Marshall Dawson has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/52772 )
Change subject: mb/google/guybrush: Add Thermal Zone support ......................................................................
mb/google/guybrush: Add Thermal Zone support
Duplicate the functionality from Zork. The file thermal.asl is a direct copy with the exception of removing an extra blank like and declaring PPKG as External.
BUG=b:186166365 TEST=Build Guybrush
Signed-off-by: Marshall Dawson marshalldawson3rd@gmail.com Change-Id: Ifbe0b7ed23f108e42abf7a9b13580b974fd61ec1 --- M src/mainboard/google/guybrush/dsdt.asl A src/mainboard/google/guybrush/variants/baseboard/include/baseboard/acpi/thermal.asl A src/mainboard/google/guybrush/variants/baseboard/include/baseboard/thermal.h A src/mainboard/google/guybrush/variants/guybrush/include/variant/acpi/thermal.asl A src/mainboard/google/guybrush/variants/guybrush/include/variant/thermal.h 5 files changed, 110 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/72/52772/1
diff --git a/src/mainboard/google/guybrush/dsdt.asl b/src/mainboard/google/guybrush/dsdt.asl index 9579ae3..2e8f609 100644 --- a/src/mainboard/google/guybrush/dsdt.asl +++ b/src/mainboard/google/guybrush/dsdt.asl @@ -23,4 +23,6 @@ /* ACPI code for EC functions */ #include <ec/google/chromeec/acpi/ec.asl> } + /* Thermal handler */ + #include <variant/acpi/thermal.asl> } diff --git a/src/mainboard/google/guybrush/variants/baseboard/include/baseboard/acpi/thermal.asl b/src/mainboard/google/guybrush/variants/baseboard/include/baseboard/acpi/thermal.asl new file mode 100644 index 0000000..f3900cc --- /dev/null +++ b/src/mainboard/google/guybrush/variants/baseboard/include/baseboard/acpi/thermal.asl @@ -0,0 +1,78 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +/* Generated by acpigen */ +External (\PPKG, MethodObj) + +#include <variant/thermal.h> + +/* Thermal Zone */ + +Scope (_TZ) +{ + ThermalZone (THRM) + { + /* Thermal constants for passive cooling */ + Name (_TC1, 0x02) + Name (_TC2, 0x05) + + /* Thermal zone polling frequency: 10 seconds */ + Name (_TZP, 100) + + /* Thermal sampling period for passive cooling: 2 seconds */ + Name (_TSP, 20) + + /* Convert from Degrees C to 1/10 Kelvin for ACPI */ + Method (CTOK, 1) { + /* 10th of Degrees C */ + Local0 = Arg0 * 10 + + /* Convert to Kelvin */ + Local0 += 2732 + + Return (Local0) + } + + /* Threshold for OS to shutdown */ + Method (_CRT, 0, Serialized) + { + Return (CTOK (\TCRT)) + } + + /* Threshold for passive cooling */ + Method (_PSV, 0, Serialized) + { + Return (CTOK (\TPSV)) + } + + /* Processors used for passive cooling */ + Method (_PSL, 0, Serialized) + { + Return (\PPKG ()) + } + + Method (_TMP, 0, Serialized) + { + /* Get temperature from EC in deci-kelvin */ + Local0 = _SB.PCI0.LPCB.EC0.TSRD (TMPS) + + /* Critical temperature in deci-kelvin */ + Local1 = CTOK (\TCRT) + + If (Local0 >= Local1) { + Debug = "CRITICAL TEMPERATURE" + Debug = Local0 + + /* Wait 1 second for EC to re-poll */ + Sleep (1000) + + /* Re-read temperature from EC */ + Local0 = _SB.PCI0.LPCB.EC0.TSRD (TMPS) + + Debug = "RE-READ TEMPERATURE" + Debug = Local0 + } + + Return (Local0) + } + } +} diff --git a/src/mainboard/google/guybrush/variants/baseboard/include/baseboard/thermal.h b/src/mainboard/google/guybrush/variants/baseboard/include/baseboard/thermal.h new file mode 100644 index 0000000..b3c951b --- /dev/null +++ b/src/mainboard/google/guybrush/variants/baseboard/include/baseboard/thermal.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef THERMAL_H +#define THERMAL_H + +/* + * Picasso Thermal Requirements + * TDP (W) 15 + * T die,max (°C) 105 + * T ctl,max 105 + * T die,lmt (default) 100 + * T ctl,lmt (default) 100 + */ + +/* Control TDP Settings */ +#define CTL_TDP_SENSOR_ID 2 /* EC TIN2 */ + +/* Temperature which OS will shutdown at */ +#define CRITICAL_TEMPERATURE 104 + +/* Temperature which OS will throttle CPU */ +#define PASSIVE_TEMPERATURE 95 + +#endif diff --git a/src/mainboard/google/guybrush/variants/guybrush/include/variant/acpi/thermal.asl b/src/mainboard/google/guybrush/variants/guybrush/include/variant/acpi/thermal.asl new file mode 100644 index 0000000..7a793d8 --- /dev/null +++ b/src/mainboard/google/guybrush/variants/guybrush/include/variant/acpi/thermal.asl @@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include <baseboard/acpi/thermal.asl> diff --git a/src/mainboard/google/guybrush/variants/guybrush/include/variant/thermal.h b/src/mainboard/google/guybrush/variants/guybrush/include/variant/thermal.h new file mode 100644 index 0000000..2af6479 --- /dev/null +++ b/src/mainboard/google/guybrush/variants/guybrush/include/variant/thermal.h @@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include <baseboard/thermal.h>