1 #ifndef _CPU_TOPOLOGY_H_
2 #define _CPU_TOPOLOGY_H_
6 #include <machine/cpumask.h>
8 /* CPU TOPOLOGY DATA AND FUNCTIONS */
10 struct cpu_node
* parent_node
;
11 struct cpu_node
* child_node
[MAXCPU
];
15 uint8_t compute_unit_id
; /* AMD compute unit ID */
17 typedef struct cpu_node cpu_node_t
;
19 extern int cpu_topology_levels_number
;
20 extern cpu_node_t
*root_cpu_node
;
22 cpumask_t
get_cpumask_from_level(int cpuid
, uint8_t level_type
);
23 cpu_node_t
*get_cpu_node_by_cpuid(int cpuid
);
24 const cpu_node_t
*get_cpu_node_by_chipid(int chip_id
);
28 /* Level type for CPU siblings */
29 #define PACKAGE_LEVEL 1
32 #define THREAD_LEVEL 4
34 #define CPUSET_FOREACH(cpu, mask) \
35 for ((cpu) = 0; (cpu) < ncpus; (cpu)++) \
36 if (CPUMASK_TESTBIT(mask, cpu))
40 #endif /* _CPU_TOPOLOGY_H_ */