UefiCpuPkg/PiSmmCpuDxe: use MpService2Ppi to wakeup AP in s3
Use MpService2Ppi to wakeup AP in s3 boot flow during initializing CPU. If mSmmS3ResumeState->MpService2Ppi is not 0, then BSP will use MpService2Ppi->StartupAllCPUs to do CPU initialization for both BSP and AP instead of only sending InitSipiSipi for AP. Signed-off-by: Dun Tan <dun.tan@intel.com> Cc: Eric Dong <eric.dong@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Cc: Rahul Kumar <rahul1.kumar@intel.com>
This commit is contained in:
parent
cf82c09bac
commit
2ce5ae43c2
|
@ -7,6 +7,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include "PiSmmCpuDxeSmm.h"
|
#include "PiSmmCpuDxeSmm.h"
|
||||||
|
#include <PiPei.h>
|
||||||
|
#include <Ppi/MpServices2.h>
|
||||||
|
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -594,6 +596,8 @@ InitializeCpuAfterRebase (
|
||||||
UINT8 Stack[128];
|
UINT8 Stack[128];
|
||||||
|
|
||||||
SetRegister (FALSE);
|
SetRegister (FALSE);
|
||||||
|
|
||||||
|
if (mSmmS3ResumeState->MpService2Ppi == 0) {
|
||||||
if (IsBsp) {
|
if (IsBsp) {
|
||||||
while (mNumberToFinish > 0) {
|
while (mNumberToFinish > 0) {
|
||||||
CpuPause ();
|
CpuPause ();
|
||||||
|
@ -608,6 +612,7 @@ InitializeCpuAfterRebase (
|
||||||
TransferApToSafeState ((UINTN)mApHltLoopCode, TopOfStack, (UINTN)&mNumberToFinish);
|
TransferApToSafeState ((UINTN)mApHltLoopCode, TopOfStack, (UINTN)&mNumberToFinish);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Cpu initialization procedure.
|
Cpu initialization procedure.
|
||||||
|
@ -788,6 +793,7 @@ SmmRestoreCpu (
|
||||||
IA32_DESCRIPTOR X64Idtr;
|
IA32_DESCRIPTOR X64Idtr;
|
||||||
IA32_IDT_GATE_DESCRIPTOR IdtEntryTable[EXCEPTION_VECTOR_NUMBER];
|
IA32_IDT_GATE_DESCRIPTOR IdtEntryTable[EXCEPTION_VECTOR_NUMBER];
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
EDKII_PEI_MP_SERVICES2_PPI *Mp2ServicePpi;
|
||||||
|
|
||||||
DEBUG ((DEBUG_INFO, "SmmRestoreCpu()\n"));
|
DEBUG ((DEBUG_INFO, "SmmRestoreCpu()\n"));
|
||||||
|
|
||||||
|
@ -852,14 +858,20 @@ SmmRestoreCpu (
|
||||||
//
|
//
|
||||||
mInitApsAfterSmmBaseReloc = FALSE;
|
mInitApsAfterSmmBaseReloc = FALSE;
|
||||||
|
|
||||||
|
if (mSmmS3ResumeState->MpService2Ppi != 0) {
|
||||||
|
Mp2ServicePpi = (EDKII_PEI_MP_SERVICES2_PPI *)(UINTN)mSmmS3ResumeState->MpService2Ppi;
|
||||||
|
Mp2ServicePpi->StartupAllCPUs (Mp2ServicePpi, InitializeCpuProcedure, 0, NULL);
|
||||||
|
} else {
|
||||||
PrepareApStartupVector (mAcpiCpuData.StartupVector);
|
PrepareApStartupVector (mAcpiCpuData.StartupVector);
|
||||||
//
|
//
|
||||||
// Send INIT IPI - SIPI to all APs
|
// Send INIT IPI - SIPI to all APs
|
||||||
//
|
//
|
||||||
SendInitSipiSipiAllExcludingSelf ((UINT32)mAcpiCpuData.StartupVector);
|
SendInitSipiSipiAllExcludingSelf ((UINT32)mAcpiCpuData.StartupVector);
|
||||||
}
|
|
||||||
|
|
||||||
InitializeCpuProcedure (NULL);
|
InitializeCpuProcedure (NULL);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
InitializeCpuProcedure (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set a flag to restore SMM configuration in S3 path.
|
// Set a flag to restore SMM configuration in S3 path.
|
||||||
|
|
Loading…
Reference in New Issue