summaryrefslogtreecommitdiffstats
path: root/sys/dev/ata/ata-lowlevel.c
diff options
context:
space:
mode:
authorsos <sos@FreeBSD.org>2005-04-08 09:37:47 +0000
committersos <sos@FreeBSD.org>2005-04-08 09:37:47 +0000
commit807c19e46482af6c9718dc815d967bcf150208ed (patch)
tree4fdd7d0f1c14c46c4d5644201fa9543da4203488 /sys/dev/ata/ata-lowlevel.c
parenta2b6f806840b15fedd7fb6d52c4487302428cab1 (diff)
downloadFreeBSD-src-807c19e46482af6c9718dc815d967bcf150208ed.zip
FreeBSD-src-807c19e46482af6c9718dc815d967bcf150208ed.tar.gz
Generalise the SATA PHY handling code so it wont be duplicated for
each SATA chip. Promise and Silicon Image are the current candidates for this.
Diffstat (limited to 'sys/dev/ata/ata-lowlevel.c')
-rw-r--r--sys/dev/ata/ata-lowlevel.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/sys/dev/ata/ata-lowlevel.c b/sys/dev/ata/ata-lowlevel.c
index b94558e..ba322ee 100644
--- a/sys/dev/ata/ata-lowlevel.c
+++ b/sys/dev/ata/ata-lowlevel.c
@@ -79,6 +79,9 @@ ata_getparam(device_t parent, struct ata_device *atadev, u_int8_t command)
/* select device */
ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_D_LBA | atadev->unit);
+ /* wait a bit to let slow devices settle */
+ DELAY(100);
+
/* disable interrupt */
ATA_IDX_OUTB(ch, ATA_CONTROL, ATA_A_4BIT | ATA_A_IDS);
@@ -610,15 +613,7 @@ ata_generic_reset(struct ata_channel *ch)
u_int8_t err = 0, lsb = 0, msb = 0;
int mask = 0, timeout;
- /* if DMA functionality present stop it */
- if (ch->dma) {
- if (ch->dma->stop)
- ch->dma->stop(ch);
- if (ch->dma->flags & ATA_DMA_LOADED)
- ch->dma->unload(ch);
- }
-
- /* reset host end of channel (if supported) */
+ /* reset controller (host) */
ATA_RESET(ch->dev);
/* do we have any signs of ATA/ATAPI HW being present ? */
@@ -752,8 +747,8 @@ ata_wait(struct ata_channel *ch, struct ata_device *atadev, u_int8_t mask)
DELAY(1);
- /* wait 5 seconds for device to get !BUSY */
- while (timeout < 5000000) {
+ /* wait at max 1 second for device to get !BUSY */
+ while (timeout < 1000000) {
status = ATA_IDX_INB(ch, ATA_ALTSTAT);
/* if drive fails status, reselect the drive and try again */
@@ -777,7 +772,7 @@ ata_wait(struct ata_channel *ch, struct ata_device *atadev, u_int8_t mask)
DELAY(10);
}
}
- if (timeout >= 5000000)
+ if (timeout >= 1000000)
return -2;
if (!mask)
return (status & ATA_S_ERROR);
OpenPOWER on IntegriCloud