From: Pierre Gondois <pierre.gond...@arm.com> Add a ArmHasAesExt() to check for the FEAT_AES extension.
Signed-off-by: Pierre Gondois <pierre.gond...@arm.com> --- ArmPkg/Include/Library/ArmLib.h | 12 +++++++++++- ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c | 13 +++++++++++++ ArmPkg/Library/ArmLib/AArch64/AArch64Lib.h | 1 + ArmPkg/Library/ArmLib/Arm/ArmV7Lib.c | 13 +++++++++++++ ArmPkg/Library/ArmLib/Arm/ArmV7Lib.h | 2 ++ 5 files changed, 40 insertions(+), 1 deletion(-) diff --git a/ArmPkg/Include/Library/ArmLib.h b/ArmPkg/Include/Library/ArmLib.h index 8058634dbc53..5cd2bc1a26e5 100644 --- a/ArmPkg/Include/Library/ArmLib.h +++ b/ArmPkg/Include/Library/ArmLib.h @@ -1,7 +1,7 @@ /** @file Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR> - Copyright (c) 2011 - 2022, Arm Limited. All rights reserved.<BR> + Copyright (c) 2011 - 2022, Arm Ltd. All rights reserved.<BR> Copyright (c) 2020 - 2021, NUVIA Inc. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent @@ -779,6 +779,16 @@ ArmHasRngExt ( VOID ); +/** Check if FEAT_AES extension is available. + + @retval TRUE if FEAT_AES extension is available. + @retval FALSE otherwise. +**/ +BOOLEAN +ArmHasAesExt ( + VOID + ); + #ifdef MDE_CPU_ARM /// /// AArch32-only ID Register Helper functions diff --git a/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c b/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c index 124b28e16874..dac406362114 100644 --- a/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c +++ b/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c @@ -117,3 +117,16 @@ ArmHasRngExt ( { return ArmReadIdIsar0 () & ID_AA64ISAR0_EL1_RNDR_MASK; } + +/** Check if FEAT_AES extension is available. + + @retval TRUE if FEAT_AES extension is available. + @retval FALSE otherwise. +**/ +BOOLEAN +ArmHasAesExt ( + VOID + ) +{ + return ArmReadIdIsar0 () & ID_AA64ISAR0_EL1_AES_MASK; +} diff --git a/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.h b/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.h index 61a775ea27e8..9f5ad3e0214f 100644 --- a/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.h +++ b/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.h @@ -11,6 +11,7 @@ #ifndef AARCH64_LIB_H_ #define AARCH64_LIB_H_ +#define ID_AA64ISAR0_EL1_AES_MASK ((UINT64)0xF << 4U) #define ID_AA64ISAR0_EL1_RNDR_MASK ((UINT64)0xF << 60U) typedef VOID (*AARCH64_CACHE_OPERATION)( diff --git a/ArmPkg/Library/ArmLib/Arm/ArmV7Lib.c b/ArmPkg/Library/ArmLib/Arm/ArmV7Lib.c index a4ec23c8f8d8..ee3a847c1b50 100644 --- a/ArmPkg/Library/ArmLib/Arm/ArmV7Lib.c +++ b/ArmPkg/Library/ArmLib/Arm/ArmV7Lib.c @@ -133,3 +133,16 @@ ArmHasRngExt ( // Not supported. return FALSE; } + +/** Check if FEAT_AES extension is available. + + @retval TRUE if FEAT_AES extension is available. + @retval FALSE otherwise. +**/ +BOOLEAN +ArmHasAesExt ( + VOID + ) +{ + return ArmReadIdIsaR5 () & ID_ISAR5_AES_MASK; +} diff --git a/ArmPkg/Library/ArmLib/Arm/ArmV7Lib.h b/ArmPkg/Library/ArmLib/Arm/ArmV7Lib.h index 1cfd6e5f65ac..1b91db66fb43 100644 --- a/ArmPkg/Library/ArmLib/Arm/ArmV7Lib.h +++ b/ArmPkg/Library/ArmLib/Arm/ArmV7Lib.h @@ -10,6 +10,8 @@ #ifndef ARM_V7_LIB_H_ #define ARM_V7_LIB_H_ +#define ID_ISAR5_AES_MASK (0xF << 4U) + #define ID_MMFR0_SHARELVL_SHIFT 12 #define ID_MMFR0_SHARELVL_MASK 0xf #define ID_MMFR0_SHARELVL_ONE 0 -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#90882): https://edk2.groups.io/g/devel/message/90882 Mute This Topic: https://groups.io/mt/92066831/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-