📄 init301.c
字号:
} else {#ifdef SIS315H /* ---------------------- 310 series ------------------*/ tempcx = SiS_Pr->SiS_VGAHT; /* BTVGA2HT 0x08,0x09 */ pushcx = tempcx; if(modeflag & HalfDCLK) tempcx >>= 1; tempcx--; temp = tempcx & 0xff; SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x08,temp); /* TW: CRT2 Horizontal Total */ temp = ((tempcx & 0xff00) >> 8) << 4; SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x09,0x0F,temp); /* TW: CRT2 Horizontal Total Overflow [7:4] */ tempcx = pushcx; /* BTVGA2HDEE 0x0A,0x0C */ tempbx = SiS_Pr->SiS_VGAHDE; tempcx -= tempbx; tempcx >>= 2; if(modeflag & HalfDCLK) { tempbx >>= 1; tempcx >>= 1; } tempbx += 16; temp = tempbx & 0xff; SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0A,temp); /* TW: CRT2 Horizontal Display Enable End */ pushbx = tempbx; tempcx >>= 1; tempbx += tempcx; tempcx += tempbx; if(SiS_Pr->SiS_IF_DEF_LVDS==0) { if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC) { tempbx = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[4]; tempbx |= ((SiS_Pr->SiS_CRT1Table[CRT1Index].CR[14] & 0xC0) << 2); tempbx = (tempbx - 3) << 3; /*(VGAHRS-3)*8 */ tempcx = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[5]; tempcx &= 0x1F; temp = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[15]; temp = (temp & 0x04) << (5-2); /* VGAHRE D[5] */ tempcx = ((tempcx | temp) - 3) << 3; /* (VGAHRE-3)*8 */ tempbx += 16; tempcx += 16; tempax = SiS_Pr->SiS_VGAHT; if (modeflag & HalfDCLK) tempax >>= 1; tempax--; if (tempcx > tempax) tempcx = tempax; } if((SiS_Pr->SiS_VBInfo & SetCRT2ToTV) && (resinfo == 0x08)){ if(!(SiS_Pr->SiS_VBInfo & SetPALTV)){ tempbx = 1040; tempcx = 1042; } } /* TW: Makes no sense, but is in 650/301LVx 1.10.6s */ if((SiS_Pr->SiS_VBInfo & SetCRT2ToTV) && (resinfo == 0x08)){ if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV)) { if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) { tempbx = 1040; tempcx = 1042; } } } } temp = tempbx & 0xff; SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0B,temp); /* TW: CRT2 Horizontal Retrace Start */#if 0 /* TW: Old code */ if (modeflag & HalfDCLK) { /* for low resolution modes */ temp = ((SiS_Pr->SiS_VGAHT / 2) - 1) & 0xFF; /* BTVGA2HT 0x08,0x09 */ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x08,temp); /* TW: CRT2 Horizontal Total */ temp = ((((SiS_Pr->SiS_VGAHT / 2) - 1) & 0xFF00) >> 8) << 4; SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x09,0x0F,temp); /* TW: CRT2 Horizontal Total Overflow [7:4] */ temp = ((SiS_Pr->SiS_VGAHDE / 2) + 16) & 0xFF; /* BTVGA2HDEE 0x0A,0x0C */ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0A,temp); /* TW: CRT2 Horizontal Display Enable End */ pushbx = (SiS_Pr->SiS_VGAHDE / 2) + 16; tempcx = ((SiS_Pr->SiS_VGAHT - SiS_Pr->SiS_VGAHDE) / 2) >> 2; /* cx */ if(SiS_Pr->SiS_IF_DEF_LVDS == 1) tempcx >>= 1; /* TW: From LVDS 1.10.07; not done on 301(LV) */ tempbx = pushbx + tempcx; /* bx BTVGA@HRS 0x0B,0x0C */ tempcx += tempbx; if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC){ tempbx = SiS_CRT1Table[CRT1Index].CR[4]; tempbx |= ((SiS_CRT1Table[CRT1Index].CR[14] & 0xC0) << 2); tempbx = (tempbx - 3) << 3; /*(VGAHRS-3)*8 */ tempcx = SiS_CRT1Table[CRT1Index].CR[5]; tempcx &= 0x1F; temp = SiS_CRT1Table[CRT1Index].CR[15]; temp = (temp & 0x04) << (5-2); /* VGAHRE D[5] */ tempcx =((tempcx | temp) - 3) << 3; /* (VGAHRE-3)*8 */ } /* TW: The following is not done in 650/LVDS BIOS */ tempbx += 4; tempcx += 4; if (tempcx > (SiS_Pr->SiS_VGAHT / 2)) tempcx = SiS_Pr->SiS_VGAHT / 2; } temp = tempbx & 0x00FF; SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0B,temp); /* TW: CRT2 Horizontal Retrace Start */ } else { /* for high resolution modes */ temp = (SiS_Pr->SiS_VGAHT - 1) & 0xFF; /* BTVGA2HT 0x08,0x09 */ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x08,temp); /* TW: CRT2 Horizontal Total */ temp = (((SiS_Pr->SiS_VGAHT - 1) & 0xFF00) >> 8 ) << 4; SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x09,0x0F,temp); /* TW: CRT2 Horizontal Total Overflow [7:4] */ temp = (SiS_Pr->SiS_VGAHDE + 16) & 0xFF; /* BTVGA2HDEE 0x0A,0x0C */ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0A,temp); /* TW: CRT2 Horizontal Display Enable End */ pushbx = SiS_Pr->SiS_VGAHDE + 16; tempcx = (SiS_Pr->SiS_VGAHT - SiS_Pr->SiS_VGAHDE) >> 2; /* cx */ /* TW: Done in 650/301LVx 1.10.6s */ /* if(SiS_Pr->SiS_IF_DEF_LVDS == 1) */ tempcx >>= 1; /* TW: From LVDS 1.10.07; not done on 301(LV), done in 301LVx 1.10.6s */ tempbx = pushbx + tempcx; /* bx BTVGA@HRS 0x0B,0x0C */ tempcx += tempbx; if(SiS_Pr->SiS_IF_DEF_LVDS==0) { if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC){ tempbx = SiS_CRT1Table[CRT1Index].CR[4]; tempbx |= ((SiS_CRT1Table[CRT1Index].CR[14] & 0xC0) << 2); tempbx = (tempbx - 3) << 3; /*(VGAHRS-3)*8 */ tempcx = SiS_CRT1Table[CRT1Index].CR[5]; tempcx &= 0x1F; temp = SiS_CRT1Table[CRT1Index].CR[15]; temp = (temp & 0x04) << (5-2); /* VGAHRE D[5] */ tempcx = ((tempcx | temp) - 3) << 3; /* (VGAHRE-3)*8 */ tempbx += 16; tempcx += 16; } /* TW: The entire following section is not done in 650/LVDS BIOS */ if (tempcx > SiS_Pr->SiS_VGAHT) tempcx = SiS_Pr->SiS_VGAHT; if((SiS_Pr->SiS_VBInfo & SetCRT2ToTV) && (resinfo == 0x08)){ if(!(SiS_Pr->SiS_VBInfo & SetPALTV)){ tempbx = 1040; tempcx = 1042; } } } temp = tempbx & 0x00FF; SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0B,temp); /* TW: CRT2 Horizontal Retrace Start */ } /* halfdclk */#endif#endif /* SIS315H */ } /* 310 series */ /* TW: The following is done for all bridge/chip types/series */ tempax = tempbx & 0xFF00; tempbx = pushbx; tempbx = (tempbx & 0x00FF) | ((tempbx & 0xFF00) << 4); tempax |= (tempbx & 0xFF00); temp = (tempax & 0xFF00) >> 8; SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0C,temp); /* TW: Overflow */ temp = tempcx & 0x00FF; SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0D,temp); /* TW: CRT2 Horizontal Retrace End */ /* 2. Vertical setup */ tempcx = SiS_Pr->SiS_VGAVT - 1; temp = tempcx & 0x00FF; /* TW: Matches 650/301LV, 650/LVDS, 630/LVDS(CLEVO), 630/LVDS(no-Ch7005) */ if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { if(HwDeviceExtension->jChipType < SIS_315H) { if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { if(SiS_Pr->SiS_VBInfo & (SetCRT2ToSVIDEO|SetCRT2ToAVIDEO)) { temp--; } } } else { if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { temp--; } } } else if(HwDeviceExtension->jChipType >= SIS_315H) { /* TW: Inserted from 650/301LVx 1.10.6s */ temp--; } SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0E,temp); /* TW: CRT2 Vertical Total */ tempbx = SiS_Pr->SiS_VGAVDE - 1; temp = tempbx & 0x00FF; SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0F,temp); /* TW: CRT2 Vertical Display Enable End */ temp = ((tempbx & 0xFF00) << 3) >> 8; temp |= ((tempcx & 0xFF00) >> 8); SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x12,temp); /* TW: Overflow (and HWCursor Test Mode) */ /* TW: For 650/LVDS (1.10.07), 650/301LVx (1.10.6s) */ if(HwDeviceExtension->jChipType >= SIS_315H) { tempbx++; tempax = tempbx; tempcx++; tempcx -= tempax; tempcx >>= 2; tempbx += tempcx; if(tempcx < 4) tempcx = 4; tempcx >>= 2; tempcx += tempbx; tempcx++; } else { /* TW: For 630/LVDS/301B: */ tempbx = (SiS_Pr->SiS_VGAVT + SiS_Pr->SiS_VGAVDE) >> 1; /* BTVGA2VRS 0x10,0x11 */ tempcx = ((SiS_Pr->SiS_VGAVT - SiS_Pr->SiS_VGAVDE) >> 4) + tempbx + 1; /* BTVGA2VRE 0x11 */ } if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC){ tempbx = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[8]; temp = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[7]; if(temp & 0x04) tempbx |= 0x0100; if(temp & 0x80) tempbx |= 0x0200; temp = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[13]; if(temp & 0x08) tempbx |= 0x0400; temp = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[9]; tempcx = (tempcx & 0xFF00) | (temp & 0x00FF); } } temp = tempbx & 0x00FF; SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x10,temp); /* TW: CRT2 Vertical Retrace Start */ temp = ((tempbx & 0xFF00) >> 8) << 4; temp |= (tempcx & 0x000F); SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x11,temp); /* TW: CRT2 Vert. Retrace End; Overflow; "Enable CRTC Check" */ /* 3. Panel compensation delay */ if (HwDeviceExtension->jChipType < SIS_315H ) { /* ---------- 300 series -------------- */ if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { temp = 0x20;#if 0 /* TW: Not in 630/301B BIOS */ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x960) temp = 0x24;#endif if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) temp = 0x08;#ifdef oldHV /* TW: Not in 630/301B BIOS */ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) temp = 0x2c; else temp = 0x20; }#endif if((ROMAddr) && (SiS_Pr->SiS_UseROM) && (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) { if(ROMAddr[0x220] & 0x80) { if(SiS_Pr->SiS_VBInfo & (SetCRT2ToTV-SetCRT2ToHiVisionTV)) temp = ROMAddr[0x221]; else if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) temp = ROMAddr[0x222]; else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) temp = ROMAddr[0x223]; else temp = ROMAddr[0x224]; temp &= 0x3c; } } if(HwDeviceExtension->pdc) { temp = HwDeviceExtension->pdc & 0x3c; } } else { temp = 0x20; if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480) temp = 0x04; if((ROMAddr) && SiS_Pr->SiS_UseROM) { if(ROMAddr[0x220] & 0x80) { temp = ROMAddr[0x220] & 0x3c; } } if(HwDeviceExtension->pdc) { temp = HwDeviceExtension->pdc & 0x3c; } } SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,~0x03C,temp); /* TW: Panel Link Delay Compensation; (Software Command Reset; Power Saving) */ } else { /* ----------- 310/325 series ---------------*/ if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { temp = 0x10; if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) temp = 0x2c; if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) temp = 0x20; if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x960) temp = 0x24; if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) temp = 0x08; tempbl = 0xF0; } else { temp = 0x00; if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) temp = 0x0a; tempbl = 0xF0; if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) tempbl = 0x0F; }#if 0 /* TW: Not done in 650/301LVx 1.10.6s */ if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { temp >>= 2; }#endif SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2D,tempbl,temp); /* TW: Panel Link Delay Compensation */ tempax = 0; if (modeflag & DoubleScanMode) tempax |= 0x80; if (modeflag & HalfDCLK) tempax |= 0x40; SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2C,0x3f,tempax); } } /* Slavemode */ if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { /* TW: 630/301B BIOS sets up Panel Link, too! (650/LV does not) */ if( (HwDeviceExtension->jChipType < SIS_315H) && (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) ) { SiS_SetGroup1_LVDS(SiS_Pr,BaseAddr,ROMAddr,ModeNo,ModeIdIndex, HwDeviceExtension,RefreshRateTableIndex); } else if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { SiS_SetGroup1_301(SiS_Pr,BaseAddr,ROMAddr,ModeNo,ModeIdIndex, HwDeviceExtension,RefreshRateTableIndex); } } else { if(HwDeviceExtension->jChipType < SIS_315H) { SiS_SetGroup1_LVDS(SiS_Pr,BaseAddr,ROMAddr,ModeNo,ModeIdIndex, HwDeviceExtension,RefreshRateTableIndex); } else { /* TW: For 650/LVDS */ if((!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) || (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) { SiS_SetGroup1_LVDS(SiS_Pr,BaseAddr,ROMAddr,ModeNo,ModeIdIndex, HwDeviceExtension,RefreshRateTableIndex);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -