aboutsummaryrefslogtreecommitdiff
path: root/hw/spapr_vscsi.c
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2011-04-18 13:36:02 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2011-05-26 12:14:16 +0200
commit74382217ca8f25a530c9f63e6b523e6259d7719a (patch)
tree5075f9599c392fde8019c06a293662ee27922ea1 /hw/spapr_vscsi.c
parent0c34459b6af1b7ed2f000995b9bcb1c722646fbb (diff)
scsi: Implement 'get_sense' callback
The get_sense callback copies existing sense information into the provided buffer. This is required if sense information should be transferred together with the command response. Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'hw/spapr_vscsi.c')
-rw-r--r--hw/spapr_vscsi.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/hw/spapr_vscsi.c b/hw/spapr_vscsi.c
index 762a22ec4a..bae670a377 100644
--- a/hw/spapr_vscsi.c
+++ b/hw/spapr_vscsi.c
@@ -450,6 +450,15 @@ static void vscsi_send_request_sense(VSCSIState *s, vscsi_req *req)
uint8_t *cdb = req->iu.srp.cmd.cdb;
int n;
+ n = scsi_req_get_sense(req->sreq, req->sense, sizeof(req->sense));
+ if (n) {
+ req->senselen = n;
+ vscsi_send_rsp(s, req, CHECK_CONDITION, 0, 0);
+ vscsi_put_req(s, req);
+ return;
+ }
+
+ dprintf("VSCSI: Got CHECK_CONDITION, requesting sense...\n");
cdb[0] = 3;
cdb[1] = 0;
cdb[2] = 0;
@@ -522,7 +531,6 @@ static void vscsi_command_complete(SCSIRequest *sreq, int reason, uint32_t arg)
}
vscsi_send_rsp(s, req, 0, res_in, res_out);
} else if (arg == CHECK_CONDITION) {
- dprintf("VSCSI: Got CHECK_CONDITION, requesting sense...\n");
vscsi_send_request_sense(s, req);
return;
} else {