2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4 * Copyright (c) 2006-2015 LSI Corp.
5 * Copyright (c) 2013-2015 Avago Technologies
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * Avago Technologies (LSI) MPT-Fusion Host Adapter FreeBSD
35 * Copyright (c) 2006-2015 LSI Corporation.
36 * Copyright (c) 2013-2015 Avago Technologies
40 * Title: MPI Target mode messages and structures
41 * Creation Date: September 8, 2006
43 * mpi2_targ.h Version: 02.00.04
48 * Date Version Description
49 * -------- -------- ------------------------------------------------------
50 * 04-30-07 02.00.00 Corresponds to Fusion-MPT MPI Specification Rev A.
51 * 08-31-07 02.00.01 Added Command Buffer Data Location Address Space bits to
52 * BufferPostFlags field of CommandBufferPostBase Request.
53 * 02-29-08 02.00.02 Modified various names to make them 32-character unique.
54 * 10-02-08 02.00.03 Removed NextCmdBufferOffset from
55 * MPI2_TARGET_CMD_BUF_POST_BASE_REQUEST.
56 * Target Status Send Request only takes a single SGE for
58 * 02-10-10 02.00.04 Added comment to MPI2_TARGET_SSP_RSP_IU structure.
59 * --------------------------------------------------------------------------
65 /******************************************************************************
67 * SCSI Target Messages
69 *******************************************************************************/
71 /****************************************************************************
72 * Target Command Buffer Post Base Request
73 ****************************************************************************/
75 typedef struct _MPI2_TARGET_CMD_BUF_POST_BASE_REQUEST
77 U8 BufferPostFlags; /* 0x00 */
78 U8 Reserved1; /* 0x01 */
79 U8 ChainOffset; /* 0x02 */
80 U8 Function; /* 0x03 */
81 U16 TotalCmdBuffers; /* 0x04 */
82 U8 Reserved; /* 0x06 */
83 U8 MsgFlags; /* 0x07 */
86 U16 Reserved2; /* 0x0A */
87 U32 Reserved3; /* 0x0C */
88 U16 CmdBufferLength; /* 0x10 */
89 U16 Reserved4; /* 0x12 */
90 U32 BaseAddressLow; /* 0x14 */
91 U32 BaseAddressHigh; /* 0x18 */
92 } MPI2_TARGET_CMD_BUF_POST_BASE_REQUEST,
93 MPI2_POINTER PTR_MPI2_TARGET_CMD_BUF_POST_BASE_REQUEST,
94 Mpi2TargetCmdBufferPostBaseRequest_t,
95 MPI2_POINTER pMpi2TargetCmdBufferPostBaseRequest_t;
97 /* values for the BufferPostflags field */
98 #define MPI2_CMD_BUF_POST_BASE_ADDRESS_SPACE_MASK (0x0C)
99 #define MPI2_CMD_BUF_POST_BASE_SYSTEM_ADDRESS_SPACE (0x00)
100 #define MPI2_CMD_BUF_POST_BASE_IOCDDR_ADDRESS_SPACE (0x04)
101 #define MPI2_CMD_BUF_POST_BASE_IOCPLB_ADDRESS_SPACE (0x08)
102 #define MPI2_CMD_BUF_POST_BASE_IOCPLBNTA_ADDRESS_SPACE (0x0C)
104 #define MPI2_CMD_BUF_POST_BASE_FLAGS_AUTO_POST_ALL (0x01)
106 /****************************************************************************
107 * Target Command Buffer Post List Request
108 ****************************************************************************/
110 typedef struct _MPI2_TARGET_CMD_BUF_POST_LIST_REQUEST
112 U16 Reserved; /* 0x00 */
113 U8 ChainOffset; /* 0x02 */
114 U8 Function; /* 0x03 */
115 U16 CmdBufferCount; /* 0x04 */
116 U8 Reserved1; /* 0x06 */
117 U8 MsgFlags; /* 0x07 */
120 U16 Reserved2; /* 0x0A */
121 U32 Reserved3; /* 0x0C */
122 U16 IoIndex[2]; /* 0x10 */
123 } MPI2_TARGET_CMD_BUF_POST_LIST_REQUEST,
124 MPI2_POINTER PTR_MPI2_TARGET_CMD_BUF_POST_LIST_REQUEST,
125 Mpi2TargetCmdBufferPostListRequest_t,
126 MPI2_POINTER pMpi2TargetCmdBufferPostListRequest_t;
128 /****************************************************************************
129 * Target Command Buffer Post Base List Reply
130 ****************************************************************************/
132 typedef struct _MPI2_TARGET_BUF_POST_BASE_LIST_REPLY
135 U8 Reserved; /* 0x01 */
136 U8 MsgLength; /* 0x02 */
137 U8 Function; /* 0x03 */
138 U16 Reserved1; /* 0x04 */
139 U8 Reserved2; /* 0x06 */
140 U8 MsgFlags; /* 0x07 */
143 U16 Reserved3; /* 0x0A */
144 U16 Reserved4; /* 0x0C */
145 U16 IOCStatus; /* 0x0E */
146 U32 IOCLogInfo; /* 0x10 */
147 U16 IoIndex; /* 0x14 */
148 U16 Reserved5; /* 0x16 */
149 U32 Reserved6; /* 0x18 */
150 } MPI2_TARGET_BUF_POST_BASE_LIST_REPLY,
151 MPI2_POINTER PTR_MPI2_TARGET_BUF_POST_BASE_LIST_REPLY,
152 Mpi2TargetCmdBufferPostBaseListReply_t,
153 MPI2_POINTER pMpi2TargetCmdBufferPostBaseListReply_t;
156 #define MPI2_CMD_BUF_POST_REPLY_IOINDEX_VALID (0x01)
158 /****************************************************************************
159 * Command Buffer Formats (with 16 byte CDB)
160 ****************************************************************************/
162 typedef struct _MPI2_TARGET_SSP_CMD_BUFFER
164 U8 FrameType; /* 0x00 */
165 U8 Reserved1; /* 0x01 */
166 U16 InitiatorConnectionTag; /* 0x02 */
167 U32 HashedSourceSASAddress; /* 0x04 */
168 U16 Reserved2; /* 0x08 */
169 U16 Flags; /* 0x0A */
170 U32 Reserved3; /* 0x0C */
172 U16 TargetPortTransferTag; /* 0x12 */
173 U32 DataOffset; /* 0x14 */
174 /* COMMAND information unit starts here */
175 U8 LogicalUnitNumber[8]; /* 0x18 */
176 U8 Reserved4; /* 0x20 */
177 U8 TaskAttribute; /* lower 3 bits */ /* 0x21 */
178 U8 Reserved5; /* 0x22 */
179 U8 AdditionalCDBLength; /* upper 5 bits */ /* 0x23 */
180 U8 CDB[16]; /* 0x24 */
181 /* Additional CDB bytes extend past the CDB field */
182 } MPI2_TARGET_SSP_CMD_BUFFER, MPI2_POINTER PTR_MPI2_TARGET_SSP_CMD_BUFFER,
183 Mpi2TargetSspCmdBuffer, MPI2_POINTER pMp2iTargetSspCmdBuffer;
185 typedef struct _MPI2_TARGET_SSP_TASK_BUFFER
187 U8 FrameType; /* 0x00 */
188 U8 Reserved1; /* 0x01 */
189 U16 InitiatorConnectionTag; /* 0x02 */
190 U32 HashedSourceSASAddress; /* 0x04 */
191 U16 Reserved2; /* 0x08 */
192 U16 Flags; /* 0x0A */
193 U32 Reserved3; /* 0x0C */
195 U16 TargetPortTransferTag; /* 0x12 */
196 U32 DataOffset; /* 0x14 */
197 /* TASK information unit starts here */
198 U8 LogicalUnitNumber[8]; /* 0x18 */
199 U16 Reserved4; /* 0x20 */
200 U8 TaskManagementFunction; /* 0x22 */
201 U8 Reserved5; /* 0x23 */
202 U16 ManagedTaskTag; /* 0x24 */
203 U16 Reserved6; /* 0x26 */
204 U32 Reserved7; /* 0x28 */
205 U32 Reserved8; /* 0x2C */
206 U32 Reserved9; /* 0x30 */
207 } MPI2_TARGET_SSP_TASK_BUFFER, MPI2_POINTER PTR_MPI2_TARGET_SSP_TASK_BUFFER,
208 Mpi2TargetSspTaskBuffer, MPI2_POINTER pMpi2TargetSspTaskBuffer;
210 /* mask and shift for HashedSourceSASAddress field */
211 #define MPI2_TARGET_HASHED_SAS_ADDRESS_MASK (0xFFFFFF00)
212 #define MPI2_TARGET_HASHED_SAS_ADDRESS_SHIFT (8)
214 /****************************************************************************
215 * Target Assist Request
216 ****************************************************************************/
218 typedef struct _MPI2_TARGET_ASSIST_REQUEST
220 U8 Reserved1; /* 0x00 */
221 U8 TargetAssistFlags; /* 0x01 */
222 U8 ChainOffset; /* 0x02 */
223 U8 Function; /* 0x03 */
224 U16 QueueTag; /* 0x04 */
225 U8 Reserved2; /* 0x06 */
226 U8 MsgFlags; /* 0x07 */
229 U16 Reserved3; /* 0x0A */
230 U16 IoIndex; /* 0x0C */
231 U16 InitiatorConnectionTag; /* 0x0E */
232 U16 SGLFlags; /* 0x10 */
233 U8 SequenceNumber; /* 0x12 */
234 U8 Reserved4; /* 0x13 */
235 U8 SGLOffset0; /* 0x14 */
236 U8 SGLOffset1; /* 0x15 */
237 U8 SGLOffset2; /* 0x16 */
238 U8 SGLOffset3; /* 0x17 */
239 U32 SkipCount; /* 0x18 */
240 U32 DataLength; /* 0x1C */
241 U32 BidirectionalDataLength; /* 0x20 */
242 U16 IoFlags; /* 0x24 */
243 U16 EEDPFlags; /* 0x26 */
244 U32 EEDPBlockSize; /* 0x28 */
245 U32 SecondaryReferenceTag; /* 0x2C */
246 U16 SecondaryApplicationTag; /* 0x30 */
247 U16 ApplicationTagTranslationMask; /* 0x32 */
248 U32 PrimaryReferenceTag; /* 0x34 */
249 U16 PrimaryApplicationTag; /* 0x38 */
250 U16 PrimaryApplicationTagMask; /* 0x3A */
251 U32 RelativeOffset; /* 0x3C */
252 U32 Reserved5; /* 0x40 */
253 U32 Reserved6; /* 0x44 */
254 U32 Reserved7; /* 0x48 */
255 U32 Reserved8; /* 0x4C */
256 MPI2_SGE_IO_UNION SGL[1]; /* 0x50 */
257 } MPI2_TARGET_ASSIST_REQUEST, MPI2_POINTER PTR_MPI2_TARGET_ASSIST_REQUEST,
258 Mpi2TargetAssistRequest_t, MPI2_POINTER pMpi2TargetAssistRequest_t;
260 /* Target Assist TargetAssistFlags bits */
262 #define MPI2_TARGET_ASSIST_FLAGS_REPOST_CMD_BUFFER (0x80)
263 #define MPI2_TARGET_ASSIST_FLAGS_TLR (0x10)
264 #define MPI2_TARGET_ASSIST_FLAGS_RETRANSMIT (0x04)
265 #define MPI2_TARGET_ASSIST_FLAGS_AUTO_STATUS (0x02)
266 #define MPI2_TARGET_ASSIST_FLAGS_DATA_DIRECTION (0x01)
268 /* Target Assist SGLFlags bits */
270 /* base values for Data Location Address Space */
271 #define MPI2_TARGET_ASSIST_SGLFLAGS_ADDR_MASK (0x0C)
272 #define MPI2_TARGET_ASSIST_SGLFLAGS_SYSTEM_ADDR (0x00)
273 #define MPI2_TARGET_ASSIST_SGLFLAGS_IOCDDR_ADDR (0x04)
274 #define MPI2_TARGET_ASSIST_SGLFLAGS_IOCPLB_ADDR (0x08)
275 #define MPI2_TARGET_ASSIST_SGLFLAGS_PLBNTA_ADDR (0x0C)
277 /* base values for Type */
278 #define MPI2_TARGET_ASSIST_SGLFLAGS_TYPE_MASK (0x03)
279 #define MPI2_TARGET_ASSIST_SGLFLAGS_MPI_TYPE (0x00)
280 #define MPI2_TARGET_ASSIST_SGLFLAGS_32IEEE_TYPE (0x01)
281 #define MPI2_TARGET_ASSIST_SGLFLAGS_64IEEE_TYPE (0x02)
283 /* shift values for each sub-field */
284 #define MPI2_TARGET_ASSIST_SGLFLAGS_SGL3_SHIFT (12)
285 #define MPI2_TARGET_ASSIST_SGLFLAGS_SGL2_SHIFT (8)
286 #define MPI2_TARGET_ASSIST_SGLFLAGS_SGL1_SHIFT (4)
287 #define MPI2_TARGET_ASSIST_SGLFLAGS_SGL0_SHIFT (0)
289 /* Target Assist IoFlags bits */
291 #define MPI2_TARGET_ASSIST_IOFLAGS_BIDIRECTIONAL (0x0800)
292 #define MPI2_TARGET_ASSIST_IOFLAGS_MULTICAST (0x0400)
293 #define MPI2_TARGET_ASSIST_IOFLAGS_RECEIVE_FIRST (0x0200)
295 /* Target Assist EEDPFlags bits */
297 #define MPI2_TA_EEDPFLAGS_INC_PRI_REFTAG (0x8000)
298 #define MPI2_TA_EEDPFLAGS_INC_SEC_REFTAG (0x4000)
299 #define MPI2_TA_EEDPFLAGS_INC_PRI_APPTAG (0x2000)
300 #define MPI2_TA_EEDPFLAGS_INC_SEC_APPTAG (0x1000)
302 #define MPI2_TA_EEDPFLAGS_CHECK_REFTAG (0x0400)
303 #define MPI2_TA_EEDPFLAGS_CHECK_APPTAG (0x0200)
304 #define MPI2_TA_EEDPFLAGS_CHECK_GUARD (0x0100)
306 #define MPI2_TA_EEDPFLAGS_PASSTHRU_REFTAG (0x0008)
308 #define MPI2_TA_EEDPFLAGS_MASK_OP (0x0007)
309 #define MPI2_TA_EEDPFLAGS_NOOP_OP (0x0000)
310 #define MPI2_TA_EEDPFLAGS_CHECK_OP (0x0001)
311 #define MPI2_TA_EEDPFLAGS_STRIP_OP (0x0002)
312 #define MPI2_TA_EEDPFLAGS_CHECK_REMOVE_OP (0x0003)
313 #define MPI2_TA_EEDPFLAGS_INSERT_OP (0x0004)
314 #define MPI2_TA_EEDPFLAGS_REPLACE_OP (0x0006)
315 #define MPI2_TA_EEDPFLAGS_CHECK_REGEN_OP (0x0007)
317 /****************************************************************************
318 * Target Status Send Request
319 ****************************************************************************/
321 typedef struct _MPI2_TARGET_STATUS_SEND_REQUEST
323 U8 Reserved1; /* 0x00 */
324 U8 StatusFlags; /* 0x01 */
325 U8 ChainOffset; /* 0x02 */
326 U8 Function; /* 0x03 */
327 U16 QueueTag; /* 0x04 */
328 U8 Reserved2; /* 0x06 */
329 U8 MsgFlags; /* 0x07 */
332 U16 Reserved3; /* 0x0A */
333 U16 IoIndex; /* 0x0C */
334 U16 InitiatorConnectionTag; /* 0x0E */
335 U16 SGLFlags; /* 0x10 */
336 U16 Reserved4; /* 0x12 */
337 U8 SGLOffset0; /* 0x14 */
338 U8 Reserved5; /* 0x15 */
339 U16 Reserved6; /* 0x16 */
340 U32 Reserved7; /* 0x18 */
341 U32 Reserved8; /* 0x1C */
342 MPI2_SIMPLE_SGE_UNION StatusDataSGE; /* 0x20 */
343 } MPI2_TARGET_STATUS_SEND_REQUEST,
344 MPI2_POINTER PTR_MPI2_TARGET_STATUS_SEND_REQUEST,
345 Mpi2TargetStatusSendRequest_t, MPI2_POINTER pMpi2TargetStatusSendRequest_t;
347 /* Target Status Send StatusFlags bits */
349 #define MPI2_TSS_FLAGS_REPOST_CMD_BUFFER (0x80)
350 #define MPI2_TSS_FLAGS_RETRANSMIT (0x04)
351 #define MPI2_TSS_FLAGS_AUTO_GOOD_STATUS (0x01)
353 /* Target Status Send SGLFlags bits */
354 /* Data Location Address Space */
355 #define MPI2_TSS_SGLFLAGS_ADDR_MASK (0x0C)
356 #define MPI2_TSS_SGLFLAGS_SYSTEM_ADDR (0x00)
357 #define MPI2_TSS_SGLFLAGS_IOCDDR_ADDR (0x04)
358 #define MPI2_TSS_SGLFLAGS_IOCPLB_ADDR (0x08)
359 #define MPI2_TSS_SGLFLAGS_IOCPLBNTA_ADDR (0x0C)
361 #define MPI2_TSS_SGLFLAGS_TYPE_MASK (0x03)
362 #define MPI2_TSS_SGLFLAGS_MPI_TYPE (0x00)
363 #define MPI2_TSS_SGLFLAGS_IEEE32_TYPE (0x01)
364 #define MPI2_TSS_SGLFLAGS_IEEE64_TYPE (0x02)
367 * NOTE: The SSP status IU is big-endian. When used on a little-endian system,
368 * this structure properly orders the bytes.
370 typedef struct _MPI2_TARGET_SSP_RSP_IU
372 U32 Reserved0[6]; /* reserved for SSP header */ /* 0x00 */
374 /* start of RESPONSE information unit */
375 U32 Reserved1; /* 0x18 */
376 U32 Reserved2; /* 0x1C */
377 U16 Reserved3; /* 0x20 */
378 U8 DataPres; /* lower 2 bits */ /* 0x22 */
379 U8 Status; /* 0x23 */
380 U32 Reserved4; /* 0x24 */
381 U32 SenseDataLength; /* 0x28 */
382 U32 ResponseDataLength; /* 0x2C */
384 /* start of Response or Sense Data (size may vary dynamically) */
385 U8 ResponseSenseData[4]; /* 0x30 */
386 } MPI2_TARGET_SSP_RSP_IU, MPI2_POINTER PTR_MPI2_TARGET_SSP_RSP_IU,
387 Mpi2TargetSspRspIu_t, MPI2_POINTER pMpi2TargetSspRspIu_t;
389 /****************************************************************************
390 * Target Standard Reply - used with Target Assist or Target Status Send
391 ****************************************************************************/
393 typedef struct _MPI2_TARGET_STANDARD_REPLY
395 U16 Reserved; /* 0x00 */
396 U8 MsgLength; /* 0x02 */
397 U8 Function; /* 0x03 */
398 U16 Reserved1; /* 0x04 */
399 U8 Reserved2; /* 0x06 */
400 U8 MsgFlags; /* 0x07 */
403 U16 Reserved3; /* 0x0A */
404 U16 Reserved4; /* 0x0C */
405 U16 IOCStatus; /* 0x0E */
406 U32 IOCLogInfo; /* 0x10 */
407 U16 IoIndex; /* 0x14 */
408 U16 Reserved5; /* 0x16 */
409 U32 TransferCount; /* 0x18 */
410 U32 BidirectionalTransferCount; /* 0x1C */
411 } MPI2_TARGET_STANDARD_REPLY, MPI2_POINTER PTR_MPI2_TARGET_STANDARD_REPLY,
412 Mpi2TargetErrorReply_t, MPI2_POINTER pMpi2TargetErrorReply_t;
414 /****************************************************************************
415 * Target Mode Abort Request
416 ****************************************************************************/
418 typedef struct _MPI2_TARGET_MODE_ABORT_REQUEST
420 U8 AbortType; /* 0x00 */
421 U8 Reserved1; /* 0x01 */
422 U8 ChainOffset; /* 0x02 */
423 U8 Function; /* 0x03 */
424 U16 Reserved2; /* 0x04 */
425 U8 Reserved3; /* 0x06 */
426 U8 MsgFlags; /* 0x07 */
429 U16 Reserved4; /* 0x0A */
430 U16 IoIndexToAbort; /* 0x0C */
431 U16 Reserved6; /* 0x0E */
432 U32 MidToAbort; /* 0x10 */
433 } MPI2_TARGET_MODE_ABORT, MPI2_POINTER PTR_MPI2_TARGET_MODE_ABORT,
434 Mpi2TargetModeAbort_t, MPI2_POINTER pMpi2TargetModeAbort_t;
436 /* Target Mode Abort AbortType values */
438 #define MPI2_TARGET_MODE_ABORT_ALL_CMD_BUFFERS (0x00)
439 #define MPI2_TARGET_MODE_ABORT_ALL_IO (0x01)
440 #define MPI2_TARGET_MODE_ABORT_EXACT_IO (0x02)
441 #define MPI2_TARGET_MODE_ABORT_EXACT_IO_REQUEST (0x03)
442 #define MPI2_TARGET_MODE_ABORT_IO_REQUEST_AND_IO (0x04)
444 /****************************************************************************
445 * Target Mode Abort Reply
446 ****************************************************************************/
448 typedef struct _MPI2_TARGET_MODE_ABORT_REPLY
450 U16 Reserved; /* 0x00 */
451 U8 MsgLength; /* 0x02 */
452 U8 Function; /* 0x03 */
453 U16 Reserved1; /* 0x04 */
454 U8 Reserved2; /* 0x06 */
455 U8 MsgFlags; /* 0x07 */
458 U16 Reserved3; /* 0x0A */
459 U16 Reserved4; /* 0x0C */
460 U16 IOCStatus; /* 0x0E */
461 U32 IOCLogInfo; /* 0x10 */
462 U32 AbortCount; /* 0x14 */
463 } MPI2_TARGET_MODE_ABORT_REPLY, MPI2_POINTER PTR_MPI2_TARGET_MODE_ABORT_REPLY,
464 Mpi2TargetModeAbortReply_t, MPI2_POINTER pMpi2TargetModeAbortReply_t;