diff options
author | Antonio Nino Diaz <antonio.ninodiaz@arm.com> | 2019-02-06 09:23:04 +0000 |
---|---|---|
committer | Antonio Nino Diaz <antonio.ninodiaz@arm.com> | 2019-02-06 09:54:42 +0000 |
commit | 29a24134c170af1cda1b59e5f47071c8353ce3b9 (patch) | |
tree | 4830fd15df3426b973522bc040e0ec69131c7c5b /include/arch | |
parent | a45ccf135e48efc70006055c32e8a89fddb38db2 (diff) |
drivers: generic_delay_timer: Assert presence of Generic Timer
The Generic Timer is an optional extension to an ARMv7-A implementation.
The generic delay timer can be used from any architecture supported by
the Trusted Firmware. In ARMv7 it is needed to check that this feature
is present. In ARMv8 it is always present.
Change-Id: Ib7e8ec13ffbb2f64445d4ee48ed00f26e34b79b7
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Diffstat (limited to 'include/arch')
-rw-r--r-- | include/arch/aarch32/arch.h | 2 | ||||
-rw-r--r-- | include/arch/aarch32/arch_features.h | 6 | ||||
-rw-r--r-- | include/arch/aarch64/arch_features.h | 6 |
3 files changed, 14 insertions, 0 deletions
diff --git a/include/arch/aarch32/arch.h b/include/arch/aarch32/arch.h index 4af3e903..3421e042 100644 --- a/include/arch/aarch32/arch.h +++ b/include/arch/aarch32/arch.h @@ -114,6 +114,8 @@ #define ID_PFR1_VIRTEXT_MASK U(0xf) #define GET_VIRT_EXT(id) (((id) >> ID_PFR1_VIRTEXT_SHIFT) \ & ID_PFR1_VIRTEXT_MASK) +#define ID_PFR1_GENTIMER_SHIFT U(16) +#define ID_PFR1_GENTIMER_MASK U(0xf) #define ID_PFR1_GIC_SHIFT U(28) #define ID_PFR1_GIC_MASK U(0xf) diff --git a/include/arch/aarch32/arch_features.h b/include/arch/aarch32/arch_features.h index d9341026..ddf09680 100644 --- a/include/arch/aarch32/arch_features.h +++ b/include/arch/aarch32/arch_features.h @@ -11,6 +11,12 @@ #include <arch_helpers.h> +static inline bool is_armv7_gentimer_present(void) +{ + return ((read_id_pfr1() >> ID_PFR1_GENTIMER_SHIFT) & + ID_PFR1_GENTIMER_MASK) != 0U; +} + static inline bool is_armv8_2_ttcnp_present(void) { return ((read_id_mmfr4() >> ID_MMFR4_CNP_SHIFT) & diff --git a/include/arch/aarch64/arch_features.h b/include/arch/aarch64/arch_features.h index 9bf43bf8..da8b6e4f 100644 --- a/include/arch/aarch64/arch_features.h +++ b/include/arch/aarch64/arch_features.h @@ -11,6 +11,12 @@ #include <arch_helpers.h> +static inline bool is_armv7_gentimer_present(void) +{ + /* The Generic Timer is always present in an ARMv8-A implementation */ + return true; +} + static inline bool is_armv8_2_ttcnp_present(void) { return ((read_id_aa64mmfr2_el1() >> ID_AA64MMFR2_EL1_CNP_SHIFT) & |