From 1eca1d4e15c254b1f63336b991bf1a81b70712c0 Mon Sep 17 00:00:00 2001 From: Duncan Laurie Date: Sat, 12 Oct 2013 11:50:05 +0800 Subject: samus: Change thermal behavior to match other haswell platforms Change-Id: Ia835f16b156949f1841210c4a469223d5df28a54 Signed-off-by: Duncan Laurie Reviewed-on: https://chromium-review.googlesource.com/174087 Reviewed-by: Aaron Durbin (cherry picked from commit 8e51d1d74cdcadde9cbf10e8321d601b099c46bc) Signed-off-by: Isaac Christensen Reviewed-on: http://review.coreboot.org/6825 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- src/mainboard/google/samus/acpi/thermal.asl | 100 +++++++++------------------- src/mainboard/google/samus/acpi_tables.c | 10 +-- src/mainboard/google/samus/thermal.h | 18 ++--- 3 files changed, 40 insertions(+), 88 deletions(-) (limited to 'src/mainboard/google/samus') diff --git a/src/mainboard/google/samus/acpi/thermal.asl b/src/mainboard/google/samus/acpi/thermal.asl index b61baeb261..a622d6cba6 100644 --- a/src/mainboard/google/samus/acpi/thermal.asl +++ b/src/mainboard/google/samus/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) @@ -61,7 +75,7 @@ Scope (\_TZ) Return (\PPKG ()) } - Method (_TMP, 0, Serialized) + Method (TCHK, 0, Serialized) { // Get Temperature from TIN# set in NVS Store (\_SB.PCI0.LPCB.EC0.TINS (TMPS), Local0) @@ -94,79 +108,29 @@ Scope (\_TZ) Return (Local0) } - /* CTDP Down */ - Method (_AC0) { - If (LLessEqual (\FLVL, 0)) { - Return (CTOK (\F0OF)) - } Else { - Return (CTOK (\F0ON)) - } - } + Method (_TMP, 0, Serialized) + { + // Get temperature from EC in deci-kelvin + Store (TCHK (), Local0) - /* CTDP Nominal */ - Method (_AC1) { - If (LLessEqual (\FLVL, 1)) { - Return (CTOK (\F1OF)) - } Else { - Return (CTOK (\F1ON)) - } - } + // Critical temperature in deci-kelvin + Store (CTOK (\TCRT), Local1) - Name (_AL0, Package () { TDP0 }) - Name (_AL1, Package () { TDP1 }) + If (LGreaterEqual (Local0, Local1)) { + Store ("CRITICAL TEMPERATURE", Debug) + Store (Local0, Debug) - PowerResource (TNP0, 0, 0) - { - Method (_STA) { - If (LLessEqual (\FLVL, 0)) { - Return (One) - } Else { - Return (Zero) - } - } - Method (_ON) { - Store (0, \FLVL) - \_SB.PCI0.MCHC.STND () - Notify (\_TZ.THRM, 0x81) - } - Method (_OFF) { - Store (1, \FLVL) - \_SB.PCI0.MCHC.STDN () - Notify (\_TZ.THRM, 0x81) - } - } + // Wait 1 second for EC to re-poll + Sleep (1000) - PowerResource (TNP1, 0, 0) - { - Method (_STA) { - If (LLessEqual (\FLVL, 1)) { - Return (One) - } Else { - Return (Zero) - } - } - Method (_ON) { - Store (1, \FLVL) - Notify (\_TZ.THRM, 0x81) - } - Method (_OFF) { - Store (1, \FLVL) - Notify (\_TZ.THRM, 0x81) - } - } + // Re-read temperature from EC + Store (TCHK (), Local0) - Device (TDP0) - { - Name (_HID, EISAID ("PNP0C0B")) - Name (_UID, 0) - Name (_PR0, Package () { TNP0 }) - } + Store ("RE-READ TEMPERATURE", Debug) + Store (Local0, Debug) + } - Device (TDP1) - { - Name (_HID, EISAID ("PNP0C0B")) - Name (_UID, 1) - Name (_PR0, Package () { TNP1 }) + Return (Local0) } } } diff --git a/src/mainboard/google/samus/acpi_tables.c b/src/mainboard/google/samus/acpi_tables.c index a96cb2437d..dd73d2986d 100644 --- a/src/mainboard/google/samus/acpi_tables.c +++ b/src/mainboard/google/samus/acpi_tables.c @@ -44,17 +44,11 @@ unsigned long acpi_create_slic(unsigned long current); static void acpi_update_thermal_table(global_nvs_t *gnvs) { - gnvs->tmps = CTDP_SENSOR_ID; - - gnvs->f1of = CTDP_NOMINAL_THRESHOLD_OFF; - gnvs->f1on = CTDP_NOMINAL_THRESHOLD_ON; - - gnvs->f0of = CTDP_DOWN_THRESHOLD_OFF; - gnvs->f0on = CTDP_DOWN_THRESHOLD_ON; - + gnvs->tmps = TEMPERATURE_SENSOR_ID; 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/samus/thermal.h b/src/mainboard/google/samus/thermal.h index 75f247c1ed..89069a62f2 100644 --- a/src/mainboard/google/samus/thermal.h +++ b/src/mainboard/google/samus/thermal.h @@ -20,24 +20,18 @@ #ifndef THERMAL_H #define THERMAL_H -/* Config TDP Sensor ID */ -#define CTDP_SENSOR_ID 0 /* PECI */ +#define TEMPERATURE_SENSOR_ID 0 /* PECI */ -/* Config TDP Nominal */ -#define CTDP_NOMINAL_THRESHOLD_OFF 0 -#define CTDP_NOMINAL_THRESHOLD_ON 0 - -/* Config TDP Down */ -#define CTDP_DOWN_THRESHOLD_OFF 80 -#define CTDP_DOWN_THRESHOLD_ON 90 +/* 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 +#define CRITICAL_TEMPERATURE 99 /* Temperature which OS will throttle CPU */ -#define PASSIVE_TEMPERATURE 100 +#define PASSIVE_TEMPERATURE 95 /* Tj_max value for calculating PECI CPU temperature */ -#define MAX_TEMPERATURE 105 +#define MAX_TEMPERATURE 100 #endif -- cgit v1.2.3