If the temperature is at _HOT or _CRT for 3 sequential readings, shutdown

the system.  Also, decrease the poll interval to 10 seconds from 30
seconds.  This is needed because some systems will report an invalid high
temperature for one poll cycle.  It is suspected this is due to the
embedded controller timing out.  A typical value is 138C for one cycle on a
system that is otherwise 65C.  This prevents the system from prematurely
shutting down after one invalid reading.  It will still shut down after 30
seconds of high temperature, which is the same as previous default
behavior.

Tested by:	Scott Lambert <lambert AT lambertfam.org>
This commit is contained in:
Nate Lawson 2004-02-02 18:03:35 +00:00
parent 6ec2f175f9
commit 322141f1e2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=125335

View File

@ -53,8 +53,11 @@ ACPI_MODULE_NAME("THERMAL")
#define TZ_NOTIFY_LEVELS 0x81
#define TZ_NOTIFY_DEVICES 0x82
/* Check for temperature changes every 30 seconds by default */
#define TZ_POLLRATE 30
/* Check for temperature changes every 10 seconds by default */
#define TZ_POLLRATE 10
/* Make sure the reported temperature is valid for this number of polls. */
#define TZ_VALIDCHECKS 3
/* ACPI spec defines this */
#define TZ_NUMLEVELS 10
@ -71,7 +74,6 @@ struct acpi_tz_zone {
int tzp;
};
struct acpi_tz_softc {
device_t tz_dev;
ACPI_HANDLE tz_handle; /*Thermal zone handle*/
@ -95,6 +97,7 @@ struct acpi_tz_softc {
struct acpi_tz_zone tz_zone; /*Thermal zone parameters*/
int tz_tmp_updating;
int tz_validchecks;
};
static int acpi_tz_probe(device_t dev);
@ -472,18 +475,22 @@ acpi_tz_monitor(void *Context)
/* XXX (de)activate any passive cooling that may be required. */
/*
* If we have just become _HOT or _CRT, warn the user.
*
* We should actually shut down at this point, but it's not clear
* that some systems don't actually map _CRT to the same value as _AC0.
* If the temperature is at _HOT or _CRT, increment our event count.
* If it has occurred enough times, shutdown the system. This is
* needed because some systems will report an invalid high temperature
* for one poll cycle. It is suspected this is due to the embedded
* controller timing out. A typical value is 138C for one cycle on
* a system that is otherwise 65C.
*/
if ((newflags & (TZ_THFLAG_HOT | TZ_THFLAG_CRT)) != 0 &&
(sc->tz_thflags & (TZ_THFLAG_HOT | TZ_THFLAG_CRT)) == 0) {
device_printf(sc->tz_dev,
"WARNING - current temperature (%d.%dC) exceeds system limits\n",
TZ_KELVTOC(sc->tz_temperature));
shutdown_nice(RB_POWEROFF);
if ((newflags & (TZ_THFLAG_HOT | TZ_THFLAG_CRT)) != 0) {
if (++sc->tz_validchecks == TZ_VALIDCHECKS) {
device_printf(sc->tz_dev,
"WARNING - current temperature (%d.%dC) exceeds safe limits\n",
TZ_KELVTOC(sc->tz_temperature));
shutdown_nice(RB_POWEROFF);
}
} else {
sc->tz_validchecks = 0;
}
sc->tz_thflags = newflags;