Andrew Morton | 0db9ae4 | 2005-10-24 23:05:58 -0700 | [diff] [blame^] | 1 | #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) \ |
| 29 | do { var = value; mb(); } while (0) |
| 30 | |
| 31 | #define set_wmb(var, value) \ |
| 32 | do { var = value; wmb(); } while (0) |
| 33 | |
| 34 | #endif /* __BARRIER_H */ |