This source file includes following definitions.
- __bus_inb
- __bus_outb
- inb
- inw
- inl
- outb
- outw
- outl
- readb
- readw
- readl
- writeb
- writew
- writel
- insw
- insl
- outsw
- outsl
1
2
3
4
5 #include <linux/kernel.h>
6
7 #include <asm/io.h>
8
9
10
11
12
13 #ifdef __is_local
14 #undef __bus_inb
15 unsigned int __bus_inb(unsigned long addr)
16 {
17 return ___bus_inb(addr);
18 }
19
20 #undef __bus_outb
21 void __bus_outb(unsigned char b, unsigned long addr)
22 {
23 ___bus_outb(b, addr);
24 }
25 #endif
26
27 #undef inb
28 unsigned int inb(unsigned long addr)
29 {
30 return __inb(addr);
31 }
32
33 #undef inw
34 unsigned int inw(unsigned long addr)
35 {
36 return __inw(addr);
37 }
38
39 #undef inl
40 unsigned int inl(unsigned long addr)
41 {
42 return __inl(addr);
43 }
44
45
46 #undef outb
47 void outb(unsigned char b, unsigned long addr)
48 {
49 __outb(b, addr);
50 }
51
52 #undef outw
53 void outw(unsigned short b, unsigned long addr)
54 {
55 __outw(b, addr);
56 }
57
58 #undef outl
59 void outl(unsigned int b, unsigned long addr)
60 {
61 __outl(b, addr);
62 }
63
64
65 #undef readb
66 unsigned long readb(unsigned long addr)
67 {
68 return __readb(addr);
69 }
70
71 #undef readw
72 unsigned long readw(unsigned long addr)
73 {
74 return __readw(addr);
75 }
76
77 #undef readl
78 unsigned long readl(unsigned long addr)
79 {
80 return __readl(addr);
81 }
82
83
84 #undef writeb
85 void writeb(unsigned short b, unsigned long addr)
86 {
87 __writeb(b, addr);
88 }
89
90 #undef writew
91 void writew(unsigned short b, unsigned long addr)
92 {
93 __writew(b, addr);
94 }
95
96 #undef writel
97 void writel(unsigned int b, unsigned long addr)
98 {
99 __writel(b, addr);
100 }
101
102
103
104
105
106
107
108
109 #undef insw
110 void insw (unsigned long port, void *dst, unsigned long count)
111 {
112 unsigned int *ip, w;
113
114 if (((unsigned long)dst) & 0x3) {
115 if (((unsigned long)dst) & 0x1) {
116 panic("insw: memory not short aligned");
117 }
118 *(unsigned short*)dst = inw(port);
119 dst += 2;
120 --count;
121 }
122
123 ip = dst;
124 while (count >= 2) {
125 w = inw(port);
126 w |= inw(port) << 16;
127 count -= 2;
128 *ip++ = w;
129 }
130
131 if (count) {
132 w = inw(port);
133 *(unsigned short*)ip = w;
134 }
135 }
136
137
138
139
140
141
142
143
144
145 #undef insl
146 void insl (unsigned long port, void *dst, unsigned long count)
147 {
148 unsigned int *ip, w;
149
150 if (((unsigned long)dst) & 0x3) {
151 panic("insl: memory not aligned");
152 }
153
154 ip = dst;
155 while (count > 0) {
156 w = inw(port);
157 --count;
158 *ip++ = w;
159 }
160 }
161
162
163
164
165
166
167
168
169 #undef outsw
170 void outsw (unsigned long port, void *src, unsigned long count)
171 {
172 unsigned int *ip, w;
173
174 if (((unsigned long)src) & 0x3) {
175 if (((unsigned long)src) & 0x1) {
176 panic("outsw: memory not short aligned");
177 }
178 outw(*(unsigned short*)src, port);
179 src += 2;
180 --count;
181 }
182
183 ip = src;
184 while (count >= 2) {
185 w = *ip++;
186 count -= 2;
187 outw(w >> 0, port);
188 outw(w >> 16, port);
189 }
190
191 if (count) {
192 outw(*(unsigned short*)ip, port);
193 }
194 }
195
196
197
198
199
200
201
202
203 #undef outsw
204 void outsl (unsigned long port, void *src, unsigned long count)
205 {
206 unsigned int *ip, w;
207
208 if (((unsigned long)src) & 0x3) {
209 panic("outsw: memory not aligned");
210 }
211
212 ip = src;
213 while (count > 0) {
214 w = *ip++;
215 --count;
216 outw(w, port);
217 }
218 }