core_tsunami.h 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. #ifndef __ALPHA_TSUNAMI__H__
  2. #define __ALPHA_TSUNAMI__H__
  3. #include <linux/types.h>
  4. #include <asm/compiler.h>
  5. /*
  6. * TSUNAMI/TYPHOON are the internal names for the core logic chipset which
  7. * provides memory controller and PCI access for the 21264 based systems.
  8. *
  9. * This file is based on:
  10. *
  11. * Tsunami System Programmers Manual
  12. * Preliminary, Chapters 2-5
  13. *
  14. */
  15. /* XXX: Do we need to conditionalize on this? */
  16. #ifdef USE_48_BIT_KSEG
  17. #define TS_BIAS 0x80000000000UL
  18. #else
  19. #define TS_BIAS 0x10000000000UL
  20. #endif
  21. /*
  22. * CChip, DChip, and PChip registers
  23. */
  24. typedef struct {
  25. volatile unsigned long csr __attribute__((aligned(64)));
  26. } tsunami_64;
  27. typedef struct {
  28. tsunami_64 csc;
  29. tsunami_64 mtr;
  30. tsunami_64 misc;
  31. tsunami_64 mpd;
  32. tsunami_64 aar0;
  33. tsunami_64 aar1;
  34. tsunami_64 aar2;
  35. tsunami_64 aar3;
  36. tsunami_64 dim0;
  37. tsunami_64 dim1;
  38. tsunami_64 dir0;
  39. tsunami_64 dir1;
  40. tsunami_64 drir;
  41. tsunami_64 prben;
  42. tsunami_64 iic; /* a.k.a. iic0 */
  43. tsunami_64 wdr; /* a.k.a. iic1 */
  44. tsunami_64 mpr0;
  45. tsunami_64 mpr1;
  46. tsunami_64 mpr2;
  47. tsunami_64 mpr3;
  48. tsunami_64 mctl;
  49. tsunami_64 __pad1;
  50. tsunami_64 ttr;
  51. tsunami_64 tdr;
  52. tsunami_64 dim2;
  53. tsunami_64 dim3;
  54. tsunami_64 dir2;
  55. tsunami_64 dir3;
  56. tsunami_64 iic2;
  57. tsunami_64 iic3;
  58. } tsunami_cchip;
  59. typedef struct {
  60. tsunami_64 dsc;
  61. tsunami_64 str;
  62. tsunami_64 drev;
  63. } tsunami_dchip;
  64. typedef struct {
  65. tsunami_64 wsba[4];
  66. tsunami_64 wsm[4];
  67. tsunami_64 tba[4];
  68. tsunami_64 pctl;
  69. tsunami_64 plat;
  70. tsunami_64 reserved;
  71. tsunami_64 perror;
  72. tsunami_64 perrmask;
  73. tsunami_64 perrset;
  74. tsunami_64 tlbiv;
  75. tsunami_64 tlbia;
  76. tsunami_64 pmonctl;
  77. tsunami_64 pmoncnt;
  78. } tsunami_pchip;
  79. #define TSUNAMI_cchip ((tsunami_cchip *)(IDENT_ADDR+TS_BIAS+0x1A0000000UL))
  80. #define TSUNAMI_dchip ((tsunami_dchip *)(IDENT_ADDR+TS_BIAS+0x1B0000800UL))
  81. #define TSUNAMI_pchip0 ((tsunami_pchip *)(IDENT_ADDR+TS_BIAS+0x180000000UL))
  82. #define TSUNAMI_pchip1 ((tsunami_pchip *)(IDENT_ADDR+TS_BIAS+0x380000000UL))
  83. extern int TSUNAMI_bootcpu;
  84. /*
  85. * TSUNAMI Pchip Error register.
  86. */
  87. #define perror_m_lost 0x1
  88. #define perror_m_serr 0x2
  89. #define perror_m_perr 0x4
  90. #define perror_m_dcrto 0x8
  91. #define perror_m_sge 0x10
  92. #define perror_m_ape 0x20
  93. #define perror_m_ta 0x40
  94. #define perror_m_rdpe 0x80
  95. #define perror_m_nds 0x100
  96. #define perror_m_rto 0x200
  97. #define perror_m_uecc 0x400
  98. #define perror_m_cre 0x800
  99. #define perror_m_addrl 0xFFFFFFFF0000UL
  100. #define perror_m_addrh 0x7000000000000UL
  101. #define perror_m_cmd 0xF0000000000000UL
  102. #define perror_m_syn 0xFF00000000000000UL
  103. union TPchipPERROR {
  104. struct {
  105. unsigned int perror_v_lost : 1;
  106. unsigned perror_v_serr : 1;
  107. unsigned perror_v_perr : 1;
  108. unsigned perror_v_dcrto : 1;
  109. unsigned perror_v_sge : 1;
  110. unsigned perror_v_ape : 1;
  111. unsigned perror_v_ta : 1;
  112. unsigned perror_v_rdpe : 1;
  113. unsigned perror_v_nds : 1;
  114. unsigned perror_v_rto : 1;
  115. unsigned perror_v_uecc : 1;
  116. unsigned perror_v_cre : 1;
  117. unsigned perror_v_rsvd1 : 4;
  118. unsigned perror_v_addrl : 32;
  119. unsigned perror_v_addrh : 3;
  120. unsigned perror_v_rsvd2 : 1;
  121. unsigned perror_v_cmd : 4;
  122. unsigned perror_v_syn : 8;
  123. } perror_r_bits;
  124. int perror_q_whole [2];
  125. };
  126. /*
  127. * TSUNAMI Pchip Window Space Base Address register.
  128. */
  129. #define wsba_m_ena 0x1
  130. #define wsba_m_sg 0x2
  131. #define wsba_m_ptp 0x4
  132. #define wsba_m_addr 0xFFF00000
  133. #define wmask_k_sz1gb 0x3FF00000
  134. union TPchipWSBA {
  135. struct {
  136. unsigned wsba_v_ena : 1;
  137. unsigned wsba_v_sg : 1;
  138. unsigned wsba_v_ptp : 1;
  139. unsigned wsba_v_rsvd1 : 17;
  140. unsigned wsba_v_addr : 12;
  141. unsigned wsba_v_rsvd2 : 32;
  142. } wsba_r_bits;
  143. int wsba_q_whole [2];
  144. };
  145. /*
  146. * TSUNAMI Pchip Control Register
  147. */
  148. #define pctl_m_fdsc 0x1
  149. #define pctl_m_fbtb 0x2
  150. #define pctl_m_thdis 0x4
  151. #define pctl_m_chaindis 0x8
  152. #define pctl_m_tgtlat 0x10
  153. #define pctl_m_hole 0x20
  154. #define pctl_m_mwin 0x40
  155. #define pctl_m_arbena 0x80
  156. #define pctl_m_prigrp 0x7F00
  157. #define pctl_m_ppri 0x8000
  158. #define pctl_m_rsvd1 0x30000
  159. #define pctl_m_eccen 0x40000
  160. #define pctl_m_padm 0x80000
  161. #define pctl_m_cdqmax 0xF00000
  162. #define pctl_m_rev 0xFF000000
  163. #define pctl_m_crqmax 0xF00000000UL
  164. #define pctl_m_ptpmax 0xF000000000UL
  165. #define pctl_m_pclkx 0x30000000000UL
  166. #define pctl_m_fdsdis 0x40000000000UL
  167. #define pctl_m_fdwdis 0x80000000000UL
  168. #define pctl_m_ptevrfy 0x100000000000UL
  169. #define pctl_m_rpp 0x200000000000UL
  170. #define pctl_m_pid 0xC00000000000UL
  171. #define pctl_m_rsvd2 0xFFFF000000000000UL
  172. union TPchipPCTL {
  173. struct {
  174. unsigned pctl_v_fdsc : 1;
  175. unsigned pctl_v_fbtb : 1;
  176. unsigned pctl_v_thdis : 1;
  177. unsigned pctl_v_chaindis : 1;
  178. unsigned pctl_v_tgtlat : 1;
  179. unsigned pctl_v_hole : 1;
  180. unsigned pctl_v_mwin : 1;
  181. unsigned pctl_v_arbena : 1;
  182. unsigned pctl_v_prigrp : 7;
  183. unsigned pctl_v_ppri : 1;
  184. unsigned pctl_v_rsvd1 : 2;
  185. unsigned pctl_v_eccen : 1;
  186. unsigned pctl_v_padm : 1;
  187. unsigned pctl_v_cdqmax : 4;
  188. unsigned pctl_v_rev : 8;
  189. unsigned pctl_v_crqmax : 4;
  190. unsigned pctl_v_ptpmax : 4;
  191. unsigned pctl_v_pclkx : 2;
  192. unsigned pctl_v_fdsdis : 1;
  193. unsigned pctl_v_fdwdis : 1;
  194. unsigned pctl_v_ptevrfy : 1;
  195. unsigned pctl_v_rpp : 1;
  196. unsigned pctl_v_pid : 2;
  197. unsigned pctl_v_rsvd2 : 16;
  198. } pctl_r_bits;
  199. int pctl_q_whole [2];
  200. };
  201. /*
  202. * TSUNAMI Pchip Error Mask Register.
  203. */
  204. #define perrmask_m_lost 0x1
  205. #define perrmask_m_serr 0x2
  206. #define perrmask_m_perr 0x4
  207. #define perrmask_m_dcrto 0x8
  208. #define perrmask_m_sge 0x10
  209. #define perrmask_m_ape 0x20
  210. #define perrmask_m_ta 0x40
  211. #define perrmask_m_rdpe 0x80
  212. #define perrmask_m_nds 0x100
  213. #define perrmask_m_rto 0x200
  214. #define perrmask_m_uecc 0x400
  215. #define perrmask_m_cre 0x800
  216. #define perrmask_m_rsvd 0xFFFFFFFFFFFFF000UL
  217. union TPchipPERRMASK {
  218. struct {
  219. unsigned int perrmask_v_lost : 1;
  220. unsigned perrmask_v_serr : 1;
  221. unsigned perrmask_v_perr : 1;
  222. unsigned perrmask_v_dcrto : 1;
  223. unsigned perrmask_v_sge : 1;
  224. unsigned perrmask_v_ape : 1;
  225. unsigned perrmask_v_ta : 1;
  226. unsigned perrmask_v_rdpe : 1;
  227. unsigned perrmask_v_nds : 1;
  228. unsigned perrmask_v_rto : 1;
  229. unsigned perrmask_v_uecc : 1;
  230. unsigned perrmask_v_cre : 1;
  231. unsigned perrmask_v_rsvd1 : 20;
  232. unsigned perrmask_v_rsvd2 : 32;
  233. } perrmask_r_bits;
  234. int perrmask_q_whole [2];
  235. };
  236. /*
  237. * Memory spaces:
  238. */
  239. #define TSUNAMI_HOSE(h) (((unsigned long)(h)) << 33)
  240. #define TSUNAMI_BASE (IDENT_ADDR + TS_BIAS)
  241. #define TSUNAMI_MEM(h) (TSUNAMI_BASE+TSUNAMI_HOSE(h) + 0x000000000UL)
  242. #define _TSUNAMI_IACK_SC(h) (TSUNAMI_BASE+TSUNAMI_HOSE(h) + 0x1F8000000UL)
  243. #define TSUNAMI_IO(h) (TSUNAMI_BASE+TSUNAMI_HOSE(h) + 0x1FC000000UL)
  244. #define TSUNAMI_CONF(h) (TSUNAMI_BASE+TSUNAMI_HOSE(h) + 0x1FE000000UL)
  245. #define TSUNAMI_IACK_SC _TSUNAMI_IACK_SC(0) /* hack! */
  246. /*
  247. * The canonical non-remaped I/O and MEM addresses have these values
  248. * subtracted out. This is arranged so that folks manipulating ISA
  249. * devices can use their familiar numbers and have them map to bus 0.
  250. */
  251. #define TSUNAMI_IO_BIAS TSUNAMI_IO(0)
  252. #define TSUNAMI_MEM_BIAS TSUNAMI_MEM(0)
  253. /* The IO address space is larger than 0xffff */
  254. #define TSUNAMI_IO_SPACE (TSUNAMI_CONF(0) - TSUNAMI_IO(0))
  255. /* Offset between ram physical addresses and pci64 DAC bus addresses. */
  256. #define TSUNAMI_DAC_OFFSET (1UL << 40)
  257. /*
  258. * Data structure for handling TSUNAMI machine checks:
  259. */
  260. struct el_TSUNAMI_sysdata_mcheck {
  261. };
  262. #ifdef __KERNEL__
  263. #ifndef __EXTERN_INLINE
  264. #define __EXTERN_INLINE extern inline
  265. #define __IO_EXTERN_INLINE
  266. #endif
  267. /*
  268. * I/O functions:
  269. *
  270. * TSUNAMI, the 21??? PCI/memory support chipset for the EV6 (21264)
  271. * can only use linear accesses to get at PCI memory and I/O spaces.
  272. */
  273. /*
  274. * Memory functions. all accesses are done through linear space.
  275. */
  276. extern void __iomem *tsunami_ioportmap(unsigned long addr);
  277. extern void __iomem *tsunami_ioremap(unsigned long addr, unsigned long size);
  278. __EXTERN_INLINE int tsunami_is_ioaddr(unsigned long addr)
  279. {
  280. return addr >= TSUNAMI_BASE;
  281. }
  282. __EXTERN_INLINE int tsunami_is_mmio(const volatile void __iomem *xaddr)
  283. {
  284. unsigned long addr = (unsigned long) xaddr;
  285. return (addr & 0x100000000UL) == 0;
  286. }
  287. #undef __IO_PREFIX
  288. #define __IO_PREFIX tsunami
  289. #define tsunami_trivial_rw_bw 1
  290. #define tsunami_trivial_rw_lq 1
  291. #define tsunami_trivial_io_bw 1
  292. #define tsunami_trivial_io_lq 1
  293. #define tsunami_trivial_iounmap 1
  294. #include <asm/io_trivial.h>
  295. #ifdef __IO_EXTERN_INLINE
  296. #undef __EXTERN_INLINE
  297. #undef __IO_EXTERN_INLINE
  298. #endif
  299. #endif /* __KERNEL__ */
  300. #endif /* __ALPHA_TSUNAMI__H__ */