1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2010-2014 Intel Corporation 3 */ 4 5 #ifndef _POWER_COMMON_H_ 6 #define _POWER_COMMON_H_ 7 8 #include <rte_common.h> 9 #include <rte_log.h> 10 11 #define RTE_POWER_INVALID_FREQ_INDEX (~0) 12 13 extern int power_logtype; 14 #define RTE_LOGTYPE_POWER power_logtype 15 #define POWER_LOG(level, ...) \ 16 RTE_LOG_LINE(level, POWER, "" __VA_ARGS__) 17 18 #ifdef RTE_LIBRTE_POWER_DEBUG 19 #define POWER_DEBUG_LOG(...) \ 20 RTE_LOG_LINE_PREFIX(ERR, POWER, "%s: ", __func__, __VA_ARGS__) 21 #else 22 #define POWER_DEBUG_LOG(...) 23 #endif 24 25 /* check if scaling driver matches one we want */ 26 int cpufreq_check_scaling_driver(const char *driver); 27 int power_set_governor(unsigned int lcore_id, const char *new_governor, 28 char *orig_governor, size_t orig_governor_len); 29 int open_core_sysfs_file(FILE **f, const char *mode, const char *format, ...) 30 __rte_format_printf(3, 4); 31 int read_core_sysfs_u32(FILE *f, uint32_t *val); 32 int read_core_sysfs_s(FILE *f, char *buf, unsigned int len); 33 int write_core_sysfs_s(FILE *f, const char *str); 34 35 #endif /* _POWER_COMMON_H_ */ 36