1 /* $FreeBSD$ */ 2 /* 3 * Copyright (c) 2000-2008 LSI Corporation. 4 * 5 * 6 * Name: mpi2_targ.h 7 * Title: MPI Target mode messages and structures 8 * Creation Date: September 8, 2006 9 * 10 * mpi2_targ.h Version: 02.00.03 11 * 12 * Version History 13 * --------------- 14 * 15 * Date Version Description 16 * -------- -------- ------------------------------------------------------ 17 * 04-30-07 02.00.00 Corresponds to Fusion-MPT MPI Specification Rev A. 18 * 08-31-07 02.00.01 Added Command Buffer Data Location Address Space bits to 19 * BufferPostFlags field of CommandBufferPostBase Request. 20 * 02-29-08 02.00.02 Modified various names to make them 32-character unique. 21 * 10-02-08 02.00.03 Removed NextCmdBufferOffset from 22 * MPI2_TARGET_CMD_BUF_POST_BASE_REQUEST. 23 * Target Status Send Request only takes a single SGE for 24 * response data. 25 * -------------------------------------------------------------------------- 26 */ 27 28 #ifndef MPI2_TARG_H 29 #define MPI2_TARG_H 30 31 32 /****************************************************************************** 33 * 34 * SCSI Target Messages 35 * 36 *******************************************************************************/ 37 38 /**************************************************************************** 39 * Target Command Buffer Post Base Request 40 ****************************************************************************/ 41 42 typedef struct _MPI2_TARGET_CMD_BUF_POST_BASE_REQUEST 43 { 44 U8 BufferPostFlags; /* 0x00 */ 45 U8 Reserved1; /* 0x01 */ 46 U8 ChainOffset; /* 0x02 */ 47 U8 Function; /* 0x03 */ 48 U16 TotalCmdBuffers; /* 0x04 */ 49 U8 Reserved; /* 0x06 */ 50 U8 MsgFlags; /* 0x07 */ 51 U8 VP_ID; /* 0x08 */ 52 U8 VF_ID; /* 0x09 */ 53 U16 Reserved2; /* 0x0A */ 54 U32 Reserved3; /* 0x0C */ 55 U16 CmdBufferLength; /* 0x10 */ 56 U16 Reserved4; /* 0x12 */ 57 U32 BaseAddressLow; /* 0x14 */ 58 U32 BaseAddressHigh; /* 0x18 */ 59 } MPI2_TARGET_CMD_BUF_POST_BASE_REQUEST, 60 MPI2_POINTER PTR_MPI2_TARGET_CMD_BUF_POST_BASE_REQUEST, 61 Mpi2TargetCmdBufferPostBaseRequest_t, 62 MPI2_POINTER pMpi2TargetCmdBufferPostBaseRequest_t; 63 64 /* values for the BufferPostflags field */ 65 #define MPI2_CMD_BUF_POST_BASE_ADDRESS_SPACE_MASK (0x0C) 66 #define MPI2_CMD_BUF_POST_BASE_SYSTEM_ADDRESS_SPACE (0x00) 67 #define MPI2_CMD_BUF_POST_BASE_IOCDDR_ADDRESS_SPACE (0x04) 68 #define MPI2_CMD_BUF_POST_BASE_IOCPLB_ADDRESS_SPACE (0x08) 69 #define MPI2_CMD_BUF_POST_BASE_IOCPLBNTA_ADDRESS_SPACE (0x0C) 70 71 #define MPI2_CMD_BUF_POST_BASE_FLAGS_AUTO_POST_ALL (0x01) 72 73 74 /**************************************************************************** 75 * Target Command Buffer Post List Request 76 ****************************************************************************/ 77 78 typedef struct _MPI2_TARGET_CMD_BUF_POST_LIST_REQUEST 79 { 80 U16 Reserved; /* 0x00 */ 81 U8 ChainOffset; /* 0x02 */ 82 U8 Function; /* 0x03 */ 83 U16 CmdBufferCount; /* 0x04 */ 84 U8 Reserved1; /* 0x06 */ 85 U8 MsgFlags; /* 0x07 */ 86 U8 VP_ID; /* 0x08 */ 87 U8 VF_ID; /* 0x09 */ 88 U16 Reserved2; /* 0x0A */ 89 U32 Reserved3; /* 0x0C */ 90 U16 IoIndex[2]; /* 0x10 */ 91 } MPI2_TARGET_CMD_BUF_POST_LIST_REQUEST, 92 MPI2_POINTER PTR_MPI2_TARGET_CMD_BUF_POST_LIST_REQUEST, 93 Mpi2TargetCmdBufferPostListRequest_t, 94 MPI2_POINTER pMpi2TargetCmdBufferPostListRequest_t; 95 96 /**************************************************************************** 97 * Target Command Buffer Post Base List Reply 98 ****************************************************************************/ 99 100 typedef struct _MPI2_TARGET_BUF_POST_BASE_LIST_REPLY 101 { 102 U8 Flags; /* 0x00 */ 103 U8 Reserved; /* 0x01 */ 104 U8 MsgLength; /* 0x02 */ 105 U8 Function; /* 0x03 */ 106 U16 Reserved1; /* 0x04 */ 107 U8 Reserved2; /* 0x06 */ 108 U8 MsgFlags; /* 0x07 */ 109 U8 VP_ID; /* 0x08 */ 110 U8 VF_ID; /* 0x09 */ 111 U16 Reserved3; /* 0x0A */ 112 U16 Reserved4; /* 0x0C */ 113 U16 IOCStatus; /* 0x0E */ 114 U32 IOCLogInfo; /* 0x10 */ 115 U16 IoIndex; /* 0x14 */ 116 U16 Reserved5; /* 0x16 */ 117 U32 Reserved6; /* 0x18 */ 118 } MPI2_TARGET_BUF_POST_BASE_LIST_REPLY, 119 MPI2_POINTER PTR_MPI2_TARGET_BUF_POST_BASE_LIST_REPLY, 120 Mpi2TargetCmdBufferPostBaseListReply_t, 121 MPI2_POINTER pMpi2TargetCmdBufferPostBaseListReply_t; 122 123 /* Flags defines */ 124 #define MPI2_CMD_BUF_POST_REPLY_IOINDEX_VALID (0x01) 125 126 127 /**************************************************************************** 128 * Command Buffer Formats (with 16 byte CDB) 129 ****************************************************************************/ 130 131 typedef struct _MPI2_TARGET_SSP_CMD_BUFFER 132 { 133 U8 FrameType; /* 0x00 */ 134 U8 Reserved1; /* 0x01 */ 135 U16 InitiatorConnectionTag; /* 0x02 */ 136 U32 HashedSourceSASAddress; /* 0x04 */ 137 U16 Reserved2; /* 0x08 */ 138 U16 Flags; /* 0x0A */ 139 U32 Reserved3; /* 0x0C */ 140 U16 Tag; /* 0x10 */ 141 U16 TargetPortTransferTag; /* 0x12 */ 142 U32 DataOffset; /* 0x14 */ 143 /* COMMAND information unit starts here */ 144 U8 LogicalUnitNumber[8]; /* 0x18 */ 145 U8 Reserved4; /* 0x20 */ 146 U8 TaskAttribute; /* lower 3 bits */ /* 0x21 */ 147 U8 Reserved5; /* 0x22 */ 148 U8 AdditionalCDBLength; /* upper 5 bits */ /* 0x23 */ 149 U8 CDB[16]; /* 0x24 */ 150 /* Additional CDB bytes extend past the CDB field */ 151 } MPI2_TARGET_SSP_CMD_BUFFER, MPI2_POINTER PTR_MPI2_TARGET_SSP_CMD_BUFFER, 152 Mpi2TargetSspCmdBuffer, MPI2_POINTER pMp2iTargetSspCmdBuffer; 153 154 typedef struct _MPI2_TARGET_SSP_TASK_BUFFER 155 { 156 U8 FrameType; /* 0x00 */ 157 U8 Reserved1; /* 0x01 */ 158 U16 InitiatorConnectionTag; /* 0x02 */ 159 U32 HashedSourceSASAddress; /* 0x04 */ 160 U16 Reserved2; /* 0x08 */ 161 U16 Flags; /* 0x0A */ 162 U32 Reserved3; /* 0x0C */ 163 U16 Tag; /* 0x10 */ 164 U16 TargetPortTransferTag; /* 0x12 */ 165 U32 DataOffset; /* 0x14 */ 166 /* TASK information unit starts here */ 167 U8 LogicalUnitNumber[8]; /* 0x18 */ 168 U16 Reserved4; /* 0x20 */ 169 U8 TaskManagementFunction; /* 0x22 */ 170 U8 Reserved5; /* 0x23 */ 171 U16 ManagedTaskTag; /* 0x24 */ 172 U16 Reserved6; /* 0x26 */ 173 U32 Reserved7; /* 0x28 */ 174 U32 Reserved8; /* 0x2C */ 175 U32 Reserved9; /* 0x30 */ 176 } MPI2_TARGET_SSP_TASK_BUFFER, MPI2_POINTER PTR_MPI2_TARGET_SSP_TASK_BUFFER, 177 Mpi2TargetSspTaskBuffer, MPI2_POINTER pMpi2TargetSspTaskBuffer; 178 179 /* mask and shift for HashedSourceSASAddress field */ 180 #define MPI2_TARGET_HASHED_SAS_ADDRESS_MASK (0xFFFFFF00) 181 #define MPI2_TARGET_HASHED_SAS_ADDRESS_SHIFT (8) 182 183 184 /**************************************************************************** 185 * Target Assist Request 186 ****************************************************************************/ 187 188 typedef struct _MPI2_TARGET_ASSIST_REQUEST 189 { 190 U8 Reserved1; /* 0x00 */ 191 U8 TargetAssistFlags; /* 0x01 */ 192 U8 ChainOffset; /* 0x02 */ 193 U8 Function; /* 0x03 */ 194 U16 QueueTag; /* 0x04 */ 195 U8 Reserved2; /* 0x06 */ 196 U8 MsgFlags; /* 0x07 */ 197 U8 VP_ID; /* 0x08 */ 198 U8 VF_ID; /* 0x09 */ 199 U16 Reserved3; /* 0x0A */ 200 U16 IoIndex; /* 0x0C */ 201 U16 InitiatorConnectionTag; /* 0x0E */ 202 U16 SGLFlags; /* 0x10 */ 203 U8 SequenceNumber; /* 0x12 */ 204 U8 Reserved4; /* 0x13 */ 205 U8 SGLOffset0; /* 0x14 */ 206 U8 SGLOffset1; /* 0x15 */ 207 U8 SGLOffset2; /* 0x16 */ 208 U8 SGLOffset3; /* 0x17 */ 209 U32 SkipCount; /* 0x18 */ 210 U32 DataLength; /* 0x1C */ 211 U32 BidirectionalDataLength; /* 0x20 */ 212 U16 IoFlags; /* 0x24 */ 213 U16 EEDPFlags; /* 0x26 */ 214 U32 EEDPBlockSize; /* 0x28 */ 215 U32 SecondaryReferenceTag; /* 0x2C */ 216 U16 SecondaryApplicationTag; /* 0x30 */ 217 U16 ApplicationTagTranslationMask; /* 0x32 */ 218 U32 PrimaryReferenceTag; /* 0x34 */ 219 U16 PrimaryApplicationTag; /* 0x38 */ 220 U16 PrimaryApplicationTagMask; /* 0x3A */ 221 U32 RelativeOffset; /* 0x3C */ 222 U32 Reserved5; /* 0x40 */ 223 U32 Reserved6; /* 0x44 */ 224 U32 Reserved7; /* 0x48 */ 225 U32 Reserved8; /* 0x4C */ 226 MPI2_SGE_IO_UNION SGL[1]; /* 0x50 */ 227 } MPI2_TARGET_ASSIST_REQUEST, MPI2_POINTER PTR_MPI2_TARGET_ASSIST_REQUEST, 228 Mpi2TargetAssistRequest_t, MPI2_POINTER pMpi2TargetAssistRequest_t; 229 230 /* Target Assist TargetAssistFlags bits */ 231 232 #define MPI2_TARGET_ASSIST_FLAGS_REPOST_CMD_BUFFER (0x80) 233 #define MPI2_TARGET_ASSIST_FLAGS_TLR (0x10) 234 #define MPI2_TARGET_ASSIST_FLAGS_RETRANSMIT (0x04) 235 #define MPI2_TARGET_ASSIST_FLAGS_AUTO_STATUS (0x02) 236 #define MPI2_TARGET_ASSIST_FLAGS_DATA_DIRECTION (0x01) 237 238 /* Target Assist SGLFlags bits */ 239 240 /* base values for Data Location Address Space */ 241 #define MPI2_TARGET_ASSIST_SGLFLAGS_ADDR_MASK (0x0C) 242 #define MPI2_TARGET_ASSIST_SGLFLAGS_SYSTEM_ADDR (0x00) 243 #define MPI2_TARGET_ASSIST_SGLFLAGS_IOCDDR_ADDR (0x04) 244 #define MPI2_TARGET_ASSIST_SGLFLAGS_IOCPLB_ADDR (0x08) 245 #define MPI2_TARGET_ASSIST_SGLFLAGS_PLBNTA_ADDR (0x0C) 246 247 /* base values for Type */ 248 #define MPI2_TARGET_ASSIST_SGLFLAGS_TYPE_MASK (0x03) 249 #define MPI2_TARGET_ASSIST_SGLFLAGS_MPI_TYPE (0x00) 250 #define MPI2_TARGET_ASSIST_SGLFLAGS_32IEEE_TYPE (0x01) 251 #define MPI2_TARGET_ASSIST_SGLFLAGS_64IEEE_TYPE (0x02) 252 253 /* shift values for each sub-field */ 254 #define MPI2_TARGET_ASSIST_SGLFLAGS_SGL3_SHIFT (12) 255 #define MPI2_TARGET_ASSIST_SGLFLAGS_SGL2_SHIFT (8) 256 #define MPI2_TARGET_ASSIST_SGLFLAGS_SGL1_SHIFT (4) 257 #define MPI2_TARGET_ASSIST_SGLFLAGS_SGL0_SHIFT (0) 258 259 /* Target Assist IoFlags bits */ 260 261 #define MPI2_TARGET_ASSIST_IOFLAGS_BIDIRECTIONAL (0x0800) 262 #define MPI2_TARGET_ASSIST_IOFLAGS_MULTICAST (0x0400) 263 #define MPI2_TARGET_ASSIST_IOFLAGS_RECEIVE_FIRST (0x0200) 264 265 /* Target Assist EEDPFlags bits */ 266 267 #define MPI2_TA_EEDPFLAGS_INC_PRI_REFTAG (0x8000) 268 #define MPI2_TA_EEDPFLAGS_INC_SEC_REFTAG (0x4000) 269 #define MPI2_TA_EEDPFLAGS_INC_PRI_APPTAG (0x2000) 270 #define MPI2_TA_EEDPFLAGS_INC_SEC_APPTAG (0x1000) 271 272 #define MPI2_TA_EEDPFLAGS_CHECK_REFTAG (0x0400) 273 #define MPI2_TA_EEDPFLAGS_CHECK_APPTAG (0x0200) 274 #define MPI2_TA_EEDPFLAGS_CHECK_GUARD (0x0100) 275 276 #define MPI2_TA_EEDPFLAGS_PASSTHRU_REFTAG (0x0008) 277 278 #define MPI2_TA_EEDPFLAGS_MASK_OP (0x0007) 279 #define MPI2_TA_EEDPFLAGS_NOOP_OP (0x0000) 280 #define MPI2_TA_EEDPFLAGS_CHECK_OP (0x0001) 281 #define MPI2_TA_EEDPFLAGS_STRIP_OP (0x0002) 282 #define MPI2_TA_EEDPFLAGS_CHECK_REMOVE_OP (0x0003) 283 #define MPI2_TA_EEDPFLAGS_INSERT_OP (0x0004) 284 #define MPI2_TA_EEDPFLAGS_REPLACE_OP (0x0006) 285 #define MPI2_TA_EEDPFLAGS_CHECK_REGEN_OP (0x0007) 286 287 288 /**************************************************************************** 289 * Target Status Send Request 290 ****************************************************************************/ 291 292 typedef struct _MPI2_TARGET_STATUS_SEND_REQUEST 293 { 294 U8 Reserved1; /* 0x00 */ 295 U8 StatusFlags; /* 0x01 */ 296 U8 ChainOffset; /* 0x02 */ 297 U8 Function; /* 0x03 */ 298 U16 QueueTag; /* 0x04 */ 299 U8 Reserved2; /* 0x06 */ 300 U8 MsgFlags; /* 0x07 */ 301 U8 VP_ID; /* 0x08 */ 302 U8 VF_ID; /* 0x09 */ 303 U16 Reserved3; /* 0x0A */ 304 U16 IoIndex; /* 0x0C */ 305 U16 InitiatorConnectionTag; /* 0x0E */ 306 U16 SGLFlags; /* 0x10 */ 307 U16 Reserved4; /* 0x12 */ 308 U8 SGLOffset0; /* 0x14 */ 309 U8 Reserved5; /* 0x15 */ 310 U16 Reserved6; /* 0x16 */ 311 U32 Reserved7; /* 0x18 */ 312 U32 Reserved8; /* 0x1C */ 313 MPI2_SIMPLE_SGE_UNION StatusDataSGE; /* 0x20 */ 314 } MPI2_TARGET_STATUS_SEND_REQUEST, 315 MPI2_POINTER PTR_MPI2_TARGET_STATUS_SEND_REQUEST, 316 Mpi2TargetStatusSendRequest_t, MPI2_POINTER pMpi2TargetStatusSendRequest_t; 317 318 /* Target Status Send StatusFlags bits */ 319 320 #define MPI2_TSS_FLAGS_REPOST_CMD_BUFFER (0x80) 321 #define MPI2_TSS_FLAGS_RETRANSMIT (0x04) 322 #define MPI2_TSS_FLAGS_AUTO_GOOD_STATUS (0x01) 323 324 /* Target Status Send SGLFlags bits */ 325 /* Data Location Address Space */ 326 #define MPI2_TSS_SGLFLAGS_ADDR_MASK (0x0C) 327 #define MPI2_TSS_SGLFLAGS_SYSTEM_ADDR (0x00) 328 #define MPI2_TSS_SGLFLAGS_IOCDDR_ADDR (0x04) 329 #define MPI2_TSS_SGLFLAGS_IOCPLB_ADDR (0x08) 330 #define MPI2_TSS_SGLFLAGS_IOCPLBNTA_ADDR (0x0C) 331 /* Type */ 332 #define MPI2_TSS_SGLFLAGS_TYPE_MASK (0x03) 333 #define MPI2_TSS_SGLFLAGS_MPI_TYPE (0x00) 334 #define MPI2_TSS_SGLFLAGS_IEEE32_TYPE (0x01) 335 #define MPI2_TSS_SGLFLAGS_IEEE64_TYPE (0x02) 336 337 338 339 /* 340 * NOTE: The SSP status IU is big-endian. When used on a little-endian system, 341 * this structure properly orders the bytes. 342 */ 343 typedef struct _MPI2_TARGET_SSP_RSP_IU 344 { 345 U32 Reserved0[6]; /* reserved for SSP header */ /* 0x00 */ 346 /* start of RESPONSE information unit */ 347 U32 Reserved1; /* 0x18 */ 348 U32 Reserved2; /* 0x1C */ 349 U16 Reserved3; /* 0x20 */ 350 U8 DataPres; /* lower 2 bits */ /* 0x22 */ 351 U8 Status; /* 0x23 */ 352 U32 Reserved4; /* 0x24 */ 353 U32 SenseDataLength; /* 0x28 */ 354 U32 ResponseDataLength; /* 0x2C */ 355 U8 ResponseSenseData[4]; /* 0x30 */ 356 } MPI2_TARGET_SSP_RSP_IU, MPI2_POINTER PTR_MPI2_TARGET_SSP_RSP_IU, 357 Mpi2TargetSspRspIu_t, MPI2_POINTER pMpi2TargetSspRspIu_t; 358 359 360 /**************************************************************************** 361 * Target Standard Reply - used with Target Assist or Target Status Send 362 ****************************************************************************/ 363 364 typedef struct _MPI2_TARGET_STANDARD_REPLY 365 { 366 U16 Reserved; /* 0x00 */ 367 U8 MsgLength; /* 0x02 */ 368 U8 Function; /* 0x03 */ 369 U16 Reserved1; /* 0x04 */ 370 U8 Reserved2; /* 0x06 */ 371 U8 MsgFlags; /* 0x07 */ 372 U8 VP_ID; /* 0x08 */ 373 U8 VF_ID; /* 0x09 */ 374 U16 Reserved3; /* 0x0A */ 375 U16 Reserved4; /* 0x0C */ 376 U16 IOCStatus; /* 0x0E */ 377 U32 IOCLogInfo; /* 0x10 */ 378 U16 IoIndex; /* 0x14 */ 379 U16 Reserved5; /* 0x16 */ 380 U32 TransferCount; /* 0x18 */ 381 U32 BidirectionalTransferCount; /* 0x1C */ 382 } MPI2_TARGET_STANDARD_REPLY, MPI2_POINTER PTR_MPI2_TARGET_STANDARD_REPLY, 383 Mpi2TargetErrorReply_t, MPI2_POINTER pMpi2TargetErrorReply_t; 384 385 386 /**************************************************************************** 387 * Target Mode Abort Request 388 ****************************************************************************/ 389 390 typedef struct _MPI2_TARGET_MODE_ABORT_REQUEST 391 { 392 U8 AbortType; /* 0x00 */ 393 U8 Reserved1; /* 0x01 */ 394 U8 ChainOffset; /* 0x02 */ 395 U8 Function; /* 0x03 */ 396 U16 Reserved2; /* 0x04 */ 397 U8 Reserved3; /* 0x06 */ 398 U8 MsgFlags; /* 0x07 */ 399 U8 VP_ID; /* 0x08 */ 400 U8 VF_ID; /* 0x09 */ 401 U16 Reserved4; /* 0x0A */ 402 U16 IoIndexToAbort; /* 0x0C */ 403 U16 Reserved6; /* 0x0E */ 404 U32 MidToAbort; /* 0x10 */ 405 } MPI2_TARGET_MODE_ABORT, MPI2_POINTER PTR_MPI2_TARGET_MODE_ABORT, 406 Mpi2TargetModeAbort_t, MPI2_POINTER pMpi2TargetModeAbort_t; 407 408 /* Target Mode Abort AbortType values */ 409 410 #define MPI2_TARGET_MODE_ABORT_ALL_CMD_BUFFERS (0x00) 411 #define MPI2_TARGET_MODE_ABORT_ALL_IO (0x01) 412 #define MPI2_TARGET_MODE_ABORT_EXACT_IO (0x02) 413 #define MPI2_TARGET_MODE_ABORT_EXACT_IO_REQUEST (0x03) 414 #define MPI2_TARGET_MODE_ABORT_IO_REQUEST_AND_IO (0x04) 415 416 417 /**************************************************************************** 418 * Target Mode Abort Reply 419 ****************************************************************************/ 420 421 typedef struct _MPI2_TARGET_MODE_ABORT_REPLY 422 { 423 U16 Reserved; /* 0x00 */ 424 U8 MsgLength; /* 0x02 */ 425 U8 Function; /* 0x03 */ 426 U16 Reserved1; /* 0x04 */ 427 U8 Reserved2; /* 0x06 */ 428 U8 MsgFlags; /* 0x07 */ 429 U8 VP_ID; /* 0x08 */ 430 U8 VF_ID; /* 0x09 */ 431 U16 Reserved3; /* 0x0A */ 432 U16 Reserved4; /* 0x0C */ 433 U16 IOCStatus; /* 0x0E */ 434 U32 IOCLogInfo; /* 0x10 */ 435 U32 AbortCount; /* 0x14 */ 436 } MPI2_TARGET_MODE_ABORT_REPLY, MPI2_POINTER PTR_MPI2_TARGET_MODE_ABORT_REPLY, 437 Mpi2TargetModeAbortReply_t, MPI2_POINTER pMpi2TargetModeAbortReply_t; 438 439 440 #endif 441 442