aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/sysdev/mpic.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 3bf71035ff50..0f7c6718d261 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -147,6 +147,16 @@ static u32 mpic_infos[][MPIC_IDX_END] = {
147 147
148#endif /* CONFIG_MPIC_WEIRD */ 148#endif /* CONFIG_MPIC_WEIRD */
149 149
150static inline unsigned int mpic_processor_id(struct mpic *mpic)
151{
152 unsigned int cpu = 0;
153
154 if (mpic->flags & MPIC_PRIMARY)
155 cpu = hard_smp_processor_id();
156
157 return cpu;
158}
159
150/* 160/*
151 * Register accessor functions 161 * Register accessor functions
152 */ 162 */
@@ -210,19 +220,14 @@ static inline void _mpic_ipi_write(struct mpic *mpic, unsigned int ipi, u32 valu
210 220
211static inline u32 _mpic_cpu_read(struct mpic *mpic, unsigned int reg) 221static inline u32 _mpic_cpu_read(struct mpic *mpic, unsigned int reg)
212{ 222{
213 unsigned int cpu = 0; 223 unsigned int cpu = mpic_processor_id(mpic);
214 224
215 if (mpic->flags & MPIC_PRIMARY)
216 cpu = hard_smp_processor_id();
217 return _mpic_read(mpic->reg_type, &mpic->cpuregs[cpu], reg); 225 return _mpic_read(mpic->reg_type, &mpic->cpuregs[cpu], reg);
218} 226}
219 227
220static inline void _mpic_cpu_write(struct mpic *mpic, unsigned int reg, u32 value) 228static inline void _mpic_cpu_write(struct mpic *mpic, unsigned int reg, u32 value)
221{ 229{
222 unsigned int cpu = 0; 230 unsigned int cpu = mpic_processor_id(mpic);
223
224 if (mpic->flags & MPIC_PRIMARY)
225 cpu = hard_smp_processor_id();
226 231
227 _mpic_write(mpic->reg_type, &mpic->cpuregs[cpu], reg, value); 232 _mpic_write(mpic->reg_type, &mpic->cpuregs[cpu], reg, value);
228} 233}
@@ -1012,13 +1017,8 @@ static int mpic_host_map(struct irq_host *h, unsigned int virq,
1012 * is done here. 1017 * is done here.
1013 */ 1018 */
1014 if (!mpic_is_ipi(mpic, hw) && (mpic->flags & MPIC_NO_RESET)) { 1019 if (!mpic_is_ipi(mpic, hw) && (mpic->flags & MPIC_NO_RESET)) {
1015 unsigned int cpu = 0;
1016
1017 if (mpic->flags & MPIC_PRIMARY)
1018 cpu = hard_smp_processor_id();
1019
1020 mpic_set_vector(virq, hw); 1020 mpic_set_vector(virq, hw);
1021 mpic_set_destination(virq, cpu); 1021 mpic_set_destination(virq, mpic_processor_id(mpic));
1022 mpic_irq_set_priority(virq, 8); 1022 mpic_irq_set_priority(virq, 8);
1023 } 1023 }
1024 1024
@@ -1362,10 +1362,7 @@ void __init mpic_init(struct mpic *mpic)
1362 1362
1363 mpic_pasemi_msi_init(mpic); 1363 mpic_pasemi_msi_init(mpic);
1364 1364
1365 if (mpic->flags & MPIC_PRIMARY) 1365 cpu = mpic_processor_id(mpic);
1366 cpu = hard_smp_processor_id();
1367 else
1368 cpu = 0;
1369 1366
1370 if (!(mpic->flags & MPIC_NO_RESET)) { 1367 if (!(mpic->flags & MPIC_NO_RESET)) {
1371 for (i = 0; i < mpic->num_sources; i++) { 1368 for (i = 0; i < mpic->num_sources; i++) {