(Message inbox:6742) Date: Tue, 16 Oct 2001 15:48:32 BST To: walter@belgers.com cc: Warner Losh From: Ian Dowse Subject: Re: pcmcia cdrom/irq sharing problem? In-Reply-To: Your message of "Tue, 16 Oct 2001 16:36:03 +0200." <20011016163603.B89828@teletubbie.het.net.je> In message <20011016163603.B89828@teletubbie.het.net.je>, walter@belgers.com wr ites: >Warner Losh wrote: >> There's a bug in the ata driver that Ian Downes has a patch for. > >Thanks Warner. Ian, can you tell me where to find the patch? Here it is - you can get the rest of the details by searching for 200110102047 AND aa14135 in the freebsd-mobile archives. Ian Index: ata-all.c =================================================================== RCS file: /home/iedowse/CVS/src/sys/dev/ata/ata-all.c,v retrieving revision 1.50.2.20 diff -u -r1.50.2.20 ata-all.c --- ata-all.c 2001/08/28 17:56:14 1.50.2.20 +++ ata-all.c 2001/10/10 18:48:15 @@ -885,7 +885,7 @@ ata_attach(device_t dev) { struct ata_softc *scp = device_get_softc(dev); - int error, rid = 0; + int error, rid = 0, s; if (!scp || scp->flags & ATA_ATTACHED) return ENXIO; @@ -906,6 +906,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; @@ -930,6 +931,7 @@ if (scp->devices & ATA_ATAPI_SLAVE) atapi_attach(scp, ATA_SLAVE); #endif + splx(s); } scp->flags |= ATA_ATTACHED; return 0; @@ -1285,7 +1287,7 @@ /* wait for BUSY to go inactive */ for (timeout = 0; timeout < 310000; timeout++) { - if (status0 & ATA_S_BUSY) { + if (*mask & 0x01 && status0 & ATA_S_BUSY) { outb(scp->ioaddr + ATA_DRIVE, ATA_D_IBM | ATA_MASTER); DELAY(10); status0 = inb(scp->ioaddr + ATA_STATUS); @@ -1300,7 +1302,7 @@ scp->devices |= ATA_ATAPI_MASTER; } } - if (status1 & ATA_S_BUSY) { + if (*mask & 0x02 && status1 & ATA_S_BUSY) { outb(scp->ioaddr + ATA_DRIVE, ATA_D_IBM | ATA_SLAVE); DELAY(10); status1 = inb(scp->ioaddr + ATA_STATUS);