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