This repository has been archived by the owner on Jul 1, 2022. It is now read-only.
forked from mpollice/AmdMsrTweaker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInfo.h
91 lines (71 loc) · 1.9 KB
/
Info.h
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
* Copyright (c) Martin Kinkelin
*
* See the "License.txt" file in the root directory for infos
* about permitted and prohibited uses of this code.
*/
#pragma once
struct PStateInfo
{
int Index; // hardware index
double Multi; // internal one for 100 MHz reference
int VID;
int NBPState;
int NBVID; // family 0x10 only
};
struct NBPStateInfo
{
int Index;
double Multi; // for 200 MHz reference
int VID;
};
class Info
{
public:
int Family;
int Model;
int NumCores;
int NumPStates;
int NumNBPStates;
double MinMulti, MaxMulti; // internal ones for 100 MHz reference
double MaxSoftwareMulti; // for software (i.e., non-boost) P-states
double MinVID, MaxVID;
double VIDStep;
double multiScaleFactor;
bool IsBoostSupported;
bool IsBoostEnabled;
bool IsBoostLocked;
int NumBoostStates;
Info()
: Family(0)
, Model(0)
, NumCores(0)
, NumPStates(0)
, NumNBPStates(2) //except family 0x15, we have at least 2 NB P-States
, MinMulti(0.0), MaxMulti(0.0)
, MaxSoftwareMulti(0.0)
, MinVID(0.0), MaxVID(0.0)
, VIDStep(0.0125) //default step for pre SVI2 platforms
, multiScaleFactor(1.0) //default for 100MHz REFCLK
, IsBoostSupported(false)
, IsBoostEnabled(false)
, IsBoostLocked(false)
, NumBoostStates(0)
{
}
bool Initialize();
PStateInfo ReadPState(int index) const;
void WritePState(const PStateInfo& info) const;
NBPStateInfo ReadNBPState(int index) const;
void WriteNBPState(const NBPStateInfo& info) const;
void SetCPBDis(bool enabled) const;
void SetBoostSource(bool enabled) const;
void SetAPM(bool enabled) const;
int GetCurrentPState() const;
void SetCurrentPState(int index) const;
double DecodeVID(int vid) const;
int EncodeVID(double vid) const;
private:
double DecodeMulti(int fid, int did) const;
void EncodeMulti(double multi, int& fid, int& did) const;
};