diff options
author | msmith <msmith@FreeBSD.org> | 2000-06-23 07:44:33 +0000 |
---|---|---|
committer | msmith <msmith@FreeBSD.org> | 2000-06-23 07:44:33 +0000 |
commit | dd93fd16a6696fe0c9c1b69539b2ac899c04978e (patch) | |
tree | ced3f143f58f67f9f3e1a80e95d8b0ab2df4a6ae /sys/amd64/isa/nmi.c | |
parent | 9d946aa74ddb86df33489ee80770826d8dc37705 (diff) | |
download | FreeBSD-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/amd64/isa/nmi.c')
-rw-r--r-- | sys/amd64/isa/nmi.c | 66 |
1 files changed, 66 insertions, 0 deletions
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. */ |