kernel - remove mapzone
[dragonfly.git] / sys / sys / cpu_topology.h
blob0cfdd56fd451a32ad34d45b300fdd8577a91a700
1 #ifndef _CPU_TOPOLOGY_H_
2 #define _CPU_TOPOLOGY_H_
4 #ifdef _KERNEL
6 #include <machine/cpumask.h>
8 /* CPU TOPOLOGY DATA AND FUNCTIONS */
9 struct cpu_node {
10 struct cpu_node * parent_node;
11 struct cpu_node * child_node[MAXCPU];
12 uint32_t child_no;
13 cpumask_t members;
14 uint8_t type;
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 int cpu_topology_core_ids;
21 extern int cpu_topology_phys_ids;
22 extern cpu_node_t *root_cpu_node;
24 cpumask_t get_cpumask_from_level(int cpuid, uint8_t level_type);
25 cpu_node_t *get_cpu_node_by_cpuid(int cpuid);
26 const cpu_node_t *get_cpu_node_by_chipid(int chip_id);
27 int get_cpu_core_id(int cpuid);
28 int get_cpu_phys_id(int cpuid);
30 #define LEVEL_NO 4
32 /* Level type for CPU siblings */
33 #define PACKAGE_LEVEL 1
34 #define CHIP_LEVEL 2
35 #define CORE_LEVEL 3
36 #define THREAD_LEVEL 4
38 #define CPUSET_FOREACH(cpu, mask) \
39 for ((cpu) = 0; (cpu) < ncpus; (cpu)++) \
40 if (CPUMASK_TESTBIT(mask, cpu))
43 #endif /* _KERNEL */
44 #endif /* _CPU_TOPOLOGY_H_ */