Go to the documentation of this file.
8 #ifndef __ASM_BARRIER_H
9 #define __ASM_BARRIER_H
11 #include <asm/addrspace.h>
65 #define read_barrier_depends() do { } while(0)
66 #define smp_read_barrier_depends() do { } while(0)
68 #ifdef CONFIG_CPU_HAS_SYNC
70 __asm__ __volatile__( \
72 ".set noreorder\n\t" \
80 #define __sync() do { } while(0)
83 #define __fast_iob() \
84 __asm__ __volatile__( \
86 ".set noreorder\n\t" \
91 : "m" (*(int *)CKSEG1) \
93 #ifdef CONFIG_CPU_CAVIUM_OCTEON
94 # define OCTEON_SYNCW_STR ".set push\n.set arch=octeon\nsyncw\nsyncw\n.set pop\n"
95 # define __syncw() __asm__ __volatile__(OCTEON_SYNCW_STR : : : "memory")
97 # define fast_wmb() __syncw()
98 # define fast_rmb() barrier()
99 # define fast_mb() __sync()
100 # define fast_iob() do { } while (0)
102 # define fast_wmb() __sync()
103 # define fast_rmb() __sync()
104 # define fast_mb() __sync()
105 # ifdef CONFIG_SGI_IP28
106 # define fast_iob() \
107 __asm__ __volatile__( \
109 ".set noreorder\n\t" \
115 : "m" (*(int *)CKSEG1ADDR(0x1fa00004)) \
118 # define fast_iob() \
126 #ifdef CONFIG_CPU_HAS_WB
130 #define wmb() fast_wmb()
131 #define rmb() fast_rmb()
132 #define mb() wbflush()
133 #define iob() wbflush()
137 #define wmb() fast_wmb()
138 #define rmb() fast_rmb()
139 #define mb() fast_mb()
140 #define iob() fast_iob()
144 #if defined(CONFIG_WEAK_ORDERING) && defined(CONFIG_SMP)
145 # ifdef CONFIG_CPU_CAVIUM_OCTEON
146 # define smp_mb() __sync()
147 # define smp_rmb() barrier()
148 # define smp_wmb() __syncw()
150 # define smp_mb() __asm__ __volatile__("sync" : : :"memory")
151 # define smp_rmb() __asm__ __volatile__("sync" : : :"memory")
152 # define smp_wmb() __asm__ __volatile__("sync" : : :"memory")
155 #define smp_mb() barrier()
156 #define smp_rmb() barrier()
157 #define smp_wmb() barrier()
160 #if defined(CONFIG_WEAK_REORDERING_BEYOND_LLSC) && defined(CONFIG_SMP)
161 #define __WEAK_LLSC_MB " sync \n"
163 #define __WEAK_LLSC_MB " \n"
166 #define set_mb(var, value) \
167 do { var = value; smp_mb(); } while (0)
169 #define smp_llsc_mb() __asm__ __volatile__(__WEAK_LLSC_MB : : :"memory")
171 #ifdef CONFIG_CPU_CAVIUM_OCTEON
172 #define smp_mb__before_llsc() smp_wmb()
174 #define nudge_writes() __asm__ __volatile__(".set push\n\t" \
175 ".set arch=octeon\n\t" \
177 ".set pop" : : : "memory")
179 #define smp_mb__before_llsc() smp_llsc_mb()
180 #define nudge_writes() mb()