4 * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * * Neither the name of Intel Corporation nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 #ifndef POWER_MANAGER_H_
35 #define POWER_MANAGER_H_
41 /* Maximum number of CPUS to manage */
42 #define POWER_MGR_MAX_CPUS 64
44 * Initialize power management.
45 * Initializes resources and verifies the number of CPUs on the system.
46 * Wraps librte_power int rte_power_init(unsigned lcore_id);
50 * - Negative on error.
52 int power_manager_init(void);
55 * Exit power management. Must be called prior to exiting the application.
59 * - Negative on error.
61 int power_manager_exit(void);
64 * Scale up the frequency of the cores specified in core_mask.
68 * The uint64_t bit-mask of cores to change frequency.
72 * - Negative on error.
74 int power_manager_scale_mask_up(uint64_t core_mask);
77 * Scale down the frequency of the cores specified in core_mask.
81 * The uint64_t bit-mask of cores to change frequency.
85 * - Negative on error.
87 int power_manager_scale_mask_down(uint64_t core_mask);
90 * Scale to the minimum frequency of the cores specified in core_mask.
94 * The uint64_t bit-mask of cores to change frequency.
98 * - Negative on error.
100 int power_manager_scale_mask_min(uint64_t core_mask);
103 * Scale to the maximum frequency of the cores specified in core_mask.
107 * The uint64_t bit-mask of cores to change frequency.
111 * - Negative on error.
113 int power_manager_scale_mask_max(uint64_t core_mask);
116 * Enable Turbo Boost on the cores specified in core_mask.
120 * The uint64_t bit-mask of cores to change frequency.
124 * - Negative on error.
126 int power_manager_enable_turbo_mask(uint64_t core_mask);
129 * Disable Turbo Boost on the cores specified in core_mask.
133 * The uint64_t bit-mask of cores to change frequency.
137 * - Negative on error.
139 int power_manager_disable_turbo_mask(uint64_t core_mask);
142 * Scale up frequency for the core specified by core_num.
146 * The core number to change frequency
150 * - Negative on error.
152 int power_manager_scale_core_up(unsigned core_num);
155 * Scale down frequency for the core specified by core_num.
159 * The core number to change frequency
163 * - 0 if frequency not changed.
164 * - Negative on error.
166 int power_manager_scale_core_down(unsigned core_num);
169 * Scale to minimum frequency for the core specified by core_num.
173 * The core number to change frequency
177 * - 0 if frequency not changed.
178 * - Negative on error.
180 int power_manager_scale_core_min(unsigned core_num);
183 * Scale to maximum frequency for the core specified by core_num.
187 * The core number to change frequency
191 * - 0 if frequency not changed.
192 * - Negative on error.
194 int power_manager_scale_core_max(unsigned core_num);
197 * Enable Turbo Boost for the core specified by core_num.
201 * The core number to boost
205 * - Negative on error.
207 int power_manager_enable_turbo_core(unsigned int core_num);
210 * Disable Turbo Boost for the core specified by core_num.
214 * The core number to boost
218 * - Negative on error.
220 int power_manager_disable_turbo_core(unsigned int core_num);
223 * Get the current freuency of the core specified by core_num
226 * The core number to get the current frequency
230 * - >0 for current frequency.
232 uint32_t power_manager_get_current_frequency(unsigned core_num);
235 * Scale to medium frequency for the core specified by core_num.
239 * The core number to change frequency
243 * - 0 if frequency not changed.
244 * - Negative on error.
246 int power_manager_scale_core_med(unsigned int core_num);
253 #endif /* POWER_MANAGER_H_ */