From 74cb3e78696031b191c452f12dbc278a17bffc12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Wed, 17 Feb 2021 17:33:17 +0200 Subject: [PATCH] soc/intel/broadwell: Use cbmem_recovery() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For consistency with other soc/intel add s3resume variable, this helps towards unified chipset_power_state. Change-Id: I34a123f9fc13bd86264317c7762bf6e9ffd0f842 Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/c/coreboot/+/50970 Tested-by: build bot (Jenkins) Reviewed-by: Angel Pons --- src/soc/intel/broadwell/romstage.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/soc/intel/broadwell/romstage.c b/src/soc/intel/broadwell/romstage.c index 12072a3a50..82ee73d825 100644 --- a/src/soc/intel/broadwell/romstage.c +++ b/src/soc/intel/broadwell/romstage.c @@ -41,7 +41,9 @@ void mainboard_romstage_entry(void) /* Get power state */ struct chipset_power_state *const power_state = fill_power_state(); - elog_boot_notify(power_state->prev_sleep_state == ACPI_S3); + int s3resume = power_state->prev_sleep_state == ACPI_S3; + + elog_boot_notify(s3resume); /* Print useful platform information */ report_platform_info(); @@ -73,11 +75,10 @@ void mainboard_romstage_entry(void) timestamp_add_now(TS_AFTER_INITRAM); - if (pei_data.boot_mode != ACPI_S3) { - cbmem_initialize_empty(); - } else if (cbmem_initialize()) { - printk(BIOS_DEBUG, "Failed to recover CBMEM in S3 resume.\n"); + int cbmem_was_initted = !cbmem_recovery(s3resume); + if (s3resume && !cbmem_was_initted) { /* Failed S3 resume, reset to come up cleanly */ + printk(BIOS_CRIT, "Failed to recover CBMEM in S3 resume.\n"); system_reset(); } @@ -85,7 +86,7 @@ void mainboard_romstage_entry(void) setup_sdram_meminfo(&pei_data); - romstage_handoff_init(power_state->prev_sleep_state == ACPI_S3); + romstage_handoff_init(s3resume); - mainboard_post_raminit(power_state->prev_sleep_state == ACPI_S3); + mainboard_post_raminit(s3resume); }