a6xx_hfi.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* Copyright (c) 2017 The Linux Foundation. All rights reserved. */
  3. #ifndef _A6XX_HFI_H_
  4. #define _A6XX_HFI_H_
  5. struct a6xx_hfi_queue_table_header {
  6. u32 version;
  7. u32 size; /* Size of the queue table in dwords */
  8. u32 qhdr0_offset; /* Offset of the first queue header */
  9. u32 qhdr_size; /* Size of the queue headers */
  10. u32 num_queues; /* Number of total queues */
  11. u32 active_queues; /* Number of active queues */
  12. };
  13. struct a6xx_hfi_queue_header {
  14. u32 status;
  15. u32 iova;
  16. u32 type;
  17. u32 size;
  18. u32 msg_size;
  19. u32 dropped;
  20. u32 rx_watermark;
  21. u32 tx_watermark;
  22. u32 rx_request;
  23. u32 tx_request;
  24. u32 read_index;
  25. u32 write_index;
  26. };
  27. struct a6xx_hfi_queue {
  28. struct a6xx_hfi_queue_header *header;
  29. spinlock_t lock;
  30. u32 *data;
  31. atomic_t seqnum;
  32. };
  33. /* This is the outgoing queue to the GMU */
  34. #define HFI_COMMAND_QUEUE 0
  35. /* THis is the incoming response queue from the GMU */
  36. #define HFI_RESPONSE_QUEUE 1
  37. #define HFI_HEADER_ID(msg) ((msg) & 0xff)
  38. #define HFI_HEADER_SIZE(msg) (((msg) >> 8) & 0xff)
  39. #define HFI_HEADER_SEQNUM(msg) (((msg) >> 20) & 0xfff)
  40. /* FIXME: Do we need this or can we use ARRAY_SIZE? */
  41. #define HFI_RESPONSE_PAYLOAD_SIZE 16
  42. /* HFI message types */
  43. #define HFI_MSG_CMD 0
  44. #define HFI_MSG_ACK 2
  45. #define HFI_F2H_MSG_ACK 126
  46. struct a6xx_hfi_msg_response {
  47. u32 header;
  48. u32 ret_header;
  49. u32 error;
  50. u32 payload[HFI_RESPONSE_PAYLOAD_SIZE];
  51. };
  52. #define HFI_F2H_MSG_ERROR 100
  53. struct a6xx_hfi_msg_error {
  54. u32 header;
  55. u32 code;
  56. u32 payload[2];
  57. };
  58. #define HFI_H2F_MSG_INIT 0
  59. struct a6xx_hfi_msg_gmu_init_cmd {
  60. u32 header;
  61. u32 seg_id;
  62. u32 dbg_buffer_addr;
  63. u32 dbg_buffer_size;
  64. u32 boot_state;
  65. };
  66. #define HFI_H2F_MSG_FW_VERSION 1
  67. struct a6xx_hfi_msg_fw_version {
  68. u32 header;
  69. u32 supported_version;
  70. };
  71. #define HFI_H2F_MSG_PERF_TABLE 4
  72. struct perf_level {
  73. u32 vote;
  74. u32 freq;
  75. };
  76. struct a6xx_hfi_msg_perf_table {
  77. u32 header;
  78. u32 num_gpu_levels;
  79. u32 num_gmu_levels;
  80. struct perf_level gx_votes[16];
  81. struct perf_level cx_votes[4];
  82. };
  83. #define HFI_H2F_MSG_BW_TABLE 3
  84. struct a6xx_hfi_msg_bw_table {
  85. u32 header;
  86. u32 bw_level_num;
  87. u32 cnoc_cmds_num;
  88. u32 ddr_cmds_num;
  89. u32 cnoc_wait_bitmask;
  90. u32 ddr_wait_bitmask;
  91. u32 cnoc_cmds_addrs[6];
  92. u32 cnoc_cmds_data[2][6];
  93. u32 ddr_cmds_addrs[8];
  94. u32 ddr_cmds_data[16][8];
  95. };
  96. #define HFI_H2F_MSG_TEST 5
  97. struct a6xx_hfi_msg_test {
  98. u32 header;
  99. };
  100. #endif