aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev
diff options
context:
space:
mode:
authorKyle Moffett <Kyle.D.Moffett@boeing.com>2011-12-22 05:19:12 -0500
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2012-02-22 18:49:59 -0500
commit5019609fce965dbdc66a7d947385fe92ca522231 (patch)
tree00678069c54aa7dbdf7ce32b927844957ead65f5 /arch/powerpc/sysdev
parent9ca163c8602681ad098910f48f89b97f0cb87c4f (diff)
powerpc/mpic: Remove MPIC_BROKEN_FRR_NIRQS and duplicate irq_count
The mpic->irq_count variable is only used as a software error-checking limit to determine whether or not an IRQ number is valid. In board code which does not manually specify an IRQ count to mpic_alloc(), i.e. 0, it is automatically detected from the number of ISUs and the ISU size. In practice, all hardware ends up with irq_count == num_sources, so all of the runtime checks on mpic->irq_count should just check the value of mpic->num_sources instead. When platform hardware does not correctly report the number of IRQs, which only happens on the MPC85xx/MPC86xx, the MPIC_BROKEN_FRR_NIRQS flag is used to override the detected value of num_sources with the manual irq_count parameter. Since there's no need to manually specify the number of IRQs except in this case, the extra flag can be eliminated and the test changed to "irq_count != 0". Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/sysdev')
-rw-r--r--arch/powerpc/sysdev/mpic.c17
-rw-r--r--arch/powerpc/sysdev/mpic_msi.c4
2 files changed, 8 insertions, 13 deletions
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index c297a524f761..cbffeb742d66 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -873,7 +873,7 @@ int mpic_set_irq_type(struct irq_data *d, unsigned int flow_type)
873 DBG("mpic: set_irq_type(mpic:@%p,virq:%d,src:0x%x,type:0x%x)\n", 873 DBG("mpic: set_irq_type(mpic:@%p,virq:%d,src:0x%x,type:0x%x)\n",
874 mpic, d->irq, src, flow_type); 874 mpic, d->irq, src, flow_type);
875 875
876 if (src >= mpic->irq_count) 876 if (src >= mpic->num_sources)
877 return -EINVAL; 877 return -EINVAL;
878 878
879 if (flow_type == IRQ_TYPE_NONE) 879 if (flow_type == IRQ_TYPE_NONE)
@@ -909,7 +909,7 @@ void mpic_set_vector(unsigned int virq, unsigned int vector)
909 DBG("mpic: set_vector(mpic:@%p,virq:%d,src:%d,vector:0x%x)\n", 909 DBG("mpic: set_vector(mpic:@%p,virq:%d,src:%d,vector:0x%x)\n",
910 mpic, virq, src, vector); 910 mpic, virq, src, vector);
911 911
912 if (src >= mpic->irq_count) 912 if (src >= mpic->num_sources)
913 return; 913 return;
914 914
915 vecpri = mpic_irq_read(src, MPIC_INFO(IRQ_VECTOR_PRI)); 915 vecpri = mpic_irq_read(src, MPIC_INFO(IRQ_VECTOR_PRI));
@@ -926,7 +926,7 @@ void mpic_set_destination(unsigned int virq, unsigned int cpuid)
926 DBG("mpic: set_destination(mpic:@%p,virq:%d,src:%d,cpuid:0x%x)\n", 926 DBG("mpic: set_destination(mpic:@%p,virq:%d,src:%d,cpuid:0x%x)\n",
927 mpic, virq, src, cpuid); 927 mpic, virq, src, cpuid);
928 928
929 if (src >= mpic->irq_count) 929 if (src >= mpic->num_sources)
930 return; 930 return;
931 931
932 mpic_irq_write(src, MPIC_INFO(IRQ_DESTINATION), 1 << cpuid); 932 mpic_irq_write(src, MPIC_INFO(IRQ_DESTINATION), 1 << cpuid);
@@ -1006,7 +1006,7 @@ static int mpic_host_map(struct irq_host *h, unsigned int virq,
1006 return 0; 1006 return 0;
1007 } 1007 }
1008 1008
1009 if (hw >= mpic->irq_count) 1009 if (hw >= mpic->num_sources)
1010 return -EINVAL; 1010 return -EINVAL;
1011 1011
1012 mpic_msi_reserve_hwirq(mpic, hw); 1012 mpic_msi_reserve_hwirq(mpic, hw);
@@ -1221,7 +1221,6 @@ struct mpic * __init mpic_alloc(struct device_node *node,
1221 mpic->hc_tm.name = name; 1221 mpic->hc_tm.name = name;
1222 1222
1223 mpic->isu_size = isu_size; 1223 mpic->isu_size = isu_size;
1224 mpic->irq_count = irq_count;
1225 mpic->num_sources = 0; /* so far */ 1224 mpic->num_sources = 0; /* so far */
1226 1225
1227 if (mpic->flags & MPIC_LARGE_VECTORS) 1226 if (mpic->flags & MPIC_LARGE_VECTORS)
@@ -1314,8 +1313,8 @@ struct mpic * __init mpic_alloc(struct device_node *node,
1314 */ 1313 */
1315 greg_feature = mpic_read(mpic->gregs, MPIC_INFO(GREG_FEATURE_0)); 1314 greg_feature = mpic_read(mpic->gregs, MPIC_INFO(GREG_FEATURE_0));
1316 if (isu_size == 0) { 1315 if (isu_size == 0) {
1317 if (mpic->flags & MPIC_BROKEN_FRR_NIRQS) 1316 if (irq_count)
1318 mpic->num_sources = mpic->irq_count; 1317 mpic->num_sources = irq_count;
1319 else 1318 else
1320 mpic->num_sources = 1319 mpic->num_sources =
1321 ((greg_feature & MPIC_GREG_FEATURE_LAST_SRC_MASK) 1320 ((greg_feature & MPIC_GREG_FEATURE_LAST_SRC_MASK)
@@ -1450,10 +1449,6 @@ void __init mpic_init(struct mpic *mpic)
1450 (mpic->ipi_vecs[0] + i)); 1449 (mpic->ipi_vecs[0] + i));
1451 } 1450 }
1452 1451
1453 /* Initialize interrupt sources */
1454 if (mpic->irq_count == 0)
1455 mpic->irq_count = mpic->num_sources;
1456
1457 /* Do the HT PIC fixups on U3 broken mpic */ 1452 /* Do the HT PIC fixups on U3 broken mpic */
1458 DBG("MPIC flags: %x\n", mpic->flags); 1453 DBG("MPIC flags: %x\n", mpic->flags);
1459 if ((mpic->flags & MPIC_U3_HT_IRQS) && !(mpic->flags & MPIC_SECONDARY)) { 1454 if ((mpic->flags & MPIC_U3_HT_IRQS) && !(mpic->flags & MPIC_SECONDARY)) {
diff --git a/arch/powerpc/sysdev/mpic_msi.c b/arch/powerpc/sysdev/mpic_msi.c
index 0f67cd79d481..cfe394716f68 100644
--- a/arch/powerpc/sysdev/mpic_msi.c
+++ b/arch/powerpc/sysdev/mpic_msi.c
@@ -54,7 +54,7 @@ static int mpic_msi_reserve_u3_hwirqs(struct mpic *mpic)
54 for (i = 100; i < 105; i++) 54 for (i = 100; i < 105; i++)
55 msi_bitmap_reserve_hwirq(&mpic->msi_bitmap, i); 55 msi_bitmap_reserve_hwirq(&mpic->msi_bitmap, i);
56 56
57 for (i = 124; i < mpic->irq_count; i++) 57 for (i = 124; i < mpic->num_sources; i++)
58 msi_bitmap_reserve_hwirq(&mpic->msi_bitmap, i); 58 msi_bitmap_reserve_hwirq(&mpic->msi_bitmap, i);
59 59
60 60
@@ -83,7 +83,7 @@ int mpic_msi_init_allocator(struct mpic *mpic)
83{ 83{
84 int rc; 84 int rc;
85 85
86 rc = msi_bitmap_alloc(&mpic->msi_bitmap, mpic->irq_count, 86 rc = msi_bitmap_alloc(&mpic->msi_bitmap, mpic->num_sources,
87 mpic->irqhost->of_node); 87 mpic->irqhost->of_node);
88 if (rc) 88 if (rc)
89 return rc; 89 return rc;