r420d.h revision 254885
11897Swollman/*
299979Salfred * Copyright 2008 Advanced Micro Devices, Inc.
399979Salfred * Copyright 2008 Red Hat Inc.
499979Salfred * Copyright 2009 Jerome Glisse.
51897Swollman *
61897Swollman * Permission is hereby granted, free of charge, to any person obtaining a
71897Swollman * copy of this software and associated documentation files (the "Software"),
81897Swollman * to deal in the Software without restriction, including without limitation
91897Swollman * the rights to use, copy, modify, merge, publish, distribute, sublicense,
101897Swollman * and/or sell copies of the Software, and to permit persons to whom the
11100441Scharnier * Software is furnished to do so, subject to the following conditions:
121897Swollman *
131897Swollman * The above copyright notice and this permission notice shall be included in
141897Swollman * all copies or substantial portions of the Software.
15100441Scharnier *
161897Swollman * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
171897Swollman * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
181897Swollman * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19100441Scharnier * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
201897Swollman * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
211897Swollman * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
221897Swollman * OTHER DEALINGS IN THE SOFTWARE.
23100441Scharnier *
241897Swollman * Authors: Dave Airlie
251897Swollman *          Alex Deucher
261897Swollman *          Jerome Glisse
27100441Scharnier */
281897Swollman#ifndef R420D_H
291897Swollman#define R420D_H
301897Swollman
311897Swollman#include <sys/cdefs.h>
3299979Salfred__FBSDID("$FreeBSD: head/sys/dev/drm2/radeon/r420d.h 254885 2013-08-25 19:37:15Z dumbbell $");
331897Swollman
3412798Swpaul#define R_0001F8_MC_IND_INDEX                        0x0001F8
3512798Swpaul#define   S_0001F8_MC_IND_ADDR(x)                      (((x) & 0x7F) << 0)
3612798Swpaul#define   G_0001F8_MC_IND_ADDR(x)                      (((x) >> 0) & 0x7F)
3712798Swpaul#define   C_0001F8_MC_IND_ADDR                         0xFFFFFF80
3812798Swpaul#define   S_0001F8_MC_IND_WR_EN(x)                     (((x) & 0x1) << 8)
3912798Swpaul#define   G_0001F8_MC_IND_WR_EN(x)                     (((x) >> 8) & 0x1)
4012798Swpaul#define   C_0001F8_MC_IND_WR_EN                        0xFFFFFEFF
4112798Swpaul#define R_0001FC_MC_IND_DATA                         0x0001FC
4212798Swpaul#define   S_0001FC_MC_IND_DATA(x)                      (((x) & 0xFFFFFFFF) << 0)
4312798Swpaul#define   G_0001FC_MC_IND_DATA(x)                      (((x) >> 0) & 0xFFFFFFFF)
4412798Swpaul#define   C_0001FC_MC_IND_DATA                         0x00000000
4512798Swpaul#define R_0007C0_CP_STAT                             0x0007C0
4612798Swpaul#define   S_0007C0_MRU_BUSY(x)                         (((x) & 0x1) << 0)
4712798Swpaul#define   G_0007C0_MRU_BUSY(x)                         (((x) >> 0) & 0x1)
4812798Swpaul#define   C_0007C0_MRU_BUSY                            0xFFFFFFFE
4912798Swpaul#define   S_0007C0_MWU_BUSY(x)                         (((x) & 0x1) << 1)
5012798Swpaul#define   G_0007C0_MWU_BUSY(x)                         (((x) >> 1) & 0x1)
5112798Swpaul#define   C_0007C0_MWU_BUSY                            0xFFFFFFFD
5212798Swpaul#define   S_0007C0_RSIU_BUSY(x)                        (((x) & 0x1) << 2)
5312798Swpaul#define   G_0007C0_RSIU_BUSY(x)                        (((x) >> 2) & 0x1)
54100441Scharnier#define   C_0007C0_RSIU_BUSY                           0xFFFFFFFB
5512798Swpaul#define   S_0007C0_RCIU_BUSY(x)                        (((x) & 0x1) << 3)
56100441Scharnier#define   G_0007C0_RCIU_BUSY(x)                        (((x) >> 3) & 0x1)
5712798Swpaul#define   C_0007C0_RCIU_BUSY                           0xFFFFFFF7
5812798Swpaul#define   S_0007C0_CSF_PRIMARY_BUSY(x)                 (((x) & 0x1) << 9)
5912798Swpaul#define   G_0007C0_CSF_PRIMARY_BUSY(x)                 (((x) >> 9) & 0x1)
6012798Swpaul#define   C_0007C0_CSF_PRIMARY_BUSY                    0xFFFFFDFF
6112798Swpaul#define   S_0007C0_CSF_INDIRECT_BUSY(x)                (((x) & 0x1) << 10)
62100441Scharnier#define   G_0007C0_CSF_INDIRECT_BUSY(x)                (((x) >> 10) & 0x1)
6312798Swpaul#define   C_0007C0_CSF_INDIRECT_BUSY                   0xFFFFFBFF
6412798Swpaul#define   S_0007C0_CSQ_PRIMARY_BUSY(x)                 (((x) & 0x1) << 11)
6512798Swpaul#define   G_0007C0_CSQ_PRIMARY_BUSY(x)                 (((x) >> 11) & 0x1)
661897Swollman#define   C_0007C0_CSQ_PRIMARY_BUSY                    0xFFFFF7FF
67100441Scharnier#define   S_0007C0_CSQ_INDIRECT_BUSY(x)                (((x) & 0x1) << 12)
681897Swollman#define   G_0007C0_CSQ_INDIRECT_BUSY(x)                (((x) >> 12) & 0x1)
691897Swollman#define   C_0007C0_CSQ_INDIRECT_BUSY                   0xFFFFEFFF
701897Swollman#define   S_0007C0_CSI_BUSY(x)                         (((x) & 0x1) << 13)
71100441Scharnier#define   G_0007C0_CSI_BUSY(x)                         (((x) >> 13) & 0x1)
721897Swollman#define   C_0007C0_CSI_BUSY                            0xFFFFDFFF
731897Swollman#define   S_0007C0_CSF_INDIRECT2_BUSY(x)               (((x) & 0x1) << 14)
741897Swollman#define   G_0007C0_CSF_INDIRECT2_BUSY(x)               (((x) >> 14) & 0x1)
7512798Swpaul#define   C_0007C0_CSF_INDIRECT2_BUSY                  0xFFFFBFFF
761897Swollman#define   S_0007C0_CSQ_INDIRECT2_BUSY(x)               (((x) & 0x1) << 15)
771897Swollman#define   G_0007C0_CSQ_INDIRECT2_BUSY(x)               (((x) >> 15) & 0x1)
781897Swollman#define   C_0007C0_CSQ_INDIRECT2_BUSY                  0xFFFF7FFF
791897Swollman#define   S_0007C0_GUIDMA_BUSY(x)                      (((x) & 0x1) << 28)
801897Swollman#define   G_0007C0_GUIDMA_BUSY(x)                      (((x) >> 28) & 0x1)
811897Swollman#define   C_0007C0_GUIDMA_BUSY                         0xEFFFFFFF
821897Swollman#define   S_0007C0_VIDDMA_BUSY(x)                      (((x) & 0x1) << 29)
831897Swollman#define   G_0007C0_VIDDMA_BUSY(x)                      (((x) >> 29) & 0x1)
841897Swollman#define   C_0007C0_VIDDMA_BUSY                         0xDFFFFFFF
851897Swollman#define   S_0007C0_CMDSTRM_BUSY(x)                     (((x) & 0x1) << 30)
861897Swollman#define   G_0007C0_CMDSTRM_BUSY(x)                     (((x) >> 30) & 0x1)
871897Swollman#define   C_0007C0_CMDSTRM_BUSY                        0xBFFFFFFF
881897Swollman#define   S_0007C0_CP_BUSY(x)                          (((x) & 0x1) << 31)
891897Swollman#define   G_0007C0_CP_BUSY(x)                          (((x) >> 31) & 0x1)
901897Swollman#define   C_0007C0_CP_BUSY                             0x7FFFFFFF
911897Swollman#define R_000E40_RBBM_STATUS                         0x000E40
921897Swollman#define   S_000E40_CMDFIFO_AVAIL(x)                    (((x) & 0x7F) << 0)
931897Swollman#define   G_000E40_CMDFIFO_AVAIL(x)                    (((x) >> 0) & 0x7F)
941897Swollman#define   C_000E40_CMDFIFO_AVAIL                       0xFFFFFF80
951897Swollman#define   S_000E40_HIRQ_ON_RBB(x)                      (((x) & 0x1) << 8)
961897Swollman#define   G_000E40_HIRQ_ON_RBB(x)                      (((x) >> 8) & 0x1)
971897Swollman#define   C_000E40_HIRQ_ON_RBB                         0xFFFFFEFF
981897Swollman#define   S_000E40_CPRQ_ON_RBB(x)                      (((x) & 0x1) << 9)
991897Swollman#define   G_000E40_CPRQ_ON_RBB(x)                      (((x) >> 9) & 0x1)
1001897Swollman#define   C_000E40_CPRQ_ON_RBB                         0xFFFFFDFF
10112798Swpaul#define   S_000E40_CFRQ_ON_RBB(x)                      (((x) & 0x1) << 10)
1021897Swollman#define   G_000E40_CFRQ_ON_RBB(x)                      (((x) >> 10) & 0x1)
1031897Swollman#define   C_000E40_CFRQ_ON_RBB                         0xFFFFFBFF
1041897Swollman#define   S_000E40_HIRQ_IN_RTBUF(x)                    (((x) & 0x1) << 11)
10512798Swpaul#define   G_000E40_HIRQ_IN_RTBUF(x)                    (((x) >> 11) & 0x1)
1061897Swollman#define   C_000E40_HIRQ_IN_RTBUF                       0xFFFFF7FF
1071897Swollman#define   S_000E40_CPRQ_IN_RTBUF(x)                    (((x) & 0x1) << 12)
1081897Swollman#define   G_000E40_CPRQ_IN_RTBUF(x)                    (((x) >> 12) & 0x1)
1091897Swollman#define   C_000E40_CPRQ_IN_RTBUF                       0xFFFFEFFF
1101897Swollman#define   S_000E40_CFRQ_IN_RTBUF(x)                    (((x) & 0x1) << 13)
1111897Swollman#define   G_000E40_CFRQ_IN_RTBUF(x)                    (((x) >> 13) & 0x1)
1121897Swollman#define   C_000E40_CFRQ_IN_RTBUF                       0xFFFFDFFF
1131897Swollman#define   S_000E40_CF_PIPE_BUSY(x)                     (((x) & 0x1) << 14)
1141897Swollman#define   G_000E40_CF_PIPE_BUSY(x)                     (((x) >> 14) & 0x1)
1151897Swollman#define   C_000E40_CF_PIPE_BUSY                        0xFFFFBFFF
1161897Swollman#define   S_000E40_ENG_EV_BUSY(x)                      (((x) & 0x1) << 15)
1171897Swollman#define   G_000E40_ENG_EV_BUSY(x)                      (((x) >> 15) & 0x1)
118100441Scharnier#define   C_000E40_ENG_EV_BUSY                         0xFFFF7FFF
1191897Swollman#define   S_000E40_CP_CMDSTRM_BUSY(x)                  (((x) & 0x1) << 16)
1201897Swollman#define   G_000E40_CP_CMDSTRM_BUSY(x)                  (((x) >> 16) & 0x1)
1211897Swollman#define   C_000E40_CP_CMDSTRM_BUSY                     0xFFFEFFFF
1221897Swollman#define   S_000E40_E2_BUSY(x)                          (((x) & 0x1) << 17)
1231897Swollman#define   G_000E40_E2_BUSY(x)                          (((x) >> 17) & 0x1)
1241897Swollman#define   C_000E40_E2_BUSY                             0xFFFDFFFF
1251897Swollman#define   S_000E40_RB2D_BUSY(x)                        (((x) & 0x1) << 18)
1261897Swollman#define   G_000E40_RB2D_BUSY(x)                        (((x) >> 18) & 0x1)
1271897Swollman#define   C_000E40_RB2D_BUSY                           0xFFFBFFFF
128100441Scharnier#define   S_000E40_RB3D_BUSY(x)                        (((x) & 0x1) << 19)
1291897Swollman#define   G_000E40_RB3D_BUSY(x)                        (((x) >> 19) & 0x1)
1301897Swollman#define   C_000E40_RB3D_BUSY                           0xFFF7FFFF
1311897Swollman#define   S_000E40_VAP_BUSY(x)                         (((x) & 0x1) << 20)
1321897Swollman#define   G_000E40_VAP_BUSY(x)                         (((x) >> 20) & 0x1)
1331897Swollman#define   C_000E40_VAP_BUSY                            0xFFEFFFFF
1341897Swollman#define   S_000E40_RE_BUSY(x)                          (((x) & 0x1) << 21)
1351897Swollman#define   G_000E40_RE_BUSY(x)                          (((x) >> 21) & 0x1)
1361897Swollman#define   C_000E40_RE_BUSY                             0xFFDFFFFF
137#define   S_000E40_TAM_BUSY(x)                         (((x) & 0x1) << 22)
138#define   G_000E40_TAM_BUSY(x)                         (((x) >> 22) & 0x1)
139#define   C_000E40_TAM_BUSY                            0xFFBFFFFF
140#define   S_000E40_TDM_BUSY(x)                         (((x) & 0x1) << 23)
141#define   G_000E40_TDM_BUSY(x)                         (((x) >> 23) & 0x1)
142#define   C_000E40_TDM_BUSY                            0xFF7FFFFF
143#define   S_000E40_PB_BUSY(x)                          (((x) & 0x1) << 24)
144#define   G_000E40_PB_BUSY(x)                          (((x) >> 24) & 0x1)
145#define   C_000E40_PB_BUSY                             0xFEFFFFFF
146#define   S_000E40_TIM_BUSY(x)                         (((x) & 0x1) << 25)
147#define   G_000E40_TIM_BUSY(x)                         (((x) >> 25) & 0x1)
148#define   C_000E40_TIM_BUSY                            0xFDFFFFFF
149#define   S_000E40_GA_BUSY(x)                          (((x) & 0x1) << 26)
150#define   G_000E40_GA_BUSY(x)                          (((x) >> 26) & 0x1)
151#define   C_000E40_GA_BUSY                             0xFBFFFFFF
152#define   S_000E40_CBA2D_BUSY(x)                       (((x) & 0x1) << 27)
153#define   G_000E40_CBA2D_BUSY(x)                       (((x) >> 27) & 0x1)
154#define   C_000E40_CBA2D_BUSY                          0xF7FFFFFF
155#define   S_000E40_GUI_ACTIVE(x)                       (((x) & 0x1) << 31)
156#define   G_000E40_GUI_ACTIVE(x)                       (((x) >> 31) & 0x1)
157#define   C_000E40_GUI_ACTIVE                          0x7FFFFFFF
158
159/* CLK registers */
160#define R_00000D_SCLK_CNTL                           0x00000D
161#define   S_00000D_SCLK_SRC_SEL(x)                     (((x) & 0x7) << 0)
162#define   G_00000D_SCLK_SRC_SEL(x)                     (((x) >> 0) & 0x7)
163#define   C_00000D_SCLK_SRC_SEL                        0xFFFFFFF8
164#define   S_00000D_CP_MAX_DYN_STOP_LAT(x)              (((x) & 0x1) << 3)
165#define   G_00000D_CP_MAX_DYN_STOP_LAT(x)              (((x) >> 3) & 0x1)
166#define   C_00000D_CP_MAX_DYN_STOP_LAT                 0xFFFFFFF7
167#define   S_00000D_HDP_MAX_DYN_STOP_LAT(x)             (((x) & 0x1) << 4)
168#define   G_00000D_HDP_MAX_DYN_STOP_LAT(x)             (((x) >> 4) & 0x1)
169#define   C_00000D_HDP_MAX_DYN_STOP_LAT                0xFFFFFFEF
170#define   S_00000D_TV_MAX_DYN_STOP_LAT(x)              (((x) & 0x1) << 5)
171#define   G_00000D_TV_MAX_DYN_STOP_LAT(x)              (((x) >> 5) & 0x1)
172#define   C_00000D_TV_MAX_DYN_STOP_LAT                 0xFFFFFFDF
173#define   S_00000D_E2_MAX_DYN_STOP_LAT(x)              (((x) & 0x1) << 6)
174#define   G_00000D_E2_MAX_DYN_STOP_LAT(x)              (((x) >> 6) & 0x1)
175#define   C_00000D_E2_MAX_DYN_STOP_LAT                 0xFFFFFFBF
176#define   S_00000D_SE_MAX_DYN_STOP_LAT(x)              (((x) & 0x1) << 7)
177#define   G_00000D_SE_MAX_DYN_STOP_LAT(x)              (((x) >> 7) & 0x1)
178#define   C_00000D_SE_MAX_DYN_STOP_LAT                 0xFFFFFF7F
179#define   S_00000D_IDCT_MAX_DYN_STOP_LAT(x)            (((x) & 0x1) << 8)
180#define   G_00000D_IDCT_MAX_DYN_STOP_LAT(x)            (((x) >> 8) & 0x1)
181#define   C_00000D_IDCT_MAX_DYN_STOP_LAT               0xFFFFFEFF
182#define   S_00000D_VIP_MAX_DYN_STOP_LAT(x)             (((x) & 0x1) << 9)
183#define   G_00000D_VIP_MAX_DYN_STOP_LAT(x)             (((x) >> 9) & 0x1)
184#define   C_00000D_VIP_MAX_DYN_STOP_LAT                0xFFFFFDFF
185#define   S_00000D_RE_MAX_DYN_STOP_LAT(x)              (((x) & 0x1) << 10)
186#define   G_00000D_RE_MAX_DYN_STOP_LAT(x)              (((x) >> 10) & 0x1)
187#define   C_00000D_RE_MAX_DYN_STOP_LAT                 0xFFFFFBFF
188#define   S_00000D_PB_MAX_DYN_STOP_LAT(x)              (((x) & 0x1) << 11)
189#define   G_00000D_PB_MAX_DYN_STOP_LAT(x)              (((x) >> 11) & 0x1)
190#define   C_00000D_PB_MAX_DYN_STOP_LAT                 0xFFFFF7FF
191#define   S_00000D_TAM_MAX_DYN_STOP_LAT(x)             (((x) & 0x1) << 12)
192#define   G_00000D_TAM_MAX_DYN_STOP_LAT(x)             (((x) >> 12) & 0x1)
193#define   C_00000D_TAM_MAX_DYN_STOP_LAT                0xFFFFEFFF
194#define   S_00000D_TDM_MAX_DYN_STOP_LAT(x)             (((x) & 0x1) << 13)
195#define   G_00000D_TDM_MAX_DYN_STOP_LAT(x)             (((x) >> 13) & 0x1)
196#define   C_00000D_TDM_MAX_DYN_STOP_LAT                0xFFFFDFFF
197#define   S_00000D_RB_MAX_DYN_STOP_LAT(x)              (((x) & 0x1) << 14)
198#define   G_00000D_RB_MAX_DYN_STOP_LAT(x)              (((x) >> 14) & 0x1)
199#define   C_00000D_RB_MAX_DYN_STOP_LAT                 0xFFFFBFFF
200#define   S_00000D_FORCE_DISP2(x)                      (((x) & 0x1) << 15)
201#define   G_00000D_FORCE_DISP2(x)                      (((x) >> 15) & 0x1)
202#define   C_00000D_FORCE_DISP2                         0xFFFF7FFF
203#define   S_00000D_FORCE_CP(x)                         (((x) & 0x1) << 16)
204#define   G_00000D_FORCE_CP(x)                         (((x) >> 16) & 0x1)
205#define   C_00000D_FORCE_CP                            0xFFFEFFFF
206#define   S_00000D_FORCE_HDP(x)                        (((x) & 0x1) << 17)
207#define   G_00000D_FORCE_HDP(x)                        (((x) >> 17) & 0x1)
208#define   C_00000D_FORCE_HDP                           0xFFFDFFFF
209#define   S_00000D_FORCE_DISP1(x)                      (((x) & 0x1) << 18)
210#define   G_00000D_FORCE_DISP1(x)                      (((x) >> 18) & 0x1)
211#define   C_00000D_FORCE_DISP1                         0xFFFBFFFF
212#define   S_00000D_FORCE_TOP(x)                        (((x) & 0x1) << 19)
213#define   G_00000D_FORCE_TOP(x)                        (((x) >> 19) & 0x1)
214#define   C_00000D_FORCE_TOP                           0xFFF7FFFF
215#define   S_00000D_FORCE_E2(x)                         (((x) & 0x1) << 20)
216#define   G_00000D_FORCE_E2(x)                         (((x) >> 20) & 0x1)
217#define   C_00000D_FORCE_E2                            0xFFEFFFFF
218#define   S_00000D_FORCE_VAP(x)                        (((x) & 0x1) << 21)
219#define   G_00000D_FORCE_VAP(x)                        (((x) >> 21) & 0x1)
220#define   C_00000D_FORCE_VAP                           0xFFDFFFFF
221#define   S_00000D_FORCE_IDCT(x)                       (((x) & 0x1) << 22)
222#define   G_00000D_FORCE_IDCT(x)                       (((x) >> 22) & 0x1)
223#define   C_00000D_FORCE_IDCT                          0xFFBFFFFF
224#define   S_00000D_FORCE_VIP(x)                        (((x) & 0x1) << 23)
225#define   G_00000D_FORCE_VIP(x)                        (((x) >> 23) & 0x1)
226#define   C_00000D_FORCE_VIP                           0xFF7FFFFF
227#define   S_00000D_FORCE_RE(x)                         (((x) & 0x1) << 24)
228#define   G_00000D_FORCE_RE(x)                         (((x) >> 24) & 0x1)
229#define   C_00000D_FORCE_RE                            0xFEFFFFFF
230#define   S_00000D_FORCE_SR(x)                         (((x) & 0x1) << 25)
231#define   G_00000D_FORCE_SR(x)                         (((x) >> 25) & 0x1)
232#define   C_00000D_FORCE_SR                            0xFDFFFFFF
233#define   S_00000D_FORCE_PX(x)                         (((x) & 0x1) << 26)
234#define   G_00000D_FORCE_PX(x)                         (((x) >> 26) & 0x1)
235#define   C_00000D_FORCE_PX                            0xFBFFFFFF
236#define   S_00000D_FORCE_TX(x)                         (((x) & 0x1) << 27)
237#define   G_00000D_FORCE_TX(x)                         (((x) >> 27) & 0x1)
238#define   C_00000D_FORCE_TX                            0xF7FFFFFF
239#define   S_00000D_FORCE_US(x)                         (((x) & 0x1) << 28)
240#define   G_00000D_FORCE_US(x)                         (((x) >> 28) & 0x1)
241#define   C_00000D_FORCE_US                            0xEFFFFFFF
242#define   S_00000D_FORCE_TV_SCLK(x)                    (((x) & 0x1) << 29)
243#define   G_00000D_FORCE_TV_SCLK(x)                    (((x) >> 29) & 0x1)
244#define   C_00000D_FORCE_TV_SCLK                       0xDFFFFFFF
245#define   S_00000D_FORCE_SU(x)                         (((x) & 0x1) << 30)
246#define   G_00000D_FORCE_SU(x)                         (((x) >> 30) & 0x1)
247#define   C_00000D_FORCE_SU                            0xBFFFFFFF
248#define   S_00000D_FORCE_OV0(x)                        (((x) & 0x1) << 31)
249#define   G_00000D_FORCE_OV0(x)                        (((x) >> 31) & 0x1)
250#define   C_00000D_FORCE_OV0                           0x7FFFFFFF
251
252#endif
253