diff options
author | sos <sos@FreeBSD.org> | 2003-03-29 13:37:09 +0000 |
---|---|---|
committer | sos <sos@FreeBSD.org> | 2003-03-29 13:37:09 +0000 |
commit | 1aa8f29ccf0eb6c6db95c1257318186a901b5ef9 (patch) | |
tree | bb9ce90b8fcfe8e400644fa3aceb2bcd039d7993 /sys/dev/ata/ata-isa.c | |
parent | ededebc1a4663fdc2452865586200d45a8fef1fe (diff) | |
download | FreeBSD-src-1aa8f29ccf0eb6c6db95c1257318186a901b5ef9.zip FreeBSD-src-1aa8f29ccf0eb6c6db95c1257318186a901b5ef9.tar.gz |
Second round of updates to the ATA driver.
Clean up the DMA interface too much unneeded stuff crept in with
the busdma code back when.
Modify the ATA_IN* / ATA_OUT* macros so that resource and offset
are gotten from a table. That allows for new chipsets that doesn't
nessesarily have things ordered the good old way. This also removes
the need for the wierd PC98 resource functions.
Tested on: i386, PC98, Alpha, Sparc64
Diffstat (limited to 'sys/dev/ata/ata-isa.c')
-rw-r--r-- | sys/dev/ata/ata-isa.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/sys/dev/ata/ata-isa.c b/sys/dev/ata/ata-isa.c index fba5b73..0f4688a 100644 --- a/sys/dev/ata/ata-isa.c +++ b/sys/dev/ata/ata-isa.c @@ -70,9 +70,9 @@ static int ata_isa_probe(device_t dev) { struct ata_channel *ch = device_get_softc(dev); - struct resource *io; + struct resource *io = NULL, *altio = NULL; u_long tmp; - int rid; + int i, rid; /* check isapnp ids */ if (ISA_PNP_PROBE(device_get_parent(dev), dev, ata_ids) == ENXIO) @@ -83,7 +83,7 @@ ata_isa_probe(device_t dev) io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, ATA_IOSIZE, RF_ACTIVE); if (!io) - return ENOMEM; + return ENXIO; /* set the altport range */ if (bus_get_resource(dev, SYS_RES_IOPORT, ATA_ALTADDR_RID, &tmp, &tmp)) { @@ -91,7 +91,24 @@ ata_isa_probe(device_t dev) rman_get_start(io) + ATA_ALTOFFSET, ATA_ALTIOSIZE); } - bus_release_resource(dev, SYS_RES_IOPORT, rid, io); + /* allocate the altport range */ + rid = ATA_ALTADDR_RID; + altio = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, + ATA_ALTIOSIZE, RF_ACTIVE); + if (!altio) { + bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, io); + return ENXIO; + } + + /* setup the resource vectors */ + for (i = ATA_DATA; i <= ATA_STATUS; i++) { + ch->r_io[i].res = io; + ch->r_io[i].offset = i; + } + ch->r_io[ATA_ALTSTAT].res = altio; + ch->r_io[ATA_ALTSTAT].offset = 0; + + /* initialize softc for this channel */ ch->unit = 0; ch->flags |= ATA_USE_16BIT; ch->locking = ata_isa_lock; |