<p>Marc Jones has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/22400">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">kahlee: Add thermal ASL<br><br>Connect the EC thermal to Kahlee thermal ASL. Intialize GNVS<br>thermal values in the mainboard finalize.<br><br>BUG=b:67999819<br><br>Change-Id: I89159a5fd3c639e511139b8c5948b6a4ee19aaa3<br>Signed-off-by: Marc Jones <marcj303@gmail.com><br>---<br>A src/mainboard/google/kahlee/acpi/thermal.asl<br>M src/mainboard/google/kahlee/dsdt.asl<br>M src/mainboard/google/kahlee/mainboard.c<br>A src/mainboard/google/kahlee/variants/kahlee/include/variant/thermal.h<br>4 files changed, 156 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/00/22400/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/src/mainboard/google/kahlee/acpi/thermal.asl b/src/mainboard/google/kahlee/acpi/thermal.asl<br>new file mode 100644<br>index 0000000..3d53364<br>--- /dev/null<br>+++ b/src/mainboard/google/kahlee/acpi/thermal.asl<br>@@ -0,0 +1,90 @@<br>+/*<br>+ * This file is part of the coreboot project.<br>+ *<br>+ * Copyright (C) 2014 Google Inc.<br>+ *<br>+ * This program is free software; you can redistribute it and/or modify<br>+ * it under the terms of the GNU General Public License as published by<br>+ * the Free Software Foundation; version 2 of the License.<br>+ *<br>+ * This program is distributed in the hope that it will be useful,<br>+ * but WITHOUT ANY WARRANTY; without even the implied warranty of<br>+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the<br>+ * GNU General Public License for more details.<br>+ */<br>+<br>+#include <variant/thermal.h><br>+<br>+/* Thermal Zone */<br>+<br>+Scope (\_TZ)<br>+{<br>+      ThermalZone (THRM)<br>+   {<br>+            /* Thermal constants for passive cooling */<br>+          Name (_TC1, 0x02)<br>+            Name (_TC2, 0x05)<br>+<br>+         /* Thermal zone polling frequency: 10 seconds */<br>+             Name (_TZP, 100)<br>+<br>+          /* Thermal sampling period for passive cooling: 2 seconds */<br>+         Name (_TSP, 20)<br>+<br>+           /* Convert from Degrees C to 1/10 Kelvin for ACPI */<br>+         Method (CTOK, 1) {<br>+                   /* 10th of Degrees C */<br>+                      Multiply (Arg0, 10, Local0)<br>+<br>+                       /* Convert to Kelvin */<br>+                      Add (Local0, 2732, Local0)<br>+<br>+                        Return (Local0)<br>+              }<br>+<br>+         /* Threshold for OS to shutdown */<br>+           Method (_CRT, 0, Serialized)<br>+         {<br>+                    Return (CTOK (\TCRT))<br>+                }<br>+<br>+         /* Threshold for passive cooling */<br>+          Method (_PSV, 0, Serialized)<br>+         {<br>+                    Return (CTOK (\TPSV))<br>+                }<br>+<br>+         /* Processors used for passive cooling */<br>+            Method (_PSL, 0, Serialized)<br>+         {<br>+                    Return (\PPKG ())<br>+            }<br>+<br>+         Method (_TMP, 0, Serialized)<br>+         {<br>+                    /* Get temperature from EC in deci-kelvin */<br>+                 Store (\_SB.PCI0.LPCB.EC0.TSRD (TMPS), Local0)<br>+<br>+                    /* Critical temperature in deci-kelvin */<br>+                    Store (CTOK (\TCRT), Local1)<br>+<br>+                      If (LGreaterEqual (Local0, Local1)) {<br>+                                Store ("CRITICAL TEMPERATURE", Debug)<br>+                              Store (Local0, Debug)<br>+<br>+                             /* Wait 1 second for EC to re-poll */<br>+                                Sleep (1000)<br>+<br>+                              /* Re-read temperature from EC */<br>+                            Store (\_SB.PCI0.LPCB.EC0.TSRD (TMPS), Local0)<br>+<br>+                            Store ("RE-READ TEMPERATURE", Debug)<br>+                               Store (Local0, Debug)<br>+                        }<br>+<br>+                 Return (Local0)<br>+              }<br>+<br>+         /* No active fan controll (_ACx) on Kahlee */<br>+        }<br>+}<br>diff --git a/src/mainboard/google/kahlee/dsdt.asl b/src/mainboard/google/kahlee/dsdt.asl<br>index f3f8aaa..963f7d1 100644<br>--- a/src/mainboard/google/kahlee/dsdt.asl<br>+++ b/src/mainboard/google/kahlee/dsdt.asl<br>@@ -77,6 +77,9 @@<br> <br>  } /* End \_SB scope */<br> <br>+    /* Thermal handler */<br>+        #include "acpi/thermal.asl"<br>+<br>      /* Chrome OS specific */<br>      #include <vendorcode/google/chromeos/acpi/chromeos.asl><br> <br>diff --git a/src/mainboard/google/kahlee/mainboard.c b/src/mainboard/google/kahlee/mainboard.c<br>index c7689c8..1532d33 100644<br>--- a/src/mainboard/google/kahlee/mainboard.c<br>+++ b/src/mainboard/google/kahlee/mainboard.c<br>@@ -18,9 +18,12 @@<br> #include <arch/acpi.h><br> #include <agesawrapper.h><br> #include <amd_pci_util.h><br>+#include <cbmem.h><br> #include <ec.h><br> #include <mainboard.h><br>+#include <soc/nvs.h><br> #include <soc/smi.h><br>+#include <variant/thermal.h><br> #include <vendorcode/google/chromeos/chromeos.h><br> <br> /***********************************************************<br>@@ -104,7 +107,24 @@<br>        dev->ops->acpi_inject_dsdt_generator = chromeos_dsdt_generator;<br> }<br> <br>+<br>+static void mainboard_final(void *chip_info)<br>+{<br>+   struct global_nvs_t *gnvs;<br>+<br>+        gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS);<br>+<br>+    if (gnvs) {<br>+          gnvs->tmps = CTL_TDP_SENSOR_ID;<br>+           gnvs->tcrt = CRITICAL_TEMPERATURE;<br>+                gnvs->tpsv = PASSIVE_TEMPERATURE;<br>+         gnvs->tmax = MAX_TEMPERATURE;<br>+             gnvs->flvl = 1;<br>+   }<br>+}<br>+<br> struct chip_operations mainboard_ops = {<br>   .init = mainboard_init,<br>       .enable_dev = kahlee_enable,<br>+ .final = mainboard_final,<br> };<br>diff --git a/src/mainboard/google/kahlee/variants/kahlee/include/variant/thermal.h b/src/mainboard/google/kahlee/variants/kahlee/include/variant/thermal.h<br>new file mode 100644<br>index 0000000..a511215<br>--- /dev/null<br>+++ b/src/mainboard/google/kahlee/variants/kahlee/include/variant/thermal.h<br>@@ -0,0 +1,43 @@<br>+/*<br>+ * This file is part of the coreboot project.<br>+ *<br>+ * Copyright (C) 2014 Google Inc.<br>+ * Copyright (C) 2017 Advanced Micro Devices, Inc.<br>+ *<br>+ * This program is free software; you can redistribute it and/or modify<br>+ * it under the terms of the GNU General Public License as published by<br>+ * the Free Software Foundation; version 2 of the License.<br>+ *<br>+ * This program is distributed in the hope that it will be useful,<br>+ * but WITHOUT ANY WARRANTY; without even the implied warranty of<br>+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the<br>+ * GNU General Public License for more details.<br>+ */<br>+<br>+#ifndef THERMAL_H<br>+#define THERMAL_H<br>+<br>+/*<br>+ * Stoney Ridge Thermal Requirements 12 (6W)<br>+ * TDP (W) 6<br>+ * T die,max (°C) 95<br>+ * T ctl,max 85<br>+ * T die,lmt (default) 90<br>+ * T ctl,lmt (default) 80<br>+ */<br>+<br>+/* Control TDP Settings */<br>+#define CTL_TDP_SENSOR_ID           0       /* EC TIN0 */<br>+#define CTL_TDP_THRESHOLD_OFF           85      /* Normal at 85C */<br>+#define CTL_TDP_THRESHOLD_ON              90      /* Limited at 90C */<br>+<br>+/* Temperature which OS will shutdown at */<br>+#define CRITICAL_TEMPERATURE            94<br>+<br>+/* Temperature which OS will throttle CPU */<br>+#define PASSIVE_TEMPERATURE              85<br>+<br>+/* Tj_max value for calculating PECI CPU temperature */<br>+#define MAX_TEMPERATURE                       95<br>+<br>+#endif<br></pre><p>To view, visit <a href="https://review.coreboot.org/22400">change 22400</a>. To unsubscribe, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/22400"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I89159a5fd3c639e511139b8c5948b6a4ee19aaa3 </div>
<div style="display:none"> Gerrit-Change-Number: 22400 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Marc Jones <marc@marcjonesconsulting.com> </div>