Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1 | #ifndef _BLACKFIN_BITOPS_H |
| 2 | #define _BLACKFIN_BITOPS_H |
| 3 | |
Mike Frysinger | 3d15063 | 2009-06-13 11:21:51 -0400 | [diff] [blame^] | 4 | #ifndef CONFIG_SMP |
| 5 | # include <asm-generic/bitops.h> |
| 6 | #else |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 7 | |
Jiri Slaby | 0624517 | 2007-10-18 23:40:26 -0700 | [diff] [blame] | 8 | #ifndef _LINUX_BITOPS_H |
| 9 | #error only <linux/bitops.h> can be included directly |
| 10 | #endif |
| 11 | |
Mike Frysinger | 3d15063 | 2009-06-13 11:21:51 -0400 | [diff] [blame^] | 12 | #include <linux/compiler.h> |
| 13 | #include <asm/byteorder.h> /* swab32 */ |
| 14 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 15 | #include <asm-generic/bitops/ffs.h> |
| 16 | #include <asm-generic/bitops/__ffs.h> |
| 17 | #include <asm-generic/bitops/sched.h> |
| 18 | #include <asm-generic/bitops/ffz.h> |
| 19 | |
Graf Yang | 6b3087c | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 20 | #include <linux/linkage.h> |
| 21 | |
| 22 | asmlinkage int __raw_bit_set_asm(volatile unsigned long *addr, int nr); |
| 23 | |
| 24 | asmlinkage int __raw_bit_clear_asm(volatile unsigned long *addr, int nr); |
| 25 | |
| 26 | asmlinkage int __raw_bit_toggle_asm(volatile unsigned long *addr, int nr); |
| 27 | |
| 28 | asmlinkage int __raw_bit_test_set_asm(volatile unsigned long *addr, int nr); |
| 29 | |
| 30 | asmlinkage int __raw_bit_test_clear_asm(volatile unsigned long *addr, int nr); |
| 31 | |
| 32 | asmlinkage int __raw_bit_test_toggle_asm(volatile unsigned long *addr, int nr); |
| 33 | |
| 34 | asmlinkage int __raw_bit_test_asm(const volatile unsigned long *addr, int nr); |
| 35 | |
| 36 | static inline void set_bit(int nr, volatile unsigned long *addr) |
| 37 | { |
| 38 | volatile unsigned long *a = addr + (nr >> 5); |
| 39 | __raw_bit_set_asm(a, nr & 0x1f); |
| 40 | } |
| 41 | |
| 42 | static inline void clear_bit(int nr, volatile unsigned long *addr) |
| 43 | { |
| 44 | volatile unsigned long *a = addr + (nr >> 5); |
| 45 | __raw_bit_clear_asm(a, nr & 0x1f); |
| 46 | } |
| 47 | |
| 48 | static inline void change_bit(int nr, volatile unsigned long *addr) |
| 49 | { |
| 50 | volatile unsigned long *a = addr + (nr >> 5); |
| 51 | __raw_bit_toggle_asm(a, nr & 0x1f); |
| 52 | } |
| 53 | |
| 54 | static inline int test_bit(int nr, const volatile unsigned long *addr) |
| 55 | { |
| 56 | volatile const unsigned long *a = addr + (nr >> 5); |
| 57 | return __raw_bit_test_asm(a, nr & 0x1f) != 0; |
| 58 | } |
| 59 | |
| 60 | static inline int test_and_set_bit(int nr, volatile unsigned long *addr) |
| 61 | { |
| 62 | volatile unsigned long *a = addr + (nr >> 5); |
| 63 | return __raw_bit_test_set_asm(a, nr & 0x1f); |
| 64 | } |
| 65 | |
| 66 | static inline int test_and_clear_bit(int nr, volatile unsigned long *addr) |
| 67 | { |
| 68 | volatile unsigned long *a = addr + (nr >> 5); |
| 69 | return __raw_bit_test_clear_asm(a, nr & 0x1f); |
| 70 | } |
| 71 | |
| 72 | static inline int test_and_change_bit(int nr, volatile unsigned long *addr) |
| 73 | { |
| 74 | volatile unsigned long *a = addr + (nr >> 5); |
| 75 | return __raw_bit_test_toggle_asm(a, nr & 0x1f); |
| 76 | } |
| 77 | |
Graf Yang | 6b3087c | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 78 | /* |
| 79 | * clear_bit() doesn't provide any barrier for the compiler. |
| 80 | */ |
| 81 | #define smp_mb__before_clear_bit() barrier() |
| 82 | #define smp_mb__after_clear_bit() barrier() |
| 83 | |
Mike Frysinger | 3d15063 | 2009-06-13 11:21:51 -0400 | [diff] [blame^] | 84 | #include <asm-generic/bitops/non-atomic.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 85 | |
| 86 | #include <asm-generic/bitops/find.h> |
| 87 | #include <asm-generic/bitops/hweight.h> |
Nick Piggin | 2633357 | 2007-10-18 03:06:39 -0700 | [diff] [blame] | 88 | #include <asm-generic/bitops/lock.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 89 | |
| 90 | #include <asm-generic/bitops/ext2-atomic.h> |
| 91 | #include <asm-generic/bitops/ext2-non-atomic.h> |
| 92 | |
| 93 | #include <asm-generic/bitops/minix.h> |
| 94 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 95 | #include <asm-generic/bitops/fls.h> |
Rusty Russell | ccec25f | 2009-01-01 10:12:17 +1030 | [diff] [blame] | 96 | #include <asm-generic/bitops/__fls.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 97 | #include <asm-generic/bitops/fls64.h> |
| 98 | |
Mike Frysinger | 3d15063 | 2009-06-13 11:21:51 -0400 | [diff] [blame^] | 99 | #endif /* CONFIG_SMP */ |
| 100 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 101 | #endif /* _BLACKFIN_BITOPS_H */ |