summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_cpu.c
diff options
context:
space:
mode:
authornjl <njl@FreeBSD.org>2005-02-24 20:21:41 +0000
committernjl <njl@FreeBSD.org>2005-02-24 20:21:41 +0000
commit82088e2e10225f47b70b5977462c757282d75946 (patch)
treeee07b09c81754c27cd9affe399da0d2db35a4b43 /sys/kern/kern_cpu.c
parentdde81671fd0537a5b7e1d9c439a99c06021efcec (diff)
downloadFreeBSD-src-82088e2e10225f47b70b5977462c757282d75946.zip
FreeBSD-src-82088e2e10225f47b70b5977462c757282d75946.tar.gz
Bump the maximum number of levels to 64 and add warning messages about
what to do to fix reduced functionality if the number of levels is too low.
Diffstat (limited to 'sys/kern/kern_cpu.c')
-rw-r--r--sys/kern/kern_cpu.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/sys/kern/kern_cpu.c b/sys/kern/kern_cpu.c
index cff9da3..355b258 100644
--- a/sys/kern/kern_cpu.c
+++ b/sys/kern/kern_cpu.c
@@ -51,9 +51,9 @@ __FBSDID("$FreeBSD$");
/*
* Number of levels we can handle. Levels are synthesized from settings
- * so for N settings there may be N^2 levels.
+ * so for M settings and N drivers, there may be M*N levels.
*/
-#define CF_MAX_LEVELS 32
+#define CF_MAX_LEVELS 64
struct cpufreq_softc {
struct cf_level curr_level;
@@ -321,8 +321,11 @@ cf_get_method(device_t dev, struct cf_level *level)
if (levels == NULL)
return (ENOMEM);
error = CPUFREQ_LEVELS(sc->dev, levels, &count);
- if (error)
+ if (error) {
+ if (error == E2BIG)
+ printf("cpufreq: need to increase CF_MAX_LEVELS\n");
goto out;
+ }
error = device_get_children(device_get_parent(dev), &devs, &numdevs);
if (error)
goto out;
@@ -686,8 +689,12 @@ cpufreq_curr_sysctl(SYSCTL_HANDLER_ARGS)
for (n = 0; n < devcount; n++) {
count = CF_MAX_LEVELS;
error = CPUFREQ_LEVELS(devs[n], levels, &count);
- if (error)
+ if (error) {
+ if (error == E2BIG)
+ printf(
+ "cpufreq: need to increase CF_MAX_LEVELS\n");
break;
+ }
for (i = 0; i < count; i++) {
if (CPUFREQ_CMP(levels[i].total_set.freq, freq)) {
error = CPUFREQ_SET(devs[n], &levels[i],
@@ -727,8 +734,11 @@ cpufreq_levels_sysctl(SYSCTL_HANDLER_ARGS)
if (levels == NULL)
return (ENOMEM);
error = CPUFREQ_LEVELS(sc->dev, levels, &count);
- if (error)
+ if (error) {
+ if (error == E2BIG)
+ printf("cpufreq: need to increase CF_MAX_LEVELS\n");
goto out;
+ }
if (count) {
for (i = 0; i < count; i++) {
set = &levels[i].total_set;
OpenPOWER on IntegriCloud