2005-10-25 14:05:58 +08:00
|
|
|
#ifndef __BARRIER_H
|
|
|
|
#define __BARRIER_H
|
|
|
|
|
2005-10-30 09:15:43 +08:00
|
|
|
#include <asm/compiler.h>
|
|
|
|
|
2005-10-25 14:05:58 +08:00
|
|
|
#define mb() \
|
|
|
|
__asm__ __volatile__("mb": : :"memory")
|
|
|
|
|
|
|
|
#define rmb() \
|
|
|
|
__asm__ __volatile__("mb": : :"memory")
|
|
|
|
|
|
|
|
#define wmb() \
|
|
|
|
__asm__ __volatile__("wmb": : :"memory")
|
|
|
|
|
|
|
|
#define read_barrier_depends() \
|
|
|
|
__asm__ __volatile__("mb": : :"memory")
|
|
|
|
|
|
|
|
#ifdef CONFIG_SMP
|
2009-05-01 06:08:48 +08:00
|
|
|
#define __ASM_SMP_MB "\tmb\n"
|
2005-10-25 14:05:58 +08:00
|
|
|
#define smp_mb() mb()
|
|
|
|
#define smp_rmb() rmb()
|
|
|
|
#define smp_wmb() wmb()
|
|
|
|
#define smp_read_barrier_depends() read_barrier_depends()
|
|
|
|
#else
|
2009-05-01 06:08:48 +08:00
|
|
|
#define __ASM_SMP_MB
|
2005-10-25 14:05:58 +08:00
|
|
|
#define smp_mb() barrier()
|
|
|
|
#define smp_rmb() barrier()
|
|
|
|
#define smp_wmb() barrier()
|
2008-05-14 12:35:11 +08:00
|
|
|
#define smp_read_barrier_depends() do { } while (0)
|
2005-10-25 14:05:58 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define set_mb(var, value) \
|
|
|
|
do { var = value; mb(); } while (0)
|
|
|
|
|
|
|
|
#endif /* __BARRIER_H */
|