Merge https://gitlab.denx.de/u-boot/custodians/u-boot-spi
[platform/kernel/u-boot.git] / arch / x86 / lib / init_helpers.c
index ac85278..d906b52 100644 (file)
@@ -5,30 +5,34 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <linux/errno.h>
 #include <asm/mtrr.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
-/* Get the top of usable RAM */
-__weak ulong board_get_usable_ram_top(ulong total_size)
-{
-       return gd->ram_size;
-}
-
 int init_cache_f_r(void)
 {
-#if (CONFIG_IS_ENABLED(X86_32BIT_INIT) || \
-     (!defined(CONFIG_SPL_BUILD) && \
-      !CONFIG_IS_ENABLED(CONFIG_X86_RUN_64BIT))) && \
-    !defined(CONFIG_HAVE_FSP)
+       bool do_mtrr = CONFIG_IS_ENABLED(X86_32BIT_INIT) ||
+                IS_ENABLED(CONFIG_FSP_VERSION2);
        int ret;
 
-       ret = mtrr_commit(false);
-       /* If MTRR MSR is not implemented by the processor, just ignore it */
-       if (ret && ret != -ENOSYS)
-               return ret;
-#endif
+       do_mtrr &= !IS_ENABLED(CONFIG_FSP_VERSION1) &&
+               !IS_ENABLED(CONFIG_SYS_SLIMBOOTLOADER);
+
+       if (do_mtrr) {
+               ret = mtrr_commit(false);
+               /*
+                * If MTRR MSR is not implemented by the processor, just ignore
+                * it
+                */
+               if (ret && ret != -ENOSYS)
+                       return ret;
+       }
+
+       if (!ll_boot_init())
+               return 0;
+
        /* Initialise the CPU cache(s) */
        return init_cache();
 }