]> git.proxmox.com Git - mirror_smartmontools-debian.git/blame - debian/patches/3w-sas
refresh patch
[mirror_smartmontools-debian.git] / debian / patches / 3w-sas
CommitLineData
88b6d448
FW
1Author: chrfranke <chrfranke@4ea69e1a-61f1-4043-bf83-b5c94c648137>
2Date: Tue Jul 27 13:08:31 2010 +0000
3
4 Linux: Support SATA drives on LSI 3ware 9750 controllers (ticket #86).
5
6Index: smartmontools-5.39.1+svn3124/CHANGELOG
7===================================================================
8--- smartmontools-5.39.1+svn3124.orig/CHANGELOG 2010-07-12 21:21:00.000000000 +0200
9+++ smartmontools-5.39.1+svn3124/CHANGELOG 2010-12-23 11:05:12.103063859 +0100
10@@ -86,6 +86,10 @@
11 This fixes build on QNX (ticket #1).
12 Thanks to Stefan (stevestereo) for testing.
13
14+ [CF] Linux: Support SATA drives on LSI 3ware 9750 controllers.
15+ Patch provided by Victor Payno (ticket #86).
16+ Modified to avoid duplicate code.
17+
18 [CF] drivedb.h update:
19 - WD Caviar Green (Adv. Format) family
20
21Index: smartmontools-5.39.1+svn3124/NEWS
22===================================================================
23--- smartmontools-5.39.1+svn3124.orig/NEWS 2010-06-11 18:21:25.000000000 +0200
24+++ smartmontools-5.39.1+svn3124/NEWS 2010-12-23 11:05:12.103063859 +0100
25@@ -22,6 +22,7 @@
26 SCT Error Recovery Control time limit.
27 - smartctl options '--scan, --scan-open'.
28 - Linux: Add '/dev/sd[a-c][a-z]' to smartd DEVICESCAN.
29+- Linux: Support SATA drives on LSI 3ware 9750 controllers.
30 - Windows: Read 'drivedb.h' and 'smartd.conf' from exe directory.
31 - Windows: Support for 64-bit executables.
32 - Windows: Support for cross compilation on Linux.
33Index: smartmontools-5.39.1+svn3124/os_linux.cpp
34===================================================================
35--- smartmontools-5.39.1+svn3124.orig/os_linux.cpp 2010-04-30 19:35:35.000000000 +0200
36+++ smartmontools-5.39.1+svn3124/os_linux.cpp 2010-12-23 11:05:12.103063859 +0100
37@@ -196,6 +196,7 @@
38 " smartctl --all --device=3ware,2 /dev/sda\n"
39 " smartctl --all --device=3ware,2 /dev/twe0\n"
40 " smartctl --all --device=3ware,2 /dev/twa0\n"
41+ " smartctl --all --device=3ware,2 /dev/twl0\n"
42 " (Prints all SMART info for 3rd ATA disk on 3ware RAID controller)\n"
43 " smartctl --all --device=hpt,1/1/3 /dev/sda\n"
44 " (Prints all SMART info for the SATA disk attached to the 3rd PMPort\n"
45@@ -1216,7 +1217,8 @@
46 enum escalade_type_t {
47 AMCC_3WARE_678K,
48 AMCC_3WARE_678K_CHAR,
49- AMCC_3WARE_9000_CHAR
50+ AMCC_3WARE_9000_CHAR,
51+ AMCC_3WARE_9700_CHAR
52 };
53
54 linux_escalade_device(smart_interface * intf, const char * dev_name,
55@@ -1389,12 +1391,17 @@
56
57 bool linux_escalade_device::open()
58 {
59- if (m_escalade_type == AMCC_3WARE_9000_CHAR || m_escalade_type == AMCC_3WARE_678K_CHAR) {
60+ if (m_escalade_type == AMCC_3WARE_9700_CHAR || m_escalade_type == AMCC_3WARE_9000_CHAR ||
61+ m_escalade_type == AMCC_3WARE_678K_CHAR) {
62 // the device nodes for these controllers are dynamically assigned,
63 // so we need to check that they exist with the correct major
64 // numbers and if not, create them
65- const char * node = (m_escalade_type == AMCC_3WARE_9000_CHAR ? "twa" : "twe" );
66- const char * driver = (m_escalade_type == AMCC_3WARE_9000_CHAR ? "3w-9xxx": "3w-xxxx");
67+ const char * node = (m_escalade_type == AMCC_3WARE_9700_CHAR ? "twl" :
68+ m_escalade_type == AMCC_3WARE_9000_CHAR ? "twa" :
69+ "twe" );
70+ const char * driver = (m_escalade_type == AMCC_3WARE_9700_CHAR ? "3w-sas" :
71+ m_escalade_type == AMCC_3WARE_9000_CHAR ? "3w-9xxx" :
72+ "3w-xxxx" );
73 if (setup_3ware_nodes(node, driver))
74 return set_err((errno ? errno : ENXIO), "setup_3ware_nodes(\"%s\", \"%s\") failed", node, driver);
75 }
76@@ -1461,7 +1468,7 @@
77 memset(ioctl_buffer, 0, TW_IOCTL_BUFFER_SIZE);
78
79 // TODO: Handle controller differences by different classes
80- if (m_escalade_type==AMCC_3WARE_9000_CHAR) {
81+ if (m_escalade_type == AMCC_3WARE_9700_CHAR || m_escalade_type == AMCC_3WARE_9000_CHAR) {
82 tw_ioctl_apache = (TW_Ioctl_Buf_Apache *)ioctl_buffer;
83 tw_ioctl_apache->driver_command.control_code = TW_IOCTL_FIRMWARE_PASS_THROUGH;
84 tw_ioctl_apache->driver_command.buffer_length = 512; /* payload size */
85@@ -1523,7 +1530,8 @@
86 // in dwords by 1 to account for the 64-bit single sgl 'address'
87 // field. Note that this doesn't agree with the typedefs but it's
88 // right (agree with kernel driver behavior/typedefs).
89- if (m_escalade_type==AMCC_3WARE_9000_CHAR && sizeof(long)==8)
90+ if ((m_escalade_type == AMCC_3WARE_9700_CHAR || m_escalade_type == AMCC_3WARE_9000_CHAR)
91+ && sizeof(long) == 8)
92 passthru->size++;
93 }
94 else if (in.direction == ata_cmd_in::no_data) {
95@@ -1535,7 +1543,7 @@
96 passthru->sector_count = 0x0;
97 }
98 else if (in.direction == ata_cmd_in::data_out) {
99- if (m_escalade_type == AMCC_3WARE_9000_CHAR)
100+ if (m_escalade_type == AMCC_3WARE_9700_CHAR || m_escalade_type == AMCC_3WARE_9000_CHAR)
101 memcpy(tw_ioctl_apache->data_buffer, in.buffer, in.size);
102 else if (m_escalade_type == AMCC_3WARE_678K_CHAR)
103 memcpy(tw_ioctl_char->data_buffer, in.buffer, in.size);
104@@ -1548,7 +1556,8 @@
105 passthru->byte0.sgloff = 0x5;
106 passthru->size = 0x7; // TODO: Other value for multi-sector ?
107 passthru->param = 0xF; // PIO data write
108- if (m_escalade_type==AMCC_3WARE_9000_CHAR && sizeof(long)==8)
109+ if ((m_escalade_type == AMCC_3WARE_9700_CHAR || m_escalade_type == AMCC_3WARE_9000_CHAR)
110+ && sizeof(long) == 8)
111 passthru->size++;
112 }
113 else
114@@ -1556,7 +1565,7 @@
115
116 // Now send the command down through an ioctl()
117 int ioctlreturn;
118- if (m_escalade_type==AMCC_3WARE_9000_CHAR)
119+ if (m_escalade_type == AMCC_3WARE_9700_CHAR || m_escalade_type == AMCC_3WARE_9000_CHAR)
120 ioctlreturn=ioctl(get_fd(), TW_IOCTL_FIRMWARE_PASS_THROUGH, tw_ioctl_apache);
121 else if (m_escalade_type==AMCC_3WARE_678K_CHAR)
122 ioctlreturn=ioctl(get_fd(), TW_CMD_PACKET_WITH_DATA, tw_ioctl_char);
123@@ -1607,7 +1616,7 @@
124
125 // If this is a read data command, copy data to output buffer
126 if (readdata) {
127- if (m_escalade_type==AMCC_3WARE_9000_CHAR)
128+ if (m_escalade_type == AMCC_3WARE_9700_CHAR || m_escalade_type == AMCC_3WARE_9000_CHAR)
129 memcpy(in.buffer, tw_ioctl_apache->data_buffer, in.size);
130 else if (m_escalade_type==AMCC_3WARE_678K_CHAR)
131 memcpy(in.buffer, tw_ioctl_char->data_buffer, in.size);
132@@ -2695,7 +2704,7 @@
133 if (!memcmp(req_buff + 8, "3ware", 5) || !memcmp(req_buff + 8, "AMCC", 4)) {
134 close();
135 set_err(EINVAL, "AMCC/3ware controller, please try adding '-d 3ware,N',\n"
136- "you may need to replace %s with /dev/twaN or /dev/tweN", get_dev_name());
137+ "you may need to replace %s with /dev/twlN, /dev/twaN or /dev/tweN", get_dev_name());
138 return this;
139 }
140
141@@ -2997,6 +3006,7 @@
142 static const char * lin_dev_scsi_tape1 = "ns";
143 static const char * lin_dev_scsi_tape2 = "os";
144 static const char * lin_dev_scsi_tape3 = "nos";
145+static const char * lin_dev_3ware_9700_char = "twl";
146 static const char * lin_dev_3ware_9000_char = "twa";
147 static const char * lin_dev_3ware_678k_char = "twe";
148 static const char * lin_dev_cciss_dir = "cciss/";
149@@ -3080,6 +3090,11 @@
150 strlen(lin_dev_scsi_tape3)))
151 return new linux_scsi_device(this, name, "");
152
153+ // form /dev/twl*
154+ if (!strncmp(lin_dev_3ware_9700_char, dev_name,
155+ strlen(lin_dev_3ware_9700_char)))
156+ return missing_option("-d 3ware,N");
157+
158 // form /dev/twa*
159 if (!strncmp(lin_dev_3ware_9000_char, dev_name,
160 strlen(lin_dev_3ware_9000_char)))
161@@ -3122,7 +3137,9 @@
162 return 0;
163 }
164
165- if (!strncmp(name, "/dev/twa", 8))
166+ if (!strncmp(name, "/dev/twl", 8))
167+ return new linux_escalade_device(this, name, linux_escalade_device::AMCC_3WARE_9700_CHAR, disknum);
168+ else if (!strncmp(name, "/dev/twa", 8))
169 return new linux_escalade_device(this, name, linux_escalade_device::AMCC_3WARE_9000_CHAR, disknum);
170 else if (!strncmp(name, "/dev/twe", 8))
171 return new linux_escalade_device(this, name, linux_escalade_device::AMCC_3WARE_678K_CHAR, disknum);
172Index: smartmontools-5.39.1+svn3124/smartctl.8.in
173===================================================================
174--- smartmontools-5.39.1+svn3124.orig/smartctl.8.in 2010-06-11 18:21:25.000000000 +0200
175+++ smartmontools-5.39.1+svn3124/smartctl.8.in 2010-12-23 11:05:12.103063859 +0100
176@@ -65,7 +65,7 @@
177 \fB"/dev/sg*"\fP. For SATA disks accessed with libata, use
178 \fB"/dev/sd[a\-z]"\fP and append \fB"\-d ata"\fP. For disks behind
179 3ware controllers you may need \fB"/dev/sd[a\-z]"\fP or
180-\fB"/dev/twe[0\-9]"\fP or \fB"/dev/twa[0\-9]"\fP: see details
181+\fB"/dev/twe[0\-9]"\fP, \fB"/dev/twa[0\-9]"\fP or \fB"/dev/twl[0\-9]"\fP: see details
182 below. For disks behind HighPoint RocketRAID controllers you may need
183 \fB"/dev/sd[a\-z]"\fP. For disks behind Areca SATA RAID controllers,
184 you need \fB"/dev/sg[2\-9]"\fP (note that smartmontools interacts with
185@@ -303,6 +303,9 @@
186 .nf
187 \fBsmartctl \-a \-d 3ware,1 /dev/twa0\fP
188 .fi
189+.nf
190+\fBsmartctl \-a \-d 3ware,1 /dev/twl0\fP
191+.fi
192 where in the argument \fI3ware,N\fP, the integer N is the disk number
193 (3ware \'port\') within the 3ware ATA RAID controller. The allowed
194 values of N are from 0 to 127 inclusive. The first two forms, which
195@@ -314,12 +317,17 @@
196 /dev/twa0\-15, must be used with 3ware 9000 series controllers, which
197 use the 3w\-9xxx driver.
198
199-Note that if the special character device nodes /dev/twa? and
200-/dev/twe? do not exist, or exist with the incorrect major or minor
201+The devices /dev/twl0\-15 must be used with the 3ware/LSI 9750 series
202+controllers which use the 3w-sas driver.
203+
204+Note that if the special character device nodes /dev/twl?, /dev/twa?
205+and /dev/twe? do not exist, or exist with the incorrect major or minor
206 numbers, smartctl will recreate them on the fly. Typically /dev/twa0
207 refers to the first 9000\-series controller, /dev/twa1 refers to the
208-second 9000 series controller, and so on. Likewise /dev/twe0 refers to
209-the first 6/7/8000\-series controller, /dev/twa1 refers to the second
210+second 9000 series controller, and so on. The /dev/twl0 devices refers
211+to the first 9750 series controller, /dev/twl1 resfers to the second
212+9750 series controller, and so on. Likewise /dev/twe0 refers to
213+the first 6/7/8000\-series controller, /dev/twe1 refers to the second
214 6/7/8000 series controller, and so on.
215
216 Note that for the 6/7/8000 controllers, \fBany\fP of the physical
217@@ -354,7 +362,7 @@
218 instructions. Alternatively, use the character device /dev/twe0\-15 interface.
219
220 The selective self\-test functions (\'\-t select,A\-B\') are only supported
221-using the character device interface /dev/twa0\-15 and /dev/twe0\-15.
222+using the character device interface /dev/twl0\-15, /dev/twa0\-15 and /dev/twe0\-15.
223 The necessary WRITE LOG commands can not be passed through the SCSI
224 interface.
225
226@@ -1688,8 +1696,14 @@
227 .nf
228 .B smartctl \-a \-d 3ware,0 /dev/twa0
229 .fi
230-Examine all SMART data for the first ATA disk connected to a 3ware
231-RAID 9000 controller card.
232+Examine all SMART data for the first ATA disk connected to a
233+3ware RAID 9000 controller card.
234+.PP
235+.nf
236+.B smartctl \-a \-d 3ware,0 /dev/twl0
237+.fi
238+Examine all SMART data for the first SATA (not SAS) disk connected to a
239+3ware RAID 9750 controller card.
240 .PP
241 .nf
242 .B smartctl \-t short \-d 3ware,3 /dev/sdb
243Index: smartmontools-5.39.1+svn3124/smartd.8.in
244===================================================================
245--- smartmontools-5.39.1+svn3124.orig/smartd.8.in 2010-12-23 11:00:15.000000000 +0100
246+++ smartmontools-5.39.1+svn3124/smartd.8.in 2010-12-23 11:06:26.676860226 +0100
247@@ -601,10 +601,17 @@
248 .B #
249 .nf
250 .B # Two ATA disks on a 3ware 9000 controller.
251-.B # Start long self-tests Sundays between midnight and
252+.B # Start long self-tests Sundays between midnight and
253 .B # 1am and 2-3 am
254 .B \ \ /dev/twa0 -d 3ware,0 -a -s L/../../7/00
255 .B \ \ /dev/twa0 -d 3ware,1 -a -s L/../../7/02
256+.nf
257+.B #
258+.B # Two SATA (not SAS) disks on a 3ware 9750 controller.
259+.B # Start long self-tests Sundays between midnight and
260+.B # 1am and 2-3 am
261+.B \ \ /dev/twl0 -d 3ware,0 -a -s L/../../7/00
262+.B \ \ /dev/twl0 -d 3ware,1 -a -s L/../../7/02
263 .B #
264 .nf
265 .B # Monitor 2 disks connected to the first HP SmartArray controller which
266@@ -703,11 +710,11 @@
267 status fails, or if new errors appear in the self-test log.
268
269 .B If a 3ware controller is used
270-then the corresponding SCSI (/dev/sd?) or character device (/dev/twe?
271-or /dev/twa?) must be listed, along with the \'\-d 3ware,N\' Directive
272-(see below). The individual ATA disks hosted by the 3ware controller
273-appear to \fBsmartd\fP as normal ATA devices. Hence all the ATA
274-directives can be used for these disks (but see note below).
275+then the corresponding SCSI (/dev/sd?) or character device (/dev/twe?,
276+/dev/twa? or /dev/twl?) must be listed, along with the \'\-d 3ware,N\'
277+Directive (see below). The individual ATA disks hosted by the 3ware
278+controller appear to \fBsmartd\fP as normal ATA devices. Hence all
279+the ATA directives can be used for these disks (but see note below).
280
281 .B If an Areca controller is used
282 then the corresponding SCSI generic device (/dev/sg?) must be listed,
283@@ -791,11 +798,11 @@
284
285 ATA disks behind 3ware controllers may alternatively be accessed via a
286 character device interface /dev/twe0-15 (3ware 6000/7000/8000
287-controllers) and /dev/twa0-15 (3ware 9000 series controllers). Note
288-that the 9000 series controllers may \fBonly\fP be accessed using the
289-character device interface /dev/twa0-15 and not the SCSI device
290-interface /dev/sd?. Please see the \fBsmartctl\fP(8) man page for
291-further details.
292+controllers), /dev/twa0-15 (3ware 9000 series controllers) and
293+/dev/twl0-15 (3ware 9750 series controllers). Note that the 9000 series
294+controllers may \fBonly\fP be accessed using the character device
295+interface /dev/twa0-15 and not the SCSI device interface /dev/sd?.
296+Please see the \fBsmartctl\fP(8) man page for further details.
297
298 Note that older 3w-xxxx drivers do not pass the \'Enable Autosave\'
299 (\fB-S on\fP) and \'Enable Automatic Offline\' (\fB-o on\fP) commands
300@@ -806,8 +813,8 @@
301 patch to older versions. See
302 \fBhttp://smartmontools.sourceforge.net/\fP for instructions.
303 Alternatively use the character device interfaces /dev/twe0-15 (3ware
304-6/7/8000 series controllers) or /dev/twa0-15 (3ware 9000 series
305-controllers).
306+6/7/8000 series controllers), /dev/twa0-15 (3ware 9000 series
307+controllers) or /dev/twl0-15 (3ware 9750 series controllers).
308
309 .I areca,N
310 \- the device consists of one or more SATA disks connected to an Areca
311Index: smartmontools-5.39.1+svn3124/smartd.conf
312===================================================================
313--- smartmontools-5.39.1+svn3124.orig/smartd.conf 2010-12-23 11:00:15.000000000 +0100
314+++ smartmontools-5.39.1+svn3124/smartd.conf 2010-12-23 11:05:12.107063211 +0100
315@@ -75,12 +75,18 @@
316 #/dev/sdc -d 3ware,2 -a -s L/../../7/03
317 #/dev/sdc -d 3ware,3 -a -s L/../../7/04
318
319-# Monitor 2 ATA disks connected to a 3ware 9000 controller which uses
320-# the 3w-9xxx driver (Linux, FreeBSD). Start long self-tests Tuesdays
321+# Monitor 2 ATA disks connected to a 3ware 9000 controller which
322+# uses the 3w-9xxx driver (Linux, FreeBSD). Start long self-tests Tuesdays
323 # between 1-2 and 3-4 am.
324 #/dev/twa0 -d 3ware,0 -a -s L/../../2/01
325 #/dev/twa0 -d 3ware,1 -a -s L/../../2/03
326
327+# Monitor 2 SATA (not SAS) disks connected to a 3ware 9000 controller which
328+# uses the 3w-sas driver (Linux, FreeBSD). Start long self-tests Tuesdays
329+# between 1-2 and 3-4 am.
330+#/dev/twl0 -d 3ware,0 -a -s L/../../2/01
331+#/dev/twa0 -d 3ware,1 -a -s L/../../2/03
332+
333 # Same as above for Windows. Option '-d 3ware,N' is not necessary,
334 # disk (port) number is specified in device name.
335 # NOTE: On Windows, DEVICESCAN works also for 3ware controllers.
336Index: smartmontools-5.39.1+svn3124/smartd.conf.5.in
337===================================================================
338--- smartmontools-5.39.1+svn3124.orig/smartd.conf.5.in 2010-12-23 11:00:15.000000000 +0100
339+++ smartmontools-5.39.1+svn3124/smartd.conf.5.in 2010-12-23 11:07:46.278565643 +0100
340@@ -177,12 +177,19 @@
341 .B #
342 .nf
343 .B # Two ATA disks on a 3ware 9000 controller.
344-.B # Start long self-tests Sundays between midnight and
345+.B # Start long self-tests Sundays between midnight and
346 .B # 1am and 2-3 am
347 .B \ \ /dev/twa0 -d 3ware,0 -a -s L/../../7/00
348 .B \ \ /dev/twa0 -d 3ware,1 -a -s L/../../7/02
349 .B #
350 .nf
351+.B # Two SATA (not SAS) disks on a 3ware 9750 controller.
352+.B # Start long self-tests Sundays between midnight and
353+.B # 1am and 2-3 am
354+.B \ \ /dev/twl0 -d 3ware,0 -a -s L/../../7/00
355+.B \ \ /dev/twl0 -d 3ware,1 -a -s L/../../7/02
356+.B #
357+.nf
358 .B # Monitor 2 disks connected to the first HP SmartArray controller which
359 .B # uses the cciss driver. Start long tests on Sunday nights and short
360 .B # self-tests every night and send errors to root
361@@ -279,11 +286,11 @@
362 status fails, or if new errors appear in the self-test log.
363
364 .B If a 3ware controller is used
365-then the corresponding SCSI (/dev/sd?) or character device (/dev/twe?
366-or /dev/twa?) must be listed, along with the \'\-d 3ware,N\' Directive
367-(see below). The individual ATA disks hosted by the 3ware controller
368-appear to \fBsmartd\fP as normal ATA devices. Hence all the ATA
369-directives can be used for these disks (but see note below).
370+then the corresponding SCSI (/dev/sd?) or character device (/dev/twe?,
371+/dev/twa? or /dev/twl?) must be listed, along with the \'\-d 3ware,N\'
372+Directive (see below). The individual ATA disks hosted by the 3ware
373+controller appear to \fBsmartd\fP as normal ATA devices. Hence all
374+the ATA directives can be used for these disks (but see note below).
375
376 .B If an Areca controller is used
377 then the corresponding SCSI generic device (/dev/sg?) must be listed,
378@@ -367,11 +374,11 @@
379
380 ATA disks behind 3ware controllers may alternatively be accessed via a
381 character device interface /dev/twe0-15 (3ware 6000/7000/8000
382-controllers) and /dev/twa0-15 (3ware 9000 series controllers). Note
383-that the 9000 series controllers may \fBonly\fP be accessed using the
384-character device interface /dev/twa0-15 and not the SCSI device
385-interface /dev/sd?. Please see the \fBsmartctl\fP(8) man page for
386-further details.
387+controllers), /dev/twa0-15 (3ware 9000 series controllers) and
388+/dev/twl0-15 (3ware 9750 series controllers). Note that the 9000 series
389+controllers may \fBonly\fP be accessed using the character device
390+interface /dev/twa0-15 and not the SCSI device interface /dev/sd?.
391+Please see the \fBsmartctl\fP(8) man page for further details.
392
393 Note that older 3w-xxxx drivers do not pass the \'Enable Autosave\'
394 (\fB-S on\fP) and \'Enable Automatic Offline\' (\fB-o on\fP) commands
395@@ -382,8 +389,8 @@
396 patch to older versions. See
397 \fBhttp://smartmontools.sourceforge.net/\fP for instructions.
398 Alternatively use the character device interfaces /dev/twe0-15 (3ware
399-6/7/8000 series controllers) or /dev/twa0-15 (3ware 9000 series
400-controllers).
401+6/7/8000 series controllers), /dev/twa0-15 (3ware 9000 series
402+controllers) or /dev/twl0-15 (3ware 9750 series controllers).
403
404 .I areca,N
405 \- the device consists of one or more SATA disks connected to an Areca