• 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_IND_ACK       0x00000003
166 #define   S_SQ_CF_ALLOC_EXPORT_WORD0_RW_GPR(x)                       (((unsigned)(x) & 0x7F) << 15)
167 #define   G_SQ_CF_ALLOC_EXPORT_WORD0_RW_GPR(x)                       (((x) >> 15) & 0x7F)
168 #define   C_SQ_CF_ALLOC_EXPORT_WORD0_RW_GPR                          0xFFC07FFF
169 #define   S_SQ_CF_ALLOC_EXPORT_WORD0_RW_REL(x)                       (((unsigned)(x) & 0x1) << 22)
170 #define   G_SQ_CF_ALLOC_EXPORT_WORD0_RW_REL(x)                       (((x) >> 22) & 0x1)
171 #define   C_SQ_CF_ALLOC_EXPORT_WORD0_RW_REL                          0xFFBFFFFF
172 #define   S_SQ_CF_ALLOC_EXPORT_WORD0_INDEX_GPR(x)                    (((unsigned)(x) & 0x7F) << 23)
173 #define   G_SQ_CF_ALLOC_EXPORT_WORD0_INDEX_GPR(x)                    (((x) >> 23) & 0x7F)
174 #define   C_SQ_CF_ALLOC_EXPORT_WORD0_INDEX_GPR                       0xC07FFFFF
175 #define   S_SQ_CF_ALLOC_EXPORT_WORD0_ELEM_SIZE(x)                    (((unsigned)(x) & 0x3) << 30)
176 #define   G_SQ_CF_ALLOC_EXPORT_WORD0_ELEM_SIZE(x)                    (((x) >> 30) & 0x3)
177 #define   C_SQ_CF_ALLOC_EXPORT_WORD0_ELEM_SIZE                       0x3FFFFFFF
178 /* done */
179 #define P_SQ_CF_ALLOC_EXPORT_WORD1
180 #define   S_SQ_CF_ALLOC_EXPORT_WORD1_BURST_COUNT(x)                  (((unsigned)(x) & 0xF) << 16)
181 #define   G_SQ_CF_ALLOC_EXPORT_WORD1_BURST_COUNT(x)                  (((x) >> 16) & 0xF)
182 #define   C_SQ_CF_ALLOC_EXPORT_WORD1_BURST_COUNT                     0xFFF0FFFF
183 #define   S_SQ_CF_ALLOC_EXPORT_WORD1_VALID_PIXEL_MODE(x)             (((unsigned)(x) & 0x1) << 20)
184 #define   G_SQ_CF_ALLOC_EXPORT_WORD1_VALID_PIXEL_MODE(x)             (((x) >> 20) & 0x1)
185 #define   C_SQ_CF_ALLOC_EXPORT_WORD1_VALID_PIXEL_MODE                0xFFEFFFFF
186 #define   S_SQ_CF_ALLOC_EXPORT_WORD1_END_OF_PROGRAM(x)               (((unsigned)(x) & 0x1) << 21)
187 #define   G_SQ_CF_ALLOC_EXPORT_WORD1_END_OF_PROGRAM(x)               (((x) >> 21) & 0x1)
188 #define   C_SQ_CF_ALLOC_EXPORT_WORD1_END_OF_PROGRAM                  0xFFDFFFFF
189 #define   S_SQ_CF_ALLOC_EXPORT_WORD1_CF_INST(x)                      (((unsigned)(x) & 0xFF) << 22)
190 #define   G_SQ_CF_ALLOC_EXPORT_WORD1_CF_INST(x)                      (((x) >> 22) & 0xFF)
191 #define   C_SQ_CF_ALLOC_EXPORT_WORD1_CF_INST                         0xC03FFFFF
192 
193 #define   S_SQ_CF_ALLOC_EXPORT_WORD1_MARK(x)                         (((unsigned)(x) & 0x1) << 30)
194 #define   G_SQ_CF_ALLOC_EXPORT_WORD1_MARK(x)                         (((x) >> 30) & 0x1)
195 #define   C_SQ_CF_ALLOC_EXPORT_WORD1_WHOLE_QUAD_MODE                 0xBFFFFFFF
196 #define   S_SQ_CF_ALLOC_EXPORT_WORD1_BARRIER(x)                      (((unsigned)(x) & 0x1) << 31)
197 #define   G_SQ_CF_ALLOC_EXPORT_WORD1_BARRIER(x)                      (((x) >> 31) & 0x1)
198 #define   C_SQ_CF_ALLOC_EXPORT_WORD1_BARRIER                         0x7FFFFFFF
199 
200 /* done */
201 #define P_SQ_CF_ALLOC_EXPORT_WORD1_BUF
202 #define   S_SQ_CF_ALLOC_EXPORT_WORD1_BUF_ARRAY_SIZE(x)               (((unsigned)(x) & 0xFFF) << 0)
203 #define   G_SQ_CF_ALLOC_EXPORT_WORD1_BUF_ARRAY_SIZE(x)               (((x) >> 0) & 0xFFF)
204 #define   C_SQ_CF_ALLOC_EXPORT_WORD1_BUF_ARRAY_SIZE                  0xFFFFF000
205 #define   S_SQ_CF_ALLOC_EXPORT_WORD1_BUF_COMP_MASK(x)                (((unsigned)(x) & 0xF) << 12)
206 #define   G_SQ_CF_ALLOC_EXPORT_WORD1_BUF_COMP_MASK(x)                (((x) >> 12) & 0xF)
207 #define   C_SQ_CF_ALLOC_EXPORT_WORD1_BUF_COMP_MASK                   0xFFFF0FFF
208 #define P_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ
209 #define   S_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_X(x)                   (((unsigned)(x) & 0x7) << 0)
210 #define   G_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_X(x)                   (((x) >> 0) & 0x7)
211 #define   C_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_X                      0xFFFFFFF8
212 #define   S_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Y(x)                   (((unsigned)(x) & 0x7) << 3)
213 #define   G_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Y(x)                   (((x) >> 3) & 0x7)
214 #define   C_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Y                      0xFFFFFFC7
215 #define   S_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Z(x)                   (((unsigned)(x) & 0x7) << 6)
216 #define   G_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Z(x)                   (((x) >> 6) & 0x7)
217 #define   C_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Z                      0xFFFFFE3F
218 #define   S_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_W(x)                   (((unsigned)(x) & 0x7) << 9)
219 #define   G_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_W(x)                   (((x) >> 9) & 0x7)
220 #define   C_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_W                      0xFFFFF1FF
221 
222 /* done */
223 #define P_SQ_ALU_WORD0
224 #define   S_SQ_ALU_WORD0_SRC0_SEL(x)                                 (((unsigned)(x) & 0x1FF) << 0)
225 #define   G_SQ_ALU_WORD0_SRC0_SEL(x)                                 (((x) >> 0) & 0x1FF)
226 #define   C_SQ_ALU_WORD0_SRC0_SEL                                    0xFFFFFE00
227 
228 /*
229  * 244  ALU_SRC_1_DBL_L: special constant 1.0 double-float, LSW. (RV670+)
230  * 245  ALU_SRC_1_DBL_M: special constant 1.0 double-float, MSW. (RV670+)
231  * 246  ALU_SRC_0_5_DBL_L: special constant 0.5 double-float, LSW. (RV670+)
232  * 247  ALU_SRC_0_5_DBL_M: special constant 0.5 double-float, MSW. (RV670+)
233  * 248  SQ_ALU_SRC_0: special constant 0.0.
234  * 249  SQ_ALU_SRC_1: special constant 1.0 float.
235  * 250  SQ_ALU_SRC_1_INT: special constant 1 integer.
236  * 251  SQ_ALU_SRC_M_1_INT: special constant -1 integer.
237  * 252  SQ_ALU_SRC_0_5: special constant 0.5 float.
238  * 253  SQ_ALU_SRC_LITERAL: literal constant.
239  * 254  SQ_ALU_SRC_PV: previous vector result.
240  * 255  SQ_ALU_SRC_PS: previous scalar result.
241  */
242 #define     V_SQ_ALU_SRC_0                                           0x000000F8
243 #define     V_SQ_ALU_SRC_1                                           0x000000F9
244 #define     V_SQ_ALU_SRC_1_INT                                       0x000000FA
245 #define     V_SQ_ALU_SRC_M_1_INT                                     0x000000FB
246 #define     V_SQ_ALU_SRC_0_5                                         0x000000FC
247 #define     V_SQ_ALU_SRC_LITERAL                                     0x000000FD
248 #define   S_SQ_ALU_WORD0_SRC0_REL(x)                                 (((unsigned)(x) & 0x1) << 9)
249 #define   G_SQ_ALU_WORD0_SRC0_REL(x)                                 (((x) >> 9) & 0x1)
250 #define   C_SQ_ALU_WORD0_SRC0_REL                                    0xFFFFFDFF
251 #define   S_SQ_ALU_WORD0_SRC0_CHAN(x)                                (((unsigned)(x) & 0x3) << 10)
252 #define   G_SQ_ALU_WORD0_SRC0_CHAN(x)                                (((x) >> 10) & 0x3)
253 #define   C_SQ_ALU_WORD0_SRC0_CHAN                                   0xFFFFF3FF
254 #define   S_SQ_ALU_WORD0_SRC0_NEG(x)                                 (((unsigned)(x) & 0x1) << 12)
255 #define   G_SQ_ALU_WORD0_SRC0_NEG(x)                                 (((x) >> 12) & 0x1)
256 #define   C_SQ_ALU_WORD0_SRC0_NEG                                    0xFFFFEFFF
257 #define   S_SQ_ALU_WORD0_SRC1_SEL(x)                                 (((unsigned)(x) & 0x1FF) << 13)
258 #define   G_SQ_ALU_WORD0_SRC1_SEL(x)                                 (((x) >> 13) & 0x1FF)
259 #define   C_SQ_ALU_WORD0_SRC1_SEL                                    0xFFC01FFF
260 #define   S_SQ_ALU_WORD0_SRC1_REL(x)                                 (((unsigned)(x) & 0x1) << 22)
261 #define   G_SQ_ALU_WORD0_SRC1_REL(x)                                 (((x) >> 22) & 0x1)
262 #define   C_SQ_ALU_WORD0_SRC1_REL                                    0xFFBFFFFF
263 #define   S_SQ_ALU_WORD0_SRC1_CHAN(x)                                (((unsigned)(x) & 0x3) << 23)
264 #define   G_SQ_ALU_WORD0_SRC1_CHAN(x)                                (((x) >> 23) & 0x3)
265 #define   C_SQ_ALU_WORD0_SRC1_CHAN                                   0xFE7FFFFF
266 #define   S_SQ_ALU_WORD0_SRC1_NEG(x)                                 (((unsigned)(x) & 0x1) << 25)
267 #define   G_SQ_ALU_WORD0_SRC1_NEG(x)                                 (((x) >> 25) & 0x1)
268 #define   C_SQ_ALU_WORD0_SRC1_NEG                                    0xFDFFFFFF
269 #define   S_SQ_ALU_WORD0_INDEX_MODE(x)                               (((unsigned)(x) & 0x7) << 26)
270 #define   G_SQ_ALU_WORD0_INDEX_MODE(x)                               (((x) >> 26) & 0x7)
271 #define   C_SQ_ALU_WORD0_INDEX_MODE                                  0xE3FFFFFF
272 #define   S_SQ_ALU_WORD0_PRED_SEL(x)                                 (((unsigned)(x) & 0x3) << 29)
273 #define   G_SQ_ALU_WORD0_PRED_SEL(x)                                 (((x) >> 29) & 0x3)
274 #define   C_SQ_ALU_WORD0_PRED_SEL                                    0x9FFFFFFF
275 #define   S_SQ_ALU_WORD0_LAST(x)                                     (((unsigned)(x) & 0x1) << 31)
276 #define   G_SQ_ALU_WORD0_LAST(x)                                     (((x) >> 31) & 0x1)
277 #define   C_SQ_ALU_WORD0_LAST                                        0x7FFFFFFF
278 /* same */
279 #define P_SQ_ALU_WORD1
280 #define   S_SQ_ALU_WORD1_ENCODING(x)                                 (((unsigned)(x) & 0x7) << 15)
281 #define   G_SQ_ALU_WORD1_ENCODING(x)                                 (((x) >> 15) & 0x7)
282 #define   C_SQ_ALU_WORD1_ENCODING                                    0xFFFC7FFF
283 #define   S_SQ_ALU_WORD1_BANK_SWIZZLE(x)                             (((unsigned)(x) & 0x7) << 18)
284 #define   G_SQ_ALU_WORD1_BANK_SWIZZLE(x)                             (((x) >> 18) & 0x7)
285 #define   C_SQ_ALU_WORD1_BANK_SWIZZLE                                0xFFE3FFFF
286 #define   S_SQ_ALU_WORD1_DST_GPR(x)                                  (((unsigned)(x) & 0x7F) << 21)
287 #define   G_SQ_ALU_WORD1_DST_GPR(x)                                  (((x) >> 21) & 0x7F)
288 #define   C_SQ_ALU_WORD1_DST_GPR                                     0xF01FFFFF
289 #define   S_SQ_ALU_WORD1_DST_REL(x)                                  (((unsigned)(x) & 0x1) << 28)
290 #define   G_SQ_ALU_WORD1_DST_REL(x)                                  (((x) >> 28) & 0x1)
291 #define   C_SQ_ALU_WORD1_DST_REL                                     0xEFFFFFFF
292 #define   S_SQ_ALU_WORD1_DST_CHAN(x)                                 (((unsigned)(x) & 0x3) << 29)
293 #define   G_SQ_ALU_WORD1_DST_CHAN(x)                                 (((x) >> 29) & 0x3)
294 #define   C_SQ_ALU_WORD1_DST_CHAN                                    0x9FFFFFFF
295 #define   S_SQ_ALU_WORD1_CLAMP(x)                                    (((unsigned)(x) & 0x1) << 31)
296 #define   G_SQ_ALU_WORD1_CLAMP(x)                                    (((x) >> 31) & 0x1)
297 #define   C_SQ_ALU_WORD1_CLAMP                                       0x7FFFFFFF
298 /* same except maybe encoding */
299 #define P_SQ_ALU_WORD1_OP2
300 #define   S_SQ_ALU_WORD1_OP2_SRC0_ABS(x)                             (((unsigned)(x) & 0x1) << 0)
301 #define   G_SQ_ALU_WORD1_OP2_SRC0_ABS(x)                             (((x) >> 0) & 0x1)
302 #define   C_SQ_ALU_WORD1_OP2_SRC0_ABS                                0xFFFFFFFE
303 #define   S_SQ_ALU_WORD1_OP2_SRC1_ABS(x)                             (((unsigned)(x) & 0x1) << 1)
304 #define   G_SQ_ALU_WORD1_OP2_SRC1_ABS(x)                             (((x) >> 1) & 0x1)
305 #define   C_SQ_ALU_WORD1_OP2_SRC1_ABS                                0xFFFFFFFD
306 #define   S_SQ_ALU_WORD1_OP2_UPDATE_EXECUTE_MASK(x)                  (((unsigned)(x) & 0x1) << 2)
307 #define   G_SQ_ALU_WORD1_OP2_UPDATE_EXECUTE_MASK(x)                  (((x) >> 2) & 0x1)
308 #define   C_SQ_ALU_WORD1_OP2_UPDATE_EXECUTE_MASK                     0xFFFFFFFB
309 #define   S_SQ_ALU_WORD1_OP2_UPDATE_PRED(x)                          (((unsigned)(x) & 0x1) << 3)
310 #define   G_SQ_ALU_WORD1_OP2_UPDATE_PRED(x)                          (((x) >> 3) & 0x1)
311 #define   C_SQ_ALU_WORD1_OP2_UPDATE_PRED                             0xFFFFFFF7
312 #define   S_SQ_ALU_WORD1_OP2_WRITE_MASK(x)                           (((unsigned)(x) & 0x1) << 4)
313 #define   G_SQ_ALU_WORD1_OP2_WRITE_MASK(x)                           (((x) >> 4) & 0x1)
314 #define   C_SQ_ALU_WORD1_OP2_WRITE_MASK                              0xFFFFFFEF
315 #define   S_SQ_ALU_WORD1_OP2_OMOD(x)                                 (((unsigned)(x) & 0x3) << 5)
316 #define   G_SQ_ALU_WORD1_OP2_OMOD(x)                                 (((x) >> 5) & 0x3)
317 #define   C_SQ_ALU_WORD1_OP2_OMOD                                    0xFFFFFF9F
318 #define   S_SQ_ALU_WORD1_OP2_ALU_INST(x)                             (((unsigned)(x) & 0x7FF) << 7)
319 #define   G_SQ_ALU_WORD1_OP2_ALU_INST(x)                             (((x) >> 7) & 0x7FF)
320 #define   C_SQ_ALU_WORD1_OP2_ALU_INST                                0xFFFC007F
321 
322 #define P_SQ_ALU_WORD1_OP3
323 #define   S_SQ_ALU_WORD1_OP3_SRC2_SEL(x)                             (((unsigned)(x) & 0x1FF) << 0)
324 #define   G_SQ_ALU_WORD1_OP3_SRC2_SEL(x)                             (((x) >> 0) & 0x1FF)
325 #define   C_SQ_ALU_WORD1_OP3_SRC2_SEL                                0xFFFFFE00
326 #define   S_SQ_ALU_WORD1_OP3_SRC2_REL(x)                             (((unsigned)(x) & 0x1) << 9)
327 #define   G_SQ_ALU_WORD1_OP3_SRC2_REL(x)                             (((x) >> 9) & 0x1)
328 #define   C_SQ_ALU_WORD1_OP3_SRC2_REL                                0xFFFFFDFF
329 #define   S_SQ_ALU_WORD1_OP3_SRC2_CHAN(x)                            (((unsigned)(x) & 0x3) << 10)
330 #define   G_SQ_ALU_WORD1_OP3_SRC2_CHAN(x)                            (((x) >> 10) & 0x3)
331 #define   C_SQ_ALU_WORD1_OP3_SRC2_CHAN                               0xFFFFF3FF
332 #define   S_SQ_ALU_WORD1_OP3_SRC2_NEG(x)                             (((unsigned)(x) & 0x1) << 12)
333 #define   G_SQ_ALU_WORD1_OP3_SRC2_NEG(x)                             (((x) >> 12) & 0x1)
334 #define   C_SQ_ALU_WORD1_OP3_SRC2_NEG                                0xFFFFEFFF
335 #define   S_SQ_ALU_WORD1_OP3_ALU_INST(x)                             (((unsigned)(x) & 0x1F) << 13)
336 #define   G_SQ_ALU_WORD1_OP3_ALU_INST(x)                             (((x) >> 13) & 0x1F)
337 #define   C_SQ_ALU_WORD1_OP3_ALU_INST                                0xFFFC1FFF
338 /* XXX ADD OTHER OP3 */
339 /* done */
340 #define P_SQ_VTX_WORD0
341 #define   S_SQ_VTX_WORD0_VTX_INST(x)                                 (((unsigned)(x) & 0x1F) << 0)
342 #define   G_SQ_VTX_WORD0_VTX_INST(x)                                 (((x) >> 0) & 0x1F)
343 #define   C_SQ_VTX_WORD0_VTX_INST                                    0xFFFFFFE0
344 #define   S_SQ_VTX_WORD0_FETCH_TYPE(x)                               (((unsigned)(x) & 0x3) << 5)
345 #define   G_SQ_VTX_WORD0_FETCH_TYPE(x)                               (((x) >> 5) & 0x3)
346 #define   C_SQ_VTX_WORD0_FETCH_TYPE                                  0xFFFFFF9F
347 #define   S_SQ_VTX_WORD0_FETCH_WHOLE_QUAD(x)                         (((unsigned)(x) & 0x1) << 7)
348 #define   G_SQ_VTX_WORD0_FETCH_WHOLE_QUAD(x)                         (((x) >> 7) & 0x1)
349 #define   C_SQ_VTX_WORD0_FETCH_WHOLE_QUAD                            0xFFFFFF7F
350 #define   S_SQ_VTX_WORD0_BUFFER_ID(x)                                (((unsigned)(x) & 0xFF) << 8)
351 #define   G_SQ_VTX_WORD0_BUFFER_ID(x)                                (((x) >> 8) & 0xFF)
352 #define   C_SQ_VTX_WORD0_BUFFER_ID                                   0xFFFF00FF
353 #define   S_SQ_VTX_WORD0_SRC_GPR(x)                                  (((unsigned)(x) & 0x7F) << 16)
354 #define   G_SQ_VTX_WORD0_SRC_GPR(x)                                  (((x) >> 16) & 0x7F)
355 #define   C_SQ_VTX_WORD0_SRC_GPR                                     0xFF80FFFF
356 #define   S_SQ_VTX_WORD0_SRC_REL(x)                                  (((unsigned)(x) & 0x1) << 23)
357 #define   G_SQ_VTX_WORD0_SRC_REL(x)                                  (((x) >> 23) & 0x1)
358 #define   C_SQ_VTX_WORD0_SRC_REL                                     0xFF7FFFFF
359 #define   S_SQ_VTX_WORD0_SRC_SEL_X(x)                                (((unsigned)(x) & 0x3) << 24)
360 #define   G_SQ_VTX_WORD0_SRC_SEL_X(x)                                (((x) >> 24) & 0x3)
361 #define   C_SQ_VTX_WORD0_SRC_SEL_X                                   0xFCFFFFFF
362 #define   S_SQ_VTX_WORD0_MEGA_FETCH_COUNT(x)                         (((unsigned)(x) & 0x3F) << 26)
363 #define   G_SQ_VTX_WORD0_MEGA_FETCH_COUNT(x)                         (((x) >> 26) & 0x3F)
364 #define   C_SQ_VTX_WORD0_MEGA_FETCH_COUNT                            0x03FFFFFF
365 /* same WORD 0 */
366 #define P_SQ_VTX_WORD1
367 #define   S_SQ_VTX_WORD1_DST_SEL_X(x)                                (((unsigned)(x) & 0x7) << 9)
368 #define   G_SQ_VTX_WORD1_DST_SEL_X(x)                                (((x) >> 9) & 0x7)
369 #define   C_SQ_VTX_WORD1_DST_SEL_X                                   0xFFFFF1FF
370 #define   S_SQ_VTX_WORD1_DST_SEL_Y(x)                                (((unsigned)(x) & 0x7) << 12)
371 #define   G_SQ_VTX_WORD1_DST_SEL_Y(x)                                (((x) >> 12) & 0x7)
372 #define   C_SQ_VTX_WORD1_DST_SEL_Y                                   0xFFFF8FFF
373 #define   S_SQ_VTX_WORD1_DST_SEL_Z(x)                                (((unsigned)(x) & 0x7) << 15)
374 #define   G_SQ_VTX_WORD1_DST_SEL_Z(x)                                (((x) >> 15) & 0x7)
375 #define   C_SQ_VTX_WORD1_DST_SEL_Z                                   0xFFFC7FFF
376 #define   S_SQ_VTX_WORD1_DST_SEL_W(x)                                (((unsigned)(x) & 0x7) << 18)
377 #define   G_SQ_VTX_WORD1_DST_SEL_W(x)                                (((x) >> 18) & 0x7)
378 #define   C_SQ_VTX_WORD1_DST_SEL_W                                   0xFFE3FFFF
379 #define   S_SQ_VTX_WORD1_USE_CONST_FIELDS(x)                         (((unsigned)(x) & 0x1) << 21)
380 #define   G_SQ_VTX_WORD1_USE_CONST_FIELDS(x)                         (((x) >> 21) & 0x1)
381 #define   C_SQ_VTX_WORD1_USE_CONST_FIELDS                            0xFFDFFFFF
382 #define   S_SQ_VTX_WORD1_DATA_FORMAT(x)                              (((unsigned)(x) & 0x3F) << 22)
383 #define   G_SQ_VTX_WORD1_DATA_FORMAT(x)                              (((x) >> 22) & 0x3F)
384 #define   C_SQ_VTX_WORD1_DATA_FORMAT                                 0xF03FFFFF
385 #define   S_SQ_VTX_WORD1_NUM_FORMAT_ALL(x)                           (((unsigned)(x) & 0x3) << 28)
386 #define   G_SQ_VTX_WORD1_NUM_FORMAT_ALL(x)                           (((x) >> 28) & 0x3)
387 #define   C_SQ_VTX_WORD1_NUM_FORMAT_ALL                              0xCFFFFFFF
388 #define   S_SQ_VTX_WORD1_FORMAT_COMP_ALL(x)                          (((unsigned)(x) & 0x1) << 30)
389 #define   G_SQ_VTX_WORD1_FORMAT_COMP_ALL(x)                          (((x) >> 30) & 0x1)
390 #define   C_SQ_VTX_WORD1_FORMAT_COMP_ALL                             0xBFFFFFFF
391 #define   S_SQ_VTX_WORD1_SRF_MODE_ALL(x)                             (((unsigned)(x) & 0x1) << 31)
392 #define   G_SQ_VTX_WORD1_SRF_MODE_ALL(x)                             (((x) >> 31) & 0x1)
393 #define   C_SQ_VTX_WORD1_SRF_MODE_ALL                                0x7FFFFFFF
394 /* same WORD1 generic */
395 #define P_SQ_VTX_WORD1_GPR
396 #define   S_SQ_VTX_WORD1_GPR_DST_GPR(x)                              (((unsigned)(x) & 0x7F) << 0)
397 #define   G_SQ_VTX_WORD1_GPR_DST_GPR(x)                              (((x) >> 0) & 0x7F)
398 #define   C_SQ_VTX_WORD1_GPR_DST_GPR                                 0xFFFFFF80
399 #define   S_SQ_VTX_WORD1_GPR_DST_REL(x)                              (((unsigned)(x) & 0x1) << 7)
400 #define   G_SQ_VTX_WORD1_GPR_DST_REL(x)                              (((x) >> 7) & 0x1)
401 #define   C_SQ_VTX_WORD1_GPR_DST_REL                                 0xFFFFFF7F
402 #define P_SQ_VTX_WORD1_SEM
403 #define   S_SQ_VTX_WORD1_SEM_SEMANTIC_ID(x)                          (((unsigned)(x) & 0xFF) << 0)
404 #define   G_SQ_VTX_WORD1_SEM_SEMANTIC_ID(x)                          (((x) >> 0) & 0xFF)
405 #define   C_SQ_VTX_WORD1_SEM_SEMANTIC_ID                             0xFFFFFF00
406 #define P_SQ_VTX_WORD2
407 #define   S_SQ_VTX_WORD2_OFFSET(x)                                   (((unsigned)(x) & 0xFFFF) << 0)
408 #define   G_SQ_VTX_WORD2_OFFSET(x)                                   (((x) >> 0) & 0xFFFF)
409 #define   C_SQ_VTX_WORD2_OFFSET                                      0xFFFF0000
410 #define   S_SQ_VTX_WORD2_ENDIAN_SWAP(x)                              (((unsigned)(x) & 0x3) << 16)
411 #define   G_SQ_VTX_WORD2_ENDIAN_SWAP(x)                              (((x) >> 16) & 0x3)
412 #define   C_SQ_VTX_WORD2_ENDIAN_SWAP                                 0xFFFCFFFF
413 #define   S_SQ_VTX_WORD2_CONST_BUF_NO_STRIDE(x)                      (((unsigned)(x) & 0x1) << 18)
414 #define   G_SQ_VTX_WORD2_CONST_BUF_NO_STRIDE(x)                      (((x) >> 18) & 0x1)
415 #define   C_SQ_VTX_WORD2_CONST_BUF_NO_STRIDE                         0xFFFBFFFF
416 #define   S_SQ_VTX_WORD2_MEGA_FETCH(x)                               (((unsigned)(x) & 0x1) << 19)
417 #define   G_SQ_VTX_WORD2_MEGA_FETCH(x)                               (((x) >> 19) & 0x1)
418 #define   C_SQ_VTX_WORD2_MEGA_FETCH                                  0xFFF7FFFF
419 #define   S_SQ_VTX_WORD2_ALT_CONST(x)                                (((unsigned)(x) & 0x1) << 20)
420 #define   G_SQ_VTX_WORD2_ALT_CONST(x)                                (((x) >> 20) & 0x1)
421 #define   C_SQ_VTX_WORD2_ALT_CONST                                   0xFFEFFFFF
422 #define   S_SQ_VTX_WORD2_BIM(x)                                      (((unsigned)(x) & 0x3) << 21)
423 #define   G_SQ_VTX_WORD2_BIM(x)                                      (((x) >> 21) & 0x3)
424 #define   C_SQ_VTX_WORD2_BIM                                         0xFF9FFFFF
425 /* done */
426 
427 #define P_SQ_TEX_WORD0
428 #define   S_SQ_TEX_WORD0_TEX_INST(x)                                 (((unsigned)(x) & 0x1F) << 0)
429 #define   G_SQ_TEX_WORD0_TEX_INST(x)                                 (((x) >> 0) & 0x1F)
430 #define   C_SQ_TEX_WORD0_TEX_INST                                    0xFFFFFFE0
431 #define   S_SQ_TEX_WORD0_INST_MOD(x)                                 (((unsigned)(x) & 0x3) << 5)
432 #define   G_SQ_TEX_WORD0_INST_MOD(x)                                 (((x) >> 5) & 0x3)
433 #define   C_SQ_TEX_WORD0_INST_MOD                                    0xFFFFFF9F
434 #define   S_SQ_TEX_WORD0_FETCH_WHOLE_QUAD(x)                         (((unsigned)(x) & 0x1) << 7)
435 #define   G_SQ_TEX_WORD0_FETCH_WHOLE_QUAD(x)                         (((x) >> 7) & 0x1)
436 #define   C_SQ_TEX_WORD0_FETCH_WHOLE_QUAD                            0xFFFFFF7F
437 #define   S_SQ_TEX_WORD0_RESOURCE_ID(x)                              (((unsigned)(x) & 0xFF) << 8)
438 #define   G_SQ_TEX_WORD0_RESOURCE_ID(x)                              (((x) >> 8) & 0xFF)
439 #define   C_SQ_TEX_WORD0_RESOURCE_ID                                 0xFFFF00FF
440 #define   S_SQ_TEX_WORD0_SRC_GPR(x)                                  (((unsigned)(x) & 0x7F) << 16)
441 #define   G_SQ_TEX_WORD0_SRC_GPR(x)                                  (((x) >> 16) & 0x7F)
442 #define   C_SQ_TEX_WORD0_SRC_GPR                                     0xFF80FFFF
443 #define   S_SQ_TEX_WORD0_SRC_REL(x)                                  (((unsigned)(x) & 0x1) << 23)
444 #define   G_SQ_TEX_WORD0_SRC_REL(x)                                  (((x) >> 23) & 0x1)
445 #define   C_SQ_TEX_WORD0_SRC_REL                                     0xFF7FFFFF
446 #define   S_SQ_TEX_WORD0_ALT_CONST(x)                                (((unsigned)(x) & 0x1) << 24)
447 #define   G_SQ_TEX_WORD0_ALT_CONST(x)                                (((x) >> 24) & 0x1)
448 #define   C_SQ_TEX_WORD0_ALT_CONST                                   0xFEFFFFFF
449 #define   S_SQ_TEX_WORD0_RIM(x)                                      (((unsigned)(x) & 0x3) << 25)
450 #define   G_SQ_TEX_WORD0_RIM(x)                                      (((x) >> 25) & 0x3)
451 #define   C_SQ_TEX_WORD0_RIM                                         0xF9FFFFFF
452 #define   S_SQ_TEX_WORD0_SIM(x)                                      (((unsigned)(x) & 0x3) << 27)
453 #define   G_SQ_TEX_WORD0_SIM(x)                                      (((x) >> 27) & 0x3)
454 #define   C_SQ_TEX_WORD0_SIM                                         0xE7FFFFFF
455 #define P_SQ_TEX_WORD1
456 #define   S_SQ_TEX_WORD1_DST_GPR(x)                                  (((unsigned)(x) & 0x7F) << 0)
457 #define   G_SQ_TEX_WORD1_DST_GPR(x)                                  (((x) >> 0) & 0x7F)
458 #define   C_SQ_TEX_WORD1_DST_GPR                                     0xFFFFFF80
459 #define   S_SQ_TEX_WORD1_DST_REL(x)                                  (((unsigned)(x) & 0x1) << 7)
460 #define   G_SQ_TEX_WORD1_DST_REL(x)                                  (((x) >> 7) & 0x1)
461 #define   C_SQ_TEX_WORD1_DST_REL                                     0xFFFFFF7F
462 #define   S_SQ_TEX_WORD1_DST_SEL_X(x)                                (((unsigned)(x) & 0x7) << 9)
463 #define   G_SQ_TEX_WORD1_DST_SEL_X(x)                                (((x) >> 9) & 0x7)
464 #define   C_SQ_TEX_WORD1_DST_SEL_X                                   0xFFFFF1FF
465 #define   S_SQ_TEX_WORD1_DST_SEL_Y(x)                                (((unsigned)(x) & 0x7) << 12)
466 #define   G_SQ_TEX_WORD1_DST_SEL_Y(x)                                (((x) >> 12) & 0x7)
467 #define   C_SQ_TEX_WORD1_DST_SEL_Y                                   0xFFFF8FFF
468 #define   S_SQ_TEX_WORD1_DST_SEL_Z(x)                                (((unsigned)(x) & 0x7) << 15)
469 #define   G_SQ_TEX_WORD1_DST_SEL_Z(x)                                (((x) >> 15) & 0x7)
470 #define   C_SQ_TEX_WORD1_DST_SEL_Z                                   0xFFFC7FFF
471 #define   S_SQ_TEX_WORD1_DST_SEL_W(x)                                (((unsigned)(x) & 0x7) << 18)
472 #define   G_SQ_TEX_WORD1_DST_SEL_W(x)                                (((x) >> 18) & 0x7)
473 #define   C_SQ_TEX_WORD1_DST_SEL_W                                   0xFFE3FFFF
474 #define   S_SQ_TEX_WORD1_LOD_BIAS(x)                                 (((unsigned)(x) & 0x7F) << 21)
475 #define   G_SQ_TEX_WORD1_LOD_BIAS(x)                                 (((x) >> 21) & 0x7F)
476 #define   C_SQ_TEX_WORD1_LOD_BIAS                                    0xF01FFFFF
477 #define   S_SQ_TEX_WORD1_COORD_TYPE_X(x)                             (((unsigned)(x) & 0x1) << 28)
478 #define   G_SQ_TEX_WORD1_COORD_TYPE_X(x)                             (((x) >> 28) & 0x1)
479 #define   C_SQ_TEX_WORD1_COORD_TYPE_X                                0xEFFFFFFF
480 #define     V_SQ_TEX_WORD1_COORD_UNNORMALIZED                        0x00000000
481 #define     V_SQ_TEX_WORD1_COORD_NORMALIZED                          0x00000001
482 #define   S_SQ_TEX_WORD1_COORD_TYPE_Y(x)                             (((unsigned)(x) & 0x1) << 29)
483 #define   G_SQ_TEX_WORD1_COORD_TYPE_Y(x)                             (((x) >> 29) & 0x1)
484 #define   C_SQ_TEX_WORD1_COORD_TYPE_Y                                0xDFFFFFFF
485 #define   S_SQ_TEX_WORD1_COORD_TYPE_Z(x)                             (((unsigned)(x) & 0x1) << 30)
486 #define   G_SQ_TEX_WORD1_COORD_TYPE_Z(x)                             (((x) >> 30) & 0x1)
487 #define   C_SQ_TEX_WORD1_COORD_TYPE_Z                                0xBFFFFFFF
488 #define   S_SQ_TEX_WORD1_COORD_TYPE_W(x)                             (((unsigned)(x) & 0x1) << 31)
489 #define   G_SQ_TEX_WORD1_COORD_TYPE_W(x)                             (((x) >> 31) & 0x1)
490 #define   C_SQ_TEX_WORD1_COORD_TYPE_W                                0x7FFFFFFF
491 #define P_SQ_TEX_WORD2
492 #define   S_SQ_TEX_WORD2_OFFSET_X(x)                                 (((unsigned)(x) & 0x1F) << 0)
493 #define   G_SQ_TEX_WORD2_OFFSET_X(x)                                 (((x) >> 0) & 0x1F)
494 #define   C_SQ_TEX_WORD2_OFFSET_X                                    0xFFFFFFE0
495 #define   S_SQ_TEX_WORD2_OFFSET_Y(x)                                 (((unsigned)(x) & 0x1F) << 5)
496 #define   G_SQ_TEX_WORD2_OFFSET_Y(x)                                 (((x) >> 5) & 0x1F)
497 #define   C_SQ_TEX_WORD2_OFFSET_Y                                    0xFFFFFC1F
498 #define   S_SQ_TEX_WORD2_OFFSET_Z(x)                                 (((unsigned)(x) & 0x1F) << 10)
499 #define   G_SQ_TEX_WORD2_OFFSET_Z(x)                                 (((x) >> 10) & 0x1F)
500 #define   C_SQ_TEX_WORD2_OFFSET_Z                                    0xFFFF83FF
501 #define   S_SQ_TEX_WORD2_SAMPLER_ID(x)                               (((unsigned)(x) & 0x1F) << 15)
502 #define   G_SQ_TEX_WORD2_SAMPLER_ID(x)                               (((x) >> 15) & 0x1F)
503 #define   C_SQ_TEX_WORD2_SAMPLER_ID                                  0xFFF07FFF
504 #define   S_SQ_TEX_WORD2_SRC_SEL_X(x)                                (((unsigned)(x) & 0x7) << 20)
505 #define   G_SQ_TEX_WORD2_SRC_SEL_X(x)                                (((x) >> 20) & 0x7)
506 #define   C_SQ_TEX_WORD2_SRC_SEL_X                                   0xFF8FFFFF
507 #define   S_SQ_TEX_WORD2_SRC_SEL_Y(x)                                (((unsigned)(x) & 0x7) << 23)
508 #define   G_SQ_TEX_WORD2_SRC_SEL_Y(x)                                (((x) >> 23) & 0x7)
509 #define   C_SQ_TEX_WORD2_SRC_SEL_Y                                   0xFC7FFFFF
510 #define   S_SQ_TEX_WORD2_SRC_SEL_Z(x)                                (((unsigned)(x) & 0x7) << 26)
511 #define   G_SQ_TEX_WORD2_SRC_SEL_Z(x)                                (((x) >> 26) & 0x7)
512 #define   C_SQ_TEX_WORD2_SRC_SEL_Z                                   0xE3FFFFFF
513 #define   S_SQ_TEX_WORD2_SRC_SEL_W(x)                                (((unsigned)(x) & 0x7) << 29)
514 #define   G_SQ_TEX_WORD2_SRC_SEL_W(x)                                (((x) >> 29) & 0x7)
515 #define   C_SQ_TEX_WORD2_SRC_SEL_W                                   0x1FFFFFFF
516 
517 #define P_SQ_MEM_GDS_WORD0
518 #define   S_SQ_MEM_GDS_WORD0_MEM_INST(x)                             (((unsigned)(x) & 0x1f) << 0)
519 #define   S_SQ_MEM_GDS_WORD0_MEM_OP(x)                               (((unsigned)(x) & 0x7) << 8)
520 #define   S_SQ_MEM_GDS_WORD0_SRC_GPR(x)                              (((unsigned)(x) & 0x7f) << 11)
521 #define   S_SQ_MEM_GDS_WORD0_SRC_REL(x)                              (((unsigned)(x) & 0x3) << 18)
522 #define   S_SQ_MEM_GDS_WORD0_SRC_SEL_X(x)                            (((unsigned)(x) & 0x7) << 20)
523 #define   S_SQ_MEM_GDS_WORD0_SRC_SEL_Y(x)                            (((unsigned)(x) & 0x7) << 23)
524 #define   S_SQ_MEM_GDS_WORD0_SRC_SEL_Z(x)                            (((unsigned)(x) & 0x7) << 26)
525 
526 #define P_SQ_MEM_GDS_WORD1
527 #define   S_SQ_MEM_GDS_WORD1_DST_GPR(x)                              (((unsigned)(x) & 0x7f) << 0)
528 #define   S_SQ_MEM_GDS_WORD1_DST_REL(x)                              (((unsigned)(x) & 0x3) << 7)
529 #define   S_SQ_MEM_GDS_WORD1_GDS_OP(x)                               (((unsigned)(x) & 0x3f) << 9)
530 #define   S_SQ_MEM_GDS_WORD1_SRC_GPR(x)                              (((unsigned)(x) & 0x7f) << 16)
531 
532 #define P_SQ_MEM_GDS_WORD2
533 #define   S_SQ_MEM_GDS_WORD2_DST_SEL_X(x)                            (((unsigned)(x) & 0x7) << 0)
534 #define   S_SQ_MEM_GDS_WORD2_DST_SEL_Y(x)                            (((unsigned)(x) & 0x7) << 3)
535 #define   S_SQ_MEM_GDS_WORD2_DST_SEL_Z(x)                            (((unsigned)(x) & 0x7) << 6)
536 #define   S_SQ_MEM_GDS_WORD2_DST_SEL_W(x)                            (((unsigned)(x) & 0x7) << 9)
537 
538 /* LDS IDX redefines the neg bits on op3 */
539 #define S_SQ_ALU_WORD0_LDS_IDX_OP_IDX_OFFSET_4(x)                    (((unsigned)(x) & 0x1) << 12)
540 #define S_SQ_ALU_WORD0_LDS_IDX_OP_IDX_OFFSET_5(x)                    (((unsigned)(x) & 0x1) << 25)
541 
542 /* src2 neg */
543 #define S_SQ_ALU_WORD1_LDS_IDX_OP_IDX_OFFSET_1(x)                    (((unsigned)(x) & 0x1) << 12)
544 
545 /* this was dst gpr */
546 #define S_SQ_ALU_WORD1_LDS_IDX_OP_LDS_OP(x)                    (((unsigned)(x) & 0x3f) << 21)
547 #define S_SQ_ALU_WORD1_LDS_IDX_OP_IDX_OFFSET_0(x)                    (((unsigned)(x) & 0x1) << 27)
548 
549 /* this was dst rel */
550 #define S_SQ_ALU_WORD1_LDS_IDX_OP_IDX_OFFSET_2(x)                    (((unsigned)(x) & 0x1) << 28)
551 /* this was clamp */
552 #define S_SQ_ALU_WORD1_LDS_IDX_OP_IDX_OFFSET_3(x)                    (((unsigned)(x) & 0x1) << 31)
553 
554 #define V_SQ_LDS_INST_ADD                               0x00
555 #define V_SQ_LDS_INST_SUB                               0x01
556 #define V_SQ_LDS_INST_RSUB                              0x02
557 
558 #define V_SQ_LDS_INST_INC                               0x03
559 #define V_SQ_LDS_INST_DEC                               0x04
560 #define V_SQ_LDS_INST_MIN_INT                           0x05
561 #define V_SQ_LDS_INST_MAX_INT                           0x06
562 #define V_SQ_LDS_INST_MIN_UINT                          0x07
563 #define V_SQ_LDS_INST_MAX_UINT                          0x08
564 #define V_SQ_LDS_INST_AND                               0x09
565 #define V_SQ_LDS_INST_OR                                0x0a
566 #define V_SQ_LDS_INST_XOR                               0x0b
567 #define V_SQ_LDS_INST_MSKOR                             0x0c
568 #define V_SQ_LDS_INST_WRITE                             0x0d
569 #define V_SQ_LDS_INST_WRITE_REL                         0x0e
570 #define V_SQ_LDS_INST_WRITE2                            0x0f
571 
572 #define V_SQ_LDS_INST_READ_RET                          0x32
573 #define V_SQ_LDS_INST_READ_REL_RET                      0x33
574 #define V_SQ_LDS_INST_READ2_RET                         0x34
575 #define V_SQ_LDS_INST_READWRITE_RET                     0x35
576 
577 #define V_SQ_CF_COND_ACTIVE                             0x00
578 #define V_SQ_CF_COND_FALSE                              0x01
579 #define V_SQ_CF_COND_BOOL                               0x02
580 #define V_SQ_CF_COND_NOT_BOOL                           0x03
581 
582 #define V_SQ_REL_ABSOLUTE 0
583 #define V_SQ_REL_RELATIVE 1
584 
585 /* CAYMAN has special encoding for MOVA_INT destination */
586 #define CM_V_SQ_MOVA_DST_AR_X 0
587 #define CM_V_SQ_MOVA_DST_CF_PC 1
588 #define CM_V_SQ_MOVA_DST_CF_IDX0 2
589 #define CM_V_SQ_MOVA_DST_CF_IDX1 3
590 
591 #endif
592