diff options
author | Christian Hoff | 2012-06-14 15:55:28 +0200 |
---|---|---|
committer | Paolo Bonzini | 2012-07-02 11:27:00 +0200 |
commit | 9ce1bb2d36f24af79d2757497acbaf4dc4a2e302 (patch) | |
tree | 7b1b1a9f576c4f102228230daae47bb64ad0e198 /hw/scsi-bus.c | |
parent | scsi: Add basic support for SCSI media changer commands. (diff) | |
download | qemu-9ce1bb2d36f24af79d2757497acbaf4dc4a2e302.tar.gz qemu-9ce1bb2d36f24af79d2757497acbaf4dc4a2e302.tar.xz qemu-9ce1bb2d36f24af79d2757497acbaf4dc4a2e302.zip |
scsi: Fix transfer length for READ POSITION commands.
The transfer length depends on the specific service action
code, as defined in the SCSI stream commands spec section 7.7.
Up to now only the extended form was supported.
Signed-off-by: Christian Hoff <christian.hoff@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/scsi-bus.c')
-rw-r--r-- | hw/scsi-bus.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c index 9c64e30279..5ad1013be1 100644 --- a/hw/scsi-bus.c +++ b/hw/scsi-bus.c @@ -901,7 +901,21 @@ static int scsi_req_stream_length(SCSICommand *cmd, SCSIDevice *dev, uint8_t *bu cmd->xfer = buf[13] | (buf[12] << 8); break; case READ_POSITION: - cmd->xfer = buf[8] | (buf[7] << 8); + switch (buf[1] & 0x1f) /* operation code */ { + case SHORT_FORM_BLOCK_ID: + case SHORT_FORM_VENDOR_SPECIFIC: + cmd->xfer = 20; + break; + case LONG_FORM: + cmd->xfer = 32; + break; + case EXTENDED_FORM: + cmd->xfer = buf[8] | (buf[7] << 8); + break; + default: + return -1; + } + break; case FORMAT_UNIT: cmd->xfer = buf[4] | (buf[3] << 8); |