if (rinfo->fb_base) memset_io(rinfo->fb_base, 0, rinfo->mapped_vram); else { printk (KERN_ERR "radeonfb (%s): cannot map FB\n", pci_name(rinfo->pdev)); 
if (rinfo->fb_base == NULL) { printk (KERN_ERR "radeonfb (%s): cannot map FB\n", pci_name(rinfo->pdev)); 
static int radeonfb_pci_register (struct pci_dev *pdev,				  const struct pci_device_id *ent){	struct fb_info *info;	struct radeonfb_info *rinfo;	int ret;	RTRACE("radeonfb_pci_register BEGIN\n");		/* Enable device in PCI config */	ret = pci_enable_device(pdev);	if (ret < 0) {		printk(KERN_ERR "radeonfb (%s): Cannot enable PCI device\n",		       pci_name(pdev));		goto err_out;	}	info = framebuffer_alloc(sizeof(struct radeonfb_info), &pdev->dev);	if (!info) {		printk (KERN_ERR "radeonfb (%s): could not allocate memory\n",			pci_name(pdev));		ret = -ENOMEM;		goto err_disable;	}	rinfo = info->par;	rinfo->info = info;		rinfo->pdev = pdev;		spin_lock_init(&rinfo->reg_lock);	init_timer(&rinfo->lvds_timer);	rinfo->lvds_timer.function = radeon_lvds_timer_func;	rinfo->lvds_timer.data = (unsigned long)rinfo;	strcpy(rinfo->name, "ATI Radeon XX ");	rinfo->name[11] = ent->device >> 8;	rinfo->name[12] = ent->device & 0xFF;	rinfo->family = ent->driver_data & CHIP_FAMILY_MASK;	rinfo->chipset = pdev->device;	rinfo->has_CRTC2 = (ent->driver_data & CHIP_HAS_CRTC2) != 0;	rinfo->is_mobility = (ent->driver_data & CHIP_IS_MOBILITY) != 0;	rinfo->is_IGP = (ent->driver_data & CHIP_IS_IGP) != 0;	/* Set base addrs */	rinfo->fb_base_phys = pci_resource_start (pdev, 0);	rinfo->mmio_base_phys = pci_resource_start (pdev, 2);	/* request the mem regions */	ret = pci_request_regions(pdev, "radeonfb");	if (ret < 0) {		printk( KERN_ERR "radeonfb (%s): cannot reserve PCI regions."			"  Someone already got them?\n", pci_name(rinfo->pdev));		goto err_release_fb;	}	/* map the regions */	rinfo->mmio_base = ioremap(rinfo->mmio_base_phys, RADEON_REGSIZE);	if (!rinfo->mmio_base) {		printk(KERN_ERR "radeonfb (%s): cannot map MMIO\n", pci_name(rinfo->pdev));		ret = -EIO;		goto err_release_pci;	}	rinfo->fb_local_base = INREG(MC_FB_LOCATION) << 16;	/*	 * Check for errata	 */	rinfo->errata = 0;	if (rinfo->family == CHIP_FAMILY_R300 &&	    (INREG(CONFIG_CNTL) & CFG_ATI_REV_ID_MASK)	    == CFG_ATI_REV_A11)		rinfo->errata |= CHIP_ERRATA_R300_CG;	if (rinfo->family == CHIP_FAMILY_RV200 ||	    rinfo->family == CHIP_FAMILY_RS200)		rinfo->errata |= CHIP_ERRATA_PLL_DUMMYREADS;	if (rinfo->family == CHIP_FAMILY_RV100 ||	    rinfo->family == CHIP_FAMILY_RS100 ||	    rinfo->family == CHIP_FAMILY_RS200)		rinfo->errata |= CHIP_ERRATA_PLL_DELAY;#ifdef CONFIG_PPC_OF	/* On PPC, we obtain the OF device-node pointer to the firmware	 * data for this chip	 */	rinfo->of_node = pci_device_to_OF_node(pdev);	if (rinfo->of_node == NULL)		printk(KERN_WARNING "radeonfb (%s): Cannot match card to OF node !\n",		       pci_name(rinfo->pdev));	/* On PPC, the firmware sets up a memory mapping that tends	 * to cause lockups when enabling the engine. We reconfigure	 * the card internal memory mappings properly	 */	fixup_memory_mappings(rinfo);#endif /* CONFIG_PPC_OF */	/* Get VRAM size and type */	radeon_identify_vram(rinfo);	rinfo->mapped_vram = min_t(unsigned long, MAX_MAPPED_VRAM, rinfo->video_ram);	do {		rinfo->fb_base = ioremap (rinfo->fb_base_phys,					  rinfo->mapped_vram);	} while (   rinfo->fb_base == 0 &&		  ((rinfo->mapped_vram /=2) >= MIN_MAPPED_VRAM) );	if (rinfo->fb_base)		memset_io(rinfo->fb_base, 0, rinfo->mapped_vram);	else {		printk (KERN_ERR "radeonfb (%s): cannot map FB\n", pci_name(rinfo->pdev));		ret = -EIO;		goto err_unmap_rom;	}	RTRACE("radeonfb (%s): mapped %ldk videoram\n", pci_name(rinfo->pdev),	       rinfo->mapped_vram/1024);	/*	 * Map the BIOS ROM if any and retreive PLL parameters from	 * the BIOS. We skip that on mobility chips as the real panel	 * values we need aren't in the ROM but in the BIOS image in	 * memory. This is definitely not the best meacnism though,	 * we really need the arch code to tell us which is the "primary"	 * video adapter to use the memory image (or better, the arch	 * should provide us a copy of the BIOS image to shield us from	 * archs who would store that elsewhere and/or could initialize	 * more than one adapter during boot).	 */	if (!rinfo->is_mobility)		radeon_map_ROM(rinfo, pdev);	/*	 * On x86, the primary display on laptop may have it's BIOS	 * ROM elsewhere, try to locate it at the legacy memory hole.	 * We probably need to make sure this is the primary display,	 * but that is difficult without some arch support.	 */#ifdef CONFIG_X86	if (rinfo->bios_seg == NULL)		radeon_find_mem_vbios(rinfo);#endif	/* If both above failed, try the BIOS ROM again for mobility	 * chips	 */	if (rinfo->bios_seg == NULL && rinfo->is_mobility)		radeon_map_ROM(rinfo, pdev);	/* Get informations about the board's PLL */	radeon_get_pllinfo(rinfo);#ifdef CONFIG_FB_RADEON_I2C	/* Register I2C bus */	radeon_create_i2c_busses(rinfo);#endif	/* set all the vital stuff */	radeon_set_fbinfo (rinfo);	/* Probe screen types */	radeon_probe_screens(rinfo, monitor_layout, ignore_edid);	/* Build mode list, check out panel native model */	radeon_check_modes(rinfo, mode_option);	/* Register some sysfs stuff (should be done better) */	if (rinfo->mon1_EDID)		sysfs_create_bin_file(&rinfo->pdev->dev.kobj, &edid1_attr);	if (rinfo->mon2_EDID)		sysfs_create_bin_file(&rinfo->pdev->dev.kobj, &edid2_attr);	/* save current mode regs before we switch into the new one	 * so we can restore this upon __exit	 */	radeon_save_state (rinfo, &rinfo->init_state);	memcpy(&rinfo->state, &rinfo->init_state, sizeof(struct radeon_regs));	/* Setup Power Management capabilities */	if (default_dynclk < -1) {		/* -2 is special: means  ON on mobility chips and do not		 * change on others		 */		radeonfb_pm_init(rinfo, rinfo->is_mobility ? 1 : -1);	} else		radeonfb_pm_init(rinfo, default_dynclk);	pci_set_drvdata(pdev, info);	/* Register with fbdev layer */	ret = register_framebuffer(info);	if (ret < 0) {		printk (KERN_ERR "radeonfb (%s): could not register framebuffer\n",			pci_name(rinfo->pdev));		goto err_unmap_fb;	}#ifdef CONFIG_MTRR	rinfo->mtrr_hdl = nomtrr ? -1 : mtrr_add(rinfo->fb_base_phys,						 rinfo->video_ram,						 MTRR_TYPE_WRCOMB, 1);#endif#ifdef CONFIG_PMAC_BACKLIGHT	if (rinfo->mon1_type == MT_LCD) {		register_backlight_controller(&radeon_backlight_controller,					      rinfo, "ati");		register_backlight_controller(&radeon_backlight_controller,					      rinfo, "mnca");	}#endif	printk ("radeonfb (%s): %s\n", pci_name(rinfo->pdev), rinfo->name);	if (rinfo->bios_seg)		radeon_unmap_ROM(rinfo, pdev);	RTRACE("radeonfb_pci_register END\n");	return 0;err_unmap_fb:	iounmap(rinfo->fb_base);err_unmap_rom:	kfree(rinfo->mon1_EDID);	kfree(rinfo->mon2_EDID);	if (rinfo->mon1_modedb)		fb_destroy_modedb(rinfo->mon1_modedb);	fb_dealloc_cmap(&info->cmap);#ifdef CONFIG_FB_RADEON_I2C	radeon_delete_i2c_busses(rinfo);#endif	if (rinfo->bios_seg)		radeon_unmap_ROM(rinfo, pdev);	iounmap(rinfo->mmio_base);err_release_pci:	pci_release_regions(pdev);err_release_fb:	framebuffer_release(info);err_disable:	pci_disable_device(pdev);err_out:	return ret;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/8d5f7b4353dae4c7ee342c61303372fd996ca161/radeon_base.c/clean/drivers/video/aty/radeon_base.c