]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg/ArmMmuLib: take the CPU supported maximum PA space into account
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Fri, 23 Nov 2018 12:14:28 +0000 (13:14 +0100)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 29 Nov 2018 17:54:59 +0000 (18:54 +0100)
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>
ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c
ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf

index 4b62ecb6a47650b318b852815f02e26251b8b789..5403b8d4070e8a8b81eb2e568f7190d3e297bf8a 100644 (file)
@@ -604,8 +604,15 @@ ArmConfigureMmu (
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  // Cover the entire GCD memory space\r
-  MaxAddress = (1UL << PcdGet8 (PcdPrePiCpuMemorySize)) - 1;\r
+  //\r
+  // Limit the virtual address space to what we can actually use: UEFI\r
+  // mandates a 1:1 mapping, so no point in making the virtual address\r
+  // space larger than the physical address space. We also have to take\r
+  // into account the architectural limitations that result from UEFI's\r
+  // use of 4 KB pages.\r
+  //\r
+  MaxAddress = MIN (LShiftU64 (1ULL, ArmGetPhysicalAddressBits ()) - 1,\r
+                    MAX_ADDRESS);\r
 \r
   // Lookup the Table Level to get the information\r
   LookupAddresstoRootTable (MaxAddress, &T0SZ, &RootTableEntryCount);\r
 \r
   // Lookup the Table Level to get the information\r
   LookupAddresstoRootTable (MaxAddress, &T0SZ, &RootTableEntryCount);\r
index b9f264de8d26975d00f0e12b7d8622572120ef64..246963361e45390649b18aea1441624ca5d34007 100644 (file)
@@ -40,8 +40,5 @@
   CacheMaintenanceLib\r
   MemoryAllocationLib\r
 \r
   CacheMaintenanceLib\r
   MemoryAllocationLib\r
 \r
-[Pcd.AARCH64]\r
-  gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize\r
-\r
 [Pcd.ARM]\r
   gArmTokenSpaceGuid.PcdNormalMemoryNonshareableOverride\r
 [Pcd.ARM]\r
   gArmTokenSpaceGuid.PcdNormalMemoryNonshareableOverride\r
index ecf13f790734fda49a448362f8e407e63d2eede5..f689c193b8621ac28d5b4f3166250478358289c6 100644 (file)
@@ -35,6 +35,3 @@
   ArmLib\r
   CacheMaintenanceLib\r
   MemoryAllocationLib\r
   ArmLib\r
   CacheMaintenanceLib\r
   MemoryAllocationLib\r
-\r
-[Pcd.AARCH64]\r
-  gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize\r