Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  *  Copyright (c) 2000-2008 LSI Corporation.
0004  *
0005  *
0006  *           Name:  mpi.h
0007  *          Title:  MPI Message independent structures and definitions
0008  *  Creation Date:  July 27, 2000
0009  *
0010  *    mpi.h Version:  01.05.16
0011  *
0012  *  Version History
0013  *  ---------------
0014  *
0015  *  Date      Version   Description
0016  *  --------  --------  ------------------------------------------------------
0017  *  05-08-00  00.10.01  Original release for 0.10 spec dated 4/26/2000.
0018  *  05-24-00  00.10.02  Added MPI_IOCSTATUS_SCSI_RESIDUAL_MISMATCH definition.
0019  *  06-06-00  01.00.01  Update MPI_VERSION_MAJOR and MPI_VERSION_MINOR.
0020  *  06-22-00  01.00.02  Added MPI_IOCSTATUS_LAN_ definitions.
0021  *                      Removed LAN_SUSPEND function definition.
0022  *                      Added MPI_MSGFLAGS_CONTINUATION_REPLY definition.
0023  *  06-30-00  01.00.03  Added MPI_CONTEXT_REPLY_TYPE_LAN definition.
0024  *                      Added MPI_GET/SET_CONTEXT_REPLY_TYPE macros.
0025  *  07-27-00  01.00.04  Added MPI_FAULT_ definitions.
0026  *                      Removed MPI_IOCSTATUS_MSG/DATA_XFER_ERROR definitions.
0027  *                      Added MPI_IOCSTATUS_INTERNAL_ERROR definition.
0028  *                      Added MPI_IOCSTATUS_TARGET_XFER_COUNT_MISMATCH.
0029  *  11-02-00  01.01.01  Original release for post 1.0 work.
0030  *  12-04-00  01.01.02  Added new function codes.
0031  *  01-09-01  01.01.03  Added more definitions to the system interface section
0032  *                      Added MPI_IOCSTATUS_TARGET_STS_DATA_NOT_SENT.
0033  *  01-25-01  01.01.04  Changed MPI_VERSION_MINOR from 0x00 to 0x01.
0034  *  02-20-01  01.01.05  Started using MPI_POINTER.
0035  *                      Fixed value for MPI_DIAG_RW_ENABLE.
0036  *                      Added defines for MPI_DIAG_PREVENT_IOC_BOOT and
0037  *                      MPI_DIAG_CLEAR_FLASH_BAD_SIG.
0038  *                      Obsoleted MPI_IOCSTATUS_TARGET_FC_ defines.
0039  *  02-27-01  01.01.06  Removed MPI_HOST_INDEX_REGISTER define.
0040  *                      Added function codes for RAID.
0041  *  04-09-01  01.01.07  Added alternate define for MPI_DOORBELL_ACTIVE,
0042  *                      MPI_DOORBELL_USED, to better match the spec.
0043  *  08-08-01  01.02.01  Original release for v1.2 work.
0044  *                      Changed MPI_VERSION_MINOR from 0x01 to 0x02.
0045  *                      Added define MPI_FUNCTION_TOOLBOX.
0046  *  09-28-01  01.02.02  New function code MPI_SCSI_ENCLOSURE_PROCESSOR.
0047  *  11-01-01  01.02.03  Changed name to MPI_FUNCTION_SCSI_ENCLOSURE_PROCESSOR.
0048  *  03-14-02  01.02.04  Added MPI_HEADER_VERSION_ defines.
0049  *  05-31-02  01.02.05  Bumped MPI_HEADER_VERSION_UNIT.
0050  *  07-12-02  01.02.06  Added define for MPI_FUNCTION_MAILBOX.
0051  *  09-16-02  01.02.07  Bumped value for MPI_HEADER_VERSION_UNIT.
0052  *  11-15-02  01.02.08  Added define MPI_IOCSTATUS_TARGET_INVALID_IO_INDEX and
0053  *                      obsoleted define MPI_IOCSTATUS_TARGET_INVALID_IOCINDEX.
0054  *  04-01-03  01.02.09  New IOCStatus code: MPI_IOCSTATUS_FC_EXCHANGE_CANCELED
0055  *  06-26-03  01.02.10  Bumped MPI_HEADER_VERSION_UNIT value.
0056  *  01-16-04  01.02.11  Added define for MPI_IOCLOGINFO_TYPE_SHIFT.
0057  *  04-29-04  01.02.12  Added function codes for MPI_FUNCTION_DIAG_BUFFER_POST
0058  *                      and MPI_FUNCTION_DIAG_RELEASE.
0059  *                      Added MPI_IOCSTATUS_DIAGNOSTIC_RELEASED define.
0060  *                      Bumped MPI_HEADER_VERSION_UNIT value.
0061  *  05-11-04  01.03.01  Bumped MPI_VERSION_MINOR for MPI v1.3.
0062  *                      Added codes for Inband.
0063  *  08-19-04  01.05.01  Added defines for Host Buffer Access Control doorbell.
0064  *                      Added define for offset of High Priority Request Queue.
0065  *                      Added new function codes and new IOCStatus codes.
0066  *                      Added a IOCLogInfo type of SAS.
0067  *  12-07-04  01.05.02  Bumped MPI_HEADER_VERSION_UNIT.
0068  *  12-09-04  01.05.03  Bumped MPI_HEADER_VERSION_UNIT.
0069  *  01-15-05  01.05.04  Bumped MPI_HEADER_VERSION_UNIT.
0070  *  02-09-05  01.05.05  Bumped MPI_HEADER_VERSION_UNIT.
0071  *  02-22-05  01.05.06  Bumped MPI_HEADER_VERSION_UNIT.
0072  *  03-11-05  01.05.07  Removed function codes for SCSI IO 32 and
0073  *                      TargetAssistExtended requests.
0074  *                      Removed EEDP IOCStatus codes.
0075  *  06-24-05  01.05.08  Added function codes for SCSI IO 32 and
0076  *                      TargetAssistExtended requests.
0077  *                      Added EEDP IOCStatus codes.
0078  *  08-03-05  01.05.09  Bumped MPI_HEADER_VERSION_UNIT.
0079  *  08-30-05  01.05.10  Added 2 new IOCStatus codes for Target.
0080  *  03-27-06  01.05.11  Bumped MPI_HEADER_VERSION_UNIT.
0081  *  10-11-06  01.05.12  Bumped MPI_HEADER_VERSION_UNIT.
0082  *  05-24-07  01.05.13  Bumped MPI_HEADER_VERSION_UNIT.
0083  *  08-07-07  01.05.14  Bumped MPI_HEADER_VERSION_UNIT.
0084  *  01-15-08  01.05.15  Bumped MPI_HEADER_VERSION_UNIT.
0085  *  03-28-08  01.05.16  Bumped MPI_HEADER_VERSION_UNIT.
0086  *  --------------------------------------------------------------------------
0087  */
0088 
0089 #ifndef MPI_H
0090 #define MPI_H
0091 
0092 
0093 /*****************************************************************************
0094 *
0095 *        M P I    V e r s i o n    D e f i n i t i o n s
0096 *
0097 *****************************************************************************/
0098 
0099 #define MPI_VERSION_MAJOR                   (0x01)
0100 #define MPI_VERSION_MINOR                   (0x05)
0101 #define MPI_VERSION_MAJOR_MASK              (0xFF00)
0102 #define MPI_VERSION_MAJOR_SHIFT             (8)
0103 #define MPI_VERSION_MINOR_MASK              (0x00FF)
0104 #define MPI_VERSION_MINOR_SHIFT             (0)
0105 #define MPI_VERSION ((MPI_VERSION_MAJOR << MPI_VERSION_MAJOR_SHIFT) |   \
0106                                       MPI_VERSION_MINOR)
0107 
0108 #define MPI_VERSION_01_00                   (0x0100)
0109 #define MPI_VERSION_01_01                   (0x0101)
0110 #define MPI_VERSION_01_02                   (0x0102)
0111 #define MPI_VERSION_01_03                   (0x0103)
0112 #define MPI_VERSION_01_05                   (0x0105)
0113 /* Note: The major versions of 0xe0 through 0xff are reserved */
0114 
0115 /* versioning for this MPI header set */
0116 #define MPI_HEADER_VERSION_UNIT             (0x13)
0117 #define MPI_HEADER_VERSION_DEV              (0x00)
0118 #define MPI_HEADER_VERSION_UNIT_MASK        (0xFF00)
0119 #define MPI_HEADER_VERSION_UNIT_SHIFT       (8)
0120 #define MPI_HEADER_VERSION_DEV_MASK         (0x00FF)
0121 #define MPI_HEADER_VERSION_DEV_SHIFT        (0)
0122 #define MPI_HEADER_VERSION ((MPI_HEADER_VERSION_UNIT << 8) | MPI_HEADER_VERSION_DEV)
0123 
0124 /*****************************************************************************
0125 *
0126 *        I O C    S t a t e    D e f i n i t i o n s
0127 *
0128 *****************************************************************************/
0129 
0130 #define MPI_IOC_STATE_RESET                 (0x00000000)
0131 #define MPI_IOC_STATE_READY                 (0x10000000)
0132 #define MPI_IOC_STATE_OPERATIONAL           (0x20000000)
0133 #define MPI_IOC_STATE_FAULT                 (0x40000000)
0134 
0135 #define MPI_IOC_STATE_MASK                  (0xF0000000)
0136 #define MPI_IOC_STATE_SHIFT                 (28)
0137 
0138 /* Fault state codes (product independent range 0x8000-0xFFFF) */
0139 
0140 #define MPI_FAULT_REQUEST_MESSAGE_PCI_PARITY_ERROR  (0x8111)
0141 #define MPI_FAULT_REQUEST_MESSAGE_PCI_BUS_FAULT     (0x8112)
0142 #define MPI_FAULT_REPLY_MESSAGE_PCI_PARITY_ERROR    (0x8113)
0143 #define MPI_FAULT_REPLY_MESSAGE_PCI_BUS_FAULT       (0x8114)
0144 #define MPI_FAULT_DATA_SEND_PCI_PARITY_ERROR        (0x8115)
0145 #define MPI_FAULT_DATA_SEND_PCI_BUS_FAULT           (0x8116)
0146 #define MPI_FAULT_DATA_RECEIVE_PCI_PARITY_ERROR     (0x8117)
0147 #define MPI_FAULT_DATA_RECEIVE_PCI_BUS_FAULT        (0x8118)
0148 
0149 
0150 /*****************************************************************************
0151 *
0152 *        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
0153 *
0154 *****************************************************************************/
0155 
0156 /*
0157  * Defines for working with the System Doorbell register.
0158  * Values for doorbell function codes are included in the section that defines
0159  * all the function codes (further on in this file).
0160  */
0161 #define MPI_DOORBELL_OFFSET                 (0x00000000)
0162 #define MPI_DOORBELL_ACTIVE                 (0x08000000) /* DoorbellUsed */
0163 #define MPI_DOORBELL_USED                   (MPI_DOORBELL_ACTIVE)
0164 #define MPI_DOORBELL_ACTIVE_SHIFT           (27)
0165 #define MPI_DOORBELL_WHO_INIT_MASK          (0x07000000)
0166 #define MPI_DOORBELL_WHO_INIT_SHIFT         (24)
0167 #define MPI_DOORBELL_FUNCTION_MASK          (0xFF000000)
0168 #define MPI_DOORBELL_FUNCTION_SHIFT         (24)
0169 #define MPI_DOORBELL_ADD_DWORDS_MASK        (0x00FF0000)
0170 #define MPI_DOORBELL_ADD_DWORDS_SHIFT       (16)
0171 #define MPI_DOORBELL_DATA_MASK              (0x0000FFFF)
0172 #define MPI_DOORBELL_FUNCTION_SPECIFIC_MASK (0x0000FFFF)
0173 
0174 /* values for Host Buffer Access Control doorbell function */
0175 #define MPI_DB_HPBAC_VALUE_MASK             (0x0000F000)
0176 #define MPI_DB_HPBAC_ENABLE_ACCESS          (0x01)
0177 #define MPI_DB_HPBAC_DISABLE_ACCESS         (0x02)
0178 #define MPI_DB_HPBAC_FREE_BUFFER            (0x03)
0179 
0180 
0181 #define MPI_WRITE_SEQUENCE_OFFSET           (0x00000004)
0182 #define MPI_WRSEQ_KEY_VALUE_MASK            (0x0000000F)
0183 #define MPI_WRSEQ_1ST_KEY_VALUE             (0x04)
0184 #define MPI_WRSEQ_2ND_KEY_VALUE             (0x0B)
0185 #define MPI_WRSEQ_3RD_KEY_VALUE             (0x02)
0186 #define MPI_WRSEQ_4TH_KEY_VALUE             (0x07)
0187 #define MPI_WRSEQ_5TH_KEY_VALUE             (0x0D)
0188 
0189 #define MPI_DIAGNOSTIC_OFFSET               (0x00000008)
0190 #define MPI_DIAG_CLEAR_FLASH_BAD_SIG        (0x00000400)
0191 #define MPI_DIAG_PREVENT_IOC_BOOT           (0x00000200)
0192 #define MPI_DIAG_DRWE                       (0x00000080)
0193 #define MPI_DIAG_FLASH_BAD_SIG              (0x00000040)
0194 #define MPI_DIAG_RESET_HISTORY              (0x00000020)
0195 #define MPI_DIAG_RW_ENABLE                  (0x00000010)
0196 #define MPI_DIAG_RESET_ADAPTER              (0x00000004)
0197 #define MPI_DIAG_DISABLE_ARM                (0x00000002)
0198 #define MPI_DIAG_MEM_ENABLE                 (0x00000001)
0199 
0200 #define MPI_TEST_BASE_ADDRESS_OFFSET        (0x0000000C)
0201 
0202 #define MPI_DIAG_RW_DATA_OFFSET             (0x00000010)
0203 
0204 #define MPI_DIAG_RW_ADDRESS_OFFSET          (0x00000014)
0205 
0206 #define MPI_HOST_INTERRUPT_STATUS_OFFSET    (0x00000030)
0207 #define MPI_HIS_IOP_DOORBELL_STATUS         (0x80000000)
0208 #define MPI_HIS_REPLY_MESSAGE_INTERRUPT     (0x00000008)
0209 #define MPI_HIS_DOORBELL_INTERRUPT          (0x00000001)
0210 
0211 #define MPI_HOST_INTERRUPT_MASK_OFFSET      (0x00000034)
0212 #define MPI_HIM_RIM                         (0x00000008)
0213 #define MPI_HIM_DIM                         (0x00000001)
0214 
0215 #define MPI_REQUEST_QUEUE_OFFSET            (0x00000040)
0216 #define MPI_REQUEST_POST_FIFO_OFFSET        (0x00000040)
0217 
0218 #define MPI_REPLY_QUEUE_OFFSET              (0x00000044)
0219 #define MPI_REPLY_POST_FIFO_OFFSET          (0x00000044)
0220 #define MPI_REPLY_FREE_FIFO_OFFSET          (0x00000044)
0221 
0222 #define MPI_HI_PRI_REQUEST_QUEUE_OFFSET     (0x00000048)
0223 
0224 
0225 
0226 /*****************************************************************************
0227 *
0228 *        M e s s a g e    F r a m e    D e s c r i p t o r s
0229 *
0230 *****************************************************************************/
0231 
0232 #define MPI_REQ_MF_DESCRIPTOR_NB_MASK       (0x00000003)
0233 #define MPI_REQ_MF_DESCRIPTOR_F_BIT         (0x00000004)
0234 #define MPI_REQ_MF_DESCRIPTOR_ADDRESS_MASK  (0xFFFFFFF8)
0235 
0236 #define MPI_ADDRESS_REPLY_A_BIT             (0x80000000)
0237 #define MPI_ADDRESS_REPLY_ADDRESS_MASK      (0x7FFFFFFF)
0238 
0239 #define MPI_CONTEXT_REPLY_A_BIT             (0x80000000)
0240 #define MPI_CONTEXT_REPLY_TYPE_MASK         (0x60000000)
0241 #define MPI_CONTEXT_REPLY_TYPE_SCSI_INIT    (0x00)
0242 #define MPI_CONTEXT_REPLY_TYPE_SCSI_TARGET  (0x01)
0243 #define MPI_CONTEXT_REPLY_TYPE_LAN          (0x02)
0244 #define MPI_CONTEXT_REPLY_TYPE_SHIFT        (29)
0245 #define MPI_CONTEXT_REPLY_CONTEXT_MASK      (0x1FFFFFFF)
0246 
0247 
0248 /****************************************************************************/
0249 /* Context Reply macros                                                     */
0250 /****************************************************************************/
0251 
0252 #define MPI_GET_CONTEXT_REPLY_TYPE(x)  (((x) & MPI_CONTEXT_REPLY_TYPE_MASK) \
0253                                           >> MPI_CONTEXT_REPLY_TYPE_SHIFT)
0254 
0255 #define MPI_SET_CONTEXT_REPLY_TYPE(x, typ)                                  \
0256             ((x) = ((x) & ~MPI_CONTEXT_REPLY_TYPE_MASK) |                   \
0257                             (((typ) << MPI_CONTEXT_REPLY_TYPE_SHIFT) &      \
0258                                         MPI_CONTEXT_REPLY_TYPE_MASK))
0259 
0260 
0261 /*****************************************************************************
0262 *
0263 *        M e s s a g e    F u n c t i o n s
0264 *              0x80 -> 0x8F reserved for private message use per product
0265 *
0266 *
0267 *****************************************************************************/
0268 
0269 #define MPI_FUNCTION_SCSI_IO_REQUEST                (0x00)
0270 #define MPI_FUNCTION_SCSI_TASK_MGMT                 (0x01)
0271 #define MPI_FUNCTION_IOC_INIT                       (0x02)
0272 #define MPI_FUNCTION_IOC_FACTS                      (0x03)
0273 #define MPI_FUNCTION_CONFIG                         (0x04)
0274 #define MPI_FUNCTION_PORT_FACTS                     (0x05)
0275 #define MPI_FUNCTION_PORT_ENABLE                    (0x06)
0276 #define MPI_FUNCTION_EVENT_NOTIFICATION             (0x07)
0277 #define MPI_FUNCTION_EVENT_ACK                      (0x08)
0278 #define MPI_FUNCTION_FW_DOWNLOAD                    (0x09)
0279 #define MPI_FUNCTION_TARGET_CMD_BUFFER_POST         (0x0A)
0280 #define MPI_FUNCTION_TARGET_ASSIST                  (0x0B)
0281 #define MPI_FUNCTION_TARGET_STATUS_SEND             (0x0C)
0282 #define MPI_FUNCTION_TARGET_MODE_ABORT              (0x0D)
0283 #define MPI_FUNCTION_FC_LINK_SRVC_BUF_POST          (0x0E)
0284 #define MPI_FUNCTION_FC_LINK_SRVC_RSP               (0x0F)
0285 #define MPI_FUNCTION_FC_EX_LINK_SRVC_SEND           (0x10)
0286 #define MPI_FUNCTION_FC_ABORT                       (0x11)
0287 #define MPI_FUNCTION_FW_UPLOAD                      (0x12)
0288 #define MPI_FUNCTION_FC_COMMON_TRANSPORT_SEND       (0x13)
0289 #define MPI_FUNCTION_FC_PRIMITIVE_SEND              (0x14)
0290 
0291 #define MPI_FUNCTION_RAID_ACTION                    (0x15)
0292 #define MPI_FUNCTION_RAID_SCSI_IO_PASSTHROUGH       (0x16)
0293 
0294 #define MPI_FUNCTION_TOOLBOX                        (0x17)
0295 
0296 #define MPI_FUNCTION_SCSI_ENCLOSURE_PROCESSOR       (0x18)
0297 
0298 #define MPI_FUNCTION_MAILBOX                        (0x19)
0299 
0300 #define MPI_FUNCTION_SMP_PASSTHROUGH                (0x1A)
0301 #define MPI_FUNCTION_SAS_IO_UNIT_CONTROL            (0x1B)
0302 #define MPI_FUNCTION_SATA_PASSTHROUGH               (0x1C)
0303 
0304 #define MPI_FUNCTION_DIAG_BUFFER_POST               (0x1D)
0305 #define MPI_FUNCTION_DIAG_RELEASE                   (0x1E)
0306 
0307 #define MPI_FUNCTION_SCSI_IO_32                     (0x1F)
0308 
0309 #define MPI_FUNCTION_LAN_SEND                       (0x20)
0310 #define MPI_FUNCTION_LAN_RECEIVE                    (0x21)
0311 #define MPI_FUNCTION_LAN_RESET                      (0x22)
0312 
0313 #define MPI_FUNCTION_TARGET_ASSIST_EXTENDED         (0x23)
0314 #define MPI_FUNCTION_TARGET_CMD_BUF_BASE_POST       (0x24)
0315 #define MPI_FUNCTION_TARGET_CMD_BUF_LIST_POST       (0x25)
0316 
0317 #define MPI_FUNCTION_INBAND_BUFFER_POST             (0x28)
0318 #define MPI_FUNCTION_INBAND_SEND                    (0x29)
0319 #define MPI_FUNCTION_INBAND_RSP                     (0x2A)
0320 #define MPI_FUNCTION_INBAND_ABORT                   (0x2B)
0321 
0322 #define MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET         (0x40)
0323 #define MPI_FUNCTION_IO_UNIT_RESET                  (0x41)
0324 #define MPI_FUNCTION_HANDSHAKE                      (0x42)
0325 #define MPI_FUNCTION_REPLY_FRAME_REMOVAL            (0x43)
0326 #define MPI_FUNCTION_HOST_PAGEBUF_ACCESS_CONTROL    (0x44)
0327 
0328 
0329 /* standard version format */
0330 typedef struct _MPI_VERSION_STRUCT
0331 {
0332     U8                      Dev;                        /* 00h */
0333     U8                      Unit;                       /* 01h */
0334     U8                      Minor;                      /* 02h */
0335     U8                      Major;                      /* 03h */
0336 } MPI_VERSION_STRUCT, MPI_POINTER PTR_MPI_VERSION_STRUCT,
0337   MpiVersionStruct_t, MPI_POINTER pMpiVersionStruct;
0338 
0339 typedef union _MPI_VERSION_FORMAT
0340 {
0341     MPI_VERSION_STRUCT      Struct;
0342     U32                     Word;
0343 } MPI_VERSION_FORMAT, MPI_POINTER PTR_MPI_VERSION_FORMAT,
0344   MpiVersionFormat_t, MPI_POINTER pMpiVersionFormat_t;
0345 
0346 
0347 /*****************************************************************************
0348 *
0349 *        S c a t t e r    G a t h e r    E l e m e n t s
0350 *
0351 *****************************************************************************/
0352 
0353 /****************************************************************************/
0354 /*  Simple element structures                                               */
0355 /****************************************************************************/
0356 
0357 typedef struct _SGE_SIMPLE32
0358 {
0359     U32                     FlagsLength;
0360     U32                     Address;
0361 } SGE_SIMPLE32, MPI_POINTER PTR_SGE_SIMPLE32,
0362   SGESimple32_t, MPI_POINTER pSGESimple32_t;
0363 
0364 typedef struct _SGE_SIMPLE64
0365 {
0366     U32                     FlagsLength;
0367     U64                     Address;
0368 } SGE_SIMPLE64, MPI_POINTER PTR_SGE_SIMPLE64,
0369   SGESimple64_t, MPI_POINTER pSGESimple64_t;
0370 
0371 typedef struct _SGE_SIMPLE_UNION
0372 {
0373     U32                     FlagsLength;
0374     union
0375     {
0376         U32                 Address32;
0377         U64                 Address64;
0378     }u;
0379 } SGE_SIMPLE_UNION, MPI_POINTER PTR_SGE_SIMPLE_UNION,
0380   SGESimpleUnion_t, MPI_POINTER pSGESimpleUnion_t;
0381 
0382 /****************************************************************************/
0383 /*  Chain element structures                                                */
0384 /****************************************************************************/
0385 
0386 typedef struct _SGE_CHAIN32
0387 {
0388     U16                     Length;
0389     U8                      NextChainOffset;
0390     U8                      Flags;
0391     U32                     Address;
0392 } SGE_CHAIN32, MPI_POINTER PTR_SGE_CHAIN32,
0393   SGEChain32_t, MPI_POINTER pSGEChain32_t;
0394 
0395 typedef struct _SGE_CHAIN64
0396 {
0397     U16                     Length;
0398     U8                      NextChainOffset;
0399     U8                      Flags;
0400     U64                     Address;
0401 } SGE_CHAIN64, MPI_POINTER PTR_SGE_CHAIN64,
0402   SGEChain64_t, MPI_POINTER pSGEChain64_t;
0403 
0404 typedef struct _SGE_CHAIN_UNION
0405 {
0406     U16                     Length;
0407     U8                      NextChainOffset;
0408     U8                      Flags;
0409     union
0410     {
0411         U32                 Address32;
0412         U64                 Address64;
0413     }u;
0414 } SGE_CHAIN_UNION, MPI_POINTER PTR_SGE_CHAIN_UNION,
0415   SGEChainUnion_t, MPI_POINTER pSGEChainUnion_t;
0416 
0417 /****************************************************************************/
0418 /*  Transaction Context element                                             */
0419 /****************************************************************************/
0420 
0421 typedef struct _SGE_TRANSACTION32
0422 {
0423     U8                      Reserved;
0424     U8                      ContextSize;
0425     U8                      DetailsLength;
0426     U8                      Flags;
0427     U32                     TransactionContext;
0428     U32                     TransactionDetails[];
0429 } SGE_TRANSACTION32, MPI_POINTER PTR_SGE_TRANSACTION32,
0430   SGETransaction32_t, MPI_POINTER pSGETransaction32_t;
0431 
0432 typedef struct _SGE_TRANSACTION64
0433 {
0434     U8                      Reserved;
0435     U8                      ContextSize;
0436     U8                      DetailsLength;
0437     U8                      Flags;
0438     U32                     TransactionContext[2];
0439     U32                     TransactionDetails[1];
0440 } SGE_TRANSACTION64, MPI_POINTER PTR_SGE_TRANSACTION64,
0441   SGETransaction64_t, MPI_POINTER pSGETransaction64_t;
0442 
0443 typedef struct _SGE_TRANSACTION96
0444 {
0445     U8                      Reserved;
0446     U8                      ContextSize;
0447     U8                      DetailsLength;
0448     U8                      Flags;
0449     U32                     TransactionContext[3];
0450     U32                     TransactionDetails[1];
0451 } SGE_TRANSACTION96, MPI_POINTER PTR_SGE_TRANSACTION96,
0452   SGETransaction96_t, MPI_POINTER pSGETransaction96_t;
0453 
0454 typedef struct _SGE_TRANSACTION128
0455 {
0456     U8                      Reserved;
0457     U8                      ContextSize;
0458     U8                      DetailsLength;
0459     U8                      Flags;
0460     U32                     TransactionContext[4];
0461     U32                     TransactionDetails[1];
0462 } SGE_TRANSACTION128, MPI_POINTER PTR_SGE_TRANSACTION128,
0463   SGETransaction_t128, MPI_POINTER pSGETransaction_t128;
0464 
0465 typedef struct _SGE_TRANSACTION_UNION
0466 {
0467     U8                      Reserved;
0468     U8                      ContextSize;
0469     U8                      DetailsLength;
0470     U8                      Flags;
0471     union
0472     {
0473         U32                 TransactionContext32[1];
0474         U32                 TransactionContext64[2];
0475         U32                 TransactionContext96[3];
0476         U32                 TransactionContext128[4];
0477     }u;
0478     U32                     TransactionDetails[1];
0479 } SGE_TRANSACTION_UNION, MPI_POINTER PTR_SGE_TRANSACTION_UNION,
0480   SGETransactionUnion_t, MPI_POINTER pSGETransactionUnion_t;
0481 
0482 
0483 /****************************************************************************/
0484 /*  SGE IO types union  for IO SGL's                                        */
0485 /****************************************************************************/
0486 
0487 typedef struct _SGE_IO_UNION
0488 {
0489     union
0490     {
0491         SGE_SIMPLE_UNION    Simple;
0492         SGE_CHAIN_UNION     Chain;
0493     } u;
0494 } SGE_IO_UNION, MPI_POINTER PTR_SGE_IO_UNION,
0495   SGEIOUnion_t, MPI_POINTER pSGEIOUnion_t;
0496 
0497 /****************************************************************************/
0498 /*  SGE union for SGL's with Simple and Transaction elements                */
0499 /****************************************************************************/
0500 
0501 typedef struct _SGE_TRANS_SIMPLE_UNION
0502 {
0503     union
0504     {
0505         SGE_SIMPLE_UNION        Simple;
0506         SGE_TRANSACTION_UNION   Transaction;
0507     } u;
0508 } SGE_TRANS_SIMPLE_UNION, MPI_POINTER PTR_SGE_TRANS_SIMPLE_UNION,
0509   SGETransSimpleUnion_t, MPI_POINTER pSGETransSimpleUnion_t;
0510 
0511 /****************************************************************************/
0512 /*  All SGE types union                                                     */
0513 /****************************************************************************/
0514 
0515 typedef struct _SGE_MPI_UNION
0516 {
0517     union
0518     {
0519         SGE_SIMPLE_UNION        Simple;
0520         SGE_CHAIN_UNION         Chain;
0521         SGE_TRANSACTION_UNION   Transaction;
0522     } u;
0523 } SGE_MPI_UNION, MPI_POINTER PTR_SGE_MPI_UNION,
0524   MPI_SGE_UNION_t, MPI_POINTER pMPI_SGE_UNION_t,
0525   SGEAllUnion_t, MPI_POINTER pSGEAllUnion_t;
0526 
0527 
0528 /****************************************************************************/
0529 /*  SGE field definition and masks                                          */
0530 /****************************************************************************/
0531 
0532 /* Flags field bit definitions */
0533 
0534 #define MPI_SGE_FLAGS_LAST_ELEMENT              (0x80)
0535 #define MPI_SGE_FLAGS_END_OF_BUFFER             (0x40)
0536 #define MPI_SGE_FLAGS_ELEMENT_TYPE_MASK         (0x30)
0537 #define MPI_SGE_FLAGS_LOCAL_ADDRESS             (0x08)
0538 #define MPI_SGE_FLAGS_DIRECTION                 (0x04)
0539 #define MPI_SGE_FLAGS_ADDRESS_SIZE              (0x02)
0540 #define MPI_SGE_FLAGS_END_OF_LIST               (0x01)
0541 
0542 #define MPI_SGE_FLAGS_SHIFT                     (24)
0543 
0544 #define MPI_SGE_LENGTH_MASK                     (0x00FFFFFF)
0545 #define MPI_SGE_CHAIN_LENGTH_MASK               (0x0000FFFF)
0546 
0547 /* Element Type */
0548 
0549 #define MPI_SGE_FLAGS_TRANSACTION_ELEMENT       (0x00)
0550 #define MPI_SGE_FLAGS_SIMPLE_ELEMENT            (0x10)
0551 #define MPI_SGE_FLAGS_CHAIN_ELEMENT             (0x30)
0552 #define MPI_SGE_FLAGS_ELEMENT_MASK              (0x30)
0553 
0554 /* Address location */
0555 
0556 #define MPI_SGE_FLAGS_SYSTEM_ADDRESS            (0x00)
0557 
0558 /* Direction */
0559 
0560 #define MPI_SGE_FLAGS_IOC_TO_HOST               (0x00)
0561 #define MPI_SGE_FLAGS_HOST_TO_IOC               (0x04)
0562 
0563 /* Address Size */
0564 
0565 #define MPI_SGE_FLAGS_32_BIT_ADDRESSING         (0x00)
0566 #define MPI_SGE_FLAGS_64_BIT_ADDRESSING         (0x02)
0567 
0568 /* Context Size */
0569 
0570 #define MPI_SGE_FLAGS_32_BIT_CONTEXT            (0x00)
0571 #define MPI_SGE_FLAGS_64_BIT_CONTEXT            (0x02)
0572 #define MPI_SGE_FLAGS_96_BIT_CONTEXT            (0x04)
0573 #define MPI_SGE_FLAGS_128_BIT_CONTEXT           (0x06)
0574 
0575 #define MPI_SGE_CHAIN_OFFSET_MASK               (0x00FF0000)
0576 #define MPI_SGE_CHAIN_OFFSET_SHIFT              (16)
0577 
0578 
0579 /****************************************************************************/
0580 /*  SGE operation Macros                                                    */
0581 /****************************************************************************/
0582 
0583          /* SIMPLE FlagsLength manipulations... */
0584 #define  MPI_SGE_SET_FLAGS(f)           ((U32)(f) << MPI_SGE_FLAGS_SHIFT)
0585 #define  MPI_SGE_GET_FLAGS(fl)          (((fl) & ~MPI_SGE_LENGTH_MASK) >> MPI_SGE_FLAGS_SHIFT)
0586 #define  MPI_SGE_LENGTH(fl)             ((fl) & MPI_SGE_LENGTH_MASK)
0587 #define  MPI_SGE_CHAIN_LENGTH(fl)       ((fl) & MPI_SGE_CHAIN_LENGTH_MASK)
0588 
0589 #define  MPI_SGE_SET_FLAGS_LENGTH(f,l)  (MPI_SGE_SET_FLAGS(f) | MPI_SGE_LENGTH(l))
0590 
0591 #define  MPI_pSGE_GET_FLAGS(psg)        MPI_SGE_GET_FLAGS((psg)->FlagsLength)
0592 #define  MPI_pSGE_GET_LENGTH(psg)       MPI_SGE_LENGTH((psg)->FlagsLength)
0593 #define  MPI_pSGE_SET_FLAGS_LENGTH(psg,f,l)  (psg)->FlagsLength = MPI_SGE_SET_FLAGS_LENGTH(f,l)
0594          /* CAUTION - The following are READ-MODIFY-WRITE! */
0595 #define  MPI_pSGE_SET_FLAGS(psg,f)      (psg)->FlagsLength |= MPI_SGE_SET_FLAGS(f)
0596 #define  MPI_pSGE_SET_LENGTH(psg,l)     (psg)->FlagsLength |= MPI_SGE_LENGTH(l)
0597 
0598 #define  MPI_GET_CHAIN_OFFSET(x) ((x&MPI_SGE_CHAIN_OFFSET_MASK)>>MPI_SGE_CHAIN_OFFSET_SHIFT)
0599 
0600 
0601 
0602 /*****************************************************************************
0603 *
0604 *        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
0605 *
0606 *****************************************************************************/
0607 
0608 /****************************************************************************/
0609 /* Standard message request header for all request messages                 */
0610 /****************************************************************************/
0611 
0612 typedef struct _MSG_REQUEST_HEADER
0613 {
0614     U8                      Reserved[2];      /* function specific */
0615     U8                      ChainOffset;
0616     U8                      Function;
0617     U8                      Reserved1[3];     /* function specific */
0618     U8                      MsgFlags;
0619     U32                     MsgContext;
0620 } MSG_REQUEST_HEADER, MPI_POINTER PTR_MSG_REQUEST_HEADER,
0621   MPIHeader_t, MPI_POINTER pMPIHeader_t;
0622 
0623 
0624 /****************************************************************************/
0625 /*  Default Reply                                                           */
0626 /****************************************************************************/
0627 
0628 typedef struct _MSG_DEFAULT_REPLY
0629 {
0630     U8                      Reserved[2];      /* function specific */
0631     U8                      MsgLength;
0632     U8                      Function;
0633     U8                      Reserved1[3];     /* function specific */
0634     U8                      MsgFlags;
0635     U32                     MsgContext;
0636     U8                      Reserved2[2];     /* function specific */
0637     U16                     IOCStatus;
0638     U32                     IOCLogInfo;
0639 } MSG_DEFAULT_REPLY, MPI_POINTER PTR_MSG_DEFAULT_REPLY,
0640   MPIDefaultReply_t, MPI_POINTER pMPIDefaultReply_t;
0641 
0642 
0643 /* MsgFlags definition for all replies */
0644 
0645 #define MPI_MSGFLAGS_CONTINUATION_REPLY         (0x80)
0646 
0647 
0648 /*****************************************************************************
0649 *
0650 *               I O C    S t a t u s   V a l u e s
0651 *
0652 *****************************************************************************/
0653 
0654 /****************************************************************************/
0655 /*  Common IOCStatus values for all replies                                 */
0656 /****************************************************************************/
0657 
0658 #define MPI_IOCSTATUS_SUCCESS                   (0x0000)
0659 #define MPI_IOCSTATUS_INVALID_FUNCTION          (0x0001)
0660 #define MPI_IOCSTATUS_BUSY                      (0x0002)
0661 #define MPI_IOCSTATUS_INVALID_SGL               (0x0003)
0662 #define MPI_IOCSTATUS_INTERNAL_ERROR            (0x0004)
0663 #define MPI_IOCSTATUS_RESERVED                  (0x0005)
0664 #define MPI_IOCSTATUS_INSUFFICIENT_RESOURCES    (0x0006)
0665 #define MPI_IOCSTATUS_INVALID_FIELD             (0x0007)
0666 #define MPI_IOCSTATUS_INVALID_STATE             (0x0008)
0667 #define MPI_IOCSTATUS_OP_STATE_NOT_SUPPORTED    (0x0009)
0668 
0669 /****************************************************************************/
0670 /*  Config IOCStatus values                                                 */
0671 /****************************************************************************/
0672 
0673 #define MPI_IOCSTATUS_CONFIG_INVALID_ACTION     (0x0020)
0674 #define MPI_IOCSTATUS_CONFIG_INVALID_TYPE       (0x0021)
0675 #define MPI_IOCSTATUS_CONFIG_INVALID_PAGE       (0x0022)
0676 #define MPI_IOCSTATUS_CONFIG_INVALID_DATA       (0x0023)
0677 #define MPI_IOCSTATUS_CONFIG_NO_DEFAULTS        (0x0024)
0678 #define MPI_IOCSTATUS_CONFIG_CANT_COMMIT        (0x0025)
0679 
0680 /****************************************************************************/
0681 /*  SCSIIO Reply (SPI & FCP) initiator values                               */
0682 /****************************************************************************/
0683 
0684 #define MPI_IOCSTATUS_SCSI_RECOVERED_ERROR      (0x0040)
0685 #define MPI_IOCSTATUS_SCSI_INVALID_BUS          (0x0041)
0686 #define MPI_IOCSTATUS_SCSI_INVALID_TARGETID     (0x0042)
0687 #define MPI_IOCSTATUS_SCSI_DEVICE_NOT_THERE     (0x0043)
0688 #define MPI_IOCSTATUS_SCSI_DATA_OVERRUN         (0x0044)
0689 #define MPI_IOCSTATUS_SCSI_DATA_UNDERRUN        (0x0045)
0690 #define MPI_IOCSTATUS_SCSI_IO_DATA_ERROR        (0x0046)
0691 #define MPI_IOCSTATUS_SCSI_PROTOCOL_ERROR       (0x0047)
0692 #define MPI_IOCSTATUS_SCSI_TASK_TERMINATED      (0x0048)
0693 #define MPI_IOCSTATUS_SCSI_RESIDUAL_MISMATCH    (0x0049)
0694 #define MPI_IOCSTATUS_SCSI_TASK_MGMT_FAILED     (0x004A)
0695 #define MPI_IOCSTATUS_SCSI_IOC_TERMINATED       (0x004B)
0696 #define MPI_IOCSTATUS_SCSI_EXT_TERMINATED       (0x004C)
0697 
0698 /****************************************************************************/
0699 /*  For use by SCSI Initiator and SCSI Target end-to-end data protection    */
0700 /****************************************************************************/
0701 
0702 #define MPI_IOCSTATUS_EEDP_GUARD_ERROR          (0x004D)
0703 #define MPI_IOCSTATUS_EEDP_REF_TAG_ERROR        (0x004E)
0704 #define MPI_IOCSTATUS_EEDP_APP_TAG_ERROR        (0x004F)
0705 
0706 
0707 /****************************************************************************/
0708 /*  SCSI Target values                                                      */
0709 /****************************************************************************/
0710 
0711 #define MPI_IOCSTATUS_TARGET_PRIORITY_IO         (0x0060)
0712 #define MPI_IOCSTATUS_TARGET_INVALID_PORT        (0x0061)
0713 #define MPI_IOCSTATUS_TARGET_INVALID_IOCINDEX    (0x0062)   /* obsolete name */
0714 #define MPI_IOCSTATUS_TARGET_INVALID_IO_INDEX    (0x0062)
0715 #define MPI_IOCSTATUS_TARGET_ABORTED             (0x0063)
0716 #define MPI_IOCSTATUS_TARGET_NO_CONN_RETRYABLE   (0x0064)
0717 #define MPI_IOCSTATUS_TARGET_NO_CONNECTION       (0x0065)
0718 #define MPI_IOCSTATUS_TARGET_XFER_COUNT_MISMATCH (0x006A)
0719 #define MPI_IOCSTATUS_TARGET_STS_DATA_NOT_SENT   (0x006B)
0720 #define MPI_IOCSTATUS_TARGET_DATA_OFFSET_ERROR   (0x006D)
0721 #define MPI_IOCSTATUS_TARGET_TOO_MUCH_WRITE_DATA (0x006E)
0722 #define MPI_IOCSTATUS_TARGET_IU_TOO_SHORT        (0x006F)
0723 #define MPI_IOCSTATUS_TARGET_ACK_NAK_TIMEOUT     (0x0070)
0724 #define MPI_IOCSTATUS_TARGET_NAK_RECEIVED        (0x0071)
0725 
0726 /****************************************************************************/
0727 /*  Additional FCP target values (obsolete)                                 */
0728 /****************************************************************************/
0729 
0730 #define MPI_IOCSTATUS_TARGET_FC_ABORTED         (0x0066)    /* obsolete */
0731 #define MPI_IOCSTATUS_TARGET_FC_RX_ID_INVALID   (0x0067)    /* obsolete */
0732 #define MPI_IOCSTATUS_TARGET_FC_DID_INVALID     (0x0068)    /* obsolete */
0733 #define MPI_IOCSTATUS_TARGET_FC_NODE_LOGGED_OUT (0x0069)    /* obsolete */
0734 
0735 /****************************************************************************/
0736 /*  Fibre Channel Direct Access values                                      */
0737 /****************************************************************************/
0738 
0739 #define MPI_IOCSTATUS_FC_ABORTED                (0x0066)
0740 #define MPI_IOCSTATUS_FC_RX_ID_INVALID          (0x0067)
0741 #define MPI_IOCSTATUS_FC_DID_INVALID            (0x0068)
0742 #define MPI_IOCSTATUS_FC_NODE_LOGGED_OUT        (0x0069)
0743 #define MPI_IOCSTATUS_FC_EXCHANGE_CANCELED      (0x006C)
0744 
0745 /****************************************************************************/
0746 /*  LAN values                                                              */
0747 /****************************************************************************/
0748 
0749 #define MPI_IOCSTATUS_LAN_DEVICE_NOT_FOUND      (0x0080)
0750 #define MPI_IOCSTATUS_LAN_DEVICE_FAILURE        (0x0081)
0751 #define MPI_IOCSTATUS_LAN_TRANSMIT_ERROR        (0x0082)
0752 #define MPI_IOCSTATUS_LAN_TRANSMIT_ABORTED      (0x0083)
0753 #define MPI_IOCSTATUS_LAN_RECEIVE_ERROR         (0x0084)
0754 #define MPI_IOCSTATUS_LAN_RECEIVE_ABORTED       (0x0085)
0755 #define MPI_IOCSTATUS_LAN_PARTIAL_PACKET        (0x0086)
0756 #define MPI_IOCSTATUS_LAN_CANCELED              (0x0087)
0757 
0758 /****************************************************************************/
0759 /*  Serial Attached SCSI values                                             */
0760 /****************************************************************************/
0761 
0762 #define MPI_IOCSTATUS_SAS_SMP_REQUEST_FAILED    (0x0090)
0763 #define MPI_IOCSTATUS_SAS_SMP_DATA_OVERRUN      (0x0091)
0764 
0765 /****************************************************************************/
0766 /*  Inband values                                                           */
0767 /****************************************************************************/
0768 
0769 #define MPI_IOCSTATUS_INBAND_ABORTED            (0x0098)
0770 #define MPI_IOCSTATUS_INBAND_NO_CONNECTION      (0x0099)
0771 
0772 /****************************************************************************/
0773 /*  Diagnostic Tools values                                                 */
0774 /****************************************************************************/
0775 
0776 #define MPI_IOCSTATUS_DIAGNOSTIC_RELEASED       (0x00A0)
0777 
0778 
0779 /****************************************************************************/
0780 /*  IOCStatus flag to indicate that log info is available                   */
0781 /****************************************************************************/
0782 
0783 #define MPI_IOCSTATUS_FLAG_LOG_INFO_AVAILABLE   (0x8000)
0784 #define MPI_IOCSTATUS_MASK                      (0x7FFF)
0785 
0786 /****************************************************************************/
0787 /*  LogInfo Types                                                           */
0788 /****************************************************************************/
0789 
0790 #define MPI_IOCLOGINFO_TYPE_MASK                (0xF0000000)
0791 #define MPI_IOCLOGINFO_TYPE_SHIFT               (28)
0792 #define MPI_IOCLOGINFO_TYPE_NONE                (0x0)
0793 #define MPI_IOCLOGINFO_TYPE_SCSI                (0x1)
0794 #define MPI_IOCLOGINFO_TYPE_FC                  (0x2)
0795 #define MPI_IOCLOGINFO_TYPE_SAS                 (0x3)
0796 #define MPI_IOCLOGINFO_TYPE_ISCSI               (0x4)
0797 #define MPI_IOCLOGINFO_LOG_DATA_MASK            (0x0FFFFFFF)
0798 
0799 
0800 #endif