137b70031SAmbroise Vincent /* 2*30bbc4faSBoyan Karatotev * Copyright (c) 2019-2025, Arm Limited. All rights reserved. 337b70031SAmbroise Vincent * 437b70031SAmbroise Vincent * SPDX-License-Identifier: BSD-3-Clause 537b70031SAmbroise Vincent */ 637b70031SAmbroise Vincent 737b70031SAmbroise Vincent #include <errno.h> 837b70031SAmbroise Vincent 937b70031SAmbroise Vincent #include <common/debug.h> 1037b70031SAmbroise Vincent #include <drivers/arm/sp805.h> 1137b70031SAmbroise Vincent #include <drivers/cfi/v2m_flash.h> 1259ea3648SManish V Badarkhe #include <lib/mmio.h> 1337b70031SAmbroise Vincent #include <plat/arm/common/plat_arm.h> 1437b70031SAmbroise Vincent #include <platform_def.h> 1537b70031SAmbroise Vincent 1637b70031SAmbroise Vincent /* 1737b70031SAmbroise Vincent * FVP error handler 1837b70031SAmbroise Vincent */ plat_arm_error_handler(int err)1937b70031SAmbroise Vincent__dead2 void plat_arm_error_handler(int err) 2037b70031SAmbroise Vincent { 2159ea3648SManish V Badarkhe /* Propagate the err code in the NV-flags register */ 2259ea3648SManish V Badarkhe mmio_write_32(V2M_SYS_NVFLAGS_ADDR, (uint32_t)err); 2337b70031SAmbroise Vincent 24831b0e98SJimmy Brisson console_flush(); 2537b70031SAmbroise Vincent 2637b70031SAmbroise Vincent /* Setup the watchdog to reset the system as soon as possible */ 2737b70031SAmbroise Vincent sp805_refresh(ARM_SP805_TWDG_BASE, 1U); 2837b70031SAmbroise Vincent 2937b70031SAmbroise Vincent for (;;) 3037b70031SAmbroise Vincent wfi(); 3137b70031SAmbroise Vincent } 32586f60ccSManish V Badarkhe 33