From 36ec3e9ba1b89416d87426eabe496d67dbb2cdbf Mon Sep 17 00:00:00 2001 From: Nico Huber Date: Sun, 27 May 2018 14:32:27 +0200 Subject: [PATCH] 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 Reviewed-on: https://review.coreboot.org/26577 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- src/arch/x86/include/arch/cpu.h | 5 +++++ src/arch/x86/postcar_loader.c | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/src/arch/x86/include/arch/cpu.h b/src/arch/x86/include/arch/cpu.h index 5d44aaeb6c..5f11c9dc0c 100644 --- a/src/arch/x86/include/arch/cpu.h +++ b/src/arch/x86/include/arch/cpu.h @@ -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. diff --git a/src/arch/x86/postcar_loader.c b/src/arch/x86/postcar_loader.c index 11f048de7a..1877108ed0 100644 --- a/src/arch/x86/postcar_loader.c +++ b/src/arch/x86/postcar_loader.c @@ -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) { /*