blob: 4d4e5d0758d44b26720edc16afd1b0f981654499 [file] [log] [blame]
Simon Glass75659ac2019-04-25 21:58:52 -06001/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * 32-bit x86 Startup Code when running from SPL
4 *
5 * Copyright 2018 Google, Inc
6 * Written by Simon Glass <sjg@chromium.org>
7 */
8
9#include <config.h>
10
11.section .text.start
12.code32
13.globl _start
14.type _start, @function
15_start:
16 /* Set up memory using the existing stack */
17 movl $(CONFIG_SYS_CAR_ADDR + CONFIG_SYS_CAR_SIZE - 4), %eax
18#ifdef CONFIG_DCACHE_RAM_MRC_VAR_SIZE
19 subl $CONFIG_DCACHE_RAM_MRC_VAR_SIZE, %eax
20#endif
21 /*
22 * We don't subject CONFIG_DCACHE_RAM_MRC_VAR_SIZE since memory is
23 * already set up. This has the happy side-effect of putting gd in a
24 * new place separate from SPL, so the memset() in
25 * board_init_f_init_reserve() does not cause any problems (otherwise
26 * it would zero out the gd and crash)
27 */
28 call board_init_f_alloc_reserve
29 mov %eax, %esp
30
31 call board_init_f_init_reserve
32
33 xorl %eax, %eax
34 call board_init_f
35 call board_init_f_r
36
37 /* Should not return here */
38 jmp .
39
40.globl board_init_f_r_trampoline
41.type board_init_f_r_trampoline, @function
42board_init_f_r_trampoline:
43 /*
44 * SPL has been executed and SDRAM has been initialised, U-Boot code
45 * has been copied into RAM, BSS has been cleared and relocation
46 * adjustments have been made. It is now time to jump into the in-RAM
47 * copy of U-Boot
48 *
49 * %eax = Address of top of new stack
50 */
51
52 /* Stack grows down from top of SDRAM */
53 movl %eax, %esp
54
55 /* Re-enter U-Boot by calling board_init_f_r() */
56 call board_init_f_r
57
58die:
59 hlt
60 jmp die
61 hlt
62
63 .align 4
64_dt_ucode_base_size:
65 /* These next two fields are filled in by binman */
66.globl ucode_base
67ucode_base: /* Declared in microcode.h */
68 .long 0 /* microcode base */
69.globl ucode_size
70ucode_size: /* Declared in microcode.h */
71 .long 0 /* microcode size */