blob: 0fe70167538e24d02c4185089d1923e1efb8f78b [file] [log] [blame]
Juan Castillo7b4c1402015-10-06 14:01:35 +01001/*
Roberto Vargasfd116b92018-02-12 12:36:17 +00002 * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
Juan Castillo7b4c1402015-10-06 14:01:35 +01003 *
dp-arm82cb2c12017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Juan Castillo7b4c1402015-10-06 14:01:35 +01005 */
6
Sandrine Bailleux8c9e1af2016-08-18 09:24:40 +01007#include <arch_helpers.h>
Juan Castillo7b4c1402015-10-06 14:01:35 +01008#include <errno.h>
Roberto Vargasfd116b92018-02-12 12:36:17 +00009#include <platform.h>
Juan Castillo7b4c1402015-10-06 14:01:35 +010010#include <v2m_def.h>
11
12#define V2M_SYS_NVFLAGS_ADDR (V2M_SYSREGS_BASE + V2M_SYS_NVFLAGS)
13
14/*
15 * Juno error handler
16 */
17void plat_error_handler(int err)
18{
19 uint32_t *flags_ptr = (uint32_t *)V2M_SYS_NVFLAGS_ADDR;
20
21 /* Propagate the err code in the NV-flags register */
22 *flags_ptr = err;
23
24 /* Loop until the watchdog resets the system */
25 for (;;)
Sandrine Bailleux8c9e1af2016-08-18 09:24:40 +010026 wfi();
Juan Castillo7b4c1402015-10-06 14:01:35 +010027}