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