Re: SeaBIOS cdrom regression with Vista

Message ID 20091120180351.GA21458@morn.localdomain
State New
Headers show

Commit Message

Kevin O'Connor Nov. 20, 2009, 6:03 p.m.
On Wed, Nov 18, 2009 at 12:19:20AM -0500, Kevin O'Connor wrote:
> On Tue, Nov 17, 2009 at 03:21:31PM +0200, Avi Kivity wrote:
> > qemu-kvm's switch to seabios uncovered a regression with cdrom handling.  
> > Vista x64 no longer recognizes the cdrom, while pc-bios still works.  
> > Installing works, but that uses int 13, not the native driver.  Haven't 
> > investigated further yet.
> The only things I can think of that could impact the OS recognizing a
> cdrom would be: the cdrom left in an odd state (seems unlikely as the
> OS usually does a full reset), ACPI differences, or int1348 errors.

I've looked into this, and it looks like the cdrom is left in an odd
state.  At this point, I think SeaBIOS is tickling a bug outside of
seabios (eg, in Vista or qemu).  I would appreciate it someone with
cdrom knowledge of qemu could help.

Here is what I'm seeing.

As reported, the following fails:
qemu -hda winvista -cdrom util.iso

The following also fails:
qemu -hdc winvista -drive file=util.iso,media=cdrom,index=0

However, this works!?
qemu -hdc winvista -drive file=util.iso,media=cdrom,index=1

And this works (both cdroms are seen):
qemu -hdc winvista -drive file=util.iso,media=cdrom,index=0 -drive file=util2.iso,media=cdrom,index=1

The following also works:
qemu -hda winvista -hdc someotherdrive

And this works too:
qemu -hdd winvista -cdrom util.iso

So, basically, something is causing vista to not like the cdrom, but
only when the cdrom is a master and there is no slave.

Tracking this further, if I apply the patch to seabios below, I find
that it still fails, but if I uncomment the first check then
everything works.  This leads me to believe that sending an "identify
packet device" request to a non-existent slave when a cdrom is master
is causing that cdrom master to not be liked by vista.

SeaBIOS has a different ata drive detection mechanism than bochs - it
needs it in order to work on real hardware.  So, this explains why
bochs bios doesn't show this issue.  (Seabios tries to send an
"identify packet device" and then an "identify device" command to
detect a drive; bochs bios looks for a signature in the ata registers
after an ata reset.)

Any thoughts?


--- a/src/ata.c
+++ b/src/ata.c
@@ -713,9 +713,14 @@  ata_detect(void *data)
             last_reset_ataid = ataid;
+//        if (slave)
+//            continue;
         // check for ATAPI
         u16 buffer[256];
         struct drive_s *drive_g = init_drive_atapi(&dummy, buffer);
+        if (slave)
+            continue;
         if (!drive_g) {
             // Didn't find an ATAPI drive - look for ATA drive.
             u8 st = inb(iobase1+ATA_CB_STAT);