ARM: bootm: take into account gd->ram_top
[oweals/u-boot.git] / arch / arm / lib / bootm.c
index 488358a33163df342cd00b6543ea17bf8bd72104..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;
        }