diff --git a/core/arch/arm/include/arm.h b/core/arch/arm/include/arm.h index 1ec019f8ea0..3cae634c9db 100644 --- a/core/arch/arm/include/arm.h +++ b/core/arch/arm/include/arm.h @@ -187,6 +187,70 @@ static inline bool feat_crc32_implemented(void) #endif } +static inline bool feat_aes_implemented(void) +{ +#ifdef ARM32 + return read_id_isar5() & ID_ISAR5_AES; +#else + return read_id_aa64isar0_el1() & ID_AA64ISAR0_AES; +#endif +} + +static inline bool feat_sha1_implemented(void) +{ +#ifdef ARM32 + return read_id_isar5() & ID_ISAR5_SHA1; +#else + return read_id_aa64isar0_el1() & ID_AA64ISAR0_SHA1; +#endif +} + +static inline bool feat_sha256_implemented(void) +{ +#ifdef ARM32 + return read_id_isar5() & ID_ISAR5_SHA2; +#else + return read_id_aa64isar0_el1() & ID_AA64ISAR0_SHA2; +#endif +} + +static inline bool feat_sha512_implemented(void) +{ +#ifdef ARM32 + return false; +#else + return ((read_id_aa64isar0_el1() & ID_AA64ISAR0_SHA2) >> + ID_AA64ISAR0_SHA2_SHIFT) == ID_AA64ISAR0_SHA2_SHA512_FEAT; +#endif +} + +static inline bool feat_sha3_implemented(void) +{ +#ifdef ARM32 + return false; +#else + return read_id_aa64isar0_el1() & ID_AA64ISAR0_SHA3; +#endif +} + +static inline bool feat_sm3_implemented(void) +{ +#ifdef ARM32 + return false; +#else + return read_id_aa64isar0_el1() & ID_AA64ISAR0_SM3; +#endif +} + +static inline bool feat_sm4_implemented(void) +{ +#ifdef ARM32 + return false; +#else + return read_id_aa64isar0_el1() & ID_AA64ISAR0_SM4; +#endif +} + static inline bool feat_pauth_is_implemented(void) { #ifdef ARM32