Merge /pub/scm/linux/kernel/git/torvalds/linux-2.6
[pandora-kernel.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.04
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  *  --------------------------------------------------------------------------
52  */
53
54 #ifndef MPI_INIT_H
55 #define MPI_INIT_H
56
57
58 /*****************************************************************************
59 *
60 *               S C S I    I n i t i a t o r    M e s s a g e s
61 *
62 *****************************************************************************/
63
64 /****************************************************************************/
65 /*  SCSI IO messages and associated structures                              */
66 /****************************************************************************/
67
68 typedef struct _MSG_SCSI_IO_REQUEST
69 {
70     U8                      TargetID;           /* 00h */
71     U8                      Bus;                /* 01h */
72     U8                      ChainOffset;        /* 02h */
73     U8                      Function;           /* 03h */
74     U8                      CDBLength;          /* 04h */
75     U8                      SenseBufferLength;  /* 05h */
76     U8                      Reserved;           /* 06h */
77     U8                      MsgFlags;           /* 07h */
78     U32                     MsgContext;         /* 08h */
79     U8                      LUN[8];             /* 0Ch */
80     U32                     Control;            /* 14h */
81     U8                      CDB[16];            /* 18h */
82     U32                     DataLength;         /* 28h */
83     U32                     SenseBufferLowAddr; /* 2Ch */
84     SGE_IO_UNION            SGL;                /* 30h */
85 } MSG_SCSI_IO_REQUEST, MPI_POINTER PTR_MSG_SCSI_IO_REQUEST,
86   SCSIIORequest_t, MPI_POINTER pSCSIIORequest_t;
87
88
89 /* SCSI IO MsgFlags bits */
90
91 #define MPI_SCSIIO_MSGFLGS_SENSE_WIDTH              (0x01)
92 #define MPI_SCSIIO_MSGFLGS_SENSE_WIDTH_32           (0x00)
93 #define MPI_SCSIIO_MSGFLGS_SENSE_WIDTH_64           (0x01)
94
95 #define MPI_SCSIIO_MSGFLGS_SENSE_LOCATION           (0x02)
96 #define MPI_SCSIIO_MSGFLGS_SENSE_LOC_HOST           (0x00)
97 #define MPI_SCSIIO_MSGFLGS_SENSE_LOC_IOC            (0x02)
98
99 #define MPI_SCSIIO_MSGFLGS_CMD_DETERMINES_DATA_DIR  (0x04)
100
101 /* SCSI IO LUN fields */
102
103 #define MPI_SCSIIO_LUN_FIRST_LEVEL_ADDRESSING   (0x0000FFFF)
104 #define MPI_SCSIIO_LUN_SECOND_LEVEL_ADDRESSING  (0xFFFF0000)
105 #define MPI_SCSIIO_LUN_THIRD_LEVEL_ADDRESSING   (0x0000FFFF)
106 #define MPI_SCSIIO_LUN_FOURTH_LEVEL_ADDRESSING  (0xFFFF0000)
107 #define MPI_SCSIIO_LUN_LEVEL_1_WORD             (0xFF00)
108 #define MPI_SCSIIO_LUN_LEVEL_1_DWORD            (0x0000FF00)
109
110 /* SCSI IO Control bits */
111
112 #define MPI_SCSIIO_CONTROL_DATADIRECTION_MASK   (0x03000000)
113 #define MPI_SCSIIO_CONTROL_NODATATRANSFER       (0x00000000)
114 #define MPI_SCSIIO_CONTROL_WRITE                (0x01000000)
115 #define MPI_SCSIIO_CONTROL_READ                 (0x02000000)
116
117 #define MPI_SCSIIO_CONTROL_ADDCDBLEN_MASK       (0x3C000000)
118 #define MPI_SCSIIO_CONTROL_ADDCDBLEN_SHIFT      (26)
119
120 #define MPI_SCSIIO_CONTROL_TASKATTRIBUTE_MASK   (0x00000700)
121 #define MPI_SCSIIO_CONTROL_SIMPLEQ              (0x00000000)
122 #define MPI_SCSIIO_CONTROL_HEADOFQ              (0x00000100)
123 #define MPI_SCSIIO_CONTROL_ORDEREDQ             (0x00000200)
124 #define MPI_SCSIIO_CONTROL_ACAQ                 (0x00000400)
125 #define MPI_SCSIIO_CONTROL_UNTAGGED             (0x00000500)
126 #define MPI_SCSIIO_CONTROL_NO_DISCONNECT        (0x00000700)
127
128 #define MPI_SCSIIO_CONTROL_TASKMANAGE_MASK      (0x00FF0000)
129 #define MPI_SCSIIO_CONTROL_OBSOLETE             (0x00800000)
130 #define MPI_SCSIIO_CONTROL_CLEAR_ACA_RSV        (0x00400000)
131 #define MPI_SCSIIO_CONTROL_TARGET_RESET         (0x00200000)
132 #define MPI_SCSIIO_CONTROL_LUN_RESET_RSV        (0x00100000)
133 #define MPI_SCSIIO_CONTROL_RESERVED             (0x00080000)
134 #define MPI_SCSIIO_CONTROL_CLR_TASK_SET_RSV     (0x00040000)
135 #define MPI_SCSIIO_CONTROL_ABORT_TASK_SET       (0x00020000)
136 #define MPI_SCSIIO_CONTROL_RESERVED2            (0x00010000)
137
138
139 /* SCSI IO reply structure */
140 typedef struct _MSG_SCSI_IO_REPLY
141 {
142     U8                      TargetID;           /* 00h */
143     U8                      Bus;                /* 01h */
144     U8                      MsgLength;          /* 02h */
145     U8                      Function;           /* 03h */
146     U8                      CDBLength;          /* 04h */
147     U8                      SenseBufferLength;  /* 05h */
148     U8                      Reserved;           /* 06h */
149     U8                      MsgFlags;           /* 07h */
150     U32                     MsgContext;         /* 08h */
151     U8                      SCSIStatus;         /* 0Ch */
152     U8                      SCSIState;          /* 0Dh */
153     U16                     IOCStatus;          /* 0Eh */
154     U32                     IOCLogInfo;         /* 10h */
155     U32                     TransferCount;      /* 14h */
156     U32                     SenseCount;         /* 18h */
157     U32                     ResponseInfo;       /* 1Ch */
158     U16                     TaskTag;            /* 20h */
159     U16                     Reserved1;          /* 22h */
160 } MSG_SCSI_IO_REPLY, MPI_POINTER PTR_MSG_SCSI_IO_REPLY,
161   SCSIIOReply_t, MPI_POINTER pSCSIIOReply_t;
162
163
164 /* SCSI IO Reply SCSIStatus values (SAM-2 status codes) */
165
166 #define MPI_SCSI_STATUS_SUCCESS                 (0x00)
167 #define MPI_SCSI_STATUS_CHECK_CONDITION         (0x02)
168 #define MPI_SCSI_STATUS_CONDITION_MET           (0x04)
169 #define MPI_SCSI_STATUS_BUSY                    (0x08)
170 #define MPI_SCSI_STATUS_INTERMEDIATE            (0x10)
171 #define MPI_SCSI_STATUS_INTERMEDIATE_CONDMET    (0x14)
172 #define MPI_SCSI_STATUS_RESERVATION_CONFLICT    (0x18)
173 #define MPI_SCSI_STATUS_COMMAND_TERMINATED      (0x22)
174 #define MPI_SCSI_STATUS_TASK_SET_FULL           (0x28)
175 #define MPI_SCSI_STATUS_ACA_ACTIVE              (0x30)
176
177 #define MPI_SCSI_STATUS_FCPEXT_DEVICE_LOGGED_OUT    (0x80)
178 #define MPI_SCSI_STATUS_FCPEXT_NO_LINK              (0x81)
179 #define MPI_SCSI_STATUS_FCPEXT_UNASSIGNED           (0x82)
180
181
182 /* SCSI IO Reply SCSIState values */
183
184 #define MPI_SCSI_STATE_AUTOSENSE_VALID          (0x01)
185 #define MPI_SCSI_STATE_AUTOSENSE_FAILED         (0x02)
186 #define MPI_SCSI_STATE_NO_SCSI_STATUS           (0x04)
187 #define MPI_SCSI_STATE_TERMINATED               (0x08)
188 #define MPI_SCSI_STATE_RESPONSE_INFO_VALID      (0x10)
189 #define MPI_SCSI_STATE_QUEUE_TAG_REJECTED       (0x20)
190
191 /* SCSI IO Reply ResponseInfo values */
192 /* (FCP-1 RSP_CODE values and SPI-3 Packetized Failure codes) */
193
194 #define MPI_SCSI_RSP_INFO_FUNCTION_COMPLETE     (0x00000000)
195 #define MPI_SCSI_RSP_INFO_FCP_BURST_LEN_ERROR   (0x01000000)
196 #define MPI_SCSI_RSP_INFO_CMND_FIELDS_INVALID   (0x02000000)
197 #define MPI_SCSI_RSP_INFO_FCP_DATA_RO_ERROR     (0x03000000)
198 #define MPI_SCSI_RSP_INFO_TASK_MGMT_UNSUPPORTED (0x04000000)
199 #define MPI_SCSI_RSP_INFO_TASK_MGMT_FAILED      (0x05000000)
200 #define MPI_SCSI_RSP_INFO_SPI_LQ_INVALID_TYPE   (0x06000000)
201
202 #define MPI_SCSI_TASKTAG_UNKNOWN                (0xFFFF)
203
204
205 /****************************************************************************/
206 /*  SCSI Task Management messages                                           */
207 /****************************************************************************/
208
209 typedef struct _MSG_SCSI_TASK_MGMT
210 {
211     U8                      TargetID;           /* 00h */
212     U8                      Bus;                /* 01h */
213     U8                      ChainOffset;        /* 02h */
214     U8                      Function;           /* 03h */
215     U8                      Reserved;           /* 04h */
216     U8                      TaskType;           /* 05h */
217     U8                      Reserved1;          /* 06h */
218     U8                      MsgFlags;           /* 07h */
219     U32                     MsgContext;         /* 08h */
220     U8                      LUN[8];             /* 0Ch */
221     U32                     Reserved2[7];       /* 14h */
222     U32                     TaskMsgContext;     /* 30h */
223 } MSG_SCSI_TASK_MGMT, MPI_POINTER PTR_SCSI_TASK_MGMT,
224   SCSITaskMgmt_t, MPI_POINTER pSCSITaskMgmt_t;
225
226 /* TaskType values */
227
228 #define MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK            (0x01)
229 #define MPI_SCSITASKMGMT_TASKTYPE_ABRT_TASK_SET         (0x02)
230 #define MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET          (0x03)
231 #define MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS             (0x04)
232 #define MPI_SCSITASKMGMT_TASKTYPE_LOGICAL_UNIT_RESET    (0x05)
233 #define MPI_SCSITASKMGMT_TASKTYPE_CLEAR_TASK_SET        (0x06)
234 #define MPI_SCSITASKMGMT_TASKTYPE_QUERY_TASK            (0x07)
235
236 /* MsgFlags bits */
237 #define MPI_SCSITASKMGMT_MSGFLAGS_TARGET_RESET_OPTION   (0x00)
238 #define MPI_SCSITASKMGMT_MSGFLAGS_LIP_RESET_OPTION      (0x02)
239 #define MPI_SCSITASKMGMT_MSGFLAGS_LIPRESET_RESET_OPTION (0x04)
240
241 /* SCSI Task Management Reply */
242 typedef struct _MSG_SCSI_TASK_MGMT_REPLY
243 {
244     U8                      TargetID;           /* 00h */
245     U8                      Bus;                /* 01h */
246     U8                      MsgLength;          /* 02h */
247     U8                      Function;           /* 03h */
248     U8                      ResponseCode;       /* 04h */
249     U8                      TaskType;           /* 05h */
250     U8                      Reserved1;          /* 06h */
251     U8                      MsgFlags;           /* 07h */
252     U32                     MsgContext;         /* 08h */
253     U8                      Reserved2[2];       /* 0Ch */
254     U16                     IOCStatus;          /* 0Eh */
255     U32                     IOCLogInfo;         /* 10h */
256     U32                     TerminationCount;   /* 14h */
257 } MSG_SCSI_TASK_MGMT_REPLY, MPI_POINTER PTR_MSG_SCSI_TASK_MGMT_REPLY,
258   SCSITaskMgmtReply_t, MPI_POINTER pSCSITaskMgmtReply_t;
259
260 /* ResponseCode values */
261 #define MPI_SCSITASKMGMT_RSP_TM_COMPLETE                (0x00)
262 #define MPI_SCSITASKMGMT_RSP_INVALID_FRAME              (0x02)
263 #define MPI_SCSITASKMGMT_RSP_TM_NOT_SUPPORTED           (0x04)
264 #define MPI_SCSITASKMGMT_RSP_TM_FAILED                  (0x05)
265 #define MPI_SCSITASKMGMT_RSP_TM_SUCCEEDED               (0x08)
266 #define MPI_SCSITASKMGMT_RSP_TM_INVALID_LUN             (0x09)
267 #define MPI_SCSITASKMGMT_RSP_IO_QUEUED_ON_IOC           (0x80)
268
269
270 /****************************************************************************/
271 /*  SCSI Enclosure Processor messages                                       */
272 /****************************************************************************/
273
274 typedef struct _MSG_SEP_REQUEST
275 {
276     U8                      TargetID;           /* 00h */
277     U8                      Bus;                /* 01h */
278     U8                      ChainOffset;        /* 02h */
279     U8                      Function;           /* 03h */
280     U8                      Action;             /* 04h */
281     U8                      Flags;              /* 05h */
282     U8                      Reserved1;          /* 06h */
283     U8                      MsgFlags;           /* 07h */
284     U32                     MsgContext;         /* 08h */
285     U32                     SlotStatus;         /* 0Ch */
286     U32                     Reserved2;          /* 10h */
287     U32                     Reserved3;          /* 14h */
288     U32                     Reserved4;          /* 18h */
289     U16                     Slot;               /* 1Ch */
290     U16                     EnclosureHandle;    /* 1Eh */
291 } MSG_SEP_REQUEST, MPI_POINTER PTR_MSG_SEP_REQUEST,
292   SEPRequest_t, MPI_POINTER pSEPRequest_t;
293
294 /* Action defines */
295 #define MPI_SEP_REQ_ACTION_WRITE_STATUS                 (0x00)
296 #define MPI_SEP_REQ_ACTION_READ_STATUS                  (0x01)
297
298 /* Flags defines */
299 #define MPI_SEP_REQ_FLAGS_ENCLOSURE_SLOT_ADDRESS        (0x01)
300 #define MPI_SEP_REQ_FLAGS_BUS_TARGETID_ADDRESS          (0x00)
301
302 /* SlotStatus bits for MSG_SEP_REQUEST */
303 #define MPI_SEP_REQ_SLOTSTATUS_NO_ERROR                 (0x00000001)
304 #define MPI_SEP_REQ_SLOTSTATUS_DEV_FAULTY               (0x00000002)
305 #define MPI_SEP_REQ_SLOTSTATUS_DEV_REBUILDING           (0x00000004)
306 #define MPI_SEP_REQ_SLOTSTATUS_IN_FAILED_ARRAY          (0x00000008)
307 #define MPI_SEP_REQ_SLOTSTATUS_IN_CRITICAL_ARRAY        (0x00000010)
308 #define MPI_SEP_REQ_SLOTSTATUS_PARITY_CHECK             (0x00000020)
309 #define MPI_SEP_REQ_SLOTSTATUS_PREDICTED_FAULT          (0x00000040)
310 #define MPI_SEP_REQ_SLOTSTATUS_UNCONFIGURED             (0x00000080)
311 #define MPI_SEP_REQ_SLOTSTATUS_HOT_SPARE                (0x00000100)
312 #define MPI_SEP_REQ_SLOTSTATUS_REBUILD_STOPPED          (0x00000200)
313 #define MPI_SEP_REQ_SLOTSTATUS_IDENTIFY_REQUEST         (0x00020000)
314 #define MPI_SEP_REQ_SLOTSTATUS_REQUEST_REMOVE           (0x00040000)
315 #define MPI_SEP_REQ_SLOTSTATUS_REQUEST_INSERT           (0x00080000)
316 #define MPI_SEP_REQ_SLOTSTATUS_DO_NOT_MOVE              (0x00400000)
317 #define MPI_SEP_REQ_SLOTSTATUS_B_ENABLE_BYPASS          (0x04000000)
318 #define MPI_SEP_REQ_SLOTSTATUS_A_ENABLE_BYPASS          (0x08000000)
319 #define MPI_SEP_REQ_SLOTSTATUS_DEV_OFF                  (0x10000000)
320 #define MPI_SEP_REQ_SLOTSTATUS_SWAP_RESET               (0x80000000)
321
322
323 typedef struct _MSG_SEP_REPLY
324 {
325     U8                      TargetID;           /* 00h */
326     U8                      Bus;                /* 01h */
327     U8                      MsgLength;          /* 02h */
328     U8                      Function;           /* 03h */
329     U8                      Action;             /* 04h */
330     U8                      Reserved1;          /* 05h */
331     U8                      Reserved2;          /* 06h */
332     U8                      MsgFlags;           /* 07h */
333     U32                     MsgContext;         /* 08h */
334     U16                     Reserved3;          /* 0Ch */
335     U16                     IOCStatus;          /* 0Eh */
336     U32                     IOCLogInfo;         /* 10h */
337     U32                     SlotStatus;         /* 14h */
338     U32                     Reserved4;          /* 18h */
339     U16                     Slot;               /* 1Ch */
340     U16                     EnclosureHandle;    /* 1Eh */
341 } MSG_SEP_REPLY, MPI_POINTER PTR_MSG_SEP_REPLY,
342   SEPReply_t, MPI_POINTER pSEPReply_t;
343
344 /* SlotStatus bits for MSG_SEP_REPLY */
345 #define MPI_SEP_REPLY_SLOTSTATUS_NO_ERROR               (0x00000001)
346 #define MPI_SEP_REPLY_SLOTSTATUS_DEV_FAULTY             (0x00000002)
347 #define MPI_SEP_REPLY_SLOTSTATUS_DEV_REBUILDING         (0x00000004)
348 #define MPI_SEP_REPLY_SLOTSTATUS_IN_FAILED_ARRAY        (0x00000008)
349 #define MPI_SEP_REPLY_SLOTSTATUS_IN_CRITICAL_ARRAY      (0x00000010)
350 #define MPI_SEP_REPLY_SLOTSTATUS_PARITY_CHECK           (0x00000020)
351 #define MPI_SEP_REPLY_SLOTSTATUS_PREDICTED_FAULT        (0x00000040)
352 #define MPI_SEP_REPLY_SLOTSTATUS_UNCONFIGURED           (0x00000080)
353 #define MPI_SEP_REPLY_SLOTSTATUS_HOT_SPARE              (0x00000100)
354 #define MPI_SEP_REPLY_SLOTSTATUS_REBUILD_STOPPED        (0x00000200)
355 #define MPI_SEP_REPLY_SLOTSTATUS_REPORT                 (0x00010000)
356 #define MPI_SEP_REPLY_SLOTSTATUS_IDENTIFY_REQUEST       (0x00020000)
357 #define MPI_SEP_REPLY_SLOTSTATUS_REMOVE_READY           (0x00040000)
358 #define MPI_SEP_REPLY_SLOTSTATUS_INSERT_READY           (0x00080000)
359 #define MPI_SEP_REPLY_SLOTSTATUS_DO_NOT_REMOVE          (0x00400000)
360 #define MPI_SEP_REPLY_SLOTSTATUS_B_BYPASS_ENABLED       (0x01000000)
361 #define MPI_SEP_REPLY_SLOTSTATUS_A_BYPASS_ENABLED       (0x02000000)
362 #define MPI_SEP_REPLY_SLOTSTATUS_B_ENABLE_BYPASS        (0x04000000)
363 #define MPI_SEP_REPLY_SLOTSTATUS_A_ENABLE_BYPASS        (0x08000000)
364 #define MPI_SEP_REPLY_SLOTSTATUS_DEV_OFF                (0x10000000)
365 #define MPI_SEP_REPLY_SLOTSTATUS_FAULT_SENSED           (0x40000000)
366 #define MPI_SEP_REPLY_SLOTSTATUS_SWAPPED                (0x80000000)
367
368 #endif