1 #ifndef __ALPHA_TITAN__H__
2 #define __ALPHA_TITAN__H__
4 #include <linux/types.h>
6 #include <asm/compiler.h>
9 * TITAN is the internal names for a core logic chipset which provides
10 * memory controller and PCI/AGP access for 21264 based systems.
12 * This file is based on:
14 * Titan Chipset Engineering Specification
20 /* XXX: Do we need to conditionalize on this? */
21 #ifdef USE_48_BIT_KSEG
22 #define TI_BIAS 0x80000000000UL
24 #define TI_BIAS 0x10000000000UL
28 * CChip, DChip, and PChip registers
32 volatile unsigned long csr __attribute__((aligned(64)));
66 titan_64 reserved[17];
87 titan_64 reserved0[2];
100 titan_64 reserved2[2];
102 titan_64 reserved3[3];
115 titan_64 reserved1[6];
119 titan_64 reserved1[31];
123 titan_pachip_port g_port;
124 titan_pachip_port a_port;
127 #define TITAN_cchip ((titan_cchip *)(IDENT_ADDR+TI_BIAS+0x1A0000000UL))
128 #define TITAN_dchip ((titan_dchip *)(IDENT_ADDR+TI_BIAS+0x1B0000800UL))
129 #define TITAN_pachip0 ((titan_pachip *)(IDENT_ADDR+TI_BIAS+0x180000000UL))
130 #define TITAN_pachip1 ((titan_pachip *)(IDENT_ADDR+TI_BIAS+0x380000000UL))
131 extern unsigned TITAN_agp;
132 extern int TITAN_bootcpu;
135 * TITAN PA-chip Window Space Base Address register.
138 #define wsba_m_ena 0x1
139 #define wsba_m_sg 0x2
140 #define wsba_m_addr 0xFFF00000
141 #define wmask_k_sz1gb 0x3FF00000
144 unsigned wsba_v_ena : 1;
145 unsigned wsba_v_sg : 1;
146 unsigned wsba_v_rsvd1 : 18;
147 unsigned wsba_v_addr : 12;
148 unsigned wsba_v_rsvd2 : 32;
150 int wsba_q_whole [2];
154 * TITAN PA-chip Control Register
155 * This definition covers both the G-Port GPCTL and the A-PORT APCTL.
156 * Bits <51:0> are the same in both cases. APCTL<63:52> are only
159 #define pctl_m_fbtb 0x00000001
160 #define pctl_m_thdis 0x00000002
161 #define pctl_m_chaindis 0x00000004
162 #define pctl_m_tgtlat 0x00000018
163 #define pctl_m_hole 0x00000020
164 #define pctl_m_mwin 0x00000040
165 #define pctl_m_arbena 0x00000080
166 #define pctl_m_prigrp 0x0000FF00
167 #define pctl_m_ppri 0x00010000
168 #define pctl_m_pcispd66 0x00020000
169 #define pctl_m_cngstlt 0x003C0000
170 #define pctl_m_ptpdesten 0x3FC00000
171 #define pctl_m_dpcen 0x40000000
172 #define pctl_m_apcen 0x0000000080000000UL
173 #define pctl_m_dcrtv 0x0000000300000000UL
174 #define pctl_m_en_stepping 0x0000000400000000UL
175 #define apctl_m_rsvd1 0x000FFFF800000000UL
176 #define apctl_m_agp_rate 0x0030000000000000UL
177 #define apctl_m_agp_sba_en 0x0040000000000000UL
178 #define apctl_m_agp_en 0x0080000000000000UL
179 #define apctl_m_rsvd2 0x0100000000000000UL
180 #define apctl_m_agp_present 0x0200000000000000UL
181 #define apctl_agp_hp_rd 0x1C00000000000000UL
182 #define apctl_agp_lp_rd 0xE000000000000000UL
183 #define gpctl_m_rsvd 0xFFFFFFF800000000UL
186 unsigned pctl_v_fbtb : 1; /* A/G [0] */
187 unsigned pctl_v_thdis : 1; /* A/G [1] */
188 unsigned pctl_v_chaindis : 1; /* A/G [2] */
189 unsigned pctl_v_tgtlat : 2; /* A/G [4:3] */
190 unsigned pctl_v_hole : 1; /* A/G [5] */
191 unsigned pctl_v_mwin : 1; /* A/G [6] */
192 unsigned pctl_v_arbena : 1; /* A/G [7] */
193 unsigned pctl_v_prigrp : 8; /* A/G [15:8] */
194 unsigned pctl_v_ppri : 1; /* A/G [16] */
195 unsigned pctl_v_pcispd66 : 1; /* A/G [17] */
196 unsigned pctl_v_cngstlt : 4; /* A/G [21:18] */
197 unsigned pctl_v_ptpdesten : 8; /* A/G [29:22] */
198 unsigned pctl_v_dpcen : 1; /* A/G [30] */
199 unsigned pctl_v_apcen : 1; /* A/G [31] */
200 unsigned pctl_v_dcrtv : 2; /* A/G [33:32] */
201 unsigned pctl_v_en_stepping :1; /* A/G [34] */
202 unsigned apctl_v_rsvd1 : 17; /* A [51:35] */
203 unsigned apctl_v_agp_rate : 2; /* A [53:52] */
204 unsigned apctl_v_agp_sba_en : 1; /* A [54] */
205 unsigned apctl_v_agp_en : 1; /* A [55] */
206 unsigned apctl_v_rsvd2 : 1; /* A [56] */
207 unsigned apctl_v_agp_present : 1; /* A [57] */
208 unsigned apctl_v_agp_hp_rd : 3; /* A [60:58] */
209 unsigned apctl_v_agp_lp_rd : 3; /* A [63:61] */
211 unsigned int pctl_l_whole [2];
212 unsigned long pctl_q_whole;
216 * SERROR / SERREN / SERRSET
220 unsigned serr_v_lost_uecc : 1; /* [0] */
221 unsigned serr_v_uecc : 1; /* [1] */
222 unsigned serr_v_cre : 1; /* [2] */
223 unsigned serr_v_nxio : 1; /* [3] */
224 unsigned serr_v_lost_cre : 1; /* [4] */
225 unsigned serr_v_rsvd0 : 10; /* [14:5] */
226 unsigned serr_v_addr : 32; /* [46:15] */
227 unsigned serr_v_rsvd1 : 5; /* [51:47] */
228 unsigned serr_v_source : 2; /* [53:52] */
229 unsigned serr_v_cmd : 2; /* [55:54] */
230 unsigned serr_v_syn : 8; /* [63:56] */
232 unsigned int serr_l_whole[2];
233 unsigned long serr_q_whole;
237 * GPERROR / APERROR / GPERREN / APERREN / GPERRSET / APERRSET
241 unsigned long perr_v_lost : 1; /* [0] */
242 unsigned long perr_v_serr : 1; /* [1] */
243 unsigned long perr_v_perr : 1; /* [2] */
244 unsigned long perr_v_dcrto : 1; /* [3] */
245 unsigned long perr_v_sge : 1; /* [4] */
246 unsigned long perr_v_ape : 1; /* [5] */
247 unsigned long perr_v_ta : 1; /* [6] */
248 unsigned long perr_v_dpe : 1; /* [7] */
249 unsigned long perr_v_nds : 1; /* [8] */
250 unsigned long perr_v_iptpr : 1; /* [9] */
251 unsigned long perr_v_iptpw : 1; /* [10] */
252 unsigned long perr_v_rsvd0 : 3; /* [13:11] */
253 unsigned long perr_v_addr : 33; /* [46:14] */
254 unsigned long perr_v_dac : 1; /* [47] */
255 unsigned long perr_v_mwin : 1; /* [48] */
256 unsigned long perr_v_rsvd1 : 3; /* [51:49] */
257 unsigned long perr_v_cmd : 4; /* [55:52] */
258 unsigned long perr_v_rsvd2 : 8; /* [63:56] */
260 unsigned int perr_l_whole[2];
261 unsigned long perr_q_whole;
265 * AGPERROR / AGPERREN / AGPERRSET
267 union TPAchipAGPERR {
269 unsigned agperr_v_lost : 1; /* [0] */
270 unsigned agperr_v_lpqfull : 1; /* [1] */
271 unsigned apgerr_v_hpqfull : 1; /* [2] */
272 unsigned agperr_v_rescmd : 1; /* [3] */
273 unsigned agperr_v_ipte : 1; /* [4] */
274 unsigned agperr_v_ptp : 1; /* [5] */
275 unsigned agperr_v_nowindow : 1; /* [6] */
276 unsigned agperr_v_rsvd0 : 8; /* [14:7] */
277 unsigned agperr_v_addr : 32; /* [46:15] */
278 unsigned agperr_v_rsvd1 : 1; /* [47] */
279 unsigned agperr_v_dac : 1; /* [48] */
280 unsigned agperr_v_mwin : 1; /* [49] */
281 unsigned agperr_v_cmd : 3; /* [52:50] */
282 unsigned agperr_v_length : 6; /* [58:53] */
283 unsigned agperr_v_fence : 1; /* [59] */
284 unsigned agperr_v_rsvd2 : 4; /* [63:60] */
286 unsigned int agperr_l_whole[2];
287 unsigned long agperr_q_whole;
291 * Hose numbers are assigned as follows:
292 * 0 - pachip 0 / G Port
293 * 1 - pachip 1 / G Port
294 * 2 - pachip 0 / A Port
295 * 3 - pachip 1 / A Port
297 #define TITAN_HOSE_SHIFT (33)
298 #define TITAN_HOSE(h) (((unsigned long)(h)) << TITAN_HOSE_SHIFT)
299 #define TITAN_BASE (IDENT_ADDR + TI_BIAS)
300 #define TITAN_MEM(h) (TITAN_BASE+TITAN_HOSE(h)+0x000000000UL)
301 #define _TITAN_IACK_SC(h) (TITAN_BASE+TITAN_HOSE(h)+0x1F8000000UL)
302 #define TITAN_IO(h) (TITAN_BASE+TITAN_HOSE(h)+0x1FC000000UL)
303 #define TITAN_CONF(h) (TITAN_BASE+TITAN_HOSE(h)+0x1FE000000UL)
305 #define TITAN_HOSE_MASK TITAN_HOSE(3)
306 #define TITAN_IACK_SC _TITAN_IACK_SC(0) /* hack! */
309 * The canonical non-remaped I/O and MEM addresses have these values
310 * subtracted out. This is arranged so that folks manipulating ISA
311 * devices can use their familiar numbers and have them map to bus 0.
314 #define TITAN_IO_BIAS TITAN_IO(0)
315 #define TITAN_MEM_BIAS TITAN_MEM(0)
317 /* The IO address space is larger than 0xffff */
318 #define TITAN_IO_SPACE (TITAN_CONF(0) - TITAN_IO(0))
321 #define TITAN_TIG_SPACE (TITAN_BASE + 0x100000000UL)
323 /* Offset between ram physical addresses and pci64 DAC bus addresses. */
324 /* ??? Just a guess. Ought to confirm it hasn't been moved. */
325 #define TITAN_DAC_OFFSET (1UL << 40)
328 * Data structure for handling TITAN machine checks:
330 #define SCB_Q_SYSERR 0x620
331 #define SCB_Q_PROCERR 0x630
332 #define SCB_Q_SYSMCHK 0x660
333 #define SCB_Q_PROCMCHK 0x670
334 #define SCB_Q_SYSEVENT 0x680 /* environmental / system management */
335 struct el_TITAN_sysdata_mcheck {
336 u64 summary; /* 0x00 */
337 u64 c_dirx; /* 0x08 */
338 u64 c_misc; /* 0x10 */
339 u64 p0_serror; /* 0x18 */
340 u64 p0_gperror; /* 0x20 */
341 u64 p0_aperror; /* 0x28 */
342 u64 p0_agperror;/* 0x30 */
343 u64 p1_serror; /* 0x38 */
344 u64 p1_gperror; /* 0x40 */
345 u64 p1_aperror; /* 0x48 */
346 u64 p1_agperror;/* 0x50 */
350 * System area for a privateer 680 environmental/system management mcheck
352 struct el_PRIVATEER_envdata_mcheck {
353 u64 summary; /* 0x00 */
354 u64 c_dirx; /* 0x08 */
356 u64 cpuir; /* 0x18 */
358 u64 fault; /* 0x28 */
359 u64 sys_doors; /* 0x30 */
360 u64 temp_warn; /* 0x38 */
361 u64 fan_ctrl; /* 0x40 */
363 u64 reserved; /* 0x50 */
368 #ifndef __EXTERN_INLINE
369 #define __EXTERN_INLINE extern inline
370 #define __IO_EXTERN_INLINE
376 * TITAN, a 21??? PCI/memory support chipset for the EV6 (21264)
377 * can only use linear accesses to get at PCI/AGP memory and I/O spaces.
380 #define vucp volatile unsigned char *
381 #define vusp volatile unsigned short *
382 #define vuip volatile unsigned int *
383 #define vulp volatile unsigned long *
385 __EXTERN_INLINE u8 titan_inb(unsigned long addr)
387 /* ??? I wish I could get rid of this. But there's no ioremap
388 equivalent for I/O space. PCI I/O can be forced into the
389 correct hose's I/O region, but that doesn't take care of
392 addr += TITAN_IO_BIAS;
393 return __kernel_ldbu(*(vucp)addr);
396 __EXTERN_INLINE void titan_outb(u8 b, unsigned long addr)
398 addr += TITAN_IO_BIAS;
399 __kernel_stb(b, *(vucp)addr);
403 __EXTERN_INLINE u16 titan_inw(unsigned long addr)
405 addr += TITAN_IO_BIAS;
406 return __kernel_ldwu(*(vusp)addr);
409 __EXTERN_INLINE void titan_outw(u16 b, unsigned long addr)
411 addr += TITAN_IO_BIAS;
412 __kernel_stw(b, *(vusp)addr);
416 __EXTERN_INLINE u32 titan_inl(unsigned long addr)
418 addr += TITAN_IO_BIAS;
422 __EXTERN_INLINE void titan_outl(u32 b, unsigned long addr)
424 addr += TITAN_IO_BIAS;
430 * Memory functions. all accesses are done through linear space.
433 extern unsigned long titan_ioremap(unsigned long addr, unsigned long size);
434 extern void titan_iounmap(unsigned long addr);
436 __EXTERN_INLINE int titan_is_ioaddr(unsigned long addr)
438 return addr >= TITAN_BASE;
441 __EXTERN_INLINE u8 titan_readb(unsigned long addr)
443 return __kernel_ldbu(*(vucp)addr);
446 __EXTERN_INLINE u16 titan_readw(unsigned long addr)
448 return __kernel_ldwu(*(vusp)addr);
451 __EXTERN_INLINE u32 titan_readl(unsigned long addr)
453 return (*(vuip)addr) & 0xffffffff;
456 __EXTERN_INLINE u64 titan_readq(unsigned long addr)
461 __EXTERN_INLINE void titan_writeb(u8 b, unsigned long addr)
463 __kernel_stb(b, *(vucp)addr);
466 __EXTERN_INLINE void titan_writew(u16 b, unsigned long addr)
468 __kernel_stw(b, *(vusp)addr);
471 __EXTERN_INLINE void titan_writel(u32 b, unsigned long addr)
476 __EXTERN_INLINE void titan_writeq(u64 b, unsigned long addr)
488 #define __inb(p) titan_inb((unsigned long)(p))
489 #define __inw(p) titan_inw((unsigned long)(p))
490 #define __inl(p) titan_inl((unsigned long)(p))
491 #define __outb(x,p) titan_outb((x),(unsigned long)(p))
492 #define __outw(x,p) titan_outw((x),(unsigned long)(p))
493 #define __outl(x,p) titan_outl((x),(unsigned long)(p))
494 #define __readb(a) titan_readb((unsigned long)(a))
495 #define __readw(a) titan_readw((unsigned long)(a))
496 #define __readl(a) titan_readl((unsigned long)(a))
497 #define __readq(a) titan_readq((unsigned long)(a))
498 #define __writeb(x,a) titan_writeb((x),(unsigned long)(a))
499 #define __writew(x,a) titan_writew((x),(unsigned long)(a))
500 #define __writel(x,a) titan_writel((x),(unsigned long)(a))
501 #define __writeq(x,a) titan_writeq((x),(unsigned long)(a))
502 #define __ioremap(a,s) titan_ioremap((unsigned long)(a),(s))
503 #define __iounmap(a) titan_iounmap((unsigned long)(a))
504 #define __is_ioaddr(a) titan_is_ioaddr((unsigned long)(a))
506 #define inb(port) __inb((port))
507 #define inw(port) __inw((port))
508 #define inl(port) __inl((port))
509 #define outb(v, port) __outb((v),(port))
510 #define outw(v, port) __outw((v),(port))
511 #define outl(v, port) __outl((v),(port))
513 #define __raw_readb(a) __readb((unsigned long)(a))
514 #define __raw_readw(a) __readw((unsigned long)(a))
515 #define __raw_readl(a) __readl((unsigned long)(a))
516 #define __raw_readq(a) __readq((unsigned long)(a))
517 #define __raw_writeb(v,a) __writeb((v),(unsigned long)(a))
518 #define __raw_writew(v,a) __writew((v),(unsigned long)(a))
519 #define __raw_writel(v,a) __writel((v),(unsigned long)(a))
520 #define __raw_writeq(v,a) __writeq((v),(unsigned long)(a))
522 #endif /* __WANT_IO_DEF */
524 #ifdef __IO_EXTERN_INLINE
525 #undef __EXTERN_INLINE
526 #undef __IO_EXTERN_INLINE
529 #endif /* __KERNEL__ */
531 #endif /* __ALPHA_TITAN__H__ */