-
Notifications
You must be signed in to change notification settings - Fork 66
/
Copy pathconfig.h
87 lines (72 loc) · 1.47 KB
/
config.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
#ifndef __CONFIG_H__
#define __CONFIG_H__
#include "util.h"
#define MAP_SIZE 4096UL
#define MAP_MASK (MAP_SIZE - 1)
#define MSR_ADDR_TEMPERATURE 0x1a2
#define MSR_ADDR_UNITS 0x606
#define MSR_ADDR_VOLTAGE 0x150
struct undervolt_t {
int index;
char * title;
float value;
};
struct power_domain_t {
const char * name;
size_t mem_addr;
int msr_addr;
};
static struct power_domain_t power_domains[1] = {
{ "package", 0xfed159a0, 0x610 }
};
struct power_limit_value_t {
int power;
float time_window;
bool enabled;
};
struct power_limit_t {
bool apply;
struct power_limit_value_t short_term;
struct power_limit_value_t long_term;
void * mem;
};
struct hwp_power_term_t {
bool and;
char * domain;
bool greater;
double power;
};
struct hwp_hint_t {
bool force;
bool load;
bool load_multi;
float load_threshold;
bool power;
struct array_t * hwp_power_terms;
char * load_hint;
char * normal_hint;
};
enum daemon_action_kind {
DAEMON_ACTION_KIND_UNDERVOLT,
DAEMON_ACTION_KIND_POWER,
DAEMON_ACTION_KIND_TJOFFSET
};
struct daemon_action_t {
enum daemon_action_kind kind;
bool once;
};
struct config_t {
int fd_msr;
int fd_mem;
bool enable;
struct array_t * undervolts;
struct power_limit_t power[ARRAY_SIZE(power_domains)];
bool tjoffset_apply;
float tjoffset;
struct array_t * hwp_hints;
int interval;
struct array_t * daemon_actions;
};
void free_config(struct config_t * config);
struct config_t * load_config(struct config_t * old_config, bool * nl);
#endif