cik_reg.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  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 __CIK_REG_H__
  25. #define __CIK_REG_H__
  26. #define CIK_DIDT_IND_INDEX 0xca00
  27. #define CIK_DIDT_IND_DATA 0xca04
  28. #define CIK_DC_GPIO_HPD_MASK 0x65b0
  29. #define CIK_DC_GPIO_HPD_A 0x65b4
  30. #define CIK_DC_GPIO_HPD_EN 0x65b8
  31. #define CIK_DC_GPIO_HPD_Y 0x65bc
  32. #define CIK_GRPH_CONTROL 0x6804
  33. # define CIK_GRPH_DEPTH(x) (((x) & 0x3) << 0)
  34. # define CIK_GRPH_DEPTH_8BPP 0
  35. # define CIK_GRPH_DEPTH_16BPP 1
  36. # define CIK_GRPH_DEPTH_32BPP 2
  37. # define CIK_GRPH_NUM_BANKS(x) (((x) & 0x3) << 2)
  38. # define CIK_ADDR_SURF_2_BANK 0
  39. # define CIK_ADDR_SURF_4_BANK 1
  40. # define CIK_ADDR_SURF_8_BANK 2
  41. # define CIK_ADDR_SURF_16_BANK 3
  42. # define CIK_GRPH_Z(x) (((x) & 0x3) << 4)
  43. # define CIK_GRPH_BANK_WIDTH(x) (((x) & 0x3) << 6)
  44. # define CIK_ADDR_SURF_BANK_WIDTH_1 0
  45. # define CIK_ADDR_SURF_BANK_WIDTH_2 1
  46. # define CIK_ADDR_SURF_BANK_WIDTH_4 2
  47. # define CIK_ADDR_SURF_BANK_WIDTH_8 3
  48. # define CIK_GRPH_FORMAT(x) (((x) & 0x7) << 8)
  49. /* 8 BPP */
  50. # define CIK_GRPH_FORMAT_INDEXED 0
  51. /* 16 BPP */
  52. # define CIK_GRPH_FORMAT_ARGB1555 0
  53. # define CIK_GRPH_FORMAT_ARGB565 1
  54. # define CIK_GRPH_FORMAT_ARGB4444 2
  55. # define CIK_GRPH_FORMAT_AI88 3
  56. # define CIK_GRPH_FORMAT_MONO16 4
  57. # define CIK_GRPH_FORMAT_BGRA5551 5
  58. /* 32 BPP */
  59. # define CIK_GRPH_FORMAT_ARGB8888 0
  60. # define CIK_GRPH_FORMAT_ARGB2101010 1
  61. # define CIK_GRPH_FORMAT_32BPP_DIG 2
  62. # define CIK_GRPH_FORMAT_8B_ARGB2101010 3
  63. # define CIK_GRPH_FORMAT_BGRA1010102 4
  64. # define CIK_GRPH_FORMAT_8B_BGRA1010102 5
  65. # define CIK_GRPH_FORMAT_RGB111110 6
  66. # define CIK_GRPH_FORMAT_BGR101111 7
  67. # define CIK_GRPH_BANK_HEIGHT(x) (((x) & 0x3) << 11)
  68. # define CIK_ADDR_SURF_BANK_HEIGHT_1 0
  69. # define CIK_ADDR_SURF_BANK_HEIGHT_2 1
  70. # define CIK_ADDR_SURF_BANK_HEIGHT_4 2
  71. # define CIK_ADDR_SURF_BANK_HEIGHT_8 3
  72. # define CIK_GRPH_TILE_SPLIT(x) (((x) & 0x7) << 13)
  73. # define CIK_ADDR_SURF_TILE_SPLIT_64B 0
  74. # define CIK_ADDR_SURF_TILE_SPLIT_128B 1
  75. # define CIK_ADDR_SURF_TILE_SPLIT_256B 2
  76. # define CIK_ADDR_SURF_TILE_SPLIT_512B 3
  77. # define CIK_ADDR_SURF_TILE_SPLIT_1KB 4
  78. # define CIK_ADDR_SURF_TILE_SPLIT_2KB 5
  79. # define CIK_ADDR_SURF_TILE_SPLIT_4KB 6
  80. # define CIK_GRPH_MACRO_TILE_ASPECT(x) (((x) & 0x3) << 18)
  81. # define CIK_ADDR_SURF_MACRO_TILE_ASPECT_1 0
  82. # define CIK_ADDR_SURF_MACRO_TILE_ASPECT_2 1
  83. # define CIK_ADDR_SURF_MACRO_TILE_ASPECT_4 2
  84. # define CIK_ADDR_SURF_MACRO_TILE_ASPECT_8 3
  85. # define CIK_GRPH_ARRAY_MODE(x) (((x) & 0x7) << 20)
  86. # define CIK_GRPH_ARRAY_LINEAR_GENERAL 0
  87. # define CIK_GRPH_ARRAY_LINEAR_ALIGNED 1
  88. # define CIK_GRPH_ARRAY_1D_TILED_THIN1 2
  89. # define CIK_GRPH_ARRAY_2D_TILED_THIN1 4
  90. # define CIK_GRPH_PIPE_CONFIG(x) (((x) & 0x1f) << 24)
  91. # define CIK_ADDR_SURF_P2 0
  92. # define CIK_ADDR_SURF_P4_8x16 4
  93. # define CIK_ADDR_SURF_P4_16x16 5
  94. # define CIK_ADDR_SURF_P4_16x32 6
  95. # define CIK_ADDR_SURF_P4_32x32 7
  96. # define CIK_ADDR_SURF_P8_16x16_8x16 8
  97. # define CIK_ADDR_SURF_P8_16x32_8x16 9
  98. # define CIK_ADDR_SURF_P8_32x32_8x16 10
  99. # define CIK_ADDR_SURF_P8_16x32_16x16 11
  100. # define CIK_ADDR_SURF_P8_32x32_16x16 12
  101. # define CIK_ADDR_SURF_P8_32x32_16x32 13
  102. # define CIK_ADDR_SURF_P8_32x64_32x32 14
  103. # define CIK_GRPH_MICRO_TILE_MODE(x) (((x) & 0x7) << 29)
  104. # define CIK_DISPLAY_MICRO_TILING 0
  105. # define CIK_THIN_MICRO_TILING 1
  106. # define CIK_DEPTH_MICRO_TILING 2
  107. # define CIK_ROTATED_MICRO_TILING 4
  108. /* CUR blocks at 0x6998, 0x7598, 0x10198, 0x10d98, 0x11998, 0x12598 */
  109. #define CIK_CUR_CONTROL 0x6998
  110. # define CIK_CURSOR_EN (1 << 0)
  111. # define CIK_CURSOR_MODE(x) (((x) & 0x3) << 8)
  112. # define CIK_CURSOR_MONO 0
  113. # define CIK_CURSOR_24_1 1
  114. # define CIK_CURSOR_24_8_PRE_MULT 2
  115. # define CIK_CURSOR_24_8_UNPRE_MULT 3
  116. # define CIK_CURSOR_2X_MAGNIFY (1 << 16)
  117. # define CIK_CURSOR_FORCE_MC_ON (1 << 20)
  118. # define CIK_CURSOR_URGENT_CONTROL(x) (((x) & 0x7) << 24)
  119. # define CIK_CURSOR_URGENT_ALWAYS 0
  120. # define CIK_CURSOR_URGENT_1_8 1
  121. # define CIK_CURSOR_URGENT_1_4 2
  122. # define CIK_CURSOR_URGENT_3_8 3
  123. # define CIK_CURSOR_URGENT_1_2 4
  124. #define CIK_CUR_SURFACE_ADDRESS 0x699c
  125. # define CIK_CUR_SURFACE_ADDRESS_MASK 0xfffff000
  126. #define CIK_CUR_SIZE 0x69a0
  127. #define CIK_CUR_SURFACE_ADDRESS_HIGH 0x69a4
  128. #define CIK_CUR_POSITION 0x69a8
  129. #define CIK_CUR_HOT_SPOT 0x69ac
  130. #define CIK_CUR_COLOR1 0x69b0
  131. #define CIK_CUR_COLOR2 0x69b4
  132. #define CIK_CUR_UPDATE 0x69b8
  133. # define CIK_CURSOR_UPDATE_PENDING (1 << 0)
  134. # define CIK_CURSOR_UPDATE_TAKEN (1 << 1)
  135. # define CIK_CURSOR_UPDATE_LOCK (1 << 16)
  136. # define CIK_CURSOR_DISABLE_MULTIPLE_UPDATE (1 << 24)
  137. #define CIK_ALPHA_CONTROL 0x6af0
  138. # define CIK_CURSOR_ALPHA_BLND_ENA (1 << 1)
  139. #define CIK_LB_DATA_FORMAT 0x6b00
  140. # define CIK_INTERLEAVE_EN (1 << 3)
  141. #define CIK_LB_DESKTOP_HEIGHT 0x6b0c
  142. #define KFD_CIK_SDMA_QUEUE_OFFSET 0x200
  143. #define SQ_IND_INDEX 0x8DE0
  144. #define SQ_CMD 0x8DEC
  145. #define SQ_IND_DATA 0x8DE4
  146. /*
  147. * The TCP_WATCHx_xxxx addresses that are shown here are in dwords,
  148. * and that's why they are multiplied by 4
  149. */
  150. #define TCP_WATCH0_ADDR_H (0x32A0*4)
  151. #define TCP_WATCH1_ADDR_H (0x32A3*4)
  152. #define TCP_WATCH2_ADDR_H (0x32A6*4)
  153. #define TCP_WATCH3_ADDR_H (0x32A9*4)
  154. #define TCP_WATCH0_ADDR_L (0x32A1*4)
  155. #define TCP_WATCH1_ADDR_L (0x32A4*4)
  156. #define TCP_WATCH2_ADDR_L (0x32A7*4)
  157. #define TCP_WATCH3_ADDR_L (0x32AA*4)
  158. #define TCP_WATCH0_CNTL (0x32A2*4)
  159. #define TCP_WATCH1_CNTL (0x32A5*4)
  160. #define TCP_WATCH2_CNTL (0x32A8*4)
  161. #define TCP_WATCH3_CNTL (0x32AB*4)
  162. #define CPC_INT_CNTL 0xC2D0
  163. #define CP_HQD_IQ_RPTR 0xC970u
  164. #define SDMA0_RLC0_RB_CNTL 0xD400u
  165. #define SDMA_RB_VMID(x) (x << 24)
  166. #define SDMA0_RLC0_RB_BASE 0xD404u
  167. #define SDMA0_RLC0_RB_BASE_HI 0xD408u
  168. #define SDMA0_RLC0_RB_RPTR 0xD40Cu
  169. #define SDMA0_RLC0_RB_WPTR 0xD410u
  170. #define SDMA0_RLC0_RB_WPTR_POLL_CNTL 0xD414u
  171. #define SDMA0_RLC0_RB_WPTR_POLL_ADDR_HI 0xD418u
  172. #define SDMA0_RLC0_RB_WPTR_POLL_ADDR_LO 0xD41Cu
  173. #define SDMA0_RLC0_RB_RPTR_ADDR_HI 0xD420u
  174. #define SDMA0_RLC0_RB_RPTR_ADDR_LO 0xD424u
  175. #define SDMA0_RLC0_IB_CNTL 0xD428u
  176. #define SDMA0_RLC0_IB_RPTR 0xD42Cu
  177. #define SDMA0_RLC0_IB_OFFSET 0xD430u
  178. #define SDMA0_RLC0_IB_BASE_LO 0xD434u
  179. #define SDMA0_RLC0_IB_BASE_HI 0xD438u
  180. #define SDMA0_RLC0_IB_SIZE 0xD43Cu
  181. #define SDMA0_RLC0_SKIP_CNTL 0xD440u
  182. #define SDMA0_RLC0_CONTEXT_STATUS 0xD444u
  183. #define SDMA_RLC_IDLE (1 << 2)
  184. #define SDMA0_RLC0_DOORBELL 0xD448u
  185. #define SDMA_OFFSET(x) (x << 0)
  186. #define SDMA_DB_ENABLE (1 << 28)
  187. #define SDMA0_RLC0_VIRTUAL_ADDR 0xD49Cu
  188. #define SDMA_ATC (1 << 0)
  189. #define SDMA_VA_PTR32 (1 << 4)
  190. #define SDMA_VA_SHARED_BASE(x) (x << 8)
  191. #define SDMA0_RLC0_APE1_CNTL 0xD4A0u
  192. #define SDMA0_RLC0_DOORBELL_LOG 0xD4A4u
  193. #define SDMA0_RLC0_WATERMARK 0xD4A8u
  194. #define SDMA0_CNTL 0xD010
  195. #define SDMA1_CNTL 0xD810
  196. enum {
  197. MAX_TRAPID = 8, /* 3 bits in the bitfield. */
  198. MAX_WATCH_ADDRESSES = 4
  199. };
  200. enum {
  201. ADDRESS_WATCH_REG_ADDR_HI = 0,
  202. ADDRESS_WATCH_REG_ADDR_LO,
  203. ADDRESS_WATCH_REG_CNTL,
  204. ADDRESS_WATCH_REG_MAX
  205. };
  206. enum { /* not defined in the CI/KV reg file */
  207. ADDRESS_WATCH_REG_CNTL_ATC_BIT = 0x10000000UL,
  208. ADDRESS_WATCH_REG_CNTL_DEFAULT_MASK = 0x00FFFFFF,
  209. ADDRESS_WATCH_REG_ADDLOW_MASK_EXTENSION = 0x03000000,
  210. /* extend the mask to 26 bits in order to match the low address field */
  211. ADDRESS_WATCH_REG_ADDLOW_SHIFT = 6,
  212. ADDRESS_WATCH_REG_ADDHIGH_MASK = 0xFFFF
  213. };
  214. union TCP_WATCH_CNTL_BITS {
  215. struct {
  216. uint32_t mask:24;
  217. uint32_t vmid:4;
  218. uint32_t atc:1;
  219. uint32_t mode:2;
  220. uint32_t valid:1;
  221. } bitfields, bits;
  222. uint32_t u32All;
  223. signed int i32All;
  224. float f32All;
  225. };
  226. #endif