1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __CPUPOWER_CPUPOWER_H__
3 #define __CPUPOWER_CPUPOWER_H__
4 
5 #define CPULIST_BUFFER 5
6 
7 struct cpupower_topology {
8 	/* Amount of CPU cores, packages and threads per core in the system */
9 	unsigned int cores;
10 	unsigned int pkgs;
11 	unsigned int threads; /* per core */
12 
13 	/* Array gets mallocated with cores entries, holding per core info */
14 	struct cpuid_core_info *core_info;
15 };
16 
17 struct cpuid_core_info {
18 	int pkg;
19 	int core;
20 	int cpu;
21 	char core_cpu_list[CPULIST_BUFFER];
22 
23 	/* flags */
24 	unsigned int is_online:1;
25 };
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 int get_cpu_topology(struct cpupower_topology *cpu_top);
32 void cpu_topology_release(struct cpupower_topology cpu_top);
33 int cpupower_is_cpu_online(unsigned int cpu);
34 
35 #ifdef __cplusplus
36 }
37 #endif
38 
39 #endif
40