Merge git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable
[pandora-kernel.git] / drivers / scsi / mpt2sas / mpi / mpi2_tool.h
1 /*
2  *  Copyright (c) 2000-2009 LSI Corporation.
3  *
4  *
5  *           Name:  mpi2_tool.h
6  *          Title:  MPI diagnostic tool structures and definitions
7  *  Creation Date:  March 26, 2007
8  *
9  *    mpi2_tool.h Version:  02.00.04
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  *  12-18-07  02.00.01  Added Diagnostic Buffer Post and Diagnostic Release
18  *                      structures and defines.
19  *  02-29-08  02.00.02  Modified various names to make them 32-character unique.
20  *  05-06-09  02.00.03  Added ISTWI Read Write Tool and Diagnostic CLI Tool.
21  *  07-30-09  02.00.04  Added ExtendedType field to DiagnosticBufferPost request
22  *                      and reply messages.
23  *                      Added MPI2_DIAG_BUF_TYPE_EXTENDED.
24  *                      Incremented MPI2_DIAG_BUF_TYPE_COUNT.
25  *  --------------------------------------------------------------------------
26  */
27
28 #ifndef MPI2_TOOL_H
29 #define MPI2_TOOL_H
30
31 /*****************************************************************************
32 *
33 *               Toolbox Messages
34 *
35 *****************************************************************************/
36
37 /* defines for the Tools */
38 #define MPI2_TOOLBOX_CLEAN_TOOL                     (0x00)
39 #define MPI2_TOOLBOX_MEMORY_MOVE_TOOL               (0x01)
40 #define MPI2_TOOLBOX_ISTWI_READ_WRITE_TOOL          (0x03)
41 #define MPI2_TOOLBOX_BEACON_TOOL                    (0x05)
42 #define MPI2_TOOLBOX_DIAGNOSTIC_CLI_TOOL            (0x06)
43
44
45 /****************************************************************************
46 *  Toolbox reply
47 ****************************************************************************/
48
49 typedef struct _MPI2_TOOLBOX_REPLY
50 {
51     U8                      Tool;                       /* 0x00 */
52     U8                      Reserved1;                  /* 0x01 */
53     U8                      MsgLength;                  /* 0x02 */
54     U8                      Function;                   /* 0x03 */
55     U16                     Reserved2;                  /* 0x04 */
56     U8                      Reserved3;                  /* 0x06 */
57     U8                      MsgFlags;                   /* 0x07 */
58     U8                      VP_ID;                      /* 0x08 */
59     U8                      VF_ID;                      /* 0x09 */
60     U16                     Reserved4;                  /* 0x0A */
61     U16                     Reserved5;                  /* 0x0C */
62     U16                     IOCStatus;                  /* 0x0E */
63     U32                     IOCLogInfo;                 /* 0x10 */
64 } MPI2_TOOLBOX_REPLY, MPI2_POINTER PTR_MPI2_TOOLBOX_REPLY,
65   Mpi2ToolboxReply_t, MPI2_POINTER pMpi2ToolboxReply_t;
66
67
68 /****************************************************************************
69 *  Toolbox Clean Tool request
70 ****************************************************************************/
71
72 typedef struct _MPI2_TOOLBOX_CLEAN_REQUEST
73 {
74     U8                      Tool;                       /* 0x00 */
75     U8                      Reserved1;                  /* 0x01 */
76     U8                      ChainOffset;                /* 0x02 */
77     U8                      Function;                   /* 0x03 */
78     U16                     Reserved2;                  /* 0x04 */
79     U8                      Reserved3;                  /* 0x06 */
80     U8                      MsgFlags;                   /* 0x07 */
81     U8                      VP_ID;                      /* 0x08 */
82     U8                      VF_ID;                      /* 0x09 */
83     U16                     Reserved4;                  /* 0x0A */
84     U32                     Flags;                      /* 0x0C */
85    } MPI2_TOOLBOX_CLEAN_REQUEST, MPI2_POINTER PTR_MPI2_TOOLBOX_CLEAN_REQUEST,
86   Mpi2ToolboxCleanRequest_t, MPI2_POINTER pMpi2ToolboxCleanRequest_t;
87
88 /* values for the Flags field */
89 #define MPI2_TOOLBOX_CLEAN_BOOT_SERVICES            (0x80000000)
90 #define MPI2_TOOLBOX_CLEAN_PERSIST_MANUFACT_PAGES   (0x40000000)
91 #define MPI2_TOOLBOX_CLEAN_OTHER_PERSIST_PAGES      (0x20000000)
92 #define MPI2_TOOLBOX_CLEAN_FW_CURRENT               (0x10000000)
93 #define MPI2_TOOLBOX_CLEAN_FW_BACKUP                (0x08000000)
94 #define MPI2_TOOLBOX_CLEAN_MEGARAID                 (0x02000000)
95 #define MPI2_TOOLBOX_CLEAN_INITIALIZATION           (0x01000000)
96 #define MPI2_TOOLBOX_CLEAN_FLASH                    (0x00000004)
97 #define MPI2_TOOLBOX_CLEAN_SEEPROM                  (0x00000002)
98 #define MPI2_TOOLBOX_CLEAN_NVSRAM                   (0x00000001)
99
100
101 /****************************************************************************
102 *  Toolbox Memory Move request
103 ****************************************************************************/
104
105 typedef struct _MPI2_TOOLBOX_MEM_MOVE_REQUEST
106 {
107     U8                      Tool;                       /* 0x00 */
108     U8                      Reserved1;                  /* 0x01 */
109     U8                      ChainOffset;                /* 0x02 */
110     U8                      Function;                   /* 0x03 */
111     U16                     Reserved2;                  /* 0x04 */
112     U8                      Reserved3;                  /* 0x06 */
113     U8                      MsgFlags;                   /* 0x07 */
114     U8                      VP_ID;                      /* 0x08 */
115     U8                      VF_ID;                      /* 0x09 */
116     U16                     Reserved4;                  /* 0x0A */
117     MPI2_SGE_SIMPLE_UNION   SGL;                        /* 0x0C */
118 } MPI2_TOOLBOX_MEM_MOVE_REQUEST, MPI2_POINTER PTR_MPI2_TOOLBOX_MEM_MOVE_REQUEST,
119   Mpi2ToolboxMemMoveRequest_t, MPI2_POINTER pMpi2ToolboxMemMoveRequest_t;
120
121
122 /****************************************************************************
123 *  Toolbox ISTWI Read Write Tool
124 ****************************************************************************/
125
126 /* Toolbox ISTWI Read Write Tool request message */
127 typedef struct _MPI2_TOOLBOX_ISTWI_READ_WRITE_REQUEST {
128     U8                      Tool;                       /* 0x00 */
129     U8                      Reserved1;                  /* 0x01 */
130     U8                      ChainOffset;                /* 0x02 */
131     U8                      Function;                   /* 0x03 */
132     U16                     Reserved2;                  /* 0x04 */
133     U8                      Reserved3;                  /* 0x06 */
134     U8                      MsgFlags;                   /* 0x07 */
135     U8                      VP_ID;                      /* 0x08 */
136     U8                      VF_ID;                      /* 0x09 */
137     U16                     Reserved4;                  /* 0x0A */
138     U32                     Reserved5;                  /* 0x0C */
139     U32                     Reserved6;                  /* 0x10 */
140     U8                      DevIndex;                   /* 0x14 */
141     U8                      Action;                     /* 0x15 */
142     U8                      SGLFlags;                   /* 0x16 */
143     U8                      Reserved7;                  /* 0x17 */
144     U16                     TxDataLength;               /* 0x18 */
145     U16                     RxDataLength;               /* 0x1A */
146     U32                     Reserved8;                  /* 0x1C */
147     U32                     Reserved9;                  /* 0x20 */
148     U32                     Reserved10;                 /* 0x24 */
149     U32                     Reserved11;                 /* 0x28 */
150     U32                     Reserved12;                 /* 0x2C */
151     MPI2_SGE_SIMPLE_UNION   SGL;                        /* 0x30 */
152 } MPI2_TOOLBOX_ISTWI_READ_WRITE_REQUEST,
153   MPI2_POINTER PTR_MPI2_TOOLBOX_ISTWI_READ_WRITE_REQUEST,
154   Mpi2ToolboxIstwiReadWriteRequest_t,
155   MPI2_POINTER pMpi2ToolboxIstwiReadWriteRequest_t;
156
157 /* values for the Action field */
158 #define MPI2_TOOL_ISTWI_ACTION_READ_DATA            (0x01)
159 #define MPI2_TOOL_ISTWI_ACTION_WRITE_DATA           (0x02)
160 #define MPI2_TOOL_ISTWI_ACTION_SEQUENCE             (0x03)
161 #define MPI2_TOOL_ISTWI_ACTION_RESERVE_BUS          (0x10)
162 #define MPI2_TOOL_ISTWI_ACTION_RELEASE_BUS          (0x11)
163 #define MPI2_TOOL_ISTWI_ACTION_RESET                (0x12)
164
165 /* values for SGLFlags field are in the SGL section of mpi2.h */
166
167
168 /* Toolbox ISTWI Read Write Tool reply message */
169 typedef struct _MPI2_TOOLBOX_ISTWI_REPLY {
170     U8                      Tool;                       /* 0x00 */
171     U8                      Reserved1;                  /* 0x01 */
172     U8                      MsgLength;                  /* 0x02 */
173     U8                      Function;                   /* 0x03 */
174     U16                     Reserved2;                  /* 0x04 */
175     U8                      Reserved3;                  /* 0x06 */
176     U8                      MsgFlags;                   /* 0x07 */
177     U8                      VP_ID;                      /* 0x08 */
178     U8                      VF_ID;                      /* 0x09 */
179     U16                     Reserved4;                  /* 0x0A */
180     U16                     Reserved5;                  /* 0x0C */
181     U16                     IOCStatus;                  /* 0x0E */
182     U32                     IOCLogInfo;                 /* 0x10 */
183     U8                      DevIndex;                   /* 0x14 */
184     U8                      Action;                     /* 0x15 */
185     U8                      IstwiStatus;                /* 0x16 */
186     U8                      Reserved6;                  /* 0x17 */
187     U16                     TxDataCount;                /* 0x18 */
188     U16                     RxDataCount;                /* 0x1A */
189 } MPI2_TOOLBOX_ISTWI_REPLY, MPI2_POINTER PTR_MPI2_TOOLBOX_ISTWI_REPLY,
190   Mpi2ToolboxIstwiReply_t, MPI2_POINTER pMpi2ToolboxIstwiReply_t;
191
192
193 /****************************************************************************
194 *  Toolbox Beacon Tool request
195 ****************************************************************************/
196
197 typedef struct _MPI2_TOOLBOX_BEACON_REQUEST
198 {
199     U8                      Tool;                       /* 0x00 */
200     U8                      Reserved1;                  /* 0x01 */
201     U8                      ChainOffset;                /* 0x02 */
202     U8                      Function;                   /* 0x03 */
203     U16                     Reserved2;                  /* 0x04 */
204     U8                      Reserved3;                  /* 0x06 */
205     U8                      MsgFlags;                   /* 0x07 */
206     U8                      VP_ID;                      /* 0x08 */
207     U8                      VF_ID;                      /* 0x09 */
208     U16                     Reserved4;                  /* 0x0A */
209     U8                      Reserved5;                  /* 0x0C */
210     U8                      PhysicalPort;               /* 0x0D */
211     U8                      Reserved6;                  /* 0x0E */
212     U8                      Flags;                      /* 0x0F */
213 } MPI2_TOOLBOX_BEACON_REQUEST, MPI2_POINTER PTR_MPI2_TOOLBOX_BEACON_REQUEST,
214   Mpi2ToolboxBeaconRequest_t, MPI2_POINTER pMpi2ToolboxBeaconRequest_t;
215
216 /* values for the Flags field */
217 #define MPI2_TOOLBOX_FLAGS_BEACONMODE_OFF       (0x00)
218 #define MPI2_TOOLBOX_FLAGS_BEACONMODE_ON        (0x01)
219
220
221 /****************************************************************************
222 *  Toolbox Diagnostic CLI Tool
223 ****************************************************************************/
224
225 #define MPI2_TOOLBOX_DIAG_CLI_CMD_LENGTH    (0x5C)
226
227 /* Toolbox Diagnostic CLI Tool request message */
228 typedef struct _MPI2_TOOLBOX_DIAGNOSTIC_CLI_REQUEST {
229     U8                      Tool;                       /* 0x00 */
230     U8                      Reserved1;                  /* 0x01 */
231     U8                      ChainOffset;                /* 0x02 */
232     U8                      Function;                   /* 0x03 */
233     U16                     Reserved2;                  /* 0x04 */
234     U8                      Reserved3;                  /* 0x06 */
235     U8                      MsgFlags;                   /* 0x07 */
236     U8                      VP_ID;                      /* 0x08 */
237     U8                      VF_ID;                      /* 0x09 */
238     U16                     Reserved4;                  /* 0x0A */
239     U8                      SGLFlags;                   /* 0x0C */
240     U8                      Reserved5;                  /* 0x0D */
241     U16                     Reserved6;                  /* 0x0E */
242     U32                     DataLength;                 /* 0x10 */
243     U8                      DiagnosticCliCommand
244                 [MPI2_TOOLBOX_DIAG_CLI_CMD_LENGTH];     /* 0x14 */
245     MPI2_SGE_SIMPLE_UNION   SGL;                        /* 0x70 */
246 } MPI2_TOOLBOX_DIAGNOSTIC_CLI_REQUEST,
247   MPI2_POINTER PTR_MPI2_TOOLBOX_DIAGNOSTIC_CLI_REQUEST,
248   Mpi2ToolboxDiagnosticCliRequest_t,
249   MPI2_POINTER pMpi2ToolboxDiagnosticCliRequest_t;
250
251 /* values for SGLFlags field are in the SGL section of mpi2.h */
252
253
254 /* Toolbox Diagnostic CLI Tool reply message */
255 typedef struct _MPI2_TOOLBOX_DIAGNOSTIC_CLI_REPLY {
256     U8                      Tool;                       /* 0x00 */
257     U8                      Reserved1;                  /* 0x01 */
258     U8                      MsgLength;                  /* 0x02 */
259     U8                      Function;                   /* 0x03 */
260     U16                     Reserved2;                  /* 0x04 */
261     U8                      Reserved3;                  /* 0x06 */
262     U8                      MsgFlags;                   /* 0x07 */
263     U8                      VP_ID;                      /* 0x08 */
264     U8                      VF_ID;                      /* 0x09 */
265     U16                     Reserved4;                  /* 0x0A */
266     U16                     Reserved5;                  /* 0x0C */
267     U16                     IOCStatus;                  /* 0x0E */
268     U32                     IOCLogInfo;                 /* 0x10 */
269     U32                     ReturnedDataLength;         /* 0x14 */
270 } MPI2_TOOLBOX_DIAGNOSTIC_CLI_REPLY,
271   MPI2_POINTER PTR_MPI2_TOOLBOX_DIAG_CLI_REPLY,
272   Mpi2ToolboxDiagnosticCliReply_t,
273   MPI2_POINTER pMpi2ToolboxDiagnosticCliReply_t;
274
275
276 /*****************************************************************************
277 *
278 *       Diagnostic Buffer Messages
279 *
280 *****************************************************************************/
281
282
283 /****************************************************************************
284 *  Diagnostic Buffer Post request
285 ****************************************************************************/
286
287 typedef struct _MPI2_DIAG_BUFFER_POST_REQUEST
288 {
289     U8                      ExtendedType;               /* 0x00 */
290     U8                      BufferType;                 /* 0x01 */
291     U8                      ChainOffset;                /* 0x02 */
292     U8                      Function;                   /* 0x03 */
293     U16                     Reserved2;                  /* 0x04 */
294     U8                      Reserved3;                  /* 0x06 */
295     U8                      MsgFlags;                   /* 0x07 */
296     U8                      VP_ID;                      /* 0x08 */
297     U8                      VF_ID;                      /* 0x09 */
298     U16                     Reserved4;                  /* 0x0A */
299     U64                     BufferAddress;              /* 0x0C */
300     U32                     BufferLength;               /* 0x14 */
301     U32                     Reserved5;                  /* 0x18 */
302     U32                     Reserved6;                  /* 0x1C */
303     U32                     Flags;                      /* 0x20 */
304     U32                     ProductSpecific[23];        /* 0x24 */
305 } MPI2_DIAG_BUFFER_POST_REQUEST, MPI2_POINTER PTR_MPI2_DIAG_BUFFER_POST_REQUEST,
306   Mpi2DiagBufferPostRequest_t, MPI2_POINTER pMpi2DiagBufferPostRequest_t;
307
308 /* values for the ExtendedType field */
309 #define MPI2_DIAG_EXTENDED_TYPE_UTILIZATION         (0x02)
310
311 /* values for the BufferType field */
312 #define MPI2_DIAG_BUF_TYPE_TRACE                    (0x00)
313 #define MPI2_DIAG_BUF_TYPE_SNAPSHOT                 (0x01)
314 #define MPI2_DIAG_BUF_TYPE_EXTENDED                 (0x02)
315 /* count of the number of buffer types */
316 #define MPI2_DIAG_BUF_TYPE_COUNT                    (0x03)
317
318
319 /****************************************************************************
320 *  Diagnostic Buffer Post reply
321 ****************************************************************************/
322
323 typedef struct _MPI2_DIAG_BUFFER_POST_REPLY
324 {
325     U8                      ExtendedType;               /* 0x00 */
326     U8                      BufferType;                 /* 0x01 */
327     U8                      MsgLength;                  /* 0x02 */
328     U8                      Function;                   /* 0x03 */
329     U16                     Reserved2;                  /* 0x04 */
330     U8                      Reserved3;                  /* 0x06 */
331     U8                      MsgFlags;                   /* 0x07 */
332     U8                      VP_ID;                      /* 0x08 */
333     U8                      VF_ID;                      /* 0x09 */
334     U16                     Reserved4;                  /* 0x0A */
335     U16                     Reserved5;                  /* 0x0C */
336     U16                     IOCStatus;                  /* 0x0E */
337     U32                     IOCLogInfo;                 /* 0x10 */
338     U32                     TransferLength;             /* 0x14 */
339 } MPI2_DIAG_BUFFER_POST_REPLY, MPI2_POINTER PTR_MPI2_DIAG_BUFFER_POST_REPLY,
340   Mpi2DiagBufferPostReply_t, MPI2_POINTER pMpi2DiagBufferPostReply_t;
341
342
343 /****************************************************************************
344 *  Diagnostic Release request
345 ****************************************************************************/
346
347 typedef struct _MPI2_DIAG_RELEASE_REQUEST
348 {
349     U8                      Reserved1;                  /* 0x00 */
350     U8                      BufferType;                 /* 0x01 */
351     U8                      ChainOffset;                /* 0x02 */
352     U8                      Function;                   /* 0x03 */
353     U16                     Reserved2;                  /* 0x04 */
354     U8                      Reserved3;                  /* 0x06 */
355     U8                      MsgFlags;                   /* 0x07 */
356     U8                      VP_ID;                      /* 0x08 */
357     U8                      VF_ID;                      /* 0x09 */
358     U16                     Reserved4;                  /* 0x0A */
359 } MPI2_DIAG_RELEASE_REQUEST, MPI2_POINTER PTR_MPI2_DIAG_RELEASE_REQUEST,
360   Mpi2DiagReleaseRequest_t, MPI2_POINTER pMpi2DiagReleaseRequest_t;
361
362
363 /****************************************************************************
364 *  Diagnostic Buffer Post reply
365 ****************************************************************************/
366
367 typedef struct _MPI2_DIAG_RELEASE_REPLY
368 {
369     U8                      Reserved1;                  /* 0x00 */
370     U8                      BufferType;                 /* 0x01 */
371     U8                      MsgLength;                  /* 0x02 */
372     U8                      Function;                   /* 0x03 */
373     U16                     Reserved2;                  /* 0x04 */
374     U8                      Reserved3;                  /* 0x06 */
375     U8                      MsgFlags;                   /* 0x07 */
376     U8                      VP_ID;                      /* 0x08 */
377     U8                      VF_ID;                      /* 0x09 */
378     U16                     Reserved4;                  /* 0x0A */
379     U16                     Reserved5;                  /* 0x0C */
380     U16                     IOCStatus;                  /* 0x0E */
381     U32                     IOCLogInfo;                 /* 0x10 */
382 } MPI2_DIAG_RELEASE_REPLY, MPI2_POINTER PTR_MPI2_DIAG_RELEASE_REPLY,
383   Mpi2DiagReleaseReply_t, MPI2_POINTER pMpi2DiagReleaseReply_t;
384
385
386 #endif
387