diff --git a/sm5/CHANGELOG b/sm5/CHANGELOG
index 1f6368318efba2673d291b3e1f7e74db030f0673..4fe0acbc05ecfb4babbd1331045c08331ad6463c 100644
--- a/sm5/CHANGELOG
+++ b/sm5/CHANGELOG
@@ -1,6 +1,6 @@
 CHANGELOG for smartmontools
 
-$Id: CHANGELOG,v 1.619 2007/06/15 16:23:13 guidog Exp $
+$Id: CHANGELOG,v 1.620 2007/07/09 01:57:31 ballen4705 Exp $
 
 The most recent version of this file is:
 http://smartmontools.cvs.sourceforge.net/smartmontools/sm5/CHANGELOG?view=markup
@@ -33,6 +33,10 @@ NOTES FOR FUTURE RELEASES: see TODO file.
 
 <DEVELOPERS: ADDITIONS TO THE CHANGE LOG GO JUST BELOW HERE, PLEASE>
 
+  [BA] Updated smartctl and smartd so that they can be used with the latest
+       3ware controllers which have 24 ports.  Also updated docs.
+       Thanks to Tim Bell at CERN.
+
   [GG] bit 4 in smartctl's return code might be set even when the dist check
        didn't return "DISK OK"
 
diff --git a/sm5/smartctl.8.in b/sm5/smartctl.8.in
index 789ed0c3b4883ea188776080ae3cfd320f78145a..1be45468af0976f9d26b7dfe7a96aa40bedf185e 100644
--- a/sm5/smartctl.8.in
+++ b/sm5/smartctl.8.in
@@ -1,7 +1,7 @@
 .ig
  Copyright (C) 2002-7 Bruce Allen <smartmontools-support@lists.sourceforge.net>
 
- $Id: smartctl.8.in,v 1.96 2007/06/15 16:23:13 guidog Exp $
+ $Id: smartctl.8.in,v 1.97 2007/07/09 01:57:31 ballen4705 Exp $
  
  This program is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published by the Free
@@ -228,7 +228,7 @@ use syntax such as:
 .fi
 where in the argument \fI3ware,N\fP, the integer N is the disk number
 (3ware \'port\') within the 3ware ATA RAID controller.  The allowed
-values of N are from 0 to 15 inclusive.  The first two forms, which
+values of N are from 0 to 23 inclusive.  The first two forms, which
 refer to devices /dev/sda\-z and /dev/twe0\-15, may be used with 3ware
 series 6000, 7000, and 8000 series controllers that use the 3x\-xxxx
 driver.  \fBNote that the /dev/sda\-z form is deprecated\fP starting
@@ -1475,7 +1475,7 @@ these documents may be found in the References section of the
 
 .SH
 CVS ID OF THIS PAGE:
-$Id: smartctl.8.in,v 1.96 2007/06/15 16:23:13 guidog Exp $
+$Id: smartctl.8.in,v 1.97 2007/07/09 01:57:31 ballen4705 Exp $
 .\" Local Variables:	         
 .\" mode: nroff         
 .\" End:
diff --git a/sm5/smartctl.cpp b/sm5/smartctl.cpp
index 6648f5b3b80324b8d1aea8257fbf81a03eaef4a0..bce6e3e11687953189e4ca3d307680c9a75f07c3 100644
--- a/sm5/smartctl.cpp
+++ b/sm5/smartctl.cpp
@@ -50,7 +50,7 @@
 extern const char *os_solaris_ata_s_cvsid;
 #endif
 extern const char *atacmdnames_c_cvsid, *atacmds_c_cvsid, *ataprint_c_cvsid, *knowndrives_c_cvsid, *os_XXXX_c_cvsid, *scsicmds_c_cvsid, *scsiprint_c_cvsid, *utility_c_cvsid;
-const char* smartctl_c_cvsid="$Id: smartctl.cpp,v 1.163 2007/05/13 14:33:33 guidog Exp $"
+const char* smartctl_c_cvsid="$Id: smartctl.cpp,v 1.164 2007/07/09 01:57:31 ballen4705 Exp $"
 ATACMDS_H_CVSID ATAPRINT_H_CVSID CONFIG_H_CVSID EXTERN_H_CVSID INT64_H_CVSID KNOWNDRIVES_H_CVSID SCSICMDS_H_CVSID SCSIPRINT_H_CVSID SMARTCTL_H_CVSID UTILITY_H_CVSID;
 
 // This is a block containing all the "control variables".  We declare
@@ -465,8 +465,8 @@ void ParseOpts (int argc, char** argv){
             if (split_report_arg2(s, &i)) {
                  sprintf(extraerror, "Option -d 3ware,N requires N to be a non-negative integer\n");
                  badarg = TRUE;
-            } else if (i<0 || i>15) {
-                 sprintf(extraerror, "Option -d 3ware,N (N=%d) must have 0 <= N <= 15\n", i);
+            } else if (i<0 || i>23) {
+                 sprintf(extraerror, "Option -d 3ware,N (N=%d) must have 0 <= N <= 23\n", i);
                  badarg = TRUE;
             } else {
  	        // NOTE: controller_port == disk number + 1
diff --git a/sm5/smartd.8.in b/sm5/smartd.8.in
index 133013475c98aa716e9cf16fee2e06c7fcb59495..77d8acfca71a2d3b3b9935305d88bd6d03793e6a 100644
--- a/sm5/smartd.8.in
+++ b/sm5/smartd.8.in
@@ -1,7 +1,7 @@
 .ig
 Copyright (C) 2002-7 Bruce Allen <smartmontools-support@lists.sourceforge.net>
  
-$Id: smartd.8.in,v 1.114 2007/01/04 15:16:16 chrfranke Exp $
+$Id: smartd.8.in,v 1.115 2007/07/09 01:57:31 ballen4705 Exp $
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -671,10 +671,10 @@ controllers (using the Marvell rather than libata driver).
 
 .I 3ware,N
 \- the device consists of one or more ATA disks connected to a 3ware
-RAID controller. The non-negative integer N (in the range from 0 to 15
+RAID controller. The non-negative integer N (in the range from 0 to 23
 inclusive) denotes which disk on the controller is monitored.  In log
 files and email messages this disk will be identified as 3ware_disk_XX
-with XX in the range from 00 to 15 inclusive.
+with XX in the range from 00 to 23 inclusive.
 
 This Directive may at first appear confusing, because the 3ware
 controller is a SCSI device (such as /dev/sda) and should be listed as
@@ -1102,7 +1102,7 @@ is set to the argument of \-M exec, if present or else to \'mail\'
 is set to the device path (examples: /dev/hda, /dev/sdb).
 .IP \fBSMARTD_DEVICETYPE\fP 4
 is set to the device type (possible values: ata, scsi, 3ware,N, hpt,L/M/N).
-Here N=0,...,15 denotes the ATA disk behind a 3ware RAID controller and
+Here N=0,...,23 denotes the ATA disk behind a 3ware RAID controller and
 L/M/N denotes the SATA disk behind a HighPoint RocketRAID controller.
 .IP \fBSMARTD_DEVICESTRING\fP 4
 is set to the device description.  For SMARTD_DEVICETYPE of ata or
@@ -1956,4 +1956,4 @@ smartmontools home page at \fBhttp://smartmontools.sourceforge.net/#references\f
 
 .SH
 CVS ID OF THIS PAGE:
-$Id: smartd.8.in,v 1.114 2007/01/04 15:16:16 chrfranke Exp $
+$Id: smartd.8.in,v 1.115 2007/07/09 01:57:31 ballen4705 Exp $
diff --git a/sm5/smartd.conf.5.in b/sm5/smartd.conf.5.in
index 1b229dd9fe61eaa3243bc45be22f573339a1ebda..3804f2cb9d913661a4f208d31812725b9b4d38be 100644
--- a/sm5/smartd.conf.5.in
+++ b/sm5/smartd.conf.5.in
@@ -1,7 +1,7 @@
 .ig
 Copyright (C) 2002-7 Bruce Allen <smartmontools-support@lists.sourceforge.net>
 
-$Id: smartd.conf.5.in,v 1.83 2007/01/04 15:16:17 chrfranke Exp $
+$Id: smartd.conf.5.in,v 1.84 2007/07/09 01:57:31 ballen4705 Exp $
 
 This program is free software; you can redistribute it and/or modify it
 under the terms of the GNU General Public License as published by the Free
@@ -298,10 +298,10 @@ controllers (using the Marvell rather than libata driver).
 
 .I 3ware,N
 \- the device consists of one or more ATA disks connected to a 3ware
-RAID controller. The non-negative integer N (in the range from 0 to 15
+RAID controller. The non-negative integer N (in the range from 0 to 23
 inclusive) denotes which disk on the controller is monitored.  In log
 files and email messages this disk will be identified as 3ware_disk_XX
-with XX in the range from 00 to 15 inclusive.
+with XX in the range from 00 to 23 inclusive.
 
 This Directive may at first appear confusing, because the 3ware
 controller is a SCSI device (such as /dev/sda) and should be listed as
@@ -729,7 +729,7 @@ is set to the argument of \-M exec, if present or else to \'mail\'
 is set to the device path (examples: /dev/hda, /dev/sdb).
 .IP \fBSMARTD_DEVICETYPE\fP 4
 is set to the device type (possible values: ata, scsi, 3ware,N, hpt,L/M/N).
-Here N=0,...,15 denotes the ATA disk behind a 3ware RAID controller and
+Here N=0,...,23 denotes the ATA disk behind a 3ware RAID controller and
 L/M/N denotes the SATA disk behind a HighPoint RocketRAID controller.
 .IP \fBSMARTD_DEVICESTRING\fP 4
 is set to the device description.  For SMARTD_DEVICETYPE of ata or
@@ -1353,4 +1353,4 @@ SEE ALSO:
 
 .SH
 CVS ID OF THIS PAGE:
-$Id: smartd.conf.5.in,v 1.83 2007/01/04 15:16:17 chrfranke Exp $
+$Id: smartd.conf.5.in,v 1.84 2007/07/09 01:57:31 ballen4705 Exp $
diff --git a/sm5/smartd.cpp b/sm5/smartd.cpp
index bae3db8d8972563f39f0aba947c8d2b13871b0d9..fee6b9031f1b29da57263b7875a1064463c2249f 100644
--- a/sm5/smartd.cpp
+++ b/sm5/smartd.cpp
@@ -119,14 +119,14 @@ extern "C" int getdomainname(char *, int); // no declaration in header files!
 extern const char *atacmdnames_c_cvsid, *atacmds_c_cvsid, *ataprint_c_cvsid, *escalade_c_cvsid, 
                   *knowndrives_c_cvsid, *os_XXXX_c_cvsid, *scsicmds_c_cvsid, *utility_c_cvsid;
 
-static const char *filenameandversion="$Id: smartd.cpp,v 1.390 2007/06/05 20:41:10 shattered Exp $";
+static const char *filenameandversion="$Id: smartd.cpp,v 1.391 2007/07/09 01:57:31 ballen4705 Exp $";
 #ifdef NEED_SOLARIS_ATA_CODE
 extern const char *os_solaris_ata_s_cvsid;
 #endif
 #ifdef _WIN32
 extern const char *daemon_win32_c_cvsid, *hostname_win32_c_cvsid, *syslog_win32_c_cvsid;
 #endif
-const char *smartd_c_cvsid="$Id: smartd.cpp,v 1.390 2007/06/05 20:41:10 shattered Exp $" 
+const char *smartd_c_cvsid="$Id: smartd.cpp,v 1.391 2007/07/09 01:57:31 ballen4705 Exp $" 
 ATACMDS_H_CVSID ATAPRINT_H_CVSID CONFIG_H_CVSID
 #ifdef DAEMON_WIN32_H_CVSID
 DAEMON_WIN32_H_CVSID
@@ -3047,8 +3047,8 @@ int ParseToken(char *token,cfgfile *cfg){
               PrintOut(LOG_CRIT, "File %s line %d (drive %s): Directive -d 3ware,N requires N integer\n",
                	       configfile, lineno, name);
               badarg=1;
-          } else if ( i<0 || i>15) {
-              PrintOut(LOG_CRIT, "File %s line %d (drive %s): Directive -d 3ware,N (N=%d) must have 0 <= N <= 15\n",
+          } else if ( i<0 || i>23) {
+              PrintOut(LOG_CRIT, "File %s line %d (drive %s): Directive -d 3ware,N (N=%d) must have 0 <= N <= 23\n",
                        configfile, lineno, name, i);
               badarg=1;
           } else {