/** @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
{\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