import of upstream 2.4.34.4 from kernel.org
[linux-2.4.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 unsigned int
55 ia64_inb (unsigned long port)
56 {
57         return __ia64_inb(port);
58 }
59
60 unsigned int
61 ia64_inw (unsigned long port)
62 {
63         return __ia64_inw(port);
64 }
65
66 unsigned int
67 ia64_inl (unsigned long port)
68 {
69         return __ia64_inl(port);
70 }
71
72 void
73 ia64_outb (unsigned char val, unsigned long port)
74 {
75         __ia64_outb(val, port);
76 }
77
78 void
79 ia64_outw (unsigned short val, unsigned long port)
80 {
81         __ia64_outw(val, port);
82 }
83
84 void
85 ia64_outl (unsigned int val, unsigned long port)
86 {
87         __ia64_outl(val, port);
88 }
89
90 /* define aliases: */
91
92 asm (".global __ia64_inb, __ia64_inw, __ia64_inl");
93 asm ("__ia64_inb = ia64_inb");
94 asm ("__ia64_inw = ia64_inw");
95 asm ("__ia64_inl = ia64_inl");
96
97 asm (".global __ia64_outb, __ia64_outw, __ia64_outl");
98 asm ("__ia64_outb = ia64_outb");
99 asm ("__ia64_outw = ia64_outw");
100 asm ("__ia64_outl = ia64_outl");
101
102 #endif /* CONFIG_IA64_GENERIC */