1 /* 2 * Copyright (c) 2000-2005 LSI Logic Corporation. 3 * 4 * 5 * Name: mpi.h 6 * Title: MPI Message independent structures and definitions 7 * Creation Date: July 27, 2000 8 * 9 * mpi.h Version: 01.05.07 10 * 11 * Version History 12 * --------------- 13 * 14 * Date Version Description 15 * -------- -------- ------------------------------------------------------ 16 * 05-08-00 00.10.01 Original release for 0.10 spec dated 4/26/2000. 17 * 05-24-00 00.10.02 Added MPI_IOCSTATUS_SCSI_RESIDUAL_MISMATCH definition. 18 * 06-06-00 01.00.01 Update MPI_VERSION_MAJOR and MPI_VERSION_MINOR. 19 * 06-22-00 01.00.02 Added MPI_IOCSTATUS_LAN_ definitions. 20 * Removed LAN_SUSPEND function definition. 21 * Added MPI_MSGFLAGS_CONTINUATION_REPLY definition. 22 * 06-30-00 01.00.03 Added MPI_CONTEXT_REPLY_TYPE_LAN definition. 23 * Added MPI_GET/SET_CONTEXT_REPLY_TYPE macros. 24 * 07-27-00 01.00.04 Added MPI_FAULT_ definitions. 25 * Removed MPI_IOCSTATUS_MSG/DATA_XFER_ERROR definitions. 26 * Added MPI_IOCSTATUS_INTERNAL_ERROR definition. 27 * Added MPI_IOCSTATUS_TARGET_XFER_COUNT_MISMATCH. 28 * 11-02-00 01.01.01 Original release for post 1.0 work. 29 * 12-04-00 01.01.02 Added new function codes. 30 * 01-09-01 01.01.03 Added more definitions to the system interface section 31 * Added MPI_IOCSTATUS_TARGET_STS_DATA_NOT_SENT. 32 * 01-25-01 01.01.04 Changed MPI_VERSION_MINOR from 0x00 to 0x01. 33 * 02-20-01 01.01.05 Started using MPI_POINTER. 34 * Fixed value for MPI_DIAG_RW_ENABLE. 35 * Added defines for MPI_DIAG_PREVENT_IOC_BOOT and 36 * MPI_DIAG_CLEAR_FLASH_BAD_SIG. 37 * Obsoleted MPI_IOCSTATUS_TARGET_FC_ defines. 38 * 02-27-01 01.01.06 Removed MPI_HOST_INDEX_REGISTER define. 39 * Added function codes for RAID. 40 * 04-09-01 01.01.07 Added alternate define for MPI_DOORBELL_ACTIVE, 41 * MPI_DOORBELL_USED, to better match the spec. 42 * 08-08-01 01.02.01 Original release for v1.2 work. 43 * Changed MPI_VERSION_MINOR from 0x01 to 0x02. 44 * Added define MPI_FUNCTION_TOOLBOX. 45 * 09-28-01 01.02.02 New function code MPI_SCSI_ENCLOSURE_PROCESSOR. 46 * 11-01-01 01.02.03 Changed name to MPI_FUNCTION_SCSI_ENCLOSURE_PROCESSOR. 47 * 03-14-02 01.02.04 Added MPI_HEADER_VERSION_ defines. 48 * 05-31-02 01.02.05 Bumped MPI_HEADER_VERSION_UNIT. 49 * 07-12-02 01.02.06 Added define for MPI_FUNCTION_MAILBOX. 50 * 09-16-02 01.02.07 Bumped value for MPI_HEADER_VERSION_UNIT. 51 * 11-15-02 01.02.08 Added define MPI_IOCSTATUS_TARGET_INVALID_IO_INDEX and 52 * obsoleted define MPI_IOCSTATUS_TARGET_INVALID_IOCINDEX. 53 * 04-01-03 01.02.09 New IOCStatus code: MPI_IOCSTATUS_FC_EXCHANGE_CANCELED 54 * 06-26-03 01.02.10 Bumped MPI_HEADER_VERSION_UNIT value. 55 * 01-16-04 01.02.11 Added define for MPI_IOCLOGINFO_TYPE_SHIFT. 56 * 04-29-04 01.02.12 Added function codes for MPI_FUNCTION_DIAG_BUFFER_POST 57 * and MPI_FUNCTION_DIAG_RELEASE. 58 * Added MPI_IOCSTATUS_DIAGNOSTIC_RELEASED define. 59 * Bumped MPI_HEADER_VERSION_UNIT value. 60 * 05-11-04 01.03.01 Bumped MPI_VERSION_MINOR for MPI v1.3. 61 * Added codes for Inband. 62 * 08-19-04 01.05.01 Added defines for Host Buffer Access Control doorbell. 63 * Added define for offset of High Priority Request Queue. 64 * Added new function codes and new IOCStatus codes. 65 * Added a IOCLogInfo type of SAS. 66 * 12-07-04 01.05.02 Bumped MPI_HEADER_VERSION_UNIT. 67 * 12-09-04 01.05.03 Bumped MPI_HEADER_VERSION_UNIT. 68 * 01-15-05 01.05.04 Bumped MPI_HEADER_VERSION_UNIT. 69 * 02-09-05 01.05.05 Bumped MPI_HEADER_VERSION_UNIT. 70 * 02-22-05 01.05.06 Bumped MPI_HEADER_VERSION_UNIT. 71 * 03-11-05 01.05.07 Removed function codes for SCSI IO 32 and 72 * TargetAssistExtended requests. 73 * Removed EEDP IOCStatus codes. 74 * -------------------------------------------------------------------------- 75 */ 76 77 #ifndef MPI_H 78 #define MPI_H 79 80 81 /***************************************************************************** 82 * 83 * M P I V e r s i o n D e f i n i t i o n s 84 * 85 *****************************************************************************/ 86 87 #define MPI_VERSION_MAJOR (0x01) 88 #define MPI_VERSION_MINOR (0x05) 89 #define MPI_VERSION_MAJOR_MASK (0xFF00) 90 #define MPI_VERSION_MAJOR_SHIFT (8) 91 #define MPI_VERSION_MINOR_MASK (0x00FF) 92 #define MPI_VERSION_MINOR_SHIFT (0) 93 #define MPI_VERSION ((MPI_VERSION_MAJOR << MPI_VERSION_MAJOR_SHIFT) | \ 94 MPI_VERSION_MINOR) 95 96 #define MPI_VERSION_01_00 (0x0100) 97 #define MPI_VERSION_01_01 (0x0101) 98 #define MPI_VERSION_01_02 (0x0102) 99 #define MPI_VERSION_01_03 (0x0103) 100 #define MPI_VERSION_01_05 (0x0105) 101 /* Note: The major versions of 0xe0 through 0xff are reserved */ 102 103 /* versioning for this MPI header set */ 104 #define MPI_HEADER_VERSION_UNIT (0x09) 105 #define MPI_HEADER_VERSION_DEV (0x00) 106 #define MPI_HEADER_VERSION_UNIT_MASK (0xFF00) 107 #define MPI_HEADER_VERSION_UNIT_SHIFT (8) 108 #define MPI_HEADER_VERSION_DEV_MASK (0x00FF) 109 #define MPI_HEADER_VERSION_DEV_SHIFT (0) 110 #define MPI_HEADER_VERSION ((MPI_HEADER_VERSION_UNIT << 8) | MPI_HEADER_VERSION_DEV) 111 112 /***************************************************************************** 113 * 114 * I O C S t a t e D e f i n i t i o n s 115 * 116 *****************************************************************************/ 117 118 #define MPI_IOC_STATE_RESET (0x00000000) 119 #define MPI_IOC_STATE_READY (0x10000000) 120 #define MPI_IOC_STATE_OPERATIONAL (0x20000000) 121 #define MPI_IOC_STATE_FAULT (0x40000000) 122 123 #define MPI_IOC_STATE_MASK (0xF0000000) 124 #define MPI_IOC_STATE_SHIFT (28) 125 126 /* Fault state codes (product independent range 0x8000-0xFFFF) */ 127 128 #define MPI_FAULT_REQUEST_MESSAGE_PCI_PARITY_ERROR (0x8111) 129 #define MPI_FAULT_REQUEST_MESSAGE_PCI_BUS_FAULT (0x8112) 130 #define MPI_FAULT_REPLY_MESSAGE_PCI_PARITY_ERROR (0x8113) 131 #define MPI_FAULT_REPLY_MESSAGE_PCI_BUS_FAULT (0x8114) 132 #define MPI_FAULT_DATA_SEND_PCI_PARITY_ERROR (0x8115) 133 #define MPI_FAULT_DATA_SEND_PCI_BUS_FAULT (0x8116) 134 #define MPI_FAULT_DATA_RECEIVE_PCI_PARITY_ERROR (0x8117) 135 #define MPI_FAULT_DATA_RECEIVE_PCI_BUS_FAULT (0x8118) 136 137 138 /***************************************************************************** 139 * 140 * P C I S y s t e m I n t e r f a c e R e g i s t e r s 141 * 142 *****************************************************************************/ 143 144 /* 145 * Defines for working with the System Doorbell register. 146 * Values for doorbell function codes are included in the section that defines 147 * all the function codes (further on in this file). 148 */ 149 #define MPI_DOORBELL_OFFSET (0x00000000) 150 #define MPI_DOORBELL_ACTIVE (0x08000000) /* DoorbellUsed */ 151 #define MPI_DOORBELL_USED (MPI_DOORBELL_ACTIVE) 152 #define MPI_DOORBELL_ACTIVE_SHIFT (27) 153 #define MPI_DOORBELL_WHO_INIT_MASK (0x07000000) 154 #define MPI_DOORBELL_WHO_INIT_SHIFT (24) 155 #define MPI_DOORBELL_FUNCTION_MASK (0xFF000000) 156 #define MPI_DOORBELL_FUNCTION_SHIFT (24) 157 #define MPI_DOORBELL_ADD_DWORDS_MASK (0x00FF0000) 158 #define MPI_DOORBELL_ADD_DWORDS_SHIFT (16) 159 #define MPI_DOORBELL_DATA_MASK (0x0000FFFF) 160 #define MPI_DOORBELL_FUNCTION_SPECIFIC_MASK (0x0000FFFF) 161 162 /* values for Host Buffer Access Control doorbell function */ 163 #define MPI_DB_HPBAC_VALUE_MASK (0x0000F000) 164 #define MPI_DB_HPBAC_ENABLE_ACCESS (0x01) 165 #define MPI_DB_HPBAC_DISABLE_ACCESS (0x02) 166 #define MPI_DB_HPBAC_FREE_BUFFER (0x03) 167 168 169 #define MPI_WRITE_SEQUENCE_OFFSET (0x00000004) 170 #define MPI_WRSEQ_KEY_VALUE_MASK (0x0000000F) 171 #define MPI_WRSEQ_1ST_KEY_VALUE (0x04) 172 #define MPI_WRSEQ_2ND_KEY_VALUE (0x0B) 173 #define MPI_WRSEQ_3RD_KEY_VALUE (0x02) 174 #define MPI_WRSEQ_4TH_KEY_VALUE (0x07) 175 #define MPI_WRSEQ_5TH_KEY_VALUE (0x0D) 176 177 #define MPI_DIAGNOSTIC_OFFSET (0x00000008) 178 #define MPI_DIAG_CLEAR_FLASH_BAD_SIG (0x00000400) 179 #define MPI_DIAG_PREVENT_IOC_BOOT (0x00000200) 180 #define MPI_DIAG_DRWE (0x00000080) 181 #define MPI_DIAG_FLASH_BAD_SIG (0x00000040) 182 #define MPI_DIAG_RESET_HISTORY (0x00000020) 183 #define MPI_DIAG_RW_ENABLE (0x00000010) 184 #define MPI_DIAG_RESET_ADAPTER (0x00000004) 185 #define MPI_DIAG_DISABLE_ARM (0x00000002) 186 #define MPI_DIAG_MEM_ENABLE (0x00000001) 187 188 #define MPI_TEST_BASE_ADDRESS_OFFSET (0x0000000C) 189 190 #define MPI_DIAG_RW_DATA_OFFSET (0x00000010) 191 192 #define MPI_DIAG_RW_ADDRESS_OFFSET (0x00000014) 193 194 #define MPI_HOST_INTERRUPT_STATUS_OFFSET (0x00000030) 195 #define MPI_HIS_IOP_DOORBELL_STATUS (0x80000000) 196 #define MPI_HIS_REPLY_MESSAGE_INTERRUPT (0x00000008) 197 #define MPI_HIS_DOORBELL_INTERRUPT (0x00000001) 198 199 #define MPI_HOST_INTERRUPT_MASK_OFFSET (0x00000034) 200 #define MPI_HIM_RIM (0x00000008) 201 #define MPI_HIM_DIM (0x00000001) 202 203 #define MPI_REQUEST_QUEUE_OFFSET (0x00000040) 204 #define MPI_REQUEST_POST_FIFO_OFFSET (0x00000040) 205 206 #define MPI_REPLY_QUEUE_OFFSET (0x00000044) 207 #define MPI_REPLY_POST_FIFO_OFFSET (0x00000044) 208 #define MPI_REPLY_FREE_FIFO_OFFSET (0x00000044) 209 210 #define MPI_HI_PRI_REQUEST_QUEUE_OFFSET (0x00000048) 211 212 213 214 /***************************************************************************** 215 * 216 * M e s s a g e F r a m e D e s c r i p t o r s 217 * 218 *****************************************************************************/ 219 220 #define MPI_REQ_MF_DESCRIPTOR_NB_MASK (0x00000003) 221 #define MPI_REQ_MF_DESCRIPTOR_F_BIT (0x00000004) 222 #define MPI_REQ_MF_DESCRIPTOR_ADDRESS_MASK (0xFFFFFFF8) 223 224 #define MPI_ADDRESS_REPLY_A_BIT (0x80000000) 225 #define MPI_ADDRESS_REPLY_ADDRESS_MASK (0x7FFFFFFF) 226 227 #define MPI_CONTEXT_REPLY_A_BIT (0x80000000) 228 #define MPI_CONTEXT_REPLY_TYPE_MASK (0x60000000) 229 #define MPI_CONTEXT_REPLY_TYPE_SCSI_INIT (0x00) 230 #define MPI_CONTEXT_REPLY_TYPE_SCSI_TARGET (0x01) 231 #define MPI_CONTEXT_REPLY_TYPE_LAN (0x02) 232 #define MPI_CONTEXT_REPLY_TYPE_SHIFT (29) 233 #define MPI_CONTEXT_REPLY_CONTEXT_MASK (0x1FFFFFFF) 234 235 236 /****************************************************************************/ 237 /* Context Reply macros */ 238 /****************************************************************************/ 239 240 #define MPI_GET_CONTEXT_REPLY_TYPE(x) (((x) & MPI_CONTEXT_REPLY_TYPE_MASK) \ 241 >> MPI_CONTEXT_REPLY_TYPE_SHIFT) 242 243 #define MPI_SET_CONTEXT_REPLY_TYPE(x, typ) \ 244 ((x) = ((x) & ~MPI_CONTEXT_REPLY_TYPE_MASK) | \ 245 (((typ) << MPI_CONTEXT_REPLY_TYPE_SHIFT) & \ 246 MPI_CONTEXT_REPLY_TYPE_MASK)) 247 248 249 /***************************************************************************** 250 * 251 * M e s s a g e F u n c t i o n s 252 * 0x80 -> 0x8F reserved for private message use per product 253 * 254 * 255 *****************************************************************************/ 256 257 #define MPI_FUNCTION_SCSI_IO_REQUEST (0x00) 258 #define MPI_FUNCTION_SCSI_TASK_MGMT (0x01) 259 #define MPI_FUNCTION_IOC_INIT (0x02) 260 #define MPI_FUNCTION_IOC_FACTS (0x03) 261 #define MPI_FUNCTION_CONFIG (0x04) 262 #define MPI_FUNCTION_PORT_FACTS (0x05) 263 #define MPI_FUNCTION_PORT_ENABLE (0x06) 264 #define MPI_FUNCTION_EVENT_NOTIFICATION (0x07) 265 #define MPI_FUNCTION_EVENT_ACK (0x08) 266 #define MPI_FUNCTION_FW_DOWNLOAD (0x09) 267 #define MPI_FUNCTION_TARGET_CMD_BUFFER_POST (0x0A) 268 #define MPI_FUNCTION_TARGET_ASSIST (0x0B) 269 #define MPI_FUNCTION_TARGET_STATUS_SEND (0x0C) 270 #define MPI_FUNCTION_TARGET_MODE_ABORT (0x0D) 271 #define MPI_FUNCTION_FC_LINK_SRVC_BUF_POST (0x0E) 272 #define MPI_FUNCTION_FC_LINK_SRVC_RSP (0x0F) 273 #define MPI_FUNCTION_FC_EX_LINK_SRVC_SEND (0x10) 274 #define MPI_FUNCTION_FC_ABORT (0x11) 275 #define MPI_FUNCTION_FW_UPLOAD (0x12) 276 #define MPI_FUNCTION_FC_COMMON_TRANSPORT_SEND (0x13) 277 #define MPI_FUNCTION_FC_PRIMITIVE_SEND (0x14) 278 279 #define MPI_FUNCTION_RAID_ACTION (0x15) 280 #define MPI_FUNCTION_RAID_SCSI_IO_PASSTHROUGH (0x16) 281 282 #define MPI_FUNCTION_TOOLBOX (0x17) 283 284 #define MPI_FUNCTION_SCSI_ENCLOSURE_PROCESSOR (0x18) 285 286 #define MPI_FUNCTION_MAILBOX (0x19) 287 288 #define MPI_FUNCTION_SMP_PASSTHROUGH (0x1A) 289 #define MPI_FUNCTION_SAS_IO_UNIT_CONTROL (0x1B) 290 #define MPI_FUNCTION_SATA_PASSTHROUGH (0x1C) 291 292 #define MPI_FUNCTION_DIAG_BUFFER_POST (0x1D) 293 #define MPI_FUNCTION_DIAG_RELEASE (0x1E) 294 295 #define MPI_FUNCTION_LAN_SEND (0x20) 296 #define MPI_FUNCTION_LAN_RECEIVE (0x21) 297 #define MPI_FUNCTION_LAN_RESET (0x22) 298 299 #define MPI_FUNCTION_TARGET_CMD_BUF_BASE_POST (0x24) 300 #define MPI_FUNCTION_TARGET_CMD_BUF_LIST_POST (0x25) 301 302 #define MPI_FUNCTION_INBAND_BUFFER_POST (0x28) 303 #define MPI_FUNCTION_INBAND_SEND (0x29) 304 #define MPI_FUNCTION_INBAND_RSP (0x2A) 305 #define MPI_FUNCTION_INBAND_ABORT (0x2B) 306 307 #define MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET (0x40) 308 #define MPI_FUNCTION_IO_UNIT_RESET (0x41) 309 #define MPI_FUNCTION_HANDSHAKE (0x42) 310 #define MPI_FUNCTION_REPLY_FRAME_REMOVAL (0x43) 311 #define MPI_FUNCTION_HOST_PAGEBUF_ACCESS_CONTROL (0x44) 312 313 314 /* standard version format */ 315 typedef struct _MPI_VERSION_STRUCT 316 { 317 U8 Dev; /* 00h */ 318 U8 Unit; /* 01h */ 319 U8 Minor; /* 02h */ 320 U8 Major; /* 03h */ 321 } MPI_VERSION_STRUCT, MPI_POINTER PTR_MPI_VERSION_STRUCT, 322 MpiVersionStruct_t, MPI_POINTER pMpiVersionStruct; 323 324 typedef union _MPI_VERSION_FORMAT 325 { 326 MPI_VERSION_STRUCT Struct; 327 U32 Word; 328 } MPI_VERSION_FORMAT, MPI_POINTER PTR_MPI_VERSION_FORMAT, 329 MpiVersionFormat_t, MPI_POINTER pMpiVersionFormat_t; 330 331 332 /***************************************************************************** 333 * 334 * S c a t t e r G a t h e r E l e m e n t s 335 * 336 *****************************************************************************/ 337 338 /****************************************************************************/ 339 /* Simple element structures */ 340 /****************************************************************************/ 341 342 typedef struct _SGE_SIMPLE32 343 { 344 U32 FlagsLength; 345 U32 Address; 346 } SGE_SIMPLE32, MPI_POINTER PTR_SGE_SIMPLE32, 347 SGESimple32_t, MPI_POINTER pSGESimple32_t; 348 349 typedef struct _SGE_SIMPLE64 350 { 351 U32 FlagsLength; 352 U64 Address; 353 } SGE_SIMPLE64, MPI_POINTER PTR_SGE_SIMPLE64, 354 SGESimple64_t, MPI_POINTER pSGESimple64_t; 355 356 typedef struct _SGE_SIMPLE_UNION 357 { 358 U32 FlagsLength; 359 union 360 { 361 U32 Address32; 362 U64 Address64; 363 }u; 364 } SGE_SIMPLE_UNION, MPI_POINTER PTR_SGE_SIMPLE_UNION, 365 SGESimpleUnion_t, MPI_POINTER pSGESimpleUnion_t; 366 367 /****************************************************************************/ 368 /* Chain element structures */ 369 /****************************************************************************/ 370 371 typedef struct _SGE_CHAIN32 372 { 373 U16 Length; 374 U8 NextChainOffset; 375 U8 Flags; 376 U32 Address; 377 } SGE_CHAIN32, MPI_POINTER PTR_SGE_CHAIN32, 378 SGEChain32_t, MPI_POINTER pSGEChain32_t; 379 380 typedef struct _SGE_CHAIN64 381 { 382 U16 Length; 383 U8 NextChainOffset; 384 U8 Flags; 385 U64 Address; 386 } SGE_CHAIN64, MPI_POINTER PTR_SGE_CHAIN64, 387 SGEChain64_t, MPI_POINTER pSGEChain64_t; 388 389 typedef struct _SGE_CHAIN_UNION 390 { 391 U16 Length; 392 U8 NextChainOffset; 393 U8 Flags; 394 union 395 { 396 U32 Address32; 397 U64 Address64; 398 }u; 399 } SGE_CHAIN_UNION, MPI_POINTER PTR_SGE_CHAIN_UNION, 400 SGEChainUnion_t, MPI_POINTER pSGEChainUnion_t; 401 402 /****************************************************************************/ 403 /* Transaction Context element */ 404 /****************************************************************************/ 405 406 typedef struct _SGE_TRANSACTION32 407 { 408 U8 Reserved; 409 U8 ContextSize; 410 U8 DetailsLength; 411 U8 Flags; 412 U32 TransactionContext[1]; 413 U32 TransactionDetails[1]; 414 } SGE_TRANSACTION32, MPI_POINTER PTR_SGE_TRANSACTION32, 415 SGETransaction32_t, MPI_POINTER pSGETransaction32_t; 416 417 typedef struct _SGE_TRANSACTION64 418 { 419 U8 Reserved; 420 U8 ContextSize; 421 U8 DetailsLength; 422 U8 Flags; 423 U32 TransactionContext[2]; 424 U32 TransactionDetails[1]; 425 } SGE_TRANSACTION64, MPI_POINTER PTR_SGE_TRANSACTION64, 426 SGETransaction64_t, MPI_POINTER pSGETransaction64_t; 427 428 typedef struct _SGE_TRANSACTION96 429 { 430 U8 Reserved; 431 U8 ContextSize; 432 U8 DetailsLength; 433 U8 Flags; 434 U32 TransactionContext[3]; 435 U32 TransactionDetails[1]; 436 } SGE_TRANSACTION96, MPI_POINTER PTR_SGE_TRANSACTION96, 437 SGETransaction96_t, MPI_POINTER pSGETransaction96_t; 438 439 typedef struct _SGE_TRANSACTION128 440 { 441 U8 Reserved; 442 U8 ContextSize; 443 U8 DetailsLength; 444 U8 Flags; 445 U32 TransactionContext[4]; 446 U32 TransactionDetails[1]; 447 } SGE_TRANSACTION128, MPI_POINTER PTR_SGE_TRANSACTION128, 448 SGETransaction_t128, MPI_POINTER pSGETransaction_t128; 449 450 typedef struct _SGE_TRANSACTION_UNION 451 { 452 U8 Reserved; 453 U8 ContextSize; 454 U8 DetailsLength; 455 U8 Flags; 456 union 457 { 458 U32 TransactionContext32[1]; 459 U32 TransactionContext64[2]; 460 U32 TransactionContext96[3]; 461 U32 TransactionContext128[4]; 462 }u; 463 U32 TransactionDetails[1]; 464 } SGE_TRANSACTION_UNION, MPI_POINTER PTR_SGE_TRANSACTION_UNION, 465 SGETransactionUnion_t, MPI_POINTER pSGETransactionUnion_t; 466 467 468 /****************************************************************************/ 469 /* SGE IO types union for IO SGL's */ 470 /****************************************************************************/ 471 472 typedef struct _SGE_IO_UNION 473 { 474 union 475 { 476 SGE_SIMPLE_UNION Simple; 477 SGE_CHAIN_UNION Chain; 478 } u; 479 } SGE_IO_UNION, MPI_POINTER PTR_SGE_IO_UNION, 480 SGEIOUnion_t, MPI_POINTER pSGEIOUnion_t; 481 482 /****************************************************************************/ 483 /* SGE union for SGL's with Simple and Transaction elements */ 484 /****************************************************************************/ 485 486 typedef struct _SGE_TRANS_SIMPLE_UNION 487 { 488 union 489 { 490 SGE_SIMPLE_UNION Simple; 491 SGE_TRANSACTION_UNION Transaction; 492 } u; 493 } SGE_TRANS_SIMPLE_UNION, MPI_POINTER PTR_SGE_TRANS_SIMPLE_UNION, 494 SGETransSimpleUnion_t, MPI_POINTER pSGETransSimpleUnion_t; 495 496 /****************************************************************************/ 497 /* All SGE types union */ 498 /****************************************************************************/ 499 500 typedef struct _SGE_MPI_UNION 501 { 502 union 503 { 504 SGE_SIMPLE_UNION Simple; 505 SGE_CHAIN_UNION Chain; 506 SGE_TRANSACTION_UNION Transaction; 507 } u; 508 } SGE_MPI_UNION, MPI_POINTER PTR_SGE_MPI_UNION, 509 MPI_SGE_UNION_t, MPI_POINTER pMPI_SGE_UNION_t, 510 SGEAllUnion_t, MPI_POINTER pSGEAllUnion_t; 511 512 513 /****************************************************************************/ 514 /* SGE field definition and masks */ 515 /****************************************************************************/ 516 517 /* Flags field bit definitions */ 518 519 #define MPI_SGE_FLAGS_LAST_ELEMENT (0x80) 520 #define MPI_SGE_FLAGS_END_OF_BUFFER (0x40) 521 #define MPI_SGE_FLAGS_ELEMENT_TYPE_MASK (0x30) 522 #define MPI_SGE_FLAGS_LOCAL_ADDRESS (0x08) 523 #define MPI_SGE_FLAGS_DIRECTION (0x04) 524 #define MPI_SGE_FLAGS_ADDRESS_SIZE (0x02) 525 #define MPI_SGE_FLAGS_END_OF_LIST (0x01) 526 527 #define MPI_SGE_FLAGS_SHIFT (24) 528 529 #define MPI_SGE_LENGTH_MASK (0x00FFFFFF) 530 #define MPI_SGE_CHAIN_LENGTH_MASK (0x0000FFFF) 531 532 /* Element Type */ 533 534 #define MPI_SGE_FLAGS_TRANSACTION_ELEMENT (0x00) 535 #define MPI_SGE_FLAGS_SIMPLE_ELEMENT (0x10) 536 #define MPI_SGE_FLAGS_CHAIN_ELEMENT (0x30) 537 #define MPI_SGE_FLAGS_ELEMENT_MASK (0x30) 538 539 /* Address location */ 540 541 #define MPI_SGE_FLAGS_SYSTEM_ADDRESS (0x00) 542 543 /* Direction */ 544 545 #define MPI_SGE_FLAGS_IOC_TO_HOST (0x00) 546 #define MPI_SGE_FLAGS_HOST_TO_IOC (0x04) 547 548 /* Address Size */ 549 550 #define MPI_SGE_FLAGS_32_BIT_ADDRESSING (0x00) 551 #define MPI_SGE_FLAGS_64_BIT_ADDRESSING (0x02) 552 553 /* Context Size */ 554 555 #define MPI_SGE_FLAGS_32_BIT_CONTEXT (0x00) 556 #define MPI_SGE_FLAGS_64_BIT_CONTEXT (0x02) 557 #define MPI_SGE_FLAGS_96_BIT_CONTEXT (0x04) 558 #define MPI_SGE_FLAGS_128_BIT_CONTEXT (0x06) 559 560 #define MPI_SGE_CHAIN_OFFSET_MASK (0x00FF0000) 561 #define MPI_SGE_CHAIN_OFFSET_SHIFT (16) 562 563 564 /****************************************************************************/ 565 /* SGE operation Macros */ 566 /****************************************************************************/ 567 568 /* SIMPLE FlagsLength manipulations... */ 569 #define MPI_SGE_SET_FLAGS(f) ((U32)(f) << MPI_SGE_FLAGS_SHIFT) 570 #define MPI_SGE_GET_FLAGS(fl) (((fl) & ~MPI_SGE_LENGTH_MASK) >> MPI_SGE_FLAGS_SHIFT) 571 #define MPI_SGE_LENGTH(fl) ((fl) & MPI_SGE_LENGTH_MASK) 572 #define MPI_SGE_CHAIN_LENGTH(fl) ((fl) & MPI_SGE_CHAIN_LENGTH_MASK) 573 574 #define MPI_SGE_SET_FLAGS_LENGTH(f,l) (MPI_SGE_SET_FLAGS(f) | MPI_SGE_LENGTH(l)) 575 576 #define MPI_pSGE_GET_FLAGS(psg) MPI_SGE_GET_FLAGS((psg)->FlagsLength) 577 #define MPI_pSGE_GET_LENGTH(psg) MPI_SGE_LENGTH((psg)->FlagsLength) 578 #define MPI_pSGE_SET_FLAGS_LENGTH(psg,f,l) (psg)->FlagsLength = MPI_SGE_SET_FLAGS_LENGTH(f,l) 579 /* CAUTION - The following are READ-MODIFY-WRITE! */ 580 #define MPI_pSGE_SET_FLAGS(psg,f) (psg)->FlagsLength |= MPI_SGE_SET_FLAGS(f) 581 #define MPI_pSGE_SET_LENGTH(psg,l) (psg)->FlagsLength |= MPI_SGE_LENGTH(l) 582 583 #define MPI_GET_CHAIN_OFFSET(x) ((x&MPI_SGE_CHAIN_OFFSET_MASK)>>MPI_SGE_CHAIN_OFFSET_SHIFT) 584 585 586 587 /***************************************************************************** 588 * 589 * S t a n d a r d M e s s a g e S t r u c t u r e s 590 * 591 *****************************************************************************/ 592 593 /****************************************************************************/ 594 /* Standard message request header for all request messages */ 595 /****************************************************************************/ 596 597 typedef struct _MSG_REQUEST_HEADER 598 { 599 U8 Reserved[2]; /* function specific */ 600 U8 ChainOffset; 601 U8 Function; 602 U8 Reserved1[3]; /* function specific */ 603 U8 MsgFlags; 604 U32 MsgContext; 605 } MSG_REQUEST_HEADER, MPI_POINTER PTR_MSG_REQUEST_HEADER, 606 MPIHeader_t, MPI_POINTER pMPIHeader_t; 607 608 609 /****************************************************************************/ 610 /* Default Reply */ 611 /****************************************************************************/ 612 613 typedef struct _MSG_DEFAULT_REPLY 614 { 615 U8 Reserved[2]; /* function specific */ 616 U8 MsgLength; 617 U8 Function; 618 U8 Reserved1[3]; /* function specific */ 619 U8 MsgFlags; 620 U32 MsgContext; 621 U8 Reserved2[2]; /* function specific */ 622 U16 IOCStatus; 623 U32 IOCLogInfo; 624 } MSG_DEFAULT_REPLY, MPI_POINTER PTR_MSG_DEFAULT_REPLY, 625 MPIDefaultReply_t, MPI_POINTER pMPIDefaultReply_t; 626 627 628 /* MsgFlags definition for all replies */ 629 630 #define MPI_MSGFLAGS_CONTINUATION_REPLY (0x80) 631 632 633 /***************************************************************************** 634 * 635 * I O C S t a t u s V a l u e s 636 * 637 *****************************************************************************/ 638 639 /****************************************************************************/ 640 /* Common IOCStatus values for all replies */ 641 /****************************************************************************/ 642 643 #define MPI_IOCSTATUS_SUCCESS (0x0000) 644 #define MPI_IOCSTATUS_INVALID_FUNCTION (0x0001) 645 #define MPI_IOCSTATUS_BUSY (0x0002) 646 #define MPI_IOCSTATUS_INVALID_SGL (0x0003) 647 #define MPI_IOCSTATUS_INTERNAL_ERROR (0x0004) 648 #define MPI_IOCSTATUS_RESERVED (0x0005) 649 #define MPI_IOCSTATUS_INSUFFICIENT_RESOURCES (0x0006) 650 #define MPI_IOCSTATUS_INVALID_FIELD (0x0007) 651 #define MPI_IOCSTATUS_INVALID_STATE (0x0008) 652 #define MPI_IOCSTATUS_OP_STATE_NOT_SUPPORTED (0x0009) 653 654 /****************************************************************************/ 655 /* Config IOCStatus values */ 656 /****************************************************************************/ 657 658 #define MPI_IOCSTATUS_CONFIG_INVALID_ACTION (0x0020) 659 #define MPI_IOCSTATUS_CONFIG_INVALID_TYPE (0x0021) 660 #define MPI_IOCSTATUS_CONFIG_INVALID_PAGE (0x0022) 661 #define MPI_IOCSTATUS_CONFIG_INVALID_DATA (0x0023) 662 #define MPI_IOCSTATUS_CONFIG_NO_DEFAULTS (0x0024) 663 #define MPI_IOCSTATUS_CONFIG_CANT_COMMIT (0x0025) 664 665 /****************************************************************************/ 666 /* SCSIIO Reply (SPI & FCP) initiator values */ 667 /****************************************************************************/ 668 669 #define MPI_IOCSTATUS_SCSI_RECOVERED_ERROR (0x0040) 670 #define MPI_IOCSTATUS_SCSI_INVALID_BUS (0x0041) 671 #define MPI_IOCSTATUS_SCSI_INVALID_TARGETID (0x0042) 672 #define MPI_IOCSTATUS_SCSI_DEVICE_NOT_THERE (0x0043) 673 #define MPI_IOCSTATUS_SCSI_DATA_OVERRUN (0x0044) 674 #define MPI_IOCSTATUS_SCSI_DATA_UNDERRUN (0x0045) 675 #define MPI_IOCSTATUS_SCSI_IO_DATA_ERROR (0x0046) 676 #define MPI_IOCSTATUS_SCSI_PROTOCOL_ERROR (0x0047) 677 #define MPI_IOCSTATUS_SCSI_TASK_TERMINATED (0x0048) 678 #define MPI_IOCSTATUS_SCSI_RESIDUAL_MISMATCH (0x0049) 679 #define MPI_IOCSTATUS_SCSI_TASK_MGMT_FAILED (0x004A) 680 #define MPI_IOCSTATUS_SCSI_IOC_TERMINATED (0x004B) 681 #define MPI_IOCSTATUS_SCSI_EXT_TERMINATED (0x004C) 682 683 /****************************************************************************/ 684 /* SCSI Target values */ 685 /****************************************************************************/ 686 687 #define MPI_IOCSTATUS_TARGET_PRIORITY_IO (0x0060) 688 #define MPI_IOCSTATUS_TARGET_INVALID_PORT (0x0061) 689 #define MPI_IOCSTATUS_TARGET_INVALID_IOCINDEX (0x0062) /* obsolete name */ 690 #define MPI_IOCSTATUS_TARGET_INVALID_IO_INDEX (0x0062) 691 #define MPI_IOCSTATUS_TARGET_ABORTED (0x0063) 692 #define MPI_IOCSTATUS_TARGET_NO_CONN_RETRYABLE (0x0064) 693 #define MPI_IOCSTATUS_TARGET_NO_CONNECTION (0x0065) 694 #define MPI_IOCSTATUS_TARGET_XFER_COUNT_MISMATCH (0x006A) 695 #define MPI_IOCSTATUS_TARGET_STS_DATA_NOT_SENT (0x006B) 696 #define MPI_IOCSTATUS_TARGET_DATA_OFFSET_ERROR (0x006D) 697 #define MPI_IOCSTATUS_TARGET_TOO_MUCH_WRITE_DATA (0x006E) 698 #define MPI_IOCSTATUS_TARGET_IU_TOO_SHORT (0x006F) 699 700 /****************************************************************************/ 701 /* Additional FCP target values (obsolete) */ 702 /****************************************************************************/ 703 704 #define MPI_IOCSTATUS_TARGET_FC_ABORTED (0x0066) /* obsolete */ 705 #define MPI_IOCSTATUS_TARGET_FC_RX_ID_INVALID (0x0067) /* obsolete */ 706 #define MPI_IOCSTATUS_TARGET_FC_DID_INVALID (0x0068) /* obsolete */ 707 #define MPI_IOCSTATUS_TARGET_FC_NODE_LOGGED_OUT (0x0069) /* obsolete */ 708 709 /****************************************************************************/ 710 /* Fibre Channel Direct Access values */ 711 /****************************************************************************/ 712 713 #define MPI_IOCSTATUS_FC_ABORTED (0x0066) 714 #define MPI_IOCSTATUS_FC_RX_ID_INVALID (0x0067) 715 #define MPI_IOCSTATUS_FC_DID_INVALID (0x0068) 716 #define MPI_IOCSTATUS_FC_NODE_LOGGED_OUT (0x0069) 717 #define MPI_IOCSTATUS_FC_EXCHANGE_CANCELED (0x006C) 718 719 /****************************************************************************/ 720 /* LAN values */ 721 /****************************************************************************/ 722 723 #define MPI_IOCSTATUS_LAN_DEVICE_NOT_FOUND (0x0080) 724 #define MPI_IOCSTATUS_LAN_DEVICE_FAILURE (0x0081) 725 #define MPI_IOCSTATUS_LAN_TRANSMIT_ERROR (0x0082) 726 #define MPI_IOCSTATUS_LAN_TRANSMIT_ABORTED (0x0083) 727 #define MPI_IOCSTATUS_LAN_RECEIVE_ERROR (0x0084) 728 #define MPI_IOCSTATUS_LAN_RECEIVE_ABORTED (0x0085) 729 #define MPI_IOCSTATUS_LAN_PARTIAL_PACKET (0x0086) 730 #define MPI_IOCSTATUS_LAN_CANCELED (0x0087) 731 732 /****************************************************************************/ 733 /* Serial Attached SCSI values */ 734 /****************************************************************************/ 735 736 #define MPI_IOCSTATUS_SAS_SMP_REQUEST_FAILED (0x0090) 737 #define MPI_IOCSTATUS_SAS_SMP_DATA_OVERRUN (0x0091) 738 739 /****************************************************************************/ 740 /* Inband values */ 741 /****************************************************************************/ 742 743 #define MPI_IOCSTATUS_INBAND_ABORTED (0x0098) 744 #define MPI_IOCSTATUS_INBAND_NO_CONNECTION (0x0099) 745 746 /****************************************************************************/ 747 /* Diagnostic Tools values */ 748 /****************************************************************************/ 749 750 #define MPI_IOCSTATUS_DIAGNOSTIC_RELEASED (0x00A0) 751 752 753 /****************************************************************************/ 754 /* IOCStatus flag to indicate that log info is available */ 755 /****************************************************************************/ 756 757 #define MPI_IOCSTATUS_FLAG_LOG_INFO_AVAILABLE (0x8000) 758 #define MPI_IOCSTATUS_MASK (0x7FFF) 759 760 /****************************************************************************/ 761 /* LogInfo Types */ 762 /****************************************************************************/ 763 764 #define MPI_IOCLOGINFO_TYPE_MASK (0xF0000000) 765 #define MPI_IOCLOGINFO_TYPE_SHIFT (28) 766 #define MPI_IOCLOGINFO_TYPE_NONE (0x0) 767 #define MPI_IOCLOGINFO_TYPE_SCSI (0x1) 768 #define MPI_IOCLOGINFO_TYPE_FC (0x2) 769 #define MPI_IOCLOGINFO_TYPE_SAS (0x3) 770 #define MPI_IOCLOGINFO_TYPE_ISCSI (0x4) 771 #define MPI_IOCLOGINFO_LOG_DATA_MASK (0x0FFFFFFF) 772 773 774 #endif 775