cik_regs.h 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. /*
  2. * Copyright 2014 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. #ifndef CIK_REGS_H
  23. #define CIK_REGS_H
  24. #define IH_VMID_0_LUT 0x3D40u
  25. #define BIF_DOORBELL_CNTL 0x530Cu
  26. #define SRBM_GFX_CNTL 0xE44
  27. #define PIPEID(x) ((x) << 0)
  28. #define MEID(x) ((x) << 2)
  29. #define VMID(x) ((x) << 4)
  30. #define QUEUEID(x) ((x) << 8)
  31. #define SQ_CONFIG 0x8C00
  32. #define SH_MEM_BASES 0x8C28
  33. /* if PTR32, these are the bases for scratch and lds */
  34. #define PRIVATE_BASE(x) ((x) << 0) /* scratch */
  35. #define SHARED_BASE(x) ((x) << 16) /* LDS */
  36. #define SH_MEM_APE1_BASE 0x8C2C
  37. /* if PTR32, this is the base location of GPUVM */
  38. #define SH_MEM_APE1_LIMIT 0x8C30
  39. /* if PTR32, this is the upper limit of GPUVM */
  40. #define SH_MEM_CONFIG 0x8C34
  41. #define PTR32 (1 << 0)
  42. #define PRIVATE_ATC (1 << 1)
  43. #define ALIGNMENT_MODE(x) ((x) << 2)
  44. #define SH_MEM_ALIGNMENT_MODE_DWORD 0
  45. #define SH_MEM_ALIGNMENT_MODE_DWORD_STRICT 1
  46. #define SH_MEM_ALIGNMENT_MODE_STRICT 2
  47. #define SH_MEM_ALIGNMENT_MODE_UNALIGNED 3
  48. #define DEFAULT_MTYPE(x) ((x) << 4)
  49. #define APE1_MTYPE(x) ((x) << 7)
  50. /* valid for both DEFAULT_MTYPE and APE1_MTYPE */
  51. #define MTYPE_CACHED 0
  52. #define MTYPE_NONCACHED 3
  53. #define SH_STATIC_MEM_CONFIG 0x9604u
  54. #define TC_CFG_L1_LOAD_POLICY0 0xAC68
  55. #define TC_CFG_L1_LOAD_POLICY1 0xAC6C
  56. #define TC_CFG_L1_STORE_POLICY 0xAC70
  57. #define TC_CFG_L2_LOAD_POLICY0 0xAC74
  58. #define TC_CFG_L2_LOAD_POLICY1 0xAC78
  59. #define TC_CFG_L2_STORE_POLICY0 0xAC7C
  60. #define TC_CFG_L2_STORE_POLICY1 0xAC80
  61. #define TC_CFG_L2_ATOMIC_POLICY 0xAC84
  62. #define TC_CFG_L1_VOLATILE 0xAC88
  63. #define TC_CFG_L2_VOLATILE 0xAC8C
  64. #define CP_PQ_WPTR_POLL_CNTL 0xC20C
  65. #define WPTR_POLL_EN (1 << 31)
  66. #define CPC_INT_CNTL 0xC2D0
  67. #define CP_ME1_PIPE0_INT_CNTL 0xC214
  68. #define CP_ME1_PIPE1_INT_CNTL 0xC218
  69. #define CP_ME1_PIPE2_INT_CNTL 0xC21C
  70. #define CP_ME1_PIPE3_INT_CNTL 0xC220
  71. #define CP_ME2_PIPE0_INT_CNTL 0xC224
  72. #define CP_ME2_PIPE1_INT_CNTL 0xC228
  73. #define CP_ME2_PIPE2_INT_CNTL 0xC22C
  74. #define CP_ME2_PIPE3_INT_CNTL 0xC230
  75. #define DEQUEUE_REQUEST_INT_ENABLE (1 << 13)
  76. #define WRM_POLL_TIMEOUT_INT_ENABLE (1 << 17)
  77. #define PRIV_REG_INT_ENABLE (1 << 23)
  78. #define TIME_STAMP_INT_ENABLE (1 << 26)
  79. #define GENERIC2_INT_ENABLE (1 << 29)
  80. #define GENERIC1_INT_ENABLE (1 << 30)
  81. #define GENERIC0_INT_ENABLE (1 << 31)
  82. #define CP_ME1_PIPE0_INT_STATUS 0xC214
  83. #define CP_ME1_PIPE1_INT_STATUS 0xC218
  84. #define CP_ME1_PIPE2_INT_STATUS 0xC21C
  85. #define CP_ME1_PIPE3_INT_STATUS 0xC220
  86. #define CP_ME2_PIPE0_INT_STATUS 0xC224
  87. #define CP_ME2_PIPE1_INT_STATUS 0xC228
  88. #define CP_ME2_PIPE2_INT_STATUS 0xC22C
  89. #define CP_ME2_PIPE3_INT_STATUS 0xC230
  90. #define DEQUEUE_REQUEST_INT_STATUS (1 << 13)
  91. #define WRM_POLL_TIMEOUT_INT_STATUS (1 << 17)
  92. #define PRIV_REG_INT_STATUS (1 << 23)
  93. #define TIME_STAMP_INT_STATUS (1 << 26)
  94. #define GENERIC2_INT_STATUS (1 << 29)
  95. #define GENERIC1_INT_STATUS (1 << 30)
  96. #define GENERIC0_INT_STATUS (1 << 31)
  97. #define CP_HPD_EOP_BASE_ADDR 0xC904
  98. #define CP_HPD_EOP_BASE_ADDR_HI 0xC908
  99. #define CP_HPD_EOP_VMID 0xC90C
  100. #define CP_HPD_EOP_CONTROL 0xC910
  101. #define EOP_SIZE(x) ((x) << 0)
  102. #define EOP_SIZE_MASK (0x3f << 0)
  103. #define CP_MQD_BASE_ADDR 0xC914
  104. #define CP_MQD_BASE_ADDR_HI 0xC918
  105. #define CP_HQD_ACTIVE 0xC91C
  106. #define CP_HQD_VMID 0xC920
  107. #define CP_HQD_PERSISTENT_STATE 0xC924u
  108. #define DEFAULT_CP_HQD_PERSISTENT_STATE (0x33U << 8)
  109. #define PRELOAD_REQ (1 << 0)
  110. #define CP_HQD_PIPE_PRIORITY 0xC928u
  111. #define CP_HQD_QUEUE_PRIORITY 0xC92Cu
  112. #define CP_HQD_QUANTUM 0xC930u
  113. #define QUANTUM_EN 1U
  114. #define QUANTUM_SCALE_1MS (1U << 4)
  115. #define QUANTUM_DURATION(x) ((x) << 8)
  116. #define CP_HQD_PQ_BASE 0xC934
  117. #define CP_HQD_PQ_BASE_HI 0xC938
  118. #define CP_HQD_PQ_RPTR 0xC93C
  119. #define CP_HQD_PQ_RPTR_REPORT_ADDR 0xC940
  120. #define CP_HQD_PQ_RPTR_REPORT_ADDR_HI 0xC944
  121. #define CP_HQD_PQ_WPTR_POLL_ADDR 0xC948
  122. #define CP_HQD_PQ_WPTR_POLL_ADDR_HI 0xC94C
  123. #define CP_HQD_PQ_DOORBELL_CONTROL 0xC950
  124. #define DOORBELL_OFFSET(x) ((x) << 2)
  125. #define DOORBELL_OFFSET_MASK (0x1fffff << 2)
  126. #define DOORBELL_SOURCE (1 << 28)
  127. #define DOORBELL_SCHD_HIT (1 << 29)
  128. #define DOORBELL_EN (1 << 30)
  129. #define DOORBELL_HIT (1 << 31)
  130. #define CP_HQD_PQ_WPTR 0xC954
  131. #define CP_HQD_PQ_CONTROL 0xC958
  132. #define QUEUE_SIZE(x) ((x) << 0)
  133. #define QUEUE_SIZE_MASK (0x3f << 0)
  134. #define RPTR_BLOCK_SIZE(x) ((x) << 8)
  135. #define RPTR_BLOCK_SIZE_MASK (0x3f << 8)
  136. #define MIN_AVAIL_SIZE(x) ((x) << 20)
  137. #define PQ_ATC_EN (1 << 23)
  138. #define PQ_VOLATILE (1 << 26)
  139. #define NO_UPDATE_RPTR (1 << 27)
  140. #define UNORD_DISPATCH (1 << 28)
  141. #define ROQ_PQ_IB_FLIP (1 << 29)
  142. #define PRIV_STATE (1 << 30)
  143. #define KMD_QUEUE (1 << 31)
  144. #define DEFAULT_RPTR_BLOCK_SIZE RPTR_BLOCK_SIZE(5)
  145. #define DEFAULT_MIN_AVAIL_SIZE MIN_AVAIL_SIZE(3)
  146. #define CP_HQD_IB_BASE_ADDR 0xC95Cu
  147. #define CP_HQD_IB_BASE_ADDR_HI 0xC960u
  148. #define CP_HQD_IB_RPTR 0xC964u
  149. #define CP_HQD_IB_CONTROL 0xC968u
  150. #define IB_ATC_EN (1U << 23)
  151. #define DEFAULT_MIN_IB_AVAIL_SIZE (3U << 20)
  152. #define AQL_ENABLE 1
  153. #define CP_HQD_DEQUEUE_REQUEST 0xC974
  154. #define DEQUEUE_REQUEST_DRAIN 1
  155. #define DEQUEUE_REQUEST_RESET 2
  156. #define DEQUEUE_INT (1U << 8)
  157. #define CP_HQD_SEMA_CMD 0xC97Cu
  158. #define CP_HQD_MSG_TYPE 0xC980u
  159. #define CP_HQD_ATOMIC0_PREOP_LO 0xC984u
  160. #define CP_HQD_ATOMIC0_PREOP_HI 0xC988u
  161. #define CP_HQD_ATOMIC1_PREOP_LO 0xC98Cu
  162. #define CP_HQD_ATOMIC1_PREOP_HI 0xC990u
  163. #define CP_HQD_HQ_SCHEDULER0 0xC994u
  164. #define CP_HQD_HQ_SCHEDULER1 0xC998u
  165. #define CP_MQD_CONTROL 0xC99C
  166. #define MQD_VMID(x) ((x) << 0)
  167. #define MQD_VMID_MASK (0xf << 0)
  168. #define MQD_CONTROL_PRIV_STATE_EN (1U << 8)
  169. #define SDMA_RB_VMID(x) (x << 24)
  170. #define SDMA_RB_ENABLE (1 << 0)
  171. #define SDMA_RB_SIZE(x) ((x) << 1) /* log2 */
  172. #define SDMA_RPTR_WRITEBACK_ENABLE (1 << 12)
  173. #define SDMA_RPTR_WRITEBACK_TIMER(x) ((x) << 16) /* log2 */
  174. #define SDMA_OFFSET(x) (x << 0)
  175. #define SDMA_DB_ENABLE (1 << 28)
  176. #define SDMA_ATC (1 << 0)
  177. #define SDMA_VA_PTR32 (1 << 4)
  178. #define SDMA_VA_SHARED_BASE(x) (x << 8)
  179. #define GRBM_GFX_INDEX 0x30800
  180. #define INSTANCE_INDEX(x) ((x) << 0)
  181. #define SH_INDEX(x) ((x) << 8)
  182. #define SE_INDEX(x) ((x) << 16)
  183. #define SH_BROADCAST_WRITES (1 << 29)
  184. #define INSTANCE_BROADCAST_WRITES (1 << 30)
  185. #define SE_BROADCAST_WRITES (1 << 31)
  186. #define SQC_CACHES 0x30d20
  187. #define SQC_POLICY 0x8C38u
  188. #define SQC_VOLATILE 0x8C3Cu
  189. #define CP_PERFMON_CNTL 0x36020
  190. #define ATC_VMID0_PASID_MAPPING 0x339Cu
  191. #define ATC_VMID_PASID_MAPPING_UPDATE_STATUS 0x3398u
  192. #define ATC_VMID_PASID_MAPPING_VALID (1U << 31)
  193. #define ATC_VM_APERTURE0_CNTL 0x3310u
  194. #define ATS_ACCESS_MODE_NEVER 0
  195. #define ATS_ACCESS_MODE_ALWAYS 1
  196. #define ATC_VM_APERTURE0_CNTL2 0x3318u
  197. #define ATC_VM_APERTURE0_HIGH_ADDR 0x3308u
  198. #define ATC_VM_APERTURE0_LOW_ADDR 0x3300u
  199. #define ATC_VM_APERTURE1_CNTL 0x3314u
  200. #define ATC_VM_APERTURE1_CNTL2 0x331Cu
  201. #define ATC_VM_APERTURE1_HIGH_ADDR 0x330Cu
  202. #define ATC_VM_APERTURE1_LOW_ADDR 0x3304u
  203. #endif