summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authornjl <njl@FreeBSD.org>2004-02-03 04:18:56 +0000
committernjl <njl@FreeBSD.org>2004-02-03 04:18:56 +0000
commit8ec8ff7672ef4b6b99e145cdd609754f9c4cbb17 (patch)
tree3d6f7a30501d42369124596593d55038b0d91238 /sys/dev
parent39de947ca8fb40a08f0cf5545071ff98348a8baa (diff)
downloadFreeBSD-src-8ec8ff7672ef4b6b99e145cdd609754f9c4cbb17.zip
FreeBSD-src-8ec8ff7672ef4b6b99e145cdd609754f9c4cbb17.tar.gz
Notify the user (at kern.emerg) that the system will be shutting down if
it is still above the critical temperature on the next poll cycle. This is a 10 second advance notice by default. Document the private (non-standard) notify we will be using with devd(8).
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/acpica/acpi_thermal.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/sys/dev/acpica/acpi_thermal.c b/sys/dev/acpica/acpi_thermal.c
index 32fb551..03d50ce 100644
--- a/sys/dev/acpica/acpi_thermal.c
+++ b/sys/dev/acpica/acpi_thermal.c
@@ -49,9 +49,10 @@ ACPI_MODULE_NAME("THERMAL")
#define TZ_ZEROC 2732
#define TZ_KELVTOC(x) (((x) - TZ_ZEROC) / 10), (((x) - TZ_ZEROC) % 10)
-#define TZ_NOTIFY_TEMPERATURE 0x80
-#define TZ_NOTIFY_LEVELS 0x81
-#define TZ_NOTIFY_DEVICES 0x82
+#define TZ_NOTIFY_TEMPERATURE 0x80 /* Temperature changed. */
+#define TZ_NOTIFY_LEVELS 0x81 /* Cooling levels changed. */
+#define TZ_NOTIFY_DEVICES 0x82 /* Device lists changed. */
+#define TZ_NOTIFY_CRITICAL 0xcc /* Fake notify that _CRT/_HOT reached. */
/* Check for temperature changes every 10 seconds by default */
#define TZ_POLLRATE 10
@@ -59,6 +60,9 @@ ACPI_MODULE_NAME("THERMAL")
/* Make sure the reported temperature is valid for this number of polls. */
#define TZ_VALIDCHECKS 3
+/* Notify the user we will be shutting down in one more poll cycle. */
+#define TZ_NOTIFYCOUNT (TZ_VALIDCHECKS - 1)
+
/* ACPI spec defines this */
#define TZ_NUMLEVELS 10
struct acpi_tz_zone {
@@ -481,14 +485,18 @@ acpi_tz_monitor(void *Context)
* 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 we're almost at that threshold, notify the user through devd(8).
*/
if ((newflags & (TZ_THFLAG_HOT | TZ_THFLAG_CRT)) != 0) {
- if (++sc->tz_validchecks == TZ_VALIDCHECKS) {
+ sc->tz_validchecks++;
+ 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 if (sc->tz_validchecks == TZ_NOTIFYCOUNT)
+ acpi_UserNotify("Thermal", sc->tz_handle, TZ_NOTIFY_CRITICAL);
} else {
sc->tz_validchecks = 0;
}
OpenPOWER on IntegriCloud