#ifdef CONFIG_PCI_NAMES printk(KERN_INFO PFX "%s\n", pd->pretty_name); #endif  
static int __devinit rivafb_probe(struct pci_dev *pd,			     	const struct pci_device_id *ent){	struct riva_par *default_par;	struct fb_info *info;	int ret;	NVTRACE_ENTER();	assert(pd != NULL);	info = framebuffer_alloc(sizeof(struct riva_par), &pd->dev);	if (!info) {		printk (KERN_ERR PFX "could not allocate memory\n");		ret = -ENOMEM;		goto err_ret;	}	default_par = (struct riva_par *) info->par;	default_par->pdev = pd;	info->pixmap.addr = kmalloc(8 * 1024, GFP_KERNEL);	if (info->pixmap.addr == NULL) {	    	ret = -ENOMEM;		goto err_framebuffer_release;	}	memset(info->pixmap.addr, 0, 8 * 1024);	ret = pci_enable_device(pd);	if (ret < 0) {		printk(KERN_ERR PFX "cannot enable PCI device\n");		goto err_free_pixmap;	}	ret = pci_request_regions(pd, "rivafb");	if (ret < 0) {		printk(KERN_ERR PFX "cannot request PCI regions\n");		goto err_disable_device;	}	default_par->riva.Architecture = riva_get_arch(pd);	default_par->Chipset = (pd->vendor << 16) | pd->device;	printk(KERN_INFO PFX "nVidia device/chipset %X\n",default_par->Chipset);	#ifdef CONFIG_PCI_NAMES	printk(KERN_INFO PFX "%s\n", pd->pretty_name);#endif	if(default_par->riva.Architecture == 0) {		printk(KERN_ERR PFX "unknown NV_ARCH\n");		ret=-ENODEV;		goto err_release_region;	}	if(default_par->riva.Architecture == NV_ARCH_10 ||	   default_par->riva.Architecture == NV_ARCH_20 ||	   default_par->riva.Architecture == NV_ARCH_30) {		sprintf(rivafb_fix.id, "NV%x", (pd->device & 0x0ff0) >> 4);	} else {		sprintf(rivafb_fix.id, "NV%x", default_par->riva.Architecture);	}	default_par->FlatPanel = flatpanel;	if (flatpanel == 1)		printk(KERN_INFO PFX "flatpanel support enabled\n");	default_par->forceCRTC = forceCRTC;		rivafb_fix.mmio_len = pci_resource_len(pd, 0);	rivafb_fix.smem_len = pci_resource_len(pd, 1);	{		/* enable IO and mem if not already done */		unsigned short cmd;		pci_read_config_word(pd, PCI_COMMAND, &cmd);		cmd |= (PCI_COMMAND_IO | PCI_COMMAND_MEMORY);		pci_write_config_word(pd, PCI_COMMAND, cmd);	}		rivafb_fix.mmio_start = pci_resource_start(pd, 0);	rivafb_fix.smem_start = pci_resource_start(pd, 1);	default_par->ctrl_base = ioremap(rivafb_fix.mmio_start,					 rivafb_fix.mmio_len);	if (!default_par->ctrl_base) {		printk(KERN_ERR PFX "cannot ioremap MMIO base\n");		ret = -EIO;		goto err_release_region;	}	switch (default_par->riva.Architecture) {	case NV_ARCH_03:		/* Riva128's PRAMIN is in the "framebuffer" space		 * Since these cards were never made with more than 8 megabytes		 * we can safely allocate this separately.		 */		default_par->riva.PRAMIN = ioremap(rivafb_fix.smem_start + 0x00C00000, 0x00008000);		if (!default_par->riva.PRAMIN) {			printk(KERN_ERR PFX "cannot ioremap PRAMIN region\n");			ret = -EIO;			goto err_iounmap_ctrl_base;		}		break;	case NV_ARCH_04:	case NV_ARCH_10:	case NV_ARCH_20:	case NV_ARCH_30:		default_par->riva.PCRTC0 =			(u32 __iomem *)(default_par->ctrl_base + 0x00600000);		default_par->riva.PRAMIN =			(u32 __iomem *)(default_par->ctrl_base + 0x00710000);		break;	}	riva_common_setup(default_par);	if (default_par->riva.Architecture == NV_ARCH_03) {		default_par->riva.PCRTC = default_par->riva.PCRTC0		                        = default_par->riva.PGRAPH;	}	rivafb_fix.smem_len = riva_get_memlen(default_par) * 1024;	default_par->dclk_max = riva_get_maxdclk(default_par) * 1000;	info->screen_base = ioremap(rivafb_fix.smem_start,				    rivafb_fix.smem_len);	if (!info->screen_base) {		printk(KERN_ERR PFX "cannot ioremap FB base\n");		ret = -EIO;		goto err_iounmap_pramin;	}#ifdef CONFIG_MTRR	if (!nomtrr) {		default_par->mtrr.vram = mtrr_add(rivafb_fix.smem_start,					   	  rivafb_fix.smem_len,					    	  MTRR_TYPE_WRCOMB, 1);		if (default_par->mtrr.vram < 0) {			printk(KERN_ERR PFX "unable to setup MTRR\n");		} else {			default_par->mtrr.vram_valid = 1;			/* let there be speed */			printk(KERN_INFO PFX "RIVA MTRR set to ON\n");		}	}#endif /* CONFIG_MTRR */	info->fbops = &riva_fb_ops;	info->fix = rivafb_fix;	riva_get_EDID(info, pd);	riva_get_edidinfo(info);	ret=riva_set_fbinfo(info);	if (ret < 0) {		printk(KERN_ERR PFX "error setting initial video mode\n");		goto err_iounmap_screen_base;	}	fb_destroy_modedb(info->monspecs.modedb);	info->monspecs.modedb = NULL;	ret = register_framebuffer(info);	if (ret < 0) {		printk(KERN_ERR PFX			"error registering riva framebuffer\n");		goto err_iounmap_screen_base;	}	pci_set_drvdata(pd, info);	printk(KERN_INFO PFX		"PCI nVidia %s framebuffer ver %s (%dMB @ 0x%lX)\n",		info->fix.id,		RIVAFB_VERSION,		info->fix.smem_len / (1024 * 1024),		info->fix.smem_start);#ifdef CONFIG_PMAC_BACKLIGHT	if (default_par->FlatPanel && _machine == _MACH_Pmac)	register_backlight_controller(&riva_backlight_controller,						default_par, "mnca");#endif	NVTRACE_LEAVE();	return 0;err_iounmap_screen_base:#ifdef CONFIG_FB_RIVA_I2C	riva_delete_i2c_busses((struct riva_par *) info->par);#endif	iounmap(info->screen_base);err_iounmap_pramin:	if (default_par->riva.Architecture == NV_ARCH_03) 		iounmap(default_par->riva.PRAMIN);err_iounmap_ctrl_base:	iounmap(default_par->ctrl_base);err_release_region:	pci_release_regions(pd);err_disable_device:	pci_disable_device(pd);err_free_pixmap:	kfree(info->pixmap.addr);err_framebuffer_release:	framebuffer_release(info);err_ret:	return ret;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/982245f01734e9d5a3ab98b2b2e9761ae7719094/fbdev.c/clean/drivers/video/riva/fbdev.c