mirror of
https://github.com/memtest86plus/memtest86plus.git
synced 2024-11-30 11:03:48 -06:00
Check whether the BIOS has enabled x2APIC mode, and disable SMP if so.
This commit is contained in:
parent
29b8bbece8
commit
7dd17c26c0
@ -84,7 +84,9 @@ typedef union {
|
||||
uint32_t smx : 1;
|
||||
uint32_t eist : 1;
|
||||
uint32_t tm2 : 1;
|
||||
uint32_t : 23; // ECX feature flags, bit 31
|
||||
uint32_t : 12; // ECX feature flags, bit 20
|
||||
uint32_t x2apic : 1;
|
||||
uint32_t : 10; // ECX feature flags, bit 31
|
||||
uint32_t : 29; // EDX extended feature flags, bit 0
|
||||
uint32_t lm : 1;
|
||||
uint32_t : 2; // EDX extended feature flags, bit 31
|
||||
|
@ -4,7 +4,7 @@
|
||||
/*
|
||||
* Provides access to the CPU machine-specific registers.
|
||||
*
|
||||
* Copyright (C) 2020 Martin Whitaker.
|
||||
* Copyright (C) 2020-2022 Martin Whitaker.
|
||||
*/
|
||||
|
||||
#define MSR_PLATFORM_INFO 0xce
|
||||
@ -12,6 +12,7 @@
|
||||
#define MSR_EBC_FREQUENCY_ID 0x2c
|
||||
|
||||
#define MSR_IA32_PLATFORM_ID 0x17
|
||||
#define MSR_IA32_APIC_BASE 0x1b
|
||||
#define MSR_IA32_EBL_CR_POWERON 0x2a
|
||||
#define MSR_IA32_MCG_CTL 0x17b
|
||||
#define MSR_IA32_PERF_STATUS 0x198
|
||||
|
15
system/smp.c
15
system/smp.c
@ -21,6 +21,7 @@
|
||||
|
||||
#include "cpuid.h"
|
||||
#include "memsize.h"
|
||||
#include "msr.h"
|
||||
#include "pmem.h"
|
||||
#include "string.h"
|
||||
#include "unistd.h"
|
||||
@ -58,6 +59,11 @@
|
||||
#define APIC_DELMODE_STARTUP 6
|
||||
#define APIC_DELMODE_EXTINT 7
|
||||
|
||||
// IA32_APIC_BASE MSR bits
|
||||
|
||||
#define IA32_APIC_ENABLED (1 << 11)
|
||||
#define IA32_APIC_EXTENDED (1 << 10)
|
||||
|
||||
// Table signatures
|
||||
|
||||
#define FPSignature ('_' | ('M' << 8) | ('P' << 16) | ('_' << 24))
|
||||
@ -660,6 +666,15 @@ void smp_init(bool smp_enable)
|
||||
|
||||
num_available_cpus = 1;
|
||||
|
||||
if (cpuid_info.flags.x2apic) {
|
||||
uint32_t msrl, msrh;
|
||||
rdmsr(MSR_IA32_APIC_BASE, msrl, msrh);
|
||||
if ((msrl & IA32_APIC_ENABLED) && (msrl & IA32_APIC_EXTENDED)) {
|
||||
// We don't currently support x2APIC mode.
|
||||
smp_enable = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (smp_enable) {
|
||||
(void)(find_cpus_in_rsdp() || find_cpus_in_floating_mp_struct());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user