From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:50773) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RFo7G-0001xX-M5 for qemu-devel@nongnu.org; Mon, 17 Oct 2011 10:24:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RFo7F-000864-Eq for qemu-devel@nongnu.org; Mon, 17 Oct 2011 10:24:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:9137) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RFo7F-00085u-4o for qemu-devel@nongnu.org; Mon, 17 Oct 2011 10:24:33 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p9HEOWeX000456 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 17 Oct 2011 10:24:32 -0400 Message-ID: <4E9C3B59.5030800@redhat.com> Date: Mon, 17 Oct 2011 16:27:37 +0200 From: Kevin Wolf MIME-Version: 1.0 References: <1318503845-11473-1-git-send-email-pbonzini@redhat.com> <1318503845-11473-8-git-send-email-pbonzini@redhat.com> In-Reply-To: <1318503845-11473-8-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 07/35] scsi-disk: add stubs for more MMC commands List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org Am 13.10.2011 13:03, schrieb Paolo Bonzini: > 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 > --- > hw/scsi-defs.h | 3 ++ > hw/scsi-disk.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++---- > 2 files changed, 61 insertions(+), 5 deletions(-) > > diff --git a/hw/scsi-defs.h b/hw/scsi-defs.h > index 8094698..030d4c2 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 880cb22..95a6b77 100644 > --- a/hw/scsi-disk.c > +++ b/hw/scsi-disk.c > @@ -563,6 +563,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) > { > @@ -947,12 +984,25 @@ 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; Braces are missing here and in the other commands. Kevin