mali_midg_regmap.h 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565
  1. /*
  2. *
  3. * (C) COPYRIGHT 2010-2016 ARM Limited. All rights reserved.
  4. *
  5. * This program is free software and is provided to you under the terms of the
  6. * GNU General Public License version 2 as published by the Free Software
  7. * Foundation, and any use by you of this program is subject to the terms
  8. * of such GNU licence.
  9. *
  10. * A copy of the licence is included with the program, and can also be obtained
  11. * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  12. * Boston, MA 02110-1301, USA.
  13. *
  14. */
  15. #ifndef _MIDGARD_REGMAP_H_
  16. #define _MIDGARD_REGMAP_H_
  17. #include "mali_midg_coherency.h"
  18. #include "mali_kbase_gpu_id.h"
  19. /*
  20. * Begin Register Offsets
  21. */
  22. #define GPU_CONTROL_BASE 0x0000
  23. #define GPU_CONTROL_REG(r) (GPU_CONTROL_BASE + (r))
  24. #define GPU_ID 0x000 /* (RO) GPU and revision identifier */
  25. #define L2_FEATURES 0x004 /* (RO) Level 2 cache features */
  26. #define SUSPEND_SIZE 0x008 /* (RO) Fixed-function suspend buffer
  27. size */
  28. #define TILER_FEATURES 0x00C /* (RO) Tiler Features */
  29. #define MEM_FEATURES 0x010 /* (RO) Memory system features */
  30. #define MMU_FEATURES 0x014 /* (RO) MMU features */
  31. #define AS_PRESENT 0x018 /* (RO) Address space slots present */
  32. #define JS_PRESENT 0x01C /* (RO) Job slots present */
  33. #define GPU_IRQ_RAWSTAT 0x020 /* (RW) */
  34. #define GPU_IRQ_CLEAR 0x024 /* (WO) */
  35. #define GPU_IRQ_MASK 0x028 /* (RW) */
  36. #define GPU_IRQ_STATUS 0x02C /* (RO) */
  37. /* IRQ flags */
  38. #define GPU_FAULT (1 << 0) /* A GPU Fault has occurred */
  39. #define MULTIPLE_GPU_FAULTS (1 << 7) /* More than one GPU Fault occurred. */
  40. #define RESET_COMPLETED (1 << 8) /* Set when a reset has completed. Intended to use with SOFT_RESET
  41. commands which may take time. */
  42. #define POWER_CHANGED_SINGLE (1 << 9) /* Set when a single core has finished powering up or down. */
  43. #define POWER_CHANGED_ALL (1 << 10) /* Set when all cores have finished powering up or down
  44. and the power manager is idle. */
  45. #define PRFCNT_SAMPLE_COMPLETED (1 << 16) /* Set when a performance count sample has completed. */
  46. #define CLEAN_CACHES_COMPLETED (1 << 17) /* Set when a cache clean operation has completed. */
  47. #define GPU_IRQ_REG_ALL (GPU_FAULT | MULTIPLE_GPU_FAULTS | RESET_COMPLETED \
  48. | POWER_CHANGED_ALL | PRFCNT_SAMPLE_COMPLETED)
  49. #define GPU_COMMAND 0x030 /* (WO) */
  50. #define GPU_STATUS 0x034 /* (RO) */
  51. #define LATEST_FLUSH 0x038 /* (RO) */
  52. #define GROUPS_L2_COHERENT (1 << 0) /* Cores groups are l2 coherent */
  53. #define GPU_FAULTSTATUS 0x03C /* (RO) GPU exception type and fault status */
  54. #define GPU_FAULTADDRESS_LO 0x040 /* (RO) GPU exception fault address, low word */
  55. #define GPU_FAULTADDRESS_HI 0x044 /* (RO) GPU exception fault address, high word */
  56. #define PWR_KEY 0x050 /* (WO) Power manager key register */
  57. #define PWR_OVERRIDE0 0x054 /* (RW) Power manager override settings */
  58. #define PWR_OVERRIDE1 0x058 /* (RW) Power manager override settings */
  59. #define PRFCNT_BASE_LO 0x060 /* (RW) Performance counter memory region base address, low word */
  60. #define PRFCNT_BASE_HI 0x064 /* (RW) Performance counter memory region base address, high word */
  61. #define PRFCNT_CONFIG 0x068 /* (RW) Performance counter configuration */
  62. #define PRFCNT_JM_EN 0x06C /* (RW) Performance counter enable flags for Job Manager */
  63. #define PRFCNT_SHADER_EN 0x070 /* (RW) Performance counter enable flags for shader cores */
  64. #define PRFCNT_TILER_EN 0x074 /* (RW) Performance counter enable flags for tiler */
  65. #define PRFCNT_MMU_L2_EN 0x07C /* (RW) Performance counter enable flags for MMU/L2 cache */
  66. #define CYCLE_COUNT_LO 0x090 /* (RO) Cycle counter, low word */
  67. #define CYCLE_COUNT_HI 0x094 /* (RO) Cycle counter, high word */
  68. #define TIMESTAMP_LO 0x098 /* (RO) Global time stamp counter, low word */
  69. #define TIMESTAMP_HI 0x09C /* (RO) Global time stamp counter, high word */
  70. #define THREAD_MAX_THREADS 0x0A0 /* (RO) Maximum number of threads per core */
  71. #define THREAD_MAX_WORKGROUP_SIZE 0x0A4 /* (RO) Maximum workgroup size */
  72. #define THREAD_MAX_BARRIER_SIZE 0x0A8 /* (RO) Maximum threads waiting at a barrier */
  73. #define THREAD_FEATURES 0x0AC /* (RO) Thread features */
  74. #define TEXTURE_FEATURES_0 0x0B0 /* (RO) Support flags for indexed texture formats 0..31 */
  75. #define TEXTURE_FEATURES_1 0x0B4 /* (RO) Support flags for indexed texture formats 32..63 */
  76. #define TEXTURE_FEATURES_2 0x0B8 /* (RO) Support flags for indexed texture formats 64..95 */
  77. #define TEXTURE_FEATURES_REG(n) GPU_CONTROL_REG(TEXTURE_FEATURES_0 + ((n) << 2))
  78. #define JS0_FEATURES 0x0C0 /* (RO) Features of job slot 0 */
  79. #define JS1_FEATURES 0x0C4 /* (RO) Features of job slot 1 */
  80. #define JS2_FEATURES 0x0C8 /* (RO) Features of job slot 2 */
  81. #define JS3_FEATURES 0x0CC /* (RO) Features of job slot 3 */
  82. #define JS4_FEATURES 0x0D0 /* (RO) Features of job slot 4 */
  83. #define JS5_FEATURES 0x0D4 /* (RO) Features of job slot 5 */
  84. #define JS6_FEATURES 0x0D8 /* (RO) Features of job slot 6 */
  85. #define JS7_FEATURES 0x0DC /* (RO) Features of job slot 7 */
  86. #define JS8_FEATURES 0x0E0 /* (RO) Features of job slot 8 */
  87. #define JS9_FEATURES 0x0E4 /* (RO) Features of job slot 9 */
  88. #define JS10_FEATURES 0x0E8 /* (RO) Features of job slot 10 */
  89. #define JS11_FEATURES 0x0EC /* (RO) Features of job slot 11 */
  90. #define JS12_FEATURES 0x0F0 /* (RO) Features of job slot 12 */
  91. #define JS13_FEATURES 0x0F4 /* (RO) Features of job slot 13 */
  92. #define JS14_FEATURES 0x0F8 /* (RO) Features of job slot 14 */
  93. #define JS15_FEATURES 0x0FC /* (RO) Features of job slot 15 */
  94. #define JS_FEATURES_REG(n) GPU_CONTROL_REG(JS0_FEATURES + ((n) << 2))
  95. #define SHADER_PRESENT_LO 0x100 /* (RO) Shader core present bitmap, low word */
  96. #define SHADER_PRESENT_HI 0x104 /* (RO) Shader core present bitmap, high word */
  97. #define TILER_PRESENT_LO 0x110 /* (RO) Tiler core present bitmap, low word */
  98. #define TILER_PRESENT_HI 0x114 /* (RO) Tiler core present bitmap, high word */
  99. #define L2_PRESENT_LO 0x120 /* (RO) Level 2 cache present bitmap, low word */
  100. #define L2_PRESENT_HI 0x124 /* (RO) Level 2 cache present bitmap, high word */
  101. #define SHADER_READY_LO 0x140 /* (RO) Shader core ready bitmap, low word */
  102. #define SHADER_READY_HI 0x144 /* (RO) Shader core ready bitmap, high word */
  103. #define TILER_READY_LO 0x150 /* (RO) Tiler core ready bitmap, low word */
  104. #define TILER_READY_HI 0x154 /* (RO) Tiler core ready bitmap, high word */
  105. #define L2_READY_LO 0x160 /* (RO) Level 2 cache ready bitmap, low word */
  106. #define L2_READY_HI 0x164 /* (RO) Level 2 cache ready bitmap, high word */
  107. #define SHADER_PWRON_LO 0x180 /* (WO) Shader core power on bitmap, low word */
  108. #define SHADER_PWRON_HI 0x184 /* (WO) Shader core power on bitmap, high word */
  109. #define TILER_PWRON_LO 0x190 /* (WO) Tiler core power on bitmap, low word */
  110. #define TILER_PWRON_HI 0x194 /* (WO) Tiler core power on bitmap, high word */
  111. #define L2_PWRON_LO 0x1A0 /* (WO) Level 2 cache power on bitmap, low word */
  112. #define L2_PWRON_HI 0x1A4 /* (WO) Level 2 cache power on bitmap, high word */
  113. #define SHADER_PWROFF_LO 0x1C0 /* (WO) Shader core power off bitmap, low word */
  114. #define SHADER_PWROFF_HI 0x1C4 /* (WO) Shader core power off bitmap, high word */
  115. #define TILER_PWROFF_LO 0x1D0 /* (WO) Tiler core power off bitmap, low word */
  116. #define TILER_PWROFF_HI 0x1D4 /* (WO) Tiler core power off bitmap, high word */
  117. #define L2_PWROFF_LO 0x1E0 /* (WO) Level 2 cache power off bitmap, low word */
  118. #define L2_PWROFF_HI 0x1E4 /* (WO) Level 2 cache power off bitmap, high word */
  119. #define SHADER_PWRTRANS_LO 0x200 /* (RO) Shader core power transition bitmap, low word */
  120. #define SHADER_PWRTRANS_HI 0x204 /* (RO) Shader core power transition bitmap, high word */
  121. #define TILER_PWRTRANS_LO 0x210 /* (RO) Tiler core power transition bitmap, low word */
  122. #define TILER_PWRTRANS_HI 0x214 /* (RO) Tiler core power transition bitmap, high word */
  123. #define L2_PWRTRANS_LO 0x220 /* (RO) Level 2 cache power transition bitmap, low word */
  124. #define L2_PWRTRANS_HI 0x224 /* (RO) Level 2 cache power transition bitmap, high word */
  125. #define SHADER_PWRACTIVE_LO 0x240 /* (RO) Shader core active bitmap, low word */
  126. #define SHADER_PWRACTIVE_HI 0x244 /* (RO) Shader core active bitmap, high word */
  127. #define TILER_PWRACTIVE_LO 0x250 /* (RO) Tiler core active bitmap, low word */
  128. #define TILER_PWRACTIVE_HI 0x254 /* (RO) Tiler core active bitmap, high word */
  129. #define L2_PWRACTIVE_LO 0x260 /* (RO) Level 2 cache active bitmap, low word */
  130. #define L2_PWRACTIVE_HI 0x264 /* (RO) Level 2 cache active bitmap, high word */
  131. #define COHERENCY_FEATURES 0x300 /* (RO) Coherency features present */
  132. #define COHERENCY_ENABLE 0x304 /* (RW) Coherency enable */
  133. #define JM_CONFIG 0xF00 /* (RW) Job Manager configuration register (Implementation specific register) */
  134. #define SHADER_CONFIG 0xF04 /* (RW) Shader core configuration settings (Implementation specific register) */
  135. #define TILER_CONFIG 0xF08 /* (RW) Tiler core configuration settings (Implementation specific register) */
  136. #define L2_MMU_CONFIG 0xF0C /* (RW) Configuration of the L2 cache and MMU (Implementation specific register) */
  137. #define JOB_CONTROL_BASE 0x1000
  138. #define JOB_CONTROL_REG(r) (JOB_CONTROL_BASE + (r))
  139. #define JOB_IRQ_RAWSTAT 0x000 /* Raw interrupt status register */
  140. #define JOB_IRQ_CLEAR 0x004 /* Interrupt clear register */
  141. #define JOB_IRQ_MASK 0x008 /* Interrupt mask register */
  142. #define JOB_IRQ_STATUS 0x00C /* Interrupt status register */
  143. #define JOB_IRQ_JS_STATE 0x010 /* status==active and _next == busy snapshot from last JOB_IRQ_CLEAR */
  144. #define JOB_IRQ_THROTTLE 0x014 /* cycles to delay delivering an interrupt externally. The JOB_IRQ_STATUS is NOT affected by this, just the delivery of the interrupt. */
  145. #define JOB_SLOT0 0x800 /* Configuration registers for job slot 0 */
  146. #define JOB_SLOT1 0x880 /* Configuration registers for job slot 1 */
  147. #define JOB_SLOT2 0x900 /* Configuration registers for job slot 2 */
  148. #define JOB_SLOT3 0x980 /* Configuration registers for job slot 3 */
  149. #define JOB_SLOT4 0xA00 /* Configuration registers for job slot 4 */
  150. #define JOB_SLOT5 0xA80 /* Configuration registers for job slot 5 */
  151. #define JOB_SLOT6 0xB00 /* Configuration registers for job slot 6 */
  152. #define JOB_SLOT7 0xB80 /* Configuration registers for job slot 7 */
  153. #define JOB_SLOT8 0xC00 /* Configuration registers for job slot 8 */
  154. #define JOB_SLOT9 0xC80 /* Configuration registers for job slot 9 */
  155. #define JOB_SLOT10 0xD00 /* Configuration registers for job slot 10 */
  156. #define JOB_SLOT11 0xD80 /* Configuration registers for job slot 11 */
  157. #define JOB_SLOT12 0xE00 /* Configuration registers for job slot 12 */
  158. #define JOB_SLOT13 0xE80 /* Configuration registers for job slot 13 */
  159. #define JOB_SLOT14 0xF00 /* Configuration registers for job slot 14 */
  160. #define JOB_SLOT15 0xF80 /* Configuration registers for job slot 15 */
  161. #define JOB_SLOT_REG(n, r) (JOB_CONTROL_REG(JOB_SLOT0 + ((n) << 7)) + (r))
  162. #define JS_HEAD_LO 0x00 /* (RO) Job queue head pointer for job slot n, low word */
  163. #define JS_HEAD_HI 0x04 /* (RO) Job queue head pointer for job slot n, high word */
  164. #define JS_TAIL_LO 0x08 /* (RO) Job queue tail pointer for job slot n, low word */
  165. #define JS_TAIL_HI 0x0C /* (RO) Job queue tail pointer for job slot n, high word */
  166. #define JS_AFFINITY_LO 0x10 /* (RO) Core affinity mask for job slot n, low word */
  167. #define JS_AFFINITY_HI 0x14 /* (RO) Core affinity mask for job slot n, high word */
  168. #define JS_CONFIG 0x18 /* (RO) Configuration settings for job slot n */
  169. #define JS_COMMAND 0x20 /* (WO) Command register for job slot n */
  170. #define JS_STATUS 0x24 /* (RO) Status register for job slot n */
  171. #define JS_HEAD_NEXT_LO 0x40 /* (RW) Next job queue head pointer for job slot n, low word */
  172. #define JS_HEAD_NEXT_HI 0x44 /* (RW) Next job queue head pointer for job slot n, high word */
  173. #define JS_AFFINITY_NEXT_LO 0x50 /* (RW) Next core affinity mask for job slot n, low word */
  174. #define JS_AFFINITY_NEXT_HI 0x54 /* (RW) Next core affinity mask for job slot n, high word */
  175. #define JS_CONFIG_NEXT 0x58 /* (RW) Next configuration settings for job slot n */
  176. #define JS_COMMAND_NEXT 0x60 /* (RW) Next command register for job slot n */
  177. #define JS_FLUSH_ID_NEXT 0x70 /* (RW) Next job slot n cache flush ID */
  178. #define MEMORY_MANAGEMENT_BASE 0x2000
  179. #define MMU_REG(r) (MEMORY_MANAGEMENT_BASE + (r))
  180. #define MMU_IRQ_RAWSTAT 0x000 /* (RW) Raw interrupt status register */
  181. #define MMU_IRQ_CLEAR 0x004 /* (WO) Interrupt clear register */
  182. #define MMU_IRQ_MASK 0x008 /* (RW) Interrupt mask register */
  183. #define MMU_IRQ_STATUS 0x00C /* (RO) Interrupt status register */
  184. #define MMU_AS0 0x400 /* Configuration registers for address space 0 */
  185. #define MMU_AS1 0x440 /* Configuration registers for address space 1 */
  186. #define MMU_AS2 0x480 /* Configuration registers for address space 2 */
  187. #define MMU_AS3 0x4C0 /* Configuration registers for address space 3 */
  188. #define MMU_AS4 0x500 /* Configuration registers for address space 4 */
  189. #define MMU_AS5 0x540 /* Configuration registers for address space 5 */
  190. #define MMU_AS6 0x580 /* Configuration registers for address space 6 */
  191. #define MMU_AS7 0x5C0 /* Configuration registers for address space 7 */
  192. #define MMU_AS8 0x600 /* Configuration registers for address space 8 */
  193. #define MMU_AS9 0x640 /* Configuration registers for address space 9 */
  194. #define MMU_AS10 0x680 /* Configuration registers for address space 10 */
  195. #define MMU_AS11 0x6C0 /* Configuration registers for address space 11 */
  196. #define MMU_AS12 0x700 /* Configuration registers for address space 12 */
  197. #define MMU_AS13 0x740 /* Configuration registers for address space 13 */
  198. #define MMU_AS14 0x780 /* Configuration registers for address space 14 */
  199. #define MMU_AS15 0x7C0 /* Configuration registers for address space 15 */
  200. #define MMU_AS_REG(n, r) (MMU_REG(MMU_AS0 + ((n) << 6)) + (r))
  201. #define AS_TRANSTAB_LO 0x00 /* (RW) Translation Table Base Address for address space n, low word */
  202. #define AS_TRANSTAB_HI 0x04 /* (RW) Translation Table Base Address for address space n, high word */
  203. #define AS_MEMATTR_LO 0x08 /* (RW) Memory attributes for address space n, low word. */
  204. #define AS_MEMATTR_HI 0x0C /* (RW) Memory attributes for address space n, high word. */
  205. #define AS_LOCKADDR_LO 0x10 /* (RW) Lock region address for address space n, low word */
  206. #define AS_LOCKADDR_HI 0x14 /* (RW) Lock region address for address space n, high word */
  207. #define AS_COMMAND 0x18 /* (WO) MMU command register for address space n */
  208. #define AS_FAULTSTATUS 0x1C /* (RO) MMU fault status register for address space n */
  209. #define AS_FAULTADDRESS_LO 0x20 /* (RO) Fault Address for address space n, low word */
  210. #define AS_FAULTADDRESS_HI 0x24 /* (RO) Fault Address for address space n, high word */
  211. #define AS_STATUS 0x28 /* (RO) Status flags for address space n */
  212. /* (RW) Translation table configuration for address space n, low word */
  213. #define AS_TRANSCFG_LO 0x30
  214. /* (RW) Translation table configuration for address space n, high word */
  215. #define AS_TRANSCFG_HI 0x34
  216. /* (RO) Secondary fault address for address space n, low word */
  217. #define AS_FAULTEXTRA_LO 0x38
  218. /* (RO) Secondary fault address for address space n, high word */
  219. #define AS_FAULTEXTRA_HI 0x3C
  220. /* End Register Offsets */
  221. /*
  222. * MMU_IRQ_RAWSTAT register values. Values are valid also for
  223. MMU_IRQ_CLEAR, MMU_IRQ_MASK, MMU_IRQ_STATUS registers.
  224. */
  225. #define MMU_PAGE_FAULT_FLAGS 16
  226. /* Macros returning a bitmask to retrieve page fault or bus error flags from
  227. * MMU registers */
  228. #define MMU_PAGE_FAULT(n) (1UL << (n))
  229. #define MMU_BUS_ERROR(n) (1UL << ((n) + MMU_PAGE_FAULT_FLAGS))
  230. /*
  231. * Begin LPAE MMU TRANSTAB register values
  232. */
  233. #define AS_TRANSTAB_LPAE_ADDR_SPACE_MASK 0xfffff000
  234. #define AS_TRANSTAB_LPAE_ADRMODE_UNMAPPED (0u << 0)
  235. #define AS_TRANSTAB_LPAE_ADRMODE_IDENTITY (1u << 1)
  236. #define AS_TRANSTAB_LPAE_ADRMODE_TABLE (3u << 0)
  237. #define AS_TRANSTAB_LPAE_READ_INNER (1u << 2)
  238. #define AS_TRANSTAB_LPAE_SHARE_OUTER (1u << 4)
  239. #define AS_TRANSTAB_LPAE_ADRMODE_MASK 0x00000003
  240. /*
  241. * Begin AARCH64 MMU TRANSTAB register values
  242. */
  243. #define MMU_HW_OUTA_BITS 40
  244. #define AS_TRANSTAB_BASE_MASK ((1ULL << MMU_HW_OUTA_BITS) - (1ULL << 4))
  245. /*
  246. * Begin MMU STATUS register values
  247. */
  248. #define AS_STATUS_AS_ACTIVE 0x01
  249. #define AS_FAULTSTATUS_EXCEPTION_CODE_MASK (0x7<<3)
  250. #define AS_FAULTSTATUS_EXCEPTION_CODE_TRANSLATION_FAULT (0x0<<3)
  251. #define AS_FAULTSTATUS_EXCEPTION_CODE_PERMISSION_FAULT (0x1<<3)
  252. #define AS_FAULTSTATUS_EXCEPTION_CODE_TRANSTAB_BUS_FAULT (0x2<<3)
  253. #define AS_FAULTSTATUS_EXCEPTION_CODE_ACCESS_FLAG (0x3<<3)
  254. #define AS_FAULTSTATUS_EXCEPTION_CODE_ADDRESS_SIZE_FAULT (0x4<<3)
  255. #define AS_FAULTSTATUS_EXCEPTION_CODE_MEMORY_ATTRIBUTES_FAULT (0x5<<3)
  256. #define AS_FAULTSTATUS_ACCESS_TYPE_MASK (0x3<<8)
  257. #define AS_FAULTSTATUS_ACCESS_TYPE_ATOMIC (0x0<<8)
  258. #define AS_FAULTSTATUS_ACCESS_TYPE_EX (0x1<<8)
  259. #define AS_FAULTSTATUS_ACCESS_TYPE_READ (0x2<<8)
  260. #define AS_FAULTSTATUS_ACCESS_TYPE_WRITE (0x3<<8)
  261. /*
  262. * Begin MMU TRANSCFG register values
  263. */
  264. #define AS_TRANSCFG_ADRMODE_LEGACY 0
  265. #define AS_TRANSCFG_ADRMODE_UNMAPPED 1
  266. #define AS_TRANSCFG_ADRMODE_IDENTITY 2
  267. #define AS_TRANSCFG_ADRMODE_AARCH64_4K 6
  268. #define AS_TRANSCFG_ADRMODE_AARCH64_64K 8
  269. #define AS_TRANSCFG_ADRMODE_MASK 0xF
  270. /*
  271. * Begin TRANSCFG register values
  272. */
  273. #define AS_TRANSCFG_PTW_MEMATTR_MASK (3 << 24)
  274. #define AS_TRANSCFG_PTW_MEMATTR_NON_CACHEABLE (1 << 24)
  275. #define AS_TRANSCFG_PTW_MEMATTR_WRITE_BACK (2 << 24)
  276. #define AS_TRANSCFG_PTW_SH_MASK ((3 << 28))
  277. #define AS_TRANSCFG_PTW_SH_OS (2 << 28)
  278. #define AS_TRANSCFG_PTW_SH_IS (3 << 28)
  279. /*
  280. * Begin Command Values
  281. */
  282. /* JS_COMMAND register commands */
  283. #define JS_COMMAND_NOP 0x00 /* NOP Operation. Writing this value is ignored */
  284. #define JS_COMMAND_START 0x01 /* Start processing a job chain. Writing this value is ignored */
  285. #define JS_COMMAND_SOFT_STOP 0x02 /* Gently stop processing a job chain */
  286. #define JS_COMMAND_HARD_STOP 0x03 /* Rudely stop processing a job chain */
  287. #define JS_COMMAND_SOFT_STOP_0 0x04 /* Execute SOFT_STOP if JOB_CHAIN_FLAG is 0 */
  288. #define JS_COMMAND_HARD_STOP_0 0x05 /* Execute HARD_STOP if JOB_CHAIN_FLAG is 0 */
  289. #define JS_COMMAND_SOFT_STOP_1 0x06 /* Execute SOFT_STOP if JOB_CHAIN_FLAG is 1 */
  290. #define JS_COMMAND_HARD_STOP_1 0x07 /* Execute HARD_STOP if JOB_CHAIN_FLAG is 1 */
  291. #define JS_COMMAND_MASK 0x07 /* Mask of bits currently in use by the HW */
  292. /* AS_COMMAND register commands */
  293. #define AS_COMMAND_NOP 0x00 /* NOP Operation */
  294. #define AS_COMMAND_UPDATE 0x01 /* Broadcasts the values in AS_TRANSTAB and ASn_MEMATTR to all MMUs */
  295. #define AS_COMMAND_LOCK 0x02 /* Issue a lock region command to all MMUs */
  296. #define AS_COMMAND_UNLOCK 0x03 /* Issue a flush region command to all MMUs */
  297. #define AS_COMMAND_FLUSH 0x04 /* Flush all L2 caches then issue a flush region command to all MMUs
  298. (deprecated - only for use with T60x) */
  299. #define AS_COMMAND_FLUSH_PT 0x04 /* Flush all L2 caches then issue a flush region command to all MMUs */
  300. #define AS_COMMAND_FLUSH_MEM 0x05 /* Wait for memory accesses to complete, flush all the L1s cache then
  301. flush all L2 caches then issue a flush region command to all MMUs */
  302. /* Possible values of JS_CONFIG and JS_CONFIG_NEXT registers */
  303. #define JS_CONFIG_START_FLUSH_NO_ACTION (0u << 0)
  304. #define JS_CONFIG_START_FLUSH_CLEAN (1u << 8)
  305. #define JS_CONFIG_START_FLUSH_CLEAN_INVALIDATE (3u << 8)
  306. #define JS_CONFIG_START_MMU (1u << 10)
  307. #define JS_CONFIG_JOB_CHAIN_FLAG (1u << 11)
  308. #define JS_CONFIG_END_FLUSH_NO_ACTION JS_CONFIG_START_FLUSH_NO_ACTION
  309. #define JS_CONFIG_END_FLUSH_CLEAN (1u << 12)
  310. #define JS_CONFIG_END_FLUSH_CLEAN_INVALIDATE (3u << 12)
  311. #define JS_CONFIG_ENABLE_FLUSH_REDUCTION (1u << 14)
  312. #define JS_CONFIG_DISABLE_DESCRIPTOR_WR_BK (1u << 15)
  313. #define JS_CONFIG_THREAD_PRI(n) ((n) << 16)
  314. /* JS_STATUS register values */
  315. /* NOTE: Please keep this values in sync with enum base_jd_event_code in mali_base_kernel.h.
  316. * The values are separated to avoid dependency of userspace and kernel code.
  317. */
  318. /* Group of values representing the job status insead a particular fault */
  319. #define JS_STATUS_NO_EXCEPTION_BASE 0x00
  320. #define JS_STATUS_INTERRUPTED (JS_STATUS_NO_EXCEPTION_BASE + 0x02) /* 0x02 means INTERRUPTED */
  321. #define JS_STATUS_STOPPED (JS_STATUS_NO_EXCEPTION_BASE + 0x03) /* 0x03 means STOPPED */
  322. #define JS_STATUS_TERMINATED (JS_STATUS_NO_EXCEPTION_BASE + 0x04) /* 0x04 means TERMINATED */
  323. /* General fault values */
  324. #define JS_STATUS_FAULT_BASE 0x40
  325. #define JS_STATUS_CONFIG_FAULT (JS_STATUS_FAULT_BASE) /* 0x40 means CONFIG FAULT */
  326. #define JS_STATUS_POWER_FAULT (JS_STATUS_FAULT_BASE + 0x01) /* 0x41 means POWER FAULT */
  327. #define JS_STATUS_READ_FAULT (JS_STATUS_FAULT_BASE + 0x02) /* 0x42 means READ FAULT */
  328. #define JS_STATUS_WRITE_FAULT (JS_STATUS_FAULT_BASE + 0x03) /* 0x43 means WRITE FAULT */
  329. #define JS_STATUS_AFFINITY_FAULT (JS_STATUS_FAULT_BASE + 0x04) /* 0x44 means AFFINITY FAULT */
  330. #define JS_STATUS_BUS_FAULT (JS_STATUS_FAULT_BASE + 0x08) /* 0x48 means BUS FAULT */
  331. /* Instruction or data faults */
  332. #define JS_STATUS_INSTRUCTION_FAULT_BASE 0x50
  333. #define JS_STATUS_INSTR_INVALID_PC (JS_STATUS_INSTRUCTION_FAULT_BASE) /* 0x50 means INSTR INVALID PC */
  334. #define JS_STATUS_INSTR_INVALID_ENC (JS_STATUS_INSTRUCTION_FAULT_BASE + 0x01) /* 0x51 means INSTR INVALID ENC */
  335. #define JS_STATUS_INSTR_TYPE_MISMATCH (JS_STATUS_INSTRUCTION_FAULT_BASE + 0x02) /* 0x52 means INSTR TYPE MISMATCH */
  336. #define JS_STATUS_INSTR_OPERAND_FAULT (JS_STATUS_INSTRUCTION_FAULT_BASE + 0x03) /* 0x53 means INSTR OPERAND FAULT */
  337. #define JS_STATUS_INSTR_TLS_FAULT (JS_STATUS_INSTRUCTION_FAULT_BASE + 0x04) /* 0x54 means INSTR TLS FAULT */
  338. #define JS_STATUS_INSTR_BARRIER_FAULT (JS_STATUS_INSTRUCTION_FAULT_BASE + 0x05) /* 0x55 means INSTR BARRIER FAULT */
  339. #define JS_STATUS_INSTR_ALIGN_FAULT (JS_STATUS_INSTRUCTION_FAULT_BASE + 0x06) /* 0x56 means INSTR ALIGN FAULT */
  340. /* NOTE: No fault with 0x57 code defined in spec. */
  341. #define JS_STATUS_DATA_INVALID_FAULT (JS_STATUS_INSTRUCTION_FAULT_BASE + 0x08) /* 0x58 means DATA INVALID FAULT */
  342. #define JS_STATUS_TILE_RANGE_FAULT (JS_STATUS_INSTRUCTION_FAULT_BASE + 0x09) /* 0x59 means TILE RANGE FAULT */
  343. #define JS_STATUS_ADDRESS_RANGE_FAULT (JS_STATUS_INSTRUCTION_FAULT_BASE + 0x0A) /* 0x5A means ADDRESS RANGE FAULT */
  344. /* Other faults */
  345. #define JS_STATUS_MEMORY_FAULT_BASE 0x60
  346. #define JS_STATUS_OUT_OF_MEMORY (JS_STATUS_MEMORY_FAULT_BASE) /* 0x60 means OUT OF MEMORY */
  347. #define JS_STATUS_UNKNOWN 0x7F /* 0x7F means UNKNOWN */
  348. /* GPU_COMMAND values */
  349. #define GPU_COMMAND_NOP 0x00 /* No operation, nothing happens */
  350. #define GPU_COMMAND_SOFT_RESET 0x01 /* Stop all external bus interfaces, and then reset the entire GPU. */
  351. #define GPU_COMMAND_HARD_RESET 0x02 /* Immediately reset the entire GPU. */
  352. #define GPU_COMMAND_PRFCNT_CLEAR 0x03 /* Clear all performance counters, setting them all to zero. */
  353. #define GPU_COMMAND_PRFCNT_SAMPLE 0x04 /* Sample all performance counters, writing them out to memory */
  354. #define GPU_COMMAND_CYCLE_COUNT_START 0x05 /* Starts the cycle counter, and system timestamp propagation */
  355. #define GPU_COMMAND_CYCLE_COUNT_STOP 0x06 /* Stops the cycle counter, and system timestamp propagation */
  356. #define GPU_COMMAND_CLEAN_CACHES 0x07 /* Clean all caches */
  357. #define GPU_COMMAND_CLEAN_INV_CACHES 0x08 /* Clean and invalidate all caches */
  358. #define GPU_COMMAND_SET_PROTECTED_MODE 0x09 /* Places the GPU in protected mode */
  359. /* End Command Values */
  360. /* GPU_STATUS values */
  361. #define GPU_STATUS_PRFCNT_ACTIVE (1 << 2) /* Set if the performance counters are active. */
  362. #define GPU_STATUS_PROTECTED_MODE_ACTIVE (1 << 7) /* Set if protected mode is active */
  363. /* PRFCNT_CONFIG register values */
  364. #define PRFCNT_CONFIG_MODE_SHIFT 0 /* Counter mode position. */
  365. #define PRFCNT_CONFIG_AS_SHIFT 4 /* Address space bitmap position. */
  366. #define PRFCNT_CONFIG_SETSELECT_SHIFT 8 /* Set select position. */
  367. #define PRFCNT_CONFIG_MODE_OFF 0 /* The performance counters are disabled. */
  368. #define PRFCNT_CONFIG_MODE_MANUAL 1 /* The performance counters are enabled, but are only written out when a PRFCNT_SAMPLE command is issued using the GPU_COMMAND register. */
  369. #define PRFCNT_CONFIG_MODE_TILE 2 /* The performance counters are enabled, and are written out each time a tile finishes rendering. */
  370. /* AS<n>_MEMATTR values: */
  371. /* Use GPU implementation-defined caching policy. */
  372. #define AS_MEMATTR_IMPL_DEF_CACHE_POLICY 0x88ull
  373. /* The attribute set to force all resources to be cached. */
  374. #define AS_MEMATTR_FORCE_TO_CACHE_ALL 0x8Full
  375. /* Inner write-alloc cache setup, no outer caching */
  376. #define AS_MEMATTR_WRITE_ALLOC 0x8Dull
  377. /* Set to implementation defined, outer caching */
  378. #define AS_MEMATTR_AARCH64_OUTER_IMPL_DEF 0x88ull
  379. /* Set to write back memory, outer caching */
  380. #define AS_MEMATTR_AARCH64_OUTER_WA 0x8Dull
  381. /* Use GPU implementation-defined caching policy. */
  382. #define AS_MEMATTR_LPAE_IMPL_DEF_CACHE_POLICY 0x48ull
  383. /* The attribute set to force all resources to be cached. */
  384. #define AS_MEMATTR_LPAE_FORCE_TO_CACHE_ALL 0x4Full
  385. /* Inner write-alloc cache setup, no outer caching */
  386. #define AS_MEMATTR_LPAE_WRITE_ALLOC 0x4Dull
  387. /* Set to implementation defined, outer caching */
  388. #define AS_MEMATTR_LPAE_OUTER_IMPL_DEF 0x88ull
  389. /* Set to write back memory, outer caching */
  390. #define AS_MEMATTR_LPAE_OUTER_WA 0x8Dull
  391. /* Symbol for default MEMATTR to use */
  392. /* Default is - HW implementation defined caching */
  393. #define AS_MEMATTR_INDEX_DEFAULT 0
  394. #define AS_MEMATTR_INDEX_DEFAULT_ACE 3
  395. /* HW implementation defined caching */
  396. #define AS_MEMATTR_INDEX_IMPL_DEF_CACHE_POLICY 0
  397. /* Force cache on */
  398. #define AS_MEMATTR_INDEX_FORCE_TO_CACHE_ALL 1
  399. /* Write-alloc */
  400. #define AS_MEMATTR_INDEX_WRITE_ALLOC 2
  401. /* Outer coherent, inner implementation defined policy */
  402. #define AS_MEMATTR_INDEX_OUTER_IMPL_DEF 3
  403. /* Outer coherent, write alloc inner */
  404. #define AS_MEMATTR_INDEX_OUTER_WA 4
  405. /* JS<n>_FEATURES register */
  406. #define JS_FEATURE_NULL_JOB (1u << 1)
  407. #define JS_FEATURE_SET_VALUE_JOB (1u << 2)
  408. #define JS_FEATURE_CACHE_FLUSH_JOB (1u << 3)
  409. #define JS_FEATURE_COMPUTE_JOB (1u << 4)
  410. #define JS_FEATURE_VERTEX_JOB (1u << 5)
  411. #define JS_FEATURE_GEOMETRY_JOB (1u << 6)
  412. #define JS_FEATURE_TILER_JOB (1u << 7)
  413. #define JS_FEATURE_FUSED_JOB (1u << 8)
  414. #define JS_FEATURE_FRAGMENT_JOB (1u << 9)
  415. /* End JS<n>_FEATURES register */
  416. /* L2_MMU_CONFIG register */
  417. #define L2_MMU_CONFIG_ALLOW_SNOOP_DISPARITY_SHIFT (23)
  418. #define L2_MMU_CONFIG_ALLOW_SNOOP_DISPARITY (0x1 << L2_MMU_CONFIG_ALLOW_SNOOP_DISPARITY_SHIFT)
  419. #define L2_MMU_CONFIG_LIMIT_EXTERNAL_READS_SHIFT (24)
  420. #define L2_MMU_CONFIG_LIMIT_EXTERNAL_READS (0x3 << L2_MMU_CONFIG_LIMIT_EXTERNAL_READS_SHIFT)
  421. #define L2_MMU_CONFIG_LIMIT_EXTERNAL_READS_OCTANT (0x1 << L2_MMU_CONFIG_LIMIT_EXTERNAL_READS_SHIFT)
  422. #define L2_MMU_CONFIG_LIMIT_EXTERNAL_READS_QUARTER (0x2 << L2_MMU_CONFIG_LIMIT_EXTERNAL_READS_SHIFT)
  423. #define L2_MMU_CONFIG_LIMIT_EXTERNAL_READS_HALF (0x3 << L2_MMU_CONFIG_LIMIT_EXTERNAL_READS_SHIFT)
  424. #define L2_MMU_CONFIG_LIMIT_EXTERNAL_WRITES_SHIFT (26)
  425. #define L2_MMU_CONFIG_LIMIT_EXTERNAL_WRITES (0x3 << L2_MMU_CONFIG_LIMIT_EXTERNAL_WRITES_SHIFT)
  426. #define L2_MMU_CONFIG_LIMIT_EXTERNAL_WRITES_OCTANT (0x1 << L2_MMU_CONFIG_LIMIT_EXTERNAL_WRITES_SHIFT)
  427. #define L2_MMU_CONFIG_LIMIT_EXTERNAL_WRITES_QUARTER (0x2 << L2_MMU_CONFIG_LIMIT_EXTERNAL_WRITES_SHIFT)
  428. #define L2_MMU_CONFIG_LIMIT_EXTERNAL_WRITES_HALF (0x3 << L2_MMU_CONFIG_LIMIT_EXTERNAL_WRITES_SHIFT)
  429. /* End L2_MMU_CONFIG register */
  430. /* THREAD_* registers */
  431. /* THREAD_FEATURES IMPLEMENTATION_TECHNOLOGY values */
  432. #define IMPLEMENTATION_UNSPECIFIED 0
  433. #define IMPLEMENTATION_SILICON 1
  434. #define IMPLEMENTATION_FPGA 2
  435. #define IMPLEMENTATION_MODEL 3
  436. /* Default values when registers are not supported by the implemented hardware */
  437. #define THREAD_MT_DEFAULT 256
  438. #define THREAD_MWS_DEFAULT 256
  439. #define THREAD_MBS_DEFAULT 256
  440. #define THREAD_MR_DEFAULT 1024
  441. #define THREAD_MTQ_DEFAULT 4
  442. #define THREAD_MTGS_DEFAULT 10
  443. /* End THREAD_* registers */
  444. /* SHADER_CONFIG register */
  445. #define SC_ALT_COUNTERS (1ul << 3)
  446. #define SC_OVERRIDE_FWD_PIXEL_KILL (1ul << 4)
  447. #define SC_SDC_DISABLE_OQ_DISCARD (1ul << 6)
  448. #define SC_LS_ALLOW_ATTR_TYPES (1ul << 16)
  449. #define SC_LS_PAUSEBUFFER_DISABLE (1ul << 16)
  450. #define SC_LS_ATTR_CHECK_DISABLE (1ul << 18)
  451. #define SC_ENABLE_TEXGRD_FLAGS (1ul << 25)
  452. /* End SHADER_CONFIG register */
  453. /* TILER_CONFIG register */
  454. #define TC_CLOCK_GATE_OVERRIDE (1ul << 0)
  455. /* End TILER_CONFIG register */
  456. #endif // ifndef _MIDGARD_REGMAP_H_