aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/acpica/acpi_thermal.c
diff options
context:
space:
mode:
authorHajimu UMEMOTO <ume@FreeBSD.org>2007-12-24 16:32:14 +0000
committerHajimu UMEMOTO <ume@FreeBSD.org>2007-12-24 16:32:14 +0000
commit0c3e489dce24a1a77e4bf2994e4ea6f848fe2be1 (patch)
tree1bfd5e706474396a5ed5cce583c33ba4b81ad0f3 /sys/dev/acpica/acpi_thermal.c
parent316d90a37bd2753f6395decfcab4712b1c47955b (diff)
downloadsrc-0c3e489dce24a1a77e4bf2994e4ea6f848fe2be1.tar.gz
src-0c3e489dce24a1a77e4bf2994e4ea6f848fe2be1.zip
Add sysctl mibs for _TSP, _TC1 and _TC2 which is user overridable
but is blocked on user_override mib. Not a few people want to use a passive cooling without their ACPI BIOS support. Reviewed by: njl
Notes
Notes: svn path=/head/; revision=174889
Diffstat (limited to 'sys/dev/acpica/acpi_thermal.c')
-rw-r--r--sys/dev/acpica/acpi_thermal.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/sys/dev/acpica/acpi_thermal.c b/sys/dev/acpica/acpi_thermal.c
index 9c560c87b421..045d2ba197c0 100644
--- a/sys/dev/acpica/acpi_thermal.c
+++ b/sys/dev/acpica/acpi_thermal.c
@@ -133,6 +133,7 @@ static void acpi_tz_sanity(struct acpi_tz_softc *sc, int *val, char *what);
static int acpi_tz_active_sysctl(SYSCTL_HANDLER_ARGS);
static int acpi_tz_cooling_sysctl(SYSCTL_HANDLER_ARGS);
static int acpi_tz_temp_sysctl(SYSCTL_HANDLER_ARGS);
+static int acpi_tz_passive_sysctl(SYSCTL_HANDLER_ARGS);
static void acpi_tz_notify_handler(ACPI_HANDLE h, UINT32 notify,
void *context);
static void acpi_tz_signal(struct acpi_tz_softc *sc, int flags);
@@ -293,6 +294,21 @@ acpi_tz_attach(device_t dev)
SYSCTL_ADD_OPAQUE(&sc->tz_sysctl_ctx, SYSCTL_CHILDREN(sc->tz_sysctl_tree),
OID_AUTO, "_ACx", CTLFLAG_RD, &sc->tz_zone.ac,
sizeof(sc->tz_zone.ac), "IK", "");
+ SYSCTL_ADD_PROC(&sc->tz_sysctl_ctx, SYSCTL_CHILDREN(sc->tz_sysctl_tree),
+ OID_AUTO, "_TC1", CTLTYPE_INT | CTLFLAG_RW,
+ sc, offsetof(struct acpi_tz_softc, tz_zone.tc1),
+ acpi_tz_passive_sysctl, "I",
+ "thermal constant 1 for passive cooling");
+ SYSCTL_ADD_PROC(&sc->tz_sysctl_ctx, SYSCTL_CHILDREN(sc->tz_sysctl_tree),
+ OID_AUTO, "_TC2", CTLTYPE_INT | CTLFLAG_RW,
+ sc, offsetof(struct acpi_tz_softc, tz_zone.tc2),
+ acpi_tz_passive_sysctl, "I",
+ "thermal constant 2 for passive cooling");
+ SYSCTL_ADD_PROC(&sc->tz_sysctl_ctx, SYSCTL_CHILDREN(sc->tz_sysctl_tree),
+ OID_AUTO, "_TSP", CTLTYPE_INT | CTLFLAG_RW,
+ sc, offsetof(struct acpi_tz_softc, tz_zone.tsp),
+ acpi_tz_passive_sysctl, "I",
+ "thermal sampling period for passive cooling");
/*
* Create thread to service all of the thermal zones. Register
@@ -748,6 +764,30 @@ acpi_tz_temp_sysctl(SYSCTL_HANDLER_ARGS)
return (0);
}
+static int
+acpi_tz_passive_sysctl(SYSCTL_HANDLER_ARGS)
+{
+ struct acpi_tz_softc *sc;
+ int val, *val_ptr;
+ int error;
+
+ sc = oidp->oid_arg1;
+ val_ptr = (int *)((uintptr_t)sc + oidp->oid_arg2);
+ val = *val_ptr;
+ error = sysctl_handle_int(oidp, &val, 0, req);
+
+ /* Error or no new value */
+ if (error != 0 || req->newptr == NULL)
+ return (error);
+
+ /* Only allow changing settings if override is set. */
+ if (!acpi_tz_override)
+ return (EPERM);
+
+ *val_ptr = val;
+ return (0);
+}
+
static void
acpi_tz_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context)
{