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
@ -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_active_sysctl(SYSCTL_HANDLER_ARGS);
|
||||||
static int acpi_tz_cooling_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_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,
|
static void acpi_tz_notify_handler(ACPI_HANDLE h, UINT32 notify,
|
||||||
void *context);
|
void *context);
|
||||||
static void acpi_tz_signal(struct acpi_tz_softc *sc, int flags);
|
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),
|
SYSCTL_ADD_OPAQUE(&sc->tz_sysctl_ctx, SYSCTL_CHILDREN(sc->tz_sysctl_tree),
|
||||||
OID_AUTO, "_ACx", CTLFLAG_RD, &sc->tz_zone.ac,
|
OID_AUTO, "_ACx", CTLFLAG_RD, &sc->tz_zone.ac,
|
||||||
sizeof(sc->tz_zone.ac), "IK", "");
|
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
|
* Create thread to service all of the thermal zones. Register
|
||||||
@ -748,6 +764,30 @@ acpi_tz_temp_sysctl(SYSCTL_HANDLER_ARGS)
|
|||||||
return (0);
|
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
|
static void
|
||||||
acpi_tz_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context)
|
acpi_tz_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user