lib/bootmem: Add method to walk memory tables
Add a method to walk bootmem memory tables and call a function for each memory range. The tables might not match with OS sight of view. Return true if the callback function returned false. Required for FIT support in coreboot to find a usable RAM region. Tested on Cavium SoC. Change-Id: I0004e5ad5fe2289827f370f0d0f9979d3cbd3926 Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Reviewed-on: https://review.coreboot.org/25583 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
committed by
Patrick Georgi
parent
23d62dd15c
commit
c653623d59
@@ -180,6 +180,20 @@ void bootmem_dump_ranges(void)
|
||||
}
|
||||
}
|
||||
|
||||
bool bootmem_walk(range_action_t action, void *arg)
|
||||
{
|
||||
const struct range_entry *r;
|
||||
|
||||
assert(bootmem_is_initialized());
|
||||
|
||||
memranges_each_entry(r, &bootmem) {
|
||||
if (!action(r, arg))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int bootmem_region_targets_usable_ram(uint64_t start, uint64_t size)
|
||||
{
|
||||
const struct range_entry *r;
|
||||
|
Reference in New Issue
Block a user