power.h 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. /* Intel P-state and deep C-state management. */
  2. #ifndef POWER_H
  3. #define POWER_H
  4. #define POWER_CPUFREQ_AUTO 0
  5. #define POWER_CPUFREQ_MIN 1
  6. #define POWER_CPUFREQ_MAX 2
  7. #define POWER_CPUFREQ_FIXED 3
  8. #define POWER_CPUFREQ_OFF 4
  9. /* Probe the CPU and MSRs. Nehalem/Westmere and Airmont/Braswell run the
  10. * race-to-idle P-state governor; Airmont uses the Linux Atom VID encoding
  11. * (pstate in 15:8, interpolated VID in 7:0) and caps at max non-turbo.
  12. * Called once on the BSP before idle_init(); logs to COM1 and is a no-op on
  13. * CPUs outside the allowlist. */
  14. void power_init(void);
  15. /* Once per scheduler tick with the CPU's idle flag and the tick length. */
  16. void power_tick(int idle, unsigned int ms);
  17. /* Deep C-state hint for idle.c's automatic mode: -1 = use HLT, otherwise
  18. * the MWAIT hint. Airmont returns C6N (0x58), or -1 on an AP without ARAT;
  19. * Nehalem returns C6 (0x20), or C1E on an AP whose local timer stops. */
  20. int power_idle_hint(void);
  21. /* `power` / `cpufreq` command support (terminal.c). */
  22. void power_print(void);
  23. int power_cpufreq_command(const char *arg);
  24. const char *power_cpufreq_name(void);
  25. #endif