1 #ifndef __XEN_PROCESSOR_PM_H__
2 #define __XEN_PROCESSOR_PM_H__
3 
4 #include <public/platform.h>
5 #include <public/sysctl.h>
6 #include <xen/acpi.h>
7 
8 #define XEN_PX_INIT 0x80000000
9 
10 int powernow_cpufreq_init(void);
11 unsigned int powernow_register_driver(void);
12 unsigned int get_measured_perf(unsigned int cpu, unsigned int flag);
13 void cpufreq_residency_update(unsigned int, uint8_t);
14 void cpufreq_statistic_update(unsigned int, uint8_t, uint8_t);
15 int  cpufreq_statistic_init(unsigned int);
16 void cpufreq_statistic_exit(unsigned int);
17 void cpufreq_statistic_reset(unsigned int);
18 
19 int  cpufreq_limit_change(unsigned int);
20 
21 int  cpufreq_add_cpu(unsigned int);
22 int  cpufreq_del_cpu(unsigned int);
23 
24 struct processor_performance {
25     uint32_t state;
26     uint32_t platform_limit;
27     struct xen_pct_register control_register;
28     struct xen_pct_register status_register;
29     uint32_t state_count;
30     struct xen_processor_px *states;
31     struct xen_psd_package domain_info;
32     uint32_t shared_type;
33 
34     uint32_t init;
35 };
36 
37 struct processor_pminfo {
38     uint32_t acpi_id;
39     uint32_t id;
40     struct processor_performance    perf;
41 };
42 
43 extern struct processor_pminfo *processor_pminfo[NR_CPUS];
44 
45 struct px_stat {
46     uint8_t total;        /* total Px states */
47     uint8_t usable;       /* usable Px states */
48     uint8_t last;         /* last Px state */
49     uint8_t cur;          /* current Px state */
50     uint64_t *trans_pt;   /* Px transition table */
51     pm_px_val_t *pt;
52 };
53 
54 struct pm_px {
55     struct px_stat u;
56     uint64_t prev_state_wall;
57     uint64_t prev_idle_wall;
58 };
59 
60 DECLARE_PER_CPU(struct pm_px *, cpufreq_statistic_data);
61 
62 int cpufreq_cpu_init(unsigned int cpuid);
63 #endif /* __XEN_PROCESSOR_PM_H__ */
64