ls_err.c 849 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Copyright 2018-2020 NXP
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. *
  6. */
  7. #include <errno.h>
  8. #include <stdbool.h>
  9. #include <stdint.h>
  10. #include <arch_helpers.h>
  11. #include <common/debug.h>
  12. #if TRUSTED_BOARD_BOOT
  13. #include <dcfg.h>
  14. #include <snvs.h>
  15. #endif
  16. #include "plat_common.h"
  17. /*
  18. * Error handler
  19. */
  20. void plat_error_handler(int err)
  21. {
  22. #if TRUSTED_BOARD_BOOT
  23. uint32_t mode;
  24. bool sb = check_boot_mode_secure(&mode);
  25. #endif
  26. switch (err) {
  27. case -ENOENT:
  28. case -EAUTH:
  29. printf("Authentication failure\n");
  30. #if TRUSTED_BOARD_BOOT
  31. /* For SB production mode i.e ITS = 1 */
  32. if (sb == true) {
  33. if (mode == 1U) {
  34. transition_snvs_soft_fail();
  35. } else {
  36. transition_snvs_non_secure();
  37. }
  38. }
  39. #endif
  40. break;
  41. default:
  42. /* Unexpected error */
  43. break;
  44. }
  45. /* Loop until the watchdog resets the system */
  46. for (;;)
  47. wfi();
  48. }