* [Qemu-devel] [PATCH] scsi: refine constants for READ CAPACITY 16
@ 2011-09-06 10:31 Paolo Bonzini
2011-09-06 13:46 ` Kevin Wolf
0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2011-09-06 10:31 UTC (permalink / raw)
To: qemu-devel
Rename SERVICE_ACTION_IN to SERVICE_ACTION_IN_16 to distinguish
from the 12-byte CDB variant, and add a constant for the subcommand.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/scsi-bus.c | 3 ++-
hw/scsi-defs.h | 8 +++++++-
hw/scsi-disk.c | 6 +++---
3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
index 7c8afff..80b8802 100644
--- a/hw/scsi-bus.c
+++ b/hw/scsi-bus.c
@@ -981,7 +981,7 @@ static const char *scsi_command_name(uint8_t cmd)
[ LOCATE_16 ] = "LOCATE_16",
[ WRITE_SAME_16 ] = "WRITE_SAME_16",
[ ERASE_16 ] = "ERASE_16",
- [ SERVICE_ACTION_IN ] = "SERVICE_ACTION_IN",
+ [ SERVICE_ACTION_IN_16 ] = "SERVICE_ACTION_IN_16",
[ WRITE_LONG_16 ] = "WRITE_LONG_16",
[ REPORT_LUNS ] = "REPORT_LUNS",
[ BLANK ] = "BLANK",
@@ -991,6 +991,7 @@ static const char *scsi_command_name(uint8_t cmd)
[ LOAD_UNLOAD ] = "LOAD_UNLOAD",
[ READ_12 ] = "READ_12",
[ WRITE_12 ] = "WRITE_12",
+ [ SERVICE_ACTION_IN_12 ] = "SERVICE_ACTION_IN_12",
[ WRITE_VERIFY_12 ] = "WRITE_VERIFY_12",
[ VERIFY_12 ] = "VERIFY_12",
[ SEARCH_HIGH_12 ] = "SEARCH_HIGH_12",
diff --git a/hw/scsi-defs.h b/hw/scsi-defs.h
index ea288fa..bfe9392 100644
--- a/hw/scsi-defs.h
+++ b/hw/scsi-defs.h
@@ -102,7 +102,7 @@
#define LOCATE_16 0x92
#define WRITE_SAME_16 0x93
#define ERASE_16 0x93
-#define SERVICE_ACTION_IN 0x9e
+#define SERVICE_ACTION_IN_16 0x9e
#define WRITE_LONG_16 0x9f
#define REPORT_LUNS 0xa0
#define BLANK 0xa1
@@ -112,6 +112,7 @@
#define LOAD_UNLOAD 0xa6
#define READ_12 0xa8
#define WRITE_12 0xaa
+#define SERVICE_ACTION_IN_12 0xab
#define WRITE_VERIFY_12 0xae
#define VERIFY_12 0xaf
#define SEARCH_HIGH_12 0xb0
@@ -123,6 +124,11 @@
#define SET_CD_SPEED 0xbb
/*
+ * SERVICE ACTION IN subcodes
+ */
+#define SAI_READ_CAPACITY_16 0x10
+
+/*
* SAM Status codes
*/
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index a1c5812..487f6cb 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -945,9 +945,9 @@ static int scsi_disk_emulate_command(SCSIDiskReq *r)
outbuf[7] = 8; // CD-ROM
buflen = 8;
break;
- case SERVICE_ACTION_IN:
+ case SERVICE_ACTION_IN_16:
/* Service Action In subcommands. */
- if ((req->cmd.buf[1] & 31) == 0x10) {
+ if ((req->cmd.buf[1] & 31) == SAI_READ_CAPACITY_16) {
DPRINTF("SAI READ CAPACITY(16)\n");
memset(outbuf, 0, req->cmd.xfer);
bdrv_get_geometry(s->bs, &nb_sectors);
@@ -1045,7 +1045,7 @@ static int32_t scsi_send_command(SCSIRequest *req, uint8_t *buf)
case READ_CAPACITY_10:
case READ_TOC:
case GET_CONFIGURATION:
- case SERVICE_ACTION_IN:
+ case SERVICE_ACTION_IN_16:
case VERIFY_10:
rc = scsi_disk_emulate_command(r);
if (rc < 0) {
--
1.7.6
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] scsi: refine constants for READ CAPACITY 16
2011-09-06 10:31 [Qemu-devel] [PATCH] scsi: refine constants for READ CAPACITY 16 Paolo Bonzini
@ 2011-09-06 13:46 ` Kevin Wolf
0 siblings, 0 replies; 2+ messages in thread
From: Kevin Wolf @ 2011-09-06 13:46 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: qemu-devel
Am 06.09.2011 12:31, schrieb Paolo Bonzini:
> Rename SERVICE_ACTION_IN to SERVICE_ACTION_IN_16 to distinguish
> from the 12-byte CDB variant, and add a constant for the subcommand.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Thanks, applied to the block branch.
Kevin
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-09-06 13:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-06 10:31 [Qemu-devel] [PATCH] scsi: refine constants for READ CAPACITY 16 Paolo Bonzini
2011-09-06 13:46 ` Kevin Wolf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).