From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f180.google.com (mail-qk1-f180.google.com [209.85.222.180]) by mx.groups.io with SMTP id smtpd.web11.26312.1612135536112669390 for ; Sun, 31 Jan 2021 15:25:36 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=jAb92QlD; spf=pass (domain: nuviainc.com, ip: 209.85.222.180, mailfrom: rebecca@nuviainc.com) Received: by mail-qk1-f180.google.com with SMTP id t63so14633889qkc.1 for ; Sun, 31 Jan 2021 15:25:36 -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=jAb92QlDLZl1To5ecMPlRDIkNd+G/60zn7H+x0ylRmuJkEh3KWMA3eW/sPsuZa2H9T FWjxUOBkf3cqI/Z/cbfAU8dPN+oK/ZFcreuDYnaSEGx3JamD7gAs28sjyTru6qQd7xUP incZytMVc/f44i6I9IOU0HAP3ovQ1RTPO9NEOA3IOdv0Tk4r21lhV9o8lj+39LWP6GfB o0M/QP/VHxXIgdmlpqtydxIIdehquJFlAuBiLHjzkE1XrlfaoTdjvGkgtSGTE3TOyYDE ltQGI1wtnXxYn6GWE1+lZ3dTZp1vUYrgButUK7neVqG11lGWQHzrFde7Yu3dSmKD6M3A tE+Q== 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=cuTYxQ3lhSVbJVU4ZZO6kCuYXPogYBjA1WGc2mHeFfOZXSn/gR7K8/pM/tYSxLc5Ei rEBdIUGnzXYwhjZ1zEDoeBLAhsWv7/K8ZP+/hNEsHeVRDDP/LFwI6wryJJ3CSVaVXmCw jOaTtzLIWAPZ4lXDJqKYkl4rVyVvPXbTOkH9MB4LMeWdj9lUzUCeok/p6nD0EG7ergsy TAo8sMid4UCwxZXWJctILZyYxp+8/Q3gKxSHupFIQ3YTZBfFFf1lXuV88ydCg6VsZ5Y0 Xk4XUJe06K4C5m1MW1ZIR4tjbmsIG6r2K1B6DJjE5AyXzpAiPk64HIOfBGyleB7UEgr9 mSQQ== X-Gm-Message-State: AOAM53257iYaWYoJIRW3hCCIzRE98y6x6MYHuAvuo4CK+d5lnnEZs/y+ o0lJub+rAODAxgYWWYao64Sw8P+sUj+xJ/SDoakmJGEnhBFgKQ4Gi/6rqfGauEZqye+0OhtD899 9zcUu0TF7lXpOqnPRMC60GCOtqvlM33+v/rf0yIGD0TgJv8Pk2tmqc2GAc3MLwrQjooLOuQ== X-Google-Smtp-Source: ABdhPJxUsEsilfz3211AjLyLmlhMXn98Crql4rfUfbN90NyXBm39A6R0eIZabS3bVEMj5L/e/XOFMw== X-Received: by 2002:a37:9581:: with SMTP id x123mr13512478qkd.439.1612135534964; Sun, 31 Jan 2021 15:25:34 -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 12sm11809361qkg.39.2021.01.31.15.25.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Jan 2021 15:25:34 -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 v7 09/21] ArmPkg: Add helper to read CCIDX status Date: Sun, 31 Jan 2021 16:24:59 -0700 Message-Id: <20210131232511.18340-10-rebecca@nuviainc.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210131232511.18340-1-rebecca@nuviainc.com> References: <20210131232511.18340-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