MdeModulePkg/DxeCore: switch to MdePkg allocation granularity macros

Remove the local definitions for the default and runtime page allocation
granularity macros, and switch to the new MdePkg versions.

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>
This commit is contained in:
Ard Biesheuvel
2017-03-03 15:11:32 +00:00
parent 08855193ca
commit d4731a98a3
6 changed files with 22 additions and 47 deletions

View File

@@ -15,8 +15,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "DxeMain.h"
#include "Imem.h"
#define EFI_DEFAULT_PAGE_ALLOCATION_ALIGNMENT (EFI_PAGE_SIZE)
//
// Entry for tracking the memory regions for each memory type to coalesce similar memory types
//
@@ -287,12 +285,14 @@ AllocateMemoryMapEntry (
//
// The list is empty, to allocate one page to refuel the list
//
FreeDescriptorEntries = CoreAllocatePoolPages (EfiBootServicesData, EFI_SIZE_TO_PAGES(DEFAULT_PAGE_ALLOCATION), DEFAULT_PAGE_ALLOCATION);
if(FreeDescriptorEntries != NULL) {
FreeDescriptorEntries = CoreAllocatePoolPages (EfiBootServicesData,
EFI_SIZE_TO_PAGES (DEFAULT_PAGE_ALLOCATION_GRANULARITY),
DEFAULT_PAGE_ALLOCATION_GRANULARITY);
if (FreeDescriptorEntries != NULL) {
//
// Enque the free memmory map entries into the list
//
for (Index = 0; Index< DEFAULT_PAGE_ALLOCATION / sizeof(MEMORY_MAP); Index++) {
for (Index = 0; Index < DEFAULT_PAGE_ALLOCATION_GRANULARITY / sizeof(MEMORY_MAP); Index++) {
FreeDescriptorEntries[Index].Signature = MEMORY_MAP_SIGNATURE;
InsertTailList (&mFreeMemoryMapEntryList, &FreeDescriptorEntries[Index].Link);
}
@@ -1222,14 +1222,14 @@ CoreInternalAllocatePages (
return EFI_INVALID_PARAMETER;
}
Alignment = EFI_DEFAULT_PAGE_ALLOCATION_ALIGNMENT;
Alignment = DEFAULT_PAGE_ALLOCATION_GRANULARITY;
if (MemoryType == EfiACPIReclaimMemory ||
MemoryType == EfiACPIMemoryNVS ||
MemoryType == EfiRuntimeServicesCode ||
MemoryType == EfiRuntimeServicesData) {
Alignment = EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT;
Alignment = RUNTIME_PAGE_ALLOCATION_GRANULARITY;
}
if (Type == AllocateAddress) {
@@ -1398,7 +1398,7 @@ CoreInternalFreePages (
goto Done;
}
Alignment = EFI_DEFAULT_PAGE_ALLOCATION_ALIGNMENT;
Alignment = DEFAULT_PAGE_ALLOCATION_GRANULARITY;
ASSERT (Entry != NULL);
if (Entry->Type == EfiACPIReclaimMemory ||
@@ -1406,7 +1406,7 @@ CoreInternalFreePages (
Entry->Type == EfiRuntimeServicesCode ||
Entry->Type == EfiRuntimeServicesData) {
Alignment = EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT;
Alignment = RUNTIME_PAGE_ALLOCATION_GRANULARITY;
}
@@ -1925,12 +1925,12 @@ CoreTerminateMemoryMap (
if (mMemoryTypeStatistics[Entry->Type].Runtime) {
ASSERT (Entry->Type != EfiACPIReclaimMemory);
ASSERT (Entry->Type != EfiACPIMemoryNVS);
if ((Entry->Start & (EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT - 1)) != 0) {
if ((Entry->Start & (RUNTIME_PAGE_ALLOCATION_GRANULARITY - 1)) != 0) {
DEBUG((DEBUG_ERROR | DEBUG_PAGE, "ExitBootServices: A RUNTIME memory entry is not on a proper alignment.\n"));
Status = EFI_INVALID_PARAMETER;
goto Done;
}
if (((Entry->End + 1) & (EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT - 1)) != 0) {
if (((Entry->End + 1) & (RUNTIME_PAGE_ALLOCATION_GRANULARITY - 1)) != 0) {
DEBUG((DEBUG_ERROR | DEBUG_PAGE, "ExitBootServices: A RUNTIME memory entry is not on a proper alignment.\n"));
Status = EFI_INVALID_PARAMETER;
goto Done;