summaryrefslogtreecommitdiffstats
path: root/sys/i386/isa/intr_machdep.c
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/i386/isa/intr_machdep.c
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/i386/isa/intr_machdep.c')
-rw-r--r--sys/i386/isa/intr_machdep.c66
1 files changed, 66 insertions, 0 deletions
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.
*/
OpenPOWER on IntegriCloud