17 #define SCSI_MAX_BLOCK_10 0xffffffffULL 24 #define SCSI_OPCODE_READ_10 0x28 25 #define SCSI_OPCODE_READ_16 0x88 26 #define SCSI_OPCODE_WRITE_10 0x2a 27 #define SCSI_OPCODE_WRITE_16 0x8a 28 #define SCSI_OPCODE_READ_CAPACITY_10 0x25 29 #define SCSI_OPCODE_SERVICE_ACTION_IN 0x9e 30 #define SCSI_SERVICE_ACTION_READ_CAPACITY_16 0x10 31 #define SCSI_OPCODE_TEST_UNIT_READY 0x00 40 #define SCSI_FL_FUA_NV 0x02 41 #define SCSI_FL_FUA 0x08 42 #define SCSI_FL_DPO 0x10 219 #define SCSI_CDB_FORMAT "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:" \ 220 "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x" 223 #define SCSI_CDB_DATA(cdb) \ 224 (cdb).bytes[0], (cdb).bytes[1], (cdb).bytes[2], (cdb).bytes[3], \ 225 (cdb).bytes[4], (cdb).bytes[5], (cdb).bytes[6], (cdb).bytes[7], \ 226 (cdb).bytes[8], (cdb).bytes[9], (cdb).bytes[10], (cdb).bytes[11], \ 227 (cdb).bytes[12], (cdb).bytes[13], (cdb).bytes[14], (cdb).bytes[15] 241 #define SCSI_LUN_FORMAT "%04x-%04x-%04x-%04x" 244 #define SCSI_LUN_DATA(lun) \ 245 ntohs ( (lun).u16[0] ), ntohs ( (lun).u16[1] ), \ 246 ntohs ( (lun).u16[2] ), ntohs ( (lun).u16[3] ) 309 #define SCSI_SENSE_CODE_MASK 0x7f 316 #define SCSI_SENSE_FIXED( code ) ( ( (code) & 0x7e ) == 0x70 ) 319 #define SCSI_SENSE_KEY_MASK 0x0f 342 #define scsi_command_TYPE( object_type ) \ 343 typeof ( int ( object_type, struct interface *data, \ 344 struct scsi_cmd *command ) ) 347 #define scsi_response_TYPE( object_type ) \ 348 typeof ( void ( object_type, struct scsi_rsp *response ) ) FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
uint8_t reserved[20]
Reserved.
uint16_t len
Transfer length.
size_t data_out_len
Data-out buffer length.
void scsi_response(struct interface *intf, struct scsi_rsp *response)
Report SCSI response.
uint8_t control
Control byte.
uint8_t control
Control byte.
int scsi_open(struct interface *block, struct interface *scsi, struct scsi_lun *lun)
Open SCSI device.
uint8_t control
Control byte.
uint32_t info
Information.
uint32_t len
Transfer length.
SCSI "READ CAPACITY (10)" parameter data.
size_t data_in_len
Data-in buffer length.
uint32_t lba
Start address.
unsigned long long uint64_t
uint8_t reserved
Reserved.
void scsi_parse_sense(const void *data, size_t len, struct scsi_sns_descriptor *sense)
Parse SCSI sense data.
union scsi_cdb cdb
CDB for this command.
uint8_t group
Group number.
uint8_t opcode
Opcode (0x8a)
Access to external ("user") memory.
SCSI fixed-format sense data.
uint32_t blksize
Block length in bytes.
SCSI "READ CAPACITY (16)" parameter data.
SCSI descriptor-format sense data.
uint32_t blksize
Block length in bytes.
uint8_t code
Response code.
A SCSI "TEST UNIT READY" CDB.
uint8_t reserved_b[3]
Reserved.
uint32_t userptr_t
A pointer to a user buffer.
uint16_t additional
Additional sense code and qualifier.
uint32_t len
Transfer length.
A SCSI response information unit.
userptr_t data_out
Data-out buffer (may be NULL)
A SCSI "READ CAPACITY (10)" CDB.
struct scsi_cdb_test_unit_ready testready
uint8_t control
Control byte.
uint8_t lun
Logical Unit Number.
uint8_t opcode
Opcode (0x25)
struct scsi_cdb_read_10 read10
uint8_t opcode
Opcode (0x2a)
uint8_t opcode
Opcode (0x88)
int scsi_parse_lun(const char *lun_string, struct scsi_lun *lun)
Parse SCSI LUN.
struct scsi_cdb_write_16 write16
uint8_t status
SCSI status code.
uint8_t reserved_a
Reserved.
struct scsi_sns_fixed fixed
Fixed-format sense data.
uint8_t code
Response code.
union scsi_cdb __attribute__
uint8_t control
Control byte.
uint32_t lba
Maximum logical block number.
struct scsi_cdb_read_16 read16
struct scsi_cdb_read_capacity_16 readcap16
uint32_t lba
Logical block address.
A SCSI Command Data Block.
struct scsi_cdb_read_capacity_10 readcap10
uint8_t control
Control byte.
uint64_t lba
Maximum logical block number.
uint64_t lba
Logical block address.
A SCSI command information unit.
uint64_t lba
Start address.
struct scsi_sns_descriptor desc
Descriptor-format sense data.
uint8_t opcode
Opcode (0x28)
uint8_t block[3][8]
DES-encrypted blocks.
uint32_t len
Transfer length.
uint8_t reserved
Reserved.
uint64_t lba
Start address.
uint8_t group
Group number.
uint32_t lba
Start address.
struct scsi_sns_descriptor sense
Autosense data (if any)
uint16_t len
Transfer length.
uint8_t opcode
Opcode (0x00)
uint8_t len
Additional sense length.
userptr_t data_in
Data-in buffer (may be NULL)
uint8_t control
Control byte.
uint8_t opcode
Opcode (0x9e)
uint8_t data[48]
Additional event data.
uint32_t cs_info
Command-specific information.
int scsi_command(struct interface *control, struct interface *data, struct scsi_cmd *command)
Issue SCSI command.
uint8_t group
Group number.
uint8_t reserved[4]
Reserved.
A SCSI "READ CAPACITY (16)" CDB.
uint8_t code
Response code.
uint8_t group
Group number.
uint8_t control
Control byte.
uint8_t service_action
Service action.
ssize_t overrun
Data overrun (or negative underrun)
uint16_t additional
Additional sense code and qualifier.
struct scsi_cdb_write_10 write10
uint16_t len
Transfer length.