aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-s390/io.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-s390/io.h')
-rw-r--r--include/asm-s390/io.h75
1 files changed, 1 insertions, 74 deletions
diff --git a/include/asm-s390/io.h b/include/asm-s390/io.h
index efb7de9c1c6b..b7ff6afc3caa 100644
--- a/include/asm-s390/io.h
+++ b/include/asm-s390/io.h
@@ -13,13 +13,10 @@
13 13
14#ifdef __KERNEL__ 14#ifdef __KERNEL__
15 15
16#include <linux/vmalloc.h>
17#include <asm/page.h> 16#include <asm/page.h>
18 17
19#define IO_SPACE_LIMIT 0xffffffff 18#define IO_SPACE_LIMIT 0xffffffff
20 19
21#define __io_virt(x) ((void *)(PAGE_OFFSET | (unsigned long)(x)))
22
23/* 20/*
24 * Change virtual addresses to physical addresses and vv. 21 * Change virtual addresses to physical addresses and vv.
25 * These are pretty trivial 22 * These are pretty trivial
@@ -28,11 +25,7 @@ static inline unsigned long virt_to_phys(volatile void * address)
28{ 25{
29 unsigned long real_address; 26 unsigned long real_address;
30 asm volatile( 27 asm volatile(
31#ifndef __s390x__
32 " lra %0,0(%1)\n" 28 " lra %0,0(%1)\n"
33#else /* __s390x__ */
34 " lrag %0,0(%1)\n"
35#endif /* __s390x__ */
36 " jz 0f\n" 29 " jz 0f\n"
37 " la %0,0\n" 30 " la %0,0\n"
38 "0:" 31 "0:"
@@ -42,75 +35,9 @@ static inline unsigned long virt_to_phys(volatile void * address)
42 35
43static inline void * phys_to_virt(unsigned long address) 36static inline void * phys_to_virt(unsigned long address)
44{ 37{
45 return __io_virt(address); 38 return (void *) address;
46}
47
48extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags);
49
50static inline void * ioremap (unsigned long offset, unsigned long size)
51{
52 return __ioremap(offset, size, 0);
53}
54
55/*
56 * This one maps high address device memory and turns off caching for that area.
57 * it's useful if some control registers are in such an area and write combining
58 * or read caching is not desirable:
59 */
60static inline void * ioremap_nocache (unsigned long offset, unsigned long size)
61{
62 return __ioremap(offset, size, 0);
63} 39}
64 40
65extern void iounmap(void *addr);
66
67/*
68 * IO bus memory addresses are also 1:1 with the physical address
69 */
70#define virt_to_bus virt_to_phys
71#define bus_to_virt phys_to_virt
72
73/*
74 * readX/writeX() are used to access memory mapped devices. On some
75 * architectures the memory mapped IO stuff needs to be accessed
76 * differently.
77 */
78
79#define readb(addr) (*(volatile unsigned char *) __io_virt(addr))
80#define readw(addr) (*(volatile unsigned short *) __io_virt(addr))
81#define readl(addr) (*(volatile unsigned int *) __io_virt(addr))
82#define readq(addr) (*(volatile unsigned long long *) __io_virt(addr))
83
84#define readb_relaxed(addr) readb(addr)
85#define readw_relaxed(addr) readw(addr)
86#define readl_relaxed(addr) readl(addr)
87#define readq_relaxed(addr) readq(addr)
88#define __raw_readb readb
89#define __raw_readw readw
90#define __raw_readl readl
91#define __raw_readq readq
92
93#define writeb(b,addr) (*(volatile unsigned char *) __io_virt(addr) = (b))
94#define writew(b,addr) (*(volatile unsigned short *) __io_virt(addr) = (b))
95#define writel(b,addr) (*(volatile unsigned int *) __io_virt(addr) = (b))
96#define writeq(b,addr) (*(volatile unsigned long long *) __io_virt(addr) = (b))
97#define __raw_writeb writeb
98#define __raw_writew writew
99#define __raw_writel writel
100#define __raw_writeq writeq
101
102#define memset_io(a,b,c) memset(__io_virt(a),(b),(c))
103#define memcpy_fromio(a,b,c) memcpy((a),__io_virt(b),(c))
104#define memcpy_toio(a,b,c) memcpy(__io_virt(a),(b),(c))
105
106#define inb_p(addr) readb(addr)
107#define inb(addr) readb(addr)
108
109#define outb(x,addr) ((void) writeb(x,addr))
110#define outb_p(x,addr) outb(x,addr)
111
112#define mmiowb() do { } while (0)
113
114/* 41/*
115 * Convert a physical pointer to a virtual kernel pointer for /dev/mem 42 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
116 * access 43 * access