cbe_regs.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  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. u64 fir_mode_reg; /* 0x0c18 */
  94. u64 fir_enable_mask; /* 0x0c20 */
  95. u8 pad_0x0c28_0x1000 [0x1000 - 0x0c28]; /* 0x0c28 */
  96. };
  97. extern struct cbe_pmd_regs __iomem *cbe_get_pmd_regs(struct device_node *np);
  98. extern struct cbe_pmd_regs __iomem *cbe_get_cpu_pmd_regs(int cpu);
  99. /*
  100. * PMU shadow registers
  101. *
  102. * Many of the registers in the performance monitoring unit are write-only,
  103. * so we need to save a copy of what we write to those registers.
  104. *
  105. * The actual data counters are read/write. However, writing to the counters
  106. * only takes effect if the PMU is enabled. Otherwise the value is stored in
  107. * a hardware latch until the next time the PMU is enabled. So we save a copy
  108. * of the counter values if we need to read them back while the PMU is
  109. * disabled. The counter_value_in_latch field is a bitmap indicating which
  110. * counters currently have a value waiting to be written.
  111. */
  112. struct cbe_pmd_shadow_regs {
  113. u32 group_control;
  114. u32 debug_bus_control;
  115. u32 trace_address;
  116. u32 ext_tr_timer;
  117. u32 pm_status;
  118. u32 pm_control;
  119. u32 pm_interval;
  120. u32 pm_start_stop;
  121. u32 pm07_control[NR_CTRS];
  122. u32 pm_ctr[NR_PHYS_CTRS];
  123. u32 counter_value_in_latch;
  124. };
  125. extern struct cbe_pmd_shadow_regs *cbe_get_pmd_shadow_regs(struct device_node *np);
  126. extern struct cbe_pmd_shadow_regs *cbe_get_cpu_pmd_shadow_regs(int cpu);
  127. /*
  128. *
  129. * IIC unit register definitions
  130. *
  131. */
  132. struct cbe_iic_pending_bits {
  133. u32 data;
  134. u8 flags;
  135. u8 class;
  136. u8 source;
  137. u8 prio;
  138. };
  139. #define CBE_IIC_IRQ_VALID 0x80
  140. #define CBE_IIC_IRQ_IPI 0x40
  141. struct cbe_iic_thread_regs {
  142. struct cbe_iic_pending_bits pending;
  143. struct cbe_iic_pending_bits pending_destr;
  144. u64 generate;
  145. u64 prio;
  146. };
  147. struct cbe_iic_regs {
  148. u8 pad_0x0000_0x0400[0x0400 - 0x0000]; /* 0x0000 */
  149. /* IIC interrupt registers */
  150. struct cbe_iic_thread_regs thread[2]; /* 0x0400 */
  151. u64 iic_ir; /* 0x0440 */
  152. #define CBE_IIC_IR_PRIO(x) (((x) & 0xf) << 12)
  153. #define CBE_IIC_IR_DEST_NODE(x) (((x) & 0xf) << 4)
  154. #define CBE_IIC_IR_DEST_UNIT(x) ((x) & 0xf)
  155. #define CBE_IIC_IR_IOC_0 0x0
  156. #define CBE_IIC_IR_IOC_1S 0xb
  157. #define CBE_IIC_IR_PT_0 0xe
  158. #define CBE_IIC_IR_PT_1 0xf
  159. u64 iic_is; /* 0x0448 */
  160. #define CBE_IIC_IS_PMI 0x2
  161. u8 pad_0x0450_0x0500[0x0500 - 0x0450]; /* 0x0450 */
  162. /* IOC FIR */
  163. u64 ioc_fir_reset; /* 0x0500 */
  164. u64 ioc_fir_set; /* 0x0508 */
  165. u64 ioc_checkstop_enable; /* 0x0510 */
  166. u64 ioc_fir_error_mask; /* 0x0518 */
  167. u64 ioc_syserr_enable; /* 0x0520 */
  168. u64 ioc_fir; /* 0x0528 */
  169. u8 pad_0x0530_0x1000[0x1000 - 0x0530]; /* 0x0530 */
  170. };
  171. extern struct cbe_iic_regs __iomem *cbe_get_iic_regs(struct device_node *np);
  172. extern struct cbe_iic_regs __iomem *cbe_get_cpu_iic_regs(int cpu);
  173. struct cbe_mic_tm_regs {
  174. u8 pad_0x0000_0x0040[0x0040 - 0x0000]; /* 0x0000 */
  175. u64 mic_ctl_cnfg2; /* 0x0040 */
  176. #define CBE_MIC_ENABLE_AUX_TRC 0x8000000000000000LL
  177. #define CBE_MIC_DISABLE_PWR_SAV_2 0x0200000000000000LL
  178. #define CBE_MIC_DISABLE_AUX_TRC_WRAP 0x0100000000000000LL
  179. #define CBE_MIC_ENABLE_AUX_TRC_INT 0x0080000000000000LL
  180. u64 pad_0x0048; /* 0x0048 */
  181. u64 mic_aux_trc_base; /* 0x0050 */
  182. u64 mic_aux_trc_max_addr; /* 0x0058 */
  183. u64 mic_aux_trc_cur_addr; /* 0x0060 */
  184. u64 mic_aux_trc_grf_addr; /* 0x0068 */
  185. u64 mic_aux_trc_grf_data; /* 0x0070 */
  186. u64 pad_0x0078; /* 0x0078 */
  187. u64 mic_ctl_cnfg_0; /* 0x0080 */
  188. #define CBE_MIC_DISABLE_PWR_SAV_0 0x8000000000000000LL
  189. u64 pad_0x0088; /* 0x0088 */
  190. u64 slow_fast_timer_0; /* 0x0090 */
  191. u64 slow_next_timer_0; /* 0x0098 */
  192. u8 pad_0x00a0_0x01c0[0x01c0 - 0x0a0]; /* 0x00a0 */
  193. u64 mic_ctl_cnfg_1; /* 0x01c0 */
  194. #define CBE_MIC_DISABLE_PWR_SAV_1 0x8000000000000000LL
  195. u64 pad_0x01c8; /* 0x01c8 */
  196. u64 slow_fast_timer_1; /* 0x01d0 */
  197. u64 slow_next_timer_1; /* 0x01d8 */
  198. u8 pad_0x01e0_0x1000[0x1000 - 0x01e0]; /* 0x01e0 */
  199. };
  200. extern struct cbe_mic_tm_regs __iomem *cbe_get_mic_tm_regs(struct device_node *np);
  201. extern struct cbe_mic_tm_regs __iomem *cbe_get_cpu_mic_tm_regs(int cpu);
  202. /* some utility functions to deal with SMT */
  203. extern u32 cbe_get_hw_thread_id(int cpu);
  204. extern u32 cbe_cpu_to_node(int cpu);
  205. extern u32 cbe_node_to_cpu(int node);
  206. /* Init this module early */
  207. extern void cbe_regs_init(void);
  208. #endif /* CBE_REGS_H */