📄 init.c
字号:
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_LVDSCRT1320x480_1 = (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT1320x480_1; /*fstn*/ 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#ifndef LINUX_XF86/* -------------- SiSInit -----------------*/BOOLEANSiSInit(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;#ifdef LINUX_KERNEL UCHAR temp1; ULONG base;#endif UCHAR SR12=0,SR13=0,SR14=0,SR16=0,SR17=0,SR18=0,SR19=0,SR1A=0;#ifdef SIS315H UCHAR CR37=0,CR38=0,CR79=0,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); /* 3c2 <- 67 ,ynlai */#ifdef SIS315H /*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 SIS315H 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 640/740 */ (HwDeviceExtension->jChipType == SIS_650)) /* 09/03/01 chiawen for 650 */ InitTo310Pointer();#endif#ifdef SIS300 if ((HwDeviceExtension->jChipType == SIS_540)|| (HwDeviceExtension->jChipType == SIS_630)|| (HwDeviceExtension->jChipType == SIS_730)|| (HwDeviceExtension->jChipType == SIS_300)) InitTo300Pointer();#endif /* TW: Set SiS Register globals */ SiSRegInit(BaseAddr); /* TW: Determine LVDS/CH7005/TRUMPION */ SiS_Set_LVDS_TRUMPION(HwDeviceExtension); SiS_SetReg1(SiS_P3c4,0x05,0x86); /* 1.Openkey - unlock registers */#ifdef LINUX_KERNEL#ifdef SIS300 /* 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 SIS315H /* 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)|| /* 08/20/01 chiawen for 640/740 */ (HwDeviceExtension->jChipType == SIS_740)|| /* 09/03/01 chiawen for 640/740 */ (HwDeviceExtension->jChipType == SIS_650)) { /* 09/03/01 chiawen for 650 */ 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 /* Linux kernel */#ifdef SIS300 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 if(HwDeviceExtension->jChipType == SIS_300){ SR13 = (UCHAR)SiS_GetReg1(SiS_P3c4,0x13); SR14 = (UCHAR)SiS_GetReg1(SiS_P3c4,0x14); }#endif#ifdef SIS315H 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 640/740 */ (HwDeviceExtension->jChipType == SIS_650)) { /* 09/03/01 chiawen for 650 */ SR19 = (UCHAR)SiS_GetReg1(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_P3c4,0x13); SR14 = (UCHAR)SiS_GetReg1(SiS_P3c4,0x14); SR15 = (UCHAR)SiS_GetReg1(SiS_P3c4,0x15); SR16 = (UCHAR)SiS_GetReg1(SiS_P3c4,0x16); SR17 = (UCHAR)SiS_GetReg1(SiS_P3c4,0x17); SR1A = (UCHAR)SiS_GetReg1(SiS_P3c4,0x1A); SR1B = (UCHAR)SiS_GetReg1(SiS_P3c4,0x1B); CR37 = 0x02;/*(UCHAR)SiS_GetReg1(SiS_P3d4,0x37);*/ CR38 = (UCHAR)SiS_GetReg1(SiS_P3d4,0x38); 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); } }#endif/* ResetExtReg begin: Reset extended registers */ 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 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_P3d4,i,0); }#endif#ifdef SIS315H 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 640/740 */ (HwDeviceExtension->jChipType == SIS_650)) { for(i=0x12;i<=0x1B;i++) SiS_SetReg1(SiS_P3c4,i,0); for(i=0x79;i<=0x7C;i++) SiS_SetReg1(SiS_P3d4,i,0); }#endif/* ResetExtReg end */#ifdef SIS300 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 SIS315H 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 640/740 */ (HwDeviceExtension->jChipType == SIS_650)) { /* 09/03/01 chiawen for 650 */ SiS_SetReg1(SiS_P3c4,0x13,SR13); SiS_SetReg1(SiS_P3c4,0x14,SR14); SiS_SetReg1(SiS_P3c4,0x15,SR15); SiS_SetReg1(SiS_P3c4,0x16,SR16); SiS_SetReg1(SiS_P3c4,0x17,SR17); SiS_SetReg1(SiS_P3c4,0x19,SR19); SiS_SetReg1(SiS_P3c4,0x1A,SR1A); SiS_SetReg1(SiS_P3c4,0x1B,SR1B); SiS_SetReg1(SiS_P3d4,0x37,CR37); SiS_SetReg1(SiS_P3d4,0x38,CR38); SiS_SetReg1(SiS_P3d4,0x79,CR79); SiS_SetReg1(SiS_P3d4,0x7A,CR7A); SiS_SetReg1(SiS_P3d4,0x7B,CR7B); SiS_SetReg1(SiS_P3d4,0x7C,CR7C); }#endif#ifdef SIS300 if((HwDeviceExtension->jChipType==SIS_540)|| (HwDeviceExtension->jChipType==SIS_630)|| (HwDeviceExtension->jChipType==SIS_730)) { temp=(UCHAR)SR1A; } else if(HwDeviceExtension->jChipType==SIS_300) { /* TW: Nothing */ } else#endif { if((*pSiS_SoftSetting&SoftDRAMType)==0){ temp=(UCHAR)SiS_GetReg1(SiS_P3c4,0x3A); } } SiS_RAMType=temp&0x03; SiS_SetMemoryClock(ROMAddr);/* SetDefExt1Regs begin: Set default register contents */ SiS_SetReg1(SiS_P3c4,0x07,*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_P3c4,i,SiS_SR15[i-0x15][SiS_RAMType]); } }#ifdef SIS315H 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); /* DAC pedestal */ /*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 SIS300 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); /* Power Management */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -