blob: 12af803d445a00444f7af2f85606a13f5f3e3d84 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#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
14extern unsigned char wildfire_hard_qbb_map[WILDFIRE_MAX_QBB];
15extern unsigned char wildfire_soft_qbb_map[WILDFIRE_MAX_QBB];
16#define QBB_MAP_EMPTY 0xff
17
18extern unsigned long wildfire_hard_qbb_mask;
19extern unsigned long wildfire_soft_qbb_mask;
20extern unsigned long wildfire_gp_mask;
21extern unsigned long wildfire_hs_mask;
22extern unsigned long wildfire_iop_mask;
23extern unsigned long wildfire_ior_mask;
24extern unsigned long wildfire_pca_mask;
25extern unsigned long wildfire_cpu_mask;
26extern 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
35typedef struct {
36 volatile unsigned long csr __attribute__((aligned(64)));
37} wildfire_64;
38
39typedef struct {
40 volatile unsigned long csr __attribute__((aligned(256)));
41} wildfire_256;
42
43typedef struct {
44 volatile unsigned long csr __attribute__((aligned(2048)));
45} wildfire_2k;
46
47typedef 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;
66
67typedef 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;
77
78typedef 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;
105
106typedef 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];
129
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;
147
148typedef 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;
159
160typedef 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;
181
182typedef struct {
183 wildfire_64 ne_what_am_i;
184 /* not complete */
185} wildfire_ne;
186
187typedef struct {
188 wildfire_64 fe_what_am_i;
189 /* not complete */
190} wildfire_fe;
191
192typedef 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;
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)addr;
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__ */