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