Cc: Feng Tian <[email protected]>
Cc: Michael Kinney <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <[email protected]>
---
 UefiCpuPkg/CpuMpPei/CpuMpPei.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/UefiCpuPkg/CpuMpPei/CpuMpPei.c b/UefiCpuPkg/CpuMpPei/CpuMpPei.c
index 7bedf64..d058d14 100644
--- a/UefiCpuPkg/CpuMpPei/CpuMpPei.c
+++ b/UefiCpuPkg/CpuMpPei/CpuMpPei.c
@@ -228,13 +228,14 @@ ApCFunction (
 
   PeiCpuMpData = ExchangeInfo->PeiCpuMpData;
   if (PeiCpuMpData->InitFlag) {
+    ProcessorNumber = NumApsExecuting;
     //
     // This is first time AP wakeup, get BIST information from AP stack
     //
-    BistData = *(UINTN *) (PeiCpuMpData->Buffer + NumApsExecuting * 
PeiCpuMpData->CpuApStackSize - sizeof (UINTN));
-    PeiCpuMpData->CpuData[NumApsExecuting].Health.Uint32 = (UINT32) BistData;
-    PeiCpuMpData->CpuData[NumApsExecuting].ApicId = GetInitialApicId ();
-    if (PeiCpuMpData->CpuData[NumApsExecuting].ApicId >= 0xFF) {
+    BistData = *(UINTN *) (PeiCpuMpData->Buffer + ProcessorNumber * 
PeiCpuMpData->CpuApStackSize - sizeof (UINTN));
+    PeiCpuMpData->CpuData[ProcessorNumber].Health.Uint32 = (UINT32) BistData;
+    PeiCpuMpData->CpuData[ProcessorNumber].ApicId = GetInitialApicId ();
+    if (PeiCpuMpData->CpuData[ProcessorNumber].ApicId >= 0xFF) {
       //
       // Set x2APIC mode if there are any logical processor reporting
       // an APIC ID of 255 or greater.
@@ -248,6 +249,7 @@ ApCFunction (
     //
     MtrrSetAllMtrrs (&PeiCpuMpData->MtrrTable);
     MicrocodeDetect ();
+    PeiCpuMpData->CpuData[ProcessorNumber].State = CpuStateIdle;
   } else {
     //
     // Execute AP function if AP is not disabled
-- 
1.9.5.msysgit.0

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to