blob: 578ac78d45306f949d9ee237c27b17e164c5d317 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Andreas Bießmannd2eae432013-04-18 22:48:50 +00002/*
3 * (C) Copyright 2013
Andreas Bießmann09c2b8f2016-05-01 03:46:16 +02004 * Andreas Bießmann <andreas@biessmann.org>
Andreas Bießmannd2eae432013-04-18 22:48:50 +00005 *
6 * This file consolidates all the different hang() functions implemented in
7 * u-boot.
Andreas Bießmannd2eae432013-04-18 22:48:50 +00008 */
9
10#include <common.h>
11#include <bootstage.h>
Simon Glassdb41d652019-12-28 10:45:07 -070012#include <hang.h>
Simon Glassf2980ec2019-05-18 11:59:44 -060013#include <os.h>
Andreas Bießmannd2eae432013-04-18 22:48:50 +000014
15/**
16 * hang - stop processing by staying in an endless loop
17 *
18 * The purpose of this function is to stop further execution of code cause
19 * something went completely wrong. To catch this and give some feedback to
20 * the user one needs to catch the bootstage_error (see show_boot_progress())
21 * in the board code.
22 */
23void hang(void)
24{
Simon Glassaa0ffe82018-10-01 12:22:20 -060025#if !defined(CONFIG_SPL_BUILD) || \
26 (CONFIG_IS_ENABLED(LIBCOMMON_SUPPORT) && \
27 CONFIG_IS_ENABLED(SERIAL_SUPPORT))
Andreas Bießmannd2eae432013-04-18 22:48:50 +000028 puts("### ERROR ### Please RESET the board ###\n");
29#endif
30 bootstage_error(BOOTSTAGE_ID_NEED_RESET);
Simon Glassf2980ec2019-05-18 11:59:44 -060031 if (IS_ENABLED(CONFIG_SANDBOX))
32 os_exit(1);
Andreas Bießmannd2eae432013-04-18 22:48:50 +000033 for (;;)
34 ;
35}