This source file includes following definitions.
- __set_hae
- __local_inb
- __local_outb
- ___bus_inb
- ___bus_outb
- __inb
- __outb
- __inw
- __inl
- __outw
- __outl
- __readb
- __readw
- __readl
- __writeb
- __writew
- __writel
1 #ifndef __ALPHA_JENSEN_H
2 #define __ALPHA_JENSEN_H
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 #define EISA_INTA (IDENT_ADDR + 0x100000000UL)
32
33
34
35
36 #define EISA_FEPROM0 (IDENT_ADDR + 0x180000000UL)
37 #define EISA_FEPROM1 (IDENT_ADDR + 0x1A0000000UL)
38
39
40
41
42 #define EISA_VL82C106 (IDENT_ADDR + 0x1C0000000UL)
43
44
45
46
47 #define EISA_HAE (IDENT_ADDR + 0x1D0000000UL)
48
49
50
51
52 #define EISA_SYSCTL (IDENT_ADDR + 0x1E0000000UL)
53
54
55
56
57 #define EISA_SPARE (IDENT_ADDR + 0x1F0000000UL)
58
59
60
61
62 #define EISA_MEM (IDENT_ADDR + 0x200000000UL)
63
64
65
66
67 #define EISA_IO (IDENT_ADDR + 0x300000000UL)
68
69
70
71
72
73
74
75
76 #define virt_to_bus virt_to_phys
77 #define bus_to_virt phys_to_virt
78
79 #define HAE_ADDRESS EISA_HAE
80
81
82
83
84
85
86
87
88
89 #define __HAE_MASK 0x1ffffff
90 extern inline void __set_hae(unsigned long addr)
91 {
92
93 addr >>= 25;
94 if (addr != hae.cache)
95 set_hae(addr);
96 }
97
98
99
100
101
102
103
104
105
106
107
108
109 extern inline unsigned int __local_inb(unsigned long addr)
110 {
111 long result = *(volatile int *) ((addr << 9) + EISA_VL82C106);
112 return 0xffUL & result;
113 }
114
115 extern inline void __local_outb(unsigned char b, unsigned long addr)
116 {
117 *(volatile unsigned int *) ((addr << 9) + EISA_VL82C106) = b;
118 mb();
119 }
120
121 extern unsigned int __bus_inb(unsigned long addr);
122 extern inline unsigned int ___bus_inb(unsigned long addr)
123 {
124 long result;
125
126 __set_hae(0);
127 result = *(volatile int *) ((addr << 7) + EISA_IO + 0x00);
128 result >>= (addr & 3) * 8;
129 return 0xffUL & result;
130 }
131
132 extern void __bus_outb(unsigned char b, unsigned long addr);
133 extern inline void ___bus_outb(unsigned char b, unsigned long addr)
134 {
135 __set_hae(0);
136 *(volatile unsigned int *) ((addr << 7) + EISA_IO + 0x00) = b * 0x01010101;
137 mb();
138 }
139
140
141
142
143
144
145 #define __is_local(addr) ( \
146 (addr == 0x60 || addr == 0x64) || \
147 (addr == 0x170 || addr == 0x171) || \
148 (addr >= 0x2f8 && addr <= 0x2ff) || \
149 (addr >= 0x3bc && addr <= 0x3be) || \
150 (addr >= 0x3f8 && addr <= 0x3ff))
151
152 extern inline unsigned int __inb(unsigned long addr)
153 {
154 if (__is_local(addr))
155 return __local_inb(addr);
156 return __bus_inb(addr);
157 }
158
159 extern inline void __outb(unsigned char b, unsigned long addr)
160 {
161 if (__is_local(addr))
162 __local_outb(b, addr);
163 else
164 __bus_outb(b, addr);
165 }
166
167 extern inline unsigned int __inw(unsigned long addr)
168 {
169 long result;
170
171 __set_hae(0);
172 result = *(volatile int *) ((addr << 7) + EISA_IO + 0x20);
173 result >>= (addr & 3) * 8;
174 return 0xffffUL & result;
175 }
176
177 extern inline unsigned int __inl(unsigned long addr)
178 {
179 __set_hae(0);
180 return *(volatile unsigned int *) ((addr << 7) + EISA_IO + 0x60);
181 }
182
183 extern inline void __outw(unsigned short b, unsigned long addr)
184 {
185 __set_hae(0);
186 *(volatile unsigned int *) ((addr << 7) + EISA_IO + 0x20) = b * 0x00010001;
187 mb();
188 }
189
190 extern inline void __outl(unsigned int b, unsigned long addr)
191 {
192 __set_hae(0);
193 *(volatile unsigned int *) ((addr << 7) + EISA_IO + 0x60) = b;
194 mb();
195 }
196
197
198
199
200 extern inline unsigned long __readb(unsigned long addr)
201 {
202 long result;
203
204 __set_hae(addr);
205 addr &= __HAE_MASK;
206 result = *(volatile int *) ((addr << 7) + EISA_MEM + 0x00);
207 result >>= (addr & 3) * 8;
208 return 0xffUL & result;
209 }
210
211 extern inline unsigned long __readw(unsigned long addr)
212 {
213 long result;
214
215 __set_hae(addr);
216 addr &= __HAE_MASK;
217 result = *(volatile int *) ((addr << 7) + EISA_MEM + 0x20);
218 result >>= (addr & 3) * 8;
219 return 0xffffUL & result;
220 }
221
222 extern inline unsigned long __readl(unsigned long addr)
223 {
224 __set_hae(addr);
225 addr &= __HAE_MASK;
226 return *(volatile unsigned int *) ((addr << 7) + EISA_MEM + 0x60);
227 }
228
229 extern inline void __writeb(unsigned short b, unsigned long addr)
230 {
231 __set_hae(addr);
232 addr &= __HAE_MASK;
233 *(volatile unsigned int *) ((addr << 7) + EISA_MEM + 0x00) = b * 0x01010101;
234 }
235
236 extern inline void __writew(unsigned short b, unsigned long addr)
237 {
238 __set_hae(addr);
239 addr &= __HAE_MASK;
240 *(volatile unsigned int *) ((addr << 7) + EISA_MEM + 0x20) = b * 0x00010001;
241 }
242
243 extern inline void __writel(unsigned int b, unsigned long addr)
244 {
245 __set_hae(addr);
246 addr &= __HAE_MASK;
247 *(volatile unsigned int *) ((addr << 7) + EISA_MEM + 0x60) = b;
248 }
249
250
251
252
253
254 extern unsigned int inb(unsigned long addr);
255 extern unsigned int inw(unsigned long addr);
256 extern unsigned int inl(unsigned long addr);
257
258 extern void outb(unsigned char b, unsigned long addr);
259 extern void outw(unsigned short b, unsigned long addr);
260 extern void outl(unsigned int b, unsigned long addr);
261
262 extern unsigned long readb(unsigned long addr);
263 extern unsigned long readw(unsigned long addr);
264 extern unsigned long readl(unsigned long addr);
265
266 extern void writeb(unsigned char b, unsigned long addr);
267 extern void writew(unsigned short b, unsigned long addr);
268 extern void writel(unsigned int b, unsigned long addr);
269
270 #define inb(port) \
271 (__builtin_constant_p((port))?__inb(port):(inb)(port))
272
273 #define outb(x, port) \
274 (__builtin_constant_p((port))?__outb((x),(port)):(outb)((x),(port)))
275
276 #define inb_p inb
277 #define outb_p outb
278
279
280
281
282
283
284
285
286 #define RTC_PORT(x) (0x170+(x))
287 #define RTC_ADDR(x) (x)
288 #define RTC_ALWAYS_BCD 0
289
290 #endif