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