diff options
author | Alexander Motin <mav@FreeBSD.org> | 2008-12-16 01:24:05 +0000 |
---|---|---|
committer | Alexander Motin <mav@FreeBSD.org> | 2008-12-16 01:24:05 +0000 |
commit | d288bcc4df65569fda08cc7fa86b78b70aeee4a3 (patch) | |
tree | ad0a3e772cc2b6ecee6e90b9ac5564f7b5f81b73 /sys/kern/kern_cpu.c | |
parent | 3d3728e9f8bb500191b91de8cf6a3a6f1fd79e45 (diff) |
Notes
Diffstat (limited to 'sys/kern/kern_cpu.c')
-rw-r--r-- | sys/kern/kern_cpu.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/kern/kern_cpu.c b/sys/kern/kern_cpu.c index 50fff533333e..7b0b58891b32 100644 --- a/sys/kern/kern_cpu.c +++ b/sys/kern/kern_cpu.c @@ -144,7 +144,9 @@ static int cpufreq_attach(device_t dev) { struct cpufreq_softc *sc; + struct pcpu *pc; device_t parent; + uint64_t rate; int numdevs; CF_DEBUG("initializing %s\n", device_get_nameunit(dev)); @@ -156,7 +158,12 @@ cpufreq_attach(device_t dev) CF_MTX_INIT(&sc->lock); sc->curr_level.total_set.freq = CPUFREQ_VAL_UNKNOWN; SLIST_INIT(&sc->saved_freq); - sc->max_mhz = CPUFREQ_VAL_UNKNOWN; + /* Try to get current CPU freq to use it as maximum later if needed */ + pc = cpu_get_pcpu(dev); + if (cpu_est_clockrate(pc->pc_cpuid, &rate) == 0) + sc->max_mhz = rate / 1000000; + else + sc->max_mhz = CPUFREQ_VAL_UNKNOWN; /* * Only initialize one set of sysctls for all CPUs. In the future, |