misc.c 790 B

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