diff options
author | jhb <jhb@FreeBSD.org> | 2007-03-05 16:22:49 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2007-03-05 16:22:49 +0000 |
commit | f650676d7dc494534905e8aedc6cbf5851bbd4de (patch) | |
tree | 46e98b4017af8a2fddd87a55cd8251b0911397c3 /sys/i386 | |
parent | 514f531cb4527841b91ea3bc209e74587dc9e195 (diff) | |
download | FreeBSD-src-f650676d7dc494534905e8aedc6cbf5851bbd4de.zip FreeBSD-src-f650676d7dc494534905e8aedc6cbf5851bbd4de.tar.gz |
Add a simple device driver to "eat" any I/O APICs that show up as PCI
devices.
MFC after: 1 week
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/i386/io_apic.c | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/sys/i386/i386/io_apic.c b/sys/i386/i386/io_apic.c index 5973836..0db8ea3 100644 --- a/sys/i386/i386/io_apic.c +++ b/sys/i386/i386/io_apic.c @@ -36,11 +36,15 @@ __FBSDID("$FreeBSD$"); #include <sys/systm.h> #include <sys/bus.h> #include <sys/kernel.h> -#include <sys/malloc.h> #include <sys/lock.h> +#include <sys/malloc.h> +#include <sys/module.h> #include <sys/mutex.h> #include <sys/sysctl.h> +#include <dev/pci/pcireg.h> +#include <dev/pci/pcivar.h> + #include <vm/vm.h> #include <vm/pmap.h> @@ -727,3 +731,46 @@ ioapic_register(void *cookie) if (pin->io_irq < NUM_IO_INTS) intr_register_source(&pin->io_intsrc); } + +/* A simple new-bus driver to consume PCI I/O APIC devices. */ +static int +ioapic_pci_probe(device_t dev) +{ + + if (pci_get_class(dev) == PCIC_BASEPERIPH && + pci_get_subclass(dev) == PCIS_BASEPERIPH_PIC) { + switch (pci_get_progif(dev)) { + case PCIP_BASEPERIPH_PIC_IO_APIC: + device_set_desc(dev, "IO APIC"); + break; + case PCIP_BASEPERIPH_PIC_IOX_APIC: + device_set_desc(dev, "IO(x) APIC"); + break; + default: + return (ENXIO); + } + device_quiet(dev); + return (-10000); + } + return (ENXIO); +} + +static int +ioapic_pci_attach(device_t dev) +{ + + return (0); +} + +static device_method_t ioapic_pci_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, ioapic_pci_probe), + DEVMETHOD(device_attach, ioapic_pci_attach), + + { 0, 0 } +}; + +DEFINE_CLASS_0(ioapic, ioapic_pci_driver, ioapic_pci_methods, 0); + +static devclass_t ioapic_devclass; +DRIVER_MODULE(ioapic, pci, ioapic_pci_driver, ioapic_devclass, 0, 0); |