diff options
| -rw-r--r-- | sys/dev/ata/ata-all.c | 9 | ||||
| -rw-r--r-- | sys/dev/ata/ata-all.h | 1 | ||||
| -rw-r--r-- | sys/dev/ata/ata-chipset.c | 8 | ||||
| -rw-r--r-- | sys/dev/ata/ata-lowlevel.c | 7 |
4 files changed, 18 insertions, 7 deletions
diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c index fba9edc38919..89f20c668f68 100644 --- a/sys/dev/ata/ata-all.c +++ b/sys/dev/ata/ata-all.c @@ -734,6 +734,15 @@ ata_boot_attach(void) /* * misc support functions */ +void +ata_udelay(int interval) +{ + if (interval < (1000000/hz) || ata_delayed_attach) + DELAY(interval); + else + tsleep(&interval, PRIBIO, "ataslp", interval/(1000000/hz)); +} + static void bswap(int8_t *buf, int len) { diff --git a/sys/dev/ata/ata-all.h b/sys/dev/ata/ata-all.h index 6d85989f9add..7de6d7f5f418 100644 --- a/sys/dev/ata/ata-all.h +++ b/sys/dev/ata/ata-all.h @@ -390,6 +390,7 @@ int ata_attach(device_t dev); int ata_detach(device_t dev); int ata_suspend(device_t dev); int ata_resume(device_t dev); +void ata_udelay(int interval); int ata_printf(struct ata_channel *ch, int device, const char *fmt, ...) __printflike(3, 4); int ata_prtdev(struct ata_device *atadev, const char *fmt, ...) __printflike(2, 3); void ata_set_name(struct ata_device *atadev, char *name, int lun); diff --git a/sys/dev/ata/ata-chipset.c b/sys/dev/ata/ata-chipset.c index 15f4e35bc716..9abd1d623122 100644 --- a/sys/dev/ata/ata-chipset.c +++ b/sys/dev/ata/ata-chipset.c @@ -926,9 +926,9 @@ ata_intel_reset(struct ata_channel *ch) pci_write_config(parent, 0x92, pci_read_config(parent, 0x92, 2) | mask, 2); while (timeout--) { - DELAY(10000); + ata_udelay(10000); if ((pci_read_config(parent, 0x92, 2) & (mask << 4)) == (mask << 4)) { - DELAY(10000); + ata_udelay(10000); return; } } @@ -1107,7 +1107,7 @@ ata_nvidia_ident(device_t dev) static struct ata_chip_id ids[] = {{ ATA_NFORCE1, 0, AMDNVIDIA, NVIDIA, ATA_UDMA5, "nVidia nForce" }, { ATA_NFORCE2, 0, AMDNVIDIA, NVIDIA, ATA_UDMA6, "nVidia nForce2" }, - { ATA_NFORCE2_MCP, 0, AMDNVIDIA, NVIDIA, ATA_UDMA6, "nVidia MCP" }, + { ATA_NFORCE2_MCP, 0, AMDNVIDIA, NVIDIA, ATA_UDMA6, "nVidia nForce2 MCP" }, { ATA_NFORCE3, 0, AMDNVIDIA, NVIDIA, ATA_UDMA6, "nVidia nForce3" }, { ATA_NFORCE3_PRO, 0, AMDNVIDIA, NVIDIA, ATA_UDMA6, "nVidia nForce3 Pro" }, { ATA_NFORCE3_MCP, 0, AMDNVIDIA, NVIDIA, ATA_UDMA6, "nVidia nForce3 MCP" }, @@ -2171,7 +2171,7 @@ ata_sii_reset(struct ata_channel *ch) ATA_IDX_OUTL(ch, ATA_BMDEVSPEC_1, 0x00000001); DELAY(25000); ATA_IDX_OUTL(ch, ATA_BMDEVSPEC_1, 0x00000000); - tsleep(ch, PRIBIO, "siirst", hz); + ata_udelay(1000000); } static void diff --git a/sys/dev/ata/ata-lowlevel.c b/sys/dev/ata/ata-lowlevel.c index 65e2c24bd051..3fef4a6cde41 100644 --- a/sys/dev/ata/ata-lowlevel.c +++ b/sys/dev/ata/ata-lowlevel.c @@ -48,6 +48,7 @@ static int ata_generic_transaction(struct ata_request *); static void ata_generic_interrupt(void *); static void ata_generic_reset(struct ata_channel *); static int ata_wait(struct ata_device *, u_int8_t); +/*static int ata_command(struct ata_device *, u_int8_t, u_int64_t, u_int16_t, u_int16_t);*/ static void ata_pio_read(struct ata_request *, int); static void ata_pio_write(struct ata_request *, int); @@ -585,9 +586,9 @@ ata_generic_reset(struct ata_channel *ch) ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_MASTER); DELAY(10); ATA_IDX_OUTB(ch, ATA_ALTSTAT, ATA_A_IDS | ATA_A_RESET); - DELAY(10000); + ata_udelay(10000); ATA_IDX_OUTB(ch, ATA_ALTSTAT, ATA_A_IDS); - DELAY(100000); + ata_udelay(100000); ATA_IDX_INB(ch, ATA_ERROR); /* wait for BUSY to go inactive */ @@ -656,7 +657,7 @@ ata_generic_reset(struct ata_channel *ch) if (stat1 == 0xff && timeout > 5) mask &= ~0x02; } - DELAY(100000); + ata_udelay(100000); } if (bootverbose) |
