xref: /freebsd/sys/dev/mpt/mpilib/mpi_tool.h (revision 15fe2513996eaa8857fcf66a632814b5f9374b03)
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 /****************************************************************************/
73 /* Toolbox reply                                                            */
74 /****************************************************************************/
75 
76 typedef struct _MSG_TOOLBOX_REPLY
77 {
78     U8                      Tool;                       /* 00h */
79     U8                      Reserved;                   /* 01h */
80     U8                      MsgLength;                  /* 02h */
81     U8                      Function;                   /* 03h */
82     U16                     Reserved1;                  /* 04h */
83     U8                      Reserved2;                  /* 06h */
84     U8                      MsgFlags;                   /* 07h */
85     U32                     MsgContext;                 /* 08h */
86     U16                     Reserved3;                  /* 0Ch */
87     U16                     IOCStatus;                  /* 0Eh */
88     U32                     IOCLogInfo;                 /* 10h */
89 } MSG_TOOLBOX_REPLY, MPI_POINTER PTR_MSG_TOOLBOX_REPLY,
90   ToolboxReply_t, MPI_POINTER pToolboxReply_t;
91 
92 
93 /****************************************************************************/
94 /* Toolbox Clean Tool request                                               */
95 /****************************************************************************/
96 
97 typedef struct _MSG_TOOLBOX_CLEAN_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     U32                     Flags;                      /* 0Ch */
108 } MSG_TOOLBOX_CLEAN_REQUEST, MPI_POINTER PTR_MSG_TOOLBOX_CLEAN_REQUEST,
109   ToolboxCleanRequest_t, MPI_POINTER pToolboxCleanRequest_t;
110 
111 #define MPI_TOOLBOX_CLEAN_NVSRAM                    (0x00000001)
112 #define MPI_TOOLBOX_CLEAN_SEEPROM                   (0x00000002)
113 #define MPI_TOOLBOX_CLEAN_FLASH                     (0x00000004)
114 #define MPI_TOOLBOX_CLEAN_BOOTLOADER                (0x04000000)
115 #define MPI_TOOLBOX_CLEAN_FW_BACKUP                 (0x08000000)
116 #define MPI_TOOLBOX_CLEAN_FW_CURRENT                (0x10000000)
117 #define MPI_TOOLBOX_CLEAN_OTHER_PERSIST_PAGES       (0x20000000)
118 #define MPI_TOOLBOX_CLEAN_PERSIST_MANUFACT_PAGES    (0x40000000)
119 #define MPI_TOOLBOX_CLEAN_BOOT_SERVICES             (0x80000000)
120 
121 
122 /****************************************************************************/
123 /* Toolbox Memory Move request                                              */
124 /****************************************************************************/
125 
126 typedef struct _MSG_TOOLBOX_MEM_MOVE_REQUEST
127 {
128     U8                      Tool;                       /* 00h */
129     U8                      Reserved;                   /* 01h */
130     U8                      ChainOffset;                /* 02h */
131     U8                      Function;                   /* 03h */
132     U16                     Reserved1;                  /* 04h */
133     U8                      Reserved2;                  /* 06h */
134     U8                      MsgFlags;                   /* 07h */
135     U32                     MsgContext;                 /* 08h */
136     SGE_SIMPLE_UNION        SGL;                        /* 0Ch */
137 } MSG_TOOLBOX_MEM_MOVE_REQUEST, MPI_POINTER PTR_MSG_TOOLBOX_MEM_MOVE_REQUEST,
138   ToolboxMemMoveRequest_t, MPI_POINTER pToolboxMemMoveRequest_t;
139 
140 
141 /****************************************************************************/
142 /* Toolbox Diagnostic Data Upload request                                   */
143 /****************************************************************************/
144 
145 typedef struct _MSG_TOOLBOX_DIAG_DATA_UPLOAD_REQUEST
146 {
147     U8                      Tool;                       /* 00h */
148     U8                      Reserved;                   /* 01h */
149     U8                      ChainOffset;                /* 02h */
150     U8                      Function;                   /* 03h */
151     U16                     Reserved1;                  /* 04h */
152     U8                      Reserved2;                  /* 06h */
153     U8                      MsgFlags;                   /* 07h */
154     U32                     MsgContext;                 /* 08h */
155     U32                     Flags;                      /* 0Ch */
156     U32                     Reserved3;                  /* 10h */
157     SGE_SIMPLE_UNION        SGL;                        /* 14h */
158 } MSG_TOOLBOX_DIAG_DATA_UPLOAD_REQUEST, MPI_POINTER PTR_MSG_TOOLBOX_DIAG_DATA_UPLOAD_REQUEST,
159   ToolboxDiagDataUploadRequest_t, MPI_POINTER pToolboxDiagDataUploadRequest_t;
160 
161 typedef struct _DIAG_DATA_UPLOAD_HEADER
162 {
163     U32                     DiagDataLength;             /* 00h */
164     U8                      FormatCode;                 /* 04h */
165     U8                      Reserved;                   /* 05h */
166     U16                     Reserved1;                  /* 06h */
167 } DIAG_DATA_UPLOAD_HEADER, MPI_POINTER PTR_DIAG_DATA_UPLOAD_HEADER,
168   DiagDataUploadHeader_t, MPI_POINTER pDiagDataUploadHeader_t;
169 
170 #define MPI_TB_DIAG_FORMAT_SCSI_PRINTF_1            (0x01)
171 #define MPI_TB_DIAG_FORMAT_SCSI_2                   (0x02)
172 #define MPI_TB_DIAG_FORMAT_SCSI_3                   (0x03)
173 #define MPI_TB_DIAG_FORMAT_FC_TRACE_1               (0x04)
174 
175 
176 /****************************************************************************/
177 /* Toolbox ISTWI Read Write request                                         */
178 /****************************************************************************/
179 
180 typedef struct _MSG_TOOLBOX_ISTWI_READ_WRITE_REQUEST
181 {
182     U8                      Tool;                       /* 00h */
183     U8                      Reserved;                   /* 01h */
184     U8                      ChainOffset;                /* 02h */
185     U8                      Function;                   /* 03h */
186     U16                     Reserved1;                  /* 04h */
187     U8                      Reserved2;                  /* 06h */
188     U8                      MsgFlags;                   /* 07h */
189     U32                     MsgContext;                 /* 08h */
190     U8                      Flags;                      /* 0Ch */
191     U8                      BusNum;                     /* 0Dh */
192     U16                     Reserved3;                  /* 0Eh */
193     U8                      NumAddressBytes;            /* 10h */
194     U8                      Reserved4;                  /* 11h */
195     U16                     DataLength;                 /* 12h */
196     U8                      DeviceAddr;                 /* 14h */
197     U8                      Addr1;                      /* 15h */
198     U8                      Addr2;                      /* 16h */
199     U8                      Addr3;                      /* 17h */
200     U32                     Reserved5;                  /* 18h */
201     SGE_SIMPLE_UNION        SGL;                        /* 1Ch */
202 } MSG_TOOLBOX_ISTWI_READ_WRITE_REQUEST, MPI_POINTER PTR_MSG_TOOLBOX_ISTWI_READ_WRITE_REQUEST,
203   ToolboxIstwiReadWriteRequest_t, MPI_POINTER pToolboxIstwiReadWriteRequest_t;
204 
205 #define MPI_TB_ISTWI_FLAGS_WRITE                    (0x00)
206 #define MPI_TB_ISTWI_FLAGS_READ                     (0x01)
207 
208 
209 /****************************************************************************/
210 /* Toolbox FC Management request                                            */
211 /****************************************************************************/
212 
213 /* ActionInfo for Bus and TargetId */
214 typedef struct _MPI_TB_FC_MANAGE_BUS_TID_AI
215 {
216     U16                     Reserved;                   /* 00h */
217     U8                      Bus;                        /* 02h */
218     U8                      TargetId;                   /* 03h */
219 } MPI_TB_FC_MANAGE_BUS_TID_AI, MPI_POINTER PTR_MPI_TB_FC_MANAGE_BUS_TID_AI,
220   MpiTbFcManageBusTidAi_t, MPI_POINTER pMpiTbFcManageBusTidAi_t;
221 
222 /* ActionInfo for port identifier */
223 typedef struct _MPI_TB_FC_MANAGE_PID_AI
224 {
225     U32                     PortIdentifier;             /* 00h */
226 } MPI_TB_FC_MANAGE_PID_AI, MPI_POINTER PTR_MPI_TB_FC_MANAGE_PID_AI,
227   MpiTbFcManagePidAi_t, MPI_POINTER pMpiTbFcManagePidAi_t;
228 
229 /* ActionInfo for set max frame size */
230 typedef struct _MPI_TB_FC_MANAGE_FRAME_SIZE_AI
231 {
232     U16                     FrameSize;                  /* 00h */
233     U8                      PortNum;                    /* 02h */
234     U8                      Reserved1;                  /* 03h */
235 } MPI_TB_FC_MANAGE_FRAME_SIZE_AI, MPI_POINTER PTR_MPI_TB_FC_MANAGE_FRAME_SIZE_AI,
236   MpiTbFcManageFrameSizeAi_t, MPI_POINTER pMpiTbFcManageFrameSizeAi_t;
237 
238 /* union of ActionInfo */
239 typedef union _MPI_TB_FC_MANAGE_AI_UNION
240 {
241     MPI_TB_FC_MANAGE_BUS_TID_AI     BusTid;
242     MPI_TB_FC_MANAGE_PID_AI         Port;
243     MPI_TB_FC_MANAGE_FRAME_SIZE_AI  FrameSize;
244 } MPI_TB_FC_MANAGE_AI_UNION, MPI_POINTER PTR_MPI_TB_FC_MANAGE_AI_UNION,
245   MpiTbFcManageAiUnion_t, MPI_POINTER pMpiTbFcManageAiUnion_t;
246 
247 typedef struct _MSG_TOOLBOX_FC_MANAGE_REQUEST
248 {
249     U8                          Tool;                   /* 00h */
250     U8                          Reserved;               /* 01h */
251     U8                          ChainOffset;            /* 02h */
252     U8                          Function;               /* 03h */
253     U16                         Reserved1;              /* 04h */
254     U8                          Reserved2;              /* 06h */
255     U8                          MsgFlags;               /* 07h */
256     U32                         MsgContext;             /* 08h */
257     U8                          Action;                 /* 0Ch */
258     U8                          Reserved3;              /* 0Dh */
259     U16                         Reserved4;              /* 0Eh */
260     MPI_TB_FC_MANAGE_AI_UNION   ActionInfo;             /* 10h */
261 } MSG_TOOLBOX_FC_MANAGE_REQUEST, MPI_POINTER PTR_MSG_TOOLBOX_FC_MANAGE_REQUEST,
262   ToolboxFcManageRequest_t, MPI_POINTER pToolboxFcManageRequest_t;
263 
264 /* defines for the Action field */
265 #define MPI_TB_FC_MANAGE_ACTION_DISC_ALL            (0x00)
266 #define MPI_TB_FC_MANAGE_ACTION_DISC_PID            (0x01)
267 #define MPI_TB_FC_MANAGE_ACTION_DISC_BUS_TID        (0x02)
268 #define MPI_TB_FC_MANAGE_ACTION_SET_MAX_FRAME_SIZE  (0x03)
269 
270 
271 /****************************************************************************/
272 /* Toolbox Beacon Tool request                                               */
273 /****************************************************************************/
274 
275 typedef struct _MSG_TOOLBOX_BEACON_REQUEST
276 {
277     U8                      Tool;                       /* 00h */
278     U8                      Reserved;                   /* 01h */
279     U8                      ChainOffset;                /* 02h */
280     U8                      Function;                   /* 03h */
281     U16                     Reserved1;                  /* 04h */
282     U8                      Reserved2;                  /* 06h */
283     U8                      MsgFlags;                   /* 07h */
284     U32                     MsgContext;                 /* 08h */
285     U8                      ConnectNum;                 /* 0Ch */
286     U8                      PortNum;                    /* 0Dh */
287     U8                      Reserved3;                  /* 0Eh */
288     U8                      Flags;                      /* 0Fh */
289 } MSG_TOOLBOX_BEACON_REQUEST, MPI_POINTER PTR_MSG_TOOLBOX_BEACON_REQUEST,
290   ToolboxBeaconRequest_t, MPI_POINTER pToolboxBeaconRequest_t;
291 
292 #define MPI_TOOLBOX_FLAGS_BEACON_MODE_OFF       (0x00)
293 #define MPI_TOOLBOX_FLAGS_BEACON_MODE_ON        (0x01)
294 
295 
296 /****************************************************************************/
297 /* Diagnostic Buffer Post request                                           */
298 /****************************************************************************/
299 
300 typedef struct _MSG_DIAG_BUFFER_POST_REQUEST
301 {
302     U8                      TraceLevel;                 /* 00h */
303     U8                      BufferType;                 /* 01h */
304     U8                      ChainOffset;                /* 02h */
305     U8                      Function;                   /* 03h */
306     U16                     Reserved1;                  /* 04h */
307     U8                      Reserved2;                  /* 06h */
308     U8                      MsgFlags;                   /* 07h */
309     U32                     MsgContext;                 /* 08h */
310     U32                     ExtendedType;               /* 0Ch */
311     U32                     BufferLength;               /* 10h */
312     U32                     ProductSpecific[4];         /* 14h */
313     U32                     Reserved3;                  /* 24h */
314     U64                     BufferAddress;              /* 28h */
315 } MSG_DIAG_BUFFER_POST_REQUEST, MPI_POINTER PTR_MSG_DIAG_BUFFER_POST_REQUEST,
316   DiagBufferPostRequest_t, MPI_POINTER pDiagBufferPostRequest_t;
317 
318 #define MPI_DIAG_BUF_TYPE_TRACE                     (0x00)
319 #define MPI_DIAG_BUF_TYPE_SNAPSHOT                  (0x01)
320 #define MPI_DIAG_BUF_TYPE_EXTENDED                  (0x02)
321 /* count of the number of buffer types */
322 #define MPI_DIAG_BUF_TYPE_COUNT                     (0x03)
323 
324 #define MPI_DIAG_EXTENDED_QTAG                      (0x00000001)
325 
326 
327 /* Diagnostic Buffer Post reply */
328 typedef struct _MSG_DIAG_BUFFER_POST_REPLY
329 {
330     U8                      Reserved1;                  /* 00h */
331     U8                      BufferType;                 /* 01h */
332     U8                      MsgLength;                  /* 02h */
333     U8                      Function;                   /* 03h */
334     U16                     Reserved2;                  /* 04h */
335     U8                      Reserved3;                  /* 06h */
336     U8                      MsgFlags;                   /* 07h */
337     U32                     MsgContext;                 /* 08h */
338     U16                     Reserved4;                  /* 0Ch */
339     U16                     IOCStatus;                  /* 0Eh */
340     U32                     IOCLogInfo;                 /* 10h */
341     U32                     TransferLength;             /* 14h */
342 } MSG_DIAG_BUFFER_POST_REPLY, MPI_POINTER PTR_MSG_DIAG_BUFFER_POST_REPLY,
343   DiagBufferPostReply_t, MPI_POINTER pDiagBufferPostReply_t;
344 
345 
346 /****************************************************************************/
347 /* Diagnostic Release request                                               */
348 /****************************************************************************/
349 
350 typedef struct _MSG_DIAG_RELEASE_REQUEST
351 {
352     U8                      Reserved1;                  /* 00h */
353     U8                      BufferType;                 /* 01h */
354     U8                      ChainOffset;                /* 02h */
355     U8                      Function;                   /* 03h */
356     U16                     Reserved2;                  /* 04h */
357     U8                      Reserved3;                  /* 06h */
358     U8                      MsgFlags;                   /* 07h */
359     U32                     MsgContext;                 /* 08h */
360 } MSG_DIAG_RELEASE_REQUEST, MPI_POINTER PTR_MSG_DIAG_RELEASE_REQUEST,
361   DiagReleaseRequest_t, MPI_POINTER pDiagReleaseRequest_t;
362 
363 
364 /* Diagnostic Release reply */
365 typedef struct _MSG_DIAG_RELEASE_REPLY
366 {
367     U8                      Reserved1;                  /* 00h */
368     U8                      BufferType;                 /* 01h */
369     U8                      MsgLength;                  /* 02h */
370     U8                      Function;                   /* 03h */
371     U16                     Reserved2;                  /* 04h */
372     U8                      Reserved3;                  /* 06h */
373     U8                      MsgFlags;                   /* 07h */
374     U32                     MsgContext;                 /* 08h */
375     U16                     Reserved4;                  /* 0Ch */
376     U16                     IOCStatus;                  /* 0Eh */
377     U32                     IOCLogInfo;                 /* 10h */
378 } MSG_DIAG_RELEASE_REPLY, MPI_POINTER PTR_MSG_DIAG_RELEASE_REPLY,
379   DiagReleaseReply_t, MPI_POINTER pDiagReleaseReply_t;
380 
381 
382 #endif
383