Warner Losh wrote:
> There's a bug in the ata driver that Ian Downes has a patch for.

Yes - Ian sent it to me (thanks!) and indeed it does work. I've attached
the version that will fix -CURRENT.

Cheers,
Walter.
-- 
Walter Belgers         "Si hoc signum legere potes, operis boni in rebus
[EMAIL PROTECTED]       Latinis alacribus et fructuosis potiri potes!" 
--- ata-all.c.orig      Tue Oct 16 17:05:36 2001
+++ ata-all.c   Tue Oct 16 17:07:16 2001
@@ -156,7 +156,7 @@
 ata_attach(device_t dev)
 {
     struct ata_softc *scp;
-    int error, rid;
+    int error, rid, s;
 
     if (!dev)
        return ENXIO;
@@ -181,6 +181,7 @@
      * otherwise attach what the probe has found in scp->devices.
      */
     if (!ata_delayed_attach) {
+       s = splbio();
        if (scp->devices & ATA_ATA_SLAVE)
            if (ata_getparam(scp, ATA_SLAVE, ATA_C_ATA_IDENTIFY))
                scp->devices &= ~ATA_ATA_SLAVE;
@@ -205,6 +206,7 @@
        if (scp->devices & ATA_ATAPI_SLAVE)
            atapi_attach(scp, ATA_SLAVE);
 #endif
+       splx(s);
     }
     return 0;
 }
@@ -723,7 +725,7 @@
 
     /* wait for BUSY to go inactive */
     for (timeout = 0; timeout < 310000; timeout++) {
-       if (stat0 & ATA_S_BUSY) {
+       if (mask & 0x01 && stat0 & ATA_S_BUSY) {
             ATA_OUTB(scp->r_io, ATA_DRIVE, ATA_D_IBM | ATA_MASTER);
             DELAY(10);
             stat0 = ATA_INB(scp->r_io, ATA_STATUS);
@@ -738,7 +740,7 @@
                     scp->devices |= ATA_ATAPI_MASTER;
             }
         }
-        if (stat1 & ATA_S_BUSY) {
+        if (mask & 0x02 && stat1 & ATA_S_BUSY) {
             ATA_OUTB(scp->r_io, ATA_DRIVE, ATA_D_IBM | ATA_SLAVE);
             DELAY(10);
             stat1 = ATA_INB(scp->r_io, ATA_STATUS);

Reply via email to