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