Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
core_wildfire.h
Go to the documentation of this file.
1 #ifndef __ALPHA_WILDFIRE__H__
2 #define __ALPHA_WILDFIRE__H__
3 
4 #include <linux/types.h>
5 #include <asm/compiler.h>
6 
7 #define WILDFIRE_MAX_QBB 8 /* more than 8 requires other mods */
8 #define WILDFIRE_PCA_PER_QBB 4
9 #define WILDFIRE_IRQ_PER_PCA 64
10 
11 #define WILDFIRE_NR_IRQS \
12  (WILDFIRE_MAX_QBB * WILDFIRE_PCA_PER_QBB * WILDFIRE_IRQ_PER_PCA)
13 
14 extern unsigned char wildfire_hard_qbb_map[WILDFIRE_MAX_QBB];
15 extern unsigned char wildfire_soft_qbb_map[WILDFIRE_MAX_QBB];
16 #define QBB_MAP_EMPTY 0xff
17 
18 extern unsigned long wildfire_hard_qbb_mask;
19 extern unsigned long wildfire_soft_qbb_mask;
20 extern unsigned long wildfire_gp_mask;
21 extern unsigned long wildfire_hs_mask;
22 extern unsigned long wildfire_iop_mask;
23 extern unsigned long wildfire_ior_mask;
24 extern unsigned long wildfire_pca_mask;
25 extern unsigned long wildfire_cpu_mask;
26 extern unsigned long wildfire_mem_mask;
27 
28 #define WILDFIRE_QBB_EXISTS(qbbno) (wildfire_soft_qbb_mask & (1 << (qbbno)))
29 
30 #define WILDFIRE_MEM_EXISTS(qbbno) (wildfire_mem_mask & (0xf << ((qbbno) << 2)))
31 
32 #define WILDFIRE_PCA_EXISTS(qbbno, pcano) \
33  (wildfire_pca_mask & (1 << (((qbbno) << 2) + (pcano))))
34 
35 typedef struct {
36  volatile unsigned long csr __attribute__((aligned(64)));
37 } wildfire_64;
38 
39 typedef struct {
40  volatile unsigned long csr __attribute__((aligned(256)));
41 } wildfire_256;
42 
43 typedef struct {
44  volatile unsigned long csr __attribute__((aligned(2048)));
45 } wildfire_2k;
46 
47 typedef struct {
56  wildfire_64 ce_sum[4];
57  wildfire_64 dev_init[4];
58  wildfire_64 it_int[4];
59  wildfire_64 ip_int[4];
60  wildfire_64 uce_sum[4];
61  wildfire_64 se_sum__non_dev_int[4];
65 } wildfire_qsd;
66 
67 typedef struct {
77 
78 typedef struct {
83  wildfire_2k qsa_config[5];
85  wildfire_2k qsa_qbb_pop[2];
89  wildfire_2k qsa_diag_lock[4];
90  wildfire_2k __pad3[11];
97  wildfire_2k __pad4[26];
100  wildfire_2k __pad5[2];
101  wildfire_2k qsa_port_map[4];
102  wildfire_2k qsa_arr_addr[8];
103  wildfire_2k qsa_arr_mask[8];
104 } wildfire_qsa;
105 
106 typedef struct {
113  struct {
116  } iop_hose[4];
125  struct {
128  } iop_dev_int[4];
129 
131  wildfire_64 __pad5[7];
138  wildfire_64 __pad8[4];
141  wildfire_64 __pad9[4];
143  wildfire_64 __pad10[15];
146 } wildfire_iop;
147 
148 typedef struct {
149  wildfire_2k gpa_qbb_map[4];
157  /* not complete */
158 } wildfire_gp;
159 
160 typedef struct {
174  struct {
177  } pca_int[4];
178  wildfire_64 __pad3[56];
179  wildfire_64 pca_alt_sent_int[32];
180 } wildfire_pca;
181 
182 typedef struct {
184  /* not complete */
185 } wildfire_ne;
186 
187 typedef struct {
189  /* not complete */
190 } wildfire_fe;
191 
192 typedef struct {
203  struct {
207  } pci_window[4];
210 } wildfire_pci;
211 
212 #define WILDFIRE_ENTITY_SHIFT 18
213 
214 #define WILDFIRE_GP_ENTITY (0x10UL << WILDFIRE_ENTITY_SHIFT)
215 #define WILDFIRE_IOP_ENTITY (0x08UL << WILDFIRE_ENTITY_SHIFT)
216 #define WILDFIRE_QSA_ENTITY (0x04UL << WILDFIRE_ENTITY_SHIFT)
217 #define WILDFIRE_QSD_ENTITY_SLOW (0x05UL << WILDFIRE_ENTITY_SHIFT)
218 #define WILDFIRE_QSD_ENTITY_FAST (0x01UL << WILDFIRE_ENTITY_SHIFT)
219 
220 #define WILDFIRE_PCA_ENTITY(pca) ((0xc|(pca))<<WILDFIRE_ENTITY_SHIFT)
221 
222 #define WILDFIRE_BASE (IDENT_ADDR | (1UL << 40))
223 
224 #define WILDFIRE_QBB_MASK 0x0fUL /* for now, only 4 bits/16 QBBs */
225 
226 #define WILDFIRE_QBB(q) ((~((long)(q)) & WILDFIRE_QBB_MASK) << 36)
227 #define WILDFIRE_HOSE(h) ((long)(h) << 33)
228 
229 #define WILDFIRE_QBB_IO(q) (WILDFIRE_BASE | WILDFIRE_QBB(q))
230 #define WILDFIRE_QBB_HOSE(q,h) (WILDFIRE_QBB_IO(q) | WILDFIRE_HOSE(h))
231 
232 #define WILDFIRE_MEM(q,h) (WILDFIRE_QBB_HOSE(q,h) | 0x000000000UL)
233 #define WILDFIRE_CONF(q,h) (WILDFIRE_QBB_HOSE(q,h) | 0x1FE000000UL)
234 #define WILDFIRE_IO(q,h) (WILDFIRE_QBB_HOSE(q,h) | 0x1FF000000UL)
235 
236 #define WILDFIRE_qsd(q) \
237  ((wildfire_qsd *)(WILDFIRE_QBB_IO(q)|WILDFIRE_QSD_ENTITY_SLOW|(((1UL<<13)-1)<<23)))
238 
239 #define WILDFIRE_fast_qsd() \
240  ((wildfire_fast_qsd *)(WILDFIRE_QBB_IO(0)|WILDFIRE_QSD_ENTITY_FAST|(((1UL<<13)-1)<<23)))
241 
242 #define WILDFIRE_qsa(q) \
243  ((wildfire_qsa *)(WILDFIRE_QBB_IO(q)|WILDFIRE_QSA_ENTITY|(((1UL<<13)-1)<<23)))
244 
245 #define WILDFIRE_iop(q) \
246  ((wildfire_iop *)(WILDFIRE_QBB_IO(q)|WILDFIRE_IOP_ENTITY|(((1UL<<13)-1)<<23)))
247 
248 #define WILDFIRE_gp(q) \
249  ((wildfire_gp *)(WILDFIRE_QBB_IO(q)|WILDFIRE_GP_ENTITY|(((1UL<<13)-1)<<23)))
250 
251 #define WILDFIRE_pca(q,pca) \
252  ((wildfire_pca *)(WILDFIRE_QBB_IO(q)|WILDFIRE_PCA_ENTITY(pca)|(((1UL<<13)-1)<<23)))
253 
254 #define WILDFIRE_ne(q,pca) \
255  ((wildfire_ne *)(WILDFIRE_QBB_IO(q)|WILDFIRE_PCA_ENTITY(pca)|(((1UL<<13)-1)<<23)|(1UL<<16)))
256 
257 #define WILDFIRE_fe(q,pca) \
258  ((wildfire_fe *)(WILDFIRE_QBB_IO(q)|WILDFIRE_PCA_ENTITY(pca)|(((1UL<<13)-1)<<23)|(3UL<<15)))
259 
260 #define WILDFIRE_pci(q,h) \
261  ((wildfire_pci *)(WILDFIRE_QBB_IO(q)|WILDFIRE_PCA_ENTITY(((h)&6)>>1)|((((h)&1)|2)<<16)|(((1UL<<13)-1)<<23)))
262 
263 #define WILDFIRE_IO_BIAS WILDFIRE_IO(0,0)
264 #define WILDFIRE_MEM_BIAS WILDFIRE_MEM(0,0) /* ??? */
265 
266 /* The IO address space is larger than 0xffff */
267 #define WILDFIRE_IO_SPACE (8UL*1024*1024)
268 
269 #ifdef __KERNEL__
270 
271 #ifndef __EXTERN_INLINE
272 #define __EXTERN_INLINE extern inline
273 #define __IO_EXTERN_INLINE
274 #endif
275 
276 /*
277  * Memory functions. all accesses are done through linear space.
278  */
279 
280 __EXTERN_INLINE void __iomem *wildfire_ioportmap(unsigned long addr)
281 {
282  return (void __iomem *)(addr + WILDFIRE_IO_BIAS);
283 }
284 
285 __EXTERN_INLINE void __iomem *wildfire_ioremap(unsigned long addr,
286  unsigned long size)
287 {
288  return (void __iomem *)(addr + WILDFIRE_MEM_BIAS);
289 }
290 
291 __EXTERN_INLINE int wildfire_is_ioaddr(unsigned long addr)
292 {
293  return addr >= WILDFIRE_BASE;
294 }
295 
296 __EXTERN_INLINE int wildfire_is_mmio(const volatile void __iomem *xaddr)
297 {
298  unsigned long addr = (unsigned long)xaddr;
299  return (addr & 0x100000000UL) == 0;
300 }
301 
302 #undef __IO_PREFIX
303 #define __IO_PREFIX wildfire
304 #define wildfire_trivial_rw_bw 1
305 #define wildfire_trivial_rw_lq 1
306 #define wildfire_trivial_io_bw 1
307 #define wildfire_trivial_io_lq 1
308 #define wildfire_trivial_iounmap 1
309 #include <asm/io_trivial.h>
310 
311 #ifdef __IO_EXTERN_INLINE
312 #undef __EXTERN_INLINE
313 #undef __IO_EXTERN_INLINE
314 #endif
315 
316 #endif /* __KERNEL__ */
317 
318 #endif /* __ALPHA_WILDFIRE__H__ */