lib/cbmem: provide optional cbmem top initialization hook

Provide a hook to allow an optional one-time cbmem_top() initialization.
The new function, cbmem_top_init(), is called on the first expected
initialization of cbmem based on the Kconfig options LATE_CBMEM_INIT
and EARLY_CBMEM_INIT.

Change-Id: I89edd2d11f226217c8e2aaca829b4f375a2cff28
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Signed-off-by: John Zhao <john.zhao@intel.com>
Reviewed-on: https://review.coreboot.org/20847
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
This commit is contained in:
Aaron Durbin
2017-08-01 10:27:10 -06:00
parent 403fdbc226
commit dfdea2aa40
2 changed files with 26 additions and 0 deletions

View File

@ -64,6 +64,11 @@ int cbmem_initialize_id_size(u32 id, u64 size);
void cbmem_initialize_empty(void);
void cbmem_initialize_empty_id_size(u32 id, u64 size);
/* Optional hook for platforms to initialize cbmem_top() value. When employed
* it's called a single time during boot at cbmem initialization/recovery
* time. */
void cbmem_top_init(void);
/* Return the top address for dynamic cbmem. The address returned needs to
* be consistent across romstage and ramstage, and it is required to be
* below 4GiB.