diff options
author | Ye Li <ye.li@nxp.com> | 2019-06-18 01:24:10 -0700 |
---|---|---|
committer | Ye Li <ye.li@nxp.com> | 2020-04-26 23:26:40 -0700 |
commit | 09d565c4ab499940ccf60607d1af54afaf410440 (patch) | |
tree | abf3173cbff9ad8d11b9029ec004809cdbd7961f /lib | |
parent | 2876d2923afe42ccdfb65a8bb286271fce78b626 (diff) |
MLK-22035-1 lmb: Add lmb_reserve_overlap for fdt reserved memory
Previous patch "MLK-21885 lmb: Handle the overlap case for lmb reserve" adds
the overlap support to lmb reserve. However, u-boot has some places to use the
lmb_reserve when allocating memory in loading images. If we allowed overlap
in this function, it means images loading address can overlap each other and
cause the address check mechanism not work.
So add another function to allow overlap and only use it for fdt reserved-memory
nodes. The FDT reserved-memory is ok to merge with other reserved memory, since
this won't break image loading address check.
Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 2109dc2a4da592003ec62820f5bdfb6bd0899805)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/lmb.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -266,6 +266,13 @@ long lmb_free(struct lmb *lmb, phys_addr_t base, phys_size_t size) return lmb_add_region(rgn, end + 1, rgnend - end); } +long lmb_reserve(struct lmb *lmb, phys_addr_t base, phys_size_t size) +{ + struct lmb_region *_rgn = &(lmb->reserved); + + return lmb_add_region(_rgn, base, size); +} + static long lmb_overlaps_region(struct lmb_region *rgn, phys_addr_t base, phys_size_t size) { @@ -281,7 +288,7 @@ static long lmb_overlaps_region(struct lmb_region *rgn, phys_addr_t base, return (i < rgn->cnt) ? i : -1; } -long lmb_reserve(struct lmb *lmb, phys_addr_t base, phys_size_t size) +long lmb_reserve_overlap(struct lmb *lmb, phys_addr_t base, phys_size_t size) { struct lmb_region *_rgn = &(lmb->reserved); long ret = lmb_add_region(_rgn, base, size); |