1 /*- 2 * Copyright (c) 2013 LSI Corp. 3 * All rights reserved. 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, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 3. Neither the name of the author nor the names of any co-contributors 14 * may be used to endorse or promote products derived from this software 15 * without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30 /* 31 * Copyright (c) 2000-2013 LSI Corporation. 32 * 33 * 34 * Name: mpi2_sas.h 35 * Title: MPI Serial Attached SCSI structures and definitions 36 * Creation Date: February 9, 2007 37 * 38 * mpi2_sas.h Version: 02.00.08 39 * 40 * NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25 41 * prefix are for use only on MPI v2.5 products, and must not be used 42 * with MPI v2.0 products. Unless otherwise noted, names beginning with 43 * MPI2 or Mpi2 are for use with both MPI v2.0 and MPI v2.5 products. 44 * 45 * Version History 46 * --------------- 47 * 48 * Date Version Description 49 * -------- -------- ------------------------------------------------------ 50 * 04-30-07 02.00.00 Corresponds to Fusion-MPT MPI Specification Rev A. 51 * 06-26-07 02.00.01 Added Clear All Persistent Operation to SAS IO Unit 52 * Control Request. 53 * 10-02-08 02.00.02 Added Set IOC Parameter Operation to SAS IO Unit Control 54 * Request. 55 * 10-28-09 02.00.03 Changed the type of SGL in MPI2_SATA_PASSTHROUGH_REQUEST 56 * to MPI2_SGE_IO_UNION since it supports chained SGLs. 57 * 05-12-10 02.00.04 Modified some comments. 58 * 08-11-10 02.00.05 Added NCQ operations to SAS IO Unit Control. 59 * 11-18-11 02.00.06 Incorporating additions for MPI v2.5. 60 * 07-10-12 02.00.07 Added MPI2_SATA_PT_SGE_UNION for use in the SATA 61 * Passthrough Request message. 62 * 08-19-13 02.00.08 Made MPI2_SAS_OP_TRANSMIT_PORT_SELECT_SIGNAL obsolete 63 * for anything newer than MPI v2.0. 64 * -------------------------------------------------------------------------- 65 */ 66 67 #ifndef MPI2_SAS_H 68 #define MPI2_SAS_H 69 70 /* 71 * Values for SASStatus. 72 */ 73 #define MPI2_SASSTATUS_SUCCESS (0x00) 74 #define MPI2_SASSTATUS_UNKNOWN_ERROR (0x01) 75 #define MPI2_SASSTATUS_INVALID_FRAME (0x02) 76 #define MPI2_SASSTATUS_UTC_BAD_DEST (0x03) 77 #define MPI2_SASSTATUS_UTC_BREAK_RECEIVED (0x04) 78 #define MPI2_SASSTATUS_UTC_CONNECT_RATE_NOT_SUPPORTED (0x05) 79 #define MPI2_SASSTATUS_UTC_PORT_LAYER_REQUEST (0x06) 80 #define MPI2_SASSTATUS_UTC_PROTOCOL_NOT_SUPPORTED (0x07) 81 #define MPI2_SASSTATUS_UTC_STP_RESOURCES_BUSY (0x08) 82 #define MPI2_SASSTATUS_UTC_WRONG_DESTINATION (0x09) 83 #define MPI2_SASSTATUS_SHORT_INFORMATION_UNIT (0x0A) 84 #define MPI2_SASSTATUS_LONG_INFORMATION_UNIT (0x0B) 85 #define MPI2_SASSTATUS_XFER_RDY_INCORRECT_WRITE_DATA (0x0C) 86 #define MPI2_SASSTATUS_XFER_RDY_REQUEST_OFFSET_ERROR (0x0D) 87 #define MPI2_SASSTATUS_XFER_RDY_NOT_EXPECTED (0x0E) 88 #define MPI2_SASSTATUS_DATA_INCORRECT_DATA_LENGTH (0x0F) 89 #define MPI2_SASSTATUS_DATA_TOO_MUCH_READ_DATA (0x10) 90 #define MPI2_SASSTATUS_DATA_OFFSET_ERROR (0x11) 91 #define MPI2_SASSTATUS_SDSF_NAK_RECEIVED (0x12) 92 #define MPI2_SASSTATUS_SDSF_CONNECTION_FAILED (0x13) 93 #define MPI2_SASSTATUS_INITIATOR_RESPONSE_TIMEOUT (0x14) 94 95 96 /* 97 * Values for the SAS DeviceInfo field used in SAS Device Status Change Event 98 * data and SAS Configuration pages. 99 */ 100 #define MPI2_SAS_DEVICE_INFO_SEP (0x00004000) 101 #define MPI2_SAS_DEVICE_INFO_ATAPI_DEVICE (0x00002000) 102 #define MPI2_SAS_DEVICE_INFO_LSI_DEVICE (0x00001000) 103 #define MPI2_SAS_DEVICE_INFO_DIRECT_ATTACH (0x00000800) 104 #define MPI2_SAS_DEVICE_INFO_SSP_TARGET (0x00000400) 105 #define MPI2_SAS_DEVICE_INFO_STP_TARGET (0x00000200) 106 #define MPI2_SAS_DEVICE_INFO_SMP_TARGET (0x00000100) 107 #define MPI2_SAS_DEVICE_INFO_SATA_DEVICE (0x00000080) 108 #define MPI2_SAS_DEVICE_INFO_SSP_INITIATOR (0x00000040) 109 #define MPI2_SAS_DEVICE_INFO_STP_INITIATOR (0x00000020) 110 #define MPI2_SAS_DEVICE_INFO_SMP_INITIATOR (0x00000010) 111 #define MPI2_SAS_DEVICE_INFO_SATA_HOST (0x00000008) 112 113 #define MPI2_SAS_DEVICE_INFO_MASK_DEVICE_TYPE (0x00000007) 114 #define MPI2_SAS_DEVICE_INFO_NO_DEVICE (0x00000000) 115 #define MPI2_SAS_DEVICE_INFO_END_DEVICE (0x00000001) 116 #define MPI2_SAS_DEVICE_INFO_EDGE_EXPANDER (0x00000002) 117 #define MPI2_SAS_DEVICE_INFO_FANOUT_EXPANDER (0x00000003) 118 119 120 /***************************************************************************** 121 * 122 * SAS Messages 123 * 124 *****************************************************************************/ 125 126 /**************************************************************************** 127 * SMP Passthrough messages 128 ****************************************************************************/ 129 130 /* SMP Passthrough Request Message */ 131 typedef struct _MPI2_SMP_PASSTHROUGH_REQUEST 132 { 133 U8 PassthroughFlags; /* 0x00 */ 134 U8 PhysicalPort; /* 0x01 */ 135 U8 ChainOffset; /* 0x02 */ 136 U8 Function; /* 0x03 */ 137 U16 RequestDataLength; /* 0x04 */ 138 U8 SGLFlags; /* 0x06 */ /* MPI v2.0 only. Reserved on MPI v2.5. */ 139 U8 MsgFlags; /* 0x07 */ 140 U8 VP_ID; /* 0x08 */ 141 U8 VF_ID; /* 0x09 */ 142 U16 Reserved1; /* 0x0A */ 143 U32 Reserved2; /* 0x0C */ 144 U64 SASAddress; /* 0x10 */ 145 U32 Reserved3; /* 0x18 */ 146 U32 Reserved4; /* 0x1C */ 147 MPI2_SIMPLE_SGE_UNION SGL; /* 0x20 */ /* MPI v2.5: IEEE Simple 64 elements only */ 148 } MPI2_SMP_PASSTHROUGH_REQUEST, MPI2_POINTER PTR_MPI2_SMP_PASSTHROUGH_REQUEST, 149 Mpi2SmpPassthroughRequest_t, MPI2_POINTER pMpi2SmpPassthroughRequest_t; 150 151 /* values for PassthroughFlags field */ 152 #define MPI2_SMP_PT_REQ_PT_FLAGS_IMMEDIATE (0x80) 153 154 /* MPI v2.0: use MPI2_SGLFLAGS_ defines from mpi2.h for the SGLFlags field */ 155 156 157 /* SMP Passthrough Reply Message */ 158 typedef struct _MPI2_SMP_PASSTHROUGH_REPLY 159 { 160 U8 PassthroughFlags; /* 0x00 */ 161 U8 PhysicalPort; /* 0x01 */ 162 U8 MsgLength; /* 0x02 */ 163 U8 Function; /* 0x03 */ 164 U16 ResponseDataLength; /* 0x04 */ 165 U8 SGLFlags; /* 0x06 */ 166 U8 MsgFlags; /* 0x07 */ 167 U8 VP_ID; /* 0x08 */ 168 U8 VF_ID; /* 0x09 */ 169 U16 Reserved1; /* 0x0A */ 170 U8 Reserved2; /* 0x0C */ 171 U8 SASStatus; /* 0x0D */ 172 U16 IOCStatus; /* 0x0E */ 173 U32 IOCLogInfo; /* 0x10 */ 174 U32 Reserved3; /* 0x14 */ 175 U8 ResponseData[4]; /* 0x18 */ 176 } MPI2_SMP_PASSTHROUGH_REPLY, MPI2_POINTER PTR_MPI2_SMP_PASSTHROUGH_REPLY, 177 Mpi2SmpPassthroughReply_t, MPI2_POINTER pMpi2SmpPassthroughReply_t; 178 179 /* values for PassthroughFlags field */ 180 #define MPI2_SMP_PT_REPLY_PT_FLAGS_IMMEDIATE (0x80) 181 182 /* values for SASStatus field are at the top of this file */ 183 184 185 /**************************************************************************** 186 * SATA Passthrough messages 187 ****************************************************************************/ 188 189 typedef union _MPI2_SATA_PT_SGE_UNION 190 { 191 MPI2_SGE_SIMPLE_UNION MpiSimple; /* MPI v2.0 only */ 192 MPI2_SGE_CHAIN_UNION MpiChain; /* MPI v2.0 only */ 193 MPI2_IEEE_SGE_SIMPLE_UNION IeeeSimple; 194 MPI2_IEEE_SGE_CHAIN_UNION IeeeChain; /* MPI v2.0 only */ 195 MPI25_IEEE_SGE_CHAIN64 IeeeChain64; /* MPI v2.5 only */ 196 } MPI2_SATA_PT_SGE_UNION, MPI2_POINTER PTR_MPI2_SATA_PT_SGE_UNION, 197 Mpi2SataPTSGEUnion_t, MPI2_POINTER pMpi2SataPTSGEUnion_t; 198 199 200 /* SATA Passthrough Request Message */ 201 typedef struct _MPI2_SATA_PASSTHROUGH_REQUEST 202 { 203 U16 DevHandle; /* 0x00 */ 204 U8 ChainOffset; /* 0x02 */ 205 U8 Function; /* 0x03 */ 206 U16 PassthroughFlags; /* 0x04 */ 207 U8 SGLFlags; /* 0x06 */ /* MPI v2.0 only. Reserved on MPI v2.5. */ 208 U8 MsgFlags; /* 0x07 */ 209 U8 VP_ID; /* 0x08 */ 210 U8 VF_ID; /* 0x09 */ 211 U16 Reserved1; /* 0x0A */ 212 U32 Reserved2; /* 0x0C */ 213 U32 Reserved3; /* 0x10 */ 214 U32 Reserved4; /* 0x14 */ 215 U32 DataLength; /* 0x18 */ 216 U8 CommandFIS[20]; /* 0x1C */ 217 MPI2_SATA_PT_SGE_UNION SGL; /* 0x30 */ /* MPI v2.5: IEEE 64 elements only */ 218 } MPI2_SATA_PASSTHROUGH_REQUEST, MPI2_POINTER PTR_MPI2_SATA_PASSTHROUGH_REQUEST, 219 Mpi2SataPassthroughRequest_t, MPI2_POINTER pMpi2SataPassthroughRequest_t; 220 221 /* values for PassthroughFlags field */ 222 #define MPI2_SATA_PT_REQ_PT_FLAGS_EXECUTE_DIAG (0x0100) 223 #define MPI2_SATA_PT_REQ_PT_FLAGS_DMA (0x0020) 224 #define MPI2_SATA_PT_REQ_PT_FLAGS_PIO (0x0010) 225 #define MPI2_SATA_PT_REQ_PT_FLAGS_UNSPECIFIED_VU (0x0004) 226 #define MPI2_SATA_PT_REQ_PT_FLAGS_WRITE (0x0002) 227 #define MPI2_SATA_PT_REQ_PT_FLAGS_READ (0x0001) 228 229 /* MPI v2.0: use MPI2_SGLFLAGS_ defines from mpi2.h for the SGLFlags field */ 230 231 232 /* SATA Passthrough Reply Message */ 233 typedef struct _MPI2_SATA_PASSTHROUGH_REPLY 234 { 235 U16 DevHandle; /* 0x00 */ 236 U8 MsgLength; /* 0x02 */ 237 U8 Function; /* 0x03 */ 238 U16 PassthroughFlags; /* 0x04 */ 239 U8 SGLFlags; /* 0x06 */ 240 U8 MsgFlags; /* 0x07 */ 241 U8 VP_ID; /* 0x08 */ 242 U8 VF_ID; /* 0x09 */ 243 U16 Reserved1; /* 0x0A */ 244 U8 Reserved2; /* 0x0C */ 245 U8 SASStatus; /* 0x0D */ 246 U16 IOCStatus; /* 0x0E */ 247 U32 IOCLogInfo; /* 0x10 */ 248 U8 StatusFIS[20]; /* 0x14 */ 249 U32 StatusControlRegisters; /* 0x28 */ 250 U32 TransferCount; /* 0x2C */ 251 } MPI2_SATA_PASSTHROUGH_REPLY, MPI2_POINTER PTR_MPI2_SATA_PASSTHROUGH_REPLY, 252 Mpi2SataPassthroughReply_t, MPI2_POINTER pMpi2SataPassthroughReply_t; 253 254 /* values for SASStatus field are at the top of this file */ 255 256 257 /**************************************************************************** 258 * SAS IO Unit Control messages 259 ****************************************************************************/ 260 261 /* SAS IO Unit Control Request Message */ 262 typedef struct _MPI2_SAS_IOUNIT_CONTROL_REQUEST 263 { 264 U8 Operation; /* 0x00 */ 265 U8 Reserved1; /* 0x01 */ 266 U8 ChainOffset; /* 0x02 */ 267 U8 Function; /* 0x03 */ 268 U16 DevHandle; /* 0x04 */ 269 U8 IOCParameter; /* 0x06 */ 270 U8 MsgFlags; /* 0x07 */ 271 U8 VP_ID; /* 0x08 */ 272 U8 VF_ID; /* 0x09 */ 273 U16 Reserved3; /* 0x0A */ 274 U16 Reserved4; /* 0x0C */ 275 U8 PhyNum; /* 0x0E */ 276 U8 PrimFlags; /* 0x0F */ 277 U32 Primitive; /* 0x10 */ 278 U8 LookupMethod; /* 0x14 */ 279 U8 Reserved5; /* 0x15 */ 280 U16 SlotNumber; /* 0x16 */ 281 U64 LookupAddress; /* 0x18 */ 282 U32 IOCParameterValue; /* 0x20 */ 283 U32 Reserved7; /* 0x24 */ 284 U32 Reserved8; /* 0x28 */ 285 } MPI2_SAS_IOUNIT_CONTROL_REQUEST, 286 MPI2_POINTER PTR_MPI2_SAS_IOUNIT_CONTROL_REQUEST, 287 Mpi2SasIoUnitControlRequest_t, MPI2_POINTER pMpi2SasIoUnitControlRequest_t; 288 289 /* values for the Operation field */ 290 #define MPI2_SAS_OP_CLEAR_ALL_PERSISTENT (0x02) 291 #define MPI2_SAS_OP_PHY_LINK_RESET (0x06) 292 #define MPI2_SAS_OP_PHY_HARD_RESET (0x07) 293 #define MPI2_SAS_OP_PHY_CLEAR_ERROR_LOG (0x08) 294 #define MPI2_SAS_OP_SEND_PRIMITIVE (0x0A) 295 #define MPI2_SAS_OP_FORCE_FULL_DISCOVERY (0x0B) 296 #define MPI2_SAS_OP_TRANSMIT_PORT_SELECT_SIGNAL (0x0C) /* MPI v2.0 only */ 297 #define MPI2_SAS_OP_REMOVE_DEVICE (0x0D) 298 #define MPI2_SAS_OP_LOOKUP_MAPPING (0x0E) 299 #define MPI2_SAS_OP_SET_IOC_PARAMETER (0x0F) 300 #define MPI25_SAS_OP_ENABLE_FP_DEVICE (0x10) 301 #define MPI25_SAS_OP_DISABLE_FP_DEVICE (0x11) 302 #define MPI25_SAS_OP_ENABLE_FP_ALL (0x12) 303 #define MPI25_SAS_OP_DISABLE_FP_ALL (0x13) 304 #define MPI2_SAS_OP_DEV_ENABLE_NCQ (0x14) 305 #define MPI2_SAS_OP_DEV_DISABLE_NCQ (0x15) 306 #define MPI2_SAS_OP_PRODUCT_SPECIFIC_MIN (0x80) 307 308 /* values for the PrimFlags field */ 309 #define MPI2_SAS_PRIMFLAGS_SINGLE (0x08) 310 #define MPI2_SAS_PRIMFLAGS_TRIPLE (0x02) 311 #define MPI2_SAS_PRIMFLAGS_REDUNDANT (0x01) 312 313 /* values for the LookupMethod field */ 314 #define MPI2_SAS_LOOKUP_METHOD_SAS_ADDRESS (0x01) 315 #define MPI2_SAS_LOOKUP_METHOD_SAS_ENCLOSURE_SLOT (0x02) 316 #define MPI2_SAS_LOOKUP_METHOD_SAS_DEVICE_NAME (0x03) 317 318 319 /* SAS IO Unit Control Reply Message */ 320 typedef struct _MPI2_SAS_IOUNIT_CONTROL_REPLY 321 { 322 U8 Operation; /* 0x00 */ 323 U8 Reserved1; /* 0x01 */ 324 U8 MsgLength; /* 0x02 */ 325 U8 Function; /* 0x03 */ 326 U16 DevHandle; /* 0x04 */ 327 U8 IOCParameter; /* 0x06 */ 328 U8 MsgFlags; /* 0x07 */ 329 U8 VP_ID; /* 0x08 */ 330 U8 VF_ID; /* 0x09 */ 331 U16 Reserved3; /* 0x0A */ 332 U16 Reserved4; /* 0x0C */ 333 U16 IOCStatus; /* 0x0E */ 334 U32 IOCLogInfo; /* 0x10 */ 335 } MPI2_SAS_IOUNIT_CONTROL_REPLY, 336 MPI2_POINTER PTR_MPI2_SAS_IOUNIT_CONTROL_REPLY, 337 Mpi2SasIoUnitControlReply_t, MPI2_POINTER pMpi2SasIoUnitControlReply_t; 338 339 340 #endif 341 342 343