summaryrefslogtreecommitdiffstats
path: root/ArmPkg
diff options
context:
space:
mode:
authorLeif Lindholm <leif@nuviainc.com>2020-12-18 13:21:08 +0000
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2020-12-18 15:27:26 +0000
commit740b870dc8660906523c85187ab5badd2fd8ea08 (patch)
tree5c70ccf63b6ee66f59adf8e614759f76afac7c9b /ArmPkg
parent7bb8dd9f9844802eb6ae2c8fcd8c2ff613570583 (diff)
downloadedk2-740b870dc8660906523c85187ab5badd2fd8ea08.tar.gz
edk2-740b870dc8660906523c85187ab5badd2fd8ea08.tar.bz2
edk2-740b870dc8660906523c85187ab5badd2fd8ea08.zip
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>
Diffstat (limited to 'ArmPkg')
-rw-r--r--ArmPkg/Include/Library/ArmLib.h17
-rw-r--r--ArmPkg/Library/ArmLib/Arm/ArmV7Lib.c15
2 files changed, 32 insertions, 0 deletions
diff --git a/ArmPkg/Include/Library/ArmLib.h b/ArmPkg/Include/Library/ArmLib.h
index 8a364f2ca9..c2ed72112b 100644
--- a/ArmPkg/Include/Library/ArmLib.h
+++ b/ArmPkg/Include/Library/ArmLib.h
@@ -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__
diff --git a/ArmPkg/Library/ArmLib/Arm/ArmV7Lib.c b/ArmPkg/Library/ArmLib/Arm/ArmV7Lib.c
index 3faada3a65..9f81a72237 100644
--- a/ArmPkg/Library/ArmLib/Arm/ArmV7Lib.c
+++ b/ArmPkg/Library/ArmLib/Arm/ArmV7Lib.c
@@ -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);
+}