summaryrefslogtreecommitdiff
path: root/drivers/staging/xgifb/vb_setmode.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/xgifb/vb_setmode.c')
-rw-r--r--drivers/staging/xgifb/vb_setmode.c6072
1 files changed, 2817 insertions, 3255 deletions
diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
index e19b932492e1..9669c22cc82c 100644
--- a/drivers/staging/xgifb/vb_setmode.c
+++ b/drivers/staging/xgifb/vb_setmode.c
@@ -1,5 +1,6 @@
#include <asm/io.h>
+#include <linux/delay.h>
#include <linux/types.h>
#include <linux/version.h>
#include "XGIfb.h"
@@ -10,7 +11,7 @@
#include "vb_struct.h"
#include "vb_util.h"
#include "vb_table.h"
-
+#include "vb_setmode.h"
#define IndexMask 0xff
@@ -18,180 +19,6 @@
#define XGI_MASK_DUAL_CHIP 0x04 /* SR3A */
#endif
-
-
-unsigned char XGI_IsLCDDualLink(struct vb_device_info *pVBInfo);
-unsigned char XGI_SetCRT2Group301(unsigned short ModeNo,
- struct xgi_hw_device_info *HwDeviceExtension,
- struct vb_device_info *pVBInfo);
-unsigned char XGI_BacklightByDrv(struct vb_device_info *pVBInfo);
-
-unsigned char XGI_IsLCDON(struct vb_device_info *pVBInfo);
-unsigned char XGI_DisableChISLCD(struct vb_device_info *pVBInfo);
-unsigned char XGI_EnableChISLCD(struct vb_device_info *pVBInfo);
-unsigned char XGI_AjustCRT2Rate(unsigned short ModeNo,
- unsigned short ModeIdIndex,
- unsigned short RefreshRateTableIndex,
- unsigned short *i, struct vb_device_info *pVBInfo);
-unsigned char XGI_SearchModeID(unsigned short ModeNo,
- unsigned short *ModeIdIndex,
- struct vb_device_info *pVBInfo);
-unsigned char XGI_GetLCDInfo(unsigned short ModeNo,
- unsigned short ModeIdIndex,
- struct vb_device_info *pVBInfo);
-unsigned char XGISetModeNew(struct xgi_hw_device_info *HwDeviceExtension,
- unsigned short ModeNo);
-unsigned char XGI_BridgeIsOn(struct vb_device_info *pVBInfo);
-unsigned char XGI_GetModePtr(unsigned short ModeNo,
- unsigned short ModeIdIndex,
- struct vb_device_info *pVBInfo);
-unsigned short XGI_GetOffset(unsigned short ModeNo,
- unsigned short ModeIdIndex,
- unsigned short RefreshRateTableIndex,
- struct xgi_hw_device_info *HwDeviceExtension,
- struct vb_device_info *pVBInfo);
-unsigned short XGI_GetRatePtrCRT2(struct xgi_hw_device_info *pXGIHWDE,
- unsigned short ModeNo,
- unsigned short ModeIdIndex,
- struct vb_device_info *pVBInfo);
-unsigned short XGI_GetResInfo(unsigned short ModeNo,
- unsigned short ModeIdIndex,
- struct vb_device_info *pVBInfo);
-unsigned short XGI_GetColorDepth(unsigned short ModeNo,
- unsigned short ModeIdIndex,
- struct vb_device_info *pVBInfo);
-unsigned short XGI_GetVGAHT2(struct vb_device_info *pVBInfo);
-unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo,
- unsigned short ModeIdIndex,
- unsigned short RefreshRateTableIndex,
- struct xgi_hw_device_info *HwDeviceExtension,
- struct vb_device_info *pVBInfo);
-void XGI_VBLongWait(struct vb_device_info *pVBInfo);
-void XGI_SaveCRT2Info(unsigned short ModeNo, struct vb_device_info *pVBInfo);
-void XGI_GetCRT2Data(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-void XGI_GetCRT2ResInfo(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo);
-void XGI_PreSetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-void XGI_SetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-void XGI_SetLCDRegs(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo);
-void XGI_SetGroup3(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo);
-void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo);
-void XGI_SetGroup5(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo);
-void *XGI_GetLcdPtr(unsigned short BX, unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-void *XGI_GetTVPtr(unsigned short BX, unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-void XGI_FirePWDEnable(struct vb_device_info *pVBInfo);
-void XGI_EnableGatingCRT(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo);
-void XGI_DisableGatingCRT(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo);
-void XGI_SetPanelDelay(unsigned short tempbl, struct vb_device_info *pVBInfo);
-void XGI_SetPanelPower(unsigned short tempah, unsigned short tempbl, struct vb_device_info *pVBInfo);
-void XGI_EnablePWD(struct vb_device_info *pVBInfo);
-void XGI_DisablePWD(struct vb_device_info *pVBInfo);
-void XGI_AutoThreshold(struct vb_device_info *pVBInfo);
-void XGI_SetTap4Regs(struct vb_device_info *pVBInfo);
-
-void XGI_DisplayOn(struct xgi_hw_device_info *, struct vb_device_info *pVBInfo);
-void XGI_DisplayOff(struct xgi_hw_device_info *, struct vb_device_info *pVBInfo);
-void XGI_SetCRT1Group(struct xgi_hw_device_info *HwDeviceExtension, unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo);
-void XGI_SetXG21CRTC(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-void XGI_SetXG21LCD(struct vb_device_info *pVBInfo, unsigned short RefreshRateTableIndex, unsigned short ModeNo);
-void XGI_SetXG27CRTC(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-void XGI_SetXG27LCD(struct vb_device_info *pVBInfo, unsigned short RefreshRateTableIndex, unsigned short ModeNo);
-void XGI_UpdateXG21CRTC(unsigned short ModeNo, struct vb_device_info *pVBInfo, unsigned short RefreshRateTableIndex);
-void XGI_WaitDisply(struct vb_device_info *pVBInfo);
-void XGI_SenseCRT1(struct vb_device_info *pVBInfo);
-void XGI_SetSeqRegs(unsigned short ModeNo, unsigned short StandTableIndex, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo);
-void XGI_SetMiscRegs(unsigned short StandTableIndex, struct vb_device_info *pVBInfo);
-void XGI_SetCRTCRegs(struct xgi_hw_device_info *HwDeviceExtension, unsigned short StandTableIndex, struct vb_device_info *pVBInfo);
-void XGI_SetATTRegs(unsigned short ModeNo, unsigned short StandTableIndex, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo);
-void XGI_SetGRCRegs(unsigned short StandTableIndex, struct vb_device_info *pVBInfo);
-void XGI_ClearExt1Regs(struct vb_device_info *pVBInfo);
-
-void XGI_SetSync(unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-void XGI_SetCRT1CRTC(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo, struct xgi_hw_device_info *HwDeviceExtension);
-void XGI_SetCRT1Timing_H(struct vb_device_info *pVBInfo, struct xgi_hw_device_info *HwDeviceExtension);
-void XGI_SetCRT1Timing_V(unsigned short ModeIdIndex, unsigned short ModeNo, struct vb_device_info *pVBInfo);
-void XGI_SetCRT1DE(struct xgi_hw_device_info *HwDeviceExtension, unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-void XGI_SetCRT1VCLK(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-void XGI_SetCRT1FIFO(unsigned short ModeNo, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo);
-void XGI_SetCRT1ModeRegs(struct xgi_hw_device_info *HwDeviceExtension, unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-void XGI_SetVCLKState(struct xgi_hw_device_info *HwDeviceExtension, unsigned short ModeNo, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-
-void XGI_LoadDAC(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo);
-void XGI_WriteDAC(unsigned short dl, unsigned short ah, unsigned short al, unsigned short dh, struct vb_device_info *pVBInfo);
-/*void XGI_ClearBuffer(struct xgi_hw_device_info *HwDeviceExtension, unsigned short ModeNo, struct vb_device_info *pVBInfo);*/
-void XGI_SetLCDAGroup(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo);
-void XGI_GetLVDSResInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
- struct vb_device_info *pVBInfo);
-void XGI_GetLVDSData(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-unsigned short XGI_GetLVDSOEMTableIndex(struct vb_device_info *pVBInfo);
-void XGI_ModCRT1Regs(unsigned short ModeNo, unsigned short ModeIdIndex,
- unsigned short RefreshRateTableIndex,
- struct xgi_hw_device_info *HwDeviceExtension,
- struct vb_device_info *pVBInfo);
-void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-void XGI_UpdateModeInfo(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo);
-void XGI_GetVGAType(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo);
-void XGI_GetVBType(struct vb_device_info *pVBInfo);
-void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo);
-void XGI_GetTVInfo(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo);
-void XGI_SetCRT2ECLK(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-void InitTo330Pointer(unsigned char, struct vb_device_info *pVBInfo);
-void XGI_GetLCDSync(unsigned short *HSyncWidth, unsigned short *VSyncWidth, struct vb_device_info *pVBInfo);
-void XGI_DisableBridge(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo);
-void XGI_EnableBridge(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo);
-void XGI_SetCRT2VCLK(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-void XGI_OEM310Setting(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo);
-void XGI_SetDelayComp(struct vb_device_info *pVBInfo);
-void XGI_SetLCDCap(struct vb_device_info *pVBInfo);
-void XGI_SetLCDCap_A(unsigned short tempcx, struct vb_device_info *pVBInfo);
-void XGI_SetLCDCap_B(unsigned short tempcx, struct vb_device_info *pVBInfo);
-void SetSpectrum(struct vb_device_info *pVBInfo);
-void XGI_SetAntiFlicker(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo);
-void XGI_SetEdgeEnhance(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo);
-void XGI_SetPhaseIncr(struct vb_device_info *pVBInfo);
-void XGI_SetYFilter(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo);
-void XGI_GetTVPtrIndex2(unsigned short *tempbx, unsigned char* tempcl,
- unsigned char *tempch, struct vb_device_info *pVBInfo);
-unsigned short XGI_GetTVPtrIndex(struct vb_device_info *pVBInfo);
-void XGI_SetCRT2ModeRegs(unsigned short ModeNo, struct xgi_hw_device_info *, struct vb_device_info *pVBInfo);
-void XGI_CloseCRTC(struct xgi_hw_device_info *, struct vb_device_info *pVBInfo);
-void XGI_OpenCRTC(struct xgi_hw_device_info *, struct vb_device_info *pVBInfo);
-void XGI_GetRAMDAC2DATA(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct vb_device_info *pVBInfo);
-void XGI_UnLockCRT2(struct xgi_hw_device_info *, struct vb_device_info *pVBInfo);
-void XGI_LockCRT2(struct xgi_hw_device_info *, struct vb_device_info *pVBInfo);
-void XGINew_EnableCRT2(struct vb_device_info *pVBInfo);
-void XGINew_LCD_Wait_Time(unsigned char DelayTime, struct vb_device_info *pVBInfo);
-void XGI_LongWait(struct vb_device_info *pVBInfo);
-void XGI_SetCRT1Offset(unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo);
-void XGI_GetLCDVCLKPtr(unsigned char *di_0, unsigned char *di_1,
- struct vb_device_info *pVBInfo);
-unsigned char XGI_GetVCLKPtr(unsigned short RefreshRateTableIndex,
- unsigned short ModeNo,
- unsigned short ModeIdIndex,
- struct vb_device_info *pVBInfo);
-void XGI_GetVCLKLen(unsigned char tempal, unsigned char *di_0,
- unsigned char *di_1, struct vb_device_info *pVBInfo);
-unsigned short XGI_GetLCDCapPtr(struct vb_device_info *pVBInfo);
-unsigned short XGI_GetLCDCapPtr1(struct vb_device_info *pVBInfo);
-struct XGI301C_Tap4TimingStruct *XGI_GetTap4Ptr(unsigned short tempcx, struct vb_device_info *pVBInfo);
-void XGI_SetXG21FPBits(struct vb_device_info *pVBInfo);
-void XGI_SetXG27FPBits(struct vb_device_info *pVBInfo);
-unsigned char XGI_XG21GetPSCValue(struct vb_device_info *pVBInfo);
-unsigned char XGI_XG27GetPSCValue(struct vb_device_info *pVBInfo);
-void XGI_XG21BLSignalVDD(unsigned short tempbh, unsigned short tempbl, struct vb_device_info *pVBInfo);
-void XGI_XG27BLSignalVDD(unsigned short tempbh, unsigned short tempbl, struct vb_device_info *pVBInfo);
-void XGI_XG21SetPanelDelay(unsigned short tempbl, struct vb_device_info *pVBInfo);
-unsigned char XGI_XG21CheckLVDSMode(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo);
-void XGI_SetXG21LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo);
-void XGI_SetXG27LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo);
-unsigned char XGI_SetDefaultVCLK(struct vb_device_info *pVBInfo);
-
-extern void ReadVBIOSTablData(unsigned char ChipType, struct vb_device_info *pVBInfo);
-
-/* unsigned short XGINew_flag_clearbuffer; 0: no clear frame buffer 1:clear frame buffer */
-
-
static unsigned short XGINew_MDA_DAC[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15,
@@ -247,18 +74,8 @@ void InitTo330Pointer(unsigned char ChipType, struct vb_device_info *pVBInfo)
/* XGINew_UBLCDDataTable = (struct XGI_LCDDataTablStruct *) XGI_LCDDataTable; */
/* XGINew_UBTVDataTable = (XGI_TVDataTablStruct *) XGI_TVDataTable; */
- if (ChipType >= XG40) {
- pVBInfo->MCLKData
- = (struct XGI_MCLKDataStruct *) XGI340New_MCLKData;
- pVBInfo->ECLKData
- = (struct XGI_ECLKDataStruct *) XGI340_ECLKData;
- } else {
- pVBInfo->MCLKData
- = (struct XGI_MCLKDataStruct *) XGI330New_MCLKData;
- pVBInfo->ECLKData
- = (struct XGI_ECLKDataStruct *) XGI330_ECLKData;
- }
-
+ pVBInfo->MCLKData = (struct XGI_MCLKDataStruct *) XGI340New_MCLKData;
+ pVBInfo->ECLKData = (struct XGI_ECLKDataStruct *) XGI340_ECLKData;
pVBInfo->VCLKData = (struct XGI_VCLKDataStruct *) XGI_VCLKData;
pVBInfo->VBVCLKData = (struct XGI_VBVCLKDataStruct *) XGI_VBVCLKData;
pVBInfo->ScreenOffset = XGI330_ScreenOffset;
@@ -373,314 +190,7 @@ void InitTo330Pointer(unsigned char ChipType, struct vb_device_info *pVBInfo)
}
-unsigned char XGISetModeNew(struct xgi_hw_device_info *HwDeviceExtension,
- unsigned short ModeNo)
-{
- unsigned short ModeIdIndex;
- /* unsigned char *pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress; */
- struct vb_device_info VBINF;
- struct vb_device_info *pVBInfo = &VBINF;
- pVBInfo->ROMAddr = HwDeviceExtension->pjVirtualRomBase;
- pVBInfo->BaseAddr = (unsigned long) HwDeviceExtension->pjIOAddress;
- pVBInfo->IF_DEF_LVDS = 0;
- pVBInfo->IF_DEF_CH7005 = 0;
- pVBInfo->IF_DEF_LCDA = 1;
- pVBInfo->IF_DEF_CH7017 = 0;
- pVBInfo->IF_DEF_CH7007 = 0; /* [Billy] 2007/05/14 */
- pVBInfo->IF_DEF_VideoCapture = 0;
- pVBInfo->IF_DEF_ScaleLCD = 0;
- pVBInfo->IF_DEF_OEMUtil = 0;
- pVBInfo->IF_DEF_PWD = 0;
-
- if (HwDeviceExtension->jChipType >= XG20) { /* kuku 2004/06/25 */
- pVBInfo->IF_DEF_YPbPr = 0;
- pVBInfo->IF_DEF_HiVision = 0;
- pVBInfo->IF_DEF_CRT2Monitor = 0;
- pVBInfo->VBType = 0; /*set VBType default 0*/
- } else if (HwDeviceExtension->jChipType >= XG40) {
- pVBInfo->IF_DEF_YPbPr = 1;
- pVBInfo->IF_DEF_HiVision = 1;
- pVBInfo->IF_DEF_CRT2Monitor = 1;
- } else {
- pVBInfo->IF_DEF_YPbPr = 1;
- pVBInfo->IF_DEF_HiVision = 1;
- pVBInfo->IF_DEF_CRT2Monitor = 0;
- }
-
- pVBInfo->P3c4 = pVBInfo->BaseAddr + 0x14;
- pVBInfo->P3d4 = pVBInfo->BaseAddr + 0x24;
- pVBInfo->P3c0 = pVBInfo->BaseAddr + 0x10;
- pVBInfo->P3ce = pVBInfo->BaseAddr + 0x1e;
- pVBInfo->P3c2 = pVBInfo->BaseAddr + 0x12;
- pVBInfo->P3cc = pVBInfo->BaseAddr + 0x1C;
- pVBInfo->P3ca = pVBInfo->BaseAddr + 0x1a;
- pVBInfo->P3c6 = pVBInfo->BaseAddr + 0x16;
- pVBInfo->P3c7 = pVBInfo->BaseAddr + 0x17;
- pVBInfo->P3c8 = pVBInfo->BaseAddr + 0x18;
- pVBInfo->P3c9 = pVBInfo->BaseAddr + 0x19;
- pVBInfo->P3da = pVBInfo->BaseAddr + 0x2A;
- pVBInfo->Part0Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_00;
- pVBInfo->Part1Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_04;
- pVBInfo->Part2Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_10;
- pVBInfo->Part3Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_12;
- pVBInfo->Part4Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14;
- pVBInfo->Part5Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14 + 2;
-
- if (HwDeviceExtension->jChipType == XG21) { /* for x86 Linux, XG21 LVDS */
- if ((XGINew_GetReg1(pVBInfo->P3d4, 0x38) & 0xE0) == 0xC0)
- pVBInfo->IF_DEF_LVDS = 1;
- }
- if (HwDeviceExtension->jChipType == XG27) {
- if ((XGINew_GetReg1(pVBInfo->P3d4, 0x38) & 0xE0) == 0xC0) {
- if (XGINew_GetReg1(pVBInfo->P3d4, 0x30) & 0x20)
- pVBInfo->IF_DEF_LVDS = 1;
- }
- }
-
- if (HwDeviceExtension->jChipType < XG20) /* kuku 2004/06/25 */
- XGI_GetVBType(pVBInfo);
-
- InitTo330Pointer(HwDeviceExtension->jChipType, pVBInfo);
- if (ModeNo & 0x80) {
- ModeNo = ModeNo & 0x7F;
- /* XGINew_flag_clearbuffer = 0; */
- }
- /* else {
- XGINew_flag_clearbuffer = 1;
- }
- */
- XGINew_SetReg1(pVBInfo->P3c4, 0x05, 0x86);
-
- if (HwDeviceExtension->jChipType < XG20) /* kuku 2004/06/25 1.Openkey */
- XGI_UnLockCRT2(HwDeviceExtension, pVBInfo);
-
- XGI_SearchModeID(ModeNo, &ModeIdIndex, pVBInfo);
-
- XGI_GetVGAType(HwDeviceExtension, pVBInfo);
-
- if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */
- XGI_GetVBInfo(ModeNo, ModeIdIndex, HwDeviceExtension, pVBInfo);
- XGI_GetTVInfo(ModeNo, ModeIdIndex, pVBInfo);
- XGI_GetLCDInfo(ModeNo, ModeIdIndex, pVBInfo);
- XGI_DisableBridge(HwDeviceExtension, pVBInfo);
- /* XGI_OpenCRTC(HwDeviceExtension, pVBInfo); */
-
- if (pVBInfo->VBInfo & (SetSimuScanMode | SetCRT2ToLCDA)) {
- XGI_SetCRT1Group(HwDeviceExtension, ModeNo,
- ModeIdIndex, pVBInfo);
-
- if (pVBInfo->VBInfo & SetCRT2ToLCDA) {
- XGI_SetLCDAGroup(ModeNo, ModeIdIndex,
- HwDeviceExtension, pVBInfo);
- }
- } else {
- if (!(pVBInfo->VBInfo & SwitchToCRT2)) {
- XGI_SetCRT1Group(HwDeviceExtension, ModeNo,
- ModeIdIndex, pVBInfo);
- if (pVBInfo->VBInfo & SetCRT2ToLCDA) {
- XGI_SetLCDAGroup(ModeNo, ModeIdIndex,
- HwDeviceExtension,
- pVBInfo);
- }
- }
- }
-
- if (pVBInfo->VBInfo & (SetSimuScanMode | SwitchToCRT2)) {
- switch (HwDeviceExtension->ujVBChipID) {
- case VB_CHIP_301:
- XGI_SetCRT2Group301(ModeNo, HwDeviceExtension,
- pVBInfo); /*add for CRT2 */
- break;
-
- case VB_CHIP_302:
- XGI_SetCRT2Group301(ModeNo, HwDeviceExtension,
- pVBInfo); /*add for CRT2 */
- break;
-
- default:
- break;
- }
- }
-
- XGI_SetCRT2ModeRegs(ModeNo, HwDeviceExtension, pVBInfo);
- XGI_OEM310Setting(ModeNo, ModeIdIndex, pVBInfo); /*0212*/
- XGI_CloseCRTC(HwDeviceExtension, pVBInfo);
- XGI_EnableBridge(HwDeviceExtension, pVBInfo);
- } /* !XG20 */
- else {
- if (pVBInfo->IF_DEF_LVDS == 1)
- if (!XGI_XG21CheckLVDSMode(ModeNo, ModeIdIndex, pVBInfo))
- return 0;
-
- if (ModeNo <= 0x13) {
- pVBInfo->ModeType
- = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag
- & ModeInfoFlag;
- } else {
- pVBInfo->ModeType
- = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag
- & ModeInfoFlag;
- }
-
- pVBInfo->SetFlag = 0;
- if (pVBInfo->IF_DEF_CH7007 != 1)
- pVBInfo->VBInfo = DisableCRT2Display;
-
- XGI_DisplayOff(HwDeviceExtension, pVBInfo);
-
- XGI_SetCRT1Group(HwDeviceExtension, ModeNo, ModeIdIndex,
- pVBInfo);
-
- XGI_DisplayOn(HwDeviceExtension, pVBInfo);
- /*
- if (HwDeviceExtension->jChipType == XG21)
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x09, ~0x80, 0x80);
- */
- }
-
- /*
- if (ModeNo <= 0x13) {
- modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
- } else {
- modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
- }
- pVBInfo->ModeType = modeflag&ModeInfoFlag;
- pVBInfo->SetFlag = 0x00;
- pVBInfo->VBInfo = DisableCRT2Display;
- temp = XGINew_CheckMemorySize(HwDeviceExtension, ModeNo, ModeIdIndex, pVBInfo);
-
- if (temp == 0)
- return (0);
-
- XGI_DisplayOff(HwDeviceExtension, pVBInfo) ;
- XGI_SetCRT1Group(HwDeviceExtension, ModeNo, ModeIdIndex, pVBInfo);
- XGI_DisplayOn(HwDeviceExtension, pVBInfo);
- */
-
- XGI_UpdateModeInfo(HwDeviceExtension, pVBInfo);
-
- if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */
- XGI_LockCRT2(HwDeviceExtension, pVBInfo);
- }
-
- return 1;
-}
-
-void XGI_SetCRT1Group(struct xgi_hw_device_info *HwDeviceExtension,
- unsigned short ModeNo, unsigned short ModeIdIndex,
- struct vb_device_info *pVBInfo)
-{
- unsigned short StandTableIndex, RefreshRateTableIndex, b3CC, temp;
-
- unsigned short XGINew_P3cc = pVBInfo->P3cc;
-
- /* XGINew_CRT1Mode = ModeNo; // SaveModeID */
- StandTableIndex = XGI_GetModePtr(ModeNo, ModeIdIndex, pVBInfo);
- /* XGI_SetBIOSData(ModeNo, ModeIdIndex); */
- /* XGI_ClearBankRegs(ModeNo, ModeIdIndex); */
- XGI_SetSeqRegs(ModeNo, StandTableIndex, ModeIdIndex, pVBInfo);
- XGI_SetMiscRegs(StandTableIndex, pVBInfo);
- XGI_SetCRTCRegs(HwDeviceExtension, StandTableIndex, pVBInfo);
- XGI_SetATTRegs(ModeNo, StandTableIndex, ModeIdIndex, pVBInfo);
- XGI_SetGRCRegs(StandTableIndex, pVBInfo);
- XGI_ClearExt1Regs(pVBInfo);
-
- /* if (pVBInfo->IF_DEF_ExpLink) */
- if (HwDeviceExtension->jChipType == XG27) {
- if (pVBInfo->IF_DEF_LVDS == 0)
- XGI_SetDefaultVCLK(pVBInfo);
- }
-
- temp = ~ProgrammingCRT2;
- pVBInfo->SetFlag &= temp;
- pVBInfo->SelectCRT2Rate = 0;
-
- if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
- | VB_XGI302LV | VB_XGI301C)) {
- if (pVBInfo->VBInfo & (SetSimuScanMode | SetCRT2ToLCDA
- | SetInSlaveMode)) {
- pVBInfo->SetFlag |= ProgrammingCRT2;
- }
- }
-
- RefreshRateTableIndex = XGI_GetRatePtrCRT2(HwDeviceExtension, ModeNo,
- ModeIdIndex, pVBInfo);
- if (RefreshRateTableIndex != 0xFFFF) {
- XGI_SetSync(RefreshRateTableIndex, pVBInfo);
- XGI_SetCRT1CRTC(ModeNo, ModeIdIndex, RefreshRateTableIndex,
- pVBInfo, HwDeviceExtension);
- XGI_SetCRT1DE(HwDeviceExtension, ModeNo, ModeIdIndex,
- RefreshRateTableIndex, pVBInfo);
- XGI_SetCRT1Offset(ModeNo, ModeIdIndex, RefreshRateTableIndex,
- HwDeviceExtension, pVBInfo);
- XGI_SetCRT1VCLK(ModeNo, ModeIdIndex, HwDeviceExtension,
- RefreshRateTableIndex, pVBInfo);
- }
-
- if ((HwDeviceExtension->jChipType >= XG20)
- && (HwDeviceExtension->jChipType < XG27)) { /* fix H/W DCLK/2 bug */
- if ((ModeNo == 0x00) | (ModeNo == 0x01)) {
- XGINew_SetReg1(pVBInfo->P3c4, 0x2B, 0x4E);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2C, 0xE9);
- b3CC = (unsigned char) XGINew_GetReg2(XGINew_P3cc);
- XGINew_SetReg3(XGINew_P3cc, (b3CC |= 0x0C));
- } else if ((ModeNo == 0x04) | (ModeNo == 0x05) | (ModeNo
- == 0x0D)) {
- XGINew_SetReg1(pVBInfo->P3c4, 0x2B, 0x1B);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2C, 0xE3);
- b3CC = (unsigned char) XGINew_GetReg2(XGINew_P3cc);
- XGINew_SetReg3(XGINew_P3cc, (b3CC |= 0x0C));
- }
- }
-
- if (HwDeviceExtension->jChipType >= XG21) {
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x38);
- if (temp & 0xA0) {
-
- /* XGINew_SetRegAND(pVBInfo->P3d4, 0x4A, ~0x20); *//* Enable write GPIOF */
- /* XGINew_SetRegAND(pVBInfo->P3d4, 0x48, ~0x20); *//* P. DWN */
- /* XG21 CRT1 Timing */
- if (HwDeviceExtension->jChipType == XG27)
- XGI_SetXG27CRTC(ModeNo, ModeIdIndex,
- RefreshRateTableIndex, pVBInfo);
- else
- XGI_SetXG21CRTC(ModeNo, ModeIdIndex,
- RefreshRateTableIndex, pVBInfo);
-
- XGI_UpdateXG21CRTC(ModeNo, pVBInfo,
- RefreshRateTableIndex);
-
- if (HwDeviceExtension->jChipType == XG27)
- XGI_SetXG27LCD(pVBInfo, RefreshRateTableIndex,
- ModeNo);
- else
- XGI_SetXG21LCD(pVBInfo, RefreshRateTableIndex,
- ModeNo);
-
- if (pVBInfo->IF_DEF_LVDS == 1) {
- if (HwDeviceExtension->jChipType == XG27)
- XGI_SetXG27LVDSPara(ModeNo,
- ModeIdIndex, pVBInfo);
- else
- XGI_SetXG21LVDSPara(ModeNo,
- ModeIdIndex, pVBInfo);
- }
- /* XGINew_SetRegOR(pVBInfo->P3d4, 0x48, 0x20); *//* P. ON */
- }
- }
-
- pVBInfo->SetFlag &= (~ProgrammingCRT2);
- XGI_SetCRT1FIFO(ModeNo, HwDeviceExtension, pVBInfo);
- XGI_SetCRT1ModeRegs(HwDeviceExtension, ModeNo, ModeIdIndex,
- RefreshRateTableIndex, pVBInfo);
-
- /* XGI_LoadCharacter(); //dif ifdef TVFont */
-
- XGI_LoadDAC(ModeNo, ModeIdIndex, pVBInfo);
- /* XGI_ClearBuffer(HwDeviceExtension, ModeNo, pVBInfo); */
-}
-
-unsigned char XGI_GetModePtr(unsigned short ModeNo, unsigned short ModeIdIndex,
+static unsigned char XGI_GetModePtr(unsigned short ModeNo, unsigned short ModeIdIndex,
struct vb_device_info *pVBInfo)
{
unsigned char index;
@@ -707,7 +217,7 @@ unsigned char XGI_SetBIOSData(unsigned short ModeNo, unsigned short ModeIdIndex)
}
*/
-void XGI_SetSeqRegs(unsigned short ModeNo, unsigned short StandTableIndex,
+static void XGI_SetSeqRegs(unsigned short ModeNo, unsigned short StandTableIndex,
unsigned short ModeIdIndex, struct vb_device_info *pVBInfo)
{
unsigned char tempah, SRdata;
@@ -719,7 +229,7 @@ void XGI_SetSeqRegs(unsigned short ModeNo, unsigned short StandTableIndex,
else
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
- XGINew_SetReg1(pVBInfo->P3c4, 0x00, 0x03); /* Set SR0 */
+ xgifb_reg_set(pVBInfo->P3c4, 0x00, 0x03); /* Set SR0 */
tempah = pVBInfo->StandTable[StandTableIndex].SR[0];
i = SetCRT2ToLCDA;
@@ -733,15 +243,15 @@ void XGI_SetSeqRegs(unsigned short ModeNo, unsigned short StandTableIndex,
}
tempah |= 0x20; /* screen off */
- XGINew_SetReg1(pVBInfo->P3c4, 0x01, tempah); /* Set SR1 */
+ xgifb_reg_set(pVBInfo->P3c4, 0x01, tempah); /* Set SR1 */
for (i = 02; i <= 04; i++) {
SRdata = pVBInfo->StandTable[StandTableIndex].SR[i - 1]; /* Get SR2,3,4 from file */
- XGINew_SetReg1(pVBInfo->P3c4, i, SRdata); /* Set SR2 3 4 */
+ xgifb_reg_set(pVBInfo->P3c4, i, SRdata); /* Set SR2 3 4 */
}
}
-void XGI_SetMiscRegs(unsigned short StandTableIndex,
+static void XGI_SetMiscRegs(unsigned short StandTableIndex,
struct vb_device_info *pVBInfo)
{
unsigned char Miscdata;
@@ -755,35 +265,35 @@ void XGI_SetMiscRegs(unsigned short StandTableIndex,
}
*/
- XGINew_SetReg3(pVBInfo->P3c2, Miscdata); /* Set Misc(3c2) */
+ outb(Miscdata, pVBInfo->P3c2); /* Set Misc(3c2) */
}
-void XGI_SetCRTCRegs(struct xgi_hw_device_info *HwDeviceExtension,
+static void XGI_SetCRTCRegs(struct xgi_hw_device_info *HwDeviceExtension,
unsigned short StandTableIndex, struct vb_device_info *pVBInfo)
{
unsigned char CRTCdata;
unsigned short i;
- CRTCdata = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x11);
+ CRTCdata = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x11);
CRTCdata &= 0x7f;
- XGINew_SetReg1(pVBInfo->P3d4, 0x11, CRTCdata); /* Unlock CRTC */
+ xgifb_reg_set(pVBInfo->P3d4, 0x11, CRTCdata); /* Unlock CRTC */
for (i = 0; i <= 0x18; i++) {
CRTCdata = pVBInfo->StandTable[StandTableIndex].CRTC[i]; /* Get CRTC from file */
- XGINew_SetReg1(pVBInfo->P3d4, i, CRTCdata); /* Set CRTC(3d4) */
+ xgifb_reg_set(pVBInfo->P3d4, i, CRTCdata); /* Set CRTC(3d4) */
}
/*
if ((HwDeviceExtension->jChipType == XGI_630) && (HwDeviceExtension->jChipRevision == 0x30)) {
if (pVBInfo->VBInfo & SetInSlaveMode) {
if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToTV)) {
- XGINew_SetReg1(pVBInfo->P3d4, 0x18, 0xFE);
+ xgifb_reg_set(pVBInfo->P3d4, 0x18, 0xFE);
}
}
}
*/
}
-void XGI_SetATTRegs(unsigned short ModeNo, unsigned short StandTableIndex,
+static void XGI_SetATTRegs(unsigned short ModeNo, unsigned short StandTableIndex,
unsigned short ModeIdIndex, struct vb_device_info *pVBInfo)
{
unsigned char ARdata;
@@ -811,19 +321,19 @@ void XGI_SetATTRegs(unsigned short ModeNo, unsigned short StandTableIndex,
}
}
- XGINew_GetReg2(pVBInfo->P3da); /* reset 3da */
- XGINew_SetReg3(pVBInfo->P3c0, i); /* set index */
- XGINew_SetReg3(pVBInfo->P3c0, ARdata); /* set data */
+ inb(pVBInfo->P3da); /* reset 3da */
+ outb(i, pVBInfo->P3c0); /* set index */
+ outb(ARdata, pVBInfo->P3c0); /* set data */
}
- XGINew_GetReg2(pVBInfo->P3da); /* reset 3da */
- XGINew_SetReg3(pVBInfo->P3c0, 0x14); /* set index */
- XGINew_SetReg3(pVBInfo->P3c0, 0x00); /* set data */
- XGINew_GetReg2(pVBInfo->P3da); /* Enable Attribute */
- XGINew_SetReg3(pVBInfo->P3c0, 0x20);
+ inb(pVBInfo->P3da); /* reset 3da */
+ outb(0x14, pVBInfo->P3c0); /* set index */
+ outb(0x00, pVBInfo->P3c0); /* set data */
+ inb(pVBInfo->P3da); /* Enable Attribute */
+ outb(0x20, pVBInfo->P3c0);
}
-void XGI_SetGRCRegs(unsigned short StandTableIndex,
+static void XGI_SetGRCRegs(unsigned short StandTableIndex,
struct vb_device_info *pVBInfo)
{
unsigned char GRdata;
@@ -831,159 +341,40 @@ void XGI_SetGRCRegs(unsigned short StandTableIndex,
for (i = 0; i <= 0x08; i++) {
GRdata = pVBInfo->StandTable[StandTableIndex].GRC[i]; /* Get GR from file */
- XGINew_SetReg1(pVBInfo->P3ce, i, GRdata); /* Set GR(3ce) */
+ xgifb_reg_set(pVBInfo->P3ce, i, GRdata); /* Set GR(3ce) */
}
if (pVBInfo->ModeType > ModeVGA) {
- GRdata = (unsigned char) XGINew_GetReg1(pVBInfo->P3ce, 0x05);
+ GRdata = (unsigned char) xgifb_reg_get(pVBInfo->P3ce, 0x05);
GRdata &= 0xBF; /* 256 color disable */
- XGINew_SetReg1(pVBInfo->P3ce, 0x05, GRdata);
+ xgifb_reg_set(pVBInfo->P3ce, 0x05, GRdata);
}
}
-void XGI_ClearExt1Regs(struct vb_device_info *pVBInfo)
+static void XGI_ClearExt1Regs(struct vb_device_info *pVBInfo)
{
unsigned short i;
for (i = 0x0A; i <= 0x0E; i++)
- XGINew_SetReg1(pVBInfo->P3c4, i, 0x00); /* Clear SR0A-SR0E */
+ xgifb_reg_set(pVBInfo->P3c4, i, 0x00); /* Clear SR0A-SR0E */
}
-unsigned char XGI_SetDefaultVCLK(struct vb_device_info *pVBInfo)
+static unsigned char XGI_SetDefaultVCLK(struct vb_device_info *pVBInfo)
{
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x31, ~0x30, 0x20);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2B, pVBInfo->VCLKData[0].SR2B);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2C, pVBInfo->VCLKData[0].SR2C);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x31, ~0x30, 0x20);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2B, pVBInfo->VCLKData[0].SR2B);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2C, pVBInfo->VCLKData[0].SR2C);
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x31, ~0x30, 0x10);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2B, pVBInfo->VCLKData[1].SR2B);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2C, pVBInfo->VCLKData[1].SR2C);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x31, ~0x30, 0x10);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2B, pVBInfo->VCLKData[1].SR2B);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2C, pVBInfo->VCLKData[1].SR2C);
- XGINew_SetRegAND(pVBInfo->P3c4, 0x31, ~0x30);
+ xgifb_reg_and(pVBInfo->P3c4, 0x31, ~0x30);
return 0;
}
-unsigned short XGI_GetRatePtrCRT2(struct xgi_hw_device_info *pXGIHWDE,
- unsigned short ModeNo, unsigned short ModeIdIndex,
- struct vb_device_info *pVBInfo)
-{
- short LCDRefreshIndex[] = { 0x00, 0x00, 0x03, 0x01 },
- LCDARefreshIndex[] = { 0x00, 0x00, 0x03, 0x01, 0x01,
- 0x01, 0x01 };
-
- unsigned short RefreshRateTableIndex, i, modeflag, index, temp;
-
- if (ModeNo <= 0x13)
- modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
- else
- modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
-
- if (pVBInfo->IF_DEF_CH7005 == 1) {
- if (pVBInfo->VBInfo & SetCRT2ToTV) {
- if (modeflag & HalfDCLK)
- return 0;
- }
- }
-
- if (ModeNo < 0x14)
- return 0xFFFF;
-
- index = XGINew_GetReg1(pVBInfo->P3d4, 0x33);
- index = index >> pVBInfo->SelectCRT2Rate;
- index &= 0x0F;
-
- if (pVBInfo->LCDInfo & LCDNonExpanding)
- index = 0;
-
- if (index > 0)
- index--;
-
- if (pVBInfo->SetFlag & ProgrammingCRT2) {
- if (pVBInfo->IF_DEF_CH7005 == 1) {
- if (pVBInfo->VBInfo & SetCRT2ToTV)
- index = 0;
- }
-
- if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
- if (pVBInfo->IF_DEF_LVDS == 0) {
- if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B
- | VB_XGI301LV | VB_XGI302LV
- | VB_XGI301C))
- temp
- = LCDARefreshIndex[pVBInfo->LCDResInfo
- & 0x0F]; /* 301b */
- else
- temp
- = LCDRefreshIndex[pVBInfo->LCDResInfo
- & 0x0F];
-
- if (index > temp)
- index = temp;
- } else {
- index = 0;
- }
- }
- }
-
- RefreshRateTableIndex = pVBInfo->EModeIDTable[ModeIdIndex].REFindex;
- ModeNo = pVBInfo->RefIndex[RefreshRateTableIndex].ModeID;
- if (pXGIHWDE->jChipType >= XG20) { /* for XG20, XG21, XG27 */
- /*
- if (pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag & XG2xNotSupport) {
- index++;
- }
- */
- if ((pVBInfo->RefIndex[RefreshRateTableIndex].XRes == 800)
- && (pVBInfo->RefIndex[RefreshRateTableIndex].YRes
- == 600)) {
- index++;
- }
- /* Alan 10/19/2007; do the similiar adjustment like XGISearchCRT1Rate() */
- if ((pVBInfo->RefIndex[RefreshRateTableIndex].XRes == 1024)
- && (pVBInfo->RefIndex[RefreshRateTableIndex].YRes
- == 768)) {
- index++;
- }
- if ((pVBInfo->RefIndex[RefreshRateTableIndex].XRes == 1280)
- && (pVBInfo->RefIndex[RefreshRateTableIndex].YRes
- == 1024)) {
- index++;
- }
- }
-
- i = 0;
- do {
- if (pVBInfo->RefIndex[RefreshRateTableIndex + i].ModeID
- != ModeNo)
- break;
- temp
- = pVBInfo->RefIndex[RefreshRateTableIndex + i].Ext_InfoFlag;
- temp &= ModeInfoFlag;
- if (temp < pVBInfo->ModeType)
- break;
- i++;
- index--;
-
- } while (index != 0xFFFF);
- if (!(pVBInfo->VBInfo & SetCRT2ToRAMDAC)) {
- if (pVBInfo->VBInfo & SetInSlaveMode) {
- temp
- = pVBInfo->RefIndex[RefreshRateTableIndex
- + i - 1].Ext_InfoFlag;
- if (temp & InterlaceMode)
- i++;
- }
- }
- i--;
- if ((pVBInfo->SetFlag & ProgrammingCRT2)) {
- temp = XGI_AjustCRT2Rate(ModeNo, ModeIdIndex,
- RefreshRateTableIndex, &i, pVBInfo);
- }
- return RefreshRateTableIndex + i; /* return (0x01 | (temp1<<1)); */
-}
-
-unsigned char XGI_AjustCRT2Rate(unsigned short ModeNo,
+static unsigned char XGI_AjustCRT2Rate(unsigned short ModeNo,
unsigned short ModeIdIndex,
unsigned short RefreshRateTableIndex, unsigned short *i,
struct vb_device_info *pVBInfo)
@@ -1125,7 +516,7 @@ unsigned char XGI_AjustCRT2Rate(unsigned short ModeNo,
return 1;
}
-void XGI_SetSync(unsigned short RefreshRateTableIndex,
+static void XGI_SetSync(unsigned short RefreshRateTableIndex,
struct vb_device_info *pVBInfo)
{
unsigned short sync, temp;
@@ -1134,134 +525,103 @@ void XGI_SetSync(unsigned short RefreshRateTableIndex,
sync &= 0xC0;
temp = 0x2F;
temp |= sync;
- XGINew_SetReg3(pVBInfo->P3c2, temp); /* Set Misc(3c2) */
+ outb(temp, pVBInfo->P3c2); /* Set Misc(3c2) */
}
-void XGI_SetCRT1CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
- unsigned short RefreshRateTableIndex,
- struct vb_device_info *pVBInfo,
- struct xgi_hw_device_info *HwDeviceExtension)
-{
- unsigned char index, data;
- unsigned short i;
-
- index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; /* Get index */
- index = index & IndexMask;
-
- data = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x11);
- data &= 0x7F;
- XGINew_SetReg1(pVBInfo->P3d4, 0x11, data); /* Unlock CRTC */
-
- for (i = 0; i < 8; i++)
- pVBInfo->TimingH[0].data[i]
- = pVBInfo->XGINEWUB_CRT1Table[index].CR[i];
-
- for (i = 0; i < 7; i++)
- pVBInfo->TimingV[0].data[i]
- = pVBInfo->XGINEWUB_CRT1Table[index].CR[i + 8];
-
- XGI_SetCRT1Timing_H(pVBInfo, HwDeviceExtension);
-
- XGI_SetCRT1Timing_V(ModeIdIndex, ModeNo, pVBInfo);
-
- if (pVBInfo->ModeType > 0x03)
- XGINew_SetReg1(pVBInfo->P3d4, 0x14, 0x4F);
-}
-
-void XGI_SetCRT1Timing_H(struct vb_device_info *pVBInfo,
+static void XGI_SetCRT1Timing_H(struct vb_device_info *pVBInfo,
struct xgi_hw_device_info *HwDeviceExtension)
{
unsigned char data, data1, pushax;
unsigned short i, j;
- /* XGINew_SetReg1(pVBInfo->P3d4, 0x51, 0); */
- /* XGINew_SetReg1(pVBInfo->P3d4, 0x56, 0); */
- /* XGINew_SetRegANDOR(pVBInfo->P3d4, 0x11, 0x7f, 0x00); */
+ /* xgifb_reg_set(pVBInfo->P3d4, 0x51, 0); */
+ /* xgifb_reg_set(pVBInfo->P3d4, 0x56, 0); */
+ /* xgifb_reg_and_or(pVBInfo->P3d4, 0x11, 0x7f, 0x00); */
- data = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x11); /* unlock cr0-7 */
+ data = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x11); /* unlock cr0-7 */
data &= 0x7F;
- XGINew_SetReg1(pVBInfo->P3d4, 0x11, data);
+ xgifb_reg_set(pVBInfo->P3d4, 0x11, data);
data = pVBInfo->TimingH[0].data[0];
- XGINew_SetReg1(pVBInfo->P3d4, 0, data);
+ xgifb_reg_set(pVBInfo->P3d4, 0, data);
for (i = 0x01; i <= 0x04; i++) {
data = pVBInfo->TimingH[0].data[i];
- XGINew_SetReg1(pVBInfo->P3d4, (unsigned short) (i + 1), data);
+ xgifb_reg_set(pVBInfo->P3d4, (unsigned short) (i + 1), data);
}
for (i = 0x05; i <= 0x06; i++) {
data = pVBInfo->TimingH[0].data[i];
- XGINew_SetReg1(pVBInfo->P3c4, (unsigned short) (i + 6), data);
+ xgifb_reg_set(pVBInfo->P3c4, (unsigned short) (i + 6), data);
}
- j = (unsigned char) XGINew_GetReg1(pVBInfo->P3c4, 0x0e);
+ j = (unsigned char) xgifb_reg_get(pVBInfo->P3c4, 0x0e);
j &= 0x1F;
data = pVBInfo->TimingH[0].data[7];
data &= 0xE0;
data |= j;
- XGINew_SetReg1(pVBInfo->P3c4, 0x0e, data);
+ xgifb_reg_set(pVBInfo->P3c4, 0x0e, data);
if (HwDeviceExtension->jChipType >= XG20) {
- data = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x04);
+ data = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x04);
data = data - 1;
- XGINew_SetReg1(pVBInfo->P3d4, 0x04, data);
- data = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x05);
+ xgifb_reg_set(pVBInfo->P3d4, 0x04, data);
+ data = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x05);
data1 = data;
data1 &= 0xE0;
data &= 0x1F;
if (data == 0) {
pushax = data;
- data = (unsigned char) XGINew_GetReg1(pVBInfo->P3c4,
+ data = (unsigned char) xgifb_reg_get(pVBInfo->P3c4,
0x0c);
data &= 0xFB;
- XGINew_SetReg1(pVBInfo->P3c4, 0x0c, data);
+ xgifb_reg_set(pVBInfo->P3c4, 0x0c, data);
data = pushax;
}
data = data - 1;
data |= data1;
- XGINew_SetReg1(pVBInfo->P3d4, 0x05, data);
- data = (unsigned char) XGINew_GetReg1(pVBInfo->P3c4, 0x0e);
+ xgifb_reg_set(pVBInfo->P3d4, 0x05, data);
+ data = (unsigned char) xgifb_reg_get(pVBInfo->P3c4, 0x0e);
data = data >> 5;
data = data + 3;
if (data > 7)
data = data - 7;
data = data << 5;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0e, ~0xE0, data);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0e, ~0xE0, data);
}
}
-void XGI_SetCRT1Timing_V(unsigned short ModeIdIndex, unsigned short ModeNo,
+static void XGI_SetCRT1Timing_V(unsigned short ModeIdIndex, unsigned short ModeNo,
struct vb_device_info *pVBInfo)
{
unsigned char data;
unsigned short i, j;
- /* XGINew_SetReg1(pVBInfo->P3d4, 0x51, 0); */
- /* XGINew_SetReg1(pVBInfo->P3d4, 0x56, 0); */
- /* XGINew_SetRegANDOR(pVBInfo->P3d4, 0x11, 0x7f, 0x00); */
+ /* xgifb_reg_set(pVBInfo->P3d4, 0x51, 0); */
+ /* xgifb_reg_set(pVBInfo->P3d4, 0x56, 0); */
+ /* xgifb_reg_and_or(pVBInfo->P3d4, 0x11, 0x7f, 0x00); */
for (i = 0x00; i <= 0x01; i++) {
data = pVBInfo->TimingV[0].data[i];
- XGINew_SetReg1(pVBInfo->P3d4, (unsigned short) (i + 6), data);
+ xgifb_reg_set(pVBInfo->P3d4, (unsigned short) (i + 6), data);
}
for (i = 0x02; i <= 0x03; i++) {
data = pVBInfo->TimingV[0].data[i];
- XGINew_SetReg1(pVBInfo->P3d4, (unsigned short) (i + 0x0e), data);
+ xgifb_reg_set(pVBInfo->P3d4, (unsigned short) (i + 0x0e), data);
}
for (i = 0x04; i <= 0x05; i++) {
data = pVBInfo->TimingV[0].data[i];
- XGINew_SetReg1(pVBInfo->P3d4, (unsigned short) (i + 0x11), data);
+ xgifb_reg_set(pVBInfo->P3d4, (unsigned short) (i + 0x11), data);
}
- j = (unsigned char) XGINew_GetReg1(pVBInfo->P3c4, 0x0a);
+ j = (unsigned char) xgifb_reg_get(pVBInfo->P3c4, 0x0a);
j &= 0xC0;
data = pVBInfo->TimingV[0].data[6];
data &= 0x3F;
data |= j;
- XGINew_SetReg1(pVBInfo->P3c4, 0x0a, data);
+ xgifb_reg_set(pVBInfo->P3c4, 0x0a, data);
data = pVBInfo->TimingV[0].data[6];
data &= 0x80;
@@ -1276,10 +636,41 @@ void XGI_SetCRT1Timing_V(unsigned short ModeIdIndex, unsigned short ModeNo,
if (i)
data |= 0x80;
- j = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x09);
+ j = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x09);
j &= 0x5F;
data |= j;
- XGINew_SetReg1(pVBInfo->P3d4, 0x09, data);
+ xgifb_reg_set(pVBInfo->P3d4, 0x09, data);
+}
+
+static void XGI_SetCRT1CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
+ unsigned short RefreshRateTableIndex,
+ struct vb_device_info *pVBInfo,
+ struct xgi_hw_device_info *HwDeviceExtension)
+{
+ unsigned char index, data;
+ unsigned short i;
+
+ index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; /* Get index */
+ index = index & IndexMask;
+
+ data = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x11);
+ data &= 0x7F;
+ xgifb_reg_set(pVBInfo->P3d4, 0x11, data); /* Unlock CRTC */
+
+ for (i = 0; i < 8; i++)
+ pVBInfo->TimingH[0].data[i]
+ = pVBInfo->XGINEWUB_CRT1Table[index].CR[i];
+
+ for (i = 0; i < 7; i++)
+ pVBInfo->TimingV[0].data[i]
+ = pVBInfo->XGINEWUB_CRT1Table[index].CR[i + 8];
+
+ XGI_SetCRT1Timing_H(pVBInfo, HwDeviceExtension);
+
+ XGI_SetCRT1Timing_V(ModeIdIndex, ModeNo, pVBInfo);
+
+ if (pVBInfo->ModeType > 0x03)
+ xgifb_reg_set(pVBInfo->P3d4, 0x14, 0x4F);
}
/* --------------------------------------------------------------------- */
@@ -1288,7 +679,7 @@ void XGI_SetCRT1Timing_V(unsigned short ModeIdIndex, unsigned short ModeNo,
/* Output : Fill CRT Hsync/Vsync to SR2E/SR2F/SR30/SR33/SR34/SR3F */
/* Description : Set LCD timing */
/* --------------------------------------------------------------------- */
-void XGI_SetXG21CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_SetXG21CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
unsigned short RefreshRateTableIndex,
struct vb_device_info *pVBInfo)
{
@@ -1298,7 +689,7 @@ void XGI_SetXG21CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
if (ModeNo <= 0x13) {
StandTableIndex = XGI_GetModePtr(ModeNo, ModeIdIndex, pVBInfo);
Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[4]; /* CR04 HRS */
- XGINew_SetReg1(pVBInfo->P3c4, 0x2E, Tempax); /* SR2E [7:0]->HRS */
+ xgifb_reg_set(pVBInfo->P3c4, 0x2E, Tempax); /* SR2E [7:0]->HRS */
Tempbx = pVBInfo->StandTable[StandTableIndex].CRTC[5]; /* Tempbx: CR05 HRE */
Tempbx &= 0x1F; /* Tempbx: HRE[4:0] */
Tempcx = Tempax;
@@ -1307,19 +698,19 @@ void XGI_SetXG21CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
if (Tempbx < (Tempax & 0x1F)) /* IF HRE < HRS */
Tempdx |= 0x20; /* Tempdx: HRE = HRE + 0x20 */
Tempdx <<= 2; /* Tempdx << 2 */
- XGINew_SetReg1(pVBInfo->P3c4, 0x2F, Tempdx); /* SR2F [7:2]->HRE */
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x30, 0xE3, 00);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2F, Tempdx); /* SR2F [7:2]->HRE */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x30, 0xE3, 00);
Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[16]; /* Tempax: CR16 VRS */
Tempbx = Tempax; /* Tempbx=Tempax */
Tempax &= 0x01; /* Tempax: VRS[0] */
- XGINew_SetRegOR(pVBInfo->P3c4, 0x33, Tempax); /* SR33[0]->VRS */
+ xgifb_reg_or(pVBInfo->P3c4, 0x33, Tempax); /* SR33[0]->VRS */
Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[7]; /* Tempax: CR7 VRS */
Tempdx = Tempbx >> 1; /* Tempdx: VRS[7:1] */
Tempcx = Tempax & 0x04; /* Tempcx: CR7[2] */
Tempcx <<= 5; /* Tempcx[7]: VRS[8] */
Tempdx |= Tempcx; /* Tempdx: VRS[8:1] */
- XGINew_SetReg1(pVBInfo->P3c4, 0x34, Tempdx); /* SR34[7:0]: VRS[8:1] */
+ xgifb_reg_set(pVBInfo->P3c4, 0x34, Tempdx); /* SR34[7:0]: VRS[8:1] */
Temp1 = Tempcx << 1; /* Temp1[8]: VRS[8] unsigned char -> unsigned short */
Temp1 |= Tempbx; /* Temp1[8:0]: VRS[8:0] */
@@ -1342,12 +733,12 @@ void XGI_SetXG21CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
Tempbx = (unsigned char) Temp1; /* Tempbx[1:0]: VRS[10:9] */
Tempax |= Tempbx; /* VRE[5:0]VRS[10:9] */
Tempax &= 0x7F;
- XGINew_SetReg1(pVBInfo->P3c4, 0x3F, Tempax); /* SR3F D[7:2]->VRE D[1:0]->VRS */
+ xgifb_reg_set(pVBInfo->P3c4, 0x3F, Tempax); /* SR3F D[7:2]->VRE D[1:0]->VRS */
} else {
index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[3]; /* Tempax: CR4 HRS */
Tempcx = Tempax; /* Tempcx: HRS */
- XGINew_SetReg1(pVBInfo->P3c4, 0x2E, Tempax); /* SR2E[7:0]->HRS */
+ xgifb_reg_set(pVBInfo->P3c4, 0x2E, Tempax); /* SR2E[7:0]->HRS */
Tempdx = pVBInfo->XGINEWUB_CRT1Table[index].CR[5]; /* SRB */
Tempdx &= 0xC0; /* Tempdx[7:6]: SRB[7:6] */
@@ -1375,19 +766,19 @@ void XGI_SetXG21CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
Tempax <<= 2; /* Tempax[7:2]: HRE[5:0] */
Tempdx >>= 6; /* Tempdx[7:6]->[1:0] HRS[9:8] */
Tempax |= Tempdx; /* HRE[5:0]HRS[9:8] */
- XGINew_SetReg1(pVBInfo->P3c4, 0x2F, Tempax); /* SR2F D[7:2]->HRE, D[1:0]->HRS */
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x30, 0xE3, 00);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2F, Tempax); /* SR2F D[7:2]->HRE, D[1:0]->HRS */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x30, 0xE3, 00);
Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[10]; /* CR10 VRS */
Tempbx = Tempax; /* Tempbx: VRS */
Tempax &= 0x01; /* Tempax[0]: VRS[0] */
- XGINew_SetRegOR(pVBInfo->P3c4, 0x33, Tempax); /* SR33[0]->VRS[0] */
+ xgifb_reg_or(pVBInfo->P3c4, 0x33, Tempax); /* SR33[0]->VRS[0] */
Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[9]; /* CR7[2][7] VRE */
Tempcx = Tempbx >> 1; /* Tempcx[6:0]: VRS[7:1] */
Tempdx = Tempax & 0x04; /* Tempdx[2]: CR7[2] */
Tempdx <<= 5; /* Tempdx[7]: VRS[8] */
Tempcx |= Tempdx; /* Tempcx[7:0]: VRS[8:1] */
- XGINew_SetReg1(pVBInfo->P3c4, 0x34, Tempcx); /* SR34[8:1]->VRS */
+ xgifb_reg_set(pVBInfo->P3c4, 0x34, Tempcx); /* SR34[8:1]->VRS */
Temp1 = Tempdx; /* Temp1[7]: Tempdx[7] */
Temp1 <<= 1; /* Temp1[8]: VRS[8] */
@@ -1422,11 +813,11 @@ void XGI_SetXG21CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
Tempbx = (unsigned char) Temp1;
Tempax |= Tempbx; /* Tempax[7:0]: VRE[5:0]VRS[10:9] */
Tempax &= 0x7F;
- XGINew_SetReg1(pVBInfo->P3c4, 0x3F, Tempax); /* SR3F D[7:2]->VRE D[1:0]->VRS */
+ xgifb_reg_set(pVBInfo->P3c4, 0x3F, Tempax); /* SR3F D[7:2]->VRE D[1:0]->VRS */
}
}
-void XGI_SetXG27CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_SetXG27CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
unsigned short RefreshRateTableIndex,
struct vb_device_info *pVBInfo)
{
@@ -1435,7 +826,7 @@ void XGI_SetXG27CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
if (ModeNo <= 0x13) {
StandTableIndex = XGI_GetModePtr(ModeNo, ModeIdIndex, pVBInfo);
Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[4]; /* CR04 HRS */
- XGINew_SetReg1(pVBInfo->P3c4, 0x2E, Tempax); /* SR2E [7:0]->HRS */
+ xgifb_reg_set(pVBInfo->P3c4, 0x2E, Tempax); /* SR2E [7:0]->HRS */
Tempbx = pVBInfo->StandTable[StandTableIndex].CRTC[5]; /* Tempbx: CR05 HRE */
Tempbx &= 0x1F; /* Tempbx: HRE[4:0] */
Tempcx = Tempax;
@@ -1444,17 +835,17 @@ void XGI_SetXG27CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
if (Tempbx < (Tempax & 0x1F)) /* IF HRE < HRS */
Tempdx |= 0x20; /* Tempdx: HRE = HRE + 0x20 */
Tempdx <<= 2; /* Tempdx << 2 */
- XGINew_SetReg1(pVBInfo->P3c4, 0x2F, Tempdx); /* SR2F [7:2]->HRE */
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x30, 0xE3, 00);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2F, Tempdx); /* SR2F [7:2]->HRE */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x30, 0xE3, 00);
Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[16]; /* Tempax: CR10 VRS */
- XGINew_SetReg1(pVBInfo->P3c4, 0x34, Tempax); /* SR34[7:0]->VRS */
+ xgifb_reg_set(pVBInfo->P3c4, 0x34, Tempax); /* SR34[7:0]->VRS */
Tempcx = Tempax; /* Tempcx=Tempax=VRS[7:0] */
Tempax = pVBInfo->StandTable[StandTableIndex].CRTC[7]; /* Tempax[7][2]: CR7[7][2] VRS[9][8] */
Tempbx = Tempax; /* Tempbx=CR07 */
Tempax &= 0x04; /* Tempax[2]: CR07[2] VRS[8] */
Tempax >>= 2;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x35, ~0x01, Tempax); /* SR35 D[0]->VRS D[8] */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x35, ~0x01, Tempax); /* SR35 D[0]->VRS D[8] */
Tempcx |= (Tempax << 8); /* Tempcx[8] |= VRS[8] */
Tempcx |= (Tempbx & 0x80) << 2; /* Tempcx[9] |= VRS[9] */
@@ -1468,13 +859,13 @@ void XGI_SetXG27CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
Tempax = (unsigned char) Tempbx & 0xFF; /* Tempax[7:0]: VRE[7:0] */
Tempax <<= 2; /* Tempax << 2: VRE[5:0] */
Tempcx = (Tempcx & 0x600) >> 8; /* Tempcx VRS[10:9] */
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x3F, ~0xFC, Tempax); /* SR3F D[7:2]->VRE D[5:0] */
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x35, ~0x06, Tempcx); /* SR35 D[2:1]->VRS[10:9] */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x3F, ~0xFC, Tempax); /* SR3F D[7:2]->VRE D[5:0] */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x35, ~0x06, Tempcx); /* SR35 D[2:1]->VRS[10:9] */
} else {
index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[3]; /* Tempax: CR4 HRS */
Tempbx = Tempax; /* Tempbx: HRS[7:0] */
- XGINew_SetReg1(pVBInfo->P3c4, 0x2E, Tempax); /* SR2E[7:0]->HRS */
+ xgifb_reg_set(pVBInfo->P3c4, 0x2E, Tempax); /* SR2E[7:0]->HRS */
Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[5]; /* SR0B */
Tempax &= 0xC0; /* Tempax[7:6]: SR0B[7:6]: HRS[9:8]*/
@@ -1501,18 +892,18 @@ void XGI_SetXG27CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
Tempax &= 0xC0; /* Tempax[7:6]: SR0B[7:6]: HRS[9:8]*/
Tempax >>= 6; /* Tempax[1:0]: HRS[9:8]*/
Tempax |= ((Tempbx << 2) & 0xFF); /* Tempax[7:2]: HRE[5:0] */
- XGINew_SetReg1(pVBInfo->P3c4, 0x2F, Tempax); /* SR2F [7:2][1:0]: HRE[5:0]HRS[9:8] */
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x30, 0xE3, 00);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2F, Tempax); /* SR2F [7:2][1:0]: HRE[5:0]HRS[9:8] */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x30, 0xE3, 00);
Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[10]; /* CR10 VRS */
- XGINew_SetReg1(pVBInfo->P3c4, 0x34, Tempax); /* SR34[7:0]->VRS[7:0] */
+ xgifb_reg_set(pVBInfo->P3c4, 0x34, Tempax); /* SR34[7:0]->VRS[7:0] */
Tempcx = Tempax; /* Tempcx <= VRS[7:0] */
Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[9]; /* CR7[7][2] VRS[9][8] */
Tempbx = Tempax; /* Tempbx <= CR07[7:0] */
Tempax = Tempax & 0x04; /* Tempax[2]: CR7[2]: VRS[8] */
Tempax >>= 2; /* Tempax[0]: VRS[8] */
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x35, ~0x01, Tempax); /* SR35[0]: VRS[8] */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x35, ~0x01, Tempax); /* SR35[0]: VRS[8] */
Tempcx |= (Tempax << 8); /* Tempcx <= VRS[8:0] */
Tempcx |= ((Tempbx & 0x80) << 2); /* Tempcx <= VRS[9:0] */
Tempax = pVBInfo->XGINEWUB_CRT1Table[index].CR[14]; /* Tempax: SR0A */
@@ -1533,9 +924,9 @@ void XGI_SetXG27CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
Tempbx |= 0x20; /* VRE + 0x20 */
Tempax = (Tempbx << 2) & 0xFF; /* Tempax: Tempax[7:0]; VRE[5:0]00 */
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x3F, ~0xFC, Tempax); /* SR3F[7:2]:VRE[5:0] */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x3F, ~0xFC, Tempax); /* SR3F[7:2]:VRE[5:0] */
Tempax = Tempcx >> 8;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x35, ~0x07, Tempax); /* SR35[2:0]:VRS[10:8] */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x35, ~0x07, Tempax); /* SR35[2:0]:VRS[10:8] */
}
}
@@ -1545,7 +936,7 @@ void XGI_SetXG27CRTC(unsigned short ModeNo, unsigned short ModeIdIndex,
/* Output : FCLK duty cycle, FCLK delay compensation */
/* Description : All values set zero */
/* --------------------------------------------------------------------- */
-void XGI_SetXG21LCD(struct vb_device_info *pVBInfo,
+static void XGI_SetXG21LCD(struct vb_device_info *pVBInfo,
unsigned short RefreshRateTableIndex, unsigned short ModeNo)
{
unsigned short Data, Temp, b3CC;
@@ -1553,45 +944,45 @@ void XGI_SetXG21LCD(struct vb_device_info *pVBInfo,
XGI_P3cc = pVBInfo->P3cc;
- XGINew_SetReg1(pVBInfo->P3d4, 0x2E, 0x00);
- XGINew_SetReg1(pVBInfo->P3d4, 0x2F, 0x00);
- XGINew_SetReg1(pVBInfo->P3d4, 0x46, 0x00);
- XGINew_SetReg1(pVBInfo->P3d4, 0x47, 0x00);
+ xgifb_reg_set(pVBInfo->P3d4, 0x2E, 0x00);
+ xgifb_reg_set(pVBInfo->P3d4, 0x2F, 0x00);
+ xgifb_reg_set(pVBInfo->P3d4, 0x46, 0x00);
+ xgifb_reg_set(pVBInfo->P3d4, 0x47, 0x00);
if (((*pVBInfo->pDVOSetting) & 0xC0) == 0xC0) {
- XGINew_SetReg1(pVBInfo->P3d4, 0x2E, *pVBInfo->pCR2E);
- XGINew_SetReg1(pVBInfo->P3d4, 0x2F, *pVBInfo->pCR2F);
- XGINew_SetReg1(pVBInfo->P3d4, 0x46, *pVBInfo->pCR46);
- XGINew_SetReg1(pVBInfo->P3d4, 0x47, *pVBInfo->pCR47);
+ xgifb_reg_set(pVBInfo->P3d4, 0x2E, *pVBInfo->pCR2E);
+ xgifb_reg_set(pVBInfo->P3d4, 0x2F, *pVBInfo->pCR2F);
+ xgifb_reg_set(pVBInfo->P3d4, 0x46, *pVBInfo->pCR46);
+ xgifb_reg_set(pVBInfo->P3d4, 0x47, *pVBInfo->pCR47);
}
- Temp = XGINew_GetReg1(pVBInfo->P3d4, 0x37);
+ Temp = xgifb_reg_get(pVBInfo->P3d4, 0x37);
if (Temp & 0x01) {
- XGINew_SetRegOR(pVBInfo->P3c4, 0x06, 0x40); /* 18 bits FP */
- XGINew_SetRegOR(pVBInfo->P3c4, 0x09, 0x40);
+ xgifb_reg_or(pVBInfo->P3c4, 0x06, 0x40); /* 18 bits FP */
+ xgifb_reg_or(pVBInfo->P3c4, 0x09, 0x40);
}
- XGINew_SetRegOR(pVBInfo->P3c4, 0x1E, 0x01); /* Negative blank polarity */
+ xgifb_reg_or(pVBInfo->P3c4, 0x1E, 0x01); /* Negative blank polarity */
- XGINew_SetRegAND(pVBInfo->P3c4, 0x30, ~0x20);
- XGINew_SetRegAND(pVBInfo->P3c4, 0x35, ~0x80);
+ xgifb_reg_and(pVBInfo->P3c4, 0x30, ~0x20);
+ xgifb_reg_and(pVBInfo->P3c4, 0x35, ~0x80);
if (ModeNo <= 0x13) {
- b3CC = (unsigned char) XGINew_GetReg2(XGI_P3cc);
+ b3CC = (unsigned char) inb(XGI_P3cc);
if (b3CC & 0x40)
- XGINew_SetRegOR(pVBInfo->P3c4, 0x30, 0x20); /* Hsync polarity */
+ xgifb_reg_or(pVBInfo->P3c4, 0x30, 0x20); /* Hsync polarity */
if (b3CC & 0x80)
- XGINew_SetRegOR(pVBInfo->P3c4, 0x35, 0x80); /* Vsync polarity */
+ xgifb_reg_or(pVBInfo->P3c4, 0x35, 0x80); /* Vsync polarity */
} else {
Data = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag;
if (Data & 0x4000)
- XGINew_SetRegOR(pVBInfo->P3c4, 0x30, 0x20); /* Hsync polarity */
+ xgifb_reg_or(pVBInfo->P3c4, 0x30, 0x20); /* Hsync polarity */
if (Data & 0x8000)
- XGINew_SetRegOR(pVBInfo->P3c4, 0x35, 0x80); /* Vsync polarity */
+ xgifb_reg_or(pVBInfo->P3c4, 0x35, 0x80); /* Vsync polarity */
}
}
-void XGI_SetXG27LCD(struct vb_device_info *pVBInfo,
+static void XGI_SetXG27LCD(struct vb_device_info *pVBInfo,
unsigned short RefreshRateTableIndex, unsigned short ModeNo)
{
unsigned short Data, Temp, b3CC;
@@ -1599,43 +990,43 @@ void XGI_SetXG27LCD(struct vb_device_info *pVBInfo,
XGI_P3cc = pVBInfo->P3cc;
- XGINew_SetReg1(pVBInfo->P3d4, 0x2E, 0x00);
- XGINew_SetReg1(pVBInfo->P3d4, 0x2F, 0x00);
- XGINew_SetReg1(pVBInfo->P3d4, 0x46, 0x00);
- XGINew_SetReg1(pVBInfo->P3d4, 0x47, 0x00);
+ xgifb_reg_set(pVBInfo->P3d4, 0x2E, 0x00);
+ xgifb_reg_set(pVBInfo->P3d4, 0x2F, 0x00);
+ xgifb_reg_set(pVBInfo->P3d4, 0x46, 0x00);
+ xgifb_reg_set(pVBInfo->P3d4, 0x47, 0x00);
- Temp = XGINew_GetReg1(pVBInfo->P3d4, 0x37);
+ Temp = xgifb_reg_get(pVBInfo->P3d4, 0x37);
if ((Temp & 0x03) == 0) { /* dual 12 */
- XGINew_SetReg1(pVBInfo->P3d4, 0x46, 0x13);
- XGINew_SetReg1(pVBInfo->P3d4, 0x47, 0x13);
+ xgifb_reg_set(pVBInfo->P3d4, 0x46, 0x13);
+ xgifb_reg_set(pVBInfo->P3d4, 0x47, 0x13);
}
if (((*pVBInfo->pDVOSetting) & 0xC0) == 0xC0) {
- XGINew_SetReg1(pVBInfo->P3d4, 0x2E, *pVBInfo->pCR2E);
- XGINew_SetReg1(pVBInfo->P3d4, 0x2F, *pVBInfo->pCR2F);
- XGINew_SetReg1(pVBInfo->P3d4, 0x46, *pVBInfo->pCR46);
- XGINew_SetReg1(pVBInfo->P3d4, 0x47, *pVBInfo->pCR47);
+ xgifb_reg_set(pVBInfo->P3d4, 0x2E, *pVBInfo->pCR2E);
+ xgifb_reg_set(pVBInfo->P3d4, 0x2F, *pVBInfo->pCR2F);
+ xgifb_reg_set(pVBInfo->P3d4, 0x46, *pVBInfo->pCR46);
+ xgifb_reg_set(pVBInfo->P3d4, 0x47, *pVBInfo->pCR47);
}
XGI_SetXG27FPBits(pVBInfo);
- XGINew_SetRegOR(pVBInfo->P3c4, 0x1E, 0x01); /* Negative blank polarity */
+ xgifb_reg_or(pVBInfo->P3c4, 0x1E, 0x01); /* Negative blank polarity */
- XGINew_SetRegAND(pVBInfo->P3c4, 0x30, ~0x20); /* Hsync polarity */
- XGINew_SetRegAND(pVBInfo->P3c4, 0x35, ~0x80); /* Vsync polarity */
+ xgifb_reg_and(pVBInfo->P3c4, 0x30, ~0x20); /* Hsync polarity */
+ xgifb_reg_and(pVBInfo->P3c4, 0x35, ~0x80); /* Vsync polarity */
if (ModeNo <= 0x13) {
- b3CC = (unsigned char) XGINew_GetReg2(XGI_P3cc);
+ b3CC = (unsigned char) inb(XGI_P3cc);
if (b3CC & 0x40)
- XGINew_SetRegOR(pVBInfo->P3c4, 0x30, 0x20); /* Hsync polarity */
+ xgifb_reg_or(pVBInfo->P3c4, 0x30, 0x20); /* Hsync polarity */
if (b3CC & 0x80)
- XGINew_SetRegOR(pVBInfo->P3c4, 0x35, 0x80); /* Vsync polarity */
+ xgifb_reg_or(pVBInfo->P3c4, 0x35, 0x80); /* Vsync polarity */
} else {
Data = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag;
if (Data & 0x4000)
- XGINew_SetRegOR(pVBInfo->P3c4, 0x30, 0x20); /* Hsync polarity */
+ xgifb_reg_or(pVBInfo->P3c4, 0x30, 0x20); /* Hsync polarity */
if (Data & 0x8000)
- XGINew_SetRegOR(pVBInfo->P3c4, 0x35, 0x80); /* Vsync polarity */
+ xgifb_reg_or(pVBInfo->P3c4, 0x35, 0x80); /* Vsync polarity */
}
}
@@ -1645,12 +1036,12 @@ void XGI_SetXG27LCD(struct vb_device_info *pVBInfo,
/* Output : CRT1 CRTC */
/* Description : Modify CRT1 Hsync/Vsync to fix LCD mode timing */
/* --------------------------------------------------------------------- */
-void XGI_UpdateXG21CRTC(unsigned short ModeNo, struct vb_device_info *pVBInfo,
+static void XGI_UpdateXG21CRTC(unsigned short ModeNo, struct vb_device_info *pVBInfo,
unsigned short RefreshRateTableIndex)
{
int i, index = -1;
- XGINew_SetRegAND(pVBInfo->P3d4, 0x11, 0x7F); /* Unlock CR0~7 */
+ xgifb_reg_and(pVBInfo->P3d4, 0x11, 0x7F); /* Unlock CR0~7 */
if (ModeNo <= 0x13) {
for (i = 0; i < 12; i++) {
if (ModeNo == pVBInfo->UpdateCRT1[i].ModeID)
@@ -1674,18 +1065,18 @@ void XGI_UpdateXG21CRTC(unsigned short ModeNo, struct vb_device_info *pVBInfo,
}
if (index != -1) {
- XGINew_SetReg1(pVBInfo->P3d4, 0x02,
+ xgifb_reg_set(pVBInfo->P3d4, 0x02,
pVBInfo->UpdateCRT1[index].CR02);
- XGINew_SetReg1(pVBInfo->P3d4, 0x03,
+ xgifb_reg_set(pVBInfo->P3d4, 0x03,
pVBInfo->UpdateCRT1[index].CR03);
- XGINew_SetReg1(pVBInfo->P3d4, 0x15,
+ xgifb_reg_set(pVBInfo->P3d4, 0x15,
pVBInfo->UpdateCRT1[index].CR15);
- XGINew_SetReg1(pVBInfo->P3d4, 0x16,
+ xgifb_reg_set(pVBInfo->P3d4, 0x16,
pVBInfo->UpdateCRT1[index].CR16);
}
}
-void XGI_SetCRT1DE(struct xgi_hw_device_info *HwDeviceExtension,
+static void XGI_SetCRT1DE(struct xgi_hw_device_info *HwDeviceExtension,
unsigned short ModeNo, unsigned short ModeIdIndex,
unsigned short RefreshRateTableIndex,
struct vb_device_info *pVBInfo)
@@ -1731,14 +1122,14 @@ void XGI_SetCRT1DE(struct xgi_hw_device_info *HwDeviceExtension,
tempax -= 1;
tempbx -= 1;
tempcx = tempax;
- temp = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x11);
- data = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x11);
+ temp = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x11);
+ data = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x11);
data &= 0x7F;
- XGINew_SetReg1(pVBInfo->P3d4, 0x11, data); /* Unlock CRTC */
- XGINew_SetReg1(pVBInfo->P3d4, 0x01, (unsigned short) (tempcx & 0xff));
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x0b, ~0x0c,
+ xgifb_reg_set(pVBInfo->P3d4, 0x11, data); /* Unlock CRTC */
+ xgifb_reg_set(pVBInfo->P3d4, 0x01, (unsigned short) (tempcx & 0xff));
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x0b, ~0x0c,
(unsigned short) ((tempcx & 0x0ff00) >> 10));
- XGINew_SetReg1(pVBInfo->P3d4, 0x12, (unsigned short) (tempbx & 0xff));
+ xgifb_reg_set(pVBInfo->P3d4, 0x12, (unsigned short) (tempbx & 0xff));
tempax = 0;
tempbx = tempbx >> 8;
@@ -1748,16 +1139,16 @@ void XGI_SetCRT1DE(struct xgi_hw_device_info *HwDeviceExtension,
if (tempbx & 0x02)
tempax |= 0x40;
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x07, ~0x42, tempax);
- data = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x07);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x07, ~0x42, tempax);
+ data = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x07);
data &= 0xFF;
tempax = 0;
if (tempbx & 0x04)
tempax |= 0x02;
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x0a, ~0x02, tempax);
- XGINew_SetReg1(pVBInfo->P3d4, 0x11, temp);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x0a, ~0x02, tempax);
+ xgifb_reg_set(pVBInfo->P3d4, 0x11, temp);
}
unsigned short XGI_GetResInfo(unsigned short ModeNo,
@@ -1772,7 +1163,7 @@ unsigned short XGI_GetResInfo(unsigned short ModeNo,
return resindex;
}
-void XGI_SetCRT1Offset(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_SetCRT1Offset(unsigned short ModeNo, unsigned short ModeIdIndex,
unsigned short RefreshRateTableIndex,
struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
@@ -1825,14 +1216,14 @@ void XGI_SetCRT1Offset(unsigned short ModeNo, unsigned short ModeIdIndex,
temp2 = temp;
temp = temp >> 8; /* ah */
temp &= 0x0F;
- i = XGINew_GetReg1(pVBInfo->P3c4, 0x0E);
+ i = xgifb_reg_get(pVBInfo->P3c4, 0x0E);
i &= 0xF0;
i |= temp;
- XGINew_SetReg1(pVBInfo->P3c4, 0x0E, i);
+ xgifb_reg_set(pVBInfo->P3c4, 0x0E, i);
temp = (unsigned char) temp2;
temp &= 0xFF; /* al */
- XGINew_SetReg1(pVBInfo->P3d4, 0x13, temp);
+ xgifb_reg_set(pVBInfo->P3d4, 0x13, temp);
/* SetDisplayUnit */
temp2 = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag;
@@ -1852,10 +1243,183 @@ void XGI_SetCRT1Offset(unsigned short ModeNo, unsigned short ModeIdIndex,
if ((ModeNo == 0x4A) | (ModeNo == 0x49))
ah -= 1;
- XGINew_SetReg1(pVBInfo->P3c4, 0x10, ah);
+ xgifb_reg_set(pVBInfo->P3c4, 0x10, ah);
+}
+
+static unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo,
+ unsigned short ModeIdIndex,
+ unsigned short RefreshRateTableIndex,
+ struct xgi_hw_device_info *HwDeviceExtension,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short tempbx;
+
+ unsigned short LCDXlat1VCLK[4] = { VCLK65 + 2, VCLK65 + 2, VCLK65 + 2,
+ VCLK65 + 2 };
+ unsigned short LCDXlat2VCLK[4] = { VCLK108_2 + 5, VCLK108_2 + 5,
+ VCLK108_2 + 5, VCLK108_2 + 5 };
+ unsigned short LVDSXlat1VCLK[4] = { VCLK40, VCLK40, VCLK40, VCLK40 };
+ unsigned short LVDSXlat2VCLK[4] = { VCLK65 + 2, VCLK65 + 2, VCLK65 + 2,
+ VCLK65 + 2 };
+ unsigned short LVDSXlat3VCLK[4] = { VCLK65 + 2, VCLK65 + 2, VCLK65 + 2,
+ VCLK65 + 2 };
+
+ unsigned short CRT2Index, VCLKIndex;
+ unsigned short modeflag, resinfo;
+ unsigned char *CHTVVCLKPtr = NULL;
+
+ if (ModeNo <= 0x13) {
+ modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */
+ resinfo = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo;
+ CRT2Index = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC;
+ } else {
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */
+ resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
+ CRT2Index
+ = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
+ }
+
+ if (pVBInfo->IF_DEF_LVDS == 0) {
+ CRT2Index = CRT2Index >> 6; /* for LCD */
+ if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { /*301b*/
+ if (pVBInfo->LCDResInfo != Panel1024x768)
+ VCLKIndex = LCDXlat2VCLK[CRT2Index];
+ else
+ VCLKIndex = LCDXlat1VCLK[CRT2Index];
+ } else { /* for TV */
+ if (pVBInfo->VBInfo & SetCRT2ToTV) {
+ if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) {
+ if (pVBInfo->SetFlag & RPLLDIV2XO) {
+ VCLKIndex = HiTVVCLKDIV2;
+
+ VCLKIndex += 25;
+
+ } else {
+ VCLKIndex = HiTVVCLK;
+
+ VCLKIndex += 25;
+
+ }
+
+ if (pVBInfo->SetFlag & TVSimuMode) {
+ if (modeflag & Charx8Dot) {
+ VCLKIndex
+ = HiTVSimuVCLK;
+
+ VCLKIndex += 25;
+
+ } else {
+ VCLKIndex
+ = HiTVTextVCLK;
+
+ VCLKIndex += 25;
+
+ }
+ }
+
+ if (pVBInfo->VBType & VB_XGI301LV) { /* 301lv */
+ if (!(pVBInfo->VBExtInfo
+ == VB_YPbPr1080i)) {
+ VCLKIndex
+ = YPbPr750pVCLK;
+ if (!(pVBInfo->VBExtInfo
+ == VB_YPbPr750p)) {
+ VCLKIndex
+ = YPbPr525pVCLK;
+ if (!(pVBInfo->VBExtInfo
+ == VB_YPbPr525p)) {
+ VCLKIndex
+ = YPbPr525iVCLK_2;
+ if (!(pVBInfo->SetFlag
+ & RPLLDIV2XO))
+ VCLKIndex
+ = YPbPr525iVCLK;
+ }
+ }
+ }
+ }
+ } else {
+ if (pVBInfo->VBInfo & SetCRT2ToTV) {
+ if (pVBInfo->SetFlag
+ & RPLLDIV2XO) {
+ VCLKIndex = TVVCLKDIV2;
+
+ VCLKIndex += 25;
+
+ } else {
+ VCLKIndex = TVVCLK;
+
+ VCLKIndex += 25;
+
+ }
+ }
+ }
+ } else { /* for CRT2 */
+ VCLKIndex = (unsigned char) inb(
+ (pVBInfo->P3ca + 0x02)); /* Port 3cch */
+ VCLKIndex = ((VCLKIndex >> 2) & 0x03);
+ if (ModeNo > 0x13) {
+ VCLKIndex
+ = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; /* di+Ext_CRTVCLK */
+ VCLKIndex &= IndexMask;
+ }
+ }
+ }
+ } else { /* LVDS */
+ if (ModeNo <= 0x13)
+ VCLKIndex = CRT2Index;
+ else
+ VCLKIndex = CRT2Index;
+
+ if (pVBInfo->IF_DEF_CH7005 == 1) {
+ if (!(pVBInfo->VBInfo & SetCRT2ToLCD)) {
+ VCLKIndex &= 0x1f;
+ tempbx = 0;
+
+ if (pVBInfo->VBInfo & SetPALTV)
+ tempbx += 2;
+
+ if (pVBInfo->VBInfo & SetCHTVOverScan)
+ tempbx += 1;
+
+ switch (tempbx) {
+ case 0:
+ CHTVVCLKPtr = pVBInfo->CHTVVCLKUNTSC;
+ break;
+ case 1:
+ CHTVVCLKPtr = pVBInfo->CHTVVCLKONTSC;
+ break;
+ case 2:
+ CHTVVCLKPtr = pVBInfo->CHTVVCLKUPAL;
+ break;
+ case 3:
+ CHTVVCLKPtr = pVBInfo->CHTVVCLKOPAL;
+ break;
+ default:
+ break;
+ }
+
+ VCLKIndex = CHTVVCLKPtr[VCLKIndex];
+ }
+ } else {
+ VCLKIndex = VCLKIndex >> 6;
+ if ((pVBInfo->LCDResInfo == Panel800x600)
+ || (pVBInfo->LCDResInfo == Panel320x480))
+ VCLKIndex = LVDSXlat1VCLK[VCLKIndex];
+ else if ((pVBInfo->LCDResInfo == Panel1024x768)
+ || (pVBInfo->LCDResInfo
+ == Panel1024x768x75))
+ VCLKIndex = LVDSXlat2VCLK[VCLKIndex];
+ else
+ VCLKIndex = LVDSXlat3VCLK[VCLKIndex];
+ }
+ }
+ /* VCLKIndex = VCLKIndex&IndexMask; */
+
+ return VCLKIndex;
}
-void XGI_SetCRT1VCLK(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_SetCRT1VCLK(unsigned short ModeNo, unsigned short ModeIdIndex,
struct xgi_hw_device_info *HwDeviceExtension,
unsigned short RefreshRateTableIndex,
struct vb_device_info *pVBInfo)
@@ -1865,82 +1429,82 @@ void XGI_SetCRT1VCLK(unsigned short ModeNo, unsigned short ModeIdIndex,
if (pVBInfo->IF_DEF_LVDS == 1) {
index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x31) & 0xCF;
- XGINew_SetReg1(pVBInfo->P3c4, 0x31, data);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2B,
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x31) & 0xCF;
+ xgifb_reg_set(pVBInfo->P3c4, 0x31, data);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2B,
pVBInfo->VCLKData[index].SR2B);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2C,
+ xgifb_reg_set(pVBInfo->P3c4, 0x2C,
pVBInfo->VCLKData[index].SR2C);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2D, 0x01);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2D, 0x01);
} else if ((pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
| VB_XGI302LV | VB_XGI301C)) && (pVBInfo->VBInfo
& SetCRT2ToLCDA)) {
vclkindex = XGI_GetVCLK2Ptr(ModeNo, ModeIdIndex,
RefreshRateTableIndex, HwDeviceExtension,
pVBInfo);
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x31) & 0xCF;
- XGINew_SetReg1(pVBInfo->P3c4, 0x31, data);
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x31) & 0xCF;
+ xgifb_reg_set(pVBInfo->P3c4, 0x31, data);
data = pVBInfo->VBVCLKData[vclkindex].Part4_A;
- XGINew_SetReg1(pVBInfo->P3c4, 0x2B, data);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2B, data);
data = pVBInfo->VBVCLKData[vclkindex].Part4_B;
- XGINew_SetReg1(pVBInfo->P3c4, 0x2C, data);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2D, 0x01);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2C, data);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2D, 0x01);
} else {
index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x31) & 0xCF;
- XGINew_SetReg1(pVBInfo->P3c4, 0x31, data);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2B,
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x31) & 0xCF;
+ xgifb_reg_set(pVBInfo->P3c4, 0x31, data);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2B,
pVBInfo->VCLKData[index].SR2B);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2C,
+ xgifb_reg_set(pVBInfo->P3c4, 0x2C,
pVBInfo->VCLKData[index].SR2C);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2D, 0x01);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2D, 0x01);
}
if (HwDeviceExtension->jChipType >= XG20) {
if (pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag & HalfDCLK) {
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x2B);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2B, data);
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x2C);
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x2B);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2B, data);
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x2C);
index = data;
index &= 0xE0;
data &= 0x1F;
data = data << 1;
data += 1;
data |= index;
- XGINew_SetReg1(pVBInfo->P3c4, 0x2C, data);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2C, data);
}
}
}
-void XGI_SetCRT1FIFO(unsigned short ModeNo,
+static void XGI_SetCRT1FIFO(unsigned short ModeNo,
struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
{
unsigned short data;
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x3D);
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x3D);
data &= 0xfe;
- XGINew_SetReg1(pVBInfo->P3c4, 0x3D, data); /* diable auto-threshold */
+ xgifb_reg_set(pVBInfo->P3c4, 0x3D, data); /* diable auto-threshold */
if (ModeNo > 0x13) {
- XGINew_SetReg1(pVBInfo->P3c4, 0x08, 0x34);
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x09);
+ xgifb_reg_set(pVBInfo->P3c4, 0x08, 0x34);
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x09);
data &= 0xC0;
- XGINew_SetReg1(pVBInfo->P3c4, 0x09, data | 0x30);
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x3D);
+ xgifb_reg_set(pVBInfo->P3c4, 0x09, data | 0x30);
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x3D);
data |= 0x01;
- XGINew_SetReg1(pVBInfo->P3c4, 0x3D, data);
+ xgifb_reg_set(pVBInfo->P3c4, 0x3D, data);
} else {
if (HwDeviceExtension->jChipType == XG27) {
- XGINew_SetReg1(pVBInfo->P3c4, 0x08, 0x0E);
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x09);
+ xgifb_reg_set(pVBInfo->P3c4, 0x08, 0x0E);
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x09);
data &= 0xC0;
- XGINew_SetReg1(pVBInfo->P3c4, 0x09, data | 0x20);
+ xgifb_reg_set(pVBInfo->P3c4, 0x09, data | 0x20);
} else {
- XGINew_SetReg1(pVBInfo->P3c4, 0x08, 0xAE);
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x09);
+ xgifb_reg_set(pVBInfo->P3c4, 0x08, 0xAE);
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x09);
data &= 0xF0;
- XGINew_SetReg1(pVBInfo->P3c4, 0x09, data);
+ xgifb_reg_set(pVBInfo->P3c4, 0x09, data);
}
}
@@ -1948,7 +1512,60 @@ void XGI_SetCRT1FIFO(unsigned short ModeNo,
XGI_SetXG21FPBits(pVBInfo); /* Fix SR9[7:6] can't read back */
}
-void XGI_SetCRT1ModeRegs(struct xgi_hw_device_info *HwDeviceExtension,
+static void XGI_SetVCLKState(struct xgi_hw_device_info *HwDeviceExtension,
+ unsigned short ModeNo, unsigned short RefreshRateTableIndex,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short data, data2 = 0;
+ short VCLK;
+
+ unsigned char index;
+
+ if (ModeNo <= 0x13)
+ VCLK = 0;
+ else {
+ index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
+ index &= IndexMask;
+ VCLK = pVBInfo->VCLKData[index].CLOCK;
+ }
+
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x32);
+ data &= 0xf3;
+ if (VCLK >= 200)
+ data |= 0x0c; /* VCLK > 200 */
+
+ if (HwDeviceExtension->jChipType >= XG20)
+ data &= ~0x04; /* 2 pixel mode */
+
+ xgifb_reg_set(pVBInfo->P3c4, 0x32, data);
+
+ if (HwDeviceExtension->jChipType < XG20) {
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x1F);
+ data &= 0xE7;
+ if (VCLK < 200)
+ data |= 0x10;
+ xgifb_reg_set(pVBInfo->P3c4, 0x1F, data);
+ }
+
+ /* Jong for Adavantech LCD ripple issue
+ if ((VCLK >= 0) && (VCLK < 135))
+ data2 = 0x03;
+ else if ((VCLK >= 135) && (VCLK < 160))
+ data2 = 0x02;
+ else if ((VCLK >= 160) && (VCLK < 260))
+ data2 = 0x01;
+ else if (VCLK > 260)
+ data2 = 0x00;
+ */
+ data2 = 0x00;
+
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x07, 0xFC, data2);
+ if (HwDeviceExtension->jChipType >= XG27)
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x40, 0xFC, data2 & 0x03);
+
+}
+
+static void XGI_SetCRT1ModeRegs(struct xgi_hw_device_info *HwDeviceExtension,
unsigned short ModeNo, unsigned short ModeIdIndex,
unsigned short RefreshRateTableIndex,
struct vb_device_info *pVBInfo)
@@ -1963,8 +1580,8 @@ void XGI_SetCRT1ModeRegs(struct xgi_hw_device_info *HwDeviceExtension,
} else
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ModeFlag */
- if (XGINew_GetReg1(pVBInfo->P3d4, 0x31) & 0x01)
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x1F, 0x3F, 0x00);
+ if (xgifb_reg_get(pVBInfo->P3d4, 0x31) & 0x01)
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x1F, 0x3F, 0x00);
if (ModeNo > 0x13)
data = infoflag;
@@ -1987,8 +1604,8 @@ void XGI_SetCRT1ModeRegs(struct xgi_hw_device_info *HwDeviceExtension,
if (data)
data2 |= 0x20;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x06, ~0x3F, data2);
- /* XGINew_SetReg1(pVBInfo->P3c4,0x06,data2); */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x06, ~0x3F, data2);
+ /* xgifb_reg_set(pVBInfo->P3c4,0x06,data2); */
resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo);
if (ModeNo <= 0x13)
xres = pVBInfo->StResInfo[resindex].HTotal;
@@ -2004,12 +1621,12 @@ void XGI_SetCRT1ModeRegs(struct xgi_hw_device_info *HwDeviceExtension,
}
data2 = data & 0x00FF;
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x19, 0xFF, data2);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x19, 0xFF, data2);
data2 = (data & 0xFF00) >> 8;
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x19, 0xFC, data2);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x19, 0xFC, data2);
if (modeflag & HalfDCLK)
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x01, 0xF7, 0x08);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x01, 0xF7, 0x08);
data2 = 0;
@@ -2021,14 +1638,14 @@ void XGI_SetCRT1ModeRegs(struct xgi_hw_device_info *HwDeviceExtension,
data2 |= 0x40;
}
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0F, ~0x48, data2);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0F, ~0x48, data2);
data = 0x60;
if (pVBInfo->ModeType != ModeText) {
data = data ^ 0x60;
if (pVBInfo->ModeType != ModeEGA)
data = data ^ 0xA0;
}
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x21, 0x1F, data);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x21, 0x1F, data);
XGI_SetVCLKState(HwDeviceExtension, ModeNo, RefreshRateTableIndex,
pVBInfo);
@@ -2037,86 +1654,32 @@ void XGI_SetCRT1ModeRegs(struct xgi_hw_device_info *HwDeviceExtension,
/* if (XGINew_IF_DEF_NEW_LOWRES) */
/* XGI_VesaLowResolution(ModeNo, ModeIdIndex); //030305 fix lowresolution bug */
- data = XGINew_GetReg1(pVBInfo->P3d4, 0x31);
+ data = xgifb_reg_get(pVBInfo->P3d4, 0x31);
if (HwDeviceExtension->jChipType == XG27) {
if (data & 0x40)
data = 0x2c;
else
data = 0x6c;
- XGINew_SetReg1(pVBInfo->P3d4, 0x52, data);
- XGINew_SetRegOR(pVBInfo->P3d4, 0x51, 0x10);
+ xgifb_reg_set(pVBInfo->P3d4, 0x52, data);
+ xgifb_reg_or(pVBInfo->P3d4, 0x51, 0x10);
} else if (HwDeviceExtension->jChipType >= XG20) {
if (data & 0x40)
data = 0x33;
else
data = 0x73;
- XGINew_SetReg1(pVBInfo->P3d4, 0x52, data);
- XGINew_SetReg1(pVBInfo->P3d4, 0x51, 0x02);
+ xgifb_reg_set(pVBInfo->P3d4, 0x52, data);
+ xgifb_reg_set(pVBInfo->P3d4, 0x51, 0x02);
} else {
if (data & 0x40)
data = 0x2c;
else
data = 0x6c;
- XGINew_SetReg1(pVBInfo->P3d4, 0x52, data);
- }
-
-}
-
-void XGI_SetVCLKState(struct xgi_hw_device_info *HwDeviceExtension,
- unsigned short ModeNo, unsigned short RefreshRateTableIndex,
- struct vb_device_info *pVBInfo)
-{
- unsigned short data, data2 = 0;
- short VCLK;
-
- unsigned char index;
-
- if (ModeNo <= 0x13)
- VCLK = 0;
- else {
- index = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
- index &= IndexMask;
- VCLK = pVBInfo->VCLKData[index].CLOCK;
+ xgifb_reg_set(pVBInfo->P3d4, 0x52, data);
}
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x32);
- data &= 0xf3;
- if (VCLK >= 200)
- data |= 0x0c; /* VCLK > 200 */
-
- if (HwDeviceExtension->jChipType >= XG20)
- data &= ~0x04; /* 2 pixel mode */
-
- XGINew_SetReg1(pVBInfo->P3c4, 0x32, data);
-
- if (HwDeviceExtension->jChipType < XG20) {
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x1F);
- data &= 0xE7;
- if (VCLK < 200)
- data |= 0x10;
- XGINew_SetReg1(pVBInfo->P3c4, 0x1F, data);
- }
-
- /* Jong for Adavantech LCD ripple issue
- if ((VCLK >= 0) && (VCLK < 135))
- data2 = 0x03;
- else if ((VCLK >= 135) && (VCLK < 160))
- data2 = 0x02;
- else if ((VCLK >= 160) && (VCLK < 260))
- data2 = 0x01;
- else if (VCLK > 260)
- data2 = 0x00;
- */
- data2 = 0x00;
-
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x07, 0xFC, data2);
- if (HwDeviceExtension->jChipType >= XG27)
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x40, 0xFC, data2 & 0x03);
-
}
-
/*
void XGI_VesaLowResolution(unsigned short ModeNo, unsigned short ModeIdIndex, struct vb_device_info *pVBInfo)
{
@@ -2133,23 +1696,50 @@ void XGI_VesaLowResolution(unsigned short ModeNo, unsigned short ModeIdIndex, st
if (pVBInfo->VBType & VB_XGI301B | VB_XGI302B | VB_XGI301LV | VB_XGI302LV | VB_XGI301C)) {
if (!(pVBInfo->VBInfo & SetCRT2ToRAMDAC)) {
if (pVBInfo->VBInfo & SetInSlaveMode) {
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x01, 0xf7, 0x00);
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0f, 0x7f, 0x00);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x01, 0xf7, 0x00);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0f, 0x7f, 0x00);
return;
}
}
}
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0f, 0xff, 0x80);
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x01, 0xf7, 0x00);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0f, 0xff, 0x80);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x01, 0xf7, 0x00);
return;
}
}
}
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0f, 0x7f, 0x00);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0f, 0x7f, 0x00);
}
*/
-void XGI_LoadDAC(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_WriteDAC(unsigned short dl, unsigned short ah, unsigned short al,
+ unsigned short dh, struct vb_device_info *pVBInfo)
+{
+ unsigned short temp, bh, bl;
+
+ bh = ah;
+ bl = al;
+
+ if (dl != 0) {
+ temp = bh;
+ bh = dh;
+ dh = temp;
+ if (dl == 1) {
+ temp = bl;
+ bl = dh;
+ dh = temp;
+ } else {
+ temp = bl;
+ bl = bh;
+ bh = temp;
+ }
+ }
+ outb((unsigned short) dh, pVBInfo->P3c9);
+ outb((unsigned short) bh, pVBInfo->P3c9);
+ outb((unsigned short) bl, pVBInfo->P3c9);
+}
+
+static void XGI_LoadDAC(unsigned short ModeNo, unsigned short ModeIdIndex,
struct vb_device_info *pVBInfo)
{
unsigned short data, data2, time, i, j, k, m, n, o, si, di, bx, dl, al,
@@ -2179,8 +1769,8 @@ void XGI_LoadDAC(unsigned short ModeNo, unsigned short ModeIdIndex,
else
j = time;
- XGINew_SetReg3(pVBInfo->P3c6, 0xFF);
- XGINew_SetReg3(pVBInfo->P3c8, 0x00);
+ outb(0xFF, pVBInfo->P3c6);
+ outb(0x00, pVBInfo->P3c8);
for (i = 0; i < j; i++) {
data = table[i];
@@ -2194,7 +1784,7 @@ void XGI_LoadDAC(unsigned short ModeNo, unsigned short ModeIdIndex,
if (data & 0x02)
data2 += 0x15;
- XGINew_SetReg3(pVBInfo->P3c9, data2);
+ outb(data2, pVBInfo->P3c9);
data = data >> 2;
}
}
@@ -2204,7 +1794,7 @@ void XGI_LoadDAC(unsigned short ModeNo, unsigned short ModeIdIndex,
data = table[i];
for (k = 0; k < 3; k++)
- XGINew_SetReg3(pVBInfo->P3c9, data);
+ outb(data, pVBInfo->P3c9);
}
si = 32;
@@ -2241,54 +1831,7 @@ void XGI_LoadDAC(unsigned short ModeNo, unsigned short ModeIdIndex,
}
}
-void XGI_WriteDAC(unsigned short dl, unsigned short ah, unsigned short al,
- unsigned short dh, struct vb_device_info *pVBInfo)
-{
- unsigned short temp, bh, bl;
-
- bh = ah;
- bl = al;
-
- if (dl != 0) {
- temp = bh;
- bh = dh;
- dh = temp;
- if (dl == 1) {
- temp = bl;
- bl = dh;
- dh = temp;
- } else {
- temp = bl;
- bl = bh;
- bh = temp;
- }
- }
- XGINew_SetReg3(pVBInfo->P3c9, (unsigned short) dh);
- XGINew_SetReg3(pVBInfo->P3c9, (unsigned short) bh);
- XGINew_SetReg3(pVBInfo->P3c9, (unsigned short) bl);
-}
-
-void XGI_SetLCDAGroup(unsigned short ModeNo, unsigned short ModeIdIndex,
- struct xgi_hw_device_info *HwDeviceExtension,
- struct vb_device_info *pVBInfo)
-{
- unsigned short RefreshRateTableIndex;
- /* unsigned short temp ; */
-
- /* pVBInfo->SelectCRT2Rate = 0; */
-
- pVBInfo->SetFlag |= ProgrammingCRT2;
- RefreshRateTableIndex = XGI_GetRatePtrCRT2(HwDeviceExtension, ModeNo,
- ModeIdIndex, pVBInfo);
- XGI_GetLVDSResInfo(ModeNo, ModeIdIndex, pVBInfo);
- XGI_GetLVDSData(ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo);
- XGI_ModCRT1Regs(ModeNo, ModeIdIndex, RefreshRateTableIndex,
- HwDeviceExtension, pVBInfo);
- XGI_SetLVDSRegs(ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo);
- XGI_SetCRT2ECLK(ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo);
-}
-
-void XGI_GetLVDSResInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_GetLVDSResInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
struct vb_device_info *pVBInfo)
{
unsigned short resindex, xres, yres, modeflag;
@@ -2337,7 +1880,621 @@ void XGI_GetLVDSResInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
pVBInfo->VDE = yres;
}
-void XGI_GetLVDSData(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void *XGI_GetLcdPtr(unsigned short BX, unsigned short ModeNo,
+ unsigned short ModeIdIndex,
+ unsigned short RefreshRateTableIndex,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short i, tempdx, tempcx, tempbx, tempal, modeflag, table;
+
+ struct XGI330_LCDDataTablStruct *tempdi = NULL;
+
+ tempbx = BX;
+
+ if (ModeNo <= 0x13) {
+ modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
+ tempal = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC;
+ } else {
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
+ }
+
+ tempal = tempal & 0x0f;
+
+ if (tempbx <= 1) { /* ExpLink */
+ if (ModeNo <= 0x13) {
+ tempal = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC; /* find no Ext_CRT2CRTC2 */
+ } else {
+ tempal
+ = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
+ }
+
+ if (pVBInfo->VBInfo & SetCRT2ToLCDA) {
+ if (ModeNo <= 0x13)
+ tempal
+ = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC2;
+ else
+ tempal
+ = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC2;
+ }
+
+ if (tempbx & 0x01)
+ tempal = (tempal >> 4);
+
+ tempal = (tempal & 0x0f);
+ }
+
+ tempcx = LCDLenList[tempbx]; /* mov cl,byte ptr cs:LCDLenList[bx] */
+
+ if (pVBInfo->LCDInfo & EnableScalingLCD) { /* ScaleLCD */
+ if ((tempbx == 5) || (tempbx) == 7)
+ tempcx = LCDDesDataLen2;
+ else if ((tempbx == 3) || (tempbx == 8))
+ tempcx = LVDSDesDataLen2;
+ }
+ /* mov di, word ptr cs:LCDDataList[bx] */
+ /* tempdi = pVideoMemory[LCDDataList + tempbx * 2] | (pVideoMemory[LCDDataList + tempbx * 2 + 1] << 8); */
+
+ switch (tempbx) {
+ case 0:
+ tempdi = XGI_EPLLCDCRT1Ptr_H;
+ break;
+ case 1:
+ tempdi = XGI_EPLLCDCRT1Ptr_V;
+ break;
+ case 2:
+ tempdi = XGI_EPLLCDDataPtr;
+ break;
+ case 3:
+ tempdi = XGI_EPLLCDDesDataPtr;
+ break;
+ case 4:
+ tempdi = XGI_LCDDataTable;
+ break;
+ case 5:
+ tempdi = XGI_LCDDesDataTable;
+ break;
+ case 6:
+ tempdi = XGI_EPLCHLCDRegPtr;
+ break;
+ case 7:
+ case 8:
+ case 9:
+ tempdi = NULL;
+ break;
+ default:
+ break;
+ }
+
+ if (tempdi == NULL) /* OEMUtil */
+ return NULL;
+
+ table = tempbx;
+ i = 0;
+
+ while (tempdi[i].PANELID != 0xff) {
+ tempdx = pVBInfo->LCDResInfo;
+ if (tempbx & 0x0080) { /* OEMUtil */
+ tempbx &= (~0x0080);
+ tempdx = pVBInfo->LCDTypeInfo;
+ }
+
+ if (pVBInfo->LCDInfo & EnableScalingLCD)
+ tempdx &= (~PanelResInfo);
+
+ if (tempdi[i].PANELID == tempdx) {
+ tempbx = tempdi[i].MASK;
+ tempdx = pVBInfo->LCDInfo;
+
+ if (ModeNo <= 0x13) /* alan 09/10/2003 */
+ tempdx |= SetLCDStdMode;
+
+ if (modeflag & HalfDCLK)
+ tempdx |= SetLCDLowResolution;
+
+ tempbx &= tempdx;
+ if (tempbx == tempdi[i].CAP)
+ break;
+ }
+ i++;
+ }
+
+ if (table == 0) {
+ switch (tempdi[i].DATAPTR) {
+ case 0:
+ return &XGI_LVDSCRT11024x768_1_H[tempal];
+ break;
+ case 1:
+ return &XGI_LVDSCRT11024x768_2_H[tempal];
+ break;
+ case 2:
+ return &XGI_LVDSCRT11280x1024_1_H[tempal];
+ break;
+ case 3:
+ return &XGI_LVDSCRT11280x1024_2_H[tempal];
+ break;
+ case 4:
+ return &XGI_LVDSCRT11400x1050_1_H[tempal];
+ break;
+ case 5:
+ return &XGI_LVDSCRT11400x1050_2_H[tempal];
+ break;
+ case 6:
+ return &XGI_LVDSCRT11600x1200_1_H[tempal];
+ break;
+ case 7:
+ return &XGI_LVDSCRT11024x768_1_Hx75[tempal];
+ break;
+ case 8:
+ return &XGI_LVDSCRT11024x768_2_Hx75[tempal];
+ break;
+ case 9:
+ return &XGI_LVDSCRT11280x1024_1_Hx75[tempal];
+ break;
+ case 10:
+ return &XGI_LVDSCRT11280x1024_2_Hx75[tempal];
+ break;
+ default:
+ break;
+ }
+ } else if (table == 1) {
+ switch (tempdi[i].DATAPTR) {
+ case 0:
+ return &XGI_LVDSCRT11024x768_1_V[tempal];
+ break;
+ case 1:
+ return &XGI_LVDSCRT11024x768_2_V[tempal];
+ break;
+ case 2:
+ return &XGI_LVDSCRT11280x1024_1_V[tempal];
+ break;
+ case 3:
+ return &XGI_LVDSCRT11280x1024_2_V[tempal];
+ break;
+ case 4:
+ return &XGI_LVDSCRT11400x1050_1_V[tempal];
+ break;
+ case 5:
+ return &XGI_LVDSCRT11400x1050_2_V[tempal];
+ break;
+ case 6:
+ return &XGI_LVDSCRT11600x1200_1_V[tempal];
+ break;
+ case 7:
+ return &XGI_LVDSCRT11024x768_1_Vx75[tempal];
+ break;
+ case 8:
+ return &XGI_LVDSCRT11024x768_2_Vx75[tempal];
+ break;
+ case 9:
+ return &XGI_LVDSCRT11280x1024_1_Vx75[tempal];
+ break;
+ case 10:
+ return &XGI_LVDSCRT11280x1024_2_Vx75[tempal];
+ break;
+ default:
+ break;
+ }
+ } else if (table == 2) {
+ switch (tempdi[i].DATAPTR) {
+ case 0:
+ return &XGI_LVDS1024x768Data_1[tempal];
+ break;
+ case 1:
+ return &XGI_LVDS1024x768Data_2[tempal];
+ break;
+ case 2:
+ return &XGI_LVDS1280x1024Data_1[tempal];
+ break;
+ case 3:
+ return &XGI_LVDS1280x1024Data_2[tempal];
+ break;
+ case 4:
+ return &XGI_LVDS1400x1050Data_1[tempal];
+ break;
+ case 5:
+ return &XGI_LVDS1400x1050Data_2[tempal];
+ break;
+ case 6:
+ return &XGI_LVDS1600x1200Data_1[tempal];
+ break;
+ case 7:
+ return &XGI_LVDSNoScalingData[tempal];
+ break;
+ case 8:
+ return &XGI_LVDS1024x768Data_1x75[tempal];
+ break;
+ case 9:
+ return &XGI_LVDS1024x768Data_2x75[tempal];
+ break;
+ case 10:
+ return &XGI_LVDS1280x1024Data_1x75[tempal];
+ break;
+ case 11:
+ return &XGI_LVDS1280x1024Data_2x75[tempal];
+ break;
+ case 12:
+ return &XGI_LVDSNoScalingDatax75[tempal];
+ break;
+ default:
+ break;
+ }
+ } else if (table == 3) {
+ switch (tempdi[i].DATAPTR) {
+ case 0:
+ return &XGI_LVDS1024x768Des_1[tempal];
+ break;
+ case 1:
+ return &XGI_LVDS1024x768Des_3[tempal];
+ break;
+ case 2:
+ return &XGI_LVDS1024x768Des_2[tempal];
+ break;
+ case 3:
+ return &XGI_LVDS1280x1024Des_1[tempal];
+ break;
+ case 4:
+ return &XGI_LVDS1280x1024Des_2[tempal];
+ break;
+ case 5:
+ return &XGI_LVDS1400x1050Des_1[tempal];
+ break;
+ case 6:
+ return &XGI_LVDS1400x1050Des_2[tempal];
+ break;
+ case 7:
+ return &XGI_LVDS1600x1200Des_1[tempal];
+ break;
+ case 8:
+ return &XGI_LVDSNoScalingDesData[tempal];
+ break;
+ case 9:
+ return &XGI_LVDS1024x768Des_1x75[tempal];
+ break;
+ case 10:
+ return &XGI_LVDS1024x768Des_3x75[tempal];
+ break;
+ case 11:
+ return &XGI_LVDS1024x768Des_2x75[tempal];
+ break;
+ case 12:
+ return &XGI_LVDS1280x1024Des_1x75[tempal];
+ break;
+ case 13:
+ return &XGI_LVDS1280x1024Des_2x75[tempal];
+ break;
+ case 14:
+ return &XGI_LVDSNoScalingDesDatax75[tempal];
+ break;
+ default:
+ break;
+ }
+ } else if (table == 4) {
+ switch (tempdi[i].DATAPTR) {
+ case 0:
+ return &XGI_ExtLCD1024x768Data[tempal];
+ break;
+ case 1:
+ return &XGI_StLCD1024x768Data[tempal];
+ break;
+ case 2:
+ return &XGI_CetLCD1024x768Data[tempal];
+ break;
+ case 3:
+ return &XGI_ExtLCD1280x1024Data[tempal];
+ break;
+ case 4:
+ return &XGI_StLCD1280x1024Data[tempal];
+ break;
+ case 5:
+ return &XGI_CetLCD1280x1024Data[tempal];
+ break;
+ case 6:
+ return &XGI_ExtLCD1400x1050Data[tempal];
+ break;
+ case 7:
+ return &XGI_StLCD1400x1050Data[tempal];
+ break;
+ case 8:
+ return &XGI_CetLCD1400x1050Data[tempal];
+ break;
+ case 9:
+ return &XGI_ExtLCD1600x1200Data[tempal];
+ break;
+ case 10:
+ return &XGI_StLCD1600x1200Data[tempal];
+ break;
+ case 11:
+ return &XGI_NoScalingData[tempal];
+ break;
+ case 12:
+ return &XGI_ExtLCD1024x768x75Data[tempal];
+ break;
+ case 13:
+ return &XGI_ExtLCD1024x768x75Data[tempal];
+ break;
+ case 14:
+ return &XGI_CetLCD1024x768x75Data[tempal];
+ break;
+ case 15:
+ return &XGI_ExtLCD1280x1024x75Data[tempal];
+ break;
+ case 16:
+ return &XGI_StLCD1280x1024x75Data[tempal];
+ break;
+ case 17:
+ return &XGI_CetLCD1280x1024x75Data[tempal];
+ break;
+ case 18:
+ return &XGI_NoScalingDatax75[tempal];
+ break;
+ default:
+ break;
+ }
+ } else if (table == 5) {
+ switch (tempdi[i].DATAPTR) {
+ case 0:
+ return &XGI_ExtLCDDes1024x768Data[tempal];
+ break;
+ case 1:
+ return &XGI_StLCDDes1024x768Data[tempal];
+ break;
+ case 2:
+ return &XGI_CetLCDDes1024x768Data[tempal];
+ break;
+ case 3:
+ if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
+ & VB_XGI302LV))
+ return &XGI_ExtLCDDLDes1280x1024Data[tempal];
+ else
+ return &XGI_ExtLCDDes1280x1024Data[tempal];
+ break;
+ case 4:
+ if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
+ & VB_XGI302LV))
+ return &XGI_StLCDDLDes1280x1024Data[tempal];
+ else
+ return &XGI_StLCDDes1280x1024Data[tempal];
+ break;
+ case 5:
+ if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
+ & VB_XGI302LV))
+ return &XGI_CetLCDDLDes1280x1024Data[tempal];
+ else
+ return &XGI_CetLCDDes1280x1024Data[tempal];
+ break;
+ case 6:
+ if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
+ & VB_XGI302LV))
+ return &XGI_ExtLCDDLDes1400x1050Data[tempal];
+ else
+ return &XGI_ExtLCDDes1400x1050Data[tempal];
+ break;
+ case 7:
+ if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
+ & VB_XGI302LV))
+ return &XGI_StLCDDLDes1400x1050Data[tempal];
+ else
+ return &XGI_StLCDDes1400x1050Data[tempal];
+ break;
+ case 8:
+ return &XGI_CetLCDDes1400x1050Data[tempal];
+ break;
+ case 9:
+ return &XGI_CetLCDDes1400x1050Data2[tempal];
+ break;
+ case 10:
+ if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
+ & VB_XGI302LV))
+ return &XGI_ExtLCDDLDes1600x1200Data[tempal];
+ else
+ return &XGI_ExtLCDDes1600x1200Data[tempal];
+ break;
+ case 11:
+ if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
+ & VB_XGI302LV))
+ return &XGI_StLCDDLDes1600x1200Data[tempal];
+ else
+ return &XGI_StLCDDes1600x1200Data[tempal];
+ break;
+ case 12:
+ return &XGI_NoScalingDesData[tempal];
+ break;
+ case 13:
+ return &XGI_ExtLCDDes1024x768x75Data[tempal];
+ break;
+ case 14:
+ return &XGI_StLCDDes1024x768x75Data[tempal];
+ break;
+ case 15:
+ return &XGI_CetLCDDes1024x768x75Data[tempal];
+ break;
+ case 16:
+ if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
+ & VB_XGI302LV))
+ return &XGI_ExtLCDDLDes1280x1024x75Data[tempal];
+ else
+ return &XGI_ExtLCDDes1280x1024x75Data[tempal];
+ break;
+ case 17:
+ if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
+ & VB_XGI302LV))
+ return &XGI_StLCDDLDes1280x1024x75Data[tempal];
+ else
+ return &XGI_StLCDDes1280x1024x75Data[tempal];
+ break;
+ case 18:
+ if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
+ & VB_XGI302LV))
+ return &XGI_CetLCDDLDes1280x1024x75Data[tempal];
+ else
+ return &XGI_CetLCDDes1280x1024x75Data[tempal];
+ break;
+ case 19:
+ return &XGI_NoScalingDesDatax75[tempal];
+ break;
+ default:
+ break;
+ }
+ } else if (table == 6) {
+ switch (tempdi[i].DATAPTR) {
+ case 0:
+ return &XGI_CH7017LV1024x768[tempal];
+ break;
+ case 1:
+ return &XGI_CH7017LV1400x1050[tempal];
+ break;
+ default:
+ break;
+ }
+ }
+ return NULL;
+}
+
+static void *XGI_GetTVPtr(unsigned short BX, unsigned short ModeNo,
+ unsigned short ModeIdIndex,
+ unsigned short RefreshRateTableIndex,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short i, tempdx, tempbx, tempal, modeflag, table;
+ struct XGI330_TVDataTablStruct *tempdi = NULL;
+
+ tempbx = BX;
+
+ if (ModeNo <= 0x13) {
+ modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
+ tempal = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC;
+ } else {
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
+ }
+
+ tempal = tempal & 0x3f;
+ table = tempbx;
+
+ switch (tempbx) {
+ case 0:
+ tempdi = NULL; /*EPLCHTVCRT1Ptr_H;*/
+ if (pVBInfo->IF_DEF_CH7007 == 1)
+ tempdi = XGI_EPLCHTVCRT1Ptr;
+
+ break;
+ case 1:
+ tempdi = NULL; /*EPLCHTVCRT1Ptr_V;*/
+ if (pVBInfo->IF_DEF_CH7007 == 1)
+ tempdi = XGI_EPLCHTVCRT1Ptr;
+
+ break;
+ case 2:
+ tempdi = XGI_EPLCHTVDataPtr;
+ break;
+ case 3:
+ tempdi = NULL;
+ break;
+ case 4:
+ tempdi = XGI_TVDataTable;
+ break;
+ case 5:
+ tempdi = NULL;
+ break;
+ case 6:
+ tempdi = XGI_EPLCHTVRegPtr;
+ break;
+ default:
+ break;
+ }
+
+ if (tempdi == NULL) /* OEMUtil */
+ return NULL;
+
+ tempdx = pVBInfo->TVInfo;
+
+ if (pVBInfo->VBInfo & SetInSlaveMode)
+ tempdx = tempdx | SetTVLockMode;
+
+ if (modeflag & HalfDCLK)
+ tempdx = tempdx | SetTVLowResolution;
+
+ i = 0;
+
+ while (tempdi[i].MASK != 0xffff) {
+ if ((tempdx & tempdi[i].MASK) == tempdi[i].CAP)
+ break;
+ i++;
+ }
+
+ if (table == 0x00) { /* 07/05/22 */
+ } else if (table == 0x01) {
+ } else if (table == 0x04) {
+ switch (tempdi[i].DATAPTR) {
+ case 0:
+ return &XGI_ExtPALData[tempal];
+ break;
+ case 1:
+ return &XGI_ExtNTSCData[tempal];
+ break;
+ case 2:
+ return &XGI_StPALData[tempal];
+ break;
+ case 3:
+ return &XGI_StNTSCData[tempal];
+ break;
+ case 4:
+ return &XGI_ExtHiTVData[tempal];
+ break;
+ case 5:
+ return &XGI_St2HiTVData[tempal];
+ break;
+ case 6:
+ return &XGI_ExtYPbPr525iData[tempal];
+ break;
+ case 7:
+ return &XGI_ExtYPbPr525pData[tempal];
+ break;
+ case 8:
+ return &XGI_ExtYPbPr750pData[tempal];
+ break;
+ case 9:
+ return &XGI_StYPbPr525iData[tempal];
+ break;
+ case 10:
+ return &XGI_StYPbPr525pData[tempal];
+ break;
+ case 11:
+ return &XGI_StYPbPr750pData[tempal];
+ break;
+ case 12: /* avoid system hang */
+ return &XGI_ExtNTSCData[tempal];
+ break;
+ case 13:
+ return &XGI_St1HiTVData[tempal];
+ break;
+ default:
+ break;
+ }
+ } else if (table == 0x02) {
+ switch (tempdi[i].DATAPTR) {
+ case 0:
+ return &XGI_CHTVUNTSCData[tempal];
+ break;
+ case 1:
+ return &XGI_CHTVONTSCData[tempal];
+ break;
+ case 2:
+ return &XGI_CHTVUPALData[tempal];
+ break;
+ case 3:
+ return &XGI_CHTVOPALData[tempal];
+ break;
+ default:
+ break;
+ }
+ } else if (table == 0x06) {
+ }
+ return NULL;
+}
+
+static void XGI_GetLVDSData(unsigned short ModeNo, unsigned short ModeIdIndex,
unsigned short RefreshRateTableIndex,
struct vb_device_info *pVBInfo)
{
@@ -2392,7 +2549,7 @@ void XGI_GetLVDSData(unsigned short ModeNo, unsigned short ModeIdIndex,
}
}
-void XGI_ModCRT1Regs(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_ModCRT1Regs(unsigned short ModeNo, unsigned short ModeIdIndex,
unsigned short RefreshRateTableIndex,
struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
@@ -2453,9 +2610,9 @@ void XGI_ModCRT1Regs(unsigned short ModeNo, unsigned short ModeIdIndex,
XGI_SetCRT1Timing_H(pVBInfo, HwDeviceExtension);
if (pVBInfo->IF_DEF_CH7007 == 1) {
- XGINew_SetReg1(pVBInfo->P3c4, 0x2E,
+ xgifb_reg_set(pVBInfo->P3c4, 0x2E,
CH7007TV_TimingHPtr[0].data[8]);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2F,
+ xgifb_reg_set(pVBInfo->P3c4, 0x2F,
CH7007TV_TimingHPtr[0].data[9]);
}
@@ -2496,18 +2653,89 @@ void XGI_ModCRT1Regs(unsigned short ModeNo, unsigned short ModeIdIndex,
XGI_SetCRT1Timing_V(ModeIdIndex, ModeNo, pVBInfo);
if (pVBInfo->IF_DEF_CH7007 == 1) {
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x33, ~0x01,
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x33, ~0x01,
CH7007TV_TimingVPtr[0].data[7] & 0x01);
- XGINew_SetReg1(pVBInfo->P3c4, 0x34,
+ xgifb_reg_set(pVBInfo->P3c4, 0x34,
CH7007TV_TimingVPtr[0].data[8]);
- XGINew_SetReg1(pVBInfo->P3c4, 0x3F,
+ xgifb_reg_set(pVBInfo->P3c4, 0x3F,
CH7007TV_TimingVPtr[0].data[9]);
}
}
}
-void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
+static unsigned short XGI_GetLCDCapPtr(struct vb_device_info *pVBInfo)
+{
+ unsigned char tempal, tempah, tempbl, i;
+
+ tempah = xgifb_reg_get(pVBInfo->P3d4, 0x36);
+ tempal = tempah & 0x0F;
+ tempah = tempah & 0xF0;
+ i = 0;
+ tempbl = pVBInfo->LCDCapList[i].LCD_ID;
+
+ while (tempbl != 0xFF) {
+ if (tempbl & 0x80) { /* OEMUtil */
+ tempal = tempah;
+ tempbl = tempbl & ~(0x80);
+ }
+
+ if (tempal == tempbl)
+ break;
+
+ i++;
+
+ tempbl = pVBInfo->LCDCapList[i].LCD_ID;
+ }
+
+ return i;
+}
+
+static unsigned short XGI_GetLCDCapPtr1(struct vb_device_info *pVBInfo)
+{
+ unsigned short tempah, tempal, tempbl, i;
+
+ tempal = pVBInfo->LCDResInfo;
+ tempah = pVBInfo->LCDTypeInfo;
+
+ i = 0;
+ tempbl = pVBInfo->LCDCapList[i].LCD_ID;
+
+ while (tempbl != 0xFF) {
+ if ((tempbl & 0x80) && (tempbl != 0x80)) {
+ tempal = tempah;
+ tempbl &= ~0x80;
+ }
+
+ if (tempal == tempbl)
+ break;
+
+ i++;
+ tempbl = pVBInfo->LCDCapList[i].LCD_ID;
+ }
+
+ if (tempbl == 0xFF) {
+ pVBInfo->LCDResInfo = Panel1024x768;
+ pVBInfo->LCDTypeInfo = 0;
+ i = 0;
+ }
+
+ return i;
+}
+
+static void XGI_GetLCDSync(unsigned short *HSyncWidth, unsigned short *VSyncWidth,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short Index;
+
+ Index = XGI_GetLCDCapPtr(pVBInfo);
+ *HSyncWidth = pVBInfo->LCDCapList[Index].LCD_HSyncWidth;
+ *VSyncWidth = pVBInfo->LCDCapList[Index].LCD_VSyncWidth;
+
+ return;
+}
+
+static void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
unsigned short RefreshRateTableIndex,
struct vb_device_info *pVBInfo)
{
@@ -2605,14 +2833,14 @@ void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
if (tempcx >= tempax)
tempcx -= tempax;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x1A, tempbx & 0x07);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x1A, tempbx & 0x07);
tempcx = tempcx >> 3;
tempbx = tempbx >> 3;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x16,
+ xgifb_reg_set(pVBInfo->Part1Port, 0x16,
(unsigned short) (tempbx & 0xff));
- XGINew_SetReg1(pVBInfo->Part1Port, 0x17,
+ xgifb_reg_set(pVBInfo->Part1Port, 0x17,
(unsigned short) (tempcx & 0xff));
tempax = pVBInfo->HT;
@@ -2640,8 +2868,8 @@ void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
tempcx &= 0x1f;
tempax |= tempcx;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x15, tempax);
- XGINew_SetReg1(pVBInfo->Part1Port, 0x14,
+ xgifb_reg_set(pVBInfo->Part1Port, 0x15, tempax);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x14,
(unsigned short) (tempbx & 0xff));
tempax = pVBInfo->VT;
@@ -2656,15 +2884,15 @@ void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
if (tempcx >= tempax)
tempcx -= tempax;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x1b,
+ xgifb_reg_set(pVBInfo->Part1Port, 0x1b,
(unsigned short) (tempbx & 0xff));
- XGINew_SetReg1(pVBInfo->Part1Port, 0x1c,
+ xgifb_reg_set(pVBInfo->Part1Port, 0x1c,
(unsigned short) (tempcx & 0xff));
tempbx = (tempbx >> 8) & 0x07;
tempcx = (tempcx >> 8) & 0x07;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x1d,
+ xgifb_reg_set(pVBInfo->Part1Port, 0x1d,
(unsigned short) ((tempcx << 3)
| tempbx));
@@ -2684,9 +2912,9 @@ void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
if (tempcx >= tempax)
tempcx -= tempax;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x18,
+ xgifb_reg_set(pVBInfo->Part1Port, 0x18,
(unsigned short) (tempbx & 0xff));
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x19, ~0x0f,
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x19, ~0x0f,
(unsigned short) (tempcx & 0x0f));
tempax = ((tempbx >> 8) & 0x07) << 3;
@@ -2698,7 +2926,7 @@ void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
if (pVBInfo->LCDInfo & EnableLVDSDDA)
tempax |= 0x40;
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x1a, 0x07,
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x1a, 0x07,
tempax);
tempcx = pVBInfo->VGAVT;
@@ -2717,9 +2945,9 @@ void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
temp2 = temp1;
push3 = temp2;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x37,
+ xgifb_reg_set(pVBInfo->Part1Port, 0x37,
(unsigned short) (temp2 & 0xff));
- XGINew_SetReg1(pVBInfo->Part1Port, 0x36,
+ xgifb_reg_set(pVBInfo->Part1Port, 0x36,
(unsigned short) ((temp2 >> 8) & 0xff));
tempbx = (unsigned short) (temp2 >> 16);
@@ -2729,27 +2957,27 @@ void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
if (tempbx == pVBInfo->VDE)
tempax |= 0x04;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x35, tempax);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x35, tempax);
if (pVBInfo->VBType & VB_XGI301C) {
temp2 = push3;
- XGINew_SetReg1(pVBInfo->Part4Port, 0x3c,
+ xgifb_reg_set(pVBInfo->Part4Port, 0x3c,
(unsigned short) (temp2 & 0xff));
- XGINew_SetReg1(pVBInfo->Part4Port, 0x3b,
+ xgifb_reg_set(pVBInfo->Part4Port, 0x3b,
(unsigned short) ((temp2 >> 8)
& 0xff));
tempbx = (unsigned short) (temp2 >> 16);
- XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x3a,
+ xgifb_reg_and_or(pVBInfo->Part4Port, 0x3a,
~0xc0,
(unsigned short) ((tempbx
& 0xff) << 6));
tempcx = pVBInfo->VGAVDE;
if (tempcx == pVBInfo->VDE)
- XGINew_SetRegANDOR(pVBInfo->Part4Port,
+ xgifb_reg_and_or(pVBInfo->Part4Port,
0x30, ~0x0c, 0x00);
else
- XGINew_SetRegANDOR(pVBInfo->Part4Port,
+ xgifb_reg_and_or(pVBInfo->Part4Port,
0x30, ~0x0c, 0x08);
}
@@ -2773,7 +3001,7 @@ void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
temp3 = (temp3 & 0xffff0000) + (temp1 & 0xffff);
tempax = (unsigned short) (temp3 & 0xff);
- XGINew_SetReg1(pVBInfo->Part1Port, 0x1f, tempax);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x1f, tempax);
temp1 = pVBInfo->VGAVDE << 18;
temp1 = temp1 / push3;
@@ -2784,9 +3012,9 @@ void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
tempax = ((tempbx >> 8) & 0xff) << 3;
tempax |= (unsigned short) ((temp3 >> 8) & 0x07);
- XGINew_SetReg1(pVBInfo->Part1Port, 0x20,
+ xgifb_reg_set(pVBInfo->Part1Port, 0x20,
(unsigned short) (tempax & 0xff));
- XGINew_SetReg1(pVBInfo->Part1Port, 0x21,
+ xgifb_reg_set(pVBInfo->Part1Port, 0x21,
(unsigned short) (tempbx & 0xff));
temp3 = temp3 >> 16;
@@ -2794,15 +3022,223 @@ void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
if (modeflag & HalfDCLK)
temp3 = temp3 >> 1;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x22,
+ xgifb_reg_set(pVBInfo->Part1Port, 0x22,
(unsigned short) ((temp3 >> 8) & 0xff));
- XGINew_SetReg1(pVBInfo->Part1Port, 0x23,
+ xgifb_reg_set(pVBInfo->Part1Port, 0x23,
(unsigned short) (temp3 & 0xff));
}
}
}
-void XGI_SetCRT2ECLK(unsigned short ModeNo, unsigned short ModeIdIndex,
+/* --------------------------------------------------------------------- */
+/* Function : XGI_GETLCDVCLKPtr */
+/* Input : */
+/* Output : al -> VCLK Index */
+/* Description : */
+/* --------------------------------------------------------------------- */
+static void XGI_GetLCDVCLKPtr(unsigned char *di_0, unsigned char *di_1,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short index;
+
+ if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
+ if (pVBInfo->IF_DEF_ScaleLCD == 1) {
+ if (pVBInfo->LCDInfo & EnableScalingLCD)
+ return;
+ }
+
+ /* index = XGI_GetLCDCapPtr(pVBInfo); */
+ index = XGI_GetLCDCapPtr1(pVBInfo);
+
+ if (pVBInfo->VBInfo & SetCRT2ToLCD) { /* LCDB */
+ *di_0 = pVBInfo->LCDCapList[index].LCUCHAR_VCLKData1;
+ *di_1 = pVBInfo->LCDCapList[index].LCUCHAR_VCLKData2;
+ } else { /* LCDA */
+ *di_0 = pVBInfo->LCDCapList[index].LCDA_VCLKData1;
+ *di_1 = pVBInfo->LCDCapList[index].LCDA_VCLKData2;
+ }
+ }
+ return;
+}
+
+static unsigned char XGI_GetVCLKPtr(unsigned short RefreshRateTableIndex,
+ unsigned short ModeNo, unsigned short ModeIdIndex,
+ struct vb_device_info *pVBInfo)
+{
+
+ unsigned short index, modeflag;
+ unsigned short tempbx;
+ unsigned char tempal;
+ unsigned char *CHTVVCLKPtr = NULL;
+
+ if (ModeNo <= 0x13)
+ modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */
+ else
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */
+
+ if ((pVBInfo->SetFlag & ProgrammingCRT2) && (!(pVBInfo->LCDInfo
+ & EnableScalingLCD))) { /* {LCDA/LCDB} */
+ index = XGI_GetLCDCapPtr(pVBInfo);
+ tempal = pVBInfo->LCDCapList[index].LCD_VCLK;
+
+ if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA))
+ return tempal;
+
+ /* {TV} */
+ if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
+ | VB_XGI302LV | VB_XGI301C)) {
+ if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) {
+ tempal = HiTVVCLKDIV2;
+ if (!(pVBInfo->TVInfo & RPLLDIV2XO))
+ tempal = HiTVVCLK;
+ if (pVBInfo->TVInfo & TVSimuMode) {
+ tempal = HiTVSimuVCLK;
+ if (!(modeflag & Charx8Dot))
+ tempal = HiTVTextVCLK;
+
+ }
+ return tempal;
+ }
+
+ if (pVBInfo->TVInfo & SetYPbPrMode750p) {
+ tempal = YPbPr750pVCLK;
+ return tempal;
+ }
+
+ if (pVBInfo->TVInfo & SetYPbPrMode525p) {
+ tempal = YPbPr525pVCLK;
+ return tempal;
+ }
+
+ tempal = NTSC1024VCLK;
+
+ if (!(pVBInfo->TVInfo & NTSC1024x768)) {
+ tempal = TVVCLKDIV2;
+ if (!(pVBInfo->TVInfo & RPLLDIV2XO))
+ tempal = TVVCLK;
+ }
+
+ if (pVBInfo->VBInfo & SetCRT2ToTV)
+ return tempal;
+ }
+ /* else if ((pVBInfo->IF_DEF_CH7017==1)&&(pVBInfo->VBType&VB_CH7017)) {
+ if (ModeNo<=0x13)
+ *tempal = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC;
+ else
+ *tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
+ *tempal = *tempal & 0x1F;
+ tempbx = 0;
+ if (pVBInfo->TVInfo & SetPALTV)
+ tempbx = tempbx + 2;
+ if (pVBInfo->TVInfo & SetCHTVOverScan)
+ tempbx++;
+ tempbx = tempbx << 1;
+ } */
+ } /* {End of VB} */
+
+ if ((pVBInfo->IF_DEF_CH7007 == 1) && (pVBInfo->VBType & VB_CH7007)) { /* [Billy] 07/05/08 CH7007 */
+ /* VideoDebugPrint((0, "XGI_GetVCLKPtr: pVBInfo->IF_DEF_CH7007==1\n")); */
+ if ((pVBInfo->VBInfo & SetCRT2ToTV)) {
+ if (ModeNo <= 0x13) {
+ tempal
+ = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC;
+ } else {
+ tempal
+ = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
+ }
+
+ tempal = tempal & 0x0F;
+ tempbx = 0;
+
+ if (pVBInfo->TVInfo & SetPALTV)
+ tempbx = tempbx + 2;
+
+ if (pVBInfo->TVInfo & SetCHTVOverScan)
+ tempbx++;
+
+ /** tempbx = tempbx << 1; CH7007 ? **/
+
+ /* [Billy]07/05/29 CH7007 */
+ if (pVBInfo->IF_DEF_CH7007 == 1) {
+ switch (tempbx) {
+ case 0:
+ CHTVVCLKPtr = XGI7007_CHTVVCLKUNTSC;
+ break;
+ case 1:
+ CHTVVCLKPtr = XGI7007_CHTVVCLKONTSC;
+ break;
+ case 2:
+ CHTVVCLKPtr = XGI7007_CHTVVCLKUPAL;
+ break;
+ case 3:
+ CHTVVCLKPtr = XGI7007_CHTVVCLKOPAL;
+ break;
+ default:
+ break;
+
+ }
+ }
+ /* else {
+ switch(tempbx) {
+ case 0:
+ CHTVVCLKPtr = pVBInfo->CHTVVCLKUNTSC;
+ break;
+ case 1:
+ CHTVVCLKPtr = pVBInfo->CHTVVCLKONTSC;
+ break;
+ case 2:
+ CHTVVCLKPtr = pVBInfo->CHTVVCLKUPAL;
+ break;
+ case 3:
+ CHTVVCLKPtr = pVBInfo->CHTVVCLKOPAL;
+ break;
+ default:
+ break;
+ }
+ }
+ */
+
+ tempal = CHTVVCLKPtr[tempal];
+ return tempal;
+ }
+
+ }
+
+ tempal = (unsigned char) inb((pVBInfo->P3ca + 0x02));
+ tempal = tempal >> 2;
+ tempal &= 0x03;
+
+ if ((pVBInfo->LCDInfo & EnableScalingLCD) && (modeflag & Charx8Dot)) /* for Dot8 Scaling LCD */
+ tempal = tempal ^ tempal; /* ; set to VCLK25MHz always */
+
+ if (ModeNo <= 0x13)
+ return tempal;
+
+ tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
+ return tempal;
+}
+
+static void XGI_GetVCLKLen(unsigned char tempal, unsigned char *di_0,
+ unsigned char *di_1, struct vb_device_info *pVBInfo)
+{
+ if (pVBInfo->IF_DEF_CH7007 == 1) { /* [Billy] 2007/05/16 */
+ /* VideoDebugPrint((0, "XGI_GetVCLKLen: pVBInfo->IF_DEF_CH7007==1\n")); */
+ *di_0 = (unsigned char) XGI_CH7007VCLKData[tempal].SR2B;
+ *di_1 = (unsigned char) XGI_CH7007VCLKData[tempal].SR2C;
+ } else if (pVBInfo->VBType & (VB_XGI301 | VB_XGI301B | VB_XGI302B
+ | VB_XGI301LV | VB_XGI302LV | VB_XGI301C)) {
+ if ((!(pVBInfo->VBInfo & SetCRT2ToLCDA)) && (pVBInfo->SetFlag
+ & ProgrammingCRT2)) {
+ *di_0 = (unsigned char) XGI_VBVCLKData[tempal].SR2B;
+ *di_1 = XGI_VBVCLKData[tempal].SR2C;
+ }
+ } else {
+ *di_0 = XGI_VCLKData[tempal].SR2B;
+ *di_1 = XGI_VCLKData[tempal].SR2C;
+ }
+}
+
+static void XGI_SetCRT2ECLK(unsigned short ModeNo, unsigned short ModeIdIndex,
unsigned short RefreshRateTableIndex,
struct vb_device_info *pVBInfo)
{
@@ -2815,23 +3251,23 @@ void XGI_SetCRT2ECLK(unsigned short ModeNo, unsigned short ModeIdIndex,
XGI_GetLCDVCLKPtr(&di_0, &di_1, pVBInfo);
for (i = 0; i < 4; i++) {
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x31, ~0x30,
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x31, ~0x30,
(unsigned short) (0x10 * i));
if (pVBInfo->IF_DEF_CH7007 == 1) {
- XGINew_SetReg1(pVBInfo->P3c4, 0x2b, di_0);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2c, di_1);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2b, di_0);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2c, di_1);
} else if ((!(pVBInfo->VBInfo & SetCRT2ToLCDA))
&& (!(pVBInfo->VBInfo & SetInSlaveMode))) {
- XGINew_SetReg1(pVBInfo->P3c4, 0x2e, di_0);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2f, di_1);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2e, di_0);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2f, di_1);
} else {
- XGINew_SetReg1(pVBInfo->P3c4, 0x2b, di_0);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2c, di_1);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2b, di_0);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2c, di_1);
}
}
}
-void XGI_UpdateModeInfo(struct xgi_hw_device_info *HwDeviceExtension,
+static void XGI_UpdateModeInfo(struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
{
unsigned short tempcl, tempch, temp, tempbl, tempax;
@@ -2840,30 +3276,22 @@ void XGI_UpdateModeInfo(struct xgi_hw_device_info *HwDeviceExtension,
| VB_XGI302LV | VB_XGI301C)) {
tempcl = 0;
tempch = 0;
- temp = XGINew_GetReg1(pVBInfo->P3c4, 0x01);
+ temp = xgifb_reg_get(pVBInfo->P3c4, 0x01);
if (!(temp & 0x20)) {
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x17);
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x17);
if (temp & 0x80) {
- if ((HwDeviceExtension->jChipType >= XG20)
- || (HwDeviceExtension->jChipType
- >= XG40))
- temp = XGINew_GetReg1(pVBInfo->P3d4,
- 0x53);
- else
- temp = XGINew_GetReg1(pVBInfo->P3d4,
- 0x63);
-
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x53);
if (!(temp & 0x40))
tempcl |= ActiveCRT1;
}
}
- temp = XGINew_GetReg1(pVBInfo->Part1Port, 0x2e);
+ temp = xgifb_reg_get(pVBInfo->Part1Port, 0x2e);
temp &= 0x0f;
if (!(temp == 0x08)) {
- tempax = XGINew_GetReg1(pVBInfo->Part1Port, 0x13); /* Check ChannelA by Part1_13 [2003/10/03] */
+ tempax = xgifb_reg_get(pVBInfo->Part1Port, 0x13); /* Check ChannelA by Part1_13 [2003/10/03] */
if (tempax & 0x04)
tempcl = tempcl | ActiveLCD;
@@ -2877,7 +3305,7 @@ void XGI_UpdateModeInfo(struct xgi_hw_device_info *HwDeviceExtension,
tempcl |= ActiveLCD;
if (temp == 0x05) {
- temp = XGINew_GetReg1(pVBInfo->Part2Port, 0x00);
+ temp = xgifb_reg_get(pVBInfo->Part2Port, 0x00);
if (!(temp & 0x08))
tempch |= ActiveAVideo;
@@ -2894,7 +3322,7 @@ void XGI_UpdateModeInfo(struct xgi_hw_device_info *HwDeviceExtension,
}
if (pVBInfo->VBInfo & SetCRT2ToYPbPr) {
- temp = XGINew_GetReg1(
+ temp = xgifb_reg_get(
pVBInfo->Part2Port,
0x4d);
@@ -2907,7 +3335,7 @@ void XGI_UpdateModeInfo(struct xgi_hw_device_info *HwDeviceExtension,
}
}
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x3d);
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x3d);
if (tempcl & ActiveLCD) {
if ((pVBInfo->SetFlag & ReserveTVOption)) {
if (temp & ActiveTV)
@@ -2916,10 +3344,10 @@ void XGI_UpdateModeInfo(struct xgi_hw_device_info *HwDeviceExtension,
}
temp = tempcl;
tempbl = ~ModeSwitchStatus;
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x3d, tempbl, temp);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x3d, tempbl, temp);
if (!(pVBInfo->SetFlag & ReserveTVOption))
- XGINew_SetReg1(pVBInfo->P3d4, 0x3e, tempch);
+ xgifb_reg_set(pVBInfo->P3d4, 0x3e, tempch);
} else {
return;
}
@@ -2931,7 +3359,7 @@ void XGI_GetVGAType(struct xgi_hw_device_info *HwDeviceExtension,
/*
if ( HwDeviceExtension->jChipType >= XG20 ) {
pVBInfo->Set_VGAType = XG20;
- } else if (HwDeviceExtension->jChipType >= XG40) {
+ } else {
pVBInfo->Set_VGAType = VGA_XGI340;
}
*/
@@ -2948,10 +3376,10 @@ void XGI_GetVBType(struct vb_device_info *pVBInfo)
}
if (pVBInfo->IF_DEF_LVDS == 0) {
tempbx = VB_XGI302B;
- flag = XGINew_GetReg1(pVBInfo->Part4Port, 0x00);
+ flag = xgifb_reg_get(pVBInfo->Part4Port, 0x00);
if (flag != 0x02) {
tempbx = VB_XGI301;
- flag = XGINew_GetReg1(pVBInfo->Part4Port, 0x01);
+ flag = xgifb_reg_get(pVBInfo->Part4Port, 0x01);
if (flag >= 0xB0) {
tempbx = VB_XGI301B;
if (flag >= 0xC0) {
@@ -2961,7 +3389,7 @@ void XGI_GetVBType(struct vb_device_info *pVBInfo)
if (flag >= 0xE0) {
tempbx = VB_XGI302LV;
tempah
- = XGINew_GetReg1(
+ = xgifb_reg_get(
pVBInfo->Part4Port,
0x39);
if (tempah != 0xFF)
@@ -2972,7 +3400,7 @@ void XGI_GetVBType(struct vb_device_info *pVBInfo)
}
if (tempbx & (VB_XGI301B | VB_XGI302B)) {
- flag = XGINew_GetReg1(
+ flag = xgifb_reg_get(
pVBInfo->Part4Port,
0x23);
@@ -3008,9 +3436,9 @@ void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
tempbx = 0;
if (pVBInfo->VBType & 0xFFFF) {
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x30); /* Check Display Device */
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x30); /* Check Display Device */
tempbx = tempbx | temp;
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x31);
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x31);
push = temp;
push = push << 8;
tempax = temp << 8;
@@ -3020,7 +3448,7 @@ void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
temp = 0xFFFF ^ temp;
tempbx &= temp;
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x38);
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x38);
if (pVBInfo->IF_DEF_LCDA == 1) {
@@ -3069,7 +3497,7 @@ void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
& VB_CH7007))) { /* [Billy] 07/05/04 */
if (temp & SetYPbPr) { /* temp = CR38 */
if (pVBInfo->IF_DEF_HiVision == 1) {
- temp = XGINew_GetReg1(
+ temp = xgifb_reg_get(
pVBInfo->P3d4,
0x35); /* shampoo add for new scratch */
temp &= YPbPrMode;
@@ -3257,7 +3685,7 @@ void XGI_GetTVInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
}
if (pVBInfo->VBInfo & SetCRT2ToTV) {
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x35);
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x35);
tempbx = temp;
if (tempbx & SetPALTV) {
tempbx &= (SetCHTVOverScan | SetPALMTV
@@ -3269,7 +3697,7 @@ void XGI_GetTVInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
| SetPALTV);
/*
if (pVBInfo->IF_DEF_LVDS == 0) {
- index1 = XGINew_GetReg1(pVBInfo->P3d4, 0x38); //PAL-M/PAL-N Info
+ index1 = xgifb_reg_get(pVBInfo->P3d4, 0x38); //PAL-M/PAL-N Info
temp2 = (index1 & 0xC0) >> 5; //00:PAL, 01:PAL-M, 10:PAL-N
tempbx |= temp2;
if (temp2 & 0x02) //PAL-M
@@ -3279,14 +3707,14 @@ void XGI_GetTVInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
}
if (pVBInfo->IF_DEF_CH7017 == 1) {
- tempbx = XGINew_GetReg1(pVBInfo->P3d4, 0x35);
+ tempbx = xgifb_reg_get(pVBInfo->P3d4, 0x35);
if (tempbx & TVOverScan)
tempbx |= SetCHTVOverScan;
}
if (pVBInfo->IF_DEF_CH7007 == 1) { /* [Billy] 07/05/04 */
- tempbx = XGINew_GetReg1(pVBInfo->P3d4, 0x35);
+ tempbx = xgifb_reg_get(pVBInfo->P3d4, 0x35);
if (tempbx & TVOverScan)
tempbx |= SetCHTVOverScan;
@@ -3299,7 +3727,7 @@ void XGI_GetTVInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
if (pVBInfo->IF_DEF_YPbPr == 1) {
if (pVBInfo->VBInfo & SetCRT2ToYPbPr) {
- index1 = XGINew_GetReg1(pVBInfo->P3d4, 0x35);
+ index1 = xgifb_reg_get(pVBInfo->P3d4, 0x35);
index1 &= YPbPrMode;
if (index1 == YPbPrMode525i)
@@ -3363,7 +3791,7 @@ unsigned char XGI_GetLCDInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO; /* si+Ext_ResInfo // */
}
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x36); /* Get LCD Res.Info */
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x36); /* Get LCD Res.Info */
tempbx = temp & 0x0F;
if (tempbx == 0)
@@ -3372,7 +3800,7 @@ unsigned char XGI_GetLCDInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
/* LCD75 [2003/8/22] Vicent */
if ((tempbx == Panel1024x768) || (tempbx == Panel1280x1024)) {
if (pVBInfo->VBInfo & DriverMode) {
- tempax = XGINew_GetReg1(pVBInfo->P3d4, 0x33);
+ tempax = xgifb_reg_get(pVBInfo->P3d4, 0x33);
if (pVBInfo->VBInfo & SetCRT2ToLCDA)
tempax &= 0x0F;
else
@@ -3400,7 +3828,7 @@ unsigned char XGI_GetLCDInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
tempbx = 0;
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x37);
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x37);
temp &= (ScalingLCD | LCDNonExpanding | LCDSyncBit | SetPWDEnable);
@@ -3570,7 +3998,7 @@ static unsigned char XGINew_CheckMemorySize(
memorysize = memorysize > MemorySizeShift;
memorysize++; /* Get memory size */
- temp = XGINew_GetReg1(pVBInfo->P3c4, 0x14); /* Get DRAM Size */
+ temp = xgifb_reg_get(pVBInfo->P3c4, 0x14); /* Get DRAM Size */
tmp = temp;
if (HwDeviceExtension->jChipType == XG40) {
@@ -3610,29 +4038,87 @@ void XGINew_IsLowResolution(unsigned short ModeNo, unsigned short ModeIdIndex, u
unsigned short data ;
unsigned short ModeFlag ;
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x0F);
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x0F);
data &= 0x7F;
- XGINew_SetReg1(pVBInfo->P3c4, 0x0F, data);
+ xgifb_reg_set(pVBInfo->P3c4, 0x0F, data);
if (ModeNo > 0x13) {
ModeFlag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
if ((ModeFlag & HalfDCLK) && (ModeFlag & DoubleScanMode)) {
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x0F);
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x0F);
data |= 0x80;
- XGINew_SetReg1(pVBInfo->P3c4, 0x0F, data);
- data = XGINew_GetReg1(pVBInfo->P3c4, 0x01);
+ xgifb_reg_set(pVBInfo->P3c4, 0x0F, data);
+ data = xgifb_reg_get(pVBInfo->P3c4, 0x01);
data &= 0xF7;
- XGINew_SetReg1(pVBInfo->P3c4, 0x01, data);
+ xgifb_reg_set(pVBInfo->P3c4, 0x01, data);
}
}
}
*/
+static unsigned char XG21GPIODataTransfer(unsigned char ujDate)
+{
+ unsigned char ujRet = 0;
+ unsigned char i = 0;
+
+ for (i = 0; i < 8; i++) {
+ ujRet = ujRet << 1;
+ /* ujRet |= GETBITS(ujDate >> i, 0:0); */
+ ujRet |= (ujDate >> i) & 1;
+ }
+
+ return ujRet;
+}
+
+/*----------------------------------------------------------------------------*/
+/* output */
+/* bl[5] : LVDS signal */
+/* bl[1] : LVDS backlight */
+/* bl[0] : LVDS VDD */
+/*----------------------------------------------------------------------------*/
+static unsigned char XGI_XG21GetPSCValue(struct vb_device_info *pVBInfo)
+{
+ unsigned char CR4A, temp;
+
+ CR4A = xgifb_reg_get(pVBInfo->P3d4, 0x4A);
+ xgifb_reg_and(pVBInfo->P3d4, 0x4A, ~0x23); /* enable GPIO write */
+
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x48);
+
+ temp = XG21GPIODataTransfer(temp);
+ temp &= 0x23;
+ xgifb_reg_set(pVBInfo->P3d4, 0x4A, CR4A);
+ return temp;
+}
+
+/*----------------------------------------------------------------------------*/
+/* output */
+/* bl[5] : LVDS signal */
+/* bl[1] : LVDS backlight */
+/* bl[0] : LVDS VDD */
+/*----------------------------------------------------------------------------*/
+static unsigned char XGI_XG27GetPSCValue(struct vb_device_info *pVBInfo)
+{
+ unsigned char CR4A, CRB4, temp;
+
+ CR4A = xgifb_reg_get(pVBInfo->P3d4, 0x4A);
+ xgifb_reg_and(pVBInfo->P3d4, 0x4A, ~0x0C); /* enable GPIO write */
+
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x48);
+
+ temp &= 0x0C;
+ temp >>= 2;
+ xgifb_reg_set(pVBInfo->P3d4, 0x4A, CR4A);
+ CRB4 = xgifb_reg_get(pVBInfo->P3d4, 0xB4);
+ temp |= ((CRB4 & 0x04) << 3);
+ return temp;
+}
+
void XGI_DisplayOn(struct xgi_hw_device_info *pXGIHWDE,
struct vb_device_info *pVBInfo)
{
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x01, 0xDF, 0x00);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x01, 0xDF, 0x00);
if (pXGIHWDE->jChipType == XG21) {
if (pVBInfo->IF_DEF_LVDS == 1) {
if (!(XGI_XG21GetPSCValue(pVBInfo) & 0x1)) {
@@ -3699,184 +4185,43 @@ void XGI_DisplayOff(struct xgi_hw_device_info *pXGIHWDE,
XGI_XG27BLSignalVDD(0x20, 0x00, pVBInfo); /* DVO/DVI signal off */
}
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x01, 0xDF, 0x20);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x01, 0xDF, 0x20);
}
-void XGI_WaitDisply(struct vb_device_info *pVBInfo)
+static void XGI_WaitDisply(struct vb_device_info *pVBInfo)
{
- while ((XGINew_GetReg2(pVBInfo->P3da) & 0x01))
+ while ((inb(pVBInfo->P3da) & 0x01))
break;
- while (!(XGINew_GetReg2(pVBInfo->P3da) & 0x01))
+ while (!(inb(pVBInfo->P3da) & 0x01))
break;
}
-void XGI_SenseCRT1(struct vb_device_info *pVBInfo)
-{
- unsigned char CRTCData[17] = { 0x5F, 0x4F, 0x50, 0x82, 0x55, 0x81,
- 0x0B, 0x3E, 0xE9, 0x0B, 0xDF, 0xE7, 0x04, 0x00, 0x00,
- 0x05, 0x00 };
-
- unsigned char SR01 = 0, SR1F = 0, SR07 = 0, SR06 = 0;
-
- unsigned char CR17, CR63, SR31;
- unsigned short temp;
- unsigned char DAC_TEST_PARMS[3] = { 0x0F, 0x0F, 0x0F };
-
- int i;
- XGINew_SetReg1(pVBInfo->P3c4, 0x05, 0x86);
-
- /* [2004/05/06] Vicent to fix XG42 single LCD sense to CRT+LCD */
- XGINew_SetReg1(pVBInfo->P3d4, 0x57, 0x4A);
- XGINew_SetReg1(pVBInfo->P3d4, 0x53, (unsigned char) (XGINew_GetReg1(
- pVBInfo->P3d4, 0x53) | 0x02));
-
- SR31 = (unsigned char) XGINew_GetReg1(pVBInfo->P3c4, 0x31);
- CR63 = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x63);
- SR01 = (unsigned char) XGINew_GetReg1(pVBInfo->P3c4, 0x01);
-
- XGINew_SetReg1(pVBInfo->P3c4, 0x01, (unsigned char) (SR01 & 0xDF));
- XGINew_SetReg1(pVBInfo->P3d4, 0x63, (unsigned char) (CR63 & 0xBF));
-
- CR17 = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x17);
- XGINew_SetReg1(pVBInfo->P3d4, 0x17, (unsigned char) (CR17 | 0x80));
-
- SR1F = (unsigned char) XGINew_GetReg1(pVBInfo->P3c4, 0x1F);
- XGINew_SetReg1(pVBInfo->P3c4, 0x1F, (unsigned char) (SR1F | 0x04));
-
- SR07 = (unsigned char) XGINew_GetReg1(pVBInfo->P3c4, 0x07);
- XGINew_SetReg1(pVBInfo->P3c4, 0x07, (unsigned char) (SR07 & 0xFB));
- SR06 = (unsigned char) XGINew_GetReg1(pVBInfo->P3c4, 0x06);
- XGINew_SetReg1(pVBInfo->P3c4, 0x06, (unsigned char) (SR06 & 0xC3));
-
- XGINew_SetReg1(pVBInfo->P3d4, 0x11, 0x00);
-
- for (i = 0; i < 8; i++)
- XGINew_SetReg1(pVBInfo->P3d4, (unsigned short) i, CRTCData[i]);
-
- for (i = 8; i < 11; i++)
- XGINew_SetReg1(pVBInfo->P3d4, (unsigned short) (i + 8),
- CRTCData[i]);
-
- for (i = 11; i < 13; i++)
- XGINew_SetReg1(pVBInfo->P3d4, (unsigned short) (i + 4),
- CRTCData[i]);
-
- for (i = 13; i < 16; i++)
- XGINew_SetReg1(pVBInfo->P3c4, (unsigned short) (i - 3),
- CRTCData[i]);
-
- XGINew_SetReg1(pVBInfo->P3c4, 0x0E, (unsigned char) (CRTCData[16]
- & 0xE0));
-
- XGINew_SetReg1(pVBInfo->P3c4, 0x31, 0x00);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2B, 0x1B);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2C, 0xE1);
-
- XGINew_SetReg3(pVBInfo->P3c8, 0x00);
-
- for (i = 0; i < 256; i++) {
- XGINew_SetReg3((pVBInfo->P3c8 + 1),
- (unsigned char) DAC_TEST_PARMS[0]);
- XGINew_SetReg3((pVBInfo->P3c8 + 1),
- (unsigned char) DAC_TEST_PARMS[1]);
- XGINew_SetReg3((pVBInfo->P3c8 + 1),
- (unsigned char) DAC_TEST_PARMS[2]);
- }
-
- XGI_VBLongWait(pVBInfo);
- XGI_VBLongWait(pVBInfo);
- XGI_VBLongWait(pVBInfo);
-
- XGINew_LCD_Wait_Time(0x01, pVBInfo);
-
- XGI_WaitDisply(pVBInfo);
- temp = XGINew_GetReg2(pVBInfo->P3c2);
-
- if (temp & 0x10)
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x32, 0xDF, 0x20);
- else
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x32, 0xDF, 0x00);
-
- /* alan, avoid display something, set BLACK DAC if not restore DAC */
- XGINew_SetReg3(pVBInfo->P3c8, 0x00);
-
- for (i = 0; i < 256; i++) {
- XGINew_SetReg3((pVBInfo->P3c8 + 1), 0);
- XGINew_SetReg3((pVBInfo->P3c8 + 1), 0);
- XGINew_SetReg3((pVBInfo->P3c8 + 1), 0);
- }
-
- XGINew_SetReg1(pVBInfo->P3c4, 0x01, SR01);
- XGINew_SetReg1(pVBInfo->P3d4, 0x63, CR63);
- XGINew_SetReg1(pVBInfo->P3c4, 0x31, SR31);
-
- /* [2004/05/11] Vicent */
- XGINew_SetReg1(pVBInfo->P3d4, 0x53, (unsigned char) (XGINew_GetReg1(
- pVBInfo->P3d4, 0x53) & 0xFD));
- XGINew_SetReg1(pVBInfo->P3c4, 0x1F, (unsigned char) SR1F);
-}
-
#if 0
static void XGI_WaitDisplay(struct vb_device_info *pVBInfo)
{
- while (!(XGINew_GetReg2(pVBInfo->P3da) & 0x01));
- while (XGINew_GetReg2(pVBInfo->P3da) & 0x01);
+ while (!(inb(pVBInfo->P3da) & 0x01));
+ while (inb(pVBInfo->P3da) & 0x01);
}
#endif
-unsigned char XGI_SetCRT2Group301(unsigned short ModeNo,
- struct xgi_hw_device_info *HwDeviceExtension,
- struct vb_device_info *pVBInfo)
-{
- unsigned short tempbx, ModeIdIndex, RefreshRateTableIndex;
-
- tempbx = pVBInfo->VBInfo;
- pVBInfo->SetFlag |= ProgrammingCRT2;
- XGI_SearchModeID(ModeNo, &ModeIdIndex, pVBInfo);
- pVBInfo->SelectCRT2Rate = 4;
- RefreshRateTableIndex = XGI_GetRatePtrCRT2(HwDeviceExtension, ModeNo,
- ModeIdIndex, pVBInfo);
- XGI_SaveCRT2Info(ModeNo, pVBInfo);
- XGI_GetCRT2ResInfo(ModeNo, ModeIdIndex, pVBInfo);
- XGI_GetCRT2Data(ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo);
- XGI_PreSetGroup1(ModeNo, ModeIdIndex, HwDeviceExtension,
- RefreshRateTableIndex, pVBInfo);
- XGI_SetGroup1(ModeNo, ModeIdIndex, HwDeviceExtension,
- RefreshRateTableIndex, pVBInfo);
- XGI_SetLockRegs(ModeNo, ModeIdIndex, HwDeviceExtension,
- RefreshRateTableIndex, pVBInfo);
- XGI_SetGroup2(ModeNo, ModeIdIndex, RefreshRateTableIndex,
- HwDeviceExtension, pVBInfo);
- XGI_SetLCDRegs(ModeNo, ModeIdIndex, HwDeviceExtension,
- RefreshRateTableIndex, pVBInfo);
- XGI_SetTap4Regs(pVBInfo);
- XGI_SetGroup3(ModeNo, ModeIdIndex, pVBInfo);
- XGI_SetGroup4(ModeNo, ModeIdIndex, RefreshRateTableIndex,
- HwDeviceExtension, pVBInfo);
- XGI_SetCRT2VCLK(ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo);
- XGI_SetGroup5(ModeNo, ModeIdIndex, pVBInfo);
- XGI_AutoThreshold(pVBInfo);
- return 1;
-}
-
-void XGI_AutoThreshold(struct vb_device_info *pVBInfo)
+static void XGI_AutoThreshold(struct vb_device_info *pVBInfo)
{
if (!(pVBInfo->SetFlag & Win9xDOSMode))
- XGINew_SetRegOR(pVBInfo->Part1Port, 0x01, 0x40);
+ xgifb_reg_or(pVBInfo->Part1Port, 0x01, 0x40);
}
-void XGI_SaveCRT2Info(unsigned short ModeNo, struct vb_device_info *pVBInfo)
+static void XGI_SaveCRT2Info(unsigned short ModeNo, struct vb_device_info *pVBInfo)
{
unsigned short temp1, temp2;
- XGINew_SetReg1(pVBInfo->P3d4, 0x34, ModeNo); /* reserve CR34 for CRT1 Mode No */
+ xgifb_reg_set(pVBInfo->P3d4, 0x34, ModeNo); /* reserve CR34 for CRT1 Mode No */
temp1 = (pVBInfo->VBInfo & SetInSlaveMode) >> 8;
temp2 = ~(SetInSlaveMode >> 8);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x31, temp2, temp1);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x31, temp2, temp1);
}
-void XGI_GetCRT2ResInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_GetCRT2ResInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
struct vb_device_info *pVBInfo)
{
unsigned short xres, yres, modeflag, resindex;
@@ -3951,7 +4296,7 @@ void XGI_GetCRT2ResInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
pVBInfo->VDE = yres;
}
-unsigned char XGI_IsLCDDualLink(struct vb_device_info *pVBInfo)
+static unsigned char XGI_IsLCDDualLink(struct vb_device_info *pVBInfo)
{
if ((pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) &&
@@ -3961,7 +4306,64 @@ unsigned char XGI_IsLCDDualLink(struct vb_device_info *pVBInfo)
return 0;
}
-void XGI_GetCRT2Data(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_GetRAMDAC2DATA(unsigned short ModeNo, unsigned short ModeIdIndex,
+ unsigned short RefreshRateTableIndex,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short tempax, tempbx, temp1, temp2, modeflag = 0, tempcx,
+ StandTableIndex, CRT1Index;
+
+ pVBInfo->RVBHCMAX = 1;
+ pVBInfo->RVBHCFACT = 1;
+
+ if (ModeNo <= 0x13) {
+ modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
+ StandTableIndex = XGI_GetModePtr(ModeNo, ModeIdIndex, pVBInfo);
+ tempax = pVBInfo->StandTable[StandTableIndex].CRTC[0];
+ tempbx = pVBInfo->StandTable[StandTableIndex].CRTC[6];
+ temp1 = pVBInfo->StandTable[StandTableIndex].CRTC[7];
+ } else {
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ CRT1Index
+ = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
+ CRT1Index &= IndexMask;
+ temp1
+ = (unsigned short) pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[0];
+ temp2
+ = (unsigned short) pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[5];
+ tempax = (temp1 & 0xFF) | ((temp2 & 0x03) << 8);
+ tempbx
+ = (unsigned short) pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[8];
+ tempcx
+ = (unsigned short) pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[14]
+ << 8;
+ tempcx &= 0x0100;
+ tempcx = tempcx << 2;
+ tempbx |= tempcx;
+ temp1
+ = (unsigned short) pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[9];
+ }
+
+ if (temp1 & 0x01)
+ tempbx |= 0x0100;
+
+ if (temp1 & 0x20)
+ tempbx |= 0x0200;
+ tempax += 5;
+
+ if (modeflag & Charx8Dot)
+ tempax *= 8;
+ else
+ tempax *= 9;
+
+ pVBInfo->VGAHT = tempax;
+ pVBInfo->HT = tempax;
+ tempbx++;
+ pVBInfo->VGAVT = tempbx;
+ pVBInfo->VT = tempbx;
+}
+
+static void XGI_GetCRT2Data(unsigned short ModeNo, unsigned short ModeIdIndex,
unsigned short RefreshRateTableIndex,
struct vb_device_info *pVBInfo)
{
@@ -4147,7 +4549,7 @@ void XGI_GetCRT2Data(unsigned short ModeNo, unsigned short ModeIdIndex,
}
}
-void XGI_SetCRT2VCLK(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_SetCRT2VCLK(unsigned short ModeNo, unsigned short ModeIdIndex,
unsigned short RefreshRateTableIndex,
struct vb_device_info *pVBInfo)
{
@@ -4160,253 +4562,43 @@ void XGI_SetCRT2VCLK(unsigned short ModeNo, unsigned short ModeIdIndex,
if (pVBInfo->VBType & VB_XGI301) { /* shampoo 0129 */
/* 301 */
- XGINew_SetReg1(pVBInfo->Part4Port, 0x0A, 0x10);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x0B, di_1);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x0A, di_0);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x0A, 0x10);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x0B, di_1);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x0A, di_0);
} else { /* 301b/302b/301lv/302lv */
- XGINew_SetReg1(pVBInfo->Part4Port, 0x0A, di_0);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x0B, di_1);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x0A, di_0);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x0B, di_1);
}
- XGINew_SetReg1(pVBInfo->Part4Port, 0x00, 0x12);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x00, 0x12);
if (pVBInfo->VBInfo & SetCRT2ToRAMDAC)
- XGINew_SetRegOR(pVBInfo->Part4Port, 0x12, 0x28);
+ xgifb_reg_or(pVBInfo->Part4Port, 0x12, 0x28);
else
- XGINew_SetRegOR(pVBInfo->Part4Port, 0x12, 0x08);
-}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_GETLCDVCLKPtr */
-/* Input : */
-/* Output : al -> VCLK Index */
-/* Description : */
-/* --------------------------------------------------------------------- */
-void XGI_GetLCDVCLKPtr(unsigned char *di_0, unsigned char *di_1,
- struct vb_device_info *pVBInfo)
-{
- unsigned short index;
-
- if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
- if (pVBInfo->IF_DEF_ScaleLCD == 1) {
- if (pVBInfo->LCDInfo & EnableScalingLCD)
- return;
- }
-
- /* index = XGI_GetLCDCapPtr(pVBInfo); */
- index = XGI_GetLCDCapPtr1(pVBInfo);
-
- if (pVBInfo->VBInfo & SetCRT2ToLCD) { /* LCDB */
- *di_0 = pVBInfo->LCDCapList[index].LCUCHAR_VCLKData1;
- *di_1 = pVBInfo->LCDCapList[index].LCUCHAR_VCLKData2;
- } else { /* LCDA */
- *di_0 = pVBInfo->LCDCapList[index].LCDA_VCLKData1;
- *di_1 = pVBInfo->LCDCapList[index].LCDA_VCLKData2;
- }
- }
- return;
+ xgifb_reg_or(pVBInfo->Part4Port, 0x12, 0x08);
}
-unsigned char XGI_GetVCLKPtr(unsigned short RefreshRateTableIndex,
- unsigned short ModeNo, unsigned short ModeIdIndex,
- struct vb_device_info *pVBInfo)
+static unsigned short XGI_GetColorDepth(unsigned short ModeNo,
+ unsigned short ModeIdIndex, struct vb_device_info *pVBInfo)
{
-
- unsigned short index, modeflag;
- unsigned short tempbx;
- unsigned char tempal;
- unsigned char *CHTVVCLKPtr = NULL;
+ unsigned short ColorDepth[6] = { 1, 2, 4, 4, 6, 8 };
+ short index;
+ unsigned short modeflag;
if (ModeNo <= 0x13)
- modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */
+ modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
else
- modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */
-
- if ((pVBInfo->SetFlag & ProgrammingCRT2) && (!(pVBInfo->LCDInfo
- & EnableScalingLCD))) { /* {LCDA/LCDB} */
- index = XGI_GetLCDCapPtr(pVBInfo);
- tempal = pVBInfo->LCDCapList[index].LCD_VCLK;
-
- if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA))
- return tempal;
-
- /* {TV} */
- if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
- | VB_XGI302LV | VB_XGI301C)) {
- if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) {
- tempal = HiTVVCLKDIV2;
- if (!(pVBInfo->TVInfo & RPLLDIV2XO))
- tempal = HiTVVCLK;
- if (pVBInfo->TVInfo & TVSimuMode) {
- tempal = HiTVSimuVCLK;
- if (!(modeflag & Charx8Dot))
- tempal = HiTVTextVCLK;
-
- }
- return tempal;
- }
-
- if (pVBInfo->TVInfo & SetYPbPrMode750p) {
- tempal = YPbPr750pVCLK;
- return tempal;
- }
-
- if (pVBInfo->TVInfo & SetYPbPrMode525p) {
- tempal = YPbPr525pVCLK;
- return tempal;
- }
-
- tempal = NTSC1024VCLK;
-
- if (!(pVBInfo->TVInfo & NTSC1024x768)) {
- tempal = TVVCLKDIV2;
- if (!(pVBInfo->TVInfo & RPLLDIV2XO))
- tempal = TVVCLK;
- }
-
- if (pVBInfo->VBInfo & SetCRT2ToTV)
- return tempal;
- }
- /* else if ((pVBInfo->IF_DEF_CH7017==1)&&(pVBInfo->VBType&VB_CH7017)) {
- if (ModeNo<=0x13)
- *tempal = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC;
- else
- *tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
- *tempal = *tempal & 0x1F;
- tempbx = 0;
- if (pVBInfo->TVInfo & SetPALTV)
- tempbx = tempbx + 2;
- if (pVBInfo->TVInfo & SetCHTVOverScan)
- tempbx++;
- tempbx = tempbx << 1;
- } */
- } /* {End of VB} */
-
- if ((pVBInfo->IF_DEF_CH7007 == 1) && (pVBInfo->VBType & VB_CH7007)) { /* [Billy] 07/05/08 CH7007 */
- /* VideoDebugPrint((0, "XGI_GetVCLKPtr: pVBInfo->IF_DEF_CH7007==1\n")); */
- if ((pVBInfo->VBInfo & SetCRT2ToTV)) {
- if (ModeNo <= 0x13) {
- tempal
- = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC;
- } else {
- tempal
- = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
- }
-
- tempal = tempal & 0x0F;
- tempbx = 0;
-
- if (pVBInfo->TVInfo & SetPALTV)
- tempbx = tempbx + 2;
-
- if (pVBInfo->TVInfo & SetCHTVOverScan)
- tempbx++;
-
- /** tempbx = tempbx << 1; CH7007 ? **/
-
- /* [Billy]07/05/29 CH7007 */
- if (pVBInfo->IF_DEF_CH7007 == 1) {
- switch (tempbx) {
- case 0:
- CHTVVCLKPtr = XGI7007_CHTVVCLKUNTSC;
- break;
- case 1:
- CHTVVCLKPtr = XGI7007_CHTVVCLKONTSC;
- break;
- case 2:
- CHTVVCLKPtr = XGI7007_CHTVVCLKUPAL;
- break;
- case 3:
- CHTVVCLKPtr = XGI7007_CHTVVCLKOPAL;
- break;
- default:
- break;
-
- }
- }
- /* else {
- switch(tempbx) {
- case 0:
- CHTVVCLKPtr = pVBInfo->CHTVVCLKUNTSC;
- break;
- case 1:
- CHTVVCLKPtr = pVBInfo->CHTVVCLKONTSC;
- break;
- case 2:
- CHTVVCLKPtr = pVBInfo->CHTVVCLKUPAL;
- break;
- case 3:
- CHTVVCLKPtr = pVBInfo->CHTVVCLKOPAL;
- break;
- default:
- break;
- }
- }
- */
-
- tempal = CHTVVCLKPtr[tempal];
- return tempal;
- }
-
- }
-
- tempal = (unsigned char) XGINew_GetReg2((pVBInfo->P3ca + 0x02));
- tempal = tempal >> 2;
- tempal &= 0x03;
-
- if ((pVBInfo->LCDInfo & EnableScalingLCD) && (modeflag & Charx8Dot)) /* for Dot8 Scaling LCD */
- tempal = tempal ^ tempal; /* ; set to VCLK25MHz always */
-
- if (ModeNo <= 0x13)
- return tempal;
-
- tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
- return tempal;
-}
-
-void XGI_GetVCLKLen(unsigned char tempal, unsigned char *di_0,
- unsigned char *di_1, struct vb_device_info *pVBInfo)
-{
- if (pVBInfo->IF_DEF_CH7007 == 1) { /* [Billy] 2007/05/16 */
- /* VideoDebugPrint((0, "XGI_GetVCLKLen: pVBInfo->IF_DEF_CH7007==1\n")); */
- *di_0 = (unsigned char) XGI_CH7007VCLKData[tempal].SR2B;
- *di_1 = (unsigned char) XGI_CH7007VCLKData[tempal].SR2C;
- } else if (pVBInfo->VBType & (VB_XGI301 | VB_XGI301B | VB_XGI302B
- | VB_XGI301LV | VB_XGI302LV | VB_XGI301C)) {
- if ((!(pVBInfo->VBInfo & SetCRT2ToLCDA)) && (pVBInfo->SetFlag
- & ProgrammingCRT2)) {
- *di_0 = (unsigned char) XGI_VBVCLKData[tempal].SR2B;
- *di_1 = XGI_VBVCLKData[tempal].SR2C;
- }
- } else {
- *di_0 = XGI_VCLKData[tempal].SR2B;
- *di_1 = XGI_VCLKData[tempal].SR2C;
- }
-}
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
-static void XGI_SetCRT2Offset(unsigned short ModeNo,
- unsigned short ModeIdIndex,
- unsigned short RefreshRateTableIndex,
- struct xgi_hw_device_info *HwDeviceExtension,
- struct vb_device_info *pVBInfo)
-{
- unsigned short offset;
- unsigned char temp;
+ index = (modeflag & ModeInfoFlag) - ModeEGA;
- if (pVBInfo->VBInfo & SetInSlaveMode)
- return;
+ if (index < 0)
+ index = 0;
- offset = XGI_GetOffset(ModeNo, ModeIdIndex, RefreshRateTableIndex,
- HwDeviceExtension, pVBInfo);
- temp = (unsigned char) (offset & 0xFF);
- XGINew_SetReg1(pVBInfo->Part1Port, 0x07, temp);
- temp = (unsigned char) ((offset & 0xFF00) >> 8);
- XGINew_SetReg1(pVBInfo->Part1Port, 0x09, temp);
- temp = (unsigned char) (((offset >> 3) & 0xFF) + 1);
- XGINew_SetReg1(pVBInfo->Part1Port, 0x03, temp);
+ return ColorDepth[index];
}
-unsigned short XGI_GetOffset(unsigned short ModeNo, unsigned short ModeIdIndex,
+static unsigned short XGI_GetOffset(unsigned short ModeNo, unsigned short ModeIdIndex,
unsigned short RefreshRateTableIndex,
struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
@@ -4441,13 +4633,35 @@ unsigned short XGI_GetOffset(unsigned short ModeNo, unsigned short ModeIdIndex,
}
}
+static void XGI_SetCRT2Offset(unsigned short ModeNo,
+ unsigned short ModeIdIndex,
+ unsigned short RefreshRateTableIndex,
+ struct xgi_hw_device_info *HwDeviceExtension,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short offset;
+ unsigned char temp;
+
+ if (pVBInfo->VBInfo & SetInSlaveMode)
+ return;
+
+ offset = XGI_GetOffset(ModeNo, ModeIdIndex, RefreshRateTableIndex,
+ HwDeviceExtension, pVBInfo);
+ temp = (unsigned char) (offset & 0xFF);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x07, temp);
+ temp = (unsigned char) ((offset & 0xFF00) >> 8);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x09, temp);
+ temp = (unsigned char) (((offset >> 3) & 0xFF) + 1);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x03, temp);
+}
+
static void XGI_SetCRT2FIFO(struct vb_device_info *pVBInfo)
{
- XGINew_SetReg1(pVBInfo->Part1Port, 0x01, 0x3B); /* threshold high ,disable auto threshold */
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x02, ~(0x3F), 0x04); /* threshold low default 04h */
+ xgifb_reg_set(pVBInfo->Part1Port, 0x01, 0x3B); /* threshold high ,disable auto threshold */
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x02, ~(0x3F), 0x04); /* threshold low default 04h */
}
-void XGI_PreSetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_PreSetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex,
struct xgi_hw_device_info *HwDeviceExtension,
unsigned short RefreshRateTableIndex,
struct vb_device_info *pVBInfo)
@@ -4466,13 +4680,13 @@ void XGI_PreSetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex,
/* XGI_SetCRT2Sync(ModeNo,RefreshRateTableIndex); */
for (tempcx = 4; tempcx < 7; tempcx++)
- XGINew_SetReg1(pVBInfo->Part1Port, tempcx, 0x0);
+ xgifb_reg_set(pVBInfo->Part1Port, tempcx, 0x0);
- XGINew_SetReg1(pVBInfo->Part1Port, 0x50, 0x00);
- XGINew_SetReg1(pVBInfo->Part1Port, 0x02, 0x44); /* temp 0206 */
+ xgifb_reg_set(pVBInfo->Part1Port, 0x50, 0x00);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x02, 0x44); /* temp 0206 */
}
-void XGI_SetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_SetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex,
struct xgi_hw_device_info *HwDeviceExtension,
unsigned short RefreshRateTableIndex,
struct vb_device_info *pVBInfo)
@@ -4494,11 +4708,11 @@ void XGI_SetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex,
/* bainy change table name */
if (modeflag & HalfDCLK) {
temp = (pVBInfo->VGAHT / 2 - 1) & 0x0FF; /* BTVGA2HT 0x08,0x09 */
- XGINew_SetReg1(pVBInfo->Part1Port, 0x08, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x08, temp);
temp = (((pVBInfo->VGAHT / 2 - 1) & 0xFF00) >> 8) << 4;
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x09, ~0x0F0, temp);
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x09, ~0x0F0, temp);
temp = (pVBInfo->VGAHDE / 2 + 16) & 0x0FF; /* BTVGA2HDEE 0x0A,0x0C */
- XGINew_SetReg1(pVBInfo->Part1Port, 0x0A, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x0A, temp);
tempcx = ((pVBInfo->VGAHT - pVBInfo->VGAHDE) / 2) >> 2;
pushbx = pVBInfo->VGAHDE / 2 + 16;
tempcx = tempcx >> 1;
@@ -4525,14 +4739,14 @@ void XGI_SetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex,
temp = tempbx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x0B, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x0B, temp);
} else {
temp = (pVBInfo->VGAHT - 1) & 0x0FF; /* BTVGA2HT 0x08,0x09 */
- XGINew_SetReg1(pVBInfo->Part1Port, 0x08, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x08, temp);
temp = (((pVBInfo->VGAHT - 1) & 0xFF00) >> 8) << 4;
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x09, ~0x0F0, temp);
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x09, ~0x0F0, temp);
temp = (pVBInfo->VGAHDE + 16) & 0x0FF; /* BTVGA2HDEE 0x0A,0x0C */
- XGINew_SetReg1(pVBInfo->Part1Port, 0x0A, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x0A, temp);
tempcx = (pVBInfo->VGAHT - pVBInfo->VGAHDE) >> 2; /* cx */
pushbx = pVBInfo->VGAHDE + 16;
tempcx = tempcx >> 1;
@@ -4557,7 +4771,7 @@ void XGI_SetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex,
tempcx = pVBInfo->VGAHT;
temp = tempbx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x0B, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x0B, temp);
}
tempax = (tempax & 0x00FF) | (tempbx & 0xFF00);
@@ -4565,9 +4779,9 @@ void XGI_SetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex,
tempbx = (tempbx & 0x00FF) | ((tempbx & 0xFF00) << 4);
tempax |= (tempbx & 0xFF00);
temp = (tempax & 0xFF00) >> 8;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x0C, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x0C, temp);
temp = tempcx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x0D, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x0D, temp);
tempcx = (pVBInfo->VGAVT - 1);
temp = tempcx & 0x00FF;
@@ -4576,13 +4790,13 @@ void XGI_SetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex,
temp--;
}
- XGINew_SetReg1(pVBInfo->Part1Port, 0x0E, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x0E, temp);
tempbx = pVBInfo->VGAVDE - 1;
temp = tempbx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x0F, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x0F, temp);
temp = ((tempbx & 0xFF00) << 3) >> 8;
temp |= ((tempcx & 0xFF00) >> 8);
- XGINew_SetReg1(pVBInfo->Part1Port, 0x12, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x12, temp);
tempax = pVBInfo->VGAVDE;
tempbx = pVBInfo->VGAVDE;
@@ -4610,10 +4824,10 @@ void XGI_SetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex,
}
temp = tempbx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x10, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x10, temp);
temp = ((tempbx & 0xFF00) >> 8) << 4;
temp = ((tempcx & 0x000F) | (temp));
- XGINew_SetReg1(pVBInfo->Part1Port, 0x11, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x11, temp);
tempax = 0;
if (modeflag & DoubleScanMode)
@@ -4622,10 +4836,22 @@ void XGI_SetGroup1(unsigned short ModeNo, unsigned short ModeIdIndex,
if (modeflag & HalfDCLK)
tempax |= 0x40;
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x2C, ~0x0C0, tempax);
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x2C, ~0x0C0, tempax);
+}
+
+static unsigned short XGI_GetVGAHT2(struct vb_device_info *pVBInfo)
+{
+ unsigned long tempax, tempbx;
+
+ tempbx = ((pVBInfo->VGAVT - pVBInfo->VGAVDE) * pVBInfo->RVBHCMAX)
+ & 0xFFFF;
+ tempax = (pVBInfo->VT - pVBInfo->VDE) * pVBInfo->RVBHCFACT;
+ tempax = (tempax * pVBInfo->HT) / tempbx;
+
+ return (unsigned short) tempax;
}
-void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
struct xgi_hw_device_info *HwDeviceExtension,
unsigned short RefreshRateTableIndex,
struct vb_device_info *pVBInfo)
@@ -4647,7 +4873,7 @@ void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
return;
temp = 0xFF; /* set MAX HT */
- XGINew_SetReg1(pVBInfo->Part1Port, 0x03, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x03, temp);
/* if (modeflag & Charx8Dot) */
/* tempcx = 0x08; */
/* else */
@@ -4664,7 +4890,7 @@ void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
tempax = (tempax / tempcx) - 1;
tempbx |= ((tempax & 0x00FF) << 8);
temp = tempax & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x04, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x04, temp);
temp = (tempbx & 0xFF00) >> 8;
@@ -4685,8 +4911,8 @@ void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
}
}
- XGINew_SetReg1(pVBInfo->Part1Port, 0x05, temp); /* 0x05 Horizontal Display Start */
- XGINew_SetReg1(pVBInfo->Part1Port, 0x06, 0x03); /* 0x06 Horizontal Blank end */
+ xgifb_reg_set(pVBInfo->Part1Port, 0x05, temp); /* 0x05 Horizontal Display Start */
+ xgifb_reg_set(pVBInfo->Part1Port, 0x06, 0x03); /* 0x06 Horizontal Blank end */
if (!(pVBInfo->VBInfo & DisableCRT2Display)) { /* 030226 bainy */
if (pVBInfo->VBInfo & SetCRT2ToTV)
@@ -4763,30 +4989,30 @@ void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
}
}
- XGINew_SetReg1(pVBInfo->Part1Port, 0x07, temp); /* 0x07 Horizontal Retrace Start */
- XGINew_SetReg1(pVBInfo->Part1Port, 0x08, 0); /* 0x08 Horizontal Retrace End */
+ xgifb_reg_set(pVBInfo->Part1Port, 0x07, temp); /* 0x07 Horizontal Retrace Start */
+ xgifb_reg_set(pVBInfo->Part1Port, 0x08, 0); /* 0x08 Horizontal Retrace End */
if (pVBInfo->VBInfo & SetCRT2ToTV) {
if (pVBInfo->TVInfo & TVSimuMode) {
if ((ModeNo == 0x06) || (ModeNo == 0x10) || (ModeNo
== 0x11) || (ModeNo == 0x13) || (ModeNo
== 0x0F)) {
- XGINew_SetReg1(pVBInfo->Part1Port, 0x07, 0x5b);
- XGINew_SetReg1(pVBInfo->Part1Port, 0x08, 0x03);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x07, 0x5b);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x08, 0x03);
}
if ((ModeNo == 0x00) || (ModeNo == 0x01)) {
if (pVBInfo->TVInfo & SetNTSCTV) {
- XGINew_SetReg1(pVBInfo->Part1Port,
+ xgifb_reg_set(pVBInfo->Part1Port,
0x07, 0x2A);
- XGINew_SetReg1(pVBInfo->Part1Port,
+ xgifb_reg_set(pVBInfo->Part1Port,
0x08, 0x61);
} else {
- XGINew_SetReg1(pVBInfo->Part1Port,
+ xgifb_reg_set(pVBInfo->Part1Port,
0x07, 0x2A);
- XGINew_SetReg1(pVBInfo->Part1Port,
+ xgifb_reg_set(pVBInfo->Part1Port,
0x08, 0x41);
- XGINew_SetReg1(pVBInfo->Part1Port,
+ xgifb_reg_set(pVBInfo->Part1Port,
0x0C, 0xF0);
}
}
@@ -4794,16 +5020,16 @@ void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
if ((ModeNo == 0x02) || (ModeNo == 0x03) || (ModeNo
== 0x07)) {
if (pVBInfo->TVInfo & SetNTSCTV) {
- XGINew_SetReg1(pVBInfo->Part1Port,
+ xgifb_reg_set(pVBInfo->Part1Port,
0x07, 0x54);
- XGINew_SetReg1(pVBInfo->Part1Port,
+ xgifb_reg_set(pVBInfo->Part1Port,
0x08, 0x00);
} else {
- XGINew_SetReg1(pVBInfo->Part1Port,
+ xgifb_reg_set(pVBInfo->Part1Port,
0x07, 0x55);
- XGINew_SetReg1(pVBInfo->Part1Port,
+ xgifb_reg_set(pVBInfo->Part1Port,
0x08, 0x00);
- XGINew_SetReg1(pVBInfo->Part1Port,
+ xgifb_reg_set(pVBInfo->Part1Port,
0x0C, 0xF0);
}
}
@@ -4811,23 +5037,23 @@ void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
if ((ModeNo == 0x04) || (ModeNo == 0x05) || (ModeNo
== 0x0D) || (ModeNo == 0x50)) {
if (pVBInfo->TVInfo & SetNTSCTV) {
- XGINew_SetReg1(pVBInfo->Part1Port,
+ xgifb_reg_set(pVBInfo->Part1Port,
0x07, 0x30);
- XGINew_SetReg1(pVBInfo->Part1Port,
+ xgifb_reg_set(pVBInfo->Part1Port,
0x08, 0x03);
} else {
- XGINew_SetReg1(pVBInfo->Part1Port,
+ xgifb_reg_set(pVBInfo->Part1Port,
0x07, 0x2f);
- XGINew_SetReg1(pVBInfo->Part1Port,
+ xgifb_reg_set(pVBInfo->Part1Port,
0x08, 0x02);
}
}
}
}
- XGINew_SetReg1(pVBInfo->Part1Port, 0x18, 0x03); /* 0x18 SR0B */
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x19, 0xF0, 0x00);
- XGINew_SetReg1(pVBInfo->Part1Port, 0x09, 0xFF); /* 0x09 Set Max VT */
+ xgifb_reg_set(pVBInfo->Part1Port, 0x18, 0x03); /* 0x18 SR0B */
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x19, 0xF0, 0x00);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x09, 0xFF); /* 0x09 Set Max VT */
tempbx = pVBInfo->VGAVT;
push1 = tempbx;
@@ -4861,11 +5087,11 @@ void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
temp = tempbx & 0x00FF;
tempbx--;
temp = tempbx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x10, temp); /* 0x10 vertical Blank Start */
+ xgifb_reg_set(pVBInfo->Part1Port, 0x10, temp); /* 0x10 vertical Blank Start */
tempbx = push2;
tempbx--;
temp = tempbx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x0E, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x0E, temp);
if (tempbx & 0x0100)
tempcx |= 0x0002;
@@ -4879,12 +5105,12 @@ void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
tempcx |= 0x0040;
temp = (tempax & 0xFF00) >> 8;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x0B, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x0B, temp);
if (tempbx & 0x0400)
tempcx |= 0x0600;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x11, 0x00); /* 0x11 Vertival Blank End */
+ xgifb_reg_set(pVBInfo->Part1Port, 0x11, 0x00); /* 0x11 Vertival Blank End */
tempax = push1;
tempax -= tempbx; /* 0x0C Vertical Retrace Start */
@@ -4948,16 +5174,16 @@ void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
}
temp = tempbx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x0C, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x0C, temp);
tempbx--;
temp = tempbx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x10, temp);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x10, temp);
if (tempbx & 0x0100)
tempcx |= 0x0008;
if (tempbx & 0x0200)
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x0B, 0x0FF, 0x20);
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x0B, 0x0FF, 0x20);
tempbx++;
@@ -4973,15 +5199,15 @@ void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
tempbx = push1; /* pop ax */
temp = tempbx & 0x00FF;
temp &= 0x0F;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x0D, temp); /* 0x0D vertical Retrace End */
+ xgifb_reg_set(pVBInfo->Part1Port, 0x0D, temp); /* 0x0D vertical Retrace End */
if (tempbx & 0x0010)
tempcx |= 0x2000;
temp = tempcx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x0A, temp); /* 0x0A CR07 */
+ xgifb_reg_set(pVBInfo->Part1Port, 0x0A, temp); /* 0x0A CR07 */
temp = (tempcx & 0x0FF00) >> 8;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x17, temp); /* 0x17 SR0A */
+ xgifb_reg_set(pVBInfo->Part1Port, 0x17, temp); /* 0x17 SR0A */
tempax = modeflag;
temp = (tempax & 0xFF00) >> 8;
@@ -4990,21 +5216,21 @@ void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
if (pVBInfo->VBType & (VB_XGI301LV | VB_XGI302LV | VB_XGI301C))
temp |= 0x01;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x16, temp); /* 0x16 SR01 */
- XGINew_SetReg1(pVBInfo->Part1Port, 0x0F, 0); /* 0x0F CR14 */
- XGINew_SetReg1(pVBInfo->Part1Port, 0x12, 0); /* 0x12 CR17 */
+ xgifb_reg_set(pVBInfo->Part1Port, 0x16, temp); /* 0x16 SR01 */
+ xgifb_reg_set(pVBInfo->Part1Port, 0x0F, 0); /* 0x0F CR14 */
+ xgifb_reg_set(pVBInfo->Part1Port, 0x12, 0); /* 0x12 CR17 */
if (pVBInfo->LCDInfo & LCDRGB18Bit)
temp = 0x80;
else
temp = 0x00;
- XGINew_SetReg1(pVBInfo->Part1Port, 0x1A, temp); /* 0x1A SR0E */
+ xgifb_reg_set(pVBInfo->Part1Port, 0x1A, temp); /* 0x1A SR0E */
return;
}
-void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
unsigned short RefreshRateTableIndex,
struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
@@ -5048,7 +5274,7 @@ void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
tempax = (tempax & 0xff00) >> 8;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x0, tempax);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x0, tempax);
TimingPoint = pVBInfo->NTSCTiming;
if (pVBInfo->TVInfo & SetPALTV)
@@ -5079,17 +5305,17 @@ void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
}
for (i = 0x01, j = 0; i <= 0x2D; i++, j++)
- XGINew_SetReg1(pVBInfo->Part2Port, i, TimingPoint[j]);
+ xgifb_reg_set(pVBInfo->Part2Port, i, TimingPoint[j]);
for (i = 0x39; i <= 0x45; i++, j++)
- XGINew_SetReg1(pVBInfo->Part2Port, i, TimingPoint[j]); /* di->temp2[j] */
+ xgifb_reg_set(pVBInfo->Part2Port, i, TimingPoint[j]); /* di->temp2[j] */
if (pVBInfo->VBInfo & SetCRT2ToTV)
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x3A, 0x1F, 0x00);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x3A, 0x1F, 0x00);
temp = pVBInfo->NewFlickerMode;
temp &= 0x80;
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x0A, 0xFF, temp);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x0A, 0xFF, temp);
if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV)
tempax = 950;
@@ -5121,7 +5347,7 @@ void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
}
}
- XGINew_SetReg1(pVBInfo->Part2Port, 0x01, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x01, temp);
tempax = push1;
temp = (tempax & 0xFF00) >> 8;
temp += TimingPoint[1];
@@ -5139,7 +5365,7 @@ void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
}
}
}
- XGINew_SetReg1(pVBInfo->Part2Port, 0x02, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x02, temp);
}
/* 301b */
@@ -5150,10 +5376,10 @@ void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
tempcx -= 2;
temp = tempcx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x1B, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x1B, temp);
temp = (tempcx & 0xFF00) >> 8;
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x1D, ~0x0F, temp);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x1D, ~0x0F, temp);
tempcx = pVBInfo->HT >> 1;
push1 = tempcx; /* push cx */
@@ -5164,16 +5390,16 @@ void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
temp = tempcx & 0x00FF;
temp = temp << 4;
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x22, 0x0F, temp);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x22, 0x0F, temp);
tempbx = TimingPoint[j] | ((TimingPoint[j + 1]) << 8);
tempbx += tempcx;
push2 = tempbx;
temp = tempbx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x24, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x24, temp);
temp = (tempbx & 0xFF00) >> 8;
temp = temp << 4;
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x25, 0x0F, temp);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x25, 0x0F, temp);
tempbx = push2;
tempbx = tempbx + 8;
@@ -5183,14 +5409,14 @@ void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
}
temp = (tempbx & 0x00FF) << 4;
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x29, 0x0F, temp);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x29, 0x0F, temp);
j += 2;
tempcx += (TimingPoint[j] | ((TimingPoint[j + 1]) << 8));
temp = tempcx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x27, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x27, temp);
temp = ((tempcx & 0xFF00) >> 8) << 4;
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x28, 0x0F, temp);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x28, 0x0F, temp);
tempcx += 8;
if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV)
@@ -5198,7 +5424,7 @@ void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
temp = tempcx & 0xFF;
temp = temp << 4;
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x2A, 0x0F, temp);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x2A, 0x0F, temp);
tempcx = push1; /* pop cx */
j += 2;
@@ -5206,7 +5432,7 @@ void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
tempcx -= temp;
temp = tempcx & 0x00FF;
temp = temp << 4;
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x2D, 0x0F, temp);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x2D, 0x0F, temp);
tempcx -= 11;
@@ -5215,7 +5441,7 @@ void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
tempcx = tempax - 1;
}
temp = tempcx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x2E, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x2E, temp);
tempbx = pVBInfo->VDE;
@@ -5254,7 +5480,7 @@ void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
}
}
- XGINew_SetReg1(pVBInfo->Part2Port, 0x2F, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x2F, temp);
temp = (tempcx & 0xFF00) >> 8;
temp |= ((tempbx & 0xFF00) >> 8) << 6;
@@ -5274,7 +5500,7 @@ void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
}
}
- XGINew_SetReg1(pVBInfo->Part2Port, 0x30, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x30, temp);
if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
| VB_XGI302LV | VB_XGI301C)) { /* TV gatingno */
@@ -5295,13 +5521,13 @@ void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
if (tempbx & 0x0400)
temp |= 0x40;
- XGINew_SetReg1(pVBInfo->Part4Port, 0x10, temp);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x10, temp);
}
temp = (((tempbx - 3) & 0x0300) >> 8) << 5;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x46, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x46, temp);
temp = (tempbx - 3) & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x47, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x47, temp);
}
tempbx = tempbx & 0x00FF;
@@ -5371,9 +5597,9 @@ void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
temp = (tempax & 0x00FF) >> 8;
}
- XGINew_SetReg1(pVBInfo->Part2Port, 0x44, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x44, temp);
temp = (tempbx & 0xFF00) >> 8;
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x45, ~0x03F, temp);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x45, ~0x03F, temp);
temp = tempcx & 0x00FF;
if (tempbx & 0x2000)
@@ -5382,7 +5608,7 @@ void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
if (!(pVBInfo->VBInfo & SetCRT2ToLCD))
temp |= 0x18;
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x46, ~0x1F, temp);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x46, ~0x1F, temp);
if (pVBInfo->TVInfo & SetPALTV) {
tempbx = 0x0382;
tempcx = 0x007e;
@@ -5392,9 +5618,9 @@ void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
}
temp = tempbx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x4b, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x4b, temp);
temp = tempcx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x4c, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x4c, temp);
temp = ((tempcx & 0xFF00) >> 8) & 0x03;
temp = temp << 2;
@@ -5410,48 +5636,48 @@ void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
temp |= 0x60;
}
- XGINew_SetReg1(pVBInfo->Part2Port, 0x4d, temp);
- temp = XGINew_GetReg1(pVBInfo->Part2Port, 0x43); /* 301b change */
- XGINew_SetReg1(pVBInfo->Part2Port, 0x43, (unsigned short) (temp - 3));
+ xgifb_reg_set(pVBInfo->Part2Port, 0x4d, temp);
+ temp = xgifb_reg_get(pVBInfo->Part2Port, 0x43); /* 301b change */
+ xgifb_reg_set(pVBInfo->Part2Port, 0x43, (unsigned short) (temp - 3));
if (!(pVBInfo->TVInfo & (SetYPbPrMode525p | SetYPbPrMode750p))) {
if (pVBInfo->TVInfo & NTSC1024x768) {
TimingPoint = XGI_NTSC1024AdjTime;
for (i = 0x1c, j = 0; i <= 0x30; i++, j++) {
- XGINew_SetReg1(pVBInfo->Part2Port, i,
+ xgifb_reg_set(pVBInfo->Part2Port, i,
TimingPoint[j]);
}
- XGINew_SetReg1(pVBInfo->Part2Port, 0x43, 0x72);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x43, 0x72);
}
}
/* [ycchen] 01/14/03 Modify for 301C PALM Support */
if (pVBInfo->VBType & VB_XGI301C) {
if (pVBInfo->TVInfo & SetPALMTV)
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x4E, ~0x08,
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x4E, ~0x08,
0x08); /* PALM Mode */
}
if (pVBInfo->TVInfo & SetPALMTV) {
- tempax = (unsigned char) XGINew_GetReg1(pVBInfo->Part2Port,
+ tempax = (unsigned char) xgifb_reg_get(pVBInfo->Part2Port,
0x01);
tempax--;
- XGINew_SetRegAND(pVBInfo->Part2Port, 0x01, tempax);
+ xgifb_reg_and(pVBInfo->Part2Port, 0x01, tempax);
/* if ( !( pVBInfo->VBType & VB_XGI301C ) ) */
- XGINew_SetRegAND(pVBInfo->Part2Port, 0x00, 0xEF);
+ xgifb_reg_and(pVBInfo->Part2Port, 0x00, 0xEF);
}
if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) {
if (!(pVBInfo->VBInfo & SetInSlaveMode))
- XGINew_SetReg1(pVBInfo->Part2Port, 0x0B, 0x00);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x0B, 0x00);
}
if (pVBInfo->VBInfo & SetCRT2ToTV)
return;
}
-void XGI_SetLCDRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_SetLCDRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
struct xgi_hw_device_info *HwDeviceExtension,
unsigned short RefreshRateTableIndex,
struct vb_device_info *pVBInfo)
@@ -5482,10 +5708,10 @@ void XGI_SetLCDRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
tempbx -= 1;
temp = tempbx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x2C, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x2C, temp);
temp = (tempbx & 0xFF00) >> 8;
temp = temp << 4;
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x2B, 0x0F, temp);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x2B, 0x0F, temp);
temp = 0x01;
if (pVBInfo->LCDResInfo == Panel1280x1024) {
@@ -5498,26 +5724,26 @@ void XGI_SetLCDRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
}
}
- XGINew_SetReg1(pVBInfo->Part2Port, 0x0B, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x0B, temp);
tempbx = pVBInfo->VDE; /* RTVACTEO=(VDE-1)&0xFF */
push1 = tempbx;
tempbx--;
temp = tempbx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x03, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x03, temp);
temp = ((tempbx & 0xFF00) >> 8) & 0x07;
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x0C, ~0x07, temp);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x0C, ~0x07, temp);
tempcx = pVBInfo->VT - 1;
push2 = tempcx + 1;
temp = tempcx & 0x00FF; /* RVTVT=VT-1 */
- XGINew_SetReg1(pVBInfo->Part2Port, 0x19, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x19, temp);
temp = (tempcx & 0xFF00) >> 8;
temp = temp << 5;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x1A, temp);
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x09, 0xF0, 0x00);
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x0A, 0xF0, 0x00);
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x17, 0xFB, 0x00);
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x18, 0xDF, 0x00);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x1A, temp);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x09, 0xF0, 0x00);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x0A, 0xF0, 0x00);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x17, 0xFB, 0x00);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x18, 0xDF, 0x00);
/* Customized LCDB Des no add */
tempbx = 5;
@@ -5558,15 +5784,15 @@ void XGI_SetLCDRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
tempcx -= tempax; /* lcdvdes */
temp = tempbx & 0x00FF; /* RVEQ1EQ=lcdvdes */
- XGINew_SetReg1(pVBInfo->Part2Port, 0x05, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x05, temp);
temp = tempcx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x06, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x06, temp);
tempch = ((tempcx & 0xFF00) >> 8) & 0x07;
tempbh = ((tempbx & 0xFF00) >> 8) & 0x07;
tempah = tempch;
tempah = tempah << 3;
tempah |= tempbh;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x02, tempah);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x02, tempah);
/* getlcdsync() */
XGI_GetLCDSync(&tempax, &tempbx, pVBInfo);
@@ -5580,11 +5806,11 @@ void XGI_SetLCDRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
tempcx -= tempax;
temp = tempbx & 0x00FF; /* RTVACTEE=lcdvrs */
- XGINew_SetReg1(pVBInfo->Part2Port, 0x04, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x04, temp);
temp = (tempbx & 0xFF00) >> 8;
temp = temp << 4;
temp |= (tempcx & 0x000F);
- XGINew_SetReg1(pVBInfo->Part2Port, 0x01, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x01, temp);
tempcx = pushbx;
tempax = pVBInfo->HT;
tempbx = pVBInfo->LCDHDES;
@@ -5608,13 +5834,13 @@ void XGI_SetLCDRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
tempcx -= tempax;
temp = tempbx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x1F, temp); /* RHBLKE=lcdhdes */
+ xgifb_reg_set(pVBInfo->Part2Port, 0x1F, temp); /* RHBLKE=lcdhdes */
temp = ((tempbx & 0xFF00) >> 8) << 4;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x20, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x20, temp);
temp = tempcx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x23, temp); /* RHEQPLE=lcdhdee */
+ xgifb_reg_set(pVBInfo->Part2Port, 0x23, temp); /* RHEQPLE=lcdhdee */
temp = (tempcx & 0xFF00) >> 8;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x25, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x25, temp);
/* getlcdsync() */
XGI_GetLCDSync(&tempax, &tempbx, pVBInfo);
@@ -5637,13 +5863,13 @@ void XGI_SetLCDRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
tempcx -= tempax;
temp = tempbx & 0x00FF; /* RHBURSTS=lcdhrs */
- XGINew_SetReg1(pVBInfo->Part2Port, 0x1C, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x1C, temp);
temp = (tempbx & 0xFF00) >> 8;
temp = temp << 4;
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x1D, ~0x0F0, temp);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x1D, ~0x0F0, temp);
temp = tempcx & 0x00FF; /* RHSYEXP2S=lcdhre */
- XGINew_SetReg1(pVBInfo->Part2Port, 0x21, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x21, temp);
if (!(pVBInfo->LCDInfo & LCDVESATiming)) {
if (pVBInfo->VGAVDE == 525) {
@@ -5654,8 +5880,8 @@ void XGI_SetLCDRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
} else
temp = 0xC4;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x2f, temp);
- XGINew_SetReg1(pVBInfo->Part2Port, 0x30, 0xB3);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x2f, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x30, 0xB3);
}
if (pVBInfo->VGAVDE == 420) {
@@ -5665,7 +5891,7 @@ void XGI_SetLCDRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
temp = 0x4F;
} else
temp = 0x4E;
- XGINew_SetReg1(pVBInfo->Part2Port, 0x2f, temp);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x2f, temp);
}
}
}
@@ -5676,7 +5902,7 @@ void XGI_SetLCDRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
/* Output : di -> Tap4 Reg. Setting Pointer */
/* Description : */
/* --------------------------------------------------------------------- */
-struct XGI301C_Tap4TimingStruct *XGI_GetTap4Ptr(unsigned short tempcx,
+static struct XGI301C_Tap4TimingStruct *XGI_GetTap4Ptr(unsigned short tempcx,
struct vb_device_info *pVBInfo)
{
unsigned short tempax, tempbx, i;
@@ -5722,7 +5948,7 @@ struct XGI301C_Tap4TimingStruct *XGI_GetTap4Ptr(unsigned short tempcx,
return &Tap4TimingPtr[i];
}
-void XGI_SetTap4Regs(struct vb_device_info *pVBInfo)
+static void XGI_SetTap4Regs(struct vb_device_info *pVBInfo)
{
unsigned short i, j;
@@ -5732,27 +5958,27 @@ void XGI_SetTap4Regs(struct vb_device_info *pVBInfo)
return;
#ifndef Tap4
- XGINew_SetRegAND(pVBInfo->Part2Port, 0x4E, 0xEB); /* Disable Tap4 */
+ xgifb_reg_and(pVBInfo->Part2Port, 0x4E, 0xEB); /* Disable Tap4 */
#else /* Tap4 Setting */
Tap4TimingPtr = XGI_GetTap4Ptr(0, pVBInfo); /* Set Horizontal Scaling */
for (i = 0x80, j = 0; i <= 0xBF; i++, j++)
- XGINew_SetReg1(pVBInfo->Part2Port, i, Tap4TimingPtr->Reg[j]);
+ xgifb_reg_set(pVBInfo->Part2Port, i, Tap4TimingPtr->Reg[j]);
if ((pVBInfo->VBInfo & SetCRT2ToTV) && (!(pVBInfo->VBInfo & SetCRT2ToHiVisionTV))) {
Tap4TimingPtr = XGI_GetTap4Ptr(1, pVBInfo); /* Set Vertical Scaling */
for (i = 0xC0, j = 0; i < 0xFF; i++, j++)
- XGINew_SetReg1(pVBInfo->Part2Port, i, Tap4TimingPtr->Reg[j]);
+ xgifb_reg_set(pVBInfo->Part2Port, i, Tap4TimingPtr->Reg[j]);
}
if ((pVBInfo->VBInfo & SetCRT2ToTV) && (!(pVBInfo->VBInfo & SetCRT2ToHiVisionTV)))
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x4E, ~0x14, 0x04); /* Enable V.Scaling */
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x4E, ~0x14, 0x04); /* Enable V.Scaling */
else
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x4E, ~0x14, 0x10); /* Enable H.Scaling */
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x4E, ~0x14, 0x10); /* Enable H.Scaling */
#endif
}
-void XGI_SetGroup3(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_SetGroup3(unsigned short ModeNo, unsigned short ModeIdIndex,
struct vb_device_info *pVBInfo)
{
unsigned short i;
@@ -5764,22 +5990,22 @@ void XGI_SetGroup3(unsigned short ModeNo, unsigned short ModeIdIndex,
else
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */
- XGINew_SetReg1(pVBInfo->Part3Port, 0x00, 0x00);
+ xgifb_reg_set(pVBInfo->Part3Port, 0x00, 0x00);
if (pVBInfo->TVInfo & SetPALTV) {
- XGINew_SetReg1(pVBInfo->Part3Port, 0x13, 0xFA);
- XGINew_SetReg1(pVBInfo->Part3Port, 0x14, 0xC8);
+ xgifb_reg_set(pVBInfo->Part3Port, 0x13, 0xFA);
+ xgifb_reg_set(pVBInfo->Part3Port, 0x14, 0xC8);
} else {
- XGINew_SetReg1(pVBInfo->Part3Port, 0x13, 0xF5);
- XGINew_SetReg1(pVBInfo->Part3Port, 0x14, 0xB7);
+ xgifb_reg_set(pVBInfo->Part3Port, 0x13, 0xF5);
+ xgifb_reg_set(pVBInfo->Part3Port, 0x14, 0xB7);
}
if (!(pVBInfo->VBInfo & SetCRT2ToTV))
return;
if (pVBInfo->TVInfo & SetPALMTV) {
- XGINew_SetReg1(pVBInfo->Part3Port, 0x13, 0xFA);
- XGINew_SetReg1(pVBInfo->Part3Port, 0x14, 0xC8);
- XGINew_SetReg1(pVBInfo->Part3Port, 0x3D, 0xA8);
+ xgifb_reg_set(pVBInfo->Part3Port, 0x13, 0xFA);
+ xgifb_reg_set(pVBInfo->Part3Port, 0x14, 0xC8);
+ xgifb_reg_set(pVBInfo->Part3Port, 0x3D, 0xA8);
}
if ((pVBInfo->VBInfo & SetCRT2ToHiVisionTV) || (pVBInfo->VBInfo
@@ -5801,17 +6027,17 @@ void XGI_SetGroup3(unsigned short ModeNo, unsigned short ModeIdIndex,
tempdi = pVBInfo->Ren750pGroup3;
for (i = 0; i <= 0x3E; i++)
- XGINew_SetReg1(pVBInfo->Part3Port, i, tempdi[i]);
+ xgifb_reg_set(pVBInfo->Part3Port, i, tempdi[i]);
if (pVBInfo->VBType & VB_XGI301C) { /* Marcovision */
if (pVBInfo->TVInfo & SetYPbPrMode525p)
- XGINew_SetReg1(pVBInfo->Part3Port, 0x28, 0x3f);
+ xgifb_reg_set(pVBInfo->Part3Port, 0x28, 0x3f);
}
}
return;
} /* {end of XGI_SetGroup3} */
-void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex,
unsigned short RefreshRateTableIndex,
struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
@@ -5826,15 +6052,15 @@ void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex,
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */
temp = pVBInfo->RVBHCFACT;
- XGINew_SetReg1(pVBInfo->Part4Port, 0x13, temp);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x13, temp);
tempbx = pVBInfo->RVBHCMAX;
temp = tempbx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part4Port, 0x14, temp);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x14, temp);
temp2 = ((tempbx & 0xFF00) >> 8) << 7;
tempcx = pVBInfo->VGAHT - 1;
temp = tempcx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part4Port, 0x16, temp);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x16, temp);
temp = ((tempcx & 0xFF00) >> 8) << 3;
temp2 |= temp;
@@ -5844,10 +6070,10 @@ void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex,
tempcx -= 5;
temp = tempcx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part4Port, 0x17, temp);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x17, temp);
temp = temp2 | ((tempcx & 0xFF00) >> 8);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x15, temp);
- XGINew_SetRegOR(pVBInfo->Part4Port, 0x0D, 0x08);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x15, temp);
+ xgifb_reg_or(pVBInfo->Part4Port, 0x0D, 0x08);
tempcx = pVBInfo->VBInfo;
tempbx = pVBInfo->VGAHDE;
@@ -5883,7 +6109,7 @@ void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex,
if (pVBInfo->VGAHDE == 1024)
temp = 0x20;
}
- XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x0E, ~0xEF, temp);
+ xgifb_reg_and_or(pVBInfo->Part4Port, 0x0E, ~0xEF, temp);
tempebx = pVBInfo->VDE;
@@ -5894,7 +6120,7 @@ void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex,
tempcx = pVBInfo->RVBHRS;
temp = tempcx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part4Port, 0x18, temp);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x18, temp);
tempeax = pVBInfo->VGAVDE;
tempcx |= 0x04000;
@@ -5914,21 +6140,21 @@ void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex,
tempebx++;
temp = (unsigned short) (tempebx & 0x000000FF);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x1B, temp);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x1B, temp);
temp = (unsigned short) ((tempebx & 0x0000FF00) >> 8);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x1A, temp);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x1A, temp);
tempbx = (unsigned short) (tempebx >> 16);
temp = tempbx & 0x00FF;
temp = temp << 4;
temp |= ((tempcx & 0xFF00) >> 8);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x19, temp);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x19, temp);
/* 301b */
if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
| VB_XGI302LV | VB_XGI301C)) {
temp = 0x0028;
- XGINew_SetReg1(pVBInfo->Part4Port, 0x1C, temp);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x1C, temp);
tempax = pVBInfo->VGAHDE;
if (modeflag & HalfDCLK)
tempax = tempax >> 1;
@@ -5974,13 +6200,13 @@ void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex,
temp = (tempax & 0xFF00) >> 8;
temp = ((temp & 0x0003) << 4);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x1E, temp);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x1E, temp);
temp = (tempax & 0x00FF);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x1D, temp);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x1D, temp);
if (pVBInfo->VBInfo & (SetCRT2ToTV | SetCRT2ToHiVisionTV)) {
if (pVBInfo->VGAHDE > 800)
- XGINew_SetRegOR(pVBInfo->Part4Port, 0x1E, 0x08);
+ xgifb_reg_or(pVBInfo->Part4Port, 0x1E, 0x08);
}
temp = 0x0036;
@@ -5997,15 +6223,15 @@ void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex,
}
}
- XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x1F, 0x00C0, temp);
+ xgifb_reg_and_or(pVBInfo->Part4Port, 0x1F, 0x00C0, temp);
tempbx = pVBInfo->HT;
if (XGI_IsLCDDualLink(pVBInfo))
tempbx = tempbx >> 1;
tempbx = (tempbx >> 1) - 2;
temp = ((tempbx & 0x0700) >> 8) << 3;
- XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x21, 0x00C0, temp);
+ xgifb_reg_and_or(pVBInfo->Part4Port, 0x21, 0x00C0, temp);
temp = tempbx & 0x00FF;
- XGINew_SetReg1(pVBInfo->Part4Port, 0x22, temp);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x22, temp);
}
/* end 301b */
@@ -6014,7 +6240,12 @@ void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex,
pVBInfo);
}
-void XGI_SetGroup5(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGINew_EnableCRT2(struct vb_device_info *pVBInfo)
+{
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x1E, 0xFF, 0x20);
+}
+
+static void XGI_SetGroup5(unsigned short ModeNo, unsigned short ModeIdIndex,
struct vb_device_info *pVBInfo)
{
unsigned short Pindex, Pdata;
@@ -6031,779 +6262,19 @@ void XGI_SetGroup5(unsigned short ModeNo, unsigned short ModeIdIndex,
return;
}
-void *XGI_GetLcdPtr(unsigned short BX, unsigned short ModeNo,
- unsigned short ModeIdIndex,
- unsigned short RefreshRateTableIndex,
- struct vb_device_info *pVBInfo)
-{
- unsigned short i, tempdx, tempcx, tempbx, tempal, modeflag, table;
-
- struct XGI330_LCDDataTablStruct *tempdi = NULL;
-
- tempbx = BX;
-
- if (ModeNo <= 0x13) {
- modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
- tempal = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC;
- } else {
- modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
- tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
- }
-
- tempal = tempal & 0x0f;
-
- if (tempbx <= 1) { /* ExpLink */
- if (ModeNo <= 0x13) {
- tempal = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC; /* find no Ext_CRT2CRTC2 */
- } else {
- tempal
- = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
- }
-
- if (pVBInfo->VBInfo & SetCRT2ToLCDA) {
- if (ModeNo <= 0x13)
- tempal
- = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC2;
- else
- tempal
- = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC2;
- }
-
- if (tempbx & 0x01)
- tempal = (tempal >> 4);
-
- tempal = (tempal & 0x0f);
- }
-
- tempcx = LCDLenList[tempbx]; /* mov cl,byte ptr cs:LCDLenList[bx] */
-
- if (pVBInfo->LCDInfo & EnableScalingLCD) { /* ScaleLCD */
- if ((tempbx == 5) || (tempbx) == 7)
- tempcx = LCDDesDataLen2;
- else if ((tempbx == 3) || (tempbx == 8))
- tempcx = LVDSDesDataLen2;
- }
- /* mov di, word ptr cs:LCDDataList[bx] */
- /* tempdi = pVideoMemory[LCDDataList + tempbx * 2] | (pVideoMemory[LCDDataList + tempbx * 2 + 1] << 8); */
-
- switch (tempbx) {
- case 0:
- tempdi = XGI_EPLLCDCRT1Ptr_H;
- break;
- case 1:
- tempdi = XGI_EPLLCDCRT1Ptr_V;
- break;
- case 2:
- tempdi = XGI_EPLLCDDataPtr;
- break;
- case 3:
- tempdi = XGI_EPLLCDDesDataPtr;
- break;
- case 4:
- tempdi = XGI_LCDDataTable;
- break;
- case 5:
- tempdi = XGI_LCDDesDataTable;
- break;
- case 6:
- tempdi = XGI_EPLCHLCDRegPtr;
- break;
- case 7:
- case 8:
- case 9:
- tempdi = NULL;
- break;
- default:
- break;
- }
-
- if (tempdi == NULL) /* OEMUtil */
- return NULL;
-
- table = tempbx;
- i = 0;
-
- while (tempdi[i].PANELID != 0xff) {
- tempdx = pVBInfo->LCDResInfo;
- if (tempbx & 0x0080) { /* OEMUtil */
- tempbx &= (~0x0080);
- tempdx = pVBInfo->LCDTypeInfo;
- }
-
- if (pVBInfo->LCDInfo & EnableScalingLCD)
- tempdx &= (~PanelResInfo);
-
- if (tempdi[i].PANELID == tempdx) {
- tempbx = tempdi[i].MASK;
- tempdx = pVBInfo->LCDInfo;
-
- if (ModeNo <= 0x13) /* alan 09/10/2003 */
- tempdx |= SetLCDStdMode;
-
- if (modeflag & HalfDCLK)
- tempdx |= SetLCDLowResolution;
-
- tempbx &= tempdx;
- if (tempbx == tempdi[i].CAP)
- break;
- }
- i++;
- }
-
- if (table == 0) {
- switch (tempdi[i].DATAPTR) {
- case 0:
- return &XGI_LVDSCRT11024x768_1_H[tempal];
- break;
- case 1:
- return &XGI_LVDSCRT11024x768_2_H[tempal];
- break;
- case 2:
- return &XGI_LVDSCRT11280x1024_1_H[tempal];
- break;
- case 3:
- return &XGI_LVDSCRT11280x1024_2_H[tempal];
- break;
- case 4:
- return &XGI_LVDSCRT11400x1050_1_H[tempal];
- break;
- case 5:
- return &XGI_LVDSCRT11400x1050_2_H[tempal];
- break;
- case 6:
- return &XGI_LVDSCRT11600x1200_1_H[tempal];
- break;
- case 7:
- return &XGI_LVDSCRT11024x768_1_Hx75[tempal];
- break;
- case 8:
- return &XGI_LVDSCRT11024x768_2_Hx75[tempal];
- break;
- case 9:
- return &XGI_LVDSCRT11280x1024_1_Hx75[tempal];
- break;
- case 10:
- return &XGI_LVDSCRT11280x1024_2_Hx75[tempal];
- break;
- default:
- break;
- }
- } else if (table == 1) {
- switch (tempdi[i].DATAPTR) {
- case 0:
- return &XGI_LVDSCRT11024x768_1_V[tempal];
- break;
- case 1:
- return &XGI_LVDSCRT11024x768_2_V[tempal];
- break;
- case 2:
- return &XGI_LVDSCRT11280x1024_1_V[tempal];
- break;
- case 3:
- return &XGI_LVDSCRT11280x1024_2_V[tempal];
- break;
- case 4:
- return &XGI_LVDSCRT11400x1050_1_V[tempal];
- break;
- case 5:
- return &XGI_LVDSCRT11400x1050_2_V[tempal];
- break;
- case 6:
- return &XGI_LVDSCRT11600x1200_1_V[tempal];
- break;
- case 7:
- return &XGI_LVDSCRT11024x768_1_Vx75[tempal];
- break;
- case 8:
- return &XGI_LVDSCRT11024x768_2_Vx75[tempal];
- break;
- case 9:
- return &XGI_LVDSCRT11280x1024_1_Vx75[tempal];
- break;
- case 10:
- return &XGI_LVDSCRT11280x1024_2_Vx75[tempal];
- break;
- default:
- break;
- }
- } else if (table == 2) {
- switch (tempdi[i].DATAPTR) {
- case 0:
- return &XGI_LVDS1024x768Data_1[tempal];
- break;
- case 1:
- return &XGI_LVDS1024x768Data_2[tempal];
- break;
- case 2:
- return &XGI_LVDS1280x1024Data_1[tempal];
- break;
- case 3:
- return &XGI_LVDS1280x1024Data_2[tempal];
- break;
- case 4:
- return &XGI_LVDS1400x1050Data_1[tempal];
- break;
- case 5:
- return &XGI_LVDS1400x1050Data_2[tempal];
- break;
- case 6:
- return &XGI_LVDS1600x1200Data_1[tempal];
- break;
- case 7:
- return &XGI_LVDSNoScalingData[tempal];
- break;
- case 8:
- return &XGI_LVDS1024x768Data_1x75[tempal];
- break;
- case 9:
- return &XGI_LVDS1024x768Data_2x75[tempal];
- break;
- case 10:
- return &XGI_LVDS1280x1024Data_1x75[tempal];
- break;
- case 11:
- return &XGI_LVDS1280x1024Data_2x75[tempal];
- break;
- case 12:
- return &XGI_LVDSNoScalingDatax75[tempal];
- break;
- default:
- break;
- }
- } else if (table == 3) {
- switch (tempdi[i].DATAPTR) {
- case 0:
- return &XGI_LVDS1024x768Des_1[tempal];
- break;
- case 1:
- return &XGI_LVDS1024x768Des_3[tempal];
- break;
- case 2:
- return &XGI_LVDS1024x768Des_2[tempal];
- break;
- case 3:
- return &XGI_LVDS1280x1024Des_1[tempal];
- break;
- case 4:
- return &XGI_LVDS1280x1024Des_2[tempal];
- break;
- case 5:
- return &XGI_LVDS1400x1050Des_1[tempal];
- break;
- case 6:
- return &XGI_LVDS1400x1050Des_2[tempal];
- break;
- case 7:
- return &XGI_LVDS1600x1200Des_1[tempal];
- break;
- case 8:
- return &XGI_LVDSNoScalingDesData[tempal];
- break;
- case 9:
- return &XGI_LVDS1024x768Des_1x75[tempal];
- break;
- case 10:
- return &XGI_LVDS1024x768Des_3x75[tempal];
- break;
- case 11:
- return &XGI_LVDS1024x768Des_2x75[tempal];
- break;
- case 12:
- return &XGI_LVDS1280x1024Des_1x75[tempal];
- break;
- case 13:
- return &XGI_LVDS1280x1024Des_2x75[tempal];
- break;
- case 14:
- return &XGI_LVDSNoScalingDesDatax75[tempal];
- break;
- default:
- break;
- }
- } else if (table == 4) {
- switch (tempdi[i].DATAPTR) {
- case 0:
- return &XGI_ExtLCD1024x768Data[tempal];
- break;
- case 1:
- return &XGI_StLCD1024x768Data[tempal];
- break;
- case 2:
- return &XGI_CetLCD1024x768Data[tempal];
- break;
- case 3:
- return &XGI_ExtLCD1280x1024Data[tempal];
- break;
- case 4:
- return &XGI_StLCD1280x1024Data[tempal];
- break;
- case 5:
- return &XGI_CetLCD1280x1024Data[tempal];
- break;
- case 6:
- return &XGI_ExtLCD1400x1050Data[tempal];
- break;
- case 7:
- return &XGI_StLCD1400x1050Data[tempal];
- break;
- case 8:
- return &XGI_CetLCD1400x1050Data[tempal];
- break;
- case 9:
- return &XGI_ExtLCD1600x1200Data[tempal];
- break;
- case 10:
- return &XGI_StLCD1600x1200Data[tempal];
- break;
- case 11:
- return &XGI_NoScalingData[tempal];
- break;
- case 12:
- return &XGI_ExtLCD1024x768x75Data[tempal];
- break;
- case 13:
- return &XGI_ExtLCD1024x768x75Data[tempal];
- break;
- case 14:
- return &XGI_CetLCD1024x768x75Data[tempal];
- break;
- case 15:
- return &XGI_ExtLCD1280x1024x75Data[tempal];
- break;
- case 16:
- return &XGI_StLCD1280x1024x75Data[tempal];
- break;
- case 17:
- return &XGI_CetLCD1280x1024x75Data[tempal];
- break;
- case 18:
- return &XGI_NoScalingDatax75[tempal];
- break;
- default:
- break;
- }
- } else if (table == 5) {
- switch (tempdi[i].DATAPTR) {
- case 0:
- return &XGI_ExtLCDDes1024x768Data[tempal];
- break;
- case 1:
- return &XGI_StLCDDes1024x768Data[tempal];
- break;
- case 2:
- return &XGI_CetLCDDes1024x768Data[tempal];
- break;
- case 3:
- if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
- & VB_XGI302LV))
- return &XGI_ExtLCDDLDes1280x1024Data[tempal];
- else
- return &XGI_ExtLCDDes1280x1024Data[tempal];
- break;
- case 4:
- if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
- & VB_XGI302LV))
- return &XGI_StLCDDLDes1280x1024Data[tempal];
- else
- return &XGI_StLCDDes1280x1024Data[tempal];
- break;
- case 5:
- if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
- & VB_XGI302LV))
- return &XGI_CetLCDDLDes1280x1024Data[tempal];
- else
- return &XGI_CetLCDDes1280x1024Data[tempal];
- break;
- case 6:
- if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
- & VB_XGI302LV))
- return &XGI_ExtLCDDLDes1400x1050Data[tempal];
- else
- return &XGI_ExtLCDDes1400x1050Data[tempal];
- break;
- case 7:
- if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
- & VB_XGI302LV))
- return &XGI_StLCDDLDes1400x1050Data[tempal];
- else
- return &XGI_StLCDDes1400x1050Data[tempal];
- break;
- case 8:
- return &XGI_CetLCDDes1400x1050Data[tempal];
- break;
- case 9:
- return &XGI_CetLCDDes1400x1050Data2[tempal];
- break;
- case 10:
- if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
- & VB_XGI302LV))
- return &XGI_ExtLCDDLDes1600x1200Data[tempal];
- else
- return &XGI_ExtLCDDes1600x1200Data[tempal];
- break;
- case 11:
- if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
- & VB_XGI302LV))
- return &XGI_StLCDDLDes1600x1200Data[tempal];
- else
- return &XGI_StLCDDes1600x1200Data[tempal];
- break;
- case 12:
- return &XGI_NoScalingDesData[tempal];
- break;
- case 13:
- return &XGI_ExtLCDDes1024x768x75Data[tempal];
- break;
- case 14:
- return &XGI_StLCDDes1024x768x75Data[tempal];
- break;
- case 15:
- return &XGI_CetLCDDes1024x768x75Data[tempal];
- break;
- case 16:
- if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
- & VB_XGI302LV))
- return &XGI_ExtLCDDLDes1280x1024x75Data[tempal];
- else
- return &XGI_ExtLCDDes1280x1024x75Data[tempal];
- break;
- case 17:
- if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
- & VB_XGI302LV))
- return &XGI_StLCDDLDes1280x1024x75Data[tempal];
- else
- return &XGI_StLCDDes1280x1024x75Data[tempal];
- break;
- case 18:
- if ((pVBInfo->VBType & VB_XGI301LV) || (pVBInfo->VBType
- & VB_XGI302LV))
- return &XGI_CetLCDDLDes1280x1024x75Data[tempal];
- else
- return &XGI_CetLCDDes1280x1024x75Data[tempal];
- break;
- case 19:
- return &XGI_NoScalingDesDatax75[tempal];
- break;
- default:
- break;
- }
- } else if (table == 6) {
- switch (tempdi[i].DATAPTR) {
- case 0:
- return &XGI_CH7017LV1024x768[tempal];
- break;
- case 1:
- return &XGI_CH7017LV1400x1050[tempal];
- break;
- default:
- break;
- }
- }
- return NULL;
-}
-
-void *XGI_GetTVPtr(unsigned short BX, unsigned short ModeNo,
- unsigned short ModeIdIndex,
- unsigned short RefreshRateTableIndex,
+static void XGI_EnableGatingCRT(struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
{
- unsigned short i, tempdx, tempbx, tempal, modeflag, table;
- struct XGI330_TVDataTablStruct *tempdi = NULL;
-
- tempbx = BX;
-
- if (ModeNo <= 0x13) {
- modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
- tempal = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC;
- } else {
- modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
- tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
- }
-
- tempal = tempal & 0x3f;
- table = tempbx;
-
- switch (tempbx) {
- case 0:
- tempdi = NULL; /*EPLCHTVCRT1Ptr_H;*/
- if (pVBInfo->IF_DEF_CH7007 == 1)
- tempdi = XGI_EPLCHTVCRT1Ptr;
-
- break;
- case 1:
- tempdi = NULL; /*EPLCHTVCRT1Ptr_V;*/
- if (pVBInfo->IF_DEF_CH7007 == 1)
- tempdi = XGI_EPLCHTVCRT1Ptr;
-
- break;
- case 2:
- tempdi = XGI_EPLCHTVDataPtr;
- break;
- case 3:
- tempdi = NULL;
- break;
- case 4:
- tempdi = XGI_TVDataTable;
- break;
- case 5:
- tempdi = NULL;
- break;
- case 6:
- tempdi = XGI_EPLCHTVRegPtr;
- break;
- default:
- break;
- }
-
- if (tempdi == NULL) /* OEMUtil */
- return NULL;
-
- tempdx = pVBInfo->TVInfo;
-
- if (pVBInfo->VBInfo & SetInSlaveMode)
- tempdx = tempdx | SetTVLockMode;
-
- if (modeflag & HalfDCLK)
- tempdx = tempdx | SetTVLowResolution;
-
- i = 0;
-
- while (tempdi[i].MASK != 0xffff) {
- if ((tempdx & tempdi[i].MASK) == tempdi[i].CAP)
- break;
- i++;
- }
-
- if (table == 0x00) { /* 07/05/22 */
- } else if (table == 0x01) {
- } else if (table == 0x04) {
- switch (tempdi[i].DATAPTR) {
- case 0:
- return &XGI_ExtPALData[tempal];
- break;
- case 1:
- return &XGI_ExtNTSCData[tempal];
- break;
- case 2:
- return &XGI_StPALData[tempal];
- break;
- case 3:
- return &XGI_StNTSCData[tempal];
- break;
- case 4:
- return &XGI_ExtHiTVData[tempal];
- break;
- case 5:
- return &XGI_St2HiTVData[tempal];
- break;
- case 6:
- return &XGI_ExtYPbPr525iData[tempal];
- break;
- case 7:
- return &XGI_ExtYPbPr525pData[tempal];
- break;
- case 8:
- return &XGI_ExtYPbPr750pData[tempal];
- break;
- case 9:
- return &XGI_StYPbPr525iData[tempal];
- break;
- case 10:
- return &XGI_StYPbPr525pData[tempal];
- break;
- case 11:
- return &XGI_StYPbPr750pData[tempal];
- break;
- case 12: /* avoid system hang */
- return &XGI_ExtNTSCData[tempal];
- break;
- case 13:
- return &XGI_St1HiTVData[tempal];
- break;
- default:
- break;
- }
- } else if (table == 0x02) {
- switch (tempdi[i].DATAPTR) {
- case 0:
- return &XGI_CHTVUNTSCData[tempal];
- break;
- case 1:
- return &XGI_CHTVONTSCData[tempal];
- break;
- case 2:
- return &XGI_CHTVUPALData[tempal];
- break;
- case 3:
- return &XGI_CHTVOPALData[tempal];
- break;
- default:
- break;
- }
- } else if (table == 0x06) {
- }
- return NULL;
-}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_BacklightByDrv */
-/* Input : */
-/* Output : 1 -> Skip backlight control */
-/* Description : */
-/* --------------------------------------------------------------------- */
-unsigned char XGI_BacklightByDrv(struct vb_device_info *pVBInfo)
-{
- unsigned char tempah;
-
- tempah = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x3A);
- if (tempah & BacklightControlBit)
- return 1;
- else
- return 0;
-}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_FirePWDDisable */
-/* Input : */
-/* Output : */
-/* Description : Turn off VDD & Backlight : Fire disable procedure */
-/* --------------------------------------------------------------------- */
-/*
-void XGI_FirePWDDisable(struct vb_device_info *pVBInfo)
-{
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x26, 0x00, 0xFC);
-}
-*/
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_FirePWDEnable */
-/* Input : */
-/* Output : */
-/* Description : Turn on VDD & Backlight : Fire enable procedure */
-/* --------------------------------------------------------------------- */
-void XGI_FirePWDEnable(struct vb_device_info *pVBInfo)
-{
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x26, 0x03, 0xFC);
-}
-
-void XGI_EnableGatingCRT(struct xgi_hw_device_info *HwDeviceExtension,
- struct vb_device_info *pVBInfo)
-{
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x63, 0xBF, 0x40);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x63, 0xBF, 0x40);
}
-void XGI_DisableGatingCRT(struct xgi_hw_device_info *HwDeviceExtension,
+static void XGI_DisableGatingCRT(struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
{
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x63, 0xBF, 0x00);
-}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetPanelDelay */
-/* Input : */
-/* Output : */
-/* Description : */
-/* I/P : bl : 1 ; T1 : the duration between CPL on and signal on */
-/* : bl : 2 ; T2 : the duration signal on and Vdd on */
-/* : bl : 3 ; T3 : the duration between CPL off and signal off */
-/* : bl : 4 ; T4 : the duration signal off and Vdd off */
-/* --------------------------------------------------------------------- */
-void XGI_SetPanelDelay(unsigned short tempbl, struct vb_device_info *pVBInfo)
-{
- unsigned short index;
-
- index = XGI_GetLCDCapPtr(pVBInfo);
-
- if (tempbl == 1)
- XGINew_LCD_Wait_Time(pVBInfo->LCDCapList[index].PSC_S1, pVBInfo);
-
- if (tempbl == 2)
- XGINew_LCD_Wait_Time(pVBInfo->LCDCapList[index].PSC_S2, pVBInfo);
-
- if (tempbl == 3)
- XGINew_LCD_Wait_Time(pVBInfo->LCDCapList[index].PSC_S3, pVBInfo);
-
- if (tempbl == 4)
- XGINew_LCD_Wait_Time(pVBInfo->LCDCapList[index].PSC_S4, pVBInfo);
-}
-
-/* --------------------------------------------------------------------- */
-/* Function : XGI_SetPanelPower */
-/* Input : */
-/* Output : */
-/* Description : */
-/* I/O : ah = 0011b = 03h ; Backlight on, Power on */
-/* = 0111b = 07h ; Backlight on, Power off */
-/* = 1011b = 0Bh ; Backlight off, Power on */
-/* = 1111b = 0Fh ; Backlight off, Power off */
-/* --------------------------------------------------------------------- */
-void XGI_SetPanelPower(unsigned short tempah, unsigned short tempbl,
- struct vb_device_info *pVBInfo)
-{
- if (pVBInfo->VBType & (VB_XGI301LV | VB_XGI302LV | VB_XGI301C))
- XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x26, tempbl, tempah);
- else
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x11, tempbl, tempah);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x63, 0xBF, 0x00);
}
-static unsigned char XG21GPIODataTransfer(unsigned char ujDate)
-{
- unsigned char ujRet = 0;
- unsigned char i = 0;
-
- for (i = 0; i < 8; i++) {
- ujRet = ujRet << 1;
- /* ujRet |= GETBITS(ujDate >> i, 0:0); */
- ujRet |= (ujDate >> i) & 1;
- }
-
- return ujRet;
-}
-
-/*----------------------------------------------------------------------------*/
-/* output */
-/* bl[5] : LVDS signal */
-/* bl[1] : LVDS backlight */
-/* bl[0] : LVDS VDD */
-/*----------------------------------------------------------------------------*/
-unsigned char XGI_XG21GetPSCValue(struct vb_device_info *pVBInfo)
-{
- unsigned char CR4A, temp;
-
- CR4A = XGINew_GetReg1(pVBInfo->P3d4, 0x4A);
- XGINew_SetRegAND(pVBInfo->P3d4, 0x4A, ~0x23); /* enable GPIO write */
-
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x48);
-
- temp = XG21GPIODataTransfer(temp);
- temp &= 0x23;
- XGINew_SetReg1(pVBInfo->P3d4, 0x4A, CR4A);
- return temp;
-}
-
-/*----------------------------------------------------------------------------*/
-/* output */
-/* bl[5] : LVDS signal */
-/* bl[1] : LVDS backlight */
-/* bl[0] : LVDS VDD */
-/*----------------------------------------------------------------------------*/
-unsigned char XGI_XG27GetPSCValue(struct vb_device_info *pVBInfo)
-{
- unsigned char CR4A, CRB4, temp;
-
- CR4A = XGINew_GetReg1(pVBInfo->P3d4, 0x4A);
- XGINew_SetRegAND(pVBInfo->P3d4, 0x4A, ~0x0C); /* enable GPIO write */
-
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x48);
-
- temp &= 0x0C;
- temp >>= 2;
- XGINew_SetReg1(pVBInfo->P3d4, 0x4A, CR4A);
- CRB4 = XGINew_GetReg1(pVBInfo->P3d4, 0xB4);
- temp |= ((CRB4 & 0x04) << 3);
- return temp;
-}
/*----------------------------------------------------------------------------*/
/* input */
/* bl[5] : 1;LVDS signal on */
@@ -6818,24 +6289,24 @@ void XGI_XG21BLSignalVDD(unsigned short tempbh, unsigned short tempbl,
{
unsigned char CR4A, temp;
- CR4A = XGINew_GetReg1(pVBInfo->P3d4, 0x4A);
+ CR4A = xgifb_reg_get(pVBInfo->P3d4, 0x4A);
tempbh &= 0x23;
tempbl &= 0x23;
- XGINew_SetRegAND(pVBInfo->P3d4, 0x4A, ~tempbh); /* enable GPIO write */
+ xgifb_reg_and(pVBInfo->P3d4, 0x4A, ~tempbh); /* enable GPIO write */
if (tempbh & 0x20) {
temp = (tempbl >> 4) & 0x02;
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0xB4, ~0x02, temp); /* CR B4[1] */
+ xgifb_reg_and_or(pVBInfo->P3d4, 0xB4, ~0x02, temp); /* CR B4[1] */
}
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x48);
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x48);
temp = XG21GPIODataTransfer(temp);
temp &= ~tempbh;
temp |= tempbl;
- XGINew_SetReg1(pVBInfo->P3d4, 0x48, temp);
+ xgifb_reg_set(pVBInfo->P3d4, 0x48, temp);
}
void XGI_XG27BLSignalVDD(unsigned short tempbh, unsigned short tempbl,
@@ -6854,18 +6325,18 @@ void XGI_XG27BLSignalVDD(unsigned short tempbh, unsigned short tempbl,
if (tempbh & 0x20) {
temp = (tempbl >> 4) & 0x02;
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0xB4, ~0x02, temp); /* CR B4[1] */
+ xgifb_reg_and_or(pVBInfo->P3d4, 0xB4, ~0x02, temp); /* CR B4[1] */
}
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0xB4, ~tempbh0, tempbl0);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0xB4, ~tempbh0, tempbl0);
- CR4A = XGINew_GetReg1(pVBInfo->P3d4, 0x4A);
+ CR4A = xgifb_reg_get(pVBInfo->P3d4, 0x4A);
tempbh &= 0x03;
tempbl &= 0x03;
tempbh <<= 2;
tempbl <<= 2; /* GPIOC,GPIOD */
- XGINew_SetRegAND(pVBInfo->P3d4, 0x4A, ~tempbh); /* enable GPIO write */
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x48, ~tempbh, tempbl);
+ xgifb_reg_and(pVBInfo->P3d4, 0x4A, ~tempbh); /* enable GPIO write */
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x48, ~tempbh, tempbl);
}
/* --------------------------------------------------------------------- */
@@ -6873,7 +6344,7 @@ unsigned short XGI_GetLVDSOEMTableIndex(struct vb_device_info *pVBInfo)
{
unsigned short index;
- index = XGINew_GetReg1(pVBInfo->P3d4, 0x36);
+ index = xgifb_reg_get(pVBInfo->P3d4, 0x36);
if (index < sizeof(XGI21_LCDCapList)
/ sizeof(struct XGI21_LVDSCapStruct))
return index;
@@ -6897,20 +6368,16 @@ void XGI_XG21SetPanelDelay(unsigned short tempbl,
index = XGI_GetLVDSOEMTableIndex(pVBInfo);
if (tempbl == 1)
- XGINew_LCD_Wait_Time(pVBInfo->XG21_LVDSCapList[index].PSC_S1,
- pVBInfo);
+ mdelay(pVBInfo->XG21_LVDSCapList[index].PSC_S1);
if (tempbl == 2)
- XGINew_LCD_Wait_Time(pVBInfo->XG21_LVDSCapList[index].PSC_S2,
- pVBInfo);
+ mdelay(pVBInfo->XG21_LVDSCapList[index].PSC_S2);
if (tempbl == 3)
- XGINew_LCD_Wait_Time(pVBInfo->XG21_LVDSCapList[index].PSC_S3,
- pVBInfo);
+ mdelay(pVBInfo->XG21_LVDSCapList[index].PSC_S3);
if (tempbl == 4)
- XGINew_LCD_Wait_Time(pVBInfo->XG21_LVDSCapList[index].PSC_S4,
- pVBInfo);
+ mdelay(pVBInfo->XG21_LVDSCapList[index].PSC_S4);
}
unsigned char XGI_XG21CheckLVDSMode(unsigned short ModeNo,
@@ -6970,10 +6437,10 @@ void XGI_SetXG21FPBits(struct vb_device_info *pVBInfo)
{
unsigned char temp;
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x37); /* D[0] 1: 18bit */
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x37); /* D[0] 1: 18bit */
temp = (temp & 1) << 6;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x06, ~0x40, temp); /* SR06[6] 18bit Dither */
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x09, ~0xc0, temp | 0x80); /* SR09[7] enable FP output, SR09[6] 1: sigle 18bits, 0: dual 12bits */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x06, ~0x40, temp); /* SR06[6] 18bit Dither */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x09, ~0xc0, temp | 0x80); /* SR09[7] enable FP output, SR09[6] 1: sigle 18bits, 0: dual 12bits */
}
@@ -6981,14 +6448,14 @@ void XGI_SetXG27FPBits(struct vb_device_info *pVBInfo)
{
unsigned char temp;
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x37); /* D[1:0] 01: 18bit, 00: dual 12, 10: single 24 */
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x37); /* D[1:0] 01: 18bit, 00: dual 12, 10: single 24 */
temp = (temp & 3) << 6;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x06, ~0xc0, temp & 0x80); /* SR06[7]0: dual 12/1: single 24 [6] 18bit Dither <= 0 h/w recommend */
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x09, ~0xc0, temp | 0x80); /* SR09[7] enable FP output, SR09[6] 1: sigle 18bits, 0: 24bits */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x06, ~0xc0, temp & 0x80); /* SR06[7]0: dual 12/1: single 24 [6] 18bit Dither <= 0 h/w recommend */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x09, ~0xc0, temp | 0x80); /* SR09[7] enable FP output, SR09[6] 1: sigle 18bits, 0: 24bits */
}
-void XGI_SetXG21LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_SetXG21LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex,
struct vb_device_info *pVBInfo)
{
unsigned char temp, Miscdata;
@@ -7002,14 +6469,14 @@ void XGI_SetXG21LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex,
temp = (unsigned char) ((pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDS_Capability
& (LCDPolarity << 8)) >> 8);
temp &= LCDPolarity;
- Miscdata = (unsigned char) XGINew_GetReg2(pVBInfo->P3cc);
+ Miscdata = (unsigned char) inb(pVBInfo->P3cc);
- XGINew_SetReg3(pVBInfo->P3c2, (Miscdata & 0x3F) | temp);
+ outb((Miscdata & 0x3F) | temp, pVBInfo->P3c2);
temp = (unsigned char) (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDS_Capability
& LCDPolarity);
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x35, ~0x80, temp & 0x80); /* SR35[7] FP VSync polarity */
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x30, ~0x20, (temp & 0x40) >> 1); /* SR30[5] FP HSync polarity */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x35, ~0x80, temp & 0x80); /* SR35[7] FP VSync polarity */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x30, ~0x20, (temp & 0x40) >> 1); /* SR30[5] FP HSync polarity */
XGI_SetXG21FPBits(pVBInfo);
resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo);
@@ -7068,113 +6535,113 @@ void XGI_SetXG21LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex,
LVDSVBE = LVDSVBS + LVDSVT
- pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE;
- temp = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x11);
- XGINew_SetReg1(pVBInfo->P3d4, 0x11, temp & 0x7f); /* Unlock CRTC */
+ temp = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x11);
+ xgifb_reg_set(pVBInfo->P3d4, 0x11, temp & 0x7f); /* Unlock CRTC */
if (!(modeflag & Charx8Dot))
- XGINew_SetRegOR(pVBInfo->P3c4, 0x1, 0x1);
+ xgifb_reg_or(pVBInfo->P3c4, 0x1, 0x1);
/* HT SR0B[1:0] CR00 */
value = (LVDSHT >> 3) - 5;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0B, ~0x03, (value & 0x300) >> 8);
- XGINew_SetReg1(pVBInfo->P3d4, 0x0, (value & 0xFF));
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0B, ~0x03, (value & 0x300) >> 8);
+ xgifb_reg_set(pVBInfo->P3d4, 0x0, (value & 0xFF));
/* HBS SR0B[5:4] CR02 */
value = (LVDSHBS >> 3) - 1;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0B, ~0x30, (value & 0x300) >> 4);
- XGINew_SetReg1(pVBInfo->P3d4, 0x2, (value & 0xFF));
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0B, ~0x30, (value & 0x300) >> 4);
+ xgifb_reg_set(pVBInfo->P3d4, 0x2, (value & 0xFF));
/* HBE SR0C[1:0] CR05[7] CR03[4:0] */
value = (LVDSHBE >> 3) - 1;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0C, ~0x03, (value & 0xC0) >> 6);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x05, ~0x80, (value & 0x20) << 2);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x03, ~0x1F, value & 0x1F);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0C, ~0x03, (value & 0xC0) >> 6);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x05, ~0x80, (value & 0x20) << 2);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x03, ~0x1F, value & 0x1F);
/* HRS SR0B[7:6] CR04 */
value = (LVDSHRS >> 3) + 2;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0B, ~0xC0, (value & 0x300) >> 2);
- XGINew_SetReg1(pVBInfo->P3d4, 0x4, (value & 0xFF));
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0B, ~0xC0, (value & 0x300) >> 2);
+ xgifb_reg_set(pVBInfo->P3d4, 0x4, (value & 0xFF));
/* Panel HRS SR2F[1:0] SR2E[7:0] */
value--;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x2F, ~0x03, (value & 0x300) >> 8);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2E, (value & 0xFF));
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x2F, ~0x03, (value & 0x300) >> 8);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2E, (value & 0xFF));
/* HRE SR0C[2] CR05[4:0] */
value = (LVDSHRE >> 3) + 2;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0C, ~0x04, (value & 0x20) >> 3);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x05, ~0x1F, value & 0x1F);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0C, ~0x04, (value & 0x20) >> 3);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x05, ~0x1F, value & 0x1F);
/* Panel HRE SR2F[7:2] */
value--;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x2F, ~0xFC, value << 2);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x2F, ~0xFC, value << 2);
/* VT SR0A[0] CR07[5][0] CR06 */
value = LVDSVT - 2;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0A, ~0x01, (value & 0x400) >> 10);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x07, ~0x20, (value & 0x200) >> 4);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x07, ~0x01, (value & 0x100) >> 8);
- XGINew_SetReg1(pVBInfo->P3d4, 0x06, (value & 0xFF));
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0A, ~0x01, (value & 0x400) >> 10);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x07, ~0x20, (value & 0x200) >> 4);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x07, ~0x01, (value & 0x100) >> 8);
+ xgifb_reg_set(pVBInfo->P3d4, 0x06, (value & 0xFF));
/* VBS SR0A[2] CR09[5] CR07[3] CR15 */
value = LVDSVBS - 1;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0A, ~0x04, (value & 0x400) >> 8);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x09, ~0x20, (value & 0x200) >> 4);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x07, ~0x08, (value & 0x100) >> 5);
- XGINew_SetReg1(pVBInfo->P3d4, 0x15, (value & 0xFF));
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0A, ~0x04, (value & 0x400) >> 8);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x09, ~0x20, (value & 0x200) >> 4);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x07, ~0x08, (value & 0x100) >> 5);
+ xgifb_reg_set(pVBInfo->P3d4, 0x15, (value & 0xFF));
/* VBE SR0A[4] CR16 */
value = LVDSVBE - 1;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0A, ~0x10, (value & 0x100) >> 4);
- XGINew_SetReg1(pVBInfo->P3d4, 0x16, (value & 0xFF));
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0A, ~0x10, (value & 0x100) >> 4);
+ xgifb_reg_set(pVBInfo->P3d4, 0x16, (value & 0xFF));
/* VRS SR0A[3] CR7[7][2] CR10 */
value = LVDSVRS - 1;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0A, ~0x08, (value & 0x400) >> 7);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x07, ~0x80, (value & 0x200) >> 2);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x07, ~0x04, (value & 0x100) >> 6);
- XGINew_SetReg1(pVBInfo->P3d4, 0x10, (value & 0xFF));
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0A, ~0x08, (value & 0x400) >> 7);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x07, ~0x80, (value & 0x200) >> 2);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x07, ~0x04, (value & 0x100) >> 6);
+ xgifb_reg_set(pVBInfo->P3d4, 0x10, (value & 0xFF));
/* Panel VRS SR3F[1:0] SR34[7:0] SR33[0] */
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x3F, ~0x03, (value & 0x600) >> 9);
- XGINew_SetReg1(pVBInfo->P3c4, 0x34, (value >> 1) & 0xFF);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x33, ~0x01, value & 0x01);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x3F, ~0x03, (value & 0x600) >> 9);
+ xgifb_reg_set(pVBInfo->P3c4, 0x34, (value >> 1) & 0xFF);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x33, ~0x01, value & 0x01);
/* VRE SR0A[5] CR11[3:0] */
value = LVDSVRE - 1;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0A, ~0x20, (value & 0x10) << 1);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x11, ~0x0F, value & 0x0F);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0A, ~0x20, (value & 0x10) << 1);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x11, ~0x0F, value & 0x0F);
/* Panel VRE SR3F[7:2] *//* SR3F[7] has to be 0, h/w bug */
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x3F, ~0xFC, (value << 2) & 0x7C);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x3F, ~0xFC, (value << 2) & 0x7C);
for (temp = 0, value = 0; temp < 3; temp++) {
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x31, ~0x30, value);
- XGINew_SetReg1(pVBInfo->P3c4,
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x31, ~0x30, value);
+ xgifb_reg_set(pVBInfo->P3c4,
0x2B,
pVBInfo->XG21_LVDSCapList[lvdstableindex].VCLKData1);
- XGINew_SetReg1(pVBInfo->P3c4,
+ xgifb_reg_set(pVBInfo->P3c4,
0x2C,
pVBInfo->XG21_LVDSCapList[lvdstableindex].VCLKData2);
value += 0x10;
}
if (!(modeflag & Charx8Dot)) {
- XGINew_GetReg2(pVBInfo->P3da); /* reset 3da */
- XGINew_SetReg3(pVBInfo->P3c0, 0x13); /* set index */
- XGINew_SetReg3(pVBInfo->P3c0, 0x00); /* set data, panning = 0, shift left 1 dot*/
+ inb(pVBInfo->P3da); /* reset 3da */
+ outb(0x13, pVBInfo->P3c0); /* set index */
+ outb(0x00, pVBInfo->P3c0); /* set data, panning = 0, shift left 1 dot*/
- XGINew_GetReg2(pVBInfo->P3da); /* Enable Attribute */
- XGINew_SetReg3(pVBInfo->P3c0, 0x20);
+ inb(pVBInfo->P3da); /* Enable Attribute */
+ outb(0x20, pVBInfo->P3c0);
- XGINew_GetReg2(pVBInfo->P3da); /* reset 3da */
+ inb(pVBInfo->P3da); /* reset 3da */
}
}
/* no shadow case */
-void XGI_SetXG27LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_SetXG27LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex,
struct vb_device_info *pVBInfo)
{
unsigned char temp, Miscdata;
@@ -7187,14 +6654,14 @@ void XGI_SetXG27LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex,
temp = (unsigned char) ((pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDS_Capability
& (LCDPolarity << 8)) >> 8);
temp &= LCDPolarity;
- Miscdata = (unsigned char) XGINew_GetReg2(pVBInfo->P3cc);
+ Miscdata = (unsigned char) inb(pVBInfo->P3cc);
- XGINew_SetReg3(pVBInfo->P3c2, (Miscdata & 0x3F) | temp);
+ outb((Miscdata & 0x3F) | temp, pVBInfo->P3c2);
temp = (unsigned char) (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDS_Capability
& LCDPolarity);
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x35, ~0x80, temp & 0x80); /* SR35[7] FP VSync polarity */
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x30, ~0x20, (temp & 0x40) >> 1); /* SR30[5] FP HSync polarity */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x35, ~0x80, temp & 0x80); /* SR35[7] FP VSync polarity */
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x30, ~0x20, (temp & 0x40) >> 1); /* SR30[5] FP HSync polarity */
XGI_SetXG27FPBits(pVBInfo);
resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo);
@@ -7253,106 +6720,106 @@ void XGI_SetXG27LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex,
LVDSVBE = LVDSVBS + LVDSVT
- pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE;
- temp = (unsigned char) XGINew_GetReg1(pVBInfo->P3d4, 0x11);
- XGINew_SetReg1(pVBInfo->P3d4, 0x11, temp & 0x7f); /* Unlock CRTC */
+ temp = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x11);
+ xgifb_reg_set(pVBInfo->P3d4, 0x11, temp & 0x7f); /* Unlock CRTC */
if (!(modeflag & Charx8Dot))
- XGINew_SetRegOR(pVBInfo->P3c4, 0x1, 0x1);
+ xgifb_reg_or(pVBInfo->P3c4, 0x1, 0x1);
/* HT SR0B[1:0] CR00 */
value = (LVDSHT >> 3) - 5;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0B, ~0x03, (value & 0x300) >> 8);
- XGINew_SetReg1(pVBInfo->P3d4, 0x0, (value & 0xFF));
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0B, ~0x03, (value & 0x300) >> 8);
+ xgifb_reg_set(pVBInfo->P3d4, 0x0, (value & 0xFF));
/* HBS SR0B[5:4] CR02 */
value = (LVDSHBS >> 3) - 1;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0B, ~0x30, (value & 0x300) >> 4);
- XGINew_SetReg1(pVBInfo->P3d4, 0x2, (value & 0xFF));
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0B, ~0x30, (value & 0x300) >> 4);
+ xgifb_reg_set(pVBInfo->P3d4, 0x2, (value & 0xFF));
/* HBE SR0C[1:0] CR05[7] CR03[4:0] */
value = (LVDSHBE >> 3) - 1;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0C, ~0x03, (value & 0xC0) >> 6);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x05, ~0x80, (value & 0x20) << 2);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x03, ~0x1F, value & 0x1F);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0C, ~0x03, (value & 0xC0) >> 6);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x05, ~0x80, (value & 0x20) << 2);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x03, ~0x1F, value & 0x1F);
/* HRS SR0B[7:6] CR04 */
value = (LVDSHRS >> 3) + 2;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0B, ~0xC0, (value & 0x300) >> 2);
- XGINew_SetReg1(pVBInfo->P3d4, 0x4, (value & 0xFF));
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0B, ~0xC0, (value & 0x300) >> 2);
+ xgifb_reg_set(pVBInfo->P3d4, 0x4, (value & 0xFF));
/* Panel HRS SR2F[1:0] SR2E[7:0] */
value--;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x2F, ~0x03, (value & 0x300) >> 8);
- XGINew_SetReg1(pVBInfo->P3c4, 0x2E, (value & 0xFF));
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x2F, ~0x03, (value & 0x300) >> 8);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2E, (value & 0xFF));
/* HRE SR0C[2] CR05[4:0] */
value = (LVDSHRE >> 3) + 2;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0C, ~0x04, (value & 0x20) >> 3);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x05, ~0x1F, value & 0x1F);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0C, ~0x04, (value & 0x20) >> 3);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x05, ~0x1F, value & 0x1F);
/* Panel HRE SR2F[7:2] */
value--;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x2F, ~0xFC, value << 2);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x2F, ~0xFC, value << 2);
/* VT SR0A[0] CR07[5][0] CR06 */
value = LVDSVT - 2;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0A, ~0x01, (value & 0x400) >> 10);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x07, ~0x20, (value & 0x200) >> 4);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x07, ~0x01, (value & 0x100) >> 8);
- XGINew_SetReg1(pVBInfo->P3d4, 0x06, (value & 0xFF));
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0A, ~0x01, (value & 0x400) >> 10);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x07, ~0x20, (value & 0x200) >> 4);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x07, ~0x01, (value & 0x100) >> 8);
+ xgifb_reg_set(pVBInfo->P3d4, 0x06, (value & 0xFF));
/* VBS SR0A[2] CR09[5] CR07[3] CR15 */
value = LVDSVBS - 1;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0A, ~0x04, (value & 0x400) >> 8);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x09, ~0x20, (value & 0x200) >> 4);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x07, ~0x08, (value & 0x100) >> 5);
- XGINew_SetReg1(pVBInfo->P3d4, 0x15, (value & 0xFF));
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0A, ~0x04, (value & 0x400) >> 8);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x09, ~0x20, (value & 0x200) >> 4);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x07, ~0x08, (value & 0x100) >> 5);
+ xgifb_reg_set(pVBInfo->P3d4, 0x15, (value & 0xFF));
/* VBE SR0A[4] CR16 */
value = LVDSVBE - 1;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0A, ~0x10, (value & 0x100) >> 4);
- XGINew_SetReg1(pVBInfo->P3d4, 0x16, (value & 0xFF));
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0A, ~0x10, (value & 0x100) >> 4);
+ xgifb_reg_set(pVBInfo->P3d4, 0x16, (value & 0xFF));
/* VRS SR0A[3] CR7[7][2] CR10 */
value = LVDSVRS - 1;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0A, ~0x08, (value & 0x400) >> 7);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x07, ~0x80, (value & 0x200) >> 2);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x07, ~0x04, (value & 0x100) >> 6);
- XGINew_SetReg1(pVBInfo->P3d4, 0x10, (value & 0xFF));
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0A, ~0x08, (value & 0x400) >> 7);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x07, ~0x80, (value & 0x200) >> 2);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x07, ~0x04, (value & 0x100) >> 6);
+ xgifb_reg_set(pVBInfo->P3d4, 0x10, (value & 0xFF));
/* Panel VRS SR35[2:0] SR34[7:0] */
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x35, ~0x07, (value & 0x700) >> 8);
- XGINew_SetReg1(pVBInfo->P3c4, 0x34, value & 0xFF);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x35, ~0x07, (value & 0x700) >> 8);
+ xgifb_reg_set(pVBInfo->P3c4, 0x34, value & 0xFF);
/* VRE SR0A[5] CR11[3:0] */
value = LVDSVRE - 1;
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x0A, ~0x20, (value & 0x10) << 1);
- XGINew_SetRegANDOR(pVBInfo->P3d4, 0x11, ~0x0F, value & 0x0F);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x0A, ~0x20, (value & 0x10) << 1);
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x11, ~0x0F, value & 0x0F);
/* Panel VRE SR3F[7:2] */
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x3F, ~0xFC, (value << 2) & 0xFC);
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x3F, ~0xFC, (value << 2) & 0xFC);
for (temp = 0, value = 0; temp < 3; temp++) {
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x31, ~0x30, value);
- XGINew_SetReg1(pVBInfo->P3c4,
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x31, ~0x30, value);
+ xgifb_reg_set(pVBInfo->P3c4,
0x2B,
pVBInfo->XG21_LVDSCapList[lvdstableindex].VCLKData1);
- XGINew_SetReg1(pVBInfo->P3c4,
+ xgifb_reg_set(pVBInfo->P3c4,
0x2C,
pVBInfo->XG21_LVDSCapList[lvdstableindex].VCLKData2);
value += 0x10;
}
if (!(modeflag & Charx8Dot)) {
- XGINew_GetReg2(pVBInfo->P3da); /* reset 3da */
- XGINew_SetReg3(pVBInfo->P3c0, 0x13); /* set index */
- XGINew_SetReg3(pVBInfo->P3c0, 0x00); /* set data, panning = 0, shift left 1 dot*/
+ inb(pVBInfo->P3da); /* reset 3da */
+ outb(0x13, pVBInfo->P3c0); /* set index */
+ outb(0x00, pVBInfo->P3c0); /* set data, panning = 0, shift left 1 dot*/
- XGINew_GetReg2(pVBInfo->P3da); /* Enable Attribute */
- XGINew_SetReg3(pVBInfo->P3c0, 0x20);
+ inb(pVBInfo->P3da); /* Enable Attribute */
+ outb(0x20, pVBInfo->P3c0);
- XGINew_GetReg2(pVBInfo->P3da); /* reset 3da */
+ inb(pVBInfo->P3da); /* reset 3da */
}
}
@@ -7364,7 +6831,7 @@ void XGI_SetXG27LVDSPara(unsigned short ModeNo, unsigned short ModeIdIndex,
/* 1: Disable PSC */
/* Description : */
/* --------------------------------------------------------------------- */
-unsigned char XGI_IsLCDON(struct vb_device_info *pVBInfo)
+static unsigned char XGI_IsLCDON(struct vb_device_info *pVBInfo)
{
unsigned short tempax;
@@ -7377,41 +6844,18 @@ unsigned char XGI_IsLCDON(struct vb_device_info *pVBInfo)
return 0;
}
-void XGI_EnablePWD(struct vb_device_info *pVBInfo)
-{
- unsigned short index, temp;
-
- index = XGI_GetLCDCapPtr(pVBInfo);
- temp = pVBInfo->LCDCapList[index].PWD_2B;
- XGINew_SetReg1(pVBInfo->Part4Port, 0x2B, temp);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x2C,
- pVBInfo->LCDCapList[index].PWD_2C);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x2D,
- pVBInfo->LCDCapList[index].PWD_2D);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x2E,
- pVBInfo->LCDCapList[index].PWD_2E);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x2F,
- pVBInfo->LCDCapList[index].PWD_2F);
- XGINew_SetRegOR(pVBInfo->Part4Port, 0x27, 0x80); /* enable PWD */
-}
-
-void XGI_DisablePWD(struct vb_device_info *pVBInfo)
-{
- XGINew_SetRegAND(pVBInfo->Part4Port, 0x27, 0x7F); /* disable PWD */
-}
-
/* --------------------------------------------------------------------- */
/* Function : XGI_DisableChISLCD */
/* Input : */
/* Output : 0 -> Not LCD Mode */
/* Description : */
/* --------------------------------------------------------------------- */
-unsigned char XGI_DisableChISLCD(struct vb_device_info *pVBInfo)
+static unsigned char XGI_DisableChISLCD(struct vb_device_info *pVBInfo)
{
unsigned short tempbx, tempah;
tempbx = pVBInfo->SetFlag & (DisableChA | DisableChB);
- tempah = ~((unsigned short) XGINew_GetReg1(pVBInfo->Part1Port, 0x2E));
+ tempah = ~((unsigned short) xgifb_reg_get(pVBInfo->Part1Port, 0x2E));
if (tempbx & (EnableChA | DisableChA)) {
if (!(tempah & 0x08)) /* Chk LCDA Mode */
@@ -7433,12 +6877,12 @@ unsigned char XGI_DisableChISLCD(struct vb_device_info *pVBInfo)
/* Output : 0 -> Not LCD mode */
/* Description : */
/* --------------------------------------------------------------------- */
-unsigned char XGI_EnableChISLCD(struct vb_device_info *pVBInfo)
+static unsigned char XGI_EnableChISLCD(struct vb_device_info *pVBInfo)
{
unsigned short tempbx, tempah;
tempbx = pVBInfo->SetFlag & (EnableChA | EnableChB);
- tempah = ~((unsigned short) XGINew_GetReg1(pVBInfo->Part1Port, 0x2E));
+ tempah = ~((unsigned short) xgifb_reg_get(pVBInfo->Part1Port, 0x2E));
if (tempbx & (EnableChA | DisableChA)) {
if (!(tempah & 0x08)) /* Chk LCDA Mode */
@@ -7454,298 +6898,14 @@ unsigned char XGI_EnableChISLCD(struct vb_device_info *pVBInfo)
return 0;
}
-unsigned short XGI_GetLCDCapPtr(struct vb_device_info *pVBInfo)
-{
- unsigned char tempal, tempah, tempbl, i;
-
- tempah = XGINew_GetReg1(pVBInfo->P3d4, 0x36);
- tempal = tempah & 0x0F;
- tempah = tempah & 0xF0;
- i = 0;
- tempbl = pVBInfo->LCDCapList[i].LCD_ID;
-
- while (tempbl != 0xFF) {
- if (tempbl & 0x80) { /* OEMUtil */
- tempal = tempah;
- tempbl = tempbl & ~(0x80);
- }
-
- if (tempal == tempbl)
- break;
-
- i++;
-
- tempbl = pVBInfo->LCDCapList[i].LCD_ID;
- }
-
- return i;
-}
-
-unsigned short XGI_GetLCDCapPtr1(struct vb_device_info *pVBInfo)
-{
- unsigned short tempah, tempal, tempbl, i;
-
- tempal = pVBInfo->LCDResInfo;
- tempah = pVBInfo->LCDTypeInfo;
-
- i = 0;
- tempbl = pVBInfo->LCDCapList[i].LCD_ID;
-
- while (tempbl != 0xFF) {
- if ((tempbl & 0x80) && (tempbl != 0x80)) {
- tempal = tempah;
- tempbl &= ~0x80;
- }
-
- if (tempal == tempbl)
- break;
-
- i++;
- tempbl = pVBInfo->LCDCapList[i].LCD_ID;
- }
-
- if (tempbl == 0xFF) {
- pVBInfo->LCDResInfo = Panel1024x768;
- pVBInfo->LCDTypeInfo = 0;
- i = 0;
- }
-
- return i;
-}
-
-void XGI_GetLCDSync(unsigned short *HSyncWidth, unsigned short *VSyncWidth,
- struct vb_device_info *pVBInfo)
-{
- unsigned short Index;
-
- Index = XGI_GetLCDCapPtr(pVBInfo);
- *HSyncWidth = pVBInfo->LCDCapList[Index].LCD_HSyncWidth;
- *VSyncWidth = pVBInfo->LCDCapList[Index].LCD_VSyncWidth;
-
- return;
-}
-
-void XGI_EnableBridge(struct xgi_hw_device_info *HwDeviceExtension,
- struct vb_device_info *pVBInfo)
-{
- unsigned short tempbl, tempah;
-
- if (pVBInfo->SetFlag == Win9xDOSMode) {
- if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
- | VB_XGI302LV | VB_XGI301C)) {
- XGI_DisplayOn(HwDeviceExtension, pVBInfo);
- return;
- } else
- /* LVDS or CH7017 */
- return;
- }
-
- if (HwDeviceExtension->jChipType < XG40) {
- if (!XGI_DisableChISLCD(pVBInfo)) {
- if ((XGI_EnableChISLCD(pVBInfo)) || (pVBInfo->VBInfo
- & (SetCRT2ToLCD | SetCRT2ToLCDA))) {
- if (pVBInfo->LCDInfo & SetPWDEnable) {
- XGI_EnablePWD(pVBInfo);
- } else {
- pVBInfo->LCDInfo &= (~SetPWDEnable);
- if (pVBInfo->VBType & (VB_XGI301LV
- | VB_XGI302LV
- | VB_XGI301C)) {
- tempbl = 0xFD;
- tempah = 0x02;
- } else {
- tempbl = 0xFB;
- tempah = 0x00;
- }
-
- XGI_SetPanelPower(tempah, tempbl,
- pVBInfo);
- XGI_SetPanelDelay(1, pVBInfo);
- }
- }
- }
- } /* Not 340 */
-
- if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
- | VB_XGI302LV | VB_XGI301C)) {
- if (!(pVBInfo->SetFlag & DisableChA)) {
- if (pVBInfo->SetFlag & EnableChA) {
- XGINew_SetReg1(pVBInfo->Part1Port, 0x1E, 0x20); /* Power on */
- } else {
- if (pVBInfo->VBInfo & SetCRT2ToDualEdge) { /* SetCRT2ToLCDA ) */
- XGINew_SetReg1(pVBInfo->Part1Port,
- 0x1E, 0x20); /* Power on */
- }
- }
- }
-
- if (!(pVBInfo->SetFlag & DisableChB)) {
- if ((pVBInfo->SetFlag & EnableChB) || (pVBInfo->VBInfo
- & (SetCRT2ToLCD | SetCRT2ToTV
- | SetCRT2ToRAMDAC))) {
- tempah = (unsigned char) XGINew_GetReg1(
- pVBInfo->P3c4, 0x32);
- tempah &= 0xDF;
- if (pVBInfo->VBInfo & SetInSlaveMode) {
- if (!(pVBInfo->VBInfo & SetCRT2ToRAMDAC))
- tempah |= 0x20;
- }
- XGINew_SetReg1(pVBInfo->P3c4, 0x32, tempah);
- XGINew_SetRegOR(pVBInfo->P3c4, 0x1E, 0x20);
-
- tempah = (unsigned char) XGINew_GetReg1(
- pVBInfo->Part1Port, 0x2E);
-
- if (!(tempah & 0x80))
- XGINew_SetRegOR(pVBInfo->Part1Port,
- 0x2E, 0x80); /* BVBDOENABLE = 1 */
-
- XGINew_SetRegAND(pVBInfo->Part1Port, 0x00, 0x7F); /* BScreenOFF = 0 */
- }
- }
-
- if ((pVBInfo->SetFlag & (EnableChA | EnableChB))
- || (!(pVBInfo->VBInfo & DisableCRT2Display))) {
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x00, ~0xE0,
- 0x20); /* shampoo 0129 */
- if (pVBInfo->VBType & (VB_XGI302LV | VB_XGI301C)) {
- if (!XGI_DisableChISLCD(pVBInfo)) {
- if (XGI_EnableChISLCD(pVBInfo)
- || (pVBInfo->VBInfo
- & (SetCRT2ToLCD
- | SetCRT2ToLCDA)))
- XGINew_SetRegAND(
- pVBInfo->Part4Port,
- 0x2A, 0x7F); /* LVDS PLL power on */
- }
- XGINew_SetRegAND(pVBInfo->Part4Port, 0x30, 0x7F); /* LVDS Driver power on */
- }
- }
-
- tempah = 0x00;
-
- if (!(pVBInfo->VBInfo & DisableCRT2Display)) {
- tempah = 0xc0;
-
- if (!(pVBInfo->VBInfo & SetSimuScanMode)) {
- if (pVBInfo->VBInfo & SetCRT2ToLCDA) {
- if (pVBInfo->VBInfo & SetCRT2ToDualEdge) {
- tempah = tempah & 0x40;
- if (pVBInfo->VBInfo
- & SetCRT2ToLCDA)
- tempah = tempah ^ 0xC0;
-
- if (pVBInfo->SetFlag
- & DisableChB)
- tempah &= 0xBF;
-
- if (pVBInfo->SetFlag
- & DisableChA)
- tempah &= 0x7F;
-
- if (pVBInfo->SetFlag
- & EnableChB)
- tempah |= 0x40;
-
- if (pVBInfo->SetFlag
- & EnableChA)
- tempah |= 0x80;
- }
- }
- }
- }
-
- XGINew_SetRegOR(pVBInfo->Part4Port, 0x1F, tempah); /* EnablePart4_1F */
-
- if (pVBInfo->SetFlag & Win9xDOSMode) {
- XGI_DisplayOn(HwDeviceExtension, pVBInfo);
- return;
- }
-
- if (!(pVBInfo->SetFlag & DisableChA)) {
- XGI_VBLongWait(pVBInfo);
- if (!(pVBInfo->SetFlag & GatingCRT)) {
- XGI_DisableGatingCRT(HwDeviceExtension, pVBInfo);
- XGI_DisplayOn(HwDeviceExtension, pVBInfo);
- XGI_VBLongWait(pVBInfo);
- }
- }
- } /* 301 */
- else { /* LVDS */
- if (pVBInfo->VBInfo & (SetCRT2ToTV | SetCRT2ToLCD
- | SetCRT2ToLCDA))
- XGINew_SetRegOR(pVBInfo->Part1Port, 0x1E, 0x20); /* enable CRT2 */
-
- tempah = (unsigned char) XGINew_GetReg1(pVBInfo->Part1Port,
- 0x2E);
- if (!(tempah & 0x80))
- XGINew_SetRegOR(pVBInfo->Part1Port, 0x2E, 0x80); /* BVBDOENABLE = 1 */
-
- XGINew_SetRegAND(pVBInfo->Part1Port, 0x00, 0x7F);
- XGI_DisplayOn(HwDeviceExtension, pVBInfo);
- } /* End of VB */
-
- if (HwDeviceExtension->jChipType < XG40) {
- if (!XGI_EnableChISLCD(pVBInfo)) {
- if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
- if (XGI_BacklightByDrv(pVBInfo))
- return;
- } else
- return;
- }
-
- if (pVBInfo->LCDInfo & SetPWDEnable) {
- XGI_FirePWDEnable(pVBInfo);
- return;
- }
-
- XGI_SetPanelDelay(2, pVBInfo);
-
- if (pVBInfo->VBType & (VB_XGI301LV | VB_XGI302LV | VB_XGI301C)) {
- tempah = 0x01;
- tempbl = 0xFE; /* turn on backlght */
- } else {
- tempbl = 0xF7;
- tempah = 0x00;
- }
- XGI_SetPanelPower(tempah, tempbl, pVBInfo);
- }
-}
-
void XGI_DisableBridge(struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
{
- unsigned short tempax, tempbx, tempah = 0, tempbl = 0;
+ unsigned short tempah = 0;
if (pVBInfo->SetFlag == Win9xDOSMode)
return;
- if (HwDeviceExtension->jChipType < XG40) {
- if ((!(pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)))
- || (XGI_DisableChISLCD(pVBInfo))) {
- if (!XGI_IsLCDON(pVBInfo)) {
- if (pVBInfo->LCDInfo & SetPWDEnable)
- XGI_EnablePWD(pVBInfo);
- else {
- pVBInfo->LCDInfo &= ~SetPWDEnable;
- XGI_DisablePWD(pVBInfo);
- if (pVBInfo->VBType & (VB_XGI301LV
- | VB_XGI302LV
- | VB_XGI301C)) {
- tempbx = 0xFE; /* not 01h */
- tempax = 0;
- } else {
- tempbx = 0xF7; /* not 08h */
- tempax = 0x08;
- }
- XGI_SetPanelPower(tempax, tempbx,
- pVBInfo);
- XGI_SetPanelDelay(3, pVBInfo);
- }
- } /* end if (!XGI_IsLCDON(pVBInfo)) */
- }
- }
-
/*
if (CH7017) {
if (!(pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2toLCDA)) || (XGI_DisableChISLCD(pVBInfo))) {
@@ -7781,13 +6941,13 @@ void XGI_DisableBridge(struct xgi_hw_device_info *HwDeviceExtension,
}
}
- XGINew_SetRegAND(pVBInfo->Part4Port, 0x1F, tempah); /* disable part4_1f */
+ xgifb_reg_and(pVBInfo->Part4Port, 0x1F, tempah); /* disable part4_1f */
if (pVBInfo->VBType & (VB_XGI302LV | VB_XGI301C)) {
if (((pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)))
|| (XGI_DisableChISLCD(pVBInfo))
|| (XGI_IsLCDON(pVBInfo)))
- XGINew_SetRegOR(pVBInfo->Part4Port, 0x30, 0x80); /* LVDS Driver power down */
+ xgifb_reg_or(pVBInfo->Part4Port, 0x30, 0x80); /* LVDS Driver power down */
}
if ((pVBInfo->SetFlag & DisableChA) || (pVBInfo->VBInfo
@@ -7801,13 +6961,13 @@ void XGI_DisableBridge(struct xgi_hw_device_info *HwDeviceExtension,
if (pVBInfo->VBInfo & SetCRT2ToLCDA) {
if ((pVBInfo->SetFlag & DisableChA) || (pVBInfo->VBInfo
& SetCRT2ToLCDA))
- XGINew_SetRegAND(pVBInfo->Part1Port, 0x1e, 0xdf); /* Power down */
+ xgifb_reg_and(pVBInfo->Part1Port, 0x1e, 0xdf); /* Power down */
}
- XGINew_SetRegAND(pVBInfo->P3c4, 0x32, 0xdf); /* disable TV as primary VGA swap */
+ xgifb_reg_and(pVBInfo->P3c4, 0x32, 0xdf); /* disable TV as primary VGA swap */
if ((pVBInfo->VBInfo & (SetSimuScanMode | SetCRT2ToDualEdge)))
- XGINew_SetRegAND(pVBInfo->Part2Port, 0x00, 0xdf);
+ xgifb_reg_and(pVBInfo->Part2Port, 0x00, 0xdf);
if ((pVBInfo->SetFlag & DisableChB) || (pVBInfo->VBInfo
& (DisableCRT2Display | SetSimuScanMode))
@@ -7816,51 +6976,29 @@ void XGI_DisableBridge(struct xgi_hw_device_info *HwDeviceExtension,
& (SetCRT2ToRAMDAC
| SetCRT2ToLCD
| SetCRT2ToTV))))
- XGINew_SetRegOR(pVBInfo->Part1Port, 0x00, 0x80); /* BScreenOff=1 */
+ xgifb_reg_or(pVBInfo->Part1Port, 0x00, 0x80); /* BScreenOff=1 */
if ((pVBInfo->SetFlag & DisableChB) || (pVBInfo->VBInfo
& (DisableCRT2Display | SetSimuScanMode))
|| (!(pVBInfo->VBInfo & SetCRT2ToLCDA))
|| (pVBInfo->VBInfo & (SetCRT2ToRAMDAC
| SetCRT2ToLCD | SetCRT2ToTV))) {
- tempah = XGINew_GetReg1(pVBInfo->Part1Port, 0x00); /* save Part1 index 0 */
- XGINew_SetRegOR(pVBInfo->Part1Port, 0x00, 0x10); /* BTDAC = 1, avoid VB reset */
- XGINew_SetRegAND(pVBInfo->Part1Port, 0x1E, 0xDF); /* disable CRT2 */
- XGINew_SetReg1(pVBInfo->Part1Port, 0x00, tempah); /* restore Part1 index 0 */
+ tempah = xgifb_reg_get(pVBInfo->Part1Port, 0x00); /* save Part1 index 0 */
+ xgifb_reg_or(pVBInfo->Part1Port, 0x00, 0x10); /* BTDAC = 1, avoid VB reset */
+ xgifb_reg_and(pVBInfo->Part1Port, 0x1E, 0xDF); /* disable CRT2 */
+ xgifb_reg_set(pVBInfo->Part1Port, 0x00, tempah); /* restore Part1 index 0 */
}
} else { /* {301} */
if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToTV)) {
- XGINew_SetRegOR(pVBInfo->Part1Port, 0x00, 0x80); /* BScreenOff=1 */
- XGINew_SetRegAND(pVBInfo->Part1Port, 0x1E, 0xDF); /* Disable CRT2 */
- XGINew_SetRegAND(pVBInfo->P3c4, 0x32, 0xDF); /* Disable TV asPrimary VGA swap */
+ xgifb_reg_or(pVBInfo->Part1Port, 0x00, 0x80); /* BScreenOff=1 */
+ xgifb_reg_and(pVBInfo->Part1Port, 0x1E, 0xDF); /* Disable CRT2 */
+ xgifb_reg_and(pVBInfo->P3c4, 0x32, 0xDF); /* Disable TV asPrimary VGA swap */
}
if (pVBInfo->VBInfo & (DisableCRT2Display | SetCRT2ToLCDA
| SetSimuScanMode))
XGI_DisplayOff(HwDeviceExtension, pVBInfo);
}
-
- if (HwDeviceExtension->jChipType < XG40) {
- if (!(pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA))
- || (XGI_DisableChISLCD(pVBInfo))
- || (XGI_IsLCDON(pVBInfo))) {
- if (pVBInfo->LCDInfo & SetPWDEnable) {
- if (pVBInfo->LCDInfo & SetPWDEnable)
- XGI_BacklightByDrv(pVBInfo);
- else {
- XGI_SetPanelDelay(4, pVBInfo);
- if (pVBInfo->VBType & VB_XGI301LV) {
- tempbl = 0xFD;
- tempah = 0x00;
- } else {
- tempbl = 0xFB;
- tempah = 0x04;
- }
- }
- }
- XGI_SetPanelPower(tempah, tempbl, pVBInfo);
- }
- }
}
/* --------------------------------------------------------------------- */
@@ -7880,7 +7018,7 @@ void XGI_DisableBridge(struct xgi_hw_device_info *HwDeviceExtension,
/* A : Ext750p */
/* B : St750p */
/* --------------------------------------------------------------------- */
-unsigned short XGI_GetTVPtrIndex(struct vb_device_info *pVBInfo)
+static unsigned short XGI_GetTVPtrIndex(struct vb_device_info *pVBInfo)
{
unsigned short tempbx = 0;
@@ -7901,35 +7039,58 @@ unsigned short XGI_GetTVPtrIndex(struct vb_device_info *pVBInfo)
}
/* --------------------------------------------------------------------- */
-/* Function : XGI_OEM310Setting */
+/* Function : XGI_GetTVPtrIndex2 */
/* Input : */
-/* Output : */
-/* Description : Customized Param. for 301 */
+/* Output : bx 0 : NTSC */
+/* 1 : PAL */
+/* 2 : PALM */
+/* 3 : PALN */
+/* 4 : NTSC1024x768 */
+/* 5 : PAL-M 1024x768 */
+/* 6-7: reserved */
+/* cl 0 : YFilter1 */
+/* 1 : YFilter2 */
+/* ch 0 : 301A */
+/* 1 : 301B/302B/301LV/302LV */
+/* Description : */
/* --------------------------------------------------------------------- */
-void XGI_OEM310Setting(unsigned short ModeNo, unsigned short ModeIdIndex,
- struct vb_device_info *pVBInfo)
+static void XGI_GetTVPtrIndex2(unsigned short *tempbx, unsigned char *tempcl,
+ unsigned char *tempch, struct vb_device_info *pVBInfo)
{
- if (pVBInfo->SetFlag & Win9xDOSMode)
- return;
+ *tempbx = 0;
+ *tempcl = 0;
+ *tempch = 0;
- /* GetPart1IO(); */
- XGI_SetDelayComp(pVBInfo);
+ if (pVBInfo->TVInfo & SetPALTV)
+ *tempbx = 1;
- if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA))
- XGI_SetLCDCap(pVBInfo);
+ if (pVBInfo->TVInfo & SetPALMTV)
+ *tempbx = 2;
- if (pVBInfo->VBInfo & SetCRT2ToTV) {
- /* GetPart2IO() */
- XGI_SetPhaseIncr(pVBInfo);
- XGI_SetYFilter(ModeNo, ModeIdIndex, pVBInfo);
- XGI_SetAntiFlicker(ModeNo, ModeIdIndex, pVBInfo);
+ if (pVBInfo->TVInfo & SetPALNTV)
+ *tempbx = 3;
- if (pVBInfo->VBType & VB_XGI301)
- XGI_SetEdgeEnhance(ModeNo, ModeIdIndex, pVBInfo);
+ if (pVBInfo->TVInfo & NTSC1024x768) {
+ *tempbx = 4;
+ if (pVBInfo->TVInfo & SetPALMTV)
+ *tempbx = 5;
+ }
+
+ if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
+ | VB_XGI302LV | VB_XGI301C)) {
+ if ((!(pVBInfo->VBInfo & SetInSlaveMode)) || (pVBInfo->TVInfo
+ & TVSimuMode)) {
+ *tempbx += 8;
+ *tempcl += 1;
+ }
}
+
+ if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
+ | VB_XGI302LV | VB_XGI301C))
+ (*tempch)++;
}
-void XGI_SetDelayComp(struct vb_device_info *pVBInfo)
+static void XGI_SetDelayComp(struct vb_device_info *pVBInfo)
{
unsigned short index;
@@ -7968,7 +7129,7 @@ void XGI_SetDelayComp(struct vb_device_info *pVBInfo)
tempbl &= 0x0F;
tempbh &= 0xF0;
- tempah = XGINew_GetReg1(pVBInfo->Part1Port, 0x2D);
+ tempah = xgifb_reg_get(pVBInfo->Part1Port, 0x2D);
if (pVBInfo->VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToLCD
| SetCRT2ToTV)) { /* Channel B */
@@ -7980,7 +7141,7 @@ void XGI_SetDelayComp(struct vb_device_info *pVBInfo)
tempah &= 0x0F;
tempah |= tempbh;
}
- XGINew_SetReg1(pVBInfo->Part1Port, 0x2D, tempah);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x2D, tempah);
}
} else if (pVBInfo->IF_DEF_LVDS == 1) {
tempbl = 0;
@@ -7991,72 +7152,35 @@ void XGI_SetDelayComp(struct vb_device_info *pVBInfo)
pVBInfo)].LCD_DelayCompensation; /* / Get LCD Delay */
tempah &= 0x0f;
tempah = tempah << 4;
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x2D, 0x0f,
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x2D, 0x0f,
tempah);
}
}
}
-void XGI_SetLCDCap(struct vb_device_info *pVBInfo)
-{
- unsigned short tempcx;
-
- tempcx = pVBInfo->LCDCapList[XGI_GetLCDCapPtr(pVBInfo)].LCD_Capability;
-
- if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
- | VB_XGI302LV | VB_XGI301C)) {
- if (pVBInfo->VBType & (VB_XGI301LV | VB_XGI302LV | VB_XGI301C)) { /* 301LV/302LV only */
- /* Set 301LV Capability */
- XGINew_SetReg1(pVBInfo->Part4Port, 0x24,
- (unsigned char) (tempcx & 0x1F));
- }
- /* VB Driving */
- XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x0D,
- ~((EnableVBCLKDRVLOW | EnablePLLSPLOW) >> 8),
- (unsigned short) ((tempcx & (EnableVBCLKDRVLOW
- | EnablePLLSPLOW)) >> 8));
- }
-
- if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
- | VB_XGI302LV | VB_XGI301C)) {
- if (pVBInfo->VBInfo & SetCRT2ToLCD)
- XGI_SetLCDCap_B(tempcx, pVBInfo);
- else if (pVBInfo->VBInfo & SetCRT2ToLCDA)
- XGI_SetLCDCap_A(tempcx, pVBInfo);
-
- if (pVBInfo->VBType & (VB_XGI302LV | VB_XGI301C)) {
- if (tempcx & EnableSpectrum)
- SetSpectrum(pVBInfo);
- }
- } else {
- /* LVDS,CH7017 */
- XGI_SetLCDCap_A(tempcx, pVBInfo);
- }
-}
-
-void XGI_SetLCDCap_A(unsigned short tempcx, struct vb_device_info *pVBInfo)
+static void XGI_SetLCDCap_A(unsigned short tempcx, struct vb_device_info *pVBInfo)
{
unsigned short temp;
- temp = XGINew_GetReg1(pVBInfo->P3d4, 0x37);
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x37);
if (temp & LCDRGB18Bit) {
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x19, 0x0F,
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x19, 0x0F,
(unsigned short) (0x20 | (tempcx & 0x00C0))); /* Enable Dither */
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x1A, 0x7F, 0x80);
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x1A, 0x7F, 0x80);
} else {
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x19, 0x0F,
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x19, 0x0F,
(unsigned short) (0x30 | (tempcx & 0x00C0)));
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x1A, 0x7F, 0x00);
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x1A, 0x7F, 0x00);
}
/*
if (tempcx & EnableLCD24bpp) { // 24bits
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x19, 0x0F, (unsigned short)(0x30 | (tempcx&0x00C0)));
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x1A, 0x7F, 0x00);
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x19, 0x0F, (unsigned short)(0x30 | (tempcx&0x00C0)));
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x1A, 0x7F, 0x00);
} else {
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x19, 0x0F, (unsigned short)(0x20 | (tempcx&0x00C0))); // Enable Dither
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x1A, 0x7F, 0x80);
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x19, 0x0F, (unsigned short)(0x20 | (tempcx&0x00C0))); // Enable Dither
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x1A, 0x7F, 0x80);
}
*/
}
@@ -8067,39 +7191,76 @@ void XGI_SetLCDCap_A(unsigned short tempcx, struct vb_device_info *pVBInfo)
/* Output : */
/* Description : */
/* --------------------------------------------------------------------- */
-void XGI_SetLCDCap_B(unsigned short tempcx, struct vb_device_info *pVBInfo)
+static void XGI_SetLCDCap_B(unsigned short tempcx, struct vb_device_info *pVBInfo)
{
if (tempcx & EnableLCD24bpp) /* 24bits */
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x1A, 0xE0,
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x1A, 0xE0,
(unsigned short) (((tempcx & 0x00ff) >> 6)
| 0x0c));
else
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x1A, 0xE0,
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x1A, 0xE0,
(unsigned short) (((tempcx & 0x00ff) >> 6)
| 0x18)); /* Enable Dither */
}
-void SetSpectrum(struct vb_device_info *pVBInfo)
+static void SetSpectrum(struct vb_device_info *pVBInfo)
{
unsigned short index;
index = XGI_GetLCDCapPtr(pVBInfo);
- XGINew_SetRegAND(pVBInfo->Part4Port, 0x30, 0x8F); /* disable down spectrum D[4] */
+ xgifb_reg_and(pVBInfo->Part4Port, 0x30, 0x8F); /* disable down spectrum D[4] */
XGI_LongWait(pVBInfo);
- XGINew_SetRegOR(pVBInfo->Part4Port, 0x30, 0x20); /* reset spectrum */
+ xgifb_reg_or(pVBInfo->Part4Port, 0x30, 0x20); /* reset spectrum */
XGI_LongWait(pVBInfo);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x31,
+ xgifb_reg_set(pVBInfo->Part4Port, 0x31,
pVBInfo->LCDCapList[index].Spectrum_31);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x32,
+ xgifb_reg_set(pVBInfo->Part4Port, 0x32,
pVBInfo->LCDCapList[index].Spectrum_32);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x33,
+ xgifb_reg_set(pVBInfo->Part4Port, 0x33,
pVBInfo->LCDCapList[index].Spectrum_33);
- XGINew_SetReg1(pVBInfo->Part4Port, 0x34,
+ xgifb_reg_set(pVBInfo->Part4Port, 0x34,
pVBInfo->LCDCapList[index].Spectrum_34);
XGI_LongWait(pVBInfo);
- XGINew_SetRegOR(pVBInfo->Part4Port, 0x30, 0x40); /* enable spectrum */
+ xgifb_reg_or(pVBInfo->Part4Port, 0x30, 0x40); /* enable spectrum */
+}
+
+static void XGI_SetLCDCap(struct vb_device_info *pVBInfo)
+{
+ unsigned short tempcx;
+
+ tempcx = pVBInfo->LCDCapList[XGI_GetLCDCapPtr(pVBInfo)].LCD_Capability;
+
+ if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
+ | VB_XGI302LV | VB_XGI301C)) {
+ if (pVBInfo->VBType & (VB_XGI301LV | VB_XGI302LV | VB_XGI301C)) { /* 301LV/302LV only */
+ /* Set 301LV Capability */
+ xgifb_reg_set(pVBInfo->Part4Port, 0x24,
+ (unsigned char) (tempcx & 0x1F));
+ }
+ /* VB Driving */
+ xgifb_reg_and_or(pVBInfo->Part4Port, 0x0D,
+ ~((EnableVBCLKDRVLOW | EnablePLLSPLOW) >> 8),
+ (unsigned short) ((tempcx & (EnableVBCLKDRVLOW
+ | EnablePLLSPLOW)) >> 8));
+ }
+
+ if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
+ | VB_XGI302LV | VB_XGI301C)) {
+ if (pVBInfo->VBInfo & SetCRT2ToLCD)
+ XGI_SetLCDCap_B(tempcx, pVBInfo);
+ else if (pVBInfo->VBInfo & SetCRT2ToLCDA)
+ XGI_SetLCDCap_A(tempcx, pVBInfo);
+
+ if (pVBInfo->VBType & (VB_XGI302LV | VB_XGI301C)) {
+ if (tempcx & EnableSpectrum)
+ SetSpectrum(pVBInfo);
+ }
+ } else {
+ /* LVDS,CH7017 */
+ XGI_SetLCDCap_A(tempcx, pVBInfo);
+ }
}
/* --------------------------------------------------------------------- */
@@ -8108,7 +7269,7 @@ void SetSpectrum(struct vb_device_info *pVBInfo)
/* Output : */
/* Description : Set TV Customized Param. */
/* --------------------------------------------------------------------- */
-void XGI_SetAntiFlicker(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_SetAntiFlicker(unsigned short ModeNo, unsigned short ModeIdIndex,
struct vb_device_info *pVBInfo)
{
unsigned short tempbx, index;
@@ -8130,10 +7291,10 @@ void XGI_SetAntiFlicker(unsigned short ModeNo, unsigned short ModeIdIndex,
tempah = TVAntiFlickList[tempbx];
tempah = tempah << 4;
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x0A, 0x8F, tempah);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x0A, 0x8F, tempah);
}
-void XGI_SetEdgeEnhance(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_SetEdgeEnhance(unsigned short ModeNo, unsigned short ModeIdIndex,
struct vb_device_info *pVBInfo)
{
unsigned short tempbx, index;
@@ -8152,10 +7313,10 @@ void XGI_SetEdgeEnhance(unsigned short ModeNo, unsigned short ModeIdIndex,
tempah = TVEdgeList[tempbx];
tempah = tempah << 5;
- XGINew_SetRegANDOR(pVBInfo->Part2Port, 0x3A, 0x1F, tempah);
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x3A, 0x1F, tempah);
}
-void XGI_SetPhaseIncr(struct vb_device_info *pVBInfo)
+static void XGI_SetPhaseIncr(struct vb_device_info *pVBInfo)
{
unsigned short tempbx;
@@ -8166,17 +7327,17 @@ void XGI_SetPhaseIncr(struct vb_device_info *pVBInfo)
XGI_GetTVPtrIndex2(&tempbx, &tempcl, &tempch, pVBInfo); /* bx, cl, ch */
tempData = TVPhaseList[tempbx];
- XGINew_SetReg1(pVBInfo->Part2Port, 0x31, (unsigned short) (tempData
+ xgifb_reg_set(pVBInfo->Part2Port, 0x31, (unsigned short) (tempData
& 0x000000FF));
- XGINew_SetReg1(pVBInfo->Part2Port, 0x32, (unsigned short) ((tempData
+ xgifb_reg_set(pVBInfo->Part2Port, 0x32, (unsigned short) ((tempData
& 0x0000FF00) >> 8));
- XGINew_SetReg1(pVBInfo->Part2Port, 0x33, (unsigned short) ((tempData
+ xgifb_reg_set(pVBInfo->Part2Port, 0x33, (unsigned short) ((tempData
& 0x00FF0000) >> 16));
- XGINew_SetReg1(pVBInfo->Part2Port, 0x34, (unsigned short) ((tempData
+ xgifb_reg_set(pVBInfo->Part2Port, 0x34, (unsigned short) ((tempData
& 0xFF000000) >> 24));
}
-void XGI_SetYFilter(unsigned short ModeNo, unsigned short ModeIdIndex,
+static void XGI_SetYFilter(unsigned short ModeNo, unsigned short ModeIdIndex,
struct vb_device_info *pVBInfo)
{
unsigned short tempbx, index;
@@ -8238,75 +7399,52 @@ void XGI_SetYFilter(unsigned short ModeNo, unsigned short ModeIdIndex,
index = tempal * 7;
if ((tempcl == 0) && (tempch == 1)) {
- XGINew_SetReg1(pVBInfo->Part2Port, 0x35, 0);
- XGINew_SetReg1(pVBInfo->Part2Port, 0x36, 0);
- XGINew_SetReg1(pVBInfo->Part2Port, 0x37, 0);
- XGINew_SetReg1(pVBInfo->Part2Port, 0x38, filterPtr[index++]);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x35, 0);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x36, 0);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x37, 0);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x38, filterPtr[index++]);
} else {
- XGINew_SetReg1(pVBInfo->Part2Port, 0x35, filterPtr[index++]);
- XGINew_SetReg1(pVBInfo->Part2Port, 0x36, filterPtr[index++]);
- XGINew_SetReg1(pVBInfo->Part2Port, 0x37, filterPtr[index++]);
- XGINew_SetReg1(pVBInfo->Part2Port, 0x38, filterPtr[index++]);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x35, filterPtr[index++]);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x36, filterPtr[index++]);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x37, filterPtr[index++]);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x38, filterPtr[index++]);
}
if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
| VB_XGI302LV | VB_XGI301C)) {
- XGINew_SetReg1(pVBInfo->Part2Port, 0x48, filterPtr[index++]);
- XGINew_SetReg1(pVBInfo->Part2Port, 0x49, filterPtr[index++]);
- XGINew_SetReg1(pVBInfo->Part2Port, 0x4A, filterPtr[index++]);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x48, filterPtr[index++]);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x49, filterPtr[index++]);
+ xgifb_reg_set(pVBInfo->Part2Port, 0x4A, filterPtr[index++]);
}
}
/* --------------------------------------------------------------------- */
-/* Function : XGI_GetTVPtrIndex2 */
+/* Function : XGI_OEM310Setting */
/* Input : */
-/* Output : bx 0 : NTSC */
-/* 1 : PAL */
-/* 2 : PALM */
-/* 3 : PALN */
-/* 4 : NTSC1024x768 */
-/* 5 : PAL-M 1024x768 */
-/* 6-7: reserved */
-/* cl 0 : YFilter1 */
-/* 1 : YFilter2 */
-/* ch 0 : 301A */
-/* 1 : 301B/302B/301LV/302LV */
-/* Description : */
+/* Output : */
+/* Description : Customized Param. for 301 */
/* --------------------------------------------------------------------- */
-void XGI_GetTVPtrIndex2(unsigned short *tempbx, unsigned char *tempcl,
- unsigned char *tempch, struct vb_device_info *pVBInfo)
+static void XGI_OEM310Setting(unsigned short ModeNo, unsigned short ModeIdIndex,
+ struct vb_device_info *pVBInfo)
{
- *tempbx = 0;
- *tempcl = 0;
- *tempch = 0;
-
- if (pVBInfo->TVInfo & SetPALTV)
- *tempbx = 1;
+ if (pVBInfo->SetFlag & Win9xDOSMode)
+ return;
- if (pVBInfo->TVInfo & SetPALMTV)
- *tempbx = 2;
+ /* GetPart1IO(); */
+ XGI_SetDelayComp(pVBInfo);
- if (pVBInfo->TVInfo & SetPALNTV)
- *tempbx = 3;
+ if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA))
+ XGI_SetLCDCap(pVBInfo);
- if (pVBInfo->TVInfo & NTSC1024x768) {
- *tempbx = 4;
- if (pVBInfo->TVInfo & SetPALMTV)
- *tempbx = 5;
- }
+ if (pVBInfo->VBInfo & SetCRT2ToTV) {
+ /* GetPart2IO() */
+ XGI_SetPhaseIncr(pVBInfo);
+ XGI_SetYFilter(ModeNo, ModeIdIndex, pVBInfo);
+ XGI_SetAntiFlicker(ModeNo, ModeIdIndex, pVBInfo);
- if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
- | VB_XGI302LV | VB_XGI301C)) {
- if ((!(pVBInfo->VBInfo & SetInSlaveMode)) || (pVBInfo->TVInfo
- & TVSimuMode)) {
- *tempbx += 8;
- *tempcl += 1;
- }
+ if (pVBInfo->VBType & VB_XGI301)
+ XGI_SetEdgeEnhance(ModeNo, ModeIdIndex, pVBInfo);
}
-
- if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
- | VB_XGI302LV | VB_XGI301C))
- (*tempch)++;
}
/* --------------------------------------------------------------------- */
@@ -8324,10 +7462,10 @@ void XGI_SetCRT2ModeRegs(unsigned short ModeNo,
unsigned char tempah;
- /* XGINew_SetReg1(pVBInfo->Part1Port, 0x03, 0x00); // fix write part1 index 0 BTDRAM bit Bug */
+ /* xgifb_reg_set(pVBInfo->Part1Port, 0x03, 0x00); // fix write part1 index 0 BTDRAM bit Bug */
tempah = 0;
if (!(pVBInfo->VBInfo & DisableCRT2Display)) {
- tempah = XGINew_GetReg1(pVBInfo->Part1Port, 0x00);
+ tempah = xgifb_reg_get(pVBInfo->Part1Port, 0x00);
tempah &= ~0x10; /* BTRAMDAC */
tempah |= 0x40; /* BTRAM */
@@ -8354,7 +7492,7 @@ void XGI_SetCRT2ModeRegs(unsigned short ModeNo,
tempah = 0;
}
- XGINew_SetReg1(pVBInfo->Part1Port, 0x00, tempah);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x00, tempah);
if (pVBInfo->VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD)) {
tempcl = pVBInfo->ModeType;
if (ModeNo > 0x13) {
@@ -8375,12 +7513,12 @@ void XGI_SetCRT2ModeRegs(unsigned short ModeNo,
}
*/
- XGINew_SetReg1(pVBInfo->Part1Port, 0x00, tempah);
+ xgifb_reg_set(pVBInfo->Part1Port, 0x00, tempah);
tempah = 0x08;
tempbl = 0xf0;
if (pVBInfo->VBInfo & DisableCRT2Display) {
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x2e, tempbl, tempah);
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x2e, tempbl, tempah);
} else {
tempah = 0x00;
tempbl = 0xff;
@@ -8391,7 +7529,7 @@ void XGI_SetCRT2ModeRegs(unsigned short ModeNo,
&& (!(pVBInfo->VBInfo & SetSimuScanMode))) {
tempbl &= 0xf7;
tempah |= 0x01;
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x2e,
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x2e,
tempbl, tempah);
} else {
if (pVBInfo->VBInfo & SetCRT2ToLCDA) {
@@ -8417,15 +7555,15 @@ void XGI_SetCRT2ModeRegs(unsigned short ModeNo,
if (!(pVBInfo->VBInfo
& SetCRT2ToDualEdge))
tempah |= 0x08;
- XGINew_SetRegANDOR(pVBInfo->Part1Port,
+ xgifb_reg_and_or(pVBInfo->Part1Port,
0x2e, tempbl, tempah);
} else {
- XGINew_SetRegANDOR(pVBInfo->Part1Port,
+ xgifb_reg_and_or(pVBInfo->Part1Port,
0x2e, tempbl, tempah);
}
}
} else {
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x2e, tempbl,
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x2e, tempbl,
tempah);
}
}
@@ -8449,7 +7587,7 @@ void XGI_SetCRT2ModeRegs(unsigned short ModeNo,
/* } */
}
- XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x0D, ~0x0BF, tempah);
+ xgifb_reg_and_or(pVBInfo->Part4Port, 0x0D, ~0x0BF, tempah);
tempah = 0;
if (pVBInfo->LCDInfo & SetLCDDualLink)
@@ -8469,7 +7607,7 @@ void XGI_SetCRT2ModeRegs(unsigned short ModeNo,
if (pVBInfo->LCDResInfo == Panel1280x960)
tempah |= 0x80;
- XGINew_SetReg1(pVBInfo->Part4Port, 0x0C, tempah);
+ xgifb_reg_set(pVBInfo->Part4Port, 0x0C, tempah);
}
if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
@@ -8483,7 +7621,7 @@ void XGI_SetCRT2ModeRegs(unsigned short ModeNo,
tempah |= 0x04; /* shampoo 0129 */
}
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x13, tempbl, tempah);
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x13, tempbl, tempah);
tempah = 0x00;
tempbl = 0xcf;
if (!(pVBInfo->VBInfo & DisableCRT2Display)) {
@@ -8491,7 +7629,7 @@ void XGI_SetCRT2ModeRegs(unsigned short ModeNo,
tempah |= 0x30;
}
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x2c, tempbl, tempah);
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x2c, tempbl, tempah);
tempah = 0;
tempbl = 0x3f;
@@ -8499,7 +7637,7 @@ void XGI_SetCRT2ModeRegs(unsigned short ModeNo,
if (pVBInfo->VBInfo & SetCRT2ToDualEdge)
tempah |= 0xc0;
}
- XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x21, tempbl, tempah);
+ xgifb_reg_and_or(pVBInfo->Part4Port, 0x21, tempbl, tempah);
}
tempah = 0;
@@ -8510,17 +7648,17 @@ void XGI_SetCRT2ModeRegs(unsigned short ModeNo,
tempah |= 0x80;
}
- XGINew_SetRegANDOR(pVBInfo->Part4Port, 0x23, tempbl, tempah);
+ xgifb_reg_and_or(pVBInfo->Part4Port, 0x23, tempbl, tempah);
if (pVBInfo->VBType & (VB_XGI302LV | VB_XGI301C)) {
if (pVBInfo->LCDInfo & SetLCDDualLink) {
- XGINew_SetRegOR(pVBInfo->Part4Port, 0x27, 0x20);
- XGINew_SetRegOR(pVBInfo->Part4Port, 0x34, 0x10);
+ xgifb_reg_or(pVBInfo->Part4Port, 0x27, 0x20);
+ xgifb_reg_or(pVBInfo->Part4Port, 0x34, 0x10);
}
}
}
-void XGI_CloseCRTC(struct xgi_hw_device_info *HwDeviceExtension,
+static void XGI_CloseCRTC(struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
{
unsigned short tempbx;
@@ -8539,88 +7677,11 @@ void XGI_OpenCRTC(struct xgi_hw_device_info *HwDeviceExtension,
tempbx = 0;
}
-void XGI_GetRAMDAC2DATA(unsigned short ModeNo, unsigned short ModeIdIndex,
- unsigned short RefreshRateTableIndex,
- struct vb_device_info *pVBInfo)
-{
- unsigned short tempax, tempbx, temp1, temp2, modeflag = 0, tempcx,
- StandTableIndex, CRT1Index;
-
- pVBInfo->RVBHCMAX = 1;
- pVBInfo->RVBHCFACT = 1;
-
- if (ModeNo <= 0x13) {
- modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
- StandTableIndex = XGI_GetModePtr(ModeNo, ModeIdIndex, pVBInfo);
- tempax = pVBInfo->StandTable[StandTableIndex].CRTC[0];
- tempbx = pVBInfo->StandTable[StandTableIndex].CRTC[6];
- temp1 = pVBInfo->StandTable[StandTableIndex].CRTC[7];
- } else {
- modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
- CRT1Index
- = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
- CRT1Index &= IndexMask;
- temp1
- = (unsigned short) pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[0];
- temp2
- = (unsigned short) pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[5];
- tempax = (temp1 & 0xFF) | ((temp2 & 0x03) << 8);
- tempbx
- = (unsigned short) pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[8];
- tempcx
- = (unsigned short) pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[14]
- << 8;
- tempcx &= 0x0100;
- tempcx = tempcx << 2;
- tempbx |= tempcx;
- temp1
- = (unsigned short) pVBInfo->XGINEWUB_CRT1Table[CRT1Index].CR[9];
- }
-
- if (temp1 & 0x01)
- tempbx |= 0x0100;
-
- if (temp1 & 0x20)
- tempbx |= 0x0200;
- tempax += 5;
-
- if (modeflag & Charx8Dot)
- tempax *= 8;
- else
- tempax *= 9;
-
- pVBInfo->VGAHT = tempax;
- pVBInfo->HT = tempax;
- tempbx++;
- pVBInfo->VGAVT = tempbx;
- pVBInfo->VT = tempbx;
-}
-
-unsigned short XGI_GetColorDepth(unsigned short ModeNo,
- unsigned short ModeIdIndex, struct vb_device_info *pVBInfo)
-{
- unsigned short ColorDepth[6] = { 1, 2, 4, 4, 6, 8 };
- short index;
- unsigned short modeflag;
-
- if (ModeNo <= 0x13)
- modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
- else
- modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
-
- index = (modeflag & ModeInfoFlag) - ModeEGA;
-
- if (index < 0)
- index = 0;
-
- return ColorDepth[index];
-}
-
void XGI_UnLockCRT2(struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
{
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x2f, 0xFF, 0x01);
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x2f, 0xFF, 0x01);
}
@@ -8628,36 +7689,8 @@ void XGI_LockCRT2(struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
{
- XGINew_SetRegANDOR(pVBInfo->Part1Port, 0x2F, 0xFE, 0x00);
-
-}
-
-void XGINew_EnableCRT2(struct vb_device_info *pVBInfo)
-{
- XGINew_SetRegANDOR(pVBInfo->P3c4, 0x1E, 0xFF, 0x20);
-}
-
-void XGINew_LCD_Wait_Time(unsigned char DelayTime,
- struct vb_device_info *pVBInfo)
-{
- unsigned short i, j;
-
- unsigned long temp, flag;
-
- flag = 0;
- /* printk("XGINew_LCD_Wait_Time"); */
- /* return; */
- for (i = 0; i < DelayTime; i++) {
- for (j = 0; j < 66; j++) {
- temp = XGINew_GetReg3(0x61);
- /* temp &= 0x10000000; */
- temp &= 0x10;
- if (temp == flag)
- continue;
+ xgifb_reg_and_or(pVBInfo->Part1Port, 0x2F, 0xFE, 0x00);
- flag = temp;
- }
- }
}
unsigned char XGI_BridgeIsOn(struct vb_device_info *pVBInfo)
@@ -8667,7 +7700,7 @@ unsigned char XGI_BridgeIsOn(struct vb_device_info *pVBInfo)
if (pVBInfo->IF_DEF_LVDS == 1) {
return 1;
} else {
- flag = XGINew_GetReg1(pVBInfo->Part4Port, 0x00);
+ flag = xgifb_reg_get(pVBInfo->Part4Port, 0x00);
if ((flag == 1) || (flag == 2))
return 1; /* 301b */
else
@@ -8679,22 +7712,22 @@ void XGI_LongWait(struct vb_device_info *pVBInfo)
{
unsigned short i;
- i = XGINew_GetReg1(pVBInfo->P3c4, 0x1F);
+ i = xgifb_reg_get(pVBInfo->P3c4, 0x1F);
if (!(i & 0xC0)) {
for (i = 0; i < 0xFFFF; i++) {
- if (!(XGINew_GetReg2(pVBInfo->P3da) & 0x08))
+ if (!(inb(pVBInfo->P3da) & 0x08))
break;
}
for (i = 0; i < 0xFFFF; i++) {
- if ((XGINew_GetReg2(pVBInfo->P3da) & 0x08))
+ if ((inb(pVBInfo->P3da) & 0x08))
break;
}
}
}
-void XGI_VBLongWait(struct vb_device_info *pVBInfo)
+static void XGI_VBLongWait(struct vb_device_info *pVBInfo)
{
unsigned short tempal, temp, i, j;
return;
@@ -8702,7 +7735,7 @@ void XGI_VBLongWait(struct vb_device_info *pVBInfo)
temp = 0;
for (i = 0; i < 3; i++) {
for (j = 0; j < 100; j++) {
- tempal = XGINew_GetReg2(pVBInfo->P3da);
+ tempal = inb(pVBInfo->P3da);
if (temp & 0x01) { /* VBWaitMode2 */
if ((tempal & 0x08))
continue;
@@ -8726,188 +7759,717 @@ void XGI_VBLongWait(struct vb_device_info *pVBInfo)
return;
}
-unsigned short XGI_GetVGAHT2(struct vb_device_info *pVBInfo)
+unsigned short XGI_GetRatePtrCRT2(struct xgi_hw_device_info *pXGIHWDE,
+ unsigned short ModeNo, unsigned short ModeIdIndex,
+ struct vb_device_info *pVBInfo)
{
- unsigned long tempax, tempbx;
+ short LCDRefreshIndex[] = { 0x00, 0x00, 0x03, 0x01 },
+ LCDARefreshIndex[] = { 0x00, 0x00, 0x03, 0x01, 0x01,
+ 0x01, 0x01 };
- tempbx = ((pVBInfo->VGAVT - pVBInfo->VGAVDE) * pVBInfo->RVBHCMAX)
- & 0xFFFF;
- tempax = (pVBInfo->VT - pVBInfo->VDE) * pVBInfo->RVBHCFACT;
- tempax = (tempax * pVBInfo->HT) / tempbx;
+ unsigned short RefreshRateTableIndex, i, modeflag, index, temp;
- return (unsigned short) tempax;
+ if (ModeNo <= 0x13)
+ modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
+ else
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+
+ if (pVBInfo->IF_DEF_CH7005 == 1) {
+ if (pVBInfo->VBInfo & SetCRT2ToTV) {
+ if (modeflag & HalfDCLK)
+ return 0;
+ }
+ }
+
+ if (ModeNo < 0x14)
+ return 0xFFFF;
+
+ index = xgifb_reg_get(pVBInfo->P3d4, 0x33);
+ index = index >> pVBInfo->SelectCRT2Rate;
+ index &= 0x0F;
+
+ if (pVBInfo->LCDInfo & LCDNonExpanding)
+ index = 0;
+
+ if (index > 0)
+ index--;
+
+ if (pVBInfo->SetFlag & ProgrammingCRT2) {
+ if (pVBInfo->IF_DEF_CH7005 == 1) {
+ if (pVBInfo->VBInfo & SetCRT2ToTV)
+ index = 0;
+ }
+
+ if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
+ if (pVBInfo->IF_DEF_LVDS == 0) {
+ if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B
+ | VB_XGI301LV | VB_XGI302LV
+ | VB_XGI301C))
+ temp
+ = LCDARefreshIndex[pVBInfo->LCDResInfo
+ & 0x0F]; /* 301b */
+ else
+ temp
+ = LCDRefreshIndex[pVBInfo->LCDResInfo
+ & 0x0F];
+
+ if (index > temp)
+ index = temp;
+ } else {
+ index = 0;
+ }
+ }
+ }
+
+ RefreshRateTableIndex = pVBInfo->EModeIDTable[ModeIdIndex].REFindex;
+ ModeNo = pVBInfo->RefIndex[RefreshRateTableIndex].ModeID;
+ if (pXGIHWDE->jChipType >= XG20) { /* for XG20, XG21, XG27 */
+ /*
+ if (pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag & XG2xNotSupport) {
+ index++;
+ }
+ */
+ if ((pVBInfo->RefIndex[RefreshRateTableIndex].XRes == 800)
+ && (pVBInfo->RefIndex[RefreshRateTableIndex].YRes
+ == 600)) {
+ index++;
+ }
+ /* Alan 10/19/2007; do the similar adjustment like XGISearchCRT1Rate() */
+ if ((pVBInfo->RefIndex[RefreshRateTableIndex].XRes == 1024)
+ && (pVBInfo->RefIndex[RefreshRateTableIndex].YRes
+ == 768)) {
+ index++;
+ }
+ if ((pVBInfo->RefIndex[RefreshRateTableIndex].XRes == 1280)
+ && (pVBInfo->RefIndex[RefreshRateTableIndex].YRes
+ == 1024)) {
+ index++;
+ }
+ }
+
+ i = 0;
+ do {
+ if (pVBInfo->RefIndex[RefreshRateTableIndex + i].ModeID
+ != ModeNo)
+ break;
+ temp
+ = pVBInfo->RefIndex[RefreshRateTableIndex + i].Ext_InfoFlag;
+ temp &= ModeInfoFlag;
+ if (temp < pVBInfo->ModeType)
+ break;
+ i++;
+ index--;
+
+ } while (index != 0xFFFF);
+ if (!(pVBInfo->VBInfo & SetCRT2ToRAMDAC)) {
+ if (pVBInfo->VBInfo & SetInSlaveMode) {
+ temp
+ = pVBInfo->RefIndex[RefreshRateTableIndex
+ + i - 1].Ext_InfoFlag;
+ if (temp & InterlaceMode)
+ i++;
+ }
+ }
+ i--;
+ if ((pVBInfo->SetFlag & ProgrammingCRT2)) {
+ temp = XGI_AjustCRT2Rate(ModeNo, ModeIdIndex,
+ RefreshRateTableIndex, &i, pVBInfo);
+ }
+ return RefreshRateTableIndex + i; /* return (0x01 | (temp1<<1)); */
}
-unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo,
- unsigned short ModeIdIndex,
- unsigned short RefreshRateTableIndex,
+static void XGI_SetLCDAGroup(unsigned short ModeNo, unsigned short ModeIdIndex,
struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
{
- unsigned short tempbx;
+ unsigned short RefreshRateTableIndex;
+ /* unsigned short temp ; */
- unsigned short LCDXlat1VCLK[4] = { VCLK65 + 2, VCLK65 + 2, VCLK65 + 2,
- VCLK65 + 2 };
- unsigned short LCDXlat2VCLK[4] = { VCLK108_2 + 5, VCLK108_2 + 5,
- VCLK108_2 + 5, VCLK108_2 + 5 };
- unsigned short LVDSXlat1VCLK[4] = { VCLK40, VCLK40, VCLK40, VCLK40 };
- unsigned short LVDSXlat2VCLK[4] = { VCLK65 + 2, VCLK65 + 2, VCLK65 + 2,
- VCLK65 + 2 };
- unsigned short LVDSXlat3VCLK[4] = { VCLK65 + 2, VCLK65 + 2, VCLK65 + 2,
- VCLK65 + 2 };
+ /* pVBInfo->SelectCRT2Rate = 0; */
- unsigned short CRT2Index, VCLKIndex;
- unsigned short modeflag, resinfo;
- unsigned char *CHTVVCLKPtr = NULL;
+ pVBInfo->SetFlag |= ProgrammingCRT2;
+ RefreshRateTableIndex = XGI_GetRatePtrCRT2(HwDeviceExtension, ModeNo,
+ ModeIdIndex, pVBInfo);
+ XGI_GetLVDSResInfo(ModeNo, ModeIdIndex, pVBInfo);
+ XGI_GetLVDSData(ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo);
+ XGI_ModCRT1Regs(ModeNo, ModeIdIndex, RefreshRateTableIndex,
+ HwDeviceExtension, pVBInfo);
+ XGI_SetLVDSRegs(ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo);
+ XGI_SetCRT2ECLK(ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo);
+}
- if (ModeNo <= 0x13) {
- modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */
- resinfo = pVBInfo->SModeIDTable[ModeIdIndex].St_ResInfo;
- CRT2Index = pVBInfo->SModeIDTable[ModeIdIndex].St_CRT2CRTC;
- } else {
- modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */
- resinfo = pVBInfo->EModeIDTable[ModeIdIndex].Ext_RESINFO;
- CRT2Index
- = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
- }
+unsigned char XGI_SetCRT2Group301(unsigned short ModeNo,
+ struct xgi_hw_device_info *HwDeviceExtension,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short tempbx, ModeIdIndex, RefreshRateTableIndex;
- if (pVBInfo->IF_DEF_LVDS == 0) {
- CRT2Index = CRT2Index >> 6; /* for LCD */
- if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { /*301b*/
- if (pVBInfo->LCDResInfo != Panel1024x768)
- VCLKIndex = LCDXlat2VCLK[CRT2Index];
- else
- VCLKIndex = LCDXlat1VCLK[CRT2Index];
- } else { /* for TV */
- if (pVBInfo->VBInfo & SetCRT2ToTV) {
- if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) {
- if (pVBInfo->SetFlag & RPLLDIV2XO) {
- VCLKIndex = HiTVVCLKDIV2;
+ tempbx = pVBInfo->VBInfo;
+ pVBInfo->SetFlag |= ProgrammingCRT2;
+ XGI_SearchModeID(ModeNo, &ModeIdIndex, pVBInfo);
+ pVBInfo->SelectCRT2Rate = 4;
+ RefreshRateTableIndex = XGI_GetRatePtrCRT2(HwDeviceExtension, ModeNo,
+ ModeIdIndex, pVBInfo);
+ XGI_SaveCRT2Info(ModeNo, pVBInfo);
+ XGI_GetCRT2ResInfo(ModeNo, ModeIdIndex, pVBInfo);
+ XGI_GetCRT2Data(ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo);
+ XGI_PreSetGroup1(ModeNo, ModeIdIndex, HwDeviceExtension,
+ RefreshRateTableIndex, pVBInfo);
+ XGI_SetGroup1(ModeNo, ModeIdIndex, HwDeviceExtension,
+ RefreshRateTableIndex, pVBInfo);
+ XGI_SetLockRegs(ModeNo, ModeIdIndex, HwDeviceExtension,
+ RefreshRateTableIndex, pVBInfo);
+ XGI_SetGroup2(ModeNo, ModeIdIndex, RefreshRateTableIndex,
+ HwDeviceExtension, pVBInfo);
+ XGI_SetLCDRegs(ModeNo, ModeIdIndex, HwDeviceExtension,
+ RefreshRateTableIndex, pVBInfo);
+ XGI_SetTap4Regs(pVBInfo);
+ XGI_SetGroup3(ModeNo, ModeIdIndex, pVBInfo);
+ XGI_SetGroup4(ModeNo, ModeIdIndex, RefreshRateTableIndex,
+ HwDeviceExtension, pVBInfo);
+ XGI_SetCRT2VCLK(ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo);
+ XGI_SetGroup5(ModeNo, ModeIdIndex, pVBInfo);
+ XGI_AutoThreshold(pVBInfo);
+ return 1;
+}
- VCLKIndex += 25;
+void XGI_SenseCRT1(struct vb_device_info *pVBInfo)
+{
+ unsigned char CRTCData[17] = { 0x5F, 0x4F, 0x50, 0x82, 0x55, 0x81,
+ 0x0B, 0x3E, 0xE9, 0x0B, 0xDF, 0xE7, 0x04, 0x00, 0x00,
+ 0x05, 0x00 };
- } else {
- VCLKIndex = HiTVVCLK;
+ unsigned char SR01 = 0, SR1F = 0, SR07 = 0, SR06 = 0;
- VCLKIndex += 25;
+ unsigned char CR17, CR63, SR31;
+ unsigned short temp;
+ unsigned char DAC_TEST_PARMS[3] = { 0x0F, 0x0F, 0x0F };
- }
+ int i;
+ xgifb_reg_set(pVBInfo->P3c4, 0x05, 0x86);
- if (pVBInfo->SetFlag & TVSimuMode) {
- if (modeflag & Charx8Dot) {
- VCLKIndex
- = HiTVSimuVCLK;
+ /* [2004/05/06] Vicent to fix XG42 single LCD sense to CRT+LCD */
+ xgifb_reg_set(pVBInfo->P3d4, 0x57, 0x4A);
+ xgifb_reg_set(pVBInfo->P3d4, 0x53, (unsigned char) (xgifb_reg_get(
+ pVBInfo->P3d4, 0x53) | 0x02));
- VCLKIndex += 25;
+ SR31 = (unsigned char) xgifb_reg_get(pVBInfo->P3c4, 0x31);
+ CR63 = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x63);
+ SR01 = (unsigned char) xgifb_reg_get(pVBInfo->P3c4, 0x01);
- } else {
- VCLKIndex
- = HiTVTextVCLK;
+ xgifb_reg_set(pVBInfo->P3c4, 0x01, (unsigned char) (SR01 & 0xDF));
+ xgifb_reg_set(pVBInfo->P3d4, 0x63, (unsigned char) (CR63 & 0xBF));
- VCLKIndex += 25;
+ CR17 = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x17);
+ xgifb_reg_set(pVBInfo->P3d4, 0x17, (unsigned char) (CR17 | 0x80));
- }
- }
+ SR1F = (unsigned char) xgifb_reg_get(pVBInfo->P3c4, 0x1F);
+ xgifb_reg_set(pVBInfo->P3c4, 0x1F, (unsigned char) (SR1F | 0x04));
- if (pVBInfo->VBType & VB_XGI301LV) { /* 301lv */
- if (!(pVBInfo->VBExtInfo
- == VB_YPbPr1080i)) {
- VCLKIndex
- = YPbPr750pVCLK;
- if (!(pVBInfo->VBExtInfo
- == VB_YPbPr750p)) {
- VCLKIndex
- = YPbPr525pVCLK;
- if (!(pVBInfo->VBExtInfo
- == VB_YPbPr525p)) {
- VCLKIndex
- = YPbPr525iVCLK_2;
- if (!(pVBInfo->SetFlag
- & RPLLDIV2XO))
- VCLKIndex
- = YPbPr525iVCLK;
- }
- }
- }
- }
- } else {
- if (pVBInfo->VBInfo & SetCRT2ToTV) {
- if (pVBInfo->SetFlag
- & RPLLDIV2XO) {
- VCLKIndex = TVVCLKDIV2;
+ SR07 = (unsigned char) xgifb_reg_get(pVBInfo->P3c4, 0x07);
+ xgifb_reg_set(pVBInfo->P3c4, 0x07, (unsigned char) (SR07 & 0xFB));
+ SR06 = (unsigned char) xgifb_reg_get(pVBInfo->P3c4, 0x06);
+ xgifb_reg_set(pVBInfo->P3c4, 0x06, (unsigned char) (SR06 & 0xC3));
- VCLKIndex += 25;
+ xgifb_reg_set(pVBInfo->P3d4, 0x11, 0x00);
- } else {
- VCLKIndex = TVVCLK;
+ for (i = 0; i < 8; i++)
+ xgifb_reg_set(pVBInfo->P3d4, (unsigned short) i, CRTCData[i]);
- VCLKIndex += 25;
+ for (i = 8; i < 11; i++)
+ xgifb_reg_set(pVBInfo->P3d4, (unsigned short) (i + 8),
+ CRTCData[i]);
- }
- }
+ for (i = 11; i < 13; i++)
+ xgifb_reg_set(pVBInfo->P3d4, (unsigned short) (i + 4),
+ CRTCData[i]);
+
+ for (i = 13; i < 16; i++)
+ xgifb_reg_set(pVBInfo->P3c4, (unsigned short) (i - 3),
+ CRTCData[i]);
+
+ xgifb_reg_set(pVBInfo->P3c4, 0x0E, (unsigned char) (CRTCData[16]
+ & 0xE0));
+
+ xgifb_reg_set(pVBInfo->P3c4, 0x31, 0x00);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2B, 0x1B);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2C, 0xE1);
+
+ outb(0x00, pVBInfo->P3c8);
+
+ for (i = 0; i < 256; i++) {
+ outb((unsigned char) DAC_TEST_PARMS[0], (pVBInfo->P3c8 + 1));
+ outb((unsigned char) DAC_TEST_PARMS[1], (pVBInfo->P3c8 + 1));
+ outb((unsigned char) DAC_TEST_PARMS[2], (pVBInfo->P3c8 + 1));
+ }
+
+ XGI_VBLongWait(pVBInfo);
+ XGI_VBLongWait(pVBInfo);
+ XGI_VBLongWait(pVBInfo);
+
+ mdelay(1);
+
+ XGI_WaitDisply(pVBInfo);
+ temp = inb(pVBInfo->P3c2);
+
+ if (temp & 0x10)
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x32, 0xDF, 0x20);
+ else
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x32, 0xDF, 0x00);
+
+ /* alan, avoid display something, set BLACK DAC if not restore DAC */
+ outb(0x00, pVBInfo->P3c8);
+
+ for (i = 0; i < 256; i++) {
+ outb(0, (pVBInfo->P3c8 + 1));
+ outb(0, (pVBInfo->P3c8 + 1));
+ outb(0, (pVBInfo->P3c8 + 1));
+ }
+
+ xgifb_reg_set(pVBInfo->P3c4, 0x01, SR01);
+ xgifb_reg_set(pVBInfo->P3d4, 0x63, CR63);
+ xgifb_reg_set(pVBInfo->P3c4, 0x31, SR31);
+
+ /* [2004/05/11] Vicent */
+ xgifb_reg_set(pVBInfo->P3d4, 0x53, (unsigned char) (xgifb_reg_get(
+ pVBInfo->P3d4, 0x53) & 0xFD));
+ xgifb_reg_set(pVBInfo->P3c4, 0x1F, (unsigned char) SR1F);
+}
+
+void XGI_EnableBridge(struct xgi_hw_device_info *HwDeviceExtension,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short tempah;
+
+ if (pVBInfo->SetFlag == Win9xDOSMode) {
+ if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
+ | VB_XGI302LV | VB_XGI301C)) {
+ XGI_DisplayOn(HwDeviceExtension, pVBInfo);
+ return;
+ } else
+ /* LVDS or CH7017 */
+ return;
+ }
+
+ if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
+ | VB_XGI302LV | VB_XGI301C)) {
+ if (!(pVBInfo->SetFlag & DisableChA)) {
+ if (pVBInfo->SetFlag & EnableChA) {
+ xgifb_reg_set(pVBInfo->Part1Port, 0x1E, 0x20); /* Power on */
+ } else {
+ if (pVBInfo->VBInfo & SetCRT2ToDualEdge) { /* SetCRT2ToLCDA ) */
+ xgifb_reg_set(pVBInfo->Part1Port,
+ 0x1E, 0x20); /* Power on */
}
- } else { /* for CRT2 */
- VCLKIndex = (unsigned char) XGINew_GetReg2(
- (pVBInfo->P3ca + 0x02)); /* Port 3cch */
- VCLKIndex = ((VCLKIndex >> 2) & 0x03);
- if (ModeNo > 0x13) {
- VCLKIndex
- = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; /* di+Ext_CRTVCLK */
- VCLKIndex &= IndexMask;
+ }
+ }
+
+ if (!(pVBInfo->SetFlag & DisableChB)) {
+ if ((pVBInfo->SetFlag & EnableChB) || (pVBInfo->VBInfo
+ & (SetCRT2ToLCD | SetCRT2ToTV
+ | SetCRT2ToRAMDAC))) {
+ tempah = (unsigned char) xgifb_reg_get(
+ pVBInfo->P3c4, 0x32);
+ tempah &= 0xDF;
+ if (pVBInfo->VBInfo & SetInSlaveMode) {
+ if (!(pVBInfo->VBInfo & SetCRT2ToRAMDAC))
+ tempah |= 0x20;
}
+ xgifb_reg_set(pVBInfo->P3c4, 0x32, tempah);
+ xgifb_reg_or(pVBInfo->P3c4, 0x1E, 0x20);
+
+ tempah = (unsigned char) xgifb_reg_get(
+ pVBInfo->Part1Port, 0x2E);
+
+ if (!(tempah & 0x80))
+ xgifb_reg_or(pVBInfo->Part1Port,
+ 0x2E, 0x80); /* BVBDOENABLE = 1 */
+
+ xgifb_reg_and(pVBInfo->Part1Port, 0x00, 0x7F); /* BScreenOFF = 0 */
}
}
- } else { /* LVDS */
- if (ModeNo <= 0x13)
- VCLKIndex = CRT2Index;
- else
- VCLKIndex = CRT2Index;
- if (pVBInfo->IF_DEF_CH7005 == 1) {
- if (!(pVBInfo->VBInfo & SetCRT2ToLCD)) {
- VCLKIndex &= 0x1f;
- tempbx = 0;
+ if ((pVBInfo->SetFlag & (EnableChA | EnableChB))
+ || (!(pVBInfo->VBInfo & DisableCRT2Display))) {
+ xgifb_reg_and_or(pVBInfo->Part2Port, 0x00, ~0xE0,
+ 0x20); /* shampoo 0129 */
+ if (pVBInfo->VBType & (VB_XGI302LV | VB_XGI301C)) {
+ if (!XGI_DisableChISLCD(pVBInfo)) {
+ if (XGI_EnableChISLCD(pVBInfo)
+ || (pVBInfo->VBInfo
+ & (SetCRT2ToLCD
+ | SetCRT2ToLCDA)))
+ xgifb_reg_and(
+ pVBInfo->Part4Port,
+ 0x2A, 0x7F); /* LVDS PLL power on */
+ }
+ xgifb_reg_and(pVBInfo->Part4Port, 0x30, 0x7F); /* LVDS Driver power on */
+ }
+ }
- if (pVBInfo->VBInfo & SetPALTV)
- tempbx += 2;
+ tempah = 0x00;
- if (pVBInfo->VBInfo & SetCHTVOverScan)
- tempbx += 1;
+ if (!(pVBInfo->VBInfo & DisableCRT2Display)) {
+ tempah = 0xc0;
- switch (tempbx) {
- case 0:
- CHTVVCLKPtr = pVBInfo->CHTVVCLKUNTSC;
- break;
- case 1:
- CHTVVCLKPtr = pVBInfo->CHTVVCLKONTSC;
- break;
- case 2:
- CHTVVCLKPtr = pVBInfo->CHTVVCLKUPAL;
- break;
- case 3:
- CHTVVCLKPtr = pVBInfo->CHTVVCLKOPAL;
- break;
- default:
- break;
+ if (!(pVBInfo->VBInfo & SetSimuScanMode)) {
+ if (pVBInfo->VBInfo & SetCRT2ToLCDA) {
+ if (pVBInfo->VBInfo & SetCRT2ToDualEdge) {
+ tempah = tempah & 0x40;
+ if (pVBInfo->VBInfo
+ & SetCRT2ToLCDA)
+ tempah = tempah ^ 0xC0;
+
+ if (pVBInfo->SetFlag
+ & DisableChB)
+ tempah &= 0xBF;
+
+ if (pVBInfo->SetFlag
+ & DisableChA)
+ tempah &= 0x7F;
+
+ if (pVBInfo->SetFlag
+ & EnableChB)
+ tempah |= 0x40;
+
+ if (pVBInfo->SetFlag
+ & EnableChA)
+ tempah |= 0x80;
+ }
}
+ }
+ }
- VCLKIndex = CHTVVCLKPtr[VCLKIndex];
+ xgifb_reg_or(pVBInfo->Part4Port, 0x1F, tempah); /* EnablePart4_1F */
+
+ if (pVBInfo->SetFlag & Win9xDOSMode) {
+ XGI_DisplayOn(HwDeviceExtension, pVBInfo);
+ return;
+ }
+
+ if (!(pVBInfo->SetFlag & DisableChA)) {
+ XGI_VBLongWait(pVBInfo);
+ if (!(pVBInfo->SetFlag & GatingCRT)) {
+ XGI_DisableGatingCRT(HwDeviceExtension, pVBInfo);
+ XGI_DisplayOn(HwDeviceExtension, pVBInfo);
+ XGI_VBLongWait(pVBInfo);
}
- } else {
- VCLKIndex = VCLKIndex >> 6;
- if ((pVBInfo->LCDResInfo == Panel800x600)
- || (pVBInfo->LCDResInfo == Panel320x480))
- VCLKIndex = LVDSXlat1VCLK[VCLKIndex];
- else if ((pVBInfo->LCDResInfo == Panel1024x768)
- || (pVBInfo->LCDResInfo
- == Panel1024x768x75))
- VCLKIndex = LVDSXlat2VCLK[VCLKIndex];
+ }
+ } /* 301 */
+ else { /* LVDS */
+ if (pVBInfo->VBInfo & (SetCRT2ToTV | SetCRT2ToLCD
+ | SetCRT2ToLCDA))
+ xgifb_reg_or(pVBInfo->Part1Port, 0x1E, 0x20); /* enable CRT2 */
+
+ tempah = (unsigned char) xgifb_reg_get(pVBInfo->Part1Port,
+ 0x2E);
+ if (!(tempah & 0x80))
+ xgifb_reg_or(pVBInfo->Part1Port, 0x2E, 0x80); /* BVBDOENABLE = 1 */
+
+ xgifb_reg_and(pVBInfo->Part1Port, 0x00, 0x7F);
+ XGI_DisplayOn(HwDeviceExtension, pVBInfo);
+ } /* End of VB */
+}
+
+static void XGI_SetCRT1Group(struct xgi_hw_device_info *HwDeviceExtension,
+ unsigned short ModeNo, unsigned short ModeIdIndex,
+ struct vb_device_info *pVBInfo)
+{
+ unsigned short StandTableIndex, RefreshRateTableIndex, b3CC, temp;
+
+ unsigned short XGINew_P3cc = pVBInfo->P3cc;
+
+ /* XGINew_CRT1Mode = ModeNo; // SaveModeID */
+ StandTableIndex = XGI_GetModePtr(ModeNo, ModeIdIndex, pVBInfo);
+ /* XGI_SetBIOSData(ModeNo, ModeIdIndex); */
+ /* XGI_ClearBankRegs(ModeNo, ModeIdIndex); */
+ XGI_SetSeqRegs(ModeNo, StandTableIndex, ModeIdIndex, pVBInfo);
+ XGI_SetMiscRegs(StandTableIndex, pVBInfo);
+ XGI_SetCRTCRegs(HwDeviceExtension, StandTableIndex, pVBInfo);
+ XGI_SetATTRegs(ModeNo, StandTableIndex, ModeIdIndex, pVBInfo);
+ XGI_SetGRCRegs(StandTableIndex, pVBInfo);
+ XGI_ClearExt1Regs(pVBInfo);
+
+ /* if (pVBInfo->IF_DEF_ExpLink) */
+ if (HwDeviceExtension->jChipType == XG27) {
+ if (pVBInfo->IF_DEF_LVDS == 0)
+ XGI_SetDefaultVCLK(pVBInfo);
+ }
+
+ temp = ~ProgrammingCRT2;
+ pVBInfo->SetFlag &= temp;
+ pVBInfo->SelectCRT2Rate = 0;
+
+ if (pVBInfo->VBType & (VB_XGI301B | VB_XGI302B | VB_XGI301LV
+ | VB_XGI302LV | VB_XGI301C)) {
+ if (pVBInfo->VBInfo & (SetSimuScanMode | SetCRT2ToLCDA
+ | SetInSlaveMode)) {
+ pVBInfo->SetFlag |= ProgrammingCRT2;
+ }
+ }
+
+ RefreshRateTableIndex = XGI_GetRatePtrCRT2(HwDeviceExtension, ModeNo,
+ ModeIdIndex, pVBInfo);
+ if (RefreshRateTableIndex != 0xFFFF) {
+ XGI_SetSync(RefreshRateTableIndex, pVBInfo);
+ XGI_SetCRT1CRTC(ModeNo, ModeIdIndex, RefreshRateTableIndex,
+ pVBInfo, HwDeviceExtension);
+ XGI_SetCRT1DE(HwDeviceExtension, ModeNo, ModeIdIndex,
+ RefreshRateTableIndex, pVBInfo);
+ XGI_SetCRT1Offset(ModeNo, ModeIdIndex, RefreshRateTableIndex,
+ HwDeviceExtension, pVBInfo);
+ XGI_SetCRT1VCLK(ModeNo, ModeIdIndex, HwDeviceExtension,
+ RefreshRateTableIndex, pVBInfo);
+ }
+
+ if ((HwDeviceExtension->jChipType >= XG20)
+ && (HwDeviceExtension->jChipType < XG27)) { /* fix H/W DCLK/2 bug */
+ if ((ModeNo == 0x00) | (ModeNo == 0x01)) {
+ xgifb_reg_set(pVBInfo->P3c4, 0x2B, 0x4E);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2C, 0xE9);
+ b3CC = (unsigned char) inb(XGINew_P3cc);
+ outb((b3CC |= 0x0C), XGINew_P3cc);
+ } else if ((ModeNo == 0x04) | (ModeNo == 0x05) | (ModeNo
+ == 0x0D)) {
+ xgifb_reg_set(pVBInfo->P3c4, 0x2B, 0x1B);
+ xgifb_reg_set(pVBInfo->P3c4, 0x2C, 0xE3);
+ b3CC = (unsigned char) inb(XGINew_P3cc);
+ outb((b3CC |= 0x0C), XGINew_P3cc);
+ }
+ }
+
+ if (HwDeviceExtension->jChipType >= XG21) {
+ temp = xgifb_reg_get(pVBInfo->P3d4, 0x38);
+ if (temp & 0xA0) {
+
+ /* xgifb_reg_and(pVBInfo->P3d4, 0x4A, ~0x20); *//* Enable write GPIOF */
+ /* xgifb_reg_and(pVBInfo->P3d4, 0x48, ~0x20); *//* P. DWN */
+ /* XG21 CRT1 Timing */
+ if (HwDeviceExtension->jChipType == XG27)
+ XGI_SetXG27CRTC(ModeNo, ModeIdIndex,
+ RefreshRateTableIndex, pVBInfo);
else
- VCLKIndex = LVDSXlat3VCLK[VCLKIndex];
+ XGI_SetXG21CRTC(ModeNo, ModeIdIndex,
+ RefreshRateTableIndex, pVBInfo);
+
+ XGI_UpdateXG21CRTC(ModeNo, pVBInfo,
+ RefreshRateTableIndex);
+
+ if (HwDeviceExtension->jChipType == XG27)
+ XGI_SetXG27LCD(pVBInfo, RefreshRateTableIndex,
+ ModeNo);
+ else
+ XGI_SetXG21LCD(pVBInfo, RefreshRateTableIndex,
+ ModeNo);
+
+ if (pVBInfo->IF_DEF_LVDS == 1) {
+ if (HwDeviceExtension->jChipType == XG27)
+ XGI_SetXG27LVDSPara(ModeNo,
+ ModeIdIndex, pVBInfo);
+ else
+ XGI_SetXG21LVDSPara(ModeNo,
+ ModeIdIndex, pVBInfo);
+ }
+ /* xgifb_reg_or(pVBInfo->P3d4, 0x48, 0x20); *//* P. ON */
}
}
- /* VCLKIndex = VCLKIndex&IndexMask; */
- return VCLKIndex;
+ pVBInfo->SetFlag &= (~ProgrammingCRT2);
+ XGI_SetCRT1FIFO(ModeNo, HwDeviceExtension, pVBInfo);
+ XGI_SetCRT1ModeRegs(HwDeviceExtension, ModeNo, ModeIdIndex,
+ RefreshRateTableIndex, pVBInfo);
+
+ /* XGI_LoadCharacter(); //dif ifdef TVFont */
+
+ XGI_LoadDAC(ModeNo, ModeIdIndex, pVBInfo);
+ /* XGI_ClearBuffer(HwDeviceExtension, ModeNo, pVBInfo); */
}
+unsigned char XGISetModeNew(struct xgi_hw_device_info *HwDeviceExtension,
+ unsigned short ModeNo)
+{
+ unsigned short ModeIdIndex;
+ /* unsigned char *pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress; */
+ struct vb_device_info VBINF;
+ struct vb_device_info *pVBInfo = &VBINF;
+ pVBInfo->ROMAddr = HwDeviceExtension->pjVirtualRomBase;
+ pVBInfo->BaseAddr = (unsigned long) HwDeviceExtension->pjIOAddress;
+ pVBInfo->IF_DEF_LVDS = 0;
+ pVBInfo->IF_DEF_CH7005 = 0;
+ pVBInfo->IF_DEF_LCDA = 1;
+ pVBInfo->IF_DEF_CH7017 = 0;
+ pVBInfo->IF_DEF_CH7007 = 0; /* [Billy] 2007/05/14 */
+ pVBInfo->IF_DEF_VideoCapture = 0;
+ pVBInfo->IF_DEF_ScaleLCD = 0;
+ pVBInfo->IF_DEF_OEMUtil = 0;
+ pVBInfo->IF_DEF_PWD = 0;
+
+ if (HwDeviceExtension->jChipType >= XG20) { /* kuku 2004/06/25 */
+ pVBInfo->IF_DEF_YPbPr = 0;
+ pVBInfo->IF_DEF_HiVision = 0;
+ pVBInfo->IF_DEF_CRT2Monitor = 0;
+ pVBInfo->VBType = 0; /*set VBType default 0*/
+ } else {
+ pVBInfo->IF_DEF_YPbPr = 1;
+ pVBInfo->IF_DEF_HiVision = 1;
+ pVBInfo->IF_DEF_CRT2Monitor = 1;
+ }
+
+ pVBInfo->P3c4 = pVBInfo->BaseAddr + 0x14;
+ pVBInfo->P3d4 = pVBInfo->BaseAddr + 0x24;
+ pVBInfo->P3c0 = pVBInfo->BaseAddr + 0x10;
+ pVBInfo->P3ce = pVBInfo->BaseAddr + 0x1e;
+ pVBInfo->P3c2 = pVBInfo->BaseAddr + 0x12;
+ pVBInfo->P3cc = pVBInfo->BaseAddr + 0x1C;
+ pVBInfo->P3ca = pVBInfo->BaseAddr + 0x1a;
+ pVBInfo->P3c6 = pVBInfo->BaseAddr + 0x16;
+ pVBInfo->P3c7 = pVBInfo->BaseAddr + 0x17;
+ pVBInfo->P3c8 = pVBInfo->BaseAddr + 0x18;
+ pVBInfo->P3c9 = pVBInfo->BaseAddr + 0x19;
+ pVBInfo->P3da = pVBInfo->BaseAddr + 0x2A;
+ pVBInfo->Part0Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_00;
+ pVBInfo->Part1Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_04;
+ pVBInfo->Part2Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_10;
+ pVBInfo->Part3Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_12;
+ pVBInfo->Part4Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14;
+ pVBInfo->Part5Port = pVBInfo->BaseAddr + XGI_CRT2_PORT_14 + 2;
+
+ if (HwDeviceExtension->jChipType == XG21) { /* for x86 Linux, XG21 LVDS */
+ if ((xgifb_reg_get(pVBInfo->P3d4, 0x38) & 0xE0) == 0xC0)
+ pVBInfo->IF_DEF_LVDS = 1;
+ }
+ if (HwDeviceExtension->jChipType == XG27) {
+ if ((xgifb_reg_get(pVBInfo->P3d4, 0x38) & 0xE0) == 0xC0) {
+ if (xgifb_reg_get(pVBInfo->P3d4, 0x30) & 0x20)
+ pVBInfo->IF_DEF_LVDS = 1;
+ }
+ }
+
+ if (HwDeviceExtension->jChipType < XG20) /* kuku 2004/06/25 */
+ XGI_GetVBType(pVBInfo);
+
+ InitTo330Pointer(HwDeviceExtension->jChipType, pVBInfo);
+ if (ModeNo & 0x80) {
+ ModeNo = ModeNo & 0x7F;
+ /* XGINew_flag_clearbuffer = 0; */
+ }
+ /* else {
+ XGINew_flag_clearbuffer = 1;
+ }
+ */
+ xgifb_reg_set(pVBInfo->P3c4, 0x05, 0x86);
+
+ if (HwDeviceExtension->jChipType < XG20) /* kuku 2004/06/25 1.Openkey */
+ XGI_UnLockCRT2(HwDeviceExtension, pVBInfo);
+
+ XGI_SearchModeID(ModeNo, &ModeIdIndex, pVBInfo);
+
+ XGI_GetVGAType(HwDeviceExtension, pVBInfo);
+
+ if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */
+ XGI_GetVBInfo(ModeNo, ModeIdIndex, HwDeviceExtension, pVBInfo);
+ XGI_GetTVInfo(ModeNo, ModeIdIndex, pVBInfo);
+ XGI_GetLCDInfo(ModeNo, ModeIdIndex, pVBInfo);
+ XGI_DisableBridge(HwDeviceExtension, pVBInfo);
+ /* XGI_OpenCRTC(HwDeviceExtension, pVBInfo); */
+
+ if (pVBInfo->VBInfo & (SetSimuScanMode | SetCRT2ToLCDA)) {
+ XGI_SetCRT1Group(HwDeviceExtension, ModeNo,
+ ModeIdIndex, pVBInfo);
+
+ if (pVBInfo->VBInfo & SetCRT2ToLCDA) {
+ XGI_SetLCDAGroup(ModeNo, ModeIdIndex,
+ HwDeviceExtension, pVBInfo);
+ }
+ } else {
+ if (!(pVBInfo->VBInfo & SwitchToCRT2)) {
+ XGI_SetCRT1Group(HwDeviceExtension, ModeNo,
+ ModeIdIndex, pVBInfo);
+ if (pVBInfo->VBInfo & SetCRT2ToLCDA) {
+ XGI_SetLCDAGroup(ModeNo, ModeIdIndex,
+ HwDeviceExtension,
+ pVBInfo);
+ }
+ }
+ }
+
+ if (pVBInfo->VBInfo & (SetSimuScanMode | SwitchToCRT2)) {
+ switch (HwDeviceExtension->ujVBChipID) {
+ case VB_CHIP_301:
+ XGI_SetCRT2Group301(ModeNo, HwDeviceExtension,
+ pVBInfo); /*add for CRT2 */
+ break;
+
+ case VB_CHIP_302:
+ XGI_SetCRT2Group301(ModeNo, HwDeviceExtension,
+ pVBInfo); /*add for CRT2 */
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ XGI_SetCRT2ModeRegs(ModeNo, HwDeviceExtension, pVBInfo);
+ XGI_OEM310Setting(ModeNo, ModeIdIndex, pVBInfo); /*0212*/
+ XGI_CloseCRTC(HwDeviceExtension, pVBInfo);
+ XGI_EnableBridge(HwDeviceExtension, pVBInfo);
+ } /* !XG20 */
+ else {
+ if (pVBInfo->IF_DEF_LVDS == 1)
+ if (!XGI_XG21CheckLVDSMode(ModeNo, ModeIdIndex, pVBInfo))
+ return 0;
+
+ if (ModeNo <= 0x13) {
+ pVBInfo->ModeType
+ = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag
+ & ModeInfoFlag;
+ } else {
+ pVBInfo->ModeType
+ = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag
+ & ModeInfoFlag;
+ }
+
+ pVBInfo->SetFlag = 0;
+ if (pVBInfo->IF_DEF_CH7007 != 1)
+ pVBInfo->VBInfo = DisableCRT2Display;
+
+ XGI_DisplayOff(HwDeviceExtension, pVBInfo);
+
+ XGI_SetCRT1Group(HwDeviceExtension, ModeNo, ModeIdIndex,
+ pVBInfo);
+
+ XGI_DisplayOn(HwDeviceExtension, pVBInfo);
+ /*
+ if (HwDeviceExtension->jChipType == XG21)
+ xgifb_reg_and_or(pVBInfo->P3c4, 0x09, ~0x80, 0x80);
+ */
+ }
+
+ /*
+ if (ModeNo <= 0x13) {
+ modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
+ } else {
+ modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ }
+ pVBInfo->ModeType = modeflag&ModeInfoFlag;
+ pVBInfo->SetFlag = 0x00;
+ pVBInfo->VBInfo = DisableCRT2Display;
+ temp = XGINew_CheckMemorySize(HwDeviceExtension, ModeNo, ModeIdIndex, pVBInfo);
+
+ if (temp == 0)
+ return (0);
+
+ XGI_DisplayOff(HwDeviceExtension, pVBInfo) ;
+ XGI_SetCRT1Group(HwDeviceExtension, ModeNo, ModeIdIndex, pVBInfo);
+ XGI_DisplayOn(HwDeviceExtension, pVBInfo);
+ */
+
+ XGI_UpdateModeInfo(HwDeviceExtension, pVBInfo);
+
+ if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */
+ XGI_LockCRT2(HwDeviceExtension, pVBInfo);
+ }
+
+ return 1;
+}