1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
27fe2f639SDominik Brodowski #ifndef __CPUPOWER_HELPERS_SYSFS_H__
37fe2f639SDominik Brodowski #define __CPUPOWER_HELPERS_SYSFS_H__
47fe2f639SDominik Brodowski 
57fe2f639SDominik Brodowski #define PATH_TO_CPU "/sys/devices/system/cpu/"
67fe2f639SDominik Brodowski #define MAX_LINE_LEN 255
77fe2f639SDominik Brodowski #define SYSFS_PATH_MAX 255
87fe2f639SDominik Brodowski 
97fe2f639SDominik Brodowski extern unsigned int sysfs_read_file(const char *path, char *buf, size_t buflen);
107fe2f639SDominik Brodowski 
110924c369SThomas Renninger extern unsigned int sysfs_idlestate_file_exists(unsigned int cpu,
120924c369SThomas Renninger 						unsigned int idlestate,
130924c369SThomas Renninger 						const char *fname);
140924c369SThomas Renninger 
157c74d2bcSThomas Renninger extern int sysfs_is_cpu_online(unsigned int cpu);
167c74d2bcSThomas Renninger 
170924c369SThomas Renninger extern int sysfs_is_idlestate_disabled(unsigned int cpu,
180924c369SThomas Renninger 				       unsigned int idlestate);
190924c369SThomas Renninger extern int sysfs_idlestate_disable(unsigned int cpu, unsigned int idlestate,
200924c369SThomas Renninger 				   unsigned int disable);
212cd005caSDominik Brodowski extern unsigned long sysfs_get_idlestate_latency(unsigned int cpu,
222cd005caSDominik Brodowski 						unsigned int idlestate);
232cd005caSDominik Brodowski extern unsigned long sysfs_get_idlestate_usage(unsigned int cpu,
242cd005caSDominik Brodowski 					unsigned int idlestate);
252cd005caSDominik Brodowski extern unsigned long long sysfs_get_idlestate_time(unsigned int cpu,
262cd005caSDominik Brodowski 						unsigned int idlestate);
272cd005caSDominik Brodowski extern char *sysfs_get_idlestate_name(unsigned int cpu,
282cd005caSDominik Brodowski 				unsigned int idlestate);
292cd005caSDominik Brodowski extern char *sysfs_get_idlestate_desc(unsigned int cpu,
302cd005caSDominik Brodowski 				unsigned int idlestate);
31f605181aSThomas Renninger extern unsigned int sysfs_get_idlestate_count(unsigned int cpu);
327fe2f639SDominik Brodowski 
337fe2f639SDominik Brodowski extern char *sysfs_get_cpuidle_governor(void);
347fe2f639SDominik Brodowski extern char *sysfs_get_cpuidle_driver(void);
357fe2f639SDominik Brodowski 
367fe2f639SDominik Brodowski extern int sysfs_get_sched(const char *smt_mc);
377fe2f639SDominik Brodowski extern int sysfs_set_sched(const char *smt_mc, int val);
387fe2f639SDominik Brodowski 
397fe2f639SDominik Brodowski #endif /* __CPUPOWER_HELPERS_SYSFS_H__ */
40