From fc13220238df2e35fbb0afa0c1647ea8807168e0 Mon Sep 17 00:00:00 2001 From: Ray Ni Date: Wed, 27 Aug 2025 08:45:13 +0800 Subject: [PATCH] MdeModulePkg/PeiCore: Accept MemoryDiscoveredPpi from SecCore PeiCore assumes that it runs initially from the temporary memory and switches to physical memory after PS::InstallPeiMemory() reports the physical memory range for PEI. This change enables PeiCore to run initially from the physical memory when MemoryDiscoveredPpi is passed from SEC. Signed-off-by: Ray Ni --- MdeModulePkg/Core/Pei/Ppi/Ppi.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/MdeModulePkg/Core/Pei/Ppi/Ppi.c b/MdeModulePkg/Core/Pei/Ppi/Ppi.c index ad77481b3b..e3a63cc12b 100644 --- a/MdeModulePkg/Core/Pei/Ppi/Ppi.c +++ b/MdeModulePkg/Core/Pei/Ppi/Ppi.c @@ -1038,6 +1038,7 @@ ProcessPpiListFromSec ( EFI_STATUS Status; EFI_SEC_HOB_DATA_PPI *SecHobDataPpi; EFI_HOB_GENERIC_HEADER *SecHobList; + PEI_CORE_INSTANCE *PrivateData; for ( ; ;) { if ((PpiList->Flags & EFI_PEI_PPI_DESCRIPTOR_NOTIFY_TYPES) != 0) { @@ -1052,6 +1053,15 @@ ProcessPpiListFromSec ( // Status = InternalPeiInstallPpi (PeiServices, PpiList, TRUE); ASSERT_EFI_ERROR (Status); + + // + // Set the PeiMemoryInstalled flag if SEC passed MemoryDiscoveredPpi, so the PEI runs in + // physical memory. + // + if (CompareGuid (PpiList->Guid, &gEfiPeiMemoryDiscoveredPpiGuid)) { + PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices); + PrivateData->PeiMemoryInstalled = TRUE; + } } if ((PpiList->Flags & EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) == EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) {