summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2003-07-08 18:56:58 +0000
committerjhb <jhb@FreeBSD.org>2003-07-08 18:56:58 +0000
commit810e95d9a74415521fcdc42fec34f678a610e04a (patch)
tree2c8ec1ca0802f7a41f339b63f59cd44e147b3eee /sys
parent6c736e55e449a0fa1a9047c02939778d0d4687a4 (diff)
downloadFreeBSD-src-810e95d9a74415521fcdc42fec34f678a610e04a.zip
FreeBSD-src-810e95d9a74415521fcdc42fec34f678a610e04a.tar.gz
- 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().
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/isa_pci.c19
-rw-r--r--sys/isa/isa_common.c17
-rw-r--r--sys/isa/isavar.h5
3 files changed, 29 insertions, 12 deletions
diff --git a/sys/dev/pci/isa_pci.c b/sys/dev/pci/isa_pci.c
index 5690df1..3f1b779 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 3e36a52..4f84093 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 d0306e0..5a7621e 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>
OpenPOWER on IntegriCloud