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