From cf7f9685fa560e8c2d58eaf9699aae8f5763c4e7 Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Fri, 20 Jun 2008 01:35:07 +0100 Subject: [PATCH] --- yaml --- r: 99348 b: refs/heads/master c: 7f0dbbc08d80df7ea15d8da4f0d78255891c8812 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/arch/x86/kernel/io_apic_64.c | 28 ++++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 0dc53deb27ba..7ab6ff2ed913 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: cd08d0754ecb0cb9293c8476cb33ded1d23d0d8f +refs/heads/master: 7f0dbbc08d80df7ea15d8da4f0d78255891c8812 diff --git a/trunk/arch/x86/kernel/io_apic_64.c b/trunk/arch/x86/kernel/io_apic_64.c index f06f5b4fb35f..40aa041b2987 100644 --- a/trunk/arch/x86/kernel/io_apic_64.c +++ b/trunk/arch/x86/kernel/io_apic_64.c @@ -360,6 +360,26 @@ static void add_pin_to_irq(unsigned int irq, int apic, int pin) entry->pin = pin; } +/* + * Reroute an IRQ to a different pin. + */ +static void __init replace_pin_at_irq(unsigned int irq, + int oldapic, int oldpin, + int newapic, int newpin) +{ + struct irq_pin_list *entry = irq_2_pin + irq; + + while (1) { + if (entry->apic == oldapic && entry->pin == oldpin) { + entry->apic = newapic; + entry->pin = newpin; + } + if (!entry->next) + break; + entry = irq_2_pin + entry->next; + } +} + #define DO_ACTION(name,R,ACTION, FINAL) \ \ @@ -1680,6 +1700,11 @@ static inline void __init check_timer(void) apic2 = apic1; } + replace_pin_at_irq(0, 0, 0, apic1, pin1); + apic1 = 0; + pin1 = 0; + setup_timer_IRQ0_pin(apic1, pin1, cfg->vector); + if (pin1 != -1) { /* * Ok, does IRQ0 through the IOAPIC work? @@ -1712,10 +1737,9 @@ static inline void __init check_timer(void) /* * legacy devices should be connected to IO APIC #0 */ - /* replace_pin_at_irq(0, apic1, pin1, apic2, pin2); */ + replace_pin_at_irq(0, apic1, pin1, apic2, pin2); setup_timer_IRQ0_pin(apic2, pin2, cfg->vector); unmask_IO_APIC_irq(0); - clear_IO_APIC_pin(apic2, pin2); enable_8259A_irq(0); if (timer_irq_works()) { apic_printk(APIC_VERBOSE," works.\n");