aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorJerome Glisse <jglisse@redhat.com>2009-09-30 09:35:32 -0400
committerDave Airlie <airlied@redhat.com>2009-10-01 18:51:48 -0400
commit207bf9e90cd40f91d4662127b8ae3b64e6b101c4 (patch)
tree2a2620bed9c01545a6a38a841ece647b2c072b21 /drivers/gpu
parentca6ffc64cba0cdd0a2b3fcad0e1d19edcf277ccc (diff)
drm/radeon/kms: Convert R300 to new init path
Also cleanup register specific to R300. Signed-off-by: Jerome Glisse <jglisse@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/radeon/r300.c293
-rw-r--r--drivers/gpu/drm/radeon/r300d.h113
-rw-r--r--drivers/gpu/drm/radeon/radeon.h10
-rw-r--r--drivers/gpu/drm/radeon/radeon_asic.h75
4 files changed, 345 insertions, 146 deletions
diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c
index e491d40d4d54..18c81dc750bc 100644
--- a/drivers/gpu/drm/radeon/r300.c
+++ b/drivers/gpu/drm/radeon/r300.c
@@ -34,42 +34,15 @@
34#include "r100_track.h" 34#include "r100_track.h"
35#include "r300d.h" 35#include "r300d.h"
36#include "rv350d.h" 36#include "rv350d.h"
37
38#include "r300_reg_safe.h" 37#include "r300_reg_safe.h"
39 38
40/* r300,r350,rv350,rv370,rv380 depends on : */ 39/* This files gather functions specifics to: r300,r350,rv350,rv370,rv380 */
41void r100_hdp_reset(struct radeon_device *rdev);
42int r100_cp_reset(struct radeon_device *rdev);
43int r100_rb2d_reset(struct radeon_device *rdev);
44int r100_cp_init(struct radeon_device *rdev, unsigned ring_size);
45int r100_pci_gart_enable(struct radeon_device *rdev);
46void r100_mc_setup(struct radeon_device *rdev);
47void r100_mc_disable_clients(struct radeon_device *rdev);
48int r100_gui_wait_for_idle(struct radeon_device *rdev);
49int r100_cs_packet_parse(struct radeon_cs_parser *p,
50 struct radeon_cs_packet *pkt,
51 unsigned idx);
52int r100_cs_packet_parse_vline(struct radeon_cs_parser *p);
53int r100_cs_parse_packet0(struct radeon_cs_parser *p,
54 struct radeon_cs_packet *pkt,
55 const unsigned *auth, unsigned n,
56 radeon_packet0_check_t check);
57int r100_cs_track_check_pkt3_indx_buffer(struct radeon_cs_parser *p,
58 struct radeon_cs_packet *pkt,
59 struct radeon_object *robj);
60
61/* This files gather functions specifics to:
62 * r300,r350,rv350,rv370,rv380
63 *
64 * Some of these functions might be used by newer ASICs.
65 */
66void r300_gpu_init(struct radeon_device *rdev);
67int rv370_debugfs_pcie_gart_info_init(struct radeon_device *rdev);
68
69 40
70/* 41/*
71 * rv370,rv380 PCIE GART 42 * rv370,rv380 PCIE GART
72 */ 43 */
44static int rv370_debugfs_pcie_gart_info_init(struct radeon_device *rdev);
45
73void rv370_pcie_gart_tlb_flush(struct radeon_device *rdev) 46void rv370_pcie_gart_tlb_flush(struct radeon_device *rdev)
74{ 47{
75 uint32_t tmp; 48 uint32_t tmp;
@@ -182,59 +155,6 @@ void rv370_pcie_gart_fini(struct radeon_device *rdev)
182 radeon_gart_fini(rdev); 155 radeon_gart_fini(rdev);
183} 156}
184 157
185/*
186 * MC
187 */
188int r300_mc_init(struct radeon_device *rdev)
189{
190 int r;
191
192 if (r100_debugfs_rbbm_init(rdev)) {
193 DRM_ERROR("Failed to register debugfs file for RBBM !\n");
194 }
195
196 r300_gpu_init(rdev);
197 r100_pci_gart_disable(rdev);
198 if (rdev->flags & RADEON_IS_PCIE) {
199 rv370_pcie_gart_disable(rdev);
200 }
201
202 /* Setup GPU memory space */
203 rdev->mc.vram_location = 0xFFFFFFFFUL;
204 rdev->mc.gtt_location = 0xFFFFFFFFUL;
205 if (rdev->flags & RADEON_IS_AGP) {
206 r = radeon_agp_init(rdev);
207 if (r) {
208 printk(KERN_WARNING "[drm] Disabling AGP\n");
209 rdev->flags &= ~RADEON_IS_AGP;
210 rdev->mc.gtt_size = radeon_gart_size * 1024 * 1024;
211 } else {
212 rdev->mc.gtt_location = rdev->mc.agp_base;
213 }
214 }
215 r = radeon_mc_setup(rdev);
216 if (r) {
217 return r;
218 }
219
220 /* Program GPU memory space */
221 r100_mc_disable_clients(rdev);
222 if (r300_mc_wait_for_idle(rdev)) {
223 printk(KERN_WARNING "Failed to wait MC idle while "
224 "programming pipes. Bad things might happen.\n");
225 }
226 r100_mc_setup(rdev);
227 return 0;
228}
229
230void r300_mc_fini(struct radeon_device *rdev)
231{
232}
233
234
235/*
236 * Fence emission
237 */
238void r300_fence_ring_emit(struct radeon_device *rdev, 158void r300_fence_ring_emit(struct radeon_device *rdev,
239 struct radeon_fence *fence) 159 struct radeon_fence *fence)
240{ 160{
@@ -260,10 +180,6 @@ void r300_fence_ring_emit(struct radeon_device *rdev,
260 radeon_ring_write(rdev, RADEON_SW_INT_FIRE); 180 radeon_ring_write(rdev, RADEON_SW_INT_FIRE);
261} 181}
262 182
263
264/*
265 * Global GPU functions
266 */
267int r300_copy_dma(struct radeon_device *rdev, 183int r300_copy_dma(struct radeon_device *rdev,
268 uint64_t src_offset, 184 uint64_t src_offset,
269 uint64_t dst_offset, 185 uint64_t dst_offset,
@@ -582,11 +498,6 @@ void r300_vram_info(struct radeon_device *rdev)
582 r100_vram_init_sizes(rdev); 498 r100_vram_init_sizes(rdev);
583} 499}
584 500
585
586/*
587 * PCIE Lanes
588 */
589
590void rv370_set_pcie_lanes(struct radeon_device *rdev, int lanes) 501void rv370_set_pcie_lanes(struct radeon_device *rdev, int lanes)
591{ 502{
592 uint32_t link_width_cntl, mask; 503 uint32_t link_width_cntl, mask;
@@ -646,10 +557,6 @@ void rv370_set_pcie_lanes(struct radeon_device *rdev, int lanes)
646 557
647} 558}
648 559
649
650/*
651 * Debugfs info
652 */
653#if defined(CONFIG_DEBUG_FS) 560#if defined(CONFIG_DEBUG_FS)
654static int rv370_debugfs_pcie_gart_info(struct seq_file *m, void *data) 561static int rv370_debugfs_pcie_gart_info(struct seq_file *m, void *data)
655{ 562{
@@ -680,7 +587,7 @@ static struct drm_info_list rv370_pcie_gart_info_list[] = {
680}; 587};
681#endif 588#endif
682 589
683int rv370_debugfs_pcie_gart_info_init(struct radeon_device *rdev) 590static int rv370_debugfs_pcie_gart_info_init(struct radeon_device *rdev)
684{ 591{
685#if defined(CONFIG_DEBUG_FS) 592#if defined(CONFIG_DEBUG_FS)
686 return radeon_debugfs_add_files(rdev, rv370_pcie_gart_info_list, 1); 593 return radeon_debugfs_add_files(rdev, rv370_pcie_gart_info_list, 1);
@@ -689,10 +596,6 @@ int rv370_debugfs_pcie_gart_info_init(struct radeon_device *rdev)
689#endif 596#endif
690} 597}
691 598
692
693/*
694 * CS functions
695 */
696static int r300_packet0_check(struct radeon_cs_parser *p, 599static int r300_packet0_check(struct radeon_cs_parser *p,
697 struct radeon_cs_packet *pkt, 600 struct radeon_cs_packet *pkt,
698 unsigned idx, unsigned reg) 601 unsigned idx, unsigned reg)
@@ -1226,12 +1129,6 @@ void r300_set_reg_safe(struct radeon_device *rdev)
1226 rdev->config.r300.reg_safe_bm_size = ARRAY_SIZE(r300_reg_safe_bm); 1129 rdev->config.r300.reg_safe_bm_size = ARRAY_SIZE(r300_reg_safe_bm);
1227} 1130}
1228 1131
1229int r300_init(struct radeon_device *rdev)
1230{
1231 r300_set_reg_safe(rdev);
1232 return 0;
1233}
1234
1235void r300_mc_program(struct radeon_device *rdev) 1132void r300_mc_program(struct radeon_device *rdev)
1236{ 1133{
1237 struct r100_mc_save save; 1134 struct r100_mc_save save;
@@ -1279,3 +1176,185 @@ void r300_clock_startup(struct radeon_device *rdev)
1279 tmp |= S_00000D_FORCE_VAP(1); 1176 tmp |= S_00000D_FORCE_VAP(1);
1280 WREG32_PLL(R_00000D_SCLK_CNTL, tmp); 1177 WREG32_PLL(R_00000D_SCLK_CNTL, tmp);
1281} 1178}
1179
1180static int r300_startup(struct radeon_device *rdev)
1181{
1182 int r;
1183
1184 r300_mc_program(rdev);
1185 /* Resume clock */
1186 r300_clock_startup(rdev);
1187 /* Initialize GPU configuration (# pipes, ...) */
1188 r300_gpu_init(rdev);
1189 /* Initialize GART (initialize after TTM so we can allocate
1190 * memory through TTM but finalize after TTM) */
1191 if (rdev->flags & RADEON_IS_PCIE) {
1192 r = rv370_pcie_gart_enable(rdev);
1193 if (r)
1194 return r;
1195 }
1196 if (rdev->flags & RADEON_IS_PCI) {
1197 r = r100_pci_gart_enable(rdev);
1198 if (r)
1199 return r;
1200 }
1201 /* Enable IRQ */
1202 rdev->irq.sw_int = true;
1203 r100_irq_set(rdev);
1204 /* 1M ring buffer */
1205 r = r100_cp_init(rdev, 1024 * 1024);
1206 if (r) {
1207 dev_err(rdev->dev, "failled initializing CP (%d).\n", r);
1208 return r;
1209 }
1210 r = r100_wb_init(rdev);
1211 if (r)
1212 dev_err(rdev->dev, "failled initializing WB (%d).\n", r);
1213 r = r100_ib_init(rdev);
1214 if (r) {
1215 dev_err(rdev->dev, "failled initializing IB (%d).\n", r);
1216 return r;
1217 }
1218 return 0;
1219}
1220
1221int r300_resume(struct radeon_device *rdev)
1222{
1223 /* Make sur GART are not working */
1224 if (rdev->flags & RADEON_IS_PCIE)
1225 rv370_pcie_gart_disable(rdev);
1226 if (rdev->flags & RADEON_IS_PCI)
1227 r100_pci_gart_disable(rdev);
1228 /* Resume clock before doing reset */
1229 r300_clock_startup(rdev);
1230 /* Reset gpu before posting otherwise ATOM will enter infinite loop */
1231 if (radeon_gpu_reset(rdev)) {
1232 dev_warn(rdev->dev, "GPU reset failed ! (0xE40=0x%08X, 0x7C0=0x%08X)\n",
1233 RREG32(R_000E40_RBBM_STATUS),
1234 RREG32(R_0007C0_CP_STAT));
1235 }
1236 /* post */
1237 radeon_combios_asic_init(rdev->ddev);
1238 /* Resume clock after posting */
1239 r300_clock_startup(rdev);
1240 return r300_startup(rdev);
1241}
1242
1243int r300_suspend(struct radeon_device *rdev)
1244{
1245 r100_cp_disable(rdev);
1246 r100_wb_disable(rdev);
1247 r100_irq_disable(rdev);
1248 if (rdev->flags & RADEON_IS_PCIE)
1249 rv370_pcie_gart_disable(rdev);
1250 if (rdev->flags & RADEON_IS_PCI)
1251 r100_pci_gart_disable(rdev);
1252 return 0;
1253}
1254
1255void r300_fini(struct radeon_device *rdev)
1256{
1257 r300_suspend(rdev);
1258 r100_cp_fini(rdev);
1259 r100_wb_fini(rdev);
1260 r100_ib_fini(rdev);
1261 radeon_gem_fini(rdev);
1262 if (rdev->flags & RADEON_IS_PCIE)
1263 rv370_pcie_gart_fini(rdev);
1264 if (rdev->flags & RADEON_IS_PCI)
1265 r100_pci_gart_fini(rdev);
1266 radeon_irq_kms_fini(rdev);
1267 radeon_fence_driver_fini(rdev);
1268 radeon_object_fini(rdev);
1269 radeon_atombios_fini(rdev);
1270 kfree(rdev->bios);
1271 rdev->bios = NULL;
1272}
1273
1274int r300_init(struct radeon_device *rdev)
1275{
1276 int r;
1277
1278 rdev->new_init_path = true;
1279 /* Disable VGA */
1280 r100_vga_render_disable(rdev);
1281 /* Initialize scratch registers */
1282 radeon_scratch_init(rdev);
1283 /* Initialize surface registers */
1284 radeon_surface_init(rdev);
1285 /* TODO: disable VGA need to use VGA request */
1286 /* BIOS*/
1287 if (!radeon_get_bios(rdev)) {
1288 if (ASIC_IS_AVIVO(rdev))
1289 return -EINVAL;
1290 }
1291 if (rdev->is_atom_bios) {
1292 dev_err(rdev->dev, "Expecting combios for RS400/RS480 GPU\n");
1293 return -EINVAL;
1294 } else {
1295 r = radeon_combios_init(rdev);
1296 if (r)
1297 return r;
1298 }
1299 /* Reset gpu before posting otherwise ATOM will enter infinite loop */
1300 if (radeon_gpu_reset(rdev)) {
1301 dev_warn(rdev->dev,
1302 "GPU reset failed ! (0xE40=0x%08X, 0x7C0=0x%08X)\n",
1303 RREG32(R_000E40_RBBM_STATUS),
1304 RREG32(R_0007C0_CP_STAT));
1305 }
1306 /* check if cards are posted or not */
1307 if (!radeon_card_posted(rdev) && rdev->bios) {
1308 DRM_INFO("GPU not posted. posting now...\n");
1309 radeon_combios_asic_init(rdev->ddev);
1310 }
1311 /* Set asic errata */
1312 r300_errata(rdev);
1313 /* Initialize clocks */
1314 radeon_get_clock_info(rdev->ddev);
1315 /* Get vram informations */
1316 r300_vram_info(rdev);
1317 /* Initialize memory controller (also test AGP) */
1318 r = r420_mc_init(rdev);
1319 if (r)
1320 return r;
1321 /* Fence driver */
1322 r = radeon_fence_driver_init(rdev);
1323 if (r)
1324 return r;
1325 r = radeon_irq_kms_init(rdev);
1326 if (r)
1327 return r;
1328 /* Memory manager */
1329 r = radeon_object_init(rdev);
1330 if (r)
1331 return r;
1332 if (rdev->flags & RADEON_IS_PCIE) {
1333 r = rv370_pcie_gart_init(rdev);
1334 if (r)
1335 return r;
1336 }
1337 if (rdev->flags & RADEON_IS_PCI) {
1338 r = r100_pci_gart_init(rdev);
1339 if (r)
1340 return r;
1341 }
1342 r300_set_reg_safe(rdev);
1343 rdev->accel_working = true;
1344 r = r300_startup(rdev);
1345 if (r) {
1346 /* Somethings want wront with the accel init stop accel */
1347 dev_err(rdev->dev, "Disabling GPU acceleration\n");
1348 r300_suspend(rdev);
1349 r100_cp_fini(rdev);
1350 r100_wb_fini(rdev);
1351 r100_ib_fini(rdev);
1352 if (rdev->flags & RADEON_IS_PCIE)
1353 rv370_pcie_gart_fini(rdev);
1354 if (rdev->flags & RADEON_IS_PCI)
1355 r100_pci_gart_fini(rdev);
1356 radeon_irq_kms_fini(rdev);
1357 rdev->accel_working = false;
1358 }
1359 return 0;
1360}
diff --git a/drivers/gpu/drm/radeon/r300d.h b/drivers/gpu/drm/radeon/r300d.h
index a6d54dabc50f..4c73114f0de9 100644
--- a/drivers/gpu/drm/radeon/r300d.h
+++ b/drivers/gpu/drm/radeon/r300d.h
@@ -96,6 +96,119 @@
96#define S_000170_AGP_BASE_ADDR(x) (((x) & 0xFFFFFFFF) << 0) 96#define S_000170_AGP_BASE_ADDR(x) (((x) & 0xFFFFFFFF) << 0)
97#define G_000170_AGP_BASE_ADDR(x) (((x) >> 0) & 0xFFFFFFFF) 97#define G_000170_AGP_BASE_ADDR(x) (((x) >> 0) & 0xFFFFFFFF)
98#define C_000170_AGP_BASE_ADDR 0x00000000 98#define C_000170_AGP_BASE_ADDR 0x00000000
99#define R_0007C0_CP_STAT 0x0007C0
100#define S_0007C0_MRU_BUSY(x) (((x) & 0x1) << 0)
101#define G_0007C0_MRU_BUSY(x) (((x) >> 0) & 0x1)
102#define C_0007C0_MRU_BUSY 0xFFFFFFFE
103#define S_0007C0_MWU_BUSY(x) (((x) & 0x1) << 1)
104#define G_0007C0_MWU_BUSY(x) (((x) >> 1) & 0x1)
105#define C_0007C0_MWU_BUSY 0xFFFFFFFD
106#define S_0007C0_RSIU_BUSY(x) (((x) & 0x1) << 2)
107#define G_0007C0_RSIU_BUSY(x) (((x) >> 2) & 0x1)
108#define C_0007C0_RSIU_BUSY 0xFFFFFFFB
109#define S_0007C0_RCIU_BUSY(x) (((x) & 0x1) << 3)
110#define G_0007C0_RCIU_BUSY(x) (((x) >> 3) & 0x1)
111#define C_0007C0_RCIU_BUSY 0xFFFFFFF7
112#define S_0007C0_CSF_PRIMARY_BUSY(x) (((x) & 0x1) << 9)
113#define G_0007C0_CSF_PRIMARY_BUSY(x) (((x) >> 9) & 0x1)
114#define C_0007C0_CSF_PRIMARY_BUSY 0xFFFFFDFF
115#define S_0007C0_CSF_INDIRECT_BUSY(x) (((x) & 0x1) << 10)
116#define G_0007C0_CSF_INDIRECT_BUSY(x) (((x) >> 10) & 0x1)
117#define C_0007C0_CSF_INDIRECT_BUSY 0xFFFFFBFF
118#define S_0007C0_CSQ_PRIMARY_BUSY(x) (((x) & 0x1) << 11)
119#define G_0007C0_CSQ_PRIMARY_BUSY(x) (((x) >> 11) & 0x1)
120#define C_0007C0_CSQ_PRIMARY_BUSY 0xFFFFF7FF
121#define S_0007C0_CSQ_INDIRECT_BUSY(x) (((x) & 0x1) << 12)
122#define G_0007C0_CSQ_INDIRECT_BUSY(x) (((x) >> 12) & 0x1)
123#define C_0007C0_CSQ_INDIRECT_BUSY 0xFFFFEFFF
124#define S_0007C0_CSI_BUSY(x) (((x) & 0x1) << 13)
125#define G_0007C0_CSI_BUSY(x) (((x) >> 13) & 0x1)
126#define C_0007C0_CSI_BUSY 0xFFFFDFFF
127#define S_0007C0_CSF_INDIRECT2_BUSY(x) (((x) & 0x1) << 14)
128#define G_0007C0_CSF_INDIRECT2_BUSY(x) (((x) >> 14) & 0x1)
129#define C_0007C0_CSF_INDIRECT2_BUSY 0xFFFFBFFF
130#define S_0007C0_CSQ_INDIRECT2_BUSY(x) (((x) & 0x1) << 15)
131#define G_0007C0_CSQ_INDIRECT2_BUSY(x) (((x) >> 15) & 0x1)
132#define C_0007C0_CSQ_INDIRECT2_BUSY 0xFFFF7FFF
133#define S_0007C0_GUIDMA_BUSY(x) (((x) & 0x1) << 28)
134#define G_0007C0_GUIDMA_BUSY(x) (((x) >> 28) & 0x1)
135#define C_0007C0_GUIDMA_BUSY 0xEFFFFFFF
136#define S_0007C0_VIDDMA_BUSY(x) (((x) & 0x1) << 29)
137#define G_0007C0_VIDDMA_BUSY(x) (((x) >> 29) & 0x1)
138#define C_0007C0_VIDDMA_BUSY 0xDFFFFFFF
139#define S_0007C0_CMDSTRM_BUSY(x) (((x) & 0x1) << 30)
140#define G_0007C0_CMDSTRM_BUSY(x) (((x) >> 30) & 0x1)
141#define C_0007C0_CMDSTRM_BUSY 0xBFFFFFFF
142#define S_0007C0_CP_BUSY(x) (((x) & 0x1) << 31)
143#define G_0007C0_CP_BUSY(x) (((x) >> 31) & 0x1)
144#define C_0007C0_CP_BUSY 0x7FFFFFFF
145#define R_000E40_RBBM_STATUS 0x000E40
146#define S_000E40_CMDFIFO_AVAIL(x) (((x) & 0x7F) << 0)
147#define G_000E40_CMDFIFO_AVAIL(x) (((x) >> 0) & 0x7F)
148#define C_000E40_CMDFIFO_AVAIL 0xFFFFFF80
149#define S_000E40_HIRQ_ON_RBB(x) (((x) & 0x1) << 8)
150#define G_000E40_HIRQ_ON_RBB(x) (((x) >> 8) & 0x1)
151#define C_000E40_HIRQ_ON_RBB 0xFFFFFEFF
152#define S_000E40_CPRQ_ON_RBB(x) (((x) & 0x1) << 9)
153#define G_000E40_CPRQ_ON_RBB(x) (((x) >> 9) & 0x1)
154#define C_000E40_CPRQ_ON_RBB 0xFFFFFDFF
155#define S_000E40_CFRQ_ON_RBB(x) (((x) & 0x1) << 10)
156#define G_000E40_CFRQ_ON_RBB(x) (((x) >> 10) & 0x1)
157#define C_000E40_CFRQ_ON_RBB 0xFFFFFBFF
158#define S_000E40_HIRQ_IN_RTBUF(x) (((x) & 0x1) << 11)
159#define G_000E40_HIRQ_IN_RTBUF(x) (((x) >> 11) & 0x1)
160#define C_000E40_HIRQ_IN_RTBUF 0xFFFFF7FF
161#define S_000E40_CPRQ_IN_RTBUF(x) (((x) & 0x1) << 12)
162#define G_000E40_CPRQ_IN_RTBUF(x) (((x) >> 12) & 0x1)
163#define C_000E40_CPRQ_IN_RTBUF 0xFFFFEFFF
164#define S_000E40_CFRQ_IN_RTBUF(x) (((x) & 0x1) << 13)
165#define G_000E40_CFRQ_IN_RTBUF(x) (((x) >> 13) & 0x1)
166#define C_000E40_CFRQ_IN_RTBUF 0xFFFFDFFF
167#define S_000E40_CF_PIPE_BUSY(x) (((x) & 0x1) << 14)
168#define G_000E40_CF_PIPE_BUSY(x) (((x) >> 14) & 0x1)
169#define C_000E40_CF_PIPE_BUSY 0xFFFFBFFF
170#define S_000E40_ENG_EV_BUSY(x) (((x) & 0x1) << 15)
171#define G_000E40_ENG_EV_BUSY(x) (((x) >> 15) & 0x1)
172#define C_000E40_ENG_EV_BUSY 0xFFFF7FFF
173#define S_000E40_CP_CMDSTRM_BUSY(x) (((x) & 0x1) << 16)
174#define G_000E40_CP_CMDSTRM_BUSY(x) (((x) >> 16) & 0x1)
175#define C_000E40_CP_CMDSTRM_BUSY 0xFFFEFFFF
176#define S_000E40_E2_BUSY(x) (((x) & 0x1) << 17)
177#define G_000E40_E2_BUSY(x) (((x) >> 17) & 0x1)
178#define C_000E40_E2_BUSY 0xFFFDFFFF
179#define S_000E40_RB2D_BUSY(x) (((x) & 0x1) << 18)
180#define G_000E40_RB2D_BUSY(x) (((x) >> 18) & 0x1)
181#define C_000E40_RB2D_BUSY 0xFFFBFFFF
182#define S_000E40_RB3D_BUSY(x) (((x) & 0x1) << 19)
183#define G_000E40_RB3D_BUSY(x) (((x) >> 19) & 0x1)
184#define C_000E40_RB3D_BUSY 0xFFF7FFFF
185#define S_000E40_VAP_BUSY(x) (((x) & 0x1) << 20)
186#define G_000E40_VAP_BUSY(x) (((x) >> 20) & 0x1)
187#define C_000E40_VAP_BUSY 0xFFEFFFFF
188#define S_000E40_RE_BUSY(x) (((x) & 0x1) << 21)
189#define G_000E40_RE_BUSY(x) (((x) >> 21) & 0x1)
190#define C_000E40_RE_BUSY 0xFFDFFFFF
191#define S_000E40_TAM_BUSY(x) (((x) & 0x1) << 22)
192#define G_000E40_TAM_BUSY(x) (((x) >> 22) & 0x1)
193#define C_000E40_TAM_BUSY 0xFFBFFFFF
194#define S_000E40_TDM_BUSY(x) (((x) & 0x1) << 23)
195#define G_000E40_TDM_BUSY(x) (((x) >> 23) & 0x1)
196#define C_000E40_TDM_BUSY 0xFF7FFFFF
197#define S_000E40_PB_BUSY(x) (((x) & 0x1) << 24)
198#define G_000E40_PB_BUSY(x) (((x) >> 24) & 0x1)
199#define C_000E40_PB_BUSY 0xFEFFFFFF
200#define S_000E40_TIM_BUSY(x) (((x) & 0x1) << 25)
201#define G_000E40_TIM_BUSY(x) (((x) >> 25) & 0x1)
202#define C_000E40_TIM_BUSY 0xFDFFFFFF
203#define S_000E40_GA_BUSY(x) (((x) & 0x1) << 26)
204#define G_000E40_GA_BUSY(x) (((x) >> 26) & 0x1)
205#define C_000E40_GA_BUSY 0xFBFFFFFF
206#define S_000E40_CBA2D_BUSY(x) (((x) & 0x1) << 27)
207#define G_000E40_CBA2D_BUSY(x) (((x) >> 27) & 0x1)
208#define C_000E40_CBA2D_BUSY 0xF7FFFFFF
209#define S_000E40_GUI_ACTIVE(x) (((x) & 0x1) << 31)
210#define G_000E40_GUI_ACTIVE(x) (((x) >> 31) & 0x1)
211#define C_000E40_GUI_ACTIVE 0x7FFFFFFF
99 212
100 213
101#define R_00000D_SCLK_CNTL 0x00000D 214#define R_00000D_SCLK_CNTL 0x00000D
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 012cdff193c2..f31483d1749b 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -1031,6 +1031,16 @@ extern void r100_hdp_reset(struct radeon_device *rdev);
1031extern int r100_rb2d_reset(struct radeon_device *rdev); 1031extern int r100_rb2d_reset(struct radeon_device *rdev);
1032extern int r100_cp_reset(struct radeon_device *rdev); 1032extern int r100_cp_reset(struct radeon_device *rdev);
1033extern void r100_vga_render_disable(struct radeon_device *rdev); 1033extern void r100_vga_render_disable(struct radeon_device *rdev);
1034extern int r100_cs_track_check_pkt3_indx_buffer(struct radeon_cs_parser *p,
1035 struct radeon_cs_packet *pkt,
1036 struct radeon_object *robj);
1037extern int r100_cs_parse_packet0(struct radeon_cs_parser *p,
1038 struct radeon_cs_packet *pkt,
1039 const unsigned *auth, unsigned n,
1040 radeon_packet0_check_t check);
1041extern int r100_cs_packet_parse(struct radeon_cs_parser *p,
1042 struct radeon_cs_packet *pkt,
1043 unsigned idx);
1034 1044
1035/* r300,r350,rv350,rv370,rv380 */ 1045/* r300,r350,rv350,rv370,rv380 */
1036extern void r300_set_reg_safe(struct radeon_device *rdev); 1046extern void r300_set_reg_safe(struct radeon_device *rdev);
diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h
index 0fa117afc742..72562cf372b7 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.h
+++ b/drivers/gpu/drm/radeon/radeon_asic.h
@@ -129,54 +129,51 @@ static struct radeon_asic r100_asic = {
129/* 129/*
130 * r300,r350,rv350,rv380 130 * r300,r350,rv350,rv380
131 */ 131 */
132int r300_init(struct radeon_device *rdev); 132extern int r300_init(struct radeon_device *rdev);
133void r300_errata(struct radeon_device *rdev); 133extern void r300_fini(struct radeon_device *rdev);
134void r300_vram_info(struct radeon_device *rdev); 134extern int r300_suspend(struct radeon_device *rdev);
135int r300_gpu_reset(struct radeon_device *rdev); 135extern int r300_resume(struct radeon_device *rdev);
136int r300_mc_init(struct radeon_device *rdev); 136extern int r300_gpu_reset(struct radeon_device *rdev);
137void r300_mc_fini(struct radeon_device *rdev); 137extern void r300_ring_start(struct radeon_device *rdev);
138void r300_ring_start(struct radeon_device *rdev); 138extern void r300_fence_ring_emit(struct radeon_device *rdev,
139void r300_fence_ring_emit(struct radeon_device *rdev, 139 struct radeon_fence *fence);
140 struct radeon_fence *fence); 140extern int r300_cs_parse(struct radeon_cs_parser *p);
141int r300_cs_parse(struct radeon_cs_parser *p); 141extern void rv370_pcie_gart_tlb_flush(struct radeon_device *rdev);
142int rv370_pcie_gart_init(struct radeon_device *rdev); 142extern int rv370_pcie_gart_set_page(struct radeon_device *rdev, int i, uint64_t addr);
143void rv370_pcie_gart_fini(struct radeon_device *rdev); 143extern uint32_t rv370_pcie_rreg(struct radeon_device *rdev, uint32_t reg);
144int rv370_pcie_gart_enable(struct radeon_device *rdev); 144extern void rv370_pcie_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v);
145void rv370_pcie_gart_disable(struct radeon_device *rdev); 145extern void rv370_set_pcie_lanes(struct radeon_device *rdev, int lanes);
146void rv370_pcie_gart_tlb_flush(struct radeon_device *rdev); 146extern int r300_copy_dma(struct radeon_device *rdev,
147int rv370_pcie_gart_set_page(struct radeon_device *rdev, int i, uint64_t addr); 147 uint64_t src_offset,
148uint32_t rv370_pcie_rreg(struct radeon_device *rdev, uint32_t reg); 148 uint64_t dst_offset,
149void rv370_pcie_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v); 149 unsigned num_pages,
150void rv370_set_pcie_lanes(struct radeon_device *rdev, int lanes); 150 struct radeon_fence *fence);
151int r300_copy_dma(struct radeon_device *rdev,
152 uint64_t src_offset,
153 uint64_t dst_offset,
154 unsigned num_pages,
155 struct radeon_fence *fence);
156
157static struct radeon_asic r300_asic = { 151static struct radeon_asic r300_asic = {
158 .init = &r300_init, 152 .init = &r300_init,
159 .errata = &r300_errata, 153 .fini = &r300_fini,
160 .vram_info = &r300_vram_info, 154 .suspend = &r300_suspend,
155 .resume = &r300_resume,
156 .errata = NULL,
157 .vram_info = NULL,
161 .gpu_reset = &r300_gpu_reset, 158 .gpu_reset = &r300_gpu_reset,
162 .mc_init = &r300_mc_init, 159 .mc_init = NULL,
163 .mc_fini = &r300_mc_fini, 160 .mc_fini = NULL,
164 .wb_init = &r100_wb_init, 161 .wb_init = NULL,
165 .wb_fini = &r100_wb_fini, 162 .wb_fini = NULL,
166 .gart_init = &r100_pci_gart_init, 163 .gart_init = NULL,
167 .gart_fini = &r100_pci_gart_fini, 164 .gart_fini = NULL,
168 .gart_enable = &r100_pci_gart_enable, 165 .gart_enable = NULL,
169 .gart_disable = &r100_pci_gart_disable, 166 .gart_disable = NULL,
170 .gart_tlb_flush = &r100_pci_gart_tlb_flush, 167 .gart_tlb_flush = &r100_pci_gart_tlb_flush,
171 .gart_set_page = &r100_pci_gart_set_page, 168 .gart_set_page = &r100_pci_gart_set_page,
172 .cp_init = &r100_cp_init, 169 .cp_init = NULL,
173 .cp_fini = &r100_cp_fini, 170 .cp_fini = NULL,
174 .cp_disable = &r100_cp_disable, 171 .cp_disable = NULL,
175 .cp_commit = &r100_cp_commit, 172 .cp_commit = &r100_cp_commit,
176 .ring_start = &r300_ring_start, 173 .ring_start = &r300_ring_start,
177 .ring_test = &r100_ring_test, 174 .ring_test = &r100_ring_test,
178 .ring_ib_execute = &r100_ring_ib_execute, 175 .ring_ib_execute = &r100_ring_ib_execute,
179 .ib_test = &r100_ib_test, 176 .ib_test = NULL,
180 .irq_set = &r100_irq_set, 177 .irq_set = &r100_irq_set,
181 .irq_process = &r100_irq_process, 178 .irq_process = &r100_irq_process,
182 .get_vblank_counter = &r100_get_vblank_counter, 179 .get_vblank_counter = &r100_get_vblank_counter,