1027
1006
xgifb_reg_set(pVBInfo->P3d4, 0x47, *pVBInfo->pCR47);
1030
Temp = xgifb_reg_get(pVBInfo->P3d4, 0x37);
1033
xgifb_reg_or(pVBInfo->P3c4, 0x06, 0x40); /* 18 bits FP */
1034
xgifb_reg_or(pVBInfo->P3c4, 0x09, 0x40);
1037
xgifb_reg_or(pVBInfo->P3c4, 0x1E, 0x01); /* Negative blank polarity */
1039
xgifb_reg_and(pVBInfo->P3c4, 0x30, ~0x20);
1040
xgifb_reg_and(pVBInfo->P3c4, 0x35, ~0x80);
1042
if (ModeNo <= 0x13) {
1043
b3CC = (unsigned char) inb(XGI_P3cc);
1045
/* Hsync polarity */
1046
xgifb_reg_or(pVBInfo->P3c4, 0x30, 0x20);
1048
/* Vsync polarity */
1049
xgifb_reg_or(pVBInfo->P3c4, 0x35, 0x80);
1009
if (chip_id == XG27) {
1010
XGI_SetXG27FPBits(pVBInfo);
1051
Data = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_InfoFlag;
1053
/* Hsync polarity */
1054
xgifb_reg_or(pVBInfo->P3c4, 0x30, 0x20);
1056
/* Vsync polarity */
1057
xgifb_reg_or(pVBInfo->P3c4, 0x35, 0x80);
1061
static void XGI_SetXG27LCD(struct vb_device_info *pVBInfo,
1062
unsigned short RefreshRateTableIndex,
1063
unsigned short ModeNo)
1065
unsigned short Data, Temp, b3CC;
1066
unsigned short XGI_P3cc;
1068
XGI_P3cc = pVBInfo->P3cc;
1070
xgifb_reg_set(pVBInfo->P3d4, 0x2E, 0x00);
1071
xgifb_reg_set(pVBInfo->P3d4, 0x2F, 0x00);
1072
xgifb_reg_set(pVBInfo->P3d4, 0x46, 0x00);
1073
xgifb_reg_set(pVBInfo->P3d4, 0x47, 0x00);
1075
Temp = xgifb_reg_get(pVBInfo->P3d4, 0x37);
1076
if ((Temp & 0x03) == 0) { /* dual 12 */
1077
xgifb_reg_set(pVBInfo->P3d4, 0x46, 0x13);
1078
xgifb_reg_set(pVBInfo->P3d4, 0x47, 0x13);
1081
if (((*pVBInfo->pDVOSetting) & 0xC0) == 0xC0) {
1082
xgifb_reg_set(pVBInfo->P3d4, 0x2E, *pVBInfo->pCR2E);
1083
xgifb_reg_set(pVBInfo->P3d4, 0x2F, *pVBInfo->pCR2F);
1084
xgifb_reg_set(pVBInfo->P3d4, 0x46, *pVBInfo->pCR46);
1085
xgifb_reg_set(pVBInfo->P3d4, 0x47, *pVBInfo->pCR47);
1088
XGI_SetXG27FPBits(pVBInfo);
1012
Temp = xgifb_reg_get(pVBInfo->P3d4, 0x37);
1015
xgifb_reg_or(pVBInfo->P3c4, 0x06, 0x40);
1016
xgifb_reg_or(pVBInfo->P3c4, 0x09, 0x40);
1090
1020
xgifb_reg_or(pVBInfo->P3c4, 0x1E, 0x01); /* Negative blank polarity */
2694
2493
index = index & IndexMask;
2696
if ((pVBInfo->IF_DEF_ScaleLCD == 0) ||
2697
((pVBInfo->IF_DEF_ScaleLCD == 1) &&
2698
(!(pVBInfo->LCDInfo & EnableScalingLCD)))) {
2701
if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
2702
LCDPtr = (struct XGI_LVDSCRT1HDataStruct *)
2703
XGI_GetLcdPtr(tempbx, ModeNo,
2705
RefreshRateTableIndex,
2708
for (i = 0; i < 8; i++)
2709
pVBInfo->TimingH[0].data[i] = LCDPtr[0].Reg[i];
2712
if (pVBInfo->IF_DEF_CH7007 == 1) {
2713
if (pVBInfo->VBInfo & SetCRT2ToTV) {
2714
CH7007TV_TimingHPtr =
2715
(struct XGI_CH7007TV_TimingHStruct *)
2720
RefreshRateTableIndex,
2723
for (i = 0; i < 8; i++)
2724
pVBInfo->TimingH[0].data[i] =
2725
CH7007TV_TimingHPtr[0].data[i];
2729
/* if (pVBInfo->IF_DEF_CH7017 == 1) {
2730
if (pVBInfo->VBInfo & SetCRT2ToTV)
2731
TVPtr = (struct XGI330_CHTVDataStruct *)
2736
RefreshRateTableIndex,
2741
XGI_SetCRT1Timing_H(pVBInfo, HwDeviceExtension);
2743
if (pVBInfo->IF_DEF_CH7007 == 1) {
2744
xgifb_reg_set(pVBInfo->P3c4, 0x2E,
2745
CH7007TV_TimingHPtr[0].data[8]);
2746
xgifb_reg_set(pVBInfo->P3c4, 0x2F,
2747
CH7007TV_TimingHPtr[0].data[9]);
2752
if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
2753
LCDPtr1 = (struct XGI_LVDSCRT1VDataStruct *)
2758
RefreshRateTableIndex,
2760
for (i = 0; i < 7; i++)
2761
pVBInfo->TimingV[0].data[i] = LCDPtr1[0].Reg[i];
2764
if (pVBInfo->IF_DEF_CH7007 == 1) {
2765
if (pVBInfo->VBInfo & SetCRT2ToTV) {
2766
CH7007TV_TimingVPtr =
2767
(struct XGI_CH7007TV_TimingVStruct *)
2772
RefreshRateTableIndex,
2775
for (i = 0; i < 7; i++)
2776
pVBInfo->TimingV[0].data[i] =
2777
CH7007TV_TimingVPtr[0].data[i];
2780
/* if (pVBInfo->IF_DEF_CH7017 == 1) {
2781
if (pVBInfo->VBInfo & SetCRT2ToTV)
2782
TVPtr = (struct XGI330_CHTVDataStruct *)
2783
XGI_GetTVPtr(tempbx,
2786
RefreshRateTableIndex,
2791
XGI_SetCRT1Timing_V(ModeIdIndex, ModeNo, pVBInfo);
2793
if (pVBInfo->IF_DEF_CH7007 == 1) {
2794
xgifb_reg_and_or(pVBInfo->P3c4, 0x33, ~0x01,
2795
CH7007TV_TimingVPtr[0].data[7] & 0x01);
2796
xgifb_reg_set(pVBInfo->P3c4, 0x34,
2797
CH7007TV_TimingVPtr[0].data[8]);
2798
xgifb_reg_set(pVBInfo->P3c4, 0x3F,
2799
CH7007TV_TimingVPtr[0].data[9]);
2497
if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
2498
LCDPtr = (struct XGI_LVDSCRT1HDataStruct *)
2499
XGI_GetLcdPtr(tempbx, ModeNo,
2501
RefreshRateTableIndex,
2504
for (i = 0; i < 8; i++)
2505
pVBInfo->TimingH[0].data[i] = LCDPtr[0].Reg[i];
2508
XGI_SetCRT1Timing_H(pVBInfo, HwDeviceExtension);
2512
if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
2513
LCDPtr1 = (struct XGI_LVDSCRT1VDataStruct *)
2518
RefreshRateTableIndex,
2520
for (i = 0; i < 7; i++)
2521
pVBInfo->TimingV[0].data[i] = LCDPtr1[0].Reg[i];
2524
XGI_SetCRT1Timing_V(ModeIdIndex, ModeNo, pVBInfo);
2805
2527
static unsigned short XGI_GetLCDCapPtr(struct vb_device_info *pVBInfo)
2889
2611
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
2891
if (!(pVBInfo->SetFlag & Win9xDOSMode)) {
2892
if ((pVBInfo->IF_DEF_CH7017 == 0) || (pVBInfo->VBInfo
2893
& (SetCRT2ToLCD | SetCRT2ToLCDA))) {
2894
if (pVBInfo->IF_DEF_OEMUtil == 1) {
2896
LCDPtr = (struct XGI330_LCDDataDesStruct *)
2897
XGI_GetLcdPtr(tempbx,
2900
RefreshRateTableIndex,
2904
if ((pVBInfo->IF_DEF_OEMUtil == 0) ||
2907
if (pVBInfo->LCDInfo & EnableScalingLCD)
2909
(struct XGI330_LCDDataDesStruct2 *)
2914
RefreshRateTableIndex,
2918
(struct XGI330_LCDDataDesStruct *)
2923
RefreshRateTableIndex,
2927
XGI_GetLCDSync(&tempax, &tempbx, pVBInfo);
2932
if ((pVBInfo->LCDResInfo == Panel1024x768) ||
2933
(pVBInfo->LCDResInfo == Panel1024x768x75)) {
2936
} else if ((pVBInfo->LCDResInfo == Panel1280x1024) ||
2937
(pVBInfo->LCDResInfo == Panel1280x1024x75)) {
2940
} else if (pVBInfo->LCDResInfo == Panel1400x1050) {
2948
if (pVBInfo->LCDInfo & SetLCDtoNonExpanding) {
2949
pVBInfo->HDE = tempax;
2950
pVBInfo->VDE = tempbx;
2951
pVBInfo->VGAHDE = tempax;
2952
pVBInfo->VGAVDE = tempbx;
2955
if ((pVBInfo->IF_DEF_ScaleLCD == 1) &&
2956
(pVBInfo->LCDInfo & EnableScalingLCD)) {
2957
tempax = pVBInfo->HDE;
2958
tempbx = pVBInfo->VDE;
2961
tempax = pVBInfo->HT;
2963
if (pVBInfo->LCDInfo & EnableScalingLCD)
2964
tempbx = LCDPtr1->LCDHDES;
2966
tempbx = LCDPtr->LCDHDES;
2968
tempcx = pVBInfo->HDE;
2969
tempbx = tempbx & 0x0fff;
2972
if (tempcx >= tempax)
2975
xgifb_reg_set(pVBInfo->Part1Port, 0x1A, tempbx & 0x07);
2977
tempcx = tempcx >> 3;
2978
tempbx = tempbx >> 3;
2980
xgifb_reg_set(pVBInfo->Part1Port, 0x16,
2981
(unsigned short) (tempbx & 0xff));
2982
xgifb_reg_set(pVBInfo->Part1Port, 0x17,
2983
(unsigned short) (tempcx & 0xff));
2985
tempax = pVBInfo->HT;
2987
if (pVBInfo->LCDInfo & EnableScalingLCD)
2988
tempbx = LCDPtr1->LCDHRS;
2990
tempbx = LCDPtr->LCDHRS;
2994
if (pVBInfo->LCDInfo & EnableScalingLCD)
2995
tempcx = LCDPtr1->LCDHSync;
2999
if (tempcx >= tempax)
3002
tempax = tempbx & 0x07;
3003
tempax = tempax >> 5;
3004
tempcx = tempcx >> 3;
3005
tempbx = tempbx >> 3;
3010
xgifb_reg_set(pVBInfo->Part1Port, 0x15, tempax);
3011
xgifb_reg_set(pVBInfo->Part1Port, 0x14,
3012
(unsigned short) (tempbx & 0xff));
3014
tempax = pVBInfo->VT;
3015
if (pVBInfo->LCDInfo & EnableScalingLCD)
3016
tempbx = LCDPtr1->LCDVDES;
3018
tempbx = LCDPtr->LCDVDES;
3019
tempcx = pVBInfo->VDE;
3021
tempbx = tempbx & 0x0fff;
3023
if (tempcx >= tempax)
3026
xgifb_reg_set(pVBInfo->Part1Port, 0x1b,
3027
(unsigned short) (tempbx & 0xff));
3028
xgifb_reg_set(pVBInfo->Part1Port, 0x1c,
3029
(unsigned short) (tempcx & 0xff));
3031
tempbx = (tempbx >> 8) & 0x07;
3032
tempcx = (tempcx >> 8) & 0x07;
3034
xgifb_reg_set(pVBInfo->Part1Port, 0x1d,
3035
(unsigned short) ((tempcx << 3)
3038
tempax = pVBInfo->VT;
3039
if (pVBInfo->LCDInfo & EnableScalingLCD)
3040
tempbx = LCDPtr1->LCDVRS;
3042
tempbx = LCDPtr->LCDVRS;
3044
/* tempbx = tempbx >> 4; */
3047
if (pVBInfo->LCDInfo & EnableScalingLCD)
3048
tempcx = LCDPtr1->LCDVSync;
3051
if (tempcx >= tempax)
3054
xgifb_reg_set(pVBInfo->Part1Port, 0x18,
3055
(unsigned short) (tempbx & 0xff));
3056
xgifb_reg_and_or(pVBInfo->Part1Port, 0x19, ~0x0f,
3057
(unsigned short) (tempcx & 0x0f));
3059
tempax = ((tempbx >> 8) & 0x07) << 3;
3061
tempbx = pVBInfo->VGAVDE;
3062
if (tempbx != pVBInfo->VDE)
3065
if (pVBInfo->LCDInfo & EnableLVDSDDA)
3068
xgifb_reg_and_or(pVBInfo->Part1Port, 0x1a, 0x07,
3071
tempcx = pVBInfo->VGAVT;
3072
tempbx = pVBInfo->VDE;
3073
tempax = pVBInfo->VGAVDE;
3076
temp = tempax; /* 0430 ylshieh */
3077
temp1 = (temp << 18) / tempbx;
3079
tempdx = (unsigned short) ((temp << 18) % tempbx);
3087
xgifb_reg_set(pVBInfo->Part1Port, 0x37,
3088
(unsigned short) (temp2 & 0xff));
3089
xgifb_reg_set(pVBInfo->Part1Port, 0x36,
3090
(unsigned short) ((temp2 >> 8) & 0xff));
3092
tempbx = (unsigned short) (temp2 >> 16);
3093
tempax = tempbx & 0x03;
3095
tempbx = pVBInfo->VGAVDE;
3096
if (tempbx == pVBInfo->VDE)
3099
xgifb_reg_set(pVBInfo->Part1Port, 0x35, tempax);
3101
if (pVBInfo->VBType & VB_XGI301C) {
3103
xgifb_reg_set(pVBInfo->Part4Port,
3105
(unsigned short) (temp2 & 0xff));
3106
xgifb_reg_set(pVBInfo->Part4Port,
3108
(unsigned short) ((temp2 >> 8) &
3110
tempbx = (unsigned short) (temp2 >> 16);
3111
xgifb_reg_and_or(pVBInfo->Part4Port, 0x3a,
3113
(unsigned short) ((tempbx &
3116
tempcx = pVBInfo->VGAVDE;
3117
if (tempcx == pVBInfo->VDE)
3118
xgifb_reg_and_or(pVBInfo->Part4Port,
3121
xgifb_reg_and_or(pVBInfo->Part4Port,
3125
tempcx = pVBInfo->VGAHDE;
3126
tempbx = pVBInfo->HDE;
3128
temp1 = tempcx << 16;
3130
tempax = (unsigned short) (temp1 / tempbx);
3132
if ((tempbx & 0xffff) == (tempcx & 0xffff))
3136
temp1 = pVBInfo->VGAHDE << 16;
3139
temp3 = temp3 << 16;
3142
temp3 = (temp3 & 0xffff0000) + (temp1 & 0xffff);
3144
tempax = (unsigned short) (temp3 & 0xff);
3145
xgifb_reg_set(pVBInfo->Part1Port, 0x1f, tempax);
3147
temp1 = pVBInfo->VGAVDE << 18;
3148
temp1 = temp1 / push3;
3149
tempbx = (unsigned short) (temp1 & 0xffff);
3151
if (pVBInfo->LCDResInfo == Panel1024x768)
3154
tempax = ((tempbx >> 8) & 0xff) << 3;
3155
tempax |= (unsigned short) ((temp3 >> 8) & 0x07);
3156
xgifb_reg_set(pVBInfo->Part1Port, 0x20,
3157
(unsigned short) (tempax & 0xff));
3158
xgifb_reg_set(pVBInfo->Part1Port, 0x21,
3159
(unsigned short) (tempbx & 0xff));
3161
temp3 = temp3 >> 16;
3163
if (modeflag & HalfDCLK)
3166
xgifb_reg_set(pVBInfo->Part1Port, 0x22,
3167
(unsigned short) ((temp3 >> 8) & 0xff));
3168
xgifb_reg_set(pVBInfo->Part1Port, 0x23,
3169
(unsigned short) (temp3 & 0xff));
2614
if (pVBInfo->LCDInfo & EnableScalingLCD)
2616
(struct XGI330_LCDDataDesStruct2 *)
2621
RefreshRateTableIndex,
2625
(struct XGI330_LCDDataDesStruct *)
2630
RefreshRateTableIndex,
2633
XGI_GetLCDSync(&tempax, &tempbx, pVBInfo);
2638
if ((pVBInfo->LCDResInfo == Panel1024x768) ||
2639
(pVBInfo->LCDResInfo == Panel1024x768x75)) {
2642
} else if ((pVBInfo->LCDResInfo == Panel1280x1024) ||
2643
(pVBInfo->LCDResInfo == Panel1280x1024x75)) {
2646
} else if (pVBInfo->LCDResInfo == Panel1400x1050) {
2654
if (pVBInfo->LCDInfo & SetLCDtoNonExpanding) {
2655
pVBInfo->HDE = tempax;
2656
pVBInfo->VDE = tempbx;
2657
pVBInfo->VGAHDE = tempax;
2658
pVBInfo->VGAVDE = tempbx;
2661
tempax = pVBInfo->HT;
2663
if (pVBInfo->LCDInfo & EnableScalingLCD)
2664
tempbx = LCDPtr1->LCDHDES;
2666
tempbx = LCDPtr->LCDHDES;
2668
tempcx = pVBInfo->HDE;
2669
tempbx = tempbx & 0x0fff;
2672
if (tempcx >= tempax)
2675
xgifb_reg_set(pVBInfo->Part1Port, 0x1A, tempbx & 0x07);
2677
tempcx = tempcx >> 3;
2678
tempbx = tempbx >> 3;
2680
xgifb_reg_set(pVBInfo->Part1Port, 0x16,
2681
(unsigned short) (tempbx & 0xff));
2682
xgifb_reg_set(pVBInfo->Part1Port, 0x17,
2683
(unsigned short) (tempcx & 0xff));
2685
tempax = pVBInfo->HT;
2687
if (pVBInfo->LCDInfo & EnableScalingLCD)
2688
tempbx = LCDPtr1->LCDHRS;
2690
tempbx = LCDPtr->LCDHRS;
2694
if (pVBInfo->LCDInfo & EnableScalingLCD)
2695
tempcx = LCDPtr1->LCDHSync;
2699
if (tempcx >= tempax)
2702
tempax = tempbx & 0x07;
2703
tempax = tempax >> 5;
2704
tempcx = tempcx >> 3;
2705
tempbx = tempbx >> 3;
2710
xgifb_reg_set(pVBInfo->Part1Port, 0x15, tempax);
2711
xgifb_reg_set(pVBInfo->Part1Port, 0x14,
2712
(unsigned short) (tempbx & 0xff));
2714
tempax = pVBInfo->VT;
2715
if (pVBInfo->LCDInfo & EnableScalingLCD)
2716
tempbx = LCDPtr1->LCDVDES;
2718
tempbx = LCDPtr->LCDVDES;
2719
tempcx = pVBInfo->VDE;
2721
tempbx = tempbx & 0x0fff;
2723
if (tempcx >= tempax)
2726
xgifb_reg_set(pVBInfo->Part1Port, 0x1b,
2727
(unsigned short) (tempbx & 0xff));
2728
xgifb_reg_set(pVBInfo->Part1Port, 0x1c,
2729
(unsigned short) (tempcx & 0xff));
2731
tempbx = (tempbx >> 8) & 0x07;
2732
tempcx = (tempcx >> 8) & 0x07;
2734
xgifb_reg_set(pVBInfo->Part1Port, 0x1d,
2735
(unsigned short) ((tempcx << 3)
2738
tempax = pVBInfo->VT;
2739
if (pVBInfo->LCDInfo & EnableScalingLCD)
2740
tempbx = LCDPtr1->LCDVRS;
2742
tempbx = LCDPtr->LCDVRS;
2744
/* tempbx = tempbx >> 4; */
2747
if (pVBInfo->LCDInfo & EnableScalingLCD)
2748
tempcx = LCDPtr1->LCDVSync;
2751
if (tempcx >= tempax)
2754
xgifb_reg_set(pVBInfo->Part1Port, 0x18,
2755
(unsigned short) (tempbx & 0xff));
2756
xgifb_reg_and_or(pVBInfo->Part1Port, 0x19, ~0x0f,
2757
(unsigned short) (tempcx & 0x0f));
2759
tempax = ((tempbx >> 8) & 0x07) << 3;
2761
tempbx = pVBInfo->VGAVDE;
2762
if (tempbx != pVBInfo->VDE)
2765
if (pVBInfo->LCDInfo & EnableLVDSDDA)
2768
xgifb_reg_and_or(pVBInfo->Part1Port, 0x1a, 0x07,
2771
tempcx = pVBInfo->VGAVT;
2772
tempbx = pVBInfo->VDE;
2773
tempax = pVBInfo->VGAVDE;
2776
temp = tempax; /* 0430 ylshieh */
2777
temp1 = (temp << 18) / tempbx;
2779
tempdx = (unsigned short) ((temp << 18) % tempbx);
2787
xgifb_reg_set(pVBInfo->Part1Port, 0x37,
2788
(unsigned short) (temp2 & 0xff));
2789
xgifb_reg_set(pVBInfo->Part1Port, 0x36,
2790
(unsigned short) ((temp2 >> 8) & 0xff));
2792
tempbx = (unsigned short) (temp2 >> 16);
2793
tempax = tempbx & 0x03;
2795
tempbx = pVBInfo->VGAVDE;
2796
if (tempbx == pVBInfo->VDE)
2799
xgifb_reg_set(pVBInfo->Part1Port, 0x35, tempax);
2801
if (pVBInfo->VBType & VB_XGI301C) {
2803
xgifb_reg_set(pVBInfo->Part4Port,
2805
(unsigned short) (temp2 & 0xff));
2806
xgifb_reg_set(pVBInfo->Part4Port,
2808
(unsigned short) ((temp2 >> 8) &
2810
tempbx = (unsigned short) (temp2 >> 16);
2811
xgifb_reg_and_or(pVBInfo->Part4Port, 0x3a,
2813
(unsigned short) ((tempbx &
2816
tempcx = pVBInfo->VGAVDE;
2817
if (tempcx == pVBInfo->VDE)
2818
xgifb_reg_and_or(pVBInfo->Part4Port,
2821
xgifb_reg_and_or(pVBInfo->Part4Port,
2825
tempcx = pVBInfo->VGAHDE;
2826
tempbx = pVBInfo->HDE;
2828
temp1 = tempcx << 16;
2830
tempax = (unsigned short) (temp1 / tempbx);
2832
if ((tempbx & 0xffff) == (tempcx & 0xffff))
2836
temp1 = pVBInfo->VGAHDE << 16;
2839
temp3 = temp3 << 16;
2842
temp3 = (temp3 & 0xffff0000) + (temp1 & 0xffff);
2844
tempax = (unsigned short) (temp3 & 0xff);
2845
xgifb_reg_set(pVBInfo->Part1Port, 0x1f, tempax);
2847
temp1 = pVBInfo->VGAVDE << 18;
2848
temp1 = temp1 / push3;
2849
tempbx = (unsigned short) (temp1 & 0xffff);
2851
if (pVBInfo->LCDResInfo == Panel1024x768)
2854
tempax = ((tempbx >> 8) & 0xff) << 3;
2855
tempax |= (unsigned short) ((temp3 >> 8) & 0x07);
2856
xgifb_reg_set(pVBInfo->Part1Port, 0x20,
2857
(unsigned short) (tempax & 0xff));
2858
xgifb_reg_set(pVBInfo->Part1Port, 0x21,
2859
(unsigned short) (tempbx & 0xff));
2861
temp3 = temp3 >> 16;
2863
if (modeflag & HalfDCLK)
2866
xgifb_reg_set(pVBInfo->Part1Port, 0x22,
2867
(unsigned short) ((temp3 >> 8) & 0xff));
2868
xgifb_reg_set(pVBInfo->Part1Port, 0x23,
2869
(unsigned short) (temp3 & 0xff));
3174
2872
/* --------------------------------------------------------------------- */
4173
/* win2000 MM adapter not support standard mode! */
4176
static unsigned char XGINew_CheckMemorySize(
4177
struct xgi_hw_device_info *HwDeviceExtension,
4178
unsigned short ModeNo,
4179
unsigned short ModeIdIndex,
4180
struct vb_device_info *pVBInfo)
4182
unsigned short memorysize, modeflag, temp, temp1, tmp;
4185
if ((HwDeviceExtension->jChipType == XGI_650) ||
4186
(HwDeviceExtension->jChipType == XGI_650M)) {
4192
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
4194
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
4196
/* ModeType = modeflag&ModeInfoFlag; // Get mode type */
4198
memorysize = modeflag & MemoryInfoFlag;
4199
memorysize = memorysize > MemorySizeShift;
4200
memorysize++; /* Get memory size */
4202
temp = xgifb_reg_get(pVBInfo->P3c4, 0x14); /* Get DRAM Size */
4205
if (HwDeviceExtension->jChipType == XG40) {
4206
/* memory size per channel SR14[7:4] */
4207
temp = 1 << ((temp & 0x0F0) >> 4);
4208
if ((tmp & 0x0c) == 0x0C) { /* Qual channels */
4210
} else if ((tmp & 0x0c) == 0x08) { /* Dual channels */
4213
} else if (HwDeviceExtension->jChipType == XG42) {
4214
/* memory size per channel SR14[7:4] */
4215
temp = 1 << ((temp & 0x0F0) >> 4);
4216
if ((tmp & 0x04) == 0x04) { /* Dual channels */
4219
} else if (HwDeviceExtension->jChipType == XG45) {
4220
/* memory size per channel SR14[7:4] */
4221
temp = 1 << ((temp & 0x0F0) >> 4);
4222
if ((tmp & 0x0c) == 0x0C) { /* Qual channels */
4224
} else if ((tmp & 0x0c) == 0x08) { /* triple channels */
4228
} else if ((tmp & 0x0c) == 0x04) { /* Dual channels */
4232
if (temp < memorysize)
4240
void XGINew_IsLowResolution(unsigned short ModeNo,
4241
unsigned short ModeIdIndex,
4242
unsigned char XGINew_CheckMemorySize(
4243
struct xgi_hw_device_info *HwDeviceExtension,
4244
unsigned short ModeNo,
4245
unsigned short ModeIdIndex,
4246
struct vb_device_info *pVBInfo)
4248
unsigned short data ;
4249
unsigned short ModeFlag ;
4251
data = xgifb_reg_get(pVBInfo->P3c4, 0x0F);
4253
xgifb_reg_set(pVBInfo->P3c4, 0x0F, data);
4255
if (ModeNo > 0x13) {
4256
ModeFlag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
4257
if ((ModeFlag & HalfDCLK) && (ModeFlag & DoubleScanMode)) {
4258
data = xgifb_reg_get(pVBInfo->P3c4, 0x0F);
4260
xgifb_reg_set(pVBInfo->P3c4, 0x0F, data);
4261
data = xgifb_reg_get(pVBInfo->P3c4, 0x01);
4263
xgifb_reg_set(pVBInfo->P3c4, 0x01, data);
4269
3671
static unsigned char XG21GPIODataTransfer(unsigned char ujDate)
4271
3673
unsigned char ujRet = 0;
6746
static void XGI_SetXG21LVDSPara(unsigned short ModeNo,
6747
unsigned short ModeIdIndex,
6748
struct vb_device_info *pVBInfo)
6750
unsigned char temp, Miscdata;
6751
unsigned short xres, yres, modeflag, resindex, lvdstableindex;
6752
unsigned short LVDSHT, LVDSHBS, LVDSHRS, LVDSHRE, LVDSHBE;
6753
unsigned short LVDSVT, LVDSVBS, LVDSVRS, LVDSVRE, LVDSVBE;
6754
unsigned short value;
6756
lvdstableindex = XGI_GetLVDSOEMTableIndex(pVBInfo);
6758
temp = (unsigned char) ((pVBInfo->XG21_LVDSCapList[lvdstableindex].
6760
(LCDPolarity << 8)) >> 8);
6761
temp &= LCDPolarity;
6762
Miscdata = (unsigned char) inb(pVBInfo->P3cc);
6764
outb((Miscdata & 0x3F) | temp, pVBInfo->P3c2);
6766
temp = (unsigned char) (pVBInfo->XG21_LVDSCapList[lvdstableindex].
6767
LVDS_Capability & LCDPolarity);
6768
/* SR35[7] FP VSync polarity */
6769
xgifb_reg_and_or(pVBInfo->P3c4, 0x35, ~0x80, temp & 0x80);
6770
/* SR30[5] FP HSync polarity */
6771
xgifb_reg_and_or(pVBInfo->P3c4, 0x30, ~0x20, (temp & 0x40) >> 1);
6773
XGI_SetXG21FPBits(pVBInfo);
6774
resindex = XGI_GetResInfo(ModeNo, ModeIdIndex, pVBInfo);
6775
if (ModeNo <= 0x13) {
6776
xres = pVBInfo->StResInfo[resindex].HTotal;
6777
yres = pVBInfo->StResInfo[resindex].VTotal;
6779
modeflag = pVBInfo->SModeIDTable[ModeIdIndex].St_ModeFlag;
6781
xres = pVBInfo->ModeResInfo[resindex].HTotal; /* xres->ax */
6782
yres = pVBInfo->ModeResInfo[resindex].VTotal; /* yres->bx */
6783
/* si+St_ModeFlag */
6784
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
6787
if (!(modeflag & Charx8Dot))
6788
xres = xres * 8 / 9;
6790
LVDSHT = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHT;
6792
LVDSHBS = xres + (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE
6794
if ((ModeNo <= 0x13) && (modeflag & HalfDCLK))
6795
LVDSHBS -= xres / 4;
6797
if (LVDSHBS > LVDSHT)
6800
LVDSHRS = LVDSHBS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHFP;
6801
if (LVDSHRS > LVDSHT)
6804
LVDSHRE = LVDSHRS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHSYNC;
6805
if (LVDSHRE > LVDSHT)
6808
LVDSHBE = LVDSHBS + LVDSHT
6809
- pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE;
6811
LVDSVT = pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVT;
6813
LVDSVBS = yres + (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE
6815
if ((ModeNo > 0x13) && (modeflag & DoubleScanMode))
6816
LVDSVBS += yres / 2;
6818
if (LVDSVBS > LVDSVT)
6821
LVDSVRS = LVDSVBS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVFP;
6822
if (LVDSVRS > LVDSVT)
6825
LVDSVRE = LVDSVRS + pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVSYNC;
6826
if (LVDSVRE > LVDSVT)
6829
LVDSVBE = LVDSVBS + LVDSVT
6830
- pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE;
6832
temp = (unsigned char) xgifb_reg_get(pVBInfo->P3d4, 0x11);
6833
xgifb_reg_set(pVBInfo->P3d4, 0x11, temp & 0x7f); /* Unlock CRTC */
6835
if (!(modeflag & Charx8Dot))
6836
xgifb_reg_or(pVBInfo->P3c4, 0x1, 0x1);
6838
/* HT SR0B[1:0] CR00 */
6839
value = (LVDSHT >> 3) - 5;
6840
xgifb_reg_and_or(pVBInfo->P3c4, 0x0B, ~0x03, (value & 0x300) >> 8);
6841
xgifb_reg_set(pVBInfo->P3d4, 0x0, (value & 0xFF));
6843
/* HBS SR0B[5:4] CR02 */
6844
value = (LVDSHBS >> 3) - 1;
6845
xgifb_reg_and_or(pVBInfo->P3c4, 0x0B, ~0x30, (value & 0x300) >> 4);
6846
xgifb_reg_set(pVBInfo->P3d4, 0x2, (value & 0xFF));
6848
/* HBE SR0C[1:0] CR05[7] CR03[4:0] */
6849
value = (LVDSHBE >> 3) - 1;
6850
xgifb_reg_and_or(pVBInfo->P3c4, 0x0C, ~0x03, (value & 0xC0) >> 6);
6851
xgifb_reg_and_or(pVBInfo->P3d4, 0x05, ~0x80, (value & 0x20) << 2);
6852
xgifb_reg_and_or(pVBInfo->P3d4, 0x03, ~0x1F, value & 0x1F);
6854
/* HRS SR0B[7:6] CR04 */
6855
value = (LVDSHRS >> 3) + 2;
6856
xgifb_reg_and_or(pVBInfo->P3c4, 0x0B, ~0xC0, (value & 0x300) >> 2);
6857
xgifb_reg_set(pVBInfo->P3d4, 0x4, (value & 0xFF));
6859
/* Panel HRS SR2F[1:0] SR2E[7:0] */
6861
xgifb_reg_and_or(pVBInfo->P3c4, 0x2F, ~0x03, (value & 0x300) >> 8);
6862
xgifb_reg_set(pVBInfo->P3c4, 0x2E, (value & 0xFF));
6864
/* HRE SR0C[2] CR05[4:0] */
6865
value = (LVDSHRE >> 3) + 2;
6866
xgifb_reg_and_or(pVBInfo->P3c4, 0x0C, ~0x04, (value & 0x20) >> 3);
6867
xgifb_reg_and_or(pVBInfo->P3d4, 0x05, ~0x1F, value & 0x1F);
6869
/* Panel HRE SR2F[7:2] */
6871
xgifb_reg_and_or(pVBInfo->P3c4, 0x2F, ~0xFC, value << 2);
6873
/* VT SR0A[0] CR07[5][0] CR06 */
6875
xgifb_reg_and_or(pVBInfo->P3c4, 0x0A, ~0x01, (value & 0x400) >> 10);
6876
xgifb_reg_and_or(pVBInfo->P3d4, 0x07, ~0x20, (value & 0x200) >> 4);
6877
xgifb_reg_and_or(pVBInfo->P3d4, 0x07, ~0x01, (value & 0x100) >> 8);
6878
xgifb_reg_set(pVBInfo->P3d4, 0x06, (value & 0xFF));
6880
/* VBS SR0A[2] CR09[5] CR07[3] CR15 */
6881
value = LVDSVBS - 1;
6882
xgifb_reg_and_or(pVBInfo->P3c4, 0x0A, ~0x04, (value & 0x400) >> 8);
6883
xgifb_reg_and_or(pVBInfo->P3d4, 0x09, ~0x20, (value & 0x200) >> 4);
6884
xgifb_reg_and_or(pVBInfo->P3d4, 0x07, ~0x08, (value & 0x100) >> 5);
6885
xgifb_reg_set(pVBInfo->P3d4, 0x15, (value & 0xFF));
6887
/* VBE SR0A[4] CR16 */
6888
value = LVDSVBE - 1;
6889
xgifb_reg_and_or(pVBInfo->P3c4, 0x0A, ~0x10, (value & 0x100) >> 4);
6890
xgifb_reg_set(pVBInfo->P3d4, 0x16, (value & 0xFF));
6892
/* VRS SR0A[3] CR7[7][2] CR10 */
6893
value = LVDSVRS - 1;
6894
xgifb_reg_and_or(pVBInfo->P3c4, 0x0A, ~0x08, (value & 0x400) >> 7);
6895
xgifb_reg_and_or(pVBInfo->P3d4, 0x07, ~0x80, (value & 0x200) >> 2);
6896
xgifb_reg_and_or(pVBInfo->P3d4, 0x07, ~0x04, (value & 0x100) >> 6);
6897
xgifb_reg_set(pVBInfo->P3d4, 0x10, (value & 0xFF));
6899
/* Panel VRS SR3F[1:0] SR34[7:0] SR33[0] */
6900
xgifb_reg_and_or(pVBInfo->P3c4, 0x3F, ~0x03, (value & 0x600) >> 9);
6901
xgifb_reg_set(pVBInfo->P3c4, 0x34, (value >> 1) & 0xFF);
6902
xgifb_reg_and_or(pVBInfo->P3d4, 0x33, ~0x01, value & 0x01);
6904
/* VRE SR0A[5] CR11[3:0] */
6905
value = LVDSVRE - 1;
6906
xgifb_reg_and_or(pVBInfo->P3c4, 0x0A, ~0x20, (value & 0x10) << 1);
6907
xgifb_reg_and_or(pVBInfo->P3d4, 0x11, ~0x0F, value & 0x0F);
6909
/* Panel VRE SR3F[7:2] *//* SR3F[7] has to be 0, h/w bug */
6910
xgifb_reg_and_or(pVBInfo->P3c4, 0x3F, ~0xFC, (value << 2) & 0x7C);
6912
for (temp = 0, value = 0; temp < 3; temp++) {
6914
xgifb_reg_and_or(pVBInfo->P3c4, 0x31, ~0x30, value);
6915
xgifb_reg_set(pVBInfo->P3c4,
6917
pVBInfo->XG21_LVDSCapList[lvdstableindex].
6919
xgifb_reg_set(pVBInfo->P3c4,
6921
pVBInfo->XG21_LVDSCapList[lvdstableindex].
6926
if (!(modeflag & Charx8Dot)) {
6927
inb(pVBInfo->P3da); /* reset 3da */
6928
outb(0x13, pVBInfo->P3c0); /* set index */
6929
/* set data, panning = 0, shift left 1 dot*/
6930
outb(0x00, pVBInfo->P3c0);
6932
inb(pVBInfo->P3da); /* Enable Attribute */
6933
outb(0x20, pVBInfo->P3c0);
6935
inb(pVBInfo->P3da); /* reset 3da */
6940
/* no shadow case */
6941
static void XGI_SetXG27LVDSPara(unsigned short ModeNo,
6942
unsigned short ModeIdIndex,
6943
struct vb_device_info *pVBInfo)
6114
static void xgifb_set_lvds(int chip_id,
6115
unsigned short ModeNo,
6116
unsigned short ModeIdIndex,
6117
struct vb_device_info *pVBInfo)
6945
6119
unsigned char temp, Miscdata;
6946
6120
unsigned short xres, yres, modeflag, resindex, lvdstableindex;