Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IMBTM-0002E2-V2 for qemu-devel@nongnu.org; Fri, 17 Aug 2007 19:43:20 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IMBTL-0002DI-Km for qemu-devel@nongnu.org; Fri, 17 Aug 2007 19:43:20 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IMBTL-0002Cz-CP for qemu-devel@nongnu.org; Fri, 17 Aug 2007 19:43:19 -0400 Received: from rv-out-0910.google.com ([209.85.198.190]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IMBTK-0002oy-JK for qemu-devel@nongnu.org; Fri, 17 Aug 2007 19:43:19 -0400 Received: by rv-out-0910.google.com with SMTP id g11so1953257rvb for ; Fri, 17 Aug 2007 16:43:08 -0700 (PDT) Date: Fri, 17 Aug 2007 16:43:04 -0700 From: Brandon Philips Message-ID: <20070817234304.GB10490@ifup.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH][RFC] Fix bugs in the ATAPI cdrom driver Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org The new libata-eh in the Linux kernel is throwing a fit over the QEMU cdrom device for two reasons: 1) DRQ can be set with ERR_STAT set. This is a violation of the ATAPI state machine. 2) After a TEST_UNIT_READY ATAPI command is sent ERR_STAT is getting set which is correct. But, when the OS issues another ATAPI command ERR_STAT is still set. Which is bad since the next expected command from the OS is REQUEST_SENSE to find out why ERR_STAT is set. bug this fixes: https://bugzilla.novell.com/show_bug.cgi?id=291775 Signed-off-by: Brandon Philips --- hw/ide.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) Index: qemu-0.9.0/hw/ide.c =================================================================== --- qemu-0.9.0.orig/hw/ide.c +++ qemu-0.9.0/hw/ide.c @@ -586,7 +586,9 @@ static void ide_transfer_start(IDEState s->end_transfer_func = end_transfer_func; s->data_ptr = buf; s->data_end = buf + size; - s->status |= DRQ_STAT; + /* don't violate the HSM */ + if (!(s->status & ERR_STAT)) + s->status |= DRQ_STAT; } static void ide_transfer_stop(IDEState *s) @@ -1805,6 +1807,7 @@ static void ide_ioport_write(void *opaqu /* overlapping commands not supported */ if (s->feature & 0x02) goto abort_cmd; + s->status = READY_STAT; s->atapi_dma = s->feature & 1; s->nsector = 1; ide_transfer_start(s, s->io_buffer, ATAPI_PACKET_SIZE,