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)
index = pVBInfo->SModeIDTable[ModeIdIndex].St_StTableIndex;
else {
if (pVBInfo->ModeType <= 0x02) if (pVBInfo->ModeType <= 0x02)
index = 0x1B; /* 02 -> ModeEGA */ index = 0x1B; /* 02 -> ModeEGA */
else else
index = 0x0F; index = 0x0F;
}
return index; /* Get pVBInfo->StandTable index */ return index; /* Get pVBInfo->StandTable index */
} }
...@@ -200,9 +196,6 @@ static void XGI_SetSeqRegs(unsigned short ModeNo, ...@@ -200,9 +196,6 @@ 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->SModeIDTable[ModeIdIndex].St_ModeFlag;
else
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
xgifb_reg_set(pVBInfo->P3c4, 0x00, 0x03); /* Set SR0 */ xgifb_reg_set(pVBInfo->P3c4, 0x00, 0x03); /* Set SR0 */
...@@ -254,9 +247,6 @@ static void XGI_SetATTRegs(unsigned short ModeNo, ...@@ -254,9 +247,6 @@ 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->SModeIDTable[ModeIdIndex].St_ModeFlag;
else
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
for (i = 0; i <= 0x13; i++) { for (i = 0; i <= 0x13; 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)
/* si+St_ModeFlag */
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
else
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; 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->SModeIDTable[ModeIdIndex].St_ModeFlag;
else
i = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; i = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
i &= DoubleScanMode; i &= DoubleScanMode;
if (i) if (i)
data |= 0x80; data |= 0x80;
...@@ -634,69 +615,9 @@ static void XGI_SetXG21CRTC(unsigned short ModeNo, unsigned short ModeIdIndex, ...@@ -634,69 +615,9 @@ 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) {
StandTableIndex = XGI_GetModePtr(ModeNo, ModeIdIndex, pVBInfo);
/* CR04 HRS */
Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[4];
/* SR2E [7:0]->HRS */
xgifb_reg_set(pVBInfo->P3c4, 0x2E, Tempax);
/* Tempbx: CR05 HRE */
Tempbx = pVBInfo->StandTable[StandTableIndex].CRTC[5];
Tempbx &= 0x1F; /* Tempbx: HRE[4:0] */
Tempcx = Tempax;
Tempcx &= 0xE0; /* Tempcx: HRS[7:5] */
Tempdx = Tempcx | Tempbx; /* Tempdx(HRE): HRS[7:5]HRE[4:0] */
if (Tempbx < (Tempax & 0x1F)) /* IF HRE < HRS */
Tempdx |= 0x20; /* Tempdx: HRE = HRE + 0x20 */
Tempdx <<= 2; /* Tempdx << 2 */
/* SR2F [7:2]->HRE */
xgifb_reg_set(pVBInfo->P3c4, 0x2F, Tempdx);
xgifb_reg_and_or(pVBInfo->P3c4, 0x30, 0xE3, 00);
/* Tempax: CR16 VRS */
Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[16];
Tempbx = Tempax; /* Tempbx=Tempax */
Tempax &= 0x01; /* Tempax: VRS[0] */
xgifb_reg_or(pVBInfo->P3c4, 0x33, Tempax); /* SR33[0]->VRS */
/* Tempax: CR7 VRS */
Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[7];
Tempdx = Tempbx >> 1; /* Tempdx: VRS[7:1] */
Tempcx = Tempax & 0x04; /* Tempcx: CR7[2] */
Tempcx <<= 5; /* Tempcx[7]: VRS[8] */
Tempdx |= Tempcx; /* Tempdx: VRS[8:1] */
/* SR34[7:0]: VRS[8:1] */
xgifb_reg_set(pVBInfo->P3c4, 0x34, Tempdx);
/* Temp1[8]: VRS[8] unsigned char -> unsigned short */
Temp1 = Tempcx << 1;
Temp1 |= Tempbx; /* Temp1[8:0]: VRS[8:0] */
Tempax &= 0x80; /* Tempax[7]: CR7[7] */
Temp2 = Tempax << 2; /* Temp2[9]: VRS[9] */
Temp1 |= Temp2; /* Temp1[9:0]: VRS[9:0] */
/* CR16 VRE */
Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[17];
Tempax &= 0x0F; /* Tempax[3:0]: VRE[3:0] */
Temp2 = Temp1 & 0x3F0; /* Temp2[9:4]: VRS[9:4] */
Temp2 |= Tempax; /* Temp2[9:0]: VRE[9:0] */
Temp3 = Temp1 & 0x0F; /* Temp3[3:0]: VRS[3:0] */
if (Tempax < Temp3) /* VRE[3:0]<VRS[3:0] */
Temp2 |= 0x10; /* Temp2: VRE + 0x10 */
Temp2 &= 0xFF; /* Temp2[7:0]: VRE[7:0] */
Tempax = (unsigned char) Temp2; /* Tempax[7:0]: VRE[7:0] */
Tempax <<= 2; /* Tempax << 2: VRE[5:0] */
Temp1 &= 0x600; /* Temp1[10:9]: VRS[10:9] */
Temp1 >>= 9; /* [10:9]->[1:0] */
Tempbx = (unsigned char) Temp1; /* Tempbx[1:0]: VRS[10:9] */
Tempax |= Tempbx; /* VRE[5:0]VRS[10:9] */
Tempax &= 0x7F;
/* SR3F D[7:2]->VRE D[1:0]->VRS */
xgifb_reg_set(pVBInfo->P3c4, 0x3F, Tempax);
} else {
index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
/* Tempax: CR4 HRS */ /* Tempax: CR4 HRS */
Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[3]; Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[3];
...@@ -785,7 +706,6 @@ static void XGI_SetXG21CRTC(unsigned short ModeNo, unsigned short ModeIdIndex, ...@@ -785,7 +706,6 @@ static void XGI_SetXG21CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
Tempax &= 0x7F; Tempax &= 0x7F;
/* SR3F D[7:2]->VRE D[1:0]->VRS */ /* SR3F D[7:2]->VRE D[1:0]->VRS */
xgifb_reg_set(pVBInfo->P3c4, 0x3F, Tempax); xgifb_reg_set(pVBInfo->P3c4, 0x3F, Tempax);
}
} }
static void XGI_SetXG27CRTC(unsigned short ModeNo, static void XGI_SetXG27CRTC(unsigned short ModeNo,
...@@ -793,58 +713,8 @@ static void XGI_SetXG27CRTC(unsigned short ModeNo, ...@@ -793,58 +713,8 @@ 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) {
StandTableIndex = XGI_GetModePtr(ModeNo, ModeIdIndex, pVBInfo);
/* CR04 HRS */
Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[4];
/* SR2E [7:0]->HRS */
xgifb_reg_set(pVBInfo->P3c4, 0x2E, Tempax);
/* Tempbx: CR05 HRE */
Tempbx = pVBInfo->StandTable[StandTableIndex].CRTC[5];
Tempbx &= 0x1F; /* Tempbx: HRE[4:0] */
Tempcx = Tempax;
Tempcx &= 0xE0; /* Tempcx: HRS[7:5] */
Tempdx = Tempcx | Tempbx; /* Tempdx(HRE): HRS[7:5]HRE[4:0] */
if (Tempbx < (Tempax & 0x1F)) /* IF HRE < HRS */
Tempdx |= 0x20; /* Tempdx: HRE = HRE + 0x20 */
Tempdx <<= 2; /* Tempdx << 2 */
/* SR2F [7:2]->HRE */
xgifb_reg_set(pVBInfo->P3c4, 0x2F, Tempdx);
xgifb_reg_and_or(pVBInfo->P3c4, 0x30, 0xE3, 00);
/* Tempax: CR10 VRS */
Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[16];
xgifb_reg_set(pVBInfo->P3c4, 0x34, Tempax); /* SR34[7:0]->VRS */
Tempcx = Tempax; /* Tempcx=Tempax=VRS[7:0] */
/* Tempax[7][2]: CR7[7][2] VRS[9][8] */
Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[7];
Tempbx = Tempax; /* Tempbx=CR07 */
Tempax &= 0x04; /* Tempax[2]: CR07[2] VRS[8] */
Tempax >>= 2;
/* SR35 D[0]->VRS D[8] */
xgifb_reg_and_or(pVBInfo->P3c4, 0x35, ~0x01, Tempax);
Tempcx |= (Tempax << 8); /* Tempcx[8] |= VRS[8] */
Tempcx |= (Tempbx & 0x80) << 2; /* Tempcx[9] |= VRS[9] */
/* CR11 VRE */
Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[17];
Tempax &= 0x0F; /* Tempax: VRE[3:0] */
Tempbx = Tempcx; /* Tempbx=Tempcx=VRS[9:0] */
Tempbx &= 0x3F0; /* Tempbx[9:4]: VRS[9:4] */
Tempbx |= Tempax; /* Tempbx[9:0]: VRE[9:0] */
if (Tempax <= (Tempcx & 0x0F)) /* VRE[3:0]<=VRS[3:0] */
Tempbx |= 0x10; /* Tempbx: VRE + 0x10 */
/* Tempax[7:0]: VRE[7:0] */
Tempax = (unsigned char) Tempbx & 0xFF;
Tempax <<= 2; /* Tempax << 2: VRE[5:0] */
Tempcx = (Tempcx & 0x600) >> 8; /* Tempcx VRS[10:9] */
/* SR3F D[7:2]->VRE D[5:0] */
xgifb_reg_and_or(pVBInfo->P3c4, 0x3F, ~0xFC, Tempax);
/* SR35 D[2:1]->VRS[10:9] */
xgifb_reg_and_or(pVBInfo->P3c4, 0x35, ~0x06, Tempcx);
} else {
index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
/* Tempax: CR4 HRS */ /* Tempax: CR4 HRS */
Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[3]; Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[3];
...@@ -925,7 +795,6 @@ static void XGI_SetXG27CRTC(unsigned short ModeNo, ...@@ -925,7 +795,6 @@ static void XGI_SetXG27CRTC(unsigned short ModeNo,
Tempax = Tempcx >> 8; Tempax = Tempcx >> 8;
/* SR35[2:0]:VRS[10:8] */ /* SR35[2:0]:VRS[10:8] */
xgifb_reg_and_or(pVBInfo->P3c4, 0x35, ~0x07, Tempax); 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,15 +857,6 @@ static void xgifb_set_lcd(int chip_id, ...@@ -988,15 +857,6 @@ 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) {
b3CC = (unsigned char) inb(XGI_P3cc);
if (b3CC & 0x40)
/* Hsync polarity */
xgifb_reg_or(pVBInfo->P3c4, 0x30, 0x20);
if (b3CC & 0x80)
/* Vsync polarity */
xgifb_reg_or(pVBInfo->P3c4, 0x35, 0x80);
} else {
Data = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag; Data = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag;
if (Data & 0x4000) if (Data & 0x4000)
/* Hsync polarity */ /* Hsync polarity */
...@@ -1004,7 +864,6 @@ static void xgifb_set_lcd(int chip_id, ...@@ -1004,7 +864,6 @@ static void xgifb_set_lcd(int chip_id,
if (Data & 0x8000) if (Data & 0x8000)
/* Vsync polarity */ /* Vsync polarity */
xgifb_reg_or(pVBInfo->P3c4, 0x35, 0x80); xgifb_reg_or(pVBInfo->P3c4, 0x35, 0x80);
}
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
...@@ -1017,21 +876,14 @@ static void XGI_UpdateXG21CRTC(unsigned short ModeNo, ...@@ -1017,21 +876,14 @@ 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) {
for (i = 0; i < 12; i++) {
if (ModeNo == pVBInfo->UpdateCRT1[i].ModeID)
index = i;
}
} else {
if (ModeNo == 0x2E && if (ModeNo == 0x2E &&
(pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC == (pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC ==
RES640x480x60)) RES640x480x60))
index = 12; index = 12;
else if (ModeNo == 0x2E && else if (ModeNo == 0x2E && (pVBInfo->RefIndex[RefreshRateTableIndex].
(pVBInfo->RefIndex[RefreshRateTableIndex].
Ext_CRT1CRTC == RES640x480x72)) Ext_CRT1CRTC == RES640x480x72))
index = 13; index = 13;
else if (ModeNo == 0x2F) else if (ModeNo == 0x2F)
...@@ -1040,7 +892,6 @@ static void XGI_UpdateXG21CRTC(unsigned short ModeNo, ...@@ -1040,7 +892,6 @@ static void XGI_UpdateXG21CRTC(unsigned short ModeNo,
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;
if (ModeNo <= 0x13)
/* si+St_ResInfo */
resindex = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo;
else
/* si+Ext_ResInfo */ /* si+Ext_ResInfo */
resindex = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO; return 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,20 +923,13 @@ static void XGI_SetCRT1DE(struct xgi_hw_device_info *HwDeviceExtension, ...@@ -1079,20 +923,13 @@ 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->SModeIDTable[ModeIdIndex].St_ModeFlag;
tempax = pVBInfo->StResInfo[resindex].HTotal;
tempbx = pVBInfo->StResInfo[resindex].VTotal;
} else {
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
tempax = pVBInfo->ModeResInfo[resindex].HTotal; tempax = pVBInfo->ModeResInfo[resindex].HTotal;
tempbx = pVBInfo->ModeResInfo[resindex].VTotal; 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;
...@@ -1103,7 +940,6 @@ static void XGI_SetCRT1DE(struct xgi_hw_device_info *HwDeviceExtension, ...@@ -1103,7 +940,6 @@ static void XGI_SetCRT1DE(struct xgi_hw_device_info *HwDeviceExtension,
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+St_ResInfo */
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
resinfo = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo;
CRT2Index = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC;
} else {
/* si+Ext_ResInfo */ /* si+Ext_ResInfo */
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO; resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
CRT2Index = pVBInfo->RefIndex[RefreshRateTableIndex]. CRT2Index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
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 */
VCLKIndex = (unsigned char) inb((pVBInfo->P3ca + 0x02));
VCLKIndex = ((VCLKIndex >> 2) & 0x03);
if (ModeNo > 0x13) {
/* di+Ext_CRTVCLK */ /* di+Ext_CRTVCLK */
VCLKIndex = pVBInfo->RefIndex[ VCLKIndex = pVBInfo->RefIndex[RefreshRateTableIndex].
RefreshRateTableIndex].
Ext_CRTVCLK; Ext_CRTVCLK;
VCLKIndex &= IndexMask; VCLKIndex &= IndexMask;
} }
}
} else { /* LVDS */ } else { /* LVDS */
if (ModeNo <= 0x13)
VCLKIndex = CRT2Index;
else
VCLKIndex = CRT2Index; 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,7 +1242,6 @@ static void XGI_SetCRT1FIFO(unsigned short ModeNo, ...@@ -1424,7 +1242,6 @@ 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;
...@@ -1432,19 +1249,6 @@ static void XGI_SetCRT1FIFO(unsigned short ModeNo, ...@@ -1432,19 +1249,6 @@ static void XGI_SetCRT1FIFO(unsigned short ModeNo,
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)
VCLK = 0;
else {
index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
index &= IndexMask; index &= IndexMask;
VCLK = pVBInfo->VCLKData[index].CLOCK; VCLK = pVBInfo->VCLKData[index].CLOCK;
}
data = xgifb_reg_get(pVBInfo->P3c4, 0x32); data = xgifb_reg_get(pVBInfo->P3c4, 0x32);
data &= 0xf3; data &= 0xf3;
...@@ -1501,32 +1301,21 @@ static void XGI_SetCRT1ModeRegs(struct xgi_hw_device_info *HwDeviceExtension, ...@@ -1501,32 +1301,21 @@ 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]. infoflag = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag;
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,9 +1324,6 @@ static void XGI_SetCRT1ModeRegs(struct xgi_hw_device_info *HwDeviceExtension, ...@@ -1535,9 +1324,6 @@ 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->StResInfo[resindex].HTotal;
else
xres = pVBInfo->ModeResInfo[resindex].HTotal; /* xres->ax */ xres = pVBInfo->ModeResInfo[resindex].HTotal; /* xres->ax */
data = 0x0000; data = 0x0000;
...@@ -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->SModeIDTable[ModeIdIndex].St_ModeFlag;
else
data = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; 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+St_ResInfo */
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo;
else
/* si+Ext_ResInfo */ /* si+Ext_ResInfo */
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO; modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
if (ModeNo <= 0x13)
/* si+St_ResInfo */
resindex = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo;
else
/* si+Ext_ResInfo */ /* si+Ext_ResInfo */
resindex = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO; resindex = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
if (ModeNo <= 0x13) {
xres = pVBInfo->StResInfo[resindex].HTotal;
yres = pVBInfo->StResInfo[resindex].VTotal;
} else {
xres = pVBInfo->ModeResInfo[resindex].HTotal; xres = pVBInfo->ModeResInfo[resindex].HTotal;
yres = pVBInfo->ModeResInfo[resindex].VTotal; yres = pVBInfo->ModeResInfo[resindex].VTotal;
}
if (ModeNo > 0x13) {
if (modeflag & HalfDCLK) if (modeflag & HalfDCLK)
xres = xres << 1; xres = xres << 1;
if (modeflag & DoubleScanMode) if (modeflag & DoubleScanMode)
yres = yres << 1; 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->SModeIDTable[ModeIdIndex].St_ModeFlag;
tempal = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC;
} else {
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; 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;
if (ModeNo <= 0x13) {
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
tempal = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC;
} else {
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; 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->SModeIDTable[ModeIdIndex].St_CRT2CRTC;
else
index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; 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,10 +2554,6 @@ static unsigned char XGI_GetVCLKPtr(unsigned short RefreshRateTableIndex, ...@@ -2822,10 +2554,6 @@ 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+St_ResInfo */
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
else
/* si+Ext_ResInfo */ /* si+Ext_ResInfo */
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
...@@ -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->SModeIDTable[ModeIdIndex].St_ModeFlag;
else
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; 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) {
/* si+St_ModeFlag // */
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
} else {
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
/* si+Ext_ResInfo // */ /* si+Ext_ResInfo // */
resinfo = pVBInfo->EModeIDTable[ModeIdIndex].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,9 +3152,7 @@ static unsigned char XGI_GetLCDInfo(unsigned short ModeNo, ...@@ -3446,9 +3152,7 @@ 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
== Panel_1024x768) {
if (resinfo == 4) {/* 512x384 */ if (resinfo == 4) {/* 512x384 */
tempbx |= XGI_EnableLVDSDDA; tempbx |= XGI_EnableLVDSDDA;
} }
...@@ -3456,7 +3160,6 @@ static unsigned char XGI_GetLCDInfo(unsigned short ModeNo, ...@@ -3456,7 +3160,6 @@ static unsigned char XGI_GetLCDInfo(unsigned short ModeNo,
} }
} }
} }
}
if (pVBInfo->VBInfo & SetInSlaveMode) { if (pVBInfo->VBInfo & SetInSlaveMode) {
if (pVBInfo->VBInfo & SetNotSimuMode) if (pVBInfo->VBInfo & SetNotSimuMode)
...@@ -3467,58 +3170,19 @@ static unsigned char XGI_GetLCDInfo(unsigned short ModeNo, ...@@ -3467,58 +3170,19 @@ 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)
ModeNo |= 1;
if (ModeNo <= 0x13) {
for (*ModeIdIndex = 0;; (*ModeIdIndex)++) { for (*ModeIdIndex = 0;; (*ModeIdIndex)++) {
if (pVBInfo->SModeIDTable[*ModeIdIndex].St_ModeID == if (pVBInfo->EModeIDTable[*ModeIdIndex].Ext_ModeID == ModeNo)
ModeNo)
break; break;
if (pVBInfo->SModeIDTable[*ModeIdIndex].St_ModeID == if (pVBInfo->EModeIDTable[*ModeIdIndex].Ext_ModeID == 0xFF)
0xFF)
return 0; 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,10 +3447,6 @@ static void XGI_GetCRT2ResInfo(unsigned short ModeNo, ...@@ -3783,10 +3447,6 @@ 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->StResInfo[resindex].HTotal;
yres = pVBInfo->StResInfo[resindex].VTotal;
} else {
xres = pVBInfo->ModeResInfo[resindex].HTotal; /* xres->ax */ xres = pVBInfo->ModeResInfo[resindex].HTotal; /* xres->ax */
yres = pVBInfo->ModeResInfo[resindex].VTotal; /* yres->bx */ yres = pVBInfo->ModeResInfo[resindex].VTotal; /* yres->bx */
/* si+St_ModeFlag */ /* si+St_ModeFlag */
...@@ -3797,7 +3457,6 @@ static void XGI_GetCRT2ResInfo(unsigned short ModeNo, ...@@ -3797,7 +3457,6 @@ static void XGI_GetCRT2ResInfo(unsigned short ModeNo,
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;
if (ModeNo <= 0x13) {
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
StandTableIndex = XGI_GetModePtr(ModeNo, ModeIdIndex, pVBInfo);
tempax = pVBInfo->StandTable[StandTableIndex].CRTC[0];
tempbx = pVBInfo->StandTable[StandTableIndex].CRTC[6];
temp1 = pVBInfo->StandTable[StandTableIndex].CRTC[7];
} else {
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
CRT1Index = pVBInfo->RefIndex[RefreshRateTableIndex]. CRT1Index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
Ext_CRT1CRTC;
CRT1Index &= IndexMask; CRT1Index &= IndexMask;
temp1 = (unsigned short) pVBInfo-> temp1 = (unsigned short) pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[0];
XGINEWUB_CRT1Table[CRT1Index].CR[0]; temp2 = (unsigned short) pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[5];
temp2 = (unsigned short) pVBInfo->
XGINEWUB_CRT1Table[CRT1Index].CR[5];
tempax = (temp1 & 0xFF) | ((temp2 & 0x03) << 8); tempax = (temp1 & 0xFF) | ((temp2 & 0x03) << 8);
tempbx = (unsigned short) pVBInfo-> tempbx = (unsigned short) pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[8];
XGINEWUB_CRT1Table[CRT1Index].CR[8]; tempcx = (unsigned short)
tempcx = (unsigned short) pVBInfo-> pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[14] << 8;
XGINEWUB_CRT1Table[CRT1Index].CR[14] << 8;
tempcx &= 0x0100; tempcx &= 0x0100;
tempcx = tempcx << 2; tempcx = tempcx << 2;
tempbx |= tempcx; tempbx |= tempcx;
temp1 = (unsigned short) pVBInfo-> temp1 = (unsigned short) pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[9];
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+St_ResInfo */
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
resinfo = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo;
} else {
/* si+Ext_ResInfo */ /* si+Ext_ResInfo */
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO; 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->SModeIDTable[ModeIdIndex].St_ModeFlag;
else
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; 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->
RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
CRT1Index &= IndexMask; CRT1Index &= IndexMask;
resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO; resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
}
XGI_SetCRT2Offset(ModeNo, ModeIdIndex, RefreshRateTableIndex, XGI_SetCRT2Offset(ModeNo, ModeIdIndex, RefreshRateTableIndex,
HwDeviceExtension, pVBInfo); HwDeviceExtension, pVBInfo);
...@@ -4247,16 +3874,9 @@ static void XGI_SetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex, ...@@ -4247,16 +3874,9 @@ 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->
RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
CRT1Index &= IndexMask; CRT1Index &= IndexMask;
resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO; resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
}
if (ModeNo <= 0x13)
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
else
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
/* bainy change table name */ /* bainy change table name */
...@@ -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+St_ResInfo */
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
resinfo = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo;
} else {
/* si+Ext_ResInfo */ /* si+Ext_ResInfo */
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO; resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
CRT1Index = pVBInfo-> CRT1Index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
CRT1Index &= IndexMask; CRT1Index &= IndexMask;
}
if (!(pVBInfo->VBInfo & SetInSlaveMode)) if (!(pVBInfo->VBInfo & SetInSlaveMode))
return; return;
...@@ -4493,7 +4106,6 @@ static void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex, ...@@ -4493,7 +4106,6 @@ 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;
} }
} }
...@@ -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+St_ResInfo */
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
resinfo = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo;
crt2crtc = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC;
} else {
/* si+Ext_ResInfo */ /* si+Ext_ResInfo */
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO; resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
crt2crtc = pVBInfo->RefIndex[RefreshRateTableIndex]. crt2crtc = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
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+St_ResInfo */
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
resinfo = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo;
} else {
/* si+Ext_ResInfo */ /* si+Ext_ResInfo */
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO; resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
CRT1Index = pVBInfo->RefIndex[RefreshRateTableIndex]. CRT1Index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
Ext_CRT1CRTC;
CRT1Index &= IndexMask; CRT1Index &= IndexMask;
}
if (!(pVBInfo->VBInfo & SetCRT2ToLCD)) if (!(pVBInfo->VBInfo & SetCRT2ToLCD))
return; return;
...@@ -5535,10 +5091,6 @@ static void XGI_SetGroup3(unsigned short ModeNo, unsigned short ModeIdIndex, ...@@ -5535,10 +5091,6 @@ 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+St_ResInfo */
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
else
/* si+Ext_ResInfo */ /* si+Ext_ResInfo */
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
...@@ -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+St_ResInfo */
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
else
/* si+Ext_ResInfo */ /* si+Ext_ResInfo */
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; 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,48 +5359,33 @@ static unsigned char XGI_XG21CheckLVDSMode(struct xgifb_video_info *xgifb_info, ...@@ -5812,48 +5359,33 @@ 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->StResInfo[resindex].HTotal;
yres = pVBInfo->StResInfo[resindex].VTotal;
/* si+St_ResInfo */
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
} else {
xres = pVBInfo->ModeResInfo[resindex].HTotal; /* xres->ax */ xres = pVBInfo->ModeResInfo[resindex].HTotal; /* xres->ax */
yres = pVBInfo->ModeResInfo[resindex].VTotal; /* yres->bx */ yres = pVBInfo->ModeResInfo[resindex].VTotal; /* yres->bx */
/* si+St_ModeFlag */ /* si+St_ModeFlag */
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_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)) if ((ModeNo > 0x13) && (modeflag & DoubleScanMode))
yres *= 2; yres *= 2;
}
if (xres > xgifb_info->lvds_data.LVDSHDE) if (xres > xgifb_info->lvds_data.LVDSHDE)
return 0; return 0;
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, colordepth = XGI_GetColorDepth(ModeNo, ModeIdIndex, pVBInfo);
ModeIdIndex,
pVBInfo);
if (colordepth > 2) if (colordepth > 2)
return 0; 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->StResInfo[resindex].HTotal;
yres = pVBInfo->StResInfo[resindex].VTotal;
/* si+St_ResInfo */
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
} else {
xres = pVBInfo->ModeResInfo[resindex].HTotal; /* xres->ax */ xres = pVBInfo->ModeResInfo[resindex].HTotal; /* xres->ax */
yres = pVBInfo->ModeResInfo[resindex].VTotal; /* yres->bx */ yres = pVBInfo->ModeResInfo[resindex].VTotal; /* yres->bx */
/* si+St_ModeFlag */ /* si+St_ModeFlag */
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_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;
if (ModeNo <= 0x13)
index = pVBInfo->SModeIDTable[ModeIdIndex].VB_StTVFlickerIndex;
else
index = pVBInfo->EModeIDTable[ModeIdIndex].VB_ExtTVFlickerIndex; 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;
if (ModeNo <= 0x13)
index = pVBInfo->SModeIDTable[ModeIdIndex].VB_StTVEdgeIndex;
else
index = pVBInfo->EModeIDTable[ModeIdIndex].VB_ExtTVEdgeIndex; 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,7 +6212,6 @@ static void XGI_SetCRT2ModeRegs(unsigned short ModeNo, ...@@ -6705,7 +6212,6 @@ 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) {
...@@ -6715,7 +6221,6 @@ static void XGI_SetCRT2ModeRegs(unsigned short ModeNo, ...@@ -6715,7 +6221,6 @@ static void XGI_SetCRT2ModeRegs(unsigned short ModeNo,
tempah = 1; tempah = 1;
tempah |= 0x040; tempah |= 0x040;
} }
}
if (pVBInfo->VBInfo & SetInSlaveMode) if (pVBInfo->VBInfo & SetInSlaveMode)
tempah ^= 0x50; /* BTDAC */ tempah ^= 0x50; /* BTDAC */
} }
...@@ -6790,11 +6295,9 @@ static void XGI_SetCRT2ModeRegs(unsigned short ModeNo, ...@@ -6790,11 +6295,9 @@ 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);
tempah = 0; tempah = 0;
...@@ -6918,14 +6421,8 @@ unsigned short XGI_GetRatePtrCRT2(struct xgi_hw_device_info *pXGIHWDE, ...@@ -6918,14 +6421,8 @@ 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->SModeIDTable[ModeIdIndex].St_ModeFlag;
else
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; 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;
index &= 0x0F; index &= 0x0F;
...@@ -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->SModeIDTable[ModeIdIndex].
St_ModeFlag & ModeTypeMask;
} else {
pVBInfo->ModeType = pVBInfo->EModeIDTable[ModeIdIndex]. 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