iPXE
|
SCSI devices. More...
Go to the source code of this file.
Data Structures | |
struct | scsi_cdb_read_10 |
A SCSI "READ (10)" CDB. More... | |
struct | scsi_cdb_read_16 |
A SCSI "READ (16)" CDB. More... | |
struct | scsi_cdb_write_10 |
A SCSI "WRITE (10)" CDB. More... | |
struct | scsi_cdb_write_16 |
A SCSI "WRITE (16)" CDB. More... | |
struct | scsi_cdb_read_capacity_10 |
A SCSI "READ CAPACITY (10)" CDB. More... | |
struct | scsi_capacity_10 |
SCSI "READ CAPACITY (10)" parameter data. More... | |
struct | scsi_cdb_read_capacity_16 |
A SCSI "READ CAPACITY (16)" CDB. More... | |
struct | scsi_capacity_16 |
SCSI "READ CAPACITY (16)" parameter data. More... | |
struct | scsi_cdb_test_unit_ready |
A SCSI "TEST UNIT READY" CDB. More... | |
union | scsi_cdb |
A SCSI Command Data Block. More... | |
struct | scsi_lun |
A SCSI LUN. More... | |
struct | scsi_cmd |
A SCSI command information unit. More... | |
struct | scsi_sns_fixed |
SCSI fixed-format sense data. More... | |
struct | scsi_sns_descriptor |
SCSI descriptor-format sense data. More... | |
union | scsi_sns |
SCSI sense data. More... | |
struct | scsi_rsp |
A SCSI response information unit. More... | |
Macros | |
#define | SCSI_MAX_BLOCK_10 0xffffffffULL |
Maximum block for READ/WRITE (10) commands. More... | |
#define | SCSI_OPCODE_READ_10 0x28 |
READ (10) More... | |
#define | SCSI_OPCODE_READ_16 0x88 |
READ (16) More... | |
#define | SCSI_OPCODE_WRITE_10 0x2a |
WRITE (10) More... | |
#define | SCSI_OPCODE_WRITE_16 0x8a |
WRITE (16) More... | |
#define | SCSI_OPCODE_READ_CAPACITY_10 0x25 |
READ CAPACITY (10) More... | |
#define | SCSI_OPCODE_SERVICE_ACTION_IN 0x9e |
SERVICE ACTION IN. More... | |
#define | SCSI_SERVICE_ACTION_READ_CAPACITY_16 0x10 |
READ CAPACITY (16) More... | |
#define | SCSI_OPCODE_TEST_UNIT_READY 0x00 |
TEST UNIT READY. More... | |
#define | SCSI_FL_FUA_NV 0x02 |
Force unit access to NVS. More... | |
#define | SCSI_FL_FUA 0x08 |
Force unit access. More... | |
#define | SCSI_FL_DPO 0x10 |
Disable cache page out. More... | |
#define | SCSI_CDB_FORMAT |
printf() format for dumping a scsi_cdb More... | |
#define | SCSI_CDB_DATA(cdb) |
printf() parameters for dumping a scsi_cdb More... | |
#define | SCSI_LUN_FORMAT "%04x-%04x-%04x-%04x" |
printf() format for dumping a scsi_lun More... | |
#define | SCSI_LUN_DATA(lun) |
printf() parameters for dumping a scsi_lun More... | |
#define | SCSI_SENSE_CODE_MASK 0x7f |
SCSI sense response code mask. More... | |
#define | SCSI_SENSE_FIXED(code) ( ( (code) & 0x7e ) == 0x70 ) |
Test if SCSI sense data is in fixed format. More... | |
#define | SCSI_SENSE_KEY_MASK 0x0f |
SCSI sense key mask. More... | |
#define | scsi_command_TYPE(object_type) |
#define | scsi_response_TYPE(object_type) typeof ( void ( object_type, struct scsi_rsp *response ) ) |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
struct scsi_cdb_read_10 | __attribute__ ((packed)) |
int | scsi_parse_lun (const char *lun_string, struct scsi_lun *lun) |
Parse SCSI LUN. More... | |
void | scsi_parse_sense (const void *data, size_t len, struct scsi_sns_descriptor *sense) |
Parse SCSI sense data. More... | |
int | scsi_command (struct interface *control, struct interface *data, struct scsi_cmd *command) |
Issue SCSI command. More... | |
void | scsi_response (struct interface *intf, struct scsi_rsp *response) |
Report SCSI response. More... | |
int | scsi_open (struct interface *block, struct interface *scsi, struct scsi_lun *lun) |
Open SCSI device. More... | |
Variables | |
uint8_t | opcode |
Opcode (0x28) More... | |
uint8_t | flags |
Flags. More... | |
uint32_t | lba |
Start address. More... | |
uint8_t | group |
Group number. More... | |
uint16_t | len |
Transfer length. More... | |
uint8_t | control |
Control byte. More... | |
uint8_t | reserved_a |
Reserved. More... | |
uint8_t | reserved_b [3] |
Reserved. More... | |
uint32_t | blksize |
Block length in bytes. More... | |
uint8_t | service_action |
Service action. More... | |
uint8_t | reserved |
Reserved. More... | |
union scsi_cdb | __attribute__ |
uint16_t | u16 [4] |
uint8_t | code |
Response code. More... | |
uint8_t | key |
Sense key. More... | |
uint32_t | info |
Information. More... | |
uint32_t | cs_info |
Command-specific information. More... | |
uint16_t | additional |
Additional sense code and qualifier. More... | |
SCSI devices.
Definition in file scsi.h.
#define SCSI_MAX_BLOCK_10 0xffffffffULL |
#define SCSI_LUN_FORMAT "%04x-%04x-%04x-%04x" |
#define SCSI_SENSE_CODE_MASK 0x7f |
#define scsi_command_TYPE | ( | object_type | ) |
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
int scsi_parse_lun | ( | const char * | lun_string, |
struct scsi_lun * | lun | ||
) |
Parse SCSI LUN.
lun_string | LUN string representation |
lun | LUN to fill in |
rc | Return status code |
Definition at line 117 of file scsi.c.
References EINVAL, htons, lun, memset(), and strtoul().
Referenced by fcp_parse_uri(), ib_srp_parse_lun(), and iscsi_parse_root_path().
void scsi_parse_sense | ( | const void * | data, |
size_t | len, | ||
struct scsi_sns_descriptor * | sense | ||
) |
Parse SCSI sense data.
data | Raw sense data |
len | Length of raw sense data |
sense | Descriptor-format sense data to fill in |
Definition at line 146 of file scsi.c.
References scsi_sns_fixed::additional, scsi_sns_descriptor::additional, scsi_sns::code, data, scsi_sns::desc, scsi_sns::fixed, len, memcpy(), memset(), and SCSI_SENSE_FIXED.
Referenced by fcpcmd_recv_rsp(), iscsi_rx_scsi_response(), and srp_rsp().
int scsi_command | ( | struct interface * | control, |
struct interface * | data, | ||
struct scsi_cmd * | command | ||
) |
Issue SCSI command.
control | SCSI control interface |
data | SCSI data interface |
command | SCSI command |
tag | Command tag, or negative error |
Definition at line 181 of file scsi.c.
References control, data, dest, EOPNOTSUPP, intf_get_dest_op, intf_object(), intf_put(), op, and scsi_command_TYPE.
Report SCSI response.
interface | SCSI command interface |
response | SCSI response |
Definition at line 206 of file scsi.c.
References dest, interface::intf, intf_get_dest_op, intf_object(), intf_put(), op, scsi_response(), and scsi_response_TYPE.
Referenced by fcpcmd_recv_rsp(), iscsi_scsi_done(), scsi_response(), and srp_rsp().
Open SCSI device.
block | Block control interface |
scsi | SCSI control interface |
lun | SCSI LUN |
rc | Return status code |
Definition at line 984 of file scsi.c.
References block, scsi_device::block, scsi_device::cmds, DBGC, ENOMEM, INIT_LIST_HEAD, intf_init(), intf_plug_plug(), lun, scsi_device::lun, memcpy(), NULL, scsi_device::process, process_init(), scsi_device::ready, ref_init, ref_put, scsi_device::refcnt, scsi_device::scsi, SCSI_LUN_DATA, SCSI_LUN_FORMAT, scsidev_block_desc, scsidev_process_desc, scsidev_ready_desc, scsidev_scsi_desc, and zalloc().
Referenced by fcpdev_open(), iscsi_open(), srp_open(), and usbblk_open_uri().
uint8_t opcode |
uint64_t lba |
uint8_t len |
uint16_t additional |
Additional sense code and qualifier.
Definition at line 28 of file scsi.h.
Referenced by drbg_generate(), drbg_generate_algorithm(), drbg_reseed(), drbg_reseed_algorithm(), hmac_drbg_generate(), hmac_drbg_reseed(), and rbg_generate().