summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/include/cbmem.h2
-rw-r--r--src/lib/imd_cbmem.c9
2 files changed, 10 insertions, 1 deletions
diff --git a/src/include/cbmem.h b/src/include/cbmem.h
index efaa44f9c9..2e947a1973 100644
--- a/src/include/cbmem.h
+++ b/src/include/cbmem.h
@@ -109,6 +109,8 @@ int cbmem_recovery(int s3resume);
void *cbmem_add(u32 id, u64 size);
/* Find a cbmem entry of a given id. These return NULL on failure. */
void *cbmem_find(u32 id);
+/* Get location and size of CBMEM region in memory */
+void cbmem_region_used(uintptr_t *base, size_t *size);
/* Indicate to each hook if cbmem is being recovered or not. */
typedef void (* const cbmem_init_hook_t)(int is_recovery);
diff --git a/src/lib/imd_cbmem.c b/src/lib/imd_cbmem.c
index 49faad97b4..e75c538cea 100644
--- a/src/lib/imd_cbmem.c
+++ b/src/lib/imd_cbmem.c
@@ -263,12 +263,19 @@ void *cbmem_entry_start(const struct cbmem_entry *entry)
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);
}