smartmontools SVN Rev 3317
Utility to control and monitor storage systems with "S.M.A.R.T."
csmisas.h
Go to the documentation of this file.
00001 /**************************************************************************
00002 
00003 Module Name:
00004 
00005    CSMISAS.H
00006 
00007 
00008 Abstract:
00009 
00010    This file contains constants and data structure definitions used by drivers
00011    that support the Common Storage Management Interface specification for
00012    SAS or SATA in either the Windows or Linux.
00013 
00014    This should be considered as a reference implementation only.  Changes may
00015    be necessary to accommodate a specific build environment or target OS.
00016 
00017 Revision History:
00018 
00019    001  SEF   8/12/03  Initial release.
00020    002  SEF   8/20/03  Cleanup to match documentation.
00021    003  SEF   9/12/03  Additional cleanup, created combined header
00022    004  SEF   9/23/03  Changed base types to match linux defaults
00023                        Added RAID signature
00024                        Added bControllerFlags to CSMI_SAS_CNTLR_CONFIG
00025                        Changed CSMI_SAS_BEGIN_PACK to 8 for common structures
00026                        Fixed other typos identified in first compilation test
00027    005  SEF  10/03/03  Additions to match first version of CSMI document
00028    006  SEF  10/14/03  Fixed typedef struct _CSMI_SAS_SMP_PASSTHRU_BUFFER
00029                        Added defines for bConnectionRate
00030    007  SEF  10/15/03  Added Firmware Download Control Code and support
00031                        Added CSMI revision support
00032    008  SEF  10/30/03  No functional change, just updated version to track
00033                        spec changes
00034    009  SEF  12/09/03  No functional change, just updated version to track
00035                        spec changes
00036    010  SEF   3/11/04  Fixed typedef struct CSMI_SAS_RAID_DRIVES to include the
00037                        bFirmware member that is defined in the spec, but
00038                        was missing in this file,
00039                        added CC_CSMI_SAS_TASK_MANAGEMENT
00040    011  SEF   4/02/04  No functional change, added comment line before
00041                        CC_CSMI_SAS_TASK_MANAGEMENT
00042    012  SEF   4/16/04  Added IOControllerNumber to linux header,
00043                        Modified linux control codes to have upper word of
00044                        0xCC77.... to indicate CSMI version 77
00045                        Added bSignalClass to CC_CSMI_SET_PHY_INFO
00046                        Added CC_CSMI_SAS_PHY_CONTROL support
00047    013  SEF   5/14/04  Added CC_CSMI_SAS_GET_CONNECTOR_INFO support
00048    014  SEF   5/24/04  No functional change, just updated version to track spec
00049                        changes
00050    015  SEF   6/16/04  changed bPinout to uPinout to reflect proper size,
00051                        changed width of bLocation defines to reflect size
00052    016  SEF   6/17/04  changed bLengthOfControls in CSMI_SAS_PHY_CONTROL
00053                        to be proper size
00054    017  SEF   9/17/04  added CSMI_SAS_SATA_PORT_SELECTOR,
00055                        CSMI_SAS_LINK_VIRTUAL, CSMI_SAS_CON_NOT_PRESENT, and
00056                        CSMI_SAS_CON_NOT_CONNECTED
00057    018  SEF   9/20/04  added CSMI_SAS_PHY_USER_PATTERN,
00058                        changed definition of CSMI_SAS_PHY_FIXED_PATTERN to not
00059                        conflict with activate definition
00060    019  SEF  12/06/04  added CSMI_SAS_GET_LOCATION
00061                        added bSSPStatus to CSMI_SAS_SSP_PASSTHRU_STATUS
00062                        structure
00063    020  SEF   5/25/05  added CSMI_SAS_PHY_VIRTUAL_SMP, and changes to
00064                        CSMI_SAS_GET_LOCATION
00065    021  SEF  11/03/05  added new RAID creation functionality
00066    022  SEF   2/01/06  corrected typo bNegotitiatedLInkRate
00067                        Added two more RAID_TYPES, 7 and 8
00068    023  SEF   4/04/06  added CSMI_RAID_TYPE_1E
00069                        changed structures that contained surface scan
00070                        to priority approach rather than time, causes
00071                        0.89 to incompatible with 0.87, so a version
00072                        check is necessary when interpreting the
00073                        raid structures
00074                        Added netware section
00075    024 DRG    5/22/06  Added uFailureCode to CSMI_SAS_RAID_CONFIG and
00076                        CSMI_SAS_RAID_FEATURES
00077                        Changed __u64 fields to high and low __u32 fields in
00078                        order to avoid backward compatibility issues with
00079                        packing and alignment.
00080                        Fixed alignment problem in CSMI_SAS_RAID_DRIVES.
00081                        Added CSMI_SAS_CNTLR_SMART_ARRAY to uControllerFlags
00082                        Reassigned the value of CSMI_SAS_CNTLR_RAID_CFG_SUPPORT
00083                        to avoid a conflict.
00084 
00085 **************************************************************************/
00086 
00087 #ifndef _CSMI_SAS_H_
00088 #define _CSMI_SAS_H_
00089 
00090 // CSMI Specification Revision, the intent is that all versions of the
00091 // specification will be backward compatible after the 1.00 release.
00092 // Major revision number, corresponds to xxxx. of CSMI specification
00093 // Minor revision number, corresponds to .xxxx of CSMI specification
00094 #define CSMI_MAJOR_REVISION   0
00095 #define CSMI_MINOR_REVISION   90
00096 
00097 /*************************************************************************/
00098 /* PATCHES FOR TYPOS                                                     */
00099 /*************************************************************************/
00100 
00101 #define bNegotitiatedLInkRate bNegotiatedLinkRate
00102 
00103 /*************************************************************************/
00104 /* TARGET OS LINUX SPECIFIC CODE                                         */
00105 /*************************************************************************/
00106 
00107 // EDM #ifdef _linux
00108 #ifdef __KERNEL__
00109 
00110 // Linux base types
00111 
00112 #include <linux/types.h>
00113 
00114 #define __i8    char
00115 
00116 // pack definition
00117 
00118 // EDM #define CSMI_SAS_BEGIN_PACK(x)    pack(x)
00119 // EDM #define CSMI_SAS_END_PACK         pack()
00120 
00121 // IOCTL Control Codes
00122 // (IoctlHeader.ControlCode)
00123 
00124 // Control Codes prior to 0.77
00125 
00126 // Control Codes requiring CSMI_ALL_SIGNATURE
00127 
00128 // #define CC_CSMI_SAS_GET_DRIVER_INFO    0x12345678
00129 // #define CC_CSMI_SAS_GET_CNTLR_CONFIG   0x23456781
00130 // #define CC_CSMI_SAS_GET_CNTLR_STATUS   0x34567812
00131 // #define CC_CSMI_SAS_FIRMWARE_DOWNLOAD  0x92345678
00132 
00133 // Control Codes requiring CSMI_RAID_SIGNATURE
00134 
00135 // #define CC_CSMI_SAS_GET_RAID_INFO      0x45678123
00136 // #define CC_CSMI_SAS_GET_RAID_CONFIG    0x56781234
00137 
00138 // Control Codes requiring CSMI_SAS_SIGNATURE
00139 
00140 // #define CC_CSMI_SAS_GET_PHY_INFO       0x67812345
00141 // #define CC_CSMI_SAS_SET_PHY_INFO       0x78123456
00142 // #define CC_CSMI_SAS_GET_LINK_ERRORS    0x81234567
00143 // #define CC_CSMI_SAS_SMP_PASSTHRU       0xA1234567
00144 // #define CC_CSMI_SAS_SSP_PASSTHRU       0xB1234567
00145 // #define CC_CSMI_SAS_STP_PASSTHRU       0xC1234567
00146 // #define CC_CSMI_SAS_GET_SATA_SIGNATURE 0xD1234567
00147 // #define CC_CSMI_SAS_GET_SCSI_ADDRESS   0xE1234567
00148 // #define CC_CSMI_SAS_GET_DEVICE_ADDRESS 0xF1234567
00149 // #define CC_CSMI_SAS_TASK_MANAGEMENT    0xA2345678
00150 
00151 // Control Codes for 0.77 and later
00152 
00153 // Control Codes requiring CSMI_ALL_SIGNATURE
00154 
00155 #define CC_CSMI_SAS_GET_DRIVER_INFO    0xCC770001
00156 #define CC_CSMI_SAS_GET_CNTLR_CONFIG   0xCC770002
00157 #define CC_CSMI_SAS_GET_CNTLR_STATUS   0xCC770003
00158 #define CC_CSMI_SAS_FIRMWARE_DOWNLOAD  0xCC770004
00159 
00160 // Control Codes requiring CSMI_RAID_SIGNATURE
00161 
00162 #define CC_CSMI_SAS_GET_RAID_INFO      0xCC77000A
00163 #define CC_CSMI_SAS_GET_RAID_CONFIG    0xCC77000B
00164 #define CC_CSMI_SAS_GET_RAID_FEATURES  0xCC77000C
00165 #define CC_CSMI_SAS_SET_RAID_CONTROL   0xCC77000D
00166 #define CC_CSMI_SAS_GET_RAID_ELEMENT   0xCC77000E
00167 #define CC_CSMI_SAS_SET_RAID_OPERATION 0xCC77000F
00168 
00169 // Control Codes requiring CSMI_SAS_SIGNATURE
00170 
00171 #define CC_CSMI_SAS_GET_PHY_INFO       0xCC770014
00172 #define CC_CSMI_SAS_SET_PHY_INFO       0xCC770015
00173 #define CC_CSMI_SAS_GET_LINK_ERRORS    0xCC770016
00174 #define CC_CSMI_SAS_SMP_PASSTHRU       0xCC770017
00175 #define CC_CSMI_SAS_SSP_PASSTHRU       0xCC770018
00176 #define CC_CSMI_SAS_STP_PASSTHRU       0xCC770019
00177 #define CC_CSMI_SAS_GET_SATA_SIGNATURE 0xCC770020
00178 #define CC_CSMI_SAS_GET_SCSI_ADDRESS   0xCC770021
00179 #define CC_CSMI_SAS_GET_DEVICE_ADDRESS 0xCC770022
00180 #define CC_CSMI_SAS_TASK_MANAGEMENT    0xCC770023
00181 #define CC_CSMI_SAS_GET_CONNECTOR_INFO 0xCC770024
00182 #define CC_CSMI_SAS_GET_LOCATION       0xCC770025
00183 
00184 
00185 // Control Codes requiring CSMI_PHY_SIGNATURE
00186 
00187 #define CC_CSMI_SAS_PHY_CONTROL        0xCC77003C
00188 
00189 // EDM #pragma CSMI_SAS_BEGIN_PACK(8)
00190 #pragma pack(8)
00191 
00192 // IOCTL_HEADER
00193 typedef struct _IOCTL_HEADER {
00194     __u32 IOControllerNumber;
00195     __u32 Length;
00196     __u32 ReturnCode;
00197     __u32 Timeout;
00198     __u16 Direction;
00199 } IOCTL_HEADER,
00200   *PIOCTL_HEADER;
00201 
00202 // EDM #pragma CSMI_SAS_END_PACK
00203 #pragma pack()
00204 
00205 #endif
00206 
00207 /*************************************************************************/
00208 /* TARGET OS WINDOWS SPECIFIC CODE                                       */
00209 /*************************************************************************/
00210 
00211 #ifdef _WIN32
00212 
00213 // windows IOCTL definitions
00214 
00215 #if 0 // <ntddscsi.h> and CSMI_*_PACK are no longer needed
00216 
00217 #ifndef _NTDDSCSIH_
00218 #include <ntddscsi.h>
00219 #endif
00220 
00221 // pack definition
00222 
00223 #if defined _MSC_VER
00224    #define CSMI_SAS_BEGIN_PACK(x)    pack(push,x)
00225    #define CSMI_SAS_END_PACK         pack(pop)
00226 #elif defined __BORLANDC__
00227    #define CSMI_SAS_BEGIN_PACK(x)    option -a##x
00228    #define CSMI_SAS_END_PACK         option -a.
00229 #else
00230    #error "CSMISAS.H - Must externally define a pack compiler designator."
00231 #endif
00232 
00233 #endif // #if 0
00234 
00235 // base types
00236 
00237 #define __u8    unsigned char
00238 #define __u16   unsigned short
00239 #ifndef __LP64__  // ILP32 (32-bit), LLP64 (64-bit MSVC, MinGW)
00240 #define __u32   unsigned long
00241 #else             // LP64 (64-bit Cygwin)
00242 #define __u32   unsigned int
00243 #endif
00244 #define __u64   unsigned __int64
00245 
00246 #define __i8    char
00247 
00248 // IOCTL Control Codes
00249 // (IoctlHeader.ControlCode)
00250 
00251 // Control Codes requiring CSMI_ALL_SIGNATURE
00252 
00253 #define CC_CSMI_SAS_GET_DRIVER_INFO    1
00254 #define CC_CSMI_SAS_GET_CNTLR_CONFIG   2
00255 #define CC_CSMI_SAS_GET_CNTLR_STATUS   3
00256 #define CC_CSMI_SAS_FIRMWARE_DOWNLOAD  4
00257 
00258 // Control Codes requiring CSMI_RAID_SIGNATURE
00259 
00260 #define CC_CSMI_SAS_GET_RAID_INFO      10
00261 #define CC_CSMI_SAS_GET_RAID_CONFIG    11
00262 #define CC_CSMI_SAS_GET_RAID_FEATURES  12
00263 #define CC_CSMI_SAS_SET_RAID_CONTROL   13
00264 #define CC_CSMI_SAS_GET_RAID_ELEMENT   14
00265 #define CC_CSMI_SAS_SET_RAID_OPERATION 15
00266 
00267 // Control Codes requiring CSMI_SAS_SIGNATURE
00268 
00269 #define CC_CSMI_SAS_GET_PHY_INFO       20
00270 #define CC_CSMI_SAS_SET_PHY_INFO       21
00271 #define CC_CSMI_SAS_GET_LINK_ERRORS    22
00272 #define CC_CSMI_SAS_SMP_PASSTHRU       23
00273 #define CC_CSMI_SAS_SSP_PASSTHRU       24
00274 #define CC_CSMI_SAS_STP_PASSTHRU       25
00275 #define CC_CSMI_SAS_GET_SATA_SIGNATURE 26
00276 #define CC_CSMI_SAS_GET_SCSI_ADDRESS   27
00277 #define CC_CSMI_SAS_GET_DEVICE_ADDRESS 28
00278 #define CC_CSMI_SAS_TASK_MANAGEMENT    29
00279 #define CC_CSMI_SAS_GET_CONNECTOR_INFO 30
00280 #define CC_CSMI_SAS_GET_LOCATION       31
00281 
00282 // Control Codes requiring CSMI_PHY_SIGNATURE
00283 
00284 #define CC_CSMI_SAS_PHY_CONTROL        60
00285 
00286 #define IOCTL_HEADER SRB_IO_CONTROL
00287 #define PIOCTL_HEADER PSRB_IO_CONTROL
00288 
00289 #endif
00290 
00291 /*************************************************************************/
00292 /* TARGET OS NETWARE SPECIFIC CODE                                       */
00293 /*************************************************************************/
00294 
00295 #ifdef _NETWARE
00296 
00297 // NetWare IOCTL definitions
00298 
00299 #define CSMI_SAS_BEGIN_PACK(x)    pack(x)
00300 #define CSMI_SAS_END_PACK         pack()
00301 
00302 #ifndef LONG
00303 typedef unsigned long LONG;
00304 #endif
00305 
00306 #ifndef WORD
00307 typedef unsigned short WORD;
00308 #endif
00309 
00310 #ifndef BYTE
00311 typedef unsigned char BYTE;
00312 #endif
00313 
00314 /* Need to have these definitions for Netware */
00315 #define __u8    unsigned char
00316 #define __u16   unsigned short
00317 #define __u32   unsigned long
00318 #define __u64   unsigned __int64
00319 
00320 #define __i8    char
00321 
00322 
00323 // EDM #pragma CSMI_SAS_BEGIN_PACK(8)
00324 #pragma pack(8)
00325 
00326 // IOCTL_HEADER
00327 typedef struct _IOCTL_HEADER {
00328     __u32 Length;
00329     __u32 ReturnCode;
00330 } IOCTL_HEADER,
00331   *PIOCTL_HEADER;
00332 
00333 // EDM #pragma CSMI_SAS_END_PACK
00334 #pragma pack()
00335 
00336 // IOCTL Control Codes
00337 // (IoctlHeader.ControlCode)
00338 
00339 // Control Codes requiring CSMI_ALL_SIGNATURE
00340 
00341 #define CC_CSMI_SAS_GET_DRIVER_INFO    0x01FF0001
00342 #define CC_CSMI_SAS_GET_CNTLR_CONFIG   0x01FF0002
00343 #define CC_CSMI_SAS_GET_CNTLR_STATUS   0x01FF0003
00344 #define CC_CSMI_SAS_FIRMWARE_DOWNLOAD  0x01FF0004
00345 
00346 // Control Codes requiring CSMI_RAID_SIGNATURE
00347 
00348 #define CC_CSMI_SAS_GET_RAID_INFO      0x01FF000A
00349 #define CC_CSMI_SAS_GET_RAID_CONFIG    0x01FF000B
00350 #define CC_CSMI_SAS_GET_RAID_FEATURES  0x01FF000C
00351 #define CC_CSMI_SAS_SET_RAID_CONTROL   0x01FF000D
00352 #define CC_CSMI_SAS_GET_RAID_ELEMENT   0x01FF000E
00353 #define CC_CSMI_SAS_SET_RAID_OPERATION 0x01FF000F
00354 
00355 // Control Codes requiring CSMI_SAS_SIGNATURE
00356 
00357 #define CC_CSMI_SAS_GET_PHY_INFO       0x01FF0014
00358 #define CC_CSMI_SAS_SET_PHY_INFO       0x01FF0015
00359 #define CC_CSMI_SAS_GET_LINK_ERRORS    0x01FF0016
00360 #define CC_CSMI_SAS_SMP_PASSTHRU       0x01FF0017
00361 #define CC_CSMI_SAS_SSP_PASSTHRU       0x01FF0018
00362 #define CC_CSMI_SAS_STP_PASSTHRU       0x01FF0019
00363 #define CC_CSMI_SAS_GET_SATA_SIGNATURE 0x01FF001A
00364 #define CC_CSMI_SAS_GET_SCSI_ADDRESS   0x01FF001B
00365 #define CC_CSMI_SAS_GET_DEVICE_ADDRESS 0x01FF001C
00366 #define CC_CSMI_SAS_TASK_MANAGEMENT    0x01FF001D
00367 #define CC_CSMI_SAS_GET_CONNECTOR_INFO 0x01FF001E
00368 #define CC_CSMI_SAS_GET_LOCATION       0x01FF001F
00369 
00370 // Control Codes requiring CSMI_PHY_SIGNATURE
00371 
00372 #define CC_CSMI_SAS_PHY_CONTROL        60
00373 
00374 #endif
00375 
00376 /*************************************************************************/
00377 /* TARGET OS NOT DEFINED ERROR                                           */
00378 /*************************************************************************/
00379 
00380 // EDM
00381 //#if (!_WIN32 && !_linux && !_NETWARE)
00382 //   #error "Unknown target OS."
00383 //#endif
00384 
00385 /*************************************************************************/
00386 /* OS INDEPENDENT CODE                                                   */
00387 /*************************************************************************/
00388 
00389 /* * * * * * * * * * Class Independent IOCTL Constants * * * * * * * * * */
00390 
00391 // Return codes for all IOCTL's regardless of class
00392 // (IoctlHeader.ReturnCode)
00393 
00394 #define CSMI_SAS_STATUS_SUCCESS              0
00395 #define CSMI_SAS_STATUS_FAILED               1
00396 #define CSMI_SAS_STATUS_BAD_CNTL_CODE        2
00397 #define CSMI_SAS_STATUS_INVALID_PARAMETER    3
00398 #define CSMI_SAS_STATUS_WRITE_ATTEMPTED      4
00399 
00400 // Signature value
00401 // (IoctlHeader.Signature)
00402 
00403 #define CSMI_ALL_SIGNATURE    "CSMIALL"
00404 
00405 // Timeout value default of 60 seconds
00406 // (IoctlHeader.Timeout)
00407 
00408 #define CSMI_ALL_TIMEOUT      60
00409 
00410 //  Direction values for data flow on this IOCTL
00411 // (IoctlHeader.Direction, Linux only)
00412 #define CSMI_SAS_DATA_READ    0
00413 #define CSMI_SAS_DATA_WRITE   1
00414 
00415 // I/O Bus Types
00416 // ISA and EISA bus types are not supported
00417 // (bIoBusType)
00418 
00419 #define CSMI_SAS_BUS_TYPE_PCI       3
00420 #define CSMI_SAS_BUS_TYPE_PCMCIA    4
00421 
00422 // Controller Status
00423 // (uStatus)
00424 
00425 #define CSMI_SAS_CNTLR_STATUS_GOOD     1
00426 #define CSMI_SAS_CNTLR_STATUS_FAILED   2
00427 #define CSMI_SAS_CNTLR_STATUS_OFFLINE  3
00428 #define CSMI_SAS_CNTLR_STATUS_POWEROFF 4
00429 
00430 // Offline Status Reason
00431 // (uOfflineReason)
00432 
00433 #define CSMI_SAS_OFFLINE_REASON_NO_REASON             0
00434 #define CSMI_SAS_OFFLINE_REASON_INITIALIZING          1
00435 #define CSMI_SAS_OFFLINE_REASON_BACKSIDE_BUS_DEGRADED 2
00436 #define CSMI_SAS_OFFLINE_REASON_BACKSIDE_BUS_FAILURE  3
00437 
00438 // Controller Class
00439 // (bControllerClass)
00440 
00441 #define CSMI_SAS_CNTLR_CLASS_HBA    5
00442 
00443 // Controller Flag bits
00444 // (uControllerFlags)
00445 
00446 #define CSMI_SAS_CNTLR_SAS_HBA          0x00000001
00447 #define CSMI_SAS_CNTLR_SAS_RAID         0x00000002
00448 #define CSMI_SAS_CNTLR_SATA_HBA         0x00000004
00449 #define CSMI_SAS_CNTLR_SATA_RAID        0x00000008
00450 #define CSMI_SAS_CNTLR_SMART_ARRAY      0x00000010
00451 
00452 // for firmware download
00453 #define CSMI_SAS_CNTLR_FWD_SUPPORT      0x00010000
00454 #define CSMI_SAS_CNTLR_FWD_ONLINE       0x00020000
00455 #define CSMI_SAS_CNTLR_FWD_SRESET       0x00040000
00456 #define CSMI_SAS_CNTLR_FWD_HRESET       0x00080000
00457 #define CSMI_SAS_CNTLR_FWD_RROM         0x00100000
00458 
00459 // for RAID configuration supported
00460 #define CSMI_SAS_CNTLR_RAID_CFG_SUPPORT 0x01000000
00461 
00462 // Download Flag bits
00463 // (uDownloadFlags)
00464 #define CSMI_SAS_FWD_VALIDATE       0x00000001
00465 #define CSMI_SAS_FWD_SOFT_RESET     0x00000002
00466 #define CSMI_SAS_FWD_HARD_RESET     0x00000004
00467 
00468 // Firmware Download Status
00469 // (usStatus)
00470 #define CSMI_SAS_FWD_SUCCESS        0
00471 #define CSMI_SAS_FWD_FAILED         1
00472 #define CSMI_SAS_FWD_USING_RROM     2
00473 #define CSMI_SAS_FWD_REJECT         3
00474 #define CSMI_SAS_FWD_DOWNREV        4
00475 
00476 // Firmware Download Severity
00477 // (usSeverity>
00478 #define CSMI_SAS_FWD_INFORMATION    0
00479 #define CSMI_SAS_FWD_WARNING        1
00480 #define CSMI_SAS_FWD_ERROR          2
00481 #define CSMI_SAS_FWD_FATAL          3
00482 
00483 /* * * * * * * * * * SAS RAID Class IOCTL Constants  * * * * * * * * */
00484 
00485 // Return codes for the RAID IOCTL's regardless of class
00486 // (IoctlHeader.ReturnCode)
00487 
00488 #define CSMI_SAS_RAID_SET_OUT_OF_RANGE       1000
00489 #define CSMI_SAS_RAID_SET_BUFFER_TOO_SMALL   1001
00490 #define CSMI_SAS_RAID_SET_DATA_CHANGED       1002
00491 
00492 // Signature value
00493 // (IoctlHeader.Signature)
00494 
00495 #define CSMI_RAID_SIGNATURE    "CSMIARY"
00496 
00497 // Timeout value default of 60 seconds
00498 // (IoctlHeader.Timeout)
00499 
00500 #define CSMI_RAID_TIMEOUT      60
00501 
00502 // RAID Types
00503 // (bRaidType)
00504 #define CSMI_SAS_RAID_TYPE_NONE     0
00505 #define CSMI_SAS_RAID_TYPE_0        1
00506 #define CSMI_SAS_RAID_TYPE_1        2
00507 #define CSMI_SAS_RAID_TYPE_10       3
00508 #define CSMI_SAS_RAID_TYPE_5        4
00509 #define CSMI_SAS_RAID_TYPE_15       5
00510 #define CSMI_SAS_RAID_TYPE_6        6
00511 #define CSMI_SAS_RAID_TYPE_50       7
00512 #define CSMI_SAS_RAID_TYPE_VOLUME   8
00513 #define CSMI_SAS_RAID_TYPE_1E       9
00514 #define CSMI_SAS_RAID_TYPE_OTHER    255
00515 // the last value 255 was already defined for other
00516 // so end is defined as 254
00517 #define CSMI_SAS_RAID_TYPE_END      254
00518 
00519 // RAID Status
00520 // (bStatus)
00521 #define CSMI_SAS_RAID_SET_STATUS_OK             0
00522 #define CSMI_SAS_RAID_SET_STATUS_DEGRADED       1
00523 #define CSMI_SAS_RAID_SET_STATUS_REBUILDING     2
00524 #define CSMI_SAS_RAID_SET_STATUS_FAILED         3
00525 #define CSMI_SAS_RAID_SET_STATUS_OFFLINE        4
00526 #define CSMI_SAS_RAID_SET_STATUS_TRANSFORMING   5
00527 #define CSMI_SAS_RAID_SET_STATUS_QUEUED_FOR_REBUILD         6
00528 #define CSMI_SAS_RAID_SET_STATUS_QUEUED_FOR_TRANSFORMATION  7
00529 
00530 // RAID Drive Count
00531 // (bDriveCount, 0xF1 to 0xFF are reserved)
00532 #define CSMI_SAS_RAID_DRIVE_COUNT_TOO_BIG   0xF1
00533 #define CSMI_SAS_RAID_DRIVE_COUNT_SUPRESSED 0xF2
00534 
00535 // RAID Data Type
00536 // (bDataType)
00537 #define CSMI_SAS_RAID_DATA_DRIVES           0
00538 #define CSMI_SAS_RAID_DATA_DEVICE_ID        1
00539 #define CSMI_SAS_RAID_DATA_ADDITIONAL_DATA  2
00540 
00541 // RAID Drive Status
00542 // (bDriveStatus)
00543 #define CSMI_SAS_DRIVE_STATUS_OK          0
00544 #define CSMI_SAS_DRIVE_STATUS_REBUILDING  1
00545 #define CSMI_SAS_DRIVE_STATUS_FAILED      2
00546 #define CSMI_SAS_DRIVE_STATUS_DEGRADED    3
00547 #define CSMI_SAS_DRIVE_STATUS_OFFLINE     4
00548 #define CSMI_SAS_DRIVE_STATUS_QUEUED_FOR_REBUILD 5
00549 
00550 // RAID Drive Usage
00551 // (bDriveUsage)
00552 #define CSMI_SAS_DRIVE_CONFIG_NOT_USED      0
00553 #define CSMI_SAS_DRIVE_CONFIG_MEMBER        1
00554 #define CSMI_SAS_DRIVE_CONFIG_SPARE         2
00555 #define CSMI_SAS_DRIVE_CONFIG_SPARE_ACTIVE  3
00556 
00557 // RAID Drive Type
00558 // (bDriveType)
00559 #define CSMI_SAS_DRIVE_TYPE_UNKNOWN         0
00560 #define CSMI_SAS_DRIVE_TYPE_SINGLE_PORT_SAS 1
00561 #define CSMI_SAS_DRIVE_TYPE_DUAL_PORT_SAS   2
00562 #define CSMI_SAS_DRIVE_TYPE_SATA            3
00563 #define CSMI_SAS_DRIVE_TYPE_SATA_PS         4
00564 #define CSMI_SAS_DRIVE_TYPE_OTHER           255
00565 
00566 // RAID Write Protect
00567 // (bWriteProtect)
00568 #define CSMI_SAS_RAID_SET_WRITE_PROTECT_UNKNOWN     0
00569 #define CSMI_SAS_RAID_SET_WRITE_PROTECT_UNCHANGED   0
00570 #define CSMI_SAS_RAID_SET_WRITE_PROTECT_ENABLED     1
00571 #define CSMI_SAS_RAID_SET_WRITE_PROTECT_DISABLED    2
00572 
00573 // RAID Cache Setting
00574 // (bCacheSetting)
00575 #define CSMI_SAS_RAID_SET_CACHE_UNKNOWN             0
00576 #define CSMI_SAS_RAID_SET_CACHE_UNCHANGED           0
00577 #define CSMI_SAS_RAID_SET_CACHE_ENABLED             1
00578 #define CSMI_SAS_RAID_SET_CACHE_DISABLED            2
00579 #define CSMI_SAS_RAID_SET_CACHE_CORRUPT             3
00580 
00581 // RAID Features
00582 // (uFeatures)
00583 #define CSMI_SAS_RAID_FEATURE_TRANSFORMATION    0x00000001
00584 #define CSMI_SAS_RAID_FEATURE_REBUILD           0x00000002
00585 #define CSMI_SAS_RAID_FEATURE_SPLIT_MIRROR      0x00000004
00586 #define CSMI_SAS_RAID_FEATURE_MERGE_MIRROR      0x00000008
00587 #define CSMI_SAS_RAID_FEATURE_LUN_RENUMBER      0x00000010
00588 #define CSMI_SAS_RAID_FEATURE_SURFACE_SCAN      0x00000020
00589 #define CSMI_SAS_RAID_FEATURE_SPARES_SHARED     0x00000040
00590 
00591 // RAID Priority
00592 // (bDefaultTransformPriority, etc.)
00593 #define CSMI_SAS_PRIORITY_UNKNOWN   0
00594 #define CSMI_SAS_PRIORITY_UNCHANGED 0
00595 #define CSMI_SAS_PRIORITY_AUTO      1
00596 #define CSMI_SAS_PRIORITY_OFF       2
00597 #define CSMI_SAS_PRIORITY_LOW       3
00598 #define CSMI_SAS_PRIORITY_MEDIUM    4
00599 #define CSMI_SAS_PRIORITY_HIGH      5
00600 
00601 // RAID Transformation Rules
00602 // (uRaidSetTransformationRules)
00603 #define CSMI_SAS_RAID_RULE_AVAILABLE_MEMORY     0x00000001
00604 #define CSMI_SAS_RAID_RULE_OVERLAPPED_EXTENTS   0x00000002
00605 
00606 // RAID Cache Ratios Supported
00607 // (bCacheRatiosSupported)
00608 // from 0 to 100 defines the write to read ratio, 0 is 100% write
00609 #define CSMI_SAS_RAID_CACHE_RATIO_RANGE     101
00610 #define CSMI_SAS_RAID_CACHE_RATIO_FIXED     102
00611 #define CSMI_SAS_RAID_CACHE_RATIO_AUTO      103
00612 #define CSMI_SAS_RAID_CACHE_RATIO_END       255
00613 
00614 // RAID Cache Ratio Flag
00615 // (bCacheRatioFlag)
00616 #define CSMI_SAS_RAID_CACHE_RATIO_DISABLE   0
00617 #define CSMI_SAS_RAID_CACHE_RATIO_ENABLE    1
00618 
00619 // RAID Clear Configuration Signature
00620 // (bClearConfiguration)
00621 #define CSMI_SAS_RAID_CLEAR_CONFIGURATION_SIGNATURE "RAIDCLR"
00622 
00623 // RAID Failure Codes
00624 // (uFailureCode)
00625 #define CSMI_SAS_FAIL_CODE_OK                           0
00626 #define CSMI_SAS_FAIL_CODE_PARAMETER_INVALID            1000
00627 #define CSMI_SAS_FAIL_CODE_TRANSFORM_PRIORITY_INVALID   1001
00628 #define CSMI_SAS_FAIL_CODE_REBUILD_PRIORITY_INVALID     1002
00629 #define CSMI_SAS_FAIL_CODE_CACHE_RATIO_INVALID          1003
00630 #define CSMI_SAS_FAIL_CODE_SURFACE_SCAN_INVALID         1004
00631 #define CSMI_SAS_FAIL_CODE_CLEAR_CONFIGURATION_INVALID  1005
00632 #define CSMI_SAS_FAIL_CODE_ELEMENT_INDEX_INVALID        1006
00633 #define CSMI_SAS_FAIL_CODE_SUBELEMENT_INDEX_INVALID     1007
00634 #define CSMI_SAS_FAIL_CODE_EXTENT_INVALID               1008
00635 #define CSMI_SAS_FAIL_CODE_BLOCK_COUNT_INVALID          1009
00636 #define CSMI_SAS_FAIL_CODE_DRIVE_INDEX_INVALID          1010
00637 #define CSMI_SAS_FAIL_CODE_EXISTING_LUN_INVALID         1011
00638 #define CSMI_SAS_FAIL_CODE_RAID_TYPE_INVALID            1012
00639 #define CSMI_SAS_FAIL_CODE_STRIPE_SIZE_INVALID          1013
00640 #define CSMI_SAS_FAIL_CODE_TRANSFORMATION_INVALID       1014
00641 #define CSMI_SAS_FAIL_CODE_CHANGE_COUNT_INVALID         1015
00642 #define CSMI_SAS_FAIL_CODE_ENUMERATION_TYPE_INVALID     1016
00643 
00644 #define CSMI_SAS_FAIL_CODE_EXCEEDED_RAID_SET_COUNT      2000
00645 #define CSMI_SAS_FAIL_CODE_DUPLICATE_LUN                2001
00646 
00647 #define CSMI_SAS_FAIL_CODE_WAIT_FOR_OPERATION           3000
00648 
00649 // RAID Enumeration Types
00650 // (uEnumerationType)
00651 #define CSMI_SAS_RAID_ELEMENT_TYPE_DRIVE                0
00652 #define CSMI_SAS_RAID_ELEMENT_TYPE_MODULE               1
00653 #define CSMI_SAS_RAID_ELEMENT_TYPE_DRIVE_RAID_SET       2
00654 #define CSMI_SAS_RAID_ELEMENT_TYPE_EXTENT_DRIVE         3
00655 
00656 // RAID Extent Types
00657 // (bExtentType)
00658 #define CSMI_SAS_RAID_EXTENT_RESERVED       0
00659 #define CSMI_SAS_RAID_EXTENT_METADATA       1
00660 #define CSMI_SAS_RAID_EXTENT_ALLOCATED      2
00661 #define CSMI_SAS_RAID_EXTENT_UNALLOCATED    3
00662 
00663 // RAID Operation Types
00664 // (uOperationType)
00665 #define CSMI_SAS_RAID_SET_CREATE            0
00666 #define CSMI_SAS_RAID_SET_LABEL             1
00667 #define CSMI_SAS_RAID_SET_TRANSFORM         2
00668 #define CSMI_SAS_RAID_SET_DELETE            3
00669 #define CSMI_SAS_RAID_SET_WRITE_PROTECT     4
00670 #define CSMI_SAS_RAID_SET_CACHE             5
00671 #define CSMI_SAS_RAID_SET_ONLINE_STATE      6
00672 #define CSMI_SAS_RAID_SET_SPARE             7
00673 
00674 // RAID Transform Types
00675 // (bTransformType)
00676 #define CSMI_SAS_RAID_SET_TRANSFORM_SPLIT_MIRROR    0
00677 #define CSMI_SAS_RAID_SET_TRANSFORM_MERGE_RAID_0    1
00678 #define CSMI_SAS_RAID_SET_TRANSFORM_LUN_RENUMBER    2
00679 #define CSMI_SAS_RAID_SET_TRANSFORM_RAID_SET        3
00680 
00681 // RAID Online State
00682 // (bOnlineState)
00683 #define CSMI_SAS_RAID_SET_STATE_UNKNOWN     0
00684 #define CSMI_SAS_RAID_SET_STATE_ONLINE      1
00685 #define CSMI_SAS_RAID_SET_STATE_OFFLINE     2
00686 
00687 /* * * * * * * * * * SAS HBA Class IOCTL Constants * * * * * * * * * */
00688 
00689 // Return codes for SAS IOCTL's
00690 // (IoctlHeader.ReturnCode)
00691 
00692 #define CSMI_SAS_PHY_INFO_CHANGED            CSMI_SAS_STATUS_SUCCESS
00693 #define CSMI_SAS_PHY_INFO_NOT_CHANGEABLE     2000
00694 #define CSMI_SAS_LINK_RATE_OUT_OF_RANGE      2001
00695 
00696 #define CSMI_SAS_PHY_DOES_NOT_EXIST          2002
00697 #define CSMI_SAS_PHY_DOES_NOT_MATCH_PORT     2003
00698 #define CSMI_SAS_PHY_CANNOT_BE_SELECTED      2004
00699 #define CSMI_SAS_SELECT_PHY_OR_PORT          2005
00700 #define CSMI_SAS_PORT_DOES_NOT_EXIST         2006
00701 #define CSMI_SAS_PORT_CANNOT_BE_SELECTED     2007
00702 #define CSMI_SAS_CONNECTION_FAILED           2008
00703 
00704 #define CSMI_SAS_NO_SATA_DEVICE              2009
00705 #define CSMI_SAS_NO_SATA_SIGNATURE           2010
00706 #define CSMI_SAS_SCSI_EMULATION              2011
00707 #define CSMI_SAS_NOT_AN_END_DEVICE           2012
00708 #define CSMI_SAS_NO_SCSI_ADDRESS             2013
00709 #define CSMI_SAS_NO_DEVICE_ADDRESS           2014
00710 
00711 // Signature value
00712 // (IoctlHeader.Signature)
00713 
00714 #define CSMI_SAS_SIGNATURE    "CSMISAS"
00715 
00716 // Timeout value default of 60 seconds
00717 // (IoctlHeader.Timeout)
00718 
00719 #define CSMI_SAS_TIMEOUT      60
00720 
00721 // Device types
00722 // (bDeviceType)
00723 
00724 #define CSMI_SAS_PHY_UNUSED               0x00
00725 #define CSMI_SAS_NO_DEVICE_ATTACHED       0x00
00726 #define CSMI_SAS_END_DEVICE               0x10
00727 #define CSMI_SAS_EDGE_EXPANDER_DEVICE     0x20
00728 #define CSMI_SAS_FANOUT_EXPANDER_DEVICE   0x30
00729 
00730 // Protocol options
00731 // (bInitiatorPortProtocol, bTargetPortProtocol)
00732 
00733 #define CSMI_SAS_PROTOCOL_SATA   0x01
00734 #define CSMI_SAS_PROTOCOL_SMP    0x02
00735 #define CSMI_SAS_PROTOCOL_STP    0x04
00736 #define CSMI_SAS_PROTOCOL_SSP    0x08
00737 
00738 // Negotiated and hardware link rates
00739 // (bNegotiatedLinkRate, bMinimumLinkRate, bMaximumLinkRate)
00740 
00741 #define CSMI_SAS_LINK_RATE_UNKNOWN  0x00
00742 #define CSMI_SAS_PHY_DISABLED       0x01
00743 #define CSMI_SAS_LINK_RATE_FAILED   0x02
00744 #define CSMI_SAS_SATA_SPINUP_HOLD   0x03
00745 #define CSMI_SAS_SATA_PORT_SELECTOR 0x04
00746 #define CSMI_SAS_LINK_RATE_1_5_GBPS 0x08
00747 #define CSMI_SAS_LINK_RATE_3_0_GBPS 0x09
00748 #define CSMI_SAS_LINK_VIRTUAL       0x10
00749 
00750 // Discover state
00751 // (bAutoDiscover)
00752 
00753 #define CSMI_SAS_DISCOVER_NOT_SUPPORTED   0x00
00754 #define CSMI_SAS_DISCOVER_NOT_STARTED     0x01
00755 #define CSMI_SAS_DISCOVER_IN_PROGRESS     0x02
00756 #define CSMI_SAS_DISCOVER_COMPLETE        0x03
00757 #define CSMI_SAS_DISCOVER_ERROR           0x04
00758 
00759 // Phy features
00760 
00761 #define CSMI_SAS_PHY_VIRTUAL_SMP          0x01
00762 
00763 // Programmed link rates
00764 // (bMinimumLinkRate, bMaximumLinkRate)
00765 // (bProgrammedMinimumLinkRate, bProgrammedMaximumLinkRate)
00766 
00767 #define CSMI_SAS_PROGRAMMED_LINK_RATE_UNCHANGED 0x00
00768 #define CSMI_SAS_PROGRAMMED_LINK_RATE_1_5_GBPS  0x08
00769 #define CSMI_SAS_PROGRAMMED_LINK_RATE_3_0_GBPS  0x09
00770 
00771 // Link rate
00772 // (bNegotiatedLinkRate in CSMI_SAS_SET_PHY_INFO)
00773 
00774 #define CSMI_SAS_LINK_RATE_NEGOTIATE      0x00
00775 #define CSMI_SAS_LINK_RATE_PHY_DISABLED   0x01
00776 
00777 // Signal class
00778 // (bSignalClass in CSMI_SAS_SET_PHY_INFO)
00779 
00780 #define CSMI_SAS_SIGNAL_CLASS_UNKNOWN     0x00
00781 #define CSMI_SAS_SIGNAL_CLASS_DIRECT      0x01
00782 #define CSMI_SAS_SIGNAL_CLASS_SERVER      0x02
00783 #define CSMI_SAS_SIGNAL_CLASS_ENCLOSURE   0x03
00784 
00785 // Link error reset
00786 // (bResetCounts)
00787 
00788 #define CSMI_SAS_LINK_ERROR_DONT_RESET_COUNTS   0x00
00789 #define CSMI_SAS_LINK_ERROR_RESET_COUNTS        0x01
00790 
00791 // Phy identifier
00792 // (bPhyIdentifier)
00793 
00794 #define CSMI_SAS_USE_PORT_IDENTIFIER   0xFF
00795 
00796 // Port identifier
00797 // (bPortIdentifier)
00798 
00799 #define CSMI_SAS_IGNORE_PORT           0xFF
00800 
00801 // Programmed link rates
00802 // (bConnectionRate)
00803 
00804 #define CSMI_SAS_LINK_RATE_NEGOTIATED  0x00
00805 #define CSMI_SAS_LINK_RATE_1_5_GBPS    0x08
00806 #define CSMI_SAS_LINK_RATE_3_0_GBPS    0x09
00807 
00808 // Connection status
00809 // (bConnectionStatus)
00810 
00811 #define CSMI_SAS_OPEN_ACCEPT                          0
00812 #define CSMI_SAS_OPEN_REJECT_BAD_DESTINATION          1
00813 #define CSMI_SAS_OPEN_REJECT_RATE_NOT_SUPPORTED       2
00814 #define CSMI_SAS_OPEN_REJECT_NO_DESTINATION           3
00815 #define CSMI_SAS_OPEN_REJECT_PATHWAY_BLOCKED          4
00816 #define CSMI_SAS_OPEN_REJECT_PROTOCOL_NOT_SUPPORTED   5
00817 #define CSMI_SAS_OPEN_REJECT_RESERVE_ABANDON          6
00818 #define CSMI_SAS_OPEN_REJECT_RESERVE_CONTINUE         7
00819 #define CSMI_SAS_OPEN_REJECT_RESERVE_INITIALIZE       8
00820 #define CSMI_SAS_OPEN_REJECT_RESERVE_STOP             9
00821 #define CSMI_SAS_OPEN_REJECT_RETRY                    10
00822 #define CSMI_SAS_OPEN_REJECT_STP_RESOURCES_BUSY       11
00823 #define CSMI_SAS_OPEN_REJECT_WRONG_DESTINATION        12
00824 
00825 // SSP Status
00826 // (bSSPStatus)
00827 
00828 #define CSMI_SAS_SSP_STATUS_UNKNOWN     0x00
00829 #define CSMI_SAS_SSP_STATUS_WAITING     0x01
00830 #define CSMI_SAS_SSP_STATUS_COMPLETED   0x02
00831 #define CSMI_SAS_SSP_STATUS_FATAL_ERROR 0x03
00832 #define CSMI_SAS_SSP_STATUS_RETRY       0x04
00833 #define CSMI_SAS_SSP_STATUS_NO_TAG      0x05
00834 
00835 // SSP Flags
00836 // (uFlags)
00837 
00838 #define CSMI_SAS_SSP_READ           0x00000001
00839 #define CSMI_SAS_SSP_WRITE          0x00000002
00840 #define CSMI_SAS_SSP_UNSPECIFIED    0x00000004
00841 
00842 #define CSMI_SAS_SSP_TASK_ATTRIBUTE_SIMPLE         0x00000000
00843 #define CSMI_SAS_SSP_TASK_ATTRIBUTE_HEAD_OF_QUEUE  0x00000010
00844 #define CSMI_SAS_SSP_TASK_ATTRIBUTE_ORDERED        0x00000020
00845 #define CSMI_SAS_SSP_TASK_ATTRIBUTE_ACA            0x00000040
00846 
00847 // SSP Data present
00848 // (bDataPresent)
00849 
00850 #define CSMI_SAS_SSP_NO_DATA_PRESENT         0x00
00851 #define CSMI_SAS_SSP_RESPONSE_DATA_PRESENT   0x01
00852 #define CSMI_SAS_SSP_SENSE_DATA_PRESENT      0x02
00853 
00854 // STP Flags
00855 // (uFlags)
00856 
00857 #define CSMI_SAS_STP_READ           0x00000001
00858 #define CSMI_SAS_STP_WRITE          0x00000002
00859 #define CSMI_SAS_STP_UNSPECIFIED    0x00000004
00860 #define CSMI_SAS_STP_PIO            0x00000010
00861 #define CSMI_SAS_STP_DMA            0x00000020
00862 #define CSMI_SAS_STP_PACKET         0x00000040
00863 #define CSMI_SAS_STP_DMA_QUEUED     0x00000080
00864 #define CSMI_SAS_STP_EXECUTE_DIAG   0x00000100
00865 #define CSMI_SAS_STP_RESET_DEVICE   0x00000200
00866 
00867 // Task Management Flags
00868 // (uFlags)
00869 
00870 #define CSMI_SAS_TASK_IU               0x00000001
00871 #define CSMI_SAS_HARD_RESET_SEQUENCE   0x00000002
00872 #define CSMI_SAS_SUPPRESS_RESULT       0x00000004
00873 
00874 // Task Management Functions
00875 // (bTaskManagement)
00876 
00877 #define CSMI_SAS_SSP_ABORT_TASK           0x01
00878 #define CSMI_SAS_SSP_ABORT_TASK_SET       0x02
00879 #define CSMI_SAS_SSP_CLEAR_TASK_SET       0x04
00880 #define CSMI_SAS_SSP_LOGICAL_UNIT_RESET   0x08
00881 #define CSMI_SAS_SSP_CLEAR_ACA            0x40
00882 #define CSMI_SAS_SSP_QUERY_TASK           0x80
00883 
00884 // Task Management Information
00885 // (uInformation)
00886 
00887 #define CSMI_SAS_SSP_TEST           1
00888 #define CSMI_SAS_SSP_EXCEEDED       2
00889 #define CSMI_SAS_SSP_DEMAND         3
00890 #define CSMI_SAS_SSP_TRIGGER        4
00891 
00892 // Connector Pinout Information
00893 // (uPinout)
00894 
00895 #define CSMI_SAS_CON_UNKNOWN              0x00000001
00896 #define CSMI_SAS_CON_SFF_8482             0x00000002
00897 #define CSMI_SAS_CON_SFF_8470_LANE_1      0x00000100
00898 #define CSMI_SAS_CON_SFF_8470_LANE_2      0x00000200
00899 #define CSMI_SAS_CON_SFF_8470_LANE_3      0x00000400
00900 #define CSMI_SAS_CON_SFF_8470_LANE_4      0x00000800
00901 #define CSMI_SAS_CON_SFF_8484_LANE_1      0x00010000
00902 #define CSMI_SAS_CON_SFF_8484_LANE_2      0x00020000
00903 #define CSMI_SAS_CON_SFF_8484_LANE_3      0x00040000
00904 #define CSMI_SAS_CON_SFF_8484_LANE_4      0x00080000
00905 
00906 // Connector Location Information
00907 // (bLocation)
00908 
00909 // same as uPinout above...
00910 // #define CSMI_SAS_CON_UNKNOWN              0x01
00911 #define CSMI_SAS_CON_INTERNAL             0x02
00912 #define CSMI_SAS_CON_EXTERNAL             0x04
00913 #define CSMI_SAS_CON_SWITCHABLE           0x08
00914 #define CSMI_SAS_CON_AUTO                 0x10
00915 #define CSMI_SAS_CON_NOT_PRESENT          0x20
00916 #define CSMI_SAS_CON_NOT_CONNECTED        0x80
00917 
00918 // Device location identification
00919 // (bIdentify)
00920 
00921 #define CSMI_SAS_LOCATE_UNKNOWN           0x00
00922 #define CSMI_SAS_LOCATE_FORCE_OFF         0x01
00923 #define CSMI_SAS_LOCATE_FORCE_ON          0x02
00924 
00925 // Location Valid flags
00926 // (uLocationFlags)
00927 
00928 #define CSMI_SAS_LOCATE_SAS_ADDRESS_VALID           0x00000001
00929 #define CSMI_SAS_LOCATE_SAS_LUN_VALID               0x00000002
00930 #define CSMI_SAS_LOCATE_ENCLOSURE_IDENTIFIER_VALID  0x00000004
00931 #define CSMI_SAS_LOCATE_ENCLOSURE_NAME_VALID        0x00000008
00932 #define CSMI_SAS_LOCATE_BAY_PREFIX_VALID            0x00000010
00933 #define CSMI_SAS_LOCATE_BAY_IDENTIFIER_VALID        0x00000020
00934 #define CSMI_SAS_LOCATE_LOCATION_STATE_VALID        0x00000040
00935 
00936 /* * * * * * * * SAS Phy Control Class IOCTL Constants * * * * * * * * */
00937 
00938 // Return codes for SAS Phy Control IOCTL's
00939 // (IoctlHeader.ReturnCode)
00940 
00941 // Signature value
00942 // (IoctlHeader.Signature)
00943 
00944 #define CSMI_PHY_SIGNATURE    "CSMIPHY"
00945 
00946 // Phy Control Functions
00947 // (bFunction)
00948 
00949 // values 0x00 to 0xFF are consistent in definition with the SMP PHY CONTROL
00950 // function defined in the SAS spec
00951 #define CSMI_SAS_PC_NOP                   0x00000000
00952 #define CSMI_SAS_PC_LINK_RESET            0x00000001
00953 #define CSMI_SAS_PC_HARD_RESET            0x00000002
00954 #define CSMI_SAS_PC_PHY_DISABLE           0x00000003
00955 // 0x04 to 0xFF reserved...
00956 #define CSMI_SAS_PC_GET_PHY_SETTINGS      0x00000100
00957 
00958 // Link Flags
00959 #define CSMI_SAS_PHY_ACTIVATE_CONTROL     0x00000001
00960 #define CSMI_SAS_PHY_UPDATE_SPINUP_RATE   0x00000002
00961 #define CSMI_SAS_PHY_AUTO_COMWAKE         0x00000004
00962 
00963 // Device Types for Phy Settings
00964 // (bType)
00965 #define CSMI_SAS_UNDEFINED 0x00
00966 #define CSMI_SAS_SATA      0x01
00967 #define CSMI_SAS_SAS       0x02
00968 
00969 // Transmitter Flags
00970 // (uTransmitterFlags)
00971 #define CSMI_SAS_PHY_PREEMPHASIS_DISABLED    0x00000001
00972 
00973 // Receiver Flags
00974 // (uReceiverFlags)
00975 #define CSMI_SAS_PHY_EQUALIZATION_DISABLED   0x00000001
00976 
00977 // Pattern Flags
00978 // (uPatternFlags)
00979 // #define CSMI_SAS_PHY_ACTIVATE_CONTROL     0x00000001
00980 #define CSMI_SAS_PHY_DISABLE_SCRAMBLING      0x00000002
00981 #define CSMI_SAS_PHY_DISABLE_ALIGN           0x00000004
00982 #define CSMI_SAS_PHY_DISABLE_SSC             0x00000008
00983 
00984 #define CSMI_SAS_PHY_FIXED_PATTERN           0x00000010
00985 #define CSMI_SAS_PHY_USER_PATTERN            0x00000020
00986 
00987 // Fixed Patterns
00988 // (bFixedPattern)
00989 #define CSMI_SAS_PHY_CJPAT                   0x00000001
00990 #define CSMI_SAS_PHY_ALIGN                   0x00000002
00991 
00992 // Type Flags
00993 // (bTypeFlags)
00994 #define CSMI_SAS_PHY_POSITIVE_DISPARITY      0x01
00995 #define CSMI_SAS_PHY_NEGATIVE_DISPARITY      0x02
00996 #define CSMI_SAS_PHY_CONTROL_CHARACTER       0x04
00997 
00998 // Miscellaneous
00999 #define SLOT_NUMBER_UNKNOWN   0xFFFF
01000 
01001 /*************************************************************************/
01002 /* DATA STRUCTURES                                                       */
01003 /*************************************************************************/
01004 
01005 /* * * * * * * * * * Class Independent Structures * * * * * * * * * */
01006 
01007 // EDM #pragma CSMI_SAS_BEGIN_PACK(8)
01008 #pragma pack(8)
01009 
01010 // CC_CSMI_SAS_DRIVER_INFO
01011 
01012 typedef struct _CSMI_SAS_DRIVER_INFO {
01013    __u8  szName[81];
01014    __u8  szDescription[81];
01015    __u16 usMajorRevision;
01016    __u16 usMinorRevision;
01017    __u16 usBuildRevision;
01018    __u16 usReleaseRevision;
01019    __u16 usCSMIMajorRevision;
01020    __u16 usCSMIMinorRevision;
01021 } CSMI_SAS_DRIVER_INFO,
01022   *PCSMI_SAS_DRIVER_INFO;
01023 
01024 typedef struct _CSMI_SAS_DRIVER_INFO_BUFFER {
01025    IOCTL_HEADER IoctlHeader;
01026    CSMI_SAS_DRIVER_INFO Information;
01027 } CSMI_SAS_DRIVER_INFO_BUFFER,
01028   *PCSMI_SAS_DRIVER_INFO_BUFFER;
01029 
01030 // CC_CSMI_SAS_CNTLR_CONFIGURATION
01031 
01032 typedef struct _CSMI_SAS_PCI_BUS_ADDRESS {
01033    __u8  bBusNumber;
01034    __u8  bDeviceNumber;
01035    __u8  bFunctionNumber;
01036    __u8  bReserved;
01037 } CSMI_SAS_PCI_BUS_ADDRESS,
01038   *PCSMI_SAS_PCI_BUS_ADDRESS;
01039 
01040 typedef union _CSMI_SAS_IO_BUS_ADDRESS {
01041    CSMI_SAS_PCI_BUS_ADDRESS PciAddress;
01042    __u8  bReserved[32];
01043 } CSMI_SAS_IO_BUS_ADDRESS,
01044   *PCSMI_SAS_IO_BUS_ADDRESS;
01045 
01046 typedef struct _CSMI_SAS_CNTLR_CONFIG {
01047    __u32 uBaseIoAddress;
01048    struct {
01049       __u32 uLowPart;
01050       __u32 uHighPart;
01051    } BaseMemoryAddress;
01052    __u32 uBoardID;
01053    __u16 usSlotNumber;
01054    __u8  bControllerClass;
01055    __u8  bIoBusType;
01056    CSMI_SAS_IO_BUS_ADDRESS BusAddress;
01057    __u8  szSerialNumber[81];
01058    __u16 usMajorRevision;
01059    __u16 usMinorRevision;
01060    __u16 usBuildRevision;
01061    __u16 usReleaseRevision;
01062    __u16 usBIOSMajorRevision;
01063    __u16 usBIOSMinorRevision;
01064    __u16 usBIOSBuildRevision;
01065    __u16 usBIOSReleaseRevision;
01066    __u32 uControllerFlags;
01067    __u16 usRromMajorRevision;
01068    __u16 usRromMinorRevision;
01069    __u16 usRromBuildRevision;
01070    __u16 usRromReleaseRevision;
01071    __u16 usRromBIOSMajorRevision;
01072    __u16 usRromBIOSMinorRevision;
01073    __u16 usRromBIOSBuildRevision;
01074    __u16 usRromBIOSReleaseRevision;
01075    __u8  bReserved[7];
01076 } CSMI_SAS_CNTLR_CONFIG,
01077   *PCSMI_SAS_CNTLR_CONFIG;
01078 
01079 typedef struct _CSMI_SAS_CNTLR_CONFIG_BUFFER {
01080    IOCTL_HEADER IoctlHeader;
01081    CSMI_SAS_CNTLR_CONFIG Configuration;
01082 } CSMI_SAS_CNTLR_CONFIG_BUFFER,
01083   *PCSMI_SAS_CNTLR_CONFIG_BUFFER;
01084 
01085 // CC_CSMI_SAS_CNTLR_STATUS
01086 
01087 typedef struct _CSMI_SAS_CNTLR_STATUS {
01088    __u32 uStatus;
01089    __u32 uOfflineReason;
01090    __u8  bReserved[28];
01091 } CSMI_SAS_CNTLR_STATUS,
01092   *PCSMI_SAS_CNTLR_STATUS;
01093 
01094 typedef struct _CSMI_SAS_CNTLR_STATUS_BUFFER {
01095    IOCTL_HEADER IoctlHeader;
01096    CSMI_SAS_CNTLR_STATUS Status;
01097 } CSMI_SAS_CNTLR_STATUS_BUFFER,
01098   *PCSMI_SAS_CNTLR_STATUS_BUFFER;
01099 
01100 // CC_CSMI_SAS_FIRMWARE_DOWNLOAD
01101 
01102 typedef struct _CSMI_SAS_FIRMWARE_DOWNLOAD {
01103    __u32 uBufferLength;
01104    __u32 uDownloadFlags;
01105    __u8  bReserved[32];
01106    __u16 usStatus;
01107    __u16 usSeverity;
01108 } CSMI_SAS_FIRMWARE_DOWNLOAD,
01109   *PCSMI_SAS_FIRMWARE_DOWNLOAD;
01110 
01111 typedef struct _CSMI_SAS_FIRMWARE_DOWNLOAD_BUFFER {
01112    IOCTL_HEADER IoctlHeader;
01113    CSMI_SAS_FIRMWARE_DOWNLOAD Information;
01114    __u8  bDataBuffer[1];
01115 } CSMI_SAS_FIRMWARE_DOWNLOAD_BUFFER,
01116   *PCSMI_SAS_FIRMWARE_DOWNLOAD_BUFFER;
01117 
01118 // CC_CSMI_SAS_RAID_INFO
01119 
01120 typedef struct _CSMI_SAS_RAID_INFO {
01121    __u32 uNumRaidSets;
01122    __u32 uMaxDrivesPerSet;
01123    __u32 uMaxRaidSets;
01124    __u8  bMaxRaidTypes;
01125    __u8  bReservedByteFields[7];
01126    struct
01127    {
01128       __u32 uLowPart;
01129       __u32 uHighPart;
01130    } ulMinRaidSetBlocks;
01131    struct
01132    {
01133       __u32 uLowPart;
01134       __u32 uHighPart;
01135    } ulMaxRaidSetBlocks;
01136    __u32 uMaxPhysicalDrives;
01137    __u32 uMaxExtents;
01138    __u32 uMaxModules;
01139    __u32 uMaxTransformationMemory;
01140    __u32 uChangeCount;
01141    __u8  bReserved[44];
01142 } CSMI_SAS_RAID_INFO,
01143   *PCSMI_SAS_RAID_INFO;
01144 
01145 typedef struct _CSMI_SAS_RAID_INFO_BUFFER {
01146    IOCTL_HEADER IoctlHeader;
01147    CSMI_SAS_RAID_INFO Information;
01148 } CSMI_SAS_RAID_INFO_BUFFER,
01149   *PCSMI_SAS_RAID_INFO_BUFFER;
01150 
01151 // CC_CSMI_SAS_GET_RAID_CONFIG
01152 
01153 typedef struct _CSMI_SAS_RAID_DRIVES {
01154    __u8  bModel[40];
01155    __u8  bFirmware[8];
01156    __u8  bSerialNumber[40];
01157    __u8  bSASAddress[8];
01158    __u8  bSASLun[8];
01159    __u8  bDriveStatus;
01160    __u8  bDriveUsage;
01161    __u16 usBlockSize;
01162    __u8  bDriveType;
01163    __u8  bReserved[15];
01164    __u32 uDriveIndex;
01165    struct
01166    {
01167       __u32 uLowPart;
01168       __u32 uHighPart;
01169    } ulTotalUserBlocks;
01170 } CSMI_SAS_RAID_DRIVES,
01171   *PCSMI_SAS_RAID_DRIVES;
01172 
01173 typedef struct _CSMI_SAS_RAID_DEVICE_ID {
01174    __u8  bDeviceIdentificationVPDPage[1];
01175 } CSMI_SAS_RAID_DEVICE_ID,
01176   *PCSMI_SAS_RAID_DEVICE_ID;
01177 
01178 typedef struct _CSMI_SAS_RAID_SET_ADDITIONAL_DATA {
01179    __u8  bLabel[16];
01180    __u8  bRaidSetLun[8];
01181    __u8  bWriteProtection;
01182    __u8  bCacheSetting;
01183    __u8  bCacheRatio;
01184    __u16 usBlockSize;
01185    __u8  bReservedBytes[11];
01186    struct
01187    {
01188       __u32 uLowPart;
01189       __u32 uHighPart;
01190    } ulRaidSetExtentOffset;
01191    struct
01192    {
01193       __u32 uLowPart;
01194       __u32 uHighPart;
01195    } ulRaidSetBlocks;
01196    __u32 uStripeSizeInBlocks;
01197    __u32 uSectorsPerTrack;
01198    __u8  bApplicationScratchPad[16];
01199    __u32 uNumberOfHeads;
01200    __u32 uNumberOfTracks;
01201    __u8  bReserved[24];
01202 } CSMI_SAS_RAID_SET_ADDITIONAL_DATA,
01203   *PCSMI_SAS_RAID_SET_ADDITIONAL_DATA;
01204 
01205 typedef struct _CSMI_SAS_RAID_CONFIG {
01206    __u32 uRaidSetIndex;
01207    __u32 uCapacity;
01208    __u32 uStripeSize;
01209    __u8  bRaidType;
01210    __u8  bStatus;
01211    __u8  bInformation;
01212    __u8  bDriveCount;
01213    __u8  bDataType;
01214    __u8  bReserved[11];
01215    __u32 uFailureCode;
01216    __u32 uChangeCount;
01217    union {
01218       CSMI_SAS_RAID_DRIVES Drives[1];
01219       CSMI_SAS_RAID_DEVICE_ID DeviceId[1];
01220       CSMI_SAS_RAID_SET_ADDITIONAL_DATA Data[1];
01221    };
01222 } CSMI_SAS_RAID_CONFIG,
01223    *PCSMI_SAS_RAID_CONFIG;
01224 
01225 typedef struct _CSMI_SAS_RAID_CONFIG_BUFFER {
01226    IOCTL_HEADER IoctlHeader;
01227    CSMI_SAS_RAID_CONFIG Configuration;
01228 } CSMI_SAS_RAID_CONFIG_BUFFER,
01229   *PCSMI_SAS_RAID_CONFIG_BUFFER;
01230 
01231 // CC_CSMI_SAS_GET_RAID_FEATURES
01232 
01233 typedef struct _CSMI_SAS_RAID_TYPE_DESCRIPTION {
01234   __u8  bRaidType;
01235   __u8  bReservedBytes[7];
01236   __u32 uSupportedStripeSizeMap;
01237   __u8  bReserved[24];
01238 } CSMI_SAS_RAID_TYPE_DESCRIPTION,
01239   *PCSMI_SAS_RAID_TYPE_DESCRIPTION;
01240 
01241 typedef struct _CSMI_SAS_RAID_FEATURES {
01242    __u32 uFeatures;
01243    __u8  bReservedFeatures[32];
01244    __u8  bDefaultTransformPriority;
01245    __u8  bTransformPriority;
01246    __u8  bDefaultRebuildPriority;
01247    __u8  bRebuildPriority;
01248    __u8  bDefaultSurfaceScanPriority;
01249    __u8  bSurfaceScanPriority;
01250    __u16 usReserved;
01251    __u32 uRaidSetTransformationRules;
01252    __u32 uReserved[11];
01253    CSMI_SAS_RAID_TYPE_DESCRIPTION RaidType[24];
01254    __u8  bCacheRatiosSupported[104];
01255    __u32 uChangeCount;
01256    __u32 uFailureCode;
01257    __u8  bReserved[120];
01258 } CSMI_SAS_RAID_FEATURES,
01259   *PCSMI_SAS_RAID_FEATURES;
01260 
01261 typedef struct _CSMI_SAS_RAID_FEATURES_BUFFER {
01262    IOCTL_HEADER IoctlHeader;
01263    CSMI_SAS_RAID_FEATURES Information;
01264 } CSMI_SAS_RAID_FEATURES_BUFFER,
01265   *PCSMI_SAS_RAID_FEATURES_BUFFER;
01266 
01267 // CC_CSMI_SAS_SET_RAID_CONTROL
01268 
01269 typedef struct _CSMI_SAS_RAID_CONTROL {
01270    __u8  bTransformPriority;
01271    __u8  bRebuildPriority;
01272    __u8  bCacheRatioFlag;
01273    __u8  bCacheRatio;
01274    __u8  bSurfaceScanPriority;
01275    __u8  bReservedBytes[15];
01276    __u8  bClearConfiguration[8];
01277    __u32 uChangeCount;
01278    __u8  bReserved[88];
01279    __u32 uFailureCode;
01280    __u8  bFailureDescription[80];
01281 } CSMI_SAS_RAID_CONTROL,
01282   *PCSMI_SAS_RAID_CONTROL;
01283 
01284 typedef struct _CSMI_SAS_RAID_CONTROL_BUFFER {
01285    IOCTL_HEADER IoctlHeader;
01286    CSMI_SAS_RAID_CONTROL Information;
01287 } CSMI_SAS_RAID_CONTROL_BUFFER,
01288   *PCSMI_SAS_RAID_CONTROL_BUFFER;
01289 
01290 // CC_CSMI_SAS_GET_RAID_ELEMENT
01291 
01292 typedef struct _CSMI_SAS_DRIVE_EXTENT_INFO {
01293    __u32 uDriveIndex;
01294    __u8  bExtentType;
01295    __u8  bReservedBytes[7];
01296    struct
01297    {
01298       __u32 uLowPart;
01299       __u32 uHighPart;
01300    } ulExtentOffset;
01301    struct
01302    {
01303       __u32 uLowPart;
01304       __u32 uHighPart;
01305    } ulExtentBlocks;
01306    __u32 uRaidSetIndex;
01307    __u8  bReserved[96];
01308 } CSMI_SAS_DRIVE_EXTENT_INFO,
01309   *PCSMI_SAS_DRIVE_EXTENT_INFO;
01310 
01311 typedef struct _CSMI_SAS_RAID_MODULE_INFO {
01312    __u8  bReserved[128];
01313 } CSMI_SAS_RAID_MODULE_INFO,
01314   *PCSMI_SAS_RAID_MODULE_INFO;
01315 
01316 typedef struct _CSMI_SAS_DRIVE_LOCATION {
01317    __u8  bConnector[16];
01318    __u8  bBoxName[16];
01319    __u32 uBay;
01320    __u8  bReservedBytes[4];
01321    __u8  bAttachedSASAddress[8];
01322    __u8  bAttachedPhyIdentifier;
01323    __u8  bReserved[79];
01324 } CSMI_SAS_DRIVE_LOCATION,
01325   *PCSMI_SAS_DRIVE_LOCATION;
01326 
01327 typedef struct _CSMI_SAS_RAID_DRIVES_ADDITIONAL_DATA {
01328    __u8  bNegotiatedLinkRate[2];
01329    __u8  bReserved[126];
01330 } CSMI_SAS_RAID_DRIVES_ADDITIONAL_DATA,
01331   *PCSMI_SAS_RAID_DRIVES_ADDITIONAL_DATA;
01332 
01333 typedef struct _CSMI_SAS_DRIVE_INFO {
01334    CSMI_SAS_RAID_DRIVES Device;
01335    CSMI_SAS_RAID_DRIVES_ADDITIONAL_DATA Data;
01336    CSMI_SAS_DRIVE_LOCATION Location;
01337    __u8  bReserved[16];
01338 } CSMI_SAS_DRIVE_INFO,
01339   *PCSMI_SAS_DRIVE_INFO;
01340 
01341 typedef struct _CSMI_SAS_RAID_ELEMENT {
01342    __u32 uEnumerationType;
01343    __u32 uElementIndex;
01344    __u32 uNumElements;
01345    __u32 uChangeCount;
01346    __u32 uSubElementIndex;
01347    __u8  bReserved[32];
01348    __u32 uFailureCode;
01349    __u8  bFailureDescription[80];
01350    union {
01351        CSMI_SAS_DRIVE_INFO Drive;
01352        CSMI_SAS_RAID_MODULE_INFO Module;
01353        CSMI_SAS_DRIVE_EXTENT_INFO Extent;
01354    } Element;
01355 } CSMI_SAS_RAID_ELEMENT,
01356   *PCSMI_SAS_RAID_ELEMENT;
01357 
01358 typedef struct _CSMI_SAS_RAID_ELEMENT_BUFFER {
01359    IOCTL_HEADER IoctlHeader;
01360    CSMI_SAS_RAID_ELEMENT Information;
01361 } CSMI_SAS_RAID_ELEMENT_BUFFER,
01362   *PCSMI_SAS_RAID_ELEMENT_BUFFER;
01363 
01364 // CC_CSMI_SAS_SET_RAID_OPERATION
01365 
01366 typedef struct _CSMI_SAS_RAID_SET_LIST {
01367    __u32 uRaidSetIndex;
01368    __u8  bExistingLun[8];
01369    __u8  bNewLun[8];
01370    __u8  bReserved[12];
01371 } CSMI_SAS_RAID_SET_LIST,
01372   *PCSMI_SAS_RAID_SET_LIST;
01373 
01374 typedef struct _CSMI_SAS_RAID_SET_DRIVE_LIST {
01375    __u32 uDriveIndex;
01376    __u8  bDriveUsage;
01377    __u8  bReserved[27];
01378 } CSMI_SAS_RAID_SET_DRIVE_LIST,
01379   *PCSMI_SAS_RAID_SET_DRIVE_LIST;
01380 
01381 typedef struct _CSMI_SAS_RAID_SET_SPARE_INFO {
01382    __u32 uRaidSetIndex;
01383    __u32 uDriveCount;
01384    __u8  bApplicationScratchPad[16];
01385    __u8  bReserved[104];
01386 } CSMI_SAS_RAID_SET_SPARE_INFO,
01387   *PCSMI_SAS_RAID_SET_SPARE_INFO;
01388 
01389 typedef struct _CSMI_SAS_RAID_SET_ONLINE_STATE_INFO {
01390    __u32 uRaidSetIndex;
01391    __u8  bOnlineState;
01392    __u8  bReserved[123];
01393 } CSMI_SAS_RAID_SET_ONLINE_STATE_INFO,
01394   *PCSMI_SAS_RAID_SET_ONLINE_STATE_INFO;
01395 
01396 typedef struct _CSMI_SAS_RAID_SET_CACHE_INFO {
01397    __u32 uRaidSetIndex;
01398    __u8  bCacheSetting;
01399    __u8  bCacheRatioFlag;
01400    __u8  bCacheRatio;
01401    __u8  bReserved[121];
01402 } CSMI_SAS_RAID_SET_CACHE_INFO,
01403   *PCSMI_SAS_RAID_SET_CACHE_INFO;
01404 
01405 typedef struct _CSMI_SAS_RAID_SET_WRITE_PROTECT_INFO {
01406    __u32 uRaidSetIndex;
01407    __u8  bWriteProtectSetting;
01408    __u8  bReserved[123];
01409 } CSMI_SAS_RAID_SET_WRITE_PROTECT_INFO,
01410   *PCSMI_SAS_RAID_SET_WRITE_PROTECT_INFO;
01411 
01412 typedef struct _CSMI_SAS_RAID_SET_DELETE_INFO {
01413    __u32 uRaidSetIndex;
01414    __u8  bReserved[124];
01415 } CSMI_SAS_RAID_SET_DELETE_INFO,
01416   *PCSMI_SAS_RAID_SET_DELETE_INFO;
01417 
01418 typedef struct _CSMI_SAS_RAID_SET_MODIFY_INFO {
01419    __u8  bRaidType;
01420    __u8  bReservedBytes[7];
01421    __u32 uStripeSize;
01422    struct
01423    {
01424       __u32 uLowPart;
01425       __u32 uHighPart;
01426    } ulRaidSetBlocks;
01427    struct
01428    {
01429       __u32 uLowPart;
01430       __u32 uHighPart;
01431    } ulRaidSetExtentOffset;
01432    __u32 uDriveCount;
01433    __u8  bReserved[96];
01434 } CSMI_SAS_RAID_SET_MODIFY_INFO,
01435   *PCSMI_SAS_RAID_SET_MODIFY_INFO;
01436 
01437 typedef struct _CSMI_SAS_RAID_SET_TRANSFORM_INFO {
01438    __u8  bTransformType;
01439    __u8  bReservedBytes[3];
01440    __u32 uRaidSetIndex;
01441    __u8  bRaidType;
01442    __u8  bReservedBytes2[11];
01443    __u32 uAdditionalRaidSetIndex;
01444    __u32 uRaidSetCount;
01445    __u8  bApplicationScratchPad[16];
01446    CSMI_SAS_RAID_SET_MODIFY_INFO Modify;
01447    __u8  bReserved[80];
01448 } CSMI_SAS_RAID_SET_TRANSFORM_INFO,
01449   *PCSMI_SAS_RAID_SET_TRANSFORM_INFO;
01450 
01451 typedef struct _CSMI_SAS_RAID_SET_LABEL_INFO {
01452    __u32 uRaidSetIndex;
01453    __u8  bLabel[16];
01454    __u8  bReserved[108];
01455 } CSMI_SAS_RAID_SET_LABEL_INFO,
01456   *PCSMI_SAS_RAID_SET_LABEL_INFO;
01457 
01458 typedef struct _CSMI_SAS_RAID_SET_CREATE_INFO {
01459    __u8  bRaidType;
01460    __u8  bReservedBytes[7];
01461    __u32 uStripeSize;
01462    __u32 uTrackSectorCount;
01463    struct
01464    {
01465       __u32 uLowPart;
01466       __u32 uHighPart;
01467    } ulRaidSetBlocks;
01468    struct
01469    {
01470       __u32 uLowPart;
01471       __u32 uHighPart;
01472    } ulRaidSetExtentOffset;
01473    __u32 uDriveCount;
01474    __u8  bLabel[16];
01475    __u32 uRaidSetIndex;
01476    __u8  bApplicationScratchPad[16];
01477    __u32 uNumberOfHeads;
01478    __u32 uNumberOfTracks;
01479    __u8  bReserved[48];
01480 } CSMI_SAS_RAID_SET_CREATE_INFO,
01481   *PCSMI_SAS_RAID_SET_CREATE_INFO;
01482 
01483 typedef struct _CSMI_SAS_RAID_SET_OPERATION {
01484    __u32 uOperationType;
01485    __u32 uChangeCount;
01486    __u32 uFailureCode;
01487    __u8  bFailureDescription[80];
01488    __u8  bReserved[28];
01489    union {
01490        CSMI_SAS_RAID_SET_CREATE_INFO Create;
01491        CSMI_SAS_RAID_SET_LABEL_INFO Label;
01492        CSMI_SAS_RAID_SET_TRANSFORM_INFO Transform;
01493        CSMI_SAS_RAID_SET_DELETE_INFO Delete;
01494        CSMI_SAS_RAID_SET_WRITE_PROTECT_INFO Protect;
01495        CSMI_SAS_RAID_SET_CACHE_INFO Cache;
01496        CSMI_SAS_RAID_SET_ONLINE_STATE_INFO State;
01497        CSMI_SAS_RAID_SET_SPARE_INFO Spare;
01498    } Operation;
01499    union {
01500        CSMI_SAS_RAID_SET_DRIVE_LIST DriveList[1];
01501        CSMI_SAS_RAID_SET_LIST RaidSetList[1];
01502    } Parameters;
01503 } CSMI_SAS_RAID_SET_OPERATION,
01504   *PCSMI_SAS_RAID_SET_OPERATION;
01505 
01506 typedef struct _CSMI_SAS_RAID_SET_OPERATION_BUFFER {
01507    IOCTL_HEADER IoctlHeader;
01508    CSMI_SAS_RAID_SET_OPERATION Information;
01509 } CSMI_SAS_RAID_SET_OPERATION_BUFFER,
01510   *PCSMI_SAS_RAID_SET_OPERATION_BUFFER;
01511 
01512 /* * * * * * * * * * SAS HBA Class Structures * * * * * * * * * */
01513 
01514 // CC_CSMI_SAS_GET_PHY_INFO
01515 
01516 typedef struct _CSMI_SAS_IDENTIFY {
01517    __u8  bDeviceType;
01518    __u8  bRestricted;
01519    __u8  bInitiatorPortProtocol;
01520    __u8  bTargetPortProtocol;
01521    __u8  bRestricted2[8];
01522    __u8  bSASAddress[8];
01523    __u8  bPhyIdentifier;
01524    __u8  bSignalClass;
01525    __u8  bReserved[6];
01526 } CSMI_SAS_IDENTIFY,
01527   *PCSMI_SAS_IDENTIFY;
01528 
01529 typedef struct _CSMI_SAS_PHY_ENTITY {
01530    CSMI_SAS_IDENTIFY Identify;
01531    __u8  bPortIdentifier;
01532    __u8  bNegotiatedLinkRate;
01533    __u8  bMinimumLinkRate;
01534    __u8  bMaximumLinkRate;
01535    __u8  bPhyChangeCount;
01536    __u8  bAutoDiscover;
01537    __u8  bPhyFeatures;
01538    __u8  bReserved;
01539    CSMI_SAS_IDENTIFY Attached;
01540 } CSMI_SAS_PHY_ENTITY,
01541   *PCSMI_SAS_PHY_ENTITY;
01542 
01543 typedef struct _CSMI_SAS_PHY_INFO {
01544    __u8  bNumberOfPhys;
01545    __u8  bReserved[3];
01546    CSMI_SAS_PHY_ENTITY Phy[32];
01547 } CSMI_SAS_PHY_INFO,
01548   *PCSMI_SAS_PHY_INFO;
01549 
01550 typedef struct _CSMI_SAS_PHY_INFO_BUFFER {
01551    IOCTL_HEADER IoctlHeader;
01552    CSMI_SAS_PHY_INFO Information;
01553 } CSMI_SAS_PHY_INFO_BUFFER,
01554   *PCSMI_SAS_PHY_INFO_BUFFER;
01555 
01556 // CC_CSMI_SAS_SET_PHY_INFO
01557 
01558 typedef struct _CSMI_SAS_SET_PHY_INFO {
01559    __u8  bPhyIdentifier;
01560    __u8  bNegotiatedLinkRate;
01561    __u8  bProgrammedMinimumLinkRate;
01562    __u8  bProgrammedMaximumLinkRate;
01563    __u8  bSignalClass;
01564    __u8  bReserved[3];
01565 } CSMI_SAS_SET_PHY_INFO,
01566   *PCSMI_SAS_SET_PHY_INFO;
01567 
01568 typedef struct _CSMI_SAS_SET_PHY_INFO_BUFFER {
01569    IOCTL_HEADER IoctlHeader;
01570    CSMI_SAS_SET_PHY_INFO Information;
01571 } CSMI_SAS_SET_PHY_INFO_BUFFER,
01572   *PCSMI_SAS_SET_PHY_INFO_BUFFER;
01573 
01574 // CC_CSMI_SAS_GET_LINK_ERRORS
01575 
01576 typedef struct _CSMI_SAS_LINK_ERRORS {
01577    __u8  bPhyIdentifier;
01578    __u8  bResetCounts;
01579    __u8  bReserved[2];
01580    __u32 uInvalidDwordCount;
01581    __u32 uRunningDisparityErrorCount;
01582    __u32 uLossOfDwordSyncCount;
01583    __u32 uPhyResetProblemCount;
01584 } CSMI_SAS_LINK_ERRORS,
01585   *PCSMI_SAS_LINK_ERRORS;
01586 
01587 typedef struct _CSMI_SAS_LINK_ERRORS_BUFFER {
01588    IOCTL_HEADER IoctlHeader;
01589    CSMI_SAS_LINK_ERRORS Information;
01590 } CSMI_SAS_LINK_ERRORS_BUFFER,
01591   *PCSMI_SAS_LINK_ERRORS_BUFFER;
01592 
01593 // CC_CSMI_SAS_SMP_PASSTHRU
01594 
01595 typedef struct _CSMI_SAS_SMP_REQUEST {
01596    __u8  bFrameType;
01597    __u8  bFunction;
01598    __u8  bReserved[2];
01599    __u8  bAdditionalRequestBytes[1016];
01600 } CSMI_SAS_SMP_REQUEST,
01601   *PCSMI_SAS_SMP_REQUEST;
01602 
01603 typedef struct _CSMI_SAS_SMP_RESPONSE {
01604    __u8  bFrameType;
01605    __u8  bFunction;
01606    __u8  bFunctionResult;
01607    __u8  bReserved;
01608    __u8  bAdditionalResponseBytes[1016];
01609 } CSMI_SAS_SMP_RESPONSE,
01610   *PCSMI_SAS_SMP_RESPONSE;
01611 
01612 typedef struct _CSMI_SAS_SMP_PASSTHRU {
01613    __u8  bPhyIdentifier;
01614    __u8  bPortIdentifier;
01615    __u8  bConnectionRate;
01616    __u8  bReserved;
01617    __u8  bDestinationSASAddress[8];
01618    __u32 uRequestLength;
01619    CSMI_SAS_SMP_REQUEST Request;
01620    __u8  bConnectionStatus;
01621    __u8  bReserved2[3];
01622    __u32 uResponseBytes;
01623    CSMI_SAS_SMP_RESPONSE Response;
01624 } CSMI_SAS_SMP_PASSTHRU,
01625   *PCSMI_SAS_SMP_PASSTHRU;
01626 
01627 typedef struct _CSMI_SAS_SMP_PASSTHRU_BUFFER {
01628    IOCTL_HEADER IoctlHeader;
01629    CSMI_SAS_SMP_PASSTHRU Parameters;
01630 } CSMI_SAS_SMP_PASSTHRU_BUFFER,
01631   *PCSMI_SAS_SMP_PASSTHRU_BUFFER;
01632 
01633 // CC_CSMI_SAS_SSP_PASSTHRU
01634 
01635 typedef struct _CSMI_SAS_SSP_PASSTHRU {
01636    __u8  bPhyIdentifier;
01637    __u8  bPortIdentifier;
01638    __u8  bConnectionRate;
01639    __u8  bReserved;
01640    __u8  bDestinationSASAddress[8];
01641    __u8  bLun[8];
01642    __u8  bCDBLength;
01643    __u8  bAdditionalCDBLength;
01644    __u8  bReserved2[2];
01645    __u8  bCDB[16];
01646    __u32 uFlags;
01647    __u8  bAdditionalCDB[24];
01648    __u32 uDataLength;
01649 } CSMI_SAS_SSP_PASSTHRU,
01650   *PCSMI_SAS_SSP_PASSTHRU;
01651 
01652 typedef struct _CSMI_SAS_SSP_PASSTHRU_STATUS {
01653    __u8  bConnectionStatus;
01654    __u8  bSSPStatus;
01655    __u8  bReserved[2];
01656    __u8  bDataPresent;
01657    __u8  bStatus;
01658    __u8  bResponseLength[2];
01659    __u8  bResponse[256];
01660    __u32 uDataBytes;
01661 } CSMI_SAS_SSP_PASSTHRU_STATUS,
01662   *PCSMI_SAS_SSP_PASSTHRU_STATUS;
01663 
01664 typedef struct _CSMI_SAS_SSP_PASSTHRU_BUFFER {
01665    IOCTL_HEADER IoctlHeader;
01666    CSMI_SAS_SSP_PASSTHRU Parameters;
01667    CSMI_SAS_SSP_PASSTHRU_STATUS Status;
01668    __u8  bDataBuffer[1];
01669 } CSMI_SAS_SSP_PASSTHRU_BUFFER,
01670   *PCSMI_SAS_SSP_PASSTHRU_BUFFER;
01671 
01672 // CC_CSMI_SAS_STP_PASSTHRU
01673 
01674 typedef struct _CSMI_SAS_STP_PASSTHRU {
01675    __u8  bPhyIdentifier;
01676    __u8  bPortIdentifier;
01677    __u8  bConnectionRate;
01678    __u8  bReserved;
01679    __u8  bDestinationSASAddress[8];
01680    __u8  bReserved2[4];
01681    __u8  bCommandFIS[20];
01682    __u32 uFlags;
01683    __u32 uDataLength;
01684 } CSMI_SAS_STP_PASSTHRU,
01685   *PCSMI_SAS_STP_PASSTHRU;
01686 
01687 typedef struct _CSMI_SAS_STP_PASSTHRU_STATUS {
01688    __u8  bConnectionStatus;
01689    __u8  bReserved[3];
01690    __u8  bStatusFIS[20];
01691    __u32 uSCR[16];
01692    __u32 uDataBytes;
01693 } CSMI_SAS_STP_PASSTHRU_STATUS,
01694   *PCSMI_SAS_STP_PASSTHRU_STATUS;
01695 
01696 typedef struct _CSMI_SAS_STP_PASSTHRU_BUFFER {
01697    IOCTL_HEADER IoctlHeader;
01698    CSMI_SAS_STP_PASSTHRU Parameters;
01699    CSMI_SAS_STP_PASSTHRU_STATUS Status;
01700    __u8  bDataBuffer[1];
01701 } CSMI_SAS_STP_PASSTHRU_BUFFER,
01702   *PCSMI_SAS_STP_PASSTHRU_BUFFER;
01703 
01704 // CC_CSMI_SAS_GET_SATA_SIGNATURE
01705 
01706 typedef struct _CSMI_SAS_SATA_SIGNATURE {
01707    __u8  bPhyIdentifier;
01708    __u8  bReserved[3];
01709    __u8  bSignatureFIS[20];
01710 } CSMI_SAS_SATA_SIGNATURE,
01711   *PCSMI_SAS_SATA_SIGNATURE;
01712 
01713 typedef struct _CSMI_SAS_SATA_SIGNATURE_BUFFER {
01714    IOCTL_HEADER IoctlHeader;
01715    CSMI_SAS_SATA_SIGNATURE Signature;
01716 } CSMI_SAS_SATA_SIGNATURE_BUFFER,
01717   *PCSMI_SAS_SATA_SIGNATURE_BUFFER;
01718 
01719 // CC_CSMI_SAS_GET_SCSI_ADDRESS
01720 
01721 typedef struct _CSMI_SAS_GET_SCSI_ADDRESS_BUFFER {
01722    IOCTL_HEADER IoctlHeader;
01723    __u8  bSASAddress[8];
01724    __u8  bSASLun[8];
01725    __u8  bHostIndex;
01726    __u8  bPathId;
01727    __u8  bTargetId;
01728    __u8  bLun;
01729 } CSMI_SAS_GET_SCSI_ADDRESS_BUFFER,
01730    *PCSMI_SAS_GET_SCSI_ADDRESS_BUFFER;
01731 
01732 // CC_CSMI_SAS_GET_DEVICE_ADDRESS
01733 
01734 typedef struct _CSMI_SAS_GET_DEVICE_ADDRESS_BUFFER {
01735    IOCTL_HEADER IoctlHeader;
01736    __u8  bHostIndex;
01737    __u8  bPathId;
01738    __u8  bTargetId;
01739    __u8  bLun;
01740    __u8  bSASAddress[8];
01741    __u8  bSASLun[8];
01742 } CSMI_SAS_GET_DEVICE_ADDRESS_BUFFER,
01743   *PCSMI_SAS_GET_DEVICE_ADDRESS_BUFFER;
01744 
01745 // CC_CSMI_SAS_TASK_MANAGEMENT
01746 
01747 typedef struct _CSMI_SAS_SSP_TASK_IU {
01748    __u8  bHostIndex;
01749    __u8  bPathId;
01750    __u8  bTargetId;
01751    __u8  bLun;
01752    __u32 uFlags;
01753    __u32 uQueueTag;
01754    __u32 uReserved;
01755    __u8  bTaskManagementFunction;
01756    __u8  bReserved[7];
01757    __u32 uInformation;
01758 } CSMI_SAS_SSP_TASK_IU,
01759   *PCSMI_SAS_SSP_TASK_IU;
01760 
01761 typedef struct _CSMI_SAS_SSP_TASK_IU_BUFFER {
01762    IOCTL_HEADER IoctlHeader;
01763    CSMI_SAS_SSP_TASK_IU Parameters;
01764    CSMI_SAS_SSP_PASSTHRU_STATUS Status;
01765 } CSMI_SAS_SSP_TASK_IU_BUFFER,
01766   *PCSMI_SAS_SSP_TASK_IU_BUFFER;
01767 
01768 // CC_CSMI_SAS_GET_CONNECTOR_INFO
01769 
01770 typedef struct _CSMI_SAS_GET_CONNECTOR_INFO {
01771    __u32 uPinout;
01772    __u8  bConnector[16];
01773    __u8  bLocation;
01774    __u8  bReserved[15];
01775 } CSMI_SAS_CONNECTOR_INFO,
01776   *PCSMI_SAS_CONNECTOR_INFO;
01777 
01778 typedef struct _CSMI_SAS_CONNECTOR_INFO_BUFFER {
01779    IOCTL_HEADER IoctlHeader;
01780    CSMI_SAS_CONNECTOR_INFO Reference[32];
01781 } CSMI_SAS_CONNECTOR_INFO_BUFFER,
01782   *PCSMI_SAS_CONNECTOR_INFO_BUFFER;
01783 
01784 // CC_CSMI_SAS_GET_LOCATION
01785 
01786 typedef struct _CSMI_SAS_LOCATION_IDENTIFIER {
01787    __u32 bLocationFlags;
01788    __u8  bSASAddress[8];
01789    __u8  bSASLun[8];
01790    __u8  bEnclosureIdentifier[8];
01791    __u8  bEnclosureName[32];
01792    __u8  bBayPrefix[32];
01793    __u8  bBayIdentifier;
01794    __u8  bLocationState;
01795    __u8  bReserved[2];
01796 } CSMI_SAS_LOCATION_IDENTIFIER,
01797   *PCSMI_SAS_LOCATION_IDENTIFIER;
01798 
01799 typedef struct _CSMI_SAS_GET_LOCATION_BUFFER {
01800    IOCTL_HEADER IoctlHeader;
01801    __u8  bHostIndex;
01802    __u8  bPathId;
01803    __u8  bTargetId;
01804    __u8  bLun;
01805    __u8  bIdentify;
01806    __u8  bNumberOfLocationIdentifiers;
01807    __u8  bLengthOfLocationIdentifier;
01808    CSMI_SAS_LOCATION_IDENTIFIER Location[1];
01809 } CSMI_SAS_GET_LOCATION_BUFFER,
01810   *PCSMI_SAS_GET_LOCATION_BUFFER;
01811 
01812 // CC_CSMI_SAS_PHY_CONTROL
01813 
01814 typedef struct _CSMI_SAS_CHARACTER {
01815    __u8  bTypeFlags;
01816    __u8  bValue;
01817 } CSMI_SAS_CHARACTER,
01818   *PCSMI_SAS_CHARACTER;
01819 
01820 typedef struct _CSMI_SAS_PHY_CONTROL {
01821    __u8  bType;
01822    __u8  bRate;
01823    __u8  bReserved[6];
01824    __u32 uVendorUnique[8];
01825    __u32 uTransmitterFlags;
01826    __i8  bTransmitAmplitude;
01827    __i8  bTransmitterPreemphasis;
01828    __i8  bTransmitterSlewRate;
01829    __i8  bTransmitterReserved[13];
01830    __u8  bTransmitterVendorUnique[64];
01831    __u32 uReceiverFlags;
01832    __i8  bReceiverThreshold;
01833    __i8  bReceiverEqualizationGain;
01834    __i8  bReceiverReserved[14];
01835    __u8  bReceiverVendorUnique[64];
01836    __u32 uPatternFlags;
01837    __u8  bFixedPattern;
01838    __u8  bUserPatternLength;
01839    __u8  bPatternReserved[6];
01840    CSMI_SAS_CHARACTER UserPatternBuffer[16];
01841 } CSMI_SAS_PHY_CONTROL,
01842   *PCSMI_SAS_PHY_CONTROL;
01843 
01844 typedef struct _CSMI_SAS_PHY_CONTROL_BUFFER {
01845    IOCTL_HEADER IoctlHeader;
01846    __u32 uFunction;
01847    __u8  bPhyIdentifier;
01848    __u16 usLengthOfControl;
01849    __u8  bNumberOfControls;
01850    __u8  bReserved[4];
01851    __u32 uLinkFlags;
01852    __u8  bSpinupRate;
01853    __u8  bLinkReserved[7];
01854    __u32 uVendorUnique[8];
01855    CSMI_SAS_PHY_CONTROL Control[1];
01856 } CSMI_SAS_PHY_CONTROL_BUFFER,
01857   *PCSMI_SAS_PHY_CONTROL_BUFFER;
01858 
01859 //EDM #pragma CSMI_SAS_END_PACK
01860 #pragma pack()
01861 
01862 #endif // _CSMI_SAS_H_