diff --git a/sys/dev/pci/isa_pci.c b/sys/dev/pci/isa_pci.c index 5690df187cfa..3f1b779c1900 100644 --- a/sys/dev/pci/isa_pci.c +++ b/sys/dev/pci/isa_pci.c @@ -42,6 +42,7 @@ #include <sys/bus.h> #include <sys/rman.h> +#include <isa/isavar.h> #include <pci/pcivar.h> #include <pci/pcireg.h> @@ -54,7 +55,7 @@ struct isab_softc { }; static int isab_probe(device_t dev); -static int isab_attach(device_t dev); +static int pci_isab_attach(device_t dev); static int isab_detach(device_t dev); static int isab_resume(device_t dev); static int isab_suspend(device_t dev); @@ -62,7 +63,7 @@ static int isab_suspend(device_t dev); static device_method_t isab_methods[] = { /* Device interface */ DEVMETHOD(device_probe, isab_probe), - DEVMETHOD(device_attach, isab_attach), + DEVMETHOD(device_attach, pci_isab_attach), DEVMETHOD(device_detach, isab_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), DEVMETHOD(device_suspend, isab_suspend), @@ -86,8 +87,6 @@ static driver_t isab_driver = { sizeof(struct isab_softc), }; -static devclass_t isab_devclass; - DRIVER_MODULE(isab, pci, isab_driver, isab_devclass, 0, 0); /* @@ -155,21 +154,17 @@ isab_probe(device_t dev) } static int -isab_attach(device_t dev) +pci_isab_attach(device_t dev) { - device_t child; struct isab_softc *sc = device_get_softc(dev); int error, rid; /* * Attach an ISA bus. Note that we can only have one ISA bus. */ - child = device_add_child(dev, "isa", 0); - if (child != NULL) { - error = bus_generic_attach(dev); - if (error) - return (error); - } + error = isab_attach(dev); + if (error) + return (error); switch (pci_get_devid(dev)) { case 0x71108086: /* Intel 82371AB */ diff --git a/sys/isa/isa_common.c b/sys/isa/isa_common.c index 3e36a52574e0..4f8409396a6c 100644 --- a/sys/isa/isa_common.c +++ b/sys/isa/isa_common.c @@ -1117,3 +1117,20 @@ DRIVER_MODULE(isa, eisab, isa_driver, isa_devclass, 0, 0); DRIVER_MODULE(isa, legacy, isa_driver, isa_devclass, 0, 0); #endif MODULE_VERSION(isa, 1); + +/* + * Code common to ISA bridges. + */ + +devclass_t isab_devclass; + +int +isab_attach(device_t dev) +{ + device_t child; + + child = device_add_child(dev, "isa", 0); + if (child != NULL) + return (bus_generic_attach(dev)); + return (ENXIO); +} diff --git a/sys/isa/isavar.h b/sys/isa/isavar.h index d0306e0a3721..5a7621ea14a6 100644 --- a/sys/isa/isavar.h +++ b/sys/isa/isavar.h @@ -152,6 +152,9 @@ ISA_ACCESSOR(logicalid, LOGICALID, int) ISA_ACCESSOR(compatid, COMPATID, int) ISA_ACCESSOR(configattr, CONFIGATTR, int) +/* Device class for ISA bridges. */ +extern devclass_t isab_devclass; + extern intrmask_t isa_irq_pending(void); extern void isa_probe_children(device_t dev); @@ -164,6 +167,8 @@ extern void isa_dma_release(int chan); extern int isa_dmastatus(int chan); extern int isa_dmastop(int chan); +int isab_attach(device_t dev); + #ifdef PC98 #include <machine/bus.h>