init.c
上传用户:lgb322
上传日期:2013-02-24
资源大小:30529k
文件大小:100k
- /* Function: Support NT X.0 MM function */
- /* Version : V 0.80 [ynlai] 04/12/98 */
- #include "init.h"
- #ifdef CONFIG_FB_SIS_300
- #include "300vtbl.h"
- #endif
- #ifdef CONFIG_FB_SIS_315
- #include "310vtbl.h"
- #endif
- BOOLEAN SiSInit (PSIS_HW_DEVICE_INFO HwDeviceExtension);
- BOOLEAN SiSSetMode (PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT ModeNo);
- #if defined(ALLOC_PRAGMA)
- #pragma alloc_text(PAGE,SiSSetMode)
- #pragma alloc_text(PAGE,SiSInit)
- #endif
- void SiS_SetReg1 (USHORT, USHORT, USHORT);
- void SiS_SetReg2 (USHORT, USHORT, USHORT);
- void SiS_SetReg3 (USHORT, USHORT);
- void SiS_SetReg4 (USHORT, ULONG);
- UCHAR SiS_GetReg1 (USHORT, USHORT);
- UCHAR SiS_GetReg2 (USHORT);
- ULONG SiS_GetReg3 (USHORT);
- void SiS_ClearDAC (ULONG);
- #ifdef CONFIG_FB_SIS_300
- void
- InitTo300Pointer (void)
- {
- SiS_SModeIDTable = (SiS_StStruct *) SiS300_SModeIDTable;
- SiS_VBModeIDTable = (SiS_VBModeStruct *) SiS300_VBModeIDTable; /*add for 300 oem util */
- SiS_StandTable = (SiS_StandTableStruct *) SiS300_StandTable;
- SiS_EModeIDTable = (SiS_ExtStruct *) SiS300_EModeIDTable;
- SiS_RefIndex = (SiS_Ext2Struct *) SiS300_RefIndex;
- SiS_CRT1Table = (SiS_CRT1TableStruct *) SiS300_CRT1Table;
- SiS_MCLKData = (SiS_MCLKDataStruct *) SiS300_MCLKData;
- SiS_ECLKData = (SiS_ECLKDataStruct *) SiS300_ECLKData;
- SiS_VCLKData = (SiS_VCLKDataStruct *) SiS300_VCLKData;
- SiS_VBVCLKData = (SiS_VBVCLKDataStruct *) SiS300_VCLKData;
- SiS_ScreenOffset = SiS300_ScreenOffset;
- SiS_StResInfo = (SiS_StResInfoStruct *) SiS300_StResInfo;
- SiS_ModeResInfo = (SiS_ModeResInfoStruct *) SiS300_ModeResInfo;
- pSiS_OutputSelect = &SiS300_OutputSelect;
- pSiS_SoftSetting = &SiS300_SoftSetting;
- pSiS_SR07 = &SiS300_SR07;
- SiS_SR15 = SiS300_SR15;
- SiS_CR40 = SiS300_CR40;
- SiS_CR49 = SiS300_CR49;
- pSiS_SR1F = &SiS300_SR1F;
- pSiS_SR21 = &SiS300_SR21;
- pSiS_SR22 = &SiS300_SR22;
- pSiS_SR23 = &SiS300_SR23;
- pSiS_SR24 = &SiS300_SR24;
- SiS_SR25 = SiS300_SR25;
- pSiS_SR31 = &SiS300_SR31;
- pSiS_SR32 = &SiS300_SR32;
- pSiS_SR33 = &SiS300_SR33;
- pSiS_CRT2Data_1_2 = &SiS300_CRT2Data_1_2;
- pSiS_CRT2Data_4_D = &SiS300_CRT2Data_4_D;
- pSiS_CRT2Data_4_E = &SiS300_CRT2Data_4_E;
- pSiS_CRT2Data_4_10 = &SiS300_CRT2Data_4_10;
- pSiS_RGBSenseData = &SiS300_RGBSenseData;
- pSiS_VideoSenseData = &SiS300_VideoSenseData;
- pSiS_YCSenseData = &SiS300_YCSenseData;
- pSiS_RGBSenseData2 = &SiS300_RGBSenseData2;
- pSiS_VideoSenseData2 = &SiS300_VideoSenseData2;
- pSiS_YCSenseData2 = &SiS300_YCSenseData2;
- SiS_NTSCPhase = SiS300_NTSCPhase;
- SiS_PALPhase = SiS300_PALPhase;
- SiS_NTSCPhase2 = SiS300_NTSCPhase2;
- SiS_PALPhase2 = SiS300_PALPhase2;
- SiS_PALMPhase = SiS300_PALMPhase; /*add for PALMN */
- SiS_PALNPhase = SiS300_PALNPhase;
- SiS_StLCD1024x768Data = (SiS_LCDDataStruct *) SiS300_StLCD1024x768Data;
- SiS_ExtLCD1024x768Data =
- (SiS_LCDDataStruct *) SiS300_ExtLCD1024x768Data;
- SiS_St2LCD1024x768Data =
- (SiS_LCDDataStruct *) SiS300_St2LCD1024x768Data;
- SiS_StLCD1280x1024Data =
- (SiS_LCDDataStruct *) SiS300_StLCD1280x1024Data;
- SiS_ExtLCD1280x1024Data =
- (SiS_LCDDataStruct *) SiS300_ExtLCD1280x1024Data;
- SiS_St2LCD1280x1024Data =
- (SiS_LCDDataStruct *) SiS300_St2LCD1280x1024Data;
- SiS_NoScaleData = (SiS_LCDDataStruct *) SiS300_NoScaleData;
- SiS_LCD1280x960Data = (SiS_LCDDataStruct *) SiS300_LCD1280x960Data;
- SiS_StPALData = (SiS_TVDataStruct *) SiS300_StPALData;
- SiS_ExtPALData = (SiS_TVDataStruct *) SiS300_ExtPALData;
- SiS_StNTSCData = (SiS_TVDataStruct *) SiS300_StNTSCData;
- SiS_ExtNTSCData = (SiS_TVDataStruct *) SiS300_ExtNTSCData;
- SiS_St1HiTVData = (SiS_TVDataStruct *) SiS300_St1HiTVData;
- SiS_St2HiTVData = (SiS_TVDataStruct *) SiS300_St2HiTVData;
- SiS_ExtHiTVData = (SiS_TVDataStruct *) SiS300_ExtHiTVData;
- SiS_NTSCTiming = SiS300_NTSCTiming;
- SiS_PALTiming = SiS300_PALTiming;
- SiS_HiTVSt1Timing = SiS300_HiTVSt1Timing;
- SiS_HiTVSt2Timing = SiS300_HiTVSt2Timing;
- SiS_HiTVTextTiming = SiS300_HiTVTextTiming;
- SiS_HiTVGroup3Data = SiS300_HiTVGroup3Data;
- SiS_HiTVGroup3Simu = SiS300_HiTVGroup3Simu;
- SiS_HiTVGroup3Text = SiS300_HiTVGroup3Text;
- SiS_PanelDelayTbl = (SiS_PanelDelayTblStruct *) SiS300_PanelDelayTbl;
- SiS_LVDS800x600Data_1 = (SiS_LVDSDataStruct *) SiS300_LVDS800x600Data_1;
- SiS_LVDS800x600Data_2 = (SiS_LVDSDataStruct *) SiS300_LVDS800x600Data_2;
- SiS_LVDS1024x768Data_1 =
- (SiS_LVDSDataStruct *) SiS300_LVDS1024x768Data_1;
- SiS_LVDS1024x768Data_2 =
- (SiS_LVDSDataStruct *) SiS300_LVDS1024x768Data_2;
- SiS_LVDS1280x1024Data_1 =
- (SiS_LVDSDataStruct *) SiS300_LVDS1280x1024Data_1;
- SiS_LVDS1280x1024Data_2 =
- (SiS_LVDSDataStruct *) SiS300_LVDS1280x1024Data_2;
- SiS_LVDS640x480Data_1 = (SiS_LVDSDataStruct *) SiS300_LVDS640x480Data_1;
- SiS_CHTVUNTSCData = (SiS_LVDSDataStruct *) SiS300_CHTVUNTSCData;
- SiS_CHTVONTSCData = (SiS_LVDSDataStruct *) SiS300_CHTVONTSCData;
- SiS_CHTVUPALData = (SiS_LVDSDataStruct *) SiS300_CHTVUPALData;
- SiS_CHTVOPALData = (SiS_LVDSDataStruct *) SiS300_CHTVOPALData;
- SiS_PanelType00_1 = (SiS_LVDSDesStruct *) SiS300_PanelType00_1;
- SiS_PanelType01_1 = (SiS_LVDSDesStruct *) SiS300_PanelType01_1;
- SiS_PanelType02_1 = (SiS_LVDSDesStruct *) SiS300_PanelType02_1;
- SiS_PanelType03_1 = (SiS_LVDSDesStruct *) SiS300_PanelType03_1;
- SiS_PanelType04_1 = (SiS_LVDSDesStruct *) SiS300_PanelType04_1;
- SiS_PanelType05_1 = (SiS_LVDSDesStruct *) SiS300_PanelType05_1;
- SiS_PanelType06_1 = (SiS_LVDSDesStruct *) SiS300_PanelType06_1;
- SiS_PanelType07_1 = (SiS_LVDSDesStruct *) SiS300_PanelType07_1;
- SiS_PanelType08_1 = (SiS_LVDSDesStruct *) SiS300_PanelType08_1;
- SiS_PanelType09_1 = (SiS_LVDSDesStruct *) SiS300_PanelType09_1;
- SiS_PanelType0a_1 = (SiS_LVDSDesStruct *) SiS300_PanelType0a_1;
- SiS_PanelType0b_1 = (SiS_LVDSDesStruct *) SiS300_PanelType0b_1;
- SiS_PanelType0c_1 = (SiS_LVDSDesStruct *) SiS300_PanelType0c_1;
- SiS_PanelType0d_1 = (SiS_LVDSDesStruct *) SiS300_PanelType0d_1;
- SiS_PanelType0e_1 = (SiS_LVDSDesStruct *) SiS300_PanelType0e_1;
- SiS_PanelType0f_1 = (SiS_LVDSDesStruct *) SiS300_PanelType0f_1;
- SiS_PanelType00_2 = (SiS_LVDSDesStruct *) SiS300_PanelType00_2;
- SiS_PanelType01_2 = (SiS_LVDSDesStruct *) SiS300_PanelType01_2;
- SiS_PanelType02_2 = (SiS_LVDSDesStruct *) SiS300_PanelType02_2;
- SiS_PanelType03_2 = (SiS_LVDSDesStruct *) SiS300_PanelType03_2;
- SiS_PanelType04_2 = (SiS_LVDSDesStruct *) SiS300_PanelType04_2;
- SiS_PanelType05_2 = (SiS_LVDSDesStruct *) SiS300_PanelType05_2;
- SiS_PanelType06_2 = (SiS_LVDSDesStruct *) SiS300_PanelType06_2;
- SiS_PanelType07_2 = (SiS_LVDSDesStruct *) SiS300_PanelType07_2;
- SiS_PanelType08_2 = (SiS_LVDSDesStruct *) SiS300_PanelType08_2;
- SiS_PanelType09_2 = (SiS_LVDSDesStruct *) SiS300_PanelType09_2;
- SiS_PanelType0a_2 = (SiS_LVDSDesStruct *) SiS300_PanelType0a_2;
- SiS_PanelType0b_2 = (SiS_LVDSDesStruct *) SiS300_PanelType0b_2;
- SiS_PanelType0c_2 = (SiS_LVDSDesStruct *) SiS300_PanelType0c_2;
- SiS_PanelType0d_2 = (SiS_LVDSDesStruct *) SiS300_PanelType0d_2;
- SiS_PanelType0e_2 = (SiS_LVDSDesStruct *) SiS300_PanelType0e_2;
- SiS_PanelType0f_2 = (SiS_LVDSDesStruct *) SiS300_PanelType0f_2;
- SiS_CHTVUNTSCDesData = (SiS_LVDSDesStruct *) SiS300_CHTVUNTSCDesData;
- SiS_CHTVONTSCDesData = (SiS_LVDSDesStruct *) SiS300_CHTVONTSCDesData;
- SiS_CHTVUPALDesData = (SiS_LVDSDesStruct *) SiS300_CHTVUPALDesData;
- SiS_CHTVOPALDesData = (SiS_LVDSDesStruct *) SiS300_CHTVOPALDesData;
- SiS_LVDSCRT1800x600_1 =
- (SiS_LVDSCRT1DataStruct *) SiS300_LVDSCRT1800x600_1;
- SiS_LVDSCRT11024x768_1 =
- (SiS_LVDSCRT1DataStruct *) SiS300_LVDSCRT11024x768_1;
- SiS_LVDSCRT11280x1024_1 =
- (SiS_LVDSCRT1DataStruct *) SiS300_LVDSCRT11280x1024_1;
- SiS_LVDSCRT1800x600_1_H =
- (SiS_LVDSCRT1DataStruct *) SiS300_LVDSCRT1800x600_1_H;
- SiS_LVDSCRT11024x768_1_H =
- (SiS_LVDSCRT1DataStruct *) SiS300_LVDSCRT11024x768_1_H;
- SiS_LVDSCRT11280x1024_1_H =
- (SiS_LVDSCRT1DataStruct *) SiS300_LVDSCRT11280x1024_1_H;
- SiS_LVDSCRT1800x600_2 =
- (SiS_LVDSCRT1DataStruct *) SiS300_LVDSCRT1800x600_2;
- SiS_LVDSCRT11024x768_2 =
- (SiS_LVDSCRT1DataStruct *) SiS300_LVDSCRT11024x768_2;
- SiS_LVDSCRT11280x1024_2 =
- (SiS_LVDSCRT1DataStruct *) SiS300_LVDSCRT11280x1024_2;
- SiS_LVDSCRT1800x600_2_H =
- (SiS_LVDSCRT1DataStruct *) SiS300_LVDSCRT1800x600_2_H;
- SiS_LVDSCRT11024x768_2_H =
- (SiS_LVDSCRT1DataStruct *) SiS300_LVDSCRT11024x768_2_H;
- SiS_LVDSCRT11280x1024_2_H =
- (SiS_LVDSCRT1DataStruct *) SiS300_LVDSCRT11280x1024_2_H;
- SiS_CHTVCRT1UNTSC = (SiS_LVDSCRT1DataStruct *) SiS300_CHTVCRT1UNTSC;
- SiS_CHTVCRT1ONTSC = (SiS_LVDSCRT1DataStruct *) SiS300_CHTVCRT1ONTSC;
- SiS_CHTVCRT1UPAL = (SiS_LVDSCRT1DataStruct *) SiS300_CHTVCRT1UPAL;
- SiS_CHTVCRT1OPAL = (SiS_LVDSCRT1DataStruct *) SiS300_CHTVCRT1OPAL;
- SiS_CHTVReg_UNTSC = (SiS_CHTVRegDataStruct *) SiS300_CHTVReg_UNTSC;
- SiS_CHTVReg_ONTSC = (SiS_CHTVRegDataStruct *) SiS300_CHTVReg_ONTSC;
- SiS_CHTVReg_UPAL = (SiS_CHTVRegDataStruct *) SiS300_CHTVReg_UPAL;
- SiS_CHTVReg_OPAL = (SiS_CHTVRegDataStruct *) SiS300_CHTVReg_OPAL;
- SiS_CHTVVCLKUNTSC = SiS300_CHTVVCLKUNTSC;
- SiS_CHTVVCLKONTSC = SiS300_CHTVVCLKONTSC;
- SiS_CHTVVCLKUPAL = SiS300_CHTVVCLKUPAL;
- SiS_CHTVVCLKOPAL = SiS300_CHTVVCLKOPAL;
- /* 300 customization related */
- }
- #endif
- #ifdef CONFIG_FB_SIS_315
- void
- InitTo310Pointer (void)
- {
- SiS_SModeIDTable = (SiS_StStruct *) SiS310_SModeIDTable;
- SiS_StandTable = (SiS_StandTableStruct *) SiS310_StandTable;
- SiS_EModeIDTable = (SiS_ExtStruct *) SiS310_EModeIDTable;
- SiS_RefIndex = (SiS_Ext2Struct *) SiS310_RefIndex;
- SiS_CRT1Table = (SiS_CRT1TableStruct *) SiS310_CRT1Table;
- SiS_MCLKData = (SiS_MCLKDataStruct *) SiS310_MCLKData;
- SiS_ECLKData = (SiS_ECLKDataStruct *) SiS310_ECLKData;
- SiS_VCLKData = (SiS_VCLKDataStruct *) SiS310_VCLKData;
- SiS_VBVCLKData = (SiS_VBVCLKDataStruct *) SiS310_VBVCLKData;
- SiS_ScreenOffset = SiS310_ScreenOffset;
- SiS_StResInfo = (SiS_StResInfoStruct *) SiS310_StResInfo;
- SiS_ModeResInfo = (SiS_ModeResInfoStruct *) SiS310_ModeResInfo;
- pSiS_OutputSelect = &SiS310_OutputSelect;
- pSiS_SoftSetting = &SiS310_SoftSetting;
- pSiS_SR07 = &SiS310_SR07;
- SiS_SR15 = SiS310_SR15;
- SiS_CR40 = SiS310_CR40;
- SiS_CR49 = SiS310_CR49;
- pSiS_SR1F = &SiS310_SR1F;
- pSiS_SR21 = &SiS310_SR21;
- pSiS_SR22 = &SiS310_SR22;
- pSiS_SR23 = &SiS310_SR23;
- pSiS_SR24 = &SiS310_SR24;
- SiS_SR25 = SiS310_SR25;
- pSiS_SR31 = &SiS310_SR31;
- pSiS_SR32 = &SiS310_SR32;
- pSiS_SR33 = &SiS310_SR33;
- pSiS_CRT2Data_1_2 = &SiS310_CRT2Data_1_2;
- pSiS_CRT2Data_4_D = &SiS310_CRT2Data_4_D;
- pSiS_CRT2Data_4_E = &SiS310_CRT2Data_4_E;
- pSiS_CRT2Data_4_10 = &SiS310_CRT2Data_4_10;
- pSiS_RGBSenseData = &SiS310_RGBSenseData;
- pSiS_VideoSenseData = &SiS310_VideoSenseData;
- pSiS_YCSenseData = &SiS310_YCSenseData;
- pSiS_RGBSenseData2 = &SiS310_RGBSenseData2;
- pSiS_VideoSenseData2 = &SiS310_VideoSenseData2;
- pSiS_YCSenseData2 = &SiS310_YCSenseData2;
- SiS_NTSCPhase = SiS310_NTSCPhase;
- SiS_PALPhase = SiS310_PALPhase;
- SiS_NTSCPhase2 = SiS310_NTSCPhase2;
- SiS_PALPhase2 = SiS310_PALPhase2;
- SiS_PALMPhase = SiS310_PALMPhase; /*add for PALMN */
- SiS_PALNPhase = SiS310_PALNPhase;
- SiS_StLCD1024x768Data = (SiS_LCDDataStruct *) SiS310_StLCD1024x768Data;
- SiS_ExtLCD1024x768Data =
- (SiS_LCDDataStruct *) SiS310_ExtLCD1024x768Data;
- SiS_St2LCD1024x768Data =
- (SiS_LCDDataStruct *) SiS310_St2LCD1024x768Data;
- SiS_StLCD1280x1024Data =
- (SiS_LCDDataStruct *) SiS310_StLCD1280x1024Data;
- SiS_ExtLCD1280x1024Data =
- (SiS_LCDDataStruct *) SiS310_ExtLCD1280x1024Data;
- SiS_St2LCD1280x1024Data =
- (SiS_LCDDataStruct *) SiS310_St2LCD1280x1024Data;
- SiS_NoScaleData = (SiS_LCDDataStruct *) SiS310_NoScaleData;
- SiS_LCD1280x960Data = (SiS_LCDDataStruct *) SiS310_LCD1280x960Data;
- SiS_StPALData = (SiS_TVDataStruct *) SiS310_StPALData;
- SiS_ExtPALData = (SiS_TVDataStruct *) SiS310_ExtPALData;
- SiS_StNTSCData = (SiS_TVDataStruct *) SiS310_StNTSCData;
- SiS_ExtNTSCData = (SiS_TVDataStruct *) SiS310_ExtNTSCData;
- SiS_St1HiTVData = (SiS_TVDataStruct *) SiS310_St1HiTVData;
- SiS_St2HiTVData = (SiS_TVDataStruct *) SiS310_St2HiTVData;
- SiS_ExtHiTVData = (SiS_TVDataStruct *) SiS310_ExtHiTVData;
- SiS_NTSCTiming = SiS310_NTSCTiming;
- SiS_PALTiming = SiS310_PALTiming;
- SiS_HiTVSt1Timing = SiS310_HiTVSt1Timing;
- SiS_HiTVSt2Timing = SiS310_HiTVSt2Timing;
- SiS_HiTVTextTiming = SiS310_HiTVTextTiming;
- SiS_HiTVGroup3Data = SiS310_HiTVGroup3Data;
- SiS_HiTVGroup3Simu = SiS310_HiTVGroup3Simu;
- SiS_HiTVGroup3Text = SiS310_HiTVGroup3Text;
- SiS_PanelDelayTbl = (SiS_PanelDelayTblStruct *) SiS310_PanelDelayTbl;
- SiS_LVDS800x600Data_1 = (SiS_LVDSDataStruct *) SiS310_LVDS800x600Data_1;
- SiS_LVDS800x600Data_2 = (SiS_LVDSDataStruct *) SiS310_LVDS800x600Data_2;
- SiS_LVDS1024x768Data_1 =
- (SiS_LVDSDataStruct *) SiS310_LVDS1024x768Data_1;
- SiS_LVDS1024x768Data_2 =
- (SiS_LVDSDataStruct *) SiS310_LVDS1024x768Data_2;
- SiS_LVDS1280x1024Data_1 =
- (SiS_LVDSDataStruct *) SiS310_LVDS1280x1024Data_1;
- SiS_LVDS1280x1024Data_2 =
- (SiS_LVDSDataStruct *) SiS310_LVDS1280x1024Data_2;
- SiS_LVDS640x480Data_1 = (SiS_LVDSDataStruct *) SiS310_LVDS640x480Data_1;
- SiS_CHTVUNTSCData = (SiS_LVDSDataStruct *) SiS310_CHTVUNTSCData;
- SiS_CHTVONTSCData = (SiS_LVDSDataStruct *) SiS310_CHTVONTSCData;
- SiS_CHTVUPALData = (SiS_LVDSDataStruct *) SiS310_CHTVUPALData;
- SiS_CHTVOPALData = (SiS_LVDSDataStruct *) SiS310_CHTVOPALData;
- SiS_PanelType00_1 = (SiS_LVDSDesStruct *) SiS310_PanelType00_1;
- SiS_PanelType01_1 = (SiS_LVDSDesStruct *) SiS310_PanelType01_1;
- SiS_PanelType02_1 = (SiS_LVDSDesStruct *) SiS310_PanelType02_1;
- SiS_PanelType03_1 = (SiS_LVDSDesStruct *) SiS310_PanelType03_1;
- SiS_PanelType04_1 = (SiS_LVDSDesStruct *) SiS310_PanelType04_1;
- SiS_PanelType05_1 = (SiS_LVDSDesStruct *) SiS310_PanelType05_1;
- SiS_PanelType06_1 = (SiS_LVDSDesStruct *) SiS310_PanelType06_1;
- SiS_PanelType07_1 = (SiS_LVDSDesStruct *) SiS310_PanelType07_1;
- SiS_PanelType08_1 = (SiS_LVDSDesStruct *) SiS310_PanelType08_1;
- SiS_PanelType09_1 = (SiS_LVDSDesStruct *) SiS310_PanelType09_1;
- SiS_PanelType0a_1 = (SiS_LVDSDesStruct *) SiS310_PanelType0a_1;
- SiS_PanelType0b_1 = (SiS_LVDSDesStruct *) SiS310_PanelType0b_1;
- SiS_PanelType0c_1 = (SiS_LVDSDesStruct *) SiS310_PanelType0c_1;
- SiS_PanelType0d_1 = (SiS_LVDSDesStruct *) SiS310_PanelType0d_1;
- SiS_PanelType0e_1 = (SiS_LVDSDesStruct *) SiS310_PanelType0e_1;
- SiS_PanelType0f_1 = (SiS_LVDSDesStruct *) SiS310_PanelType0f_1;
- SiS_PanelType00_2 = (SiS_LVDSDesStruct *) SiS310_PanelType00_2;
- SiS_PanelType01_2 = (SiS_LVDSDesStruct *) SiS310_PanelType01_2;
- SiS_PanelType02_2 = (SiS_LVDSDesStruct *) SiS310_PanelType02_2;
- SiS_PanelType03_2 = (SiS_LVDSDesStruct *) SiS310_PanelType03_2;
- SiS_PanelType04_2 = (SiS_LVDSDesStruct *) SiS310_PanelType04_2;
- SiS_PanelType05_2 = (SiS_LVDSDesStruct *) SiS310_PanelType05_2;
- SiS_PanelType06_2 = (SiS_LVDSDesStruct *) SiS310_PanelType06_2;
- SiS_PanelType07_2 = (SiS_LVDSDesStruct *) SiS310_PanelType07_2;
- SiS_PanelType08_2 = (SiS_LVDSDesStruct *) SiS310_PanelType08_2;
- SiS_PanelType09_2 = (SiS_LVDSDesStruct *) SiS310_PanelType09_2;
- SiS_PanelType0a_2 = (SiS_LVDSDesStruct *) SiS310_PanelType0a_2;
- SiS_PanelType0b_2 = (SiS_LVDSDesStruct *) SiS310_PanelType0b_2;
- SiS_PanelType0c_2 = (SiS_LVDSDesStruct *) SiS310_PanelType0c_2;
- SiS_PanelType0d_2 = (SiS_LVDSDesStruct *) SiS310_PanelType0d_2;
- SiS_PanelType0e_2 = (SiS_LVDSDesStruct *) SiS310_PanelType0e_2;
- SiS_PanelType0f_2 = (SiS_LVDSDesStruct *) SiS310_PanelType0f_2;
- /*301b */
- LVDS1024x768Des_1 = (SiS_LVDSDesStruct *) SiS310_PanelType1076_1;
- LVDS1280x1024Des_1 = (SiS_LVDSDesStruct *) SiS310_PanelType1210_1;
- LVDS1280x960Des_1 = (SiS_LVDSDesStruct *) SiS310_PanelType1296_1;
- LVDS1024x768Des_2 = (SiS_LVDSDesStruct *) SiS310_PanelType1076_2;
- LVDS1280x1024Des_2 = (SiS_LVDSDesStruct *) SiS310_PanelType1210_2;
- LVDS1280x960Des_2 = (SiS_LVDSDesStruct *) SiS310_PanelType1296_2;
- /*end 301b */
- SiS_CHTVUNTSCDesData = (SiS_LVDSDesStruct *) SiS310_CHTVUNTSCDesData;
- SiS_CHTVONTSCDesData = (SiS_LVDSDesStruct *) SiS310_CHTVONTSCDesData;
- SiS_CHTVUPALDesData = (SiS_LVDSDesStruct *) SiS310_CHTVUPALDesData;
- SiS_CHTVOPALDesData = (SiS_LVDSDesStruct *) SiS310_CHTVOPALDesData;
- SiS_LVDSCRT1800x600_1 =
- (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT1800x600_1;
- SiS_LVDSCRT11024x768_1 =
- (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT11024x768_1;
- SiS_LVDSCRT11280x1024_1 =
- (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT11280x1024_1;
- SiS_LVDSCRT1800x600_1_H =
- (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT1800x600_1_H;
- SiS_LVDSCRT11024x768_1_H =
- (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT11024x768_1_H;
- SiS_LVDSCRT11280x1024_1_H =
- (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT11280x1024_1_H;
- SiS_LVDSCRT1800x600_2 =
- (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT1800x600_2;
- SiS_LVDSCRT11024x768_2 =
- (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT11024x768_2;
- SiS_LVDSCRT11280x1024_2 =
- (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT11280x1024_2;
- SiS_LVDSCRT1800x600_2_H =
- (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT1800x600_2_H;
- SiS_LVDSCRT11024x768_2_H =
- (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT11024x768_2_H;
- SiS_LVDSCRT11280x1024_2_H =
- (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT11280x1024_2_H;
- SiS_CHTVCRT1UNTSC = (SiS_LVDSCRT1DataStruct *) SiS310_CHTVCRT1UNTSC;
- SiS_CHTVCRT1ONTSC = (SiS_LVDSCRT1DataStruct *) SiS310_CHTVCRT1ONTSC;
- SiS_CHTVCRT1UPAL = (SiS_LVDSCRT1DataStruct *) SiS310_CHTVCRT1UPAL;
- SiS_CHTVCRT1OPAL = (SiS_LVDSCRT1DataStruct *) SiS310_CHTVCRT1OPAL;
- SiS_CHTVReg_UNTSC = (SiS_CHTVRegDataStruct *) SiS310_CHTVReg_UNTSC;
- SiS_CHTVReg_ONTSC = (SiS_CHTVRegDataStruct *) SiS310_CHTVReg_ONTSC;
- SiS_CHTVReg_UPAL = (SiS_CHTVRegDataStruct *) SiS310_CHTVReg_UPAL;
- SiS_CHTVReg_OPAL = (SiS_CHTVRegDataStruct *) SiS310_CHTVReg_OPAL;
- /*add for LCDA */
- SiS_LCDACRT1800x600_1 =
- (SiS_LCDACRT1DataStruct *) SiS310_LCDACRT1800x600_1;
- SiS_LCDACRT11024x768_1 =
- (SiS_LCDACRT1DataStruct *) SiS310_LCDACRT11024x768_1;
- SiS_LCDACRT11280x1024_1 =
- (SiS_LCDACRT1DataStruct *) SiS310_LCDACRT11280x1024_1;
- SiS_LCDACRT1800x600_1_H =
- (SiS_LCDACRT1DataStruct *) SiS310_LCDACRT1800x600_1_H;
- SiS_LCDACRT11024x768_1_H =
- (SiS_LCDACRT1DataStruct *) SiS310_LCDACRT11024x768_1_H;
- SiS_LCDACRT11280x1024_1_H =
- (SiS_LCDACRT1DataStruct *) SiS310_LCDACRT11280x1024_1_H;
- SiS_LCDACRT1800x600_2 =
- (SiS_LCDACRT1DataStruct *) SiS310_LCDACRT1800x600_2;
- SiS_LCDACRT11024x768_2 =
- (SiS_LCDACRT1DataStruct *) SiS310_LCDACRT11024x768_2;
- SiS_LCDACRT11280x1024_2 =
- (SiS_LCDACRT1DataStruct *) SiS310_LCDACRT11280x1024_2;
- SiS_LCDACRT1800x600_2_H =
- (SiS_LCDACRT1DataStruct *) SiS310_LCDACRT1800x600_2_H;
- SiS_LCDACRT11024x768_2_H =
- (SiS_LCDACRT1DataStruct *) SiS310_LCDACRT11024x768_2_H;
- SiS_LCDACRT11280x1024_2_H =
- (SiS_LCDACRT1DataStruct *) SiS310_LCDACRT11280x1024_2_H;
- /*end for 301b */
- SiS_CHTVVCLKUNTSC = SiS310_CHTVVCLKUNTSC;
- SiS_CHTVVCLKONTSC = SiS310_CHTVVCLKONTSC;
- SiS_CHTVVCLKUPAL = SiS310_CHTVVCLKUPAL;
- SiS_CHTVVCLKOPAL = SiS310_CHTVVCLKOPAL;
- /* 310 customization related */
- }
- #endif
- BOOLEAN
- SiSInit (PSIS_HW_DEVICE_INFO HwDeviceExtension)
- {
- ULONG ROMAddr = (ULONG) HwDeviceExtension->pjVirtualRomBase;
- ULONG FBAddr = (ULONG) HwDeviceExtension->pjVideoMemoryAddress;
- USHORT BaseAddr = (USHORT) HwDeviceExtension->ulIOAddress;
- UCHAR i, temp = 0;
- UCHAR SR11, temp1;
- ULONG base;
- UCHAR SR12 = 0, SR13 = 0, SR14 = 0, SR16 = 0, SR17 = 0, SR18 = 0, SR19 =
- 0, SR1A = 0;
- #ifdef CONFIG_FB_SIS_315
- /* ULONG j, k; */
- UCHAR CR39 = 0, CR3A = 0, CR3B = 0, CR3C = 0, CR3D = 0, CR3E = 0, CR3F =
- 0;
- UCHAR CR79 = 0, CR7A = 0, CR7B = 0, CR7C = 0;
- PSIS_DSReg pSR;
- ULONG Temp;
- #endif
- UCHAR VBIOSVersion[5];
- /* if(ROMAddr==0) return (FALSE);*/
- if (FBAddr == 0)
- return (FALSE);
- if (BaseAddr == 0)
- return (FALSE);
- SiS_SetReg3 ((USHORT) (BaseAddr + 0x12), 0x67); /* 3c2 <- 67 ,ynlai */
- #ifdef CONFIG_FB_SIS_315
- /*if(HwDeviceExtension->jChipType > SIS_315H) */
- if (HwDeviceExtension->jChipType > SIS_315PRO) {
- if (!HwDeviceExtension->bIntegratedMMEnabled)
- return (FALSE); /* alan */
- }
- #endif
- SiS_MemoryCopy (VBIOSVersion, HwDeviceExtension->szVBIOSVer, 4);
- VBIOSVersion[4] = 0x0;
- /* 09/07/99 modify by domao */
- #ifdef CONFIG_FB_SIS_315
- if ((HwDeviceExtension->jChipType == SIS_315H) ||
- (HwDeviceExtension->jChipType == SIS_315PRO) ||
- (HwDeviceExtension->jChipType == SIS_550) || /* 05/02/01 ynlai for 550 */
- (HwDeviceExtension->jChipType == SIS_640) || /* 08/20/01 chiawen for 640/740 */
- (HwDeviceExtension->jChipType == SIS_740)) /* 09/03/01 chiawen for 650 */
- InitTo310Pointer ();
- #endif
- #ifdef CONFIG_FB_SIS_300
- if ((HwDeviceExtension->jChipType == SIS_540) ||
- (HwDeviceExtension->jChipType == SIS_630) ||
- (HwDeviceExtension->jChipType == SIS_730) ||
- (HwDeviceExtension->jChipType == SIS_300))
- InitTo300Pointer ();
- #endif
- SiS_P3c4 = BaseAddr + 0x14;
- SiS_P3d4 = BaseAddr + 0x24;
- SiS_P3c0 = BaseAddr + 0x10;
- SiS_P3ce = BaseAddr + 0x1e;
- SiS_P3c2 = BaseAddr + 0x12;
- SiS_P3ca = BaseAddr + 0x1a;
- SiS_P3c6 = BaseAddr + 0x16;
- SiS_P3c7 = BaseAddr + 0x17;
- SiS_P3c8 = BaseAddr + 0x18;
- SiS_P3c9 = BaseAddr + 0x19;
- SiS_P3da = BaseAddr + 0x2A;
- SiS_Part1Port = BaseAddr + SIS_CRT2_PORT_04;
- SiS_Part2Port = BaseAddr + SIS_CRT2_PORT_10;
- SiS_Part3Port = BaseAddr + SIS_CRT2_PORT_12;
- SiS_Part4Port = BaseAddr + SIS_CRT2_PORT_14;
- SiS_Part5Port = BaseAddr + SIS_CRT2_PORT_14 + 2;
- SiS_Set_LVDS_TRUMPION (HwDeviceExtension); /*2/29/00 by Mars Wen for LVDS and Trumpion */
- SiS_SetReg1 (SiS_P3c4, 0x05, 0x86); /* 1.Openkey */
- #ifdef LINUX_KERNEL
- #ifdef CONFIG_FB_SIS_300 /* add to set SR14 */
- if ((HwDeviceExtension->jChipType == SIS_540) ||
- (HwDeviceExtension->jChipType == SIS_630) ||
- (HwDeviceExtension->jChipType == SIS_730)) {
- base = 0x80000060;
- OutPortLong (base, 0xcf8);
- temp1 = InPortLong (0xcfc);
- temp1 = temp1 >> (16 + 8 + 4);
- temp1 = temp1 & (0x07);
- temp1 = temp1 + 1;
- temp1 = 1 << temp1;
- SR14 = temp1 - 1;
- base = 0x80000064;
- OutPortLong (base, 0xcf8);
- temp1 = InPortLong (0xcfc);
- temp1 = temp1 & (0x00000020);
- if (temp1)
- SR14 = (0x10000000) | SR14;
- else
- SR14 = (0x01000000) | SR14;
- }
- #endif
- #ifdef CONFIG_FB_SIS_315 /* add to set SR14 */
- if ((HwDeviceExtension->jChipType == SIS_550)) {
- base = 0x80000060;
- OutPortLong (base, 0xcf8);
- temp1 = InPortLong (0xcfc);
- temp1 = temp1 >> (16 + 8 + 4);
- temp1 = temp1 & (0x07);
- temp1 = temp1 + 1;
- temp1 = 1 << temp1;
- SR14 = temp1 - 1;
- base = 0x80000064;
- OutPortLong (base, 0xcf8);
- temp1 = InPortLong (0xcfc);
- temp1 = temp1 & (0x00000020);
- if (temp1)
- SR14 = (0x10000000) | SR14;
- else
- SR14 = (0x01000000) | SR14;
- }
- if ((HwDeviceExtension->jChipType == SIS_640)
- || (HwDeviceExtension->jChipType == SIS_740)) {
- base = 0x80000064;
- OutPortLong (base, 0xcf8);
- temp1 = InPortLong (0xcfc);
- temp1 = temp >> 4;
- temp1 = 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 = temp1 & (0x00000020);
- if (temp1)
- SR14 = (0x10000000) | SR14;
- }
- #endif
- #endif
- #ifdef CONFIG_FB_SIS_300
- if ((HwDeviceExtension->jChipType == SIS_540) ||
- (HwDeviceExtension->jChipType == SIS_630) ||
- (HwDeviceExtension->jChipType == SIS_730)) {
- SR12 = (UCHAR) SiS_GetReg1 (SiS_P3c4, 0x12);
- SR13 = (UCHAR) SiS_GetReg1 (SiS_P3c4, 0x13);
- SR14 = (UCHAR) SiS_GetReg1 (SiS_P3c4, 0x14);
- SR16 = (UCHAR) SiS_GetReg1 (SiS_P3c4, 0x16);
- SR17 = (UCHAR) SiS_GetReg1 (SiS_P3c4, 0x17);
- SR18 = (UCHAR) SiS_GetReg1 (SiS_P3c4, 0x18);
- SR19 = (UCHAR) SiS_GetReg1 (SiS_P3c4, 0x19);
- SR1A = (UCHAR) SiS_GetReg1 (SiS_P3c4, 0x1A);
- } else {
- SR13 = (UCHAR) SiS_GetReg1 (SiS_P3c4, 0x13);
- SR14 = (UCHAR) SiS_GetReg1 (SiS_P3c4, 0x14);
- }
- #endif
- #ifdef CONFIG_FB_SIS_315
- if ((HwDeviceExtension->jChipType == SIS_550)) {
- CR39 = (UCHAR) SiS_GetReg1 (SiS_P3d4, 0x39);
- CR3A = (UCHAR) SiS_GetReg1 (SiS_P3d4, 0x3A);
- CR3B = (UCHAR) SiS_GetReg1 (SiS_P3d4, 0x3B);
- CR3C = (UCHAR) SiS_GetReg1 (SiS_P3d4, 0x3C);
- CR3D = (UCHAR) SiS_GetReg1 (SiS_P3d4, 0x3D);
- CR3E = (UCHAR) SiS_GetReg1 (SiS_P3d4, 0x3E);
- CR3F = (UCHAR) SiS_GetReg1 (SiS_P3d4, 0x3F);
- CR79 = (UCHAR) SiS_GetReg1 (SiS_P3d4, 0x79);
- CR7A = (UCHAR) SiS_GetReg1 (SiS_P3d4, 0x7A);
- CR7B = (UCHAR) SiS_GetReg1 (SiS_P3d4, 0x7B);
- CR7C = (UCHAR) SiS_GetReg1 (SiS_P3d4, 0x7C);
- } else if ((HwDeviceExtension->jChipType == SIS_640) || /* 08/20/01 chiawen for 640/740 */
- (HwDeviceExtension->jChipType == SIS_740)) {
- SR12 = (UCHAR) SiS_GetReg1 (SiS_P3c4, 0x12);
- SR13 = (UCHAR) SiS_GetReg1 (SiS_P3c4, 0x13);
- SR14 = (UCHAR) SiS_GetReg1 (SiS_P3c4, 0x14);
- SR16 = (UCHAR) SiS_GetReg1 (SiS_P3c4, 0x16);
- SR17 = (UCHAR) SiS_GetReg1 (SiS_P3c4, 0x17);
- SR18 = (UCHAR) SiS_GetReg1 (SiS_P3c4, 0x18);
- SR19 = (UCHAR) SiS_GetReg1 (SiS_P3c4, 0x19);
- SR1A = (UCHAR) SiS_GetReg1 (SiS_P3c4, 0x1A);
- }
- #endif
- /* ResetExtReg begin */
- for (i = 0x06; i < 0x20; i++)
- SiS_SetReg1 (SiS_P3c4, i, 0); /* 2.Reset Extended register */
- for (i = 0x21; i <= 0x27; i++)
- SiS_SetReg1 (SiS_P3c4, i, 0); /* Reset Extended register */
- for (i = 0x31; i <= 0x3D; i++)
- SiS_SetReg1 (SiS_P3c4, i, 0);
- #ifdef CONFIG_FB_SIS_300H
- for (i = 0x38; i <= 0x3F; i++)
- SiS_SetReg1 (SiS_P3d4, i, 0);
- #endif
- #ifdef CONFIG_FB_SIS_315
- for (i = 0x37; i <= 0x3F; i++)
- SiS_SetReg1 (SiS_P3d4, i, 0);
- for (i = 0x79; i <= 0x7C; i++)
- SiS_SetReg1 (SiS_P3d4, i, 0);
- #endif
- /* ResetExtReg end */
- #ifdef CONFIG_FB_SIS_300
- if ((HwDeviceExtension->jChipType == SIS_540) ||
- (HwDeviceExtension->jChipType == SIS_630) ||
- (HwDeviceExtension->jChipType == SIS_730)) {
- SiS_SetReg1 (SiS_P3c4, 0x12, SR12);
- SiS_SetReg1 (SiS_P3c4, 0x13, SR13);
- SiS_SetReg1 (SiS_P3c4, 0x14, SR14);
- SiS_SetReg1 (SiS_P3c4, 0x16, SR16);
- SiS_SetReg1 (SiS_P3c4, 0x17, SR17);
- SiS_SetReg1 (SiS_P3c4, 0x18, SR18);
- SiS_SetReg1 (SiS_P3c4, 0x19, SR19);
- SiS_SetReg1 (SiS_P3c4, 0x1A, SR1A);
- }
- #endif
- #ifdef CONFIG_FB_SIS_315
- if ((HwDeviceExtension->jChipType == SIS_550)) {
- SiS_SetReg1 (SiS_P3d4, 0x39, CR39);
- SiS_SetReg1 (SiS_P3d4, 0x3A, CR3A);
- SiS_SetReg1 (SiS_P3d4, 0x3B, CR3B);
- SiS_SetReg1 (SiS_P3d4, 0x3C, CR3C);
- SiS_SetReg1 (SiS_P3d4, 0x3D, CR3D);
- SiS_SetReg1 (SiS_P3d4, 0x3E, CR3E);
- SiS_SetReg1 (SiS_P3d4, 0x3F, CR3F);
- SiS_SetReg1 (SiS_P3d4, 0x79, CR79);
- SiS_SetReg1 (SiS_P3d4, 0x7A, CR7A);
- SiS_SetReg1 (SiS_P3d4, 0x7B, CR7B);
- SiS_SetReg1 (SiS_P3d4, 0x7C, CR7C);
- } else if ((HwDeviceExtension->jChipType == SIS_640) || /* 08/20/01 chiawen for 640/740 */
- (HwDeviceExtension->jChipType == SIS_740)) {
- SiS_SetReg1 (SiS_P3c4, 0x12, SR12);
- SiS_SetReg1 (SiS_P3c4, 0x13, SR13);
- SiS_SetReg1 (SiS_P3c4, 0x14, SR14);
- SiS_SetReg1 (SiS_P3c4, 0x16, SR16);
- SiS_SetReg1 (SiS_P3c4, 0x17, SR17);
- SiS_SetReg1 (SiS_P3c4, 0x18, SR18);
- SiS_SetReg1 (SiS_P3c4, 0x19, SR19);
- SiS_SetReg1 (SiS_P3c4, 0x1A, SR1A);
- }
- #endif
- /* detect ExtChip Type */
- SiS_Set_LVDS_TRUMPION (HwDeviceExtension); /*2/29/00 by Mars Wen for LVDS and Trumpion */
- #ifdef CONFIG_FB_SIS_300
- if ((HwDeviceExtension->jChipType == SIS_540) ||
- (HwDeviceExtension->jChipType == SIS_630) ||
- (HwDeviceExtension->jChipType == SIS_730)) {
- temp = (UCHAR) SR1A;
- } else
- #endif
- {
- if ((*pSiS_SoftSetting & SoftDRAMType) == 0) {
- temp = (UCHAR) SiS_GetReg1 (SiS_P3c4, 0x3A);
- }
- }
- SiS_RAMType = temp & 0x03;
- SiS_SetMemoryClock (ROMAddr);
- /* SetDefExt1Regs begin */
- SiS_SetReg1 (SiS_P3c4, 0x07, *pSiS_SR07);
- if ((HwDeviceExtension->jChipType != SIS_540) &&
- (HwDeviceExtension->jChipType != SIS_630) &&
- (HwDeviceExtension->jChipType != SIS_730)) {
- for (i = 0x15; i < 0x1C; i++) {
- SiS_SetReg1 (SiS_P3c4, i,
- SiS_SR15[i - 0x15][SiS_RAMType]);
- }
- }
- #ifdef CONFIG_FB_SIS_315
- if ((HwDeviceExtension->jChipType == SIS_315H) ||
- (HwDeviceExtension->jChipType == SIS_315PRO)) {
- for (i = 0x40; i <= 0x44; i++) {
- SiS_SetReg1 (SiS_P3d4, i,
- SiS_CR40[i - 0x40][SiS_RAMType]);
- }
- SiS_SetReg1 (SiS_P3d4, 0x48, 0x23);
- SiS_SetReg1 (SiS_P3d4, 0x49, SiS_CR49[0]);
- /* /SiS_SetReg1(SiS_P3c4,0x25,SiS_SR25[0]); */
- }
- #endif
- SiS_SetReg1 (SiS_P3c4, 0x1F, *pSiS_SR1F);
- /*SiS_SetReg1(SiS_P3c4,0x20,0x20); */
- SiS_SetReg1 (SiS_P3c4, 0x20, 0xA0); /* alan, 2001/6/26 Frame buffer can read/write */
- SiS_SetReg1 (SiS_P3c4, 0x23, *pSiS_SR23);
- SiS_SetReg1 (SiS_P3c4, 0x24, *pSiS_SR24);
- SiS_SetReg1 (SiS_P3c4, 0x25, SiS_SR25[0]);
- #ifdef CONFIG_FB_SIS_300
- if (HwDeviceExtension->jChipType == SIS_300) {
- SiS_SetReg1 (SiS_P3c4, 0x21, 0x84);
- SiS_SetReg1 (SiS_P3c4, 0x22, 0x00);
- }
- #endif
- SR11 = 0x0F;
- SiS_SetReg1 (SiS_P3c4, 0x11, SR11);
- SiS_UnLockCRT2 (HwDeviceExtension, BaseAddr);
- SiS_SetReg1 (SiS_Part1Port, 0x00, 0x00);
- SiS_SetReg1 (SiS_Part1Port, 0x02, *pSiS_CRT2Data_1_2);
- #ifdef CONFIG_FB_SIS_315 /* 05/02/01 ynlai for sis550 */
- if ((HwDeviceExtension->jChipType == SIS_315H) ||
- (HwDeviceExtension->jChipType == SIS_315PRO) ||
- (HwDeviceExtension->jChipType == SIS_550) ||
- (HwDeviceExtension->jChipType == SIS_640) || /* 08/20/01 chiawen for 640/740 */
- (HwDeviceExtension->jChipType == SIS_740))
- /* 09/03/01 chiawen for 650 */
- SiS_SetReg1 (SiS_Part1Port, 0x2E, 0x08); /* use VB */
- #endif
- temp = *pSiS_SR32;
- if (SiS_BridgeIsOn (BaseAddr)) {
- temp = temp & 0xEF;
- }
- SiS_SetReg1 (SiS_P3c4, 0x32, temp);
- #ifdef CONFIG_FB_SIS_315
- if ((HwDeviceExtension->jChipType == SIS_315H) ||
- (HwDeviceExtension->jChipType == SIS_315PRO)) {
- HwDeviceExtension->pQueryVGAConfigSpace (HwDeviceExtension,
- 0x50, 0, &Temp); /* Get */
- Temp >>= 20;
- Temp &= 0xF;
- if (Temp != 1) {
- SiS_SetReg1 (SiS_P3c4, 0x25, SiS_SR25[1]);
- SiS_SetReg1 (SiS_P3d4, 0x49, SiS_CR49[1]);
- }
- SiS_SetReg1 (SiS_P3c4, 0x27, 0x1F);
- SiS_SetReg1 (SiS_P3c4, 0x31, *pSiS_SR31);
- SiS_SetReg1 (SiS_P3c4, 0x32, *pSiS_SR32);
- SiS_SetReg1 (SiS_P3c4, 0x33, *pSiS_SR33);
- }
- #endif
- if (SiS_BridgeIsOn (BaseAddr) == 1) {
- if (SiS_IF_DEF_LVDS == 0) {
- SiS_SetReg1 (SiS_Part2Port, 0x00, 0x1C);
- SiS_SetReg1 (SiS_Part4Port, 0x0D, *pSiS_CRT2Data_4_D);
- SiS_SetReg1 (SiS_Part4Port, 0x0E, *pSiS_CRT2Data_4_E);
- SiS_SetReg1 (SiS_Part4Port, 0x10, *pSiS_CRT2Data_4_10);
- SiS_SetReg1 (SiS_Part4Port, 0x0F, 0x3F);
- }
- SiS_LockCRT2 (HwDeviceExtension, BaseAddr);
- }
- SiS_SetReg1 (SiS_P3d4, 0x83, 0x00);
- /* SetDefExt1Regs end */
- #ifdef CONFIG_FB_SIS_315
- if ((HwDeviceExtension->jChipType == SIS_315H) ||
- (HwDeviceExtension->jChipType == SIS_315PRO)
- ) { /* 05/02/01 ynlai */
- /* For SiS 300,310 Chip */
- if (HwDeviceExtension->bSkipDramSizing == TRUE) {
- SiS_SetDRAMModeRegister (ROMAddr);
- pSR = HwDeviceExtension->pSR;
- if (pSR != NULL) {
- while (pSR->jIdx != 0xFF) {
- SiS_SetReg1 (SiS_P3c4, pSR->jIdx,
- pSR->jVal);
- pSR++;
- }
- }
- } else
- SiS_SetDRAMSize_310 (HwDeviceExtension);
- }
- #endif
- #ifdef CONFIG_FB_SIS_315
- if ((HwDeviceExtension->jChipType == SIS_550)) { /* 05/02/01 ynlai For SiS 550 */
- /* SetDRAMConfig begin */
- /* SiS_SetReg1(SiS_P3c4,0x12,SR12);
- SiS_SetReg1(SiS_P3c4,0x13,SR13);
- SiS_SetReg1(SiS_P3c4,0x14,SR14);
- SiS_SetReg1(SiS_P3c4,0x16,SR16);
- SiS_SetReg1(SiS_P3c4,0x17,SR17);
- SiS_SetReg1(SiS_P3c4,0x18,SR18);
- SiS_SetReg1(SiS_P3c4,0x19,SR19);
- SiS_SetReg1(SiS_P3c4,0x1A,SR1A); */
- /* SetDRAMConfig end */
- }
- #endif
- #ifdef CONFIG_FB_SIS_300
- if (HwDeviceExtension->jChipType == SIS_300) { /* For SiS 300 Chip */
- if (HwDeviceExtension->bSkipDramSizing == TRUE) {
- /* SiS_SetDRAMModeRegister(ROMAddr);
- temp = (HwDeviceExtension->pSR)->jVal;
- SiS_SetReg1(SiS_P3c4,0x13,temp);
- temp = (HwDeviceExtension->pSR)->jVal;
- SiS_SetReg1(SiS_P3c4,0x14,temp); */
- } else {
- #ifdef TC
- SiS_SetReg1 (SiS_P3c4, 0x13, SR13);
- SiS_SetReg1 (SiS_P3c4, 0x14, SR14);
- SiS_SetRegANDOR (SiS_P3c4, 0x15, 0xFF, 0x04);
- #else
- SiS_SetDRAMSize_300 (HwDeviceExtension);
- SiS_SetDRAMSize_300 (HwDeviceExtension);
- #endif
- }
- }
- if ((HwDeviceExtension->jChipType == SIS_540) || /* For SiS 630/540/730 Chip */
- (HwDeviceExtension->jChipType == SIS_630) ||
- (HwDeviceExtension->jChipType == SIS_730)) {
- /* SetDRAMConfig begin */
- /* SiS_SetReg1(SiS_P3c4,0x12,SR12);
- SiS_SetReg1(SiS_P3c4,0x13,SR13);
- SiS_SetReg1(SiS_P3c4,0x14,SR14);
- SiS_SetReg1(SiS_P3c4,0x16,SR16);
- SiS_SetReg1(SiS_P3c4,0x17,SR17);
- SiS_SetReg1(SiS_P3c4,0x18,SR18);
- SiS_SetReg1(SiS_P3c4,0x19,SR19);
- SiS_SetReg1(SiS_P3c4,0x1A,SR1A); */
- /* SetDRAMConfig end */
- }
- /* SetDRAMSize end */
- #endif
- /* SetDefExt2Regs begin */
- /* AGP=1;
- temp=(UCHAR)SiS_GetReg1(SiS_P3c4,0x3A);
- temp=temp&0x30;
- if(temp==0x30) AGP=0;
- if(AGP==0) *pSiS_SR21=*pSiS_SR21&0xEF;
- SiS_SetReg1(SiS_P3c4,0x21,*pSiS_SR21);
- if(AGP==1) *pSiS_SR22=*pSiS_SR22&0x20;
- SiS_SetReg1(SiS_P3c4,0x22,*pSiS_SR22); */
- SiS_SetReg1 (SiS_P3c4, 0x21, *pSiS_SR21);
- SiS_SetReg1 (SiS_P3c4, 0x22, *pSiS_SR22);
- /* SetDefExt2Regs end */
- /* SiS_SetReg3(SiS_P3c6,0xff);
- SiS_ClearDAC(SiS_P3c8); [ynlai] 05/22/01 */
- SiS_DetectMonitor (HwDeviceExtension, BaseAddr);
- SiS_GetSenseStatus (HwDeviceExtension, ROMAddr); /* sense CRT2 */
- return (TRUE);
- }
- void
- SiS_Set_LVDS_TRUMPION (PSIS_HW_DEVICE_INFO HwDeviceExtension)
- {
- USHORT temp;
- #ifdef CONFIG_FB_SIS_300
- if ((HwDeviceExtension->jChipType == SIS_540) ||
- (HwDeviceExtension->jChipType == SIS_630) ||
- (HwDeviceExtension->jChipType == SIS_730)) {
- temp = (UCHAR) SiS_GetReg1 (SiS_P3c4, 0x1A);
- temp = (temp & 0xE0) >> 4;
- SiS_SetRegANDOR (SiS_P3d4, 0x37, 0xF1, temp);
- temp = temp >> 1;
- if ((temp == 0) || (temp == 1)) { /* for 301 */
- SiS_IF_DEF_LVDS = 0;
- SiS_IF_DEF_CH7005 = 0;
- SiS_IF_DEF_TRUMPION = 0;
- }
- if ((temp >= 2) && (temp <= 5)) {
- SiS_IF_DEF_LVDS = 1;
- }
- if (temp == 3)
- SiS_IF_DEF_TRUMPION = 1;
- if ((temp == 4) || (temp == 5))
- SiS_IF_DEF_CH7005 = 1;
- } else {
- SiS_IF_DEF_LVDS = 0;
- SiS_IF_DEF_TRUMPION = 0;
- SiS_IF_DEF_CH7005 = 0;
- }
- #else
- if ((HwDeviceExtension->jChipType == SIS_550) ||
- (HwDeviceExtension->jChipType == SIS_640) || /* 08/20/01 chiawen for 640/740 */
- (HwDeviceExtension->jChipType == SIS_740))
- { /* 09/03/01 chiawen for 650 */
- SiS_IF_DEF_LVDS = 0;
- SiS_IF_DEF_TRUMPION = 0;
- SiS_IF_DEF_CH7005 = 0;
- }
- #endif
- }
- /* =============== for 300 dram sizing begin =============== */
- #ifdef CONFIG_FB_SIS_300
- void
- SiS_SetDRAMSize_300 (PSIS_HW_DEVICE_INFO HwDeviceExtension)
- {
- /*ULONG ROMAddr = (ULONG)HwDeviceExtension->pjVirtualRomBase; */
- ULONG FBAddr = (ULONG) HwDeviceExtension->pjVideoMemoryAddress;
- /*USHORT BaseAddr = (USHORT)HwDeviceExtension->ulIOAddress; */
- 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,PhysicalAdrAnotherPage; */
- int PageCapacity, PhysicalAdrHigh, PhysicalAdrHalfPage;
- SiSSetMode (HwDeviceExtension, 0x2e);
- data = SiS_GetReg1 (SiS_P3c4, 0x1);
- data = data | 0x20;
- SiS_SetReg1 (SiS_P3c4, 0x01, data); /* Turn OFF Display */
- SiS_SetReg1 (SiS_P3c4, 0x13, 0x00);
- SiS_SetReg1 (SiS_P3c4, 0x14, 0xBF);
- buswidth = SiS_ChkBUSWidth_300 (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 */
- temp =
- (UCHAR)
- SiS_GetReg1
- (SiS_P3c4, 0x15);
- SiS_SetReg1 (SiS_P3c4,
- 0x15,
- (USHORT)
- (temp &
- 0xFB));
- temp =
- (UCHAR)
- SiS_GetReg1
- (SiS_P3c4, 0x15);
- SiS_SetReg1 (SiS_P3c4,
- 0x15,
- (USHORT)
- (temp |
- 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_P3c4,
- 0x13,
- SR13);
- SiS_SetReg1 (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 (ULONG FBAddress)
- {
- /*USHORT data; */
- PULONG pVideoMemory;
- pVideoMemory = (PULONG) FBAddress;
- pVideoMemory[0] = 0x01234567L;
- pVideoMemory[1] = 0x456789ABL;
- pVideoMemory[2] = 0x89ABCDEFL;
- pVideoMemory[3] = 0xCDEF0123L;
- if (pVideoMemory[3] == 0xCDEF0123L) { /*ChannelA128Bit */
- return (4);
- }
- if (pVideoMemory[1] == 0x456789ABL) { /*ChannelB64Bit */
- return (2);
- }
- return (1);
- }
- #endif
- /* =============== for 300 dram sizing end =============== */
- /* ============== alan ====================== */
- #ifdef CONFIG_FB_SIS_315
- UCHAR
- SiS_Get310DRAMType (ULONG ROMAddr)
- {
- UCHAR data;
- /*
- index=SiS_GetReg1(SiS_P3c4,0x1A);
- index=index&07;
- */
- if (*pSiS_SoftSetting & SoftDRAMType)
- data = *pSiS_SoftSetting & 0x03;
- else
- data = SiS_GetReg1 (SiS_P3c4, 0x3a) & 0x03;
- return data;
- }
- void
- SiS_Delay15us (ULONG ulMicrsoSec)
- {
- }
- void
- SiS_SDR_MRS (void)
- {
- USHORT data;
- data = SiS_GetReg1 (SiS_P3c4, 0x16);
- data = data & 0x3F; /*/ SR16 D7=0,D6=0 */
- SiS_SetReg1 (SiS_P3c4, 0x16, data); /*/ enable mode register set(MRS) low */
- SiS_Delay15us (0x100);
- data = data | 0x80; /*/ SR16 D7=1,D6=0 */
- SiS_SetReg1 (SiS_P3c4, 0x16, data); /*/ enable mode register set(MRS) high */
- SiS_Delay15us (0x100);
- }
- void
- SiS_DDR_MRS (void)
- {
- USHORT data;
- /* SR16 <- 1F,DF,2F,AF */
- /* enable DLL of DDR SD/SGRAM , SR16 D4=1 */
- data = SiS_GetReg1 (SiS_P3c4, 0x16);
- data &= 0x0F;
- data |= 0x10;
- SiS_SetReg1 (SiS_P3c4, 0x16, data);
- if (!(SiS_SR15[1][SiS_RAMType] & 0x10)) {
- data &= 0x0F;
- }
- /* SR16 D7=1,D6=1 */
- data |= 0xC0;
- SiS_SetReg1 (SiS_P3c4, 0x16, data);
- /* SR16 D7=1,D6=0,D5=1,D4=0 */
- data &= 0x0F;
- data |= 0x20;
- SiS_SetReg1 (SiS_P3c4, 0x16, data);
- if (!(SiS_SR15[1][SiS_RAMType] & 0x10)) {
- data &= 0x0F;
- }
- /* SR16 D7=1 */
- data |= 0x80;
- SiS_SetReg1 (SiS_P3c4, 0x16, data);
- }
- void
- SiS_SetDRAMModeRegister (ULONG ROMAddr)
- {
- if (SiS_Get310DRAMType (ROMAddr) < 2) {
- SiS_SDR_MRS ();
- } else {
- /* SR16 <- 0F,CF,0F,8F */
- SiS_DDR_MRS ();
- }
- }
- void
- SiS_DisableRefresh (void)
- {
- USHORT data;
- data = SiS_GetReg1 (SiS_P3c4, 0x17);
- data &= 0xF8;
- SiS_SetReg1 (SiS_P3c4, 0x17, data);
- data = SiS_GetReg1 (SiS_P3c4, 0x19);
- data |= 0x03;
- SiS_SetReg1 (SiS_P3c4, 0x19, data);
- }
- void
- SiS_EnableRefresh (ULONG ROMAddr)
- {
- SiS_SetReg1 (SiS_P3c4, 0x17, SiS_SR15[2][SiS_RAMType]); /* SR17 */
- SiS_SetReg1 (SiS_P3c4, 0x19, SiS_SR15[4][SiS_RAMType]); /* SR19 */
- }
- void
- SiS_DisableChannelInterleaving (int index, USHORT SiS_DDRDRAM_TYPE[][5])
- {
- USHORT data;
- data = SiS_GetReg1 (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_P3c4, 0x15, data);
- }
- void
- SiS_SetDRAMSizingType (int index, USHORT DRAMTYPE_TABLE[][5])
- {
- USHORT data;
- data = DRAMTYPE_TABLE[index][4];
- SiS_SetReg1 (SiS_P3c4, 0x13, data);
- /* should delay 50 ns */
- }
- void
- SiS_CheckBusWidth_310 (ULONG ROMAddress, ULONG FBAddress)
- {
- USHORT data;
- PULONG volatile pVideoMemory;
- pVideoMemory = (PULONG) FBAddress;
- if (SiS_Get310DRAMType (ROMAddress) < 2) {
- SiS_SetReg1 (SiS_P3c4, 0x13, 0x00);
- SiS_SetReg1 (SiS_P3c4, 0x14, 0x12);
- /* should delay */
- SiS_SDR_MRS ();
- SiS_ChannelAB = 0;
- 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)) {
- /*ChannelA64Bit */
- SiS_DataBusWidth = 64;
- SiS_ChannelAB = 0;
- data = SiS_GetReg1 (SiS_P3c4, 0x14);
- SiS_SetReg1 (SiS_P3c4, 0x14, (USHORT) (data & 0xFD));
- }
- if ((pVideoMemory[1] != 0x456789ABL)
- || (pVideoMemory[0] != 0x01234567L)) {
- /*ChannelB64Bit */
- SiS_DataBusWidth = 64;
- SiS_ChannelAB = 1;
- data = SiS_GetReg1 (SiS_P3c4, 0x14);
- SiS_SetReg1 (SiS_P3c4, 0x14,
- (USHORT) ((data & 0xFD) | 0x01));
- }
- return;
- } else {
- /* DDR Dual channel */
- SiS_SetReg1 (SiS_P3c4, 0x13, 0x00);
- SiS_SetReg1 (SiS_P3c4, 0x14, 0x02); /* Channel A, 64bit */
- /* should delay */
- SiS_DDR_MRS ();
- SiS_ChannelAB = 0;
- 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_DataBusWidth = 32;
- SiS_SetReg1 (SiS_P3c4, 0x14, 0x00);
- return;
- }
- }
- SiS_SetReg1 (SiS_P3c4, 0x14, 0x03); /* Channel B, 64bit */
- SiS_DDR_MRS ();
- SiS_ChannelAB = 1;
- 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_DataBusWidth = 32;
- SiS_SetReg1 (SiS_P3c4, 0x14, 0x01);
- } else {
- /* error */
- }
- }
- }
- }
- int
- SiS_SetRank (int index, UCHAR RankNo, UCHAR SiS_ChannelAB,
- 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_DataBusWidth / 32;
- if (RankNo * RankSize <= 128) {
- data = 0;
- while ((RankSize >>= 1) > 0) {
- data += 0x10;
- }
- data |= (RankNo - 1) << 2;
- data |= (SiS_DataBusWidth / 64) & 2;
- data |= SiS_ChannelAB;
- SiS_SetReg1 (SiS_P3c4, 0x14, data);
- /* should delay */
- SiS_SDR_MRS ();
- return 1;
- } else
- return 0;
- }
- int
- SiS_SetDDRChannel (int index, UCHAR ChannelNo, UCHAR SiS_ChannelAB,
- USHORT DRAMTYPE_TABLE[][5])
- {
- USHORT data;
- int RankSize;
- RankSize = DRAMTYPE_TABLE[index][3] / 2 * 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_DataBusWidth / 32) & 2;
- data |= SiS_ChannelAB;
- SiS_SetReg1 (SiS_P3c4, 0x14, data);
- /* should delay */
- SiS_DDR_MRS ();
- return 1;
- } else
- return 0;
- }
- int
- SiS_CheckColumn (int index, USHORT DRAMTYPE_TABLE[][5], ULONG FBAddress)
- {
- int i;
- ULONG Increment, Position;
- /*Increment = 1<<(DRAMTYPE_TABLE[index][2] + SiS_DataBusWidth / 64 + 1); */
- Increment = 1 << (10 + 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 (int index, USHORT DRAMTYPE_TABLE[][5], ULONG FBAddress)
- {
- int i;
- ULONG Increment, Position;
- Increment = 1 << (DRAMTYPE_TABLE[index][2] + 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 (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_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 (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_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_P3c4, 0x14);
- data &= 0xF3;
- data |= 0x08;
- SiS_SetReg1 (SiS_P3c4, 0x14, data);
- data = SiS_GetReg1 (SiS_P3c4, 0x15);
- data += 0x20;
- SiS_SetReg1 (SiS_P3c4, 0x15, data);
- return 1;
- }
- int
- SiS_CheckRanks (int RankNo, int index, USHORT DRAMTYPE_TABLE[][5],
- ULONG FBAddress)
- {
- int r;
- for (r = RankNo; r >= 1; r--) {
- if (!SiS_CheckRank (r, index, DRAMTYPE_TABLE, FBAddress))
- return 0;
- }
- if (!SiS_CheckBanks (index, DRAMTYPE_TABLE, FBAddress))
- return 0;
- if (!SiS_CheckColumn (index, DRAMTYPE_TABLE, FBAddress))
- return 0;
- return 1;
- }
- int
- SiS_CheckDDRRanks (int RankNo, int index, USHORT DRAMTYPE_TABLE[][5],
- ULONG FBAddress)
- {
- int r;
- for (r = RankNo; r >= 1; r--) {
- if (!SiS_CheckDDRRank (r, index, DRAMTYPE_TABLE, FBAddress))
- return 0;
- }
- if (!SiS_CheckBanks (index, DRAMTYPE_TABLE, FBAddress))
- return 0;
- if (!SiS_CheckColumn (index, DRAMTYPE_TABLE, FBAddress))
- return 0;
- return 1;
- }
- int
- SiS_SDRSizing (ULONG FBAddress)
- {
- int i;
- UCHAR j;
- for (i = 0; i < 13; i++) {
- SiS_SetDRAMSizingType (i, SiS_SDRDRAM_TYPE);
- for (j = 2; j > 0; j--) {
- if (!SiS_SetRank
- (i, (UCHAR) j, SiS_ChannelAB,
- SiS_SDRDRAM_TYPE)) continue;
- else {
- if (SiS_CheckRanks
- (j, i, SiS_SDRDRAM_TYPE,
- FBAddress)) return 1;
- }
- }
- }
- return 0;
- }
- int
- SiS_DDRSizing (ULONG FBAddress)
- {
- int i;
- UCHAR j;
- for (i = 0; i < 4; i++) {
- SiS_SetDRAMSizingType (i, SiS_DDRDRAM_TYPE);
- SiS_DisableChannelInterleaving (i, SiS_DDRDRAM_TYPE);
- for (j = 2; j > 0; j--) {
- SiS_SetDDRChannel (i, j, SiS_ChannelAB,
- SiS_DDRDRAM_TYPE);
- if (!SiS_SetRank
- (i, (UCHAR) j, SiS_ChannelAB,
- SiS_DDRDRAM_TYPE)) continue;
- else {
- if (SiS_CheckDDRRanks
- (j, i, SiS_DDRDRAM_TYPE,
- FBAddress)) return 1;
- }
- }
- }
- return 0;
- }
- /*
- check if read cache pointer is correct
- */
- void
- SiS_VerifyMclk (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_P3c4, 0x21);
- Temp = SR21 & 0xFB; /* disable PCI post write buffer empty gating */
- SiS_SetReg1 (SiS_P3c4, 0x21, Temp);
- Temp = SiS_GetReg1 (SiS_P3c4, 0x3C);
- Temp = Temp | 0x01; /*MCLK reset */
- SiS_SetReg1 (SiS_P3c4, 0x3C, Temp);
- Temp = SiS_GetReg1 (SiS_P3c4, 0x3C);
- Temp = Temp & 0xFE; /* MCLK normal operation */
- SiS_SetReg1 (SiS_P3c4, 0x3C, Temp);
- SiS_SetReg1 (SiS_P3c4, 0x21, SR21);
- pVideoMemory[16 + j] = j;
- if (pVideoMemory[16 + j] == j) {
- pVideoMemory[j] = j;
- break;
- }
- }
- }
- }
- int
- Is315E (void)
- {
- USHORT data;
- data = SiS_GetReg1 (SiS_P3d4, 0x5F);
- if (data & 0x10)
- return 1;
- else
- return 0;
- }
- void
- SiS_SetDRAMSize_310 (PSIS_HW_DEVICE_INFO HwDeviceExtension)
- {
- ULONG ROMAddr = (ULONG) HwDeviceExtension->pjVirtualRomBase;
- ULONG FBAddr = (ULONG) HwDeviceExtension->pjVideoMemoryAddress;
- /*USHORT BaseAddr = (USHORT)HwDeviceExtension->ulIOAddress; */
- USHORT data;
- #ifdef SIS301
- /*SiS_SetReg1(SiS_P3d4,0x30,0x40); */
- #endif
- #ifdef SIS302
- SiS_SetReg1 (SiS_P3d4, 0x30, 0x4D); /* alan,should change value */
- SiS_SetReg1 (SiS_P3d4, 0x31, 0xc0); /* alan,should change value */
- SiS_SetReg1 (SiS_P3d4, 0x34, 0x3F); /* alan,should change value */
- #endif
- SiSSetMode (HwDeviceExtension, 0x2e);
- data = SiS_GetReg1 (SiS_P3c4, 0x21);
- SiS_SetReg1 (SiS_P3c4, 0x21, (USHORT) (data & 0xDF)); /* disable read cache */
- data = SiS_GetReg1 (SiS_P3c4, 0x1);
- data = data | 0x20;
- SiS_SetReg1 (SiS_P3c4, 0x01, data); /* Turn OFF Display */
- data = SiS_GetReg1 (SiS_P3c4, 0x16);
- SiS_SetReg1 (SiS_P3c4, 0x16, (USHORT) (data | 0x0F)); /* assume lowest speed DRAM */
- SiS_SetDRAMModeRegister (ROMAddr);
- SiS_DisableRefresh ();
- SiS_CheckBusWidth_310 (ROMAddr, FBAddr);
- SiS_VerifyMclk (FBAddr); /* alan 2000/7/3 */
- if (SiS_Get310DRAMType (ROMAddr) < 2) {
- SiS_SDRSizing (FBAddr);
- } else {
- SiS_DDRSizing (FBAddr);
- }
- if (Is315E ()) {
- data = SiS_GetReg1 (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_P3c4, 0x16, SiS_SR15[1][SiS_RAMType]); /* restore SR16 */
- SiS_EnableRefresh (ROMAddr);
- data = SiS_GetReg1 (SiS_P3c4, 0x21);
- SiS_SetReg1 (SiS_P3c4, 0x21, (USHORT) (data | 0x20)); /* enable read cache */
- }
- #endif
- void
- SiS_SetMemoryClock (ULONG ROMAddr)
- {
- SiS_SetReg1 (SiS_P3c4, 0x28, SiS_MCLKData[SiS_RAMType].SR28);
- SiS_SetReg1 (SiS_P3c4, 0x29, SiS_MCLKData[SiS_RAMType].SR29);
- SiS_SetReg1 (SiS_P3c4, 0x2A, SiS_MCLKData[SiS_RAMType].SR2A);
- SiS_SetReg1 (SiS_P3c4, 0x2E, SiS_ECLKData[SiS_RAMType].SR2E);
- SiS_SetReg1 (SiS_P3c4, 0x2F, SiS_ECLKData[SiS_RAMType].SR2F);
- SiS_SetReg1 (SiS_P3c4, 0x30, SiS_ECLKData[SiS_RAMType].SR30);
- #ifdef CONFIG_FB_SIS_315
- if (Is315E ()) {
- SiS_SetReg1 (SiS_P3c4, 0x28, 0x3B); /* 143 */
- SiS_SetReg1 (SiS_P3c4, 0x29, 0x22);
- SiS_SetReg1 (SiS_P3c4, 0x2E, 0x3B); /* 143 */
- SiS_SetReg1 (SiS_P3c4, 0x2F, 0x22);
- }
- #endif
- }
- /*
- =========================================
- ======== SiS SetMode Function ==========
- =========================================
- */
- BOOLEAN
- SiSSetMode (PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT ModeNo)
- {
- ULONG temp;
- USHORT ModeIdIndex, KeepLockReg;
- ULONG ROMAddr = (ULONG) HwDeviceExtension->pjVirtualRomBase;
- /*ULONG FBAddr = (ULONG)HwDeviceExtension->pjVideoMemoryAddress; */
- USHORT BaseAddr = (USHORT) HwDeviceExtension->ulIOAddress;
- #ifdef CONFIG_FB_SIS_315
- if ((HwDeviceExtension->jChipType == SIS_315H) || /* 05/02/01 ynlai for sis550 */
- (HwDeviceExtension->jChipType == SIS_315PRO) ||
- (HwDeviceExtension->jChipType == SIS_550) ||
- (HwDeviceExtension->jChipType == SIS_640) || /* 08/20/01 chiawen for 640/740 */
- (HwDeviceExtension->jChipType == SIS_740)) /* 09/03/01 chiawen for 650 */
- InitTo310Pointer ();
- #endif
- #ifdef CONFIG_FB_SIS_300
- if ((HwDeviceExtension->jChipType == SIS_540) ||
- (HwDeviceExtension->jChipType == SIS_630) ||
- (HwDeviceExtension->jChipType == SIS_730) ||
- (HwDeviceExtension->jChipType == SIS_300))
- InitTo300Pointer ();
- #endif
- SiS_P3c4 = BaseAddr + 0x14;
- SiS_P3d4 = BaseAddr + 0x24;
- SiS_P3c0 = BaseAddr + 0x10;
- SiS_P3ce = BaseAddr + 0x1e;
- SiS_P3c2 = BaseAddr + 0x12;
- SiS_P3ca = BaseAddr + 0x1a;
- SiS_P3c6 = BaseAddr + 0x16;
- SiS_P3c7 = BaseAddr + 0x17;
- SiS_P3c8 = BaseAddr + 0x18;
- SiS_P3c9 = BaseAddr + 0x19;
- SiS_P3da = BaseAddr + 0x2A;
- SiS_Part1Port = BaseAddr + SIS_CRT2_PORT_04;
- SiS_Part2Port = BaseAddr + SIS_CRT2_PORT_10;
- SiS_Part3Port = BaseAddr + SIS_CRT2_PORT_12;
- SiS_Part4Port = BaseAddr + SIS_CRT2_PORT_14;
- SiS_Part5Port = BaseAddr + SIS_CRT2_PORT_14 + 2;
- SiS_IF_DEF_LVDS = 0;
- SiS_IF_DEF_CH7005 = 0;
- SiS_IF_DEF_HiVision = 0;
- SiS_IF_DEF_DSTN = 0; /*for 550 dstn */
- if ((HwDeviceExtension->jChipType == SIS_540) ||
- (HwDeviceExtension->jChipType == SIS_630) ||
- (HwDeviceExtension->jChipType == SIS_730) ||
- (HwDeviceExtension->jChipType == SIS_550) ||
- (HwDeviceExtension->jChipType == SIS_640) || /* 08/20/01 chiawen for 640/740 */
- (HwDeviceExtension->jChipType == SIS_740)) { /* 09/03/01 chiawen for 650 */
- temp = SiS_GetReg1 (SiS_P3d4, 0x37);
- temp = (temp & 0x0E) >> 1;
- if ((temp == 0) || (temp == 1)) { /* for 301 */
- SiS_IF_DEF_LVDS = 0;
- SiS_IF_DEF_CH7005 = 0;
- SiS_IF_DEF_TRUMPION = 0;
- }
- if ((temp >= 2) && (temp <= 5)) {
- SiS_IF_DEF_LVDS = 1;
- }
- if (temp == 3)
- SiS_IF_DEF_TRUMPION = 1;
- if ((temp == 4) || (temp == 5))
- SiS_IF_DEF_CH7005 = 1;
- } else {
- SiS_IF_DEF_LVDS = 0;
- SiS_IF_DEF_TRUMPION = 0;
- SiS_IF_DEF_CH7005 = 0;
- }
- if (ModeNo & 0x80) {
- ModeNo = ModeNo & 0x7F;
- flag_clearbuffer = 0;
- } else {
- flag_clearbuffer = 1;
- }
- SiS_PresetScratchregister (SiS_P3d4, HwDeviceExtension); /*add for CRT2 */
- KeepLockReg = SiS_GetReg1 (SiS_P3c4, 0x05);
- SiS_SetReg1 (SiS_P3c4, 0x05, 0x86); /* 1.Openkey */
- temp = SiS_SearchModeID (ROMAddr, ModeNo, &ModeIdIndex); /* 2.Get ModeID Table */
- if (temp == 0)
- return (0);
- /*301b */
- SiS_GetVBType (BaseAddr);
- /*end 301b */
- SiS_GetVBInfo301 (BaseAddr, ROMAddr, ModeNo, ModeIdIndex, HwDeviceExtension); /*add for CRT2 */
- SiS_GetLCDResInfo301 (ROMAddr, SiS_P3d4, ModeNo, ModeIdIndex); /*add for CRT2 */
- temp = SiS_CheckMemorySize (ROMAddr, HwDeviceExtension, ModeNo, ModeIdIndex); /*3.Check memory size */
- if (temp == 0)
- return (0);
- if (SiS_VBInfo & (SetSimuScanMode | SetCRT2ToLCDA)) { /*301b */
- SiS_SetCRT1Group (ROMAddr, HwDeviceExtension, ModeNo,
- ModeIdIndex);
- } else {
- if (!(SiS_VBInfo & SwitchToCRT2)) {
- SiS_SetCRT1Group (ROMAddr, HwDeviceExtension, ModeNo,
- ModeIdIndex);
- }
- }
- if (SiS_VBInfo & (SetSimuScanMode | SwitchToCRT2 | SetCRT2ToLCDA)) { /*301b */
- switch (HwDeviceExtension->ujVBChipID) {
- /*karl*/
- case VB_CHIP_301:
- case VB_CHIP_301B:
- SiS_SetCRT2Group301 (BaseAddr, ROMAddr, ModeNo, HwDeviceExtension); /*add for CRT2 */
- break;
- case VB_CHIP_302:
- SiS_SetCRT2Group301 (BaseAddr, ROMAddr, ModeNo,
- HwDeviceExtension);
- break;
- case VB_CHIP_303:
- /* SetCRT2Group302(BaseAddr,ROMAddr,ModeNo, HwDeviceExtension); add for CRT2 */
- break;
- case VB_CHIP_UNKNOWN: /*add for lvds ch7005 */
- temp = SiS_GetReg1 (SiS_P3d4, 0x37);
- if (temp &
- (ExtChipLVDS | ExtChipTrumpion | ExtChipCH7005)) {
- SiS_SetCRT2Group301 (BaseAddr, ROMAddr, ModeNo,
- HwDeviceExtension);
- }
- break;
- }
- }
- if (KeepLockReg == 0xA1)
- SiS_SetReg1 (SiS_P3c4, 0x05, 0x86); /* 05/02/01 ynlai */
- else
- SiS_SetReg1 (SiS_P3c4, 0x05, 0x00);
- return TRUE;
- }
- void
- SiS_SetCRT1Group (ULONG ROMAddr, PSIS_HW_DEVICE_INFO HwDeviceExtension,
- USHORT ModeNo, USHORT ModeIdIndex)
- {
- USHORT StandTableIndex, RefreshRateTableIndex;
- USHORT temp;
- /*SiS_SetReg1(SiS_P3d4,0x34,ModeNo); */
- SiS_CRT1Mode = ModeNo;
- /* set CR34->CRT1 ModeNofor CRT2 FIFO */
- StandTableIndex = SiS_GetModePtr (ROMAddr, ModeNo, ModeIdIndex); /* 4.GetModePtr */
- SiS_SetSeqRegs (ROMAddr, StandTableIndex); /* 5.SetSeqRegs */
- SiS_SetMiscRegs (ROMAddr, StandTableIndex); /* 6.SetMiscRegs */
- SiS_SetCRTCRegs (ROMAddr, HwDeviceExtension, StandTableIndex); /* 7.SetCRTCRegs */
- SiS_SetATTRegs (ROMAddr, StandTableIndex); /* 8.SetATTRegs */
- SiS_SetGRCRegs (ROMAddr, StandTableIndex); /* 9.SetGRCRegs */
- SiS_ClearExt1Regs (); /* 10.Clear Ext1Regs */
- temp = ~ProgrammingCRT2; /* 11.GetRatePtr */
- SiS_SetFlag = SiS_SetFlag & temp;
- SiS_SelectCRT2Rate = 0;
- /*301b */
- if ((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B)) {
- if (SiS_VBInfo & SetCRT2ToLCDA) {
- SiS_SetFlag = SiS_SetFlag | ProgrammingCRT2;
- /* SiS_SelectCRT2Rate=4; */
- }
- }
- /*end 301b */
- RefreshRateTableIndex = SiS_GetRatePtrCRT2 (ROMAddr, ModeNo, ModeIdIndex); /* 11.GetRatePtr */
- /*301b */
- if ((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B)) {
- if (!(SiS_VBInfo & SetCRT2ToLCDA)) {
- SiS_SetFlag = SiS_SetFlag & (~ProgrammingCRT2);
- }
- }
- /*end 301b */
- if (RefreshRateTableIndex != 0xFFFF) {
- SiS_SetSync (ROMAddr, RefreshRateTableIndex); /* 12.SetSync */
- SiS_SetCRT1CRTC (ROMAddr, ModeNo, ModeIdIndex, RefreshRateTableIndex); /* 13.SetCRT1CRTC */
- SiS_SetCRT1Offset (ROMAddr, ModeNo, ModeIdIndex,
- RefreshRateTableIndex, HwDeviceExtension); /* 14.SetCRT1Offset */
- SiS_SetCRT1VCLK (ROMAddr, ModeNo, ModeIdIndex,
- HwDeviceExtension, RefreshRateTableIndex); /* 15.SetCRT1VCLK */
- }
- #ifdef CONFIG_FB_SIS_300
- if ((HwDeviceExtension->jChipType == SIS_630) ||
- (HwDeviceExtension->jChipType == SIS_540)) {
- SiS_SetCRT1FIFO2 (ROMAddr, ModeNo, HwDeviceExtension,
- RefreshRateTableIndex);
- }
- #endif
- #ifdef CONFIG_FB_SIS_315
- if (HwDeviceExtension->jChipType >= SIS_315H) {
- SiS_SetCRT1FIFO (ROMAddr, ModeNo, HwDeviceExtension);
- }
- #endif
- SiS_SetCRT1ModeRegs (ROMAddr, HwDeviceExtension, ModeNo, ModeIdIndex,
- RefreshRateTableIndex);
- SiS_SetVCLKState (ROMAddr, HwDeviceExtension, ModeNo,
- RefreshRateTableIndex);
- #ifdef CONFIG_FB_SIS_315
- if (HwDeviceExtension->jChipType > SIS_315H)
- SiS_SetInterlace (ROMAddr, ModeNo, RefreshRateTableIndex);
- #endif
- SiS_LoadDAC (ROMAddr, ModeNo, ModeIdIndex);
- if (flag_clearbuffer)
- SiS_ClearBuffer (HwDeviceExtension, ModeNo);
- if (!(SiS_VBInfo & (SetSimuScanMode | SwitchToCRT2 | SetCRT2ToLCDA))) { /*301b */
- SiS_LongWait ();
- SiS_DisplayOn ();
- }
- }
- void
- SiS_GetVBType (USHORT BaseAddr)
- {
- USHORT flag;
- flag = SiS_GetReg1 (SiS_Part4Port, 0x00);
- if (flag >= 2)
- SiS_VBType = VB_SIS302B;
- else {
- flag = SiS_GetReg1 (SiS_Part4Port, 0x01);
- if (flag >= 0xB0)
- SiS_VBType = VB_SIS301B;
- else
- SiS_VBType = VB_SIS301;
- flag = SiS_GetReg1 (SiS_Part4Port, 0x23); /*301dlvds */
- if (!(flag & 0x02))
- SiS_VBType = SiS_VBType | VB_NoLCD;
- }
- }
- /* win2000 MM adapter not support standard mode */
- BOOLEAN
- SiS_SearchModeID (ULONG ROMAddr, USHORT ModeNo, USHORT * ModeIdIndex)
- {
- PUCHAR VGA_INFO = "