summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormsmith <msmith@FreeBSD.org>2000-06-23 07:44:33 +0000
committermsmith <msmith@FreeBSD.org>2000-06-23 07:44:33 +0000
commitdd93fd16a6696fe0c9c1b69539b2ac899c04978e (patch)
treeced3f143f58f67f9f3e1a80e95d8b0ab2df4a6ae /sys
parent9d946aa74ddb86df33489ee80770826d8dc37705 (diff)
downloadFreeBSD-src-dd93fd16a6696fe0c9c1b69539b2ac899c04978e.zip
FreeBSD-src-dd93fd16a6696fe0c9c1b69539b2ac899c04978e.tar.gz
Add PnP probe methods to some common AT hardware drivers. In each case,
the PnP probe is merely a stub as we make assumptions about some of this hardware before we have probed it. Since these devices (with the exception of the speaker) are 'standard', suppress output in the !bootverbose case to clean up the probe messages somewhat.
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/amd64/tsc.c48
-rw-r--r--sys/amd64/isa/clock.c48
-rw-r--r--sys/amd64/isa/intr_machdep.c66
-rw-r--r--sys/amd64/isa/isa_dma.c50
-rw-r--r--sys/amd64/isa/nmi.c66
-rw-r--r--sys/amd64/pci/pci_bus.c54
-rw-r--r--sys/amd64/pci/pci_cfgreg.c54
-rw-r--r--sys/dev/speaker/spkr.c44
-rw-r--r--sys/i386/i386/tsc.c48
-rw-r--r--sys/i386/isa/clock.c48
-rw-r--r--sys/i386/isa/intr_machdep.c66
-rw-r--r--sys/i386/isa/isa_dma.c50
-rw-r--r--sys/i386/isa/nmi.c66
-rw-r--r--sys/i386/isa/pcibus.c54
-rw-r--r--sys/i386/isa/spkr.c44
-rw-r--r--sys/i386/pci/pci_bus.c54
-rw-r--r--sys/i386/pci/pci_cfgreg.c54
-rw-r--r--sys/i386/pci/pci_pir.c54
-rw-r--r--sys/isa/atrtc.c48
19 files changed, 1014 insertions, 2 deletions
diff --git a/sys/amd64/amd64/tsc.c b/sys/amd64/amd64/tsc.c
index 465ea98..b75f775 100644
--- a/sys/amd64/amd64/tsc.c
+++ b/sys/amd64/amd64/tsc.c
@@ -53,6 +53,7 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/bus.h>
#include <sys/time.h>
#include <sys/timetc.h>
#include <sys/kernel.h>
@@ -82,6 +83,7 @@
#include <i386/isa/icu.h>
#include <i386/isa/isa.h>
#include <isa/rtc.h>
+#include <isa/isavar.h>
#include <i386/isa/timerreg.h>
#include <i386/isa/intr_machdep.h>
@@ -1229,3 +1231,49 @@ tsc_get_timecount(struct timecounter *tc)
{
return (rdtsc());
}
+
+/*
+ * Attach to the ISA PnP descriptors for the timer and realtime clock.
+ */
+static struct isa_pnp_id attimer_ids[] = {
+ { 0x0001d041 /* PNP0100 */, "AT timer" },
+ { 0x000bd041 /* PNP0B00 */, "AT realtime clock" },
+ { 0 }
+};
+
+static int
+attimer_probe(device_t dev)
+{
+ int result;
+
+ if ((result = ISA_PNP_PROBE(device_get_parent(dev), dev, attimer_ids)) <= 0)
+ device_quiet(dev);
+ return(result);
+}
+
+static int
+attimer_attach(device_t dev)
+{
+ return(0);
+}
+
+static device_method_t attimer_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, attimer_probe),
+ DEVMETHOD(device_attach, attimer_attach),
+ DEVMETHOD(device_detach, bus_generic_detach),
+ DEVMETHOD(device_shutdown, bus_generic_shutdown),
+ DEVMETHOD(device_suspend, bus_generic_suspend), /* XXX stop statclock? */
+ DEVMETHOD(device_resume, bus_generic_resume), /* XXX restart statclock? */
+ { 0, 0 }
+};
+
+static driver_t attimer_driver = {
+ "attimer",
+ attimer_methods,
+ 1, /* no softc */
+};
+
+static devclass_t attimer_devclass;
+
+DRIVER_MODULE(attimer, isa, attimer_driver, attimer_devclass, 0, 0);
diff --git a/sys/amd64/isa/clock.c b/sys/amd64/isa/clock.c
index 465ea98..b75f775 100644
--- a/sys/amd64/isa/clock.c
+++ b/sys/amd64/isa/clock.c
@@ -53,6 +53,7 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/bus.h>
#include <sys/time.h>
#include <sys/timetc.h>
#include <sys/kernel.h>
@@ -82,6 +83,7 @@
#include <i386/isa/icu.h>
#include <i386/isa/isa.h>
#include <isa/rtc.h>
+#include <isa/isavar.h>
#include <i386/isa/timerreg.h>
#include <i386/isa/intr_machdep.h>
@@ -1229,3 +1231,49 @@ tsc_get_timecount(struct timecounter *tc)
{
return (rdtsc());
}
+
+/*
+ * Attach to the ISA PnP descriptors for the timer and realtime clock.
+ */
+static struct isa_pnp_id attimer_ids[] = {
+ { 0x0001d041 /* PNP0100 */, "AT timer" },
+ { 0x000bd041 /* PNP0B00 */, "AT realtime clock" },
+ { 0 }
+};
+
+static int
+attimer_probe(device_t dev)
+{
+ int result;
+
+ if ((result = ISA_PNP_PROBE(device_get_parent(dev), dev, attimer_ids)) <= 0)
+ device_quiet(dev);
+ return(result);
+}
+
+static int
+attimer_attach(device_t dev)
+{
+ return(0);
+}
+
+static device_method_t attimer_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, attimer_probe),
+ DEVMETHOD(device_attach, attimer_attach),
+ DEVMETHOD(device_detach, bus_generic_detach),
+ DEVMETHOD(device_shutdown, bus_generic_shutdown),
+ DEVMETHOD(device_suspend, bus_generic_suspend), /* XXX stop statclock? */
+ DEVMETHOD(device_resume, bus_generic_resume), /* XXX restart statclock? */
+ { 0, 0 }
+};
+
+static driver_t attimer_driver = {
+ "attimer",
+ attimer_methods,
+ 1, /* no softc */
+};
+
+static devclass_t attimer_devclass;
+
+DRIVER_MODULE(attimer, isa, attimer_driver, attimer_devclass, 0, 0);
diff --git a/sys/amd64/isa/intr_machdep.c b/sys/amd64/isa/intr_machdep.c
index 9c3ce45..16c6160 100644
--- a/sys/amd64/isa/intr_machdep.c
+++ b/sys/amd64/isa/intr_machdep.c
@@ -53,7 +53,9 @@
#endif
#include <sys/systm.h>
#include <sys/syslog.h>
+#include <sys/kernel.h>
#include <sys/malloc.h>
+#include <sys/module.h>
#include <sys/errno.h>
#include <sys/interrupt.h>
#include <machine/ipl.h>
@@ -155,6 +157,70 @@ static inthand2_t isa_strayintr;
#endif
/*
+ * Bus attachment for the ISA PIC.
+ */
+static struct isa_pnp_id atpic_ids[] = {
+ { 0x0000d041 /* PNP0000 */, "AT interrupt controller" },
+ { 0 }
+};
+
+static int
+atpic_probe(device_t dev)
+{
+ int result;
+
+ if ((result = ISA_PNP_PROBE(device_get_parent(dev), dev, atpic_ids)) <= 0)
+ device_quiet(dev);
+ return(result);
+}
+
+/*
+ * In the APIC_IO case we might be granted IRQ 2, as this is typically
+ * consumed by chaining between the two PIC components. If we're using
+ * the APIC, however, this may not be the case, and as such we should
+ * free the resource. (XXX untested)
+ *
+ * The generic ISA attachment code will handle allocating any other resources
+ * that we don't explicitly claim here.
+ */
+static int
+atpic_attach(device_t dev)
+{
+#ifdef APIC_IO
+ int rid;
+ bus_resource_t res;
+
+ /* try to allocate our IRQ and then free it */
+ rid = 0;
+ res = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1, 0);
+ if (res != NULL)
+ bus_release_resource(dev, SYS_RES_IRQ, rid, res);
+#endif
+ return(0);
+}
+
+static device_method_t atpic_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, atpic_probe),
+ DEVMETHOD(device_attach, atpic_attach),
+ DEVMETHOD(device_detach, bus_generic_detach),
+ DEVMETHOD(device_shutdown, bus_generic_shutdown),
+ DEVMETHOD(device_suspend, bus_generic_suspend),
+ DEVMETHOD(device_resume, bus_generic_resume),
+ { 0, 0 }
+};
+
+static driver_t atpic_driver = {
+ "atpic",
+ atpic_methods,
+ 1, /* no softc */
+};
+
+static devclass_t atpic_devclass;
+
+DRIVER_MODULE(atpic, isa, atpic_driver, atpic_devclass, 0, 0);
+
+/*
* Handle a NMI, possibly a machine check.
* return true to panic system, false to ignore.
*/
diff --git a/sys/amd64/isa/isa_dma.c b/sys/amd64/isa/isa_dma.c
index 1cc1ea8..dab5e6a 100644
--- a/sys/amd64/isa/isa_dma.c
+++ b/sys/amd64/isa/isa_dma.c
@@ -49,13 +49,16 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/kernel.h>
#include <sys/malloc.h>
+#include <sys/module.h>
#include <vm/vm.h>
#include <vm/vm_param.h>
#include <vm/pmap.h>
#include <i386/isa/isa.h>
-#include <i386/isa/isa_dma.h>
#include <i386/isa/ic/i8237.h>
+#include <isa/isavar.h>
/*
** Register definitions for DMA controller 1 (channels 0..3):
@@ -494,3 +497,48 @@ isa_dmastop(int chan)
}
return(isa_dmastatus(chan));
}
+
+/*
+ * Attach to the ISA PnP descriptor for the AT DMA controller
+ */
+static struct isa_pnp_id atdma_ids[] = {
+ { 0x0002d041 /* PNP0200 */, "AT DMA controller" },
+ { 0 }
+};
+
+static int
+atdma_probe(device_t dev)
+{
+ int result;
+
+ if ((result = ISA_PNP_PROBE(device_get_parent(dev), dev, atdma_ids)) <= 0)
+ device_quiet(dev);
+ return(result);
+}
+
+static int
+atdma_attach(device_t dev)
+{
+ return(0);
+}
+
+static device_method_t atdma_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, atdma_probe),
+ DEVMETHOD(device_attach, atdma_attach),
+ DEVMETHOD(device_detach, bus_generic_detach),
+ DEVMETHOD(device_shutdown, bus_generic_shutdown),
+ DEVMETHOD(device_suspend, bus_generic_suspend),
+ DEVMETHOD(device_resume, bus_generic_resume),
+ { 0, 0 }
+};
+
+static driver_t atdma_driver = {
+ "atdma",
+ atdma_methods,
+ 1, /* no softc */
+};
+
+static devclass_t atdma_devclass;
+
+DRIVER_MODULE(atdma, isa, atdma_driver, atdma_devclass, 0, 0);
diff --git a/sys/amd64/isa/nmi.c b/sys/amd64/isa/nmi.c
index 9c3ce45..16c6160 100644
--- a/sys/amd64/isa/nmi.c
+++ b/sys/amd64/isa/nmi.c
@@ -53,7 +53,9 @@
#endif
#include <sys/systm.h>
#include <sys/syslog.h>
+#include <sys/kernel.h>
#include <sys/malloc.h>
+#include <sys/module.h>
#include <sys/errno.h>
#include <sys/interrupt.h>
#include <machine/ipl.h>
@@ -155,6 +157,70 @@ static inthand2_t isa_strayintr;
#endif
/*
+ * Bus attachment for the ISA PIC.
+ */
+static struct isa_pnp_id atpic_ids[] = {
+ { 0x0000d041 /* PNP0000 */, "AT interrupt controller" },
+ { 0 }
+};
+
+static int
+atpic_probe(device_t dev)
+{
+ int result;
+
+ if ((result = ISA_PNP_PROBE(device_get_parent(dev), dev, atpic_ids)) <= 0)
+ device_quiet(dev);
+ return(result);
+}
+
+/*
+ * In the APIC_IO case we might be granted IRQ 2, as this is typically
+ * consumed by chaining between the two PIC components. If we're using
+ * the APIC, however, this may not be the case, and as such we should
+ * free the resource. (XXX untested)
+ *
+ * The generic ISA attachment code will handle allocating any other resources
+ * that we don't explicitly claim here.
+ */
+static int
+atpic_attach(device_t dev)
+{
+#ifdef APIC_IO
+ int rid;
+ bus_resource_t res;
+
+ /* try to allocate our IRQ and then free it */
+ rid = 0;
+ res = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1, 0);
+ if (res != NULL)
+ bus_release_resource(dev, SYS_RES_IRQ, rid, res);
+#endif
+ return(0);
+}
+
+static device_method_t atpic_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, atpic_probe),
+ DEVMETHOD(device_attach, atpic_attach),
+ DEVMETHOD(device_detach, bus_generic_detach),
+ DEVMETHOD(device_shutdown, bus_generic_shutdown),
+ DEVMETHOD(device_suspend, bus_generic_suspend),
+ DEVMETHOD(device_resume, bus_generic_resume),
+ { 0, 0 }
+};
+
+static driver_t atpic_driver = {
+ "atpic",
+ atpic_methods,
+ 1, /* no softc */
+};
+
+static devclass_t atpic_devclass;
+
+DRIVER_MODULE(atpic, isa, atpic_driver, atpic_devclass, 0, 0);
+
+/*
* Handle a NMI, possibly a machine check.
* return true to panic system, false to ignore.
*/
diff --git a/sys/amd64/pci/pci_bus.c b/sys/amd64/pci/pci_bus.c
index ea62688..990b418 100644
--- a/sys/amd64/pci/pci_bus.c
+++ b/sys/amd64/pci/pci_bus.c
@@ -31,10 +31,12 @@
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/kernel.h>
+#include <sys/module.h>
#include <pci/pcivar.h>
#include <pci/pcireg.h>
#include <i386/isa/pcibus.h>
+#include <isa/isavar.h>
#include <machine/segments.h>
#include <machine/pc/bios.h>
@@ -655,3 +657,55 @@ static driver_t nexus_pcib_driver = {
};
DRIVER_MODULE(pcib, nexus, nexus_pcib_driver, pcib_devclass, 0, 0);
+
+/*
+ * Install placeholder to claim the resources owned by the
+ * PCI bus interface. This could be used to extract the
+ * config space registers in the extreme case where the PnP
+ * ID is available and the PCI BIOS isn't, but for now we just
+ * eat the PnP ID and do nothing else.
+ *
+ * XXX we should silence this probe, as it will generally confuse
+ * people.
+ */
+static struct isa_pnp_id pcibus_pnp_ids[] = {
+ { 0x030ad041 /* PNP030A */, "PCI Bus" },
+ { 0 }
+};
+
+static int
+pcibus_pnp_probe(device_t dev)
+{
+ int result;
+
+ if ((result = ISA_PNP_PROBE(device_get_parent(dev), dev, pcibus_pnp_ids)) <= 0)
+ device_quiet(dev);
+ return(result);
+}
+
+static int
+pcibus_pnp_attach(device_t dev)
+{
+ return(0);
+}
+
+static device_method_t pcibus_pnp_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, pcibus_pnp_probe),
+ DEVMETHOD(device_attach, pcibus_pnp_attach),
+ DEVMETHOD(device_detach, bus_generic_detach),
+ DEVMETHOD(device_shutdown, bus_generic_shutdown),
+ DEVMETHOD(device_suspend, bus_generic_suspend),
+ DEVMETHOD(device_resume, bus_generic_resume),
+ { 0, 0 }
+};
+
+static driver_t pcibus_pnp_driver = {
+ "pcibus_pnp",
+ pcibus_pnp_methods,
+ 1, /* no softc */
+};
+
+static devclass_t pcibus_pnp_devclass;
+
+DRIVER_MODULE(pcibus_pnp, isa, pcibus_pnp_driver, pcibus_pnp_devclass, 0, 0);
diff --git a/sys/amd64/pci/pci_cfgreg.c b/sys/amd64/pci/pci_cfgreg.c
index ea62688..990b418 100644
--- a/sys/amd64/pci/pci_cfgreg.c
+++ b/sys/amd64/pci/pci_cfgreg.c
@@ -31,10 +31,12 @@
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/kernel.h>
+#include <sys/module.h>
#include <pci/pcivar.h>
#include <pci/pcireg.h>
#include <i386/isa/pcibus.h>
+#include <isa/isavar.h>
#include <machine/segments.h>
#include <machine/pc/bios.h>
@@ -655,3 +657,55 @@ static driver_t nexus_pcib_driver = {
};
DRIVER_MODULE(pcib, nexus, nexus_pcib_driver, pcib_devclass, 0, 0);
+
+/*
+ * Install placeholder to claim the resources owned by the
+ * PCI bus interface. This could be used to extract the
+ * config space registers in the extreme case where the PnP
+ * ID is available and the PCI BIOS isn't, but for now we just
+ * eat the PnP ID and do nothing else.
+ *
+ * XXX we should silence this probe, as it will generally confuse
+ * people.
+ */
+static struct isa_pnp_id pcibus_pnp_ids[] = {
+ { 0x030ad041 /* PNP030A */, "PCI Bus" },
+ { 0 }
+};
+
+static int
+pcibus_pnp_probe(device_t dev)
+{
+ int result;
+
+ if ((result = ISA_PNP_PROBE(device_get_parent(dev), dev, pcibus_pnp_ids)) <= 0)
+ device_quiet(dev);
+ return(result);
+}
+
+static int
+pcibus_pnp_attach(device_t dev)
+{
+ return(0);
+}
+
+static device_method_t pcibus_pnp_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, pcibus_pnp_probe),
+ DEVMETHOD(device_attach, pcibus_pnp_attach),
+ DEVMETHOD(device_detach, bus_generic_detach),
+ DEVMETHOD(device_shutdown, bus_generic_shutdown),
+ DEVMETHOD(device_suspend, bus_generic_suspend),
+ DEVMETHOD(device_resume, bus_generic_resume),
+ { 0, 0 }
+};
+
+static driver_t pcibus_pnp_driver = {
+ "pcibus_pnp",
+ pcibus_pnp_methods,
+ 1, /* no softc */
+};
+
+static devclass_t pcibus_pnp_devclass;
+
+DRIVER_MODULE(pcibus_pnp, isa, pcibus_pnp_driver, pcibus_pnp_devclass, 0, 0);
diff --git a/sys/dev/speaker/spkr.c b/sys/dev/speaker/spkr.c
index 0f7ed61..e6f0e95 100644
--- a/sys/dev/speaker/spkr.c
+++ b/sys/dev/speaker/spkr.c
@@ -9,11 +9,14 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/bus.h>
#include <sys/kernel.h>
+#include <sys/module.h>
#include <sys/uio.h>
#include <sys/conf.h>
#include <sys/ctype.h>
#include <sys/malloc.h>
+#include <isa/isavar.h>
#include <i386/isa/isa.h>
#include <i386/isa/timerreg.h>
#include <machine/clock.h>
@@ -594,5 +597,46 @@ spkr_drvinit(void *unused)
SYSINIT(spkrdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,spkr_drvinit,NULL)
+/*
+ * Install placeholder to claim the resources owned by the
+ * AT tone generator.
+ */
+static struct isa_pnp_id atspeaker_ids[] = {
+ { 0x0008d041 /* PNP0800 */, "AT speaker" },
+ { 0 }
+};
+
+static int
+atspeaker_probe(device_t dev)
+{
+ return(ISA_PNP_PROBE(device_get_parent(dev), dev, atspeaker_ids));
+}
+
+static int
+atspeaker_attach(device_t dev)
+{
+ return(0);
+}
+
+static device_method_t atspeaker_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, atspeaker_probe),
+ DEVMETHOD(device_attach, atspeaker_attach),
+ DEVMETHOD(device_detach, bus_generic_detach),
+ DEVMETHOD(device_shutdown, bus_generic_shutdown),
+ DEVMETHOD(device_suspend, bus_generic_suspend),
+ DEVMETHOD(device_resume, bus_generic_resume),
+ { 0, 0 }
+};
+
+static driver_t atspeaker_driver = {
+ "atspeaker",
+ atspeaker_methods,
+ 1, /* no softc */
+};
+
+static devclass_t atspeaker_devclass;
+
+DRIVER_MODULE(atspeaker, isa, atspeaker_driver, atspeaker_devclass, 0, 0);
/* spkr.c ends here */
diff --git a/sys/i386/i386/tsc.c b/sys/i386/i386/tsc.c
index 465ea98..b75f775 100644
--- a/sys/i386/i386/tsc.c
+++ b/sys/i386/i386/tsc.c
@@ -53,6 +53,7 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/bus.h>
#include <sys/time.h>
#include <sys/timetc.h>
#include <sys/kernel.h>
@@ -82,6 +83,7 @@
#include <i386/isa/icu.h>
#include <i386/isa/isa.h>
#include <isa/rtc.h>
+#include <isa/isavar.h>
#include <i386/isa/timerreg.h>
#include <i386/isa/intr_machdep.h>
@@ -1229,3 +1231,49 @@ tsc_get_timecount(struct timecounter *tc)
{
return (rdtsc());
}
+
+/*
+ * Attach to the ISA PnP descriptors for the timer and realtime clock.
+ */
+static struct isa_pnp_id attimer_ids[] = {
+ { 0x0001d041 /* PNP0100 */, "AT timer" },
+ { 0x000bd041 /* PNP0B00 */, "AT realtime clock" },
+ { 0 }
+};
+
+static int
+attimer_probe(device_t dev)
+{
+ int result;
+
+ if ((result = ISA_PNP_PROBE(device_get_parent(dev), dev, attimer_ids)) <= 0)
+ device_quiet(dev);
+ return(result);
+}
+
+static int
+attimer_attach(device_t dev)
+{
+ return(0);
+}
+
+static device_method_t attimer_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, attimer_probe),
+ DEVMETHOD(device_attach, attimer_attach),
+ DEVMETHOD(device_detach, bus_generic_detach),
+ DEVMETHOD(device_shutdown, bus_generic_shutdown),
+ DEVMETHOD(device_suspend, bus_generic_suspend), /* XXX stop statclock? */
+ DEVMETHOD(device_resume, bus_generic_resume), /* XXX restart statclock? */
+ { 0, 0 }
+};
+
+static driver_t attimer_driver = {
+ "attimer",
+ attimer_methods,
+ 1, /* no softc */
+};
+
+static devclass_t attimer_devclass;
+
+DRIVER_MODULE(attimer, isa, attimer_driver, attimer_devclass, 0, 0);
diff --git a/sys/i386/isa/clock.c b/sys/i386/isa/clock.c
index 465ea98..b75f775 100644
--- a/sys/i386/isa/clock.c
+++ b/sys/i386/isa/clock.c
@@ -53,6 +53,7 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/bus.h>
#include <sys/time.h>
#include <sys/timetc.h>
#include <sys/kernel.h>
@@ -82,6 +83,7 @@
#include <i386/isa/icu.h>
#include <i386/isa/isa.h>
#include <isa/rtc.h>
+#include <isa/isavar.h>
#include <i386/isa/timerreg.h>
#include <i386/isa/intr_machdep.h>
@@ -1229,3 +1231,49 @@ tsc_get_timecount(struct timecounter *tc)
{
return (rdtsc());
}
+
+/*
+ * Attach to the ISA PnP descriptors for the timer and realtime clock.
+ */
+static struct isa_pnp_id attimer_ids[] = {
+ { 0x0001d041 /* PNP0100 */, "AT timer" },
+ { 0x000bd041 /* PNP0B00 */, "AT realtime clock" },
+ { 0 }
+};
+
+static int
+attimer_probe(device_t dev)
+{
+ int result;
+
+ if ((result = ISA_PNP_PROBE(device_get_parent(dev), dev, attimer_ids)) <= 0)
+ device_quiet(dev);
+ return(result);
+}
+
+static int
+attimer_attach(device_t dev)
+{
+ return(0);
+}
+
+static device_method_t attimer_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, attimer_probe),
+ DEVMETHOD(device_attach, attimer_attach),
+ DEVMETHOD(device_detach, bus_generic_detach),
+ DEVMETHOD(device_shutdown, bus_generic_shutdown),
+ DEVMETHOD(device_suspend, bus_generic_suspend), /* XXX stop statclock? */
+ DEVMETHOD(device_resume, bus_generic_resume), /* XXX restart statclock? */
+ { 0, 0 }
+};
+
+static driver_t attimer_driver = {
+ "attimer",
+ attimer_methods,
+ 1, /* no softc */
+};
+
+static devclass_t attimer_devclass;
+
+DRIVER_MODULE(attimer, isa, attimer_driver, attimer_devclass, 0, 0);
diff --git a/sys/i386/isa/intr_machdep.c b/sys/i386/isa/intr_machdep.c
index 9c3ce45..16c6160 100644
--- a/sys/i386/isa/intr_machdep.c
+++ b/sys/i386/isa/intr_machdep.c
@@ -53,7 +53,9 @@
#endif
#include <sys/systm.h>
#include <sys/syslog.h>
+#include <sys/kernel.h>
#include <sys/malloc.h>
+#include <sys/module.h>
#include <sys/errno.h>
#include <sys/interrupt.h>
#include <machine/ipl.h>
@@ -155,6 +157,70 @@ static inthand2_t isa_strayintr;
#endif
/*
+ * Bus attachment for the ISA PIC.
+ */
+static struct isa_pnp_id atpic_ids[] = {
+ { 0x0000d041 /* PNP0000 */, "AT interrupt controller" },
+ { 0 }
+};
+
+static int
+atpic_probe(device_t dev)
+{
+ int result;
+
+ if ((result = ISA_PNP_PROBE(device_get_parent(dev), dev, atpic_ids)) <= 0)
+ device_quiet(dev);
+ return(result);
+}
+
+/*
+ * In the APIC_IO case we might be granted IRQ 2, as this is typically
+ * consumed by chaining between the two PIC components. If we're using
+ * the APIC, however, this may not be the case, and as such we should
+ * free the resource. (XXX untested)
+ *
+ * The generic ISA attachment code will handle allocating any other resources
+ * that we don't explicitly claim here.
+ */
+static int
+atpic_attach(device_t dev)
+{
+#ifdef APIC_IO
+ int rid;
+ bus_resource_t res;
+
+ /* try to allocate our IRQ and then free it */
+ rid = 0;
+ res = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1, 0);
+ if (res != NULL)
+ bus_release_resource(dev, SYS_RES_IRQ, rid, res);
+#endif
+ return(0);
+}
+
+static device_method_t atpic_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, atpic_probe),
+ DEVMETHOD(device_attach, atpic_attach),
+ DEVMETHOD(device_detach, bus_generic_detach),
+ DEVMETHOD(device_shutdown, bus_generic_shutdown),
+ DEVMETHOD(device_suspend, bus_generic_suspend),
+ DEVMETHOD(device_resume, bus_generic_resume),
+ { 0, 0 }
+};
+
+static driver_t atpic_driver = {
+ "atpic",
+ atpic_methods,
+ 1, /* no softc */
+};
+
+static devclass_t atpic_devclass;
+
+DRIVER_MODULE(atpic, isa, atpic_driver, atpic_devclass, 0, 0);
+
+/*
* Handle a NMI, possibly a machine check.
* return true to panic system, false to ignore.
*/
diff --git a/sys/i386/isa/isa_dma.c b/sys/i386/isa/isa_dma.c
index 1cc1ea8..dab5e6a 100644
--- a/sys/i386/isa/isa_dma.c
+++ b/sys/i386/isa/isa_dma.c
@@ -49,13 +49,16 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/kernel.h>
#include <sys/malloc.h>
+#include <sys/module.h>
#include <vm/vm.h>
#include <vm/vm_param.h>
#include <vm/pmap.h>
#include <i386/isa/isa.h>
-#include <i386/isa/isa_dma.h>
#include <i386/isa/ic/i8237.h>
+#include <isa/isavar.h>
/*
** Register definitions for DMA controller 1 (channels 0..3):
@@ -494,3 +497,48 @@ isa_dmastop(int chan)
}
return(isa_dmastatus(chan));
}
+
+/*
+ * Attach to the ISA PnP descriptor for the AT DMA controller
+ */
+static struct isa_pnp_id atdma_ids[] = {
+ { 0x0002d041 /* PNP0200 */, "AT DMA controller" },
+ { 0 }
+};
+
+static int
+atdma_probe(device_t dev)
+{
+ int result;
+
+ if ((result = ISA_PNP_PROBE(device_get_parent(dev), dev, atdma_ids)) <= 0)
+ device_quiet(dev);
+ return(result);
+}
+
+static int
+atdma_attach(device_t dev)
+{
+ return(0);
+}
+
+static device_method_t atdma_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, atdma_probe),
+ DEVMETHOD(device_attach, atdma_attach),
+ DEVMETHOD(device_detach, bus_generic_detach),
+ DEVMETHOD(device_shutdown, bus_generic_shutdown),
+ DEVMETHOD(device_suspend, bus_generic_suspend),
+ DEVMETHOD(device_resume, bus_generic_resume),
+ { 0, 0 }
+};
+
+static driver_t atdma_driver = {
+ "atdma",
+ atdma_methods,
+ 1, /* no softc */
+};
+
+static devclass_t atdma_devclass;
+
+DRIVER_MODULE(atdma, isa, atdma_driver, atdma_devclass, 0, 0);
diff --git a/sys/i386/isa/nmi.c b/sys/i386/isa/nmi.c
index 9c3ce45..16c6160 100644
--- a/sys/i386/isa/nmi.c
+++ b/sys/i386/isa/nmi.c
@@ -53,7 +53,9 @@
#endif
#include <sys/systm.h>
#include <sys/syslog.h>
+#include <sys/kernel.h>
#include <sys/malloc.h>
+#include <sys/module.h>
#include <sys/errno.h>
#include <sys/interrupt.h>
#include <machine/ipl.h>
@@ -155,6 +157,70 @@ static inthand2_t isa_strayintr;
#endif
/*
+ * Bus attachment for the ISA PIC.
+ */
+static struct isa_pnp_id atpic_ids[] = {
+ { 0x0000d041 /* PNP0000 */, "AT interrupt controller" },
+ { 0 }
+};
+
+static int
+atpic_probe(device_t dev)
+{
+ int result;
+
+ if ((result = ISA_PNP_PROBE(device_get_parent(dev), dev, atpic_ids)) <= 0)
+ device_quiet(dev);
+ return(result);
+}
+
+/*
+ * In the APIC_IO case we might be granted IRQ 2, as this is typically
+ * consumed by chaining between the two PIC components. If we're using
+ * the APIC, however, this may not be the case, and as such we should
+ * free the resource. (XXX untested)
+ *
+ * The generic ISA attachment code will handle allocating any other resources
+ * that we don't explicitly claim here.
+ */
+static int
+atpic_attach(device_t dev)
+{
+#ifdef APIC_IO
+ int rid;
+ bus_resource_t res;
+
+ /* try to allocate our IRQ and then free it */
+ rid = 0;
+ res = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1, 0);
+ if (res != NULL)
+ bus_release_resource(dev, SYS_RES_IRQ, rid, res);
+#endif
+ return(0);
+}
+
+static device_method_t atpic_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, atpic_probe),
+ DEVMETHOD(device_attach, atpic_attach),
+ DEVMETHOD(device_detach, bus_generic_detach),
+ DEVMETHOD(device_shutdown, bus_generic_shutdown),
+ DEVMETHOD(device_suspend, bus_generic_suspend),
+ DEVMETHOD(device_resume, bus_generic_resume),
+ { 0, 0 }
+};
+
+static driver_t atpic_driver = {
+ "atpic",
+ atpic_methods,
+ 1, /* no softc */
+};
+
+static devclass_t atpic_devclass;
+
+DRIVER_MODULE(atpic, isa, atpic_driver, atpic_devclass, 0, 0);
+
+/*
* Handle a NMI, possibly a machine check.
* return true to panic system, false to ignore.
*/
diff --git a/sys/i386/isa/pcibus.c b/sys/i386/isa/pcibus.c
index ea62688..990b418 100644
--- a/sys/i386/isa/pcibus.c
+++ b/sys/i386/isa/pcibus.c
@@ -31,10 +31,12 @@
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/kernel.h>
+#include <sys/module.h>
#include <pci/pcivar.h>
#include <pci/pcireg.h>
#include <i386/isa/pcibus.h>
+#include <isa/isavar.h>
#include <machine/segments.h>
#include <machine/pc/bios.h>
@@ -655,3 +657,55 @@ static driver_t nexus_pcib_driver = {
};
DRIVER_MODULE(pcib, nexus, nexus_pcib_driver, pcib_devclass, 0, 0);
+
+/*
+ * Install placeholder to claim the resources owned by the
+ * PCI bus interface. This could be used to extract the
+ * config space registers in the extreme case where the PnP
+ * ID is available and the PCI BIOS isn't, but for now we just
+ * eat the PnP ID and do nothing else.
+ *
+ * XXX we should silence this probe, as it will generally confuse
+ * people.
+ */
+static struct isa_pnp_id pcibus_pnp_ids[] = {
+ { 0x030ad041 /* PNP030A */, "PCI Bus" },
+ { 0 }
+};
+
+static int
+pcibus_pnp_probe(device_t dev)
+{
+ int result;
+
+ if ((result = ISA_PNP_PROBE(device_get_parent(dev), dev, pcibus_pnp_ids)) <= 0)
+ device_quiet(dev);
+ return(result);
+}
+
+static int
+pcibus_pnp_attach(device_t dev)
+{
+ return(0);
+}
+
+static device_method_t pcibus_pnp_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, pcibus_pnp_probe),
+ DEVMETHOD(device_attach, pcibus_pnp_attach),
+ DEVMETHOD(device_detach, bus_generic_detach),
+ DEVMETHOD(device_shutdown, bus_generic_shutdown),
+ DEVMETHOD(device_suspend, bus_generic_suspend),
+ DEVMETHOD(device_resume, bus_generic_resume),
+ { 0, 0 }
+};
+
+static driver_t pcibus_pnp_driver = {
+ "pcibus_pnp",
+ pcibus_pnp_methods,
+ 1, /* no softc */
+};
+
+static devclass_t pcibus_pnp_devclass;
+
+DRIVER_MODULE(pcibus_pnp, isa, pcibus_pnp_driver, pcibus_pnp_devclass, 0, 0);
diff --git a/sys/i386/isa/spkr.c b/sys/i386/isa/spkr.c
index 0f7ed61..e6f0e95 100644
--- a/sys/i386/isa/spkr.c
+++ b/sys/i386/isa/spkr.c
@@ -9,11 +9,14 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/bus.h>
#include <sys/kernel.h>
+#include <sys/module.h>
#include <sys/uio.h>
#include <sys/conf.h>
#include <sys/ctype.h>
#include <sys/malloc.h>
+#include <isa/isavar.h>
#include <i386/isa/isa.h>
#include <i386/isa/timerreg.h>
#include <machine/clock.h>
@@ -594,5 +597,46 @@ spkr_drvinit(void *unused)
SYSINIT(spkrdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,spkr_drvinit,NULL)
+/*
+ * Install placeholder to claim the resources owned by the
+ * AT tone generator.
+ */
+static struct isa_pnp_id atspeaker_ids[] = {
+ { 0x0008d041 /* PNP0800 */, "AT speaker" },
+ { 0 }
+};
+
+static int
+atspeaker_probe(device_t dev)
+{
+ return(ISA_PNP_PROBE(device_get_parent(dev), dev, atspeaker_ids));
+}
+
+static int
+atspeaker_attach(device_t dev)
+{
+ return(0);
+}
+
+static device_method_t atspeaker_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, atspeaker_probe),
+ DEVMETHOD(device_attach, atspeaker_attach),
+ DEVMETHOD(device_detach, bus_generic_detach),
+ DEVMETHOD(device_shutdown, bus_generic_shutdown),
+ DEVMETHOD(device_suspend, bus_generic_suspend),
+ DEVMETHOD(device_resume, bus_generic_resume),
+ { 0, 0 }
+};
+
+static driver_t atspeaker_driver = {
+ "atspeaker",
+ atspeaker_methods,
+ 1, /* no softc */
+};
+
+static devclass_t atspeaker_devclass;
+
+DRIVER_MODULE(atspeaker, isa, atspeaker_driver, atspeaker_devclass, 0, 0);
/* spkr.c ends here */
diff --git a/sys/i386/pci/pci_bus.c b/sys/i386/pci/pci_bus.c
index ea62688..990b418 100644
--- a/sys/i386/pci/pci_bus.c
+++ b/sys/i386/pci/pci_bus.c
@@ -31,10 +31,12 @@
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/kernel.h>
+#include <sys/module.h>
#include <pci/pcivar.h>
#include <pci/pcireg.h>
#include <i386/isa/pcibus.h>
+#include <isa/isavar.h>
#include <machine/segments.h>
#include <machine/pc/bios.h>
@@ -655,3 +657,55 @@ static driver_t nexus_pcib_driver = {
};
DRIVER_MODULE(pcib, nexus, nexus_pcib_driver, pcib_devclass, 0, 0);
+
+/*
+ * Install placeholder to claim the resources owned by the
+ * PCI bus interface. This could be used to extract the
+ * config space registers in the extreme case where the PnP
+ * ID is available and the PCI BIOS isn't, but for now we just
+ * eat the PnP ID and do nothing else.
+ *
+ * XXX we should silence this probe, as it will generally confuse
+ * people.
+ */
+static struct isa_pnp_id pcibus_pnp_ids[] = {
+ { 0x030ad041 /* PNP030A */, "PCI Bus" },
+ { 0 }
+};
+
+static int
+pcibus_pnp_probe(device_t dev)
+{
+ int result;
+
+ if ((result = ISA_PNP_PROBE(device_get_parent(dev), dev, pcibus_pnp_ids)) <= 0)
+ device_quiet(dev);
+ return(result);
+}
+
+static int
+pcibus_pnp_attach(device_t dev)
+{
+ return(0);
+}
+
+static device_method_t pcibus_pnp_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, pcibus_pnp_probe),
+ DEVMETHOD(device_attach, pcibus_pnp_attach),
+ DEVMETHOD(device_detach, bus_generic_detach),
+ DEVMETHOD(device_shutdown, bus_generic_shutdown),
+ DEVMETHOD(device_suspend, bus_generic_suspend),
+ DEVMETHOD(device_resume, bus_generic_resume),
+ { 0, 0 }
+};
+
+static driver_t pcibus_pnp_driver = {
+ "pcibus_pnp",
+ pcibus_pnp_methods,
+ 1, /* no softc */
+};
+
+static devclass_t pcibus_pnp_devclass;
+
+DRIVER_MODULE(pcibus_pnp, isa, pcibus_pnp_driver, pcibus_pnp_devclass, 0, 0);
diff --git a/sys/i386/pci/pci_cfgreg.c b/sys/i386/pci/pci_cfgreg.c
index ea62688..990b418 100644
--- a/sys/i386/pci/pci_cfgreg.c
+++ b/sys/i386/pci/pci_cfgreg.c
@@ -31,10 +31,12 @@
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/kernel.h>
+#include <sys/module.h>
#include <pci/pcivar.h>
#include <pci/pcireg.h>
#include <i386/isa/pcibus.h>
+#include <isa/isavar.h>
#include <machine/segments.h>
#include <machine/pc/bios.h>
@@ -655,3 +657,55 @@ static driver_t nexus_pcib_driver = {
};
DRIVER_MODULE(pcib, nexus, nexus_pcib_driver, pcib_devclass, 0, 0);
+
+/*
+ * Install placeholder to claim the resources owned by the
+ * PCI bus interface. This could be used to extract the
+ * config space registers in the extreme case where the PnP
+ * ID is available and the PCI BIOS isn't, but for now we just
+ * eat the PnP ID and do nothing else.
+ *
+ * XXX we should silence this probe, as it will generally confuse
+ * people.
+ */
+static struct isa_pnp_id pcibus_pnp_ids[] = {
+ { 0x030ad041 /* PNP030A */, "PCI Bus" },
+ { 0 }
+};
+
+static int
+pcibus_pnp_probe(device_t dev)
+{
+ int result;
+
+ if ((result = ISA_PNP_PROBE(device_get_parent(dev), dev, pcibus_pnp_ids)) <= 0)
+ device_quiet(dev);
+ return(result);
+}
+
+static int
+pcibus_pnp_attach(device_t dev)
+{
+ return(0);
+}
+
+static device_method_t pcibus_pnp_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, pcibus_pnp_probe),
+ DEVMETHOD(device_attach, pcibus_pnp_attach),
+ DEVMETHOD(device_detach, bus_generic_detach),
+ DEVMETHOD(device_shutdown, bus_generic_shutdown),
+ DEVMETHOD(device_suspend, bus_generic_suspend),
+ DEVMETHOD(device_resume, bus_generic_resume),
+ { 0, 0 }
+};
+
+static driver_t pcibus_pnp_driver = {
+ "pcibus_pnp",
+ pcibus_pnp_methods,
+ 1, /* no softc */
+};
+
+static devclass_t pcibus_pnp_devclass;
+
+DRIVER_MODULE(pcibus_pnp, isa, pcibus_pnp_driver, pcibus_pnp_devclass, 0, 0);
diff --git a/sys/i386/pci/pci_pir.c b/sys/i386/pci/pci_pir.c
index ea62688..990b418 100644
--- a/sys/i386/pci/pci_pir.c
+++ b/sys/i386/pci/pci_pir.c
@@ -31,10 +31,12 @@
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/kernel.h>
+#include <sys/module.h>
#include <pci/pcivar.h>
#include <pci/pcireg.h>
#include <i386/isa/pcibus.h>
+#include <isa/isavar.h>
#include <machine/segments.h>
#include <machine/pc/bios.h>
@@ -655,3 +657,55 @@ static driver_t nexus_pcib_driver = {
};
DRIVER_MODULE(pcib, nexus, nexus_pcib_driver, pcib_devclass, 0, 0);
+
+/*
+ * Install placeholder to claim the resources owned by the
+ * PCI bus interface. This could be used to extract the
+ * config space registers in the extreme case where the PnP
+ * ID is available and the PCI BIOS isn't, but for now we just
+ * eat the PnP ID and do nothing else.
+ *
+ * XXX we should silence this probe, as it will generally confuse
+ * people.
+ */
+static struct isa_pnp_id pcibus_pnp_ids[] = {
+ { 0x030ad041 /* PNP030A */, "PCI Bus" },
+ { 0 }
+};
+
+static int
+pcibus_pnp_probe(device_t dev)
+{
+ int result;
+
+ if ((result = ISA_PNP_PROBE(device_get_parent(dev), dev, pcibus_pnp_ids)) <= 0)
+ device_quiet(dev);
+ return(result);
+}
+
+static int
+pcibus_pnp_attach(device_t dev)
+{
+ return(0);
+}
+
+static device_method_t pcibus_pnp_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, pcibus_pnp_probe),
+ DEVMETHOD(device_attach, pcibus_pnp_attach),
+ DEVMETHOD(device_detach, bus_generic_detach),
+ DEVMETHOD(device_shutdown, bus_generic_shutdown),
+ DEVMETHOD(device_suspend, bus_generic_suspend),
+ DEVMETHOD(device_resume, bus_generic_resume),
+ { 0, 0 }
+};
+
+static driver_t pcibus_pnp_driver = {
+ "pcibus_pnp",
+ pcibus_pnp_methods,
+ 1, /* no softc */
+};
+
+static devclass_t pcibus_pnp_devclass;
+
+DRIVER_MODULE(pcibus_pnp, isa, pcibus_pnp_driver, pcibus_pnp_devclass, 0, 0);
diff --git a/sys/isa/atrtc.c b/sys/isa/atrtc.c
index 465ea98..b75f775 100644
--- a/sys/isa/atrtc.c
+++ b/sys/isa/atrtc.c
@@ -53,6 +53,7 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/bus.h>
#include <sys/time.h>
#include <sys/timetc.h>
#include <sys/kernel.h>
@@ -82,6 +83,7 @@
#include <i386/isa/icu.h>
#include <i386/isa/isa.h>
#include <isa/rtc.h>
+#include <isa/isavar.h>
#include <i386/isa/timerreg.h>
#include <i386/isa/intr_machdep.h>
@@ -1229,3 +1231,49 @@ tsc_get_timecount(struct timecounter *tc)
{
return (rdtsc());
}
+
+/*
+ * Attach to the ISA PnP descriptors for the timer and realtime clock.
+ */
+static struct isa_pnp_id attimer_ids[] = {
+ { 0x0001d041 /* PNP0100 */, "AT timer" },
+ { 0x000bd041 /* PNP0B00 */, "AT realtime clock" },
+ { 0 }
+};
+
+static int
+attimer_probe(device_t dev)
+{
+ int result;
+
+ if ((result = ISA_PNP_PROBE(device_get_parent(dev), dev, attimer_ids)) <= 0)
+ device_quiet(dev);
+ return(result);
+}
+
+static int
+attimer_attach(device_t dev)
+{
+ return(0);
+}
+
+static device_method_t attimer_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, attimer_probe),
+ DEVMETHOD(device_attach, attimer_attach),
+ DEVMETHOD(device_detach, bus_generic_detach),
+ DEVMETHOD(device_shutdown, bus_generic_shutdown),
+ DEVMETHOD(device_suspend, bus_generic_suspend), /* XXX stop statclock? */
+ DEVMETHOD(device_resume, bus_generic_resume), /* XXX restart statclock? */
+ { 0, 0 }
+};
+
+static driver_t attimer_driver = {
+ "attimer",
+ attimer_methods,
+ 1, /* no softc */
+};
+
+static devclass_t attimer_devclass;
+
+DRIVER_MODULE(attimer, isa, attimer_driver, attimer_devclass, 0, 0);
OpenPOWER on IntegriCloud