blob: 229c83fe77cb29d97c9136f1728316b1ca48cec6 [file] [log] [blame]
Andrew Morton0db9ae42005-10-24 23:05:58 -07001#ifndef __BARRIER_H
2#define __BARRIER_H
3
4#define mb() \
5__asm__ __volatile__("mb": : :"memory")
6
7#define rmb() \
8__asm__ __volatile__("mb": : :"memory")
9
10#define wmb() \
11__asm__ __volatile__("wmb": : :"memory")
12
13#define read_barrier_depends() \
14__asm__ __volatile__("mb": : :"memory")
15
16#ifdef CONFIG_SMP
17#define smp_mb() mb()
18#define smp_rmb() rmb()
19#define smp_wmb() wmb()
20#define smp_read_barrier_depends() read_barrier_depends()
21#else
22#define smp_mb() barrier()
23#define smp_rmb() barrier()
24#define smp_wmb() barrier()
25#define smp_read_barrier_depends() barrier()
26#endif
27
28#define set_mb(var, value) \
29do { var = value; mb(); } while (0)
30
31#define set_wmb(var, value) \
32do { var = value; wmb(); } while (0)
33
34#endif /* __BARRIER_H */