summaryrefslogtreecommitdiff
path: root/src/cpu
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2016-11-29 17:43:04 -0600
committerAaron Durbin <adurbin@chromium.org>2016-12-01 08:16:15 +0100
commit77e13997d33ce8011f711c2001f82113320511fa (patch)
treea600f2d0d9e21c52ed0551ed37458a87e2ff5afb /src/cpu
parentc1d72942f4b03b4d684e9b2183841d2d50ce50f0 (diff)
downloadcoreboot-77e13997d33ce8011f711c2001f82113320511fa.tar.xz
romstage_handoff: remove code duplication
The same pattern was being used throughout the code base for initializing the romstage handoff structure. Provide a helper function to initialize the structure with the S3 resume state then utilize it at all the existing call sites. Change-Id: I1e9d588ab6b9ace67757387dbb5963ae31ceb252 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/17646 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/cpu')
-rw-r--r--src/cpu/amd/car/post_cache_as_ram.c9
-rw-r--r--src/cpu/intel/haswell/romstage.c7
2 files changed, 2 insertions, 14 deletions
diff --git a/src/cpu/amd/car/post_cache_as_ram.c b/src/cpu/amd/car/post_cache_as_ram.c
index 296adc9869..88b86378bd 100644
--- a/src/cpu/amd/car/post_cache_as_ram.c
+++ b/src/cpu/amd/car/post_cache_as_ram.c
@@ -129,14 +129,7 @@ void post_cache_as_ram(void)
prepare_romstage_ramstack(s3resume);
- if (IS_ENABLED(CONFIG_EARLY_CBMEM_INIT)) {
- struct romstage_handoff *handoff;
- handoff = romstage_handoff_find_or_add();
- if (handoff != NULL)
- handoff->s3_resume = s3resume;
- else
- printk(BIOS_DEBUG, "Romstage handoff structure not added!\n");
- }
+ romstage_handoff_init(s3resume);
/* from here don't store more data in CAR */
if (family >= 0x1f && family <= 0x3f) {
diff --git a/src/cpu/intel/haswell/romstage.c b/src/cpu/intel/haswell/romstage.c
index 48920b3968..7eb115ca96 100644
--- a/src/cpu/intel/haswell/romstage.c
+++ b/src/cpu/intel/haswell/romstage.c
@@ -172,7 +172,6 @@ void romstage_common(const struct romstage_params *params)
{
int boot_mode;
int wake_from_s3;
- struct romstage_handoff *handoff;
timestamp_init(get_initial_timestamp());
timestamp_add_now(TS_START_ROMSTAGE);
@@ -245,11 +244,7 @@ void romstage_common(const struct romstage_params *params)
#endif
}
- handoff = romstage_handoff_find_or_add();
- if (handoff != NULL)
- handoff->s3_resume = wake_from_s3;
- else
- printk(BIOS_DEBUG, "Romstage handoff structure not added!\n");
+ romstage_handoff_init(wake_from_s3);
post_code(0x3f);
if (IS_ENABLED(CONFIG_LPC_TPM)) {