xref: /freebsd/sys/dev/mpt/mpilib/mpi_sas.h (revision cddbc3b40812213ff00041f79174cac0be360a2a)
1 /* $FreeBSD$ */
2 /*-
3  * SPDX-License-Identifier: BSD-3-Clause
4  *
5  * Copyright (c) 2000-2010, LSI Logic Corporation and its contributors.
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 are
10  * 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 at minimum a disclaimer
14  *    substantially similar to the "NO WARRANTY" disclaimer below
15  *    ("Disclaimer") and any redistribution must be conditioned upon including
16  *    a substantially similar Disclaimer requirement for further binary
17  *    redistribution.
18  * 3. Neither the name of the LSI Logic Corporation nor the names of its
19  *    contributors may be used to endorse or promote products derived from
20  *    this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT
32  * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  *
34  *           Name:  mpi_sas.h
35  *          Title:  MPI Serial Attached SCSI structures and definitions
36  *  Creation Date:  August 19, 2004
37  *
38  *    mpi_sas.h Version:  01.05.05
39  *
40  *  Version History
41  *  ---------------
42  *
43  *  Date      Version   Description
44  *  --------  --------  ------------------------------------------------------
45  *  08-19-04  01.05.01  Original release.
46  *  08-30-05  01.05.02  Added DeviceInfo bit for SEP.
47  *                      Added PrimFlags and Primitive field to SAS IO Unit
48  *                      Control request, and added a new operation code.
49  *  03-27-06  01.05.03  Added Force Full Discovery, Transmit Port Select Signal,
50  *                      and Remove Device operations to SAS IO Unit Control.
51  *                      Added DevHandle field to SAS IO Unit Control request and
52  *                      reply.
53  *  10-11-06  01.05.04  Fixed the name of a define for Operation field of SAS IO
54  *                      Unit Control request.
55  *  01-15-08  01.05.05  Added support for MPI_SAS_OP_SET_IOC_PARAMETER,
56  *                      including adding IOCParameter and IOCParameter value
57  *                      fields to SAS IO Unit Control Request.
58  *                      Added MPI_SAS_DEVICE_INFO_PRODUCT_SPECIFIC define.
59  *  --------------------------------------------------------------------------
60  */
61 
62 #ifndef MPI_SAS_H
63 #define MPI_SAS_H
64 
65 
66 /*
67  * Values for SASStatus.
68  */
69 #define MPI_SASSTATUS_SUCCESS                           (0x00)
70 #define MPI_SASSTATUS_UNKNOWN_ERROR                     (0x01)
71 #define MPI_SASSTATUS_INVALID_FRAME                     (0x02)
72 #define MPI_SASSTATUS_UTC_BAD_DEST                      (0x03)
73 #define MPI_SASSTATUS_UTC_BREAK_RECEIVED                (0x04)
74 #define MPI_SASSTATUS_UTC_CONNECT_RATE_NOT_SUPPORTED    (0x05)
75 #define MPI_SASSTATUS_UTC_PORT_LAYER_REQUEST            (0x06)
76 #define MPI_SASSTATUS_UTC_PROTOCOL_NOT_SUPPORTED        (0x07)
77 #define MPI_SASSTATUS_UTC_STP_RESOURCES_BUSY            (0x08)
78 #define MPI_SASSTATUS_UTC_WRONG_DESTINATION             (0x09)
79 #define MPI_SASSTATUS_SHORT_INFORMATION_UNIT            (0x0A)
80 #define MPI_SASSTATUS_LONG_INFORMATION_UNIT             (0x0B)
81 #define MPI_SASSTATUS_XFER_RDY_INCORRECT_WRITE_DATA     (0x0C)
82 #define MPI_SASSTATUS_XFER_RDY_REQUEST_OFFSET_ERROR     (0x0D)
83 #define MPI_SASSTATUS_XFER_RDY_NOT_EXPECTED             (0x0E)
84 #define MPI_SASSTATUS_DATA_INCORRECT_DATA_LENGTH        (0x0F)
85 #define MPI_SASSTATUS_DATA_TOO_MUCH_READ_DATA           (0x10)
86 #define MPI_SASSTATUS_DATA_OFFSET_ERROR                 (0x11)
87 #define MPI_SASSTATUS_SDSF_NAK_RECEIVED                 (0x12)
88 #define MPI_SASSTATUS_SDSF_CONNECTION_FAILED            (0x13)
89 #define MPI_SASSTATUS_INITIATOR_RESPONSE_TIMEOUT        (0x14)
90 
91 
92 /*
93  * Values for the SAS DeviceInfo field used in SAS Device Status Change Event
94  * data and SAS IO Unit Configuration pages.
95  */
96 #define MPI_SAS_DEVICE_INFO_PRODUCT_SPECIFIC    (0xF0000000)
97 
98 #define MPI_SAS_DEVICE_INFO_SEP                 (0x00004000)
99 #define MPI_SAS_DEVICE_INFO_ATAPI_DEVICE        (0x00002000)
100 #define MPI_SAS_DEVICE_INFO_LSI_DEVICE          (0x00001000)
101 #define MPI_SAS_DEVICE_INFO_DIRECT_ATTACH       (0x00000800)
102 #define MPI_SAS_DEVICE_INFO_SSP_TARGET          (0x00000400)
103 #define MPI_SAS_DEVICE_INFO_STP_TARGET          (0x00000200)
104 #define MPI_SAS_DEVICE_INFO_SMP_TARGET          (0x00000100)
105 #define MPI_SAS_DEVICE_INFO_SATA_DEVICE         (0x00000080)
106 #define MPI_SAS_DEVICE_INFO_SSP_INITIATOR       (0x00000040)
107 #define MPI_SAS_DEVICE_INFO_STP_INITIATOR       (0x00000020)
108 #define MPI_SAS_DEVICE_INFO_SMP_INITIATOR       (0x00000010)
109 #define MPI_SAS_DEVICE_INFO_SATA_HOST           (0x00000008)
110 
111 #define MPI_SAS_DEVICE_INFO_MASK_DEVICE_TYPE    (0x00000007)
112 #define MPI_SAS_DEVICE_INFO_NO_DEVICE           (0x00000000)
113 #define MPI_SAS_DEVICE_INFO_END_DEVICE          (0x00000001)
114 #define MPI_SAS_DEVICE_INFO_EDGE_EXPANDER       (0x00000002)
115 #define MPI_SAS_DEVICE_INFO_FANOUT_EXPANDER     (0x00000003)
116 
117 
118 
119 /*****************************************************************************
120 *
121 *        S e r i a l    A t t a c h e d    S C S I     M e s s a g e s
122 *
123 *****************************************************************************/
124 
125 /****************************************************************************/
126 /* Serial Management Protocol Passthrough Request                           */
127 /****************************************************************************/
128 
129 typedef struct _MSG_SMP_PASSTHROUGH_REQUEST
130 {
131     U8                      PassthroughFlags;   /* 00h */
132     U8                      PhysicalPort;       /* 01h */
133     U8                      ChainOffset;        /* 02h */
134     U8                      Function;           /* 03h */
135     U16                     RequestDataLength;  /* 04h */
136     U8                      ConnectionRate;     /* 06h */
137     U8                      MsgFlags;           /* 07h */
138     U32                     MsgContext;         /* 08h */
139     U32                     Reserved1;          /* 0Ch */
140     U64                     SASAddress;         /* 10h */
141     U32                     Reserved2;          /* 18h */
142     U32                     Reserved3;          /* 1Ch */
143     SGE_SIMPLE_UNION        SGL;                /* 20h */
144 } MSG_SMP_PASSTHROUGH_REQUEST, MPI_POINTER PTR_MSG_SMP_PASSTHROUGH_REQUEST,
145   SmpPassthroughRequest_t, MPI_POINTER pSmpPassthroughRequest_t;
146 
147 /* values for PassthroughFlags field */
148 #define MPI_SMP_PT_REQ_PT_FLAGS_IMMEDIATE       (0x80)
149 
150 /* values for ConnectionRate field */
151 #define MPI_SMP_PT_REQ_CONNECT_RATE_NEGOTIATED  (0x00)
152 #define MPI_SMP_PT_REQ_CONNECT_RATE_1_5         (0x08)
153 #define MPI_SMP_PT_REQ_CONNECT_RATE_3_0         (0x09)
154 
155 
156 /* Serial Management Protocol Passthrough Reply */
157 typedef struct _MSG_SMP_PASSTHROUGH_REPLY
158 {
159     U8                      PassthroughFlags;   /* 00h */
160     U8                      PhysicalPort;       /* 01h */
161     U8                      MsgLength;          /* 02h */
162     U8                      Function;           /* 03h */
163     U16                     ResponseDataLength; /* 04h */
164     U8                      Reserved1;          /* 06h */
165     U8                      MsgFlags;           /* 07h */
166     U32                     MsgContext;         /* 08h */
167     U8                      Reserved2;          /* 0Ch */
168     U8                      SASStatus;          /* 0Dh */
169     U16                     IOCStatus;          /* 0Eh */
170     U32                     IOCLogInfo;         /* 10h */
171     U32                     Reserved3;          /* 14h */
172     U8                      ResponseData[4];    /* 18h */
173 } MSG_SMP_PASSTHROUGH_REPLY, MPI_POINTER PTR_MSG_SMP_PASSTHROUGH_REPLY,
174   SmpPassthroughReply_t, MPI_POINTER pSmpPassthroughReply_t;
175 
176 #define MPI_SMP_PT_REPLY_PT_FLAGS_IMMEDIATE     (0x80)
177 
178 
179 /****************************************************************************/
180 /* SATA Passthrough Request                                                 */
181 /****************************************************************************/
182 
183 typedef struct _MSG_SATA_PASSTHROUGH_REQUEST
184 {
185     U8                      TargetID;           /* 00h */
186     U8                      Bus;                /* 01h */
187     U8                      ChainOffset;        /* 02h */
188     U8                      Function;           /* 03h */
189     U16                     PassthroughFlags;   /* 04h */
190     U8                      ConnectionRate;     /* 06h */
191     U8                      MsgFlags;           /* 07h */
192     U32                     MsgContext;         /* 08h */
193     U32                     Reserved1;          /* 0Ch */
194     U32                     Reserved2;          /* 10h */
195     U32                     Reserved3;          /* 14h */
196     U32                     DataLength;         /* 18h */
197     U8                      CommandFIS[20];     /* 1Ch */
198     SGE_SIMPLE_UNION        SGL;                /* 30h */
199 } MSG_SATA_PASSTHROUGH_REQUEST, MPI_POINTER PTR_MSG_SATA_PASSTHROUGH_REQUEST,
200   SataPassthroughRequest_t, MPI_POINTER pSataPassthroughRequest_t;
201 
202 /* values for PassthroughFlags field */
203 #define MPI_SATA_PT_REQ_PT_FLAGS_RESET_DEVICE   (0x0200)
204 #define MPI_SATA_PT_REQ_PT_FLAGS_EXECUTE_DIAG   (0x0100)
205 #define MPI_SATA_PT_REQ_PT_FLAGS_DMA_QUEUED     (0x0080)
206 #define MPI_SATA_PT_REQ_PT_FLAGS_PACKET_COMMAND (0x0040)
207 #define MPI_SATA_PT_REQ_PT_FLAGS_DMA            (0x0020)
208 #define MPI_SATA_PT_REQ_PT_FLAGS_PIO            (0x0010)
209 #define MPI_SATA_PT_REQ_PT_FLAGS_UNSPECIFIED_VU (0x0004)
210 #define MPI_SATA_PT_REQ_PT_FLAGS_WRITE          (0x0002)
211 #define MPI_SATA_PT_REQ_PT_FLAGS_READ           (0x0001)
212 
213 /* values for ConnectionRate field */
214 #define MPI_SATA_PT_REQ_CONNECT_RATE_NEGOTIATED (0x00)
215 #define MPI_SATA_PT_REQ_CONNECT_RATE_1_5        (0x08)
216 #define MPI_SATA_PT_REQ_CONNECT_RATE_3_0        (0x09)
217 
218 
219 /* SATA Passthrough Reply */
220 typedef struct _MSG_SATA_PASSTHROUGH_REPLY
221 {
222     U8                      TargetID;           /* 00h */
223     U8                      Bus;                /* 01h */
224     U8                      MsgLength;          /* 02h */
225     U8                      Function;           /* 03h */
226     U16                     PassthroughFlags;   /* 04h */
227     U8                      Reserved1;          /* 06h */
228     U8                      MsgFlags;           /* 07h */
229     U32                     MsgContext;         /* 08h */
230     U8                      Reserved2;          /* 0Ch */
231     U8                      SASStatus;          /* 0Dh */
232     U16                     IOCStatus;          /* 0Eh */
233     U32                     IOCLogInfo;         /* 10h */
234     U8                      StatusFIS[20];      /* 14h */
235     U32                     StatusControlRegisters; /* 28h */
236     U32                     TransferCount;      /* 2Ch */
237 } MSG_SATA_PASSTHROUGH_REPLY, MPI_POINTER PTR_MSG_SATA_PASSTHROUGH_REPLY,
238   SataPassthroughReply_t, MPI_POINTER pSataPassthroughReply_t;
239 
240 
241 
242 
243 /****************************************************************************/
244 /* SAS IO Unit Control Request                                              */
245 /****************************************************************************/
246 
247 typedef struct _MSG_SAS_IOUNIT_CONTROL_REQUEST
248 {
249     U8                      Operation;          /* 00h */
250     U8                      Reserved1;          /* 01h */
251     U8                      ChainOffset;        /* 02h */
252     U8                      Function;           /* 03h */
253     U16                     DevHandle;          /* 04h */
254     U8                      IOCParameter;       /* 06h */
255     U8                      MsgFlags;           /* 07h */
256     U32                     MsgContext;         /* 08h */
257     U8                      TargetID;           /* 0Ch */
258     U8                      Bus;                /* 0Dh */
259     U8                      PhyNum;             /* 0Eh */
260     U8                      PrimFlags;          /* 0Fh */
261     U32                     Primitive;          /* 10h */
262     U64                     SASAddress;         /* 14h */
263     U32                     IOCParameterValue;  /* 1Ch */
264 } MSG_SAS_IOUNIT_CONTROL_REQUEST, MPI_POINTER PTR_MSG_SAS_IOUNIT_CONTROL_REQUEST,
265   SasIoUnitControlRequest_t, MPI_POINTER pSasIoUnitControlRequest_t;
266 
267 /* values for the Operation field */
268 #define MPI_SAS_OP_CLEAR_NOT_PRESENT            (0x01)
269 #define MPI_SAS_OP_CLEAR_ALL_PERSISTENT         (0x02)
270 #define MPI_SAS_OP_PHY_LINK_RESET               (0x06)
271 #define MPI_SAS_OP_PHY_HARD_RESET               (0x07)
272 #define MPI_SAS_OP_PHY_CLEAR_ERROR_LOG          (0x08)
273 #define MPI_SAS_OP_MAP_CURRENT                  (0x09)
274 #define MPI_SAS_OP_SEND_PRIMITIVE               (0x0A)
275 #define MPI_SAS_OP_FORCE_FULL_DISCOVERY         (0x0B)
276 #define MPI_SAS_OP_TRANSMIT_PORT_SELECT_SIGNAL  (0x0C)
277 #define MPI_SAS_OP_TRANSMIT_REMOVE_DEVICE       (0x0D)  /* obsolete name */
278 #define MPI_SAS_OP_REMOVE_DEVICE                (0x0D)
279 #define MPI_SAS_OP_SET_IOC_PARAMETER            (0x0E)
280 #define MPI_SAS_OP_PRODUCT_SPECIFIC_MIN         (0x80)
281 
282 /* values for the PrimFlags field */
283 #define MPI_SAS_PRIMFLAGS_SINGLE                (0x08)
284 #define MPI_SAS_PRIMFLAGS_TRIPLE                (0x02)
285 #define MPI_SAS_PRIMFLAGS_REDUNDANT             (0x01)
286 
287 
288 /* SAS IO Unit Control Reply */
289 typedef struct _MSG_SAS_IOUNIT_CONTROL_REPLY
290 {
291     U8                      Operation;          /* 00h */
292     U8                      Reserved1;          /* 01h */
293     U8                      MsgLength;          /* 02h */
294     U8                      Function;           /* 03h */
295     U16                     DevHandle;          /* 04h */
296     U8                      IOCParameter;       /* 06h */
297     U8                      MsgFlags;           /* 07h */
298     U32                     MsgContext;         /* 08h */
299     U16                     Reserved4;          /* 0Ch */
300     U16                     IOCStatus;          /* 0Eh */
301     U32                     IOCLogInfo;         /* 10h */
302 } MSG_SAS_IOUNIT_CONTROL_REPLY, MPI_POINTER PTR_MSG_SAS_IOUNIT_CONTROL_REPLY,
303   SasIoUnitControlReply_t, MPI_POINTER pSasIoUnitControlReply_t;
304 
305 #endif
306 
307 
308