public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ard Biesheuvel" <ard.biesheuvel@linaro.org>
To: devel@edk2.groups.io
Cc: leif@nuviainc.com, Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH 4/5] ArmPkg/ArmMmuLib: get rid of GetRootTranslationTableInfo()
Date: Sat, 28 Mar 2020 11:43:20 +0100	[thread overview]
Message-ID: <20200328104321.8668-5-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <20200328104321.8668-1-ard.biesheuvel@linaro.org>

Only a single call to GetRootTranslationTableInfo() remains, which
only provides the root table level. So let's create a new static
helper function that returns just this value, and use it instead.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c | 22 ++++++--------------
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c
index b6f3ef54aa26..a82596d290f1 100644
--- a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c
+++ b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c
@@ -70,21 +70,13 @@ GetRootTableEntryCount (
   return TT_ENTRY_COUNT >> (T0SZ - MIN_T0SZ) % BITS_PER_LEVEL;
 }
 
-VOID
-GetRootTranslationTableInfo (
-  IN UINTN     T0SZ,
-  OUT UINTN   *TableLevel,
-  OUT UINTN   *TableEntryCount
+STATIC
+UINTN
+GetRootTableLevel (
+  IN  UINTN T0SZ
   )
 {
-  // Get the level of the root table
-  if (TableLevel) {
-    *TableLevel = (T0SZ - MIN_T0SZ) / BITS_PER_LEVEL;
-  }
-
-  if (TableEntryCount) {
-    *TableEntryCount = 1UL << (BITS_PER_LEVEL - (T0SZ - MIN_T0SZ) % BITS_PER_LEVEL);
-  }
+  return (T0SZ - MIN_T0SZ) / BITS_PER_LEVEL;
 }
 
 STATIC
@@ -303,7 +295,6 @@ UpdateRegionMapping (
   IN  UINT64  AttributeClearMask
   )
 {
-  UINTN     RootTableLevel;
   UINTN     T0SZ;
 
   if (((RegionStart | RegionLength) & EFI_PAGE_MASK)) {
@@ -311,11 +302,10 @@ UpdateRegionMapping (
   }
 
   T0SZ = ArmGetTCR () & TCR_T0SZ_MASK;
-  GetRootTranslationTableInfo (T0SZ, &RootTableLevel, NULL);
 
   return UpdateRegionMappingRecursive (RegionStart, RegionStart + RegionLength,
            AttributeSetMask, AttributeClearMask, ArmGetTTBR0BaseAddress (),
-           RootTableLevel);
+           GetRootTableLevel (T0SZ));
 }
 
 STATIC
-- 
2.17.1


  parent reply	other threads:[~2020-03-28 10:43 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-28 10:43 [PATCH 0/5] ArmPkg: cosmetic cleanups for ArmMmuLib Ard Biesheuvel
2020-03-28 10:43 ` [PATCH 1/5] ArmPkg/CpuDxe: use private copy of GetRootTranslationTableInfo() Ard Biesheuvel
2020-04-02 10:16   ` Leif Lindholm
2020-04-02 10:20     ` [edk2-devel] " Ard Biesheuvel
2020-04-02 10:28       ` Leif Lindholm
2020-04-02 10:29         ` Ard Biesheuvel
2020-04-02 11:03           ` Leif Lindholm
2020-04-02 12:44             ` Ard Biesheuvel
2020-03-28 10:43 ` [PATCH 2/5] ArmPkg/CpuDxe: move PageAttributeToGcdAttribute() out of ArmMmuLib Ard Biesheuvel
2020-03-28 10:43 ` [PATCH 3/5] ArmPkg/ArmMmuLib: drop pointless LookupAddresstoRootTable() routine Ard Biesheuvel
2020-03-28 10:43 ` Ard Biesheuvel [this message]
2020-03-28 10:43 ` [PATCH 5/5] ArmPkg/ArmMmuLib: drop unused TT_ATTR_INDX_INVALID CPP symbol Ard Biesheuvel
2020-04-02 10:23   ` Leif Lindholm
2020-04-02 10:29     ` [edk2-devel] " Ard Biesheuvel
2020-04-02 10:57       ` Leif Lindholm
2020-04-02 11:05         ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200328104321.8668-5-ard.biesheuvel@linaro.org \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox