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