This source file includes following definitions.
- __mcpcia_is_mmio
- mcpcia_ioread8
- mcpcia_iowrite8
- mcpcia_ioread16
- mcpcia_iowrite16
- mcpcia_ioread32
- mcpcia_iowrite32
- mcpcia_ioportmap
- mcpcia_ioremap
- mcpcia_is_ioaddr
- mcpcia_is_mmio
1
2 #ifndef __ALPHA_MCPCIA__H__
3 #define __ALPHA_MCPCIA__H__
4
5
6
7 #define MCPCIA_ONE_HAE_WINDOW 1
8
9 #include <linux/types.h>
10 #include <asm/compiler.h>
11 #include <asm/mce.h>
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76 #define MCPCIA_MAX_HOSES 4
77
78 #define MCPCIA_MID(m) ((unsigned long)(m) << 33)
79
80
81
82 #define MCPCIA_HOSE2MID(h) ((h) + 4)
83
84 #define MCPCIA_MEM_MASK 0x07ffffff
85
86
87
88
89 #define MCPCIA_SPARSE(m) (IDENT_ADDR + 0xf000000000UL + MCPCIA_MID(m))
90 #define MCPCIA_DENSE(m) (IDENT_ADDR + 0xf100000000UL + MCPCIA_MID(m))
91 #define MCPCIA_IO(m) (IDENT_ADDR + 0xf180000000UL + MCPCIA_MID(m))
92 #define MCPCIA_CONF(m) (IDENT_ADDR + 0xf1c0000000UL + MCPCIA_MID(m))
93 #define MCPCIA_CSR(m) (IDENT_ADDR + 0xf1e0000000UL + MCPCIA_MID(m))
94 #define MCPCIA_IO_IACK(m) (IDENT_ADDR + 0xf1f0000000UL + MCPCIA_MID(m))
95 #define MCPCIA_DENSE_IO(m) (IDENT_ADDR + 0xe1fc000000UL + MCPCIA_MID(m))
96 #define MCPCIA_DENSE_CONF(m) (IDENT_ADDR + 0xe1fe000000UL + MCPCIA_MID(m))
97
98
99
100
101 #define MCPCIA_REV(m) (MCPCIA_CSR(m) + 0x000)
102 #define MCPCIA_WHOAMI(m) (MCPCIA_CSR(m) + 0x040)
103 #define MCPCIA_PCI_LAT(m) (MCPCIA_CSR(m) + 0x080)
104 #define MCPCIA_CAP_CTRL(m) (MCPCIA_CSR(m) + 0x100)
105 #define MCPCIA_HAE_MEM(m) (MCPCIA_CSR(m) + 0x400)
106 #define MCPCIA_HAE_IO(m) (MCPCIA_CSR(m) + 0x440)
107 #define _MCPCIA_IACK_SC(m) (MCPCIA_CSR(m) + 0x480)
108 #define MCPCIA_HAE_DENSE(m) (MCPCIA_CSR(m) + 0x4C0)
109
110
111
112
113 #define MCPCIA_INT_CTL(m) (MCPCIA_CSR(m) + 0x500)
114 #define MCPCIA_INT_REQ(m) (MCPCIA_CSR(m) + 0x540)
115 #define MCPCIA_INT_TARG(m) (MCPCIA_CSR(m) + 0x580)
116 #define MCPCIA_INT_ADR(m) (MCPCIA_CSR(m) + 0x5C0)
117 #define MCPCIA_INT_ADR_EXT(m) (MCPCIA_CSR(m) + 0x600)
118 #define MCPCIA_INT_MASK0(m) (MCPCIA_CSR(m) + 0x640)
119 #define MCPCIA_INT_MASK1(m) (MCPCIA_CSR(m) + 0x680)
120 #define MCPCIA_INT_ACK0(m) (MCPCIA_CSR(m) + 0x10003f00)
121 #define MCPCIA_INT_ACK1(m) (MCPCIA_CSR(m) + 0x10003f40)
122
123
124
125
126 #define MCPCIA_PERF_MON(m) (MCPCIA_CSR(m) + 0x300)
127 #define MCPCIA_PERF_CONT(m) (MCPCIA_CSR(m) + 0x340)
128
129
130
131
132 #define MCPCIA_CAP_DIAG(m) (MCPCIA_CSR(m) + 0x700)
133 #define MCPCIA_TOP_OF_MEM(m) (MCPCIA_CSR(m) + 0x7C0)
134
135
136
137
138 #define MCPCIA_MC_ERR0(m) (MCPCIA_CSR(m) + 0x800)
139 #define MCPCIA_MC_ERR1(m) (MCPCIA_CSR(m) + 0x840)
140 #define MCPCIA_CAP_ERR(m) (MCPCIA_CSR(m) + 0x880)
141 #define MCPCIA_PCI_ERR1(m) (MCPCIA_CSR(m) + 0x1040)
142 #define MCPCIA_MDPA_STAT(m) (MCPCIA_CSR(m) + 0x4000)
143 #define MCPCIA_MDPA_SYN(m) (MCPCIA_CSR(m) + 0x4040)
144 #define MCPCIA_MDPA_DIAG(m) (MCPCIA_CSR(m) + 0x4080)
145 #define MCPCIA_MDPB_STAT(m) (MCPCIA_CSR(m) + 0x8000)
146 #define MCPCIA_MDPB_SYN(m) (MCPCIA_CSR(m) + 0x8040)
147 #define MCPCIA_MDPB_DIAG(m) (MCPCIA_CSR(m) + 0x8080)
148
149
150
151
152 #define MCPCIA_SG_TBIA(m) (MCPCIA_CSR(m) + 0x1300)
153 #define MCPCIA_HBASE(m) (MCPCIA_CSR(m) + 0x1340)
154
155 #define MCPCIA_W0_BASE(m) (MCPCIA_CSR(m) + 0x1400)
156 #define MCPCIA_W0_MASK(m) (MCPCIA_CSR(m) + 0x1440)
157 #define MCPCIA_T0_BASE(m) (MCPCIA_CSR(m) + 0x1480)
158
159 #define MCPCIA_W1_BASE(m) (MCPCIA_CSR(m) + 0x1500)
160 #define MCPCIA_W1_MASK(m) (MCPCIA_CSR(m) + 0x1540)
161 #define MCPCIA_T1_BASE(m) (MCPCIA_CSR(m) + 0x1580)
162
163 #define MCPCIA_W2_BASE(m) (MCPCIA_CSR(m) + 0x1600)
164 #define MCPCIA_W2_MASK(m) (MCPCIA_CSR(m) + 0x1640)
165 #define MCPCIA_T2_BASE(m) (MCPCIA_CSR(m) + 0x1680)
166
167 #define MCPCIA_W3_BASE(m) (MCPCIA_CSR(m) + 0x1700)
168 #define MCPCIA_W3_MASK(m) (MCPCIA_CSR(m) + 0x1740)
169 #define MCPCIA_T3_BASE(m) (MCPCIA_CSR(m) + 0x1780)
170
171
172
173 #ifndef MCPCIA_ONE_HAE_WINDOW
174 #define MCPCIA_HAE_ADDRESS MCPCIA_HAE_MEM(4)
175 #endif
176 #define MCPCIA_IACK_SC _MCPCIA_IACK_SC(4)
177
178
179
180
181
182
183
184 #define MCPCIA_IO_BIAS MCPCIA_IO(4)
185 #define MCPCIA_MEM_BIAS MCPCIA_DENSE(4)
186
187
188 #define MCPCIA_DAC_OFFSET (1UL << 40)
189
190
191
192
193 struct el_MCPCIA_uncorrected_frame_mcheck {
194 struct el_common header;
195 struct el_common_EV5_uncorrectable_mcheck procdata;
196 };
197
198
199 #ifdef __KERNEL__
200
201 #ifndef __EXTERN_INLINE
202 #define __EXTERN_INLINE extern inline
203 #define __IO_EXTERN_INLINE
204 #endif
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249 #define vip volatile int __force *
250 #define vuip volatile unsigned int __force *
251
252 #ifndef MCPCIA_ONE_HAE_WINDOW
253 #define MCPCIA_FROB_MMIO \
254 if (__mcpcia_is_mmio(hose)) { \
255 set_hae(hose & 0xffffffff); \
256 hose = hose - MCPCIA_DENSE(4) + MCPCIA_SPARSE(4); \
257 }
258 #else
259 #define MCPCIA_FROB_MMIO \
260 if (__mcpcia_is_mmio(hose)) { \
261 hose = hose - MCPCIA_DENSE(4) + MCPCIA_SPARSE(4); \
262 }
263 #endif
264
265 extern inline int __mcpcia_is_mmio(unsigned long addr)
266 {
267 return (addr & 0x80000000UL) == 0;
268 }
269
270 __EXTERN_INLINE unsigned int mcpcia_ioread8(void __iomem *xaddr)
271 {
272 unsigned long addr = (unsigned long)xaddr & MCPCIA_MEM_MASK;
273 unsigned long hose = (unsigned long)xaddr & ~MCPCIA_MEM_MASK;
274 unsigned long result;
275
276 MCPCIA_FROB_MMIO;
277
278 result = *(vip) ((addr << 5) + hose + 0x00);
279 return __kernel_extbl(result, addr & 3);
280 }
281
282 __EXTERN_INLINE void mcpcia_iowrite8(u8 b, void __iomem *xaddr)
283 {
284 unsigned long addr = (unsigned long)xaddr & MCPCIA_MEM_MASK;
285 unsigned long hose = (unsigned long)xaddr & ~MCPCIA_MEM_MASK;
286 unsigned long w;
287
288 MCPCIA_FROB_MMIO;
289
290 w = __kernel_insbl(b, addr & 3);
291 *(vuip) ((addr << 5) + hose + 0x00) = w;
292 }
293
294 __EXTERN_INLINE unsigned int mcpcia_ioread16(void __iomem *xaddr)
295 {
296 unsigned long addr = (unsigned long)xaddr & MCPCIA_MEM_MASK;
297 unsigned long hose = (unsigned long)xaddr & ~MCPCIA_MEM_MASK;
298 unsigned long result;
299
300 MCPCIA_FROB_MMIO;
301
302 result = *(vip) ((addr << 5) + hose + 0x08);
303 return __kernel_extwl(result, addr & 3);
304 }
305
306 __EXTERN_INLINE void mcpcia_iowrite16(u16 b, void __iomem *xaddr)
307 {
308 unsigned long addr = (unsigned long)xaddr & MCPCIA_MEM_MASK;
309 unsigned long hose = (unsigned long)xaddr & ~MCPCIA_MEM_MASK;
310 unsigned long w;
311
312 MCPCIA_FROB_MMIO;
313
314 w = __kernel_inswl(b, addr & 3);
315 *(vuip) ((addr << 5) + hose + 0x08) = w;
316 }
317
318 __EXTERN_INLINE unsigned int mcpcia_ioread32(void __iomem *xaddr)
319 {
320 unsigned long addr = (unsigned long)xaddr;
321
322 if (!__mcpcia_is_mmio(addr))
323 addr = ((addr & 0xffff) << 5) + (addr & ~0xfffful) + 0x18;
324
325 return *(vuip)addr;
326 }
327
328 __EXTERN_INLINE void mcpcia_iowrite32(u32 b, void __iomem *xaddr)
329 {
330 unsigned long addr = (unsigned long)xaddr;
331
332 if (!__mcpcia_is_mmio(addr))
333 addr = ((addr & 0xffff) << 5) + (addr & ~0xfffful) + 0x18;
334
335 *(vuip)addr = b;
336 }
337
338
339 __EXTERN_INLINE void __iomem *mcpcia_ioportmap(unsigned long addr)
340 {
341 return (void __iomem *)(addr + MCPCIA_IO_BIAS);
342 }
343
344 __EXTERN_INLINE void __iomem *mcpcia_ioremap(unsigned long addr,
345 unsigned long size)
346 {
347 return (void __iomem *)(addr + MCPCIA_MEM_BIAS);
348 }
349
350 __EXTERN_INLINE int mcpcia_is_ioaddr(unsigned long addr)
351 {
352 return addr >= MCPCIA_SPARSE(0);
353 }
354
355 __EXTERN_INLINE int mcpcia_is_mmio(const volatile void __iomem *xaddr)
356 {
357 unsigned long addr = (unsigned long) xaddr;
358 return __mcpcia_is_mmio(addr);
359 }
360
361 #undef MCPCIA_FROB_MMIO
362
363 #undef vip
364 #undef vuip
365
366 #undef __IO_PREFIX
367 #define __IO_PREFIX mcpcia
368 #define mcpcia_trivial_rw_bw 2
369 #define mcpcia_trivial_rw_lq 1
370 #define mcpcia_trivial_io_bw 0
371 #define mcpcia_trivial_io_lq 0
372 #define mcpcia_trivial_iounmap 1
373 #include <asm/io_trivial.h>
374
375 #ifdef __IO_EXTERN_INLINE
376 #undef __EXTERN_INLINE
377 #undef __IO_EXTERN_INLINE
378 #endif
379
380 #endif
381
382 #endif