1 #ifndef __LINUX_CPUMASK_H
2 #define __LINUX_CPUMASK_H
4 #include <linux/threads.h>
5 #include <linux/bitmap.h>
6 #include <asm/cpumask.h>
11 extern cpumask_t cpu_online_map;
12 extern cpumask_t cpu_possible_map;
13 extern cpumask_t cpu_present_map;
15 #define num_online_cpus() cpus_weight(cpu_online_map)
16 #define num_possible_cpus() cpus_weight(cpu_possible_map)
17 #define num_present_cpus() cpus_weight(cpu_present_map)
19 #define cpu_online(cpu) cpu_isset(cpu, cpu_online_map)
20 #define cpu_possible(cpu) cpu_isset(cpu, cpu_possible_map)
21 #define cpu_present(cpu) cpu_isset(cpu, cpu_present_map)
23 #define for_each_cpu_mask(cpu, mask) \
24 for (cpu = first_cpu_const(mk_cpumask_const(mask)); \
26 cpu = next_cpu_const(cpu, mk_cpumask_const(mask)))
28 #define for_each_cpu(cpu) for_each_cpu_mask(cpu, cpu_possible_map)
29 #define for_each_online_cpu(cpu) for_each_cpu_mask(cpu, cpu_online_map)
30 #define for_each_present_cpu(cpu) for_each_cpu_mask(cpu, cpu_present_map)
32 #define cpu_online_map cpumask_of_cpu(0)
33 #define cpu_possible_map cpumask_of_cpu(0)
34 #define cpu_present_map cpumask_of_cpu(0)
36 #define num_online_cpus() 1
37 #define num_possible_cpus() 1
38 #define num_present_cpus() 1
40 #define cpu_online(cpu) ({ BUG_ON((cpu) != 0); 1; })
41 #define cpu_possible(cpu) ({ BUG_ON((cpu) != 0); 1; })
42 #define cpu_present(cpu) ({ BUG_ON((cpu) != 0); 1; })
44 #define for_each_cpu_mask(cpu, mask) for (cpu = 0; cpu < 1; cpu++)
45 #define for_each_cpu(cpu) for (cpu = 0; cpu < 1; cpu++)
46 #define for_each_online_cpu(cpu) for (cpu = 0; cpu < 1; cpu++)
47 #define for_each_present_cpu(cpu) for (cpu = 0; cpu < 1; cpu++)
50 #define cpumask_scnprintf(buf, buflen, map) \
51 bitmap_scnprintf(buf, buflen, cpus_addr(map), NR_CPUS)
53 #define cpumask_parse(buf, buflen, map) \
54 bitmap_parse(buf, buflen, cpus_addr(map), NR_CPUS)
56 #endif /* __LINUX_CPUMASK_H */