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 Version: 01.02.04 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 * -------------------------------------------------------------------------- 55 */ 56 57 #ifndef MPI_INIT_H 58 #define MPI_INIT_H 59 60 61 /***************************************************************************** 62 * 63 * S C S I I n i t i a t o r M e s s a g e s 64 * 65 *****************************************************************************/ 66 67 /****************************************************************************/ 68 /* SCSI IO messages and assocaited structures */ 69 /****************************************************************************/ 70 71 typedef struct _MSG_SCSI_IO_REQUEST 72 { 73 U8 TargetID; /* 00h */ 74 U8 Bus; /* 01h */ 75 U8 ChainOffset; /* 02h */ 76 U8 Function; /* 03h */ 77 U8 CDBLength; /* 04h */ 78 U8 SenseBufferLength; /* 05h */ 79 U8 Reserved; /* 06h */ 80 U8 MsgFlags; /* 07h */ 81 U32 MsgContext; /* 08h */ 82 U8 LUN[8]; /* 0Ch */ 83 U32 Control; /* 14h */ 84 U8 CDB[16]; /* 18h */ 85 U32 DataLength; /* 28h */ 86 U32 SenseBufferLowAddr; /* 2Ch */ 87 SGE_IO_UNION SGL; /* 30h */ 88 } MSG_SCSI_IO_REQUEST, MPI_POINTER PTR_MSG_SCSI_IO_REQUEST, 89 SCSIIORequest_t, MPI_POINTER pSCSIIORequest_t; 90 91 92 /* SCSIO MsgFlags bits */ 93 94 #define MPI_SCSIIO_MSGFLGS_SENSE_WIDTH (0x01) 95 #define MPI_SCSIIO_MSGFLGS_SENSE_WIDTH_32 (0x00) 96 #define MPI_SCSIIO_MSGFLGS_SENSE_WIDTH_64 (0x01) 97 #define MPI_SCSIIO_MSGFLGS_SENSE_LOCATION (0x02) 98 #define MPI_SCSIIO_MSGFLGS_SENSE_LOC_HOST (0x00) 99 #define MPI_SCSIIO_MSGFLGS_SENSE_LOC_IOC (0x02) 100 101 /* SCSIIO LUN fields */ 102 103 #define MPI_SCSIIO_LUN_FIRST_LEVEL_ADDRESSING (0x0000FFFF) 104 #define MPI_SCSIIO_LUN_SECOND_LEVEL_ADDRESSING (0xFFFF0000) 105 #define MPI_SCSIIO_LUN_THIRD_LEVEL_ADDRESSING (0x0000FFFF) 106 #define MPI_SCSIIO_LUN_FOURTH_LEVEL_ADDRESSING (0xFFFF0000) 107 #define MPI_SCSIIO_LUN_LEVEL_1_WORD (0xFF00) 108 #define MPI_SCSIIO_LUN_LEVEL_1_DWORD (0x0000FF00) 109 110 /* SCSIO Control bits */ 111 112 #define MPI_SCSIIO_CONTROL_DATADIRECTION_MASK (0x03000000) 113 #define MPI_SCSIIO_CONTROL_NODATATRANSFER (0x00000000) 114 #define MPI_SCSIIO_CONTROL_WRITE (0x01000000) 115 #define MPI_SCSIIO_CONTROL_READ (0x02000000) 116 117 #define MPI_SCSIIO_CONTROL_ADDCDBLEN_MASK (0x3C000000) 118 #define MPI_SCSIIO_CONTROL_ADDCDBLEN_SHIFT (26) 119 120 #define MPI_SCSIIO_CONTROL_TASKATTRIBUTE_MASK (0x00000700) 121 #define MPI_SCSIIO_CONTROL_SIMPLEQ (0x00000000) 122 #define MPI_SCSIIO_CONTROL_HEADOFQ (0x00000100) 123 #define MPI_SCSIIO_CONTROL_ORDEREDQ (0x00000200) 124 #define MPI_SCSIIO_CONTROL_ACAQ (0x00000400) 125 #define MPI_SCSIIO_CONTROL_UNTAGGED (0x00000500) 126 #define MPI_SCSIIO_CONTROL_NO_DISCONNECT (0x00000700) 127 128 #define MPI_SCSIIO_CONTROL_TASKMANAGE_MASK (0x00FF0000) 129 #define MPI_SCSIIO_CONTROL_OBSOLETE (0x00800000) 130 #define MPI_SCSIIO_CONTROL_CLEAR_ACA_RSV (0x00400000) 131 #define MPI_SCSIIO_CONTROL_TARGET_RESET (0x00200000) 132 #define MPI_SCSIIO_CONTROL_LUN_RESET_RSV (0x00100000) 133 #define MPI_SCSIIO_CONTROL_RESERVED (0x00080000) 134 #define MPI_SCSIIO_CONTROL_CLR_TASK_SET_RSV (0x00040000) 135 #define MPI_SCSIIO_CONTROL_ABORT_TASK_SET (0x00020000) 136 #define MPI_SCSIIO_CONTROL_RESERVED2 (0x00010000) 137 138 139 /* SCSIIO reply structure */ 140 typedef struct _MSG_SCSI_IO_REPLY 141 { 142 U8 TargetID; /* 00h */ 143 U8 Bus; /* 01h */ 144 U8 MsgLength; /* 02h */ 145 U8 Function; /* 03h */ 146 U8 CDBLength; /* 04h */ 147 U8 SenseBufferLength; /* 05h */ 148 U8 Reserved; /* 06h */ 149 U8 MsgFlags; /* 07h */ 150 U32 MsgContext; /* 08h */ 151 U8 SCSIStatus; /* 0Ch */ 152 U8 SCSIState; /* 0Dh */ 153 U16 IOCStatus; /* 0Eh */ 154 U32 IOCLogInfo; /* 10h */ 155 U32 TransferCount; /* 14h */ 156 U32 SenseCount; /* 18h */ 157 U32 ResponseInfo; /* 1Ch */ 158 } MSG_SCSI_IO_REPLY, MPI_POINTER PTR_MSG_SCSI_IO_REPLY, 159 SCSIIOReply_t, MPI_POINTER pSCSIIOReply_t; 160 161 162 /* SCSIIO Reply SCSIStatus values (SAM-2 status codes) */ 163 164 #define MPI_SCSI_STATUS_SUCCESS (0x00) 165 #define MPI_SCSI_STATUS_CHECK_CONDITION (0x02) 166 #define MPI_SCSI_STATUS_CONDITION_MET (0x04) 167 #define MPI_SCSI_STATUS_BUSY (0x08) 168 #define MPI_SCSI_STATUS_INTERMEDIATE (0x10) 169 #define MPI_SCSI_STATUS_INTERMEDIATE_CONDMET (0x14) 170 #define MPI_SCSI_STATUS_RESERVATION_CONFLICT (0x18) 171 #define MPI_SCSI_STATUS_COMMAND_TERMINATED (0x22) 172 #define MPI_SCSI_STATUS_TASK_SET_FULL (0x28) 173 #define MPI_SCSI_STATUS_ACA_ACTIVE (0x30) 174 175 176 /* SCSIIO Reply SCSIState values */ 177 178 #define MPI_SCSI_STATE_AUTOSENSE_VALID (0x01) 179 #define MPI_SCSI_STATE_AUTOSENSE_FAILED (0x02) 180 #define MPI_SCSI_STATE_NO_SCSI_STATUS (0x04) 181 #define MPI_SCSI_STATE_TERMINATED (0x08) 182 #define MPI_SCSI_STATE_RESPONSE_INFO_VALID (0x10) 183 #define MPI_SCSI_STATE_QUEUE_TAG_REJECTED (0x20) 184 185 /* SCSIIO Reply ResponseInfo values */ 186 /* (FCP-1 RSP_CODE values and SPI-3 Packetized Failure codes) */ 187 188 #define MPI_SCSI_RSP_INFO_FUNCTION_COMPLETE (0x00000000) 189 #define MPI_SCSI_RSP_INFO_FCP_BURST_LEN_ERROR (0x01000000) 190 #define MPI_SCSI_RSP_INFO_CMND_FIELDS_INVALID (0x02000000) 191 #define MPI_SCSI_RSP_INFO_FCP_DATA_RO_ERROR (0x03000000) 192 #define MPI_SCSI_RSP_INFO_TASK_MGMT_UNSUPPORTED (0x04000000) 193 #define MPI_SCSI_RSP_INFO_TASK_MGMT_FAILED (0x05000000) 194 #define MPI_SCSI_RSP_INFO_SPI_LQ_INVALID_TYPE (0x06000000) 195 196 197 /****************************************************************************/ 198 /* SCSI Task Management messages */ 199 /****************************************************************************/ 200 201 typedef struct _MSG_SCSI_TASK_MGMT 202 { 203 U8 TargetID; /* 00h */ 204 U8 Bus; /* 01h */ 205 U8 ChainOffset; /* 02h */ 206 U8 Function; /* 03h */ 207 U8 Reserved; /* 04h */ 208 U8 TaskType; /* 05h */ 209 U8 Reserved1; /* 06h */ 210 U8 MsgFlags; /* 07h */ 211 U32 MsgContext; /* 08h */ 212 U8 LUN[8]; /* 0Ch */ 213 U32 Reserved2[7]; /* 14h */ 214 U32 TaskMsgContext; /* 30h */ 215 } MSG_SCSI_TASK_MGMT, MPI_POINTER PTR_SCSI_TASK_MGMT, 216 SCSITaskMgmt_t, MPI_POINTER pSCSITaskMgmt_t; 217 218 /* TaskType values */ 219 220 #define MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK (0x01) 221 #define MPI_SCSITASKMGMT_TASKTYPE_ABRT_TASK_SET (0x02) 222 #define MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET (0x03) 223 #define MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS (0x04) 224 #define MPI_SCSITASKMGMT_TASKTYPE_LOGICAL_UNIT_RESET (0x05) 225 226 /* MsgFlags bits */ 227 #define MPI_SCSITASKMGMT_MSGFLAGS_TARGET_RESET_OPTION (0x00) 228 #define MPI_SCSITASKMGMT_MSGFLAGS_LIP_RESET_OPTION (0x02) 229 #define MPI_SCSITASKMGMT_MSGFLAGS_LIPRESET_RESET_OPTION (0x04) 230 231 /* SCSI Task Management Reply */ 232 typedef struct _MSG_SCSI_TASK_MGMT_REPLY 233 { 234 U8 TargetID; /* 00h */ 235 U8 Bus; /* 01h */ 236 U8 MsgLength; /* 02h */ 237 U8 Function; /* 03h */ 238 U8 Reserved; /* 04h */ 239 U8 TaskType; /* 05h */ 240 U8 Reserved1; /* 06h */ 241 U8 MsgFlags; /* 07h */ 242 U32 MsgContext; /* 08h */ 243 U8 Reserved2[2]; /* 0Ch */ 244 U16 IOCStatus; /* 0Eh */ 245 U32 IOCLogInfo; /* 10h */ 246 U32 TerminationCount; /* 14h */ 247 } MSG_SCSI_TASK_MGMT_REPLY, MPI_POINTER PTR_MSG_SCSI_TASK_MGMT_REPLY, 248 SCSITaskMgmtReply_t, MPI_POINTER pSCSITaskMgmtReply_t; 249 250 251 /****************************************************************************/ 252 /* SCSI Enclosure Processor messages */ 253 /****************************************************************************/ 254 255 typedef struct _MSG_SEP_REQUEST 256 { 257 U8 TargetID; /* 00h */ 258 U8 Bus; /* 01h */ 259 U8 ChainOffset; /* 02h */ 260 U8 Function; /* 03h */ 261 U8 Action; /* 04h */ 262 U8 Reserved1; /* 05h */ 263 U8 Reserved2; /* 06h */ 264 U8 MsgFlags; /* 07h */ 265 U32 MsgContext; /* 08h */ 266 U32 SlotStatus; /* 0Ch */ 267 } MSG_SEP_REQUEST, MPI_POINTER PTR_MSG_SEP_REQUEST, 268 SEPRequest_t, MPI_POINTER pSEPRequest_t; 269 270 /* Action defines */ 271 #define MPI_SEP_REQ_ACTION_WRITE_STATUS (0x00) 272 #define MPI_SEP_REQ_ACTION_READ_STATUS (0x01) 273 274 /* SlotStatus bits for MSG_SEP_REQUEST */ 275 #define MPI_SEP_REQ_SLOTSTATUS_NO_ERROR (0x00000001) 276 #define MPI_SEP_REQ_SLOTSTATUS_DEV_FAULTY (0x00000002) 277 #define MPI_SEP_REQ_SLOTSTATUS_DEV_REBUILDING (0x00000004) 278 #define MPI_SEP_REQ_SLOTSTATUS_IN_FAILED_ARRAY (0x00000008) 279 #define MPI_SEP_REQ_SLOTSTATUS_IN_CRITICAL_ARRAY (0x00000010) 280 #define MPI_SEP_REQ_SLOTSTATUS_PARITY_CHECK (0x00000020) 281 #define MPI_SEP_REQ_SLOTSTATUS_PREDICTED_FAULT (0x00000040) 282 #define MPI_SEP_REQ_SLOTSTATUS_UNCONFIGURED (0x00000080) 283 #define MPI_SEP_REQ_SLOTSTATUS_HOT_SPARE (0x00000100) 284 #define MPI_SEP_REQ_SLOTSTATUS_REBUILD_STOPPED (0x00000200) 285 #define MPI_SEP_REQ_SLOTSTATUS_IDENTIFY_REQUEST (0x00020000) 286 #define MPI_SEP_REQ_SLOTSTATUS_REQUEST_REMOVE (0x00040000) 287 #define MPI_SEP_REQ_SLOTSTATUS_REQUEST_INSERT (0x00080000) 288 #define MPI_SEP_REQ_SLOTSTATUS_DO_NOT_MOVE (0x00400000) 289 #define MPI_SEP_REQ_SLOTSTATUS_B_ENABLE_BYPASS (0x04000000) 290 #define MPI_SEP_REQ_SLOTSTATUS_A_ENABLE_BYPASS (0x08000000) 291 #define MPI_SEP_REQ_SLOTSTATUS_DEV_OFF (0x10000000) 292 #define MPI_SEP_REQ_SLOTSTATUS_SWAP_RESET (0x80000000) 293 294 295 typedef struct _MSG_SEP_REPLY 296 { 297 U8 TargetID; /* 00h */ 298 U8 Bus; /* 01h */ 299 U8 MsgLength; /* 02h */ 300 U8 Function; /* 03h */ 301 U8 Action; /* 04h */ 302 U8 Reserved1; /* 05h */ 303 U8 Reserved2; /* 06h */ 304 U8 MsgFlags; /* 07h */ 305 U32 MsgContext; /* 08h */ 306 U16 Reserved3; /* 0Ch */ 307 U16 IOCStatus; /* 0Eh */ 308 U32 IOCLogInfo; /* 10h */ 309 U32 SlotStatus; /* 14h */ 310 } MSG_SEP_REPLY, MPI_POINTER PTR_MSG_SEP_REPLY, 311 SEPReply_t, MPI_POINTER pSEPReply_t; 312 313 /* SlotStatus bits for MSG_SEP_REPLY */ 314 #define MPI_SEP_REPLY_SLOTSTATUS_NO_ERROR (0x00000001) 315 #define MPI_SEP_REPLY_SLOTSTATUS_DEV_FAULTY (0x00000002) 316 #define MPI_SEP_REPLY_SLOTSTATUS_DEV_REBUILDING (0x00000004) 317 #define MPI_SEP_REPLY_SLOTSTATUS_IN_FAILED_ARRAY (0x00000008) 318 #define MPI_SEP_REPLY_SLOTSTATUS_IN_CRITICAL_ARRAY (0x00000010) 319 #define MPI_SEP_REPLY_SLOTSTATUS_PARITY_CHECK (0x00000020) 320 #define MPI_SEP_REPLY_SLOTSTATUS_PREDICTED_FAULT (0x00000040) 321 #define MPI_SEP_REPLY_SLOTSTATUS_UNCONFIGURED (0x00000080) 322 #define MPI_SEP_REPLY_SLOTSTATUS_HOT_SPARE (0x00000100) 323 #define MPI_SEP_REPLY_SLOTSTATUS_REBUILD_STOPPED (0x00000200) 324 #define MPI_SEP_REPLY_SLOTSTATUS_REPORT (0x00010000) 325 #define MPI_SEP_REPLY_SLOTSTATUS_IDENTIFY_REQUEST (0x00020000) 326 #define MPI_SEP_REPLY_SLOTSTATUS_REMOVE_READY (0x00040000) 327 #define MPI_SEP_REPLY_SLOTSTATUS_INSERT_READY (0x00080000) 328 #define MPI_SEP_REPLY_SLOTSTATUS_DO_NOT_REMOVE (0x00400000) 329 #define MPI_SEP_REPLY_SLOTSTATUS_B_BYPASS_ENABLED (0x01000000) 330 #define MPI_SEP_REPLY_SLOTSTATUS_A_BYPASS_ENABLED (0x02000000) 331 #define MPI_SEP_REPLY_SLOTSTATUS_B_ENABLE_BYPASS (0x04000000) 332 #define MPI_SEP_REPLY_SLOTSTATUS_A_ENABLE_BYPASS (0x08000000) 333 #define MPI_SEP_REPLY_SLOTSTATUS_DEV_OFF (0x10000000) 334 #define MPI_SEP_REPLY_SLOTSTATUS_FAULT_SENSED (0x40000000) 335 #define MPI_SEP_REPLY_SLOTSTATUS_SWAPPED (0x80000000) 336 337 #endif 338