diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/common/ep_info.h | 2 | ||||
-rw-r--r-- | include/drivers/arm/tzc_common.h | 4 | ||||
-rw-r--r-- | include/lib/aarch32/arch_helpers.h | 6 | ||||
-rw-r--r-- | include/lib/aarch64/arch_helpers.h | 27 | ||||
-rw-r--r-- | include/lib/bakery_lock.h | 40 | ||||
-rw-r--r-- | include/lib/el3_runtime/aarch32/context.h | 32 | ||||
-rw-r--r-- | include/lib/el3_runtime/aarch64/context.h | 6 | ||||
-rw-r--r-- | include/lib/el3_runtime/context_mgmt.h | 9 | ||||
-rw-r--r-- | include/lib/el3_runtime/cpu_data.h | 4 | ||||
-rw-r--r-- | include/lib/spinlock.h | 6 | ||||
-rw-r--r-- | include/plat/arm/board/common/v2m_def.h | 48 | ||||
-rw-r--r-- | include/plat/arm/common/arm_def.h | 10 | ||||
-rw-r--r-- | include/plat/arm/common/arm_dyn_cfg_helpers.h | 6 |
13 files changed, 115 insertions, 85 deletions
diff --git a/include/common/ep_info.h b/include/common/ep_info.h index bf3f78236..db2355ab8 100644 --- a/include/common/ep_info.h +++ b/include/common/ep_info.h @@ -30,7 +30,7 @@ #define PARAM_EP_SECURITY_MASK U(0x1) /* Secure or Non-secure image */ -#define GET_SECURITY_STATE(x) (x & PARAM_EP_SECURITY_MASK) +#define GET_SECURITY_STATE(x) ((x) & PARAM_EP_SECURITY_MASK) #define SET_SECURITY_STATE(x, security) \ ((x) = ((x) & ~PARAM_EP_SECURITY_MASK) | (security)) diff --git a/include/drivers/arm/tzc_common.h b/include/drivers/arm/tzc_common.h index dac79aa44..4b8154788 100644 --- a/include/drivers/arm/tzc_common.h +++ b/include/drivers/arm/tzc_common.h @@ -73,10 +73,10 @@ /* Macros for allowing Non-Secure access to a region based on NSAID */ #define TZC_REGION_ACCESS_RD(nsaid) \ - ((U(1) << (nsaid & TZC_REGION_ACCESS_ID_MASK)) << \ + ((U(1) << ((nsaid) & TZC_REGION_ACCESS_ID_MASK)) << \ TZC_REGION_ACCESS_RD_EN_SHIFT) #define TZC_REGION_ACCESS_WR(nsaid) \ - ((U(1) << (nsaid & TZC_REGION_ACCESS_ID_MASK)) << \ + ((U(1) << ((nsaid) & TZC_REGION_ACCESS_ID_MASK)) << \ TZC_REGION_ACCESS_WR_EN_SHIFT) #define TZC_REGION_ACCESS_RDWR(nsaid) \ (TZC_REGION_ACCESS_RD(nsaid) | \ diff --git a/include/lib/aarch32/arch_helpers.h b/include/lib/aarch32/arch_helpers.h index 5d9c1c151..03f0e869b 100644 --- a/include/lib/aarch32/arch_helpers.h +++ b/include/lib/aarch32/arch_helpers.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#ifndef __ARCH_HELPERS_H__ -#define __ARCH_HELPERS_H__ +#ifndef ARCH_HELPERS_H +#define ARCH_HELPERS_H #include <arch.h> /* for additional register definitions */ #include <cdefs.h> @@ -381,4 +381,4 @@ static inline unsigned int get_current_el(void) #define write_icc_sgi0r_el1(_v) \ write64_icc_sgi0r_el1(_v) -#endif /* __ARCH_HELPERS_H__ */ +#endif /* ARCH_HELPERS_H */ diff --git a/include/lib/aarch64/arch_helpers.h b/include/lib/aarch64/arch_helpers.h index d90061f27..61f9830dc 100644 --- a/include/lib/aarch64/arch_helpers.h +++ b/include/lib/aarch64/arch_helpers.h @@ -4,11 +4,12 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#ifndef __ARCH_HELPERS_H__ -#define __ARCH_HELPERS_H__ +#ifndef ARCH_HELPERS_H +#define ARCH_HELPERS_H #include <arch.h> /* for additional register definitions */ #include <cdefs.h> /* For __dead2 */ +#include <stdbool.h> #include <stdint.h> #include <string.h> @@ -363,12 +364,22 @@ static inline unsigned int get_current_el(void) } /* - * Check if an EL is implemented from AA64PFR0 register fields. 'el' argument - * must be one of 1, 2 or 3. + * Check if an EL is implemented from AA64PFR0 register fields. */ -#define EL_IMPLEMENTED(el) \ - ((read_id_aa64pfr0_el1() >> ID_AA64PFR0_EL##el##_SHIFT) \ - & ID_AA64PFR0_ELX_MASK) +static inline uint64_t el_implemented(unsigned int el) +{ + if (el > 3U) { + return EL_IMPL_NONE; + } else { + unsigned int shift = ID_AA64PFR0_EL1_SHIFT * el; + + return (read_id_aa64pfr0_el1() >> shift) & ID_AA64PFR0_ELX_MASK; + } +} + +#if !ERROR_DEPRECATED +#define EL_IMPLEMENTED(_el) el_implemented(_el) +#endif /* Previously defined accesor functions with incomplete register names */ @@ -389,4 +400,4 @@ static inline unsigned int get_current_el(void) #define read_cpacr() read_cpacr_el1() #define write_cpacr(_v) write_cpacr_el1(_v) -#endif /* __ARCH_HELPERS_H__ */ +#endif /* ARCH_HELPERS_H */ diff --git a/include/lib/bakery_lock.h b/include/lib/bakery_lock.h index c80082e9b..2d1612e17 100644 --- a/include/lib/bakery_lock.h +++ b/include/lib/bakery_lock.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#ifndef __BAKERY_LOCK_H__ -#define __BAKERY_LOCK_H__ +#ifndef BAKERY_LOCK_H +#define BAKERY_LOCK_H #include <platform_def.h> @@ -13,21 +13,39 @@ #ifndef __ASSEMBLY__ #include <cdefs.h> +#include <stdbool.h> #include <stdint.h> +#include <utils_def.h> /***************************************************************************** - * Internal helper macros used by the bakery lock implementation. + * Internal helpers used by the bakery lock implementation. ****************************************************************************/ + /* Convert a ticket to priority */ -#define PRIORITY(t, pos) (((t) << 8) | (pos)) +static inline unsigned int bakery_get_priority(unsigned int t, unsigned int pos) +{ + return (t << 8) | pos; +} + +#define CHOOSING_TICKET U(0x1) +#define CHOSEN_TICKET U(0x0) + +static inline bool bakery_is_choosing(unsigned int info) +{ + return (info & 1U) == CHOOSING_TICKET; +} + +static inline unsigned int bakery_ticket_number(unsigned int info) +{ + return (info >> 1) & 0x7FFFU; +} -#define CHOOSING_TICKET 0x1 -#define CHOSEN_TICKET 0x0 +static inline uint16_t make_bakery_data(unsigned int choosing, unsigned int num) +{ + unsigned int val = (choosing & 0x1U) | (num << 1); -#define bakery_is_choosing(info) (info & 0x1) -#define bakery_ticket_number(info) ((info >> 1) & 0x7FFF) -#define make_bakery_data(choosing, number) \ - (((choosing & 0x1) | (number << 1)) & 0xFFFF) + return (uint16_t) val; +} /***************************************************************************** * External bakery lock interface. @@ -83,4 +101,4 @@ void bakery_lock_release(bakery_lock_t *bakery); #endif /* __ASSEMBLY__ */ -#endif /* __BAKERY_LOCK_H__ */ +#endif /* BAKERY_LOCK_H */ diff --git a/include/lib/el3_runtime/aarch32/context.h b/include/lib/el3_runtime/aarch32/context.h index 644736053..1ea19ca7c 100644 --- a/include/lib/el3_runtime/aarch32/context.h +++ b/include/lib/el3_runtime/aarch32/context.h @@ -1,26 +1,28 @@ /* - * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ -#ifndef __CONTEXT_H__ -#define __CONTEXT_H__ +#ifndef CONTEXT_H +#define CONTEXT_H + +#include <utils_def.h> /******************************************************************************* * Constants that allow assembler code to access members of and the 'regs' * structure at their correct offsets. ******************************************************************************/ -#define CTX_REGS_OFFSET 0x0 -#define CTX_GPREG_R0 0x0 -#define CTX_GPREG_R1 0x4 -#define CTX_GPREG_R2 0x8 -#define CTX_GPREG_R3 0xC -#define CTX_LR 0x10 -#define CTX_SCR 0x14 -#define CTX_SPSR 0x18 -#define CTX_NS_SCTLR 0x1C -#define CTX_REGS_END 0x20 +#define CTX_REGS_OFFSET U(0x0) +#define CTX_GPREG_R0 U(0x0) +#define CTX_GPREG_R1 U(0x4) +#define CTX_GPREG_R2 U(0x8) +#define CTX_GPREG_R3 U(0xC) +#define CTX_LR U(0x10) +#define CTX_SCR U(0x14) +#define CTX_SPSR U(0x18) +#define CTX_NS_SCTLR U(0x1C) +#define CTX_REGS_END U(0x20) #ifndef __ASSEMBLY__ @@ -31,7 +33,7 @@ * Common constants to help define the 'cpu_context' structure and its * members below. */ -#define WORD_SHIFT 2 +#define WORD_SHIFT U(2) #define DEFINE_REG_STRUCT(name, num_regs) \ typedef struct name { \ uint32_t _regs[num_regs]; \ @@ -64,4 +66,4 @@ CASSERT(CTX_REGS_OFFSET == __builtin_offsetof(cpu_context_t, regs_ctx), \ #endif /* __ASSEMBLY__ */ -#endif /* __CONTEXT_H__ */ +#endif /* CONTEXT_H */ diff --git a/include/lib/el3_runtime/aarch64/context.h b/include/lib/el3_runtime/aarch64/context.h index b990674c7..8c5f4c68d 100644 --- a/include/lib/el3_runtime/aarch64/context.h +++ b/include/lib/el3_runtime/aarch64/context.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#ifndef __CONTEXT_H__ -#define __CONTEXT_H__ +#ifndef CONTEXT_H +#define CONTEXT_H #include <utils_def.h> @@ -347,4 +347,4 @@ void fpregs_context_restore(fp_regs_t *regs); #endif /* __ASSEMBLY__ */ -#endif /* __CONTEXT_H__ */ +#endif /* CONTEXT_H */ diff --git a/include/lib/el3_runtime/context_mgmt.h b/include/lib/el3_runtime/context_mgmt.h index c5bbb2b43..149ac3ffd 100644 --- a/include/lib/el3_runtime/context_mgmt.h +++ b/include/lib/el3_runtime/context_mgmt.h @@ -1,16 +1,15 @@ /* - * Copyright (c) 2013-2017, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ -#ifndef __CM_H__ -#define __CM_H__ +#ifndef CONTEXT_MGMT_H +#define CONTEXT_MGMT_H #include <arch.h> #include <assert.h> #include <context.h> -#include <context_mgmt.h> #include <stdint.h> /******************************************************************************* @@ -80,4 +79,4 @@ void *cm_get_next_context(void); void cm_set_next_context(void *context); #endif /* AARCH32 */ -#endif /* __CM_H__ */ +#endif /* CONTEXT_MGMT_H */ diff --git a/include/lib/el3_runtime/cpu_data.h b/include/lib/el3_runtime/cpu_data.h index b6959509c..561f8beed 100644 --- a/include/lib/el3_runtime/cpu_data.h +++ b/include/lib/el3_runtime/cpu_data.h @@ -144,9 +144,9 @@ void init_cpu_data_ptr(void); void init_cpu_ops(void); #define get_cpu_data(_m) _cpu_data()->_m -#define set_cpu_data(_m, _v) _cpu_data()->_m = _v +#define set_cpu_data(_m, _v) _cpu_data()->_m = (_v) #define get_cpu_data_by_index(_ix, _m) _cpu_data_by_index(_ix)->_m -#define set_cpu_data_by_index(_ix, _m, _v) _cpu_data_by_index(_ix)->_m = _v +#define set_cpu_data_by_index(_ix, _m, _v) _cpu_data_by_index(_ix)->_m = (_v) /* ((cpu_data_t *)0)->_m is a dummy to get the sizeof the struct member _m */ #define flush_cpu_data(_m) flush_dcache_range((uintptr_t) \ &(_cpu_data()->_m), \ diff --git a/include/lib/spinlock.h b/include/lib/spinlock.h index 8aec70789..fcd36e856 100644 --- a/include/lib/spinlock.h +++ b/include/lib/spinlock.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#ifndef __SPINLOCK_H__ -#define __SPINLOCK_H__ +#ifndef SPINLOCK_H +#define SPINLOCK_H #ifndef __ASSEMBLY__ @@ -26,4 +26,4 @@ void spin_unlock(spinlock_t *lock); #endif -#endif /* __SPINLOCK_H__ */ +#endif /* SPINLOCK_H */ diff --git a/include/plat/arm/board/common/v2m_def.h b/include/plat/arm/board/common/v2m_def.h index 4a1d43c85..ed57fc9a0 100644 --- a/include/plat/arm/board/common/v2m_def.h +++ b/include/plat/arm/board/common/v2m_def.h @@ -48,9 +48,9 @@ #define V2M_SYS_LED_EL_SHIFT 0x1 #define V2M_SYS_LED_EC_SHIFT 0x3 -#define V2M_SYS_LED_SS_MASK 0x1 -#define V2M_SYS_LED_EL_MASK 0x3 -#define V2M_SYS_LED_EC_MASK 0x1f +#define V2M_SYS_LED_SS_MASK U(0x1) +#define V2M_SYS_LED_EL_MASK U(0x3) +#define V2M_SYS_LED_EC_MASK U(0x1f) /* V2M sysid register bits */ #define V2M_SYS_ID_REV_SHIFT 28 @@ -59,28 +59,28 @@ #define V2M_SYS_ID_ARCH_SHIFT 8 #define V2M_SYS_ID_FPGA_SHIFT 0 -#define V2M_SYS_ID_REV_MASK 0xf -#define V2M_SYS_ID_HBI_MASK 0xfff -#define V2M_SYS_ID_BLD_MASK 0xf -#define V2M_SYS_ID_ARCH_MASK 0xf -#define V2M_SYS_ID_FPGA_MASK 0xff +#define V2M_SYS_ID_REV_MASK U(0xf) +#define V2M_SYS_ID_HBI_MASK U(0xfff) +#define V2M_SYS_ID_BLD_MASK U(0xf) +#define V2M_SYS_ID_ARCH_MASK U(0xf) +#define V2M_SYS_ID_FPGA_MASK U(0xff) #define V2M_SYS_ID_BLD_LENGTH 4 /* NOR Flash */ -#define V2M_FLASH0_BASE 0x08000000 -#define V2M_FLASH0_SIZE 0x04000000 -#define V2M_FLASH_BLOCK_SIZE 0x00040000 /* 256 KB */ +#define V2M_FLASH0_BASE UL(0x08000000) +#define V2M_FLASH0_SIZE UL(0x04000000) +#define V2M_FLASH_BLOCK_SIZE UL(0x00040000) /* 256 KB */ -#define V2M_IOFPGA_BASE 0x1c000000 -#define V2M_IOFPGA_SIZE 0x03000000 +#define V2M_IOFPGA_BASE UL(0x1c000000) +#define V2M_IOFPGA_SIZE UL(0x03000000) /* PL011 UART related constants */ -#define V2M_IOFPGA_UART0_BASE 0x1c090000 -#define V2M_IOFPGA_UART1_BASE 0x1c0a0000 -#define V2M_IOFPGA_UART2_BASE 0x1c0b0000 -#define V2M_IOFPGA_UART3_BASE 0x1c0c0000 +#define V2M_IOFPGA_UART0_BASE UL(0x1c090000) +#define V2M_IOFPGA_UART1_BASE UL(0x1c0a0000) +#define V2M_IOFPGA_UART2_BASE UL(0x1c0b0000) +#define V2M_IOFPGA_UART3_BASE UL(0x1c0c0000) #define V2M_IOFPGA_UART0_CLK_IN_HZ 24000000 #define V2M_IOFPGA_UART1_CLK_IN_HZ 24000000 @@ -88,15 +88,15 @@ #define V2M_IOFPGA_UART3_CLK_IN_HZ 24000000 /* SP804 timer related constants */ -#define V2M_SP804_TIMER0_BASE 0x1C110000 -#define V2M_SP804_TIMER1_BASE 0x1C120000 +#define V2M_SP804_TIMER0_BASE UL(0x1C110000) +#define V2M_SP804_TIMER1_BASE UL(0x1C120000) /* SP810 controller */ -#define V2M_SP810_BASE 0x1c020000 -#define V2M_SP810_CTRL_TIM0_SEL (1 << 15) -#define V2M_SP810_CTRL_TIM1_SEL (1 << 17) -#define V2M_SP810_CTRL_TIM2_SEL (1 << 19) -#define V2M_SP810_CTRL_TIM3_SEL (1 << 21) +#define V2M_SP810_BASE UL(0x1c020000) +#define V2M_SP810_CTRL_TIM0_SEL BIT_32(15) +#define V2M_SP810_CTRL_TIM1_SEL BIT_32(17) +#define V2M_SP810_CTRL_TIM2_SEL BIT_32(19) +#define V2M_SP810_CTRL_TIM3_SEL BIT_32(21) /* * The flash can be mapped either as read-only or read-write. diff --git a/include/plat/arm/common/arm_def.h b/include/plat/arm/common/arm_def.h index 0f5b57f4f..088d59dca 100644 --- a/include/plat/arm/common/arm_def.h +++ b/include/plat/arm/common/arm_def.h @@ -21,7 +21,7 @@ *****************************************************************************/ /* Special value used to verify platform parameters from BL2 to BL31 */ -#define ARM_BL31_PLAT_PARAM_VAL 0x0f1e2d3c4b5a6978ULL +#define ARM_BL31_PLAT_PARAM_VAL ULL(0x0f1e2d3c4b5a6978) #define ARM_SYSTEM_COUNT 1 @@ -350,8 +350,8 @@ * To enable TB_FW_CONFIG to be loaded by BL1, define the corresponding base * and limit. Leave enough space of BL2 meminfo. */ -#define ARM_TB_FW_CONFIG_BASE ARM_BL_RAM_BASE + sizeof(meminfo_t) -#define ARM_TB_FW_CONFIG_LIMIT ARM_BL_RAM_BASE + PAGE_SIZE +#define ARM_TB_FW_CONFIG_BASE (ARM_BL_RAM_BASE + sizeof(meminfo_t)) +#define ARM_TB_FW_CONFIG_LIMIT (ARM_BL_RAM_BASE + PAGE_SIZE) /******************************************************************************* * BL1 specific defines. @@ -482,7 +482,7 @@ # define TSP_SEC_MEM_SIZE PLAT_ARM_TRUSTED_DRAM_SIZE # define BL32_BASE PLAT_ARM_TRUSTED_DRAM_BASE # define BL32_LIMIT (PLAT_ARM_TRUSTED_DRAM_BASE \ - + (1 << 21)) + + (UL(1) << 21)) # elif ARM_TSP_RAM_LOCATION_ID == ARM_DRAM_ID # define TSP_SEC_MEM_BASE ARM_AP_TZC_DRAM1_BASE # define TSP_SEC_MEM_SIZE ARM_AP_TZC_DRAM1_SIZE @@ -511,7 +511,7 @@ #define BL2U_LIMIT BL2_LIMIT #define NS_BL2U_BASE ARM_NS_DRAM1_BASE -#define NS_BL1U_BASE (PLAT_ARM_NVM_BASE + 0x03EB8000) +#define NS_BL1U_BASE (PLAT_ARM_NVM_BASE + UL(0x03EB8000)) /* * ID of the secure physical generic timer interrupt used by the TSP. diff --git a/include/plat/arm/common/arm_dyn_cfg_helpers.h b/include/plat/arm/common/arm_dyn_cfg_helpers.h index cb17c95f2..3ad6d5468 100644 --- a/include/plat/arm/common/arm_dyn_cfg_helpers.h +++ b/include/plat/arm/common/arm_dyn_cfg_helpers.h @@ -3,8 +3,8 @@ * * SPDX-License-Identifier: BSD-3-Clause */ -#ifndef __ARM_DYN_CFG_HELPERS_H__ -#define __ARM_DYN_CFG_HELPERS_H__ +#ifndef ARM_DYN_CFG_HELPERS_H +#define ARM_DYN_CFG_HELPERS_H #include <stddef.h> #include <stdint.h> @@ -19,4 +19,4 @@ int arm_get_dtb_mbedtls_heap_info(void *dtb, void **heap_addr, int arm_set_dtb_mbedtls_heap_info(void *dtb, void *heap_addr, size_t heap_size); -#endif /* __ARM_DYN_CFG_HELPERS_H__ */ +#endif /* ARM_DYN_CFG_HELPERS_H */ |