xref: /freebsd/sys/dev/mpt/mpilib/mpi_targ.h (revision 262e143bd46171a6415a5b28af260a5efa2a3db8)
1 /* $FreeBSD$ */
2 /*-
3  * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
12  *    substantially similar to the "NO WARRANTY" disclaimer below
13  *    ("Disclaimer") and any redistribution must be conditioned upon including
14  *    a substantially similar Disclaimer requirement for further binary
15  *    redistribution.
16  * 3. Neither the name of the LSI Logic Corporation nor the names of its
17  *    contributors may be used to endorse or promote products derived from
18  *    this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT
30  * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  *
33  *           Name:  MPI_TARG.H
34  *          Title:  MPI Target mode messages and structures
35  *  Creation Date:  June 22, 2000
36  *
37  *    MPI_TARG.H Version:  01.02.09
38  *
39  *  Version History
40  *  ---------------
41  *
42  *  Date      Version   Description
43  *  --------  --------  ------------------------------------------------------
44  *  05-08-00  00.10.01  Original release for 0.10 spec dated 4/26/2000.
45  *  06-06-00  01.00.01  Update version number for 1.0 release.
46  *  06-22-00  01.00.02  Added _MSG_TARGET_CMD_BUFFER_POST_REPLY structure.
47  *                      Corrected DECSRIPTOR typo to DESCRIPTOR.
48  *  11-02-00  01.01.01  Original release for post 1.0 work
49  *                      Modified target mode to use IoIndex instead of
50  *                      HostIndex and IocIndex. Added Alias.
51  *  01-09-01  01.01.02  Added defines for TARGET_ASSIST_FLAGS_REPOST_CMD_BUFFER
52  *                      and TARGET_STATUS_SEND_FLAGS_REPOST_CMD_BUFFER.
53  *  02-20-01  01.01.03  Started using MPI_POINTER.
54  *                      Added structures for MPI_TARGET_SCSI_SPI_CMD_BUFFER and
55  *                      MPI_TARGET_FCP_CMD_BUFFER.
56  *  03-27-01  01.01.04  Added structure offset comments.
57  *  08-08-01  01.02.01  Original release for v1.2 work.
58  *  09-28-01  01.02.02  Added structure for MPI_TARGET_SCSI_SPI_STATUS_IU.
59  *                      Added PriorityReason field to some replies and
60  *                      defined more PriorityReason codes.
61  *                      Added some defines for to support previous version
62  *                      of MPI.
63  *  10-04-01  01.02.03  Added PriorityReason to MSG_TARGET_ERROR_REPLY.
64  *  11-01-01  01.02.04  Added define for TARGET_STATUS_SEND_FLAGS_HIGH_PRIORITY.
65  *  03-14-02  01.02.05  Modified MPI_TARGET_FCP_RSP_BUFFER to get the proper
66  *                      byte ordering.
67  *  05-31-02  01.02.06  Modified TARGET_MODE_REPLY_ALIAS_MASK to only include
68  *                      one bit.
69  *                      Added AliasIndex field to MPI_TARGET_FCP_CMD_BUFFER.
70  *  09-16-02  01.02.07  Added flags for confirmed completion.
71  *                      Added PRIORITY_REASON_TARGET_BUSY.
72  *  11-15-02  01.02.08  Added AliasID field to MPI_TARGET_SCSI_SPI_CMD_BUFFER.
73  *  04-01-03  01.02.09  Added OptionalOxid field to MPI_TARGET_FCP_CMD_BUFFER.
74  *  --------------------------------------------------------------------------
75  */
76 
77 #ifndef MPI_TARG_H
78 #define MPI_TARG_H
79 
80 
81 /******************************************************************************
82 *
83 *        S C S I    T a r g e t    M e s s a g e s
84 *
85 *******************************************************************************/
86 
87 typedef struct _CMD_BUFFER_DESCRIPTOR
88 {
89     U16                     IoIndex;                    /* 00h */
90     U16                     Reserved;                   /* 02h */
91     union                                               /* 04h */
92     {
93         U32                 PhysicalAddress32;
94         U64                 PhysicalAddress64;
95     } u;
96 } CMD_BUFFER_DESCRIPTOR, MPI_POINTER PTR_CMD_BUFFER_DESCRIPTOR,
97   CmdBufferDescriptor_t, MPI_POINTER pCmdBufferDescriptor_t;
98 
99 
100 /****************************************************************************/
101 /* Target Command Buffer Post Request                                       */
102 /****************************************************************************/
103 
104 typedef struct _MSG_TARGET_CMD_BUFFER_POST_REQUEST
105 {
106     U8                      BufferPostFlags;            /* 00h */
107     U8                      BufferCount;                /* 01h */
108     U8                      ChainOffset;                /* 02h */
109     U8                      Function;                   /* 03h */
110     U8                      BufferLength;               /* 04h */
111     U8                      Reserved;                   /* 05h */
112     U8                      Reserved1;                  /* 06h */
113     U8                      MsgFlags;                   /* 07h */
114     U32                     MsgContext;                 /* 08h */
115     CMD_BUFFER_DESCRIPTOR   Buffer[1];                  /* 0Ch */
116 } MSG_TARGET_CMD_BUFFER_POST_REQUEST, MPI_POINTER PTR_MSG_TARGET_CMD_BUFFER_POST_REQUEST,
117   TargetCmdBufferPostRequest_t, MPI_POINTER pTargetCmdBufferPostRequest_t;
118 
119 #define CMD_BUFFER_POST_FLAGS_PORT_MASK         (0x01)
120 #define CMD_BUFFER_POST_FLAGS_ADDR_MODE_MASK    (0x80)
121 #define CMD_BUFFER_POST_FLAGS_ADDR_MODE_32      (0)
122 #define CMD_BUFFER_POST_FLAGS_ADDR_MODE_64      (1)
123 #define CMD_BUFFER_POST_FLAGS_64_BIT_ADDR       (0x80)
124 
125 #define CMD_BUFFER_POST_IO_INDEX_MASK           (0x00003FFF)
126 #define CMD_BUFFER_POST_IO_INDEX_MASK_0100      (0x000003FF) /* obsolete */
127 
128 
129 typedef struct _MSG_TARGET_CMD_BUFFER_POST_REPLY
130 {
131     U8                      BufferPostFlags;            /* 00h */
132     U8                      BufferCount;                /* 01h */
133     U8                      MsgLength;                  /* 02h */
134     U8                      Function;                   /* 03h */
135     U8                      BufferLength;               /* 04h */
136     U8                      Reserved;                   /* 05h */
137     U8                      Reserved1;                  /* 06h */
138     U8                      MsgFlags;                   /* 07h */
139     U32                     MsgContext;                 /* 08h */
140     U16                     Reserved2;                  /* 0Ch */
141     U16                     IOCStatus;                  /* 0Eh */
142     U32                     IOCLogInfo;                 /* 10h */
143 } MSG_TARGET_CMD_BUFFER_POST_REPLY, MPI_POINTER PTR_MSG_TARGET_CMD_BUFFER_POST_REPLY,
144   TargetCmdBufferPostReply_t, MPI_POINTER pTargetCmdBufferPostReply_t;
145 
146 /* the following structure is obsolete as of MPI v1.2 */
147 typedef struct _MSG_PRIORITY_CMD_RECEIVED_REPLY
148 {
149     U16                     Reserved;                   /* 00h */
150     U8                      MsgLength;                  /* 02h */
151     U8                      Function;                   /* 03h */
152     U16                     Reserved1;                  /* 04h */
153     U8                      Reserved2;                  /* 06h */
154     U8                      MsgFlags;                   /* 07h */
155     U32                     MsgContext;                 /* 08h */
156     U8                      PriorityReason;             /* 0Ch */
157     U8                      Reserved3;                  /* 0Dh */
158     U16                     IOCStatus;                  /* 0Eh */
159     U32                     IOCLogInfo;                 /* 10h */
160     U32                     ReplyWord;                  /* 14h */
161 } MSG_PRIORITY_CMD_RECEIVED_REPLY, MPI_POINTER PTR_MSG_PRIORITY_CMD_RECEIVED_REPLY,
162   PriorityCommandReceivedReply_t, MPI_POINTER pPriorityCommandReceivedReply_t;
163 
164 #define PRIORITY_REASON_NO_DISCONNECT           (0x00)
165 #define PRIORITY_REASON_SCSI_TASK_MANAGEMENT    (0x01)
166 #define PRIORITY_REASON_CMD_PARITY_ERR          (0x02)
167 #define PRIORITY_REASON_MSG_OUT_PARITY_ERR      (0x03)
168 #define PRIORITY_REASON_LQ_CRC_ERR              (0x04)
169 #define PRIORITY_REASON_CMD_CRC_ERR             (0x05)
170 #define PRIORITY_REASON_PROTOCOL_ERR            (0x06)
171 #define PRIORITY_REASON_DATA_OUT_PARITY_ERR     (0x07)
172 #define PRIORITY_REASON_DATA_OUT_CRC_ERR        (0x08)
173 #define PRIORITY_REASON_TARGET_BUSY             (0x09)
174 #define PRIORITY_REASON_UNKNOWN                 (0xFF)
175 
176 
177 typedef struct _MSG_TARGET_CMD_BUFFER_POST_ERROR_REPLY
178 {
179     U16                     Reserved;                   /* 00h */
180     U8                      MsgLength;                  /* 02h */
181     U8                      Function;                   /* 03h */
182     U16                     Reserved1;                  /* 04h */
183     U8                      Reserved2;                  /* 06h */
184     U8                      MsgFlags;                   /* 07h */
185     U32                     MsgContext;                 /* 08h */
186     U8                      PriorityReason;             /* 0Ch */
187     U8                      Reserved3;                  /* 0Dh */
188     U16                     IOCStatus;                  /* 0Eh */
189     U32                     IOCLogInfo;                 /* 10h */
190     U32                     ReplyWord;                  /* 14h */
191 } MSG_TARGET_CMD_BUFFER_POST_ERROR_REPLY,
192   MPI_POINTER PTR_MSG_TARGET_CMD_BUFFER_POST_ERROR_REPLY,
193   TargetCmdBufferPostErrorReply_t, MPI_POINTER pTargetCmdBufferPostErrorReply_t;
194 
195 
196 typedef struct _MPI_TARGET_FCP_CMD_BUFFER
197 {
198     U8      FcpLun[8];                                  /* 00h */
199     U8      FcpCntl[4];                                 /* 08h */
200     U8      FcpCdb[16];                                 /* 0Ch */
201     U32     FcpDl;                                      /* 1Ch */
202     U8      AliasIndex;                                 /* 20h */
203     U8      Reserved1;                                  /* 21h */
204     U16     OptionalOxid;                               /* 22h */
205 } MPI_TARGET_FCP_CMD_BUFFER, MPI_POINTER PTR_MPI_TARGET_FCP_CMD_BUFFER,
206   MpiTargetFcpCmdBuffer, MPI_POINTER pMpiTargetFcpCmdBuffer;
207 
208 
209 typedef struct _MPI_TARGET_SCSI_SPI_CMD_BUFFER
210 {
211     /* SPI L_Q information unit */
212     U8      L_QType;                                    /* 00h */
213     U8      Reserved;                                   /* 01h */
214     U16     Tag;                                        /* 02h */
215     U8      LogicalUnitNumber[8];                       /* 04h */
216     U32     DataLength;                                 /* 0Ch */
217     /* SPI command information unit */
218     U8      ReservedFirstByteOfCommandIU;               /* 10h */
219     U8      TaskAttribute;                              /* 11h */
220     U8      TaskManagementFlags;                        /* 12h */
221     U8      AdditionalCDBLength;                        /* 13h */
222     U8      CDB[16];                                    /* 14h */
223     /* Alias ID */
224     U8      AliasID;                                    /* 24h */
225     U8      Reserved1;                                  /* 25h */
226     U16     Reserved2;                                  /* 26h */
227 } MPI_TARGET_SCSI_SPI_CMD_BUFFER,
228   MPI_POINTER PTR_MPI_TARGET_SCSI_SPI_CMD_BUFFER,
229   MpiTargetScsiSpiCmdBuffer, MPI_POINTER pMpiTargetScsiSpiCmdBuffer;
230 
231 
232 /****************************************************************************/
233 /* Target Assist Request                                                    */
234 /****************************************************************************/
235 
236 typedef struct _MSG_TARGET_ASSIST_REQUEST
237 {
238     U8                      StatusCode;                 /* 00h */
239     U8                      TargetAssistFlags;          /* 01h */
240     U8                      ChainOffset;                /* 02h */
241     U8                      Function;                   /* 03h */
242     U16                     QueueTag;                   /* 04h */
243     U8                      Reserved;                   /* 06h */
244     U8                      MsgFlags;                   /* 07h */
245     U32                     MsgContext;                 /* 08h */
246     U32                     ReplyWord;                  /* 0Ch */
247     U8                      LUN[8];                     /* 10h */
248     U32                     RelativeOffset;             /* 18h */
249     U32                     DataLength;                 /* 1Ch */
250     SGE_IO_UNION            SGL[1];                     /* 20h */
251 } MSG_TARGET_ASSIST_REQUEST, MPI_POINTER PTR_MSG_TARGET_ASSIST_REQUEST,
252   TargetAssistRequest_t, MPI_POINTER pTargetAssistRequest_t;
253 
254 #define TARGET_ASSIST_FLAGS_DATA_DIRECTION          (0x01)
255 #define TARGET_ASSIST_FLAGS_AUTO_STATUS             (0x02)
256 #define TARGET_ASSIST_FLAGS_HIGH_PRIORITY           (0x04)
257 #define TARGET_ASSIST_FLAGS_CONFIRMED               (0x08)
258 #define TARGET_ASSIST_FLAGS_REPOST_CMD_BUFFER       (0x80)
259 
260 
261 typedef struct _MSG_TARGET_ERROR_REPLY
262 {
263     U16                     Reserved;                   /* 00h */
264     U8                      MsgLength;                  /* 02h */
265     U8                      Function;                   /* 03h */
266     U16                     Reserved1;                  /* 04h */
267     U8                      Reserved2;                  /* 06h */
268     U8                      MsgFlags;                   /* 07h */
269     U32                     MsgContext;                 /* 08h */
270     U8                      PriorityReason;             /* 0Ch */
271     U8                      Reserved3;                  /* 0Dh */
272     U16                     IOCStatus;                  /* 0Eh */
273     U32                     IOCLogInfo;                 /* 10h */
274     U32                     ReplyWord;                  /* 14h */
275     U32                     TransferCount;              /* 18h */
276 } MSG_TARGET_ERROR_REPLY, MPI_POINTER PTR_MSG_TARGET_ERROR_REPLY,
277   TargetErrorReply_t, MPI_POINTER pTargetErrorReply_t;
278 
279 
280 /****************************************************************************/
281 /* Target Status Send Request                                               */
282 /****************************************************************************/
283 
284 typedef struct _MSG_TARGET_STATUS_SEND_REQUEST
285 {
286     U8                      StatusCode;                 /* 00h */
287     U8                      StatusFlags;                /* 01h */
288     U8                      ChainOffset;                /* 02h */
289     U8                      Function;                   /* 03h */
290     U16                     QueueTag;                   /* 04h */
291     U8                      Reserved;                   /* 06h */
292     U8                      MsgFlags;                   /* 07h */
293     U32                     MsgContext;                 /* 08h */
294     U32                     ReplyWord;                  /* 0Ch */
295     U8                      LUN[8];                     /* 10h */
296     SGE_SIMPLE_UNION        StatusDataSGE;              /* 18h */
297 } MSG_TARGET_STATUS_SEND_REQUEST, MPI_POINTER PTR_MSG_TARGET_STATUS_SEND_REQUEST,
298   TargetStatusSendRequest_t, MPI_POINTER pTargetStatusSendRequest_t;
299 
300 #define TARGET_STATUS_SEND_FLAGS_AUTO_GOOD_STATUS   (0x01)
301 #define TARGET_STATUS_SEND_FLAGS_HIGH_PRIORITY      (0x04)
302 #define TARGET_STATUS_SEND_FLAGS_CONFIRMED          (0x08)
303 #define TARGET_STATUS_SEND_FLAGS_REPOST_CMD_BUFFER  (0x80)
304 
305 /*
306  * NOTE: FCP_RSP data is big-endian. When used on a little-endian system, this
307  * structure properly orders the bytes.
308  */
309 typedef struct _MPI_TARGET_FCP_RSP_BUFFER
310 {
311     U8      Reserved0[8];                               /* 00h */
312     U8      Reserved1[2];                               /* 08h */
313     U8      FcpFlags;                                   /* 0Ah */
314     U8      FcpStatus;                                  /* 0Bh */
315     U32     FcpResid;                                   /* 0Ch */
316     U32     FcpSenseLength;                             /* 10h */
317     U32     FcpResponseLength;                          /* 14h */
318     U8      FcpResponseData[8];                         /* 18h */
319     U8      FcpSenseData[32]; /* Pad to 64 bytes */     /* 20h */
320 } MPI_TARGET_FCP_RSP_BUFFER, MPI_POINTER PTR_MPI_TARGET_FCP_RSP_BUFFER,
321   MpiTargetFcpRspBuffer, MPI_POINTER pMpiTargetFcpRspBuffer;
322 
323 /*
324  * NOTE: The SPI status IU is big-endian. When used on a little-endian system,
325  * this structure properly orders the bytes.
326  */
327 typedef struct _MPI_TARGET_SCSI_SPI_STATUS_IU
328 {
329     U8      Reserved0;                                  /* 00h */
330     U8      Reserved1;                                  /* 01h */
331     U8      Valid;                                      /* 02h */
332     U8      Status;                                     /* 03h */
333     U32     SenseDataListLength;                        /* 04h */
334     U32     PktFailuresListLength;                      /* 08h */
335     U8      SenseData[52]; /* Pad the IU to 64 bytes */ /* 0Ch */
336 } MPI_TARGET_SCSI_SPI_STATUS_IU, MPI_POINTER PTR_MPI_TARGET_SCSI_SPI_STATUS_IU,
337   TargetScsiSpiStatusIU_t, MPI_POINTER pTargetScsiSpiStatusIU_t;
338 
339 /****************************************************************************/
340 /* Target Mode Abort Request                                                */
341 /****************************************************************************/
342 
343 typedef struct _MSG_TARGET_MODE_ABORT_REQUEST
344 {
345     U8                      AbortType;                  /* 00h */
346     U8                      Reserved;                   /* 01h */
347     U8                      ChainOffset;                /* 02h */
348     U8                      Function;                   /* 03h */
349     U16                     Reserved1;                  /* 04h */
350     U8                      Reserved2;                  /* 06h */
351     U8                      MsgFlags;                   /* 07h */
352     U32                     MsgContext;                 /* 08h */
353     U32                     ReplyWord;                  /* 0Ch */
354     U32                     MsgContextToAbort;          /* 10h */
355 } MSG_TARGET_MODE_ABORT, MPI_POINTER PTR_MSG_TARGET_MODE_ABORT,
356   TargetModeAbort_t, MPI_POINTER pTargetModeAbort_t;
357 
358 #define TARGET_MODE_ABORT_TYPE_ALL_CMD_BUFFERS      (0x00)
359 #define TARGET_MODE_ABORT_TYPE_ALL_IO               (0x01)
360 #define TARGET_MODE_ABORT_TYPE_EXACT_IO             (0x02)
361 #define TARGET_MODE_ABORT_TYPE_EXACT_IO_REQUEST     (0x03)
362 
363 /* Target Mode Abort Reply */
364 
365 typedef struct _MSG_TARGET_MODE_ABORT_REPLY
366 {
367     U16                     Reserved;                   /* 00h */
368     U8                      MsgLength;                  /* 02h */
369     U8                      Function;                   /* 03h */
370     U16                     Reserved1;                  /* 04h */
371     U8                      Reserved2;                  /* 06h */
372     U8                      MsgFlags;                   /* 07h */
373     U32                     MsgContext;                 /* 08h */
374     U16                     Reserved3;                  /* 0Ch */
375     U16                     IOCStatus;                  /* 0Eh */
376     U32                     IOCLogInfo;                 /* 10h */
377     U32                     AbortCount;                 /* 14h */
378 } MSG_TARGET_MODE_ABORT_REPLY, MPI_POINTER PTR_MSG_TARGET_MODE_ABORT_REPLY,
379   TargetModeAbortReply_t, MPI_POINTER pTargetModeAbortReply_t;
380 
381 
382 /****************************************************************************/
383 /* Target Mode Context Reply                                                */
384 /****************************************************************************/
385 
386 #define TARGET_MODE_REPLY_IO_INDEX_MASK         (0x00003FFF)
387 #define TARGET_MODE_REPLY_IO_INDEX_SHIFT        (0)
388 #define TARGET_MODE_REPLY_INITIATOR_INDEX_MASK  (0x03FFC000)
389 #define TARGET_MODE_REPLY_INITIATOR_INDEX_SHIFT (14)
390 #define TARGET_MODE_REPLY_ALIAS_MASK            (0x04000000)
391 #define TARGET_MODE_REPLY_ALIAS_SHIFT           (26)
392 #define TARGET_MODE_REPLY_PORT_MASK             (0x10000000)
393 #define TARGET_MODE_REPLY_PORT_SHIFT            (28)
394 
395 
396 #define GET_IO_INDEX(x)     (((x) & TARGET_MODE_REPLY_IO_INDEX_MASK)           \
397                                     >> TARGET_MODE_REPLY_IO_INDEX_SHIFT)
398 
399 #define SET_IO_INDEX(t, i)                                                     \
400             ((t) = ((t) & ~TARGET_MODE_REPLY_IO_INDEX_MASK) |                  \
401                               (((i) << TARGET_MODE_REPLY_IO_INDEX_SHIFT) &     \
402                                              TARGET_MODE_REPLY_IO_INDEX_MASK))
403 
404 #define GET_INITIATOR_INDEX(x) (((x) & TARGET_MODE_REPLY_INITIATOR_INDEX_MASK) \
405                                    >> TARGET_MODE_REPLY_INITIATOR_INDEX_SHIFT)
406 
407 #define SET_INITIATOR_INDEX(t, ii)                                             \
408         ((t) = ((t) & ~TARGET_MODE_REPLY_INITIATOR_INDEX_MASK) |               \
409                         (((ii) << TARGET_MODE_REPLY_INITIATOR_INDEX_SHIFT) &   \
410                                       TARGET_MODE_REPLY_INITIATOR_INDEX_MASK))
411 
412 #define GET_ALIAS(x) (((x) & TARGET_MODE_REPLY_ALIAS_MASK)                     \
413                                                >> TARGET_MODE_REPLY_ALIAS_SHIFT)
414 
415 #define SET_ALIAS(t, a)  ((t) = ((t) & ~TARGET_MODE_REPLY_ALIAS_MASK) |        \
416                                     (((a) << TARGET_MODE_REPLY_ALIAS_SHIFT) &  \
417                                                  TARGET_MODE_REPLY_ALIAS_MASK))
418 
419 #define GET_PORT(x) (((x) & TARGET_MODE_REPLY_PORT_MASK)                       \
420                                                >> TARGET_MODE_REPLY_PORT_SHIFT)
421 
422 #define SET_PORT(t, p)  ((t) = ((t) & ~TARGET_MODE_REPLY_PORT_MASK) |          \
423                                     (((p) << TARGET_MODE_REPLY_PORT_SHIFT) &   \
424                                                   TARGET_MODE_REPLY_PORT_MASK))
425 
426 /* the following obsolete values are for MPI v1.0 support */
427 #define TARGET_MODE_REPLY_0100_MASK_HOST_INDEX       (0x000003FF)
428 #define TARGET_MODE_REPLY_0100_SHIFT_HOST_INDEX      (0)
429 #define TARGET_MODE_REPLY_0100_MASK_IOC_INDEX        (0x001FF800)
430 #define TARGET_MODE_REPLY_0100_SHIFT_IOC_INDEX       (11)
431 #define TARGET_MODE_REPLY_0100_PORT_MASK             (0x00400000)
432 #define TARGET_MODE_REPLY_0100_PORT_SHIFT            (22)
433 #define TARGET_MODE_REPLY_0100_MASK_INITIATOR_INDEX  (0x1F800000)
434 #define TARGET_MODE_REPLY_0100_SHIFT_INITIATOR_INDEX (23)
435 
436 #define GET_HOST_INDEX_0100(x) (((x) & TARGET_MODE_REPLY_0100_MASK_HOST_INDEX) \
437                                   >> TARGET_MODE_REPLY_0100_SHIFT_HOST_INDEX)
438 
439 #define SET_HOST_INDEX_0100(t, hi)                                             \
440             ((t) = ((t) & ~TARGET_MODE_REPLY_0100_MASK_HOST_INDEX) |           \
441                          (((hi) << TARGET_MODE_REPLY_0100_SHIFT_HOST_INDEX) &  \
442                                       TARGET_MODE_REPLY_0100_MASK_HOST_INDEX))
443 
444 #define GET_IOC_INDEX_0100(x)   (((x) & TARGET_MODE_REPLY_0100_MASK_IOC_INDEX) \
445                                   >> TARGET_MODE_REPLY_0100_SHIFT_IOC_INDEX)
446 
447 #define SET_IOC_INDEX_0100(t, ii)                                              \
448             ((t) = ((t) & ~TARGET_MODE_REPLY_0100_MASK_IOC_INDEX) |            \
449                         (((ii) << TARGET_MODE_REPLY_0100_SHIFT_IOC_INDEX) &    \
450                                      TARGET_MODE_REPLY_0100_MASK_IOC_INDEX))
451 
452 #define GET_INITIATOR_INDEX_0100(x)                                            \
453             (((x) & TARGET_MODE_REPLY_0100_MASK_INITIATOR_INDEX)               \
454                               >> TARGET_MODE_REPLY_0100_SHIFT_INITIATOR_INDEX)
455 
456 #define SET_INITIATOR_INDEX_0100(t, ii)                                        \
457         ((t) = ((t) & ~TARGET_MODE_REPLY_0100_MASK_INITIATOR_INDEX) |          \
458                    (((ii) << TARGET_MODE_REPLY_0100_SHIFT_INITIATOR_INDEX) &   \
459                                 TARGET_MODE_REPLY_0100_MASK_INITIATOR_INDEX))
460 
461 
462 #endif
463 
464