amd/family14: Add k10temp thermal zone.

The thermal sensor interface exposed in function 3 of the northbridge is
a more convenient and faster way to access the processor-internal
thermal sensor than using the SMBus/SB-TSI interface from the FCH, see
the Family14 BKDG: "Tctl is a processor temperature control value used
for processor thermal management. Tctl is accessible through SB-TSI and
D18F3xA4[CurTmp]. Tctl is a temperature on its own scale aligned to the
processors cooling requirements"

Also on at least some of these boards the existing thermal zone is
broken and always returns 40C (the default value if the SMBus read
failed) because the SMBus muxing register (SmBus0Sel) is not set up
correctly.

Case in point: The fallback "smbus read failed" temperature is 40 C and
the the logs taken from the board status repository for the Asrock
E350M1 board all show: "ACPI: Thermal Zone [TZ00] (40 C)"
e.g.
http://review.coreboot.org/gitweb?p=board-status.git;a=blob;f=asrock/e350m1/4.0-5054-gf584218/2013-12-20T20:56:20Z/kernel_log.txt#l390
and
http://review.coreboot.org/gitweb?p=board-status.git;a=blob;f=asrock/e350m1/4.0-7030-g6d7de4f/2014-10-16T15:34:19Z/kernel_console.txt#l404
and
http://review.coreboot.org/gitweb?p=board-status.git;a=blob;f=asrock/e350m1/4.0-9989-gf2dfef0/2015-06-13T00:22:49Z/kernel_log.txt#l425

Example lm-sensors output with this patch on the pcengines APU1, on
Linux 4.1.0-rc8+ (wiht both CONFIG_ACPI_THERMAL and
CONFIG_SENSORS_K10TEMP enabled):

acpitz-virtual-0
Adapter: Virtual device
temp1:        +54.0 C  (crit = +100.0 C)

k10temp-pci-00c3
Adapter: PCI adapter
temp1:        +54.0 C  (high = +70.0 C)
                       (crit = +100.0 C, hyst = +97.0 C)

Change-Id: Id9c5b783ba424246816677099ec6651814e59f21
Signed-off-by: Tobias Diedrich <ranma+coreboot@tdiedrich.de>
Reviewed-on: http://review.coreboot.org/10940
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
Tobias Diedrich 2015-06-21 18:25:38 +02:00 committed by Patrick Georgi
parent b0c6817dbe
commit 6a4d6825ac
17 changed files with 8 additions and 458 deletions

View File

@ -1,90 +0,0 @@
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2011 Advanced Micro Devices, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc.
*/
#if 0
/* THERMAL */
Scope(\_TZ) {
Name (KELV, 2732)
Name (THOT, 800)
Name (TCRT, 850)
ThermalZone(TZ00) {
Method(_AC0,0) { /* Active Cooling 0 (0=highest fan speed) */
/* DBGO("\\_TZ\\TZ00\\_AC0\n") */
Return(Add(0, 2730))
}
Method(_AL0,0) { /* Returns package of cooling device to turn on */
/* DBGO("\\_TZ\\TZ00\\_AL0\n") */
Return(Package() {\_TZ.TZ00.FAN0})
}
Device (FAN0) {
Name(_HID, EISAID("PNP0C0B"))
Name(_PR0, Package() {PFN0})
}
PowerResource(PFN0,0,0) {
Method(_STA) {
Store(0xF,Local0)
Return(Local0)
}
Method(_ON) {
/* DBGO("\\_TZ\\TZ00\\FAN0 _ON\n") */
}
Method(_OFF) {
/* DBGO("\\_TZ\\TZ00\\FAN0 _OFF\n") */
}
}
Method(_HOT,0) { /* return hot temp in tenths degree Kelvin */
/* DBGO("\\_TZ\\TZ00\\_HOT\n") */
Return (Add (THOT, KELV))
}
Method(_CRT,0) { /* return critical temp in tenths degree Kelvin */
/* DBGO("\\_TZ\\TZ00\\_CRT\n") */
Return (Add (TCRT, KELV))
}
Method(_TMP,0) { /* return current temp of this zone */
Store (SMBR (0x07, 0x4C,, 0x00), Local0)
If (LGreater (Local0, 0x10)) {
Store (Local0, Local1)
}
Else {
Add (Local0, THOT, Local0)
Return (Add (400, KELV))
}
Store (SMBR (0x07, 0x4C, 0x01), Local0)
/* only the two MSBs in the external temperature low byte are used, resolution 0.25. We ignore it */
/* Store (SMBR (0x07, 0x4C, 0x10), Local2) */
If (LGreater (Local0, 0x10)) {
If (LGreater (Local0, Local1)) {
Store (Local0, Local1)
}
Multiply (Local1, 10, Local1)
Return (Add (Local1, KELV))
}
Else {
Add (Local0, THOT, Local0)
Return (Add (400 , KELV))
}
} /* end of _TMP */
} /* end of TZ00 */
}
#endif

View File

@ -63,7 +63,5 @@ DefinitionBlock (
#include "acpi/sleep.asl"
#include "acpi/gpe.asl"
#include <southbridge/amd/cimx/sb800/acpi/smbus.asl>
#include "acpi/thermal.asl"
}
/* End of ASL file */

View File

@ -1,21 +0,0 @@
/*
* This file is part of the coreboot project.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc.
*/
/* Thermal Zones have been #if 0 for a long time.
* Removing it for now because it doesn't seem to
* do anything when enabled anyway.
*/

View File

@ -63,7 +63,5 @@ DefinitionBlock (
#include "acpi/sleep.asl"
#include "acpi/gpe.asl"
#include <southbridge/amd/cimx/sb800/acpi/smbus.asl>
#include "acpi/thermal.asl"
}
/* End of ASL file */

View File

@ -1,90 +0,0 @@
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2011 Advanced Micro Devices, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc.
*/
#if 0
/* THERMAL */
Scope(\_TZ) {
Name (KELV, 2732)
Name (THOT, 800)
Name (TCRT, 850)
ThermalZone(TZ00) {
Method(_AC0,0) { /* Active Cooling 0 (0=highest fan speed) */
/* DBGO("\\_TZ\\TZ00\\_AC0\n") */
Return(Add(0, 2730))
}
Method(_AL0,0) { /* Returns package of cooling device to turn on */
/* DBGO("\\_TZ\\TZ00\\_AL0\n") */
Return(Package() {\_TZ.TZ00.FAN0})
}
Device (FAN0) {
Name(_HID, EISAID("PNP0C0B"))
Name(_PR0, Package() {PFN0})
}
PowerResource(PFN0,0,0) {
Method(_STA) {
Store(0xF,Local0)
Return(Local0)
}
Method(_ON) {
/* DBGO("\\_TZ\\TZ00\\FAN0 _ON\n") */
}
Method(_OFF) {
/* DBGO("\\_TZ\\TZ00\\FAN0 _OFF\n") */
}
}
Method(_HOT,0) { /* return hot temp in tenths degree Kelvin */
/* DBGO("\\_TZ\\TZ00\\_HOT\n") */
Return (Add (THOT, KELV))
}
Method(_CRT,0) { /* return critical temp in tenths degree Kelvin */
/* DBGO("\\_TZ\\TZ00\\_CRT\n") */
Return (Add (TCRT, KELV))
}
Method(_TMP,0) { /* return current temp of this zone */
Store (SMBR (0x07, 0x4C,, 0x00), Local0)
If (LGreater (Local0, 0x10)) {
Store (Local0, Local1)
}
Else {
Add (Local0, THOT, Local0)
Return (Add (400, KELV))
}
Store (SMBR (0x07, 0x4C, 0x01), Local0)
/* only the two MSBs in the external temperature low byte are used, resolution 0.25. We ignore it */
/* Store (SMBR (0x07, 0x4C, 0x10), Local2) */
If (LGreater (Local0, 0x10)) {
If (LGreater (Local0, Local1)) {
Store (Local0, Local1)
}
Multiply (Local1, 10, Local1)
Return (Add (Local1, KELV))
}
Else {
Add (Local0, THOT, Local0)
Return (Add (400 , KELV))
}
} /* end of _TMP */
} /* end of TZ00 */
}
#endif

View File

@ -63,7 +63,5 @@ DefinitionBlock (
#include "acpi/sleep.asl"
#include "acpi/gpe.asl"
#include <southbridge/amd/cimx/sb800/acpi/smbus.asl>
#include "acpi/thermal.asl"
}
/* End of ASL file */

View File

@ -1,90 +0,0 @@
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2011 Advanced Micro Devices, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc.
*/
#if 0
/* THERMAL */
Scope(\_TZ) {
Name (KELV, 2732)
Name (THOT, 800)
Name (TCRT, 850)
ThermalZone(TZ00) {
Method(_AC0,0) { /* Active Cooling 0 (0=highest fan speed) */
/* DBGO("\\_TZ\\TZ00\\_AC0\n") */
Return(Add(0, 2730))
}
Method(_AL0,0) { /* Returns package of cooling device to turn on */
/* DBGO("\\_TZ\\TZ00\\_AL0\n") */
Return(Package() {\_TZ.TZ00.FAN0})
}
Device (FAN0) {
Name(_HID, EISAID("PNP0C0B"))
Name(_PR0, Package() {PFN0})
}
PowerResource(PFN0,0,0) {
Method(_STA) {
Store(0xF,Local0)
Return(Local0)
}
Method(_ON) {
/* DBGO("\\_TZ\\TZ00\\FAN0 _ON\n") */
}
Method(_OFF) {
/* DBGO("\\_TZ\\TZ00\\FAN0 _OFF\n") */
}
}
Method(_HOT,0) { /* return hot temp in tenths degree Kelvin */
/* DBGO("\\_TZ\\TZ00\\_HOT\n") */
Return (Add (THOT, KELV))
}
Method(_CRT,0) { /* return critical temp in tenths degree Kelvin */
/* DBGO("\\_TZ\\TZ00\\_CRT\n") */
Return (Add (TCRT, KELV))
}
Method(_TMP,0) { /* return current temp of this zone */
Store (SMBR (0x07, 0x4C,, 0x00), Local0)
If (LGreater (Local0, 0x10)) {
Store (Local0, Local1)
}
Else {
Add (Local0, THOT, Local0)
Return (Add (400, KELV))
}
Store (SMBR (0x07, 0x4C, 0x01), Local0)
/* only the two MSBs in the external temperature low byte are used, resolution 0.25. We ignore it */
/* Store (SMBR (0x07, 0x4C, 0x10), Local2) */
If (LGreater (Local0, 0x10)) {
If (LGreater (Local0, Local1)) {
Store (Local0, Local1)
}
Multiply (Local1, 10, Local1)
Return (Add (Local1, KELV))
}
Else {
Add (Local0, THOT, Local0)
Return (Add (400 , KELV))
}
} /* end of _TMP */
} /* end of TZ00 */
}
#endif

View File

@ -63,7 +63,5 @@ DefinitionBlock (
#include "acpi/sleep.asl"
#include "acpi/gpe.asl"
#include <southbridge/amd/cimx/sb800/acpi/smbus.asl>
#include "acpi/thermal.asl"
}
/* End of ASL file */

View File

@ -1,88 +0,0 @@
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2011 Advanced Micro Devices, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc.
*/
/* THERMAL */
Scope(\_TZ) {
Name (KELV, 2732)
Name (THOT, 800)
Name (TCRT, 850)
ThermalZone(TZ00) {
Method(_AC0,0) { /* Active Cooling 0 (0=highest fan speed) */
/* DBGO("\\_TZ\\TZ00\\_AC0\n") */
Return(Add(0, 2730))
}
Method(_AL0,0) { /* Returns package of cooling device to turn on */
/* DBGO("\\_TZ\\TZ00\\_AL0\n") */
Return(Package() {\_TZ.TZ00.FAN0})
}
Device (FAN0) {
Name(_HID, EISAID("PNP0C0B"))
Name(_PR0, Package() {PFN0})
}
PowerResource(PFN0,0,0) {
Method(_STA) {
Store(0xF,Local0)
Return(Local0)
}
Method(_ON) {
/* DBGO("\\_TZ\\TZ00\\FAN0 _ON\n") */
}
Method(_OFF) {
/* DBGO("\\_TZ\\TZ00\\FAN0 _OFF\n") */
}
}
Method(_HOT,0) { /* return hot temp in tenths degree Kelvin */
/* DBGO("\\_TZ\\TZ00\\_HOT\n") */
Return (Add (THOT, KELV))
}
Method(_CRT,0) { /* return critical temp in tenths degree Kelvin */
/* DBGO("\\_TZ\\TZ00\\_CRT\n") */
Return (Add (TCRT, KELV))
}
Method(_TMP,0) { /* return current temp of this zone */
Store (SMBR (0x07, 0x4C,, 0x00), Local0)
If (LGreater (Local0, 0x10)) {
Store (Local0, Local1)
}
Else {
Add (Local0, THOT, Local0)
Return (Add (400, KELV))
}
Store (SMBR (0x07, 0x4C, 0x01), Local0)
/* only the two MSBs in the external temperature low byte are used, resolution 0.25. We ignore it */
/* Store (SMBR (0x07, 0x4C, 0x10), Local2) */
If (LGreater (Local0, 0x10)) {
If (LGreater (Local0, Local1)) {
Store (Local0, Local1)
}
Multiply (Local1, 10, Local1)
Return (Add (Local1, KELV))
}
Else {
Add (Local0, THOT, Local0)
Return (Add (400 , KELV))
}
} /* end of _TMP */
} /* end of TZ00 */
}

View File

@ -57,7 +57,5 @@ DefinitionBlock (
#include "acpi/sleep.asl"
#include "acpi/gpe.asl"
#include <southbridge/amd/cimx/sb800/acpi/smbus.asl>
#include "acpi/thermal.asl"
}
/* End of ASL file */

View File

@ -1,21 +0,0 @@
/*
* This file is part of the coreboot project.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc.
*/
/* Thermal Zones have been #if 0 for a long time.
* Removing it for now because it doesn't seem to
* do anything when enabled anyway.
*/

View File

@ -58,7 +58,5 @@ DefinitionBlock (
#include "acpi/sleep.asl"
#include "acpi/gpe.asl"
#include <southbridge/amd/cimx/sb800/acpi/smbus.asl>
#include "acpi/thermal.asl"
}
/* End of ASL file */

View File

@ -1,21 +0,0 @@
/*
* This file is part of the coreboot project.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc.
*/
/* Thermal Zones have been #if 0 for a long time.
* Removing it for now because it doesn't seem to
* do anything when enabled anyway.
*/

View File

@ -57,8 +57,6 @@ DefinitionBlock (
#include "acpi/sleep.asl"
#include "acpi/gpe.asl"
#include <southbridge/amd/cimx/sb800/acpi/smbus.asl>
#include "acpi/thermal.asl"
#include "acpi/superio.asl"
}
/* End of ASL file */

View File

@ -1,21 +0,0 @@
/*
* This file is part of the coreboot project.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc.
*/
/* Thermal Zones have been #if 0 for a long time.
* Removing it for now because it doesn't seem to
* do anything when enabled anyway.
*/

View File

@ -63,7 +63,5 @@ DefinitionBlock (
#include "acpi/buttons.asl"
#include "acpi/gpio.asl"
#include "acpi/leds.asl"
#include "acpi/thermal.asl"
}
/* End of ASL file */

View File

@ -126,3 +126,11 @@ Device(PE23) {
Return (PE3) /* PIC Mode */
} /* end _PRT */
} /* end PE23 */
/* Northbridge function 3 */
Device(NBF3) {
Name(_ADR, 0x00180003)
/* k10temp thermal zone */
#include <northbridge/amd/amdfam10/thermal_mixin.asl>
} /* end NBF3 */