xref: /linux/drivers/message/fusion/lsi/mpi_sas.h (revision 498495dba268b20e8eadd7fe93c140c68b6cc9d2)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  *  Copyright (c) 2004-2008 LSI Corporation.
4  *
5  *
6  *           Name:  mpi_sas.h
7  *          Title:  MPI Serial Attached SCSI structures and definitions
8  *  Creation Date:  August 19, 2004
9  *
10  *    mpi_sas.h Version:  01.05.05
11  *
12  *  Version History
13  *  ---------------
14  *
15  *  Date      Version   Description
16  *  --------  --------  ------------------------------------------------------
17  *  08-19-04  01.05.01  Original release.
18  *  08-30-05  01.05.02  Added DeviceInfo bit for SEP.
19  *                      Added PrimFlags and Primitive field to SAS IO Unit
20  *                      Control request, and added a new operation code.
21  *  03-27-06  01.05.03  Added Force Full Discovery, Transmit Port Select Signal,
22  *                      and Remove Device operations to SAS IO Unit Control.
23  *                      Added DevHandle field to SAS IO Unit Control request and
24  *                      reply.
25  *  10-11-06  01.05.04  Fixed the name of a define for Operation field of SAS IO
26  *                      Unit Control request.
27  *  01-15-08  01.05.05  Added support for MPI_SAS_OP_SET_IOC_PARAMETER,
28  *                      including adding IOCParameter and IOCParameter value
29  *                      fields to SAS IO Unit Control Request.
30  *                      Added MPI_SAS_DEVICE_INFO_PRODUCT_SPECIFIC define.
31  *  --------------------------------------------------------------------------
32  */
33 
34 #ifndef MPI_SAS_H
35 #define MPI_SAS_H
36 
37 
38 /*
39  * Values for SASStatus.
40  */
41 #define MPI_SASSTATUS_SUCCESS                           (0x00)
42 #define MPI_SASSTATUS_UNKNOWN_ERROR                     (0x01)
43 #define MPI_SASSTATUS_INVALID_FRAME                     (0x02)
44 #define MPI_SASSTATUS_UTC_BAD_DEST                      (0x03)
45 #define MPI_SASSTATUS_UTC_BREAK_RECEIVED                (0x04)
46 #define MPI_SASSTATUS_UTC_CONNECT_RATE_NOT_SUPPORTED    (0x05)
47 #define MPI_SASSTATUS_UTC_PORT_LAYER_REQUEST            (0x06)
48 #define MPI_SASSTATUS_UTC_PROTOCOL_NOT_SUPPORTED        (0x07)
49 #define MPI_SASSTATUS_UTC_STP_RESOURCES_BUSY            (0x08)
50 #define MPI_SASSTATUS_UTC_WRONG_DESTINATION             (0x09)
51 #define MPI_SASSTATUS_SHORT_INFORMATION_UNIT            (0x0A)
52 #define MPI_SASSTATUS_LONG_INFORMATION_UNIT             (0x0B)
53 #define MPI_SASSTATUS_XFER_RDY_INCORRECT_WRITE_DATA     (0x0C)
54 #define MPI_SASSTATUS_XFER_RDY_REQUEST_OFFSET_ERROR     (0x0D)
55 #define MPI_SASSTATUS_XFER_RDY_NOT_EXPECTED             (0x0E)
56 #define MPI_SASSTATUS_DATA_INCORRECT_DATA_LENGTH        (0x0F)
57 #define MPI_SASSTATUS_DATA_TOO_MUCH_READ_DATA           (0x10)
58 #define MPI_SASSTATUS_DATA_OFFSET_ERROR                 (0x11)
59 #define MPI_SASSTATUS_SDSF_NAK_RECEIVED                 (0x12)
60 #define MPI_SASSTATUS_SDSF_CONNECTION_FAILED            (0x13)
61 #define MPI_SASSTATUS_INITIATOR_RESPONSE_TIMEOUT        (0x14)
62 
63 
64 /*
65  * Values for the SAS DeviceInfo field used in SAS Device Status Change Event
66  * data and SAS IO Unit Configuration pages.
67  */
68 #define MPI_SAS_DEVICE_INFO_PRODUCT_SPECIFIC    (0xF0000000)
69 
70 #define MPI_SAS_DEVICE_INFO_SEP                 (0x00004000)
71 #define MPI_SAS_DEVICE_INFO_ATAPI_DEVICE        (0x00002000)
72 #define MPI_SAS_DEVICE_INFO_LSI_DEVICE          (0x00001000)
73 #define MPI_SAS_DEVICE_INFO_DIRECT_ATTACH       (0x00000800)
74 #define MPI_SAS_DEVICE_INFO_SSP_TARGET          (0x00000400)
75 #define MPI_SAS_DEVICE_INFO_STP_TARGET          (0x00000200)
76 #define MPI_SAS_DEVICE_INFO_SMP_TARGET          (0x00000100)
77 #define MPI_SAS_DEVICE_INFO_SATA_DEVICE         (0x00000080)
78 #define MPI_SAS_DEVICE_INFO_SSP_INITIATOR       (0x00000040)
79 #define MPI_SAS_DEVICE_INFO_STP_INITIATOR       (0x00000020)
80 #define MPI_SAS_DEVICE_INFO_SMP_INITIATOR       (0x00000010)
81 #define MPI_SAS_DEVICE_INFO_SATA_HOST           (0x00000008)
82 
83 #define MPI_SAS_DEVICE_INFO_MASK_DEVICE_TYPE    (0x00000007)
84 #define MPI_SAS_DEVICE_INFO_NO_DEVICE           (0x00000000)
85 #define MPI_SAS_DEVICE_INFO_END_DEVICE          (0x00000001)
86 #define MPI_SAS_DEVICE_INFO_EDGE_EXPANDER       (0x00000002)
87 #define MPI_SAS_DEVICE_INFO_FANOUT_EXPANDER     (0x00000003)
88 
89 
90 
91 /*****************************************************************************
92 *
93 *        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
94 *
95 *****************************************************************************/
96 
97 /****************************************************************************/
98 /* Serial Management Protocol Passthrough Request                           */
99 /****************************************************************************/
100 
101 typedef struct _MSG_SMP_PASSTHROUGH_REQUEST
102 {
103     U8                      PassthroughFlags;   /* 00h */
104     U8                      PhysicalPort;       /* 01h */
105     U8                      ChainOffset;        /* 02h */
106     U8                      Function;           /* 03h */
107     U16                     RequestDataLength;  /* 04h */
108     U8                      ConnectionRate;     /* 06h */
109     U8                      MsgFlags;           /* 07h */
110     U32                     MsgContext;         /* 08h */
111     U32                     Reserved1;          /* 0Ch */
112     U64                     SASAddress;         /* 10h */
113     U32                     Reserved2;          /* 18h */
114     U32                     Reserved3;          /* 1Ch */
115     SGE_SIMPLE_UNION        SGL;                /* 20h */
116 } MSG_SMP_PASSTHROUGH_REQUEST, MPI_POINTER PTR_MSG_SMP_PASSTHROUGH_REQUEST,
117   SmpPassthroughRequest_t, MPI_POINTER pSmpPassthroughRequest_t;
118 
119 /* values for PassthroughFlags field */
120 #define MPI_SMP_PT_REQ_PT_FLAGS_IMMEDIATE       (0x80)
121 
122 /* values for ConnectionRate field */
123 #define MPI_SMP_PT_REQ_CONNECT_RATE_NEGOTIATED  (0x00)
124 #define MPI_SMP_PT_REQ_CONNECT_RATE_1_5         (0x08)
125 #define MPI_SMP_PT_REQ_CONNECT_RATE_3_0         (0x09)
126 
127 
128 /* Serial Management Protocol Passthrough Reply */
129 typedef struct _MSG_SMP_PASSTHROUGH_REPLY
130 {
131     U8                      PassthroughFlags;   /* 00h */
132     U8                      PhysicalPort;       /* 01h */
133     U8                      MsgLength;          /* 02h */
134     U8                      Function;           /* 03h */
135     U16                     ResponseDataLength; /* 04h */
136     U8                      Reserved1;          /* 06h */
137     U8                      MsgFlags;           /* 07h */
138     U32                     MsgContext;         /* 08h */
139     U8                      Reserved2;          /* 0Ch */
140     U8                      SASStatus;          /* 0Dh */
141     U16                     IOCStatus;          /* 0Eh */
142     U32                     IOCLogInfo;         /* 10h */
143     U32                     Reserved3;          /* 14h */
144     U8                      ResponseData[4];    /* 18h */
145 } MSG_SMP_PASSTHROUGH_REPLY, MPI_POINTER PTR_MSG_SMP_PASSTHROUGH_REPLY,
146   SmpPassthroughReply_t, MPI_POINTER pSmpPassthroughReply_t;
147 
148 #define MPI_SMP_PT_REPLY_PT_FLAGS_IMMEDIATE     (0x80)
149 
150 
151 /****************************************************************************/
152 /* SATA Passthrough Request                                                 */
153 /****************************************************************************/
154 
155 typedef struct _MSG_SATA_PASSTHROUGH_REQUEST
156 {
157     U8                      TargetID;           /* 00h */
158     U8                      Bus;                /* 01h */
159     U8                      ChainOffset;        /* 02h */
160     U8                      Function;           /* 03h */
161     U16                     PassthroughFlags;   /* 04h */
162     U8                      ConnectionRate;     /* 06h */
163     U8                      MsgFlags;           /* 07h */
164     U32                     MsgContext;         /* 08h */
165     U32                     Reserved1;          /* 0Ch */
166     U32                     Reserved2;          /* 10h */
167     U32                     Reserved3;          /* 14h */
168     U32                     DataLength;         /* 18h */
169     U8                      CommandFIS[20];     /* 1Ch */
170     SGE_SIMPLE_UNION        SGL;                /* 30h */
171 } MSG_SATA_PASSTHROUGH_REQUEST, MPI_POINTER PTR_MSG_SATA_PASSTHROUGH_REQUEST,
172   SataPassthroughRequest_t, MPI_POINTER pSataPassthroughRequest_t;
173 
174 /* values for PassthroughFlags field */
175 #define MPI_SATA_PT_REQ_PT_FLAGS_RESET_DEVICE   (0x0200)
176 #define MPI_SATA_PT_REQ_PT_FLAGS_EXECUTE_DIAG   (0x0100)
177 #define MPI_SATA_PT_REQ_PT_FLAGS_DMA_QUEUED     (0x0080)
178 #define MPI_SATA_PT_REQ_PT_FLAGS_PACKET_COMMAND (0x0040)
179 #define MPI_SATA_PT_REQ_PT_FLAGS_DMA            (0x0020)
180 #define MPI_SATA_PT_REQ_PT_FLAGS_PIO            (0x0010)
181 #define MPI_SATA_PT_REQ_PT_FLAGS_UNSPECIFIED_VU (0x0004)
182 #define MPI_SATA_PT_REQ_PT_FLAGS_WRITE          (0x0002)
183 #define MPI_SATA_PT_REQ_PT_FLAGS_READ           (0x0001)
184 
185 /* values for ConnectionRate field */
186 #define MPI_SATA_PT_REQ_CONNECT_RATE_NEGOTIATED (0x00)
187 #define MPI_SATA_PT_REQ_CONNECT_RATE_1_5        (0x08)
188 #define MPI_SATA_PT_REQ_CONNECT_RATE_3_0        (0x09)
189 
190 
191 /* SATA Passthrough Reply */
192 typedef struct _MSG_SATA_PASSTHROUGH_REPLY
193 {
194     U8                      TargetID;           /* 00h */
195     U8                      Bus;                /* 01h */
196     U8                      MsgLength;          /* 02h */
197     U8                      Function;           /* 03h */
198     U16                     PassthroughFlags;   /* 04h */
199     U8                      Reserved1;          /* 06h */
200     U8                      MsgFlags;           /* 07h */
201     U32                     MsgContext;         /* 08h */
202     U8                      Reserved2;          /* 0Ch */
203     U8                      SASStatus;          /* 0Dh */
204     U16                     IOCStatus;          /* 0Eh */
205     U32                     IOCLogInfo;         /* 10h */
206     U8                      StatusFIS[20];      /* 14h */
207     U32                     StatusControlRegisters; /* 28h */
208     U32                     TransferCount;      /* 2Ch */
209 } MSG_SATA_PASSTHROUGH_REPLY, MPI_POINTER PTR_MSG_SATA_PASSTHROUGH_REPLY,
210   SataPassthroughReply_t, MPI_POINTER pSataPassthroughReply_t;
211 
212 
213 
214 
215 /****************************************************************************/
216 /* SAS IO Unit Control Request                                              */
217 /****************************************************************************/
218 
219 typedef struct _MSG_SAS_IOUNIT_CONTROL_REQUEST
220 {
221     U8                      Operation;          /* 00h */
222     U8                      Reserved1;          /* 01h */
223     U8                      ChainOffset;        /* 02h */
224     U8                      Function;           /* 03h */
225     U16                     DevHandle;          /* 04h */
226     U8                      IOCParameter;       /* 06h */
227     U8                      MsgFlags;           /* 07h */
228     U32                     MsgContext;         /* 08h */
229     U8                      TargetID;           /* 0Ch */
230     U8                      Bus;                /* 0Dh */
231     U8                      PhyNum;             /* 0Eh */
232     U8                      PrimFlags;          /* 0Fh */
233     U32                     Primitive;          /* 10h */
234     U64                     SASAddress;         /* 14h */
235     U32                     IOCParameterValue;  /* 1Ch */
236 } MSG_SAS_IOUNIT_CONTROL_REQUEST, MPI_POINTER PTR_MSG_SAS_IOUNIT_CONTROL_REQUEST,
237   SasIoUnitControlRequest_t, MPI_POINTER pSasIoUnitControlRequest_t;
238 
239 /* values for the Operation field */
240 #define MPI_SAS_OP_CLEAR_NOT_PRESENT            (0x01)
241 #define MPI_SAS_OP_CLEAR_ALL_PERSISTENT         (0x02)
242 #define MPI_SAS_OP_PHY_LINK_RESET               (0x06)
243 #define MPI_SAS_OP_PHY_HARD_RESET               (0x07)
244 #define MPI_SAS_OP_PHY_CLEAR_ERROR_LOG          (0x08)
245 #define MPI_SAS_OP_MAP_CURRENT                  (0x09)
246 #define MPI_SAS_OP_SEND_PRIMITIVE               (0x0A)
247 #define MPI_SAS_OP_FORCE_FULL_DISCOVERY         (0x0B)
248 #define MPI_SAS_OP_TRANSMIT_PORT_SELECT_SIGNAL  (0x0C)
249 #define MPI_SAS_OP_TRANSMIT_REMOVE_DEVICE       (0x0D)  /* obsolete name */
250 #define MPI_SAS_OP_REMOVE_DEVICE                (0x0D)
251 #define MPI_SAS_OP_SET_IOC_PARAMETER            (0x0E)
252 #define MPI_SAS_OP_PRODUCT_SPECIFIC_MIN         (0x80)
253 
254 /* values for the PrimFlags field */
255 #define MPI_SAS_PRIMFLAGS_SINGLE                (0x08)
256 #define MPI_SAS_PRIMFLAGS_TRIPLE                (0x02)
257 #define MPI_SAS_PRIMFLAGS_REDUNDANT             (0x01)
258 
259 
260 /* SAS IO Unit Control Reply */
261 typedef struct _MSG_SAS_IOUNIT_CONTROL_REPLY
262 {
263     U8                      Operation;          /* 00h */
264     U8                      Reserved1;          /* 01h */
265     U8                      MsgLength;          /* 02h */
266     U8                      Function;           /* 03h */
267     U16                     DevHandle;          /* 04h */
268     U8                      IOCParameter;       /* 06h */
269     U8                      MsgFlags;           /* 07h */
270     U32                     MsgContext;         /* 08h */
271     U16                     Reserved4;          /* 0Ch */
272     U16                     IOCStatus;          /* 0Eh */
273     U32                     IOCLogInfo;         /* 10h */
274 } MSG_SAS_IOUNIT_CONTROL_REPLY, MPI_POINTER PTR_MSG_SAS_IOUNIT_CONTROL_REPLY,
275   SasIoUnitControlReply_t, MPI_POINTER pSasIoUnitControlReply_t;
276 
277 #endif
278 
279 
280