0001
0002 #ifndef __ALPHA_APECS__H__
0003 #define __ALPHA_APECS__H__
0004
0005 #include <linux/types.h>
0006 #include <asm/compiler.h>
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078 #define APECS_IOC_DCSR (IDENT_ADDR + 0x1A0000000UL)
0079 #define APECS_IOC_PEAR (IDENT_ADDR + 0x1A0000020UL)
0080 #define APECS_IOC_SEAR (IDENT_ADDR + 0x1A0000040UL)
0081 #define APECS_IOC_DR1 (IDENT_ADDR + 0x1A0000060UL)
0082 #define APECS_IOC_DR2 (IDENT_ADDR + 0x1A0000080UL)
0083 #define APECS_IOC_DR3 (IDENT_ADDR + 0x1A00000A0UL)
0084
0085 #define APECS_IOC_TB1R (IDENT_ADDR + 0x1A00000C0UL)
0086 #define APECS_IOC_TB2R (IDENT_ADDR + 0x1A00000E0UL)
0087
0088 #define APECS_IOC_PB1R (IDENT_ADDR + 0x1A0000100UL)
0089 #define APECS_IOC_PB2R (IDENT_ADDR + 0x1A0000120UL)
0090
0091 #define APECS_IOC_PM1R (IDENT_ADDR + 0x1A0000140UL)
0092 #define APECS_IOC_PM2R (IDENT_ADDR + 0x1A0000160UL)
0093
0094 #define APECS_IOC_HAXR0 (IDENT_ADDR + 0x1A0000180UL)
0095 #define APECS_IOC_HAXR1 (IDENT_ADDR + 0x1A00001A0UL)
0096 #define APECS_IOC_HAXR2 (IDENT_ADDR + 0x1A00001C0UL)
0097
0098 #define APECS_IOC_PMLT (IDENT_ADDR + 0x1A00001E0UL)
0099
0100 #define APECS_IOC_TLBTAG0 (IDENT_ADDR + 0x1A0000200UL)
0101 #define APECS_IOC_TLBTAG1 (IDENT_ADDR + 0x1A0000220UL)
0102 #define APECS_IOC_TLBTAG2 (IDENT_ADDR + 0x1A0000240UL)
0103 #define APECS_IOC_TLBTAG3 (IDENT_ADDR + 0x1A0000260UL)
0104 #define APECS_IOC_TLBTAG4 (IDENT_ADDR + 0x1A0000280UL)
0105 #define APECS_IOC_TLBTAG5 (IDENT_ADDR + 0x1A00002A0UL)
0106 #define APECS_IOC_TLBTAG6 (IDENT_ADDR + 0x1A00002C0UL)
0107 #define APECS_IOC_TLBTAG7 (IDENT_ADDR + 0x1A00002E0UL)
0108
0109 #define APECS_IOC_TLBDATA0 (IDENT_ADDR + 0x1A0000300UL)
0110 #define APECS_IOC_TLBDATA1 (IDENT_ADDR + 0x1A0000320UL)
0111 #define APECS_IOC_TLBDATA2 (IDENT_ADDR + 0x1A0000340UL)
0112 #define APECS_IOC_TLBDATA3 (IDENT_ADDR + 0x1A0000360UL)
0113 #define APECS_IOC_TLBDATA4 (IDENT_ADDR + 0x1A0000380UL)
0114 #define APECS_IOC_TLBDATA5 (IDENT_ADDR + 0x1A00003A0UL)
0115 #define APECS_IOC_TLBDATA6 (IDENT_ADDR + 0x1A00003C0UL)
0116 #define APECS_IOC_TLBDATA7 (IDENT_ADDR + 0x1A00003E0UL)
0117
0118 #define APECS_IOC_TBIA (IDENT_ADDR + 0x1A0000400UL)
0119
0120
0121
0122
0123
0124
0125
0126 #define APECS_MEM_GCR (IDENT_ADDR + 0x180000000UL)
0127 #define APECS_MEM_EDSR (IDENT_ADDR + 0x180000040UL)
0128 #define APECS_MEM_TAR (IDENT_ADDR + 0x180000060UL)
0129 #define APECS_MEM_ELAR (IDENT_ADDR + 0x180000080UL)
0130 #define APECS_MEM_EHAR (IDENT_ADDR + 0x1800000a0UL)
0131 #define APECS_MEM_SFT_RST (IDENT_ADDR + 0x1800000c0UL)
0132 #define APECS_MEM_LDxLAR (IDENT_ADDR + 0x1800000e0UL)
0133 #define APECS_MEM_LDxHAR (IDENT_ADDR + 0x180000100UL)
0134 #define APECS_MEM_GTR (IDENT_ADDR + 0x180000200UL)
0135 #define APECS_MEM_RTR (IDENT_ADDR + 0x180000220UL)
0136 #define APECS_MEM_VFPR (IDENT_ADDR + 0x180000240UL)
0137 #define APECS_MEM_PDLDR (IDENT_ADDR + 0x180000260UL)
0138 #define APECS_MEM_PDhDR (IDENT_ADDR + 0x180000280UL)
0139
0140
0141 #define APECS_MEM_B0BAR (IDENT_ADDR + 0x180000800UL)
0142 #define APECS_MEM_B1BAR (IDENT_ADDR + 0x180000820UL)
0143 #define APECS_MEM_B2BAR (IDENT_ADDR + 0x180000840UL)
0144 #define APECS_MEM_B3BAR (IDENT_ADDR + 0x180000860UL)
0145 #define APECS_MEM_B4BAR (IDENT_ADDR + 0x180000880UL)
0146 #define APECS_MEM_B5BAR (IDENT_ADDR + 0x1800008A0UL)
0147 #define APECS_MEM_B6BAR (IDENT_ADDR + 0x1800008C0UL)
0148 #define APECS_MEM_B7BAR (IDENT_ADDR + 0x1800008E0UL)
0149 #define APECS_MEM_B8BAR (IDENT_ADDR + 0x180000900UL)
0150
0151
0152 #define APECS_MEM_B0BCR (IDENT_ADDR + 0x180000A00UL)
0153 #define APECS_MEM_B1BCR (IDENT_ADDR + 0x180000A20UL)
0154 #define APECS_MEM_B2BCR (IDENT_ADDR + 0x180000A40UL)
0155 #define APECS_MEM_B3BCR (IDENT_ADDR + 0x180000A60UL)
0156 #define APECS_MEM_B4BCR (IDENT_ADDR + 0x180000A80UL)
0157 #define APECS_MEM_B5BCR (IDENT_ADDR + 0x180000AA0UL)
0158 #define APECS_MEM_B6BCR (IDENT_ADDR + 0x180000AC0UL)
0159 #define APECS_MEM_B7BCR (IDENT_ADDR + 0x180000AE0UL)
0160 #define APECS_MEM_B8BCR (IDENT_ADDR + 0x180000B00UL)
0161
0162
0163 #define APECS_MEM_B0TRA (IDENT_ADDR + 0x180000C00UL)
0164 #define APECS_MEM_B1TRA (IDENT_ADDR + 0x180000C20UL)
0165 #define APECS_MEM_B2TRA (IDENT_ADDR + 0x180000C40UL)
0166 #define APECS_MEM_B3TRA (IDENT_ADDR + 0x180000C60UL)
0167 #define APECS_MEM_B4TRA (IDENT_ADDR + 0x180000C80UL)
0168 #define APECS_MEM_B5TRA (IDENT_ADDR + 0x180000CA0UL)
0169 #define APECS_MEM_B6TRA (IDENT_ADDR + 0x180000CC0UL)
0170 #define APECS_MEM_B7TRA (IDENT_ADDR + 0x180000CE0UL)
0171 #define APECS_MEM_B8TRA (IDENT_ADDR + 0x180000D00UL)
0172
0173
0174 #define APECS_MEM_B0TRB (IDENT_ADDR + 0x180000E00UL)
0175 #define APECS_MEM_B1TRB (IDENT_ADDR + 0x180000E20UL)
0176 #define APECS_MEM_B2TRB (IDENT_ADDR + 0x180000E40UL)
0177 #define APECS_MEM_B3TRB (IDENT_ADDR + 0x180000E60UL)
0178 #define APECS_MEM_B4TRB (IDENT_ADDR + 0x180000E80UL)
0179 #define APECS_MEM_B5TRB (IDENT_ADDR + 0x180000EA0UL)
0180 #define APECS_MEM_B6TRB (IDENT_ADDR + 0x180000EC0UL)
0181 #define APECS_MEM_B7TRB (IDENT_ADDR + 0x180000EE0UL)
0182 #define APECS_MEM_B8TRB (IDENT_ADDR + 0x180000F00UL)
0183
0184
0185
0186
0187
0188 #define APECS_IACK_SC (IDENT_ADDR + 0x1b0000000UL)
0189 #define APECS_CONF (IDENT_ADDR + 0x1e0000000UL)
0190 #define APECS_IO (IDENT_ADDR + 0x1c0000000UL)
0191 #define APECS_SPARSE_MEM (IDENT_ADDR + 0x200000000UL)
0192 #define APECS_DENSE_MEM (IDENT_ADDR + 0x300000000UL)
0193
0194
0195
0196
0197
0198 #define APECS_IOC_STAT0_CMD 0xf
0199 #define APECS_IOC_STAT0_ERR (1<<4)
0200 #define APECS_IOC_STAT0_LOST (1<<5)
0201 #define APECS_IOC_STAT0_THIT (1<<6)
0202 #define APECS_IOC_STAT0_TREF (1<<7)
0203 #define APECS_IOC_STAT0_CODE_SHIFT 8
0204 #define APECS_IOC_STAT0_CODE_MASK 0x7
0205 #define APECS_IOC_STAT0_P_NBR_SHIFT 13
0206 #define APECS_IOC_STAT0_P_NBR_MASK 0x7ffff
0207
0208 #define APECS_HAE_ADDRESS APECS_IOC_HAXR1
0209
0210
0211
0212
0213
0214
0215 struct el_apecs_mikasa_sysdata_mcheck
0216 {
0217 unsigned long coma_gcr;
0218 unsigned long coma_edsr;
0219 unsigned long coma_ter;
0220 unsigned long coma_elar;
0221 unsigned long coma_ehar;
0222 unsigned long coma_ldlr;
0223 unsigned long coma_ldhr;
0224 unsigned long coma_base0;
0225 unsigned long coma_base1;
0226 unsigned long coma_base2;
0227 unsigned long coma_base3;
0228 unsigned long coma_cnfg0;
0229 unsigned long coma_cnfg1;
0230 unsigned long coma_cnfg2;
0231 unsigned long coma_cnfg3;
0232 unsigned long epic_dcsr;
0233 unsigned long epic_pear;
0234 unsigned long epic_sear;
0235 unsigned long epic_tbr1;
0236 unsigned long epic_tbr2;
0237 unsigned long epic_pbr1;
0238 unsigned long epic_pbr2;
0239 unsigned long epic_pmr1;
0240 unsigned long epic_pmr2;
0241 unsigned long epic_harx1;
0242 unsigned long epic_harx2;
0243 unsigned long epic_pmlt;
0244 unsigned long epic_tag0;
0245 unsigned long epic_tag1;
0246 unsigned long epic_tag2;
0247 unsigned long epic_tag3;
0248 unsigned long epic_tag4;
0249 unsigned long epic_tag5;
0250 unsigned long epic_tag6;
0251 unsigned long epic_tag7;
0252 unsigned long epic_data0;
0253 unsigned long epic_data1;
0254 unsigned long epic_data2;
0255 unsigned long epic_data3;
0256 unsigned long epic_data4;
0257 unsigned long epic_data5;
0258 unsigned long epic_data6;
0259 unsigned long epic_data7;
0260
0261 unsigned long pceb_vid;
0262 unsigned long pceb_did;
0263 unsigned long pceb_revision;
0264 unsigned long pceb_command;
0265 unsigned long pceb_status;
0266 unsigned long pceb_latency;
0267 unsigned long pceb_control;
0268 unsigned long pceb_arbcon;
0269 unsigned long pceb_arbpri;
0270
0271 unsigned long esc_id;
0272 unsigned long esc_revision;
0273 unsigned long esc_int0;
0274 unsigned long esc_int1;
0275 unsigned long esc_elcr0;
0276 unsigned long esc_elcr1;
0277 unsigned long esc_last_eisa;
0278 unsigned long esc_nmi_stat;
0279
0280 unsigned long pci_ir;
0281 unsigned long pci_imr;
0282 unsigned long svr_mgr;
0283 };
0284
0285
0286 struct el_apecs_sysdata_mcheck
0287 {
0288 unsigned long coma_gcr;
0289 unsigned long coma_edsr;
0290 unsigned long coma_ter;
0291 unsigned long coma_elar;
0292 unsigned long coma_ehar;
0293 unsigned long coma_ldlr;
0294 unsigned long coma_ldhr;
0295 unsigned long coma_base0;
0296 unsigned long coma_base1;
0297 unsigned long coma_base2;
0298 unsigned long coma_cnfg0;
0299 unsigned long coma_cnfg1;
0300 unsigned long coma_cnfg2;
0301 unsigned long epic_dcsr;
0302 unsigned long epic_pear;
0303 unsigned long epic_sear;
0304 unsigned long epic_tbr1;
0305 unsigned long epic_tbr2;
0306 unsigned long epic_pbr1;
0307 unsigned long epic_pbr2;
0308 unsigned long epic_pmr1;
0309 unsigned long epic_pmr2;
0310 unsigned long epic_harx1;
0311 unsigned long epic_harx2;
0312 unsigned long epic_pmlt;
0313 unsigned long epic_tag0;
0314 unsigned long epic_tag1;
0315 unsigned long epic_tag2;
0316 unsigned long epic_tag3;
0317 unsigned long epic_tag4;
0318 unsigned long epic_tag5;
0319 unsigned long epic_tag6;
0320 unsigned long epic_tag7;
0321 unsigned long epic_data0;
0322 unsigned long epic_data1;
0323 unsigned long epic_data2;
0324 unsigned long epic_data3;
0325 unsigned long epic_data4;
0326 unsigned long epic_data5;
0327 unsigned long epic_data6;
0328 unsigned long epic_data7;
0329 };
0330
0331 struct el_apecs_procdata
0332 {
0333 unsigned long paltemp[32];
0334
0335 unsigned long exc_addr;
0336 unsigned long exc_sum;
0337 unsigned long exc_mask;
0338 unsigned long iccsr;
0339 unsigned long pal_base;
0340 unsigned long hier;
0341 unsigned long hirr;
0342 unsigned long csr;
0343 unsigned long dc_stat;
0344 unsigned long dc_addr;
0345 unsigned long abox_ctl;
0346 unsigned long biu_stat;
0347 unsigned long biu_addr;
0348 unsigned long biu_ctl;
0349 unsigned long fill_syndrome;
0350 unsigned long fill_addr;
0351 unsigned long va;
0352 unsigned long bc_tag;
0353 };
0354
0355
0356 #ifdef __KERNEL__
0357
0358 #ifndef __EXTERN_INLINE
0359 #define __EXTERN_INLINE extern inline
0360 #define __IO_EXTERN_INLINE
0361 #endif
0362
0363
0364
0365
0366
0367
0368
0369
0370
0371
0372
0373
0374 #define vip volatile int __force *
0375 #define vuip volatile unsigned int __force *
0376 #define vulp volatile unsigned long __force *
0377
0378 #define APECS_SET_HAE \
0379 do { \
0380 if (addr >= (1UL << 24)) { \
0381 unsigned long msb = addr & 0xf8000000; \
0382 addr -= msb; \
0383 set_hae(msb); \
0384 } \
0385 } while (0)
0386
0387 __EXTERN_INLINE unsigned int apecs_ioread8(const void __iomem *xaddr)
0388 {
0389 unsigned long addr = (unsigned long) xaddr;
0390 unsigned long result, base_and_type;
0391
0392 if (addr >= APECS_DENSE_MEM) {
0393 addr -= APECS_DENSE_MEM;
0394 APECS_SET_HAE;
0395 base_and_type = APECS_SPARSE_MEM + 0x00;
0396 } else {
0397 addr -= APECS_IO;
0398 base_and_type = APECS_IO + 0x00;
0399 }
0400
0401 result = *(vip) ((addr << 5) + base_and_type);
0402 return __kernel_extbl(result, addr & 3);
0403 }
0404
0405 __EXTERN_INLINE void apecs_iowrite8(u8 b, void __iomem *xaddr)
0406 {
0407 unsigned long addr = (unsigned long) xaddr;
0408 unsigned long w, base_and_type;
0409
0410 if (addr >= APECS_DENSE_MEM) {
0411 addr -= APECS_DENSE_MEM;
0412 APECS_SET_HAE;
0413 base_and_type = APECS_SPARSE_MEM + 0x00;
0414 } else {
0415 addr -= APECS_IO;
0416 base_and_type = APECS_IO + 0x00;
0417 }
0418
0419 w = __kernel_insbl(b, addr & 3);
0420 *(vuip) ((addr << 5) + base_and_type) = w;
0421 }
0422
0423 __EXTERN_INLINE unsigned int apecs_ioread16(const void __iomem *xaddr)
0424 {
0425 unsigned long addr = (unsigned long) xaddr;
0426 unsigned long result, base_and_type;
0427
0428 if (addr >= APECS_DENSE_MEM) {
0429 addr -= APECS_DENSE_MEM;
0430 APECS_SET_HAE;
0431 base_and_type = APECS_SPARSE_MEM + 0x08;
0432 } else {
0433 addr -= APECS_IO;
0434 base_and_type = APECS_IO + 0x08;
0435 }
0436
0437 result = *(vip) ((addr << 5) + base_and_type);
0438 return __kernel_extwl(result, addr & 3);
0439 }
0440
0441 __EXTERN_INLINE void apecs_iowrite16(u16 b, void __iomem *xaddr)
0442 {
0443 unsigned long addr = (unsigned long) xaddr;
0444 unsigned long w, base_and_type;
0445
0446 if (addr >= APECS_DENSE_MEM) {
0447 addr -= APECS_DENSE_MEM;
0448 APECS_SET_HAE;
0449 base_and_type = APECS_SPARSE_MEM + 0x08;
0450 } else {
0451 addr -= APECS_IO;
0452 base_and_type = APECS_IO + 0x08;
0453 }
0454
0455 w = __kernel_inswl(b, addr & 3);
0456 *(vuip) ((addr << 5) + base_and_type) = w;
0457 }
0458
0459 __EXTERN_INLINE unsigned int apecs_ioread32(const void __iomem *xaddr)
0460 {
0461 unsigned long addr = (unsigned long) xaddr;
0462 if (addr < APECS_DENSE_MEM)
0463 addr = ((addr - APECS_IO) << 5) + APECS_IO + 0x18;
0464 return *(vuip)addr;
0465 }
0466
0467 __EXTERN_INLINE void apecs_iowrite32(u32 b, void __iomem *xaddr)
0468 {
0469 unsigned long addr = (unsigned long) xaddr;
0470 if (addr < APECS_DENSE_MEM)
0471 addr = ((addr - APECS_IO) << 5) + APECS_IO + 0x18;
0472 *(vuip)addr = b;
0473 }
0474
0475 __EXTERN_INLINE void __iomem *apecs_ioportmap(unsigned long addr)
0476 {
0477 return (void __iomem *)(addr + APECS_IO);
0478 }
0479
0480 __EXTERN_INLINE void __iomem *apecs_ioremap(unsigned long addr,
0481 unsigned long size)
0482 {
0483 return (void __iomem *)(addr + APECS_DENSE_MEM);
0484 }
0485
0486 __EXTERN_INLINE int apecs_is_ioaddr(unsigned long addr)
0487 {
0488 return addr >= IDENT_ADDR + 0x180000000UL;
0489 }
0490
0491 __EXTERN_INLINE int apecs_is_mmio(const volatile void __iomem *addr)
0492 {
0493 return (unsigned long)addr >= APECS_DENSE_MEM;
0494 }
0495
0496 #undef APECS_SET_HAE
0497
0498 #undef vip
0499 #undef vuip
0500 #undef vulp
0501
0502 #undef __IO_PREFIX
0503 #define __IO_PREFIX apecs
0504 #define apecs_trivial_io_bw 0
0505 #define apecs_trivial_io_lq 0
0506 #define apecs_trivial_rw_bw 2
0507 #define apecs_trivial_rw_lq 1
0508 #define apecs_trivial_iounmap 1
0509 #include <asm/io_trivial.h>
0510
0511 #ifdef __IO_EXTERN_INLINE
0512 #undef __EXTERN_INLINE
0513 #undef __IO_EXTERN_INLINE
0514 #endif
0515
0516 #endif
0517
0518 #endif