blob: 157fdb186ae5f6e9efe48349b5e6dbd648ef8b2d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
/*
* (C) 2011 Dave Jones.
*
* Licensed under the terms of the GNU GPL License version 2.
*
*/
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include "../x86info.h"
#include "Intel.h"
void dump_thermal_MSRs(struct cpudata *cpu)
{
unsigned long long val = 0;
if (!user_is_root)
return;
if (read_msr(cpu->number, MSR_IA32_MISC_ENABLE, &val) != 1)
return;
// tcc enabled ?
if (!(val & (1<<3)))
return;
printf("Thermal MSRs:\n");
if (read_msr(cpu->number, MSR_PM_THERM2_CTL, &val) == 1) { /* THERM2_CTL */
printf(" MSR_PM_THERM2_CTL: 0x%llx [Thermal monitor: %d]\n",
val, (val & (1<<16)) ? 2 : 1);
}
if (read_msr(cpu->number, MSR_IA32_THERM_CONTROL, &val) == 1) {
printf(" MSR_IA32_THERM_CONTROL: 0x%llx ", val);
if (val & (1<<4)) {
printf("[Software-controlled clock: %f%% duty cycle]\n",
((val >> 1) & 7) / 8.);
} else
printf("[Software-controlled clock disabled (full speed)]\n");
}
if (read_msr (cpu->number, MSR_IA32_THERM_STATUS, &val) == 1) { /* THERM_STATUS */
printf(" MSR_IA32_THERM_STATUS: 0x%llx", val);
if (val & (1<<0|1<<1)) {
printf(" [");
if (val & (1<<0))
printf("TooHot ");
if (val & (1<<1))
printf("WasTooHot ");
printf("]");
}
printf("\n");
}
printf("\n");
}
|