head	1.18;
access;
symbols
	RELENG_8_4:1.18.0.2
	RELENG_9_1_0_RELEASE:1.13.4.1.4.2
	RELENG_9_1:1.13.4.1.0.4
	RELENG_9_1_BP:1.13.4.1
	RELENG_8_3_0_RELEASE:1.13.2.1.8.1
	RELENG_8_3:1.13.2.1.0.8
	RELENG_8_3_BP:1.13.2.1
	RELENG_9_0_0_RELEASE:1.13.4.1.2.1
	RELENG_9_0:1.13.4.1.0.2
	RELENG_9_0_BP:1.13.4.1
	RELENG_9:1.13.0.4
	RELENG_9_BP:1.13
	RELENG_7_4_0_RELEASE:1.11.2.1.8.1
	RELENG_8_2_0_RELEASE:1.13.2.1.6.1
	RELENG_7_4:1.11.2.1.0.8
	RELENG_7_4_BP:1.11.2.1
	RELENG_8_2:1.13.2.1.0.6
	RELENG_8_2_BP:1.13.2.1
	RELENG_8_1_0_RELEASE:1.13.2.1.4.1
	RELENG_8_1:1.13.2.1.0.4
	RELENG_8_1_BP:1.13.2.1
	RELENG_7_3_0_RELEASE:1.11.2.1.6.1
	RELENG_7_3:1.11.2.1.0.6
	RELENG_7_3_BP:1.11.2.1
	RELENG_8_0_0_RELEASE:1.13.2.1.2.1
	RELENG_8_0:1.13.2.1.0.2
	RELENG_8_0_BP:1.13.2.1
	RELENG_8:1.13.0.2
	RELENG_8_BP:1.13
	RELENG_7_2_0_RELEASE:1.11.2.1.4.1
	RELENG_7_2:1.11.2.1.0.4
	RELENG_7_2_BP:1.11.2.1
	RELENG_7_1_0_RELEASE:1.11.2.1.2.1
	RELENG_6_4_0_RELEASE:1.7.2.4.2.1
	RELENG_7_1:1.11.2.1.0.2
	RELENG_7_1_BP:1.11.2.1
	RELENG_6_4:1.7.2.4.0.2
	RELENG_6_4_BP:1.7.2.4
	RELENG_7_0_0_RELEASE:1.11.4.1
	RELENG_6_3_0_RELEASE:1.7.2.3
	RELENG_7_0:1.11.0.4
	RELENG_7_0_BP:1.11
	RELENG_6_3:1.7.2.3.0.2
	RELENG_6_3_BP:1.7.2.3
	RELENG_7:1.11.0.2
	RELENG_7_BP:1.11
	RELENG_6_2_0_RELEASE:1.7.2.1
	RELENG_6_2:1.7.2.1.0.4
	RELENG_6_2_BP:1.7.2.1
	RELENG_5_5_0_RELEASE:1.3.2.3
	RELENG_5_5:1.3.2.3.0.4
	RELENG_5_5_BP:1.3.2.3
	RELENG_6_1_0_RELEASE:1.7.2.1
	RELENG_6_1:1.7.2.1.0.2
	RELENG_6_1_BP:1.7.2.1
	RELENG_6_0_0_RELEASE:1.7
	RELENG_6_0:1.7.0.4
	RELENG_6_0_BP:1.7
	RELENG_6:1.7.0.2
	RELENG_6_BP:1.7
	RELENG_5_4_0_RELEASE:1.3.2.3
	RELENG_5_4:1.3.2.3.0.2
	RELENG_5_4_BP:1.3.2.3
	RELENG_5_3_0_RELEASE:1.3.2.1
	RELENG_5_3:1.3.2.1.0.2
	RELENG_5_3_BP:1.3.2.1
	RELENG_5:1.3.0.2
	RELENG_5_BP:1.3;
locks; strict;
comment	@# @;


1.18
date	2012.11.17.01.49.05;	author svnexp;	state Exp;
branches
	1.18.2.1;
next	1.17;

1.17
date	2012.09.11.06.25.10;	author avg;	state Exp;
branches;
next	1.16;

1.16
date	2012.07.13.06.46.09;	author kevlo;	state Exp;
branches;
next	1.15;

1.15
date	2012.07.02.17.55.29;	author sbruno;	state Exp;
branches;
next	1.14;

1.14
date	2012.07.02.16.57.13;	author sbruno;	state Exp;
branches;
next	1.13;

1.13
date	2008.06.23.22.06.28;	author mtm;	state Exp;
branches
	1.13.2.1
	1.13.4.1;
next	1.12;

1.12
date	2007.12.08.23.00.28;	author dougb;	state Exp;
branches;
next	1.11;

1.11
date	2007.04.02.22.53.07;	author des;	state Exp;
branches
	1.11.2.1
	1.11.4.1;
next	1.10;

1.10
date	2007.01.07.21.53.42;	author njl;	state Exp;
branches;
next	1.9;

1.9
date	2005.12.21.01.19.20;	author dougb;	state Exp;
branches;
next	1.8;

1.8
date	2005.07.22.00.57.04;	author obrien;	state Exp;
branches;
next	1.7;

1.7
date	2005.02.26.20.17.07;	author njl;	state Exp;
branches
	1.7.2.1;
next	1.6;

1.6
date	2005.02.25.23.14.41;	author njl;	state Exp;
branches;
next	1.5;

1.5
date	2005.02.06.21.12.25;	author njl;	state Exp;
branches;
next	1.4;

1.4
date	2004.10.07.13.55.26;	author mtm;	state Exp;
branches;
next	1.3;

1.3
date	2004.05.07.05.22.38;	author njl;	state Exp;
branches
	1.3.2.1;
next	1.2;

1.2
date	2004.03.08.12.25.05;	author pjd;	state Exp;
branches;
next	1.1;

1.1
date	2003.12.18.04.39.57;	author njl;	state Exp;
branches;
next	;

1.18.2.1
date	2012.11.17.01.49.05;	author svnexp;	state dead;
branches;
next	1.18.2.2;

1.18.2.2
date	2013.03.28.13.02.44;	author svnexp;	state Exp;
branches;
next	;

1.13.2.1
date	2009.08.03.08.13.06;	author kensmith;	state Exp;
branches
	1.13.2.1.2.1
	1.13.2.1.4.1
	1.13.2.1.6.1
	1.13.2.1.8.1;
next	1.13.2.2;

1.13.2.2
date	2012.10.06.19.06.23;	author avg;	state Exp;
branches;
next	1.13.2.3;

1.13.2.3
date	2012.11.17.10.35.57;	author svnexp;	state Exp;
branches;
next	;

1.13.2.1.2.1
date	2009.10.25.01.10.29;	author kensmith;	state Exp;
branches;
next	;

1.13.2.1.4.1
date	2010.06.14.02.09.06;	author kensmith;	state Exp;
branches;
next	;

1.13.2.1.6.1
date	2010.12.21.17.09.25;	author kensmith;	state Exp;
branches;
next	;

1.13.2.1.8.1
date	2012.03.03.06.15.13;	author kensmith;	state Exp;
branches;
next	1.13.2.1.8.2;

1.13.2.1.8.2
date	2012.11.17.08.24.38;	author svnexp;	state Exp;
branches;
next	;

1.13.4.1
date	2011.09.23.00.51.37;	author kensmith;	state Exp;
branches
	1.13.4.1.2.1
	1.13.4.1.4.1;
next	1.13.4.2;

1.13.4.2
date	2012.10.06.19.06.09;	author avg;	state Exp;
branches;
next	1.13.4.3;

1.13.4.3
date	2012.11.17.11.36.11;	author svnexp;	state Exp;
branches;
next	;

1.13.4.1.2.1
date	2011.11.11.04.20.22;	author kensmith;	state Exp;
branches;
next	1.13.4.1.2.2;

1.13.4.1.2.2
date	2012.11.17.08.36.11;	author svnexp;	state Exp;
branches;
next	;

1.13.4.1.4.1
date	2012.08.05.23.54.33;	author kensmith;	state Exp;
branches;
next	1.13.4.1.4.2;

1.13.4.1.4.2
date	2012.11.17.08.47.01;	author svnexp;	state Exp;
branches;
next	;

1.11.2.1
date	2008.01.29.00.18.08;	author dougb;	state Exp;
branches
	1.11.2.1.2.1
	1.11.2.1.4.1
	1.11.2.1.6.1
	1.11.2.1.8.1;
next	1.11.2.2;

1.11.2.2
date	2012.11.17.08.01.22;	author svnexp;	state Exp;
branches;
next	;

1.11.2.1.2.1
date	2008.11.25.02.59.29;	author kensmith;	state Exp;
branches;
next	;

1.11.2.1.4.1
date	2009.04.15.03.14.26;	author kensmith;	state Exp;
branches;
next	;

1.11.2.1.6.1
date	2010.02.10.00.26.20;	author kensmith;	state Exp;
branches;
next	;

1.11.2.1.8.1
date	2010.12.21.17.10.29;	author kensmith;	state Exp;
branches;
next	1.11.2.1.8.2;

1.11.2.1.8.2
date	2012.11.17.08.16.37;	author svnexp;	state Exp;
branches;
next	;

1.11.4.1
date	2008.01.29.00.22.33;	author dougb;	state Exp;
branches;
next	;

1.7.2.1
date	2005.12.15.16.47.06;	author obrien;	state Exp;
branches;
next	1.7.2.2;

1.7.2.2
date	2007.01.23.07.21.23;	author njl;	state Exp;
branches;
next	1.7.2.3;

1.7.2.3
date	2007.05.24.16.14.37;	author des;	state Exp;
branches;
next	1.7.2.4;

1.7.2.4
date	2008.01.29.00.33.16;	author dougb;	state Exp;
branches
	1.7.2.4.2.1;
next	1.7.2.5;

1.7.2.5
date	2012.11.17.07.39.08;	author svnexp;	state Exp;
branches;
next	;

1.7.2.4.2.1
date	2008.10.02.02.57.24;	author kensmith;	state Exp;
branches;
next	;

1.3.2.1
date	2004.10.10.09.50.54;	author mtm;	state Exp;
branches;
next	1.3.2.2;

1.3.2.2
date	2005.02.25.21.46.27;	author njl;	state Exp;
branches;
next	1.3.2.3;

1.3.2.3
date	2005.02.26.20.18.29;	author njl;	state Exp;
branches;
next	;


desc
@@


1.18
log
@Switching exporter and resync
@
text
@#!/bin/sh
#
# Modify the power profile based on AC line state.  This script is
# usually called from devd(8).
#
# Arguments: 0x00 (AC offline, economy) or 0x01 (AC online, performance)
#
# $FreeBSD: head/etc/rc.d/power_profile 240343 2012-09-11 06:25:10Z avg $
#

# PROVIDE: power_profile
# REQUIRE: FILESYSTEMS syslogd
# KEYWORD: nojail nostart

. /etc/rc.subr

name="power_profile"
stop_cmd=':'
LOGGER="logger -t power_profile -p daemon.notice"

# Set a given sysctl node to a value.
#
# Variables:
# $node: sysctl node to set with the new value
# $value: HIGH for the highest performance value, LOW for the best
#	  economy value, or the value itself.
# $highest_value: maximum value for this sysctl, when $value is "HIGH"
# $lowest_value: minimum value for this sysctl, when $value is "LOW"
#
sysctl_set()
{
	# Check if the node exists
	if [ -z "$(sysctl -n ${node} 2> /dev/null)" ]; then
		return
	fi

	# Get the new value, checking for special types HIGH or LOW
	case ${value} in
	[Hh][Ii][Gg][Hh])
		value=${highest_value}
		;;
	[Ll][Oo][Ww])
		value=${lowest_value}
		;;
	[Nn][Oo][Nn][Ee])
		return
		;;
	*)
		;;
	esac

	# Set the desired value
	if [ -n "${value}" ]; then
		if ! sysctl ${node}=${value} > /dev/null 2>&1; then
			warn "unable to set ${node}=${value}"
		fi
	fi
}

if [ $# -ne 1 ]; then
	err 1 "Usage: $0 [0x00|0x01]"
fi
load_rc_config $name

# Find the next state (performance or economy).
state=$1
case ${state} in
0x01 | '')
	${LOGGER} "changed to 'performance'"
	profile="performance"
	;;
0x00)
	${LOGGER} "changed to 'economy'"
	profile="economy"
	;;
*)
	echo "Usage: $0 [0x00|0x01]"
	exit 1
esac

# Set the various sysctls based on the profile's values.
node="hw.acpi.cpu.cx_lowest"
highest_value="C1"
lowest_value="Cmax"
eval value=\$${profile}_cx_lowest
sysctl_set

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
@


1.18.2.1
log
@file power_profile was added on branch RELENG_8_4 on 2013-03-28 13:02:44 +0000
@
text
@d1 96
@


1.18.2.2
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/248810
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@a0 96
#!/bin/sh
#
# Modify the power profile based on AC line state.  This script is
# usually called from devd(8).
#
# Arguments: 0x00 (AC offline, economy) or 0x01 (AC online, performance)
#
# $FreeBSD: releng/8.4/etc/rc.d/power_profile 241278 2012-10-06 19:06:23Z avg $
#

# PROVIDE: power_profile
# REQUIRE: FILESYSTEMS syslogd
# KEYWORD: nojail nostart

. /etc/rc.subr

name="power_profile"
stop_cmd=':'
LOGGER="logger -t power_profile -p daemon.notice"

# Set a given sysctl node to a value.
#
# Variables:
# $node: sysctl node to set with the new value
# $value: HIGH for the highest performance value, LOW for the best
#	  economy value, or the value itself.
# $highest_value: maximum value for this sysctl, when $value is "HIGH"
# $lowest_value: minimum value for this sysctl, when $value is "LOW"
#
sysctl_set ()
{
	# Check if the node exists
	if [ -z "$(sysctl -n ${node} 2> /dev/null)" ]; then
		return
	fi

	# Get the new value, checking for special types HIGH or LOW
	case ${value} in
	[Hh][Ii][Gg][Hh])
		value=${highest_value}
		;;
	[Ll][Oo][Ww])
		value=${lowest_value}
		;;
	[Nn][Oo][Nn][Ee])
		return
		;;
	*)
		;;
	esac

	# Set the desired value
	if [ -n "${value}" ]; then
		if ! sysctl ${node}=${value} > /dev/null 2>&1; then
			warn "unable to set ${node}=${value}"
		fi
	fi
}

if [ $# -ne 1 ]; then
	err 1 "Usage: $0 [0x00|0x01]"
fi
load_rc_config $name

# Find the next state (performance or economy).
state=$1
case ${state} in
0x01 | '')
	${LOGGER} "changed to 'performance'"
	profile="performance"
	;;
0x00)
	${LOGGER} "changed to 'economy'"
	profile="economy"
	;;
*)
	echo "Usage: $0 [0x00|0x01]"
	exit 1
esac

# Set the various sysctls based on the profile's values.
node="hw.acpi.cpu.cx_lowest"
highest_value="C1"
lowest_value="Cmax"
eval value=\$${profile}_cx_lowest
sysctl_set

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
@


1.17
log
@SVN rev 240343 on 2012-09-11 06:25:10Z by avg

rc.d/power_profile: use recently added Cmax for cx_lowest

Trying to determine current lowest C-state after an AC event is racy
with C-states actually being changed by ACPI platform and kernel driver.

MFC after:	3 weeks
@
text
@d8 1
a8 1
# $FreeBSD$
@


1.16
log
@SVN rev 238416 on 2012-07-13 06:46:09Z by kevlo

Whitespace nit
@
text
@d84 1
a84 2
lowest_value="`(sysctl -n dev.cpu.0.cx_supported | \
	awk '{ print "C" split($0, a) }' -) 2> /dev/null`"
@


1.15
log
@SVN rev 238009 on 2012-07-02 17:55:29Z by sbruno

Revert r238004 as more review has come in and there is now a discussion
on how to best proceed.
@
text
@d30 1
a30 1
sysctl_set ()
@


1.14
log
@SVN rev 238004 on 2012-07-02 16:57:13Z by sbruno

Cosmetic display change of Cx states via cx_supported sysctl entries.

Adjust power_profile script to handle the new world order as well.

Some vendors are opting out of a C2 state and only defining C1 & C3.  This
leads the acpi_cpu display to indicate that the machine supports C1 & C2
which is caused by the (mis)use of the index of the cx_state array as the
ACPI_STATE_CX value.

e.g. the code was pretending that cx_state[i] would
always convert to i by subtracting 1.

cx_state[2] == ACPI_STATE_C3
cx_state[1] == ACPI_STATE_C2
cx_state[0] == ACPI_STATE_C1

however, on certain machines this would lead to
cx_state[1] == ACPI_STATE_C3
cx_state[0] == ACPI_STATE_C1

This didn't break anything but led to a display of:
 * dev.cpu.0.cx_supported: C1/1 C2/96

Instead of
 * dev.cpu.0.cx_supported: C1/1 C3/96

MFC after:	2 weeks
@
text
@d93 1
a93 1
	awk '{ split($0, a, "[ /]"); print a[length(a) - 1] }' -) 2> /dev/null`"
@


1.13
log
@SVN rev 179965 on 2008-06-23 22:06:28Z by mtm

The sysctl(8) program exits on some errors and only emits warnings on
others. In the case where it displayed warnings it would still return
succesfully. Modify it so that it returns the number of sysctls that
it was not able to set.

Make use of this in rc.d to display only *unsuccessfull* attempts to
set sysctls.
@
text
@d93 1
a93 1
	awk '{ split($0, a, "[/ ]"); print a[length(a) - 1] }' -) 2> /dev/null`"
@


1.13.4.1
log
@SVN rev 225736 on 2011-09-23 00:51:37Z by kensmith

Copy head to stable/9 as part of 9.0-RELEASE release cycle.

Approved by:	re (implicit)
@
text
@@


1.13.4.2
log
@SVN rev 241277 on 2012-10-06 19:06:09Z by avg

MFC r240343: rc.d/power_profile: use recently added Cmax for cx_lowest
@
text
@d84 2
a85 1
lowest_value="Cmax"
@


1.13.4.3
log
@## SVN ##
## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/ 242902
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ## r242902 | dteske | 2012-11-11 23:29:45 +0000 (Sun, 11 Nov 2012) | 10 lines
## SVN ##
## SVN ## Fix a regression introduced by SVN r211417 that saw the breakage of a feature
## SVN ## documented in usr.sbin/sysinstall/help/shortcuts.hlp (reproduced below):
## SVN ##
## SVN ## If /usr/sbin/sysinstall is linked to another filename, say
## SVN ## `/usr/local/bin/configPackages', then the basename will be used
## SVN ## as an implicit command name.
## SVN ##
## SVN ## Reviewed by:	adrian (co-mentor)
## SVN ## Approved by:	adrian (co-mentor)
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ##
@
text
@d8 1
a8 1
# $FreeBSD: stable/9/etc/rc.d/power_profile 241277 2012-10-06 19:06:09Z avg $
@


1.13.4.1.4.1
log
@SVN rev 239080 on 2012-08-05 23:54:33Z by kensmith

Copy stable/9 to releng/9.1 as part of the 9.1-RELEASE release process.

Approved by:	re (implicit)
@
text
@@


1.13.4.1.4.2
log
@Switch importer
@
text
@d8 1
a8 1
# $FreeBSD: releng/9.1/etc/rc.d/power_profile 180563 2008-07-16 19:22:48Z dougb $
@


1.13.4.1.2.1
log
@SVN rev 227445 on 2011-11-11 04:20:22Z by kensmith

Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
cycle.

Approved by:	re (implicit)
@
text
@@


1.13.4.1.2.2
log
@Switch importer
@
text
@d8 1
a8 1
# $FreeBSD: releng/9.0/etc/rc.d/power_profile 180563 2008-07-16 19:22:48Z dougb $
@


1.13.2.1
log
@SVN rev 196045 on 2009-08-03 08:13:06Z by kensmith

Copy head to stable/8 as part of 8.0 Release cycle.

Approved by:	re (Implicit)
@
text
@@


1.13.2.2
log
@SVN rev 241278 on 2012-10-06 19:06:23Z by avg

MFC r240343: rc.d/power_profile: use recently added Cmax for cx_lowest
@
text
@d84 2
a85 1
lowest_value="Cmax"
@


1.13.2.3
log
@## SVN ##
## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/ 242909
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ## r242909 | dim | 2012-11-12 07:47:19 +0000 (Mon, 12 Nov 2012) | 20 lines
## SVN ##
## SVN ## MFC r242625:
## SVN ##
## SVN ## Remove duplicate const specifiers in many drivers (I hope I got all of
## SVN ## them, please let me know if not).  Most of these are of the form:
## SVN ##
## SVN ## static const struct bzzt_type {
## SVN ##       [...list of members...]
## SVN ## } const bzzt_devs[] = {
## SVN ##       [...list of initializers...]
## SVN ## };
## SVN ##
## SVN ## The second const is unnecessary, as arrays cannot be modified anyway,
## SVN ## and if the elements are const, the whole thing is const automatically
## SVN ## (e.g. it is placed in .rodata).
## SVN ##
## SVN ## I have verified this does not change the binary output of a full kernel
## SVN ## build (except for build timestamps embedded in the object files).
## SVN ##
## SVN ## Reviewed by:	yongari, marius
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ##
@
text
@d8 1
a8 1
# $FreeBSD: stable/8/etc/rc.d/power_profile 241278 2012-10-06 19:06:23Z avg $
@


1.13.2.1.8.1
log
@SVN rev 232438 on 2012-03-03 06:15:13Z by kensmith

Copy stable/8 to releng/8.3 as part of 8.3-RELEASE release cycle.

Approved by:	re (implicit)
@
text
@@


1.13.2.1.8.2
log
@Switch importer
@
text
@d8 1
a8 1
# $FreeBSD: releng/8.3/etc/rc.d/power_profile 180563 2008-07-16 19:22:48Z dougb $
@


1.13.2.1.6.1
log
@SVN rev 216617 on 2010-12-21 17:09:25Z by kensmith

Copy stable/8 to releng/8.2 in preparation for FreeBSD-8.2 release.

Approved by:	re (implicit)
@
text
@@


1.13.2.1.4.1
log
@SVN rev 209145 on 2010-06-14 02:09:06Z by kensmith

Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.

Approved by:	re (implicit)
@
text
@@


1.13.2.1.2.1
log
@SVN rev 198460 on 2009-10-25 01:10:29Z by kensmith

Copy stable/8 to releng/8.0 as part of 8.0-RELEASE release procedure.

Approved by:	re (implicit)
@
text
@@


1.12
log
@Add an empty stop_cmd to the remaining scripts that don't start
daemons and don't already have one.
@
text
@d53 5
a57 1
	[ -n "${value}" ] && sysctl ${node}=${value}
@


1.11
log
@Add a dummy script, FILESYSTEMS, which depends on root and mountcritlocal
and takes over mountcritlocal's role as the early / late divider.  This
makes it far easier to add rc scripts which need to run early, such as a
startup script for zfs, which is right around the corner.

This change should be a no-op; I have verified that the only change in
rcorder's output is the insertion of FILESYSTEMS immediately after
mountcritlocal.

MFC after:	3 weeks
@
text
@d18 1
@


1.11.4.1
log
@MFC functional changes to etc:
1. yar's "dry run" patch to Makefile
2. Add zfs to the list of filesystems to check in
periodic/security/100.chksetuid
3. GC the nfslocking script, which has been superseded by lockd and statd
4. Add security warning to rc.d/jail
5. Add stop_cmd=':' to those rc.d scripts that do not start services,
but did not already have a stop_cmd.

And update comments in rc.firewall* and defaults/rc.conf.

Approved by:	re (kensmith)
@
text
@a17 1
stop_cmd=':'
@


1.11.2.1
log
@MFC functional changes to etc:
1. yar's "dry run" patch to Makefile
2. Add zfs to the list of filesystems to check in
periodic/security/100.chksetuid
3. GC the nfslocking script, which has been superseded by lockd and statd
4. Add security warning to rc.d/jail
5. Add stop_cmd=':' to those rc.d scripts that do not start services,
but did not already have a stop_cmd.
@
text
@a17 1
stop_cmd=':'
@


1.11.2.2
log
@Switch importer
@
text
@d8 1
a8 1
# $FreeBSD: stable/7/etc/rc.d/power_profile 220110 2011-03-28 19:29:30Z dougb $
@


1.11.2.1.8.1
log
@SVN rev 216618 on 2010-12-21 17:10:29Z by kensmith

Copy stable/7 to releng/7.4 in preparation for FreeBSD-7.4 release.

Approved by:	re (implicit)
@
text
@@


1.11.2.1.8.2
log
@Switch importer
@
text
@d8 1
a8 1
# $FreeBSD: releng/7.4/etc/rc.d/power_profile 175781 2008-01-29 00:18:08Z dougb $
@


1.11.2.1.6.1
log
@SVN rev 203736 on 2010-02-10 00:26:20Z by kensmith

Copy stable/7 to releng/7.3 as part of the 7.3-RELEASE process.

Approved by:	re (implicit)
@
text
@@


1.11.2.1.4.1
log
@SVN rev 191087 on 2009-04-15 03:14:26Z by kensmith

Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.

Approved by:	re (implicit)
@
text
@@


1.11.2.1.2.1
log
@SVN rev 185281 on 2008-11-25 02:59:29Z by kensmith

Create releng/7.1 in preparation for moving into RC phase of 7.1 release
cycle.

Approved by:	re (implicit)
@
text
@@


1.10
log
@Re-work Cx handling to be per-cpu and asymmetrical, fixing support on
modern dual-core systems as well.

- Parse the _CST packages for each cpu and track all the states individually,
on a per-cpu basis.

- Revert to generic FADT/P_BLK based Cx control if the _CST package
is not present on all cpus. In that case, the new driver will
still support per-cpu Cx state handling. The driver will determine the
highest Cx level that can be supported by all the cpus and configure the
available Cx state based on that.

- Fixed the case where multiple cpus in the system share the same
registers for Cx state handling. To do that, added a new flag
parameter to the acpi_PkgGas and acpi_bus_alloc_gas functions that
enable the caller to add the RF_SHAREABLE flag.  This flag could also be
useful to other callers (acpi_throttle?) in the tree but this change is
not yet made.

- For Core Duo cpus, both cores seems to be taken out of C3 state when
any one of the cores need to transition out. This broke the short sleep
detection logic.  It is disabled now if there is more than one cpu in
the system for now as it fixed it in my case.  This quirk may need to
be re-enabled later differently.

- Added support to control cx_lowest on a per-cpu basis. There is still
a generic cx_lowest to enable changing cx_lowest for all cpus with a single
sysctl and for ease of use.  Sample output for the new sysctl:

dev.cpu.0.cx_supported: C1/1 C2/1 C3/57
dev.cpu.0.cx_lowest: C3
dev.cpu.0.cx_usage: 0.00% 43.16% 56.83%
dev.cpu.1.cx_supported: C1/1 C2/1 C3/57
dev.cpu.1.cx_lowest: C3
dev.cpu.1.cx_usage: 0.00% 45.65% 54.34%
hw.acpi.cpu.cx_lowest: C3

This work was done by Stephane E. Potvin with some simple reworking by
myself.  Thank you.

Submitted by:	Stephane E. Potvin <sepotvin / videotron.ca>
MFC after:	2 weeks
@
text
@d12 1
a12 1
# REQUIRE: mountcritlocal syslogd
@


1.9
log
@REQUIRE: syslogd and BEFORE: NETWORKING are now antithetical,
and including both in this file had nasty side effects on the
ordering of syslogd, as well as producing an error when running
rcorder. Remove the more bogus of the two options, which restores
proper ordering and removes the error.

There is an open question as to whether scripts with the nostart
KEYWORD should even have REQUIRE/BEFORE lines, and indeed, whether
they should be in /etc/rc.d at all, but that's for another time.
@
text
@d79 1
a79 1
lowest_value="`(sysctl -n hw.acpi.cpu.cx_supported | \
@


1.8
log
@Embellish the dependency lists - this script depends having awk(1),
and it needs syslogd due to using logger(1).
Have it run as early as possible to save battery power for laptop users.
@
text
@a13 1
# BEFORE: NETWORKING
@


1.7
log
@Add the ability to specify "NONE" if the user wants no change for the
given power profile.

MFC after:	1 day
@
text
@d12 1
d14 1
@


1.7.2.1
log
@MFC: rev 1.8: depends having awk(1) and it needs syslogd due to using logger(1).
@
text
@a11 1
# REQUIRE: mountcritlocal syslogd
@


1.7.2.2
log
@MFC: support for separate CPU Cx idle states
@
text
@d79 1
a79 1
lowest_value="`(sysctl -n dev.cpu.0.cx_supported | \
@


1.7.2.3
log
@MFC: add FILESYSTEMS
@
text
@d12 1
a12 1
# REQUIRE: FILESYSTEMS syslogd
@


1.7.2.4
log
@MFC a more limited set of changes that make sense for this branch:

1. GC the nfslocking script, which has been superseded by lockd and statd
2. Add security warning to rc.d/jail
3. Add stop_cmd=':' to those rc.d scripts that do not start services,
but did not already have a stop_cmd.
@
text
@a17 1
stop_cmd=':'
@


1.7.2.5
log
@Switch importer
@
text
@d8 1
a8 1
# $FreeBSD: stable/6/etc/rc.d/power_profile 175784 2008-01-29 00:33:16Z dougb $
@


1.7.2.4.2.1
log
@SVN rev 183531 on 2008-10-02 02:57:24Z by kensmith

Create releng/6.4 from stable/6 in preparation for 6.4-RC1.

Approved by:	re (implicit)
@
text
@@


1.6
log
@Quiet error messages if the requested sysctls are not present.

MFC after:	1 day
@
text
@d43 3
@


1.5
log
@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.
@
text
@d75 2
a76 2
lowest_value="$(sysctl -n hw.acpi.cpu.cx_supported | \
	awk '{ print "C" split($0, a) }' - 2> /dev/null)"
d81 4
a84 4
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)"
@


1.4
log
@Remove the requirement for the FreeBSD keyword as it no longer
makes any sense.

Discussed with: dougb, brooks
MFC after: 3 days
@
text
@d80 6
a85 4
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
@


1.3
log
@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.
@
text
@d12 1
a12 1
# KEYWORD: FreeBSD nojail nostart
@


1.3.2.1
log
@RCS file: /home/ncvs/src/etc/rc,v
----------------------------
revision 1.335
date: 2004/10/08 14:23:49;  author: mtm;  state: Exp;  lines: +0 -1
Remove an unused variable.

Submitted by: Pawel Worach <pawel.worach@@telia.com>
----------------------------
revision 1.334
date: 2004/10/07 13:55:25;  author: mtm;  state: Exp;  lines: +1 -1
Remove the requirement for the FreeBSD keyword as it no longer
makes any sense.

Discussed with: dougb, brooks
MFC after: 3 days
=============================================================================
RCS file: /home/ncvs/src/etc/rc.d/nsswitch,v
----------------------------
revision 1.4
date: 2004/09/16 17:03:12;  author: keramida;  state: Exp;  lines: +1 -1
Fix requirement of `network' to `NETWORK' because the former isn't
provided by any rc.d script.

Approved by:	mtm
=============================================================================
RCS file: /home/ncvs/src/etc/rc.d/pflog,v
----------------------------
revision 1.3
date: 2004/09/16 17:04:20;  author: keramida;  state: Exp;  lines: +1 -1
We don't have any providers of `beforenetlkm' in FreeBSD.  Remove the
dependency to it from our rc.d scripts.

Approved by:	mtm
=============================================================================

Approved by: re/scottl
@
text
@d12 1
a12 1
# KEYWORD: nojail nostart
@


1.3.2.2
log
@MFC: power_profile changes for cpufreq
@
text
@d80 4
a83 6
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
@


1.3.2.3
log
@MFC: quiet warning messages if sysctls not present, allow NONE flag.
@
text
@a42 3
	[Nn][Oo][Nn][Ee])
		return
		;;
d75 2
a76 2
lowest_value="`(sysctl -n hw.acpi.cpu.cx_supported | \
	awk '{ print "C" split($0, a) }' -) 2> /dev/null`"
d81 4
a84 4
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`"
@


1.2
log
@Mark scripts as not usable inside a jail by adding keyword 'nojail'.

Some suggestions from:	rwatson, Ruben de Groot <mail25@@bzerk.org>
@
text
@d74 1
a74 1
highest_value=0
d76 1
a76 1
	awk '{ print split($0, a) - 1 }' - 2> /dev/null)"
@


1.1
log
@Add power_profile, a script that changes the ACPI CPU Cx idle state and/or
the throttling state in response to line transitions.  Future plans
include adding support for CPU frequency changes.

Add a devd.conf entry for calling this script.

The default values for this are:
performance_cx_lowest="HIGH"       # Use HLT (C0) online
performance_throttle_state="HIGH"  # 100% (no throttling)
economy_cx_lowest="LOW"            # Use the lowest Cx state possible
economy_throttle_state="HIGH"      # 100% (no throttling)
@
text
@d12 1
a12 1
# KEYWORD: FreeBSD nostart
@

