1bf215546Sopenharmony_ci/*
2bf215546Sopenharmony_ci * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
3bf215546Sopenharmony_ci *
4bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
5bf215546Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
6bf215546Sopenharmony_ci * to deal in the Software without restriction, including without limitation
7bf215546Sopenharmony_ci * on the rights to use, copy, modify, merge, publish, distribute, sub
8bf215546Sopenharmony_ci * license, and/or sell copies of the Software, and to permit persons to whom
9bf215546Sopenharmony_ci * the Software is furnished to do so, subject to the following conditions:
10bf215546Sopenharmony_ci *
11bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the next
12bf215546Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the
13bf215546Sopenharmony_ci * Software.
14bf215546Sopenharmony_ci *
15bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16bf215546Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18bf215546Sopenharmony_ci * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19bf215546Sopenharmony_ci * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20bf215546Sopenharmony_ci * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21bf215546Sopenharmony_ci * USE OR OTHER DEALINGS IN THE SOFTWARE.
22bf215546Sopenharmony_ci *
23bf215546Sopenharmony_ci * Authors:
24bf215546Sopenharmony_ci *      Jerome Glisse
25bf215546Sopenharmony_ci */
26bf215546Sopenharmony_ci#ifndef R600_SQ_H
27bf215546Sopenharmony_ci#define R600_SQ_H
28bf215546Sopenharmony_ci
29bf215546Sopenharmony_ci#define P_SQ_CF_WORD0
30bf215546Sopenharmony_ci#define   S_SQ_CF_WORD0_ADDR(x)                                      (((unsigned)(x) & 0xFFFFFFFF) << 0)
31bf215546Sopenharmony_ci#define   G_SQ_CF_WORD0_ADDR(x)                                      (((x) >> 0) & 0xFFFFFFFF)
32bf215546Sopenharmony_ci#define   C_SQ_CF_WORD0_ADDR                                         0x00000000
33bf215546Sopenharmony_ci#define P_SQ_CF_WORD1
34bf215546Sopenharmony_ci#define   S_SQ_CF_WORD1_POP_COUNT(x)                                 (((unsigned)(x) & 0x7) << 0)
35bf215546Sopenharmony_ci#define   G_SQ_CF_WORD1_POP_COUNT(x)                                 (((x) >> 0) & 0x7)
36bf215546Sopenharmony_ci#define   C_SQ_CF_WORD1_POP_COUNT                                    0xFFFFFFF8
37bf215546Sopenharmony_ci#define   S_SQ_CF_WORD1_CF_CONST(x)                                  (((unsigned)(x) & 0x1F) << 3)
38bf215546Sopenharmony_ci#define   G_SQ_CF_WORD1_CF_CONST(x)                                  (((x) >> 3) & 0x1F)
39bf215546Sopenharmony_ci#define   C_SQ_CF_WORD1_CF_CONST                                     0xFFFFFF07
40bf215546Sopenharmony_ci#define   S_SQ_CF_WORD1_COND(x)                                      (((unsigned)(x) & 0x3) << 8)
41bf215546Sopenharmony_ci#define   G_SQ_CF_WORD1_COND(x)                                      (((x) >> 8) & 0x3)
42bf215546Sopenharmony_ci#define   C_SQ_CF_WORD1_COND                                         0xFFFFFCFF
43bf215546Sopenharmony_ci#define   S_SQ_CF_WORD1_COUNT(x)                                     (((unsigned)(x) & 0x7) << 10)
44bf215546Sopenharmony_ci#define   G_SQ_CF_WORD1_COUNT(x)                                     (((x) >> 10) & 0x7)
45bf215546Sopenharmony_ci#define   C_SQ_CF_WORD1_COUNT                                        0xFFFFE3FF
46bf215546Sopenharmony_ci#define   S_SQ_CF_WORD1_CALL_COUNT(x)                                (((unsigned)(x) & 0x3F) << 13)
47bf215546Sopenharmony_ci#define   G_SQ_CF_WORD1_CALL_COUNT(x)                                (((x) >> 13) & 0x3F)
48bf215546Sopenharmony_ci#define   C_SQ_CF_WORD1_CALL_COUNT                                   0xFFF81FFF
49bf215546Sopenharmony_ci#define   S_SQ_CF_WORD1_END_OF_PROGRAM(x)                            (((unsigned)(x) & 0x1) << 21)
50bf215546Sopenharmony_ci#define   G_SQ_CF_WORD1_END_OF_PROGRAM(x)                            (((x) >> 21) & 0x1)
51bf215546Sopenharmony_ci#define   C_SQ_CF_WORD1_END_OF_PROGRAM                               0xFFDFFFFF
52bf215546Sopenharmony_ci#define   S_SQ_CF_WORD1_VALID_PIXEL_MODE(x)                          (((unsigned)(x) & 0x1) << 22)
53bf215546Sopenharmony_ci#define   G_SQ_CF_WORD1_VALID_PIXEL_MODE(x)                          (((x) >> 22) & 0x1)
54bf215546Sopenharmony_ci#define   C_SQ_CF_WORD1_VALID_PIXEL_MODE                             0xFFBFFFFF
55bf215546Sopenharmony_ci#define   S_SQ_CF_WORD1_CF_INST(x)                                   (((unsigned)(x) & 0x7F) << 23)
56bf215546Sopenharmony_ci#define   G_SQ_CF_WORD1_CF_INST(x)                                   (((x) >> 23) & 0x7F)
57bf215546Sopenharmony_ci#define   C_SQ_CF_WORD1_CF_INST                                      0xC07FFFFF
58bf215546Sopenharmony_ci#define   S_SQ_CF_WORD1_WHOLE_QUAD_MODE(x)                           (((unsigned)(x) & 0x1) << 30)
59bf215546Sopenharmony_ci#define   G_SQ_CF_WORD1_WHOLE_QUAD_MODE(x)                           (((x) >> 30) & 0x1)
60bf215546Sopenharmony_ci#define   C_SQ_CF_WORD1_WHOLE_QUAD_MODE                              0xBFFFFFFF
61bf215546Sopenharmony_ci#define   S_SQ_CF_WORD1_BARRIER(x)                                   (((unsigned)(x) & 0x1) << 31)
62bf215546Sopenharmony_ci#define   G_SQ_CF_WORD1_BARRIER(x)                                   (((x) >> 31) & 0x1)
63bf215546Sopenharmony_ci#define   C_SQ_CF_WORD1_BARRIER                                      0x7FFFFFFF
64bf215546Sopenharmony_ci#define P_SQ_CF_ALU_WORD0
65bf215546Sopenharmony_ci#define   S_SQ_CF_ALU_WORD0_ADDR(x)                                  (((unsigned)(x) & 0x3FFFFF) << 0)
66bf215546Sopenharmony_ci#define   G_SQ_CF_ALU_WORD0_ADDR(x)                                  (((x) >> 0) & 0x3FFFFF)
67bf215546Sopenharmony_ci#define   C_SQ_CF_ALU_WORD0_ADDR                                     0xFFC00000
68bf215546Sopenharmony_ci#define   S_SQ_CF_ALU_WORD0_KCACHE_BANK0(x)                          (((unsigned)(x) & 0xF) << 22)
69bf215546Sopenharmony_ci#define   G_SQ_CF_ALU_WORD0_KCACHE_BANK0(x)                          (((x) >> 22) & 0xF)
70bf215546Sopenharmony_ci#define   C_SQ_CF_ALU_WORD0_KCACHE_BANK0                             0xFC3FFFFF
71bf215546Sopenharmony_ci#define   S_SQ_CF_ALU_WORD0_KCACHE_BANK1(x)                          (((unsigned)(x) & 0xF) << 26)
72bf215546Sopenharmony_ci#define   G_SQ_CF_ALU_WORD0_KCACHE_BANK1(x)                          (((x) >> 26) & 0xF)
73bf215546Sopenharmony_ci#define   C_SQ_CF_ALU_WORD0_KCACHE_BANK1                             0xC3FFFFFF
74bf215546Sopenharmony_ci#define   S_SQ_CF_ALU_WORD0_KCACHE_MODE0(x)                          (((unsigned)(x) & 0x3) << 30)
75bf215546Sopenharmony_ci#define   G_SQ_CF_ALU_WORD0_KCACHE_MODE0(x)                          (((x) >> 30) & 0x3)
76bf215546Sopenharmony_ci#define   C_SQ_CF_ALU_WORD0_KCACHE_MODE0                             0x3FFFFFFF
77bf215546Sopenharmony_ci#define     V_SQ_CF_KCACHE_NOP                                       0x00000000
78bf215546Sopenharmony_ci#define     V_SQ_CF_KCACHE_LOCK_1                                    0x00000001
79bf215546Sopenharmony_ci#define     V_SQ_CF_KCACHE_LOCK_2                                    0x00000002
80bf215546Sopenharmony_ci#define     V_SQ_CF_KCACHE_LOCK_LOOP_INDEX                           0x00000003
81bf215546Sopenharmony_ci#define P_SQ_CF_ALU_WORD1
82bf215546Sopenharmony_ci#define   S_SQ_CF_ALU_WORD1_KCACHE_MODE1(x)                          (((unsigned)(x) & 0x3) << 0)
83bf215546Sopenharmony_ci#define   G_SQ_CF_ALU_WORD1_KCACHE_MODE1(x)                          (((x) >> 0) & 0x3)
84bf215546Sopenharmony_ci#define   C_SQ_CF_ALU_WORD1_KCACHE_MODE1                             0xFFFFFFFC
85bf215546Sopenharmony_ci#define   S_SQ_CF_ALU_WORD1_KCACHE_ADDR0(x)                          (((unsigned)(x) & 0xFF) << 2)
86bf215546Sopenharmony_ci#define   G_SQ_CF_ALU_WORD1_KCACHE_ADDR0(x)                          (((x) >> 2) & 0xFF)
87bf215546Sopenharmony_ci#define   C_SQ_CF_ALU_WORD1_KCACHE_ADDR0                             0xFFFFFC03
88bf215546Sopenharmony_ci#define   S_SQ_CF_ALU_WORD1_KCACHE_ADDR1(x)                          (((unsigned)(x) & 0xFF) << 10)
89bf215546Sopenharmony_ci#define   G_SQ_CF_ALU_WORD1_KCACHE_ADDR1(x)                          (((x) >> 10) & 0xFF)
90bf215546Sopenharmony_ci#define   C_SQ_CF_ALU_WORD1_KCACHE_ADDR1                             0xFFFC03FF
91bf215546Sopenharmony_ci#define   S_SQ_CF_ALU_WORD1_COUNT(x)                                 (((unsigned)(x) & 0x7F) << 18)
92bf215546Sopenharmony_ci#define   G_SQ_CF_ALU_WORD1_COUNT(x)                                 (((x) >> 18) & 0x7F)
93bf215546Sopenharmony_ci#define   C_SQ_CF_ALU_WORD1_COUNT                                    0xFE03FFFF
94bf215546Sopenharmony_ci#define   S_SQ_CF_ALU_WORD1_USES_WATERFALL(x)                        (((unsigned)(x) & 0x1) << 25)
95bf215546Sopenharmony_ci#define   G_SQ_CF_ALU_WORD1_USES_WATERFALL(x)                        (((x) >> 25) & 0x1)
96bf215546Sopenharmony_ci#define   C_SQ_CF_ALU_WORD1_USES_WATERFALL                           0xFDFFFFFF
97bf215546Sopenharmony_ci#define   S_SQ_CF_ALU_WORD1_CF_INST(x)                               (((unsigned)(x) & 0xF) << 26)
98bf215546Sopenharmony_ci#define   G_SQ_CF_ALU_WORD1_CF_INST(x)                               (((x) >> 26) & 0xF)
99bf215546Sopenharmony_ci#define   C_SQ_CF_ALU_WORD1_CF_INST                                  0xC3FFFFFF
100bf215546Sopenharmony_ci#define   S_SQ_CF_ALU_WORD1_WHOLE_QUAD_MODE(x)                       (((unsigned)(x) & 0x1) << 30)
101bf215546Sopenharmony_ci#define   G_SQ_CF_ALU_WORD1_WHOLE_QUAD_MODE(x)                       (((x) >> 30) & 0x1)
102bf215546Sopenharmony_ci#define   C_SQ_CF_ALU_WORD1_WHOLE_QUAD_MODE                          0xBFFFFFFF
103bf215546Sopenharmony_ci#define   S_SQ_CF_ALU_WORD1_BARRIER(x)                               (((unsigned)(x) & 0x1) << 31)
104bf215546Sopenharmony_ci#define   G_SQ_CF_ALU_WORD1_BARRIER(x)                               (((x) >> 31) & 0x1)
105bf215546Sopenharmony_ci#define   C_SQ_CF_ALU_WORD1_BARRIER                                  0x7FFFFFFF
106bf215546Sopenharmony_ci#define P_SQ_CF_ALLOC_EXPORT_WORD0
107bf215546Sopenharmony_ci#define   S_SQ_CF_ALLOC_EXPORT_WORD0_ARRAY_BASE(x)                   (((unsigned)(x) & 0x1FFF) << 0)
108bf215546Sopenharmony_ci#define   G_SQ_CF_ALLOC_EXPORT_WORD0_ARRAY_BASE(x)                   (((x) >> 0) & 0x1FFF)
109bf215546Sopenharmony_ci#define   C_SQ_CF_ALLOC_EXPORT_WORD0_ARRAY_BASE                      0xFFFFE000
110bf215546Sopenharmony_ci#define   S_SQ_CF_ALLOC_EXPORT_WORD0_TYPE(x)                         (((unsigned)(x) & 0x3) << 13)
111bf215546Sopenharmony_ci#define   G_SQ_CF_ALLOC_EXPORT_WORD0_TYPE(x)                         (((x) >> 13) & 0x3)
112bf215546Sopenharmony_ci#define   C_SQ_CF_ALLOC_EXPORT_WORD0_TYPE                            0xFFFF9FFF
113bf215546Sopenharmony_ci#define     V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL               0x00000000
114bf215546Sopenharmony_ci#define     V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_POS                 0x00000001
115bf215546Sopenharmony_ci#define     V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM               0x00000002
116bf215546Sopenharmony_ci#define     V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_SX                  0x00000003
117bf215546Sopenharmony_ci#define     V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_WRITE               0x00000000
118bf215546Sopenharmony_ci#define     V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_WRITE_IND           0x00000001
119bf215546Sopenharmony_ci#define     V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_READ                0x00000002
120bf215546Sopenharmony_ci#define     V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_READ_IND            0x00000003
121bf215546Sopenharmony_ci
122bf215546Sopenharmony_ci/* R700+-only */
123bf215546Sopenharmony_ci#define     V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_WRITE_ACK_EG        0x00000002
124bf215546Sopenharmony_ci#define     V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_WRITE_IND_ACK_EG    0x00000003
125bf215546Sopenharmony_ci
126bf215546Sopenharmony_ci#define   S_SQ_CF_ALLOC_EXPORT_WORD0_RW_GPR(x)                       (((unsigned)(x) & 0x7F) << 15)
127bf215546Sopenharmony_ci#define   G_SQ_CF_ALLOC_EXPORT_WORD0_RW_GPR(x)                       (((x) >> 15) & 0x7F)
128bf215546Sopenharmony_ci#define   C_SQ_CF_ALLOC_EXPORT_WORD0_RW_GPR                          0xFFC07FFF
129bf215546Sopenharmony_ci#define   S_SQ_CF_ALLOC_EXPORT_WORD0_RW_REL(x)                       (((unsigned)(x) & 0x1) << 22)
130bf215546Sopenharmony_ci#define   G_SQ_CF_ALLOC_EXPORT_WORD0_RW_REL(x)                       (((x) >> 22) & 0x1)
131bf215546Sopenharmony_ci#define   C_SQ_CF_ALLOC_EXPORT_WORD0_RW_REL                          0xFFBFFFFF
132bf215546Sopenharmony_ci#define   S_SQ_CF_ALLOC_EXPORT_WORD0_INDEX_GPR(x)                    (((unsigned)(x) & 0x7F) << 23)
133bf215546Sopenharmony_ci#define   G_SQ_CF_ALLOC_EXPORT_WORD0_INDEX_GPR(x)                    (((x) >> 23) & 0x7F)
134bf215546Sopenharmony_ci#define   C_SQ_CF_ALLOC_EXPORT_WORD0_INDEX_GPR                       0xC07FFFFF
135bf215546Sopenharmony_ci#define   S_SQ_CF_ALLOC_EXPORT_WORD0_ELEM_SIZE(x)                    (((unsigned)(x) & 0x3) << 30)
136bf215546Sopenharmony_ci#define   G_SQ_CF_ALLOC_EXPORT_WORD0_ELEM_SIZE(x)                    (((x) >> 30) & 0x3)
137bf215546Sopenharmony_ci#define   C_SQ_CF_ALLOC_EXPORT_WORD0_ELEM_SIZE                       0x3FFFFFFF
138bf215546Sopenharmony_ci#define P_SQ_CF_ALLOC_EXPORT_WORD1
139bf215546Sopenharmony_ci#define   S_SQ_CF_ALLOC_EXPORT_WORD1_BURST_COUNT(x)                  (((unsigned)(x) & 0xF) << 17)
140bf215546Sopenharmony_ci#define   G_SQ_CF_ALLOC_EXPORT_WORD1_BURST_COUNT(x)                  (((x) >> 17) & 0xF)
141bf215546Sopenharmony_ci#define   C_SQ_CF_ALLOC_EXPORT_WORD1_BURST_COUNT                     0xFFE1FFFF
142bf215546Sopenharmony_ci#define   S_SQ_CF_ALLOC_EXPORT_WORD1_END_OF_PROGRAM(x)               (((unsigned)(x) & 0x1) << 21)
143bf215546Sopenharmony_ci#define   G_SQ_CF_ALLOC_EXPORT_WORD1_END_OF_PROGRAM(x)               (((x) >> 21) & 0x1)
144bf215546Sopenharmony_ci#define   C_SQ_CF_ALLOC_EXPORT_WORD1_END_OF_PROGRAM                  0xFFDFFFFF
145bf215546Sopenharmony_ci#define   S_SQ_CF_ALLOC_EXPORT_WORD1_VALID_PIXEL_MODE(x)             (((unsigned)(x) & 0x1) << 22)
146bf215546Sopenharmony_ci#define   G_SQ_CF_ALLOC_EXPORT_WORD1_VALID_PIXEL_MODE(x)             (((x) >> 22) & 0x1)
147bf215546Sopenharmony_ci#define   C_SQ_CF_ALLOC_EXPORT_WORD1_VALID_PIXEL_MODE                0xFFBFFFFF
148bf215546Sopenharmony_ci#define   S_SQ_CF_ALLOC_EXPORT_WORD1_CF_INST(x)                      (((unsigned)(x) & 0x7F) << 23)
149bf215546Sopenharmony_ci#define   G_SQ_CF_ALLOC_EXPORT_WORD1_CF_INST(x)                      (((x) >> 23) & 0x7F)
150bf215546Sopenharmony_ci#define   C_SQ_CF_ALLOC_EXPORT_WORD1_CF_INST                         0xC07FFFFF
151bf215546Sopenharmony_ci
152bf215546Sopenharmony_ci#define   S_SQ_CF_ALLOC_EXPORT_WORD1_WHOLE_QUAD_MODE(x)              (((unsigned)(x) & 0x1) << 30)
153bf215546Sopenharmony_ci#define   G_SQ_CF_ALLOC_EXPORT_WORD1_WHOLE_QUAD_MODE(x)              (((x) >> 30) & 0x1)
154bf215546Sopenharmony_ci#define   C_SQ_CF_ALLOC_EXPORT_WORD1_WHOLE_QUAD_MODE                 0xBFFFFFFF
155bf215546Sopenharmony_ci#define   S_SQ_CF_ALLOC_EXPORT_WORD1_BARRIER(x)                      (((unsigned)(x) & 0x1) << 31)
156bf215546Sopenharmony_ci#define   G_SQ_CF_ALLOC_EXPORT_WORD1_BARRIER(x)                      (((x) >> 31) & 0x1)
157bf215546Sopenharmony_ci#define   C_SQ_CF_ALLOC_EXPORT_WORD1_BARRIER                         0x7FFFFFFF
158bf215546Sopenharmony_ci#define P_SQ_CF_ALLOC_EXPORT_WORD1_BUF
159bf215546Sopenharmony_ci#define   S_SQ_CF_ALLOC_EXPORT_WORD1_BUF_ARRAY_SIZE(x)               (((unsigned)(x) & 0xFFF) << 0)
160bf215546Sopenharmony_ci#define   G_SQ_CF_ALLOC_EXPORT_WORD1_BUF_ARRAY_SIZE(x)               (((x) >> 0) & 0xFFF)
161bf215546Sopenharmony_ci#define   C_SQ_CF_ALLOC_EXPORT_WORD1_BUF_ARRAY_SIZE                  0xFFFFF000
162bf215546Sopenharmony_ci#define   S_SQ_CF_ALLOC_EXPORT_WORD1_BUF_COMP_MASK(x)                (((unsigned)(x) & 0xF) << 12)
163bf215546Sopenharmony_ci#define   G_SQ_CF_ALLOC_EXPORT_WORD1_BUF_COMP_MASK(x)                (((x) >> 12) & 0xF)
164bf215546Sopenharmony_ci#define   C_SQ_CF_ALLOC_EXPORT_WORD1_BUF_COMP_MASK                   0xFFFF0FFF
165bf215546Sopenharmony_ci#define P_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ
166bf215546Sopenharmony_ci#define   S_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_X(x)                   (((unsigned)(x) & 0x7) << 0)
167bf215546Sopenharmony_ci#define   G_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_X(x)                   (((x) >> 0) & 0x7)
168bf215546Sopenharmony_ci#define   C_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_X                      0xFFFFFFF8
169bf215546Sopenharmony_ci#define   S_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Y(x)                   (((unsigned)(x) & 0x7) << 3)
170bf215546Sopenharmony_ci#define   G_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Y(x)                   (((x) >> 3) & 0x7)
171bf215546Sopenharmony_ci#define   C_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Y                      0xFFFFFFC7
172bf215546Sopenharmony_ci#define   S_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Z(x)                   (((unsigned)(x) & 0x7) << 6)
173bf215546Sopenharmony_ci#define   G_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Z(x)                   (((x) >> 6) & 0x7)
174bf215546Sopenharmony_ci#define   C_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Z                      0xFFFFFE3F
175bf215546Sopenharmony_ci#define   S_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_W(x)                   (((unsigned)(x) & 0x7) << 9)
176bf215546Sopenharmony_ci#define   G_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_W(x)                   (((x) >> 9) & 0x7)
177bf215546Sopenharmony_ci#define   C_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_W                      0xFFFFF1FF
178bf215546Sopenharmony_ci#define P_SQ_ALU_WORD0
179bf215546Sopenharmony_ci#define   S_SQ_ALU_WORD0_SRC0_SEL(x)                                 (((unsigned)(x) & 0x1FF) << 0)
180bf215546Sopenharmony_ci#define   G_SQ_ALU_WORD0_SRC0_SEL(x)                                 (((x) >> 0) & 0x1FF)
181bf215546Sopenharmony_ci#define   C_SQ_ALU_WORD0_SRC0_SEL                                    0xFFFFFE00
182bf215546Sopenharmony_ci/*
183bf215546Sopenharmony_ci * 244  ALU_SRC_1_DBL_L: special constant 1.0 double-float, LSW. (RV670+)
184bf215546Sopenharmony_ci * 245  ALU_SRC_1_DBL_M: special constant 1.0 double-float, MSW. (RV670+)
185bf215546Sopenharmony_ci * 246  ALU_SRC_0_5_DBL_L: special constant 0.5 double-float, LSW. (RV670+)
186bf215546Sopenharmony_ci * 247  ALU_SRC_0_5_DBL_M: special constant 0.5 double-float, MSW. (RV670+)
187bf215546Sopenharmony_ci * 248  SQ_ALU_SRC_0: special constant 0.0.
188bf215546Sopenharmony_ci * 249  SQ_ALU_SRC_1: special constant 1.0 float.
189bf215546Sopenharmony_ci * 250  SQ_ALU_SRC_1_INT: special constant 1 integer.
190bf215546Sopenharmony_ci * 251  SQ_ALU_SRC_M_1_INT: special constant -1 integer.
191bf215546Sopenharmony_ci * 252  SQ_ALU_SRC_0_5: special constant 0.5 float.
192bf215546Sopenharmony_ci * 253  SQ_ALU_SRC_LITERAL: literal constant.
193bf215546Sopenharmony_ci * 254  SQ_ALU_SRC_PV: previous vector result.
194bf215546Sopenharmony_ci * 255  SQ_ALU_SRC_PS: previous scalar result.
195bf215546Sopenharmony_ci * 448  EG - INTERP SRC BASE
196bf215546Sopenharmony_ci */
197bf215546Sopenharmony_ci/* LDS are Evergreen/Cayman only */
198bf215546Sopenharmony_ci#define     EG_V_SQ_ALU_SRC_LDS_OQ_A                                 0x000000DB
199bf215546Sopenharmony_ci#define     EG_V_SQ_ALU_SRC_LDS_OQ_B                                 0x000000DC
200bf215546Sopenharmony_ci#define     EG_V_SQ_ALU_SRC_LDS_OQ_A_POP                             0x000000DD
201bf215546Sopenharmony_ci#define     EG_V_SQ_ALU_SRC_LDS_OQ_B_POP                             0x000000DE
202bf215546Sopenharmony_ci#define     EG_V_SQ_ALU_SRC_LDS_DIRECT_A                             0x000000DF
203bf215546Sopenharmony_ci#define     EG_V_SQ_ALU_SRC_LDS_DIRECT_B                             0x000000E0
204bf215546Sopenharmony_ci#define     EG_V_SQ_ALU_SRC_TIME_HI                                  0x000000E3
205bf215546Sopenharmony_ci#define     EG_V_SQ_ALU_SRC_TIME_LO                                  0x000000E4
206bf215546Sopenharmony_ci#define     EG_V_SQ_ALU_SRC_MASK_HI                                  0x000000E5
207bf215546Sopenharmony_ci#define     EG_V_SQ_ALU_SRC_MASK_LO                                  0x000000E6
208bf215546Sopenharmony_ci#define     EG_V_SQ_ALU_SRC_HW_WAVE_ID                               0x000000E7
209bf215546Sopenharmony_ci#define     EG_V_SQ_ALU_SRC_SIMD_ID                                  0x000000E8
210bf215546Sopenharmony_ci#define     EG_V_SQ_ALU_SRC_SE_ID                                    0x000000E9
211bf215546Sopenharmony_ci
212bf215546Sopenharmony_ci#define     V_SQ_ALU_SRC_0                                           0x000000F8
213bf215546Sopenharmony_ci#define     V_SQ_ALU_SRC_1                                           0x000000F9
214bf215546Sopenharmony_ci#define     V_SQ_ALU_SRC_1_INT                                       0x000000FA
215bf215546Sopenharmony_ci#define     V_SQ_ALU_SRC_M_1_INT                                     0x000000FB
216bf215546Sopenharmony_ci#define     V_SQ_ALU_SRC_0_5                                         0x000000FC
217bf215546Sopenharmony_ci#define     V_SQ_ALU_SRC_LITERAL                                     0x000000FD
218bf215546Sopenharmony_ci#define     V_SQ_ALU_SRC_PV                                          0x000000FE
219bf215546Sopenharmony_ci#define     V_SQ_ALU_SRC_PS                                          0x000000FF
220bf215546Sopenharmony_ci#define     V_SQ_ALU_SRC_PARAM_BASE                                  0x000001C0
221bf215546Sopenharmony_ci#define   S_SQ_ALU_WORD0_SRC0_REL(x)                                 (((unsigned)(x) & 0x1) << 9)
222bf215546Sopenharmony_ci#define   G_SQ_ALU_WORD0_SRC0_REL(x)                                 (((x) >> 9) & 0x1)
223bf215546Sopenharmony_ci#define   C_SQ_ALU_WORD0_SRC0_REL                                    0xFFFFFDFF
224bf215546Sopenharmony_ci#define   S_SQ_ALU_WORD0_SRC0_CHAN(x)                                (((unsigned)(x) & 0x3) << 10)
225bf215546Sopenharmony_ci#define   G_SQ_ALU_WORD0_SRC0_CHAN(x)                                (((x) >> 10) & 0x3)
226bf215546Sopenharmony_ci#define   C_SQ_ALU_WORD0_SRC0_CHAN                                   0xFFFFF3FF
227bf215546Sopenharmony_ci#define   S_SQ_ALU_WORD0_SRC0_NEG(x)                                 (((unsigned)(x) & 0x1) << 12)
228bf215546Sopenharmony_ci#define   G_SQ_ALU_WORD0_SRC0_NEG(x)                                 (((x) >> 12) & 0x1)
229bf215546Sopenharmony_ci#define   C_SQ_ALU_WORD0_SRC0_NEG                                    0xFFFFEFFF
230bf215546Sopenharmony_ci#define   S_SQ_ALU_WORD0_SRC1_SEL(x)                                 (((unsigned)(x) & 0x1FF) << 13)
231bf215546Sopenharmony_ci#define   G_SQ_ALU_WORD0_SRC1_SEL(x)                                 (((x) >> 13) & 0x1FF)
232bf215546Sopenharmony_ci#define   C_SQ_ALU_WORD0_SRC1_SEL                                    0xFFC01FFF
233bf215546Sopenharmony_ci#define   S_SQ_ALU_WORD0_SRC1_REL(x)                                 (((unsigned)(x) & 0x1) << 22)
234bf215546Sopenharmony_ci#define   G_SQ_ALU_WORD0_SRC1_REL(x)                                 (((x) >> 22) & 0x1)
235bf215546Sopenharmony_ci#define   C_SQ_ALU_WORD0_SRC1_REL                                    0xFFBFFFFF
236bf215546Sopenharmony_ci#define   S_SQ_ALU_WORD0_SRC1_CHAN(x)                                (((unsigned)(x) & 0x3) << 23)
237bf215546Sopenharmony_ci#define   G_SQ_ALU_WORD0_SRC1_CHAN(x)                                (((x) >> 23) & 0x3)
238bf215546Sopenharmony_ci#define   C_SQ_ALU_WORD0_SRC1_CHAN                                   0xFE7FFFFF
239bf215546Sopenharmony_ci#define   S_SQ_ALU_WORD0_SRC1_NEG(x)                                 (((unsigned)(x) & 0x1) << 25)
240bf215546Sopenharmony_ci#define   G_SQ_ALU_WORD0_SRC1_NEG(x)                                 (((x) >> 25) & 0x1)
241bf215546Sopenharmony_ci#define   C_SQ_ALU_WORD0_SRC1_NEG                                    0xFDFFFFFF
242bf215546Sopenharmony_ci#define   S_SQ_ALU_WORD0_INDEX_MODE(x)                               (((unsigned)(x) & 0x7) << 26)
243bf215546Sopenharmony_ci#define   G_SQ_ALU_WORD0_INDEX_MODE(x)                               (((x) >> 26) & 0x7)
244bf215546Sopenharmony_ci#define   C_SQ_ALU_WORD0_INDEX_MODE                                  0xE3FFFFFF
245bf215546Sopenharmony_ci#define   S_SQ_ALU_WORD0_PRED_SEL(x)                                 (((unsigned)(x) & 0x3) << 29)
246bf215546Sopenharmony_ci#define   G_SQ_ALU_WORD0_PRED_SEL(x)                                 (((x) >> 29) & 0x3)
247bf215546Sopenharmony_ci#define   C_SQ_ALU_WORD0_PRED_SEL                                    0x9FFFFFFF
248bf215546Sopenharmony_ci#define   S_SQ_ALU_WORD0_LAST(x)                                     (((unsigned)(x) & 0x1) << 31)
249bf215546Sopenharmony_ci#define   G_SQ_ALU_WORD0_LAST(x)                                     (((x) >> 31) & 0x1)
250bf215546Sopenharmony_ci#define   C_SQ_ALU_WORD0_LAST                                        0x7FFFFFFF
251bf215546Sopenharmony_ci#define P_SQ_ALU_WORD1
252bf215546Sopenharmony_ci#define   S_SQ_ALU_WORD1_ENCODING(x)                                 (((unsigned)(x) & 0x7) << 15)
253bf215546Sopenharmony_ci#define   G_SQ_ALU_WORD1_ENCODING(x)                                 (((x) >> 15) & 0x7)
254bf215546Sopenharmony_ci#define   C_SQ_ALU_WORD1_ENCODING                                    0xFFFC7FFF
255bf215546Sopenharmony_ci#define   S_SQ_ALU_WORD1_BANK_SWIZZLE(x)                             (((unsigned)(x) & 0x7) << 18)
256bf215546Sopenharmony_ci#define   G_SQ_ALU_WORD1_BANK_SWIZZLE(x)                             (((x) >> 18) & 0x7)
257bf215546Sopenharmony_ci#define   C_SQ_ALU_WORD1_BANK_SWIZZLE                                0xFFE3FFFF
258bf215546Sopenharmony_ci#define   S_SQ_ALU_WORD1_DST_GPR(x)                                  (((unsigned)(x) & 0x7F) << 21)
259bf215546Sopenharmony_ci#define   G_SQ_ALU_WORD1_DST_GPR(x)                                  (((x) >> 21) & 0x7F)
260bf215546Sopenharmony_ci#define   C_SQ_ALU_WORD1_DST_GPR                                     0xF01FFFFF
261bf215546Sopenharmony_ci#define   S_SQ_ALU_WORD1_DST_REL(x)                                  (((unsigned)(x) & 0x1) << 28)
262bf215546Sopenharmony_ci#define   G_SQ_ALU_WORD1_DST_REL(x)                                  (((x) >> 28) & 0x1)
263bf215546Sopenharmony_ci#define   C_SQ_ALU_WORD1_DST_REL                                     0xEFFFFFFF
264bf215546Sopenharmony_ci#define   S_SQ_ALU_WORD1_DST_CHAN(x)                                 (((unsigned)(x) & 0x3) << 29)
265bf215546Sopenharmony_ci#define   G_SQ_ALU_WORD1_DST_CHAN(x)                                 (((x) >> 29) & 0x3)
266bf215546Sopenharmony_ci#define   C_SQ_ALU_WORD1_DST_CHAN                                    0x9FFFFFFF
267bf215546Sopenharmony_ci#define   S_SQ_ALU_WORD1_CLAMP(x)                                    (((unsigned)(x) & 0x1) << 31)
268bf215546Sopenharmony_ci#define   G_SQ_ALU_WORD1_CLAMP(x)                                    (((x) >> 31) & 0x1)
269bf215546Sopenharmony_ci#define   C_SQ_ALU_WORD1_CLAMP                                       0x7FFFFFFF
270bf215546Sopenharmony_ci#define P_SQ_ALU_WORD1_OP2
271bf215546Sopenharmony_ci#define   S_SQ_ALU_WORD1_OP2_SRC0_ABS(x)                             (((unsigned)(x) & 0x1) << 0)
272bf215546Sopenharmony_ci#define   G_SQ_ALU_WORD1_OP2_SRC0_ABS(x)                             (((x) >> 0) & 0x1)
273bf215546Sopenharmony_ci#define   C_SQ_ALU_WORD1_OP2_SRC0_ABS                                0xFFFFFFFE
274bf215546Sopenharmony_ci#define   S_SQ_ALU_WORD1_OP2_SRC1_ABS(x)                             (((unsigned)(x) & 0x1) << 1)
275bf215546Sopenharmony_ci#define   G_SQ_ALU_WORD1_OP2_SRC1_ABS(x)                             (((x) >> 1) & 0x1)
276bf215546Sopenharmony_ci#define   C_SQ_ALU_WORD1_OP2_SRC1_ABS                                0xFFFFFFFD
277bf215546Sopenharmony_ci#define   S_SQ_ALU_WORD1_OP2_UPDATE_EXECUTE_MASK(x)                  (((unsigned)(x) & 0x1) << 2)
278bf215546Sopenharmony_ci#define   G_SQ_ALU_WORD1_OP2_UPDATE_EXECUTE_MASK(x)                  (((x) >> 2) & 0x1)
279bf215546Sopenharmony_ci#define   C_SQ_ALU_WORD1_OP2_UPDATE_EXECUTE_MASK                     0xFFFFFFFB
280bf215546Sopenharmony_ci#define   S_SQ_ALU_WORD1_OP2_UPDATE_PRED(x)                          (((unsigned)(x) & 0x1) << 3)
281bf215546Sopenharmony_ci#define   G_SQ_ALU_WORD1_OP2_UPDATE_PRED(x)                          (((x) >> 3) & 0x1)
282bf215546Sopenharmony_ci#define   C_SQ_ALU_WORD1_OP2_UPDATE_PRED                             0xFFFFFFF7
283bf215546Sopenharmony_ci#define   S_SQ_ALU_WORD1_OP2_WRITE_MASK(x)                           (((unsigned)(x) & 0x1) << 4)
284bf215546Sopenharmony_ci#define   G_SQ_ALU_WORD1_OP2_WRITE_MASK(x)                           (((x) >> 4) & 0x1)
285bf215546Sopenharmony_ci#define   C_SQ_ALU_WORD1_OP2_WRITE_MASK                              0xFFFFFFEF
286bf215546Sopenharmony_ci#define   S_SQ_ALU_WORD1_OP2_FOG_MERGE(x)                            (((unsigned)(x) & 0x1) << 5)
287bf215546Sopenharmony_ci#define   G_SQ_ALU_WORD1_OP2_FOG_MERGE(x)                            (((x) >> 5) & 0x1)
288bf215546Sopenharmony_ci#define   C_SQ_ALU_WORD1_OP2_FOG_MERGE                               0xFFFFFFDF
289bf215546Sopenharmony_ci#define   S_SQ_ALU_WORD1_OP2_OMOD(x)                                 (((unsigned)(x) & 0x3) << 6)
290bf215546Sopenharmony_ci#define   G_SQ_ALU_WORD1_OP2_OMOD(x)                                 (((x) >> 6) & 0x3)
291bf215546Sopenharmony_ci#define   C_SQ_ALU_WORD1_OP2_OMOD                                    0xFFFFFF3F
292bf215546Sopenharmony_ci#define   S_SQ_ALU_WORD1_OP2_ALU_INST(x)                             (((unsigned)(x) & 0x3FF) << 8)
293bf215546Sopenharmony_ci#define   G_SQ_ALU_WORD1_OP2_ALU_INST(x)                             (((x) >> 8) & 0x3FF)
294bf215546Sopenharmony_ci#define   C_SQ_ALU_WORD1_OP2_ALU_INST                                0xFFFC00FF
295bf215546Sopenharmony_ci#define P_SQ_ALU_WORD1_OP3
296bf215546Sopenharmony_ci#define   S_SQ_ALU_WORD1_OP3_SRC2_SEL(x)                             (((unsigned)(x) & 0x1FF) << 0)
297bf215546Sopenharmony_ci#define   G_SQ_ALU_WORD1_OP3_SRC2_SEL(x)                             (((x) >> 0) & 0x1FF)
298bf215546Sopenharmony_ci#define   C_SQ_ALU_WORD1_OP3_SRC2_SEL                                0xFFFFFE00
299bf215546Sopenharmony_ci#define   S_SQ_ALU_WORD1_OP3_SRC2_REL(x)                             (((unsigned)(x) & 0x1) << 9)
300bf215546Sopenharmony_ci#define   G_SQ_ALU_WORD1_OP3_SRC2_REL(x)                             (((x) >> 9) & 0x1)
301bf215546Sopenharmony_ci#define   C_SQ_ALU_WORD1_OP3_SRC2_REL                                0xFFFFFDFF
302bf215546Sopenharmony_ci#define   S_SQ_ALU_WORD1_OP3_SRC2_CHAN(x)                            (((unsigned)(x) & 0x3) << 10)
303bf215546Sopenharmony_ci#define   G_SQ_ALU_WORD1_OP3_SRC2_CHAN(x)                            (((x) >> 10) & 0x3)
304bf215546Sopenharmony_ci#define   C_SQ_ALU_WORD1_OP3_SRC2_CHAN                               0xFFFFF3FF
305bf215546Sopenharmony_ci#define   S_SQ_ALU_WORD1_OP3_SRC2_NEG(x)                             (((unsigned)(x) & 0x1) << 12)
306bf215546Sopenharmony_ci#define   G_SQ_ALU_WORD1_OP3_SRC2_NEG(x)                             (((x) >> 12) & 0x1)
307bf215546Sopenharmony_ci#define   C_SQ_ALU_WORD1_OP3_SRC2_NEG                                0xFFFFEFFF
308bf215546Sopenharmony_ci#define   S_SQ_ALU_WORD1_OP3_ALU_INST(x)                             (((unsigned)(x) & 0x1F) << 13)
309bf215546Sopenharmony_ci#define   G_SQ_ALU_WORD1_OP3_ALU_INST(x)                             (((x) >> 13) & 0x1F)
310bf215546Sopenharmony_ci#define   C_SQ_ALU_WORD1_OP3_ALU_INST                                0xFFFC1FFF
311bf215546Sopenharmony_ci#define P_SQ_VTX_WORD0
312bf215546Sopenharmony_ci#define   S_SQ_VTX_WORD0_VTX_INST(x)                                 (((unsigned)(x) & 0x1F) << 0)
313bf215546Sopenharmony_ci#define   G_SQ_VTX_WORD0_VTX_INST(x)                                 (((x) >> 0) & 0x1F)
314bf215546Sopenharmony_ci#define   C_SQ_VTX_WORD0_VTX_INST                                    0xFFFFFFE0
315bf215546Sopenharmony_ci#define   S_SQ_VTX_WORD0_FETCH_TYPE(x)                               (((unsigned)(x) & 0x3) << 5)
316bf215546Sopenharmony_ci#define   G_SQ_VTX_WORD0_FETCH_TYPE(x)                               (((x) >> 5) & 0x3)
317bf215546Sopenharmony_ci#define   C_SQ_VTX_WORD0_FETCH_TYPE                                  0xFFFFFF9F
318bf215546Sopenharmony_ci#define   S_SQ_VTX_WORD0_FETCH_WHOLE_QUAD(x)                         (((unsigned)(x) & 0x1) << 7)
319bf215546Sopenharmony_ci#define   G_SQ_VTX_WORD0_FETCH_WHOLE_QUAD(x)                         (((x) >> 7) & 0x1)
320bf215546Sopenharmony_ci#define   C_SQ_VTX_WORD0_FETCH_WHOLE_QUAD                            0xFFFFFF7F
321bf215546Sopenharmony_ci#define   S_SQ_VTX_WORD0_BUFFER_ID(x)                                (((unsigned)(x) & 0xFF) << 8)
322bf215546Sopenharmony_ci#define   G_SQ_VTX_WORD0_BUFFER_ID(x)                                (((x) >> 8) & 0xFF)
323bf215546Sopenharmony_ci#define   C_SQ_VTX_WORD0_BUFFER_ID                                   0xFFFF00FF
324bf215546Sopenharmony_ci#define   S_SQ_VTX_WORD0_SRC_GPR(x)                                  (((unsigned)(x) & 0x7F) << 16)
325bf215546Sopenharmony_ci#define   G_SQ_VTX_WORD0_SRC_GPR(x)                                  (((x) >> 16) & 0x7F)
326bf215546Sopenharmony_ci#define   C_SQ_VTX_WORD0_SRC_GPR                                     0xFF80FFFF
327bf215546Sopenharmony_ci#define   S_SQ_VTX_WORD0_SRC_REL(x)                                  (((unsigned)(x) & 0x1) << 23)
328bf215546Sopenharmony_ci#define   G_SQ_VTX_WORD0_SRC_REL(x)                                  (((x) >> 23) & 0x1)
329bf215546Sopenharmony_ci#define   C_SQ_VTX_WORD0_SRC_REL                                     0xFF7FFFFF
330bf215546Sopenharmony_ci#define   S_SQ_VTX_WORD0_SRC_SEL_X(x)                                (((unsigned)(x) & 0x3) << 24)
331bf215546Sopenharmony_ci#define   G_SQ_VTX_WORD0_SRC_SEL_X(x)                                (((x) >> 24) & 0x3)
332bf215546Sopenharmony_ci#define   C_SQ_VTX_WORD0_SRC_SEL_X                                   0xFCFFFFFF
333bf215546Sopenharmony_ci#define   S_SQ_VTX_WORD0_MEGA_FETCH_COUNT(x)                         (((unsigned)(x) & 0x3F) << 26)
334bf215546Sopenharmony_ci#define   G_SQ_VTX_WORD0_MEGA_FETCH_COUNT(x)                         (((x) >> 26) & 0x3F)
335bf215546Sopenharmony_ci#define   C_SQ_VTX_WORD0_MEGA_FETCH_COUNT                            0x03FFFFFF
336bf215546Sopenharmony_ci#define P_SQ_VTX_WORD1
337bf215546Sopenharmony_ci#define   S_SQ_VTX_WORD1_DST_SEL_X(x)                                (((unsigned)(x) & 0x7) << 9)
338bf215546Sopenharmony_ci#define   G_SQ_VTX_WORD1_DST_SEL_X(x)                                (((x) >> 9) & 0x7)
339bf215546Sopenharmony_ci#define   C_SQ_VTX_WORD1_DST_SEL_X                                   0xFFFFF1FF
340bf215546Sopenharmony_ci#define   S_SQ_VTX_WORD1_DST_SEL_Y(x)                                (((unsigned)(x) & 0x7) << 12)
341bf215546Sopenharmony_ci#define   G_SQ_VTX_WORD1_DST_SEL_Y(x)                                (((x) >> 12) & 0x7)
342bf215546Sopenharmony_ci#define   C_SQ_VTX_WORD1_DST_SEL_Y                                   0xFFFF8FFF
343bf215546Sopenharmony_ci#define   S_SQ_VTX_WORD1_DST_SEL_Z(x)                                (((unsigned)(x) & 0x7) << 15)
344bf215546Sopenharmony_ci#define   G_SQ_VTX_WORD1_DST_SEL_Z(x)                                (((x) >> 15) & 0x7)
345bf215546Sopenharmony_ci#define   C_SQ_VTX_WORD1_DST_SEL_Z                                   0xFFFC7FFF
346bf215546Sopenharmony_ci#define   S_SQ_VTX_WORD1_DST_SEL_W(x)                                (((unsigned)(x) & 0x7) << 18)
347bf215546Sopenharmony_ci#define   G_SQ_VTX_WORD1_DST_SEL_W(x)                                (((x) >> 18) & 0x7)
348bf215546Sopenharmony_ci#define   C_SQ_VTX_WORD1_DST_SEL_W                                   0xFFE3FFFF
349bf215546Sopenharmony_ci#define   S_SQ_VTX_WORD1_USE_CONST_FIELDS(x)                         (((unsigned)(x) & 0x1) << 21)
350bf215546Sopenharmony_ci#define   G_SQ_VTX_WORD1_USE_CONST_FIELDS(x)                         (((x) >> 21) & 0x1)
351bf215546Sopenharmony_ci#define   C_SQ_VTX_WORD1_USE_CONST_FIELDS                            0xFFDFFFFF
352bf215546Sopenharmony_ci#define   S_SQ_VTX_WORD1_DATA_FORMAT(x)                              (((unsigned)(x) & 0x3F) << 22)
353bf215546Sopenharmony_ci#define   G_SQ_VTX_WORD1_DATA_FORMAT(x)                              (((x) >> 22) & 0x3F)
354bf215546Sopenharmony_ci#define   C_SQ_VTX_WORD1_DATA_FORMAT                                 0xF03FFFFF
355bf215546Sopenharmony_ci#define   S_SQ_VTX_WORD1_NUM_FORMAT_ALL(x)                           (((unsigned)(x) & 0x3) << 28)
356bf215546Sopenharmony_ci#define   G_SQ_VTX_WORD1_NUM_FORMAT_ALL(x)                           (((x) >> 28) & 0x3)
357bf215546Sopenharmony_ci#define   C_SQ_VTX_WORD1_NUM_FORMAT_ALL                              0xCFFFFFFF
358bf215546Sopenharmony_ci#define   S_SQ_VTX_WORD1_FORMAT_COMP_ALL(x)                          (((unsigned)(x) & 0x1) << 30)
359bf215546Sopenharmony_ci#define   G_SQ_VTX_WORD1_FORMAT_COMP_ALL(x)                          (((x) >> 30) & 0x1)
360bf215546Sopenharmony_ci#define   C_SQ_VTX_WORD1_FORMAT_COMP_ALL                             0xBFFFFFFF
361bf215546Sopenharmony_ci#define   S_SQ_VTX_WORD1_SRF_MODE_ALL(x)                             (((unsigned)(x) & 0x1) << 31)
362bf215546Sopenharmony_ci#define   G_SQ_VTX_WORD1_SRF_MODE_ALL(x)                             (((x) >> 31) & 0x1)
363bf215546Sopenharmony_ci#define   C_SQ_VTX_WORD1_SRF_MODE_ALL                                0x7FFFFFFF
364bf215546Sopenharmony_ci#define P_SQ_VTX_WORD1_GPR
365bf215546Sopenharmony_ci#define   S_SQ_VTX_WORD1_GPR_DST_GPR(x)                              (((unsigned)(x) & 0x7F) << 0)
366bf215546Sopenharmony_ci#define   G_SQ_VTX_WORD1_GPR_DST_GPR(x)                              (((x) >> 0) & 0x7F)
367bf215546Sopenharmony_ci#define   C_SQ_VTX_WORD1_GPR_DST_GPR                                 0xFFFFFF80
368bf215546Sopenharmony_ci#define   S_SQ_VTX_WORD1_GPR_DST_REL(x)                              (((unsigned)(x) & 0x1) << 7)
369bf215546Sopenharmony_ci#define   G_SQ_VTX_WORD1_GPR_DST_REL(x)                              (((x) >> 7) & 0x1)
370bf215546Sopenharmony_ci#define   C_SQ_VTX_WORD1_GPR_DST_REL                                 0xFFFFFF7F
371bf215546Sopenharmony_ci#define P_SQ_VTX_WORD1_SEM
372bf215546Sopenharmony_ci#define   S_SQ_VTX_WORD1_SEM_SEMANTIC_ID(x)                          (((unsigned)(x) & 0xFF) << 0)
373bf215546Sopenharmony_ci#define   G_SQ_VTX_WORD1_SEM_SEMANTIC_ID(x)                          (((x) >> 0) & 0xFF)
374bf215546Sopenharmony_ci#define   C_SQ_VTX_WORD1_SEM_SEMANTIC_ID                             0xFFFFFF00
375bf215546Sopenharmony_ci#define P_SQ_VTX_WORD2
376bf215546Sopenharmony_ci#define   S_SQ_VTX_WORD2_OFFSET(x)                                   (((unsigned)(x) & 0xFFFF) << 0)
377bf215546Sopenharmony_ci#define   G_SQ_VTX_WORD2_OFFSET(x)                                   (((x) >> 0) & 0xFFFF)
378bf215546Sopenharmony_ci#define   C_SQ_VTX_WORD2_OFFSET                                      0xFFFF0000
379bf215546Sopenharmony_ci#define   S_SQ_VTX_WORD2_ENDIAN_SWAP(x)                              (((unsigned)(x) & 0x3) << 16)
380bf215546Sopenharmony_ci#define   G_SQ_VTX_WORD2_ENDIAN_SWAP(x)                              (((x) >> 16) & 0x3)
381bf215546Sopenharmony_ci#define   C_SQ_VTX_WORD2_ENDIAN_SWAP                                 0xFFFCFFFF
382bf215546Sopenharmony_ci#define   S_SQ_VTX_WORD2_CONST_BUF_NO_STRIDE(x)                      (((unsigned)(x) & 0x1) << 18)
383bf215546Sopenharmony_ci#define   G_SQ_VTX_WORD2_CONST_BUF_NO_STRIDE(x)                      (((x) >> 18) & 0x1)
384bf215546Sopenharmony_ci#define   C_SQ_VTX_WORD2_CONST_BUF_NO_STRIDE                         0xFFFBFFFF
385bf215546Sopenharmony_ci#define   S_SQ_VTX_WORD2_MEGA_FETCH(x)                               (((unsigned)(x) & 0x1) << 19)
386bf215546Sopenharmony_ci#define   G_SQ_VTX_WORD2_MEGA_FETCH(x)                               (((x) >> 19) & 0x1)
387bf215546Sopenharmony_ci#define   C_SQ_VTX_WORD2_MEGA_FETCH                                  0xFFF7FFFF
388bf215546Sopenharmony_ci#define   S_SQ_VTX_WORD2_ALT_CONST(x)                                (((unsigned)(x) & 0x1) << 20)
389bf215546Sopenharmony_ci#define   G_SQ_VTX_WORD2_ALT_CONST(x)                                (((x) >> 20) & 0x1)
390bf215546Sopenharmony_ci#define   C_SQ_VTX_WORD2_ALT_CONST                                   0xFFEFFFFF
391bf215546Sopenharmony_ci#define P_SQ_TEX_WORD0
392bf215546Sopenharmony_ci#define   S_SQ_TEX_WORD0_TEX_INST(x)                                 (((unsigned)(x) & 0x1F) << 0)
393bf215546Sopenharmony_ci#define   G_SQ_TEX_WORD0_TEX_INST(x)                                 (((x) >> 0) & 0x1F)
394bf215546Sopenharmony_ci#define   C_SQ_TEX_WORD0_TEX_INST                                    0xFFFFFFE0
395bf215546Sopenharmony_ci#define   S_SQ_TEX_WORD0_BC_FRAC_MODE(x)                             (((unsigned)(x) & 0x1) << 5)
396bf215546Sopenharmony_ci#define   G_SQ_TEX_WORD0_BC_FRAC_MODE(x)                             (((x) >> 5) & 0x1)
397bf215546Sopenharmony_ci#define   C_SQ_TEX_WORD0_BC_FRAC_MODE                                0xFFFFFFDF
398bf215546Sopenharmony_ci#define   EG_S_SQ_TEX_WORD0_INST_MOD(x)                                 (((unsigned)(x) & 0x3) << 5)
399bf215546Sopenharmony_ci#define   EG_G_SQ_TEX_WORD0_INST_MOD(x)                                 (((x) >> 5) & 0x3)
400bf215546Sopenharmony_ci#define   EG_C_SQ_TEX_WORD0_INST_MOD                                    0xFFFFFF9F
401bf215546Sopenharmony_ci#define   S_SQ_TEX_WORD0_FETCH_WHOLE_QUAD(x)                         (((unsigned)(x) & 0x1) << 7)
402bf215546Sopenharmony_ci#define   G_SQ_TEX_WORD0_FETCH_WHOLE_QUAD(x)                         (((x) >> 7) & 0x1)
403bf215546Sopenharmony_ci#define   C_SQ_TEX_WORD0_FETCH_WHOLE_QUAD                            0xFFFFFF7F
404bf215546Sopenharmony_ci#define   S_SQ_TEX_WORD0_RESOURCE_ID(x)                              (((unsigned)(x) & 0xFF) << 8)
405bf215546Sopenharmony_ci#define   G_SQ_TEX_WORD0_RESOURCE_ID(x)                              (((x) >> 8) & 0xFF)
406bf215546Sopenharmony_ci#define   C_SQ_TEX_WORD0_RESOURCE_ID                                 0xFFFF00FF
407bf215546Sopenharmony_ci#define   S_SQ_TEX_WORD0_SRC_GPR(x)                                  (((unsigned)(x) & 0x7F) << 16)
408bf215546Sopenharmony_ci#define   G_SQ_TEX_WORD0_SRC_GPR(x)                                  (((x) >> 16) & 0x7F)
409bf215546Sopenharmony_ci#define   C_SQ_TEX_WORD0_SRC_GPR                                     0xFF80FFFF
410bf215546Sopenharmony_ci#define   S_SQ_TEX_WORD0_SRC_REL(x)                                  (((unsigned)(x) & 0x1) << 23)
411bf215546Sopenharmony_ci#define   G_SQ_TEX_WORD0_SRC_REL(x)                                  (((x) >> 23) & 0x1)
412bf215546Sopenharmony_ci#define   C_SQ_TEX_WORD0_SRC_REL                                     0xFF7FFFFF
413bf215546Sopenharmony_ci#define   S_SQ_TEX_WORD0_ALT_CONST(x)                                (((unsigned)(x) & 0x1) << 24)
414bf215546Sopenharmony_ci#define   G_SQ_TEX_WORD0_ALT_CONST(x)                                (((x) >> 24) & 0x1)
415bf215546Sopenharmony_ci#define   C_SQ_TEX_WORD0_ALT_CONST                                   0xFEFFFFFF
416bf215546Sopenharmony_ci#define P_SQ_TEX_WORD1
417bf215546Sopenharmony_ci#define   S_SQ_TEX_WORD1_DST_GPR(x)                                  (((unsigned)(x) & 0x7F) << 0)
418bf215546Sopenharmony_ci#define   G_SQ_TEX_WORD1_DST_GPR(x)                                  (((x) >> 0) & 0x7F)
419bf215546Sopenharmony_ci#define   C_SQ_TEX_WORD1_DST_GPR                                     0xFFFFFF80
420bf215546Sopenharmony_ci#define   S_SQ_TEX_WORD1_DST_REL(x)                                  (((unsigned)(x) & 0x1) << 7)
421bf215546Sopenharmony_ci#define   G_SQ_TEX_WORD1_DST_REL(x)                                  (((x) >> 7) & 0x1)
422bf215546Sopenharmony_ci#define   C_SQ_TEX_WORD1_DST_REL                                     0xFFFFFF7F
423bf215546Sopenharmony_ci#define   S_SQ_TEX_WORD1_DST_SEL_X(x)                                (((unsigned)(x) & 0x7) << 9)
424bf215546Sopenharmony_ci#define   G_SQ_TEX_WORD1_DST_SEL_X(x)                                (((x) >> 9) & 0x7)
425bf215546Sopenharmony_ci#define   C_SQ_TEX_WORD1_DST_SEL_X                                   0xFFFFF1FF
426bf215546Sopenharmony_ci#define   S_SQ_TEX_WORD1_DST_SEL_Y(x)                                (((unsigned)(x) & 0x7) << 12)
427bf215546Sopenharmony_ci#define   G_SQ_TEX_WORD1_DST_SEL_Y(x)                                (((x) >> 12) & 0x7)
428bf215546Sopenharmony_ci#define   C_SQ_TEX_WORD1_DST_SEL_Y                                   0xFFFF8FFF
429bf215546Sopenharmony_ci#define   S_SQ_TEX_WORD1_DST_SEL_Z(x)                                (((unsigned)(x) & 0x7) << 15)
430bf215546Sopenharmony_ci#define   G_SQ_TEX_WORD1_DST_SEL_Z(x)                                (((x) >> 15) & 0x7)
431bf215546Sopenharmony_ci#define   C_SQ_TEX_WORD1_DST_SEL_Z                                   0xFFFC7FFF
432bf215546Sopenharmony_ci#define   S_SQ_TEX_WORD1_DST_SEL_W(x)                                (((unsigned)(x) & 0x7) << 18)
433bf215546Sopenharmony_ci#define   G_SQ_TEX_WORD1_DST_SEL_W(x)                                (((x) >> 18) & 0x7)
434bf215546Sopenharmony_ci#define   C_SQ_TEX_WORD1_DST_SEL_W                                   0xFFE3FFFF
435bf215546Sopenharmony_ci#define   S_SQ_TEX_WORD1_LOD_BIAS(x)                                 (((unsigned)(x) & 0x7F) << 21)
436bf215546Sopenharmony_ci#define   G_SQ_TEX_WORD1_LOD_BIAS(x)                                 (((x) >> 21) & 0x7F)
437bf215546Sopenharmony_ci#define   C_SQ_TEX_WORD1_LOD_BIAS                                    0xF01FFFFF
438bf215546Sopenharmony_ci#define   S_SQ_TEX_WORD1_COORD_TYPE_X(x)                             (((unsigned)(x) & 0x1) << 28)
439bf215546Sopenharmony_ci#define   G_SQ_TEX_WORD1_COORD_TYPE_X(x)                             (((x) >> 28) & 0x1)
440bf215546Sopenharmony_ci#define   C_SQ_TEX_WORD1_COORD_TYPE_X                                0xEFFFFFFF
441bf215546Sopenharmony_ci#define     V_SQ_TEX_WORD1_COORD_UNNORMALIZED                        0x00000000
442bf215546Sopenharmony_ci#define     V_SQ_TEX_WORD1_COORD_NORMALIZED                          0x00000001
443bf215546Sopenharmony_ci#define   S_SQ_TEX_WORD1_COORD_TYPE_Y(x)                             (((unsigned)(x) & 0x1) << 29)
444bf215546Sopenharmony_ci#define   G_SQ_TEX_WORD1_COORD_TYPE_Y(x)                             (((x) >> 29) & 0x1)
445bf215546Sopenharmony_ci#define   C_SQ_TEX_WORD1_COORD_TYPE_Y                                0xDFFFFFFF
446bf215546Sopenharmony_ci#define   S_SQ_TEX_WORD1_COORD_TYPE_Z(x)                             (((unsigned)(x) & 0x1) << 30)
447bf215546Sopenharmony_ci#define   G_SQ_TEX_WORD1_COORD_TYPE_Z(x)                             (((x) >> 30) & 0x1)
448bf215546Sopenharmony_ci#define   C_SQ_TEX_WORD1_COORD_TYPE_Z                                0xBFFFFFFF
449bf215546Sopenharmony_ci#define   S_SQ_TEX_WORD1_COORD_TYPE_W(x)                             (((unsigned)(x) & 0x1) << 31)
450bf215546Sopenharmony_ci#define   G_SQ_TEX_WORD1_COORD_TYPE_W(x)                             (((x) >> 31) & 0x1)
451bf215546Sopenharmony_ci#define   C_SQ_TEX_WORD1_COORD_TYPE_W                                0x7FFFFFFF
452bf215546Sopenharmony_ci#define P_SQ_TEX_WORD2
453bf215546Sopenharmony_ci#define   S_SQ_TEX_WORD2_OFFSET_X(x)                                 (((unsigned)(x) & 0x1F) << 0)
454bf215546Sopenharmony_ci#define   G_SQ_TEX_WORD2_OFFSET_X(x)                                 (((x) >> 0) & 0x1F)
455bf215546Sopenharmony_ci#define   C_SQ_TEX_WORD2_OFFSET_X                                    0xFFFFFFE0
456bf215546Sopenharmony_ci#define   S_SQ_TEX_WORD2_OFFSET_Y(x)                                 (((unsigned)(x) & 0x1F) << 5)
457bf215546Sopenharmony_ci#define   G_SQ_TEX_WORD2_OFFSET_Y(x)                                 (((x) >> 5) & 0x1F)
458bf215546Sopenharmony_ci#define   C_SQ_TEX_WORD2_OFFSET_Y                                    0xFFFFFC1F
459bf215546Sopenharmony_ci#define   S_SQ_TEX_WORD2_OFFSET_Z(x)                                 (((unsigned)(x) & 0x1F) << 10)
460bf215546Sopenharmony_ci#define   G_SQ_TEX_WORD2_OFFSET_Z(x)                                 (((x) >> 10) & 0x1F)
461bf215546Sopenharmony_ci#define   C_SQ_TEX_WORD2_OFFSET_Z                                    0xFFFF83FF
462bf215546Sopenharmony_ci#define   S_SQ_TEX_WORD2_SAMPLER_ID(x)                               (((unsigned)(x) & 0x1F) << 15)
463bf215546Sopenharmony_ci#define   G_SQ_TEX_WORD2_SAMPLER_ID(x)                               (((x) >> 15) & 0x1F)
464bf215546Sopenharmony_ci#define   C_SQ_TEX_WORD2_SAMPLER_ID                                  0xFFF07FFF
465bf215546Sopenharmony_ci#define   S_SQ_TEX_WORD2_SRC_SEL_X(x)                                (((unsigned)(x) & 0x7) << 20)
466bf215546Sopenharmony_ci#define   G_SQ_TEX_WORD2_SRC_SEL_X(x)                                (((x) >> 20) & 0x7)
467bf215546Sopenharmony_ci#define   C_SQ_TEX_WORD2_SRC_SEL_X                                   0xFF8FFFFF
468bf215546Sopenharmony_ci#define   S_SQ_TEX_WORD2_SRC_SEL_Y(x)                                (((unsigned)(x) & 0x7) << 23)
469bf215546Sopenharmony_ci#define   G_SQ_TEX_WORD2_SRC_SEL_Y(x)                                (((x) >> 23) & 0x7)
470bf215546Sopenharmony_ci#define   C_SQ_TEX_WORD2_SRC_SEL_Y                                   0xFC7FFFFF
471bf215546Sopenharmony_ci#define   S_SQ_TEX_WORD2_SRC_SEL_Z(x)                                (((unsigned)(x) & 0x7) << 26)
472bf215546Sopenharmony_ci#define   G_SQ_TEX_WORD2_SRC_SEL_Z(x)                                (((x) >> 26) & 0x7)
473bf215546Sopenharmony_ci#define   C_SQ_TEX_WORD2_SRC_SEL_Z                                   0xE3FFFFFF
474bf215546Sopenharmony_ci#define   S_SQ_TEX_WORD2_SRC_SEL_W(x)                                (((unsigned)(x) & 0x7) << 29)
475bf215546Sopenharmony_ci#define   G_SQ_TEX_WORD2_SRC_SEL_W(x)                                (((x) >> 29) & 0x7)
476bf215546Sopenharmony_ci#define   C_SQ_TEX_WORD2_SRC_SEL_W                                   0x1FFFFFFF
477bf215546Sopenharmony_ci
478bf215546Sopenharmony_ci#define V_SQ_CF_COND_ACTIVE                             0x00
479bf215546Sopenharmony_ci#define V_SQ_CF_COND_FALSE                              0x01
480bf215546Sopenharmony_ci#define V_SQ_CF_COND_BOOL                               0x02
481bf215546Sopenharmony_ci#define V_SQ_CF_COND_NOT_BOOL                           0x03
482bf215546Sopenharmony_ci
483bf215546Sopenharmony_ci#define V_SQ_REL_ABSOLUTE 0
484bf215546Sopenharmony_ci#define V_SQ_REL_RELATIVE 1
485bf215546Sopenharmony_ci
486bf215546Sopenharmony_ci#define SQ_ALU_VEC_012                                0x00
487bf215546Sopenharmony_ci#define SQ_ALU_VEC_021                                0x01
488bf215546Sopenharmony_ci#define SQ_ALU_VEC_120                                0x02
489bf215546Sopenharmony_ci#define SQ_ALU_VEC_102                                0x03
490bf215546Sopenharmony_ci#define SQ_ALU_VEC_201                                0x04
491bf215546Sopenharmony_ci#define SQ_ALU_VEC_210                                0x05
492bf215546Sopenharmony_ci
493bf215546Sopenharmony_ci#define SQ_ALU_SCL_210                           0x00000000
494bf215546Sopenharmony_ci#define SQ_ALU_SCL_122                           0x00000001
495bf215546Sopenharmony_ci#define SQ_ALU_SCL_212                           0x00000002
496bf215546Sopenharmony_ci#define SQ_ALU_SCL_221                           0x00000003
497bf215546Sopenharmony_ci
498bf215546Sopenharmony_ci#define   INDEX_MODE_AR_X 0
499bf215546Sopenharmony_ci#define   INDEX_MODE_AR_Y 1
500bf215546Sopenharmony_ci#define   INDEX_MODE_AR_Z 2
501bf215546Sopenharmony_ci#define   INDEX_MODE_AR_W 3
502bf215546Sopenharmony_ci#define   INDEX_MODE_LOOP 4
503bf215546Sopenharmony_ci
504bf215546Sopenharmony_ci#define SQ_VTX_FETCH_VERTEX_DATA 0
505bf215546Sopenharmony_ci#define SQ_VTX_FETCH_INSTANCE_DATA 1
506bf215546Sopenharmony_ci#define SQ_VTX_FETCH_NO_INDEX_OFFSET 2
507bf215546Sopenharmony_ci
508bf215546Sopenharmony_ci/* EG RAT functions */
509bf215546Sopenharmony_ci#define       V_RAT_INST_NOP                                         0
510bf215546Sopenharmony_ci#define       V_RAT_INST_STORE_TYPED                                 1
511bf215546Sopenharmony_ci#define       V_RAT_INST_CMPXCHG_INT                                 4
512bf215546Sopenharmony_ci#define       V_RAT_INST_ADD                                         7
513bf215546Sopenharmony_ci#define       V_RAT_INST_SUB                                         8
514bf215546Sopenharmony_ci#define       V_RAT_INST_RSUB                                        9
515bf215546Sopenharmony_ci#define       V_RAT_INST_MIN_INT                                     10
516bf215546Sopenharmony_ci#define       V_RAT_INST_MIN_UINT                                    11
517bf215546Sopenharmony_ci#define       V_RAT_INST_MAX_INT                                     12
518bf215546Sopenharmony_ci#define       V_RAT_INST_MAX_UINT                                    13
519bf215546Sopenharmony_ci#define       V_RAT_INST_AND                                         14
520bf215546Sopenharmony_ci#define       V_RAT_INST_OR                                          15
521bf215546Sopenharmony_ci#define       V_RAT_INST_XOR                                         16
522bf215546Sopenharmony_ci#define       V_RAT_INST_INC_UINT                                    18
523bf215546Sopenharmony_ci#define       V_RAT_INST_DEC_UINT                                    19
524bf215546Sopenharmony_ci#define       V_RAT_INST_STORE_DWORD                                 20
525bf215546Sopenharmony_ci#define       V_RAT_INST_STORE_SHORT                                 21
526bf215546Sopenharmony_ci#define       V_RAT_INST_STORE_BYTE                                  22
527bf215546Sopenharmony_ci#define       V_RAT_INST_NOP_RTN                                     32
528bf215546Sopenharmony_ci#define       V_RAT_INST_XCHG_RTN                                    34
529bf215546Sopenharmony_ci#define       V_RAT_INST_CMPXCHG_INT_RTN                             36
530bf215546Sopenharmony_ci#define       V_RAT_INST_ADD_RTN                                     39
531bf215546Sopenharmony_ci#define       V_RAT_INST_SUB_RTN                                     40
532bf215546Sopenharmony_ci#define       V_RAT_INST_RSUB_RTN                                    41
533bf215546Sopenharmony_ci#define       V_RAT_INST_MIN_INT_RTN                                 42
534bf215546Sopenharmony_ci#define       V_RAT_INST_MIN_UINT_RTN                                43
535bf215546Sopenharmony_ci#define       V_RAT_INST_MAX_INT_RTN                                 44
536bf215546Sopenharmony_ci#define       V_RAT_INST_MAX_UINT_RTN                                45
537bf215546Sopenharmony_ci#define       V_RAT_INST_AND_RTN                                     46
538bf215546Sopenharmony_ci#define       V_RAT_INST_OR_RTN                                      47
539bf215546Sopenharmony_ci#define       V_RAT_INST_XOR_RTN                                     48
540bf215546Sopenharmony_ci#define       V_RAT_INST_INC_UINT_RTN                                50
541bf215546Sopenharmony_ci#define       V_RAT_INST_DEC_UINT_RTN                                51
542bf215546Sopenharmony_ci
543bf215546Sopenharmony_ci#endif
544