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