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