xref: /aosp_15_r20/external/arm-trusted-firmware/plat/arm/board/fvp/fvp_err.c (revision 54fd6939e177f8ff529b10183254802c76df6d08)
1 /*
2  * Copyright (c) 2019-2021, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <errno.h>
8 
9 #include <common/debug.h>
10 #include <drivers/arm/sp805.h>
11 #include <drivers/cfi/v2m_flash.h>
12 #include <lib/mmio.h>
13 #include <plat/arm/common/plat_arm.h>
14 #include <platform_def.h>
15 
16 /*
17  * FVP error handler
18  */
plat_arm_error_handler(int err)19 __dead2 void plat_arm_error_handler(int err)
20 {
21 	/* Propagate the err code in the NV-flags register */
22 	mmio_write_32(V2M_SYS_NVFLAGS_ADDR, (uint32_t)err);
23 
24 	console_flush();
25 
26 	/* Setup the watchdog to reset the system as soon as possible */
27 	sp805_refresh(ARM_SP805_TWDG_BASE, 1U);
28 
29 	for (;;)
30 		wfi();
31 }
32