]> xenbits.xensource.com Git - seabios.git/commitdiff
ata: send TEST UNIT READY correctly
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 19 Mar 2012 10:41:09 +0000 (11:41 +0100)
committerKevin O'Connor <kevin@koconnor.net>
Wed, 21 Mar 2012 23:42:09 +0000 (19:42 -0400)
The ATAPI driver does not need to support writes, but it does needs to
avoid the PIO transfer and DRQ check when TEST UNIT READY is sent.
Since TEST UNIT READY has no payload, checking for not busy is enough.

This fixes a timeout when booting from CD/DVD, which fellaw@gmx.net
reported to cause boot failures.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
src/ata.c

index 76e4f20d2f9cd6b35a078d9e2200a8ef21969c7d..c37691a04a52a706d339b0454a43f52e853089bf 100644 (file)
--- a/src/ata.c
+++ b/src/ata.c
@@ -645,13 +645,15 @@ atapi_cmd_data(struct disk_op_s *op, void *cdbcmd, u16 blocksize)
         ret = -2;
         goto fail;
     }
-    if (!(status & ATA_CB_STAT_DRQ)) {
-        dprintf(6, "send_atapi_cmd : DRQ not set (status %02x)\n", status);
-        ret = -3;
-        goto fail;
-    }
+    if (blocksize) {
+        if (!(status & ATA_CB_STAT_DRQ)) {
+            dprintf(6, "send_atapi_cmd : DRQ not set (status %02x)\n", status);
+            ret = -3;
+            goto fail;
+        }
 
-    ret = ata_pio_transfer(op, 0, blocksize);
+        ret = ata_pio_transfer(op, 0, blocksize);
+    }
 
 fail:
     // Enable interrupts