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