1 /*
2  * Copyright (c) 2015-2021, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <errno.h>
8 
9 #include <arch_helpers.h>
10 #include <drivers/arm/sp805.h>
11 #include <plat/arm/common/plat_arm.h>
12 #include <platform_def.h>
13 
14 /*
15  * Juno error handler
16  */
plat_arm_error_handler(int err)17 void __dead2 plat_arm_error_handler(int err)
18 {
19 	/* Propagate the err code in the NV-flags register */
20 	mmio_write_32(V2M_SYS_NVFLAGS_ADDR, (uint32_t)err);
21 
22 	/* Setup the watchdog to reset the system as soon as possible */
23 	sp805_refresh(ARM_SP805_TWDG_BASE, 1U);
24 
25 	for (;;)
26 		wfi();
27 }
28