From: Jeff Fan Date: Fri, 26 May 2017 11:50:43 +0000 (+0800) Subject: UefiCpuPkg/MpInitLib: Force to enable X2APIC if CPU number > 255 X-Git-Tag: edk2-stable201903~3985 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=71d8226ac6f256d360626c8072337f9373f95671 UefiCpuPkg/MpInitLib: Force to enable X2APIC if CPU number > 255 Cc: Michael D Kinney Cc: Eric Dong Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan Reviewed-by: Eric Dong --- diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c index c6f81914d2..df19b43bc0 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c @@ -451,6 +451,12 @@ CollectProcessorCount ( CpuPause (); } + if (CpuMpData->CpuCount > 255) { + // + // If there are more than 255 processor found, force to enable X2APIC + // + CpuMpData->X2ApicEnable = TRUE; + } if (CpuMpData->X2ApicEnable) { DEBUG ((DEBUG_INFO, "Force x2APIC mode!\n")); // @@ -1412,7 +1418,7 @@ MpInitLibInitialize ( CpuInfoInHob = (CPU_INFO_IN_HOB *) (UINTN) CpuMpData->CpuInfoInHob; for (Index = 0; Index < CpuMpData->CpuCount; Index++) { InitializeSpinLock(&CpuMpData->CpuData[Index].ApLock); - if (CpuInfoInHob[Index].InitialApicId >= 255) { + if (CpuInfoInHob[Index].InitialApicId >= 255 || Index > 254) { CpuMpData->X2ApicEnable = TRUE; } CpuMpData->CpuData[Index].CpuHealthy = (CpuInfoInHob[Index].Health == 0)? TRUE:FALSE;