FMAP: Refactor CBMEM hook
Change-Id: Ib1257c57c64322c8c3dccdf1a754afb9b54ce7f8 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/63395 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
parent
f4b8538701
commit
845f232502
|
@ -273,7 +273,7 @@ ssize_t fmap_overwrite_area(const char *name, const void *buffer, size_t size)
|
|||
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 @@ static void fmap_register_cbmem_cache(int unused)
|
|||
* 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 @@ static void fmap_setup_cbmem_cache(int unused)
|
|||
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)
|
||||
|
|
Loading…
Reference in New Issue