Kyösti Mälkki has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/63395 )
Change subject: [WIP] FMAP: Refactor CBMEM hook ......................................................................
[WIP] FMAP: Refactor CBMEM hook
Change-Id: Ib1257c57c64322c8c3dccdf1a754afb9b54ce7f8 Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- M src/lib/fmap.c 1 file changed, 11 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/95/63395/1
diff --git a/src/lib/fmap.c b/src/lib/fmap.c index 2511255..4d197db 100644 --- a/src/lib/fmap.c +++ b/src/lib/fmap.c @@ -273,7 +273,7 @@ return rdev_writeat(&rdev, buffer, 0, size); }
-static void fmap_register_cbmem_cache(int unused) +static void fmap_register_cbmem_cache(void) { const struct cbmem_entry *e;
@@ -290,7 +290,7 @@ * The main reason to copy the FMAP into CBMEM is to make it available to the * OS on every architecture. As side effect use the CBMEM copy as cache. */ -static void fmap_setup_cbmem_cache(int unused) +static void fmap_add_cbmem_cache(void) { struct region_device fmrd;
@@ -311,11 +311,17 @@ cbmem_entry_remove(cbmem_entry_find(CBMEM_ID_FMAP)); return; } +} + +static void fmap_setup_cbmem_cache(int unused) +{ + if (ENV_ROMSTAGE) + fmap_add_cbmem_cache();
/* Finally advertise the cache for the current stage */ - fmap_register_cbmem_cache(unused); + fmap_register_cbmem_cache(); }
ROMSTAGE_CBMEM_INIT_HOOK(fmap_setup_cbmem_cache) -RAMSTAGE_CBMEM_INIT_HOOK(fmap_register_cbmem_cache) -POSTCAR_CBMEM_INIT_HOOK(fmap_register_cbmem_cache) +RAMSTAGE_CBMEM_INIT_HOOK(fmap_setup_cbmem_cache) +POSTCAR_CBMEM_INIT_HOOK(fmap_setup_cbmem_cache)