summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYe Li <ye.li@nxp.com>2019-06-18 01:24:10 -0700
committerYe Li <ye.li@nxp.com>2020-04-26 23:26:40 -0700
commit09d565c4ab499940ccf60607d1af54afaf410440 (patch)
treeabf3173cbff9ad8d11b9029ec004809cdbd7961f /lib
parent2876d2923afe42ccdfb65a8bb286271fce78b626 (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.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/lmb.c b/lib/lmb.c
index 9ead003929..61ee6e1e8f 100644
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -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);