aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/include/asm/barrier.h61
1 files changed, 5 insertions, 56 deletions
diff --git a/arch/mips/include/asm/barrier.h b/arch/mips/include/asm/barrier.h
index d0101dd0575e..2b8bbbcb9be0 100644
--- a/arch/mips/include/asm/barrier.h
+++ b/arch/mips/include/asm/barrier.h
@@ -10,58 +10,6 @@
10 10
11#include <asm/addrspace.h> 11#include <asm/addrspace.h>
12 12
13/*
14 * read_barrier_depends - Flush all pending reads that subsequents reads
15 * depend on.
16 *
17 * No data-dependent reads from memory-like regions are ever reordered
18 * over this barrier. All reads preceding this primitive are guaranteed
19 * to access memory (but not necessarily other CPUs' caches) before any
20 * reads following this primitive that depend on the data return by
21 * any of the preceding reads. This primitive is much lighter weight than
22 * rmb() on most CPUs, and is never heavier weight than is
23 * rmb().
24 *
25 * These ordering constraints are respected by both the local CPU
26 * and the compiler.
27 *
28 * Ordering is not guaranteed by anything other than these primitives,
29 * not even by data dependencies. See the documentation for
30 * memory_barrier() for examples and URLs to more information.
31 *
32 * For example, the following code would force ordering (the initial
33 * value of "a" is zero, "b" is one, and "p" is "&a"):
34 *
35 * <programlisting>
36 * CPU 0 CPU 1
37 *
38 * b = 2;
39 * memory_barrier();
40 * p = &b; q = p;
41 * read_barrier_depends();
42 * d = *q;
43 * </programlisting>
44 *
45 * because the read of "*q" depends on the read of "p" and these
46 * two reads are separated by a read_barrier_depends(). However,
47 * the following code, with the same initial values for "a" and "b":
48 *
49 * <programlisting>
50 * CPU 0 CPU 1
51 *
52 * a = 2;
53 * memory_barrier();
54 * b = 3; y = b;
55 * read_barrier_depends();
56 * x = a;
57 * </programlisting>
58 *
59 * does not enforce ordering, since there is no data dependency between
60 * the read of "a" and the read of "b". Therefore, on some CPUs, such
61 * as Alpha, "y" could be set to 3 and "x" to 0. Use rmb()
62 * in cases like this where there are no data dependencies.
63 */
64
65#define read_barrier_depends() do { } while(0) 13#define read_barrier_depends() do { } while(0)
66#define smp_read_barrier_depends() do { } while(0) 14#define smp_read_barrier_depends() do { } while(0)
67 15
@@ -127,20 +75,21 @@
127 75
128#include <asm/wbflush.h> 76#include <asm/wbflush.h>
129 77
130#define wmb() fast_wmb()
131#define rmb() fast_rmb()
132#define mb() wbflush() 78#define mb() wbflush()
133#define iob() wbflush() 79#define iob() wbflush()
134 80
135#else /* !CONFIG_CPU_HAS_WB */ 81#else /* !CONFIG_CPU_HAS_WB */
136 82
137#define wmb() fast_wmb()
138#define rmb() fast_rmb()
139#define mb() fast_mb() 83#define mb() fast_mb()
140#define iob() fast_iob() 84#define iob() fast_iob()
141 85
142#endif /* !CONFIG_CPU_HAS_WB */ 86#endif /* !CONFIG_CPU_HAS_WB */
143 87
88#define wmb() fast_wmb()
89#define rmb() fast_rmb()
90#define dma_wmb() fast_wmb()
91#define dma_rmb() fast_rmb()
92
144#if defined(CONFIG_WEAK_ORDERING) && defined(CONFIG_SMP) 93#if defined(CONFIG_WEAK_ORDERING) && defined(CONFIG_SMP)
145# ifdef CONFIG_CPU_CAVIUM_OCTEON 94# ifdef CONFIG_CPU_CAVIUM_OCTEON
146# define smp_mb() __sync() 95# define smp_mb() __sync()