[U-Boot] [PATCH v13 3/6] generic board patch of manual reloc and zero gd_t
fenghua at phytium.com.cn
fenghua at phytium.com.cn
Thu Sep 26 15:35:26 CEST 2013
From: David Feng <fenghua at phytium.com.cn>
Signed-off-by: David Feng <fenghua at phytium.com.cn>
---
common/board_f.c | 18 +++++++++++-------
common/board_r.c | 20 +++++++++++++++++++-
2 files changed, 30 insertions(+), 8 deletions(-)
diff --git a/common/board_f.c b/common/board_f.c
index 0ada1af..5891ad2 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -458,7 +458,7 @@ static int reserve_round_4k(void)
static int reserve_mmu(void)
{
/* reserve TLB table */
- gd->arch.tlb_size = 4096 * 4;
+ gd->arch.tlb_size = PGTABLE_SIZE;
gd->relocaddr -= gd->arch.tlb_size;
/* round down to next 64 kB limit */
@@ -610,7 +610,7 @@ static int reserve_stacks(void)
* TODO(sjg at chromium.org): Perhaps create arch_reserve_stack()
* to handle this and put in arch/xxx/lib/stack.c
*/
-# ifdef CONFIG_ARM
+# if defined(CONFIG_ARM) && !defined(CONFIG_ARM64)
# ifdef CONFIG_USE_IRQ
gd->start_addr_sp -= (CONFIG_STACKSIZE_IRQ + CONFIG_STACKSIZE_FIQ);
debug("Reserving %zu Bytes for IRQ stack at: %08lx\n",
@@ -807,11 +807,6 @@ static int mark_bootstage(void)
}
static init_fnc_t init_sequence_f[] = {
-#if !defined(CONFIG_CPM2) && !defined(CONFIG_MPC512X) && \
- !defined(CONFIG_MPC83xx) && !defined(CONFIG_MPC85xx) && \
- !defined(CONFIG_MPC86xx) && !defined(CONFIG_X86)
- zero_global_data,
-#endif
#ifdef CONFIG_SANDBOX
setup_ram_buf,
#endif
@@ -1005,6 +1000,15 @@ void board_init_f(ulong boot_flags)
gd = &data;
#endif
+ /*
+ * Zero gd_t first, otherwise the debug print(if DEBUG defined)
+ * in initcall_run_list function before zero_global_data is called
+ * will go wrong.
+ */
+#ifndef CONFIG_X86
+ zero_global_data();
+#endif
+
gd->flags = boot_flags;
if (initcall_run_list(init_sequence_f))
diff --git a/common/board_r.c b/common/board_r.c
index 86ca1cb..8984cf3 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -157,6 +157,13 @@ static int initr_reloc_global_data(void)
*/
gd->env_addr += gd->relocaddr - CONFIG_SYS_MONITOR_BASE;
#endif
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
+ /*
+ * We have to relocate the command table manually
+ */
+ fixup_cmdtable(ll_entry_start(cmd_tbl_t, cmd),
+ ll_entry_count(cmd_tbl_t, cmd));
+#endif /* CONFIG_NEEDS_MANUAL_RELOC */
return 0;
}
@@ -705,6 +712,7 @@ static int run_main_loop(void)
* TODO: perhaps reset the watchdog in the initcall function after each call?
*/
init_fnc_t init_sequence_r[] = {
+ initr_serial,
initr_trace,
initr_reloc,
/* TODO: could x86/PPC have this also perhaps? */
@@ -722,7 +730,6 @@ init_fnc_t init_sequence_r[] = {
set_cpu_clk_info, /* Setup clock information */
#endif
initr_reloc_global_data,
- initr_serial,
initr_announce,
INIT_FUNC_WATCHDOG_RESET
#ifdef CONFIG_PPC
@@ -899,6 +906,7 @@ init_fnc_t init_sequence_r[] = {
initr_modem,
#endif
run_main_loop,
+ NULL,
};
void board_init_r(gd_t *new_gd, ulong dest_addr)
@@ -906,6 +914,16 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
#ifndef CONFIG_X86
gd = new_gd;
#endif
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
+ /*
+ * We have to relocate the init_sequence_r table manually
+ */
+ init_fnc_t *init_fnc_ptr;
+ for (init_fnc_ptr = init_sequence_r; *init_fnc_ptr; ++init_fnc_ptr)
+ *(unsigned long *)init_fnc_ptr =
+ (unsigned long)(*init_fnc_ptr) + gd->reloc_off;
+#endif /* CONFIG_NEEDS_MANUAL_RELOC */
+
if (initcall_run_list(init_sequence_r))
hang();
--
1.7.9.5
More information about the U-Boot
mailing list