summaryrefslogtreecommitdiffstats
path: root/sys/dev/pcic
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2000-08-19 04:47:09 +0000
committerimp <imp@FreeBSD.org>2000-08-19 04:47:09 +0000
commit037be25ed3d6141fafe190b0cd650f6a5fc255ff (patch)
treed83023eedcb87c9966dae5d6375c0cdb8cb25c80 /sys/dev/pcic
parent5b74deeea0da4626c74d81c4801c5020aac9c897 (diff)
downloadFreeBSD-src-037be25ed3d6141fafe190b0cd650f6a5fc255ff.zip
FreeBSD-src-037be25ed3d6141fafe190b0cd650f6a5fc255ff.tar.gz
Remove pcic_isa_identify. I don't think it is needed.
Add pcic_detach which removes all of the pcic's children. This lets me load/unload pcic multiple times w/o having multiple instances of each slot attached to pcic.
Diffstat (limited to 'sys/dev/pcic')
-rw-r--r--sys/dev/pcic/i82365.c19
-rw-r--r--sys/dev/pcic/i82365_isa.c27
-rw-r--r--sys/dev/pcic/i82365var.h1
3 files changed, 21 insertions, 26 deletions
diff --git a/sys/dev/pcic/i82365.c b/sys/dev/pcic/i82365.c
index 3b11018..5204e94 100644
--- a/sys/dev/pcic/i82365.c
+++ b/sys/dev/pcic/i82365.c
@@ -1514,4 +1514,23 @@ pcic_start_threads(void *arg)
}
}
+int
+pcic_detach(device_t dev)
+{
+ device_t pccarddev;
+ device_t *kids;
+ int nkids;
+ int i;
+ int ret;
+
+ device_get_children(dev, &kids, &nkids);
+ for (i = 0; i < nkids; i++) {
+ if ((ret = device_delete_child(pccarddev, kids[i])) != 0)
+ device_printf(dev, "delete of %s failed: %d\n",
+ device_get_nameunit(kids[i]), ret);
+ }
+ free(kids, M_TEMP);
+ return (bus_generic_detach(dev));
+}
+
SYSINIT(pcic, SI_SUB_KTHREAD_IDLE, SI_ORDER_ANY, pcic_start_threads, 0);
diff --git a/sys/dev/pcic/i82365_isa.c b/sys/dev/pcic/i82365_isa.c
index 3dc67dd..6518460 100644
--- a/sys/dev/pcic/i82365_isa.c
+++ b/sys/dev/pcic/i82365_isa.c
@@ -272,31 +272,6 @@ pcic_isa_check(device_t dev, u_int16_t addr)
}
#endif
-static void
-pcic_isa_identify(driver_t *driver, device_t parent)
-{
-#if 0
- device_t child;
- u_int16_t ioaddrs[] = { 0x3e0, 0x3e2, 0x3e4, 0x3e6, 0 };
- u_int16_t ioaddr;
- int i;
-
- for (i = 0; ioaddrs[i]; i++) {
- ioaddr = ioaddrs[i];
- if (pcic_isa_check(parent, ioaddr)) {
- child = BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE,
- "pcic", -1);
- device_set_driver(child, driver);
-/* XXX */
- bus_set_resource(child, SYS_RES_IRQ, 0, 10, 1);
- bus_set_resource(child, SYS_RES_MEMORY, 0, 0xd0000, 1 << 12);
- bus_set_resource(child, SYS_RES_IOPORT, 0, ioaddr,
- PCIC_IOSIZE);
- }
- }
-#endif
-}
-
static int
pcic_isa_probe(device_t dev)
{
@@ -384,12 +359,12 @@ static int
pcic_isa_detach(device_t dev)
{
pcic_deactivate(dev);
+ pcic_detach(dev);
return 0;
}
static device_method_t pcic_isa_methods[] = {
/* Device interface */
- DEVMETHOD(device_identify, pcic_isa_identify),
DEVMETHOD(device_probe, pcic_isa_probe),
DEVMETHOD(device_attach, pcic_isa_attach),
DEVMETHOD(device_detach, pcic_isa_detach),
diff --git a/sys/dev/pcic/i82365var.h b/sys/dev/pcic/i82365var.h
index f14f3ed..b926ffd 100644
--- a/sys/dev/pcic/i82365var.h
+++ b/sys/dev/pcic/i82365var.h
@@ -179,6 +179,7 @@ struct resource *pcic_alloc_resource(device_t dev, device_t child, int type,
void pcic_deactivate(device_t dev);
int pcic_deactivate_resource(device_t dev, device_t child, int type, int rid,
struct resource *r);
+int pcic_detach(device_t dev);
int pcic_release_resource(device_t dev, device_t child, int type, int rid,
struct resource *r);
int pcic_setup_intr(device_t dev, device_t child, struct resource *irq,
OpenPOWER on IntegriCloud