On Mon, May 18, 2009 at 7:59 PM, Vladimir 'phcoder' Serbinenko
<phco...@gmail.com> wrote:
> On Mon, May 18, 2009 at 7:59 PM, Vladimir 'phcoder' Serbinenko
> <phco...@gmail.com> wrote:
>> Hello. While experimenting with ata.mod on qemu I noticed it doesn't
>> see the CD when it wasn't already initialised by bios. Just putting
>> the status check after identify check solves the problem. However I'm
>> not familiar with ata so I would like someone to have a look at it
> Forgotten attachement
File was empty and mailer was rejecting it. I haven't forgotten it
actually. Anyway here you go
>>
>> --
>> Regards
>> Vladimir 'phcoder' Serbinenko
>>
>
>
>
> --
> Regards
> Vladimir 'phcoder' Serbinenko
>



-- 
Regards
Vladimir 'phcoder' Serbinenko
diff --git a/ChangeLog b/ChangeLog
index f5bc28b..4dec14d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-05-18  Vladimir Serbinenko  <phco...@gmail.com>
+
+	Fix a false negative for ata disks
+
+	* disk/ata.c (grub_ata_device_initialize): check for status after 
+	identify
+	
 2009-05-17  Vladimir Serbinenko  <phco...@gmail.com>
 
 	Not fail if unable to retrieve C/H/S on LBA disks
diff --git a/disk/ata.c b/disk/ata.c
index ea42d59..32a314b 100644
--- a/disk/ata.c
+++ b/disk/ata.c
@@ -334,16 +334,6 @@ grub_ata_device_initialize (int port, int device, int addr, int addr2)
   grub_ata_regset (dev, GRUB_ATA_REG_DISK, dev->device << 4);
   grub_ata_wait ();
 
-  /* If status is 0x00, it is safe to assume that there
-     is no device (or only a !READY) device connected.  */
-  grub_int8_t sts = grub_ata_regget (dev, GRUB_ATA_REG_STATUS);
-  grub_dprintf ("ata", "status=0x%x\n", sts);
-  if (sts == 0x00)
-    {
-      grub_free(dev);
-      return 0;
-    }
-
   /* Try to detect if the port is in use by writing to it,
      waiting for a while and reading it again.  If the value
      was preserved, there is a device connected.
@@ -365,6 +355,17 @@ grub_ata_device_initialize (int port, int device, int addr, int addr2)
   if (grub_ata_identify (dev))
     {
       grub_free (dev);
+      grub_errno = GRUB_ERR_NONE;
+      return 0;
+    }
+
+  /* If status is 0x00, it is safe to assume that there
+     is no device (or only a !READY) device connected.  */
+  grub_int8_t sts = grub_ata_regget (dev, GRUB_ATA_REG_STATUS);
+  grub_dprintf ("ata", "status=0x%x\n", sts);
+  if (sts == 0x00)
+    {
+      grub_free(dev);
       return 0;
     }
 
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to