Module Name: src
Committed By: jruoho
Date: Thu Oct 27 05:25:08 UTC 2011
Modified Files:
src/share/man/man9: cpufreq.9
src/sys/dev/acpi: acpi_cpu.c
src/sys/kern: subr_cpufreq.c
Log Message:
Revert the revision 1.5 in cpufreq(9). Instead, document that the KPI can
not be used before interrupts have been enabled. Suggested by macallan@.
To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/share/man/man9/cpufreq.9
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/acpi/acpi_cpu.c
cvs rdiff -u -r1.7 -r1.8 src/sys/kern/subr_cpufreq.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/share/man/man9/cpufreq.9
diff -u src/share/man/man9/cpufreq.9:1.5 src/share/man/man9/cpufreq.9:1.6
--- src/share/man/man9/cpufreq.9:1.5 Thu Oct 20 06:48:24 2011
+++ src/share/man/man9/cpufreq.9 Thu Oct 27 05:25:08 2011
@@ -1,4 +1,4 @@
-.\" $NetBSD: cpufreq.9,v 1.5 2011/10/20 06:48:24 jruoho Exp $ */
+.\" $NetBSD: cpufreq.9,v 1.6 2011/10/27 05:25:08 jruoho Exp $ */
.\"
.\" Copyright (c) 2011 Jukka Ruohonen <jruohonen.iki.fi>
.\" All rights reserved.
@@ -25,7 +25,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd October 20, 2011
+.Dd October 27, 2011
.Dt CPUFREQ 9
.Os
.Sh NAME
@@ -115,7 +115,11 @@ a machine-dependent backend with the fra
Only one backend can be registered.
Upon successful completion,
.Fn cpufreq_register
-returns 0.
+returns 0 and sets the frequency of all processors
+to the maximum available level.
+Note that the registration can be done
+only after interrupts have been enabled; cf.
+.Xr config_interrupts 9 .
.Pp
The following elements in
.Vt struct cpufreq
Index: src/sys/dev/acpi/acpi_cpu.c
diff -u src/sys/dev/acpi/acpi_cpu.c:1.46 src/sys/dev/acpi/acpi_cpu.c:1.47
--- src/sys/dev/acpi/acpi_cpu.c:1.46 Thu Oct 20 06:57:23 2011
+++ src/sys/dev/acpi/acpi_cpu.c Thu Oct 27 05:25:07 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu.c,v 1.46 2011/10/20 06:57:23 jruoho Exp $ */
+/* $NetBSD: acpi_cpu.c,v 1.47 2011/10/27 05:25:07 jruoho Exp $ */
/*-
* Copyright (c) 2010, 2011 Jukka Ruohonen <[email protected]>
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_cpu.c,v 1.46 2011/10/20 06:57:23 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu.c,v 1.47 2011/10/27 05:25:07 jruoho Exp $");
#include <sys/param.h>
#include <sys/cpu.h>
@@ -327,12 +327,6 @@ acpicpu_start(device_t self)
if (cpufreq_register(&cf) != 0)
aprint_error_dev(self, "failed to register cpufreq\n");
- else {
- /*
- * Initialize the states to P0.
- */
- cpufreq_set_all(sc->sc_pstate[0].ps_freq);
- }
}
}
Index: src/sys/kern/subr_cpufreq.c
diff -u src/sys/kern/subr_cpufreq.c:1.7 src/sys/kern/subr_cpufreq.c:1.8
--- src/sys/kern/subr_cpufreq.c:1.7 Tue Oct 25 18:26:09 2011
+++ src/sys/kern/subr_cpufreq.c Thu Oct 27 05:25:07 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_cpufreq.c,v 1.7 2011/10/25 18:26:09 christos Exp $ */
+/* $NetBSD: subr_cpufreq.c,v 1.8 2011/10/27 05:25:07 jruoho Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -30,11 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_cpufreq.c,v 1.7 2011/10/25 18:26:09 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_cpufreq.c,v 1.8 2011/10/27 05:25:07 jruoho Exp $");
#include <sys/param.h>
#include <sys/cpu.h>
#include <sys/cpufreq.h>
+#include <sys/kernel.h>
#include <sys/kmem.h>
#include <sys/mutex.h>
#include <sys/time.h>
@@ -62,9 +63,12 @@ cpufreq_init(void)
int
cpufreq_register(struct cpufreq *cf)
{
- uint32_t c, i, j, k;
+ uint32_t c, i, j, k, m;
int rv;
+ if (cold != 0)
+ return EBUSY;
+
KASSERT(cf != NULL);
KASSERT(cf_backend != NULL);
KASSERT(cf->cf_get_freq != NULL);
@@ -138,6 +142,8 @@ cpufreq_register(struct cpufreq *cf)
return rv;
}
+ m = cpufreq_get_max();
+ cpufreq_set_all_raw(m);
mutex_exit(&cpufreq_lock);
return 0;