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_dac3026.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_dac3026.c')
-rw-r--r-- | src/mga_dac3026.c | 100 |
1 files changed, 6 insertions, 94 deletions
diff --git a/src/mga_dac3026.c b/src/mga_dac3026.c index ecd0605..3efdf3c 100644 --- a/src/mga_dac3026.c +++ b/src/mga_dac3026.c @@ -47,7 +47,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" #include "mga_macros.h" @@ -1079,100 +1078,13 @@ MGA3026RamdacInit(ScrnInfoPtr pScrn) MGAdac->LoadPalette = MGA3026LoadPalette; MGAdac->RestorePalette = MGA3026RestorePalette; + MGAdac->maxPixelClock = pMga->bios.pixel.max_freq; MGAdac->ClockFrom = X_PROBED; - if ( pMga->Chipset == PCI_CHIP_MGA2064 && pMga->Bios2.PinID == 0 ) - { - switch( pMga->Bios.RamdacType & 0xff ) - { - case 1: MGAdac->maxPixelClock = 220000; - break; - case 2: MGAdac->maxPixelClock = 250000; - break; - default: - MGAdac->maxPixelClock = 175000; - MGAdac->ClockFrom = X_DEFAULT; - break; - } - /* Set MCLK based on amount of memory */ - if(pMga->OverclockMem) { - if ( pScrn->videoRam < 4096 ) - MGAdac->MemoryClock = pMga->Bios.ClkBase * 12; - else if ( pScrn->videoRam < 8192 ) - MGAdac->MemoryClock = pMga->Bios.Clk4MB * 12; - else - MGAdac->MemoryClock = pMga->Bios.Clk8MB * 12; - MGAdac->MemClkFrom = X_CONFIG; - MGAdac->SetMemClk = TRUE; -#if 0 - ErrorF("BIOS Memory clock settings: 2Mb %d, 4Mb %d, 8MB %d\n", - pMga->Bios.ClkBase, pMga->Bios.Clk4MB, pMga->Bios.Clk8MB); -#endif - } else { - if ( pScrn->videoRam < 4096 ) - MGAdac->MemoryClock = pMga->Bios.ClkBase * 10; - else if ( pScrn->videoRam < 8192 ) - MGAdac->MemoryClock = pMga->Bios.Clk4MB * 10; - else - MGAdac->MemoryClock = pMga->Bios.Clk8MB * 10; - MGAdac->MemClkFrom = X_PROBED; - MGAdac->SetMemClk = TRUE; - } - } - else - { - if ( pMga->Bios2.PinID ) /* make sure BIOS is available */ - { - if ( pMga->Bios2.PclkMax != 0xff ) - { - MGAdac->maxPixelClock = (pMga->Bios2.PclkMax + 100) * 1000; - } - else - MGAdac->maxPixelClock = 220000; - - /* make sure we are not overdriving the GE for the amount of WRAM */ - switch ( pScrn->videoRam ) - { - case 4096: - if (pMga->Bios2.Clk4MB != 0xff) - pMga->Bios2.ClkGE = pMga->Bios2.Clk4MB; - break; - case 8192: - if (pMga->Bios2.Clk8MB != 0xff) - pMga->Bios2.ClkGE = pMga->Bios2.Clk8MB; - break; - case 12288: - if (pMga->Bios2.Clk12MB != 0xff) - pMga->Bios2.ClkGE = pMga->Bios2.Clk12MB; - break; - case 16384: - if (pMga->Bios2.Clk16MB != 0xff) - pMga->Bios2.ClkGE = pMga->Bios2.Clk16MB; - break; - default: - break; - } - if ( pMga->Bios2.ClkGE != 0xff && pMga->Bios2.ClkMem == 0xff ) - pMga->Bios2.ClkMem = pMga->Bios2.ClkGE; - else if ( pMga->Bios2.ClkGE == 0xff && pMga->Bios2.ClkMem != 0xff ) - ; /* don't need to do anything */ - else if ( pMga->Bios2.ClkGE == pMga->Bios2.ClkMem && pMga->Bios2.ClkGE != 0xff ) - pMga->Bios2.ClkMem = pMga->Bios2.ClkGE; - else - pMga->Bios2.ClkMem = 60; - - MGAdac->MemoryClock = pMga->Bios2.ClkMem * 1000; - MGAdac->MemClkFrom = X_PROBED; - MGAdac->SetMemClk = TRUE; - } /* BIOS enabled initialization */ - else - { - /* bios is not available, initialize to rational figures */ - MGAdac->MemoryClock = 60000; /* 60 MHz WRAM */ - MGAdac->maxPixelClock = 220000; /* 220 MHz */ - MGAdac->ClockFrom = X_DEFAULT; - } - } /* 2164 specific initialization */ + MGAdac->MemoryClock = pMga->bios.mem_clock; + MGAdac->MemClkFrom = X_PROBED; + MGAdac->SetMemClk = TRUE; + /* safety check */ if ( (MGAdac->MemoryClock < 40000) || @@ -1201,7 +1113,7 @@ MGA3026RamdacInit(ScrnInfoPtr pScrn) pMga->Roundings[3] = 128 >> pMga->BppShifts[3]; /* Set Fast bitblt flag */ - pMga->HasFBitBlt = !(pMga->Bios.FeatFlag & 0x00000001); + pMga->HasFBitBlt = pMga->bios.fast_bitblt; } void MGA3026LoadPalette( |