x86: fsp: Pass mrc cache to fsp_init() and save it to gd after fsp_init()
fsp_init() call has a parameter nvs_buf which is used by FSP as the MRC cache but currently is blindly set to NULL. Retreive the MRC cache from SPI flash and pass it to fsp_init() call. After the call, save FSP produced MRC cache to SPI flash too. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
4b9f6a669e
commit
ff1e18af9d
|
@ -7,6 +7,7 @@
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
|
#include <asm/mrccache.h>
|
||||||
#include <asm/post.h>
|
#include <asm/post.h>
|
||||||
#include <asm/processor.h>
|
#include <asm/processor.h>
|
||||||
#include <asm/fsp/fsp_support.h>
|
#include <asm/fsp/fsp_support.h>
|
||||||
|
@ -54,15 +55,42 @@ void board_final_cleanup(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static __maybe_unused void *fsp_prepare_mrc_cache(void)
|
||||||
|
{
|
||||||
|
struct mrc_data_container *cache;
|
||||||
|
struct mrc_region entry;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = mrccache_get_region(NULL, &entry);
|
||||||
|
if (ret)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
cache = mrccache_find_current(&entry);
|
||||||
|
if (!cache)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
debug("%s: mrc cache at %p, size %x checksum %04x\n", __func__,
|
||||||
|
cache->data, cache->data_size, cache->checksum);
|
||||||
|
|
||||||
|
return cache->data;
|
||||||
|
}
|
||||||
|
|
||||||
int x86_fsp_init(void)
|
int x86_fsp_init(void)
|
||||||
{
|
{
|
||||||
|
void *nvs;
|
||||||
|
|
||||||
if (!gd->arch.hob_list) {
|
if (!gd->arch.hob_list) {
|
||||||
|
#ifdef CONFIG_ENABLE_MRC_CACHE
|
||||||
|
nvs = fsp_prepare_mrc_cache();
|
||||||
|
#else
|
||||||
|
nvs = NULL;
|
||||||
|
#endif
|
||||||
/*
|
/*
|
||||||
* The first time we enter here, call fsp_init().
|
* The first time we enter here, call fsp_init().
|
||||||
* Note the execution does not return to this function,
|
* Note the execution does not return to this function,
|
||||||
* instead it jumps to fsp_continue().
|
* instead it jumps to fsp_continue().
|
||||||
*/
|
*/
|
||||||
fsp_init(CONFIG_FSP_TEMP_RAM_ADDR, BOOT_FULL_CONFIG, NULL);
|
fsp_init(CONFIG_FSP_TEMP_RAM_ADDR, BOOT_FULL_CONFIG, nvs);
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* The second time we enter here, adjust the size of malloc()
|
* The second time we enter here, adjust the size of malloc()
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <asm/fsp/fsp_support.h>
|
#include <asm/fsp/fsp_support.h>
|
||||||
#include <asm/e820.h>
|
#include <asm/e820.h>
|
||||||
|
#include <asm/mrccache.h>
|
||||||
#include <asm/post.h>
|
#include <asm/post.h>
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
@ -32,6 +33,11 @@ int dram_init(void)
|
||||||
gd->ram_size = ram_size;
|
gd->ram_size = ram_size;
|
||||||
post_code(POST_DRAM);
|
post_code(POST_DRAM);
|
||||||
|
|
||||||
|
#ifdef CONFIG_ENABLE_MRC_CACHE
|
||||||
|
gd->arch.mrc_output = fsp_get_nvs_data(gd->arch.hob_list,
|
||||||
|
&gd->arch.mrc_output_len);
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue