xref: /freebsd/sys/dev/mpt/mpilib/mpi_tool.h (revision edf8578117e8844e02c0121147f45e4609b30680)
1 /*-
2  * SPDX-License-Identifier: BSD-3-Clause
3  *
4  * Copyright (c) 2000-2010, LSI Logic Corporation and its contributors.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are
9  * met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
13  *    substantially similar to the "NO WARRANTY" disclaimer below
14  *    ("Disclaimer") and any redistribution must be conditioned upon including
15  *    a substantially similar Disclaimer requirement for further binary
16  *    redistribution.
17  * 3. Neither the name of the LSI Logic Corporation nor the names of its
18  *    contributors may be used to endorse or promote products derived from
19  *    this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT
31  * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  *
33  *
34  *           Name:  mpi_tool.h
35  *          Title:  MPI Toolbox structures and definitions
36  *  Creation Date:  July 30, 2001
37  *
38  *    mpi_tool.h Version:  01.05.03
39  *
40  *  Version History
41  *  ---------------
42  *
43  *  Date      Version   Description
44  *  --------  --------  ------------------------------------------------------
45  *  08-08-01  01.02.01  Original release.
46  *  08-29-01  01.02.02  Added DIAG_DATA_UPLOAD_HEADER and related defines.
47  *  01-16-04  01.02.03  Added defines and structures for new tools
48  *.                     MPI_TOOLBOX_ISTWI_READ_WRITE_TOOL and
49  *                      MPI_TOOLBOX_FC_MANAGEMENT_TOOL.
50  *  04-29-04  01.02.04  Added message structures for Diagnostic Buffer Post and
51  *                      Diagnostic Release requests and replies.
52  *  05-11-04  01.03.01  Original release for MPI v1.3.
53  *  08-19-04  01.05.01  Original release for MPI v1.5.
54  *  10-06-04  01.05.02  Added define for MPI_DIAG_BUF_TYPE_COUNT.
55  *  02-09-05  01.05.03  Added frame size option to FC management tool.
56  *                      Added Beacon tool to the Toolbox.
57  *  --------------------------------------------------------------------------
58  */
59 
60 #ifndef MPI_TOOL_H
61 #define MPI_TOOL_H
62 
63 #define MPI_TOOLBOX_CLEAN_TOOL                      (0x00)
64 #define MPI_TOOLBOX_MEMORY_MOVE_TOOL                (0x01)
65 #define MPI_TOOLBOX_DIAG_DATA_UPLOAD_TOOL           (0x02)
66 #define MPI_TOOLBOX_ISTWI_READ_WRITE_TOOL           (0x03)
67 #define MPI_TOOLBOX_FC_MANAGEMENT_TOOL              (0x04)
68 #define MPI_TOOLBOX_BEACON_TOOL                     (0x05)
69 
70 /****************************************************************************/
71 /* Toolbox reply                                                            */
72 /****************************************************************************/
73 
74 typedef struct _MSG_TOOLBOX_REPLY
75 {
76     U8                      Tool;                       /* 00h */
77     U8                      Reserved;                   /* 01h */
78     U8                      MsgLength;                  /* 02h */
79     U8                      Function;                   /* 03h */
80     U16                     Reserved1;                  /* 04h */
81     U8                      Reserved2;                  /* 06h */
82     U8                      MsgFlags;                   /* 07h */
83     U32                     MsgContext;                 /* 08h */
84     U16                     Reserved3;                  /* 0Ch */
85     U16                     IOCStatus;                  /* 0Eh */
86     U32                     IOCLogInfo;                 /* 10h */
87 } MSG_TOOLBOX_REPLY, MPI_POINTER PTR_MSG_TOOLBOX_REPLY,
88   ToolboxReply_t, MPI_POINTER pToolboxReply_t;
89 
90 /****************************************************************************/
91 /* Toolbox Clean Tool request                                               */
92 /****************************************************************************/
93 
94 typedef struct _MSG_TOOLBOX_CLEAN_REQUEST
95 {
96     U8                      Tool;                       /* 00h */
97     U8                      Reserved;                   /* 01h */
98     U8                      ChainOffset;                /* 02h */
99     U8                      Function;                   /* 03h */
100     U16                     Reserved1;                  /* 04h */
101     U8                      Reserved2;                  /* 06h */
102     U8                      MsgFlags;                   /* 07h */
103     U32                     MsgContext;                 /* 08h */
104     U32                     Flags;                      /* 0Ch */
105 } MSG_TOOLBOX_CLEAN_REQUEST, MPI_POINTER PTR_MSG_TOOLBOX_CLEAN_REQUEST,
106   ToolboxCleanRequest_t, MPI_POINTER pToolboxCleanRequest_t;
107 
108 #define MPI_TOOLBOX_CLEAN_NVSRAM                    (0x00000001)
109 #define MPI_TOOLBOX_CLEAN_SEEPROM                   (0x00000002)
110 #define MPI_TOOLBOX_CLEAN_FLASH                     (0x00000004)
111 #define MPI_TOOLBOX_CLEAN_BOOTLOADER                (0x04000000)
112 #define MPI_TOOLBOX_CLEAN_FW_BACKUP                 (0x08000000)
113 #define MPI_TOOLBOX_CLEAN_FW_CURRENT                (0x10000000)
114 #define MPI_TOOLBOX_CLEAN_OTHER_PERSIST_PAGES       (0x20000000)
115 #define MPI_TOOLBOX_CLEAN_PERSIST_MANUFACT_PAGES    (0x40000000)
116 #define MPI_TOOLBOX_CLEAN_BOOT_SERVICES             (0x80000000)
117 
118 /****************************************************************************/
119 /* Toolbox Memory Move request                                              */
120 /****************************************************************************/
121 
122 typedef struct _MSG_TOOLBOX_MEM_MOVE_REQUEST
123 {
124     U8                      Tool;                       /* 00h */
125     U8                      Reserved;                   /* 01h */
126     U8                      ChainOffset;                /* 02h */
127     U8                      Function;                   /* 03h */
128     U16                     Reserved1;                  /* 04h */
129     U8                      Reserved2;                  /* 06h */
130     U8                      MsgFlags;                   /* 07h */
131     U32                     MsgContext;                 /* 08h */
132     SGE_SIMPLE_UNION        SGL;                        /* 0Ch */
133 } MSG_TOOLBOX_MEM_MOVE_REQUEST, MPI_POINTER PTR_MSG_TOOLBOX_MEM_MOVE_REQUEST,
134   ToolboxMemMoveRequest_t, MPI_POINTER pToolboxMemMoveRequest_t;
135 
136 /****************************************************************************/
137 /* Toolbox Diagnostic Data Upload request                                   */
138 /****************************************************************************/
139 
140 typedef struct _MSG_TOOLBOX_DIAG_DATA_UPLOAD_REQUEST
141 {
142     U8                      Tool;                       /* 00h */
143     U8                      Reserved;                   /* 01h */
144     U8                      ChainOffset;                /* 02h */
145     U8                      Function;                   /* 03h */
146     U16                     Reserved1;                  /* 04h */
147     U8                      Reserved2;                  /* 06h */
148     U8                      MsgFlags;                   /* 07h */
149     U32                     MsgContext;                 /* 08h */
150     U32                     Flags;                      /* 0Ch */
151     U32                     Reserved3;                  /* 10h */
152     SGE_SIMPLE_UNION        SGL;                        /* 14h */
153 } MSG_TOOLBOX_DIAG_DATA_UPLOAD_REQUEST, MPI_POINTER PTR_MSG_TOOLBOX_DIAG_DATA_UPLOAD_REQUEST,
154   ToolboxDiagDataUploadRequest_t, MPI_POINTER pToolboxDiagDataUploadRequest_t;
155 
156 typedef struct _DIAG_DATA_UPLOAD_HEADER
157 {
158     U32                     DiagDataLength;             /* 00h */
159     U8                      FormatCode;                 /* 04h */
160     U8                      Reserved;                   /* 05h */
161     U16                     Reserved1;                  /* 06h */
162 } DIAG_DATA_UPLOAD_HEADER, MPI_POINTER PTR_DIAG_DATA_UPLOAD_HEADER,
163   DiagDataUploadHeader_t, MPI_POINTER pDiagDataUploadHeader_t;
164 
165 #define MPI_TB_DIAG_FORMAT_SCSI_PRINTF_1            (0x01)
166 #define MPI_TB_DIAG_FORMAT_SCSI_2                   (0x02)
167 #define MPI_TB_DIAG_FORMAT_SCSI_3                   (0x03)
168 #define MPI_TB_DIAG_FORMAT_FC_TRACE_1               (0x04)
169 
170 /****************************************************************************/
171 /* Toolbox ISTWI Read Write request                                         */
172 /****************************************************************************/
173 
174 typedef struct _MSG_TOOLBOX_ISTWI_READ_WRITE_REQUEST
175 {
176     U8                      Tool;                       /* 00h */
177     U8                      Reserved;                   /* 01h */
178     U8                      ChainOffset;                /* 02h */
179     U8                      Function;                   /* 03h */
180     U16                     Reserved1;                  /* 04h */
181     U8                      Reserved2;                  /* 06h */
182     U8                      MsgFlags;                   /* 07h */
183     U32                     MsgContext;                 /* 08h */
184     U8                      Flags;                      /* 0Ch */
185     U8                      BusNum;                     /* 0Dh */
186     U16                     Reserved3;                  /* 0Eh */
187     U8                      NumAddressBytes;            /* 10h */
188     U8                      Reserved4;                  /* 11h */
189     U16                     DataLength;                 /* 12h */
190     U8                      DeviceAddr;                 /* 14h */
191     U8                      Addr1;                      /* 15h */
192     U8                      Addr2;                      /* 16h */
193     U8                      Addr3;                      /* 17h */
194     U32                     Reserved5;                  /* 18h */
195     SGE_SIMPLE_UNION        SGL;                        /* 1Ch */
196 } MSG_TOOLBOX_ISTWI_READ_WRITE_REQUEST, MPI_POINTER PTR_MSG_TOOLBOX_ISTWI_READ_WRITE_REQUEST,
197   ToolboxIstwiReadWriteRequest_t, MPI_POINTER pToolboxIstwiReadWriteRequest_t;
198 
199 #define MPI_TB_ISTWI_FLAGS_WRITE                    (0x00)
200 #define MPI_TB_ISTWI_FLAGS_READ                     (0x01)
201 
202 /****************************************************************************/
203 /* Toolbox FC Management request                                            */
204 /****************************************************************************/
205 
206 /* ActionInfo for Bus and TargetId */
207 typedef struct _MPI_TB_FC_MANAGE_BUS_TID_AI
208 {
209     U16                     Reserved;                   /* 00h */
210     U8                      Bus;                        /* 02h */
211     U8                      TargetId;                   /* 03h */
212 } MPI_TB_FC_MANAGE_BUS_TID_AI, MPI_POINTER PTR_MPI_TB_FC_MANAGE_BUS_TID_AI,
213   MpiTbFcManageBusTidAi_t, MPI_POINTER pMpiTbFcManageBusTidAi_t;
214 
215 /* ActionInfo for port identifier */
216 typedef struct _MPI_TB_FC_MANAGE_PID_AI
217 {
218     U32                     PortIdentifier;             /* 00h */
219 } MPI_TB_FC_MANAGE_PID_AI, MPI_POINTER PTR_MPI_TB_FC_MANAGE_PID_AI,
220   MpiTbFcManagePidAi_t, MPI_POINTER pMpiTbFcManagePidAi_t;
221 
222 /* ActionInfo for set max frame size */
223 typedef struct _MPI_TB_FC_MANAGE_FRAME_SIZE_AI
224 {
225     U16                     FrameSize;                  /* 00h */
226     U8                      PortNum;                    /* 02h */
227     U8                      Reserved1;                  /* 03h */
228 } MPI_TB_FC_MANAGE_FRAME_SIZE_AI, MPI_POINTER PTR_MPI_TB_FC_MANAGE_FRAME_SIZE_AI,
229   MpiTbFcManageFrameSizeAi_t, MPI_POINTER pMpiTbFcManageFrameSizeAi_t;
230 
231 /* union of ActionInfo */
232 typedef union _MPI_TB_FC_MANAGE_AI_UNION
233 {
234     MPI_TB_FC_MANAGE_BUS_TID_AI     BusTid;
235     MPI_TB_FC_MANAGE_PID_AI         Port;
236     MPI_TB_FC_MANAGE_FRAME_SIZE_AI  FrameSize;
237 } MPI_TB_FC_MANAGE_AI_UNION, MPI_POINTER PTR_MPI_TB_FC_MANAGE_AI_UNION,
238   MpiTbFcManageAiUnion_t, MPI_POINTER pMpiTbFcManageAiUnion_t;
239 
240 typedef struct _MSG_TOOLBOX_FC_MANAGE_REQUEST
241 {
242     U8                          Tool;                   /* 00h */
243     U8                          Reserved;               /* 01h */
244     U8                          ChainOffset;            /* 02h */
245     U8                          Function;               /* 03h */
246     U16                         Reserved1;              /* 04h */
247     U8                          Reserved2;              /* 06h */
248     U8                          MsgFlags;               /* 07h */
249     U32                         MsgContext;             /* 08h */
250     U8                          Action;                 /* 0Ch */
251     U8                          Reserved3;              /* 0Dh */
252     U16                         Reserved4;              /* 0Eh */
253     MPI_TB_FC_MANAGE_AI_UNION   ActionInfo;             /* 10h */
254 } MSG_TOOLBOX_FC_MANAGE_REQUEST, MPI_POINTER PTR_MSG_TOOLBOX_FC_MANAGE_REQUEST,
255   ToolboxFcManageRequest_t, MPI_POINTER pToolboxFcManageRequest_t;
256 
257 /* defines for the Action field */
258 #define MPI_TB_FC_MANAGE_ACTION_DISC_ALL            (0x00)
259 #define MPI_TB_FC_MANAGE_ACTION_DISC_PID            (0x01)
260 #define MPI_TB_FC_MANAGE_ACTION_DISC_BUS_TID        (0x02)
261 #define MPI_TB_FC_MANAGE_ACTION_SET_MAX_FRAME_SIZE  (0x03)
262 
263 /****************************************************************************/
264 /* Toolbox Beacon Tool request                                               */
265 /****************************************************************************/
266 
267 typedef struct _MSG_TOOLBOX_BEACON_REQUEST
268 {
269     U8                      Tool;                       /* 00h */
270     U8                      Reserved;                   /* 01h */
271     U8                      ChainOffset;                /* 02h */
272     U8                      Function;                   /* 03h */
273     U16                     Reserved1;                  /* 04h */
274     U8                      Reserved2;                  /* 06h */
275     U8                      MsgFlags;                   /* 07h */
276     U32                     MsgContext;                 /* 08h */
277     U8                      ConnectNum;                 /* 0Ch */
278     U8                      PortNum;                    /* 0Dh */
279     U8                      Reserved3;                  /* 0Eh */
280     U8                      Flags;                      /* 0Fh */
281 } MSG_TOOLBOX_BEACON_REQUEST, MPI_POINTER PTR_MSG_TOOLBOX_BEACON_REQUEST,
282   ToolboxBeaconRequest_t, MPI_POINTER pToolboxBeaconRequest_t;
283 
284 #define MPI_TOOLBOX_FLAGS_BEACON_MODE_OFF       (0x00)
285 #define MPI_TOOLBOX_FLAGS_BEACON_MODE_ON        (0x01)
286 
287 /****************************************************************************/
288 /* Diagnostic Buffer Post request                                           */
289 /****************************************************************************/
290 
291 typedef struct _MSG_DIAG_BUFFER_POST_REQUEST
292 {
293     U8                      TraceLevel;                 /* 00h */
294     U8                      BufferType;                 /* 01h */
295     U8                      ChainOffset;                /* 02h */
296     U8                      Function;                   /* 03h */
297     U16                     Reserved1;                  /* 04h */
298     U8                      Reserved2;                  /* 06h */
299     U8                      MsgFlags;                   /* 07h */
300     U32                     MsgContext;                 /* 08h */
301     U32                     ExtendedType;               /* 0Ch */
302     U32                     BufferLength;               /* 10h */
303     U32                     ProductSpecific[4];         /* 14h */
304     U32                     Reserved3;                  /* 24h */
305     U64                     BufferAddress;              /* 28h */
306 } MSG_DIAG_BUFFER_POST_REQUEST, MPI_POINTER PTR_MSG_DIAG_BUFFER_POST_REQUEST,
307   DiagBufferPostRequest_t, MPI_POINTER pDiagBufferPostRequest_t;
308 
309 #define MPI_DIAG_BUF_TYPE_TRACE                     (0x00)
310 #define MPI_DIAG_BUF_TYPE_SNAPSHOT                  (0x01)
311 #define MPI_DIAG_BUF_TYPE_EXTENDED                  (0x02)
312 /* count of the number of buffer types */
313 #define MPI_DIAG_BUF_TYPE_COUNT                     (0x03)
314 
315 #define MPI_DIAG_EXTENDED_QTAG                      (0x00000001)
316 
317 /* Diagnostic Buffer Post reply */
318 typedef struct _MSG_DIAG_BUFFER_POST_REPLY
319 {
320     U8                      Reserved1;                  /* 00h */
321     U8                      BufferType;                 /* 01h */
322     U8                      MsgLength;                  /* 02h */
323     U8                      Function;                   /* 03h */
324     U16                     Reserved2;                  /* 04h */
325     U8                      Reserved3;                  /* 06h */
326     U8                      MsgFlags;                   /* 07h */
327     U32                     MsgContext;                 /* 08h */
328     U16                     Reserved4;                  /* 0Ch */
329     U16                     IOCStatus;                  /* 0Eh */
330     U32                     IOCLogInfo;                 /* 10h */
331     U32                     TransferLength;             /* 14h */
332 } MSG_DIAG_BUFFER_POST_REPLY, MPI_POINTER PTR_MSG_DIAG_BUFFER_POST_REPLY,
333   DiagBufferPostReply_t, MPI_POINTER pDiagBufferPostReply_t;
334 
335 /****************************************************************************/
336 /* Diagnostic Release request                                               */
337 /****************************************************************************/
338 
339 typedef struct _MSG_DIAG_RELEASE_REQUEST
340 {
341     U8                      Reserved1;                  /* 00h */
342     U8                      BufferType;                 /* 01h */
343     U8                      ChainOffset;                /* 02h */
344     U8                      Function;                   /* 03h */
345     U16                     Reserved2;                  /* 04h */
346     U8                      Reserved3;                  /* 06h */
347     U8                      MsgFlags;                   /* 07h */
348     U32                     MsgContext;                 /* 08h */
349 } MSG_DIAG_RELEASE_REQUEST, MPI_POINTER PTR_MSG_DIAG_RELEASE_REQUEST,
350   DiagReleaseRequest_t, MPI_POINTER pDiagReleaseRequest_t;
351 
352 /* Diagnostic Release reply */
353 typedef struct _MSG_DIAG_RELEASE_REPLY
354 {
355     U8                      Reserved1;                  /* 00h */
356     U8                      BufferType;                 /* 01h */
357     U8                      MsgLength;                  /* 02h */
358     U8                      Function;                   /* 03h */
359     U16                     Reserved2;                  /* 04h */
360     U8                      Reserved3;                  /* 06h */
361     U8                      MsgFlags;                   /* 07h */
362     U32                     MsgContext;                 /* 08h */
363     U16                     Reserved4;                  /* 0Ch */
364     U16                     IOCStatus;                  /* 0Eh */
365     U32                     IOCLogInfo;                 /* 10h */
366 } MSG_DIAG_RELEASE_REPLY, MPI_POINTER PTR_MSG_DIAG_RELEASE_REPLY,
367   DiagReleaseReply_t, MPI_POINTER pDiagReleaseReply_t;
368 
369 #endif
370