This source file includes following definitions.
- lca_ioread8
- lca_iowrite8
- lca_ioread16
- lca_iowrite16
- lca_ioread32
- lca_iowrite32
- lca_ioportmap
- lca_ioremap
- lca_is_ioaddr
- lca_is_mmio
1
2 #ifndef __ALPHA_LCA__H__
3 #define __ALPHA_LCA__H__
4
5 #include <asm/compiler.h>
6 #include <asm/mce.h>
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
56
57
58
59
60
61
62 #define LCA_MEM_BCR0 (IDENT_ADDR + 0x120000000UL)
63 #define LCA_MEM_BCR1 (IDENT_ADDR + 0x120000008UL)
64 #define LCA_MEM_BCR2 (IDENT_ADDR + 0x120000010UL)
65 #define LCA_MEM_BCR3 (IDENT_ADDR + 0x120000018UL)
66 #define LCA_MEM_BMR0 (IDENT_ADDR + 0x120000020UL)
67 #define LCA_MEM_BMR1 (IDENT_ADDR + 0x120000028UL)
68 #define LCA_MEM_BMR2 (IDENT_ADDR + 0x120000030UL)
69 #define LCA_MEM_BMR3 (IDENT_ADDR + 0x120000038UL)
70 #define LCA_MEM_BTR0 (IDENT_ADDR + 0x120000040UL)
71 #define LCA_MEM_BTR1 (IDENT_ADDR + 0x120000048UL)
72 #define LCA_MEM_BTR2 (IDENT_ADDR + 0x120000050UL)
73 #define LCA_MEM_BTR3 (IDENT_ADDR + 0x120000058UL)
74 #define LCA_MEM_GTR (IDENT_ADDR + 0x120000060UL)
75 #define LCA_MEM_ESR (IDENT_ADDR + 0x120000068UL)
76 #define LCA_MEM_EAR (IDENT_ADDR + 0x120000070UL)
77 #define LCA_MEM_CAR (IDENT_ADDR + 0x120000078UL)
78 #define LCA_MEM_VGR (IDENT_ADDR + 0x120000080UL)
79 #define LCA_MEM_PLM (IDENT_ADDR + 0x120000088UL)
80 #define LCA_MEM_FOR (IDENT_ADDR + 0x120000090UL)
81
82
83
84
85 #define LCA_IOC_HAE (IDENT_ADDR + 0x180000000UL)
86 #define LCA_IOC_CONF (IDENT_ADDR + 0x180000020UL)
87 #define LCA_IOC_STAT0 (IDENT_ADDR + 0x180000040UL)
88 #define LCA_IOC_STAT1 (IDENT_ADDR + 0x180000060UL)
89 #define LCA_IOC_TBIA (IDENT_ADDR + 0x180000080UL)
90 #define LCA_IOC_TB_ENA (IDENT_ADDR + 0x1800000a0UL)
91 #define LCA_IOC_SFT_RST (IDENT_ADDR + 0x1800000c0UL)
92 #define LCA_IOC_PAR_DIS (IDENT_ADDR + 0x1800000e0UL)
93 #define LCA_IOC_W_BASE0 (IDENT_ADDR + 0x180000100UL)
94 #define LCA_IOC_W_BASE1 (IDENT_ADDR + 0x180000120UL)
95 #define LCA_IOC_W_MASK0 (IDENT_ADDR + 0x180000140UL)
96 #define LCA_IOC_W_MASK1 (IDENT_ADDR + 0x180000160UL)
97 #define LCA_IOC_T_BASE0 (IDENT_ADDR + 0x180000180UL)
98 #define LCA_IOC_T_BASE1 (IDENT_ADDR + 0x1800001a0UL)
99 #define LCA_IOC_TB_TAG0 (IDENT_ADDR + 0x188000000UL)
100 #define LCA_IOC_TB_TAG1 (IDENT_ADDR + 0x188000020UL)
101 #define LCA_IOC_TB_TAG2 (IDENT_ADDR + 0x188000040UL)
102 #define LCA_IOC_TB_TAG3 (IDENT_ADDR + 0x188000060UL)
103 #define LCA_IOC_TB_TAG4 (IDENT_ADDR + 0x188000070UL)
104 #define LCA_IOC_TB_TAG5 (IDENT_ADDR + 0x1880000a0UL)
105 #define LCA_IOC_TB_TAG6 (IDENT_ADDR + 0x1880000c0UL)
106 #define LCA_IOC_TB_TAG7 (IDENT_ADDR + 0x1880000e0UL)
107
108
109
110
111 #define LCA_IACK_SC (IDENT_ADDR + 0x1a0000000UL)
112 #define LCA_CONF (IDENT_ADDR + 0x1e0000000UL)
113 #define LCA_IO (IDENT_ADDR + 0x1c0000000UL)
114 #define LCA_SPARSE_MEM (IDENT_ADDR + 0x200000000UL)
115 #define LCA_DENSE_MEM (IDENT_ADDR + 0x300000000UL)
116
117
118
119
120 #define LCA_IOC_STAT0_CMD 0xf
121 #define LCA_IOC_STAT0_ERR (1<<4)
122 #define LCA_IOC_STAT0_LOST (1<<5)
123 #define LCA_IOC_STAT0_THIT (1<<6)
124 #define LCA_IOC_STAT0_TREF (1<<7)
125 #define LCA_IOC_STAT0_CODE_SHIFT 8
126 #define LCA_IOC_STAT0_CODE_MASK 0x7
127 #define LCA_IOC_STAT0_P_NBR_SHIFT 13
128 #define LCA_IOC_STAT0_P_NBR_MASK 0x7ffff
129
130 #define LCA_HAE_ADDRESS LCA_IOC_HAE
131
132
133 #define LCA_PMR_ADDR (IDENT_ADDR + 0x120000098UL)
134 #define LCA_PMR_PDIV 0x7
135 #define LCA_PMR_ODIV 0x38
136 #define LCA_PMR_INTO 0x40
137 #define LCA_PMR_DMAO 0x80
138 #define LCA_PMR_OCCEB 0xffff0000L
139 #define LCA_PMR_OCCOB 0xffff000000000000L
140 #define LCA_PMR_PRIMARY_MASK 0xfffffffffffffff8L
141
142
143
144 #define LCA_READ_PMR (*(volatile unsigned long *)LCA_PMR_ADDR)
145 #define LCA_WRITE_PMR(d) (*((volatile unsigned long *)LCA_PMR_ADDR) = (d))
146
147 #define LCA_GET_PRIMARY(r) ((r) & LCA_PMR_PDIV)
148 #define LCA_GET_OVERRIDE(r) (((r) >> 3) & LCA_PMR_PDIV)
149 #define LCA_SET_PRIMARY_CLOCK(r, c) ((r) = (((r) & LCA_PMR_PRIMARY_MASK)|(c)))
150
151
152 #define LCA_PMR_DIV_1 0x0
153 #define LCA_PMR_DIV_1_5 0x1
154 #define LCA_PMR_DIV_2 0x2
155 #define LCA_PMR_DIV_4 0x3
156 #define LCA_PMR_DIV_8 0x4
157 #define LCA_PMR_DIV_16 0x5
158 #define LCA_PMR_DIV_MIN DIV_1
159 #define LCA_PMR_DIV_MAX DIV_16
160
161
162
163
164
165
166 struct el_lca_mcheck_short {
167 struct el_common h;
168 unsigned long esr;
169 unsigned long ear;
170 unsigned long dc_stat;
171 unsigned long ioc_stat0;
172 unsigned long ioc_stat1;
173 };
174
175 struct el_lca_mcheck_long {
176 struct el_common h;
177 unsigned long pt[31];
178 unsigned long exc_addr;
179 unsigned long pad1[3];
180 unsigned long pal_base;
181 unsigned long hier;
182 unsigned long hirr;
183 unsigned long mm_csr;
184 unsigned long dc_stat;
185 unsigned long dc_addr;
186 unsigned long abox_ctl;
187 unsigned long esr;
188 unsigned long ear;
189 unsigned long car;
190 unsigned long ioc_stat0;
191 unsigned long ioc_stat1;
192 unsigned long va;
193 };
194
195 union el_lca {
196 struct el_common * c;
197 struct el_lca_mcheck_long * l;
198 struct el_lca_mcheck_short * s;
199 };
200
201 #ifdef __KERNEL__
202
203 #ifndef __EXTERN_INLINE
204 #define __EXTERN_INLINE extern inline
205 #define __IO_EXTERN_INLINE
206 #endif
207
208
209
210
211
212
213
214
215
216
217
218
219 #define vip volatile int __force *
220 #define vuip volatile unsigned int __force *
221 #define vulp volatile unsigned long __force *
222
223 #define LCA_SET_HAE \
224 do { \
225 if (addr >= (1UL << 24)) { \
226 unsigned long msb = addr & 0xf8000000; \
227 addr -= msb; \
228 set_hae(msb); \
229 } \
230 } while (0)
231
232
233 __EXTERN_INLINE unsigned int lca_ioread8(void __iomem *xaddr)
234 {
235 unsigned long addr = (unsigned long) xaddr;
236 unsigned long result, base_and_type;
237
238 if (addr >= LCA_DENSE_MEM) {
239 addr -= LCA_DENSE_MEM;
240 LCA_SET_HAE;
241 base_and_type = LCA_SPARSE_MEM + 0x00;
242 } else {
243 addr -= LCA_IO;
244 base_and_type = LCA_IO + 0x00;
245 }
246
247 result = *(vip) ((addr << 5) + base_and_type);
248 return __kernel_extbl(result, addr & 3);
249 }
250
251 __EXTERN_INLINE void lca_iowrite8(u8 b, void __iomem *xaddr)
252 {
253 unsigned long addr = (unsigned long) xaddr;
254 unsigned long w, base_and_type;
255
256 if (addr >= LCA_DENSE_MEM) {
257 addr -= LCA_DENSE_MEM;
258 LCA_SET_HAE;
259 base_and_type = LCA_SPARSE_MEM + 0x00;
260 } else {
261 addr -= LCA_IO;
262 base_and_type = LCA_IO + 0x00;
263 }
264
265 w = __kernel_insbl(b, addr & 3);
266 *(vuip) ((addr << 5) + base_and_type) = w;
267 }
268
269 __EXTERN_INLINE unsigned int lca_ioread16(void __iomem *xaddr)
270 {
271 unsigned long addr = (unsigned long) xaddr;
272 unsigned long result, base_and_type;
273
274 if (addr >= LCA_DENSE_MEM) {
275 addr -= LCA_DENSE_MEM;
276 LCA_SET_HAE;
277 base_and_type = LCA_SPARSE_MEM + 0x08;
278 } else {
279 addr -= LCA_IO;
280 base_and_type = LCA_IO + 0x08;
281 }
282
283 result = *(vip) ((addr << 5) + base_and_type);
284 return __kernel_extwl(result, addr & 3);
285 }
286
287 __EXTERN_INLINE void lca_iowrite16(u16 b, void __iomem *xaddr)
288 {
289 unsigned long addr = (unsigned long) xaddr;
290 unsigned long w, base_and_type;
291
292 if (addr >= LCA_DENSE_MEM) {
293 addr -= LCA_DENSE_MEM;
294 LCA_SET_HAE;
295 base_and_type = LCA_SPARSE_MEM + 0x08;
296 } else {
297 addr -= LCA_IO;
298 base_and_type = LCA_IO + 0x08;
299 }
300
301 w = __kernel_inswl(b, addr & 3);
302 *(vuip) ((addr << 5) + base_and_type) = w;
303 }
304
305 __EXTERN_INLINE unsigned int lca_ioread32(void __iomem *xaddr)
306 {
307 unsigned long addr = (unsigned long) xaddr;
308 if (addr < LCA_DENSE_MEM)
309 addr = ((addr - LCA_IO) << 5) + LCA_IO + 0x18;
310 return *(vuip)addr;
311 }
312
313 __EXTERN_INLINE void lca_iowrite32(u32 b, void __iomem *xaddr)
314 {
315 unsigned long addr = (unsigned long) xaddr;
316 if (addr < LCA_DENSE_MEM)
317 addr = ((addr - LCA_IO) << 5) + LCA_IO + 0x18;
318 *(vuip)addr = b;
319 }
320
321 __EXTERN_INLINE void __iomem *lca_ioportmap(unsigned long addr)
322 {
323 return (void __iomem *)(addr + LCA_IO);
324 }
325
326 __EXTERN_INLINE void __iomem *lca_ioremap(unsigned long addr,
327 unsigned long size)
328 {
329 return (void __iomem *)(addr + LCA_DENSE_MEM);
330 }
331
332 __EXTERN_INLINE int lca_is_ioaddr(unsigned long addr)
333 {
334 return addr >= IDENT_ADDR + 0x120000000UL;
335 }
336
337 __EXTERN_INLINE int lca_is_mmio(const volatile void __iomem *addr)
338 {
339 return (unsigned long)addr >= LCA_DENSE_MEM;
340 }
341
342 #undef vip
343 #undef vuip
344 #undef vulp
345
346 #undef __IO_PREFIX
347 #define __IO_PREFIX lca
348 #define lca_trivial_rw_bw 2
349 #define lca_trivial_rw_lq 1
350 #define lca_trivial_io_bw 0
351 #define lca_trivial_io_lq 0
352 #define lca_trivial_iounmap 1
353 #include <asm/io_trivial.h>
354
355 #ifdef __IO_EXTERN_INLINE
356 #undef __EXTERN_INLINE
357 #undef __IO_EXTERN_INLINE
358 #endif
359
360 #endif
361
362 #endif