From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K3u8j-00089U-1b for qemu-devel@nongnu.org; Wed, 04 Jun 2008 10:39:01 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K3u8h-000874-65 for qemu-devel@nongnu.org; Wed, 04 Jun 2008 10:39:00 -0400 Received: from [199.232.76.173] (port=48843 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K3u8g-00086m-Lh for qemu-devel@nongnu.org; Wed, 04 Jun 2008 10:38:58 -0400 Received: from e4.ny.us.ibm.com ([32.97.182.144]:34128) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1K3u8g-0001l6-Ey for qemu-devel@nongnu.org; Wed, 04 Jun 2008 10:38:58 -0400 Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by e4.ny.us.ibm.com (8.13.8/8.13.8) with ESMTP id m54EZq6I019222 for ; Wed, 4 Jun 2008 10:35:52 -0400 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v8.7) with ESMTP id m54EZqM1217500 for ; Wed, 4 Jun 2008 10:35:52 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m54EZqZT026905 for ; Wed, 4 Jun 2008 10:35:52 -0400 Message-ID: <4846A83B.2050000@us.ibm.com> Date: Wed, 04 Jun 2008 09:35:39 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] ide: fix ATAPI read drive structure command (v3) References: <1211865917.8201.56.camel@bling> <1212004084.6821.30.camel@lappy> <13EAABC4-ED0C-4B91-9DF4-9486F0A1259E@suse.de> <1212418735.6656.32.camel@lappy> <8F70DBBA-DB05-4B03-886B-A2182F3A3AC6@suse.de> <1212444720.13411.12.camel@lappy> <1212446737.13411.15.camel@lappy> <4845786C.5090908@codemonkey.ws> <1212582648.10496.134.camel@bling> In-Reply-To: <1212582648.10496.134.camel@bling> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alex Williamson Cc: qemu-devel@nongnu.org, Alexander Graf Alex Williamson wrote: > On Tue, 2008-06-03 at 11:59 -0500, Anthony Liguori wrote: > >> Can you send this as an attachment or inlined as plain text? >> > > Hmm, shows up as plain text in the archives, although there is a strange > character in front of the patch title. Here it is again. Thanks, > > Alex > > Fix ATAPI read drive structure command > > Previous version ignored the allocation length parameter and read the > format byte from the wrong location. Re-implement to support the full > requirements for DVD-ROM and allow for easy extension later. > > Signed-off-by: Alex Williamson > -- > > --- a/trunk/hw/ide.c 2008-06-02 16:37:12.000000000 -0600 > +++ b/trunk/hw/ide.c 2008-06-02 16:40:11.000000000 -0600 > @@ -351,6 +351,7 @@ > #define ASC_ILLEGAL_OPCODE 0x20 > #define ASC_LOGICAL_BLOCK_OOR 0x21 > #define ASC_INV_FIELD_IN_CMD_PACKET 0x24 > +#define ASC_INCOMPATIBLE_FORMAT 0x30 > #define ASC_MEDIUM_NOT_PRESENT 0x3a > #define ASC_SAVING_PARAMETERS_NOT_SUPPORTED 0x39 > > @@ -434,6 +435,22 @@ > int media_changed; > } IDEState; > > +/* XXX: DVDs that could fit on a CD will be reported as a CD */ > +static inline int media_present(IDEState *s) > +{ > + return (s->nb_sectors > 0); > +} > + > +static inline int media_is_dvd(IDEState *s) > +{ > + return (media_present(s) && s->nb_sectors > CD_MAX_SECTORS); > +} > + > +static inline int media_is_cd(IDEState *s) > +{ > + return (media_present(s) && s->nb_sectors <= CD_MAX_SECTORS); > +} > > I think the automatic probing is good, but we should have a -drive parameter that allows the cd type to explicitly be set to either CDROM or DVD. This can be done in a follow-up patch though. I did some testing with Windows and this patch seems to do the right thing. Tested-by: Anthony Liguori Reviewed-by: Anthony Liguori Regards, Anthony Liguori