From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-io1-f51.google.com (mail-io1-f51.google.com [209.85.166.51]) by mx.groups.io with SMTP id smtpd.web12.4175.1610642209348055249 for ; Thu, 14 Jan 2021 08:36:49 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=RR7cFNAf; spf=pass (domain: nuviainc.com, ip: 209.85.166.51, mailfrom: rebecca@nuviainc.com) Received: by mail-io1-f51.google.com with SMTP id z5so12311744iob.11 for ; Thu, 14 Jan 2021 08:36:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuviainc-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MfxKWWwakAcuxzCnRX6lWMm3ZW+bKq2wtpEzITXRsak=; b=RR7cFNAfXJ37X2ZAsrbLz2wjIgdX4i+xOJDg0pRoph5lfPwQMKlqtwQ0w9oytGP6vL tdAFnTTMsx7xocQyL+NRequl2VtVo/dLA5zHHWcvI7p9+GW//woMvOWjnGOBLXkQCL20 ZSEAjgL25Rerq6fm6ykDpI5l/u+uJ1dgQIKnsHMXNrrsA4VY8/k7sqgUCPgVOMKbZSAI fh4JmPs3rcD/63+G1ag/eLMG97YXF0YeyW6m1tvCjUTnOU8GRmiLRqKkhxU/aL+0f3q0 vVSLzIyj3GaiKz6zTz0nwhjqS02eJGOabu3z5psJ+fvALpPSJaRdNkIAbI4qA81nMl65 Atjg== 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:mime-version:content-transfer-encoding; bh=MfxKWWwakAcuxzCnRX6lWMm3ZW+bKq2wtpEzITXRsak=; b=qK/loc4rh/4IuacS9Go2PE2s3BsC4VjftbJRe099uBTHtVzIb6ACS6PcQr856VDAae cSyzrjzZPhHPCYReB7zE7r8u22bw7Z3DkeSu/Xu24YtA9VDRgMSGS7co4kb8NHUbrXrS g1PJVHWEzSItTaKXb97gV/+C0hxoGykbH+U+TBnCp21iwKZJLsAcez9gmuF/gVw9gpIe GVwnpebYyY2IeGJDxm3LDmZ5TMASyc4hjfg7e8gMu4Jpz4DarRHb5GCBG1s+U8BbTr7i 7qf+vfZxSO6q7zVlH5JY2XJCJcDEQMtKCw5rKVXoP6tEUHlnKMZzFpwiXeNt0dww5hlM M7+g== X-Gm-Message-State: AOAM531bDCaYt1nM/eq6quzCCo0OYk8mnxw1hh0B0N7s4YUUMF/QAbkh KOZwRQVFt7thtDvTb55EJd2GcBGYHP1TBbzFy98+MgmMxtRHHHxocykMBoiP6mkIy1yV3wYepFR G905I9jSw4x+ty/abz0DD+Q/jEQIhDWveXn58Y9oVa9wCH2QWy9F67UUzWrQBg3+9EJlK7RWR X-Google-Smtp-Source: ABdhPJx98a8ealXcN0JQxJBHYp2TzmPeyeInmB130z41r7xV5JrVNZmy6s7u31bWPNZDgzg4HP1yCw== X-Received: by 2002:a02:6a53:: with SMTP id m19mr6631590jaf.24.1610642208459; Thu, 14 Jan 2021 08:36:48 -0800 (PST) Return-Path: Received: from cube.nuviainc.com (c-174-52-16-57.hsd1.ut.comcast.net. [174.52.16.57]) by smtp.gmail.com with ESMTPSA id y5sm3711920ilj.35.2021.01.14.08.36.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jan 2021 08:36:47 -0800 (PST) From: "Rebecca Cran" To: devel@edk2.groups.io Cc: Rebecca Cran , Leif Lindholm , Ard Biesheuvel , nd@arm.com, Sami Mujawar , Liming Gao , Michael D Kinney , Zhiguang Liu , Sami Mujawar Subject: [PATCH v6 10/22] ArmPkg: Add helper to read CCIDX status Date: Thu, 14 Jan 2021 09:36:16 -0700 Message-Id: <20210114163628.31952-11-rebecca@nuviainc.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210114163628.31952-1-rebecca@nuviainc.com> References: <20210114163628.31952-1-rebecca@nuviainc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Add a helper function to determine CCIDX support. Signed-off-by: Rebecca Cran Reviewed-by: Sami Mujawar Reviewed-by: Leif Lindholm --- ArmPkg/Include/Library/ArmLib.h | 11 +++++++++++ ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c | 19 ++++++++++++++++++- ArmPkg/Library/ArmLib/Arm/ArmV7Lib.c | 19 ++++++++++++++++++- 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/ArmPkg/Include/Library/ArmLib.h b/ArmPkg/Include/Library/ArmLib.h index fd4f06d24274..70b9d816b74c 100644 --- a/ArmPkg/Include/Library/ArmLib.h +++ b/ArmPkg/Include/Library/ArmLib.h @@ -725,6 +725,17 @@ ArmHasGicSystemRegisters ( VOID ); +/** Checks if CCIDX is implemented. + + @retval TRUE CCIDX is implemented. + @retval FALSE CCIDX is not implemented. +**/ +BOOLEAN +EFIAPI +ArmHasCcidx ( + VOID + ); + #ifdef MDE_CPU_ARM /// /// AArch32-only ID Register Helper functions diff --git a/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c b/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c index 53e593bc994b..191a5fea31a1 100644 --- a/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c +++ b/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c @@ -2,7 +2,7 @@ Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
Portions copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.
- Copyright (c) 2020, NUVIA Inc. All rights reserved.
+ Copyright (c) 2021, NUVIA Inc. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent @@ -87,3 +87,20 @@ ArmHasGicSystemRegisters ( { return ((ArmReadIdAA64Pfr0 () & AARCH64_PFR0_GIC) != 0); } + +/** Checks if CCIDX is implemented. + + @retval TRUE CCIDX is implemented. + @retval FALSE CCIDX is not implemented. +**/ +BOOLEAN +EFIAPI +ArmHasCcidx ( + VOID + ) +{ + UINTN Mmfr2; + + Mmfr2 = ArmReadIdAA64Mmfr2 (); + return (((Mmfr2 >> 20) & 0xF) == 1) ? TRUE : FALSE; +} diff --git a/ArmPkg/Library/ArmLib/Arm/ArmV7Lib.c b/ArmPkg/Library/ArmLib/Arm/ArmV7Lib.c index 9f81a7223732..c5dd3f8b2f1c 100644 --- a/ArmPkg/Library/ArmLib/Arm/ArmV7Lib.c +++ b/ArmPkg/Library/ArmLib/Arm/ArmV7Lib.c @@ -2,7 +2,7 @@ Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
Copyright (c) 2011 - 2014, ARM Limited. All rights reserved. - Copyright (c) 2020, NUVIA Inc. All rights reserved.
+ Copyright (c) 2021, NUVIA Inc. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent @@ -102,3 +102,20 @@ ArmHasSecurityExtensions ( { return ((ArmReadIdPfr1 () & ARM_PFR1_SEC) != 0); } + +/** Checks if CCIDX is implemented. + + @retval TRUE CCIDX is implemented. + @retval FALSE CCIDX is not implemented. +**/ +BOOLEAN +EFIAPI +ArmHasCcidx ( + VOID + ) +{ + UINTN Mmfr4; + + Mmfr4 = ArmReadIdMmfr4 (); + return (((Mmfr4 >> 24) & 0xF) == 1) ? TRUE : FALSE; +} -- 2.26.2