Merge to Fedora kernel-2.6.18-1.2224_FC5 patched with stable patch-2.6.18.1-vs2.0...
[linux-2.6.git] / drivers / message / fusion / lsi / mpi_init.h
1 /*
2  *  Copyright (c) 2000-2005 LSI Logic Corporation.
3  *
4  *
5  *           Name:  mpi_init.h
6  *          Title:  MPI initiator mode messages and structures
7  *  Creation Date:  June 8, 2000
8  *
9  *    mpi_init.h Version:  01.05.07
10  *
11  *  Version History
12  *  ---------------
13  *
14  *  Date      Version   Description
15  *  --------  --------  ------------------------------------------------------
16  *  05-08-00  00.10.01  Original release for 0.10 spec dated 4/26/2000.
17  *  05-24-00  00.10.02  Added SenseBufferLength to _MSG_SCSI_IO_REPLY.
18  *  06-06-00  01.00.01  Update version number for 1.0 release.
19  *  06-08-00  01.00.02  Added MPI_SCSI_RSP_INFO_ definitions.
20  *  11-02-00  01.01.01  Original release for post 1.0 work.
21  *  12-04-00  01.01.02  Added MPI_SCSIIO_CONTROL_NO_DISCONNECT.
22  *  02-20-01  01.01.03  Started using MPI_POINTER.
23  *  03-27-01  01.01.04  Added structure offset comments.
24  *  04-10-01  01.01.05  Added new MsgFlag for MSG_SCSI_TASK_MGMT.
25  *  08-08-01  01.02.01  Original release for v1.2 work.
26  *  08-29-01  01.02.02  Added MPI_SCSITASKMGMT_TASKTYPE_LOGICAL_UNIT_RESET.
27  *                      Added MPI_SCSI_STATE_QUEUE_TAG_REJECTED for
28  *                      MSG_SCSI_IO_REPLY.
29  *  09-28-01  01.02.03  Added structures and defines for SCSI Enclosure
30  *                      Processor messages.
31  *  10-04-01  01.02.04  Added defines for SEP request Action field.
32  *  05-31-02  01.02.05  Added MPI_SCSIIO_MSGFLGS_CMD_DETERMINES_DATA_DIR define
33  *                      for SCSI IO requests.
34  *  11-15-02  01.02.06  Added special extended SCSI Status defines for FCP.
35  *  06-26-03  01.02.07  Added MPI_SCSI_STATUS_FCPEXT_UNASSIGNED define.
36  *  05-11-04  01.03.01  Original release for MPI v1.3.
37  *  08-19-04  01.05.01  Added MsgFlags defines for EEDP to SCSI IO request.
38  *                      Added new word to MSG_SCSI_IO_REPLY to add TaskTag field
39  *                      and a reserved U16.
40  *                      Added new MSG_SCSI_IO32_REQUEST structure.
41  *                      Added a TaskType of Clear Task Set to SCSI
42  *                      Task Management request.
43  *  12-07-04  01.05.02  Added support for Task Management Query Task.
44  *  01-15-05  01.05.03  Modified SCSI Enclosure Processor Request to support
45  *                      WWID addressing.
46  *  03-11-05  01.05.04  Removed EEDP flags from SCSI IO Request.
47  *                      Removed SCSI IO 32 Request.
48  *                      Modified SCSI Enclosure Processor Request and Reply to
49  *                      support Enclosure/Slot addressing rather than WWID
50  *                      addressing.
51  *  06-24-05  01.05.05  Added SCSI IO 32 structures and defines.
52  *                      Added four new defines for SEP SlotStatus.
53  *  08-03-05  01.05.06  Fixed some MPI_SCSIIO32_MSGFLGS_ defines to make them
54  *                      unique in the first 32 characters.
55  *  03-27-06  01.05.07  Added Task Management type of Clear ACA.
56  *  --------------------------------------------------------------------------
57  */
58
59 #ifndef MPI_INIT_H
60 #define MPI_INIT_H
61
62
63 /*****************************************************************************
64 *
65 *               S C S I    I n i t i a t o r    M e s s a g e s
66 *
67 *****************************************************************************/
68
69 /****************************************************************************/
70 /*  SCSI IO messages and associated structures                              */
71 /****************************************************************************/
72
73 typedef struct _MSG_SCSI_IO_REQUEST
74 {
75     U8                      TargetID;           /* 00h */
76     U8                      Bus;                /* 01h */
77     U8                      ChainOffset;        /* 02h */
78     U8                      Function;           /* 03h */
79     U8                      CDBLength;          /* 04h */
80     U8                      SenseBufferLength;  /* 05h */
81     U8                      Reserved;           /* 06h */
82     U8                      MsgFlags;           /* 07h */
83     U32                     MsgContext;         /* 08h */
84     U8                      LUN[8];             /* 0Ch */
85     U32                     Control;            /* 14h */
86     U8                      CDB[16];            /* 18h */
87     U32                     DataLength;         /* 28h */
88     U32                     SenseBufferLowAddr; /* 2Ch */
89     SGE_IO_UNION            SGL;                /* 30h */
90 } MSG_SCSI_IO_REQUEST, MPI_POINTER PTR_MSG_SCSI_IO_REQUEST,
91   SCSIIORequest_t, MPI_POINTER pSCSIIORequest_t;
92
93
94 /* SCSI IO MsgFlags bits */
95
96 #define MPI_SCSIIO_MSGFLGS_SENSE_WIDTH              (0x01)
97 #define MPI_SCSIIO_MSGFLGS_SENSE_WIDTH_32           (0x00)
98 #define MPI_SCSIIO_MSGFLGS_SENSE_WIDTH_64           (0x01)
99
100 #define MPI_SCSIIO_MSGFLGS_SENSE_LOCATION           (0x02)
101 #define MPI_SCSIIO_MSGFLGS_SENSE_LOC_HOST           (0x00)
102 #define MPI_SCSIIO_MSGFLGS_SENSE_LOC_IOC            (0x02)
103
104 #define MPI_SCSIIO_MSGFLGS_CMD_DETERMINES_DATA_DIR  (0x04)
105
106 /* SCSI IO LUN fields */
107
108 #define MPI_SCSIIO_LUN_FIRST_LEVEL_ADDRESSING   (0x0000FFFF)
109 #define MPI_SCSIIO_LUN_SECOND_LEVEL_ADDRESSING  (0xFFFF0000)
110 #define MPI_SCSIIO_LUN_THIRD_LEVEL_ADDRESSING   (0x0000FFFF)
111 #define MPI_SCSIIO_LUN_FOURTH_LEVEL_ADDRESSING  (0xFFFF0000)
112 #define MPI_SCSIIO_LUN_LEVEL_1_WORD             (0xFF00)
113 #define MPI_SCSIIO_LUN_LEVEL_1_DWORD            (0x0000FF00)
114
115 /* SCSI IO Control bits */
116
117 #define MPI_SCSIIO_CONTROL_DATADIRECTION_MASK   (0x03000000)
118 #define MPI_SCSIIO_CONTROL_NODATATRANSFER       (0x00000000)
119 #define MPI_SCSIIO_CONTROL_WRITE                (0x01000000)
120 #define MPI_SCSIIO_CONTROL_READ                 (0x02000000)
121
122 #define MPI_SCSIIO_CONTROL_ADDCDBLEN_MASK       (0x3C000000)
123 #define MPI_SCSIIO_CONTROL_ADDCDBLEN_SHIFT      (26)
124
125 #define MPI_SCSIIO_CONTROL_TASKATTRIBUTE_MASK   (0x00000700)
126 #define MPI_SCSIIO_CONTROL_SIMPLEQ              (0x00000000)
127 #define MPI_SCSIIO_CONTROL_HEADOFQ              (0x00000100)
128 #define MPI_SCSIIO_CONTROL_ORDEREDQ             (0x00000200)
129 #define MPI_SCSIIO_CONTROL_ACAQ                 (0x00000400)
130 #define MPI_SCSIIO_CONTROL_UNTAGGED             (0x00000500)
131 #define MPI_SCSIIO_CONTROL_NO_DISCONNECT        (0x00000700)
132
133 #define MPI_SCSIIO_CONTROL_TASKMANAGE_MASK      (0x00FF0000)
134 #define MPI_SCSIIO_CONTROL_OBSOLETE             (0x00800000)
135 #define MPI_SCSIIO_CONTROL_CLEAR_ACA_RSV        (0x00400000)
136 #define MPI_SCSIIO_CONTROL_TARGET_RESET         (0x00200000)
137 #define MPI_SCSIIO_CONTROL_LUN_RESET_RSV        (0x00100000)
138 #define MPI_SCSIIO_CONTROL_RESERVED             (0x00080000)
139 #define MPI_SCSIIO_CONTROL_CLR_TASK_SET_RSV     (0x00040000)
140 #define MPI_SCSIIO_CONTROL_ABORT_TASK_SET       (0x00020000)
141 #define MPI_SCSIIO_CONTROL_RESERVED2            (0x00010000)
142
143
144 /* SCSI IO reply structure */
145 typedef struct _MSG_SCSI_IO_REPLY
146 {
147     U8                      TargetID;           /* 00h */
148     U8                      Bus;                /* 01h */
149     U8                      MsgLength;          /* 02h */
150     U8                      Function;           /* 03h */
151     U8                      CDBLength;          /* 04h */
152     U8                      SenseBufferLength;  /* 05h */
153     U8                      Reserved;           /* 06h */
154     U8                      MsgFlags;           /* 07h */
155     U32                     MsgContext;         /* 08h */
156     U8                      SCSIStatus;         /* 0Ch */
157     U8                      SCSIState;          /* 0Dh */
158     U16                     IOCStatus;          /* 0Eh */
159     U32                     IOCLogInfo;         /* 10h */
160     U32                     TransferCount;      /* 14h */
161     U32                     SenseCount;         /* 18h */
162     U32                     ResponseInfo;       /* 1Ch */
163     U16                     TaskTag;            /* 20h */
164     U16                     Reserved1;          /* 22h */
165 } MSG_SCSI_IO_REPLY, MPI_POINTER PTR_MSG_SCSI_IO_REPLY,
166   SCSIIOReply_t, MPI_POINTER pSCSIIOReply_t;
167
168
169 /* SCSI IO Reply SCSIStatus values (SAM-2 status codes) */
170
171 #define MPI_SCSI_STATUS_SUCCESS                 (0x00)
172 #define MPI_SCSI_STATUS_CHECK_CONDITION         (0x02)
173 #define MPI_SCSI_STATUS_CONDITION_MET           (0x04)
174 #define MPI_SCSI_STATUS_BUSY                    (0x08)
175 #define MPI_SCSI_STATUS_INTERMEDIATE            (0x10)
176 #define MPI_SCSI_STATUS_INTERMEDIATE_CONDMET    (0x14)
177 #define MPI_SCSI_STATUS_RESERVATION_CONFLICT    (0x18)
178 #define MPI_SCSI_STATUS_COMMAND_TERMINATED      (0x22)
179 #define MPI_SCSI_STATUS_TASK_SET_FULL           (0x28)
180 #define MPI_SCSI_STATUS_ACA_ACTIVE              (0x30)
181
182 #define MPI_SCSI_STATUS_FCPEXT_DEVICE_LOGGED_OUT    (0x80)
183 #define MPI_SCSI_STATUS_FCPEXT_NO_LINK              (0x81)
184 #define MPI_SCSI_STATUS_FCPEXT_UNASSIGNED           (0x82)
185
186
187 /* SCSI IO Reply SCSIState values */
188
189 #define MPI_SCSI_STATE_AUTOSENSE_VALID          (0x01)
190 #define MPI_SCSI_STATE_AUTOSENSE_FAILED         (0x02)
191 #define MPI_SCSI_STATE_NO_SCSI_STATUS           (0x04)
192 #define MPI_SCSI_STATE_TERMINATED               (0x08)
193 #define MPI_SCSI_STATE_RESPONSE_INFO_VALID      (0x10)
194 #define MPI_SCSI_STATE_QUEUE_TAG_REJECTED       (0x20)
195
196 /* SCSI IO Reply ResponseInfo values */
197 /* (FCP-1 RSP_CODE values and SPI-3 Packetized Failure codes) */
198
199 #define MPI_SCSI_RSP_INFO_FUNCTION_COMPLETE     (0x00000000)
200 #define MPI_SCSI_RSP_INFO_FCP_BURST_LEN_ERROR   (0x01000000)
201 #define MPI_SCSI_RSP_INFO_CMND_FIELDS_INVALID   (0x02000000)
202 #define MPI_SCSI_RSP_INFO_FCP_DATA_RO_ERROR     (0x03000000)
203 #define MPI_SCSI_RSP_INFO_TASK_MGMT_UNSUPPORTED (0x04000000)
204 #define MPI_SCSI_RSP_INFO_TASK_MGMT_FAILED      (0x05000000)
205 #define MPI_SCSI_RSP_INFO_SPI_LQ_INVALID_TYPE   (0x06000000)
206
207 #define MPI_SCSI_TASKTAG_UNKNOWN                (0xFFFF)
208
209
210 /****************************************************************************/
211 /*  SCSI IO 32 messages and associated structures                           */
212 /****************************************************************************/
213
214 typedef struct
215 {
216     U8                      CDB[20];                    /* 00h */
217     U32                     PrimaryReferenceTag;        /* 14h */
218     U16                     PrimaryApplicationTag;      /* 18h */
219     U16                     PrimaryApplicationTagMask;  /* 1Ah */
220     U32                     TransferLength;             /* 1Ch */
221 } MPI_SCSI_IO32_CDB_EEDP32, MPI_POINTER PTR_MPI_SCSI_IO32_CDB_EEDP32,
222   MpiScsiIo32CdbEedp32_t, MPI_POINTER pMpiScsiIo32CdbEedp32_t;
223
224 typedef struct
225 {
226     U8                      CDB[16];                    /* 00h */
227     U32                     DataLength;                 /* 10h */
228     U32                     PrimaryReferenceTag;        /* 14h */
229     U16                     PrimaryApplicationTag;      /* 18h */
230     U16                     PrimaryApplicationTagMask;  /* 1Ah */
231     U32                     TransferLength;             /* 1Ch */
232 } MPI_SCSI_IO32_CDB_EEDP16, MPI_POINTER PTR_MPI_SCSI_IO32_CDB_EEDP16,
233   MpiScsiIo32CdbEedp16_t, MPI_POINTER pMpiScsiIo32CdbEedp16_t;
234
235 typedef union
236 {
237     U8                       CDB32[32];
238     MPI_SCSI_IO32_CDB_EEDP32 EEDP32;
239     MPI_SCSI_IO32_CDB_EEDP16 EEDP16;
240     SGE_SIMPLE_UNION         SGE;
241 } MPI_SCSI_IO32_CDB_UNION, MPI_POINTER PTR_MPI_SCSI_IO32_CDB_UNION,
242   MpiScsiIo32Cdb_t, MPI_POINTER pMpiScsiIo32Cdb_t;
243
244 typedef struct
245 {
246     U8                      TargetID;           /* 00h */
247     U8                      Bus;                /* 01h */
248     U16                     Reserved1;          /* 02h */
249     U32                     Reserved2;          /* 04h */
250 } MPI_SCSI_IO32_BUS_TARGET_ID_FORM, MPI_POINTER PTR_MPI_SCSI_IO32_BUS_TARGET_ID_FORM,
251   MpiScsiIo32BusTargetIdForm_t, MPI_POINTER pMpiScsiIo32BusTargetIdForm_t;
252
253 typedef union
254 {
255     MPI_SCSI_IO32_BUS_TARGET_ID_FORM    SCSIID;
256     U64                                 WWID;
257 } MPI_SCSI_IO32_ADDRESS, MPI_POINTER PTR_MPI_SCSI_IO32_ADDRESS,
258   MpiScsiIo32Address_t, MPI_POINTER pMpiScsiIo32Address_t;
259
260 typedef struct _MSG_SCSI_IO32_REQUEST
261 {
262     U8                          Port;                           /* 00h */
263     U8                          Reserved1;                      /* 01h */
264     U8                          ChainOffset;                    /* 02h */
265     U8                          Function;                       /* 03h */
266     U8                          CDBLength;                      /* 04h */
267     U8                          SenseBufferLength;              /* 05h */
268     U8                          Flags;                          /* 06h */
269     U8                          MsgFlags;                       /* 07h */
270     U32                         MsgContext;                     /* 08h */
271     U8                          LUN[8];                         /* 0Ch */
272     U32                         Control;                        /* 14h */
273     MPI_SCSI_IO32_CDB_UNION     CDB;                            /* 18h */
274     U32                         DataLength;                     /* 38h */
275     U32                         BidirectionalDataLength;        /* 3Ch */
276     U32                         SecondaryReferenceTag;          /* 40h */
277     U16                         SecondaryApplicationTag;        /* 44h */
278     U16                         Reserved2;                      /* 46h */
279     U16                         EEDPFlags;                      /* 48h */
280     U16                         ApplicationTagTranslationMask;  /* 4Ah */
281     U32                         EEDPBlockSize;                  /* 4Ch */
282     MPI_SCSI_IO32_ADDRESS       DeviceAddress;                  /* 50h */
283     U8                          SGLOffset0;                     /* 58h */
284     U8                          SGLOffset1;                     /* 59h */
285     U8                          SGLOffset2;                     /* 5Ah */
286     U8                          SGLOffset3;                     /* 5Bh */
287     U32                         Reserved3;                      /* 5Ch */
288     U32                         Reserved4;                      /* 60h */
289     U32                         SenseBufferLowAddr;             /* 64h */
290     SGE_IO_UNION                SGL;                            /* 68h */
291 } MSG_SCSI_IO32_REQUEST, MPI_POINTER PTR_MSG_SCSI_IO32_REQUEST,
292   SCSIIO32Request_t, MPI_POINTER pSCSIIO32Request_t;
293
294 /* SCSI IO 32 MsgFlags bits */
295 #define MPI_SCSIIO32_MSGFLGS_SENSE_WIDTH                (0x01)
296 #define MPI_SCSIIO32_MSGFLGS_32_SENSE_WIDTH             (0x00)
297 #define MPI_SCSIIO32_MSGFLGS_64_SENSE_WIDTH             (0x01)
298
299 #define MPI_SCSIIO32_MSGFLGS_SENSE_LOCATION             (0x02)
300 #define MPI_SCSIIO32_MSGFLGS_SENSE_LOC_HOST             (0x00)
301 #define MPI_SCSIIO32_MSGFLGS_SENSE_LOC_IOC              (0x02)
302
303 #define MPI_SCSIIO32_MSGFLGS_CMD_DETERMINES_DATA_DIR    (0x04)
304 #define MPI_SCSIIO32_MSGFLGS_SGL_OFFSETS_CHAINS         (0x08)
305 #define MPI_SCSIIO32_MSGFLGS_MULTICAST                  (0x10)
306 #define MPI_SCSIIO32_MSGFLGS_BIDIRECTIONAL              (0x20)
307 #define MPI_SCSIIO32_MSGFLGS_LARGE_CDB                  (0x40)
308
309 /* SCSI IO 32 Flags bits */
310 #define MPI_SCSIIO32_FLAGS_FORM_MASK                    (0x03)
311 #define MPI_SCSIIO32_FLAGS_FORM_SCSIID                  (0x00)
312 #define MPI_SCSIIO32_FLAGS_FORM_WWID                    (0x01)
313
314 /* SCSI IO 32 LUN fields */
315 #define MPI_SCSIIO32_LUN_FIRST_LEVEL_ADDRESSING     (0x0000FFFF)
316 #define MPI_SCSIIO32_LUN_SECOND_LEVEL_ADDRESSING    (0xFFFF0000)
317 #define MPI_SCSIIO32_LUN_THIRD_LEVEL_ADDRESSING     (0x0000FFFF)
318 #define MPI_SCSIIO32_LUN_FOURTH_LEVEL_ADDRESSING    (0xFFFF0000)
319 #define MPI_SCSIIO32_LUN_LEVEL_1_WORD               (0xFF00)
320 #define MPI_SCSIIO32_LUN_LEVEL_1_DWORD              (0x0000FF00)
321
322 /* SCSI IO 32 Control bits */
323 #define MPI_SCSIIO32_CONTROL_DATADIRECTION_MASK     (0x03000000)
324 #define MPI_SCSIIO32_CONTROL_NODATATRANSFER         (0x00000000)
325 #define MPI_SCSIIO32_CONTROL_WRITE                  (0x01000000)
326 #define MPI_SCSIIO32_CONTROL_READ                   (0x02000000)
327 #define MPI_SCSIIO32_CONTROL_BIDIRECTIONAL          (0x03000000)
328
329 #define MPI_SCSIIO32_CONTROL_ADDCDBLEN_MASK         (0xFC000000)
330 #define MPI_SCSIIO32_CONTROL_ADDCDBLEN_SHIFT        (26)
331
332 #define MPI_SCSIIO32_CONTROL_TASKATTRIBUTE_MASK     (0x00000700)
333 #define MPI_SCSIIO32_CONTROL_SIMPLEQ                (0x00000000)
334 #define MPI_SCSIIO32_CONTROL_HEADOFQ                (0x00000100)
335 #define MPI_SCSIIO32_CONTROL_ORDEREDQ               (0x00000200)
336 #define MPI_SCSIIO32_CONTROL_ACAQ                   (0x00000400)
337 #define MPI_SCSIIO32_CONTROL_UNTAGGED               (0x00000500)
338 #define MPI_SCSIIO32_CONTROL_NO_DISCONNECT          (0x00000700)
339
340 #define MPI_SCSIIO32_CONTROL_TASKMANAGE_MASK        (0x00FF0000)
341 #define MPI_SCSIIO32_CONTROL_OBSOLETE               (0x00800000)
342 #define MPI_SCSIIO32_CONTROL_CLEAR_ACA_RSV          (0x00400000)
343 #define MPI_SCSIIO32_CONTROL_TARGET_RESET           (0x00200000)
344 #define MPI_SCSIIO32_CONTROL_LUN_RESET_RSV          (0x00100000)
345 #define MPI_SCSIIO32_CONTROL_RESERVED               (0x00080000)
346 #define MPI_SCSIIO32_CONTROL_CLR_TASK_SET_RSV       (0x00040000)
347 #define MPI_SCSIIO32_CONTROL_ABORT_TASK_SET         (0x00020000)
348 #define MPI_SCSIIO32_CONTROL_RESERVED2              (0x00010000)
349
350 /* SCSI IO 32 EEDPFlags */
351 #define MPI_SCSIIO32_EEDPFLAGS_MASK_OP              (0x0007)
352 #define MPI_SCSIIO32_EEDPFLAGS_NOOP_OP              (0x0000)
353 #define MPI_SCSIIO32_EEDPFLAGS_CHK_OP               (0x0001)
354 #define MPI_SCSIIO32_EEDPFLAGS_STRIP_OP             (0x0002)
355 #define MPI_SCSIIO32_EEDPFLAGS_CHKRM_OP             (0x0003)
356 #define MPI_SCSIIO32_EEDPFLAGS_INSERT_OP            (0x0004)
357 #define MPI_SCSIIO32_EEDPFLAGS_REPLACE_OP           (0x0006)
358 #define MPI_SCSIIO32_EEDPFLAGS_CHKREGEN_OP          (0x0007)
359
360 #define MPI_SCSIIO32_EEDPFLAGS_PASS_REF_TAG         (0x0008)
361 #define MPI_SCSIIO32_EEDPFLAGS_8_9THS_MODE          (0x0010)
362
363 #define MPI_SCSIIO32_EEDPFLAGS_T10_CHK_MASK         (0x0700)
364 #define MPI_SCSIIO32_EEDPFLAGS_T10_CHK_GUARD        (0x0100)
365 #define MPI_SCSIIO32_EEDPFLAGS_T10_CHK_REFTAG       (0x0200)
366 #define MPI_SCSIIO32_EEDPFLAGS_T10_CHK_LBATAG       (0x0400)
367 #define MPI_SCSIIO32_EEDPFLAGS_T10_CHK_SHIFT        (8)
368
369 #define MPI_SCSIIO32_EEDPFLAGS_INC_SEC_APPTAG       (0x1000)
370 #define MPI_SCSIIO32_EEDPFLAGS_INC_PRI_APPTAG       (0x2000)
371 #define MPI_SCSIIO32_EEDPFLAGS_INC_SEC_REFTAG       (0x4000)
372 #define MPI_SCSIIO32_EEDPFLAGS_INC_PRI_REFTAG       (0x8000)
373
374
375 /* SCSIIO32 IO reply structure */
376 typedef struct _MSG_SCSIIO32_IO_REPLY
377 {
378     U8                      Port;                       /* 00h */
379     U8                      Reserved1;                  /* 01h */
380     U8                      MsgLength;                  /* 02h */
381     U8                      Function;                   /* 03h */
382     U8                      CDBLength;                  /* 04h */
383     U8                      SenseBufferLength;          /* 05h */
384     U8                      Flags;                      /* 06h */
385     U8                      MsgFlags;                   /* 07h */
386     U32                     MsgContext;                 /* 08h */
387     U8                      SCSIStatus;                 /* 0Ch */
388     U8                      SCSIState;                  /* 0Dh */
389     U16                     IOCStatus;                  /* 0Eh */
390     U32                     IOCLogInfo;                 /* 10h */
391     U32                     TransferCount;              /* 14h */
392     U32                     SenseCount;                 /* 18h */
393     U32                     ResponseInfo;               /* 1Ch */
394     U16                     TaskTag;                    /* 20h */
395     U16                     Reserved2;                  /* 22h */
396     U32                     BidirectionalTransferCount; /* 24h */
397 } MSG_SCSIIO32_IO_REPLY, MPI_POINTER PTR_MSG_SCSIIO32_IO_REPLY,
398   SCSIIO32Reply_t, MPI_POINTER pSCSIIO32Reply_t;
399
400
401 /****************************************************************************/
402 /*  SCSI Task Management messages                                           */
403 /****************************************************************************/
404
405 typedef struct _MSG_SCSI_TASK_MGMT
406 {
407     U8                      TargetID;           /* 00h */
408     U8                      Bus;                /* 01h */
409     U8                      ChainOffset;        /* 02h */
410     U8                      Function;           /* 03h */
411     U8                      Reserved;           /* 04h */
412     U8                      TaskType;           /* 05h */
413     U8                      Reserved1;          /* 06h */
414     U8                      MsgFlags;           /* 07h */
415     U32                     MsgContext;         /* 08h */
416     U8                      LUN[8];             /* 0Ch */
417     U32                     Reserved2[7];       /* 14h */
418     U32                     TaskMsgContext;     /* 30h */
419 } MSG_SCSI_TASK_MGMT, MPI_POINTER PTR_SCSI_TASK_MGMT,
420   SCSITaskMgmt_t, MPI_POINTER pSCSITaskMgmt_t;
421
422 /* TaskType values */
423
424 #define MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK            (0x01)
425 #define MPI_SCSITASKMGMT_TASKTYPE_ABRT_TASK_SET         (0x02)
426 #define MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET          (0x03)
427 #define MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS             (0x04)
428 #define MPI_SCSITASKMGMT_TASKTYPE_LOGICAL_UNIT_RESET    (0x05)
429 #define MPI_SCSITASKMGMT_TASKTYPE_CLEAR_TASK_SET        (0x06)
430 #define MPI_SCSITASKMGMT_TASKTYPE_QUERY_TASK            (0x07)
431 #define MPI_SCSITASKMGMT_TASKTYPE_CLEAR_ACA             (0x08)
432
433 /* MsgFlags bits */
434 #define MPI_SCSITASKMGMT_MSGFLAGS_TARGET_RESET_OPTION   (0x00)
435 #define MPI_SCSITASKMGMT_MSGFLAGS_LIP_RESET_OPTION      (0x02)
436 #define MPI_SCSITASKMGMT_MSGFLAGS_LIPRESET_RESET_OPTION (0x04)
437
438 /* SCSI Task Management Reply */
439 typedef struct _MSG_SCSI_TASK_MGMT_REPLY
440 {
441     U8                      TargetID;           /* 00h */
442     U8                      Bus;                /* 01h */
443     U8                      MsgLength;          /* 02h */
444     U8                      Function;           /* 03h */
445     U8                      ResponseCode;       /* 04h */
446     U8                      TaskType;           /* 05h */
447     U8                      Reserved1;          /* 06h */
448     U8                      MsgFlags;           /* 07h */
449     U32                     MsgContext;         /* 08h */
450     U8                      Reserved2[2];       /* 0Ch */
451     U16                     IOCStatus;          /* 0Eh */
452     U32                     IOCLogInfo;         /* 10h */
453     U32                     TerminationCount;   /* 14h */
454 } MSG_SCSI_TASK_MGMT_REPLY, MPI_POINTER PTR_MSG_SCSI_TASK_MGMT_REPLY,
455   SCSITaskMgmtReply_t, MPI_POINTER pSCSITaskMgmtReply_t;
456
457 /* ResponseCode values */
458 #define MPI_SCSITASKMGMT_RSP_TM_COMPLETE                (0x00)
459 #define MPI_SCSITASKMGMT_RSP_INVALID_FRAME              (0x02)
460 #define MPI_SCSITASKMGMT_RSP_TM_NOT_SUPPORTED           (0x04)
461 #define MPI_SCSITASKMGMT_RSP_TM_FAILED                  (0x05)
462 #define MPI_SCSITASKMGMT_RSP_TM_SUCCEEDED               (0x08)
463 #define MPI_SCSITASKMGMT_RSP_TM_INVALID_LUN             (0x09)
464 #define MPI_SCSITASKMGMT_RSP_IO_QUEUED_ON_IOC           (0x80)
465
466
467 /****************************************************************************/
468 /*  SCSI Enclosure Processor messages                                       */
469 /****************************************************************************/
470
471 typedef struct _MSG_SEP_REQUEST
472 {
473     U8                      TargetID;           /* 00h */
474     U8                      Bus;                /* 01h */
475     U8                      ChainOffset;        /* 02h */
476     U8                      Function;           /* 03h */
477     U8                      Action;             /* 04h */
478     U8                      Flags;              /* 05h */
479     U8                      Reserved1;          /* 06h */
480     U8                      MsgFlags;           /* 07h */
481     U32                     MsgContext;         /* 08h */
482     U32                     SlotStatus;         /* 0Ch */
483     U32                     Reserved2;          /* 10h */
484     U32                     Reserved3;          /* 14h */
485     U32                     Reserved4;          /* 18h */
486     U16                     Slot;               /* 1Ch */
487     U16                     EnclosureHandle;    /* 1Eh */
488 } MSG_SEP_REQUEST, MPI_POINTER PTR_MSG_SEP_REQUEST,
489   SEPRequest_t, MPI_POINTER pSEPRequest_t;
490
491 /* Action defines */
492 #define MPI_SEP_REQ_ACTION_WRITE_STATUS                 (0x00)
493 #define MPI_SEP_REQ_ACTION_READ_STATUS                  (0x01)
494
495 /* Flags defines */
496 #define MPI_SEP_REQ_FLAGS_ENCLOSURE_SLOT_ADDRESS        (0x01)
497 #define MPI_SEP_REQ_FLAGS_BUS_TARGETID_ADDRESS          (0x00)
498
499 /* SlotStatus bits for MSG_SEP_REQUEST */
500 #define MPI_SEP_REQ_SLOTSTATUS_NO_ERROR                 (0x00000001)
501 #define MPI_SEP_REQ_SLOTSTATUS_DEV_FAULTY               (0x00000002)
502 #define MPI_SEP_REQ_SLOTSTATUS_DEV_REBUILDING           (0x00000004)
503 #define MPI_SEP_REQ_SLOTSTATUS_IN_FAILED_ARRAY          (0x00000008)
504 #define MPI_SEP_REQ_SLOTSTATUS_IN_CRITICAL_ARRAY        (0x00000010)
505 #define MPI_SEP_REQ_SLOTSTATUS_PARITY_CHECK             (0x00000020)
506 #define MPI_SEP_REQ_SLOTSTATUS_PREDICTED_FAULT          (0x00000040)
507 #define MPI_SEP_REQ_SLOTSTATUS_UNCONFIGURED             (0x00000080)
508 #define MPI_SEP_REQ_SLOTSTATUS_HOT_SPARE                (0x00000100)
509 #define MPI_SEP_REQ_SLOTSTATUS_REBUILD_STOPPED          (0x00000200)
510 #define MPI_SEP_REQ_SLOTSTATUS_REQ_CONSISTENCY_CHECK    (0x00001000)
511 #define MPI_SEP_REQ_SLOTSTATUS_DISABLE                  (0x00002000)
512 #define MPI_SEP_REQ_SLOTSTATUS_REQ_RESERVED_DEVICE      (0x00004000)
513 #define MPI_SEP_REQ_SLOTSTATUS_IDENTIFY_REQUEST         (0x00020000)
514 #define MPI_SEP_REQ_SLOTSTATUS_REQUEST_REMOVE           (0x00040000)
515 #define MPI_SEP_REQ_SLOTSTATUS_REQUEST_INSERT           (0x00080000)
516 #define MPI_SEP_REQ_SLOTSTATUS_DO_NOT_MOVE              (0x00400000)
517 #define MPI_SEP_REQ_SLOTSTATUS_ACTIVE                   (0x00800000)
518 #define MPI_SEP_REQ_SLOTSTATUS_B_ENABLE_BYPASS          (0x04000000)
519 #define MPI_SEP_REQ_SLOTSTATUS_A_ENABLE_BYPASS          (0x08000000)
520 #define MPI_SEP_REQ_SLOTSTATUS_DEV_OFF                  (0x10000000)
521 #define MPI_SEP_REQ_SLOTSTATUS_SWAP_RESET               (0x80000000)
522
523
524 typedef struct _MSG_SEP_REPLY
525 {
526     U8                      TargetID;           /* 00h */
527     U8                      Bus;                /* 01h */
528     U8                      MsgLength;          /* 02h */
529     U8                      Function;           /* 03h */
530     U8                      Action;             /* 04h */
531     U8                      Reserved1;          /* 05h */
532     U8                      Reserved2;          /* 06h */
533     U8                      MsgFlags;           /* 07h */
534     U32                     MsgContext;         /* 08h */
535     U16                     Reserved3;          /* 0Ch */
536     U16                     IOCStatus;          /* 0Eh */
537     U32                     IOCLogInfo;         /* 10h */
538     U32                     SlotStatus;         /* 14h */
539     U32                     Reserved4;          /* 18h */
540     U16                     Slot;               /* 1Ch */
541     U16                     EnclosureHandle;    /* 1Eh */
542 } MSG_SEP_REPLY, MPI_POINTER PTR_MSG_SEP_REPLY,
543   SEPReply_t, MPI_POINTER pSEPReply_t;
544
545 /* SlotStatus bits for MSG_SEP_REPLY */
546 #define MPI_SEP_REPLY_SLOTSTATUS_NO_ERROR               (0x00000001)
547 #define MPI_SEP_REPLY_SLOTSTATUS_DEV_FAULTY             (0x00000002)
548 #define MPI_SEP_REPLY_SLOTSTATUS_DEV_REBUILDING         (0x00000004)
549 #define MPI_SEP_REPLY_SLOTSTATUS_IN_FAILED_ARRAY        (0x00000008)
550 #define MPI_SEP_REPLY_SLOTSTATUS_IN_CRITICAL_ARRAY      (0x00000010)
551 #define MPI_SEP_REPLY_SLOTSTATUS_PARITY_CHECK           (0x00000020)
552 #define MPI_SEP_REPLY_SLOTSTATUS_PREDICTED_FAULT        (0x00000040)
553 #define MPI_SEP_REPLY_SLOTSTATUS_UNCONFIGURED           (0x00000080)
554 #define MPI_SEP_REPLY_SLOTSTATUS_HOT_SPARE              (0x00000100)
555 #define MPI_SEP_REPLY_SLOTSTATUS_REBUILD_STOPPED        (0x00000200)
556 #define MPI_SEP_REPLY_SLOTSTATUS_CONSISTENCY_CHECK      (0x00001000)
557 #define MPI_SEP_REPLY_SLOTSTATUS_DISABLE                (0x00002000)
558 #define MPI_SEP_REPLY_SLOTSTATUS_RESERVED_DEVICE        (0x00004000)
559 #define MPI_SEP_REPLY_SLOTSTATUS_REPORT                 (0x00010000)
560 #define MPI_SEP_REPLY_SLOTSTATUS_IDENTIFY_REQUEST       (0x00020000)
561 #define MPI_SEP_REPLY_SLOTSTATUS_REMOVE_READY           (0x00040000)
562 #define MPI_SEP_REPLY_SLOTSTATUS_INSERT_READY           (0x00080000)
563 #define MPI_SEP_REPLY_SLOTSTATUS_DO_NOT_REMOVE          (0x00400000)
564 #define MPI_SEP_REPLY_SLOTSTATUS_ACTIVE                 (0x00800000)
565 #define MPI_SEP_REPLY_SLOTSTATUS_B_BYPASS_ENABLED       (0x01000000)
566 #define MPI_SEP_REPLY_SLOTSTATUS_A_BYPASS_ENABLED       (0x02000000)
567 #define MPI_SEP_REPLY_SLOTSTATUS_B_ENABLE_BYPASS        (0x04000000)
568 #define MPI_SEP_REPLY_SLOTSTATUS_A_ENABLE_BYPASS        (0x08000000)
569 #define MPI_SEP_REPLY_SLOTSTATUS_DEV_OFF                (0x10000000)
570 #define MPI_SEP_REPLY_SLOTSTATUS_FAULT_SENSED           (0x40000000)
571 #define MPI_SEP_REPLY_SLOTSTATUS_SWAPPED                (0x80000000)
572
573 #endif