summary refs log tree commit diff stats
path: root/hw/scsi-generic.c
diff options
context:
space:
mode:
authorBernhard Kohl <bernhard.kohl@nsn.com>2010-09-01 16:33:21 +0200
committerKevin Wolf <kwolf@redhat.com>2010-09-08 12:39:13 +0200
commitaa2b1e8908271a2d7f31b73106cb83b8b4c49dfc (patch)
treef364f0b4a353269572201a7ebbf10478a35c70a6 /hw/scsi-generic.c
parent333d50fe3d9a1ff0a6a1a44ef42a0d3a2a7f2abe (diff)
downloadfocaccia-qemu-aa2b1e8908271a2d7f31b73106cb83b8b4c49dfc.tar.gz
focaccia-qemu-aa2b1e8908271a2d7f31b73106cb83b8b4c49dfc.zip
scsi: fix and improve debug prints
Some of them are not compile clean.

Signed-off-by: Bernhard Kohl <bernhard.kohl@nsn.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/scsi-generic.c')
-rw-r--r--hw/scsi-generic.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/hw/scsi-generic.c b/hw/scsi-generic.c
index aa4f62ae57..953802777d 100644
--- a/hw/scsi-generic.c
+++ b/hw/scsi-generic.c
@@ -164,7 +164,7 @@ static void scsi_read_complete(void * opaque, int ret)
     int len;
 
     if (ret) {
-        DPRINTF("IO error\n");
+        DPRINTF("IO error ret %d\n", ret);
         scsi_command_complete(r, ret);
         return;
     }
@@ -236,7 +236,7 @@ static void scsi_write_complete(void * opaque, int ret)
     if (r->req.cmd.buf[0] == MODE_SELECT && r->req.cmd.buf[4] == 12 &&
         s->qdev.type == TYPE_TAPE) {
         s->qdev.blocksize = (r->buf[9] << 16) | (r->buf[10] << 8) | r->buf[11];
-        DPRINTF("block size %d\n", s->blocksize);
+        DPRINTF("block size %d\n", s->qdev.blocksize);
     }
 
     scsi_command_complete(r, ret);
@@ -351,8 +351,18 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag,
     }
     scsi_req_fixup(&r->req);
 
-    DPRINTF("Command: lun=%d tag=0x%x data=0x%02x len %d\n", lun, tag,
-            cmd[0], r->req.cmd.xfer);
+    DPRINTF("Command: lun=%d tag=0x%x len %zd data=0x%02x", lun, tag,
+            r->req.cmd.xfer, cmd[0]);
+
+#ifdef DEBUG_SCSI
+    {
+        int i;
+        for (i = 1; i < r->req.cmd.len; i++) {
+            printf(" 0x%02x", cmd[i]);
+        }
+        printf("\n");
+    }
+#endif
 
     if (r->req.cmd.xfer == 0) {
         if (r->buf != NULL)