At present we assume that CAR (Cache-as-RAM) is used if HOBs (Hand-off
bLocks) are not, since HOBs typically indicate that an FSP is in use, and
FSPs handle the CAR init.

However this is a bit indirect, and for FSP2 machines which use their own
CAR implementation (such as apollolake) but use the FSP for other
functions, the logic is wrong.

To fix this, add a dedicated Kconfig option to indicate when CAR is used.

Signed-off-by: Simon Glass <s...@chromium.org>
---

Changes in v2: None

 arch/x86/Kconfig                 | 8 ++++++++
 arch/x86/cpu/start.S             | 4 ++--
 configs/slimbootloader_defconfig | 1 +
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 314f8def7a4..47bf28c434f 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -364,6 +364,14 @@ config HAVE_FSP
          Note: Without this binary U-Boot will not be able to set up its
          SDRAM so will not boot.
 
+config USE_CAR
+       bool "Use Cache-As-RAM (CAR) to get temporary RAM at start-up"
+       default y if !HAVE_FSP
+       help
+         Select this option if your board uses CAR init code, typically in a
+         car.S file, to get some initial memory for code execution. This is
+         common with Intel CPUs which don't use FSP.
+
 choice
        prompt "FSP version"
        depends on HAVE_FSP
diff --git a/arch/x86/cpu/start.S b/arch/x86/cpu/start.S
index 3c9bdf2a9d6..9b763942743 100644
--- a/arch/x86/cpu/start.S
+++ b/arch/x86/cpu/start.S
@@ -90,7 +90,7 @@ early_board_init_ret:
        jmp     car_init
 .globl car_init_ret
 car_init_ret:
-#ifndef CONFIG_USE_HOB
+#ifdef CONFIG_USE_CAR
        /*
         * We now have CONFIG_SYS_CAR_SIZE bytes of Cache-As-RAM (or SRAM,
         * or fully initialised SDRAM - we really don't care which)
@@ -130,7 +130,7 @@ car_init_ret:
 
        /* Get address of global_data */
        mov     %fs:0, %edx
-#ifdef CONFIG_USE_HOB
+#if defined(CONFIG_USE_HOB) && !defined(CONFIG_USE_CAR)
        /* Store the HOB list if we have one */
        test    %esi, %esi
        jz      skip_hob
diff --git a/configs/slimbootloader_defconfig b/configs/slimbootloader_defconfig
index f9fecff45ea..3cbb83c7a47 100644
--- a/configs/slimbootloader_defconfig
+++ b/configs/slimbootloader_defconfig
@@ -18,3 +18,4 @@ CONFIG_REGMAP=y
 CONFIG_SYSCON=y
 # CONFIG_PCI_PNP is not set
 CONFIG_CONSOLE_SCROLL_LINES=5
+# CONFIG_USE_CAR is not set
-- 
2.23.0.444.g18eeb5a265-goog

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to