From 535ad2db069aae6d1d36fc05c31cbd8a2b3d8831 Mon Sep 17 00:00:00 2001 From: Graeme Russ Date: Sat, 24 Apr 2010 00:05:36 +1000 Subject: x86: #ifdef out getenv_IPaddr() Signed-off-by: Graeme Russ --- arch/i386/lib/board.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'arch/i386/lib/board.c') diff --git a/arch/i386/lib/board.c b/arch/i386/lib/board.c index f3b6348551e..af81cd5b237 100644 --- a/arch/i386/lib/board.c +++ b/arch/i386/lib/board.c @@ -280,8 +280,10 @@ void board_init_r(gd_t *id, ulong ram_start) show_boot_progress(0x26); +#ifdef CONFIG_CMD_NET /* IP Address */ bd_data.bi_ip_addr = getenv_IPaddr ("ipaddr"); +#endif #if defined(CONFIG_PCI) /* -- cgit v1.2.3 From 9e08efcfee22570bb3a9ea384bf4d60b378f6092 Mon Sep 17 00:00:00 2001 From: Graeme Russ Date: Sat, 24 Apr 2010 00:05:39 +1000 Subject: x86: Fix do_go_exec() This was broken a long time ago by a49864593e083a5d0779fb9ca98e5a0f2053183d which munged the NIOS and x86 do_go_exec() Signed-off-by: Graeme Russ --- arch/i386/lib/board.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'arch/i386/lib/board.c') diff --git a/arch/i386/lib/board.c b/arch/i386/lib/board.c index af81cd5b237..5e28c6f7dfc 100644 --- a/arch/i386/lib/board.c +++ b/arch/i386/lib/board.c @@ -422,10 +422,10 @@ void hang (void) unsigned long do_go_exec (ulong (*entry)(int, char *[]), int argc, char *argv[]) { /* - * TODO: Test this function - changed to fix compiler error. - * Original code was: - * return (entry >> 1) (argc, argv); - * with a comment about Nios function pointers are address >> 1 + * x86 does not use a dedicated register to pass the pointer + * to the global_data */ + argv[-1] = (char *)gd; + return (entry) (argc, argv); } -- cgit v1.2.3 From 2fb1bc4f53618743b92a48763d7aaa0ece9ad98f Mon Sep 17 00:00:00 2001 From: Graeme Russ Date: Sat, 24 Apr 2010 00:05:44 +1000 Subject: x86: Pass relocation offset into Global Data In order to locate the 16-bit BIOS code, we need to know the reloaction offset. Signed-off-by: Graeme Russ --- arch/i386/lib/board.c | 63 +++++++++++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 27 deletions(-) (limited to 'arch/i386/lib/board.c') diff --git a/arch/i386/lib/board.c b/arch/i386/lib/board.c index 5e28c6f7dfc..947a8ec474c 100644 --- a/arch/i386/lib/board.c +++ b/arch/i386/lib/board.c @@ -52,7 +52,9 @@ extern ulong _i386boot_rel_dyn_start; extern ulong _i386boot_rel_dyn_end; extern ulong _i386boot_bss_start; extern ulong _i386boot_bss_size; -void ram_bootstrap (void *); + +void ram_bootstrap (void *, ulong); + const char version_string[] = U_BOOT_VERSION" (" U_BOOT_DATE " - " U_BOOT_TIME ")"; @@ -162,6 +164,7 @@ init_fnc_t *init_sequence[] = { NULL, }; +static gd_t gd_data; gd_t *gd; /* @@ -174,21 +177,18 @@ void board_init_f (ulong stack_limit) Elf32_Rel *rel_dyn_start = (Elf32_Rel *)&_i386boot_rel_dyn_start; Elf32_Rel *rel_dyn_end = (Elf32_Rel *)&_i386boot_rel_dyn_end; void *bss_start = &_i386boot_bss_start; - void *bss_size = &_i386boot_bss_size; + ulong bss_size = (ulong)&_i386boot_bss_size; - size_t uboot_size; - void *ram_start; + ulong uboot_size; + void *dest_addr; ulong rel_offset; Elf32_Rel *re; - void (*start_func)(void *); - - /* compiler optimization barrier needed for GCC >= 3.4 */ - __asm__ __volatile__("": : :"memory"); + void (*start_func)(void *, ulong); - uboot_size = (size_t)u_boot_cmd_end - (size_t)text_start; - ram_start = (void *)stack_limit - (uboot_size + (ulong)bss_size); - rel_offset = text_start - ram_start; + uboot_size = (ulong)u_boot_cmd_end - (ulong)text_start; + dest_addr = (void *)stack_limit - (uboot_size + (ulong)bss_size); + rel_offset = text_start - dest_addr; start_func = ram_bootstrap - rel_offset; /* First stage CPU initialization */ @@ -200,10 +200,10 @@ void board_init_f (ulong stack_limit) hang(); /* Copy U-Boot into RAM */ - memcpy(ram_start, text_start, (size_t)uboot_size); + memcpy(dest_addr, text_start, uboot_size); /* Clear BSS */ - memset(bss_start - rel_offset, 0, (size_t)bss_size); + memset(bss_start - rel_offset, 0, bss_size); /* Perform relocation adjustments */ for (re = rel_dyn_start; re < rel_dyn_end; re++) @@ -213,27 +213,39 @@ void board_init_f (ulong stack_limit) *(ulong *)(re->r_offset - rel_offset) -= (Elf32_Addr)rel_offset; } - start_func(ram_start); - - /* NOTREACHED - relocate_code() does not return */ + /* Enter the relocated U-Boot! */ + start_func(dest_addr, rel_offset); + /* NOTREACHED - board_init_f() does not return */ while(1); } /* - * All attempts to jump straight from board_init_f() to board_init_r() - * have failed, hence this special 'bootstrap' function. + * We cannot initialize gd_data in board_init_f() because we would be + * attempting to write to flash (I have even tried using manual relocation + * adjustments on pointers but it just won't work) and board_init_r() does + * not have enough arguments to allow us to pass the relocation offset + * straight up. This bootstrap function (which runs in RAM) is used to + * setup gd_data in order to pass the relocation offset to the rest of + * U-Boot. + * + * TODO: The compiler optimization barrier is intended to stop GCC from + * optimizing this function into board_init_f(). It seems to work without + * it, but I've left it in to be sure. I think also that the barrier in + * board_init_r() is no longer needed, but left it in 'just in case' */ -void ram_bootstrap (void *ram_start) +void ram_bootstrap (void *dest_addr, ulong rel_offset) { - static gd_t gd_data; - /* compiler optimization barrier needed for GCC >= 3.4 */ __asm__ __volatile__("": : :"memory"); - board_init_r(&gd_data, (ulong)ram_start); + /* tell others: relocation done */ + gd_data.reloc_off = rel_offset; + gd_data.flags |= GD_FLG_RELOC; + + board_init_r(&gd_data, (ulong)dest_addr); } -void board_init_r(gd_t *id, ulong ram_start) +void board_init_r(gd_t *id, ulong dest_addr) { char *s; int i; @@ -247,16 +259,13 @@ void board_init_r(gd_t *id, ulong ram_start) /* compiler optimization barrier needed for GCC >= 3.4 */ __asm__ __volatile__("": : :"memory"); - memset (gd, 0, sizeof (gd_t)); gd->bd = &bd_data; memset (gd->bd, 0, sizeof (bd_t)); show_boot_progress(0x22); gd->baudrate = CONFIG_BAUDRATE; - gd->flags |= GD_FLG_RELOC; /* tell others: relocation done */ - - mem_malloc_init((((ulong)ram_start - CONFIG_SYS_MALLOC_LEN)+3)&~3, + 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++) { -- cgit v1.2.3 From bf16500f79fdf2653a286b40bb601cb185ac4675 Mon Sep 17 00:00:00 2001 From: Graeme Russ Date: Sat, 24 Apr 2010 00:05:47 +1000 Subject: x86: Use CONFIG_SERIAL_MULTI Signed-off-by: Graeme Russ --- arch/i386/lib/board.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'arch/i386/lib/board.c') diff --git a/arch/i386/lib/board.c b/arch/i386/lib/board.c index 947a8ec474c..7115a2f39c3 100644 --- a/arch/i386/lib/board.c +++ b/arch/i386/lib/board.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -149,7 +150,6 @@ static void display_flash_config (ulong size) typedef int (init_fnc_t) (void); init_fnc_t *init_sequence[] = { - serial_init, cpu_init_r, /* basic cpu dependent setup */ board_early_init_r, /* basic board dependent setup */ dram_init, /* configure available RAM banks */ @@ -277,6 +277,9 @@ void board_init_r(gd_t *id, ulong dest_addr) } show_boot_progress(0x23); +#ifdef CONFIG_SERIAL_MULTI + serial_initialize(); +#endif /* configure available FLASH banks */ size = flash_init(); display_flash_config(size); -- cgit v1.2.3 From 79ea6b87011c0524ced31359e2be7aac97c29d0a Mon Sep 17 00:00:00 2001 From: Graeme Russ Date: Sat, 24 Apr 2010 00:05:48 +1000 Subject: x86: Provide weak PC/AT compatibility setup function It is possibly to setup x86 boards to use non-PC/AT configurations. For example, the sc520 is an x86 CPU with PC/AT and non-PC/AT peripherals. This function allows the board to set itself up for maximum PC/AT compatibility just before booting the Linux kernel (the Linux kernel 'just works' if everything is PC/AT compliant) Signed-off-by: Graeme Russ --- arch/i386/lib/board.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'arch/i386/lib/board.c') diff --git a/arch/i386/lib/board.c b/arch/i386/lib/board.c index 7115a2f39c3..3f849f6542d 100644 --- a/arch/i386/lib/board.c +++ b/arch/i386/lib/board.c @@ -441,3 +441,10 @@ unsigned long do_go_exec (ulong (*entry)(int, char *[]), int argc, char *argv[]) return (entry) (argc, argv); } + +void setup_pcat_compatibility(void) + __attribute__((weak, alias("__setup_pcat_compatibility"))); + +void __setup_pcat_compatibility(void) +{ +} -- cgit v1.2.3