]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
x86: fsp: Save usable RAM and hob_list in the handoff area
authorSimon Glass <sjg@chromium.org>
Wed, 25 Sep 2019 14:11:41 +0000 (08:11 -0600)
committerBin Meng <bmeng.cn@gmail.com>
Tue, 8 Oct 2019 05:57:36 +0000 (13:57 +0800)
The useable RAM is calculated when the RAM is inited. Save this value so
that it can be easily used in U-Boot proper.

Also save a pointer to the hob list so that it is accessible (before
relocation only) in U-Boot proper. This avoids having to scan it in SPL,
for everything U-Boot proper might need later.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: guard handoff_arch_save() with IS_ENABLED(CONFIG_USE_HOB)]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
arch/x86/cpu/intel_common/cpu_from_spl.c
arch/x86/include/asm/handoff.h
arch/x86/lib/fsp/fsp_dram.c

index a6233c75ce2cc2c0b1a18d05e70de9ec73cbe71e..b7bb524162f6f0e48cf2a38005cdd8c5d56a41c4 100644 (file)
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <handoff.h>
 #include <asm/cpu_common.h>
 #include <asm/intel_regs.h>
 #include <asm/lapic.h>
@@ -21,6 +22,11 @@ int arch_cpu_init(void)
 {
        int ret;
 
+#if CONFIG_IS_ENABLED(HANDOFF) && IS_ENABLED(CONFIG_USE_HOB)
+       struct spl_handoff *ho = gd->spl_handoff;
+
+       gd->arch.hob_list = ho->arch.hob_list;
+#endif
        ret = x86_cpu_reinit_f();
 
        return ret;
index 4d18d59efedb4ca49bf55d515a4318aef9224c6e..aec49b9b815c6e1a1a683c516e9ceeecd1ae844c 100644 (file)
@@ -9,7 +9,15 @@
 #ifndef __x86_asm_handoff_h
 #define __x86_asm_handoff_h
 
+/**
+ * struct arch_spl_handoff - architecture-specific handoff info
+ *
+ * @usable_ram_top: Value returned by board_get_usable_ram_top() in SPL
+ * @hob_list: Start of FSP hand-off blocks (HOBs)
+ */
 struct arch_spl_handoff {
+       ulong usable_ram_top;
+       void *hob_list;
 };
 
 #endif
index 8fe1e0bf73db365e8de3186103c4171f77aca868..2d1023068feb856015aab667dd319b46f3e04004 100644 (file)
@@ -88,3 +88,13 @@ unsigned int install_e820_map(unsigned int max_entries,
 
        return num_entries;
 }
+
+#if CONFIG_IS_ENABLED(HANDOFF) && IS_ENABLED(CONFIG_USE_HOB)
+int handoff_arch_save(struct spl_handoff *ho)
+{
+       ho->arch.usable_ram_top = fsp_get_usable_lowmem_top(gd->arch.hob_list);
+       ho->arch.hob_list = gd->arch.hob_list;
+
+       return 0;
+}
+#endif