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