diff options
author | sos <sos@FreeBSD.org> | 2003-08-28 09:15:05 +0000 |
---|---|---|
committer | sos <sos@FreeBSD.org> | 2003-08-28 09:15:05 +0000 |
commit | 6fe35ffd35bfa5d51ae6dba2d9c8c3859d27619f (patch) | |
tree | 265062bf0e59f4b5b67a9662e489937dad95d737 /sys | |
parent | 2901a39d0d1c03a1470d27bccf5a1095d01fad92 (diff) | |
download | FreeBSD-src-6fe35ffd35bfa5d51ae6dba2d9c8c3859d27619f.zip FreeBSD-src-6fe35ffd35bfa5d51ae6dba2d9c8c3859d27619f.tar.gz |
Be more carefull on nulling the ATAPI magic for fake slave.
Skip polling devices that keeps returning 0xff early (ie no HW there).
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ata/ata-lowlevel.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/sys/dev/ata/ata-lowlevel.c b/sys/dev/ata/ata-lowlevel.c index 2bea58a..3d3c966 100644 --- a/sys/dev/ata/ata-lowlevel.c +++ b/sys/dev/ata/ata-lowlevel.c @@ -528,46 +528,48 @@ ata_reset(struct ata_channel *ch) ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_MASTER); DELAY(10); ATA_IDX_INB(ch, ATA_ERROR); - stat0 = ATA_IDX_INB(ch, ATA_STATUS); if (!(stat0 & ATA_S_BUSY)) { /* check for ATAPI signature while its still there */ lsb = ATA_IDX_INB(ch, ATA_CYL_LSB); msb = ATA_IDX_INB(ch, ATA_CYL_MSB); - ATA_IDX_OUTB(ch, ATA_CYL_LSB, 0x00); - ATA_IDX_OUTB(ch, ATA_CYL_MSB, 0x00); if (bootverbose) ata_printf(ch, ATA_MASTER, "ATAPI %02x %02x\n", lsb, msb); - if (lsb == ATAPI_MAGIC_LSB && msb == ATAPI_MAGIC_MSB) + if (lsb == ATAPI_MAGIC_LSB && msb == ATAPI_MAGIC_MSB) { ch->devices |= ATA_ATAPI_MASTER; + ATA_IDX_OUTB(ch, ATA_CYL_LSB, 0x00); + ATA_IDX_OUTB(ch, ATA_CYL_MSB, 0x00); + } } } if (stat1 & ATA_S_BUSY) { ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_SLAVE); DELAY(10); ATA_IDX_INB(ch, ATA_ERROR); - stat1 = ATA_IDX_INB(ch, ATA_STATUS); if (!(stat1 & ATA_S_BUSY)) { /* check for ATAPI signature while its still there */ lsb = ATA_IDX_INB(ch, ATA_CYL_LSB); msb = ATA_IDX_INB(ch, ATA_CYL_MSB); - ATA_IDX_OUTB(ch, ATA_CYL_LSB, 0x00); - ATA_IDX_OUTB(ch, ATA_CYL_MSB, 0x00); if (bootverbose) ata_printf(ch, ATA_SLAVE, "ATAPI %02x %02x\n", lsb, msb); - if (lsb == ATAPI_MAGIC_LSB && msb == ATAPI_MAGIC_MSB) + if (lsb == ATAPI_MAGIC_LSB && msb == ATAPI_MAGIC_MSB) { ch->devices |= ATA_ATAPI_SLAVE; + ATA_IDX_OUTB(ch, ATA_CYL_LSB, 0x00); + ATA_IDX_OUTB(ch, ATA_CYL_MSB, 0x00); + } } } if (mask == 0x01) /* wait for master only */ - if (!(stat0 & ATA_S_BUSY)) + if (!(stat0 & ATA_S_BUSY) || (stat0 == 0xff && timeout > 20)) break; if (mask == 0x02) /* wait for slave only */ - if (!(stat1 & ATA_S_BUSY)) + if (!(stat1 & ATA_S_BUSY) || (stat1 == 0xff && timeout > 20)) break; if (mask == 0x03) /* wait for both master & slave */ - if (!(stat0 & ATA_S_BUSY) && !(stat1 & ATA_S_BUSY)) + if ((!(stat0 & ATA_S_BUSY) && !(stat1 & ATA_S_BUSY)) || + (stat0 == 0xff && stat1 == 0xff && timeout > 20)) + break; DELAY(100000); } @@ -759,7 +761,7 @@ ata_pio_read(struct ata_request *request, int length) size / sizeof(int32_t)); if (request->transfersize < length) { - ata_prtdev(request->device, "WARNING - %s read data overrun %d/%d\n", + ata_prtdev(request->device, "WARNING - %s read data overrun %d>%d\n", ata_cmd2str(request), length, request->transfersize); for (resid = request->transfersize; resid < length; resid += sizeof(int16_t)) @@ -784,7 +786,7 @@ ata_pio_write(struct ata_request *request, int length) size / sizeof(int32_t)); if (request->transfersize < length) { - ata_prtdev(request->device, "WARNING - %s write data underrun %d/%d\n", + ata_prtdev(request->device, "WARNING - %s write data underrun %d>%d\n", ata_cmd2str(request), length, request->transfersize); for (resid = request->transfersize; resid < length; resid += sizeof(int16_t)) |