File tree Expand file tree Collapse file tree 1 file changed +23
-3
lines changed
tools/power/cpupower/utils/helpers Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -41,13 +41,27 @@ union core_pstate {
41
41
unsigned res1 :31 ;
42
42
unsigned en :1 ;
43
43
} pstatedef ;
44
+ /* since fam 1Ah: */
45
+ struct {
46
+ unsigned fid :12 ;
47
+ unsigned res1 :2 ;
48
+ unsigned vid :8 ;
49
+ unsigned iddval :8 ;
50
+ unsigned idddiv :2 ;
51
+ unsigned res2 :31 ;
52
+ unsigned en :1 ;
53
+ } pstatedef2 ;
44
54
unsigned long long val ;
45
55
};
46
56
47
57
static int get_did (union core_pstate pstate )
48
58
{
49
59
int t ;
50
60
61
+ /* Fam 1Ah onward do not use did */
62
+ if (cpupower_cpu_info .family >= 0x1A )
63
+ return 0 ;
64
+
51
65
if (cpupower_cpu_info .caps & CPUPOWER_CAP_AMD_PSTATEDEF )
52
66
t = pstate .pstatedef .did ;
53
67
else if (cpupower_cpu_info .family == 0x12 )
@@ -61,12 +75,18 @@ static int get_did(union core_pstate pstate)
61
75
static int get_cof (union core_pstate pstate )
62
76
{
63
77
int t ;
64
- int fid , did , cof ;
78
+ int fid , did , cof = 0 ;
65
79
66
80
did = get_did (pstate );
67
81
if (cpupower_cpu_info .caps & CPUPOWER_CAP_AMD_PSTATEDEF ) {
68
- fid = pstate .pstatedef .fid ;
69
- cof = 200 * fid / did ;
82
+ if (cpupower_cpu_info .family >= 0x1A ) {
83
+ fid = pstate .pstatedef2 .fid ;
84
+ if (fid > 0x0f )
85
+ cof = (fid * 5 );
86
+ } else {
87
+ fid = pstate .pstatedef .fid ;
88
+ cof = 200 * fid / did ;
89
+ }
70
90
} else {
71
91
t = 0x10 ;
72
92
fid = pstate .pstate .fid ;
You can’t perform that action at this time.
0 commit comments