Debian Codegraph @

plat/arm/board/fvp/fvp_err.c

raw
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 */
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
33 void __dead2 plat_arm_system_reset(void)
34 {
35 /* Write the System Configuration Control Register */
36 mmio_write_32(V2M_SYSREGS_BASE + V2M_SYS_CFGCTRL,
37 V2M_CFGCTRL_START |
38 V2M_CFGCTRL_RW |
39 V2M_CFGCTRL_FUNC(V2M_FUNC_REBOOT));
40 wfi();
41 ERROR("FVP System Reset: operation not handled.\n");
42 panic();
43 }