From 800579ef040cf5df4a8b09a4a8db6118c3d84980 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 1 Jul 2005 16:21:35 +0000 Subject: 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 --- src/mga_dh.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'src/mga_dh.c') diff --git a/src/mga_dh.c b/src/mga_dh.c index 79c8510..63ddf80 100644 --- a/src/mga_dh.c +++ b/src/mga_dh.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dh.c,v 1.4 2002/01/11 15:42:57 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dh.c,v 1.4tsi Exp $ */ /********************************************************************* * G450: This is for Dual Head. * Matrox Graphics @@ -17,7 +17,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" @@ -151,13 +150,11 @@ void MGACRTC2Get(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo) CARD32 ulHTotal; CARD32 ulHDispEnd; CARD32 ulHBlkStr; - CARD32 ulHBlkEnd; CARD32 ulHSyncStr; CARD32 ulHSyncEnd; CARD32 ulVTotal; CARD32 ulVDispEnd; CARD32 ulVBlkStr; - CARD32 ulVBlkEnd; CARD32 ulVSyncStr; CARD32 ulVSyncEnd; CARD32 ulOffset; @@ -181,7 +178,6 @@ void MGACRTC2Get(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo) ulHDispEnd = tmpModeInfo.ulDispWidth; ulHBlkStr = ulHDispEnd; - ulHBlkEnd = ulHBlkStr + tmpModeInfo.ulHBPorch + tmpModeInfo.ulHFPorch + tmpModeInfo.ulHSync; ulHSyncStr = ulHBlkStr + tmpModeInfo.ulHFPorch; ulHSyncEnd = ulHSyncStr + tmpModeInfo.ulHSync; @@ -193,7 +189,6 @@ void MGACRTC2Get(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo) ulVDispEnd = ulDispHeight; ulVBlkStr = ulVDispEnd; - ulVBlkEnd = ulVBlkStr + tmpModeInfo.ulVBPorch + tmpModeInfo.ulVFPorch + tmpModeInfo.ulVSync; ulVSyncStr = ulVBlkStr + tmpModeInfo.ulVFPorch; ulVSyncEnd = ulVSyncStr + tmpModeInfo.ulVSync; @@ -285,7 +280,7 @@ void MGACRTC2Set(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo) void MGAEnableSecondOutPut(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo) { CARD8 ucByte, ucXDispCtrl; - CARD32 ulC2CTL, ulStatusReg; + CARD32 ulC2CTL; MGAPtr pMga = MGAPTR(pScrn); MGARegPtr pReg; pReg = &pMga->ModeReg; @@ -300,8 +295,8 @@ void MGAEnableSecondOutPut(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo) /*--- Disable Pixel clock oscillations On Crtc1 */ OUTREG( MGAREG_C2CTL, ulC2CTL | C2CTL_PIXCLKDIS_MASK); /*--- Have to wait minimum time (2 acces will be ok) */ - ulStatusReg = INREG( MGAREG_Status); - ulStatusReg = INREG( MGAREG_Status); + (void) INREG( MGAREG_Status); + (void) INREG( MGAREG_Status); ulC2CTL &= ~(C2CTL_PIXCLKSEL_MASK | C2CTL_PIXCLKSELH_MASK); -- cgit v1.2.3