xref: /aosp_15_r20/external/coreboot/src/mainboard/google/zork/variants/baseboard/include/baseboard/acpi/thermal.asl (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2
3#include <variant/thermal.h>
4
5External (\PPKG, MethodObj)
6
7/* Thermal Zone */
8
9Scope (\_TZ)
10{
11	ThermalZone (THRM)
12	{
13		/* Thermal constants for passive cooling */
14		Name (_TC1, 0x02)
15		Name (_TC2, 0x05)
16
17		/* Thermal zone polling frequency: 10 seconds */
18		Name (_TZP, 100)
19
20		/* Thermal sampling period for passive cooling: 2 seconds */
21		Name (_TSP, 20)
22
23		/* Convert from Degrees C to 1/10 Kelvin for ACPI */
24		Method (CTOK, 1) {
25			/* 10th of Degrees C */
26			Local0 = Arg0 * 10
27
28			/* Convert to Kelvin */
29			Local0 += 2732
30
31			Return (Local0)
32		}
33
34		/* Threshold for OS to shutdown */
35		Method (_CRT, 0, Serialized)
36		{
37			Return (CTOK (\TCRT))
38		}
39
40		/* Threshold for passive cooling */
41		Method (_PSV, 0, Serialized)
42		{
43			Return (CTOK (\TPSV))
44		}
45
46		/* Processors used for passive cooling */
47		Method (_PSL, 0, Serialized)
48		{
49			Return (\PPKG ())
50		}
51
52		Method (_TMP, 0, Serialized)
53		{
54			/* Get temperature from EC in deci-kelvin */
55			Local0 = \_SB.PCI0.LPCB.EC0.TSRD (TMPS)
56
57			/* Critical temperature in deci-kelvin */
58			Local1 = CTOK (\TCRT)
59
60			If (Local0 >= Local1) {
61				Printf ("CRITICAL TEMPERATURE: %o", Local0)
62
63				/* Wait 1 second for EC to re-poll */
64				Sleep (1000)
65
66				/* Re-read temperature from EC */
67				Local0 = \_SB.PCI0.LPCB.EC0.TSRD (TMPS)
68
69				Printf ("RE-READ TEMPERATURE: %o", Local0)
70			}
71
72			Return (Local0)
73		}
74
75	}
76}
77