Ticket #86: smartmontools-5.40-svn-3ware-9750-sata.patch

File smartmontools-5.40-svn-3ware-9750-sata.patch, 17.6 KB (added by vpayno, 14 years ago)

Patch that adds 3ware 9750 SATA support

  • dev_legacy.cpp

    diff -uNr smartmontools-orig/dev_legacy.cpp smartmontools/dev_legacy.cpp
    old new  
    416416    set_err(EINVAL, "AMCC/3ware controller, please try changing device to %s,N", get_dev_name());
    417417#else
    418418    set_err(EINVAL, "AMCC/3ware controller, please try adding '-d 3ware,N',\n"
    419                     "you may need to replace %s with /dev/twaN or /dev/tweN", get_dev_name());
     419                    "you may need to replace %s with /dev/twlN, /dev/twaN or /dev/tweN", get_dev_name());
    420420#endif
    421421    return this;
    422422  }
  • os_linux.cpp

    diff -uNr smartmontools-orig/os_linux.cpp smartmontools/os_linux.cpp
    old new  
    196196                  "  smartctl --all --device=3ware,2 /dev/sda\n"
    197197                  "  smartctl --all --device=3ware,2 /dev/twe0\n"
    198198                  "  smartctl --all --device=3ware,2 /dev/twa0\n"
     199                  "  smartctl --all --device=3ware,2 /dev/twl0\n"
    199200                  "          (Prints all SMART info for 3rd ATA disk on 3ware RAID controller)\n"
    200201                  "  smartctl --all --device=hpt,1/1/3 /dev/sda\n"
    201202                  "          (Prints all SMART info for the SATA disk attached to the 3rd PMPort\n"
     
    12161217  enum escalade_type_t {
    12171218    AMCC_3WARE_678K,
    12181219    AMCC_3WARE_678K_CHAR,
    1219     AMCC_3WARE_9000_CHAR
     1220    AMCC_3WARE_9000_CHAR,
     1221    AMCC_3WARE_9700_CHAR
    12201222  };
    12211223
    12221224  linux_escalade_device(smart_interface * intf, const char * dev_name,
     
    13891391
    13901392bool linux_escalade_device::open()
    13911393{
    1392   if (m_escalade_type == AMCC_3WARE_9000_CHAR || m_escalade_type == AMCC_3WARE_678K_CHAR) {
     1394  if (m_escalade_type == AMCC_3WARE_9700_CHAR) {
     1395    // the device nodes for these controllers are dynamically assigned,
     1396    // so we need to check that they exist with the correct major
     1397    // numbers and if not, create them
     1398    const char * node   = "twl";
     1399    const char * driver = "3w-sas";
     1400    if (setup_3ware_nodes(node, driver))
     1401      return set_err((errno ? errno : ENXIO), "setup_3ware_nodes(\"%s\", \"%s\") failed", node, driver);
     1402  }
     1403  else if (m_escalade_type == AMCC_3WARE_9000_CHAR || m_escalade_type == AMCC_3WARE_678K_CHAR) {
    13931404    // the device nodes for these controllers are dynamically assigned,
    13941405    // so we need to check that they exist with the correct major
    13951406    // numbers and if not, create them
     
    14611472  memset(ioctl_buffer, 0, TW_IOCTL_BUFFER_SIZE);
    14621473
    14631474  // TODO: Handle controller differences by different classes
    1464   if (m_escalade_type==AMCC_3WARE_9000_CHAR) {
     1475  if (m_escalade_type==AMCC_3WARE_9700_CHAR) {
     1476    tw_ioctl_apache                               = (TW_Ioctl_Buf_Apache *)ioctl_buffer;
     1477    tw_ioctl_apache->driver_command.control_code  = TW_IOCTL_FIRMWARE_PASS_THROUGH;
     1478    tw_ioctl_apache->driver_command.buffer_length = 512; /* payload size */
     1479    passthru                                      = (TW_Passthru *)&(tw_ioctl_apache->firmware_command.command.oldcommand);
     1480  }
     1481  else if (m_escalade_type==AMCC_3WARE_9000_CHAR) {
    14651482    tw_ioctl_apache                               = (TW_Ioctl_Buf_Apache *)ioctl_buffer;
    14661483    tw_ioctl_apache->driver_command.control_code  = TW_IOCTL_FIRMWARE_PASS_THROUGH;
    14671484    tw_ioctl_apache->driver_command.buffer_length = 512; /* payload size */
     
    15231540    // in dwords by 1 to account for the 64-bit single sgl 'address'
    15241541    // field. Note that this doesn't agree with the typedefs but it's
    15251542    // right (agree with kernel driver behavior/typedefs).
    1526     if (m_escalade_type==AMCC_3WARE_9000_CHAR && sizeof(long)==8)
     1543    if (m_escalade_type==AMCC_3WARE_9700_CHAR && sizeof(long)==8)
     1544      passthru->size++;
     1545    else if (m_escalade_type==AMCC_3WARE_9000_CHAR && sizeof(long)==8)
    15271546      passthru->size++;
    15281547  }
    15291548  else if (in.direction == ata_cmd_in::no_data) {
     
    15351554    passthru->sector_count = 0x0;
    15361555  }
    15371556  else if (in.direction == ata_cmd_in::data_out) {
    1538     if (m_escalade_type == AMCC_3WARE_9000_CHAR)
     1557    if (m_escalade_type == AMCC_3WARE_9700_CHAR)
     1558      memcpy(tw_ioctl_apache->data_buffer, in.buffer, in.size);
     1559    else if (m_escalade_type == AMCC_3WARE_9000_CHAR)
    15391560      memcpy(tw_ioctl_apache->data_buffer, in.buffer, in.size);
    15401561    else if (m_escalade_type == AMCC_3WARE_678K_CHAR)
    15411562      memcpy(tw_ioctl_char->data_buffer,   in.buffer, in.size);
     
    15481569    passthru->byte0.sgloff = 0x5;
    15491570    passthru->size         = 0x7;  // TODO: Other value for multi-sector ?
    15501571    passthru->param        = 0xF;  // PIO data write
    1551     if (m_escalade_type==AMCC_3WARE_9000_CHAR && sizeof(long)==8)
     1572    if (m_escalade_type==AMCC_3WARE_9700_CHAR && sizeof(long)==8)
     1573      passthru->size++;
     1574    else if (m_escalade_type==AMCC_3WARE_9000_CHAR && sizeof(long)==8)
    15521575      passthru->size++;
    15531576  }
    15541577  else
     
    15561579
    15571580  // Now send the command down through an ioctl()
    15581581  int ioctlreturn;
    1559   if (m_escalade_type==AMCC_3WARE_9000_CHAR)
     1582  if (m_escalade_type==AMCC_3WARE_9700_CHAR)
     1583    ioctlreturn=ioctl(get_fd(), TW_IOCTL_FIRMWARE_PASS_THROUGH, tw_ioctl_apache);
     1584  else if (m_escalade_type==AMCC_3WARE_9000_CHAR)
    15601585    ioctlreturn=ioctl(get_fd(), TW_IOCTL_FIRMWARE_PASS_THROUGH, tw_ioctl_apache);
    15611586  else if (m_escalade_type==AMCC_3WARE_678K_CHAR)
    15621587    ioctlreturn=ioctl(get_fd(), TW_CMD_PACKET_WITH_DATA, tw_ioctl_char);
     
    16071632
    16081633  // If this is a read data command, copy data to output buffer
    16091634  if (readdata) {
    1610     if (m_escalade_type==AMCC_3WARE_9000_CHAR)
     1635    if (m_escalade_type==AMCC_3WARE_9700_CHAR)
     1636      memcpy(in.buffer, tw_ioctl_apache->data_buffer, in.size);
     1637    else if (m_escalade_type==AMCC_3WARE_9000_CHAR)
    16111638      memcpy(in.buffer, tw_ioctl_apache->data_buffer, in.size);
    16121639    else if (m_escalade_type==AMCC_3WARE_678K_CHAR)
    16131640      memcpy(in.buffer, tw_ioctl_char->data_buffer, in.size);
     
    26952722    if (!memcmp(req_buff + 8, "3ware", 5) || !memcmp(req_buff + 8, "AMCC", 4)) {
    26962723      close();
    26972724      set_err(EINVAL, "AMCC/3ware controller, please try adding '-d 3ware,N',\n"
    2698                       "you may need to replace %s with /dev/twaN or /dev/tweN", get_dev_name());
     2725                      "you may need to replace %s with /dev/twlN, /dev/twaN or /dev/tweN", get_dev_name());
    26992726      return this;
    27002727    }
    27012728
     
    29973024static const char * lin_dev_scsi_tape1 = "ns";
    29983025static const char * lin_dev_scsi_tape2 = "os";
    29993026static const char * lin_dev_scsi_tape3 = "nos";
     3027static const char * lin_dev_3ware_9700_char = "twl";
    30003028static const char * lin_dev_3ware_9000_char = "twa";
    30013029static const char * lin_dev_3ware_678k_char = "twe";
    30023030static const char * lin_dev_cciss_dir = "cciss/";
     
    30803108               strlen(lin_dev_scsi_tape3)))
    30813109    return new linux_scsi_device(this, name, "");
    30823110
     3111  // form /dev/twl*
     3112  if (!strncmp(lin_dev_3ware_9700_char, dev_name,
     3113               strlen(lin_dev_3ware_9700_char)))
     3114    return missing_option("-d 3ware,N");
     3115
    30833116  // form /dev/twa*
    30843117  if (!strncmp(lin_dev_3ware_9000_char, dev_name,
    30853118               strlen(lin_dev_3ware_9000_char)))
     
    31223155      return 0;
    31233156    }
    31243157
    3125     if (!strncmp(name, "/dev/twa", 8))
     3158    if (!strncmp(name, "/dev/twl", 8))
     3159      return new linux_escalade_device(this, name, linux_escalade_device::AMCC_3WARE_9700_CHAR, disknum);
     3160    else if (!strncmp(name, "/dev/twa", 8))
    31263161      return new linux_escalade_device(this, name, linux_escalade_device::AMCC_3WARE_9000_CHAR, disknum);
    31273162    else if (!strncmp(name, "/dev/twe", 8))
    31283163      return new linux_escalade_device(this, name, linux_escalade_device::AMCC_3WARE_678K_CHAR, disknum);
  • smartctl.8.in

    diff -uNr smartmontools-orig/smartctl.8.in smartmontools/smartctl.8.in
    old new  
    6565\fB"/dev/sg*"\fP.  For SATA disks accessed with libata, use
    6666\fB"/dev/sd[a\-z]"\fP and append \fB"\-d ata"\fP. For disks behind
    67673ware controllers you may need \fB"/dev/sd[a\-z]"\fP or
    68 \fB"/dev/twe[0\-9]"\fP or \fB"/dev/twa[0\-9]"\fP: see details
     68\fB"/dev/twe[0\-9]"\fP, \fB"/dev/twa[0\-9]"\fP or  \fB"/dev/twl[0\-9]"\fP: see details
    6969below. For disks behind HighPoint RocketRAID controllers you may need
    7070\fB"/dev/sd[a\-z]"\fP.  For disks behind Areca SATA RAID controllers,
    7171you need \fB"/dev/sg[2\-9]"\fP (note that smartmontools interacts with
     
    303303.nf
    304304\fBsmartctl \-a \-d 3ware,1 /dev/twa0\fP
    305305.fi
     306.nf
     307\fBsmartctl \-a \-d 3ware,1 /dev/twl0\fP
     308.fi
    306309where in the argument \fI3ware,N\fP, the integer N is the disk number
    307310(3ware \'port\') within the 3ware ATA RAID controller.  The allowed
    308311values of N are from 0 to 127 inclusive.  The first two forms, which
     
    314317/dev/twa0\-15, must be used with 3ware 9000 series controllers, which
    315318use the 3w\-9xxx driver.
    316319
    317 Note that if the special character device nodes /dev/twa? and
    318 /dev/twe? do not exist, or exist with the incorrect major or minor
     320The devices /dev/twl0\-15 must be used with the 3ware/LSI 9750 series
     321controllers which use the 3w-sas driver.
     322
     323Note that if the special character device nodes /dev/twl?, /dev/twa?
     324and /dev/twe? do not exist, or exist with the incorrect major or minor
    319325numbers, smartctl will recreate them on the fly.  Typically /dev/twa0
    320326refers to the first 9000\-series controller, /dev/twa1 refers to the
    321 second 9000 series controller, and so on. Likewise /dev/twe0 refers to
    322 the first 6/7/8000\-series controller, /dev/twa1 refers to the second
     327second 9000 series controller, and so on. The /dev/twl0 devices refers
     328to the first 9750 series controller, /dev/twl1 resfers to the second
     3299750 series controller, and so on. Likewise /dev/twe0 refers to
     330the first 6/7/8000\-series controller, /dev/twe1 refers to the second
    3233316/7/8000 series controller, and so on.
    324332
    325333Note that for the 6/7/8000 controllers, \fBany\fP of the physical
     
    354362instructions.  Alternatively, use the character device /dev/twe0\-15 interface.
    355363
    356364The selective self\-test functions (\'\-t select,A\-B\') are only supported
    357 using the character device interface /dev/twa0\-15 and /dev/twe0\-15.
     365using the character device interface /dev/twl0\-15, /dev/twa0\-15 and /dev/twe0\-15.
    358366The necessary WRITE LOG commands can not be passed through the SCSI
    359367interface.
    360368
     
    16881696.nf
    16891697.B smartctl \-a \-d 3ware,0 /dev/twa0
    16901698.fi
    1691 Examine all SMART data for the first ATA disk connected to a 3ware
    1692 RAID 9000 controller card.
     1699Examine all SMART data for the first ATA disk connected to a
     17003ware RAID 9000 controller card.
     1701.PP
     1702.nf
     1703.B smartctl \-a \-d 3ware,0 /dev/twl0
     1704.fi
     1705Examine all SMART data for the first SATA (not SAS) disk connected to a
     17063ware RAID 9750 controller card.
    16931707.PP
    16941708.nf
    16951709.B smartctl \-t short \-d 3ware,3 /dev/sdb
  • smartd.8.in

    diff -uNr smartmontools-orig/smartd.8.in smartmontools/smartd.8.in
    old new  
    606606.B \ \ /dev/twa0 -d 3ware,1 -a -s L/../../7/02
    607607.B #
    608608.nf
     609.B # Two SATA (not SAS) disks on a 3ware 9750 controller.
     610.B # Start long self-tests Sundays between  midnight and
     611.B # 1am and 2-3 am
     612.B \ \ /dev/twl0 -d 3ware,0 -a -s L/../../7/00
     613.B \ \ /dev/twl0 -d 3ware,1 -a -s L/../../7/02
     614.B #
     615.nf
    609616.B # Three SATA disks on a HighPoint RocketRAID controller.
    610617.B # Start short self-tests daily between 1-2, 2-3, and
    611618.B # 3-4 am.
     
    695702status fails, or if new errors appear in the self-test log.
    696703
    697704.B If a 3ware controller is used
    698 then the corresponding SCSI (/dev/sd?) or character device (/dev/twe?
    699 or /dev/twa?) must be listed, along with the \'\-d 3ware,N\' Directive
    700 (see below).  The individual ATA disks hosted by the 3ware controller
    701 appear to \fBsmartd\fP as normal ATA devices.  Hence all the ATA
    702 directives can be used for these disks (but see note below).
     705then the corresponding SCSI (/dev/sd?) or character device (/dev/twe?,
     706/dev/twa? or /dev/twl?) must be listed, along with the \'\-d 3ware,N\'
     707Directive (see below).  The individual ATA disks hosted by the 3ware
     708controller appear to \fBsmartd\fP as normal ATA devices.  Hence all
     709the ATA directives can be used for these disks (but see note below).
    703710
    704711.B If an Areca controller is used
    705712then the corresponding SCSI generic device (/dev/sg?)  must be listed,
     
    783790
    784791ATA disks behind 3ware controllers may alternatively be accessed via a
    785792character device interface /dev/twe0-15 (3ware 6000/7000/8000
    786 controllers) and /dev/twa0-15 (3ware 9000 series controllers).  Note
    787 that the 9000 series controllers may \fBonly\fP be accessed using the
    788 character device interface /dev/twa0-15 and not the SCSI device
    789 interface /dev/sd?.  Please see the \fBsmartctl\fP(8) man page for
    790 further details.
     793controllers), /dev/twa0-15 (3ware 9000 series controllers) and
     794/dev/twl0-15 (3ware 9750 series controllers).  Note that the 9000 series
     795controllers may \fBonly\fP be accessed using the character device
     796interface /dev/twa0-15 and not the SCSI device interface /dev/sd?. 
     797Please see the \fBsmartctl\fP(8) man page for further details.
    791798
    792799Note that older 3w-xxxx drivers do not pass the \'Enable Autosave\'
    793800(\fB-S on\fP) and \'Enable Automatic Offline\' (\fB-o on\fP) commands
     
    798805patch to older versions.  See
    799806\fBhttp://smartmontools.sourceforge.net/\fP for instructions.
    800807Alternatively use the character device interfaces /dev/twe0-15 (3ware
    801 6/7/8000 series controllers) or /dev/twa0-15 (3ware 9000 series
    802 controllers).
     8086/7/8000 series controllers), /dev/twa0-15 (3ware 9000 series
     809controllers) or /dev/twl0-15 (3ware 9750 series controllers).
    803810
    804811.I areca,N
    805812\- the device consists of one or more SATA disks connected to an Areca
  • smartd.conf

    diff -uNr smartmontools-orig/smartd.conf smartmontools/smartd.conf
    old new  
    7676#/dev/sdc -d 3ware,2 -a -s L/../../7/03
    7777#/dev/sdc -d 3ware,3 -a -s L/../../7/04
    7878
    79 # Monitor 2 ATA disks connected to a 3ware 9000 controller which uses
    80 # the 3w-9xxx driver (Linux, FreeBSD). Start long self-tests Tuesdays
     79# Monitor 2 ATA disks connected to a 3ware 9000 controller which
     80# uses the 3w-9xxx driver (Linux, FreeBSD). Start long self-tests Tuesdays
    8181# between 1-2 and 3-4 am.
    8282#/dev/twa0 -d 3ware,0 -a -s L/../../2/01
    8383#/dev/twa0 -d 3ware,1 -a -s L/../../2/03
    8484
     85# Monitor 2 SATA (not SAS) disks connected to a 3ware 9000 controller which
     86# uses the 3w-sas driver (Linux, FreeBSD). Start long self-tests Tuesdays
     87# between 1-2 and 3-4 am.
     88#/dev/twl0 -d 3ware,0 -a -s L/../../2/01
     89#/dev/twa0 -d 3ware,1 -a -s L/../../2/03
     90
    8591# Same as above for Windows. Option '-d 3ware,N' is not necessary,
    8692# disk (port) number is specified in device name.
    8793# NOTE: On Windows, DEVICESCAN works also for 3ware controllers.
  • smartd.conf.5.in

    diff -uNr smartmontools-orig/smartd.conf.5.in smartmontools/smartd.conf.5.in
    old new  
    182182.B \ \ /dev/twa0 -d 3ware,1 -a -s L/../../7/02
    183183.B #
    184184.nf
     185.B # Two SATA (not SAS) disks on a 3ware 9750 controller.
     186.B # Start long self-tests Sundays between  midnight and
     187.B # 1am and 2-3 am
     188.B \ \ /dev/twl0 -d 3ware,0 -a -s L/../../7/00
     189.B \ \ /dev/twl0 -d 3ware,1 -a -s L/../../7/02
     190.B #
     191.nf
    185192.B # Three SATA disks on a HighPoint RocketRAID controller.
    186193.B # Start short self-tests daily between 1-2, 2-3, and
    187194.B # 3-4 am.
     
    271278status fails, or if new errors appear in the self-test log.
    272279
    273280.B If a 3ware controller is used
    274 then the corresponding SCSI (/dev/sd?) or character device (/dev/twe?
    275 or /dev/twa?) must be listed, along with the \'\-d 3ware,N\' Directive
    276 (see below).  The individual ATA disks hosted by the 3ware controller
    277 appear to \fBsmartd\fP as normal ATA devices.  Hence all the ATA
    278 directives can be used for these disks (but see note below).
     281then the corresponding SCSI (/dev/sd?) or character device (/dev/twe?,
     282/dev/twa? or /dev/twl?) must be listed, along with the \'\-d 3ware,N\'
     283Directive (see below).  The individual ATA disks hosted by the 3ware
     284controller appear to \fBsmartd\fP as normal ATA devices.  Hence all the
     285ATA directives can be used for these disks (but see note below).
    279286
    280287.B If an Areca controller is used
    281288then the corresponding SCSI generic device (/dev/sg?)  must be listed,
     
    359366
    360367ATA disks behind 3ware controllers may alternatively be accessed via a
    361368character device interface /dev/twe0-15 (3ware 6000/7000/8000
    362 controllers) and /dev/twa0-15 (3ware 9000 series controllers).  Note
    363 that the 9000 series controllers may \fBonly\fP be accessed using the
    364 character device interface /dev/twa0-15 and not the SCSI device
    365 interface /dev/sd?.  Please see the \fBsmartctl\fP(8) man page for
    366 further details.
     369controllers), /dev/twa0-15 (3ware 9000 series controllers), and
     370/dev/twl0-15 (3ware 9750 series controllers).  Note that the 9000 series
     371controllers may \fBonly\fP be accessed using the character device
     372interface /dev/twa0-15 and not the SCSI device interface /dev/sd?. 
     373Please see the \fBsmartctl\fP(8) man page for further details.
    367374
    368375Note that older 3w-xxxx drivers do not pass the \'Enable Autosave\'
    369376(\fB-S on\fP) and \'Enable Automatic Offline\' (\fB-o on\fP) commands
     
    374381patch to older versions.  See
    375382\fBhttp://smartmontools.sourceforge.net/\fP for instructions.
    376383Alternatively use the character device interfaces /dev/twe0-15 (3ware
    377 6/7/8000 series controllers) or /dev/twa0-15 (3ware 9000 series
    378 controllers).
     3846/7/8000 series controllers), /dev/twa0-15 (3ware 9000 series
     385controllers) or /dev/twl0-15 (3ware 9750 series controllers).
    379386
    380387.I areca,N
    381388\- the device consists of one or more SATA disks connected to an Areca