1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 *  Copyright (c) 2001-2008 LSI Corporation.
4 *
5 *
6 *           Name:  mpi_tool.h
7 *          Title:  MPI Toolbox structures and definitions
8 *  Creation Date:  July 30, 2001
9 *
10 *    mpi_tool.h Version:  01.05.03
11 *
12 *  Version History
13 *  ---------------
14 *
15 *  Date      Version   Description
16 *  --------  --------  ------------------------------------------------------
17 *  08-08-01  01.02.01  Original release.
18 *  08-29-01  01.02.02  Added DIAG_DATA_UPLOAD_HEADER and related defines.
19 *  01-16-04  01.02.03  Added defines and structures for new tools
20 *.                     MPI_TOOLBOX_ISTWI_READ_WRITE_TOOL and
21 *                      MPI_TOOLBOX_FC_MANAGEMENT_TOOL.
22 *  04-29-04  01.02.04  Added message structures for Diagnostic Buffer Post and
23 *                      Diagnostic Release requests and replies.
24 *  05-11-04  01.03.01  Original release for MPI v1.3.
25 *  08-19-04  01.05.01  Original release for MPI v1.5.
26 *  10-06-04  01.05.02  Added define for MPI_DIAG_BUF_TYPE_COUNT.
27 *  02-09-05  01.05.03  Added frame size option to FC management tool.
28 *                      Added Beacon tool to the Toolbox.
29 *  --------------------------------------------------------------------------
30 */
31
32#ifndef MPI_TOOL_H
33#define MPI_TOOL_H
34
35#define MPI_TOOLBOX_CLEAN_TOOL                      (0x00)
36#define MPI_TOOLBOX_MEMORY_MOVE_TOOL                (0x01)
37#define MPI_TOOLBOX_DIAG_DATA_UPLOAD_TOOL           (0x02)
38#define MPI_TOOLBOX_ISTWI_READ_WRITE_TOOL           (0x03)
39#define MPI_TOOLBOX_FC_MANAGEMENT_TOOL              (0x04)
40#define MPI_TOOLBOX_BEACON_TOOL                     (0x05)
41
42
43/****************************************************************************/
44/* Toolbox reply                                                            */
45/****************************************************************************/
46
47typedef struct _MSG_TOOLBOX_REPLY
48{
49    U8                      Tool;                       /* 00h */
50    U8                      Reserved;                   /* 01h */
51    U8                      MsgLength;                  /* 02h */
52    U8                      Function;                   /* 03h */
53    U16                     Reserved1;                  /* 04h */
54    U8                      Reserved2;                  /* 06h */
55    U8                      MsgFlags;                   /* 07h */
56    U32                     MsgContext;                 /* 08h */
57    U16                     Reserved3;                  /* 0Ch */
58    U16                     IOCStatus;                  /* 0Eh */
59    U32                     IOCLogInfo;                 /* 10h */
60} MSG_TOOLBOX_REPLY, MPI_POINTER PTR_MSG_TOOLBOX_REPLY,
61  ToolboxReply_t, MPI_POINTER pToolboxReply_t;
62
63
64/****************************************************************************/
65/* Toolbox Clean Tool request                                               */
66/****************************************************************************/
67
68typedef struct _MSG_TOOLBOX_CLEAN_REQUEST
69{
70    U8                      Tool;                       /* 00h */
71    U8                      Reserved;                   /* 01h */
72    U8                      ChainOffset;                /* 02h */
73    U8                      Function;                   /* 03h */
74    U16                     Reserved1;                  /* 04h */
75    U8                      Reserved2;                  /* 06h */
76    U8                      MsgFlags;                   /* 07h */
77    U32                     MsgContext;                 /* 08h */
78    U32                     Flags;                      /* 0Ch */
79} MSG_TOOLBOX_CLEAN_REQUEST, MPI_POINTER PTR_MSG_TOOLBOX_CLEAN_REQUEST,
80  ToolboxCleanRequest_t, MPI_POINTER pToolboxCleanRequest_t;
81
82#define MPI_TOOLBOX_CLEAN_NVSRAM                    (0x00000001)
83#define MPI_TOOLBOX_CLEAN_SEEPROM                   (0x00000002)
84#define MPI_TOOLBOX_CLEAN_FLASH                     (0x00000004)
85#define MPI_TOOLBOX_CLEAN_BOOTLOADER                (0x04000000)
86#define MPI_TOOLBOX_CLEAN_FW_BACKUP                 (0x08000000)
87#define MPI_TOOLBOX_CLEAN_FW_CURRENT                (0x10000000)
88#define MPI_TOOLBOX_CLEAN_OTHER_PERSIST_PAGES       (0x20000000)
89#define MPI_TOOLBOX_CLEAN_PERSIST_MANUFACT_PAGES    (0x40000000)
90#define MPI_TOOLBOX_CLEAN_BOOT_SERVICES             (0x80000000)
91
92
93/****************************************************************************/
94/* Toolbox Memory Move request                                              */
95/****************************************************************************/
96
97typedef struct _MSG_TOOLBOX_MEM_MOVE_REQUEST
98{
99    U8                      Tool;                       /* 00h */
100    U8                      Reserved;                   /* 01h */
101    U8                      ChainOffset;                /* 02h */
102    U8                      Function;                   /* 03h */
103    U16                     Reserved1;                  /* 04h */
104    U8                      Reserved2;                  /* 06h */
105    U8                      MsgFlags;                   /* 07h */
106    U32                     MsgContext;                 /* 08h */
107    SGE_SIMPLE_UNION        SGL;                        /* 0Ch */
108} MSG_TOOLBOX_MEM_MOVE_REQUEST, MPI_POINTER PTR_MSG_TOOLBOX_MEM_MOVE_REQUEST,
109  ToolboxMemMoveRequest_t, MPI_POINTER pToolboxMemMoveRequest_t;
110
111
112/****************************************************************************/
113/* Toolbox Diagnostic Data Upload request                                   */
114/****************************************************************************/
115
116typedef struct _MSG_TOOLBOX_DIAG_DATA_UPLOAD_REQUEST
117{
118    U8                      Tool;                       /* 00h */
119    U8                      Reserved;                   /* 01h */
120    U8                      ChainOffset;                /* 02h */
121    U8                      Function;                   /* 03h */
122    U16                     Reserved1;                  /* 04h */
123    U8                      Reserved2;                  /* 06h */
124    U8                      MsgFlags;                   /* 07h */
125    U32                     MsgContext;                 /* 08h */
126    U32                     Flags;                      /* 0Ch */
127    U32                     Reserved3;                  /* 10h */
128    SGE_SIMPLE_UNION        SGL;                        /* 14h */
129} MSG_TOOLBOX_DIAG_DATA_UPLOAD_REQUEST, MPI_POINTER PTR_MSG_TOOLBOX_DIAG_DATA_UPLOAD_REQUEST,
130  ToolboxDiagDataUploadRequest_t, MPI_POINTER pToolboxDiagDataUploadRequest_t;
131
132typedef struct _DIAG_DATA_UPLOAD_HEADER
133{
134    U32                     DiagDataLength;             /* 00h */
135    U8                      FormatCode;                 /* 04h */
136    U8                      Reserved;                   /* 05h */
137    U16                     Reserved1;                  /* 06h */
138} DIAG_DATA_UPLOAD_HEADER, MPI_POINTER PTR_DIAG_DATA_UPLOAD_HEADER,
139  DiagDataUploadHeader_t, MPI_POINTER pDiagDataUploadHeader_t;
140
141#define MPI_TB_DIAG_FORMAT_SCSI_PRINTF_1            (0x01)
142#define MPI_TB_DIAG_FORMAT_SCSI_2                   (0x02)
143#define MPI_TB_DIAG_FORMAT_SCSI_3                   (0x03)
144#define MPI_TB_DIAG_FORMAT_FC_TRACE_1               (0x04)
145
146
147/****************************************************************************/
148/* Toolbox ISTWI Read Write request                                         */
149/****************************************************************************/
150
151typedef struct _MSG_TOOLBOX_ISTWI_READ_WRITE_REQUEST
152{
153    U8                      Tool;                       /* 00h */
154    U8                      Reserved;                   /* 01h */
155    U8                      ChainOffset;                /* 02h */
156    U8                      Function;                   /* 03h */
157    U16                     Reserved1;                  /* 04h */
158    U8                      Reserved2;                  /* 06h */
159    U8                      MsgFlags;                   /* 07h */
160    U32                     MsgContext;                 /* 08h */
161    U8                      Flags;                      /* 0Ch */
162    U8                      BusNum;                     /* 0Dh */
163    U16                     Reserved3;                  /* 0Eh */
164    U8                      NumAddressBytes;            /* 10h */
165    U8                      Reserved4;                  /* 11h */
166    U16                     DataLength;                 /* 12h */
167    U8                      DeviceAddr;                 /* 14h */
168    U8                      Addr1;                      /* 15h */
169    U8                      Addr2;                      /* 16h */
170    U8                      Addr3;                      /* 17h */
171    U32                     Reserved5;                  /* 18h */
172    SGE_SIMPLE_UNION        SGL;                        /* 1Ch */
173} MSG_TOOLBOX_ISTWI_READ_WRITE_REQUEST, MPI_POINTER PTR_MSG_TOOLBOX_ISTWI_READ_WRITE_REQUEST,
174  ToolboxIstwiReadWriteRequest_t, MPI_POINTER pToolboxIstwiReadWriteRequest_t;
175
176#define MPI_TB_ISTWI_FLAGS_WRITE                    (0x00)
177#define MPI_TB_ISTWI_FLAGS_READ                     (0x01)
178
179
180/****************************************************************************/
181/* Toolbox FC Management request                                            */
182/****************************************************************************/
183
184/* ActionInfo for Bus and TargetId */
185typedef struct _MPI_TB_FC_MANAGE_BUS_TID_AI
186{
187    U16                     Reserved;                   /* 00h */
188    U8                      Bus;                        /* 02h */
189    U8                      TargetId;                   /* 03h */
190} MPI_TB_FC_MANAGE_BUS_TID_AI, MPI_POINTER PTR_MPI_TB_FC_MANAGE_BUS_TID_AI,
191  MpiTbFcManageBusTidAi_t, MPI_POINTER pMpiTbFcManageBusTidAi_t;
192
193/* ActionInfo for port identifier */
194typedef struct _MPI_TB_FC_MANAGE_PID_AI
195{
196    U32                     PortIdentifier;             /* 00h */
197} MPI_TB_FC_MANAGE_PID_AI, MPI_POINTER PTR_MPI_TB_FC_MANAGE_PID_AI,
198  MpiTbFcManagePidAi_t, MPI_POINTER pMpiTbFcManagePidAi_t;
199
200/* ActionInfo for set max frame size */
201typedef struct _MPI_TB_FC_MANAGE_FRAME_SIZE_AI
202{
203    U16                     FrameSize;                  /* 00h */
204    U8                      PortNum;                    /* 02h */
205    U8                      Reserved1;                  /* 03h */
206} MPI_TB_FC_MANAGE_FRAME_SIZE_AI, MPI_POINTER PTR_MPI_TB_FC_MANAGE_FRAME_SIZE_AI,
207  MpiTbFcManageFrameSizeAi_t, MPI_POINTER pMpiTbFcManageFrameSizeAi_t;
208
209/* union of ActionInfo */
210typedef union _MPI_TB_FC_MANAGE_AI_UNION
211{
212    MPI_TB_FC_MANAGE_BUS_TID_AI     BusTid;
213    MPI_TB_FC_MANAGE_PID_AI         Port;
214    MPI_TB_FC_MANAGE_FRAME_SIZE_AI  FrameSize;
215} MPI_TB_FC_MANAGE_AI_UNION, MPI_POINTER PTR_MPI_TB_FC_MANAGE_AI_UNION,
216  MpiTbFcManageAiUnion_t, MPI_POINTER pMpiTbFcManageAiUnion_t;
217
218typedef struct _MSG_TOOLBOX_FC_MANAGE_REQUEST
219{
220    U8                          Tool;                   /* 00h */
221    U8                          Reserved;               /* 01h */
222    U8                          ChainOffset;            /* 02h */
223    U8                          Function;               /* 03h */
224    U16                         Reserved1;              /* 04h */
225    U8                          Reserved2;              /* 06h */
226    U8                          MsgFlags;               /* 07h */
227    U32                         MsgContext;             /* 08h */
228    U8                          Action;                 /* 0Ch */
229    U8                          Reserved3;              /* 0Dh */
230    U16                         Reserved4;              /* 0Eh */
231    MPI_TB_FC_MANAGE_AI_UNION   ActionInfo;             /* 10h */
232} MSG_TOOLBOX_FC_MANAGE_REQUEST, MPI_POINTER PTR_MSG_TOOLBOX_FC_MANAGE_REQUEST,
233  ToolboxFcManageRequest_t, MPI_POINTER pToolboxFcManageRequest_t;
234
235/* defines for the Action field */
236#define MPI_TB_FC_MANAGE_ACTION_DISC_ALL            (0x00)
237#define MPI_TB_FC_MANAGE_ACTION_DISC_PID            (0x01)
238#define MPI_TB_FC_MANAGE_ACTION_DISC_BUS_TID        (0x02)
239#define MPI_TB_FC_MANAGE_ACTION_SET_MAX_FRAME_SIZE  (0x03)
240
241
242/****************************************************************************/
243/* Toolbox Beacon Tool request                                               */
244/****************************************************************************/
245
246typedef struct _MSG_TOOLBOX_BEACON_REQUEST
247{
248    U8                      Tool;                       /* 00h */
249    U8                      Reserved;                   /* 01h */
250    U8                      ChainOffset;                /* 02h */
251    U8                      Function;                   /* 03h */
252    U16                     Reserved1;                  /* 04h */
253    U8                      Reserved2;                  /* 06h */
254    U8                      MsgFlags;                   /* 07h */
255    U32                     MsgContext;                 /* 08h */
256    U8                      ConnectNum;                 /* 0Ch */
257    U8                      PortNum;                    /* 0Dh */
258    U8                      Reserved3;                  /* 0Eh */
259    U8                      Flags;                      /* 0Fh */
260} MSG_TOOLBOX_BEACON_REQUEST, MPI_POINTER PTR_MSG_TOOLBOX_BEACON_REQUEST,
261  ToolboxBeaconRequest_t, MPI_POINTER pToolboxBeaconRequest_t;
262
263#define MPI_TOOLBOX_FLAGS_BEACON_MODE_OFF       (0x00)
264#define MPI_TOOLBOX_FLAGS_BEACON_MODE_ON        (0x01)
265
266
267/****************************************************************************/
268/* Diagnostic Buffer Post request                                           */
269/****************************************************************************/
270
271typedef struct _MSG_DIAG_BUFFER_POST_REQUEST
272{
273    U8                      TraceLevel;                 /* 00h */
274    U8                      BufferType;                 /* 01h */
275    U8                      ChainOffset;                /* 02h */
276    U8                      Function;                   /* 03h */
277    U16                     Reserved1;                  /* 04h */
278    U8                      Reserved2;                  /* 06h */
279    U8                      MsgFlags;                   /* 07h */
280    U32                     MsgContext;                 /* 08h */
281    U32                     ExtendedType;               /* 0Ch */
282    U32                     BufferLength;               /* 10h */
283    U32                     ProductSpecific[4];         /* 14h */
284    U32                     Reserved3;                  /* 24h */
285    U64                     BufferAddress;              /* 28h */
286} MSG_DIAG_BUFFER_POST_REQUEST, MPI_POINTER PTR_MSG_DIAG_BUFFER_POST_REQUEST,
287  DiagBufferPostRequest_t, MPI_POINTER pDiagBufferPostRequest_t;
288
289#define MPI_DIAG_BUF_TYPE_TRACE                     (0x00)
290#define MPI_DIAG_BUF_TYPE_SNAPSHOT                  (0x01)
291#define MPI_DIAG_BUF_TYPE_EXTENDED                  (0x02)
292/* count of the number of buffer types */
293#define MPI_DIAG_BUF_TYPE_COUNT                     (0x03)
294
295#define MPI_DIAG_EXTENDED_QTAG                      (0x00000001)
296
297
298/* Diagnostic Buffer Post reply */
299typedef struct _MSG_DIAG_BUFFER_POST_REPLY
300{
301    U8                      Reserved1;                  /* 00h */
302    U8                      BufferType;                 /* 01h */
303    U8                      MsgLength;                  /* 02h */
304    U8                      Function;                   /* 03h */
305    U16                     Reserved2;                  /* 04h */
306    U8                      Reserved3;                  /* 06h */
307    U8                      MsgFlags;                   /* 07h */
308    U32                     MsgContext;                 /* 08h */
309    U16                     Reserved4;                  /* 0Ch */
310    U16                     IOCStatus;                  /* 0Eh */
311    U32                     IOCLogInfo;                 /* 10h */
312    U32                     TransferLength;             /* 14h */
313} MSG_DIAG_BUFFER_POST_REPLY, MPI_POINTER PTR_MSG_DIAG_BUFFER_POST_REPLY,
314  DiagBufferPostReply_t, MPI_POINTER pDiagBufferPostReply_t;
315
316
317/****************************************************************************/
318/* Diagnostic Release request                                               */
319/****************************************************************************/
320
321typedef struct _MSG_DIAG_RELEASE_REQUEST
322{
323    U8                      Reserved1;                  /* 00h */
324    U8                      BufferType;                 /* 01h */
325    U8                      ChainOffset;                /* 02h */
326    U8                      Function;                   /* 03h */
327    U16                     Reserved2;                  /* 04h */
328    U8                      Reserved3;                  /* 06h */
329    U8                      MsgFlags;                   /* 07h */
330    U32                     MsgContext;                 /* 08h */
331} MSG_DIAG_RELEASE_REQUEST, MPI_POINTER PTR_MSG_DIAG_RELEASE_REQUEST,
332  DiagReleaseRequest_t, MPI_POINTER pDiagReleaseRequest_t;
333
334
335/* Diagnostic Release reply */
336typedef struct _MSG_DIAG_RELEASE_REPLY
337{
338    U8                      Reserved1;                  /* 00h */
339    U8                      BufferType;                 /* 01h */
340    U8                      MsgLength;                  /* 02h */
341    U8                      Function;                   /* 03h */
342    U16                     Reserved2;                  /* 04h */
343    U8                      Reserved3;                  /* 06h */
344    U8                      MsgFlags;                   /* 07h */
345    U32                     MsgContext;                 /* 08h */
346    U16                     Reserved4;                  /* 0Ch */
347    U16                     IOCStatus;                  /* 0Eh */
348    U32                     IOCLogInfo;                 /* 10h */
349} MSG_DIAG_RELEASE_REPLY, MPI_POINTER PTR_MSG_DIAG_RELEASE_REPLY,
350  DiagReleaseReply_t, MPI_POINTER pDiagReleaseReply_t;
351
352
353#endif
354
355
356