1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 3*0Sstevel@tonic-gate * Use is subject to license terms. 4*0Sstevel@tonic-gate */ 5*0Sstevel@tonic-gate 6*0Sstevel@tonic-gate #ifndef _SYS_MPI_H 7*0Sstevel@tonic-gate #define _SYS_MPI_H 8*0Sstevel@tonic-gate 9*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 10*0Sstevel@tonic-gate 11*0Sstevel@tonic-gate #ifdef __cplusplus 12*0Sstevel@tonic-gate extern "C" { 13*0Sstevel@tonic-gate #endif 14*0Sstevel@tonic-gate 15*0Sstevel@tonic-gate /* 16*0Sstevel@tonic-gate * This header file is based on Version 1.2 of the MPT 17*0Sstevel@tonic-gate * Specification by LSI Logic, Inc. 18*0Sstevel@tonic-gate */ 19*0Sstevel@tonic-gate 20*0Sstevel@tonic-gate /* 21*0Sstevel@tonic-gate * MPI Version Definitions 22*0Sstevel@tonic-gate */ 23*0Sstevel@tonic-gate #define MPI_VERSION_MAJOR (0x01) 24*0Sstevel@tonic-gate #define MPI_VERSION_MINOR (0x05) 25*0Sstevel@tonic-gate #define MPI_VERSION_MAJOR_MASK (0xFF00) 26*0Sstevel@tonic-gate #define MPI_VERSION_MAJOR_SHIFT (8) 27*0Sstevel@tonic-gate #define MPI_VERSION_MINOR_MASK (0x00FF) 28*0Sstevel@tonic-gate #define MPI_VERSION_MINOR_SHIFT (0) 29*0Sstevel@tonic-gate #define MPI_VERSION ((MPI_VERSION_MAJOR << MPI_VERSION_MAJOR_SHIFT) | \ 30*0Sstevel@tonic-gate MPI_VERSION_MINOR) 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate #define MPI_HEADER_VERSION_UNIT (0x00) 33*0Sstevel@tonic-gate #define MPI_HEADER_VERSION_DEV (0x00) 34*0Sstevel@tonic-gate #define MPI_HEADER_VERSION_UNIT_MASK (0xFF00) 35*0Sstevel@tonic-gate #define MPI_HEADER_VERSION_UNIT_SHIFT (8) 36*0Sstevel@tonic-gate #define MPI_HEADER_VERSION_DEV_MASK (0x00FF) 37*0Sstevel@tonic-gate #define MPI_HEADER_VERSION_DEV_SHIFT (0) 38*0Sstevel@tonic-gate #define MPI_HEADER_VERSION ((MPI_HEADER_VERSION_UNIT << 8) | \ 39*0Sstevel@tonic-gate MPI_HEADER_VERSION_DEV) 40*0Sstevel@tonic-gate /* Note: The major versions of 0xe0 through 0xff are reserved */ 41*0Sstevel@tonic-gate 42*0Sstevel@tonic-gate /* 43*0Sstevel@tonic-gate * IOC State Definitions 44*0Sstevel@tonic-gate */ 45*0Sstevel@tonic-gate #define MPI_IOC_STATE_RESET 0x00000000 46*0Sstevel@tonic-gate #define MPI_IOC_STATE_READY 0x10000000 47*0Sstevel@tonic-gate #define MPI_IOC_STATE_OPERATIONAL 0x20000000 48*0Sstevel@tonic-gate #define MPI_IOC_STATE_FAULT 0x40000000 49*0Sstevel@tonic-gate 50*0Sstevel@tonic-gate #define MPI_IOC_STATE_MASK 0xF0000000 51*0Sstevel@tonic-gate #define MPI_IOC_STATE_SHIFT 28 52*0Sstevel@tonic-gate 53*0Sstevel@tonic-gate /* 54*0Sstevel@tonic-gate * Fault state codes (product independent range 0x8000-0xFFFF) 55*0Sstevel@tonic-gate */ 56*0Sstevel@tonic-gate #define MPI_FAULT_REQUEST_MESSAGE_PCI_PARITY_ERROR 0x8111 57*0Sstevel@tonic-gate #define MPI_FAULT_REQUEST_MESSAGE_PCI_BUS_FAULT 0x8112 58*0Sstevel@tonic-gate #define MPI_FAULT_REPLY_MESSAGE_PCI_PARITY_ERROR 0x8113 59*0Sstevel@tonic-gate #define MPI_FAULT_REPLY_MESSAGE_PCI_BUS_FAULT 0x8114 60*0Sstevel@tonic-gate #define MPI_FAULT_DATA_SEND_PCI_PARITY_ERROR 0x8115 61*0Sstevel@tonic-gate #define MPI_FAULT_DATA_SEND_PCI_BUS_FAULT 0x8116 62*0Sstevel@tonic-gate #define MPI_FAULT_DATA_RECEIVE_PCI_PARITY_ERROR 0x8117 63*0Sstevel@tonic-gate #define MPI_FAULT_DATA_RECEIVE_PCI_BUS_FAULT 0x8118 64*0Sstevel@tonic-gate 65*0Sstevel@tonic-gate 66*0Sstevel@tonic-gate /* 67*0Sstevel@tonic-gate * System Doorbell 68*0Sstevel@tonic-gate */ 69*0Sstevel@tonic-gate #define MPI_DOORBELL_OFFSET 0x00000000 70*0Sstevel@tonic-gate #define MPI_DOORBELL_ACTIVE 0x08000000 71*0Sstevel@tonic-gate #define MPI_DOORBELL_USED MPI_DOORBELL_ACTIVE 72*0Sstevel@tonic-gate #define MPI_DOORBELL_ACTIVE_SHIFT 27 73*0Sstevel@tonic-gate #define MPI_DOORBELL_WHO_INIT_MASK 0x07000000 74*0Sstevel@tonic-gate #define MPI_DOORBELL_WHO_INIT_SHIFT 24 75*0Sstevel@tonic-gate #define MPI_DOORBELL_FUNCTION_MASK 0xFF000000 76*0Sstevel@tonic-gate #define MPI_DOORBELL_FUNCTION_SHIFT 24 77*0Sstevel@tonic-gate #define MPI_DOORBELL_ADD_DWORDS_MASK 0x00FF0000 78*0Sstevel@tonic-gate #define MPI_DOORBELL_ADD_DWORDS_SHIFT 16 79*0Sstevel@tonic-gate #define MPI_DOORBELL_DATA_MASK 0x0000FFFF 80*0Sstevel@tonic-gate 81*0Sstevel@tonic-gate 82*0Sstevel@tonic-gate /* 83*0Sstevel@tonic-gate * PCI System Interface Registers 84*0Sstevel@tonic-gate */ 85*0Sstevel@tonic-gate #define MPI_WRITE_SEQUENCE_OFFSET 0x00000004 86*0Sstevel@tonic-gate #define MPI_WRSEQ_KEY_VALUE_MASK 0x0000000F 87*0Sstevel@tonic-gate #define MPI_WRSEQ_1ST_KEY_VALUE 0x04 88*0Sstevel@tonic-gate #define MPI_WRSEQ_2ND_KEY_VALUE 0x0B 89*0Sstevel@tonic-gate #define MPI_WRSEQ_3RD_KEY_VALUE 0x02 90*0Sstevel@tonic-gate #define MPI_WRSEQ_4TH_KEY_VALUE 0x07 91*0Sstevel@tonic-gate #define MPI_WRSEQ_5TH_KEY_VALUE 0x0D 92*0Sstevel@tonic-gate 93*0Sstevel@tonic-gate #define MPI_DIAGNOSTIC_OFFSET 0x00000008 94*0Sstevel@tonic-gate #define MPI_DIAG_CLEAR_FLASH_BAD_SIG 0x00000400 95*0Sstevel@tonic-gate #define MPI_DIAG_PREVENT_IOC_BOOT 0x00000200 96*0Sstevel@tonic-gate #define MPI_DIAG_DRWE 0x00000080 97*0Sstevel@tonic-gate #define MPI_DIAG_FLASH_BAD_SIG 0x00000040 98*0Sstevel@tonic-gate #define MPI_DIAG_RESET_HISTORY 0x00000020 99*0Sstevel@tonic-gate #define MPI_DIAG_RW_ENABLE 0x00000010 100*0Sstevel@tonic-gate #define MPI_DIAG_RESET_ADAPTER 0x00000004 101*0Sstevel@tonic-gate #define MPI_DIAG_DISABLE_ARM 0x00000002 102*0Sstevel@tonic-gate #define MPI_DIAG_MEM_ENABLE 0x00000001 103*0Sstevel@tonic-gate 104*0Sstevel@tonic-gate #define MPI_TEST_BASE_ADDRESS_OFFSET 0x0000000C 105*0Sstevel@tonic-gate 106*0Sstevel@tonic-gate #define MPI_DIAG_RW_DATA_OFFSET 0x00000010 107*0Sstevel@tonic-gate 108*0Sstevel@tonic-gate #define MPI_DIAG_RW_ADDRESS_OFFSET 0x00000014 109*0Sstevel@tonic-gate 110*0Sstevel@tonic-gate #define MPI_HOST_INTERRUPT_STATUS_OFFSET 0x00000030 111*0Sstevel@tonic-gate #define MPI_HIS_IOP_DOORBELL_STATUS 0x80000000 112*0Sstevel@tonic-gate #define MPI_HIS_REPLY_MESSAGE_INTERRUPT 0x00000008 113*0Sstevel@tonic-gate #define MPI_HIS_DOORBELL_INTERRUPT 0x00000001 114*0Sstevel@tonic-gate 115*0Sstevel@tonic-gate #define MPI_HOST_INTERRUPT_MASK_OFFSET 0x00000034 116*0Sstevel@tonic-gate #define MPI_HIM_RIM 0x00000008 117*0Sstevel@tonic-gate #define MPI_HIM_DIM 0x00000001 118*0Sstevel@tonic-gate 119*0Sstevel@tonic-gate #define MPI_REQUEST_QUEUE_OFFSET 0x00000040 120*0Sstevel@tonic-gate #define MPI_REQUEST_POST_FIFO_OFFSET 0x00000040 121*0Sstevel@tonic-gate 122*0Sstevel@tonic-gate #define MPI_REPLY_QUEUE_OFFSET 0x00000044 123*0Sstevel@tonic-gate #define MPI_REPLY_POST_FIFO_OFFSET 0x00000044 124*0Sstevel@tonic-gate #define MPI_REPLY_FREE_FIFO_OFFSET 0x00000044 125*0Sstevel@tonic-gate 126*0Sstevel@tonic-gate #define MPI_HI_PRI_REQUEST_QUEUE_OFFSET 0x00000048 127*0Sstevel@tonic-gate 128*0Sstevel@tonic-gate /* 129*0Sstevel@tonic-gate * Message Frame Descriptors 130*0Sstevel@tonic-gate */ 131*0Sstevel@tonic-gate #define MPI_REQ_MF_DESCRIPTOR_NB_MASK 0x00000003 132*0Sstevel@tonic-gate #define MPI_REQ_MF_DESCRIPTOR_F_BIT 0x00000004 133*0Sstevel@tonic-gate #define MPI_REQ_MF_DESCRIPTOR_ADDRESS_MASK 0xFFFFFFF8 134*0Sstevel@tonic-gate 135*0Sstevel@tonic-gate #define MPI_ADDRESS_REPLY_A_BIT 0x80000000 136*0Sstevel@tonic-gate #define MPI_ADDRESS_REPLY_ADDRESS_MASK 0x7FFFFFFF 137*0Sstevel@tonic-gate 138*0Sstevel@tonic-gate #define MPI_CONTEXT_REPLY_A_BIT 0x80000000 139*0Sstevel@tonic-gate #define MPI_CONTEXT_REPLY_TYPE_MASK 0x60000000 140*0Sstevel@tonic-gate #define MPI_CONTEXT_REPLY_TYPE_SCSI_INIT 0x00 141*0Sstevel@tonic-gate #define MPI_CONTEXT_REPLY_TYPE_SCSI_TARGET 0x01 142*0Sstevel@tonic-gate #define MPI_CONTEXT_REPLY_TYPE_LAN 0x02 143*0Sstevel@tonic-gate #define MPI_CONTEXT_REPLY_TYPE_SHIFT 29 144*0Sstevel@tonic-gate #define MPI_CONTEXT_REPLY_CONTEXT_MASK 0x1FFFFFFF 145*0Sstevel@tonic-gate 146*0Sstevel@tonic-gate 147*0Sstevel@tonic-gate /* 148*0Sstevel@tonic-gate * Context Reply macros 149*0Sstevel@tonic-gate */ 150*0Sstevel@tonic-gate #define MPI_GET_CONTEXT_REPLY_TYPE(x) \ 151*0Sstevel@tonic-gate (((x) & MPI_CONTEXT_REPLY_TYPE_MASK) \ 152*0Sstevel@tonic-gate >> MPI_CONTEXT_REPLY_TYPE_SHIFT) 153*0Sstevel@tonic-gate 154*0Sstevel@tonic-gate #define MPI_SET_CONTEXT_REPLY_TYPE(x, typ) \ 155*0Sstevel@tonic-gate ((x) = ((x) & ~MPI_CONTEXT_REPLY_TYPE_MASK) | \ 156*0Sstevel@tonic-gate (((typ) << MPI_CONTEXT_REPLY_TYPE_SHIFT) & \ 157*0Sstevel@tonic-gate MPI_CONTEXT_REPLY_TYPE_MASK)) 158*0Sstevel@tonic-gate 159*0Sstevel@tonic-gate 160*0Sstevel@tonic-gate /* 161*0Sstevel@tonic-gate * Message Functions 162*0Sstevel@tonic-gate * 0x80 -> 0x8F reserved for private message use per product 163*0Sstevel@tonic-gate */ 164*0Sstevel@tonic-gate #define MPI_FUNCTION_SCSI_IO_REQUEST 0x00 165*0Sstevel@tonic-gate #define MPI_FUNCTION_SCSI_TASK_MGMT 0x01 166*0Sstevel@tonic-gate #define MPI_FUNCTION_IOC_INIT 0x02 167*0Sstevel@tonic-gate #define MPI_FUNCTION_IOC_FACTS 0x03 168*0Sstevel@tonic-gate #define MPI_FUNCTION_CONFIG 0x04 169*0Sstevel@tonic-gate #define MPI_FUNCTION_PORT_FACTS 0x05 170*0Sstevel@tonic-gate #define MPI_FUNCTION_PORT_ENABLE 0x06 171*0Sstevel@tonic-gate #define MPI_FUNCTION_EVENT_NOTIFICATION 0x07 172*0Sstevel@tonic-gate #define MPI_FUNCTION_EVENT_ACK 0x08 173*0Sstevel@tonic-gate #define MPI_FUNCTION_FW_DOWNLOAD 0x09 174*0Sstevel@tonic-gate #define MPI_FUNCTION_TARGET_CMD_BUFFER_POST 0x0A 175*0Sstevel@tonic-gate #define MPI_FUNCTION_TARGET_ASSIST 0x0B 176*0Sstevel@tonic-gate #define MPI_FUNCTION_TARGET_STATUS_SEND 0x0C 177*0Sstevel@tonic-gate #define MPI_FUNCTION_TARGET_MODE_ABORT 0x0D 178*0Sstevel@tonic-gate #define MPI_FUNCTION_FC_LINK_SRVC_BUF_POST 0x0E 179*0Sstevel@tonic-gate #define MPI_FUNCTION_FC_LINK_SRVC_RSP 0x0F 180*0Sstevel@tonic-gate #define MPI_FUNCTION_FC_EX_LINK_SRVC_SEND 0x10 181*0Sstevel@tonic-gate #define MPI_FUNCTION_FC_ABORT 0x11 182*0Sstevel@tonic-gate #define MPI_FUNCTION_FW_UPLOAD 0x12 183*0Sstevel@tonic-gate #define MPI_FUNCTION_FC_COMMON_TRANSPORT_SEND 0x13 184*0Sstevel@tonic-gate #define MPI_FUNCTION_FC_PRIMITIVE_SEND 0x14 185*0Sstevel@tonic-gate 186*0Sstevel@tonic-gate #define MPI_FUNCTION_RAID_ACTION 0x15 187*0Sstevel@tonic-gate #define MPI_FUNCTION_RAID_SCSI_IO_PASSTHROUGH 0x16 188*0Sstevel@tonic-gate 189*0Sstevel@tonic-gate #define MPI_FUNCTION_TOOLBOX 0x17 190*0Sstevel@tonic-gate 191*0Sstevel@tonic-gate #define MPI_FUNCTION_SCSI_ENCLOSURE_PROCESSOR 0x18 192*0Sstevel@tonic-gate 193*0Sstevel@tonic-gate #define MPI_FUNCTION_MAILBOX 0x19 194*0Sstevel@tonic-gate 195*0Sstevel@tonic-gate #define MPI_FUNCTION_SMP_PASSTHROUGH 0x1A 196*0Sstevel@tonic-gate #define MPI_FUNCTION_SAS_IO_UNIT_CONTROL 0x1B 197*0Sstevel@tonic-gate 198*0Sstevel@tonic-gate #define MPI_DIAG_BUFFER_POST 0x1D 199*0Sstevel@tonic-gate #define MPI_DIAG_RELEASE 0x1E 200*0Sstevel@tonic-gate 201*0Sstevel@tonic-gate #define MPI_FUNCTION_SCSI_IO_32 0x1F 202*0Sstevel@tonic-gate 203*0Sstevel@tonic-gate #define MPI_FUNCTION_LAN_SEND 0x20 204*0Sstevel@tonic-gate #define MPI_FUNCTION_LAN_RECEIVE 0x21 205*0Sstevel@tonic-gate #define MPI_FUNCTION_LAN_RESET 0x22 206*0Sstevel@tonic-gate 207*0Sstevel@tonic-gate #define MPI_FUNCTION_INBAND_BUFFER_POST 0x28 208*0Sstevel@tonic-gate #define MPI_FUNCTION_INBAND_SEND 0x29 209*0Sstevel@tonic-gate #define MPI_FUNCTION_INBAND_RSP 0x2A 210*0Sstevel@tonic-gate #define MPI_FUNCTION_INBAND_ABORT 0x2B 211*0Sstevel@tonic-gate 212*0Sstevel@tonic-gate #define MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET 0x40 213*0Sstevel@tonic-gate #define MPI_FUNCTION_IO_UNIT_RESET 0x41 214*0Sstevel@tonic-gate #define MPI_FUNCTION_HANDSHAKE 0x42 215*0Sstevel@tonic-gate #define MPI_FUNCTION_REPLY_FRAME_REMOVAL 0x43 216*0Sstevel@tonic-gate #define MPI_FUNCTION_HOST_PAGEBUF_ACCESS_CONTROL 0x44 217*0Sstevel@tonic-gate 218*0Sstevel@tonic-gate /* 219*0Sstevel@tonic-gate * Version format 220*0Sstevel@tonic-gate */ 221*0Sstevel@tonic-gate typedef struct mpi_version_struct { 222*0Sstevel@tonic-gate uint8_t Dev; 223*0Sstevel@tonic-gate uint8_t Unit; 224*0Sstevel@tonic-gate uint8_t Minor; 225*0Sstevel@tonic-gate uint8_t Major; 226*0Sstevel@tonic-gate } mpi_version_struct_t; 227*0Sstevel@tonic-gate 228*0Sstevel@tonic-gate typedef union mpi_version_format { 229*0Sstevel@tonic-gate mpi_version_struct_t Struct; 230*0Sstevel@tonic-gate uint32_t Word; 231*0Sstevel@tonic-gate } mpi_version_format_t; 232*0Sstevel@tonic-gate 233*0Sstevel@tonic-gate /* 234*0Sstevel@tonic-gate * Scatter Gather Elements 235*0Sstevel@tonic-gate */ 236*0Sstevel@tonic-gate 237*0Sstevel@tonic-gate /* 238*0Sstevel@tonic-gate * Simple element structures 239*0Sstevel@tonic-gate */ 240*0Sstevel@tonic-gate typedef struct sge_simple32 { 241*0Sstevel@tonic-gate uint32_t FlagsLength; 242*0Sstevel@tonic-gate uint32_t Address; 243*0Sstevel@tonic-gate } sge_simple32_t; 244*0Sstevel@tonic-gate 245*0Sstevel@tonic-gate typedef struct sge_simple64 { 246*0Sstevel@tonic-gate uint32_t FlagsLength; 247*0Sstevel@tonic-gate uint32_t Address_Low; 248*0Sstevel@tonic-gate uint32_t Address_High; 249*0Sstevel@tonic-gate } sge_simple64_t; 250*0Sstevel@tonic-gate 251*0Sstevel@tonic-gate typedef struct sge_simple_union { 252*0Sstevel@tonic-gate uint32_t FlagsLength; 253*0Sstevel@tonic-gate union { 254*0Sstevel@tonic-gate uint32_t Address32; 255*0Sstevel@tonic-gate uint32_t Address64_Low; 256*0Sstevel@tonic-gate uint32_t Address64_High; 257*0Sstevel@tonic-gate } u1; 258*0Sstevel@tonic-gate } sge_simple_union_t; 259*0Sstevel@tonic-gate 260*0Sstevel@tonic-gate /* 261*0Sstevel@tonic-gate * Chain element structures 262*0Sstevel@tonic-gate */ 263*0Sstevel@tonic-gate typedef struct sge_chain32 { 264*0Sstevel@tonic-gate uint16_t Length; 265*0Sstevel@tonic-gate uint8_t NextChainOffset; 266*0Sstevel@tonic-gate uint8_t Flags; 267*0Sstevel@tonic-gate uint32_t Address; 268*0Sstevel@tonic-gate } sge_chain32_t; 269*0Sstevel@tonic-gate 270*0Sstevel@tonic-gate typedef struct sge_chain64 { 271*0Sstevel@tonic-gate uint16_t Length; 272*0Sstevel@tonic-gate uint8_t NextChainOffset; 273*0Sstevel@tonic-gate uint8_t Flags; 274*0Sstevel@tonic-gate uint32_t Address64_Low; 275*0Sstevel@tonic-gate uint32_t Address64_High; 276*0Sstevel@tonic-gate } sge_chain64_t; 277*0Sstevel@tonic-gate 278*0Sstevel@tonic-gate typedef struct sge_chain_union { 279*0Sstevel@tonic-gate uint16_t Length; 280*0Sstevel@tonic-gate uint8_t NextChainOffset; 281*0Sstevel@tonic-gate uint8_t Flags; 282*0Sstevel@tonic-gate union { 283*0Sstevel@tonic-gate uint32_t Address32; 284*0Sstevel@tonic-gate uint32_t Address64_Low; 285*0Sstevel@tonic-gate uint32_t Address64_High; 286*0Sstevel@tonic-gate } u1; 287*0Sstevel@tonic-gate } sge_chain_union_t; 288*0Sstevel@tonic-gate 289*0Sstevel@tonic-gate /* 290*0Sstevel@tonic-gate * Transaction Context element 291*0Sstevel@tonic-gate */ 292*0Sstevel@tonic-gate typedef struct sge_transaction32 { 293*0Sstevel@tonic-gate uint8_t Reserved; 294*0Sstevel@tonic-gate uint8_t ContextSize; 295*0Sstevel@tonic-gate uint8_t DetailsLength; 296*0Sstevel@tonic-gate uint8_t Flags; 297*0Sstevel@tonic-gate uint32_t TransactionContext[1]; 298*0Sstevel@tonic-gate uint32_t TransactionDetails[1]; 299*0Sstevel@tonic-gate } sge_transaction32_t; 300*0Sstevel@tonic-gate 301*0Sstevel@tonic-gate typedef struct sge_transaction64 { 302*0Sstevel@tonic-gate uint8_t Reserved; 303*0Sstevel@tonic-gate uint8_t ContextSize; 304*0Sstevel@tonic-gate uint8_t DetailsLength; 305*0Sstevel@tonic-gate uint8_t Flags; 306*0Sstevel@tonic-gate uint32_t TransactionContext[2]; 307*0Sstevel@tonic-gate uint32_t TransactionDetails[1]; 308*0Sstevel@tonic-gate } sge_transaction64_t; 309*0Sstevel@tonic-gate 310*0Sstevel@tonic-gate typedef struct sge_transaction96 { 311*0Sstevel@tonic-gate uint8_t Reserved; 312*0Sstevel@tonic-gate uint8_t ContextSize; 313*0Sstevel@tonic-gate uint8_t DetailsLength; 314*0Sstevel@tonic-gate uint8_t Flags; 315*0Sstevel@tonic-gate uint32_t TransactionContext[3]; 316*0Sstevel@tonic-gate uint32_t TransactionDetails[1]; 317*0Sstevel@tonic-gate } sge_transaction96_t; 318*0Sstevel@tonic-gate 319*0Sstevel@tonic-gate typedef struct sge_transaction128 { 320*0Sstevel@tonic-gate uint8_t Reserved; 321*0Sstevel@tonic-gate uint8_t ContextSize; 322*0Sstevel@tonic-gate uint8_t DetailsLength; 323*0Sstevel@tonic-gate uint8_t Flags; 324*0Sstevel@tonic-gate uint32_t TransactionContext[4]; 325*0Sstevel@tonic-gate uint32_t TransactionDetails[1]; 326*0Sstevel@tonic-gate } sge_transaction128_t; 327*0Sstevel@tonic-gate 328*0Sstevel@tonic-gate typedef struct sge_transaction_union { 329*0Sstevel@tonic-gate uint8_t Reserved; 330*0Sstevel@tonic-gate uint8_t ContextSize; 331*0Sstevel@tonic-gate uint8_t DetailsLength; 332*0Sstevel@tonic-gate uint8_t Flags; 333*0Sstevel@tonic-gate union { 334*0Sstevel@tonic-gate uint32_t TransactionContext32[1]; 335*0Sstevel@tonic-gate uint32_t TransactionContext64[2]; 336*0Sstevel@tonic-gate uint32_t TransactionContext96[3]; 337*0Sstevel@tonic-gate uint32_t TransactionContext128[4]; 338*0Sstevel@tonic-gate } u1; 339*0Sstevel@tonic-gate uint32_t TransactionDetails[1]; 340*0Sstevel@tonic-gate } sge_transaction_union_t; 341*0Sstevel@tonic-gate 342*0Sstevel@tonic-gate 343*0Sstevel@tonic-gate /* 344*0Sstevel@tonic-gate * SGE IO types union for IO SGL's 345*0Sstevel@tonic-gate */ 346*0Sstevel@tonic-gate typedef struct sge_io_union { 347*0Sstevel@tonic-gate union { 348*0Sstevel@tonic-gate sge_simple_union_t Simple; 349*0Sstevel@tonic-gate sge_chain_union_t Chain; 350*0Sstevel@tonic-gate } u1; 351*0Sstevel@tonic-gate } sge_io_union_t; 352*0Sstevel@tonic-gate 353*0Sstevel@tonic-gate /* 354*0Sstevel@tonic-gate * SGE union for SGL's with Simple and Transaction elements 355*0Sstevel@tonic-gate */ 356*0Sstevel@tonic-gate typedef struct sge_trans_simple_union { 357*0Sstevel@tonic-gate union { 358*0Sstevel@tonic-gate sge_simple_union_t Simple; 359*0Sstevel@tonic-gate sge_transaction_union_t Transaction; 360*0Sstevel@tonic-gate } u1; 361*0Sstevel@tonic-gate } sge_trans_simple_union_t; 362*0Sstevel@tonic-gate 363*0Sstevel@tonic-gate /* 364*0Sstevel@tonic-gate * All SGE types union 365*0Sstevel@tonic-gate */ 366*0Sstevel@tonic-gate typedef struct sge_mpi_union { 367*0Sstevel@tonic-gate union { 368*0Sstevel@tonic-gate sge_simple_union_t Simple; 369*0Sstevel@tonic-gate sge_chain_union_t Chain; 370*0Sstevel@tonic-gate sge_transaction_union_t Transaction; 371*0Sstevel@tonic-gate } u1; 372*0Sstevel@tonic-gate } sge_mpi_union_t; 373*0Sstevel@tonic-gate 374*0Sstevel@tonic-gate 375*0Sstevel@tonic-gate /* 376*0Sstevel@tonic-gate * SGE field definition and masks 377*0Sstevel@tonic-gate */ 378*0Sstevel@tonic-gate 379*0Sstevel@tonic-gate /* 380*0Sstevel@tonic-gate * Flags field bit definitions 381*0Sstevel@tonic-gate */ 382*0Sstevel@tonic-gate #define MPI_SGE_FLAGS_LAST_ELEMENT 0x80 383*0Sstevel@tonic-gate #define MPI_SGE_FLAGS_END_OF_BUFFER 0x40 384*0Sstevel@tonic-gate #define MPI_SGE_FLAGS_ELEMENT_TYPE_MASK 0x30 385*0Sstevel@tonic-gate #define MPI_SGE_FLAGS_LOCAL_ADDRESS 0x08 386*0Sstevel@tonic-gate #define MPI_SGE_FLAGS_DIRECTION 0x04 387*0Sstevel@tonic-gate #define MPI_SGE_FLAGS_ADDRESS_SIZE 0x02 388*0Sstevel@tonic-gate #define MPI_SGE_FLAGS_END_OF_LIST 0x01 389*0Sstevel@tonic-gate 390*0Sstevel@tonic-gate #define MPI_SGE_FLAGS_SHIFT 24 391*0Sstevel@tonic-gate 392*0Sstevel@tonic-gate #define MPI_SGE_LENGTH_MASK 0x00FFFFFF 393*0Sstevel@tonic-gate #define MPI_SGE_CHAIN_LENGTH_MASK 0x0000FFFF 394*0Sstevel@tonic-gate 395*0Sstevel@tonic-gate /* 396*0Sstevel@tonic-gate * Element Type 397*0Sstevel@tonic-gate */ 398*0Sstevel@tonic-gate #define MPI_SGE_FLAGS_TRANSACTION_ELEMENT 0x00 399*0Sstevel@tonic-gate #define MPI_SGE_FLAGS_SIMPLE_ELEMENT 0x10 400*0Sstevel@tonic-gate #define MPI_SGE_FLAGS_CHAIN_ELEMENT 0x30 401*0Sstevel@tonic-gate #define MPI_SGE_FLAGS_ELEMENT_MASK 0x30 402*0Sstevel@tonic-gate 403*0Sstevel@tonic-gate /* 404*0Sstevel@tonic-gate * Address location 405*0Sstevel@tonic-gate */ 406*0Sstevel@tonic-gate #define MPI_SGE_FLAGS_SYSTEM_ADDRESS 0x00 407*0Sstevel@tonic-gate 408*0Sstevel@tonic-gate /* 409*0Sstevel@tonic-gate * Direction 410*0Sstevel@tonic-gate */ 411*0Sstevel@tonic-gate #define MPI_SGE_FLAGS_IOC_TO_HOST 0x00 412*0Sstevel@tonic-gate #define MPI_SGE_FLAGS_HOST_TO_IOC 0x04 413*0Sstevel@tonic-gate 414*0Sstevel@tonic-gate /* 415*0Sstevel@tonic-gate * Address Size 416*0Sstevel@tonic-gate */ 417*0Sstevel@tonic-gate #define MPI_SGE_FLAGS_32_BIT_ADDRESSING 0x00 418*0Sstevel@tonic-gate #define MPI_SGE_FLAGS_64_BIT_ADDRESSING 0x02 419*0Sstevel@tonic-gate 420*0Sstevel@tonic-gate /* 421*0Sstevel@tonic-gate * Context Size 422*0Sstevel@tonic-gate */ 423*0Sstevel@tonic-gate #define MPI_SGE_FLAGS_32_BIT_CONTEXT 0x00 424*0Sstevel@tonic-gate #define MPI_SGE_FLAGS_64_BIT_CONTEXT 0x02 425*0Sstevel@tonic-gate #define MPI_SGE_FLAGS_96_BIT_CONTEXT 0x04 426*0Sstevel@tonic-gate #define MPI_SGE_FLAGS_128_BIT_CONTEXT 0x06 427*0Sstevel@tonic-gate 428*0Sstevel@tonic-gate #define MPI_SGE_CHAIN_OFFSET_MASK 0x00FF0000 429*0Sstevel@tonic-gate #define MPI_SGE_CHAIN_OFFSET_SHIFT 16 430*0Sstevel@tonic-gate 431*0Sstevel@tonic-gate 432*0Sstevel@tonic-gate /* 433*0Sstevel@tonic-gate * SGE operation Macros 434*0Sstevel@tonic-gate */ 435*0Sstevel@tonic-gate 436*0Sstevel@tonic-gate /* 437*0Sstevel@tonic-gate * SIMPLE FlagsLength manipulations... 438*0Sstevel@tonic-gate */ 439*0Sstevel@tonic-gate #define MPI_SGE_SET_FLAGS(f) ((uint32_t)(f) << MPI_SGE_FLAGS_SHIFT) 440*0Sstevel@tonic-gate #define MPI_SGE_GET_FLAGS(fl) \ 441*0Sstevel@tonic-gate (((fl) & ~MPI_SGE_LENGTH_MASK) >> MPI_SGE_FLAGS_SHIFT) 442*0Sstevel@tonic-gate #define MPI_SGE_LENGTH(fl) ((fl) & MPI_SGE_LENGTH_MASK) 443*0Sstevel@tonic-gate #define MPI_SGE_CHAIN_LENGTH(fl) ((fl) & MPI_SGE_CHAIN_LENGTH_MASK) 444*0Sstevel@tonic-gate 445*0Sstevel@tonic-gate #define MPI_SGE_SET_FLAGS_LENGTH(f, l) \ 446*0Sstevel@tonic-gate (MPI_SGE_SET_FLAGS(f) | MPI_SGE_LENGTH(l)) 447*0Sstevel@tonic-gate 448*0Sstevel@tonic-gate #define MPI_pSGE_GET_FLAGS(psg) MPI_SGE_GET_FLAGS((psg)->FlagsLength) 449*0Sstevel@tonic-gate #define MPI_pSGE_GET_LENGTH(psg) MPI_SGE_LENGTH((psg)->FlagsLength) 450*0Sstevel@tonic-gate #define MPI_pSGE_SET_FLAGS_LENGTH(psg, f, l) \ 451*0Sstevel@tonic-gate (psg)->FlagsLength = MPI_SGE_SET_FLAGS_LENGTH(f, l) 452*0Sstevel@tonic-gate 453*0Sstevel@tonic-gate /* 454*0Sstevel@tonic-gate * CAUTION - The following are READ-MODIFY-WRITE! 455*0Sstevel@tonic-gate */ 456*0Sstevel@tonic-gate #define MPI_pSGE_SET_FLAGS(psg, f) \ 457*0Sstevel@tonic-gate (psg)->FlagsLength |= MPI_SGE_SET_FLAGS(f) 458*0Sstevel@tonic-gate #define MPI_pSGE_SET_LENGTH(psg, l) \ 459*0Sstevel@tonic-gate (psg)->FlagsLength |= MPI_SGE_LENGTH(l) 460*0Sstevel@tonic-gate 461*0Sstevel@tonic-gate #define MPI_GET_CHAIN_OFFSET(x) \ 462*0Sstevel@tonic-gate ((x&MPI_SGE_CHAIN_OFFSET_MASK)>>MPI_SGE_CHAIN_OFFSET_SHIFT) 463*0Sstevel@tonic-gate 464*0Sstevel@tonic-gate 465*0Sstevel@tonic-gate /* 466*0Sstevel@tonic-gate * Standard Message Structures 467*0Sstevel@tonic-gate */ 468*0Sstevel@tonic-gate 469*0Sstevel@tonic-gate /* 470*0Sstevel@tonic-gate * Standard message request header for all request messages 471*0Sstevel@tonic-gate */ 472*0Sstevel@tonic-gate typedef struct msg_request_header { 473*0Sstevel@tonic-gate uint8_t Reserved[2]; /* function specific */ 474*0Sstevel@tonic-gate uint8_t ChainOffset; 475*0Sstevel@tonic-gate uint8_t Function; 476*0Sstevel@tonic-gate uint8_t Reserved1[3]; /* function specific */ 477*0Sstevel@tonic-gate uint8_t MsgFlags; 478*0Sstevel@tonic-gate uint32_t MsgContext; 479*0Sstevel@tonic-gate } msg_request_header_t; 480*0Sstevel@tonic-gate 481*0Sstevel@tonic-gate 482*0Sstevel@tonic-gate /* 483*0Sstevel@tonic-gate * Default Reply 484*0Sstevel@tonic-gate */ 485*0Sstevel@tonic-gate typedef struct msg_default_reply { 486*0Sstevel@tonic-gate uint8_t Reserved[2]; /* function specific */ 487*0Sstevel@tonic-gate uint8_t MsgLength; 488*0Sstevel@tonic-gate uint8_t Function; 489*0Sstevel@tonic-gate uint8_t Reserved1[3]; /* function specific */ 490*0Sstevel@tonic-gate uint8_t MsgFlags; 491*0Sstevel@tonic-gate uint32_t MsgContext; 492*0Sstevel@tonic-gate uint8_t Reserved2[2]; /* function specific */ 493*0Sstevel@tonic-gate uint16_t IOCStatus; 494*0Sstevel@tonic-gate uint32_t IOCLogInfo; 495*0Sstevel@tonic-gate } msg_default_reply_t; 496*0Sstevel@tonic-gate 497*0Sstevel@tonic-gate /* 498*0Sstevel@tonic-gate * MsgFlags definition for all replies 499*0Sstevel@tonic-gate */ 500*0Sstevel@tonic-gate #define MPI_MSGFLAGS_CONTINUATION_REPLY 0x80 501*0Sstevel@tonic-gate 502*0Sstevel@tonic-gate 503*0Sstevel@tonic-gate /* 504*0Sstevel@tonic-gate * IOC Status Values 505*0Sstevel@tonic-gate */ 506*0Sstevel@tonic-gate 507*0Sstevel@tonic-gate /* 508*0Sstevel@tonic-gate * Common IOCStatus values for all replies 509*0Sstevel@tonic-gate */ 510*0Sstevel@tonic-gate #define MPI_IOCSTATUS_SUCCESS 0x0000 511*0Sstevel@tonic-gate #define MPI_IOCSTATUS_INVALID_FUNCTION 0x0001 512*0Sstevel@tonic-gate #define MPI_IOCSTATUS_BUSY 0x0002 513*0Sstevel@tonic-gate #define MPI_IOCSTATUS_INVALID_SGL 0x0003 514*0Sstevel@tonic-gate #define MPI_IOCSTATUS_INTERNAL_ERROR 0x0004 515*0Sstevel@tonic-gate #define MPI_IOCSTATUS_RESERVED 0x0005 516*0Sstevel@tonic-gate #define MPI_IOCSTATUS_INSUFFICIENT_RESOURCES 0x0006 517*0Sstevel@tonic-gate #define MPI_IOCSTATUS_INVALID_FIELD 0x0007 518*0Sstevel@tonic-gate #define MPI_IOCSTATUS_INVALID_STATE 0x0008 519*0Sstevel@tonic-gate #define MPI_IOCSTATUS_OP_STATE_NOT_SUPPORTED 0x0009 520*0Sstevel@tonic-gate 521*0Sstevel@tonic-gate /* 522*0Sstevel@tonic-gate * Config IOCStatus values 523*0Sstevel@tonic-gate */ 524*0Sstevel@tonic-gate #define MPI_IOCSTATUS_CONFIG_INVALID_ACTION 0x0020 525*0Sstevel@tonic-gate #define MPI_IOCSTATUS_CONFIG_INVALID_TYPE 0x0021 526*0Sstevel@tonic-gate #define MPI_IOCSTATUS_CONFIG_INVALID_PAGE 0x0022 527*0Sstevel@tonic-gate #define MPI_IOCSTATUS_CONFIG_INVALID_DATA 0x0023 528*0Sstevel@tonic-gate #define MPI_IOCSTATUS_CONFIG_NO_DEFAULTS 0x0024 529*0Sstevel@tonic-gate #define MPI_IOCSTATUS_CONFIG_CANT_COMMIT 0x0025 530*0Sstevel@tonic-gate 531*0Sstevel@tonic-gate /* 532*0Sstevel@tonic-gate * SCSIIO Reply (SPI & FCP) initiator values 533*0Sstevel@tonic-gate */ 534*0Sstevel@tonic-gate #define MPI_IOCSTATUS_SCSI_RECOVERED_ERROR 0x0040 535*0Sstevel@tonic-gate #define MPI_IOCSTATUS_SCSI_INVALID_BUS 0x0041 536*0Sstevel@tonic-gate #define MPI_IOCSTATUS_SCSI_INVALID_TARGETID 0x0042 537*0Sstevel@tonic-gate #define MPI_IOCSTATUS_SCSI_DEVICE_NOT_THERE 0x0043 538*0Sstevel@tonic-gate #define MPI_IOCSTATUS_SCSI_DATA_OVERRUN 0x0044 539*0Sstevel@tonic-gate #define MPI_IOCSTATUS_SCSI_DATA_UNDERRUN 0x0045 540*0Sstevel@tonic-gate #define MPI_IOCSTATUS_SCSI_IO_DATA_ERROR 0x0046 541*0Sstevel@tonic-gate #define MPI_IOCSTATUS_SCSI_PROTOCOL_ERROR 0x0047 542*0Sstevel@tonic-gate #define MPI_IOCSTATUS_SCSI_TASK_TERMINATED 0x0048 543*0Sstevel@tonic-gate #define MPI_IOCSTATUS_SCSI_RESIDUAL_MISMATCH 0x0049 544*0Sstevel@tonic-gate #define MPI_IOCSTATUS_SCSI_TASK_MGMT_FAILED 0x004A 545*0Sstevel@tonic-gate #define MPI_IOCSTATUS_SCSI_IOC_TERMINATED 0x004B 546*0Sstevel@tonic-gate #define MPI_IOCSTATUS_SCSI_EXT_TERMINATED 0x004C 547*0Sstevel@tonic-gate 548*0Sstevel@tonic-gate /* 549*0Sstevel@tonic-gate * SCSI Initiator/Target end-to-end data protection 550*0Sstevel@tonic-gate */ 551*0Sstevel@tonic-gate #define MPI_IOCSTATUS_EEDP_CRC_ERROR 0x004D 552*0Sstevel@tonic-gate #define MPI_IOCSTATUS_EEDP_LBA_TAG_ERROR 0x004E 553*0Sstevel@tonic-gate #define MPI_IOCSTATUS_EEDP_APP_TAG_ERROR 0x004F 554*0Sstevel@tonic-gate /* 555*0Sstevel@tonic-gate * SCSI (SPI & FCP) target values 556*0Sstevel@tonic-gate */ 557*0Sstevel@tonic-gate #define MPI_IOCSTATUS_TARGET_PRIORITY_IO 0x0060 558*0Sstevel@tonic-gate #define MPI_IOCSTATUS_TARGET_INVALID_PORT 0x0061 559*0Sstevel@tonic-gate #define MPI_IOCSTATUS_TARGET_INVALID_IOCINDEX 0x0062 560*0Sstevel@tonic-gate #define MPI_IOCSTATUS_TARGET_ABORTED 0x0063 561*0Sstevel@tonic-gate #define MPI_IOCSTATUS_TARGET_NO_CONN_RETRYABLE 0x0064 562*0Sstevel@tonic-gate #define MPI_IOCSTATUS_TARGET_NO_CONNECTION 0x0065 563*0Sstevel@tonic-gate #define MPI_IOCSTATUS_TARGET_XFER_COUNT_MISMATCH 0x006A 564*0Sstevel@tonic-gate #define MPI_IOCSTATUS_TARGET_STS_DATA_NOT_SENT 0x006B 565*0Sstevel@tonic-gate 566*0Sstevel@tonic-gate /* 567*0Sstevel@tonic-gate * Additional FCP target values 568*0Sstevel@tonic-gate */ 569*0Sstevel@tonic-gate #define MPI_IOCSTATUS_TARGET_FC_ABORTED 0x0066 /* obsolete */ 570*0Sstevel@tonic-gate #define MPI_IOCSTATUS_TARGET_FC_RX_ID_INVALID 0x0067 /* obsolete */ 571*0Sstevel@tonic-gate #define MPI_IOCSTATUS_TARGET_FC_DID_INVALID 0x0068 /* obsolete */ 572*0Sstevel@tonic-gate #define MPI_IOCSTATUS_TARGET_FC_NODE_LOGGED_OUT 0x0069 /* obsolete */ 573*0Sstevel@tonic-gate 574*0Sstevel@tonic-gate /* 575*0Sstevel@tonic-gate * Fibre Channel Direct Access values 576*0Sstevel@tonic-gate */ 577*0Sstevel@tonic-gate #define MPI_IOCSTATUS_FC_ABORTED 0x0066 578*0Sstevel@tonic-gate #define MPI_IOCSTATUS_FC_RX_ID_INVALID 0x0067 579*0Sstevel@tonic-gate #define MPI_IOCSTATUS_FC_DID_INVALID 0x0068 580*0Sstevel@tonic-gate #define MPI_IOCSTATUS_FC_NODE_LOGGED_OUT 0x0069 581*0Sstevel@tonic-gate #define MPI_IOCSTATUS_FC_EXCHANGE_CANCELED 0x006C 582*0Sstevel@tonic-gate 583*0Sstevel@tonic-gate /* 584*0Sstevel@tonic-gate * LAN values 585*0Sstevel@tonic-gate */ 586*0Sstevel@tonic-gate #define MPI_IOCSTATUS_LAN_DEVICE_NOT_FOUND 0x0080 587*0Sstevel@tonic-gate #define MPI_IOCSTATUS_LAN_DEVICE_FAILURE 0x0081 588*0Sstevel@tonic-gate #define MPI_IOCSTATUS_LAN_TRANSMIT_ERROR 0x0082 589*0Sstevel@tonic-gate #define MPI_IOCSTATUS_LAN_TRANSMIT_ABORTED 0x0083 590*0Sstevel@tonic-gate #define MPI_IOCSTATUS_LAN_RECEIVE_ERROR 0x0084 591*0Sstevel@tonic-gate #define MPI_IOCSTATUS_LAN_RECEIVE_ABORTED 0x0085 592*0Sstevel@tonic-gate #define MPI_IOCSTATUS_LAN_PARTIAL_PACKET 0x0086 593*0Sstevel@tonic-gate #define MPI_IOCSTATUS_LAN_CANCELED 0x0087 594*0Sstevel@tonic-gate 595*0Sstevel@tonic-gate /* 596*0Sstevel@tonic-gate * SAS values 597*0Sstevel@tonic-gate */ 598*0Sstevel@tonic-gate #define MPI_IOCSTATUS_SAS_SMP_REQUEST_FAILED 0x0090 599*0Sstevel@tonic-gate 600*0Sstevel@tonic-gate /* 601*0Sstevel@tonic-gate * Inband values 602*0Sstevel@tonic-gate */ 603*0Sstevel@tonic-gate #define MPI_IOCSTATUS_INBAND_ABORTED 0x0098 604*0Sstevel@tonic-gate #define MPI_IOCSTATUS_INBAND_NO_CONNECTION 0x0099 605*0Sstevel@tonic-gate 606*0Sstevel@tonic-gate /* 607*0Sstevel@tonic-gate * Diagnostic Tools values 608*0Sstevel@tonic-gate */ 609*0Sstevel@tonic-gate #define MPI_IOCSTATUS_DIAGNOSTIC_RELEASED 0x00A0 610*0Sstevel@tonic-gate 611*0Sstevel@tonic-gate /* 612*0Sstevel@tonic-gate * IOCStatus flag to indicate that log info is available 613*0Sstevel@tonic-gate */ 614*0Sstevel@tonic-gate #define MPI_IOCSTATUS_FLAG_LOG_INFO_AVAILABLE 0x8000 615*0Sstevel@tonic-gate #define MPI_IOCSTATUS_MASK 0x7FFF 616*0Sstevel@tonic-gate 617*0Sstevel@tonic-gate /* 618*0Sstevel@tonic-gate * LogInfo Types 619*0Sstevel@tonic-gate */ 620*0Sstevel@tonic-gate #define MPI_IOCLOGINFO_TYPE_MASK 0xF0000000 621*0Sstevel@tonic-gate #define MPI_IOCLOGINFO_TYPE_NONE 0x0 622*0Sstevel@tonic-gate #define MPI_IOCLOGINFO_TYPE_SCSI 0x1 623*0Sstevel@tonic-gate #define MPI_IOCLOGINFO_TYPE_FC 0x2 624*0Sstevel@tonic-gate #define MPI_IOCLOGINFO_TYPE_SAS 0x3 625*0Sstevel@tonic-gate #define MPI_IOCLOGINFO_TYPE_ISCSI 0x4 626*0Sstevel@tonic-gate #define MPI_IOCLOGINFO_LOG_DATA_MASK 0x0FFFFFFF 627*0Sstevel@tonic-gate 628*0Sstevel@tonic-gate #ifdef __cplusplus 629*0Sstevel@tonic-gate } 630*0Sstevel@tonic-gate #endif 631*0Sstevel@tonic-gate 632*0Sstevel@tonic-gate #endif /* _SYS_MPI_H */ 633