Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/jaswinder...
[linux-2.6] / drivers / scsi / mpt2sas / mpi / mpi2_sas.h
1 /*
2  *  Copyright (c) 2000-2007 LSI Corporation.
3  *
4  *
5  *           Name:  mpi2_sas.h
6  *          Title:  MPI Serial Attached SCSI structures and definitions
7  *  Creation Date:  February 9, 2007
8  *
9  *  mpi2.h Version:  02.00.02
10  *
11  *  Version History
12  *  ---------------
13  *
14  *  Date      Version   Description
15  *  --------  --------  ------------------------------------------------------
16  *  04-30-07  02.00.00  Corresponds to Fusion-MPT MPI Specification Rev A.
17  *  06-26-07  02.00.01  Added Clear All Persistent Operation to SAS IO Unit
18  *                      Control Request.
19  *  10-02-08  02.00.02  Added Set IOC Parameter Operation to SAS IO Unit Control
20  *                      Request.
21  *  --------------------------------------------------------------------------
22  */
23
24 #ifndef MPI2_SAS_H
25 #define MPI2_SAS_H
26
27 /*
28  * Values for SASStatus.
29  */
30 #define MPI2_SASSTATUS_SUCCESS                          (0x00)
31 #define MPI2_SASSTATUS_UNKNOWN_ERROR                    (0x01)
32 #define MPI2_SASSTATUS_INVALID_FRAME                    (0x02)
33 #define MPI2_SASSTATUS_UTC_BAD_DEST                     (0x03)
34 #define MPI2_SASSTATUS_UTC_BREAK_RECEIVED               (0x04)
35 #define MPI2_SASSTATUS_UTC_CONNECT_RATE_NOT_SUPPORTED   (0x05)
36 #define MPI2_SASSTATUS_UTC_PORT_LAYER_REQUEST           (0x06)
37 #define MPI2_SASSTATUS_UTC_PROTOCOL_NOT_SUPPORTED       (0x07)
38 #define MPI2_SASSTATUS_UTC_STP_RESOURCES_BUSY           (0x08)
39 #define MPI2_SASSTATUS_UTC_WRONG_DESTINATION            (0x09)
40 #define MPI2_SASSTATUS_SHORT_INFORMATION_UNIT           (0x0A)
41 #define MPI2_SASSTATUS_LONG_INFORMATION_UNIT            (0x0B)
42 #define MPI2_SASSTATUS_XFER_RDY_INCORRECT_WRITE_DATA    (0x0C)
43 #define MPI2_SASSTATUS_XFER_RDY_REQUEST_OFFSET_ERROR    (0x0D)
44 #define MPI2_SASSTATUS_XFER_RDY_NOT_EXPECTED            (0x0E)
45 #define MPI2_SASSTATUS_DATA_INCORRECT_DATA_LENGTH       (0x0F)
46 #define MPI2_SASSTATUS_DATA_TOO_MUCH_READ_DATA          (0x10)
47 #define MPI2_SASSTATUS_DATA_OFFSET_ERROR                (0x11)
48 #define MPI2_SASSTATUS_SDSF_NAK_RECEIVED                (0x12)
49 #define MPI2_SASSTATUS_SDSF_CONNECTION_FAILED           (0x13)
50 #define MPI2_SASSTATUS_INITIATOR_RESPONSE_TIMEOUT       (0x14)
51
52
53 /*
54  * Values for the SAS DeviceInfo field used in SAS Device Status Change Event
55  * data and SAS Configuration pages.
56  */
57 #define MPI2_SAS_DEVICE_INFO_SEP                (0x00004000)
58 #define MPI2_SAS_DEVICE_INFO_ATAPI_DEVICE       (0x00002000)
59 #define MPI2_SAS_DEVICE_INFO_LSI_DEVICE         (0x00001000)
60 #define MPI2_SAS_DEVICE_INFO_DIRECT_ATTACH      (0x00000800)
61 #define MPI2_SAS_DEVICE_INFO_SSP_TARGET         (0x00000400)
62 #define MPI2_SAS_DEVICE_INFO_STP_TARGET         (0x00000200)
63 #define MPI2_SAS_DEVICE_INFO_SMP_TARGET         (0x00000100)
64 #define MPI2_SAS_DEVICE_INFO_SATA_DEVICE        (0x00000080)
65 #define MPI2_SAS_DEVICE_INFO_SSP_INITIATOR      (0x00000040)
66 #define MPI2_SAS_DEVICE_INFO_STP_INITIATOR      (0x00000020)
67 #define MPI2_SAS_DEVICE_INFO_SMP_INITIATOR      (0x00000010)
68 #define MPI2_SAS_DEVICE_INFO_SATA_HOST          (0x00000008)
69
70 #define MPI2_SAS_DEVICE_INFO_MASK_DEVICE_TYPE   (0x00000007)
71 #define MPI2_SAS_DEVICE_INFO_NO_DEVICE          (0x00000000)
72 #define MPI2_SAS_DEVICE_INFO_END_DEVICE         (0x00000001)
73 #define MPI2_SAS_DEVICE_INFO_EDGE_EXPANDER      (0x00000002)
74 #define MPI2_SAS_DEVICE_INFO_FANOUT_EXPANDER    (0x00000003)
75
76
77 /*****************************************************************************
78 *
79 *        SAS Messages
80 *
81 *****************************************************************************/
82
83 /****************************************************************************
84 *  SMP Passthrough messages
85 ****************************************************************************/
86
87 /* SMP Passthrough Request Message */
88 typedef struct _MPI2_SMP_PASSTHROUGH_REQUEST
89 {
90     U8                      PassthroughFlags;   /* 0x00 */
91     U8                      PhysicalPort;       /* 0x01 */
92     U8                      ChainOffset;        /* 0x02 */
93     U8                      Function;           /* 0x03 */
94     U16                     RequestDataLength;  /* 0x04 */
95     U8                      SGLFlags;           /* 0x06 */
96     U8                      MsgFlags;           /* 0x07 */
97     U8                      VP_ID;              /* 0x08 */
98     U8                      VF_ID;              /* 0x09 */
99     U16                     Reserved1;          /* 0x0A */
100     U32                     Reserved2;          /* 0x0C */
101     U64                     SASAddress;         /* 0x10 */
102     U32                     Reserved3;          /* 0x18 */
103     U32                     Reserved4;          /* 0x1C */
104     MPI2_SIMPLE_SGE_UNION   SGL;                /* 0x20 */
105 } MPI2_SMP_PASSTHROUGH_REQUEST, MPI2_POINTER PTR_MPI2_SMP_PASSTHROUGH_REQUEST,
106   Mpi2SmpPassthroughRequest_t, MPI2_POINTER pMpi2SmpPassthroughRequest_t;
107
108 /* values for PassthroughFlags field */
109 #define MPI2_SMP_PT_REQ_PT_FLAGS_IMMEDIATE      (0x80)
110
111 /* values for SGLFlags field are in the SGL section of mpi2.h */
112
113
114 /* SMP Passthrough Reply Message */
115 typedef struct _MPI2_SMP_PASSTHROUGH_REPLY
116 {
117     U8                      PassthroughFlags;   /* 0x00 */
118     U8                      PhysicalPort;       /* 0x01 */
119     U8                      MsgLength;          /* 0x02 */
120     U8                      Function;           /* 0x03 */
121     U16                     ResponseDataLength; /* 0x04 */
122     U8                      SGLFlags;           /* 0x06 */
123     U8                      MsgFlags;           /* 0x07 */
124     U8                      VP_ID;              /* 0x08 */
125     U8                      VF_ID;              /* 0x09 */
126     U16                     Reserved1;          /* 0x0A */
127     U8                      Reserved2;          /* 0x0C */
128     U8                      SASStatus;          /* 0x0D */
129     U16                     IOCStatus;          /* 0x0E */
130     U32                     IOCLogInfo;         /* 0x10 */
131     U32                     Reserved3;          /* 0x14 */
132     U8                      ResponseData[4];    /* 0x18 */
133 } MPI2_SMP_PASSTHROUGH_REPLY, MPI2_POINTER PTR_MPI2_SMP_PASSTHROUGH_REPLY,
134   Mpi2SmpPassthroughReply_t, MPI2_POINTER pMpi2SmpPassthroughReply_t;
135
136 /* values for PassthroughFlags field */
137 #define MPI2_SMP_PT_REPLY_PT_FLAGS_IMMEDIATE    (0x80)
138
139 /* values for SASStatus field are at the top of this file */
140
141
142 /****************************************************************************
143 *  SATA Passthrough messages
144 ****************************************************************************/
145
146 /* SATA Passthrough Request Message */
147 typedef struct _MPI2_SATA_PASSTHROUGH_REQUEST
148 {
149     U16                     DevHandle;          /* 0x00 */
150     U8                      ChainOffset;        /* 0x02 */
151     U8                      Function;           /* 0x03 */
152     U16                     PassthroughFlags;   /* 0x04 */
153     U8                      SGLFlags;           /* 0x06 */
154     U8                      MsgFlags;           /* 0x07 */
155     U8                      VP_ID;              /* 0x08 */
156     U8                      VF_ID;              /* 0x09 */
157     U16                     Reserved1;          /* 0x0A */
158     U32                     Reserved2;          /* 0x0C */
159     U32                     Reserved3;          /* 0x10 */
160     U32                     Reserved4;          /* 0x14 */
161     U32                     DataLength;         /* 0x18 */
162     U8                      CommandFIS[20];     /* 0x1C */
163     MPI2_SIMPLE_SGE_UNION   SGL;                /* 0x20 */
164 } MPI2_SATA_PASSTHROUGH_REQUEST, MPI2_POINTER PTR_MPI2_SATA_PASSTHROUGH_REQUEST,
165   Mpi2SataPassthroughRequest_t, MPI2_POINTER pMpi2SataPassthroughRequest_t;
166
167 /* values for PassthroughFlags field */
168 #define MPI2_SATA_PT_REQ_PT_FLAGS_EXECUTE_DIAG      (0x0100)
169 #define MPI2_SATA_PT_REQ_PT_FLAGS_DMA               (0x0020)
170 #define MPI2_SATA_PT_REQ_PT_FLAGS_PIO               (0x0010)
171 #define MPI2_SATA_PT_REQ_PT_FLAGS_UNSPECIFIED_VU    (0x0004)
172 #define MPI2_SATA_PT_REQ_PT_FLAGS_WRITE             (0x0002)
173 #define MPI2_SATA_PT_REQ_PT_FLAGS_READ              (0x0001)
174
175 /* values for SGLFlags field are in the SGL section of mpi2.h */
176
177
178 /* SATA Passthrough Reply Message */
179 typedef struct _MPI2_SATA_PASSTHROUGH_REPLY
180 {
181     U16                     DevHandle;          /* 0x00 */
182     U8                      MsgLength;          /* 0x02 */
183     U8                      Function;           /* 0x03 */
184     U16                     PassthroughFlags;   /* 0x04 */
185     U8                      SGLFlags;           /* 0x06 */
186     U8                      MsgFlags;           /* 0x07 */
187     U8                      VP_ID;              /* 0x08 */
188     U8                      VF_ID;              /* 0x09 */
189     U16                     Reserved1;          /* 0x0A */
190     U8                      Reserved2;          /* 0x0C */
191     U8                      SASStatus;          /* 0x0D */
192     U16                     IOCStatus;          /* 0x0E */
193     U32                     IOCLogInfo;         /* 0x10 */
194     U8                      StatusFIS[20];      /* 0x14 */
195     U32                     StatusControlRegisters; /* 0x28 */
196     U32                     TransferCount;      /* 0x2C */
197 } MPI2_SATA_PASSTHROUGH_REPLY, MPI2_POINTER PTR_MPI2_SATA_PASSTHROUGH_REPLY,
198   Mpi2SataPassthroughReply_t, MPI2_POINTER pMpi2SataPassthroughReply_t;
199
200 /* values for SASStatus field are at the top of this file */
201
202
203 /****************************************************************************
204 *  SAS IO Unit Control messages
205 ****************************************************************************/
206
207 /* SAS IO Unit Control Request Message */
208 typedef struct _MPI2_SAS_IOUNIT_CONTROL_REQUEST
209 {
210     U8                      Operation;          /* 0x00 */
211     U8                      Reserved1;          /* 0x01 */
212     U8                      ChainOffset;        /* 0x02 */
213     U8                      Function;           /* 0x03 */
214     U16                     DevHandle;          /* 0x04 */
215     U8                      IOCParameter;       /* 0x06 */
216     U8                      MsgFlags;           /* 0x07 */
217     U8                      VP_ID;              /* 0x08 */
218     U8                      VF_ID;              /* 0x09 */
219     U16                     Reserved3;          /* 0x0A */
220     U16                     Reserved4;          /* 0x0C */
221     U8                      PhyNum;             /* 0x0E */
222     U8                      PrimFlags;          /* 0x0F */
223     U32                     Primitive;          /* 0x10 */
224     U8                      LookupMethod;       /* 0x14 */
225     U8                      Reserved5;          /* 0x15 */
226     U16                     SlotNumber;         /* 0x16 */
227     U64                     LookupAddress;      /* 0x18 */
228     U32                     IOCParameterValue;  /* 0x20 */
229     U32                     Reserved7;          /* 0x24 */
230     U32                     Reserved8;          /* 0x28 */
231 } MPI2_SAS_IOUNIT_CONTROL_REQUEST,
232   MPI2_POINTER PTR_MPI2_SAS_IOUNIT_CONTROL_REQUEST,
233   Mpi2SasIoUnitControlRequest_t, MPI2_POINTER pMpi2SasIoUnitControlRequest_t;
234
235 /* values for the Operation field */
236 #define MPI2_SAS_OP_CLEAR_ALL_PERSISTENT        (0x02)
237 #define MPI2_SAS_OP_PHY_LINK_RESET              (0x06)
238 #define MPI2_SAS_OP_PHY_HARD_RESET              (0x07)
239 #define MPI2_SAS_OP_PHY_CLEAR_ERROR_LOG         (0x08)
240 #define MPI2_SAS_OP_SEND_PRIMITIVE              (0x0A)
241 #define MPI2_SAS_OP_FORCE_FULL_DISCOVERY        (0x0B)
242 #define MPI2_SAS_OP_TRANSMIT_PORT_SELECT_SIGNAL (0x0C)
243 #define MPI2_SAS_OP_REMOVE_DEVICE               (0x0D)
244 #define MPI2_SAS_OP_LOOKUP_MAPPING              (0x0E)
245 #define MPI2_SAS_OP_SET_IOC_PARAMETER           (0x0F)
246 #define MPI2_SAS_OP_PRODUCT_SPECIFIC_MIN        (0x80)
247
248 /* values for the PrimFlags field */
249 #define MPI2_SAS_PRIMFLAGS_SINGLE               (0x08)
250 #define MPI2_SAS_PRIMFLAGS_TRIPLE               (0x02)
251 #define MPI2_SAS_PRIMFLAGS_REDUNDANT            (0x01)
252
253 /* values for the LookupMethod field */
254 #define MPI2_SAS_LOOKUP_METHOD_SAS_ADDRESS          (0x01)
255 #define MPI2_SAS_LOOKUP_METHOD_SAS_ENCLOSURE_SLOT   (0x02)
256 #define MPI2_SAS_LOOKUP_METHOD_SAS_DEVICE_NAME      (0x03)
257
258
259 /* SAS IO Unit Control Reply Message */
260 typedef struct _MPI2_SAS_IOUNIT_CONTROL_REPLY
261 {
262     U8                      Operation;          /* 0x00 */
263     U8                      Reserved1;          /* 0x01 */
264     U8                      MsgLength;          /* 0x02 */
265     U8                      Function;           /* 0x03 */
266     U16                     DevHandle;          /* 0x04 */
267     U8                      IOCParameter;       /* 0x06 */
268     U8                      MsgFlags;           /* 0x07 */
269     U8                      VP_ID;              /* 0x08 */
270     U8                      VF_ID;              /* 0x09 */
271     U16                     Reserved3;          /* 0x0A */
272     U16                     Reserved4;          /* 0x0C */
273     U16                     IOCStatus;          /* 0x0E */
274     U32                     IOCLogInfo;         /* 0x10 */
275 } MPI2_SAS_IOUNIT_CONTROL_REPLY,
276   MPI2_POINTER PTR_MPI2_SAS_IOUNIT_CONTROL_REPLY,
277   Mpi2SasIoUnitControlReply_t, MPI2_POINTER pMpi2SasIoUnitControlReply_t;
278
279
280 #endif
281
282