tempbx |= SetSimuScanMode;
tempbx |= SetInSlaveMode;
SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,              PSIS_HW_INFO HwInfo, int checkcrt2mode){  USHORT tempax,tempbx,temp;  USHORT modeflag, resinfo=0;  if(ModeNo <= 0x13) {     modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;  } else if(SiS_Pr->UseCustomMode) {     modeflag = SiS_Pr->CModeFlag;  } else {     modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;     resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;  }  SiS_Pr->SiS_SetFlag = 0;  SiS_Pr->SiS_ModeType = modeflag & ModeTypeMask;  tempbx = 0;  if(SiS_BridgeIsOn(SiS_Pr)) {    	temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30);#if 0   	if(HwInfo->jChipType < SIS_661) {	   /* NO - YPbPr not set yet ! */	   if(SiS_Pr->SiS_YPbPr & <all ypbpr except 525i>) {	      temp &= (SetCRT2ToHiVision | SwitchCRT2 | SetSimuScanMode); 	/* 0x83 */	      temp |= SetCRT2ToHiVision;   					/* 0x80 */   	   }	   if(SiS_Pr->SiS_YPbPr & <ypbpr525i>) {	      temp &= (SetCRT2ToHiVision | SwitchCRT2 | SetSimuScanMode); 	/* 0x83 */	      temp |= SetCRT2ToSVIDEO;  					/* 0x08 */	   }	}#endif    	tempbx |= temp;    	tempax = SiS_GetReg(SiS_Pr->SiS_P3d4,0x31) << 8;        tempax &= (DriverMode | LoadDACFlag | SetNotSimuMode | SetPALTV);    	tempbx |= tempax;#ifdef SIS315H	if(HwInfo->jChipType >= SIS_315H) {    	   if(SiS_Pr->SiS_VBType & VB_SISLCDA) {	      if(ModeNo == 0x03) {	         /* Mode 0x03 is never in driver mode */		 SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x31,0xbf);	      }	      if(!(SiS_GetReg(SiS_Pr->SiS_P3d4,0x31) & (DriverMode >> 8))) {	         /* Reset LCDA setting if not driver mode */		 SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x38,0xfc);	      }	      if(IS_SIS650) {	         if(SiS_Pr->SiS_UseLCDA) {		    if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x5f) & 0xF0) {		       if((ModeNo <= 0x13) || (!(SiS_GetReg(SiS_Pr->SiS_P3d4,0x31) & (DriverMode >> 8)))) {		          SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x38,(EnableDualEdge | SetToLCDA));		       }		    }		 }	      }	      temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38);       	      if((temp & (EnableDualEdge | SetToLCDA)) == (EnableDualEdge | SetToLCDA)) {          	 tempbx |= SetCRT2ToLCDA;	      }	   }	   if(SiS_Pr->SiS_VBType & (VB_SIS301LV|VB_SIS302LV|VB_SIS302ELV)) {	      tempbx &= ~(SetCRT2ToRAMDAC);	   }	   if(HwInfo->jChipType >= SIS_661) {	      tempbx &= ~(SetCRT2ToYPbPr525750 | SetCRT2ToHiVision);	      temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38);	      if(SiS_Pr->SiS_VBType & VB_SISYPBPR) {	         if(temp & 0x04) {		    temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35) & 0xe0;		    if(temp == 0x60) tempbx |= SetCRT2ToHiVision;		    else             tempbx |= SetCRT2ToYPbPr525750;		 }	      } else if(SiS_Pr->SiS_VBType & VB_SISHIVISION) {	         if(temp & 0x04) {		    temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35) & 0xe0;		    if(temp == 0x60) tempbx |= SetCRT2ToHiVision;		 }	      }  	   }	   if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {	      temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38);	      if(temp & SetToLCDA) {		 tempbx |= SetCRT2ToLCDA;	      }	      if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {	         if(temp & EnableCHYPbPr) {		    tempbx |= SetCRT2ToCHYPbPr;		 }	      }	   }	}#endif  /* SIS315H */    	if(SiS_Pr->SiS_VBType & VB_SISVB) {	   temp = SetCRT2ToSVIDEO   |	          SetCRT2ToAVIDEO   |	          SetCRT2ToSCART    |	          SetCRT2ToLCDA     |	          SetCRT2ToLCD      |	          SetCRT2ToRAMDAC   |                  SetCRT2ToHiVision |		  SetCRT2ToYPbPr525750;    	} else {           if(HwInfo->jChipType >= SIS_315H) {              if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {        	 temp = SetCRT2ToAVIDEO |		        SetCRT2ToSVIDEO |		        SetCRT2ToSCART  |		        SetCRT2ToLCDA   |		        SetCRT2ToLCD    |		        SetCRT2ToCHYPbPr;      	      } else {        	 temp = SetCRT2ToLCDA   |		        SetCRT2ToLCD;	      }	   } else {      	      if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {          	 temp = SetCRT2ToTV | SetCRT2ToLCD;              } else {        	 temp = SetCRT2ToLCD;	      }	   }    	}    	if(!(tempbx & temp)) {      	   tempax = DisableCRT2Display;      	   tempbx = 0;    	}   	if(SiS_Pr->SiS_VBType & VB_SISVB) {	   USHORT clearmask = ( DriverMode 	   |				DisableCRT2Display |				LoadDACFlag 	   |				SetNotSimuMode 	   |				SetInSlaveMode 	   |				SetPALTV 	   |				SwitchCRT2	   |				SetSimuScanMode );      	   if(tempbx & SetCRT2ToLCDA)        tempbx &= (clearmask | SetCRT2ToLCDA);	   if(tempbx & SetCRT2ToRAMDAC)      tempbx &= (clearmask | SetCRT2ToRAMDAC);	   if(tempbx & SetCRT2ToLCD)         tempbx &= (clearmask | SetCRT2ToLCD);	   if(tempbx & SetCRT2ToSCART)       tempbx &= (clearmask | SetCRT2ToSCART);	   if(tempbx & SetCRT2ToHiVision)    tempbx &= (clearmask | SetCRT2ToHiVision);	   if(tempbx & SetCRT2ToYPbPr525750) tempbx &= (clearmask | SetCRT2ToYPbPr525750);   	} else {	   if(HwInfo->jChipType >= SIS_315H) {	      if(tempbx & SetCRT2ToLCDA) {	         tempbx &= (0xFF00|SwitchCRT2|SetSimuScanMode);	      }	   }      	   if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {              if(tempbx & SetCRT2ToTV) {          	 tempbx &= (0xFF00|SetCRT2ToTV|SwitchCRT2|SetSimuScanMode);	      }      	   }      	   if(tempbx & SetCRT2ToLCD) {              tempbx &= (0xFF00|SetCRT2ToLCD|SwitchCRT2|SetSimuScanMode);	   }	   if(HwInfo->jChipType >= SIS_315H) {	      if(tempbx & SetCRT2ToLCDA) {	         tempbx |= SetCRT2ToLCD;	      }	   }	}    	if(tempax & DisableCRT2Display) {      	   if(!(tempbx & (SwitchCRT2 | SetSimuScanMode))) {              tempbx = SetSimuScanMode | DisableCRT2Display;      	   }    	}    	if(!(tempbx & DriverMode)) tempbx |= SetSimuScanMode;	/* LVDS/CHRONTEL (LCD/TV) and 301BDH (LCD) can only be slave in 8bpp modes */	if(SiS_Pr->SiS_ModeType <= ModeVGA) {	   if( (SiS_Pr->SiS_IF_DEF_LVDS == 1) ||	       ((SiS_Pr->SiS_VBType & VB_NoLCD) && (tempbx & SetCRT2ToLCD)) ) {	       modeflag &= (~CRT2Mode);	   }	}    	if(!(tempbx & SetSimuScanMode)) {      	   if(tempbx & SwitchCRT2) {              if((!(modeflag & CRT2Mode)) && (checkcrt2mode)) {		 if( (HwInfo->jChipType >= SIS_315H) &&		     (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) ) {		    if(resinfo != SIS_RI_1600x1200) {                       tempbx |= SetSimuScanMode;		    }		 } else {            	    tempbx |= SetSimuScanMode;	         }              }      	   } else {              if(SiS_BridgeIsEnabled(SiS_Pr,HwInfo)) {          	 if(!(tempbx & DriverMode)) {            	    if(SiS_BridgeInSlavemode(SiS_Pr)) {		       tempbx |= SetSimuScanMode;            	    }                 }              }      	   }    	}    	if(!(tempbx & DisableCRT2Display)) {           if(tempbx & DriverMode) {              if(tempbx & SetSimuScanMode) {          	 if((!(modeflag & CRT2Mode)) && (checkcrt2mode)) {	            if( (HwInfo->jChipType >= SIS_315H) &&		        (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) ) {		       if(resinfo != SIS_RI_1600x1200) {		          tempbx |= SetInSlaveMode;		       }		    } else {            	       tempbx |= SetInSlaveMode;                    }	         }              }           } else {              tempbx |= SetInSlaveMode;      	   }    	}  }  SiS_Pr->SiS_VBInfo = tempbx;  if(HwInfo->jChipType == SIS_630) {     SiS_SetChrontelGPIO(SiS_Pr, SiS_Pr->SiS_VBInfo);  }#ifdef TWDEBUG#ifdef LINUX_KERNEL  printk(KERN_DEBUG "sisfb: (VBInfo= 0x%04x, SetFlag=0x%04x)\n",      SiS_Pr->SiS_VBInfo, SiS_Pr->SiS_SetFlag);#endif#ifdef LINUX_XF86  xf86DrvMsgVerb(0, X_PROBED, 3, "(init301: VBInfo=0x%04x, SetFlag=0x%04x)\n",      SiS_Pr->SiS_VBInfo, SiS_Pr->SiS_SetFlag);#endif#endif}