summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEtienne Brateau <etienne.brateau@gmail.com>2022-09-24 18:31:45 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2022-09-26 00:15:38 +0200
commite45542fbd6cbc0a815b0808f16cf4a8e87410f64 (patch)
tree0ecf79ee4a7fd4e1a6c03bed46f4034aaed7314d
parent44f67d31ec1e178388dd85e549b9761050713d4b (diff)
Fix when enabling APIC without SMP
When we want to enable APIC, we must initialize the structure or otherwise, it will try to access to a not initialized memory addresses. Message-Id: <20220924163145.39894-1-etienne.brateau@gmail.com>
-rw-r--r--i386/i386/smp.c10
-rw-r--r--i386/i386at/model_dep.c10
2 files changed, 10 insertions, 10 deletions
diff --git a/i386/i386/smp.c b/i386/i386/smp.c
index f64fb7f7..d7523a73 100644
--- a/i386/i386/smp.c
+++ b/i386/i386/smp.c
@@ -20,7 +20,6 @@
#include <i386/i386/apic.h>
#include <i386/i386/smp.h>
-#include <i386/i386at/acpi_parse_apic.h>
#include <kern/smp.h>
@@ -42,12 +41,7 @@ static void smp_data_init(void)
*/
int smp_init(void)
{
- int apic_success;
+ smp_data_init();
- apic_success = acpi_apic_init();
- if (apic_success == ACPI_SUCCESS) {
- smp_data_init();
- }
-
- return apic_success;
+ return 0;
}
diff --git a/i386/i386at/model_dep.c b/i386/i386at/model_dep.c
index 105aedb2..1819526b 100644
--- a/i386/i386at/model_dep.c
+++ b/i386/i386at/model_dep.c
@@ -66,6 +66,7 @@
#include <i386/locore.h>
#include <i386/model_dep.h>
#include <i386/smp.h>
+#include <i386at/acpi_parse_apic.h>
#include <i386at/autoconf.h>
#include <i386at/biosmem.h>
#include <i386at/elf.h>
@@ -170,10 +171,14 @@ void machine_init(void)
hyp_init();
#else /* MACH_HYP */
-#if (NCPUS > 1) && defined(APIC)
- smp_init();
+#if defined(APIC)
+ if (acpi_apic_init() != ACPI_SUCCESS) {
+ panic("APIC not found, unable to boot");
+ }
ioapic_configure();
lapic_enable_timer();
+#if (NCPUS > 1)
+ smp_init();
#warning FIXME: Rather unmask them from their respective drivers
/* kd */
@@ -183,6 +188,7 @@ void machine_init(void)
/* com1 */
unmask_irq(3);
#endif /* NCPUS > 1 */
+#endif /* APIC */
#ifdef LINUX_DEV
/*