Unverified Commit 18ff0b61 authored by Antonio Niño Díaz's avatar Antonio Niño Díaz Committed by GitHub
Browse files

Merge pull request #1886 from ambroise-arm/av/static-checks

Fix extra compilation warnings
parents 9cadccdf 279faa6d
...@@ -61,7 +61,7 @@ static int is_watchdog_reset(void) ...@@ -61,7 +61,7 @@ static int is_watchdog_reset(void)
******************************************************************************/ ******************************************************************************/
int plat_arm_bl1_fwu_needed(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. */ /* Check if TOC is invalid or watchdog reset happened. */
if ((arm_io_is_toc_valid() != 1) || if ((arm_io_is_toc_valid() != 1) ||
......
/* /*
* 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 * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <errno.h> #include <errno.h>
#include <arch_helpers.h> #include <arch_helpers.h>
#include <plat/arm/common/plat_arm.h>
#include <plat/common/platform.h> #include <plat/common/platform.h>
#include <platform_def.h> #include <platform_def.h>
......
/* /*
* 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 * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -20,7 +20,7 @@ static scmi_channel_plat_info_t juno_scmi_plat_info = { ...@@ -20,7 +20,7 @@ static scmi_channel_plat_info_t juno_scmi_plat_info = {
.ring_doorbell = &mhu_ring_doorbell, .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; return &juno_scmi_plat_info;
} }
......
/* /*
* 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 * SPDX-License-Identifier: BSD-3-Clause
*/ */
#include <plat/common/platform.h> #include <plat/common/platform.h>
#include <sgi_variant.h>
unsigned int plat_arm_sgi_get_platform_id(void) unsigned int plat_arm_sgi_get_platform_id(void)
{ {
return mmio_read_32(SSC_VERSION) & SSC_VERSION_PART_NUM_MASK; return mmio_read_32(SSC_VERSION) & SSC_VERSION_PART_NUM_MASK;
......
/* /*
* 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 * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <common/debug.h> #include <common/debug.h>
#include <drivers/arm/tzc_dmc620.h> #include <drivers/arm/tzc_dmc620.h>
#include <plat/arm/common/plat_arm.h>
uintptr_t sgi575_dmc_base[] = { uintptr_t sgi575_dmc_base[] = {
SGI575_DMC620_BASE0, SGI575_DMC620_BASE0,
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <drivers/arm/css/css_mhu_doorbell.h> #include <drivers/arm/css/css_mhu_doorbell.h>
#include <drivers/arm/css/scmi.h> #include <drivers/arm/css/scmi.h>
#include <plat/arm/common/plat_arm.h> #include <plat/arm/common/plat_arm.h>
#include <plat/common/platform.h>
#include <sgi_ras.h> #include <sgi_ras.h>
#include <sgi_variant.h> #include <sgi_variant.h>
...@@ -35,7 +36,7 @@ static scmi_channel_plat_info_t rd_n1e1_edge_scmi_plat_info = { ...@@ -35,7 +36,7 @@ static scmi_channel_plat_info_t rd_n1e1_edge_scmi_plat_info = {
.ring_doorbell = &mhuv2_ring_doorbell, .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) if (sgi_plat_info.platform_id == RD_N1E1_EDGE_SID_VER_PART_NUM)
return &rd_n1e1_edge_scmi_plat_info; return &rd_n1e1_edge_scmi_plat_info;
...@@ -43,7 +44,7 @@ scmi_channel_plat_info_t *plat_css_get_scmi_info() ...@@ -43,7 +44,7 @@ scmi_channel_plat_info_t *plat_css_get_scmi_info()
return &sgi575_scmi_plat_info; return &sgi575_scmi_plat_info;
else else
panic(); panic();
}; }
void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1, void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
u_register_t arg2, u_register_t arg3) u_register_t arg2, u_register_t arg3)
......
/* /*
* 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 * SPDX-License-Identifier: BSD-3-Clause
*/ */
#include <arch_helpers.h> #include <arch_helpers.h>
#include <common/debug.h> #include <common/debug.h>
#include <plat/arm/common/plat_arm.h>
/* /*
* For SGI575 which support FCM (with automatic interconnect enter/exit), * For SGI575 which support FCM (with automatic interconnect enter/exit),
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
*/ */
#include <plat/arm/common/plat_arm.h> #include <plat/arm/common/plat_arm.h>
#include <plat/common/platform.h>
#include <sgi_variant.h> #include <sgi_variant.h>
......
/* /*
* Copyright (c) 2018, Arm Limited. All rights reserved. * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <common/debug.h> #include <common/debug.h>
#include <common/fdt_wrappers.h> #include <common/fdt_wrappers.h>
#include <lib/object_pool.h> #include <lib/object_pool.h>
#include <plat/common/platform.h>
#include <services/sp_res_desc.h> #include <services/sp_res_desc.h>
/******************************************************************************* /*******************************************************************************
......
/* /*
* Copyright (c) 2018, Arm Limited. All rights reserved. * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <platform_def.h> #include <platform_def.h>
#include <common/debug.h> #include <common/debug.h>
#include <plat/common/platform.h>
#include <tools_share/sptool.h> #include <tools_share/sptool.h>
static unsigned int sp_next; static unsigned int sp_next;
......
...@@ -379,6 +379,41 @@ static uint64_t spci_service_request_blocking(void *handle, ...@@ -379,6 +379,41 @@ static uint64_t spci_service_request_blocking(void *handle,
SMC_RET4(handle, SPCI_SUCCESS, rx1, rx2, rx3); 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. * 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, ...@@ -465,34 +500,8 @@ static uint64_t spci_service_request_start(void *handle,
/* Jump to the Secure Partition. */ /* Jump to the Secure Partition. */
uint64_t ret = spm_sp_synchronous_entry(sp_ctx, 1); uint64_t ret = spm_sp_synchronous_entry(sp_ctx, 1);
/* Verify returned values */ /* Handle returned values */
if (ret == SPRT_PUT_RESPONSE_AARCH64) { spci_handle_returned_values(cpu_ctx, ret);
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();
}
/* Flag Secure Partition as idle. */ /* Flag Secure Partition as idle. */
assert(sp_ctx->state == SP_STATE_BUSY); assert(sp_ctx->state == SP_STATE_BUSY);
...@@ -572,34 +581,8 @@ static uint64_t spci_service_request_resume(void *handle, u_register_t x1, ...@@ -572,34 +581,8 @@ static uint64_t spci_service_request_resume(void *handle, u_register_t x1,
/* Jump to the Secure Partition. */ /* Jump to the Secure Partition. */
uint64_t ret = spm_sp_synchronous_entry(sp_ctx, 1); uint64_t ret = spm_sp_synchronous_entry(sp_ctx, 1);
/* Verify returned values */ /* Handle returned values */
if (ret == SPRT_PUT_RESPONSE_AARCH64) { spci_handle_returned_values(cpu_ctx, ret);
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();
}
/* Flag Secure Partition as idle. */ /* Flag Secure Partition as idle. */
assert(sp_ctx->state == SP_STATE_BUSY); assert(sp_ctx->state == SP_STATE_BUSY);
......
/* /*
* Copyright (c) 2018, Arm Limited. All rights reserved. * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
#include <lib/utils_def.h> #include <lib/utils_def.h>
#include <platform_def.h> #include <platform_def.h>
#include "./spm_private.h"
/******************************************************************************* /*******************************************************************************
* Secure Service response global array. All the responses to the requests done * 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 * 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, ...@@ -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]); struct sprt_response *resp = &(responses[i]);
if (resp->is_valid == 0) { if (resp->is_valid == 0) {
......
/* /*
* 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 * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <lib/utils.h> #include <lib/utils.h>
#include <lib/xlat_tables/xlat_tables_v2.h> #include <lib/xlat_tables/xlat_tables_v2.h>
#include <plat/common/platform.h> #include <plat/common/platform.h>
#include <services/spm_svc.h>
#include <services/sprt_svc.h> #include <services/sprt_svc.h>
#include <smccc_helpers.h> #include <smccc_helpers.h>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment