Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / message / fusion / lsi / mpi_targ.h
1 /*
2  *  Copyright (c) 2000-2004 LSI Logic Corporation.
3  *
4  *
5  *           Name:  mpi_targ.h
6  *          Title:  MPI Target mode messages and structures
7  *  Creation Date:  June 22, 2000
8  *
9  *    mpi_targ.h Version:  01.05.05
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  *  06-06-00  01.00.01  Update version number for 1.0 release.
18  *  06-22-00  01.00.02  Added _MSG_TARGET_CMD_BUFFER_POST_REPLY structure.
19  *                      Corrected DECSRIPTOR typo to DESCRIPTOR.
20  *  11-02-00  01.01.01  Original release for post 1.0 work
21  *                      Modified target mode to use IoIndex instead of
22  *                      HostIndex and IocIndex. Added Alias.
23  *  01-09-01  01.01.02  Added defines for TARGET_ASSIST_FLAGS_REPOST_CMD_BUFFER
24  *                      and TARGET_STATUS_SEND_FLAGS_REPOST_CMD_BUFFER.
25  *  02-20-01  01.01.03  Started using MPI_POINTER.
26  *                      Added structures for MPI_TARGET_SCSI_SPI_CMD_BUFFER and
27  *                      MPI_TARGET_FCP_CMD_BUFFER.
28  *  03-27-01  01.01.04  Added structure offset comments.
29  *  08-08-01  01.02.01  Original release for v1.2 work.
30  *  09-28-01  01.02.02  Added structure for MPI_TARGET_SCSI_SPI_STATUS_IU.
31  *                      Added PriorityReason field to some replies and
32  *                      defined more PriorityReason codes.
33  *                      Added some defines for to support previous version
34  *                      of MPI.
35  *  10-04-01  01.02.03  Added PriorityReason to MSG_TARGET_ERROR_REPLY.
36  *  11-01-01  01.02.04  Added define for TARGET_STATUS_SEND_FLAGS_HIGH_PRIORITY.
37  *  03-14-02  01.02.05  Modified MPI_TARGET_FCP_RSP_BUFFER to get the proper
38  *                      byte ordering.
39  *  05-31-02  01.02.06  Modified TARGET_MODE_REPLY_ALIAS_MASK to only include
40  *                      one bit.
41  *                      Added AliasIndex field to MPI_TARGET_FCP_CMD_BUFFER.
42  *  09-16-02  01.02.07  Added flags for confirmed completion.
43  *                      Added PRIORITY_REASON_TARGET_BUSY.
44  *  11-15-02  01.02.08  Added AliasID field to MPI_TARGET_SCSI_SPI_CMD_BUFFER.
45  *  04-01-03  01.02.09  Added OptionalOxid field to MPI_TARGET_FCP_CMD_BUFFER.
46  *  05-11-04  01.03.01  Original release for MPI v1.3.
47  *  08-19-04  01.05.01  Added new request message structures for
48  *                      MSG_TARGET_CMD_BUF_POST_BASE_REQUEST,
49  *                      MSG_TARGET_CMD_BUF_POST_LIST_REQUEST, and
50  *                      MSG_TARGET_ASSIST_EXT_REQUEST.
51  *                      Added new structures for SAS SSP Command buffer, SSP
52  *                      Task buffer, and SSP Status IU.
53  *  10-05-04  01.05.02  MSG_TARGET_CMD_BUFFER_POST_BASE_LIST_REPLY added.
54  *  02-22-05  01.05.03  Changed a comment.
55  *  03-11-05  01.05.04  Removed TargetAssistExtended Request.
56  *  06-24-05  01.05.05  Added TargetAssistExtended structures and defines.
57  *  --------------------------------------------------------------------------
58  */
59
60 #ifndef MPI_TARG_H
61 #define MPI_TARG_H
62
63
64 /******************************************************************************
65 *
66 *        S C S I    T a r g e t    M e s s a g e s
67 *
68 *******************************************************************************/
69
70 typedef struct _CMD_BUFFER_DESCRIPTOR
71 {
72     U16                     IoIndex;                    /* 00h */
73     U16                     Reserved;                   /* 02h */
74     union                                               /* 04h */
75     {
76         U32                 PhysicalAddress32;
77         U64                 PhysicalAddress64;
78     } u;
79 } CMD_BUFFER_DESCRIPTOR, MPI_POINTER PTR_CMD_BUFFER_DESCRIPTOR,
80   CmdBufferDescriptor_t, MPI_POINTER pCmdBufferDescriptor_t;
81
82
83 /****************************************************************************/
84 /* Target Command Buffer Post Request                                       */
85 /****************************************************************************/
86
87 typedef struct _MSG_TARGET_CMD_BUFFER_POST_REQUEST
88 {
89     U8                      BufferPostFlags;            /* 00h */
90     U8                      BufferCount;                /* 01h */
91     U8                      ChainOffset;                /* 02h */
92     U8                      Function;                   /* 03h */
93     U8                      BufferLength;               /* 04h */
94     U8                      Reserved;                   /* 05h */
95     U8                      Reserved1;                  /* 06h */
96     U8                      MsgFlags;                   /* 07h */
97     U32                     MsgContext;                 /* 08h */
98     CMD_BUFFER_DESCRIPTOR   Buffer[1];                  /* 0Ch */
99 } MSG_TARGET_CMD_BUFFER_POST_REQUEST, MPI_POINTER PTR_MSG_TARGET_CMD_BUFFER_POST_REQUEST,
100   TargetCmdBufferPostRequest_t, MPI_POINTER pTargetCmdBufferPostRequest_t;
101
102 #define CMD_BUFFER_POST_FLAGS_PORT_MASK         (0x01)
103 #define CMD_BUFFER_POST_FLAGS_ADDR_MODE_MASK    (0x80)
104 #define CMD_BUFFER_POST_FLAGS_ADDR_MODE_32      (0)
105 #define CMD_BUFFER_POST_FLAGS_ADDR_MODE_64      (1)
106 #define CMD_BUFFER_POST_FLAGS_64_BIT_ADDR       (0x80)
107
108 #define CMD_BUFFER_POST_IO_INDEX_MASK           (0x00003FFF)
109 #define CMD_BUFFER_POST_IO_INDEX_MASK_0100      (0x000003FF) /* obsolete */
110
111
112 typedef struct _MSG_TARGET_CMD_BUFFER_POST_REPLY
113 {
114     U8                      BufferPostFlags;            /* 00h */
115     U8                      BufferCount;                /* 01h */
116     U8                      MsgLength;                  /* 02h */
117     U8                      Function;                   /* 03h */
118     U8                      BufferLength;               /* 04h */
119     U8                      Reserved;                   /* 05h */
120     U8                      Reserved1;                  /* 06h */
121     U8                      MsgFlags;                   /* 07h */
122     U32                     MsgContext;                 /* 08h */
123     U16                     Reserved2;                  /* 0Ch */
124     U16                     IOCStatus;                  /* 0Eh */
125     U32                     IOCLogInfo;                 /* 10h */
126 } MSG_TARGET_CMD_BUFFER_POST_REPLY, MPI_POINTER PTR_MSG_TARGET_CMD_BUFFER_POST_REPLY,
127   TargetCmdBufferPostReply_t, MPI_POINTER pTargetCmdBufferPostReply_t;
128
129 /* the following structure is obsolete as of MPI v1.2 */
130 typedef struct _MSG_PRIORITY_CMD_RECEIVED_REPLY
131 {
132     U16                     Reserved;                   /* 00h */
133     U8                      MsgLength;                  /* 02h */
134     U8                      Function;                   /* 03h */
135     U16                     Reserved1;                  /* 04h */
136     U8                      Reserved2;                  /* 06h */
137     U8                      MsgFlags;                   /* 07h */
138     U32                     MsgContext;                 /* 08h */
139     U8                      PriorityReason;             /* 0Ch */
140     U8                      Reserved3;                  /* 0Dh */
141     U16                     IOCStatus;                  /* 0Eh */
142     U32                     IOCLogInfo;                 /* 10h */
143     U32                     ReplyWord;                  /* 14h */
144 } MSG_PRIORITY_CMD_RECEIVED_REPLY, MPI_POINTER PTR_MSG_PRIORITY_CMD_RECEIVED_REPLY,
145   PriorityCommandReceivedReply_t, MPI_POINTER pPriorityCommandReceivedReply_t;
146
147
148 typedef struct _MSG_TARGET_CMD_BUFFER_POST_ERROR_REPLY
149 {
150     U16                     Reserved;                   /* 00h */
151     U8                      MsgLength;                  /* 02h */
152     U8                      Function;                   /* 03h */
153     U16                     Reserved1;                  /* 04h */
154     U8                      Reserved2;                  /* 06h */
155     U8                      MsgFlags;                   /* 07h */
156     U32                     MsgContext;                 /* 08h */
157     U8                      PriorityReason;             /* 0Ch */
158     U8                      Reserved3;                  /* 0Dh */
159     U16                     IOCStatus;                  /* 0Eh */
160     U32                     IOCLogInfo;                 /* 10h */
161     U32                     ReplyWord;                  /* 14h */
162 } MSG_TARGET_CMD_BUFFER_POST_ERROR_REPLY,
163   MPI_POINTER PTR_MSG_TARGET_CMD_BUFFER_POST_ERROR_REPLY,
164   TargetCmdBufferPostErrorReply_t, MPI_POINTER pTargetCmdBufferPostErrorReply_t;
165
166 #define PRIORITY_REASON_NO_DISCONNECT           (0x00)
167 #define PRIORITY_REASON_SCSI_TASK_MANAGEMENT    (0x01)
168 #define PRIORITY_REASON_CMD_PARITY_ERR          (0x02)
169 #define PRIORITY_REASON_MSG_OUT_PARITY_ERR      (0x03)
170 #define PRIORITY_REASON_LQ_CRC_ERR              (0x04)
171 #define PRIORITY_REASON_CMD_CRC_ERR             (0x05)
172 #define PRIORITY_REASON_PROTOCOL_ERR            (0x06)
173 #define PRIORITY_REASON_DATA_OUT_PARITY_ERR     (0x07)
174 #define PRIORITY_REASON_DATA_OUT_CRC_ERR        (0x08)
175 #define PRIORITY_REASON_TARGET_BUSY             (0x09)
176 #define PRIORITY_REASON_UNKNOWN                 (0xFF)
177
178
179 /****************************************************************************/
180 /* Target Command Buffer Post Base Request                                  */
181 /****************************************************************************/
182
183 typedef struct _MSG_TARGET_CMD_BUF_POST_BASE_REQUEST
184 {
185     U8                      BufferPostFlags;            /* 00h */
186     U8                      PortNumber;                 /* 01h */
187     U8                      ChainOffset;                /* 02h */
188     U8                      Function;                   /* 03h */
189     U16                     TotalCmdBuffers;            /* 04h */
190     U8                      Reserved;                   /* 06h */
191     U8                      MsgFlags;                   /* 07h */
192     U32                     MsgContext;                 /* 08h */
193     U32                     Reserved1;                  /* 0Ch */
194     U16                     CmdBufferLength;            /* 10h */
195     U16                     NextCmdBufferOffset;        /* 12h */
196     U32                     BaseAddressLow;             /* 14h */
197     U32                     BaseAddressHigh;            /* 18h */
198 } MSG_TARGET_CMD_BUF_POST_BASE_REQUEST,
199   MPI_POINTER PTR__MSG_TARGET_CMD_BUF_POST_BASE_REQUEST,
200   TargetCmdBufferPostBaseRequest_t,
201   MPI_POINTER pTargetCmdBufferPostBaseRequest_t;
202
203 #define CMD_BUFFER_POST_BASE_FLAGS_AUTO_POST_ALL    (0x01)
204
205
206 typedef struct _MSG_TARGET_CMD_BUFFER_POST_BASE_LIST_REPLY
207 {
208     U16                     Reserved;                   /* 00h */
209     U8                      MsgLength;                  /* 02h */
210     U8                      Function;                   /* 03h */
211     U16                     Reserved1;                  /* 04h */
212     U8                      Reserved2;                  /* 06h */
213     U8                      MsgFlags;                   /* 07h */
214     U32                     MsgContext;                 /* 08h */
215     U16                     Reserved3;                  /* 0Ch */
216     U16                     IOCStatus;                  /* 0Eh */
217     U32                     IOCLogInfo;                 /* 10h */
218 } MSG_TARGET_CMD_BUFFER_POST_BASE_LIST_REPLY,
219   MPI_POINTER PTR_MSG_TARGET_CMD_BUFFER_POST_BASE_LIST_REPLY,
220   TargetCmdBufferPostBaseListReply_t,
221   MPI_POINTER pTargetCmdBufferPostBaseListReply_t;
222
223
224 /****************************************************************************/
225 /* Target Command Buffer Post List Request                                  */
226 /****************************************************************************/
227
228 typedef struct _MSG_TARGET_CMD_BUF_POST_LIST_REQUEST
229 {
230     U8                      Reserved;                   /* 00h */
231     U8                      PortNumber;                 /* 01h */
232     U8                      ChainOffset;                /* 02h */
233     U8                      Function;                   /* 03h */
234     U16                     CmdBufferCount;             /* 04h */
235     U8                      Reserved1;                  /* 06h */
236     U8                      MsgFlags;                   /* 07h */
237     U32                     MsgContext;                 /* 08h */
238     U32                     Reserved2;                  /* 0Ch */
239     U16                     IoIndex[2];                 /* 10h */
240 } MSG_TARGET_CMD_BUF_POST_LIST_REQUEST,
241   MPI_POINTER PTR_MSG_TARGET_CMD_BUF_POST_LIST_REQUEST,
242   TargetCmdBufferPostListRequest_t,
243   MPI_POINTER pTargetCmdBufferPostListRequest_t;
244
245
246 /****************************************************************************/
247 /* Command Buffer Formats (with 16 byte CDB)                                */
248 /****************************************************************************/
249
250 typedef struct _MPI_TARGET_FCP_CMD_BUFFER
251 {
252     U8      FcpLun[8];                                  /* 00h */
253     U8      FcpCntl[4];                                 /* 08h */
254     U8      FcpCdb[16];                                 /* 0Ch */
255     U32     FcpDl;                                      /* 1Ch */
256     U8      AliasIndex;                                 /* 20h */
257     U8      Reserved1;                                  /* 21h */
258     U16     OptionalOxid;                               /* 22h */
259 } MPI_TARGET_FCP_CMD_BUFFER, MPI_POINTER PTR_MPI_TARGET_FCP_CMD_BUFFER,
260   MpiTargetFcpCmdBuffer, MPI_POINTER pMpiTargetFcpCmdBuffer;
261
262
263 typedef struct _MPI_TARGET_SCSI_SPI_CMD_BUFFER
264 {
265     /* SPI L_Q information unit */
266     U8      L_QType;                                    /* 00h */
267     U8      Reserved;                                   /* 01h */
268     U16     Tag;                                        /* 02h */
269     U8      LogicalUnitNumber[8];                       /* 04h */
270     U32     DataLength;                                 /* 0Ch */
271     /* SPI command information unit */
272     U8      ReservedFirstByteOfCommandIU;               /* 10h */
273     U8      TaskAttribute;                              /* 11h */
274     U8      TaskManagementFlags;                        /* 12h */
275     U8      AdditionalCDBLength;                        /* 13h */
276     U8      CDB[16];                                    /* 14h */
277     /* Alias ID */
278     U8      AliasID;                                    /* 24h */
279     U8      Reserved1;                                  /* 25h */
280     U16     Reserved2;                                  /* 26h */
281 } MPI_TARGET_SCSI_SPI_CMD_BUFFER,
282   MPI_POINTER PTR_MPI_TARGET_SCSI_SPI_CMD_BUFFER,
283   MpiTargetScsiSpiCmdBuffer, MPI_POINTER pMpiTargetScsiSpiCmdBuffer;
284
285
286 typedef struct _MPI_TARGET_SSP_CMD_BUFFER
287 {
288     U8      FrameType;                                  /* 00h */
289     U8      Reserved1;                                  /* 01h */
290     U16     Reserved2;                                  /* 02h */
291     U16     InitiatorTag;                               /* 04h */
292     U16     DevHandle;                                  /* 06h */
293     /* COMMAND information unit starts here */
294     U8      LogicalUnitNumber[8];                       /* 08h */
295     U8      Reserved3;                                  /* 10h */
296     U8      TaskAttribute; /* lower 3 bits */           /* 11h */
297     U8      Reserved4;                                  /* 12h */
298     U8      AdditionalCDBLength; /* upper 5 bits */     /* 13h */
299     U8      CDB[16];                                    /* 14h */
300     /* Additional CDB bytes extend past the CDB field */
301 } MPI_TARGET_SSP_CMD_BUFFER, MPI_POINTER PTR_MPI_TARGET_SSP_CMD_BUFFER,
302   MpiTargetSspCmdBuffer, MPI_POINTER pMpiTargetSspCmdBuffer;
303
304 typedef struct _MPI_TARGET_SSP_TASK_BUFFER
305 {
306     U8      FrameType;                                  /* 00h */
307     U8      Reserved1;                                  /* 01h */
308     U16     Reserved2;                                  /* 02h */
309     U16     InitiatorTag;                               /* 04h */
310     U16     DevHandle;                                  /* 06h */
311     /* TASK information unit starts here */
312     U8      LogicalUnitNumber[8];                       /* 08h */
313     U8      Reserved3;                                  /* 10h */
314     U8      Reserved4;                                  /* 11h */
315     U8      TaskManagementFunction;                     /* 12h */
316     U8      Reserved5;                                  /* 13h */
317     U16     ManagedTaskTag;                             /* 14h */
318     U16     Reserved6;                                  /* 16h */
319     U32     Reserved7;                                  /* 18h */
320     U32     Reserved8;                                  /* 1Ch */
321     U32     Reserved9;                                  /* 20h */
322 } MPI_TARGET_SSP_TASK_BUFFER, MPI_POINTER PTR_MPI_TARGET_SSP_TASK_BUFFER,
323   MpiTargetSspTaskBuffer, MPI_POINTER pMpiTargetSspTaskBuffer;
324
325
326 /****************************************************************************/
327 /* Target Assist Request                                                    */
328 /****************************************************************************/
329
330 typedef struct _MSG_TARGET_ASSIST_REQUEST
331 {
332     U8                      StatusCode;                 /* 00h */
333     U8                      TargetAssistFlags;          /* 01h */
334     U8                      ChainOffset;                /* 02h */
335     U8                      Function;                   /* 03h */
336     U16                     QueueTag;                   /* 04h */
337     U8                      Reserved;                   /* 06h */
338     U8                      MsgFlags;                   /* 07h */
339     U32                     MsgContext;                 /* 08h */
340     U32                     ReplyWord;                  /* 0Ch */
341     U8                      LUN[8];                     /* 10h */
342     U32                     RelativeOffset;             /* 18h */
343     U32                     DataLength;                 /* 1Ch */
344     SGE_IO_UNION            SGL[1];                     /* 20h */
345 } MSG_TARGET_ASSIST_REQUEST, MPI_POINTER PTR_MSG_TARGET_ASSIST_REQUEST,
346   TargetAssistRequest_t, MPI_POINTER pTargetAssistRequest_t;
347
348 #define TARGET_ASSIST_FLAGS_DATA_DIRECTION          (0x01)
349 #define TARGET_ASSIST_FLAGS_AUTO_STATUS             (0x02)
350 #define TARGET_ASSIST_FLAGS_HIGH_PRIORITY           (0x04)
351 #define TARGET_ASSIST_FLAGS_CONFIRMED               (0x08)
352 #define TARGET_ASSIST_FLAGS_REPOST_CMD_BUFFER       (0x80)
353
354
355 typedef struct _MSG_TARGET_ERROR_REPLY
356 {
357     U16                     Reserved;                   /* 00h */
358     U8                      MsgLength;                  /* 02h */
359     U8                      Function;                   /* 03h */
360     U16                     Reserved1;                  /* 04h */
361     U8                      Reserved2;                  /* 06h */
362     U8                      MsgFlags;                   /* 07h */
363     U32                     MsgContext;                 /* 08h */
364     U8                      PriorityReason;             /* 0Ch */
365     U8                      Reserved3;                  /* 0Dh */
366     U16                     IOCStatus;                  /* 0Eh */
367     U32                     IOCLogInfo;                 /* 10h */
368     U32                     ReplyWord;                  /* 14h */
369     U32                     TransferCount;              /* 18h */
370 } MSG_TARGET_ERROR_REPLY, MPI_POINTER PTR_MSG_TARGET_ERROR_REPLY,
371   TargetErrorReply_t, MPI_POINTER pTargetErrorReply_t;
372
373
374 /****************************************************************************/
375 /* Target Assist Extended Request                                           */
376 /****************************************************************************/
377
378 typedef struct _MSG_TARGET_ASSIST_EXT_REQUEST
379 {
380     U8                      StatusCode;                     /* 00h */
381     U8                      TargetAssistFlags;              /* 01h */
382     U8                      ChainOffset;                    /* 02h */
383     U8                      Function;                       /* 03h */
384     U16                     QueueTag;                       /* 04h */
385     U8                      Reserved1;                      /* 06h */
386     U8                      MsgFlags;                       /* 07h */
387     U32                     MsgContext;                     /* 08h */
388     U32                     ReplyWord;                      /* 0Ch */
389     U8                      LUN[8];                         /* 10h */
390     U32                     RelativeOffset;                 /* 18h */
391     U32                     Reserved2;                      /* 1Ch */
392     U32                     Reserved3;                      /* 20h */
393     U32                     PrimaryReferenceTag;            /* 24h */
394     U16                     PrimaryApplicationTag;          /* 28h */
395     U16                     PrimaryApplicationTagMask;      /* 2Ah */
396     U32                     Reserved4;                      /* 2Ch */
397     U32                     DataLength;                     /* 30h */
398     U32                     BidirectionalDataLength;        /* 34h */
399     U32                     SecondaryReferenceTag;          /* 38h */
400     U16                     SecondaryApplicationTag;        /* 3Ch */
401     U16                     Reserved5;                      /* 3Eh */
402     U16                     EEDPFlags;                      /* 40h */
403     U16                     ApplicationTagTranslationMask;  /* 42h */
404     U32                     EEDPBlockSize;                  /* 44h */
405     U8                      SGLOffset0;                     /* 48h */
406     U8                      SGLOffset1;                     /* 49h */
407     U8                      SGLOffset2;                     /* 4Ah */
408     U8                      SGLOffset3;                     /* 4Bh */
409     U32                     Reserved6;                      /* 4Ch */
410     SGE_IO_UNION            SGL[1];                         /* 50h */
411 } MSG_TARGET_ASSIST_EXT_REQUEST, MPI_POINTER PTR_MSG_TARGET_ASSIST_EXT_REQUEST,
412   TargetAssistExtRequest_t, MPI_POINTER pTargetAssistExtRequest_t;
413
414 /* see the defines after MSG_TARGET_ASSIST_REQUEST for TargetAssistFlags */
415
416 /* defines for the MsgFlags field */
417 #define TARGET_ASSIST_EXT_MSGFLAGS_BIDIRECTIONAL        (0x20)
418 #define TARGET_ASSIST_EXT_MSGFLAGS_MULTICAST            (0x10)
419 #define TARGET_ASSIST_EXT_MSGFLAGS_SGL_OFFSET_CHAINS    (0x08)
420
421 /* defines for the EEDPFlags field */
422 #define TARGET_ASSIST_EXT_EEDP_MASK_OP          (0x0007)
423 #define TARGET_ASSIST_EXT_EEDP_NOOP_OP          (0x0000)
424 #define TARGET_ASSIST_EXT_EEDP_CHK_OP           (0x0001)
425 #define TARGET_ASSIST_EXT_EEDP_STRIP_OP         (0x0002)
426 #define TARGET_ASSIST_EXT_EEDP_CHKRM_OP         (0x0003)
427 #define TARGET_ASSIST_EXT_EEDP_INSERT_OP        (0x0004)
428 #define TARGET_ASSIST_EXT_EEDP_REPLACE_OP       (0x0006)
429 #define TARGET_ASSIST_EXT_EEDP_CHKREGEN_OP      (0x0007)
430
431 #define TARGET_ASSIST_EXT_EEDP_PASS_REF_TAG     (0x0008)
432
433 #define TARGET_ASSIST_EXT_EEDP_T10_CHK_MASK     (0x0700)
434 #define TARGET_ASSIST_EXT_EEDP_T10_CHK_GUARD    (0x0100)
435 #define TARGET_ASSIST_EXT_EEDP_T10_CHK_APPTAG   (0x0200)
436 #define TARGET_ASSIST_EXT_EEDP_T10_CHK_REFTAG   (0x0400)
437 #define TARGET_ASSIST_EXT_EEDP_T10_CHK_SHIFT    (8)
438
439 #define TARGET_ASSIST_EXT_EEDP_INC_SEC_APPTAG   (0x1000)
440 #define TARGET_ASSIST_EXT_EEDP_INC_PRI_APPTAG   (0x2000)
441 #define TARGET_ASSIST_EXT_EEDP_INC_SEC_REFTAG   (0x4000)
442 #define TARGET_ASSIST_EXT_EEDP_INC_PRI_REFTAG   (0x8000)
443
444
445 /****************************************************************************/
446 /* Target Status Send Request                                               */
447 /****************************************************************************/
448
449 typedef struct _MSG_TARGET_STATUS_SEND_REQUEST
450 {
451     U8                      StatusCode;                 /* 00h */
452     U8                      StatusFlags;                /* 01h */
453     U8                      ChainOffset;                /* 02h */
454     U8                      Function;                   /* 03h */
455     U16                     QueueTag;                   /* 04h */
456     U8                      Reserved;                   /* 06h */
457     U8                      MsgFlags;                   /* 07h */
458     U32                     MsgContext;                 /* 08h */
459     U32                     ReplyWord;                  /* 0Ch */
460     U8                      LUN[8];                     /* 10h */
461     SGE_SIMPLE_UNION        StatusDataSGE;              /* 18h */
462 } MSG_TARGET_STATUS_SEND_REQUEST, MPI_POINTER PTR_MSG_TARGET_STATUS_SEND_REQUEST,
463   TargetStatusSendRequest_t, MPI_POINTER pTargetStatusSendRequest_t;
464
465 #define TARGET_STATUS_SEND_FLAGS_AUTO_GOOD_STATUS   (0x01)
466 #define TARGET_STATUS_SEND_FLAGS_HIGH_PRIORITY      (0x04)
467 #define TARGET_STATUS_SEND_FLAGS_CONFIRMED          (0x08)
468 #define TARGET_STATUS_SEND_FLAGS_REPOST_CMD_BUFFER  (0x80)
469
470 /*
471  * NOTE: FCP_RSP data is big-endian. When used on a little-endian system, this
472  * structure properly orders the bytes.
473  */
474 typedef struct _MPI_TARGET_FCP_RSP_BUFFER
475 {
476     U8      Reserved0[8];                               /* 00h */
477     U8      Reserved1[2];                               /* 08h */
478     U8      FcpFlags;                                   /* 0Ah */
479     U8      FcpStatus;                                  /* 0Bh */
480     U32     FcpResid;                                   /* 0Ch */
481     U32     FcpSenseLength;                             /* 10h */
482     U32     FcpResponseLength;                          /* 14h */
483     U8      FcpResponseData[8];                         /* 18h */
484     U8      FcpSenseData[32]; /* Pad to 64 bytes */     /* 20h */
485 } MPI_TARGET_FCP_RSP_BUFFER, MPI_POINTER PTR_MPI_TARGET_FCP_RSP_BUFFER,
486   MpiTargetFcpRspBuffer, MPI_POINTER pMpiTargetFcpRspBuffer;
487
488 /*
489  * NOTE: The SPI status IU is big-endian. When used on a little-endian system,
490  * this structure properly orders the bytes.
491  */
492 typedef struct _MPI_TARGET_SCSI_SPI_STATUS_IU
493 {
494     U8      Reserved0;                                  /* 00h */
495     U8      Reserved1;                                  /* 01h */
496     U8      Valid;                                      /* 02h */
497     U8      Status;                                     /* 03h */
498     U32     SenseDataListLength;                        /* 04h */
499     U32     PktFailuresListLength;                      /* 08h */
500     U8      SenseData[52]; /* Pad the IU to 64 bytes */ /* 0Ch */
501 } MPI_TARGET_SCSI_SPI_STATUS_IU, MPI_POINTER PTR_MPI_TARGET_SCSI_SPI_STATUS_IU,
502   TargetScsiSpiStatusIU_t, MPI_POINTER pTargetScsiSpiStatusIU_t;
503
504 /*
505  * NOTE: The SSP status IU is big-endian. When used on a little-endian system,
506  * this structure properly orders the bytes.
507  */
508 typedef struct _MPI_TARGET_SSP_RSP_IU
509 {
510     U32     Reserved0[6]; /* reserved for SSP header */ /* 00h */
511     /* start of RESPONSE information unit */
512     U32     Reserved1;                                  /* 18h */
513     U32     Reserved2;                                  /* 1Ch */
514     U16     Reserved3;                                  /* 20h */
515     U8      DataPres; /* lower 2 bits */                /* 22h */
516     U8      Status;                                     /* 23h */
517     U32     Reserved4;                                  /* 24h */
518     U32     SenseDataLength;                            /* 28h */
519     U32     ResponseDataLength;                         /* 2Ch */
520     U8      ResponseSenseData[4];                       /* 30h */
521 } MPI_TARGET_SSP_RSP_IU, MPI_POINTER PTR_MPI_TARGET_SSP_RSP_IU,
522   MpiTargetSspRspIu_t, MPI_POINTER pMpiTargetSspRspIu_t;
523
524
525 /****************************************************************************/
526 /* Target Mode Abort Request                                                */
527 /****************************************************************************/
528
529 typedef struct _MSG_TARGET_MODE_ABORT_REQUEST
530 {
531     U8                      AbortType;                  /* 00h */
532     U8                      Reserved;                   /* 01h */
533     U8                      ChainOffset;                /* 02h */
534     U8                      Function;                   /* 03h */
535     U16                     Reserved1;                  /* 04h */
536     U8                      Reserved2;                  /* 06h */
537     U8                      MsgFlags;                   /* 07h */
538     U32                     MsgContext;                 /* 08h */
539     U32                     ReplyWord;                  /* 0Ch */
540     U32                     MsgContextToAbort;          /* 10h */
541 } MSG_TARGET_MODE_ABORT, MPI_POINTER PTR_MSG_TARGET_MODE_ABORT,
542   TargetModeAbort_t, MPI_POINTER pTargetModeAbort_t;
543
544 #define TARGET_MODE_ABORT_TYPE_ALL_CMD_BUFFERS      (0x00)
545 #define TARGET_MODE_ABORT_TYPE_ALL_IO               (0x01)
546 #define TARGET_MODE_ABORT_TYPE_EXACT_IO             (0x02)
547 #define TARGET_MODE_ABORT_TYPE_EXACT_IO_REQUEST     (0x03)
548
549 /* Target Mode Abort Reply */
550
551 typedef struct _MSG_TARGET_MODE_ABORT_REPLY
552 {
553     U16                     Reserved;                   /* 00h */
554     U8                      MsgLength;                  /* 02h */
555     U8                      Function;                   /* 03h */
556     U16                     Reserved1;                  /* 04h */
557     U8                      Reserved2;                  /* 06h */
558     U8                      MsgFlags;                   /* 07h */
559     U32                     MsgContext;                 /* 08h */
560     U16                     Reserved3;                  /* 0Ch */
561     U16                     IOCStatus;                  /* 0Eh */
562     U32                     IOCLogInfo;                 /* 10h */
563     U32                     AbortCount;                 /* 14h */
564 } MSG_TARGET_MODE_ABORT_REPLY, MPI_POINTER PTR_MSG_TARGET_MODE_ABORT_REPLY,
565   TargetModeAbortReply_t, MPI_POINTER pTargetModeAbortReply_t;
566
567
568 /****************************************************************************/
569 /* Target Mode Context Reply                                                */
570 /****************************************************************************/
571
572 #define TARGET_MODE_REPLY_IO_INDEX_MASK         (0x00003FFF)
573 #define TARGET_MODE_REPLY_IO_INDEX_SHIFT        (0)
574 #define TARGET_MODE_REPLY_INITIATOR_INDEX_MASK  (0x03FFC000)
575 #define TARGET_MODE_REPLY_INITIATOR_INDEX_SHIFT (14)
576 #define TARGET_MODE_REPLY_ALIAS_MASK            (0x04000000)
577 #define TARGET_MODE_REPLY_ALIAS_SHIFT           (26)
578 #define TARGET_MODE_REPLY_PORT_MASK             (0x10000000)
579 #define TARGET_MODE_REPLY_PORT_SHIFT            (28)
580
581
582 #define GET_IO_INDEX(x)     (((x) & TARGET_MODE_REPLY_IO_INDEX_MASK)           \
583                                     >> TARGET_MODE_REPLY_IO_INDEX_SHIFT)
584
585 #define SET_IO_INDEX(t, i)                                                     \
586             ((t) = ((t) & ~TARGET_MODE_REPLY_IO_INDEX_MASK) |                  \
587                               (((i) << TARGET_MODE_REPLY_IO_INDEX_SHIFT) &     \
588                                              TARGET_MODE_REPLY_IO_INDEX_MASK))
589
590 #define GET_INITIATOR_INDEX(x) (((x) & TARGET_MODE_REPLY_INITIATOR_INDEX_MASK) \
591                                    >> TARGET_MODE_REPLY_INITIATOR_INDEX_SHIFT)
592
593 #define SET_INITIATOR_INDEX(t, ii)                                             \
594         ((t) = ((t) & ~TARGET_MODE_REPLY_INITIATOR_INDEX_MASK) |               \
595                         (((ii) << TARGET_MODE_REPLY_INITIATOR_INDEX_SHIFT) &   \
596                                       TARGET_MODE_REPLY_INITIATOR_INDEX_MASK))
597
598 #define GET_ALIAS(x) (((x) & TARGET_MODE_REPLY_ALIAS_MASK)                     \
599                                                >> TARGET_MODE_REPLY_ALIAS_SHIFT)
600
601 #define SET_ALIAS(t, a)  ((t) = ((t) & ~TARGET_MODE_REPLY_ALIAS_MASK) |        \
602                                     (((a) << TARGET_MODE_REPLY_ALIAS_SHIFT) &  \
603                                                  TARGET_MODE_REPLY_ALIAS_MASK))
604
605 #define GET_PORT(x) (((x) & TARGET_MODE_REPLY_PORT_MASK)                       \
606                                                >> TARGET_MODE_REPLY_PORT_SHIFT)
607
608 #define SET_PORT(t, p)  ((t) = ((t) & ~TARGET_MODE_REPLY_PORT_MASK) |          \
609                                     (((p) << TARGET_MODE_REPLY_PORT_SHIFT) &   \
610                                                   TARGET_MODE_REPLY_PORT_MASK))
611
612 /* the following obsolete values are for MPI v1.0 support */
613 #define TARGET_MODE_REPLY_0100_MASK_HOST_INDEX       (0x000003FF)
614 #define TARGET_MODE_REPLY_0100_SHIFT_HOST_INDEX      (0)
615 #define TARGET_MODE_REPLY_0100_MASK_IOC_INDEX        (0x001FF800)
616 #define TARGET_MODE_REPLY_0100_SHIFT_IOC_INDEX       (11)
617 #define TARGET_MODE_REPLY_0100_PORT_MASK             (0x00400000)
618 #define TARGET_MODE_REPLY_0100_PORT_SHIFT            (22)
619 #define TARGET_MODE_REPLY_0100_MASK_INITIATOR_INDEX  (0x1F800000)
620 #define TARGET_MODE_REPLY_0100_SHIFT_INITIATOR_INDEX (23)
621
622 #define GET_HOST_INDEX_0100(x) (((x) & TARGET_MODE_REPLY_0100_MASK_HOST_INDEX) \
623                                   >> TARGET_MODE_REPLY_0100_SHIFT_HOST_INDEX)
624
625 #define SET_HOST_INDEX_0100(t, hi)                                             \
626             ((t) = ((t) & ~TARGET_MODE_REPLY_0100_MASK_HOST_INDEX) |           \
627                          (((hi) << TARGET_MODE_REPLY_0100_SHIFT_HOST_INDEX) &  \
628                                       TARGET_MODE_REPLY_0100_MASK_HOST_INDEX))
629
630 #define GET_IOC_INDEX_0100(x)   (((x) & TARGET_MODE_REPLY_0100_MASK_IOC_INDEX) \
631                                   >> TARGET_MODE_REPLY_0100_SHIFT_IOC_INDEX)
632
633 #define SET_IOC_INDEX_0100(t, ii)                                              \
634             ((t) = ((t) & ~TARGET_MODE_REPLY_0100_MASK_IOC_INDEX) |            \
635                         (((ii) << TARGET_MODE_REPLY_0100_SHIFT_IOC_INDEX) &    \
636                                      TARGET_MODE_REPLY_0100_MASK_IOC_INDEX))
637
638 #define GET_INITIATOR_INDEX_0100(x)                                            \
639             (((x) & TARGET_MODE_REPLY_0100_MASK_INITIATOR_INDEX)               \
640                               >> TARGET_MODE_REPLY_0100_SHIFT_INITIATOR_INDEX)
641
642 #define SET_INITIATOR_INDEX_0100(t, ii)                                        \
643         ((t) = ((t) & ~TARGET_MODE_REPLY_0100_MASK_INITIATOR_INDEX) |          \
644                    (((ii) << TARGET_MODE_REPLY_0100_SHIFT_INITIATOR_INDEX) &   \
645                                 TARGET_MODE_REPLY_0100_MASK_INITIATOR_INDEX))
646
647
648 #endif
649