From: "Sami Mujawar" <sami.mujawar@arm.com>
To: <devel@edk2.groups.io>
Cc: Sami Mujawar <sami.mujawar@arm.com>, <ardb+tianocore@kernel.org>,
<quic_llindhol@quicinc.com>, <pierre.gondois@arm.com>,
<Anshuman.Khandual@arm.com>, <Matteo.Carlini@arm.com>,
<Akanksha.Jain2@arm.com>, <Sibel.Allinson@arm.com>,
<jeshuas@nvidia.com>, <nd@arm.com>
Subject: [edk2-devel] [PATCH v3 12/13] ArmPkg/ArmLib: Add ArmHasTrbe () helper function
Date: Fri, 22 Sep 2023 15:35:15 +0100 [thread overview]
Message-ID: <20230922143516.4764-13-sami.mujawar@arm.com> (raw)
In-Reply-To: <20230922143516.4764-1-sami.mujawar@arm.com>
Create a helper function to query whether ID_AA64MFR1_EL1 indicates
presence of the Trace Buffer Extension (TRBE). This feature is only
visible in AARCH64 state.
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Pierre Gondois <pierre.gondois@arm.com>
---
Notes:
v3:
- New patch in this series that introduces a helper [SAMI]
function for platforms to query if TRBE feature is
supported.
Ref: https://edk2.groups.io/g/devel/message/108986
ArmPkg/Include/Chipset/AArch64.h | 3 +++
ArmPkg/Include/Library/ArmLib.h | 13 +++++++++++++
ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c | 15 +++++++++++++++
3 files changed, 31 insertions(+)
diff --git a/ArmPkg/Include/Chipset/AArch64.h b/ArmPkg/Include/Chipset/AArch64.h
index 2e87917049f9c50af9bf674a5ca32d1ae6f072c3..d8711ad7112f1f983d22d98bdf8ff8607bf2ff98 100644
--- a/ArmPkg/Include/Chipset/AArch64.h
+++ b/ArmPkg/Include/Chipset/AArch64.h
@@ -31,6 +31,9 @@
#define AARCH64_PFR0_FP (0xF << 16)
#define AARCH64_PFR0_GIC (0xF << 24)
+// ID_AA64DFR0 - AArch64 Debug Feature Register 0 definitions
+#define AARCH64_DFR0_TRBE (0xFULL << 44)
+
// SCR - Secure Configuration Register definitions
#define SCR_NS (1 << 0)
#define SCR_IRQ (1 << 1)
diff --git a/ArmPkg/Include/Library/ArmLib.h b/ArmPkg/Include/Library/ArmLib.h
index 0169dbc1092cddae684362c07c8d5fe3d8809b91..c2d738c06e27a3599b79c7bd83c72f8a696b4aef 100644
--- a/ArmPkg/Include/Library/ArmLib.h
+++ b/ArmPkg/Include/Library/ArmLib.h
@@ -780,6 +780,19 @@ EFIAPI
ArmHasVhe (
VOID
);
+
+/**
+ Checks whether the CPU implements the Trace Buffer Extension.
+
+ @retval TRUE FEAT_TRBE is implemented.
+ @retval FALSE FEAT_TRBE is not mplemented.
+**/
+BOOLEAN
+EFIAPI
+ArmHasTrbe (
+ VOID
+ );
+
#endif // MDE_CPU_AARCH64
#ifdef MDE_CPU_ARM
diff --git a/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c b/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c
index da5755106e623da92be8455af7159e66e5c48661..3a46f360ef512ed68f9ec80fc486551ff7440009 100644
--- a/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c
+++ b/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c
@@ -119,3 +119,18 @@ ArmHasVhe (
{
return ((ArmReadIdAA64Mmfr1 () & AARCH64_MMFR1_VH) != 0);
}
+
+/**
+ Checks whether the CPU implements the Trace Buffer Extension.
+
+ @retval TRUE FEAT_TRBE is implemented.
+ @retval FALSE FEAT_TRBE is not mplemented.
+**/
+BOOLEAN
+EFIAPI
+ArmHasTrbe (
+ VOID
+ )
+{
+ return ((ArmReadIdAA64Dfr0 () & AARCH64_DFR0_TRBE) != 0);
+}
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109005): https://edk2.groups.io/g/devel/message/109005
Mute This Topic: https://groups.io/mt/101522351/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
next prev parent reply other threads:[~2023-09-22 14:40 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-22 14:35 [edk2-devel] [PATCH v3 00/11] Update MADT for ACPI 6.5, and add TRBE & ETE support Sami Mujawar
2023-09-22 14:35 ` [edk2-devel] [PATCH v3 01/13] MdePkg: MADT: Add Online capable flag in GICC Sami Mujawar
2023-09-22 14:35 ` [edk2-devel] [PATCH v3 02/13] MdePkg: MADT: Add TRBE interrupt to GICC Sami Mujawar
2023-09-22 14:35 ` [edk2-devel] [PATCH v3 03/13] DynamicTablesPkg: Add TRBE interrupt to GICC object Sami Mujawar
2023-09-22 14:35 ` [edk2-devel] [PATCH v3 04/13] DynamicTablesPkg: Add TRBE interrupt to GICC object parser Sami Mujawar
2023-09-22 14:35 ` [edk2-devel] [PATCH v3 05/13] DynamicTablesPkg: Update MADT generator for ACPI 6.5 Sami Mujawar
2023-09-22 14:35 ` [edk2-devel] [PATCH v3 06/13] DynamicTablesPkg: Update FADT generator to " Sami Mujawar
2023-09-22 14:35 ` [edk2-devel] [PATCH v3 07/13] ShellPkg: Acpiview: Update MADT parser for TRBE interrupt Sami Mujawar
2023-09-22 14:35 ` [edk2-devel] [PATCH v3 08/13] DynamicTablesPkg: Add an ET info object to Arm namespace Sami Mujawar
2023-09-22 14:35 ` [edk2-devel] [PATCH v3 09/13] DynamicTablesPkg: Add an ET info object parser Sami Mujawar
2023-09-22 14:35 ` [edk2-devel] [PATCH v3 10/13] DynamicTablesPkg: Add ETE device to CPU node in AML Sami Mujawar
2023-09-22 14:35 ` [edk2-devel] [PATCH v3 11/13] DynamicTablesPkg: Fix referencing of CPC token Sami Mujawar
2023-09-22 14:35 ` Sami Mujawar [this message]
2023-09-22 14:35 ` [edk2-devel] [PATCH v3 13/13] ArmPkg/ArmLib: Add ArmHasEte () helper function Sami Mujawar
2023-09-22 14:50 ` [edk2-devel] [PATCH v3 00/11] Update MADT for ACPI 6.5, and add TRBE & ETE support PierreGondois
2023-10-23 15:30 ` Jeshua Smith via groups.io
2023-10-24 8:43 ` Sami Mujawar
2023-10-26 9:08 ` Gao, Zhichao
2023-10-30 14:16 ` Sami Mujawar
2023-09-22 16:19 ` Leif Lindholm
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=20230922143516.4764-13-sami.mujawar@arm.com \
--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