1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2014 Intel Corporation
5 #ifndef POWER_MANAGER_H_
6 #define POWER_MANAGER_H_
12 uint64_t last_branches;
13 uint64_t last_branch_misses;
14 uint16_t global_enabled_cpus;
21 struct core_details *cd;
30 #define RTE_LOGTYPE_POWER_MANAGER RTE_LOGTYPE_USER1
32 /* Maximum number of CPUS to manage */
33 #define POWER_MGR_MAX_CPUS 64
35 * Initialize power management.
36 * Initializes resources and verifies the number of CPUs on the system.
37 * Wraps librte_power int rte_power_init(unsigned lcore_id);
41 * - Negative on error.
43 int power_manager_init(void);
46 * Exit power management. Must be called prior to exiting the application.
50 * - Negative on error.
52 int power_manager_exit(void);
55 * Scale up the frequency of the cores specified in core_mask.
59 * The uint64_t bit-mask of cores to change frequency.
63 * - Negative on error.
65 int power_manager_scale_mask_up(uint64_t core_mask);
68 * Scale down the frequency of the cores specified in core_mask.
72 * The uint64_t bit-mask of cores to change frequency.
76 * - Negative on error.
78 int power_manager_scale_mask_down(uint64_t core_mask);
81 * Scale to the minimum frequency of the cores specified in core_mask.
85 * The uint64_t bit-mask of cores to change frequency.
89 * - Negative on error.
91 int power_manager_scale_mask_min(uint64_t core_mask);
94 * Scale to the maximum frequency of the cores specified in core_mask.
98 * The uint64_t bit-mask of cores to change frequency.
102 * - Negative on error.
104 int power_manager_scale_mask_max(uint64_t core_mask);
107 * Enable Turbo Boost on the cores specified in core_mask.
111 * The uint64_t bit-mask of cores to change frequency.
115 * - Negative on error.
117 int power_manager_enable_turbo_mask(uint64_t core_mask);
120 * Disable Turbo Boost on the cores specified in core_mask.
124 * The uint64_t bit-mask of cores to change frequency.
128 * - Negative on error.
130 int power_manager_disable_turbo_mask(uint64_t core_mask);
133 * Scale up frequency for the core specified by core_num.
137 * The core number to change frequency
141 * - Negative on error.
143 int power_manager_scale_core_up(unsigned core_num);
146 * Scale down frequency for the core specified by core_num.
150 * The core number to change frequency
154 * - 0 if frequency not changed.
155 * - Negative on error.
157 int power_manager_scale_core_down(unsigned core_num);
160 * Scale to minimum frequency for the core specified by core_num.
164 * The core number to change frequency
168 * - 0 if frequency not changed.
169 * - Negative on error.
171 int power_manager_scale_core_min(unsigned core_num);
174 * Scale to maximum frequency for the core specified by core_num.
178 * The core number to change frequency
182 * - 0 if frequency not changed.
183 * - Negative on error.
185 int power_manager_scale_core_max(unsigned core_num);
188 * Enable Turbo Boost for the core specified by core_num.
192 * The core number to boost
196 * - Negative on error.
198 int power_manager_enable_turbo_core(unsigned int core_num);
201 * Disable Turbo Boost for the core specified by core_num.
205 * The core number to boost
209 * - Negative on error.
211 int power_manager_disable_turbo_core(unsigned int core_num);
214 * Get the current freuency of the core specified by core_num
217 * The core number to get the current frequency
221 * - >0 for current frequency.
223 uint32_t power_manager_get_current_frequency(unsigned core_num);
226 * Scale to medium frequency for the core specified by core_num.
230 * The core number to change frequency
234 * - 0 if frequency not changed.
235 * - Negative on error.
237 int power_manager_scale_core_med(unsigned int core_num);
244 #endif /* POWER_MANAGER_H_ */