diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2008-05-26 15:06:40 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2008-05-26 15:06:40 -0400 |
commit | 3e1b6496be3100d182b764a6eeee94e94e894185 (patch) | |
tree | 0639c56cfde564481037228421c03b811b26fd73 /src/ata.c | |
parent | ac8df8c1dbdc789454b3739898d16eebc3e7dbff (diff) | |
download | seabios-hppa-3e1b6496be3100d182b764a6eeee94e94e894185.zip seabios-hppa-3e1b6496be3100d182b764a6eeee94e94e894185.tar.gz seabios-hppa-3e1b6496be3100d182b764a6eeee94e94e894185.tar.bz2 |
Fix bug causing ata_reset to not wait for BSY to clear.
ata_reset is always called on a valid drive - it shouldn't need to recheck.
All callers expect BSY to be clear upon completion.
This fixes an issue where ata_detect was reading status before drive ready.
Diffstat (limited to 'src/ata.c')
-rw-r--r-- | src/ata.c | 31 |
1 files changed, 15 insertions, 16 deletions
@@ -118,25 +118,24 @@ ata_reset(int driveid) outb(ATA_CB_DC_HD15 | ATA_CB_DC_NIEN, iobase2+ATA_CB_DC); type=GET_EBDA(ata.devices[driveid].type); - if (type != ATA_TYPE_NONE) { - // 8.2.1 (g) -- check for sc==sn==0x01 - // select device - outb(slave?ATA_CB_DH_DEV1:ATA_CB_DH_DEV0, iobase1+ATA_CB_DH); - sc = inb(iobase1+ATA_CB_SC); - sn = inb(iobase1+ATA_CB_SN); - - if ( (sc==0x01) && (sn==0x01) ) { - if (type == ATA_TYPE_ATA) //ATA - await_ide(NOT_BSY_RDY, iobase1, IDE_TIMEOUT); - else //ATAPI - await_ide(NOT_BSY, iobase1, IDE_TIMEOUT); - } - - // 8.2.1 (h) -- wait for not BSY - await_ide(NOT_BSY, iobase1, IDE_TIMEOUT); + // 8.2.1 (g) -- check for sc==sn==0x01 + // select device + outb(slave ? ATA_CB_DH_DEV1 : ATA_CB_DH_DEV0, iobase1+ATA_CB_DH); + sc = inb(iobase1+ATA_CB_SC); + sn = inb(iobase1+ATA_CB_SN); + + // XXX - why special check for ATA and ready? + if ( (sc==0x01) && (sn==0x01) ) { + if (type == ATA_TYPE_ATA) //ATA + await_ide(NOT_BSY_RDY, iobase1, IDE_TIMEOUT); + else //ATAPI + await_ide(NOT_BSY, iobase1, IDE_TIMEOUT); } + // 8.2.1 (h) -- wait for not BSY + await_ide(NOT_BSY, iobase1, IDE_TIMEOUT); + // Enable interrupts outb(ATA_CB_DC_HD15, iobase2+ATA_CB_DC); } |