[coreboot-gerrit] New patch to review for coreboot: f6f00e4 falco: Enable EC controlled throttling

Stefan Reinauer (stefan.reinauer@coreboot.org) gerrit at coreboot.org
Tue Dec 3 23:55:56 CET 2013


Stefan Reinauer (stefan.reinauer at coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4416

-gerrit

commit f6f00e4da9187847ffe43d2f34176dfc0d648113
Author: Duncan Laurie <dlaurie at chromium.org>
Date:   Wed Jul 31 15:35:55 2013 -0700

    falco: Enable EC controlled throttling
    
    When the EC requests the host to throttle (for charging or thermal
    related reasons) the package power consumption will be limited.
    
    Right now this is set at 12W but that is somewhat arbitrary and may
    need tuning.
    
    1) define the THRT method in \_TZ scope for EC to call
    2) enable SCI events for throttle start and stop
    3) define the power limit at 12W and set it in NVS
    
    1) Enable CONFIG_ACPI_DEBUG=y in the kernel
    
    2) Enable the Debug object event in acpi module
    acpi.debug_layer=0x7f acpi.debug_level=0x2f
    
    3) Using EC console generate host event for throttle start
    > hostevent set 0x20000
    
    4) Check dmesg for throttle start events
    ACPI: Execute Method [\_SB_.PCI0.LPCB.EC0_._Q12] (Node ffff8801002c5988)
    [ACPI Debug]  String [0x12] "EC: THROTTLE START"
    [ACPI Debug]  String [0x10] "Enable PL1 Limit"
    
    5) Using EC console generate host event for throttle stop
    > hostevent set 0x40000
    
    6) Check dmesg for throttle stop events
    ACPI: Execute Method [\_SB_.PCI0.LPCB.EC0_._Q13] (Node ffff8801002c59b0)
    [ACPI Debug]  String [0x11] "EC: THROTTLE STOP"
    [ACPI Debug]  String [0x11] "Disable PL1 Limit"
    
    Change-Id: I39b53a5e8abc2892846bcd214a333fe204c6da9b
    Signed-off-by: Duncan Laurie <dlaurie at chromium.org>
    Reviewed-on: https://gerrit.chromium.org/gerrit/63989
    Reviewed-by: Aaron Durbin <adurbin at chromium.org>
---
 src/mainboard/google/falco/acpi/thermal.asl | 14 ++++++++++++++
 src/mainboard/google/falco/acpi_tables.c    |  1 +
 src/mainboard/google/falco/ec.h             |  2 ++
 src/mainboard/google/falco/thermal.h        |  3 +++
 4 files changed, 20 insertions(+)

diff --git a/src/mainboard/google/falco/acpi/thermal.asl b/src/mainboard/google/falco/acpi/thermal.asl
index adbc9ec..f9173b7 100644
--- a/src/mainboard/google/falco/acpi/thermal.asl
+++ b/src/mainboard/google/falco/acpi/thermal.asl
@@ -21,6 +21,20 @@
 
 Scope (\_TZ)
 {
+	// Handler for throttle requests on this platform
+	//  0 = Stop throttling
+	//  1 = Start throttling
+	Method (THRT, 1, Serialized)
+	{
+		If (LEqual (Arg0, 0)) {
+			/* Disable Power Limit */
+			\_SB.PCI0.MCHC.CTLD ()
+		} Else {
+			/* Enable Power Limit */
+			\_SB.PCI0.MCHC.CTLE (\F0PW)
+		}
+	}
+
 	ThermalZone (THRM)
 	{
 		Name (_TC1, 0x02)
diff --git a/src/mainboard/google/falco/acpi_tables.c b/src/mainboard/google/falco/acpi_tables.c
index 34c4407..ba084a1 100644
--- a/src/mainboard/google/falco/acpi_tables.c
+++ b/src/mainboard/google/falco/acpi_tables.c
@@ -48,6 +48,7 @@ static void acpi_update_thermal_table(global_nvs_t *gnvs)
 	gnvs->tcrt = CRITICAL_TEMPERATURE;
 	gnvs->tpsv = PASSIVE_TEMPERATURE;
 	gnvs->tmax = MAX_TEMPERATURE;
+	gnvs->f0pw = EC_THROTTLE_POWER_LIMIT;
 	gnvs->flvl = 1;
 }
 
diff --git a/src/mainboard/google/falco/ec.h b/src/mainboard/google/falco/ec.h
index 11d2453..c61d3da 100644
--- a/src/mainboard/google/falco/ec.h
+++ b/src/mainboard/google/falco/ec.h
@@ -35,6 +35,8 @@
 	 EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY)           |\
 	 EC_HOST_EVENT_MASK(EC_HOST_EVENT_THERMAL_THRESHOLD) |\
 	 EC_HOST_EVENT_MASK(EC_HOST_EVENT_THERMAL_OVERLOAD)  |\
+	 EC_HOST_EVENT_MASK(EC_HOST_EVENT_THROTTLE_START)    |\
+	 EC_HOST_EVENT_MASK(EC_HOST_EVENT_THROTTLE_STOP)     |\
 	 EC_HOST_EVENT_MASK(EC_HOST_EVENT_USB_CHARGER))
 
 #define MAINBOARD_EC_SMI_EVENTS \
diff --git a/src/mainboard/google/falco/thermal.h b/src/mainboard/google/falco/thermal.h
index cfda67d..9bd6ee6 100644
--- a/src/mainboard/google/falco/thermal.h
+++ b/src/mainboard/google/falco/thermal.h
@@ -22,6 +22,9 @@
 
 #define TEMPERATURE_SENSOR_ID		0	/* PECI */
 
+/* Power level to set when EC requests throttle */
+#define EC_THROTTLE_POWER_LIMIT		12	/* 12W */
+
 /* Temperature which OS will shutdown at */
 #define CRITICAL_TEMPERATURE		104
 



More information about the coreboot-gerrit mailing list