xref: /openbmc/linux/arch/xtensa/include/asm/barrier.h (revision 404e077a)
1 /*
2  * This file is subject to the terms and conditions of the GNU General Public
3  * License.  See the file "COPYING" in the main directory of this archive
4  * for more details.
5  *
6  * Copyright (C) 2001 - 2012 Tensilica Inc.
7  */
8 
9 #ifndef _XTENSA_SYSTEM_H
10 #define _XTENSA_SYSTEM_H
11 
12 #include <asm/core.h>
13 
14 #define __mb()  ({ __asm__ __volatile__("memw" : : : "memory"); })
15 #define __rmb() barrier()
16 #define __wmb() __mb()
17 
18 #ifdef CONFIG_SMP
19 #define __smp_mb() __mb()
20 #define __smp_rmb() __rmb()
21 #define __smp_wmb() __wmb()
22 #endif
23 
24 #if XCHAL_HAVE_S32C1I
25 #define __smp_mb__before_atomic()		barrier()
26 #define __smp_mb__after_atomic()		barrier()
27 #endif
28 
29 #include <asm-generic/barrier.h>
30 
31 #endif /* _XTENSA_SYSTEM_H */
32