Skip to content

Commit 80b9ece

Browse files
andy-shevIngo Molnar
authored andcommitted
x86/io: Define IO accessors by preprocessor
As a preparatory to use generic IO accessor helpers we need to define architecture dependent functions via preprocessor to let world know we have them. Signed-off-by: Andy Shevchenko <[email protected]> Acked-by: Wolfram Sang <[email protected]> Cc: Baolin Wang <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Mika Westerberg <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: [email protected] Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 76846bf commit 80b9ece

File tree

1 file changed

+41
-0
lines changed
  • arch/x86/include/asm

1 file changed

+41
-0
lines changed

arch/x86/include/asm/io.h

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,19 @@ build_mmio_write(__writeb, "b", unsigned char, "q", )
6969
build_mmio_write(__writew, "w", unsigned short, "r", )
7070
build_mmio_write(__writel, "l", unsigned int, "r", )
7171

72+
#define readb readb
73+
#define readw readw
74+
#define readl readl
7275
#define readb_relaxed(a) __readb(a)
7376
#define readw_relaxed(a) __readw(a)
7477
#define readl_relaxed(a) __readl(a)
7578
#define __raw_readb __readb
7679
#define __raw_readw __readw
7780
#define __raw_readl __readl
7881

82+
#define writeb writeb
83+
#define writew writew
84+
#define writel writel
7985
#define writeb_relaxed(v, a) __writeb(v, a)
8086
#define writew_relaxed(v, a) __writew(v, a)
8187
#define writel_relaxed(v, a) __writel(v, a)
@@ -119,6 +125,7 @@ static inline phys_addr_t virt_to_phys(volatile void *address)
119125
{
120126
return __pa(address);
121127
}
128+
#define virt_to_phys virt_to_phys
122129

123130
/**
124131
* phys_to_virt - map physical address to virtual
@@ -137,6 +144,7 @@ static inline void *phys_to_virt(phys_addr_t address)
137144
{
138145
return __va(address);
139146
}
147+
#define phys_to_virt phys_to_virt
140148

141149
/*
142150
* Change "struct page" to physical address.
@@ -169,11 +177,14 @@ static inline unsigned int isa_virt_to_bus(volatile void *address)
169177
* else, you probably want one of the following.
170178
*/
171179
extern void __iomem *ioremap_nocache(resource_size_t offset, unsigned long size);
180+
#define ioremap_nocache ioremap_nocache
172181
extern void __iomem *ioremap_uc(resource_size_t offset, unsigned long size);
173182
#define ioremap_uc ioremap_uc
174183

175184
extern void __iomem *ioremap_cache(resource_size_t offset, unsigned long size);
185+
#define ioremap_cache ioremap_cache
176186
extern void __iomem *ioremap_prot(resource_size_t offset, unsigned long size, unsigned long prot_val);
187+
#define ioremap_prot ioremap_prot
177188

178189
/**
179190
* ioremap - map bus memory into CPU space
@@ -193,8 +204,10 @@ static inline void __iomem *ioremap(resource_size_t offset, unsigned long size)
193204
{
194205
return ioremap_nocache(offset, size);
195206
}
207+
#define ioremap ioremap
196208

197209
extern void iounmap(volatile void __iomem *addr);
210+
#define iounmap iounmap
198211

199212
extern void set_iounmap_nonlazy(void);
200213

@@ -220,6 +233,7 @@ memset_io(volatile void __iomem *addr, unsigned char val, size_t count)
220233
{
221234
memset((void __force *)addr, val, count);
222235
}
236+
#define memset_io(dst,c,count) memset_io(dst,c,count)
223237

224238
/**
225239
* memcpy_fromio Copy a block of data from I/O memory
@@ -234,6 +248,7 @@ memcpy_fromio(void *dst, const volatile void __iomem *src, size_t count)
234248
{
235249
memcpy(dst, (const void __force *)src, count);
236250
}
251+
#define memcpy_fromio(to,from,count) memcpy_fromio(to,from,count)
237252

238253
/**
239254
* memcpy_toio Copy a block of data into I/O memory
@@ -248,6 +263,7 @@ memcpy_toio(volatile void __iomem *dst, const void *src, size_t count)
248263
{
249264
memcpy((void __force *)dst, src, count);
250265
}
266+
#define memcpy_toio(to,from,count) memcpy_toio(to,from,count)
251267

252268
/*
253269
* ISA space is 'always mapped' on a typical x86 system, no need to
@@ -341,13 +357,38 @@ BUILDIO(b, b, char)
341357
BUILDIO(w, w, short)
342358
BUILDIO(l, , int)
343359

360+
#define inb inb
361+
#define inw inw
362+
#define inl inl
363+
#define inb_p inb_p
364+
#define inw_p inw_p
365+
#define inl_p inl_p
366+
#define insb insb
367+
#define insw insw
368+
#define insl insl
369+
370+
#define outb outb
371+
#define outw outw
372+
#define outl outl
373+
#define outb_p outb_p
374+
#define outw_p outw_p
375+
#define outl_p outl_p
376+
#define outsb outsb
377+
#define outsw outsw
378+
#define outsl outsl
379+
344380
extern void *xlate_dev_mem_ptr(phys_addr_t phys);
345381
extern void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr);
346382

383+
#define xlate_dev_mem_ptr xlate_dev_mem_ptr
384+
#define unxlate_dev_mem_ptr unxlate_dev_mem_ptr
385+
347386
extern int ioremap_change_attr(unsigned long vaddr, unsigned long size,
348387
enum page_cache_mode pcm);
349388
extern void __iomem *ioremap_wc(resource_size_t offset, unsigned long size);
389+
#define ioremap_wc ioremap_wc
350390
extern void __iomem *ioremap_wt(resource_size_t offset, unsigned long size);
391+
#define ioremap_wt ioremap_wt
351392

352393
extern bool is_early_ioremap_ptep(pte_t *ptep);
353394

0 commit comments

Comments
 (0)