diff options
author | jhb <jhb@FreeBSD.org> | 2000-05-10 18:54:28 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2000-05-10 18:54:28 +0000 |
commit | a1a769d93e6080bab3ab2c67906c3d2586e16aed (patch) | |
tree | 39d188bd68492c613fb72d7deeb3187c6473250e /sys/alpha/pci | |
parent | b1c5277216ac06bbdbf908c1fb8d2080a48c793e (diff) | |
download | FreeBSD-src-a1a769d93e6080bab3ab2c67906c3d2586e16aed.zip FreeBSD-src-a1a769d93e6080bab3ab2c67906c3d2586e16aed.tar.gz |
Handle PCI devices that actually use an ISA IRQ for the cia and tsunami
chipsets. An example of this is the USB controller on these chipsets.
With this, I can now use USB devices on the test Alpha I am borrowing at
the moment.
Reviewed by: dfr, obrien
Diffstat (limited to 'sys/alpha/pci')
-rw-r--r-- | sys/alpha/pci/cia_pci.c | 5 | ||||
-rw-r--r-- | sys/alpha/pci/pcibus.c | 46 | ||||
-rw-r--r-- | sys/alpha/pci/tsunami_pci.c | 5 |
3 files changed, 51 insertions, 5 deletions
diff --git a/sys/alpha/pci/cia_pci.c b/sys/alpha/pci/cia_pci.c index 32bf645..f9b7268 100644 --- a/sys/alpha/pci/cia_pci.c +++ b/sys/alpha/pci/cia_pci.c @@ -32,6 +32,7 @@ #include <sys/module.h> #include <sys/bus.h> #include <machine/bus.h> +#include <machine/md_var.h> #include <sys/rman.h> #include <pci/pcivar.h> @@ -69,8 +70,8 @@ static device_method_t cia_pcib_methods[] = { DEVMETHOD(bus_release_resource, bus_generic_release_resource), DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), - DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), + DEVMETHOD(bus_setup_intr, alpha_platform_pci_setup_intr), + DEVMETHOD(bus_teardown_intr, alpha_platform_pci_teardown_intr), { 0, 0 } }; diff --git a/sys/alpha/pci/pcibus.c b/sys/alpha/pci/pcibus.c index aaaff7b..f72e9c0 100644 --- a/sys/alpha/pci/pcibus.c +++ b/sys/alpha/pci/pcibus.c @@ -47,6 +47,9 @@ #include "isa.h" +#define ISA_IRQ_OFFSET 0xe0 +#define ISA_IRQ_LEN 0x10 + char chipset_type[10]; int chipset_bwx = 0; long chipset_ports = 0; @@ -197,6 +200,38 @@ alpha_platform_teardown_ide_intr(struct resource *res, void *cookie) static struct rman irq_rman, port_rman, mem_rman; +int +alpha_platform_pci_setup_intr(device_t dev, device_t child, + struct resource *irq, int flags, + driver_intr_t *intr, void *arg, + void **cookiep) +{ + /* + * XXX - If we aren't the resource manager for this IRQ, assume that + * it is actually handled by the ISA PIC. + */ + if(irq->r_rm != &irq_rman) + return isa_setup_intr(dev, child, irq, flags, intr, arg, + cookiep); + else + return bus_generic_setup_intr(dev, child, irq, flags, intr, + arg, cookiep); +} + +int +alpha_platform_pci_teardown_intr(device_t dev, device_t child, + struct resource *irq, void *cookie) +{ + /* + * XXX - If we aren't the resource manager for this IRQ, assume that + * it is actually handled by the ISA PIC. + */ + if(irq->r_rm != &irq_rman) + return isa_teardown_intr(dev, child, irq, cookie); + else + return bus_generic_teardown_intr(dev, child, irq, cookie); +} + void pci_init_resources(void) { @@ -238,7 +273,16 @@ pci_alloc_resource(device_t bus, device_t child, int type, int *rid, switch (type) { case SYS_RES_IRQ: - rm = &irq_rman; +#if NISA > 0 + if((start >= ISA_IRQ_OFFSET) && + (end < ISA_IRQ_OFFSET + ISA_IRQ_LEN)) { + return isa_alloc_intrs(bus, child, + start - ISA_IRQ_OFFSET, + end - ISA_IRQ_OFFSET); + } + else +#endif + rm = &irq_rman; break; case SYS_RES_IOPORT: diff --git a/sys/alpha/pci/tsunami_pci.c b/sys/alpha/pci/tsunami_pci.c index 5372420..17d7be2 100644 --- a/sys/alpha/pci/tsunami_pci.c +++ b/sys/alpha/pci/tsunami_pci.c @@ -33,6 +33,7 @@ #include <sys/malloc.h> #include <sys/bus.h> #include <machine/bus.h> +#include <machine/md_var.h> #include <sys/rman.h> #include <pci/pcivar.h> #include <alpha/pci/tsunamireg.h> @@ -156,8 +157,8 @@ static device_method_t tsunami_pcib_methods[] = { DEVMETHOD(bus_release_resource, bus_generic_release_resource), DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), - DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), + DEVMETHOD(bus_setup_intr, alpha_platform_pci_setup_intr), + DEVMETHOD(bus_teardown_intr, alpha_platform_pci_teardown_intr), { 0, 0 } }; |