2 * This file is part of the coreboot project.
4 * Copyright (C) 2014 The Chromium OS Authors. All rights reserved.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
16 #include "../thermal.h"
27 // Thermal zone polling frequency: 10 seconds
30 // Thermal sampling period for passive cooling: 2 seconds
33 // Convert from Degrees C to 1/10 Kelvin for ACPI
36 Multiply (Arg0, 10, Local0)
39 Add (Local0, 2732, Local0)
44 // Threshold for OS to shutdown
45 Method (_CRT, 0, Serialized)
50 // Threshold for passive cooling
51 Method (_PSV, 0, Serialized)
56 // Processors used for passive cooling
57 Method (_PSL, 0, Serialized)
62 // Start fan at state 4 = lowest temp state
66 Store (FAN4_PWM, \_SB.PCI0.LPCB.SIO.ENVC.F2PS)
67 Notify (\_TZ.THRM, 0x81)
70 Method (TCHK, 0, Serialized)
72 // Get CPU Temperature from PECI via SuperIO TMPIN3
73 Store (\_SB.PCI0.LPCB.SIO.ENVC.TIN3, Local0)
75 // Check for "no reading available
76 If (LEqual (Local0, 0x80)) {
77 Return (CTOK (FAN0_THRESHOLD_ON))
80 // Check for invalid readings
81 If (LOr (LEqual (Local0, 255), LEqual (Local0, 0))) {
82 Return (CTOK (FAN0_THRESHOLD_ON))
85 // PECI raw value is an offset from Tj_max
86 Subtract (255, Local0, Local1)
88 // Handle values greater than Tj_max
89 If (LGreaterEqual (Local1, \TMAX)) {
93 // Subtract from Tj_max to get temperature
94 Subtract (\TMAX, Local1, Local0)
95 Return (CTOK (Local0))
98 Method (_TMP, 0, Serialized)
100 // Get temperature from SuperIO in deci-kelvin
101 Store (TCHK (), Local0)
103 // Critical temperature in deci-kelvin
104 Store (CTOK (\TMAX), Local1)
106 If (LGreaterEqual (Local0, Local1)) {
107 Store ("CRITICAL TEMPERATURE", Debug)
108 Store (Local0, Debug)
110 // Wait 1 second for SuperIO to re-poll
113 // Re-read temperature from SuperIO
114 Store (TCHK (), Local0)
116 Store ("RE-READ TEMPERATURE", Debug)
117 Store (Local0, Debug)
124 If (LLessEqual (\FLVL, 0)) {
125 Return (CTOK (FAN0_THRESHOLD_OFF))
127 Return (CTOK (FAN0_THRESHOLD_ON))
132 If (LLessEqual (\FLVL, 1)) {
133 Return (CTOK (FAN1_THRESHOLD_OFF))
135 Return (CTOK (FAN1_THRESHOLD_ON))
140 If (LLessEqual (\FLVL, 2)) {
141 Return (CTOK (FAN2_THRESHOLD_OFF))
143 Return (CTOK (FAN2_THRESHOLD_ON))
148 If (LLessEqual (\FLVL, 3)) {
149 Return (CTOK (FAN3_THRESHOLD_OFF))
151 Return (CTOK (FAN3_THRESHOLD_ON))
156 If (LLessEqual (\FLVL, 4)) {
157 Return (CTOK (FAN4_THRESHOLD_OFF))
159 Return (CTOK (FAN4_THRESHOLD_ON))
163 Name (_AL0, Package () { FAN0 })
164 Name (_AL1, Package () { FAN1 })
165 Name (_AL2, Package () { FAN2 })
166 Name (_AL3, Package () { FAN3 })
167 Name (_AL4, Package () { FAN4 })
169 PowerResource (FNP0, 0, 0)
172 If (LLessEqual (\FLVL, 0)) {
179 If (LNot (_STA ())) {
182 \_SB.PCI0.LPCB.SIO.ENVC.F2PS)
183 Notify (\_TZ.THRM, 0x81)
190 \_SB.PCI0.LPCB.SIO.ENVC.F2PS)
191 Notify (\_TZ.THRM, 0x81)
196 PowerResource (FNP1, 0, 0)
199 If (LLessEqual (\FLVL, 1)) {
206 If (LNot (_STA ())) {
209 \_SB.PCI0.LPCB.SIO.ENVC.F2PS)
210 Notify (\_TZ.THRM, 0x81)
217 \_SB.PCI0.LPCB.SIO.ENVC.F2PS)
218 Notify (\_TZ.THRM, 0x81)
223 PowerResource (FNP2, 0, 0)
226 If (LLessEqual (\FLVL, 2)) {
233 If (LNot (_STA ())) {
236 \_SB.PCI0.LPCB.SIO.ENVC.F2PS)
237 Notify (\_TZ.THRM, 0x81)
244 \_SB.PCI0.LPCB.SIO.ENVC.F2PS)
245 Notify (\_TZ.THRM, 0x81)
250 PowerResource (FNP3, 0, 0)
253 If (LLessEqual (\FLVL, 3)) {
260 If (LNot (_STA ())) {
263 \_SB.PCI0.LPCB.SIO.ENVC.F2PS)
264 Notify (\_TZ.THRM, 0x81)
271 \_SB.PCI0.LPCB.SIO.ENVC.F2PS)
272 Notify (\_TZ.THRM, 0x81)
277 PowerResource (FNP4, 0, 0)
280 If (LLessEqual (\FLVL, 4)) {
287 If (LNot (_STA ())) {
290 \_SB.PCI0.LPCB.SIO.ENVC.F2PS)
291 Notify (\_TZ.THRM, 0x81)
298 \_SB.PCI0.LPCB.SIO.ENVC.F2PS)
299 Notify (\_TZ.THRM, 0x81)
306 Name (_HID, EISAID ("PNP0C0B"))
308 Name (_PR0, Package () { FNP0 })
313 Name (_HID, EISAID ("PNP0C0B"))
315 Name (_PR0, Package () { FNP1 })
320 Name (_HID, EISAID ("PNP0C0B"))
322 Name (_PR0, Package () { FNP2 })
327 Name (_HID, EISAID ("PNP0C0B"))
329 Name (_PR0, Package () { FNP3 })
334 Name (_HID, EISAID ("PNP0C0B"))
336 Name (_PR0, Package () { FNP4 })