summary refs log tree commit diff stats
path: root/hw/scsi-bus.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2011-04-18 14:59:13 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2011-05-26 12:14:14 +0200
commitab9adc88c80186cfef29bda076363e20aa675241 (patch)
tree75899831e47ea90207dbbcbb291bd896ed420506 /hw/scsi-bus.c
parent40f16dd1279e7f26357b3c4b3838a89ffc6153da (diff)
downloadfocaccia-qemu-ab9adc88c80186cfef29bda076363e20aa675241.tar.gz
focaccia-qemu-ab9adc88c80186cfef29bda076363e20aa675241.zip
scsi: introduce scsi_req_data
This abstracts calling the command_complete callback, reducing churn
in the following patches.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'hw/scsi-bus.c')
-rw-r--r--hw/scsi-bus.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
index 0fd85fc56d..191cbabc44 100644
--- a/hw/scsi-bus.c
+++ b/hw/scsi-bus.c
@@ -495,6 +495,17 @@ static const char *scsi_command_name(uint8_t cmd)
     return names[cmd];
 }
 
+/* Called by the devices when data is ready for the HBA.  The HBA should
+   start a DMA operation to read or fill the device's data buffer.
+   Once it completes, calling one of req->dev->info->read_data or
+   req->dev->info->write_data (depending on the direction of the
+   transfer) will restart I/O.  */
+void scsi_req_data(SCSIRequest *req, int len)
+{
+    trace_scsi_req_data(req->dev->id, req->lun, req->tag, len);
+    req->bus->complete(req->bus, SCSI_REASON_DATA, req->tag, len);
+}
+
 void scsi_req_print(SCSIRequest *req)
 {
     FILE *fp = stderr;