master
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 2000-2010, LSI Logic Corporation and its contributors.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are
9 * met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
13 * substantially similar to the "NO WARRANTY" disclaimer below
14 * ("Disclaimer") and any redistribution must be conditioned upon including
15 * a substantially similar Disclaimer requirement for further binary
16 * redistribution.
17 * 3. Neither the name of the LSI Logic Corporation nor the names of its
18 * contributors may be used to endorse or promote products derived from
19 * this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT
31 * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 *
33 * Name: mpi_targ.h
34 * Title: MPI Target mode messages and structures
35 * Creation Date: June 22, 2000
36 *
37 * mpi_targ.h Version: 01.05.06
38 *
39 * Version History
40 * ---------------
41 *
42 * Date Version Description
43 * -------- -------- ------------------------------------------------------
44 * 05-08-00 00.10.01 Original release for 0.10 spec dated 4/26/2000.
45 * 06-06-00 01.00.01 Update version number for 1.0 release.
46 * 06-22-00 01.00.02 Added _MSG_TARGET_CMD_BUFFER_POST_REPLY structure.
47 * Corrected DECSRIPTOR typo to DESCRIPTOR.
48 * 11-02-00 01.01.01 Original release for post 1.0 work
49 * Modified target mode to use IoIndex instead of
50 * HostIndex and IocIndex. Added Alias.
51 * 01-09-01 01.01.02 Added defines for TARGET_ASSIST_FLAGS_REPOST_CMD_BUFFER
52 * and TARGET_STATUS_SEND_FLAGS_REPOST_CMD_BUFFER.
53 * 02-20-01 01.01.03 Started using MPI_POINTER.
54 * Added structures for MPI_TARGET_SCSI_SPI_CMD_BUFFER and
55 * MPI_TARGET_FCP_CMD_BUFFER.
56 * 03-27-01 01.01.04 Added structure offset comments.
57 * 08-08-01 01.02.01 Original release for v1.2 work.
58 * 09-28-01 01.02.02 Added structure for MPI_TARGET_SCSI_SPI_STATUS_IU.
59 * Added PriorityReason field to some replies and
60 * defined more PriorityReason codes.
61 * Added some defines for to support previous version
62 * of MPI.
63 * 10-04-01 01.02.03 Added PriorityReason to MSG_TARGET_ERROR_REPLY.
64 * 11-01-01 01.02.04 Added define for TARGET_STATUS_SEND_FLAGS_HIGH_PRIORITY.
65 * 03-14-02 01.02.05 Modified MPI_TARGET_FCP_RSP_BUFFER to get the proper
66 * byte ordering.
67 * 05-31-02 01.02.06 Modified TARGET_MODE_REPLY_ALIAS_MASK to only include
68 * one bit.
69 * Added AliasIndex field to MPI_TARGET_FCP_CMD_BUFFER.
70 * 09-16-02 01.02.07 Added flags for confirmed completion.
71 * Added PRIORITY_REASON_TARGET_BUSY.
72 * 11-15-02 01.02.08 Added AliasID field to MPI_TARGET_SCSI_SPI_CMD_BUFFER.
73 * 04-01-03 01.02.09 Added OptionalOxid field to MPI_TARGET_FCP_CMD_BUFFER.
74 * 05-11-04 01.03.01 Original release for MPI v1.3.
75 * 08-19-04 01.05.01 Added new request message structures for
76 * MSG_TARGET_CMD_BUF_POST_BASE_REQUEST,
77 * MSG_TARGET_CMD_BUF_POST_LIST_REQUEST, and
78 * MSG_TARGET_ASSIST_EXT_REQUEST.
79 * Added new structures for SAS SSP Command buffer, SSP
80 * Task buffer, and SSP Status IU.
81 * 10-05-04 01.05.02 MSG_TARGET_CMD_BUFFER_POST_BASE_LIST_REPLY added.
82 * 02-22-05 01.05.03 Changed a comment.
83 * 03-11-05 01.05.04 Removed TargetAssistExtended Request.
84 * 06-24-05 01.05.05 Added TargetAssistExtended structures and defines.
85 * 03-27-06 01.05.06 Added a comment.
86 * --------------------------------------------------------------------------
87 */
88
89#ifndef MPI_TARG_H
90#define MPI_TARG_H
91
92/******************************************************************************
93*
94* S C S I T a r g e t M e s s a g e s
95*
96*******************************************************************************/
97
98typedef struct _CMD_BUFFER_DESCRIPTOR
99{
100 U16 IoIndex; /* 00h */
101 U16 Reserved; /* 02h */
102 union /* 04h */
103 {
104 U32 PhysicalAddress32;
105 U64 PhysicalAddress64;
106 } u;
107} CMD_BUFFER_DESCRIPTOR, MPI_POINTER PTR_CMD_BUFFER_DESCRIPTOR,
108 CmdBufferDescriptor_t, MPI_POINTER pCmdBufferDescriptor_t;
109
110/****************************************************************************/
111/* Target Command Buffer Post Request */
112/****************************************************************************/
113
114typedef struct _MSG_TARGET_CMD_BUFFER_POST_REQUEST
115{
116 U8 BufferPostFlags; /* 00h */
117 U8 BufferCount; /* 01h */
118 U8 ChainOffset; /* 02h */
119 U8 Function; /* 03h */
120 U8 BufferLength; /* 04h */
121 U8 Reserved; /* 05h */
122 U8 Reserved1; /* 06h */
123 U8 MsgFlags; /* 07h */
124 U32 MsgContext; /* 08h */
125 CMD_BUFFER_DESCRIPTOR Buffer[1]; /* 0Ch */
126} MSG_TARGET_CMD_BUFFER_POST_REQUEST, MPI_POINTER PTR_MSG_TARGET_CMD_BUFFER_POST_REQUEST,
127 TargetCmdBufferPostRequest_t, MPI_POINTER pTargetCmdBufferPostRequest_t;
128
129#define CMD_BUFFER_POST_FLAGS_PORT_MASK (0x01)
130#define CMD_BUFFER_POST_FLAGS_ADDR_MODE_MASK (0x80)
131#define CMD_BUFFER_POST_FLAGS_ADDR_MODE_32 (0)
132#define CMD_BUFFER_POST_FLAGS_ADDR_MODE_64 (1)
133#define CMD_BUFFER_POST_FLAGS_64_BIT_ADDR (0x80)
134
135#define CMD_BUFFER_POST_IO_INDEX_MASK (0x00003FFF)
136#define CMD_BUFFER_POST_IO_INDEX_MASK_0100 (0x000003FF) /* obsolete */
137
138typedef struct _MSG_TARGET_CMD_BUFFER_POST_REPLY
139{
140 U8 BufferPostFlags; /* 00h */
141 U8 BufferCount; /* 01h */
142 U8 MsgLength; /* 02h */
143 U8 Function; /* 03h */
144 U8 BufferLength; /* 04h */
145 U8 Reserved; /* 05h */
146 U8 Reserved1; /* 06h */
147 U8 MsgFlags; /* 07h */
148 U32 MsgContext; /* 08h */
149 U16 Reserved2; /* 0Ch */
150 U16 IOCStatus; /* 0Eh */
151 U32 IOCLogInfo; /* 10h */
152} MSG_TARGET_CMD_BUFFER_POST_REPLY, MPI_POINTER PTR_MSG_TARGET_CMD_BUFFER_POST_REPLY,
153 TargetCmdBufferPostReply_t, MPI_POINTER pTargetCmdBufferPostReply_t;
154
155/* the following structure is obsolete as of MPI v1.2 */
156typedef struct _MSG_PRIORITY_CMD_RECEIVED_REPLY
157{
158 U16 Reserved; /* 00h */
159 U8 MsgLength; /* 02h */
160 U8 Function; /* 03h */
161 U16 Reserved1; /* 04h */
162 U8 Reserved2; /* 06h */
163 U8 MsgFlags; /* 07h */
164 U32 MsgContext; /* 08h */
165 U8 PriorityReason; /* 0Ch */
166 U8 Reserved3; /* 0Dh */
167 U16 IOCStatus; /* 0Eh */
168 U32 IOCLogInfo; /* 10h */
169 U32 ReplyWord; /* 14h */
170} MSG_PRIORITY_CMD_RECEIVED_REPLY, MPI_POINTER PTR_MSG_PRIORITY_CMD_RECEIVED_REPLY,
171 PriorityCommandReceivedReply_t, MPI_POINTER pPriorityCommandReceivedReply_t;
172
173typedef struct _MSG_TARGET_CMD_BUFFER_POST_ERROR_REPLY
174{
175 U16 Reserved; /* 00h */
176 U8 MsgLength; /* 02h */
177 U8 Function; /* 03h */
178 U16 Reserved1; /* 04h */
179 U8 Reserved2; /* 06h */
180 U8 MsgFlags; /* 07h */
181 U32 MsgContext; /* 08h */
182 U8 PriorityReason; /* 0Ch */
183 U8 Reserved3; /* 0Dh */
184 U16 IOCStatus; /* 0Eh */
185 U32 IOCLogInfo; /* 10h */
186 U32 ReplyWord; /* 14h */
187} MSG_TARGET_CMD_BUFFER_POST_ERROR_REPLY,
188 MPI_POINTER PTR_MSG_TARGET_CMD_BUFFER_POST_ERROR_REPLY,
189 TargetCmdBufferPostErrorReply_t, MPI_POINTER pTargetCmdBufferPostErrorReply_t;
190
191#define PRIORITY_REASON_NO_DISCONNECT (0x00)
192#define PRIORITY_REASON_SCSI_TASK_MANAGEMENT (0x01)
193#define PRIORITY_REASON_CMD_PARITY_ERR (0x02)
194#define PRIORITY_REASON_MSG_OUT_PARITY_ERR (0x03)
195#define PRIORITY_REASON_LQ_CRC_ERR (0x04)
196#define PRIORITY_REASON_CMD_CRC_ERR (0x05)
197#define PRIORITY_REASON_PROTOCOL_ERR (0x06)
198#define PRIORITY_REASON_DATA_OUT_PARITY_ERR (0x07)
199#define PRIORITY_REASON_DATA_OUT_CRC_ERR (0x08)
200#define PRIORITY_REASON_TARGET_BUSY (0x09)
201#define PRIORITY_REASON_UNKNOWN (0xFF)
202
203/****************************************************************************/
204/* Target Command Buffer Post Base Request */
205/****************************************************************************/
206
207typedef struct _MSG_TARGET_CMD_BUF_POST_BASE_REQUEST
208{
209 U8 BufferPostFlags; /* 00h */
210 U8 PortNumber; /* 01h */
211 U8 ChainOffset; /* 02h */
212 U8 Function; /* 03h */
213 U16 TotalCmdBuffers; /* 04h */
214 U8 Reserved; /* 06h */
215 U8 MsgFlags; /* 07h */
216 U32 MsgContext; /* 08h */
217 U32 Reserved1; /* 0Ch */
218 U16 CmdBufferLength; /* 10h */
219 U16 NextCmdBufferOffset; /* 12h */
220 U32 BaseAddressLow; /* 14h */
221 U32 BaseAddressHigh; /* 18h */
222} MSG_TARGET_CMD_BUF_POST_BASE_REQUEST,
223 MPI_POINTER PTR__MSG_TARGET_CMD_BUF_POST_BASE_REQUEST,
224 TargetCmdBufferPostBaseRequest_t,
225 MPI_POINTER pTargetCmdBufferPostBaseRequest_t;
226
227#define CMD_BUFFER_POST_BASE_FLAGS_AUTO_POST_ALL (0x01)
228
229typedef struct _MSG_TARGET_CMD_BUFFER_POST_BASE_LIST_REPLY
230{
231 U16 Reserved; /* 00h */
232 U8 MsgLength; /* 02h */
233 U8 Function; /* 03h */
234 U16 Reserved1; /* 04h */
235 U8 Reserved2; /* 06h */
236 U8 MsgFlags; /* 07h */
237 U32 MsgContext; /* 08h */
238 U16 Reserved3; /* 0Ch */
239 U16 IOCStatus; /* 0Eh */
240 U32 IOCLogInfo; /* 10h */
241} MSG_TARGET_CMD_BUFFER_POST_BASE_LIST_REPLY,
242 MPI_POINTER PTR_MSG_TARGET_CMD_BUFFER_POST_BASE_LIST_REPLY,
243 TargetCmdBufferPostBaseListReply_t,
244 MPI_POINTER pTargetCmdBufferPostBaseListReply_t;
245
246/****************************************************************************/
247/* Target Command Buffer Post List Request */
248/****************************************************************************/
249
250typedef struct _MSG_TARGET_CMD_BUF_POST_LIST_REQUEST
251{
252 U8 Reserved; /* 00h */
253 U8 PortNumber; /* 01h */
254 U8 ChainOffset; /* 02h */
255 U8 Function; /* 03h */
256 U16 CmdBufferCount; /* 04h */
257 U8 Reserved1; /* 06h */
258 U8 MsgFlags; /* 07h */
259 U32 MsgContext; /* 08h */
260 U32 Reserved2; /* 0Ch */
261 U16 IoIndex[2]; /* 10h */
262} MSG_TARGET_CMD_BUF_POST_LIST_REQUEST,
263 MPI_POINTER PTR_MSG_TARGET_CMD_BUF_POST_LIST_REQUEST,
264 TargetCmdBufferPostListRequest_t,
265 MPI_POINTER pTargetCmdBufferPostListRequest_t;
266
267/****************************************************************************/
268/* Command Buffer Formats (with 16 byte CDB) */
269/****************************************************************************/
270
271typedef struct _MPI_TARGET_FCP_CMD_BUFFER
272{
273 U8 FcpLun[8]; /* 00h */
274 U8 FcpCntl[4]; /* 08h */
275 U8 FcpCdb[16]; /* 0Ch */
276 U32 FcpDl; /* 1Ch */
277 U8 AliasIndex; /* 20h */
278 U8 Reserved1; /* 21h */
279 U16 OptionalOxid; /* 22h */
280} MPI_TARGET_FCP_CMD_BUFFER, MPI_POINTER PTR_MPI_TARGET_FCP_CMD_BUFFER,
281 MpiTargetFcpCmdBuffer, MPI_POINTER pMpiTargetFcpCmdBuffer;
282
283typedef struct _MPI_TARGET_SCSI_SPI_CMD_BUFFER
284{
285 /* SPI L_Q information unit */
286 U8 L_QType; /* 00h */
287 U8 Reserved; /* 01h */
288 U16 Tag; /* 02h */
289 U8 LogicalUnitNumber[8]; /* 04h */
290 U32 DataLength; /* 0Ch */
291 /* SPI command information unit */
292 U8 ReservedFirstByteOfCommandIU; /* 10h */
293 U8 TaskAttribute; /* 11h */
294 U8 TaskManagementFlags; /* 12h */
295 U8 AdditionalCDBLength; /* 13h */
296 U8 CDB[16]; /* 14h */
297 /* Alias ID */
298 U8 AliasID; /* 24h */
299 U8 Reserved1; /* 25h */
300 U16 Reserved2; /* 26h */
301} MPI_TARGET_SCSI_SPI_CMD_BUFFER,
302 MPI_POINTER PTR_MPI_TARGET_SCSI_SPI_CMD_BUFFER,
303 MpiTargetScsiSpiCmdBuffer, MPI_POINTER pMpiTargetScsiSpiCmdBuffer;
304
305typedef struct _MPI_TARGET_SSP_CMD_BUFFER
306{
307 U8 FrameType; /* 00h */
308 U8 Reserved1; /* 01h */
309 U16 Reserved2; /* 02h */
310 U16 InitiatorTag; /* 04h */
311 U16 DevHandle; /* 06h */
312 /* COMMAND information unit starts here */
313 U8 LogicalUnitNumber[8]; /* 08h */
314 U8 Reserved3; /* 10h */
315 U8 TaskAttribute; /* lower 3 bits */ /* 11h */
316 U8 Reserved4; /* 12h */
317 U8 AdditionalCDBLength; /* upper 5 bits */ /* 13h */
318 U8 CDB[16]; /* 14h */
319 /* Additional CDB bytes extend past the CDB field */
320} MPI_TARGET_SSP_CMD_BUFFER, MPI_POINTER PTR_MPI_TARGET_SSP_CMD_BUFFER,
321 MpiTargetSspCmdBuffer, MPI_POINTER pMpiTargetSspCmdBuffer;
322
323typedef struct _MPI_TARGET_SSP_TASK_BUFFER
324{
325 U8 FrameType; /* 00h */
326 U8 Reserved1; /* 01h */
327 U16 Reserved2; /* 02h */
328 U16 InitiatorTag; /* 04h */
329 U16 DevHandle; /* 06h */
330 /* TASK information unit starts here */
331 U8 LogicalUnitNumber[8]; /* 08h */
332 U8 Reserved3; /* 10h */
333 U8 Reserved4; /* 11h */
334 U8 TaskManagementFunction; /* 12h */
335 U8 Reserved5; /* 13h */
336 U16 ManagedTaskTag; /* 14h */
337 U16 Reserved6; /* 16h */
338 U32 Reserved7; /* 18h */
339 U32 Reserved8; /* 1Ch */
340 U32 Reserved9; /* 20h */
341} MPI_TARGET_SSP_TASK_BUFFER, MPI_POINTER PTR_MPI_TARGET_SSP_TASK_BUFFER,
342 MpiTargetSspTaskBuffer, MPI_POINTER pMpiTargetSspTaskBuffer;
343
344/****************************************************************************/
345/* Target Assist Request */
346/****************************************************************************/
347
348typedef struct _MSG_TARGET_ASSIST_REQUEST
349{
350 U8 StatusCode; /* 00h */
351 U8 TargetAssistFlags; /* 01h */
352 U8 ChainOffset; /* 02h */
353 U8 Function; /* 03h */
354 U16 QueueTag; /* 04h */
355 U8 Reserved; /* 06h */
356 U8 MsgFlags; /* 07h */
357 U32 MsgContext; /* 08h */
358 U32 ReplyWord; /* 0Ch */
359 U8 LUN[8]; /* 10h */
360 U32 RelativeOffset; /* 18h */
361 U32 DataLength; /* 1Ch */
362 SGE_IO_UNION SGL[1]; /* 20h */
363} MSG_TARGET_ASSIST_REQUEST, MPI_POINTER PTR_MSG_TARGET_ASSIST_REQUEST,
364 TargetAssistRequest_t, MPI_POINTER pTargetAssistRequest_t;
365
366#define TARGET_ASSIST_FLAGS_DATA_DIRECTION (0x01)
367#define TARGET_ASSIST_FLAGS_AUTO_STATUS (0x02)
368#define TARGET_ASSIST_FLAGS_HIGH_PRIORITY (0x04)
369#define TARGET_ASSIST_FLAGS_CONFIRMED (0x08)
370#define TARGET_ASSIST_FLAGS_REPOST_CMD_BUFFER (0x80)
371
372/* Standard Target Mode Reply message */
373typedef struct _MSG_TARGET_ERROR_REPLY
374{
375 U16 Reserved; /* 00h */
376 U8 MsgLength; /* 02h */
377 U8 Function; /* 03h */
378 U16 Reserved1; /* 04h */
379 U8 Reserved2; /* 06h */
380 U8 MsgFlags; /* 07h */
381 U32 MsgContext; /* 08h */
382 U8 PriorityReason; /* 0Ch */
383 U8 Reserved3; /* 0Dh */
384 U16 IOCStatus; /* 0Eh */
385 U32 IOCLogInfo; /* 10h */
386 U32 ReplyWord; /* 14h */
387 U32 TransferCount; /* 18h */
388} MSG_TARGET_ERROR_REPLY, MPI_POINTER PTR_MSG_TARGET_ERROR_REPLY,
389 TargetErrorReply_t, MPI_POINTER pTargetErrorReply_t;
390
391/****************************************************************************/
392/* Target Assist Extended Request */
393/****************************************************************************/
394
395typedef struct _MSG_TARGET_ASSIST_EXT_REQUEST
396{
397 U8 StatusCode; /* 00h */
398 U8 TargetAssistFlags; /* 01h */
399 U8 ChainOffset; /* 02h */
400 U8 Function; /* 03h */
401 U16 QueueTag; /* 04h */
402 U8 Reserved1; /* 06h */
403 U8 MsgFlags; /* 07h */
404 U32 MsgContext; /* 08h */
405 U32 ReplyWord; /* 0Ch */
406 U8 LUN[8]; /* 10h */
407 U32 RelativeOffset; /* 18h */
408 U32 Reserved2; /* 1Ch */
409 U32 Reserved3; /* 20h */
410 U32 PrimaryReferenceTag; /* 24h */
411 U16 PrimaryApplicationTag; /* 28h */
412 U16 PrimaryApplicationTagMask; /* 2Ah */
413 U32 Reserved4; /* 2Ch */
414 U32 DataLength; /* 30h */
415 U32 BidirectionalDataLength; /* 34h */
416 U32 SecondaryReferenceTag; /* 38h */
417 U16 SecondaryApplicationTag; /* 3Ch */
418 U16 Reserved5; /* 3Eh */
419 U16 EEDPFlags; /* 40h */
420 U16 ApplicationTagTranslationMask; /* 42h */
421 U32 EEDPBlockSize; /* 44h */
422 U8 SGLOffset0; /* 48h */
423 U8 SGLOffset1; /* 49h */
424 U8 SGLOffset2; /* 4Ah */
425 U8 SGLOffset3; /* 4Bh */
426 U32 Reserved6; /* 4Ch */
427 SGE_IO_UNION SGL[1]; /* 50h */
428} MSG_TARGET_ASSIST_EXT_REQUEST, MPI_POINTER PTR_MSG_TARGET_ASSIST_EXT_REQUEST,
429 TargetAssistExtRequest_t, MPI_POINTER pTargetAssistExtRequest_t;
430
431/* see the defines after MSG_TARGET_ASSIST_REQUEST for TargetAssistFlags */
432
433/* defines for the MsgFlags field */
434#define TARGET_ASSIST_EXT_MSGFLAGS_BIDIRECTIONAL (0x20)
435#define TARGET_ASSIST_EXT_MSGFLAGS_MULTICAST (0x10)
436#define TARGET_ASSIST_EXT_MSGFLAGS_SGL_OFFSET_CHAINS (0x08)
437
438/* defines for the EEDPFlags field */
439#define TARGET_ASSIST_EXT_EEDP_MASK_OP (0x0007)
440#define TARGET_ASSIST_EXT_EEDP_NOOP_OP (0x0000)
441#define TARGET_ASSIST_EXT_EEDP_CHK_OP (0x0001)
442#define TARGET_ASSIST_EXT_EEDP_STRIP_OP (0x0002)
443#define TARGET_ASSIST_EXT_EEDP_CHKRM_OP (0x0003)
444#define TARGET_ASSIST_EXT_EEDP_INSERT_OP (0x0004)
445#define TARGET_ASSIST_EXT_EEDP_REPLACE_OP (0x0006)
446#define TARGET_ASSIST_EXT_EEDP_CHKREGEN_OP (0x0007)
447
448#define TARGET_ASSIST_EXT_EEDP_PASS_REF_TAG (0x0008)
449
450#define TARGET_ASSIST_EXT_EEDP_T10_CHK_MASK (0x0700)
451#define TARGET_ASSIST_EXT_EEDP_T10_CHK_GUARD (0x0100)
452#define TARGET_ASSIST_EXT_EEDP_T10_CHK_APPTAG (0x0200)
453#define TARGET_ASSIST_EXT_EEDP_T10_CHK_REFTAG (0x0400)
454#define TARGET_ASSIST_EXT_EEDP_T10_CHK_SHIFT (8)
455
456#define TARGET_ASSIST_EXT_EEDP_INC_SEC_APPTAG (0x1000)
457#define TARGET_ASSIST_EXT_EEDP_INC_PRI_APPTAG (0x2000)
458#define TARGET_ASSIST_EXT_EEDP_INC_SEC_REFTAG (0x4000)
459#define TARGET_ASSIST_EXT_EEDP_INC_PRI_REFTAG (0x8000)
460
461/****************************************************************************/
462/* Target Status Send Request */
463/****************************************************************************/
464
465typedef struct _MSG_TARGET_STATUS_SEND_REQUEST
466{
467 U8 StatusCode; /* 00h */
468 U8 StatusFlags; /* 01h */
469 U8 ChainOffset; /* 02h */
470 U8 Function; /* 03h */
471 U16 QueueTag; /* 04h */
472 U8 Reserved; /* 06h */
473 U8 MsgFlags; /* 07h */
474 U32 MsgContext; /* 08h */
475 U32 ReplyWord; /* 0Ch */
476 U8 LUN[8]; /* 10h */
477 SGE_SIMPLE_UNION StatusDataSGE; /* 18h */
478} MSG_TARGET_STATUS_SEND_REQUEST, MPI_POINTER PTR_MSG_TARGET_STATUS_SEND_REQUEST,
479 TargetStatusSendRequest_t, MPI_POINTER pTargetStatusSendRequest_t;
480
481#define TARGET_STATUS_SEND_FLAGS_AUTO_GOOD_STATUS (0x01)
482#define TARGET_STATUS_SEND_FLAGS_HIGH_PRIORITY (0x04)
483#define TARGET_STATUS_SEND_FLAGS_CONFIRMED (0x08)
484#define TARGET_STATUS_SEND_FLAGS_REPOST_CMD_BUFFER (0x80)
485
486/*
487 * NOTE: FCP_RSP data is big-endian. When used on a little-endian system, this
488 * structure properly orders the bytes.
489 */
490typedef struct _MPI_TARGET_FCP_RSP_BUFFER
491{
492 U8 Reserved0[8]; /* 00h */
493 U8 Reserved1[2]; /* 08h */
494 U8 FcpFlags; /* 0Ah */
495 U8 FcpStatus; /* 0Bh */
496 U32 FcpResid; /* 0Ch */
497 U32 FcpSenseLength; /* 10h */
498 U32 FcpResponseLength; /* 14h */
499 U8 FcpResponseData[8]; /* 18h */
500 U8 FcpSenseData[32]; /* Pad to 64 bytes */ /* 20h */
501} MPI_TARGET_FCP_RSP_BUFFER, MPI_POINTER PTR_MPI_TARGET_FCP_RSP_BUFFER,
502 MpiTargetFcpRspBuffer, MPI_POINTER pMpiTargetFcpRspBuffer;
503
504/*
505 * NOTE: The SPI status IU is big-endian. When used on a little-endian system,
506 * this structure properly orders the bytes.
507 */
508typedef struct _MPI_TARGET_SCSI_SPI_STATUS_IU
509{
510 U8 Reserved0; /* 00h */
511 U8 Reserved1; /* 01h */
512 U8 Valid; /* 02h */
513 U8 Status; /* 03h */
514 U32 SenseDataListLength; /* 04h */
515 U32 PktFailuresListLength; /* 08h */
516 U8 SenseData[52]; /* Pad the IU to 64 bytes */ /* 0Ch */
517} MPI_TARGET_SCSI_SPI_STATUS_IU, MPI_POINTER PTR_MPI_TARGET_SCSI_SPI_STATUS_IU,
518 TargetScsiSpiStatusIU_t, MPI_POINTER pTargetScsiSpiStatusIU_t;
519
520/*
521 * NOTE: The SSP status IU is big-endian. When used on a little-endian system,
522 * this structure properly orders the bytes.
523 */
524typedef struct _MPI_TARGET_SSP_RSP_IU
525{
526 U32 Reserved0[6]; /* reserved for SSP header */ /* 00h */
527 /* start of RESPONSE information unit */
528 U32 Reserved1; /* 18h */
529 U32 Reserved2; /* 1Ch */
530 U16 Reserved3; /* 20h */
531 U8 DataPres; /* lower 2 bits */ /* 22h */
532 U8 Status; /* 23h */
533 U32 Reserved4; /* 24h */
534 U32 SenseDataLength; /* 28h */
535 U32 ResponseDataLength; /* 2Ch */
536 U8 ResponseSenseData[4]; /* 30h */
537} MPI_TARGET_SSP_RSP_IU, MPI_POINTER PTR_MPI_TARGET_SSP_RSP_IU,
538 MpiTargetSspRspIu_t, MPI_POINTER pMpiTargetSspRspIu_t;
539
540/****************************************************************************/
541/* Target Mode Abort Request */
542/****************************************************************************/
543
544typedef struct _MSG_TARGET_MODE_ABORT_REQUEST
545{
546 U8 AbortType; /* 00h */
547 U8 Reserved; /* 01h */
548 U8 ChainOffset; /* 02h */
549 U8 Function; /* 03h */
550 U16 Reserved1; /* 04h */
551 U8 Reserved2; /* 06h */
552 U8 MsgFlags; /* 07h */
553 U32 MsgContext; /* 08h */
554 U32 ReplyWord; /* 0Ch */
555 U32 MsgContextToAbort; /* 10h */
556} MSG_TARGET_MODE_ABORT, MPI_POINTER PTR_MSG_TARGET_MODE_ABORT,
557 TargetModeAbort_t, MPI_POINTER pTargetModeAbort_t;
558
559#define TARGET_MODE_ABORT_TYPE_ALL_CMD_BUFFERS (0x00)
560#define TARGET_MODE_ABORT_TYPE_ALL_IO (0x01)
561#define TARGET_MODE_ABORT_TYPE_EXACT_IO (0x02)
562#define TARGET_MODE_ABORT_TYPE_EXACT_IO_REQUEST (0x03)
563
564/* Target Mode Abort Reply */
565
566typedef struct _MSG_TARGET_MODE_ABORT_REPLY
567{
568 U16 Reserved; /* 00h */
569 U8 MsgLength; /* 02h */
570 U8 Function; /* 03h */
571 U16 Reserved1; /* 04h */
572 U8 Reserved2; /* 06h */
573 U8 MsgFlags; /* 07h */
574 U32 MsgContext; /* 08h */
575 U16 Reserved3; /* 0Ch */
576 U16 IOCStatus; /* 0Eh */
577 U32 IOCLogInfo; /* 10h */
578 U32 AbortCount; /* 14h */
579} MSG_TARGET_MODE_ABORT_REPLY, MPI_POINTER PTR_MSG_TARGET_MODE_ABORT_REPLY,
580 TargetModeAbortReply_t, MPI_POINTER pTargetModeAbortReply_t;
581
582/****************************************************************************/
583/* Target Mode Context Reply */
584/****************************************************************************/
585
586#define TARGET_MODE_REPLY_IO_INDEX_MASK (0x00003FFF)
587#define TARGET_MODE_REPLY_IO_INDEX_SHIFT (0)
588#define TARGET_MODE_REPLY_INITIATOR_INDEX_MASK (0x03FFC000)
589#define TARGET_MODE_REPLY_INITIATOR_INDEX_SHIFT (14)
590#define TARGET_MODE_REPLY_ALIAS_MASK (0x04000000)
591#define TARGET_MODE_REPLY_ALIAS_SHIFT (26)
592#define TARGET_MODE_REPLY_PORT_MASK (0x10000000)
593#define TARGET_MODE_REPLY_PORT_SHIFT (28)
594
595#define GET_IO_INDEX(x) (((x) & TARGET_MODE_REPLY_IO_INDEX_MASK) \
596 >> TARGET_MODE_REPLY_IO_INDEX_SHIFT)
597
598#define SET_IO_INDEX(t, i) \
599 ((t) = ((t) & ~TARGET_MODE_REPLY_IO_INDEX_MASK) | \
600 (((i) << TARGET_MODE_REPLY_IO_INDEX_SHIFT) & \
601 TARGET_MODE_REPLY_IO_INDEX_MASK))
602
603#define GET_INITIATOR_INDEX(x) (((x) & TARGET_MODE_REPLY_INITIATOR_INDEX_MASK) \
604 >> TARGET_MODE_REPLY_INITIATOR_INDEX_SHIFT)
605
606#define SET_INITIATOR_INDEX(t, ii) \
607 ((t) = ((t) & ~TARGET_MODE_REPLY_INITIATOR_INDEX_MASK) | \
608 (((ii) << TARGET_MODE_REPLY_INITIATOR_INDEX_SHIFT) & \
609 TARGET_MODE_REPLY_INITIATOR_INDEX_MASK))
610
611#define GET_ALIAS(x) (((x) & TARGET_MODE_REPLY_ALIAS_MASK) \
612 >> TARGET_MODE_REPLY_ALIAS_SHIFT)
613
614#define SET_ALIAS(t, a) ((t) = ((t) & ~TARGET_MODE_REPLY_ALIAS_MASK) | \
615 (((a) << TARGET_MODE_REPLY_ALIAS_SHIFT) & \
616 TARGET_MODE_REPLY_ALIAS_MASK))
617
618#define GET_PORT(x) (((x) & TARGET_MODE_REPLY_PORT_MASK) \
619 >> TARGET_MODE_REPLY_PORT_SHIFT)
620
621#define SET_PORT(t, p) ((t) = ((t) & ~TARGET_MODE_REPLY_PORT_MASK) | \
622 (((p) << TARGET_MODE_REPLY_PORT_SHIFT) & \
623 TARGET_MODE_REPLY_PORT_MASK))
624
625/* the following obsolete values are for MPI v1.0 support */
626#define TARGET_MODE_REPLY_0100_MASK_HOST_INDEX (0x000003FF)
627#define TARGET_MODE_REPLY_0100_SHIFT_HOST_INDEX (0)
628#define TARGET_MODE_REPLY_0100_MASK_IOC_INDEX (0x001FF800)
629#define TARGET_MODE_REPLY_0100_SHIFT_IOC_INDEX (11)
630#define TARGET_MODE_REPLY_0100_PORT_MASK (0x00400000)
631#define TARGET_MODE_REPLY_0100_PORT_SHIFT (22)
632#define TARGET_MODE_REPLY_0100_MASK_INITIATOR_INDEX (0x1F800000)
633#define TARGET_MODE_REPLY_0100_SHIFT_INITIATOR_INDEX (23)
634
635#define GET_HOST_INDEX_0100(x) (((x) & TARGET_MODE_REPLY_0100_MASK_HOST_INDEX) \
636 >> TARGET_MODE_REPLY_0100_SHIFT_HOST_INDEX)
637
638#define SET_HOST_INDEX_0100(t, hi) \
639 ((t) = ((t) & ~TARGET_MODE_REPLY_0100_MASK_HOST_INDEX) | \
640 (((hi) << TARGET_MODE_REPLY_0100_SHIFT_HOST_INDEX) & \
641 TARGET_MODE_REPLY_0100_MASK_HOST_INDEX))
642
643#define GET_IOC_INDEX_0100(x) (((x) & TARGET_MODE_REPLY_0100_MASK_IOC_INDEX) \
644 >> TARGET_MODE_REPLY_0100_SHIFT_IOC_INDEX)
645
646#define SET_IOC_INDEX_0100(t, ii) \
647 ((t) = ((t) & ~TARGET_MODE_REPLY_0100_MASK_IOC_INDEX) | \
648 (((ii) << TARGET_MODE_REPLY_0100_SHIFT_IOC_INDEX) & \
649 TARGET_MODE_REPLY_0100_MASK_IOC_INDEX))
650
651#define GET_INITIATOR_INDEX_0100(x) \
652 (((x) & TARGET_MODE_REPLY_0100_MASK_INITIATOR_INDEX) \
653 >> TARGET_MODE_REPLY_0100_SHIFT_INITIATOR_INDEX)
654
655#define SET_INITIATOR_INDEX_0100(t, ii) \
656 ((t) = ((t) & ~TARGET_MODE_REPLY_0100_MASK_INITIATOR_INDEX) | \
657 (((ii) << TARGET_MODE_REPLY_0100_SHIFT_INITIATOR_INDEX) & \
658 TARGET_MODE_REPLY_0100_MASK_INITIATOR_INDEX))
659
660#endif