This source file includes following definitions.
- virt_to_bus
- bus_to_virt
- __inb
- __outb
- __inw
- __outw
- __inl
- __outl
- __readb
- __readw
- __readl
- __writeb
- __writew
- __writel
1 #ifndef __ALPHA_LCA__H__
2 #define __ALPHA_LCA__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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55 #include <asm/system.h>
56
57 #define LCA_DMA_WIN_BASE (1024*1024*1024)
58 #define LCA_DMA_WIN_SIZE (1024*1024*1024)
59
60
61
62
63 #define LCA_MEM_BCR0 (IDENT_ADDR + 0x120000000UL)
64 #define LCA_MEM_BCR1 (IDENT_ADDR + 0x120000008UL)
65 #define LCA_MEM_BCR2 (IDENT_ADDR + 0x120000010UL)
66 #define LCA_MEM_BCR3 (IDENT_ADDR + 0x120000018UL)
67 #define LCA_MEM_BMR0 (IDENT_ADDR + 0x120000020UL)
68 #define LCA_MEM_BMR1 (IDENT_ADDR + 0x120000028UL)
69 #define LCA_MEM_BMR2 (IDENT_ADDR + 0x120000030UL)
70 #define LCA_MEM_BMR3 (IDENT_ADDR + 0x120000038UL)
71 #define LCA_MEM_BTR0 (IDENT_ADDR + 0x120000040UL)
72 #define LCA_MEM_BTR1 (IDENT_ADDR + 0x120000048UL)
73 #define LCA_MEM_BTR2 (IDENT_ADDR + 0x120000050UL)
74 #define LCA_MEM_BTR3 (IDENT_ADDR + 0x120000058UL)
75 #define LCA_MEM_GTR (IDENT_ADDR + 0x120000060UL)
76 #define LCA_MEM_ESR (IDENT_ADDR + 0x120000068UL)
77 #define LCA_MEM_EAR (IDENT_ADDR + 0x120000070UL)
78 #define LCA_MEM_CAR (IDENT_ADDR + 0x120000078UL)
79 #define LCA_MEM_VGR (IDENT_ADDR + 0x120000080UL)
80 #define LCA_MEM_PLM (IDENT_ADDR + 0x120000088UL)
81 #define LCA_MEM_FOR (IDENT_ADDR + 0x120000090UL)
82
83
84
85
86 #define LCA_IOC_HAE (IDENT_ADDR + 0x180000000UL)
87 #define LCA_IOC_CONF (IDENT_ADDR + 0x180000020UL)
88 #define LCA_IOC_STAT0 (IDENT_ADDR + 0x180000040UL)
89 #define LCA_IOC_STAT1 (IDENT_ADDR + 0x180000060UL)
90 #define LCA_IOC_TBIA (IDENT_ADDR + 0x180000080UL)
91 #define LCA_IOC_TB_ENA (IDENT_ADDR + 0x1800000a0UL)
92 #define LCA_IOC_SFT_RST (IDENT_ADDR + 0x1800000c0UL)
93 #define LCA_IOC_PAR_DIS (IDENT_ADDR + 0x1800000e0UL)
94 #define LCA_IOC_W_BASE0 (IDENT_ADDR + 0x180000100UL)
95 #define LCA_IOC_W_BASE1 (IDENT_ADDR + 0x180000120UL)
96 #define LCA_IOC_W_MASK0 (IDENT_ADDR + 0x180000140UL)
97 #define LCA_IOC_W_MASK1 (IDENT_ADDR + 0x180000160UL)
98 #define LCA_IOC_T_BASE0 (IDENT_ADDR + 0x180000180UL)
99 #define LCA_IOC_T_BASE1 (IDENT_ADDR + 0x1800001a0UL)
100 #define LCA_IOC_TB_TAG0 (IDENT_ADDR + 0x188000000UL)
101 #define LCA_IOC_TB_TAG1 (IDENT_ADDR + 0x188000020UL)
102 #define LCA_IOC_TB_TAG2 (IDENT_ADDR + 0x188000040UL)
103 #define LCA_IOC_TB_TAG3 (IDENT_ADDR + 0x188000060UL)
104 #define LCA_IOC_TB_TAG4 (IDENT_ADDR + 0x188000070UL)
105 #define LCA_IOC_TB_TAG5 (IDENT_ADDR + 0x1880000a0UL)
106 #define LCA_IOC_TB_TAG6 (IDENT_ADDR + 0x1880000c0UL)
107 #define LCA_IOC_TB_TAG7 (IDENT_ADDR + 0x1880000e0UL)
108
109
110
111
112 #define LCA_IACK_SC (IDENT_ADDR + 0x1a0000000UL)
113 #define LCA_CONF (IDENT_ADDR + 0x1e0000000UL)
114 #define LCA_IO (IDENT_ADDR + 0x1c0000000UL)
115 #define LCA_SPARSE_MEM (IDENT_ADDR + 0x200000000UL)
116 #define LCA_DENSE_MEM (IDENT_ADDR + 0x300000000UL)
117
118
119
120
121 #define LCA_IOC_STAT0_CMD 0xf
122 #define LCA_IOC_STAT0_ERR (1<<4)
123 #define LCA_IOC_STAT0_LOST (1<<5)
124 #define LCA_IOC_STAT0_THIT (1<<6)
125 #define LCA_IOC_STAT0_TREF (1<<7)
126 #define LCA_IOC_STAT0_CODE_SHIFT 8
127 #define LCA_IOC_STAT0_CODE_MASK 0x7
128 #define LCA_IOC_STAT0_P_NBR_SHIFT 13
129 #define LCA_IOC_STAT0_P_NBR_MASK 0x7ffff
130
131 #define HAE_ADDRESS LCA_IOC_HAE
132
133 #ifdef __KERNEL__
134
135
136
137
138
139 extern inline unsigned long virt_to_bus(void * address)
140 {
141 return virt_to_phys(address) + LCA_DMA_WIN_BASE;
142 }
143
144 extern inline void * bus_to_virt(unsigned long address)
145 {
146
147
148
149
150
151
152 if (address < LCA_DMA_WIN_BASE)
153 return 0;
154 return phys_to_virt(address - LCA_DMA_WIN_BASE);
155 }
156
157
158
159
160
161
162
163
164
165
166
167
168 #define vuip volatile unsigned int *
169
170 extern inline unsigned int __inb(unsigned long addr)
171 {
172 long result = *(vuip) ((addr << 5) + LCA_IO + 0x00);
173 result >>= (addr & 3) * 8;
174 return 0xffUL & result;
175 }
176
177 extern inline void __outb(unsigned char b, unsigned long addr)
178 {
179 unsigned int w;
180
181 asm ("insbl %2,%1,%0" : "r="(w) : "ri"(addr & 0x3), "r"(b));
182 *(vuip) ((addr << 5) + LCA_IO + 0x00) = w;
183 mb();
184 }
185
186 extern inline unsigned int __inw(unsigned long addr)
187 {
188 long result = *(vuip) ((addr << 5) + LCA_IO + 0x08);
189 result >>= (addr & 3) * 8;
190 return 0xffffUL & result;
191 }
192
193 extern inline void __outw(unsigned short b, unsigned long addr)
194 {
195 unsigned int w;
196
197 asm ("inswl %2,%1,%0" : "r="(w) : "ri"(addr & 0x3), "r"(b));
198 *(vuip) ((addr << 5) + LCA_IO + 0x08) = w;
199 mb();
200 }
201
202 extern inline unsigned int __inl(unsigned long addr)
203 {
204 return *(vuip) ((addr << 5) + LCA_IO + 0x18);
205 }
206
207 extern inline void __outl(unsigned int b, unsigned long addr)
208 {
209 *(vuip) ((addr << 5) + LCA_IO + 0x18) = b;
210 mb();
211 }
212
213
214
215
216
217
218 extern inline unsigned long __readb(unsigned long addr)
219 {
220 unsigned long result, shift, msb;
221
222 shift = (addr & 0x3) * 8;
223 if (addr >= (1UL << 24)) {
224 msb = addr & 0xf8000000;
225 addr -= msb;
226 if (msb != hae.cache) {
227 set_hae(msb);
228 }
229 }
230 result = *(vuip) ((addr << 5) + LCA_SPARSE_MEM + 0x00);
231 result >>= shift;
232 return 0xffUL & result;
233 }
234
235 extern inline unsigned long __readw(unsigned long addr)
236 {
237 unsigned long result, shift, msb;
238
239 shift = (addr & 0x3) * 8;
240 if (addr >= (1UL << 24)) {
241 msb = addr & 0xf8000000;
242 addr -= msb;
243 if (msb != hae.cache) {
244 set_hae(msb);
245 }
246 }
247 result = *(vuip) ((addr << 5) + LCA_SPARSE_MEM + 0x08);
248 result >>= shift;
249 return 0xffffUL & result;
250 }
251
252 extern inline unsigned long __readl(unsigned long addr)
253 {
254 return *(vuip) (addr + LCA_DENSE_MEM);
255 }
256
257 extern inline void __writeb(unsigned char b, unsigned long addr)
258 {
259 unsigned long msb;
260 unsigned int w;
261
262 if (addr >= (1UL << 24)) {
263 msb = addr & 0xf8000000;
264 addr -= msb;
265 if (msb != hae.cache) {
266 set_hae(msb);
267 }
268 }
269 asm ("insbl %2,%1,%0" : "r="(w) : "ri"(addr & 0x3), "r"(b));
270 *(vuip) ((addr << 5) + LCA_SPARSE_MEM + 0x00) = w;
271 }
272
273 extern inline void __writew(unsigned short b, unsigned long addr)
274 {
275 unsigned long msb;
276 unsigned int w;
277
278 if (addr >= (1UL << 24)) {
279 msb = addr & 0xf8000000;
280 addr -= msb;
281 if (msb != hae.cache) {
282 set_hae(msb);
283 }
284 }
285 asm ("inswl %2,%1,%0" : "r="(w) : "ri"(addr & 0x3), "r"(b));
286 *(vuip) ((addr << 5) + LCA_SPARSE_MEM + 0x08) = w;
287 }
288
289 extern inline void __writel(unsigned int b, unsigned long addr)
290 {
291 *(vuip) (addr + LCA_DENSE_MEM) = b;
292 }
293
294
295
296
297
298
299 #define inb(port) \
300 (__builtin_constant_p((port))?__inb(port):_inb(port))
301
302 #define outb(x, port) \
303 (__builtin_constant_p((port))?__outb((x),(port)):_outb((x),(port)))
304
305 #define readl(a) __readl((unsigned long)(a))
306 #define writel(v,a) __writel((v),(unsigned long)(a))
307
308 #undef vuip
309
310 extern unsigned long lca_init (unsigned long mem_start, unsigned long mem_end);
311
312 #endif
313
314
315
316
317
318 struct el_lca_mcheck_short {
319 struct el_common h;
320 unsigned long reason;
321 unsigned long esr;
322 unsigned long ear;
323 unsigned long dc_stat;
324 unsigned long ioc_stat0;
325 unsigned long ioc_stat1;
326 };
327
328 struct el_lca_mcheck_long {
329 struct el_common h;
330 unsigned long pt[32];
331 unsigned long exc_addr;
332 unsigned long pad1[3];
333 unsigned long pal_base;
334 unsigned long hier;
335 unsigned long hirr;
336 unsigned long mm_csr;
337 unsigned long dc_stat;
338 unsigned long dc_addr;
339 unsigned long abox_ctl;
340 unsigned long esr;
341 unsigned long ear;
342 unsigned long car;
343 unsigned long ioc_stat0;
344 unsigned long ioc_stat1;
345 unsigned long va;
346 };
347
348 union el_lca {
349 struct el_common * c;
350 struct el_lca_mcheck_long * l;
351 struct el_lca_mcheck_short * s;
352 };
353
354 #define RTC_PORT(x) (0x70 + (x))
355 #define RTC_ADDR(x) (0x80 | (x))
356 #define RTC_ALWAYS_BCD 0
357
358 #endif