diff options
Diffstat (limited to 'sys/alpha/pci')
-rw-r--r-- | sys/alpha/pci/apecs.c | 18 | ||||
-rw-r--r-- | sys/alpha/pci/cia.c | 18 | ||||
-rw-r--r-- | sys/alpha/pci/t2.c | 12 | ||||
-rw-r--r-- | sys/alpha/pci/tsunami.c | 17 |
4 files changed, 55 insertions, 10 deletions
diff --git a/sys/alpha/pci/apecs.c b/sys/alpha/pci/apecs.c index ebe350b..c74e940 100644 --- a/sys/alpha/pci/apecs.c +++ b/sys/alpha/pci/apecs.c @@ -58,8 +58,10 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> -#include <sys/module.h> +#include <sys/lock.h> #include <sys/malloc.h> +#include <sys/module.h> +#include <sys/mutex.h> #include <sys/bus.h> #include <machine/bus.h> #include <sys/proc.h> @@ -304,15 +306,23 @@ apecs_attach(device_t dev) static void apecs_disable_intr(int vector) { - int irq = (vector - 0x900) >> 4; + int irq; + + irq = (vector - 0x900) >> 4; + mtx_lock_spin(&icu_lock); platform.pci_intr_disable(irq); + mtx_unlock_spin(&icu_lock); } static void apecs_enable_intr(int vector) { - int irq = (vector - 0x900) >> 4; + int irq; + + irq = (vector - 0x900) >> 4; + mtx_lock_spin(&icu_lock); platform.pci_intr_enable(irq); + mtx_unlock_spin(&icu_lock); } static int @@ -342,7 +352,9 @@ apecs_setup_intr(device_t dev, device_t child, return error; /* Enable PCI interrupt */ + mtx_lock_spin(&icu_lock); platform.pci_intr_enable(irq->r_start); + mtx_unlock_spin(&icu_lock); device_printf(child, "interrupting at APECS irq %d\n", (int) irq->r_start); diff --git a/sys/alpha/pci/cia.c b/sys/alpha/pci/cia.c index 09436e3..40f205c 100644 --- a/sys/alpha/pci/cia.c +++ b/sys/alpha/pci/cia.c @@ -94,8 +94,10 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> -#include <sys/module.h> +#include <sys/lock.h> #include <sys/malloc.h> +#include <sys/module.h> +#include <sys/mutex.h> #include <sys/bus.h> #include <machine/bus.h> #include <sys/proc.h> @@ -513,15 +515,23 @@ cia_attach(device_t dev) static void cia_disable_intr(int vector) { - int irq = (vector - 0x900) >> 4; + int irq; + + irq = (vector - 0x900) >> 4; + mtx_lock_spin(&icu_lock); platform.pci_intr_disable(irq); + mtx_unlock_spin(&icu_lock); } static void cia_enable_intr(int vector) { - int irq = (vector - 0x900) >> 4; + int irq; + + irq = (vector - 0x900) >> 4; + mtx_lock_spin(&icu_lock); platform.pci_intr_enable(irq); + mtx_unlock_spin(&icu_lock); } static int @@ -544,7 +554,9 @@ cia_setup_intr(device_t dev, device_t child, return error; /* Enable PCI interrupt */ + mtx_lock_spin(&icu_lock); platform.pci_intr_enable(irq->r_start); + mtx_unlock_spin(&icu_lock); device_printf(child, "interrupting at CIA irq %d\n", (int) irq->r_start); diff --git a/sys/alpha/pci/t2.c b/sys/alpha/pci/t2.c index d9d0b9d..3dcfe35 100644 --- a/sys/alpha/pci/t2.c +++ b/sys/alpha/pci/t2.c @@ -55,8 +55,10 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> -#include <sys/module.h> +#include <sys/lock.h> #include <sys/malloc.h> +#include <sys/module.h> +#include <sys/mutex.h> #include <sys/bus.h> #include <machine/bus.h> #include <sys/proc.h> @@ -460,6 +462,7 @@ t2_enable_vec(int vector) hose = (vector >= 0xC00); irq = (vector - 0x800) >> 4; + mtx_lock_spin(&icu_lock); if (pci_int_type[hose]) { /* Write the air register on the T3/T4 with the @@ -481,6 +484,7 @@ t2_enable_vec(int vector) /* Old style 8259 (Gack!!!) interrupts */ t2_8259_enable_mask(irq); } + mtx_unlock_spin(&icu_lock); } static void @@ -492,6 +496,7 @@ t2_disable_vec(int vector) hose = (vector >= 0xC00); irq = (vector - 0x800) >> 4; + mtx_lock_spin(&icu_lock); if (pci_int_type[hose]) { /* Write the air register on the T3/T4 wioth the @@ -515,6 +520,7 @@ t2_disable_vec(int vector) /* Old style 8259 (Gack!!!) interrupts */ t2_8259_disable_mask(irq); } + mtx_unlock_spin(&icu_lock); } @@ -590,12 +596,14 @@ t2_teardown_intr(device_t dev, device_t child, t2_shadow_mask |= (1UL << mask); + mtx_lock_spin(&icu_lock); if (mask <= 7) outb(SLAVE0_ICU, t2_shadow_mask); else if (mask <= 15) outb(SLAVE1_ICU, t2_shadow_mask >> 8); else outb(SLAVE2_ICU, t2_shadow_mask >> 16); + mtx_unlock_spin(&icu_lock); alpha_teardown_intr(cookie); return rman_deactivate_resource(irq); @@ -607,7 +615,9 @@ static void t2_dispatch_intr(void *frame, unsigned long vector) { alpha_dispatch_intr(frame, vector); + mtx_lock_spin(&icu_lock); t2_eoi(vector); + mtx_unlock_spin(&icu_lock); } static void diff --git a/sys/alpha/pci/tsunami.c b/sys/alpha/pci/tsunami.c index 1ca0803..3ca127b 100644 --- a/sys/alpha/pci/tsunami.c +++ b/sys/alpha/pci/tsunami.c @@ -31,7 +31,9 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> +#include <sys/lock.h> #include <sys/module.h> +#include <sys/mutex.h> #include <sys/bus.h> #include <machine/bus.h> #include <sys/proc.h> @@ -305,15 +307,23 @@ tsunami_attach(device_t dev) static void tsunami_disable_intr_vec(int vector) { - int irq = (vector - 0x900) >> 4; + int irq; + + irq = (vector - 0x900) >> 4; + mtx_lock_spin(&icu_lock); platform.pci_intr_disable(irq); + mtx_unlock_spin(&icu_lock); } static void tsunami_enable_intr_vec(int vector) { - int irq = (vector - 0x900) >> 4; + int irq; + + irq = (vector - 0x900) >> 4; + mtx_lock_spin(&icu_lock); platform.pci_intr_enable(irq); + mtx_unlock_spin(&icu_lock); } static int @@ -335,7 +345,9 @@ tsunami_setup_intr(device_t dev, device_t child, return error; /* Enable PCI interrupt */ + mtx_lock_spin(&icu_lock); platform.pci_intr_enable(irq->r_start); + mtx_unlock_spin(&icu_lock); device_printf(child, "interrupting at TSUNAMI irq %d\n", (int) irq->r_start); @@ -391,7 +403,6 @@ tsunami_intr_disable(int irq) saved_mask = *mask; alpha_mb(); alpha_mb(); - } |