aboutsummaryrefslogtreecommitdiff
path: root/include/lmb.h
diff options
context:
space:
mode:
authorSimon Goldschmidt2019-01-14 22:38:18 +0100
committerTom Rini2019-01-16 16:37:04 -0500
commit4cc8af8037ebabd674d0a6bed202b0c711dc7699 (patch)
tree8617a878fbb2be6711067e854144670539e60769 /include/lmb.h
parente2237a2c263783996a85b70ccbf1f967aa2ec182 (diff)
lib: lmb: extend lmb for checks at load time
This adds two new functions, lmb_alloc_addr and lmb_get_unreserved_size. lmb_alloc_addr behaves like lmb_alloc, but it tries to allocate a pre-specified address range. Unlike lmb_reserve, this address range must be inside one of the memory ranges that has been set up with lmb_add. lmb_get_unreserved_size returns the number of bytes that can be used up to the next reserved region or the end of valid ram. This can be 0 if the address passed is reserved. Added test for these new functions. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Diffstat (limited to 'include/lmb.h')
-rw-r--r--include/lmb.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/lmb.h b/include/lmb.h
index f04d0580937..7d7e2a78dc0 100644
--- a/include/lmb.h
+++ b/include/lmb.h
@@ -38,6 +38,9 @@ extern phys_addr_t lmb_alloc_base(struct lmb *lmb, phys_size_t size, ulong align
phys_addr_t max_addr);
extern phys_addr_t __lmb_alloc_base(struct lmb *lmb, phys_size_t size, ulong align,
phys_addr_t max_addr);
+extern phys_addr_t lmb_alloc_addr(struct lmb *lmb, phys_addr_t base,
+ phys_size_t size);
+extern phys_size_t lmb_get_unreserved_size(struct lmb *lmb, phys_addr_t addr);
extern int lmb_is_reserved(struct lmb *lmb, phys_addr_t addr);
extern long lmb_free(struct lmb *lmb, phys_addr_t base, phys_size_t size);