x86: Add a common HOB library
[oweals/u-boot.git] / arch / x86 / cpu / start.S
index 8de55a0af1de3681a360ff35fb5acf70ef878a90..71cd70f9cde402f5d53479f851088878163f56e9 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
 /*
  *  U-Boot - x86 Startup Code
  *
@@ -6,8 +7,6 @@
  *
  * (C) Copyright 2002
  * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <config.h>
@@ -17,8 +16,9 @@
 #include <asm/processor-flags.h>
 #include <generated/generic-asm-offsets.h>
 #include <generated/asm-offsets.h>
+#include <linux/linkage.h>
 
-.section .text
+.section .text.start
 .code32
 .globl _start
 .type _start, @function
@@ -97,7 +97,7 @@ early_board_init_ret:
        jmp     car_init
 .globl car_init_ret
 car_init_ret:
-#ifndef CONFIG_HAVE_FSP
+#ifndef CONFIG_USE_HOB
        /*
         * We now have CONFIG_SYS_CAR_SIZE bytes of Cache-As-RAM (or SRAM,
         * or fully initialised SDRAM - we really don't care which)
@@ -137,12 +137,13 @@ car_init_ret:
 
        /* Get address of global_data */
        mov     %fs:0, %edx
-#ifdef CONFIG_HAVE_FSP
+#ifdef CONFIG_USE_HOB
        /* Store the HOB list if we have one */
        test    %esi, %esi
        jz      skip_hob
        movl    %esi, GD_HOB_LIST(%edx)
 
+#ifdef CONFIG_HAVE_FSP
        /*
         * After fsp_init() returns, the stack has already been switched to a
         * place within system memory as defined by CONFIG_FSP_TEMP_RAM_ADDR.
@@ -151,6 +152,7 @@ car_init_ret:
         */
        subl    $CONFIG_FSP_SYS_MALLOC_F_LEN, %esp
        movl    %esp, GD_MALLOC_BASE(%edx)
+#endif
 skip_hob:
 #else
        /* Store table pointer */
@@ -185,21 +187,33 @@ board_init_f_r_trampoline:
        movl    %eax, %esp
 
        /* See if we need to disable CAR */
-.weak  car_uninit
-       movl    $car_uninit, %eax
-       cmpl    $0, %eax
-       jz      1f
-
        call    car_uninit
-1:
+
        /* Re-enter U-Boot by calling board_init_f_r() */
        call    board_init_f_r
 
+#ifdef CONFIG_TPL
+.globl jump_to_spl
+.type jump_to_spl, @function
+jump_to_spl:
+       /* Reset stack to the top of CAR space */
+       movl    $(CONFIG_SYS_CAR_ADDR + CONFIG_SYS_CAR_SIZE - 4), %esp
+#ifdef CONFIG_DCACHE_RAM_MRC_VAR_SIZE
+       subl    $CONFIG_DCACHE_RAM_MRC_VAR_SIZE, %esp
+#endif
+
+       jmp     *%eax
+#endif
+
 die:
        hlt
        jmp     die
        hlt
 
+WEAK(car_uninit)
+       ret
+ENDPROC(car_uninit)
+
 blank_idt_ptr:
        .word   0               /* limit */
        .long   0               /* base */