diff options
author | Richard Braun <rbraun@sceen.net> | 2017-05-26 22:39:31 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2017-05-26 22:40:01 +0200 |
commit | cab8846284996df401c5bdaa0088b224e076b510 (patch) | |
tree | 884c1dc40cbcf47e763da9c1c470aec73165c0a3 /arch/x86/machine/lapic.c | |
parent | 10f2d5f59a37532fb48cf9d6896efa238c9c6eb5 (diff) |
x86: use the new intr module
In particular, the pic and ioapic modules register their respective
devices as interrupt controllers. Selection between the legacy XT-PIC
and the modern APIC system is made on the availability of ACPI,
disregarding the multiprocessor specification entirely. The uart
driver is also updated to register devices interrupt handlers.
Diffstat (limited to 'arch/x86/machine/lapic.c')
-rw-r--r-- | arch/x86/machine/lapic.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/arch/x86/machine/lapic.c b/arch/x86/machine/lapic.c index a978da1..444e661 100644 --- a/arch/x86/machine/lapic.c +++ b/arch/x86/machine/lapic.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2014 Richard Braun. + * Copyright (c) 2011-2017 Richard Braun. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,10 +15,12 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include <stdbool.h> #include <stddef.h> #include <stdint.h> #include <stdio.h> +#include <kern/assert.h> #include <kern/init.h> #include <kern/macros.h> #include <kern/panic.h> @@ -182,6 +184,9 @@ static volatile struct lapic_map *lapic_map __read_mostly; */ static uint32_t lapic_bus_freq __read_mostly; +static bool lapic_initialized __initdata; +static bool lapic_is_unused __initdata; + static uint32_t lapic_read(const volatile struct lapic_register *r) { @@ -237,6 +242,20 @@ lapic_setup_registers(void) lapic_write(&lapic_map->timer_icr, lapic_bus_freq / HZ); } +bool __init +lapic_unused(void) +{ + assert(lapic_initialized); + return lapic_is_unused; +} + +void __init +lapic_setup_unused(void) +{ + lapic_initialized = true; + lapic_is_unused = true; +} + void __init lapic_setup(uint32_t map_addr) { @@ -256,6 +275,8 @@ lapic_setup(uint32_t map_addr) lapic_setup_registers(); lapic_setup_timer(); + + lapic_initialized = true; } void __init |