From 27739d97dc4eacfb70bddbd4c47d74b187f58d8c Mon Sep 17 00:00:00 2001 From: njl Date: Wed, 16 Jan 2008 01:05:21 +0000 Subject: Remove duplicate cpufreq levels, i.e. ones that are within 25 Mhz of each other. The first one survives, the rest are removed. So far, it appears only some acpi_perf(4) BIOS tables have these invalid states, but address this in the core to be sure to handle other potential driver data. PR: kern/114722 Tested by: stefan.lambrev / moneybookers.com MFC after: 3 days --- sys/kern/kern_cpu.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'sys') diff --git a/sys/kern/kern_cpu.c b/sys/kern/kern_cpu.c index 8320ee4..f8f8c36 100644 --- a/sys/kern/kern_cpu.c +++ b/sys/kern/kern_cpu.c @@ -606,6 +606,17 @@ cf_levels_method(device_t dev, struct cf_level *levels, int *count) /* Finally, output the list of levels. */ i = 0; TAILQ_FOREACH(lev, &sc->all_levels, link) { + /* + * Skip levels that are too close in frequency to the + * previous levels. Some systems report bogus duplicate + * settings (i.e., for acpi_perf). + */ + if (i > 0 && CPUFREQ_CMP(lev->total_set.freq, + levels[i - 1].total_set.freq)) { + sc->all_count--; + continue; + } + /* Skip levels that have a frequency that is too low. */ if (lev->total_set.freq < cf_lowest_freq) { sc->all_count--; -- cgit v1.1