blob: 02d751e9a56e338f6c9c0a6e20898e06591aba8c [file] [log] [blame]
Sathees Balya22576072018-09-03 17:41:13 +01001/*
Manish V Badarkhe79f4ee02021-06-16 19:59:41 +01002 * Copyright (c) 2015-2021, ARM Limited and Contributors. All rights reserved.
Sathees Balya22576072018-09-03 17:41:13 +01003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
Sathees Balya22576072018-09-03 17:41:13 +01007#include <errno.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +00008
9#include <arch_helpers.h>
Ambroise Vincentfa42c9e2019-07-04 14:58:45 +010010#include <drivers/arm/sp805.h>
Ambroise Vincentb237bca2019-02-13 15:58:00 +000011#include <plat/arm/common/plat_arm.h>
Antonio Nino Diaza320ecd2019-01-15 14:19:50 +000012#include <platform_def.h>
Sathees Balya22576072018-09-03 17:41:13 +010013
14/*
15 * Juno error handler
16 */
17void __dead2 plat_arm_error_handler(int err)
18{
Sathees Balya22576072018-09-03 17:41:13 +010019 /* Propagate the err code in the NV-flags register */
Manish V Badarkhe79f4ee02021-06-16 19:59:41 +010020 mmio_write_32(V2M_SYS_NVFLAGS_ADDR, (uint32_t)err);
Sathees Balya22576072018-09-03 17:41:13 +010021
Ambroise Vincentfa42c9e2019-07-04 14:58:45 +010022 /* Setup the watchdog to reset the system as soon as possible */
23 sp805_refresh(ARM_SP805_TWDG_BASE, 1U);
24
Sathees Balya22576072018-09-03 17:41:13 +010025 for (;;)
26 wfi();
27}