Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Revert the revision 1.5 in cpufreq(9). Instead, document tha...
details: https://anonhg.NetBSD.org/src/rev/769cf6f82eab
branches: trunk
changeset: 770636:769cf6f82eab
user: jruoho <jruoho%NetBSD.org@localhost>
date: Thu Oct 27 05:25:07 2011 +0000
description:
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@.
diffstat:
share/man/man9/cpufreq.9 | 10 +++++++---
sys/dev/acpi/acpi_cpu.c | 10 ++--------
sys/kern/subr_cpufreq.c | 12 +++++++++---
3 files changed, 18 insertions(+), 14 deletions(-)
diffs (108 lines):
diff -r 01daf6011cb8 -r 769cf6f82eab share/man/man9/cpufreq.9
--- a/share/man/man9/cpufreq.9 Thu Oct 27 05:13:04 2011 +0000
+++ b/share/man/man9/cpufreq.9 Thu Oct 27 05:25:07 2011 +0000
@@ -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 @@
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
diff -r 01daf6011cb8 -r 769cf6f82eab sys/dev/acpi/acpi_cpu.c
--- a/sys/dev/acpi/acpi_cpu.c Thu Oct 27 05:13:04 2011 +0000
+++ b/sys/dev/acpi/acpi_cpu.c Thu Oct 27 05:25:07 2011 +0000
@@ -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 <jruohonen%iki.fi@localhost>
@@ -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 @@
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);
- }
}
}
diff -r 01daf6011cb8 -r 769cf6f82eab sys/kern/subr_cpufreq.c
--- a/sys/kern/subr_cpufreq.c Thu Oct 27 05:13:04 2011 +0000
+++ b/sys/kern/subr_cpufreq.c Thu Oct 27 05:25:07 2011 +0000
@@ -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 @@
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 @@
return rv;
}
+ m = cpufreq_get_max();
+ cpufreq_set_all_raw(m);
mutex_exit(&cpufreq_lock);
return 0;
Home |
Main Index |
Thread Index |
Old Index