xref: /rk3399_ARM-atf/include/arch/aarch64/arch_features.h (revision 70b0f2789e93f253bec5cbd2986d0de023c1bdf4)
1 /*
2  * Copyright (c) 2019, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef ARCH_FEATURES_H
8 #define ARCH_FEATURES_H
9 
10 #include <stdbool.h>
11 
12 #include <arch_helpers.h>
13 
14 static inline bool is_armv7_gentimer_present(void)
15 {
16 	/* The Generic Timer is always present in an ARMv8-A implementation */
17 	return true;
18 }
19 
20 static inline bool is_armv8_2_ttcnp_present(void)
21 {
22 	return ((read_id_aa64mmfr2_el1() >> ID_AA64MMFR2_EL1_CNP_SHIFT) &
23 		ID_AA64MMFR2_EL1_CNP_MASK) != 0U;
24 }
25 
26 static inline bool is_armv8_4_ttst_present(void)
27 {
28 	return ((read_id_aa64mmfr2_el1() >> ID_AA64MMFR2_EL1_ST_SHIFT) &
29 		ID_AA64MMFR2_EL1_ST_MASK) == 1U;
30 }
31 
32 #endif /* ARCH_FEATURES_H */
33