| /*- |
| * Largely written by Julian Elischer (julian@tfs.com) |
| * for TRW Financial Systems. |
| * |
| * TRW Financial Systems, in accordance with their agreement with Carnegie |
| * Mellon University, makes this software available to CMU to distribute |
| * or use in any manner that they see fit as long as this message is kept with |
| * the software. For this reason TFS also grants any other persons or |
| * organisations permission to use or modify this software. |
| * |
| * TFS supplies this software to be publicly redistributed |
| * on the understanding that TFS is not responsible for the correct |
| * functioning of this software in any circumstances. |
| * |
| * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992 |
| * |
| * $FreeBSD$ |
| */ |
| |
| /* |
| * Contains type definition of 'struct scsi_inquiry_data', as well as |
| * definitions of related macros. |
| * |
| * Taken from 'cam/scsi/scsi_all.h' of kFreeBSD. |
| */ |
| |
| #include <stdint.h> |
| |
| /* |
| * Device Types |
| */ |
| #define T_DIRECT 0x00 |
| #define T_SEQUENTIAL 0x01 |
| #define T_PRINTER 0x02 |
| #define T_PROCESSOR 0x03 |
| #define T_WORM 0x04 |
| #define T_CDROM 0x05 |
| #define T_SCANNER 0x06 |
| #define T_OPTICAL 0x07 |
| #define T_CHANGER 0x08 |
| #define T_COMM 0x09 |
| #define T_ASC0 0x0a |
| #define T_ASC1 0x0b |
| #define T_STORARRAY 0x0c |
| #define T_ENCLOSURE 0x0d |
| #define T_RBC 0x0e |
| #define T_OCRW 0x0f |
| #define T_OSD 0x11 |
| #define T_ADC 0x12 |
| #define T_ZBC_HM 0x14 |
| #define T_NODEVICE 0x1f |
| #define T_ANY 0xff /* Used in Quirk table matches */ |
| |
| #define T_REMOV 1 |
| #define T_FIXED 0 |
| |
| struct scsi_inquiry_data { |
| uint8_t device; |
| #define SID_TYPE(inq_data) ((inq_data)->device & 0x1f) |
| #define SID_QUAL(inq_data) (((inq_data)->device & 0xE0) >> 5) |
| #define SID_QUAL_LU_CONNECTED 0x00 /* |
| * The specified peripheral device |
| * type is currently connected to |
| * logical unit. If the target cannot |
| * determine whether or not a physical |
| * device is currently connected, it |
| * shall also use this peripheral |
| * qualifier when returning the INQUIRY |
| * data. This peripheral qualifier |
| * does not mean that the device is |
| * ready for access by the initiator. |
| */ |
| #define SID_QUAL_LU_OFFLINE 0x01 /* |
| * The target is capable of supporting |
| * the specified peripheral device type |
| * on this logical unit; however, the |
| * physical device is not currently |
| * connected to this logical unit. |
| */ |
| #define SID_QUAL_RSVD 0x02 |
| #define SID_QUAL_BAD_LU 0x03 /* |
| * The target is not capable of |
| * supporting a physical device on |
| * this logical unit. For this |
| * peripheral qualifier the peripheral |
| * device type shall be set to 1Fh to |
| * provide compatibility with previous |
| * versions of SCSI. All other |
| * peripheral device type values are |
| * reserved for this peripheral |
| * qualifier. |
| */ |
| #define SID_QUAL_IS_VENDOR_UNIQUE(inq_data) ((SID_QUAL(inq_data) & 0x04) != 0) |
| uint8_t dev_qual2; |
| #define SID_QUAL2 0x7F |
| #define SID_LU_CONG 0x40 |
| #define SID_RMB 0x80 |
| #define SID_IS_REMOVABLE(inq_data) (((inq_data)->dev_qual2 & SID_RMB) != 0) |
| uint8_t version; |
| #define SID_ANSI_REV(inq_data) ((inq_data)->version & 0x07) |
| #define SCSI_REV_0 0 |
| #define SCSI_REV_CCS 1 |
| #define SCSI_REV_2 2 |
| #define SCSI_REV_SPC 3 |
| #define SCSI_REV_SPC2 4 |
| #define SCSI_REV_SPC3 5 |
| #define SCSI_REV_SPC4 6 |
| #define SCSI_REV_SPC5 7 |
| |
| #define SID_ECMA 0x38 |
| #define SID_ISO 0xC0 |
| uint8_t response_format; |
| #define SID_AENC 0x80 |
| #define SID_TrmIOP 0x40 |
| #define SID_NormACA 0x20 |
| #define SID_HiSup 0x10 |
| uint8_t additional_length; |
| #define SID_ADDITIONAL_LENGTH(iqd) \ |
| ((iqd)->additional_length + \ |
| __offsetof(struct scsi_inquiry_data, additional_length) + 1) |
| uint8_t spc3_flags; |
| #define SPC3_SID_PROTECT 0x01 |
| #define SPC3_SID_3PC 0x08 |
| #define SPC3_SID_TPGS_MASK 0x30 |
| #define SPC3_SID_TPGS_IMPLICIT 0x10 |
| #define SPC3_SID_TPGS_EXPLICIT 0x20 |
| #define SPC3_SID_ACC 0x40 |
| #define SPC3_SID_SCCS 0x80 |
| uint8_t spc2_flags; |
| #define SPC2_SID_ADDR16 0x01 |
| #define SPC2_SID_MChngr 0x08 |
| #define SPC2_SID_MultiP 0x10 |
| #define SPC2_SID_EncServ 0x40 |
| #define SPC2_SID_BQueue 0x80 |
| |
| #define INQ_DATA_TQ_ENABLED(iqd) \ |
| ((SID_ANSI_REV(iqd) < SCSI_REV_SPC2)? ((iqd)->flags & SID_CmdQue) : \ |
| (((iqd)->flags & SID_CmdQue) && !((iqd)->spc2_flags & SPC2_SID_BQueue)) || \ |
| (!((iqd)->flags & SID_CmdQue) && ((iqd)->spc2_flags & SPC2_SID_BQueue))) |
| |
| uint8_t flags; |
| #define SID_SftRe 0x01 |
| #define SID_CmdQue 0x02 |
| #define SID_Linked 0x08 |
| #define SID_Sync 0x10 |
| #define SID_WBus16 0x20 |
| #define SID_WBus32 0x40 |
| #define SID_RelAdr 0x80 |
| #define SID_VENDOR_SIZE 8 |
| char vendor[SID_VENDOR_SIZE]; |
| #define SID_PRODUCT_SIZE 16 |
| char product[SID_PRODUCT_SIZE]; |
| #define SID_REVISION_SIZE 4 |
| char revision[SID_REVISION_SIZE]; |
| /* |
| * The following fields were taken from SCSI Primary Commands - 2 |
| * (SPC-2) Revision 14, Dated 11 November 1999 |
| */ |
| #define SID_VENDOR_SPECIFIC_0_SIZE 20 |
| uint8_t vendor_specific0[SID_VENDOR_SPECIFIC_0_SIZE]; |
| /* |
| * An extension of SCSI Parallel Specific Values |
| */ |
| #define SID_SPI_IUS 0x01 |
| #define SID_SPI_QAS 0x02 |
| #define SID_SPI_CLOCK_ST 0x00 |
| #define SID_SPI_CLOCK_DT 0x04 |
| #define SID_SPI_CLOCK_DT_ST 0x0C |
| #define SID_SPI_MASK 0x0F |
| uint8_t spi3data; |
| uint8_t reserved2; |
| /* |
| * Version Descriptors, stored 2 byte values. |
| */ |
| uint8_t version1[2]; |
| uint8_t version2[2]; |
| uint8_t version3[2]; |
| uint8_t version4[2]; |
| uint8_t version5[2]; |
| uint8_t version6[2]; |
| uint8_t version7[2]; |
| uint8_t version8[2]; |
| |
| uint8_t reserved3[22]; |
| |
| #define SID_VENDOR_SPECIFIC_1_SIZE 160 |
| uint8_t vendor_specific1[SID_VENDOR_SPECIFIC_1_SIZE]; |
| }; |