aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2007-03-05 16:22:49 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2007-03-05 16:22:49 +0000
commitdb181dc741b63797fad3a1acf14e66bc2e801894 (patch)
tree46e98b4017af8a2fddd87a55cd8251b0911397c3
parentd8a4c26cde9bc6361a89d1a8d59788fed6a881f3 (diff)
Notes
-rw-r--r--sys/amd64/amd64/io_apic.c49
-rw-r--r--sys/i386/i386/io_apic.c49
2 files changed, 96 insertions, 2 deletions
diff --git a/sys/amd64/amd64/io_apic.c b/sys/amd64/amd64/io_apic.c
index b27db7e294e6..b4bbcaf52501 100644
--- a/sys/amd64/amd64/io_apic.c
+++ b/sys/amd64/amd64/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);
diff --git a/sys/i386/i386/io_apic.c b/sys/i386/i386/io_apic.c
index 597383660696..0db8ea3bcc5c 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);