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