summaryrefslogtreecommitdiffstats
path: root/sys/powerpc/powermac
diff options
context:
space:
mode:
authornwhitehorn <nwhitehorn@FreeBSD.org>2013-10-25 03:55:52 +0000
committernwhitehorn <nwhitehorn@FreeBSD.org>2013-10-25 03:55:52 +0000
commit59faa4d4a471e89639668412ed5e555ae3834ca6 (patch)
treec8a5c9ac647db2f22d22cc02c149f0ed72a3bb9e /sys/powerpc/powermac
parentdb62fd446587bf1e7faa049a82f62fc683aa92e3 (diff)
downloadFreeBSD-src-59faa4d4a471e89639668412ed5e555ae3834ca6.zip
FreeBSD-src-59faa4d4a471e89639668412ed5e555ae3834ca6.tar.gz
Be a little more suspicious of thermal sensors, which can have single
crazy readings occasionally. One wild reading should not be enough to trigger a shutdown, so instead wait for several concerning readings in a row. PR: powerpc/180593 Submitted by: Julio Merino MFC after: 1 week
Diffstat (limited to 'sys/powerpc/powermac')
-rw-r--r--sys/powerpc/powermac/powermac_thermal.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/sys/powerpc/powermac/powermac_thermal.c b/sys/powerpc/powermac/powermac_thermal.c
index db0611a..8b9462c 100644
--- a/sys/powerpc/powermac/powermac_thermal.c
+++ b/sys/powerpc/powermac/powermac_thermal.c
@@ -68,6 +68,8 @@ struct pmac_fan_le {
struct pmac_sens_le {
struct pmac_therm *sensor;
int last_val;
+#define MAX_CRITICAL_COUNT 6
+ int critical_count;
SLIST_ENTRY(pmac_sens_le) entries;
};
static SLIST_HEAD(pmac_fans, pmac_fan_le) fans = SLIST_HEAD_INITIALIZER(fans);
@@ -106,14 +108,27 @@ pmac_therm_manage_fans(void)
sensor->last_val = temp;
if (sensor->last_val > sensor->sensor->max_temp) {
+ sensor->critical_count++;
printf("WARNING: Current temperature (%s: %d.%d C) "
- "exceeds critical temperature (%d.%d C)! "
- "Shutting down!\n", sensor->sensor->name,
- (sensor->last_val - ZERO_C_TO_K) / 10,
- (sensor->last_val - ZERO_C_TO_K) % 10,
- (sensor->sensor->max_temp - ZERO_C_TO_K) / 10,
- (sensor->sensor->max_temp - ZERO_C_TO_K) % 10);
- shutdown_nice(RB_POWEROFF);
+ "exceeds critical temperature (%d.%d C); "
+ "count=%d\n",
+ sensor->sensor->name,
+ (sensor->last_val - ZERO_C_TO_K) / 10,
+ (sensor->last_val - ZERO_C_TO_K) % 10,
+ (sensor->sensor->max_temp - ZERO_C_TO_K) / 10,
+ (sensor->sensor->max_temp - ZERO_C_TO_K) % 10,
+ sensor->critical_count);
+ if (sensor->critical_count >= MAX_CRITICAL_COUNT) {
+ printf("WARNING: %s temperature exceeded "
+ "critical temperature %d times in a row; "
+ "shutting down!\n",
+ sensor->sensor->name,
+ sensor->critical_count);
+ shutdown_nice(RB_POWEROFF);
+ }
+ } else {
+ if (sensor->critical_count > 0)
+ sensor->critical_count--;
}
}
@@ -177,6 +192,8 @@ pmac_thermal_sensor_register(struct pmac_therm *sensor)
list_entry = malloc(sizeof(struct pmac_sens_le), M_PMACTHERM,
M_ZERO | M_WAITOK);
list_entry->sensor = sensor;
+ list_entry->last_val = 0;
+ list_entry->critical_count = 0;
SLIST_INSERT_HEAD(&sensors, list_entry, entries);
}
OpenPOWER on IntegriCloud