12311Sjkh/*- 22311Sjkh * Copyright 2000-2020 Broadcom Inc. All rights reserved. 32311Sjkh * 42311Sjkh * Redistribution and use in source and binary forms, with or without 52311Sjkh * modification, are permitted provided that the following conditions 62311Sjkh * are met: 72311Sjkh * 1. Redistributions of source code must retain the above copyright 82311Sjkh * notice, this list of conditions and the following disclaimer. 92311Sjkh * 2. Redistributions in binary form must reproduce the above copyright 102311Sjkh * notice, this list of conditions and the following disclaimer in the 112311Sjkh * documentation and/or other materials provided with the distribution. 122311Sjkh * 3. Neither the name of the author nor the names of any co-contributors 132311Sjkh * may be used to endorse or promote products derived from this software 142311Sjkh * without specific prior written permission. 152311Sjkh * 162311Sjkh * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 172311Sjkh * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 182311Sjkh * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 192311Sjkh * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 202311Sjkh * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 212311Sjkh * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 222311Sjkh * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 232311Sjkh * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 242311Sjkh * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 252311Sjkh * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 262311Sjkh * SUCH DAMAGE. 2729452Scharnier * 282311Sjkh * Broadcom Inc. (LSI) MPT-Fusion Host Adapter FreeBSD 2929452Scharnier */ 3029452Scharnier 3150479Speter/* 322311Sjkh * Copyright 2000-2020 Broadcom Inc. All rights reserved. 332311Sjkh * 342311Sjkh * 352311Sjkh * Name: mpi2_sas.h 3645369Speter * Title: MPI Serial Attached SCSI structures and definitions 3769793Sobrien * Creation Date: February 9, 2007 3862367Sache * 3962367Sache * mpi2_sas.h Version: 02.00.10 4062367Sache * 4162367Sache * NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25 4262367Sache * prefix are for use only on MPI v2.5 products, and must not be used 4362367Sache * with MPI v2.0 products. Unless otherwise noted, names beginning with 442311Sjkh * MPI2 or Mpi2 are for use with both MPI v2.0 and MPI v2.5 products. 452311Sjkh * 4620573Spst * Version History 472311Sjkh * --------------- 482311Sjkh * 492311Sjkh * Date Version Description 502311Sjkh * -------- -------- ------------------------------------------------------ 512311Sjkh * 04-30-07 02.00.00 Corresponds to Fusion-MPT MPI Specification Rev A. 522311Sjkh * 06-26-07 02.00.01 Added Clear All Persistent Operation to SAS IO Unit 532311Sjkh * Control Request. 542311Sjkh * 10-02-08 02.00.02 Added Set IOC Parameter Operation to SAS IO Unit Control 552311Sjkh * Request. 562311Sjkh * 10-28-09 02.00.03 Changed the type of SGL in MPI2_SATA_PASSTHROUGH_REQUEST 572311Sjkh * to MPI2_SGE_IO_UNION since it supports chained SGLs. 5862367Sache * 05-12-10 02.00.04 Modified some comments. 592311Sjkh * 08-11-10 02.00.05 Added NCQ operations to SAS IO Unit Control. 6062367Sache * 11-18-11 02.00.06 Incorporating additions for MPI v2.5. 612311Sjkh * 07-10-12 02.00.07 Added MPI2_SATA_PT_SGE_UNION for use in the SATA 622311Sjkh * Passthrough Request message. 632311Sjkh * 08-19-13 02.00.08 Made MPI2_SAS_OP_TRANSMIT_PORT_SELECT_SIGNAL obsolete 642311Sjkh * for anything newer than MPI v2.0. 652311Sjkh * 11-18-14 02.00.09 Updated copyright information. 6662367Sache * 03-16-15 02.00.10 Updated for MPI v2.6. 6720573Spst * Added MPI2_SATA_PT_REQ_PT_FLAGS_FPDMA. 6862367Sache * -------------------------------------------------------------------------- 6962367Sache */ 7062367Sache 7162367Sache#ifndef MPI2_SAS_H 722311Sjkh#define MPI2_SAS_H 732311Sjkh 742311Sjkh/* 752311Sjkh * Values for SASStatus. 762311Sjkh */ 772311Sjkh#define MPI2_SASSTATUS_SUCCESS (0x00) 782311Sjkh#define MPI2_SASSTATUS_UNKNOWN_ERROR (0x01) 7929452Scharnier#define MPI2_SASSTATUS_INVALID_FRAME (0x02) 802311Sjkh#define MPI2_SASSTATUS_UTC_BAD_DEST (0x03) 812311Sjkh#define MPI2_SASSTATUS_UTC_BREAK_RECEIVED (0x04) 822311Sjkh#define MPI2_SASSTATUS_UTC_CONNECT_RATE_NOT_SUPPORTED (0x05) 832311Sjkh#define MPI2_SASSTATUS_UTC_PORT_LAYER_REQUEST (0x06) 842311Sjkh#define MPI2_SASSTATUS_UTC_PROTOCOL_NOT_SUPPORTED (0x07) 852311Sjkh#define MPI2_SASSTATUS_UTC_STP_RESOURCES_BUSY (0x08) 862311Sjkh#define MPI2_SASSTATUS_UTC_WRONG_DESTINATION (0x09) 872311Sjkh#define MPI2_SASSTATUS_SHORT_INFORMATION_UNIT (0x0A) 882311Sjkh#define MPI2_SASSTATUS_LONG_INFORMATION_UNIT (0x0B) 892311Sjkh#define MPI2_SASSTATUS_XFER_RDY_INCORRECT_WRITE_DATA (0x0C) 902311Sjkh#define MPI2_SASSTATUS_XFER_RDY_REQUEST_OFFSET_ERROR (0x0D) 912311Sjkh#define MPI2_SASSTATUS_XFER_RDY_NOT_EXPECTED (0x0E) 922311Sjkh#define MPI2_SASSTATUS_DATA_INCORRECT_DATA_LENGTH (0x0F) 9320573Spst#define MPI2_SASSTATUS_DATA_TOO_MUCH_READ_DATA (0x10) 942311Sjkh#define MPI2_SASSTATUS_DATA_OFFSET_ERROR (0x11) 952311Sjkh#define MPI2_SASSTATUS_SDSF_NAK_RECEIVED (0x12) 9662365Sache#define MPI2_SASSTATUS_SDSF_CONNECTION_FAILED (0x13) 972311Sjkh#define MPI2_SASSTATUS_INITIATOR_RESPONSE_TIMEOUT (0x14) 982311Sjkh 992311Sjkh/* 1002311Sjkh * Values for the SAS DeviceInfo field used in SAS Device Status Change Event 1012311Sjkh * data and SAS Configuration pages. 1022311Sjkh */ 1032311Sjkh#define MPI2_SAS_DEVICE_INFO_SEP (0x00004000) 1042311Sjkh#define MPI2_SAS_DEVICE_INFO_ATAPI_DEVICE (0x00002000) 1052311Sjkh#define MPI2_SAS_DEVICE_INFO_LSI_DEVICE (0x00001000) 1062311Sjkh#define MPI2_SAS_DEVICE_INFO_DIRECT_ATTACH (0x00000800) 1072311Sjkh#define MPI2_SAS_DEVICE_INFO_SSP_TARGET (0x00000400) 1082311Sjkh#define MPI2_SAS_DEVICE_INFO_STP_TARGET (0x00000200) 1092311Sjkh#define MPI2_SAS_DEVICE_INFO_SMP_TARGET (0x00000100) 1102311Sjkh#define MPI2_SAS_DEVICE_INFO_SATA_DEVICE (0x00000080) 1112311Sjkh#define MPI2_SAS_DEVICE_INFO_SSP_INITIATOR (0x00000040) 1122311Sjkh#define MPI2_SAS_DEVICE_INFO_STP_INITIATOR (0x00000020) 1132311Sjkh#define MPI2_SAS_DEVICE_INFO_SMP_INITIATOR (0x00000010) 1142311Sjkh#define MPI2_SAS_DEVICE_INFO_SATA_HOST (0x00000008) 1152311Sjkh 1162311Sjkh#define MPI2_SAS_DEVICE_INFO_MASK_DEVICE_TYPE (0x00000007) 1172311Sjkh#define MPI2_SAS_DEVICE_INFO_NO_DEVICE (0x00000000) 1182311Sjkh#define MPI2_SAS_DEVICE_INFO_END_DEVICE (0x00000001) 1192311Sjkh#define MPI2_SAS_DEVICE_INFO_EDGE_EXPANDER (0x00000002) 1202311Sjkh#define MPI2_SAS_DEVICE_INFO_FANOUT_EXPANDER (0x00000003) 1212311Sjkh 12262367Sache/***************************************************************************** 12362367Sache* 12462367Sache* SAS Messages 12562367Sache* 12662367Sache*****************************************************************************/ 12762367Sache 12862367Sache/**************************************************************************** 12962367Sache* SMP Passthrough messages 13062367Sache****************************************************************************/ 1312311Sjkh 13245369Speter/* SMP Passthrough Request Message */ 13345369Spetertypedef struct _MPI2_SMP_PASSTHROUGH_REQUEST 13469793Sobrien{ 1352311Sjkh U8 PassthroughFlags; /* 0x00 */ 1362311Sjkh U8 PhysicalPort; /* 0x01 */ 1372311Sjkh U8 ChainOffset; /* 0x02 */ 1382311Sjkh U8 Function; /* 0x03 */ 1392311Sjkh U16 RequestDataLength; /* 0x04 */ 1402311Sjkh U8 SGLFlags; /* 0x06 */ /* MPI v2.0 only. Reserved on MPI v2.5. */ 1412311Sjkh U8 MsgFlags; /* 0x07 */ 1422311Sjkh U8 VP_ID; /* 0x08 */ 1432311Sjkh U8 VF_ID; /* 0x09 */ 1442311Sjkh U16 Reserved1; /* 0x0A */ 1452311Sjkh U32 Reserved2; /* 0x0C */ 14645369Speter U64 SASAddress; /* 0x10 */ 14745369Speter U32 Reserved3; /* 0x18 */ 14869793Sobrien U32 Reserved4; /* 0x1C */ 14945369Speter MPI2_SIMPLE_SGE_UNION SGL; /* 0x20 */ /* MPI v2.5: IEEE Simple 64 elements only */ 15069793Sobrien} MPI2_SMP_PASSTHROUGH_REQUEST, MPI2_POINTER PTR_MPI2_SMP_PASSTHROUGH_REQUEST, 1512311Sjkh Mpi2SmpPassthroughRequest_t, MPI2_POINTER pMpi2SmpPassthroughRequest_t; 1522311Sjkh 15362367Sache/* values for PassthroughFlags field */ 15462367Sache#define MPI2_SMP_PT_REQ_PT_FLAGS_IMMEDIATE (0x80) 15562367Sache 15662367Sache/* MPI v2.0: use MPI2_SGLFLAGS_ defines from mpi2.h for the SGLFlags field */ 15762367Sache 15890276Sbbraun/* SMP Passthrough Reply Message */ 15962367Sachetypedef struct _MPI2_SMP_PASSTHROUGH_REPLY 16062367Sache{ 16162367Sache U8 PassthroughFlags; /* 0x00 */ 16262367Sache U8 PhysicalPort; /* 0x01 */ 16362367Sache U8 MsgLength; /* 0x02 */ 16462367Sache U8 Function; /* 0x03 */ 16562367Sache U16 ResponseDataLength; /* 0x04 */ 16662367Sache U8 SGLFlags; /* 0x06 */ 16762367Sache U8 MsgFlags; /* 0x07 */ 16862367Sache U8 VP_ID; /* 0x08 */ 16962367Sache U8 VF_ID; /* 0x09 */ 17062367Sache U16 Reserved1; /* 0x0A */ 17162367Sache U8 Reserved2; /* 0x0C */ 17262367Sache U8 SASStatus; /* 0x0D */ 17362367Sache U16 IOCStatus; /* 0x0E */ 17462367Sache U32 IOCLogInfo; /* 0x10 */ 175159523Smaxim U32 Reserved3; /* 0x14 */ 176159523Smaxim U8 ResponseData[4]; /* 0x18 */ 177159523Smaxim} MPI2_SMP_PASSTHROUGH_REPLY, MPI2_POINTER PTR_MPI2_SMP_PASSTHROUGH_REPLY, 178159523Smaxim Mpi2SmpPassthroughReply_t, MPI2_POINTER pMpi2SmpPassthroughReply_t; 17962367Sache 180159142Smaxim/* values for PassthroughFlags field */ 181159142Smaxim#define MPI2_SMP_PT_REPLY_PT_FLAGS_IMMEDIATE (0x80) 18262367Sache 183159142Smaxim/* values for SASStatus field are at the top of this file */ 184159142Smaxim 18562367Sache/**************************************************************************** 186159142Smaxim* SATA Passthrough messages 187159142Smaxim****************************************************************************/ 188159142Smaxim 189159142Smaximtypedef union _MPI2_SATA_PT_SGE_UNION 190159142Smaxim{ 19162367Sache MPI2_SGE_SIMPLE_UNION MpiSimple; /* MPI v2.0 only */ 19262367Sache MPI2_SGE_CHAIN_UNION MpiChain; /* MPI v2.0 only */ 19362376Sache MPI2_IEEE_SGE_SIMPLE_UNION IeeeSimple; 19462376Sache MPI2_IEEE_SGE_CHAIN_UNION IeeeChain; /* MPI v2.0 only */ 19562367Sache MPI25_IEEE_SGE_CHAIN64 IeeeChain64; /* MPI v2.5 only */ 19662367Sache} MPI2_SATA_PT_SGE_UNION, MPI2_POINTER PTR_MPI2_SATA_PT_SGE_UNION, 19762367Sache Mpi2SataPTSGEUnion_t, MPI2_POINTER pMpi2SataPTSGEUnion_t; 1982311Sjkh 1992311Sjkh/* SATA Passthrough Request Message */ 2002311Sjkhtypedef struct _MPI2_SATA_PASSTHROUGH_REQUEST 2012311Sjkh{ 2022311Sjkh U16 DevHandle; /* 0x00 */ 2032311Sjkh U8 ChainOffset; /* 0x02 */ 2042311Sjkh U8 Function; /* 0x03 */ 2052311Sjkh U16 PassthroughFlags; /* 0x04 */ 2062311Sjkh U8 SGLFlags; /* 0x06 */ /* MPI v2.0 only. Reserved on MPI v2.5. */ 2072311Sjkh U8 MsgFlags; /* 0x07 */ 2082311Sjkh U8 VP_ID; /* 0x08 */ 2092311Sjkh U8 VF_ID; /* 0x09 */ 2102311Sjkh U16 Reserved1; /* 0x0A */ 2112311Sjkh U32 Reserved2; /* 0x0C */ 2122311Sjkh U32 Reserved3; /* 0x10 */ 2132311Sjkh U32 Reserved4; /* 0x14 */ 2142311Sjkh U32 DataLength; /* 0x18 */ 2152311Sjkh U8 CommandFIS[20]; /* 0x1C */ 2162311Sjkh MPI2_SATA_PT_SGE_UNION SGL; /* 0x30 */ /* MPI v2.5: IEEE 64 elements only */ 2172311Sjkh} MPI2_SATA_PASSTHROUGH_REQUEST, MPI2_POINTER PTR_MPI2_SATA_PASSTHROUGH_REQUEST, 2182311Sjkh Mpi2SataPassthroughRequest_t, MPI2_POINTER pMpi2SataPassthroughRequest_t; 2192311Sjkh 2202311Sjkh/* values for PassthroughFlags field */ 2212311Sjkh#define MPI2_SATA_PT_REQ_PT_FLAGS_EXECUTE_DIAG (0x0100) 2222311Sjkh#define MPI2_SATA_PT_REQ_PT_FLAGS_FPDMA (0x0040) /* MPI v2.6 and newer */ 2232311Sjkh#define MPI2_SATA_PT_REQ_PT_FLAGS_DMA (0x0020) 2242311Sjkh#define MPI2_SATA_PT_REQ_PT_FLAGS_PIO (0x0010) 2252311Sjkh#define MPI2_SATA_PT_REQ_PT_FLAGS_UNSPECIFIED_VU (0x0004) 2262311Sjkh#define MPI2_SATA_PT_REQ_PT_FLAGS_WRITE (0x0002) 2272311Sjkh#define MPI2_SATA_PT_REQ_PT_FLAGS_READ (0x0001) 2282311Sjkh 2292311Sjkh/* MPI v2.0: use MPI2_SGLFLAGS_ defines from mpi2.h for the SGLFlags field */ 2302311Sjkh 2312311Sjkh/* SATA Passthrough Reply Message */ 2322311Sjkhtypedef struct _MPI2_SATA_PASSTHROUGH_REPLY 2332311Sjkh{ 2342311Sjkh U16 DevHandle; /* 0x00 */ 2352311Sjkh U8 MsgLength; /* 0x02 */ 2362311Sjkh U8 Function; /* 0x03 */ 2372311Sjkh U16 PassthroughFlags; /* 0x04 */ 2382311Sjkh U8 SGLFlags; /* 0x06 */ 2392311Sjkh U8 MsgFlags; /* 0x07 */ 2402311Sjkh U8 VP_ID; /* 0x08 */ 2412311Sjkh U8 VF_ID; /* 0x09 */ 2422311Sjkh U16 Reserved1; /* 0x0A */ 2432311Sjkh U8 Reserved2; /* 0x0C */ 2442311Sjkh U8 SASStatus; /* 0x0D */ 2452311Sjkh U16 IOCStatus; /* 0x0E */ 2462311Sjkh U32 IOCLogInfo; /* 0x10 */ 2472311Sjkh U8 StatusFIS[20]; /* 0x14 */ 248 U32 StatusControlRegisters; /* 0x28 */ 249 U32 TransferCount; /* 0x2C */ 250} MPI2_SATA_PASSTHROUGH_REPLY, MPI2_POINTER PTR_MPI2_SATA_PASSTHROUGH_REPLY, 251 Mpi2SataPassthroughReply_t, MPI2_POINTER pMpi2SataPassthroughReply_t; 252 253/* values for SASStatus field are at the top of this file */ 254 255/**************************************************************************** 256* SAS IO Unit Control messages 257* (MPI v2.5 and earlier only. 258* Replaced by IO Unit Control messages in MPI v2.6 and later.) 259****************************************************************************/ 260 261/* SAS IO Unit Control Request Message */ 262typedef 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/* SAS IO Unit Control Reply Message */ 319typedef struct _MPI2_SAS_IOUNIT_CONTROL_REPLY 320{ 321 U8 Operation; /* 0x00 */ 322 U8 Reserved1; /* 0x01 */ 323 U8 MsgLength; /* 0x02 */ 324 U8 Function; /* 0x03 */ 325 U16 DevHandle; /* 0x04 */ 326 U8 IOCParameter; /* 0x06 */ 327 U8 MsgFlags; /* 0x07 */ 328 U8 VP_ID; /* 0x08 */ 329 U8 VF_ID; /* 0x09 */ 330 U16 Reserved3; /* 0x0A */ 331 U16 Reserved4; /* 0x0C */ 332 U16 IOCStatus; /* 0x0E */ 333 U32 IOCLogInfo; /* 0x10 */ 334} MPI2_SAS_IOUNIT_CONTROL_REPLY, 335 MPI2_POINTER PTR_MPI2_SAS_IOUNIT_CONTROL_REPLY, 336 Mpi2SasIoUnitControlReply_t, MPI2_POINTER pMpi2SasIoUnitControlReply_t; 337 338#endif 339