ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / arch / ia64 / lib / io.c
1 #include <linux/config.h>
2 #include <linux/module.h>
3 #include <linux/types.h>
4
5 #include <asm/io.h>
6
7 /*
8  * Copy data from IO memory space to "real" memory space.
9  * This needs to be optimized.
10  */
11 void
12 __ia64_memcpy_fromio (void *to, unsigned long from, long count)
13 {
14         char *dst = to;
15
16         while (count) {
17                 count--;
18                 *dst++ = readb(from++);
19         }
20 }
21 EXPORT_SYMBOL(__ia64_memcpy_fromio);
22
23 /*
24  * Copy data from "real" memory space to IO memory space.
25  * This needs to be optimized.
26  */
27 void
28 __ia64_memcpy_toio (unsigned long to, void *from, long count)
29 {
30         char *src = from;
31
32         while (count) {
33                 count--;
34                 writeb(*src++, to++);
35         }
36 }
37 EXPORT_SYMBOL(__ia64_memcpy_toio);
38
39 /*
40  * "memset" on IO memory space.
41  * This needs to be optimized.
42  */
43 void
44 __ia64_memset_c_io (unsigned long dst, unsigned long c, long count)
45 {
46         unsigned char ch = (char)(c & 0xff);
47
48         while (count) {
49                 count--;
50                 writeb(ch, dst);
51                 dst++;
52         }
53 }
54 EXPORT_SYMBOL(__ia64_memset_c_io);
55
56 #ifdef CONFIG_IA64_GENERIC
57
58 #undef __ia64_inb
59 #undef __ia64_inw
60 #undef __ia64_inl
61 #undef __ia64_outb
62 #undef __ia64_outw
63 #undef __ia64_outl
64 #undef __ia64_readb
65 #undef __ia64_readw
66 #undef __ia64_readl
67 #undef __ia64_readq
68 #undef __ia64_readb_relaxed
69 #undef __ia64_readw_relaxed
70 #undef __ia64_readl_relaxed
71 #undef __ia64_readq_relaxed
72 #undef __ia64_writeb
73 #undef __ia64_writew
74 #undef __ia64_writel
75 #undef __ia64_writeq
76
77 unsigned int
78 __ia64_inb (unsigned long port)
79 {
80         return ___ia64_inb(port);
81 }
82
83 unsigned int
84 __ia64_inw (unsigned long port)
85 {
86         return ___ia64_inw(port);
87 }
88
89 unsigned int
90 __ia64_inl (unsigned long port)
91 {
92         return ___ia64_inl(port);
93 }
94
95 void
96 __ia64_outb (unsigned char val, unsigned long port)
97 {
98         ___ia64_outb(val, port);
99 }
100
101 void
102 __ia64_outw (unsigned short val, unsigned long port)
103 {
104         ___ia64_outw(val, port);
105 }
106
107 void
108 __ia64_outl (unsigned int val, unsigned long port)
109 {
110         ___ia64_outl(val, port);
111 }
112
113 unsigned char
114 __ia64_readb (void *addr)
115 {
116         return ___ia64_readb (addr);
117 }
118
119 unsigned short
120 __ia64_readw (void *addr)
121 {
122         return ___ia64_readw (addr);
123 }
124
125 unsigned int
126 __ia64_readl (void *addr)
127 {
128         return ___ia64_readl (addr);
129 }
130
131 unsigned long
132 __ia64_readq (void *addr)
133 {
134         return ___ia64_readq (addr);
135 }
136
137 unsigned char
138 __ia64_readb_relaxed (void *addr)
139 {
140         return ___ia64_readb (addr);
141 }
142
143 unsigned short
144 __ia64_readw_relaxed (void *addr)
145 {
146         return ___ia64_readw (addr);
147 }
148
149 unsigned int
150 __ia64_readl_relaxed (void *addr)
151 {
152         return ___ia64_readl (addr);
153 }
154
155 unsigned long
156 __ia64_readq_relaxed (void *addr)
157 {
158         return ___ia64_readq (addr);
159 }
160
161 #endif /* CONFIG_IA64_GENERIC */