Merge tag 'tpm-030822' of https://source.denx.de/u-boot/custodians/u-boot-tpm
[platform/kernel/u-boot.git] / lib / lmb.c
index 676b3a0..f21fe67 100644 (file)
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -13,6 +13,7 @@
 #include <malloc.h>
 
 #include <asm/global_data.h>
+#include <asm/sections.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -107,7 +108,7 @@ void lmb_init(struct lmb *lmb)
 #if IS_ENABLED(CONFIG_LMB_USE_MAX_REGIONS)
        lmb->memory.max = CONFIG_LMB_MAX_REGIONS;
        lmb->reserved.max = CONFIG_LMB_MAX_REGIONS;
-#else
+#elif IS_ENABLED(CONFIG_LMB_MEMORY_REGIONS)
        lmb->memory.max = CONFIG_LMB_MEMORY_REGIONS;
        lmb->reserved.max = CONFIG_LMB_RESERVED_REGIONS;
        lmb->memory.region = lmb->memory_regions;
@@ -144,6 +145,10 @@ void arch_lmb_reserve_generic(struct lmb *lmb, ulong sp, ulong end, ulong align)
                        bank_end = end - 1;
 
                lmb_reserve(lmb, sp, bank_end - sp + 1);
+
+               if (gd->flags & GD_FLG_SKIP_RELOC)
+                       lmb_reserve(lmb, (phys_addr_t)(uintptr_t)_start, gd->mon_len);
+
                break;
        }
 }