hang.c 884 B

12345678910111213141516171819202122232425262728293031323334
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * (C) Copyright 2013
  4. * Andreas Bießmann <andreas@biessmann.org>
  5. *
  6. * This file consolidates all the different hang() functions implemented in
  7. * u-boot.
  8. */
  9. #include <common.h>
  10. #include <bootstage.h>
  11. #include <os.h>
  12. /**
  13. * hang - stop processing by staying in an endless loop
  14. *
  15. * The purpose of this function is to stop further execution of code cause
  16. * something went completely wrong. To catch this and give some feedback to
  17. * the user one needs to catch the bootstage_error (see show_boot_progress())
  18. * in the board code.
  19. */
  20. void hang(void)
  21. {
  22. #if !defined(CONFIG_SPL_BUILD) || \
  23. (CONFIG_IS_ENABLED(LIBCOMMON_SUPPORT) && \
  24. CONFIG_IS_ENABLED(SERIAL_SUPPORT))
  25. puts("### ERROR ### Please RESET the board ###\n");
  26. #endif
  27. bootstage_error(BOOTSTAGE_ID_NEED_RESET);
  28. if (IS_ENABLED(CONFIG_SANDBOX))
  29. os_exit(1);
  30. for (;;)
  31. ;
  32. }