core_titan.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. #ifndef __ALPHA_TITAN__H__
  2. #define __ALPHA_TITAN__H__
  3. #include <linux/types.h>
  4. #include <asm/compiler.h>
  5. /*
  6. * TITAN is the internal names for a core logic chipset which provides
  7. * memory controller and PCI/AGP access for 21264 based systems.
  8. *
  9. * This file is based on:
  10. *
  11. * Titan Chipset Engineering Specification
  12. * Revision 0.12
  13. * 13 July 1999
  14. *
  15. */
  16. /* XXX: Do we need to conditionalize on this? */
  17. #ifdef USE_48_BIT_KSEG
  18. #define TI_BIAS 0x80000000000UL
  19. #else
  20. #define TI_BIAS 0x10000000000UL
  21. #endif
  22. /*
  23. * CChip, DChip, and PChip registers
  24. */
  25. typedef struct {
  26. volatile unsigned long csr __attribute__((aligned(64)));
  27. } titan_64;
  28. typedef struct {
  29. titan_64 csc;
  30. titan_64 mtr;
  31. titan_64 misc;
  32. titan_64 mpd;
  33. titan_64 aar0;
  34. titan_64 aar1;
  35. titan_64 aar2;
  36. titan_64 aar3;
  37. titan_64 dim0;
  38. titan_64 dim1;
  39. titan_64 dir0;
  40. titan_64 dir1;
  41. titan_64 drir;
  42. titan_64 prben;
  43. titan_64 iic0;
  44. titan_64 iic1;
  45. titan_64 mpr0;
  46. titan_64 mpr1;
  47. titan_64 mpr2;
  48. titan_64 mpr3;
  49. titan_64 rsvd[2];
  50. titan_64 ttr;
  51. titan_64 tdr;
  52. titan_64 dim2;
  53. titan_64 dim3;
  54. titan_64 dir2;
  55. titan_64 dir3;
  56. titan_64 iic2;
  57. titan_64 iic3;
  58. titan_64 pwr;
  59. titan_64 reserved[17];
  60. titan_64 cmonctla;
  61. titan_64 cmonctlb;
  62. titan_64 cmoncnt01;
  63. titan_64 cmoncnt23;
  64. titan_64 cpen;
  65. } titan_cchip;
  66. typedef struct {
  67. titan_64 dsc;
  68. titan_64 str;
  69. titan_64 drev;
  70. titan_64 dsc2;
  71. } titan_dchip;
  72. typedef struct {
  73. titan_64 wsba[4];
  74. titan_64 wsm[4];
  75. titan_64 tba[4];
  76. titan_64 pctl;
  77. titan_64 plat;
  78. titan_64 reserved0[2];
  79. union {
  80. struct {
  81. titan_64 serror;
  82. titan_64 serren;
  83. titan_64 serrset;
  84. titan_64 reserved0;
  85. titan_64 gperror;
  86. titan_64 gperren;
  87. titan_64 gperrset;
  88. titan_64 reserved1;
  89. titan_64 gtlbiv;
  90. titan_64 gtlbia;
  91. titan_64 reserved2[2];
  92. titan_64 sctl;
  93. titan_64 reserved3[3];
  94. } g;
  95. struct {
  96. titan_64 agperror;
  97. titan_64 agperren;
  98. titan_64 agperrset;
  99. titan_64 agplastwr;
  100. titan_64 aperror;
  101. titan_64 aperren;
  102. titan_64 aperrset;
  103. titan_64 reserved0;
  104. titan_64 atlbiv;
  105. titan_64 atlbia;
  106. titan_64 reserved1[6];
  107. } a;
  108. } port_specific;
  109. titan_64 sprst;
  110. titan_64 reserved1[31];
  111. } titan_pachip_port;
  112. typedef struct {
  113. titan_pachip_port g_port;
  114. titan_pachip_port a_port;
  115. } titan_pachip;
  116. #define TITAN_cchip ((titan_cchip *)(IDENT_ADDR+TI_BIAS+0x1A0000000UL))
  117. #define TITAN_dchip ((titan_dchip *)(IDENT_ADDR+TI_BIAS+0x1B0000800UL))
  118. #define TITAN_pachip0 ((titan_pachip *)(IDENT_ADDR+TI_BIAS+0x180000000UL))
  119. #define TITAN_pachip1 ((titan_pachip *)(IDENT_ADDR+TI_BIAS+0x380000000UL))
  120. extern unsigned TITAN_agp;
  121. extern int TITAN_bootcpu;
  122. /*
  123. * TITAN PA-chip Window Space Base Address register.
  124. * (WSBA[0-2])
  125. */
  126. #define wsba_m_ena 0x1
  127. #define wsba_m_sg 0x2
  128. #define wsba_m_addr 0xFFF00000
  129. #define wmask_k_sz1gb 0x3FF00000
  130. union TPAchipWSBA {
  131. struct {
  132. unsigned wsba_v_ena : 1;
  133. unsigned wsba_v_sg : 1;
  134. unsigned wsba_v_rsvd1 : 18;
  135. unsigned wsba_v_addr : 12;
  136. unsigned wsba_v_rsvd2 : 32;
  137. } wsba_r_bits;
  138. int wsba_q_whole [2];
  139. };
  140. /*
  141. * TITAN PA-chip Control Register
  142. * This definition covers both the G-Port GPCTL and the A-PORT APCTL.
  143. * Bits <51:0> are the same in both cases. APCTL<63:52> are only
  144. * applicable to AGP.
  145. */
  146. #define pctl_m_fbtb 0x00000001
  147. #define pctl_m_thdis 0x00000002
  148. #define pctl_m_chaindis 0x00000004
  149. #define pctl_m_tgtlat 0x00000018
  150. #define pctl_m_hole 0x00000020
  151. #define pctl_m_mwin 0x00000040
  152. #define pctl_m_arbena 0x00000080
  153. #define pctl_m_prigrp 0x0000FF00
  154. #define pctl_m_ppri 0x00010000
  155. #define pctl_m_pcispd66 0x00020000
  156. #define pctl_m_cngstlt 0x003C0000
  157. #define pctl_m_ptpdesten 0x3FC00000
  158. #define pctl_m_dpcen 0x40000000
  159. #define pctl_m_apcen 0x0000000080000000UL
  160. #define pctl_m_dcrtv 0x0000000300000000UL
  161. #define pctl_m_en_stepping 0x0000000400000000UL
  162. #define apctl_m_rsvd1 0x000FFFF800000000UL
  163. #define apctl_m_agp_rate 0x0030000000000000UL
  164. #define apctl_m_agp_sba_en 0x0040000000000000UL
  165. #define apctl_m_agp_en 0x0080000000000000UL
  166. #define apctl_m_rsvd2 0x0100000000000000UL
  167. #define apctl_m_agp_present 0x0200000000000000UL
  168. #define apctl_agp_hp_rd 0x1C00000000000000UL
  169. #define apctl_agp_lp_rd 0xE000000000000000UL
  170. #define gpctl_m_rsvd 0xFFFFFFF800000000UL
  171. union TPAchipPCTL {
  172. struct {
  173. unsigned pctl_v_fbtb : 1; /* A/G [0] */
  174. unsigned pctl_v_thdis : 1; /* A/G [1] */
  175. unsigned pctl_v_chaindis : 1; /* A/G [2] */
  176. unsigned pctl_v_tgtlat : 2; /* A/G [4:3] */
  177. unsigned pctl_v_hole : 1; /* A/G [5] */
  178. unsigned pctl_v_mwin : 1; /* A/G [6] */
  179. unsigned pctl_v_arbena : 1; /* A/G [7] */
  180. unsigned pctl_v_prigrp : 8; /* A/G [15:8] */
  181. unsigned pctl_v_ppri : 1; /* A/G [16] */
  182. unsigned pctl_v_pcispd66 : 1; /* A/G [17] */
  183. unsigned pctl_v_cngstlt : 4; /* A/G [21:18] */
  184. unsigned pctl_v_ptpdesten : 8; /* A/G [29:22] */
  185. unsigned pctl_v_dpcen : 1; /* A/G [30] */
  186. unsigned pctl_v_apcen : 1; /* A/G [31] */
  187. unsigned pctl_v_dcrtv : 2; /* A/G [33:32] */
  188. unsigned pctl_v_en_stepping :1; /* A/G [34] */
  189. unsigned apctl_v_rsvd1 : 17; /* A [51:35] */
  190. unsigned apctl_v_agp_rate : 2; /* A [53:52] */
  191. unsigned apctl_v_agp_sba_en : 1; /* A [54] */
  192. unsigned apctl_v_agp_en : 1; /* A [55] */
  193. unsigned apctl_v_rsvd2 : 1; /* A [56] */
  194. unsigned apctl_v_agp_present : 1; /* A [57] */
  195. unsigned apctl_v_agp_hp_rd : 3; /* A [60:58] */
  196. unsigned apctl_v_agp_lp_rd : 3; /* A [63:61] */
  197. } pctl_r_bits;
  198. unsigned int pctl_l_whole [2];
  199. unsigned long pctl_q_whole;
  200. };
  201. /*
  202. * SERROR / SERREN / SERRSET
  203. */
  204. union TPAchipSERR {
  205. struct {
  206. unsigned serr_v_lost_uecc : 1; /* [0] */
  207. unsigned serr_v_uecc : 1; /* [1] */
  208. unsigned serr_v_cre : 1; /* [2] */
  209. unsigned serr_v_nxio : 1; /* [3] */
  210. unsigned serr_v_lost_cre : 1; /* [4] */
  211. unsigned serr_v_rsvd0 : 10; /* [14:5] */
  212. unsigned serr_v_addr : 32; /* [46:15] */
  213. unsigned serr_v_rsvd1 : 5; /* [51:47] */
  214. unsigned serr_v_source : 2; /* [53:52] */
  215. unsigned serr_v_cmd : 2; /* [55:54] */
  216. unsigned serr_v_syn : 8; /* [63:56] */
  217. } serr_r_bits;
  218. unsigned int serr_l_whole[2];
  219. unsigned long serr_q_whole;
  220. };
  221. /*
  222. * GPERROR / APERROR / GPERREN / APERREN / GPERRSET / APERRSET
  223. */
  224. union TPAchipPERR {
  225. struct {
  226. unsigned long perr_v_lost : 1; /* [0] */
  227. unsigned long perr_v_serr : 1; /* [1] */
  228. unsigned long perr_v_perr : 1; /* [2] */
  229. unsigned long perr_v_dcrto : 1; /* [3] */
  230. unsigned long perr_v_sge : 1; /* [4] */
  231. unsigned long perr_v_ape : 1; /* [5] */
  232. unsigned long perr_v_ta : 1; /* [6] */
  233. unsigned long perr_v_dpe : 1; /* [7] */
  234. unsigned long perr_v_nds : 1; /* [8] */
  235. unsigned long perr_v_iptpr : 1; /* [9] */
  236. unsigned long perr_v_iptpw : 1; /* [10] */
  237. unsigned long perr_v_rsvd0 : 3; /* [13:11] */
  238. unsigned long perr_v_addr : 33; /* [46:14] */
  239. unsigned long perr_v_dac : 1; /* [47] */
  240. unsigned long perr_v_mwin : 1; /* [48] */
  241. unsigned long perr_v_rsvd1 : 3; /* [51:49] */
  242. unsigned long perr_v_cmd : 4; /* [55:52] */
  243. unsigned long perr_v_rsvd2 : 8; /* [63:56] */
  244. } perr_r_bits;
  245. unsigned int perr_l_whole[2];
  246. unsigned long perr_q_whole;
  247. };
  248. /*
  249. * AGPERROR / AGPERREN / AGPERRSET
  250. */
  251. union TPAchipAGPERR {
  252. struct {
  253. unsigned agperr_v_lost : 1; /* [0] */
  254. unsigned agperr_v_lpqfull : 1; /* [1] */
  255. unsigned apgerr_v_hpqfull : 1; /* [2] */
  256. unsigned agperr_v_rescmd : 1; /* [3] */
  257. unsigned agperr_v_ipte : 1; /* [4] */
  258. unsigned agperr_v_ptp : 1; /* [5] */
  259. unsigned agperr_v_nowindow : 1; /* [6] */
  260. unsigned agperr_v_rsvd0 : 8; /* [14:7] */
  261. unsigned agperr_v_addr : 32; /* [46:15] */
  262. unsigned agperr_v_rsvd1 : 1; /* [47] */
  263. unsigned agperr_v_dac : 1; /* [48] */
  264. unsigned agperr_v_mwin : 1; /* [49] */
  265. unsigned agperr_v_cmd : 3; /* [52:50] */
  266. unsigned agperr_v_length : 6; /* [58:53] */
  267. unsigned agperr_v_fence : 1; /* [59] */
  268. unsigned agperr_v_rsvd2 : 4; /* [63:60] */
  269. } agperr_r_bits;
  270. unsigned int agperr_l_whole[2];
  271. unsigned long agperr_q_whole;
  272. };
  273. /*
  274. * Memory spaces:
  275. * Hose numbers are assigned as follows:
  276. * 0 - pachip 0 / G Port
  277. * 1 - pachip 1 / G Port
  278. * 2 - pachip 0 / A Port
  279. * 3 - pachip 1 / A Port
  280. */
  281. #define TITAN_HOSE_SHIFT (33)
  282. #define TITAN_HOSE(h) (((unsigned long)(h)) << TITAN_HOSE_SHIFT)
  283. #define TITAN_BASE (IDENT_ADDR + TI_BIAS)
  284. #define TITAN_MEM(h) (TITAN_BASE+TITAN_HOSE(h)+0x000000000UL)
  285. #define _TITAN_IACK_SC(h) (TITAN_BASE+TITAN_HOSE(h)+0x1F8000000UL)
  286. #define TITAN_IO(h) (TITAN_BASE+TITAN_HOSE(h)+0x1FC000000UL)
  287. #define TITAN_CONF(h) (TITAN_BASE+TITAN_HOSE(h)+0x1FE000000UL)
  288. #define TITAN_HOSE_MASK TITAN_HOSE(3)
  289. #define TITAN_IACK_SC _TITAN_IACK_SC(0) /* hack! */
  290. /*
  291. * The canonical non-remaped I/O and MEM addresses have these values
  292. * subtracted out. This is arranged so that folks manipulating ISA
  293. * devices can use their familiar numbers and have them map to bus 0.
  294. */
  295. #define TITAN_IO_BIAS TITAN_IO(0)
  296. #define TITAN_MEM_BIAS TITAN_MEM(0)
  297. /* The IO address space is larger than 0xffff */
  298. #define TITAN_IO_SPACE (TITAN_CONF(0) - TITAN_IO(0))
  299. /* TIG Space */
  300. #define TITAN_TIG_SPACE (TITAN_BASE + 0x100000000UL)
  301. /* Offset between ram physical addresses and pci64 DAC bus addresses. */
  302. /* ??? Just a guess. Ought to confirm it hasn't been moved. */
  303. #define TITAN_DAC_OFFSET (1UL << 40)
  304. /*
  305. * Data structure for handling TITAN machine checks:
  306. */
  307. #define SCB_Q_SYSERR 0x620
  308. #define SCB_Q_PROCERR 0x630
  309. #define SCB_Q_SYSMCHK 0x660
  310. #define SCB_Q_PROCMCHK 0x670
  311. #define SCB_Q_SYSEVENT 0x680 /* environmental / system management */
  312. struct el_TITAN_sysdata_mcheck {
  313. u64 summary; /* 0x00 */
  314. u64 c_dirx; /* 0x08 */
  315. u64 c_misc; /* 0x10 */
  316. u64 p0_serror; /* 0x18 */
  317. u64 p0_gperror; /* 0x20 */
  318. u64 p0_aperror; /* 0x28 */
  319. u64 p0_agperror;/* 0x30 */
  320. u64 p1_serror; /* 0x38 */
  321. u64 p1_gperror; /* 0x40 */
  322. u64 p1_aperror; /* 0x48 */
  323. u64 p1_agperror;/* 0x50 */
  324. };
  325. /*
  326. * System area for a privateer 680 environmental/system management mcheck
  327. */
  328. struct el_PRIVATEER_envdata_mcheck {
  329. u64 summary; /* 0x00 */
  330. u64 c_dirx; /* 0x08 */
  331. u64 smir; /* 0x10 */
  332. u64 cpuir; /* 0x18 */
  333. u64 psir; /* 0x20 */
  334. u64 fault; /* 0x28 */
  335. u64 sys_doors; /* 0x30 */
  336. u64 temp_warn; /* 0x38 */
  337. u64 fan_ctrl; /* 0x40 */
  338. u64 code; /* 0x48 */
  339. u64 reserved; /* 0x50 */
  340. };
  341. #ifdef __KERNEL__
  342. #ifndef __EXTERN_INLINE
  343. #define __EXTERN_INLINE extern inline
  344. #define __IO_EXTERN_INLINE
  345. #endif
  346. /*
  347. * I/O functions:
  348. *
  349. * TITAN, a 21??? PCI/memory support chipset for the EV6 (21264)
  350. * can only use linear accesses to get at PCI/AGP memory and I/O spaces.
  351. */
  352. /*
  353. * Memory functions. all accesses are done through linear space.
  354. */
  355. extern void __iomem *titan_ioportmap(unsigned long addr);
  356. extern void __iomem *titan_ioremap(unsigned long addr, unsigned long size);
  357. extern void titan_iounmap(volatile void __iomem *addr);
  358. __EXTERN_INLINE int titan_is_ioaddr(unsigned long addr)
  359. {
  360. return addr >= TITAN_BASE;
  361. }
  362. extern int titan_is_mmio(const volatile void __iomem *addr);
  363. #undef __IO_PREFIX
  364. #define __IO_PREFIX titan
  365. #define titan_trivial_rw_bw 1
  366. #define titan_trivial_rw_lq 1
  367. #define titan_trivial_io_bw 1
  368. #define titan_trivial_io_lq 1
  369. #define titan_trivial_iounmap 0
  370. #include <asm/io_trivial.h>
  371. #ifdef __IO_EXTERN_INLINE
  372. #undef __EXTERN_INLINE
  373. #undef __IO_EXTERN_INLINE
  374. #endif
  375. #endif /* __KERNEL__ */
  376. #endif /* __ALPHA_TITAN__H__ */