nb/intel/sandybridge/raminit: Add extended memtest

Run an regular or extended memtest on native raminit to make sure the DRAM
is usable. As it's very intrusive, the test is only run on cold-boot, but
not on S3 resume.

Change-Id: I31bcf8348c97b9461ee0aa792b3e53c0225d7d48
Signed-off-by: Patrick Rudolph <siro@das-labor.org>
This commit is contained in:
Patrick Rudolph 2017-10-27 12:56:00 +02:00 committed by Alexander Couzens
parent 8882b10681
commit 78d34c2a38
2 changed files with 22 additions and 2 deletions

View File

@ -142,6 +142,13 @@ config MRC_FILE
The path and filename of the file to use as System Agent
binary.
config RAMINIT_EXTENDED_MEMTEST
bool "Run extended memtest on raminit"
default n
help
Run extended memtest over all usable memory below 4GiB.
This will delay raminit training by several seconds.
endif # !USE_NATIVE_RAMINIT
endif

View File

@ -448,8 +448,21 @@ static void init_dram_ddr3(int mobile, int min_tck, int s3resume)
/* Zone config */
dram_zones(&ctrl, 0);
/* Non intrusive, fast ram check */
quick_ram_check();
if (!s3resume) {
/* TODO: use PAE */
/* Test memory below 4GiB */
const size_t stepk = IS_ENABLED(CONFIG_RAMINIT_EXTENDED_MEMTEST)
? (64 << 10) : (4 << 10);
const u32 tseg_base = pci_read_config32(PCI_DEV(0, 0, 0), 0xb8);
const size_t endk = (tseg_base & 0xfff00000) >> 10;
for (size_t basek = 0; basek < endk; basek += stepk)
ram_check(basek << 10, (basek + (1 << 10)) << 10);
} else {
/* Non intrusive, fast ram check */
quick_ram_check();
}
intel_early_me_status();
intel_early_me_init_done(ME_INIT_STATUS_SUCCESS);