diff options
author | Richard Braun <rbraun@sceen.net> | 2017-05-28 20:03:35 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2017-05-28 20:03:35 +0200 |
commit | 3bdbab08f6d21f71a69ad3ba317b27ed816ccd9b (patch) | |
tree | ea6a563008bd7166a7e5a24b3d13ec6dd6ce6569 /arch/x86/machine/lapic.c | |
parent | 16fd990520cd3ff7f12dd5c37ca8d1f64999ba0c (diff) |
x86/lapic: fix initialization on BSP
Diffstat (limited to 'arch/x86/machine/lapic.c')
-rw-r--r-- | arch/x86/machine/lapic.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/x86/machine/lapic.c b/arch/x86/machine/lapic.c index 444e661..6bd1d72 100644 --- a/arch/x86/machine/lapic.c +++ b/arch/x86/machine/lapic.c @@ -200,10 +200,11 @@ lapic_write(volatile struct lapic_register *r, uint32_t value) } static void __init -lapic_setup_timer(void) +lapic_compute_freq(void) { uint32_t c1, c2; + lapic_write(&lapic_map->svr, LAPIC_SVR_SOFT_EN | TRAP_LAPIC_SPURIOUS); lapic_write(&lapic_map->timer_dcr, LAPIC_TIMER_DCR_DIV1); /* The APIC timer counter should never wrap around here */ @@ -215,6 +216,7 @@ lapic_setup_timer(void) printf("lapic: bus frequency: %u.%02u MHz\n", lapic_bus_freq / 1000000, lapic_bus_freq % 1000000); lapic_write(&lapic_map->timer_icr, lapic_bus_freq / HZ); + lapic_write(&lapic_map->svr, 0); } void @@ -228,6 +230,7 @@ lapic_setup_registers(void) { /* * LVT mask bits can only be cleared when the local APIC is enabled. + * They are kept disabled while the local APIC is disabled. */ lapic_write(&lapic_map->svr, LAPIC_SVR_SOFT_EN | TRAP_LAPIC_SPURIOUS); lapic_write(&lapic_map->tpr, 0); @@ -273,8 +276,8 @@ lapic_setup(uint32_t map_addr) panic("lapic: external local APIC not supported"); } + lapic_compute_freq(); lapic_setup_registers(); - lapic_setup_timer(); lapic_initialized = true; } |