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