diff mbox

[U-Boot,30/32] x86: Convert board_init_f to use an init_sequence

Message ID 1296822959-3927-31-git-send-email-graeme.russ@gmail.com
State Accepted
Commit e4f78d78d7b710243c9953cc86fd75055d59ebf9
Delegated to: Graeme Russ
Headers show

Commit Message

Graeme Russ Feb. 4, 2011, 12:35 p.m. UTC
Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
---
 arch/i386/lib/board.c |   70 ++++++++++++++++++++----------------------------
 1 files changed, 29 insertions(+), 41 deletions(-)

Comments

Graeme Russ Feb. 12, 2011, 4:31 a.m. UTC | #1
On 04/02/11 23:35, Graeme Russ wrote:
> Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
> ---
>  arch/i386/lib/board.c |   70 ++++++++++++++++++++----------------------------
>  1 files changed, 29 insertions(+), 41 deletions(-)
> 

Applied to u-boot-x86

Regards,

Graeme
diff mbox

Patch

diff --git a/arch/i386/lib/board.c b/arch/i386/lib/board.c
index 4751e49..0c37c23 100644
--- a/arch/i386/lib/board.c
+++ b/arch/i386/lib/board.c
@@ -156,7 +156,28 @@  static void display_flash_config (ulong size)
  */
 typedef int (init_fnc_t) (void);
 
-init_fnc_t *init_sequence[] = {
+static int calculate_relocation_address(void);
+static int copy_uboot_to_ram(void);
+static int clear_bss(void);
+static int do_elf_reloc_fixups(void);
+
+init_fnc_t *init_sequence_f[] = {
+	cpu_init_f,
+	board_early_init_f,
+	env_init,
+	init_baudrate,
+	serial_init,
+	console_init_f,
+	dram_init_f,
+	calculate_relocation_address,
+	copy_uboot_to_ram,
+	clear_bss,
+	do_elf_reloc_fixups,
+
+	NULL,
+};
+
+init_fnc_t *init_sequence_r[] = {
 	cpu_init_r,		/* basic cpu dependent setup */
 	board_early_init_r,	/* basic board dependent setup */
 	dram_init,		/* configure available RAM banks */
@@ -235,41 +256,12 @@  static int do_elf_reloc_fixups(void)
  */
 void board_init_f(ulong boot_flags)
 {
-	/* First stage CPU initialization */
-	if (cpu_init_f() != 0)
-		hang();
-
-	/* First stage Board initialization */
-	if (board_early_init_f() != 0)
-		hang();
-
-	if (env_init() != 0)
-		hang();
-
-	if (init_baudrate() != 0)
-		hang();
-
-	if (serial_init() != 0)
-		hang();
-
-	if (console_init_f() != 0)
-		hang();
-
-	if (dram_init_f() != 0)
-		hang();
-
-	if (calculate_relocation_address() != 0)
-		hang();
-
-	/* Copy U-Boot into RAM */
-	if (copy_uboot_to_ram() != 0)
-		hang();
-
-	if (clear_bss() != 0)
-		hang();
+	init_fnc_t **init_fnc_ptr;
 
-	if (do_elf_reloc_fixups() != 0)
-		hang();
+	for (init_fnc_ptr = init_sequence_f; *init_fnc_ptr; ++init_fnc_ptr) {
+		if ((*init_fnc_ptr)() != 0)
+			hang();
+	}
 
 	gd->flags |= GD_FLG_RELOC;
 
@@ -283,7 +275,6 @@  void board_init_f(ulong boot_flags)
 void board_init_r(gd_t *id, ulong dest_addr)
 {
 	char *s;
-	int i;
 	ulong size;
 	static bd_t bd_data;
 	static gd_t gd_data;
@@ -307,12 +298,9 @@  void board_init_r(gd_t *id, ulong dest_addr)
 	mem_malloc_init((((ulong)dest_addr - CONFIG_SYS_MALLOC_LEN)+3)&~3,
 			CONFIG_SYS_MALLOC_LEN);
 
-	for (init_fnc_ptr = init_sequence, i=0; *init_fnc_ptr; ++init_fnc_ptr, i++) {
-		show_boot_progress(0xa130|i);
-
-		if ((*init_fnc_ptr)() != 0) {
+	for (init_fnc_ptr = init_sequence_r; *init_fnc_ptr; ++init_fnc_ptr) {
+		if ((*init_fnc_ptr)() != 0)
 			hang ();
-		}
 	}
 	show_boot_progress(0x23);