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