diff options
Diffstat (limited to 'virtio-v1.0-wd01-part1-specification.txt')
-rw-r--r-- | virtio-v1.0-wd01-part1-specification.txt | 80 |
1 files changed, 41 insertions, 39 deletions
diff --git a/virtio-v1.0-wd01-part1-specification.txt b/virtio-v1.0-wd01-part1-specification.txt index c883996..bc44492 100644 --- a/virtio-v1.0-wd01-part1-specification.txt +++ b/virtio-v1.0-wd01-part1-specification.txt @@ -1613,8 +1613,6 @@ device except where noted. VIRTIO_BLK_F_BLK_SIZE (6) Block size of disk is in “blk_size”. - VIRTIO_BLK_F_SCSI (7) Device supports scsi packet commands. - VIRTIO_BLK_F_FLUSH (9) Cache flush command support. Device configuration layout The capacity of the device @@ -1634,7 +1632,11 @@ device except where noted. u32 blk_size; }; -2.4.2.3. Device Initialization +2.4.2.3.1 Legacy Interface: Feature bits +-------------------- + VIRTIO_BLK_F_SCSI (7) Device supports scsi packet commands. + +2.4.2.4. Device Initialization ----------------------------- 1. The device size should be read from the “capacity” @@ -1664,27 +1666,8 @@ the device (not necessarily in order). Each request is of form: u8 status; }; -If the device has VIRTIO_BLK_F_SCSI feature, it can also support -scsi packet command requests, each of these requests is of form: - - struct virtio_scsi_pc_req { - u32 type; - u32 ioprio; - u64 sector; - char cmd[]; - char data[][512]; -#define SCSI_SENSE_BUFFERSIZE 96 - u8 sense[SCSI_SENSE_BUFFERSIZE]; - u32 errors; - u32 data_len; - u32 sense_len; - u32 residual; - u8 status; - }; - The type of the request is either a read (VIRTIO_BLK_T_IN), a write -(VIRTIO_BLK_T_OUT), a scsi packet command (VIRTIO_BLK_T_SCSI_CMD or -VIRTIO_BLK_T_SCSI_CMD_OUT[22]) or a flush (VIRTIO_BLK_T_FLUSH or +(VIRTIO_BLK_T_OUT), or a flush (VIRTIO_BLK_T_FLUSH or VIRTIO_BLK_T_FLUSH_OUT[23]). If the device has VIRTIO_BLK_F_BARRIER feature the high bit (VIRTIO_BLK_T_BARRIER) indicates that this request acts as a barrier and that all preceeding requests must be @@ -1696,8 +1679,6 @@ flush the host cache. #define VIRTIO_BLK_T_IN 0 #define VIRTIO_BLK_T_OUT 1 - #define VIRTIO_BLK_T_SCSI_CMD 2 - #define VIRTIO_BLK_T_SCSI_CMD_OUT 3 #define VIRTIO_BLK_T_FLUSH 4 #define VIRTIO_BLK_T_FLUSH_OUT 5 #define VIRTIO_BLK_T_BARRIER 0x80000000 @@ -1710,6 +1691,41 @@ The sector number indicates the offset (multiplied by 512) where the read or write is to occur. This field is unused and set to 0 for scsi packet commands and for flush commands. +The final status byte is written by the device: either +VIRTIO_BLK_S_OK for success, VIRTIO_BLK_S_IOERR for host or guest +error or VIRTIO_BLK_S_UNSUPP for a request unsupported by host: + + #define VIRTIO_BLK_S_OK 0 + #define VIRTIO_BLK_S_IOERR 1 + #define VIRTIO_BLK_S_UNSUPP 2 + +2.4.2.5.1 Legacy Interface: Device Operation +------------------------ +If the device has VIRTIO_BLK_F_SCSI feature, it can also support +scsi packet command requests, each of these requests is of form: + + struct virtio_scsi_pc_req { + u32 type; + u32 ioprio; + u64 sector; + char cmd[]; + char data[][512]; +#define SCSI_SENSE_BUFFERSIZE 96 + u8 sense[SCSI_SENSE_BUFFERSIZE]; + u32 errors; + u32 data_len; + u32 sense_len; + u32 residual; + u8 status; + }; + +A request type can also be a scsi packet command (VIRTIO_BLK_T_SCSI_CMD or +VIRTIO_BLK_T_SCSI_CMD_OUT). The two types are equivalent, the device +does not distinguish between them: + + #define VIRTIO_BLK_T_SCSI_CMD 2 + #define VIRTIO_BLK_T_SCSI_CMD_OUT 3 + The cmd field is only present for scsi packet command requests, and indicates the command to perform. This field must reside in a single, separate read-only buffer; command length can be derived @@ -1735,17 +1751,6 @@ The residual field is only present for scsi packet command requests and indicates the residual size, calculated as data length - number of bytes actually transferred. -The final status byte is written by the device: either -VIRTIO_BLK_S_OK for success, VIRTIO_BLK_S_IOERR for host or guest -error or VIRTIO_BLK_S_UNSUPP for a request unsupported by host: - - #define VIRTIO_BLK_S_OK 0 - #define VIRTIO_BLK_S_IOERR 1 - #define VIRTIO_BLK_S_UNSUPP 2 - -2.4.2.5.1 Legacy Interface: Device Operation ------------------------- - Historically, devices assumed that the fields type, ioprio and sector reside in a single, separate read-only buffer; the fields errors, data_len, sense_len and residual reside in a single, @@ -2948,9 +2953,6 @@ elements. silently switch to allmulti or promiscuous mode if it is given too many addresses. -[22] The SCSI_CMD and SCSI_CMD_OUT types are equivalent, the device -does not distinguish between them. - [23] The FLUSH and FLUSH_OUT types are equivalent, the device does not distinguish between them |