Create a helper function to query whether ID_AA64MFR1_EL1 indicates presence of the Embedded Trace Extension (ETE). This feature is only visible in AARCH64 state.
Signed-off-by: Sami Mujawar <sami.muja...@arm.com> Cc: Ard Biesheuvel <ardb+tianoc...@kernel.org> Cc: Leif Lindholm <quic_llind...@quicinc.com> Cc: Pierre Gondois <pierre.gond...@arm.com> --- Notes: v3: - New patch in this series that introduces a helper [SAMI] function for platforms to query if ETE feature is supported. Ref: https://edk2.groups.io/g/devel/message/10898 ArmPkg/Include/Chipset/AArch64.h | 3 ++- ArmPkg/Include/Library/ArmLib.h | 12 ++++++++++++ ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c | 16 ++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/ArmPkg/Include/Chipset/AArch64.h b/ArmPkg/Include/Chipset/AArch64.h index d8711ad7112f1f983d22d98bdf8ff8607bf2ff98..5390bf0a2774fb410f33e031cb0367708905c658 100644 --- a/ArmPkg/Include/Chipset/AArch64.h +++ b/ArmPkg/Include/Chipset/AArch64.h @@ -32,7 +32,8 @@ #define AARCH64_PFR0_GIC (0xF << 24) // ID_AA64DFR0 - AArch64 Debug Feature Register 0 definitions -#define AARCH64_DFR0_TRBE (0xFULL << 44) +#define AARCH64_DFR0_TRACEVER (0xFULL << 4) +#define AARCH64_DFR0_TRBE (0xFULL << 44) // SCR - Secure Configuration Register definitions #define SCR_NS (1 << 0) diff --git a/ArmPkg/Include/Library/ArmLib.h b/ArmPkg/Include/Library/ArmLib.h index c2d738c06e27a3599b79c7bd83c72f8a696b4aef..6aa8a48f07f39255b70406774d2d803dbfc97b0b 100644 --- a/ArmPkg/Include/Library/ArmLib.h +++ b/ArmPkg/Include/Library/ArmLib.h @@ -793,6 +793,18 @@ ArmHasTrbe ( VOID ); +/** + Checks whether the CPU implements the Embedded Trace Extension. + + @retval TRUE FEAT_ETE is implemented. + @retval FALSE FEAT_ETE is not mplemented. +**/ +BOOLEAN +EFIAPI +ArmHasEte ( + 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 3a46f360ef512ed68f9ec80fc486551ff7440009..87285465871dc100ea0065659959ca845912c549 100644 --- a/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c +++ b/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c @@ -134,3 +134,19 @@ ArmHasTrbe ( { return ((ArmReadIdAA64Dfr0 () & AARCH64_DFR0_TRBE) != 0); } + +/** + Checks whether the CPU implements the Embedded Trace Extension. + + @retval TRUE FEAT_ETE is implemented. + @retval FALSE FEAT_ETE is not mplemented. +**/ +BOOLEAN +EFIAPI +ArmHasEte ( + VOID + ) +{ + // The ID_AA64DFR0_EL1.TraceVer field identifies the presence of FEAT_ETE. + return ((ArmReadIdAA64Dfr0 () & AARCH64_DFR0_TRACEVER) != 0); +} -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109006): https://edk2.groups.io/g/devel/message/109006 Mute This Topic: https://groups.io/mt/101522356/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-