cell-regs.h 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. /*
  2. * cbe_regs.h
  3. *
  4. * This file is intended to hold the various register definitions for CBE
  5. * on-chip system devices (memory controller, IO controller, etc...)
  6. *
  7. * (C) Copyright IBM Corporation 2001,2006
  8. *
  9. * Authors: Maximino Aguilar (maguilar@us.ibm.com)
  10. * David J. Erb (djerb@us.ibm.com)
  11. *
  12. * (c) 2006 Benjamin Herrenschmidt <benh@kernel.crashing.org>, IBM Corp.
  13. */
  14. #ifndef CBE_REGS_H
  15. #define CBE_REGS_H
  16. #include <asm/cell-pmu.h>
  17. /*
  18. *
  19. * Some HID register definitions
  20. *
  21. */
  22. /* CBE specific HID0 bits */
  23. #define HID0_CBE_THERM_WAKEUP 0x0000020000000000ul
  24. #define HID0_CBE_SYSERR_WAKEUP 0x0000008000000000ul
  25. #define HID0_CBE_THERM_INT_EN 0x0000000400000000ul
  26. #define HID0_CBE_SYSERR_INT_EN 0x0000000200000000ul
  27. #define MAX_CBE 2
  28. /*
  29. *
  30. * Pervasive unit register definitions
  31. *
  32. */
  33. union spe_reg {
  34. u64 val;
  35. u8 spe[8];
  36. };
  37. union ppe_spe_reg {
  38. u64 val;
  39. struct {
  40. u32 ppe;
  41. u32 spe;
  42. };
  43. };
  44. struct cbe_pmd_regs {
  45. /* Debug Bus Control */
  46. u64 pad_0x0000; /* 0x0000 */
  47. u64 group_control; /* 0x0008 */
  48. u8 pad_0x0010_0x00a8 [0x00a8 - 0x0010]; /* 0x0010 */
  49. u64 debug_bus_control; /* 0x00a8 */
  50. u8 pad_0x00b0_0x0100 [0x0100 - 0x00b0]; /* 0x00b0 */
  51. u64 trace_aux_data; /* 0x0100 */
  52. u64 trace_buffer_0_63; /* 0x0108 */
  53. u64 trace_buffer_64_127; /* 0x0110 */
  54. u64 trace_address; /* 0x0118 */
  55. u64 ext_tr_timer; /* 0x0120 */
  56. u8 pad_0x0128_0x0400 [0x0400 - 0x0128]; /* 0x0128 */
  57. /* Performance Monitor */
  58. u64 pm_status; /* 0x0400 */
  59. u64 pm_control; /* 0x0408 */
  60. u64 pm_interval; /* 0x0410 */
  61. u64 pm_ctr[4]; /* 0x0418 */
  62. u64 pm_start_stop; /* 0x0438 */
  63. u64 pm07_control[8]; /* 0x0440 */
  64. u8 pad_0x0480_0x0800 [0x0800 - 0x0480]; /* 0x0480 */
  65. /* Thermal Sensor Registers */
  66. union spe_reg ts_ctsr1; /* 0x0800 */
  67. u64 ts_ctsr2; /* 0x0808 */
  68. union spe_reg ts_mtsr1; /* 0x0810 */
  69. u64 ts_mtsr2; /* 0x0818 */
  70. union spe_reg ts_itr1; /* 0x0820 */
  71. u64 ts_itr2; /* 0x0828 */
  72. u64 ts_gitr; /* 0x0830 */
  73. u64 ts_isr; /* 0x0838 */
  74. u64 ts_imr; /* 0x0840 */
  75. union spe_reg tm_cr1; /* 0x0848 */
  76. u64 tm_cr2; /* 0x0850 */
  77. u64 tm_simr; /* 0x0858 */
  78. union ppe_spe_reg tm_tpr; /* 0x0860 */
  79. union spe_reg tm_str1; /* 0x0868 */
  80. u64 tm_str2; /* 0x0870 */
  81. union ppe_spe_reg tm_tsr; /* 0x0878 */
  82. /* Power Management */
  83. u64 pmcr; /* 0x0880 */
  84. #define CBE_PMD_PAUSE_ZERO_CONTROL 0x10000
  85. u64 pmsr; /* 0x0888 */
  86. /* Time Base Register */
  87. u64 tbr; /* 0x0890 */
  88. u8 pad_0x0898_0x0c00 [0x0c00 - 0x0898]; /* 0x0898 */
  89. /* Fault Isolation Registers */
  90. u64 checkstop_fir; /* 0x0c00 */
  91. u64 recoverable_fir; /* 0x0c08 */
  92. u64 spec_att_mchk_fir; /* 0x0c10 */
  93. u32 fir_mode_reg; /* 0x0c18 */
  94. u8 pad_0x0c1c_0x0c20 [4]; /* 0x0c1c */
  95. #define CBE_PMD_FIR_MODE_M8 0x00800
  96. u64 fir_enable_mask; /* 0x0c20 */
  97. u8 pad_0x0c28_0x0ca8 [0x0ca8 - 0x0c28]; /* 0x0c28 */
  98. u64 ras_esc_0; /* 0x0ca8 */
  99. u8 pad_0x0cb0_0x1000 [0x1000 - 0x0cb0]; /* 0x0cb0 */
  100. };
  101. extern struct cbe_pmd_regs __iomem *cbe_get_pmd_regs(struct device_node *np);
  102. extern struct cbe_pmd_regs __iomem *cbe_get_cpu_pmd_regs(int cpu);
  103. /*
  104. * PMU shadow registers
  105. *
  106. * Many of the registers in the performance monitoring unit are write-only,
  107. * so we need to save a copy of what we write to those registers.
  108. *
  109. * The actual data counters are read/write. However, writing to the counters
  110. * only takes effect if the PMU is enabled. Otherwise the value is stored in
  111. * a hardware latch until the next time the PMU is enabled. So we save a copy
  112. * of the counter values if we need to read them back while the PMU is
  113. * disabled. The counter_value_in_latch field is a bitmap indicating which
  114. * counters currently have a value waiting to be written.
  115. */
  116. struct cbe_pmd_shadow_regs {
  117. u32 group_control;
  118. u32 debug_bus_control;
  119. u32 trace_address;
  120. u32 ext_tr_timer;
  121. u32 pm_status;
  122. u32 pm_control;
  123. u32 pm_interval;
  124. u32 pm_start_stop;
  125. u32 pm07_control[NR_CTRS];
  126. u32 pm_ctr[NR_PHYS_CTRS];
  127. u32 counter_value_in_latch;
  128. };
  129. extern struct cbe_pmd_shadow_regs *cbe_get_pmd_shadow_regs(struct device_node *np);
  130. extern struct cbe_pmd_shadow_regs *cbe_get_cpu_pmd_shadow_regs(int cpu);
  131. /*
  132. *
  133. * IIC unit register definitions
  134. *
  135. */
  136. struct cbe_iic_pending_bits {
  137. u32 data;
  138. u8 flags;
  139. u8 class;
  140. u8 source;
  141. u8 prio;
  142. };
  143. #define CBE_IIC_IRQ_VALID 0x80
  144. #define CBE_IIC_IRQ_IPI 0x40
  145. struct cbe_iic_thread_regs {
  146. struct cbe_iic_pending_bits pending;
  147. struct cbe_iic_pending_bits pending_destr;
  148. u64 generate;
  149. u64 prio;
  150. };
  151. struct cbe_iic_regs {
  152. u8 pad_0x0000_0x0400[0x0400 - 0x0000]; /* 0x0000 */
  153. /* IIC interrupt registers */
  154. struct cbe_iic_thread_regs thread[2]; /* 0x0400 */
  155. u64 iic_ir; /* 0x0440 */
  156. #define CBE_IIC_IR_PRIO(x) (((x) & 0xf) << 12)
  157. #define CBE_IIC_IR_DEST_NODE(x) (((x) & 0xf) << 4)
  158. #define CBE_IIC_IR_DEST_UNIT(x) ((x) & 0xf)
  159. #define CBE_IIC_IR_IOC_0 0x0
  160. #define CBE_IIC_IR_IOC_1S 0xb
  161. #define CBE_IIC_IR_PT_0 0xe
  162. #define CBE_IIC_IR_PT_1 0xf
  163. u64 iic_is; /* 0x0448 */
  164. #define CBE_IIC_IS_PMI 0x2
  165. u8 pad_0x0450_0x0500[0x0500 - 0x0450]; /* 0x0450 */
  166. /* IOC FIR */
  167. u64 ioc_fir_reset; /* 0x0500 */
  168. u64 ioc_fir_set; /* 0x0508 */
  169. u64 ioc_checkstop_enable; /* 0x0510 */
  170. u64 ioc_fir_error_mask; /* 0x0518 */
  171. u64 ioc_syserr_enable; /* 0x0520 */
  172. u64 ioc_fir; /* 0x0528 */
  173. u8 pad_0x0530_0x1000[0x1000 - 0x0530]; /* 0x0530 */
  174. };
  175. extern struct cbe_iic_regs __iomem *cbe_get_iic_regs(struct device_node *np);
  176. extern struct cbe_iic_regs __iomem *cbe_get_cpu_iic_regs(int cpu);
  177. struct cbe_mic_tm_regs {
  178. u8 pad_0x0000_0x0040[0x0040 - 0x0000]; /* 0x0000 */
  179. u64 mic_ctl_cnfg2; /* 0x0040 */
  180. #define CBE_MIC_ENABLE_AUX_TRC 0x8000000000000000LL
  181. #define CBE_MIC_DISABLE_PWR_SAV_2 0x0200000000000000LL
  182. #define CBE_MIC_DISABLE_AUX_TRC_WRAP 0x0100000000000000LL
  183. #define CBE_MIC_ENABLE_AUX_TRC_INT 0x0080000000000000LL
  184. u64 pad_0x0048; /* 0x0048 */
  185. u64 mic_aux_trc_base; /* 0x0050 */
  186. u64 mic_aux_trc_max_addr; /* 0x0058 */
  187. u64 mic_aux_trc_cur_addr; /* 0x0060 */
  188. u64 mic_aux_trc_grf_addr; /* 0x0068 */
  189. u64 mic_aux_trc_grf_data; /* 0x0070 */
  190. u64 pad_0x0078; /* 0x0078 */
  191. u64 mic_ctl_cnfg_0; /* 0x0080 */
  192. #define CBE_MIC_DISABLE_PWR_SAV_0 0x8000000000000000LL
  193. u64 pad_0x0088; /* 0x0088 */
  194. u64 slow_fast_timer_0; /* 0x0090 */
  195. u64 slow_next_timer_0; /* 0x0098 */
  196. u8 pad_0x00a0_0x00f8[0x00f8 - 0x00a0]; /* 0x00a0 */
  197. u64 mic_df_ecc_address_0; /* 0x00f8 */
  198. u8 pad_0x0100_0x01b8[0x01b8 - 0x0100]; /* 0x0100 */
  199. u64 mic_df_ecc_address_1; /* 0x01b8 */
  200. u64 mic_ctl_cnfg_1; /* 0x01c0 */
  201. #define CBE_MIC_DISABLE_PWR_SAV_1 0x8000000000000000LL
  202. u64 pad_0x01c8; /* 0x01c8 */
  203. u64 slow_fast_timer_1; /* 0x01d0 */
  204. u64 slow_next_timer_1; /* 0x01d8 */
  205. u8 pad_0x01e0_0x0208[0x0208 - 0x01e0]; /* 0x01e0 */
  206. u64 mic_exc; /* 0x0208 */
  207. #define CBE_MIC_EXC_BLOCK_SCRUB 0x0800000000000000ULL
  208. #define CBE_MIC_EXC_FAST_SCRUB 0x0100000000000000ULL
  209. u64 mic_mnt_cfg; /* 0x0210 */
  210. #define CBE_MIC_MNT_CFG_CHAN_0_POP 0x0002000000000000ULL
  211. #define CBE_MIC_MNT_CFG_CHAN_1_POP 0x0004000000000000ULL
  212. u64 mic_df_config; /* 0x0218 */
  213. #define CBE_MIC_ECC_DISABLE_0 0x4000000000000000ULL
  214. #define CBE_MIC_ECC_REP_SINGLE_0 0x2000000000000000ULL
  215. #define CBE_MIC_ECC_DISABLE_1 0x0080000000000000ULL
  216. #define CBE_MIC_ECC_REP_SINGLE_1 0x0040000000000000ULL
  217. u8 pad_0x0220_0x0230[0x0230 - 0x0220]; /* 0x0220 */
  218. u64 mic_fir; /* 0x0230 */
  219. #define CBE_MIC_FIR_ECC_SINGLE_0_ERR 0x0200000000000000ULL
  220. #define CBE_MIC_FIR_ECC_MULTI_0_ERR 0x0100000000000000ULL
  221. #define CBE_MIC_FIR_ECC_SINGLE_1_ERR 0x0080000000000000ULL
  222. #define CBE_MIC_FIR_ECC_MULTI_1_ERR 0x0040000000000000ULL
  223. #define CBE_MIC_FIR_ECC_ERR_MASK 0xffff000000000000ULL
  224. #define CBE_MIC_FIR_ECC_SINGLE_0_CTE 0x0000020000000000ULL
  225. #define CBE_MIC_FIR_ECC_MULTI_0_CTE 0x0000010000000000ULL
  226. #define CBE_MIC_FIR_ECC_SINGLE_1_CTE 0x0000008000000000ULL
  227. #define CBE_MIC_FIR_ECC_MULTI_1_CTE 0x0000004000000000ULL
  228. #define CBE_MIC_FIR_ECC_CTE_MASK 0x0000ffff00000000ULL
  229. #define CBE_MIC_FIR_ECC_SINGLE_0_RESET 0x0000000002000000ULL
  230. #define CBE_MIC_FIR_ECC_MULTI_0_RESET 0x0000000001000000ULL
  231. #define CBE_MIC_FIR_ECC_SINGLE_1_RESET 0x0000000000800000ULL
  232. #define CBE_MIC_FIR_ECC_MULTI_1_RESET 0x0000000000400000ULL
  233. #define CBE_MIC_FIR_ECC_RESET_MASK 0x00000000ffff0000ULL
  234. #define CBE_MIC_FIR_ECC_SINGLE_0_SET 0x0000000000000200ULL
  235. #define CBE_MIC_FIR_ECC_MULTI_0_SET 0x0000000000000100ULL
  236. #define CBE_MIC_FIR_ECC_SINGLE_1_SET 0x0000000000000080ULL
  237. #define CBE_MIC_FIR_ECC_MULTI_1_SET 0x0000000000000040ULL
  238. #define CBE_MIC_FIR_ECC_SET_MASK 0x000000000000ffffULL
  239. u64 mic_fir_debug; /* 0x0238 */
  240. u8 pad_0x0240_0x1000[0x1000 - 0x0240]; /* 0x0240 */
  241. };
  242. extern struct cbe_mic_tm_regs __iomem *cbe_get_mic_tm_regs(struct device_node *np);
  243. extern struct cbe_mic_tm_regs __iomem *cbe_get_cpu_mic_tm_regs(int cpu);
  244. /* Cell page table entries */
  245. #define CBE_IOPTE_PP_W 0x8000000000000000ul /* protection: write */
  246. #define CBE_IOPTE_PP_R 0x4000000000000000ul /* protection: read */
  247. #define CBE_IOPTE_M 0x2000000000000000ul /* coherency required */
  248. #define CBE_IOPTE_SO_R 0x1000000000000000ul /* ordering: writes */
  249. #define CBE_IOPTE_SO_RW 0x1800000000000000ul /* ordering: r & w */
  250. #define CBE_IOPTE_RPN_Mask 0x07fffffffffff000ul /* RPN */
  251. #define CBE_IOPTE_H 0x0000000000000800ul /* cache hint */
  252. #define CBE_IOPTE_IOID_Mask 0x00000000000007fful /* ioid */
  253. /* some utility functions to deal with SMT */
  254. extern u32 cbe_get_hw_thread_id(int cpu);
  255. extern u32 cbe_cpu_to_node(int cpu);
  256. extern u32 cbe_node_to_cpu(int node);
  257. /* Init this module early */
  258. extern void cbe_regs_init(void);
  259. #endif /* CBE_REGS_H */