Commit d2eae43ba803cff75b44a07d08d718ecdecdee94

Authored by Andreas Bießmann
Committed by Tom Rini
1 parent b0dac5b1af

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
... ... @@ -148,11 +148,4 @@
148 148 for (;;)
149 149 ;
150 150 }
151   -
152   -void hang(void) __attribute__ ((noreturn));
153   -void hang(void)
154   -{
155   - for (;;)
156   - ;
157   -}
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
... ... @@ -706,10 +706,4 @@
706 706  
707 707 /* NOTREACHED - no way out of command loop except booting */
708 708 }
709   -
710   -void hang(void)
711   -{
712   - puts("### ERROR ### Please RESET the board ###\n");
713   - for (;;);
714   -}
arch/avr32/lib/board.c
... ... @@ -120,11 +120,6 @@
120 120 return 0;
121 121 }
122 122  
123   -void hang(void)
124   -{
125   - for (;;) ;
126   -}
127   -
128 123 static int display_dram_config (void)
129 124 {
130 125 int i;
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
... ... @@ -663,11 +663,4 @@
663 663  
664 664 /* NOTREACHED - no way out of command loop except booting */
665 665 }
666   -
667   -
668   -void hang(void)
669   -{
670   - puts ("### ERROR ### Please RESET the board ###\n");
671   - for (;;);
672   -}
arch/microblaze/lib/board.c
... ... @@ -195,11 +195,4 @@
195 195 main_loop();
196 196 }
197 197 }
198   -
199   -void hang(void)
200   -{
201   - puts("### ERROR ### Please RESET the board ###\n");
202   - for (;;)
203   - ;
204   -}
arch/mips/lib/board.c
... ... @@ -344,11 +344,4 @@
344 344  
345 345 /* NOTREACHED - no way out of command loop except booting */
346 346 }
347   -
348   -void hang(void)
349   -{
350   - puts("### ERROR ### Please RESET the board ###\n");
351   - for (;;)
352   - ;
353   -}
arch/nds32/lib/board.c
... ... @@ -404,11 +404,4 @@
404 404  
405 405 /* NOTREACHED - no way out of command loop except booting */
406 406 }
407   -
408   -void hang(void)
409   -{
410   - puts("### ERROR ### Please RESET the board ###\n");
411   - for (;;)
412   - ;
413   -}
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
... ... @@ -200,13 +200,4 @@
200 200 main_loop();
201 201 }
202 202 }
203   -
204   -/***********************************************************************/
205   -
206   -void hang(void)
207   -{
208   - puts("Board ERROR\n");
209   - for (;;)
210   - ;
211   -}
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
... ... @@ -264,11 +264,4 @@
264 264  
265 265 /* NOTREACHED - no way out of command loop except booting */
266 266 }
267   -
268   -void hang(void)
269   -{
270   - puts("### ERROR ### Please RESET the board ###\n");
271   - for (;;)
272   - ;
273   -}
... ... @@ -1087,14 +1087,4 @@
1087 1087 hang();
1088 1088 }
1089 1089 #endif /* CONFIG_X86 */
1090   -
1091   -void hang(void)
1092   -{
1093   - puts("### ERROR ### Please RESET the board ###\n");
1094   -#ifdef CONFIG_SANDBOX
1095   - os_exit(0);
1096   -#else
1097   - for (;;);
1098   -#endif
1099   -}
... ... @@ -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
... ... @@ -355,13 +355,4 @@
355 355 hang();
356 356 }
357 357 }
358   -
359   -/*
360   - * Called in case of an exception.
361   - */
362   -void hang(void)
363   -{
364   - /* Loop forever */
365   - while (1) ;
366   -}
... ... @@ -71,6 +71,7 @@
71 71 COBJS-y += crc32.o
72 72 COBJS-y += ctype.o
73 73 COBJS-y += div64.o
  74 +COBJS-y += hang.o
74 75 COBJS-y += linux_string.o
75 76 COBJS-$(CONFIG_REGEX) += slre.o
76 77 COBJS-y += string.o
  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 +}