cbmem: Add utility to get memory region occupied by cbmem
Change-Id: I8e57c23565f173afc0f4d450579b8bfb35aeb964
Signed-off-by: Alexandru Gagniuc <alexandrux.gagniuc@intel.com>
Signed-off-by: Andrey Petrov <andrey.petrov@intel.com>
Reviewed-on: https://review.coreboot.org/13363
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
diff --git a/src/lib/imd_cbmem.c b/src/lib/imd_cbmem.c
index 49faad9..e75c538 100644
--- a/src/lib/imd_cbmem.c
+++ b/src/lib/imd_cbmem.c
@@ -263,12 +263,19 @@
return imd_entry_at(imd, cbmem_to_imd(entry));
}
+void cbmem_region_used(uintptr_t *base, size_t *size)
+{
+ void *baseptr;
+ imd_region_used(cbmem_get_imd(), &baseptr, size);
+ *base = (uintptr_t)baseptr;
+}
+
void cbmem_add_bootmem(void)
{
void *base = NULL;
size_t size = 0;
- imd_region_used(cbmem_get_imd(), &base, &size);
+ cbmem_region_used(base, &size);
bootmem_add_range((uintptr_t)base, size, LB_MEM_TABLE);
}