diff options
Diffstat (limited to 'include/lib')
| -rw-r--r-- | include/lib/aarch32/arch.h | 7 | ||||
| -rw-r--r-- | include/lib/aarch64/arch.h | 7 | ||||
| -rw-r--r-- | include/lib/utils_def.h | 26 |
3 files changed, 39 insertions, 1 deletions
diff --git a/include/lib/aarch32/arch.h b/include/lib/aarch32/arch.h index 3624cc68..910341a7 100644 --- a/include/lib/aarch32/arch.h +++ b/include/lib/aarch32/arch.h @@ -379,6 +379,7 @@ * Definitions of register offsets and fields in the CNTCTLBase Frame of the * system level implementation of the Generic Timer. ******************************************************************************/ +#define CNTCTLBASE_CNTFRQ U(0x0) #define CNTNSAR 0x4 #define CNTNSAR_NS_SHIFT(x) (x) @@ -390,6 +391,12 @@ #define CNTACR_RWVT_SHIFT 0x4 #define CNTACR_RWPT_SHIFT 0x5 +/******************************************************************************* + * Definitions of register offsets in the CNTBaseN Frame of the + * system level implementation of the Generic Timer. + ******************************************************************************/ +#define CNTBASE_CNTFRQ U(0x10) + /* MAIR macros */ #define MAIR0_ATTR_SET(attr, index) ((attr) << ((index) << 3)) #define MAIR1_ATTR_SET(attr, index) ((attr) << (((index) - 3) << 3)) diff --git a/include/lib/aarch64/arch.h b/include/lib/aarch64/arch.h index 92bb97d5..7cc4b237 100644 --- a/include/lib/aarch64/arch.h +++ b/include/lib/aarch64/arch.h @@ -554,6 +554,7 @@ * Definitions of register offsets and fields in the CNTCTLBase Frame of the * system level implementation of the Generic Timer. ******************************************************************************/ +#define CNTCTLBASE_CNTFRQ U(0x0) #define CNTNSAR U(0x4) #define CNTNSAR_NS_SHIFT(x) (x) @@ -565,6 +566,12 @@ #define CNTACR_RWVT_SHIFT U(0x4) #define CNTACR_RWPT_SHIFT U(0x5) +/******************************************************************************* + * Definitions of register offsets in the CNTBaseN Frame of the + * system level implementation of the Generic Timer. + ******************************************************************************/ +#define CNTBASE_CNTFRQ U(0x10) + /* PMCR_EL0 definitions */ #define PMCR_EL0_RESET_VAL U(0x0) #define PMCR_EL0_N_SHIFT U(11) diff --git a/include/lib/utils_def.h b/include/lib/utils_def.h index 31b12945..7335103b 100644 --- a/include/lib/utils_def.h +++ b/include/lib/utils_def.h @@ -16,7 +16,31 @@ #define SIZE_FROM_LOG2_WORDS(n) (4 << (n)) -#define BIT(nr) (ULL(1) << (nr)) +#define BIT_32(nr) (U(1) << (nr)) +#define BIT_64(nr) (ULL(1) << (nr)) + +#ifdef AARCH32 +#define BIT BIT_32 +#else +#define BIT BIT_64 +#endif + +/* + * Create a contiguous bitmask starting at bit position @l and ending at + * position @h. For example + * GENMASK_64(39, 21) gives us the 64bit vector 0x000000ffffe00000. + */ +#define GENMASK_32(h, l) \ + (((~UINT32_C(0)) << (l)) & (~UINT32_C(0) >> (32 - 1 - (h)))) + +#define GENMASK_64(h, l) \ + (((~UINT64_C(0)) << (l)) & (~UINT64_C(0) >> (64 - 1 - (h)))) + +#ifdef AARCH32 +#define GENMASK GENMASK_32 +#else +#define GENMASK GENMASK_64 +#endif /* * This variant of div_round_up can be used in macro definition but should not |
