rv515d.h 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. /*
  2. * Copyright 2008 Advanced Micro Devices, Inc.
  3. * Copyright 2008 Red Hat Inc.
  4. * Copyright 2009 Jerome Glisse.
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining a
  7. * copy of this software and associated documentation files (the "Software"),
  8. * to deal in the Software without restriction, including without limitation
  9. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  10. * and/or sell copies of the Software, and to permit persons to whom the
  11. * Software is furnished to do so, subject to the following conditions:
  12. *
  13. * The above copyright notice and this permission notice shall be included in
  14. * all copies or substantial portions of the Software.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  19. * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  20. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  21. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  22. * OTHER DEALINGS IN THE SOFTWARE.
  23. *
  24. * Authors: Dave Airlie
  25. * Alex Deucher
  26. * Jerome Glisse
  27. */
  28. #ifndef __RV515D_H__
  29. #define __RV515D_H__
  30. /*
  31. * RV515 registers
  32. */
  33. #define PCIE_INDEX 0x0030
  34. #define PCIE_DATA 0x0034
  35. #define MC_IND_INDEX 0x0070
  36. #define MC_IND_WR_EN (1 << 24)
  37. #define MC_IND_DATA 0x0074
  38. #define RBBM_SOFT_RESET 0x00F0
  39. #define CONFIG_MEMSIZE 0x00F8
  40. #define HDP_FB_LOCATION 0x0134
  41. #define CP_CSQ_CNTL 0x0740
  42. #define CP_CSQ_MODE 0x0744
  43. #define CP_CSQ_ADDR 0x07F0
  44. #define CP_CSQ_DATA 0x07F4
  45. #define CP_CSQ_STAT 0x07F8
  46. #define CP_CSQ2_STAT 0x07FC
  47. #define RBBM_STATUS 0x0E40
  48. #define DST_PIPE_CONFIG 0x170C
  49. #define WAIT_UNTIL 0x1720
  50. #define WAIT_2D_IDLE (1 << 14)
  51. #define WAIT_3D_IDLE (1 << 15)
  52. #define WAIT_2D_IDLECLEAN (1 << 16)
  53. #define WAIT_3D_IDLECLEAN (1 << 17)
  54. #define ISYNC_CNTL 0x1724
  55. #define ISYNC_ANY2D_IDLE3D (1 << 0)
  56. #define ISYNC_ANY3D_IDLE2D (1 << 1)
  57. #define ISYNC_TRIG2D_IDLE3D (1 << 2)
  58. #define ISYNC_TRIG3D_IDLE2D (1 << 3)
  59. #define ISYNC_WAIT_IDLEGUI (1 << 4)
  60. #define ISYNC_CPSCRATCH_IDLEGUI (1 << 5)
  61. #define VAP_INDEX_OFFSET 0x208C
  62. #define VAP_PVS_STATE_FLUSH_REG 0x2284
  63. #define GB_ENABLE 0x4008
  64. #define GB_MSPOS0 0x4010
  65. #define MS_X0_SHIFT 0
  66. #define MS_Y0_SHIFT 4
  67. #define MS_X1_SHIFT 8
  68. #define MS_Y1_SHIFT 12
  69. #define MS_X2_SHIFT 16
  70. #define MS_Y2_SHIFT 20
  71. #define MSBD0_Y_SHIFT 24
  72. #define MSBD0_X_SHIFT 28
  73. #define GB_MSPOS1 0x4014
  74. #define MS_X3_SHIFT 0
  75. #define MS_Y3_SHIFT 4
  76. #define MS_X4_SHIFT 8
  77. #define MS_Y4_SHIFT 12
  78. #define MS_X5_SHIFT 16
  79. #define MS_Y5_SHIFT 20
  80. #define MSBD1_SHIFT 24
  81. #define GB_TILE_CONFIG 0x4018
  82. #define ENABLE_TILING (1 << 0)
  83. #define PIPE_COUNT_MASK 0x0000000E
  84. #define PIPE_COUNT_SHIFT 1
  85. #define TILE_SIZE_8 (0 << 4)
  86. #define TILE_SIZE_16 (1 << 4)
  87. #define TILE_SIZE_32 (2 << 4)
  88. #define SUBPIXEL_1_12 (0 << 16)
  89. #define SUBPIXEL_1_16 (1 << 16)
  90. #define GB_SELECT 0x401C
  91. #define GB_AA_CONFIG 0x4020
  92. #define GB_PIPE_SELECT 0x402C
  93. #define GA_ENHANCE 0x4274
  94. #define GA_DEADLOCK_CNTL (1 << 0)
  95. #define GA_FASTSYNC_CNTL (1 << 1)
  96. #define GA_POLY_MODE 0x4288
  97. #define FRONT_PTYPE_POINT (0 << 4)
  98. #define FRONT_PTYPE_LINE (1 << 4)
  99. #define FRONT_PTYPE_TRIANGE (2 << 4)
  100. #define BACK_PTYPE_POINT (0 << 7)
  101. #define BACK_PTYPE_LINE (1 << 7)
  102. #define BACK_PTYPE_TRIANGE (2 << 7)
  103. #define GA_ROUND_MODE 0x428C
  104. #define GEOMETRY_ROUND_TRUNC (0 << 0)
  105. #define GEOMETRY_ROUND_NEAREST (1 << 0)
  106. #define COLOR_ROUND_TRUNC (0 << 2)
  107. #define COLOR_ROUND_NEAREST (1 << 2)
  108. #define SU_REG_DEST 0x42C8
  109. #define RB3D_DSTCACHE_CTLSTAT 0x4E4C
  110. #define RB3D_DC_FLUSH (2 << 0)
  111. #define RB3D_DC_FREE (2 << 2)
  112. #define RB3D_DC_FINISH (1 << 4)
  113. #define ZB_ZCACHE_CTLSTAT 0x4F18
  114. #define ZC_FLUSH (1 << 0)
  115. #define ZC_FREE (1 << 1)
  116. #define DC_LB_MEMORY_SPLIT 0x6520
  117. #define DC_LB_MEMORY_SPLIT_MASK 0x00000003
  118. #define DC_LB_MEMORY_SPLIT_SHIFT 0
  119. #define DC_LB_MEMORY_SPLIT_D1HALF_D2HALF 0
  120. #define DC_LB_MEMORY_SPLIT_D1_3Q_D2_1Q 1
  121. #define DC_LB_MEMORY_SPLIT_D1_ONLY 2
  122. #define DC_LB_MEMORY_SPLIT_D1_1Q_D2_3Q 3
  123. #define DC_LB_MEMORY_SPLIT_SHIFT_MODE (1 << 2)
  124. #define DC_LB_DISP1_END_ADR_SHIFT 4
  125. #define DC_LB_DISP1_END_ADR_MASK 0x00007FF0
  126. #define D1MODE_PRIORITY_A_CNT 0x6548
  127. #define MODE_PRIORITY_MARK_MASK 0x00007FFF
  128. #define MODE_PRIORITY_OFF (1 << 16)
  129. #define MODE_PRIORITY_ALWAYS_ON (1 << 20)
  130. #define MODE_PRIORITY_FORCE_MASK (1 << 24)
  131. #define D1MODE_PRIORITY_B_CNT 0x654C
  132. #define LB_MAX_REQ_OUTSTANDING 0x6D58
  133. #define LB_D1_MAX_REQ_OUTSTANDING_MASK 0x0000000F
  134. #define LB_D1_MAX_REQ_OUTSTANDING_SHIFT 0
  135. #define LB_D2_MAX_REQ_OUTSTANDING_MASK 0x000F0000
  136. #define LB_D2_MAX_REQ_OUTSTANDING_SHIFT 16
  137. #define D2MODE_PRIORITY_A_CNT 0x6D48
  138. #define D2MODE_PRIORITY_B_CNT 0x6D4C
  139. /* ix[MC] registers */
  140. #define MC_FB_LOCATION 0x01
  141. #define MC_FB_START_MASK 0x0000FFFF
  142. #define MC_FB_START_SHIFT 0
  143. #define MC_FB_TOP_MASK 0xFFFF0000
  144. #define MC_FB_TOP_SHIFT 16
  145. #define MC_AGP_LOCATION 0x02
  146. #define MC_AGP_START_MASK 0x0000FFFF
  147. #define MC_AGP_START_SHIFT 0
  148. #define MC_AGP_TOP_MASK 0xFFFF0000
  149. #define MC_AGP_TOP_SHIFT 16
  150. #define MC_AGP_BASE 0x03
  151. #define MC_AGP_BASE_2 0x04
  152. #define MC_CNTL 0x5
  153. #define MEM_NUM_CHANNELS_MASK 0x00000003
  154. #define MC_STATUS 0x08
  155. #define MC_STATUS_IDLE (1 << 4)
  156. #define MC_MISC_LAT_TIMER 0x09
  157. #define MC_CPR_INIT_LAT_MASK 0x0000000F
  158. #define MC_VF_INIT_LAT_MASK 0x000000F0
  159. #define MC_DISP0R_INIT_LAT_MASK 0x00000F00
  160. #define MC_DISP0R_INIT_LAT_SHIFT 8
  161. #define MC_DISP1R_INIT_LAT_MASK 0x0000F000
  162. #define MC_DISP1R_INIT_LAT_SHIFT 12
  163. #define MC_FIXED_INIT_LAT_MASK 0x000F0000
  164. #define MC_E2R_INIT_LAT_MASK 0x00F00000
  165. #define SAME_PAGE_PRIO_MASK 0x0F000000
  166. #define MC_GLOBW_INIT_LAT_MASK 0xF0000000
  167. /*
  168. * PM4 packet
  169. */
  170. #define CP_PACKET0 0x00000000
  171. #define PACKET0_BASE_INDEX_SHIFT 0
  172. #define PACKET0_BASE_INDEX_MASK (0x1ffff << 0)
  173. #define PACKET0_COUNT_SHIFT 16
  174. #define PACKET0_COUNT_MASK (0x3fff << 16)
  175. #define CP_PACKET1 0x40000000
  176. #define CP_PACKET2 0x80000000
  177. #define PACKET2_PAD_SHIFT 0
  178. #define PACKET2_PAD_MASK (0x3fffffff << 0)
  179. #define CP_PACKET3 0xC0000000
  180. #define PACKET3_IT_OPCODE_SHIFT 8
  181. #define PACKET3_IT_OPCODE_MASK (0xff << 8)
  182. #define PACKET3_COUNT_SHIFT 16
  183. #define PACKET3_COUNT_MASK (0x3fff << 16)
  184. /* PACKET3 op code */
  185. #define PACKET3_NOP 0x10
  186. #define PACKET3_3D_DRAW_VBUF 0x28
  187. #define PACKET3_3D_DRAW_IMMD 0x29
  188. #define PACKET3_3D_DRAW_INDX 0x2A
  189. #define PACKET3_3D_LOAD_VBPNTR 0x2F
  190. #define PACKET3_INDX_BUFFER 0x33
  191. #define PACKET3_3D_DRAW_VBUF_2 0x34
  192. #define PACKET3_3D_DRAW_IMMD_2 0x35
  193. #define PACKET3_3D_DRAW_INDX_2 0x36
  194. #define PACKET3_BITBLT_MULTI 0x9B
  195. #define PACKET0(reg, n) (CP_PACKET0 | \
  196. REG_SET(PACKET0_BASE_INDEX, (reg) >> 2) | \
  197. REG_SET(PACKET0_COUNT, (n)))
  198. #define PACKET2(v) (CP_PACKET2 | REG_SET(PACKET2_PAD, (v)))
  199. #define PACKET3(op, n) (CP_PACKET3 | \
  200. REG_SET(PACKET3_IT_OPCODE, (op)) | \
  201. REG_SET(PACKET3_COUNT, (n)))
  202. #define PACKET_TYPE0 0
  203. #define PACKET_TYPE1 1
  204. #define PACKET_TYPE2 2
  205. #define PACKET_TYPE3 3
  206. #define CP_PACKET_GET_TYPE(h) (((h) >> 30) & 3)
  207. #define CP_PACKET_GET_COUNT(h) (((h) >> 16) & 0x3FFF)
  208. #define CP_PACKET0_GET_REG(h) (((h) & 0x1FFF) << 2)
  209. #define CP_PACKET0_GET_ONE_REG_WR(h) (((h) >> 15) & 1)
  210. #define CP_PACKET3_GET_OPCODE(h) (((h) >> 8) & 0xFF)
  211. #endif