summaryrefslogtreecommitdiffstats
path: root/sys/dev/ata
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2004-11-10 00:33:05 +0000
committerimp <imp@FreeBSD.org>2004-11-10 00:33:05 +0000
commit8c126525fee1bb37183e14c6e7f114bd5184aa91 (patch)
tree46f12ab1af1854a3e7c20eebb2dd51cddf9f999a /sys/dev/ata
parent1e7f87c964ad8ed877e1e74de72b10aef40f1354 (diff)
downloadFreeBSD-src-8c126525fee1bb37183e14c6e7f114bd5184aa91.zip
FreeBSD-src-8c126525fee1bb37183e14c6e7f114bd5184aa91.tar.gz
Tweaks to the resource allocation to allow a few of my obscure
cdrom/ata controller PC Card devices work better.
Diffstat (limited to 'sys/dev/ata')
-rw-r--r--sys/dev/ata/ata-card.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/dev/ata/ata-card.c b/sys/dev/ata/ata-card.c
index 4c63fae..490e06c 100644
--- a/sys/dev/ata/ata-card.c
+++ b/sys/dev/ata/ata-card.c
@@ -105,11 +105,10 @@ ata_pccard_probe(device_t dev)
{
struct ata_channel *ch = device_get_softc(dev);
struct resource *io, *altio;
- int i, rid, len;
+ int i, rid;
/* allocate the io range to get start and length */
rid = ATA_IOADDR_RID;
- len = bus_get_resource_count(dev, SYS_RES_IOPORT, rid);
io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0,
ATA_IOSIZE, RF_ACTIVE);
if (!io)
@@ -125,7 +124,7 @@ ata_pccard_probe(device_t dev)
* if we got more than the default ATA_IOSIZE ports, this is a device
* where altio is located at offset 14 into "normal" io space.
*/
- if (len > ATA_IOSIZE) {
+ if (rman_get_size(io) > ATA_IOSIZE) {
ch->r_io[ATA_ALTSTAT].res = io;
ch->r_io[ATA_ALTSTAT].offset = 14;
}
@@ -161,10 +160,11 @@ ata_pccard_detach(device_t dev)
free(ch->device[MASTER].param, M_ATA);
ch->device[MASTER].param = NULL;
ata_detach(dev);
- bus_release_resource(dev, SYS_RES_IOPORT,
- ATA_ALTADDR_RID, ch->r_io[ATA_ALTSTAT].res);
- bus_release_resource(dev, SYS_RES_IOPORT,
- ATA_IOADDR_RID, ch->r_io[ATA_DATA].res);
+ if (ch->r_io[ATA_ALTSTAT].res != ch->r_io[ATA_DATA].res)
+ bus_release_resource(dev, SYS_RES_IOPORT, ATA_ALTADDR_RID,
+ ch->r_io[ATA_ALTSTAT].res);
+ bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID,
+ ch->r_io[ATA_DATA].res);
for (i = ATA_DATA; i < ATA_MAX_RES; i++)
ch->r_io[i].res = NULL;
return 0;
OpenPOWER on IntegriCloud