From 3f0a9fe06c7a85adbcdb1d4273ccf3c324bd98e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Date: Thu, 10 Aug 2017 17:46:57 +0000 Subject: [PATCH] mptable: fix i386 build failure Reported by: emaste X-MFC-with: r322347 --- sys/x86/acpica/madt.c | 7 ++++++- sys/x86/x86/mptable.c | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/sys/x86/acpica/madt.c b/sys/x86/acpica/madt.c index dfb944c9abbc..136e5475006f 100644 --- a/sys/x86/acpica/madt.c +++ b/sys/x86/acpica/madt.c @@ -325,12 +325,17 @@ static void madt_parse_cpu(unsigned int apic_id, unsigned int flags) { - if (!(flags & ACPI_MADT_ENABLED) || mp_ncpus == MAXCPU || + if (!(flags & ACPI_MADT_ENABLED) || +#ifdef SMP + mp_ncpus == MAXCPU || +#endif apic_id > MAX_APIC_ID) return; +#ifdef SMP mp_ncpus++; mp_maxid = mp_ncpus - 1; +#endif max_apic_id = max(apic_id, max_apic_id); } diff --git a/sys/x86/x86/mptable.c b/sys/x86/x86/mptable.c index 2c589049563d..2734607fed21 100644 --- a/sys/x86/x86/mptable.c +++ b/sys/x86/x86/mptable.c @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef NEW_PCIB #include #endif @@ -330,8 +331,10 @@ mptable_probe_cpus(void) /* Is this a pre-defined config? */ if (mpfps->config_type != 0) { +#ifdef SMP mp_ncpus = 2; mp_maxid = 1; +#endif max_apic_id = 1; } else { mptable_walk_table(mptable_probe_cpus_handler, &cpu_mask); @@ -346,6 +349,7 @@ static int mptable_setup_local(void) { vm_paddr_t addr; + u_int cpu_mask; /* Is this a pre-defined config? */ printf("MPTable: <"); @@ -478,8 +482,10 @@ mptable_probe_cpus_handler(u_char *entry, void *arg) proc = (proc_entry_ptr)entry; if (proc->cpu_flags & PROCENTRY_FLAG_EN && proc->apic_id < MAX_LAPIC_ID && mp_ncpus < MAXCPU) { +#ifdef SMP mp_ncpus++; mp_maxid = mp_ncpus - 1; +#endif max_apic_id = max(max_apic_id, proc->apic_id); } break;