bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] x86_64: fix APIC initialization


From: Luca Dariz
Subject: [PATCH] x86_64: fix APIC initialization
Date: Sun, 21 May 2023 22:49:18 +0200

* i386/i386at/acpi_parse_apic.c: use vm_offset_t instead of uint32_t
  for vm addresses
* x86_64/Makefrag.am: support --enable-apic
---
 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 9bad6b7a..9f636a08 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
 
 #
-- 
2.30.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]