diff options
author | sos <sos@FreeBSD.org> | 2003-04-07 14:12:12 +0000 |
---|---|---|
committer | sos <sos@FreeBSD.org> | 2003-04-07 14:12:12 +0000 |
commit | d6ec3d03e8a8f11fe2c2ad4eed44f838af3d34c5 (patch) | |
tree | d60f24537913145e9ba6870a10f8d1a18d690b6f /sys/dev/ata/ata-pci.c | |
parent | a0a3e94922941f60bddb7d4cc4f9b0899c784f32 (diff) | |
download | FreeBSD-src-d6ec3d03e8a8f11fe2c2ad4eed44f838af3d34c5.zip FreeBSD-src-d6ec3d03e8a8f11fe2c2ad4eed44f838af3d34c5.tar.gz |
Third round of updates to the ATA driver.
More DMA cleanups, including fix for breakage on older Promise controllers.
Add more ways of getting to the ATA registers.
Diffstat (limited to 'sys/dev/ata/ata-pci.c')
-rw-r--r-- | sys/dev/ata/ata-pci.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/sys/dev/ata/ata-pci.c b/sys/dev/ata/ata-pci.c index d2864cb..b79a043 100644 --- a/sys/dev/ata/ata-pci.c +++ b/sys/dev/ata/ata-pci.c @@ -157,8 +157,8 @@ ata_pci_attach(device_t dev) if ((cmd & PCIM_CMD_BUSMASTEREN) == PCIM_CMD_BUSMASTEREN) { int rid = ATA_BMADDR_RID; - if (!ctlr->r_mem) { - if (!(ctlr->r_bmio = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, + if (!ctlr->r_io2) { + if (!(ctlr->r_io1 = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, 1, RF_ACTIVE))) device_printf(dev, "Busmastering DMA not configured\n"); } @@ -182,7 +182,7 @@ ata_pci_print_child(device_t dev, device_t child) int retval = 0; retval += bus_print_child_header(dev, child); - retval += printf(": at 0x%lx", rman_get_start(ch->r_io[0].res)); + retval += printf(": at 0x%lx", rman_get_start(ch->r_io[ATA_IDX_ADDR].res)); if (ATA_MASTERDEV(dev)) retval += printf(" irq %d", 14 + ch->unit); @@ -390,10 +390,11 @@ ata_pci_allocate(device_t dev, struct ata_channel *ch) } ch->r_io[ATA_ALTSTAT].res = altio; ch->r_io[ATA_ALTSTAT].offset = 0; + ch->r_io[ATA_IDX_ADDR].res = io; - if (ctlr->r_bmio) { + if (ctlr->r_io1) { for (i = ATA_BMCMD_PORT; i <= ATA_BMDTP_PORT; i++) { - ch->r_io[i].res = ctlr->r_bmio; + ch->r_io[i].res = ctlr->r_io1; ch->r_io[i].offset = (i - ATA_BMCMD_PORT)+(ch->unit * ATA_BMIOSIZE); } @@ -420,9 +421,9 @@ ata_pci_dmastart(struct ata_channel *ch, caddr_t data, int32_t count, int dir) ATA_IDX_OUTL(ch, ATA_BMDTP_PORT, ch->dma->mdmatab); ATA_IDX_OUTB(ch, ATA_BMCMD_PORT, dir ? ATA_BMCMD_WRITE_READ : 0); ATA_IDX_OUTB(ch, ATA_BMSTAT_PORT, (ATA_IDX_INB(ch, ATA_BMSTAT_PORT) | - (ATA_BMSTAT_INTERRUPT | ATA_BMSTAT_ERROR))); + (ATA_BMSTAT_INTERRUPT | ATA_BMSTAT_ERROR))); ATA_IDX_OUTB(ch, ATA_BMCMD_PORT, - ATA_IDX_INB(ch, ATA_BMCMD_PORT) | ATA_BMCMD_START_STOP); + ATA_IDX_INB(ch, ATA_BMCMD_PORT) | ATA_BMCMD_START_STOP); return 0; } @@ -433,7 +434,7 @@ ata_pci_dmastop(struct ata_channel *ch) error = ATA_IDX_INB(ch, ATA_BMSTAT_PORT); ATA_IDX_OUTB(ch, ATA_BMCMD_PORT, - ATA_IDX_INB(ch, ATA_BMCMD_PORT) & ~ATA_BMCMD_START_STOP); + ATA_IDX_INB(ch, ATA_BMCMD_PORT) & ~ATA_BMCMD_START_STOP); ATA_IDX_OUTB(ch, ATA_BMSTAT_PORT, ATA_BMSTAT_INTERRUPT | ATA_BMSTAT_ERROR); ata_dmastop(ch); @@ -441,12 +442,6 @@ ata_pci_dmastop(struct ata_channel *ch) return (error & ATA_BMSTAT_MASK); } -static int -ata_pci_dmastatus(struct ata_channel *ch) -{ - return ATA_IDX_INB(ch, ATA_BMSTAT_PORT) & ATA_BMSTAT_MASK; -} - static int ata_pci_dmainit(struct ata_channel *ch) { @@ -457,7 +452,6 @@ ata_pci_dmainit(struct ata_channel *ch) ch->dma->start = ata_pci_dmastart; ch->dma->stop = ata_pci_dmastop; - ch->dma->status = ata_pci_dmastatus; return 0; } |