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_compat.h> 10 #include <rte_log.h> 11 12 #define RTE_POWER_INVALID_FREQ_INDEX (~0) 13 14 extern int rte_power_logtype; 15 #define RTE_LOGTYPE_POWER rte_power_logtype 16 #define POWER_LOG(level, ...) \ 17 RTE_LOG_LINE(level, POWER, "" __VA_ARGS__) 18 19 #ifdef RTE_LIBRTE_POWER_DEBUG 20 #define POWER_DEBUG_LOG(...) \ 21 RTE_LOG_LINE_PREFIX(ERR, POWER, "%s: ", __func__, __VA_ARGS__) 22 #else 23 #define POWER_DEBUG_LOG(...) 24 #endif 25 26 /* check if scaling driver matches one we want */ 27 __rte_internal 28 int cpufreq_check_scaling_driver(const char *driver); 29 30 __rte_internal 31 int power_set_governor(unsigned int lcore_id, const char *new_governor, 32 char *orig_governor, size_t orig_governor_len); 33 34 __rte_internal 35 int open_core_sysfs_file(FILE **f, const char *mode, const char *format, ...) 36 __rte_format_printf(3, 4); 37 38 __rte_internal 39 int read_core_sysfs_u32(FILE *f, uint32_t *val); 40 41 __rte_internal 42 int read_core_sysfs_s(FILE *f, char *buf, unsigned int len); 43 44 __rte_internal 45 int write_core_sysfs_s(FILE *f, const char *str); 46 47 __rte_internal 48 int power_get_lcore_mapped_cpu_id(uint32_t lcore_id, uint32_t *cpu_id); 49 50 #endif /* POWER_COMMON_H */ 51