[coreboot-gerrit] New patch to review for coreboot: arch/x86: provide common ACPI_Sx constants

Aaron Durbin (adurbin@chromium.org) gerrit at coreboot.org
Thu Jul 14 06:31:36 CEST 2016


Aaron Durbin (adurbin at chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15663

-gerrit

commit ba9466922494e115fa698e5f826c4a38084eb227
Author: Aaron Durbin <adurbin at chromium.org>
Date:   Wed Jul 13 12:08:33 2016 -0500

    arch/x86: provide common ACPI_Sx constants
    
    Instead of open coding the literal values provide more
    semantic symbol to be used. This will allow for aligning
    chipset code with this as well to reduce duplication.
    
    BUG=chrome-os-partner:54977
    
    Change-Id: I022bf1eb258f7244f2e5aa2fb72b7b82e1900a5c
    Signed-off-by: Aaron Durbin <adurbin at chromium.org>
---
 src/arch/x86/acpi_s3.c           | 16 ++++++++--------
 src/arch/x86/include/arch/acpi.h | 15 ++++++++++++---
 2 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/src/arch/x86/acpi_s3.c b/src/arch/x86/acpi_s3.c
index 7855a2f..c327cbd 100644
--- a/src/arch/x86/acpi_s3.c
+++ b/src/arch/x86/acpi_s3.c
@@ -36,13 +36,13 @@ int acpi_get_sleep_type(void)
 
 	if (handoff == NULL) {
 		printk(BIOS_DEBUG, "Unknown boot method, assuming normal.\n");
-		return 0;
+		return ACPI_S0;
 	} else if (handoff->s3_resume) {
 		printk(BIOS_DEBUG, "S3 Resume.\n");
-		return 3;
+		return ACPI_S3;
 	} else {
 		printk(BIOS_DEBUG, "Normal boot.\n");
-		return 0;
+		return ACPI_S0;
 	}
 }
 #endif
@@ -57,25 +57,25 @@ int acpi_is_wakeup(void)
 {
 	acpi_handoff_wakeup();
 	/* Both resume from S2 and resume from S3 restart at CPU reset */
-	return (acpi_slp_type == 3 || acpi_slp_type == 2);
+	return (acpi_slp_type == ACPI_S3 || acpi_slp_type == ACPI_S2);
 }
 
 int acpi_is_wakeup_s3(void)
 {
 	acpi_handoff_wakeup();
-	return (acpi_slp_type == 3);
+	return (acpi_slp_type == ACPI_S3);
 }
 
 int acpi_is_wakeup_s4(void)
 {
 	acpi_handoff_wakeup();
-	return (acpi_slp_type == 4);
+	return (acpi_slp_type == ACPI_S4);
 }
 
 void acpi_fail_wakeup(void)
 {
-	if (acpi_slp_type == 3 || acpi_slp_type == 2)
-		acpi_slp_type = 0;
+	if (acpi_slp_type == ACPI_S3 || acpi_slp_type == ACPI_S2)
+		acpi_slp_type = ACPI_S0;
 }
 #endif /* ENV_RAMSTAGE */
 
diff --git a/src/arch/x86/include/arch/acpi.h b/src/arch/x86/include/arch/acpi.h
index 7434000..03cd709 100644
--- a/src/arch/x86/include/arch/acpi.h
+++ b/src/arch/x86/include/arch/acpi.h
@@ -615,7 +615,16 @@ void acpi_prepare_resume_backup(void);
 void mainboard_suspend_resume(void);
 void *acpi_find_wakeup_vector(void);
 
-/* Returns 0 = S0, 1 = S1 ... */
+enum {
+	ACPI_S0,
+	ACPI_S1,
+	ACPI_S2,
+	ACPI_S3,
+	ACPI_S4,
+	ACPI_S5,
+};
+
+/* Returns ACPI_Sx values. */
 int acpi_get_sleep_type(void);
 
 static inline int acpi_s3_resume_allowed(void)
@@ -629,7 +638,7 @@ extern int acpi_slp_type;
 #ifdef __PRE_RAM__
 static inline int acpi_is_wakeup_s3(void)
 {
-	return (acpi_get_sleep_type() == 3);
+	return (acpi_get_sleep_type() == ACPI_S3);
 }
 #else
 int acpi_is_wakeup(void);
@@ -639,7 +648,7 @@ int acpi_is_wakeup_s4(void);
 void acpi_prepare_for_resume(void);
 
 #else
-#define acpi_slp_type 0
+#define acpi_slp_type ACPI_S0
 static inline int acpi_is_wakeup(void) { return 0; }
 static inline int acpi_is_wakeup_s3(void) { return 0; }
 static inline int acpi_is_wakeup_s4(void) { return 0; }



More information about the coreboot-gerrit mailing list