]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg: add ArmHasSecurityExtensions () helper function
authorLeif Lindholm <leif@nuviainc.com>
Fri, 18 Dec 2020 13:21:08 +0000 (13:21 +0000)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Fri, 18 Dec 2020 15:27:26 +0000 (15:27 +0000)
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>
ArmPkg/Include/Library/ArmLib.h
ArmPkg/Library/ArmLib/Arm/ArmV7Lib.c

index 8a364f2ca96fef41eaef1faa7ad55b49d2dc757f..c2ed72112b73d2e36c11abecc167aa5edad68f4d 100644 (file)
@@ -733,4 +733,21 @@ ArmHasGicSystemRegisters (
   VOID\r
   );\r
 \r
+#ifdef MDE_CPU_ARM\r
+///\r
+/// AArch32-only ID Register Helper functions\r
+///\r
+/**\r
+  Check whether the CPU supports the Security extensions\r
+\r
+  @return   Whether the Security extensions are implemented\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+ArmHasSecurityExtensions (\r
+  VOID\r
+  );\r
+#endif // MDE_CPU_ARM\r
+\r
 #endif // __ARM_LIB__\r
index 3faada3a653945bc8a706ef288a152f499ae7859..9f81a7223732feb00404571ddc39a6079a584165 100644 (file)
@@ -87,3 +87,18 @@ ArmHasGicSystemRegisters (
 {\r
   return ((ArmReadIdPfr1 () & ARM_PFR1_GIC) != 0);\r
 }\r
+\r
+/**\r
+  Check whether the CPU supports the Security extensions\r
+\r
+  @return   Whether the Security extensions are implemented\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+ArmHasSecurityExtensions (\r
+  VOID\r
+  )\r
+{\r
+  return ((ArmReadIdPfr1 () & ARM_PFR1_SEC) != 0);\r
+}\r