[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 25/55] scsi-disk: add stubs for more MMC commands
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 25/55] scsi-disk: add stubs for more MMC commands |
Date: |
Mon, 31 Oct 2011 14:30:00 +0100 |
From: Paolo Bonzini <address@hidden>
This patch adds a few stub implementations for MMC commands to
scsi-disk, to be filled in later in the series. It also adds to
scsi-defs.h constants for commands implemented by ide/atapi.c,
when missing.
Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
hw/scsi-defs.h | 3 ++
hw/scsi-disk.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++----
2 files changed, 65 insertions(+), 5 deletions(-)
diff --git a/hw/scsi-defs.h b/hw/scsi-defs.h
index 5e6c9b7..d0a467a 100644
--- a/hw/scsi-defs.h
+++ b/hw/scsi-defs.h
@@ -113,6 +113,7 @@
#define READ_12 0xa8
#define WRITE_12 0xaa
#define SERVICE_ACTION_IN_12 0xab
+#define READ_DVD_STRUCTURE 0xad
#define WRITE_VERIFY_12 0xae
#define VERIFY_12 0xaf
#define SEARCH_HIGH_12 0xb0
@@ -122,6 +123,8 @@
#define SEND_VOLUME_TAG 0xb6
#define READ_DEFECT_DATA_12 0xb7
#define SET_CD_SPEED 0xbb
+#define MECHANISM_STATUS 0xbd
+#define READ_CD 0xbe
/*
* SERVICE ACTION IN subcodes
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index 3a08848..bdb98ef 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -567,6 +567,43 @@ static int scsi_disk_emulate_inquiry(SCSIRequest *req,
uint8_t *outbuf)
return buflen;
}
+static int scsi_read_dvd_structure(SCSIDiskState *s, SCSIDiskReq *r,
+ uint8_t *outbuf)
+{
+ scsi_check_condition(r, SENSE_CODE(INVALID_OPCODE));
+ return -1;
+}
+
+static int scsi_get_event_status_notification(SCSIDiskState *s,
+ SCSIDiskReq *r, uint8_t *outbuf)
+{
+ scsi_check_condition(r, SENSE_CODE(INVALID_OPCODE));
+ return -1;
+}
+
+static int scsi_get_configuration(SCSIDiskState *s, SCSIDiskReq *r,
+ uint8_t *outbuf)
+{
+ if (s->qdev.type != TYPE_ROM) {
+ return -1;
+ }
+ memset(outbuf, 0, 8);
+ /* ??? This should probably return much more information. For now
+ just return the basic header indicating the CD-ROM profile. */
+ outbuf[7] = 8; /* CD-ROM */
+ return 8;
+}
+
+static int scsi_emulate_mechanism_status(SCSIDiskState *s, uint8_t *outbuf)
+{
+ if (s->qdev.type != TYPE_ROM) {
+ return -1;
+ }
+ memset(outbuf, 0, 8);
+ outbuf[5] = 1; /* CD-ROM */
+ return 8;
+}
+
static int mode_sense_page(SCSIDiskState *s, int page, uint8_t **p_outbuf,
int page_control)
{
@@ -964,12 +1001,29 @@ static int scsi_disk_emulate_command(SCSIDiskReq *r)
outbuf[7] = 0;
buflen = 8;
break;
+ case MECHANISM_STATUS:
+ buflen = scsi_emulate_mechanism_status(s, outbuf);
+ if (buflen < 0) {
+ goto illegal_request;
+ }
+ break;
case GET_CONFIGURATION:
- memset(outbuf, 0, 8);
- /* ??? This should probably return much more information. For now
- just return the basic header indicating the CD-ROM profile. */
- outbuf[7] = 8; // CD-ROM
- buflen = 8;
+ buflen = scsi_get_configuration(s, r, outbuf);
+ if (buflen < 0) {
+ goto illegal_request;
+ }
+ break;
+ case GET_EVENT_STATUS_NOTIFICATION:
+ buflen = scsi_get_event_status_notification(s, r, outbuf);
+ if (buflen < 0) {
+ goto illegal_request;
+ }
+ break;
+ case READ_DVD_STRUCTURE:
+ buflen = scsi_read_dvd_structure(s, r, outbuf);
+ if (buflen < 0) {
+ goto illegal_request;
+ }
break;
case SERVICE_ACTION_IN_16:
/* Service Action In subcommands. */
@@ -1073,7 +1127,10 @@ static int32_t scsi_send_command(SCSIRequest *req,
uint8_t *buf)
case ALLOW_MEDIUM_REMOVAL:
case READ_CAPACITY_10:
case READ_TOC:
+ case READ_DVD_STRUCTURE:
case GET_CONFIGURATION:
+ case GET_EVENT_STATUS_NOTIFICATION:
+ case MECHANISM_STATUS:
case SERVICE_ACTION_IN_16:
case VERIFY_10:
rc = scsi_disk_emulate_command(r);
--
1.7.6.4
- [Qemu-devel] [PATCH 20/55] atapi: move GESN definitions to scsi-defs.h, (continued)
- [Qemu-devel] [PATCH 20/55] atapi: move GESN definitions to scsi-defs.h, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 30/55] scsi-disk: report media changed via GET EVENT STATUS NOTIFICATION, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 23/55] scsi-disk: report media changed via unit attention sense codes, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 42/55] scsi-generic: look at host status, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 48/55] scsi: make reqops const, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 53/55] scsi-generic: bump SCSIRequest reference count until aio completion runs, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 27/55] atapi/scsi-disk: make mode page values coherent between the two, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 28/55] scsi-disk: support DVD profile in GET CONFIGURATION, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 54/55] scsi: push request restart to SCSIDevice, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 29/55] scsi-disk: support READ DVD STRUCTURE, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 25/55] scsi-disk: add stubs for more MMC commands,
Kevin Wolf <=
- [Qemu-devel] [PATCH 43/55] scsi-generic: snoop READ CAPACITY commands to get block size, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 32/55] qdev: switch children device list to QTAILQ, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 19/55] atapi/scsi: unify definitions for MMC, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 26/55] scsi-disk: store valid mode pages in a table, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 39/55] scsi-generic: drop SCSIGenericState, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 24/55] scsi-disk: fix coding style issues (braces), Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 31/55] scsi: move tcq/ndev to SCSIBusOps (now SCSIBusInfo), Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 34/55] scsi: implement REPORT LUNS for arbitrary LUNs, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 55/55] scsi-disk: add scsi-block for device passthrough, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 41/55] scsi-generic: check ioctl statuses when SG_IO succeeds, Kevin Wolf, 2011/10/31