⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 init.c

📁 优龙2410linux2.6.8内核源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
         (ROMAddr[0x1b] == 'e') &&         (ROMAddr[0x1c] == 'w') &&         (ROMAddr[0x1d] == 'V')) {	 return TRUE;      }   }   return FALSE;}static voidSiSDetermineROMUsage(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo){   UCHAR  *ROMAddr  = HwInfo->pjVirtualRomBase;   USHORT romptr = 0;   SiS_Pr->SiS_UseROM = FALSE;   SiS_Pr->SiS_ROMNew = FALSE;   if((ROMAddr) && (HwInfo->UseROM)) {      if(HwInfo->jChipType == SIS_300) {         /* 300: We check if the code starts below 0x220 by	  * checking the jmp instruction at the beginning	  * of the BIOS image.	  */	 if((ROMAddr[3] == 0xe9) && ((ROMAddr[5] << 8) | ROMAddr[4]) > 0x21a)	    SiS_Pr->SiS_UseROM = TRUE;      } else if(HwInfo->jChipType < SIS_315H) {	 /* Sony's VAIO BIOS 1.09 follows the standard, so perhaps	  * the others do as well	  */	 SiS_Pr->SiS_UseROM = TRUE;      } else {         /* 315/330 series stick to the standard(s) */	 SiS_Pr->SiS_UseROM = TRUE;	 if((SiS_Pr->SiS_ROMNew = SiSDetermineROMLayout661(SiS_Pr, HwInfo))) {	    /* Find out about LCD data table entry size */	    if((romptr = SISGETROMW(0x0102))) {	       if(ROMAddr[romptr + (32 * 16)] == 0xff)	          SiS_Pr->SiS661LCD2TableSize = 32;	       else if(ROMAddr[romptr + (34 * 16)] == 0xff)	          SiS_Pr->SiS661LCD2TableSize = 34;	       else if(ROMAddr[romptr + (36 * 16)] == 0xff)	          SiS_Pr->SiS661LCD2TableSize = 36;  /* 0.94 final */	    }	 }      }   }}/*********************************************//*        HELPER: SET SEGMENT REGISTERS      *//*********************************************/static voidSiS_SetSegRegLower(SiS_Private *SiS_Pr, USHORT value){   USHORT temp;   value &= 0x00ff;   temp = SiS_GetRegByte(SiS_Pr->SiS_P3cb) & 0xf0;   temp |= (value >> 4);   SiS_SetRegByte(SiS_Pr->SiS_P3cb, temp);   temp = SiS_GetRegByte(SiS_Pr->SiS_P3cd) & 0xf0;   temp |= (value & 0x0f);   SiS_SetRegByte(SiS_Pr->SiS_P3cd, temp);}static voidSiS_SetSegRegUpper(SiS_Private *SiS_Pr, USHORT value){   USHORT temp;   value &= 0x00ff;   temp = SiS_GetRegByte(SiS_Pr->SiS_P3cb) & 0x0f;   temp |= (value & 0xf0);   SiS_SetRegByte(SiS_Pr->SiS_P3cb, temp);   temp = SiS_GetRegByte(SiS_Pr->SiS_P3cd) & 0x0f;   temp |= (value << 4);   SiS_SetRegByte(SiS_Pr->SiS_P3cd, temp);}static voidSiS_SetSegmentReg(SiS_Private *SiS_Pr, USHORT value){   SiS_SetSegRegLower(SiS_Pr, value);   SiS_SetSegRegUpper(SiS_Pr, value);}static voidSiS_ResetSegmentReg(SiS_Private *SiS_Pr){   SiS_SetSegmentReg(SiS_Pr, 0);}static voidSiS_SetSegmentRegOver(SiS_Private *SiS_Pr, USHORT value){   USHORT temp = value >> 8;   temp &= 0x07;   temp |= (temp << 4);   SiS_SetReg(SiS_Pr->SiS_P3c4,0x1d,temp);   SiS_SetSegmentReg(SiS_Pr, value);}static voidSiS_ResetSegmentRegOver(SiS_Private *SiS_Pr){   SiS_SetSegmentRegOver(SiS_Pr, 0);}static voidSiS_ResetSegmentRegisters(SiS_Private *SiS_Pr,PSIS_HW_INFO HwInfo){   if((IS_SIS65x) || (HwInfo->jChipType >= SIS_661)) {      SiS_ResetSegmentReg(SiS_Pr);      SiS_ResetSegmentRegOver(SiS_Pr);   }}/*********************************************//*             HELPER: GetVBType             *//*********************************************/voidSiS_GetVBType(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo){  USHORT flag=0, rev=0, nolcd=0;  SiS_Pr->SiS_VBType = 0;  if((SiS_Pr->SiS_IF_DEF_LVDS) || (SiS_Pr->SiS_IF_DEF_CONEX))     return;  flag = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x00);  if(flag > 3) return;  rev = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x01);  if(flag >= 2) {     SiS_Pr->SiS_VBType = VB_SIS302B;  } else if(flag == 1) {     if(rev >= 0xC0) {       	SiS_Pr->SiS_VBType = VB_SIS301C;     } else if(rev >= 0xB0) {       	SiS_Pr->SiS_VBType = VB_SIS301B;	/* Check if 30xB DH version (no LCD support, use Panel Link instead) */    	nolcd = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x23);        if(!(nolcd & 0x02)) SiS_Pr->SiS_VBType |= VB_NoLCD;     } else {        SiS_Pr->SiS_VBType = VB_SIS301;     }  }  if(SiS_Pr->SiS_VBType & (VB_SIS301B | VB_SIS301C | VB_SIS302B)) {     if(rev >= 0xE0) {	flag = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x39);	if(flag == 0xff) SiS_Pr->SiS_VBType = VB_SIS302LV;	else 	 	 SiS_Pr->SiS_VBType = VB_SIS301C;  /* VB_SIS302ELV; */     } else if(rev >= 0xD0) {	SiS_Pr->SiS_VBType = VB_SIS301LV;     }  }}/*********************************************//*           HELPER: Check RAM size          *//*********************************************/#ifndef LINUX_XF86static BOOLEANSiS_CheckMemorySize(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,                    USHORT ModeNo, USHORT ModeIdIndex){  USHORT AdapterMemSize = HwInfo->ulVideoMemorySize / (1024*1024);  USHORT memorysize,modeflag;  if(SiS_Pr->UseCustomMode) {     modeflag = SiS_Pr->CModeFlag;  } else {     if(ModeNo <= 0x13) {        modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;     } else {        modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;     }  }  memorysize = modeflag & MemoryInfoFlag;  memorysize >>= MemorySizeShift;		/* Get required memory size */  memorysize++;  if(AdapterMemSize < memorysize) return FALSE;  return TRUE;}#endif/*********************************************//*           HELPER: Get DRAM type           *//*********************************************/#ifdef SIS315Hstatic UCHARSiS_Get310DRAMType(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo){   UCHAR data, temp;   if((*SiS_Pr->pSiS_SoftSetting) & SoftDRAMType) {     data = (*SiS_Pr->pSiS_SoftSetting) & 0x03;   } else {     if(HwInfo->jChipType >= SIS_661) {        data = SiS_GetReg(SiS_Pr->SiS_P3d4,0x78) & 0x07;	if(SiS_Pr->SiS_ROMNew) {	   data = ((SiS_GetReg(SiS_Pr->SiS_P3d4,0x78) & 0xc0) >> 6);	}     } else if(IS_SIS550650740) {        data = SiS_GetReg(SiS_Pr->SiS_P3c4,0x13) & 0x07;     } else {	/* 315, 330 */        data = SiS_GetReg(SiS_Pr->SiS_P3c4,0x3a) & 0x03;        if(HwInfo->jChipType == SIS_330) {	   if(data > 1) {	      temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x5f) & 0x30;	      switch(temp) {	      case 0x00: data = 1; break;	      case 0x10: data = 3; break;	      case 0x20: data = 3; break;	      case 0x30: data = 2; break;	      }	   } else {	      data = 0;	   }	}     }   }   return data;}USHORTSiS_GetMCLK(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo){  UCHAR  *ROMAddr  = HwInfo->pjVirtualRomBase;  USHORT index;  index = SiS_Get310DRAMType(SiS_Pr, HwInfo);  if(HwInfo->jChipType >= SIS_661) {     if(SiS_Pr->SiS_ROMNew) {        return((USHORT)(SISGETROMW((0x90 + (index * 5) + 3))));     }     return(SiS_Pr->SiS_MCLKData_0[index].CLOCK);  } else if(index >= 4) {     index -= 4;     return(SiS_Pr->SiS_MCLKData_1[index].CLOCK);  } else {     return(SiS_Pr->SiS_MCLKData_0[index].CLOCK);  }}#endif/*********************************************//*           HELPER: ClearBuffer             *//*********************************************/#ifndef LINUX_XF86static voidSiS_ClearBuffer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo){  UCHAR   *VideoMemoryAddress = HwInfo->pjVideoMemoryAddress;  ULONG   AdapterMemorySize  = (ULONG)HwInfo->ulVideoMemorySize;  USHORT  *pBuffer;  int i;  if(SiS_Pr->SiS_ModeType >= ModeEGA) {     if(ModeNo > 0x13) {        SiS_SetMemory(VideoMemoryAddress, AdapterMemorySize, 0);     } else {        pBuffer = (USHORT *)VideoMemoryAddress;        for(i=0; i<0x4000; i++) pBuffer[i] = 0x0000;     }  } else {     if(SiS_Pr->SiS_ModeType < ModeCGA) {        pBuffer = (USHORT *)VideoMemoryAddress;        for(i=0; i<0x4000; i++) pBuffer[i] = 0x0720;     } else {        SiS_SetMemory(VideoMemoryAddress, 0x8000, 0);     }  }}#endif/*********************************************//*           HELPER: SearchModeID            *//*********************************************/BOOLEANSiS_SearchModeID(SiS_Private *SiS_Pr, USHORT *ModeNo, USHORT *ModeIdIndex){   UCHAR VGAINFO = SiS_Pr->SiS_VGAINFO;   if(*ModeNo <= 0x13) {      if((*ModeNo) <= 0x05) (*ModeNo) |= 0x01;      for(*ModeIdIndex = 0; ;(*ModeIdIndex)++) {         if(SiS_Pr->SiS_SModeIDTable[*ModeIdIndex].St_ModeID == (*ModeNo)) break;         if(SiS_Pr->SiS_SModeIDTable[*ModeIdIndex].St_ModeID == 0xFF)   return FALSE;      }      if(*ModeNo == 0x07) {          if(VGAINFO & 0x10) (*ModeIdIndex)++;   /* 400 lines */          /* else 350 lines */      }      if(*ModeNo <= 0x03) {         if(!(VGAINFO & 0x80)) (*ModeIdIndex)++;         if(VGAINFO & 0x10)    (*ModeIdIndex)++; /* 400 lines  */         /* else 350 lines  */      }      /* else 200 lines  */   } else {      for(*ModeIdIndex = 0; ;(*ModeIdIndex)++) {         if(SiS_Pr->SiS_EModeIDTable[*ModeIdIndex].Ext_ModeID == (*ModeNo)) break;         if(SiS_Pr->SiS_EModeIDTable[*ModeIdIndex].Ext_ModeID == 0xFF)      return FALSE;      }   }   return TRUE;}/*********************************************//*            HELPER: GetModePtr             *//*********************************************/UCHARSiS_GetModePtr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex){   UCHAR index;   if(ModeNo <= 0x13) {      index = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_StTableIndex;   } else {      if(SiS_Pr->SiS_ModeType <= ModeEGA) index = 0x1B;      else index = 0x0F;   }   return index;}/*********************************************//*           HELPER: LowModeTests            *//*********************************************/static BOOLEANSiS_DoLowModeTest(SiS_Private *SiS_Pr, USHORT ModeNo, PSIS_HW_INFO HwInfo){    USHORT temp,temp1,temp2;    if((ModeNo != 0x03) && (ModeNo != 0x10) && (ModeNo != 0x12))       return(TRUE);    temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x11);    SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x11,0x80);    temp1 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x00);    SiS_SetReg(SiS_Pr->SiS_P3d4,0x00,0x55);    temp2 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x00);    SiS_SetReg(SiS_Pr->SiS_P3d4,0x00,temp1);    SiS_SetReg(SiS_Pr->SiS_P3d4,0x11,temp);    if((HwInfo->jChipType >= SIS_315H) ||       (HwInfo->jChipType == SIS_300)) {       if(temp2 == 0x55) return(FALSE);       else return(TRUE);    } else {       if(temp2 != 0x55) return(TRUE);       else {          SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x35,0x01);          return(FALSE);       }    }}static voidSiS_SetLowModeTest(SiS_Pri

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -