Merge tag 'u-boot-atmel-fixes-2020.07-a' of https://gitlab.denx.de/u-boot/custodians...
[oweals/u-boot.git] / arch / x86 / lib / fsp2 / fsp_dram.c
index 90a238a224548cfa3dbed1d191f8567c8fc125d5..1c82b818313431c3f3b91e3b5768e183d601aad7 100644 (file)
@@ -5,18 +5,27 @@
  */
 
 #include <common.h>
-#include <acpi_s3.h>
 #include <handoff.h>
+#include <init.h>
+#include <log.h>
 #include <spl.h>
+#include <acpi/acpi_s3.h>
 #include <asm/arch/cpu.h>
 #include <asm/fsp/fsp_support.h>
 #include <asm/fsp2/fsp_api.h>
 #include <asm/fsp2/fsp_internal.h>
+#include <linux/sizes.h>
 
 int dram_init(void)
 {
        int ret;
 
+       if (!ll_boot_init()) {
+               /* Use a small and safe amount of 1GB */
+               gd->ram_size = SZ_1G;
+
+               return 0;
+       }
        if (spl_phase() == PHASE_SPL) {
 #ifdef CONFIG_HAVE_ACPI_RESUME
                bool s3wake = gd->arch.prev_sleep_state == ACPI_S3;
@@ -68,6 +77,9 @@ int dram_init(void)
 
 ulong board_get_usable_ram_top(ulong total_size)
 {
+       if (!ll_boot_init())
+               return gd->ram_size;
+
 #if CONFIG_IS_ENABLED(HANDOFF)
        struct spl_handoff *ho = gd->spl_handoff;