- Make the isab devclass global to allow for multiple ISA bridge drivers.

- Factor out code common to all ISA bridge drivers attach methods into a
  isab_attach() function.
- Rename the PCI-ISA bridge driver's attach function to pci_isab_attach()
  and have it call isab_attach().
This commit is contained in:
John Baldwin 2003-07-08 18:56:58 +00:00
parent 486d26019c
commit c37faf267c
3 changed files with 29 additions and 12 deletions

View File

@ -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 */

View File

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

View File

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