[SeaBIOS] [PATCH] ata: send TEST UNIT READY correctly

Paolo Bonzini pbonzini at redhat.com
Mon Mar 19 11:41:09 CET 2012


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 at gmx.net
reported to cause boot failures.

Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
---
 src/ata.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/ata.c b/src/ata.c
index 76e4f20..c37691a 100644
--- 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
-- 
1.7.7.6




More information about the SeaBIOS mailing list