fvp_err.c 966 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (c) 2019-2021, Arm Limited. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <errno.h>
  7. #include <common/debug.h>
  8. #include <drivers/arm/sp805.h>
  9. #include <drivers/cfi/v2m_flash.h>
  10. #include <lib/mmio.h>
  11. #include <plat/arm/common/plat_arm.h>
  12. #include <platform_def.h>
  13. /*
  14. * FVP error handler
  15. */
  16. __dead2 void plat_arm_error_handler(int err)
  17. {
  18. /* Propagate the err code in the NV-flags register */
  19. mmio_write_32(V2M_SYS_NVFLAGS_ADDR, (uint32_t)err);
  20. console_flush();
  21. /* Setup the watchdog to reset the system as soon as possible */
  22. sp805_refresh(ARM_SP805_TWDG_BASE, 1U);
  23. for (;;)
  24. wfi();
  25. }
  26. void __dead2 plat_arm_system_reset(void)
  27. {
  28. /* Write the System Configuration Control Register */
  29. mmio_write_32(V2M_SYSREGS_BASE + V2M_SYS_CFGCTRL,
  30. V2M_CFGCTRL_START |
  31. V2M_CFGCTRL_RW |
  32. V2M_CFGCTRL_FUNC(V2M_FUNC_REBOOT));
  33. wfi();
  34. ERROR("FVP System Reset: operation not handled.\n");
  35. panic();
  36. }