diff options
author | Paolo Bonzini | 2011-07-06 11:55:37 +0200 |
---|---|---|
committer | Paolo Bonzini | 2012-02-22 13:29:07 +0100 |
commit | 01e95455889780871374e1b72cd6919cfbd23399 (patch) | |
tree | 402da6c430ccf8c2e8169201c920631786d69386 /hw/scsi-bus.c | |
parent | ahci: use new DMA helpers (diff) | |
download | qemu-01e95455889780871374e1b72cd6919cfbd23399.tar.gz qemu-01e95455889780871374e1b72cd6919cfbd23399.tar.xz qemu-01e95455889780871374e1b72cd6919cfbd23399.zip |
scsi: pass residual amount to command_complete
With the upcoming sglist support, HBAs will not see any transfer_data
call and will not have a way to detect short transfers. So pass the
residual amount of data upon command completion.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/scsi-bus.c')
-rw-r--r-- | hw/scsi-bus.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c index b3e97ceeec..eb97c878bf 100644 --- a/hw/scsi-bus.c +++ b/hw/scsi-bus.c @@ -533,6 +533,8 @@ SCSIRequest *scsi_req_new(SCSIDevice *d, uint32_t tag, uint32_t lun, } req->cmd = cmd; + req->resid = req->cmd.xfer; + switch (buf[0]) { case INQUIRY: trace_scsi_inquiry(d->id, lun, tag, cmd.buf[1], cmd.buf[2]); @@ -1275,10 +1277,12 @@ void scsi_req_data(SCSIRequest *req, int len) { if (req->io_canceled) { trace_scsi_req_data_canceled(req->dev->id, req->lun, req->tag, len); - } else { - trace_scsi_req_data(req->dev->id, req->lun, req->tag, len); - req->bus->info->transfer_data(req, len); + return; } + trace_scsi_req_data(req->dev->id, req->lun, req->tag, len); + assert(req->cmd.mode != SCSI_XFER_NONE); + req->resid -= len; + req->bus->info->transfer_data(req, len); } void scsi_req_print(SCSIRequest *req) @@ -1337,7 +1341,7 @@ void scsi_req_complete(SCSIRequest *req, int status) scsi_req_ref(req); scsi_req_dequeue(req); - req->bus->info->complete(req, req->status); + req->bus->info->complete(req, req->status, req->resid); scsi_req_unref(req); } |