aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
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
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')
-rw-r--r--arch/powerpc/include/asm/mpic.h3
-rw-r--r--arch/powerpc/platforms/85xx/corenet_ds.c3
-rw-r--r--arch/powerpc/platforms/85xx/mpc8536_ds.c2
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_ds.c4
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_mds.c2
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_rdb.c4
-rw-r--r--arch/powerpc/platforms/85xx/p1010rdb.c2
-rw-r--r--arch/powerpc/platforms/85xx/p1022_ds.c2
-rw-r--r--arch/powerpc/platforms/85xx/p1023_rds.c2
-rw-r--r--arch/powerpc/platforms/85xx/xes_mpc85xx.c2
-rw-r--r--arch/powerpc/platforms/86xx/pic.c2
-rw-r--r--arch/powerpc/platforms/embedded6xx/holly.c3
-rw-r--r--arch/powerpc/platforms/embedded6xx/linkstation.c2
-rw-r--r--arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c3
-rw-r--r--arch/powerpc/platforms/embedded6xx/storcenter.c2
-rw-r--r--arch/powerpc/platforms/pseries/setup.c4
-rw-r--r--arch/powerpc/sysdev/mpic.c17
-rw-r--r--arch/powerpc/sysdev/mpic_msi.c4
18 files changed, 25 insertions, 38 deletions
diff --git a/arch/powerpc/include/asm/mpic.h b/arch/powerpc/include/asm/mpic.h
index 67b4d983723..2ebac31d1bb 100644
--- a/arch/powerpc/include/asm/mpic.h
+++ b/arch/powerpc/include/asm/mpic.h
@@ -273,7 +273,6 @@ struct mpic
273 unsigned int isu_size; 273 unsigned int isu_size;
274 unsigned int isu_shift; 274 unsigned int isu_shift;
275 unsigned int isu_mask; 275 unsigned int isu_mask;
276 unsigned int irq_count;
277 /* Number of sources */ 276 /* Number of sources */
278 unsigned int num_sources; 277 unsigned int num_sources;
279 /* default senses array */ 278 /* default senses array */
@@ -363,8 +362,6 @@ struct mpic
363#define MPIC_ENABLE_MCK 0x00000200 362#define MPIC_ENABLE_MCK 0x00000200
364/* Disable bias among target selection, spread interrupts evenly */ 363/* Disable bias among target selection, spread interrupts evenly */
365#define MPIC_NO_BIAS 0x00000400 364#define MPIC_NO_BIAS 0x00000400
366/* Ignore NIRQS as reported by FRR */
367#define MPIC_BROKEN_FRR_NIRQS 0x00000800
368/* Destination only supports a single CPU at a time */ 365/* Destination only supports a single CPU at a time */
369#define MPIC_SINGLE_DEST_CPU 0x00001000 366#define MPIC_SINGLE_DEST_CPU 0x00001000
370/* Enable CoreInt delivery of interrupts */ 367/* Enable CoreInt delivery of interrupts */
diff --git a/arch/powerpc/platforms/85xx/corenet_ds.c b/arch/powerpc/platforms/85xx/corenet_ds.c
index 07e3e6c4737..768479b986d 100644
--- a/arch/powerpc/platforms/85xx/corenet_ds.c
+++ b/arch/powerpc/platforms/85xx/corenet_ds.c
@@ -36,8 +36,7 @@
36void __init corenet_ds_pic_init(void) 36void __init corenet_ds_pic_init(void)
37{ 37{
38 struct mpic *mpic; 38 struct mpic *mpic;
39 unsigned int flags = MPIC_BIG_ENDIAN | 39 unsigned int flags = MPIC_BIG_ENDIAN | MPIC_SINGLE_DEST_CPU;
40 MPIC_BROKEN_FRR_NIRQS | MPIC_SINGLE_DEST_CPU;
41 40
42 if (ppc_md.get_irq == mpic_get_coreint_irq) 41 if (ppc_md.get_irq == mpic_get_coreint_irq)
43 flags |= MPIC_ENABLE_COREINT; 42 flags |= MPIC_ENABLE_COREINT;
diff --git a/arch/powerpc/platforms/85xx/mpc8536_ds.c b/arch/powerpc/platforms/85xx/mpc8536_ds.c
index cf266826682..d5373e0c0f7 100644
--- a/arch/powerpc/platforms/85xx/mpc8536_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc8536_ds.c
@@ -38,7 +38,7 @@ void __init mpc8536_ds_pic_init(void)
38{ 38{
39 struct mpic *mpic = mpic_alloc(NULL, 0, 39 struct mpic *mpic = mpic_alloc(NULL, 0,
40 MPIC_WANTS_RESET | 40 MPIC_WANTS_RESET |
41 MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS, 41 MPIC_BIG_ENDIAN,
42 0, 256, " OpenPIC "); 42 0, 256, " OpenPIC ");
43 BUG_ON(mpic == NULL); 43 BUG_ON(mpic == NULL);
44 mpic_init(mpic); 44 mpic_init(mpic);
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
index eefbb91e1d6..528b9a09e14 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
@@ -72,13 +72,13 @@ void __init mpc85xx_ds_pic_init(void)
72 72
73 if (of_flat_dt_is_compatible(root, "fsl,MPC8572DS-CAMP")) { 73 if (of_flat_dt_is_compatible(root, "fsl,MPC8572DS-CAMP")) {
74 mpic = mpic_alloc(NULL, 0, 74 mpic = mpic_alloc(NULL, 0,
75 MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS | 75 MPIC_BIG_ENDIAN |
76 MPIC_SINGLE_DEST_CPU, 76 MPIC_SINGLE_DEST_CPU,
77 0, 256, " OpenPIC "); 77 0, 256, " OpenPIC ");
78 } else { 78 } else {
79 mpic = mpic_alloc(NULL, 0, 79 mpic = mpic_alloc(NULL, 0,
80 MPIC_WANTS_RESET | 80 MPIC_WANTS_RESET |
81 MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS | 81 MPIC_BIG_ENDIAN |
82 MPIC_SINGLE_DEST_CPU, 82 MPIC_SINGLE_DEST_CPU,
83 0, 256, " OpenPIC "); 83 0, 256, " OpenPIC ");
84 } 84 }
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index 1d15a0cd2c8..a0cb7707c5b 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -436,7 +436,7 @@ static void __init mpc85xx_mds_pic_init(void)
436{ 436{
437 struct mpic *mpic = mpic_alloc(NULL, 0, 437 struct mpic *mpic = mpic_alloc(NULL, 0,
438 MPIC_WANTS_RESET | MPIC_BIG_ENDIAN | 438 MPIC_WANTS_RESET | MPIC_BIG_ENDIAN |
439 MPIC_BROKEN_FRR_NIRQS | MPIC_SINGLE_DEST_CPU, 439 MPIC_SINGLE_DEST_CPU,
440 0, 256, " OpenPIC "); 440 0, 256, " OpenPIC ");
441 BUG_ON(mpic == NULL); 441 BUG_ON(mpic == NULL);
442 442
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
index ccf520e890b..a23f6f30993 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
@@ -49,13 +49,13 @@ void __init mpc85xx_rdb_pic_init(void)
49 49
50 if (of_flat_dt_is_compatible(root, "fsl,MPC85XXRDB-CAMP")) { 50 if (of_flat_dt_is_compatible(root, "fsl,MPC85XXRDB-CAMP")) {
51 mpic = mpic_alloc(NULL, 0, 51 mpic = mpic_alloc(NULL, 0,
52 MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS | 52 MPIC_BIG_ENDIAN |
53 MPIC_SINGLE_DEST_CPU, 53 MPIC_SINGLE_DEST_CPU,
54 0, 256, " OpenPIC "); 54 0, 256, " OpenPIC ");
55 } else { 55 } else {
56 mpic = mpic_alloc(NULL, 0, 56 mpic = mpic_alloc(NULL, 0,
57 MPIC_WANTS_RESET | 57 MPIC_WANTS_RESET |
58 MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS | 58 MPIC_BIG_ENDIAN |
59 MPIC_SINGLE_DEST_CPU, 59 MPIC_SINGLE_DEST_CPU,
60 0, 256, " OpenPIC "); 60 0, 256, " OpenPIC ");
61 } 61 }
diff --git a/arch/powerpc/platforms/85xx/p1010rdb.c b/arch/powerpc/platforms/85xx/p1010rdb.c
index 538bc3f57e9..8650773c839 100644
--- a/arch/powerpc/platforms/85xx/p1010rdb.c
+++ b/arch/powerpc/platforms/85xx/p1010rdb.c
@@ -34,7 +34,7 @@ void __init p1010_rdb_pic_init(void)
34{ 34{
35 struct mpic *mpic = mpic_alloc(NULL, 0, 35 struct mpic *mpic = mpic_alloc(NULL, 0,
36 MPIC_WANTS_RESET | MPIC_BIG_ENDIAN | 36 MPIC_WANTS_RESET | MPIC_BIG_ENDIAN |
37 MPIC_BROKEN_FRR_NIRQS | MPIC_SINGLE_DEST_CPU, 37 MPIC_SINGLE_DEST_CPU,
38 0, 256, " OpenPIC "); 38 0, 256, " OpenPIC ");
39 39
40 BUG_ON(mpic == NULL); 40 BUG_ON(mpic == NULL);
diff --git a/arch/powerpc/platforms/85xx/p1022_ds.c b/arch/powerpc/platforms/85xx/p1022_ds.c
index b0984ada3f8..28266ab619d 100644
--- a/arch/powerpc/platforms/85xx/p1022_ds.c
+++ b/arch/powerpc/platforms/85xx/p1022_ds.c
@@ -244,7 +244,7 @@ void __init p1022_ds_pic_init(void)
244{ 244{
245 struct mpic *mpic = mpic_alloc(NULL, 0, 245 struct mpic *mpic = mpic_alloc(NULL, 0,
246 MPIC_WANTS_RESET | 246 MPIC_WANTS_RESET |
247 MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS | 247 MPIC_BIG_ENDIAN |
248 MPIC_SINGLE_DEST_CPU, 248 MPIC_SINGLE_DEST_CPU,
249 0, 256, " OpenPIC "); 249 0, 256, " OpenPIC ");
250 BUG_ON(mpic == NULL); 250 BUG_ON(mpic == NULL);
diff --git a/arch/powerpc/platforms/85xx/p1023_rds.c b/arch/powerpc/platforms/85xx/p1023_rds.c
index d951e7027bb..b1cd6a28901 100644
--- a/arch/powerpc/platforms/85xx/p1023_rds.c
+++ b/arch/powerpc/platforms/85xx/p1023_rds.c
@@ -95,7 +95,7 @@ static void __init mpc85xx_rds_pic_init(void)
95{ 95{
96 struct mpic *mpic = mpic_alloc(NULL, 0, 96 struct mpic *mpic = mpic_alloc(NULL, 0,
97 MPIC_WANTS_RESET | MPIC_BIG_ENDIAN | 97 MPIC_WANTS_RESET | MPIC_BIG_ENDIAN |
98 MPIC_BROKEN_FRR_NIRQS | MPIC_SINGLE_DEST_CPU, 98 MPIC_SINGLE_DEST_CPU,
99 0, 256, " OpenPIC "); 99 0, 256, " OpenPIC ");
100 100
101 BUG_ON(mpic == NULL); 101 BUG_ON(mpic == NULL);
diff --git a/arch/powerpc/platforms/85xx/xes_mpc85xx.c b/arch/powerpc/platforms/85xx/xes_mpc85xx.c
index 3a69f8b77de..1ab4e026006 100644
--- a/arch/powerpc/platforms/85xx/xes_mpc85xx.c
+++ b/arch/powerpc/platforms/85xx/xes_mpc85xx.c
@@ -45,7 +45,7 @@ void __init xes_mpc85xx_pic_init(void)
45{ 45{
46 struct mpic *mpic = mpic_alloc(NULL, 0, 46 struct mpic *mpic = mpic_alloc(NULL, 0,
47 MPIC_WANTS_RESET | 47 MPIC_WANTS_RESET |
48 MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS, 48 MPIC_BIG_ENDIAN,
49 0, 256, " OpenPIC "); 49 0, 256, " OpenPIC ");
50 BUG_ON(mpic == NULL); 50 BUG_ON(mpic == NULL);
51 mpic_init(mpic); 51 mpic_init(mpic);
diff --git a/arch/powerpc/platforms/86xx/pic.c b/arch/powerpc/platforms/86xx/pic.c
index 52bbfa03153..27959d63a07 100644
--- a/arch/powerpc/platforms/86xx/pic.c
+++ b/arch/powerpc/platforms/86xx/pic.c
@@ -39,7 +39,7 @@ void __init mpc86xx_init_irq(void)
39 39
40 struct mpic *mpic = mpic_alloc(NULL, 0, 40 struct mpic *mpic = mpic_alloc(NULL, 0,
41 MPIC_WANTS_RESET | MPIC_BIG_ENDIAN | 41 MPIC_WANTS_RESET | MPIC_BIG_ENDIAN |
42 MPIC_BROKEN_FRR_NIRQS | MPIC_SINGLE_DEST_CPU, 42 MPIC_SINGLE_DEST_CPU,
43 0, 256, " MPIC "); 43 0, 256, " MPIC ");
44 BUG_ON(mpic == NULL); 44 BUG_ON(mpic == NULL);
45 45
diff --git a/arch/powerpc/platforms/embedded6xx/holly.c b/arch/powerpc/platforms/embedded6xx/holly.c
index 9cfcf20c056..d7727de85d5 100644
--- a/arch/powerpc/platforms/embedded6xx/holly.c
+++ b/arch/powerpc/platforms/embedded6xx/holly.c
@@ -157,8 +157,7 @@ static void __init holly_init_IRQ(void)
157 mpic = mpic_alloc(NULL, 0, 157 mpic = mpic_alloc(NULL, 0,
158 MPIC_BIG_ENDIAN | MPIC_WANTS_RESET | 158 MPIC_BIG_ENDIAN | MPIC_WANTS_RESET |
159 MPIC_SPV_EOI | MPIC_NO_PTHROU_DIS | MPIC_REGSET_TSI108, 159 MPIC_SPV_EOI | MPIC_NO_PTHROU_DIS | MPIC_REGSET_TSI108,
160 24, 160 24, 0,
161 NR_IRQS-4, /* num_sources used */
162 "Tsi108_PIC"); 161 "Tsi108_PIC");
163 162
164 BUG_ON(mpic == NULL); 163 BUG_ON(mpic == NULL);
diff --git a/arch/powerpc/platforms/embedded6xx/linkstation.c b/arch/powerpc/platforms/embedded6xx/linkstation.c
index bcfad92c9ce..9479f4ebe1b 100644
--- a/arch/powerpc/platforms/embedded6xx/linkstation.c
+++ b/arch/powerpc/platforms/embedded6xx/linkstation.c
@@ -83,7 +83,7 @@ static void __init linkstation_init_IRQ(void)
83 struct mpic *mpic; 83 struct mpic *mpic;
84 84
85 mpic = mpic_alloc(NULL, 0, MPIC_WANTS_RESET, 85 mpic = mpic_alloc(NULL, 0, MPIC_WANTS_RESET,
86 4, 32, " EPIC "); 86 4, 0, " EPIC ");
87 BUG_ON(mpic == NULL); 87 BUG_ON(mpic == NULL);
88 88
89 /* PCI IRQs */ 89 /* PCI IRQs */
diff --git a/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c b/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
index f3350d786f5..90acb544916 100644
--- a/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
+++ b/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
@@ -111,8 +111,7 @@ static void __init mpc7448_hpc2_init_IRQ(void)
111 mpic = mpic_alloc(NULL, 0, 111 mpic = mpic_alloc(NULL, 0,
112 MPIC_BIG_ENDIAN | MPIC_WANTS_RESET | 112 MPIC_BIG_ENDIAN | MPIC_WANTS_RESET |
113 MPIC_SPV_EOI | MPIC_NO_PTHROU_DIS | MPIC_REGSET_TSI108, 113 MPIC_SPV_EOI | MPIC_NO_PTHROU_DIS | MPIC_REGSET_TSI108,
114 24, 114 24, 0,
115 NR_IRQS-4, /* num_sources used */
116 "Tsi108_PIC"); 115 "Tsi108_PIC");
117 116
118 BUG_ON(mpic == NULL); 117 BUG_ON(mpic == NULL);
diff --git a/arch/powerpc/platforms/embedded6xx/storcenter.c b/arch/powerpc/platforms/embedded6xx/storcenter.c
index afa63883496..451dce4edcc 100644
--- a/arch/powerpc/platforms/embedded6xx/storcenter.c
+++ b/arch/powerpc/platforms/embedded6xx/storcenter.c
@@ -85,7 +85,7 @@ static void __init storcenter_init_IRQ(void)
85 struct mpic *mpic; 85 struct mpic *mpic;
86 86
87 mpic = mpic_alloc(NULL, 0, MPIC_WANTS_RESET, 87 mpic = mpic_alloc(NULL, 0, MPIC_WANTS_RESET,
88 16, 32, " OpenPIC "); 88 16, 0, " OpenPIC ");
89 BUG_ON(mpic == NULL); 89 BUG_ON(mpic == NULL);
90 90
91 /* 91 /*
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index f79f1278dfc..6d0a5dfbb9f 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -190,9 +190,7 @@ static void __init pseries_mpic_init_IRQ(void)
190 BUG_ON(openpic_addr == 0); 190 BUG_ON(openpic_addr == 0);
191 191
192 /* Setup the openpic driver */ 192 /* Setup the openpic driver */
193 mpic = mpic_alloc(pSeries_mpic_node, openpic_addr, 0, 193 mpic = mpic_alloc(pSeries_mpic_node, openpic_addr, 0, 16, 0, " MPIC ");
194 16, 250, /* isu size, irq count */
195 " MPIC ");
196 BUG_ON(mpic == NULL); 194 BUG_ON(mpic == NULL);
197 195
198 /* Add ISUs */ 196 /* Add ISUs */
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index c297a524f76..cbffeb742d6 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 0f67cd79d48..cfe394716f6 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;