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
This commit is contained in:
Nate Lawson 2008-01-16 01:05:21 +00:00
parent c833fdd83f
commit e1f13773ec

View File

@ -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--;