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