Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chen Fan <chen.fan.f...@cn.fujitsu.com>
---
 UefiCpuPkg/CpuDxe/CpuMp.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/UefiCpuPkg/CpuDxe/CpuMp.c b/UefiCpuPkg/CpuDxe/CpuMp.c
index 96513e8..d657152 100644
--- a/UefiCpuPkg/CpuDxe/CpuMp.c
+++ b/UefiCpuPkg/CpuDxe/CpuMp.c
@@ -25,7 +25,7 @@ VOID *mCommonStack = 0;
 VOID *mTopOfApCommonStack = 0;
 VOID *mApStackStart = 0;
 
-BOOLEAN mAPsAlreadyInitFinished = FALSE;
+volatile BOOLEAN mAPsAlreadyInitFinished = FALSE;
 volatile BOOLEAN mStopCheckAllAPsStatus = TRUE;
 
 EFI_MP_SERVICES_PROTOCOL  mMpServicesTemplate = {
@@ -1135,11 +1135,15 @@ ProcessorToIdleState (
   EFI_AP_PROCEDURE      Procedure;
   VOID                  *ProcedureArgument;
 
+  AsmApDoneWithCommonStack ();
+
+  while (!mAPsAlreadyInitFinished) {
+    CpuPause ();
+  }
+
   WhoAmI (&mMpServicesTemplate, &ProcessorNumber);
   CpuData = &mMpSystemData.CpuDatas[ProcessorNumber];
 
-  AsmApDoneWithCommonStack ();
-
   //
   // Avoid forcibly reset AP caused the AP State is not updated.
   //
@@ -1486,6 +1490,11 @@ InitializeMpSupport (
     return;
   }
 
+  mMpSystemData.CpuDatas = ReallocatePool (
+                             sizeof (CPU_DATA_BLOCK) * 
gMaxLogicalProcessorNumber,
+                             sizeof (CPU_DATA_BLOCK) * 
mMpSystemData.NumberOfProcessors,
+                             mMpSystemData.CpuDatas);
+
   mAPsAlreadyInitFinished = TRUE;
 
   if (mMpSystemData.NumberOfProcessors < gMaxLogicalProcessorNumber) {
-- 
1.9.3


------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to