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