|
#define | SCSI_READY_MAX_RETRIES 10 |
| Maximum number of TEST UNIT READY retries. More...
|
|
#define | EIO_NO_SENSE __einfo_error ( EINFO_EIO_NO_SENSE ) |
|
#define | EINFO_EIO_NO_SENSE __einfo_uniqify ( EINFO_EIO, 0x00, "No sense" ) |
|
#define | EIO_RECOVERED_ERROR __einfo_error ( EINFO_EIO_RECOVERED_ERROR ) |
|
#define | EINFO_EIO_RECOVERED_ERROR __einfo_uniqify ( EINFO_EIO, 0x01, "Recovered error" ) |
|
#define | EIO_NOT_READY __einfo_error ( EINFO_EIO_NOT_READY ) |
|
#define | EINFO_EIO_NOT_READY __einfo_uniqify ( EINFO_EIO, 0x02, "Not ready" ) |
|
#define | EIO_MEDIUM_ERROR __einfo_error ( EINFO_EIO_MEDIUM_ERROR ) |
|
#define | EINFO_EIO_MEDIUM_ERROR __einfo_uniqify ( EINFO_EIO, 0x03, "Medium error" ) |
|
#define | EIO_HARDWARE_ERROR __einfo_error ( EINFO_EIO_HARDWARE_ERROR ) |
|
#define | EINFO_EIO_HARDWARE_ERROR __einfo_uniqify ( EINFO_EIO, 0x04, "Hardware error" ) |
|
#define | EIO_ILLEGAL_REQUEST __einfo_error ( EINFO_EIO_ILLEGAL_REQUEST ) |
|
#define | EINFO_EIO_ILLEGAL_REQUEST __einfo_uniqify ( EINFO_EIO, 0x05, "Illegal request" ) |
|
#define | EIO_UNIT_ATTENTION __einfo_error ( EINFO_EIO_UNIT_ATTENTION ) |
|
#define | EINFO_EIO_UNIT_ATTENTION __einfo_uniqify ( EINFO_EIO, 0x06, "Unit attention" ) |
|
#define | EIO_DATA_PROTECT __einfo_error ( EINFO_EIO_DATA_PROTECT ) |
|
#define | EINFO_EIO_DATA_PROTECT __einfo_uniqify ( EINFO_EIO, 0x07, "Data protect" ) |
|
#define | EIO_BLANK_CHECK __einfo_error ( EINFO_EIO_BLANK_CHECK ) |
|
#define | EINFO_EIO_BLANK_CHECK __einfo_uniqify ( EINFO_EIO, 0x08, "Blank check" ) |
|
#define | EIO_VENDOR_SPECIFIC __einfo_error ( EINFO_EIO_VENDOR_SPECIFIC ) |
|
#define | EINFO_EIO_VENDOR_SPECIFIC __einfo_uniqify ( EINFO_EIO, 0x09, "Vendor specific" ) |
|
#define | EIO_COPY_ABORTED __einfo_error ( EINFO_EIO_COPY_ABORTED ) |
|
#define | EINFO_EIO_COPY_ABORTED __einfo_uniqify ( EINFO_EIO, 0x0a, "Copy aborted" ) |
|
#define | EIO_ABORTED_COMMAND __einfo_error ( EINFO_EIO_ABORTED_COMMAND ) |
|
#define | EINFO_EIO_ABORTED_COMMAND __einfo_uniqify ( EINFO_EIO, 0x0b, "Aborted command" ) |
|
#define | EIO_RESERVED __einfo_error ( EINFO_EIO_RESERVED ) |
|
#define | EINFO_EIO_RESERVED __einfo_uniqify ( EINFO_EIO, 0x0c, "Reserved" ) |
|
#define | EIO_VOLUME_OVERFLOW __einfo_error ( EINFO_EIO_VOLUME_OVERFLOW ) |
|
#define | EINFO_EIO_VOLUME_OVERFLOW __einfo_uniqify ( EINFO_EIO, 0x0d, "Volume overflow" ) |
|
#define | EIO_MISCOMPARE __einfo_error ( EINFO_EIO_MISCOMPARE ) |
|
#define | EINFO_EIO_MISCOMPARE __einfo_uniqify ( EINFO_EIO, 0x0e, "Miscompare" ) |
|
#define | EIO_COMPLETED __einfo_error ( EINFO_EIO_COMPLETED ) |
|
#define | EINFO_EIO_COMPLETED __einfo_uniqify ( EINFO_EIO, 0x0f, "Completed" ) |
|
#define | EIO_SENSE(key) |
|
|
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) |
|
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...
|
|
static struct scsi_device * | scsidev_get (struct scsi_device *scsidev) |
| Get reference to SCSI device. More...
|
|
static void | scsidev_put (struct scsi_device *scsidev) |
| Drop reference to SCSI device. More...
|
|
static struct scsi_command * | scsicmd_get (struct scsi_command *scsicmd) |
| Get reference to SCSI command. More...
|
|
static void | scsicmd_put (struct scsi_command *scsicmd) |
| Drop reference to SCSI command. More...
|
|
static void * | scsicmd_priv (struct scsi_command *scsicmd) |
| Get SCSI command private data. More...
|
|
static void | scsicmd_free (struct refcnt *refcnt) |
| Free SCSI command. More...
|
|
static void | scsicmd_close (struct scsi_command *scsicmd, int rc) |
| Close SCSI command. More...
|
|
static int | scsicmd_command (struct scsi_command *scsicmd) |
| Construct and issue SCSI command. More...
|
|
static void | scsicmd_done (struct scsi_command *scsicmd, int rc) |
| Handle SCSI command completion. More...
|
|
static void | scsicmd_response (struct scsi_command *scsicmd, struct scsi_rsp *response) |
| Handle SCSI response. More...
|
|
static void | scsicmd_read_cmd (struct scsi_command *scsicmd, struct scsi_cmd *command) |
| Construct SCSI READ command. More...
|
|
static void | scsicmd_write_cmd (struct scsi_command *scsicmd, struct scsi_cmd *command) |
| Construct SCSI WRITE command. More...
|
|
static void | scsicmd_read_capacity_cmd (struct scsi_command *scsicmd, struct scsi_cmd *command) |
| Construct SCSI READ CAPACITY command. More...
|
|
static void | scsicmd_read_capacity_done (struct scsi_command *scsicmd, int rc) |
| Handle SCSI READ CAPACITY command completion. More...
|
|
static void | scsicmd_test_unit_ready_cmd (struct scsi_command *scsicmd __unused, struct scsi_cmd *command) |
| Construct SCSI TEST UNIT READY command. More...
|
|
static int | scsidev_command (struct scsi_device *scsidev, struct interface *block, struct scsi_command_type *type, uint64_t lba, unsigned int count, userptr_t buffer, size_t len) |
| Create SCSI command. More...
|
|
static int | scsidev_read (struct scsi_device *scsidev, struct interface *block, uint64_t lba, unsigned int count, userptr_t buffer, size_t len) |
| Issue SCSI block read. More...
|
|
static int | scsidev_write (struct scsi_device *scsidev, struct interface *block, uint64_t lba, unsigned int count, userptr_t buffer, size_t len) |
| Issue SCSI block write. More...
|
|
static int | scsidev_read_capacity (struct scsi_device *scsidev, struct interface *block) |
| Read SCSI device capacity. More...
|
|
static int | scsidev_test_unit_ready (struct scsi_device *scsidev, struct interface *block) |
| Test to see if SCSI device is ready. More...
|
|
static size_t | scsidev_window (struct scsi_device *scsidev) |
| Check SCSI device flow-control window. More...
|
|
static void | scsidev_close (struct scsi_device *scsidev, int rc) |
| Close SCSI device. More...
|
|
static void | scsidev_ready (struct scsi_device *scsidev, int rc) |
| Handle SCSI TEST UNIT READY response. More...
|
|
static void | scsidev_step (struct scsi_device *scsidev) |
| SCSI TEST UNIT READY process. More...
|
|
int | scsi_open (struct interface *block, struct interface *scsi, struct scsi_lun *lun) |
| Open SCSI device. More...
|
|
SCSI block device.
Definition in file scsi.c.
Construct and issue SCSI command.
- Return values
-
Definition at line 415 of file scsi.c.
430 DBGC ( scsidev,
"SCSI %p could not issue command: %s\n",
436 if ( scsicmd->
tag ) {
437 DBGC ( scsidev,
"SCSI %p tag %08x is now tag %08x\n",
438 scsidev, scsicmd->
tag,
tag );
struct interface scsi
SCSI control interface.
struct arbelprm_rc_send_wqe rc
void * memcpy(void *dest, const void *src, size_t len) __nonnull
struct interface scsi
SCSI data interface.
struct scsi_command_type * type
Command type.
char * strerror(int errno)
Retrieve string representation of error number.
#define SCSI_CDB_DATA(cdb)
printf() parameters for dumping a scsi_cdb
struct scsi_device * scsidev
SCSI device.
A SCSI command information unit.
#define SCSI_CDB_FORMAT
printf() format for dumping a scsi_cdb
struct scsi_lun lun
SCSI LUN.
uint64_t tag
Identity tag.
void(* cmd)(struct scsi_command *scsicmd, struct scsi_cmd *command)
Construct SCSI command IU.
void * memset(void *dest, int character, size_t len) __nonnull
References scsi_command_type::cmd, DBGC, DBGC2, scsi_device::lun, memcpy(), memset(), scsi_command_type::name, rc, scsi_command::scsi, scsi_device::scsi, SCSI_CDB_DATA, SCSI_CDB_FORMAT, scsi_command::scsidev, strerror(), tag, scsi_command::tag, and scsi_command::type.
Referenced by scsicmd_read_capacity_done(), and scsidev_command().
static void scsicmd_read_capacity_done |
( |
struct scsi_command * |
scsicmd, |
|
|
int |
rc |
|
) |
| |
|
static |
Handle SCSI READ CAPACITY command completion.
- Parameters
-
scsicmd | SCSI command |
rc | Reason for completion |
Definition at line 610 of file scsi.c.
638 if ( capacity.blocks == 0 ) {
647 capacity.max_count = -1U;
struct interface scsi
SCSI control interface.
struct arbelprm_rc_send_wqe rc
void block_capacity(struct interface *intf, struct block_device_capacity *capacity)
Report block device capacity.
SCSI "READ CAPACITY (10)" parameter data.
static void scsicmd_close(struct scsi_command *scsicmd, int rc)
Close SCSI command.
uint32_t blksize
Block length in bytes.
SCSI "READ CAPACITY (16)" parameter data.
uint32_t blksize
Block length in bytes.
SCSI READ CAPACITY private data.
#define be32_to_cpu(value)
#define be64_to_cpu(value)
uint32_t lba
Maximum logical block number.
struct scsi_device * scsidev
SCSI device.
uint64_t lba
Maximum logical block number.
static struct tlan_private * priv
struct interface block
Block data interface.
static int scsicmd_command(struct scsi_command *scsicmd)
Construct and issue SCSI command.
static void * scsicmd_priv(struct scsi_command *scsicmd)
Get SCSI command private data.
References be32_to_cpu, be64_to_cpu, block_device_capacity::blksize, scsi_capacity_10::blksize, scsi_capacity_16::blksize, scsi_command::block, block_capacity(), block_device_capacity::blocks, scsi_capacity_10::lba, scsi_capacity_16::lba, block_device_capacity::max_count, priv, rc, scsi_device::scsi, scsicmd_close(), scsicmd_command(), scsicmd_priv(), and scsi_command::scsidev.
Create SCSI command.
- Parameters
-
scsidev | SCSI device |
block | Block data interface |
type | SCSI command type |
lba | Starting logical block address |
count | Number of blocks to transfer |
buffer | Data buffer |
len | Length of data buffer |
- Return values
-
Definition at line 720 of file scsi.c.
729 scsicmd =
zalloc (
sizeof ( *scsicmd ) +
type->priv_len );
struct arbelprm_rc_send_wqe rc
static struct interface_descriptor scsicmd_scsi_desc
SCSI command SCSI interface descriptor.
uint32_t lba
Start address.
#define list_add(new, head)
Add a new entry to the head of a list.
#define ref_init(refcnt, free)
Initialise a reference counter.
struct list_head cmds
List of commands.
uint32_t type
Operating system type.
static void scsicmd_close(struct scsi_command *scsicmd, int rc)
Close SCSI command.
void intf_plug_plug(struct interface *a, struct interface *b)
Plug two object interfaces together.
uint32_t buffer
Buffer index (or NETVSC_RNDIS_NO_BUFFER)
#define ENOMEM
Not enough space.
userptr_t buffer
Data buffer.
unsigned int count
Number of blocks.
size_t len
Length of data buffer.
struct interface scsi
SCSI data interface.
struct scsi_command_type * type
Command type.
static void scsicmd_free(struct refcnt *refcnt)
Free SCSI command.
struct refcnt refcnt
Reference count.
void * zalloc(size_t size)
Allocate cleared memory.
static struct scsi_device * scsidev_get(struct scsi_device *scsidev)
Get reference to SCSI device.
struct list_head list
List of SCSI commands.
struct scsi_device * scsidev
SCSI device.
static struct interface_descriptor scsicmd_block_desc
SCSI command block interface descriptor.
uint16_t count
Number of entries.
struct interface block
Block data interface.
static int scsicmd_command(struct scsi_command *scsicmd)
Construct and issue SCSI command.
uint64_t lba
Starting logical block address.
static void intf_init(struct interface *intf, struct interface_descriptor *desc, struct refcnt *refcnt)
Initialise an object interface.
#define ref_put(refcnt)
Drop reference to object.
References block, scsi_command::block, buffer, scsi_command::buffer, scsi_device::cmds, count, scsi_command::count, ENOMEM, intf_init(), intf_plug_plug(), lba, scsi_command::lba, len, scsi_command::len, scsi_command::list, list_add, rc, ref_init, ref_put, scsi_command::refcnt, scsi_command::scsi, scsicmd_block_desc, scsicmd_close(), scsicmd_command(), scsicmd_free(), scsicmd_scsi_desc, scsi_command::scsidev, scsidev_get(), type, scsi_command::type, and zalloc().
Referenced by scsidev_read(), scsidev_read_capacity(), scsidev_test_unit_ready(), and scsidev_write().
Open SCSI device.
- Parameters
-
block | Block control interface |
scsi | SCSI control interface |
lun | SCSI LUN |
- Return values
-
Definition at line 984 of file scsi.c.
989 scsidev =
zalloc (
sizeof ( *scsidev ) );
struct interface scsi
SCSI control interface.
#define ref_init(refcnt, free)
Initialise a reference counter.
struct list_head cmds
List of commands.
static void process_init(struct process *process, struct process_descriptor *desc, struct refcnt *refcnt)
Initialise process and add to process list.
void intf_plug_plug(struct interface *a, struct interface *b)
Plug two object interfaces together.
static struct interface_descriptor scsidev_block_desc
SCSI device block interface descriptor.
static struct interface_descriptor scsidev_ready_desc
SCSI device TEST UNIT READY interface descriptor.
#define ENOMEM
Not enough space.
struct interface ready
TEST UNIT READY interface.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
struct refcnt refcnt
Reference count.
struct interface block
Block control interface.
uint8_t lun
Logical Unit Number.
void * zalloc(size_t size)
Allocate cleared memory.
#define SCSI_LUN_FORMAT
printf() format for dumping a scsi_lun
#define SCSI_LUN_DATA(lun)
printf() parameters for dumping a scsi_lun
#define INIT_LIST_HEAD(list)
Initialise a list head.
static struct interface_descriptor scsidev_scsi_desc
SCSI device SCSI interface descriptor.
static struct process_descriptor scsidev_process_desc
SCSI device process descriptor.
struct scsi_lun lun
SCSI LUN.
static void intf_init(struct interface *intf, struct interface_descriptor *desc, struct refcnt *refcnt)
Initialise an object interface.
#define NULL
NULL pointer (VOID *)
struct process process
TEST UNIT READY process.
#define ref_put(refcnt)
Drop reference to object.
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().