Patchwork [U-Boot,2/3] init_func: Add x86 support

login
register
mail settings
Submitter Graeme Russ
Date April 22, 2012, 3:23 p.m.
Message ID <1335108188-21875-3-git-send-email-graeme.russ@gmail.com>
Download mbox | patch
Permalink /patch/154287/
State Deferred
Headers show

Comments

Graeme Russ - April 22, 2012, 3:23 p.m.
Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
---
 arch/x86/cpu/u-boot.lds |   23 +++++++++++++++++++++++
 arch/x86/lib/board.c    |   10 +++-------
 2 files changed, 26 insertions(+), 7 deletions(-)

Patch

diff --git a/arch/x86/cpu/u-boot.lds b/arch/x86/cpu/u-boot.lds
index fe28030..b88fd57 100644
--- a/arch/x86/cpu/u-boot.lds
+++ b/arch/x86/cpu/u-boot.lds
@@ -28,6 +28,27 @@  ENTRY(_start)
 
 SECTIONS
 {
+#ifdef MAKE_INIT_LDS
+	.initfuncs : { KEEP(*(.initfuncs*)) }
+
+	/DISCARD/ : { *(.text*) }
+	/DISCARD/ : { *(.debug*) }
+	/DISCARD/ : { *(.u_boot_cmd*) }
+	/DISCARD/ : { *(.rodata*) }
+	/DISCARD/ : { *(.data*) }
+	/DISCARD/ : { *(.dynsym*) }
+	/DISCARD/ : { *(.hash*) }
+	/DISCARD/ : { *(.bss*) }
+	/DISCARD/ : { *(.bss) }
+	/DISCARD/ : { *(.rel.dyn*) }
+	/DISCARD/ : { *(.rel.dyn) }
+	/DISCARD/ : { *(.dynstr*) }
+	/DISCARD/ : { *(.dynamic*) }
+	/DISCARD/ : { *(.plt*) }
+	/DISCARD/ : { *(.interp*) }
+	/DISCARD/ : { *(.gnu*) }
+	/DISCARD/ : { *(.comment*) }
+#else
 	. = CONFIG_SYS_TEXT_BASE;	/* Location of bootcode in flash */
 	__text_start = .;
 	.text  : { *(.text*); }
@@ -72,6 +93,7 @@  SECTIONS
 	/DISCARD/ : { *(.plt*) }
 	/DISCARD/ : { *(.interp*) }
 	/DISCARD/ : { *(.gnu*) }
+	/DISCARD/ : { *(.initfuncs*) }
 
 	/* 16bit realmode trampoline code */
 	.realmode REALMODE_BASE : AT ( LOADADDR(.rel.dyn) + SIZEOF(.rel.dyn) ) { KEEP(*(.realmode)) }
@@ -94,4 +116,5 @@  SECTIONS
 
 	. = RESET_VEC_LOC;
 	.resetvec : AT (CONFIG_SYS_TEXT_BASE + (CONFIG_SYS_MONITOR_LEN - RESET_SEG_SIZE + RESET_VEC_LOC)) { KEEP(*(.resetvec)); }
+#endif
 }
diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c
index 5f0b62c..5789581 100644
--- a/arch/x86/lib/board.c
+++ b/arch/x86/lib/board.c
@@ -32,6 +32,7 @@ 
  */
 
 #include <common.h>
+#include <init_func.h>
 #include <watchdog.h>
 #include <stdio_dev.h>
 #include <asm/u-boot-x86.h>
@@ -77,13 +78,7 @@ 
  *      - All remaining initialisation
  */
 
-/*
- * The requirements for any new initalization function is simple: it is
- * a function with no parameters which returns an integer return code,
- * where 0 means "continue" and != 0 means "fatal error, hang the system"
- */
-typedef int (init_fnc_t) (void);
-
+#ifndef CONFIG_INIT_FUNC
 /*
  * init_sequence_f is the list of init functions which are run when U-Boot
  * is executing from Flash with a limited 'C' environment. The following
@@ -206,6 +201,7 @@  init_fnc_t *init_sequence_r[] = {
 #endif
 	NULL,
 };
+#endif
 
 static void do_init_loop(init_fnc_t **init_fnc_ptr)
 {