xref: /freebsd/sys/dev/mpr/mpi/mpi2_sas.h (revision 13464e4a44fc58490a03bb8bfc7e3c972e9c30b2)
1 /*-
2  * Copyright (c) 2012-2015 LSI Corp.
3  * Copyright (c) 2013-2016 Avago Technologies
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
8  * are 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 the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 3. Neither the name of the author nor the names of any co-contributors
15  *    may be used to endorse or promote products derived from this software
16  *    without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28  * SUCH DAMAGE.
29  *
30  * Avago Technologies (LSI) MPT-Fusion Host Adapter FreeBSD
31  *
32  * $FreeBSD$
33  */
34 
35 /*
36  *  Copyright (c) 2000-2015 LSI Corporation.
37  *  Copyright (c) 2013-2016 Avago Technologies
38  *  All rights reserved.
39  *
40  *
41  *           Name:  mpi2_sas.h
42  *          Title:  MPI Serial Attached SCSI structures and definitions
43  *  Creation Date:  February 9, 2007
44  *
45  *  mpi2_sas.h Version:  02.00.10
46  *
47  *  NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25
48  *        prefix are for use only on MPI v2.5 products, and must not be used
49  *        with MPI v2.0 products. Unless otherwise noted, names beginning with
50  *        MPI2 or Mpi2 are for use with both MPI v2.0 and MPI v2.5 products.
51  *
52  *  Version History
53  *  ---------------
54  *
55  *  Date      Version   Description
56  *  --------  --------  ------------------------------------------------------
57  *  04-30-07  02.00.00  Corresponds to Fusion-MPT MPI Specification Rev A.
58  *  06-26-07  02.00.01  Added Clear All Persistent Operation to SAS IO Unit
59  *                      Control Request.
60  *  10-02-08  02.00.02  Added Set IOC Parameter Operation to SAS IO Unit Control
61  *                      Request.
62  *  10-28-09  02.00.03  Changed the type of SGL in MPI2_SATA_PASSTHROUGH_REQUEST
63  *                      to MPI2_SGE_IO_UNION since it supports chained SGLs.
64  *  05-12-10  02.00.04  Modified some comments.
65  *  08-11-10  02.00.05  Added NCQ operations to SAS IO Unit Control.
66  *  11-18-11  02.00.06  Incorporating additions for MPI v2.5.
67  *  07-10-12  02.00.07  Added MPI2_SATA_PT_SGE_UNION for use in the SATA
68  *                      Passthrough Request message.
69  *  08-19-13  02.00.08  Made MPI2_SAS_OP_TRANSMIT_PORT_SELECT_SIGNAL obsolete
70  *                      for anything newer than MPI v2.0.
71  *  11-18-14  02.00.09  Updated copyright information.
72  *  03-16-15  02.00.10  Updated for MPI v2.6.
73  *                      Added MPI2_SATA_PT_REQ_PT_FLAGS_FPDMA.
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 typedef union _MPI2_SATA_PT_SGE_UNION
200 {
201     MPI2_SGE_SIMPLE_UNION       MpiSimple;      /* MPI v2.0 only */
202     MPI2_SGE_CHAIN_UNION        MpiChain;       /* MPI v2.0 only */
203     MPI2_IEEE_SGE_SIMPLE_UNION  IeeeSimple;
204     MPI2_IEEE_SGE_CHAIN_UNION   IeeeChain;      /* MPI v2.0 only */
205     MPI25_IEEE_SGE_CHAIN64      IeeeChain64;    /* MPI v2.5 only */
206 } MPI2_SATA_PT_SGE_UNION, MPI2_POINTER PTR_MPI2_SATA_PT_SGE_UNION,
207   Mpi2SataPTSGEUnion_t, MPI2_POINTER pMpi2SataPTSGEUnion_t;
208 
209 
210 /* SATA Passthrough Request Message */
211 typedef struct _MPI2_SATA_PASSTHROUGH_REQUEST
212 {
213     U16                     DevHandle;          /* 0x00 */
214     U8                      ChainOffset;        /* 0x02 */
215     U8                      Function;           /* 0x03 */
216     U16                     PassthroughFlags;   /* 0x04 */
217     U8                      SGLFlags;           /* 0x06 */ /* MPI v2.0 only. Reserved on MPI v2.5. */
218     U8                      MsgFlags;           /* 0x07 */
219     U8                      VP_ID;              /* 0x08 */
220     U8                      VF_ID;              /* 0x09 */
221     U16                     Reserved1;          /* 0x0A */
222     U32                     Reserved2;          /* 0x0C */
223     U32                     Reserved3;          /* 0x10 */
224     U32                     Reserved4;          /* 0x14 */
225     U32                     DataLength;         /* 0x18 */
226     U8                      CommandFIS[20];     /* 0x1C */
227     MPI2_SATA_PT_SGE_UNION  SGL;                /* 0x30 */ /* MPI v2.5: IEEE 64 elements only */
228 } MPI2_SATA_PASSTHROUGH_REQUEST, MPI2_POINTER PTR_MPI2_SATA_PASSTHROUGH_REQUEST,
229   Mpi2SataPassthroughRequest_t, MPI2_POINTER pMpi2SataPassthroughRequest_t;
230 
231 /* values for PassthroughFlags field */
232 #define MPI2_SATA_PT_REQ_PT_FLAGS_EXECUTE_DIAG      (0x0100)
233 #define MPI2_SATA_PT_REQ_PT_FLAGS_FPDMA             (0x0040) /* MPI v2.6 and newer */
234 #define MPI2_SATA_PT_REQ_PT_FLAGS_DMA               (0x0020)
235 #define MPI2_SATA_PT_REQ_PT_FLAGS_PIO               (0x0010)
236 #define MPI2_SATA_PT_REQ_PT_FLAGS_UNSPECIFIED_VU    (0x0004)
237 #define MPI2_SATA_PT_REQ_PT_FLAGS_WRITE             (0x0002)
238 #define MPI2_SATA_PT_REQ_PT_FLAGS_READ              (0x0001)
239 
240 /* MPI v2.0: use MPI2_SGLFLAGS_ defines from mpi2.h for the SGLFlags field */
241 
242 
243 /* SATA Passthrough Reply Message */
244 typedef struct _MPI2_SATA_PASSTHROUGH_REPLY
245 {
246     U16                     DevHandle;          /* 0x00 */
247     U8                      MsgLength;          /* 0x02 */
248     U8                      Function;           /* 0x03 */
249     U16                     PassthroughFlags;   /* 0x04 */
250     U8                      SGLFlags;           /* 0x06 */
251     U8                      MsgFlags;           /* 0x07 */
252     U8                      VP_ID;              /* 0x08 */
253     U8                      VF_ID;              /* 0x09 */
254     U16                     Reserved1;          /* 0x0A */
255     U8                      Reserved2;          /* 0x0C */
256     U8                      SASStatus;          /* 0x0D */
257     U16                     IOCStatus;          /* 0x0E */
258     U32                     IOCLogInfo;         /* 0x10 */
259     U8                      StatusFIS[20];      /* 0x14 */
260     U32                     StatusControlRegisters; /* 0x28 */
261     U32                     TransferCount;      /* 0x2C */
262 } MPI2_SATA_PASSTHROUGH_REPLY, MPI2_POINTER PTR_MPI2_SATA_PASSTHROUGH_REPLY,
263   Mpi2SataPassthroughReply_t, MPI2_POINTER pMpi2SataPassthroughReply_t;
264 
265 /* values for SASStatus field are at the top of this file */
266 
267 
268 /****************************************************************************
269 *  SAS IO Unit Control messages
270 *  (MPI v2.5 and earlier only.
271 *  Replaced by IO Unit Control messages in MPI v2.6 and later.)
272 ****************************************************************************/
273 
274 /* SAS IO Unit Control Request Message */
275 typedef struct _MPI2_SAS_IOUNIT_CONTROL_REQUEST
276 {
277     U8                      Operation;          /* 0x00 */
278     U8                      Reserved1;          /* 0x01 */
279     U8                      ChainOffset;        /* 0x02 */
280     U8                      Function;           /* 0x03 */
281     U16                     DevHandle;          /* 0x04 */
282     U8                      IOCParameter;       /* 0x06 */
283     U8                      MsgFlags;           /* 0x07 */
284     U8                      VP_ID;              /* 0x08 */
285     U8                      VF_ID;              /* 0x09 */
286     U16                     Reserved3;          /* 0x0A */
287     U16                     Reserved4;          /* 0x0C */
288     U8                      PhyNum;             /* 0x0E */
289     U8                      PrimFlags;          /* 0x0F */
290     U32                     Primitive;          /* 0x10 */
291     U8                      LookupMethod;       /* 0x14 */
292     U8                      Reserved5;          /* 0x15 */
293     U16                     SlotNumber;         /* 0x16 */
294     U64                     LookupAddress;      /* 0x18 */
295     U32                     IOCParameterValue;  /* 0x20 */
296     U32                     Reserved7;          /* 0x24 */
297     U32                     Reserved8;          /* 0x28 */
298 } MPI2_SAS_IOUNIT_CONTROL_REQUEST,
299   MPI2_POINTER PTR_MPI2_SAS_IOUNIT_CONTROL_REQUEST,
300   Mpi2SasIoUnitControlRequest_t, MPI2_POINTER pMpi2SasIoUnitControlRequest_t;
301 
302 /* values for the Operation field */
303 #define MPI2_SAS_OP_CLEAR_ALL_PERSISTENT        (0x02)
304 #define MPI2_SAS_OP_PHY_LINK_RESET              (0x06)
305 #define MPI2_SAS_OP_PHY_HARD_RESET              (0x07)
306 #define MPI2_SAS_OP_PHY_CLEAR_ERROR_LOG         (0x08)
307 #define MPI2_SAS_OP_SEND_PRIMITIVE              (0x0A)
308 #define MPI2_SAS_OP_FORCE_FULL_DISCOVERY        (0x0B)
309 #define MPI2_SAS_OP_TRANSMIT_PORT_SELECT_SIGNAL (0x0C) /* MPI v2.0 only */
310 #define MPI2_SAS_OP_REMOVE_DEVICE               (0x0D)
311 #define MPI2_SAS_OP_LOOKUP_MAPPING              (0x0E)
312 #define MPI2_SAS_OP_SET_IOC_PARAMETER           (0x0F)
313 #define MPI25_SAS_OP_ENABLE_FP_DEVICE           (0x10)
314 #define MPI25_SAS_OP_DISABLE_FP_DEVICE          (0x11)
315 #define MPI25_SAS_OP_ENABLE_FP_ALL              (0x12)
316 #define MPI25_SAS_OP_DISABLE_FP_ALL             (0x13)
317 #define MPI2_SAS_OP_DEV_ENABLE_NCQ              (0x14)
318 #define MPI2_SAS_OP_DEV_DISABLE_NCQ             (0x15)
319 #define MPI2_SAS_OP_PRODUCT_SPECIFIC_MIN        (0x80)
320 
321 /* values for the PrimFlags field */
322 #define MPI2_SAS_PRIMFLAGS_SINGLE               (0x08)
323 #define MPI2_SAS_PRIMFLAGS_TRIPLE               (0x02)
324 #define MPI2_SAS_PRIMFLAGS_REDUNDANT            (0x01)
325 
326 /* values for the LookupMethod field */
327 #define MPI2_SAS_LOOKUP_METHOD_SAS_ADDRESS          (0x01)
328 #define MPI2_SAS_LOOKUP_METHOD_SAS_ENCLOSURE_SLOT   (0x02)
329 #define MPI2_SAS_LOOKUP_METHOD_SAS_DEVICE_NAME      (0x03)
330 
331 
332 /* SAS IO Unit Control Reply Message */
333 typedef struct _MPI2_SAS_IOUNIT_CONTROL_REPLY
334 {
335     U8                      Operation;          /* 0x00 */
336     U8                      Reserved1;          /* 0x01 */
337     U8                      MsgLength;          /* 0x02 */
338     U8                      Function;           /* 0x03 */
339     U16                     DevHandle;          /* 0x04 */
340     U8                      IOCParameter;       /* 0x06 */
341     U8                      MsgFlags;           /* 0x07 */
342     U8                      VP_ID;              /* 0x08 */
343     U8                      VF_ID;              /* 0x09 */
344     U16                     Reserved3;          /* 0x0A */
345     U16                     Reserved4;          /* 0x0C */
346     U16                     IOCStatus;          /* 0x0E */
347     U32                     IOCLogInfo;         /* 0x10 */
348 } MPI2_SAS_IOUNIT_CONTROL_REPLY,
349   MPI2_POINTER PTR_MPI2_SAS_IOUNIT_CONTROL_REPLY,
350   Mpi2SasIoUnitControlReply_t, MPI2_POINTER pMpi2SasIoUnitControlReply_t;
351 
352 
353 #endif
354 
355 
356