summaryrefslogtreecommitdiffstats
path: root/ArmPkg/Drivers/CpuDxe
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@arm.com>2020-03-31 19:24:45 +0200
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2020-04-02 12:35:52 +0000
commitf45e254f2e2b1e25f10b21a2bbb6d833ae45b5c5 (patch)
tree1ec224cb0f455d49b947c9792546ad13ca14ae68 /ArmPkg/Drivers/CpuDxe
parent4deef2d865efdc61d1a53ad7bd48f9dd42560b45 (diff)
downloadedk2-f45e254f2e2b1e25f10b21a2bbb6d833ae45b5c5.tar.gz
edk2-f45e254f2e2b1e25f10b21a2bbb6d833ae45b5c5.tar.bz2
edk2-f45e254f2e2b1e25f10b21a2bbb6d833ae45b5c5.zip
ArmPkg/CpuDxe: use private copy of GetRootTranslationTableInfo()
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>
Diffstat (limited to 'ArmPkg/Drivers/CpuDxe')
-rw-r--r--ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c15
-rw-r--r--ArmPkg/Drivers/CpuDxe/CpuDxe.h7
2 files changed, 15 insertions, 7 deletions
diff --git a/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c b/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c
index 3b6c5e7337..24eb1c4221 100644
--- a/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c
+++ b/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c
@@ -15,6 +15,21 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#define TT_ATTR_INDX_INVALID ((UINT32)~0)
+#define MIN_T0SZ 16
+#define BITS_PER_LEVEL 9
+
+STATIC
+VOID
+GetRootTranslationTableInfo (
+ IN UINTN T0SZ,
+ OUT UINTN *RootTableLevel,
+ OUT UINTN *RootTableEntryCount
+ )
+{
+ *RootTableLevel = (T0SZ - MIN_T0SZ) / BITS_PER_LEVEL;
+ *RootTableEntryCount = TT_ENTRY_COUNT >> (T0SZ - MIN_T0SZ) % BITS_PER_LEVEL;
+}
+
STATIC
UINT64
GetFirstPageAttribute (
diff --git a/ArmPkg/Drivers/CpuDxe/CpuDxe.h b/ArmPkg/Drivers/CpuDxe/CpuDxe.h
index b627c3c50f..3fe5c24d5e 100644
--- a/ArmPkg/Drivers/CpuDxe/CpuDxe.h
+++ b/ArmPkg/Drivers/CpuDxe/CpuDxe.h
@@ -134,13 +134,6 @@ GetMemoryRegion (
OUT UINTN *RegionAttributes
);
-VOID
-GetRootTranslationTableInfo (
- IN UINTN T0SZ,
- OUT UINTN *TableLevel,
- OUT UINTN *TableEntryCount
- );
-
EFI_STATUS
SetGcdMemorySpaceAttributes (
IN EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemorySpaceMap,