1 /* $FreeBSD$ */ 2 /* 3 * Copyright (c) 2000, 2001 by LSI Logic Corporation 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice immediately at the beginning of the file, without modification, 10 * this list of conditions, and the following disclaimer. 11 * 2. The name of the author may not be used to endorse or promote products 12 * derived from this software without specific prior written permission. 13 * 14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 18 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 * 27 * Name: MPI_INIT.H 28 * Title: MPI initiator mode messages and structures 29 * Creation Date: June 8, 2000 30 * 31 * MPI_INIT.H Version: 01.02.06 32 * 33 * Version History 34 * --------------- 35 * 36 * Date Version Description 37 * -------- -------- ------------------------------------------------------ 38 * 05-08-00 00.10.01 Original release for 0.10 spec dated 4/26/2000. 39 * 05-24-00 00.10.02 Added SenseBufferLength to _MSG_SCSI_IO_REPLY. 40 * 06-06-00 01.00.01 Update version number for 1.0 release. 41 * 06-08-00 01.00.02 Added MPI_SCSI_RSP_INFO_ definitions. 42 * 11-02-00 01.01.01 Original release for post 1.0 work. 43 * 12-04-00 01.01.02 Added MPI_SCSIIO_CONTROL_NO_DISCONNECT. 44 * 02-20-01 01.01.03 Started using MPI_POINTER. 45 * 03-27-01 01.01.04 Added structure offset comments. 46 * 04-10-01 01.01.05 Added new MsgFlag for MSG_SCSI_TASK_MGMT. 47 * 08-08-01 01.02.01 Original release for v1.2 work. 48 * 08-29-01 01.02.02 Added MPI_SCSITASKMGMT_TASKTYPE_LOGICAL_UNIT_RESET. 49 * Added MPI_SCSI_STATE_QUEUE_TAG_REJECTED for 50 * MSG_SCSI_IO_REPLY. 51 * 09-28-01 01.02.03 Added structures and defines for SCSI Enclosure 52 * Processor messages. 53 * 10-04-01 01.02.04 Added defines for SEP request Action field. 54 * 05-31-02 01.02.05 Added MPI_SCSIIO_MSGFLGS_CMD_DETERMINES_DATA_DIR define 55 * for SCSI IO requests. 56 * 11-15-02 01.02.06 Added special extended SCSI Status defines for FCP. 57 * -------------------------------------------------------------------------- 58 */ 59 60 #ifndef MPI_INIT_H 61 #define MPI_INIT_H 62 63 64 /***************************************************************************** 65 * 66 * S C S I I n i t i a t o r M e s s a g e s 67 * 68 *****************************************************************************/ 69 70 /****************************************************************************/ 71 /* SCSI IO messages and assocaited structures */ 72 /****************************************************************************/ 73 74 typedef struct _MSG_SCSI_IO_REQUEST 75 { 76 U8 TargetID; /* 00h */ 77 U8 Bus; /* 01h */ 78 U8 ChainOffset; /* 02h */ 79 U8 Function; /* 03h */ 80 U8 CDBLength; /* 04h */ 81 U8 SenseBufferLength; /* 05h */ 82 U8 Reserved; /* 06h */ 83 U8 MsgFlags; /* 07h */ 84 U32 MsgContext; /* 08h */ 85 U8 LUN[8]; /* 0Ch */ 86 U32 Control; /* 14h */ 87 U8 CDB[16]; /* 18h */ 88 U32 DataLength; /* 28h */ 89 U32 SenseBufferLowAddr; /* 2Ch */ 90 SGE_IO_UNION SGL; /* 30h */ 91 } MSG_SCSI_IO_REQUEST, MPI_POINTER PTR_MSG_SCSI_IO_REQUEST, 92 SCSIIORequest_t, MPI_POINTER pSCSIIORequest_t; 93 94 95 /* SCSI IO MsgFlags bits */ 96 97 #define MPI_SCSIIO_MSGFLGS_SENSE_WIDTH (0x01) 98 #define MPI_SCSIIO_MSGFLGS_SENSE_WIDTH_32 (0x00) 99 #define MPI_SCSIIO_MSGFLGS_SENSE_WIDTH_64 (0x01) 100 #define MPI_SCSIIO_MSGFLGS_SENSE_LOCATION (0x02) 101 #define MPI_SCSIIO_MSGFLGS_SENSE_LOC_HOST (0x00) 102 #define MPI_SCSIIO_MSGFLGS_SENSE_LOC_IOC (0x02) 103 #define MPI_SCSIIO_MSGFLGS_CMD_DETERMINES_DATA_DIR (0x04) 104 105 /* SCSI IO LUN fields */ 106 107 #define MPI_SCSIIO_LUN_FIRST_LEVEL_ADDRESSING (0x0000FFFF) 108 #define MPI_SCSIIO_LUN_SECOND_LEVEL_ADDRESSING (0xFFFF0000) 109 #define MPI_SCSIIO_LUN_THIRD_LEVEL_ADDRESSING (0x0000FFFF) 110 #define MPI_SCSIIO_LUN_FOURTH_LEVEL_ADDRESSING (0xFFFF0000) 111 #define MPI_SCSIIO_LUN_LEVEL_1_WORD (0xFF00) 112 #define MPI_SCSIIO_LUN_LEVEL_1_DWORD (0x0000FF00) 113 114 /* SCSI IO Control bits */ 115 116 #define MPI_SCSIIO_CONTROL_DATADIRECTION_MASK (0x03000000) 117 #define MPI_SCSIIO_CONTROL_NODATATRANSFER (0x00000000) 118 #define MPI_SCSIIO_CONTROL_WRITE (0x01000000) 119 #define MPI_SCSIIO_CONTROL_READ (0x02000000) 120 121 #define MPI_SCSIIO_CONTROL_ADDCDBLEN_MASK (0x3C000000) 122 #define MPI_SCSIIO_CONTROL_ADDCDBLEN_SHIFT (26) 123 124 #define MPI_SCSIIO_CONTROL_TASKATTRIBUTE_MASK (0x00000700) 125 #define MPI_SCSIIO_CONTROL_SIMPLEQ (0x00000000) 126 #define MPI_SCSIIO_CONTROL_HEADOFQ (0x00000100) 127 #define MPI_SCSIIO_CONTROL_ORDEREDQ (0x00000200) 128 #define MPI_SCSIIO_CONTROL_ACAQ (0x00000400) 129 #define MPI_SCSIIO_CONTROL_UNTAGGED (0x00000500) 130 #define MPI_SCSIIO_CONTROL_NO_DISCONNECT (0x00000700) 131 132 #define MPI_SCSIIO_CONTROL_TASKMANAGE_MASK (0x00FF0000) 133 #define MPI_SCSIIO_CONTROL_OBSOLETE (0x00800000) 134 #define MPI_SCSIIO_CONTROL_CLEAR_ACA_RSV (0x00400000) 135 #define MPI_SCSIIO_CONTROL_TARGET_RESET (0x00200000) 136 #define MPI_SCSIIO_CONTROL_LUN_RESET_RSV (0x00100000) 137 #define MPI_SCSIIO_CONTROL_RESERVED (0x00080000) 138 #define MPI_SCSIIO_CONTROL_CLR_TASK_SET_RSV (0x00040000) 139 #define MPI_SCSIIO_CONTROL_ABORT_TASK_SET (0x00020000) 140 #define MPI_SCSIIO_CONTROL_RESERVED2 (0x00010000) 141 142 143 /* SCSI IO reply structure */ 144 typedef struct _MSG_SCSI_IO_REPLY 145 { 146 U8 TargetID; /* 00h */ 147 U8 Bus; /* 01h */ 148 U8 MsgLength; /* 02h */ 149 U8 Function; /* 03h */ 150 U8 CDBLength; /* 04h */ 151 U8 SenseBufferLength; /* 05h */ 152 U8 Reserved; /* 06h */ 153 U8 MsgFlags; /* 07h */ 154 U32 MsgContext; /* 08h */ 155 U8 SCSIStatus; /* 0Ch */ 156 U8 SCSIState; /* 0Dh */ 157 U16 IOCStatus; /* 0Eh */ 158 U32 IOCLogInfo; /* 10h */ 159 U32 TransferCount; /* 14h */ 160 U32 SenseCount; /* 18h */ 161 U32 ResponseInfo; /* 1Ch */ 162 } MSG_SCSI_IO_REPLY, MPI_POINTER PTR_MSG_SCSI_IO_REPLY, 163 SCSIIOReply_t, MPI_POINTER pSCSIIOReply_t; 164 165 166 /* SCSI IO Reply SCSIStatus values (SAM-2 status codes) */ 167 168 #define MPI_SCSI_STATUS_SUCCESS (0x00) 169 #define MPI_SCSI_STATUS_CHECK_CONDITION (0x02) 170 #define MPI_SCSI_STATUS_CONDITION_MET (0x04) 171 #define MPI_SCSI_STATUS_BUSY (0x08) 172 #define MPI_SCSI_STATUS_INTERMEDIATE (0x10) 173 #define MPI_SCSI_STATUS_INTERMEDIATE_CONDMET (0x14) 174 #define MPI_SCSI_STATUS_RESERVATION_CONFLICT (0x18) 175 #define MPI_SCSI_STATUS_COMMAND_TERMINATED (0x22) 176 #define MPI_SCSI_STATUS_TASK_SET_FULL (0x28) 177 #define MPI_SCSI_STATUS_ACA_ACTIVE (0x30) 178 179 #define MPI_SCSI_STATUS_FCPEXT_DEVICE_LOGGED_OUT (0x80) 180 #define MPI_SCSI_STATUS_FCPEXT_NO_LINK (0x81) 181 182 183 /* SCSI IO Reply SCSIState values */ 184 185 #define MPI_SCSI_STATE_AUTOSENSE_VALID (0x01) 186 #define MPI_SCSI_STATE_AUTOSENSE_FAILED (0x02) 187 #define MPI_SCSI_STATE_NO_SCSI_STATUS (0x04) 188 #define MPI_SCSI_STATE_TERMINATED (0x08) 189 #define MPI_SCSI_STATE_RESPONSE_INFO_VALID (0x10) 190 #define MPI_SCSI_STATE_QUEUE_TAG_REJECTED (0x20) 191 192 /* SCSI IO Reply ResponseInfo values */ 193 /* (FCP-1 RSP_CODE values and SPI-3 Packetized Failure codes) */ 194 195 #define MPI_SCSI_RSP_INFO_FUNCTION_COMPLETE (0x00000000) 196 #define MPI_SCSI_RSP_INFO_FCP_BURST_LEN_ERROR (0x01000000) 197 #define MPI_SCSI_RSP_INFO_CMND_FIELDS_INVALID (0x02000000) 198 #define MPI_SCSI_RSP_INFO_FCP_DATA_RO_ERROR (0x03000000) 199 #define MPI_SCSI_RSP_INFO_TASK_MGMT_UNSUPPORTED (0x04000000) 200 #define MPI_SCSI_RSP_INFO_TASK_MGMT_FAILED (0x05000000) 201 #define MPI_SCSI_RSP_INFO_SPI_LQ_INVALID_TYPE (0x06000000) 202 203 204 /****************************************************************************/ 205 /* SCSI Task Management messages */ 206 /****************************************************************************/ 207 208 typedef struct _MSG_SCSI_TASK_MGMT 209 { 210 U8 TargetID; /* 00h */ 211 U8 Bus; /* 01h */ 212 U8 ChainOffset; /* 02h */ 213 U8 Function; /* 03h */ 214 U8 Reserved; /* 04h */ 215 U8 TaskType; /* 05h */ 216 U8 Reserved1; /* 06h */ 217 U8 MsgFlags; /* 07h */ 218 U32 MsgContext; /* 08h */ 219 U8 LUN[8]; /* 0Ch */ 220 U32 Reserved2[7]; /* 14h */ 221 U32 TaskMsgContext; /* 30h */ 222 } MSG_SCSI_TASK_MGMT, MPI_POINTER PTR_SCSI_TASK_MGMT, 223 SCSITaskMgmt_t, MPI_POINTER pSCSITaskMgmt_t; 224 225 /* TaskType values */ 226 227 #define MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK (0x01) 228 #define MPI_SCSITASKMGMT_TASKTYPE_ABRT_TASK_SET (0x02) 229 #define MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET (0x03) 230 #define MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS (0x04) 231 #define MPI_SCSITASKMGMT_TASKTYPE_LOGICAL_UNIT_RESET (0x05) 232 233 /* MsgFlags bits */ 234 #define MPI_SCSITASKMGMT_MSGFLAGS_TARGET_RESET_OPTION (0x00) 235 #define MPI_SCSITASKMGMT_MSGFLAGS_LIP_RESET_OPTION (0x02) 236 #define MPI_SCSITASKMGMT_MSGFLAGS_LIPRESET_RESET_OPTION (0x04) 237 238 /* SCSI Task Management Reply */ 239 typedef struct _MSG_SCSI_TASK_MGMT_REPLY 240 { 241 U8 TargetID; /* 00h */ 242 U8 Bus; /* 01h */ 243 U8 MsgLength; /* 02h */ 244 U8 Function; /* 03h */ 245 U8 Reserved; /* 04h */ 246 U8 TaskType; /* 05h */ 247 U8 Reserved1; /* 06h */ 248 U8 MsgFlags; /* 07h */ 249 U32 MsgContext; /* 08h */ 250 U8 Reserved2[2]; /* 0Ch */ 251 U16 IOCStatus; /* 0Eh */ 252 U32 IOCLogInfo; /* 10h */ 253 U32 TerminationCount; /* 14h */ 254 } MSG_SCSI_TASK_MGMT_REPLY, MPI_POINTER PTR_MSG_SCSI_TASK_MGMT_REPLY, 255 SCSITaskMgmtReply_t, MPI_POINTER pSCSITaskMgmtReply_t; 256 257 258 /****************************************************************************/ 259 /* SCSI Enclosure Processor messages */ 260 /****************************************************************************/ 261 262 typedef struct _MSG_SEP_REQUEST 263 { 264 U8 TargetID; /* 00h */ 265 U8 Bus; /* 01h */ 266 U8 ChainOffset; /* 02h */ 267 U8 Function; /* 03h */ 268 U8 Action; /* 04h */ 269 U8 Reserved1; /* 05h */ 270 U8 Reserved2; /* 06h */ 271 U8 MsgFlags; /* 07h */ 272 U32 MsgContext; /* 08h */ 273 U32 SlotStatus; /* 0Ch */ 274 } MSG_SEP_REQUEST, MPI_POINTER PTR_MSG_SEP_REQUEST, 275 SEPRequest_t, MPI_POINTER pSEPRequest_t; 276 277 /* Action defines */ 278 #define MPI_SEP_REQ_ACTION_WRITE_STATUS (0x00) 279 #define MPI_SEP_REQ_ACTION_READ_STATUS (0x01) 280 281 /* SlotStatus bits for MSG_SEP_REQUEST */ 282 #define MPI_SEP_REQ_SLOTSTATUS_NO_ERROR (0x00000001) 283 #define MPI_SEP_REQ_SLOTSTATUS_DEV_FAULTY (0x00000002) 284 #define MPI_SEP_REQ_SLOTSTATUS_DEV_REBUILDING (0x00000004) 285 #define MPI_SEP_REQ_SLOTSTATUS_IN_FAILED_ARRAY (0x00000008) 286 #define MPI_SEP_REQ_SLOTSTATUS_IN_CRITICAL_ARRAY (0x00000010) 287 #define MPI_SEP_REQ_SLOTSTATUS_PARITY_CHECK (0x00000020) 288 #define MPI_SEP_REQ_SLOTSTATUS_PREDICTED_FAULT (0x00000040) 289 #define MPI_SEP_REQ_SLOTSTATUS_UNCONFIGURED (0x00000080) 290 #define MPI_SEP_REQ_SLOTSTATUS_HOT_SPARE (0x00000100) 291 #define MPI_SEP_REQ_SLOTSTATUS_REBUILD_STOPPED (0x00000200) 292 #define MPI_SEP_REQ_SLOTSTATUS_IDENTIFY_REQUEST (0x00020000) 293 #define MPI_SEP_REQ_SLOTSTATUS_REQUEST_REMOVE (0x00040000) 294 #define MPI_SEP_REQ_SLOTSTATUS_REQUEST_INSERT (0x00080000) 295 #define MPI_SEP_REQ_SLOTSTATUS_DO_NOT_MOVE (0x00400000) 296 #define MPI_SEP_REQ_SLOTSTATUS_B_ENABLE_BYPASS (0x04000000) 297 #define MPI_SEP_REQ_SLOTSTATUS_A_ENABLE_BYPASS (0x08000000) 298 #define MPI_SEP_REQ_SLOTSTATUS_DEV_OFF (0x10000000) 299 #define MPI_SEP_REQ_SLOTSTATUS_SWAP_RESET (0x80000000) 300 301 302 typedef struct _MSG_SEP_REPLY 303 { 304 U8 TargetID; /* 00h */ 305 U8 Bus; /* 01h */ 306 U8 MsgLength; /* 02h */ 307 U8 Function; /* 03h */ 308 U8 Action; /* 04h */ 309 U8 Reserved1; /* 05h */ 310 U8 Reserved2; /* 06h */ 311 U8 MsgFlags; /* 07h */ 312 U32 MsgContext; /* 08h */ 313 U16 Reserved3; /* 0Ch */ 314 U16 IOCStatus; /* 0Eh */ 315 U32 IOCLogInfo; /* 10h */ 316 U32 SlotStatus; /* 14h */ 317 } MSG_SEP_REPLY, MPI_POINTER PTR_MSG_SEP_REPLY, 318 SEPReply_t, MPI_POINTER pSEPReply_t; 319 320 /* SlotStatus bits for MSG_SEP_REPLY */ 321 #define MPI_SEP_REPLY_SLOTSTATUS_NO_ERROR (0x00000001) 322 #define MPI_SEP_REPLY_SLOTSTATUS_DEV_FAULTY (0x00000002) 323 #define MPI_SEP_REPLY_SLOTSTATUS_DEV_REBUILDING (0x00000004) 324 #define MPI_SEP_REPLY_SLOTSTATUS_IN_FAILED_ARRAY (0x00000008) 325 #define MPI_SEP_REPLY_SLOTSTATUS_IN_CRITICAL_ARRAY (0x00000010) 326 #define MPI_SEP_REPLY_SLOTSTATUS_PARITY_CHECK (0x00000020) 327 #define MPI_SEP_REPLY_SLOTSTATUS_PREDICTED_FAULT (0x00000040) 328 #define MPI_SEP_REPLY_SLOTSTATUS_UNCONFIGURED (0x00000080) 329 #define MPI_SEP_REPLY_SLOTSTATUS_HOT_SPARE (0x00000100) 330 #define MPI_SEP_REPLY_SLOTSTATUS_REBUILD_STOPPED (0x00000200) 331 #define MPI_SEP_REPLY_SLOTSTATUS_REPORT (0x00010000) 332 #define MPI_SEP_REPLY_SLOTSTATUS_IDENTIFY_REQUEST (0x00020000) 333 #define MPI_SEP_REPLY_SLOTSTATUS_REMOVE_READY (0x00040000) 334 #define MPI_SEP_REPLY_SLOTSTATUS_INSERT_READY (0x00080000) 335 #define MPI_SEP_REPLY_SLOTSTATUS_DO_NOT_REMOVE (0x00400000) 336 #define MPI_SEP_REPLY_SLOTSTATUS_B_BYPASS_ENABLED (0x01000000) 337 #define MPI_SEP_REPLY_SLOTSTATUS_A_BYPASS_ENABLED (0x02000000) 338 #define MPI_SEP_REPLY_SLOTSTATUS_B_ENABLE_BYPASS (0x04000000) 339 #define MPI_SEP_REPLY_SLOTSTATUS_A_ENABLE_BYPASS (0x08000000) 340 #define MPI_SEP_REPLY_SLOTSTATUS_DEV_OFF (0x10000000) 341 #define MPI_SEP_REPLY_SLOTSTATUS_FAULT_SENSED (0x40000000) 342 #define MPI_SEP_REPLY_SLOTSTATUS_SWAPPED (0x80000000) 343 344 #endif 345