2 * Copyright (c) 2011 The Chromium OS Authors.
3 * (C) Copyright 2002-2006
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
7 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
8 * Marius Groeger <mgroeger@sysgo.de>
10 * SPDX-License-Identifier: GPL-2.0+
15 #include <environment.h>
25 /* TODO: Can we move these into arch/ headers? */
35 #if defined(CONFIG_MP) && (defined(CONFIG_MPC86xx) || defined(CONFIG_E500))
42 #include <status_led.h>
48 #include <asm/sections.h>
49 #if defined(CONFIG_X86) || defined(CONFIG_ARC)
50 #include <asm/init_helpers.h>
52 #if defined(CONFIG_X86) || defined(CONFIG_ARC) || defined(CONFIG_XTENSA)
53 #include <asm/relocate.h>
56 #include <linux/errno.h>
59 * Pointer to initial global data area
61 * Here we initialize it if needed.
63 #ifdef XTRN_DECLARE_GLOBAL_DATA_PTR
64 #undef XTRN_DECLARE_GLOBAL_DATA_PTR
65 #define XTRN_DECLARE_GLOBAL_DATA_PTR /* empty = allocate here */
66 DECLARE_GLOBAL_DATA_PTR = (gd_t *) (CONFIG_SYS_INIT_GD_ADDR);
68 DECLARE_GLOBAL_DATA_PTR;
72 * TODO(sjg@chromium.org): IMO this code should be
73 * refactored to a single function, something like:
75 * void led_set_state(enum led_colour_t colour, int on);
77 /************************************************************************
78 * Coloured LED functionality
79 ************************************************************************
80 * May be supplied by boards if desired
82 __weak void coloured_LED_init(void) {}
83 __weak void red_led_on(void) {}
84 __weak void red_led_off(void) {}
85 __weak void green_led_on(void) {}
86 __weak void green_led_off(void) {}
87 __weak void yellow_led_on(void) {}
88 __weak void yellow_led_off(void) {}
89 __weak void blue_led_on(void) {}
90 __weak void blue_led_off(void) {}
93 * Why is gd allocated a register? Prior to reloc it might be better to
94 * just pass it around to each function in this file?
96 * After reloc one could argue that it is hardly used and doesn't need
97 * to be in a register. Or if it is it should perhaps hold pointers to all
98 * global data for all modules, so that post-reloc we can avoid the massive
99 * literal pool we get on ARM. Or perhaps just encourage each module to use
103 #if defined(CONFIG_WATCHDOG) || defined(CONFIG_HW_WATCHDOG)
104 static int init_func_watchdog_init(void)
106 # if defined(CONFIG_HW_WATCHDOG) && \
107 (defined(CONFIG_M68K) || defined(CONFIG_MICROBLAZE) || \
108 defined(CONFIG_SH) || defined(CONFIG_AT91SAM9_WATCHDOG) || \
109 defined(CONFIG_DESIGNWARE_WATCHDOG) || \
110 defined(CONFIG_IMX_WATCHDOG))
112 puts(" Watchdog enabled\n");
119 int init_func_watchdog_reset(void)
125 #endif /* CONFIG_WATCHDOG */
127 __weak void board_add_ram_info(int use_default)
129 /* please define platform specific board_add_ram_info() */
132 static int init_baud_rate(void)
134 gd->baudrate = getenv_ulong("baudrate", 10, CONFIG_BAUDRATE);
138 static int display_text_info(void)
140 #if !defined(CONFIG_SANDBOX) && !defined(CONFIG_EFI_APP)
141 ulong bss_start, bss_end, text_base;
143 bss_start = (ulong)&__bss_start;
144 bss_end = (ulong)&__bss_end;
146 #ifdef CONFIG_SYS_TEXT_BASE
147 text_base = CONFIG_SYS_TEXT_BASE;
149 text_base = CONFIG_SYS_MONITOR_BASE;
152 debug("U-Boot code: %08lX -> %08lX BSS: -> %08lX\n",
153 text_base, bss_start, bss_end);
156 #ifdef CONFIG_USE_IRQ
157 debug("IRQ Stack: %08lx\n", IRQ_STACK_START);
158 debug("FIQ Stack: %08lx\n", FIQ_STACK_START);
164 static int announce_dram_init(void)
170 #if defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_M68K)
171 static int init_func_ram(void)
177 static int show_dram_config(void)
179 unsigned long long size;
181 #ifdef CONFIG_NR_DRAM_BANKS
184 debug("\nRAM Configuration:\n");
185 for (i = size = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
186 size += gd->bd->bi_dram[i].size;
187 debug("Bank #%d: %llx ", i,
188 (unsigned long long)(gd->bd->bi_dram[i].start));
190 print_size(gd->bd->bi_dram[i].size, "\n");
198 print_size(size, "");
199 board_add_ram_info(0);
205 __weak int dram_init_banksize(void)
207 #if defined(CONFIG_NR_DRAM_BANKS) && defined(CONFIG_SYS_SDRAM_BASE)
208 gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
209 gd->bd->bi_dram[0].size = get_effective_memsize();
215 #if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C)
216 static int init_func_i2c(void)
219 #ifdef CONFIG_SYS_I2C
222 i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
229 #if defined(CONFIG_HARD_SPI)
230 static int init_func_spi(void)
240 static int zero_global_data(void)
242 memset((void *)gd, '\0', sizeof(gd_t));
247 static int setup_mon_len(void)
249 #if defined(__ARM__) || defined(__MICROBLAZE__)
250 gd->mon_len = (ulong)&__bss_end - (ulong)_start;
251 #elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
252 gd->mon_len = (ulong)&_end - (ulong)_init;
253 #elif defined(CONFIG_NIOS2) || defined(CONFIG_XTENSA)
254 gd->mon_len = CONFIG_SYS_MONITOR_LEN;
255 #elif defined(CONFIG_NDS32) || defined(CONFIG_SH)
256 gd->mon_len = (ulong)(&__bss_end) - (ulong)(&_start);
257 #elif defined(CONFIG_SYS_MONITOR_BASE)
258 /* TODO: use (ulong)&__bss_end - (ulong)&__text_start; ? */
259 gd->mon_len = (ulong)&__bss_end - CONFIG_SYS_MONITOR_BASE;
264 __weak int arch_cpu_init(void)
269 __weak int mach_cpu_init(void)
274 /* Get the top of usable RAM */
275 __weak ulong board_get_usable_ram_top(ulong total_size)
277 #ifdef CONFIG_SYS_SDRAM_BASE
279 * Detect whether we have so much RAM that it goes past the end of our
280 * 32-bit address space. If so, clip the usable RAM so it doesn't.
282 if (gd->ram_top < CONFIG_SYS_SDRAM_BASE)
284 * Will wrap back to top of 32-bit space when reservations
292 static int setup_dest_addr(void)
294 debug("Monitor len: %08lX\n", gd->mon_len);
296 * Ram is setup, size stored in gd !!
298 debug("Ram size: %08lX\n", (ulong)gd->ram_size);
299 #if defined(CONFIG_SYS_MEM_TOP_HIDE)
301 * Subtract specified amount of memory to hide so that it won't
302 * get "touched" at all by U-Boot. By fixing up gd->ram_size
303 * the Linux kernel should now get passed the now "corrected"
304 * memory size and won't touch it either. This should work
305 * for arch/ppc and arch/powerpc. Only Linux board ports in
306 * arch/powerpc with bootwrapper support, that recalculate the
307 * memory size from the SDRAM controller setup will have to
310 gd->ram_size -= CONFIG_SYS_MEM_TOP_HIDE;
312 #ifdef CONFIG_SYS_SDRAM_BASE
313 gd->ram_top = CONFIG_SYS_SDRAM_BASE;
315 gd->ram_top += get_effective_memsize();
316 gd->ram_top = board_get_usable_ram_top(gd->mon_len);
317 gd->relocaddr = gd->ram_top;
318 debug("Ram top: %08lX\n", (ulong)gd->ram_top);
319 #if defined(CONFIG_MP) && (defined(CONFIG_MPC86xx) || defined(CONFIG_E500))
321 * We need to make sure the location we intend to put secondary core
322 * boot code is reserved and not used by any part of u-boot
324 if (gd->relocaddr > determine_mp_bootpg(NULL)) {
325 gd->relocaddr = determine_mp_bootpg(NULL);
326 debug("Reserving MP boot page to %08lx\n", gd->relocaddr);
332 #if defined(CONFIG_LOGBUFFER)
333 static int reserve_logbuffer(void)
335 #ifndef CONFIG_ALT_LB_ADDR
336 /* reserve kernel log buffer */
337 gd->relocaddr -= LOGBUFF_RESERVE;
338 debug("Reserving %dk for kernel logbuffer at %08lx\n", LOGBUFF_LEN,
347 /* reserve protected RAM */
348 static int reserve_pram(void)
352 reg = getenv_ulong("pram", 10, CONFIG_PRAM);
353 gd->relocaddr -= (reg << 10); /* size is in kB */
354 debug("Reserving %ldk for protected RAM at %08lx\n", reg,
358 #endif /* CONFIG_PRAM */
360 /* Round memory pointer down to next 4 kB limit */
361 static int reserve_round_4k(void)
363 gd->relocaddr &= ~(4096 - 1);
368 static int reserve_mmu(void)
370 #if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
371 /* reserve TLB table */
372 gd->arch.tlb_size = PGTABLE_SIZE;
373 gd->relocaddr -= gd->arch.tlb_size;
375 /* round down to next 64 kB limit */
376 gd->relocaddr &= ~(0x10000 - 1);
378 gd->arch.tlb_addr = gd->relocaddr;
379 debug("TLB table from %08lx to %08lx\n", gd->arch.tlb_addr,
380 gd->arch.tlb_addr + gd->arch.tlb_size);
382 #ifdef CONFIG_SYS_MEM_RESERVE_SECURE
384 * Record allocated tlb_addr in case gd->tlb_addr to be overwritten
385 * with location within secure ram.
387 gd->arch.tlb_allocated = gd->arch.tlb_addr;
395 static int reserve_video(void)
397 #ifdef CONFIG_DM_VIDEO
401 addr = gd->relocaddr;
402 ret = video_reserve(&addr);
405 gd->relocaddr = addr;
406 #elif defined(CONFIG_LCD)
407 # ifdef CONFIG_FB_ADDR
408 gd->fb_base = CONFIG_FB_ADDR;
410 /* reserve memory for LCD display (always full pages) */
411 gd->relocaddr = lcd_setmem(gd->relocaddr);
412 gd->fb_base = gd->relocaddr;
413 # endif /* CONFIG_FB_ADDR */
414 #elif defined(CONFIG_VIDEO) && \
415 (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) && \
416 !defined(CONFIG_ARM) && !defined(CONFIG_X86) && \
417 !defined(CONFIG_M68K)
418 /* reserve memory for video display (always full pages) */
419 gd->relocaddr = video_setmem(gd->relocaddr);
420 gd->fb_base = gd->relocaddr;
426 static int reserve_trace(void)
429 gd->relocaddr -= CONFIG_TRACE_BUFFER_SIZE;
430 gd->trace_buff = map_sysmem(gd->relocaddr, CONFIG_TRACE_BUFFER_SIZE);
431 debug("Reserving %dk for trace data at: %08lx\n",
432 CONFIG_TRACE_BUFFER_SIZE >> 10, gd->relocaddr);
438 static int reserve_uboot(void)
441 * reserve memory for U-Boot code, data & bss
442 * round down to next 4 kB limit
444 gd->relocaddr -= gd->mon_len;
445 gd->relocaddr &= ~(4096 - 1);
447 /* round down to next 64 kB limit so that IVPR stays aligned */
448 gd->relocaddr &= ~(65536 - 1);
451 debug("Reserving %ldk for U-Boot at: %08lx\n", gd->mon_len >> 10,
454 gd->start_addr_sp = gd->relocaddr;
459 /* reserve memory for malloc() area */
460 static int reserve_malloc(void)
462 gd->start_addr_sp = gd->start_addr_sp - TOTAL_MALLOC_LEN;
463 debug("Reserving %dk for malloc() at: %08lx\n",
464 TOTAL_MALLOC_LEN >> 10, gd->start_addr_sp);
468 /* (permanently) allocate a Board Info struct */
469 static int reserve_board(void)
472 gd->start_addr_sp -= sizeof(bd_t);
473 gd->bd = (bd_t *)map_sysmem(gd->start_addr_sp, sizeof(bd_t));
474 memset(gd->bd, '\0', sizeof(bd_t));
475 debug("Reserving %zu Bytes for Board Info at: %08lx\n",
476 sizeof(bd_t), gd->start_addr_sp);
481 static int setup_machine(void)
483 #ifdef CONFIG_MACH_TYPE
484 gd->bd->bi_arch_number = CONFIG_MACH_TYPE; /* board id for Linux */
489 static int reserve_global_data(void)
491 gd->start_addr_sp -= sizeof(gd_t);
492 gd->new_gd = (gd_t *)map_sysmem(gd->start_addr_sp, sizeof(gd_t));
493 debug("Reserving %zu Bytes for Global Data at: %08lx\n",
494 sizeof(gd_t), gd->start_addr_sp);
498 static int reserve_fdt(void)
500 #ifndef CONFIG_OF_EMBED
502 * If the device tree is sitting immediately above our image then we
503 * must relocate it. If it is embedded in the data section, then it
504 * will be relocated with other data.
507 gd->fdt_size = ALIGN(fdt_totalsize(gd->fdt_blob) + 0x1000, 32);
509 gd->start_addr_sp -= gd->fdt_size;
510 gd->new_fdt = map_sysmem(gd->start_addr_sp, gd->fdt_size);
511 debug("Reserving %lu Bytes for FDT at: %08lx\n",
512 gd->fdt_size, gd->start_addr_sp);
519 int arch_reserve_stacks(void)
524 static int reserve_stacks(void)
526 /* make stack pointer 16-byte aligned */
527 gd->start_addr_sp -= 16;
528 gd->start_addr_sp &= ~0xf;
531 * let the architecture-specific code tailor gd->start_addr_sp and
534 return arch_reserve_stacks();
537 static int display_new_sp(void)
539 debug("New Stack Pointer is: %08lx\n", gd->start_addr_sp);
544 #if defined(CONFIG_M68K) || defined(CONFIG_MIPS) || defined(CONFIG_PPC) || \
546 static int setup_board_part1(void)
551 * Save local variables to board info struct
553 bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; /* start of memory */
554 bd->bi_memsize = gd->ram_size; /* size in bytes */
556 #ifdef CONFIG_SYS_SRAM_BASE
557 bd->bi_sramstart = CONFIG_SYS_SRAM_BASE; /* start of SRAM */
558 bd->bi_sramsize = CONFIG_SYS_SRAM_SIZE; /* size of SRAM */
561 #if defined(CONFIG_8xx) || defined(CONFIG_MPC8260) || defined(CONFIG_5xx) || \
562 defined(CONFIG_E500) || defined(CONFIG_MPC86xx)
563 bd->bi_immr_base = CONFIG_SYS_IMMR; /* base of IMMR register */
565 #if defined(CONFIG_MPC5xxx) || defined(CONFIG_M68K)
566 bd->bi_mbar_base = CONFIG_SYS_MBAR; /* base of internal registers */
568 #if defined(CONFIG_MPC83xx)
569 bd->bi_immrbar = CONFIG_SYS_IMMR;
576 #if defined(CONFIG_PPC) || defined(CONFIG_M68K)
577 static int setup_board_part2(void)
581 bd->bi_intfreq = gd->cpu_clk; /* Internal Freq, in Hz */
582 bd->bi_busfreq = gd->bus_clk; /* Bus Freq, in Hz */
583 #if defined(CONFIG_CPM2)
584 bd->bi_cpmfreq = gd->arch.cpm_clk;
585 bd->bi_brgfreq = gd->arch.brg_clk;
586 bd->bi_sccfreq = gd->arch.scc_clk;
587 bd->bi_vco = gd->arch.vco_out;
588 #endif /* CONFIG_CPM2 */
589 #if defined(CONFIG_MPC512X)
590 bd->bi_ipsfreq = gd->arch.ips_clk;
591 #endif /* CONFIG_MPC512X */
592 #if defined(CONFIG_MPC5xxx)
593 bd->bi_ipbfreq = gd->arch.ipb_clk;
594 bd->bi_pcifreq = gd->pci_clk;
595 #endif /* CONFIG_MPC5xxx */
596 #if defined(CONFIG_M68K) && defined(CONFIG_PCI)
597 bd->bi_pcifreq = gd->pci_clk;
599 #if defined(CONFIG_EXTRA_CLOCK)
600 bd->bi_inpfreq = gd->arch.inp_clk; /* input Freq in Hz */
601 bd->bi_vcofreq = gd->arch.vco_clk; /* vco Freq in Hz */
602 bd->bi_flbfreq = gd->arch.flb_clk; /* flexbus Freq in Hz */
610 static int init_post(void)
612 post_bootmode_init();
613 post_run(NULL, POST_ROM | post_bootmode_get(0));
619 static int reloc_fdt(void)
621 #ifndef CONFIG_OF_EMBED
622 if (gd->flags & GD_FLG_SKIP_RELOC)
625 memcpy(gd->new_fdt, gd->fdt_blob, gd->fdt_size);
626 gd->fdt_blob = gd->new_fdt;
633 static int setup_reloc(void)
635 if (gd->flags & GD_FLG_SKIP_RELOC) {
636 debug("Skipping relocation due to flag\n");
640 #ifdef CONFIG_SYS_TEXT_BASE
641 gd->reloc_off = gd->relocaddr - CONFIG_SYS_TEXT_BASE;
644 * On all ColdFire arch cpu, monitor code starts always
645 * just after the default vector table location, so at 0x400
647 gd->reloc_off = gd->relocaddr - (CONFIG_SYS_TEXT_BASE + 0x400);
650 memcpy(gd->new_gd, (char *)gd, sizeof(gd_t));
652 debug("Relocation Offset is: %08lx\n", gd->reloc_off);
653 debug("Relocating to %08lx, new gd at %08lx, sp at %08lx\n",
654 gd->relocaddr, (ulong)map_to_sysmem(gd->new_gd),
660 #ifdef CONFIG_OF_BOARD_FIXUP
661 static int fix_fdt(void)
663 return board_fix_fdt((void *)gd->fdt_blob);
667 /* ARM calls relocate_code from its crt0.S */
668 #if !defined(CONFIG_ARM) && !defined(CONFIG_SANDBOX) && \
669 !CONFIG_IS_ENABLED(X86_64)
671 static int jump_to_copy(void)
673 if (gd->flags & GD_FLG_SKIP_RELOC)
676 * x86 is special, but in a nice way. It uses a trampoline which
677 * enables the dcache if possible.
679 * For now, other archs use relocate_code(), which is implemented
680 * similarly for all archs. When we do generic relocation, hopefully
681 * we can make all archs enable the dcache prior to relocation.
683 #if defined(CONFIG_X86) || defined(CONFIG_ARC)
685 * SDRAM and console are now initialised. The final stack can now
686 * be setup in SDRAM. Code execution will continue in Flash, but
687 * with the stack in SDRAM and Global Data in temporary memory
690 arch_setup_gd(gd->new_gd);
691 board_init_f_r_trampoline(gd->start_addr_sp);
693 relocate_code(gd->start_addr_sp, gd->new_gd, gd->relocaddr);
700 /* Record the board_init_f() bootstage (after arch_cpu_init()) */
701 static int mark_bootstage(void)
703 bootstage_mark_name(BOOTSTAGE_ID_START_UBOOT_F, "board_init_f");
708 static int initf_console_record(void)
710 #if defined(CONFIG_CONSOLE_RECORD) && defined(CONFIG_SYS_MALLOC_F_LEN)
711 return console_record_init();
717 static int initf_dm(void)
719 #if defined(CONFIG_DM) && defined(CONFIG_SYS_MALLOC_F_LEN)
722 ret = dm_init_and_scan(true);
726 #ifdef CONFIG_TIMER_EARLY
727 ret = dm_timer_init();
735 /* Architecture-specific memory reservation */
736 __weak int reserve_arch(void)
741 __weak int arch_cpu_init_dm(void)
746 static const init_fnc_t init_sequence_f[] = {
748 #ifdef CONFIG_OF_CONTROL
755 initf_console_record,
756 #if defined(CONFIG_HAVE_FSP)
759 arch_cpu_init, /* basic arch cpu dependent setup */
760 mach_cpu_init, /* SoC/machine dependent CPU setup */
763 mark_bootstage, /* need timer, go after init dm */
764 #if defined(CONFIG_BOARD_EARLY_INIT_F)
767 #if defined(CONFIG_PPC) || defined(CONFIG_SYS_FSL_CLK) || defined(CONFIG_M68K)
768 /* get CPU and bus clocks according to the environment variable */
769 get_clocks, /* get CPU and bus clocks (etc.) */
771 timer_init, /* initialize timer */
772 #if defined(CONFIG_BOARD_POSTCLK_INIT)
775 env_init, /* initialize environment */
776 init_baud_rate, /* initialze baudrate settings */
777 serial_init, /* serial communications setup */
778 console_init_f, /* stage 1 init of console */
779 display_options, /* say that we are here */
780 display_text_info, /* show debugging info if required */
781 #if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_SH) || \
785 #if defined(CONFIG_DISPLAY_CPUINFO)
786 print_cpuinfo, /* display cpu info (and speed) */
788 #if defined(CONFIG_DISPLAY_BOARDINFO)
791 INIT_FUNC_WATCHDOG_INIT
792 #if defined(CONFIG_MISC_INIT_F)
795 INIT_FUNC_WATCHDOG_RESET
796 #if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C)
799 #if defined(CONFIG_HARD_SPI)
803 /* TODO: unify all these dram functions? */
804 #if defined(CONFIG_ARM) || defined(CONFIG_X86) || defined(CONFIG_NDS32) || \
805 defined(CONFIG_MICROBLAZE) || defined(CONFIG_AVR32) || \
807 dram_init, /* configure available RAM banks */
809 #if defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_M68K)
815 INIT_FUNC_WATCHDOG_RESET
816 #if defined(CONFIG_SYS_DRAM_TEST)
818 #endif /* CONFIG_SYS_DRAM_TEST */
819 INIT_FUNC_WATCHDOG_RESET
824 INIT_FUNC_WATCHDOG_RESET
826 * Now that we have DRAM mapped and working, we can
827 * relocate the code and continue running from DRAM.
829 * Reserve memory at end of RAM for (top down in that order):
830 * - area that won't get touched by U-Boot and Linux (optional)
831 * - kernel log buffer
835 * - board info struct
838 #if defined(CONFIG_LOGBUFFER)
860 #if defined(CONFIG_M68K) || defined(CONFIG_MIPS) || defined(CONFIG_PPC) || \
864 #if defined(CONFIG_PPC) || defined(CONFIG_M68K)
865 INIT_FUNC_WATCHDOG_RESET
869 #ifdef CONFIG_SYS_EXTBDINFO
872 #ifdef CONFIG_OF_BOARD_FIXUP
875 INIT_FUNC_WATCHDOG_RESET
878 #if defined(CONFIG_X86) || defined(CONFIG_ARC)
883 #if defined(CONFIG_XTENSA)
886 #if !defined(CONFIG_ARM) && !defined(CONFIG_SANDBOX) && \
887 !CONFIG_IS_ENABLED(X86_64)
893 void board_init_f(ulong boot_flags)
895 #ifdef CONFIG_SYS_GENERIC_GLOBAL_DATA
897 * For some architectures, global data is initialized and used before
898 * calling this function. The data should be preserved. For others,
899 * CONFIG_SYS_GENERIC_GLOBAL_DATA should be defined and use the stack
900 * here to host global data until relocation.
907 * Clear global data before it is accessed at debug print
908 * in initcall_run_list. Otherwise the debug print probably
909 * get the wrong value of gd->have_console.
914 gd->flags = boot_flags;
915 gd->have_console = 0;
917 if (initcall_run_list(init_sequence_f))
920 #if !defined(CONFIG_ARM) && !defined(CONFIG_SANDBOX) && \
921 !defined(CONFIG_EFI_APP) && !CONFIG_IS_ENABLED(X86_64)
922 /* NOTREACHED - jump_to_copy() does not return */
927 #if defined(CONFIG_X86) || defined(CONFIG_ARC)
929 * For now this code is only used on x86.
931 * init_sequence_f_r is the list of init functions which are run when
932 * U-Boot is executing from Flash with a semi-limited 'C' environment.
933 * The following limitations must be considered when implementing an
935 * - 'static' variables are read-only
936 * - Global Data (gd->xxx) is read/write
938 * The '_f_r' sequence must, as a minimum, copy U-Boot to RAM (if
939 * supported). It _should_, if possible, copy global data to RAM and
940 * initialise the CPU caches (to speed up the relocation process)
942 * NOTE: At present only x86 uses this route, but it is intended that
943 * all archs will move to this when generic relocation is implemented.
945 static const init_fnc_t init_sequence_f_r[] = {
946 #if !CONFIG_IS_ENABLED(X86_64)
953 void board_init_f_r(void)
955 if (initcall_run_list(init_sequence_f_r))
959 * The pre-relocation drivers may be using memory that has now gone
960 * away. Mark serial as unavailable - this will fall back to the debug
963 gd->flags &= ~GD_FLG_SERIAL_READY;
966 * U-Boot has been copied into SDRAM, the BSS has been cleared etc.
967 * Transfer execution from Flash to RAM by calculating the address
968 * of the in-RAM copy of board_init_r() and calling it
970 (board_init_r + gd->reloc_off)((gd_t *)gd, gd->relocaddr);
972 /* NOTREACHED - board_init_r() does not return */
975 #endif /* CONFIG_X86 */