Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Andreas Bießmann | d2eae43 | 2013-04-18 22:48:50 +0000 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2013 |
Andreas Bießmann | 09c2b8f | 2016-05-01 03:46:16 +0200 | [diff] [blame] | 4 | * Andreas Bießmann <andreas@biessmann.org> |
Andreas Bießmann | d2eae43 | 2013-04-18 22:48:50 +0000 | [diff] [blame] | 5 | * |
| 6 | * This file consolidates all the different hang() functions implemented in |
| 7 | * u-boot. |
Andreas Bießmann | d2eae43 | 2013-04-18 22:48:50 +0000 | [diff] [blame] | 8 | */ |
| 9 | |
| 10 | #include <common.h> |
| 11 | #include <bootstage.h> |
Simon Glass | db41d65 | 2019-12-28 10:45:07 -0700 | [diff] [blame] | 12 | #include <hang.h> |
Simon Glass | f2980ec | 2019-05-18 11:59:44 -0600 | [diff] [blame] | 13 | #include <os.h> |
Andreas Bießmann | d2eae43 | 2013-04-18 22:48:50 +0000 | [diff] [blame] | 14 | |
| 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 | */ |
| 23 | void hang(void) |
| 24 | { |
Simon Glass | aa0ffe8 | 2018-10-01 12:22:20 -0600 | [diff] [blame] | 25 | #if !defined(CONFIG_SPL_BUILD) || \ |
| 26 | (CONFIG_IS_ENABLED(LIBCOMMON_SUPPORT) && \ |
Simon Glass | 2a73606 | 2021-08-08 12:20:12 -0600 | [diff] [blame] | 27 | CONFIG_IS_ENABLED(SERIAL)) |
Andreas Bießmann | d2eae43 | 2013-04-18 22:48:50 +0000 | [diff] [blame] | 28 | puts("### ERROR ### Please RESET the board ###\n"); |
| 29 | #endif |
| 30 | bootstage_error(BOOTSTAGE_ID_NEED_RESET); |
Simon Glass | f2980ec | 2019-05-18 11:59:44 -0600 | [diff] [blame] | 31 | if (IS_ENABLED(CONFIG_SANDBOX)) |
| 32 | os_exit(1); |
Andreas Bießmann | d2eae43 | 2013-04-18 22:48:50 +0000 | [diff] [blame] | 33 | for (;;) |
| 34 | ; |
| 35 | } |