diff options
author | Ian Moffett <ian@osmora.org> | 2024-02-11 23:40:21 -0500 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2024-02-11 23:40:21 -0500 |
commit | 8ee6f7a06ce2d569805edd35a1ac79c2511b2a27 (patch) | |
tree | b3318811da7ab7a0c5204f20d68920b5f50502ee /sys/firmware/acpi/acpi_madt.c | |
parent | 3ac9a53caabcb8b9f43b5e1638968c027c2c79d6 (diff) |
kernel/amd64: acpi: Fetch LAPIC base separate
This commit creates a acpi_get_lapic_base() so we don't have to
parse the MADT each time we want the Local APIC base.
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/firmware/acpi/acpi_madt.c')
-rw-r--r-- | sys/firmware/acpi/acpi_madt.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/firmware/acpi/acpi_madt.c b/sys/firmware/acpi/acpi_madt.c index 5f5d8d4..055ebd2 100644 --- a/sys/firmware/acpi/acpi_madt.c +++ b/sys/firmware/acpi/acpi_madt.c @@ -46,6 +46,14 @@ __KERNEL_META("$Hyra$: acpi_madt.c, Ian Marco Moffett, " static struct acpi_madt *madt = NULL; +void * +acpi_get_lapic_base(void) +{ + if (madt == NULL) + return NULL; + return (void *)(uint64_t)madt->lapic_addr; +} + static void do_parse(struct cpu_info *ci) { @@ -53,7 +61,6 @@ do_parse(struct cpu_info *ci) uint8_t *end = NULL; void *ioapic_mmio_base = NULL; - void *lapic_mmio_base = NULL; struct apic_header *hdr = NULL; struct ioapic *ioapic = NULL; @@ -61,10 +68,6 @@ do_parse(struct cpu_info *ci) cur = (uint8_t *)(madt + 1); end = (uint8_t *)madt + madt->hdr.length; - /* Init the Local APIC */ - lapic_mmio_base = (void *)(uintptr_t)madt->lapic_addr; - ci->lapic_base = lapic_mmio_base; - /* Parse the rest of the MADT */ while (cur < end) { hdr = (void *)cur; |