Commit d2eae43ba803cff75b44a07d08d718ecdecdee94
Committed by
Tom Rini
1 parent
b0dac5b1af
Exists in
master
and in
53 other branches
lib: consolidate hang()
Delete all occurrences of hang() and provide a generic function. Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com> Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net> [trini: Modify check around puts() in hang.c slightly] Signed-off-by: Tom Rini <trini@ti.com>
Showing 20 changed files with 48 additions and 150 deletions Side-by-side Diff
- arch/arm/cpu/arm926ejs/mxs/spl_boot.c
- arch/arm/cpu/arm926ejs/spear/spl.c
- arch/arm/lib/board.c
- arch/avr32/lib/board.c
- arch/blackfin/lib/board.c
- arch/m68k/lib/board.c
- arch/microblaze/lib/board.c
- arch/mips/lib/board.c
- arch/nds32/lib/board.c
- arch/nios2/lib/board.c
- arch/openrisc/lib/board.c
- arch/powerpc/lib/board.c
- arch/sh/lib/board.c
- arch/sparc/lib/board.c
- arch/x86/lib/board.c
- common/board_f.c
- common/spl/spl.c
- drivers/mtd/nand/mxc_nand_spl.c
- lib/Makefile
- lib/hang.c
arch/arm/cpu/arm926ejs/mxs/spl_boot.c
arch/arm/cpu/arm926ejs/spear/spl.c
... | ... | @@ -31,13 +31,6 @@ |
31 | 31 | #include <asm/arch/spr_misc.h> |
32 | 32 | #include <asm/arch/spr_syscntl.h> |
33 | 33 | |
34 | -inline void hang(void) | |
35 | -{ | |
36 | - serial_puts("### ERROR ### Please RESET the board ###\n"); | |
37 | - for (;;) | |
38 | - ; | |
39 | -} | |
40 | - | |
41 | 34 | static void ddr_clock_init(void) |
42 | 35 | { |
43 | 36 | struct misc_regs *misc_p = (struct misc_regs *)CONFIG_SPEAR_MISCBASE; |
arch/arm/lib/board.c
arch/avr32/lib/board.c
arch/blackfin/lib/board.c
... | ... | @@ -432,18 +432,4 @@ |
432 | 432 | for (;;) |
433 | 433 | main_loop(); |
434 | 434 | } |
435 | - | |
436 | -void hang(void) | |
437 | -{ | |
438 | -#ifdef CONFIG_STATUS_LED | |
439 | - status_led_set(STATUS_LED_BOOT, STATUS_LED_OFF); | |
440 | - status_led_set(STATUS_LED_CRASH, STATUS_LED_BLINKING); | |
441 | -#endif | |
442 | - puts("### ERROR ### Please RESET the board ###\n"); | |
443 | - while (1) | |
444 | - /* If a JTAG emulator is hooked up, we'll automatically trigger | |
445 | - * a breakpoint in it. If one isn't, this is just a NOP. | |
446 | - */ | |
447 | - asm("emuexcpt;"); | |
448 | -} |
arch/m68k/lib/board.c
arch/microblaze/lib/board.c
arch/mips/lib/board.c
arch/nds32/lib/board.c
arch/nios2/lib/board.c
... | ... | @@ -162,15 +162,4 @@ |
162 | 162 | main_loop(); |
163 | 163 | } |
164 | 164 | } |
165 | - | |
166 | - | |
167 | -/***********************************************************************/ | |
168 | - | |
169 | -void hang(void) | |
170 | -{ | |
171 | - disable_interrupts(); | |
172 | - puts("### ERROR ### Please reset board ###\n"); | |
173 | - for (;;) | |
174 | - ; | |
175 | -} |
arch/openrisc/lib/board.c
... | ... | @@ -154,16 +154,4 @@ |
154 | 154 | main_loop(); |
155 | 155 | } |
156 | 156 | } |
157 | - | |
158 | - | |
159 | -/***********************************************************************/ | |
160 | - | |
161 | -void hang(void) | |
162 | -{ | |
163 | - disable_interrupts(); | |
164 | - puts("### ERROR ### Please reset board ###\n"); | |
165 | - | |
166 | - for (;;) | |
167 | - ; | |
168 | -} |
arch/powerpc/lib/board.c
... | ... | @@ -1050,15 +1050,6 @@ |
1050 | 1050 | /* NOTREACHED - no way out of command loop except booting */ |
1051 | 1051 | } |
1052 | 1052 | |
1053 | -void hang(void) | |
1054 | -{ | |
1055 | - puts("### ERROR ### Please RESET the board ###\n"); | |
1056 | - bootstage_error(BOOTSTAGE_ID_NEED_RESET); | |
1057 | - for (;;) | |
1058 | - ; | |
1059 | -} | |
1060 | - | |
1061 | - | |
1062 | 1053 | #if 0 /* We could use plain global data, but the resulting code is bigger */ |
1063 | 1054 | /* |
1064 | 1055 | * Pointer to initial global data area |
arch/sh/lib/board.c
arch/sparc/lib/board.c
... | ... | @@ -411,14 +411,5 @@ |
411 | 411 | |
412 | 412 | } |
413 | 413 | |
414 | -void hang(void) | |
415 | -{ | |
416 | - puts("### ERROR ### Please RESET the board ###\n"); | |
417 | -#ifdef CONFIG_SHOW_BOOT_PROGRESS | |
418 | - bootstage_error(BOOTSTAGE_ID_NEED_RESET); | |
419 | -#endif | |
420 | - for (;;) ; | |
421 | -} | |
422 | - | |
423 | 414 | /************************************************************************/ |
arch/x86/lib/board.c
common/board_f.c
common/spl/spl.c
... | ... | @@ -48,13 +48,6 @@ |
48 | 48 | /* Define board data structure */ |
49 | 49 | static bd_t bdata __attribute__ ((section(".data"))); |
50 | 50 | |
51 | -inline void hang(void) | |
52 | -{ | |
53 | - puts("### ERROR ### Please RESET the board ###\n"); | |
54 | - for (;;) | |
55 | - ; | |
56 | -} | |
57 | - | |
58 | 51 | /* |
59 | 52 | * Default function to determine if u-boot or the OS should |
60 | 53 | * be started. This implementation always returns 1. |
drivers/mtd/nand/mxc_nand_spl.c
lib/Makefile
lib/hang.c
1 | +/* | |
2 | + * (C) Copyright 2013 | |
3 | + * Andreas Bießmann <andreas.devel@googlemail.com> | |
4 | + * | |
5 | + * This file consolidates all the different hang() functions implemented in | |
6 | + * u-boot. | |
7 | + * | |
8 | + * See file CREDITS for list of people who contributed to this | |
9 | + * project. | |
10 | + * | |
11 | + * This program is free software; you can redistribute it and/or | |
12 | + * modify it under the terms of the GNU General Public License as | |
13 | + * published by the Free Software Foundation; either version 2 of | |
14 | + * the License, or (at your option) any later version. | |
15 | + * | |
16 | + * This program is distributed in the hope that it will be useful, | |
17 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | + * GNU General Public License for more details. | |
20 | + * | |
21 | + * You should have received a copy of the GNU General Public License | |
22 | + * along with this program; if not, write to the Free Software | |
23 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
24 | + * MA 02111-1307 USA | |
25 | + */ | |
26 | + | |
27 | +#include <common.h> | |
28 | +#include <bootstage.h> | |
29 | + | |
30 | +/** | |
31 | + * hang - stop processing by staying in an endless loop | |
32 | + * | |
33 | + * The purpose of this function is to stop further execution of code cause | |
34 | + * something went completely wrong. To catch this and give some feedback to | |
35 | + * the user one needs to catch the bootstage_error (see show_boot_progress()) | |
36 | + * in the board code. | |
37 | + */ | |
38 | +void hang(void) | |
39 | +{ | |
40 | +#if !defined(CONFIG_SPL_BUILD) || (defined(CONFIG_SPL_LIBCOMMON_SUPPORT) && \ | |
41 | + defined(CONFIG_SPL_SERIAL_SUPPORT)) | |
42 | + puts("### ERROR ### Please RESET the board ###\n"); | |
43 | +#endif | |
44 | + bootstage_error(BOOTSTAGE_ID_NEED_RESET); | |
45 | + for (;;) | |
46 | + ; | |
47 | +} |