FreeBSD/sys/dev/drm2/radeon/r600.c
/* Plan is to move initialization in that function and use
 * helper function so that radeon_device_init pretty much
 * do nothing more than calling asic specific function. This
 * should also allow to remove a bunch of callback function
 * like vram_info.
 */
Plan is to move initialization in that function and use
helper function so that radeon_device_init pretty much
do nothing more than calling asic specific function. This
should also allow to remove a bunch of callback function
like vram_info.
Plan is to move initialization in that function and use helper function so that radeon_device_init pretty much do nothing more than calling asic specific function . This should also allow to remove a bunch of callback function like vram_info .
int r600_init(struct radeon_device *rdev)
{
	int r;
	if (r600_debugfs_mc_info_init(rdev)) {
		DRM_ERROR("Failed to register debugfs file for mc !\n");
	}
	if (!radeon_get_bios(rdev)) {
		if (ASIC_IS_AVIVO(rdev))
			return -EINVAL;
	}
	if (!rdev->is_atom_bios) {
		dev_err(rdev->dev, "Expecting atombios for R600 GPU\n");
		return -EINVAL;
	}
	r = radeon_atombios_init(rdev);
	if (r)
		return r;
	if (!radeon_card_posted(rdev)) {
		if (!rdev->bios) {
			dev_err(rdev->dev, "Card not posted and no BIOS - ignoring\n");
			return -EINVAL;
		}
		DRM_INFO("GPU not posted. posting now...\n");
		atom_asic_init(rdev->mode_info.atom_context);
	}
	r600_scratch_init(rdev);
	radeon_surface_init(rdev);
	radeon_get_clock_info(rdev->ddev);
	r = radeon_fence_driver_init(rdev);
	if (r)
		return r;
	if (rdev->flags & RADEON_IS_AGP) {
		r = radeon_agp_init(rdev);
		if (r)
			radeon_agp_disable(rdev);
	}
	r = r600_mc_init(rdev);
	if (r)
		return r;
	r = radeon_bo_init(rdev);
	if (r)
		return r;
	r = radeon_irq_kms_init(rdev);
	if (r)
		return r;
	rdev->ring[RADEON_RING_TYPE_GFX_INDEX].ring_obj = NULL;
	r600_ring_init(rdev, &rdev->ring[RADEON_RING_TYPE_GFX_INDEX], 1024 * 1024);
	rdev->ring[R600_RING_TYPE_DMA_INDEX].ring_obj = NULL;
	r600_ring_init(rdev, &rdev->ring[R600_RING_TYPE_DMA_INDEX], 64 * 1024);
	rdev->ih.ring_obj = NULL;
	r600_ih_ring_init(rdev, 64 * 1024);
	r = r600_pcie_gart_init(rdev);
	if (r)
		return r;
	rdev->accel_working = true;
	r = r600_startup(rdev);
	if (r) {
		dev_err(rdev->dev, "disabling GPU acceleration\n");
		r600_cp_fini(rdev);
		r600_dma_fini(rdev);
		r600_irq_fini(rdev);
		radeon_wb_fini(rdev);
		radeon_ib_pool_fini(rdev);
		radeon_irq_kms_fini(rdev);
		r600_pcie_gart_fini(rdev);
		rdev->accel_working = false;
	}
	if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) {
		DRM_ERROR("radeon: ucode required for R600+.\n");
		return -EINVAL;
	}
	return 0;
}
int r600_init ( struct radeon_device * rdev ) { int r ; if ( r600_debugfs_mc_info_init ( rdev ) ) { DRM_ERROR ( " \n " ) ; } if ( ! radeon_get_bios ( rdev ) ) { if ( ASIC_IS_AVIVO ( rdev ) ) return - EINVAL ; } if ( ! rdev -> is_atom_bios ) { dev_err ( rdev -> dev , " \n " ) ; return - EINVAL ; } r = radeon_atombios_init ( rdev ) ; if ( r ) return r ; if ( ! radeon_card_posted ( rdev ) ) { if ( ! rdev -> bios ) { dev_err ( rdev -> dev , " \n " ) ; return - EINVAL ; } DRM_INFO ( " \n " ) ; atom_asic_init ( rdev -> mode_info . atom_context ) ; } r600_scratch_init ( rdev ) ; radeon_surface_init ( rdev ) ; radeon_get_clock_info ( rdev -> ddev ) ; r = radeon_fence_driver_init ( rdev ) ; if ( r ) return r ; if ( rdev -> flags & RADEON_IS_AGP ) { r = radeon_agp_init ( rdev ) ; if ( r ) radeon_agp_disable ( rdev ) ; } r = r600_mc_init ( rdev ) ; if ( r ) return r ; r = radeon_bo_init ( rdev ) ; if ( r ) return r ; r = radeon_irq_kms_init ( rdev ) ; if ( r ) return r ; rdev -> ring [ RADEON_RING_TYPE_GFX_INDEX ] . ring_obj = NULL ; r600_ring_init ( rdev , & rdev -> ring [ RADEON_RING_TYPE_GFX_INDEX ] , 1024 * 1024 ) ; rdev -> ring [ R600_RING_TYPE_DMA_INDEX ] . ring_obj = NULL ; r600_ring_init ( rdev , & rdev -> ring [ R600_RING_TYPE_DMA_INDEX ] , 64 * 1024 ) ; rdev -> ih . ring_obj = NULL ; r600_ih_ring_init ( rdev , 64 * 1024 ) ; r = r600_pcie_gart_init ( rdev ) ; if ( r ) return r ; rdev -> accel_working = true ; r = r600_startup ( rdev ) ; if ( r ) { dev_err ( rdev -> dev , " \n " ) ; r600_cp_fini ( rdev ) ; r600_dma_fini ( rdev ) ; r600_irq_fini ( rdev ) ; radeon_wb_fini ( rdev ) ; radeon_ib_pool_fini ( rdev ) ; radeon_irq_kms_fini ( rdev ) ; r600_pcie_gart_fini ( rdev ) ; rdev -> accel_working = false ; } if ( ! rdev -> me_fw || ! rdev -> pfp_fw || ! rdev -> rlc_fw ) { DRM_ERROR ( " \n " ) ; return - EINVAL ; } return 0 ; }
Plan is to move initialization in that function and use
 helper function so that radeon_device_init pretty much
 do nothing more than calling asic specific function.
Plan is to move initialization in that function and use helper function so that radeon_device_init pretty much do nothing more than calling asic specific function .
/* Read BIOS */ /* Must be an ATOMBIOS */ /* Post card if necessary */ /* Initialize scratch registers */ /* Initialize surface registers */ /* Initialize clocks */ /* Fence driver */ /* Memory manager */ /* Don't start up if the ucode is missing. */