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