This source file includes following definitions.
- t2_inb
- t2_outb
- t2_inw
- t2_outw
- t2_inl
- t2_outl
- t2_readb
- t2_readw
- t2_readl
- t2_readq
- t2_writeb
- t2_writew
- t2_writel
- t2_writeq
- t2_ioportmap
- t2_ioremap
- t2_is_ioaddr
- t2_is_mmio
1
2 #ifndef __ALPHA_T2__H__
3 #define __ALPHA_T2__H__
4
5
6 #define T2_ONE_HAE_WINDOW 1
7
8 #include <linux/types.h>
9 #include <linux/spinlock.h>
10 #include <asm/compiler.h>
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 #define T2_MEM_R1_MASK 0x07ffffff
26
27
28
29 #define _GAMMA_BIAS 0x8000000000UL
30
31 #if defined(CONFIG_ALPHA_GENERIC)
32 #define GAMMA_BIAS alpha_mv.sys.t2.gamma_bias
33 #elif defined(CONFIG_ALPHA_GAMMA)
34 #define GAMMA_BIAS _GAMMA_BIAS
35 #else
36 #define GAMMA_BIAS 0
37 #endif
38
39
40
41
42 #define T2_CONF (IDENT_ADDR + GAMMA_BIAS + 0x390000000UL)
43 #define T2_IO (IDENT_ADDR + GAMMA_BIAS + 0x3a0000000UL)
44 #define T2_SPARSE_MEM (IDENT_ADDR + GAMMA_BIAS + 0x200000000UL)
45 #define T2_DENSE_MEM (IDENT_ADDR + GAMMA_BIAS + 0x3c0000000UL)
46
47 #define T2_IOCSR (IDENT_ADDR + GAMMA_BIAS + 0x38e000000UL)
48 #define T2_CERR1 (IDENT_ADDR + GAMMA_BIAS + 0x38e000020UL)
49 #define T2_CERR2 (IDENT_ADDR + GAMMA_BIAS + 0x38e000040UL)
50 #define T2_CERR3 (IDENT_ADDR + GAMMA_BIAS + 0x38e000060UL)
51 #define T2_PERR1 (IDENT_ADDR + GAMMA_BIAS + 0x38e000080UL)
52 #define T2_PERR2 (IDENT_ADDR + GAMMA_BIAS + 0x38e0000a0UL)
53 #define T2_PSCR (IDENT_ADDR + GAMMA_BIAS + 0x38e0000c0UL)
54 #define T2_HAE_1 (IDENT_ADDR + GAMMA_BIAS + 0x38e0000e0UL)
55 #define T2_HAE_2 (IDENT_ADDR + GAMMA_BIAS + 0x38e000100UL)
56 #define T2_HBASE (IDENT_ADDR + GAMMA_BIAS + 0x38e000120UL)
57 #define T2_WBASE1 (IDENT_ADDR + GAMMA_BIAS + 0x38e000140UL)
58 #define T2_WMASK1 (IDENT_ADDR + GAMMA_BIAS + 0x38e000160UL)
59 #define T2_TBASE1 (IDENT_ADDR + GAMMA_BIAS + 0x38e000180UL)
60 #define T2_WBASE2 (IDENT_ADDR + GAMMA_BIAS + 0x38e0001a0UL)
61 #define T2_WMASK2 (IDENT_ADDR + GAMMA_BIAS + 0x38e0001c0UL)
62 #define T2_TBASE2 (IDENT_ADDR + GAMMA_BIAS + 0x38e0001e0UL)
63 #define T2_TLBBR (IDENT_ADDR + GAMMA_BIAS + 0x38e000200UL)
64 #define T2_IVR (IDENT_ADDR + GAMMA_BIAS + 0x38e000220UL)
65 #define T2_HAE_3 (IDENT_ADDR + GAMMA_BIAS + 0x38e000240UL)
66 #define T2_HAE_4 (IDENT_ADDR + GAMMA_BIAS + 0x38e000260UL)
67
68
69 #define T2_WBASE3 (IDENT_ADDR + GAMMA_BIAS + 0x38e000280UL)
70 #define T2_WMASK3 (IDENT_ADDR + GAMMA_BIAS + 0x38e0002a0UL)
71 #define T2_TBASE3 (IDENT_ADDR + GAMMA_BIAS + 0x38e0002c0UL)
72
73 #define T2_TDR0 (IDENT_ADDR + GAMMA_BIAS + 0x38e000300UL)
74 #define T2_TDR1 (IDENT_ADDR + GAMMA_BIAS + 0x38e000320UL)
75 #define T2_TDR2 (IDENT_ADDR + GAMMA_BIAS + 0x38e000340UL)
76 #define T2_TDR3 (IDENT_ADDR + GAMMA_BIAS + 0x38e000360UL)
77 #define T2_TDR4 (IDENT_ADDR + GAMMA_BIAS + 0x38e000380UL)
78 #define T2_TDR5 (IDENT_ADDR + GAMMA_BIAS + 0x38e0003a0UL)
79 #define T2_TDR6 (IDENT_ADDR + GAMMA_BIAS + 0x38e0003c0UL)
80 #define T2_TDR7 (IDENT_ADDR + GAMMA_BIAS + 0x38e0003e0UL)
81
82 #define T2_WBASE4 (IDENT_ADDR + GAMMA_BIAS + 0x38e000400UL)
83 #define T2_WMASK4 (IDENT_ADDR + GAMMA_BIAS + 0x38e000420UL)
84 #define T2_TBASE4 (IDENT_ADDR + GAMMA_BIAS + 0x38e000440UL)
85
86 #define T2_AIR (IDENT_ADDR + GAMMA_BIAS + 0x38e000460UL)
87 #define T2_VAR (IDENT_ADDR + GAMMA_BIAS + 0x38e000480UL)
88 #define T2_DIR (IDENT_ADDR + GAMMA_BIAS + 0x38e0004a0UL)
89 #define T2_ICE (IDENT_ADDR + GAMMA_BIAS + 0x38e0004c0UL)
90
91 #ifndef T2_ONE_HAE_WINDOW
92 #define T2_HAE_ADDRESS T2_HAE_1
93 #endif
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128 #define T2_CPU0_BASE (IDENT_ADDR + GAMMA_BIAS + 0x380000000L)
129 #define T2_CPU1_BASE (IDENT_ADDR + GAMMA_BIAS + 0x381000000L)
130 #define T2_CPU2_BASE (IDENT_ADDR + GAMMA_BIAS + 0x382000000L)
131 #define T2_CPU3_BASE (IDENT_ADDR + GAMMA_BIAS + 0x383000000L)
132
133 #define T2_CPUn_BASE(n) (T2_CPU0_BASE + (((n)&3) * 0x001000000L))
134
135 #define T2_MEM0_BASE (IDENT_ADDR + GAMMA_BIAS + 0x388000000L)
136 #define T2_MEM1_BASE (IDENT_ADDR + GAMMA_BIAS + 0x389000000L)
137 #define T2_MEM2_BASE (IDENT_ADDR + GAMMA_BIAS + 0x38a000000L)
138 #define T2_MEM3_BASE (IDENT_ADDR + GAMMA_BIAS + 0x38b000000L)
139
140
141
142
143
144
145
146
147
148
149
150 struct sable_cpu_csr {
151 unsigned long bcc; long fill_00[3];
152 unsigned long bcce; long fill_01[3];
153 unsigned long bccea; long fill_02[3];
154 unsigned long bcue; long fill_03[3];
155 unsigned long bcuea; long fill_04[3];
156 unsigned long dter; long fill_05[3];
157 unsigned long cbctl; long fill_06[3];
158 unsigned long cbe; long fill_07[3];
159 unsigned long cbeal; long fill_08[3];
160 unsigned long cbeah; long fill_09[3];
161 unsigned long pmbx; long fill_10[3];
162 unsigned long ipir; long fill_11[3];
163 unsigned long sic; long fill_12[3];
164 unsigned long adlk; long fill_13[3];
165 unsigned long madrl; long fill_14[3];
166 unsigned long rev; long fill_15[3];
167 };
168
169
170
171
172 struct el_t2_frame_header {
173 unsigned int elcf_fid;
174 unsigned int elcf_size;
175 };
176
177 struct el_t2_procdata_mcheck {
178 unsigned long elfmc_paltemp[32];
179
180 unsigned long elfmc_exc_addr;
181 unsigned long elfmc_exc_sum;
182 unsigned long elfmc_exc_mask;
183 unsigned long elfmc_iccsr;
184 unsigned long elfmc_pal_base;
185 unsigned long elfmc_hier;
186 unsigned long elfmc_hirr;
187 unsigned long elfmc_mm_csr;
188 unsigned long elfmc_dc_stat;
189 unsigned long elfmc_dc_addr;
190 unsigned long elfmc_abox_ctl;
191 unsigned long elfmc_biu_stat;
192 unsigned long elfmc_biu_addr;
193 unsigned long elfmc_biu_ctl;
194 unsigned long elfmc_fill_syndrome;
195 unsigned long elfmc_fill_addr;
196 unsigned long elfmc_va;
197 unsigned long elfmc_bc_tag;
198 };
199
200
201
202
203
204 struct el_t2_logout_header {
205 unsigned int elfl_size;
206 unsigned int elfl_sbz1:31;
207 unsigned int elfl_retry:1;
208 unsigned int elfl_procoffset;
209 unsigned int elfl_sysoffset;
210 unsigned int elfl_error_type;
211 unsigned int elfl_frame_rev;
212 };
213 struct el_t2_sysdata_mcheck {
214 unsigned long elcmc_bcc;
215 unsigned long elcmc_bcce;
216 unsigned long elcmc_bccea;
217 unsigned long elcmc_bcue;
218 unsigned long elcmc_bcuea;
219 unsigned long elcmc_dter;
220 unsigned long elcmc_cbctl;
221 unsigned long elcmc_cbe;
222 unsigned long elcmc_cbeal;
223 unsigned long elcmc_cbeah;
224 unsigned long elcmc_pmbx;
225 unsigned long elcmc_ipir;
226 unsigned long elcmc_sic;
227 unsigned long elcmc_adlk;
228 unsigned long elcmc_madrl;
229 unsigned long elcmc_crrev4;
230 };
231
232
233
234
235 struct el_t2_data_memory {
236 struct el_t2_frame_header elcm_hdr;
237 unsigned int elcm_module;
238 unsigned int elcm_res04;
239 unsigned long elcm_merr;
240 unsigned long elcm_mcmd1;
241 unsigned long elcm_mcmd2;
242 unsigned long elcm_mconf;
243 unsigned long elcm_medc1;
244 unsigned long elcm_medc2;
245 unsigned long elcm_medcc;
246 unsigned long elcm_msctl;
247 unsigned long elcm_mref;
248 unsigned long elcm_filter;
249 };
250
251
252
253
254
255 struct el_t2_data_other_cpu {
256 short elco_cpuid;
257 short elco_res02[3];
258 unsigned long elco_bcc;
259 unsigned long elco_bcce;
260 unsigned long elco_bccea;
261 unsigned long elco_bcue;
262 unsigned long elco_bcuea;
263 unsigned long elco_dter;
264 unsigned long elco_cbctl;
265 unsigned long elco_cbe;
266 unsigned long elco_cbeal;
267 unsigned long elco_cbeah;
268 unsigned long elco_pmbx;
269 unsigned long elco_ipir;
270 unsigned long elco_sic;
271 unsigned long elco_adlk;
272 unsigned long elco_madrl;
273 unsigned long elco_crrev4;
274 };
275
276
277
278
279 struct el_t2_data_t2{
280 struct el_t2_frame_header elct_hdr;
281 unsigned long elct_iocsr;
282 unsigned long elct_cerr1;
283 unsigned long elct_cerr2;
284 unsigned long elct_cerr3;
285 unsigned long elct_perr1;
286 unsigned long elct_perr2;
287 unsigned long elct_hae0_1;
288 unsigned long elct_hae0_2;
289 unsigned long elct_hbase;
290 unsigned long elct_wbase1;
291 unsigned long elct_wmask1;
292 unsigned long elct_tbase1;
293 unsigned long elct_wbase2;
294 unsigned long elct_wmask2;
295 unsigned long elct_tbase2;
296 unsigned long elct_tdr0;
297 unsigned long elct_tdr1;
298 unsigned long elct_tdr2;
299 unsigned long elct_tdr3;
300 unsigned long elct_tdr4;
301 unsigned long elct_tdr5;
302 unsigned long elct_tdr6;
303 unsigned long elct_tdr7;
304 };
305
306
307
308
309 struct el_t2_data_corrected {
310 unsigned long elcpb_biu_stat;
311 unsigned long elcpb_biu_addr;
312 unsigned long elcpb_biu_ctl;
313 unsigned long elcpb_fill_syndrome;
314 unsigned long elcpb_fill_addr;
315 unsigned long elcpb_bc_tag;
316 };
317
318
319
320
321
322 struct el_t2_frame_mcheck {
323 struct el_t2_frame_header elfmc_header;
324 struct el_t2_logout_header elfmc_hdr;
325 struct el_t2_procdata_mcheck elfmc_procdata;
326 struct el_t2_sysdata_mcheck elfmc_sysdata;
327 struct el_t2_data_t2 elfmc_t2data;
328 struct el_t2_data_memory elfmc_memdata[4];
329 struct el_t2_frame_header elfmc_footer;
330 };
331
332
333
334
335
336 struct el_t2_frame_corrected {
337 struct el_t2_frame_header elfcc_header;
338 struct el_t2_logout_header elfcc_hdr;
339 struct el_t2_data_corrected elfcc_procdata;
340
341
342 struct el_t2_frame_header elfcc_footer;
343 };
344
345
346 #ifdef __KERNEL__
347
348 #ifndef __EXTERN_INLINE
349 #define __EXTERN_INLINE extern inline
350 #define __IO_EXTERN_INLINE
351 #endif
352
353
354
355
356
357
358
359
360
361 #define vip volatile int *
362 #define vuip volatile unsigned int *
363
364 extern inline u8 t2_inb(unsigned long addr)
365 {
366 long result = *(vip) ((addr << 5) + T2_IO + 0x00);
367 return __kernel_extbl(result, addr & 3);
368 }
369
370 extern inline void t2_outb(u8 b, unsigned long addr)
371 {
372 unsigned long w;
373
374 w = __kernel_insbl(b, addr & 3);
375 *(vuip) ((addr << 5) + T2_IO + 0x00) = w;
376 mb();
377 }
378
379 extern inline u16 t2_inw(unsigned long addr)
380 {
381 long result = *(vip) ((addr << 5) + T2_IO + 0x08);
382 return __kernel_extwl(result, addr & 3);
383 }
384
385 extern inline void t2_outw(u16 b, unsigned long addr)
386 {
387 unsigned long w;
388
389 w = __kernel_inswl(b, addr & 3);
390 *(vuip) ((addr << 5) + T2_IO + 0x08) = w;
391 mb();
392 }
393
394 extern inline u32 t2_inl(unsigned long addr)
395 {
396 return *(vuip) ((addr << 5) + T2_IO + 0x18);
397 }
398
399 extern inline void t2_outl(u32 b, unsigned long addr)
400 {
401 *(vuip) ((addr << 5) + T2_IO + 0x18) = b;
402 mb();
403 }
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437 #ifdef T2_ONE_HAE_WINDOW
438 #define t2_set_hae
439 #else
440 #define t2_set_hae { \
441 unsigned long msb = addr >> 27; \
442 addr &= T2_MEM_R1_MASK; \
443 set_hae(msb); \
444 }
445 #endif
446
447
448
449
450
451
452
453 __EXTERN_INLINE u8 t2_readb(const volatile void __iomem *xaddr)
454 {
455 unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
456 unsigned long result;
457
458 t2_set_hae;
459
460 result = *(vip) ((addr << 5) + T2_SPARSE_MEM + 0x00);
461 return __kernel_extbl(result, addr & 3);
462 }
463
464 __EXTERN_INLINE u16 t2_readw(const volatile void __iomem *xaddr)
465 {
466 unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
467 unsigned long result;
468
469 t2_set_hae;
470
471 result = *(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x08);
472 return __kernel_extwl(result, addr & 3);
473 }
474
475
476
477
478
479 __EXTERN_INLINE u32 t2_readl(const volatile void __iomem *xaddr)
480 {
481 unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
482 unsigned long result;
483
484 t2_set_hae;
485
486 result = *(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x18);
487 return result & 0xffffffffUL;
488 }
489
490 __EXTERN_INLINE u64 t2_readq(const volatile void __iomem *xaddr)
491 {
492 unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
493 unsigned long r0, r1, work;
494
495 t2_set_hae;
496
497 work = (addr << 5) + T2_SPARSE_MEM + 0x18;
498 r0 = *(vuip)(work);
499 r1 = *(vuip)(work + (4 << 5));
500 return r1 << 32 | r0;
501 }
502
503 __EXTERN_INLINE void t2_writeb(u8 b, volatile void __iomem *xaddr)
504 {
505 unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
506 unsigned long w;
507
508 t2_set_hae;
509
510 w = __kernel_insbl(b, addr & 3);
511 *(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x00) = w;
512 }
513
514 __EXTERN_INLINE void t2_writew(u16 b, volatile void __iomem *xaddr)
515 {
516 unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
517 unsigned long w;
518
519 t2_set_hae;
520
521 w = __kernel_inswl(b, addr & 3);
522 *(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x08) = w;
523 }
524
525
526
527
528
529 __EXTERN_INLINE void t2_writel(u32 b, volatile void __iomem *xaddr)
530 {
531 unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
532
533 t2_set_hae;
534
535 *(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x18) = b;
536 }
537
538 __EXTERN_INLINE void t2_writeq(u64 b, volatile void __iomem *xaddr)
539 {
540 unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
541 unsigned long work;
542
543 t2_set_hae;
544
545 work = (addr << 5) + T2_SPARSE_MEM + 0x18;
546 *(vuip)work = b;
547 *(vuip)(work + (4 << 5)) = b >> 32;
548 }
549
550 __EXTERN_INLINE void __iomem *t2_ioportmap(unsigned long addr)
551 {
552 return (void __iomem *)(addr + T2_IO);
553 }
554
555 __EXTERN_INLINE void __iomem *t2_ioremap(unsigned long addr,
556 unsigned long size)
557 {
558 return (void __iomem *)(addr + T2_DENSE_MEM);
559 }
560
561 __EXTERN_INLINE int t2_is_ioaddr(unsigned long addr)
562 {
563 return (long)addr >= 0;
564 }
565
566 __EXTERN_INLINE int t2_is_mmio(const volatile void __iomem *addr)
567 {
568 return (unsigned long)addr >= T2_DENSE_MEM;
569 }
570
571
572
573
574 #define IOPORT(OS, NS) \
575 __EXTERN_INLINE unsigned int t2_ioread##NS(void __iomem *xaddr) \
576 { \
577 if (t2_is_mmio(xaddr)) \
578 return t2_read##OS(xaddr); \
579 else \
580 return t2_in##OS((unsigned long)xaddr - T2_IO); \
581 } \
582 __EXTERN_INLINE void t2_iowrite##NS(u##NS b, void __iomem *xaddr) \
583 { \
584 if (t2_is_mmio(xaddr)) \
585 t2_write##OS(b, xaddr); \
586 else \
587 t2_out##OS(b, (unsigned long)xaddr - T2_IO); \
588 }
589
590 IOPORT(b, 8)
591 IOPORT(w, 16)
592 IOPORT(l, 32)
593
594 #undef IOPORT
595
596 #undef vip
597 #undef vuip
598
599 #undef __IO_PREFIX
600 #define __IO_PREFIX t2
601 #define t2_trivial_rw_bw 0
602 #define t2_trivial_rw_lq 0
603 #define t2_trivial_io_bw 0
604 #define t2_trivial_io_lq 0
605 #define t2_trivial_iounmap 1
606 #include <asm/io_trivial.h>
607
608 #ifdef __IO_EXTERN_INLINE
609 #undef __EXTERN_INLINE
610 #undef __IO_EXTERN_INLINE
611 #endif
612
613 #endif
614
615 #endif