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.
This commit is contained in:
Warner Losh 2000-08-19 04:47:09 +00:00
parent 8ade16819d
commit 2a30553ef2
3 changed files with 21 additions and 26 deletions

View File

@ -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);

View File

@ -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),

View File

@ -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,