X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FCore%2FPiSmmCore%2FPage.c;fp=MdeModulePkg%2FCore%2FPiSmmCore%2FPage.c;h=781707e2443bd55983ee3429421e7f5305797d24;hp=ec4dd4fcb8ef409c984ae26e3f502ea007326454;hb=3df4b6e7e96f671a0fc045119e44130936666030;hpb=3c5963cf299e0abd4c2ce7156b171fa66546dc85 diff --git a/MdeModulePkg/Core/PiSmmCore/Page.c b/MdeModulePkg/Core/PiSmmCore/Page.c index ec4dd4fcb8..781707e244 100644 --- a/MdeModulePkg/Core/PiSmmCore/Page.c +++ b/MdeModulePkg/Core/PiSmmCore/Page.c @@ -312,6 +312,16 @@ SmmAddMemoryRegion ( { UINTN AlignedMemBase; + // + // Do not add memory regions that is already allocated, needs testing, or needs ECC initialization + // + if ((Attributes & (EFI_ALLOCATED | EFI_NEEDS_TESTING | EFI_NEEDS_ECC_INITIALIZATION)) != 0) { + return; + } + + // + // Align range on an EFI_PAGE_SIZE boundary + // AlignedMemBase = (UINTN)(MemBase + EFI_PAGE_MASK) & ~EFI_PAGE_MASK; MemLength -= AlignedMemBase - MemBase; SmmFreePages (AlignedMemBase, TRUNCATE_TO_PAGES ((UINTN)MemLength));