summaryrefslogtreecommitdiffstats
path: root/ArmPkg
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2018-11-23 13:14:28 +0100
committerArd Biesheuvel <ard.biesheuvel@linaro.org>2018-11-29 18:54:59 +0100
commite36b243c7178f2693fc2ddd9d673c0614c80cab0 (patch)
tree54816fc44acb49de2808f6f128d1510d1f83378a /ArmPkg
parent2f9b248af82073aed40c0b86d9f9d7074f5fa36a (diff)
downloadedk2-e36b243c7178f2693fc2ddd9d673c0614c80cab0.tar.gz
edk2-e36b243c7178f2693fc2ddd9d673c0614c80cab0.tar.bz2
edk2-e36b243c7178f2693fc2ddd9d673c0614c80cab0.zip
ArmPkg/ArmMmuLib: take the CPU supported maximum PA space into account
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 MAX_ADDRESS into account as well. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Diffstat (limited to 'ArmPkg')
-rw-r--r--ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c11
-rw-r--r--ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf3
-rw-r--r--ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf3
3 files changed, 9 insertions, 8 deletions
diff --git a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c
index 4b62ecb6a4..5403b8d407 100644
--- a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c
+++ b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c
@@ -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 ()) - 1,
+ MAX_ADDRESS);
// Lookup the Table Level to get the information
LookupAddresstoRootTable (MaxAddress, &T0SZ, &RootTableEntryCount);
diff --git a/ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf b/ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
index b9f264de8d..246963361e 100644
--- a/ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
+++ b/ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
@@ -40,8 +40,5 @@
CacheMaintenanceLib
MemoryAllocationLib
-[Pcd.AARCH64]
- gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize
-
[Pcd.ARM]
gArmTokenSpaceGuid.PcdNormalMemoryNonshareableOverride
diff --git a/ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf b/ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf
index ecf13f7907..f689c193b8 100644
--- a/ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf
+++ b/ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf
@@ -35,6 +35,3 @@
ArmLib
CacheMaintenanceLib
MemoryAllocationLib
-
-[Pcd.AARCH64]
- gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize