1 /* 2 * linux/drivers/message/fusion/scsi3.h 3 * SCSI-3 definitions and macros. 4 * (Ultimately) SCSI-3 definitions; for now, inheriting 5 * SCSI-2 definitions. 6 * 7 * Copyright (c) 1996-2004 Steven J. Ralston 8 * Written By: Steven J. Ralston (19960517) 9 * (mailto:sjralston1@netscape.net) 10 * (mailto:mpt_linux_developer@lsil.com) 11 * 12 * $Id: scsi3.h,v 1.9 2002/02/27 18:45:02 sralston Exp $ 13 */ 14 15 #ifndef SCSI3_H_INCLUDED 16 #define SCSI3_H_INCLUDED 17 /***************************************************************************/ 18 19 /**************************************************************************** 20 * 21 * Includes 22 */ 23 #ifdef __KERNEL__ 24 #include <linux/types.h> 25 #else 26 #ifndef U_STUFF_DEFINED 27 #define U_STUFF_DEFINED 28 typedef unsigned char u8; 29 typedef unsigned short u16; 30 typedef unsigned int u32; 31 #endif 32 #endif 33 34 /**************************************************************************** 35 * 36 * Defines 37 */ 38 39 /* 40 * SCSI Commands 41 */ 42 #define CMD_TestUnitReady 0x00 43 #define CMD_RezeroUnit 0x01 /* direct-access devices */ 44 #define CMD_Rewind 0x01 /* sequential-access devices */ 45 #define CMD_RequestSense 0x03 46 #define CMD_FormatUnit 0x04 47 #define CMD_ReassignBlock 0x07 48 #define CMD_Read6 0x08 49 #define CMD_Write6 0x0A 50 #define CMD_WriteFilemark 0x10 51 #define CMD_Space 0x11 52 #define CMD_Inquiry 0x12 53 #define CMD_ModeSelect6 0x15 54 #define CMD_ModeSense6 0x1A 55 #define CMD_Reserve6 0x16 56 #define CMD_Release6 0x17 57 #define CMD_Erase 0x19 58 #define CMD_StartStopUnit 0x1b /* direct-access devices */ 59 #define CMD_LoadUnload 0x1b /* sequential-access devices */ 60 #define CMD_ReceiveDiagnostic 0x1C 61 #define CMD_SendDiagnostic 0x1D 62 #define CMD_ReadCapacity 0x25 63 #define CMD_Read10 0x28 64 #define CMD_Write10 0x2A 65 #define CMD_WriteVerify 0x2E 66 #define CMD_Verify 0x2F 67 #define CMD_SynchronizeCache 0x35 68 #define CMD_ReadDefectData 0x37 69 #define CMD_WriteBuffer 0x3B 70 #define CMD_ReadBuffer 0x3C 71 #define CMD_ReadLong 0x3E 72 #define CMD_LogSelect 0x4C 73 #define CMD_LogSense 0x4D 74 #define CMD_ModeSelect10 0x55 75 #define CMD_Reserve10 0x56 76 #define CMD_Release10 0x57 77 #define CMD_ModeSense10 0x5A 78 #define CMD_PersistReserveIn 0x5E 79 #define CMD_PersistReserveOut 0x5F 80 #define CMD_ReportLuns 0xA0 81 82 /* 83 * Control byte field 84 */ 85 #define CONTROL_BYTE_NACA_BIT 0x04 86 #define CONTROL_BYTE_Flag_BIT 0x02 87 #define CONTROL_BYTE_Link_BIT 0x01 88 89 /* 90 * SCSI Messages 91 */ 92 #define MSG_COMPLETE 0x00 93 #define MSG_EXTENDED 0x01 94 #define MSG_SAVE_POINTERS 0x02 95 #define MSG_RESTORE_POINTERS 0x03 96 #define MSG_DISCONNECT 0x04 97 #define MSG_IDERROR 0x05 98 #define MSG_ABORT 0x06 99 #define MSG_REJECT 0x07 100 #define MSG_NOP 0x08 101 #define MSG_PARITY_ERROR 0x09 102 #define MSG_LINKED_CMD_COMPLETE 0x0a 103 #define MSG_LCMD_COMPLETE_W_FLG 0x0b 104 #define MSG_BUS_DEVICE_RESET 0x0c 105 #define MSG_ABORT_TAG 0x0d 106 #define MSG_CLEAR_QUEUE 0x0e 107 #define MSG_INITIATE_RECOVERY 0x0f 108 109 #define MSG_RELEASE_RECOVRY 0x10 110 #define MSG_TERMINATE_IO 0x11 111 112 #define MSG_SIMPLE_QUEUE 0x20 113 #define MSG_HEAD_OF_QUEUE 0x21 114 #define MSG_ORDERED_QUEUE 0x22 115 #define MSG_IGNORE_WIDE_RESIDUE 0x23 116 117 #define MSG_IDENTIFY 0x80 118 #define MSG_IDENTIFY_W_DISC 0xc0 119 120 /* 121 * SCSI Phases 122 */ 123 #define PHS_DATA_OUT 0x00 124 #define PHS_DATA_IN 0x01 125 #define PHS_COMMAND 0x02 126 #define PHS_STATUS 0x03 127 #define PHS_MSG_OUT 0x06 128 #define PHS_MSG_IN 0x07 129 130 /* 131 * Statuses 132 */ 133 #define STS_GOOD 0x00 134 #define STS_CHECK_CONDITION 0x02 135 #define STS_CONDITION_MET 0x04 136 #define STS_BUSY 0x08 137 #define STS_INTERMEDIATE 0x10 138 #define STS_INTERMEDIATE_CONDITION_MET 0x14 139 #define STS_RESERVATION_CONFLICT 0x18 140 #define STS_COMMAND_TERMINATED 0x22 141 #define STS_TASK_SET_FULL 0x28 142 #define STS_QUEUE_FULL 0x28 143 #define STS_ACA_ACTIVE 0x30 144 145 #define STS_VALID_MASK 0x3e 146 147 #define SCSI_STATUS(x) ((x) & STS_VALID_MASK) 148 149 /* 150 * SCSI QTag Types 151 */ 152 #define QTAG_SIMPLE 0x20 153 #define QTAG_HEAD_OF_Q 0x21 154 #define QTAG_ORDERED 0x22 155 156 /* 157 * SCSI Sense Key Definitons 158 */ 159 #define SK_NO_SENSE 0x00 160 #define SK_RECOVERED_ERROR 0x01 161 #define SK_NOT_READY 0x02 162 #define SK_MEDIUM_ERROR 0x03 163 #define SK_HARDWARE_ERROR 0x04 164 #define SK_ILLEGAL_REQUEST 0x05 165 #define SK_UNIT_ATTENTION 0x06 166 #define SK_DATA_PROTECT 0x07 167 #define SK_BLANK_CHECK 0x08 168 #define SK_VENDOR_SPECIFIC 0x09 169 #define SK_COPY_ABORTED 0x0a 170 #define SK_ABORTED_COMMAND 0x0b 171 #define SK_EQUAL 0x0c 172 #define SK_VOLUME_OVERFLOW 0x0d 173 #define SK_MISCOMPARE 0x0e 174 #define SK_RESERVED 0x0f 175 176 177 178 #define SCSI_MAX_INQUIRY_BYTES 96 179 #define SCSI_STD_INQUIRY_BYTES 36 180 181 #undef USE_SCSI_COMPLETE_INQDATA 182 /* 183 * Structure definition for SCSI Inquiry Data 184 * 185 * NOTE: The following structure is 96 bytes in size 186 * iff USE_SCSI_COMPLETE_INQDATA IS defined above (i.e. w/ "#define"). 187 * If USE_SCSI_COMPLETE_INQDATA is NOT defined above (i.e. w/ "#undef") 188 * then the following structure is only 36 bytes in size. 189 * THE CHOICE IS YOURS! 190 */ 191 typedef struct SCSI_Inquiry_Data 192 { 193 #ifdef USE_SCSI_COMPLETE_INQDATA 194 u8 InqByte[SCSI_MAX_INQUIRY_BYTES]; 195 #else 196 u8 InqByte[SCSI_STD_INQUIRY_BYTES]; 197 #endif 198 199 /* 200 * the following structure works only for little-endian (Intel, 201 * LSB first (1234) byte order) systems with 4-byte ints. 202 * 203 u32 Periph_Device_Type : 5, 204 Periph_Qualifier : 3, 205 Device_Type_Modifier : 7, 206 Removable_Media : 1, 207 ANSI_Version : 3, 208 ECMA_Version : 3, 209 ISO_Version : 2, 210 Response_Data_Format : 4, 211 reserved_0 : 3, 212 AERC : 1 ; 213 u32 Additional_Length : 8, 214 reserved_1 :16, 215 SftReset : 1, 216 CmdQue : 1, 217 reserved_2 : 1, 218 Linked : 1, 219 Sync : 1, 220 WBus16 : 1, 221 WBus32 : 1, 222 RelAdr : 1 ; 223 u8 Vendor_ID[8]; 224 u8 Product_ID[16]; 225 u8 Revision_Level [4]; 226 #ifdef USE_SCSI_COMPLETE_INQDATA 227 u8 Vendor_Specific[20]; 228 u8 reserved_3[40]; 229 #endif 230 * 231 */ 232 233 } SCSI_Inquiry_Data_t; 234 235 #define INQ_PERIPHINFO_BYTE 0 236 #define INQ_Periph_Qualifier_MASK 0xe0 237 #define INQ_Periph_Device_Type_MASK 0x1f 238 239 #define INQ_Peripheral_Qualifier(inqp) \ 240 (int)((*((u8*)(inqp)+INQ_PERIPHINFO_BYTE) & INQ_Periph_Qualifier_MASK) >> 5) 241 #define INQ_Peripheral_Device_Type(inqp) \ 242 (int)(*((u8*)(inqp)+INQ_PERIPHINFO_BYTE) & INQ_Periph_Device_Type_MASK) 243 244 245 #define INQ_DEVTYPEMOD_BYTE 1 246 #define INQ_RMB_BIT 0x80 247 #define INQ_Device_Type_Modifier_MASK 0x7f 248 249 #define INQ_Removable_Medium(inqp) \ 250 (int)(*((u8*)(inqp)+INQ_DEVTYPEMOD_BYTE) & INQ_RMB_BIT) 251 #define INQ_Device_Type_Modifier(inqp) \ 252 (int)(*((u8*)(inqp)+INQ_DEVTYPEMOD_BYTE) & INQ_Device_Type_Modifier_MASK) 253 254 255 #define INQ_VERSIONINFO_BYTE 2 256 #define INQ_ISO_Version_MASK 0xc0 257 #define INQ_ECMA_Version_MASK 0x38 258 #define INQ_ANSI_Version_MASK 0x07 259 260 #define INQ_ISO_Version(inqp) \ 261 (int)(*((u8*)(inqp)+INQ_VERSIONINFO_BYTE) & INQ_ISO_Version_MASK) 262 #define INQ_ECMA_Version(inqp) \ 263 (int)(*((u8*)(inqp)+INQ_VERSIONINFO_BYTE) & INQ_ECMA_Version_MASK) 264 #define INQ_ANSI_Version(inqp) \ 265 (int)(*((u8*)(inqp)+INQ_VERSIONINFO_BYTE) & INQ_ANSI_Version_MASK) 266 267 268 #define INQ_BYTE3 3 269 #define INQ_AERC_BIT 0x80 270 #define INQ_TrmTsk_BIT 0x40 271 #define INQ_NormACA_BIT 0x20 272 #define INQ_RDF_MASK 0x0F 273 274 #define INQ_AER_Capable(inqp) \ 275 (int)(*((u8*)(inqp)+INQ_BYTE3) & INQ_AERC_BIT) 276 #define INQ_TrmTsk(inqp) \ 277 (int)(*((u8*)(inqp)+INQ_BYTE3) & INQ_TrmTsk_BIT) 278 #define INQ_NormACA(inqp) \ 279 (int)(*((u8*)(inqp)+INQ_BYTE3) & INQ_NormACA_BIT) 280 #define INQ_Response_Data_Format(inqp) \ 281 (int)(*((u8*)(inqp)+INQ_BYTE3) & INQ_RDF_MASK) 282 283 284 #define INQ_CAPABILITY_BYTE 7 285 #define INQ_RelAdr_BIT 0x80 286 #define INQ_WBus32_BIT 0x40 287 #define INQ_WBus16_BIT 0x20 288 #define INQ_Sync_BIT 0x10 289 #define INQ_Linked_BIT 0x08 290 /* INQ_Reserved BIT 0x40 */ 291 #define INQ_CmdQue_BIT 0x02 292 #define INQ_SftRe_BIT 0x01 293 294 #define IS_RelAdr_DEV(inqp) \ 295 (int)(*((u8*)(inqp)+INQ_CAPABILITY_BYTE) & INQ_RelAdr_BIT) 296 #define IS_WBus32_DEV(inqp) \ 297 (int)(*((u8*)(inqp)+INQ_CAPABILITY_BYTE) & INQ_WBus32_BIT) 298 #define IS_WBus16_DEV(inqp) \ 299 (int)(*((u8*)(inqp)+INQ_CAPABILITY_BYTE) & INQ_WBus16_BIT) 300 #define IS_Sync_DEV(inqp) \ 301 (int)(*((u8*)(inqp)+INQ_CAPABILITY_BYTE) & INQ_Sync_BIT) 302 #define IS_Linked_DEV(inqp) \ 303 (int)(*((u8*)(inqp)+INQ_CAPABILITY_BYTE) & INQ_Linked_BIT) 304 #define IS_CmdQue_DEV(inqp) \ 305 (int)(*((u8*)(inqp)+INQ_CAPABILITY_BYTE) & INQ_CmdQue_BIT) 306 #define IS_SftRe_DEV(inqp) \ 307 (int)(*((u8*)(inqp)+INQ_CAPABILITY_BYTE) & INQ_SftRe_BIT) 308 309 #define INQ_Width_BITS \ 310 (INQ_WBus32_BIT | INQ_WBus16_BIT) 311 #define IS_Wide_DEV(inqp) \ 312 (int)(*((u8*)(inqp)+INQ_CAPABILITY_BYTE) & INQ_Width_BITS) 313 314 315 /* 316 * SCSI peripheral device types 317 */ 318 #define SCSI_TYPE_DAD 0x00 /* Direct Access Device */ 319 #define SCSI_TYPE_SAD 0x01 /* Sequential Access Device */ 320 #define SCSI_TYPE_TAPE SCSI_TYPE_SAD 321 #define SCSI_TYPE_PRT 0x02 /* Printer */ 322 #define SCSI_TYPE_PROC 0x03 /* Processor */ 323 #define SCSI_TYPE_WORM 0x04 324 #define SCSI_TYPE_CDROM 0x05 325 #define SCSI_TYPE_SCAN 0x06 /* Scanner */ 326 #define SCSI_TYPE_OPTICAL 0x07 /* Magneto/Optical */ 327 #define SCSI_TYPE_CHANGER 0x08 328 #define SCSI_TYPE_COMM 0x09 /* Communications device */ 329 #define SCSI_TYPE_UNKNOWN 0x1f 330 #define SCSI_TYPE_UNCONFIGURED_LUN 0x7f 331 332 #define SCSI_TYPE_MAX_KNOWN SCSI_TYPE_COMM 333 334 /* 335 * Peripheral Qualifiers 336 */ 337 #define DEVICE_PRESENT 0x00 338 #define LUN_NOT_PRESENT 0x01 339 #define LUN_NOT_SUPPORTED 0x03 340 341 /* 342 * ANSI Versions 343 */ 344 #ifndef SCSI_1 345 #define SCSI_1 0x01 346 #endif 347 #ifndef SCSI_2 348 #define SCSI_2 0x02 349 #endif 350 #ifndef SCSI_3 351 #define SCSI_3 0x03 352 #endif 353 354 355 #define SCSI_MAX_SENSE_BYTES 255 356 #define SCSI_STD_SENSE_BYTES 18 357 #define SCSI_PAD_SENSE_BYTES (SCSI_MAX_SENSE_BYTES - SCSI_STD_SENSE_BYTES) 358 359 #undef USE_SCSI_COMPLETE_SENSE 360 /* 361 * Structure definition for SCSI Sense Data 362 * 363 * NOTE: The following structure is 255 bytes in size 364 * iiff USE_SCSI_COMPLETE_SENSE IS defined above (i.e. w/ "#define"). 365 * If USE_SCSI_COMPLETE_SENSE is NOT defined above (i.e. w/ "#undef") 366 * then the following structure is only 19 bytes in size. 367 * THE CHOICE IS YOURS! 368 * 369 */ 370 typedef struct SCSI_Sense_Data 371 { 372 #ifdef USE_SCSI_COMPLETE_SENSE 373 u8 SenseByte[SCSI_MAX_SENSE_BYTES]; 374 #else 375 u8 SenseByte[SCSI_STD_SENSE_BYTES]; 376 #endif 377 378 /* 379 * the following structure works only for little-endian (Intel, 380 * LSB first (1234) byte order) systems with 4-byte ints. 381 * 382 u8 Error_Code :4, // 0x00 383 Error_Class :3, 384 Valid :1 385 ; 386 u8 Segment_Number // 0x01 387 ; 388 u8 Sense_Key :4, // 0x02 389 Reserved :1, 390 Incorrect_Length_Indicator:1, 391 End_Of_Media :1, 392 Filemark :1 393 ; 394 u8 Information_MSB; // 0x03 395 u8 Information_Byte2; // 0x04 396 u8 Information_Byte1; // 0x05 397 u8 Information_LSB; // 0x06 398 u8 Additional_Length; // 0x07 399 400 u32 Command_Specific_Information; // 0x08 - 0x0b 401 402 u8 Additional_Sense_Code; // 0x0c 403 u8 Additional_Sense_Code_Qualifier; // 0x0d 404 u8 Field_Replaceable_Unit_Code; // 0x0e 405 u8 Illegal_Req_Bit_Pointer :3, // 0x0f 406 Illegal_Req_Bit_Valid :1, 407 Illegal_Req_Reserved :2, 408 Illegal_Req_Cmd_Data :1, 409 Sense_Key_Specific_Valid :1 410 ; 411 u16 Sense_Key_Specific_Data; // 0x10 - 0x11 412 413 #ifdef USE_SCSI_COMPLETE_SENSE 414 u8 Additional_Sense_Data[SCSI_PAD_SENSE_BYTES]; 415 #else 416 u8 Additional_Sense_Data[1]; 417 #endif 418 * 419 */ 420 421 } SCSI_Sense_Data_t; 422 423 424 #define SD_ERRCODE_BYTE 0 425 #define SD_Valid_BIT 0x80 426 #define SD_Error_Code_MASK 0x7f 427 #define SD_Valid(sdp) \ 428 (int)(*((u8*)(sdp)+SD_ERRCODE_BYTE) & SD_Valid_BIT) 429 #define SD_Error_Code(sdp) \ 430 (int)(*((u8*)(sdp)+SD_ERRCODE_BYTE) & SD_Error_Code_MASK) 431 432 433 #define SD_SEGNUM_BYTE 1 434 #define SD_Segment_Number(sdp) (int)(*((u8*)(sdp)+SD_SEGNUM_BYTE)) 435 436 437 #define SD_SENSEKEY_BYTE 2 438 #define SD_Filemark_BIT 0x80 439 #define SD_EOM_BIT 0x40 440 #define SD_ILI_BIT 0x20 441 #define SD_Sense_Key_MASK 0x0f 442 #define SD_Filemark(sdp) \ 443 (int)(*((u8*)(sdp)+SD_SENSEKEY_BYTE) & SD_Filemark_BIT) 444 #define SD_EOM(sdp) \ 445 (int)(*((u8*)(sdp)+SD_SENSEKEY_BYTE) & SD_EOM_BIT) 446 #define SD_ILI(sdp) \ 447 (int)(*((u8*)(sdp)+SD_SENSEKEY_BYTE) & SD_ILI_BIT) 448 #define SD_Sense_Key(sdp) \ 449 (int)(*((u8*)(sdp)+SD_SENSEKEY_BYTE) & SD_Sense_Key_MASK) 450 451 452 #define SD_INFO3_BYTE 3 453 #define SD_INFO2_BYTE 4 454 #define SD_INFO1_BYTE 5 455 #define SD_INFO0_BYTE 6 456 #define SD_Information3(sdp) (int)(*((u8*)(sdp)+SD_INFO3_BYTE)) 457 #define SD_Information2(sdp) (int)(*((u8*)(sdp)+SD_INFO2_BYTE)) 458 #define SD_Information1(sdp) (int)(*((u8*)(sdp)+SD_INFO1_BYTE)) 459 #define SD_Information0(sdp) (int)(*((u8*)(sdp)+SD_INFO0_BYTE)) 460 461 462 #define SD_ADDL_LEN_BYTE 7 463 #define SD_Additional_Sense_Length(sdp) \ 464 (int)(*((u8*)(sdp)+SD_ADDL_LEN_BYTE)) 465 #define SD_Addl_Sense_Len SD_Additional_Sense_Length 466 467 468 #define SD_CMD_SPECIFIC3_BYTE 8 469 #define SD_CMD_SPECIFIC2_BYTE 9 470 #define SD_CMD_SPECIFIC1_BYTE 10 471 #define SD_CMD_SPECIFIC0_BYTE 11 472 #define SD_Cmd_Specific_Info3(sdp) (int)(*((u8*)(sdp)+SD_CMD_SPECIFIC3_BYTE)) 473 #define SD_Cmd_Specific_Info2(sdp) (int)(*((u8*)(sdp)+SD_CMD_SPECIFIC2_BYTE)) 474 #define SD_Cmd_Specific_Info1(sdp) (int)(*((u8*)(sdp)+SD_CMD_SPECIFIC1_BYTE)) 475 #define SD_Cmd_Specific_Info0(sdp) (int)(*((u8*)(sdp)+SD_CMD_SPECIFIC0_BYTE)) 476 477 478 #define SD_ADDL_SENSE_CODE_BYTE 12 479 #define SD_Additional_Sense_Code(sdp) \ 480 (int)(*((u8*)(sdp)+SD_ADDL_SENSE_CODE_BYTE)) 481 #define SD_Addl_Sense_Code SD_Additional_Sense_Code 482 #define SD_ASC SD_Additional_Sense_Code 483 484 485 #define SD_ADDL_SENSE_CODE_QUAL_BYTE 13 486 #define SD_Additional_Sense_Code_Qualifier(sdp) \ 487 (int)(*((u8*)(sdp)+SD_ADDL_SENSE_CODE_QUAL_BYTE)) 488 #define SD_Addl_Sense_Code_Qual SD_Additional_Sense_Code_Qualifier 489 #define SD_ASCQ SD_Additional_Sense_Code_Qualifier 490 491 492 #define SD_FIELD_REPL_UNIT_CODE_BYTE 14 493 #define SD_Field_Replaceable_Unit_Code(sdp) \ 494 (int)(*((u8*)(sdp)+SD_FIELD_REPL_UNIT_CODE_BYTE)) 495 #define SD_Field_Repl_Unit_Code SD_Field_Replaceable_Unit_Code 496 #define SD_FRUC SD_Field_Replaceable_Unit_Code 497 #define SD_FRU SD_Field_Replaceable_Unit_Code 498 499 500 /* 501 * Sense-Key Specific offsets and macros. 502 */ 503 #define SD_SKS2_BYTE 15 504 #define SD_SKS_Valid_BIT 0x80 505 #define SD_SKS_Cmd_Data_BIT 0x40 506 #define SD_SKS_Bit_Ptr_Valid_BIT 0x08 507 #define SD_SKS_Bit_Ptr_MASK 0x07 508 #define SD_SKS1_BYTE 16 509 #define SD_SKS0_BYTE 17 510 #define SD_Sense_Key_Specific_Valid(sdp) \ 511 (int)(*((u8*)(sdp)+SD_SKS2_BYTE) & SD_SKS_Valid_BIT) 512 #define SD_SKS_Valid SD_Sense_Key_Specific_Valid 513 #define SD_SKS_CDB_Error(sdp) \ 514 (int)(*((u8*)(sdp)+SD_SKS2_BYTE) & SD_SKS_Cmd_Data_BIT) 515 #define SD_Was_Illegal_Request SD_SKS_CDB_Error 516 #define SD_SKS_Bit_Pointer_Valid(sdp) \ 517 (int)(*((u8*)(sdp)+SD_SKS2_BYTE) & SD_SKS_Bit_Ptr_Valid_BIT) 518 #define SD_SKS_Bit_Pointer(sdp) \ 519 (int)(*((u8*)(sdp)+SD_SKS2_BYTE) & SD_SKS_Bit_Ptr_MASK) 520 #define SD_Field_Pointer(sdp) \ 521 (int)( ((u16)(*((u8*)(sdp)+SD_SKS1_BYTE)) << 8) \ 522 + *((u8*)(sdp)+SD_SKS0_BYTE) ) 523 #define SD_Bad_Byte SD_Field_Pointer 524 #define SD_Actual_Retry_Count SD_Field_Pointer 525 #define SD_Progress_Indication SD_Field_Pointer 526 527 /* 528 * Mode Sense Write Protect Mask 529 */ 530 #define WRITE_PROTECT_MASK 0X80 531 532 /* 533 * Medium Type Codes 534 */ 535 #define OPTICAL_DEFAULT 0x00 536 #define OPTICAL_READ_ONLY_MEDIUM 0x01 537 #define OPTICAL_WRITE_ONCE_MEDIUM 0x02 538 #define OPTICAL_READ_WRITABLE_MEDIUM 0x03 539 #define OPTICAL_RO_OR_WO_MEDIUM 0x04 540 #define OPTICAL_RO_OR_RW_MEDIUM 0x05 541 #define OPTICAL_WO_OR_RW_MEDIUM 0x06 542 543 544 545 /* 546 * Structure definition for READ6, WRITE6 (6-byte CDB) 547 */ 548 typedef struct SCSI_RW6_CDB 549 { 550 u32 OpCode :8, 551 LBA_HI :5, /* 5 MSBit's of the LBA */ 552 Lun :3, 553 LBA_MID :8, /* NOTE: total of 21 bits in LBA */ 554 LBA_LO :8 ; /* Max LBA = 0x001fffff */ 555 u8 BlockCount; 556 u8 Control; 557 } SCSI_RW6_t; 558 559 #define MAX_RW6_LBA ((u32)0x001fffff) 560 561 /* 562 * Structure definition for READ10, WRITE10 (10-byte CDB) 563 * 564 * NOTE: ParityCheck bit is applicable only for VERIFY and WRITE VERIFY for 565 * the ADP-92 DAC only. In the SCSI2 spec. this same bit is defined as a 566 * FUA (forced unit access) bit for READs and WRITEs. Since this driver 567 * does not use the FUA, this bit is defined as it is used by the ADP-92. 568 * Also, for READ CAPACITY, only the OpCode field is used. 569 */ 570 typedef struct SCSI_RW10_CDB 571 { 572 u8 OpCode; 573 u8 Reserved1; 574 u32 LBA; 575 u8 Reserved2; 576 u16 BlockCount; 577 u8 Control; 578 } SCSI_RW10_t; 579 580 #define PARITY_CHECK 0x08 /* parity check bit - byte[1], bit 3 */ 581 582 /* 583 * Structure definition for data returned by READ CAPACITY cmd; 584 * READ CAPACITY data 585 */ 586 typedef struct READ_CAP_DATA 587 { 588 u32 MaxLBA; 589 u32 BlockBytes; 590 } SCSI_READ_CAP_DATA_t, *pSCSI_READ_CAP_DATA_t; 591 592 593 /* 594 * Structure definition for FORMAT UNIT CDB (6-byte CDB) 595 */ 596 typedef struct _SCSI_FORMAT_UNIT 597 { 598 u8 OpCode; 599 u8 Reserved1; 600 u8 VendorSpecific; 601 u16 Interleave; 602 u8 Control; 603 } SCSI_FORMAT_UNIT_t; 604 605 /* 606 * Structure definition for REQUEST SENSE (6-byte CDB) 607 */ 608 typedef struct _SCSI_REQUEST_SENSE 609 { 610 u8 OpCode; 611 u8 Reserved1; 612 u8 Reserved2; 613 u8 Reserved3; 614 u8 AllocLength; 615 u8 Control; 616 } SCSI_REQ_SENSE_t; 617 618 /* 619 * Structure definition for REPORT LUNS (12-byte CDB) 620 */ 621 typedef struct _SCSI_REPORT_LUNS 622 { 623 u8 OpCode; 624 u8 Reserved1[5]; 625 u32 AllocationLength; 626 u8 Reserved2; 627 u8 Control; 628 } SCSI_REPORT_LUNS_t, *pSCSI_REPORT_LUNS_t; 629 630 /* 631 * (per-level) LUN information bytes 632 */ 633 /* 634 * Following doesn't work on ARMCC compiler 635 * [apparently] because it pads every struct 636 * to be multiple of 4 bytes! 637 * So SCSI_LUN_LEVELS_t winds up being 16 638 * bytes instead of 8! 639 * 640 typedef struct LUN_INFO 641 { 642 u8 AddrMethod_plus_LunOrBusNumber; 643 u8 LunOrTarget; 644 } SCSI_LUN_INFO_t, *pSCSI_LUN_INFO_t; 645 646 typedef struct LUN_LEVELS 647 { 648 SCSI_LUN_INFO_t LUN_0; 649 SCSI_LUN_INFO_t LUN_1; 650 SCSI_LUN_INFO_t LUN_2; 651 SCSI_LUN_INFO_t LUN_3; 652 } SCSI_LUN_LEVELS_t, *pSCSI_LUN_LEVELS_t; 653 */ 654 /* 655 * All 4 levels (8 bytes) of LUN information 656 */ 657 typedef struct LUN_LEVELS 658 { 659 u8 LVL1_AddrMethod_plus_LunOrBusNumber; 660 u8 LVL1_LunOrTarget; 661 u8 LVL2_AddrMethod_plus_LunOrBusNumber; 662 u8 LVL2_LunOrTarget; 663 u8 LVL3_AddrMethod_plus_LunOrBusNumber; 664 u8 LVL3_LunOrTarget; 665 u8 LVL4_AddrMethod_plus_LunOrBusNumber; 666 u8 LVL4_LunOrTarget; 667 } SCSI_LUN_LEVELS_t, *pSCSI_LUN_LEVELS_t; 668 669 /* 670 * Structure definition for data returned by REPORT LUNS cmd; 671 * LUN reporting parameter list format 672 */ 673 typedef struct LUN_REPORT 674 { 675 u32 LunListLength; 676 u32 Reserved; 677 SCSI_LUN_LEVELS_t LunInfo[1]; 678 } SCSI_LUN_REPORT_t, *pSCSI_LUN_REPORT_t; 679 680 /**************************************************************************** 681 * 682 * Externals 683 */ 684 685 /**************************************************************************** 686 * 687 * Public Typedefs & Related Defines 688 */ 689 690 /**************************************************************************** 691 * 692 * Macros (embedded, above) 693 */ 694 695 /**************************************************************************** 696 * 697 * Public Variables 698 */ 699 700 /**************************************************************************** 701 * 702 * Public Prototypes (module entry points) 703 */ 704 705 706 /***************************************************************************/ 707 #endif 708