summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpica
diff options
context:
space:
mode:
authornjl <njl@FreeBSD.org>2004-05-07 05:22:38 +0000
committernjl <njl@FreeBSD.org>2004-05-07 05:22:38 +0000
commit055815ed7e46944882d8d61591fbbd5d1e390a84 (patch)
tree9006c91f89da2e5720d976ecff27f6610c16d209 /sys/dev/acpica
parentf822beb73630f72486689173c8a0ef9670e15c56 (diff)
downloadFreeBSD-src-055815ed7e46944882d8d61591fbbd5d1e390a84.zip
FreeBSD-src-055815ed7e46944882d8d61591fbbd5d1e390a84.tar.gz
Change hw.acpi.cpu.cx_lowest to accept values in the form of C1,
C2, ... Update power_profile to use the new format. Update the man page to reflect this and give more info on Cx states.
Diffstat (limited to 'sys/dev/acpica')
-rw-r--r--sys/dev/acpica/acpi_cpu.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c
index 3a9279c..f92c4b1f 100644
--- a/sys/dev/acpica/acpi_cpu.c
+++ b/sys/dev/acpica/acpi_cpu.c
@@ -739,10 +739,8 @@ acpi_cpu_startup_cx()
sc = device_get_softc(cpu_devices[0]);
sbuf_new(&sb, cpu_cx_supported, sizeof(cpu_cx_supported), SBUF_FIXEDLEN);
- for (i = 0; i < cpu_cx_count; i++) {
- sbuf_printf(&sb, "C%d/%d ", sc->cpu_cx_states[i].type,
- sc->cpu_cx_states[i].trans_lat);
- }
+ for (i = 0; i < cpu_cx_count; i++)
+ sbuf_printf(&sb, "C%d/%d ", i + 1, sc->cpu_cx_states[i].trans_lat);
sbuf_trim(&sb);
sbuf_finish(&sb);
SYSCTL_ADD_STRING(&acpi_cpu_sysctl_ctx,
@@ -751,8 +749,8 @@ acpi_cpu_startup_cx()
0, "Cx/microsecond values for supported Cx states");
SYSCTL_ADD_PROC(&acpi_cpu_sysctl_ctx,
SYSCTL_CHILDREN(acpi_cpu_sysctl_tree),
- OID_AUTO, "cx_lowest", CTLTYPE_INT | CTLFLAG_RW,
- NULL, 0, acpi_cpu_cx_lowest_sysctl, "I",
+ OID_AUTO, "cx_lowest", CTLTYPE_STRING | CTLFLAG_RW,
+ NULL, 0, acpi_cpu_cx_lowest_sysctl, "A",
"lowest Cx sleep state to use");
SYSCTL_ADD_PROC(&acpi_cpu_sysctl_ctx,
SYSCTL_CHILDREN(acpi_cpu_sysctl_tree),
@@ -1085,7 +1083,8 @@ acpi_cpu_history_sysctl(SYSCTL_HANDLER_ARGS)
}
sbuf_trim(&sb);
sbuf_finish(&sb);
- sysctl_handle_string(oidp, sbuf_data(&sb), 0, req);
+ sysctl_handle_string(oidp, sbuf_data(&sb), sbuf_len(&sb), req);
+ sbuf_delete(&sb);
return (0);
}
@@ -1094,13 +1093,17 @@ static int
acpi_cpu_cx_lowest_sysctl(SYSCTL_HANDLER_ARGS)
{
struct acpi_cpu_softc *sc;
+ char state[8];
int val, error, i;
sc = device_get_softc(cpu_devices[0]);
- val = cpu_cx_lowest;
- error = sysctl_handle_int(oidp, &val, 0, req);
+ snprintf(state, sizeof(state), "C%d", cpu_cx_lowest + 1);
+ error = sysctl_handle_string(oidp, state, sizeof(state), req);
if (error != 0 || req->newptr == NULL)
return (error);
+ if (strlen(state) < 2 || toupper(state[0]) != 'C')
+ return (EINVAL);
+ val = (int) strtol(state + 1, NULL, 10) - 1;
if (val < 0 || val > cpu_cx_count - 1)
return (EINVAL);
OpenPOWER on IntegriCloud