socfpga_sip_ecc.c 966 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // SPDX-License-Identifier: BSD-3-Clause
  2. /*
  3. * Copyright (c) 2020-2022, ARM Limited and Contributors. All rights reserved.
  4. */
  5. #include <assert.h>
  6. #include <common/debug.h>
  7. #include <common/runtime_svc.h>
  8. #include <lib/mmio.h>
  9. #include <tools_share/uuid.h>
  10. #include "socfpga_fcs.h"
  11. #include "socfpga_mailbox.h"
  12. #include "socfpga_reset_manager.h"
  13. #include "socfpga_sip_svc.h"
  14. #include "socfpga_system_manager.h"
  15. uint32_t intel_ecc_dbe_notification(uint64_t dbe_value)
  16. {
  17. dbe_value &= WARM_RESET_WFI_FLAG;
  18. /* Trap CPUs in WFI if warm reset flag is set */
  19. if (dbe_value > 0) {
  20. while (1) {
  21. wfi();
  22. }
  23. }
  24. return INTEL_SIP_SMC_STATUS_OK;
  25. }
  26. bool cold_reset_for_ecc_dbe(void)
  27. {
  28. uint32_t dbe_int_status;
  29. dbe_int_status = mmio_read_32(SOCFPGA_SYSMGR(BOOT_SCRATCH_COLD_8));
  30. /* Trigger cold reset only for error in critical memory (DDR/OCRAM) */
  31. dbe_int_status &= SYSMGR_ECC_DBE_COLD_RST_MASK;
  32. if (dbe_int_status > 0) {
  33. return true;
  34. }
  35. return false;
  36. }