- Separate out show_stack changes into own patch.
[linux-flexiantxendom0-3.2.10.git] / arch / ia64 / lib / io.c
1 #include <linux/config.h>
2 #include <linux/types.h>
3
4 #include <asm/io.h>
5
6 /*
7  * Copy data from IO memory space to "real" memory space.
8  * This needs to be optimized.
9  */
10 void
11 __ia64_memcpy_fromio (void * to, unsigned long from, long count)
12 {
13         while (count) {
14                 count--;
15                 *(char *) to = readb(from);
16                 ((char *) to)++;
17                 from++;
18         }
19 }
20
21 /*
22  * Copy data from "real" memory space to IO memory space.
23  * This needs to be optimized.
24  */
25 void
26 __ia64_memcpy_toio (unsigned long to, void * from, long count)
27 {
28         while (count) {
29                 count--;
30                 writeb(*(char *) from, to);
31                 ((char *) from)++;
32                 to++;
33         }
34 }
35
36 /*
37  * "memset" on IO memory space.
38  * This needs to be optimized.
39  */
40 void
41 __ia64_memset_c_io (unsigned long dst, unsigned long c, long count)
42 {
43         unsigned char ch = (char)(c & 0xff);
44
45         while (count) {
46                 count--;
47                 writeb(ch, dst);
48                 dst++;
49         }
50 }
51
52 #ifdef CONFIG_IA64_GENERIC
53
54 #undef __ia64_inb
55 #undef __ia64_inw
56 #undef __ia64_inl
57 #undef __ia64_outb
58 #undef __ia64_outw
59 #undef __ia64_outl
60 #undef __ia64_readb
61 #undef __ia64_readw
62 #undef __ia64_readl
63 #undef __ia64_readq
64 #undef __ia64_writeb
65 #undef __ia64_writew
66 #undef __ia64_writel
67 #undef __ia64_writeq
68
69 unsigned int
70 __ia64_inb (unsigned long port)
71 {
72         return ___ia64_inb(port);
73 }
74
75 unsigned int
76 __ia64_inw (unsigned long port)
77 {
78         return ___ia64_inw(port);
79 }
80
81 unsigned int
82 __ia64_inl (unsigned long port)
83 {
84         return ___ia64_inl(port);
85 }
86
87 void
88 __ia64_outb (unsigned char val, unsigned long port)
89 {
90         ___ia64_outb(val, port);
91 }
92
93 void
94 __ia64_outw (unsigned short val, unsigned long port)
95 {
96         ___ia64_outw(val, port);
97 }
98
99 void
100 __ia64_outl (unsigned int val, unsigned long port)
101 {
102         ___ia64_outl(val, port);
103 }
104
105 unsigned char
106 __ia64_readb (void *addr)
107 {
108         return ___ia64_readb (addr);
109 }
110
111 unsigned short
112 __ia64_readw (void *addr)
113 {
114         return ___ia64_readw (addr);
115 }
116
117 unsigned int
118 __ia64_readl (void *addr)
119 {
120         return ___ia64_readl (addr);
121 }
122
123 unsigned long
124 __ia64_readq (void *addr)
125 {
126         return ___ia64_readq (addr);
127 }
128
129 #endif /* CONFIG_IA64_GENERIC */