From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) by mx.groups.io with SMTP id smtpd.web10.29071.1612745601696912302 for ; Sun, 07 Feb 2021 16:53:21 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=umJuNCfV; spf=pass (domain: nuviainc.com, ip: 209.85.216.47, mailfrom: rebecca@nuviainc.com) Received: by mail-pj1-f47.google.com with SMTP id s24so7282067pjp.5 for ; Sun, 07 Feb 2021 16:53:21 -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=umJuNCfVGNs5p7JPvlTH2Jy41+Ke/0FSl6mr2BtNYsVSEC4QMMzTxw4rmNOvWQ3eUR hgWeuGnuOb3roSj8KqXjdT0w89bqzKhSU3hymfHSLUMtm/T6ViyVgfSaVX1n9AOWeOmr EhIXN9RckNbuvIxcKhaZL2mOGe++TslMI+3gnqgLe7fQ6iJ6VKyYd1LkV944X76qug5c /eIAWPYQw98Q65UpKTUvkQ5HD7yE0pI7JLo386+zYczspl/rXumElUdEZR1eWa+wZbc7 PvGMDY+mOXgw8s65Bh4+PIvHVu8nA+bdQ/9HMqkNH4Gsc4K6etuswAEFoC5mV9zgSZfR 8H4A== 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=grvf3HkESI7fpifAmuHp51KCw7rKvvUEQmq8E+qz7mvGFaZ7tHSfUN/BWhdqVjIcBx u2P6/AZaoGB+43KK3LQj1HHXRIkD5dMY4FwCIWf2Sc/wJGtNntmDMvk4zbJCMCU0fw9D bz7w570wiOkF52iDMKM6JMIXXxBYsuMnjAKzBfPhz22YncFaQKpiVJZ2xG0GFtw5ehgg qfxrOKjty1N4bZRqykae0ilmnu33b1wSfek1ZhBNH16BTSDFodMlXsFoI0f+3undUlO8 rEyws8a7Sljn5KnDE/kTYacE6YriLJ4qRu7CJjCkIGh45Nt3zR2Ep+5P+NYMu+dQYIiP +U0w== X-Gm-Message-State: AOAM532huTwStI8n46MMnJqvnpiGuRkworM97VApwOv4wwGgQqHrR4IG JAf5r6uonk0WKP+qcsaCRJsqcUWmjuI6LIkfsMdUUdUZAet+QNFSSPk6/Fd+ZFrDAm/PyNmXINV dDudnJdzGnyzcJotgZ6l1vIJYvN//QHg/xaoIOKQ7KitGfRhUKQ8pP8+08Cgqy7VB+b+w6A== X-Google-Smtp-Source: ABdhPJy8Lw+mw3w8JEBgrYD0/DvjZCMwPHibDO6T7VKO4H3Lf0bxaOq60pQ04d6hDz7T56RlZ1HhsA== X-Received: by 2002:a17:90b:1804:: with SMTP id lw4mr14595812pjb.141.1612745600708; Sun, 07 Feb 2021 16:53:20 -0800 (PST) Return-Path: Received: from cube.int.bluestop.org (c-174-52-16-57.hsd1.ut.comcast.net. [174.52.16.57]) by smtp.gmail.com with ESMTPSA id c6sm11095883pjd.21.2021.02.07.16.53.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Feb 2021 16:53:20 -0800 (PST) From: "Rebecca Cran" To: devel@edk2.groups.io Cc: Rebecca Cran , leif@nuviainc.com, Ard Biesheuvel , nd@arm.com, Sami Mujawar , Liming Gao , Michael D Kinney , Zhiguang Liu , Samer El-Haj-Mahmoud , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Sami Mujawar Subject: [PATCH v8 09/21] ArmPkg: Add helper to read CCIDX status Date: Sun, 7 Feb 2021 17:52:42 -0700 Message-Id: <20210208005254.12176-10-rebecca@nuviainc.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210208005254.12176-1-rebecca@nuviainc.com> References: <20210208005254.12176-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