si_enums.h 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. /*
  2. * Copyright 2016 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. */
  23. #ifndef SI_ENUMS_H
  24. #define SI_ENUMS_H
  25. #define AMDGPU_NUM_OF_VMIDS 8
  26. #define SI_CRTC0_REGISTER_OFFSET 0
  27. #define SI_CRTC1_REGISTER_OFFSET 0x300
  28. #define SI_CRTC2_REGISTER_OFFSET 0x2600
  29. #define SI_CRTC3_REGISTER_OFFSET 0x2900
  30. #define SI_CRTC4_REGISTER_OFFSET 0x2c00
  31. #define SI_CRTC5_REGISTER_OFFSET 0x2f00
  32. #define DMA0_REGISTER_OFFSET 0x000
  33. #define DMA1_REGISTER_OFFSET 0x200
  34. #define ES_AND_GS_AUTO 3
  35. #define RADEON_PACKET_TYPE3 3
  36. #define CE_PARTITION_BASE 3
  37. #define BUF_SWAP_32BIT (2 << 16)
  38. #define GFX_POWER_STATUS (1 << 1)
  39. #define GFX_CLOCK_STATUS (1 << 2)
  40. #define GFX_LS_STATUS (1 << 3)
  41. #define RLC_BUSY_STATUS (1 << 0)
  42. #define RLC_PUD(x) ((x) << 0)
  43. #define RLC_PUD_MASK (0xff << 0)
  44. #define RLC_PDD(x) ((x) << 8)
  45. #define RLC_PDD_MASK (0xff << 8)
  46. #define RLC_TTPD(x) ((x) << 16)
  47. #define RLC_TTPD_MASK (0xff << 16)
  48. #define RLC_MSD(x) ((x) << 24)
  49. #define RLC_MSD_MASK (0xff << 24)
  50. #define WRITE_DATA_ENGINE_SEL(x) ((x) << 30)
  51. #define WRITE_DATA_DST_SEL(x) ((x) << 8)
  52. #define EVENT_TYPE(x) ((x) << 0)
  53. #define EVENT_INDEX(x) ((x) << 8)
  54. #define WAIT_REG_MEM_MEM_SPACE(x) ((x) << 4)
  55. #define WAIT_REG_MEM_FUNCTION(x) ((x) << 0)
  56. #define WAIT_REG_MEM_ENGINE(x) ((x) << 8)
  57. #define GFX6_NUM_GFX_RINGS 1
  58. #define GFX6_NUM_COMPUTE_RINGS 2
  59. #define RLC_SAVE_AND_RESTORE_STARTING_OFFSET 0x90
  60. #define RLC_CLEAR_STATE_DESCRIPTOR_OFFSET 0x3D
  61. #define TAHITI_GB_ADDR_CONFIG_GOLDEN 0x12011003
  62. #define VERDE_GB_ADDR_CONFIG_GOLDEN 0x12010002
  63. #define HAINAN_GB_ADDR_CONFIG_GOLDEN 0x02010001
  64. #define PACKET3(op, n) ((RADEON_PACKET_TYPE3 << 30) | \
  65. (((op) & 0xFF) << 8) | \
  66. ((n) & 0x3FFF) << 16)
  67. #define PACKET3_COMPUTE(op, n) (PACKET3(op, n) | 1 << 1)
  68. #define PACKET3_NOP 0x10
  69. #define PACKET3_SET_BASE 0x11
  70. #define PACKET3_BASE_INDEX(x) ((x) << 0)
  71. #define PACKET3_CLEAR_STATE 0x12
  72. #define PACKET3_INDEX_BUFFER_SIZE 0x13
  73. #define PACKET3_DISPATCH_DIRECT 0x15
  74. #define PACKET3_DISPATCH_INDIRECT 0x16
  75. #define PACKET3_ALLOC_GDS 0x1B
  76. #define PACKET3_WRITE_GDS_RAM 0x1C
  77. #define PACKET3_ATOMIC_GDS 0x1D
  78. #define PACKET3_ATOMIC 0x1E
  79. #define PACKET3_OCCLUSION_QUERY 0x1F
  80. #define PACKET3_SET_PREDICATION 0x20
  81. #define PACKET3_REG_RMW 0x21
  82. #define PACKET3_COND_EXEC 0x22
  83. #define PACKET3_PRED_EXEC 0x23
  84. #define PACKET3_DRAW_INDIRECT 0x24
  85. #define PACKET3_DRAW_INDEX_INDIRECT 0x25
  86. #define PACKET3_INDEX_BASE 0x26
  87. #define PACKET3_DRAW_INDEX_2 0x27
  88. #define PACKET3_CONTEXT_CONTROL 0x28
  89. #define PACKET3_INDEX_TYPE 0x2A
  90. #define PACKET3_DRAW_INDIRECT_MULTI 0x2C
  91. #define PACKET3_DRAW_INDEX_AUTO 0x2D
  92. #define PACKET3_DRAW_INDEX_IMMD 0x2E
  93. #define PACKET3_NUM_INSTANCES 0x2F
  94. #define PACKET3_DRAW_INDEX_MULTI_AUTO 0x30
  95. #define PACKET3_INDIRECT_BUFFER_CONST 0x31
  96. #define PACKET3_INDIRECT_BUFFER 0x3F
  97. #define PACKET3_STRMOUT_BUFFER_UPDATE 0x34
  98. #define PACKET3_DRAW_INDEX_OFFSET_2 0x35
  99. #define PACKET3_DRAW_INDEX_MULTI_ELEMENT 0x36
  100. #define PACKET3_WRITE_DATA 0x37
  101. #define PACKET3_DRAW_INDEX_INDIRECT_MULTI 0x38
  102. #define PACKET3_MEM_SEMAPHORE 0x39
  103. #define PACKET3_MPEG_INDEX 0x3A
  104. #define PACKET3_COPY_DW 0x3B
  105. #define PACKET3_WAIT_REG_MEM 0x3C
  106. #define PACKET3_MEM_WRITE 0x3D
  107. #define PACKET3_COPY_DATA 0x40
  108. #define PACKET3_CP_DMA 0x41
  109. # define PACKET3_CP_DMA_DST_SEL(x) ((x) << 20)
  110. # define PACKET3_CP_DMA_ENGINE(x) ((x) << 27)
  111. # define PACKET3_CP_DMA_SRC_SEL(x) ((x) << 29)
  112. # define PACKET3_CP_DMA_CP_SYNC (1 << 31)
  113. # define PACKET3_CP_DMA_DIS_WC (1 << 21)
  114. # define PACKET3_CP_DMA_CMD_SRC_SWAP(x) ((x) << 22)
  115. # define PACKET3_CP_DMA_CMD_DST_SWAP(x) ((x) << 24)
  116. # define PACKET3_CP_DMA_CMD_SAS (1 << 26)
  117. # define PACKET3_CP_DMA_CMD_DAS (1 << 27)
  118. # define PACKET3_CP_DMA_CMD_SAIC (1 << 28)
  119. # define PACKET3_CP_DMA_CMD_DAIC (1 << 29)
  120. # define PACKET3_CP_DMA_CMD_RAW_WAIT (1 << 30)
  121. #define PACKET3_PFP_SYNC_ME 0x42
  122. #define PACKET3_SURFACE_SYNC 0x43
  123. # define PACKET3_DEST_BASE_0_ENA (1 << 0)
  124. # define PACKET3_DEST_BASE_1_ENA (1 << 1)
  125. # define PACKET3_CB0_DEST_BASE_ENA (1 << 6)
  126. # define PACKET3_CB1_DEST_BASE_ENA (1 << 7)
  127. # define PACKET3_CB2_DEST_BASE_ENA (1 << 8)
  128. # define PACKET3_CB3_DEST_BASE_ENA (1 << 9)
  129. # define PACKET3_CB4_DEST_BASE_ENA (1 << 10)
  130. # define PACKET3_CB5_DEST_BASE_ENA (1 << 11)
  131. # define PACKET3_CB6_DEST_BASE_ENA (1 << 12)
  132. # define PACKET3_CB7_DEST_BASE_ENA (1 << 13)
  133. # define PACKET3_DB_DEST_BASE_ENA (1 << 14)
  134. # define PACKET3_DEST_BASE_2_ENA (1 << 19)
  135. # define PACKET3_DEST_BASE_3_ENA (1 << 21)
  136. # define PACKET3_TCL1_ACTION_ENA (1 << 22)
  137. # define PACKET3_TC_ACTION_ENA (1 << 23)
  138. # define PACKET3_CB_ACTION_ENA (1 << 25)
  139. # define PACKET3_DB_ACTION_ENA (1 << 26)
  140. # define PACKET3_SH_KCACHE_ACTION_ENA (1 << 27)
  141. # define PACKET3_SH_ICACHE_ACTION_ENA (1 << 29)
  142. #define PACKET3_ME_INITIALIZE 0x44
  143. #define PACKET3_ME_INITIALIZE_DEVICE_ID(x) ((x) << 16)
  144. #define PACKET3_COND_WRITE 0x45
  145. #define PACKET3_EVENT_WRITE 0x46
  146. #define PACKET3_EVENT_WRITE_EOP 0x47
  147. #define PACKET3_EVENT_WRITE_EOS 0x48
  148. #define PACKET3_PREAMBLE_CNTL 0x4A
  149. # define PACKET3_PREAMBLE_BEGIN_CLEAR_STATE (2 << 28)
  150. # define PACKET3_PREAMBLE_END_CLEAR_STATE (3 << 28)
  151. #define PACKET3_ONE_REG_WRITE 0x57
  152. #define PACKET3_LOAD_CONFIG_REG 0x5F
  153. #define PACKET3_LOAD_CONTEXT_REG 0x60
  154. #define PACKET3_LOAD_SH_REG 0x61
  155. #define PACKET3_SET_CONFIG_REG 0x68
  156. #define PACKET3_SET_CONFIG_REG_START 0x00002000
  157. #define PACKET3_SET_CONFIG_REG_END 0x00002c00
  158. #define PACKET3_SET_CONTEXT_REG 0x69
  159. #define PACKET3_SET_CONTEXT_REG_START 0x000a000
  160. #define PACKET3_SET_CONTEXT_REG_END 0x000a400
  161. #define PACKET3_SET_CONTEXT_REG_INDIRECT 0x73
  162. #define PACKET3_SET_RESOURCE_INDIRECT 0x74
  163. #define PACKET3_SET_SH_REG 0x76
  164. #define PACKET3_SET_SH_REG_START 0x00002c00
  165. #define PACKET3_SET_SH_REG_END 0x00003000
  166. #define PACKET3_SET_SH_REG_OFFSET 0x77
  167. #define PACKET3_ME_WRITE 0x7A
  168. #define PACKET3_SCRATCH_RAM_WRITE 0x7D
  169. #define PACKET3_SCRATCH_RAM_READ 0x7E
  170. #define PACKET3_CE_WRITE 0x7F
  171. #define PACKET3_LOAD_CONST_RAM 0x80
  172. #define PACKET3_WRITE_CONST_RAM 0x81
  173. #define PACKET3_WRITE_CONST_RAM_OFFSET 0x82
  174. #define PACKET3_DUMP_CONST_RAM 0x83
  175. #define PACKET3_INCREMENT_CE_COUNTER 0x84
  176. #define PACKET3_INCREMENT_DE_COUNTER 0x85
  177. #define PACKET3_WAIT_ON_CE_COUNTER 0x86
  178. #define PACKET3_WAIT_ON_DE_COUNTER 0x87
  179. #define PACKET3_WAIT_ON_DE_COUNTER_DIFF 0x88
  180. #define PACKET3_SET_CE_DE_COUNTERS 0x89
  181. #define PACKET3_WAIT_ON_AVAIL_BUFFER 0x8A
  182. #define PACKET3_SWITCH_BUFFER 0x8B
  183. #define PACKET3_SEM_WAIT_ON_SIGNAL (0x1 << 12)
  184. #define PACKET3_SEM_SEL_SIGNAL (0x6 << 29)
  185. #define PACKET3_SEM_SEL_WAIT (0x7 << 29)
  186. #endif