X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=UefiCpuPkg%2FCpuMpPei%2FCpuMpPei.c;h=8ed52436c98ff8a3ea5fd19fdd71539606cbcf4e;hp=8e35f288fe3c64fd235a84658a851671f6317029;hb=2f0261b7dcab49b1ee503a4b545238b59f58123d;hpb=944f45ae2f7ecbff2c66622d15d52ffbc3455bfb diff --git a/UefiCpuPkg/CpuMpPei/CpuMpPei.c b/UefiCpuPkg/CpuMpPei/CpuMpPei.c index 8e35f288fe..8ed52436c9 100644 --- a/UefiCpuPkg/CpuMpPei/CpuMpPei.c +++ b/UefiCpuPkg/CpuMpPei/CpuMpPei.c @@ -146,11 +146,20 @@ ApCFunction ( PeiCpuMpData = ExchangeInfo->PeiCpuMpData; if (PeiCpuMpData->InitFlag) { // - // This is first time AP wakeup, get BIST inforamtion from AP stack + // This is first time AP wakeup, get BIST information from AP stack // BistData = *(UINTN *) (PeiCpuMpData->Buffer + NumApsExecuting * PeiCpuMpData->CpuApStackSize - sizeof (UINTN)); - PeiCpuMpData->CpuData[NumApsExecuting].ApicId = GetInitialApicId (); PeiCpuMpData->CpuData[NumApsExecuting].Health.Uint32 = (UINT32) BistData; + PeiCpuMpData->CpuData[NumApsExecuting].ApicId = GetInitialApicId (); + if (PeiCpuMpData->CpuData[NumApsExecuting].ApicId >= 0xFF) { + // + // Set x2APIC mode if there are any logical processor reporting + // an APIC ID of 255 or greater. + // + AcquireSpinLock(&PeiCpuMpData->MpLock); + PeiCpuMpData->X2ApicEnable = TRUE; + ReleaseSpinLock(&PeiCpuMpData->MpLock); + } // // Sync BSP's Mtrr table to all wakeup APs and load microcode on APs. // @@ -363,15 +372,16 @@ CountProcessorNumber ( // if (PcdGet32 (PcdCpuMaxLogicalProcessorNumber) > 1) { // - // Send broadcast IPI to APs to wakeup APs + // Send 1st broadcast IPI to APs to wakeup APs // - PeiCpuMpData->InitFlag = 1; + PeiCpuMpData->InitFlag = TRUE; + PeiCpuMpData->X2ApicEnable = FALSE; WakeUpAP (PeiCpuMpData, TRUE, 0, NULL, NULL); // // Wait for AP task to complete and then exit. // MicroSecondDelay (PcdGet32 (PcdCpuApInitTimeOutInMicroSeconds)); - PeiCpuMpData->InitFlag = 0; + PeiCpuMpData->InitFlag = FALSE; PeiCpuMpData->CpuCount += (UINT32)PeiCpuMpData->MpCpuExchangeInfo->NumApsExecuting; ASSERT (PeiCpuMpData->CpuCount <= PcdGet32 (PcdCpuMaxLogicalProcessorNumber)); // @@ -439,6 +449,7 @@ PrepareAPStartupVector ( PeiCpuMpData->CpuData[0].ApicId = GetInitialApicId (); PeiCpuMpData->CpuData[0].Health.Uint32 = 0; PeiCpuMpData->EndOfPeiFlag = FALSE; + InitializeSpinLock(&PeiCpuMpData->MpLock); CopyMem (&PeiCpuMpData->AddressMap, &AddressMap, sizeof (MP_ASSEMBLY_ADDRESS_MAP)); //