 if(default_par->mem_control == 0 && default_par->boot_address == 0x31 && default_par->mem_config == 0x259fffff && pdev->subsystem_vendor == 0x1048 && pdev->subsystem_device == 0x0a31) { DPRINTK("subsystem_vendor: %04x, subsystem_device: %04x\n", pdev->subsystem_vendor, pdev->subsystem_device); DPRINTK("We have not been initialized by VGA BIOS " "and are running on an Elsa Winner 2000 Office\n"); DPRINTK("Initializing card timings manually...\n"); default_par->mem_control=0; default_par->boot_address=0x20; default_par->mem_config=0xe6002021; default_par->memclock=100000; } 
static int __devinit pm2fb_probe(struct pci_dev *pdev,				 const struct pci_device_id *id){	struct pm2fb_par *default_par;	struct fb_info *info;	int size, err;	int err_retval = -ENXIO;	err = pci_enable_device(pdev);	if ( err ) {		printk(KERN_WARNING "pm2fb: Can't enable pdev: %d\n", err);		return err;	}	size = sizeof(struct pm2fb_par) + 256 * sizeof(u32);	info = framebuffer_alloc(size, &pdev->dev);	if ( !info )		return -ENOMEM;	default_par = (struct pm2fb_par *) info->par;	switch (pdev->device) {	case  PCI_DEVICE_ID_TI_TVP4020:		strcpy(pm2fb_fix.id, "TVP4020");		default_par->type = PM2_TYPE_PERMEDIA2;		break;	case  PCI_DEVICE_ID_3DLABS_PERMEDIA2:		strcpy(pm2fb_fix.id, "Permedia2");		default_par->type = PM2_TYPE_PERMEDIA2;		break;	case  PCI_DEVICE_ID_3DLABS_PERMEDIA2V:		strcpy(pm2fb_fix.id, "Permedia2v");		default_par->type = PM2_TYPE_PERMEDIA2V;		break;	}	pm2fb_fix.mmio_start = pci_resource_start(pdev, 0);	pm2fb_fix.mmio_len = PM2_REGS_SIZE;#if defined(__BIG_ENDIAN)	/*	 * PM2 has a 64k register file, mapped twice in 128k. Lower	 * map is little-endian, upper map is big-endian.	 */	pm2fb_fix.mmio_start += PM2_REGS_SIZE;	DPRINTK("Adjusting register base for big-endian.\n");#endif	DPRINTK("Register base at 0x%lx\n", pm2fb_fix.mmio_start);    	/* Registers - request region and map it. */	if ( !request_mem_region(pm2fb_fix.mmio_start, pm2fb_fix.mmio_len,				 "pm2fb regbase") ) {		printk(KERN_WARNING "pm2fb: Can't reserve regbase.\n");		goto err_exit_neither;	}	default_par->v_regs =		ioremap_nocache(pm2fb_fix.mmio_start, pm2fb_fix.mmio_len);	if ( !default_par->v_regs ) {		printk(KERN_WARNING "pm2fb: Can't remap %s register area.\n",		       pm2fb_fix.id);		release_mem_region(pm2fb_fix.mmio_start, pm2fb_fix.mmio_len);		goto err_exit_neither;	}	/* Stash away memory register info for use when we reset the board */	default_par->mem_control = pm2_RD(default_par, PM2R_MEM_CONTROL);	default_par->boot_address = pm2_RD(default_par, PM2R_BOOT_ADDRESS);	default_par->mem_config = pm2_RD(default_par, PM2R_MEM_CONFIG);	DPRINTK("MemControl 0x%x BootAddress 0x%x MemConfig 0x%x\n",		default_par->mem_control, default_par->boot_address,		default_par->mem_config);	/* Now work out how big lfb is going to be. */	switch(default_par->mem_config & PM2F_MEM_CONFIG_RAM_MASK) {	case PM2F_MEM_BANKS_1:		default_par->fb_size=0x200000;		break;	case PM2F_MEM_BANKS_2:		default_par->fb_size=0x400000;		break;	case PM2F_MEM_BANKS_3:		default_par->fb_size=0x600000;		break;	case PM2F_MEM_BANKS_4:		default_par->fb_size=0x800000;		break;	}	default_par->memclock = CVPPC_MEMCLOCK;	pm2fb_fix.smem_start = pci_resource_start(pdev, 1);	pm2fb_fix.smem_len = default_par->fb_size;	/* Linear frame buffer - request region and map it. */	if ( !request_mem_region(pm2fb_fix.smem_start, pm2fb_fix.smem_len,				 "pm2fb smem") ) {		printk(KERN_WARNING "pm2fb: Can't reserve smem.\n");		goto err_exit_mmio;	}	info->screen_base = default_par->v_fb =		ioremap_nocache(pm2fb_fix.smem_start, pm2fb_fix.smem_len);	if ( !default_par->v_fb ) {		printk(KERN_WARNING "pm2fb: Can't ioremap smem area.\n");		release_mem_region(pm2fb_fix.smem_start, pm2fb_fix.smem_len);		goto err_exit_mmio;	}	info->fbops		= &pm2fb_ops;	info->fix		= pm2fb_fix; 		info->pseudo_palette	= (void *)(default_par + 1); 	info->flags		= FBINFO_DEFAULT |                                  FBINFO_HWACCEL_YPAN;	if (!mode)		mode = "640x480@60";	 	err = fb_find_mode(&info->var, info, mode, NULL, 0, NULL, 8); 	if (!err || err == 4)		info->var = pm2fb_var;	if (fb_alloc_cmap(&info->cmap, 256, 0) < 0)		goto err_exit_all;	if (register_framebuffer(info) < 0)		goto err_exit_both;	printk(KERN_INFO "fb%d: %s frame buffer device, memory = %dK.\n",	       info->node, info->fix.id, default_par->fb_size / 1024);	/*	 * Our driver data	 */	pci_set_drvdata(pdev, info);	return 0; err_exit_all:	fb_dealloc_cmap(&info->cmap);	 err_exit_both:    	iounmap(info->screen_base);	release_mem_region(pm2fb_fix.smem_start, pm2fb_fix.smem_len); err_exit_mmio:	iounmap(default_par->v_regs);	release_mem_region(pm2fb_fix.mmio_start, pm2fb_fix.mmio_len); err_exit_neither:	framebuffer_release(info);	return err_retval;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/9127fa28595093a146fc3e2c937747e014e4bfa2/pm2fb.c/clean/drivers/video/pm2fb.c