]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg/CpuDxe: use private copy of GetRootTranslationTableInfo()
authorArd Biesheuvel <ard.biesheuvel@arm.com>
Tue, 31 Mar 2020 17:24:45 +0000 (19:24 +0200)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Thu, 2 Apr 2020 12:35:52 +0000 (12:35 +0000)
Before getting rid of GetRootTranslationTableInfo() and the related
LookupAddresstoRootTable() in AARCH64's version of ArmMmuLib, add a
version of the former to CpuDxe, which will be its only remaining
user. While at it, simplify it a bit, since in the CpuDxe cases,
both OUT arguments are always provided.

Note that this removes the declaration of GetRootTranslationTableInfo()
as well, but this is a declaration that is private to CpuDxe, and it
really doesn't belong here in the first place. Since ArmMmuLib's version
of GetRootTranslationTableInfo() is going to be replaced shortly anyway,
don't bother moving this .h declaration elsewhere.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c
ArmPkg/Drivers/CpuDxe/CpuDxe.h

index 3b6c5e733709836fdca206ff8e1ad1134f25d4e5..24eb1c4221e31ff18b77914fee963923a21c3124 100644 (file)
@@ -15,6 +15,21 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 \r
 #define TT_ATTR_INDX_INVALID    ((UINT32)~0)\r
 \r
+#define MIN_T0SZ        16\r
+#define BITS_PER_LEVEL  9\r
+\r
+STATIC\r
+VOID\r
+GetRootTranslationTableInfo (\r
+  IN  UINTN     T0SZ,\r
+  OUT UINTN     *RootTableLevel,\r
+  OUT UINTN     *RootTableEntryCount\r
+  )\r
+{\r
+  *RootTableLevel       = (T0SZ - MIN_T0SZ) / BITS_PER_LEVEL;\r
+  *RootTableEntryCount  = TT_ENTRY_COUNT >> (T0SZ - MIN_T0SZ) % BITS_PER_LEVEL;\r
+}\r
+\r
 STATIC\r
 UINT64\r
 GetFirstPageAttribute (\r
index b627c3c50ff8c79adbfb3b047dc05699e872b1d4..3fe5c24d5e5b28fe2e0e31cd0355ff2d68da3fb4 100644 (file)
@@ -134,13 +134,6 @@ GetMemoryRegion (
   OUT    UINTN                   *RegionAttributes\r
   );\r
 \r
-VOID\r
-GetRootTranslationTableInfo (\r
-  IN  UINTN    T0SZ,\r
-  OUT UINTN   *TableLevel,\r
-  OUT UINTN   *TableEntryCount\r
-  );\r
-\r
 EFI_STATUS\r
 SetGcdMemorySpaceAttributes (\r
   IN EFI_GCD_MEMORY_SPACE_DESCRIPTOR    *MemorySpaceMap,\r