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