summaryrefslogtreecommitdiff
path: root/src/ast_vgatool.c
diff options
context:
space:
mode:
authorAlan Coopersmith <Alan.Coopersmith@sun.com>2006-03-14 23:51:52 +0000
committerAlan Coopersmith <Alan.Coopersmith@sun.com>2006-03-14 23:51:52 +0000
commit24d5661d2c703582e44ce140d0eb7251433e1ad0 (patch)
tree596fcffe716a6fb4f8c4d56c0378493298ba38bb /src/ast_vgatool.c
parent4e31187407a6dfe53a9d15f06c8c4584e20125ba (diff)
Version 0.80 from ASPEED Technology Inc. (Fixed get video buffer size
incorrect issue) Bugzilla #4937 <https://bugs.freedesktop.org/show_bug.cgi?id=4937> Attachment #4932 <https://bugs.freedesktop.org/attachment.cgi?id=4932>
Diffstat (limited to 'src/ast_vgatool.c')
-rw-r--r--src/ast_vgatool.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/src/ast_vgatool.c b/src/ast_vgatool.c
index 85b105c..fc761ab 100644
--- a/src/ast_vgatool.c
+++ b/src/ast_vgatool.c
@@ -58,6 +58,7 @@
void vASTOpenKey(ScrnInfoPtr pScrn);
Bool bASTRegInit(ScrnInfoPtr pScrn);
ULONG GetVRAMInfo(ScrnInfoPtr pScrn);
+ULONG GetMaxDCLK(ScrnInfoPtr pScrn);
void vAST1000DisplayOn(ASTRecPtr pAST);
void vAST1000DisplayOff(ASTRecPtr pAST);
void vSetStartAddressCRT1(ASTRecPtr pAST, ULONG base);
@@ -111,6 +112,76 @@ GetVRAMInfo(ScrnInfoPtr pScrn)
}
+ULONG
+GetMaxDCLK(ScrnInfoPtr pScrn)
+{
+ ASTRecPtr pAST = ASTPTR(pScrn);
+ UCHAR jReg;
+ ULONG ulData, ulData2;
+ ULONG ulRefPLL, ulDeNumerator, ulNumerator, ulDivider;
+ ULONG ulDRAMBusWidth, ulMCLK, ulDRAMBandwidth, ActualDRAMBandwidth, DRAMEfficiency = 500;
+ ULONG ulDCLK;
+
+ vASTOpenKey(pScrn);
+
+ *(ULONG *) (pAST->MMIOVirtualAddr + 0xF004) = 0x1e6e0000;
+ *(ULONG *) (pAST->MMIOVirtualAddr + 0xF000) = 0x00000001;
+
+ /* Get BusWidth */
+ ulData = *(ULONG * ) (pAST->MMIOVirtualAddr + 0x10004);
+ if (ulData & 0x40)
+ ulDRAMBusWidth = 16;
+ else
+ ulDRAMBusWidth = 32;
+
+ /* Get MCLK */
+ {
+ *(ULONG *) (pAST->MMIOVirtualAddr + 0x10100) = 0x000000A8;
+
+ ulData = *(ULONG *) (pAST->MMIOVirtualAddr + 0x10120);
+ ulData2 = *(ULONG *) (pAST->MMIOVirtualAddr + 0x10170);
+ if (ulData2 & 0x2000)
+ ulRefPLL = 14318;
+ else
+ ulRefPLL = 12000;
+
+ ulDeNumerator = ulData & 0x1F;
+ ulNumerator = (ulData & 0x3FE0) >> 5;
+
+ ulData = (ulData & 0xC000) >> 14;
+ switch (ulData)
+ {
+ case 0x03:
+ ulDivider = 0x04;
+ break;
+ case 0x02:
+ case 0x01:
+ ulDivider = 0x02;
+ break;
+ default:
+ ulDivider = 0x01;
+ }
+
+ ulMCLK = ulRefPLL * (ulNumerator + 2) / ((ulDeNumerator + 2) * ulDivider * 1000);
+
+ }
+
+ /* Get Bandwidth */
+ ulDRAMBandwidth = ulMCLK * ulDRAMBusWidth * 2 / 8;
+ ActualDRAMBandwidth = ulDRAMBandwidth * DRAMEfficiency / 1000;
+
+ /* Get Max DCLK */
+ GetIndexRegMask(CRTC_PORT, 0xD0, 0xFF, jReg);
+ if (jReg & 0x08)
+ ulDCLK = ActualDRAMBandwidth / ((pScrn->bitsPerPixel+1+16) / 8);
+ else
+ ulDCLK = ActualDRAMBandwidth / ((pScrn->bitsPerPixel+1) / 8);
+
+ if (ulDCLK > 165) ulDCLK = 165;
+
+ return(ulDCLK);
+
+}
void
vSetStartAddressCRT1(ASTRecPtr pAST, ULONG base)