discovery.h 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. /*
  2. * Copyright 2018 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 _DISCOVERY_H_
  24. #define _DISCOVERY_H_
  25. #define PSP_HEADER_SIZE 256
  26. #define BINARY_SIGNATURE 0x28211407
  27. #define DISCOVERY_TABLE_SIGNATURE 0x53445049
  28. #define GC_TABLE_ID 0x4347
  29. #define HARVEST_TABLE_SIGNATURE 0x56524148
  30. #define VCN_INFO_TABLE_ID 0x004E4356
  31. #define MALL_INFO_TABLE_ID 0x4D414C4C
  32. typedef enum
  33. {
  34. IP_DISCOVERY = 0,
  35. GC,
  36. HARVEST_INFO,
  37. VCN_INFO,
  38. MALL_INFO,
  39. RESERVED_1,
  40. TOTAL_TABLES = 6
  41. } table;
  42. #pragma pack(1)
  43. typedef struct table_info
  44. {
  45. uint16_t offset; /* Byte offset */
  46. uint16_t checksum; /* Byte sum of the table */
  47. uint16_t size; /* Table size */
  48. uint16_t padding;
  49. } table_info;
  50. typedef struct binary_header
  51. {
  52. /* psp structure should go at the top of this structure */
  53. uint32_t binary_signature; /* 0x7, 0x14, 0x21, 0x28 */
  54. uint16_t version_major;
  55. uint16_t version_minor;
  56. uint16_t binary_checksum; /* Byte sum of the binary after this field */
  57. uint16_t binary_size; /* Binary Size*/
  58. table_info table_list[TOTAL_TABLES];
  59. } binary_header;
  60. typedef struct die_info
  61. {
  62. uint16_t die_id;
  63. uint16_t die_offset; /* Points to the corresponding die_header structure */
  64. } die_info;
  65. typedef struct ip_discovery_header
  66. {
  67. uint32_t signature; /* Table Signature */
  68. uint16_t version; /* Table Version */
  69. uint16_t size; /* Table Size */
  70. uint32_t id; /* Table ID */
  71. uint16_t num_dies; /* Number of Dies */
  72. die_info die_info[16]; /* list die information for up to 16 dies */
  73. uint16_t padding[1]; /* padding */
  74. } ip_discovery_header;
  75. typedef struct ip
  76. {
  77. uint16_t hw_id; /* Hardware ID */
  78. uint8_t number_instance; /* instance of the IP */
  79. uint8_t num_base_address; /* Number of Base Addresses */
  80. uint8_t major; /* HCID Major */
  81. uint8_t minor; /* HCID Minor */
  82. uint8_t revision; /* HCID Revision */
  83. #if defined(__BIG_ENDIAN)
  84. uint8_t reserved : 4; /* Placeholder field */
  85. uint8_t harvest : 4; /* Harvest */
  86. #else
  87. uint8_t harvest : 4; /* Harvest */
  88. uint8_t reserved : 4; /* Placeholder field */
  89. #endif
  90. uint32_t base_address[]; /* variable number of Addresses */
  91. } ip;
  92. typedef struct ip_v3
  93. {
  94. uint16_t hw_id; /* Hardware ID */
  95. uint8_t instance_number; /* Instance number for the IP */
  96. uint8_t num_base_address; /* Number of base addresses*/
  97. uint8_t major; /* Hardware ID.major version */
  98. uint8_t minor; /* Hardware ID.minor version */
  99. uint8_t revision; /* Hardware ID.revision version */
  100. #if defined(__BIG_ENDIAN)
  101. uint8_t variant : 4; /* HW variant */
  102. uint8_t sub_revision : 4; /* HCID Sub-Revision */
  103. #else
  104. uint8_t sub_revision : 4; /* HCID Sub-Revision */
  105. uint8_t variant : 4; /* HW variant */
  106. #endif
  107. uint32_t base_address[1]; /* Base Address list. Corresponds to the num_base_address field*/
  108. } ip_v3;
  109. typedef struct die_header
  110. {
  111. uint16_t die_id;
  112. uint16_t num_ips;
  113. } die_header;
  114. typedef struct ip_structure
  115. {
  116. ip_discovery_header* header;
  117. struct die
  118. {
  119. die_header *die_header;
  120. union
  121. {
  122. ip *ip_list;
  123. ip_v3 *ip_v3_list;
  124. }; /* IP list. Variable size*/
  125. } die;
  126. } ip_structure;
  127. struct gpu_info_header {
  128. uint32_t table_id; /* table ID */
  129. uint16_t version_major; /* table version */
  130. uint16_t version_minor; /* table version */
  131. uint32_t size; /* size of the entire header+data in bytes */
  132. };
  133. struct gc_info_v1_0 {
  134. struct gpu_info_header header;
  135. uint32_t gc_num_se;
  136. uint32_t gc_num_wgp0_per_sa;
  137. uint32_t gc_num_wgp1_per_sa;
  138. uint32_t gc_num_rb_per_se;
  139. uint32_t gc_num_gl2c;
  140. uint32_t gc_num_gprs;
  141. uint32_t gc_num_max_gs_thds;
  142. uint32_t gc_gs_table_depth;
  143. uint32_t gc_gsprim_buff_depth;
  144. uint32_t gc_parameter_cache_depth;
  145. uint32_t gc_double_offchip_lds_buffer;
  146. uint32_t gc_wave_size;
  147. uint32_t gc_max_waves_per_simd;
  148. uint32_t gc_max_scratch_slots_per_cu;
  149. uint32_t gc_lds_size;
  150. uint32_t gc_num_sc_per_se;
  151. uint32_t gc_num_sa_per_se;
  152. uint32_t gc_num_packer_per_sc;
  153. uint32_t gc_num_gl2a;
  154. };
  155. struct gc_info_v1_1 {
  156. struct gpu_info_header header;
  157. uint32_t gc_num_se;
  158. uint32_t gc_num_wgp0_per_sa;
  159. uint32_t gc_num_wgp1_per_sa;
  160. uint32_t gc_num_rb_per_se;
  161. uint32_t gc_num_gl2c;
  162. uint32_t gc_num_gprs;
  163. uint32_t gc_num_max_gs_thds;
  164. uint32_t gc_gs_table_depth;
  165. uint32_t gc_gsprim_buff_depth;
  166. uint32_t gc_parameter_cache_depth;
  167. uint32_t gc_double_offchip_lds_buffer;
  168. uint32_t gc_wave_size;
  169. uint32_t gc_max_waves_per_simd;
  170. uint32_t gc_max_scratch_slots_per_cu;
  171. uint32_t gc_lds_size;
  172. uint32_t gc_num_sc_per_se;
  173. uint32_t gc_num_sa_per_se;
  174. uint32_t gc_num_packer_per_sc;
  175. uint32_t gc_num_gl2a;
  176. uint32_t gc_num_tcp_per_sa;
  177. uint32_t gc_num_sdp_interface;
  178. uint32_t gc_num_tcps;
  179. };
  180. struct gc_info_v1_2 {
  181. struct gpu_info_header header;
  182. uint32_t gc_num_se;
  183. uint32_t gc_num_wgp0_per_sa;
  184. uint32_t gc_num_wgp1_per_sa;
  185. uint32_t gc_num_rb_per_se;
  186. uint32_t gc_num_gl2c;
  187. uint32_t gc_num_gprs;
  188. uint32_t gc_num_max_gs_thds;
  189. uint32_t gc_gs_table_depth;
  190. uint32_t gc_gsprim_buff_depth;
  191. uint32_t gc_parameter_cache_depth;
  192. uint32_t gc_double_offchip_lds_buffer;
  193. uint32_t gc_wave_size;
  194. uint32_t gc_max_waves_per_simd;
  195. uint32_t gc_max_scratch_slots_per_cu;
  196. uint32_t gc_lds_size;
  197. uint32_t gc_num_sc_per_se;
  198. uint32_t gc_num_sa_per_se;
  199. uint32_t gc_num_packer_per_sc;
  200. uint32_t gc_num_gl2a;
  201. uint32_t gc_num_tcp_per_sa;
  202. uint32_t gc_num_sdp_interface;
  203. uint32_t gc_num_tcps;
  204. uint32_t gc_num_tcp_per_wpg;
  205. uint32_t gc_tcp_l1_size;
  206. uint32_t gc_num_sqc_per_wgp;
  207. uint32_t gc_l1_instruction_cache_size_per_sqc;
  208. uint32_t gc_l1_data_cache_size_per_sqc;
  209. uint32_t gc_gl1c_per_sa;
  210. uint32_t gc_gl1c_size_per_instance;
  211. uint32_t gc_gl2c_per_gpu;
  212. };
  213. struct gc_info_v2_0 {
  214. struct gpu_info_header header;
  215. uint32_t gc_num_se;
  216. uint32_t gc_num_cu_per_sh;
  217. uint32_t gc_num_sh_per_se;
  218. uint32_t gc_num_rb_per_se;
  219. uint32_t gc_num_tccs;
  220. uint32_t gc_num_gprs;
  221. uint32_t gc_num_max_gs_thds;
  222. uint32_t gc_gs_table_depth;
  223. uint32_t gc_gsprim_buff_depth;
  224. uint32_t gc_parameter_cache_depth;
  225. uint32_t gc_double_offchip_lds_buffer;
  226. uint32_t gc_wave_size;
  227. uint32_t gc_max_waves_per_simd;
  228. uint32_t gc_max_scratch_slots_per_cu;
  229. uint32_t gc_lds_size;
  230. uint32_t gc_num_sc_per_se;
  231. uint32_t gc_num_packer_per_sc;
  232. };
  233. typedef struct harvest_info_header {
  234. uint32_t signature; /* Table Signature */
  235. uint32_t version; /* Table Version */
  236. } harvest_info_header;
  237. typedef struct harvest_info {
  238. uint16_t hw_id; /* Hardware ID */
  239. uint8_t number_instance; /* Instance of the IP */
  240. uint8_t reserved; /* Reserved for alignment */
  241. } harvest_info;
  242. typedef struct harvest_table {
  243. harvest_info_header header;
  244. harvest_info list[32];
  245. } harvest_table;
  246. struct mall_info_header {
  247. uint32_t table_id; /* table ID */
  248. uint16_t version_major; /* table version */
  249. uint16_t version_minor; /* table version */
  250. uint32_t size_bytes; /* size of the entire header+data in bytes */
  251. };
  252. struct mall_info_v1_0 {
  253. struct mall_info_header header;
  254. uint32_t mall_size_per_m;
  255. uint32_t m_s_present;
  256. uint32_t m_half_use;
  257. uint32_t m_mall_config;
  258. uint32_t reserved[5];
  259. };
  260. #define VCN_INFO_TABLE_MAX_NUM_INSTANCES 4
  261. struct vcn_info_header {
  262. uint32_t table_id; /* table ID */
  263. uint16_t version_major; /* table version */
  264. uint16_t version_minor; /* table version */
  265. uint32_t size_bytes; /* size of the entire header+data in bytes */
  266. };
  267. struct vcn_instance_info_v1_0
  268. {
  269. uint32_t instance_num; /* VCN IP instance number. 0 - VCN0; 1 - VCN1 etc*/
  270. union _fuse_data {
  271. struct {
  272. uint32_t av1_disabled : 1;
  273. uint32_t vp9_disabled : 1;
  274. uint32_t hevc_disabled : 1;
  275. uint32_t h264_disabled : 1;
  276. uint32_t reserved : 28;
  277. } bits;
  278. uint32_t all_bits;
  279. } fuse_data;
  280. uint32_t reserved[2];
  281. };
  282. struct vcn_info_v1_0 {
  283. struct vcn_info_header header;
  284. uint32_t num_of_instances; /* number of entries used in instance_info below*/
  285. struct vcn_instance_info_v1_0 instance_info[VCN_INFO_TABLE_MAX_NUM_INSTANCES];
  286. uint32_t reserved[4];
  287. };
  288. #pragma pack()
  289. #endif