mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-24 11:29:10 +00:00
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
This commit is contained in:
parent
316d90a37b
commit
0c3e489dce
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=174889
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user