]> Git Repo - J-u-boot.git/blobdiff - lib/lmb.c
aes: Allow to store randomly generated IV in the FIT
[J-u-boot.git] / lib / lmb.c
index 3dfd8f4f88cbb70e7a12f723a72616a2a166bc0f..b03237bc06cba1919e2b88800076adaf22536061 100644 (file)
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -201,15 +201,6 @@ static long lmb_add_region_flags(struct alist *lmb_rgn_lst, phys_addr_t base,
                phys_addr_t rgnbase = rgn[i].base;
                phys_size_t rgnsize = rgn[i].size;
                phys_size_t rgnflags = rgn[i].flags;
-               phys_addr_t end = base + size - 1;
-               phys_addr_t rgnend = rgnbase + rgnsize - 1;
-               if (rgnbase <= base && end <= rgnend) {
-                       if (flags == rgnflags)
-                               /* Already have this region, so we're done */
-                               return 0;
-                       else
-                               return -1; /* regions with new flags */
-               }
 
                ret = lmb_addrs_adjacent(base, size, rgnbase, rgnsize);
                if (ret > 0) {
@@ -506,7 +497,7 @@ static void lmb_dump_region(struct alist *lmb_rgn_lst, char *name)
        enum lmb_flags flags;
        int i;
 
-       printf(" %s.count = 0x%x\n", name, lmb_rgn_lst->count);
+       printf(" %s.count = %#x\n", name, lmb_rgn_lst->count);
 
        for (i = 0; i < lmb_rgn_lst->count; i++) {
                base = rgn[i].base;
@@ -514,7 +505,7 @@ static void lmb_dump_region(struct alist *lmb_rgn_lst, char *name)
                end = base + size - 1;
                flags = rgn[i].flags;
 
-               printf(" %s[%d]\t[0x%llx-0x%llx], 0x%08llx bytes flags: ",
+               printf(" %s[%d]\t[%#llx-%#llx], %#llx bytes, flags: ",
                       name, i, base, end, size);
                lmb_print_region_flags(flags);
        }
@@ -615,6 +606,7 @@ static __maybe_unused void lmb_reserve_common_spl(void)
 void lmb_add_memory(void)
 {
        int i;
+       phys_addr_t bank_end;
        phys_size_t size;
        u64 ram_top = gd->ram_top;
        struct bd_info *bd = gd->bd;
@@ -628,6 +620,8 @@ void lmb_add_memory(void)
 
        for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
                size = bd->bi_dram[i].size;
+               bank_end = bd->bi_dram[i].start + size;
+
                if (size) {
                        lmb_add(bd->bi_dram[i].start, size);
 
@@ -639,6 +633,9 @@ void lmb_add_memory(void)
                        if (bd->bi_dram[i].start >= ram_top)
                                lmb_reserve_flags(bd->bi_dram[i].start, size,
                                                  LMB_NOOVERWRITE);
+                       else if (bank_end > ram_top)
+                               lmb_reserve_flags(ram_top, bank_end - ram_top,
+                                                 LMB_NOOVERWRITE);
                }
        }
 }
This page took 0.025538 seconds and 4 git commands to generate.