2 * Copyright (c) 2011, 2012 LSI Corp.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * LSI MPT-Fusion Host Adapter FreeBSD
32 * Copyright (c) 2000-2012 LSI Corporation.
36 * Title: MPI Target mode messages and structures
37 * Creation Date: September 8, 2006
39 * mpi2_targ.h Version: 02.00.04
44 * Date Version Description
45 * -------- -------- ------------------------------------------------------
46 * 04-30-07 02.00.00 Corresponds to Fusion-MPT MPI Specification Rev A.
47 * 08-31-07 02.00.01 Added Command Buffer Data Location Address Space bits to
48 * BufferPostFlags field of CommandBufferPostBase Request.
49 * 02-29-08 02.00.02 Modified various names to make them 32-character unique.
50 * 10-02-08 02.00.03 Removed NextCmdBufferOffset from
51 * MPI2_TARGET_CMD_BUF_POST_BASE_REQUEST.
52 * Target Status Send Request only takes a single SGE for
54 * 02-10-10 02.00.04 Added comment to MPI2_TARGET_SSP_RSP_IU structure.
55 * --------------------------------------------------------------------------
62 /******************************************************************************
64 * SCSI Target Messages
66 *******************************************************************************/
68 /****************************************************************************
69 * Target Command Buffer Post Base Request
70 ****************************************************************************/
72 typedef struct _MPI2_TARGET_CMD_BUF_POST_BASE_REQUEST
74 U8 BufferPostFlags; /* 0x00 */
75 U8 Reserved1; /* 0x01 */
76 U8 ChainOffset; /* 0x02 */
77 U8 Function; /* 0x03 */
78 U16 TotalCmdBuffers; /* 0x04 */
79 U8 Reserved; /* 0x06 */
80 U8 MsgFlags; /* 0x07 */
83 U16 Reserved2; /* 0x0A */
84 U32 Reserved3; /* 0x0C */
85 U16 CmdBufferLength; /* 0x10 */
86 U16 Reserved4; /* 0x12 */
87 U32 BaseAddressLow; /* 0x14 */
88 U32 BaseAddressHigh; /* 0x18 */
89 } MPI2_TARGET_CMD_BUF_POST_BASE_REQUEST,
90 MPI2_POINTER PTR_MPI2_TARGET_CMD_BUF_POST_BASE_REQUEST,
91 Mpi2TargetCmdBufferPostBaseRequest_t,
92 MPI2_POINTER pMpi2TargetCmdBufferPostBaseRequest_t;
94 /* values for the BufferPostflags field */
95 #define MPI2_CMD_BUF_POST_BASE_ADDRESS_SPACE_MASK (0x0C)
96 #define MPI2_CMD_BUF_POST_BASE_SYSTEM_ADDRESS_SPACE (0x00)
97 #define MPI2_CMD_BUF_POST_BASE_IOCDDR_ADDRESS_SPACE (0x04)
98 #define MPI2_CMD_BUF_POST_BASE_IOCPLB_ADDRESS_SPACE (0x08)
99 #define MPI2_CMD_BUF_POST_BASE_IOCPLBNTA_ADDRESS_SPACE (0x0C)
101 #define MPI2_CMD_BUF_POST_BASE_FLAGS_AUTO_POST_ALL (0x01)
104 /****************************************************************************
105 * Target Command Buffer Post List Request
106 ****************************************************************************/
108 typedef struct _MPI2_TARGET_CMD_BUF_POST_LIST_REQUEST
110 U16 Reserved; /* 0x00 */
111 U8 ChainOffset; /* 0x02 */
112 U8 Function; /* 0x03 */
113 U16 CmdBufferCount; /* 0x04 */
114 U8 Reserved1; /* 0x06 */
115 U8 MsgFlags; /* 0x07 */
118 U16 Reserved2; /* 0x0A */
119 U32 Reserved3; /* 0x0C */
120 U16 IoIndex[2]; /* 0x10 */
121 } MPI2_TARGET_CMD_BUF_POST_LIST_REQUEST,
122 MPI2_POINTER PTR_MPI2_TARGET_CMD_BUF_POST_LIST_REQUEST,
123 Mpi2TargetCmdBufferPostListRequest_t,
124 MPI2_POINTER pMpi2TargetCmdBufferPostListRequest_t;
126 /****************************************************************************
127 * Target Command Buffer Post Base List Reply
128 ****************************************************************************/
130 typedef struct _MPI2_TARGET_BUF_POST_BASE_LIST_REPLY
133 U8 Reserved; /* 0x01 */
134 U8 MsgLength; /* 0x02 */
135 U8 Function; /* 0x03 */
136 U16 Reserved1; /* 0x04 */
137 U8 Reserved2; /* 0x06 */
138 U8 MsgFlags; /* 0x07 */
141 U16 Reserved3; /* 0x0A */
142 U16 Reserved4; /* 0x0C */
143 U16 IOCStatus; /* 0x0E */
144 U32 IOCLogInfo; /* 0x10 */
145 U16 IoIndex; /* 0x14 */
146 U16 Reserved5; /* 0x16 */
147 U32 Reserved6; /* 0x18 */
148 } MPI2_TARGET_BUF_POST_BASE_LIST_REPLY,
149 MPI2_POINTER PTR_MPI2_TARGET_BUF_POST_BASE_LIST_REPLY,
150 Mpi2TargetCmdBufferPostBaseListReply_t,
151 MPI2_POINTER pMpi2TargetCmdBufferPostBaseListReply_t;
154 #define MPI2_CMD_BUF_POST_REPLY_IOINDEX_VALID (0x01)
157 /****************************************************************************
158 * Command Buffer Formats (with 16 byte CDB)
159 ****************************************************************************/
161 typedef struct _MPI2_TARGET_SSP_CMD_BUFFER
163 U8 FrameType; /* 0x00 */
164 U8 Reserved1; /* 0x01 */
165 U16 InitiatorConnectionTag; /* 0x02 */
166 U32 HashedSourceSASAddress; /* 0x04 */
167 U16 Reserved2; /* 0x08 */
168 U16 Flags; /* 0x0A */
169 U32 Reserved3; /* 0x0C */
171 U16 TargetPortTransferTag; /* 0x12 */
172 U32 DataOffset; /* 0x14 */
173 /* COMMAND information unit starts here */
174 U8 LogicalUnitNumber[8]; /* 0x18 */
175 U8 Reserved4; /* 0x20 */
176 U8 TaskAttribute; /* lower 3 bits */ /* 0x21 */
177 U8 Reserved5; /* 0x22 */
178 U8 AdditionalCDBLength; /* upper 5 bits */ /* 0x23 */
179 U8 CDB[16]; /* 0x24 */
180 /* Additional CDB bytes extend past the CDB field */
181 } MPI2_TARGET_SSP_CMD_BUFFER, MPI2_POINTER PTR_MPI2_TARGET_SSP_CMD_BUFFER,
182 Mpi2TargetSspCmdBuffer, MPI2_POINTER pMp2iTargetSspCmdBuffer;
184 typedef struct _MPI2_TARGET_SSP_TASK_BUFFER
186 U8 FrameType; /* 0x00 */
187 U8 Reserved1; /* 0x01 */
188 U16 InitiatorConnectionTag; /* 0x02 */
189 U32 HashedSourceSASAddress; /* 0x04 */
190 U16 Reserved2; /* 0x08 */
191 U16 Flags; /* 0x0A */
192 U32 Reserved3; /* 0x0C */
194 U16 TargetPortTransferTag; /* 0x12 */
195 U32 DataOffset; /* 0x14 */
196 /* TASK information unit starts here */
197 U8 LogicalUnitNumber[8]; /* 0x18 */
198 U16 Reserved4; /* 0x20 */
199 U8 TaskManagementFunction; /* 0x22 */
200 U8 Reserved5; /* 0x23 */
201 U16 ManagedTaskTag; /* 0x24 */
202 U16 Reserved6; /* 0x26 */
203 U32 Reserved7; /* 0x28 */
204 U32 Reserved8; /* 0x2C */
205 U32 Reserved9; /* 0x30 */
206 } MPI2_TARGET_SSP_TASK_BUFFER, MPI2_POINTER PTR_MPI2_TARGET_SSP_TASK_BUFFER,
207 Mpi2TargetSspTaskBuffer, MPI2_POINTER pMpi2TargetSspTaskBuffer;
209 /* mask and shift for HashedSourceSASAddress field */
210 #define MPI2_TARGET_HASHED_SAS_ADDRESS_MASK (0xFFFFFF00)
211 #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)
318 /****************************************************************************
319 * Target Status Send Request
320 ****************************************************************************/
322 typedef struct _MPI2_TARGET_STATUS_SEND_REQUEST
324 U8 Reserved1; /* 0x00 */
325 U8 StatusFlags; /* 0x01 */
326 U8 ChainOffset; /* 0x02 */
327 U8 Function; /* 0x03 */
328 U16 QueueTag; /* 0x04 */
329 U8 Reserved2; /* 0x06 */
330 U8 MsgFlags; /* 0x07 */
333 U16 Reserved3; /* 0x0A */
334 U16 IoIndex; /* 0x0C */
335 U16 InitiatorConnectionTag; /* 0x0E */
336 U16 SGLFlags; /* 0x10 */
337 U16 Reserved4; /* 0x12 */
338 U8 SGLOffset0; /* 0x14 */
339 U8 Reserved5; /* 0x15 */
340 U16 Reserved6; /* 0x16 */
341 U32 Reserved7; /* 0x18 */
342 U32 Reserved8; /* 0x1C */
343 MPI2_SIMPLE_SGE_UNION StatusDataSGE; /* 0x20 */
344 } MPI2_TARGET_STATUS_SEND_REQUEST,
345 MPI2_POINTER PTR_MPI2_TARGET_STATUS_SEND_REQUEST,
346 Mpi2TargetStatusSendRequest_t, MPI2_POINTER pMpi2TargetStatusSendRequest_t;
348 /* Target Status Send StatusFlags bits */
350 #define MPI2_TSS_FLAGS_REPOST_CMD_BUFFER (0x80)
351 #define MPI2_TSS_FLAGS_RETRANSMIT (0x04)
352 #define MPI2_TSS_FLAGS_AUTO_GOOD_STATUS (0x01)
354 /* Target Status Send SGLFlags bits */
355 /* Data Location Address Space */
356 #define MPI2_TSS_SGLFLAGS_ADDR_MASK (0x0C)
357 #define MPI2_TSS_SGLFLAGS_SYSTEM_ADDR (0x00)
358 #define MPI2_TSS_SGLFLAGS_IOCDDR_ADDR (0x04)
359 #define MPI2_TSS_SGLFLAGS_IOCPLB_ADDR (0x08)
360 #define MPI2_TSS_SGLFLAGS_IOCPLBNTA_ADDR (0x0C)
362 #define MPI2_TSS_SGLFLAGS_TYPE_MASK (0x03)
363 #define MPI2_TSS_SGLFLAGS_MPI_TYPE (0x00)
364 #define MPI2_TSS_SGLFLAGS_IEEE32_TYPE (0x01)
365 #define MPI2_TSS_SGLFLAGS_IEEE64_TYPE (0x02)
370 * NOTE: The SSP status IU is big-endian. When used on a little-endian system,
371 * this structure properly orders the bytes.
373 typedef struct _MPI2_TARGET_SSP_RSP_IU
375 U32 Reserved0[6]; /* reserved for SSP header */ /* 0x00 */
377 /* start of RESPONSE information unit */
378 U32 Reserved1; /* 0x18 */
379 U32 Reserved2; /* 0x1C */
380 U16 Reserved3; /* 0x20 */
381 U8 DataPres; /* lower 2 bits */ /* 0x22 */
382 U8 Status; /* 0x23 */
383 U32 Reserved4; /* 0x24 */
384 U32 SenseDataLength; /* 0x28 */
385 U32 ResponseDataLength; /* 0x2C */
387 /* start of Response or Sense Data (size may vary dynamically) */
388 U8 ResponseSenseData[4]; /* 0x30 */
389 } MPI2_TARGET_SSP_RSP_IU, MPI2_POINTER PTR_MPI2_TARGET_SSP_RSP_IU,
390 Mpi2TargetSspRspIu_t, MPI2_POINTER pMpi2TargetSspRspIu_t;
393 /****************************************************************************
394 * Target Standard Reply - used with Target Assist or Target Status Send
395 ****************************************************************************/
397 typedef struct _MPI2_TARGET_STANDARD_REPLY
399 U16 Reserved; /* 0x00 */
400 U8 MsgLength; /* 0x02 */
401 U8 Function; /* 0x03 */
402 U16 Reserved1; /* 0x04 */
403 U8 Reserved2; /* 0x06 */
404 U8 MsgFlags; /* 0x07 */
407 U16 Reserved3; /* 0x0A */
408 U16 Reserved4; /* 0x0C */
409 U16 IOCStatus; /* 0x0E */
410 U32 IOCLogInfo; /* 0x10 */
411 U16 IoIndex; /* 0x14 */
412 U16 Reserved5; /* 0x16 */
413 U32 TransferCount; /* 0x18 */
414 U32 BidirectionalTransferCount; /* 0x1C */
415 } MPI2_TARGET_STANDARD_REPLY, MPI2_POINTER PTR_MPI2_TARGET_STANDARD_REPLY,
416 Mpi2TargetErrorReply_t, MPI2_POINTER pMpi2TargetErrorReply_t;
419 /****************************************************************************
420 * Target Mode Abort Request
421 ****************************************************************************/
423 typedef struct _MPI2_TARGET_MODE_ABORT_REQUEST
425 U8 AbortType; /* 0x00 */
426 U8 Reserved1; /* 0x01 */
427 U8 ChainOffset; /* 0x02 */
428 U8 Function; /* 0x03 */
429 U16 Reserved2; /* 0x04 */
430 U8 Reserved3; /* 0x06 */
431 U8 MsgFlags; /* 0x07 */
434 U16 Reserved4; /* 0x0A */
435 U16 IoIndexToAbort; /* 0x0C */
436 U16 Reserved6; /* 0x0E */
437 U32 MidToAbort; /* 0x10 */
438 } MPI2_TARGET_MODE_ABORT, MPI2_POINTER PTR_MPI2_TARGET_MODE_ABORT,
439 Mpi2TargetModeAbort_t, MPI2_POINTER pMpi2TargetModeAbort_t;
441 /* Target Mode Abort AbortType values */
443 #define MPI2_TARGET_MODE_ABORT_ALL_CMD_BUFFERS (0x00)
444 #define MPI2_TARGET_MODE_ABORT_ALL_IO (0x01)
445 #define MPI2_TARGET_MODE_ABORT_EXACT_IO (0x02)
446 #define MPI2_TARGET_MODE_ABORT_EXACT_IO_REQUEST (0x03)
447 #define MPI2_TARGET_MODE_ABORT_IO_REQUEST_AND_IO (0x04)
450 /****************************************************************************
451 * Target Mode Abort Reply
452 ****************************************************************************/
454 typedef struct _MPI2_TARGET_MODE_ABORT_REPLY
456 U16 Reserved; /* 0x00 */
457 U8 MsgLength; /* 0x02 */
458 U8 Function; /* 0x03 */
459 U16 Reserved1; /* 0x04 */
460 U8 Reserved2; /* 0x06 */
461 U8 MsgFlags; /* 0x07 */
464 U16 Reserved3; /* 0x0A */
465 U16 Reserved4; /* 0x0C */
466 U16 IOCStatus; /* 0x0E */
467 U32 IOCLogInfo; /* 0x10 */
468 U32 AbortCount; /* 0x14 */
469 } MPI2_TARGET_MODE_ABORT_REPLY, MPI2_POINTER PTR_MPI2_TARGET_MODE_ABORT_REPLY,
470 Mpi2TargetModeAbortReply_t, MPI2_POINTER pMpi2TargetModeAbortReply_t;