Lines Matching +full:0 +full:xf0ffffff

94 #if 0  in InitCommonPointer()
144 #if 0 in InitCommonPointer()
344 unsigned short ModeIndex = 0; in SiS_GetModeID()
483 unsigned short ModeIndex = 0; in SiS_GetModeID_LCD()
732 unsigned short ModeIndex = 0; in SiS_GetModeID_TV()
851 if(!(VBFlags2 & VB2_SISVGA2BRIDGE)) return 0; in SiS_GetModeID_VGA2()
853 if(HDisplay >= 1920) return 0; in SiS_GetModeID_VGA2()
859 if(VGAEngine != SIS_315_VGA) return 0; in SiS_GetModeID_VGA2()
860 if(!(VBFlags2 & VB2_30xB)) return 0; in SiS_GetModeID_VGA2()
865 if(VGAEngine != SIS_315_VGA) return 0; in SiS_GetModeID_VGA2()
866 if(!(VBFlags2 & VB2_30xB)) return 0; in SiS_GetModeID_VGA2()
871 return SiS_GetModeID(VGAEngine, 0, HDisplay, VDisplay, Depth, false, 0, 0); in SiS_GetModeID_VGA2()
966 SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x01,0xDF); in SiS_DisplayOn()
972 SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x01,0x20); in SiS_DisplayOff()
983 SiS_Pr->SiS_P3c4 = BaseAddr + 0x14; in SiSRegInit()
984 SiS_Pr->SiS_P3d4 = BaseAddr + 0x24; in SiSRegInit()
985 SiS_Pr->SiS_P3c0 = BaseAddr + 0x10; in SiSRegInit()
986 SiS_Pr->SiS_P3ce = BaseAddr + 0x1e; in SiSRegInit()
987 SiS_Pr->SiS_P3c2 = BaseAddr + 0x12; in SiSRegInit()
988 SiS_Pr->SiS_P3ca = BaseAddr + 0x1a; in SiSRegInit()
989 SiS_Pr->SiS_P3c6 = BaseAddr + 0x16; in SiSRegInit()
990 SiS_Pr->SiS_P3c7 = BaseAddr + 0x17; in SiSRegInit()
991 SiS_Pr->SiS_P3c8 = BaseAddr + 0x18; in SiSRegInit()
992 SiS_Pr->SiS_P3c9 = BaseAddr + 0x19; in SiSRegInit()
993 SiS_Pr->SiS_P3cb = BaseAddr + 0x1b; in SiSRegInit()
994 SiS_Pr->SiS_P3cc = BaseAddr + 0x1c; in SiSRegInit()
995 SiS_Pr->SiS_P3cd = BaseAddr + 0x1d; in SiSRegInit()
996 SiS_Pr->SiS_P3da = BaseAddr + 0x2a; in SiSRegInit()
1002 SiS_Pr->SiS_DDC_Port = BaseAddr + 0x14; in SiSRegInit()
1019 SiS_Pr->SiS_MyCR63 = 0x63; in SiS_GetSysFlags()
1021 SiS_Pr->SiS_MyCR63 = 0x53; in SiS_GetSysFlags()
1029 SiS_Pr->SiS_SysFlags = 0; in SiS_GetSysFlags()
1031 cr5f = SiS_GetReg(SiS_Pr->SiS_P3d4,0x5f) & 0xf0; in SiS_GetSysFlags()
1032 SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x5c,0x07); in SiS_GetSysFlags()
1033 temp1 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x5c) & 0xf8; in SiS_GetSysFlags()
1034 SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x5c,0xf8); in SiS_GetSysFlags()
1035 temp2 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x5c) & 0xf8; in SiS_GetSysFlags()
1038 case 0x80: in SiS_GetSysFlags()
1039 case 0x90: in SiS_GetSysFlags()
1040 case 0xc0: in SiS_GetSysFlags()
1043 case 0xa0: in SiS_GetSysFlags()
1044 case 0xb0: in SiS_GetSysFlags()
1045 case 0xe0: in SiS_GetSysFlags()
1051 case 0x90: in SiS_GetSysFlags()
1052 temp1 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x5c) & 0xf8; in SiS_GetSysFlags()
1054 case 0x00: SiS_Pr->SiS_SysFlags |= SF_IsM652; break; in SiS_GetSysFlags()
1055 case 0x40: SiS_Pr->SiS_SysFlags |= SF_IsM653; break; in SiS_GetSysFlags()
1059 case 0xb0: in SiS_GetSysFlags()
1070 if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x78) & 0x30) { in SiS_GetSysFlags()
1073 if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x79) & 0xf0) { in SiS_GetSysFlags()
1092 /* Set - PCI LINEAR ADDRESSING ENABLE (0x80) in SiSInitPCIetc()
1093 * - RELOCATED VGA IO ENABLED (0x20) in SiSInitPCIetc()
1094 * - MMIO ENABLED (0x01) in SiSInitPCIetc()
1097 SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x20,0xa1); in SiSInitPCIetc()
1098 /* - Enable 2D (0x40) in SiSInitPCIetc()
1099 * - Enable 3D (0x02) in SiSInitPCIetc()
1100 * - Enable 3D Vertex command fetch (0x10) ? in SiSInitPCIetc()
1101 * - Enable 3D command parser (0x08) ? in SiSInitPCIetc()
1103 SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x5A); in SiSInitPCIetc()
1121 SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x20,0xa1); in SiSInitPCIetc()
1122 /* - Enable 3D G/L transformation engine (0x80) in SiSInitPCIetc()
1123 * - Enable 2D (0x40) in SiSInitPCIetc()
1124 * - Enable 3D vertex command fetch (0x10) in SiSInitPCIetc()
1125 * - Enable 3D command parser (0x08) in SiSInitPCIetc()
1126 * - Enable 3D (0x02) in SiSInitPCIetc()
1128 SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0xDA); in SiSInitPCIetc()
1133 SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x20,0xa1); in SiSInitPCIetc()
1135 /* - Enable 2D (0x40) in SiSInitPCIetc()
1138 SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x1E,0x60,0x40); in SiSInitPCIetc()
1156 SiS_Pr->SiS_IF_DEF_LVDS = 0; in SiSSetLVDSetc()
1157 SiS_Pr->SiS_IF_DEF_TRUMPION = 0; in SiSSetLVDSetc()
1158 SiS_Pr->SiS_IF_DEF_CH70xx = 0; in SiSSetLVDSetc()
1159 SiS_Pr->SiS_IF_DEF_CONEX = 0; in SiSSetLVDSetc()
1161 SiS_Pr->SiS_ChrontelInit = 0; in SiSSetLVDSetc()
1166 temp = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x00); in SiSSetLVDSetc()
1174 temp = (SiS_GetReg(SiS_Pr->SiS_P3d4,0x37) & 0x0e) >> 1; in SiSSetLVDSetc()
1179 SiS_Pr->SiS_Backup70xx = SiS_GetCH700x(SiS_Pr, 0x0e); in SiSSetLVDSetc()
1189 temp = (SiS_GetReg(SiS_Pr->SiS_P3d4,0x37) & 0x0e) >> 1; in SiSSetLVDSetc()
1201 temp = (SiS_GetReg(SiS_Pr->SiS_P3d4,0x38) & 0xe0) >> 5; in SiSSetLVDSetc()
1219 SiS_Pr->SiS_IF_DEF_DSTN = enable ? 1 : 0; in SiS_SetEnableDstn()
1225 SiS_Pr->SiS_IF_DEF_FSTN = enable ? 1 : 0; in SiS_SetEnableFstn()
1238 } else if(ModeNo <= 0x13) { in SiS_GetModeFlag()
1253 unsigned short romversoffs, romvmaj = 1, romvmin = 0; in SiSDetermineROMLayout661()
1262 if((ROMAddr[0x1a] == 'N') && in SiSDetermineROMLayout661()
1263 (ROMAddr[0x1b] == 'e') && in SiSDetermineROMLayout661()
1264 (ROMAddr[0x1c] == 'w') && in SiSDetermineROMLayout661()
1265 (ROMAddr[0x1d] == 'V')) { in SiSDetermineROMLayout661()
1268 romversoffs = ROMAddr[0x16] | (ROMAddr[0x17] << 8); in SiSDetermineROMLayout661()
1271 romvmaj = ROMAddr[romversoffs] - '0'; in SiSDetermineROMLayout661()
1272 romvmin = ((ROMAddr[romversoffs+2] -'0') * 10) + (ROMAddr[romversoffs+3] - '0'); in SiSDetermineROMLayout661()
1275 if((romvmaj != 0) || (romvmin >= 92)) { in SiSDetermineROMLayout661()
1279 if((ROMAddr[0x1a] == 'N') && in SiSDetermineROMLayout661()
1280 (ROMAddr[0x1b] == 'e') && in SiSDetermineROMLayout661()
1281 (ROMAddr[0x1c] == 'w') && in SiSDetermineROMLayout661()
1282 (ROMAddr[0x1d] == 'V')) { in SiSDetermineROMLayout661()
1293 unsigned short romptr = 0; in SiSDetermineROMUsage()
1297 SiS_Pr->SiS_PWDOffset = 0; in SiSDetermineROMUsage()
1303 /* 300: We check if the code starts below 0x220 by in SiSDetermineROMUsage()
1307 if((ROMAddr[3] == 0xe9) && ((ROMAddr[5] << 8) | ROMAddr[4]) > 0x21a) in SiSDetermineROMUsage()
1322 if((romptr = SISGETROMW(0x0102))) { in SiSDetermineROMUsage()
1323 if(ROMAddr[romptr + (32 * 16)] == 0xff) in SiSDetermineROMUsage()
1325 else if(ROMAddr[romptr + (34 * 16)] == 0xff) in SiSDetermineROMUsage()
1327 else if(ROMAddr[romptr + (36 * 16)] == 0xff) /* 0.94, 2.05.00+ */ in SiSDetermineROMUsage()
1329 else if( (ROMAddr[romptr + (38 * 16)] == 0xff) || /* 2.00.00 - 2.02.00 */ in SiSDetermineROMUsage()
1330 (ROMAddr[0x6F] & 0x01) ) { /* 2.03.00 - <2.05.00 */ in SiSDetermineROMUsage()
1350 value &= 0x00ff; in SiS_SetSegRegLower()
1351 temp = SiS_GetRegByte(SiS_Pr->SiS_P3cb) & 0xf0; in SiS_SetSegRegLower()
1354 temp = SiS_GetRegByte(SiS_Pr->SiS_P3cd) & 0xf0; in SiS_SetSegRegLower()
1355 temp |= (value & 0x0f); in SiS_SetSegRegLower()
1364 value &= 0x00ff; in SiS_SetSegRegUpper()
1365 temp = SiS_GetRegByte(SiS_Pr->SiS_P3cb) & 0x0f; in SiS_SetSegRegUpper()
1366 temp |= (value & 0xf0); in SiS_SetSegRegUpper()
1368 temp = SiS_GetRegByte(SiS_Pr->SiS_P3cd) & 0x0f; in SiS_SetSegRegUpper()
1383 SiS_SetSegmentReg(SiS_Pr, 0); in SiS_ResetSegmentReg()
1391 temp &= 0x07; in SiS_SetSegmentRegOver()
1393 SiS_SetReg(SiS_Pr->SiS_P3c4,0x1d,temp); in SiS_SetSegmentRegOver()
1400 SiS_SetSegmentRegOver(SiS_Pr, 0); in SiS_ResetSegmentRegOver()
1420 unsigned short flag = 0, rev = 0, nolcd = 0; in SiS_GetVBType()
1423 SiS_Pr->SiS_VBType = 0; in SiS_GetVBType()
1431 flag = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x00); in SiS_GetVBType()
1436 rev = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x01); in SiS_GetVBType()
1441 if(rev >= 0xC0) { in SiS_GetVBType()
1443 } else if(rev >= 0xB0) { in SiS_GetVBType()
1446 nolcd = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x23); in SiS_GetVBType()
1447 if(!(nolcd & 0x02)) SiS_Pr->SiS_VBType |= VB_NoLCD; in SiS_GetVBType()
1453 if(rev >= 0xE0) { in SiS_GetVBType()
1454 flag = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x39); in SiS_GetVBType()
1455 if(flag == 0xff) SiS_Pr->SiS_VBType = VB_SIS302LV; in SiS_GetVBType()
1457 } else if(rev >= 0xD0) { in SiS_GetVBType()
1462 p4_0f = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x0f); in SiS_GetVBType()
1463 p4_25 = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x25); in SiS_GetVBType()
1464 p4_27 = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x27); in SiS_GetVBType()
1465 SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x0f,0x7f); in SiS_GetVBType()
1466 SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x25,0x08); in SiS_GetVBType()
1467 SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x27,0xfd); in SiS_GetVBType()
1468 if(SiS_GetReg(SiS_Pr->SiS_Part4Port,0x26) & 0x08) { in SiS_GetVBType()
1471 SiS_SetReg(SiS_Pr->SiS_Part4Port,0x27,p4_27); in SiS_GetVBType()
1472 SiS_SetReg(SiS_Pr->SiS_Part4Port,0x25,p4_25); in SiS_GetVBType()
1473 SiS_SetReg(SiS_Pr->SiS_Part4Port,0x0f,p4_0f); in SiS_GetVBType()
1506 data = (*SiS_Pr->pSiS_SoftSetting) & 0x03; in SiS_Get310DRAMType()
1510 data = 0; in SiS_Get310DRAMType()
1513 data = 0; in SiS_Get310DRAMType()
1516 data = ((SiS_GetReg(SiS_Pr->SiS_P3d4,0x78) & 0xc0) >> 6); in SiS_Get310DRAMType()
1518 data = SiS_GetReg(SiS_Pr->SiS_P3d4,0x78) & 0x07; in SiS_Get310DRAMType()
1521 data = SiS_GetReg(SiS_Pr->SiS_P3c4,0x13) & 0x07; in SiS_Get310DRAMType()
1523 data = SiS_GetReg(SiS_Pr->SiS_P3c4,0x3a) & 0x03; in SiS_Get310DRAMType()
1526 switch(SiS_GetReg(SiS_Pr->SiS_P3d4,0x5f) & 0x30) { in SiS_Get310DRAMType()
1527 case 0x00: data = 1; break; in SiS_Get310DRAMType()
1528 case 0x10: data = 3; break; in SiS_Get310DRAMType()
1529 case 0x20: data = 3; break; in SiS_Get310DRAMType()
1530 case 0x30: data = 2; break; in SiS_Get310DRAMType()
1533 data = 0; in SiS_Get310DRAMType()
1551 return((unsigned short)(SISGETROMW((0x90 + (index * 5) + 3)))); in SiS_GetMCLK()
1577 if(ModeNo > 0x13) { in SiS_ClearBuffer()
1578 memset_io(memaddr, 0, memsize); in SiS_ClearBuffer()
1581 for(i = 0; i < 0x4000; i++) writew(0x0000, &pBuffer[i]); in SiS_ClearBuffer()
1585 for(i = 0; i < 0x4000; i++) writew(0x0720, &pBuffer[i]); in SiS_ClearBuffer()
1587 memset_io(memaddr, 0, 0x8000); in SiS_ClearBuffer()
1601 if((*ModeNo) <= 0x13) { in SiS_SearchModeID()
1603 if((*ModeNo) <= 0x05) (*ModeNo) |= 0x01; in SiS_SearchModeID()
1605 for((*ModeIdIndex) = 0; ;(*ModeIdIndex)++) { in SiS_SearchModeID()
1607 if(SiS_Pr->SiS_SModeIDTable[(*ModeIdIndex)].St_ModeID == 0xFF) return false; in SiS_SearchModeID()
1610 if((*ModeNo) == 0x07) { in SiS_SearchModeID()
1611 if(VGAINFO & 0x10) (*ModeIdIndex)++; /* 400 lines */ in SiS_SearchModeID()
1614 if((*ModeNo) <= 0x03) { in SiS_SearchModeID()
1615 if(!(VGAINFO & 0x80)) (*ModeIdIndex)++; in SiS_SearchModeID()
1616 if(VGAINFO & 0x10) (*ModeIdIndex)++; /* 400 lines */ in SiS_SearchModeID()
1623 for((*ModeIdIndex) = 0; ;(*ModeIdIndex)++) { in SiS_SearchModeID()
1625 if(SiS_Pr->SiS_EModeIDTable[(*ModeIdIndex)].Ext_ModeID == 0xFF) return false; in SiS_SearchModeID()
1641 if(ModeNo <= 0x13) { in SiS_GetModePtr()
1644 if(SiS_Pr->SiS_ModeType <= ModeEGA) index = 0x1B; in SiS_GetModePtr()
1645 else index = 0x0F; in SiS_GetModePtr()
1691 if((ModeNo != 0x03) && (ModeNo != 0x10) && (ModeNo != 0x12)) in SiS_DoLowModeTest()
1693 temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x11); in SiS_DoLowModeTest()
1694 SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x11,0x80); in SiS_DoLowModeTest()
1695 temp1 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x00); in SiS_DoLowModeTest()
1696 SiS_SetReg(SiS_Pr->SiS_P3d4,0x00,0x55); in SiS_DoLowModeTest()
1697 temp2 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x00); in SiS_DoLowModeTest()
1698 SiS_SetReg(SiS_Pr->SiS_P3d4,0x00,temp1); in SiS_DoLowModeTest()
1699 SiS_SetReg(SiS_Pr->SiS_P3d4,0x11,temp); in SiS_DoLowModeTest()
1702 if(temp2 == 0x55) return false; in SiS_DoLowModeTest()
1705 if(temp2 != 0x55) return true; in SiS_DoLowModeTest()
1707 SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x35,0x01); in SiS_DoLowModeTest()
1729 SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x51,0x1f); in SiS_OpenCRTC()
1730 if(IS_SIS651) SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x51,0x20); in SiS_OpenCRTC()
1731 SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x56,0xe7); in SiS_OpenCRTC()
1733 SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x61,0xf7); in SiS_OpenCRTC()
1734 SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x51,0x1f); in SiS_OpenCRTC()
1735 SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x56,0xe7); in SiS_OpenCRTC()
1737 SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x3a,0xef); in SiS_OpenCRTC()
1745 #if 0 /* This locks some CRTC registers. We don't want that. */ in SiS_CloseCRTC()
1746 unsigned short temp1 = 0, temp2 = 0; in SiS_CloseCRTC()
1750 temp1 = 0xa0; temp2 = 0x08; in SiS_CloseCRTC()
1752 SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x51,0x1f,temp1); in SiS_CloseCRTC()
1753 SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x56,0xe7,temp2); in SiS_CloseCRTC()
1762 SiS_SetRegAND(SiS_Pr->SiS_P3d4,SiS_Pr->SiS_MyCR63,0xbf); in SiS_HandleCRT1()
1763 #if 0 in SiS_HandleCRT1()
1764 if(!(SiS_GetReg(SiS_Pr->SiS_P3c4,0x15) & 0x01)) { in SiS_HandleCRT1()
1765 if((SiS_GetReg(SiS_Pr->SiS_P3c4,0x15) & 0x0a) || in SiS_HandleCRT1()
1766 (SiS_GetReg(SiS_Pr->SiS_P3c4,0x16) & 0x01)) { in SiS_HandleCRT1()
1767 SiS_SetRegOR(SiS_Pr->SiS_P3d4,SiS_Pr->SiS_MyCR63,0x40); in SiS_HandleCRT1()
1786 if(ModeNo == 0xfe) { in SiS_GetColorDepth()
1788 } else if(ModeNo <= 0x13) { in SiS_GetColorDepth()
1795 if(index < 0) index = 0; in SiS_GetColorDepth()
1837 SiS_SetReg(SiS_Pr->SiS_P3c4,0x00,0x03); in SiS_SetSeqRegs()
1840 SRdata = SiS_Pr->SiS_StandTable[StandTableIndex].SR[0] | 0x20; in SiS_SetSeqRegs()
1846 if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) SRdata |= 0x01; in SiS_SetSeqRegs()
1847 } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) SRdata |= 0x01; in SiS_SetSeqRegs()
1851 SiS_SetReg(SiS_Pr->SiS_P3c4,0x01,SRdata); in SiS_SetSeqRegs()
1873 Miscdata |= 0x0C; in SiS_SetMiscRegs()
1892 SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x11,0x7f); in SiS_SetCRTCRegs()
1894 for(i = 0; i <= 0x18; i++) { in SiS_SetCRTCRegs()
1901 for(i = 0x13; i <= 0x14; i++) { in SiS_SetCRTCRegs()
1907 (SiS_Pr->ChipRevision >= 0x30) ) { in SiS_SetCRTCRegs()
1910 SiS_SetReg(SiS_Pr->SiS_P3d4,0x18,0xFE); in SiS_SetCRTCRegs()
1926 for(i = 0; i <= 0x13; i++) { in SiS_SetATTRegs()
1929 if(i == 0x13) { in SiS_SetATTRegs()
1934 if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) ARdata = 0; in SiS_SetATTRegs()
1937 if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { in SiS_SetATTRegs()
1939 if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) ARdata = 0; in SiS_SetATTRegs()
1945 if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) ARdata = 0; in SiS_SetATTRegs()
1952 if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) ARdata = 0; in SiS_SetATTRegs()
1954 ARdata = 0; in SiS_SetATTRegs()
1958 if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) ARdata = 0; in SiS_SetATTRegs()
1968 SiS_SetRegByte(SiS_Pr->SiS_P3c0,0x14); /* set index */ in SiS_SetATTRegs()
1969 SiS_SetRegByte(SiS_Pr->SiS_P3c0,0x00); /* set data */ in SiS_SetATTRegs()
1972 SiS_SetRegByte(SiS_Pr->SiS_P3c0,0x20); /* Enable Attribute */ in SiS_SetATTRegs()
1986 for(i = 0; i <= 0x08; i++) { in SiS_SetGRCRegs()
1993 SiS_SetRegAND(SiS_Pr->SiS_P3ce,0x05,0xBF); in SiS_SetGRCRegs()
2006 for(i = 0x0A; i <= 0x0E; i++) { in SiS_ClearExt1Regs()
2007 SiS_SetReg(SiS_Pr->SiS_P3c4,i,0x00); in SiS_ClearExt1Regs()
2011 SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x37,0xFE); in SiS_ClearExt1Regs()
2012 if(ModeNo <= 0x13) { in SiS_ClearExt1Regs()
2013 if(ModeNo == 0x06 || ModeNo >= 0x0e) { in SiS_ClearExt1Regs()
2014 SiS_SetReg(SiS_Pr->SiS_P3c4,0x0e,0x20); in SiS_ClearExt1Regs()
2029 if(SiS_Pr->SiS_IF_DEF_LVDS == 0) return; in SiS_ResetCRT1VCLK()
2032 if((SiS_Pr->SiS_IF_DEF_LVDS == 0) && in SiS_ResetCRT1VCLK()
2038 SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x31,0xcf,0x20); in SiS_ResetCRT1VCLK()
2039 SiS_SetReg(SiS_Pr->SiS_P3c4,0x2B,SiS_Pr->SiS_VCLKData[1].SR2B); in SiS_ResetCRT1VCLK()
2040 SiS_SetReg(SiS_Pr->SiS_P3c4,0x2C,SiS_Pr->SiS_VCLKData[1].SR2C); in SiS_ResetCRT1VCLK()
2041 SiS_SetReg(SiS_Pr->SiS_P3c4,0x2D,0x80); in SiS_ResetCRT1VCLK()
2042 SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x31,0xcf,0x10); in SiS_ResetCRT1VCLK()
2043 SiS_SetReg(SiS_Pr->SiS_P3c4,0x2B,SiS_Pr->SiS_VCLKData[0].SR2B); in SiS_ResetCRT1VCLK()
2044 SiS_SetReg(SiS_Pr->SiS_P3c4,0x2C,SiS_Pr->SiS_VCLKData[0].SR2C); in SiS_ResetCRT1VCLK()
2045 SiS_SetReg(SiS_Pr->SiS_P3c4,0x2D,0x80); in SiS_ResetCRT1VCLK()
2063 sync &= 0xC0; in SiS_SetCRT1Sync()
2064 sync |= 0x2f; in SiS_SetCRT1Sync()
2083 crt1data = &SiS_Pr->CCRT1CRTC[0]; in SiS_SetCRT1CRTC()
2090 if((temp == 0x20) && (SiS_Pr->Alternate1600x1200)) temp = 0x57; in SiS_SetCRT1CRTC()
2092 crt1data = (unsigned char *)&SiS_Pr->SiS_CRT1Table[temp].CR[0]; in SiS_SetCRT1CRTC()
2097 SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x11,0x7f); in SiS_SetCRT1CRTC()
2099 for(i = 0, j = 0; i <= 7; i++, j++) { in SiS_SetCRT1CRTC()
2102 for(j = 0x10; i <= 10; i++, j++) { in SiS_SetCRT1CRTC()
2105 for(j = 0x15; i <= 12; i++, j++) { in SiS_SetCRT1CRTC()
2108 for(j = 0x0A; i <= 15; i++, j++) { in SiS_SetCRT1CRTC()
2112 SiS_SetReg(SiS_Pr->SiS_P3c4,0x0E,crt1data[16] & 0xE0); in SiS_SetCRT1CRTC()
2114 temp = (crt1data[16] & 0x01) << 5; in SiS_SetCRT1CRTC()
2115 if(modeflag & DoubleScanMode) temp |= 0x80; in SiS_SetCRT1CRTC()
2116 SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,0x5F,temp); in SiS_SetCRT1CRTC()
2119 SiS_SetReg(SiS_Pr->SiS_P3d4,0x14,0x4F); in SiS_SetCRT1CRTC()
2124 SiS_SetReg(SiS_Pr->SiS_P3d4,0x04,crt1data[4] - 1); in SiS_SetCRT1CRTC()
2125 if(!(temp = crt1data[5] & 0x1f)) { in SiS_SetCRT1CRTC()
2126 SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x0c,0xfb); in SiS_SetCRT1CRTC()
2128 SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x05,0xe0,((temp - 1) & 0x1f)); in SiS_SetCRT1CRTC()
2131 SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0e,0x1f,(temp << 5)); in SiS_SetCRT1CRTC()
2156 temp = (DisplayUnit >> 8) & 0x0f; in SiS_SetCRT1Offset()
2157 SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0E,0xF0,temp); in SiS_SetCRT1Offset()
2159 SiS_SetReg(SiS_Pr->SiS_P3d4,0x13,DisplayUnit & 0xFF); in SiS_SetCRT1Offset()
2165 if(DisplayUnit & 0xff) temp++; in SiS_SetCRT1Offset()
2167 if(ModeNo == 0x4a || ModeNo == 0x49) temp--; in SiS_SetCRT1Offset()
2169 SiS_SetReg(SiS_Pr->SiS_P3c4,0x10,temp); in SiS_SetCRT1Offset()
2180 unsigned short index = 0, clka, clkb; in SiS_SetCRT1VCLK()
2190 if((index == 0x21) && (SiS_Pr->Alternate1600x1200)) index = 0x72; in SiS_SetCRT1VCLK()
2199 SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x31,0xCF); in SiS_SetCRT1VCLK()
2201 SiS_SetReg(SiS_Pr->SiS_P3c4,0x2b,clka); in SiS_SetCRT1VCLK()
2202 SiS_SetReg(SiS_Pr->SiS_P3c4,0x2c,clkb); in SiS_SetCRT1VCLK()
2206 SiS_SetReg(SiS_Pr->SiS_P3c4,0x2D,0x01); in SiS_SetCRT1VCLK()
2210 SiS_SetReg(SiS_Pr->SiS_P3c4,0x2b,SiS_GetReg(SiS_Pr->SiS_P3c4,0x2b)); in SiS_SetCRT1VCLK()
2211 clkb = SiS_GetReg(SiS_Pr->SiS_P3c4,0x2c); in SiS_SetCRT1VCLK()
2212 clkb = (((clkb & 0x1f) << 1) + 1) | (clkb & 0xe0); in SiS_SetCRT1VCLK()
2213 SiS_SetReg(SiS_Pr->SiS_P3c4,0x2c,clkb); in SiS_SetCRT1VCLK()
2218 SiS_SetReg(SiS_Pr->SiS_P3c4,0x2D,0x80); in SiS_SetCRT1VCLK()
2233 1, 2, 2, 3, 0, 1, 1, 2 in SiS_GetFIFOThresholdIndex300()
2236 temp1 = temp2 = (SiS_GetReg(SiS_Pr->SiS_P3c4,0x18) & 0x62) >> 1; in SiS_GetFIFOThresholdIndex300()
2237 (*idx2) = (unsigned short)(ThTiming[((temp2 >> 3) | temp1) & 0x07]); in SiS_GetFIFOThresholdIndex300()
2238 (*idx1) = (unsigned short)(SiS_GetReg(SiS_Pr->SiS_P3c4,0x16) >> 6) & 0x03; in SiS_GetFIFOThresholdIndex300()
2239 (*idx1) |= (unsigned short)(((SiS_GetReg(SiS_Pr->SiS_P3c4,0x14) >> 4) & 0x0c)); in SiS_GetFIFOThresholdIndex300()
2276 if(key == 0) { in SiS_DoCalcDelay()
2293 temp2 = SiS_DoCalcDelay(SiS_Pr, MCLK, VCLK, colordepth, 0); in SiS_CalcDelay()
2305 unsigned short ThresholdLow = 0; in SiS_SetCRT1FIFO_300()
2309 if(ModeNo > 0x13) { in SiS_SetCRT1FIFO_300()
2323 index = SiS_GetReg(SiS_Pr->SiS_P3c4,0x3A) & 0x07; in SiS_SetCRT1FIFO_300()
2326 temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35) & 0xc3; in SiS_SetCRT1FIFO_300()
2327 SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x16,0x3c,temp); in SiS_SetCRT1FIFO_300()
2331 if(ThresholdLow < 0x13) break; in SiS_SetCRT1FIFO_300()
2332 SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x16,0xfc); in SiS_SetCRT1FIFO_300()
2333 ThresholdLow = 0x13; in SiS_SetCRT1FIFO_300()
2334 temp = SiS_GetReg(SiS_Pr->SiS_P3c4,0x16) >> 6; in SiS_SetCRT1FIFO_300()
2336 SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x16,0x3f,((temp - 1) << 6)); in SiS_SetCRT1FIFO_300()
2337 } while(0); in SiS_SetCRT1FIFO_300()
2342 temp = (ThresholdLow << 4) | 0x0f; in SiS_SetCRT1FIFO_300()
2343 SiS_SetReg(SiS_Pr->SiS_P3c4,0x08,temp); in SiS_SetCRT1FIFO_300()
2345 temp = (ThresholdLow & 0x10) << 1; in SiS_SetCRT1FIFO_300()
2346 if(ModeNo > 0x13) temp |= 0x40; in SiS_SetCRT1FIFO_300()
2347 SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0f,0x9f,temp); in SiS_SetCRT1FIFO_300()
2350 SiS_SetReg(SiS_Pr->SiS_P3c4,0x3B,0x09); in SiS_SetCRT1FIFO_300()
2354 if(temp > 0x0f) temp = 0x0f; in SiS_SetCRT1FIFO_300()
2355 SiS_SetReg(SiS_Pr->SiS_P3c4,0x09,temp); in SiS_SetCRT1FIFO_300()
2362 97, 88, 86, 79, 77, 0, /* 64 bit BQ=2 */ in SiS_GetLatencyFactor630()
2363 0, 87, 85, 78, 76, 54, /* 64 bit BQ=1 */ in SiS_GetLatencyFactor630()
2364 97, 88, 86, 79, 77, 0, /* 128 bit BQ=2 */ in SiS_GetLatencyFactor630()
2365 0, 79, 77, 70, 68, 48, /* 128 bit BQ=1 */ in SiS_GetLatencyFactor630()
2366 80, 72, 69, 63, 61, 0, /* 64 bit BQ=2 */ in SiS_GetLatencyFactor630()
2367 0, 70, 68, 61, 59, 37, /* 64 bit BQ=1 */ in SiS_GetLatencyFactor630()
2368 86, 77, 75, 68, 66, 0, /* 128 bit BQ=2 */ in SiS_GetLatencyFactor630()
2369 0, 68, 66, 59, 57, 37 /* 128 bit BQ=1 */ in SiS_GetLatencyFactor630()
2392 index = ((key & 0x0f) * 3) + ((key & 0xc0) >> 6); in SiS_CalcDelay2()
2394 index = (key & 0xe0) >> 5; in SiS_CalcDelay2()
2395 if(key & 0x10) index += 6; in SiS_CalcDelay2()
2396 if(!(key & 0x01)) index += 24; in SiS_CalcDelay2()
2397 if(SiS_GetReg(SiS_Pr->SiS_P3c4,0x14) & 0x80) index += 12; in SiS_CalcDelay2()
2406 unsigned short ThresholdLow = 0; in SiS_SetCRT1FIFO_630()
2407 unsigned short i, data, VCLK, MCLK16, colorth = 0; in SiS_SetCRT1FIFO_630()
2411 0x01,0x21,0x41,0x61,0x81, in SiS_SetCRT1FIFO_630()
2412 0x31,0x51,0x71,0x91,0xb1, in SiS_SetCRT1FIFO_630()
2413 0x00,0x20,0x40,0x60,0x80, in SiS_SetCRT1FIFO_630()
2414 0x30,0x50,0x70,0x90,0xb0, in SiS_SetCRT1FIFO_630()
2415 0xff in SiS_SetCRT1FIFO_630()
2418 0x34,0x74,0xb4, in SiS_SetCRT1FIFO_630()
2419 0x23,0x63,0xa3, in SiS_SetCRT1FIFO_630()
2420 0x12,0x52,0x92, in SiS_SetCRT1FIFO_630()
2421 0x01,0x41,0x81, in SiS_SetCRT1FIFO_630()
2422 0x00,0x40,0x80, in SiS_SetCRT1FIFO_630()
2423 0xff in SiS_SetCRT1FIFO_630()
2429 i = 0; in SiS_SetCRT1FIFO_630()
2432 queuedata = &FQBQData730[0]; in SiS_SetCRT1FIFO_630()
2434 queuedata = &FQBQData[0]; in SiS_SetCRT1FIFO_630()
2436 if(ModeNo > 0x13) { in SiS_SetCRT1FIFO_630()
2447 data = SiS_GetReg(SiS_Pr->SiS_P3c4,0x1A) & 0x07; in SiS_SetCRT1FIFO_630()
2460 if(templ > 0x13) { in SiS_SetCRT1FIFO_630()
2461 if(queuedata[i + 1] == 0xFF) { in SiS_SetCRT1FIFO_630()
2462 ThresholdLow = 0x13; in SiS_SetCRT1FIFO_630()
2470 } while(queuedata[i] != 0xFF); in SiS_SetCRT1FIFO_630()
2475 ThresholdLow = 0x02; in SiS_SetCRT1FIFO_630()
2480 data = ((ThresholdLow & 0x0f) << 4) | 0x0f; in SiS_SetCRT1FIFO_630()
2481 SiS_SetReg(SiS_Pr->SiS_P3c4,0x08,data); in SiS_SetCRT1FIFO_630()
2483 data = (ThresholdLow & 0x10) << 1; in SiS_SetCRT1FIFO_630()
2484 SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0F,0xDF,data); in SiS_SetCRT1FIFO_630()
2487 SiS_SetReg(SiS_Pr->SiS_P3c4,0x3B,0x09); in SiS_SetCRT1FIFO_630()
2491 if(data > 0x0f) data = 0x0f; in SiS_SetCRT1FIFO_630()
2492 SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x09,0x80,data); in SiS_SetCRT1FIFO_630()
2495 templ = sisfb_read_nbridge_pci_dword(SiS_Pr, 0x50); in SiS_SetCRT1FIFO_630()
2499 templ &= 0xfffff9ff; in SiS_SetCRT1FIFO_630()
2500 templ |= ((queuedata[i] & 0xc0) << 3); in SiS_SetCRT1FIFO_630()
2504 templ &= 0xf0ffffff; in SiS_SetCRT1FIFO_630()
2505 if( (ModeNo <= 0x13) && in SiS_SetCRT1FIFO_630()
2507 (SiS_Pr->ChipRevision >= 0x30) ) { in SiS_SetCRT1FIFO_630()
2508 templ |= 0x0b000000; in SiS_SetCRT1FIFO_630()
2510 templ |= ((queuedata[i] & 0xf0) << 20); in SiS_SetCRT1FIFO_630()
2515 sisfb_write_nbridge_pci_dword(SiS_Pr, 0x50, templ); in SiS_SetCRT1FIFO_630()
2516 templ = sisfb_read_nbridge_pci_dword(SiS_Pr, 0xA0); in SiS_SetCRT1FIFO_630()
2518 /* GUI grant timer (PCI config 0xA3) */ in SiS_SetCRT1FIFO_630()
2521 templ &= 0x00ffffff; in SiS_SetCRT1FIFO_630()
2523 templ |= (((datal & 0x0f00) | ((datal & 0x3000) >> 8)) << 20); in SiS_SetCRT1FIFO_630()
2527 templ &= 0xf0ffffff; in SiS_SetCRT1FIFO_630()
2528 templ |= ((queuedata[i] & 0x0f) << 24); in SiS_SetCRT1FIFO_630()
2532 sisfb_write_nbridge_pci_dword(SiS_Pr, 0xA0, templ); in SiS_SetCRT1FIFO_630()
2543 SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x3D,0xFE); in SiS_SetCRT1FIFO_310()
2547 SiS_SetReg(SiS_Pr->SiS_P3c4,0x08,0xAE); in SiS_SetCRT1FIFO_310()
2548 SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x09,0xF0); in SiS_SetCRT1FIFO_310()
2549 if(ModeNo > 0x13) { in SiS_SetCRT1FIFO_310()
2551 SiS_SetReg(SiS_Pr->SiS_P3c4,0x08,0x34); in SiS_SetCRT1FIFO_310()
2552 SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x3D,0x01); in SiS_SetCRT1FIFO_310()
2555 SiS_SetReg(SiS_Pr->SiS_P3c4,0x08,0x34); in SiS_SetCRT1FIFO_310()
2556 SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x3D,0x01); in SiS_SetCRT1FIFO_310()
2560 SiS_SetReg(SiS_Pr->SiS_P3c4,0x08,0x34); in SiS_SetCRT1FIFO_310()
2561 SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x3D,0x01); in SiS_SetCRT1FIFO_310()
2576 unsigned short data = 0, VCLK = 0, index = 0; in SiS_SetVCLKState()
2578 if(ModeNo > 0x13) { in SiS_SetVCLKState()
2589 if(VCLK > 150) data |= 0x80; in SiS_SetVCLKState()
2590 SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x07,0x7B,data); in SiS_SetVCLKState()
2592 data = 0x00; in SiS_SetVCLKState()
2593 if(VCLK >= 150) data |= 0x08; in SiS_SetVCLKState()
2594 SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x32,0xF7,data); in SiS_SetVCLKState()
2598 if(VCLK >= 166) data |= 0x0c; in SiS_SetVCLKState()
2599 SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x32,0xf3,data); in SiS_SetVCLKState()
2602 SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1f,0xe7); in SiS_SetVCLKState()
2607 if(VCLK >= 200) data |= 0x0c; in SiS_SetVCLKState()
2608 if(SiS_Pr->ChipType == XGI_20) data &= ~0x04; in SiS_SetVCLKState()
2609 SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x32,0xf3,data); in SiS_SetVCLKState()
2611 data = SiS_GetReg(SiS_Pr->SiS_P3c4,0x1f) & 0xe7; in SiS_SetVCLKState()
2612 if(VCLK < 200) data |= 0x10; in SiS_SetVCLKState()
2613 SiS_SetReg(SiS_Pr->SiS_P3c4,0x1f,data); in SiS_SetVCLKState()
2621 SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x07,0xE8,0x10); in SiS_SetVCLKState()
2625 data = 0x03; in SiS_SetVCLKState()
2626 if(VCLK >= 260) data = 0x00; in SiS_SetVCLKState()
2627 else if(VCLK >= 160) data = 0x01; in SiS_SetVCLKState()
2628 else if(VCLK >= 135) data = 0x02; in SiS_SetVCLKState()
2632 if (VCLK < 234) data = 0x02; in SiS_SetVCLKState()
2636 SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x07,0xFC,data); in SiS_SetVCLKState()
2639 if(ModeNo > 0x13) data &= 0xfc; in SiS_SetVCLKState()
2641 SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x07,0xF8,data); in SiS_SetVCLKState()
2651 unsigned short data, infoflag = 0, modeflag; in SiS_SetCRT1ModeRegs()
2662 if(ModeNo > 0x13) { in SiS_SetCRT1ModeRegs()
2668 SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1F,0x3F); in SiS_SetCRT1ModeRegs()
2670 data = 0; in SiS_SetCRT1ModeRegs()
2671 if(ModeNo > 0x13) { in SiS_SetCRT1ModeRegs()
2673 data |= 0x02; in SiS_SetCRT1ModeRegs()
2676 if(infoflag & InterlaceMode) data |= 0x20; in SiS_SetCRT1ModeRegs()
2678 SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x06,0xC0,data); in SiS_SetCRT1ModeRegs()
2681 data = 0; in SiS_SetCRT1ModeRegs()
2684 int hrs = (SiS_GetReg(SiS_Pr->SiS_P3d4,0x04) | in SiS_SetCRT1ModeRegs()
2685 ((SiS_GetReg(SiS_Pr->SiS_P3c4,0x0b) & 0xc0) << 2)) - 3; in SiS_SetCRT1ModeRegs()
2686 int hto = (SiS_GetReg(SiS_Pr->SiS_P3d4,0x00) | in SiS_SetCRT1ModeRegs()
2687 ((SiS_GetReg(SiS_Pr->SiS_P3c4,0x0b) & 0x03) << 8)) + 5; in SiS_SetCRT1ModeRegs()
2690 SiS_SetReg(SiS_Pr->SiS_P3d4,0x19,data); in SiS_SetCRT1ModeRegs()
2691 SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x1a,0xFC,((data >> 8) & 0x03)); in SiS_SetCRT1ModeRegs()
2695 SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x01,0x08); in SiS_SetCRT1ModeRegs()
2698 data = 0; in SiS_SetCRT1ModeRegs()
2699 if(modeflag & LineCompareOff) data = 0x08; in SiS_SetCRT1ModeRegs()
2701 SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0F,0xF7,data); in SiS_SetCRT1ModeRegs()
2703 if(SiS_Pr->ChipType >= XGI_20) data |= 0x20; in SiS_SetCRT1ModeRegs()
2705 if(ModeNo > 0x13) { in SiS_SetCRT1ModeRegs()
2706 data |= 0x40; in SiS_SetCRT1ModeRegs()
2709 SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0F,0xB7,data); in SiS_SetCRT1ModeRegs()
2714 SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x31,0xfb); in SiS_SetCRT1ModeRegs()
2721 data &= 0xc7; in SiS_SetCRT1ModeRegs()
2727 if(data2 >= 0x50) { in SiS_SetCRT1ModeRegs()
2728 data &= 0x0f; in SiS_SetCRT1ModeRegs()
2729 data |= 0x50; in SiS_SetCRT1ModeRegs()
2732 SiS_SetReg(SiS_Pr->SiS_P3c4,0x17,data); in SiS_SetCRT1ModeRegs()
2740 if(SiS_Pr->SiS_ROMNew) data = ROMAddr[0xf6]; in SiS_SetCRT1ModeRegs()
2741 else if(SiS_Pr->SiS_UseROM) data = ROMAddr[0x100 + data]; in SiS_SetCRT1ModeRegs()
2742 else data = 0xba; in SiS_SetCRT1ModeRegs()
2745 data &= 0xc7; in SiS_SetCRT1ModeRegs()
2761 if (data2 >= 0x19c) data = 0xba; in SiS_SetCRT1ModeRegs()
2762 else if(data2 >= 0x140) data = 0x7a; in SiS_SetCRT1ModeRegs()
2763 else if(data2 >= 0x101) data = 0x3a; in SiS_SetCRT1ModeRegs()
2764 else if(data2 >= 0xf5) data = 0x32; in SiS_SetCRT1ModeRegs()
2765 else if(data2 >= 0xe2) data = 0x2a; in SiS_SetCRT1ModeRegs()
2766 else if(data2 >= 0xc4) data = 0x22; in SiS_SetCRT1ModeRegs()
2767 else if(data2 >= 0xac) data = 0x1a; in SiS_SetCRT1ModeRegs()
2768 else if(data2 >= 0x9e) data = 0x12; in SiS_SetCRT1ModeRegs()
2769 else if(data2 >= 0x8e) data = 0x0a; in SiS_SetCRT1ModeRegs()
2770 else data = 0x02; in SiS_SetCRT1ModeRegs()
2772 if(data2 >= 0x127) data = 0xba; in SiS_SetCRT1ModeRegs()
2773 else data = 0x7a; in SiS_SetCRT1ModeRegs()
2776 if (data2 >= 0x190) data = 0xba; in SiS_SetCRT1ModeRegs()
2777 else if(data2 >= 0xff) data = 0x7a; in SiS_SetCRT1ModeRegs()
2778 else if(data2 >= 0xd3) data = 0x3a; in SiS_SetCRT1ModeRegs()
2779 else if(data2 >= 0xa9) data = 0x1a; in SiS_SetCRT1ModeRegs()
2780 else if(data2 >= 0x93) data = 0x0a; in SiS_SetCRT1ModeRegs()
2781 else data = 0x02; in SiS_SetCRT1ModeRegs()
2784 SiS_SetReg(SiS_Pr->SiS_P3c4,0x17,data); in SiS_SetCRT1ModeRegs()
2791 data = 0x60; in SiS_SetCRT1ModeRegs()
2793 data ^= 0x60; in SiS_SetCRT1ModeRegs()
2795 data ^= 0xA0; in SiS_SetCRT1ModeRegs()
2798 SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x21,0x1F,data); in SiS_SetCRT1ModeRegs()
2805 if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x31) & 0x40) { in SiS_SetCRT1ModeRegs()
2806 SiS_SetReg(SiS_Pr->SiS_P3d4,0x52,0x2c); in SiS_SetCRT1ModeRegs()
2808 SiS_SetReg(SiS_Pr->SiS_P3d4,0x52,0x6c); in SiS_SetCRT1ModeRegs()
2811 if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x31) & 0x40) { in SiS_SetCRT1ModeRegs()
2812 SiS_SetReg(SiS_Pr->SiS_P3d4,0x52,0x33); in SiS_SetCRT1ModeRegs()
2814 SiS_SetReg(SiS_Pr->SiS_P3d4,0x52,0x73); in SiS_SetCRT1ModeRegs()
2816 SiS_SetReg(SiS_Pr->SiS_P3d4,0x51,0x02); in SiS_SetCRT1ModeRegs()
2825 #if 0 in SiS_SetupDualChip()
2827 SISIOADDRESS P2_3c2 = SiS_Pr->IOAddress2 + 0x12; in SiS_SetupDualChip()
2828 SISIOADDRESS P2_3c4 = SiS_Pr->IOAddress2 + 0x14; in SiS_SetupDualChip()
2829 SISIOADDRESS P2_3ce = SiS_Pr->IOAddress2 + 0x1e; in SiS_SetupDualChip()
2832 if((SiS_Pr->ChipRevision != 0) || in SiS_SetupDualChip()
2833 (!(SiS_GetReg(SiS_Pr->SiS_P3c4,0x3a) & 0x04))) in SiS_SetupDualChip()
2836 for(i = 0; i <= 4; i++) { /* SR00 - SR04 */ in SiS_SetupDualChip()
2839 for(i = 0; i <= 8; i++) { /* GR00 - GR08 */ in SiS_SetupDualChip()
2842 SiS_SetReg(P2_3c4,0x05,0x86); in SiS_SetupDualChip()
2843 SiS_SetReg(P2_3c4,0x06,SiS_GetReg(SiS_Pr->SiS_P3c4,0x06)); /* SR06 */ in SiS_SetupDualChip()
2844 SiS_SetReg(P2_3c4,0x21,SiS_GetReg(SiS_Pr->SiS_P3c4,0x21)); /* SR21 */ in SiS_SetupDualChip()
2846 SiS_SetReg(P2_3c4,0x05,0x00); in SiS_SetupDualChip()
2862 case 0: d1 = dh; d2 = ah; d3 = al; break; in SiS_WriteDAC()
2882 if(data == 0x00) table = SiS_MDA_DAC; in SiS_LoadDAC()
2883 else if(data == 0x08) table = SiS_CGA_DAC; in SiS_LoadDAC()
2884 else if(data == 0x10) table = SiS_EGA_DAC; in SiS_LoadDAC()
2885 else if(data == 0x18) { in SiS_LoadDAC()
2895 SiS_SetRegByte(SiS_Pr->SiS_P3c6,0xFF); in SiS_LoadDAC()
2898 sf = 0; in SiS_LoadDAC()
2905 SiS_SetRegByte(DACAddr,0x00); in SiS_LoadDAC()
2907 for(i = 0; i < j; i++) { in SiS_LoadDAC()
2909 for(k = 0; k < 3; k++) { in SiS_LoadDAC()
2910 data2 = 0; in SiS_LoadDAC()
2911 if(data & 0x01) data2 += 0x2A; in SiS_LoadDAC()
2912 if(data & 0x02) data2 += 0x15; in SiS_LoadDAC()
2921 for(k = 0; k < 3; k++) SiS_SetRegByte(DACData, data); in SiS_LoadDAC()
2924 for(m = 0; m < 9; m++) { in SiS_LoadDAC()
2927 for(n = 0; n < 3; n++) { in SiS_LoadDAC()
2928 for(o = 0; o < 5; o++) { in SiS_LoadDAC()
2933 for(o = 0; o < 3; o++) { in SiS_LoadDAC()
2972 SiS_Pr->SiS_SelectCRT2Rate = 0; in SiS_SetCRT1Group()
2991 if(RefreshRateTableIndex != 0xFFFF) { in SiS_SetCRT1Group()
3012 unsigned char sr2b = 0, sr2c = 0; in SiS_SetCRT1Group()
3014 case 0x00: in SiS_SetCRT1Group()
3015 case 0x01: sr2b = 0x4e; sr2c = 0xe9; break; in SiS_SetCRT1Group()
3016 case 0x04: in SiS_SetCRT1Group()
3017 case 0x05: in SiS_SetCRT1Group()
3018 case 0x0d: sr2b = 0x1b; sr2c = 0xe3; break; in SiS_SetCRT1Group()
3021 SiS_SetReg(SiS_Pr->SiS_P3c4,0x2b,sr2b); in SiS_SetCRT1Group()
3022 SiS_SetReg(SiS_Pr->SiS_P3c4,0x2c,sr2c); in SiS_SetCRT1Group()
3023 SiS_SetRegByte(SiS_Pr->SiS_P3c2,(SiS_GetRegByte(SiS_Pr->SiS_P3cc) | 0x0c)); in SiS_SetCRT1Group()
3060 SiS_Pr->Init_P4_0E = 0; in SiS_InitVB()
3062 SiS_Pr->Init_P4_0E = ROMAddr[0x82]; in SiS_InitVB()
3065 SiS_Pr->Init_P4_0E = ROMAddr[0x80]; in SiS_InitVB()
3080 temp = ROMAddr[VB310Data_1_2_Offset] | 0x40; in SiS_ResetVB()
3081 if(SiS_Pr->SiS_ROMNew) temp = ROMAddr[0x80] | 0x40; in SiS_ResetVB()
3082 SiS_SetReg(SiS_Pr->SiS_Part1Port,0x02,temp); in SiS_ResetVB()
3084 temp = ROMAddr[0x7e] | 0x40; in SiS_ResetVB()
3085 if(SiS_Pr->SiS_ROMNew) temp = ROMAddr[0x80] | 0x40; in SiS_ResetVB()
3086 SiS_SetReg(SiS_Pr->SiS_Part1Port,0x02,temp); in SiS_ResetVB()
3089 temp = 0x40; in SiS_ResetVB()
3090 if(SiS_Pr->SiS_XGIROM) temp |= ROMAddr[0x7e]; in SiS_ResetVB()
3092 SiS_SetReg(SiS_Pr->SiS_Part1Port,0x02,temp); in SiS_ResetVB()
3112 SiS_SetReg(SiS_Pr->SiS_VidCapt, 0x3f, 0x00); /* Fiddle with capture regs */ in SiS_StrangeStuff()
3113 SiS_SetReg(SiS_Pr->SiS_VidCapt, 0x00, 0x00); in SiS_StrangeStuff()
3114 SiS_SetReg(SiS_Pr->SiS_VidPlay, 0x00, 0x86); /* (BIOS does NOT unlock) */ in SiS_StrangeStuff()
3115 SiS_SetRegAND(SiS_Pr->SiS_VidPlay, 0x30, 0xfe); /* Fiddle with video regs */ in SiS_StrangeStuff()
3116 SiS_SetRegAND(SiS_Pr->SiS_VidPlay, 0x3f, 0xef); in SiS_StrangeStuff()
3118 /* !!! This does not support modes < 0x13 !!! */ in SiS_StrangeStuff()
3134 ((SiS_GetReg(SiS_Pr->SiS_P3d4, 0x5c) & 0xf8) != 0x80) || in SiS_Handle760()
3139 somebase = sisfb_read_mio_pci_word(SiS_Pr, 0x74); in SiS_Handle760()
3140 somebase &= 0xffff; in SiS_Handle760()
3142 if(somebase == 0) return; in SiS_Handle760()
3144 temp3 = SiS_GetRegByte((somebase + 0x85)) & 0xb7; in SiS_Handle760()
3146 if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x31) & 0x40) { in SiS_Handle760()
3147 temp1 = 0x21; in SiS_Handle760()
3148 temp2 = 0x03; in SiS_Handle760()
3149 temp3 |= 0x08; in SiS_Handle760()
3151 temp1 = 0x25; in SiS_Handle760()
3152 temp2 = 0x0b; in SiS_Handle760()
3155 sisfb_write_nbridge_pci_byte(SiS_Pr, 0x7e, temp1); in SiS_Handle760()
3156 sisfb_write_nbridge_pci_byte(SiS_Pr, 0x8d, temp2); in SiS_Handle760()
3158 SiS_SetRegByte((somebase + 0x85), temp3); in SiS_Handle760()
3171 unsigned char backupreg = 0; in SiSSetMode()
3177 SiS_Pr->SiS_flag_clearbuffer = 0; in SiSSetMode()
3180 ModeNo = 0xfe; in SiSSetMode()
3182 if(!(ModeNo & 0x80)) SiS_Pr->SiS_flag_clearbuffer = 1; in SiSSetMode()
3183 ModeNo &= 0x7f; in SiSSetMode()
3188 if(ModeNo == 0x5b) ModeNo = 0x56; in SiSSetMode()
3194 SiS_Pr->SiS_VGAINFO = 0x11; in SiSSetMode()
3196 KeepLockReg = SiS_GetReg(SiS_Pr->SiS_P3c4,0x05); in SiSSetMode()
3197 SiS_SetReg(SiS_Pr->SiS_P3c4,0x05,0x86); in SiSSetMode()
3208 ModeIdIndex = 0; in SiSSetMode()
3218 SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x32,0x10); in SiSSetMode()
3219 SiS_SetRegOR(SiS_Pr->SiS_Part2Port,0x00,0x0c); in SiSSetMode()
3220 backupreg = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38); in SiSSetMode()
3222 backupreg = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35); in SiSSetMode()
3227 SiS_GetVBInfo(SiS_Pr, ModeNo, ModeIdIndex, (SiS_Pr->UseCustomMode) ? 0 : 1); in SiSSetMode()
3258 (SiS_Pr->SiS_IF_DEF_CH70xx != 0) || in SiSSetMode()
3259 (SiS_Pr->SiS_IF_DEF_TRUMPION != 0) ) { in SiSSetMode()
3269 SiS_SetRegByte(SiS_Pr->SiS_P3c6,0xFF); in SiSSetMode()
3275 SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x13,0xfb); in SiSSetMode()
3286 SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x35,0x01); in SiSSetMode()
3288 SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x35,0xFE); in SiSSetMode()
3292 SiS_SetReg(SiS_Pr->SiS_P3d4,0x38,backupreg); in SiSSetMode()
3294 if((IS_SIS650) && (SiS_GetReg(SiS_Pr->SiS_P3d4,0x30) & 0xfc)) { in SiSSetMode()
3295 if((ModeNo == 0x03) || (ModeNo == 0x10)) { in SiSSetMode()
3296 SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x51,0x80); in SiSSetMode()
3297 SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x56,0x08); in SiSSetMode()
3301 if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x30) & SetCRT2ToLCD) { in SiSSetMode()
3302 SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x38,0xfc); in SiSSetMode()
3307 SiS_SetReg(SiS_Pr->SiS_P3d4,0x35,backupreg); in SiSSetMode()
3316 if(KeepLockReg != 0xA1) SiS_SetReg(SiS_Pr->SiS_P3c4,0x05,0x00); in SiSSetMode()
3322 #define GENBITSMASK(mask) GENMASK(1?mask,0?mask)
3323 #define GETBITS(var,mask) (((var) & GENBITSMASK(mask)) >> (0?mask))
3324 #define GETBITSTR(val,from,to) ((GETBITS(val,from)) << (0?to))
3332 SiS_Pr->CCRT1CRTC[0] = ((SiS_Pr->CHTotal >> 3) - 5) & 0xff; /* CR0 */ in SiS_CalcCRRegisters()
3335 SiS_Pr->CCRT1CRTC[3] = (((SiS_Pr->CHBlankEnd >> 3) - 1) & 0x1F) | 0x80; /* CR3 */ in SiS_CalcCRRegisters()
3337 SiS_Pr->CCRT1CRTC[5] = ((((SiS_Pr->CHBlankEnd >> 3) - 1) & 0x20) << 2) | /* CR5 */ in SiS_CalcCRRegisters()
3338 (((SiS_Pr->CHSyncEnd >> 3) + 3) & 0x1F); in SiS_CalcCRRegisters()
3340 SiS_Pr->CCRT1CRTC[6] = (SiS_Pr->CVTotal - 2) & 0xFF; /* CR6 */ in SiS_CalcCRRegisters()
3341 SiS_Pr->CCRT1CRTC[7] = (((SiS_Pr->CVTotal - 2) & 0x100) >> 8) /* CR7 */ in SiS_CalcCRRegisters()
3342 | (((SiS_Pr->CVDisplay - 1) & 0x100) >> 7) in SiS_CalcCRRegisters()
3343 | (((SiS_Pr->CVSyncStart - x) & 0x100) >> 6) in SiS_CalcCRRegisters()
3344 | (((SiS_Pr->CVBlankStart- 1) & 0x100) >> 5) in SiS_CalcCRRegisters()
3345 | 0x10 in SiS_CalcCRRegisters()
3346 | (((SiS_Pr->CVTotal - 2) & 0x200) >> 4) in SiS_CalcCRRegisters()
3347 | (((SiS_Pr->CVDisplay - 1) & 0x200) >> 3) in SiS_CalcCRRegisters()
3348 | (((SiS_Pr->CVSyncStart - x) & 0x200) >> 2); in SiS_CalcCRRegisters()
3350 SiS_Pr->CCRT1CRTC[16] = ((((SiS_Pr->CVBlankStart - 1) & 0x200) >> 4) >> 5); /* CR9 */ in SiS_CalcCRRegisters()
3353 if(SiS_Pr->CHDisplay >= 1600) SiS_Pr->CCRT1CRTC[16] |= 0x60; /* SRE */ in SiS_CalcCRRegisters()
3354 else if(SiS_Pr->CHDisplay >= 640) SiS_Pr->CCRT1CRTC[16] |= 0x40; in SiS_CalcCRRegisters()
3357 SiS_Pr->CCRT1CRTC[8] = (SiS_Pr->CVSyncStart - x) & 0xFF; /* CR10 */ in SiS_CalcCRRegisters()
3358 SiS_Pr->CCRT1CRTC[9] = ((SiS_Pr->CVSyncEnd - x) & 0x0F) | 0x80; /* CR11 */ in SiS_CalcCRRegisters()
3359 SiS_Pr->CCRT1CRTC[10] = (SiS_Pr->CVDisplay - 1) & 0xFF; /* CR12 */ in SiS_CalcCRRegisters()
3360 SiS_Pr->CCRT1CRTC[11] = (SiS_Pr->CVBlankStart - 1) & 0xFF; /* CR15 */ in SiS_CalcCRRegisters()
3361 SiS_Pr->CCRT1CRTC[12] = (SiS_Pr->CVBlankEnd - 1) & 0xFF; /* CR16 */ in SiS_CalcCRRegisters()
3364 GETBITSTR((SiS_Pr->CVTotal -2), 10:10, 0:0) | in SiS_CalcCRRegisters()
3372 GETBITSTR((SiS_Pr->CHTotal >> 3) - 5, 9:8, 1:0) | in SiS_CalcCRRegisters()
3379 GETBITSTR((SiS_Pr->CHBlankEnd >> 3) - 1, 7:6, 1:0) | in SiS_CalcCRRegisters()
3387 unsigned short modeflag, tempax, tempbx = 0, remaining = 0; in SiS_CalcLCDACRT1Timing()
3485 tempax = 0; in SiS_CalcLCDACRT1Timing()
3506 SiS_Pr->CCRT1CRTC[15] &= ~0xF8; in SiS_CalcLCDACRT1Timing()
3508 SiS_Pr->CCRT1CRTC[16] &= ~0xE0; in SiS_CalcLCDACRT1Timing()
3510 SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x11,0x7f); in SiS_CalcLCDACRT1Timing()
3512 for(i = 0, j = 0; i <= 7; i++, j++) { in SiS_CalcLCDACRT1Timing()
3515 for(j = 0x10; i <= 10; i++, j++) { in SiS_CalcLCDACRT1Timing()
3518 for(j = 0x15; i <= 12; i++, j++) { in SiS_CalcLCDACRT1Timing()
3521 for(j = 0x0A; i <= 15; i++, j++) { in SiS_CalcLCDACRT1Timing()
3525 tempax = SiS_Pr->CCRT1CRTC[16] & 0xE0; in SiS_CalcLCDACRT1Timing()
3526 SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0E,0x1F,tempax); in SiS_CalcLCDACRT1Timing()
3528 tempax = (SiS_Pr->CCRT1CRTC[16] & 0x01) << 5; in SiS_CalcLCDACRT1Timing()
3529 if(modeflag & DoubleScanMode) tempax |= 0x80; in SiS_CalcLCDACRT1Timing()
3530 SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,0x5F,tempax); in SiS_CalcLCDACRT1Timing()
3548 HDE = crdata[1] | ((unsigned short)(sr_data & 0x0C) << 6); in SiS_Generic_ConvertCRData()
3552 HRS = crdata[4] | ((unsigned short)(sr_data & 0xC0) << 2); in SiS_Generic_ConvertCRData()
3559 HBE = (crdata[3] & 0x1f) | in SiS_Generic_ConvertCRData()
3560 ((unsigned short)(cr_data & 0x80) >> 2) | in SiS_Generic_ConvertCRData()
3561 ((unsigned short)(sr_data & 0x03) << 6); in SiS_Generic_ConvertCRData()
3564 HRE = (cr_data & 0x1f) | ((sr_data & 0x04) << 3); in SiS_Generic_ConvertCRData()
3567 B = (temp > 0) ? temp : (temp + 256); in SiS_Generic_ConvertCRData()
3570 C = (temp > 0) ? temp : (temp + 64); in SiS_Generic_ConvertCRData()
3585 ((unsigned short)(cr_data & 0x02) << 7) | in SiS_Generic_ConvertCRData()
3586 ((unsigned short)(cr_data & 0x40) << 3) | in SiS_Generic_ConvertCRData()
3587 ((unsigned short)(sr_data & 0x02) << 9); in SiS_Generic_ConvertCRData()
3592 ((unsigned short)(cr_data & 0x04) << 6) | in SiS_Generic_ConvertCRData()
3593 ((unsigned short)(cr_data & 0x80) << 2) | in SiS_Generic_ConvertCRData()
3594 ((unsigned short)(sr_data & 0x08) << 7); in SiS_Generic_ConvertCRData()
3598 VBE = crdata[12] | ((unsigned short)(sr_data & 0x10) << 4); in SiS_Generic_ConvertCRData()
3600 B = (temp > 0) ? temp : (temp + 512); in SiS_Generic_ConvertCRData()
3603 VRE = (crdata[9] & 0x0f) | ((sr_data & 0x20) >> 1); in SiS_Generic_ConvertCRData()
3605 C = (temp > 0) ? temp : (temp + 32); in SiS_Generic_ConvertCRData()
3617 * (HRE is 0, leading into a too large C and in SiS_Generic_ConvertCRData()