xref: /freebsd/sys/dev/mps/mpi/mpi2_sas.h (revision c697fb7f)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3  *
4  * Copyright (c) 2007-2015 LSI Corp.
5  * Copyright (c) 2013-2015 Avago Technologies
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
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  * Avago Technologies (LSI) MPT-Fusion Host Adapter FreeBSD
30  *
31  * $FreeBSD$
32  */
33 
34 /*
35  *  Copyright (c) 2007-2015 LSI Corporation.
36  *  Copyright (c) 2013-2015 Avago Technologies
37  *
38  *
39  *           Name:  mpi2_sas.h
40  *          Title:  MPI Serial Attached SCSI structures and definitions
41  *  Creation Date:  February 9, 2007
42  *
43  *  mpi2_sas.h Version:  02.00.05
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  *  --------------------------------------------------------------------------
60  */
61 
62 #ifndef MPI2_SAS_H
63 #define MPI2_SAS_H
64 
65 /*
66  * Values for SASStatus.
67  */
68 #define MPI2_SASSTATUS_SUCCESS                          (0x00)
69 #define MPI2_SASSTATUS_UNKNOWN_ERROR                    (0x01)
70 #define MPI2_SASSTATUS_INVALID_FRAME                    (0x02)
71 #define MPI2_SASSTATUS_UTC_BAD_DEST                     (0x03)
72 #define MPI2_SASSTATUS_UTC_BREAK_RECEIVED               (0x04)
73 #define MPI2_SASSTATUS_UTC_CONNECT_RATE_NOT_SUPPORTED   (0x05)
74 #define MPI2_SASSTATUS_UTC_PORT_LAYER_REQUEST           (0x06)
75 #define MPI2_SASSTATUS_UTC_PROTOCOL_NOT_SUPPORTED       (0x07)
76 #define MPI2_SASSTATUS_UTC_STP_RESOURCES_BUSY           (0x08)
77 #define MPI2_SASSTATUS_UTC_WRONG_DESTINATION            (0x09)
78 #define MPI2_SASSTATUS_SHORT_INFORMATION_UNIT           (0x0A)
79 #define MPI2_SASSTATUS_LONG_INFORMATION_UNIT            (0x0B)
80 #define MPI2_SASSTATUS_XFER_RDY_INCORRECT_WRITE_DATA    (0x0C)
81 #define MPI2_SASSTATUS_XFER_RDY_REQUEST_OFFSET_ERROR    (0x0D)
82 #define MPI2_SASSTATUS_XFER_RDY_NOT_EXPECTED            (0x0E)
83 #define MPI2_SASSTATUS_DATA_INCORRECT_DATA_LENGTH       (0x0F)
84 #define MPI2_SASSTATUS_DATA_TOO_MUCH_READ_DATA          (0x10)
85 #define MPI2_SASSTATUS_DATA_OFFSET_ERROR                (0x11)
86 #define MPI2_SASSTATUS_SDSF_NAK_RECEIVED                (0x12)
87 #define MPI2_SASSTATUS_SDSF_CONNECTION_FAILED           (0x13)
88 #define MPI2_SASSTATUS_INITIATOR_RESPONSE_TIMEOUT       (0x14)
89 
90 
91 /*
92  * Values for the SAS DeviceInfo field used in SAS Device Status Change Event
93  * data and SAS Configuration pages.
94  */
95 #define MPI2_SAS_DEVICE_INFO_SEP                (0x00004000)
96 #define MPI2_SAS_DEVICE_INFO_ATAPI_DEVICE       (0x00002000)
97 #define MPI2_SAS_DEVICE_INFO_LSI_DEVICE         (0x00001000)
98 #define MPI2_SAS_DEVICE_INFO_DIRECT_ATTACH      (0x00000800)
99 #define MPI2_SAS_DEVICE_INFO_SSP_TARGET         (0x00000400)
100 #define MPI2_SAS_DEVICE_INFO_STP_TARGET         (0x00000200)
101 #define MPI2_SAS_DEVICE_INFO_SMP_TARGET         (0x00000100)
102 #define MPI2_SAS_DEVICE_INFO_SATA_DEVICE        (0x00000080)
103 #define MPI2_SAS_DEVICE_INFO_SSP_INITIATOR      (0x00000040)
104 #define MPI2_SAS_DEVICE_INFO_STP_INITIATOR      (0x00000020)
105 #define MPI2_SAS_DEVICE_INFO_SMP_INITIATOR      (0x00000010)
106 #define MPI2_SAS_DEVICE_INFO_SATA_HOST          (0x00000008)
107 
108 #define MPI2_SAS_DEVICE_INFO_MASK_DEVICE_TYPE   (0x00000007)
109 #define MPI2_SAS_DEVICE_INFO_NO_DEVICE          (0x00000000)
110 #define MPI2_SAS_DEVICE_INFO_END_DEVICE         (0x00000001)
111 #define MPI2_SAS_DEVICE_INFO_EDGE_EXPANDER      (0x00000002)
112 #define MPI2_SAS_DEVICE_INFO_FANOUT_EXPANDER    (0x00000003)
113 
114 
115 /*****************************************************************************
116 *
117 *        SAS Messages
118 *
119 *****************************************************************************/
120 
121 /****************************************************************************
122 *  SMP Passthrough messages
123 ****************************************************************************/
124 
125 /* SMP Passthrough Request Message */
126 typedef struct _MPI2_SMP_PASSTHROUGH_REQUEST
127 {
128     U8                      PassthroughFlags;   /* 0x00 */
129     U8                      PhysicalPort;       /* 0x01 */
130     U8                      ChainOffset;        /* 0x02 */
131     U8                      Function;           /* 0x03 */
132     U16                     RequestDataLength;  /* 0x04 */
133     U8                      SGLFlags;           /* 0x06 */
134     U8                      MsgFlags;           /* 0x07 */
135     U8                      VP_ID;              /* 0x08 */
136     U8                      VF_ID;              /* 0x09 */
137     U16                     Reserved1;          /* 0x0A */
138     U32                     Reserved2;          /* 0x0C */
139     U64                     SASAddress;         /* 0x10 */
140     U32                     Reserved3;          /* 0x18 */
141     U32                     Reserved4;          /* 0x1C */
142     MPI2_SIMPLE_SGE_UNION   SGL;                /* 0x20 */
143 } MPI2_SMP_PASSTHROUGH_REQUEST, MPI2_POINTER PTR_MPI2_SMP_PASSTHROUGH_REQUEST,
144   Mpi2SmpPassthroughRequest_t, MPI2_POINTER pMpi2SmpPassthroughRequest_t;
145 
146 /* values for PassthroughFlags field */
147 #define MPI2_SMP_PT_REQ_PT_FLAGS_IMMEDIATE      (0x80)
148 
149 /* use MPI2_SGLFLAGS_ defines from mpi2.h for the SGLFlags field */
150 
151 
152 /* SMP Passthrough Reply Message */
153 typedef struct _MPI2_SMP_PASSTHROUGH_REPLY
154 {
155     U8                      PassthroughFlags;   /* 0x00 */
156     U8                      PhysicalPort;       /* 0x01 */
157     U8                      MsgLength;          /* 0x02 */
158     U8                      Function;           /* 0x03 */
159     U16                     ResponseDataLength; /* 0x04 */
160     U8                      SGLFlags;           /* 0x06 */
161     U8                      MsgFlags;           /* 0x07 */
162     U8                      VP_ID;              /* 0x08 */
163     U8                      VF_ID;              /* 0x09 */
164     U16                     Reserved1;          /* 0x0A */
165     U8                      Reserved2;          /* 0x0C */
166     U8                      SASStatus;          /* 0x0D */
167     U16                     IOCStatus;          /* 0x0E */
168     U32                     IOCLogInfo;         /* 0x10 */
169     U32                     Reserved3;          /* 0x14 */
170     U8                      ResponseData[4];    /* 0x18 */
171 } MPI2_SMP_PASSTHROUGH_REPLY, MPI2_POINTER PTR_MPI2_SMP_PASSTHROUGH_REPLY,
172   Mpi2SmpPassthroughReply_t, MPI2_POINTER pMpi2SmpPassthroughReply_t;
173 
174 /* values for PassthroughFlags field */
175 #define MPI2_SMP_PT_REPLY_PT_FLAGS_IMMEDIATE    (0x80)
176 
177 /* values for SASStatus field are at the top of this file */
178 
179 
180 /****************************************************************************
181 *  SATA Passthrough messages
182 ****************************************************************************/
183 
184 /* SATA Passthrough Request Message */
185 typedef struct _MPI2_SATA_PASSTHROUGH_REQUEST
186 {
187     U16                     DevHandle;          /* 0x00 */
188     U8                      ChainOffset;        /* 0x02 */
189     U8                      Function;           /* 0x03 */
190     U16                     PassthroughFlags;   /* 0x04 */
191     U8                      SGLFlags;           /* 0x06 */
192     U8                      MsgFlags;           /* 0x07 */
193     U8                      VP_ID;              /* 0x08 */
194     U8                      VF_ID;              /* 0x09 */
195     U16                     Reserved1;          /* 0x0A */
196     U32                     Reserved2;          /* 0x0C */
197     U32                     Reserved3;          /* 0x10 */
198     U32                     Reserved4;          /* 0x14 */
199     U32                     DataLength;         /* 0x18 */
200     U8                      CommandFIS[20];     /* 0x1C */
201     MPI2_SGE_IO_UNION       SGL;                /* 0x30 */
202 } MPI2_SATA_PASSTHROUGH_REQUEST, MPI2_POINTER PTR_MPI2_SATA_PASSTHROUGH_REQUEST,
203   Mpi2SataPassthroughRequest_t, MPI2_POINTER pMpi2SataPassthroughRequest_t;
204 
205 /* values for PassthroughFlags field */
206 #define MPI2_SATA_PT_REQ_PT_FLAGS_EXECUTE_DIAG      (0x0100)
207 #define MPI2_SATA_PT_REQ_PT_FLAGS_DMA               (0x0020)
208 #define MPI2_SATA_PT_REQ_PT_FLAGS_PIO               (0x0010)
209 #define MPI2_SATA_PT_REQ_PT_FLAGS_UNSPECIFIED_VU    (0x0004)
210 #define MPI2_SATA_PT_REQ_PT_FLAGS_WRITE             (0x0002)
211 #define MPI2_SATA_PT_REQ_PT_FLAGS_READ              (0x0001)
212 
213 /* use MPI2_SGLFLAGS_ defines from mpi2.h for the SGLFlags field */
214 
215 
216 /* SATA Passthrough Reply Message */
217 typedef struct _MPI2_SATA_PASSTHROUGH_REPLY
218 {
219     U16                     DevHandle;          /* 0x00 */
220     U8                      MsgLength;          /* 0x02 */
221     U8                      Function;           /* 0x03 */
222     U16                     PassthroughFlags;   /* 0x04 */
223     U8                      SGLFlags;           /* 0x06 */
224     U8                      MsgFlags;           /* 0x07 */
225     U8                      VP_ID;              /* 0x08 */
226     U8                      VF_ID;              /* 0x09 */
227     U16                     Reserved1;          /* 0x0A */
228     U8                      Reserved2;          /* 0x0C */
229     U8                      SASStatus;          /* 0x0D */
230     U16                     IOCStatus;          /* 0x0E */
231     U32                     IOCLogInfo;         /* 0x10 */
232     U8                      StatusFIS[20];      /* 0x14 */
233     U32                     StatusControlRegisters; /* 0x28 */
234     U32                     TransferCount;      /* 0x2C */
235 } MPI2_SATA_PASSTHROUGH_REPLY, MPI2_POINTER PTR_MPI2_SATA_PASSTHROUGH_REPLY,
236   Mpi2SataPassthroughReply_t, MPI2_POINTER pMpi2SataPassthroughReply_t;
237 
238 /* values for SASStatus field are at the top of this file */
239 
240 
241 /****************************************************************************
242 *  SAS IO Unit Control messages
243 ****************************************************************************/
244 
245 /* SAS IO Unit Control Request Message */
246 typedef struct _MPI2_SAS_IOUNIT_CONTROL_REQUEST
247 {
248     U8                      Operation;          /* 0x00 */
249     U8                      Reserved1;          /* 0x01 */
250     U8                      ChainOffset;        /* 0x02 */
251     U8                      Function;           /* 0x03 */
252     U16                     DevHandle;          /* 0x04 */
253     U8                      IOCParameter;       /* 0x06 */
254     U8                      MsgFlags;           /* 0x07 */
255     U8                      VP_ID;              /* 0x08 */
256     U8                      VF_ID;              /* 0x09 */
257     U16                     Reserved3;          /* 0x0A */
258     U16                     Reserved4;          /* 0x0C */
259     U8                      PhyNum;             /* 0x0E */
260     U8                      PrimFlags;          /* 0x0F */
261     U32                     Primitive;          /* 0x10 */
262     U8                      LookupMethod;       /* 0x14 */
263     U8                      Reserved5;          /* 0x15 */
264     U16                     SlotNumber;         /* 0x16 */
265     U64                     LookupAddress;      /* 0x18 */
266     U32                     IOCParameterValue;  /* 0x20 */
267     U32                     Reserved7;          /* 0x24 */
268     U32                     Reserved8;          /* 0x28 */
269 } MPI2_SAS_IOUNIT_CONTROL_REQUEST,
270   MPI2_POINTER PTR_MPI2_SAS_IOUNIT_CONTROL_REQUEST,
271   Mpi2SasIoUnitControlRequest_t, MPI2_POINTER pMpi2SasIoUnitControlRequest_t;
272 
273 /* values for the Operation field */
274 #define MPI2_SAS_OP_CLEAR_ALL_PERSISTENT        (0x02)
275 #define MPI2_SAS_OP_PHY_LINK_RESET              (0x06)
276 #define MPI2_SAS_OP_PHY_HARD_RESET              (0x07)
277 #define MPI2_SAS_OP_PHY_CLEAR_ERROR_LOG         (0x08)
278 #define MPI2_SAS_OP_SEND_PRIMITIVE              (0x0A)
279 #define MPI2_SAS_OP_FORCE_FULL_DISCOVERY        (0x0B)
280 #define MPI2_SAS_OP_TRANSMIT_PORT_SELECT_SIGNAL (0x0C)
281 #define MPI2_SAS_OP_REMOVE_DEVICE               (0x0D)
282 #define MPI2_SAS_OP_LOOKUP_MAPPING              (0x0E)
283 #define MPI2_SAS_OP_SET_IOC_PARAMETER           (0x0F)
284 #define MPI2_SAS_OP_DEV_ENABLE_NCQ              (0x14)
285 #define MPI2_SAS_OP_DEV_DISABLE_NCQ             (0x15)
286 #define MPI2_SAS_OP_PRODUCT_SPECIFIC_MIN        (0x80)
287 
288 /* values for the PrimFlags field */
289 #define MPI2_SAS_PRIMFLAGS_SINGLE               (0x08)
290 #define MPI2_SAS_PRIMFLAGS_TRIPLE               (0x02)
291 #define MPI2_SAS_PRIMFLAGS_REDUNDANT            (0x01)
292 
293 /* values for the LookupMethod field */
294 #define MPI2_SAS_LOOKUP_METHOD_SAS_ADDRESS          (0x01)
295 #define MPI2_SAS_LOOKUP_METHOD_SAS_ENCLOSURE_SLOT   (0x02)
296 #define MPI2_SAS_LOOKUP_METHOD_SAS_DEVICE_NAME      (0x03)
297 
298 
299 /* SAS IO Unit Control Reply Message */
300 typedef struct _MPI2_SAS_IOUNIT_CONTROL_REPLY
301 {
302     U8                      Operation;          /* 0x00 */
303     U8                      Reserved1;          /* 0x01 */
304     U8                      MsgLength;          /* 0x02 */
305     U8                      Function;           /* 0x03 */
306     U16                     DevHandle;          /* 0x04 */
307     U8                      IOCParameter;       /* 0x06 */
308     U8                      MsgFlags;           /* 0x07 */
309     U8                      VP_ID;              /* 0x08 */
310     U8                      VF_ID;              /* 0x09 */
311     U16                     Reserved3;          /* 0x0A */
312     U16                     Reserved4;          /* 0x0C */
313     U16                     IOCStatus;          /* 0x0E */
314     U32                     IOCLogInfo;         /* 0x10 */
315 } MPI2_SAS_IOUNIT_CONTROL_REPLY,
316   MPI2_POINTER PTR_MPI2_SAS_IOUNIT_CONTROL_REPLY,
317   Mpi2SasIoUnitControlReply_t, MPI2_POINTER pMpi2SasIoUnitControlReply_t;
318 
319 
320 #endif
321 
322 
323