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