lib/fmap: Disable pre-RAM cache for FSP 1.0

Due to the way CAR teardown is handled in FSP 1.0, the results of
car_get_var_ptr() aren't always reliable, which can break things when
running with FMAP cache. It might be possible to fix this but would make
the code rather complicated, so let's just disable the feature on these
platforms and hope they die out soon.

Also allow this option to be used by platforms that don't have space for
the cache and want to save a little more code.

Change-Id: I7ffb1b8b08a7ca3fe8d53dc827e2c8521da064c7
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/36937
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
Julius Werner 2019-11-18 13:01:06 -08:00 committed by Patrick Georgi
parent ceb7e68c48
commit 7fc928656e
5 changed files with 19 additions and 4 deletions

View File

@ -58,7 +58,10 @@
#endif #endif
TIMESTAMP(., 0x200) TIMESTAMP(., 0x200)
#if !CONFIG(NO_FMAP_CACHE)
FMAP_CACHE(., FMAP_SIZE) FMAP_CACHE(., FMAP_SIZE)
#endif
_car_ehci_dbg_info = .; _car_ehci_dbg_info = .;
/* Reserve sizeof(struct ehci_dbg_info). */ /* Reserve sizeof(struct ehci_dbg_info). */

View File

@ -15,6 +15,7 @@ config PLATFORM_USES_FSP1_0
bool bool
default n default n
select CAR_GLOBAL_MIGRATION select CAR_GLOBAL_MIGRATION
select NO_FMAP_CACHE # doesn't work with CAR_GLOBAL restrictions
help help
Selected for Intel processors/platform combinations that use the Selected for Intel processors/platform combinations that use the
Intel Firmware Support Package (FSP) 1.0 for initialization. Intel Firmware Support Package (FSP) 1.0 for initialization.

View File

@ -68,3 +68,10 @@ config HWBASE_DIRECT_PCIDEV
def_bool y def_bool y
endif endif
config NO_FMAP_CACHE
bool
help
If your platform really doesn't want to use an FMAP cache (e.g. due to
space constraints), you can select this to disable warnings and save
a bit more code.

View File

@ -60,6 +60,9 @@ static void report(const struct fmap *fmap)
static void setup_preram_cache(struct mem_region_device *cache_mrdev) static void setup_preram_cache(struct mem_region_device *cache_mrdev)
{ {
if (CONFIG(NO_FMAP_CACHE))
return;
if (!ENV_ROMSTAGE_OR_BEFORE) { if (!ENV_ROMSTAGE_OR_BEFORE) {
/* We get here if ramstage makes an FMAP access before calling /* We get here if ramstage makes an FMAP access before calling
cbmem_initialize(). We should avoid letting it come to that, cbmem_initialize(). We should avoid letting it come to that,
@ -70,10 +73,10 @@ static void setup_preram_cache(struct mem_region_device *cache_mrdev)
} }
if (REGION_SIZE(fmap_cache) == 0) { if (REGION_SIZE(fmap_cache) == 0) {
/* If you see this you really want to add an FMAP_CACHE to your /* If you see this you should add FMAP_CACHE() to your memlayout
memlayout, unless you absolutely can't affort the 2K. */ (or select NO_FMAP_CACHE if you can't afford the 2K). */
print_once(BIOS_NOTICE, print_once(BIOS_ERR,
"NOTE: Running without FMAP_CACHE, should add it!\n"); "ERROR: FMAP_CACHE enabled but no region provided!\n");
return; return;
} }

View File

@ -29,6 +29,7 @@ config SOC_ROCKCHIP_RK3288
select MAINBOARD_FORCE_NATIVE_VGA_INIT select MAINBOARD_FORCE_NATIVE_VGA_INIT
select HAVE_LINEAR_FRAMEBUFFER select HAVE_LINEAR_FRAMEBUFFER
select NO_BOOTBLOCK_CONSOLE select NO_BOOTBLOCK_CONSOLE
select NO_FMAP_CACHE
if SOC_ROCKCHIP_RK3288 if SOC_ROCKCHIP_RK3288