ARM: bootm: take into account gd->ram_top
[oweals/u-boot.git] / arch / arm / lib / bootm.c
index 1638f1e81d700274c0ba9a7bd84f9bf5c396f2d7..f4b5ca6de004dec95d8b2924984bac040e33da6a 100644 (file)
@@ -13,7 +13,9 @@
 
 #include <common.h>
 #include <command.h>
+#include <cpu_func.h>
 #include <dm.h>
+#include <hang.h>
 #include <dm/root.h>
 #include <env.h>
 #include <image.h>
@@ -73,6 +75,9 @@ void arch_lmb_reserve(struct lmb *lmb)
                        gd->bd->bi_dram[bank].size - 1;
                if (sp > bank_end)
                        continue;
+               if (bank_end > gd->ram_top)
+                       bank_end = gd->ram_top - 1;
+
                lmb_reserve(lmb, sp, bank_end - sp + 1);
                break;
        }
@@ -224,6 +229,8 @@ static void do_nonsec_virt_switch(void)
 }
 #endif
 
+__weak void board_prep_linux(bootm_headers_t *images) { }
+
 /* Subcommand: PREP */
 static void boot_prep_linux(bootm_headers_t *images)
 {
@@ -270,6 +277,8 @@ static void boot_prep_linux(bootm_headers_t *images)
                printf("FDT and ATAGS support not compiled in - hanging\n");
                hang();
        }
+
+       board_prep_linux(images);
 }
 
 __weak bool armv7_boot_nonsec_default(void)