summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEgbert Eich <eich@suse.de>2004-03-30 14:23:13 +0000
committerEgbert Eich <eich@suse.de>2004-03-30 14:23:13 +0000
commit6f82d06eea99eb607020076d0923994d76a56113 (patch)
tree1d1f37490206330bd4a384c033dc8a3b7c76c718
parent7d27a815b614d93698b6d3de4c8a102e35d9fe99 (diff)
Added support for memory size tweaking in BIOS for i845 (Egbert Eich, thanks toXORG-CURRENT-premerge-release-1
Christian Ziez)
-rw-r--r--src/i830.h3
-rw-r--r--src/i830_driver.c19
2 files changed, 13 insertions, 9 deletions
diff --git a/src/i830.h b/src/i830.h
index 143df120..c9276b05 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -401,7 +401,8 @@ extern void I830ChangeFrontbuffer(ScrnInfoPtr pScrn,int buffer);
#define ALLOCATE_DRY_RUN 0x80000000
/* Chipset registers for VIDEO BIOS memory RW access */
-#define DRAM_RW_CONTROL 0x58
+#define _855_DRAM_RW_CONTROL 0x58
+#define _845_DRAM_RW_CONTROL 0x90
#define DRAM_WRITE 0x33330000
#endif /* _I830_H_ */
diff --git a/src/i830_driver.c b/src/i830_driver.c
index e504342f..3552fbc3 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -1079,7 +1079,9 @@ static CARD32
TweakMemorySize(ScrnInfoPtr pScrn, CARD32 newsize, Bool preinit)
{
#define SIZE 0x10000
-#define IDOFFSET (-23)
+#define _855_IDOFFSET (-23)
+#define _845_IDOFFSET (-19)
+
const char *MAGICstring = "Total time for VGA POST:";
const int len = strlen(MAGICstring);
I830Ptr pI830 = I830PTR(pScrn);
@@ -1090,7 +1092,8 @@ TweakMemorySize(ScrnInfoPtr pScrn, CARD32 newsize, Bool preinit)
CARD32 ret = 0;
int i,j = 0;
PCITAG tag =pciTag(0,0,0);
-
+ int reg = IS_845G(pI830) ? _845_DRAM_RW_CONTROL : _855_DRAM_RW_CONTROL;
+
if(!pI830->PciInfo
|| !(pI830->PciInfo->chipType == PCI_CHIP_I855_GM
|| pI830->PciInfo->chipType == PCI_CHIP_I865_G))
@@ -1119,19 +1122,19 @@ TweakMemorySize(ScrnInfoPtr pScrn, CARD32 newsize, Bool preinit)
}
if (j < len) return 0;
- pI830->BIOSMemSizeLoc = (i - j + 1 + IDOFFSET);
+ pI830->BIOSMemSizeLoc = (i - j + 1 + (IS_845G(pI830)
+ ? _845_IDOFFSET : _855_IDOFFSET));
}
position = biosAddr + pI830->BIOSMemSizeLoc;
oldsize = *(CARD32 *)position;
ret = oldsize - (3 << 16);
-
/* verify that register really contains current size */
if (preinit && ((oldsize) >> 16) - 3 != pI830->vbeInfo->TotalMemory)
return 0;
- oldpermission = pciReadLong(tag, DRAM_RW_CONTROL);
- pciWriteLong(tag, DRAM_RW_CONTROL, 0x33330000);
+ oldpermission = pciReadLong(tag, reg);
+ pciWriteLong(tag, reg, 0x33330000);
*(CARD32 *)position = newsize + (3 << 16);
if (preinit) {
@@ -1142,7 +1145,7 @@ TweakMemorySize(ScrnInfoPtr pScrn, CARD32 newsize, Bool preinit)
pI830->vbeInfo = VBEGetVBEInfo(pI830->pVbe);
/* verify that change was successful */
- if (pI830->vbeInfo->TotalMemory * 64 * 1024 != pI830->newBIOSMemSize) {
+ if (pI830->vbeInfo->TotalMemory * 64 * 1024 != pI830->newBIOSMemSize){
ret = 0;
*(CARD32 *)position = oldsize;
} else {
@@ -1153,7 +1156,7 @@ TweakMemorySize(ScrnInfoPtr pScrn, CARD32 newsize, Bool preinit)
}
}
- pciWriteLong(tag, DRAM_RW_CONTROL, oldpermission);
+ pciWriteLong(tag, reg, oldpermission);
return ret;
}