aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/amd64/amd64/machdep.c2
-rw-r--r--sys/firmware/acpi/acpi_madt.c13
-rw-r--r--sys/include/firmware/acpi/acpi.h1
3 files changed, 11 insertions, 5 deletions
diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c
index 1194b63..07f16fc 100644
--- a/sys/arch/amd64/amd64/machdep.c
+++ b/sys/arch/amd64/amd64/machdep.c
@@ -41,6 +41,7 @@
#include <vm/vm.h>
#include <vm/physseg.h>
#include <firmware/acpi/acpi.h>
+#include <sys/syslog.h>
__MODULE_NAME("machdep");
__KERNEL_META("$Hyra$: machdep.c, Ian Marco Moffett, "
@@ -135,6 +136,7 @@ processor_init(void)
ioapic_init();
}
+ cur_cpu->lapic_base = acpi_get_lapic_base();
CPU_INFO_UNLOCK(cur_cpu);
lapic_init(); /* Per core */
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;
diff --git a/sys/include/firmware/acpi/acpi.h b/sys/include/firmware/acpi/acpi.h
index b3416f4..66a955f 100644
--- a/sys/include/firmware/acpi/acpi.h
+++ b/sys/include/firmware/acpi/acpi.h
@@ -41,5 +41,6 @@ bool acpi_is_checksum_valid(struct acpi_header *hdr);
struct acpi_root_sdt *acpi_get_root_sdt(void);
size_t acpi_get_root_sdt_len(void);
void acpi_parse_madt(struct cpu_info *ci);
+void *acpi_get_lapic_base(void);
#endif /* !_ACPI_ACPI_H_ */