[coreboot-gerrit] Patch set updated for coreboot: acpigen: Add functions to generate _STA() and _PRW()

Duncan Laurie (dlaurie@google.com) gerrit at coreboot.org
Mon May 16 19:55:14 CEST 2016


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

-gerrit

commit ada306834a2aa700f3b180339931726ecc0afaf5
Author: Duncan Laurie <dlaurie at chromium.org>
Date:   Mon May 9 11:08:46 2016 -0700

    acpigen: Add functions to generate _STA() and _PRW()
    
    Add helper functions for generating some common objects:
    
    acpigen_write_STA(status) will generate a status method that will
    indicate the device status as provided:
      Method (_STA) { Return (status) }
    
    Full status byte configuration is possible and macros are provided for
    the common status bytes used for generated code:
    ACPI_STATUS_DEVICE_ALL_OFF = 0x0
    ACPI_STATUS_DEVICE_ALL_ON  = 0xF
    
    acpigen_write_PRW() will generate a Power Resoruce for Wake that describes
    the GPE that will wake a particular device:
      Name (_PRW, Package (2) { wake, level }
    
    Change-Id: I10277f0f3820d272d3975abf34b9a8de577782e5
    Signed-off-by: Duncan Laurie <dlaurie at chromium.org>
---
 src/arch/x86/acpigen.c              | 23 +++++++++++++++++++++++
 src/arch/x86/include/arch/acpigen.h | 14 ++++++++++++++
 2 files changed, 37 insertions(+)

diff --git a/src/arch/x86/acpigen.c b/src/arch/x86/acpigen.c
index e051c82..74efbb0 100644
--- a/src/arch/x86/acpigen.c
+++ b/src/arch/x86/acpigen.c
@@ -449,6 +449,17 @@ void acpigen_write_device(const char *name)
 	acpigen_emit_namestring(name);
 }
 
+void acpigen_write_STA(uint8_t status)
+{
+	/*
+	 * Method (_STA, 0, NotSerialized) { Return (status) }
+	 */
+	acpigen_write_method("_STA", 0);
+	acpigen_emit_byte(0xa4);
+	acpigen_write_byte(status);
+	acpigen_pop_len();
+}
+
 /*
  * Generates a func with max supported P-states.
  */
@@ -503,6 +514,18 @@ void acpigen_write_TPC(const char *gnvs_tpc_limit)
 	acpigen_pop_len();
 }
 
+void acpigen_write_PRW(u32 wake, u32 level)
+{
+	/*
+	 * Name (_PRW, Package () { wake, level }
+	 */
+	acpigen_write_name("_PRW");
+	acpigen_write_package(2);
+	acpigen_write_integer(wake);
+	acpigen_write_integer(level);
+	acpigen_pop_len();
+}
+
 void acpigen_write_PSS_package(u32 coreFreq, u32 power, u32 transLat,
 			      u32 busmLat, u32 control, u32 status)
 {
diff --git a/src/arch/x86/include/arch/acpigen.h b/src/arch/x86/include/arch/acpigen.h
index 2555164..e968778 100644
--- a/src/arch/x86/include/arch/acpigen.h
+++ b/src/arch/x86/include/arch/acpigen.h
@@ -22,6 +22,18 @@
 #include <stdint.h>
 #include <arch/acpi.h>
 
+/* Values that can be returned for ACPI Device _STA method */
+#define ACPI_STATUS_DEVICE_PRESENT	(1 << 0)
+#define ACPI_STATUS_DEVICE_ENABLED	(1 << 1)
+#define ACPI_STATUS_DEVICE_SHOW_IN_UI	(1 << 2)
+#define ACPI_STATUS_DEVICE_STATE_OK	(1 << 3)
+
+#define ACPI_STATUS_DEVICE_ALL_OFF	0
+#define ACPI_STATUS_DEVICE_ALL_ON	(ACPI_STATUS_DEVICE_PRESENT |\
+					 ACPI_STATUS_DEVICE_ENABLED |\
+					 ACPI_STATUS_DEVICE_SHOW_IN_UI |\
+					 ACPI_STATUS_DEVICE_STATE_OK)
+
 void acpigen_write_len_f(void);
 void acpigen_pop_len(void);
 void acpigen_set_current(char *curr);
@@ -58,6 +70,8 @@ void acpigen_write_PPC(u8 nr);
 void acpigen_write_PPC_NVS(void);
 void acpigen_write_empty_PCT(void);
 void acpigen_write_empty_PTC(void);
+void acpigen_write_PRW(u32 wake, u32 level);
+void acpigen_write_STA(uint8_t status);
 void acpigen_write_TPC(const char *gnvs_tpc_limit);
 void acpigen_write_PSS_package(u32 coreFreq, u32 power, u32 transLat, u32 busmLat,
 			u32 control, u32 status);



More information about the coreboot-gerrit mailing list