diff options
Diffstat (limited to 'include/asm-ppc/io.h')
-rw-r--r-- | include/asm-ppc/io.h | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/include/asm-ppc/io.h b/include/asm-ppc/io.h index b919d8fb7d9..680555be22e 100644 --- a/include/asm-ppc/io.h +++ b/include/asm-ppc/io.h | |||
@@ -2,7 +2,6 @@ | |||
2 | #ifndef _PPC_IO_H | 2 | #ifndef _PPC_IO_H |
3 | #define _PPC_IO_H | 3 | #define _PPC_IO_H |
4 | 4 | ||
5 | #include <linux/config.h> | ||
6 | #include <linux/string.h> | 5 | #include <linux/string.h> |
7 | #include <linux/types.h> | 6 | #include <linux/types.h> |
8 | 7 | ||
@@ -64,7 +63,7 @@ extern inline int in_8(const volatile unsigned char __iomem *addr) | |||
64 | int ret; | 63 | int ret; |
65 | 64 | ||
66 | __asm__ __volatile__( | 65 | __asm__ __volatile__( |
67 | "lbz%U1%X1 %0,%1;\n" | 66 | "sync; lbz%U1%X1 %0,%1;\n" |
68 | "twi 0,%0,0;\n" | 67 | "twi 0,%0,0;\n" |
69 | "isync" : "=r" (ret) : "m" (*addr)); | 68 | "isync" : "=r" (ret) : "m" (*addr)); |
70 | return ret; | 69 | return ret; |
@@ -79,7 +78,7 @@ extern inline int in_le16(const volatile unsigned short __iomem *addr) | |||
79 | { | 78 | { |
80 | int ret; | 79 | int ret; |
81 | 80 | ||
82 | __asm__ __volatile__("lhbrx %0,0,%1;\n" | 81 | __asm__ __volatile__("sync; lhbrx %0,0,%1;\n" |
83 | "twi 0,%0,0;\n" | 82 | "twi 0,%0,0;\n" |
84 | "isync" : "=r" (ret) : | 83 | "isync" : "=r" (ret) : |
85 | "r" (addr), "m" (*addr)); | 84 | "r" (addr), "m" (*addr)); |
@@ -90,7 +89,7 @@ extern inline int in_be16(const volatile unsigned short __iomem *addr) | |||
90 | { | 89 | { |
91 | int ret; | 90 | int ret; |
92 | 91 | ||
93 | __asm__ __volatile__("lhz%U1%X1 %0,%1;\n" | 92 | __asm__ __volatile__("sync; lhz%U1%X1 %0,%1;\n" |
94 | "twi 0,%0,0;\n" | 93 | "twi 0,%0,0;\n" |
95 | "isync" : "=r" (ret) : "m" (*addr)); | 94 | "isync" : "=r" (ret) : "m" (*addr)); |
96 | return ret; | 95 | return ret; |
@@ -98,20 +97,20 @@ extern inline int in_be16(const volatile unsigned short __iomem *addr) | |||
98 | 97 | ||
99 | extern inline void out_le16(volatile unsigned short __iomem *addr, int val) | 98 | extern inline void out_le16(volatile unsigned short __iomem *addr, int val) |
100 | { | 99 | { |
101 | __asm__ __volatile__("sthbrx %1,0,%2; eieio" : "=m" (*addr) : | 100 | __asm__ __volatile__("sync; sthbrx %1,0,%2" : "=m" (*addr) : |
102 | "r" (val), "r" (addr)); | 101 | "r" (val), "r" (addr)); |
103 | } | 102 | } |
104 | 103 | ||
105 | extern inline void out_be16(volatile unsigned short __iomem *addr, int val) | 104 | extern inline void out_be16(volatile unsigned short __iomem *addr, int val) |
106 | { | 105 | { |
107 | __asm__ __volatile__("sth%U0%X0 %1,%0; eieio" : "=m" (*addr) : "r" (val)); | 106 | __asm__ __volatile__("sync; sth%U0%X0 %1,%0" : "=m" (*addr) : "r" (val)); |
108 | } | 107 | } |
109 | 108 | ||
110 | extern inline unsigned in_le32(const volatile unsigned __iomem *addr) | 109 | extern inline unsigned in_le32(const volatile unsigned __iomem *addr) |
111 | { | 110 | { |
112 | unsigned ret; | 111 | unsigned ret; |
113 | 112 | ||
114 | __asm__ __volatile__("lwbrx %0,0,%1;\n" | 113 | __asm__ __volatile__("sync; lwbrx %0,0,%1;\n" |
115 | "twi 0,%0,0;\n" | 114 | "twi 0,%0,0;\n" |
116 | "isync" : "=r" (ret) : | 115 | "isync" : "=r" (ret) : |
117 | "r" (addr), "m" (*addr)); | 116 | "r" (addr), "m" (*addr)); |
@@ -122,7 +121,7 @@ extern inline unsigned in_be32(const volatile unsigned __iomem *addr) | |||
122 | { | 121 | { |
123 | unsigned ret; | 122 | unsigned ret; |
124 | 123 | ||
125 | __asm__ __volatile__("lwz%U1%X1 %0,%1;\n" | 124 | __asm__ __volatile__("sync; lwz%U1%X1 %0,%1;\n" |
126 | "twi 0,%0,0;\n" | 125 | "twi 0,%0,0;\n" |
127 | "isync" : "=r" (ret) : "m" (*addr)); | 126 | "isync" : "=r" (ret) : "m" (*addr)); |
128 | return ret; | 127 | return ret; |
@@ -130,13 +129,13 @@ extern inline unsigned in_be32(const volatile unsigned __iomem *addr) | |||
130 | 129 | ||
131 | extern inline void out_le32(volatile unsigned __iomem *addr, int val) | 130 | extern inline void out_le32(volatile unsigned __iomem *addr, int val) |
132 | { | 131 | { |
133 | __asm__ __volatile__("stwbrx %1,0,%2; eieio" : "=m" (*addr) : | 132 | __asm__ __volatile__("sync; stwbrx %1,0,%2" : "=m" (*addr) : |
134 | "r" (val), "r" (addr)); | 133 | "r" (val), "r" (addr)); |
135 | } | 134 | } |
136 | 135 | ||
137 | extern inline void out_be32(volatile unsigned __iomem *addr, int val) | 136 | extern inline void out_be32(volatile unsigned __iomem *addr, int val) |
138 | { | 137 | { |
139 | __asm__ __volatile__("stw%U0%X0 %1,%0; eieio" : "=m" (*addr) : "r" (val)); | 138 | __asm__ __volatile__("sync; stw%U0%X0 %1,%0" : "=m" (*addr) : "r" (val)); |
140 | } | 139 | } |
141 | #if defined (CONFIG_8260_PCI9) | 140 | #if defined (CONFIG_8260_PCI9) |
142 | #define readb(addr) in_8((volatile u8 *)(addr)) | 141 | #define readb(addr) in_8((volatile u8 *)(addr)) |
@@ -260,6 +259,7 @@ extern __inline__ unsigned int name(unsigned int port) \ | |||
260 | { \ | 259 | { \ |
261 | unsigned int x; \ | 260 | unsigned int x; \ |
262 | __asm__ __volatile__( \ | 261 | __asm__ __volatile__( \ |
262 | "sync\n" \ | ||
263 | "0:" op " %0,0,%1\n" \ | 263 | "0:" op " %0,0,%1\n" \ |
264 | "1: twi 0,%0,0\n" \ | 264 | "1: twi 0,%0,0\n" \ |
265 | "2: isync\n" \ | 265 | "2: isync\n" \ |
@@ -285,6 +285,7 @@ extern __inline__ unsigned int name(unsigned int port) \ | |||
285 | extern __inline__ void name(unsigned int val, unsigned int port) \ | 285 | extern __inline__ void name(unsigned int val, unsigned int port) \ |
286 | { \ | 286 | { \ |
287 | __asm__ __volatile__( \ | 287 | __asm__ __volatile__( \ |
288 | "sync\n" \ | ||
288 | "0:" op " %0,0,%1\n" \ | 289 | "0:" op " %0,0,%1\n" \ |
289 | "1: sync\n" \ | 290 | "1: sync\n" \ |
290 | "2:\n" \ | 291 | "2:\n" \ |