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