trinityd.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. /*
  2. * Copyright 2012 Advanced Micro Devices, Inc.
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  17. * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  18. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  19. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  20. * OTHER DEALINGS IN THE SOFTWARE.
  21. *
  22. * Authors: Alex Deucher
  23. */
  24. #ifndef _TRINITYD_H_
  25. #define _TRINITYD_H_
  26. /* pm registers */
  27. /* cg */
  28. #define CG_CGTT_LOCAL_0 0x0
  29. #define CG_CGTT_LOCAL_1 0x1
  30. /* smc */
  31. #define SMU_SCLK_DPM_STATE_0_CNTL_0 0x1f000
  32. # define STATE_VALID(x) ((x) << 0)
  33. # define STATE_VALID_MASK (0xff << 0)
  34. # define STATE_VALID_SHIFT 0
  35. # define CLK_DIVIDER(x) ((x) << 8)
  36. # define CLK_DIVIDER_MASK (0xff << 8)
  37. # define CLK_DIVIDER_SHIFT 8
  38. # define VID(x) ((x) << 16)
  39. # define VID_MASK (0xff << 16)
  40. # define VID_SHIFT 16
  41. # define LVRT(x) ((x) << 24)
  42. # define LVRT_MASK (0xff << 24)
  43. # define LVRT_SHIFT 24
  44. #define SMU_SCLK_DPM_STATE_0_CNTL_1 0x1f004
  45. # define DS_DIV(x) ((x) << 0)
  46. # define DS_DIV_MASK (0xff << 0)
  47. # define DS_DIV_SHIFT 0
  48. # define DS_SH_DIV(x) ((x) << 8)
  49. # define DS_SH_DIV_MASK (0xff << 8)
  50. # define DS_SH_DIV_SHIFT 8
  51. # define DISPLAY_WM(x) ((x) << 16)
  52. # define DISPLAY_WM_MASK (0xff << 16)
  53. # define DISPLAY_WM_SHIFT 16
  54. # define VCE_WM(x) ((x) << 24)
  55. # define VCE_WM_MASK (0xff << 24)
  56. # define VCE_WM_SHIFT 24
  57. #define SMU_SCLK_DPM_STATE_0_CNTL_3 0x1f00c
  58. # define GNB_SLOW(x) ((x) << 0)
  59. # define GNB_SLOW_MASK (0xff << 0)
  60. # define GNB_SLOW_SHIFT 0
  61. # define FORCE_NBPS1(x) ((x) << 8)
  62. # define FORCE_NBPS1_MASK (0xff << 8)
  63. # define FORCE_NBPS1_SHIFT 8
  64. #define SMU_SCLK_DPM_STATE_0_AT 0x1f010
  65. # define AT(x) ((x) << 0)
  66. # define AT_MASK (0xff << 0)
  67. # define AT_SHIFT 0
  68. #define SMU_SCLK_DPM_STATE_0_PG_CNTL 0x1f014
  69. # define PD_SCLK_DIVIDER(x) ((x) << 16)
  70. # define PD_SCLK_DIVIDER_MASK (0xff << 16)
  71. # define PD_SCLK_DIVIDER_SHIFT 16
  72. #define SMU_SCLK_DPM_STATE_1_CNTL_0 0x1f020
  73. #define SMU_SCLK_DPM_CNTL 0x1f100
  74. # define SCLK_DPM_EN(x) ((x) << 0)
  75. # define SCLK_DPM_EN_MASK (0xff << 0)
  76. # define SCLK_DPM_EN_SHIFT 0
  77. # define SCLK_DPM_BOOT_STATE(x) ((x) << 16)
  78. # define SCLK_DPM_BOOT_STATE_MASK (0xff << 16)
  79. # define SCLK_DPM_BOOT_STATE_SHIFT 16
  80. # define VOLTAGE_CHG_EN(x) ((x) << 24)
  81. # define VOLTAGE_CHG_EN_MASK (0xff << 24)
  82. # define VOLTAGE_CHG_EN_SHIFT 24
  83. #define SMU_SCLK_DPM_TT_CNTL 0x1f108
  84. # define SCLK_TT_EN(x) ((x) << 0)
  85. # define SCLK_TT_EN_MASK (0xff << 0)
  86. # define SCLK_TT_EN_SHIFT 0
  87. #define SMU_SCLK_DPM_TTT 0x1f10c
  88. # define LT(x) ((x) << 0)
  89. # define LT_MASK (0xffff << 0)
  90. # define LT_SHIFT 0
  91. # define HT(x) ((x) << 16)
  92. # define HT_MASK (0xffff << 16)
  93. # define HT_SHIFT 16
  94. #define SMU_UVD_DPM_STATES 0x1f1a0
  95. #define SMU_UVD_DPM_CNTL 0x1f1a4
  96. #define SMU_S_PG_CNTL 0x1f118
  97. # define DS_PG_EN(x) ((x) << 16)
  98. # define DS_PG_EN_MASK (0xff << 16)
  99. # define DS_PG_EN_SHIFT 16
  100. #define GFX_POWER_GATING_CNTL 0x1f38c
  101. # define PDS_DIV(x) ((x) << 0)
  102. # define PDS_DIV_MASK (0xff << 0)
  103. # define PDS_DIV_SHIFT 0
  104. # define SSSD(x) ((x) << 8)
  105. # define SSSD_MASK (0xff << 8)
  106. # define SSSD_SHIFT 8
  107. #define PM_CONFIG 0x1f428
  108. # define SVI_Mode (1 << 29)
  109. #define PM_I_CNTL_1 0x1f464
  110. # define SCLK_DPM(x) ((x) << 0)
  111. # define SCLK_DPM_MASK (0xff << 0)
  112. # define SCLK_DPM_SHIFT 0
  113. # define DS_PG_CNTL(x) ((x) << 16)
  114. # define DS_PG_CNTL_MASK (0xff << 16)
  115. # define DS_PG_CNTL_SHIFT 16
  116. #define PM_TP 0x1f468
  117. #define NB_PSTATE_CONFIG 0x1f5f8
  118. # define Dpm0PgNbPsLo(x) ((x) << 0)
  119. # define Dpm0PgNbPsLo_MASK (3 << 0)
  120. # define Dpm0PgNbPsLo_SHIFT 0
  121. # define Dpm0PgNbPsHi(x) ((x) << 2)
  122. # define Dpm0PgNbPsHi_MASK (3 << 2)
  123. # define Dpm0PgNbPsHi_SHIFT 2
  124. # define DpmXNbPsLo(x) ((x) << 4)
  125. # define DpmXNbPsLo_MASK (3 << 4)
  126. # define DpmXNbPsLo_SHIFT 4
  127. # define DpmXNbPsHi(x) ((x) << 6)
  128. # define DpmXNbPsHi_MASK (3 << 6)
  129. # define DpmXNbPsHi_SHIFT 6
  130. #define DC_CAC_VALUE 0x1f908
  131. #define GPU_CAC_AVRG_CNTL 0x1f920
  132. # define WINDOW_SIZE(x) ((x) << 0)
  133. # define WINDOW_SIZE_MASK (0xff << 0)
  134. # define WINDOW_SIZE_SHIFT 0
  135. #define CC_SMU_MISC_FUSES 0xe0001004
  136. # define MinSClkDid(x) ((x) << 2)
  137. # define MinSClkDid_MASK (0x7f << 2)
  138. # define MinSClkDid_SHIFT 2
  139. #define CC_SMU_TST_EFUSE1_MISC 0xe000101c
  140. # define RB_BACKEND_DISABLE(x) ((x) << 16)
  141. # define RB_BACKEND_DISABLE_MASK (3 << 16)
  142. # define RB_BACKEND_DISABLE_SHIFT 16
  143. #define SMU_SCRATCH_A 0xe0003024
  144. #define SMU_SCRATCH0 0xe0003040
  145. /* mmio */
  146. #define SMC_INT_REQ 0x220
  147. #define SMC_MESSAGE_0 0x22c
  148. #define SMC_RESP_0 0x230
  149. #define GENERAL_PWRMGT 0x670
  150. # define GLOBAL_PWRMGT_EN (1 << 0)
  151. #define SCLK_PWRMGT_CNTL 0x678
  152. # define DYN_PWR_DOWN_EN (1 << 2)
  153. # define RESET_BUSY_CNT (1 << 4)
  154. # define RESET_SCLK_CNT (1 << 5)
  155. # define DYN_GFX_CLK_OFF_EN (1 << 7)
  156. # define GFX_CLK_FORCE_ON (1 << 8)
  157. # define DYNAMIC_PM_EN (1 << 21)
  158. #define TARGET_AND_CURRENT_PROFILE_INDEX 0x684
  159. # define TARGET_STATE(x) ((x) << 0)
  160. # define TARGET_STATE_MASK (0xf << 0)
  161. # define TARGET_STATE_SHIFT 0
  162. # define CURRENT_STATE(x) ((x) << 4)
  163. # define CURRENT_STATE_MASK (0xf << 4)
  164. # define CURRENT_STATE_SHIFT 4
  165. #define CG_GIPOTS 0x6d8
  166. # define CG_GIPOT(x) ((x) << 16)
  167. # define CG_GIPOT_MASK (0xffff << 16)
  168. # define CG_GIPOT_SHIFT 16
  169. #define CG_PG_CTRL 0x6e0
  170. # define SP(x) ((x) << 0)
  171. # define SP_MASK (0xffff << 0)
  172. # define SP_SHIFT 0
  173. # define SU(x) ((x) << 16)
  174. # define SU_MASK (0xffff << 16)
  175. # define SU_SHIFT 16
  176. #define CG_MISC_REG 0x708
  177. #define CG_THERMAL_INT_CTRL 0x738
  178. # define DIG_THERM_INTH(x) ((x) << 0)
  179. # define DIG_THERM_INTH_MASK (0xff << 0)
  180. # define DIG_THERM_INTH_SHIFT 0
  181. # define DIG_THERM_INTL(x) ((x) << 8)
  182. # define DIG_THERM_INTL_MASK (0xff << 8)
  183. # define DIG_THERM_INTL_SHIFT 8
  184. # define THERM_INTH_MASK (1 << 24)
  185. # define THERM_INTL_MASK (1 << 25)
  186. #define CG_CG_VOLTAGE_CNTL 0x770
  187. # define EN (1 << 9)
  188. #define HW_REV 0x5564
  189. # define ATI_REV_ID_MASK (0xf << 28)
  190. # define ATI_REV_ID_SHIFT 28
  191. /* 0 = A0, 1 = A1, 2 = B0, 3 = C0, etc. */
  192. #define CGTS_SM_CTRL_REG 0x9150
  193. #define GB_ADDR_CONFIG 0x98f8
  194. #endif