summaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2015-01-08 20:03:18 +0200
committerKyösti Mälkki <kyosti.malkki@gmail.com>2015-03-10 23:42:10 +0100
commit9e94dbfcd089db31b2201381f9d83a89cdea86b9 (patch)
treef73b282c8e37e29966f6a86419ceead0f6e5f39a /src/arch
parenta63719407fc5fad17eebe0e5086511a511466353 (diff)
downloadcoreboot-9e94dbfcd089db31b2201381f9d83a89cdea86b9.tar.xz
ACPI: Get S3 resume state from romstage_handoff
There is nothing platform specific in retrieving S3 resume state from romstage_handoff structure. Boards without EARLY_CBMEM_INIT update acpi_slp_type from ACPI power-management block or scratchpad registers. Change-Id: Ifc3755f891a0810473b3216c1fec8e45908fc1ab Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: http://review.coreboot.org/8188 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@google.com>
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/x86/boot/acpi.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/arch/x86/boot/acpi.c b/src/arch/x86/boot/acpi.c
index 621df2f72f..fb902dbfa2 100644
--- a/src/arch/x86/boot/acpi.c
+++ b/src/arch/x86/boot/acpi.c
@@ -36,6 +36,7 @@
#if CONFIG_COLLECT_TIMESTAMPS
#include <timestamp.h>
#endif
+#include <romstage_handoff.h>
/* FIXME: Kconfig doesn't support overridable defaults :-( */
#ifndef CONFIG_HPET_MIN_TICKS
@@ -857,10 +858,25 @@ void acpi_resume(void *wake_vec)
/* This is filled with acpi_is_wakeup() call early in ramstage. */
int acpi_slp_type = -1;
-int __attribute__((weak)) acpi_get_sleep_type(void)
+#if IS_ENABLED(CONFIG_EARLY_CBMEM_INIT)
+int acpi_get_sleep_type(void)
{
- return 0;
+ struct romstage_handoff *handoff;
+
+ handoff = cbmem_find(CBMEM_ID_ROMSTAGE_INFO);
+
+ if (handoff == NULL) {
+ printk(BIOS_DEBUG, "Unknown boot method, assuming normal.\n");
+ return 0;
+ } else if (handoff->s3_resume) {
+ printk(BIOS_DEBUG, "S3 Resume.\n");
+ return 3;
+ } else {
+ printk(BIOS_DEBUG, "Normal boot.\n");
+ return 0;
+ }
}
+#endif
static void acpi_handoff_wakeup(void)
{