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