MdeModulePkg/PiSmmCore: switch to MdePkg allocation granularity macros
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Fri, 3 Mar 2017 15:11:33 +0000 (15:11 +0000)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 6 Mar 2017 10:29:25 +0000 (11:29 +0100)
Remove the local definitions for the default and runtime page allocation
granularity macros, and switch to the new MdePkg versions.

Note that this replaces a reference to the 'default' version with the
more correct 'runtime' version, but this matters little in practice.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c
MdeModulePkg/Core/PiSmmCore/Page.c
MdeModulePkg/Core/PiSmmCore/PiSmmCore.h

index 6cfd35945ab147aa981e1ca988acdbd7f4147d65..e3c505ef18abf9b31f1f1f1b4019225525f71076 100644 (file)
@@ -795,7 +795,7 @@ SetMemoryAttributesTableSectionAlignment (
   IN UINT32  SectionAlignment\r
   )\r
 {\r
-  if (((SectionAlignment & (EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT - 1)) != 0) &&\r
+  if (((SectionAlignment & (RUNTIME_PAGE_ALLOCATION_GRANULARITY - 1)) != 0) &&\r
       ((mMemoryProtectionAttribute & EFI_MEMORY_ATTRIBUTES_RUNTIME_MEMORY_PROTECTION_NON_EXECUTABLE_PE_DATA) != 0)) {\r
     DEBUG ((DEBUG_VERBOSE, "SMM SetMemoryAttributesTableSectionAlignment - Clear\n"));\r
     mMemoryProtectionAttribute &= ~((UINT64)EFI_MEMORY_ATTRIBUTES_RUNTIME_MEMORY_PROTECTION_NON_EXECUTABLE_PE_DATA);\r
@@ -1125,9 +1125,9 @@ SmmInsertImageRecord (
   }\r
 \r
   SetMemoryAttributesTableSectionAlignment (SectionAlignment);\r
-  if ((SectionAlignment & (EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT - 1)) != 0) {\r
+  if ((SectionAlignment & (RUNTIME_PAGE_ALLOCATION_GRANULARITY - 1)) != 0) {\r
     DEBUG ((DEBUG_WARN, "SMM !!!!!!!!  InsertImageRecord - Section Alignment(0x%x) is not %dK  !!!!!!!!\n",\r
-      SectionAlignment, EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT >> 10));\r
+      SectionAlignment, RUNTIME_PAGE_ALLOCATION_GRANULARITY >> 10));\r
     PdbPointer = PeCoffLoaderGetPdbPointer ((VOID*) (UINTN) ImageAddress);\r
     if (PdbPointer != NULL) {\r
       DEBUG ((DEBUG_WARN, "SMM !!!!!!!!  Image - %a  !!!!!!!!\n", PdbPointer));\r
index 1bc8fd82c86713b935420fbb5ef76e4def331354..4154c2e6a1ec08e7c805e4c4b871022e919ab106 100644 (file)
@@ -110,7 +110,7 @@ AllocateMemoryMapEntry (
     Status = SmmInternalAllocatePagesEx (\r
                AllocateAnyPages,\r
                EfiRuntimeServicesData,\r
-               EFI_SIZE_TO_PAGES(DEFAULT_PAGE_ALLOCATION),\r
+               EFI_SIZE_TO_PAGES (RUNTIME_PAGE_ALLOCATION_GRANULARITY),\r
                &Mem,\r
                TRUE\r
                );\r
@@ -121,7 +121,7 @@ AllocateMemoryMapEntry (
       //\r
       // Enque the free memmory map entries into the list\r
       //\r
-      for (Index = 0; Index< DEFAULT_PAGE_ALLOCATION / sizeof(MEMORY_MAP); Index++) {\r
+      for (Index = 0; Index< RUNTIME_PAGE_ALLOCATION_GRANULARITY / sizeof(MEMORY_MAP); Index++) {\r
         FreeDescriptorEntries[Index].Signature = MEMORY_MAP_SIGNATURE;\r
         InsertTailList (&mFreeMemoryMapEntryList, &FreeDescriptorEntries[Index].Link);\r
       }\r
index bdef026e6c687fa0cd7660cc0bf4ba7f88af9ae1..45b9d9758be8d7543568f6d9f093d17beb1d4339 100644 (file)
@@ -1151,12 +1151,6 @@ SmiHandlerProfileUnregisterHandler (
   IN EFI_SMM_HANDLER_ENTRY_POINT2   Handler\r
   );\r
 \r
-///\r
-/// For generic EFI machines make the default allocations 4K aligned\r
-///\r
-#define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT  (EFI_PAGE_SIZE)\r
-#define DEFAULT_PAGE_ALLOCATION                     (EFI_PAGE_SIZE)\r
-\r
 extern UINTN                    mFullSmramRangeCount;\r
 extern EFI_SMRAM_DESCRIPTOR     *mFullSmramRanges;\r
 \r