1771fe6b9SJerome Glisse /* 2771fe6b9SJerome Glisse * Copyright 2008 Advanced Micro Devices, Inc. 3771fe6b9SJerome Glisse * Copyright 2008 Red Hat Inc. 4771fe6b9SJerome Glisse * Copyright 2009 Jerome Glisse. 5771fe6b9SJerome Glisse * 6771fe6b9SJerome Glisse * Permission is hereby granted, free of charge, to any person obtaining a 7771fe6b9SJerome Glisse * copy of this software and associated documentation files (the "Software"), 8771fe6b9SJerome Glisse * to deal in the Software without restriction, including without limitation 9771fe6b9SJerome Glisse * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10771fe6b9SJerome Glisse * and/or sell copies of the Software, and to permit persons to whom the 11771fe6b9SJerome Glisse * Software is furnished to do so, subject to the following conditions: 12771fe6b9SJerome Glisse * 13771fe6b9SJerome Glisse * The above copyright notice and this permission notice shall be included in 14771fe6b9SJerome Glisse * all copies or substantial portions of the Software. 15771fe6b9SJerome Glisse * 16771fe6b9SJerome Glisse * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17771fe6b9SJerome Glisse * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18771fe6b9SJerome Glisse * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19771fe6b9SJerome Glisse * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 20771fe6b9SJerome Glisse * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21771fe6b9SJerome Glisse * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22771fe6b9SJerome Glisse * OTHER DEALINGS IN THE SOFTWARE. 23771fe6b9SJerome Glisse * 24771fe6b9SJerome Glisse * Authors: Dave Airlie 25771fe6b9SJerome Glisse * Alex Deucher 26771fe6b9SJerome Glisse * Jerome Glisse 27771fe6b9SJerome Glisse */ 28771fe6b9SJerome Glisse #include <linux/seq_file.h> 29771fe6b9SJerome Glisse #include "drmP.h" 30771fe6b9SJerome Glisse #include "radeon_reg.h" 31771fe6b9SJerome Glisse #include "radeon.h" 329f022ddfSJerome Glisse #include "atom.h" 33905b6822SJerome Glisse #include "r420d.h" 34771fe6b9SJerome Glisse 35771fe6b9SJerome Glisse int r420_mc_init(struct radeon_device *rdev) 36771fe6b9SJerome Glisse { 37771fe6b9SJerome Glisse int r; 38771fe6b9SJerome Glisse 39771fe6b9SJerome Glisse /* Setup GPU memory space */ 40771fe6b9SJerome Glisse rdev->mc.vram_location = 0xFFFFFFFFUL; 41771fe6b9SJerome Glisse rdev->mc.gtt_location = 0xFFFFFFFFUL; 42771fe6b9SJerome Glisse if (rdev->flags & RADEON_IS_AGP) { 43771fe6b9SJerome Glisse r = radeon_agp_init(rdev); 44771fe6b9SJerome Glisse if (r) { 45771fe6b9SJerome Glisse printk(KERN_WARNING "[drm] Disabling AGP\n"); 46771fe6b9SJerome Glisse rdev->flags &= ~RADEON_IS_AGP; 47771fe6b9SJerome Glisse rdev->mc.gtt_size = radeon_gart_size * 1024 * 1024; 48771fe6b9SJerome Glisse } else { 49771fe6b9SJerome Glisse rdev->mc.gtt_location = rdev->mc.agp_base; 50771fe6b9SJerome Glisse } 51771fe6b9SJerome Glisse } 52771fe6b9SJerome Glisse r = radeon_mc_setup(rdev); 53771fe6b9SJerome Glisse if (r) { 54771fe6b9SJerome Glisse return r; 55771fe6b9SJerome Glisse } 56771fe6b9SJerome Glisse return 0; 57771fe6b9SJerome Glisse } 58771fe6b9SJerome Glisse 59771fe6b9SJerome Glisse void r420_pipes_init(struct radeon_device *rdev) 60771fe6b9SJerome Glisse { 61771fe6b9SJerome Glisse unsigned tmp; 62771fe6b9SJerome Glisse unsigned gb_pipe_select; 63771fe6b9SJerome Glisse unsigned num_pipes; 64771fe6b9SJerome Glisse 65771fe6b9SJerome Glisse /* GA_ENHANCE workaround TCL deadlock issue */ 66771fe6b9SJerome Glisse WREG32(0x4274, (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3)); 6718a4cd2eSDave Airlie /* add idle wait as per freedesktop.org bug 24041 */ 6818a4cd2eSDave Airlie if (r100_gui_wait_for_idle(rdev)) { 6918a4cd2eSDave Airlie printk(KERN_WARNING "Failed to wait GUI idle while " 7018a4cd2eSDave Airlie "programming pipes. Bad things might happen.\n"); 7118a4cd2eSDave Airlie } 72771fe6b9SJerome Glisse /* get max number of pipes */ 73771fe6b9SJerome Glisse gb_pipe_select = RREG32(0x402C); 74771fe6b9SJerome Glisse num_pipes = ((gb_pipe_select >> 12) & 3) + 1; 75771fe6b9SJerome Glisse rdev->num_gb_pipes = num_pipes; 76771fe6b9SJerome Glisse tmp = 0; 77771fe6b9SJerome Glisse switch (num_pipes) { 78771fe6b9SJerome Glisse default: 79771fe6b9SJerome Glisse /* force to 1 pipe */ 80771fe6b9SJerome Glisse num_pipes = 1; 81771fe6b9SJerome Glisse case 1: 82771fe6b9SJerome Glisse tmp = (0 << 1); 83771fe6b9SJerome Glisse break; 84771fe6b9SJerome Glisse case 2: 85771fe6b9SJerome Glisse tmp = (3 << 1); 86771fe6b9SJerome Glisse break; 87771fe6b9SJerome Glisse case 3: 88771fe6b9SJerome Glisse tmp = (6 << 1); 89771fe6b9SJerome Glisse break; 90771fe6b9SJerome Glisse case 4: 91771fe6b9SJerome Glisse tmp = (7 << 1); 92771fe6b9SJerome Glisse break; 93771fe6b9SJerome Glisse } 94771fe6b9SJerome Glisse WREG32(0x42C8, (1 << num_pipes) - 1); 95771fe6b9SJerome Glisse /* Sub pixel 1/12 so we can have 4K rendering according to doc */ 96771fe6b9SJerome Glisse tmp |= (1 << 4) | (1 << 0); 97771fe6b9SJerome Glisse WREG32(0x4018, tmp); 98771fe6b9SJerome Glisse if (r100_gui_wait_for_idle(rdev)) { 99771fe6b9SJerome Glisse printk(KERN_WARNING "Failed to wait GUI idle while " 100771fe6b9SJerome Glisse "programming pipes. Bad things might happen.\n"); 101771fe6b9SJerome Glisse } 102771fe6b9SJerome Glisse 103771fe6b9SJerome Glisse tmp = RREG32(0x170C); 104771fe6b9SJerome Glisse WREG32(0x170C, tmp | (1 << 31)); 105771fe6b9SJerome Glisse 106771fe6b9SJerome Glisse WREG32(R300_RB2D_DSTCACHE_MODE, 107771fe6b9SJerome Glisse RREG32(R300_RB2D_DSTCACHE_MODE) | 108771fe6b9SJerome Glisse R300_DC_AUTOFLUSH_ENABLE | 109771fe6b9SJerome Glisse R300_DC_DC_DISABLE_IGNORE_PE); 110771fe6b9SJerome Glisse 111771fe6b9SJerome Glisse if (r100_gui_wait_for_idle(rdev)) { 112771fe6b9SJerome Glisse printk(KERN_WARNING "Failed to wait GUI idle while " 113771fe6b9SJerome Glisse "programming pipes. Bad things might happen.\n"); 114771fe6b9SJerome Glisse } 115f779b3e5SAlex Deucher 116f779b3e5SAlex Deucher if (rdev->family == CHIP_RV530) { 117f779b3e5SAlex Deucher tmp = RREG32(RV530_GB_PIPE_SELECT2); 118f779b3e5SAlex Deucher if ((tmp & 3) == 3) 119f779b3e5SAlex Deucher rdev->num_z_pipes = 2; 120f779b3e5SAlex Deucher else 121f779b3e5SAlex Deucher rdev->num_z_pipes = 1; 122f779b3e5SAlex Deucher } else 123f779b3e5SAlex Deucher rdev->num_z_pipes = 1; 124f779b3e5SAlex Deucher 125f779b3e5SAlex Deucher DRM_INFO("radeon: %d quad pipes, %d z pipes initialized.\n", 126f779b3e5SAlex Deucher rdev->num_gb_pipes, rdev->num_z_pipes); 127771fe6b9SJerome Glisse } 128771fe6b9SJerome Glisse 1299f022ddfSJerome Glisse u32 r420_mc_rreg(struct radeon_device *rdev, u32 reg) 130771fe6b9SJerome Glisse { 1319f022ddfSJerome Glisse u32 r; 1329f022ddfSJerome Glisse 1339f022ddfSJerome Glisse WREG32(R_0001F8_MC_IND_INDEX, S_0001F8_MC_IND_ADDR(reg)); 1349f022ddfSJerome Glisse r = RREG32(R_0001FC_MC_IND_DATA); 1359f022ddfSJerome Glisse return r; 1369f022ddfSJerome Glisse } 1379f022ddfSJerome Glisse 1389f022ddfSJerome Glisse void r420_mc_wreg(struct radeon_device *rdev, u32 reg, u32 v) 1399f022ddfSJerome Glisse { 1409f022ddfSJerome Glisse WREG32(R_0001F8_MC_IND_INDEX, S_0001F8_MC_IND_ADDR(reg) | 1419f022ddfSJerome Glisse S_0001F8_MC_IND_WR_EN(1)); 1429f022ddfSJerome Glisse WREG32(R_0001FC_MC_IND_DATA, v); 1439f022ddfSJerome Glisse } 1449f022ddfSJerome Glisse 1459f022ddfSJerome Glisse static void r420_debugfs(struct radeon_device *rdev) 1469f022ddfSJerome Glisse { 1479f022ddfSJerome Glisse if (r100_debugfs_rbbm_init(rdev)) { 1489f022ddfSJerome Glisse DRM_ERROR("Failed to register debugfs file for RBBM !\n"); 1499f022ddfSJerome Glisse } 1509f022ddfSJerome Glisse if (r420_debugfs_pipes_info_init(rdev)) { 1519f022ddfSJerome Glisse DRM_ERROR("Failed to register debugfs file for pipes !\n"); 1529f022ddfSJerome Glisse } 1539f022ddfSJerome Glisse } 1549f022ddfSJerome Glisse 1559f022ddfSJerome Glisse static void r420_clock_resume(struct radeon_device *rdev) 1569f022ddfSJerome Glisse { 1579f022ddfSJerome Glisse u32 sclk_cntl; 158ca6ffc64SJerome Glisse 159ca6ffc64SJerome Glisse if (radeon_dynclks != -1 && radeon_dynclks) 160ca6ffc64SJerome Glisse radeon_atom_set_clock_gating(rdev, 1); 1619f022ddfSJerome Glisse sclk_cntl = RREG32_PLL(R_00000D_SCLK_CNTL); 1629f022ddfSJerome Glisse sclk_cntl |= S_00000D_FORCE_CP(1) | S_00000D_FORCE_VIP(1); 1639f022ddfSJerome Glisse if (rdev->family == CHIP_R420) 1649f022ddfSJerome Glisse sclk_cntl |= S_00000D_FORCE_PX(1) | S_00000D_FORCE_TX(1); 1659f022ddfSJerome Glisse WREG32_PLL(R_00000D_SCLK_CNTL, sclk_cntl); 1669f022ddfSJerome Glisse } 1679f022ddfSJerome Glisse 168fc30b8efSDave Airlie static int r420_startup(struct radeon_device *rdev) 1699f022ddfSJerome Glisse { 1709f022ddfSJerome Glisse int r; 1719f022ddfSJerome Glisse 172*92cde00cSAlex Deucher /* set common regs */ 173*92cde00cSAlex Deucher r100_set_common_regs(rdev); 174*92cde00cSAlex Deucher /* program mc */ 1759f022ddfSJerome Glisse r300_mc_program(rdev); 176ca6ffc64SJerome Glisse /* Resume clock */ 177ca6ffc64SJerome Glisse r420_clock_resume(rdev); 1789f022ddfSJerome Glisse /* Initialize GART (initialize after TTM so we can allocate 1799f022ddfSJerome Glisse * memory through TTM but finalize after TTM) */ 1804aac0473SJerome Glisse if (rdev->flags & RADEON_IS_PCIE) { 1814aac0473SJerome Glisse r = rv370_pcie_gart_enable(rdev); 1824aac0473SJerome Glisse if (r) 1834aac0473SJerome Glisse return r; 1844aac0473SJerome Glisse } 1854aac0473SJerome Glisse if (rdev->flags & RADEON_IS_PCI) { 1864aac0473SJerome Glisse r = r100_pci_gart_enable(rdev); 1874aac0473SJerome Glisse if (r) 1889f022ddfSJerome Glisse return r; 1899f022ddfSJerome Glisse } 190771fe6b9SJerome Glisse r420_pipes_init(rdev); 1919f022ddfSJerome Glisse /* Enable IRQ */ 1929f022ddfSJerome Glisse r100_irq_set(rdev); 1939f022ddfSJerome Glisse /* 1M ring buffer */ 1949f022ddfSJerome Glisse r = r100_cp_init(rdev, 1024 * 1024); 1959f022ddfSJerome Glisse if (r) { 1969f022ddfSJerome Glisse dev_err(rdev->dev, "failled initializing CP (%d).\n", r); 1979f022ddfSJerome Glisse return r; 198771fe6b9SJerome Glisse } 1999f022ddfSJerome Glisse r = r100_wb_init(rdev); 2009f022ddfSJerome Glisse if (r) { 2019f022ddfSJerome Glisse dev_err(rdev->dev, "failled initializing WB (%d).\n", r); 2029f022ddfSJerome Glisse } 2039f022ddfSJerome Glisse r = r100_ib_init(rdev); 2049f022ddfSJerome Glisse if (r) { 2059f022ddfSJerome Glisse dev_err(rdev->dev, "failled initializing IB (%d).\n", r); 2069f022ddfSJerome Glisse return r; 2079f022ddfSJerome Glisse } 2089f022ddfSJerome Glisse return 0; 209771fe6b9SJerome Glisse } 210771fe6b9SJerome Glisse 211fc30b8efSDave Airlie int r420_resume(struct radeon_device *rdev) 212fc30b8efSDave Airlie { 213fc30b8efSDave Airlie /* Make sur GART are not working */ 214fc30b8efSDave Airlie if (rdev->flags & RADEON_IS_PCIE) 215fc30b8efSDave Airlie rv370_pcie_gart_disable(rdev); 216fc30b8efSDave Airlie if (rdev->flags & RADEON_IS_PCI) 217fc30b8efSDave Airlie r100_pci_gart_disable(rdev); 218fc30b8efSDave Airlie /* Resume clock before doing reset */ 219fc30b8efSDave Airlie r420_clock_resume(rdev); 220fc30b8efSDave Airlie /* Reset gpu before posting otherwise ATOM will enter infinite loop */ 221fc30b8efSDave Airlie if (radeon_gpu_reset(rdev)) { 222fc30b8efSDave Airlie dev_warn(rdev->dev, "GPU reset failed ! (0xE40=0x%08X, 0x7C0=0x%08X)\n", 223fc30b8efSDave Airlie RREG32(R_000E40_RBBM_STATUS), 224fc30b8efSDave Airlie RREG32(R_0007C0_CP_STAT)); 225fc30b8efSDave Airlie } 226fc30b8efSDave Airlie /* check if cards are posted or not */ 227fc30b8efSDave Airlie if (rdev->is_atom_bios) { 228fc30b8efSDave Airlie atom_asic_init(rdev->mode_info.atom_context); 229fc30b8efSDave Airlie } else { 230fc30b8efSDave Airlie radeon_combios_asic_init(rdev->ddev); 231fc30b8efSDave Airlie } 232fc30b8efSDave Airlie /* Resume clock after posting */ 233fc30b8efSDave Airlie r420_clock_resume(rdev); 234fc30b8efSDave Airlie 235fc30b8efSDave Airlie return r420_startup(rdev); 236fc30b8efSDave Airlie } 237fc30b8efSDave Airlie 2389f022ddfSJerome Glisse int r420_suspend(struct radeon_device *rdev) 239771fe6b9SJerome Glisse { 2409f022ddfSJerome Glisse r100_cp_disable(rdev); 2419f022ddfSJerome Glisse r100_wb_disable(rdev); 2429f022ddfSJerome Glisse r100_irq_disable(rdev); 2434aac0473SJerome Glisse if (rdev->flags & RADEON_IS_PCIE) 2444aac0473SJerome Glisse rv370_pcie_gart_disable(rdev); 2454aac0473SJerome Glisse if (rdev->flags & RADEON_IS_PCI) 2464aac0473SJerome Glisse r100_pci_gart_disable(rdev); 2479f022ddfSJerome Glisse return 0; 248771fe6b9SJerome Glisse } 249771fe6b9SJerome Glisse 2509f022ddfSJerome Glisse void r420_fini(struct radeon_device *rdev) 2519f022ddfSJerome Glisse { 2529f022ddfSJerome Glisse r100_cp_fini(rdev); 2539f022ddfSJerome Glisse r100_wb_fini(rdev); 2549f022ddfSJerome Glisse r100_ib_fini(rdev); 2559f022ddfSJerome Glisse radeon_gem_fini(rdev); 2564aac0473SJerome Glisse if (rdev->flags & RADEON_IS_PCIE) 2574aac0473SJerome Glisse rv370_pcie_gart_fini(rdev); 2584aac0473SJerome Glisse if (rdev->flags & RADEON_IS_PCI) 2594aac0473SJerome Glisse r100_pci_gart_fini(rdev); 2609f022ddfSJerome Glisse radeon_agp_fini(rdev); 2619f022ddfSJerome Glisse radeon_irq_kms_fini(rdev); 2629f022ddfSJerome Glisse radeon_fence_driver_fini(rdev); 2634c788679SJerome Glisse radeon_bo_fini(rdev); 2649f022ddfSJerome Glisse if (rdev->is_atom_bios) { 2659f022ddfSJerome Glisse radeon_atombios_fini(rdev); 2669f022ddfSJerome Glisse } else { 2679f022ddfSJerome Glisse radeon_combios_fini(rdev); 2689f022ddfSJerome Glisse } 2699f022ddfSJerome Glisse kfree(rdev->bios); 2709f022ddfSJerome Glisse rdev->bios = NULL; 2719f022ddfSJerome Glisse } 2729f022ddfSJerome Glisse 2739f022ddfSJerome Glisse int r420_init(struct radeon_device *rdev) 2749f022ddfSJerome Glisse { 2759f022ddfSJerome Glisse int r; 2769f022ddfSJerome Glisse 2779f022ddfSJerome Glisse /* Initialize scratch registers */ 2789f022ddfSJerome Glisse radeon_scratch_init(rdev); 2799f022ddfSJerome Glisse /* Initialize surface registers */ 2809f022ddfSJerome Glisse radeon_surface_init(rdev); 2819f022ddfSJerome Glisse /* TODO: disable VGA need to use VGA request */ 2829f022ddfSJerome Glisse /* BIOS*/ 2839f022ddfSJerome Glisse if (!radeon_get_bios(rdev)) { 2849f022ddfSJerome Glisse if (ASIC_IS_AVIVO(rdev)) 2859f022ddfSJerome Glisse return -EINVAL; 2869f022ddfSJerome Glisse } 2879f022ddfSJerome Glisse if (rdev->is_atom_bios) { 2889f022ddfSJerome Glisse r = radeon_atombios_init(rdev); 2899f022ddfSJerome Glisse if (r) { 2909f022ddfSJerome Glisse return r; 2919f022ddfSJerome Glisse } 2929f022ddfSJerome Glisse } else { 2939f022ddfSJerome Glisse r = radeon_combios_init(rdev); 2949f022ddfSJerome Glisse if (r) { 2959f022ddfSJerome Glisse return r; 2969f022ddfSJerome Glisse } 2979f022ddfSJerome Glisse } 2989f022ddfSJerome Glisse /* Reset gpu before posting otherwise ATOM will enter infinite loop */ 2999f022ddfSJerome Glisse if (radeon_gpu_reset(rdev)) { 3009f022ddfSJerome Glisse dev_warn(rdev->dev, 3019f022ddfSJerome Glisse "GPU reset failed ! (0xE40=0x%08X, 0x7C0=0x%08X)\n", 3029f022ddfSJerome Glisse RREG32(R_000E40_RBBM_STATUS), 3039f022ddfSJerome Glisse RREG32(R_0007C0_CP_STAT)); 3049f022ddfSJerome Glisse } 3059f022ddfSJerome Glisse /* check if cards are posted or not */ 30672542d77SDave Airlie if (radeon_boot_test_post_card(rdev) == false) 30772542d77SDave Airlie return -EINVAL; 30872542d77SDave Airlie 3099f022ddfSJerome Glisse /* Initialize clocks */ 3109f022ddfSJerome Glisse radeon_get_clock_info(rdev->ddev); 3117433874eSRafał Miłecki /* Initialize power management */ 3127433874eSRafał Miłecki radeon_pm_init(rdev); 3139f022ddfSJerome Glisse /* Get vram informations */ 3149f022ddfSJerome Glisse r300_vram_info(rdev); 3159f022ddfSJerome Glisse /* Initialize memory controller (also test AGP) */ 3169f022ddfSJerome Glisse r = r420_mc_init(rdev); 3179f022ddfSJerome Glisse if (r) { 3189f022ddfSJerome Glisse return r; 3199f022ddfSJerome Glisse } 3209f022ddfSJerome Glisse r420_debugfs(rdev); 3219f022ddfSJerome Glisse /* Fence driver */ 3229f022ddfSJerome Glisse r = radeon_fence_driver_init(rdev); 3239f022ddfSJerome Glisse if (r) { 3249f022ddfSJerome Glisse return r; 3259f022ddfSJerome Glisse } 3269f022ddfSJerome Glisse r = radeon_irq_kms_init(rdev); 3279f022ddfSJerome Glisse if (r) { 3289f022ddfSJerome Glisse return r; 3299f022ddfSJerome Glisse } 3309f022ddfSJerome Glisse /* Memory manager */ 3314c788679SJerome Glisse r = radeon_bo_init(rdev); 3329f022ddfSJerome Glisse if (r) { 3339f022ddfSJerome Glisse return r; 3349f022ddfSJerome Glisse } 33517e15b0cSDave Airlie if (rdev->family == CHIP_R420) 33617e15b0cSDave Airlie r100_enable_bm(rdev); 33717e15b0cSDave Airlie 3384aac0473SJerome Glisse if (rdev->flags & RADEON_IS_PCIE) { 3394aac0473SJerome Glisse r = rv370_pcie_gart_init(rdev); 3404aac0473SJerome Glisse if (r) 3414aac0473SJerome Glisse return r; 3424aac0473SJerome Glisse } 3434aac0473SJerome Glisse if (rdev->flags & RADEON_IS_PCI) { 3444aac0473SJerome Glisse r = r100_pci_gart_init(rdev); 3454aac0473SJerome Glisse if (r) 3464aac0473SJerome Glisse return r; 3474aac0473SJerome Glisse } 3489f022ddfSJerome Glisse r300_set_reg_safe(rdev); 349733289c2SJerome Glisse rdev->accel_working = true; 350fc30b8efSDave Airlie r = r420_startup(rdev); 3519f022ddfSJerome Glisse if (r) { 3529f022ddfSJerome Glisse /* Somethings want wront with the accel init stop accel */ 3539f022ddfSJerome Glisse dev_err(rdev->dev, "Disabling GPU acceleration\n"); 3549f022ddfSJerome Glisse r420_suspend(rdev); 3559f022ddfSJerome Glisse r100_cp_fini(rdev); 3569f022ddfSJerome Glisse r100_wb_fini(rdev); 3579f022ddfSJerome Glisse r100_ib_fini(rdev); 3584aac0473SJerome Glisse if (rdev->flags & RADEON_IS_PCIE) 3594aac0473SJerome Glisse rv370_pcie_gart_fini(rdev); 3604aac0473SJerome Glisse if (rdev->flags & RADEON_IS_PCI) 3614aac0473SJerome Glisse r100_pci_gart_fini(rdev); 3629f022ddfSJerome Glisse radeon_agp_fini(rdev); 3639f022ddfSJerome Glisse radeon_irq_kms_fini(rdev); 364733289c2SJerome Glisse rdev->accel_working = false; 3659f022ddfSJerome Glisse } 3669f022ddfSJerome Glisse return 0; 3679f022ddfSJerome Glisse } 368771fe6b9SJerome Glisse 369771fe6b9SJerome Glisse /* 370771fe6b9SJerome Glisse * Debugfs info 371771fe6b9SJerome Glisse */ 372771fe6b9SJerome Glisse #if defined(CONFIG_DEBUG_FS) 373771fe6b9SJerome Glisse static int r420_debugfs_pipes_info(struct seq_file *m, void *data) 374771fe6b9SJerome Glisse { 375771fe6b9SJerome Glisse struct drm_info_node *node = (struct drm_info_node *) m->private; 376771fe6b9SJerome Glisse struct drm_device *dev = node->minor->dev; 377771fe6b9SJerome Glisse struct radeon_device *rdev = dev->dev_private; 378771fe6b9SJerome Glisse uint32_t tmp; 379771fe6b9SJerome Glisse 380771fe6b9SJerome Glisse tmp = RREG32(R400_GB_PIPE_SELECT); 381771fe6b9SJerome Glisse seq_printf(m, "GB_PIPE_SELECT 0x%08x\n", tmp); 382771fe6b9SJerome Glisse tmp = RREG32(R300_GB_TILE_CONFIG); 383771fe6b9SJerome Glisse seq_printf(m, "GB_TILE_CONFIG 0x%08x\n", tmp); 384771fe6b9SJerome Glisse tmp = RREG32(R300_DST_PIPE_CONFIG); 385771fe6b9SJerome Glisse seq_printf(m, "DST_PIPE_CONFIG 0x%08x\n", tmp); 386771fe6b9SJerome Glisse return 0; 387771fe6b9SJerome Glisse } 388771fe6b9SJerome Glisse 389771fe6b9SJerome Glisse static struct drm_info_list r420_pipes_info_list[] = { 390771fe6b9SJerome Glisse {"r420_pipes_info", r420_debugfs_pipes_info, 0, NULL}, 391771fe6b9SJerome Glisse }; 392771fe6b9SJerome Glisse #endif 393771fe6b9SJerome Glisse 394771fe6b9SJerome Glisse int r420_debugfs_pipes_info_init(struct radeon_device *rdev) 395771fe6b9SJerome Glisse { 396771fe6b9SJerome Glisse #if defined(CONFIG_DEBUG_FS) 397771fe6b9SJerome Glisse return radeon_debugfs_add_files(rdev, r420_pipes_info_list, 1); 398771fe6b9SJerome Glisse #else 399771fe6b9SJerome Glisse return 0; 400771fe6b9SJerome Glisse #endif 401771fe6b9SJerome Glisse } 402