1 #ifndef __ASM_GENERIC_CPUMASK_ARRAY_H
2 #define __ASM_GENERIC_CPUMASK_ARRAY_H
5 * Array-based cpu bitmaps. An array of unsigned longs is used to contain
6 * the bitmap, and then contained in a structure so it may be passed by
10 #define CPU_ARRAY_SIZE BITS_TO_LONGS(NR_CPUS)
12 #define cpu_set(cpu, map) set_bit(cpu, (map).mask)
13 #define cpu_clear(cpu, map) clear_bit(cpu, (map).mask)
14 #define cpu_isset(cpu, map) test_bit(cpu, (map).mask)
15 #define cpu_test_and_set(cpu, map) test_and_set_bit(cpu, (map).mask)
17 #define cpus_and(dst,src1,src2) bitmap_and((dst).mask,(src1).mask, (src2).mask, NR_CPUS)
18 #define cpus_or(dst,src1,src2) bitmap_or((dst).mask, (src1).mask, (src2).mask, NR_CPUS)
19 #define cpus_clear(map) bitmap_zero((map).mask, NR_CPUS)
20 #define cpus_complement(map) bitmap_complement((map).mask, NR_CPUS)
21 #define cpus_equal(map1, map2) bitmap_equal((map1).mask, (map2).mask, NR_CPUS)
22 #define cpus_empty(map) bitmap_empty(map.mask, NR_CPUS)
23 #define cpus_addr(map) ((map).mask)
24 #define cpus_weight(map) bitmap_weight((map).mask, NR_CPUS)
25 #define cpus_shift_right(d, s, n) bitmap_shift_right((d).mask, (s).mask, n, NR_CPUS)
26 #define cpus_shift_left(d, s, n) bitmap_shift_left((d).mask, (s).mask, n, NR_CPUS)
27 #define first_cpu(map) find_first_bit((map).mask, NR_CPUS)
28 #define next_cpu(cpu, map) find_next_bit((map).mask, NR_CPUS, cpu + 1)
30 /* only ever use this for things that are _never_ used on large boxen */
31 #define cpus_coerce(map) ((map).mask[0])
32 #define cpus_promote(map) ({ cpumask_t __cpu_mask = CPU_MASK_NONE;\
33 __cpu_mask.mask[0] = map; \
36 #define cpumask_of_cpu(cpu) ({ cpumask_t __cpu_mask = CPU_MASK_NONE;\
37 cpu_set(cpu, __cpu_mask); \
40 #define any_online_cpu(map) \
43 cpus_and(__tmp__, map, cpu_online_map); \
44 find_first_bit(__tmp__.mask, NR_CPUS); \
49 * um, these need to be usable as static initializers
51 #define CPU_MASK_ALL ((cpumask_t) { {[0 ... CPU_ARRAY_SIZE-1] = ~0UL} })
52 #define CPU_MASK_NONE ((cpumask_t) { {[0 ... CPU_ARRAY_SIZE-1] = 0UL} })
54 #endif /* __ASM_GENERIC_CPUMASK_ARRAY_H */