Merge "fix(spmd): coverity scan issues" into integration
diff --git a/plat/arm/board/corstone1000/platform.mk b/plat/arm/board/corstone1000/platform.mk
index 3edffe0..dcd0df8 100644
--- a/plat/arm/board/corstone1000/platform.mk
+++ b/plat/arm/board/corstone1000/platform.mk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved.
+# Copyright (c) 2021-2023, Arm Limited and Contributors. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -43,6 +43,7 @@
plat/arm/board/corstone1000/common/corstone1000_err.c \
plat/arm/board/corstone1000/common/corstone1000_trusted_boot.c \
lib/utils/mem_region.c \
+ lib/cpus/aarch64/cpu_helpers.S \
plat/arm/board/corstone1000/common/corstone1000_helpers.S \
plat/arm/board/corstone1000/common/corstone1000_plat.c \
plat/arm/board/corstone1000/common/corstone1000_bl2_mem_params_desc.c \
diff --git a/plat/mediatek/drivers/emi_mpu/emi_mpu_common.c b/plat/mediatek/drivers/emi_mpu/emi_mpu_common.c
index 7eeadec..8810be3 100644
--- a/plat/mediatek/drivers/emi_mpu/emi_mpu_common.c
+++ b/plat/mediatek/drivers/emi_mpu/emi_mpu_common.c
@@ -118,12 +118,7 @@
u_register_t x3, u_register_t x4,
void *handle, struct smccc_res *smccc_ret)
{
- int ret;
-
- ret = emi_mpu_optee_handler(x1, x2, x3);
- SMC_RET2(handle, ret, 0U);
-
- return 0;
+ return (u_register_t) emi_mpu_optee_handler(x1, x2, x3);
}
DECLARE_SMC_HANDLER(MTK_SIP_TEE_MPU_PERM_SET, mtk_emi_mpu_sip_handler);
diff --git a/plat/xilinx/versal/bl31_versal_setup.c b/plat/xilinx/versal/bl31_versal_setup.c
index c50f06f..99797b5 100644
--- a/plat/xilinx/versal/bl31_versal_setup.c
+++ b/plat/xilinx/versal/bl31_versal_setup.c
@@ -86,7 +86,7 @@
}
console_set_scope(&versal_runtime_console, (uint32_t)(CONSOLE_FLAG_BOOT |
- CONSOLE_FLAG_RUNTIME));
+ CONSOLE_FLAG_RUNTIME | CONSOLE_FLAG_CRASH));
} else if (VERSAL_CONSOLE_IS(dcc)) {
/* Initialize the dcc console for debug */
int32_t rc = console_dcc_register();
diff --git a/plat/xilinx/versal_net/aarch64/versal_net_helpers.S b/plat/xilinx/versal_net/aarch64/versal_net_helpers.S
index ccebff2..dab8717 100644
--- a/plat/xilinx/versal_net/aarch64/versal_net_helpers.S
+++ b/plat/xilinx/versal_net/aarch64/versal_net_helpers.S
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2018-2021, Arm Limited and Contributors. All rights reserved.
* Copyright (c) 2018-2022, Xilinx, Inc. All rights reserved.
- * Copyright (c) 2022, Advanced Micro Devices, Inc. All rights reserved.
+ * Copyright (c) 2022-2023, Advanced Micro Devices, Inc. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -16,9 +16,6 @@
.globl plat_is_my_cpu_primary
.globl platform_mem_init
.globl plat_my_core_pos
- .globl plat_crash_console_init
- .globl plat_crash_console_putc
- .globl plat_crash_console_flush
/* -----------------------------------------------------
* void plat_secondary_cold_boot_setup (void);
@@ -69,43 +66,3 @@
func platform_mem_init
ret
endfunc platform_mem_init
-
-
- /* ---------------------------------------------
- * int plat_crash_console_init(void)
- * Function to initialize the crash console
- * without a C Runtime to print crash report.
- * Clobber list : x0, x1, x2
- * ---------------------------------------------
- */
-func plat_crash_console_init
-/* mov_imm x0, PLAT_VERSAL_NET_CRASH_UART_BASE
- mov_imm x1, PLAT_VERSAL_NET_CRASH_UART_CLK_IN_HZ
- mov_imm x2, VERSAL_NET_CONSOLE_BAUDRATE
- b console_pl011_core_init */
-endfunc plat_crash_console_init
-
- /* ---------------------------------------------
- * int plat_crash_console_putc(int c)
- * Function to print a character on the crash
- * console without a C Runtime.
- * Clobber list : x1, x2
- * ---------------------------------------------
- */
-func plat_crash_console_putc
- mov_imm x1, PLAT_VERSAL_NET_CRASH_UART_BASE
- b console_pl011_core_putc
-endfunc plat_crash_console_putc
-
- /* ---------------------------------------------
- * void plat_crash_console_flush()
- * Function to force a write of all buffered
- * data that hasn't been output.
- * Out : void.
- * Clobber list : x0, x1
- * ---------------------------------------------
- */
-func plat_crash_console_flush
- mov_imm x0, PLAT_VERSAL_NET_CRASH_UART_BASE
- b console_pl011_core_flush
-endfunc plat_crash_console_flush
diff --git a/plat/xilinx/versal_net/bl31_versal_net_setup.c b/plat/xilinx/versal_net/bl31_versal_net_setup.c
index d2b6c7b..91f9a46 100644
--- a/plat/xilinx/versal_net/bl31_versal_net_setup.c
+++ b/plat/xilinx/versal_net/bl31_versal_net_setup.c
@@ -113,7 +113,7 @@
}
console_set_scope(&versal_net_runtime_console, CONSOLE_FLAG_BOOT |
- CONSOLE_FLAG_RUNTIME);
+ CONSOLE_FLAG_RUNTIME | CONSOLE_FLAG_CRASH);
} else if (VERSAL_NET_CONSOLE_IS(dcc)) {
/* Initialize the dcc console for debug.
* dcc is over jtag and does not configures uart0 or uart1.
diff --git a/plat/xilinx/versal_net/include/versal_net_def.h b/plat/xilinx/versal_net/include/versal_net_def.h
index 758882c..53eb2cd 100644
--- a/plat/xilinx/versal_net/include/versal_net_def.h
+++ b/plat/xilinx/versal_net/include/versal_net_def.h
@@ -144,8 +144,6 @@
#define VERSAL_NET_UART_BASE VERSAL_NET_UART0_BASE
#endif
-#define PLAT_VERSAL_NET_CRASH_UART_BASE VERSAL_NET_UART_BASE
-#define PLAT_VERSAL_NET_CRASH_UART_CLK_IN_HZ VERSAL_NET_UART_CLOCK
#define VERSAL_NET_CONSOLE_BAUDRATE VERSAL_NET_UART_BAUDRATE
/* Processor core device IDs */
diff --git a/plat/xilinx/versal_net/platform.mk b/plat/xilinx/versal_net/platform.mk
index 9c4cfa0..9fa16fd 100644
--- a/plat/xilinx/versal_net/platform.mk
+++ b/plat/xilinx/versal_net/platform.mk
@@ -86,6 +86,7 @@
drivers/delay_timer/generic_delay_timer.c \
${GICV3_SOURCES} \
drivers/arm/pl011/aarch64/pl011_console.S \
+ plat/common/aarch64/crash_console_helpers.S \
plat/arm/common/arm_common.c \
plat/common/plat_gicv3.c \
${PLAT_PATH}/aarch64/versal_net_helpers.S \
diff --git a/plat/xilinx/zynqmp/bl31_zynqmp_setup.c b/plat/xilinx/zynqmp/bl31_zynqmp_setup.c
index 56d402f..f408992 100644
--- a/plat/xilinx/zynqmp/bl31_zynqmp_setup.c
+++ b/plat/xilinx/zynqmp/bl31_zynqmp_setup.c
@@ -81,7 +81,8 @@
ZYNQMP_UART_BAUDRATE,
&bl31_boot_console);
console_set_scope(&bl31_boot_console,
- CONSOLE_FLAG_RUNTIME | CONSOLE_FLAG_BOOT);
+ CONSOLE_FLAG_RUNTIME | CONSOLE_FLAG_BOOT |
+ CONSOLE_FLAG_CRASH);
} else if (ZYNQMP_CONSOLE_IS(dcc)) {
/* Initialize the dcc console for debug */
int32_t rc = console_dcc_register();
diff --git a/tools/fiptool/Makefile b/tools/fiptool/Makefile
index 4bdebd9..fda7c77 100644
--- a/tools/fiptool/Makefile
+++ b/tools/fiptool/Makefile
@@ -13,8 +13,7 @@
PROJECT := $(notdir ${FIPTOOL})
OBJECTS := fiptool.o tbbr_config.o
V ?= 0
-OPENSSL_DIR := /usr
-
+STATIC ?= 0
override CPPFLAGS += -D_GNU_SOURCE -D_XOPEN_SOURCE=700
HOSTCCFLAGS := -Wall -Werror -pedantic -std=c99
@@ -24,14 +23,22 @@
HOSTCCFLAGS += -O2
endif
+INCLUDE_PATHS := -I../../include/tools_share
+
+DEFINES += -DSTATIC=$(STATIC)
+
+ifeq (${STATIC},1)
+LDOPTS := -static
+else
+OPENSSL_DIR := /usr
+
# Select OpenSSL version flag according to the OpenSSL build selected
# from setting the OPENSSL_DIR path.
$(eval $(call SELECT_OPENSSL_API_VERSION))
-HOSTCCFLAGS += ${DEFINES}
# USING_OPENSSL3 flag will be added to the HOSTCCFLAGS variable with the proper
# computed value.
-HOSTCCFLAGS += -DUSING_OPENSSL3=$(USING_OPENSSL3)
+DEFINES += -DUSING_OPENSSL3=$(USING_OPENSSL3)
# Include library directories where OpenSSL library files are located.
# For a normal installation (i.e.: when ${OPENSSL_DIR} = /usr or
@@ -39,7 +46,11 @@
# directory. However, for a local build of OpenSSL, the built binaries are
# located under the main project directory (i.e.: ${OPENSSL_DIR}, not
# ${OPENSSL_DIR}/lib/).
-LDLIBS := -L${OPENSSL_DIR}/lib -L${OPENSSL_DIR} -lcrypto
+LDOPTS := -L${OPENSSL_DIR}/lib -L${OPENSSL_DIR} -lcrypto
+INCLUDE_PATHS += -I${OPENSSL_DIR}/include
+endif # STATIC
+
+HOSTCCFLAGS += ${DEFINES}
ifeq (${V},0)
Q := @
@@ -47,8 +58,6 @@
Q :=
endif
-INCLUDE_PATHS := -I../../include/tools_share -I${OPENSSL_DIR}/include
-
HOSTCC ?= gcc
ifneq (${PLAT},)
@@ -72,7 +81,7 @@
${PROJECT}: ${OBJECTS} Makefile
@echo " HOSTLD $@"
- ${Q}${HOSTCC} ${OBJECTS} -o $@ ${LDLIBS}
+ ${Q}${HOSTCC} ${OBJECTS} -o $@ $(LDOPTS)
@${ECHO_BLANK_LINE}
@echo "Built $@ successfully"
@${ECHO_BLANK_LINE}
@@ -84,10 +93,11 @@
-include $(DEPS)
--openssl:
+ifeq ($(STATIC),0)
ifeq ($(DEBUG),1)
@echo "Selected OpenSSL version: ${OPENSSL_CURRENT_VER}"
endif
-
+endif # STATIC
clean:
$(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS} $(DEPS))
diff --git a/tools/fiptool/fiptool.c b/tools/fiptool/fiptool.c
index fadf319..6c566ef 100644
--- a/tools/fiptool/fiptool.c
+++ b/tools/fiptool/fiptool.c
@@ -460,6 +460,7 @@
return opts;
}
+#if !STATIC
static void md_print(const unsigned char *md, size_t len)
{
size_t i;
@@ -467,6 +468,7 @@
for (i = 0; i < len; i++)
printf("%02x", md[i]);
}
+#endif
static int info_cmd(int argc, char *argv[])
{
@@ -498,7 +500,13 @@
(unsigned long long)image->toc_e.offset_address,
(unsigned long long)image->toc_e.size,
desc->cmdline_name);
-#ifndef _MSC_VER /* We don't have SHA256 for Visual Studio. */
+
+ /*
+ * Omit this informative code portion for:
+ * Visual Studio missing SHA256.
+ * Statically linked builds.
+ */
+#if !defined(_MSC_VER) && !STATIC
if (verbose) {
unsigned char md[SHA256_DIGEST_LENGTH];