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 * Scale up frequency for the core specified by core_num.
120 * The core number to change frequency
124 * - Negative on error.
126 int power_manager_scale_core_up(unsigned core_num);
129 * Scale down frequency for the core specified by core_num.
133 * The core number to change frequency
137 * - 0 if frequency not changed.
138 * - Negative on error.
140 int power_manager_scale_core_down(unsigned core_num);
143 * Scale to minimum frequency for the core specified by core_num.
147 * The core number to change frequency
151 * - 0 if frequency not changed.
152 * - Negative on error.
154 int power_manager_scale_core_min(unsigned core_num);
157 * Scale to maximum frequency for the core specified by core_num.
161 * The core number to change frequency
165 * - 0 if frequency not changed.
166 * - Negative on error.
168 int power_manager_scale_core_max(unsigned core_num);
171 * Get the current freuency of the core specified by core_num
174 * The core number to get the current frequency
178 * - >0 for current frequency.
180 uint32_t power_manager_get_current_frequency(unsigned core_num);
188 #endif /* POWER_MANAGER_H_ */