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