diff --git a/bl1/bl1_fwu.c b/bl1/bl1_fwu.c index 57a86aea8eb7d1cf37871380a1aa1dbce227849c..76a43753799d4ab15f1b70f77d7573a34006d71c 100644 --- a/bl1/bl1_fwu.c +++ b/bl1/bl1_fwu.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2019, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -52,9 +52,6 @@ __dead2 static void bl1_fwu_done(void *client_cookie, void *reserved); */ static unsigned int sec_exec_image_id = INVALID_IMAGE_ID; -/* Authentication status of each image. */ -extern unsigned int auth_img_flags[MAX_NUMBER_IDS]; - /******************************************************************************* * Top level handler for servicing FWU SMCs. ******************************************************************************/ @@ -108,7 +105,7 @@ register_t bl1_fwu_smc_handler(unsigned int smc_fid, #define FWU_MAX_SIMULTANEOUS_IMAGES 10 #endif -static int bl1_fwu_loaded_ids[FWU_MAX_SIMULTANEOUS_IMAGES] = { +static unsigned int bl1_fwu_loaded_ids[FWU_MAX_SIMULTANEOUS_IMAGES] = { [0 ... FWU_MAX_SIMULTANEOUS_IMAGES-1] = INVALID_IMAGE_ID }; @@ -116,7 +113,7 @@ static int bl1_fwu_loaded_ids[FWU_MAX_SIMULTANEOUS_IMAGES] = { * Adds an image_id to the bl1_fwu_loaded_ids array. * Returns 0 on success, 1 on error. */ -static int bl1_fwu_add_loaded_id(int image_id) +static int bl1_fwu_add_loaded_id(unsigned int image_id) { int i; @@ -141,7 +138,7 @@ static int bl1_fwu_add_loaded_id(int image_id) * Removes an image_id from the bl1_fwu_loaded_ids array. * Returns 0 on success, 1 on error. */ -static int bl1_fwu_remove_loaded_id(int image_id) +static int bl1_fwu_remove_loaded_id(unsigned int image_id) { int i; @@ -160,7 +157,7 @@ static int bl1_fwu_remove_loaded_id(int image_id) * This function checks if the specified image overlaps another image already * loaded. It returns 0 if there is no overlap, a negative error code otherwise. ******************************************************************************/ -static int bl1_fwu_image_check_overlaps(int image_id) +static int bl1_fwu_image_check_overlaps(unsigned int image_id) { const image_desc_t *image_desc, *checked_image_desc; const image_info_t *info, *checked_info; diff --git a/drivers/arm/css/scmi/scmi_ap_core_proto.c b/drivers/arm/css/scmi/scmi_ap_core_proto.c index 2caccc2b81398b1f31582a2dc1a90c9194c2c7f2..5941b87f32aa7b83d904b78dbd123d983de432c2 100644 --- a/drivers/arm/css/scmi/scmi_ap_core_proto.c +++ b/drivers/arm/css/scmi/scmi_ap_core_proto.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -18,7 +18,8 @@ int scmi_ap_core_set_reset_addr(void *p, uint64_t reset_addr, uint32_t attr) { mailbox_mem_t *mbx_mem; - int token = 0, ret; + unsigned int token = 0; + int ret; scmi_channel_t *ch = (scmi_channel_t *)p; validate_scmi_channel(ch); @@ -51,7 +52,8 @@ int scmi_ap_core_set_reset_addr(void *p, uint64_t reset_addr, uint32_t attr) int scmi_ap_core_get_reset_addr(void *p, uint64_t *reset_addr, uint32_t *attr) { mailbox_mem_t *mbx_mem; - int token = 0, ret; + unsigned int token = 0; + int ret; scmi_channel_t *ch = (scmi_channel_t *)p; uint32_t lo_addr, hi_addr; diff --git a/drivers/arm/css/scmi/scmi_common.c b/drivers/arm/css/scmi/scmi_common.c index e2c353d851a373f6c39e62e8d96e8dfbd5838ddf..5b3724ace6bd1097e8d4d3b8c1fbe94e56766549 100644 --- a/drivers/arm/css/scmi/scmi_common.c +++ b/drivers/arm/css/scmi/scmi_common.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -90,7 +90,8 @@ void scmi_put_channel(scmi_channel_t *ch) int scmi_proto_version(void *p, uint32_t proto_id, uint32_t *version) { mailbox_mem_t *mbx_mem; - int token = 0, ret; + unsigned int token = 0; + int ret; scmi_channel_t *ch = (scmi_channel_t *)p; validate_scmi_channel(ch); @@ -122,7 +123,8 @@ int scmi_proto_msg_attr(void *p, uint32_t proto_id, uint32_t command_id, uint32_t *attr) { mailbox_mem_t *mbx_mem; - int token = 0, ret; + unsigned int token = 0; + int ret; scmi_channel_t *ch = (scmi_channel_t *)p; validate_scmi_channel(ch); diff --git a/drivers/arm/css/scmi/scmi_pwr_dmn_proto.c b/drivers/arm/css/scmi/scmi_pwr_dmn_proto.c index 70165dec299a7d4e21258f8fe8e68293bea25657..a342aa89ea2b50b13f4cdaadae4cab92d23d5b12 100644 --- a/drivers/arm/css/scmi/scmi_pwr_dmn_proto.c +++ b/drivers/arm/css/scmi/scmi_pwr_dmn_proto.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -19,7 +19,8 @@ int scmi_pwr_state_set(void *p, uint32_t domain_id, uint32_t scmi_pwr_state) { mailbox_mem_t *mbx_mem; - int token = 0, ret; + unsigned int token = 0; + int ret; /* * Only asynchronous mode of `set power state` command is allowed on @@ -59,7 +60,8 @@ int scmi_pwr_state_get(void *p, uint32_t domain_id, uint32_t *scmi_pwr_state) { mailbox_mem_t *mbx_mem; - int token = 0, ret; + unsigned int token = 0; + int ret; scmi_channel_t *ch = (scmi_channel_t *)p; validate_scmi_channel(ch); diff --git a/drivers/arm/css/scmi/scmi_sys_pwr_proto.c b/drivers/arm/css/scmi/scmi_sys_pwr_proto.c index a27c4a5d0bb662838b50337a3feada37317e8ea1..c8e62d1536d1bbbd4b5a125ef8f38c05232315b2 100644 --- a/drivers/arm/css/scmi/scmi_sys_pwr_proto.c +++ b/drivers/arm/css/scmi/scmi_sys_pwr_proto.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -18,7 +18,8 @@ int scmi_sys_pwr_state_set(void *p, uint32_t flags, uint32_t system_state) { mailbox_mem_t *mbx_mem; - int token = 0, ret; + unsigned int token = 0; + int ret; scmi_channel_t *ch = (scmi_channel_t *)p; validate_scmi_channel(ch); @@ -50,7 +51,8 @@ int scmi_sys_pwr_state_set(void *p, uint32_t flags, uint32_t system_state) int scmi_sys_pwr_state_get(void *p, uint32_t *system_state) { mailbox_mem_t *mbx_mem; - int token = 0, ret; + unsigned int token = 0; + int ret; scmi_channel_t *ch = (scmi_channel_t *)p; validate_scmi_channel(ch); diff --git a/drivers/arm/css/scp/css_pm_scmi.c b/drivers/arm/css/scp/css_pm_scmi.c index 1966c44caf53e647bc08e051438b7f99211abe7e..8dbefa16bb03f323296fd23e0933536c89b0ecb6 100644 --- a/drivers/arm/css/scp/css_pm_scmi.c +++ b/drivers/arm/css/scp/css_pm_scmi.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -99,7 +99,7 @@ void css_scp_suspend(const struct psci_power_state *target_state) return; } #if !HW_ASSISTED_COHERENCY - int lvl; + unsigned int lvl; uint32_t scmi_pwr_state = 0; /* * If we reach here, then assert that power down at system power domain @@ -145,7 +145,8 @@ void css_scp_suspend(const struct psci_power_state *target_state) */ void css_scp_off(const struct psci_power_state *target_state) { - int lvl = 0, ret; + unsigned int lvl = 0; + int ret; uint32_t scmi_pwr_state = 0; /* At-least the CPU level should be specified to be OFF */ @@ -184,7 +185,8 @@ void css_scp_off(const struct psci_power_state *target_state) */ void css_scp_on(u_register_t mpidr) { - int lvl = 0, ret, core_pos; + unsigned int lvl = 0; + int ret, core_pos; uint32_t scmi_pwr_state = 0; for (; lvl <= PLAT_MAX_PWR_LVL; lvl++) diff --git a/drivers/arm/sp804/sp804_delay_timer.c b/drivers/arm/sp804/sp804_delay_timer.c index 5313fbde2d54edd256f7a0c5abbd27abfee00b0d..9c5e76286f89d331e67155849293a9384ec60356 100644 --- a/drivers/arm/sp804/sp804_delay_timer.c +++ b/drivers/arm/sp804/sp804_delay_timer.c @@ -1,11 +1,12 @@ /* - * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2019, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ #include +#include #include #include diff --git a/drivers/auth/auth_mod.c b/drivers/auth/auth_mod.c index 1b8ff82bcad33d0d2a1cf51db7367a49858d9190..97e1220327b4d3e2269998a924c301233a19da0f 100644 --- a/drivers/auth/auth_mod.c +++ b/drivers/auth/auth_mod.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2019, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -30,10 +30,6 @@ #pragma weak plat_set_nv_ctr2 -/* Pointer to CoT */ -extern const auth_img_desc_t *const cot_desc_ptr; -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/console/multi_console.c b/drivers/console/multi_console.c index a135959232c3def79d96c1fe6895a69d11691dc2..b5ff88b70a5eb53b01275839cb765b25fa4ed0a2 100644 --- a/drivers/console/multi_console.c +++ b/drivers/console/multi_console.c @@ -13,11 +13,11 @@ console_t *console_list; uint8_t console_state = CONSOLE_FLAG_BOOT; +IMPORT_SYM(console_t *, __STACKS_START__, stacks_start) +IMPORT_SYM(console_t *, __STACKS_END__, stacks_end) + int console_register(console_t *console) { - IMPORT_SYM(console_t *, __STACKS_START__, stacks_start) - IMPORT_SYM(console_t *, __STACKS_END__, stacks_end) - /* Assert that the struct is not on the stack (common mistake). */ assert((console < stacks_start) || (console >= stacks_end)); /* Assert that we won't make a circle in the list. */ diff --git a/drivers/io/io_fip.c b/drivers/io/io_fip.c index eaaf0909692adfb1b6f91ea237469125132c9e3f..544b37dbea56fc4cc442b8caaa9f071d8270cbc1 100644 --- a/drivers/io/io_fip.c +++ b/drivers/io/io_fip.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2014-2019, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -48,7 +48,7 @@ typedef struct { uintptr_t dev_spec; } fip_dev_state_t; -static const uuid_t uuid_null = { {0} }; +static const uuid_t uuid_null; /* * Only one file can be open across all FIP device * as backends like io_memmap don't support diff --git a/include/drivers/arm/css/scmi.h b/include/drivers/arm/css/scmi.h index df259f76d822e46cc83e5577ea2573763157f40e..1f8dc6ccea6d50d294554add7182ca3dd3378c49 100644 --- a/include/drivers/arm/css/scmi.h +++ b/include/drivers/arm/css/scmi.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -162,7 +162,7 @@ int scmi_ap_core_set_reset_addr(void *p, uint64_t reset_addr, uint32_t attr); int scmi_ap_core_get_reset_addr(void *p, uint64_t *reset_addr, uint32_t *attr); /* API to get the platform specific SCMI channel information. */ -scmi_channel_plat_info_t *plat_css_get_scmi_info(); +scmi_channel_plat_info_t *plat_css_get_scmi_info(void); /* API to override default PSCI callbacks for platforms that support SCMI. */ const plat_psci_ops_t *css_scmi_override_pm_ops(plat_psci_ops_t *ops); diff --git a/include/drivers/console.h b/include/drivers/console.h index 24887f9083e19b6015b849ee8a01fc956a8268c0..4f26ccef21757a4c53271f9a10026886d0f871ed 100644 --- a/include/drivers/console.h +++ b/include/drivers/console.h @@ -49,11 +49,12 @@ typedef struct console { #include /* - * NOTE: There is no publicly accessible console_register() function. Consoles - * are registered by directly calling the register function of a specific - * implementation, e.g. console_16550_register() from . Consoles - * registered that way can be unregistered/reconfigured with below functions. + * Add a console_t instance to the console list. This should only be called by + * console drivers after they have initialized all fields in the console + * structure. Platforms seeking to register a new console need to call the + * respective console__register() function instead. */ +int console_register(console_t *console); /* Remove a single console_t instance from the console list. Return a pointer to * the console that was removed if it was found, or NULL if not. */ console_t *console_unregister(console_t *console); diff --git a/include/plat/arm/common/plat_arm.h b/include/plat/arm/common/plat_arm.h index 9d6786f5e3e71c75d642ac9818357fd535f046eb..527375f6a438ed82e6ee84513c51bb3845b477d7 100644 --- a/include/plat/arm/common/plat_arm.h +++ b/include/plat/arm/common/plat_arm.h @@ -187,6 +187,7 @@ void arm_bl2_platform_setup(void); void arm_bl2_plat_arch_setup(void); uint32_t arm_get_spsr_for_bl32_entry(void); uint32_t arm_get_spsr_for_bl33_entry(void); +int arm_bl2_plat_handle_post_image_load(unsigned int image_id); int arm_bl2_handle_post_image_load(unsigned int image_id); struct bl_params *arm_get_next_bl_params(void); diff --git a/lib/libc/memchr.c b/lib/libc/memchr.c index 2eba47c959161454ea7229fbb907ae8963e3256e..0fe05358bbb3f06266c87b4d488942871e8e4154 100644 --- a/lib/libc/memchr.c +++ b/lib/libc/memchr.c @@ -1,10 +1,11 @@ /* - * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ #include +#include void *memchr(const void *src, int c, size_t len) { diff --git a/lib/libc/memcmp.c b/lib/libc/memcmp.c index a4c798b097fb0db9e33f2189d4151043f6acd3dc..cd5f0df0c9ea71e69ac4acd055d0271c010f3303 100644 --- a/lib/libc/memcmp.c +++ b/lib/libc/memcmp.c @@ -1,10 +1,11 @@ /* - * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ #include +#include int memcmp(const void *s1, const void *s2, size_t len) { diff --git a/lib/libc/memcpy.c b/lib/libc/memcpy.c index fc0c9fe890e1295c6c6f141889ada90a632be608..158df9b794e147988356f12055ba3161086957a1 100644 --- a/lib/libc/memcpy.c +++ b/lib/libc/memcpy.c @@ -1,10 +1,11 @@ /* - * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ #include +#include void *memcpy(void *dst, const void *src, size_t len) { diff --git a/lib/libc/memset.c b/lib/libc/memset.c index 03aa80966131ef2b1395829957229d3e670ade7b..d8007d8e947e82d2b3f7e1c978553e6dc51f8dc6 100644 --- a/lib/libc/memset.c +++ b/lib/libc/memset.c @@ -1,10 +1,11 @@ /* - * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ #include +#include void *memset(void *dst, int val, size_t count) { diff --git a/lib/semihosting/semihosting.c b/lib/semihosting/semihosting.c index ee48dbc1f7c1d71618f516bc25031232ebb235ca..051dd008bebb1fa6518305157b9af1ce00a4ae85 100644 --- a/lib/semihosting/semihosting.c +++ b/lib/semihosting/semihosting.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2014, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -160,7 +160,7 @@ long semihosting_system(char *command_line) long semihosting_get_flen(const char *file_name) { long file_handle; - size_t length; + long length; assert(semihosting_connection_supported()); diff --git a/plat/arm/board/fvp/fvp_pm.c b/plat/arm/board/fvp/fvp_pm.c index ecf0b0135bc9e3b190777ab477541f7604e43baf..42dec8dfc81ab0ee57fa84f17d1448ac951161d4 100644 --- a/plat/arm/board/fvp/fvp_pm.c +++ b/plat/arm/board/fvp/fvp_pm.c @@ -20,6 +20,7 @@ #include #include "fvp_private.h" +#include "../drivers/arm/gic/v3/gicv3_private.h" #if ARM_RECOM_STATE_ID_ENC diff --git a/plat/arm/board/fvp/fvp_private.h b/plat/arm/board/fvp/fvp_private.h index 3d9653739c90098c8fad955cdbe0c67a30fd5f67..5067d3a2f5dc78f87a4de21469a2e5747a183377 100644 --- a/plat/arm/board/fvp/fvp_private.h +++ b/plat/arm/board/fvp/fvp_private.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2014-2019, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -20,5 +20,4 @@ void fvp_interconnect_enable(void); void fvp_interconnect_disable(void); void tsp_early_platform_setup(void); - #endif /* FVP_PRIVATE_H */ diff --git a/plat/arm/board/juno/juno_bl1_setup.c b/plat/arm/board/juno/juno_bl1_setup.c index f72a6ff1af2f5251cc4b6a475272de29267537d7..33f5c47912eb20566b01cbc45d1e930188f7c863 100644 --- a/plat/arm/board/juno/juno_bl1_setup.c +++ b/plat/arm/board/juno/juno_bl1_setup.c @@ -61,7 +61,7 @@ static int is_watchdog_reset(void) ******************************************************************************/ int plat_arm_bl1_fwu_needed(void) { - const uint32_t *nv_flags_ptr = (const uint32_t *)V2M_SYS_NVFLAGS_ADDR; + const int32_t *nv_flags_ptr = (const int32_t *)V2M_SYS_NVFLAGS_ADDR; /* Check if TOC is invalid or watchdog reset happened. */ if ((arm_io_is_toc_valid() != 1) || diff --git a/plat/arm/board/juno/juno_err.c b/plat/arm/board/juno/juno_err.c index f80ff24525b7e3879e41684b002d02f74bb2280b..700b96cb1aa9fe3bc533061554f231df9a053b77 100644 --- a/plat/arm/board/juno/juno_err.c +++ b/plat/arm/board/juno/juno_err.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2019, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -7,6 +7,7 @@ #include #include +#include #include #include diff --git a/plat/arm/board/juno/juno_topology.c b/plat/arm/board/juno/juno_topology.c index ca5c344d61b5eec0e109c5a54905e965abc472c7..052ab9f8a712f7550650f1cb3748e9aa5d8218aa 100644 --- a/plat/arm/board/juno/juno_topology.c +++ b/plat/arm/board/juno/juno_topology.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2016-2019, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -20,7 +20,7 @@ static scmi_channel_plat_info_t juno_scmi_plat_info = { .ring_doorbell = &mhu_ring_doorbell, }; -scmi_channel_plat_info_t *plat_css_get_scmi_info() +scmi_channel_plat_info_t *plat_css_get_scmi_info(void) { return &juno_scmi_plat_info; } diff --git a/plat/arm/board/sgi575/sgi575_plat.c b/plat/arm/board/sgi575/sgi575_plat.c index d1a1fbf46f621f112ba4b30a0155f746ae7f5844..0d3fd16ab626fc7ff97e61784307efbf6c63b905 100644 --- a/plat/arm/board/sgi575/sgi575_plat.c +++ b/plat/arm/board/sgi575/sgi575_plat.c @@ -1,11 +1,13 @@ /* - * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ #include +#include + unsigned int plat_arm_sgi_get_platform_id(void) { return mmio_read_32(SSC_VERSION) & SSC_VERSION_PART_NUM_MASK; diff --git a/plat/arm/board/sgi575/sgi575_security.c b/plat/arm/board/sgi575/sgi575_security.c index 8417e1008430689a3e6d7cb705ba0f4f2dd90539..440f18d55d05877f744e59f0cf0c91dcf020d6b6 100644 --- a/plat/arm/board/sgi575/sgi575_security.c +++ b/plat/arm/board/sgi575/sgi575_security.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -8,6 +8,7 @@ #include #include +#include uintptr_t sgi575_dmc_base[] = { SGI575_DMC620_BASE0, diff --git a/plat/arm/css/sgi/sgi_bl31_setup.c b/plat/arm/css/sgi/sgi_bl31_setup.c index 8fa5b01b277d9e113946ef7b02d88cda10b61748..ba050d5f1ced9eb909d9203cf8492b4d903ecbcf 100644 --- a/plat/arm/css/sgi/sgi_bl31_setup.c +++ b/plat/arm/css/sgi/sgi_bl31_setup.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -35,7 +36,7 @@ static scmi_channel_plat_info_t rd_n1e1_edge_scmi_plat_info = { .ring_doorbell = &mhuv2_ring_doorbell, }; -scmi_channel_plat_info_t *plat_css_get_scmi_info() +scmi_channel_plat_info_t *plat_css_get_scmi_info(void) { if (sgi_plat_info.platform_id == RD_N1E1_EDGE_SID_VER_PART_NUM) return &rd_n1e1_edge_scmi_plat_info; @@ -43,7 +44,7 @@ scmi_channel_plat_info_t *plat_css_get_scmi_info() return &sgi575_scmi_plat_info; else panic(); -}; +} void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1, u_register_t arg2, u_register_t arg3) diff --git a/plat/arm/css/sgi/sgi_interconnect.c b/plat/arm/css/sgi/sgi_interconnect.c index e86c760d16b7d61dc753099de740e47547281fdb..e9cd81256343278b02127bfc2da1bebb1ebdb27a 100644 --- a/plat/arm/css/sgi/sgi_interconnect.c +++ b/plat/arm/css/sgi/sgi_interconnect.c @@ -1,11 +1,12 @@ /* - * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ #include #include +#include /* * For SGI575 which support FCM (with automatic interconnect enter/exit), diff --git a/plat/arm/css/sgi/sgi_topology.c b/plat/arm/css/sgi/sgi_topology.c index f9dbdefe927a2da9eaa7a72c9c2ccc3897327ee7..7aa9e40d353ce0cfe56908797f8646a7b0978a57 100644 --- a/plat/arm/css/sgi/sgi_topology.c +++ b/plat/arm/css/sgi/sgi_topology.c @@ -5,6 +5,7 @@ */ #include +#include #include diff --git a/plat/common/plat_spm_rd.c b/plat/common/plat_spm_rd.c index 0c72cb7aa82514616b31da89f6bd5ff6282bf2e5..ebd3e6dc6b2084a310b884ef10b84e84963a8c20 100644 --- a/plat/common/plat_spm_rd.c +++ b/plat/common/plat_spm_rd.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Arm Limited. All rights reserved. + * Copyright (c) 2018-2019, Arm Limited. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -14,6 +14,7 @@ #include #include #include +#include #include /******************************************************************************* diff --git a/plat/common/plat_spm_sp.c b/plat/common/plat_spm_sp.c index ce482799236693e437f393c34c6cd51c9cc573d5..bc3d6a01516c960d13936bec83f046dccd82d076 100644 --- a/plat/common/plat_spm_sp.c +++ b/plat/common/plat_spm_sp.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Arm Limited. All rights reserved. + * Copyright (c) 2018-2019, Arm Limited. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -9,6 +9,7 @@ #include #include +#include #include static unsigned int sp_next; diff --git a/services/std_svc/spm/spci.c b/services/std_svc/spm/spci.c index 1ee986af4285b8b7ebae6092e54b811d56c83c2f..2e12a6c6b2684b60ad0651d8888f899a992b1cc9 100644 --- a/services/std_svc/spm/spci.c +++ b/services/std_svc/spm/spci.c @@ -379,6 +379,41 @@ static uint64_t spci_service_request_blocking(void *handle, SMC_RET4(handle, SPCI_SUCCESS, rx1, rx2, rx3); } +/******************************************************************************* + * This function handles the returned values from the Secure Partition. + ******************************************************************************/ +static void spci_handle_returned_values(const cpu_context_t *cpu_ctx, + uint64_t ret) +{ + if (ret == SPRT_PUT_RESPONSE_AARCH64) { + uint32_t token; + uint64_t x3, x4, x5, x6; + + token = read_ctx_reg(get_gpregs_ctx(cpu_ctx), CTX_GPREG_X1); + x3 = read_ctx_reg(get_gpregs_ctx(cpu_ctx), CTX_GPREG_X3); + x4 = read_ctx_reg(get_gpregs_ctx(cpu_ctx), CTX_GPREG_X4); + x5 = read_ctx_reg(get_gpregs_ctx(cpu_ctx), CTX_GPREG_X5); + x6 = read_ctx_reg(get_gpregs_ctx(cpu_ctx), CTX_GPREG_X6); + + uint16_t client_id = x6 & 0xFFFFU; + uint16_t service_handle = x6 >> 16; + + int rc = spm_response_add(client_id, service_handle, token, + x3, x4, x5); + if (rc != 0) { + /* + * This is error fatal because we can't return to the SP + * from this SMC. The SP has crashed. + */ + panic(); + } + } else if ((ret != SPRT_YIELD_AARCH64) && + (ret != SPM_SECURE_PARTITION_PREEMPTED)) { + ERROR("SPM: %s: Unexpected x0 value 0x%llx\n", __func__, ret); + panic(); + } +} + /******************************************************************************* * This function requests a Secure Service from a given handle and client ID. ******************************************************************************/ @@ -465,34 +500,8 @@ static uint64_t spci_service_request_start(void *handle, /* Jump to the Secure Partition. */ uint64_t ret = spm_sp_synchronous_entry(sp_ctx, 1); - /* Verify returned values */ - if (ret == SPRT_PUT_RESPONSE_AARCH64) { - uint32_t token; - uint64_t rx1, rx2, rx3, x6; - - token = read_ctx_reg(get_gpregs_ctx(cpu_ctx), CTX_GPREG_X1); - rx1 = read_ctx_reg(get_gpregs_ctx(cpu_ctx), CTX_GPREG_X3); - rx2 = read_ctx_reg(get_gpregs_ctx(cpu_ctx), CTX_GPREG_X4); - rx3 = read_ctx_reg(get_gpregs_ctx(cpu_ctx), CTX_GPREG_X5); - x6 = read_ctx_reg(get_gpregs_ctx(cpu_ctx), CTX_GPREG_X6); - - uint16_t client_id = x6 & 0xFFFFU; - uint16_t service_handle = x6 >> 16; - - int rc = spm_response_add(client_id, service_handle, token, - rx1, rx2, rx3); - if (rc != 0) { - /* - * This is error fatal because we can't return to the SP - * from this SMC. The SP has crashed. - */ - panic(); - } - } else if ((ret != SPRT_YIELD_AARCH64) && - (ret != SPM_SECURE_PARTITION_PREEMPTED)) { - ERROR("SPM: %s: Unexpected x0 value 0x%llx\n", __func__, ret); - panic(); - } + /* Handle returned values */ + spci_handle_returned_values(cpu_ctx, ret); /* Flag Secure Partition as idle. */ assert(sp_ctx->state == SP_STATE_BUSY); @@ -572,34 +581,8 @@ static uint64_t spci_service_request_resume(void *handle, u_register_t x1, /* Jump to the Secure Partition. */ uint64_t ret = spm_sp_synchronous_entry(sp_ctx, 1); - /* Verify returned values */ - if (ret == SPRT_PUT_RESPONSE_AARCH64) { - uint32_t token; - uint64_t rx1, rx2, rx3, x6; - - token = read_ctx_reg(get_gpregs_ctx(cpu_ctx), CTX_GPREG_X1); - rx1 = read_ctx_reg(get_gpregs_ctx(cpu_ctx), CTX_GPREG_X3); - rx2 = read_ctx_reg(get_gpregs_ctx(cpu_ctx), CTX_GPREG_X4); - rx3 = read_ctx_reg(get_gpregs_ctx(cpu_ctx), CTX_GPREG_X5); - x6 = read_ctx_reg(get_gpregs_ctx(cpu_ctx), CTX_GPREG_X6); - - uint16_t client_id = x6 & 0xFFFFU; - uint16_t service_handle = x6 >> 16; - - int rc = spm_response_add(client_id, service_handle, token, - rx1, rx2, rx3); - if (rc != 0) { - /* - * This is error fatal because we can't return to the SP - * from this SMC. The SP has crashed. - */ - panic(); - } - } else if ((ret != SPRT_YIELD_AARCH64) && - (ret != SPM_SECURE_PARTITION_PREEMPTED)) { - ERROR("SPM: %s: Unexpected x0 value 0x%llx\n", __func__, ret); - panic(); - } + /* Handle returned values */ + spci_handle_returned_values(cpu_ctx, ret); /* Flag Secure Partition as idle. */ assert(sp_ctx->state == SP_STATE_BUSY); diff --git a/services/std_svc/spm/spm_buffers.c b/services/std_svc/spm/spm_buffers.c index 0c26a74bac4e134351e80b7b914578c37e9a8522..3e0c9496fce0244a63663f572c0d7e1d34e430f7 100644 --- a/services/std_svc/spm/spm_buffers.c +++ b/services/std_svc/spm/spm_buffers.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Arm Limited. All rights reserved. + * Copyright (c) 2018-2019, Arm Limited. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -9,6 +9,8 @@ #include #include +#include "./spm_private.h" + /******************************************************************************* * Secure Service response global array. All the responses to the requests done * to the Secure Partition are stored here. They are removed from the array as @@ -40,7 +42,7 @@ int spm_response_add(uint16_t client_id, uint16_t handle, uint32_t token, } } - for (int i = 0; i < ARRAY_SIZE(responses); i++) { + for (unsigned int i = 0U; i < ARRAY_SIZE(responses); i++) { struct sprt_response *resp = &(responses[i]); if (resp->is_valid == 0) { diff --git a/services/std_svc/spm/spm_main.c b/services/std_svc/spm/spm_main.c index adfffd58c5561cdd0ddc9ee00bddaee875d39757..6cd77e3d971538b2fe163b087bc819dd8802c866 100644 --- a/services/std_svc/spm/spm_main.c +++ b/services/std_svc/spm/spm_main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -20,6 +20,7 @@ #include #include #include +#include #include #include