aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-12-09 20:25:00 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-12-09 20:25:00 -0500
commita0e4467726cd26bacb16f13d207ffcfa82ffc07d (patch)
tree98b5fcbda0cd787b07d09da90d25c87b3883c567 /arch
parented8efd2de75479a175bd21df073d9e97df65a820 (diff)
parentcb61f6769b8836081940ba26249f1b756400c7df (diff)
Merge tag 'asm-generic-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic
Pull asm-generic asm/io.h rewrite from Arnd Bergmann: "While there normally is no reason to have a pull request for asm-generic but have all changes get merged through whichever tree needs them, I do have a series for 3.19. There are two sets of patches that change significant portions of asm/io.h, and this branch contains both in order to resolve the conflicts: - Will Deacon has done a set of patches to ensure that all architectures define {read,write}{b,w,l,q}_relaxed() functions or get them by including asm-generic/io.h. These functions are commonly used on ARM specific drivers to avoid expensive L2 cache synchronization implied by the normal {read,write}{b,w,l,q}, but we need to define them on all architectures in order to share the drivers across architectures and to enable CONFIG_COMPILE_TEST configurations for them - Thierry Reding has done an unrelated set of patches that extends the asm-generic/io.h file to the degree necessary to make it useful on ARM64 and potentially other architectures" * tag 'asm-generic-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic: (29 commits) ARM64: use GENERIC_PCI_IOMAP sparc: io: remove duplicate relaxed accessors on sparc32 ARM: sa11x0: Use void __iomem * in MMIO accessors arm64: Use include/asm-generic/io.h ARM: Use include/asm-generic/io.h asm-generic/io.h: Implement generic {read,write}s*() asm-generic/io.h: Reconcile I/O accessor overrides /dev/mem: Use more consistent data types Change xlate_dev_{kmem,mem}_ptr() prototypes ARM: ixp4xx: Properly override I/O accessors ARM: ixp4xx: Fix build with IXP4XX_INDIRECT_PCI ARM: ebsa110: Properly override I/O accessors ARC: Remove redundant PCI_IOBASE declaration documentation: memory-barriers: clarify relaxed io accessor semantics x86: io: implement dummy relaxed accessor macros for writes tile: io: implement dummy relaxed accessor macros for writes sparc: io: implement dummy relaxed accessor macros for writes powerpc: io: implement dummy relaxed accessor macros for writes parisc: io: implement dummy relaxed accessor macros for writes mn10300: io: implement dummy relaxed accessor macros for writes ...
Diffstat (limited to 'arch')
-rw-r--r--arch/arc/include/asm/io.h2
-rw-r--r--arch/arm/include/asm/io.h89
-rw-r--r--arch/arm/include/asm/memory.h4
-rw-r--r--arch/arm/mach-ebsa110/include/mach/io.h25
-rw-r--r--arch/arm/mach-ebsa110/io.c14
-rw-r--r--arch/arm/mach-ixp4xx/common.c2
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/io.h24
-rw-r--r--arch/arm/mach-sa1100/pci-nanoengine.c8
-rw-r--r--arch/arm64/Kconfig2
-rw-r--r--arch/arm64/include/asm/io.h122
-rw-r--r--arch/arm64/include/asm/memory.h2
-rw-r--r--arch/cris/include/asm/io.h3
-rw-r--r--arch/frv/include/asm/io.h3
-rw-r--r--arch/ia64/include/asm/io.h4
-rw-r--r--arch/ia64/include/asm/uaccess.h16
-rw-r--r--arch/m32r/include/asm/io.h3
-rw-r--r--arch/m68k/include/asm/io.h8
-rw-r--r--arch/m68k/include/asm/io_no.h4
-rw-r--r--arch/microblaze/include/asm/io.h8
-rw-r--r--arch/mn10300/include/asm/io.h4
-rw-r--r--arch/parisc/include/asm/io.h12
-rw-r--r--arch/powerpc/include/asm/io.h12
-rw-r--r--arch/s390/include/asm/io.h10
-rw-r--r--arch/s390/mm/maccess.c4
-rw-r--r--arch/sparc/include/asm/io_32.h4
-rw-r--r--arch/sparc/include/asm/io_64.h14
-rw-r--r--arch/tile/include/asm/io.h4
-rw-r--r--arch/x86/include/asm/io.h8
-rw-r--r--arch/x86/mm/ioremap.c4
-rw-r--r--arch/xtensa/include/asm/io.h7
30 files changed, 194 insertions, 232 deletions
diff --git a/arch/arc/include/asm/io.h b/arch/arc/include/asm/io.h
index 334ce7017a18..cabd518cb253 100644
--- a/arch/arc/include/asm/io.h
+++ b/arch/arc/include/asm/io.h
@@ -13,8 +13,6 @@
13#include <asm/byteorder.h> 13#include <asm/byteorder.h>
14#include <asm/page.h> 14#include <asm/page.h>
15 15
16#define PCI_IOBASE ((void __iomem *)0)
17
18extern void __iomem *ioremap(unsigned long physaddr, unsigned long size); 16extern void __iomem *ioremap(unsigned long physaddr, unsigned long size);
19extern void __iomem *ioremap_prot(phys_addr_t offset, unsigned long size, 17extern void __iomem *ioremap_prot(phys_addr_t offset, unsigned long size,
20 unsigned long flags); 18 unsigned long flags);
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index 180567408ee8..db58deb00aa7 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -47,13 +47,13 @@ extern void atomic_io_modify_relaxed(void __iomem *reg, u32 mask, u32 set);
47 * Generic IO read/write. These perform native-endian accesses. Note 47 * Generic IO read/write. These perform native-endian accesses. Note
48 * that some architectures will want to re-define __raw_{read,write}w. 48 * that some architectures will want to re-define __raw_{read,write}w.
49 */ 49 */
50extern void __raw_writesb(void __iomem *addr, const void *data, int bytelen); 50void __raw_writesb(volatile void __iomem *addr, const void *data, int bytelen);
51extern void __raw_writesw(void __iomem *addr, const void *data, int wordlen); 51void __raw_writesw(volatile void __iomem *addr, const void *data, int wordlen);
52extern void __raw_writesl(void __iomem *addr, const void *data, int longlen); 52void __raw_writesl(volatile void __iomem *addr, const void *data, int longlen);
53 53
54extern void __raw_readsb(const void __iomem *addr, void *data, int bytelen); 54void __raw_readsb(const volatile void __iomem *addr, void *data, int bytelen);
55extern void __raw_readsw(const void __iomem *addr, void *data, int wordlen); 55void __raw_readsw(const volatile void __iomem *addr, void *data, int wordlen);
56extern void __raw_readsl(const void __iomem *addr, void *data, int longlen); 56void __raw_readsl(const volatile void __iomem *addr, void *data, int longlen);
57 57
58#if __LINUX_ARM_ARCH__ < 6 58#if __LINUX_ARM_ARCH__ < 6
59/* 59/*
@@ -69,6 +69,7 @@ extern void __raw_readsl(const void __iomem *addr, void *data, int longlen);
69 * writeback addressing modes as these incur a significant performance 69 * writeback addressing modes as these incur a significant performance
70 * overhead (the address generation must be emulated in software). 70 * overhead (the address generation must be emulated in software).
71 */ 71 */
72#define __raw_writew __raw_writew
72static inline void __raw_writew(u16 val, volatile void __iomem *addr) 73static inline void __raw_writew(u16 val, volatile void __iomem *addr)
73{ 74{
74 asm volatile("strh %1, %0" 75 asm volatile("strh %1, %0"
@@ -76,6 +77,7 @@ static inline void __raw_writew(u16 val, volatile void __iomem *addr)
76 : "r" (val)); 77 : "r" (val));
77} 78}
78 79
80#define __raw_readw __raw_readw
79static inline u16 __raw_readw(const volatile void __iomem *addr) 81static inline u16 __raw_readw(const volatile void __iomem *addr)
80{ 82{
81 u16 val; 83 u16 val;
@@ -86,6 +88,7 @@ static inline u16 __raw_readw(const volatile void __iomem *addr)
86} 88}
87#endif 89#endif
88 90
91#define __raw_writeb __raw_writeb
89static inline void __raw_writeb(u8 val, volatile void __iomem *addr) 92static inline void __raw_writeb(u8 val, volatile void __iomem *addr)
90{ 93{
91 asm volatile("strb %1, %0" 94 asm volatile("strb %1, %0"
@@ -93,6 +96,7 @@ static inline void __raw_writeb(u8 val, volatile void __iomem *addr)
93 : "r" (val)); 96 : "r" (val));
94} 97}
95 98
99#define __raw_writel __raw_writel
96static inline void __raw_writel(u32 val, volatile void __iomem *addr) 100static inline void __raw_writel(u32 val, volatile void __iomem *addr)
97{ 101{
98 asm volatile("str %1, %0" 102 asm volatile("str %1, %0"
@@ -100,6 +104,7 @@ static inline void __raw_writel(u32 val, volatile void __iomem *addr)
100 : "r" (val)); 104 : "r" (val));
101} 105}
102 106
107#define __raw_readb __raw_readb
103static inline u8 __raw_readb(const volatile void __iomem *addr) 108static inline u8 __raw_readb(const volatile void __iomem *addr)
104{ 109{
105 u8 val; 110 u8 val;
@@ -109,6 +114,7 @@ static inline u8 __raw_readb(const volatile void __iomem *addr)
109 return val; 114 return val;
110} 115}
111 116
117#define __raw_readl __raw_readl
112static inline u32 __raw_readl(const volatile void __iomem *addr) 118static inline u32 __raw_readl(const volatile void __iomem *addr)
113{ 119{
114 u32 val; 120 u32 val;
@@ -267,20 +273,6 @@ extern int pci_ioremap_io(unsigned int offset, phys_addr_t phys_addr);
267#define insl(p,d,l) __raw_readsl(__io(p),d,l) 273#define insl(p,d,l) __raw_readsl(__io(p),d,l)
268#endif 274#endif
269 275
270#define outb_p(val,port) outb((val),(port))
271#define outw_p(val,port) outw((val),(port))
272#define outl_p(val,port) outl((val),(port))
273#define inb_p(port) inb((port))
274#define inw_p(port) inw((port))
275#define inl_p(port) inl((port))
276
277#define outsb_p(port,from,len) outsb(port,from,len)
278#define outsw_p(port,from,len) outsw(port,from,len)
279#define outsl_p(port,from,len) outsl(port,from,len)
280#define insb_p(port,to,len) insb(port,to,len)
281#define insw_p(port,to,len) insw(port,to,len)
282#define insl_p(port,to,len) insl(port,to,len)
283
284/* 276/*
285 * String version of IO memory access ops: 277 * String version of IO memory access ops:
286 */ 278 */
@@ -347,40 +339,42 @@ extern void _memset_io(volatile void __iomem *, int, size_t);
347#define iounmap __arm_iounmap 339#define iounmap __arm_iounmap
348 340
349/* 341/*
350 * io{read,write}{8,16,32} macros 342 * io{read,write}{16,32}be() macros
351 */ 343 */
352#ifndef ioread8 344#define ioread16be(p) ({ __u16 __v = be16_to_cpu((__force __be16)__raw_readw(p)); __iormb(); __v; })
353#define ioread8(p) ({ unsigned int __v = __raw_readb(p); __iormb(); __v; }) 345#define ioread32be(p) ({ __u32 __v = be32_to_cpu((__force __be32)__raw_readl(p)); __iormb(); __v; })
354#define ioread16(p) ({ unsigned int __v = le16_to_cpu((__force __le16)__raw_readw(p)); __iormb(); __v; })
355#define ioread32(p) ({ unsigned int __v = le32_to_cpu((__force __le32)__raw_readl(p)); __iormb(); __v; })
356
357#define ioread16be(p) ({ unsigned int __v = be16_to_cpu((__force __be16)__raw_readw(p)); __iormb(); __v; })
358#define ioread32be(p) ({ unsigned int __v = be32_to_cpu((__force __be32)__raw_readl(p)); __iormb(); __v; })
359
360#define iowrite8(v,p) ({ __iowmb(); __raw_writeb(v, p); })
361#define iowrite16(v,p) ({ __iowmb(); __raw_writew((__force __u16)cpu_to_le16(v), p); })
362#define iowrite32(v,p) ({ __iowmb(); __raw_writel((__force __u32)cpu_to_le32(v), p); })
363 346
364#define iowrite16be(v,p) ({ __iowmb(); __raw_writew((__force __u16)cpu_to_be16(v), p); }) 347#define iowrite16be(v,p) ({ __iowmb(); __raw_writew((__force __u16)cpu_to_be16(v), p); })
365#define iowrite32be(v,p) ({ __iowmb(); __raw_writel((__force __u32)cpu_to_be32(v), p); }) 348#define iowrite32be(v,p) ({ __iowmb(); __raw_writel((__force __u32)cpu_to_be32(v), p); })
366
367#define ioread8_rep(p,d,c) __raw_readsb(p,d,c)
368#define ioread16_rep(p,d,c) __raw_readsw(p,d,c)
369#define ioread32_rep(p,d,c) __raw_readsl(p,d,c)
370
371#define iowrite8_rep(p,s,c) __raw_writesb(p,s,c)
372#define iowrite16_rep(p,s,c) __raw_writesw(p,s,c)
373#define iowrite32_rep(p,s,c) __raw_writesl(p,s,c)
374 349
350#ifndef ioport_map
351#define ioport_map ioport_map
375extern void __iomem *ioport_map(unsigned long port, unsigned int nr); 352extern void __iomem *ioport_map(unsigned long port, unsigned int nr);
353#endif
354#ifndef ioport_unmap
355#define ioport_unmap ioport_unmap
376extern void ioport_unmap(void __iomem *addr); 356extern void ioport_unmap(void __iomem *addr);
377#endif 357#endif
378 358
379struct pci_dev; 359struct pci_dev;
380 360
361#define pci_iounmap pci_iounmap
381extern void pci_iounmap(struct pci_dev *dev, void __iomem *addr); 362extern void pci_iounmap(struct pci_dev *dev, void __iomem *addr);
382 363
383/* 364/*
365 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
366 * access
367 */
368#define xlate_dev_mem_ptr(p) __va(p)
369
370/*
371 * Convert a virtual cached pointer to an uncached pointer
372 */
373#define xlate_dev_kmem_ptr(p) p
374
375#include <asm-generic/io.h>
376
377/*
384 * can the hardware map this into one segment or not, given no other 378 * can the hardware map this into one segment or not, given no other
385 * constraints. 379 * constraints.
386 */ 380 */
@@ -402,17 +396,6 @@ extern int devmem_is_allowed(unsigned long pfn);
402#endif 396#endif
403 397
404/* 398/*
405 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
406 * access
407 */
408#define xlate_dev_mem_ptr(p) __va(p)
409
410/*
411 * Convert a virtual cached pointer to an uncached pointer
412 */
413#define xlate_dev_kmem_ptr(p) p
414
415/*
416 * Register ISA memory and port locations for glibc iopl/inb/outb 399 * Register ISA memory and port locations for glibc iopl/inb/outb
417 * emulation. 400 * emulation.
418 */ 401 */
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index e731018869a7..184def0e1652 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -274,11 +274,13 @@ static inline unsigned long __phys_to_virt(phys_addr_t x)
274 * translation for translating DMA addresses. Use the driver 274 * translation for translating DMA addresses. Use the driver
275 * DMA support - see dma-mapping.h. 275 * DMA support - see dma-mapping.h.
276 */ 276 */
277#define virt_to_phys virt_to_phys
277static inline phys_addr_t virt_to_phys(const volatile void *x) 278static inline phys_addr_t virt_to_phys(const volatile void *x)
278{ 279{
279 return __virt_to_phys((unsigned long)(x)); 280 return __virt_to_phys((unsigned long)(x));
280} 281}
281 282
283#define phys_to_virt phys_to_virt
282static inline void *phys_to_virt(phys_addr_t x) 284static inline void *phys_to_virt(phys_addr_t x)
283{ 285{
284 return (void *)__phys_to_virt(x); 286 return (void *)__phys_to_virt(x);
@@ -322,11 +324,13 @@ static inline phys_addr_t __virt_to_idmap(unsigned long x)
322#endif 324#endif
323 325
324#ifdef CONFIG_VIRT_TO_BUS 326#ifdef CONFIG_VIRT_TO_BUS
327#define virt_to_bus virt_to_bus
325static inline __deprecated unsigned long virt_to_bus(void *x) 328static inline __deprecated unsigned long virt_to_bus(void *x)
326{ 329{
327 return __virt_to_bus((unsigned long)x); 330 return __virt_to_bus((unsigned long)x);
328} 331}
329 332
333#define bus_to_virt bus_to_virt
330static inline __deprecated void *bus_to_virt(unsigned long x) 334static inline __deprecated void *bus_to_virt(unsigned long x)
331{ 335{
332 return (void *)__bus_to_virt(x); 336 return (void *)__bus_to_virt(x);
diff --git a/arch/arm/mach-ebsa110/include/mach/io.h b/arch/arm/mach-ebsa110/include/mach/io.h
index 11bb0799424b..69975784acfa 100644
--- a/arch/arm/mach-ebsa110/include/mach/io.h
+++ b/arch/arm/mach-ebsa110/include/mach/io.h
@@ -29,9 +29,9 @@ u8 __readb(const volatile void __iomem *addr);
29u16 __readw(const volatile void __iomem *addr); 29u16 __readw(const volatile void __iomem *addr);
30u32 __readl(const volatile void __iomem *addr); 30u32 __readl(const volatile void __iomem *addr);
31 31
32void __writeb(u8 val, void __iomem *addr); 32void __writeb(u8 val, volatile void __iomem *addr);
33void __writew(u16 val, void __iomem *addr); 33void __writew(u16 val, volatile void __iomem *addr);
34void __writel(u32 val, void __iomem *addr); 34void __writel(u32 val, volatile void __iomem *addr);
35 35
36/* 36/*
37 * Argh, someone forgot the IOCS16 line. We therefore have to handle 37 * Argh, someone forgot the IOCS16 line. We therefore have to handle
@@ -62,20 +62,31 @@ void __writel(u32 val, void __iomem *addr);
62#define writew(v,b) __writew(v,b) 62#define writew(v,b) __writew(v,b)
63#define writel(v,b) __writel(v,b) 63#define writel(v,b) __writel(v,b)
64 64
65#define insb insb
65extern void insb(unsigned int port, void *buf, int sz); 66extern void insb(unsigned int port, void *buf, int sz);
67#define insw insw
66extern void insw(unsigned int port, void *buf, int sz); 68extern void insw(unsigned int port, void *buf, int sz);
69#define insl insl
67extern void insl(unsigned int port, void *buf, int sz); 70extern void insl(unsigned int port, void *buf, int sz);
68 71
72#define outsb outsb
69extern void outsb(unsigned int port, const void *buf, int sz); 73extern void outsb(unsigned int port, const void *buf, int sz);
74#define outsw outsw
70extern void outsw(unsigned int port, const void *buf, int sz); 75extern void outsw(unsigned int port, const void *buf, int sz);
76#define outsl outsl
71extern void outsl(unsigned int port, const void *buf, int sz); 77extern void outsl(unsigned int port, const void *buf, int sz);
72 78
73/* can't support writesb atm */ 79/* can't support writesb atm */
74extern void writesw(void __iomem *addr, const void *data, int wordlen); 80#define writesw writesw
75extern void writesl(void __iomem *addr, const void *data, int longlen); 81extern void writesw(volatile void __iomem *addr, const void *data, int wordlen);
82#define writesl writesl
83extern void writesl(volatile void __iomem *addr, const void *data, int longlen);
76 84
77/* can't support readsb atm */ 85/* can't support readsb atm */
78extern void readsw(const void __iomem *addr, void *data, int wordlen); 86#define readsw readsw
79extern void readsl(const void __iomem *addr, void *data, int longlen); 87extern void readsw(const volatile void __iomem *addr, void *data, int wordlen);
88
89#define readsl readsl
90extern void readsl(const volatile void __iomem *addr, void *data, int longlen);
80 91
81#endif 92#endif
diff --git a/arch/arm/mach-ebsa110/io.c b/arch/arm/mach-ebsa110/io.c
index 756cc377a73d..b57980b435fd 100644
--- a/arch/arm/mach-ebsa110/io.c
+++ b/arch/arm/mach-ebsa110/io.c
@@ -102,7 +102,7 @@ EXPORT_SYMBOL(__readb);
102EXPORT_SYMBOL(__readw); 102EXPORT_SYMBOL(__readw);
103EXPORT_SYMBOL(__readl); 103EXPORT_SYMBOL(__readl);
104 104
105void readsw(const void __iomem *addr, void *data, int len) 105void readsw(const volatile void __iomem *addr, void *data, int len)
106{ 106{
107 void __iomem *a = __isamem_convert_addr(addr); 107 void __iomem *a = __isamem_convert_addr(addr);
108 108
@@ -112,7 +112,7 @@ void readsw(const void __iomem *addr, void *data, int len)
112} 112}
113EXPORT_SYMBOL(readsw); 113EXPORT_SYMBOL(readsw);
114 114
115void readsl(const void __iomem *addr, void *data, int len) 115void readsl(const volatile void __iomem *addr, void *data, int len)
116{ 116{
117 void __iomem *a = __isamem_convert_addr(addr); 117 void __iomem *a = __isamem_convert_addr(addr);
118 118
@@ -122,7 +122,7 @@ void readsl(const void __iomem *addr, void *data, int len)
122} 122}
123EXPORT_SYMBOL(readsl); 123EXPORT_SYMBOL(readsl);
124 124
125void __writeb(u8 val, void __iomem *addr) 125void __writeb(u8 val, volatile void __iomem *addr)
126{ 126{
127 void __iomem *a = __isamem_convert_addr(addr); 127 void __iomem *a = __isamem_convert_addr(addr);
128 128
@@ -132,7 +132,7 @@ void __writeb(u8 val, void __iomem *addr)
132 __raw_writeb(val, a); 132 __raw_writeb(val, a);
133} 133}
134 134
135void __writew(u16 val, void __iomem *addr) 135void __writew(u16 val, volatile void __iomem *addr)
136{ 136{
137 void __iomem *a = __isamem_convert_addr(addr); 137 void __iomem *a = __isamem_convert_addr(addr);
138 138
@@ -142,7 +142,7 @@ void __writew(u16 val, void __iomem *addr)
142 __raw_writew(val, a); 142 __raw_writew(val, a);
143} 143}
144 144
145void __writel(u32 val, void __iomem *addr) 145void __writel(u32 val, volatile void __iomem *addr)
146{ 146{
147 void __iomem *a = __isamem_convert_addr(addr); 147 void __iomem *a = __isamem_convert_addr(addr);
148 148
@@ -157,7 +157,7 @@ EXPORT_SYMBOL(__writeb);
157EXPORT_SYMBOL(__writew); 157EXPORT_SYMBOL(__writew);
158EXPORT_SYMBOL(__writel); 158EXPORT_SYMBOL(__writel);
159 159
160void writesw(void __iomem *addr, const void *data, int len) 160void writesw(volatile void __iomem *addr, const void *data, int len)
161{ 161{
162 void __iomem *a = __isamem_convert_addr(addr); 162 void __iomem *a = __isamem_convert_addr(addr);
163 163
@@ -167,7 +167,7 @@ void writesw(void __iomem *addr, const void *data, int len)
167} 167}
168EXPORT_SYMBOL(writesw); 168EXPORT_SYMBOL(writesw);
169 169
170void writesl(void __iomem *addr, const void *data, int len) 170void writesl(volatile void __iomem *addr, const void *data, int len)
171{ 171{
172 void __iomem *a = __isamem_convert_addr(addr); 172 void __iomem *a = __isamem_convert_addr(addr);
173 173
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index fc4b7b24265e..8537d4c41e34 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -652,7 +652,7 @@ static void __iomem *ixp4xx_ioremap_caller(phys_addr_t addr, size_t size,
652 return (void __iomem *)addr; 652 return (void __iomem *)addr;
653} 653}
654 654
655static void ixp4xx_iounmap(void __iomem *addr) 655static void ixp4xx_iounmap(volatile void __iomem *addr)
656{ 656{
657 if (!is_pci_memory((__force u32)addr)) 657 if (!is_pci_memory((__force u32)addr))
658 __iounmap(addr); 658 __iounmap(addr);
diff --git a/arch/arm/mach-ixp4xx/include/mach/io.h b/arch/arm/mach-ixp4xx/include/mach/io.h
index 7d11979da030..6a722860e34d 100644
--- a/arch/arm/mach-ixp4xx/include/mach/io.h
+++ b/arch/arm/mach-ixp4xx/include/mach/io.h
@@ -58,6 +58,10 @@ static inline int is_pci_memory(u32 addr)
58#define writew(v, p) __indirect_writew(v, p) 58#define writew(v, p) __indirect_writew(v, p)
59#define writel(v, p) __indirect_writel(v, p) 59#define writel(v, p) __indirect_writel(v, p)
60 60
61#define writeb_relaxed(v, p) __indirect_writeb(v, p)
62#define writew_relaxed(v, p) __indirect_writew(v, p)
63#define writel_relaxed(v, p) __indirect_writel(v, p)
64
61#define writesb(p, v, l) __indirect_writesb(p, v, l) 65#define writesb(p, v, l) __indirect_writesb(p, v, l)
62#define writesw(p, v, l) __indirect_writesw(p, v, l) 66#define writesw(p, v, l) __indirect_writesw(p, v, l)
63#define writesl(p, v, l) __indirect_writesl(p, v, l) 67#define writesl(p, v, l) __indirect_writesl(p, v, l)
@@ -66,6 +70,10 @@ static inline int is_pci_memory(u32 addr)
66#define readw(p) __indirect_readw(p) 70#define readw(p) __indirect_readw(p)
67#define readl(p) __indirect_readl(p) 71#define readl(p) __indirect_readl(p)
68 72
73#define readb_relaxed(p) __indirect_readb(p)
74#define readw_relaxed(p) __indirect_readw(p)
75#define readl_relaxed(p) __indirect_readl(p)
76
69#define readsb(p, v, l) __indirect_readsb(p, v, l) 77#define readsb(p, v, l) __indirect_readsb(p, v, l)
70#define readsw(p, v, l) __indirect_readsw(p, v, l) 78#define readsw(p, v, l) __indirect_readsw(p, v, l)
71#define readsl(p, v, l) __indirect_readsl(p, v, l) 79#define readsl(p, v, l) __indirect_readsl(p, v, l)
@@ -99,7 +107,7 @@ static inline void __indirect_writew(u16 value, volatile void __iomem *p)
99 u32 n, byte_enables, data; 107 u32 n, byte_enables, data;
100 108
101 if (!is_pci_memory(addr)) { 109 if (!is_pci_memory(addr)) {
102 __raw_writew(value, addr); 110 __raw_writew(value, p);
103 return; 111 return;
104 } 112 }
105 113
@@ -164,7 +172,7 @@ static inline unsigned short __indirect_readw(const volatile void __iomem *p)
164 u32 n, byte_enables, data; 172 u32 n, byte_enables, data;
165 173
166 if (!is_pci_memory(addr)) 174 if (!is_pci_memory(addr))
167 return __raw_readw(addr); 175 return __raw_readw(p);
168 176
169 n = addr % 4; 177 n = addr % 4;
170 byte_enables = (0xf & ~(BIT(n) | BIT(n+1))) << IXP4XX_PCI_NP_CBE_BESL; 178 byte_enables = (0xf & ~(BIT(n) | BIT(n+1))) << IXP4XX_PCI_NP_CBE_BESL;
@@ -226,6 +234,7 @@ static inline void __indirect_readsl(const volatile void __iomem *bus_addr,
226 * I/O functions. 234 * I/O functions.
227 */ 235 */
228 236
237#define outb outb
229static inline void outb(u8 value, u32 addr) 238static inline void outb(u8 value, u32 addr)
230{ 239{
231 u32 n, byte_enables, data; 240 u32 n, byte_enables, data;
@@ -235,12 +244,14 @@ static inline void outb(u8 value, u32 addr)
235 ixp4xx_pci_write(addr, byte_enables | NP_CMD_IOWRITE, data); 244 ixp4xx_pci_write(addr, byte_enables | NP_CMD_IOWRITE, data);
236} 245}
237 246
247#define outsb outsb
238static inline void outsb(u32 io_addr, const u8 *vaddr, u32 count) 248static inline void outsb(u32 io_addr, const u8 *vaddr, u32 count)
239{ 249{
240 while (count--) 250 while (count--)
241 outb(*vaddr++, io_addr); 251 outb(*vaddr++, io_addr);
242} 252}
243 253
254#define outw outw
244static inline void outw(u16 value, u32 addr) 255static inline void outw(u16 value, u32 addr)
245{ 256{
246 u32 n, byte_enables, data; 257 u32 n, byte_enables, data;
@@ -250,23 +261,27 @@ static inline void outw(u16 value, u32 addr)
250 ixp4xx_pci_write(addr, byte_enables | NP_CMD_IOWRITE, data); 261 ixp4xx_pci_write(addr, byte_enables | NP_CMD_IOWRITE, data);
251} 262}
252 263
264#define outsw outsw
253static inline void outsw(u32 io_addr, const u16 *vaddr, u32 count) 265static inline void outsw(u32 io_addr, const u16 *vaddr, u32 count)
254{ 266{
255 while (count--) 267 while (count--)
256 outw(cpu_to_le16(*vaddr++), io_addr); 268 outw(cpu_to_le16(*vaddr++), io_addr);
257} 269}
258 270
271#define outl outl
259static inline void outl(u32 value, u32 addr) 272static inline void outl(u32 value, u32 addr)
260{ 273{
261 ixp4xx_pci_write(addr, NP_CMD_IOWRITE, value); 274 ixp4xx_pci_write(addr, NP_CMD_IOWRITE, value);
262} 275}
263 276
277#define outsl outsl
264static inline void outsl(u32 io_addr, const u32 *vaddr, u32 count) 278static inline void outsl(u32 io_addr, const u32 *vaddr, u32 count)
265{ 279{
266 while (count--) 280 while (count--)
267 outl(cpu_to_le32(*vaddr++), io_addr); 281 outl(cpu_to_le32(*vaddr++), io_addr);
268} 282}
269 283
284#define inb inb
270static inline u8 inb(u32 addr) 285static inline u8 inb(u32 addr)
271{ 286{
272 u32 n, byte_enables, data; 287 u32 n, byte_enables, data;
@@ -278,12 +293,14 @@ static inline u8 inb(u32 addr)
278 return data >> (8*n); 293 return data >> (8*n);
279} 294}
280 295
296#define insb insb
281static inline void insb(u32 io_addr, u8 *vaddr, u32 count) 297static inline void insb(u32 io_addr, u8 *vaddr, u32 count)
282{ 298{
283 while (count--) 299 while (count--)
284 *vaddr++ = inb(io_addr); 300 *vaddr++ = inb(io_addr);
285} 301}
286 302
303#define inw inw
287static inline u16 inw(u32 addr) 304static inline u16 inw(u32 addr)
288{ 305{
289 u32 n, byte_enables, data; 306 u32 n, byte_enables, data;
@@ -295,12 +312,14 @@ static inline u16 inw(u32 addr)
295 return data>>(8*n); 312 return data>>(8*n);
296} 313}
297 314
315#define insw insw
298static inline void insw(u32 io_addr, u16 *vaddr, u32 count) 316static inline void insw(u32 io_addr, u16 *vaddr, u32 count)
299{ 317{
300 while (count--) 318 while (count--)
301 *vaddr++ = le16_to_cpu(inw(io_addr)); 319 *vaddr++ = le16_to_cpu(inw(io_addr));
302} 320}
303 321
322#define inl inl
304static inline u32 inl(u32 addr) 323static inline u32 inl(u32 addr)
305{ 324{
306 u32 data; 325 u32 data;
@@ -310,6 +329,7 @@ static inline u32 inl(u32 addr)
310 return data; 329 return data;
311} 330}
312 331
332#define insl insl
313static inline void insl(u32 io_addr, u32 *vaddr, u32 count) 333static inline void insl(u32 io_addr, u32 *vaddr, u32 count)
314{ 334{
315 while (count--) 335 while (count--)
diff --git a/arch/arm/mach-sa1100/pci-nanoengine.c b/arch/arm/mach-sa1100/pci-nanoengine.c
index ff02e2da99f2..b704433c529c 100644
--- a/arch/arm/mach-sa1100/pci-nanoengine.c
+++ b/arch/arm/mach-sa1100/pci-nanoengine.c
@@ -33,12 +33,12 @@
33static DEFINE_SPINLOCK(nano_lock); 33static DEFINE_SPINLOCK(nano_lock);
34 34
35static int nanoengine_get_pci_address(struct pci_bus *bus, 35static int nanoengine_get_pci_address(struct pci_bus *bus,
36 unsigned int devfn, int where, unsigned long *address) 36 unsigned int devfn, int where, void __iomem **address)
37{ 37{
38 int ret = PCIBIOS_DEVICE_NOT_FOUND; 38 int ret = PCIBIOS_DEVICE_NOT_FOUND;
39 unsigned int busnr = bus->number; 39 unsigned int busnr = bus->number;
40 40
41 *address = NANO_PCI_CONFIG_SPACE_VIRT + 41 *address = (void __iomem *)NANO_PCI_CONFIG_SPACE_VIRT +
42 ((bus->number << 16) | (devfn << 8) | (where & ~3)); 42 ((bus->number << 16) | (devfn << 8) | (where & ~3));
43 43
44 ret = (busnr > 255 || devfn > 255 || where > 255) ? 44 ret = (busnr > 255 || devfn > 255 || where > 255) ?
@@ -51,7 +51,7 @@ static int nanoengine_read_config(struct pci_bus *bus, unsigned int devfn, int w
51 int size, u32 *val) 51 int size, u32 *val)
52{ 52{
53 int ret; 53 int ret;
54 unsigned long address; 54 void __iomem *address;
55 unsigned long flags; 55 unsigned long flags;
56 u32 v; 56 u32 v;
57 57
@@ -85,7 +85,7 @@ static int nanoengine_write_config(struct pci_bus *bus, unsigned int devfn, int
85 int size, u32 val) 85 int size, u32 val)
86{ 86{
87 int ret; 87 int ret;
88 unsigned long address; 88 void __iomem *address;
89 unsigned long flags; 89 unsigned long flags;
90 unsigned shift; 90 unsigned shift;
91 u32 v; 91 u32 v;
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index f385273f4b24..6b1ebd964c10 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -24,9 +24,9 @@ config ARM64
24 select GENERIC_CLOCKEVENTS_BROADCAST if SMP 24 select GENERIC_CLOCKEVENTS_BROADCAST if SMP
25 select GENERIC_CPU_AUTOPROBE 25 select GENERIC_CPU_AUTOPROBE
26 select GENERIC_EARLY_IOREMAP 26 select GENERIC_EARLY_IOREMAP
27 select GENERIC_IOMAP
28 select GENERIC_IRQ_PROBE 27 select GENERIC_IRQ_PROBE
29 select GENERIC_IRQ_SHOW 28 select GENERIC_IRQ_SHOW
29 select GENERIC_PCI_IOMAP
30 select GENERIC_SCHED_CLOCK 30 select GENERIC_SCHED_CLOCK
31 select GENERIC_SMP_IDLE_THREAD 31 select GENERIC_SMP_IDLE_THREAD
32 select GENERIC_STRNCPY_FROM_USER 32 select GENERIC_STRNCPY_FROM_USER
diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h
index 75825b63464d..949c406d4df4 100644
--- a/arch/arm64/include/asm/io.h
+++ b/arch/arm64/include/asm/io.h
@@ -36,26 +36,31 @@
36/* 36/*
37 * Generic IO read/write. These perform native-endian accesses. 37 * Generic IO read/write. These perform native-endian accesses.
38 */ 38 */
39#define __raw_writeb __raw_writeb
39static inline void __raw_writeb(u8 val, volatile void __iomem *addr) 40static inline void __raw_writeb(u8 val, volatile void __iomem *addr)
40{ 41{
41 asm volatile("strb %w0, [%1]" : : "r" (val), "r" (addr)); 42 asm volatile("strb %w0, [%1]" : : "r" (val), "r" (addr));
42} 43}
43 44
45#define __raw_writew __raw_writew
44static inline void __raw_writew(u16 val, volatile void __iomem *addr) 46static inline void __raw_writew(u16 val, volatile void __iomem *addr)
45{ 47{
46 asm volatile("strh %w0, [%1]" : : "r" (val), "r" (addr)); 48 asm volatile("strh %w0, [%1]" : : "r" (val), "r" (addr));
47} 49}
48 50
51#define __raw_writel __raw_writel
49static inline void __raw_writel(u32 val, volatile void __iomem *addr) 52static inline void __raw_writel(u32 val, volatile void __iomem *addr)
50{ 53{
51 asm volatile("str %w0, [%1]" : : "r" (val), "r" (addr)); 54 asm volatile("str %w0, [%1]" : : "r" (val), "r" (addr));
52} 55}
53 56
57#define __raw_writeq __raw_writeq
54static inline void __raw_writeq(u64 val, volatile void __iomem *addr) 58static inline void __raw_writeq(u64 val, volatile void __iomem *addr)
55{ 59{
56 asm volatile("str %0, [%1]" : : "r" (val), "r" (addr)); 60 asm volatile("str %0, [%1]" : : "r" (val), "r" (addr));
57} 61}
58 62
63#define __raw_readb __raw_readb
59static inline u8 __raw_readb(const volatile void __iomem *addr) 64static inline u8 __raw_readb(const volatile void __iomem *addr)
60{ 65{
61 u8 val; 66 u8 val;
@@ -66,6 +71,7 @@ static inline u8 __raw_readb(const volatile void __iomem *addr)
66 return val; 71 return val;
67} 72}
68 73
74#define __raw_readw __raw_readw
69static inline u16 __raw_readw(const volatile void __iomem *addr) 75static inline u16 __raw_readw(const volatile void __iomem *addr)
70{ 76{
71 u16 val; 77 u16 val;
@@ -77,6 +83,7 @@ static inline u16 __raw_readw(const volatile void __iomem *addr)
77 return val; 83 return val;
78} 84}
79 85
86#define __raw_readl __raw_readl
80static inline u32 __raw_readl(const volatile void __iomem *addr) 87static inline u32 __raw_readl(const volatile void __iomem *addr)
81{ 88{
82 u32 val; 89 u32 val;
@@ -87,6 +94,7 @@ static inline u32 __raw_readl(const volatile void __iomem *addr)
87 return val; 94 return val;
88} 95}
89 96
97#define __raw_readq __raw_readq
90static inline u64 __raw_readq(const volatile void __iomem *addr) 98static inline u64 __raw_readq(const volatile void __iomem *addr)
91{ 99{
92 u64 val; 100 u64 val;
@@ -140,94 +148,6 @@ static inline u64 __raw_readq(const volatile void __iomem *addr)
140#define IO_SPACE_LIMIT (SZ_32M - 1) 148#define IO_SPACE_LIMIT (SZ_32M - 1)
141#define PCI_IOBASE ((void __iomem *)(MODULES_VADDR - SZ_32M)) 149#define PCI_IOBASE ((void __iomem *)(MODULES_VADDR - SZ_32M))
142 150
143static inline u8 inb(unsigned long addr)
144{
145 return readb(addr + PCI_IOBASE);
146}
147
148static inline u16 inw(unsigned long addr)
149{
150 return readw(addr + PCI_IOBASE);
151}
152
153static inline u32 inl(unsigned long addr)
154{
155 return readl(addr + PCI_IOBASE);
156}
157
158static inline void outb(u8 b, unsigned long addr)
159{
160 writeb(b, addr + PCI_IOBASE);
161}
162
163static inline void outw(u16 b, unsigned long addr)
164{
165 writew(b, addr + PCI_IOBASE);
166}
167
168static inline void outl(u32 b, unsigned long addr)
169{
170 writel(b, addr + PCI_IOBASE);
171}
172
173#define inb_p(addr) inb(addr)
174#define inw_p(addr) inw(addr)
175#define inl_p(addr) inl(addr)
176
177#define outb_p(x, addr) outb((x), (addr))
178#define outw_p(x, addr) outw((x), (addr))
179#define outl_p(x, addr) outl((x), (addr))
180
181static inline void insb(unsigned long addr, void *buffer, int count)
182{
183 u8 *buf = buffer;
184 while (count--)
185 *buf++ = __raw_readb(addr + PCI_IOBASE);
186}
187
188static inline void insw(unsigned long addr, void *buffer, int count)
189{
190 u16 *buf = buffer;
191 while (count--)
192 *buf++ = __raw_readw(addr + PCI_IOBASE);
193}
194
195static inline void insl(unsigned long addr, void *buffer, int count)
196{
197 u32 *buf = buffer;
198 while (count--)
199 *buf++ = __raw_readl(addr + PCI_IOBASE);
200}
201
202static inline void outsb(unsigned long addr, const void *buffer, int count)
203{
204 const u8 *buf = buffer;
205 while (count--)
206 __raw_writeb(*buf++, addr + PCI_IOBASE);
207}
208
209static inline void outsw(unsigned long addr, const void *buffer, int count)
210{
211 const u16 *buf = buffer;
212 while (count--)
213 __raw_writew(*buf++, addr + PCI_IOBASE);
214}
215
216static inline void outsl(unsigned long addr, const void *buffer, int count)
217{
218 const u32 *buf = buffer;
219 while (count--)
220 __raw_writel(*buf++, addr + PCI_IOBASE);
221}
222
223#define insb_p(port,to,len) insb(port,to,len)
224#define insw_p(port,to,len) insw(port,to,len)
225#define insl_p(port,to,len) insl(port,to,len)
226
227#define outsb_p(port,from,len) outsb(port,from,len)
228#define outsw_p(port,from,len) outsw(port,from,len)
229#define outsl_p(port,from,len) outsl(port,from,len)
230
231/* 151/*
232 * String version of I/O memory access operations. 152 * String version of I/O memory access operations.
233 */ 153 */
@@ -251,18 +171,14 @@ extern void __iomem *ioremap_cache(phys_addr_t phys_addr, size_t size);
251#define ioremap_wc(addr, size) __ioremap((addr), (size), __pgprot(PROT_NORMAL_NC)) 171#define ioremap_wc(addr, size) __ioremap((addr), (size), __pgprot(PROT_NORMAL_NC))
252#define iounmap __iounmap 172#define iounmap __iounmap
253 173
254#define ARCH_HAS_IOREMAP_WC
255#include <asm-generic/iomap.h>
256
257/* 174/*
258 * More restrictive address range checking than the default implementation 175 * io{read,write}{16,32}be() macros
259 * (PHYS_OFFSET and PHYS_MASK taken into account).
260 */ 176 */
261#define ARCH_HAS_VALID_PHYS_ADDR_RANGE 177#define ioread16be(p) ({ __u16 __v = be16_to_cpu((__force __be16)__raw_readw(p)); __iormb(); __v; })
262extern int valid_phys_addr_range(phys_addr_t addr, size_t size); 178#define ioread32be(p) ({ __u32 __v = be32_to_cpu((__force __be32)__raw_readl(p)); __iormb(); __v; })
263extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);
264 179
265extern int devmem_is_allowed(unsigned long pfn); 180#define iowrite16be(v,p) ({ __iowmb(); __raw_writew((__force __u16)cpu_to_be16(v), p); })
181#define iowrite32be(v,p) ({ __iowmb(); __raw_writel((__force __u32)cpu_to_be32(v), p); })
266 182
267/* 183/*
268 * Convert a physical pointer to a virtual kernel pointer for /dev/mem 184 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
@@ -275,6 +191,18 @@ extern int devmem_is_allowed(unsigned long pfn);
275 */ 191 */
276#define xlate_dev_kmem_ptr(p) p 192#define xlate_dev_kmem_ptr(p) p
277 193
194#include <asm-generic/io.h>
195
196/*
197 * More restrictive address range checking than the default implementation
198 * (PHYS_OFFSET and PHYS_MASK taken into account).
199 */
200#define ARCH_HAS_VALID_PHYS_ADDR_RANGE
201extern int valid_phys_addr_range(phys_addr_t addr, size_t size);
202extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);
203
204extern int devmem_is_allowed(unsigned long pfn);
205
278struct bio_vec; 206struct bio_vec;
279extern bool xen_biovec_phys_mergeable(const struct bio_vec *vec1, 207extern bool xen_biovec_phys_mergeable(const struct bio_vec *vec1,
280 const struct bio_vec *vec2); 208 const struct bio_vec *vec2);
diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h
index a62cd077457b..6486b2bfd562 100644
--- a/arch/arm64/include/asm/memory.h
+++ b/arch/arm64/include/asm/memory.h
@@ -120,11 +120,13 @@ extern phys_addr_t memstart_addr;
120 * translation for translating DMA addresses. Use the driver 120 * translation for translating DMA addresses. Use the driver
121 * DMA support - see dma-mapping.h. 121 * DMA support - see dma-mapping.h.
122 */ 122 */
123#define virt_to_phys virt_to_phys
123static inline phys_addr_t virt_to_phys(const volatile void *x) 124static inline phys_addr_t virt_to_phys(const volatile void *x)
124{ 125{
125 return __virt_to_phys((unsigned long)(x)); 126 return __virt_to_phys((unsigned long)(x));
126} 127}
127 128
129#define phys_to_virt phys_to_virt
128static inline void *phys_to_virt(phys_addr_t x) 130static inline void *phys_to_virt(phys_addr_t x)
129{ 131{
130 return (void *)(__phys_to_virt(x)); 132 return (void *)(__phys_to_virt(x));
diff --git a/arch/cris/include/asm/io.h b/arch/cris/include/asm/io.h
index e59dba12ce94..752a3f45df60 100644
--- a/arch/cris/include/asm/io.h
+++ b/arch/cris/include/asm/io.h
@@ -112,6 +112,9 @@ static inline void writel(unsigned int b, volatile void __iomem *addr)
112 else 112 else
113 *(volatile unsigned int __force *) addr = b; 113 *(volatile unsigned int __force *) addr = b;
114} 114}
115#define writeb_relaxed(b, addr) writeb(b, addr)
116#define writew_relaxed(b, addr) writew(b, addr)
117#define writel_relaxed(b, addr) writel(b, addr)
115#define __raw_writeb writeb 118#define __raw_writeb writeb
116#define __raw_writew writew 119#define __raw_writew writew
117#define __raw_writel writel 120#define __raw_writel writel
diff --git a/arch/frv/include/asm/io.h b/arch/frv/include/asm/io.h
index 8cb50a2fbcb2..99bb7efaf9b7 100644
--- a/arch/frv/include/asm/io.h
+++ b/arch/frv/include/asm/io.h
@@ -243,6 +243,9 @@ static inline void writel(uint32_t datum, volatile void __iomem *addr)
243 __flush_PCI_writes(); 243 __flush_PCI_writes();
244} 244}
245 245
246#define writeb_relaxed writeb
247#define writew_relaxed writew
248#define writel_relaxed writel
246 249
247/* Values for nocacheflag and cmode */ 250/* Values for nocacheflag and cmode */
248#define IOMAP_FULL_CACHING 0 251#define IOMAP_FULL_CACHING 0
diff --git a/arch/ia64/include/asm/io.h b/arch/ia64/include/asm/io.h
index bee0acd52f7e..80a7e34be009 100644
--- a/arch/ia64/include/asm/io.h
+++ b/arch/ia64/include/asm/io.h
@@ -393,6 +393,10 @@ __writeq (unsigned long val, volatile void __iomem *addr)
393#define writew(v,a) __writew((v), (a)) 393#define writew(v,a) __writew((v), (a))
394#define writel(v,a) __writel((v), (a)) 394#define writel(v,a) __writel((v), (a))
395#define writeq(v,a) __writeq((v), (a)) 395#define writeq(v,a) __writeq((v), (a))
396#define writeb_relaxed(v,a) __writeb((v), (a))
397#define writew_relaxed(v,a) __writew((v), (a))
398#define writel_relaxed(v,a) __writel((v), (a))
399#define writeq_relaxed(v,a) __writeq((v), (a))
396#define __raw_writeb writeb 400#define __raw_writeb writeb
397#define __raw_writew writew 401#define __raw_writew writew
398#define __raw_writel writel 402#define __raw_writel writel
diff --git a/arch/ia64/include/asm/uaccess.h b/arch/ia64/include/asm/uaccess.h
index 449c8c0fa2bd..103bedc59644 100644
--- a/arch/ia64/include/asm/uaccess.h
+++ b/arch/ia64/include/asm/uaccess.h
@@ -365,15 +365,15 @@ ia64_done_with_exception (struct pt_regs *regs)
365} 365}
366 366
367#define ARCH_HAS_TRANSLATE_MEM_PTR 1 367#define ARCH_HAS_TRANSLATE_MEM_PTR 1
368static __inline__ char * 368static __inline__ void *
369xlate_dev_mem_ptr (unsigned long p) 369xlate_dev_mem_ptr(phys_addr_t p)
370{ 370{
371 struct page *page; 371 struct page *page;
372 char * ptr; 372 void *ptr;
373 373
374 page = pfn_to_page(p >> PAGE_SHIFT); 374 page = pfn_to_page(p >> PAGE_SHIFT);
375 if (PageUncached(page)) 375 if (PageUncached(page))
376 ptr = (char *)p + __IA64_UNCACHED_OFFSET; 376 ptr = (void *)p + __IA64_UNCACHED_OFFSET;
377 else 377 else
378 ptr = __va(p); 378 ptr = __va(p);
379 379
@@ -383,15 +383,15 @@ xlate_dev_mem_ptr (unsigned long p)
383/* 383/*
384 * Convert a virtual cached kernel memory pointer to an uncached pointer 384 * Convert a virtual cached kernel memory pointer to an uncached pointer
385 */ 385 */
386static __inline__ char * 386static __inline__ void *
387xlate_dev_kmem_ptr (char * p) 387xlate_dev_kmem_ptr(void *p)
388{ 388{
389 struct page *page; 389 struct page *page;
390 char * ptr; 390 void *ptr;
391 391
392 page = virt_to_page((unsigned long)p); 392 page = virt_to_page((unsigned long)p);
393 if (PageUncached(page)) 393 if (PageUncached(page))
394 ptr = (char *)__pa(p) + __IA64_UNCACHED_OFFSET; 394 ptr = (void *)__pa(p) + __IA64_UNCACHED_OFFSET;
395 else 395 else
396 ptr = p; 396 ptr = p;
397 397
diff --git a/arch/m32r/include/asm/io.h b/arch/m32r/include/asm/io.h
index 4010f1fc5b65..6e7787f3dac7 100644
--- a/arch/m32r/include/asm/io.h
+++ b/arch/m32r/include/asm/io.h
@@ -161,6 +161,9 @@ static inline void _writel(unsigned long l, unsigned long addr)
161#define __raw_writeb writeb 161#define __raw_writeb writeb
162#define __raw_writew writew 162#define __raw_writew writew
163#define __raw_writel writel 163#define __raw_writel writel
164#define writeb_relaxed writeb
165#define writew_relaxed writew
166#define writel_relaxed writel
164 167
165#define ioread8 read 168#define ioread8 read
166#define ioread16 readw 169#define ioread16 readw
diff --git a/arch/m68k/include/asm/io.h b/arch/m68k/include/asm/io.h
index c70cc9155003..bccd5a914eb6 100644
--- a/arch/m68k/include/asm/io.h
+++ b/arch/m68k/include/asm/io.h
@@ -3,3 +3,11 @@
3#else 3#else
4#include <asm/io_mm.h> 4#include <asm/io_mm.h>
5#endif 5#endif
6
7#define readb_relaxed(addr) readb(addr)
8#define readw_relaxed(addr) readw(addr)
9#define readl_relaxed(addr) readl(addr)
10
11#define writeb_relaxed(b, addr) writeb(b, addr)
12#define writew_relaxed(b, addr) writew(b, addr)
13#define writel_relaxed(b, addr) writel(b, addr)
diff --git a/arch/m68k/include/asm/io_no.h b/arch/m68k/include/asm/io_no.h
index be4b5a813ad4..a93c8cde4d38 100644
--- a/arch/m68k/include/asm/io_no.h
+++ b/arch/m68k/include/asm/io_no.h
@@ -40,10 +40,6 @@ static inline unsigned int _swapl(volatile unsigned long v)
40#define readl(addr) \ 40#define readl(addr) \
41 ({ unsigned int __v = (*(volatile unsigned int *) (addr)); __v; }) 41 ({ unsigned int __v = (*(volatile unsigned int *) (addr)); __v; })
42 42
43#define readb_relaxed(addr) readb(addr)
44#define readw_relaxed(addr) readw(addr)
45#define readl_relaxed(addr) readl(addr)
46
47#define writeb(b,addr) (void)((*(volatile unsigned char *) (addr)) = (b)) 43#define writeb(b,addr) (void)((*(volatile unsigned char *) (addr)) = (b))
48#define writew(b,addr) (void)((*(volatile unsigned short *) (addr)) = (b)) 44#define writew(b,addr) (void)((*(volatile unsigned short *) (addr)) = (b))
49#define writel(b,addr) (void)((*(volatile unsigned int *) (addr)) = (b)) 45#define writel(b,addr) (void)((*(volatile unsigned int *) (addr)) = (b))
diff --git a/arch/microblaze/include/asm/io.h b/arch/microblaze/include/asm/io.h
index 433751b2a003..940f5fc1d1da 100644
--- a/arch/microblaze/include/asm/io.h
+++ b/arch/microblaze/include/asm/io.h
@@ -69,12 +69,4 @@ extern void __iomem *ioremap(phys_addr_t address, unsigned long size);
69 69
70#include <asm-generic/io.h> 70#include <asm-generic/io.h>
71 71
72#define readb_relaxed readb
73#define readw_relaxed readw
74#define readl_relaxed readl
75
76#define writeb_relaxed writeb
77#define writew_relaxed writew
78#define writel_relaxed writel
79
80#endif /* _ASM_MICROBLAZE_IO_H */ 72#endif /* _ASM_MICROBLAZE_IO_H */
diff --git a/arch/mn10300/include/asm/io.h b/arch/mn10300/include/asm/io.h
index e6ed0d897ccc..897ba3c12b32 100644
--- a/arch/mn10300/include/asm/io.h
+++ b/arch/mn10300/include/asm/io.h
@@ -67,6 +67,10 @@ static inline void writel(u32 b, volatile void __iomem *addr)
67#define __raw_writew writew 67#define __raw_writew writew
68#define __raw_writel writel 68#define __raw_writel writel
69 69
70#define writeb_relaxed writeb
71#define writew_relaxed writew
72#define writel_relaxed writel
73
70/*****************************************************************************/ 74/*****************************************************************************/
71/* 75/*
72 * traditional input/output functions 76 * traditional input/output functions
diff --git a/arch/parisc/include/asm/io.h b/arch/parisc/include/asm/io.h
index 1f6d2ae7aba5..8cd0abf28ffb 100644
--- a/arch/parisc/include/asm/io.h
+++ b/arch/parisc/include/asm/io.h
@@ -217,10 +217,14 @@ static inline void writeq(unsigned long long q, volatile void __iomem *addr)
217#define writel writel 217#define writel writel
218#define writeq writeq 218#define writeq writeq
219 219
220#define readb_relaxed(addr) readb(addr) 220#define readb_relaxed(addr) readb(addr)
221#define readw_relaxed(addr) readw(addr) 221#define readw_relaxed(addr) readw(addr)
222#define readl_relaxed(addr) readl(addr) 222#define readl_relaxed(addr) readl(addr)
223#define readq_relaxed(addr) readq(addr) 223#define readq_relaxed(addr) readq(addr)
224#define writeb_relaxed(b, addr) writeb(b, addr)
225#define writew_relaxed(w, addr) writew(w, addr)
226#define writel_relaxed(l, addr) writel(l, addr)
227#define writeq_relaxed(q, addr) writeq(q, addr)
224 228
225#define mmiowb() do { } while (0) 229#define mmiowb() do { } while (0)
226 230
diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
index 97d3869991ca..9eaf301ac952 100644
--- a/arch/powerpc/include/asm/io.h
+++ b/arch/powerpc/include/asm/io.h
@@ -617,10 +617,14 @@ static inline void name at \
617/* 617/*
618 * We don't do relaxed operations yet, at least not with this semantic 618 * We don't do relaxed operations yet, at least not with this semantic
619 */ 619 */
620#define readb_relaxed(addr) readb(addr) 620#define readb_relaxed(addr) readb(addr)
621#define readw_relaxed(addr) readw(addr) 621#define readw_relaxed(addr) readw(addr)
622#define readl_relaxed(addr) readl(addr) 622#define readl_relaxed(addr) readl(addr)
623#define readq_relaxed(addr) readq(addr) 623#define readq_relaxed(addr) readq(addr)
624#define writeb_relaxed(v, addr) writeb(v, addr)
625#define writew_relaxed(v, addr) writew(v, addr)
626#define writel_relaxed(v, addr) writel(v, addr)
627#define writeq_relaxed(v, addr) writeq(v, addr)
624 628
625#ifdef CONFIG_PPC32 629#ifdef CONFIG_PPC32
626#define mmiowb() 630#define mmiowb()
diff --git a/arch/s390/include/asm/io.h b/arch/s390/include/asm/io.h
index cd6b9ee7b69c..6ad9013c67e7 100644
--- a/arch/s390/include/asm/io.h
+++ b/arch/s390/include/asm/io.h
@@ -13,9 +13,10 @@
13#include <asm/page.h> 13#include <asm/page.h>
14#include <asm/pci_io.h> 14#include <asm/pci_io.h>
15 15
16void *xlate_dev_mem_ptr(unsigned long phys);
17#define xlate_dev_mem_ptr xlate_dev_mem_ptr 16#define xlate_dev_mem_ptr xlate_dev_mem_ptr
18void unxlate_dev_mem_ptr(unsigned long phys, void *addr); 17void *xlate_dev_mem_ptr(phys_addr_t phys);
18#define unxlate_dev_mem_ptr unxlate_dev_mem_ptr
19void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr);
19 20
20/* 21/*
21 * Convert a virtual cached pointer to an uncached pointer 22 * Convert a virtual cached pointer to an uncached pointer
@@ -60,11 +61,6 @@ static inline void iounmap(volatile void __iomem *addr)
60#define __raw_writel zpci_write_u32 61#define __raw_writel zpci_write_u32
61#define __raw_writeq zpci_write_u64 62#define __raw_writeq zpci_write_u64
62 63
63#define readb_relaxed readb
64#define readw_relaxed readw
65#define readl_relaxed readl
66#define readq_relaxed readq
67
68#endif /* CONFIG_PCI */ 64#endif /* CONFIG_PCI */
69 65
70#include <asm-generic/io.h> 66#include <asm-generic/io.h>
diff --git a/arch/s390/mm/maccess.c b/arch/s390/mm/maccess.c
index 2a2e35416d2f..2eb34bdfc613 100644
--- a/arch/s390/mm/maccess.c
+++ b/arch/s390/mm/maccess.c
@@ -176,7 +176,7 @@ static int is_swapped(unsigned long addr)
176 * For swapped prefix pages a new buffer is returned that contains a copy of 176 * For swapped prefix pages a new buffer is returned that contains a copy of
177 * the absolute memory. The buffer size is maximum one page large. 177 * the absolute memory. The buffer size is maximum one page large.
178 */ 178 */
179void *xlate_dev_mem_ptr(unsigned long addr) 179void *xlate_dev_mem_ptr(phys_addr_t addr)
180{ 180{
181 void *bounce = (void *) addr; 181 void *bounce = (void *) addr;
182 unsigned long size; 182 unsigned long size;
@@ -197,7 +197,7 @@ void *xlate_dev_mem_ptr(unsigned long addr)
197/* 197/*
198 * Free converted buffer for /dev/mem access (if necessary) 198 * Free converted buffer for /dev/mem access (if necessary)
199 */ 199 */
200void unxlate_dev_mem_ptr(unsigned long addr, void *buf) 200void unxlate_dev_mem_ptr(phys_addr_t addr, void *buf)
201{ 201{
202 if ((void *) addr != buf) 202 if ((void *) addr != buf)
203 free_page((unsigned long) buf); 203 free_page((unsigned long) buf);
diff --git a/arch/sparc/include/asm/io_32.h b/arch/sparc/include/asm/io_32.h
index 9f532902627c..407ac14295f4 100644
--- a/arch/sparc/include/asm/io_32.h
+++ b/arch/sparc/include/asm/io_32.h
@@ -4,10 +4,6 @@
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5#include <linux/ioport.h> /* struct resource */ 5#include <linux/ioport.h> /* struct resource */
6 6
7#define readb_relaxed(__addr) readb(__addr)
8#define readw_relaxed(__addr) readw(__addr)
9#define readl_relaxed(__addr) readl(__addr)
10
11#define IO_SPACE_LIMIT 0xffffffff 7#define IO_SPACE_LIMIT 0xffffffff
12 8
13#define memset_io(d,c,sz) _memset_io(d,c,sz) 9#define memset_io(d,c,sz) _memset_io(d,c,sz)
diff --git a/arch/sparc/include/asm/io_64.h b/arch/sparc/include/asm/io_64.h
index 80b54b326d49..9b672be70dda 100644
--- a/arch/sparc/include/asm/io_64.h
+++ b/arch/sparc/include/asm/io_64.h
@@ -101,6 +101,7 @@ static inline void __raw_writeq(u64 q, const volatile void __iomem *addr)
101 * the cache by using ASI_PHYS_BYPASS_EC_E_L 101 * the cache by using ASI_PHYS_BYPASS_EC_E_L
102 */ 102 */
103#define readb readb 103#define readb readb
104#define readb_relaxed readb
104static inline u8 readb(const volatile void __iomem *addr) 105static inline u8 readb(const volatile void __iomem *addr)
105{ u8 ret; 106{ u8 ret;
106 107
@@ -112,6 +113,7 @@ static inline u8 readb(const volatile void __iomem *addr)
112} 113}
113 114
114#define readw readw 115#define readw readw
116#define readw_relaxed readw
115static inline u16 readw(const volatile void __iomem *addr) 117static inline u16 readw(const volatile void __iomem *addr)
116{ u16 ret; 118{ u16 ret;
117 119
@@ -124,6 +126,7 @@ static inline u16 readw(const volatile void __iomem *addr)
124} 126}
125 127
126#define readl readl 128#define readl readl
129#define readl_relaxed readl
127static inline u32 readl(const volatile void __iomem *addr) 130static inline u32 readl(const volatile void __iomem *addr)
128{ u32 ret; 131{ u32 ret;
129 132
@@ -136,6 +139,7 @@ static inline u32 readl(const volatile void __iomem *addr)
136} 139}
137 140
138#define readq readq 141#define readq readq
142#define readq_relaxed readq
139static inline u64 readq(const volatile void __iomem *addr) 143static inline u64 readq(const volatile void __iomem *addr)
140{ u64 ret; 144{ u64 ret;
141 145
@@ -148,6 +152,7 @@ static inline u64 readq(const volatile void __iomem *addr)
148} 152}
149 153
150#define writeb writeb 154#define writeb writeb
155#define writeb_relaxed writeb
151static inline void writeb(u8 b, volatile void __iomem *addr) 156static inline void writeb(u8 b, volatile void __iomem *addr)
152{ 157{
153 __asm__ __volatile__("stba\t%r0, [%1] %2\t/* pci_writeb */" 158 __asm__ __volatile__("stba\t%r0, [%1] %2\t/* pci_writeb */"
@@ -157,6 +162,7 @@ static inline void writeb(u8 b, volatile void __iomem *addr)
157} 162}
158 163
159#define writew writew 164#define writew writew
165#define writew_relaxed writew
160static inline void writew(u16 w, volatile void __iomem *addr) 166static inline void writew(u16 w, volatile void __iomem *addr)
161{ 167{
162 __asm__ __volatile__("stha\t%r0, [%1] %2\t/* pci_writew */" 168 __asm__ __volatile__("stha\t%r0, [%1] %2\t/* pci_writew */"
@@ -166,6 +172,7 @@ static inline void writew(u16 w, volatile void __iomem *addr)
166} 172}
167 173
168#define writel writel 174#define writel writel
175#define writel_relaxed writel
169static inline void writel(u32 l, volatile void __iomem *addr) 176static inline void writel(u32 l, volatile void __iomem *addr)
170{ 177{
171 __asm__ __volatile__("stwa\t%r0, [%1] %2\t/* pci_writel */" 178 __asm__ __volatile__("stwa\t%r0, [%1] %2\t/* pci_writel */"
@@ -175,6 +182,7 @@ static inline void writel(u32 l, volatile void __iomem *addr)
175} 182}
176 183
177#define writeq writeq 184#define writeq writeq
185#define writeq_relaxed writeq
178static inline void writeq(u64 q, volatile void __iomem *addr) 186static inline void writeq(u64 q, volatile void __iomem *addr)
179{ 187{
180 __asm__ __volatile__("stxa\t%r0, [%1] %2\t/* pci_writeq */" 188 __asm__ __volatile__("stxa\t%r0, [%1] %2\t/* pci_writeq */"
@@ -183,7 +191,6 @@ static inline void writeq(u64 q, volatile void __iomem *addr)
183 : "memory"); 191 : "memory");
184} 192}
185 193
186
187#define inb inb 194#define inb inb
188static inline u8 inb(unsigned long addr) 195static inline u8 inb(unsigned long addr)
189{ 196{
@@ -264,11 +271,6 @@ static inline void iowrite32_rep(void __iomem *port, const void *buf, unsigned l
264 outsl((unsigned long __force)port, buf, count); 271 outsl((unsigned long __force)port, buf, count);
265} 272}
266 273
267#define readb_relaxed(__addr) readb(__addr)
268#define readw_relaxed(__addr) readw(__addr)
269#define readl_relaxed(__addr) readl(__addr)
270#define readq_relaxed(__addr) readq(__addr)
271
272/* Valid I/O Space regions are anywhere, because each PCI bus supported 274/* Valid I/O Space regions are anywhere, because each PCI bus supported
273 * can live in an arbitrary area of the physical address range. 275 * can live in an arbitrary area of the physical address range.
274 */ 276 */
diff --git a/arch/tile/include/asm/io.h b/arch/tile/include/asm/io.h
index 9fe434969fab..d372641054d9 100644
--- a/arch/tile/include/asm/io.h
+++ b/arch/tile/include/asm/io.h
@@ -241,6 +241,10 @@ static inline void writeq(u64 val, unsigned long addr)
241#define readw_relaxed readw 241#define readw_relaxed readw
242#define readl_relaxed readl 242#define readl_relaxed readl
243#define readq_relaxed readq 243#define readq_relaxed readq
244#define writeb_relaxed writeb
245#define writew_relaxed writew
246#define writel_relaxed writel
247#define writeq_relaxed writeq
244 248
245#define ioread8 readb 249#define ioread8 readb
246#define ioread16 readw 250#define ioread16 readw
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
index b8237d8a1e0c..0cdbe6e81b45 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -74,6 +74,9 @@ build_mmio_write(__writel, "l", unsigned int, "r", )
74#define __raw_readw __readw 74#define __raw_readw __readw
75#define __raw_readl __readl 75#define __raw_readl __readl
76 76
77#define writeb_relaxed(v, a) __writeb(v, a)
78#define writew_relaxed(v, a) __writew(v, a)
79#define writel_relaxed(v, a) __writel(v, a)
77#define __raw_writeb __writeb 80#define __raw_writeb __writeb
78#define __raw_writew __writew 81#define __raw_writew __writew
79#define __raw_writel __writel 82#define __raw_writel __writel
@@ -86,6 +89,7 @@ build_mmio_read(readq, "q", unsigned long, "=r", :"memory")
86build_mmio_write(writeq, "q", unsigned long, "r", :"memory") 89build_mmio_write(writeq, "q", unsigned long, "r", :"memory")
87 90
88#define readq_relaxed(a) readq(a) 91#define readq_relaxed(a) readq(a)
92#define writeq_relaxed(v, a) writeq(v, a)
89 93
90#define __raw_readq(a) readq(a) 94#define __raw_readq(a) readq(a)
91#define __raw_writeq(val, addr) writeq(val, addr) 95#define __raw_writeq(val, addr) writeq(val, addr)
@@ -310,8 +314,8 @@ BUILDIO(b, b, char)
310BUILDIO(w, w, short) 314BUILDIO(w, w, short)
311BUILDIO(l, , int) 315BUILDIO(l, , int)
312 316
313extern void *xlate_dev_mem_ptr(unsigned long phys); 317extern void *xlate_dev_mem_ptr(phys_addr_t phys);
314extern void unxlate_dev_mem_ptr(unsigned long phys, void *addr); 318extern void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr);
315 319
316extern int ioremap_change_attr(unsigned long vaddr, unsigned long size, 320extern int ioremap_change_attr(unsigned long vaddr, unsigned long size,
317 unsigned long prot_val); 321 unsigned long prot_val);
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index af78e50ca6ce..b12f43c192cf 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -327,7 +327,7 @@ EXPORT_SYMBOL(iounmap);
327 * Convert a physical pointer to a virtual kernel pointer for /dev/mem 327 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
328 * access 328 * access
329 */ 329 */
330void *xlate_dev_mem_ptr(unsigned long phys) 330void *xlate_dev_mem_ptr(phys_addr_t phys)
331{ 331{
332 void *addr; 332 void *addr;
333 unsigned long start = phys & PAGE_MASK; 333 unsigned long start = phys & PAGE_MASK;
@@ -343,7 +343,7 @@ void *xlate_dev_mem_ptr(unsigned long phys)
343 return addr; 343 return addr;
344} 344}
345 345
346void unxlate_dev_mem_ptr(unsigned long phys, void *addr) 346void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr)
347{ 347{
348 if (page_is_ram(phys >> PAGE_SHIFT)) 348 if (page_is_ram(phys >> PAGE_SHIFT))
349 return; 349 return;
diff --git a/arch/xtensa/include/asm/io.h b/arch/xtensa/include/asm/io.h
index 74944207167e..fe1600a09438 100644
--- a/arch/xtensa/include/asm/io.h
+++ b/arch/xtensa/include/asm/io.h
@@ -74,13 +74,6 @@ static inline void iounmap(volatile void __iomem *addr)
74 74
75#endif /* CONFIG_MMU */ 75#endif /* CONFIG_MMU */
76 76
77/*
78 * Generic I/O
79 */
80#define readb_relaxed readb
81#define readw_relaxed readw
82#define readl_relaxed readl
83
84#endif /* __KERNEL__ */ 77#endif /* __KERNEL__ */
85 78
86#include <asm-generic/io.h> 79#include <asm-generic/io.h>