diff options
author | Ian Romanick <idr@us.ibm.com> | 2005-07-01 16:21:35 +0000 |
---|---|---|
committer | Ian Romanick <idr@us.ibm.com> | 2005-07-01 16:21:35 +0000 |
commit | 800579ef040cf5df4a8b09a4a8db6118c3d84980 (patch) | |
tree | 0ad90713ec679988e7880a05b41997251b22cb54 /src/mga_g450pll.c | |
parent | acadff30e40af48592e50e55a94f9c81ab856971 (diff) |
Re-write the PInS processing code
This patch dumps all of the old BIOS processing code from the MGA DDX. The
new code, located in mga_bios.c, is modeled after the code in
matroxfb_misc.c (though no actual code was copied). Basically, the BIOS
is processed in one place, with "device independent" values stored in a
data structure. This data is then used, without extra switch-statments,
throughout the driver.
In addition, this patch adds support for processing the BIOS on PowerPC
systems. On PPC cards, the magic offset values (that give the location
of the PInS data) is not in the BIOS. Instead the driver has to search
the BIOS for the PInS structure signature. The patch does this and
correctly handles byte-ordering (and data alignement) issues.
This code has been tested on an AGP G400 on x86 and a PCI G450 on PowerPC.
NOTE: The file mga_bios.h is also removed. The "documentation" in that file
was moved to the file mga_PInS.txt. This file documents, as much as
possible, the layout of the various PInS datastructure versions. The
information in that file is 100% based on the old mga_bios.h and the
code in matroxfb_misc.c. No additional information from Matrox
documentation is included in that file. This just puts the information
that was already known in one place.
Xorg Bug: 3553
Diffstat (limited to 'src/mga_g450pll.c')
-rw-r--r-- | src/mga_g450pll.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/mga_g450pll.c b/src/mga_g450pll.c index 6176549..e4d8467 100644 --- a/src/mga_g450pll.c +++ b/src/mga_g450pll.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_g450pll.c,v 1.8 2002/09/16 18:05:56 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_g450pll.c,v 1.8tsi Exp $ */ /* All drivers should typically include these */ #include "xf86.h" @@ -11,7 +11,6 @@ /* Drivers that need to access the PCI config space directly need this */ #include "xf86Pci.h" -#include "mga_bios.h" #include "mga_reg.h" #include "mga.h" @@ -43,11 +42,10 @@ static CARD32 G450RemovePFactor(ScrnInfoPtr pScrn, CARD8 ucP, CARD32 *pulFIn) static CARD32 G450CalculVCO(ScrnInfoPtr pScrn, CARD32 ulMNP, CARD32 *pulF) { - CARD8 ucM, ucN, ucP; + CARD8 ucM, ucN; ucM = (CARD8)((ulMNP >> 16) & 0xff); ucN = (CARD8)((ulMNP >> 8) & 0xff); - ucP = (CARD8)(ulMNP & 0x03); *pulF = (27000 * (2 * (ucN + 2)) + ((ucM + 1) >> 1)) / (ucM + 1); @@ -193,9 +191,6 @@ static CARD32 G450FindFirstPLLParam(ScrnInfoPtr pScrn, CARD32 ulFout, static CARD32 G450WriteMNP(ScrnInfoPtr pScrn, CARD32 ulMNP) { MGAPtr pMga = MGAPTR(pScrn); - MGARegPtr pReg; - - pReg = &pMga->ModeReg; if (!pMga->SecondCrtc) { outMGAdac(MGA1064_PIX_PLLC_M, (CARD8)(ulMNP >> 16)); @@ -212,11 +207,8 @@ static CARD32 G450WriteMNP(ScrnInfoPtr pScrn, CARD32 ulMNP) static CARD32 G450ReadMNP(ScrnInfoPtr pScrn) { MGAPtr pMga = MGAPTR(pScrn); - MGARegPtr pReg; CARD32 ret = 0; - pReg = &pMga->ModeReg; - if (!pMga->SecondCrtc) { ret = (CARD8)inMGAdac(MGA1064_PIX_PLLC_M) << 16; ret |= (CARD8)inMGAdac(MGA1064_PIX_PLLC_N) << 8; |