diff options
author | Andreas Bießmann <andreas.devel@googlemail.com> | 2013-04-18 22:48:50 +0000 |
---|---|---|
committer | Daniel Thompson <daniel.thompson@linaro.org> | 2017-08-02 12:26:51 +0100 |
commit | 83063986401cdb79482102c6d293d4a4bea470d6 (patch) | |
tree | ea188303b7551b359e28f1112472214dd78c3ee9 | |
parent | 05b8e07126b22128086aa37f57e986442e021c63 (diff) |
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>
(cherry picked from commit d2eae43ba803cff75b44a07d08d718ecdecdee94)
-rw-r--r-- | arch/arm/lib/board.c | 6 | ||||
-rw-r--r-- | arch/avr32/lib/board.c | 5 | ||||
-rw-r--r-- | arch/blackfin/lib/board.c | 14 | ||||
-rw-r--r-- | arch/m68k/lib/board.c | 7 | ||||
-rw-r--r-- | arch/microblaze/lib/board.c | 6 | ||||
-rw-r--r-- | arch/mips/lib/board.c | 7 | ||||
-rw-r--r-- | arch/nds32/lib/board.c | 7 | ||||
-rw-r--r-- | arch/nios2/lib/board.c | 10 | ||||
-rw-r--r-- | arch/openrisc/lib/board.c | 12 | ||||
-rw-r--r-- | arch/powerpc/lib/board.c | 9 | ||||
-rw-r--r-- | arch/sh/lib/board.c | 9 | ||||
-rw-r--r-- | arch/sparc/lib/board.c | 9 | ||||
-rw-r--r-- | arch/x86/lib/board.c | 7 | ||||
-rw-r--r-- | lib/Makefile | 1 | ||||
-rw-r--r-- | lib/hang.c | 47 |
15 files changed, 48 insertions, 108 deletions
diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index 3bb303ec31..4ad81f8f91 100644 --- a/arch/arm/lib/board.c +++ b/arch/arm/lib/board.c @@ -652,9 +652,3 @@ void board_init_r(gd_t *id, ulong dest_addr) /* NOTREACHED - no way out of command loop except booting */ } - -void hang(void) -{ - puts("### ERROR ### Please RESET the board ###\n"); - for (;;); -} diff --git a/arch/avr32/lib/board.c b/arch/avr32/lib/board.c index b390a6c8f8..3bfc64d27c 100644 --- a/arch/avr32/lib/board.c +++ b/arch/avr32/lib/board.c @@ -120,11 +120,6 @@ static int display_banner (void) return 0; } -void hang(void) -{ - for (;;) ; -} - static int display_dram_config (void) { int i; diff --git a/arch/blackfin/lib/board.c b/arch/blackfin/lib/board.c index c380d271e7..8c3dda5458 100644 --- a/arch/blackfin/lib/board.c +++ b/arch/blackfin/lib/board.c @@ -413,17 +413,3 @@ void board_init_r(gd_t * id, ulong dest_addr) for (;;) main_loop(); } - -void hang(void) -{ -#ifdef CONFIG_STATUS_LED - status_led_set(STATUS_LED_BOOT, STATUS_LED_OFF); - status_led_set(STATUS_LED_CRASH, STATUS_LED_BLINKING); -#endif - puts("### ERROR ### Please RESET the board ###\n"); - while (1) - /* If a JTAG emulator is hooked up, we'll automatically trigger - * a breakpoint in it. If one isn't, this is just a NOP. - */ - asm("emuexcpt;"); -} diff --git a/arch/m68k/lib/board.c b/arch/m68k/lib/board.c index 65a8595c2b..b93c7eb491 100644 --- a/arch/m68k/lib/board.c +++ b/arch/m68k/lib/board.c @@ -666,10 +666,3 @@ void board_init_r (gd_t *id, ulong dest_addr) /* NOTREACHED - no way out of command loop except booting */ } - - -void hang(void) -{ - puts ("### ERROR ### Please RESET the board ###\n"); - for (;;); -} diff --git a/arch/microblaze/lib/board.c b/arch/microblaze/lib/board.c index f3679d536b..5217aba37b 100644 --- a/arch/microblaze/lib/board.c +++ b/arch/microblaze/lib/board.c @@ -190,9 +190,3 @@ void board_init (void) main_loop (); } } - -void hang (void) -{ - puts ("### ERROR ### Please RESET the board ###\n"); - for (;;) ; -} diff --git a/arch/mips/lib/board.c b/arch/mips/lib/board.c index 59a80011da..cfcbf4cf4e 100644 --- a/arch/mips/lib/board.c +++ b/arch/mips/lib/board.c @@ -365,10 +365,3 @@ void board_init_r(gd_t *id, ulong dest_addr) /* NOTREACHED - no way out of command loop except booting */ } - -void hang(void) -{ - puts("### ERROR ### Please RESET the board ###\n"); - for (;;) - ; -} diff --git a/arch/nds32/lib/board.c b/arch/nds32/lib/board.c index 7121313a83..79288c2c64 100644 --- a/arch/nds32/lib/board.c +++ b/arch/nds32/lib/board.c @@ -419,10 +419,3 @@ void board_init_r(gd_t *id, ulong dest_addr) /* NOTREACHED - no way out of command loop except booting */ } - -void hang(void) -{ - puts("### ERROR ### Please RESET the board ###\n"); - for (;;) - ; -} diff --git a/arch/nios2/lib/board.c b/arch/nios2/lib/board.c index ca8a3e5246..94c07e1e91 100644 --- a/arch/nios2/lib/board.c +++ b/arch/nios2/lib/board.c @@ -166,13 +166,3 @@ void board_init (void) main_loop (); } } - - -/***********************************************************************/ - -void hang (void) -{ - disable_interrupts (); - puts("### ERROR ### Please reset board ###\n"); - for (;;); -} diff --git a/arch/openrisc/lib/board.c b/arch/openrisc/lib/board.c index 85aa1899be..630e45fdb1 100644 --- a/arch/openrisc/lib/board.c +++ b/arch/openrisc/lib/board.c @@ -154,15 +154,3 @@ void board_init(void) main_loop(); } } - - -/***********************************************************************/ - -void hang(void) -{ - disable_interrupts(); - puts("### ERROR ### Please reset board ###\n"); - - for (;;) - ; -} diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c index fea310eedd..72675d3c36 100644 --- a/arch/powerpc/lib/board.c +++ b/arch/powerpc/lib/board.c @@ -1050,15 +1050,6 @@ void board_init_r(gd_t *id, ulong dest_addr) /* NOTREACHED - no way out of command loop except booting */ } -void hang(void) -{ - puts("### ERROR ### Please RESET the board ###\n"); - bootstage_error(BOOTSTAGE_ID_NEED_RESET); - for (;;) - ; -} - - #if 0 /* We could use plain global data, but the resulting code is bigger */ /* * Pointer to initial global data area diff --git a/arch/sh/lib/board.c b/arch/sh/lib/board.c index 34d7881f44..cd2067f0d2 100644 --- a/arch/sh/lib/board.c +++ b/arch/sh/lib/board.c @@ -199,12 +199,3 @@ void sh_generic_init(void) main_loop(); } } - -/***********************************************************************/ - -void hang(void) -{ - puts("Board ERROR\n"); - for (;;) - ; -} diff --git a/arch/sparc/lib/board.c b/arch/sparc/lib/board.c index 7e48775dfe..e21ff6940d 100644 --- a/arch/sparc/lib/board.c +++ b/arch/sparc/lib/board.c @@ -415,13 +415,4 @@ void board_init_f(ulong bootflag) } -void hang(void) -{ - puts("### ERROR ### Please RESET the board ###\n"); -#ifdef CONFIG_SHOW_BOOT_PROGRESS - bootstage_error(BOOTSTAGE_ID_NEED_RESET); -#endif - for (;;) ; -} - /************************************************************************/ diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c index 90cf7fc888..941868385a 100644 --- a/arch/x86/lib/board.c +++ b/arch/x86/lib/board.c @@ -255,10 +255,3 @@ void board_init_r(gd_t *id, ulong dest_addr) /* NOTREACHED - no way out of command loop except booting */ } - -void hang(void) -{ - puts("### ERROR ### Please RESET the board ###\n"); - for (;;) - ; -} diff --git a/lib/Makefile b/lib/Makefile index c6d3f639fe..1144d08014 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -63,6 +63,7 @@ COBJS-$(CONFIG_SPL_IMAGE_SUPPORT) += crc32.o endif COBJS-y += ctype.o COBJS-y += div64.o +COBJS-y += hang.o COBJS-y += string.o COBJS-y += time.o COBJS-$(CONFIG_BOOTP_PXE) += uuid.o diff --git a/lib/hang.c b/lib/hang.c new file mode 100644 index 0000000000..fc1286c0b7 --- /dev/null +++ b/lib/hang.c @@ -0,0 +1,47 @@ +/* + * (C) Copyright 2013 + * Andreas Bießmann <andreas.devel@googlemail.com> + * + * This file consolidates all the different hang() functions implemented in + * u-boot. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <bootstage.h> + +/** + * hang - stop processing by staying in an endless loop + * + * The purpose of this function is to stop further execution of code cause + * something went completely wrong. To catch this and give some feedback to + * the user one needs to catch the bootstage_error (see show_boot_progress()) + * in the board code. + */ +void hang(void) +{ +#if !defined(CONFIG_SPL_BUILD) || (defined(CONFIG_SPL_LIBCOMMON_SUPPORT) && \ + defined(CONFIG_SPL_SERIAL_SUPPORT)) + puts("### ERROR ### Please RESET the board ###\n"); +#endif + bootstage_error(BOOTSTAGE_ID_NEED_RESET); + for (;;) + ; +} |