aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-powerpc/io.h
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@au1.ibm.com>2006-11-20 20:35:29 -0500
committerPaul Mackerras <paulus@samba.org>2006-12-04 04:39:07 -0500
commit757db1ed9b50d28cd4c1e7d9925c9ea7783b2f91 (patch)
tree1dd122c4d66ceb6e7c590b6be87695d124db6b57 /include/asm-powerpc/io.h
parent68a64357d15ae4f596e92715719071952006e83c (diff)
[POWERPC] Fix __raw* accessors
The new IO accessor code allows to stick a token in the top bit of MMIO addresses which gets masked out during actual accesses. However, the __raw_* accessors forgot to mask it out. This fixes it. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'include/asm-powerpc/io.h')
-rw-r--r--include/asm-powerpc/io.h92
1 files changed, 45 insertions, 47 deletions
diff --git a/include/asm-powerpc/io.h b/include/asm-powerpc/io.h
index 53bff8bd39b9..75df3bce9ccb 100644
--- a/include/asm-powerpc/io.h
+++ b/include/asm-powerpc/io.h
@@ -185,53 +185,6 @@ extern void _memcpy_toio(volatile void __iomem *dest, const void *src,
185 * of the accessors. 185 * of the accessors.
186 */ 186 */
187 187
188
189/*
190 * Non ordered and non-swapping "raw" accessors
191 */
192
193static inline unsigned char __raw_readb(const volatile void __iomem *addr)
194{
195 return *(volatile unsigned char __force *)addr;
196}
197static inline unsigned short __raw_readw(const volatile void __iomem *addr)
198{
199 return *(volatile unsigned short __force *)addr;
200}
201static inline unsigned int __raw_readl(const volatile void __iomem *addr)
202{
203 return *(volatile unsigned int __force *)addr;
204}
205static inline void __raw_writeb(unsigned char v, volatile void __iomem *addr)
206{
207 *(volatile unsigned char __force *)addr = v;
208}
209static inline void __raw_writew(unsigned short v, volatile void __iomem *addr)
210{
211 *(volatile unsigned short __force *)addr = v;
212}
213static inline void __raw_writel(unsigned int v, volatile void __iomem *addr)
214{
215 *(volatile unsigned int __force *)addr = v;
216}
217
218#ifdef __powerpc64__
219static inline unsigned long __raw_readq(const volatile void __iomem *addr)
220{
221 return *(volatile unsigned long __force *)addr;
222}
223static inline void __raw_writeq(unsigned long v, volatile void __iomem *addr)
224{
225 *(volatile unsigned long __force *)addr = v;
226}
227#endif /* __powerpc64__ */
228
229/*
230 *
231 * PCI PIO and MMIO accessors.
232 *
233 */
234
235/* 188/*
236 * Include the EEH definitions when EEH is enabled only so they don't get 189 * Include the EEH definitions when EEH is enabled only so they don't get
237 * in the way when building for 32 bits 190 * in the way when building for 32 bits
@@ -291,7 +244,52 @@ do { \
291#define PCI_FIX_ADDR(addr) (addr) 244#define PCI_FIX_ADDR(addr) (addr)
292#endif 245#endif
293 246
247
248/*
249 * Non ordered and non-swapping "raw" accessors
250 */
251
252static inline unsigned char __raw_readb(const volatile void __iomem *addr)
253{
254 return *(volatile unsigned char __force *)PCI_FIX_ADDR(addr);
255}
256static inline unsigned short __raw_readw(const volatile void __iomem *addr)
257{
258 return *(volatile unsigned short __force *)PCI_FIX_ADDR(addr);
259}
260static inline unsigned int __raw_readl(const volatile void __iomem *addr)
261{
262 return *(volatile unsigned int __force *)PCI_FIX_ADDR(addr);
263}
264static inline void __raw_writeb(unsigned char v, volatile void __iomem *addr)
265{
266 *(volatile unsigned char __force *)PCI_FIX_ADDR(addr) = v;
267}
268static inline void __raw_writew(unsigned short v, volatile void __iomem *addr)
269{
270 *(volatile unsigned short __force *)PCI_FIX_ADDR(addr) = v;
271}
272static inline void __raw_writel(unsigned int v, volatile void __iomem *addr)
273{
274 *(volatile unsigned int __force *)PCI_FIX_ADDR(addr) = v;
275}
276
277#ifdef __powerpc64__
278static inline unsigned long __raw_readq(const volatile void __iomem *addr)
279{
280 return *(volatile unsigned long __force *)PCI_FIX_ADDR(addr);
281}
282static inline void __raw_writeq(unsigned long v, volatile void __iomem *addr)
283{
284 *(volatile unsigned long __force *)PCI_FIX_ADDR(addr) = v;
285}
286#endif /* __powerpc64__ */
287
294/* 288/*
289 *
290 * PCI PIO and MMIO accessors.
291 *
292 *
295 * On 32 bits, PIO operations have a recovery mechanism in case they trigger 293 * On 32 bits, PIO operations have a recovery mechanism in case they trigger
296 * machine checks (which they occasionally do when probing non existing 294 * machine checks (which they occasionally do when probing non existing
297 * IO ports on some platforms, like PowerMac and 8xx). 295 * IO ports on some platforms, like PowerMac and 8xx).