blob: ac78eba909bce225243a9ddb979c3b5321d3da17 [file] [log] [blame]
Andrew Morton0db9ae42005-10-24 23:05:58 -07001#ifndef __BARRIER_H
2#define __BARRIER_H
3
Ivan Kokshaysky63f324c2005-10-29 18:15:43 -07004#include <asm/compiler.h>
5
Andrew Morton0db9ae42005-10-24 23:05:58 -07006#define mb() \
7__asm__ __volatile__("mb": : :"memory")
8
9#define rmb() \
10__asm__ __volatile__("mb": : :"memory")
11
12#define wmb() \
13__asm__ __volatile__("wmb": : :"memory")
14
15#define read_barrier_depends() \
16__asm__ __volatile__("mb": : :"memory")
17
18#ifdef CONFIG_SMP
19#define smp_mb() mb()
20#define smp_rmb() rmb()
21#define smp_wmb() wmb()
22#define smp_read_barrier_depends() read_barrier_depends()
23#else
24#define smp_mb() barrier()
25#define smp_rmb() barrier()
26#define smp_wmb() barrier()
Nick Piggin73f10282008-05-14 06:35:11 +020027#define smp_read_barrier_depends() do { } while (0)
Andrew Morton0db9ae42005-10-24 23:05:58 -070028#endif
29
30#define set_mb(var, value) \
31do { var = value; mb(); } while (0)
32
Andrew Morton0db9ae42005-10-24 23:05:58 -070033#endif /* __BARRIER_H */