• 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 EG_SQ_H
27 #define EG_SQ_H
28 
29 #define P_SQ_CF_WORD0
30 #define   S_SQ_CF_WORD0_ADDR(x)                                      (((unsigned)(x) & 0xFFFFFF) << 0)
31 #define   G_SQ_CF_WORD0_ADDR(x)                                      (((x) >> 0) & 0xFFFFFF)
32 #define   C_SQ_CF_WORD0_ADDR                                         0x00000000
33 #define   S_SQ_CF_WORD0_JUMPTABLE_SEL(x)                             (((unsigned)(x) & 0x7) << 24)
34 #define   G_SQ_CF_WORD0_JUMPTABLE_SEL(x)                             (((x) >> 24) & 0x7)
35 #define   C_SQ_CF_WORD0_JUMPTABLE_SEL                                0xF8FFFFFF
36 #define P_SQ_CF_WORD1
37 #define   S_SQ_CF_WORD1_POP_COUNT(x)                                 (((unsigned)(x) & 0x7) << 0)
38 #define   G_SQ_CF_WORD1_POP_COUNT(x)                                 (((x) >> 0) & 0x7)
39 #define   C_SQ_CF_WORD1_POP_COUNT                                    0xFFFFFFF8
40 #define   S_SQ_CF_WORD1_CF_CONST(x)                                  (((unsigned)(x) & 0x1F) << 3)
41 #define   G_SQ_CF_WORD1_CF_CONST(x)                                  (((x) >> 3) & 0x1F)
42 #define   C_SQ_CF_WORD1_CF_CONST                                     0xFFFFFF07
43 #define   S_SQ_CF_WORD1_COND(x)                                      (((unsigned)(x) & 0x3) << 8)
44 #define   G_SQ_CF_WORD1_COND(x)                                      (((x) >> 8) & 0x3)
45 #define   C_SQ_CF_WORD1_COND                                         0xFFFFFCFF
46 #define   S_SQ_CF_WORD1_COUNT(x)                                     (((unsigned)(x) & 0x3f) << 10)
47 #define   G_SQ_CF_WORD1_COUNT(x)                                     (((x) >> 10) & 0x3f)
48 #define   C_SQ_CF_WORD1_COUNT                                        0xFFFF03FF
49 #define   S_SQ_CF_WORD1_VALID_PIXEL_MODE(x)                          (((unsigned)(x) & 0x1) << 20)
50 #define   G_SQ_CF_WORD1_VALID_PIXEL_MODE(x)                          (((x) >> 20) & 0x1)
51 #define   C_SQ_CF_WORD1_VALID_PIXEL_MODE                             0xFFEFFFFF
52 #define   S_SQ_CF_WORD1_END_OF_PROGRAM(x)                            (((unsigned)(x) & 0x1) << 21)
53 #define   G_SQ_CF_WORD1_END_OF_PROGRAM(x)                            (((x) >> 21) & 0x1)
54 #define   C_SQ_CF_WORD1_END_OF_PROGRAM                               0xFFDFFFFF
55 
56 #define   S_SQ_CF_WORD1_CF_INST(x)                                   (((unsigned)(x) & 0xFF) << 22)
57 #define   G_SQ_CF_WORD1_CF_INST(x)                                   (((x) >> 22) & 0xFF)
58 #define   C_SQ_CF_WORD1_CF_INST                                      0xC03FFFFF
59 
60 #define   S_SQ_CF_WORD1_WHOLE_QUAD_MODE(x)                           (((unsigned)(x) & 0x1) << 30)
61 #define   G_SQ_CF_WORD1_WHOLE_QUAD_MODE(x)                           (((x) >> 30) & 0x1)
62 #define   C_SQ_CF_WORD1_WHOLE_QUAD_MODE                              0xBFFFFFFF
63 #define   S_SQ_CF_WORD1_BARRIER(x)                                   (((unsigned)(x) & 0x1) << 31)
64 #define   G_SQ_CF_WORD1_BARRIER(x)                                   (((x) >> 31) & 0x1)
65 #define   C_SQ_CF_WORD1_BARRIER                                      0x7FFFFFFF
66 
67 /* done */
68 #define P_SQ_CF_ALU_WORD0
69 #define   S_SQ_CF_ALU_WORD0_ADDR(x)                                  (((unsigned)(x) & 0x3FFFFF) << 0)
70 #define   G_SQ_CF_ALU_WORD0_ADDR(x)                                  (((x) >> 0) & 0x3FFFFF)
71 #define   C_SQ_CF_ALU_WORD0_ADDR                                     0xFFC00000
72 #define   S_SQ_CF_ALU_WORD0_KCACHE_BANK0(x)                          (((unsigned)(x) & 0xF) << 22)
73 #define   G_SQ_CF_ALU_WORD0_KCACHE_BANK0(x)                          (((x) >> 22) & 0xF)
74 #define   C_SQ_CF_ALU_WORD0_KCACHE_BANK0                             0xFC3FFFFF
75 #define   S_SQ_CF_ALU_WORD0_KCACHE_BANK1(x)                          (((unsigned)(x) & 0xF) << 26)
76 #define   G_SQ_CF_ALU_WORD0_KCACHE_BANK1(x)                          (((x) >> 26) & 0xF)
77 #define   C_SQ_CF_ALU_WORD0_KCACHE_BANK1                             0xC3FFFFFF
78 #define   S_SQ_CF_ALU_WORD0_KCACHE_MODE0(x)                          (((unsigned)(x) & 0x3) << 30)
79 #define   G_SQ_CF_ALU_WORD0_KCACHE_MODE0(x)                          (((x) >> 30) & 0x3)
80 #define   C_SQ_CF_ALU_WORD0_KCACHE_MODE0                             0x3FFFFFFF
81 #define     V_SQ_CF_KCACHE_NOP                                       0x00000000
82 #define     V_SQ_CF_KCACHE_LOCK_1                                    0x00000001
83 #define     V_SQ_CF_KCACHE_LOCK_2                                    0x00000002
84 #define     V_SQ_CF_KCACHE_LOCK_LOOP_INDEX                           0x00000003
85 #define P_SQ_CF_ALU_WORD1
86 #define   S_SQ_CF_ALU_WORD1_KCACHE_MODE1(x)                          (((unsigned)(x) & 0x3) << 0)
87 #define   G_SQ_CF_ALU_WORD1_KCACHE_MODE1(x)                          (((x) >> 0) & 0x3)
88 #define   C_SQ_CF_ALU_WORD1_KCACHE_MODE1                             0xFFFFFFFC
89 #define   S_SQ_CF_ALU_WORD1_KCACHE_ADDR0(x)                          (((unsigned)(x) & 0xFF) << 2)
90 #define   G_SQ_CF_ALU_WORD1_KCACHE_ADDR0(x)                          (((x) >> 2) & 0xFF)
91 #define   C_SQ_CF_ALU_WORD1_KCACHE_ADDR0                             0xFFFFFC03
92 #define   S_SQ_CF_ALU_WORD1_KCACHE_ADDR1(x)                          (((unsigned)(x) & 0xFF) << 10)
93 #define   G_SQ_CF_ALU_WORD1_KCACHE_ADDR1(x)                          (((x) >> 10) & 0xFF)
94 #define   C_SQ_CF_ALU_WORD1_KCACHE_ADDR1                             0xFFFC03FF
95 #define   S_SQ_CF_ALU_WORD1_COUNT(x)                                 (((unsigned)(x) & 0x7F) << 18)
96 #define   G_SQ_CF_ALU_WORD1_COUNT(x)                                 (((x) >> 18) & 0x7F)
97 #define   C_SQ_CF_ALU_WORD1_COUNT                                    0xFE03FFFF
98 #define   S_SQ_CF_ALU_WORD1_ALT_CONST(x)                             (((unsigned)(x) & 0x1) << 25)
99 #define   G_SQ_CF_ALU_WORD1_ALT_CONST(x)                             (((x) >> 25) & 0x1)
100 #define   C_SQ_CF_ALU_WORD1_ALT_CONST                                0xFDFFFFFF
101 #define   S_SQ_CF_ALU_WORD1_CF_INST(x)                               (((unsigned)(x) & 0xF) << 26)
102 #define   G_SQ_CF_ALU_WORD1_CF_INST(x)                               (((x) >> 26) & 0xF)
103 #define   C_SQ_CF_ALU_WORD1_CF_INST                                  0xC3FFFFFF
104 #define   S_SQ_CF_ALU_WORD1_WHOLE_QUAD_MODE(x)                       (((unsigned)(x) & 0x1) << 30)
105 #define   G_SQ_CF_ALU_WORD1_WHOLE_QUAD_MODE(x)                       (((x) >> 30) & 0x1)
106 #define   C_SQ_CF_ALU_WORD1_WHOLE_QUAD_MODE                          0xBFFFFFFF
107 #define   S_SQ_CF_ALU_WORD1_BARRIER(x)                               (((unsigned)(x) & 0x1) << 31)
108 #define   G_SQ_CF_ALU_WORD1_BARRIER(x)                               (((x) >> 31) & 0x1)
109 #define   C_SQ_CF_ALU_WORD1_BARRIER                                  0x7FFFFFFF
110 
111 #define P_SQ_CF_ALU_WORD0_EXT
112 #define   S_SQ_CF_ALU_WORD0_EXT_KCACHE_BANK_INDEX_MODE0(x)           (((unsigned)(x) & 0x3) << 4)
113 #define   G_SQ_CF_ALU_WORD0_EXT_KCACHE_BANK_INDEX_MODE0(x)           (((x) >> 4) & 0x3)
114 #define   C_SQ_CF_ALU_WORD0_EXT_KCACHE_BANK_INDEX_MODE0              0xFFFFFFCF
115 #define	    V_SQ_CF_INDEX_NONE                                       0x00
116 #define	    V_SQ_CF_INDEX_0                                          0x01
117 #define	    V_SQ_CF_INDEX_1                                          0x02
118 #define   S_SQ_CF_ALU_WORD0_EXT_KCACHE_BANK_INDEX_MODE1(x)           (((unsigned)(x) & 0x3) << 6)
119 #define   G_SQ_CF_ALU_WORD0_EXT_KCACHE_BANK_INDEX_MODE1(x)           (((x) >> 6) & 0x3)
120 #define   C_SQ_CF_ALU_WORD0_EXT_KCACHE_BANK_INDEX_MODE1              0xFFFFFF3F
121 #define   S_SQ_CF_ALU_WORD0_EXT_KCACHE_BANK_INDEX_MODE2(x)           (((unsigned)(x) & 0x3) << 8)
122 #define   G_SQ_CF_ALU_WORD0_EXT_KCACHE_BANK_INDEX_MODE2(x)           (((x) >> 8) & 0x3)
123 #define   C_SQ_CF_ALU_WORD0_EXT_KCACHE_BANK_INDEX_MODE2              0xFFFFFCFF
124 #define   S_SQ_CF_ALU_WORD0_EXT_KCACHE_BANK_INDEX_MODE3(x)           (((unsigned)(x) & 0x3) << 10)
125 #define   G_SQ_CF_ALU_WORD0_EXT_KCACHE_BANK_INDEX_MODE3(x)           (((x) >> 10) & 0x3)
126 #define   C_SQ_CF_ALU_WORD0_EXT_KCACHE_BANK_INDEX_MODE3              0xFFFFF3FF
127 #define   S_SQ_CF_ALU_WORD0_EXT_KCACHE_BANK2(x)                      (((unsigned)(x) & 0xF) << 22)
128 #define   G_SQ_CF_ALU_WORD0_EXT_KCACHE_BANK2(x)                      (((x) >> 22) & 0xF)
129 #define   C_SQ_CF_ALU_WORD0_EXT_KCACHE_BANK2                         0xFC3FFFFF
130 #define   S_SQ_CF_ALU_WORD0_EXT_KCACHE_BANK3(x)                      (((unsigned)(x) & 0xF) << 26)
131 #define   G_SQ_CF_ALU_WORD0_EXT_KCACHE_BANK3(x)                      (((x) >> 26) & 0xF)
132 #define   C_SQ_CF_ALU_WORD0_EXT_KCACHE_BANK3                         0xC3FFFFFF
133 #define   S_SQ_CF_ALU_WORD0_EXT_KCACHE_MODE2(x)                      (((unsigned)(x) & 0x3) << 30)
134 #define   G_SQ_CF_ALU_WORD0_EXT_KCACHE_MODE2(x)                      (((x) >> 30) & 0x3)
135 #define   C_SQ_CF_ALU_WORD0_EXT_KCACHE_MODE2                         0x3FFFFFFF
136 
137 #define P_SQ_CF_ALU_WORD1_EXT
138 #define   S_SQ_CF_ALU_WORD1_EXT_KCACHE_MODE3(x)                      (((unsigned)(x) & 0x3) << 0)
139 #define   G_SQ_CF_ALU_WORD1_EXT_KCACHE_MODE3(x)                      (((x) >> 0) & 0x3)
140 #define   C_SQ_CF_ALU_WORD1_EXT_KCACHE_MODE3                         0xFFFFFFFC
141 #define   S_SQ_CF_ALU_WORD1_EXT_KCACHE_ADDR2(x)                      (((unsigned)(x) & 0xFF) << 2)
142 #define   G_SQ_CF_ALU_WORD1_EXT_KCACHE_ADDR2(x)                      (((x) >> 2) & 0xFF)
143 #define   C_SQ_CF_ALU_WORD1_EXT_KCACHE_ADDR2                         0xFFFFFC03
144 #define   S_SQ_CF_ALU_WORD1_EXT_KCACHE_ADDR3(x)                      (((unsigned)(x) & 0xFF) << 10)
145 #define   G_SQ_CF_ALU_WORD1_EXT_KCACHE_ADDR3(x)                      (((x) >> 10) & 0xFF)
146 #define   C_SQ_CF_ALU_WORD1_EXT_KCACHE_ADDR3                         0xFFFC03FF
147 #define   S_SQ_CF_ALU_WORD1_EXT_CF_INST(x)                           (((unsigned)(x) & 0xF) << 26)
148 #define   G_SQ_CF_ALU_WORD1_EXT_CF_INST(x)                           (((x) >> 26) & 0xF)
149 #define   C_SQ_CF_ALU_WORD1_EXT_CF_INST                              0xC3FFFFFF
150 #define   S_SQ_CF_ALU_WORD1_EXT_BARRIER(x)                           (((unsigned)(x) & 0x1) << 31)
151 #define   G_SQ_CF_ALU_WORD1_EXT_BARRIER(x)                           (((x) >> 31) & 0x1)
152 #define   C_SQ_CF_ALU_WORD1_EXT_BARRIER                              0x7FFFFFFF
153 
154 /* done */
155 #define P_SQ_CF_ALLOC_EXPORT_WORD0
156 #define   S_SQ_CF_ALLOC_EXPORT_WORD0_ARRAY_BASE(x)                   (((unsigned)(x) & 0x1FFF) << 0)
157 #define   G_SQ_CF_ALLOC_EXPORT_WORD0_ARRAY_BASE(x)                   (((x) >> 0) & 0x1FFF)
158 #define   C_SQ_CF_ALLOC_EXPORT_WORD0_ARRAY_BASE                      0xFFFFE000
159 #define   S_SQ_CF_ALLOC_EXPORT_WORD0_TYPE(x)                         (((unsigned)(x) & 0x3) << 13)
160 #define   G_SQ_CF_ALLOC_EXPORT_WORD0_TYPE(x)                         (((x) >> 13) & 0x3)
161 #define   C_SQ_CF_ALLOC_EXPORT_WORD0_TYPE                            0xFFFF9FFF
162 #define     V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL               0x00000000
163 #define     V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_POS                 0x00000001
164 #define     V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM               0x00000002
165 #define     V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_WRITE               0x00000000
166 #define     V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_WRITE_IND           0x00000001
167 #define     V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_READ                0x00000002
168 #define     V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_WRITE_ACK           0x00000002
169 #define     V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_READ_IND            0x00000003
170 #define     V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_WRITE_IND_ACK       0x00000003
171 
172 #define   S_SQ_CF_ALLOC_EXPORT_WORD0_RW_GPR(x)                       (((unsigned)(x) & 0x7F) << 15)
173 #define   G_SQ_CF_ALLOC_EXPORT_WORD0_RW_GPR(x)                       (((x) >> 15) & 0x7F)
174 #define   C_SQ_CF_ALLOC_EXPORT_WORD0_RW_GPR                          0xFFC07FFF
175 #define   S_SQ_CF_ALLOC_EXPORT_WORD0_RW_REL(x)                       (((unsigned)(x) & 0x1) << 22)
176 #define   G_SQ_CF_ALLOC_EXPORT_WORD0_RW_REL(x)                       (((x) >> 22) & 0x1)
177 #define   C_SQ_CF_ALLOC_EXPORT_WORD0_RW_REL                          0xFFBFFFFF
178 #define   S_SQ_CF_ALLOC_EXPORT_WORD0_INDEX_GPR(x)                    (((unsigned)(x) & 0x7F) << 23)
179 #define   G_SQ_CF_ALLOC_EXPORT_WORD0_INDEX_GPR(x)                    (((x) >> 23) & 0x7F)
180 #define   C_SQ_CF_ALLOC_EXPORT_WORD0_INDEX_GPR                       0xC07FFFFF
181 #define   S_SQ_CF_ALLOC_EXPORT_WORD0_ELEM_SIZE(x)                    (((unsigned)(x) & 0x3) << 30)
182 #define   G_SQ_CF_ALLOC_EXPORT_WORD0_ELEM_SIZE(x)                    (((x) >> 30) & 0x3)
183 #define   C_SQ_CF_ALLOC_EXPORT_WORD0_ELEM_SIZE                       0x3FFFFFFF
184 /* done */
185 
186 #define P_SQ_CF_ALLOC_EXPORT_WORD0_RAT
187 #define   S_SQ_CF_ALLOC_EXPORT_WORD0_RAT_RAT_ID(x)                   (((x) & 0xF) << 0)
188 #define   G_SQ_CF_ALLOC_EXPORT_WORD0_RAT_RAT_ID(x)                   (((x) >> 0) & 0xF)
189 #define   C_SQ_CF_ALLOC_EXPORT_WORD0_RAT_RAT_ID                      0xFFFFFFF0
190 #define   S_SQ_CF_ALLOC_EXPORT_WORD0_RAT_RAT_INST(x)                 (((x) & 0x3F) << 4)
191 #define   G_SQ_CF_ALLOC_EXPORT_WORD0_RAT_RAT_INST(x)                 (((x) >> 4) & 0x3F)
192 #define   C_SQ_CF_ALLOC_EXPORT_WORD0_RAT_RAT_INST                    0xFFFFFC0F
193 #define   S_SQ_CF_ALLOC_EXPORT_WORD0_RAT_RAT_INDEX_MODE(x)           (((x) & 0x3) << 11)
194 #define   G_SQ_CF_ALLOC_EXPORT_WORD0_RAT_RAT_INDEX_MODE(x)           (((x) >> 11) & 0x3)
195 #define   C_SQ_CF_ALLOC_EXPORT_WORD0_RAT_RAT_INDEX_MODE              0xFFFFE7FF
196 
197 #define P_SQ_CF_ALLOC_EXPORT_WORD1
198 #define   S_SQ_CF_ALLOC_EXPORT_WORD1_BURST_COUNT(x)                  (((unsigned)(x) & 0xF) << 16)
199 #define   G_SQ_CF_ALLOC_EXPORT_WORD1_BURST_COUNT(x)                  (((x) >> 16) & 0xF)
200 #define   C_SQ_CF_ALLOC_EXPORT_WORD1_BURST_COUNT                     0xFFF0FFFF
201 #define   S_SQ_CF_ALLOC_EXPORT_WORD1_VALID_PIXEL_MODE(x)             (((unsigned)(x) & 0x1) << 20)
202 #define   G_SQ_CF_ALLOC_EXPORT_WORD1_VALID_PIXEL_MODE(x)             (((x) >> 20) & 0x1)
203 #define   C_SQ_CF_ALLOC_EXPORT_WORD1_VALID_PIXEL_MODE                0xFFEFFFFF
204 #define   S_SQ_CF_ALLOC_EXPORT_WORD1_END_OF_PROGRAM(x)               (((unsigned)(x) & 0x1) << 21)
205 #define   G_SQ_CF_ALLOC_EXPORT_WORD1_END_OF_PROGRAM(x)               (((x) >> 21) & 0x1)
206 #define   C_SQ_CF_ALLOC_EXPORT_WORD1_END_OF_PROGRAM                  0xFFDFFFFF
207 #define   S_SQ_CF_ALLOC_EXPORT_WORD1_CF_INST(x)                      (((unsigned)(x) & 0xFF) << 22)
208 #define   G_SQ_CF_ALLOC_EXPORT_WORD1_CF_INST(x)                      (((x) >> 22) & 0xFF)
209 #define   C_SQ_CF_ALLOC_EXPORT_WORD1_CF_INST                         0xC03FFFFF
210 
211 #define   S_SQ_CF_ALLOC_EXPORT_WORD1_MARK(x)                         (((unsigned)(x) & 0x1) << 30)
212 #define   G_SQ_CF_ALLOC_EXPORT_WORD1_MARK(x)                         (((x) >> 30) & 0x1)
213 #define   C_SQ_CF_ALLOC_EXPORT_WORD1_WHOLE_QUAD_MODE                 0xBFFFFFFF
214 #define   S_SQ_CF_ALLOC_EXPORT_WORD1_BARRIER(x)                      (((unsigned)(x) & 0x1) << 31)
215 #define   G_SQ_CF_ALLOC_EXPORT_WORD1_BARRIER(x)                      (((x) >> 31) & 0x1)
216 #define   C_SQ_CF_ALLOC_EXPORT_WORD1_BARRIER                         0x7FFFFFFF
217 
218 /* done */
219 #define P_SQ_CF_ALLOC_EXPORT_WORD1_BUF
220 #define   S_SQ_CF_ALLOC_EXPORT_WORD1_BUF_ARRAY_SIZE(x)               (((unsigned)(x) & 0xFFF) << 0)
221 #define   G_SQ_CF_ALLOC_EXPORT_WORD1_BUF_ARRAY_SIZE(x)               (((x) >> 0) & 0xFFF)
222 #define   C_SQ_CF_ALLOC_EXPORT_WORD1_BUF_ARRAY_SIZE                  0xFFFFF000
223 #define   S_SQ_CF_ALLOC_EXPORT_WORD1_BUF_COMP_MASK(x)                (((unsigned)(x) & 0xF) << 12)
224 #define   G_SQ_CF_ALLOC_EXPORT_WORD1_BUF_COMP_MASK(x)                (((x) >> 12) & 0xF)
225 #define   C_SQ_CF_ALLOC_EXPORT_WORD1_BUF_COMP_MASK                   0xFFFF0FFF
226 #define P_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ
227 #define   S_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_X(x)                   (((unsigned)(x) & 0x7) << 0)
228 #define   G_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_X(x)                   (((x) >> 0) & 0x7)
229 #define   C_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_X                      0xFFFFFFF8
230 #define   S_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Y(x)                   (((unsigned)(x) & 0x7) << 3)
231 #define   G_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Y(x)                   (((x) >> 3) & 0x7)
232 #define   C_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Y                      0xFFFFFFC7
233 #define   S_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Z(x)                   (((unsigned)(x) & 0x7) << 6)
234 #define   G_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Z(x)                   (((x) >> 6) & 0x7)
235 #define   C_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Z                      0xFFFFFE3F
236 #define   S_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_W(x)                   (((unsigned)(x) & 0x7) << 9)
237 #define   G_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_W(x)                   (((x) >> 9) & 0x7)
238 #define   C_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_W                      0xFFFFF1FF
239 
240 /* done */
241 #define P_SQ_ALU_WORD0
242 #define   S_SQ_ALU_WORD0_SRC0_SEL(x)                                 (((unsigned)(x) & 0x1FF) << 0)
243 #define   G_SQ_ALU_WORD0_SRC0_SEL(x)                                 (((x) >> 0) & 0x1FF)
244 #define   C_SQ_ALU_WORD0_SRC0_SEL                                    0xFFFFFE00
245 
246 /*
247  * 244  ALU_SRC_1_DBL_L: special constant 1.0 double-float, LSW. (RV670+)
248  * 245  ALU_SRC_1_DBL_M: special constant 1.0 double-float, MSW. (RV670+)
249  * 246  ALU_SRC_0_5_DBL_L: special constant 0.5 double-float, LSW. (RV670+)
250  * 247  ALU_SRC_0_5_DBL_M: special constant 0.5 double-float, MSW. (RV670+)
251  * 248  SQ_ALU_SRC_0: special constant 0.0.
252  * 249  SQ_ALU_SRC_1: special constant 1.0 float.
253  * 250  SQ_ALU_SRC_1_INT: special constant 1 integer.
254  * 251  SQ_ALU_SRC_M_1_INT: special constant -1 integer.
255  * 252  SQ_ALU_SRC_0_5: special constant 0.5 float.
256  * 253  SQ_ALU_SRC_LITERAL: literal constant.
257  * 254  SQ_ALU_SRC_PV: previous vector result.
258  * 255  SQ_ALU_SRC_PS: previous scalar result.
259  */
260 #define     V_SQ_ALU_SRC_0                                           0x000000F8
261 #define     V_SQ_ALU_SRC_1                                           0x000000F9
262 #define     V_SQ_ALU_SRC_1_INT                                       0x000000FA
263 #define     V_SQ_ALU_SRC_M_1_INT                                     0x000000FB
264 #define     V_SQ_ALU_SRC_0_5                                         0x000000FC
265 #define     V_SQ_ALU_SRC_LITERAL                                     0x000000FD
266 #define   S_SQ_ALU_WORD0_SRC0_REL(x)                                 (((unsigned)(x) & 0x1) << 9)
267 #define   G_SQ_ALU_WORD0_SRC0_REL(x)                                 (((x) >> 9) & 0x1)
268 #define   C_SQ_ALU_WORD0_SRC0_REL                                    0xFFFFFDFF
269 #define   S_SQ_ALU_WORD0_SRC0_CHAN(x)                                (((unsigned)(x) & 0x3) << 10)
270 #define   G_SQ_ALU_WORD0_SRC0_CHAN(x)                                (((x) >> 10) & 0x3)
271 #define   C_SQ_ALU_WORD0_SRC0_CHAN                                   0xFFFFF3FF
272 #define   S_SQ_ALU_WORD0_SRC0_NEG(x)                                 (((unsigned)(x) & 0x1) << 12)
273 #define   G_SQ_ALU_WORD0_SRC0_NEG(x)                                 (((x) >> 12) & 0x1)
274 #define   C_SQ_ALU_WORD0_SRC0_NEG                                    0xFFFFEFFF
275 #define   S_SQ_ALU_WORD0_SRC1_SEL(x)                                 (((unsigned)(x) & 0x1FF) << 13)
276 #define   G_SQ_ALU_WORD0_SRC1_SEL(x)                                 (((x) >> 13) & 0x1FF)
277 #define   C_SQ_ALU_WORD0_SRC1_SEL                                    0xFFC01FFF
278 #define   S_SQ_ALU_WORD0_SRC1_REL(x)                                 (((unsigned)(x) & 0x1) << 22)
279 #define   G_SQ_ALU_WORD0_SRC1_REL(x)                                 (((x) >> 22) & 0x1)
280 #define   C_SQ_ALU_WORD0_SRC1_REL                                    0xFFBFFFFF
281 #define   S_SQ_ALU_WORD0_SRC1_CHAN(x)                                (((unsigned)(x) & 0x3) << 23)
282 #define   G_SQ_ALU_WORD0_SRC1_CHAN(x)                                (((x) >> 23) & 0x3)
283 #define   C_SQ_ALU_WORD0_SRC1_CHAN                                   0xFE7FFFFF
284 #define   S_SQ_ALU_WORD0_SRC1_NEG(x)                                 (((unsigned)(x) & 0x1) << 25)
285 #define   G_SQ_ALU_WORD0_SRC1_NEG(x)                                 (((x) >> 25) & 0x1)
286 #define   C_SQ_ALU_WORD0_SRC1_NEG                                    0xFDFFFFFF
287 #define   S_SQ_ALU_WORD0_INDEX_MODE(x)                               (((unsigned)(x) & 0x7) << 26)
288 #define   G_SQ_ALU_WORD0_INDEX_MODE(x)                               (((x) >> 26) & 0x7)
289 #define   C_SQ_ALU_WORD0_INDEX_MODE                                  0xE3FFFFFF
290 #define   S_SQ_ALU_WORD0_PRED_SEL(x)                                 (((unsigned)(x) & 0x3) << 29)
291 #define   G_SQ_ALU_WORD0_PRED_SEL(x)                                 (((x) >> 29) & 0x3)
292 #define   C_SQ_ALU_WORD0_PRED_SEL                                    0x9FFFFFFF
293 #define   S_SQ_ALU_WORD0_LAST(x)                                     (((unsigned)(x) & 0x1) << 31)
294 #define   G_SQ_ALU_WORD0_LAST(x)                                     (((x) >> 31) & 0x1)
295 #define   C_SQ_ALU_WORD0_LAST                                        0x7FFFFFFF
296 /* same */
297 #define P_SQ_ALU_WORD1
298 #define   S_SQ_ALU_WORD1_ENCODING(x)                                 (((unsigned)(x) & 0x7) << 15)
299 #define   G_SQ_ALU_WORD1_ENCODING(x)                                 (((x) >> 15) & 0x7)
300 #define   C_SQ_ALU_WORD1_ENCODING                                    0xFFFC7FFF
301 #define   S_SQ_ALU_WORD1_BANK_SWIZZLE(x)                             (((unsigned)(x) & 0x7) << 18)
302 #define   G_SQ_ALU_WORD1_BANK_SWIZZLE(x)                             (((x) >> 18) & 0x7)
303 #define   C_SQ_ALU_WORD1_BANK_SWIZZLE                                0xFFE3FFFF
304 #define   S_SQ_ALU_WORD1_DST_GPR(x)                                  (((unsigned)(x) & 0x7F) << 21)
305 #define   G_SQ_ALU_WORD1_DST_GPR(x)                                  (((x) >> 21) & 0x7F)
306 #define   C_SQ_ALU_WORD1_DST_GPR                                     0xF01FFFFF
307 #define   S_SQ_ALU_WORD1_DST_REL(x)                                  (((unsigned)(x) & 0x1) << 28)
308 #define   G_SQ_ALU_WORD1_DST_REL(x)                                  (((x) >> 28) & 0x1)
309 #define   C_SQ_ALU_WORD1_DST_REL                                     0xEFFFFFFF
310 #define   S_SQ_ALU_WORD1_DST_CHAN(x)                                 (((unsigned)(x) & 0x3) << 29)
311 #define   G_SQ_ALU_WORD1_DST_CHAN(x)                                 (((x) >> 29) & 0x3)
312 #define   C_SQ_ALU_WORD1_DST_CHAN                                    0x9FFFFFFF
313 #define   S_SQ_ALU_WORD1_CLAMP(x)                                    (((unsigned)(x) & 0x1) << 31)
314 #define   G_SQ_ALU_WORD1_CLAMP(x)                                    (((x) >> 31) & 0x1)
315 #define   C_SQ_ALU_WORD1_CLAMP                                       0x7FFFFFFF
316 /* same except maybe encoding */
317 #define P_SQ_ALU_WORD1_OP2
318 #define   S_SQ_ALU_WORD1_OP2_SRC0_ABS(x)                             (((unsigned)(x) & 0x1) << 0)
319 #define   G_SQ_ALU_WORD1_OP2_SRC0_ABS(x)                             (((x) >> 0) & 0x1)
320 #define   C_SQ_ALU_WORD1_OP2_SRC0_ABS                                0xFFFFFFFE
321 #define   S_SQ_ALU_WORD1_OP2_SRC1_ABS(x)                             (((unsigned)(x) & 0x1) << 1)
322 #define   G_SQ_ALU_WORD1_OP2_SRC1_ABS(x)                             (((x) >> 1) & 0x1)
323 #define   C_SQ_ALU_WORD1_OP2_SRC1_ABS                                0xFFFFFFFD
324 #define   S_SQ_ALU_WORD1_OP2_UPDATE_EXECUTE_MASK(x)                  (((unsigned)(x) & 0x1) << 2)
325 #define   G_SQ_ALU_WORD1_OP2_UPDATE_EXECUTE_MASK(x)                  (((x) >> 2) & 0x1)
326 #define   C_SQ_ALU_WORD1_OP2_UPDATE_EXECUTE_MASK                     0xFFFFFFFB
327 #define   S_SQ_ALU_WORD1_OP2_UPDATE_PRED(x)                          (((unsigned)(x) & 0x1) << 3)
328 #define   G_SQ_ALU_WORD1_OP2_UPDATE_PRED(x)                          (((x) >> 3) & 0x1)
329 #define   C_SQ_ALU_WORD1_OP2_UPDATE_PRED                             0xFFFFFFF7
330 #define   S_SQ_ALU_WORD1_OP2_WRITE_MASK(x)                           (((unsigned)(x) & 0x1) << 4)
331 #define   G_SQ_ALU_WORD1_OP2_WRITE_MASK(x)                           (((x) >> 4) & 0x1)
332 #define   C_SQ_ALU_WORD1_OP2_WRITE_MASK                              0xFFFFFFEF
333 #define   S_SQ_ALU_WORD1_OP2_OMOD(x)                                 (((unsigned)(x) & 0x3) << 5)
334 #define   G_SQ_ALU_WORD1_OP2_OMOD(x)                                 (((x) >> 5) & 0x3)
335 #define   C_SQ_ALU_WORD1_OP2_OMOD                                    0xFFFFFF9F
336 #define   S_SQ_ALU_WORD1_OP2_ALU_INST(x)                             (((unsigned)(x) & 0x7FF) << 7)
337 #define   G_SQ_ALU_WORD1_OP2_ALU_INST(x)                             (((x) >> 7) & 0x7FF)
338 #define   C_SQ_ALU_WORD1_OP2_ALU_INST                                0xFFFC007F
339 
340 #define P_SQ_ALU_WORD1_OP3
341 #define   S_SQ_ALU_WORD1_OP3_SRC2_SEL(x)                             (((unsigned)(x) & 0x1FF) << 0)
342 #define   G_SQ_ALU_WORD1_OP3_SRC2_SEL(x)                             (((x) >> 0) & 0x1FF)
343 #define   C_SQ_ALU_WORD1_OP3_SRC2_SEL                                0xFFFFFE00
344 #define   S_SQ_ALU_WORD1_OP3_SRC2_REL(x)                             (((unsigned)(x) & 0x1) << 9)
345 #define   G_SQ_ALU_WORD1_OP3_SRC2_REL(x)                             (((x) >> 9) & 0x1)
346 #define   C_SQ_ALU_WORD1_OP3_SRC2_REL                                0xFFFFFDFF
347 #define   S_SQ_ALU_WORD1_OP3_SRC2_CHAN(x)                            (((unsigned)(x) & 0x3) << 10)
348 #define   G_SQ_ALU_WORD1_OP3_SRC2_CHAN(x)                            (((x) >> 10) & 0x3)
349 #define   C_SQ_ALU_WORD1_OP3_SRC2_CHAN                               0xFFFFF3FF
350 #define   S_SQ_ALU_WORD1_OP3_SRC2_NEG(x)                             (((unsigned)(x) & 0x1) << 12)
351 #define   G_SQ_ALU_WORD1_OP3_SRC2_NEG(x)                             (((x) >> 12) & 0x1)
352 #define   C_SQ_ALU_WORD1_OP3_SRC2_NEG                                0xFFFFEFFF
353 #define   S_SQ_ALU_WORD1_OP3_ALU_INST(x)                             (((unsigned)(x) & 0x1F) << 13)
354 #define   G_SQ_ALU_WORD1_OP3_ALU_INST(x)                             (((x) >> 13) & 0x1F)
355 #define   C_SQ_ALU_WORD1_OP3_ALU_INST                                0xFFFC1FFF
356 /* XXX ADD OTHER OP3 */
357 /* done */
358 #define P_SQ_VTX_WORD0
359 #define   S_SQ_VTX_WORD0_VTX_INST(x)                                 (((unsigned)(x) & 0x1F) << 0)
360 #define   G_SQ_VTX_WORD0_VTX_INST(x)                                 (((x) >> 0) & 0x1F)
361 #define   C_SQ_VTX_WORD0_VTX_INST                                    0xFFFFFFE0
362 #define   S_SQ_VTX_WORD0_FETCH_TYPE(x)                               (((unsigned)(x) & 0x3) << 5)
363 #define   G_SQ_VTX_WORD0_FETCH_TYPE(x)                               (((x) >> 5) & 0x3)
364 #define   C_SQ_VTX_WORD0_FETCH_TYPE                                  0xFFFFFF9F
365 #define   S_SQ_VTX_WORD0_FETCH_WHOLE_QUAD(x)                         (((unsigned)(x) & 0x1) << 7)
366 #define   G_SQ_VTX_WORD0_FETCH_WHOLE_QUAD(x)                         (((x) >> 7) & 0x1)
367 #define   C_SQ_VTX_WORD0_FETCH_WHOLE_QUAD                            0xFFFFFF7F
368 #define   S_SQ_VTX_WORD0_BUFFER_ID(x)                                (((unsigned)(x) & 0xFF) << 8)
369 #define   G_SQ_VTX_WORD0_BUFFER_ID(x)                                (((x) >> 8) & 0xFF)
370 #define   C_SQ_VTX_WORD0_BUFFER_ID                                   0xFFFF00FF
371 #define   S_SQ_VTX_WORD0_SRC_GPR(x)                                  (((unsigned)(x) & 0x7F) << 16)
372 #define   G_SQ_VTX_WORD0_SRC_GPR(x)                                  (((x) >> 16) & 0x7F)
373 #define   C_SQ_VTX_WORD0_SRC_GPR                                     0xFF80FFFF
374 #define   S_SQ_VTX_WORD0_SRC_REL(x)                                  (((unsigned)(x) & 0x1) << 23)
375 #define   G_SQ_VTX_WORD0_SRC_REL(x)                                  (((x) >> 23) & 0x1)
376 #define   C_SQ_VTX_WORD0_SRC_REL                                     0xFF7FFFFF
377 #define   S_SQ_VTX_WORD0_SRC_SEL_X(x)                                (((unsigned)(x) & 0x3) << 24)
378 #define   G_SQ_VTX_WORD0_SRC_SEL_X(x)                                (((x) >> 24) & 0x3)
379 #define   C_SQ_VTX_WORD0_SRC_SEL_X                                   0xFCFFFFFF
380 #define   S_SQ_VTX_WORD0_MEGA_FETCH_COUNT(x)                         (((unsigned)(x) & 0x3F) << 26)
381 #define   G_SQ_VTX_WORD0_MEGA_FETCH_COUNT(x)                         (((x) >> 26) & 0x3F)
382 #define   C_SQ_VTX_WORD0_MEGA_FETCH_COUNT                            0x03FFFFFF
383 /* same WORD 0 */
384 #define P_SQ_VTX_WORD1
385 #define   S_SQ_VTX_WORD1_DST_SEL_X(x)                                (((unsigned)(x) & 0x7) << 9)
386 #define   G_SQ_VTX_WORD1_DST_SEL_X(x)                                (((x) >> 9) & 0x7)
387 #define   C_SQ_VTX_WORD1_DST_SEL_X                                   0xFFFFF1FF
388 #define   S_SQ_VTX_WORD1_DST_SEL_Y(x)                                (((unsigned)(x) & 0x7) << 12)
389 #define   G_SQ_VTX_WORD1_DST_SEL_Y(x)                                (((x) >> 12) & 0x7)
390 #define   C_SQ_VTX_WORD1_DST_SEL_Y                                   0xFFFF8FFF
391 #define   S_SQ_VTX_WORD1_DST_SEL_Z(x)                                (((unsigned)(x) & 0x7) << 15)
392 #define   G_SQ_VTX_WORD1_DST_SEL_Z(x)                                (((x) >> 15) & 0x7)
393 #define   C_SQ_VTX_WORD1_DST_SEL_Z                                   0xFFFC7FFF
394 #define   S_SQ_VTX_WORD1_DST_SEL_W(x)                                (((unsigned)(x) & 0x7) << 18)
395 #define   G_SQ_VTX_WORD1_DST_SEL_W(x)                                (((x) >> 18) & 0x7)
396 #define   C_SQ_VTX_WORD1_DST_SEL_W                                   0xFFE3FFFF
397 #define   S_SQ_VTX_WORD1_USE_CONST_FIELDS(x)                         (((unsigned)(x) & 0x1) << 21)
398 #define   G_SQ_VTX_WORD1_USE_CONST_FIELDS(x)                         (((x) >> 21) & 0x1)
399 #define   C_SQ_VTX_WORD1_USE_CONST_FIELDS                            0xFFDFFFFF
400 #define   S_SQ_VTX_WORD1_DATA_FORMAT(x)                              (((unsigned)(x) & 0x3F) << 22)
401 #define   G_SQ_VTX_WORD1_DATA_FORMAT(x)                              (((x) >> 22) & 0x3F)
402 #define   C_SQ_VTX_WORD1_DATA_FORMAT                                 0xF03FFFFF
403 #define   S_SQ_VTX_WORD1_NUM_FORMAT_ALL(x)                           (((unsigned)(x) & 0x3) << 28)
404 #define   G_SQ_VTX_WORD1_NUM_FORMAT_ALL(x)                           (((x) >> 28) & 0x3)
405 #define   C_SQ_VTX_WORD1_NUM_FORMAT_ALL                              0xCFFFFFFF
406 #define   S_SQ_VTX_WORD1_FORMAT_COMP_ALL(x)                          (((unsigned)(x) & 0x1) << 30)
407 #define   G_SQ_VTX_WORD1_FORMAT_COMP_ALL(x)                          (((x) >> 30) & 0x1)
408 #define   C_SQ_VTX_WORD1_FORMAT_COMP_ALL                             0xBFFFFFFF
409 #define   S_SQ_VTX_WORD1_SRF_MODE_ALL(x)                             (((unsigned)(x) & 0x1) << 31)
410 #define   G_SQ_VTX_WORD1_SRF_MODE_ALL(x)                             (((x) >> 31) & 0x1)
411 #define   C_SQ_VTX_WORD1_SRF_MODE_ALL                                0x7FFFFFFF
412 /* same WORD1 generic */
413 #define P_SQ_VTX_WORD1_GPR
414 #define   S_SQ_VTX_WORD1_GPR_DST_GPR(x)                              (((unsigned)(x) & 0x7F) << 0)
415 #define   G_SQ_VTX_WORD1_GPR_DST_GPR(x)                              (((x) >> 0) & 0x7F)
416 #define   C_SQ_VTX_WORD1_GPR_DST_GPR                                 0xFFFFFF80
417 #define   S_SQ_VTX_WORD1_GPR_DST_REL(x)                              (((unsigned)(x) & 0x1) << 7)
418 #define   G_SQ_VTX_WORD1_GPR_DST_REL(x)                              (((x) >> 7) & 0x1)
419 #define   C_SQ_VTX_WORD1_GPR_DST_REL                                 0xFFFFFF7F
420 #define P_SQ_VTX_WORD1_SEM
421 #define   S_SQ_VTX_WORD1_SEM_SEMANTIC_ID(x)                          (((unsigned)(x) & 0xFF) << 0)
422 #define   G_SQ_VTX_WORD1_SEM_SEMANTIC_ID(x)                          (((x) >> 0) & 0xFF)
423 #define   C_SQ_VTX_WORD1_SEM_SEMANTIC_ID                             0xFFFFFF00
424 #define P_SQ_VTX_WORD2
425 #define   S_SQ_VTX_WORD2_OFFSET(x)                                   (((unsigned)(x) & 0xFFFF) << 0)
426 #define   G_SQ_VTX_WORD2_OFFSET(x)                                   (((x) >> 0) & 0xFFFF)
427 #define   C_SQ_VTX_WORD2_OFFSET                                      0xFFFF0000
428 #define   S_SQ_VTX_WORD2_ENDIAN_SWAP(x)                              (((unsigned)(x) & 0x3) << 16)
429 #define   G_SQ_VTX_WORD2_ENDIAN_SWAP(x)                              (((x) >> 16) & 0x3)
430 #define   C_SQ_VTX_WORD2_ENDIAN_SWAP                                 0xFFFCFFFF
431 #define   S_SQ_VTX_WORD2_CONST_BUF_NO_STRIDE(x)                      (((unsigned)(x) & 0x1) << 18)
432 #define   G_SQ_VTX_WORD2_CONST_BUF_NO_STRIDE(x)                      (((x) >> 18) & 0x1)
433 #define   C_SQ_VTX_WORD2_CONST_BUF_NO_STRIDE                         0xFFFBFFFF
434 #define   S_SQ_VTX_WORD2_MEGA_FETCH(x)                               (((unsigned)(x) & 0x1) << 19)
435 #define   G_SQ_VTX_WORD2_MEGA_FETCH(x)                               (((x) >> 19) & 0x1)
436 #define   C_SQ_VTX_WORD2_MEGA_FETCH                                  0xFFF7FFFF
437 #define   S_SQ_VTX_WORD2_ALT_CONST(x)                                (((unsigned)(x) & 0x1) << 20)
438 #define   G_SQ_VTX_WORD2_ALT_CONST(x)                                (((x) >> 20) & 0x1)
439 #define   C_SQ_VTX_WORD2_ALT_CONST                                   0xFFEFFFFF
440 #define   S_SQ_VTX_WORD2_BIM(x)                                      (((unsigned)(x) & 0x3) << 21)
441 #define   G_SQ_VTX_WORD2_BIM(x)                                      (((x) >> 21) & 0x3)
442 #define   C_SQ_VTX_WORD2_BIM                                         0xFF9FFFFF
443 /* done */
444 
445 #define P_SQ_TEX_WORD0
446 #define   S_SQ_TEX_WORD0_TEX_INST(x)                                 (((unsigned)(x) & 0x1F) << 0)
447 #define   G_SQ_TEX_WORD0_TEX_INST(x)                                 (((x) >> 0) & 0x1F)
448 #define   C_SQ_TEX_WORD0_TEX_INST                                    0xFFFFFFE0
449 #define   S_SQ_TEX_WORD0_INST_MOD(x)                                 (((unsigned)(x) & 0x3) << 5)
450 #define   G_SQ_TEX_WORD0_INST_MOD(x)                                 (((x) >> 5) & 0x3)
451 #define   C_SQ_TEX_WORD0_INST_MOD                                    0xFFFFFF9F
452 #define   S_SQ_TEX_WORD0_FETCH_WHOLE_QUAD(x)                         (((unsigned)(x) & 0x1) << 7)
453 #define   G_SQ_TEX_WORD0_FETCH_WHOLE_QUAD(x)                         (((x) >> 7) & 0x1)
454 #define   C_SQ_TEX_WORD0_FETCH_WHOLE_QUAD                            0xFFFFFF7F
455 #define   S_SQ_TEX_WORD0_RESOURCE_ID(x)                              (((unsigned)(x) & 0xFF) << 8)
456 #define   G_SQ_TEX_WORD0_RESOURCE_ID(x)                              (((x) >> 8) & 0xFF)
457 #define   C_SQ_TEX_WORD0_RESOURCE_ID                                 0xFFFF00FF
458 #define   S_SQ_TEX_WORD0_SRC_GPR(x)                                  (((unsigned)(x) & 0x7F) << 16)
459 #define   G_SQ_TEX_WORD0_SRC_GPR(x)                                  (((x) >> 16) & 0x7F)
460 #define   C_SQ_TEX_WORD0_SRC_GPR                                     0xFF80FFFF
461 #define   S_SQ_TEX_WORD0_SRC_REL(x)                                  (((unsigned)(x) & 0x1) << 23)
462 #define   G_SQ_TEX_WORD0_SRC_REL(x)                                  (((x) >> 23) & 0x1)
463 #define   C_SQ_TEX_WORD0_SRC_REL                                     0xFF7FFFFF
464 #define   S_SQ_TEX_WORD0_ALT_CONST(x)                                (((unsigned)(x) & 0x1) << 24)
465 #define   G_SQ_TEX_WORD0_ALT_CONST(x)                                (((x) >> 24) & 0x1)
466 #define   C_SQ_TEX_WORD0_ALT_CONST                                   0xFEFFFFFF
467 #define   S_SQ_TEX_WORD0_RIM(x)                                      (((unsigned)(x) & 0x3) << 25)
468 #define   G_SQ_TEX_WORD0_RIM(x)                                      (((x) >> 25) & 0x3)
469 #define   C_SQ_TEX_WORD0_RIM                                         0xF9FFFFFF
470 #define   S_SQ_TEX_WORD0_SIM(x)                                      (((unsigned)(x) & 0x3) << 27)
471 #define   G_SQ_TEX_WORD0_SIM(x)                                      (((x) >> 27) & 0x3)
472 #define   C_SQ_TEX_WORD0_SIM                                         0xE7FFFFFF
473 #define P_SQ_TEX_WORD1
474 #define   S_SQ_TEX_WORD1_DST_GPR(x)                                  (((unsigned)(x) & 0x7F) << 0)
475 #define   G_SQ_TEX_WORD1_DST_GPR(x)                                  (((x) >> 0) & 0x7F)
476 #define   C_SQ_TEX_WORD1_DST_GPR                                     0xFFFFFF80
477 #define   S_SQ_TEX_WORD1_DST_REL(x)                                  (((unsigned)(x) & 0x1) << 7)
478 #define   G_SQ_TEX_WORD1_DST_REL(x)                                  (((x) >> 7) & 0x1)
479 #define   C_SQ_TEX_WORD1_DST_REL                                     0xFFFFFF7F
480 #define   S_SQ_TEX_WORD1_DST_SEL_X(x)                                (((unsigned)(x) & 0x7) << 9)
481 #define   G_SQ_TEX_WORD1_DST_SEL_X(x)                                (((x) >> 9) & 0x7)
482 #define   C_SQ_TEX_WORD1_DST_SEL_X                                   0xFFFFF1FF
483 #define   S_SQ_TEX_WORD1_DST_SEL_Y(x)                                (((unsigned)(x) & 0x7) << 12)
484 #define   G_SQ_TEX_WORD1_DST_SEL_Y(x)                                (((x) >> 12) & 0x7)
485 #define   C_SQ_TEX_WORD1_DST_SEL_Y                                   0xFFFF8FFF
486 #define   S_SQ_TEX_WORD1_DST_SEL_Z(x)                                (((unsigned)(x) & 0x7) << 15)
487 #define   G_SQ_TEX_WORD1_DST_SEL_Z(x)                                (((x) >> 15) & 0x7)
488 #define   C_SQ_TEX_WORD1_DST_SEL_Z                                   0xFFFC7FFF
489 #define   S_SQ_TEX_WORD1_DST_SEL_W(x)                                (((unsigned)(x) & 0x7) << 18)
490 #define   G_SQ_TEX_WORD1_DST_SEL_W(x)                                (((x) >> 18) & 0x7)
491 #define   C_SQ_TEX_WORD1_DST_SEL_W                                   0xFFE3FFFF
492 #define   S_SQ_TEX_WORD1_LOD_BIAS(x)                                 (((unsigned)(x) & 0x7F) << 21)
493 #define   G_SQ_TEX_WORD1_LOD_BIAS(x)                                 (((x) >> 21) & 0x7F)
494 #define   C_SQ_TEX_WORD1_LOD_BIAS                                    0xF01FFFFF
495 #define   S_SQ_TEX_WORD1_COORD_TYPE_X(x)                             (((unsigned)(x) & 0x1) << 28)
496 #define   G_SQ_TEX_WORD1_COORD_TYPE_X(x)                             (((x) >> 28) & 0x1)
497 #define   C_SQ_TEX_WORD1_COORD_TYPE_X                                0xEFFFFFFF
498 #define     V_SQ_TEX_WORD1_COORD_UNNORMALIZED                        0x00000000
499 #define     V_SQ_TEX_WORD1_COORD_NORMALIZED                          0x00000001
500 #define   S_SQ_TEX_WORD1_COORD_TYPE_Y(x)                             (((unsigned)(x) & 0x1) << 29)
501 #define   G_SQ_TEX_WORD1_COORD_TYPE_Y(x)                             (((x) >> 29) & 0x1)
502 #define   C_SQ_TEX_WORD1_COORD_TYPE_Y                                0xDFFFFFFF
503 #define   S_SQ_TEX_WORD1_COORD_TYPE_Z(x)                             (((unsigned)(x) & 0x1) << 30)
504 #define   G_SQ_TEX_WORD1_COORD_TYPE_Z(x)                             (((x) >> 30) & 0x1)
505 #define   C_SQ_TEX_WORD1_COORD_TYPE_Z                                0xBFFFFFFF
506 #define   S_SQ_TEX_WORD1_COORD_TYPE_W(x)                             (((unsigned)(x) & 0x1) << 31)
507 #define   G_SQ_TEX_WORD1_COORD_TYPE_W(x)                             (((x) >> 31) & 0x1)
508 #define   C_SQ_TEX_WORD1_COORD_TYPE_W                                0x7FFFFFFF
509 #define P_SQ_TEX_WORD2
510 #define   S_SQ_TEX_WORD2_OFFSET_X(x)                                 (((unsigned)(x) & 0x1F) << 0)
511 #define   G_SQ_TEX_WORD2_OFFSET_X(x)                                 (((x) >> 0) & 0x1F)
512 #define   C_SQ_TEX_WORD2_OFFSET_X                                    0xFFFFFFE0
513 #define   S_SQ_TEX_WORD2_OFFSET_Y(x)                                 (((unsigned)(x) & 0x1F) << 5)
514 #define   G_SQ_TEX_WORD2_OFFSET_Y(x)                                 (((x) >> 5) & 0x1F)
515 #define   C_SQ_TEX_WORD2_OFFSET_Y                                    0xFFFFFC1F
516 #define   S_SQ_TEX_WORD2_OFFSET_Z(x)                                 (((unsigned)(x) & 0x1F) << 10)
517 #define   G_SQ_TEX_WORD2_OFFSET_Z(x)                                 (((x) >> 10) & 0x1F)
518 #define   C_SQ_TEX_WORD2_OFFSET_Z                                    0xFFFF83FF
519 #define   S_SQ_TEX_WORD2_SAMPLER_ID(x)                               (((unsigned)(x) & 0x1F) << 15)
520 #define   G_SQ_TEX_WORD2_SAMPLER_ID(x)                               (((x) >> 15) & 0x1F)
521 #define   C_SQ_TEX_WORD2_SAMPLER_ID                                  0xFFF07FFF
522 #define   S_SQ_TEX_WORD2_SRC_SEL_X(x)                                (((unsigned)(x) & 0x7) << 20)
523 #define   G_SQ_TEX_WORD2_SRC_SEL_X(x)                                (((x) >> 20) & 0x7)
524 #define   C_SQ_TEX_WORD2_SRC_SEL_X                                   0xFF8FFFFF
525 #define   S_SQ_TEX_WORD2_SRC_SEL_Y(x)                                (((unsigned)(x) & 0x7) << 23)
526 #define   G_SQ_TEX_WORD2_SRC_SEL_Y(x)                                (((x) >> 23) & 0x7)
527 #define   C_SQ_TEX_WORD2_SRC_SEL_Y                                   0xFC7FFFFF
528 #define   S_SQ_TEX_WORD2_SRC_SEL_Z(x)                                (((unsigned)(x) & 0x7) << 26)
529 #define   G_SQ_TEX_WORD2_SRC_SEL_Z(x)                                (((x) >> 26) & 0x7)
530 #define   C_SQ_TEX_WORD2_SRC_SEL_Z                                   0xE3FFFFFF
531 #define   S_SQ_TEX_WORD2_SRC_SEL_W(x)                                (((unsigned)(x) & 0x7) << 29)
532 #define   G_SQ_TEX_WORD2_SRC_SEL_W(x)                                (((x) >> 29) & 0x7)
533 #define   C_SQ_TEX_WORD2_SRC_SEL_W                                   0x1FFFFFFF
534 
535 #define P_SQ_MEM_GDS_WORD0
536 #define   S_SQ_MEM_GDS_WORD0_MEM_INST(x)                             (((unsigned)(x) & 0x1f) << 0)
537 #define   S_SQ_MEM_GDS_WORD0_MEM_OP(x)                               (((unsigned)(x) & 0x7) << 8)
538 #define   S_SQ_MEM_GDS_WORD0_SRC_GPR(x)                              (((unsigned)(x) & 0x7f) << 11)
539 #define   S_SQ_MEM_GDS_WORD0_SRC_REL(x)                              (((unsigned)(x) & 0x3) << 18)
540 #define   S_SQ_MEM_GDS_WORD0_SRC_SEL_X(x)                            (((unsigned)(x) & 0x7) << 20)
541 #define   S_SQ_MEM_GDS_WORD0_SRC_SEL_Y(x)                            (((unsigned)(x) & 0x7) << 23)
542 #define   S_SQ_MEM_GDS_WORD0_SRC_SEL_Z(x)                            (((unsigned)(x) & 0x7) << 26)
543 
544 #define P_SQ_MEM_GDS_WORD1
545 #define   S_SQ_MEM_GDS_WORD1_DST_GPR(x)                              (((unsigned)(x) & 0x7f) << 0)
546 #define   S_SQ_MEM_GDS_WORD1_DST_REL(x)                              (((unsigned)(x) & 0x3) << 7)
547 #define   S_SQ_MEM_GDS_WORD1_GDS_OP(x)                               (((unsigned)(x) & 0x3f) << 9)
548 #define   S_SQ_MEM_GDS_WORD1_SRC_GPR(x)                              (((unsigned)(x) & 0x7f) << 16)
549 #define   S_SQ_MEM_GDS_WORD1_UAV_INDEX_MODE(x)                       (((unsigned)(x) & 0x3) << 24)
550 #define   S_SQ_MEM_GDS_WORD1_UAV_ID(x)                               (((unsigned)(x) & 0xf) << 26)
551 #define   S_SQ_MEM_GDS_WORD1_ALLOC_CONSUME(x)                        (((unsigned)(x) & 0x1) << 30)
552 #define   S_SQ_MEM_GDS_WORD1_BCAST_FIRST_REQ(x)                      (((unsigned)(x) & 0x1) << 31)
553 
554 #define P_SQ_MEM_GDS_WORD2
555 #define   S_SQ_MEM_GDS_WORD2_DST_SEL_X(x)                            (((unsigned)(x) & 0x7) << 0)
556 #define   S_SQ_MEM_GDS_WORD2_DST_SEL_Y(x)                            (((unsigned)(x) & 0x7) << 3)
557 #define   S_SQ_MEM_GDS_WORD2_DST_SEL_Z(x)                            (((unsigned)(x) & 0x7) << 6)
558 #define   S_SQ_MEM_GDS_WORD2_DST_SEL_W(x)                            (((unsigned)(x) & 0x7) << 9)
559 
560 /* LDS IDX redefines the neg bits on op3 */
561 #define S_SQ_ALU_WORD0_LDS_IDX_OP_IDX_OFFSET_4(x)                    (((unsigned)(x) & 0x1) << 12)
562 #define S_SQ_ALU_WORD0_LDS_IDX_OP_IDX_OFFSET_5(x)                    (((unsigned)(x) & 0x1) << 25)
563 
564 /* src2 neg */
565 #define S_SQ_ALU_WORD1_LDS_IDX_OP_IDX_OFFSET_1(x)                    (((unsigned)(x) & 0x1) << 12)
566 
567 /* this was dst gpr */
568 #define S_SQ_ALU_WORD1_LDS_IDX_OP_LDS_OP(x)                    (((unsigned)(x) & 0x3f) << 21)
569 #define S_SQ_ALU_WORD1_LDS_IDX_OP_IDX_OFFSET_0(x)                    (((unsigned)(x) & 0x1) << 27)
570 
571 /* this was dst rel */
572 #define S_SQ_ALU_WORD1_LDS_IDX_OP_IDX_OFFSET_2(x)                    (((unsigned)(x) & 0x1) << 28)
573 /* this was clamp */
574 #define S_SQ_ALU_WORD1_LDS_IDX_OP_IDX_OFFSET_3(x)                    (((unsigned)(x) & 0x1) << 31)
575 
576 #define     EG_V_SQ_ALU_SRC_LDS_OQ_A_POP                             0x000000DD
577 #define     EG_V_SQ_ALU_SRC_LDS_OQ_B_POP                             0x000000DE
578 
579 
580 #define V_SQ_LDS_INST_ADD                               0x00
581 #define V_SQ_LDS_INST_SUB                               0x01
582 #define V_SQ_LDS_INST_RSUB                              0x02
583 
584 #define V_SQ_LDS_INST_INC                               0x03
585 #define V_SQ_LDS_INST_DEC                               0x04
586 #define V_SQ_LDS_INST_MIN_INT                           0x05
587 #define V_SQ_LDS_INST_MAX_INT                           0x06
588 #define V_SQ_LDS_INST_MIN_UINT                          0x07
589 #define V_SQ_LDS_INST_MAX_UINT                          0x08
590 #define V_SQ_LDS_INST_AND                               0x09
591 #define V_SQ_LDS_INST_OR                                0x0a
592 #define V_SQ_LDS_INST_XOR                               0x0b
593 #define V_SQ_LDS_INST_MSKOR                             0x0c
594 #define V_SQ_LDS_INST_WRITE                             0x0d
595 #define V_SQ_LDS_INST_WRITE_REL                         0x0e
596 #define V_SQ_LDS_INST_WRITE2                            0x0f
597 
598 #define V_SQ_LDS_INST_READ_RET                          0x32
599 #define V_SQ_LDS_INST_READ_REL_RET                      0x33
600 #define V_SQ_LDS_INST_READ2_RET                         0x34
601 #define V_SQ_LDS_INST_READWRITE_RET                     0x35
602 
603 #define V_SQ_CF_COND_ACTIVE                             0x00
604 #define V_SQ_CF_COND_FALSE                              0x01
605 #define V_SQ_CF_COND_BOOL                               0x02
606 #define V_SQ_CF_COND_NOT_BOOL                           0x03
607 
608 #define V_SQ_REL_ABSOLUTE 0
609 #define V_SQ_REL_RELATIVE 1
610 
611 /* CAYMAN has special encoding for MOVA_INT destination */
612 #define CM_V_SQ_MOVA_DST_AR_X 0
613 #define CM_V_SQ_MOVA_DST_CF_PC 1
614 #define CM_V_SQ_MOVA_DST_CF_IDX0 2
615 #define CM_V_SQ_MOVA_DST_CF_IDX1 3
616 
617 #endif
618