Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
422 | giacomo | 1 | #ifndef __ASM_GENERIC_CPUMASK_UP_H |
2 | #define __ASM_GENERIC_CPUMASK_UP_H |
||
3 | |||
4 | #define cpus_coerce(map) (map) |
||
5 | |||
6 | #define cpu_set(cpu, map) do { (void)(cpu); cpus_coerce(map) = 1UL; } while (0) |
||
7 | #define cpu_clear(cpu, map) do { (void)(cpu); cpus_coerce(map) = 0UL; } while (0) |
||
8 | #define cpu_isset(cpu, map) ((void)(cpu), cpus_coerce(map) != 0UL) |
||
9 | #define cpu_test_and_set(cpu, map) ((void)(cpu), test_and_set_bit(0, &(map))) |
||
10 | |||
11 | #define cpus_and(dst, src1, src2) \ |
||
12 | do { \ |
||
13 | if (cpus_coerce(src1) && cpus_coerce(src2)) \ |
||
14 | cpus_coerce(dst) = 1UL; \ |
||
15 | else \ |
||
16 | cpus_coerce(dst) = 0UL; \ |
||
17 | } while (0) |
||
18 | |||
19 | #define cpus_or(dst, src1, src2) \ |
||
20 | do { \ |
||
21 | if (cpus_coerce(src1) || cpus_coerce(src2)) \ |
||
22 | cpus_coerce(dst) = 1UL; \ |
||
23 | else \ |
||
24 | cpus_coerce(dst) = 0UL; \ |
||
25 | } while (0) |
||
26 | |||
27 | #define cpus_clear(map) do { cpus_coerce(map) = 0UL; } while (0) |
||
28 | |||
29 | #define cpus_complement(map) \ |
||
30 | do { \ |
||
31 | cpus_coerce(map) = !cpus_coerce(map); \ |
||
32 | } while (0) |
||
33 | |||
34 | #define cpus_equal(map1, map2) (cpus_coerce(map1) == cpus_coerce(map2)) |
||
35 | #define cpus_empty(map) (cpus_coerce(map) == 0UL) |
||
36 | #define cpus_weight(map) (cpus_coerce(map) ? 1UL : 0UL) |
||
37 | #define cpus_shift_right(d, s, n) do { cpus_coerce(d) = 0UL; } while (0) |
||
38 | #define cpus_shift_left(d, s, n) do { cpus_coerce(d) = 0UL; } while (0) |
||
39 | #define first_cpu(map) (cpus_coerce(map) ? 0 : 1) |
||
40 | #define next_cpu(cpu, map) 1 |
||
41 | |||
42 | /* only ever use this for things that are _never_ used on large boxen */ |
||
43 | #define cpus_promote(map) \ |
||
44 | ({ \ |
||
45 | cpumask_t __tmp__; \ |
||
46 | cpus_coerce(__tmp__) = map; \ |
||
47 | __tmp__; \ |
||
48 | }) |
||
49 | #define cpumask_of_cpu(cpu) ((void)(cpu), cpus_promote(1)) |
||
50 | #define any_online_cpu(map) (cpus_coerce(map) ? 0 : 1) |
||
51 | |||
52 | /* |
||
53 | * um, these need to be usable as static initializers |
||
54 | */ |
||
55 | #define CPU_MASK_ALL 1UL |
||
56 | #define CPU_MASK_NONE 0UL |
||
57 | |||
58 | #endif /* __ASM_GENERIC_CPUMASK_UP_H */ |