From 4b07eec8a22f883452dbc84639173d6c826bda2b Mon Sep 17 00:00:00 2001 From: njl Date: Sun, 6 Feb 2005 21:12:25 +0000 Subject: [PATCH] Add support for cpufreq to power_profile(8). Values for on/offline cpu frequencies are specified with performance_cpu_freq and economy_cpu_freq. Of course, special values LOW and HIGH are also supported. Also, remove old throttling support. --- etc/defaults/rc.conf | 4 ++-- etc/rc.d/power_profile | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/etc/defaults/rc.conf b/etc/defaults/rc.conf index 826f75abf1f4..68ba2fc7316e 100644 --- a/etc/defaults/rc.conf +++ b/etc/defaults/rc.conf @@ -471,9 +471,9 @@ devfs_system_ruleset="" # The name of a ruleset to apply to /dev devfs_set_rulesets="" # A list of /mount/dev=ruleset_name settings to # apply (must be mounted already, i.e. fstab(5)) performance_cx_lowest="LOW" # Online CPU idle state -performance_throttle_state="HIGH" # Online throttling state +performance_cpu_freq="HIGH" # Online CPU frequency economy_cx_lowest="LOW" # Offline CPU idle state -economy_throttle_state="HIGH" # Offline throttling state +economy_cpu_freq="HIGH" # Offline CPU frequency virecover_enable="YES" # Perform housekeeping for the vi(1) editor ugidfw_enable="NO" # Load mac_bsdextended(4) rules on boot bsdextended_script="/etc/rc.bsdextended" # Default mac_bsdextended(4) diff --git a/etc/rc.d/power_profile b/etc/rc.d/power_profile index 45c341a10f40..dac4b1e34529 100644 --- a/etc/rc.d/power_profile +++ b/etc/rc.d/power_profile @@ -77,10 +77,12 @@ lowest_value="$(sysctl -n hw.acpi.cpu.cx_supported | \ eval value=\$${profile}_cx_lowest sysctl_set -node="hw.acpi.cpu.throttle_state" -highest_value="$(sysctl -n hw.acpi.cpu.throttle_max 2> /dev/null)" -lowest_value="1" -eval value=\$${profile}_throttle_state +node="dev.cpu.0.freq" +highest_value="$(sysctl -n dev.cpu.0.freq_levels | \ + awk '{ split($0, a, "[/ ]"); print a[1] }' - 2> /dev/null)" +lowest_value="$(sysctl -n dev.cpu.0.freq_levels | \ + awk '{ split($0, a, "[/ ]"); print a[length(a) - 1] }' - 2> /dev/null)" +eval value=\$${profile}_cpu_freq sysctl_set exit 0