diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-11 18:53:33 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-11 18:53:33 -0800 |
commit | 02d929502ce7b57f4835d8bb7c828d36e6d9e8ce (patch) | |
tree | 7bb0ca7a9bfe5c336c3125f823770934a2150ae4 /drivers/cpufreq/powernow-k8.c | |
parent | b24ca57e7625bc304e77bc429693ad32a691eb16 (diff) | |
parent | 6c523c614c13b84a3dc64f7a56d6855b03e6b292 (diff) |
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq
* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq: (23 commits)
[CPUFREQ] EXYNOS: Removed useless headers and codes
[CPUFREQ] EXYNOS: Make EXYNOS common cpufreq driver
[CPUFREQ] powernow-k8: Update copyright, maintainer and documentation information
[CPUFREQ] powernow-k8: Fix indexing issue
[CPUFREQ] powernow-k8: Avoid Pstate MSR accesses on systems supporting CPB
[CPUFREQ] update lpj only if frequency has changed
[CPUFREQ] cpufreq:userspace: fix cpu_cur_freq updation
[CPUFREQ] Remove wall variable from cpufreq_gov_dbs_init()
[CPUFREQ] EXYNOS4210: cpufreq code is changed for stable working
[CPUFREQ] EXYNOS4210: Update frequency table for cpu divider
[CPUFREQ] EXYNOS4210: Remove code about bus on cpufreq
[CPUFREQ] s3c64xx: Use pr_fmt() for consistent log messages
cpufreq: OMAP: fixup for omap_device changes, include <linux/module.h>
cpufreq: OMAP: fix freq_table leak
cpufreq: OMAP: put clk if cpu_init failed
cpufreq: OMAP: only supports OPP library
cpufreq: OMAP: dont support !freq_table
cpufreq: OMAP: deny initialization if no mpudev
cpufreq: OMAP: move clk name decision to init
cpufreq: OMAP: notify even with bad boot frequency
...
Diffstat (limited to 'drivers/cpufreq/powernow-k8.c')
-rw-r--r-- | drivers/cpufreq/powernow-k8.c | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/drivers/cpufreq/powernow-k8.c b/drivers/cpufreq/powernow-k8.c index bce576d7478..8f9b2ceeec8 100644 --- a/drivers/cpufreq/powernow-k8.c +++ b/drivers/cpufreq/powernow-k8.c @@ -1,10 +1,11 @@ /* - * (c) 2003-2010 Advanced Micro Devices, Inc. + * (c) 2003-2012 Advanced Micro Devices, Inc. * Your use of this code is subject to the terms and conditions of the * GNU general public license version 2. See "COPYING" or * http://www.gnu.org/licenses/gpl.html * - * Support : mark.langsdorf@amd.com + * Maintainer: + * Andreas Herrmann <andreas.herrmann3@amd.com> * * Based on the powernow-k7.c module written by Dave Jones. * (C) 2003 Dave Jones on behalf of SuSE Labs @@ -16,12 +17,14 @@ * Valuable input gratefully received from Dave Jones, Pavel Machek, * Dominik Brodowski, Jacob Shin, and others. * Originally developed by Paul Devriendt. - * Processor information obtained from Chapter 9 (Power and Thermal Management) - * of the "BIOS and Kernel Developer's Guide for the AMD Athlon 64 and AMD - * Opteron Processors" available for download from www.amd.com * - * Tables for specific CPUs can be inferred from - * http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/30430.pdf + * Processor information obtained from Chapter 9 (Power and Thermal + * Management) of the "BIOS and Kernel Developer's Guide (BKDG) for + * the AMD Athlon 64 and AMD Opteron Processors" and section "2.x + * Power Management" in BKDGs for newer AMD CPU families. + * + * Tables for specific CPUs can be inferred from AMD's processor + * power and thermal data sheets, (e.g. 30417.pdf, 30430.pdf, 43375.pdf) */ #include <linux/kernel.h> @@ -54,6 +57,9 @@ static DEFINE_PER_CPU(struct powernow_k8_data *, powernow_data); static int cpu_family = CPU_OPTERON; +/* array to map SW pstate number to acpi state */ +static u32 ps_to_as[8]; + /* core performance boost */ static bool cpb_capable, cpb_enabled; static struct msr __percpu *msrs; @@ -80,9 +86,9 @@ static u32 find_khz_freq_from_fid(u32 fid) } static u32 find_khz_freq_from_pstate(struct cpufreq_frequency_table *data, - u32 pstate) + u32 pstate) { - return data[pstate].frequency; + return data[ps_to_as[pstate]].frequency; } /* Return the vco fid for an input fid @@ -926,23 +932,27 @@ static int fill_powernow_table_pstate(struct powernow_k8_data *data, invalidate_entry(powernow_table, i); continue; } - rdmsr(MSR_PSTATE_DEF_BASE + index, lo, hi); - if (!(hi & HW_PSTATE_VALID_MASK)) { - pr_debug("invalid pstate %d, ignoring\n", index); - invalidate_entry(powernow_table, i); - continue; - } - powernow_table[i].index = index; + ps_to_as[index] = i; /* Frequency may be rounded for these */ if ((boot_cpu_data.x86 == 0x10 && boot_cpu_data.x86_model < 10) || boot_cpu_data.x86 == 0x11) { + + rdmsr(MSR_PSTATE_DEF_BASE + index, lo, hi); + if (!(hi & HW_PSTATE_VALID_MASK)) { + pr_debug("invalid pstate %d, ignoring\n", index); + invalidate_entry(powernow_table, i); + continue; + } + powernow_table[i].frequency = freq_from_fid_did(lo & 0x3f, (lo >> 6) & 7); } else powernow_table[i].frequency = data->acpi_data.states[i].core_frequency * 1000; + + powernow_table[i].index = index; } return 0; } @@ -1189,7 +1199,8 @@ static int powernowk8_target(struct cpufreq_policy *pol, powernow_k8_acpi_pst_values(data, newstate); if (cpu_family == CPU_HW_PSTATE) - ret = transition_frequency_pstate(data, newstate); + ret = transition_frequency_pstate(data, + data->powernow_table[newstate].index); else ret = transition_frequency_fidvid(data, newstate); if (ret) { @@ -1202,7 +1213,7 @@ static int powernowk8_target(struct cpufreq_policy *pol, if (cpu_family == CPU_HW_PSTATE) pol->cur = find_khz_freq_from_pstate(data->powernow_table, - newstate); + data->powernow_table[newstate].index); else pol->cur = find_khz_freq_from_fid(data->currfid); ret = 0; |