summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2007-12-24 16:32:14 +0000
committerume <ume@FreeBSD.org>2007-12-24 16:32:14 +0000
commit372f968dbe5437228a5751d1676ffe95d441cd0b (patch)
tree1bfd5e706474396a5ed5cce583c33ba4b81ad0f3 /sys
parent6d2bfd1ec9391b2641e8ddb454c45e869c9b91ac (diff)
downloadFreeBSD-src-372f968dbe5437228a5751d1676ffe95d441cd0b.zip
FreeBSD-src-372f968dbe5437228a5751d1676ffe95d441cd0b.tar.gz
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
Diffstat (limited to 'sys')
-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 9c560c8..045d2ba 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)
{
OpenPOWER on IntegriCloud