summaryrefslogtreecommitdiffstats
path: root/src/drivers/intel/fsp2_0/silicon_init.c
diff options
context:
space:
mode:
authorBrandon Breitenstein <brandon.breitenstein@intel.com>2016-11-17 12:23:04 -0800
committerMartin Roth <martinroth@google.com>2016-11-21 23:43:28 +0100
commitc6ec8dd1cb2303f7f7a71f0f494a6fc30b93dff4 (patch)
tree0fee838b6730bdb4faeaafcb9d6560f898e936d3 /src/drivers/intel/fsp2_0/silicon_init.c
parent5c325491ca2f791c46b2b3ca34f4ad1c750ac6f4 (diff)
downloadcoreboot-c6ec8dd1cb2303f7f7a71f0f494a6fc30b93dff4.tar.gz
coreboot-c6ec8dd1cb2303f7f7a71f0f494a6fc30b93dff4.tar.bz2
coreboot-c6ec8dd1cb2303f7f7a71f0f494a6fc30b93dff4.zip
fsp2_0: implement stage cache for silicon init
Stage cache will save ~20ms on S3 resume for apollolake platforms. Implementing the cache in ramstage to save silicon init and reload it on resume. This patch adds passing S3 status to silicon init in order to verify that the wake is from S3 and not for some other reason. This patch also includes changes needed for quark and skylake platforms that require fsp 2.0. BUG=chrome-os-partner:56941 BRANCH=none TEST=built for reef and tested boot and S3 resume path saving 20ms Change-Id: I99dc93c1d7a7d5cf8d8de1aa253a326ec67f05f6 Signed-off-by: Brandon Breitenstein <brandon.breitenstein@intel.com> Reviewed-on: https://review.coreboot.org/17460 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/drivers/intel/fsp2_0/silicon_init.c')
-rw-r--r--src/drivers/intel/fsp2_0/silicon_init.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/drivers/intel/fsp2_0/silicon_init.c b/src/drivers/intel/fsp2_0/silicon_init.c
index b911553c2f9f..e6464aa3df90 100644
--- a/src/drivers/intel/fsp2_0/silicon_init.c
+++ b/src/drivers/intel/fsp2_0/silicon_init.c
@@ -18,6 +18,7 @@
#include <fsp/api.h>
#include <fsp/util.h>
#include <program_loading.h>
+#include <stage_cache.h>
#include <string.h>
#include <timestamp.h>
@@ -61,7 +62,7 @@ static void do_silicon_init(struct fsp_header *hdr)
}
}
-void fsp_silicon_init(void)
+void fsp_silicon_init(bool s3wake)
{
struct fsp_header *hdr = &fsps_hdr;
struct cbfsf file_desc;
@@ -69,6 +70,17 @@ void fsp_silicon_init(void)
const char *name = CONFIG_FSP_S_CBFS;
void *dest;
size_t size;
+ struct prog fsps = PROG_INIT(PROG_REFCODE, name);
+
+ if (s3wake && !IS_ENABLED(CONFIG_NO_STAGE_CACHE)) {
+ printk(BIOS_DEBUG, "Loading FSPS from stage_cache\n");
+ stage_cache_load_stage(STAGE_REFCODE, &fsps);
+ if (fsp_validate_component(hdr, prog_rdev(&fsps)) != CB_SUCCESS)
+ die("On resume fsps header is invalid\n");
+ do_silicon_init(hdr);
+ return;
+ }
+
if (cbfs_boot_locate(&file_desc, name, NULL)) {
printk(BIOS_ERR, "Could not locate %s in CBFS\n", name);
@@ -98,6 +110,10 @@ void fsp_silicon_init(void)
if (fsp_validate_component(hdr, &rdev) != CB_SUCCESS)
die("Invalid FSPS header!\n");
+ prog_set_area(&fsps, dest, size);
+
+ stage_cache_add(STAGE_REFCODE, &fsps);
+
/* Signal that FSP component has been loaded. */
prog_segment_loaded(hdr->image_base, hdr->image_size, SEG_FINAL);