summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2016-11-29 21:22:42 -0600
committerAaron Durbin <adurbin@chromium.org>2016-12-01 08:16:27 +0100
commit6c191d8af41859dd94a01c6a868a9186d0120923 (patch)
tree245fbd677b74dd4dba8dd25c234313d2fc6771ae /src/lib
parent77e13997d33ce8011f711c2001f82113320511fa (diff)
romstage_handoff: add helper to determine resume status
Instead of having callers query the romstage handoff resume status by inspecting the object themselves add romstage_handoff_is_resume() so that the same information can be queried easily. Change-Id: I40f3769b7646bf296ee4bc323a9ab1d5e5691e21 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/17647 Tested-by: build bot (Jenkins) Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/prog_loaders.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/lib/prog_loaders.c b/src/lib/prog_loaders.c
index 3a6f2e26a5..58c1a8a7e0 100644
--- a/src/lib/prog_loaders.c
+++ b/src/lib/prog_loaders.c
@@ -85,19 +85,19 @@ static void ramstage_cache_invalid(void)
}
}
-static void run_ramstage_from_resume(struct romstage_handoff *handoff,
- struct prog *ramstage)
+static void run_ramstage_from_resume(struct prog *ramstage)
{
- if (handoff != NULL && handoff->s3_resume) {
- /* Load the cached ramstage to runtime location. */
- stage_cache_load_stage(STAGE_RAMSTAGE, ramstage);
-
- if (prog_entry(ramstage) != NULL) {
- printk(BIOS_DEBUG, "Jumping to image.\n");
- prog_run(ramstage);
- }
- ramstage_cache_invalid();
+ if (!romstage_handoff_is_resume())
+ return;
+
+ /* Load the cached ramstage to runtime location. */
+ stage_cache_load_stage(STAGE_RAMSTAGE, ramstage);
+
+ if (prog_entry(ramstage) != NULL) {
+ printk(BIOS_DEBUG, "Jumping to image.\n");
+ prog_run(ramstage);
}
+ ramstage_cache_invalid();
}
static int load_relocatable_ramstage(struct prog *ramstage)
@@ -136,8 +136,7 @@ void run_ramstage(void)
if (IS_ENABLED(CONFIG_ARCH_X86) &&
!IS_ENABLED(CONFIG_NO_STAGE_CACHE) &&
IS_ENABLED(CONFIG_EARLY_CBMEM_INIT))
- run_ramstage_from_resume(romstage_handoff_find_or_add(),
- &ramstage);
+ run_ramstage_from_resume(&ramstage);
if (prog_locate(&ramstage))
goto fail;