thermal.h 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. /* CPU temperature sources: Intel DTS and AMD family 15h D18F3xA4. */
  2. #ifndef THERMAL_H
  3. #define THERMAL_H
  4. /* Probe once on the BSP (before the timer starts); logs the result to COM1. */
  5. void thermal_init(void);
  6. /* Sample this CPU's DTS. Called from the per-CPU scheduler tick, at most
  7. * once per second. The AMD package sensor is sampled from the kworker
  8. * instead (under the BKL; PCI config space is not safe to touch from a
  9. * timer interrupt on multiple CPUs). */
  10. void thermal_tick(void);
  11. /* Once-a-second AMD package sensor poll; called from system_housekeeping()
  12. * under the BKL. A no-op on Intel and when no sensor was found. */
  13. void thermal_housekeeping(void);
  14. /* Read this CPU's temperature now: degrees C, or -1 when unavailable.
  15. * On AMD this reads the package sensor, so all CPUs report the same value. */
  16. int thermal_read_this_cpu(void);
  17. /* Read this CPU's raw IA32_THERM_STATUS (Intel only): 0 on success, -1 when
  18. * unavailable. */
  19. int thermal_status_this_cpu(unsigned int *status);
  20. /* Hottest per-CPU reading cached by the ticks, or -1 when unavailable. */
  21. int thermal_max_c(void);
  22. /* TjMax used for the conversion, or 0 when DTS is unavailable. */
  23. int thermal_tjmax(void);
  24. #endif