1 /**************************************************************************
2 
3 Module Name:
4 
5    CSMISAS.H
6 
7 
8 Abstract:
9 
10    This file contains constants and data structure definitions used by drivers
11    that support the Common Storage Management Interface specification for
12    SAS or SATA in either the Windows or Linux.
13 
14    This should be considered as a reference implementation only.  Changes may
15    be necessary to accommodate a specific build environment or target OS.
16 
17 Revision History:
18 
19    001  SEF   8/12/03  Initial release.
20    002  SEF   8/20/03  Cleanup to match documentation.
21    003  SEF   9/12/03  Additional cleanup, created combined header
22    004  SEF   9/23/03  Changed base types to match linux defaults
23                        Added RAID signature
24                        Added bControllerFlags to CSMI_SAS_CNTLR_CONFIG
25                        Changed CSMI_SAS_BEGIN_PACK to 8 for common structures
26                        Fixed other typos identified in first compilation test
27    005  SEF  10/03/03  Additions to match first version of CSMI document
28    006  SEF  10/14/03  Fixed typedef struct _CSMI_SAS_SMP_PASSTHRU_BUFFER
29                        Added defines for bConnectionRate
30    007  SEF  10/15/03  Added Firmware Download Control Code and support
31                        Added CSMI revision support
32    008  SEF  10/30/03  No functional change, just updated version to track
33                        spec changes
34    009  SEF  12/09/03  No functional change, just updated version to track
35                        spec changes
36    010  SEF   3/11/04  Fixed typedef struct CSMI_SAS_RAID_DRIVES to include the
37                        bFirmware member that is defined in the spec, but
38                        was missing in this file,
39                        added CC_CSMI_SAS_TASK_MANAGEMENT
40    011  SEF   4/02/04  No functional change, added comment line before
41                        CC_CSMI_SAS_TASK_MANAGEMENT
42    012  SEF   4/16/04  Added IOControllerNumber to linux header,
43                        Modified linux control codes to have upper word of
44                        0xCC77.... to indicate CSMI version 77
45                        Added bSignalClass to CC_CSMI_SET_PHY_INFO
46                        Added CC_CSMI_SAS_PHY_CONTROL support
47    013  SEF   5/14/04  Added CC_CSMI_SAS_GET_CONNECTOR_INFO support
48    014  SEF   5/24/04  No functional change, just updated version to track spec
49                        changes
50    015  SEF   6/16/04  changed bPinout to uPinout to reflect proper size,
51                        changed width of bLocation defines to reflect size
52    016  SEF   6/17/04  changed bLengthOfControls in CSMI_SAS_PHY_CONTROL
53                        to be proper size
54    017  SEF   9/17/04  added CSMI_SAS_SATA_PORT_SELECTOR,
55                        CSMI_SAS_LINK_VIRTUAL, CSMI_SAS_CON_NOT_PRESENT, and
56                        CSMI_SAS_CON_NOT_CONNECTED
57    018  SEF   9/20/04  added CSMI_SAS_PHY_USER_PATTERN,
58                        changed definition of CSMI_SAS_PHY_FIXED_PATTERN to not
59                        conflict with activate definition
60    019  SEF  12/06/04  added CSMI_SAS_GET_LOCATION
61                        added bSSPStatus to CSMI_SAS_SSP_PASSTHRU_STATUS
62                        structure
63    020  SEF   5/25/05  added CSMI_SAS_PHY_VIRTUAL_SMP, and changes to
64                        CSMI_SAS_GET_LOCATION
65    021  SEF  11/03/05  added new RAID creation functionality
66    022  SEF   2/01/06  corrected typo bNegotitiatedLInkRate
67                        Added two more RAID_TYPES, 7 and 8
68    023  SEF   4/04/06  added CSMI_RAID_TYPE_1E
69                        changed structures that contained surface scan
70                        to priority approach rather than time, causes
71                        0.89 to incompatible with 0.87, so a version
72                        check is necessary when interpreting the
73                        raid structures
74                        Added netware section
75    024 DRG    5/22/06  Added uFailureCode to CSMI_SAS_RAID_CONFIG and
76                        CSMI_SAS_RAID_FEATURES
77                        Changed __u64 fields to high and low __u32 fields in
78                        order to avoid backward compatibility issues with
79                        packing and alignment.
80                        Fixed alignment problem in CSMI_SAS_RAID_DRIVES.
81                        Added CSMI_SAS_CNTLR_SMART_ARRAY to uControllerFlags
82                        Reassigned the value of CSMI_SAS_CNTLR_RAID_CFG_SUPPORT
83                        to avoid a conflict.
84 
85 **************************************************************************/
86 
87 #ifndef _CSMI_SAS_H_
88 #define _CSMI_SAS_H_
89 
90 // CSMI Specification Revision, the intent is that all versions of the
91 // specification will be backward compatible after the 1.00 release.
92 // Major revision number, corresponds to xxxx. of CSMI specification
93 // Minor revision number, corresponds to .xxxx of CSMI specification
94 #define CSMI_MAJOR_REVISION   0
95 #define CSMI_MINOR_REVISION   90
96 
97 /*************************************************************************/
98 /* PATCHES FOR TYPOS                                                     */
99 /*************************************************************************/
100 
101 #define bNegotitiatedLInkRate bNegotiatedLinkRate
102 
103 /*************************************************************************/
104 /* TARGET OS LINUX SPECIFIC CODE                                         */
105 /*************************************************************************/
106 
107 // EDM #ifdef _linux
108 #ifdef __KERNEL__
109 
110 // Linux base types
111 
112 #include <linux/types.h>
113 
114 #define __i8    char
115 
116 // pack definition
117 
118 // EDM #define CSMI_SAS_BEGIN_PACK(x)    pack(x)
119 // EDM #define CSMI_SAS_END_PACK         pack()
120 
121 // IOCTL Control Codes
122 // (IoctlHeader.ControlCode)
123 
124 // Control Codes prior to 0.77
125 
126 // Control Codes requiring CSMI_ALL_SIGNATURE
127 
128 // #define CC_CSMI_SAS_GET_DRIVER_INFO    0x12345678
129 // #define CC_CSMI_SAS_GET_CNTLR_CONFIG   0x23456781
130 // #define CC_CSMI_SAS_GET_CNTLR_STATUS   0x34567812
131 // #define CC_CSMI_SAS_FIRMWARE_DOWNLOAD  0x92345678
132 
133 // Control Codes requiring CSMI_RAID_SIGNATURE
134 
135 // #define CC_CSMI_SAS_GET_RAID_INFO      0x45678123
136 // #define CC_CSMI_SAS_GET_RAID_CONFIG    0x56781234
137 
138 // Control Codes requiring CSMI_SAS_SIGNATURE
139 
140 // #define CC_CSMI_SAS_GET_PHY_INFO       0x67812345
141 // #define CC_CSMI_SAS_SET_PHY_INFO       0x78123456
142 // #define CC_CSMI_SAS_GET_LINK_ERRORS    0x81234567
143 // #define CC_CSMI_SAS_SMP_PASSTHRU       0xA1234567
144 // #define CC_CSMI_SAS_SSP_PASSTHRU       0xB1234567
145 // #define CC_CSMI_SAS_STP_PASSTHRU       0xC1234567
146 // #define CC_CSMI_SAS_GET_SATA_SIGNATURE 0xD1234567
147 // #define CC_CSMI_SAS_GET_SCSI_ADDRESS   0xE1234567
148 // #define CC_CSMI_SAS_GET_DEVICE_ADDRESS 0xF1234567
149 // #define CC_CSMI_SAS_TASK_MANAGEMENT    0xA2345678
150 
151 // Control Codes for 0.77 and later
152 
153 // Control Codes requiring CSMI_ALL_SIGNATURE
154 
155 #define CC_CSMI_SAS_GET_DRIVER_INFO    0xCC770001
156 #define CC_CSMI_SAS_GET_CNTLR_CONFIG   0xCC770002
157 #define CC_CSMI_SAS_GET_CNTLR_STATUS   0xCC770003
158 #define CC_CSMI_SAS_FIRMWARE_DOWNLOAD  0xCC770004
159 
160 // Control Codes requiring CSMI_RAID_SIGNATURE
161 
162 #define CC_CSMI_SAS_GET_RAID_INFO      0xCC77000A
163 #define CC_CSMI_SAS_GET_RAID_CONFIG    0xCC77000B
164 #define CC_CSMI_SAS_GET_RAID_FEATURES  0xCC77000C
165 #define CC_CSMI_SAS_SET_RAID_CONTROL   0xCC77000D
166 #define CC_CSMI_SAS_GET_RAID_ELEMENT   0xCC77000E
167 #define CC_CSMI_SAS_SET_RAID_OPERATION 0xCC77000F
168 
169 // Control Codes requiring CSMI_SAS_SIGNATURE
170 
171 #define CC_CSMI_SAS_GET_PHY_INFO       0xCC770014
172 #define CC_CSMI_SAS_SET_PHY_INFO       0xCC770015
173 #define CC_CSMI_SAS_GET_LINK_ERRORS    0xCC770016
174 #define CC_CSMI_SAS_SMP_PASSTHRU       0xCC770017
175 #define CC_CSMI_SAS_SSP_PASSTHRU       0xCC770018
176 #define CC_CSMI_SAS_STP_PASSTHRU       0xCC770019
177 #define CC_CSMI_SAS_GET_SATA_SIGNATURE 0xCC770020
178 #define CC_CSMI_SAS_GET_SCSI_ADDRESS   0xCC770021
179 #define CC_CSMI_SAS_GET_DEVICE_ADDRESS 0xCC770022
180 #define CC_CSMI_SAS_TASK_MANAGEMENT    0xCC770023
181 #define CC_CSMI_SAS_GET_CONNECTOR_INFO 0xCC770024
182 #define CC_CSMI_SAS_GET_LOCATION       0xCC770025
183 
184 
185 // Control Codes requiring CSMI_PHY_SIGNATURE
186 
187 #define CC_CSMI_SAS_PHY_CONTROL        0xCC77003C
188 
189 // EDM #pragma CSMI_SAS_BEGIN_PACK(8)
190 #pragma pack(8)
191 
192 // IOCTL_HEADER
193 typedef struct _IOCTL_HEADER {
194     __u32 IOControllerNumber;
195     __u32 Length;
196     __u32 ReturnCode;
197     __u32 Timeout;
198     __u16 Direction;
199 } IOCTL_HEADER,
200   *PIOCTL_HEADER;
201 
202 // EDM #pragma CSMI_SAS_END_PACK
203 #pragma pack()
204 
205 #endif
206 
207 /*************************************************************************/
208 /* TARGET OS WINDOWS SPECIFIC CODE                                       */
209 /*************************************************************************/
210 
211 #ifdef _WIN32
212 
213 // windows IOCTL definitions
214 
215 #if 0 // <ntddscsi.h> and CSMI_*_PACK are no longer needed
216 
217 #ifndef _NTDDSCSIH_
218 #include <ntddscsi.h>
219 #endif
220 
221 // pack definition
222 
223 #if defined _MSC_VER
224    #define CSMI_SAS_BEGIN_PACK(x)    pack(push,x)
225    #define CSMI_SAS_END_PACK         pack(pop)
226 #elif defined __BORLANDC__
227    #define CSMI_SAS_BEGIN_PACK(x)    option -a##x
228    #define CSMI_SAS_END_PACK         option -a.
229 #else
230    #error "CSMISAS.H - Must externally define a pack compiler designator."
231 #endif
232 
233 #endif // #if 0
234 
235 // base types
236 
237 #define __u8    unsigned char
238 #define __u16   unsigned short
239 #ifndef __LP64__  // ILP32 (32-bit), LLP64 (64-bit MSVC, MinGW)
240 #define __u32   unsigned long
241 #else             // LP64 (64-bit Cygwin)
242 #define __u32   unsigned int
243 #endif
244 #define __u64   unsigned __int64
245 
246 #define __i8    char
247 
248 // IOCTL Control Codes
249 // (IoctlHeader.ControlCode)
250 
251 // Control Codes requiring CSMI_ALL_SIGNATURE
252 
253 #define CC_CSMI_SAS_GET_DRIVER_INFO    1
254 #define CC_CSMI_SAS_GET_CNTLR_CONFIG   2
255 #define CC_CSMI_SAS_GET_CNTLR_STATUS   3
256 #define CC_CSMI_SAS_FIRMWARE_DOWNLOAD  4
257 
258 // Control Codes requiring CSMI_RAID_SIGNATURE
259 
260 #define CC_CSMI_SAS_GET_RAID_INFO      10
261 #define CC_CSMI_SAS_GET_RAID_CONFIG    11
262 #define CC_CSMI_SAS_GET_RAID_FEATURES  12
263 #define CC_CSMI_SAS_SET_RAID_CONTROL   13
264 #define CC_CSMI_SAS_GET_RAID_ELEMENT   14
265 #define CC_CSMI_SAS_SET_RAID_OPERATION 15
266 
267 // Control Codes requiring CSMI_SAS_SIGNATURE
268 
269 #define CC_CSMI_SAS_GET_PHY_INFO       20
270 #define CC_CSMI_SAS_SET_PHY_INFO       21
271 #define CC_CSMI_SAS_GET_LINK_ERRORS    22
272 #define CC_CSMI_SAS_SMP_PASSTHRU       23
273 #define CC_CSMI_SAS_SSP_PASSTHRU       24
274 #define CC_CSMI_SAS_STP_PASSTHRU       25
275 #define CC_CSMI_SAS_GET_SATA_SIGNATURE 26
276 #define CC_CSMI_SAS_GET_SCSI_ADDRESS   27
277 #define CC_CSMI_SAS_GET_DEVICE_ADDRESS 28
278 #define CC_CSMI_SAS_TASK_MANAGEMENT    29
279 #define CC_CSMI_SAS_GET_CONNECTOR_INFO 30
280 #define CC_CSMI_SAS_GET_LOCATION       31
281 
282 // Control Codes requiring CSMI_PHY_SIGNATURE
283 
284 #define CC_CSMI_SAS_PHY_CONTROL        60
285 
286 #define IOCTL_HEADER SRB_IO_CONTROL
287 #define PIOCTL_HEADER PSRB_IO_CONTROL
288 
289 #endif
290 
291 /*************************************************************************/
292 /* TARGET OS NETWARE SPECIFIC CODE                                       */
293 /*************************************************************************/
294 
295 #ifdef _NETWARE
296 
297 // NetWare IOCTL definitions
298 
299 #define CSMI_SAS_BEGIN_PACK(x)    pack(x)
300 #define CSMI_SAS_END_PACK         pack()
301 
302 #ifndef LONG
303 typedef unsigned long LONG;
304 #endif
305 
306 #ifndef WORD
307 typedef unsigned short WORD;
308 #endif
309 
310 #ifndef BYTE
311 typedef unsigned char BYTE;
312 #endif
313 
314 /* Need to have these definitions for Netware */
315 #define __u8    unsigned char
316 #define __u16   unsigned short
317 #define __u32   unsigned long
318 #define __u64   unsigned __int64
319 
320 #define __i8    char
321 
322 
323 // EDM #pragma CSMI_SAS_BEGIN_PACK(8)
324 #pragma pack(8)
325 
326 // IOCTL_HEADER
327 typedef struct _IOCTL_HEADER {
328     __u32 Length;
329     __u32 ReturnCode;
330 } IOCTL_HEADER,
331   *PIOCTL_HEADER;
332 
333 // EDM #pragma CSMI_SAS_END_PACK
334 #pragma pack()
335 
336 // IOCTL Control Codes
337 // (IoctlHeader.ControlCode)
338 
339 // Control Codes requiring CSMI_ALL_SIGNATURE
340 
341 #define CC_CSMI_SAS_GET_DRIVER_INFO    0x01FF0001
342 #define CC_CSMI_SAS_GET_CNTLR_CONFIG   0x01FF0002
343 #define CC_CSMI_SAS_GET_CNTLR_STATUS   0x01FF0003
344 #define CC_CSMI_SAS_FIRMWARE_DOWNLOAD  0x01FF0004
345 
346 // Control Codes requiring CSMI_RAID_SIGNATURE
347 
348 #define CC_CSMI_SAS_GET_RAID_INFO      0x01FF000A
349 #define CC_CSMI_SAS_GET_RAID_CONFIG    0x01FF000B
350 #define CC_CSMI_SAS_GET_RAID_FEATURES  0x01FF000C
351 #define CC_CSMI_SAS_SET_RAID_CONTROL   0x01FF000D
352 #define CC_CSMI_SAS_GET_RAID_ELEMENT   0x01FF000E
353 #define CC_CSMI_SAS_SET_RAID_OPERATION 0x01FF000F
354 
355 // Control Codes requiring CSMI_SAS_SIGNATURE
356 
357 #define CC_CSMI_SAS_GET_PHY_INFO       0x01FF0014
358 #define CC_CSMI_SAS_SET_PHY_INFO       0x01FF0015
359 #define CC_CSMI_SAS_GET_LINK_ERRORS    0x01FF0016
360 #define CC_CSMI_SAS_SMP_PASSTHRU       0x01FF0017
361 #define CC_CSMI_SAS_SSP_PASSTHRU       0x01FF0018
362 #define CC_CSMI_SAS_STP_PASSTHRU       0x01FF0019
363 #define CC_CSMI_SAS_GET_SATA_SIGNATURE 0x01FF001A
364 #define CC_CSMI_SAS_GET_SCSI_ADDRESS   0x01FF001B
365 #define CC_CSMI_SAS_GET_DEVICE_ADDRESS 0x01FF001C
366 #define CC_CSMI_SAS_TASK_MANAGEMENT    0x01FF001D
367 #define CC_CSMI_SAS_GET_CONNECTOR_INFO 0x01FF001E
368 #define CC_CSMI_SAS_GET_LOCATION       0x01FF001F
369 
370 // Control Codes requiring CSMI_PHY_SIGNATURE
371 
372 #define CC_CSMI_SAS_PHY_CONTROL        60
373 
374 #endif
375 
376 /*************************************************************************/
377 /* TARGET OS NOT DEFINED ERROR                                           */
378 /*************************************************************************/
379 
380 // EDM
381 //#if (!_WIN32 && !_linux && !_NETWARE)
382 //   #error "Unknown target OS."
383 //#endif
384 
385 /*************************************************************************/
386 /* OS INDEPENDENT CODE                                                   */
387 /*************************************************************************/
388 
389 /* * * * * * * * * * Class Independent IOCTL Constants * * * * * * * * * */
390 
391 // Return codes for all IOCTL's regardless of class
392 // (IoctlHeader.ReturnCode)
393 
394 #define CSMI_SAS_STATUS_SUCCESS              0
395 #define CSMI_SAS_STATUS_FAILED               1
396 #define CSMI_SAS_STATUS_BAD_CNTL_CODE        2
397 #define CSMI_SAS_STATUS_INVALID_PARAMETER    3
398 #define CSMI_SAS_STATUS_WRITE_ATTEMPTED      4
399 
400 // Signature value
401 // (IoctlHeader.Signature)
402 
403 #define CSMI_ALL_SIGNATURE    "CSMIALL"
404 
405 // Timeout value default of 60 seconds
406 // (IoctlHeader.Timeout)
407 
408 #define CSMI_ALL_TIMEOUT      60
409 
410 //  Direction values for data flow on this IOCTL
411 // (IoctlHeader.Direction, Linux only)
412 #define CSMI_SAS_DATA_READ    0
413 #define CSMI_SAS_DATA_WRITE   1
414 
415 // I/O Bus Types
416 // ISA and EISA bus types are not supported
417 // (bIoBusType)
418 
419 #define CSMI_SAS_BUS_TYPE_PCI       3
420 #define CSMI_SAS_BUS_TYPE_PCMCIA    4
421 
422 // Controller Status
423 // (uStatus)
424 
425 #define CSMI_SAS_CNTLR_STATUS_GOOD     1
426 #define CSMI_SAS_CNTLR_STATUS_FAILED   2
427 #define CSMI_SAS_CNTLR_STATUS_OFFLINE  3
428 #define CSMI_SAS_CNTLR_STATUS_POWEROFF 4
429 
430 // Offline Status Reason
431 // (uOfflineReason)
432 
433 #define CSMI_SAS_OFFLINE_REASON_NO_REASON             0
434 #define CSMI_SAS_OFFLINE_REASON_INITIALIZING          1
435 #define CSMI_SAS_OFFLINE_REASON_BACKSIDE_BUS_DEGRADED 2
436 #define CSMI_SAS_OFFLINE_REASON_BACKSIDE_BUS_FAILURE  3
437 
438 // Controller Class
439 // (bControllerClass)
440 
441 #define CSMI_SAS_CNTLR_CLASS_HBA    5
442 
443 // Controller Flag bits
444 // (uControllerFlags)
445 
446 #define CSMI_SAS_CNTLR_SAS_HBA          0x00000001
447 #define CSMI_SAS_CNTLR_SAS_RAID         0x00000002
448 #define CSMI_SAS_CNTLR_SATA_HBA         0x00000004
449 #define CSMI_SAS_CNTLR_SATA_RAID        0x00000008
450 #define CSMI_SAS_CNTLR_SMART_ARRAY      0x00000010
451 
452 // for firmware download
453 #define CSMI_SAS_CNTLR_FWD_SUPPORT      0x00010000
454 #define CSMI_SAS_CNTLR_FWD_ONLINE       0x00020000
455 #define CSMI_SAS_CNTLR_FWD_SRESET       0x00040000
456 #define CSMI_SAS_CNTLR_FWD_HRESET       0x00080000
457 #define CSMI_SAS_CNTLR_FWD_RROM         0x00100000
458 
459 // for RAID configuration supported
460 #define CSMI_SAS_CNTLR_RAID_CFG_SUPPORT 0x01000000
461 
462 // Download Flag bits
463 // (uDownloadFlags)
464 #define CSMI_SAS_FWD_VALIDATE       0x00000001
465 #define CSMI_SAS_FWD_SOFT_RESET     0x00000002
466 #define CSMI_SAS_FWD_HARD_RESET     0x00000004
467 
468 // Firmware Download Status
469 // (usStatus)
470 #define CSMI_SAS_FWD_SUCCESS        0
471 #define CSMI_SAS_FWD_FAILED         1
472 #define CSMI_SAS_FWD_USING_RROM     2
473 #define CSMI_SAS_FWD_REJECT         3
474 #define CSMI_SAS_FWD_DOWNREV        4
475 
476 // Firmware Download Severity
477 // (usSeverity>
478 #define CSMI_SAS_FWD_INFORMATION    0
479 #define CSMI_SAS_FWD_WARNING        1
480 #define CSMI_SAS_FWD_ERROR          2
481 #define CSMI_SAS_FWD_FATAL          3
482 
483 /* * * * * * * * * * SAS RAID Class IOCTL Constants  * * * * * * * * */
484 
485 // Return codes for the RAID IOCTL's regardless of class
486 // (IoctlHeader.ReturnCode)
487 
488 #define CSMI_SAS_RAID_SET_OUT_OF_RANGE       1000
489 #define CSMI_SAS_RAID_SET_BUFFER_TOO_SMALL   1001
490 #define CSMI_SAS_RAID_SET_DATA_CHANGED       1002
491 
492 // Signature value
493 // (IoctlHeader.Signature)
494 
495 #define CSMI_RAID_SIGNATURE    "CSMIARY"
496 
497 // Timeout value default of 60 seconds
498 // (IoctlHeader.Timeout)
499 
500 #define CSMI_RAID_TIMEOUT      60
501 
502 // RAID Types
503 // (bRaidType)
504 #define CSMI_SAS_RAID_TYPE_NONE     0
505 #define CSMI_SAS_RAID_TYPE_0        1
506 #define CSMI_SAS_RAID_TYPE_1        2
507 #define CSMI_SAS_RAID_TYPE_10       3
508 #define CSMI_SAS_RAID_TYPE_5        4
509 #define CSMI_SAS_RAID_TYPE_15       5
510 #define CSMI_SAS_RAID_TYPE_6        6
511 #define CSMI_SAS_RAID_TYPE_50       7
512 #define CSMI_SAS_RAID_TYPE_VOLUME   8
513 #define CSMI_SAS_RAID_TYPE_1E       9
514 #define CSMI_SAS_RAID_TYPE_OTHER    255
515 // the last value 255 was already defined for other
516 // so end is defined as 254
517 #define CSMI_SAS_RAID_TYPE_END      254
518 
519 // RAID Status
520 // (bStatus)
521 #define CSMI_SAS_RAID_SET_STATUS_OK             0
522 #define CSMI_SAS_RAID_SET_STATUS_DEGRADED       1
523 #define CSMI_SAS_RAID_SET_STATUS_REBUILDING     2
524 #define CSMI_SAS_RAID_SET_STATUS_FAILED         3
525 #define CSMI_SAS_RAID_SET_STATUS_OFFLINE        4
526 #define CSMI_SAS_RAID_SET_STATUS_TRANSFORMING   5
527 #define CSMI_SAS_RAID_SET_STATUS_QUEUED_FOR_REBUILD         6
528 #define CSMI_SAS_RAID_SET_STATUS_QUEUED_FOR_TRANSFORMATION  7
529 
530 // RAID Drive Count
531 // (bDriveCount, 0xF1 to 0xFF are reserved)
532 #define CSMI_SAS_RAID_DRIVE_COUNT_TOO_BIG   0xF1
533 #define CSMI_SAS_RAID_DRIVE_COUNT_SUPRESSED 0xF2
534 
535 // RAID Data Type
536 // (bDataType)
537 #define CSMI_SAS_RAID_DATA_DRIVES           0
538 #define CSMI_SAS_RAID_DATA_DEVICE_ID        1
539 #define CSMI_SAS_RAID_DATA_ADDITIONAL_DATA  2
540 
541 // RAID Drive Status
542 // (bDriveStatus)
543 #define CSMI_SAS_DRIVE_STATUS_OK          0
544 #define CSMI_SAS_DRIVE_STATUS_REBUILDING  1
545 #define CSMI_SAS_DRIVE_STATUS_FAILED      2
546 #define CSMI_SAS_DRIVE_STATUS_DEGRADED    3
547 #define CSMI_SAS_DRIVE_STATUS_OFFLINE     4
548 #define CSMI_SAS_DRIVE_STATUS_QUEUED_FOR_REBUILD 5
549 
550 // RAID Drive Usage
551 // (bDriveUsage)
552 #define CSMI_SAS_DRIVE_CONFIG_NOT_USED      0
553 #define CSMI_SAS_DRIVE_CONFIG_MEMBER        1
554 #define CSMI_SAS_DRIVE_CONFIG_SPARE         2
555 #define CSMI_SAS_DRIVE_CONFIG_SPARE_ACTIVE  3
556 
557 // RAID Drive Type
558 // (bDriveType)
559 #define CSMI_SAS_DRIVE_TYPE_UNKNOWN         0
560 #define CSMI_SAS_DRIVE_TYPE_SINGLE_PORT_SAS 1
561 #define CSMI_SAS_DRIVE_TYPE_DUAL_PORT_SAS   2
562 #define CSMI_SAS_DRIVE_TYPE_SATA            3
563 #define CSMI_SAS_DRIVE_TYPE_SATA_PS         4
564 #define CSMI_SAS_DRIVE_TYPE_OTHER           255
565 
566 // RAID Write Protect
567 // (bWriteProtect)
568 #define CSMI_SAS_RAID_SET_WRITE_PROTECT_UNKNOWN     0
569 #define CSMI_SAS_RAID_SET_WRITE_PROTECT_UNCHANGED   0
570 #define CSMI_SAS_RAID_SET_WRITE_PROTECT_ENABLED     1
571 #define CSMI_SAS_RAID_SET_WRITE_PROTECT_DISABLED    2
572 
573 // RAID Cache Setting
574 // (bCacheSetting)
575 #define CSMI_SAS_RAID_SET_CACHE_UNKNOWN             0
576 #define CSMI_SAS_RAID_SET_CACHE_UNCHANGED           0
577 #define CSMI_SAS_RAID_SET_CACHE_ENABLED             1
578 #define CSMI_SAS_RAID_SET_CACHE_DISABLED            2
579 #define CSMI_SAS_RAID_SET_CACHE_CORRUPT             3
580 
581 // RAID Features
582 // (uFeatures)
583 #define CSMI_SAS_RAID_FEATURE_TRANSFORMATION    0x00000001
584 #define CSMI_SAS_RAID_FEATURE_REBUILD           0x00000002
585 #define CSMI_SAS_RAID_FEATURE_SPLIT_MIRROR      0x00000004
586 #define CSMI_SAS_RAID_FEATURE_MERGE_MIRROR      0x00000008
587 #define CSMI_SAS_RAID_FEATURE_LUN_RENUMBER      0x00000010
588 #define CSMI_SAS_RAID_FEATURE_SURFACE_SCAN      0x00000020
589 #define CSMI_SAS_RAID_FEATURE_SPARES_SHARED     0x00000040
590 
591 // RAID Priority
592 // (bDefaultTransformPriority, etc.)
593 #define CSMI_SAS_PRIORITY_UNKNOWN   0
594 #define CSMI_SAS_PRIORITY_UNCHANGED 0
595 #define CSMI_SAS_PRIORITY_AUTO      1
596 #define CSMI_SAS_PRIORITY_OFF       2
597 #define CSMI_SAS_PRIORITY_LOW       3
598 #define CSMI_SAS_PRIORITY_MEDIUM    4
599 #define CSMI_SAS_PRIORITY_HIGH      5
600 
601 // RAID Transformation Rules
602 // (uRaidSetTransformationRules)
603 #define CSMI_SAS_RAID_RULE_AVAILABLE_MEMORY     0x00000001
604 #define CSMI_SAS_RAID_RULE_OVERLAPPED_EXTENTS   0x00000002
605 
606 // RAID Cache Ratios Supported
607 // (bCacheRatiosSupported)
608 // from 0 to 100 defines the write to read ratio, 0 is 100% write
609 #define CSMI_SAS_RAID_CACHE_RATIO_RANGE     101
610 #define CSMI_SAS_RAID_CACHE_RATIO_FIXED     102
611 #define CSMI_SAS_RAID_CACHE_RATIO_AUTO      103
612 #define CSMI_SAS_RAID_CACHE_RATIO_END       255
613 
614 // RAID Cache Ratio Flag
615 // (bCacheRatioFlag)
616 #define CSMI_SAS_RAID_CACHE_RATIO_DISABLE   0
617 #define CSMI_SAS_RAID_CACHE_RATIO_ENABLE    1
618 
619 // RAID Clear Configuration Signature
620 // (bClearConfiguration)
621 #define CSMI_SAS_RAID_CLEAR_CONFIGURATION_SIGNATURE "RAIDCLR"
622 
623 // RAID Failure Codes
624 // (uFailureCode)
625 #define CSMI_SAS_FAIL_CODE_OK                           0
626 #define CSMI_SAS_FAIL_CODE_PARAMETER_INVALID            1000
627 #define CSMI_SAS_FAIL_CODE_TRANSFORM_PRIORITY_INVALID   1001
628 #define CSMI_SAS_FAIL_CODE_REBUILD_PRIORITY_INVALID     1002
629 #define CSMI_SAS_FAIL_CODE_CACHE_RATIO_INVALID          1003
630 #define CSMI_SAS_FAIL_CODE_SURFACE_SCAN_INVALID         1004
631 #define CSMI_SAS_FAIL_CODE_CLEAR_CONFIGURATION_INVALID  1005
632 #define CSMI_SAS_FAIL_CODE_ELEMENT_INDEX_INVALID        1006
633 #define CSMI_SAS_FAIL_CODE_SUBELEMENT_INDEX_INVALID     1007
634 #define CSMI_SAS_FAIL_CODE_EXTENT_INVALID               1008
635 #define CSMI_SAS_FAIL_CODE_BLOCK_COUNT_INVALID          1009
636 #define CSMI_SAS_FAIL_CODE_DRIVE_INDEX_INVALID          1010
637 #define CSMI_SAS_FAIL_CODE_EXISTING_LUN_INVALID         1011
638 #define CSMI_SAS_FAIL_CODE_RAID_TYPE_INVALID            1012
639 #define CSMI_SAS_FAIL_CODE_STRIPE_SIZE_INVALID          1013
640 #define CSMI_SAS_FAIL_CODE_TRANSFORMATION_INVALID       1014
641 #define CSMI_SAS_FAIL_CODE_CHANGE_COUNT_INVALID         1015
642 #define CSMI_SAS_FAIL_CODE_ENUMERATION_TYPE_INVALID     1016
643 
644 #define CSMI_SAS_FAIL_CODE_EXCEEDED_RAID_SET_COUNT      2000
645 #define CSMI_SAS_FAIL_CODE_DUPLICATE_LUN                2001
646 
647 #define CSMI_SAS_FAIL_CODE_WAIT_FOR_OPERATION           3000
648 
649 // RAID Enumeration Types
650 // (uEnumerationType)
651 #define CSMI_SAS_RAID_ELEMENT_TYPE_DRIVE                0
652 #define CSMI_SAS_RAID_ELEMENT_TYPE_MODULE               1
653 #define CSMI_SAS_RAID_ELEMENT_TYPE_DRIVE_RAID_SET       2
654 #define CSMI_SAS_RAID_ELEMENT_TYPE_EXTENT_DRIVE         3
655 
656 // RAID Extent Types
657 // (bExtentType)
658 #define CSMI_SAS_RAID_EXTENT_RESERVED       0
659 #define CSMI_SAS_RAID_EXTENT_METADATA       1
660 #define CSMI_SAS_RAID_EXTENT_ALLOCATED      2
661 #define CSMI_SAS_RAID_EXTENT_UNALLOCATED    3
662 
663 // RAID Operation Types
664 // (uOperationType)
665 #define CSMI_SAS_RAID_SET_CREATE            0
666 #define CSMI_SAS_RAID_SET_LABEL             1
667 #define CSMI_SAS_RAID_SET_TRANSFORM         2
668 #define CSMI_SAS_RAID_SET_DELETE            3
669 #define CSMI_SAS_RAID_SET_WRITE_PROTECT     4
670 #define CSMI_SAS_RAID_SET_CACHE             5
671 #define CSMI_SAS_RAID_SET_ONLINE_STATE      6
672 #define CSMI_SAS_RAID_SET_SPARE             7
673 
674 // RAID Transform Types
675 // (bTransformType)
676 #define CSMI_SAS_RAID_SET_TRANSFORM_SPLIT_MIRROR    0
677 #define CSMI_SAS_RAID_SET_TRANSFORM_MERGE_RAID_0    1
678 #define CSMI_SAS_RAID_SET_TRANSFORM_LUN_RENUMBER    2
679 #define CSMI_SAS_RAID_SET_TRANSFORM_RAID_SET        3
680 
681 // RAID Online State
682 // (bOnlineState)
683 #define CSMI_SAS_RAID_SET_STATE_UNKNOWN     0
684 #define CSMI_SAS_RAID_SET_STATE_ONLINE      1
685 #define CSMI_SAS_RAID_SET_STATE_OFFLINE     2
686 
687 /* * * * * * * * * * SAS HBA Class IOCTL Constants * * * * * * * * * */
688 
689 // Return codes for SAS IOCTL's
690 // (IoctlHeader.ReturnCode)
691 
692 #define CSMI_SAS_PHY_INFO_CHANGED            CSMI_SAS_STATUS_SUCCESS
693 #define CSMI_SAS_PHY_INFO_NOT_CHANGEABLE     2000
694 #define CSMI_SAS_LINK_RATE_OUT_OF_RANGE      2001
695 
696 #define CSMI_SAS_PHY_DOES_NOT_EXIST          2002
697 #define CSMI_SAS_PHY_DOES_NOT_MATCH_PORT     2003
698 #define CSMI_SAS_PHY_CANNOT_BE_SELECTED      2004
699 #define CSMI_SAS_SELECT_PHY_OR_PORT          2005
700 #define CSMI_SAS_PORT_DOES_NOT_EXIST         2006
701 #define CSMI_SAS_PORT_CANNOT_BE_SELECTED     2007
702 #define CSMI_SAS_CONNECTION_FAILED           2008
703 
704 #define CSMI_SAS_NO_SATA_DEVICE              2009
705 #define CSMI_SAS_NO_SATA_SIGNATURE           2010
706 #define CSMI_SAS_SCSI_EMULATION              2011
707 #define CSMI_SAS_NOT_AN_END_DEVICE           2012
708 #define CSMI_SAS_NO_SCSI_ADDRESS             2013
709 #define CSMI_SAS_NO_DEVICE_ADDRESS           2014
710 
711 // Signature value
712 // (IoctlHeader.Signature)
713 
714 #define CSMI_SAS_SIGNATURE    "CSMISAS"
715 
716 // Timeout value default of 60 seconds
717 // (IoctlHeader.Timeout)
718 
719 #define CSMI_SAS_TIMEOUT      60
720 
721 // Device types
722 // (bDeviceType)
723 
724 #define CSMI_SAS_PHY_UNUSED               0x00
725 #define CSMI_SAS_NO_DEVICE_ATTACHED       0x00
726 #define CSMI_SAS_END_DEVICE               0x10
727 #define CSMI_SAS_EDGE_EXPANDER_DEVICE     0x20
728 #define CSMI_SAS_FANOUT_EXPANDER_DEVICE   0x30
729 
730 // Protocol options
731 // (bInitiatorPortProtocol, bTargetPortProtocol)
732 
733 #define CSMI_SAS_PROTOCOL_SATA   0x01
734 #define CSMI_SAS_PROTOCOL_SMP    0x02
735 #define CSMI_SAS_PROTOCOL_STP    0x04
736 #define CSMI_SAS_PROTOCOL_SSP    0x08
737 
738 // Negotiated and hardware link rates
739 // (bNegotiatedLinkRate, bMinimumLinkRate, bMaximumLinkRate)
740 
741 #define CSMI_SAS_LINK_RATE_UNKNOWN  0x00
742 #define CSMI_SAS_PHY_DISABLED       0x01
743 #define CSMI_SAS_LINK_RATE_FAILED   0x02
744 #define CSMI_SAS_SATA_SPINUP_HOLD   0x03
745 #define CSMI_SAS_SATA_PORT_SELECTOR 0x04
746 #define CSMI_SAS_LINK_RATE_1_5_GBPS 0x08
747 #define CSMI_SAS_LINK_RATE_3_0_GBPS 0x09
748 #define CSMI_SAS_LINK_VIRTUAL       0x10
749 
750 // Discover state
751 // (bAutoDiscover)
752 
753 #define CSMI_SAS_DISCOVER_NOT_SUPPORTED   0x00
754 #define CSMI_SAS_DISCOVER_NOT_STARTED     0x01
755 #define CSMI_SAS_DISCOVER_IN_PROGRESS     0x02
756 #define CSMI_SAS_DISCOVER_COMPLETE        0x03
757 #define CSMI_SAS_DISCOVER_ERROR           0x04
758 
759 // Phy features
760 
761 #define CSMI_SAS_PHY_VIRTUAL_SMP          0x01
762 
763 // Programmed link rates
764 // (bMinimumLinkRate, bMaximumLinkRate)
765 // (bProgrammedMinimumLinkRate, bProgrammedMaximumLinkRate)
766 
767 #define CSMI_SAS_PROGRAMMED_LINK_RATE_UNCHANGED 0x00
768 #define CSMI_SAS_PROGRAMMED_LINK_RATE_1_5_GBPS  0x08
769 #define CSMI_SAS_PROGRAMMED_LINK_RATE_3_0_GBPS  0x09
770 
771 // Link rate
772 // (bNegotiatedLinkRate in CSMI_SAS_SET_PHY_INFO)
773 
774 #define CSMI_SAS_LINK_RATE_NEGOTIATE      0x00
775 #define CSMI_SAS_LINK_RATE_PHY_DISABLED   0x01
776 
777 // Signal class
778 // (bSignalClass in CSMI_SAS_SET_PHY_INFO)
779 
780 #define CSMI_SAS_SIGNAL_CLASS_UNKNOWN     0x00
781 #define CSMI_SAS_SIGNAL_CLASS_DIRECT      0x01
782 #define CSMI_SAS_SIGNAL_CLASS_SERVER      0x02
783 #define CSMI_SAS_SIGNAL_CLASS_ENCLOSURE   0x03
784 
785 // Link error reset
786 // (bResetCounts)
787 
788 #define CSMI_SAS_LINK_ERROR_DONT_RESET_COUNTS   0x00
789 #define CSMI_SAS_LINK_ERROR_RESET_COUNTS        0x01
790 
791 // Phy identifier
792 // (bPhyIdentifier)
793 
794 #define CSMI_SAS_USE_PORT_IDENTIFIER   0xFF
795 
796 // Port identifier
797 // (bPortIdentifier)
798 
799 #define CSMI_SAS_IGNORE_PORT           0xFF
800 
801 // Programmed link rates
802 // (bConnectionRate)
803 
804 #define CSMI_SAS_LINK_RATE_NEGOTIATED  0x00
805 #define CSMI_SAS_LINK_RATE_1_5_GBPS    0x08
806 #define CSMI_SAS_LINK_RATE_3_0_GBPS    0x09
807 
808 // Connection status
809 // (bConnectionStatus)
810 
811 #define CSMI_SAS_OPEN_ACCEPT                          0
812 #define CSMI_SAS_OPEN_REJECT_BAD_DESTINATION          1
813 #define CSMI_SAS_OPEN_REJECT_RATE_NOT_SUPPORTED       2
814 #define CSMI_SAS_OPEN_REJECT_NO_DESTINATION           3
815 #define CSMI_SAS_OPEN_REJECT_PATHWAY_BLOCKED          4
816 #define CSMI_SAS_OPEN_REJECT_PROTOCOL_NOT_SUPPORTED   5
817 #define CSMI_SAS_OPEN_REJECT_RESERVE_ABANDON          6
818 #define CSMI_SAS_OPEN_REJECT_RESERVE_CONTINUE         7
819 #define CSMI_SAS_OPEN_REJECT_RESERVE_INITIALIZE       8
820 #define CSMI_SAS_OPEN_REJECT_RESERVE_STOP             9
821 #define CSMI_SAS_OPEN_REJECT_RETRY                    10
822 #define CSMI_SAS_OPEN_REJECT_STP_RESOURCES_BUSY       11
823 #define CSMI_SAS_OPEN_REJECT_WRONG_DESTINATION        12
824 
825 // SSP Status
826 // (bSSPStatus)
827 
828 #define CSMI_SAS_SSP_STATUS_UNKNOWN     0x00
829 #define CSMI_SAS_SSP_STATUS_WAITING     0x01
830 #define CSMI_SAS_SSP_STATUS_COMPLETED   0x02
831 #define CSMI_SAS_SSP_STATUS_FATAL_ERROR 0x03
832 #define CSMI_SAS_SSP_STATUS_RETRY       0x04
833 #define CSMI_SAS_SSP_STATUS_NO_TAG      0x05
834 
835 // SSP Flags
836 // (uFlags)
837 
838 #define CSMI_SAS_SSP_READ           0x00000001
839 #define CSMI_SAS_SSP_WRITE          0x00000002
840 #define CSMI_SAS_SSP_UNSPECIFIED    0x00000004
841 
842 #define CSMI_SAS_SSP_TASK_ATTRIBUTE_SIMPLE         0x00000000
843 #define CSMI_SAS_SSP_TASK_ATTRIBUTE_HEAD_OF_QUEUE  0x00000010
844 #define CSMI_SAS_SSP_TASK_ATTRIBUTE_ORDERED        0x00000020
845 #define CSMI_SAS_SSP_TASK_ATTRIBUTE_ACA            0x00000040
846 
847 // SSP Data present
848 // (bDataPresent)
849 
850 #define CSMI_SAS_SSP_NO_DATA_PRESENT         0x00
851 #define CSMI_SAS_SSP_RESPONSE_DATA_PRESENT   0x01
852 #define CSMI_SAS_SSP_SENSE_DATA_PRESENT      0x02
853 
854 // STP Flags
855 // (uFlags)
856 
857 #define CSMI_SAS_STP_READ           0x00000001
858 #define CSMI_SAS_STP_WRITE          0x00000002
859 #define CSMI_SAS_STP_UNSPECIFIED    0x00000004
860 #define CSMI_SAS_STP_PIO            0x00000010
861 #define CSMI_SAS_STP_DMA            0x00000020
862 #define CSMI_SAS_STP_PACKET         0x00000040
863 #define CSMI_SAS_STP_DMA_QUEUED     0x00000080
864 #define CSMI_SAS_STP_EXECUTE_DIAG   0x00000100
865 #define CSMI_SAS_STP_RESET_DEVICE   0x00000200
866 
867 // Task Management Flags
868 // (uFlags)
869 
870 #define CSMI_SAS_TASK_IU               0x00000001
871 #define CSMI_SAS_HARD_RESET_SEQUENCE   0x00000002
872 #define CSMI_SAS_SUPPRESS_RESULT       0x00000004
873 
874 // Task Management Functions
875 // (bTaskManagement)
876 
877 #define CSMI_SAS_SSP_ABORT_TASK           0x01
878 #define CSMI_SAS_SSP_ABORT_TASK_SET       0x02
879 #define CSMI_SAS_SSP_CLEAR_TASK_SET       0x04
880 #define CSMI_SAS_SSP_LOGICAL_UNIT_RESET   0x08
881 #define CSMI_SAS_SSP_CLEAR_ACA            0x40
882 #define CSMI_SAS_SSP_QUERY_TASK           0x80
883 
884 // Task Management Information
885 // (uInformation)
886 
887 #define CSMI_SAS_SSP_TEST           1
888 #define CSMI_SAS_SSP_EXCEEDED       2
889 #define CSMI_SAS_SSP_DEMAND         3
890 #define CSMI_SAS_SSP_TRIGGER        4
891 
892 // Connector Pinout Information
893 // (uPinout)
894 
895 #define CSMI_SAS_CON_UNKNOWN              0x00000001
896 #define CSMI_SAS_CON_SFF_8482             0x00000002
897 #define CSMI_SAS_CON_SFF_8470_LANE_1      0x00000100
898 #define CSMI_SAS_CON_SFF_8470_LANE_2      0x00000200
899 #define CSMI_SAS_CON_SFF_8470_LANE_3      0x00000400
900 #define CSMI_SAS_CON_SFF_8470_LANE_4      0x00000800
901 #define CSMI_SAS_CON_SFF_8484_LANE_1      0x00010000
902 #define CSMI_SAS_CON_SFF_8484_LANE_2      0x00020000
903 #define CSMI_SAS_CON_SFF_8484_LANE_3      0x00040000
904 #define CSMI_SAS_CON_SFF_8484_LANE_4      0x00080000
905 
906 // Connector Location Information
907 // (bLocation)
908 
909 // same as uPinout above...
910 // #define CSMI_SAS_CON_UNKNOWN              0x01
911 #define CSMI_SAS_CON_INTERNAL             0x02
912 #define CSMI_SAS_CON_EXTERNAL             0x04
913 #define CSMI_SAS_CON_SWITCHABLE           0x08
914 #define CSMI_SAS_CON_AUTO                 0x10
915 #define CSMI_SAS_CON_NOT_PRESENT          0x20
916 #define CSMI_SAS_CON_NOT_CONNECTED        0x80
917 
918 // Device location identification
919 // (bIdentify)
920 
921 #define CSMI_SAS_LOCATE_UNKNOWN           0x00
922 #define CSMI_SAS_LOCATE_FORCE_OFF         0x01
923 #define CSMI_SAS_LOCATE_FORCE_ON          0x02
924 
925 // Location Valid flags
926 // (uLocationFlags)
927 
928 #define CSMI_SAS_LOCATE_SAS_ADDRESS_VALID           0x00000001
929 #define CSMI_SAS_LOCATE_SAS_LUN_VALID               0x00000002
930 #define CSMI_SAS_LOCATE_ENCLOSURE_IDENTIFIER_VALID  0x00000004
931 #define CSMI_SAS_LOCATE_ENCLOSURE_NAME_VALID        0x00000008
932 #define CSMI_SAS_LOCATE_BAY_PREFIX_VALID            0x00000010
933 #define CSMI_SAS_LOCATE_BAY_IDENTIFIER_VALID        0x00000020
934 #define CSMI_SAS_LOCATE_LOCATION_STATE_VALID        0x00000040
935 
936 /* * * * * * * * SAS Phy Control Class IOCTL Constants * * * * * * * * */
937 
938 // Return codes for SAS Phy Control IOCTL's
939 // (IoctlHeader.ReturnCode)
940 
941 // Signature value
942 // (IoctlHeader.Signature)
943 
944 #define CSMI_PHY_SIGNATURE    "CSMIPHY"
945 
946 // Phy Control Functions
947 // (bFunction)
948 
949 // values 0x00 to 0xFF are consistent in definition with the SMP PHY CONTROL
950 // function defined in the SAS spec
951 #define CSMI_SAS_PC_NOP                   0x00000000
952 #define CSMI_SAS_PC_LINK_RESET            0x00000001
953 #define CSMI_SAS_PC_HARD_RESET            0x00000002
954 #define CSMI_SAS_PC_PHY_DISABLE           0x00000003
955 // 0x04 to 0xFF reserved...
956 #define CSMI_SAS_PC_GET_PHY_SETTINGS      0x00000100
957 
958 // Link Flags
959 #define CSMI_SAS_PHY_ACTIVATE_CONTROL     0x00000001
960 #define CSMI_SAS_PHY_UPDATE_SPINUP_RATE   0x00000002
961 #define CSMI_SAS_PHY_AUTO_COMWAKE         0x00000004
962 
963 // Device Types for Phy Settings
964 // (bType)
965 #define CSMI_SAS_UNDEFINED 0x00
966 #define CSMI_SAS_SATA      0x01
967 #define CSMI_SAS_SAS       0x02
968 
969 // Transmitter Flags
970 // (uTransmitterFlags)
971 #define CSMI_SAS_PHY_PREEMPHASIS_DISABLED    0x00000001
972 
973 // Receiver Flags
974 // (uReceiverFlags)
975 #define CSMI_SAS_PHY_EQUALIZATION_DISABLED   0x00000001
976 
977 // Pattern Flags
978 // (uPatternFlags)
979 // #define CSMI_SAS_PHY_ACTIVATE_CONTROL     0x00000001
980 #define CSMI_SAS_PHY_DISABLE_SCRAMBLING      0x00000002
981 #define CSMI_SAS_PHY_DISABLE_ALIGN           0x00000004
982 #define CSMI_SAS_PHY_DISABLE_SSC             0x00000008
983 
984 #define CSMI_SAS_PHY_FIXED_PATTERN           0x00000010
985 #define CSMI_SAS_PHY_USER_PATTERN            0x00000020
986 
987 // Fixed Patterns
988 // (bFixedPattern)
989 #define CSMI_SAS_PHY_CJPAT                   0x00000001
990 #define CSMI_SAS_PHY_ALIGN                   0x00000002
991 
992 // Type Flags
993 // (bTypeFlags)
994 #define CSMI_SAS_PHY_POSITIVE_DISPARITY      0x01
995 #define CSMI_SAS_PHY_NEGATIVE_DISPARITY      0x02
996 #define CSMI_SAS_PHY_CONTROL_CHARACTER       0x04
997 
998 // Miscellaneous
999 #define SLOT_NUMBER_UNKNOWN   0xFFFF
1000 
1001 /*************************************************************************/
1002 /* DATA STRUCTURES                                                       */
1003 /*************************************************************************/
1004 
1005 /* * * * * * * * * * Class Independent Structures * * * * * * * * * */
1006 
1007 // EDM #pragma CSMI_SAS_BEGIN_PACK(8)
1008 #pragma pack(8)
1009 
1010 // CC_CSMI_SAS_DRIVER_INFO
1011 
1012 typedef struct _CSMI_SAS_DRIVER_INFO {
1013    __u8  szName[81];
1014    __u8  szDescription[81];
1015    __u16 usMajorRevision;
1016    __u16 usMinorRevision;
1017    __u16 usBuildRevision;
1018    __u16 usReleaseRevision;
1019    __u16 usCSMIMajorRevision;
1020    __u16 usCSMIMinorRevision;
1021 } CSMI_SAS_DRIVER_INFO,
1022   *PCSMI_SAS_DRIVER_INFO;
1023 
1024 typedef struct _CSMI_SAS_DRIVER_INFO_BUFFER {
1025    IOCTL_HEADER IoctlHeader;
1026    CSMI_SAS_DRIVER_INFO Information;
1027 } CSMI_SAS_DRIVER_INFO_BUFFER,
1028   *PCSMI_SAS_DRIVER_INFO_BUFFER;
1029 
1030 // CC_CSMI_SAS_CNTLR_CONFIGURATION
1031 
1032 typedef struct _CSMI_SAS_PCI_BUS_ADDRESS {
1033    __u8  bBusNumber;
1034    __u8  bDeviceNumber;
1035    __u8  bFunctionNumber;
1036    __u8  bReserved;
1037 } CSMI_SAS_PCI_BUS_ADDRESS,
1038   *PCSMI_SAS_PCI_BUS_ADDRESS;
1039 
1040 typedef union _CSMI_SAS_IO_BUS_ADDRESS {
1041    CSMI_SAS_PCI_BUS_ADDRESS PciAddress;
1042    __u8  bReserved[32];
1043 } CSMI_SAS_IO_BUS_ADDRESS,
1044   *PCSMI_SAS_IO_BUS_ADDRESS;
1045 
1046 typedef struct _CSMI_SAS_CNTLR_CONFIG {
1047    __u32 uBaseIoAddress;
1048    struct {
1049       __u32 uLowPart;
1050       __u32 uHighPart;
1051    } BaseMemoryAddress;
1052    __u32 uBoardID;
1053    __u16 usSlotNumber;
1054    __u8  bControllerClass;
1055    __u8  bIoBusType;
1056    CSMI_SAS_IO_BUS_ADDRESS BusAddress;
1057    __u8  szSerialNumber[81];
1058    __u16 usMajorRevision;
1059    __u16 usMinorRevision;
1060    __u16 usBuildRevision;
1061    __u16 usReleaseRevision;
1062    __u16 usBIOSMajorRevision;
1063    __u16 usBIOSMinorRevision;
1064    __u16 usBIOSBuildRevision;
1065    __u16 usBIOSReleaseRevision;
1066    __u32 uControllerFlags;
1067    __u16 usRromMajorRevision;
1068    __u16 usRromMinorRevision;
1069    __u16 usRromBuildRevision;
1070    __u16 usRromReleaseRevision;
1071    __u16 usRromBIOSMajorRevision;
1072    __u16 usRromBIOSMinorRevision;
1073    __u16 usRromBIOSBuildRevision;
1074    __u16 usRromBIOSReleaseRevision;
1075    __u8  bReserved[7];
1076 } CSMI_SAS_CNTLR_CONFIG,
1077   *PCSMI_SAS_CNTLR_CONFIG;
1078 
1079 typedef struct _CSMI_SAS_CNTLR_CONFIG_BUFFER {
1080    IOCTL_HEADER IoctlHeader;
1081    CSMI_SAS_CNTLR_CONFIG Configuration;
1082 } CSMI_SAS_CNTLR_CONFIG_BUFFER,
1083   *PCSMI_SAS_CNTLR_CONFIG_BUFFER;
1084 
1085 // CC_CSMI_SAS_CNTLR_STATUS
1086 
1087 typedef struct _CSMI_SAS_CNTLR_STATUS {
1088    __u32 uStatus;
1089    __u32 uOfflineReason;
1090    __u8  bReserved[28];
1091 } CSMI_SAS_CNTLR_STATUS,
1092   *PCSMI_SAS_CNTLR_STATUS;
1093 
1094 typedef struct _CSMI_SAS_CNTLR_STATUS_BUFFER {
1095    IOCTL_HEADER IoctlHeader;
1096    CSMI_SAS_CNTLR_STATUS Status;
1097 } CSMI_SAS_CNTLR_STATUS_BUFFER,
1098   *PCSMI_SAS_CNTLR_STATUS_BUFFER;
1099 
1100 // CC_CSMI_SAS_FIRMWARE_DOWNLOAD
1101 
1102 typedef struct _CSMI_SAS_FIRMWARE_DOWNLOAD {
1103    __u32 uBufferLength;
1104    __u32 uDownloadFlags;
1105    __u8  bReserved[32];
1106    __u16 usStatus;
1107    __u16 usSeverity;
1108 } CSMI_SAS_FIRMWARE_DOWNLOAD,
1109   *PCSMI_SAS_FIRMWARE_DOWNLOAD;
1110 
1111 typedef struct _CSMI_SAS_FIRMWARE_DOWNLOAD_BUFFER {
1112    IOCTL_HEADER IoctlHeader;
1113    CSMI_SAS_FIRMWARE_DOWNLOAD Information;
1114    __u8  bDataBuffer[1];
1115 } CSMI_SAS_FIRMWARE_DOWNLOAD_BUFFER,
1116   *PCSMI_SAS_FIRMWARE_DOWNLOAD_BUFFER;
1117 
1118 // CC_CSMI_SAS_RAID_INFO
1119 
1120 typedef struct _CSMI_SAS_RAID_INFO {
1121    __u32 uNumRaidSets;
1122    __u32 uMaxDrivesPerSet;
1123    __u32 uMaxRaidSets;
1124    __u8  bMaxRaidTypes;
1125    __u8  bReservedByteFields[7];
1126    struct
1127    {
1128       __u32 uLowPart;
1129       __u32 uHighPart;
1130    } ulMinRaidSetBlocks;
1131    struct
1132    {
1133       __u32 uLowPart;
1134       __u32 uHighPart;
1135    } ulMaxRaidSetBlocks;
1136    __u32 uMaxPhysicalDrives;
1137    __u32 uMaxExtents;
1138    __u32 uMaxModules;
1139    __u32 uMaxTransformationMemory;
1140    __u32 uChangeCount;
1141    __u8  bReserved[44];
1142 } CSMI_SAS_RAID_INFO,
1143   *PCSMI_SAS_RAID_INFO;
1144 
1145 typedef struct _CSMI_SAS_RAID_INFO_BUFFER {
1146    IOCTL_HEADER IoctlHeader;
1147    CSMI_SAS_RAID_INFO Information;
1148 } CSMI_SAS_RAID_INFO_BUFFER,
1149   *PCSMI_SAS_RAID_INFO_BUFFER;
1150 
1151 // CC_CSMI_SAS_GET_RAID_CONFIG
1152 
1153 typedef struct _CSMI_SAS_RAID_DRIVES {
1154    __u8  bModel[40];
1155    __u8  bFirmware[8];
1156    __u8  bSerialNumber[40];
1157    __u8  bSASAddress[8];
1158    __u8  bSASLun[8];
1159    __u8  bDriveStatus;
1160    __u8  bDriveUsage;
1161    __u16 usBlockSize;
1162    __u8  bDriveType;
1163    __u8  bReserved[15];
1164    __u32 uDriveIndex;
1165    struct
1166    {
1167       __u32 uLowPart;
1168       __u32 uHighPart;
1169    } ulTotalUserBlocks;
1170 } CSMI_SAS_RAID_DRIVES,
1171   *PCSMI_SAS_RAID_DRIVES;
1172 
1173 typedef struct _CSMI_SAS_RAID_DEVICE_ID {
1174    __u8  bDeviceIdentificationVPDPage[1];
1175 } CSMI_SAS_RAID_DEVICE_ID,
1176   *PCSMI_SAS_RAID_DEVICE_ID;
1177 
1178 typedef struct _CSMI_SAS_RAID_SET_ADDITIONAL_DATA {
1179    __u8  bLabel[16];
1180    __u8  bRaidSetLun[8];
1181    __u8  bWriteProtection;
1182    __u8  bCacheSetting;
1183    __u8  bCacheRatio;
1184    __u16 usBlockSize;
1185    __u8  bReservedBytes[11];
1186    struct
1187    {
1188       __u32 uLowPart;
1189       __u32 uHighPart;
1190    } ulRaidSetExtentOffset;
1191    struct
1192    {
1193       __u32 uLowPart;
1194       __u32 uHighPart;
1195    } ulRaidSetBlocks;
1196    __u32 uStripeSizeInBlocks;
1197    __u32 uSectorsPerTrack;
1198    __u8  bApplicationScratchPad[16];
1199    __u32 uNumberOfHeads;
1200    __u32 uNumberOfTracks;
1201    __u8  bReserved[24];
1202 } CSMI_SAS_RAID_SET_ADDITIONAL_DATA,
1203   *PCSMI_SAS_RAID_SET_ADDITIONAL_DATA;
1204 
1205 typedef struct _CSMI_SAS_RAID_CONFIG {
1206    __u32 uRaidSetIndex;
1207    __u32 uCapacity;
1208    __u32 uStripeSize;
1209    __u8  bRaidType;
1210    __u8  bStatus;
1211    __u8  bInformation;
1212    __u8  bDriveCount;
1213    __u8  bDataType;
1214    __u8  bReserved[11];
1215    __u32 uFailureCode;
1216    __u32 uChangeCount;
1217    union {
1218       CSMI_SAS_RAID_DRIVES Drives[1];
1219       CSMI_SAS_RAID_DEVICE_ID DeviceId[1];
1220       CSMI_SAS_RAID_SET_ADDITIONAL_DATA Data[1];
1221    };
1222 } CSMI_SAS_RAID_CONFIG,
1223    *PCSMI_SAS_RAID_CONFIG;
1224 
1225 typedef struct _CSMI_SAS_RAID_CONFIG_BUFFER {
1226    IOCTL_HEADER IoctlHeader;
1227    CSMI_SAS_RAID_CONFIG Configuration;
1228 } CSMI_SAS_RAID_CONFIG_BUFFER,
1229   *PCSMI_SAS_RAID_CONFIG_BUFFER;
1230 
1231 // CC_CSMI_SAS_GET_RAID_FEATURES
1232 
1233 typedef struct _CSMI_SAS_RAID_TYPE_DESCRIPTION {
1234   __u8  bRaidType;
1235   __u8  bReservedBytes[7];
1236   __u32 uSupportedStripeSizeMap;
1237   __u8  bReserved[24];
1238 } CSMI_SAS_RAID_TYPE_DESCRIPTION,
1239   *PCSMI_SAS_RAID_TYPE_DESCRIPTION;
1240 
1241 typedef struct _CSMI_SAS_RAID_FEATURES {
1242    __u32 uFeatures;
1243    __u8  bReservedFeatures[32];
1244    __u8  bDefaultTransformPriority;
1245    __u8  bTransformPriority;
1246    __u8  bDefaultRebuildPriority;
1247    __u8  bRebuildPriority;
1248    __u8  bDefaultSurfaceScanPriority;
1249    __u8  bSurfaceScanPriority;
1250    __u16 usReserved;
1251    __u32 uRaidSetTransformationRules;
1252    __u32 uReserved[11];
1253    CSMI_SAS_RAID_TYPE_DESCRIPTION RaidType[24];
1254    __u8  bCacheRatiosSupported[104];
1255    __u32 uChangeCount;
1256    __u32 uFailureCode;
1257    __u8  bReserved[120];
1258 } CSMI_SAS_RAID_FEATURES,
1259   *PCSMI_SAS_RAID_FEATURES;
1260 
1261 typedef struct _CSMI_SAS_RAID_FEATURES_BUFFER {
1262    IOCTL_HEADER IoctlHeader;
1263    CSMI_SAS_RAID_FEATURES Information;
1264 } CSMI_SAS_RAID_FEATURES_BUFFER,
1265   *PCSMI_SAS_RAID_FEATURES_BUFFER;
1266 
1267 // CC_CSMI_SAS_SET_RAID_CONTROL
1268 
1269 typedef struct _CSMI_SAS_RAID_CONTROL {
1270    __u8  bTransformPriority;
1271    __u8  bRebuildPriority;
1272    __u8  bCacheRatioFlag;
1273    __u8  bCacheRatio;
1274    __u8  bSurfaceScanPriority;
1275    __u8  bReservedBytes[15];
1276    __u8  bClearConfiguration[8];
1277    __u32 uChangeCount;
1278    __u8  bReserved[88];
1279    __u32 uFailureCode;
1280    __u8  bFailureDescription[80];
1281 } CSMI_SAS_RAID_CONTROL,
1282   *PCSMI_SAS_RAID_CONTROL;
1283 
1284 typedef struct _CSMI_SAS_RAID_CONTROL_BUFFER {
1285    IOCTL_HEADER IoctlHeader;
1286    CSMI_SAS_RAID_CONTROL Information;
1287 } CSMI_SAS_RAID_CONTROL_BUFFER,
1288   *PCSMI_SAS_RAID_CONTROL_BUFFER;
1289 
1290 // CC_CSMI_SAS_GET_RAID_ELEMENT
1291 
1292 typedef struct _CSMI_SAS_DRIVE_EXTENT_INFO {
1293    __u32 uDriveIndex;
1294    __u8  bExtentType;
1295    __u8  bReservedBytes[7];
1296    struct
1297    {
1298       __u32 uLowPart;
1299       __u32 uHighPart;
1300    } ulExtentOffset;
1301    struct
1302    {
1303       __u32 uLowPart;
1304       __u32 uHighPart;
1305    } ulExtentBlocks;
1306    __u32 uRaidSetIndex;
1307    __u8  bReserved[96];
1308 } CSMI_SAS_DRIVE_EXTENT_INFO,
1309   *PCSMI_SAS_DRIVE_EXTENT_INFO;
1310 
1311 typedef struct _CSMI_SAS_RAID_MODULE_INFO {
1312    __u8  bReserved[128];
1313 } CSMI_SAS_RAID_MODULE_INFO,
1314   *PCSMI_SAS_RAID_MODULE_INFO;
1315 
1316 typedef struct _CSMI_SAS_DRIVE_LOCATION {
1317    __u8  bConnector[16];
1318    __u8  bBoxName[16];
1319    __u32 uBay;
1320    __u8  bReservedBytes[4];
1321    __u8  bAttachedSASAddress[8];
1322    __u8  bAttachedPhyIdentifier;
1323    __u8  bReserved[79];
1324 } CSMI_SAS_DRIVE_LOCATION,
1325   *PCSMI_SAS_DRIVE_LOCATION;
1326 
1327 typedef struct _CSMI_SAS_RAID_DRIVES_ADDITIONAL_DATA {
1328    __u8  bNegotiatedLinkRate[2];
1329    __u8  bReserved[126];
1330 } CSMI_SAS_RAID_DRIVES_ADDITIONAL_DATA,
1331   *PCSMI_SAS_RAID_DRIVES_ADDITIONAL_DATA;
1332 
1333 typedef struct _CSMI_SAS_DRIVE_INFO {
1334    CSMI_SAS_RAID_DRIVES Device;
1335    CSMI_SAS_RAID_DRIVES_ADDITIONAL_DATA Data;
1336    CSMI_SAS_DRIVE_LOCATION Location;
1337    __u8  bReserved[16];
1338 } CSMI_SAS_DRIVE_INFO,
1339   *PCSMI_SAS_DRIVE_INFO;
1340 
1341 typedef struct _CSMI_SAS_RAID_ELEMENT {
1342    __u32 uEnumerationType;
1343    __u32 uElementIndex;
1344    __u32 uNumElements;
1345    __u32 uChangeCount;
1346    __u32 uSubElementIndex;
1347    __u8  bReserved[32];
1348    __u32 uFailureCode;
1349    __u8  bFailureDescription[80];
1350    union {
1351        CSMI_SAS_DRIVE_INFO Drive;
1352        CSMI_SAS_RAID_MODULE_INFO Module;
1353        CSMI_SAS_DRIVE_EXTENT_INFO Extent;
1354    } Element;
1355 } CSMI_SAS_RAID_ELEMENT,
1356   *PCSMI_SAS_RAID_ELEMENT;
1357 
1358 typedef struct _CSMI_SAS_RAID_ELEMENT_BUFFER {
1359    IOCTL_HEADER IoctlHeader;
1360    CSMI_SAS_RAID_ELEMENT Information;
1361 } CSMI_SAS_RAID_ELEMENT_BUFFER,
1362   *PCSMI_SAS_RAID_ELEMENT_BUFFER;
1363 
1364 // CC_CSMI_SAS_SET_RAID_OPERATION
1365 
1366 typedef struct _CSMI_SAS_RAID_SET_LIST {
1367    __u32 uRaidSetIndex;
1368    __u8  bExistingLun[8];
1369    __u8  bNewLun[8];
1370    __u8  bReserved[12];
1371 } CSMI_SAS_RAID_SET_LIST,
1372   *PCSMI_SAS_RAID_SET_LIST;
1373 
1374 typedef struct _CSMI_SAS_RAID_SET_DRIVE_LIST {
1375    __u32 uDriveIndex;
1376    __u8  bDriveUsage;
1377    __u8  bReserved[27];
1378 } CSMI_SAS_RAID_SET_DRIVE_LIST,
1379   *PCSMI_SAS_RAID_SET_DRIVE_LIST;
1380 
1381 typedef struct _CSMI_SAS_RAID_SET_SPARE_INFO {
1382    __u32 uRaidSetIndex;
1383    __u32 uDriveCount;
1384    __u8  bApplicationScratchPad[16];
1385    __u8  bReserved[104];
1386 } CSMI_SAS_RAID_SET_SPARE_INFO,
1387   *PCSMI_SAS_RAID_SET_SPARE_INFO;
1388 
1389 typedef struct _CSMI_SAS_RAID_SET_ONLINE_STATE_INFO {
1390    __u32 uRaidSetIndex;
1391    __u8  bOnlineState;
1392    __u8  bReserved[123];
1393 } CSMI_SAS_RAID_SET_ONLINE_STATE_INFO,
1394   *PCSMI_SAS_RAID_SET_ONLINE_STATE_INFO;
1395 
1396 typedef struct _CSMI_SAS_RAID_SET_CACHE_INFO {
1397    __u32 uRaidSetIndex;
1398    __u8  bCacheSetting;
1399    __u8  bCacheRatioFlag;
1400    __u8  bCacheRatio;
1401    __u8  bReserved[121];
1402 } CSMI_SAS_RAID_SET_CACHE_INFO,
1403   *PCSMI_SAS_RAID_SET_CACHE_INFO;
1404 
1405 typedef struct _CSMI_SAS_RAID_SET_WRITE_PROTECT_INFO {
1406    __u32 uRaidSetIndex;
1407    __u8  bWriteProtectSetting;
1408    __u8  bReserved[123];
1409 } CSMI_SAS_RAID_SET_WRITE_PROTECT_INFO,
1410   *PCSMI_SAS_RAID_SET_WRITE_PROTECT_INFO;
1411 
1412 typedef struct _CSMI_SAS_RAID_SET_DELETE_INFO {
1413    __u32 uRaidSetIndex;
1414    __u8  bReserved[124];
1415 } CSMI_SAS_RAID_SET_DELETE_INFO,
1416   *PCSMI_SAS_RAID_SET_DELETE_INFO;
1417 
1418 typedef struct _CSMI_SAS_RAID_SET_MODIFY_INFO {
1419    __u8  bRaidType;
1420    __u8  bReservedBytes[7];
1421    __u32 uStripeSize;
1422    struct
1423    {
1424       __u32 uLowPart;
1425       __u32 uHighPart;
1426    } ulRaidSetBlocks;
1427    struct
1428    {
1429       __u32 uLowPart;
1430       __u32 uHighPart;
1431    } ulRaidSetExtentOffset;
1432    __u32 uDriveCount;
1433    __u8  bReserved[96];
1434 } CSMI_SAS_RAID_SET_MODIFY_INFO,
1435   *PCSMI_SAS_RAID_SET_MODIFY_INFO;
1436 
1437 typedef struct _CSMI_SAS_RAID_SET_TRANSFORM_INFO {
1438    __u8  bTransformType;
1439    __u8  bReservedBytes[3];
1440    __u32 uRaidSetIndex;
1441    __u8  bRaidType;
1442    __u8  bReservedBytes2[11];
1443    __u32 uAdditionalRaidSetIndex;
1444    __u32 uRaidSetCount;
1445    __u8  bApplicationScratchPad[16];
1446    CSMI_SAS_RAID_SET_MODIFY_INFO Modify;
1447    __u8  bReserved[80];
1448 } CSMI_SAS_RAID_SET_TRANSFORM_INFO,
1449   *PCSMI_SAS_RAID_SET_TRANSFORM_INFO;
1450 
1451 typedef struct _CSMI_SAS_RAID_SET_LABEL_INFO {
1452    __u32 uRaidSetIndex;
1453    __u8  bLabel[16];
1454    __u8  bReserved[108];
1455 } CSMI_SAS_RAID_SET_LABEL_INFO,
1456   *PCSMI_SAS_RAID_SET_LABEL_INFO;
1457 
1458 typedef struct _CSMI_SAS_RAID_SET_CREATE_INFO {
1459    __u8  bRaidType;
1460    __u8  bReservedBytes[7];
1461    __u32 uStripeSize;
1462    __u32 uTrackSectorCount;
1463    struct
1464    {
1465       __u32 uLowPart;
1466       __u32 uHighPart;
1467    } ulRaidSetBlocks;
1468    struct
1469    {
1470       __u32 uLowPart;
1471       __u32 uHighPart;
1472    } ulRaidSetExtentOffset;
1473    __u32 uDriveCount;
1474    __u8  bLabel[16];
1475    __u32 uRaidSetIndex;
1476    __u8  bApplicationScratchPad[16];
1477    __u32 uNumberOfHeads;
1478    __u32 uNumberOfTracks;
1479    __u8  bReserved[48];
1480 } CSMI_SAS_RAID_SET_CREATE_INFO,
1481   *PCSMI_SAS_RAID_SET_CREATE_INFO;
1482 
1483 typedef struct _CSMI_SAS_RAID_SET_OPERATION {
1484    __u32 uOperationType;
1485    __u32 uChangeCount;
1486    __u32 uFailureCode;
1487    __u8  bFailureDescription[80];
1488    __u8  bReserved[28];
1489    union {
1490        CSMI_SAS_RAID_SET_CREATE_INFO Create;
1491        CSMI_SAS_RAID_SET_LABEL_INFO Label;
1492        CSMI_SAS_RAID_SET_TRANSFORM_INFO Transform;
1493        CSMI_SAS_RAID_SET_DELETE_INFO Delete;
1494        CSMI_SAS_RAID_SET_WRITE_PROTECT_INFO Protect;
1495        CSMI_SAS_RAID_SET_CACHE_INFO Cache;
1496        CSMI_SAS_RAID_SET_ONLINE_STATE_INFO State;
1497        CSMI_SAS_RAID_SET_SPARE_INFO Spare;
1498    } Operation;
1499    union {
1500        CSMI_SAS_RAID_SET_DRIVE_LIST DriveList[1];
1501        CSMI_SAS_RAID_SET_LIST RaidSetList[1];
1502    } Parameters;
1503 } CSMI_SAS_RAID_SET_OPERATION,
1504   *PCSMI_SAS_RAID_SET_OPERATION;
1505 
1506 typedef struct _CSMI_SAS_RAID_SET_OPERATION_BUFFER {
1507    IOCTL_HEADER IoctlHeader;
1508    CSMI_SAS_RAID_SET_OPERATION Information;
1509 } CSMI_SAS_RAID_SET_OPERATION_BUFFER,
1510   *PCSMI_SAS_RAID_SET_OPERATION_BUFFER;
1511 
1512 /* * * * * * * * * * SAS HBA Class Structures * * * * * * * * * */
1513 
1514 // CC_CSMI_SAS_GET_PHY_INFO
1515 
1516 typedef struct _CSMI_SAS_IDENTIFY {
1517    __u8  bDeviceType;
1518    __u8  bRestricted;
1519    __u8  bInitiatorPortProtocol;
1520    __u8  bTargetPortProtocol;
1521    __u8  bRestricted2[8];
1522    __u8  bSASAddress[8];
1523    __u8  bPhyIdentifier;
1524    __u8  bSignalClass;
1525    __u8  bReserved[6];
1526 } CSMI_SAS_IDENTIFY,
1527   *PCSMI_SAS_IDENTIFY;
1528 
1529 typedef struct _CSMI_SAS_PHY_ENTITY {
1530    CSMI_SAS_IDENTIFY Identify;
1531    __u8  bPortIdentifier;
1532    __u8  bNegotiatedLinkRate;
1533    __u8  bMinimumLinkRate;
1534    __u8  bMaximumLinkRate;
1535    __u8  bPhyChangeCount;
1536    __u8  bAutoDiscover;
1537    __u8  bPhyFeatures;
1538    __u8  bReserved;
1539    CSMI_SAS_IDENTIFY Attached;
1540 } CSMI_SAS_PHY_ENTITY,
1541   *PCSMI_SAS_PHY_ENTITY;
1542 
1543 typedef struct _CSMI_SAS_PHY_INFO {
1544    __u8  bNumberOfPhys;
1545    __u8  bReserved[3];
1546    CSMI_SAS_PHY_ENTITY Phy[32];
1547 } CSMI_SAS_PHY_INFO,
1548   *PCSMI_SAS_PHY_INFO;
1549 
1550 typedef struct _CSMI_SAS_PHY_INFO_BUFFER {
1551    IOCTL_HEADER IoctlHeader;
1552    CSMI_SAS_PHY_INFO Information;
1553 } CSMI_SAS_PHY_INFO_BUFFER,
1554   *PCSMI_SAS_PHY_INFO_BUFFER;
1555 
1556 // CC_CSMI_SAS_SET_PHY_INFO
1557 
1558 typedef struct _CSMI_SAS_SET_PHY_INFO {
1559    __u8  bPhyIdentifier;
1560    __u8  bNegotiatedLinkRate;
1561    __u8  bProgrammedMinimumLinkRate;
1562    __u8  bProgrammedMaximumLinkRate;
1563    __u8  bSignalClass;
1564    __u8  bReserved[3];
1565 } CSMI_SAS_SET_PHY_INFO,
1566   *PCSMI_SAS_SET_PHY_INFO;
1567 
1568 typedef struct _CSMI_SAS_SET_PHY_INFO_BUFFER {
1569    IOCTL_HEADER IoctlHeader;
1570    CSMI_SAS_SET_PHY_INFO Information;
1571 } CSMI_SAS_SET_PHY_INFO_BUFFER,
1572   *PCSMI_SAS_SET_PHY_INFO_BUFFER;
1573 
1574 // CC_CSMI_SAS_GET_LINK_ERRORS
1575 
1576 typedef struct _CSMI_SAS_LINK_ERRORS {
1577    __u8  bPhyIdentifier;
1578    __u8  bResetCounts;
1579    __u8  bReserved[2];
1580    __u32 uInvalidDwordCount;
1581    __u32 uRunningDisparityErrorCount;
1582    __u32 uLossOfDwordSyncCount;
1583    __u32 uPhyResetProblemCount;
1584 } CSMI_SAS_LINK_ERRORS,
1585   *PCSMI_SAS_LINK_ERRORS;
1586 
1587 typedef struct _CSMI_SAS_LINK_ERRORS_BUFFER {
1588    IOCTL_HEADER IoctlHeader;
1589    CSMI_SAS_LINK_ERRORS Information;
1590 } CSMI_SAS_LINK_ERRORS_BUFFER,
1591   *PCSMI_SAS_LINK_ERRORS_BUFFER;
1592 
1593 // CC_CSMI_SAS_SMP_PASSTHRU
1594 
1595 typedef struct _CSMI_SAS_SMP_REQUEST {
1596    __u8  bFrameType;
1597    __u8  bFunction;
1598    __u8  bReserved[2];
1599    __u8  bAdditionalRequestBytes[1016];
1600 } CSMI_SAS_SMP_REQUEST,
1601   *PCSMI_SAS_SMP_REQUEST;
1602 
1603 typedef struct _CSMI_SAS_SMP_RESPONSE {
1604    __u8  bFrameType;
1605    __u8  bFunction;
1606    __u8  bFunctionResult;
1607    __u8  bReserved;
1608    __u8  bAdditionalResponseBytes[1016];
1609 } CSMI_SAS_SMP_RESPONSE,
1610   *PCSMI_SAS_SMP_RESPONSE;
1611 
1612 typedef struct _CSMI_SAS_SMP_PASSTHRU {
1613    __u8  bPhyIdentifier;
1614    __u8  bPortIdentifier;
1615    __u8  bConnectionRate;
1616    __u8  bReserved;
1617    __u8  bDestinationSASAddress[8];
1618    __u32 uRequestLength;
1619    CSMI_SAS_SMP_REQUEST Request;
1620    __u8  bConnectionStatus;
1621    __u8  bReserved2[3];
1622    __u32 uResponseBytes;
1623    CSMI_SAS_SMP_RESPONSE Response;
1624 } CSMI_SAS_SMP_PASSTHRU,
1625   *PCSMI_SAS_SMP_PASSTHRU;
1626 
1627 typedef struct _CSMI_SAS_SMP_PASSTHRU_BUFFER {
1628    IOCTL_HEADER IoctlHeader;
1629    CSMI_SAS_SMP_PASSTHRU Parameters;
1630 } CSMI_SAS_SMP_PASSTHRU_BUFFER,
1631   *PCSMI_SAS_SMP_PASSTHRU_BUFFER;
1632 
1633 // CC_CSMI_SAS_SSP_PASSTHRU
1634 
1635 typedef struct _CSMI_SAS_SSP_PASSTHRU {
1636    __u8  bPhyIdentifier;
1637    __u8  bPortIdentifier;
1638    __u8  bConnectionRate;
1639    __u8  bReserved;
1640    __u8  bDestinationSASAddress[8];
1641    __u8  bLun[8];
1642    __u8  bCDBLength;
1643    __u8  bAdditionalCDBLength;
1644    __u8  bReserved2[2];
1645    __u8  bCDB[16];
1646    __u32 uFlags;
1647    __u8  bAdditionalCDB[24];
1648    __u32 uDataLength;
1649 } CSMI_SAS_SSP_PASSTHRU,
1650   *PCSMI_SAS_SSP_PASSTHRU;
1651 
1652 typedef struct _CSMI_SAS_SSP_PASSTHRU_STATUS {
1653    __u8  bConnectionStatus;
1654    __u8  bSSPStatus;
1655    __u8  bReserved[2];
1656    __u8  bDataPresent;
1657    __u8  bStatus;
1658    __u8  bResponseLength[2];
1659    __u8  bResponse[256];
1660    __u32 uDataBytes;
1661 } CSMI_SAS_SSP_PASSTHRU_STATUS,
1662   *PCSMI_SAS_SSP_PASSTHRU_STATUS;
1663 
1664 typedef struct _CSMI_SAS_SSP_PASSTHRU_BUFFER {
1665    IOCTL_HEADER IoctlHeader;
1666    CSMI_SAS_SSP_PASSTHRU Parameters;
1667    CSMI_SAS_SSP_PASSTHRU_STATUS Status;
1668    __u8  bDataBuffer[1];
1669 } CSMI_SAS_SSP_PASSTHRU_BUFFER,
1670   *PCSMI_SAS_SSP_PASSTHRU_BUFFER;
1671 
1672 // CC_CSMI_SAS_STP_PASSTHRU
1673 
1674 typedef struct _CSMI_SAS_STP_PASSTHRU {
1675    __u8  bPhyIdentifier;
1676    __u8  bPortIdentifier;
1677    __u8  bConnectionRate;
1678    __u8  bReserved;
1679    __u8  bDestinationSASAddress[8];
1680    __u8  bReserved2[4];
1681    __u8  bCommandFIS[20];
1682    __u32 uFlags;
1683    __u32 uDataLength;
1684 } CSMI_SAS_STP_PASSTHRU,
1685   *PCSMI_SAS_STP_PASSTHRU;
1686 
1687 typedef struct _CSMI_SAS_STP_PASSTHRU_STATUS {
1688    __u8  bConnectionStatus;
1689    __u8  bReserved[3];
1690    __u8  bStatusFIS[20];
1691    __u32 uSCR[16];
1692    __u32 uDataBytes;
1693 } CSMI_SAS_STP_PASSTHRU_STATUS,
1694   *PCSMI_SAS_STP_PASSTHRU_STATUS;
1695 
1696 typedef struct _CSMI_SAS_STP_PASSTHRU_BUFFER {
1697    IOCTL_HEADER IoctlHeader;
1698    CSMI_SAS_STP_PASSTHRU Parameters;
1699    CSMI_SAS_STP_PASSTHRU_STATUS Status;
1700    __u8  bDataBuffer[1];
1701 } CSMI_SAS_STP_PASSTHRU_BUFFER,
1702   *PCSMI_SAS_STP_PASSTHRU_BUFFER;
1703 
1704 // CC_CSMI_SAS_GET_SATA_SIGNATURE
1705 
1706 typedef struct _CSMI_SAS_SATA_SIGNATURE {
1707    __u8  bPhyIdentifier;
1708    __u8  bReserved[3];
1709    __u8  bSignatureFIS[20];
1710 } CSMI_SAS_SATA_SIGNATURE,
1711   *PCSMI_SAS_SATA_SIGNATURE;
1712 
1713 typedef struct _CSMI_SAS_SATA_SIGNATURE_BUFFER {
1714    IOCTL_HEADER IoctlHeader;
1715    CSMI_SAS_SATA_SIGNATURE Signature;
1716 } CSMI_SAS_SATA_SIGNATURE_BUFFER,
1717   *PCSMI_SAS_SATA_SIGNATURE_BUFFER;
1718 
1719 // CC_CSMI_SAS_GET_SCSI_ADDRESS
1720 
1721 typedef struct _CSMI_SAS_GET_SCSI_ADDRESS_BUFFER {
1722    IOCTL_HEADER IoctlHeader;
1723    __u8  bSASAddress[8];
1724    __u8  bSASLun[8];
1725    __u8  bHostIndex;
1726    __u8  bPathId;
1727    __u8  bTargetId;
1728    __u8  bLun;
1729 } CSMI_SAS_GET_SCSI_ADDRESS_BUFFER,
1730    *PCSMI_SAS_GET_SCSI_ADDRESS_BUFFER;
1731 
1732 // CC_CSMI_SAS_GET_DEVICE_ADDRESS
1733 
1734 typedef struct _CSMI_SAS_GET_DEVICE_ADDRESS_BUFFER {
1735    IOCTL_HEADER IoctlHeader;
1736    __u8  bHostIndex;
1737    __u8  bPathId;
1738    __u8  bTargetId;
1739    __u8  bLun;
1740    __u8  bSASAddress[8];
1741    __u8  bSASLun[8];
1742 } CSMI_SAS_GET_DEVICE_ADDRESS_BUFFER,
1743   *PCSMI_SAS_GET_DEVICE_ADDRESS_BUFFER;
1744 
1745 // CC_CSMI_SAS_TASK_MANAGEMENT
1746 
1747 typedef struct _CSMI_SAS_SSP_TASK_IU {
1748    __u8  bHostIndex;
1749    __u8  bPathId;
1750    __u8  bTargetId;
1751    __u8  bLun;
1752    __u32 uFlags;
1753    __u32 uQueueTag;
1754    __u32 uReserved;
1755    __u8  bTaskManagementFunction;
1756    __u8  bReserved[7];
1757    __u32 uInformation;
1758 } CSMI_SAS_SSP_TASK_IU,
1759   *PCSMI_SAS_SSP_TASK_IU;
1760 
1761 typedef struct _CSMI_SAS_SSP_TASK_IU_BUFFER {
1762    IOCTL_HEADER IoctlHeader;
1763    CSMI_SAS_SSP_TASK_IU Parameters;
1764    CSMI_SAS_SSP_PASSTHRU_STATUS Status;
1765 } CSMI_SAS_SSP_TASK_IU_BUFFER,
1766   *PCSMI_SAS_SSP_TASK_IU_BUFFER;
1767 
1768 // CC_CSMI_SAS_GET_CONNECTOR_INFO
1769 
1770 typedef struct _CSMI_SAS_GET_CONNECTOR_INFO {
1771    __u32 uPinout;
1772    __u8  bConnector[16];
1773    __u8  bLocation;
1774    __u8  bReserved[15];
1775 } CSMI_SAS_CONNECTOR_INFO,
1776   *PCSMI_SAS_CONNECTOR_INFO;
1777 
1778 typedef struct _CSMI_SAS_CONNECTOR_INFO_BUFFER {
1779    IOCTL_HEADER IoctlHeader;
1780    CSMI_SAS_CONNECTOR_INFO Reference[32];
1781 } CSMI_SAS_CONNECTOR_INFO_BUFFER,
1782   *PCSMI_SAS_CONNECTOR_INFO_BUFFER;
1783 
1784 // CC_CSMI_SAS_GET_LOCATION
1785 
1786 typedef struct _CSMI_SAS_LOCATION_IDENTIFIER {
1787    __u32 bLocationFlags;
1788    __u8  bSASAddress[8];
1789    __u8  bSASLun[8];
1790    __u8  bEnclosureIdentifier[8];
1791    __u8  bEnclosureName[32];
1792    __u8  bBayPrefix[32];
1793    __u8  bBayIdentifier;
1794    __u8  bLocationState;
1795    __u8  bReserved[2];
1796 } CSMI_SAS_LOCATION_IDENTIFIER,
1797   *PCSMI_SAS_LOCATION_IDENTIFIER;
1798 
1799 typedef struct _CSMI_SAS_GET_LOCATION_BUFFER {
1800    IOCTL_HEADER IoctlHeader;
1801    __u8  bHostIndex;
1802    __u8  bPathId;
1803    __u8  bTargetId;
1804    __u8  bLun;
1805    __u8  bIdentify;
1806    __u8  bNumberOfLocationIdentifiers;
1807    __u8  bLengthOfLocationIdentifier;
1808    CSMI_SAS_LOCATION_IDENTIFIER Location[1];
1809 } CSMI_SAS_GET_LOCATION_BUFFER,
1810   *PCSMI_SAS_GET_LOCATION_BUFFER;
1811 
1812 // CC_CSMI_SAS_PHY_CONTROL
1813 
1814 typedef struct _CSMI_SAS_CHARACTER {
1815    __u8  bTypeFlags;
1816    __u8  bValue;
1817 } CSMI_SAS_CHARACTER,
1818   *PCSMI_SAS_CHARACTER;
1819 
1820 typedef struct _CSMI_SAS_PHY_CONTROL {
1821    __u8  bType;
1822    __u8  bRate;
1823    __u8  bReserved[6];
1824    __u32 uVendorUnique[8];
1825    __u32 uTransmitterFlags;
1826    __i8  bTransmitAmplitude;
1827    __i8  bTransmitterPreemphasis;
1828    __i8  bTransmitterSlewRate;
1829    __i8  bTransmitterReserved[13];
1830    __u8  bTransmitterVendorUnique[64];
1831    __u32 uReceiverFlags;
1832    __i8  bReceiverThreshold;
1833    __i8  bReceiverEqualizationGain;
1834    __i8  bReceiverReserved[14];
1835    __u8  bReceiverVendorUnique[64];
1836    __u32 uPatternFlags;
1837    __u8  bFixedPattern;
1838    __u8  bUserPatternLength;
1839    __u8  bPatternReserved[6];
1840    CSMI_SAS_CHARACTER UserPatternBuffer[16];
1841 } CSMI_SAS_PHY_CONTROL,
1842   *PCSMI_SAS_PHY_CONTROL;
1843 
1844 typedef struct _CSMI_SAS_PHY_CONTROL_BUFFER {
1845    IOCTL_HEADER IoctlHeader;
1846    __u32 uFunction;
1847    __u8  bPhyIdentifier;
1848    __u16 usLengthOfControl;
1849    __u8  bNumberOfControls;
1850    __u8  bReserved[4];
1851    __u32 uLinkFlags;
1852    __u8  bSpinupRate;
1853    __u8  bLinkReserved[7];
1854    __u32 uVendorUnique[8];
1855    CSMI_SAS_PHY_CONTROL Control[1];
1856 } CSMI_SAS_PHY_CONTROL_BUFFER,
1857   *PCSMI_SAS_PHY_CONTROL_BUFFER;
1858 
1859 //EDM #pragma CSMI_SAS_END_PACK
1860 #pragma pack()
1861 
1862 #endif // _CSMI_SAS_H_
1863