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