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