init.c
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:159k
- /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init.c,v 1.3 2002/24/04 01:16:16 dawes Exp $ */
- /*
- * Mode switching code (CRT1 section) for SiS 300/540/630/730/315/550/650/740
- * (Universal module for Linux kernel framebuffer and XFree86 4.x)
- *
- * Assembler-To-C translation
- * Parts Copyright 2002 by Thomas Winischhofer <thomas@winischhofer.net>
- *
- * Based on BIOS
- * 1.10.07 (1.10a) for SiS650/LVDS+CH7019
- * 1.07.1b for SiS650/301(B/LV)
- * 2.04.50 (I) and 2.04.5c (II), 2.07a for SiS630/301(B)
- * 2.02.3b, 2.03.02 and 2.04.5c for 630/LVDS/LVDS+CH7005
- * 1.09b for 315/301(B)
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the copyright holder not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The copyright holder makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- */
- #include "init.h"
- #ifdef SIS300
- #include "300vtbl.h"
- #endif
- #ifdef SIS315H
- #include "310vtbl.h"
- #endif
- #ifdef LINUX_XF86
- BOOLEAN SiSBIOSSetMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,
- ScrnInfoPtr pScrn, DisplayModePtr mode);
- #ifdef SISDUALHEAD /* TW: For dual head */
- BOOLEAN SiSBIOSSetModeCRT1(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,
- ScrnInfoPtr pScrn, DisplayModePtr mode);
- BOOLEAN SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,
- ScrnInfoPtr pScrn, DisplayModePtr mode);
- #endif /* dual head */
- #endif /* linux_xf86 */
- #ifdef LINUXBIOS
- BOOLEAN SiSInit(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension);
- #endif
- #ifdef LINUX_XF86
- BOOLEAN SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,
- ScrnInfoPtr pScrn,USHORT ModeNo, BOOLEAN dosetpitch);
- #else
- BOOLEAN SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,
- USHORT ModeNo);
- #endif
- #if defined(ALLOC_PRAGMA)
- #pragma alloc_text(PAGE,SiSSetMode)
- #pragma alloc_text(PAGE,SiSInit)
- #endif
- void DelaySeconds(int seconds);
- void DebugCode(SiS_Private *SiS_Pr, UCHAR code);
- #ifdef LINUX_XF86
- /* TW: Mode table for X driver */
- const UShort ModeIndex_320x480[] = {0x5A, 0x5B, 0x00, 0x00}; /* DSTN/FSTN */
- const UShort ModeIndex_512x384[] = {0x52, 0x58, 0x00, 0x5c};
- const UShort ModeIndex_640x480[] = {0x2E, 0x44, 0x00, 0x62};
- const UShort ModeIndex_720x480[] = {0x31, 0x33, 0x00, 0x35};
- const UShort ModeIndex_720x576[] = {0x32, 0x34, 0x00, 0x36};
- const UShort ModeIndex_800x480[] = {0x70, 0x7a, 0x00, 0x76}; /* 310/325 series only */
- const UShort ModeIndex_800x600[] = {0x30, 0x47, 0x00, 0x63};
- const UShort ModeIndex_1024x768[] = {0x38, 0x4A, 0x00, 0x64};
- const UShort ModeIndex_1024x576[] = {0x71, 0x74, 0x00, 0x77}; /* 310/325 series only */
- const UShort ModeIndex_1024x600[] = {0x20, 0x21, 0x00, 0x22}; /* 300 series only */
- const UShort ModeIndex_1280x1024[] = {0x3A, 0x4D, 0x00, 0x65};
- const UShort ModeIndex_300_1280x960[] = {0x6e, 0x6f, 0x00, 0x7b};
- const UShort ModeIndex_310_1280x960[] = {0x7C, 0x7D, 0x00, 0x7E};
- const UShort ModeIndex_1152x768[] = {0x23, 0x24, 0x00, 0x25}; /* 300 series only */
- const UShort ModeIndex_1280x768[] = {0x23, 0x24, 0x00, 0x25}; /* 310/325 series only */
- const UShort ModeIndex_1280x720[] = {0x79, 0x75, 0x00, 0x78}; /* 310/325 series only */
- const UShort ModeIndex_1400x1050[] = {0x26, 0x27, 0x00, 0x28}; /* 310/325 series only */
- const UShort ModeIndex_1600x1200[] = {0x3C, 0x3D, 0x00, 0x66};
- const UShort ModeIndex_1920x1440[] = {0x68, 0x69, 0x00, 0x6B};
- const UShort ModeIndex_2048x1536[] = {0x6c, 0x6d, 0x00, 0x6e}; /* 310/325 series only */
- #endif
- void
- DelaySeconds(int seconds)
- {
- int i;
- #ifdef WIN2000
- int j;
- #endif
- for (i=0;i<seconds;i++) {
- #ifdef TC
- delay(1000);
- #endif
- #ifdef WIN2000
- for (j=0;j<20000;j++)
- VideoPortStallExecution(50);
- #endif
- #ifdef WINCE_HEADER
- #endif
- #ifdef LINUX_KERNEL
- #endif
- }
- }
- void
- DebugCode(SiS_Private *SiS_Pr, UCHAR code)
- {
- OutPortByte(0x80, code);
- DelaySeconds(0x3);
- }
- #ifdef SIS300
- void
- InitTo300Pointer(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
- {
- SiS_Pr->SiS_SModeIDTable = (SiS_StStruct *)SiS300_SModeIDTable;
- SiS_Pr->SiS_VBModeIDTable = (SiS_VBModeStruct *)SiS300_VBModeIDTable;
- SiS_Pr->SiS_StandTable = (SiS_StandTableStruct *)SiS300_StandTable;
- SiS_Pr->SiS_EModeIDTable = (SiS_ExtStruct *)SiS300_EModeIDTable;
- SiS_Pr->SiS_RefIndex = (SiS_Ext2Struct *)SiS300_RefIndex;
- SiS_Pr->SiS_CRT1Table = (SiS_CRT1TableStruct *)SiS300_CRT1Table;
- if(HwDeviceExtension->jChipType == SIS_300) {
- SiS_Pr->SiS_MCLKData_0 = (SiS_MCLKDataStruct *)SiS300_MCLKData_300; /* 300 */
- } else {
- SiS_Pr->SiS_MCLKData_0 = (SiS_MCLKDataStruct *)SiS300_MCLKData_630; /* 630 */
- }
- SiS_Pr->SiS_ECLKData = (SiS_ECLKDataStruct *)SiS300_ECLKData;
- SiS_Pr->SiS_VCLKData = (SiS_VCLKDataStruct *)SiS300_VCLKData;
- SiS_Pr->SiS_VBVCLKData = (SiS_VBVCLKDataStruct *)SiS300_VCLKData;
- SiS_Pr->SiS_ScreenOffset = SiS300_ScreenOffset;
- SiS_Pr->SiS_StResInfo = (SiS_StResInfoStruct *)SiS300_StResInfo;
- SiS_Pr->SiS_ModeResInfo = (SiS_ModeResInfoStruct *)SiS300_ModeResInfo;
- SiS_Pr->pSiS_OutputSelect = &SiS300_OutputSelect;
- SiS_Pr->pSiS_SoftSetting = &SiS300_SoftSetting;
- SiS_Pr->SiS_SR15 = SiS300_SR15;
- #ifndef LINUX_XF86
- SiS_Pr->pSiS_SR07 = &SiS300_SR07;
- SiS_Pr->SiS_CR40 = SiS300_CR40;
- SiS_Pr->SiS_CR49 = SiS300_CR49;
- SiS_Pr->pSiS_SR1F = &SiS300_SR1F;
- SiS_Pr->pSiS_SR21 = &SiS300_SR21;
- SiS_Pr->pSiS_SR22 = &SiS300_SR22;
- SiS_Pr->pSiS_SR23 = &SiS300_SR23;
- SiS_Pr->pSiS_SR24 = &SiS300_SR24;
- SiS_Pr->SiS_SR25 = SiS300_SR25;
- SiS_Pr->pSiS_SR31 = &SiS300_SR31;
- SiS_Pr->pSiS_SR32 = &SiS300_SR32;
- SiS_Pr->pSiS_SR33 = &SiS300_SR33;
- SiS_Pr->pSiS_CRT2Data_1_2 = &SiS300_CRT2Data_1_2;
- SiS_Pr->pSiS_CRT2Data_4_D = &SiS300_CRT2Data_4_D;
- SiS_Pr->pSiS_CRT2Data_4_E = &SiS300_CRT2Data_4_E;
- SiS_Pr->pSiS_CRT2Data_4_10 = &SiS300_CRT2Data_4_10;
- SiS_Pr->pSiS_RGBSenseData = &SiS300_RGBSenseData;
- SiS_Pr->pSiS_VideoSenseData = &SiS300_VideoSenseData;
- SiS_Pr->pSiS_YCSenseData = &SiS300_YCSenseData;
- SiS_Pr->pSiS_RGBSenseData2 = &SiS300_RGBSenseData2;
- SiS_Pr->pSiS_VideoSenseData2 = &SiS300_VideoSenseData2;
- SiS_Pr->pSiS_YCSenseData2 = &SiS300_YCSenseData2;
- #endif
- SiS_Pr->SiS_NTSCPhase = SiS300_NTSCPhase;
- SiS_Pr->SiS_PALPhase = SiS300_PALPhase;
- SiS_Pr->SiS_NTSCPhase2 = SiS300_NTSCPhase2;
- SiS_Pr->SiS_PALPhase2 = SiS300_PALPhase2;
- SiS_Pr->SiS_PALMPhase = SiS300_PALMPhase;
- SiS_Pr->SiS_PALNPhase = SiS300_PALNPhase;
- SiS_Pr->SiS_PALMPhase2 = SiS300_PALMPhase2;
- SiS_Pr->SiS_PALNPhase2 = SiS300_PALNPhase2;
- SiS_Pr->SiS_StLCD1024x768Data = (SiS_LCDDataStruct *)SiS300_StLCD1024x768Data;
- SiS_Pr->SiS_ExtLCD1024x768Data = (SiS_LCDDataStruct *)SiS300_ExtLCD1024x768Data;
- SiS_Pr->SiS_St2LCD1024x768Data = (SiS_LCDDataStruct *)SiS300_St2LCD1024x768Data;
- SiS_Pr->SiS_StLCD1280x1024Data = (SiS_LCDDataStruct *)SiS300_StLCD1280x1024Data;
- SiS_Pr->SiS_ExtLCD1280x1024Data = (SiS_LCDDataStruct *)SiS300_ExtLCD1280x1024Data;
- SiS_Pr->SiS_St2LCD1280x1024Data = (SiS_LCDDataStruct *)SiS300_St2LCD1280x1024Data;
- SiS_Pr->SiS_NoScaleData1024x768 = (SiS_LCDDataStruct *)SiS300_NoScaleData1024x768;
- SiS_Pr->SiS_NoScaleData1280x1024 = (SiS_LCDDataStruct *)SiS300_NoScaleData1280x1024;
- SiS_Pr->SiS_LCD1280x960Data = (SiS_LCDDataStruct *)SiS300_LCD1280x960Data;
- SiS_Pr->SiS_ExtLCD1400x1050Data = (SiS_LCDDataStruct *)SiS300_ExtLCD1400x1050Data;
- SiS_Pr->SiS_ExtLCD1600x1200Data = (SiS_LCDDataStruct *)SiS300_ExtLCD1600x1200Data;
- SiS_Pr->SiS_StLCD1400x1050Data = (SiS_LCDDataStruct *)SiS300_StLCD1400x1050Data;
- SiS_Pr->SiS_StLCD1600x1200Data = (SiS_LCDDataStruct *)SiS300_StLCD1600x1200Data;
- SiS_Pr->SiS_NoScaleData1400x1050 = (SiS_LCDDataStruct *)SiS300_NoScaleData1400x1050;
- SiS_Pr->SiS_NoScaleData1600x1200 = (SiS_LCDDataStruct *)SiS300_NoScaleData1600x1200;
- SiS_Pr->SiS_StPALData = (SiS_TVDataStruct *)SiS300_StPALData;
- SiS_Pr->SiS_ExtPALData = (SiS_TVDataStruct *)SiS300_ExtPALData;
- SiS_Pr->SiS_StNTSCData = (SiS_TVDataStruct *)SiS300_StNTSCData;
- SiS_Pr->SiS_ExtNTSCData = (SiS_TVDataStruct *)SiS300_ExtNTSCData;
- #ifdef oldHV
- SiS_Pr->SiS_St1HiTVData = (SiS_TVDataStruct *)SiS300_St1HiTVData;
- SiS_Pr->SiS_St2HiTVData = (SiS_TVDataStruct *)SiS300_St2HiTVData;
- SiS_Pr->SiS_ExtHiTVData = (SiS_TVDataStruct *)SiS300_ExtHiTVData;
- #endif
- SiS_Pr->SiS_NTSCTiming = SiS300_NTSCTiming;
- SiS_Pr->SiS_PALTiming = SiS300_PALTiming;
- #ifdef oldHV
- SiS_Pr->SiS_HiTVSt1Timing = SiS300_HiTVSt1Timing;
- SiS_Pr->SiS_HiTVSt2Timing = SiS300_HiTVSt2Timing;
- SiS_Pr->SiS_HiTVTextTiming = SiS300_HiTVTextTiming;
- SiS_Pr->SiS_HiTVGroup3Data = SiS300_HiTVGroup3Data;
- SiS_Pr->SiS_HiTVGroup3Simu = SiS300_HiTVGroup3Simu;
- SiS_Pr->SiS_HiTVGroup3Text = SiS300_HiTVGroup3Text;
- #endif
- SiS_Pr->SiS_PanelDelayTbl = (SiS_PanelDelayTblStruct *)SiS300_PanelDelayTbl;
- SiS_Pr->SiS_PanelDelayTblLVDS = (SiS_PanelDelayTblStruct *)SiS300_PanelDelayTblLVDS;
- SiS_Pr->SiS_LVDS800x600Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS800x600Data_1;
- SiS_Pr->SiS_LVDS800x600Data_2 = (SiS_LVDSDataStruct *)SiS300_LVDS800x600Data_2;
- SiS_Pr->SiS_LVDS1024x768Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS1024x768Data_1;
- SiS_Pr->SiS_LVDS1024x768Data_2 = (SiS_LVDSDataStruct *)SiS300_LVDS1024x768Data_2;
- SiS_Pr->SiS_LVDS1280x1024Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS1280x1024Data_1;
- SiS_Pr->SiS_LVDS1280x1024Data_2 = (SiS_LVDSDataStruct *)SiS300_LVDS1280x1024Data_2;
- SiS_Pr->SiS_LVDS1280x960Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS1280x1024Data_1;
- SiS_Pr->SiS_LVDS1280x960Data_2 = (SiS_LVDSDataStruct *)SiS300_LVDS1280x1024Data_2;
- SiS_Pr->SiS_LVDS1400x1050Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS1400x1050Data_1;
- SiS_Pr->SiS_LVDS1400x1050Data_2 = (SiS_LVDSDataStruct *)SiS300_LVDS1400x1050Data_2;
- SiS_Pr->SiS_LVDS1024x600Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS1024x600Data_1;
- SiS_Pr->SiS_LVDS1024x600Data_2 = (SiS_LVDSDataStruct *)SiS300_LVDS1024x600Data_2;
- SiS_Pr->SiS_LVDS1152x768Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS1152x768Data_1;
- SiS_Pr->SiS_LVDS1152x768Data_2 = (SiS_LVDSDataStruct *)SiS300_LVDS1152x768Data_2;
- SiS_Pr->SiS_LVDSXXXxXXXData_1 = (SiS_LVDSDataStruct *)SiS300_LVDSXXXxXXXData_1;
- SiS_Pr->SiS_LVDS320x480Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS320x480Data_1;
- SiS_Pr->SiS_LVDS640x480Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS640x480Data_1;
- SiS_Pr->SiS_LCDA1400x1050Data_1 = (SiS_LVDSDataStruct *)SiS300_LCDA1400x1050Data_1;
- SiS_Pr->SiS_LCDA1400x1050Data_2 = (SiS_LVDSDataStruct *)SiS300_LCDA1400x1050Data_2;
- SiS_Pr->SiS_LCDA1600x1200Data_1 = (SiS_LVDSDataStruct *)SiS300_LCDA1600x1200Data_1;
- SiS_Pr->SiS_LCDA1600x1200Data_2 = (SiS_LVDSDataStruct *)SiS300_LCDA1600x1200Data_2;
- SiS_Pr->SiS_CHTVUNTSCData = (SiS_LVDSDataStruct *)SiS300_CHTVUNTSCData;
- SiS_Pr->SiS_CHTVONTSCData = (SiS_LVDSDataStruct *)SiS300_CHTVONTSCData;
- SiS_Pr->SiS_CHTVUPALData = (SiS_LVDSDataStruct *)SiS300_CHTVUPALData;
- SiS_Pr->SiS_CHTVOPALData = (SiS_LVDSDataStruct *)SiS300_CHTVOPALData;
- SiS_Pr->SiS_PanelType00_1 = (SiS_LVDSDesStruct *)SiS300_PanelType00_1;
- SiS_Pr->SiS_PanelType01_1 = (SiS_LVDSDesStruct *)SiS300_PanelType01_1;
- SiS_Pr->SiS_PanelType02_1 = (SiS_LVDSDesStruct *)SiS300_PanelType02_1;
- SiS_Pr->SiS_PanelType03_1 = (SiS_LVDSDesStruct *)SiS300_PanelType03_1;
- SiS_Pr->SiS_PanelType04_1 = (SiS_LVDSDesStruct *)SiS300_PanelType04_1;
- SiS_Pr->SiS_PanelType05_1 = (SiS_LVDSDesStruct *)SiS300_PanelType05_1;
- SiS_Pr->SiS_PanelType06_1 = (SiS_LVDSDesStruct *)SiS300_PanelType06_1;
- SiS_Pr->SiS_PanelType07_1 = (SiS_LVDSDesStruct *)SiS300_PanelType07_1;
- SiS_Pr->SiS_PanelType08_1 = (SiS_LVDSDesStruct *)SiS300_PanelType08_1;
- SiS_Pr->SiS_PanelType09_1 = (SiS_LVDSDesStruct *)SiS300_PanelType09_1;
- SiS_Pr->SiS_PanelType0a_1 = (SiS_LVDSDesStruct *)SiS300_PanelType0a_1;
- SiS_Pr->SiS_PanelType0b_1 = (SiS_LVDSDesStruct *)SiS300_PanelType0b_1;
- SiS_Pr->SiS_PanelType0c_1 = (SiS_LVDSDesStruct *)SiS300_PanelType0c_1;
- SiS_Pr->SiS_PanelType0d_1 = (SiS_LVDSDesStruct *)SiS300_PanelType0d_1;
- SiS_Pr->SiS_PanelType0e_1 = (SiS_LVDSDesStruct *)SiS300_PanelType0e_1;
- SiS_Pr->SiS_PanelType0f_1 = (SiS_LVDSDesStruct *)SiS300_PanelType0f_1;
- SiS_Pr->SiS_PanelType00_2 = (SiS_LVDSDesStruct *)SiS300_PanelType00_2;
- SiS_Pr->SiS_PanelType01_2 = (SiS_LVDSDesStruct *)SiS300_PanelType01_2;
- SiS_Pr->SiS_PanelType02_2 = (SiS_LVDSDesStruct *)SiS300_PanelType02_2;
- SiS_Pr->SiS_PanelType03_2 = (SiS_LVDSDesStruct *)SiS300_PanelType03_2;
- SiS_Pr->SiS_PanelType04_2 = (SiS_LVDSDesStruct *)SiS300_PanelType04_2;
- SiS_Pr->SiS_PanelType05_2 = (SiS_LVDSDesStruct *)SiS300_PanelType05_2;
- SiS_Pr->SiS_PanelType06_2 = (SiS_LVDSDesStruct *)SiS300_PanelType06_2;
- SiS_Pr->SiS_PanelType07_2 = (SiS_LVDSDesStruct *)SiS300_PanelType07_2;
- SiS_Pr->SiS_PanelType08_2 = (SiS_LVDSDesStruct *)SiS300_PanelType08_2;
- SiS_Pr->SiS_PanelType09_2 = (SiS_LVDSDesStruct *)SiS300_PanelType09_2;
- SiS_Pr->SiS_PanelType0a_2 = (SiS_LVDSDesStruct *)SiS300_PanelType0a_2;
- SiS_Pr->SiS_PanelType0b_2 = (SiS_LVDSDesStruct *)SiS300_PanelType0b_2;
- SiS_Pr->SiS_PanelType0c_2 = (SiS_LVDSDesStruct *)SiS300_PanelType0c_2;
- SiS_Pr->SiS_PanelType0d_2 = (SiS_LVDSDesStruct *)SiS300_PanelType0d_2;
- SiS_Pr->SiS_PanelType0e_2 = (SiS_LVDSDesStruct *)SiS300_PanelType0e_2;
- SiS_Pr->SiS_PanelType0f_2 = (SiS_LVDSDesStruct *)SiS300_PanelType0f_2;
- SiS_Pr->SiS_CHTVUNTSCDesData = (SiS_LVDSDesStruct *)SiS300_CHTVUNTSCDesData;
- SiS_Pr->SiS_CHTVONTSCDesData = (SiS_LVDSDesStruct *)SiS300_CHTVONTSCDesData;
- SiS_Pr->SiS_CHTVUPALDesData = (SiS_LVDSDesStruct *)SiS300_CHTVUPALDesData;
- SiS_Pr->SiS_CHTVOPALDesData = (SiS_LVDSDesStruct *)SiS300_CHTVOPALDesData;
- SiS_Pr->SiS_LVDSCRT1800x600_1 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT1800x600_1;
- SiS_Pr->SiS_LVDSCRT11024x768_1 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11024x768_1;
- SiS_Pr->SiS_LVDSCRT11280x1024_1 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11280x1024_1;
- SiS_Pr->SiS_LVDSCRT11024x600_1 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11024x600_1;
- SiS_Pr->SiS_LVDSCRT11152x768_1 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11152x768_1;
- SiS_Pr->SiS_LVDSCRT1800x600_1_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT1800x600_1_H;
- SiS_Pr->SiS_LVDSCRT11024x768_1_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11024x768_1_H;
- SiS_Pr->SiS_LVDSCRT11280x1024_1_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11280x1024_1_H;
- SiS_Pr->SiS_LVDSCRT11024x600_1_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11024x600_1_H;
- SiS_Pr->SiS_LVDSCRT11152x768_1_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11152x768_1_H;
- SiS_Pr->SiS_LVDSCRT1800x600_2 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT1800x600_2;
- SiS_Pr->SiS_LVDSCRT11024x768_2 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11024x768_2;
- SiS_Pr->SiS_LVDSCRT11280x1024_2 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11280x1024_2;
- SiS_Pr->SiS_LVDSCRT11024x600_2 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11024x600_2;
- SiS_Pr->SiS_LVDSCRT11152x768_2 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11152x768_2;
- SiS_Pr->SiS_LVDSCRT1800x600_2_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT1800x600_2_H;
- SiS_Pr->SiS_LVDSCRT11024x768_2_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11024x768_2_H;
- SiS_Pr->SiS_LVDSCRT11280x1024_2_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11280x1024_2_H;
- SiS_Pr->SiS_LVDSCRT11024x600_2_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11024x600_2_H;
- SiS_Pr->SiS_LVDSCRT11152x768_2_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11152x768_2_H;
- SiS_Pr->SiS_CHTVCRT1UNTSC = (SiS_LVDSCRT1DataStruct *)SiS300_CHTVCRT1UNTSC;
- SiS_Pr->SiS_CHTVCRT1ONTSC = (SiS_LVDSCRT1DataStruct *)SiS300_CHTVCRT1ONTSC;
- SiS_Pr->SiS_CHTVCRT1UPAL = (SiS_LVDSCRT1DataStruct *)SiS300_CHTVCRT1UPAL;
- SiS_Pr->SiS_CHTVCRT1OPAL = (SiS_LVDSCRT1DataStruct *)SiS300_CHTVCRT1OPAL;
- SiS_Pr->SiS_CHTVReg_UNTSC = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_UNTSC;
- SiS_Pr->SiS_CHTVReg_ONTSC = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_ONTSC;
- SiS_Pr->SiS_CHTVReg_UPAL = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_UPAL;
- SiS_Pr->SiS_CHTVReg_OPAL = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_OPAL;
- SiS_Pr->SiS_CHTVVCLKUNTSC = SiS300_CHTVVCLKUNTSC;
- SiS_Pr->SiS_CHTVVCLKONTSC = SiS300_CHTVVCLKONTSC;
- SiS_Pr->SiS_CHTVVCLKUPAL = SiS300_CHTVVCLKUPAL;
- SiS_Pr->SiS_CHTVVCLKOPAL = SiS300_CHTVVCLKOPAL;
- /* TW: LCDResInfo will on 300 series be translated to 310/325 series definitions */
- SiS_Pr->SiS_Panel320x480 = Panel_320x480;
- SiS_Pr->SiS_Panel640x480 = Panel_640x480;
- SiS_Pr->SiS_Panel800x600 = Panel_800x600;
- SiS_Pr->SiS_Panel1024x768 = Panel_1024x768;
- SiS_Pr->SiS_Panel1280x1024 = Panel_1280x1024;
- SiS_Pr->SiS_Panel1280x960 = Panel_1280x960;
- SiS_Pr->SiS_Panel1024x600 = Panel_1024x600;
- SiS_Pr->SiS_Panel1152x768 = Panel_1152x768;
- SiS_Pr->SiS_Panel1600x1200 = 16; /* TW: Something illegal */
- SiS_Pr->SiS_Panel1400x1050 = 16; /* TW: Something illegal */
- SiS_Pr->SiS_Panel1152x864 = 16; /* TW: Something illegal */
- SiS_Pr->SiS_Panel1280x768 = 16; /* TW: Something illegal */
- SiS_Pr->SiS_PanelMax = Panel_320x480; /* TW: highest value */
- SiS_Pr->SiS_PanelMinLVDS = Panel_800x600; /* TW: Lowest value LVDS */
- SiS_Pr->SiS_PanelMin301 = Panel_1024x768; /* TW: lowest value 301 */
- }
- #endif
- #ifdef SIS315H
- void
- InitTo310Pointer(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
- {
- SiS_Pr->SiS_SModeIDTable = (SiS_StStruct *)SiS310_SModeIDTable;
- SiS_Pr->SiS_StandTable = (SiS_StandTableStruct *)SiS310_StandTable;
- SiS_Pr->SiS_EModeIDTable = (SiS_ExtStruct *)SiS310_EModeIDTable;
- SiS_Pr->SiS_RefIndex = (SiS_Ext2Struct *)SiS310_RefIndex;
- SiS_Pr->SiS_CRT1Table = (SiS_CRT1TableStruct *)SiS310_CRT1Table;
- /* TW: MCLK is different */
- if(HwDeviceExtension->jChipType > SIS_315PRO) {
- SiS_Pr->SiS_MCLKData_0 = (SiS_MCLKDataStruct *)SiS310_MCLKData_0_650; /* 550, 650 */
- } else {
- SiS_Pr->SiS_MCLKData_0 = (SiS_MCLKDataStruct *)SiS310_MCLKData_0_315; /* 315 */
- }
- SiS_Pr->SiS_MCLKData_1 = (SiS_MCLKDataStruct *)SiS310_MCLKData_1;
- SiS_Pr->SiS_ECLKData = (SiS_ECLKDataStruct *)SiS310_ECLKData;
- SiS_Pr->SiS_VCLKData = (SiS_VCLKDataStruct *)SiS310_VCLKData;
- SiS_Pr->SiS_VBVCLKData = (SiS_VBVCLKDataStruct *)SiS310_VBVCLKData;
- SiS_Pr->SiS_ScreenOffset = SiS310_ScreenOffset;
- SiS_Pr->SiS_StResInfo = (SiS_StResInfoStruct *)SiS310_StResInfo;
- SiS_Pr->SiS_ModeResInfo = (SiS_ModeResInfoStruct *)SiS310_ModeResInfo;
- SiS_Pr->pSiS_OutputSelect = &SiS310_OutputSelect;
- SiS_Pr->pSiS_SoftSetting = &SiS310_SoftSetting;
- SiS_Pr->SiS_SR15 = SiS310_SR15;
- #ifndef LINUX_XF86
- SiS_Pr->pSiS_SR07 = &SiS310_SR07;
- SiS_Pr->SiS_CR40 = SiS310_CR40;
- SiS_Pr->SiS_CR49 = SiS310_CR49;
- SiS_Pr->pSiS_SR1F = &SiS310_SR1F;
- SiS_Pr->pSiS_SR21 = &SiS310_SR21;
- SiS_Pr->pSiS_SR22 = &SiS310_SR22;
- SiS_Pr->pSiS_SR23 = &SiS310_SR23;
- SiS_Pr->pSiS_SR24 = &SiS310_SR24;
- SiS_Pr->SiS_SR25 = SiS310_SR25;
- SiS_Pr->pSiS_SR31 = &SiS310_SR31;
- SiS_Pr->pSiS_SR32 = &SiS310_SR32;
- SiS_Pr->pSiS_SR33 = &SiS310_SR33;
- SiS_Pr->pSiS_CRT2Data_1_2 = &SiS310_CRT2Data_1_2;
- SiS_Pr->pSiS_CRT2Data_4_D = &SiS310_CRT2Data_4_D;
- SiS_Pr->pSiS_CRT2Data_4_E = &SiS310_CRT2Data_4_E;
- SiS_Pr->pSiS_CRT2Data_4_10 = &SiS310_CRT2Data_4_10;
- SiS_Pr->pSiS_RGBSenseData = &SiS310_RGBSenseData;
- SiS_Pr->pSiS_VideoSenseData = &SiS310_VideoSenseData;
- SiS_Pr->pSiS_YCSenseData = &SiS310_YCSenseData;
- SiS_Pr->pSiS_RGBSenseData2 = &SiS310_RGBSenseData2;
- SiS_Pr->pSiS_VideoSenseData2 = &SiS310_VideoSenseData2;
- SiS_Pr->pSiS_YCSenseData2 = &SiS310_YCSenseData2;
- #endif
- SiS_Pr->SiS_NTSCPhase = SiS310_NTSCPhase;
- SiS_Pr->SiS_PALPhase = SiS310_PALPhase;
- SiS_Pr->SiS_NTSCPhase2 = SiS310_NTSCPhase2;
- SiS_Pr->SiS_PALPhase2 = SiS310_PALPhase2;
- SiS_Pr->SiS_PALMPhase = SiS310_PALMPhase;
- SiS_Pr->SiS_PALNPhase = SiS310_PALNPhase;
- SiS_Pr->SiS_PALMPhase2 = SiS310_PALMPhase2;
- SiS_Pr->SiS_PALNPhase2 = SiS310_PALNPhase2;
- SiS_Pr->SiS_SpecialPhase = SiS310_SpecialPhase;
- SiS_Pr->SiS_StLCD1024x768Data = (SiS_LCDDataStruct *)SiS310_StLCD1024x768Data;
- SiS_Pr->SiS_ExtLCD1024x768Data = (SiS_LCDDataStruct *)SiS310_ExtLCD1024x768Data;
- SiS_Pr->SiS_St2LCD1024x768Data = (SiS_LCDDataStruct *)SiS310_St2LCD1024x768Data;
- SiS_Pr->SiS_StLCD1280x1024Data = (SiS_LCDDataStruct *)SiS310_StLCD1280x1024Data;
- SiS_Pr->SiS_ExtLCD1280x1024Data = (SiS_LCDDataStruct *)SiS310_ExtLCD1280x1024Data;
- SiS_Pr->SiS_St2LCD1280x1024Data = (SiS_LCDDataStruct *)SiS310_St2LCD1280x1024Data;
- SiS_Pr->SiS_NoScaleData1024x768 = (SiS_LCDDataStruct *)SiS310_NoScaleData1024x768;
- SiS_Pr->SiS_NoScaleData1280x1024 = (SiS_LCDDataStruct *)SiS310_NoScaleData1280x1024;
- SiS_Pr->SiS_LCD1280x960Data = (SiS_LCDDataStruct *)SiS310_LCD1280x960Data;
- SiS_Pr->SiS_ExtLCD1400x1050Data = (SiS_LCDDataStruct *)SiS310_ExtLCD1400x1050Data;
- SiS_Pr->SiS_ExtLCD1600x1200Data = (SiS_LCDDataStruct *)SiS310_ExtLCD1600x1200Data;
- SiS_Pr->SiS_StLCD1400x1050Data = (SiS_LCDDataStruct *)SiS310_StLCD1400x1050Data;
- SiS_Pr->SiS_StLCD1600x1200Data = (SiS_LCDDataStruct *)SiS310_StLCD1600x1200Data;
- SiS_Pr->SiS_NoScaleData1400x1050 = (SiS_LCDDataStruct *)SiS310_NoScaleData1400x1050;
- SiS_Pr->SiS_NoScaleData1600x1200 = (SiS_LCDDataStruct *)SiS310_NoScaleData1600x1200;
- SiS_Pr->SiS_StPALData = (SiS_TVDataStruct *)SiS310_StPALData;
- SiS_Pr->SiS_ExtPALData = (SiS_TVDataStruct *)SiS310_ExtPALData;
- SiS_Pr->SiS_StNTSCData = (SiS_TVDataStruct *)SiS310_StNTSCData;
- SiS_Pr->SiS_ExtNTSCData = (SiS_TVDataStruct *)SiS310_ExtNTSCData;
- #ifdef oldHV
- SiS_Pr->SiS_St1HiTVData = (SiS_TVDataStruct *)SiS310_St1HiTVData;
- SiS_Pr->SiS_St2HiTVData = (SiS_TVDataStruct *)SiS310_St2HiTVData;
- SiS_Pr->SiS_ExtHiTVData = (SiS_TVDataStruct *)SiS310_ExtHiTVData;
- #endif
- SiS_Pr->SiS_NTSCTiming = SiS310_NTSCTiming;
- SiS_Pr->SiS_PALTiming = SiS310_PALTiming;
- #ifdef oldHV
- SiS_Pr->SiS_HiTVSt1Timing = SiS310_HiTVSt1Timing;
- SiS_Pr->SiS_HiTVSt2Timing = SiS310_HiTVSt2Timing;
- SiS_Pr->SiS_HiTVTextTiming = SiS310_HiTVTextTiming;
- SiS_Pr->SiS_HiTVExtTiming = SiS310_HiTVExtTiming;
- SiS_Pr->SiS_HiTVGroup3Data = SiS310_HiTVGroup3Data;
- SiS_Pr->SiS_HiTVGroup3Simu = SiS310_HiTVGroup3Simu;
- SiS_Pr->SiS_HiTVGroup3Text = SiS310_HiTVGroup3Text;
- #endif
- SiS_Pr->SiS_PanelDelayTbl = (SiS_PanelDelayTblStruct *)SiS310_PanelDelayTbl;
- SiS_Pr->SiS_PanelDelayTblLVDS = (SiS_PanelDelayTblStruct *)SiS310_PanelDelayTblLVDS;
- SiS_Pr->SiS_LVDS800x600Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS800x600Data_1;
- SiS_Pr->SiS_LVDS800x600Data_2 = (SiS_LVDSDataStruct *)SiS310_LVDS800x600Data_2;
- SiS_Pr->SiS_LVDS1024x768Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS1024x768Data_1;
- SiS_Pr->SiS_LVDS1024x768Data_2 = (SiS_LVDSDataStruct *)SiS310_LVDS1024x768Data_2;
- SiS_Pr->SiS_LVDS1280x1024Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS1280x1024Data_1;
- SiS_Pr->SiS_LVDS1280x1024Data_2 = (SiS_LVDSDataStruct *)SiS310_LVDS1280x1024Data_2;
- SiS_Pr->SiS_LVDS1280x960Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS1280x960Data_1;
- SiS_Pr->SiS_LVDS1280x960Data_2 = (SiS_LVDSDataStruct *)SiS310_LVDS1280x960Data_2;
- SiS_Pr->SiS_LVDS1400x1050Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS1400x1050Data_1;
- SiS_Pr->SiS_LVDS1400x1050Data_2 = (SiS_LVDSDataStruct *)SiS310_LVDS1400x1050Data_2;
- SiS_Pr->SiS_LVDS1024x600Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS1024x600Data_1;
- SiS_Pr->SiS_LVDS1024x600Data_2 = (SiS_LVDSDataStruct *)SiS310_LVDS1024x600Data_2;
- SiS_Pr->SiS_LVDS1152x768Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS1152x768Data_1;
- SiS_Pr->SiS_LVDS1152x768Data_2 = (SiS_LVDSDataStruct *)SiS310_LVDS1152x768Data_2;
- SiS_Pr->SiS_LVDSXXXxXXXData_1 = (SiS_LVDSDataStruct *)SiS310_LVDSXXXxXXXData_1;
- SiS_Pr->SiS_LVDS320x480Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS320x480Data_1;
- SiS_Pr->SiS_LVDS640x480Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS640x480Data_1;
- SiS_Pr->SiS_LCDA1400x1050Data_1 = (SiS_LVDSDataStruct *)SiS310_LCDA1400x1050Data_1;
- SiS_Pr->SiS_LCDA1400x1050Data_2 = (SiS_LVDSDataStruct *)SiS310_LCDA1400x1050Data_2;
- SiS_Pr->SiS_LCDA1600x1200Data_1 = (SiS_LVDSDataStruct *)SiS310_LCDA1600x1200Data_1;
- SiS_Pr->SiS_LCDA1600x1200Data_2 = (SiS_LVDSDataStruct *)SiS310_LCDA1600x1200Data_2;
- SiS_Pr->SiS_CHTVUNTSCData = (SiS_LVDSDataStruct *)SiS310_CHTVUNTSCData;
- SiS_Pr->SiS_CHTVONTSCData = (SiS_LVDSDataStruct *)SiS310_CHTVONTSCData;
- SiS_Pr->SiS_CHTVUPALData = (SiS_LVDSDataStruct *)SiS310_CHTVUPALData;
- SiS_Pr->SiS_CHTVOPALData = (SiS_LVDSDataStruct *)SiS310_CHTVOPALData;
- SiS_Pr->SiS_PanelType00_1 = (SiS_LVDSDesStruct *)SiS310_PanelType00_1;
- SiS_Pr->SiS_PanelType01_1 = (SiS_LVDSDesStruct *)SiS310_PanelType01_1;
- SiS_Pr->SiS_PanelType02_1 = (SiS_LVDSDesStruct *)SiS310_PanelType02_1;
- SiS_Pr->SiS_PanelType03_1 = (SiS_LVDSDesStruct *)SiS310_PanelType03_1;
- SiS_Pr->SiS_PanelType04_1 = (SiS_LVDSDesStruct *)SiS310_PanelType04_1;
- SiS_Pr->SiS_PanelType05_1 = (SiS_LVDSDesStruct *)SiS310_PanelType05_1;
- SiS_Pr->SiS_PanelType06_1 = (SiS_LVDSDesStruct *)SiS310_PanelType06_1;
- SiS_Pr->SiS_PanelType07_1 = (SiS_LVDSDesStruct *)SiS310_PanelType07_1;
- SiS_Pr->SiS_PanelType08_1 = (SiS_LVDSDesStruct *)SiS310_PanelType08_1;
- SiS_Pr->SiS_PanelType09_1 = (SiS_LVDSDesStruct *)SiS310_PanelType09_1;
- SiS_Pr->SiS_PanelType0a_1 = (SiS_LVDSDesStruct *)SiS310_PanelType0a_1;
- SiS_Pr->SiS_PanelType0b_1 = (SiS_LVDSDesStruct *)SiS310_PanelType0b_1;
- SiS_Pr->SiS_PanelType0c_1 = (SiS_LVDSDesStruct *)SiS310_PanelType0c_1;
- SiS_Pr->SiS_PanelType0d_1 = (SiS_LVDSDesStruct *)SiS310_PanelType0d_1;
- SiS_Pr->SiS_PanelType0e_1 = (SiS_LVDSDesStruct *)SiS310_PanelType0e_1;
- SiS_Pr->SiS_PanelType0f_1 = (SiS_LVDSDesStruct *)SiS310_PanelType0f_1;
- SiS_Pr->SiS_PanelType00_2 = (SiS_LVDSDesStruct *)SiS310_PanelType00_2;
- SiS_Pr->SiS_PanelType01_2 = (SiS_LVDSDesStruct *)SiS310_PanelType01_2;
- SiS_Pr->SiS_PanelType02_2 = (SiS_LVDSDesStruct *)SiS310_PanelType02_2;
- SiS_Pr->SiS_PanelType03_2 = (SiS_LVDSDesStruct *)SiS310_PanelType03_2;
- SiS_Pr->SiS_PanelType04_2 = (SiS_LVDSDesStruct *)SiS310_PanelType04_2;
- SiS_Pr->SiS_PanelType05_2 = (SiS_LVDSDesStruct *)SiS310_PanelType05_2;
- SiS_Pr->SiS_PanelType06_2 = (SiS_LVDSDesStruct *)SiS310_PanelType06_2;
- SiS_Pr->SiS_PanelType07_2 = (SiS_LVDSDesStruct *)SiS310_PanelType07_2;
- SiS_Pr->SiS_PanelType08_2 = (SiS_LVDSDesStruct *)SiS310_PanelType08_2;
- SiS_Pr->SiS_PanelType09_2 = (SiS_LVDSDesStruct *)SiS310_PanelType09_2;
- SiS_Pr->SiS_PanelType0a_2 = (SiS_LVDSDesStruct *)SiS310_PanelType0a_2;
- SiS_Pr->SiS_PanelType0b_2 = (SiS_LVDSDesStruct *)SiS310_PanelType0b_2;
- SiS_Pr->SiS_PanelType0c_2 = (SiS_LVDSDesStruct *)SiS310_PanelType0c_2;
- SiS_Pr->SiS_PanelType0d_2 = (SiS_LVDSDesStruct *)SiS310_PanelType0d_2;
- SiS_Pr->SiS_PanelType0e_2 = (SiS_LVDSDesStruct *)SiS310_PanelType0e_2;
- SiS_Pr->SiS_PanelType0f_2 = (SiS_LVDSDesStruct *)SiS310_PanelType0f_2;
- SiS_Pr->LVDS1024x768Des_1 = (SiS_LVDSDesStruct *)SiS310_PanelType1076_1;
- SiS_Pr->LVDS1280x1024Des_1 = (SiS_LVDSDesStruct *)SiS310_PanelType1210_1;
- SiS_Pr->LVDS1400x1050Des_1 = (SiS_LVDSDesStruct *)SiS310_PanelType1296_1 ;
- SiS_Pr->LVDS1600x1200Des_1 = (SiS_LVDSDesStruct *)SiS310_PanelType1600_1 ;
- SiS_Pr->LVDS1024x768Des_2 = (SiS_LVDSDesStruct *)SiS310_PanelType1076_2;
- SiS_Pr->LVDS1280x1024Des_2 = (SiS_LVDSDesStruct *)SiS310_PanelType1210_2;
- SiS_Pr->LVDS1400x1050Des_2 = (SiS_LVDSDesStruct *)SiS310_PanelType1296_2;
- SiS_Pr->LVDS1600x1200Des_2 = (SiS_LVDSDesStruct *)SiS310_PanelType1600_2 ;
- /* TW: New from 650/301LV BIOS */
- SiS_Pr->SiS_CRT2Part2_1024x768_1 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1024x768_1;
- SiS_Pr->SiS_CRT2Part2_1280x1024_1 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1280x1024_1;
- SiS_Pr->SiS_CRT2Part2_1400x1050_1 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1400x1050_1;
- SiS_Pr->SiS_CRT2Part2_1600x1200_1 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1600x1200_1;
- SiS_Pr->SiS_CRT2Part2_1024x768_2 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1024x768_2;
- SiS_Pr->SiS_CRT2Part2_1280x1024_2 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1280x1024_2;
- SiS_Pr->SiS_CRT2Part2_1400x1050_2 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1400x1050_2;
- SiS_Pr->SiS_CRT2Part2_1600x1200_2 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1600x1200_2;
- SiS_Pr->SiS_CRT2Part2_1024x768_3 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1024x768_3;
- SiS_Pr->SiS_CRT2Part2_1280x1024_3 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1280x1024_3;
- SiS_Pr->SiS_CRT2Part2_1400x1050_3 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1400x1050_3;
- SiS_Pr->SiS_CRT2Part2_1600x1200_3 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1600x1200_3;
- SiS_Pr->SiS_CHTVUNTSCDesData = (SiS_LVDSDesStruct *)SiS310_CHTVUNTSCDesData;
- SiS_Pr->SiS_CHTVONTSCDesData = (SiS_LVDSDesStruct *)SiS310_CHTVONTSCDesData;
- SiS_Pr->SiS_CHTVUPALDesData = (SiS_LVDSDesStruct *)SiS310_CHTVUPALDesData;
- SiS_Pr->SiS_CHTVOPALDesData = (SiS_LVDSDesStruct *)SiS310_CHTVOPALDesData;
- SiS_Pr->SiS_LVDSCRT1800x600_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT1800x600_1;
- SiS_Pr->SiS_LVDSCRT11024x768_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11024x768_1;
- SiS_Pr->SiS_LVDSCRT11280x1024_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11280x1024_1;
- SiS_Pr->SiS_LVDSCRT11400x1050_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11400x1050_1;
- SiS_Pr->SiS_LVDSCRT11024x600_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11024x600_1;
- SiS_Pr->SiS_LVDSCRT11152x768_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11152x768_1;
- SiS_Pr->SiS_LVDSCRT11600x1200_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11600x1200_1;
- SiS_Pr->SiS_LVDSCRT1800x600_1_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT1800x600_1_H;
- SiS_Pr->SiS_LVDSCRT11024x768_1_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11024x768_1_H;
- SiS_Pr->SiS_LVDSCRT11280x1024_1_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11280x1024_1_H;
- SiS_Pr->SiS_LVDSCRT11400x1050_1_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11400x1050_1_H;
- SiS_Pr->SiS_LVDSCRT11024x600_1_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11024x600_1_H;
- SiS_Pr->SiS_LVDSCRT11152x768_1_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11152x768_1_H;
- SiS_Pr->SiS_LVDSCRT11600x1200_1_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11600x1200_1_H;
- SiS_Pr->SiS_LVDSCRT1800x600_2 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT1800x600_2;
- SiS_Pr->SiS_LVDSCRT11024x768_2 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11024x768_2;
- SiS_Pr->SiS_LVDSCRT11280x1024_2 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11280x1024_2;
- SiS_Pr->SiS_LVDSCRT11400x1050_2 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11400x1050_2;
- SiS_Pr->SiS_LVDSCRT11024x600_2 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11024x600_2;
- SiS_Pr->SiS_LVDSCRT11152x768_2 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11152x768_2;
- SiS_Pr->SiS_LVDSCRT11600x1200_2 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11600x1200_2;
- SiS_Pr->SiS_LVDSCRT1800x600_2_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT1800x600_2_H;
- SiS_Pr->SiS_LVDSCRT11024x768_2_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11024x768_2_H;
- SiS_Pr->SiS_LVDSCRT11280x1024_2_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11280x1024_2_H;
- SiS_Pr->SiS_LVDSCRT11400x1050_2_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11400x1050_2_H;
- SiS_Pr->SiS_LVDSCRT11024x600_2_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11024x600_2_H;
- SiS_Pr->SiS_LVDSCRT11152x768_2_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11152x768_2_H;
- SiS_Pr->SiS_LVDSCRT11600x1200_2_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11600x1200_2_H;
- SiS_Pr->SiS_LVDSCRT1XXXxXXX_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT1XXXxXXX_1;
- SiS_Pr->SiS_LVDSCRT1320x480_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT1320x480_1;
- SiS_Pr->SiS_CHTVCRT1UNTSC = (SiS_LVDSCRT1DataStruct *)SiS310_CHTVCRT1UNTSC;
- SiS_Pr->SiS_CHTVCRT1ONTSC = (SiS_LVDSCRT1DataStruct *)SiS310_CHTVCRT1ONTSC;
- SiS_Pr->SiS_CHTVCRT1UPAL = (SiS_LVDSCRT1DataStruct *)SiS310_CHTVCRT1UPAL;
- SiS_Pr->SiS_CHTVCRT1OPAL = (SiS_LVDSCRT1DataStruct *)SiS310_CHTVCRT1OPAL;
- SiS_Pr->SiS_CHTVReg_UNTSC = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_UNTSC;
- SiS_Pr->SiS_CHTVReg_ONTSC = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_ONTSC;
- SiS_Pr->SiS_CHTVReg_UPAL = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_UPAL;
- SiS_Pr->SiS_CHTVReg_OPAL = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_OPAL;
- SiS_Pr->SiS_LCDACRT1800x600_1 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT1800x600_1;
- SiS_Pr->SiS_LCDACRT11024x768_1 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11024x768_1;
- SiS_Pr->SiS_LCDACRT11280x1024_1 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11280x1024_1;
- SiS_Pr->SiS_LCDACRT11400x1050_1 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11400x1050_1;
- SiS_Pr->SiS_LCDACRT11600x1200_1 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11600x1200_1;
- SiS_Pr->SiS_LCDACRT1800x600_1_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT1800x600_1_H;
- SiS_Pr->SiS_LCDACRT11024x768_1_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11024x768_1_H;
- SiS_Pr->SiS_LCDACRT11280x1024_1_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11280x1024_1_H;
- SiS_Pr->SiS_LCDACRT11400x1050_1_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11400x1050_1_H;
- SiS_Pr->SiS_LCDACRT11600x1200_1_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11600x1200_1_H;
- SiS_Pr->SiS_LCDACRT1800x600_2 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT1800x600_2;
- SiS_Pr->SiS_LCDACRT11024x768_2 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11024x768_2;
- SiS_Pr->SiS_LCDACRT11280x1024_2 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11280x1024_2;
- SiS_Pr->SiS_LCDACRT11400x1050_2 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11400x1050_2;
- SiS_Pr->SiS_LCDACRT11600x1200_2 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11600x1200_2;
- SiS_Pr->SiS_LCDACRT1800x600_2_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT1800x600_2_H;
- SiS_Pr->SiS_LCDACRT11024x768_2_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11024x768_2_H;
- SiS_Pr->SiS_LCDACRT11280x1024_2_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11280x1024_2_H;
- SiS_Pr->SiS_LCDACRT11400x1050_2_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11400x1050_2_H;
- SiS_Pr->SiS_LCDACRT11600x1200_2_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11600x1200_2_H;
- SiS_Pr->SiS_CHTVVCLKUNTSC = SiS310_CHTVVCLKUNTSC;
- SiS_Pr->SiS_CHTVVCLKONTSC = SiS310_CHTVVCLKONTSC;
- SiS_Pr->SiS_CHTVVCLKUPAL = SiS310_CHTVVCLKUPAL;
- SiS_Pr->SiS_CHTVVCLKOPAL = SiS310_CHTVVCLKOPAL;
- SiS_Pr->SiS_Panel320x480 = Panel_320x480;
- SiS_Pr->SiS_Panel640x480 = Panel_640x480;
- SiS_Pr->SiS_Panel800x600 = Panel_800x600;
- SiS_Pr->SiS_Panel1024x768 = Panel_1024x768;
- SiS_Pr->SiS_Panel1280x1024 = Panel_1280x1024;
- SiS_Pr->SiS_Panel1280x960 = Panel_1280x960;
- SiS_Pr->SiS_Panel1600x1200 = Panel_1600x1200;
- SiS_Pr->SiS_Panel1400x1050 = Panel_1400x1050;
- SiS_Pr->SiS_Panel1152x768 = Panel_1152x768;
- SiS_Pr->SiS_Panel1152x864 = Panel_1152x864;
- SiS_Pr->SiS_Panel1280x768 = Panel_1280x768;
- SiS_Pr->SiS_Panel1024x600 = Panel_1024x600;
- SiS_Pr->SiS_PanelMax = Panel_320x480; /* TW: highest value */
- SiS_Pr->SiS_PanelMinLVDS = Panel_800x600; /* TW: lowest value LVDS/LCDA */
- SiS_Pr->SiS_PanelMin301 = Panel_1024x768; /* TW: lowest value 301 */
- }
- #endif
- #ifdef LINUXBIOS
- /* -------------- SiSInit -----------------*/
- /* TW: I degraded this for LINUXBIOS only, because we
- * don't need this otherwise
- */
- BOOLEAN
- SiSInit(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
- {
- UCHAR *ROMAddr = HwDeviceExtension->pjVirtualRomBase;
- ULONG FBAddr = (ULONG)HwDeviceExtension->pjVideoMemoryAddress;
- USHORT BaseAddr = (USHORT)HwDeviceExtension->ulIOAddress;
- UCHAR i, temp=0;
- UCHAR SR11;
- #ifdef LINUX_KERNEL
- UCHAR temp1;
- ULONG base;
- #endif
- UCHAR SR13=0, SR14=0, SR16=0
- UCHAR SR17=0, SR19=0, SR1A=0;
- #ifdef SIS300
- UCHAR SR18=0, SR12=0;
- #endif
- #ifdef SIS315H
- UCHAR CR37=0, CR38=0, CR79=0,
- UCHAR CR7A=0, CR7B=0, CR7C=0;
- UCHAR SR1B=0, SR15=0;
- PSIS_DSReg pSR;
- ULONG Temp;
- #endif
- UCHAR VBIOSVersion[5];
- if(FBAddr==0) return (FALSE);
- if(BaseAddr==0) return (FALSE);
- SiS_SetReg3((USHORT)(BaseAddr+0x12), 0x67); /* Misc */
- #ifdef SIS315H
- if(HwDeviceExtension->jChipType > SIS_315PRO) {
- if(!HwDeviceExtension->bIntegratedMMEnabled)
- return (FALSE);
- }
- #endif
- SiS_MemoryCopy(VBIOSVersion,HwDeviceExtension->szVBIOSVer,4);
- VBIOSVersion[4]= 0x00;
- SiSDetermineROMUsage(SiS_Pr, HwDeviceExtension, ROMAddr);
- /* TW: Init pointers */
- #ifdef SIS315H
- if((HwDeviceExtension->jChipType == SIS_315H) ||
- (HwDeviceExtension->jChipType == SIS_315PRO) ||
- (HwDeviceExtension->jChipType == SIS_550) ||
- (HwDeviceExtension->jChipType == SIS_640) ||
- (HwDeviceExtension->jChipType == SIS_740) ||
- (HwDeviceExtension->jChipType == SIS_650))
- InitTo310Pointer(SiS_Pr, HwDeviceExtension);
- #endif
- #ifdef SIS300
- if((HwDeviceExtension->jChipType == SIS_540) ||
- (HwDeviceExtension->jChipType == SIS_630) ||
- (HwDeviceExtension->jChipType == SIS_730) ||
- (HwDeviceExtension->jChipType == SIS_300))
- InitTo300Pointer(SiS_Pr, HwDeviceExtension);
- #endif
- /* TW: Set SiS Register definitions */
- SiSRegInit(SiS_Pr, BaseAddr);
- /* TW: Determine LVDS/CH70xx/TRUMPION */
- SiS_Set_LVDS_TRUMPION(SiS_Pr, HwDeviceExtension);
- /* TW: Unlock registers */
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x05,0x86);
- #ifdef LINUX_KERNEL
- #ifdef SIS300 /* Set SR14 */
- if((HwDeviceExtension->jChipType==SIS_540) ||
- (HwDeviceExtension->jChipType==SIS_630) ||
- (HwDeviceExtension->jChipType==SIS_730)) {
- base=0x80000060;
- OutPortLong(base,0xcf8);
- temp1 = InPortLong(0xcfc);
- temp1 >>= (16+8+4);
- temp1 &= 0x07;
- temp1++;
- temp1 = 1 << temp1;
- SR14 = temp1 - 1;
- base = 0x80000064;
- OutPortLong(base,0xcf8);
- temp1 = InPortLong(0xcfc);
- temp1 &= 0x00000020;
- if(temp1) SR14 |= 0x80;
- else SR14 |= 0x40;
- }
- #endif
- #ifdef SIS315H /* Set SR14 */
- if(HwDeviceExtension->jChipType==SIS_550) {
- base = 0x80000060;
- OutPortLong(base,0xcf8);
- temp1 = InPortLong(0xcfc);
- temp1 >>= (16+8+4);
- temp1 &= 0x07;
- temp1++;
- temp1 = 1 << temp1;
- SR14 = temp1 - 1;
- base = 0x80000064;
- OutPortLong(base,0xcf8);
- temp1 = InPortLong(0xcfc);
- temp1 &= 0x00000020;
- if(temp1) SR14 |= 0x80;
- else SR14 |= 0x40;
- }
- if((HwDeviceExtension->jChipType == SIS_640) || /* Set SR14 */
- (HwDeviceExtension->jChipType == SIS_740) ||
- (HwDeviceExtension->jChipType == SIS_650)) {
- base = 0x80000064;
- OutPortLong(base,0xcf8);
- temp1=InPortLong(0xcfc);
- temp1 >>= 4;
- temp1 &= 0x07;
- if(temp1 > 2) {
- temp = temp1;
- switch(temp) {
- case 3: temp1 = 0x07; break;
- case 4: temp1 = 0x0F; break;
- case 5: temp1 = 0x1F; break;
- case 6: temp1 = 0x05; break;
- case 7: temp1 = 0x17; break;
- case 8: break;
- case 9: break;
- }
- }
- SR14 = temp1;
- base = 0x8000007C;
- OutPortLong(base,0xcf8);
- temp1 = InPortLong(0xcfc);
- temp1 &= 0x00000020;
- if(temp1) SR14 |= 0x80;
- }
- #endif
- #endif /* Linux kernel */
- #ifdef SIS300
- if((HwDeviceExtension->jChipType == SIS_540)||
- (HwDeviceExtension->jChipType == SIS_630)||
- (HwDeviceExtension->jChipType == SIS_730)) {
- SR12 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x12);
- SR13 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13);
- SR14 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14);
- SR16 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16);
- SR17 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x17);
- SR18 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x18);
- SR19 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x19);
- SR1A = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1A);
- } else if(HwDeviceExtension->jChipType == SIS_300){
- SR13 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13);
- SR14 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14);
- }
- #endif
- #ifdef SIS315H
- if((HwDeviceExtension->jChipType == SIS_550) ||
- (HwDeviceExtension->jChipType == SIS_640) ||
- (HwDeviceExtension->jChipType == SIS_740) ||
- (HwDeviceExtension->jChipType == SIS_650)) {
- SR19 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x19);
- SR19 = (SR19)||0x01; /* TW: ??? || ??? */
- if(SR19==0x00) {
- SR13 = 0x22;
- SR14 = 0x00;
- SR15 = 0x01;
- SR16 = 0x00;
- SR17 = 0x00;
- SR1A = 0x00;
- SR1B = 0x00;
- CR37 = 0x00;
- CR38 = 0x00;
- CR79 = 0x00;
- CR7A = 0x00;
- CR7B = 0x00;
- CR7C = 0x00;
- } else {
- SR13 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13);
- SR14 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14);
- SR15 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x15);
- SR16 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16);
- SR17 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x17);
- SR1A = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1A);
- SR1B = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1B);
- CR37 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3d4,0x37); /* TW: Was 0x02 - why? */
- CR38 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38);
- CR79 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3d4,0x79);
- CR7A = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3d4,0x7A);
- CR7B = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3d4,0x7B);
- CR7C = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3d4,0x7C);
- }
- }
- #endif
- /* Reset extended registers */
- for(i=0x06; i< 0x20; i++) SiS_SetReg1(SiS_Pr->SiS_P3c4,i,0);
- for(i=0x21; i<=0x27; i++) SiS_SetReg1(SiS_Pr->SiS_P3c4,i,0);
- for(i=0x31; i<=0x3D; i++) SiS_SetReg1(SiS_Pr->SiS_P3c4,i,0);
- #ifdef SIS300
- if((HwDeviceExtension->jChipType == SIS_540) ||
- (HwDeviceExtension->jChipType == SIS_630) ||
- (HwDeviceExtension->jChipType == SIS_730) ||
- (HwDeviceExtension->jChipType == SIS_300)) {
- for(i=0x38; i<=0x3F; i++) SiS_SetReg1(SiS_Pr->SiS_P3d4,i,0);
- }
- #endif
- #ifdef SIS315H
- if((HwDeviceExtension->jChipType == SIS_315H) ||
- (HwDeviceExtension->jChipType == SIS_315PRO) ||
- (HwDeviceExtension->jChipType == SIS_550) ||
- (HwDeviceExtension->jChipType == SIS_640) ||
- (HwDeviceExtension->jChipType == SIS_740) ||
- (HwDeviceExtension->jChipType == SIS_650)) {
- for(i=0x12; i<=0x1B; i++) SiS_SetReg1(SiS_Pr->SiS_P3c4,i,0);
- for(i=0x79; i<=0x7C; i++) SiS_SetReg1(SiS_Pr->SiS_P3d4,i,0);
- }
- #endif
- /* Restore Extended Registers */
- #ifdef SIS300
- if((HwDeviceExtension->jChipType == SIS_540) ||
- (HwDeviceExtension->jChipType == SIS_630) ||
- (HwDeviceExtension->jChipType == SIS_730)) {
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x12,SR12);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,SR13);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,SR14);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,SR16);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x17,SR17);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x18,SR18);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x19,SR19);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1A,SR1A);
- }
- #endif
- #ifdef SIS315H
- if((HwDeviceExtension->jChipType == SIS_550) ||
- (HwDeviceExtension->jChipType == SIS_640) ||
- (HwDeviceExtension->jChipType == SIS_740) ||
- (HwDeviceExtension->jChipType == SIS_650)) {
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,SR13);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,SR14);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x15,SR15);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,SR16);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x17,SR17);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x19,SR19);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1A,SR1A);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1B,SR1B);
- SiS_SetReg1(SiS_Pr->SiS_P3d4,0x37,CR37);
- SiS_SetReg1(SiS_Pr->SiS_P3d4,0x38,CR38);
- SiS_SetReg1(SiS_Pr->SiS_P3d4,0x79,CR79);
- SiS_SetReg1(SiS_Pr->SiS_P3d4,0x7A,CR7A);
- SiS_SetReg1(SiS_Pr->SiS_P3d4,0x7B,CR7B);
- SiS_SetReg1(SiS_Pr->SiS_P3d4,0x7C,CR7C);
- }
- #endif
- #ifdef SIS300
- if((HwDeviceExtension->jChipType==SIS_540) ||
- (HwDeviceExtension->jChipType==SIS_630) ||
- (HwDeviceExtension->jChipType==SIS_730)) {
- temp = (UCHAR)SR1A & 0x03;
- } else if(HwDeviceExtension->jChipType==SIS_300) {
- /* TW: Nothing */
- }
- #endif
- #ifdef SIS315H
- if((HwDeviceExtension->jChipType == SIS_315H )||
- (HwDeviceExtension->jChipType == SIS_315PRO)) {
- if((*SiS_Pr->pSiS_SoftSetting & SoftDRAMType) == 0){
- temp = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x3A) & 0x03;
- }
- }
- if((HwDeviceExtension->jChipType == SIS_550) ||
- (HwDeviceExtension->jChipType == SIS_640) ||
- (HwDeviceExtension->jChipType == SIS_740) ||
- (HwDeviceExtension->jChipType == SIS_650)) {
- if((*SiS_Pr->pSiS_SoftSetting & SoftDRAMType) == 0){
- temp = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13) & 0x07;
- }
- }
- #endif
- SiS_Pr->SiS_RAMType = temp;
- SiS_SetMemoryClock(SiS_Pr, ROMAddr, HwDeviceExtension);
- /* Set default register contents */
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x07,*SiS_Pr->pSiS_SR07); /* DAC speed */
- if((HwDeviceExtension->jChipType != SIS_540) &&
- (HwDeviceExtension->jChipType != SIS_630) &&
- (HwDeviceExtension->jChipType != SIS_730)){
- for(i=0x15;i<0x1C;i++) {
- SiS_SetReg1(SiS_Pr->SiS_P3c4,i,SiS_Pr->SiS_SR15[i-0x15][SiS_Pr->SiS_RAMType]);
- }
- }
- #ifdef SIS315H
- if ((HwDeviceExtension->jChipType == SIS_315H ) ||
- (HwDeviceExtension->jChipType == SIS_315PRO)) {
- for(i=0x40;i<=0x44;i++) {
- SiS_SetReg1(SiS_Pr->SiS_P3d4,i,SiS_Pr->SiS_CR40[i-0x40][SiS_Pr->SiS_RAMType]);
- }
- SiS_SetReg1(SiS_Pr->SiS_P3d4,0x48,0x23);
- SiS_SetReg1(SiS_Pr->SiS_P3d4,0x49,SiS_Pr->SiS_CR49[0]);
- /* SiS_SetReg1(SiS_Pr->SiS_P3c4,0x25,SiS_Pr->SiS_SR25[0]); */
- }
- #endif
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1F,*SiS_Pr->pSiS_SR1F); /* DAC pedestal */
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x20,0xA0);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x23,*SiS_Pr->pSiS_SR23);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x24,*SiS_Pr->pSiS_SR24);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x25,SiS_Pr->SiS_SR25[0]);
- #ifdef SIS300
- if(HwDeviceExtension->jChipType == SIS_300) {
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x21,0x84);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x22,0x00);
- }
- #endif
- SR11 = 0x0F;
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x11,SR11); /* Power Management & DDC port */
- SiS_UnLockCRT2(SiS_Pr, HwDeviceExtension, BaseAddr);
- SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x00,0x00);
- SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x02,*SiS_Pr->pSiS_CRT2Data_1_2);
- #ifdef SIS315H
- if((HwDeviceExtension->jChipType == SIS_315H) ||
- (HwDeviceExtension->jChipType == SIS_315PRO) ||
- (HwDeviceExtension->jChipType == SIS_550) ||
- (HwDeviceExtension->jChipType == SIS_640) ||
- (HwDeviceExtension->jChipType == SIS_740) ||
- (HwDeviceExtension->jChipType == SIS_650))
- SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x2E,0x08); /* use VB */
- #endif
- temp = *SiS_Pr->pSiS_SR32;
- if(SiS_BridgeIsOn(SiS_Pr, BaseAddr)) {
- temp &= 0xEF;
- }
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x32,temp);
- #ifdef SIS315H
- if((HwDeviceExtension->jChipType == SIS_315H) ||
- (HwDeviceExtension->jChipType == SIS_315PRO)) {
- HwDeviceExtension->pQueryVGAConfigSpace(HwDeviceExtension,0x50,0,&Temp);
- Temp >>= 20;
- Temp &= 0xF;
- if (Temp != 1) {
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x25,SiS_Pr->SiS_SR25[1]);
- SiS_SetReg1(SiS_Pr->SiS_P3d4,0x49,SiS_Pr->SiS_CR49[1]);
- }
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x27,0x1F);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x31,*SiS_Pr->pSiS_SR31);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x32,*SiS_Pr->pSiS_SR32);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x33,*SiS_Pr->pSiS_SR33);
- }
- #endif
- if (SiS_BridgeIsOn(SiS_Pr, BaseAddr) == 0) {
- if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
- SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x00,0x1C);
- SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x0D,*SiS_Pr->pSiS_CRT2Data_4_D);
- SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x0E,*SiS_Pr->pSiS_CRT2Data_4_E);
- SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x10,*SiS_Pr->pSiS_CRT2Data_4_10);
- SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x0F,0x3F);
- }
- SiS_LockCRT2(SiS_Pr, HwDeviceExtension, BaseAddr);
- }
- SiS_SetReg1(SiS_Pr->SiS_P3d4,0x83,0x00);
- #ifdef SIS315H
- if ((HwDeviceExtension->jChipType==SIS_315H) ||
- (HwDeviceExtension->jChipType==SIS_315PRO)) {
- if (HwDeviceExtension->bSkipDramSizing==TRUE) {
- SiS_SetDRAMModeRegister(SiS_Pr, ROMAddr,HwDeviceExtension);
- pSR = HwDeviceExtension->pSR;
- if (pSR!=NULL) {
- while (pSR->jIdx!=0xFF) {
- SiS_SetReg1(SiS_Pr->SiS_P3c4,pSR->jIdx,pSR->jVal);
- pSR++;
- }
- }
- } else SiS_SetDRAMSize_310(SiS_Pr, HwDeviceExtension);
- }
- #endif
- #ifdef SIS315H
- if((HwDeviceExtension->jChipType==SIS_550)){
- /* SetDRAMConfig begin */
- /* SiS_SetReg1(SiS_Pr->SiS_P3c4,0x12,SR12);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,SR13);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,SR14);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,SR16);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x17,SR17);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x18,SR18);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x19,SR19);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1A,SR1A); */
- /* SetDRAMConfig end */
- }
- #endif
- #ifdef SIS300
- if(HwDeviceExtension->jChipType == SIS_300) {
- if (HwDeviceExtension->bSkipDramSizing == TRUE) {
- /* SiS_SetDRAMModeRegister(ROMAddr,HwDeviceExtension);
- temp = (HwDeviceExtension->pSR)->jVal;
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,temp);
- temp = (HwDeviceExtension->pSR)->jVal;
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,temp); */
- } else {
- #ifdef TC
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,SR13);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,SR14);
- SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x15,0xFF,0x04);
- #else
- SiS_SetDRAMSize_300(SiS_Pr, HwDeviceExtension);
- SiS_SetDRAMSize_300(SiS_Pr, HwDeviceExtension);
- #endif
- }
- }
- if((HwDeviceExtension->jChipType==SIS_540)||
- (HwDeviceExtension->jChipType==SIS_630)||
- (HwDeviceExtension->jChipType==SIS_730)) {
- #if 0
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x12,SR12);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,SR13);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,SR14);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,SR16);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x17,SR17);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x18,SR18);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x19,SR19);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1A,SR1A);
- #endif
- }
- /* SetDRAMSize end */
- #endif /* SIS300 */
- /* Set default Ext2Regs */
- #if 0
- AGP=1;
- temp=(UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x3A);
- temp &= 0x30;
- if(temp == 0x30) AGP=0;
- if(AGP == 0) *SiS_Pr->pSiS_SR21 &= 0xEF;
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x21,*SiS_Pr->pSiS_SR21);
- if(AGP == 1) *SiS_Pr->pSiS_SR22 &= 0x20;
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x22,*SiS_Pr->pSiS_SR22);
- #endif
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x21,*SiS_Pr->pSiS_SR21);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x22,*SiS_Pr->pSiS_SR22);
- #if 0
- SiS_SetReg3(SiS_Pr->SiS_P3c6,0xff);
- SiS_ClearDAC(SiS_Pr, SiS_Pr->SiS_P3c8);
- #endif
- #ifdef LINUXBIOS /* TW: This is not needed for our purposes */
- SiS_DetectMonitor(SiS_Pr, HwDeviceExtension,BaseAddr); /* Sense CRT1 */
- SiS_GetSenseStatus(SiS_Pr, HwDeviceExtension,ROMAddr); /* Sense CRT2 */
- #endif
- return(TRUE);
- }
- void
- SiS_Set_LVDS_TRUMPION(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
- {
- USHORT temp = 0;
- #ifdef SiS300
- if((HwDeviceExtension->jChipType == SIS_540) ||
- (HwDeviceExtension->jChipType == SIS_630) ||
- (HwDeviceExtension->jChipType == SIS_730)) {
- /* TW: Read POWER_ON_TRAP and copy to CR37 */
- temp = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1A);
- temp = (temp & 0xE0) >> 4;
- SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x37,0xF1,temp);
- }
- #endif
- #ifdef SIS315H
- if((HwDeviceExtension->jChipType == SIS_640) ||
- (HwDeviceExtension->jChipType == SIS_740) ||
- (HwDeviceExtension->jChipType == SIS_650)) {
- #if 0 /* TW: This is not required */
- /* TW: Read POWER_ON_TRAP and copy to CR37 */
- temp = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1A);
- temp = (temp & 0xE0) >> 4;
- SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x37,0xF1,temp);
- #endif
- }
- #endif
- SiSSetLVDSetc(SiS_Pr, HwDeviceExtension, 0);
- }
- /* =============== SiS 300 dram sizing begin =============== */
- #ifdef SIS300
- void
- SiS_SetDRAMSize_300(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
- {
- ULONG FBAddr = (ULONG)HwDeviceExtension->pjVideoMemoryAddress;
- USHORT SR13, SR14=0, buswidth, Done;
- SHORT i, j, k;
- USHORT data, TotalCapacity, PhysicalAdrOtherPage=0;
- ULONG Addr;
- UCHAR temp;
- int PseudoRankCapacity, PseudoTotalCapacity, PseudoAdrPinCount;
- int RankCapacity, AdrPinCount, BankNumHigh, BankNumMid, MB2Bank;
- int PageCapacity, PhysicalAdrHigh, PhysicalAdrHalfPage;
- SiSSetMode(SiS_Pr, HwDeviceExtension, 0x2e);
- SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x01,0x20); /* Turn OFF Display */
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,0x00);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,0xBF);
- buswidth = SiS_ChkBUSWidth_300(SiS_Pr, FBAddr);
- MB2Bank = 16;
- Done = 0;
- for(i=6; i>=0; i--) {
- if(Done == 1) break;
- PseudoRankCapacity = 1 << i;
- for(j=4; j>=1; j--) {
- if(Done == 1) break;
- PseudoTotalCapacity = PseudoRankCapacity * j;
- PseudoAdrPinCount = 15 - j;
- if(PseudoTotalCapacity <= 64) {
- for(k=0; k<=16; k++) {
- if(Done == 1) break;
- RankCapacity = buswidth * SiS_DRAMType[k][3];
- AdrPinCount = SiS_DRAMType[k][2] + SiS_DRAMType[k][0];
- if(RankCapacity == PseudoRankCapacity)
- if(AdrPinCount <= PseudoAdrPinCount) {
- if(j == 3) { /* Rank No */
- BankNumHigh = RankCapacity * MB2Bank * 3 - 1;
- BankNumMid = RankCapacity * MB2Bank * 1 - 1;
- } else {
- BankNumHigh = RankCapacity * MB2Bank * j - 1;
- BankNumMid = RankCapacity * MB2Bank * j / 2 - 1;
- }
- PageCapacity = (1 << SiS_DRAMType[k][1]) * buswidth * 4;
- PhysicalAdrHigh = BankNumHigh;
- PhysicalAdrHalfPage = (PageCapacity / 2 + PhysicalAdrHigh) % PageCapacity;
- PhysicalAdrOtherPage = PageCapacity * SiS_DRAMType[k][2] + PhysicalAdrHigh;
- /* Write data */
- /*Test*/
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x15,0xFB);
- SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x15,0x04);
- /*/Test*/
- TotalCapacity = SiS_DRAMType[k][3] * buswidth;
- SR13 = SiS_DRAMType[k][4];
- if(buswidth == 4) SR14 = (TotalCapacity - 1) | 0x80;
- if(buswidth == 2) SR14 = (TotalCapacity - 1) | 0x40;
- if(buswidth == 1) SR14 = (TotalCapacity - 1) | 0x00;
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,SR13);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,SR14);
- Addr = FBAddr + (BankNumHigh) * 64 * 1024 + PhysicalAdrHigh;
- *((USHORT *)(Addr)) = (USHORT)PhysicalAdrHigh;
- Addr = FBAddr + (BankNumMid) * 64 * 1024 + PhysicalAdrHigh;
- *((USHORT *)(Addr)) = (USHORT)BankNumMid;
- Addr = FBAddr + (BankNumHigh) * 64 * 1024 + PhysicalAdrHalfPage;
- *((USHORT *)(Addr)) = (USHORT)PhysicalAdrHalfPage;
- Addr = FBAddr + (BankNumHigh) * 64 * 1024 + PhysicalAdrOtherPage;
- *((USHORT *)(Addr)) = PhysicalAdrOtherPage;
- /* Read data */
- Addr = FBAddr + (BankNumHigh) * 64 * 1024 + PhysicalAdrHigh;
- data = *((USHORT *)(Addr));
- if(data == PhysicalAdrHigh) Done = 1;
- } /* if struct */
- } /* for loop (k) */
- } /* if struct */
- } /* for loop (j) */
- } /* for loop (i) */
- }
- USHORT
- SiS_ChkBUSWidth_300(SiS_Private *SiS_Pr, ULONG FBAddress)
- {
- PULONG pVideoMemory;
- pVideoMemory = (PULONG)FBAddress;
- pVideoMemory[0] = 0x01234567L;
- pVideoMemory[1] = 0x456789ABL;
- pVideoMemory[2] = 0x89ABCDEFL;
- pVideoMemory[3] = 0xCDEF0123L;
- if (pVideoMemory[3]==0xCDEF0123L) { /* Channel A 128bit */
- return(4);
- }
- if (pVideoMemory[1]==0x456789ABL) { /* Channel B 64bit */
- return(2);
- }
- return(1);
- }
- #endif
- /* =============== SiS 300 dram sizing end =============== */
- /* ============ SiS 310/325 dram sizing begin ============== */
- #ifdef SIS315H
- /* TW: Moved Get310DRAMType further down */
- void
- SiS_Delay15us(SiS_Private *SiS_Pr, ULONG ulMicrsoSec)
- {
- }
- void
- SiS_SDR_MRS(SiS_Private *SiS_Pr, )
- {
- USHORT data;
- data = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16);
- data &= 0x3F; /* SR16 D7=0, D6=0 */
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,data); /* enable mode register set(MRS) low */
- SiS_Delay15us(SiS_Pr, 0x100);
- data |= 0x80; /* SR16 D7=1, D6=0 */
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,data); /* enable mode register set(MRS) high */
- SiS_Delay15us(SiS_Pr, 0x100);
- }
- void
- SiS_DDR_MRS(SiS_Private *SiS_Pr)
- {
- USHORT data;
- /* SR16 <- 1F,DF,2F,AF */
- /* enable DLL of DDR SD/SGRAM , SR16 D4=1 */
- data=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16);
- data &= 0x0F;
- data |= 0x10;
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,data);
- if (!(SiS_Pr->SiS_SR15[1][SiS_Pr->SiS_RAMType] & 0x10))
- data &= 0x0F;
- /* SR16 D7=1,D6=1 */
- data |= 0xC0;
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,data);
-
- /* SR16 D7=1,D6=0,D5=1,D4=0 */
- data &= 0x0F;
- data |= 0x20;
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,data);
- if (!(SiS_Pr->SiS_SR15[1][SiS_Pr->SiS_RAMType] & 0x10))
- data &= 0x0F;
- /* SR16 D7=1 */
- data |= 0x80;
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,data);
- }
- void
- SiS_SetDRAMModeRegister(SiS_Private *SiS_Pr, UCHAR *ROMAddr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
- {
- if (SiS_Get310DRAMType(ROMAddr,HwDeviceExtension) < 2)
- SiS_SDR_MRS(SiS_Pr);
- else
- /* SR16 <- 0F,CF,0F,8F */
- SiS_DDR_MRS(SiS_Pr);
- }
- void
- SiS_DisableRefresh(SiS_Private *SiS_Pr)
- {
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x17,0xF8);
- SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x19,0x03);
- }
- void
- SiS_EnableRefresh(SiS_Private *SiS_Pr, UCHAR *ROMAddr)
- {
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x17,SiS_Pr->SiS_SR15[2][SiS_Pr->SiS_RAMType]);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x19,SiS_Pr->SiS_SR15[4][SiS_Pr->SiS_RAMType]);
- }
- void
- SiS_DisableChannelInterleaving(SiS_Private *SiS_Pr, int index,
- USHORT SiS_DDRDRAM_TYPE[][5])
- {
- USHORT data;
- data=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x15);
- data &= 0x1F;
- switch (SiS_DDRDRAM_TYPE[index][3])
- {
- case 64: data |= 0; break;
- case 32: data |= 0x20; break;
- case 16: data |= 0x40; break;
- case 4: data |= 0x60; break;
- }
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x15,data);
- }
- void
- SiS_SetDRAMSizingType(SiS_Private *SiS_Pr, int index, USHORT DRAMTYPE_TABLE[][5])
- {
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,DRAMTYPE_TABLE[index][4]);
- /* should delay 50 ns */
- }
- void
- SiS_CheckBusWidth_310(SiS_Private *SiS_Pr, UCHAR *ROMAddress,ULONG FBAddress,
- PSIS_HW_DEVICE_INFO HwDeviceExtension)
- {
- USHORT data;
- PULONG volatile pVideoMemory;
- pVideoMemory = (PULONG)FBAddress;
- if(SiS_Get310DRAMType(ROMAddress,HwDeviceExtension) < 2) {
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,0x00);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,0x12);
- /* should delay */
- SiS_SDR_MRS(SiS_Pr);
- SiS_Pr->SiS_ChannelAB = 0;
- SiS_Pr->SiS_DataBusWidth = 128;
- pVideoMemory[0] = 0x01234567L;
- pVideoMemory[1] = 0x456789ABL;
- pVideoMemory[2] = 0x89ABCDEFL;
- pVideoMemory[3] = 0xCDEF0123L;
- pVideoMemory[4] = 0x55555555L;
- pVideoMemory[5] = 0x55555555L;
- pVideoMemory[6] = 0xFFFFFFFFL;
- pVideoMemory[7] = 0xFFFFFFFFL;
- if ((pVideoMemory[3]!=0xCDEF0123L) || (pVideoMemory[2] != 0x89ABCDEFL)) {
- /*Channel A 64Bit */
- SiS_Pr->SiS_DataBusWidth = 64;
- SiS_Pr->SiS_ChannelAB = 0;
- data=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,(USHORT)(data & 0xFD));
- }
- if ((pVideoMemory[1]!=0x456789ABL) || (pVideoMemory[0] != 0x01234567L)) {
- /*Channel B 64Bit */
- SiS_Pr->SiS_DataBusWidth = 64;
- SiS_Pr->SiS_ChannelAB = 1;
- data=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,(USHORT)((data&0xFD)|0x01));
- }
- return;
- } else {
- /* DDR Dual channel */
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,0x00);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,0x02); /* Channel A, 64bit */
- /* should delay */
- SiS_DDR_MRS(SiS_Pr);
- SiS_Pr->SiS_ChannelAB = 0;
- SiS_Pr->SiS_DataBusWidth = 64;
- pVideoMemory[0] = 0x01234567L;
- pVideoMemory[1] = 0x456789ABL;
- pVideoMemory[2] = 0x89ABCDEFL;
- pVideoMemory[3] = 0xCDEF0123L;
- pVideoMemory[4] = 0x55555555L;
- pVideoMemory[5] = 0x55555555L;
- pVideoMemory[6] = 0xAAAAAAAAL;
- pVideoMemory[7] = 0xAAAAAAAAL;
- if (pVideoMemory[1] == 0x456789ABL) {
- if (pVideoMemory[0] == 0x01234567L) {
- /* Channel A 64bit */
- return;
- }
- } else {
- if (pVideoMemory[0] == 0x01234567L) {
- /* Channel A 32bit */
- SiS_Pr->SiS_DataBusWidth = 32;
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,0x00);
- return;
- }
- }
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,0x03); /* Channel B, 64bit */
- SiS_DDR_MRS(SiS_Pr);
- SiS_Pr->SiS_ChannelAB = 1;
- SiS_Pr->SiS_DataBusWidth = 64;
- pVideoMemory[0] = 0x01234567L;
- pVideoMemory[1] = 0x456789ABL;
- pVideoMemory[2] = 0x89ABCDEFL;
- pVideoMemory[3] = 0xCDEF0123L;
- pVideoMemory[4] = 0x55555555L;
- pVideoMemory[5] = 0x55555555L;
- pVideoMemory[6] = 0xAAAAAAAAL;
- pVideoMemory[7] = 0xAAAAAAAAL;
- if (pVideoMemory[1] == 0x456789ABL) {
- /* Channel B 64 */
- if (pVideoMemory[0] == 0x01234567L) {
- /* Channel B 64bit */
- return;
- } else {
- /* error */
- }
- } else {
- if (pVideoMemory[0] == 0x01234567L) {
- /* Channel B 32 */
- SiS_Pr->SiS_DataBusWidth = 32;
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,0x01);
- } else {
- /* error */
- }
- }
- }
- }
- int
- SiS_SetRank(SiS_Private *SiS_Pr, int index,UCHAR RankNo,USHORT DRAMTYPE_TABLE[][5])
- {
- USHORT data;
- int RankSize;
- if ((RankNo==2)&&(DRAMTYPE_TABLE[index][0]==2))
- return 0;
- RankSize = DRAMTYPE_TABLE[index][3]/2 * SiS_Pr->SiS_DataBusWidth / 32;
- if (RankNo * RankSize <= 128) {
- data = 0;
- while((RankSize >>= 1) > 0) {
- data += 0x10;
- }
- data |= (RankNo - 1) << 2;
- data |= (SiS_Pr->SiS_DataBusWidth / 64) & 2;
- data |= SiS_Pr->SiS_ChannelAB;
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,data);
- /* should delay */
- SiS_SDR_MRS(SiS_Pr);
- return 1;
- } else
- return 0;
- }
- int
- SiS_SetDDRChannel(SiS_Private *SiS_Pr, int index,UCHAR ChannelNo,
- USHORT DRAMTYPE_TABLE[][5])
- {
- USHORT data;
- int RankSize;
- RankSize = DRAMTYPE_TABLE[index][3]/2 * SiS_Pr->SiS_DataBusWidth / 32;
- /* RankSize = DRAMTYPE_TABLE[index][3]; */
- if (ChannelNo * RankSize <= 128) {
- data = 0;
- while((RankSize >>= 1) > 0) {
- data += 0x10;
- }
- if(ChannelNo == 2) data |= 0x0C;
- data |= (SiS_Pr->SiS_DataBusWidth / 32) & 2;
- data |= SiS_Pr->SiS_ChannelAB;
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,data);
- /* should delay */
- SiS_DDR_MRS(SiS_Pr);
- return 1;
- } else
- return 0;
- }
- int
- SiS_CheckColumn(SiS_Private *SiS_Pr, int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress)
- {
- int i;
- ULONG Increment,Position;
- /*Increment = 1<<(DRAMTYPE_TABLE[index][2] + SiS_Pr->SiS_DataBusWidth / 64 + 1); */
- Increment = 1 << (10 + SiS_Pr->SiS_DataBusWidth / 64);
- for (i=0,Position=0;i<2;i++) {
- *((PULONG)(FBAddress + Position)) = Position;
- Position += Increment;
- }
- for (i=0,Position=0;i<2;i++) {
- /* if (FBAddress[Position]!=Position) */
- if((*(PULONG)(FBAddress + Position)) != Position)
- return 0;
- Position += Increment;
- }
- return 1;
- }
- int
- SiS_CheckBanks(SiS_Private *SiS_Pr, int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress)
- {
- int i;
- ULONG Increment,Position;
- Increment = 1 << (DRAMTYPE_TABLE[index][2] + SiS_Pr->SiS_DataBusWidth / 64 + 2);
- for (i=0,Position=0;i<4;i++) {
- /* FBAddress[Position]=Position; */
- *((PULONG)(FBAddress + Position)) = Position;
- Position += Increment;
- }
- for (i=0,Position=0;i<4;i++) {
- /* if (FBAddress[Position]!=Position) */
- if((*(PULONG)(FBAddress + Position)) != Position)
- return 0;
- Position += Increment;
- }
- return 1;
- }
- int
- SiS_CheckRank(SiS_Private *SiS_Pr, int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress)
- {
- int i;
- ULONG Increment,Position;
- Increment = 1<<(DRAMTYPE_TABLE[index][2] + DRAMTYPE_TABLE[index][1] +
- DRAMTYPE_TABLE[index][0] + SiS_Pr->SiS_DataBusWidth / 64 + RankNo);
- for (i=0,Position=0;i<2;i++) {
- /* FBAddress[Position]=Position; */
- *((PULONG)(FBAddress+Position))=Position;
- /* *((PULONG)(FBAddress))=Position; */
- Position += Increment;
- }
- for (i=0,Position=0;i<2;i++) {
- /* if (FBAddress[Position]!=Position) */
- if ( (*(PULONG) (FBAddress + Position)) !=Position)
- /*if ( (*(PULONG) (FBAddress )) !=Position) */
- return 0;
- Position += Increment;
- }
- return 1;
- }
- int
- SiS_CheckDDRRank(SiS_Private *SiS_Pr, int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress)
- {
- ULONG Increment,Position;
- USHORT data;
- Increment = 1<<(DRAMTYPE_TABLE[index][2] + DRAMTYPE_TABLE[index][1] +
- DRAMTYPE_TABLE[index][0] + SiS_Pr->SiS_DataBusWidth / 64 + RankNo);
- Increment += Increment/2;
- Position =0;
- *((PULONG)(FBAddress+Position + 0)) = 0x01234567;
- *((PULONG)(FBAddress+Position + 1)) = 0x456789AB;
- *((PULONG)(FBAddress+Position + 2)) = 0x55555555;
- *((PULONG)(FBAddress+Position + 3)) = 0x55555555;
- *((PULONG)(FBAddress+Position + 4)) = 0xAAAAAAAA;
- *((PULONG)(FBAddress+Position + 5)) = 0xAAAAAAAA;
- if ( (*(PULONG) (FBAddress + 1)) == 0x456789AB)
- return 1;
- if ( (*(PULONG) (FBAddress + 0)) == 0x01234567)
- return 0;
- data=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14);
- data &= 0xF3;
- data |= 0x08;
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,data);
- data=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x15);
- data += 0x20;
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x15,data);
- return 1;
- }
- int
- SiS_CheckRanks(SiS_Private *SiS_Pr, int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress)
- {
- int r;
- for (r=RankNo;r>=1;r--) {
- if (!SiS_CheckRank(SiS_Pr, r, index, DRAMTYPE_TABLE, FBAddress))
- return 0;
- }
- if (!SiS_CheckBanks(SiS_Pr, index, DRAMTYPE_TABLE, FBAddress))
- return 0;
- if (!SiS_CheckColumn(SiS_Pr, index, DRAMTYPE_TABLE, FBAddress))
- return 0;
- return 1;
- }
- int
- SiS_CheckDDRRanks(SiS_Private *SiS_Pr, int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],
- ULONG FBAddress)
- {
- int r;
- for (r=RankNo;r>=1;r--) {
- if (!SiS_CheckDDRRank(SiS_Pr, r,index,DRAMTYPE_TABLE,FBAddress))
- return 0;
- }
- if (!SiS_CheckBanks(SiS_Pr, index,DRAMTYPE_TABLE,FBAddress))
- return 0;
- if (!SiS_CheckColumn(SiS_Pr, index,DRAMTYPE_TABLE,FBAddress))
- return 0;
- return 1;
- }
- int
- SiS_SDRSizing(SiS_Private *SiS_Pr, ULONG FBAddress)
- {
- int i;
- UCHAR j;
- for (i=0;i<13;i++) {
- SiS_SetDRAMSizingType(SiS_Pr, i, SiS_SDRDRAM_TYPE);
- for (j=2;j>0;j--) {
- if (!SiS_SetRank(SiS_Pr, i,(UCHAR) j, SiS_SDRDRAM_TYPE))
- continue;
- else {
- if (SiS_CheckRanks(SiS_Pr, j,i,SiS_SDRDRAM_TYPE, FBAddress))
- return 1;
- }
- }
- }
- return 0;
- }
- int
- SiS_DDRSizing(SiS_Private *SiS_Pr, ULONG FBAddress)
- {
- int i;
- UCHAR j;
- for (i=0; i<4; i++){
- SiS_SetDRAMSizingType(SiS_Pr, i, SiS_DDRDRAM_TYPE);
- SiS_DisableChannelInterleaving(SiS_Pr, i, SiS_DDRDRAM_TYPE);
- for (j=2; j>0; j--) {
- SiS_SetDDRChannel(SiS_Pr, i, j, SiS_DDRDRAM_TYPE);
- if (!SiS_SetRank(SiS_Pr, i, (UCHAR) j, SiS_DDRDRAM_TYPE))
- continue;
- else {
- if (SiS_CheckDDRRanks(SiS_Pr, j, i, SiS_DDRDRAM_TYPE, FBAddress))
- return 1;
- }
- }
- }
- return 0;
- }
- /*
- check if read cache pointer is correct
- */
- void
- SiS_VerifyMclk(SiS_Private *SiS_Pr, ULONG FBAddr)
- {
- PUCHAR pVideoMemory = (PUCHAR) FBAddr;
- UCHAR i, j;
- USHORT Temp,SR21;
- pVideoMemory[0] = 0xaa; /* alan */
- pVideoMemory[16] = 0x55; /* note: PCI read cache is off */
- if((pVideoMemory[0] != 0xaa) || (pVideoMemory[16] != 0x55)) {
- for (i=0,j=16; i<2; i++,j+=16) {
- SR21 = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x21);
- Temp = SR21 & 0xFB; /* disable PCI post write buffer empty gating */
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x21,Temp);
- Temp = SiS_GetReg1(SiS_Pr->SiS_P3c4, 0x3C);
- Temp |= 0x01; /* MCLK reset */
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x3C,Temp);
- Temp = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x3C);
- Temp &= 0xFE; /* MCLK normal operation */
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x3C,Temp);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x21,SR21);
- pVideoMemory[16+j] = j;
- if(pVideoMemory[16+j] == j) {
- pVideoMemory[j] = j;
- break;
- }
- }
- }
- }
- /* TW: Is this a 315E? */
- int
- Is315E(SiS_Private *SiS_Pr)
- {
- USHORT data;
- data = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x5F);
- if(data & 0x10) return 1;
- else return 0;
- }
- /* TW: For 315 only */
- void
- SiS_SetDRAMSize_310(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
- {
- UCHAR *ROMAddr = HwDeviceExtension->pjVirtualRomBase;
- ULONG FBAddr = (ULONG)HwDeviceExtension->pjVideoMemoryAddress;
- USHORT data;
- #ifdef SIS301 /* TW: SIS301 ??? */
- /*SiS_SetReg1(SiS_Pr->SiS_P3d4,0x30,0x40); */
- #endif
- #ifdef SIS302 /* TW: SIS302 ??? */
- SiS_SetReg1(SiS_Pr->SiS_P3d4,0x30,0x4D); /* alan,should change value */
- SiS_SetReg1(SiS_Pr->SiS_P3d4,0x31,0xc0); /* alan,should change value */
- SiS_SetReg1(SiS_Pr->SiS_P3d4,0x34,0x3F); /* alan,should change value */
- #endif
- SiSSetMode(SiS_Pr, HwDeviceExtension, 0x2e);
- data = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x21);
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x21,0xDF); /* disable read cache */
- SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x01,0x20); /* Turn OFF Display */
- SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x16,0x0F); /* assume lowest speed DRAM */
- SiS_SetDRAMModeRegister(SiS_Pr, ROMAddr, HwDeviceExtension);
- SiS_DisableRefresh(SiS_Pr);
- SiS_CheckBusWidth_310(SiS_Pr, ROMAddr, FBAddr, HwDeviceExtension);
- SiS_VerifyMclk(SiS_Pr, FBAddr);
- if(SiS_Get310DRAMType(SiS_Pr, ROMAddr, HwDeviceExtension) < 2)
- SiS_SDRSizing(SiS_Pr, FBAddr);
- else
- SiS_DDRSizing(SiS_Pr, FBAddr);
- if(Is315E(SiS_Pr)) {
- data = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14);
- if((data & 0x0C) == 0x0C) { /* dual channel */
- if((data & 0xF0) > 0x40)
- data = (data & 0x0F) | 0x40;
- } else { /* single channel */
- if((data & 0xF0) > 0x50)
- data = (data & 0x0F) | 0x50;
- }
- }
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,SiS_Pr->SiS_SR15[1][SiS_Pr->SiS_RAMType]); /* restore SR16 */
- SiS_EnableRefresh(SiS_Pr, ROMAddr);
- SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x21,0x20); /* enable read cache */
- }
- #endif
- void
- SiS_SetMemoryClock(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension)
- {
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x28,SiS_Pr->SiS_MCLKData_0[SiS_Pr->SiS_RAMType].SR28);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x29,SiS_Pr->SiS_MCLKData_0[SiS_Pr->SiS_RAMType].SR29);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2A,SiS_Pr->SiS_MCLKData_0[SiS_Pr->SiS_RAMType].SR2A);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2E,SiS_Pr->SiS_ECLKData[SiS_Pr->SiS_RAMType].SR2E);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2F,SiS_Pr->SiS_ECLKData[SiS_Pr->SiS_RAMType].SR2F);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x30,SiS_Pr->SiS_ECLKData[SiS_Pr->SiS_RAMType].SR30);
- #ifdef SIS315H
- if (Is315E(SiS_Pr)) {
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x28,0x3B); /* 143 */
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x29,0x22);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2E,0x3B); /* 143 */
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2F,0x22);
- }
- #endif
- }
- #endif /* ifdef LINUXBIOS */
- #ifdef SIS315H
- UCHAR
- SiS_Get310DRAMType(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension)
- {
- UCHAR data;
- if(*SiS_Pr->pSiS_SoftSetting & SoftDRAMType) {
- data = *SiS_Pr->pSiS_SoftSetting & 0x03;
- } else {
- if(HwDeviceExtension->jChipType > SIS_315PRO) {
- data = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13) & 0x07;
- } else { /* TW: 315 */
- data = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x3a) & 0x03;
- }
- }
- return data;
- }
- #endif
- /* SiSInit END */
- /* ----------------------------------------- */
- void SiSRegInit(SiS_Private *SiS_Pr, USHORT BaseAddr)
- {
- SiS_Pr->SiS_P3c4 = BaseAddr + 0x14;
- SiS_Pr->SiS_P3d4 = BaseAddr + 0x24;
- SiS_Pr->SiS_P3c0 = BaseAddr + 0x10;
- SiS_Pr->SiS_P3ce = BaseAddr + 0x1e;
- SiS_Pr->SiS_P3c2 = BaseAddr + 0x12;
- SiS_Pr->SiS_P3ca = BaseAddr + 0x1a;
- SiS_Pr->SiS_P3c6 = BaseAddr + 0x16;
- SiS_Pr->SiS_P3c7 = BaseAddr + 0x17;
- SiS_Pr->SiS_P3c8 = BaseAddr + 0x18;
- SiS_Pr->SiS_P3c9 = BaseAddr + 0x19;
- SiS_Pr->SiS_P3da = BaseAddr + 0x2A;
- SiS_Pr->SiS_Part1Port = BaseAddr + SIS_CRT2_PORT_04; /* Digital video interface registers (LCD) */
- SiS_Pr->SiS_Part2Port = BaseAddr + SIS_CRT2_PORT_10; /* 301 TV Encoder registers */
- SiS_Pr->SiS_Part3Port = BaseAddr + SIS_CRT2_PORT_12; /* 301 Macrovision registers */
- SiS_Pr->SiS_Part4Port = BaseAddr + SIS_CRT2_PORT_14; /* 301 VGA2 (and LCD) registers */
- SiS_Pr->SiS_Part5Port = BaseAddr + SIS_CRT2_PORT_14+2; /* 301 palette address port registers */
- SiS_Pr->SiS_DDC_Port = BaseAddr + 0x14; /* DDC Port ( = P3C4, SR11/0A) */
- }
- void
- SiSInitPCIetc(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
- {
- /* #ifdef LINUX_XF86 */
- if ((HwDeviceExtension->jChipType == SIS_540)||
- (HwDeviceExtension->jChipType == SIS_630)||
- (HwDeviceExtension->jChipType == SIS_730)||
- (HwDeviceExtension->jChipType == SIS_300)) {
- /* TW: Set - PCI LINEAR ADDRESSING ENABLE (0x80)
- - PCI IO ENABLE (0x20)
- - MMIO ENABLE (0x1)
- */
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x20,0xa1);
- /* TW: Enable 2D (0x42) & 3D accelerator (0x18) */
- SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x1E,0xFF,0x5A);
- }
- if((HwDeviceExtension->jChipType == SIS_315H)||
- (HwDeviceExtension->jChipType == SIS_315PRO)||
- (HwDeviceExtension->jChipType == SIS_550)||
- (HwDeviceExtension->jChipType == SIS_640)||
- (HwDeviceExtension->jChipType == SIS_740)||
- (HwDeviceExtension->jChipType == SIS_650)) {
- /* TW: This seems to be done the same way on these chipsets */
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x20,0xa1);
- SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x1E,0xFF,0x5A);
- }
- /* #endif */
- }
- void
- SiSSetLVDSetc(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo)
- {
- ULONG temp;
- SiS_Pr->SiS_IF_DEF_LVDS = 0;
- SiS_Pr->SiS_IF_DEF_TRUMPION = 0;
- SiS_Pr->SiS_IF_DEF_CH70xx = 0;
- SiS_Pr->SiS_IF_DEF_HiVision = 0;
- SiS_Pr->SiS_IF_DEF_DSTN = 0;
- SiS_Pr->SiS_IF_DEF_FSTN = 0;
- SiS_Pr->SiS_ChrontelInit = 0;
- if((ModeNo == 0x5a) || (ModeNo == 0x5b)) {
- SiS_Pr->SiS_IF_DEF_DSTN = 1; /* for 550 dstn */
- SiS_Pr->SiS_IF_DEF_FSTN = 1; /* for fstn */
- }
- #ifdef SIS300
- if((HwDeviceExtension->jChipType == SIS_540) ||
- (HwDeviceExtension->jChipType == SIS_630) ||
- (HwDeviceExtension->jChipType == SIS_730))
- {
- /* TW: Check for SiS30x first */
- temp = SiS_GetReg1(SiS_Pr->SiS_Part4Port,0x00);
- if((temp == 1) || (temp == 2)) return;
- temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x37);
- temp = (temp & 0x0E) >> 1;
- if((temp >= 2) && (temp <= 5)) SiS_Pr->SiS_IF_DEF_LVDS = 1;
- if(temp == 3) SiS_Pr->SiS_IF_DEF_TRUMPION = 1;
- if((temp == 4) || (temp == 5)) {
- /* TW: Save power status (and error check) */
- SiS_Pr->SiS_Backup70xx = SiS_GetCH700x(SiS_Pr, 0x0e);
- SiS_Pr->SiS_IF_DEF_CH70xx = 1;
- }
- }
- #endif
- #ifdef SIS315H
- if((HwDeviceExtension->jChipType == SIS_550) ||
- (HwDeviceExtension->jChipType == SIS_640) ||
- (HwDeviceExtension->jChipType == SIS_740) ||
- (HwDeviceExtension->jChipType == SIS_650))
- {
- /* TW: CR37 is different on 310/325 series */
- if (SiS_Pr->SiS_IF_DEF_FSTN) /* fstn: set CR37=0x04 */
- SiS_SetReg1(SiS_Pr->SiS_P3d4,0x37,0x04); /* (fake LVDS bridge) */
- temp=SiS_GetReg1(SiS_Pr->SiS_P3d4,0x37);
- temp = (temp & 0x0E) >> 1;
- if((temp >= 2) && (temp <= 3)) SiS_Pr->SiS_IF_DEF_LVDS = 1;
- if(temp == 3) {
- SiS_Pr->SiS_IF_DEF_CH70xx = 2;
- }
- /* SiS_Pr->SiS_IF_DEF_HiVision = 1; */
- }
- #endif
- }
- void
- SiSInitPtr(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
- {
- #ifdef SIS315H
- if((HwDeviceExtension->jChipType == SIS_315H) ||
- (HwDeviceExtension->jChipType == SIS_315PRO) ||
- (HwDeviceExtension->jChipType == SIS_550) ||
- (HwDeviceExtension->jChipType == SIS_640) ||
- (HwDeviceExtension->jChipType == SIS_740) ||
- (HwDeviceExtension->jChipType == SIS_650))
- InitTo310Pointer(SiS_Pr, HwDeviceExtension);
- #endif
- #ifdef SIS300
- if ((HwDeviceExtension->jChipType == SIS_540) ||
- (HwDeviceExtension->jChipType == SIS_630) ||
- (HwDeviceExtension->jChipType == SIS_730) ||
- (HwDeviceExtension->jChipType == SIS_300))
- InitTo300Pointer(SiS_Pr, HwDeviceExtension);
- #endif
- }
- void
- SiSDetermineROMUsage(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, UCHAR *ROMAddr)
- {
- if((ROMAddr) && (HwDeviceExtension->UseROM)) {
- if((ROMAddr[0x00] != 0x55) || (ROMAddr[0x01] != 0xAA)) {
- SiS_Pr->SiS_UseROM = FALSE;
- } else if(HwDeviceExtension->jChipType < SIS_315H) {
- /* TW: We don't use the ROM image if BIOS version < 2.0.0 as
- * such old BIOSes don't have the needed data at the
- * expected locations
- */
- if(ROMAddr[0x06] < '2') SiS_Pr->SiS_UseROM = FALSE;
- else SiS_Pr->SiS_UseROM = TRUE;
- } else {
- /* TW: TODO: Check this for 310/325 series */
- SiS_Pr->SiS_UseROM = TRUE;
- }
- } else SiS_Pr->SiS_UseROM = FALSE;
- }
- /*
- =========================================
- ======== SiS SetMode Functions ==========
- =========================================
- */
- #ifdef LINUX_XF86
- /* TW: This is used for non-Dual-Head mode from X */
- BOOLEAN
- SiSBIOSSetMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, ScrnInfoPtr pScrn,
- DisplayModePtr mode)
- {
- UShort ModeNo=0;
- ModeNo = SiS_CalcModeIndex(pScrn, mode);
- if(!ModeNo) return FALSE;
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Setting mode 0x%xn", ModeNo);
- return(SiSSetMode(SiS_Pr, HwDeviceExtension, pScrn, ModeNo, TRUE));
- }
- #ifdef SISDUALHEAD
- /* TW: Set CRT1 mode (used for dual head) */
- BOOLEAN
- SiSBIOSSetModeCRT1(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, ScrnInfoPtr pScrn,
- DisplayModePtr mode)
- {
- ULONG temp;
- USHORT ModeIdIndex;
- UCHAR *ROMAddr = HwDeviceExtension->pjVirtualRomBase;
- USHORT BaseAddr = (USHORT)HwDeviceExtension->ulIOAddress;
- SISPtr pSiS = SISPTR(pScrn);
- SISEntPtr pSiSEnt = pSiS->entityPrivate;
- UShort ModeNo=0;
- ModeNo = SiS_CalcModeIndex(pScrn, mode);
- if(!ModeNo) return FALSE;
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Setting mode 0x%x on CRT1n", ModeNo);
- SiSInitPtr(SiS_Pr, HwDeviceExtension);
- SiSRegInit(SiS_Pr, BaseAddr);
- SiS_Pr->SiS_VGAINFO = SiS_GetSetMMIOReg(pScrn, 0x489, 0xff);
- SiSInitPCIetc(SiS_Pr, HwDeviceExtension);
- SiSSetLVDSetc(SiS_Pr, HwDeviceExtension, ModeNo);
- SiSDetermineROMUsage(SiS_Pr, HwDeviceExtension, ROMAddr);
- /* TW: We don't clear the buffer under X */
- SiS_Pr->SiS_flag_clearbuffer=0;
- /* 1.Openkey */
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x05,0x86);
- SiS_UnLockCRT2(SiS_Pr, HwDeviceExtension, BaseAddr);
- /* 2.Get ModeID Table */
- temp = SiS_SearchModeID(SiS_Pr, ROMAddr,&ModeNo,&ModeIdIndex);
- if(temp == 0) return(0);
- /* TW: Determine VBType (301,301B,301LV,302B,302LV) */
- SiS_GetVBType(SiS_Pr, BaseAddr,HwDeviceExtension);
- /* TW: Get VB information (connectors, connected devices) */
- SiS_GetVBInfo(SiS_Pr, BaseAddr,ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension);
- SiS_SetHiVision(SiS_Pr, BaseAddr,HwDeviceExtension);
- SiS_GetLCDResInfo(SiS_Pr, ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension);
- /* TW: I am not sure the flag's name is correct */
- if(HwDeviceExtension->jChipType >= SIS_315H) {
- if(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x17) & 0x08) {
- if(ModeNo != 0x10) SiS_Pr->SiS_SetFlag |= CRT2IsVGA;
- }
- }
- /* TW: Set mode on CRT1 */
- SiS_SetCRT1Group(SiS_Pr, ROMAddr,HwDeviceExtension,ModeNo,ModeIdIndex,BaseAddr);
- pSiSEnt->CRT1ModeNo = ModeNo;
- pSiSEnt->CRT1DMode = mode;
- /* TW: SetPitch: Adapt to virtual size & position */
- if(ModeNo > 0x13) {
- SiS_SetPitchCRT1(SiS_Pr, pScrn, BaseAddr);
- }
- /* We have to reset CRT2 if changing mode on CRT1 */
- if(pSiSEnt->CRT2ModeNo != -1) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "(Re-)Setting mode 0x%x on CRT2n",
- pSiSEnt->CRT2ModeNo);
- SiSBIOSSetModeCRT2(SiS_Pr, HwDeviceExtension, pSiSEnt->pScrn_1,
- pSiSEnt->CRT2DMode);
- }
- if((HwDeviceExtension->jChipType > SIS_315PRO) && (SiS_Pr->SiS_IF_DEF_LVDS == 0)) {
- /* TW: *** For 650 only! *** */
- SiS_HandleCRT1(SiS_Pr);
- }
- SiS_DisplayOn(SiS_Pr);
- SiS_SetReg3(SiS_Pr->SiS_P3c6,0xFF);
- if((HwDeviceExtension->jChipType >= SIS_315H) && (SiS_Pr->SiS_IF_DEF_LVDS == 0)) {
- if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) {
- SiS_Handle301B_1400x1050(SiS_Pr, ModeNo);
- }
- }
- /* Backup/Set ModeNo in MMIO */
- SiS_GetSetModeID(pScrn,ModeNo);
- return TRUE;
- }
- /* TW: Set CRT2 mode (used for dual head) */
- BOOLEAN
- SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, ScrnInfoPtr pScrn,
- DisplayModePtr mode)
- {
- ULONG temp;
- USHORT ModeIdIndex;
- UCHAR *ROMAddr = HwDeviceExtension->pjVirtualRomBase;
- USHORT BaseAddr = (USHORT)HwDeviceExtension->ulIOAddress;
- UShort ModeNo = 0;
- SISPtr pSiS = SISPTR(pScrn);
- SISEntPtr pSiSEnt = pSiS->entityPrivate;
- ModeNo = SiS_CalcModeIndex(pScrn, mode);
- if(!ModeNo) return FALSE;
- SiSInitPtr(SiS_Pr, HwDeviceExtension);
- SiSRegInit(SiS_Pr, BaseAddr);
- SiS_Pr->SiS_VGAINFO = SiS_GetSetMMIOReg(pScrn, 0x489, 0xff);
- SiSInitPCIetc(SiS_Pr, HwDeviceExtension);
- SiSSetLVDSetc(SiS_Pr, HwDeviceExtension, ModeNo);
- SiSDetermineROMUsage(SiS_Pr, HwDeviceExtension, ROMAddr);
- /* TW: We don't clear the buffer under X */
- SiS_Pr->SiS_flag_clearbuffer=0;
- /* TW: Save ModeNo so we can set it from within SetMode for CRT1 */
- pSiSEnt->CRT2ModeNo = ModeNo;
- pSiSEnt->CRT2DMode = mode;
- /* TW: We can't set CRT2 mode before CRT1 mode is set */
- if(pSiSEnt->CRT1ModeNo == -1) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Setting CRT2 mode delayed until after setting CRT1 moden");
- return TRUE;
- }
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Setting mode 0x%x on CRT2n", ModeNo);
- /* 1.Openkey */
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x05,0x86);
- SiS_UnLockCRT2(SiS_Pr, HwDeviceExtension, BaseAddr);
- /* 2.Get ModeID */
- temp = SiS_SearchModeID(SiS_Pr, ROMAddr,&ModeNo,&ModeIdIndex);
- if(temp == 0) return(0);
- /* TW: Determine VBType (301,301B,301LV,302B,302LV) */
- SiS_GetVBType(SiS_Pr, BaseAddr,HwDeviceExtension);
- /* TW: Get VB information (connectors, connected devices) */
- SiS_GetVBInfo(SiS_Pr, BaseAddr,ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension);
- SiS_SetHiVision(SiS_Pr, BaseAddr,HwDeviceExtension);
- SiS_GetLCDResInfo(SiS_Pr, ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension);
- if(HwDeviceExtension->jChipType >= SIS_315H) {
- if(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x17) & 0x08) {
- /* TW: I am not sure the flag's name is correct */
- if(ModeNo != 0x10) SiS_Pr->SiS_SetFlag |= CRT2IsVGA;
- }
- }
- /* Set mode on CRT2 */
- switch (HwDeviceExtension->ujVBChipID) {
- case VB_CHIP_301:
- case VB_CHIP_301B:
- case VB_CHIP_301LV:
- case VB_CHIP_301LVX:
- case VB_CHIP_302:
- case VB_CHIP_302B:
- case VB_CHIP_302LV:
- case VB_CHIP_302LVX:
- SiS_SetCRT2Group301(SiS_Pr, BaseAddr,ROMAddr,ModeNo,HwDeviceExtension);
- break;
- case VB_CHIP_303:
- break;
- case VB_CHIP_UNKNOWN:
- if (SiS_Pr->SiS_IF_DEF_LVDS == 1 || SiS_Pr->SiS_IF_DEF_CH70xx == 1 ||
- SiS_Pr->SiS_IF_DEF_TRUMPION != 0)
- SiS_SetCRT2Group301(SiS_Pr,BaseAddr,ROMAddr,ModeNo,HwDeviceExtension);
- break;
- }
- SiS_DisplayOn(SiS_Pr);
- SiS_SetReg3(SiS_Pr->SiS_P3c6,0xFF);
- if((HwDeviceExtension->jChipType >= SIS_315H) && (SiS_Pr->SiS_IF_DEF_LVDS == 0)) {
- if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) {
- SiS_Handle301B_1400x1050(SiS_Pr, ModeNo);
- }
- }
- /* TW: SetPitch: Adapt to virtual size & position */
- if(ModeNo > 0x13) {
- SiS_SetPitchCRT2(SiS_Pr, pScrn, BaseAddr);
- }
- return TRUE;
- }
- #endif /* Dualhead */
- #endif /* Linux_XF86 */
- #ifdef LINUX_XF86
- /* TW: We need pScrn for setting the pitch correctly */
- BOOLEAN
- SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,ScrnInfoPtr pScrn,USHORT ModeNo, BOOLEAN dosetpitch)
- #else
- BOOLEAN
- SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo)
- #endif
- {
- ULONG temp;
- USHORT ModeIdIndex,KeepLockReg;
- UCHAR *ROMAddr = HwDeviceExtension->pjVirtualRomBase;
- USHORT BaseAddr = (USHORT)HwDeviceExtension->ulIOAddress;
- SiSInitPtr(SiS_Pr, HwDeviceExtension);
- SiSRegInit(SiS_Pr, BaseAddr);
- #ifdef LINUX_XF86
- if(pScrn) SiS_Pr->SiS_VGAINFO = SiS_GetSetMMIOReg(pScrn, 0x489, 0xff);
- else
- #endif
- SiS_Pr->SiS_VGAINFO = 0x11;
- SiSInitPCIetc(SiS_Pr, HwDeviceExtension);
- SiSSetLVDSetc(SiS_Pr, HwDeviceExtension, ModeNo);
- SiSDetermineROMUsage(SiS_Pr, HwDeviceExtension, ROMAddr);
- /* TW: Shift the clear-buffer-bit away */
- ModeNo = ((ModeNo & 0x80) << 8) | (ModeNo & 0x7f);
- #ifdef LINUX_XF86
- /* TW: We never clear the buffer in X */
- ModeNo |= 0x8000;
- #endif
- if(ModeNo & 0x8000) {
- ModeNo &= 0x007F;
- SiS_Pr->SiS_flag_clearbuffer = 0;
- } else {
- SiS_Pr->SiS_flag_clearbuffer = 1;
- }
- /* 1.Openkey */
- KeepLockReg = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x05);
- SiS_SetReg1(SiS_Pr->SiS_P3c4,0x05,0x86);
- SiS_UnLockCRT2(SiS_Pr, HwDeviceExtension, BaseAddr);
- /* 2.Get ModeID Table */
- temp = SiS_SearchModeID(SiS_Pr,ROMAddr,&ModeNo,&ModeIdIndex);
- if(temp == 0) return(0);
- /* TW: Determine VBType (301,301B,301LV,302B,302LV) */
- SiS_GetVBType(SiS_Pr,BaseAddr,HwDeviceExtension);
- /* TW: Init/restore some VB registers */
- if(HwDeviceExtension->jChipType >= SIS_315H) {
- if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
- if(ROMAddr && SiS_Pr->SiS_UseROM) {
- temp = ROMAddr[VB310Data_1_2_Offset];
- temp |= 0x40;
- SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x02,temp);
- SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x32,0x10);
- }
- }
- }
- /* TW: Get VB information (connectors, connected devices) */
- SiS_GetVBInfo(SiS_Pr,BaseAddr,ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension);
- SiS_SetHiVision(SiS_Pr,BaseAddr,HwDeviceExtension);
- SiS_GetLCDResInfo(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension);
- /* 3. Check memory size */
- temp = SiS_CheckMemorySize(SiS_Pr,ROMAddr,HwDeviceExtension,ModeNo,ModeIdIndex);
- if(!temp) return(0);
- if(HwDeviceExtension->jChipType >= SIS_315H) {
- if(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x17) & 0x08) {
- /* TW: I am not sure the flag's name is correct */
- if(ModeNo != 0x10) SiS_Pr->SiS_SetFlag |= CRT2IsVGA;
- }
- }
- /* TW: Set mode on CRT1 */
- if(SiS_Pr->SiS_VBInfo & (SetSimuScanMode | SetCRT2ToLCDA)) {
- SiS_SetCRT1Group(SiS_Pr,ROMAddr,HwDeviceExtension,ModeNo,ModeIdIndex,BaseAddr);
- } else {
- if(!(SiS_Pr->SiS_VBInfo & SwitchToCRT2)) {
- SiS_SetCRT1Group(SiS_Pr,ROMAddr,HwDeviceExtension,ModeNo,ModeIdIndex,BaseAddr);
- }
- }
- /* TW: Set mode on CRT2 */
- if(SiS_Pr->SiS_VBInfo & (SetSimuScanMode | SwitchToCRT2 | SetCRT2ToLCDA)) {
- switch (HwDeviceExtension->ujVBChipID) {
- case VB_CHIP_301:
- case VB_CHIP_301B:
- case VB_CHIP_301LV:
- case VB_CHIP_301LVX:
- case VB_CHIP_302:
- case VB_CHIP_302B:
- case VB_CHIP_302LV:
- case VB_CHIP_302LVX:
- SiS_SetCRT2Group301(SiS_Pr,BaseAddr,ROMAddr,ModeNo,HwDeviceExtension);
- break;
- case VB_CHIP_303:
- break;
- case VB_CHIP_UNKNOWN:
- if(SiS_Pr->SiS_IF_DEF_LVDS == 1 ||
- SiS_Pr->SiS_IF_DEF_CH70xx != 0 ||
- SiS_Pr->SiS_IF_DEF_TRUMPION != 0)
- SiS_SetCRT2Group301(SiS_Pr,BaseAddr,ROMAddr,ModeNo,HwDeviceExtension);
- break;
- }
- }
- if((HwDeviceExtension->jChipType > SIS_315PRO) && (SiS_Pr->SiS_IF_DEF_LVDS == 0)) {
- /* TW: For 650 only! */
- SiS_HandleCRT1(SiS_Pr);
- }
- SiS_DisplayOn(SiS_Pr);
- SiS_SetReg3(SiS_Pr->SiS_P3c6,0xFF);
- if((HwDeviceExtension->jChipType >= SIS_315H) && (SiS_Pr->SiS_IF_DEF_LVDS == 0)) {
- if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) {
- SiS_Handle301B_1400x1050(SiS_Pr, ModeNo);
- }
- }
- #ifdef LINUX_XF86
- if(pScrn) {
- /* TW: SetPitch: Adapt to virtual size & position */
- if((ModeNo > 0x13) && (dosetpitch)) {
- SiS_SetPitch(SiS_Pr, pScrn, BaseAddr);
- }
- /* Backup/Set ModeNo in MMIO */
- SiS_GetSetModeID(pScrn, ModeNo);
- }
- #endif
- #ifndef LINUX_XF86 /* TW: We never lock registers in XF86 */
- if(KeepLockReg == 0xA1) SiS_SetReg1(SiS_Pr->SiS_P3c4,0x05,0x86);
- else SiS_SetReg1(SiS_Pr->SiS_P3c4,0x05,0x00);
- #endif
- return TRUE;
- }
- void
- SetEnableDstn(SiS_Private *SiS_Pr) /* TW: Called from sis_main.c */
- {
- /* For 550 dstn */
- SiS_Pr->SiS_IF_DEF_DSTN = 1;
- }
- void
- SiS_HandleCRT1(SiS_Private *SiS_Pr)
- {
- /* TW: Do this on 650 only! */
- /* TW: No, we don't do this at all. There is a new
- * CRT1-is-connected-at-boot-time logic in the 650, which
- * confuses our own. So just clear the bit and skip the rest.
- */
- SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x63,0xbf);
- #if 0
- if(!(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x15) & 0x01))
- SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x63,0x40);
- }
- #endif
- }
- void
- SiS_Handle301B_1400x1050(SiS_Private *SiS_Pr, USHORT ModeNo)
- {
- if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30) & SetCRT2ToLCD) {
- if(ModeNo <= 0x13) {
- if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x31) & (SetNotSimuMode >> 8)) {
- SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x38,0xFC);
- }
- }
- }
- }
- void
- SiS_SetCRT1Group(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension,
- USHORT ModeNo,USHORT ModeIdIndex,USHORT BaseAddr)
- {
- USHORT StandTableIndex,RefreshRateTableIndex;
- SiS_Pr->SiS_CRT1Mode = ModeNo;
- StandTableIndex = SiS_GetModePtr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex);
- if(SiS_LowModeStuff(SiS_Pr,ModeNo,HwDeviceExtension)) {
- if(SiS_Pr->SiS_VBInfo & (SetSimuScanMode | SwitchToCRT2)) {
- SiS_DisableBridge(SiS_Pr,HwDeviceExtension,BaseAddr);
- }
- }
- SiS_SetSeqRegs(SiS_Pr,ROMAddr,StandTableIndex);
- SiS_SetMiscRegs(SiS_Pr,ROMAddr,StandTableIndex);
- SiS_SetCRTCRegs(SiS_Pr,ROMAddr,HwDeviceExtension,StandTableIndex);
- SiS_SetATTRegs(SiS_Pr,ROMAddr,StandTableIndex,ModeNo,HwDeviceExtension);
- SiS_SetGRCRegs(SiS_Pr,ROMAddr,StandTableIndex);
- SiS_ClearExt1Regs(SiS_Pr,HwDeviceExtension);
- SiS_ResetCRT1VCLK(SiS_Pr,ROMAddr,HwDeviceExtension);