summaryrefslogtreecommitdiff
path: root/src/drivers/intel/fsp1_1
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2021-01-09 13:30:57 +0200
committerKyösti Mälkki <kyosti.malkki@gmail.com>2021-01-29 10:53:33 +0000
commite0165fbc944521171cd2776be4d3f655712079d2 (patch)
treeda303ac99860420f001a843c98e547576bc4cfc8 /src/drivers/intel/fsp1_1
parentcdaddde0672643a2457b163ea1b286a4ea77c0f1 (diff)
stage_cache: Add resume_from_stage_cache()
Factor out the condition when an attempt to load stage from cache can be tried. Change-Id: I936f07bed6fc82f46118d217f1fd233e2e041405 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/50000 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'src/drivers/intel/fsp1_1')
-rw-r--r--src/drivers/intel/fsp1_1/ramstage.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/src/drivers/intel/fsp1_1/ramstage.c b/src/drivers/intel/fsp1_1/ramstage.c
index 45faa5507e..ddfc3c7e54 100644
--- a/src/drivers/intel/fsp1_1/ramstage.c
+++ b/src/drivers/intel/fsp1_1/ramstage.c
@@ -143,21 +143,6 @@ void fsp_run_silicon_init(FSP_INFO_HEADER *fsp_info_header, int is_s3_wakeup)
soc_after_silicon_init();
}
-static void fsp_cache_save(struct prog *fsp)
-{
- if (CONFIG(NO_STAGE_CACHE))
- return;
-
- printk(BIOS_DEBUG, "FSP: Saving binary in cache\n");
-
- if (prog_entry(fsp) == NULL) {
- printk(BIOS_ERR, "ERROR: No FSP to save in cache.\n");
- return;
- }
-
- stage_cache_add(STAGE_REFCODE, fsp);
-}
-
static int fsp_find_and_relocate(struct prog *fsp)
{
if (prog_locate(fsp)) {
@@ -176,14 +161,14 @@ static int fsp_find_and_relocate(struct prog *fsp)
static void fsp_load(void)
{
struct prog fsp = PROG_INIT(PROG_REFCODE, "fsp.bin");
- int is_s3_wakeup = acpi_is_wakeup_s3();
- if (is_s3_wakeup && !CONFIG(NO_STAGE_CACHE)) {
- printk(BIOS_DEBUG, "FSP: Loading binary from cache\n");
+ if (resume_from_stage_cache()) {
stage_cache_load_stage(STAGE_REFCODE, &fsp);
} else {
fsp_find_and_relocate(&fsp);
- fsp_cache_save(&fsp);
+
+ if (prog_entry(&fsp))
+ stage_cache_add(STAGE_REFCODE, &fsp);
}
/* FSP_INFO_HEADER is set as the program entry. */