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