summaryrefslogtreecommitdiffstats
path: root/sys/dev/advansys
diff options
context:
space:
mode:
authornyan <nyan@FreeBSD.org>2001-05-06 09:28:18 +0000
committernyan <nyan@FreeBSD.org>2001-05-06 09:28:18 +0000
commit5b903302b7738914c25fec63684a927842e95a0b (patch)
treefe887fa12a16b8d7405f36ef9bade18a61fae1b0 /sys/dev/advansys
parent3e4b90010b5b03977dedb7a0b175c27c8fc8053d (diff)
downloadFreeBSD-src-5b903302b7738914c25fec63684a927842e95a0b.zip
FreeBSD-src-5b903302b7738914c25fec63684a927842e95a0b.tar.gz
Restore I/O port resources to the condition before adv_isa_probe() is
called. Submitted by: yokota
Diffstat (limited to 'sys/dev/advansys')
-rw-r--r--sys/dev/advansys/adv_isa.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/sys/dev/advansys/adv_isa.c b/sys/dev/advansys/adv_isa.c
index a0f15e9e..7162a9b 100644
--- a/sys/dev/advansys/adv_isa.c
+++ b/sys/dev/advansys/adv_isa.c
@@ -106,7 +106,8 @@ adv_isa_probe(device_t dev)
{
int port_index;
int max_port_index;
- u_long iobase, irq;
+ u_long iobase, iocount, irq;
+ int user_iobase = 0;
int rid = 0;
void *ih;
struct resource *iores, *irqres;
@@ -117,7 +118,8 @@ adv_isa_probe(device_t dev)
port_index = 0;
max_port_index = MAX_ISA_IOPORT_INDEX;
- if (bus_get_resource(dev, SYS_RES_IOPORT, 0, &iobase, NULL) == 0) {
+ if (bus_get_resource(dev, SYS_RES_IOPORT, 0, &iobase, &iocount) == 0) {
+ user_iobase = 1;
for (;port_index <= max_port_index; port_index++)
if (iobase <= adv_isa_ioports[port_index])
break;
@@ -172,7 +174,7 @@ adv_isa_probe(device_t dev)
rman_get_bushandle(iores));
if (adv == NULL) {
bus_release_resource(dev, SYS_RES_IOPORT, 0, iores);
- return ENXIO;
+ break;
}
/*
@@ -234,7 +236,7 @@ adv_isa_probe(device_t dev)
adv_name(adv), error);
adv_free(adv);
bus_release_resource(dev, SYS_RES_IOPORT, 0, iores);
- return ENXIO;
+ break;
}
adv->init_level += 2;
@@ -256,7 +258,7 @@ adv_isa_probe(device_t dev)
adv_free(adv);
bus_release_resource(dev, SYS_RES_IOPORT, 0,
iores);
- return ENXIO;
+ break;
}
if (bus_dmamem_alloc(overrun_dmat,
(void **)&overrun_buf,
@@ -266,7 +268,7 @@ adv_isa_probe(device_t dev)
adv_free(adv);
bus_release_resource(dev, SYS_RES_IOPORT, 0,
iores);
- return ENXIO;
+ break;
}
/* And permanently map it in */
bus_dmamap_load(overrun_dmat, overrun_dmamap,
@@ -284,7 +286,7 @@ adv_isa_probe(device_t dev)
bus_dma_tag_destroy(overrun_dmat);
adv_free(adv);
bus_release_resource(dev, SYS_RES_IOPORT, 0, iores);
- return ENXIO;
+ break;
}
switch (adv->type) {
@@ -319,15 +321,15 @@ adv_isa_probe(device_t dev)
irqres = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1,
RF_ACTIVE);
if (irqres == NULL ||
- bus_setup_intr(dev, irqres, INTR_TYPE_CAM|INTR_ENTROPY, adv_intr, adv,
- &ih)) {
+ bus_setup_intr(dev, irqres, INTR_TYPE_CAM|INTR_ENTROPY,
+ adv_intr, adv, &ih)) {
bus_dmamap_unload(overrun_dmat, overrun_dmamap);
bus_dmamem_free(overrun_dmat, overrun_buf,
overrun_dmamap);
bus_dma_tag_destroy(overrun_dmat);
adv_free(adv);
bus_release_resource(dev, SYS_RES_IOPORT, 0, iores);
- return ENXIO;
+ break;
}
/* Mark as probed */
@@ -335,6 +337,11 @@ adv_isa_probe(device_t dev)
return 0;
}
+ if (user_iobase)
+ bus_set_resource(dev, SYS_RES_IOPORT, 0, iobase, iocount);
+ else
+ bus_delete_resource(dev, SYS_RES_IOPORT, 0);
+
return ENXIO;
}
OpenPOWER on IntegriCloud