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>
This commit is contained in:
Aaron Durbin
2016-11-29 17:43:04 -06:00
parent c1d72942f4
commit 77e13997d3
9 changed files with 35 additions and 60 deletions

View File

@@ -210,7 +210,6 @@ static int chipset_prev_sleep_state(struct chipset_power_state *ps)
/* Entry from the mainboard. */
void romstage_common(struct romstage_params *params)
{
struct romstage_handoff *handoff;
struct chipset_power_state *ps;
int prev_sleep_state;
@@ -232,11 +231,7 @@ void romstage_common(struct romstage_params *params)
timestamp_add_now(TS_AFTER_INITRAM);
handoff = romstage_handoff_find_or_add();
if (handoff != NULL)
handoff->s3_resume = (prev_sleep_state == ACPI_S3);
else
printk(BIOS_DEBUG, "Romstage handoff structure not added!\n");
romstage_handoff_init(prev_sleep_state == ACPI_S3);
if (IS_ENABLED(CONFIG_LPC_TPM)) {
init_tpm(prev_sleep_state == ACPI_S3);