--- linux-2.4.18-pre2-radeonfix-orig/drivers/video/radeonfb.c Mon Jan 14 11:53:49 2002 +++ linux-2.4.18-pre2-radeonfix/drivers/video/radeonfb.c Tue Jan 15 15:15:07 2002 @@ -645,6 +645,7 @@ static char *radeon_find_rom(struct radeonfb_info *rinfo); static void radeon_get_pllinfo(struct radeonfb_info *rinfo, char *bios_seg); static void radeon_get_moninfo (struct radeonfb_info *rinfo); +static int radeon_get_bios_dfpinfo (struct radeonfb_info *rinfo, char *bios_seg); static int radeon_get_dfpinfo (struct radeonfb_info *rinfo); static void radeon_get_EDID(struct radeonfb_info *rinfo); static int radeon_dfp_parse_EDID(struct radeonfb_info *rinfo); @@ -686,7 +687,9 @@ name: "radeonfb", id_table: radeonfb_pci_table, probe: radeonfb_pci_register, +#ifdef MODULE remove: radeonfb_pci_unregister, +#endif }; @@ -933,7 +936,8 @@ if ((rinfo->dviDisp_type == MT_DFP) || (rinfo->dviDisp_type == MT_LCD) || (rinfo->crtDisp_type == MT_DFP)) { - if (!radeon_get_dfpinfo(rinfo)) { + if (!radeon_get_dfpinfo(rinfo) && + !radeon_get_bios_dfpinfo(rinfo, bios_seg)) { iounmap ((void*)rinfo->mmio_base); release_mem_region (rinfo->mmio_base_phys, pci_resource_len(pdev, 2)); @@ -1365,6 +1369,46 @@ +static int radeon_get_bios_dfpinfo (struct radeonfb_info *rinfo, char *bios_seg) +{ + char *fpbiosstart, *tmp, *tmp0; + int i; + char stmp[30]; + + if(!bios_seg) return 0; + if(!(fpbiosstart = bios_seg + readw(bios_seg + 0x48))) goto out; + if(!(tmp = bios_seg + readw(fpbiosstart + 0x40))) goto out; + + for(i=0; i<24; i++) stmp[i] = readb(tmp+i+1); + stmp[24] = 0; + printk("radeonfb: panel ID string: %s\n", stmp); + rinfo->panel_xres = readw(tmp + 25); + rinfo->panel_yres = readw(tmp + 27); + printk("radeonfb: detected DFP panel size from BIOS: %dx%d\n", + rinfo->panel_xres, rinfo->panel_yres); + for(i=0; i<20; i++) { + tmp0 = bios_seg + readw(tmp+64+i*2); + if(tmp0 == 0) break; + if((readw(tmp0) == rinfo->panel_xres) && + (readw(tmp0+2) == rinfo->panel_yres)) { + rinfo->hblank = (readw(tmp0+17) - readw(tmp0+19)) * 8; + rinfo->hOver_plus = ((readw(tmp0+21) - readw(tmp0+19) - 1) * 8) & 0x7fff; + rinfo->hSync_width = readb(tmp0+23) * 8; + rinfo->vblank = readw(tmp0+24) - readw(tmp0+26); + rinfo->vOver_plus = (readw(tmp0+28) & 0x7ff) - readw(tmp0+26); + rinfo->vSync_width = (readw(tmp0+28) & 0xf800) >> 11; + rinfo->clock = readw(tmp0+9); + radeon_update_default_var(rinfo); + return 1; + } + } + out: + printk("radeonfb: Failed to detect DFP panel size using BIOS\n"); + return 0; +} + + + static int radeon_get_dfpinfo (struct radeonfb_info *rinfo) { unsigned int tmp; @@ -1406,7 +1450,7 @@ rinfo->panel_xres = 1600; break; default: - printk("radeonfb: Failed to detect DFP panel size\n"); + printk("radeonfb: Failed to detect DFP panel size using EDID\n"); return 0; }