aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/mpparse.c
diff options
context:
space:
mode:
authorFeng Tang <feng.tang@intel.com>2010-11-18 22:33:35 -0500
committerThomas Gleixner <tglx@linutronix.de>2010-12-09 15:52:06 -0500
commit2d8009ba67f9503ceadf9d5a3b5637cee291ea8d (patch)
treeab3ca6aacc84b5fb0135909e788c5b65830cd75f /arch/x86/kernel/mpparse.c
parent60d79fd99ff3b9c692b260a4d53a203f537c052a (diff)
x86: Unify 3 similar ways of saving mp_irqs info
There are 3 places defining similar functions of saving IRQ vector info into mp_irqs[] array: mmparse/acpi/mrst. Replace the redundant code by a common function in io_apic.c as it's only called when CONFIG_X86_IO_APIC=y Signed-off-by: Feng Tang <feng.tang@intel.com> Cc: Alan Cox <alan@linux.intel.com> Cc: Len Brown <len.brown@intel.com> Cc: Yinghai Lu <yinghai@kernel.org> LKML-Reference: <20101207133204.4d913c5a@feng-i7> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/mpparse.c')
-rw-r--r--arch/x86/kernel/mpparse.c56
1 files changed, 3 insertions, 53 deletions
diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c
index 27ccb7075342..4318687b1c35 100644
--- a/arch/x86/kernel/mpparse.c
+++ b/arch/x86/kernel/mpparse.c
@@ -144,18 +144,6 @@ static void __init print_mp_irq_info(struct mpc_intsrc *mp_irq)
144 mp_irq->srcbusirq, mp_irq->dstapic, mp_irq->dstirq); 144 mp_irq->srcbusirq, mp_irq->dstapic, mp_irq->dstirq);
145} 145}
146 146
147static void __init assign_to_mp_irq(struct mpc_intsrc *m,
148 struct mpc_intsrc *mp_irq)
149{
150 mp_irq->dstapic = m->dstapic;
151 mp_irq->type = m->type;
152 mp_irq->irqtype = m->irqtype;
153 mp_irq->irqflag = m->irqflag;
154 mp_irq->srcbus = m->srcbus;
155 mp_irq->srcbusirq = m->srcbusirq;
156 mp_irq->dstirq = m->dstirq;
157}
158
159static void __init assign_to_mpc_intsrc(struct mpc_intsrc *mp_irq, 147static void __init assign_to_mpc_intsrc(struct mpc_intsrc *mp_irq,
160 struct mpc_intsrc *m) 148 struct mpc_intsrc *m)
161{ 149{
@@ -167,47 +155,9 @@ static void __init assign_to_mpc_intsrc(struct mpc_intsrc *mp_irq,
167 m->srcbusirq = mp_irq->srcbusirq; 155 m->srcbusirq = mp_irq->srcbusirq;
168 m->dstirq = mp_irq->dstirq; 156 m->dstirq = mp_irq->dstirq;
169} 157}
170
171static int __init mp_irq_mpc_intsrc_cmp(struct mpc_intsrc *mp_irq,
172 struct mpc_intsrc *m)
173{
174 if (mp_irq->dstapic != m->dstapic)
175 return 1;
176 if (mp_irq->type != m->type)
177 return 2;
178 if (mp_irq->irqtype != m->irqtype)
179 return 3;
180 if (mp_irq->irqflag != m->irqflag)
181 return 4;
182 if (mp_irq->srcbus != m->srcbus)
183 return 5;
184 if (mp_irq->srcbusirq != m->srcbusirq)
185 return 6;
186 if (mp_irq->dstirq != m->dstirq)
187 return 7;
188
189 return 0;
190}
191
192static void __init MP_intsrc_info(struct mpc_intsrc *m)
193{
194 int i;
195
196 print_MP_intsrc_info(m);
197
198 for (i = 0; i < mp_irq_entries; i++) {
199 if (!mp_irq_mpc_intsrc_cmp(&mp_irqs[i], m))
200 return;
201 }
202
203 assign_to_mp_irq(m, &mp_irqs[mp_irq_entries]);
204 if (++mp_irq_entries == MAX_IRQ_SOURCES)
205 panic("Max # of irq sources exceeded!!\n");
206}
207#else /* CONFIG_X86_IO_APIC */ 158#else /* CONFIG_X86_IO_APIC */
208static inline void __init MP_bus_info(struct mpc_bus *m) {} 159static inline void __init MP_bus_info(struct mpc_bus *m) {}
209static inline void __init MP_ioapic_info(struct mpc_ioapic *m) {} 160static inline void __init MP_ioapic_info(struct mpc_ioapic *m) {}
210static inline void __init MP_intsrc_info(struct mpc_intsrc *m) {}
211#endif /* CONFIG_X86_IO_APIC */ 161#endif /* CONFIG_X86_IO_APIC */
212 162
213 163
@@ -321,7 +271,7 @@ static int __init smp_read_mpc(struct mpc_table *mpc, unsigned early)
321 skip_entry(&mpt, &count, sizeof(struct mpc_ioapic)); 271 skip_entry(&mpt, &count, sizeof(struct mpc_ioapic));
322 break; 272 break;
323 case MP_INTSRC: 273 case MP_INTSRC:
324 MP_intsrc_info((struct mpc_intsrc *)mpt); 274 mp_save_irq((struct mpc_intsrc *)mpt);
325 skip_entry(&mpt, &count, sizeof(struct mpc_intsrc)); 275 skip_entry(&mpt, &count, sizeof(struct mpc_intsrc));
326 break; 276 break;
327 case MP_LINTSRC: 277 case MP_LINTSRC:
@@ -413,13 +363,13 @@ static void __init construct_default_ioirq_mptable(int mpc_default_type)
413 363
414 intsrc.srcbusirq = i; 364 intsrc.srcbusirq = i;
415 intsrc.dstirq = i ? i : 2; /* IRQ0 to INTIN2 */ 365 intsrc.dstirq = i ? i : 2; /* IRQ0 to INTIN2 */
416 MP_intsrc_info(&intsrc); 366 mp_save_irq(&intsrc);
417 } 367 }
418 368
419 intsrc.irqtype = mp_ExtINT; 369 intsrc.irqtype = mp_ExtINT;
420 intsrc.srcbusirq = 0; 370 intsrc.srcbusirq = 0;
421 intsrc.dstirq = 0; /* 8259A to INTIN0 */ 371 intsrc.dstirq = 0; /* 8259A to INTIN0 */
422 MP_intsrc_info(&intsrc); 372 mp_save_irq(&intsrc);
423} 373}
424 374
425 375