amd/stoneyridge: Keep SPI flash cacheable during POST

A side effect of using the common MTRR assignment code is the flash
device loses its WP setting and is no longer cacheable.  After MTRR
setup, reenable the setting for the duration of POST.

TEST=Run on Kahlee and inspect MTRRs prior to AmdInitLate()
BUG=b:70536683

Change-Id: Ib4924e96e2876e1e92121bb52d1931ead723d730
Signed-off-by: Marshall Dawson <marshalldawson3rd@gmail.com>
Reviewed-on: https://review.coreboot.org/23205
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Richard Spiegel <richard.spiegel@silverbackltd.com>
This commit is contained in:
Marshall Dawson 2018-01-10 11:35:24 -07:00
parent 533ea7adb5
commit 0814b12228
1 changed files with 5 additions and 0 deletions

View File

@ -24,6 +24,7 @@
#include <soc/cpu.h> #include <soc/cpu.h>
#include <soc/northbridge.h> #include <soc/northbridge.h>
#include <soc/smi.h> #include <soc/smi.h>
#include <soc/iomap.h>
#include <console/console.h> #include <console/console.h>
/* /*
@ -47,6 +48,10 @@ static struct smm_relocation_attrs relo_attrs;
static void pre_mp_init(void) static void pre_mp_init(void)
{ {
x86_setup_mtrrs_with_detect(); x86_setup_mtrrs_with_detect();
/* The flash is now no longer cacheable. Reset to WP for performance. */
mtrr_use_temp_range(FLASH_BASE_ADDR, CONFIG_ROM_SIZE, MTRR_TYPE_WRPROT);
x86_mtrr_check(); x86_mtrr_check();
} }