From 54a4ca27230ae85bf75804d5d581ebf68e620cee Mon Sep 17 00:00:00 2001 From: Luca Dariz Date: Sun, 21 May 2023 22:49:18 +0200 Subject: x86_64: fix APIC initialization * i386/i386at/acpi_parse_apic.c: use vm_offset_t instead of uint32_t for vm addresses * x86_64/Makefrag.am: support --enable-apic Message-Id: <20230521204918.492957-1-luca@orpolo.org> --- i386/i386at/acpi_parse_apic.c | 8 ++++---- x86_64/Makefrag.am | 17 ++++++++++++++--- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/i386/i386at/acpi_parse_apic.c b/i386/i386at/acpi_parse_apic.c index 2680d0aa..27e3410d 100644 --- a/i386/i386at/acpi_parse_apic.c +++ b/i386/i386at/acpi_parse_apic.c @@ -370,20 +370,20 @@ static int acpi_apic_parse_table(struct acpi_apic *apic) { struct acpi_apic_dhdr *apic_entry = NULL; - uint32_t end = 0; + vm_offset_t end = 0; uint8_t numcpus = 1; /* Get the address of first APIC entry */ apic_entry = (struct acpi_apic_dhdr*) apic->entry; /* Get the end address of APIC table */ - end = (uint32_t) apic + apic->header.length; + end = (vm_offset_t) apic + apic->header.length; /* Initialize number of cpus */ numcpus = apic_get_numcpus(); /* Search in APIC entry. */ - while ((uint32_t)apic_entry < end) { + while ((vm_offset_t)apic_entry < end) { struct acpi_apic_lapic *lapic_entry; struct acpi_apic_ioapic *ioapic_entry; struct acpi_apic_irq_override *irq_override_entry; @@ -421,7 +421,7 @@ acpi_apic_parse_table(struct acpi_apic *apic) } /* Get next APIC entry. */ - apic_entry = (struct acpi_apic_dhdr*)((uint32_t) apic_entry + apic_entry = (struct acpi_apic_dhdr*)((vm_offset_t) apic_entry + apic_entry->length); /* Update number of cpus. */ diff --git a/x86_64/Makefrag.am b/x86_64/Makefrag.am index 7de56f9e..7e0ef25b 100644 --- a/x86_64/Makefrag.am +++ b/x86_64/Makefrag.am @@ -28,6 +28,8 @@ if HOST_x86_64 # libkernel_a_SOURCES += \ + i386/i386at/acpi_parse_apic.h \ + i386/i386at/acpi_parse_apic.c \ i386/i386at/autoconf.c \ i386/i386at/autoconf.h \ i386/i386at/biosmem.c \ @@ -65,7 +67,6 @@ libkernel_a_SOURCES += \ i386/i386at/kdsoft.h \ i386/i386at/mem.c \ i386/i386at/mem.h \ - i386/i386at/pic_isa.c \ i386/i386at/rtc.c \ i386/i386at/rtc.h endif @@ -95,15 +96,25 @@ libkernel_a_SOURCES += \ if PLATFORM_at libkernel_a_SOURCES += \ + i386/i386/apic.h \ + i386/i386/apic.c \ i386/i386/hardclock.c \ i386/i386/hardclock.h \ i386/i386/irq.c \ i386/i386/irq.h \ i386/i386/msr.h \ - i386/i386/pic.c \ - i386/i386/pic.h \ i386/i386/pit.c \ i386/i386/pit.h + +if enable_apic +libkernel_a_SOURCES += \ + i386/i386at/ioapic.c +else +libkernel_a_SOURCES += \ + i386/i386/pic.c \ + i386/i386/pic.h \ + i386/i386at/pic_isa.c +endif endif # -- cgit v1.2.3