1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef __ALPHA_WILDFIRE__H__ 3 #define __ALPHA_WILDFIRE__H__ 4 5 #include <linux/types.h> 6 #include <asm/compiler.h> 7 8 #define WILDFIRE_MAX_QBB 8 /* more than 8 requires other mods */ 9 #define WILDFIRE_PCA_PER_QBB 4 10 #define WILDFIRE_IRQ_PER_PCA 64 11 12 #define WILDFIRE_NR_IRQS \ 13 (WILDFIRE_MAX_QBB * WILDFIRE_PCA_PER_QBB * WILDFIRE_IRQ_PER_PCA) 14 15 extern unsigned char wildfire_hard_qbb_map[WILDFIRE_MAX_QBB]; 16 extern unsigned char wildfire_soft_qbb_map[WILDFIRE_MAX_QBB]; 17 #define QBB_MAP_EMPTY 0xff 18 19 extern unsigned long wildfire_hard_qbb_mask; 20 extern unsigned long wildfire_soft_qbb_mask; 21 extern unsigned long wildfire_gp_mask; 22 extern unsigned long wildfire_hs_mask; 23 extern unsigned long wildfire_iop_mask; 24 extern unsigned long wildfire_ior_mask; 25 extern unsigned long wildfire_pca_mask; 26 extern unsigned long wildfire_cpu_mask; 27 extern unsigned long wildfire_mem_mask; 28 29 #define WILDFIRE_QBB_EXISTS(qbbno) (wildfire_soft_qbb_mask & (1 << (qbbno))) 30 31 #define WILDFIRE_MEM_EXISTS(qbbno) (wildfire_mem_mask & (0xf << ((qbbno) << 2))) 32 33 #define WILDFIRE_PCA_EXISTS(qbbno, pcano) \ 34 (wildfire_pca_mask & (1 << (((qbbno) << 2) + (pcano)))) 35 36 typedef struct { 37 volatile unsigned long csr __attribute__((aligned(64))); 38 } wildfire_64; 39 40 typedef struct { 41 volatile unsigned long csr __attribute__((aligned(256))); 42 } wildfire_256; 43 44 typedef struct { 45 volatile unsigned long csr __attribute__((aligned(2048))); 46 } wildfire_2k; 47 48 typedef struct { 49 wildfire_64 qsd_whami; 50 wildfire_64 qsd_rev; 51 wildfire_64 qsd_port_present; 52 wildfire_64 qsd_port_active; 53 wildfire_64 qsd_fault_ena; 54 wildfire_64 qsd_cpu_int_ena; 55 wildfire_64 qsd_mem_config; 56 wildfire_64 qsd_err_sum; 57 wildfire_64 ce_sum[4]; 58 wildfire_64 dev_init[4]; 59 wildfire_64 it_int[4]; 60 wildfire_64 ip_int[4]; 61 wildfire_64 uce_sum[4]; 62 wildfire_64 se_sum__non_dev_int[4]; 63 wildfire_64 scratch[4]; 64 wildfire_64 qsd_timer; 65 wildfire_64 qsd_diag; 66 } wildfire_qsd; 67 68 typedef struct { 69 wildfire_256 qsd_whami; 70 wildfire_256 __pad1; 71 wildfire_256 ce_sum; 72 wildfire_256 dev_init; 73 wildfire_256 it_int; 74 wildfire_256 ip_int; 75 wildfire_256 uce_sum; 76 wildfire_256 se_sum; 77 } wildfire_fast_qsd; 78 79 typedef struct { 80 wildfire_2k qsa_qbb_id; 81 wildfire_2k __pad1; 82 wildfire_2k qsa_port_ena; 83 wildfire_2k qsa_scratch; 84 wildfire_2k qsa_config[5]; 85 wildfire_2k qsa_ref_int; 86 wildfire_2k qsa_qbb_pop[2]; 87 wildfire_2k qsa_dtag_fc; 88 wildfire_2k __pad2[3]; 89 wildfire_2k qsa_diag; 90 wildfire_2k qsa_diag_lock[4]; 91 wildfire_2k __pad3[11]; 92 wildfire_2k qsa_cpu_err_sum; 93 wildfire_2k qsa_misc_err_sum; 94 wildfire_2k qsa_tmo_err_sum; 95 wildfire_2k qsa_err_ena; 96 wildfire_2k qsa_tmo_config; 97 wildfire_2k qsa_ill_cmd_err_sum; 98 wildfire_2k __pad4[26]; 99 wildfire_2k qsa_busy_mask; 100 wildfire_2k qsa_arr_valid; 101 wildfire_2k __pad5[2]; 102 wildfire_2k qsa_port_map[4]; 103 wildfire_2k qsa_arr_addr[8]; 104 wildfire_2k qsa_arr_mask[8]; 105 } wildfire_qsa; 106 107 typedef struct { 108 wildfire_64 ioa_config; 109 wildfire_64 iod_config; 110 wildfire_64 iop_switch_credits; 111 wildfire_64 __pad1; 112 wildfire_64 iop_hose_credits; 113 wildfire_64 __pad2[11]; 114 struct { 115 wildfire_64 __pad3; 116 wildfire_64 init; 117 } iop_hose[4]; 118 wildfire_64 ioa_hose_0_ctrl; 119 wildfire_64 iod_hose_0_ctrl; 120 wildfire_64 ioa_hose_1_ctrl; 121 wildfire_64 iod_hose_1_ctrl; 122 wildfire_64 ioa_hose_2_ctrl; 123 wildfire_64 iod_hose_2_ctrl; 124 wildfire_64 ioa_hose_3_ctrl; 125 wildfire_64 iod_hose_3_ctrl; 126 struct { 127 wildfire_64 target; 128 wildfire_64 __pad4; 129 } iop_dev_int[4]; 130 131 wildfire_64 iop_err_int_target; 132 wildfire_64 __pad5[7]; 133 wildfire_64 iop_qbb_err_sum; 134 wildfire_64 __pad6; 135 wildfire_64 iop_qbb_se_sum; 136 wildfire_64 __pad7; 137 wildfire_64 ioa_err_sum; 138 wildfire_64 iod_err_sum; 139 wildfire_64 __pad8[4]; 140 wildfire_64 ioa_diag_force_err; 141 wildfire_64 iod_diag_force_err; 142 wildfire_64 __pad9[4]; 143 wildfire_64 iop_diag_send_err_int; 144 wildfire_64 __pad10[15]; 145 wildfire_64 ioa_scratch; 146 wildfire_64 iod_scratch; 147 } wildfire_iop; 148 149 typedef struct { 150 wildfire_2k gpa_qbb_map[4]; 151 wildfire_2k gpa_mem_pop_map; 152 wildfire_2k gpa_scratch; 153 wildfire_2k gpa_diag; 154 wildfire_2k gpa_config_0; 155 wildfire_2k __pad1; 156 wildfire_2k gpa_init_id; 157 wildfire_2k gpa_config_2; 158 /* not complete */ 159 } wildfire_gp; 160 161 typedef struct { 162 wildfire_64 pca_what_am_i; 163 wildfire_64 pca_err_sum; 164 wildfire_64 pca_diag_force_err; 165 wildfire_64 pca_diag_send_err_int; 166 wildfire_64 pca_hose_credits; 167 wildfire_64 pca_scratch; 168 wildfire_64 pca_micro_addr; 169 wildfire_64 pca_micro_data; 170 wildfire_64 pca_pend_int; 171 wildfire_64 pca_sent_int; 172 wildfire_64 __pad1; 173 wildfire_64 pca_stdio_edge_level; 174 wildfire_64 __pad2[52]; 175 struct { 176 wildfire_64 target; 177 wildfire_64 enable; 178 } pca_int[4]; 179 wildfire_64 __pad3[56]; 180 wildfire_64 pca_alt_sent_int[32]; 181 } wildfire_pca; 182 183 typedef struct { 184 wildfire_64 ne_what_am_i; 185 /* not complete */ 186 } wildfire_ne; 187 188 typedef struct { 189 wildfire_64 fe_what_am_i; 190 /* not complete */ 191 } wildfire_fe; 192 193 typedef struct { 194 wildfire_64 pci_io_addr_ext; 195 wildfire_64 pci_ctrl; 196 wildfire_64 pci_err_sum; 197 wildfire_64 pci_err_addr; 198 wildfire_64 pci_stall_cnt; 199 wildfire_64 pci_iack_special; 200 wildfire_64 __pad1[2]; 201 wildfire_64 pci_pend_int; 202 wildfire_64 pci_sent_int; 203 wildfire_64 __pad2[54]; 204 struct { 205 wildfire_64 wbase; 206 wildfire_64 wmask; 207 wildfire_64 tbase; 208 } pci_window[4]; 209 wildfire_64 pci_flush_tlb; 210 wildfire_64 pci_perf_mon; 211 } wildfire_pci; 212 213 #define WILDFIRE_ENTITY_SHIFT 18 214 215 #define WILDFIRE_GP_ENTITY (0x10UL << WILDFIRE_ENTITY_SHIFT) 216 #define WILDFIRE_IOP_ENTITY (0x08UL << WILDFIRE_ENTITY_SHIFT) 217 #define WILDFIRE_QSA_ENTITY (0x04UL << WILDFIRE_ENTITY_SHIFT) 218 #define WILDFIRE_QSD_ENTITY_SLOW (0x05UL << WILDFIRE_ENTITY_SHIFT) 219 #define WILDFIRE_QSD_ENTITY_FAST (0x01UL << WILDFIRE_ENTITY_SHIFT) 220 221 #define WILDFIRE_PCA_ENTITY(pca) ((0xc|(pca))<<WILDFIRE_ENTITY_SHIFT) 222 223 #define WILDFIRE_BASE (IDENT_ADDR | (1UL << 40)) 224 225 #define WILDFIRE_QBB_MASK 0x0fUL /* for now, only 4 bits/16 QBBs */ 226 227 #define WILDFIRE_QBB(q) ((~((long)(q)) & WILDFIRE_QBB_MASK) << 36) 228 #define WILDFIRE_HOSE(h) ((long)(h) << 33) 229 230 #define WILDFIRE_QBB_IO(q) (WILDFIRE_BASE | WILDFIRE_QBB(q)) 231 #define WILDFIRE_QBB_HOSE(q,h) (WILDFIRE_QBB_IO(q) | WILDFIRE_HOSE(h)) 232 233 #define WILDFIRE_MEM(q,h) (WILDFIRE_QBB_HOSE(q,h) | 0x000000000UL) 234 #define WILDFIRE_CONF(q,h) (WILDFIRE_QBB_HOSE(q,h) | 0x1FE000000UL) 235 #define WILDFIRE_IO(q,h) (WILDFIRE_QBB_HOSE(q,h) | 0x1FF000000UL) 236 237 #define WILDFIRE_qsd(q) \ 238 ((wildfire_qsd *)(WILDFIRE_QBB_IO(q)|WILDFIRE_QSD_ENTITY_SLOW|(((1UL<<13)-1)<<23))) 239 240 #define WILDFIRE_fast_qsd() \ 241 ((wildfire_fast_qsd *)(WILDFIRE_QBB_IO(0)|WILDFIRE_QSD_ENTITY_FAST|(((1UL<<13)-1)<<23))) 242 243 #define WILDFIRE_qsa(q) \ 244 ((wildfire_qsa *)(WILDFIRE_QBB_IO(q)|WILDFIRE_QSA_ENTITY|(((1UL<<13)-1)<<23))) 245 246 #define WILDFIRE_iop(q) \ 247 ((wildfire_iop *)(WILDFIRE_QBB_IO(q)|WILDFIRE_IOP_ENTITY|(((1UL<<13)-1)<<23))) 248 249 #define WILDFIRE_gp(q) \ 250 ((wildfire_gp *)(WILDFIRE_QBB_IO(q)|WILDFIRE_GP_ENTITY|(((1UL<<13)-1)<<23))) 251 252 #define WILDFIRE_pca(q,pca) \ 253 ((wildfire_pca *)(WILDFIRE_QBB_IO(q)|WILDFIRE_PCA_ENTITY(pca)|(((1UL<<13)-1)<<23))) 254 255 #define WILDFIRE_ne(q,pca) \ 256 ((wildfire_ne *)(WILDFIRE_QBB_IO(q)|WILDFIRE_PCA_ENTITY(pca)|(((1UL<<13)-1)<<23)|(1UL<<16))) 257 258 #define WILDFIRE_fe(q,pca) \ 259 ((wildfire_fe *)(WILDFIRE_QBB_IO(q)|WILDFIRE_PCA_ENTITY(pca)|(((1UL<<13)-1)<<23)|(3UL<<15))) 260 261 #define WILDFIRE_pci(q,h) \ 262 ((wildfire_pci *)(WILDFIRE_QBB_IO(q)|WILDFIRE_PCA_ENTITY(((h)&6)>>1)|((((h)&1)|2)<<16)|(((1UL<<13)-1)<<23))) 263 264 #define WILDFIRE_IO_BIAS WILDFIRE_IO(0,0) 265 #define WILDFIRE_MEM_BIAS WILDFIRE_MEM(0,0) /* ??? */ 266 267 /* The IO address space is larger than 0xffff */ 268 #define WILDFIRE_IO_SPACE (8UL*1024*1024) 269 270 #ifdef __KERNEL__ 271 272 #ifndef __EXTERN_INLINE 273 #define __EXTERN_INLINE extern inline 274 #define __IO_EXTERN_INLINE 275 #endif 276 277 /* 278 * Memory functions. all accesses are done through linear space. 279 */ 280 281 __EXTERN_INLINE void __iomem *wildfire_ioportmap(unsigned long addr) 282 { 283 return (void __iomem *)(addr + WILDFIRE_IO_BIAS); 284 } 285 286 __EXTERN_INLINE void __iomem *wildfire_ioremap(unsigned long addr, 287 unsigned long size) 288 { 289 return (void __iomem *)(addr + WILDFIRE_MEM_BIAS); 290 } 291 292 __EXTERN_INLINE int wildfire_is_ioaddr(unsigned long addr) 293 { 294 return addr >= WILDFIRE_BASE; 295 } 296 297 __EXTERN_INLINE int wildfire_is_mmio(const volatile void __iomem *xaddr) 298 { 299 unsigned long addr = (unsigned long)xaddr; 300 return (addr & 0x100000000UL) == 0; 301 } 302 303 #undef __IO_PREFIX 304 #define __IO_PREFIX wildfire 305 #define wildfire_trivial_rw_bw 1 306 #define wildfire_trivial_rw_lq 1 307 #define wildfire_trivial_io_bw 1 308 #define wildfire_trivial_io_lq 1 309 #define wildfire_trivial_iounmap 1 310 #include <asm/io_trivial.h> 311 312 #ifdef __IO_EXTERN_INLINE 313 #undef __EXTERN_INLINE 314 #undef __IO_EXTERN_INLINE 315 #endif 316 317 #endif /* __KERNEL__ */ 318 319 #endif /* __ALPHA_WILDFIRE__H__ */ 320
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.