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