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_INIT_H 7*0Sstevel@tonic-gate #define _SYS_MPI_INIT_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 * SCSI Initiator Messages 17*0Sstevel@tonic-gate */ 18*0Sstevel@tonic-gate 19*0Sstevel@tonic-gate /* 20*0Sstevel@tonic-gate * SCSI IO messages and assocaited structures 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate typedef struct msg_scsi_io_request { 23*0Sstevel@tonic-gate uint8_t TargetID; 24*0Sstevel@tonic-gate uint8_t Bus; 25*0Sstevel@tonic-gate uint8_t ChainOffset; 26*0Sstevel@tonic-gate uint8_t Function; 27*0Sstevel@tonic-gate uint8_t CDBLength; 28*0Sstevel@tonic-gate uint8_t SenseBufferLength; 29*0Sstevel@tonic-gate uint8_t Reserved; 30*0Sstevel@tonic-gate uint8_t MsgFlags; 31*0Sstevel@tonic-gate uint32_t MsgContext; 32*0Sstevel@tonic-gate uint8_t LUN[8]; 33*0Sstevel@tonic-gate uint32_t Control; 34*0Sstevel@tonic-gate uint8_t CDB[16]; 35*0Sstevel@tonic-gate uint32_t DataLength; 36*0Sstevel@tonic-gate uint32_t SenseBufferLowAddr; 37*0Sstevel@tonic-gate sge_io_union_t SGL; 38*0Sstevel@tonic-gate } msg_scsi_io_request_t; 39*0Sstevel@tonic-gate 40*0Sstevel@tonic-gate /* SCSIO MsgFlags bits */ 41*0Sstevel@tonic-gate 42*0Sstevel@tonic-gate #define MPI_SCSIIO_MSGFLGS_SENSE_WIDTH 0x01 43*0Sstevel@tonic-gate #define MPI_SCSIIO_MSGFLGS_SENSE_WIDTH_32 0x00 44*0Sstevel@tonic-gate #define MPI_SCSIIO_MSGFLGS_SENSE_WIDTH_64 0x01 45*0Sstevel@tonic-gate #define MPI_SCSIIO_MSGFLGS_SENSE_LOCATION 0x02 46*0Sstevel@tonic-gate #define MPI_SCSIIO_MSGFLGS_SENSE_LOC_HOST 0x00 47*0Sstevel@tonic-gate #define MPI_SCSIIO_MSGFLGS_SENSE_LOC_IOC 0x02 48*0Sstevel@tonic-gate 49*0Sstevel@tonic-gate /* 50*0Sstevel@tonic-gate * SCSIIO LUN fields 51*0Sstevel@tonic-gate */ 52*0Sstevel@tonic-gate #define MPI_SCSIIO_LUN_FIRST_LEVEL_ADDRESSING 0x0000FFFF 53*0Sstevel@tonic-gate #define MPI_SCSIIO_LUN_SECOND_LEVEL_ADDRESSING 0xFFFF0000 54*0Sstevel@tonic-gate #define MPI_SCSIIO_LUN_THIRD_LEVEL_ADDRESSING 0x0000FFFF 55*0Sstevel@tonic-gate #define MPI_SCSIIO_LUN_FOURTH_LEVEL_ADDRESSING 0xFFFF0000 56*0Sstevel@tonic-gate #define MPI_SCSIIO_LUN_LEVEL_1_WORD 0xFF00 57*0Sstevel@tonic-gate #define MPI_SCSIIO_LUN_LEVEL_1_DWORD 0x0000FF00 58*0Sstevel@tonic-gate 59*0Sstevel@tonic-gate /* 60*0Sstevel@tonic-gate * SCSIO Control bits 61*0Sstevel@tonic-gate */ 62*0Sstevel@tonic-gate #define MPI_SCSIIO_CONTROL_DATADIRECTION_MASK 0x03000000 63*0Sstevel@tonic-gate #define MPI_SCSIIO_CONTROL_NODATATRANSFER 0x00000000 64*0Sstevel@tonic-gate #define MPI_SCSIIO_CONTROL_WRITE 0x01000000 65*0Sstevel@tonic-gate #define MPI_SCSIIO_CONTROL_READ 0x02000000 66*0Sstevel@tonic-gate 67*0Sstevel@tonic-gate #define MPI_SCSIIO_CONTROL_ADDCDBLEN_MASK 0x3C000000 68*0Sstevel@tonic-gate #define MPI_SCSIIO_CONTROL_ADDCDBLEN_SHIFT 26 69*0Sstevel@tonic-gate 70*0Sstevel@tonic-gate #define MPI_SCSIIO_CONTROL_TASKATTRIBUTE_MASK 0x00000700 71*0Sstevel@tonic-gate #define MPI_SCSIIO_CONTROL_SIMPLEQ 0x00000000 72*0Sstevel@tonic-gate #define MPI_SCSIIO_CONTROL_HEADOFQ 0x00000100 73*0Sstevel@tonic-gate #define MPI_SCSIIO_CONTROL_ORDEREDQ 0x00000200 74*0Sstevel@tonic-gate #define MPI_SCSIIO_CONTROL_ACAQ 0x00000400 75*0Sstevel@tonic-gate #define MPI_SCSIIO_CONTROL_UNTAGGED 0x00000500 76*0Sstevel@tonic-gate #define MPI_SCSIIO_CONTROL_NO_DISCONNECT 0x00000700 77*0Sstevel@tonic-gate 78*0Sstevel@tonic-gate #define MPI_SCSIIO_CONTROL_TASKMANAGE_MASK 0x00FF0000 79*0Sstevel@tonic-gate #define MPI_SCSIIO_CONTROL_OBSOLETE 0x00800000 80*0Sstevel@tonic-gate #define MPI_SCSIIO_CONTROL_CLEAR_ACA_RSV 0x00400000 81*0Sstevel@tonic-gate #define MPI_SCSIIO_CONTROL_TARGET_RESET 0x00200000 82*0Sstevel@tonic-gate #define MPI_SCSIIO_CONTROL_LUN_RESET_RSV 0x00100000 83*0Sstevel@tonic-gate #define MPI_SCSIIO_CONTROL_RESERVED 0x00080000 84*0Sstevel@tonic-gate #define MPI_SCSIIO_CONTROL_CLR_TASK_SET_RSV 0x00040000 85*0Sstevel@tonic-gate #define MPI_SCSIIO_CONTROL_ABORT_TASK_SET 0x00020000 86*0Sstevel@tonic-gate #define MPI_SCSIIO_CONTROL_RESERVED2 0x00010000 87*0Sstevel@tonic-gate 88*0Sstevel@tonic-gate 89*0Sstevel@tonic-gate /* 90*0Sstevel@tonic-gate * SCSIIO reply structure 91*0Sstevel@tonic-gate */ 92*0Sstevel@tonic-gate typedef struct msg_scsi_io_reply { 93*0Sstevel@tonic-gate uint8_t TargetID; 94*0Sstevel@tonic-gate uint8_t Bus; 95*0Sstevel@tonic-gate uint8_t MsgLength; 96*0Sstevel@tonic-gate uint8_t Function; 97*0Sstevel@tonic-gate uint8_t CDBLength; 98*0Sstevel@tonic-gate uint8_t SenseBufferLength; 99*0Sstevel@tonic-gate uint8_t Reserved; 100*0Sstevel@tonic-gate uint8_t MsgFlags; 101*0Sstevel@tonic-gate uint32_t MsgContext; 102*0Sstevel@tonic-gate uint8_t SCSIStatus; 103*0Sstevel@tonic-gate uint8_t SCSIState; 104*0Sstevel@tonic-gate uint16_t IOCStatus; 105*0Sstevel@tonic-gate uint32_t IOCLogInfo; 106*0Sstevel@tonic-gate uint32_t TransferCount; 107*0Sstevel@tonic-gate uint32_t SenseCount; 108*0Sstevel@tonic-gate uint32_t ResponseInfo; 109*0Sstevel@tonic-gate uint16_t TaskTag; 110*0Sstevel@tonic-gate uint16_t Reserved1; 111*0Sstevel@tonic-gate } msg_scsi_io_reply_t; 112*0Sstevel@tonic-gate 113*0Sstevel@tonic-gate /* 114*0Sstevel@tonic-gate * SCSIIO Reply SCSIStatus values (SAM-2 status codes) 115*0Sstevel@tonic-gate */ 116*0Sstevel@tonic-gate #define MPI_SCSI_STATUS_SUCCESS 0x00 117*0Sstevel@tonic-gate #define MPI_SCSI_STATUS_CHECK_CONDITION 0x02 118*0Sstevel@tonic-gate #define MPI_SCSI_STATUS_CONDITION_MET 0x04 119*0Sstevel@tonic-gate #define MPI_SCSI_STATUS_BUSY 0x08 120*0Sstevel@tonic-gate #define MPI_SCSI_STATUS_INTERMEDIATE 0x10 121*0Sstevel@tonic-gate #define MPI_SCSI_STATUS_INTERMEDIATE_CONDMET 0x14 122*0Sstevel@tonic-gate #define MPI_SCSI_STATUS_RESERVATION_CONFLICT 0x18 123*0Sstevel@tonic-gate #define MPI_SCSI_STATUS_COMMAND_TERMINATED 0x22 124*0Sstevel@tonic-gate #define MPI_SCSI_STATUS_TASK_SET_FULL 0x28 125*0Sstevel@tonic-gate #define MPI_SCSI_STATUS_ACA_ACTIVE 0x30 126*0Sstevel@tonic-gate 127*0Sstevel@tonic-gate /* 128*0Sstevel@tonic-gate * SCSIIO Reply SCSIState values 129*0Sstevel@tonic-gate */ 130*0Sstevel@tonic-gate #define MPI_SCSI_STATE_AUTOSENSE_VALID 0x01 131*0Sstevel@tonic-gate #define MPI_SCSI_STATE_AUTOSENSE_FAILED 0x02 132*0Sstevel@tonic-gate #define MPI_SCSI_STATE_NO_SCSI_STATUS 0x04 133*0Sstevel@tonic-gate #define MPI_SCSI_STATE_TERMINATED 0x08 134*0Sstevel@tonic-gate #define MPI_SCSI_STATE_RESPONSE_INFO_VALID 0x10 135*0Sstevel@tonic-gate #define MPI_SCSI_STATE_QUEUE_TAG_REJECTED 0x20 136*0Sstevel@tonic-gate 137*0Sstevel@tonic-gate /* 138*0Sstevel@tonic-gate * SCSIIO Reply ResponseInfo values 139*0Sstevel@tonic-gate * (FCP-1 RSP_CODE values and SPI-3 Packetized Failure codes) 140*0Sstevel@tonic-gate */ 141*0Sstevel@tonic-gate #define MPI_SCSI_RSP_INFO_FUNCTION_COMPLETE 0x00000000 142*0Sstevel@tonic-gate #define MPI_SCSI_RSP_INFO_FCP_BURST_LEN_ERROR 0x01000000 143*0Sstevel@tonic-gate #define MPI_SCSI_RSP_INFO_CMND_FIELDS_INVALID 0x02000000 144*0Sstevel@tonic-gate #define MPI_SCSI_RSP_INFO_FCP_DATA_RO_ERROR 0x03000000 145*0Sstevel@tonic-gate #define MPI_SCSI_RSP_INFO_TASK_MGMT_UNSUPPORTED 0x04000000 146*0Sstevel@tonic-gate #define MPI_SCSI_RSP_INFO_TASK_MGMT_FAILED 0x05000000 147*0Sstevel@tonic-gate #define MPI_SCSI_RSP_INFO_SPI_LQ_INVALID_TYPE 0x06000000 148*0Sstevel@tonic-gate 149*0Sstevel@tonic-gate /* 150*0Sstevel@tonic-gate * SCSI Task Management messages 151*0Sstevel@tonic-gate */ 152*0Sstevel@tonic-gate typedef struct msg_scsi_task_mgmt { 153*0Sstevel@tonic-gate uint8_t TargetID; 154*0Sstevel@tonic-gate uint8_t Bus; 155*0Sstevel@tonic-gate uint8_t ChainOffset; 156*0Sstevel@tonic-gate uint8_t Function; 157*0Sstevel@tonic-gate uint8_t Reserved; 158*0Sstevel@tonic-gate uint8_t TaskType; 159*0Sstevel@tonic-gate uint8_t Reserved1; 160*0Sstevel@tonic-gate uint8_t MsgFlags; 161*0Sstevel@tonic-gate uint32_t MsgContext; 162*0Sstevel@tonic-gate uint8_t LUN[8]; 163*0Sstevel@tonic-gate uint32_t Reserved2[7]; 164*0Sstevel@tonic-gate uint32_t TaskMsgContext; 165*0Sstevel@tonic-gate } msg_scsi_task_mgmt_t; 166*0Sstevel@tonic-gate 167*0Sstevel@tonic-gate /* 168*0Sstevel@tonic-gate * TaskType values 169*0Sstevel@tonic-gate */ 170*0Sstevel@tonic-gate #define MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK 0x00000001 171*0Sstevel@tonic-gate #define MPI_SCSITASKMGMT_TASKTYPE_ABRT_TASK_SET 0x00000002 172*0Sstevel@tonic-gate #define MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET 0x00000003 173*0Sstevel@tonic-gate #define MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS 0x00000004 174*0Sstevel@tonic-gate #define MPI_SCSITASKMGMT_TASKTYPE_LOGICAL_UNIT_RESET 0x00000005 175*0Sstevel@tonic-gate 176*0Sstevel@tonic-gate /* 177*0Sstevel@tonic-gate * MsgFlags bits 178*0Sstevel@tonic-gate */ 179*0Sstevel@tonic-gate #define MPI_SCSITASKMGMT_MSGFLAGS_TARGET_RESET_OPTION 0x00000000 180*0Sstevel@tonic-gate #define MPI_SCSITASKMGMT_MSGFLAGS_LIP_RESET_OPTION 0x00000002 181*0Sstevel@tonic-gate #define MPI_SCSITASKMGMT_MSGFLAGS_LIPRESET_RESET_OPTION 0x00000004 182*0Sstevel@tonic-gate 183*0Sstevel@tonic-gate /* SCSI Task Management Reply */ 184*0Sstevel@tonic-gate 185*0Sstevel@tonic-gate typedef struct msg_scsi_task_mgmt_reply { 186*0Sstevel@tonic-gate uint8_t TargetID; 187*0Sstevel@tonic-gate uint8_t Bus; 188*0Sstevel@tonic-gate uint8_t MsgLength; 189*0Sstevel@tonic-gate uint8_t Function; 190*0Sstevel@tonic-gate uint8_t Reserved; 191*0Sstevel@tonic-gate uint8_t TaskType; 192*0Sstevel@tonic-gate uint8_t Reserved1; 193*0Sstevel@tonic-gate uint8_t MsgFlags; 194*0Sstevel@tonic-gate uint32_t MsgContext; 195*0Sstevel@tonic-gate uint8_t Reserved2[2]; 196*0Sstevel@tonic-gate uint16_t IOCStatus; 197*0Sstevel@tonic-gate uint32_t IOCLogInfo; 198*0Sstevel@tonic-gate uint32_t TerminationCount; 199*0Sstevel@tonic-gate } msg_scsi_task_mgmt_reply_t; 200*0Sstevel@tonic-gate 201*0Sstevel@tonic-gate /* 202*0Sstevel@tonic-gate * SCSI enclosure processor messages 203*0Sstevel@tonic-gate */ 204*0Sstevel@tonic-gate typedef struct msg_sep_request { 205*0Sstevel@tonic-gate uint8_t TargetID; 206*0Sstevel@tonic-gate uint8_t Bus; 207*0Sstevel@tonic-gate uint8_t ChainOffset; 208*0Sstevel@tonic-gate uint8_t Function; 209*0Sstevel@tonic-gate uint8_t Action; 210*0Sstevel@tonic-gate uint8_t Reserved1; 211*0Sstevel@tonic-gate uint8_t Reserved2; 212*0Sstevel@tonic-gate uint8_t MsgFlags; 213*0Sstevel@tonic-gate uint32_t MsgContext; 214*0Sstevel@tonic-gate uint32_t SlotStatus; 215*0Sstevel@tonic-gate } msg_sep_request_t; 216*0Sstevel@tonic-gate 217*0Sstevel@tonic-gate #define MPI_SEP_REQ_ACTION_WRITE_STATUS 0x00 218*0Sstevel@tonic-gate #define MPI_SEP_REQ_ACTION_READ_STATUS 0x01 219*0Sstevel@tonic-gate 220*0Sstevel@tonic-gate #define MPI_SEP_REQ_SLOTSTATUS_NO_ERROR 0x00000001 221*0Sstevel@tonic-gate #define MPI_SEP_REQ_SLOTSTATUS_DEV_FAULTY 0x00000002 222*0Sstevel@tonic-gate #define MPI_SEP_REQ_SLOTSTATUS_DEV_REBUILDING 0x00000004 223*0Sstevel@tonic-gate 224*0Sstevel@tonic-gate #ifdef __cplusplus 225*0Sstevel@tonic-gate } 226*0Sstevel@tonic-gate #endif 227*0Sstevel@tonic-gate 228*0Sstevel@tonic-gate #endif /* _SYS_MPI_INIT_H */ 229