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 * --------------------------------------------------------------------------
66 /******************************************************************************
68 * SCSI Target Messages
70 *******************************************************************************/
72 /****************************************************************************
73 * Target Command Buffer Post Base Request
74 ****************************************************************************/
76 typedef struct _MPI2_TARGET_CMD_BUF_POST_BASE_REQUEST
78 U8 BufferPostFlags; /* 0x00 */
79 U8 Reserved1; /* 0x01 */
80 U8 ChainOffset; /* 0x02 */
81 U8 Function; /* 0x03 */
82 U16 TotalCmdBuffers; /* 0x04 */
83 U8 Reserved; /* 0x06 */
84 U8 MsgFlags; /* 0x07 */
87 U16 Reserved2; /* 0x0A */
88 U32 Reserved3; /* 0x0C */
89 U16 CmdBufferLength; /* 0x10 */
90 U16 Reserved4; /* 0x12 */
91 U32 BaseAddressLow; /* 0x14 */
92 U32 BaseAddressHigh; /* 0x18 */
93 } MPI2_TARGET_CMD_BUF_POST_BASE_REQUEST,
94 MPI2_POINTER PTR_MPI2_TARGET_CMD_BUF_POST_BASE_REQUEST,
95 Mpi2TargetCmdBufferPostBaseRequest_t,
96 MPI2_POINTER pMpi2TargetCmdBufferPostBaseRequest_t;
98 /* values for the BufferPostflags field */
99 #define MPI2_CMD_BUF_POST_BASE_ADDRESS_SPACE_MASK (0x0C)
100 #define MPI2_CMD_BUF_POST_BASE_SYSTEM_ADDRESS_SPACE (0x00)
101 #define MPI2_CMD_BUF_POST_BASE_IOCDDR_ADDRESS_SPACE (0x04)
102 #define MPI2_CMD_BUF_POST_BASE_IOCPLB_ADDRESS_SPACE (0x08)
103 #define MPI2_CMD_BUF_POST_BASE_IOCPLBNTA_ADDRESS_SPACE (0x0C)
105 #define MPI2_CMD_BUF_POST_BASE_FLAGS_AUTO_POST_ALL (0x01)
108 /****************************************************************************
109 * Target Command Buffer Post List Request
110 ****************************************************************************/
112 typedef struct _MPI2_TARGET_CMD_BUF_POST_LIST_REQUEST
114 U16 Reserved; /* 0x00 */
115 U8 ChainOffset; /* 0x02 */
116 U8 Function; /* 0x03 */
117 U16 CmdBufferCount; /* 0x04 */
118 U8 Reserved1; /* 0x06 */
119 U8 MsgFlags; /* 0x07 */
122 U16 Reserved2; /* 0x0A */
123 U32 Reserved3; /* 0x0C */
124 U16 IoIndex[2]; /* 0x10 */
125 } MPI2_TARGET_CMD_BUF_POST_LIST_REQUEST,
126 MPI2_POINTER PTR_MPI2_TARGET_CMD_BUF_POST_LIST_REQUEST,
127 Mpi2TargetCmdBufferPostListRequest_t,
128 MPI2_POINTER pMpi2TargetCmdBufferPostListRequest_t;
130 /****************************************************************************
131 * Target Command Buffer Post Base List Reply
132 ****************************************************************************/
134 typedef struct _MPI2_TARGET_BUF_POST_BASE_LIST_REPLY
137 U8 Reserved; /* 0x01 */
138 U8 MsgLength; /* 0x02 */
139 U8 Function; /* 0x03 */
140 U16 Reserved1; /* 0x04 */
141 U8 Reserved2; /* 0x06 */
142 U8 MsgFlags; /* 0x07 */
145 U16 Reserved3; /* 0x0A */
146 U16 Reserved4; /* 0x0C */
147 U16 IOCStatus; /* 0x0E */
148 U32 IOCLogInfo; /* 0x10 */
149 U16 IoIndex; /* 0x14 */
150 U16 Reserved5; /* 0x16 */
151 U32 Reserved6; /* 0x18 */
152 } MPI2_TARGET_BUF_POST_BASE_LIST_REPLY,
153 MPI2_POINTER PTR_MPI2_TARGET_BUF_POST_BASE_LIST_REPLY,
154 Mpi2TargetCmdBufferPostBaseListReply_t,
155 MPI2_POINTER pMpi2TargetCmdBufferPostBaseListReply_t;
158 #define MPI2_CMD_BUF_POST_REPLY_IOINDEX_VALID (0x01)
161 /****************************************************************************
162 * Command Buffer Formats (with 16 byte CDB)
163 ****************************************************************************/
165 typedef struct _MPI2_TARGET_SSP_CMD_BUFFER
167 U8 FrameType; /* 0x00 */
168 U8 Reserved1; /* 0x01 */
169 U16 InitiatorConnectionTag; /* 0x02 */
170 U32 HashedSourceSASAddress; /* 0x04 */
171 U16 Reserved2; /* 0x08 */
172 U16 Flags; /* 0x0A */
173 U32 Reserved3; /* 0x0C */
175 U16 TargetPortTransferTag; /* 0x12 */
176 U32 DataOffset; /* 0x14 */
177 /* COMMAND information unit starts here */
178 U8 LogicalUnitNumber[8]; /* 0x18 */
179 U8 Reserved4; /* 0x20 */
180 U8 TaskAttribute; /* lower 3 bits */ /* 0x21 */
181 U8 Reserved5; /* 0x22 */
182 U8 AdditionalCDBLength; /* upper 5 bits */ /* 0x23 */
183 U8 CDB[16]; /* 0x24 */
184 /* Additional CDB bytes extend past the CDB field */
185 } MPI2_TARGET_SSP_CMD_BUFFER, MPI2_POINTER PTR_MPI2_TARGET_SSP_CMD_BUFFER,
186 Mpi2TargetSspCmdBuffer, MPI2_POINTER pMp2iTargetSspCmdBuffer;
188 typedef struct _MPI2_TARGET_SSP_TASK_BUFFER
190 U8 FrameType; /* 0x00 */
191 U8 Reserved1; /* 0x01 */
192 U16 InitiatorConnectionTag; /* 0x02 */
193 U32 HashedSourceSASAddress; /* 0x04 */
194 U16 Reserved2; /* 0x08 */
195 U16 Flags; /* 0x0A */
196 U32 Reserved3; /* 0x0C */
198 U16 TargetPortTransferTag; /* 0x12 */
199 U32 DataOffset; /* 0x14 */
200 /* TASK information unit starts here */
201 U8 LogicalUnitNumber[8]; /* 0x18 */
202 U16 Reserved4; /* 0x20 */
203 U8 TaskManagementFunction; /* 0x22 */
204 U8 Reserved5; /* 0x23 */
205 U16 ManagedTaskTag; /* 0x24 */
206 U16 Reserved6; /* 0x26 */
207 U32 Reserved7; /* 0x28 */
208 U32 Reserved8; /* 0x2C */
209 U32 Reserved9; /* 0x30 */
210 } MPI2_TARGET_SSP_TASK_BUFFER, MPI2_POINTER PTR_MPI2_TARGET_SSP_TASK_BUFFER,
211 Mpi2TargetSspTaskBuffer, MPI2_POINTER pMpi2TargetSspTaskBuffer;
213 /* mask and shift for HashedSourceSASAddress field */
214 #define MPI2_TARGET_HASHED_SAS_ADDRESS_MASK (0xFFFFFF00)
215 #define MPI2_TARGET_HASHED_SAS_ADDRESS_SHIFT (8)
218 /****************************************************************************
219 * Target Assist Request
220 ****************************************************************************/
222 typedef struct _MPI2_TARGET_ASSIST_REQUEST
224 U8 Reserved1; /* 0x00 */
225 U8 TargetAssistFlags; /* 0x01 */
226 U8 ChainOffset; /* 0x02 */
227 U8 Function; /* 0x03 */
228 U16 QueueTag; /* 0x04 */
229 U8 Reserved2; /* 0x06 */
230 U8 MsgFlags; /* 0x07 */
233 U16 Reserved3; /* 0x0A */
234 U16 IoIndex; /* 0x0C */
235 U16 InitiatorConnectionTag; /* 0x0E */
236 U16 SGLFlags; /* 0x10 */
237 U8 SequenceNumber; /* 0x12 */
238 U8 Reserved4; /* 0x13 */
239 U8 SGLOffset0; /* 0x14 */
240 U8 SGLOffset1; /* 0x15 */
241 U8 SGLOffset2; /* 0x16 */
242 U8 SGLOffset3; /* 0x17 */
243 U32 SkipCount; /* 0x18 */
244 U32 DataLength; /* 0x1C */
245 U32 BidirectionalDataLength; /* 0x20 */
246 U16 IoFlags; /* 0x24 */
247 U16 EEDPFlags; /* 0x26 */
248 U32 EEDPBlockSize; /* 0x28 */
249 U32 SecondaryReferenceTag; /* 0x2C */
250 U16 SecondaryApplicationTag; /* 0x30 */
251 U16 ApplicationTagTranslationMask; /* 0x32 */
252 U32 PrimaryReferenceTag; /* 0x34 */
253 U16 PrimaryApplicationTag; /* 0x38 */
254 U16 PrimaryApplicationTagMask; /* 0x3A */
255 U32 RelativeOffset; /* 0x3C */
256 U32 Reserved5; /* 0x40 */
257 U32 Reserved6; /* 0x44 */
258 U32 Reserved7; /* 0x48 */
259 U32 Reserved8; /* 0x4C */
260 MPI2_SGE_IO_UNION SGL[1]; /* 0x50 */
261 } MPI2_TARGET_ASSIST_REQUEST, MPI2_POINTER PTR_MPI2_TARGET_ASSIST_REQUEST,
262 Mpi2TargetAssistRequest_t, MPI2_POINTER pMpi2TargetAssistRequest_t;
264 /* Target Assist TargetAssistFlags bits */
266 #define MPI2_TARGET_ASSIST_FLAGS_REPOST_CMD_BUFFER (0x80)
267 #define MPI2_TARGET_ASSIST_FLAGS_TLR (0x10)
268 #define MPI2_TARGET_ASSIST_FLAGS_RETRANSMIT (0x04)
269 #define MPI2_TARGET_ASSIST_FLAGS_AUTO_STATUS (0x02)
270 #define MPI2_TARGET_ASSIST_FLAGS_DATA_DIRECTION (0x01)
272 /* Target Assist SGLFlags bits */
274 /* base values for Data Location Address Space */
275 #define MPI2_TARGET_ASSIST_SGLFLAGS_ADDR_MASK (0x0C)
276 #define MPI2_TARGET_ASSIST_SGLFLAGS_SYSTEM_ADDR (0x00)
277 #define MPI2_TARGET_ASSIST_SGLFLAGS_IOCDDR_ADDR (0x04)
278 #define MPI2_TARGET_ASSIST_SGLFLAGS_IOCPLB_ADDR (0x08)
279 #define MPI2_TARGET_ASSIST_SGLFLAGS_PLBNTA_ADDR (0x0C)
281 /* base values for Type */
282 #define MPI2_TARGET_ASSIST_SGLFLAGS_TYPE_MASK (0x03)
283 #define MPI2_TARGET_ASSIST_SGLFLAGS_MPI_TYPE (0x00)
284 #define MPI2_TARGET_ASSIST_SGLFLAGS_32IEEE_TYPE (0x01)
285 #define MPI2_TARGET_ASSIST_SGLFLAGS_64IEEE_TYPE (0x02)
287 /* shift values for each sub-field */
288 #define MPI2_TARGET_ASSIST_SGLFLAGS_SGL3_SHIFT (12)
289 #define MPI2_TARGET_ASSIST_SGLFLAGS_SGL2_SHIFT (8)
290 #define MPI2_TARGET_ASSIST_SGLFLAGS_SGL1_SHIFT (4)
291 #define MPI2_TARGET_ASSIST_SGLFLAGS_SGL0_SHIFT (0)
293 /* Target Assist IoFlags bits */
295 #define MPI2_TARGET_ASSIST_IOFLAGS_BIDIRECTIONAL (0x0800)
296 #define MPI2_TARGET_ASSIST_IOFLAGS_MULTICAST (0x0400)
297 #define MPI2_TARGET_ASSIST_IOFLAGS_RECEIVE_FIRST (0x0200)
299 /* Target Assist EEDPFlags bits */
301 #define MPI2_TA_EEDPFLAGS_INC_PRI_REFTAG (0x8000)
302 #define MPI2_TA_EEDPFLAGS_INC_SEC_REFTAG (0x4000)
303 #define MPI2_TA_EEDPFLAGS_INC_PRI_APPTAG (0x2000)
304 #define MPI2_TA_EEDPFLAGS_INC_SEC_APPTAG (0x1000)
306 #define MPI2_TA_EEDPFLAGS_CHECK_REFTAG (0x0400)
307 #define MPI2_TA_EEDPFLAGS_CHECK_APPTAG (0x0200)
308 #define MPI2_TA_EEDPFLAGS_CHECK_GUARD (0x0100)
310 #define MPI2_TA_EEDPFLAGS_PASSTHRU_REFTAG (0x0008)
312 #define MPI2_TA_EEDPFLAGS_MASK_OP (0x0007)
313 #define MPI2_TA_EEDPFLAGS_NOOP_OP (0x0000)
314 #define MPI2_TA_EEDPFLAGS_CHECK_OP (0x0001)
315 #define MPI2_TA_EEDPFLAGS_STRIP_OP (0x0002)
316 #define MPI2_TA_EEDPFLAGS_CHECK_REMOVE_OP (0x0003)
317 #define MPI2_TA_EEDPFLAGS_INSERT_OP (0x0004)
318 #define MPI2_TA_EEDPFLAGS_REPLACE_OP (0x0006)
319 #define MPI2_TA_EEDPFLAGS_CHECK_REGEN_OP (0x0007)
322 /****************************************************************************
323 * Target Status Send Request
324 ****************************************************************************/
326 typedef struct _MPI2_TARGET_STATUS_SEND_REQUEST
328 U8 Reserved1; /* 0x00 */
329 U8 StatusFlags; /* 0x01 */
330 U8 ChainOffset; /* 0x02 */
331 U8 Function; /* 0x03 */
332 U16 QueueTag; /* 0x04 */
333 U8 Reserved2; /* 0x06 */
334 U8 MsgFlags; /* 0x07 */
337 U16 Reserved3; /* 0x0A */
338 U16 IoIndex; /* 0x0C */
339 U16 InitiatorConnectionTag; /* 0x0E */
340 U16 SGLFlags; /* 0x10 */
341 U16 Reserved4; /* 0x12 */
342 U8 SGLOffset0; /* 0x14 */
343 U8 Reserved5; /* 0x15 */
344 U16 Reserved6; /* 0x16 */
345 U32 Reserved7; /* 0x18 */
346 U32 Reserved8; /* 0x1C */
347 MPI2_SIMPLE_SGE_UNION StatusDataSGE; /* 0x20 */
348 } MPI2_TARGET_STATUS_SEND_REQUEST,
349 MPI2_POINTER PTR_MPI2_TARGET_STATUS_SEND_REQUEST,
350 Mpi2TargetStatusSendRequest_t, MPI2_POINTER pMpi2TargetStatusSendRequest_t;
352 /* Target Status Send StatusFlags bits */
354 #define MPI2_TSS_FLAGS_REPOST_CMD_BUFFER (0x80)
355 #define MPI2_TSS_FLAGS_RETRANSMIT (0x04)
356 #define MPI2_TSS_FLAGS_AUTO_GOOD_STATUS (0x01)
358 /* Target Status Send SGLFlags bits */
359 /* Data Location Address Space */
360 #define MPI2_TSS_SGLFLAGS_ADDR_MASK (0x0C)
361 #define MPI2_TSS_SGLFLAGS_SYSTEM_ADDR (0x00)
362 #define MPI2_TSS_SGLFLAGS_IOCDDR_ADDR (0x04)
363 #define MPI2_TSS_SGLFLAGS_IOCPLB_ADDR (0x08)
364 #define MPI2_TSS_SGLFLAGS_IOCPLBNTA_ADDR (0x0C)
366 #define MPI2_TSS_SGLFLAGS_TYPE_MASK (0x03)
367 #define MPI2_TSS_SGLFLAGS_MPI_TYPE (0x00)
368 #define MPI2_TSS_SGLFLAGS_IEEE32_TYPE (0x01)
369 #define MPI2_TSS_SGLFLAGS_IEEE64_TYPE (0x02)
374 * NOTE: The SSP status IU is big-endian. When used on a little-endian system,
375 * this structure properly orders the bytes.
377 typedef struct _MPI2_TARGET_SSP_RSP_IU
379 U32 Reserved0[6]; /* reserved for SSP header */ /* 0x00 */
381 /* start of RESPONSE information unit */
382 U32 Reserved1; /* 0x18 */
383 U32 Reserved2; /* 0x1C */
384 U16 Reserved3; /* 0x20 */
385 U8 DataPres; /* lower 2 bits */ /* 0x22 */
386 U8 Status; /* 0x23 */
387 U32 Reserved4; /* 0x24 */
388 U32 SenseDataLength; /* 0x28 */
389 U32 ResponseDataLength; /* 0x2C */
391 /* start of Response or Sense Data (size may vary dynamically) */
392 U8 ResponseSenseData[4]; /* 0x30 */
393 } MPI2_TARGET_SSP_RSP_IU, MPI2_POINTER PTR_MPI2_TARGET_SSP_RSP_IU,
394 Mpi2TargetSspRspIu_t, MPI2_POINTER pMpi2TargetSspRspIu_t;
397 /****************************************************************************
398 * Target Standard Reply - used with Target Assist or Target Status Send
399 ****************************************************************************/
401 typedef struct _MPI2_TARGET_STANDARD_REPLY
403 U16 Reserved; /* 0x00 */
404 U8 MsgLength; /* 0x02 */
405 U8 Function; /* 0x03 */
406 U16 Reserved1; /* 0x04 */
407 U8 Reserved2; /* 0x06 */
408 U8 MsgFlags; /* 0x07 */
411 U16 Reserved3; /* 0x0A */
412 U16 Reserved4; /* 0x0C */
413 U16 IOCStatus; /* 0x0E */
414 U32 IOCLogInfo; /* 0x10 */
415 U16 IoIndex; /* 0x14 */
416 U16 Reserved5; /* 0x16 */
417 U32 TransferCount; /* 0x18 */
418 U32 BidirectionalTransferCount; /* 0x1C */
419 } MPI2_TARGET_STANDARD_REPLY, MPI2_POINTER PTR_MPI2_TARGET_STANDARD_REPLY,
420 Mpi2TargetErrorReply_t, MPI2_POINTER pMpi2TargetErrorReply_t;
423 /****************************************************************************
424 * Target Mode Abort Request
425 ****************************************************************************/
427 typedef struct _MPI2_TARGET_MODE_ABORT_REQUEST
429 U8 AbortType; /* 0x00 */
430 U8 Reserved1; /* 0x01 */
431 U8 ChainOffset; /* 0x02 */
432 U8 Function; /* 0x03 */
433 U16 Reserved2; /* 0x04 */
434 U8 Reserved3; /* 0x06 */
435 U8 MsgFlags; /* 0x07 */
438 U16 Reserved4; /* 0x0A */
439 U16 IoIndexToAbort; /* 0x0C */
440 U16 Reserved6; /* 0x0E */
441 U32 MidToAbort; /* 0x10 */
442 } MPI2_TARGET_MODE_ABORT, MPI2_POINTER PTR_MPI2_TARGET_MODE_ABORT,
443 Mpi2TargetModeAbort_t, MPI2_POINTER pMpi2TargetModeAbort_t;
445 /* Target Mode Abort AbortType values */
447 #define MPI2_TARGET_MODE_ABORT_ALL_CMD_BUFFERS (0x00)
448 #define MPI2_TARGET_MODE_ABORT_ALL_IO (0x01)
449 #define MPI2_TARGET_MODE_ABORT_EXACT_IO (0x02)
450 #define MPI2_TARGET_MODE_ABORT_EXACT_IO_REQUEST (0x03)
451 #define MPI2_TARGET_MODE_ABORT_IO_REQUEST_AND_IO (0x04)
454 /****************************************************************************
455 * Target Mode Abort Reply
456 ****************************************************************************/
458 typedef struct _MPI2_TARGET_MODE_ABORT_REPLY
460 U16 Reserved; /* 0x00 */
461 U8 MsgLength; /* 0x02 */
462 U8 Function; /* 0x03 */
463 U16 Reserved1; /* 0x04 */
464 U8 Reserved2; /* 0x06 */
465 U8 MsgFlags; /* 0x07 */
468 U16 Reserved3; /* 0x0A */
469 U16 Reserved4; /* 0x0C */
470 U16 IOCStatus; /* 0x0E */
471 U32 IOCLogInfo; /* 0x10 */
472 U32 AbortCount; /* 0x14 */
473 } MPI2_TARGET_MODE_ABORT_REPLY, MPI2_POINTER PTR_MPI2_TARGET_MODE_ABORT_REPLY,
474 Mpi2TargetModeAbortReply_t, MPI2_POINTER pMpi2TargetModeAbortReply_t;