aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev/mpic.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/sysdev/mpic.c')
-rw-r--r--arch/powerpc/sysdev/mpic.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 0efc12d1a3d7..bbee441ae867 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -613,23 +613,23 @@ static int irq_choose_cpu(unsigned int virt_irq)
613#define mpic_irq_to_hw(virq) ((unsigned int)irq_map[virq].hwirq) 613#define mpic_irq_to_hw(virq) ((unsigned int)irq_map[virq].hwirq)
614 614
615/* Find an mpic associated with a given linux interrupt */ 615/* Find an mpic associated with a given linux interrupt */
616static struct mpic *mpic_find(unsigned int irq, unsigned int *is_ipi) 616static struct mpic *mpic_find(unsigned int irq)
617{ 617{
618 unsigned int src = mpic_irq_to_hw(irq);
619 struct mpic *mpic;
620
621 if (irq < NUM_ISA_INTERRUPTS) 618 if (irq < NUM_ISA_INTERRUPTS)
622 return NULL; 619 return NULL;
623 620
624 mpic = irq_desc[irq].chip_data; 621 return irq_desc[irq].chip_data;
622}
625 623
626 if (is_ipi) 624/* Determine if the linux irq is an IPI */
627 *is_ipi = (src >= mpic->ipi_vecs[0] && 625static unsigned int mpic_is_ipi(struct mpic *mpic, unsigned int irq)
628 src <= mpic->ipi_vecs[3]); 626{
627 unsigned int src = mpic_irq_to_hw(irq);
629 628
630 return mpic; 629 return (src >= mpic->ipi_vecs[0] && src <= mpic->ipi_vecs[3]);
631} 630}
632 631
632
633/* Convert a cpu mask from logical to physical cpu numbers. */ 633/* Convert a cpu mask from logical to physical cpu numbers. */
634static inline u32 mpic_physmask(u32 cpumask) 634static inline u32 mpic_physmask(u32 cpumask)
635{ 635{
@@ -1381,8 +1381,7 @@ void __init mpic_set_serial_int(struct mpic *mpic, int enable)
1381 1381
1382void mpic_irq_set_priority(unsigned int irq, unsigned int pri) 1382void mpic_irq_set_priority(unsigned int irq, unsigned int pri)
1383{ 1383{
1384 unsigned int is_ipi; 1384 struct mpic *mpic = mpic_find(irq);
1385 struct mpic *mpic = mpic_find(irq, &is_ipi);
1386 unsigned int src = mpic_irq_to_hw(irq); 1385 unsigned int src = mpic_irq_to_hw(irq);
1387 unsigned long flags; 1386 unsigned long flags;
1388 u32 reg; 1387 u32 reg;
@@ -1391,7 +1390,7 @@ void mpic_irq_set_priority(unsigned int irq, unsigned int pri)
1391 return; 1390 return;
1392 1391
1393 spin_lock_irqsave(&mpic_lock, flags); 1392 spin_lock_irqsave(&mpic_lock, flags);
1394 if (is_ipi) { 1393 if (mpic_is_ipi(mpic, irq)) {
1395 reg = mpic_ipi_read(src - mpic->ipi_vecs[0]) & 1394 reg = mpic_ipi_read(src - mpic->ipi_vecs[0]) &
1396 ~MPIC_VECPRI_PRIORITY_MASK; 1395 ~MPIC_VECPRI_PRIORITY_MASK;
1397 mpic_ipi_write(src - mpic->ipi_vecs[0], 1396 mpic_ipi_write(src - mpic->ipi_vecs[0],