aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavidcunado-arm <david.cunado@arm.com>2018-03-08 11:33:41 +0000
committerGitHub <noreply@github.com>2018-03-08 11:33:41 +0000
commit16b05e94a2d1757cbb98de068c662d58a6919613 (patch)
tree400d399cfc2e209fd8ba78c40ab3ff6f8bfd8406
parentbf35944bf64480f72b3832dbeddf215e67941660 (diff)
parent7b56928a122f4ba19b5f3d6b834590de2e82a978 (diff)
downloadtrusted-firmware-a-16b05e94a2d1757cbb98de068c662d58a6919613.tar.gz
Merge pull request #1303 from soby-mathew/sm/fix_juno_fwuv1.5-rc2
Juno: Fixes for firmware update
-rw-r--r--plat/arm/board/common/board_css_common.c4
-rw-r--r--plat/arm/board/fvp/fvp_bl1_setup.c13
-rw-r--r--plat/arm/board/fvp/platform.mk2
-rw-r--r--plat/arm/board/juno/juno_bl1_setup.c23
-rw-r--r--plat/arm/board/juno/juno_err.c27
-rw-r--r--plat/arm/board/juno/platform.mk4
-rw-r--r--plat/arm/common/arm_bl1_setup.c12
-rw-r--r--plat/arm/common/arm_bl2u_setup.c2
-rw-r--r--plat/arm/common/arm_common.mk2
-rw-r--r--plat/arm/common/arm_err.c (renamed from plat/arm/board/fvp/fvp_err.c)7
10 files changed, 24 insertions, 72 deletions
diff --git a/plat/arm/board/common/board_css_common.c b/plat/arm/board/common/board_css_common.c
index 032ebdf7ec..c1c3e66a64 100644
--- a/plat/arm/board/common/board_css_common.c
+++ b/plat/arm/board/common/board_css_common.c
@@ -14,7 +14,7 @@
#ifdef IMAGE_BL1
const mmap_region_t plat_arm_mmap[] = {
ARM_MAP_SHARED_RAM,
- V2M_MAP_FLASH0_RO,
+ V2M_MAP_FLASH0_RW,
V2M_MAP_IOFPGA,
CSS_MAP_DEVICE,
SOC_CSS_MAP_DEVICE,
@@ -28,7 +28,7 @@ const mmap_region_t plat_arm_mmap[] = {
#ifdef IMAGE_BL2
const mmap_region_t plat_arm_mmap[] = {
ARM_MAP_SHARED_RAM,
- V2M_MAP_FLASH0_RO,
+ V2M_MAP_FLASH0_RW,
#ifdef PLAT_ARM_MEM_PROT_ADDR
ARM_V2M_MAP_MEM_PROTECT,
#endif
diff --git a/plat/arm/board/fvp/fvp_bl1_setup.c b/plat/arm/board/fvp/fvp_bl1_setup.c
index d50c20a1dc..4b2a340b0c 100644
--- a/plat/arm/board/fvp/fvp_bl1_setup.c
+++ b/plat/arm/board/fvp/fvp_bl1_setup.c
@@ -30,16 +30,3 @@ void bl1_early_platform_setup(void)
*/
fvp_interconnect_enable();
}
-
-/*******************************************************************************
- * The following function checks if Firmware update is needed,
- * by checking if TOC in FIP image is valid or not.
- ******************************************************************************/
-unsigned int bl1_plat_get_next_image_id(void)
-{
- if (!arm_io_is_toc_valid())
- return NS_BL1U_IMAGE_ID;
-
- return BL2_IMAGE_ID;
-}
-
diff --git a/plat/arm/board/fvp/platform.mk b/plat/arm/board/fvp/platform.mk
index 3dca4c2ac8..bb7753822c 100644
--- a/plat/arm/board/fvp/platform.mk
+++ b/plat/arm/board/fvp/platform.mk
@@ -124,7 +124,6 @@ BL1_SOURCES += drivers/io/io_semihosting.c \
lib/semihosting/${ARCH}/semihosting_call.S \
plat/arm/board/fvp/${ARCH}/fvp_helpers.S \
plat/arm/board/fvp/fvp_bl1_setup.c \
- plat/arm/board/fvp/fvp_err.c \
plat/arm/board/fvp/fvp_io_storage.c \
plat/arm/board/fvp/fvp_trusted_boot.c \
${FVP_CPU_LIBS} \
@@ -135,7 +134,6 @@ BL2_SOURCES += drivers/io/io_semihosting.c \
lib/semihosting/semihosting.c \
lib/semihosting/${ARCH}/semihosting_call.S \
plat/arm/board/fvp/fvp_bl2_setup.c \
- plat/arm/board/fvp/fvp_err.c \
plat/arm/board/fvp/fvp_io_storage.c \
plat/arm/board/fvp/fvp_trusted_boot.c \
${FVP_SECURITY_SOURCES}
diff --git a/plat/arm/board/juno/juno_bl1_setup.c b/plat/arm/board/juno/juno_bl1_setup.c
index 7c026bcb79..836a67255d 100644
--- a/plat/arm/board/juno/juno_bl1_setup.c
+++ b/plat/arm/board/juno/juno_bl1_setup.c
@@ -12,31 +12,8 @@
#include <tbbr_img_def.h>
#include <v2m_def.h>
-#define RESET_REASON_WDOG_RESET (0x2)
-
void juno_reset_to_aarch32_state(void);
-
-/*******************************************************************************
- * The following function checks if Firmware update is needed,
- * by checking if TOC in FIP image is valid or watchdog reset happened.
- ******************************************************************************/
-unsigned int bl1_plat_get_next_image_id(void)
-{
- unsigned int *reset_flags_ptr = (unsigned int *)SSC_GPRETN;
- unsigned int *nv_flags_ptr = (unsigned int *)
- (V2M_SYSREGS_BASE + V2M_SYS_NVFLAGS);
- /*
- * Check if TOC is invalid or watchdog reset happened.
- */
- if ((arm_io_is_toc_valid() != 1) ||
- ((*reset_flags_ptr & RESET_REASON_WDOG_RESET) &&
- ((*nv_flags_ptr == -EAUTH) || (*nv_flags_ptr == -ENOENT))))
- return NS_BL1U_IMAGE_ID;
-
- return BL2_IMAGE_ID;
-}
-
/*******************************************************************************
* On JUNO update the arg2 with address of SCP_BL2U image info.
******************************************************************************/
diff --git a/plat/arm/board/juno/juno_err.c b/plat/arm/board/juno/juno_err.c
deleted file mode 100644
index 0fe7016753..0000000000
--- a/plat/arm/board/juno/juno_err.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#include <arch_helpers.h>
-#include <errno.h>
-#include <platform.h>
-#include <v2m_def.h>
-
-#define V2M_SYS_NVFLAGS_ADDR (V2M_SYSREGS_BASE + V2M_SYS_NVFLAGS)
-
-/*
- * Juno error handler
- */
-void plat_error_handler(int err)
-{
- uint32_t *flags_ptr = (uint32_t *)V2M_SYS_NVFLAGS_ADDR;
-
- /* Propagate the err code in the NV-flags register */
- *flags_ptr = err;
-
- /* Loop until the watchdog resets the system */
- for (;;)
- wfi();
-}
diff --git a/plat/arm/board/juno/platform.mk b/plat/arm/board/juno/platform.mk
index 70d690922b..656fc14c74 100644
--- a/plat/arm/board/juno/platform.mk
+++ b/plat/arm/board/juno/platform.mk
@@ -49,12 +49,10 @@ BL1_SOURCES += lib/cpus/aarch64/cortex_a53.S \
lib/cpus/aarch64/cortex_a57.S \
lib/cpus/aarch64/cortex_a72.S \
plat/arm/board/juno/juno_bl1_setup.c \
- plat/arm/board/juno/juno_err.c \
${JUNO_INTERCONNECT_SOURCES} \
${JUNO_SECURITY_SOURCES}
-BL2_SOURCES += plat/arm/board/juno/juno_err.c \
- plat/arm/board/juno/juno_bl2_setup.c \
+BL2_SOURCES += plat/arm/board/juno/juno_bl2_setup.c \
${JUNO_SECURITY_SOURCES}
BL2U_SOURCES += ${JUNO_SECURITY_SOURCES}
diff --git a/plat/arm/common/arm_bl1_setup.c b/plat/arm/common/arm_bl1_setup.c
index 3a30eca670..379e87df29 100644
--- a/plat/arm/common/arm_bl1_setup.c
+++ b/plat/arm/common/arm_bl1_setup.c
@@ -145,3 +145,15 @@ void bl1_plat_prepare_exit(entry_point_info_t *ep_info)
sev();
#endif
}
+
+/*******************************************************************************
+ * The following function checks if Firmware update is needed,
+ * by checking if TOC in FIP image is valid or not.
+ ******************************************************************************/
+unsigned int bl1_plat_get_next_image_id(void)
+{
+ if (!arm_io_is_toc_valid())
+ return NS_BL1U_IMAGE_ID;
+
+ return BL2_IMAGE_ID;
+}
diff --git a/plat/arm/common/arm_bl2u_setup.c b/plat/arm/common/arm_bl2u_setup.c
index cc291fc90a..3b8e4aa464 100644
--- a/plat/arm/common/arm_bl2u_setup.c
+++ b/plat/arm/common/arm_bl2u_setup.c
@@ -8,6 +8,7 @@
#include <arm_def.h>
#include <bl_common.h>
#include <console.h>
+#include <generic_delay_timer.h>
#include <plat_arm.h>
#include <platform_def.h>
#include <platform.h>
@@ -37,6 +38,7 @@ void arm_bl2u_early_platform_setup(meminfo_t *mem_layout, void *plat_info)
/* Initialize the console to provide early debug support */
console_init(PLAT_ARM_BOOT_UART_BASE, PLAT_ARM_BOOT_UART_CLK_IN_HZ,
ARM_CONSOLE_BAUDRATE);
+ generic_delay_timer_init();
}
/*******************************************************************************
diff --git a/plat/arm/common/arm_common.mk b/plat/arm/common/arm_common.mk
index b3462ab8a3..015e454a12 100644
--- a/plat/arm/common/arm_common.mk
+++ b/plat/arm/common/arm_common.mk
@@ -137,6 +137,7 @@ BL1_SOURCES += drivers/arm/sp805/sp805.c \
drivers/io/io_storage.c \
plat/arm/common/arm_bl1_setup.c \
plat/arm/common/arm_dyn_cfg.c \
+ plat/arm/common/arm_err.c \
plat/arm/common/arm_io_storage.c
ifdef EL3_PAYLOAD_BASE
# Need the arm_program_trusted_mailbox() function to release secondary CPUs from
@@ -150,6 +151,7 @@ BL2_SOURCES += drivers/delay_timer/delay_timer.c \
drivers/io/io_memmap.c \
drivers/io/io_storage.c \
plat/arm/common/arm_bl2_setup.c \
+ plat/arm/common/arm_err.c \
plat/arm/common/arm_io_storage.c
# Add `libfdt` and Arm common helpers required for Dynamic Config
diff --git a/plat/arm/board/fvp/fvp_err.c b/plat/arm/common/arm_err.c
index d9ad5175ba..59c5861815 100644
--- a/plat/arm/board/fvp/fvp_err.c
+++ b/plat/arm/common/arm_err.c
@@ -6,6 +6,7 @@
#include <arch_helpers.h>
#include <board_arm_def.h>
+#include <console.h>
#include <debug.h>
#include <errno.h>
#include <norflash.h>
@@ -13,7 +14,7 @@
#include <stdint.h>
/*
- * FVP error handler
+ * ARM common implementation for error handler
*/
void plat_error_handler(int err)
{
@@ -26,7 +27,7 @@ void plat_error_handler(int err)
INFO("Erasing FIP ToC from flash...\n");
nor_unlock(PLAT_ARM_FIP_BASE);
ret = nor_word_program(PLAT_ARM_FIP_BASE, 0);
- if (ret) {
+ if (ret != 0) {
ERROR("Cannot erase ToC\n");
} else {
INFO("Done\n");
@@ -37,6 +38,8 @@ void plat_error_handler(int err)
break;
}
+ (void)console_flush();
+
/* Loop until the watchdog resets the system */
for (;;)
wfi();