michaelvogt / rpms / qemu

Forked from rpms/qemu 3 months ago
Clone
02760b1
From: Brandon Philips <brandon@ifup.org>
02760b1
Newsgroups: gmane.comp.emulators.qemu
02760b1
Subject: [PATCH][RFC] Fix bugs in the ATAPI cdrom driver
02760b1
Date: Fri, 17 Aug 2007 16:43:04 -0700
02760b1
Message-ID: <20070817234304.GB10490@ifup.org>
02760b1
Reply-To: qemu-devel@nongnu.org
02760b1
02760b1
The new libata-eh in the Linux kernel is throwing a fit over the QEMU
02760b1
cdrom device for two reasons:
02760b1
02760b1
1) DRQ can be set with ERR_STAT set.  This is a violation of the ATAPI
02760b1
state machine.
02760b1
02760b1
2) After a TEST_UNIT_READY ATAPI command is sent ERR_STAT is getting set
02760b1
which is correct.  But, when the OS issues another ATAPI command
02760b1
ERR_STAT is still set.  Which is bad since the next expected command
02760b1
from the OS is REQUEST_SENSE to find out why ERR_STAT is set.
02760b1
02760b1
bug this fixes: https://bugzilla.novell.com/show_bug.cgi?id=291775
02760b1
02760b1
Signed-off-by: Brandon Philips <bphilips@suse.de>
02760b1
02760b1
---
02760b1
 hw/ide.c |    7 +++++--
02760b1
 1 file changed, 5 insertions(+), 2 deletions(-)
02760b1
02760b1
Index: qemu-0.9.0/hw/ide.c
02760b1
===================================================================
02760b1
--- qemu-0.9.0.orig/hw/ide.c
02760b1
+++ qemu-0.9.0/hw/ide.c
02760b1
@@ -586,7 +586,9 @@ static void ide_transfer_start(IDEState 
02760b1
     s->end_transfer_func = end_transfer_func;
02760b1
     s->data_ptr = buf;
02760b1
     s->data_end = buf + size;
02760b1
-    s->status |= DRQ_STAT;
02760b1
+    /* don't violate the HSM */
02760b1
+    if (!(s->status & ERR_STAT))
02760b1
+        s->status |= DRQ_STAT;
02760b1
 }
02760b1
 
02760b1
 static void ide_transfer_stop(IDEState *s)
02760b1
@@ -1805,6 +1807,7 @@ static void ide_ioport_write(void *opaqu
02760b1
             /* overlapping commands not supported */
02760b1
             if (s->feature & 0x02)
02760b1
                 goto abort_cmd;
02760b1
+            s->status = READY_STAT;
02760b1
             s->atapi_dma = s->feature & 1;
02760b1
             s->nsector = 1;
02760b1
             ide_transfer_start(s, s->io_buffer, ATAPI_PACKET_SIZE, 
02760b1
02760b1
02760b1