Commit 49d5ff439c9ddc0ac124ea117fd33b194dca3142

Authored by Bin Meng
1 parent 2c78a79ec7

x86: Fix the mystery of printch() during 64-bit boot

At present in arch_setup_gd() it calls printch(' ') at the end which
has been a mystery for a long time as without such call the 64-bit
U-Boot just does not boot at all.

In fact this is due to the bug that board_init_f() was called with
boot_flags not being set. Hence whatever value being there in the
rdi register becomes the boot_flags if without such magic call.
With a printch(' ') call the rdi register is initialized as 0x20
and this value seems to be sane enough for the whole boot process.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

Showing 2 changed files with 1 additions and 18 deletions Side-by-side Diff

arch/x86/cpu/start64.S
... ... @@ -20,6 +20,7 @@
20 20  
21 21 call board_init_f_init_reserve
22 22  
  23 + xor %rdi, %rdi
23 24 call board_init_f
24 25 call board_init_f_r
25 26  
arch/x86/cpu/x86_64/cpu.c
... ... @@ -19,24 +19,6 @@
19 19 void arch_setup_gd(gd_t *new_gd)
20 20 {
21 21 global_data_ptr = new_gd;
22   -
23   - /*
24   - * TODO(sjg@chromium.org): For some reason U-Boot does not boot
25   - * without this line. It fails to start up U-Boot proper and instead
26   - * restarts SPL. Need to figure out why:
27   - *
28   - * U-Boot SPL 2017.01
29   - *
30   - * U-Boot SPL 2017.01
31   - * CPU: Intel(R) Core(TM) i5-3427U CPU @ 1.80GHz
32   - * Trying to boot from SPIJumping to 64-bit U-Boot: Note many
33   - * features are missing
34   - *
35   - * U-Boot SPL 2017.01
36   - */
37   -#ifdef CONFIG_DEBUG_UART
38   - printch(' ');
39   -#endif
40 22 }
41 23  
42 24 int cpu_has_64bit(void)