Linux 4.1.18
[linux/fpc-iii.git] / arch / alpha / include / asm / core_wildfire.h
blobcd562f544ba2deb9c1c77d0ec3fe36b0a939f16e
1 #ifndef __ALPHA_WILDFIRE__H__
2 #define __ALPHA_WILDFIRE__H__
4 #include <linux/types.h>
5 #include <asm/compiler.h>
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
11 #define WILDFIRE_NR_IRQS \
12 (WILDFIRE_MAX_QBB * WILDFIRE_PCA_PER_QBB * WILDFIRE_IRQ_PER_PCA)
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
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;
28 #define WILDFIRE_QBB_EXISTS(qbbno) (wildfire_soft_qbb_mask & (1 << (qbbno)))
30 #define WILDFIRE_MEM_EXISTS(qbbno) (wildfire_mem_mask & (0xf << ((qbbno) << 2)))
32 #define WILDFIRE_PCA_EXISTS(qbbno, pcano) \
33 (wildfire_pca_mask & (1 << (((qbbno) << 2) + (pcano))))
35 typedef struct {
36 volatile unsigned long csr __attribute__((aligned(64)));
37 } wildfire_64;
39 typedef struct {
40 volatile unsigned long csr __attribute__((aligned(256)));
41 } wildfire_256;
43 typedef struct {
44 volatile unsigned long csr __attribute__((aligned(2048)));
45 } wildfire_2k;
47 typedef struct {
48 wildfire_64 qsd_whami;
49 wildfire_64 qsd_rev;
50 wildfire_64 qsd_port_present;
51 wildfire_64 qsd_port_active;
52 wildfire_64 qsd_fault_ena;
53 wildfire_64 qsd_cpu_int_ena;
54 wildfire_64 qsd_mem_config;
55 wildfire_64 qsd_err_sum;
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];
62 wildfire_64 scratch[4];
63 wildfire_64 qsd_timer;
64 wildfire_64 qsd_diag;
65 } wildfire_qsd;
67 typedef struct {
68 wildfire_256 qsd_whami;
69 wildfire_256 __pad1;
70 wildfire_256 ce_sum;
71 wildfire_256 dev_init;
72 wildfire_256 it_int;
73 wildfire_256 ip_int;
74 wildfire_256 uce_sum;
75 wildfire_256 se_sum;
76 } wildfire_fast_qsd;
78 typedef struct {
79 wildfire_2k qsa_qbb_id;
80 wildfire_2k __pad1;
81 wildfire_2k qsa_port_ena;
82 wildfire_2k qsa_scratch;
83 wildfire_2k qsa_config[5];
84 wildfire_2k qsa_ref_int;
85 wildfire_2k qsa_qbb_pop[2];
86 wildfire_2k qsa_dtag_fc;
87 wildfire_2k __pad2[3];
88 wildfire_2k qsa_diag;
89 wildfire_2k qsa_diag_lock[4];
90 wildfire_2k __pad3[11];
91 wildfire_2k qsa_cpu_err_sum;
92 wildfire_2k qsa_misc_err_sum;
93 wildfire_2k qsa_tmo_err_sum;
94 wildfire_2k qsa_err_ena;
95 wildfire_2k qsa_tmo_config;
96 wildfire_2k qsa_ill_cmd_err_sum;
97 wildfire_2k __pad4[26];
98 wildfire_2k qsa_busy_mask;
99 wildfire_2k qsa_arr_valid;
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;
106 typedef struct {
107 wildfire_64 ioa_config;
108 wildfire_64 iod_config;
109 wildfire_64 iop_switch_credits;
110 wildfire_64 __pad1;
111 wildfire_64 iop_hose_credits;
112 wildfire_64 __pad2[11];
113 struct {
114 wildfire_64 __pad3;
115 wildfire_64 init;
116 } iop_hose[4];
117 wildfire_64 ioa_hose_0_ctrl;
118 wildfire_64 iod_hose_0_ctrl;
119 wildfire_64 ioa_hose_1_ctrl;
120 wildfire_64 iod_hose_1_ctrl;
121 wildfire_64 ioa_hose_2_ctrl;
122 wildfire_64 iod_hose_2_ctrl;
123 wildfire_64 ioa_hose_3_ctrl;
124 wildfire_64 iod_hose_3_ctrl;
125 struct {
126 wildfire_64 target;
127 wildfire_64 __pad4;
128 } iop_dev_int[4];
130 wildfire_64 iop_err_int_target;
131 wildfire_64 __pad5[7];
132 wildfire_64 iop_qbb_err_sum;
133 wildfire_64 __pad6;
134 wildfire_64 iop_qbb_se_sum;
135 wildfire_64 __pad7;
136 wildfire_64 ioa_err_sum;
137 wildfire_64 iod_err_sum;
138 wildfire_64 __pad8[4];
139 wildfire_64 ioa_diag_force_err;
140 wildfire_64 iod_diag_force_err;
141 wildfire_64 __pad9[4];
142 wildfire_64 iop_diag_send_err_int;
143 wildfire_64 __pad10[15];
144 wildfire_64 ioa_scratch;
145 wildfire_64 iod_scratch;
146 } wildfire_iop;
148 typedef struct {
149 wildfire_2k gpa_qbb_map[4];
150 wildfire_2k gpa_mem_pop_map;
151 wildfire_2k gpa_scratch;
152 wildfire_2k gpa_diag;
153 wildfire_2k gpa_config_0;
154 wildfire_2k __pad1;
155 wildfire_2k gpa_init_id;
156 wildfire_2k gpa_config_2;
157 /* not complete */
158 } wildfire_gp;
160 typedef struct {
161 wildfire_64 pca_what_am_i;
162 wildfire_64 pca_err_sum;
163 wildfire_64 pca_diag_force_err;
164 wildfire_64 pca_diag_send_err_int;
165 wildfire_64 pca_hose_credits;
166 wildfire_64 pca_scratch;
167 wildfire_64 pca_micro_addr;
168 wildfire_64 pca_micro_data;
169 wildfire_64 pca_pend_int;
170 wildfire_64 pca_sent_int;
171 wildfire_64 __pad1;
172 wildfire_64 pca_stdio_edge_level;
173 wildfire_64 __pad2[52];
174 struct {
175 wildfire_64 target;
176 wildfire_64 enable;
177 } pca_int[4];
178 wildfire_64 __pad3[56];
179 wildfire_64 pca_alt_sent_int[32];
180 } wildfire_pca;
182 typedef struct {
183 wildfire_64 ne_what_am_i;
184 /* not complete */
185 } wildfire_ne;
187 typedef struct {
188 wildfire_64 fe_what_am_i;
189 /* not complete */
190 } wildfire_fe;
192 typedef struct {
193 wildfire_64 pci_io_addr_ext;
194 wildfire_64 pci_ctrl;
195 wildfire_64 pci_err_sum;
196 wildfire_64 pci_err_addr;
197 wildfire_64 pci_stall_cnt;
198 wildfire_64 pci_iack_special;
199 wildfire_64 __pad1[2];
200 wildfire_64 pci_pend_int;
201 wildfire_64 pci_sent_int;
202 wildfire_64 __pad2[54];
203 struct {
204 wildfire_64 wbase;
205 wildfire_64 wmask;
206 wildfire_64 tbase;
207 } pci_window[4];
208 wildfire_64 pci_flush_tlb;
209 wildfire_64 pci_perf_mon;
210 } wildfire_pci;
212 #define WILDFIRE_ENTITY_SHIFT 18
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)
220 #define WILDFIRE_PCA_ENTITY(pca) ((0xc|(pca))<<WILDFIRE_ENTITY_SHIFT)
222 #define WILDFIRE_BASE (IDENT_ADDR | (1UL << 40))
224 #define WILDFIRE_QBB_MASK 0x0fUL /* for now, only 4 bits/16 QBBs */
226 #define WILDFIRE_QBB(q) ((~((long)(q)) & WILDFIRE_QBB_MASK) << 36)
227 #define WILDFIRE_HOSE(h) ((long)(h) << 33)
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))
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)
236 #define WILDFIRE_qsd(q) \
237 ((wildfire_qsd *)(WILDFIRE_QBB_IO(q)|WILDFIRE_QSD_ENTITY_SLOW|(((1UL<<13)-1)<<23)))
239 #define WILDFIRE_fast_qsd() \
240 ((wildfire_fast_qsd *)(WILDFIRE_QBB_IO(0)|WILDFIRE_QSD_ENTITY_FAST|(((1UL<<13)-1)<<23)))
242 #define WILDFIRE_qsa(q) \
243 ((wildfire_qsa *)(WILDFIRE_QBB_IO(q)|WILDFIRE_QSA_ENTITY|(((1UL<<13)-1)<<23)))
245 #define WILDFIRE_iop(q) \
246 ((wildfire_iop *)(WILDFIRE_QBB_IO(q)|WILDFIRE_IOP_ENTITY|(((1UL<<13)-1)<<23)))
248 #define WILDFIRE_gp(q) \
249 ((wildfire_gp *)(WILDFIRE_QBB_IO(q)|WILDFIRE_GP_ENTITY|(((1UL<<13)-1)<<23)))
251 #define WILDFIRE_pca(q,pca) \
252 ((wildfire_pca *)(WILDFIRE_QBB_IO(q)|WILDFIRE_PCA_ENTITY(pca)|(((1UL<<13)-1)<<23)))
254 #define WILDFIRE_ne(q,pca) \
255 ((wildfire_ne *)(WILDFIRE_QBB_IO(q)|WILDFIRE_PCA_ENTITY(pca)|(((1UL<<13)-1)<<23)|(1UL<<16)))
257 #define WILDFIRE_fe(q,pca) \
258 ((wildfire_fe *)(WILDFIRE_QBB_IO(q)|WILDFIRE_PCA_ENTITY(pca)|(((1UL<<13)-1)<<23)|(3UL<<15)))
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)))
263 #define WILDFIRE_IO_BIAS WILDFIRE_IO(0,0)
264 #define WILDFIRE_MEM_BIAS WILDFIRE_MEM(0,0) /* ??? */
266 /* The IO address space is larger than 0xffff */
267 #define WILDFIRE_IO_SPACE (8UL*1024*1024)
269 #ifdef __KERNEL__
271 #ifndef __EXTERN_INLINE
272 #define __EXTERN_INLINE extern inline
273 #define __IO_EXTERN_INLINE
274 #endif
277 * Memory functions. all accesses are done through linear space.
280 __EXTERN_INLINE void __iomem *wildfire_ioportmap(unsigned long addr)
282 return (void __iomem *)(addr + WILDFIRE_IO_BIAS);
285 __EXTERN_INLINE void __iomem *wildfire_ioremap(unsigned long addr,
286 unsigned long size)
288 return (void __iomem *)(addr + WILDFIRE_MEM_BIAS);
291 __EXTERN_INLINE int wildfire_is_ioaddr(unsigned long addr)
293 return addr >= WILDFIRE_BASE;
296 __EXTERN_INLINE int wildfire_is_mmio(const volatile void __iomem *xaddr)
298 unsigned long addr = (unsigned long)xaddr;
299 return (addr & 0x100000000UL) == 0;
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>
311 #ifdef __IO_EXTERN_INLINE
312 #undef __EXTERN_INLINE
313 #undef __IO_EXTERN_INLINE
314 #endif
316 #endif /* __KERNEL__ */
318 #endif /* __ALPHA_WILDFIRE__H__ */