diff options
Diffstat (limited to 'tools/power/cpupower/utils/helpers/misc.c')
-rw-r--r-- | tools/power/cpupower/utils/helpers/misc.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/tools/power/cpupower/utils/helpers/misc.c b/tools/power/cpupower/utils/helpers/misc.c index 1609243f5c64..601d719d4e60 100644 --- a/tools/power/cpupower/utils/helpers/misc.c +++ b/tools/power/cpupower/utils/helpers/misc.c | |||
@@ -2,11 +2,14 @@ | |||
2 | 2 | ||
3 | #include "helpers/helpers.h" | 3 | #include "helpers/helpers.h" |
4 | 4 | ||
5 | #define MSR_AMD_HWCR 0xc0010015 | ||
6 | |||
5 | int cpufreq_has_boost_support(unsigned int cpu, int *support, int *active, | 7 | int cpufreq_has_boost_support(unsigned int cpu, int *support, int *active, |
6 | int *states) | 8 | int *states) |
7 | { | 9 | { |
8 | struct cpupower_cpu_info cpu_info; | 10 | struct cpupower_cpu_info cpu_info; |
9 | int ret; | 11 | int ret; |
12 | unsigned long long val; | ||
10 | 13 | ||
11 | *support = *active = *states = 0; | 14 | *support = *active = *states = 0; |
12 | 15 | ||
@@ -16,10 +19,22 @@ int cpufreq_has_boost_support(unsigned int cpu, int *support, int *active, | |||
16 | 19 | ||
17 | if (cpupower_cpu_info.caps & CPUPOWER_CAP_AMD_CBP) { | 20 | if (cpupower_cpu_info.caps & CPUPOWER_CAP_AMD_CBP) { |
18 | *support = 1; | 21 | *support = 1; |
19 | amd_pci_get_num_boost_states(active, states); | 22 | |
20 | if (ret <= 0) | 23 | /* AMD Family 0x17 does not utilize PCI D18F4 like prior |
21 | return ret; | 24 | * families and has no fixed discrete boost states but |
22 | *support = 1; | 25 | * has Hardware determined variable increments instead. |
26 | */ | ||
27 | |||
28 | if (cpu_info.family == 0x17) { | ||
29 | if (!read_msr(cpu, MSR_AMD_HWCR, &val)) { | ||
30 | if (!(val & CPUPOWER_AMD_CPBDIS)) | ||
31 | *active = 1; | ||
32 | } | ||
33 | } else { | ||
34 | ret = amd_pci_get_num_boost_states(active, states); | ||
35 | if (ret) | ||
36 | return ret; | ||
37 | } | ||
23 | } else if (cpupower_cpu_info.caps & CPUPOWER_CAP_INTEL_IDA) | 38 | } else if (cpupower_cpu_info.caps & CPUPOWER_CAP_INTEL_IDA) |
24 | *support = *active = 1; | 39 | *support = *active = 1; |
25 | return 0; | 40 | return 0; |