From 4d9b77287e583c89fea4bac9f1c264b01dcab981 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Thu, 19 Jun 2014 19:45:40 +0300 Subject: [PATCH] ACPI: Add acpi_is_wakeup_s3() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test explicitly for S3 resume. Also switch to use IS_ENABLED(). Change-Id: I17ea729f51f99ea8d6135f2c7a807623f1286238 Signed-off-by: Kyösti Mälkki Reviewed-on: http://review.coreboot.org/6070 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi --- src/arch/x86/boot/acpi.c | 5 +++++ src/arch/x86/include/arch/acpi.h | 14 +++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/arch/x86/boot/acpi.c b/src/arch/x86/boot/acpi.c index 6c1788d524..012c10127f 100644 --- a/src/arch/x86/boot/acpi.c +++ b/src/arch/x86/boot/acpi.c @@ -651,6 +651,11 @@ int acpi_is_wakeup(void) return (acpi_slp_type == 3 || acpi_slp_type == 2); } +int acpi_is_wakeup_s3(void) +{ + return (acpi_slp_type == 3); +} + void acpi_fail_wakeup(void) { if (acpi_slp_type == 3 || acpi_slp_type == 2) diff --git a/src/arch/x86/include/arch/acpi.h b/src/arch/x86/include/arch/acpi.h index a4cde20c73..362e1c0b7c 100644 --- a/src/arch/x86/include/arch/acpi.h +++ b/src/arch/x86/include/arch/acpi.h @@ -554,11 +554,12 @@ unsigned long acpi_fill_hest(acpi_hest_t *hest); void acpi_save_gnvs(u32 gnvs_address); -#if CONFIG_HAVE_ACPI_RESUME +#if IS_ENABLED(CONFIG_HAVE_ACPI_RESUME) /* 0 = S0, 1 = S1 ...*/ extern u8 acpi_slp_type; int acpi_is_wakeup(void); +int acpi_is_wakeup_s3(void); void acpi_fail_wakeup(void); void acpi_resume(void *wake_vec); void __attribute__((weak)) mainboard_suspend_resume(void); @@ -567,9 +568,7 @@ void *acpi_get_wakeup_rsdp(void); void acpi_jump_to_wakeup(void *wakeup_addr); int acpi_get_sleep_type(void); -#else /* CONFIG_HAVE_ACPI_RESUME */ -#define acpi_slp_type 0 -#endif /* CONFIG_HAVE_ACPI_RESUME */ +#endif /* IS_ENABLED(CONFIG_HAVE_ACPI_RESUME) */ /* northbridge/amd/amdfam10/amdfam10_acpi.c */ unsigned long acpi_add_ssdt_pstates(acpi_rsdp_t *rsdp, unsigned long current); @@ -580,7 +579,6 @@ void generate_cpu_entries(void); #else // CONFIG_GENERATE_ACPI_TABLES #define write_acpi_tables(start) (start) -#define acpi_slp_type 0 #endif /* CONFIG_GENERATE_ACPI_TABLES */ @@ -589,4 +587,10 @@ static inline int acpi_s3_resume_allowed(void) return IS_ENABLED(CONFIG_HAVE_ACPI_RESUME); } +#if !IS_ENABLED(CONFIG_HAVE_ACPI_RESUME) +#define acpi_slp_type 0 +static inline int acpi_is_wakeup(void) { return 0; } +static inline int acpi_is_wakeup_s3(void) { return 0; } +#endif + #endif /* __ASM_ACPI_H */