1 #ifndef __ASM_METAG_BITOPS_H
2 #define __ASM_METAG_BITOPS_H
4 #include <linux/compiler.h>
5 #include <asm/barrier.h>
6 #include <asm/global_lock.h>
9 * clear_bit() doesn't provide any barrier for the compiler.
11 #define smp_mb__before_clear_bit() barrier()
12 #define smp_mb__after_clear_bit() barrier()
16 * These functions are the basis of our bit ops.
18 static inline void set_bit(unsigned int bit, volatile unsigned long *p)
21 unsigned long mask = 1UL << (bit & 31);
25 __global_lock1(flags);
28 __global_unlock1(flags);
31 static inline void clear_bit(unsigned int bit, volatile unsigned long *p)
34 unsigned long mask = 1UL << (bit & 31);
38 __global_lock1(flags);
41 __global_unlock1(flags);
44 static inline void change_bit(unsigned int bit, volatile unsigned long *p)
47 unsigned long mask = 1UL << (bit & 31);
51 __global_lock1(flags);
54 __global_unlock1(flags);
57 static inline int test_and_set_bit(unsigned int bit, volatile unsigned long *p)
61 unsigned long mask = 1UL << (bit & 31);
65 __global_lock1(flags);
71 __global_unlock1(flags);
73 return (old & mask) != 0;
76 static inline int test_and_clear_bit(unsigned int bit,
77 volatile unsigned long *p)
81 unsigned long mask = 1UL << (bit & 31);
85 __global_lock1(flags);
91 __global_unlock1(flags);
93 return (old & mask) != 0;
96 static inline int test_and_change_bit(unsigned int bit,
97 volatile unsigned long *p)
101 unsigned long mask = 1UL << (bit & 31);
105 __global_lock1(flags);
109 __global_unlock1(flags);
111 return (old & mask) != 0;
115 #include <asm-generic/bitops/atomic.h>
116 #endif /* CONFIG_SMP */
118 #include <asm-generic/bitops/non-atomic.h>
119 #include <asm-generic/bitops/find.h>
120 #include <asm-generic/bitops/ffs.h>
121 #include <asm-generic/bitops/__ffs.h>
122 #include <asm-generic/bitops/ffz.h>
123 #include <asm-generic/bitops/fls.h>
124 #include <asm-generic/bitops/__fls.h>
125 #include <asm-generic/bitops/fls64.h>
126 #include <asm-generic/bitops/hweight.h>
127 #include <asm-generic/bitops/lock.h>
128 #include <asm-generic/bitops/sched.h>
129 #include <asm-generic/bitops/le.h>
130 #include <asm-generic/bitops/ext2-atomic.h>
132 #endif /* __ASM_METAG_BITOPS_H */