diff options
author | Patrick Delaunay <patrick.delaunay@foss.st.com> | 2021-03-10 10:16:27 +0100 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-04-22 14:09:45 -0400 |
commit | 00fd8dad4d2ed738d11f29d992dc106bbdf4d68f (patch) | |
tree | ef20e639671e0727dee0454f6aa01311ae140097 /lib | |
parent | 8f167da9c572845782000075e092e63a8273032d (diff) | |
download | u-boot-00fd8dad4d2ed738d11f29d992dc106bbdf4d68f.zip u-boot-00fd8dad4d2ed738d11f29d992dc106bbdf4d68f.tar.gz u-boot-00fd8dad4d2ed738d11f29d992dc106bbdf4d68f.tar.bz2 |
lmb: add a max parameter in the struct lmb_region
Add a max parameter in lmb_region struct to handle test
in lmb_add_region without using the MAX_LMB_REGIONS
define.
This patch allows to modify these size independently for
memory of reserved regions in the next patches.
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/lmb.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -95,6 +95,9 @@ static void lmb_coalesce_regions(struct lmb_region *rgn, unsigned long r1, void lmb_init(struct lmb *lmb) { + lmb->memory.max = MAX_LMB_REGIONS; + lmb->reserved.max = MAX_LMB_REGIONS; + lmb->memory.cnt = 0; lmb->reserved.cnt = 0; } @@ -179,7 +182,7 @@ static long lmb_add_region(struct lmb_region *rgn, phys_addr_t base, phys_size_t if (coalesced) return coalesced; - if (rgn->cnt >= MAX_LMB_REGIONS) + if (rgn->cnt >= rgn->max) return -1; /* Couldn't coalesce the LMB, so add it to the sorted table. */ |