diff options
author | Patrick Delaunay <patrick.delaunay@foss.st.com> | 2021-05-07 14:50:30 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-06-07 10:48:40 -0400 |
commit | e359a4a5c1f01add83b8f39f5da0c61ce51e918a (patch) | |
tree | 90fcf2541a1902a7a3be3ec425ffbeb517c8f9b9 /lib/lmb.c | |
parent | 59c0ea5df33fc4d9b62226d29e3b5c61d639303f (diff) |
lmb: add lmb_is_reserved_flags
Add a new function lmb_is_reserved_flags to check if
an address is reserved with a specific flags.
This function can be used to check if an address was
reserved with no-map flags with:
lmb_is_reserved_flags(lmb, addr, LMB_NOMAP);
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Diffstat (limited to 'lib/lmb.c')
-rw-r--r-- | lib/lmb.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -443,7 +443,7 @@ phys_size_t lmb_get_free_size(struct lmb *lmb, phys_addr_t addr) return 0; } -int lmb_is_reserved(struct lmb *lmb, phys_addr_t addr) +int lmb_is_reserved_flags(struct lmb *lmb, phys_addr_t addr, int flags) { int i; @@ -451,11 +451,16 @@ int lmb_is_reserved(struct lmb *lmb, phys_addr_t addr) phys_addr_t upper = lmb->reserved.region[i].base + lmb->reserved.region[i].size - 1; if ((addr >= lmb->reserved.region[i].base) && (addr <= upper)) - return 1; + return (lmb->reserved.region[i].flags & flags) == flags; } return 0; } +int lmb_is_reserved(struct lmb *lmb, phys_addr_t addr) +{ + return lmb_is_reserved_flags(lmb, addr, LMB_NONE); +} + __weak void board_lmb_reserve(struct lmb *lmb) { /* please define platform specific board_lmb_reserve() */ |