1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2014 Intel Corporation
5 #ifndef _POWER_ACPI_CPUFREQ_H
6 #define _POWER_ACPI_CPUFREQ_H
10 * RTE Power Management via userspace ACPI cpufreq
13 #include "rte_power.h"
16 * Check if ACPI power management is supported.
21 * - -1 if error, with rte_errno indicating reason for error.
23 int power_acpi_cpufreq_check_supported(void);
26 * Initialize power management for a specific lcore. It will check and set the
27 * governor to userspace for the lcore, get the available frequencies, and
28 * prepare to set new lcore frequency.
35 * - Negative on error.
37 int power_acpi_cpufreq_init(unsigned int lcore_id);
40 * Exit power management on a specific lcore. It will set the governor to which
41 * is before initialized.
48 * - Negative on error.
50 int power_acpi_cpufreq_exit(unsigned int lcore_id);
53 * Get the available frequencies of a specific lcore. The return value will be
54 * the minimal one of the total number of available frequencies and the number
55 * of buffer. The index of available frequencies used in other interfaces
56 * should be in the range of 0 to this return value.
57 * It should be protected outside of this function for threadsafe.
62 * The buffer array to save the frequencies.
64 * The number of frequencies to get.
67 * The number of available frequencies.
69 uint32_t power_acpi_cpufreq_freqs(unsigned int lcore_id, uint32_t *freqs,
73 * Return the current index of available frequencies of a specific lcore. It
74 * will return 'RTE_POWER_INVALID_FREQ_INDEX = (~0)' if error.
75 * It should be protected outside of this function for threadsafe.
81 * The current index of available frequencies.
83 uint32_t power_acpi_cpufreq_get_freq(unsigned int lcore_id);
86 * Set the new frequency for a specific lcore by indicating the index of
87 * available frequencies.
88 * It should be protected outside of this function for threadsafe.
93 * The index of available frequencies.
96 * - 1 on success with frequency changed.
97 * - 0 on success without frequency changed.
98 * - Negative on error.
100 int power_acpi_cpufreq_set_freq(unsigned int lcore_id, uint32_t index);
103 * Scale up the frequency of a specific lcore according to the available
105 * It should be protected outside of this function for threadsafe.
111 * - 1 on success with frequency changed.
112 * - 0 on success without frequency changed.
113 * - Negative on error.
115 int power_acpi_cpufreq_freq_up(unsigned int lcore_id);
118 * Scale down the frequency of a specific lcore according to the available
120 * It should be protected outside of this function for threadsafe.
126 * - 1 on success with frequency changed.
127 * - 0 on success without frequency changed.
128 * - Negative on error.
130 int power_acpi_cpufreq_freq_down(unsigned int lcore_id);
133 * Scale up the frequency of a specific lcore to the highest according to the
134 * available frequencies.
135 * It should be protected outside of this function for threadsafe.
141 * - 1 on success with frequency changed.
142 * - 0 on success without frequency changed.
143 * - Negative on error.
145 int power_acpi_cpufreq_freq_max(unsigned int lcore_id);
148 * Scale down the frequency of a specific lcore to the lowest according to the
149 * available frequencies.
150 * It should be protected outside of this function for threadsafe.
156 * - 1 on success with frequency changed.
157 * - 0 on success without frequency changed.
158 * - Negative on error.
160 int power_acpi_cpufreq_freq_min(unsigned int lcore_id);
163 * Get the turbo status of a specific lcore.
164 * It should be protected outside of this function for threadsafe.
170 * - 1 Turbo Boost is enabled on this lcore.
171 * - 0 Turbo Boost is disabled on this lcore.
172 * - Negative on error.
174 int power_acpi_turbo_status(unsigned int lcore_id);
177 * Enable Turbo Boost on a specific lcore.
178 * It should be protected outside of this function for threadsafe.
184 * - 0 Turbo Boost is enabled successfully on this lcore.
185 * - Negative on error.
187 int power_acpi_enable_turbo(unsigned int lcore_id);
190 * Disable Turbo Boost on a specific lcore.
191 * It should be protected outside of this function for threadsafe.
197 * - 0 Turbo Boost disabled successfully on this lcore.
198 * - Negative on error.
200 int power_acpi_disable_turbo(unsigned int lcore_id);
203 * Returns power capabilities for a specific lcore.
208 * pointer to rte_power_core_capabilities object.
212 * - Negative on error.
214 int power_acpi_get_capabilities(unsigned int lcore_id,
215 struct rte_power_core_capabilities *caps);