summaryrefslogtreecommitdiff
path: root/arch/x86
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2011-09-07 16:04:55 -0700
committerVadim Bendebury <vbendeb@chromium.org>2011-09-07 16:44:49 -0700
commit7c64de351aac24d393219056cdd0824f62efd297 (patch)
tree0049c436b256b47faf5b43b67192a05c62a7b5b8 /arch/x86
parentc968b682ea59af33ef0eaa200a0863a24bd1ca6f (diff)
Restore ability to print before relocation.
The problem with printing appears to be due to the corrupted contents of the global data structure (allocated at a fixed address for the before relocation use). There is no need to place the global data structure at a fixed address, it is enough to have it on the stack before relocation, as it is used only by the functions in init_sequence_f table, and then passed to board_init_r() which copies its contents immediately. The CONFIG_SYS_INIT_GD_ADDR definition is not needed anymore and is being removed. BUG=chromium-os:20142 TEST=manual . program the new image on Alex . restart the machine Observe the relocation address and u-boot banner printed on the console. Change-Id: Ifcdcd0c9da1e0ba901f319ff9b7145909300b8a1 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: http://gerrit.chromium.org/gerrit/7373 Reviewed-by: Stefan Reinauer <reinauer@google.com>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/lib/board.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c
index 922e1377135..6fd086a17fc 100644
--- a/arch/x86/lib/board.c
+++ b/arch/x86/lib/board.c
@@ -57,7 +57,7 @@
*/
#undef XTRN_DECLARE_GLOBAL_DATA_PTR
#define XTRN_DECLARE_GLOBAL_DATA_PTR /* empty = allocate here */
-DECLARE_GLOBAL_DATA_PTR = (gd_t *) (CONFIG_SYS_INIT_GD_ADDR);
+DECLARE_GLOBAL_DATA_PTR;
/* Exports from the Linker Script */
extern ulong __text_start;
@@ -262,15 +262,25 @@ void board_init_f(ulong boot_flags)
{
init_fnc_t **init_fnc_ptr;
+/*
+ * It's ok to have it on the stack as the stack is not going to be changed
+ * until board_init_r() is invoked, and the first thing it does - is copying
+ * *gd to the new location.
+ */
+
+ gd_t gd_data_f;
+ gd = &gd_data_f;
+ memset(gd, 0, sizeof(*gd));
+
for (init_fnc_ptr = init_sequence_f; *init_fnc_ptr; ++init_fnc_ptr) {
if ((*init_fnc_ptr)() != 0)
hang();
}
- gd->flags |= GD_FLG_RELOC;
-
printf("Relocating to %p\n", (void *)gd->relocaddr);
+ gd->flags |= GD_FLG_RELOC;
+
/* Enter the relocated U-Boot! */
relocate_code(gd->start_addr_sp, gd, gd->relocaddr);