summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYannick Heneault <yheneaul@matrox.com>2009-03-26 10:58:06 -0400
committerYannick Heneault <yheneaul@matrox.com>2009-03-26 10:58:06 -0400
commit16a5e3a7e13c0a2c1091ad452250cbc231b8f427 (patch)
tree1dba71e9b6c14435d307e85a413d8d2d05394a55
parent36ae47b82310d96f158694765105fc010911702f (diff)
Modified memory count rountine for G200eW to detect up to 16Megs.
-rw-r--r--src/mga_driver.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/mga_driver.c b/src/mga_driver.c
index b363437..70bd280 100644
--- a/src/mga_driver.c
+++ b/src/mga_driver.c
@@ -1284,6 +1284,38 @@ MGACountRam(ScrnInfoPtr pScrn)
usleep(20000);
}
+ if (pMga->is_G200WB) {
+ CARD32 Option, MaxMapSize;
+
+#ifdef XSERVER_LIBPCIACCESS
+ pci_device_cfg_read_u32(pMga->PciInfo, &Option,
+ PCI_OPTION_REG);
+ MaxMapSize = pMga->PciInfo->regions[0].size;
+#else
+ Option = pciReadLong(pMga->PciTag, PCI_OPTION_REG);
+ MaxMapSize = 1UL << pciGetBaseSize(pMga->PciTag, 0, TRUE,
+ NULL);
+#endif
+ Option = (Option & 0x3000000) >> 24 ;
+
+ if (Option == 2)
+ ProbeSize = 4*1024;
+ else if(Option == 1)
+ ProbeSize = 8*1024;
+ else if(Option == 0)
+ ProbeSize = 16*1024;
+
+ if (ProbeSize * 1024 > MaxMapSize)
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Fb size from config space doesn't fit option register\n");
+ else {
+ MGAUnmapMem(pScrn);
+ pMga->FbMapSize = ProbeSize * 1024;
+ MGAMapMem(pScrn);
+ base = pMga->FbBase;
+ }
+ }
+
/* turn MGA mode on - enable linear frame buffer (CRTCEXT3) */
OUTREG8(MGAREG_CRTCEXT_INDEX, 3);
tmp = INREG8(MGAREG_CRTCEXT_DATA);