After probing the available frequency settings, restore the CPU to run at

whatever frequency it started at instead of always picking the highest
frequency.  The first version of this driver attempted to do this, but it
set the speed to the first frequency in the list rather than the value it
had saved.

MFC after:	1 week
Discussed with:	rpaulo, phk
This commit is contained in:
John Baldwin 2008-05-30 22:01:09 +00:00
parent 8b461b2ba1
commit 984c25c10b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=179445

View File

@ -1078,7 +1078,8 @@ est_acpi_info(device_t dev, freq_info **freqs)
struct cf_setting *sets;
freq_info *table;
device_t perf_dev;
int count, error, i, j, maxi, maxfreq;
int count, error, i, j;
uint16_t saved_id16;
perf_dev = device_find_child(device_get_parent(dev), "acpi_perf", -1);
if (perf_dev == NULL || !device_is_attached(perf_dev))
@ -1101,7 +1102,7 @@ est_acpi_info(device_t dev, freq_info **freqs)
error = ENOMEM;
goto out;
}
maxi = maxfreq = 0;
est_get_id16(&saved_id16);
for (i = 0, j = 0; i < count; i++) {
/*
* Confirm id16 value is correct.
@ -1118,24 +1119,11 @@ est_acpi_info(device_t dev, freq_info **freqs)
table[j].id16 = sets[i].spec[0];
table[j].power = sets[i].power;
++j;
if (sets[i].freq > maxfreq) {
maxi = i;
maxfreq = sets[i].freq;
}
}
/* restore saved setting */
est_set_id16(dev, sets[i].spec[0], 0);
}
}
/*
* Set the frequency to max, so we get through boot fast, and don't
* handicap systems not running powerd.
*/
if (maxfreq != 0) {
device_printf(dev, "Setting %d MHz\n", sets[maxi].freq);
est_set_id16(dev, sets[maxi].spec[0], 0);
}
/* restore saved setting */
est_set_id16(dev, saved_id16, 0);
/* Mark end of table with a terminator. */
bzero(&table[j], sizeof(freq_info));