Merge branch 'vendor/MPFR' into gcc441
[dragonfly.git] / sys / dev / disk / mpt / mpilib / mpi_ioc.h
1 /* $FreeBSD: src/sys/dev/mpt/mpilib/mpi_ioc.h,v 1.1.2.2 2002/09/01 23:08:06 mjacob Exp $ */
2 /* $DragonFly: src/sys/dev/disk/mpt/mpilib/mpi_ioc.h,v 1.2 2003/06/17 04:28:28 dillon Exp $ */
3 /*
4  * Copyright (c) 2000, 2001 by LSI Logic Corporation
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice immediately at the beginning of the file, without modification,
11  *    this list of conditions, and the following disclaimer.
12  * 2. The name of the author may not be used to endorse or promote products
13  *    derived from this software without specific prior written permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
19  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25  * SUCH DAMAGE.
26  *
27  *
28  *           Name:  MPI_IOC.H
29  *          Title:  MPI IOC, Port, Event, FW Download, and FW Upload messages
30  *  Creation Date:  August 11, 2000
31  *
32  *    MPI Version:  01.02.04
33  *
34  *  Version History
35  *  ---------------
36  *
37  *  Date      Version   Description
38  *  --------  --------  ------------------------------------------------------
39  *  05-08-00  00.10.01  Original release for 0.10 spec dated 4/26/2000.
40  *  05-24-00  00.10.02  Added _MSG_IOC_INIT_REPLY structure.
41  *  06-06-00  01.00.01  Added CurReplyFrameSize field to _MSG_IOC_FACTS_REPLY.
42  *  06-12-00  01.00.02  Added _MSG_PORT_ENABLE_REPLY structure.
43  *                      Added _MSG_EVENT_ACK_REPLY structure.
44  *                      Added _MSG_FW_DOWNLOAD_REPLY structure.
45  *                      Added _MSG_TOOLBOX_REPLY structure.
46  *  06-30-00  01.00.03  Added MaxLanBuckets to _PORT_FACT_REPLY structure.
47  *  07-27-00  01.00.04  Added _EVENT_DATA structure definitions for _SCSI,
48  *                      _LINK_STATUS, _LOOP_STATE and _LOGOUT.
49  *  08-11-00  01.00.05  Switched positions of MsgLength and Function fields in
50  *                      _MSG_EVENT_ACK_REPLY structure to match specification.
51  *  11-02-00  01.01.01  Original release for post 1.0 work.
52  *                      Added a value for Manufacturer to WhoInit.
53  *  12-04-00  01.01.02  Modified IOCFacts reply, added FWUpload messages, and
54  *                      removed toolbox message.
55  *  01-09-01  01.01.03  Added event enabled and disabled defines.
56  *                      Added structures for FwHeader and DataHeader.
57  *                      Added ImageType to FwUpload reply.
58  *  02-20-01  01.01.04  Started using MPI_POINTER.
59  *  02-27-01  01.01.05  Added event for RAID status change and its event data.
60  *                      Added IocNumber field to MSG_IOC_FACTS_REPLY.
61  *  03-27-01  01.01.06  Added defines for ProductId field of MPI_FW_HEADER.
62  *                      Added structure offset comments.
63  *  04-09-01  01.01.07  Added structure EVENT_DATA_EVENT_CHANGE.
64  *  08-08-01  01.02.01  Original release for v1.2 work.
65  *                      New format for FWVersion and ProductId in
66  *                      MSG_IOC_FACTS_REPLY and MPI_FW_HEADER.
67  *  08-31-01  01.02.02  Addded event MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE and
68  *                      related structure and defines.
69  *                      Added event MPI_EVENT_ON_BUS_TIMER_EXPIRED.
70  *                      Added MPI_IOCINIT_FLAGS_DISCARD_FW_IMAGE.
71  *                      Replaced a reserved field in MSG_IOC_FACTS_REPLY with
72  *                      IOCExceptions and changed DataImageSize to reserved.
73  *                      Added MPI_FW_DOWNLOAD_ITYPE_NVSTORE_DATA and
74  *                      MPI_FW_UPLOAD_ITYPE_NVDATA.
75  *  09-28-01  01.02.03  Modified Event Data for Integrated RAID.
76  *  11-01-01  01.02.04  Added defines for MPI_EXT_IMAGE_HEADER ImageType field.
77  *  --------------------------------------------------------------------------
78  */
79
80 #ifndef MPI_IOC_H
81 #define MPI_IOC_H
82
83
84 /*****************************************************************************
85 *
86 *               I O C    M e s s a g e s
87 *
88 *****************************************************************************/
89
90 /****************************************************************************/
91 /*  IOCInit message                                                         */
92 /****************************************************************************/
93
94 typedef struct _MSG_IOC_INIT
95 {
96     U8                      WhoInit;                    /* 00h */
97     U8                      Reserved;                   /* 01h */
98     U8                      ChainOffset;                /* 02h */
99     U8                      Function;                   /* 03h */
100     U8                      Flags;                      /* 04h */
101     U8                      MaxDevices;                 /* 05h */
102     U8                      MaxBuses;                   /* 06h */
103     U8                      MsgFlags;                   /* 07h */
104     U32                     MsgContext;                 /* 08h */
105     U16                     ReplyFrameSize;             /* 0Ch */
106     U8                      Reserved1[2];               /* 0Eh */
107     U32                     HostMfaHighAddr;            /* 10h */
108     U32                     SenseBufferHighAddr;        /* 14h */
109 } MSG_IOC_INIT, MPI_POINTER PTR_MSG_IOC_INIT,
110   IOCInit_t, MPI_POINTER pIOCInit_t;
111
112 /* WhoInit values */
113 #define MPI_WHOINIT_NO_ONE                      (0x00)
114 #define MPI_WHOINIT_SYSTEM_BIOS                 (0x01)
115 #define MPI_WHOINIT_ROM_BIOS                    (0x02)
116 #define MPI_WHOINIT_PCI_PEER                    (0x03)
117 #define MPI_WHOINIT_HOST_DRIVER                 (0x04)
118 #define MPI_WHOINIT_MANUFACTURER                (0x05)
119
120 /* Flags values */
121 #define MPI_IOCINIT_FLAGS_DISCARD_FW_IMAGE      (0x01)
122
123 typedef struct _MSG_IOC_INIT_REPLY
124 {
125     U8                      WhoInit;                    /* 00h */
126     U8                      Reserved;                   /* 01h */
127     U8                      MsgLength;                  /* 02h */
128     U8                      Function;                   /* 03h */
129     U8                      Flags;                      /* 04h */
130     U8                      MaxDevices;                 /* 05h */
131     U8                      MaxBuses;                   /* 06h */
132     U8                      MsgFlags;                   /* 07h */
133     U32                     MsgContext;                 /* 08h */
134     U16                     Reserved2;                  /* 0Ch */
135     U16                     IOCStatus;                  /* 0Eh */
136     U32                     IOCLogInfo;                 /* 10h */
137 } MSG_IOC_INIT_REPLY, MPI_POINTER PTR_MSG_IOC_INIT_REPLY,
138   IOCInitReply_t, MPI_POINTER pIOCInitReply_t;
139
140
141
142 /****************************************************************************/
143 /*  IOC Facts message                                                       */
144 /****************************************************************************/
145
146 typedef struct _MSG_IOC_FACTS
147 {
148     U8                      Reserved[2];                /* 00h */
149     U8                      ChainOffset;                /* 01h */
150     U8                      Function;                   /* 02h */
151     U8                      Reserved1[3];               /* 03h */
152     U8                      MsgFlags;                   /* 04h */
153     U32                     MsgContext;                 /* 08h */
154 } MSG_IOC_FACTS, MPI_POINTER PTR_IOC_FACTS,
155   IOCFacts_t, MPI_POINTER pIOCFacts_t;
156
157 typedef struct _MPI_FW_VERSION_STRUCT
158 {
159     U8                      Dev;                        /* 00h */
160     U8                      Unit;                       /* 01h */
161     U8                      Minor;                      /* 02h */
162     U8                      Major;                      /* 03h */
163 } MPI_FW_VERSION_STRUCT;
164
165 typedef union _MPI_FW_VERSION
166 {
167     MPI_FW_VERSION_STRUCT   Struct;
168     U32                     Word;
169 } MPI_FW_VERSION;
170
171 /* IOC Facts Reply */
172 typedef struct _MSG_IOC_FACTS_REPLY
173 {
174     U16                     MsgVersion;                 /* 00h */
175     U8                      MsgLength;                  /* 02h */
176     U8                      Function;                   /* 03h */
177     U16                     Reserved;                   /* 04h */
178     U8                      IOCNumber;                  /* 06h */
179     U8                      MsgFlags;                   /* 07h */
180     U32                     MsgContext;                 /* 08h */
181     U16                     IOCExceptions;              /* 0Ch */
182     U16                     IOCStatus;                  /* 0Eh */
183     U32                     IOCLogInfo;                 /* 10h */
184     U8                      MaxChainDepth;              /* 14h */
185     U8                      WhoInit;                    /* 15h */
186     U8                      BlockSize;                  /* 16h */
187     U8                      Flags;                      /* 17h */
188     U16                     ReplyQueueDepth;            /* 18h */
189     U16                     RequestFrameSize;           /* 1Ah */
190     U16                     Reserved_0101_FWVersion;    /* 1Ch */ /* obsolete 16-bit FWVersion */
191     U16                     ProductID;                  /* 1Eh */
192     U32                     CurrentHostMfaHighAddr;     /* 20h */
193     U16                     GlobalCredits;              /* 24h */
194     U8                      NumberOfPorts;              /* 26h */
195     U8                      EventState;                 /* 27h */
196     U32                     CurrentSenseBufferHighAddr; /* 28h */
197     U16                     CurReplyFrameSize;          /* 2Ch */
198     U8                      MaxDevices;                 /* 2Eh */
199     U8                      MaxBuses;                   /* 2Fh */
200     U32                     FWImageSize;                /* 30h */
201     U32                     Reserved4;                  /* 34h */
202     MPI_FW_VERSION          FWVersion;                  /* 38h */
203 } MSG_IOC_FACTS_REPLY, MPI_POINTER PTR_MSG_IOC_FACTS_REPLY,
204   IOCFactsReply_t, MPI_POINTER pIOCFactsReply_t;
205
206 #define MPI_IOCFACTS_MSGVERSION_MAJOR_MASK          (0xFF00)
207 #define MPI_IOCFACTS_MSGVERSION_MINOR_MASK          (0x00FF)
208
209 #define MPI_IOCFACTS_EXCEPT_CONFIG_CHECKSUM_FAIL    (0x0001)
210
211 #define MPI_IOCFACTS_FLAGS_FW_DOWNLOAD_BOOT         (0x01)
212
213 #define MPI_IOCFACTS_EVENTSTATE_DISABLED            (0x00)
214 #define MPI_IOCFACTS_EVENTSTATE_ENABLED             (0x01)
215
216
217
218 /*****************************************************************************
219 *
220 *               P o r t    M e s s a g e s
221 *
222 *****************************************************************************/
223
224 /****************************************************************************/
225 /*  Port Facts message and Reply                                            */
226 /****************************************************************************/
227
228 typedef struct _MSG_PORT_FACTS
229 {
230      U8                     Reserved[2];                /* 00h */
231      U8                     ChainOffset;                /* 02h */
232      U8                     Function;                   /* 03h */
233      U8                     Reserved1[2];               /* 04h */
234      U8                     PortNumber;                 /* 06h */
235      U8                     MsgFlags;                   /* 07h */
236      U32                    MsgContext;                 /* 08h */
237 } MSG_PORT_FACTS, MPI_POINTER PTR_MSG_PORT_FACTS,
238   PortFacts_t, MPI_POINTER pPortFacts_t;
239
240 typedef struct _MSG_PORT_FACTS_REPLY
241 {
242      U16                    Reserved;                   /* 00h */
243      U8                     MsgLength;                  /* 02h */
244      U8                     Function;                   /* 03h */
245      U16                    Reserved1;                  /* 04h */
246      U8                     PortNumber;                 /* 06h */
247      U8                     MsgFlags;                   /* 07h */
248      U32                    MsgContext;                 /* 08h */
249      U16                    Reserved2;                  /* 0Ch */
250      U16                    IOCStatus;                  /* 0Eh */
251      U32                    IOCLogInfo;                 /* 10h */
252      U8                     Reserved3;                  /* 14h */
253      U8                     PortType;                   /* 15h */
254      U16                    MaxDevices;                 /* 16h */
255      U16                    PortSCSIID;                 /* 18h */
256      U16                    ProtocolFlags;              /* 1Ah */
257      U16                    MaxPostedCmdBuffers;        /* 1Ch */
258      U16                    MaxPersistentIDs;           /* 1Eh */
259      U16                    MaxLanBuckets;              /* 20h */
260      U16                    Reserved4;                  /* 22h */
261      U32                    Reserved5;                  /* 24h */
262 } MSG_PORT_FACTS_REPLY, MPI_POINTER PTR_MSG_PORT_FACTS_REPLY,
263   PortFactsReply_t, MPI_POINTER pPortFactsReply_t;
264
265
266 /* PortTypes values */
267
268 #define MPI_PORTFACTS_PORTTYPE_INACTIVE         (0x00)
269 #define MPI_PORTFACTS_PORTTYPE_SCSI             (0x01)
270 #define MPI_PORTFACTS_PORTTYPE_FC               (0x10)
271
272 /* ProtocolFlags values */
273
274 #define MPI_PORTFACTS_PROTOCOL_LOGBUSADDR       (0x01)
275 #define MPI_PORTFACTS_PROTOCOL_LAN              (0x02)
276 #define MPI_PORTFACTS_PROTOCOL_TARGET           (0x04)
277 #define MPI_PORTFACTS_PROTOCOL_INITIATOR        (0x08)
278
279
280 /****************************************************************************/
281 /*  Port Enable Message                                                     */
282 /****************************************************************************/
283
284 typedef struct _MSG_PORT_ENABLE
285 {
286     U8                      Reserved[2];                /* 00h */
287     U8                      ChainOffset;                /* 02h */
288     U8                      Function;                   /* 03h */
289     U8                      Reserved1[2];               /* 04h */
290     U8                      PortNumber;                 /* 06h */
291     U8                      MsgFlags;                   /* 07h */
292     U32                     MsgContext;                 /* 08h */
293 } MSG_PORT_ENABLE, MPI_POINTER PTR_MSG_PORT_ENABLE,
294   PortEnable_t, MPI_POINTER pPortEnable_t;
295
296 typedef struct _MSG_PORT_ENABLE_REPLY
297 {
298     U8                      Reserved[2];                /* 00h */
299     U8                      MsgLength;                  /* 02h */
300     U8                      Function;                   /* 03h */
301     U8                      Reserved1[2];               /* 04h */
302     U8                      PortNumber;                 /* 05h */
303     U8                      MsgFlags;                   /* 07h */
304     U32                     MsgContext;                 /* 08h */
305     U16                     Reserved2;                  /* 0Ch */
306     U16                     IOCStatus;                  /* 0Eh */
307     U32                     IOCLogInfo;                 /* 10h */
308 } MSG_PORT_ENABLE_REPLY, MPI_POINTER PTR_MSG_PORT_ENABLE_REPLY,
309   PortEnableReply_t, MPI_POINTER pPortEnableReply_t;
310
311
312 /*****************************************************************************
313 *
314 *               E v e n t    M e s s a g e s
315 *
316 *****************************************************************************/
317
318 /****************************************************************************/
319 /*  Event Notification messages                                             */
320 /****************************************************************************/
321
322 typedef struct _MSG_EVENT_NOTIFY
323 {
324     U8                      Switch;                     /* 00h */
325     U8                      Reserved;                   /* 01h */
326     U8                      ChainOffset;                /* 02h */
327     U8                      Function;                   /* 03h */
328     U8                      Reserved1[3];               /* 04h */
329     U8                      MsgFlags;                   /* 07h */
330     U32                     MsgContext;                 /* 08h */
331 } MSG_EVENT_NOTIFY, MPI_POINTER PTR_MSG_EVENT_NOTIFY,
332   EventNotification_t, MPI_POINTER pEventNotification_t;
333
334 /* Event Notification Reply */
335
336 typedef struct _MSG_EVENT_NOTIFY_REPLY
337 {
338      U16                    EventDataLength;            /* 00h */
339      U8                     MsgLength;                  /* 02h */
340      U8                     Function;                   /* 03h */
341      U8                     Reserved1[2];               /* 04h */
342      U8                     AckRequired;                /* 06h */
343      U8                     MsgFlags;                   /* 07h */
344      U32                    MsgContext;                 /* 08h */
345      U8                     Reserved2[2];               /* 0Ch */
346      U16                    IOCStatus;                  /* 0Eh */
347      U32                    IOCLogInfo;                 /* 10h */
348      U32                    Event;                      /* 14h */
349      U32                    EventContext;               /* 18h */
350      U32                    Data[1];                    /* 1Ch */
351 } MSG_EVENT_NOTIFY_REPLY, MPI_POINTER PTR_MSG_EVENT_NOTIFY_REPLY,
352   EventNotificationReply_t, MPI_POINTER pEventNotificationReply_t;
353
354 /* Event Acknowledge */
355
356 typedef struct _MSG_EVENT_ACK
357 {
358     U8                      Reserved[2];                /* 00h */
359     U8                      ChainOffset;                /* 02h */
360     U8                      Function;                   /* 03h */
361     U8                      Reserved1[3];               /* 04h */
362     U8                      MsgFlags;                   /* 07h */
363     U32                     MsgContext;                 /* 08h */
364     U32                     Event;                      /* 0Ch */
365     U32                     EventContext;               /* 10h */
366 } MSG_EVENT_ACK, MPI_POINTER PTR_MSG_EVENT_ACK,
367   EventAck_t, MPI_POINTER pEventAck_t;
368
369 typedef struct _MSG_EVENT_ACK_REPLY
370 {
371     U8                      Reserved[2];                /* 00h */
372     U8                      MsgLength;                  /* 02h */
373     U8                      Function;                   /* 03h */
374     U8                      Reserved1[3];               /* 04h */
375     U8                      MsgFlags;                   /* 07h */
376     U32                     MsgContext;                 /* 08h */
377     U16                     Reserved2;                  /* 0Ch */
378     U16                     IOCStatus;                  /* 0Eh */
379     U32                     IOCLogInfo;                 /* 10h */
380 } MSG_EVENT_ACK_REPLY, MPI_POINTER PTR_MSG_EVENT_ACK_REPLY,
381   EventAckReply_t, MPI_POINTER pEventAckReply_t;
382
383 /* Switch */
384
385 #define MPI_EVENT_NOTIFICATION_SWITCH_OFF   (0x00)
386 #define MPI_EVENT_NOTIFICATION_SWITCH_ON    (0x01)
387
388 /* Event */
389
390 #define MPI_EVENT_NONE                      (0x00000000)
391 #define MPI_EVENT_LOG_DATA                  (0x00000001)
392 #define MPI_EVENT_STATE_CHANGE              (0x00000002)
393 #define MPI_EVENT_UNIT_ATTENTION            (0x00000003)
394 #define MPI_EVENT_IOC_BUS_RESET             (0x00000004)
395 #define MPI_EVENT_EXT_BUS_RESET             (0x00000005)
396 #define MPI_EVENT_RESCAN                    (0x00000006)
397 #define MPI_EVENT_LINK_STATUS_CHANGE        (0x00000007)
398 #define MPI_EVENT_LOOP_STATE_CHANGE         (0x00000008)
399 #define MPI_EVENT_LOGOUT                    (0x00000009)
400 #define MPI_EVENT_EVENT_CHANGE              (0x0000000A)
401 #define MPI_EVENT_INTEGRATED_RAID           (0x0000000B)
402 #define MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE (0x0000000C)
403 #define MPI_EVENT_ON_BUS_TIMER_EXPIRED      (0x0000000D)
404
405 /* AckRequired field values */
406
407 #define MPI_EVENT_NOTIFICATION_ACK_NOT_REQUIRED (0x00)
408 #define MPI_EVENT_NOTIFICATION_ACK_REQUIRED     (0x01)
409
410 /* EventChange Event data */
411
412 typedef struct _EVENT_DATA_EVENT_CHANGE
413 {
414     U8                      EventState;                 /* 00h */
415     U8                      Reserved;                   /* 01h */
416     U16                     Reserved1;                  /* 02h */
417 } EVENT_DATA_EVENT_CHANGE, MPI_POINTER PTR_EVENT_DATA_EVENT_CHANGE,
418   EventDataEventChange_t, MPI_POINTER pEventDataEventChange_t;
419
420 /* SCSI Event data for Port, Bus and Device forms */
421
422 typedef struct _EVENT_DATA_SCSI
423 {
424     U8                      TargetID;                   /* 00h */
425     U8                      BusPort;                    /* 01h */
426     U16                     Reserved;                   /* 02h */
427 } EVENT_DATA_SCSI, MPI_POINTER PTR_EVENT_DATA_SCSI,
428   EventDataScsi_t, MPI_POINTER pEventDataScsi_t;
429
430 /* SCSI Device Status Change Event data */
431
432 typedef struct _EVENT_DATA_SCSI_DEVICE_STATUS_CHANGE
433 {
434     U8                      TargetID;                   /* 00h */
435     U8                      Bus;                        /* 01h */
436     U8                      ReasonCode;                 /* 02h */
437     U8                      LUN;                        /* 03h */
438     U8                      ASC;                        /* 04h */
439     U8                      ASCQ;                       /* 05h */
440     U16                     Reserved;                   /* 06h */
441 } EVENT_DATA_SCSI_DEVICE_STATUS_CHANGE,
442   MPI_POINTER PTR_EVENT_DATA_SCSI_DEVICE_STATUS_CHANGE,
443   MpiEventDataScsiDeviceStatusChange_t,
444   MPI_POINTER pMpiEventDataScsiDeviceStatusChange_t;
445
446 /* MPI SCSI Device Status Change Event data ReasonCode values */
447 #define MPI_EVENT_SCSI_DEV_STAT_RC_ADDED                (0x03)
448 #define MPI_EVENT_SCSI_DEV_STAT_RC_NOT_RESPONDING       (0x04)
449 #define MPI_EVENT_SCSI_DEV_STAT_RC_SMART_DATA           (0x05)
450
451 /* MPI Link Status Change Event data */
452
453 typedef struct _EVENT_DATA_LINK_STATUS
454 {
455     U8                      State;                      /* 00h */
456     U8                      Reserved;                   /* 01h */
457     U16                     Reserved1;                  /* 02h */
458     U8                      Reserved2;                  /* 04h */
459     U8                      Port;                       /* 05h */
460     U16                     Reserved3;                  /* 06h */
461 } EVENT_DATA_LINK_STATUS, MPI_POINTER PTR_EVENT_DATA_LINK_STATUS,
462   EventDataLinkStatus_t, MPI_POINTER pEventDataLinkStatus_t;
463
464 #define MPI_EVENT_LINK_STATUS_FAILURE       (0x00000000)
465 #define MPI_EVENT_LINK_STATUS_ACTIVE        (0x00000001)
466
467 /* MPI Loop State Change Event data */
468
469 typedef struct _EVENT_DATA_LOOP_STATE
470 {
471     U8                      Character4;                 /* 00h */
472     U8                      Character3;                 /* 01h */
473     U8                      Type;                       /* 02h */
474     U8                      Reserved;                   /* 03h */
475     U8                      Reserved1;                  /* 04h */
476     U8                      Port;                       /* 05h */
477     U16                     Reserved2;                  /* 06h */
478 } EVENT_DATA_LOOP_STATE, MPI_POINTER PTR_EVENT_DATA_LOOP_STATE,
479   EventDataLoopState_t, MPI_POINTER pEventDataLoopState_t;
480
481 #define MPI_EVENT_LOOP_STATE_CHANGE_LIP     (0x0001)
482 #define MPI_EVENT_LOOP_STATE_CHANGE_LPE     (0x0002)
483 #define MPI_EVENT_LOOP_STATE_CHANGE_LPB     (0x0003)
484
485 /* MPI LOGOUT Event data */
486
487 typedef struct _EVENT_DATA_LOGOUT
488 {
489     U32                     NPortID;                    /* 00h */
490     U8                      Reserved;                   /* 04h */
491     U8                      Port;                       /* 05h */
492     U16                     Reserved1;                  /* 06h */
493 } EVENT_DATA_LOGOUT, MPI_POINTER PTR_EVENT_DATA_LOGOUT,
494   EventDataLogout_t, MPI_POINTER pEventDataLogout_t;
495
496 /* MPI Integrated RAID Event data */
497
498 typedef struct _EVENT_DATA_RAID
499 {
500     U8                      VolumeID;                   /* 00h */
501     U8                      VolumeBus;                  /* 01h */
502     U8                      ReasonCode;                 /* 02h */
503     U8                      PhysDiskNum;                /* 03h */
504     U8                      ASC;                        /* 04h */
505     U8                      ASCQ;                       /* 05h */
506     U16                     Reserved;                   /* 06h */
507     U32                     SettingsStatus;             /* 08h */
508 } EVENT_DATA_RAID, MPI_POINTER PTR_EVENT_DATA_RAID,
509   MpiEventDataRaid_t, MPI_POINTER pMpiEventDataRaid_t;
510
511 /* MPI Integrated RAID Event data ReasonCode values */
512 #define MPI_EVENT_RAID_RC_VOLUME_CREATED                (0x00)
513 #define MPI_EVENT_RAID_RC_VOLUME_DELETED                (0x01)
514 #define MPI_EVENT_RAID_RC_VOLUME_SETTINGS_CHANGED       (0x02)
515 #define MPI_EVENT_RAID_RC_VOLUME_STATUS_CHANGED         (0x03)
516 #define MPI_EVENT_RAID_RC_VOLUME_PHYSDISK_CHANGED       (0x04)
517 #define MPI_EVENT_RAID_RC_PHYSDISK_CREATED              (0x05)
518 #define MPI_EVENT_RAID_RC_PHYSDISK_DELETED              (0x06)
519 #define MPI_EVENT_RAID_RC_PHYSDISK_SETTINGS_CHANGED     (0x07)
520 #define MPI_EVENT_RAID_RC_PHYSDISK_STATUS_CHANGED       (0x08)
521 #define MPI_EVENT_RAID_RC_DOMAIN_VAL_NEEDED             (0x09)
522 #define MPI_EVENT_RAID_RC_SMART_DATA                    (0x0A)
523 #define MPI_EVENT_RAID_RC_REPLACE_ACTION_STARTED        (0x0B)
524
525
526 /*****************************************************************************
527 *
528 *               F i r m w a r e    L o a d    M e s s a g e s
529 *
530 *****************************************************************************/
531
532 /****************************************************************************/
533 /*  Firmware Download message and associated structures                     */
534 /****************************************************************************/
535
536 typedef struct _MSG_FW_DOWNLOAD
537 {
538     U8                      ImageType;                  /* 00h */
539     U8                      Reserved;                   /* 01h */
540     U8                      ChainOffset;                /* 02h */
541     U8                      Function;                   /* 03h */
542     U8                      Reserved1[3];               /* 04h */
543     U8                      MsgFlags;                   /* 07h */
544     U32                     MsgContext;                 /* 08h */
545     SGE_MPI_UNION           SGL;                        /* 0Ch */
546 } MSG_FW_DOWNLOAD, MPI_POINTER PTR_MSG_FW_DOWNLOAD,
547   FWDownload_t, MPI_POINTER pFWDownload_t;
548
549 #define MPI_FW_DOWNLOAD_ITYPE_RESERVED      (0x00)
550 #define MPI_FW_DOWNLOAD_ITYPE_FW            (0x01)
551 #define MPI_FW_DOWNLOAD_ITYPE_BIOS          (0x02)
552 #define MPI_FW_DOWNLOAD_ITYPE_NVDATA        (0x03)
553
554
555 typedef struct _FWDownloadTCSGE
556 {
557     U8                      Reserved;                   /* 00h */
558     U8                      ContextSize;                /* 01h */
559     U8                      DetailsLength;              /* 02h */
560     U8                      Flags;                      /* 03h */
561     U32                     Reserved_0100_Checksum;     /* 04h */ /* obsolete Checksum */
562     U32                     ImageOffset;                /* 08h */
563     U32                     ImageSize;                  /* 0Ch */
564 } FW_DOWNLOAD_TCSGE, MPI_POINTER PTR_FW_DOWNLOAD_TCSGE,
565   FWDownloadTCSGE_t, MPI_POINTER pFWDownloadTCSGE_t;
566
567 /* Firmware Download reply */
568 typedef struct _MSG_FW_DOWNLOAD_REPLY
569 {
570     U8                      ImageType;                  /* 00h */
571     U8                      Reserved;                   /* 01h */
572     U8                      MsgLength;                  /* 02h */
573     U8                      Function;                   /* 03h */
574     U8                      Reserved1[3];               /* 04h */
575     U8                      MsgFlags;                   /* 07h */
576     U32                     MsgContext;                 /* 08h */
577     U16                     Reserved2;                  /* 0Ch */
578     U16                     IOCStatus;                  /* 0Eh */
579     U32                     IOCLogInfo;                 /* 10h */
580 } MSG_FW_DOWNLOAD_REPLY, MPI_POINTER PTR_MSG_FW_DOWNLOAD_REPLY,
581   FWDownloadReply_t, MPI_POINTER pFWDownloadReply_t;
582
583
584 /****************************************************************************/
585 /*  Firmware Upload message and associated structures                       */
586 /****************************************************************************/
587
588 typedef struct _MSG_FW_UPLOAD
589 {
590     U8                      ImageType;                  /* 00h */
591     U8                      Reserved;                   /* 01h */
592     U8                      ChainOffset;                /* 02h */
593     U8                      Function;                   /* 03h */
594     U8                      Reserved1[3];               /* 04h */
595     U8                      MsgFlags;                   /* 07h */
596     U32                     MsgContext;                 /* 08h */
597     SGE_MPI_UNION           SGL;                        /* 0Ch */
598 } MSG_FW_UPLOAD, MPI_POINTER PTR_MSG_FW_UPLOAD,
599   FWUpload_t, MPI_POINTER pFWUpload_t;
600
601 #define MPI_FW_UPLOAD_ITYPE_FW_IOC_MEM      (0x00)
602 #define MPI_FW_UPLOAD_ITYPE_FW_FLASH        (0x01)
603 #define MPI_FW_UPLOAD_ITYPE_BIOS_FLASH      (0x02)
604 #define MPI_FW_UPLOAD_ITYPE_NVDATA          (0x03)
605
606 typedef struct _FWUploadTCSGE
607 {
608     U8                      Reserved;                   /* 00h */
609     U8                      ContextSize;                /* 01h */
610     U8                      DetailsLength;              /* 02h */
611     U8                      Flags;                      /* 03h */
612     U32                     Reserved1;                  /* 04h */
613     U32                     ImageOffset;                /* 08h */
614     U32                     ImageSize;                  /* 0Ch */
615 } FW_UPLOAD_TCSGE, MPI_POINTER PTR_FW_UPLOAD_TCSGE,
616   FWUploadTCSGE_t, MPI_POINTER pFWUploadTCSGE_t;
617
618 /* Firmware Upload reply */
619 typedef struct _MSG_FW_UPLOAD_REPLY
620 {
621     U8                      ImageType;                  /* 00h */
622     U8                      Reserved;                   /* 01h */
623     U8                      MsgLength;                  /* 02h */
624     U8                      Function;                   /* 03h */
625     U8                      Reserved1[3];               /* 04h */
626     U8                      MsgFlags;                   /* 07h */
627     U32                     MsgContext;                 /* 08h */
628     U16                     Reserved2;                  /* 0Ch */
629     U16                     IOCStatus;                  /* 0Eh */
630     U32                     IOCLogInfo;                 /* 10h */
631     U32                     ActualImageSize;            /* 14h */
632 } MSG_FW_UPLOAD_REPLY, MPI_POINTER PTR_MSG_FW_UPLOAD_REPLY,
633   FWUploadReply_t, MPI_POINTER pFWUploadReply_t;
634
635
636 typedef struct _MPI_FW_HEADER
637 {
638     U32                     ArmBranchInstruction0;      /* 00h */
639     U32                     Signature0;                 /* 04h */
640     U32                     Signature1;                 /* 08h */
641     U32                     Signature2;                 /* 0Ch */
642     U32                     ArmBranchInstruction1;      /* 10h */
643     U32                     ArmBranchInstruction2;      /* 14h */
644     U32                     Reserved;                   /* 18h */
645     U32                     Checksum;                   /* 1Ch */
646     U16                     VendorId;                   /* 20h */
647     U16                     ProductId;                  /* 22h */
648     MPI_FW_VERSION          FWVersion;                  /* 24h */
649     U32                     SeqCodeVersion;             /* 28h */
650     U32                     ImageSize;                  /* 2Ch */
651     U32                     NextImageHeaderOffset;      /* 30h */
652     U32                     LoadStartAddress;           /* 34h */
653     U32                     IopResetVectorValue;        /* 38h */
654     U32                     IopResetRegAddr;            /* 3Ch */
655     U32                     VersionNameWhat;            /* 40h */
656     U8                      VersionName[32];            /* 44h */
657     U32                     VendorNameWhat;             /* 64h */
658     U8                      VendorName[32];             /* 68h */
659 } MPI_FW_HEADER, MPI_POINTER PTR_MPI_FW_HEADER,
660   MpiFwHeader_t, MPI_POINTER pMpiFwHeader_t;
661
662 #define MPI_FW_HEADER_WHAT_SIGNATURE        (0x29232840)
663
664 /* defines for using the ProductId field */
665 #define MPI_FW_HEADER_PID_TYPE_MASK             (0xF000)
666 #define MPI_FW_HEADER_PID_TYPE_SCSI             (0x0000)
667 #define MPI_FW_HEADER_PID_TYPE_FC               (0x1000)
668
669 #define MPI_FW_HEADER_PID_PROD_MASK                     (0x0F00)
670 #define MPI_FW_HEADER_PID_PROD_INITIATOR_SCSI           (0x0100)
671 #define MPI_FW_HEADER_PID_PROD_TARGET_INITIATOR_SCSI    (0x0200)
672 #define MPI_FW_HEADER_PID_PROD_TARGET_SCSI              (0x0300)
673 #define MPI_FW_HEADER_PID_PROD_IM_SCSI                  (0x0400)
674 #define MPI_FW_HEADER_PID_PROD_IS_SCSI                  (0x0500)
675 #define MPI_FW_HEADER_PID_PROD_CTX_SCSI                 (0x0600)
676
677 #define MPI_FW_HEADER_PID_FAMILY_MASK           (0x00FF)
678 #define MPI_FW_HEADER_PID_FAMILY_1030A0_SCSI    (0x0001)
679 #define MPI_FW_HEADER_PID_FAMILY_1030B0_SCSI    (0x0002)
680 #define MPI_FW_HEADER_PID_FAMILY_1030B1_SCSI    (0x0003)
681 #define MPI_FW_HEADER_PID_FAMILY_1030C0_SCSI    (0x0004)
682 #define MPI_FW_HEADER_PID_FAMILY_1020A0_SCSI    (0x0005)
683 #define MPI_FW_HEADER_PID_FAMILY_1020B0_SCSI    (0x0006)
684 #define MPI_FW_HEADER_PID_FAMILY_1020B1_SCSI    (0x0007)
685 #define MPI_FW_HEADER_PID_FAMILY_1020C0_SCSI    (0x0008)
686 #define MPI_FW_HEADER_PID_FAMILY_1035A0_SCSI    (0x0009)
687 #define MPI_FW_HEADER_PID_FAMILY_1035B0_SCSI    (0x000A)
688 #define MPI_FW_HEADER_PID_FAMILY_909_FC         (0x0000)
689 #define MPI_FW_HEADER_PID_FAMILY_919_FC         (0x0001)
690 #define MPI_FW_HEADER_PID_FAMILY_919X_FC        (0x0002)
691
692 typedef struct _MPI_EXT_IMAGE_HEADER
693 {
694     U8                      ImageType;                  /* 00h */
695     U8                      Reserved;                   /* 01h */
696     U16                     Reserved1;                  /* 02h */
697     U32                     Checksum;                   /* 04h */
698     U32                     ImageSize;                  /* 08h */
699     U32                     NextImageHeaderOffset;      /* 0Ch */
700     U32                     LoadStartAddress;           /* 10h */
701     U32                     Reserved2;                  /* 14h */
702 } MPI_EXT_IMAGE_HEADER, MPI_POINTER PTR_MPI_EXT_IMAGE_HEADER,
703   MpiExtImageHeader_t, MPI_POINTER pMpiExtImageHeader_t;
704
705 /* defines for the ImageType field */
706 #define MPI_EXT_IMAGE_TYPE_UNSPECIFIED          (0x00)
707 #define MPI_EXT_IMAGE_TYPE_FW                   (0x01)
708 #define MPI_EXT_IMAGE_TYPE_NVDATA               (0x03)
709
710 #endif