arch/x86: Introduce postcar_frame_add_romcache()

Provide a common implementation to add an MTRR entry for memory-
mapped boot ROMs.

Change-Id: I9fabc6b87fb36dc3d970805eb804cd950b8849d4
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/26577
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Nico Huber 2018-05-27 14:32:27 +02:00 committed by Patrick Georgi
parent b5211ef2e7
commit 36ec3e9ba1
2 changed files with 12 additions and 0 deletions

View File

@ -282,6 +282,11 @@ void postcar_frame_init_lowmem(struct postcar_frame *pcf);
void postcar_frame_add_mtrr(struct postcar_frame *pcf,
uintptr_t addr, size_t size, int type);
/*
* Add variable MTRR covering the memory-mapped ROM with given MTRR type.
*/
void postcar_frame_add_romcache(struct postcar_frame *pcf, int type);
/*
* Push used MTRR and Max MTRRs on to the stack
* and return pointer to stack top.

View File

@ -113,6 +113,13 @@ void postcar_frame_add_mtrr(struct postcar_frame *pcf,
}
}
void postcar_frame_add_romcache(struct postcar_frame *pcf, int type)
{
if (!IS_ENABLED(CONFIG_BOOT_DEVICE_MEMORY_MAPPED))
return;
postcar_frame_add_mtrr(pcf, CACHE_ROM_BASE, CACHE_ROM_SIZE, type);
}
void *postcar_commit_mtrrs(struct postcar_frame *pcf)
{
/*