diff options
| author | Søren Schmidt <sos@FreeBSD.org> | 2000-11-08 19:31:39 +0000 |
|---|---|---|
| committer | Søren Schmidt <sos@FreeBSD.org> | 2000-11-08 19:31:39 +0000 |
| commit | 30a777baa8d8802497558eb098d9e01dcd5c847f (patch) | |
| tree | fa444fb07025d6d50367282f93b42d3cc5d22a4a /sys/dev | |
| parent | 328b7df0264fe9acfd22c1a671aeaeb8a806f51b (diff) | |
Notes
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/ata/ata-all.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c index b93efc6cb6f1..d398af2d2153 100644 --- a/sys/dev/ata/ata-all.c +++ b/sys/dev/ata/ata-all.c @@ -771,7 +771,7 @@ ata_testregs(struct ata_softc *scp) outb(scp->ioaddr + ATA_ERROR, 0x58); outb(scp->ioaddr + ATA_CYL_LSB, 0xa5); return (inb(scp->ioaddr + ATA_ERROR) != 0x58 && - inb(scp->ioaddr + ATA_CYL_LSB) == 0xa5) ? 1 : 0; + inb(scp->ioaddr + ATA_CYL_LSB) == 0xa5); } static int @@ -1259,6 +1259,7 @@ ata_reset(struct ata_softc *scp, int *mask) DELAY(10000); inb(scp->ioaddr + ATA_ERROR); DELAY(3000); + scp->devices = 0; /* in some setups we dont want to test for a slave */ if (scp->flags & ATA_NO_SLAVE) @@ -1275,8 +1276,6 @@ ata_reset(struct ata_softc *scp, int *mask) if (inb(scp->ioaddr + ATA_CYL_LSB) == ATAPI_MAGIC_LSB && inb(scp->ioaddr + ATA_CYL_MSB) == ATAPI_MAGIC_MSB) scp->devices |= ATA_ATAPI_MASTER; - else if (status0 != 0x00 && ata_testregs(scp)) - scp->devices |= ATA_ATA_MASTER; } } if (status1 & ATA_S_BUSY) { @@ -1288,8 +1287,6 @@ ata_reset(struct ata_softc *scp, int *mask) if (inb(scp->ioaddr + ATA_CYL_LSB) == ATAPI_MAGIC_LSB && inb(scp->ioaddr + ATA_CYL_MSB) == ATAPI_MAGIC_MSB) scp->devices |= ATA_ATAPI_SLAVE; - else if (status1 != 0x00 && ata_testregs(scp)) - scp->devices |= ATA_ATA_SLAVE; } } if (*mask == 0x01) /* wait for master only */ @@ -1305,6 +1302,7 @@ ata_reset(struct ata_softc *scp, int *mask) } DELAY(1); outb(scp->altioaddr, ATA_A_4BIT); + if (status0 & ATA_S_BUSY) *mask &= ~0x01; if (status1 & ATA_S_BUSY) @@ -1313,7 +1311,20 @@ ata_reset(struct ata_softc *scp, int *mask) ata_printf(scp, -1, "mask=%02x status0=%02x status1=%02x\n", *mask, status0, status1); if (!mask) - scp->devices = 0; + return; + + if (status0 != 0x00 && !(scp->devices & ATA_ATAPI_MASTER)) { + outb(scp->ioaddr + ATA_DRIVE, (ATA_D_IBM | ATA_MASTER)); + DELAY(1); + if (ata_testregs(scp)) + scp->devices |= ATA_ATA_MASTER; + } + if (status1 != 0x00 && !(scp->devices & ATA_ATAPI_SLAVE)) { + outb(scp->ioaddr + ATA_DRIVE, (ATA_D_IBM | ATA_SLAVE)); + DELAY(1); + if (ata_testregs(scp)) + scp->devices |= ATA_ATA_SLAVE; + } } int |
