From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by mx.groups.io with SMTP id smtpd.web11.3002.1585392211837102758 for ; Sat, 28 Mar 2020 03:43:32 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=j3nSEETh; spf=pass (domain: linaro.org, ip: 209.85.221.68, mailfrom: ard.biesheuvel@linaro.org) Received: by mail-wr1-f68.google.com with SMTP id s1so14791115wrv.5 for ; Sat, 28 Mar 2020 03:43:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cwnNvPrMGlPFmEBQrlHBw3D41L0mXNWB77tEY8SsgRg=; b=j3nSEEThT2dREBKUSkQutiw550wwP5N+FXdifjyMZAA92t6SIxoLF4sBymtgAXUlWH IV3nbOd6oC8RbQMjxAKYAj0ShpPqpGhFhx9cS4ykosmpdMDrWTQ/5xGv0GqvAQrMk2vn MK8Bz6SawFEOEtsHvjgikzlLeTGuOkY3CnDB8mJ10WxFjyOy3mvR5bOjOLEHoV0MP9L0 znUQBRBBZv1F7G48OCweub0oxO8Y5MvDgKL6xVC62nl1kvlk5dbD0Jb2/I6CnliZqxet TyhqlL7hQR2sIxK3KNsNpPHqhuQHtCiinLiRA1kEwSFC2Mb+yBZm5KheDcz8X4Y0RFoV uo+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cwnNvPrMGlPFmEBQrlHBw3D41L0mXNWB77tEY8SsgRg=; b=X+bFOUyAxqEuFIk/kfwIDiT8GiH7/UCicmGrJWhytnpp5H5sWCQDJbKFRABY1oo8kv lS+g8LSaQsNQvwqmQEV3E47WusGWZAsxj4eOBXtfuoKt8FD+yJG6DDHOMqV7w+bEwM7E a4ShWEmxMLwBNFTWKkRCdLm1g1QIVV7eWmpVOiknrGlewSpCPUrGEgaGAIPTdqet8f3u T3yhPURpbgjvJerOUxAsPIZWOAiAYWNkeFmyoQWAVFlX80asPVMe8iNCEPKHo24jd94o JsZ58gT8nwkfXxB9lPzkIqL1At0BKxso46lty32P8/AhRyqiLP5aFWx7z5Wp+T56w3xT +1+A== X-Gm-Message-State: ANhLgQ3fG+K19vOj1aNuK1YZV7np4FGU2Oko0qZwpWHnE9S4cKomK2u1 FE6csEoihOLgxX/4nH88B4HuOGFP7T7vyA== X-Google-Smtp-Source: ADFU+vsJ/RJPNhAJ/KM9ootCJz/hyJ3LELpQrj3bqlhGmSBMmyNqaIlbS3WUXcU+Oz2UrpZuuGBHxA== X-Received: by 2002:adf:e98a:: with SMTP id h10mr4411547wrm.370.1585392210245; Sat, 28 Mar 2020 03:43:30 -0700 (PDT) Return-Path: Received: from e123331-lin.home (amontpellier-657-1-18-247.w109-210.abo.wanadoo.fr. [109.210.65.247]) by smtp.gmail.com with ESMTPSA id a13sm4756386wrt.64.2020.03.28.03.43.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Mar 2020 03:43:29 -0700 (PDT) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: leif@nuviainc.com, Ard Biesheuvel Subject: [PATCH 4/5] ArmPkg/ArmMmuLib: get rid of GetRootTranslationTableInfo() Date: Sat, 28 Mar 2020 11:43:20 +0100 Message-Id: <20200328104321.8668-5-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200328104321.8668-1-ard.biesheuvel@linaro.org> References: <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 --- 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