[coreboot-gerrit] Patch set updated for coreboot: soc/intel/apollolake: Add function to read and clear GPE status

Duncan Laurie (dlaurie@chromium.org) gerrit at coreboot.org
Tue Sep 20 04:09:02 CEST 2016


Duncan Laurie (dlaurie at chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/16659

-gerrit

commit 3d43a7c111d00be246160a04023fe438ae0cac57
Author: Duncan Laurie <dlaurie at chromium.org>
Date:   Mon Sep 19 12:05:49 2016 -0700

    soc/intel/apollolake: Add function to read and clear GPE status
    
    Implement the generic acpi_get_gpe() function to read and clear
    the GPE status for a specific GPE.
    
    Tested by watching GPE status in a loop while generating interrupts
    manually from the EC console.
    
    BUG=chrome-os-partner:53336
    
    Change-Id: Id885e98d48c2133a868da19eca3360e2dfb82e84
    Signed-off-by: Duncan Laurie <dlaurie at chromium.org>
---
 src/soc/intel/apollolake/pmutil.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/src/soc/intel/apollolake/pmutil.c b/src/soc/intel/apollolake/pmutil.c
index 2aef18c..56bb33d 100644
--- a/src/soc/intel/apollolake/pmutil.c
+++ b/src/soc/intel/apollolake/pmutil.c
@@ -17,6 +17,7 @@
 
 #define __SIMPLE_DEVICE__
 
+#include <arch/acpi.h>
 #include <arch/io.h>
 #include <console/console.h>
 #include <cbmem.h>
@@ -301,6 +302,26 @@ uint32_t clear_gpe_status(void)
 	return print_gpe_sts(reset_gpe_status());
 }
 
+/* Read and clear GPE status (defined in arch/acpi.h) */
+int acpi_get_gpe(int gpe)
+{
+	int bank;
+	uint32_t mask, sts;
+
+	if (gpe < 0 || gpe > GPE0_DW3_31)
+		return -1;
+
+	bank = gpe / 32;
+	mask = 1 << (gpe % 32);
+
+	sts = inl(ACPI_PMIO_BASE + GPE0_STS(bank));
+	if (sts & mask) {
+		outl(mask, ACPI_PMIO_BASE + GPE0_STS(bank));
+		return 1;
+	}
+	return 0;
+}
+
 void clear_pmc_status(void)
 {
 	uint32_t prsts;



More information about the coreboot-gerrit mailing list