mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-29 16:44:10 +02:00
MdeModulePkg: DxeCore: Correct Runtime Granularity Memory Type
Per the UEFI spec 2.10, section 2.3.6 (for the AARCH64 arch, other architectures in section two confirm the same) the memory types that need runtime page allocation granularity are EfiReservedMemoryType, EfiACPIMemoryNVS, EfiRuntimeServicesCode, and EfiRuntimeServicesData. However, legacy code was setting runtime page allocation granularity for EfiACPIReclaimMemory and not EfiReservedMemoryType. This patch fixes that error. Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com> Suggested-by: Ard Biesheuvel <ardb+tianocore@kernel.org> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
This commit is contained in:
parent
bf8f16f771
commit
68461c2c37
@ -1403,7 +1403,7 @@ CoreInternalAllocatePages (
|
|||||||
|
|
||||||
Alignment = DEFAULT_PAGE_ALLOCATION_GRANULARITY;
|
Alignment = DEFAULT_PAGE_ALLOCATION_GRANULARITY;
|
||||||
|
|
||||||
if ((MemoryType == EfiACPIReclaimMemory) ||
|
if ((MemoryType == EfiReservedMemoryType) ||
|
||||||
(MemoryType == EfiACPIMemoryNVS) ||
|
(MemoryType == EfiACPIMemoryNVS) ||
|
||||||
(MemoryType == EfiRuntimeServicesCode) ||
|
(MemoryType == EfiRuntimeServicesCode) ||
|
||||||
(MemoryType == EfiRuntimeServicesData))
|
(MemoryType == EfiRuntimeServicesData))
|
||||||
@ -1666,7 +1666,7 @@ CoreInternalFreePages (
|
|||||||
|
|
||||||
Alignment = DEFAULT_PAGE_ALLOCATION_GRANULARITY;
|
Alignment = DEFAULT_PAGE_ALLOCATION_GRANULARITY;
|
||||||
|
|
||||||
if ((Entry->Type == EfiACPIReclaimMemory) ||
|
if ((Entry->Type == EfiReservedMemoryType) ||
|
||||||
(Entry->Type == EfiACPIMemoryNVS) ||
|
(Entry->Type == EfiACPIMemoryNVS) ||
|
||||||
(Entry->Type == EfiRuntimeServicesCode) ||
|
(Entry->Type == EfiRuntimeServicesCode) ||
|
||||||
(Entry->Type == EfiRuntimeServicesData))
|
(Entry->Type == EfiRuntimeServicesData))
|
||||||
|
@ -370,7 +370,7 @@ CoreAllocatePoolI (
|
|||||||
|
|
||||||
ASSERT_LOCKED (&mPoolMemoryLock);
|
ASSERT_LOCKED (&mPoolMemoryLock);
|
||||||
|
|
||||||
if ((PoolType == EfiACPIReclaimMemory) ||
|
if ((PoolType == EfiReservedMemoryType) ||
|
||||||
(PoolType == EfiACPIMemoryNVS) ||
|
(PoolType == EfiACPIMemoryNVS) ||
|
||||||
(PoolType == EfiRuntimeServicesCode) ||
|
(PoolType == EfiRuntimeServicesCode) ||
|
||||||
(PoolType == EfiRuntimeServicesData))
|
(PoolType == EfiRuntimeServicesData))
|
||||||
@ -753,7 +753,7 @@ CoreFreePoolI (
|
|||||||
Pool->Used -= Size;
|
Pool->Used -= Size;
|
||||||
DEBUG ((DEBUG_POOL, "FreePool: %p (len %lx) %,ld\n", Head->Data, (UINT64)(Head->Size - POOL_OVERHEAD), (UINT64)Pool->Used));
|
DEBUG ((DEBUG_POOL, "FreePool: %p (len %lx) %,ld\n", Head->Data, (UINT64)(Head->Size - POOL_OVERHEAD), (UINT64)Pool->Used));
|
||||||
|
|
||||||
if ((Head->Type == EfiACPIReclaimMemory) ||
|
if ((Head->Type == EfiReservedMemoryType) ||
|
||||||
(Head->Type == EfiACPIMemoryNVS) ||
|
(Head->Type == EfiACPIMemoryNVS) ||
|
||||||
(Head->Type == EfiRuntimeServicesCode) ||
|
(Head->Type == EfiRuntimeServicesCode) ||
|
||||||
(Head->Type == EfiRuntimeServicesData))
|
(Head->Type == EfiRuntimeServicesData))
|
||||||
|
@ -300,18 +300,18 @@ IsMemoryProtectionSectionAligned (
|
|||||||
switch (MemoryType) {
|
switch (MemoryType) {
|
||||||
case EfiRuntimeServicesCode:
|
case EfiRuntimeServicesCode:
|
||||||
case EfiACPIMemoryNVS:
|
case EfiACPIMemoryNVS:
|
||||||
|
case EfiReservedMemoryType:
|
||||||
PageAlignment = RUNTIME_PAGE_ALLOCATION_GRANULARITY;
|
PageAlignment = RUNTIME_PAGE_ALLOCATION_GRANULARITY;
|
||||||
break;
|
break;
|
||||||
case EfiRuntimeServicesData:
|
case EfiRuntimeServicesData:
|
||||||
case EfiACPIReclaimMemory:
|
|
||||||
ASSERT (FALSE);
|
ASSERT (FALSE);
|
||||||
PageAlignment = RUNTIME_PAGE_ALLOCATION_GRANULARITY;
|
PageAlignment = RUNTIME_PAGE_ALLOCATION_GRANULARITY;
|
||||||
break;
|
break;
|
||||||
case EfiBootServicesCode:
|
case EfiBootServicesCode:
|
||||||
case EfiLoaderCode:
|
case EfiLoaderCode:
|
||||||
case EfiReservedMemoryType:
|
|
||||||
PageAlignment = EFI_PAGE_SIZE;
|
PageAlignment = EFI_PAGE_SIZE;
|
||||||
break;
|
break;
|
||||||
|
case EfiACPIReclaimMemory:
|
||||||
default:
|
default:
|
||||||
ASSERT (FALSE);
|
ASSERT (FALSE);
|
||||||
PageAlignment = EFI_PAGE_SIZE;
|
PageAlignment = EFI_PAGE_SIZE;
|
||||||
|
@ -584,7 +584,7 @@ PeiAllocatePages (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((RUNTIME_PAGE_ALLOCATION_GRANULARITY > DEFAULT_PAGE_ALLOCATION_GRANULARITY) &&
|
if ((RUNTIME_PAGE_ALLOCATION_GRANULARITY > DEFAULT_PAGE_ALLOCATION_GRANULARITY) &&
|
||||||
((MemoryType == EfiACPIReclaimMemory) ||
|
((MemoryType == EfiReservedMemoryType) ||
|
||||||
(MemoryType == EfiACPIMemoryNVS) ||
|
(MemoryType == EfiACPIMemoryNVS) ||
|
||||||
(MemoryType == EfiRuntimeServicesCode) ||
|
(MemoryType == EfiRuntimeServicesCode) ||
|
||||||
(MemoryType == EfiRuntimeServicesData)))
|
(MemoryType == EfiRuntimeServicesData)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user