ArmPkg: add ArmHasSecurityExtensions () helper function

Create a helper function to eliminate direct feature register reading.

Returns BOOLEAN True if the CPU implements the Security extensions,
otherwise returns BOOL False.

This function is only implemented for ARM, not AArch64.

Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Leif Lindholm <leif@nuviainc.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
This commit is contained in:
Leif Lindholm 2020-12-18 13:21:08 +00:00 committed by mergify[bot]
parent 7bb8dd9f98
commit 740b870dc8
2 changed files with 32 additions and 0 deletions

View File

@ -733,4 +733,21 @@ ArmHasGicSystemRegisters (
VOID
);
#ifdef MDE_CPU_ARM
///
/// AArch32-only ID Register Helper functions
///
/**
Check whether the CPU supports the Security extensions
@return Whether the Security extensions are implemented
**/
BOOLEAN
EFIAPI
ArmHasSecurityExtensions (
VOID
);
#endif // MDE_CPU_ARM
#endif // __ARM_LIB__

View File

@ -87,3 +87,18 @@ ArmHasGicSystemRegisters (
{
return ((ArmReadIdPfr1 () & ARM_PFR1_GIC) != 0);
}
/**
Check whether the CPU supports the Security extensions
@return Whether the Security extensions are implemented
**/
BOOLEAN
EFIAPI
ArmHasSecurityExtensions (
VOID
)
{
return ((ArmReadIdPfr1 () & ARM_PFR1_SEC) != 0);
}