@@ -40,8 +40,5 @@ [LibraryClasses]
CacheMaintenanceLib
MemoryAllocationLib
-[Pcd.AARCH64]
- gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize
-
[Pcd.ARM]
gArmTokenSpaceGuid.PcdNormalMemoryNonshareableOverride
@@ -35,6 +35,3 @@ [LibraryClasses]
ArmLib
CacheMaintenanceLib
MemoryAllocationLib
-
-[Pcd.AARCH64]
- gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize
@@ -604,8 +604,15 @@ ArmConfigureMmu (
return EFI_INVALID_PARAMETER;
}
- // Cover the entire GCD memory space
- MaxAddress = (1UL << PcdGet8 (PcdPrePiCpuMemorySize)) - 1;
+ //
+ // Limit the virtual address space to what we can actually use: UEFI
+ // mandates a 1:1 mapping, so no point in making the virtual address
+ // space larger than the physical address space. We also have to take
+ // into account the architectural limitations that result from UEFI's
+ // use of 4 KB pages.
+ //
+ MaxAddress = MIN (LShiftU64 (1ULL, ArmGetPhysicalAddressBits ()),
+ ARM_MMU_IDMAP_RANGE) - 1;
// Lookup the Table Level to get the information
LookupAddresstoRootTable (MaxAddress, &T0SZ, &RootTableEntryCount);
In preparation of dropping PcdPrePiCpuMemorySize entirely, base the maximum size of the identity map on the capabilities of the CPU. Since that may exceed what is architecturally permitted when using 4 KB pages, take ARM_MMU_IDMAP_RANGE into account as well. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> --- ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf | 3 --- ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf | 3 --- ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c | 11 +++++++++-- 3 files changed, 9 insertions(+), 8 deletions(-) -- 2.19.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel