From e07242e3a1589742772732c4e739f78bdab20a00 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Tue, 19 Dec 2023 22:08:43 -0500 Subject: kernel/amd64: lapic: Fixup LAPIC state tracking This commit removes the lapic_set_base() function and certain globals from the Local APIC driver so it won't cause problems on hardware with many CPU sockets or that is just wacky. Signed-off-by: Ian Moffett --- sys/firmware/acpi/acpi_init.c | 1 - sys/firmware/acpi/acpi_madt.c | 9 +++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'sys/firmware') diff --git a/sys/firmware/acpi/acpi_init.c b/sys/firmware/acpi/acpi_init.c index 93a9cf4..4ba1928 100644 --- a/sys/firmware/acpi/acpi_init.c +++ b/sys/firmware/acpi/acpi_init.c @@ -107,7 +107,6 @@ acpi_init(void) panic("Root SDT has an invalid checksum!\n"); } root_sdt_entries = (root_sdt->hdr.length - sizeof(root_sdt->hdr)) / 4; - acpi_parse_madt(); #if defined(__x86_64__) /* Hyra requires HPET on x86_64 */ diff --git a/sys/firmware/acpi/acpi_madt.c b/sys/firmware/acpi/acpi_madt.c index 119a842..4f5ff10 100644 --- a/sys/firmware/acpi/acpi_madt.c +++ b/sys/firmware/acpi/acpi_madt.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -46,7 +47,7 @@ __KERNEL_META("$Hyra$: acpi_madt.c, Ian Marco Moffett, " static struct acpi_madt *madt = NULL; static void -do_parse(void) +do_parse(struct cpu_info *ci) { uint8_t *cur = NULL; uint8_t *end = NULL; @@ -62,7 +63,7 @@ do_parse(void) /* Init the Local APIC */ lapic_mmio_base = (void *)(uintptr_t)madt->lapic_addr; - lapic_set_base(lapic_mmio_base); + ci->lapic_base = lapic_mmio_base; /* Parse the rest of the MADT */ while (cur < end) { @@ -127,7 +128,7 @@ irq_to_gsi(uint8_t irq) } void -acpi_parse_madt(void) +acpi_parse_madt(struct cpu_info *ci) { /* Prevent this function from running twice */ if (madt != NULL) { @@ -139,5 +140,5 @@ acpi_parse_madt(void) panic("Failed to query for ACPI MADT\n"); } - do_parse(); + do_parse(ci); } -- cgit v1.2.3