xref: /freebsd/sys/dev/mpr/mpi/mpi2_targ.h (revision b077aed33b7b6aefca7b17ddb250cf521f938613)
1 /*-
2  *  Copyright 2000-2020 Broadcom Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  * 3. Neither the name of the author nor the names of any co-contributors
13  *    may be used to endorse or promote products derived from this software
14  *    without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26  * SUCH DAMAGE.
27  *
28  * Broadcom Inc. (LSI) MPT-Fusion Host Adapter FreeBSD
29  *
30  * $FreeBSD$
31  */
32 
33 /*
34  *  Copyright 2000-2020 Broadcom Inc. All rights reserved.
35  *
36  *
37  *           Name:  mpi2_targ.h
38  *          Title:  MPI Target mode messages and structures
39  *  Creation Date:  September 8, 2006
40  *
41  *  mpi2_targ.h Version: 02.00.09
42  *
43  *  NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25
44  *        prefix are for use only on MPI v2.5 products, and must not be used
45  *        with MPI v2.0 products. Unless otherwise noted, names beginning with
46  *        MPI2 or Mpi2 are for use with both MPI v2.0 and MPI v2.5 products.
47  *
48  *  Version History
49  *  ---------------
50  *
51  *  Date      Version   Description
52  *  --------  --------  ------------------------------------------------------
53  *  04-30-07  02.00.00  Corresponds to Fusion-MPT MPI Specification Rev A.
54  *  08-31-07  02.00.01  Added Command Buffer Data Location Address Space bits to
55  *                      BufferPostFlags field of CommandBufferPostBase Request.
56  *  02-29-08  02.00.02  Modified various names to make them 32-character unique.
57  *  10-02-08  02.00.03  Removed NextCmdBufferOffset from
58  *                      MPI2_TARGET_CMD_BUF_POST_BASE_REQUEST.
59  *                      Target Status Send Request only takes a single SGE for
60  *                      response data.
61  *  02-10-10  02.00.04  Added comment to MPI2_TARGET_SSP_RSP_IU structure.
62  *  11-18-11  02.00.05  Incorporating additions for MPI v2.5.
63  *  11-27-12  02.00.06  Added InitiatorDevHandle field to MPI2_TARGET_MODE_ABORT
64  *                      request message structure.
65  *                      Added AbortType MPI2_TARGET_MODE_ABORT_DEVHANDLE and
66  *                      MPI2_TARGET_MODE_ABORT_ALL_COMMANDS.
67  *  06-13-14  02.00.07  Added MinMSIxIndex and MaxMSIxIndex fields to
68  *                      MPI2_TARGET_CMD_BUF_POST_BASE_REQUEST.
69  *  11-18-14  02.00.08  Updated copyright information.
70  *  03-16-15  02.00.09  Updated for MPI v2.6.
71  *                      Added MPI26_TARGET_ASSIST_IOFLAGS_ESCAPE_PASSTHROUGH.
72  *  --------------------------------------------------------------------------
73  */
74 
75 #ifndef MPI2_TARG_H
76 #define MPI2_TARG_H
77 
78 /******************************************************************************
79 *
80 *        SCSI Target Messages
81 *
82 *******************************************************************************/
83 
84 /****************************************************************************
85 *  Target Command Buffer Post Base Request
86 ****************************************************************************/
87 
88 typedef struct _MPI2_TARGET_CMD_BUF_POST_BASE_REQUEST
89 {
90     U8                      BufferPostFlags;        /* 0x00 */
91     U8                      Reserved1;              /* 0x01 */
92     U8                      ChainOffset;            /* 0x02 */
93     U8                      Function;               /* 0x03 */
94     U16                     TotalCmdBuffers;        /* 0x04 */
95     U8                      Reserved;               /* 0x06 */
96     U8                      MsgFlags;               /* 0x07 */
97     U8                      VP_ID;                  /* 0x08 */
98     U8                      VF_ID;                  /* 0x09 */
99     U16                     Reserved2;              /* 0x0A */
100     U32                     Reserved3;              /* 0x0C */
101     U16                     CmdBufferLength;        /* 0x10 */
102     U8                      MinMSIxIndex;           /* 0x12 */ /* MPI 2.5 and newer only; Reserved in MPI 2.0 */
103     U8                      MaxMSIxIndex;           /* 0x13 */ /* MPI 2.5 and newer only; Reserved in MPI 2.0 */
104     U32                     BaseAddressLow;         /* 0x14 */
105     U32                     BaseAddressHigh;        /* 0x18 */
106 } MPI2_TARGET_CMD_BUF_POST_BASE_REQUEST,
107   MPI2_POINTER PTR_MPI2_TARGET_CMD_BUF_POST_BASE_REQUEST,
108   Mpi2TargetCmdBufferPostBaseRequest_t,
109   MPI2_POINTER pMpi2TargetCmdBufferPostBaseRequest_t;
110 
111 /* values for the BufferPostflags field */
112 #define MPI2_CMD_BUF_POST_BASE_ADDRESS_SPACE_MASK            (0x0C)
113 #define MPI2_CMD_BUF_POST_BASE_SYSTEM_ADDRESS_SPACE          (0x00)
114 #define MPI2_CMD_BUF_POST_BASE_IOCDDR_ADDRESS_SPACE          (0x04)
115 #define MPI2_CMD_BUF_POST_BASE_IOCPLB_ADDRESS_SPACE          (0x08) /* only for MPI v2.5 and earlier */
116 #define MPI26_CMD_BUF_POST_BASE_IOCCTL_ADDRESS_SPACE         (0x08) /* for MPI v2.6 only */
117 #define MPI2_CMD_BUF_POST_BASE_IOCPLBNTA_ADDRESS_SPACE       (0x0C) /* only for MPI v2.5 and earlier */
118 
119 #define MPI2_CMD_BUF_POST_BASE_FLAGS_AUTO_POST_ALL           (0x01)
120 
121 /****************************************************************************
122 *  Target Command Buffer Post List Request
123 ****************************************************************************/
124 
125 typedef struct _MPI2_TARGET_CMD_BUF_POST_LIST_REQUEST
126 {
127     U16                     Reserved;               /* 0x00 */
128     U8                      ChainOffset;            /* 0x02 */
129     U8                      Function;               /* 0x03 */
130     U16                     CmdBufferCount;         /* 0x04 */
131     U8                      Reserved1;              /* 0x06 */
132     U8                      MsgFlags;               /* 0x07 */
133     U8                      VP_ID;                  /* 0x08 */
134     U8                      VF_ID;                  /* 0x09 */
135     U16                     Reserved2;              /* 0x0A */
136     U32                     Reserved3;              /* 0x0C */
137     U16                     IoIndex[2];             /* 0x10 */
138 } MPI2_TARGET_CMD_BUF_POST_LIST_REQUEST,
139   MPI2_POINTER PTR_MPI2_TARGET_CMD_BUF_POST_LIST_REQUEST,
140   Mpi2TargetCmdBufferPostListRequest_t,
141   MPI2_POINTER pMpi2TargetCmdBufferPostListRequest_t;
142 
143 /****************************************************************************
144 *  Target Command Buffer Post Base List Reply
145 ****************************************************************************/
146 
147 typedef struct _MPI2_TARGET_BUF_POST_BASE_LIST_REPLY
148 {
149     U8                      Flags;                  /* 0x00 */
150     U8                      Reserved;               /* 0x01 */
151     U8                      MsgLength;              /* 0x02 */
152     U8                      Function;               /* 0x03 */
153     U16                     Reserved1;              /* 0x04 */
154     U8                      Reserved2;              /* 0x06 */
155     U8                      MsgFlags;               /* 0x07 */
156     U8                      VP_ID;                  /* 0x08 */
157     U8                      VF_ID;                  /* 0x09 */
158     U16                     Reserved3;              /* 0x0A */
159     U16                     Reserved4;              /* 0x0C */
160     U16                     IOCStatus;              /* 0x0E */
161     U32                     IOCLogInfo;             /* 0x10 */
162     U16                     IoIndex;                /* 0x14 */
163     U16                     Reserved5;              /* 0x16 */
164     U32                     Reserved6;              /* 0x18 */
165 } MPI2_TARGET_BUF_POST_BASE_LIST_REPLY,
166   MPI2_POINTER PTR_MPI2_TARGET_BUF_POST_BASE_LIST_REPLY,
167   Mpi2TargetCmdBufferPostBaseListReply_t,
168   MPI2_POINTER pMpi2TargetCmdBufferPostBaseListReply_t;
169 
170 /* Flags defines */
171 #define MPI2_CMD_BUF_POST_REPLY_IOINDEX_VALID       (0x01)
172 
173 /****************************************************************************
174 *  Command Buffer Formats (with 16 byte CDB)
175 ****************************************************************************/
176 
177 typedef struct _MPI2_TARGET_SSP_CMD_BUFFER
178 {
179     U8      FrameType;                                  /* 0x00 */
180     U8      Reserved1;                                  /* 0x01 */
181     U16     InitiatorConnectionTag;                     /* 0x02 */
182     U32     HashedSourceSASAddress;                     /* 0x04 */
183     U16     Reserved2;                                  /* 0x08 */
184     U16     Flags;                                      /* 0x0A */
185     U32     Reserved3;                                  /* 0x0C */
186     U16     Tag;                                        /* 0x10 */
187     U16     TargetPortTransferTag;                      /* 0x12 */
188     U32     DataOffset;                                 /* 0x14 */
189     /* COMMAND information unit starts here */
190     U8      LogicalUnitNumber[8];                       /* 0x18 */
191     U8      Reserved4;                                  /* 0x20 */
192     U8      TaskAttribute; /* lower 3 bits */           /* 0x21 */
193     U8      Reserved5;                                  /* 0x22 */
194     U8      AdditionalCDBLength; /* upper 5 bits */     /* 0x23 */
195     U8      CDB[16];                                    /* 0x24 */
196     /* Additional CDB bytes extend past the CDB field */
197 } MPI2_TARGET_SSP_CMD_BUFFER, MPI2_POINTER PTR_MPI2_TARGET_SSP_CMD_BUFFER,
198   Mpi2TargetSspCmdBuffer, MPI2_POINTER pMp2iTargetSspCmdBuffer;
199 
200 typedef struct _MPI2_TARGET_SSP_TASK_BUFFER
201 {
202     U8      FrameType;                                  /* 0x00 */
203     U8      Reserved1;                                  /* 0x01 */
204     U16     InitiatorConnectionTag;                     /* 0x02 */
205     U32     HashedSourceSASAddress;                     /* 0x04 */
206     U16     Reserved2;                                  /* 0x08 */
207     U16     Flags;                                      /* 0x0A */
208     U32     Reserved3;                                  /* 0x0C */
209     U16     Tag;                                        /* 0x10 */
210     U16     TargetPortTransferTag;                      /* 0x12 */
211     U32     DataOffset;                                 /* 0x14 */
212     /* TASK information unit starts here */
213     U8      LogicalUnitNumber[8];                       /* 0x18 */
214     U16     Reserved4;                                  /* 0x20 */
215     U8      TaskManagementFunction;                     /* 0x22 */
216     U8      Reserved5;                                  /* 0x23 */
217     U16     ManagedTaskTag;                             /* 0x24 */
218     U16     Reserved6;                                  /* 0x26 */
219     U32     Reserved7;                                  /* 0x28 */
220     U32     Reserved8;                                  /* 0x2C */
221     U32     Reserved9;                                  /* 0x30 */
222 } MPI2_TARGET_SSP_TASK_BUFFER, MPI2_POINTER PTR_MPI2_TARGET_SSP_TASK_BUFFER,
223   Mpi2TargetSspTaskBuffer, MPI2_POINTER pMpi2TargetSspTaskBuffer;
224 
225 /* mask and shift for HashedSourceSASAddress field */
226 #define MPI2_TARGET_HASHED_SAS_ADDRESS_MASK     (0xFFFFFF00)
227 #define MPI2_TARGET_HASHED_SAS_ADDRESS_SHIFT    (8)
228 
229 /****************************************************************************
230 *   MPI v2.0 Target Assist Request
231 ****************************************************************************/
232 
233 typedef struct _MPI2_TARGET_ASSIST_REQUEST
234 {
235     U8                  Reserved1;                          /* 0x00 */
236     U8                  TargetAssistFlags;                  /* 0x01 */
237     U8                  ChainOffset;                        /* 0x02 */
238     U8                  Function;                           /* 0x03 */
239     U16                 QueueTag;                           /* 0x04 */
240     U8                  Reserved2;                          /* 0x06 */
241     U8                  MsgFlags;                           /* 0x07 */
242     U8                  VP_ID;                              /* 0x08 */
243     U8                  VF_ID;                              /* 0x09 */
244     U16                 Reserved3;                          /* 0x0A */
245     U16                 IoIndex;                            /* 0x0C */
246     U16                 InitiatorConnectionTag;             /* 0x0E */
247     U16                 SGLFlags;                           /* 0x10 */
248     U8                  SequenceNumber;                     /* 0x12 */
249     U8                  Reserved4;                          /* 0x13 */
250     U8                  SGLOffset0;                         /* 0x14 */
251     U8                  SGLOffset1;                         /* 0x15 */
252     U8                  SGLOffset2;                         /* 0x16 */
253     U8                  SGLOffset3;                         /* 0x17 */
254     U32                 SkipCount;                          /* 0x18 */
255     U32                 DataLength;                         /* 0x1C */
256     U32                 BidirectionalDataLength;            /* 0x20 */
257     U16                 IoFlags;                            /* 0x24 */
258     U16                 EEDPFlags;                          /* 0x26 */
259     U32                 EEDPBlockSize;                      /* 0x28 */
260     U32                 SecondaryReferenceTag;              /* 0x2C */
261     U16                 SecondaryApplicationTag;            /* 0x30 */
262     U16                 ApplicationTagTranslationMask;      /* 0x32 */
263     U32                 PrimaryReferenceTag;                /* 0x34 */
264     U16                 PrimaryApplicationTag;              /* 0x38 */
265     U16                 PrimaryApplicationTagMask;          /* 0x3A */
266     U32                 RelativeOffset;                     /* 0x3C */
267     U32                 Reserved5;                          /* 0x40 */
268     U32                 Reserved6;                          /* 0x44 */
269     U32                 Reserved7;                          /* 0x48 */
270     U32                 Reserved8;                          /* 0x4C */
271     MPI2_SGE_IO_UNION   SGL[1];                             /* 0x50 */
272 } MPI2_TARGET_ASSIST_REQUEST, MPI2_POINTER PTR_MPI2_TARGET_ASSIST_REQUEST,
273   Mpi2TargetAssistRequest_t, MPI2_POINTER pMpi2TargetAssistRequest_t;
274 
275 /* Target Assist TargetAssistFlags bits */
276 
277 #define MPI2_TARGET_ASSIST_FLAGS_REPOST_CMD_BUFFER      (0x80)
278 #define MPI2_TARGET_ASSIST_FLAGS_TLR                    (0x10)
279 #define MPI2_TARGET_ASSIST_FLAGS_RETRANSMIT             (0x04)
280 #define MPI2_TARGET_ASSIST_FLAGS_AUTO_STATUS            (0x02)
281 #define MPI2_TARGET_ASSIST_FLAGS_DATA_DIRECTION         (0x01)
282 
283 /* Target Assist SGLFlags bits */
284 
285 /* base values for Data Location Address Space */
286 #define MPI2_TARGET_ASSIST_SGLFLAGS_ADDR_MASK           (0x0C)
287 #define MPI2_TARGET_ASSIST_SGLFLAGS_SYSTEM_ADDR         (0x00)
288 #define MPI2_TARGET_ASSIST_SGLFLAGS_IOCDDR_ADDR         (0x04)
289 #define MPI2_TARGET_ASSIST_SGLFLAGS_IOCPLB_ADDR         (0x08)
290 #define MPI2_TARGET_ASSIST_SGLFLAGS_PLBNTA_ADDR         (0x0C)
291 
292 /* base values for Type */
293 #define MPI2_TARGET_ASSIST_SGLFLAGS_TYPE_MASK           (0x03)
294 #define MPI2_TARGET_ASSIST_SGLFLAGS_MPI_TYPE            (0x00)
295 #define MPI2_TARGET_ASSIST_SGLFLAGS_32IEEE_TYPE         (0x01)
296 #define MPI2_TARGET_ASSIST_SGLFLAGS_64IEEE_TYPE         (0x02)
297 
298 /* shift values for each sub-field */
299 #define MPI2_TARGET_ASSIST_SGLFLAGS_SGL3_SHIFT          (12)
300 #define MPI2_TARGET_ASSIST_SGLFLAGS_SGL2_SHIFT          (8)
301 #define MPI2_TARGET_ASSIST_SGLFLAGS_SGL1_SHIFT          (4)
302 #define MPI2_TARGET_ASSIST_SGLFLAGS_SGL0_SHIFT          (0)
303 
304 /* Target Assist IoFlags bits */
305 
306 #define MPI2_TARGET_ASSIST_IOFLAGS_BIDIRECTIONAL        (0x0800)
307 #define MPI2_TARGET_ASSIST_IOFLAGS_MULTICAST            (0x0400)
308 #define MPI2_TARGET_ASSIST_IOFLAGS_RECEIVE_FIRST        (0x0200)
309 
310 /* Target Assist EEDPFlags bits */
311 
312 #define MPI2_TA_EEDPFLAGS_INC_PRI_REFTAG            (0x8000)
313 #define MPI2_TA_EEDPFLAGS_INC_SEC_REFTAG            (0x4000)
314 #define MPI2_TA_EEDPFLAGS_INC_PRI_APPTAG            (0x2000)
315 #define MPI2_TA_EEDPFLAGS_INC_SEC_APPTAG            (0x1000)
316 
317 #define MPI2_TA_EEDPFLAGS_CHECK_REFTAG              (0x0400)
318 #define MPI2_TA_EEDPFLAGS_CHECK_APPTAG              (0x0200)
319 #define MPI2_TA_EEDPFLAGS_CHECK_GUARD               (0x0100)
320 
321 #define MPI2_TA_EEDPFLAGS_PASSTHRU_REFTAG           (0x0008)
322 
323 #define MPI2_TA_EEDPFLAGS_MASK_OP                   (0x0007)
324 #define MPI2_TA_EEDPFLAGS_NOOP_OP                   (0x0000)
325 #define MPI2_TA_EEDPFLAGS_CHECK_OP                  (0x0001)
326 #define MPI2_TA_EEDPFLAGS_STRIP_OP                  (0x0002)
327 #define MPI2_TA_EEDPFLAGS_CHECK_REMOVE_OP           (0x0003)
328 #define MPI2_TA_EEDPFLAGS_INSERT_OP                 (0x0004)
329 #define MPI2_TA_EEDPFLAGS_REPLACE_OP                (0x0006)
330 #define MPI2_TA_EEDPFLAGS_CHECK_REGEN_OP            (0x0007)
331 
332 /****************************************************************************
333 *   MPI v2.5 Target Assist Request
334 ****************************************************************************/
335 
336 typedef struct _MPI25_TARGET_ASSIST_REQUEST
337 {
338     U8                  Reserved1;                          /* 0x00 */
339     U8                  TargetAssistFlags;                  /* 0x01 */
340     U8                  ChainOffset;                        /* 0x02 */
341     U8                  Function;                           /* 0x03 */
342     U16                 QueueTag;                           /* 0x04 */
343     U8                  Reserved2;                          /* 0x06 */
344     U8                  MsgFlags;                           /* 0x07 */
345     U8                  VP_ID;                              /* 0x08 */
346     U8                  VF_ID;                              /* 0x09 */
347     U16                 Reserved3;                          /* 0x0A */
348     U16                 IoIndex;                            /* 0x0C */
349     U16                 InitiatorConnectionTag;             /* 0x0E */
350     U8                  DMAFlags;                           /* 0x10 */
351     U8                  Reserved9;                          /* 0x11 */
352     U8                  SequenceNumber;                     /* 0x12 */
353     U8                  Reserved4;                          /* 0x13 */
354     U8                  SGLOffset0;                         /* 0x14 */
355     U8                  SGLOffset1;                         /* 0x15 */
356     U8                  SGLOffset2;                         /* 0x16 */
357     U8                  SGLOffset3;                         /* 0x17 */
358     U32                 SkipCount;                          /* 0x18 */
359     U32                 DataLength;                         /* 0x1C */
360     U32                 BidirectionalDataLength;            /* 0x20 */
361     U16                 IoFlags;                            /* 0x24 */
362     U16                 EEDPFlags;                          /* 0x26 */
363     U16                 EEDPBlockSize;                      /* 0x28 */
364     U16                 Reserved10;                         /* 0x2A */
365     U32                 SecondaryReferenceTag;              /* 0x2C */
366     U16                 SecondaryApplicationTag;            /* 0x30 */
367     U16                 ApplicationTagTranslationMask;      /* 0x32 */
368     U32                 PrimaryReferenceTag;                /* 0x34 */
369     U16                 PrimaryApplicationTag;              /* 0x38 */
370     U16                 PrimaryApplicationTagMask;          /* 0x3A */
371     U32                 RelativeOffset;                     /* 0x3C */
372     U32                 Reserved5;                          /* 0x40 */
373     U32                 Reserved6;                          /* 0x44 */
374     U32                 Reserved7;                          /* 0x48 */
375     U32                 Reserved8;                          /* 0x4C */
376     MPI25_SGE_IO_UNION  SGL;                                /* 0x50 */
377 } MPI25_TARGET_ASSIST_REQUEST, MPI2_POINTER PTR_MPI25_TARGET_ASSIST_REQUEST,
378   Mpi25TargetAssistRequest_t, MPI2_POINTER pMpi25TargetAssistRequest_t;
379 
380 /* use MPI2_TARGET_ASSIST_FLAGS_ defines for the Flags field */
381 
382 /* Defines for the DMAFlags field
383  *  Each setting affects 4 SGLS, from SGL0 to SGL3.
384  *      D = Data
385  *      C = Cache DIF
386  *      I = Interleaved
387  *      H = Host DIF
388  */
389 #define MPI25_TA_DMAFLAGS_OP_MASK                   (0x0F)
390 #define MPI25_TA_DMAFLAGS_OP_D_D_D_D                (0x00)
391 #define MPI25_TA_DMAFLAGS_OP_D_D_D_C                (0x01)
392 #define MPI25_TA_DMAFLAGS_OP_D_D_D_I                (0x02)
393 #define MPI25_TA_DMAFLAGS_OP_D_D_C_C                (0x03)
394 #define MPI25_TA_DMAFLAGS_OP_D_D_C_I                (0x04)
395 #define MPI25_TA_DMAFLAGS_OP_D_D_I_I                (0x05)
396 #define MPI25_TA_DMAFLAGS_OP_D_C_C_C                (0x06)
397 #define MPI25_TA_DMAFLAGS_OP_D_C_C_I                (0x07)
398 #define MPI25_TA_DMAFLAGS_OP_D_C_I_I                (0x08)
399 #define MPI25_TA_DMAFLAGS_OP_D_I_I_I                (0x09)
400 #define MPI25_TA_DMAFLAGS_OP_D_H_D_D                (0x0A)
401 #define MPI25_TA_DMAFLAGS_OP_D_H_D_C                (0x0B)
402 #define MPI25_TA_DMAFLAGS_OP_D_H_D_I                (0x0C)
403 #define MPI25_TA_DMAFLAGS_OP_D_H_C_C                (0x0D)
404 #define MPI25_TA_DMAFLAGS_OP_D_H_C_I                (0x0E)
405 #define MPI25_TA_DMAFLAGS_OP_D_H_I_I                (0x0F)
406 
407 /* defines for the IoFlags field */
408 #define MPI26_TARGET_ASSIST_IOFLAGS_ESCAPE_PASSTHROUGH  (0x2000) /* MPI v2.6 and later */
409 #define MPI25_TARGET_ASSIST_IOFLAGS_BIDIRECTIONAL       (0x0800)
410 #define MPI25_TARGET_ASSIST_IOFLAGS_RECEIVE_FIRST       (0x0200)
411 
412 /* defines for the EEDPFlags field */
413 #define MPI25_TA_EEDPFLAGS_INC_PRI_REFTAG               (0x8000)
414 #define MPI25_TA_EEDPFLAGS_INC_SEC_REFTAG               (0x4000)
415 #define MPI25_TA_EEDPFLAGS_INC_PRI_APPTAG               (0x2000)
416 #define MPI25_TA_EEDPFLAGS_INC_SEC_APPTAG               (0x1000)
417 
418 #define MPI25_TA_EEDPFLAGS_CHECK_REFTAG                 (0x0400)
419 #define MPI25_TA_EEDPFLAGS_CHECK_APPTAG                 (0x0200)
420 #define MPI25_TA_EEDPFLAGS_CHECK_GUARD                  (0x0100)
421 
422 #define MPI25_TA_EEDPFLAGS_ESCAPE_MODE_MASK             (0x00C0)
423 #define MPI25_TA_EEDPFLAGS_COMPATIBLE_MODE              (0x0000)
424 #define MPI25_TA_EEDPFLAGS_DO_NOT_DISABLE_MODE          (0x0040)
425 #define MPI25_TA_EEDPFLAGS_APPTAG_DISABLE_MODE          (0x0080)
426 #define MPI25_TA_EEDPFLAGS_APPTAG_REFTAG_DISABLE_MODE   (0x00C0)
427 
428 #define MPI25_TA_EEDPFLAGS_HOST_GUARD_METHOD_MASK       (0x0030)
429 #define MPI25_TA_EEDPFLAGS_T10_CRC_HOST_GUARD           (0x0000)
430 #define MPI25_TA_EEDPFLAGS_IP_CHKSUM_HOST_GUARD         (0x0010)
431 
432 #define MPI25_TA_EEDPFLAGS_PASSTHRU_REFTAG              (0x0008)
433 
434 #define MPI25_TA_EEDPFLAGS_MASK_OP                      (0x0007)
435 #define MPI25_TA_EEDPFLAGS_NOOP_OP                      (0x0000)
436 #define MPI25_TA_EEDPFLAGS_CHECK_OP                     (0x0001)
437 #define MPI25_TA_EEDPFLAGS_STRIP_OP                     (0x0002)
438 #define MPI25_TA_EEDPFLAGS_CHECK_REMOVE_OP              (0x0003)
439 #define MPI25_TA_EEDPFLAGS_INSERT_OP                    (0x0004)
440 #define MPI25_TA_EEDPFLAGS_REPLACE_OP                   (0x0006)
441 #define MPI25_TA_EEDPFLAGS_CHECK_REGEN_OP               (0x0007)
442 
443 /****************************************************************************
444 *  Target Status Send Request
445 ****************************************************************************/
446 
447 typedef struct _MPI2_TARGET_STATUS_SEND_REQUEST
448 {
449     U8                      Reserved1;                  /* 0x00 */
450     U8                      StatusFlags;                /* 0x01 */
451     U8                      ChainOffset;                /* 0x02 */
452     U8                      Function;                   /* 0x03 */
453     U16                     QueueTag;                   /* 0x04 */
454     U8                      Reserved2;                  /* 0x06 */
455     U8                      MsgFlags;                   /* 0x07 */
456     U8                      VP_ID;                      /* 0x08 */
457     U8                      VF_ID;                      /* 0x09 */
458     U16                     Reserved3;                  /* 0x0A */
459     U16                     IoIndex;                    /* 0x0C */
460     U16                     InitiatorConnectionTag;     /* 0x0E */
461     U16                     SGLFlags;                   /* 0x10 */ /* MPI v2.0 only. Reserved on MPI v2.5. */
462     U16                     Reserved4;                  /* 0x12 */
463     U8                      SGLOffset0;                 /* 0x14 */
464     U8                      Reserved5;                  /* 0x15 */
465     U16                     Reserved6;                  /* 0x16 */
466     U32                     Reserved7;                  /* 0x18 */
467     U32                     Reserved8;                  /* 0x1C */
468     MPI2_SIMPLE_SGE_UNION   StatusDataSGE;              /* 0x20 */ /* MPI v2.5: This must be an IEEE Simple Element 64. */
469 } MPI2_TARGET_STATUS_SEND_REQUEST,
470   MPI2_POINTER PTR_MPI2_TARGET_STATUS_SEND_REQUEST,
471   Mpi2TargetStatusSendRequest_t, MPI2_POINTER pMpi2TargetStatusSendRequest_t;
472 
473 /* Target Status Send StatusFlags bits */
474 
475 #define MPI2_TSS_FLAGS_REPOST_CMD_BUFFER            (0x80)
476 #define MPI2_TSS_FLAGS_RETRANSMIT                   (0x04)
477 #define MPI2_TSS_FLAGS_AUTO_GOOD_STATUS             (0x01)
478 
479 /* Target Status Send SGLFlags bits - MPI v2.0 only */
480 /* Data Location Address Space */
481 #define MPI2_TSS_SGLFLAGS_ADDR_MASK                 (0x0C)
482 #define MPI2_TSS_SGLFLAGS_SYSTEM_ADDR               (0x00)
483 #define MPI2_TSS_SGLFLAGS_IOCDDR_ADDR               (0x04)
484 #define MPI2_TSS_SGLFLAGS_IOCPLB_ADDR               (0x08)
485 #define MPI2_TSS_SGLFLAGS_IOCPLBNTA_ADDR            (0x0C)
486 /* Type */
487 #define MPI2_TSS_SGLFLAGS_TYPE_MASK                 (0x03)
488 #define MPI2_TSS_SGLFLAGS_MPI_TYPE                  (0x00)
489 #define MPI2_TSS_SGLFLAGS_IEEE32_TYPE               (0x01)
490 #define MPI2_TSS_SGLFLAGS_IEEE64_TYPE               (0x02)
491 
492 /*
493  * NOTE: The SSP status IU is big-endian. When used on a little-endian system,
494  * this structure properly orders the bytes.
495  */
496 typedef struct _MPI2_TARGET_SSP_RSP_IU
497 {
498     U32     Reserved0[6]; /* reserved for SSP header */ /* 0x00 */
499 
500     /* start of RESPONSE information unit */
501     U32     Reserved1;                                  /* 0x18 */
502     U32     Reserved2;                                  /* 0x1C */
503     U16     Reserved3;                                  /* 0x20 */
504     U8      DataPres; /* lower 2 bits */                /* 0x22 */
505     U8      Status;                                     /* 0x23 */
506     U32     Reserved4;                                  /* 0x24 */
507     U32     SenseDataLength;                            /* 0x28 */
508     U32     ResponseDataLength;                         /* 0x2C */
509 
510     /* start of Response or Sense Data (size may vary dynamically) */
511     U8      ResponseSenseData[4];                       /* 0x30 */
512 } MPI2_TARGET_SSP_RSP_IU, MPI2_POINTER PTR_MPI2_TARGET_SSP_RSP_IU,
513   Mpi2TargetSspRspIu_t, MPI2_POINTER pMpi2TargetSspRspIu_t;
514 
515 /****************************************************************************
516 *  Target Standard Reply - used with Target Assist or Target Status Send
517 ****************************************************************************/
518 
519 typedef struct _MPI2_TARGET_STANDARD_REPLY
520 {
521     U16                     Reserved;                   /* 0x00 */
522     U8                      MsgLength;                  /* 0x02 */
523     U8                      Function;                   /* 0x03 */
524     U16                     Reserved1;                  /* 0x04 */
525     U8                      Reserved2;                  /* 0x06 */
526     U8                      MsgFlags;                   /* 0x07 */
527     U8                      VP_ID;                      /* 0x08 */
528     U8                      VF_ID;                      /* 0x09 */
529     U16                     Reserved3;                  /* 0x0A */
530     U16                     Reserved4;                  /* 0x0C */
531     U16                     IOCStatus;                  /* 0x0E */
532     U32                     IOCLogInfo;                 /* 0x10 */
533     U16                     IoIndex;                    /* 0x14 */
534     U16                     Reserved5;                  /* 0x16 */
535     U32                     TransferCount;              /* 0x18 */
536     U32                     BidirectionalTransferCount; /* 0x1C */
537 } MPI2_TARGET_STANDARD_REPLY, MPI2_POINTER PTR_MPI2_TARGET_STANDARD_REPLY,
538   Mpi2TargetErrorReply_t, MPI2_POINTER pMpi2TargetErrorReply_t;
539 
540 /****************************************************************************
541 *  Target Mode Abort Request
542 ****************************************************************************/
543 
544 typedef struct _MPI2_TARGET_MODE_ABORT_REQUEST
545 {
546     U8                      AbortType;                  /* 0x00 */
547     U8                      Reserved1;                  /* 0x01 */
548     U8                      ChainOffset;                /* 0x02 */
549     U8                      Function;                   /* 0x03 */
550     U16                     Reserved2;                  /* 0x04 */
551     U8                      Reserved3;                  /* 0x06 */
552     U8                      MsgFlags;                   /* 0x07 */
553     U8                      VP_ID;                      /* 0x08 */
554     U8                      VF_ID;                      /* 0x09 */
555     U16                     Reserved4;                  /* 0x0A */
556     U16                     IoIndexToAbort;             /* 0x0C */
557     U16                     InitiatorDevHandle;         /* 0x0E */
558     U32                     MidToAbort;                 /* 0x10 */
559 } MPI2_TARGET_MODE_ABORT, MPI2_POINTER PTR_MPI2_TARGET_MODE_ABORT,
560   Mpi2TargetModeAbort_t, MPI2_POINTER pMpi2TargetModeAbort_t;
561 
562 /* Target Mode Abort AbortType values */
563 
564 #define MPI2_TARGET_MODE_ABORT_ALL_CMD_BUFFERS      (0x00)
565 #define MPI2_TARGET_MODE_ABORT_ALL_IO               (0x01)
566 #define MPI2_TARGET_MODE_ABORT_EXACT_IO             (0x02)
567 #define MPI2_TARGET_MODE_ABORT_EXACT_IO_REQUEST     (0x03)
568 #define MPI2_TARGET_MODE_ABORT_IO_REQUEST_AND_IO    (0x04)
569 #define MPI2_TARGET_MODE_ABORT_DEVHANDLE            (0x05)
570 #define MPI2_TARGET_MODE_ABORT_ALL_COMMANDS         (0x06)
571 
572 /****************************************************************************
573 *  Target Mode Abort Reply
574 ****************************************************************************/
575 
576 typedef struct _MPI2_TARGET_MODE_ABORT_REPLY
577 {
578     U16                     Reserved;                   /* 0x00 */
579     U8                      MsgLength;                  /* 0x02 */
580     U8                      Function;                   /* 0x03 */
581     U16                     Reserved1;                  /* 0x04 */
582     U8                      Reserved2;                  /* 0x06 */
583     U8                      MsgFlags;                   /* 0x07 */
584     U8                      VP_ID;                      /* 0x08 */
585     U8                      VF_ID;                      /* 0x09 */
586     U16                     Reserved3;                  /* 0x0A */
587     U16                     Reserved4;                  /* 0x0C */
588     U16                     IOCStatus;                  /* 0x0E */
589     U32                     IOCLogInfo;                 /* 0x10 */
590     U32                     AbortCount;                 /* 0x14 */
591 } MPI2_TARGET_MODE_ABORT_REPLY, MPI2_POINTER PTR_MPI2_TARGET_MODE_ABORT_REPLY,
592   Mpi2TargetModeAbortReply_t, MPI2_POINTER pMpi2TargetModeAbortReply_t;
593 
594 #endif
595