c1566e93e0ec4dfd92d79531b60b79d66b6ae366
[linux-2.6.git] / tools / power / cpupower / utils / helpers / misc.c
1 #if defined(__i386__) || defined(__x86_64__)
2
3 #include "helpers/helpers.h"
4
5 int cpufreq_has_boost_support(unsigned int cpu, int *support, int *active, int * states)
6 {
7         struct cpupower_cpu_info cpu_info;
8         int ret;
9
10         *support = *active = *states = 0;
11
12         ret = get_cpu_info(0, &cpu_info);
13         if (ret)
14                 return ret;
15
16         if (cpupower_cpu_info.caps & CPUPOWER_CAP_AMD_CBP) {
17                 *support = 1;
18                 amd_pci_get_num_boost_states(active, states);
19                 if (ret <= 0)
20                         return ret;
21                 *support = 1;
22         } else if (cpupower_cpu_info.vendor == X86_VENDOR_INTEL) {
23                 ret = msr_intel_has_boost_support(cpu);
24                 if (ret <= 0)
25                         return ret;
26                 *support = ret;
27                 ret = msr_intel_boost_is_active(cpu);
28                 if (ret <= 0)
29                         return ret;
30                 *active = ret;
31         }
32         return 0;
33 }
34 #endif /* #if defined(__i386__) || defined(__x86_64__) */