Check the _TMP value for sanity also. On some systems (HP NX laptops), the

EC occasionally times out and provides bogus values (3000C).  This change
prevents those systems from prematurely shutting down while we work on the
underlying problem.  Also, bump the sanity value to 0...200C from 0...150C.
This commit is contained in:
Nate Lawson 2007-03-05 21:39:53 +00:00
parent 1471588a2f
commit 4d44d81742
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=167249

View file

@ -434,10 +434,12 @@ acpi_tz_get_temperature(struct acpi_tz_softc *sc)
{
int temp;
ACPI_STATUS status;
static char *tmp_name = "_TMP";
ACPI_FUNCTION_NAME ("acpi_tz_get_temperature");
status = acpi_GetInteger(sc->tz_handle, "_TMP", &temp);
/* Evaluate the thermal zone's _TMP method. */
status = acpi_GetInteger(sc->tz_handle, tmp_name, &temp);
if (ACPI_FAILURE(status)) {
ACPI_VPRINT(sc->tz_dev, acpi_device_get_parent_softc(sc->tz_dev),
"error fetching current temperature -- %s\n",
@ -445,6 +447,11 @@ acpi_tz_get_temperature(struct acpi_tz_softc *sc)
return (FALSE);
}
/* Check it for validity. */
acpi_tz_sanity(sc, &temp, tmp_name);
if (temp == -1)
return (FALSE);
ACPI_DEBUG_PRINT((ACPI_DB_VALUES, "got %d.%dC\n", TZ_KELVTOC(temp)));
sc->tz_temperature = temp;
return (TRUE);
@ -646,12 +653,12 @@ acpi_tz_getparam(struct acpi_tz_softc *sc, char *node, int *data)
/*
* Sanity-check a temperature value. Assume that setpoints
* should be between 0C and 150C.
* should be between 0C and 200C.
*/
static void
acpi_tz_sanity(struct acpi_tz_softc *sc, int *val, char *what)
{
if (*val != -1 && (*val < TZ_ZEROC || *val > TZ_ZEROC + 1500)) {
if (*val != -1 && (*val < TZ_ZEROC || *val > TZ_ZEROC + 2000)) {
device_printf(sc->tz_dev, "%s value is absurd, ignored (%d.%dC)\n",
what, TZ_KELVTOC(*val));
*val = -1;