]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - common/board_f.c
common/board_f.c: fix condition for reloc_off assignment
[karo-tx-uboot.git] / common / board_f.c
index 1d81ed7c6a12c440f026fc096d0a42a119f10e9b..c172ea1acb8a08be9f7adc92322d327793151205 100644 (file)
@@ -142,17 +142,19 @@ static int init_baud_rate(void)
 static int display_text_info(void)
 {
 #ifndef CONFIG_SANDBOX
-       ulong bss_start, bss_end;
+       ulong bss_start, bss_end, text_base;
 
        bss_start = (ulong)&__bss_start;
        bss_end = (ulong)&__bss_end;
 
-       debug("U-Boot code: %08X -> %08lX  BSS: -> %08lX\n",
 #ifdef CONFIG_SYS_TEXT_BASE
-             CONFIG_SYS_TEXT_BASE, bss_start, bss_end);
+       text_base = CONFIG_SYS_TEXT_BASE;
 #else
-             CONFIG_SYS_MONITOR_BASE, bss_start, bss_end);
+       text_base = CONFIG_SYS_MONITOR_BASE;
 #endif
+
+       debug("U-Boot code: %08lX -> %08lX  BSS: -> %08lX\n",
+               text_base, bss_start, bss_end);
 #endif
 
 #ifdef CONFIG_MODEM_SUPPORT
@@ -278,6 +280,11 @@ __weak int arch_cpu_init(void)
        return 0;
 }
 
+__weak unsigned long get_timer_masked(void)
+{
+       return get_timer(0);
+}
+
 #ifdef CONFIG_OF_HOSTFILE
 
 static int read_fdt_from_file(void)
@@ -285,7 +292,7 @@ static int read_fdt_from_file(void)
        struct sandbox_state *state = state_get_current();
        const char *fname = state->fdt_fname;
        void *blob;
-       ssize_t size;
+       loff_t size;
        int err;
        int fd;
 
@@ -298,10 +305,10 @@ static int read_fdt_from_file(void)
                return -EINVAL;
        }
 
-       size = os_get_filesize(fname);
-       if (size < 0) {
+       err = os_get_filesize(fname, &size);
+       if (err < 0) {
                printf("Failed to file FDT file '%s'\n", fname);
-               return -ENOENT;
+               return err;
        }
        fd = os_open(fname, OS_O_RDONLY);
        if (fd < 0) {
@@ -732,7 +739,11 @@ static int reloc_fdt(void)
 static int setup_reloc(void)
 {
 #ifdef CONFIG_SYS_TEXT_BASE
+#ifndef CONFIG_ARM
        gd->reloc_off = gd->relocaddr - CONFIG_SYS_TEXT_BASE;
+#else
+       gd->reloc_off = gd->relocaddr - (unsigned long)__image_copy_start;
+#endif
 #endif
        memcpy(gd->new_gd, (char *)gd, sizeof(gd_t));
 
@@ -805,29 +816,31 @@ static int initf_dm(void)
        return 0;
 }
 
+/* Architecture-specific memory reservation */
+__weak int reserve_arch(void)
+{
+       return 0;
+}
+
 static init_fnc_t init_sequence_f[] = {
 #ifdef CONFIG_SANDBOX
        setup_ram_buf,
 #endif
        setup_mon_len,
        setup_fdt,
+#ifdef CONFIG_TRACE
        trace_early_init,
+#endif
+       initf_malloc,
 #if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
        /* TODO: can this go into arch_cpu_init()? */
        probecpu,
 #endif
        arch_cpu_init,          /* basic arch cpu dependent setup */
-#ifdef CONFIG_X86
-       cpu_init_f,             /* TODO(sjg@chromium.org): remove */
-# ifdef CONFIG_OF_CONTROL
-       find_fdt,               /* TODO(sjg@chromium.org): remove */
-# endif
-#endif
        mark_bootstage,
 #ifdef CONFIG_OF_CONTROL
        fdtdec_check_fdt,
 #endif
-       initf_malloc,
        initf_dm,
 #if defined(CONFIG_BOARD_EARLY_INIT_F)
        board_early_init_f,
@@ -890,7 +903,7 @@ static init_fnc_t init_sequence_f[] = {
        prt_mpc5xxx_clks,
 #endif /* CONFIG_MPC5xxx */
 #if defined(CONFIG_DISPLAY_BOARDINFO)
-       checkboard,             /* display board info */
+       show_board_info,
 #endif
        INIT_FUNC_WATCHDOG_INIT
 #if defined(CONFIG_MISC_INIT_F)
@@ -972,6 +985,7 @@ static init_fnc_t init_sequence_f[] = {
        setup_machine,
        reserve_global_data,
        reserve_fdt,
+       reserve_arch,
        reserve_stacks,
        setup_dram_config,
        show_dram_config,
@@ -987,6 +1001,11 @@ static init_fnc_t init_sequence_f[] = {
        INIT_FUNC_WATCHDOG_RESET
        reloc_fdt,
        setup_reloc,
+#ifdef CONFIG_X86
+       copy_uboot_to_ram,
+       clear_bss,
+       do_elf_reloc_fixups,
+#endif
 #if !defined(CONFIG_ARM) && !defined(CONFIG_SANDBOX)
        jump_to_copy,
 #endif
@@ -1046,9 +1065,6 @@ void board_init_f(ulong boot_flags)
  */
 static init_fnc_t init_sequence_f_r[] = {
        init_cache_f_r,
-       copy_uboot_to_ram,
-       clear_bss,
-       do_elf_reloc_fixups,
 
        NULL,
 };