1 /**************************************************************************** 2 **************************************************************************** 3 *** 4 *** This header was automatically generated from a Linux kernel header 5 *** of the same name, to make information necessary for userspace to 6 *** call into the kernel available to libc. It contains only constants, 7 *** structures, and macros generated from the original header, and thus, 8 *** contains no copyrightable information. 9 *** 10 *** To edit the content of this header, modify the corresponding 11 *** source file (e.g. under external/kernel-headers/original/) then 12 *** run bionic/libc/kernel/tools/update_all.py 13 *** 14 *** Any manual change here will be lost the next time this script will 15 *** be run. You've been warned! 16 *** 17 **************************************************************************** 18 ****************************************************************************/ 19 #ifndef __LINUX_CPUMASK_H 20 #define __LINUX_CPUMASK_H 21 #include <linux/kernel.h> 22 #include <linux/threads.h> 23 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 24 #include <linux/bitmap.h> 25 typedef struct { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t; 26 #define cpu_set(cpu, dst) __cpu_set((cpu), &(dst)) 27 #define cpu_clear(cpu, dst) __cpu_clear((cpu), &(dst)) 28 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 29 #define cpus_setall(dst) __cpus_setall(&(dst), NR_CPUS) 30 #define cpus_clear(dst) __cpus_clear(&(dst), NR_CPUS) 31 #define cpu_isset(cpu, cpumask) test_bit((cpu), (cpumask).bits) 32 #define cpu_test_and_set(cpu, cpumask) __cpu_test_and_set((cpu), &(cpumask)) 33 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 34 #define cpus_and(dst, src1, src2) __cpus_and(&(dst), &(src1), &(src2), NR_CPUS) 35 #define cpus_or(dst, src1, src2) __cpus_or(&(dst), &(src1), &(src2), NR_CPUS) 36 #define cpus_xor(dst, src1, src2) __cpus_xor(&(dst), &(src1), &(src2), NR_CPUS) 37 #define cpus_andnot(dst, src1, src2) __cpus_andnot(&(dst), &(src1), &(src2), NR_CPUS) 38 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 39 #define cpus_complement(dst, src) __cpus_complement(&(dst), &(src), NR_CPUS) 40 #define cpus_equal(src1, src2) __cpus_equal(&(src1), &(src2), NR_CPUS) 41 #define cpus_intersects(src1, src2) __cpus_intersects(&(src1), &(src2), NR_CPUS) 42 #define cpus_subset(src1, src2) __cpus_subset(&(src1), &(src2), NR_CPUS) 43 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 44 #define cpus_empty(src) __cpus_empty(&(src), NR_CPUS) 45 #define cpus_full(cpumask) __cpus_full(&(cpumask), NR_CPUS) 46 #define cpus_weight(cpumask) __cpus_weight(&(cpumask), NR_CPUS) 47 #define cpus_shift_right(dst, src, n) __cpus_shift_right(&(dst), &(src), (n), NR_CPUS) 48 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 49 #define cpus_shift_left(dst, src, n) __cpus_shift_left(&(dst), &(src), (n), NR_CPUS) 50 #define first_cpu(src) 0 51 #define next_cpu(n, src) 1 52 #define cpumask_of_cpu(cpu) ({ typeof(_unused_cpumask_arg_) m; if (sizeof(m) == sizeof(unsigned long)) { m.bits[0] = 1UL<<(cpu); } else { cpus_clear(m); cpu_set((cpu), m); } m; }) 53 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 54 #define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS) 55 #if NR_CPUS <= BITS_PER_LONG 56 #define CPU_MASK_ALL (cpumask_t) { { [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD } } 57 #else 58 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 59 #define CPU_MASK_ALL (cpumask_t) { { [0 ... BITS_TO_LONGS(NR_CPUS)-2] = ~0UL, [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD } } 60 #endif 61 #define CPU_MASK_NONE (cpumask_t) { { [0 ... BITS_TO_LONGS(NR_CPUS)-1] = 0UL } } 62 #define CPU_MASK_CPU0 (cpumask_t) { { [0] = 1UL } } 63 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 64 #define cpus_addr(src) ((src).bits) 65 #define cpumask_scnprintf(buf, len, src) __cpumask_scnprintf((buf), (len), &(src), NR_CPUS) 66 #define cpumask_parse(ubuf, ulen, dst) __cpumask_parse((ubuf), (ulen), &(dst), NR_CPUS) 67 #define cpulist_scnprintf(buf, len, src) __cpulist_scnprintf((buf), (len), &(src), NR_CPUS) 68 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 69 #define cpulist_parse(buf, dst) __cpulist_parse((buf), &(dst), NR_CPUS) 70 #define cpu_remap(oldbit, old, new) __cpu_remap((oldbit), &(old), &(new), NR_CPUS) 71 #define cpus_remap(dst, src, old, new) __cpus_remap(&(dst), &(src), &(old), &(new), NR_CPUS) 72 #if NR_CPUS > 1 73 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 74 #define for_each_cpu_mask(cpu, mask) for ((cpu) = first_cpu(mask); (cpu) < NR_CPUS; (cpu) = next_cpu((cpu), (mask))) 75 #else 76 #define for_each_cpu_mask(cpu, mask) for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask) 77 #endif 78 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 79 #if NR_CPUS > 1 80 #define num_online_cpus() cpus_weight(cpu_online_map) 81 #define num_possible_cpus() cpus_weight(cpu_possible_map) 82 #define num_present_cpus() cpus_weight(cpu_present_map) 83 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 84 #define cpu_online(cpu) cpu_isset((cpu), cpu_online_map) 85 #define cpu_possible(cpu) cpu_isset((cpu), cpu_possible_map) 86 #define cpu_present(cpu) cpu_isset((cpu), cpu_present_map) 87 #else 88 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 89 #define num_online_cpus() 1 90 #define num_possible_cpus() 1 91 #define num_present_cpus() 1 92 #define cpu_online(cpu) ((cpu) == 0) 93 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 94 #define cpu_possible(cpu) ((cpu) == 0) 95 #define cpu_present(cpu) ((cpu) == 0) 96 #endif 97 #define highest_possible_processor_id() 0 98 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 99 #define any_online_cpu(mask) 0 100 #define for_each_possible_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map) 101 #define for_each_online_cpu(cpu) for_each_cpu_mask((cpu), cpu_online_map) 102 #define for_each_present_cpu(cpu) for_each_cpu_mask((cpu), cpu_present_map) 103 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 104 #endif 105