blob: 1f9f0dd14781b7ef1c0e90be64a387557b46926c [file] [log] [blame]
Ambroise Vincentfa42c9e2019-07-04 14:58:45 +01001/*
Manish V Badarkhe56808e42021-05-23 13:16:46 +01002 * Copyright (c) 2019-2021, Arm Limited. All rights reserved.
Ambroise Vincentfa42c9e2019-07-04 14:58:45 +01003 *
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>
Manish V Badarkhe56808e42021-05-23 13:16:46 +010012#include <lib/mmio.h>
Ambroise Vincentfa42c9e2019-07-04 14:58:45 +010013#include <plat/arm/common/plat_arm.h>
Ambroise Vincentfa42c9e2019-07-04 14:58:45 +010014#include <platform_def.h>
15
16/*
17 * FVP error handler
18 */
19__dead2 void plat_arm_error_handler(int err)
20{
Manish V Badarkhe56808e42021-05-23 13:16:46 +010021 /* Propagate the err code in the NV-flags register */
22 mmio_write_32(V2M_SYS_NVFLAGS_ADDR, (uint32_t)err);
Ambroise Vincentfa42c9e2019-07-04 14:58:45 +010023
Jimmy Brisson39f9eee2020-08-05 13:44:05 -050024 console_flush();
Ambroise Vincentfa42c9e2019-07-04 14:58:45 +010025
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}