summaryrefslogtreecommitdiff
path: root/src/mga_driver.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mga_driver.c')
-rw-r--r--src/mga_driver.c63
1 files changed, 55 insertions, 8 deletions
diff --git a/src/mga_driver.c b/src/mga_driver.c
index 258e146..9bb3ecf 100644
--- a/src/mga_driver.c
+++ b/src/mga_driver.c
@@ -749,6 +749,7 @@ MGACountRam(ScrnInfoPtr pScrn)
int ProbeSize = 8192;
int SizeFound = 2048;
CARD32 biosInfo = 0;
+ CARD8 seq1;
#if 0
/* This isn't correct. It looks like this can have arbitrary
@@ -821,6 +822,16 @@ MGACountRam(ScrnInfoPtr pScrn)
MGAMapMem(pScrn);
base = pMga->FbBase;
+ if (pMga->is_G200SE) {
+ OUTREG8(MGAREG_SEQ_INDEX, 0x01);
+ seq1 = INREG8(MGAREG_SEQ_DATA);
+ seq1 |= 0x20;
+ MGAWAITVSYNC();
+ MGAWAITBUSY();
+ OUTREG8(MGAREG_SEQ_DATA, seq1);
+ usleep(20000);
+ }
+
/* turn MGA mode on - enable linear frame buffer (CRTCEXT3) */
OUTREG8(MGAREG_CRTCEXT_INDEX, 3);
tmp = INREG8(MGAREG_CRTCEXT_DATA);
@@ -841,7 +852,7 @@ MGACountRam(ScrnInfoPtr pScrn)
base[1] = 0;
for (Offset = 0x100000; Offset < (ProbeSize * 1024);
- Offset += 0x1000) {
+ Offset += 0x1000) {
FirstMemoryVal1 = base[Offset];
FirstMemoryVal2 = base[Offset+1];
SecondMemoryVal1 = base[Offset+0x100];
@@ -896,8 +907,17 @@ MGACountRam(ScrnInfoPtr pScrn)
OUTREG8(MGAREG_CRTCEXT_INDEX, 3);
OUTREG8(MGAREG_CRTCEXT_DATA, tmp);
+ if (pMga->is_G200SE) {
+ OUTREG8(MGAREG_SEQ_INDEX, 0x01);
+ seq1 = INREG8(MGAREG_SEQ_DATA);
+ seq1 &= ~0x20;
+ MGAWAITVSYNC();
+ MGAWAITBUSY();
+ OUTREG8(MGAREG_SEQ_DATA, seq1);
+ usleep(20000);
+ }
MGAUnmapMem(pScrn);
- }
+ }
return SizeFound;
}
@@ -2787,7 +2807,11 @@ MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
return FALSE;
/* Program the registers */
- vgaHWProtect(pScrn, TRUE);
+ if (pMga->is_G200SE) {
+ MGAG200SEHWProtect(pScrn, TRUE);
+ } else {
+ vgaHWProtect(pScrn, TRUE);
+ }
vgaReg = &hwp->ModeReg;
mgaReg = &pMga->ModeReg;
#ifdef USEMGAHAL
@@ -2903,7 +2927,11 @@ MGA_HAL(
MGAStormSync(pScrn);
MGAStormEngineInit(pScrn);
- vgaHWProtect(pScrn, FALSE);
+ if (pMga->is_G200SE) {
+ MGAG200SEHWProtect(pScrn,FALSE);
+ } else {
+ vgaHWProtect(pScrn, FALSE);
+ }
if (xf86IsPc98()) {
if (pMga->Chipset == PCI_CHIP_MGA2064)
@@ -2912,6 +2940,13 @@ MGA_HAL(
outb(0xfac, 0x02);
}
+ MGA_NOT_HAL(
+ if (pMga->is_G200SE) {
+ OUTREG8(0x1FDE, 0x06);
+ OUTREG8(0x1FDF, 0x14);
+ }
+ );
+
pMga->CurrentLayout.mode = mode;
if(pMga->MergedFB && mode->Private && (mode->PrivSize == 0)) {
@@ -3008,7 +3043,11 @@ MGARestore(ScrnInfoPtr pScrn)
}
/* Only restore text mode fonts/text for the primary card */
- vgaHWProtect(pScrn, TRUE);
+ if (pMga->is_G200SE) {
+ MGAG200SEHWProtect(pScrn,TRUE);
+ } else {
+ vgaHWProtect(pScrn, TRUE);
+ }
if (pMga->Primary) {
#ifdef USEMGAHAL
MGA_HAL(
@@ -3022,7 +3061,12 @@ MGARestore(ScrnInfoPtr pScrn)
} else {
vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE);
}
- vgaHWProtect(pScrn, FALSE);
+
+ if (pMga->is_G200SE) {
+ MGAG200SEHWProtect(pScrn,FALSE);
+ } else {
+ vgaHWProtect(pScrn,FALSE);
+ }
}
@@ -3313,8 +3357,7 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
* InitGLXVisuals call back.
* The DRI does not work when textured video is enabled at this time.
*/
- if ((pMga->Chipset == PCI_CHIP_MGAG200_SE_A_PCI) ||
- (pMga->Chipset == PCI_CHIP_MGAG200_SE_B_PCI)) {
+ if (pMga->is_G200SE) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Not supported by hardware, not initializing the DRI\n");
pMga->directRenderingEnabled = FALSE;
@@ -4060,10 +4103,14 @@ MGADisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode,
crtcext1 = 0x30;
break;
}
+
/* XXX Prefer an implementation that doesn't depend on VGA specifics */
OUTREG8(MGAREG_SEQ_INDEX, 0x01); /* Select SEQ1 */
seq1 |= INREG8(MGAREG_SEQ_DATA) & ~0x20;
+ MGAWAITVSYNC();
+ MGAWAITBUSY();
OUTREG8(MGAREG_SEQ_DATA, seq1);
+ usleep(20000);
OUTREG8(MGAREG_CRTCEXT_INDEX, 0x01); /* Select CRTCEXT1 */
crtcext1 |= INREG8(MGAREG_CRTCEXT_DATA) & ~0x30;
OUTREG8(MGAREG_CRTCEXT_DATA, crtcext1);