* [Qemu-devel] [PATCH] scsi: Print command name in debug
@ 2014-06-12 5:41 Alexey Kardashevskiy
2014-06-12 9:21 ` Paolo Bonzini
0 siblings, 1 reply; 2+ messages in thread
From: Alexey Kardashevskiy @ 2014-06-12 5:41 UTC (permalink / raw)
To: qemu-devel; +Cc: Alexey Kardashevskiy, Paolo Bonzini, qemu-ppc, Alexander Graf
This makes scsi_command_name() public.
This makes use of scsi_command_name() in debug output for scsi-disk and
spapr-vscsi host bus adapter. Before this, SCSI used to print hex numbers
instead of human-friendly strings.
This adds GET_EVENT_STATUS_NOTIFICATION and READ_DISC_INFORMATION to
the list of SCSI commands supported by scsi_command_name().
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
hw/scsi/scsi-bus.c | 4 +++-
hw/scsi/scsi-disk.c | 3 ++-
hw/scsi/spapr_vscsi.c | 5 +++--
include/block/scsi.h | 2 ++
4 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
index 06399fa..5e7d30f 100644
--- a/hw/scsi/scsi-bus.c
+++ b/hw/scsi/scsi-bus.c
@@ -1429,7 +1429,7 @@ int scsi_build_sense(uint8_t *in_buf, int in_len,
}
}
-static const char *scsi_command_name(uint8_t cmd)
+const char *scsi_command_name(uint8_t cmd)
{
static const char *names[] = {
[ TEST_UNIT_READY ] = "TEST_UNIT_READY",
@@ -1545,6 +1545,8 @@ static const char *scsi_command_name(uint8_t cmd)
[ SET_READ_AHEAD ] = "SET_READ_AHEAD",
[ ALLOW_OVERWRITE ] = "ALLOW_OVERWRITE",
[ MECHANISM_STATUS ] = "MECHANISM_STATUS",
+ [ GET_EVENT_STATUS_NOTIFICATION ] = "GET_EVENT_STATUS_NOTIFICATION",
+ [ READ_DISC_INFORMATION ] = "READ_DISC_INFORMATION",
};
if (cmd >= ARRAY_SIZE(names) || names[cmd] == NULL)
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index 4bcef55..2b2266a 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -2027,7 +2027,8 @@ static int32_t scsi_disk_emulate_command(SCSIRequest *req, uint8_t *buf)
(long)r->req.cmd.xfer);
break;
default:
- DPRINTF("Unknown SCSI command (%2.2x)\n", buf[0]);
+ DPRINTF("Unknown SCSI command (%2.2x=%s)\n", buf[0],
+ scsi_command_name(buf[0]));
scsi_check_condition(r, SENSE_CODE(INVALID_OPCODE));
return 0;
}
diff --git a/hw/scsi/spapr_vscsi.c b/hw/scsi/spapr_vscsi.c
index d4ada4f..7dc0f80 100644
--- a/hw/scsi/spapr_vscsi.c
+++ b/hw/scsi/spapr_vscsi.c
@@ -800,8 +800,9 @@ static int vscsi_queue_cmd(VSCSIState *s, vscsi_req *req)
req->sreq = scsi_req_new(sdev, req->qtag, lun, srp->cmd.cdb, req);
n = scsi_req_enqueue(req->sreq);
- DPRINTF("VSCSI: Queued command tag 0x%x CMD 0x%x LUN %d ret: %d\n",
- req->qtag, srp->cmd.cdb[0], lun, n);
+ DPRINTF("VSCSI: Queued command tag 0x%x CMD 0x%x=%s LUN %d ret: %d\n",
+ req->qtag, srp->cmd.cdb[0], scsi_command_name(srp->cmd.cdb[0]),
+ lun, n);
if (n) {
/* Transfer direction must be set before preprocessing the
diff --git a/include/block/scsi.h b/include/block/scsi.h
index 9ab045b..edde960 100644
--- a/include/block/scsi.h
+++ b/include/block/scsi.h
@@ -143,6 +143,8 @@
#define READ_CD 0xbe
#define SEND_DVD_STRUCTURE 0xbf
+const char *scsi_command_name(uint8_t cmd);
+
/*
* SERVICE ACTION IN subcodes
*/
--
2.0.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] scsi: Print command name in debug
2014-06-12 5:41 [Qemu-devel] [PATCH] scsi: Print command name in debug Alexey Kardashevskiy
@ 2014-06-12 9:21 ` Paolo Bonzini
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2014-06-12 9:21 UTC (permalink / raw)
To: Alexey Kardashevskiy, qemu-devel; +Cc: qemu-ppc, Alexander Graf
Il 12/06/2014 07:41, Alexey Kardashevskiy ha scritto:
> This makes scsi_command_name() public.
>
> This makes use of scsi_command_name() in debug output for scsi-disk and
> spapr-vscsi host bus adapter. Before this, SCSI used to print hex numbers
> instead of human-friendly strings.
>
> This adds GET_EVENT_STATUS_NOTIFICATION and READ_DISC_INFORMATION to
> the list of SCSI commands supported by scsi_command_name().
>
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
> hw/scsi/scsi-bus.c | 4 +++-
> hw/scsi/scsi-disk.c | 3 ++-
> hw/scsi/spapr_vscsi.c | 5 +++--
> include/block/scsi.h | 2 ++
> 4 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
> index 06399fa..5e7d30f 100644
> --- a/hw/scsi/scsi-bus.c
> +++ b/hw/scsi/scsi-bus.c
> @@ -1429,7 +1429,7 @@ int scsi_build_sense(uint8_t *in_buf, int in_len,
> }
> }
>
> -static const char *scsi_command_name(uint8_t cmd)
> +const char *scsi_command_name(uint8_t cmd)
> {
> static const char *names[] = {
> [ TEST_UNIT_READY ] = "TEST_UNIT_READY",
> @@ -1545,6 +1545,8 @@ static const char *scsi_command_name(uint8_t cmd)
> [ SET_READ_AHEAD ] = "SET_READ_AHEAD",
> [ ALLOW_OVERWRITE ] = "ALLOW_OVERWRITE",
> [ MECHANISM_STATUS ] = "MECHANISM_STATUS",
> + [ GET_EVENT_STATUS_NOTIFICATION ] = "GET_EVENT_STATUS_NOTIFICATION",
> + [ READ_DISC_INFORMATION ] = "READ_DISC_INFORMATION",
> };
>
> if (cmd >= ARRAY_SIZE(names) || names[cmd] == NULL)
> diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
> index 4bcef55..2b2266a 100644
> --- a/hw/scsi/scsi-disk.c
> +++ b/hw/scsi/scsi-disk.c
> @@ -2027,7 +2027,8 @@ static int32_t scsi_disk_emulate_command(SCSIRequest *req, uint8_t *buf)
> (long)r->req.cmd.xfer);
> break;
> default:
> - DPRINTF("Unknown SCSI command (%2.2x)\n", buf[0]);
> + DPRINTF("Unknown SCSI command (%2.2x=%s)\n", buf[0],
> + scsi_command_name(buf[0]));
> scsi_check_condition(r, SENSE_CODE(INVALID_OPCODE));
> return 0;
> }
> diff --git a/hw/scsi/spapr_vscsi.c b/hw/scsi/spapr_vscsi.c
> index d4ada4f..7dc0f80 100644
> --- a/hw/scsi/spapr_vscsi.c
> +++ b/hw/scsi/spapr_vscsi.c
> @@ -800,8 +800,9 @@ static int vscsi_queue_cmd(VSCSIState *s, vscsi_req *req)
> req->sreq = scsi_req_new(sdev, req->qtag, lun, srp->cmd.cdb, req);
> n = scsi_req_enqueue(req->sreq);
>
> - DPRINTF("VSCSI: Queued command tag 0x%x CMD 0x%x LUN %d ret: %d\n",
> - req->qtag, srp->cmd.cdb[0], lun, n);
> + DPRINTF("VSCSI: Queued command tag 0x%x CMD 0x%x=%s LUN %d ret: %d\n",
> + req->qtag, srp->cmd.cdb[0], scsi_command_name(srp->cmd.cdb[0]),
> + lun, n);
>
> if (n) {
> /* Transfer direction must be set before preprocessing the
> diff --git a/include/block/scsi.h b/include/block/scsi.h
> index 9ab045b..edde960 100644
> --- a/include/block/scsi.h
> +++ b/include/block/scsi.h
> @@ -143,6 +143,8 @@
> #define READ_CD 0xbe
> #define SEND_DVD_STRUCTURE 0xbf
>
> +const char *scsi_command_name(uint8_t cmd);
> +
> /*
> * SERVICE ACTION IN subcodes
> */
>
Picked up, thanks.
Paolo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-06-12 9:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-12 5:41 [Qemu-devel] [PATCH] scsi: Print command name in debug Alexey Kardashevskiy
2014-06-12 9:21 ` Paolo Bonzini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.