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