diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/arm/gic/gic_v3.c | 2 | ||||
-rw-r--r-- | drivers/arm/tzc/tzc_dmc500.c | 18 | ||||
-rw-r--r-- | drivers/auth/auth_mod.c | 4 | ||||
-rw-r--r-- | drivers/auth/crypto_mod.c | 3 | ||||
-rw-r--r-- | drivers/auth/mbedtls/mbedtls_common.c | 3 | ||||
-rw-r--r-- | drivers/console/aarch64/multi_console.S | 53 |
6 files changed, 70 insertions, 13 deletions
diff --git a/drivers/arm/gic/gic_v3.c b/drivers/arm/gic/gic_v3.c index 3e802fddb..548681791 100644 --- a/drivers/arm/gic/gic_v3.c +++ b/drivers/arm/gic/gic_v3.c @@ -8,7 +8,7 @@ #include <debug.h> #include <gic_v3.h> -uintptr_t gicv3_get_rdist(uintptr_t gicr_base, uint64_t mpidr) +uintptr_t gicv3_get_rdist(uintptr_t gicr_base, u_register_t mpidr) { uint32_t cpu_aff, gicr_aff; uint64_t gicr_typer; diff --git a/drivers/arm/tzc/tzc_dmc500.c b/drivers/arm/tzc/tzc_dmc500.c index 7350b2ceb..8b618e6d7 100644 --- a/drivers/arm/tzc/tzc_dmc500.c +++ b/drivers/arm/tzc/tzc_dmc500.c @@ -25,6 +25,7 @@ /* Pointer to the tzc_dmc500_driver_data structure populated by the platform */ static const tzc_dmc500_driver_data_t *g_driver_data; +static unsigned int g_sys_if_count; #define verify_region_attr(region, attr) \ ((g_conf_regions[(region)].sec_attr == \ @@ -88,7 +89,7 @@ void tzc_dmc500_config_complete(void) for (dmc_inst = 0; dmc_inst < g_driver_data->dmc_count; dmc_inst++) { assert(DMC_INST_BASE_ADDR(dmc_inst)); - for (sys_if = 0; sys_if < MAX_SYS_IF_COUNT; sys_if++) + for (sys_if = 0; sys_if < g_sys_if_count; sys_if++) _tzc_dmc500_write_flush_control( DMC_INST_SI_BASE(dmc_inst, sys_if)); } @@ -119,7 +120,7 @@ int tzc_dmc500_verify_complete(void) for (dmc_inst = 0; dmc_inst < g_driver_data->dmc_count; dmc_inst++) { assert(DMC_INST_BASE_ADDR(dmc_inst)); - for (sys_if = 0; sys_if < MAX_SYS_IF_COUNT; + for (sys_if = 0; sys_if < g_sys_if_count; sys_if++) { attr = _tzc_dmc500_read_region_attr_0( DMC_INST_SI_BASE(dmc_inst, sys_if), @@ -154,7 +155,7 @@ void tzc_dmc500_configure_region0(tzc_region_attributes_t sec_attr, /* Configure region_0 in all DMC instances */ for (dmc_inst = 0; dmc_inst < g_driver_data->dmc_count; dmc_inst++) { assert(DMC_INST_BASE_ADDR(dmc_inst)); - for (sys_if = 0; sys_if < MAX_SYS_IF_COUNT; sys_if++) + for (sys_if = 0; sys_if < g_sys_if_count; sys_if++) _tzc_dmc500_configure_region0( DMC_INST_SI_BASE(dmc_inst, sys_if), sec_attr, nsaid_permissions); @@ -195,7 +196,7 @@ void tzc_dmc500_configure_region(int region_no, for (dmc_inst = 0; dmc_inst < g_driver_data->dmc_count; dmc_inst++) { assert(DMC_INST_BASE_ADDR(dmc_inst)); - for (sys_if = 0; sys_if < MAX_SYS_IF_COUNT; sys_if++) + for (sys_if = 0; sys_if < g_sys_if_count; sys_if++) _tzc_dmc500_configure_region( DMC_INST_SI_BASE(dmc_inst, sys_if), TZC_DMC500_REGION_ATTR_F_EN_MASK, @@ -272,4 +273,13 @@ void tzc_dmc500_driver_init(const tzc_dmc500_driver_data_t *plat_driver_data) /* Validates the information passed by platform */ validate_plat_driver_data(plat_driver_data); g_driver_data = plat_driver_data; + + /* Check valid system interface count */ + assert(g_driver_data->sys_if_count <= MAX_SYS_IF_COUNT); + + g_sys_if_count = g_driver_data->sys_if_count; + + /* If interface count is not present then assume max */ + if (g_sys_if_count == 0U) + g_sys_if_count = MAX_SYS_IF_COUNT; } diff --git a/drivers/auth/auth_mod.c b/drivers/auth/auth_mod.c index 1cea60b22..eb537b66a 100644 --- a/drivers/auth/auth_mod.c +++ b/drivers/auth/auth_mod.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -30,7 +30,7 @@ /* Pointer to CoT */ extern const auth_img_desc_t *const cot_desc_ptr; -extern unsigned int auth_img_flags[]; +extern unsigned int auth_img_flags[MAX_NUMBER_IDS]; static int cmp_auth_param_type_desc(const auth_param_type_desc_t *a, const auth_param_type_desc_t *b) diff --git a/drivers/auth/crypto_mod.c b/drivers/auth/crypto_mod.c index 3b3e3ac49..4cd05506b 100644 --- a/drivers/auth/crypto_mod.c +++ b/drivers/auth/crypto_mod.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -9,7 +9,6 @@ #include <debug.h> /* Variable exported by the crypto library through REGISTER_CRYPTO_LIB() */ -extern const crypto_lib_desc_t crypto_lib_desc; /* * The crypto module is responsible for verifying digital signatures and hashes. diff --git a/drivers/auth/mbedtls/mbedtls_common.c b/drivers/auth/mbedtls/mbedtls_common.c index 205c2432a..c048d005a 100644 --- a/drivers/auth/mbedtls/mbedtls_common.c +++ b/drivers/auth/mbedtls/mbedtls_common.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -10,6 +10,7 @@ #include <mbedtls/memory_buffer_alloc.h> #include <mbedtls/platform.h> #include <mbedtls_config.h> +#include <mbedtls_common.h> /* * mbed TLS heap diff --git a/drivers/console/aarch64/multi_console.S b/drivers/console/aarch64/multi_console.S index 15c3ba43d..a85a6a568 100644 --- a/drivers/console/aarch64/multi_console.S +++ b/drivers/console/aarch64/multi_console.S @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -10,7 +10,8 @@ .globl console_register .globl console_unregister - .globl console_set_scope + .globl console_is_registered + .globl console_set_scope .globl console_switch_state .globl console_putc .globl console_getc @@ -38,13 +39,15 @@ * persistent memory (e.g. the data section). * In : x0 - address of console_t structure * Out: x0 - Always 1 (for easier tail calling) - * Clobber list: x0, x1, x14 + * Clobber list: x0, x1, x14, x15 * ----------------------------------------------- */ func console_register #if ENABLE_ASSERTIONS + /* Assert that x0 isn't a NULL pointer */ cmp x0, #0 ASM_ASSERT(ne) + /* Assert that the struct isn't in the stack */ adrp x1, __STACKS_START__ add x1, x1, :lo12:__STACKS_START__ cmp x0, x1 @@ -54,6 +57,14 @@ func console_register cmp x0, x1 ASM_ASSERT(hs) not_on_stack: + /* Assert that this struct isn't in the list */ + mov x1, x0 /* Preserve x0 and x30 */ + mov x15, x30 + bl console_is_registered + cmp x0, #0 + ASM_ASSERT(eq) + mov x30, x15 + mov x0, x1 #endif /* ENABLE_ASSERTIONS */ adrp x14, console_list ldr x1, [x14, :lo12:console_list] /* X1 = first struct in list */ @@ -73,6 +84,11 @@ endfunc console_register * ----------------------------------------------- */ func console_unregister +#if ENABLE_ASSERTIONS + /* Assert that x0 isn't a NULL pointer */ + cmp x0, #0 + ASM_ASSERT(ne) +#endif /* ENABLE_ASSERTIONS */ adrp x14, console_list add x14, x14, :lo12:console_list /* X14 = ptr to first struct */ ldr x1, [x14] /* X1 = first struct */ @@ -96,6 +112,37 @@ unregister_not_found: endfunc console_unregister /* ----------------------------------------------- + * int console_is_registered(console_t *console) + * Function to detect if a specific console is + * registered or not. + * In: x0 - address of console_t struct to remove + * Out: x0 - 1 if it is registered, 0 if not. + * Clobber list: x0, x14 + * ----------------------------------------------- + */ +func console_is_registered +#if ENABLE_ASSERTIONS + /* Assert that x0 isn't a NULL pointer */ + cmp x0, #0 + ASM_ASSERT(ne) +#endif /* ENABLE_ASSERTIONS */ + adrp x14, console_list + ldr x14, [x14, :lo12:console_list] /* X14 = first console struct */ +check_registered_loop: + cbz x14, console_not_registered /* Check if end of list */ + cmp x0, x14 /* Check if the pointers are different */ + b.eq console_registered + ldr x14, [x14, #CONSOLE_T_NEXT] /* Get pointer to next struct */ + b check_registered_loop +console_not_registered: + mov x0, #0 + ret +console_registered: + mov x0, #1 + ret +endfunc console_is_registered + + /* ----------------------------------------------- * void console_switch_state(unsigned int new_state) * Function to switch the current console state. * The console state determines which of the |