2 * Based on arch/arm/include/asm/barrier.h
4 * Copyright (C) 2012 ARM Ltd.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #ifndef __ASM_BARRIER_H
19 #define __ASM_BARRIER_H
23 #define sev() asm volatile("sev" : : : "memory")
24 #define wfe() asm volatile("wfe" : : : "memory")
25 #define wfi() asm volatile("wfi" : : : "memory")
27 #define isb() asm volatile("isb" : : : "memory")
28 #define dsb() asm volatile("dsb sy" : : : "memory")
31 #define rmb() asm volatile("dsb ld" : : : "memory")
32 #define wmb() asm volatile("dsb st" : : : "memory")
35 #define smp_mb() barrier()
36 #define smp_rmb() barrier()
37 #define smp_wmb() barrier()
39 #define smp_mb() asm volatile("dmb ish" : : : "memory")
40 #define smp_rmb() asm volatile("dmb ishld" : : : "memory")
41 #define smp_wmb() asm volatile("dmb ishst" : : : "memory")
44 #define read_barrier_depends() do { } while(0)
45 #define smp_read_barrier_depends() do { } while(0)
47 #define set_mb(var, value) do { var = value; smp_mb(); } while (0)
48 #define nop() asm volatile("nop");
50 #endif /* __ASSEMBLY__ */
52 #endif /* __ASM_BARRIER_H */