diff --git a/Makefile b/Makefile index 87e35e9..db15930 100644 --- a/Makefile +++ b/Makefile @@ -200,6 +200,8 @@ ${STDLIB_SRCS} INCLUDES += -Iinclude/bl1 \ + -Iinclude/bl2 \ + -Iinclude/bl2u \ -Iinclude/bl31 \ -Iinclude/common \ -Iinclude/common/${ARCH} \ diff --git a/bl2/aarch64/bl2_arch_setup.c b/bl2/aarch64/bl2_arch_setup.c index 038a075..54052f7 100644 --- a/bl2/aarch64/bl2_arch_setup.c +++ b/bl2/aarch64/bl2_arch_setup.c @@ -1,11 +1,12 @@ /* - * Copyright (c) 2013-2014, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ #include #include +#include "../bl2_private.h" /******************************************************************************* * Place holder function to perform any S-EL1 specific architectural setup. At diff --git a/bl2/bl2_main.c b/bl2/bl2_main.c index c85db2d..41d1745 100644 --- a/bl2/bl2_main.c +++ b/bl2/bl2_main.c @@ -1,5 +1,5 @@ /* - * 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 */ @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include diff --git a/bl2/bl2_private.h b/bl2/bl2_private.h index ea2f33a..50295d6 100644 --- a/bl2/bl2_private.h +++ b/bl2/bl2_private.h @@ -1,5 +1,5 @@ /* - * 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 */ @@ -17,6 +17,6 @@ *****************************************/ void bl2_arch_setup(void); struct entry_point_info *bl2_load_images(void); -void bl2_run_next_image(const entry_point_info_t *bl_ep_info); +void bl2_run_next_image(const struct entry_point_info *bl_ep_info); #endif /* __BL2_PRIVATE_H__ */ diff --git a/bl2u/bl2u_main.c b/bl2u/bl2u_main.c index 09ad468..a7e3fb9 100644 --- a/bl2u/bl2u_main.c +++ b/bl2u/bl2u_main.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 */ @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include diff --git a/bl31/bl31_main.c b/bl31/bl31_main.c index a34cf86..0664741 100644 --- a/bl31/bl31_main.c +++ b/bl31/bl31_main.c @@ -1,5 +1,5 @@ /* - * 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 */ @@ -17,6 +17,7 @@ #include #include #include +#include #include #if ENABLE_RUNTIME_INSTRUMENTATION diff --git a/drivers/arm/gic/common/gic_common_private.h b/drivers/arm/gic/common/gic_common_private.h index 2021f9a..fa34e47 100644 --- a/drivers/arm/gic/common/gic_common_private.h +++ b/drivers/arm/gic/common/gic_common_private.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -49,6 +49,9 @@ unsigned int gicd_read_ipriorityr(uintptr_t base, unsigned int id); unsigned int gicd_read_icfgr(uintptr_t base, unsigned int id); unsigned int gicd_read_nsacr(uintptr_t base, unsigned int id); +unsigned int gicd_read_spendsgir(uintptr_t base, unsigned int id); +unsigned int gicd_read_cpendsgir(uintptr_t base, unsigned int id); +unsigned int gicd_read_itargetsr(uintptr_t base, unsigned int id); void gicd_write_igroupr(uintptr_t base, unsigned int id, unsigned int val); void gicd_write_isenabler(uintptr_t base, unsigned int id, unsigned int val); void gicd_write_icenabler(uintptr_t base, unsigned int id, unsigned int val); @@ -59,6 +62,9 @@ void gicd_write_ipriorityr(uintptr_t base, unsigned int id, unsigned int val); void gicd_write_icfgr(uintptr_t base, unsigned int id, unsigned int val); void gicd_write_nsacr(uintptr_t base, unsigned int id, unsigned int val); +void gicd_write_spendsgir(uintptr_t base, unsigned int id, unsigned int val); +void gicd_write_cpendsgir(uintptr_t base, unsigned int id, unsigned int val); +void gicd_write_itargetsr(uintptr_t base, unsigned int id, unsigned int val); /******************************************************************************* * GIC Distributor function prototypes for accessing the GIC registers diff --git a/drivers/arm/gic/v2/gicv2_helpers.c b/drivers/arm/gic/v2/gicv2_helpers.c index 0df50fb..421669f 100644 --- a/drivers/arm/gic/v2/gicv2_helpers.c +++ b/drivers/arm/gic/v2/gicv2_helpers.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 */ @@ -9,6 +9,7 @@ #include #include #include +#include #include #include "../common/gic_common_private.h" #include "gicv2_private.h" diff --git a/drivers/arm/gic/v2/gicv2_main.c b/drivers/arm/gic/v2/gicv2_main.c index 8798659..c65f972 100644 --- a/drivers/arm/gic/v2/gicv2_main.c +++ b/drivers/arm/gic/v2/gicv2_main.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 */ @@ -22,7 +22,7 @@ * spinlock are used either at boot time (when only a single CPU is active), or * when the system is fully coherent. */ -spinlock_t gic_lock; +static spinlock_t gic_lock; /******************************************************************************* * Enable secure interrupts and use FIQs to route them. Disable legacy bypass diff --git a/drivers/io/io_fip.c b/drivers/io/io_fip.c index a23940d..487f586 100644 --- a/drivers/io/io_fip.c +++ b/drivers/io/io_fip.c @@ -69,7 +69,7 @@ /* Identify the device type as a virtual driver */ -io_type_t device_type_fip(void) +static io_type_t device_type_fip(void) { return IO_TYPE_FIRMWARE_IMAGE_PACKAGE; } diff --git a/drivers/io/io_memmap.c b/drivers/io/io_memmap.c index b7e26bd..bf59d6a 100644 --- a/drivers/io/io_memmap.c +++ b/drivers/io/io_memmap.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2014-2018, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -28,7 +29,7 @@ static file_state_t current_file = {0}; /* Identify the device type as memmap */ -io_type_t device_type_memmap(void) +static io_type_t device_type_memmap(void) { return IO_TYPE_MEMMAP; } diff --git a/drivers/io/io_semihosting.c b/drivers/io/io_semihosting.c index f1dfa20..4abf44f 100644 --- a/drivers/io/io_semihosting.c +++ b/drivers/io/io_semihosting.c @@ -1,11 +1,12 @@ /* - * Copyright (c) 2014, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2014-2018, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ #include #include +#include #include #include diff --git a/include/bl1/bl1.h b/include/bl1/bl1.h index b042100..41d436d 100644 --- a/include/bl1/bl1.h +++ b/include/bl1/bl1.h @@ -64,6 +64,26 @@ #ifndef __ASSEMBLY__ #include +struct entry_point_info; + +register_t bl1_smc_wrapper(uint32_t smc_fid, + void *cookie, + void *handle, + unsigned int flags); + +register_t bl1_smc_handler(unsigned int smc_fid, + register_t x1, + register_t x2, + register_t x3, + register_t x4, + void *cookie, + void *handle, + unsigned int flags); + +void bl1_print_next_bl_ep_info(const struct entry_point_info *bl_ep_info); + +void bl1_main(void); + /* * Check if the total number of FWU SMC calls are as expected. */ diff --git a/include/bl2/bl2.h b/include/bl2/bl2.h new file mode 100644 index 0000000..89ff06e --- /dev/null +++ b/include/bl2/bl2.h @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef BL2_H__ +#define BL2_H__ + +void bl2_main(void); + +#endif /* BL2_H__ */ diff --git a/include/bl2u/bl2u.h b/include/bl2u/bl2u.h new file mode 100644 index 0000000..7017b3a --- /dev/null +++ b/include/bl2u/bl2u.h @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef BL2_H__ +#define BL2_H__ + +void bl2u_main(void); + +#endif /* BL2_H__ */ diff --git a/include/bl31/bl31.h b/include/bl31/bl31.h index aac6e28..7c35922 100644 --- a/include/bl31/bl31.h +++ b/include/bl31/bl31.h @@ -18,5 +18,7 @@ void bl31_prepare_next_image_entry(void); void bl31_register_bl32_init(int32_t (*func)(void)); void bl31_warm_entrypoint(void); +void bl31_main(void); +void bl31_lib_init(void); #endif /* __BL31_H__ */ diff --git a/include/common/runtime_svc.h b/include/common/runtime_svc.h index e179e4b..6150b32 100644 --- a/include/common/runtime_svc.h +++ b/include/common/runtime_svc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2016, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -126,5 +126,7 @@ extern uintptr_t __RT_SVC_DESCS_END__; void init_crash_reporting(void); +extern uint8_t rt_svc_descs_indices[MAX_RT_SVCS]; + #endif /*__ASSEMBLY__*/ #endif /* __RUNTIME_SVC_H__ */ diff --git a/include/lib/cpus/errata_report.h b/include/lib/cpus/errata_report.h index 14f2407..d2138bf 100644 --- a/include/lib/cpus/errata_report.h +++ b/include/lib/cpus/errata_report.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -20,6 +20,9 @@ static inline void print_errata_status(void) {} #endif +void errata_print_msg(unsigned int status, const char *cpu, const char *id); +int errata_needs_reporting(spinlock_t *lock, uint32_t *reported); + #endif /* __ASSEMBLY__ */ /* Errata status */ diff --git a/include/lib/el3_runtime/cpu_data.h b/include/lib/el3_runtime/cpu_data.h index 3f48de5..15d34eb 100644 --- a/include/lib/el3_runtime/cpu_data.h +++ b/include/lib/el3_runtime/cpu_data.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2014-2018, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -102,6 +102,8 @@ #endif } __aligned(CACHE_WRITEBACK_GRANULE) cpu_data_t; +extern cpu_data_t percpu_data[PLATFORM_CORE_COUNT]; + #if CRASH_REPORTING /* verify assembler offsets match data structures */ CASSERT(CPU_DATA_CRASH_BUF_OFFSET == __builtin_offsetof diff --git a/include/lib/el3_runtime/pubsub.h b/include/lib/el3_runtime/pubsub.h index 9a85480..2c8a196 100644 --- a/include/lib/el3_runtime/pubsub.h +++ b/include/lib/el3_runtime/pubsub.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -49,9 +49,12 @@ * Have the function func called back when the specified event happens. This * macro places the function address into the pubsub section, which is picked up * and invoked by the invoke_pubsubs() function via. the PUBLISH_EVENT* macros. + * + * The extern declaration is there to satisfy MISRA C-2012 rule 8.4. */ #define SUBSCRIBE_TO_EVENT(event, func) \ - pubsub_cb_t __cb_func_##func##event __pubsub_section(event) = func + extern pubsub_cb_t __cb_func_##func##event __pubsub_section(event); \ + pubsub_cb_t __cb_func_##func##event __pubsub_section(event) = (func) /* * Iterate over subscribed handlers for a defined event. 'event' is the name of diff --git a/include/plat/common/platform.h b/include/plat/common/platform.h index e614cdb..aa181c8 100644 --- a/include/plat/common/platform.h +++ b/include/plat/common/platform.h @@ -386,12 +386,14 @@ unsigned int plat_get_aff_count(unsigned int, unsigned long); unsigned int plat_get_aff_state(unsigned int, unsigned long); + #else /* __ENABLE_PLAT_COMPAT__ */ /* * The below function enable Trusted Firmware components like SPDs which * haven't migrated to the new platform API to compile on platforms which * have the compatibility layer disabled. */ +unsigned int platform_core_pos_helper(unsigned long mpidr); unsigned int platform_get_core_pos(unsigned long mpidr) __deprecated; #endif /* __ENABLE_PLAT_COMPAT__ */ diff --git a/lib/extensions/spe/spe.c b/lib/extensions/spe/spe.c index 3b297f2..a1ed7b7 100644 --- a/lib/extensions/spe/spe.c +++ b/lib/extensions/spe/spe.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -7,6 +7,7 @@ #include #include #include +#include /* * The assembler does not yet understand the psb csync mnemonic diff --git a/lib/stdlib/abort.c b/lib/stdlib/abort.c index af19ccf..65ce4cc 100644 --- a/lib/stdlib/abort.c +++ b/lib/stdlib/abort.c @@ -1,10 +1,11 @@ /* - * Copyright (c) 2013-2014, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ #include +#include /* * This is a basic implementation. This could be improved. diff --git a/lib/stdlib/exit.c b/lib/stdlib/exit.c index 3d23d7b..afc3f93 100644 --- a/lib/stdlib/exit.c +++ b/lib/stdlib/exit.c @@ -1,10 +1,11 @@ /* - * 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 */ #include +#include void exit(int v) { diff --git a/lib/stdlib/sscanf.c b/lib/stdlib/sscanf.c index 674ae79..a5876cf 100644 --- a/lib/stdlib/sscanf.c +++ b/lib/stdlib/sscanf.c @@ -1,9 +1,10 @@ /* - * 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 */ +#include #include /* diff --git a/plat/common/plat_bl_common.c b/plat/common/plat_bl_common.c index 502bb54..b471a7e 100644 --- a/plat/common/plat_bl_common.c +++ b/plat/common/plat_bl_common.c @@ -36,6 +36,7 @@ { } +#if LOAD_IMAGE_V2 int bl2_plat_handle_pre_image_load(unsigned int image_id) { return 0; @@ -45,6 +46,7 @@ { return 0; } +#endif int plat_try_next_boot_source(void) { diff --git a/services/arm_arch_svc/arm_arch_svc_setup.c b/services/arm_arch_svc/arm_arch_svc_setup.c index eedac86..a809c42 100644 --- a/services/arm_arch_svc/arm_arch_svc_setup.c +++ b/services/arm_arch_svc/arm_arch_svc_setup.c @@ -33,7 +33,7 @@ /* * Top-level Arm Architectural Service SMC handler. */ -uintptr_t arm_arch_svc_smc_handler(uint32_t smc_fid, +static uintptr_t arm_arch_svc_smc_handler(uint32_t smc_fid, u_register_t x1, u_register_t x2, u_register_t x3, diff --git a/services/std_svc/std_svc_setup.c b/services/std_svc/std_svc_setup.c index ffc3471..eae078e 100644 --- a/services/std_svc/std_svc_setup.c +++ b/services/std_svc/std_svc_setup.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2014-2018, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -58,7 +58,7 @@ * Top-level Standard Service SMC handler. This handler will in turn dispatch * calls to PSCI SMC handler */ -uintptr_t std_svc_smc_handler(uint32_t smc_fid, +static uintptr_t std_svc_smc_handler(uint32_t smc_fid, u_register_t x1, u_register_t x2, u_register_t x3,