From 85768e6f5872e88fe72c6690d0393c34561942cb Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Mon, 18 Jul 2011 15:51:26 +0200 Subject: [PATCH] fix bug in APIC code => before we enable the interrupts, we map the APIC registers --- arch/x86/include/asm/apic.h | 1 + arch/x86/kernel/apic.c | 49 +++++++++++++++++++++++-------------- arch/x86/mm/page.c | 4 +++ 3 files changed, 35 insertions(+), 19 deletions(-) diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h index 689ff366..1bdc3aaf 100644 --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h @@ -197,6 +197,7 @@ int has_apic(void); int apic_is_enabled(void); int ioapic_inton(uint8_t irq, uint8_t apicid); int ioapic_intoff(uint8_t irq, uint8_t apicid); +int map_apic(void); #ifdef __cplusplus } diff --git a/arch/x86/kernel/apic.c b/arch/x86/kernel/apic.c index b486bd43..25309ee8 100644 --- a/arch/x86/kernel/apic.c +++ b/arch/x86/kernel/apic.c @@ -391,21 +391,9 @@ static int lapic_reset(void) return 0; } -/* - * detects the timer frequency of the APIC and restart - * the APIC timer with the correct period - */ -int apic_calibration(void) +int map_apic(void) { - uint8_t i; - uint32_t flags; -#ifndef CONFIG_ROCKCREEK - uint64_t ticks, old; - uint32_t diff; -#else - uint64_t start, end, ticks; - uint32_t diff; -#endif + uint32_t i; if (!has_apic()) return -ENXIO; @@ -423,11 +411,33 @@ int apic_calibration(void) // map all processor entries for(i=0; iid); // now lets turn everything else off - for(i=1; i<24; i++) + for(uint32_t i=1; i<24; i++) ioapic_intoff(i, apic_processors[boot_processor]->id); } +#endif return 0; } diff --git a/arch/x86/mm/page.c b/arch/x86/mm/page.c index 1378b660..50631b49 100644 --- a/arch/x86/mm/page.c +++ b/arch/x86/mm/page.c @@ -30,6 +30,7 @@ #include #include #include +#include #ifdef CONFIG_ROCKCREEK #include #include @@ -760,6 +761,9 @@ int arch_paging_init(void) */ register_task(per_core(current_task)); + // APIC registers into the kernel address space + map_apic(); + return 0; }