Commit 34c13ee2 authored by Aaro Koskinen's avatar Aaro Koskinen Committed by Greg Kroah-Hartman

staging: xgifb: drop code for legacy VGA modes

Drop code for mode_no <= 14. These are not supported so this is all
just dead code.
Signed-off-by: default avatarAaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 77f3e4b1
...@@ -181,14 +181,10 @@ static unsigned char XGI_GetModePtr(unsigned short ModeNo, ...@@ -181,14 +181,10 @@ static unsigned char XGI_GetModePtr(unsigned short ModeNo,
{ {
unsigned char index; unsigned char index;
if (ModeNo <= 0x13) if (pVBInfo->ModeType <= 0x02)
index = pVBInfo->SModeIDTable[ModeIdIndex].St_StTableIndex; index = 0x1B; /* 02 -> ModeEGA */
else { else
if (pVBInfo->ModeType <= 0x02) index = 0x0F;
index = 0x1B; /* 02 -> ModeEGA */
else
index = 0x0F;
}
return index; /* Get pVBInfo->StandTable index */ return index; /* Get pVBInfo->StandTable index */
} }
...@@ -200,10 +196,7 @@ static void XGI_SetSeqRegs(unsigned short ModeNo, ...@@ -200,10 +196,7 @@ static void XGI_SetSeqRegs(unsigned short ModeNo,
unsigned char tempah, SRdata; unsigned char tempah, SRdata;
unsigned short i, modeflag; unsigned short i, modeflag;
if (ModeNo <= 0x13) modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
else
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
xgifb_reg_set(pVBInfo->P3c4, 0x00, 0x03); /* Set SR0 */ xgifb_reg_set(pVBInfo->P3c4, 0x00, 0x03); /* Set SR0 */
tempah = pVBInfo->StandTable[StandTableIndex].SR[0]; tempah = pVBInfo->StandTable[StandTableIndex].SR[0];
...@@ -254,10 +247,7 @@ static void XGI_SetATTRegs(unsigned short ModeNo, ...@@ -254,10 +247,7 @@ static void XGI_SetATTRegs(unsigned short ModeNo,
unsigned char ARdata; unsigned char ARdata;
unsigned short i, modeflag; unsigned short i, modeflag;
if (ModeNo <= 0x13) modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
else
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
for (i = 0; i <= 0x13; i++) { for (i = 0; i <= 0x13; i++) {
ARdata = pVBInfo->StandTable[StandTableIndex].ATTR[i]; ARdata = pVBInfo->StandTable[StandTableIndex].ATTR[i];
...@@ -337,12 +327,7 @@ static unsigned char XGI_AjustCRT2Rate(unsigned short ModeNo, ...@@ -337,12 +327,7 @@ static unsigned char XGI_AjustCRT2Rate(unsigned short ModeNo,
{ {
unsigned short tempax, tempbx, resinfo, modeflag, infoflag; unsigned short tempax, tempbx, resinfo, modeflag, infoflag;
if (ModeNo <= 0x13) modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
/* si+St_ModeFlag */
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
else
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO; resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
tempbx = pVBInfo->RefIndex[RefreshRateTableIndex + (*i)].ModeID; tempbx = pVBInfo->RefIndex[RefreshRateTableIndex + (*i)].ModeID;
tempax = 0; tempax = 0;
...@@ -577,11 +562,7 @@ static void XGI_SetCRT1Timing_V(unsigned short ModeIdIndex, ...@@ -577,11 +562,7 @@ static void XGI_SetCRT1Timing_V(unsigned short ModeIdIndex,
data &= 0x80; data &= 0x80;
data = data >> 2; data = data >> 2;
if (ModeNo <= 0x13) i = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
i = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
else
i = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
i &= DoubleScanMode; i &= DoubleScanMode;
if (i) if (i)
data |= 0x80; data |= 0x80;
...@@ -634,158 +615,97 @@ static void XGI_SetXG21CRTC(unsigned short ModeNo, unsigned short ModeIdIndex, ...@@ -634,158 +615,97 @@ static void XGI_SetXG21CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
unsigned short RefreshRateTableIndex, unsigned short RefreshRateTableIndex,
struct vb_device_info *pVBInfo) struct vb_device_info *pVBInfo)
{ {
unsigned char StandTableIndex, index, Tempax, Tempbx, Tempcx, Tempdx; unsigned char index, Tempax, Tempbx, Tempcx, Tempdx;
unsigned short Temp1, Temp2, Temp3; unsigned short Temp1, Temp2, Temp3;
if (ModeNo <= 0x13) { index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
StandTableIndex = XGI_GetModePtr(ModeNo, ModeIdIndex, pVBInfo); /* Tempax: CR4 HRS */
/* CR04 HRS */ Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[3];
Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[4]; Tempcx = Tempax; /* Tempcx: HRS */
/* SR2E [7:0]->HRS */ /* SR2E[7:0]->HRS */
xgifb_reg_set(pVBInfo->P3c4, 0x2E, Tempax); xgifb_reg_set(pVBInfo->P3c4, 0x2E, Tempax);
/* Tempbx: CR05 HRE */
Tempbx = pVBInfo->StandTable[StandTableIndex].CRTC[5]; Tempdx = pVBInfo->XGINEWUB_CRT1Table[index].CR[5]; /* SRB */
Tempbx &= 0x1F; /* Tempbx: HRE[4:0] */ Tempdx &= 0xC0; /* Tempdx[7:6]: SRB[7:6] */
Tempcx = Tempax; Temp1 = Tempdx; /* Temp1[7:6]: HRS[9:8] */
Tempcx &= 0xE0; /* Tempcx: HRS[7:5] */ Temp1 <<= 2; /* Temp1[9:8]: HRS[9:8] */
Tempdx = Tempcx | Tempbx; /* Tempdx(HRE): HRS[7:5]HRE[4:0] */ Temp1 |= Tempax; /* Temp1[9:0]: HRS[9:0] */
if (Tempbx < (Tempax & 0x1F)) /* IF HRE < HRS */
Tempdx |= 0x20; /* Tempdx: HRE = HRE + 0x20 */ Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[4]; /* CR5 HRE */
Tempdx <<= 2; /* Tempdx << 2 */ Tempax &= 0x1F; /* Tempax[4:0]: HRE[4:0] */
/* SR2F [7:2]->HRE */
xgifb_reg_set(pVBInfo->P3c4, 0x2F, Tempdx); Tempbx = pVBInfo->XGINEWUB_CRT1Table[index].CR[6]; /* SRC */
xgifb_reg_and_or(pVBInfo->P3c4, 0x30, 0xE3, 00); Tempbx &= 0x04; /* Tempbx[2]: HRE[5] */
Tempbx <<= 3; /* Tempbx[5]: HRE[5] */
/* Tempax: CR16 VRS */ Tempax |= Tempbx; /* Tempax[5:0]: HRE[5:0] */
Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[16];
Tempbx = Tempax; /* Tempbx=Tempax */ Temp2 = Temp1 & 0x3C0; /* Temp2[9:6]: HRS[9:6] */
Tempax &= 0x01; /* Tempax: VRS[0] */ Temp2 |= Tempax; /* Temp2[9:0]: HRE[9:0] */
xgifb_reg_or(pVBInfo->P3c4, 0x33, Tempax); /* SR33[0]->VRS */
Tempcx &= 0x3F; /* Tempcx[5:0]: HRS[5:0] */
/* Tempax: CR7 VRS */ if (Tempax < Tempcx) /* HRE < HRS */
Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[7]; Temp2 |= 0x40; /* Temp2 + 0x40 */
Tempdx = Tempbx >> 1; /* Tempdx: VRS[7:1] */
Tempcx = Tempax & 0x04; /* Tempcx: CR7[2] */ Temp2 &= 0xFF;
Tempcx <<= 5; /* Tempcx[7]: VRS[8] */ Tempax = (unsigned char) Temp2; /* Tempax: HRE[7:0] */
Tempdx |= Tempcx; /* Tempdx: VRS[8:1] */ Tempax <<= 2; /* Tempax[7:2]: HRE[5:0] */
/* SR34[7:0]: VRS[8:1] */ Tempdx >>= 6; /* Tempdx[7:6]->[1:0] HRS[9:8] */
xgifb_reg_set(pVBInfo->P3c4, 0x34, Tempdx); Tempax |= Tempdx; /* HRE[5:0]HRS[9:8] */
/* SR2F D[7:2]->HRE, D[1:0]->HRS */
/* Temp1[8]: VRS[8] unsigned char -> unsigned short */ xgifb_reg_set(pVBInfo->P3c4, 0x2F, Tempax);
Temp1 = Tempcx << 1; xgifb_reg_and_or(pVBInfo->P3c4, 0x30, 0xE3, 00);
Temp1 |= Tempbx; /* Temp1[8:0]: VRS[8:0] */
Tempax &= 0x80; /* Tempax[7]: CR7[7] */ /* CR10 VRS */
Temp2 = Tempax << 2; /* Temp2[9]: VRS[9] */ Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[10];
Temp1 |= Temp2; /* Temp1[9:0]: VRS[9:0] */ Tempbx = Tempax; /* Tempbx: VRS */
Tempax &= 0x01; /* Tempax[0]: VRS[0] */
/* CR16 VRE */ xgifb_reg_or(pVBInfo->P3c4, 0x33, Tempax); /* SR33[0]->VRS[0] */
Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[17]; /* CR7[2][7] VRE */
Tempax &= 0x0F; /* Tempax[3:0]: VRE[3:0] */ Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[9];
Temp2 = Temp1 & 0x3F0; /* Temp2[9:4]: VRS[9:4] */ Tempcx = Tempbx >> 1; /* Tempcx[6:0]: VRS[7:1] */
Temp2 |= Tempax; /* Temp2[9:0]: VRE[9:0] */ Tempdx = Tempax & 0x04; /* Tempdx[2]: CR7[2] */
Temp3 = Temp1 & 0x0F; /* Temp3[3:0]: VRS[3:0] */ Tempdx <<= 5; /* Tempdx[7]: VRS[8] */
if (Tempax < Temp3) /* VRE[3:0]<VRS[3:0] */ Tempcx |= Tempdx; /* Tempcx[7:0]: VRS[8:1] */
Temp2 |= 0x10; /* Temp2: VRE + 0x10 */ xgifb_reg_set(pVBInfo->P3c4, 0x34, Tempcx); /* SR34[8:1]->VRS */
Temp2 &= 0xFF; /* Temp2[7:0]: VRE[7:0] */
Tempax = (unsigned char) Temp2; /* Tempax[7:0]: VRE[7:0] */ Temp1 = Tempdx; /* Temp1[7]: Tempdx[7] */
Tempax <<= 2; /* Tempax << 2: VRE[5:0] */ Temp1 <<= 1; /* Temp1[8]: VRS[8] */
Temp1 &= 0x600; /* Temp1[10:9]: VRS[10:9] */ Temp1 |= Tempbx; /* Temp1[8:0]: VRS[8:0] */
Temp1 >>= 9; /* [10:9]->[1:0] */ Tempax &= 0x80;
Tempbx = (unsigned char) Temp1; /* Tempbx[1:0]: VRS[10:9] */ Temp2 = Tempax << 2; /* Temp2[9]: VRS[9] */
Tempax |= Tempbx; /* VRE[5:0]VRS[10:9] */ Temp1 |= Temp2; /* Temp1[9:0]: VRS[9:0] */
Tempax &= 0x7F; /* Tempax: SRA */
/* SR3F D[7:2]->VRE D[1:0]->VRS */ Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[14];
xgifb_reg_set(pVBInfo->P3c4, 0x3F, Tempax); Tempax &= 0x08; /* Tempax[3]: VRS[3] */
} else { Temp2 = Tempax;
index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; Temp2 <<= 7; /* Temp2[10]: VRS[10] */
/* Tempax: CR4 HRS */ Temp1 |= Temp2; /* Temp1[10:0]: VRS[10:0] */
Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[3];
Tempcx = Tempax; /* Tempcx: HRS */ /* Tempax: CR11 VRE */
/* SR2E[7:0]->HRS */ Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[11];
xgifb_reg_set(pVBInfo->P3c4, 0x2E, Tempax); Tempax &= 0x0F; /* Tempax[3:0]: VRE[3:0] */
/* Tempbx: SRA */
Tempdx = pVBInfo->XGINEWUB_CRT1Table[index].CR[5]; /* SRB */ Tempbx = pVBInfo->XGINEWUB_CRT1Table[index].CR[14];
Tempdx &= 0xC0; /* Tempdx[7:6]: SRB[7:6] */ Tempbx &= 0x20; /* Tempbx[5]: VRE[5] */
Temp1 = Tempdx; /* Temp1[7:6]: HRS[9:8] */ Tempbx >>= 1; /* Tempbx[4]: VRE[4] */
Temp1 <<= 2; /* Temp1[9:8]: HRS[9:8] */ Tempax |= Tempbx; /* Tempax[4:0]: VRE[4:0] */
Temp1 |= Tempax; /* Temp1[9:0]: HRS[9:0] */ Temp2 = Temp1 & 0x7E0; /* Temp2[10:5]: VRS[10:5] */
Temp2 |= Tempax; /* Temp2[10:5]: VRE[10:5] */
Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[4]; /* CR5 HRE */
Tempax &= 0x1F; /* Tempax[4:0]: HRE[4:0] */ Temp3 = Temp1 & 0x1F; /* Temp3[4:0]: VRS[4:0] */
if (Tempax < Temp3) /* VRE < VRS */
Tempbx = pVBInfo->XGINEWUB_CRT1Table[index].CR[6]; /* SRC */ Temp2 |= 0x20; /* VRE + 0x20 */
Tempbx &= 0x04; /* Tempbx[2]: HRE[5] */
Tempbx <<= 3; /* Tempbx[5]: HRE[5] */ Temp2 &= 0xFF;
Tempax |= Tempbx; /* Tempax[5:0]: HRE[5:0] */ Tempax = (unsigned char) Temp2; /* Tempax: VRE[7:0] */
Tempax <<= 2; /* Tempax[7:0]; VRE[5:0]00 */
Temp2 = Temp1 & 0x3C0; /* Temp2[9:6]: HRS[9:6] */ Temp1 &= 0x600; /* Temp1[10:9]: VRS[10:9] */
Temp2 |= Tempax; /* Temp2[9:0]: HRE[9:0] */ Temp1 >>= 9; /* Temp1[1:0]: VRS[10:9] */
Tempbx = (unsigned char) Temp1;
Tempcx &= 0x3F; /* Tempcx[5:0]: HRS[5:0] */ Tempax |= Tempbx; /* Tempax[7:0]: VRE[5:0]VRS[10:9] */
if (Tempax < Tempcx) /* HRE < HRS */ Tempax &= 0x7F;
Temp2 |= 0x40; /* Temp2 + 0x40 */ /* SR3F D[7:2]->VRE D[1:0]->VRS */
xgifb_reg_set(pVBInfo->P3c4, 0x3F, Tempax);
Temp2 &= 0xFF;
Tempax = (unsigned char) Temp2; /* Tempax: HRE[7:0] */
Tempax <<= 2; /* Tempax[7:2]: HRE[5:0] */
Tempdx >>= 6; /* Tempdx[7:6]->[1:0] HRS[9:8] */
Tempax |= Tempdx; /* HRE[5:0]HRS[9:8] */
/* SR2F D[7:2]->HRE, D[1:0]->HRS */
xgifb_reg_set(pVBInfo->P3c4, 0x2F, Tempax);
xgifb_reg_and_or(pVBInfo->P3c4, 0x30, 0xE3, 00);
/* CR10 VRS */
Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[10];
Tempbx = Tempax; /* Tempbx: VRS */
Tempax &= 0x01; /* Tempax[0]: VRS[0] */
xgifb_reg_or(pVBInfo->P3c4, 0x33, Tempax); /* SR33[0]->VRS[0] */
/* CR7[2][7] VRE */
Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[9];
Tempcx = Tempbx >> 1; /* Tempcx[6:0]: VRS[7:1] */
Tempdx = Tempax & 0x04; /* Tempdx[2]: CR7[2] */
Tempdx <<= 5; /* Tempdx[7]: VRS[8] */
Tempcx |= Tempdx; /* Tempcx[7:0]: VRS[8:1] */
xgifb_reg_set(pVBInfo->P3c4, 0x34, Tempcx); /* SR34[8:1]->VRS */
Temp1 = Tempdx; /* Temp1[7]: Tempdx[7] */
Temp1 <<= 1; /* Temp1[8]: VRS[8] */
Temp1 |= Tempbx; /* Temp1[8:0]: VRS[8:0] */
Tempax &= 0x80;
Temp2 = Tempax << 2; /* Temp2[9]: VRS[9] */
Temp1 |= Temp2; /* Temp1[9:0]: VRS[9:0] */
/* Tempax: SRA */
Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[14];
Tempax &= 0x08; /* Tempax[3]: VRS[3] */
Temp2 = Tempax;
Temp2 <<= 7; /* Temp2[10]: VRS[10] */
Temp1 |= Temp2; /* Temp1[10:0]: VRS[10:0] */
/* Tempax: CR11 VRE */
Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[11];
Tempax &= 0x0F; /* Tempax[3:0]: VRE[3:0] */
/* Tempbx: SRA */
Tempbx = pVBInfo->XGINEWUB_CRT1Table[index].CR[14];
Tempbx &= 0x20; /* Tempbx[5]: VRE[5] */
Tempbx >>= 1; /* Tempbx[4]: VRE[4] */
Tempax |= Tempbx; /* Tempax[4:0]: VRE[4:0] */
Temp2 = Temp1 & 0x7E0; /* Temp2[10:5]: VRS[10:5] */
Temp2 |= Tempax; /* Temp2[10:5]: VRE[10:5] */
Temp3 = Temp1 & 0x1F; /* Temp3[4:0]: VRS[4:0] */
if (Tempax < Temp3) /* VRE < VRS */
Temp2 |= 0x20; /* VRE + 0x20 */
Temp2 &= 0xFF;
Tempax = (unsigned char) Temp2; /* Tempax: VRE[7:0] */
Tempax <<= 2; /* Tempax[7:0]; VRE[5:0]00 */
Temp1 &= 0x600; /* Temp1[10:9]: VRS[10:9] */
Temp1 >>= 9; /* Temp1[1:0]: VRS[10:9] */
Tempbx = (unsigned char) Temp1;
Tempax |= Tempbx; /* Tempax[7:0]: VRE[5:0]VRS[10:9] */
Tempax &= 0x7F;
/* SR3F D[7:2]->VRE D[1:0]->VRS */
xgifb_reg_set(pVBInfo->P3c4, 0x3F, Tempax);
}
} }
static void XGI_SetXG27CRTC(unsigned short ModeNo, static void XGI_SetXG27CRTC(unsigned short ModeNo,
...@@ -793,139 +713,88 @@ static void XGI_SetXG27CRTC(unsigned short ModeNo, ...@@ -793,139 +713,88 @@ static void XGI_SetXG27CRTC(unsigned short ModeNo,
unsigned short RefreshRateTableIndex, unsigned short RefreshRateTableIndex,
struct vb_device_info *pVBInfo) struct vb_device_info *pVBInfo)
{ {
unsigned short StandTableIndex, index, Tempax, Tempbx, Tempcx, Tempdx; unsigned short index, Tempax, Tempbx, Tempcx;
if (ModeNo <= 0x13) { index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
StandTableIndex = XGI_GetModePtr(ModeNo, ModeIdIndex, pVBInfo); /* Tempax: CR4 HRS */
/* CR04 HRS */ Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[3];
Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[4]; Tempbx = Tempax; /* Tempbx: HRS[7:0] */
/* SR2E [7:0]->HRS */ /* SR2E[7:0]->HRS */
xgifb_reg_set(pVBInfo->P3c4, 0x2E, Tempax); xgifb_reg_set(pVBInfo->P3c4, 0x2E, Tempax);
/* Tempbx: CR05 HRE */
Tempbx = pVBInfo->StandTable[StandTableIndex].CRTC[5]; /* SR0B */
Tempbx &= 0x1F; /* Tempbx: HRE[4:0] */ Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[5];
Tempcx = Tempax; Tempax &= 0xC0; /* Tempax[7:6]: SR0B[7:6]: HRS[9:8]*/
Tempcx &= 0xE0; /* Tempcx: HRS[7:5] */ Tempbx |= (Tempax << 2); /* Tempbx: HRS[9:0] */
Tempdx = Tempcx | Tempbx; /* Tempdx(HRE): HRS[7:5]HRE[4:0] */
if (Tempbx < (Tempax & 0x1F)) /* IF HRE < HRS */ Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[4]; /* CR5 HRE */
Tempdx |= 0x20; /* Tempdx: HRE = HRE + 0x20 */ Tempax &= 0x1F; /* Tempax[4:0]: HRE[4:0] */
Tempdx <<= 2; /* Tempdx << 2 */ Tempcx = Tempax; /* Tempcx: HRE[4:0] */
/* SR2F [7:2]->HRE */
xgifb_reg_set(pVBInfo->P3c4, 0x2F, Tempdx); Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[6]; /* SRC */
xgifb_reg_and_or(pVBInfo->P3c4, 0x30, 0xE3, 00); Tempax &= 0x04; /* Tempax[2]: HRE[5] */
Tempax <<= 3; /* Tempax[5]: HRE[5] */
/* Tempax: CR10 VRS */ Tempcx |= Tempax; /* Tempcx[5:0]: HRE[5:0] */
Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[16];
xgifb_reg_set(pVBInfo->P3c4, 0x34, Tempax); /* SR34[7:0]->VRS */ Tempbx = Tempbx & 0x3C0; /* Tempbx[9:6]: HRS[9:6] */
Tempcx = Tempax; /* Tempcx=Tempax=VRS[7:0] */ Tempbx |= Tempcx; /* Tempbx: HRS[9:6]HRE[5:0] */
/* Tempax[7][2]: CR7[7][2] VRS[9][8] */
Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[7]; /* Tempax: CR4 HRS */
Tempbx = Tempax; /* Tempbx=CR07 */ Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[3];
Tempax &= 0x04; /* Tempax[2]: CR07[2] VRS[8] */ Tempax &= 0x3F; /* Tempax: HRS[5:0] */
Tempax >>= 2; if (Tempcx <= Tempax) /* HRE[5:0] < HRS[5:0] */
/* SR35 D[0]->VRS D[8] */ Tempbx += 0x40; /* Tempbx= Tempbx + 0x40 : HRE[9:0]*/
xgifb_reg_and_or(pVBInfo->P3c4, 0x35, ~0x01, Tempax);
Tempcx |= (Tempax << 8); /* Tempcx[8] |= VRS[8] */ Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[5]; /* SR0B */
Tempcx |= (Tempbx & 0x80) << 2; /* Tempcx[9] |= VRS[9] */ Tempax &= 0xC0; /* Tempax[7:6]: SR0B[7:6]: HRS[9:8]*/
Tempax >>= 6; /* Tempax[1:0]: HRS[9:8]*/
/* CR11 VRE */ Tempax |= ((Tempbx << 2) & 0xFF); /* Tempax[7:2]: HRE[5:0] */
Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[17]; /* SR2F [7:2][1:0]: HRE[5:0]HRS[9:8] */
Tempax &= 0x0F; /* Tempax: VRE[3:0] */ xgifb_reg_set(pVBInfo->P3c4, 0x2F, Tempax);
Tempbx = Tempcx; /* Tempbx=Tempcx=VRS[9:0] */ xgifb_reg_and_or(pVBInfo->P3c4, 0x30, 0xE3, 00);
Tempbx &= 0x3F0; /* Tempbx[9:4]: VRS[9:4] */
Tempbx |= Tempax; /* Tempbx[9:0]: VRE[9:0] */ /* CR10 VRS */
if (Tempax <= (Tempcx & 0x0F)) /* VRE[3:0]<=VRS[3:0] */ Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[10];
Tempbx |= 0x10; /* Tempbx: VRE + 0x10 */ /* SR34[7:0]->VRS[7:0] */
/* Tempax[7:0]: VRE[7:0] */ xgifb_reg_set(pVBInfo->P3c4, 0x34, Tempax);
Tempax = (unsigned char) Tempbx & 0xFF;
Tempax <<= 2; /* Tempax << 2: VRE[5:0] */ Tempcx = Tempax; /* Tempcx <= VRS[7:0] */
Tempcx = (Tempcx & 0x600) >> 8; /* Tempcx VRS[10:9] */ /* CR7[7][2] VRS[9][8] */
/* SR3F D[7:2]->VRE D[5:0] */ Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[9];
xgifb_reg_and_or(pVBInfo->P3c4, 0x3F, ~0xFC, Tempax); Tempbx = Tempax; /* Tempbx <= CR07[7:0] */
/* SR35 D[2:1]->VRS[10:9] */ Tempax = Tempax & 0x04; /* Tempax[2]: CR7[2]: VRS[8] */
xgifb_reg_and_or(pVBInfo->P3c4, 0x35, ~0x06, Tempcx); Tempax >>= 2; /* Tempax[0]: VRS[8] */
} else { /* SR35[0]: VRS[8] */
index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; xgifb_reg_and_or(pVBInfo->P3c4, 0x35, ~0x01, Tempax);
/* Tempax: CR4 HRS */ Tempcx |= (Tempax << 8); /* Tempcx <= VRS[8:0] */
Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[3]; Tempcx |= ((Tempbx & 0x80) << 2); /* Tempcx <= VRS[9:0] */
Tempbx = Tempax; /* Tempbx: HRS[7:0] */ /* Tempax: SR0A */
/* SR2E[7:0]->HRS */ Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[14];
xgifb_reg_set(pVBInfo->P3c4, 0x2E, Tempax); Tempax &= 0x08; /* SR0A[3] VRS[10] */
Tempcx |= (Tempax << 7); /* Tempcx <= VRS[10:0] */
/* SR0B */
Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[5]; /* Tempax: CR11 VRE */
Tempax &= 0xC0; /* Tempax[7:6]: SR0B[7:6]: HRS[9:8]*/ Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[11];
Tempbx |= (Tempax << 2); /* Tempbx: HRS[9:0] */ Tempax &= 0x0F; /* Tempax[3:0]: VRE[3:0] */
/* Tempbx: SR0A */
Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[4]; /* CR5 HRE */ Tempbx = pVBInfo->XGINEWUB_CRT1Table[index].CR[14];
Tempax &= 0x1F; /* Tempax[4:0]: HRE[4:0] */ Tempbx &= 0x20; /* Tempbx[5]: SR0A[5]: VRE[4] */
Tempcx = Tempax; /* Tempcx: HRE[4:0] */ Tempbx >>= 1; /* Tempbx[4]: VRE[4] */
Tempax |= Tempbx; /* Tempax[4:0]: VRE[4:0] */
Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[6]; /* SRC */ Tempbx = Tempcx; /* Tempbx: VRS[10:0] */
Tempax &= 0x04; /* Tempax[2]: HRE[5] */ Tempbx &= 0x7E0; /* Tempbx[10:5]: VRS[10:5] */
Tempax <<= 3; /* Tempax[5]: HRE[5] */ Tempbx |= Tempax; /* Tempbx: VRS[10:5]VRE[4:0] */
Tempcx |= Tempax; /* Tempcx[5:0]: HRE[5:0] */
if (Tempbx <= Tempcx) /* VRE <= VRS */
Tempbx = Tempbx & 0x3C0; /* Tempbx[9:6]: HRS[9:6] */ Tempbx |= 0x20; /* VRE + 0x20 */
Tempbx |= Tempcx; /* Tempbx: HRS[9:6]HRE[5:0] */
/* Tempax: Tempax[7:0]; VRE[5:0]00 */
/* Tempax: CR4 HRS */ Tempax = (Tempbx << 2) & 0xFF;
Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[3]; /* SR3F[7:2]:VRE[5:0] */
Tempax &= 0x3F; /* Tempax: HRS[5:0] */ xgifb_reg_and_or(pVBInfo->P3c4, 0x3F, ~0xFC, Tempax);
if (Tempcx <= Tempax) /* HRE[5:0] < HRS[5:0] */ Tempax = Tempcx >> 8;
Tempbx += 0x40; /* Tempbx= Tempbx + 0x40 : HRE[9:0]*/ /* SR35[2:0]:VRS[10:8] */
xgifb_reg_and_or(pVBInfo->P3c4, 0x35, ~0x07, Tempax);
Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[5]; /* SR0B */
Tempax &= 0xC0; /* Tempax[7:6]: SR0B[7:6]: HRS[9:8]*/
Tempax >>= 6; /* Tempax[1:0]: HRS[9:8]*/
Tempax |= ((Tempbx << 2) & 0xFF); /* Tempax[7:2]: HRE[5:0] */
/* SR2F [7:2][1:0]: HRE[5:0]HRS[9:8] */
xgifb_reg_set(pVBInfo->P3c4, 0x2F, Tempax);
xgifb_reg_and_or(pVBInfo->P3c4, 0x30, 0xE3, 00);
/* CR10 VRS */
Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[10];
/* SR34[7:0]->VRS[7:0] */
xgifb_reg_set(pVBInfo->P3c4, 0x34, Tempax);
Tempcx = Tempax; /* Tempcx <= VRS[7:0] */
/* CR7[7][2] VRS[9][8] */
Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[9];
Tempbx = Tempax; /* Tempbx <= CR07[7:0] */
Tempax = Tempax & 0x04; /* Tempax[2]: CR7[2]: VRS[8] */
Tempax >>= 2; /* Tempax[0]: VRS[8] */
/* SR35[0]: VRS[8] */
xgifb_reg_and_or(pVBInfo->P3c4, 0x35, ~0x01, Tempax);
Tempcx |= (Tempax << 8); /* Tempcx <= VRS[8:0] */
Tempcx |= ((Tempbx & 0x80) << 2); /* Tempcx <= VRS[9:0] */
/* Tempax: SR0A */
Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[14];
Tempax &= 0x08; /* SR0A[3] VRS[10] */
Tempcx |= (Tempax << 7); /* Tempcx <= VRS[10:0] */
/* Tempax: CR11 VRE */
Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[11];
Tempax &= 0x0F; /* Tempax[3:0]: VRE[3:0] */
/* Tempbx: SR0A */
Tempbx = pVBInfo->XGINEWUB_CRT1Table[index].CR[14];
Tempbx &= 0x20; /* Tempbx[5]: SR0A[5]: VRE[4] */
Tempbx >>= 1; /* Tempbx[4]: VRE[4] */
Tempax |= Tempbx; /* Tempax[4:0]: VRE[4:0] */
Tempbx = Tempcx; /* Tempbx: VRS[10:0] */
Tempbx &= 0x7E0; /* Tempbx[10:5]: VRS[10:5] */
Tempbx |= Tempax; /* Tempbx: VRS[10:5]VRE[4:0] */
if (Tempbx <= Tempcx) /* VRE <= VRS */
Tempbx |= 0x20; /* VRE + 0x20 */
/* Tempax: Tempax[7:0]; VRE[5:0]00 */
Tempax = (Tempbx << 2) & 0xFF;
/* SR3F[7:2]:VRE[5:0] */
xgifb_reg_and_or(pVBInfo->P3c4, 0x3F, ~0xFC, Tempax);
Tempax = Tempcx >> 8;
/* SR35[2:0]:VRS[10:8] */
xgifb_reg_and_or(pVBInfo->P3c4, 0x35, ~0x07, Tempax);
}
} }
static void XGI_SetXG27FPBits(struct vb_device_info *pVBInfo) static void XGI_SetXG27FPBits(struct vb_device_info *pVBInfo)
...@@ -947,7 +816,7 @@ static void xgifb_set_lcd(int chip_id, ...@@ -947,7 +816,7 @@ static void xgifb_set_lcd(int chip_id,
unsigned short RefreshRateTableIndex, unsigned short RefreshRateTableIndex,
unsigned short ModeNo) unsigned short ModeNo)
{ {
unsigned short Data, Temp, b3CC; unsigned short Data, Temp;
unsigned short XGI_P3cc; unsigned short XGI_P3cc;
XGI_P3cc = pVBInfo->P3cc; XGI_P3cc = pVBInfo->P3cc;
...@@ -988,23 +857,13 @@ static void xgifb_set_lcd(int chip_id, ...@@ -988,23 +857,13 @@ static void xgifb_set_lcd(int chip_id,
xgifb_reg_and(pVBInfo->P3c4, 0x30, ~0x20); /* Hsync polarity */ xgifb_reg_and(pVBInfo->P3c4, 0x30, ~0x20); /* Hsync polarity */
xgifb_reg_and(pVBInfo->P3c4, 0x35, ~0x80); /* Vsync polarity */ xgifb_reg_and(pVBInfo->P3c4, 0x35, ~0x80); /* Vsync polarity */
if (ModeNo <= 0x13) { Data = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag;
b3CC = (unsigned char) inb(XGI_P3cc); if (Data & 0x4000)
if (b3CC & 0x40) /* Hsync polarity */
/* Hsync polarity */ xgifb_reg_or(pVBInfo->P3c4, 0x30, 0x20);
xgifb_reg_or(pVBInfo->P3c4, 0x30, 0x20); if (Data & 0x8000)
if (b3CC & 0x80) /* Vsync polarity */
/* Vsync polarity */ xgifb_reg_or(pVBInfo->P3c4, 0x35, 0x80);
xgifb_reg_or(pVBInfo->P3c4, 0x35, 0x80);
} else {
Data = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag;
if (Data & 0x4000)
/* Hsync polarity */
xgifb_reg_or(pVBInfo->P3c4, 0x30, 0x20);
if (Data & 0x8000)
/* Vsync polarity */
xgifb_reg_or(pVBInfo->P3c4, 0x35, 0x80);
}
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
...@@ -1017,30 +876,22 @@ static void XGI_UpdateXG21CRTC(unsigned short ModeNo, ...@@ -1017,30 +876,22 @@ static void XGI_UpdateXG21CRTC(unsigned short ModeNo,
struct vb_device_info *pVBInfo, struct vb_device_info *pVBInfo,
unsigned short RefreshRateTableIndex) unsigned short RefreshRateTableIndex)
{ {
int i, index = -1; int index = -1;
xgifb_reg_and(pVBInfo->P3d4, 0x11, 0x7F); /* Unlock CR0~7 */ xgifb_reg_and(pVBInfo->P3d4, 0x11, 0x7F); /* Unlock CR0~7 */
if (ModeNo <= 0x13) { if (ModeNo == 0x2E &&
for (i = 0; i < 12; i++) { (pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC ==
if (ModeNo == pVBInfo->UpdateCRT1[i].ModeID) RES640x480x60))
index = i; index = 12;
} else if (ModeNo == 0x2E && (pVBInfo->RefIndex[RefreshRateTableIndex].
} else {
if (ModeNo == 0x2E &&
(pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC ==
RES640x480x60))
index = 12;
else if (ModeNo == 0x2E &&
(pVBInfo->RefIndex[RefreshRateTableIndex].
Ext_CRT1CRTC == RES640x480x72)) Ext_CRT1CRTC == RES640x480x72))
index = 13; index = 13;
else if (ModeNo == 0x2F) else if (ModeNo == 0x2F)
index = 14; index = 14;
else if (ModeNo == 0x50) else if (ModeNo == 0x50)
index = 15; index = 15;
else if (ModeNo == 0x59) else if (ModeNo == 0x59)
index = 16; index = 16;
}
if (index != -1) { if (index != -1) {
xgifb_reg_set(pVBInfo->P3d4, 0x02, xgifb_reg_set(pVBInfo->P3d4, 0x02,
...@@ -1057,15 +908,8 @@ static void XGI_UpdateXG21CRTC(unsigned short ModeNo, ...@@ -1057,15 +908,8 @@ static void XGI_UpdateXG21CRTC(unsigned short ModeNo,
static unsigned short XGI_GetResInfo(unsigned short ModeNo, static unsigned short XGI_GetResInfo(unsigned short ModeNo,
unsigned short ModeIdIndex, struct vb_device_info *pVBInfo) unsigned short ModeIdIndex, struct vb_device_info *pVBInfo)
{ {
unsigned short resindex; /* si+Ext_ResInfo */
return pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
if (ModeNo <= 0x13)
/* si+St_ResInfo */
resindex = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo;
else
/* si+Ext_ResInfo */
resindex = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
return resindex;
} }
static void XGI_SetCRT1DE(struct xgi_hw_device_info *HwDeviceExtension, static void XGI_SetCRT1DE(struct xgi_hw_device_info *HwDeviceExtension,
...@@ -1079,31 +923,23 @@ static void XGI_SetCRT1DE(struct xgi_hw_device_info *HwDeviceExtension, ...@@ -1079,31 +923,23 @@ static void XGI_SetCRT1DE(struct xgi_hw_device_info *HwDeviceExtension,
resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo); resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo);
if (ModeNo <= 0x13) { modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; tempax = pVBInfo->ModeResInfo[resindex].HTotal;
tempax = pVBInfo->StResInfo[resindex].HTotal; tempbx = pVBInfo->ModeResInfo[resindex].VTotal;
tempbx = pVBInfo->StResInfo[resindex].VTotal;
} else {
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
tempax = pVBInfo->ModeResInfo[resindex].HTotal;
tempbx = pVBInfo->ModeResInfo[resindex].VTotal;
}
if (modeflag & HalfDCLK) if (modeflag & HalfDCLK)
tempax = tempax >> 1; tempax = tempax >> 1;
if (ModeNo > 0x13) { if (modeflag & HalfDCLK)
if (modeflag & HalfDCLK) tempax = tempax << 1;
tempax = tempax << 1;
temp = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag; temp = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag;
if (temp & InterlaceMode) if (temp & InterlaceMode)
tempbx = tempbx >> 1; tempbx = tempbx >> 1;
if (modeflag & DoubleScanMode) if (modeflag & DoubleScanMode)
tempbx = tempbx << 1; tempbx = tempbx << 1;
}
tempcx = 8; tempcx = 8;
...@@ -1251,18 +1087,10 @@ static unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo, ...@@ -1251,18 +1087,10 @@ static unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo,
unsigned short CRT2Index, VCLKIndex; unsigned short CRT2Index, VCLKIndex;
unsigned short modeflag, resinfo; unsigned short modeflag, resinfo;
if (ModeNo <= 0x13) { /* si+Ext_ResInfo */
/* si+St_ResInfo */ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
resinfo = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo; CRT2Index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
CRT2Index = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC;
} else {
/* si+Ext_ResInfo */
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
CRT2Index = pVBInfo->RefIndex[RefreshRateTableIndex].
Ext_CRT2CRTC;
}
if (pVBInfo->IF_DEF_LVDS == 0) { if (pVBInfo->IF_DEF_LVDS == 0) {
CRT2Index = CRT2Index >> 6; /* for LCD */ CRT2Index = CRT2Index >> 6; /* for LCD */
...@@ -1311,23 +1139,13 @@ static unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo, ...@@ -1311,23 +1139,13 @@ static unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo,
VCLKIndex += 25; VCLKIndex += 25;
} }
} else { /* for CRT2 */ } else { /* for CRT2 */
/* Port 3cch */ /* di+Ext_CRTVCLK */
VCLKIndex = (unsigned char) inb((pVBInfo->P3ca + 0x02)); VCLKIndex = pVBInfo->RefIndex[RefreshRateTableIndex].
VCLKIndex = ((VCLKIndex >> 2) & 0x03);
if (ModeNo > 0x13) {
/* di+Ext_CRTVCLK */
VCLKIndex = pVBInfo->RefIndex[
RefreshRateTableIndex].
Ext_CRTVCLK; Ext_CRTVCLK;
VCLKIndex &= IndexMask; VCLKIndex &= IndexMask;
}
} }
} else { /* LVDS */ } else { /* LVDS */
if (ModeNo <= 0x13) VCLKIndex = CRT2Index;
VCLKIndex = CRT2Index;
else
VCLKIndex = CRT2Index;
VCLKIndex = VCLKIndex >> 6; VCLKIndex = VCLKIndex >> 6;
if ((pVBInfo->LCDResInfo == Panel_800x600) || if ((pVBInfo->LCDResInfo == Panel_800x600) ||
(pVBInfo->LCDResInfo == Panel_320x480)) (pVBInfo->LCDResInfo == Panel_320x480))
...@@ -1424,27 +1242,13 @@ static void XGI_SetCRT1FIFO(unsigned short ModeNo, ...@@ -1424,27 +1242,13 @@ static void XGI_SetCRT1FIFO(unsigned short ModeNo,
data &= 0xfe; data &= 0xfe;
xgifb_reg_set(pVBInfo->P3c4, 0x3D, data); /* diable auto-threshold */ xgifb_reg_set(pVBInfo->P3c4, 0x3D, data); /* diable auto-threshold */
if (ModeNo > 0x13) { xgifb_reg_set(pVBInfo->P3c4, 0x08, 0x34);
xgifb_reg_set(pVBInfo->P3c4, 0x08, 0x34); data = xgifb_reg_get(pVBInfo->P3c4, 0x09);
data = xgifb_reg_get(pVBInfo->P3c4, 0x09); data &= 0xC0;
data &= 0xC0; xgifb_reg_set(pVBInfo->P3c4, 0x09, data | 0x30);
xgifb_reg_set(pVBInfo->P3c4, 0x09, data | 0x30); data = xgifb_reg_get(pVBInfo->P3c4, 0x3D);
data = xgifb_reg_get(pVBInfo->P3c4, 0x3D); data |= 0x01;
data |= 0x01; xgifb_reg_set(pVBInfo->P3c4, 0x3D, data);
xgifb_reg_set(pVBInfo->P3c4, 0x3D, data);
} else {
if (HwDeviceExtension->jChipType == XG27) {
xgifb_reg_set(pVBInfo->P3c4, 0x08, 0x0E);
data = xgifb_reg_get(pVBInfo->P3c4, 0x09);
data &= 0xC0;
xgifb_reg_set(pVBInfo->P3c4, 0x09, data | 0x20);
} else {
xgifb_reg_set(pVBInfo->P3c4, 0x08, 0xAE);
data = xgifb_reg_get(pVBInfo->P3c4, 0x09);
data &= 0xF0;
xgifb_reg_set(pVBInfo->P3c4, 0x09, data);
}
}
if (HwDeviceExtension->jChipType == XG21) if (HwDeviceExtension->jChipType == XG21)
XGI_SetXG21FPBits(pVBInfo); /* Fix SR9[7:6] can't read back */ XGI_SetXG21FPBits(pVBInfo); /* Fix SR9[7:6] can't read back */
...@@ -1459,13 +1263,9 @@ static void XGI_SetVCLKState(struct xgi_hw_device_info *HwDeviceExtension, ...@@ -1459,13 +1263,9 @@ static void XGI_SetVCLKState(struct xgi_hw_device_info *HwDeviceExtension,
unsigned char index; unsigned char index;
if (ModeNo <= 0x13) index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
VCLK = 0; index &= IndexMask;
else { VCLK = pVBInfo->VCLKData[index].CLOCK;
index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
index &= IndexMask;
VCLK = pVBInfo->VCLKData[index].CLOCK;
}
data = xgifb_reg_get(pVBInfo->P3c4, 0x32); data = xgifb_reg_get(pVBInfo->P3c4, 0x32);
data &= 0xf3; data &= 0xf3;
...@@ -1501,31 +1301,20 @@ static void XGI_SetCRT1ModeRegs(struct xgi_hw_device_info *HwDeviceExtension, ...@@ -1501,31 +1301,20 @@ static void XGI_SetCRT1ModeRegs(struct xgi_hw_device_info *HwDeviceExtension,
unsigned short data, data2, data3, infoflag = 0, modeflag, resindex, unsigned short data, data2, data3, infoflag = 0, modeflag, resindex,
xres; xres;
if (ModeNo > 0x13) { modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; infoflag = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag;
infoflag = pVBInfo->RefIndex[RefreshRateTableIndex].
Ext_InfoFlag;
} else
/* si+St_ModeFlag */
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
if (xgifb_reg_get(pVBInfo->P3d4, 0x31) & 0x01) if (xgifb_reg_get(pVBInfo->P3d4, 0x31) & 0x01)
xgifb_reg_and_or(pVBInfo->P3c4, 0x1F, 0x3F, 0x00); xgifb_reg_and_or(pVBInfo->P3c4, 0x1F, 0x3F, 0x00);
if (ModeNo > 0x13) data = infoflag;
data = infoflag;
else
data = 0;
data2 = 0; data2 = 0;
if (ModeNo > 0x13) { if (pVBInfo->ModeType > 0x02) {
if (pVBInfo->ModeType > 0x02) { data2 |= 0x02;
data2 |= 0x02; data3 = pVBInfo->ModeType - ModeVGA;
data3 = pVBInfo->ModeType - ModeVGA; data3 = data3 << 2;
data3 = data3 << 2; data2 |= data3;
data2 |= data3;
}
} }
data &= InterlaceMode; data &= InterlaceMode;
...@@ -1535,10 +1324,7 @@ static void XGI_SetCRT1ModeRegs(struct xgi_hw_device_info *HwDeviceExtension, ...@@ -1535,10 +1324,7 @@ static void XGI_SetCRT1ModeRegs(struct xgi_hw_device_info *HwDeviceExtension,
xgifb_reg_and_or(pVBInfo->P3c4, 0x06, ~0x3F, data2); xgifb_reg_and_or(pVBInfo->P3c4, 0x06, ~0x3F, data2);
resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo); resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo);
if (ModeNo <= 0x13) xres = pVBInfo->ModeResInfo[resindex].HTotal; /* xres->ax */
xres = pVBInfo->StResInfo[resindex].HTotal;
else
xres = pVBInfo->ModeResInfo[resindex].HTotal; /* xres->ax */
data = 0x0000; data = 0x0000;
if (infoflag & InterlaceMode) { if (infoflag & InterlaceMode) {
...@@ -1561,10 +1347,8 @@ static void XGI_SetCRT1ModeRegs(struct xgi_hw_device_info *HwDeviceExtension, ...@@ -1561,10 +1347,8 @@ static void XGI_SetCRT1ModeRegs(struct xgi_hw_device_info *HwDeviceExtension,
if (modeflag & LineCompareOff) if (modeflag & LineCompareOff)
data2 |= 0x08; data2 |= 0x08;
if (ModeNo > 0x13) { if (pVBInfo->ModeType == ModeEGA)
if (pVBInfo->ModeType == ModeEGA) data2 |= 0x40;
data2 |= 0x40;
}
xgifb_reg_and_or(pVBInfo->P3c4, 0x0F, ~0x48, data2); xgifb_reg_and_or(pVBInfo->P3c4, 0x0F, ~0x48, data2);
data = 0x60; data = 0x60;
...@@ -1641,11 +1425,7 @@ static void XGI_LoadDAC(unsigned short ModeNo, unsigned short ModeIdIndex, ...@@ -1641,11 +1425,7 @@ static void XGI_LoadDAC(unsigned short ModeNo, unsigned short ModeIdIndex,
ah, dh; ah, dh;
const unsigned short *table = NULL; const unsigned short *table = NULL;
if (ModeNo <= 0x13) data = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
data = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
else
data = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
data &= DACInfoFlag; data &= DACInfoFlag;
time = 64; time = 64;
...@@ -1733,34 +1513,20 @@ static void XGI_GetLVDSResInfo(unsigned short ModeNo, ...@@ -1733,34 +1513,20 @@ static void XGI_GetLVDSResInfo(unsigned short ModeNo,
{ {
unsigned short resindex, xres, yres, modeflag; unsigned short resindex, xres, yres, modeflag;
if (ModeNo <= 0x13) /* si+Ext_ResInfo */
/* si+St_ResInfo */ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo;
else
/* si+Ext_ResInfo */
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
if (ModeNo <= 0x13) /* si+Ext_ResInfo */
/* si+St_ResInfo */ resindex = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
resindex = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo;
else
/* si+Ext_ResInfo */
resindex = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
if (ModeNo <= 0x13) { xres = pVBInfo->ModeResInfo[resindex].HTotal;
xres = pVBInfo->StResInfo[resindex].HTotal; yres = pVBInfo->ModeResInfo[resindex].VTotal;
yres = pVBInfo->StResInfo[resindex].VTotal;
} else {
xres = pVBInfo->ModeResInfo[resindex].HTotal;
yres = pVBInfo->ModeResInfo[resindex].VTotal;
}
if (ModeNo > 0x13) {
if (modeflag & HalfDCLK)
xres = xres << 1;
if (modeflag & DoubleScanMode) if (modeflag & HalfDCLK)
yres = yres << 1; xres = xres << 1;
}
if (modeflag & DoubleScanMode)
yres = yres << 1;
if (xres == 720) if (xres == 720)
xres = 640; xres = 640;
...@@ -1782,32 +1548,16 @@ static void *XGI_GetLcdPtr(unsigned short BX, unsigned short ModeNo, ...@@ -1782,32 +1548,16 @@ static void *XGI_GetLcdPtr(unsigned short BX, unsigned short ModeNo,
tempbx = BX; tempbx = BX;
if (ModeNo <= 0x13) { modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
tempal = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC;
} else {
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
}
tempal = tempal & 0x0f; tempal = tempal & 0x0f;
if (tempbx <= 1) { /* ExpLink */ if (tempbx <= 1) { /* ExpLink */
if (ModeNo <= 0x13) { tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
/* find no Ext_CRT2CRTC2 */
tempal = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC;
} else {
tempal = pVBInfo->RefIndex[RefreshRateTableIndex].
Ext_CRT2CRTC;
}
if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) { if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) {
if (ModeNo <= 0x13) tempal = pVBInfo->RefIndex[RefreshRateTableIndex].
tempal = pVBInfo->SModeIDTable[ModeIdIndex].
St_CRT2CRTC2;
else
tempal = pVBInfo->RefIndex[
RefreshRateTableIndex].
Ext_CRT2CRTC2; Ext_CRT2CRTC2;
} }
...@@ -1875,9 +1625,6 @@ static void *XGI_GetLcdPtr(unsigned short BX, unsigned short ModeNo, ...@@ -1875,9 +1625,6 @@ static void *XGI_GetLcdPtr(unsigned short BX, unsigned short ModeNo,
tempbx = tempdi[i].MASK; tempbx = tempdi[i].MASK;
tempdx = pVBInfo->LCDInfo; tempdx = pVBInfo->LCDInfo;
if (ModeNo <= 0x13) /* alan 09/10/2003 */
tempdx |= SetLCDStdMode;
if (modeflag & HalfDCLK) if (modeflag & HalfDCLK)
tempdx |= SetLCDLowResolution; tempdx |= SetLCDLowResolution;
...@@ -2231,15 +1978,8 @@ static void *XGI_GetTVPtr(unsigned short BX, unsigned short ModeNo, ...@@ -2231,15 +1978,8 @@ static void *XGI_GetTVPtr(unsigned short BX, unsigned short ModeNo,
struct XGI330_TVDataTablStruct *tempdi = NULL; struct XGI330_TVDataTablStruct *tempdi = NULL;
tempbx = BX; tempbx = BX;
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
if (ModeNo <= 0x13) { tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
tempal = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC;
} else {
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
}
tempal = tempal & 0x3f; tempal = tempal & 0x3f;
table = tempbx; table = tempbx;
...@@ -2406,11 +2146,7 @@ static void XGI_ModCRT1Regs(unsigned short ModeNo, unsigned short ModeIdIndex, ...@@ -2406,11 +2146,7 @@ static void XGI_ModCRT1Regs(unsigned short ModeNo, unsigned short ModeIdIndex,
struct XGI_LVDSCRT1HDataStruct *LCDPtr = NULL; struct XGI_LVDSCRT1HDataStruct *LCDPtr = NULL;
struct XGI_LVDSCRT1VDataStruct *LCDPtr1 = NULL; struct XGI_LVDSCRT1VDataStruct *LCDPtr1 = NULL;
if (ModeNo <= 0x13) index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
index = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC;
else
index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
index = index & IndexMask; index = index & IndexMask;
tempbx = 0; tempbx = 0;
...@@ -2526,11 +2262,7 @@ static void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex, ...@@ -2526,11 +2262,7 @@ static void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
struct XGI330_LCDDataDesStruct *LCDPtr = NULL; struct XGI330_LCDDataDesStruct *LCDPtr = NULL;
struct XGI330_LCDDataDesStruct2 *LCDPtr1 = NULL; struct XGI330_LCDDataDesStruct2 *LCDPtr1 = NULL;
if (ModeNo > 0x13) modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
else
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
tempbx = 3; tempbx = 3;
if (pVBInfo->LCDInfo & EnableScalingLCD) if (pVBInfo->LCDInfo & EnableScalingLCD)
LCDPtr1 = LCDPtr1 =
...@@ -2822,12 +2554,8 @@ static unsigned char XGI_GetVCLKPtr(unsigned short RefreshRateTableIndex, ...@@ -2822,12 +2554,8 @@ static unsigned char XGI_GetVCLKPtr(unsigned short RefreshRateTableIndex,
unsigned short index, modeflag; unsigned short index, modeflag;
unsigned char tempal; unsigned char tempal;
if (ModeNo <= 0x13) /* si+Ext_ResInfo */
/* si+St_ResInfo */ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
else
/* si+Ext_ResInfo */
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
if ((pVBInfo->SetFlag & ProgrammingCRT2) && if ((pVBInfo->SetFlag & ProgrammingCRT2) &&
(!(pVBInfo->LCDInfo & EnableScalingLCD))) { /* {LCDA/LCDB} */ (!(pVBInfo->LCDInfo & EnableScalingLCD))) { /* {LCDA/LCDB} */
...@@ -2888,9 +2616,6 @@ static unsigned char XGI_GetVCLKPtr(unsigned short RefreshRateTableIndex, ...@@ -2888,9 +2616,6 @@ static unsigned char XGI_GetVCLKPtr(unsigned short RefreshRateTableIndex,
if ((pVBInfo->LCDInfo & EnableScalingLCD) && (modeflag & Charx8Dot)) if ((pVBInfo->LCDInfo & EnableScalingLCD) && (modeflag & Charx8Dot))
tempal = tempal ^ tempal; /* ; set to VCLK25MHz always */ tempal = tempal ^ tempal; /* ; set to VCLK25MHz always */
if (ModeNo <= 0x13)
return tempal;
tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
return tempal; return tempal;
} }
...@@ -3072,11 +2797,7 @@ static void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex, ...@@ -3072,11 +2797,7 @@ static void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
{ {
unsigned short tempax, push, tempbx, temp, modeflag; unsigned short tempax, push, tempbx, temp, modeflag;
if (ModeNo <= 0x13) modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
else
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
pVBInfo->SetFlag = 0; pVBInfo->SetFlag = 0;
pVBInfo->ModeType = modeflag & ModeTypeMask; pVBInfo->ModeType = modeflag & ModeTypeMask;
tempbx = 0; tempbx = 0;
...@@ -3276,17 +2997,8 @@ static void XGI_GetTVInfo(unsigned short ModeNo, unsigned short ModeIdIndex, ...@@ -3276,17 +2997,8 @@ static void XGI_GetTVInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
resinfo = 0; resinfo = 0;
if (pVBInfo->VBInfo & SetCRT2ToTV) { if (pVBInfo->VBInfo & SetCRT2ToTV) {
if (ModeNo <= 0x13) { modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
modeflag = pVBInfo->SModeIDTable[ModeIdIndex]. resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
St_ModeFlag; /* si+St_ModeFlag */
resinfo = pVBInfo->SModeIDTable[ModeIdIndex].
St_ResInfo; /* si+St_ResInfo */
} else {
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].
Ext_ModeFlag;
resinfo = pVBInfo->EModeIDTable[ModeIdIndex].
Ext_RESINFO; /* si+Ext_ResInfo */
}
if (pVBInfo->VBInfo & SetCRT2ToTV) { if (pVBInfo->VBInfo & SetCRT2ToTV) {
temp = xgifb_reg_get(pVBInfo->P3d4, 0x35); temp = xgifb_reg_get(pVBInfo->P3d4, 0x35);
...@@ -3373,15 +3085,9 @@ static unsigned char XGI_GetLCDInfo(unsigned short ModeNo, ...@@ -3373,15 +3085,9 @@ static unsigned char XGI_GetLCDInfo(unsigned short ModeNo,
pVBInfo->LCDTypeInfo = 0; pVBInfo->LCDTypeInfo = 0;
pVBInfo->LCDInfo = 0; pVBInfo->LCDInfo = 0;
if (ModeNo <= 0x13) { modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
/* si+St_ModeFlag // */ /* si+Ext_ResInfo // */
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
} else {
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
/* si+Ext_ResInfo // */
resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
}
temp = xgifb_reg_get(pVBInfo->P3d4, 0x36); /* Get LCD Res.Info */ temp = xgifb_reg_get(pVBInfo->P3d4, 0x36); /* Get LCD Res.Info */
tempbx = temp & 0x0F; tempbx = temp & 0x0F;
...@@ -3435,8 +3141,8 @@ static unsigned char XGI_GetLCDInfo(unsigned short ModeNo, ...@@ -3435,8 +3141,8 @@ static unsigned char XGI_GetLCDInfo(unsigned short ModeNo,
if (pVBInfo->IF_DEF_LVDS == 0) { if (pVBInfo->IF_DEF_LVDS == 0) {
if ((pVBInfo->LCDResInfo == Panel_1400x1050) && (pVBInfo->VBInfo if ((pVBInfo->LCDResInfo == Panel_1400x1050) && (pVBInfo->VBInfo
& SetCRT2ToLCD) && (ModeNo > 0x13) && (resinfo & SetCRT2ToLCD) && (resinfo == 9) &&
== 9) && (!(tempbx & EnableScalingLCD))) (!(tempbx & EnableScalingLCD)))
/* set to center in 1280x1024 LCDB for Panel_1400x1050 */ /* set to center in 1280x1024 LCDB for Panel_1400x1050 */
tempbx |= SetLCDtoNonExpanding; tempbx |= SetLCDtoNonExpanding;
} }
...@@ -3446,12 +3152,9 @@ static unsigned char XGI_GetLCDInfo(unsigned short ModeNo, ...@@ -3446,12 +3152,9 @@ static unsigned char XGI_GetLCDInfo(unsigned short ModeNo,
if (!(tempbx & SetLCDtoNonExpanding)) { if (!(tempbx & SetLCDtoNonExpanding)) {
tempbx |= XGI_EnableLVDSDDA; tempbx |= XGI_EnableLVDSDDA;
} else { } else {
if (ModeNo > 0x13) { if (pVBInfo->LCDResInfo == Panel_1024x768) {
if (pVBInfo->LCDResInfo if (resinfo == 4) {/* 512x384 */
== Panel_1024x768) { tempbx |= XGI_EnableLVDSDDA;
if (resinfo == 4) {/* 512x384 */
tempbx |= XGI_EnableLVDSDDA;
}
} }
} }
} }
...@@ -3467,56 +3170,17 @@ static unsigned char XGI_GetLCDInfo(unsigned short ModeNo, ...@@ -3467,56 +3170,17 @@ static unsigned char XGI_GetLCDInfo(unsigned short ModeNo,
pVBInfo->LCDInfo = tempbx; pVBInfo->LCDInfo = tempbx;
if (pVBInfo->IF_DEF_LVDS == 0) {
if (tempax & (LockLCDBToA | StLCDBToA)) {
if (pVBInfo->VBInfo & SetInSlaveMode) {
if (!(tempax & LockLCDBToA)) {
if (ModeNo <= 0x13) {
pVBInfo->VBInfo &=
~(SetSimuScanMode |
SetInSlaveMode |
SetCRT2ToLCD);
pVBInfo->VBInfo |=
XGI_SetCRT2ToLCDA |
SetCRT2ToDualEdge;
}
}
}
}
}
return 1; return 1;
} }
unsigned char XGI_SearchModeID(unsigned short ModeNo, unsigned char XGI_SearchModeID(unsigned short ModeNo,
unsigned short *ModeIdIndex, struct vb_device_info *pVBInfo) unsigned short *ModeIdIndex, struct vb_device_info *pVBInfo)
{ {
if (ModeNo <= 5) for (*ModeIdIndex = 0;; (*ModeIdIndex)++) {
ModeNo |= 1; if (pVBInfo->EModeIDTable[*ModeIdIndex].Ext_ModeID == ModeNo)
if (ModeNo <= 0x13) { break;
for (*ModeIdIndex = 0;; (*ModeIdIndex)++) { if (pVBInfo->EModeIDTable[*ModeIdIndex].Ext_ModeID == 0xFF)
if (pVBInfo->SModeIDTable[*ModeIdIndex].St_ModeID == return 0;
ModeNo)
break;
if (pVBInfo->SModeIDTable[*ModeIdIndex].St_ModeID ==
0xFF)
return 0;
}
if (ModeNo == 0x07)
(*ModeIdIndex)++; /* 400 lines */
if (ModeNo <= 3)
(*ModeIdIndex) += 2; /* 400 lines */
/* else 350 lines */
} else {
for (*ModeIdIndex = 0;; (*ModeIdIndex)++) {
if (pVBInfo->EModeIDTable[*ModeIdIndex].Ext_ModeID ==
ModeNo)
break;
if (pVBInfo->EModeIDTable[*ModeIdIndex].Ext_ModeID ==
0xFF)
return 0;
}
} }
return 1; return 1;
...@@ -3783,21 +3447,16 @@ static void XGI_GetCRT2ResInfo(unsigned short ModeNo, ...@@ -3783,21 +3447,16 @@ static void XGI_GetCRT2ResInfo(unsigned short ModeNo,
unsigned short xres, yres, modeflag, resindex; unsigned short xres, yres, modeflag, resindex;
resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo); resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo);
if (ModeNo <= 0x13) { xres = pVBInfo->ModeResInfo[resindex].HTotal; /* xres->ax */
xres = pVBInfo->StResInfo[resindex].HTotal; yres = pVBInfo->ModeResInfo[resindex].VTotal; /* yres->bx */
yres = pVBInfo->StResInfo[resindex].VTotal; /* si+St_ModeFlag */
} else { modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
xres = pVBInfo->ModeResInfo[resindex].HTotal; /* xres->ax */
yres = pVBInfo->ModeResInfo[resindex].VTotal; /* yres->bx */
/* si+St_ModeFlag */
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
if (modeflag & HalfDCLK) if (modeflag & HalfDCLK)
xres *= 2; xres *= 2;
if (modeflag & DoubleScanMode) if (modeflag & DoubleScanMode)
yres *= 2; yres *= 2;
}
if (pVBInfo->VBInfo & SetCRT2ToLCD) { if (pVBInfo->VBInfo & SetCRT2ToLCD) {
if (pVBInfo->IF_DEF_LVDS == 0) { if (pVBInfo->IF_DEF_LVDS == 0) {
...@@ -3861,37 +3520,23 @@ static void XGI_GetRAMDAC2DATA(unsigned short ModeNo, ...@@ -3861,37 +3520,23 @@ static void XGI_GetRAMDAC2DATA(unsigned short ModeNo,
struct vb_device_info *pVBInfo) struct vb_device_info *pVBInfo)
{ {
unsigned short tempax, tempbx, temp1, temp2, modeflag = 0, tempcx, unsigned short tempax, tempbx, temp1, temp2, modeflag = 0, tempcx,
StandTableIndex, CRT1Index; CRT1Index;
pVBInfo->RVBHCMAX = 1; pVBInfo->RVBHCMAX = 1;
pVBInfo->RVBHCFACT = 1; pVBInfo->RVBHCFACT = 1;
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
if (ModeNo <= 0x13) { CRT1Index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; CRT1Index &= IndexMask;
StandTableIndex = XGI_GetModePtr(ModeNo, ModeIdIndex, pVBInfo); temp1 = (unsigned short) pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[0];
tempax = pVBInfo->StandTable[StandTableIndex].CRTC[0]; temp2 = (unsigned short) pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[5];
tempbx = pVBInfo->StandTable[StandTableIndex].CRTC[6]; tempax = (temp1 & 0xFF) | ((temp2 & 0x03) << 8);
temp1 = pVBInfo->StandTable[StandTableIndex].CRTC[7]; tempbx = (unsigned short) pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[8];
} else { tempcx = (unsigned short)
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[14] << 8;
CRT1Index = pVBInfo->RefIndex[RefreshRateTableIndex]. tempcx &= 0x0100;
Ext_CRT1CRTC; tempcx = tempcx << 2;
CRT1Index &= IndexMask; tempbx |= tempcx;
temp1 = (unsigned short) pVBInfo-> temp1 = (unsigned short) pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[9];
XGINEWUB_CRT1Table[CRT1Index].CR[0];
temp2 = (unsigned short) pVBInfo->
XGINEWUB_CRT1Table[CRT1Index].CR[5];
tempax = (temp1 & 0xFF) | ((temp2 & 0x03) << 8);
tempbx = (unsigned short) pVBInfo->
XGINEWUB_CRT1Table[CRT1Index].CR[8];
tempcx = (unsigned short) pVBInfo->
XGINEWUB_CRT1Table[CRT1Index].CR[14] << 8;
tempcx &= 0x0100;
tempcx = tempcx << 2;
tempbx |= tempcx;
temp1 = (unsigned short) pVBInfo->
XGINEWUB_CRT1Table[CRT1Index].CR[9];
}
if (temp1 & 0x01) if (temp1 & 0x01)
tempbx |= 0x0100; tempbx |= 0x0100;
...@@ -3921,16 +3566,9 @@ static void XGI_GetCRT2Data(unsigned short ModeNo, unsigned short ModeIdIndex, ...@@ -3921,16 +3566,9 @@ static void XGI_GetCRT2Data(unsigned short ModeNo, unsigned short ModeIdIndex,
struct SiS_LCDData *LCDPtr = NULL; struct SiS_LCDData *LCDPtr = NULL;
struct SiS_TVData *TVPtr = NULL; struct SiS_TVData *TVPtr = NULL;
if (ModeNo <= 0x13) { /* si+Ext_ResInfo */
/* si+St_ResInfo */ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
resinfo = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo;
} else {
/* si+Ext_ResInfo */
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
}
pVBInfo->NewFlickerMode = 0; pVBInfo->NewFlickerMode = 0;
pVBInfo->RVBHRS = 50; pVBInfo->RVBHRS = 50;
...@@ -4134,11 +3772,7 @@ static unsigned short XGI_GetColorDepth(unsigned short ModeNo, ...@@ -4134,11 +3772,7 @@ static unsigned short XGI_GetColorDepth(unsigned short ModeNo,
short index; short index;
unsigned short modeflag; unsigned short modeflag;
if (ModeNo <= 0x13) modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
else
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
index = (modeflag & ModeTypeMask) - ModeEGA; index = (modeflag & ModeTypeMask) - ModeEGA;
if (index < 0) if (index < 0)
...@@ -4157,11 +3791,7 @@ static unsigned short XGI_GetOffset(unsigned short ModeNo, ...@@ -4157,11 +3791,7 @@ static unsigned short XGI_GetOffset(unsigned short ModeNo,
ColorDepth[] = { 0x01, 0x02, 0x04 }; ColorDepth[] = { 0x01, 0x02, 0x04 };
modeinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeInfo; modeinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeInfo;
if (ModeNo <= 0x14) infoflag = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag;
infoflag = 0;
else
infoflag = pVBInfo->
RefIndex[RefreshRateTableIndex].Ext_InfoFlag;
index = (modeinfo >> 8) & 0xFF; index = (modeinfo >> 8) & 0xFF;
...@@ -4221,12 +3851,9 @@ static void XGI_PreSetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex, ...@@ -4221,12 +3851,9 @@ static void XGI_PreSetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex,
{ {
unsigned short tempcx = 0, CRT1Index = 0, resinfo = 0; unsigned short tempcx = 0, CRT1Index = 0, resinfo = 0;
if (ModeNo > 0x13) { CRT1Index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
CRT1Index = pVBInfo-> CRT1Index &= IndexMask;
RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
CRT1Index &= IndexMask;
resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
}
XGI_SetCRT2Offset(ModeNo, ModeIdIndex, RefreshRateTableIndex, XGI_SetCRT2Offset(ModeNo, ModeIdIndex, RefreshRateTableIndex,
HwDeviceExtension, pVBInfo); HwDeviceExtension, pVBInfo);
...@@ -4247,17 +3874,10 @@ static void XGI_SetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex, ...@@ -4247,17 +3874,10 @@ static void XGI_SetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex,
unsigned short temp = 0, tempax = 0, tempbx = 0, tempcx = 0, unsigned short temp = 0, tempax = 0, tempbx = 0, tempcx = 0,
pushbx = 0, CRT1Index = 0, modeflag, resinfo = 0; pushbx = 0, CRT1Index = 0, modeflag, resinfo = 0;
if (ModeNo > 0x13) { CRT1Index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
CRT1Index = pVBInfo-> CRT1Index &= IndexMask;
RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
CRT1Index &= IndexMask; modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
}
if (ModeNo <= 0x13)
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
else
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
/* bainy change table name */ /* bainy change table name */
if (modeflag & HalfDCLK) { if (modeflag & HalfDCLK) {
...@@ -4415,18 +4035,11 @@ static void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex, ...@@ -4415,18 +4035,11 @@ static void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
unsigned short push1, push2, tempax, tempbx = 0, tempcx, temp, resinfo, unsigned short push1, push2, tempax, tempbx = 0, tempcx, temp, resinfo,
modeflag, CRT1Index; modeflag, CRT1Index;
if (ModeNo <= 0x13) { /* si+Ext_ResInfo */
/* si+St_ResInfo */ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
resinfo = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo; CRT1Index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
} else { CRT1Index &= IndexMask;
/* si+Ext_ResInfo */
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
CRT1Index = pVBInfo->
RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
CRT1Index &= IndexMask;
}
if (!(pVBInfo->VBInfo & SetInSlaveMode)) if (!(pVBInfo->VBInfo & SetInSlaveMode))
return; return;
...@@ -4493,8 +4106,7 @@ static void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex, ...@@ -4493,8 +4106,7 @@ static void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
temp -= 6; temp -= 6;
if (pVBInfo->TVInfo & TVSimuMode) { if (pVBInfo->TVInfo & TVSimuMode) {
temp -= 4; temp -= 4;
if (ModeNo > 0x13) temp -= 10;
temp -= 10;
} }
} }
} else { } else {
...@@ -4539,48 +4151,7 @@ static void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex, ...@@ -4539,48 +4151,7 @@ static void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
if (pVBInfo->VBInfo & SetCRT2ToTV) { if (pVBInfo->VBInfo & SetCRT2ToTV) {
if (pVBInfo->TVInfo & TVSimuMode) { if (pVBInfo->TVInfo & TVSimuMode) {
if ((ModeNo == 0x06) || (ModeNo == 0x10) || (ModeNo if (ModeNo == 0x50) {
== 0x11) || (ModeNo == 0x13) || (ModeNo
== 0x0F)) {
xgifb_reg_set(pVBInfo->Part1Port, 0x07, 0x5b);
xgifb_reg_set(pVBInfo->Part1Port, 0x08, 0x03);
}
if ((ModeNo == 0x00) || (ModeNo == 0x01)) {
if (pVBInfo->TVInfo & SetNTSCTV) {
xgifb_reg_set(pVBInfo->Part1Port,
0x07, 0x2A);
xgifb_reg_set(pVBInfo->Part1Port,
0x08, 0x61);
} else {
xgifb_reg_set(pVBInfo->Part1Port,
0x07, 0x2A);
xgifb_reg_set(pVBInfo->Part1Port,
0x08, 0x41);
xgifb_reg_set(pVBInfo->Part1Port,
0x0C, 0xF0);
}
}
if ((ModeNo == 0x02) || (ModeNo == 0x03) || (ModeNo
== 0x07)) {
if (pVBInfo->TVInfo & SetNTSCTV) {
xgifb_reg_set(pVBInfo->Part1Port,
0x07, 0x54);
xgifb_reg_set(pVBInfo->Part1Port,
0x08, 0x00);
} else {
xgifb_reg_set(pVBInfo->Part1Port,
0x07, 0x55);
xgifb_reg_set(pVBInfo->Part1Port,
0x08, 0x00);
xgifb_reg_set(pVBInfo->Part1Port,
0x0C, 0xF0);
}
}
if ((ModeNo == 0x04) || (ModeNo == 0x05) || (ModeNo
== 0x0D) || (ModeNo == 0x50)) {
if (pVBInfo->TVInfo & SetNTSCTV) { if (pVBInfo->TVInfo & SetNTSCTV) {
xgifb_reg_set(pVBInfo->Part1Port, xgifb_reg_set(pVBInfo->Part1Port,
0x07, 0x30); 0x07, 0x30);
...@@ -4789,18 +4360,10 @@ static void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex, ...@@ -4789,18 +4360,10 @@ static void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
unsigned long longtemp, tempeax, tempebx, temp2, tempecx; unsigned long longtemp, tempeax, tempebx, temp2, tempecx;
if (ModeNo <= 0x13) { /* si+Ext_ResInfo */
/* si+St_ResInfo */ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
resinfo = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo; crt2crtc = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
crt2crtc = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC;
} else {
/* si+Ext_ResInfo */
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
crt2crtc = pVBInfo->RefIndex[RefreshRateTableIndex].
Ext_CRT2CRTC;
}
tempax = 0; tempax = 0;
...@@ -5238,18 +4801,11 @@ static void XGI_SetLCDRegs(unsigned short ModeNo, unsigned short ModeIdIndex, ...@@ -5238,18 +4801,11 @@ static void XGI_SetLCDRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
struct XGI_LCDDesStruct *LCDBDesPtr = NULL; struct XGI_LCDDesStruct *LCDBDesPtr = NULL;
if (ModeNo <= 0x13) { /* si+Ext_ResInfo */
/* si+St_ResInfo */ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
resinfo = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo; CRT1Index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
} else { CRT1Index &= IndexMask;
/* si+Ext_ResInfo */
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
CRT1Index = pVBInfo->RefIndex[RefreshRateTableIndex].
Ext_CRT1CRTC;
CRT1Index &= IndexMask;
}
if (!(pVBInfo->VBInfo & SetCRT2ToLCD)) if (!(pVBInfo->VBInfo & SetCRT2ToLCD))
return; return;
...@@ -5535,12 +5091,8 @@ static void XGI_SetGroup3(unsigned short ModeNo, unsigned short ModeIdIndex, ...@@ -5535,12 +5091,8 @@ static void XGI_SetGroup3(unsigned short ModeNo, unsigned short ModeIdIndex,
unsigned char *tempdi; unsigned char *tempdi;
unsigned short modeflag; unsigned short modeflag;
if (ModeNo <= 0x13) /* si+Ext_ResInfo */
/* si+St_ResInfo */ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
else
/* si+Ext_ResInfo */
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
xgifb_reg_set(pVBInfo->Part3Port, 0x00, 0x00); xgifb_reg_set(pVBInfo->Part3Port, 0x00, 0x00);
if (pVBInfo->TVInfo & TVSetPAL) { if (pVBInfo->TVInfo & TVSetPAL) {
...@@ -5598,13 +5150,8 @@ static void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex, ...@@ -5598,13 +5150,8 @@ static void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex,
unsigned long tempebx, tempeax, templong; unsigned long tempebx, tempeax, templong;
if (ModeNo <= 0x13) /* si+Ext_ResInfo */
/* si+St_ResInfo */ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
else
/* si+Ext_ResInfo */
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
temp = pVBInfo->RVBHCFACT; temp = pVBInfo->RVBHCFACT;
xgifb_reg_set(pVBInfo->Part4Port, 0x13, temp); xgifb_reg_set(pVBInfo->Part4Port, 0x13, temp);
...@@ -5812,31 +5359,21 @@ static unsigned char XGI_XG21CheckLVDSMode(struct xgifb_video_info *xgifb_info, ...@@ -5812,31 +5359,21 @@ static unsigned char XGI_XG21CheckLVDSMode(struct xgifb_video_info *xgifb_info,
unsigned short xres, yres, colordepth, modeflag, resindex; unsigned short xres, yres, colordepth, modeflag, resindex;
resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo); resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo);
if (ModeNo <= 0x13) { xres = pVBInfo->ModeResInfo[resindex].HTotal; /* xres->ax */
xres = pVBInfo->StResInfo[resindex].HTotal; yres = pVBInfo->ModeResInfo[resindex].VTotal; /* yres->bx */
yres = pVBInfo->StResInfo[resindex].VTotal; /* si+St_ModeFlag */
/* si+St_ResInfo */ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
} else {
xres = pVBInfo->ModeResInfo[resindex].HTotal; /* xres->ax */
yres = pVBInfo->ModeResInfo[resindex].VTotal; /* yres->bx */
/* si+St_ModeFlag */
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
}
if (!(modeflag & Charx8Dot)) { if (!(modeflag & Charx8Dot)) {
xres /= 9; xres /= 9;
xres *= 8; xres *= 8;
} }
if (ModeNo > 0x13) { if ((ModeNo > 0x13) && (modeflag & HalfDCLK))
if ((ModeNo > 0x13) && (modeflag & HalfDCLK)) xres *= 2;
xres *= 2;
if ((ModeNo > 0x13) && (modeflag & DoubleScanMode))
yres *= 2;
} if ((ModeNo > 0x13) && (modeflag & DoubleScanMode))
yres *= 2;
if (xres > xgifb_info->lvds_data.LVDSHDE) if (xres > xgifb_info->lvds_data.LVDSHDE)
return 0; return 0;
...@@ -5844,16 +5381,11 @@ static unsigned char XGI_XG21CheckLVDSMode(struct xgifb_video_info *xgifb_info, ...@@ -5844,16 +5381,11 @@ static unsigned char XGI_XG21CheckLVDSMode(struct xgifb_video_info *xgifb_info,
if (yres > xgifb_info->lvds_data.LVDSVDE) if (yres > xgifb_info->lvds_data.LVDSVDE)
return 0; return 0;
if (ModeNo > 0x13) { if (xres != xgifb_info->lvds_data.LVDSHDE ||
if (xres != xgifb_info->lvds_data.LVDSHDE || yres != xgifb_info->lvds_data.LVDSVDE) {
yres != xgifb_info->lvds_data.LVDSVDE) { colordepth = XGI_GetColorDepth(ModeNo, ModeIdIndex, pVBInfo);
colordepth = XGI_GetColorDepth(ModeNo, if (colordepth > 2)
ModeIdIndex, return 0;
pVBInfo);
if (colordepth > 2)
return 0;
}
} }
return 1; return 1;
} }
...@@ -5889,17 +5421,10 @@ static void xgifb_set_lvds(struct xgifb_video_info *xgifb_info, ...@@ -5889,17 +5421,10 @@ static void xgifb_set_lvds(struct xgifb_video_info *xgifb_info,
XGI_SetXG21FPBits(pVBInfo); XGI_SetXG21FPBits(pVBInfo);
resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo); resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo);
if (ModeNo <= 0x13) { xres = pVBInfo->ModeResInfo[resindex].HTotal; /* xres->ax */
xres = pVBInfo->StResInfo[resindex].HTotal; yres = pVBInfo->ModeResInfo[resindex].VTotal; /* yres->bx */
yres = pVBInfo->StResInfo[resindex].VTotal; /* si+St_ModeFlag */
/* si+St_ResInfo */ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
} else {
xres = pVBInfo->ModeResInfo[resindex].HTotal; /* xres->ax */
yres = pVBInfo->ModeResInfo[resindex].VTotal; /* yres->bx */
/* si+St_ModeFlag */
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
}
if (!(modeflag & Charx8Dot)) if (!(modeflag & Charx8Dot))
xres = xres * 8 / 9; xres = xres * 8 / 9;
...@@ -5907,8 +5432,6 @@ static void xgifb_set_lvds(struct xgifb_video_info *xgifb_info, ...@@ -5907,8 +5432,6 @@ static void xgifb_set_lvds(struct xgifb_video_info *xgifb_info,
LVDSHT = xgifb_info->lvds_data.LVDSHT; LVDSHT = xgifb_info->lvds_data.LVDSHT;
LVDSHBS = xres + (xgifb_info->lvds_data.LVDSHDE - xres) / 2; LVDSHBS = xres + (xgifb_info->lvds_data.LVDSHDE - xres) / 2;
if ((ModeNo <= 0x13) && (modeflag & HalfDCLK))
LVDSHBS -= xres / 4;
if (LVDSHBS > LVDSHT) if (LVDSHBS > LVDSHT)
LVDSHBS -= LVDSHT; LVDSHBS -= LVDSHT;
...@@ -5926,7 +5449,7 @@ static void xgifb_set_lvds(struct xgifb_video_info *xgifb_info, ...@@ -5926,7 +5449,7 @@ static void xgifb_set_lvds(struct xgifb_video_info *xgifb_info,
LVDSVT = xgifb_info->lvds_data.LVDSVT; LVDSVT = xgifb_info->lvds_data.LVDSVT;
LVDSVBS = yres + (xgifb_info->lvds_data.LVDSVDE - yres) / 2; LVDSVBS = yres + (xgifb_info->lvds_data.LVDSVDE - yres) / 2;
if ((ModeNo > 0x13) && (modeflag & DoubleScanMode)) if (modeflag & DoubleScanMode)
LVDSVBS += yres / 2; LVDSVBS += yres / 2;
if (LVDSVBS > LVDSVT) if (LVDSVBS > LVDSVT)
...@@ -6529,12 +6052,7 @@ static void XGI_SetAntiFlicker(unsigned short ModeNo, ...@@ -6529,12 +6052,7 @@ static void XGI_SetAntiFlicker(unsigned short ModeNo,
tempbx = XGI_GetTVPtrIndex(pVBInfo); tempbx = XGI_GetTVPtrIndex(pVBInfo);
tempbx &= 0xFE; tempbx &= 0xFE;
index = pVBInfo->EModeIDTable[ModeIdIndex].VB_ExtTVFlickerIndex;
if (ModeNo <= 0x13)
index = pVBInfo->SModeIDTable[ModeIdIndex].VB_StTVFlickerIndex;
else
index = pVBInfo->EModeIDTable[ModeIdIndex].VB_ExtTVFlickerIndex;
tempbx += index; tempbx += index;
tempah = TVAntiFlickList[tempbx]; tempah = TVAntiFlickList[tempbx];
tempah = tempah << 4; tempah = tempah << 4;
...@@ -6552,12 +6070,7 @@ static void XGI_SetEdgeEnhance(unsigned short ModeNo, ...@@ -6552,12 +6070,7 @@ static void XGI_SetEdgeEnhance(unsigned short ModeNo,
tempbx = XGI_GetTVPtrIndex(pVBInfo); tempbx = XGI_GetTVPtrIndex(pVBInfo);
tempbx &= 0xFE; tempbx &= 0xFE;
index = pVBInfo->EModeIDTable[ModeIdIndex].VB_ExtTVEdgeIndex;
if (ModeNo <= 0x13)
index = pVBInfo->SModeIDTable[ModeIdIndex].VB_StTVEdgeIndex;
else
index = pVBInfo->EModeIDTable[ModeIdIndex].VB_ExtTVEdgeIndex;
tempbx += index; tempbx += index;
tempah = TVEdgeList[tempbx]; tempah = TVEdgeList[tempbx];
tempah = tempah << 5; tempah = tempah << 5;
...@@ -6624,13 +6137,7 @@ static void XGI_SetYFilter(unsigned short ModeNo, unsigned short ModeIdIndex, ...@@ -6624,13 +6137,7 @@ static void XGI_SetYFilter(unsigned short ModeNo, unsigned short ModeIdIndex,
return; return;
} }
if (ModeNo <= 0x13) tempal = pVBInfo->EModeIDTable[ModeIdIndex].VB_ExtTVYFilterIndex;
tempal = pVBInfo->SModeIDTable[ModeIdIndex].
VB_StTVYFilterIndex;
else
tempal = pVBInfo->EModeIDTable[ModeIdIndex].
VB_ExtTVYFilterIndex;
if (tempcl == 0) if (tempcl == 0)
index = tempal * 4; index = tempal * 4;
else else
...@@ -6705,16 +6212,14 @@ static void XGI_SetCRT2ModeRegs(unsigned short ModeNo, ...@@ -6705,16 +6212,14 @@ static void XGI_SetCRT2ModeRegs(unsigned short ModeNo,
if (pVBInfo->VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToTV if (pVBInfo->VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToTV
| SetCRT2ToLCD)) { | SetCRT2ToLCD)) {
tempah = 0x40; /* BTDRAM */ tempah = 0x40; /* BTDRAM */
if (ModeNo > 0x13) { tempcl = pVBInfo->ModeType;
tempcl = pVBInfo->ModeType; tempcl -= ModeVGA;
tempcl -= ModeVGA; if (tempcl >= 0) {
if (tempcl >= 0) { /* BT Color */
/* BT Color */ tempah = (0x008 >> tempcl);
tempah = (0x008 >> tempcl); if (tempah == 0)
if (tempah == 0) tempah = 1;
tempah = 1; tempah |= 0x040;
tempah |= 0x040;
}
} }
if (pVBInfo->VBInfo & SetInSlaveMode) if (pVBInfo->VBInfo & SetInSlaveMode)
tempah ^= 0x50; /* BTDAC */ tempah ^= 0x50; /* BTDAC */
...@@ -6790,10 +6295,8 @@ static void XGI_SetCRT2ModeRegs(unsigned short ModeNo, ...@@ -6790,10 +6295,8 @@ static void XGI_SetCRT2ModeRegs(unsigned short ModeNo,
if (pVBInfo->VBInfo & SetCRT2ToTV) { if (pVBInfo->VBInfo & SetCRT2ToTV) {
tempah |= 0x020; tempah |= 0x020;
if (ModeNo > 0x13) { if (pVBInfo->VBInfo & DriverMode)
if (pVBInfo->VBInfo & DriverMode) tempah = tempah ^ 0x20;
tempah = tempah ^ 0x20;
}
} }
xgifb_reg_and_or(pVBInfo->Part4Port, 0x0D, ~0x0BF, tempah); xgifb_reg_and_or(pVBInfo->Part4Port, 0x0D, ~0x0BF, tempah);
...@@ -6918,13 +6421,7 @@ unsigned short XGI_GetRatePtrCRT2(struct xgi_hw_device_info *pXGIHWDE, ...@@ -6918,13 +6421,7 @@ unsigned short XGI_GetRatePtrCRT2(struct xgi_hw_device_info *pXGIHWDE,
unsigned short RefreshRateTableIndex, i, modeflag, index, temp; unsigned short RefreshRateTableIndex, i, modeflag, index, temp;
if (ModeNo <= 0x13) modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
else
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
if (ModeNo < 0x14)
return 0xFFFF;
index = xgifb_reg_get(pVBInfo->P3d4, 0x33); index = xgifb_reg_get(pVBInfo->P3d4, 0x33);
index = index >> pVBInfo->SelectCRT2Rate; index = index >> pVBInfo->SelectCRT2Rate;
...@@ -7290,9 +6787,7 @@ static void XGI_SetCRT1Group(struct xgifb_video_info *xgifb_info, ...@@ -7290,9 +6787,7 @@ static void XGI_SetCRT1Group(struct xgifb_video_info *xgifb_info,
unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short ModeNo, unsigned short ModeIdIndex,
struct vb_device_info *pVBInfo) struct vb_device_info *pVBInfo)
{ {
unsigned short StandTableIndex, RefreshRateTableIndex, b3CC, temp; unsigned short StandTableIndex, RefreshRateTableIndex, temp;
unsigned short XGINew_P3cc = pVBInfo->P3cc;
StandTableIndex = XGI_GetModePtr(ModeNo, ModeIdIndex, pVBInfo); StandTableIndex = XGI_GetModePtr(ModeNo, ModeIdIndex, pVBInfo);
XGI_SetSeqRegs(ModeNo, StandTableIndex, ModeIdIndex, pVBInfo); XGI_SetSeqRegs(ModeNo, StandTableIndex, ModeIdIndex, pVBInfo);
...@@ -7333,22 +6828,6 @@ static void XGI_SetCRT1Group(struct xgifb_video_info *xgifb_info, ...@@ -7333,22 +6828,6 @@ static void XGI_SetCRT1Group(struct xgifb_video_info *xgifb_info,
RefreshRateTableIndex, pVBInfo); RefreshRateTableIndex, pVBInfo);
} }
if ((HwDeviceExtension->jChipType >= XG20) &&
(HwDeviceExtension->jChipType < XG27)) { /* fix H/W DCLK/2 bug */
if ((ModeNo == 0x00) | (ModeNo == 0x01)) {
xgifb_reg_set(pVBInfo->P3c4, 0x2B, 0x4E);
xgifb_reg_set(pVBInfo->P3c4, 0x2C, 0xE9);
b3CC = (unsigned char) inb(XGINew_P3cc);
outb((b3CC |= 0x0C), XGINew_P3cc);
} else if ((ModeNo == 0x04) | (ModeNo == 0x05) | (ModeNo
== 0x0D)) {
xgifb_reg_set(pVBInfo->P3c4, 0x2B, 0x1B);
xgifb_reg_set(pVBInfo->P3c4, 0x2C, 0xE3);
b3CC = (unsigned char) inb(XGINew_P3cc);
outb((b3CC |= 0x0C), XGINew_P3cc);
}
}
if (HwDeviceExtension->jChipType >= XG21) { if (HwDeviceExtension->jChipType >= XG21) {
temp = xgifb_reg_get(pVBInfo->P3d4, 0x38); temp = xgifb_reg_get(pVBInfo->P3d4, 0x38);
if (temp & 0xA0) { if (temp & 0xA0) {
...@@ -7502,13 +6981,8 @@ unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info, ...@@ -7502,13 +6981,8 @@ unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info,
pVBInfo)) pVBInfo))
return 0; return 0;
if (ModeNo <= 0x13) { pVBInfo->ModeType = pVBInfo->EModeIDTable[ModeIdIndex].
pVBInfo->ModeType = pVBInfo->SModeIDTable[ModeIdIndex].
St_ModeFlag & ModeTypeMask;
} else {
pVBInfo->ModeType = pVBInfo->EModeIDTable[ModeIdIndex].
Ext_ModeFlag & ModeTypeMask; Ext_ModeFlag & ModeTypeMask;
}
pVBInfo->SetFlag = 0; pVBInfo->SetFlag = 0;
pVBInfo->VBInfo = DisableCRT2Display; pVBInfo->VBInfo = DisableCRT2Display;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment