kfd_dbgdev.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  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 KFD_DBGDEV_H_
  23. #define KFD_DBGDEV_H_
  24. enum {
  25. SQ_CMD_VMID_OFFSET = 28,
  26. ADDRESS_WATCH_CNTL_OFFSET = 24
  27. };
  28. enum {
  29. PRIV_QUEUE_SYNC_TIME_MS = 200
  30. };
  31. /* CONTEXT reg space definition */
  32. enum {
  33. CONTEXT_REG_BASE = 0xA000,
  34. CONTEXT_REG_END = 0xA400,
  35. CONTEXT_REG_SIZE = CONTEXT_REG_END - CONTEXT_REG_BASE
  36. };
  37. /* USER CONFIG reg space definition */
  38. enum {
  39. USERCONFIG_REG_BASE = 0xC000,
  40. USERCONFIG_REG_END = 0x10000,
  41. USERCONFIG_REG_SIZE = USERCONFIG_REG_END - USERCONFIG_REG_BASE
  42. };
  43. /* CONFIG reg space definition */
  44. enum {
  45. AMD_CONFIG_REG_BASE = 0x2000, /* in dwords */
  46. AMD_CONFIG_REG_END = 0x2B00,
  47. AMD_CONFIG_REG_SIZE = AMD_CONFIG_REG_END - AMD_CONFIG_REG_BASE
  48. };
  49. /* SH reg space definition */
  50. enum {
  51. SH_REG_BASE = 0x2C00,
  52. SH_REG_END = 0x3000,
  53. SH_REG_SIZE = SH_REG_END - SH_REG_BASE
  54. };
  55. enum SQ_IND_CMD_CMD {
  56. SQ_IND_CMD_CMD_NULL = 0x00000000,
  57. SQ_IND_CMD_CMD_HALT = 0x00000001,
  58. SQ_IND_CMD_CMD_RESUME = 0x00000002,
  59. SQ_IND_CMD_CMD_KILL = 0x00000003,
  60. SQ_IND_CMD_CMD_DEBUG = 0x00000004,
  61. SQ_IND_CMD_CMD_TRAP = 0x00000005,
  62. };
  63. enum SQ_IND_CMD_MODE {
  64. SQ_IND_CMD_MODE_SINGLE = 0x00000000,
  65. SQ_IND_CMD_MODE_BROADCAST = 0x00000001,
  66. SQ_IND_CMD_MODE_BROADCAST_QUEUE = 0x00000002,
  67. SQ_IND_CMD_MODE_BROADCAST_PIPE = 0x00000003,
  68. SQ_IND_CMD_MODE_BROADCAST_ME = 0x00000004,
  69. };
  70. union SQ_IND_INDEX_BITS {
  71. struct {
  72. uint32_t wave_id:4;
  73. uint32_t simd_id:2;
  74. uint32_t thread_id:6;
  75. uint32_t:1;
  76. uint32_t force_read:1;
  77. uint32_t read_timeout:1;
  78. uint32_t unindexed:1;
  79. uint32_t index:16;
  80. } bitfields, bits;
  81. uint32_t u32All;
  82. signed int i32All;
  83. float f32All;
  84. };
  85. union SQ_IND_CMD_BITS {
  86. struct {
  87. uint32_t data:32;
  88. } bitfields, bits;
  89. uint32_t u32All;
  90. signed int i32All;
  91. float f32All;
  92. };
  93. union SQ_CMD_BITS {
  94. struct {
  95. uint32_t cmd:3;
  96. uint32_t:1;
  97. uint32_t mode:3;
  98. uint32_t check_vmid:1;
  99. uint32_t trap_id:3;
  100. uint32_t:5;
  101. uint32_t wave_id:4;
  102. uint32_t simd_id:2;
  103. uint32_t:2;
  104. uint32_t queue_id:3;
  105. uint32_t:1;
  106. uint32_t vm_id:4;
  107. } bitfields, bits;
  108. uint32_t u32All;
  109. signed int i32All;
  110. float f32All;
  111. };
  112. union SQ_IND_DATA_BITS {
  113. struct {
  114. uint32_t data:32;
  115. } bitfields, bits;
  116. uint32_t u32All;
  117. signed int i32All;
  118. float f32All;
  119. };
  120. union GRBM_GFX_INDEX_BITS {
  121. struct {
  122. uint32_t instance_index:8;
  123. uint32_t sh_index:8;
  124. uint32_t se_index:8;
  125. uint32_t:5;
  126. uint32_t sh_broadcast_writes:1;
  127. uint32_t instance_broadcast_writes:1;
  128. uint32_t se_broadcast_writes:1;
  129. } bitfields, bits;
  130. uint32_t u32All;
  131. signed int i32All;
  132. float f32All;
  133. };
  134. union TCP_WATCH_ADDR_H_BITS {
  135. struct {
  136. uint32_t addr:16;
  137. uint32_t:16;
  138. } bitfields, bits;
  139. uint32_t u32All;
  140. signed int i32All;
  141. float f32All;
  142. };
  143. union TCP_WATCH_ADDR_L_BITS {
  144. struct {
  145. uint32_t:6;
  146. uint32_t addr:26;
  147. } bitfields, bits;
  148. uint32_t u32All;
  149. signed int i32All;
  150. float f32All;
  151. };
  152. enum {
  153. QUEUESTATE__INVALID = 0, /* so by default we'll get invalid state */
  154. QUEUESTATE__ACTIVE_COMPLETION_PENDING,
  155. QUEUESTATE__ACTIVE
  156. };
  157. union ULARGE_INTEGER {
  158. struct {
  159. uint32_t low_part;
  160. uint32_t high_part;
  161. } u;
  162. unsigned long long quad_part;
  163. };
  164. #define KFD_CIK_VMID_START_OFFSET (8)
  165. #define KFD_CIK_VMID_END_OFFSET (KFD_CIK_VMID_START_OFFSET + (8))
  166. void kfd_dbgdev_init(struct kfd_dbgdev *pdbgdev, struct kfd_dev *pdev,
  167. enum DBGDEV_TYPE type);
  168. #endif /* KFD_DBGDEV_H_ */