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