2 * This file is part of the coreboot project.
4 * Copyright (C) 2011 Christoph Grenz <christophg+cb@grenz-bonn.de>
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.
17 * include this file into a mainboards DSDT inside the PCI device
18 * "K8 Miscellaneous Control" and it will expose the temperature
19 * sensors of the processor as thermal zones.
21 * If, for example, the K8 Misc. Control device is on 0:18.3, include the
22 * following inside the PCI0 device:
25 * Name (_ADR, 0x00180003)
26 * #include northbridge/amd/amdk8/thermal_mixin.asl
29 * Note: as only the current temperature and the trip temperature for
30 * "Software Thermal Control" are available in the PCI registers, but the
31 * linux driver for thermal zones needs a critical temperature value, a
32 * reasonable critical temperature is calculated by simply adding 6°C to
33 * the trip temperature.
35 * The used registers are documented in the "BIOS and Kernel Developer's
36 * Guide for AMD NPT Family 0Fh Processors"
37 * http://support.amd.com/us/Processor_TechDocs/32559.pdf
41 #ifndef K8TEMP_CRITICAL_ADD
42 # define K8TEMP_CRITICAL_ADD 6
45 OperationRegion(K8TR, PCI_Config, 0xE4, 0x4)
46 Field(K8TR, DWordAcc, NoLock, Preserve) {
48 THTP, 1, /* Temperature sensor trip occured */
49 CORE, 1, /* Select Core */
50 TTS0, 1, /* Temperature sensor trip on CPU1 (or single core CPU0) */
51 TTS1, 1, /* Temperature sensor trip on CPU0 */
52 TTEN, 1, /* Temperature sensor trip enabled */
53 PLAC, 1, /* Select Sensor */
55 DOFF, 6, /* Diode offset (signed 6bit-Integer) in °C */
56 TFRC, 2, /* Temperature fractions */
57 TVAL, 8, /* Temperature value in °C biased by -49 */
60 SWTT, 1, /* Induce a thermtrip event (for diagnostic purposes) */
63 OperationRegion(K8ST, PCI_Config, 0x70, 0x1)
64 Field(K8ST, ByteAcc, NoLock, Preserve) {
65 TMAX, 5, /* Maximum temperature for software thermal control, in °C, biased by 52 */
68 /* Calculates temperature in tenths Kelvin from given TVAL and TFRC values */
70 Divide(Multiply(Arg1, 5), 2, , Local0)
71 Return (Add(Multiply(Add(Arg0, 224),10), Local0))
74 /* Calculates the diode offset from a DOFF value */
78 Return (Multiply(Subtract(Xor(Arg0, 0x3F), 1), 10))
81 Return (Multiply(Arg0, 10))
86 Name(_HID, EisaId("PNP0C11"))
88 Name(_STR, Unicode("K8 compatible CPU Core 1 Thermal Sensor 1"))
96 If (LOr(PLAC, CORE)) {
102 If (LOr(LNot(TVAL), LEqual(TVAL, 0xFF))) {
118 Store (K8PT(TVAL, TFRC), Local2)
119 Add (K8PO(DOFF), Local2, Local2)
127 Add(TMAX, 325, Local0)
128 Add(Local0, K8TEMP_CRITICAL_ADD, Local0)
129 Return (Multiply(Local0, 10))
134 Name(_HID, EisaId("PNP0C11"))
136 Name(_STR, Unicode("K8 compatible CPU Core 1 Thermal Sensor 2"))
138 Name(_TZD, Package () {\_PR.CP00})
146 If (LOr(PLAC, CORE)) {
153 If (LOr(LNot(TVAL), LEqual(TVAL, 0xFF))) {
169 Store (K8PT(TVAL, TFRC), Local2)
170 Add (K8PO(DOFF), Local2, Local2)
178 Add(TMAX, 325, Local0)
179 Add(Local0, K8TEMP_CRITICAL_ADD, Local0)
180 Return (Multiply(Local0, 10))
185 Name(_HID, EisaId("PNP0C11"))
187 Name(_STR, Unicode("K8 compatible CPU Core 2 Thermal Sensor 1"))
189 Name(_TZD, Package () {\_PR.CP00})
197 If (LOr(PLAC, CORE)) {
204 If (LOr(LNot(TVAL), LEqual(TVAL, 0xFF))) {
220 Store (K8PT(TVAL, TFRC), Local2)
221 Add (K8PO(DOFF), Local2, Local2)
229 Add(TMAX, 325, Local0)
230 Add(Local0, K8TEMP_CRITICAL_ADD, Local0)
231 Return (Multiply(Local0, 10))
236 Name(_HID, EisaId("PNP0C11"))
238 Name(_STR, Unicode("K8 compatible CPU Core 2 Thermal Sensor 2"))
240 Name(_TZD, Package () {\_PR.CP00})
248 If (LOr(PLAC, CORE)) {
256 If (LOr(LNot(TVAL), LEqual(TVAL, 0xFF))) {
272 Store (K8PT(TVAL, TFRC), Local2)
273 Add (K8PO(DOFF), Local2, Local2)
281 Add(TMAX, 325, Local0)
282 Add(Local0, K8TEMP_CRITICAL_ADD, Local0)
283 Return (Multiply(Local0, 10))