efi_loader: correct includes in efi_variable.c
[oweals/u-boot.git] / lib / hang.c
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
10 #include <common.h>
11 #include <bootstage.h>
12 #include <os.h>
13
14 /**
15  * hang - stop processing by staying in an endless loop
16  *
17  * The purpose of this function is to stop further execution of code cause
18  * something went completely wrong.  To catch this and give some feedback to
19  * the user one needs to catch the bootstage_error (see show_boot_progress())
20  * in the board code.
21  */
22 void hang(void)
23 {
24 #if !defined(CONFIG_SPL_BUILD) || \
25                 (CONFIG_IS_ENABLED(LIBCOMMON_SUPPORT) && \
26                  CONFIG_IS_ENABLED(SERIAL_SUPPORT))
27         puts("### ERROR ### Please RESET the board ###\n");
28 #endif
29         bootstage_error(BOOTSTAGE_ID_NEED_RESET);
30         if (IS_ENABLED(CONFIG_SANDBOX))
31                 os_exit(1);
32         for (;;)
33                 ;
34 }