Skip to content

Commit

Permalink
ArmPkg/ArmLib: Add ArmHasEte () helper function
Browse files Browse the repository at this point in the history
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.

Cc: Ard Biesheuvel <[email protected]>
Cc: Leif Lindholm <[email protected]>
Cc: Pierre Gondois <[email protected]>
Signed-off-by: Sami Mujawar <[email protected]>
Reviewed-by: Leif Lindholm <[email protected]>
Reviewed-by: Pierre Gondois <[email protected]>
  • Loading branch information
samimujawar authored and mergify[bot] committed Oct 30, 2023
1 parent 0843108 commit a671a14
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ArmPkg/Include/Chipset/AArch64.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 12 additions & 0 deletions ArmPkg/Include/Library/ArmLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit a671a14

Please sign in to comment.