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