kfd_pm4_headers.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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. */
  23. #ifndef KFD_PM4_HEADERS_H_
  24. #define KFD_PM4_HEADERS_H_
  25. #ifndef PM4_MES_HEADER_DEFINED
  26. #define PM4_MES_HEADER_DEFINED
  27. union PM4_MES_TYPE_3_HEADER {
  28. struct {
  29. /* reserved */
  30. uint32_t reserved1:8;
  31. /* IT opcode */
  32. uint32_t opcode:8;
  33. /* number of DWORDs - 1 in the information body */
  34. uint32_t count:14;
  35. /* packet identifier. It should be 3 for type 3 packets */
  36. uint32_t type:2;
  37. };
  38. uint32_t u32all;
  39. };
  40. #endif /* PM4_MES_HEADER_DEFINED */
  41. /*--------------------MES_MAP_PROCESS-------------------- */
  42. #ifndef PM4_MES_MAP_PROCESS_DEFINED
  43. #define PM4_MES_MAP_PROCESS_DEFINED
  44. struct pm4_map_process {
  45. union {
  46. union PM4_MES_TYPE_3_HEADER header; /* header */
  47. uint32_t ordinal1;
  48. };
  49. union {
  50. struct {
  51. uint32_t pasid:16;
  52. uint32_t reserved1:8;
  53. uint32_t diq_enable:1;
  54. uint32_t process_quantum:7;
  55. } bitfields2;
  56. uint32_t ordinal2;
  57. };
  58. union {
  59. struct {
  60. uint32_t page_table_base:28;
  61. uint32_t reserved3:4;
  62. } bitfields3;
  63. uint32_t ordinal3;
  64. };
  65. uint32_t sh_mem_bases;
  66. uint32_t sh_mem_ape1_base;
  67. uint32_t sh_mem_ape1_limit;
  68. uint32_t sh_mem_config;
  69. uint32_t gds_addr_lo;
  70. uint32_t gds_addr_hi;
  71. union {
  72. struct {
  73. uint32_t num_gws:6;
  74. uint32_t reserved4:2;
  75. uint32_t num_oac:4;
  76. uint32_t reserved5:4;
  77. uint32_t gds_size:6;
  78. uint32_t num_queues:10;
  79. } bitfields10;
  80. uint32_t ordinal10;
  81. };
  82. };
  83. #endif
  84. #ifndef PM4_MES_MAP_PROCESS_DEFINED_KV_SCRATCH
  85. #define PM4_MES_MAP_PROCESS_DEFINED_KV_SCRATCH
  86. struct pm4_map_process_scratch_kv {
  87. union {
  88. union PM4_MES_TYPE_3_HEADER header; /* header */
  89. uint32_t ordinal1;
  90. };
  91. union {
  92. struct {
  93. uint32_t pasid:16;
  94. uint32_t reserved1:8;
  95. uint32_t diq_enable:1;
  96. uint32_t process_quantum:7;
  97. } bitfields2;
  98. uint32_t ordinal2;
  99. };
  100. union {
  101. struct {
  102. uint32_t page_table_base:28;
  103. uint32_t reserved2:4;
  104. } bitfields3;
  105. uint32_t ordinal3;
  106. };
  107. uint32_t reserved3;
  108. uint32_t sh_mem_bases;
  109. uint32_t sh_mem_config;
  110. uint32_t sh_mem_ape1_base;
  111. uint32_t sh_mem_ape1_limit;
  112. uint32_t sh_hidden_private_base_vmid;
  113. uint32_t reserved4;
  114. uint32_t reserved5;
  115. uint32_t gds_addr_lo;
  116. uint32_t gds_addr_hi;
  117. union {
  118. struct {
  119. uint32_t num_gws:6;
  120. uint32_t reserved6:2;
  121. uint32_t num_oac:4;
  122. uint32_t reserved7:4;
  123. uint32_t gds_size:6;
  124. uint32_t num_queues:10;
  125. } bitfields14;
  126. uint32_t ordinal14;
  127. };
  128. uint32_t completion_signal_lo32;
  129. uint32_t completion_signal_hi32;
  130. };
  131. #endif
  132. enum {
  133. CACHE_FLUSH_AND_INV_TS_EVENT = 0x00000014
  134. };
  135. #endif /* KFD_PM4_HEADERS_H_ */