diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-02-08 10:40:37 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2012-05-04 10:39:52 +0200 |
commit | a5ee9085627eaeb501db31e3758df4e18500be71 (patch) | |
tree | 587aa233f8d13ae3f3ad1129247d5636b58e3f40 /hw/scsi-bus.c | |
parent | 31e8fd86f24b4eec8a1708d712bf0532460bb0a5 (diff) | |
download | qemu-a5ee9085627eaeb501db31e3758df4e18500be71.zip qemu-a5ee9085627eaeb501db31e3758df4e18500be71.tar.gz qemu-a5ee9085627eaeb501db31e3758df4e18500be71.tar.bz2 |
scsi: fix WRITE SAME transfer length and direction
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/scsi-bus.c')
-rw-r--r-- | hw/scsi-bus.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c index c29a4ae..5640aae 100644 --- a/hw/scsi-bus.c +++ b/hw/scsi-bus.c @@ -791,7 +791,8 @@ static int scsi_req_length(SCSICommand *cmd, SCSIDevice *dev, uint8_t *buf) case MODE_SENSE: break; case WRITE_SAME_10: - cmd->xfer = 1; + case WRITE_SAME_16: + cmd->xfer = dev->blocksize; break; case READ_CAPACITY_10: cmd->xfer = 8; @@ -909,6 +910,10 @@ static int scsi_req_stream_length(SCSICommand *cmd, SCSIDevice *dev, uint8_t *bu static void scsi_cmd_xfer_mode(SCSICommand *cmd) { + if (!cmd->xfer) { + cmd->mode = SCSI_XFER_NONE; + return; + } switch (cmd->buf[0]) { case WRITE_6: case WRITE_10: @@ -934,6 +939,7 @@ static void scsi_cmd_xfer_mode(SCSICommand *cmd) case UPDATE_BLOCK: case WRITE_LONG_10: case WRITE_SAME_10: + case WRITE_SAME_16: case SEARCH_HIGH_12: case SEARCH_EQUAL_12: case SEARCH_LOW_12: @@ -946,11 +952,7 @@ static void scsi_cmd_xfer_mode(SCSICommand *cmd) cmd->mode = SCSI_XFER_TO_DEV; break; default: - if (cmd->xfer) - cmd->mode = SCSI_XFER_FROM_DEV; - else { - cmd->mode = SCSI_XFER_NONE; - } + cmd->mode = SCSI_XFER_FROM_DEV; break; } } |