]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/PiSmmCore/Page.c
1. Update PiSmmCore to always invoke SmiManage (NULL, NULL, NULL, NULL) when SMI...
[mirror_edk2.git] / MdeModulePkg / Core / PiSmmCore / Page.c
index ec4dd4fcb8ef409c984ae26e3f502ea007326454..5b6e849a2d924b6ed4b036bfaaaea39588ba81ae 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   SMM Memory page management functions.\r
 \r
-  Copyright (c) 2009 - 2010, Intel Corporation.  All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials are licensed and made available \r
   under the terms and conditions of the BSD License which accompanies this \r
   distribution.  The full text of the license may be found at        \r
@@ -312,6 +312,16 @@ SmmAddMemoryRegion (
 {\r
   UINTN  AlignedMemBase;\r
 \r
+  //\r
+  // Do not add memory regions that is already allocated, needs testing, or needs ECC initialization\r
+  //\r
+  if ((Attributes & (EFI_ALLOCATED | EFI_NEEDS_TESTING | EFI_NEEDS_ECC_INITIALIZATION)) != 0) {\r
+    return;\r
+  }\r
+  \r
+  //\r
+  // Align range on an EFI_PAGE_SIZE boundary\r
+  //  \r
   AlignedMemBase = (UINTN)(MemBase + EFI_PAGE_MASK) & ~EFI_PAGE_MASK;\r
   MemLength -= AlignedMemBase - MemBase;\r
   SmmFreePages (AlignedMemBase, TRUNCATE_TO_PAGES ((UINTN)MemLength));\r