1 #include <linux/types.h>
2 #include <linux/delay.h> /* udelay */
9 #include "vb_setmode.h"
16 static unsigned char XGINew_ChannelAB
, XGINew_DataBusWidth
;
18 static unsigned short XGINew_DDRDRAM_TYPE340
[4][5] = {
19 { 2, 13, 9, 64, 0x45},
20 { 2, 12, 9, 32, 0x35},
21 { 2, 12, 8, 16, 0x31},
22 { 2, 11, 8, 8, 0x21} };
24 static unsigned short XGINew_DDRDRAM_TYPE20
[12][5] = {
25 { 2, 14, 11, 128, 0x5D},
26 { 2, 14, 10, 64, 0x59},
27 { 2, 13, 11, 64, 0x4D},
28 { 2, 14, 9, 32, 0x55},
29 { 2, 13, 10, 32, 0x49},
30 { 2, 12, 11, 32, 0x3D},
31 { 2, 14, 8, 16, 0x51},
32 { 2, 13, 9, 16, 0x45},
33 { 2, 12, 10, 16, 0x39},
36 { 2, 12, 8, 4, 0x31} };
38 static int XGINew_RAMType
;
41 XGINew_GetXG20DRAMType(struct xgi_hw_device_info
*HwDeviceExtension
,
42 struct vb_device_info
*pVBInfo
)
44 unsigned char data
, temp
;
46 if (HwDeviceExtension
->jChipType
< XG20
) {
47 if (*pVBInfo
->pSoftSetting
& SoftDRAMType
) {
48 data
= *pVBInfo
->pSoftSetting
& 0x07;
51 data
= xgifb_reg_get(pVBInfo
->P3c4
, 0x39) & 0x02;
53 data
= (xgifb_reg_get(pVBInfo
->P3c4
, 0x3A) &
57 } else if (HwDeviceExtension
->jChipType
== XG27
) {
58 if (*pVBInfo
->pSoftSetting
& SoftDRAMType
) {
59 data
= *pVBInfo
->pSoftSetting
& 0x07;
62 temp
= xgifb_reg_get(pVBInfo
->P3c4
, 0x3B);
63 /* SR3B[7][3]MAA15 MAA11 (Power on Trapping) */
64 if ((temp
& 0x88) == 0x80)
69 } else if (HwDeviceExtension
->jChipType
== XG21
) {
70 /* Independent GPIO control */
71 xgifb_reg_and(pVBInfo
->P3d4
, 0xB4, ~0x02);
73 xgifb_reg_or(pVBInfo
->P3d4
, 0x4A, 0x80); /* Enable GPIOH read */
74 /* GPIOF 0:DVI 1:DVO */
75 temp
= xgifb_reg_get(pVBInfo
->P3d4
, 0x48);
77 /* for current XG20 & XG21, GPIOH is floating, driver will
78 * fix DDR temporarily */
79 if (temp
& 0x01) /* DVI read GPIOH */
83 /* ~HOTPLUG_SUPPORT */
84 xgifb_reg_or(pVBInfo
->P3d4
, 0xB4, 0x02);
87 data
= xgifb_reg_get(pVBInfo
->P3d4
, 0x97) & 0x01;
96 static void XGINew_DDR1x_MRS_340(unsigned long P3c4
,
97 struct vb_device_info
*pVBInfo
)
99 xgifb_reg_set(P3c4
, 0x18, 0x01);
100 xgifb_reg_set(P3c4
, 0x19, 0x20);
101 xgifb_reg_set(P3c4
, 0x16, 0x00);
102 xgifb_reg_set(P3c4
, 0x16, 0x80);
104 if (*pVBInfo
->pXGINew_DRAMTypeDefinition
!= 0x0C) { /* Samsung F Die */
106 xgifb_reg_set(P3c4
, 0x18, 0x00);
107 xgifb_reg_set(P3c4
, 0x19, 0x20);
108 xgifb_reg_set(P3c4
, 0x16, 0x00);
109 xgifb_reg_set(P3c4
, 0x16, 0x80);
113 xgifb_reg_set(P3c4
, 0x18, pVBInfo
->SR15
[2][XGINew_RAMType
]); /* SR18 */
114 xgifb_reg_set(P3c4
, 0x19, 0x01);
115 xgifb_reg_set(P3c4
, 0x16, pVBInfo
->SR16
[0]);
116 xgifb_reg_set(P3c4
, 0x16, pVBInfo
->SR16
[1]);
118 xgifb_reg_set(P3c4
, 0x1B, 0x03);
120 xgifb_reg_set(P3c4
, 0x18, pVBInfo
->SR15
[2][XGINew_RAMType
]); /* SR18 */
121 xgifb_reg_set(P3c4
, 0x19, 0x00);
122 xgifb_reg_set(P3c4
, 0x16, pVBInfo
->SR16
[2]);
123 xgifb_reg_set(P3c4
, 0x16, pVBInfo
->SR16
[3]);
124 xgifb_reg_set(P3c4
, 0x1B, 0x00);
127 static void XGINew_SetMemoryClock(struct xgi_hw_device_info
*HwDeviceExtension
,
128 struct vb_device_info
*pVBInfo
)
131 xgifb_reg_set(pVBInfo
->P3c4
,
133 pVBInfo
->MCLKData
[XGINew_RAMType
].SR28
);
134 xgifb_reg_set(pVBInfo
->P3c4
,
136 pVBInfo
->MCLKData
[XGINew_RAMType
].SR29
);
137 xgifb_reg_set(pVBInfo
->P3c4
,
139 pVBInfo
->MCLKData
[XGINew_RAMType
].SR2A
);
141 xgifb_reg_set(pVBInfo
->P3c4
,
143 pVBInfo
->ECLKData
[XGINew_RAMType
].SR2E
);
144 xgifb_reg_set(pVBInfo
->P3c4
,
146 pVBInfo
->ECLKData
[XGINew_RAMType
].SR2F
);
147 xgifb_reg_set(pVBInfo
->P3c4
,
149 pVBInfo
->ECLKData
[XGINew_RAMType
].SR30
);
151 /* [Vicent] 2004/07/07,
152 * When XG42 ECLK = MCLK = 207MHz, Set SR32 D[1:0] = 10b */
153 /* [Hsuan] 2004/08/20,
154 * Modify SR32 value, when MCLK=207MHZ, ELCK=250MHz,
155 * Set SR32 D[1:0] = 10b */
156 if (HwDeviceExtension
->jChipType
== XG42
) {
157 if ((pVBInfo
->MCLKData
[XGINew_RAMType
].SR28
== 0x1C) &&
158 (pVBInfo
->MCLKData
[XGINew_RAMType
].SR29
== 0x01) &&
159 (((pVBInfo
->ECLKData
[XGINew_RAMType
].SR2E
== 0x1C) &&
160 (pVBInfo
->ECLKData
[XGINew_RAMType
].SR2F
== 0x01)) ||
161 ((pVBInfo
->ECLKData
[XGINew_RAMType
].SR2E
== 0x22) &&
162 (pVBInfo
->ECLKData
[XGINew_RAMType
].SR2F
== 0x01))))
163 xgifb_reg_set(pVBInfo
->P3c4
,
165 ((unsigned char) xgifb_reg_get(
166 pVBInfo
->P3c4
, 0x32) & 0xFC) | 0x02);
170 static void XGINew_DDRII_Bootup_XG27(
171 struct xgi_hw_device_info
*HwDeviceExtension
,
172 unsigned long P3c4
, struct vb_device_info
*pVBInfo
)
174 unsigned long P3d4
= P3c4
+ 0x10;
175 XGINew_RAMType
= (int) XGINew_GetXG20DRAMType(HwDeviceExtension
,
177 XGINew_SetMemoryClock(HwDeviceExtension
, pVBInfo
);
179 /* Set Double Frequency */
180 /* xgifb_reg_set(P3d4, 0x97, 0x11); *//* CR97 */
181 xgifb_reg_set(P3d4
, 0x97, *pVBInfo
->pXGINew_CR97
); /* CR97 */
185 xgifb_reg_set(P3c4
, 0x18, 0x00); /* Set SR18 */ /* EMRS2 */
186 xgifb_reg_set(P3c4
, 0x19, 0x80); /* Set SR19 */
187 xgifb_reg_set(P3c4
, 0x16, 0x20); /* Set SR16 */
189 xgifb_reg_set(P3c4
, 0x16, 0xA0); /* Set SR16 */
192 xgifb_reg_set(P3c4
, 0x18, 0x00); /* Set SR18 */ /* EMRS3 */
193 xgifb_reg_set(P3c4
, 0x19, 0xC0); /* Set SR19 */
194 xgifb_reg_set(P3c4
, 0x16, 0x20); /* Set SR16 */
196 xgifb_reg_set(P3c4
, 0x16, 0xA0); /* Set SR16 */
199 xgifb_reg_set(P3c4
, 0x18, 0x00); /* Set SR18 */ /* EMRS1 */
200 xgifb_reg_set(P3c4
, 0x19, 0x40); /* Set SR19 */
201 xgifb_reg_set(P3c4
, 0x16, 0x20); /* Set SR16 */
203 xgifb_reg_set(P3c4
, 0x16, 0xA0); /* Set SR16 */
206 xgifb_reg_set(P3c4
, 0x18, 0x42); /* Set SR18 */ /* MRS, DLL Enable */
207 xgifb_reg_set(P3c4
, 0x19, 0x0A); /* Set SR19 */
208 xgifb_reg_set(P3c4
, 0x16, 0x00); /* Set SR16 */
210 xgifb_reg_set(P3c4
, 0x16, 0x00); /* Set SR16 */
211 xgifb_reg_set(P3c4
, 0x16, 0x80); /* Set SR16 */
214 xgifb_reg_set(P3c4
, 0x1B, 0x04); /* Set SR1B */
216 xgifb_reg_set(P3c4
, 0x1B, 0x00); /* Set SR1B */
218 xgifb_reg_set(P3c4
, 0x18, 0x42); /* Set SR18 */ /* MRS, DLL Reset */
219 xgifb_reg_set(P3c4
, 0x19, 0x08); /* Set SR19 */
220 xgifb_reg_set(P3c4
, 0x16, 0x00); /* Set SR16 */
223 xgifb_reg_set(P3c4
, 0x16, 0x83); /* Set SR16 */
226 xgifb_reg_set(P3c4
, 0x18, 0x80); /* Set SR18 */ /* MRS, ODT */
227 xgifb_reg_set(P3c4
, 0x19, 0x46); /* Set SR19 */
228 xgifb_reg_set(P3c4
, 0x16, 0x20); /* Set SR16 */
230 xgifb_reg_set(P3c4
, 0x16, 0xA0); /* Set SR16 */
233 xgifb_reg_set(P3c4
, 0x18, 0x00); /* Set SR18 */ /* EMRS */
234 xgifb_reg_set(P3c4
, 0x19, 0x40); /* Set SR19 */
235 xgifb_reg_set(P3c4
, 0x16, 0x20); /* Set SR16 */
237 xgifb_reg_set(P3c4
, 0x16, 0xA0); /* Set SR16 */
240 /* Set SR1B refresh control 000:close; 010:open */
241 xgifb_reg_set(P3c4
, 0x1B, 0x04);
246 static void XGINew_DDR2_MRS_XG20(struct xgi_hw_device_info
*HwDeviceExtension
,
247 unsigned long P3c4
, struct vb_device_info
*pVBInfo
)
249 unsigned long P3d4
= P3c4
+ 0x10;
251 XGINew_RAMType
= (int) XGINew_GetXG20DRAMType(HwDeviceExtension
,
253 XGINew_SetMemoryClock(HwDeviceExtension
, pVBInfo
);
255 xgifb_reg_set(P3d4
, 0x97, 0x11); /* CR97 */
258 xgifb_reg_set(P3c4
, 0x18, 0x00); /* EMRS2 */
259 xgifb_reg_set(P3c4
, 0x19, 0x80);
260 xgifb_reg_set(P3c4
, 0x16, 0x05);
261 xgifb_reg_set(P3c4
, 0x16, 0x85);
263 xgifb_reg_set(P3c4
, 0x18, 0x00); /* EMRS3 */
264 xgifb_reg_set(P3c4
, 0x19, 0xC0);
265 xgifb_reg_set(P3c4
, 0x16, 0x05);
266 xgifb_reg_set(P3c4
, 0x16, 0x85);
268 xgifb_reg_set(P3c4
, 0x18, 0x00); /* EMRS1 */
269 xgifb_reg_set(P3c4
, 0x19, 0x40);
270 xgifb_reg_set(P3c4
, 0x16, 0x05);
271 xgifb_reg_set(P3c4
, 0x16, 0x85);
273 /* xgifb_reg_set(P3c4, 0x18, 0x52); */ /* MRS1 */
274 xgifb_reg_set(P3c4
, 0x18, 0x42); /* MRS1 */
275 xgifb_reg_set(P3c4
, 0x19, 0x02);
276 xgifb_reg_set(P3c4
, 0x16, 0x05);
277 xgifb_reg_set(P3c4
, 0x16, 0x85);
280 xgifb_reg_set(P3c4
, 0x1B, 0x04); /* SR1B */
282 xgifb_reg_set(P3c4
, 0x1B, 0x00); /* SR1B */
285 /* xgifb_reg_set(P3c4 ,0x18, 0x52); */ /* MRS2 */
286 xgifb_reg_set(P3c4
, 0x18, 0x42); /* MRS1 */
287 xgifb_reg_set(P3c4
, 0x19, 0x00);
288 xgifb_reg_set(P3c4
, 0x16, 0x05);
289 xgifb_reg_set(P3c4
, 0x16, 0x85);
294 static void XGINew_DDR1x_MRS_XG20(unsigned long P3c4
,
295 struct vb_device_info
*pVBInfo
)
297 xgifb_reg_set(P3c4
, 0x18, 0x01);
298 xgifb_reg_set(P3c4
, 0x19, 0x40);
299 xgifb_reg_set(P3c4
, 0x16, 0x00);
300 xgifb_reg_set(P3c4
, 0x16, 0x80);
303 xgifb_reg_set(P3c4
, 0x18, 0x00);
304 xgifb_reg_set(P3c4
, 0x19, 0x40);
305 xgifb_reg_set(P3c4
, 0x16, 0x00);
306 xgifb_reg_set(P3c4
, 0x16, 0x80);
308 xgifb_reg_set(P3c4
, 0x18, pVBInfo
->SR15
[2][XGINew_RAMType
]); /* SR18 */
309 /* xgifb_reg_set(P3c4, 0x18, 0x31); */
310 xgifb_reg_set(P3c4
, 0x19, 0x01);
311 xgifb_reg_set(P3c4
, 0x16, 0x03);
312 xgifb_reg_set(P3c4
, 0x16, 0x83);
314 xgifb_reg_set(P3c4
, 0x1B, 0x03);
316 /* xgifb_reg_set(P3c4, 0x18, 0x31); */
317 xgifb_reg_set(P3c4
, 0x18, pVBInfo
->SR15
[2][XGINew_RAMType
]); /* SR18 */
318 xgifb_reg_set(P3c4
, 0x19, 0x00);
319 xgifb_reg_set(P3c4
, 0x16, 0x03);
320 xgifb_reg_set(P3c4
, 0x16, 0x83);
321 xgifb_reg_set(P3c4
, 0x1B, 0x00);
324 static void XGINew_DDR1x_DefaultRegister(
325 struct xgi_hw_device_info
*HwDeviceExtension
,
326 unsigned long Port
, struct vb_device_info
*pVBInfo
)
328 unsigned long P3d4
= Port
, P3c4
= Port
- 0x10;
330 if (HwDeviceExtension
->jChipType
>= XG20
) {
331 XGINew_SetMemoryClock(HwDeviceExtension
, pVBInfo
);
334 pVBInfo
->CR40
[11][XGINew_RAMType
]); /* CR82 */
337 pVBInfo
->CR40
[12][XGINew_RAMType
]); /* CR85 */
340 pVBInfo
->CR40
[13][XGINew_RAMType
]); /* CR86 */
342 xgifb_reg_set(P3d4
, 0x98, 0x01);
343 xgifb_reg_set(P3d4
, 0x9A, 0x02);
345 XGINew_DDR1x_MRS_XG20(P3c4
, pVBInfo
);
347 XGINew_SetMemoryClock(HwDeviceExtension
, pVBInfo
);
349 switch (HwDeviceExtension
->jChipType
) {
355 pVBInfo
->CR40
[11][XGINew_RAMType
]);
359 pVBInfo
->CR40
[12][XGINew_RAMType
]);
363 pVBInfo
->CR40
[13][XGINew_RAMType
]);
366 xgifb_reg_set(P3d4
, 0x82, 0x88);
367 xgifb_reg_set(P3d4
, 0x86, 0x00);
368 /* Insert read command for delay */
369 xgifb_reg_get(P3d4
, 0x86);
370 xgifb_reg_set(P3d4
, 0x86, 0x88);
371 xgifb_reg_get(P3d4
, 0x86);
374 pVBInfo
->CR40
[13][XGINew_RAMType
]);
375 xgifb_reg_set(P3d4
, 0x82, 0x77);
376 xgifb_reg_set(P3d4
, 0x85, 0x00);
378 /* Insert read command for delay */
379 xgifb_reg_get(P3d4
, 0x85);
380 xgifb_reg_set(P3d4
, 0x85, 0x88);
382 /* Insert read command for delay */
383 xgifb_reg_get(P3d4
, 0x85);
387 pVBInfo
->CR40
[12][XGINew_RAMType
]);
391 pVBInfo
->CR40
[11][XGINew_RAMType
]);
395 xgifb_reg_set(P3d4
, 0x97, 0x00);
396 xgifb_reg_set(P3d4
, 0x98, 0x01);
397 xgifb_reg_set(P3d4
, 0x9A, 0x02);
398 XGINew_DDR1x_MRS_340(P3c4
, pVBInfo
);
402 static void XGINew_DDR2_DefaultRegister(
403 struct xgi_hw_device_info
*HwDeviceExtension
,
404 unsigned long Port
, struct vb_device_info
*pVBInfo
)
406 unsigned long P3d4
= Port
, P3c4
= Port
- 0x10;
408 /* keep following setting sequence, each setting in
409 * the same reg insert idle */
410 xgifb_reg_set(P3d4
, 0x82, 0x77);
411 xgifb_reg_set(P3d4
, 0x86, 0x00);
412 xgifb_reg_get(P3d4
, 0x86); /* Insert read command for delay */
413 xgifb_reg_set(P3d4
, 0x86, 0x88);
414 xgifb_reg_get(P3d4
, 0x86); /* Insert read command for delay */
416 xgifb_reg_set(P3d4
, 0x86, pVBInfo
->CR40
[13][XGINew_RAMType
]);
417 xgifb_reg_set(P3d4
, 0x82, 0x77);
418 xgifb_reg_set(P3d4
, 0x85, 0x00);
419 xgifb_reg_get(P3d4
, 0x85); /* Insert read command for delay */
420 xgifb_reg_set(P3d4
, 0x85, 0x88);
421 xgifb_reg_get(P3d4
, 0x85); /* Insert read command for delay */
422 xgifb_reg_set(P3d4
, 0x85, pVBInfo
->CR40
[12][XGINew_RAMType
]); /* CR85 */
423 if (HwDeviceExtension
->jChipType
== XG27
)
425 xgifb_reg_set(P3d4
, 0x82, pVBInfo
->CR40
[11][XGINew_RAMType
]);
427 xgifb_reg_set(P3d4
, 0x82, 0xA8); /* CR82 */
429 xgifb_reg_set(P3d4
, 0x98, 0x01);
430 xgifb_reg_set(P3d4
, 0x9A, 0x02);
431 if (HwDeviceExtension
->jChipType
== XG27
)
432 XGINew_DDRII_Bootup_XG27(HwDeviceExtension
, P3c4
, pVBInfo
);
434 XGINew_DDR2_MRS_XG20(HwDeviceExtension
, P3c4
, pVBInfo
);
437 static void XGINew_SetDRAMDefaultRegister340(
438 struct xgi_hw_device_info
*HwDeviceExtension
,
439 unsigned long Port
, struct vb_device_info
*pVBInfo
)
441 unsigned char temp
, temp1
, temp2
, temp3
, i
, j
, k
;
443 unsigned long P3d4
= Port
, P3c4
= Port
- 0x10;
445 xgifb_reg_set(P3d4
, 0x6D, pVBInfo
->CR40
[8][XGINew_RAMType
]);
446 xgifb_reg_set(P3d4
, 0x68, pVBInfo
->CR40
[5][XGINew_RAMType
]);
447 xgifb_reg_set(P3d4
, 0x69, pVBInfo
->CR40
[6][XGINew_RAMType
]);
448 xgifb_reg_set(P3d4
, 0x6A, pVBInfo
->CR40
[7][XGINew_RAMType
]);
451 for (i
= 0; i
< 4; i
++) {
452 /* CR6B DQS fine tune delay */
453 temp
= pVBInfo
->CR6B
[XGINew_RAMType
][i
];
454 for (j
= 0; j
< 4; j
++) {
455 temp1
= ((temp
>> (2 * j
)) & 0x03) << 2;
457 xgifb_reg_set(P3d4
, 0x6B, temp2
);
458 /* Insert read command for delay */
459 xgifb_reg_get(P3d4
, 0x6B);
466 for (i
= 0; i
< 4; i
++) {
467 /* CR6E DQM fine tune delay */
468 temp
= pVBInfo
->CR6E
[XGINew_RAMType
][i
];
469 for (j
= 0; j
< 4; j
++) {
470 temp1
= ((temp
>> (2 * j
)) & 0x03) << 2;
472 xgifb_reg_set(P3d4
, 0x6E, temp2
);
473 /* Insert read command for delay */
474 xgifb_reg_get(P3d4
, 0x6E);
481 for (k
= 0; k
< 4; k
++) {
482 /* CR6E_D[1:0] select channel */
483 xgifb_reg_and_or(P3d4
, 0x6E, 0xFC, temp3
);
485 for (i
= 0; i
< 8; i
++) {
486 /* CR6F DQ fine tune delay */
487 temp
= pVBInfo
->CR6F
[XGINew_RAMType
][8 * k
+ i
];
488 for (j
= 0; j
< 4; j
++) {
489 temp1
= (temp
>> (2 * j
)) & 0x03;
491 xgifb_reg_set(P3d4
, 0x6F, temp2
);
492 /* Insert read command for delay */
493 xgifb_reg_get(P3d4
, 0x6F);
501 xgifb_reg_set(P3d4
, 0x80, pVBInfo
->CR40
[9][XGINew_RAMType
]); /* CR80 */
502 xgifb_reg_set(P3d4
, 0x81, pVBInfo
->CR40
[10][XGINew_RAMType
]); /* CR81 */
505 /* CR89 terminator type select */
506 temp
= pVBInfo
->CR89
[XGINew_RAMType
][0];
507 for (j
= 0; j
< 4; j
++) {
508 temp1
= (temp
>> (2 * j
)) & 0x03;
510 xgifb_reg_set(P3d4
, 0x89, temp2
);
511 xgifb_reg_get(P3d4
, 0x89); /* Insert read command for delay */
516 temp
= pVBInfo
->CR89
[XGINew_RAMType
][1];
519 xgifb_reg_set(P3d4
, 0x89, temp2
);
521 temp
= pVBInfo
->CR40
[3][XGINew_RAMType
];
523 temp2
= (temp
>> 4) & 0x07;
525 xgifb_reg_set(P3d4
, 0x45, temp1
); /* CR45 */
526 xgifb_reg_set(P3d4
, 0x99, temp2
); /* CR99 */
527 xgifb_reg_or(P3d4
, 0x40, temp3
); /* CR40_D[7] */
528 xgifb_reg_set(P3d4
, 0x41, pVBInfo
->CR40
[0][XGINew_RAMType
]); /* CR41 */
530 if (HwDeviceExtension
->jChipType
== XG27
)
531 xgifb_reg_set(P3d4
, 0x8F, *pVBInfo
->pCR8F
); /* CR8F */
533 for (j
= 0; j
<= 6; j
++) /* CR90 - CR96 */
534 xgifb_reg_set(P3d4
, (0x90 + j
),
535 pVBInfo
->CR40
[14 + j
][XGINew_RAMType
]);
537 for (j
= 0; j
<= 2; j
++) /* CRC3 - CRC5 */
538 xgifb_reg_set(P3d4
, (0xC3 + j
),
539 pVBInfo
->CR40
[21 + j
][XGINew_RAMType
]);
541 for (j
= 0; j
< 2; j
++) /* CR8A - CR8B */
542 xgifb_reg_set(P3d4
, (0x8A + j
),
543 pVBInfo
->CR40
[1 + j
][XGINew_RAMType
]);
545 if ((HwDeviceExtension
->jChipType
== XG41
) ||
546 (HwDeviceExtension
->jChipType
== XG42
))
547 xgifb_reg_set(P3d4
, 0x8C, 0x87);
549 xgifb_reg_set(P3d4
, 0x59, pVBInfo
->CR40
[4][XGINew_RAMType
]); /* CR59 */
551 xgifb_reg_set(P3d4
, 0x83, 0x09); /* CR83 */
552 xgifb_reg_set(P3d4
, 0x87, 0x00); /* CR87 */
553 xgifb_reg_set(P3d4
, 0xCF, *pVBInfo
->pCRCF
); /* CRCF */
554 if (XGINew_RAMType
) {
555 /* xgifb_reg_set(P3c4, 0x17, 0xC0); */ /* SR17 DDRII */
556 xgifb_reg_set(P3c4
, 0x17, 0x80); /* SR17 DDRII */
557 if (HwDeviceExtension
->jChipType
== XG27
)
558 xgifb_reg_set(P3c4
, 0x17, 0x02); /* SR17 DDRII */
561 xgifb_reg_set(P3c4
, 0x17, 0x00); /* SR17 DDR */
563 xgifb_reg_set(P3c4
, 0x1A, 0x87); /* SR1A */
565 temp
= XGINew_GetXG20DRAMType(HwDeviceExtension
, pVBInfo
);
567 XGINew_DDR1x_DefaultRegister(HwDeviceExtension
, P3d4
, pVBInfo
);
569 xgifb_reg_set(P3d4
, 0xB0, 0x80); /* DDRII Dual frequency mode */
570 XGINew_DDR2_DefaultRegister(HwDeviceExtension
, P3d4
, pVBInfo
);
572 xgifb_reg_set(P3c4
, 0x1B, pVBInfo
->SR15
[3][XGINew_RAMType
]); /* SR1B */
575 static void XGINew_SetDRAMSizingType(int index
,
576 unsigned short DRAMTYPE_TABLE
[][5],
577 struct vb_device_info
*pVBInfo
)
581 data
= DRAMTYPE_TABLE
[index
][4];
582 xgifb_reg_and_or(pVBInfo
->P3c4
, 0x13, 0x80, data
);
584 /* should delay 50 ns */
587 static unsigned short XGINew_SetDRAMSizeReg(int index
,
588 unsigned short DRAMTYPE_TABLE
[][5],
589 struct vb_device_info
*pVBInfo
)
591 unsigned short data
= 0, memsize
= 0;
593 unsigned char ChannelNo
;
595 RankSize
= DRAMTYPE_TABLE
[index
][3] * XGINew_DataBusWidth
/ 32;
596 data
= xgifb_reg_get(pVBInfo
->P3c4
, 0x13);
604 if (XGINew_ChannelAB
== 3)
607 ChannelNo
= XGINew_ChannelAB
;
609 if (ChannelNo
* RankSize
<= 256) {
610 while ((RankSize
>>= 1) > 0)
615 /* [2004/03/25] Vicent, Fix DRAM Sizing Error */
616 xgifb_reg_set(pVBInfo
->P3c4
,
618 (xgifb_reg_get(pVBInfo
->P3c4
, 0x14) & 0x0F) |
621 /* data |= XGINew_ChannelAB << 2; */
622 /* data |= (XGINew_DataBusWidth / 64) << 1; */
623 /* xgifb_reg_set(pVBInfo->P3c4, 0x14, data); */
626 /* XGINew_SetDRAMModeRegister340(pVBInfo); */
631 static unsigned short XGINew_SetDRAMSize20Reg(int index
,
632 unsigned short DRAMTYPE_TABLE
[][5],
633 struct vb_device_info
*pVBInfo
)
635 unsigned short data
= 0, memsize
= 0;
637 unsigned char ChannelNo
;
639 RankSize
= DRAMTYPE_TABLE
[index
][3] * XGINew_DataBusWidth
/ 8;
640 data
= xgifb_reg_get(pVBInfo
->P3c4
, 0x13);
648 if (XGINew_ChannelAB
== 3)
651 ChannelNo
= XGINew_ChannelAB
;
653 if (ChannelNo
* RankSize
<= 256) {
654 while ((RankSize
>>= 1) > 0)
659 /* [2004/03/25] Vicent, Fix DRAM Sizing Error */
660 xgifb_reg_set(pVBInfo
->P3c4
,
662 (xgifb_reg_get(pVBInfo
->P3c4
, 0x14) & 0x0F) |
666 /* data |= XGINew_ChannelAB << 2; */
667 /* data |= (XGINew_DataBusWidth / 64) << 1; */
668 /* xgifb_reg_set(pVBInfo->P3c4, 0x14, data); */
671 /* XGINew_SetDRAMModeRegister340(pVBInfo); */
676 static int XGINew_ReadWriteRest(unsigned short StopAddr
,
677 unsigned short StartAddr
, struct vb_device_info
*pVBInfo
)
680 unsigned long Position
= 0;
681 void __iomem
*fbaddr
= pVBInfo
->FBAddr
;
683 writel(Position
, fbaddr
+ Position
);
685 for (i
= StartAddr
; i
<= StopAddr
; i
++) {
687 writel(Position
, fbaddr
+ Position
);
690 udelay(500); /* [Vicent] 2004/04/16.
691 Fix #1759 Memory Size error in Multi-Adapter. */
695 if (readl(fbaddr
+ Position
) != Position
)
698 for (i
= StartAddr
; i
<= StopAddr
; i
++) {
700 if (readl(fbaddr
+ Position
) != Position
)
706 static unsigned char XGINew_CheckFrequence(struct vb_device_info
*pVBInfo
)
710 data
= xgifb_reg_get(pVBInfo
->P3d4
, 0x97);
712 if ((data
& 0x10) == 0) {
713 data
= xgifb_reg_get(pVBInfo
->P3c4
, 0x39);
714 data
= (data
& 0x02) >> 1;
721 static void XGINew_CheckChannel(struct xgi_hw_device_info
*HwDeviceExtension
,
722 struct vb_device_info
*pVBInfo
)
726 switch (HwDeviceExtension
->jChipType
) {
729 data
= xgifb_reg_get(pVBInfo
->P3d4
, 0x97);
731 XGINew_ChannelAB
= 1; /* XG20 "JUST" one channel */
733 if (data
== 0) { /* Single_32_16 */
735 if ((HwDeviceExtension
->ulVideoMemorySize
- 1)
738 XGINew_DataBusWidth
= 32; /* 32 bits */
739 /* 22bit + 2 rank + 32bit */
740 xgifb_reg_set(pVBInfo
->P3c4
, 0x13, 0xB1);
741 xgifb_reg_set(pVBInfo
->P3c4
, 0x14, 0x52);
744 if (XGINew_ReadWriteRest(24, 23, pVBInfo
) == 1)
747 if ((HwDeviceExtension
->ulVideoMemorySize
- 1) >
749 /* 22bit + 1 rank + 32bit */
750 xgifb_reg_set(pVBInfo
->P3c4
,
753 xgifb_reg_set(pVBInfo
->P3c4
,
758 if (XGINew_ReadWriteRest(23,
765 if ((HwDeviceExtension
->ulVideoMemorySize
- 1) >
767 XGINew_DataBusWidth
= 16; /* 16 bits */
768 /* 22bit + 2 rank + 16bit */
769 xgifb_reg_set(pVBInfo
->P3c4
, 0x13, 0xB1);
770 xgifb_reg_set(pVBInfo
->P3c4
, 0x14, 0x41);
773 if (XGINew_ReadWriteRest(23, 22, pVBInfo
) == 1)
776 xgifb_reg_set(pVBInfo
->P3c4
,
782 } else { /* Dual_16_8 */
783 if ((HwDeviceExtension
->ulVideoMemorySize
- 1) >
785 XGINew_DataBusWidth
= 16; /* 16 bits */
786 /* (0x31:12x8x2) 22bit + 2 rank */
787 xgifb_reg_set(pVBInfo
->P3c4
, 0x13, 0xB1);
789 xgifb_reg_set(pVBInfo
->P3c4
, 0x14, 0x41);
792 if (XGINew_ReadWriteRest(23, 22, pVBInfo
) == 1)
795 if ((HwDeviceExtension
->ulVideoMemorySize
- 1) >
797 /* (0x31:12x8x2) 22bit + 1 rank */
798 xgifb_reg_set(pVBInfo
->P3c4
,
802 xgifb_reg_set(pVBInfo
->P3c4
,
807 if (XGINew_ReadWriteRest(22,
814 if ((HwDeviceExtension
->ulVideoMemorySize
- 1) >
816 XGINew_DataBusWidth
= 8; /* 8 bits */
817 /* (0x31:12x8x2) 22bit + 2 rank */
818 xgifb_reg_set(pVBInfo
->P3c4
, 0x13, 0xB1);
820 xgifb_reg_set(pVBInfo
->P3c4
, 0x14, 0x30);
823 if (XGINew_ReadWriteRest(22, 21, pVBInfo
) == 1)
825 else /* (0x31:12x8x2) 22bit + 1 rank */
826 xgifb_reg_set(pVBInfo
->P3c4
,
835 XGINew_DataBusWidth
= 16; /* 16 bits */
836 XGINew_ChannelAB
= 1; /* Single channel */
837 xgifb_reg_set(pVBInfo
->P3c4
, 0x14, 0x51); /* 32Mx16 bit*/
840 if (XGINew_CheckFrequence(pVBInfo
) == 1) {
841 XGINew_DataBusWidth
= 32; /* 32 bits */
842 XGINew_ChannelAB
= 3; /* Quad Channel */
843 xgifb_reg_set(pVBInfo
->P3c4
, 0x13, 0xA1);
844 xgifb_reg_set(pVBInfo
->P3c4
, 0x14, 0x4C);
846 if (XGINew_ReadWriteRest(25, 23, pVBInfo
) == 1)
849 XGINew_ChannelAB
= 2; /* Dual channels */
850 xgifb_reg_set(pVBInfo
->P3c4
, 0x14, 0x48);
852 if (XGINew_ReadWriteRest(24, 23, pVBInfo
) == 1)
855 xgifb_reg_set(pVBInfo
->P3c4
, 0x14, 0x49);
857 if (XGINew_ReadWriteRest(24, 23, pVBInfo
) == 1)
860 XGINew_ChannelAB
= 3;
861 xgifb_reg_set(pVBInfo
->P3c4
, 0x13, 0x21);
862 xgifb_reg_set(pVBInfo
->P3c4
, 0x14, 0x3C);
864 if (XGINew_ReadWriteRest(24, 23, pVBInfo
) == 1)
867 xgifb_reg_set(pVBInfo
->P3c4
, 0x14, 0x38);
869 if (XGINew_ReadWriteRest(8, 4, pVBInfo
) == 1)
872 xgifb_reg_set(pVBInfo
->P3c4
, 0x14, 0x39);
874 XGINew_DataBusWidth
= 64; /* 64 bits */
875 XGINew_ChannelAB
= 2; /* Dual channels */
876 xgifb_reg_set(pVBInfo
->P3c4
, 0x13, 0xA1);
877 xgifb_reg_set(pVBInfo
->P3c4
, 0x14, 0x5A);
879 if (XGINew_ReadWriteRest(25, 24, pVBInfo
) == 1)
882 XGINew_ChannelAB
= 1; /* Single channels */
883 xgifb_reg_set(pVBInfo
->P3c4
, 0x14, 0x52);
885 if (XGINew_ReadWriteRest(24, 23, pVBInfo
) == 1)
888 xgifb_reg_set(pVBInfo
->P3c4
, 0x14, 0x53);
890 if (XGINew_ReadWriteRest(24, 23, pVBInfo
) == 1)
893 XGINew_ChannelAB
= 2; /* Dual channels */
894 xgifb_reg_set(pVBInfo
->P3c4
, 0x13, 0x21);
895 xgifb_reg_set(pVBInfo
->P3c4
, 0x14, 0x4A);
897 if (XGINew_ReadWriteRest(24, 23, pVBInfo
) == 1)
900 XGINew_ChannelAB
= 1; /* Single channels */
901 xgifb_reg_set(pVBInfo
->P3c4
, 0x14, 0x42);
903 if (XGINew_ReadWriteRest(8, 4, pVBInfo
) == 1)
906 xgifb_reg_set(pVBInfo
->P3c4
, 0x14, 0x43);
913 XG42 SR14 D[3] Reserve
914 D[2] = 1, Dual Channel
917 It's Different from Other XG40 Series.
919 if (XGINew_CheckFrequence(pVBInfo
) == 1) { /* DDRII, DDR2x */
920 XGINew_DataBusWidth
= 32; /* 32 bits */
921 XGINew_ChannelAB
= 2; /* 2 Channel */
922 xgifb_reg_set(pVBInfo
->P3c4
, 0x13, 0xA1);
923 xgifb_reg_set(pVBInfo
->P3c4
, 0x14, 0x44);
925 if (XGINew_ReadWriteRest(24, 23, pVBInfo
) == 1)
928 xgifb_reg_set(pVBInfo
->P3c4
, 0x13, 0x21);
929 xgifb_reg_set(pVBInfo
->P3c4
, 0x14, 0x34);
930 if (XGINew_ReadWriteRest(23, 22, pVBInfo
) == 1)
933 XGINew_ChannelAB
= 1; /* Single Channel */
934 xgifb_reg_set(pVBInfo
->P3c4
, 0x13, 0xA1);
935 xgifb_reg_set(pVBInfo
->P3c4
, 0x14, 0x40);
937 if (XGINew_ReadWriteRest(23, 22, pVBInfo
) == 1)
940 xgifb_reg_set(pVBInfo
->P3c4
, 0x13, 0x21);
941 xgifb_reg_set(pVBInfo
->P3c4
, 0x14, 0x30);
944 XGINew_DataBusWidth
= 64; /* 64 bits */
945 XGINew_ChannelAB
= 1; /* 1 channels */
946 xgifb_reg_set(pVBInfo
->P3c4
, 0x13, 0xA1);
947 xgifb_reg_set(pVBInfo
->P3c4
, 0x14, 0x52);
949 if (XGINew_ReadWriteRest(24, 23, pVBInfo
) == 1)
952 xgifb_reg_set(pVBInfo
->P3c4
, 0x13, 0x21);
953 xgifb_reg_set(pVBInfo
->P3c4
, 0x14, 0x42);
961 if (XGINew_CheckFrequence(pVBInfo
) == 1) { /* DDRII */
962 XGINew_DataBusWidth
= 32; /* 32 bits */
963 XGINew_ChannelAB
= 3;
964 xgifb_reg_set(pVBInfo
->P3c4
, 0x13, 0xA1);
965 xgifb_reg_set(pVBInfo
->P3c4
, 0x14, 0x4C);
967 if (XGINew_ReadWriteRest(25, 23, pVBInfo
) == 1)
970 XGINew_ChannelAB
= 2; /* 2 channels */
971 xgifb_reg_set(pVBInfo
->P3c4
, 0x14, 0x48);
973 if (XGINew_ReadWriteRest(24, 23, pVBInfo
) == 1)
976 xgifb_reg_set(pVBInfo
->P3c4
, 0x13, 0x21);
977 xgifb_reg_set(pVBInfo
->P3c4
, 0x14, 0x3C);
979 if (XGINew_ReadWriteRest(24, 23, pVBInfo
) == 1) {
980 XGINew_ChannelAB
= 3; /* 4 channels */
982 XGINew_ChannelAB
= 2; /* 2 channels */
983 xgifb_reg_set(pVBInfo
->P3c4
, 0x14, 0x38);
986 XGINew_DataBusWidth
= 64; /* 64 bits */
987 XGINew_ChannelAB
= 2; /* 2 channels */
988 xgifb_reg_set(pVBInfo
->P3c4
, 0x13, 0xA1);
989 xgifb_reg_set(pVBInfo
->P3c4
, 0x14, 0x5A);
991 if (XGINew_ReadWriteRest(25, 24, pVBInfo
) == 1) {
994 xgifb_reg_set(pVBInfo
->P3c4
, 0x13, 0x21);
995 xgifb_reg_set(pVBInfo
->P3c4
, 0x14, 0x4A);
1002 static int XGINew_DDRSizing340(struct xgi_hw_device_info
*HwDeviceExtension
,
1003 struct vb_device_info
*pVBInfo
)
1006 unsigned short memsize
, addr
;
1008 xgifb_reg_set(pVBInfo
->P3c4
, 0x15, 0x00); /* noninterleaving */
1009 xgifb_reg_set(pVBInfo
->P3c4
, 0x1C, 0x00); /* nontiling */
1010 XGINew_CheckChannel(HwDeviceExtension
, pVBInfo
);
1012 if (HwDeviceExtension
->jChipType
>= XG20
) {
1013 for (i
= 0; i
< 12; i
++) {
1014 XGINew_SetDRAMSizingType(i
,
1015 XGINew_DDRDRAM_TYPE20
,
1017 memsize
= XGINew_SetDRAMSize20Reg(i
,
1018 XGINew_DDRDRAM_TYPE20
,
1023 addr
= memsize
+ (XGINew_ChannelAB
- 2) + 20;
1024 if ((HwDeviceExtension
->ulVideoMemorySize
- 1) <
1025 (unsigned long) (1 << addr
))
1028 if (XGINew_ReadWriteRest(addr
, 5, pVBInfo
) == 1)
1032 for (i
= 0; i
< 4; i
++) {
1033 XGINew_SetDRAMSizingType(i
,
1034 XGINew_DDRDRAM_TYPE340
,
1036 memsize
= XGINew_SetDRAMSizeReg(i
,
1037 XGINew_DDRDRAM_TYPE340
,
1043 addr
= memsize
+ (XGINew_ChannelAB
- 2) + 20;
1044 if ((HwDeviceExtension
->ulVideoMemorySize
- 1) <
1045 (unsigned long) (1 << addr
))
1048 if (XGINew_ReadWriteRest(addr
, 9, pVBInfo
) == 1)
1055 static void XGINew_SetDRAMSize_340(struct xgi_hw_device_info
*HwDeviceExtension
,
1056 struct vb_device_info
*pVBInfo
)
1058 unsigned short data
;
1060 pVBInfo
->ROMAddr
= HwDeviceExtension
->pjVirtualRomBase
;
1061 pVBInfo
->FBAddr
= HwDeviceExtension
->pjVideoMemoryAddress
;
1063 XGISetModeNew(HwDeviceExtension
, 0x2e);
1065 data
= xgifb_reg_get(pVBInfo
->P3c4
, 0x21);
1066 /* disable read cache */
1067 xgifb_reg_set(pVBInfo
->P3c4
, 0x21, (unsigned short) (data
& 0xDF));
1068 XGI_DisplayOff(HwDeviceExtension
, pVBInfo
);
1070 /* data = xgifb_reg_get(pVBInfo->P3c4, 0x1); */
1071 /* data |= 0x20 ; */
1072 /* xgifb_reg_set(pVBInfo->P3c4, 0x01, data); *//* Turn OFF Display */
1073 XGINew_DDRSizing340(HwDeviceExtension
, pVBInfo
);
1074 data
= xgifb_reg_get(pVBInfo
->P3c4
, 0x21);
1075 /* enable read cache */
1076 xgifb_reg_set(pVBInfo
->P3c4
, 0x21, (unsigned short) (data
| 0x20));
1079 static void ReadVBIOSTablData(unsigned char ChipType
,
1080 struct vb_device_info
*pVBInfo
)
1082 volatile unsigned char *pVideoMemory
=
1083 (unsigned char *) pVBInfo
->ROMAddr
;
1086 /* Volari customize data area end */
1088 if (ChipType
== XG21
) {
1089 pVBInfo
->IF_DEF_LVDS
= 0;
1090 if (pVideoMemory
[0x65] & 0x1) {
1091 pVBInfo
->IF_DEF_LVDS
= 1;
1092 i
= pVideoMemory
[0x316] | (pVideoMemory
[0x317] << 8);
1093 j
= pVideoMemory
[i
- 1];
1097 pVBInfo
->XG21_LVDSCapList
[k
].
1100 (pVideoMemory
[i
+ 1] << 8);
1101 pVBInfo
->XG21_LVDSCapList
[k
].LVDSHT
1102 = pVideoMemory
[i
+ 2] |
1103 (pVideoMemory
[i
+ 3] << 8);
1104 pVBInfo
->XG21_LVDSCapList
[k
].LVDSVT
1105 = pVideoMemory
[i
+ 4] |
1106 (pVideoMemory
[i
+ 5] << 8);
1107 pVBInfo
->XG21_LVDSCapList
[k
].LVDSHDE
1108 = pVideoMemory
[i
+ 6] |
1109 (pVideoMemory
[i
+ 7] << 8);
1110 pVBInfo
->XG21_LVDSCapList
[k
].LVDSVDE
1111 = pVideoMemory
[i
+ 8] |
1112 (pVideoMemory
[i
+ 9] << 8);
1113 pVBInfo
->XG21_LVDSCapList
[k
].LVDSHFP
1114 = pVideoMemory
[i
+ 10] |
1115 (pVideoMemory
[i
+ 11] << 8);
1116 pVBInfo
->XG21_LVDSCapList
[k
].LVDSVFP
1117 = pVideoMemory
[i
+ 12] |
1118 (pVideoMemory
[i
+ 13] << 8);
1119 pVBInfo
->XG21_LVDSCapList
[k
].LVDSHSYNC
1120 = pVideoMemory
[i
+ 14] |
1121 (pVideoMemory
[i
+ 15] << 8);
1122 pVBInfo
->XG21_LVDSCapList
[k
].LVDSVSYNC
1123 = pVideoMemory
[i
+ 16] |
1124 (pVideoMemory
[i
+ 17] << 8);
1125 pVBInfo
->XG21_LVDSCapList
[k
].VCLKData1
1126 = pVideoMemory
[i
+ 18];
1127 pVBInfo
->XG21_LVDSCapList
[k
].VCLKData2
1128 = pVideoMemory
[i
+ 19];
1129 pVBInfo
->XG21_LVDSCapList
[k
].PSC_S1
1130 = pVideoMemory
[i
+ 20];
1131 pVBInfo
->XG21_LVDSCapList
[k
].PSC_S2
1132 = pVideoMemory
[i
+ 21];
1133 pVBInfo
->XG21_LVDSCapList
[k
].PSC_S3
1134 = pVideoMemory
[i
+ 22];
1135 pVBInfo
->XG21_LVDSCapList
[k
].PSC_S4
1136 = pVideoMemory
[i
+ 23];
1137 pVBInfo
->XG21_LVDSCapList
[k
].PSC_S5
1138 = pVideoMemory
[i
+ 24];
1143 (k
< (sizeof(XGI21_LCDCapList
) /
1145 XGI21_LVDSCapStruct
))));
1147 pVBInfo
->XG21_LVDSCapList
[0].LVDS_Capability
1149 (pVideoMemory
[i
+ 1] << 8);
1150 pVBInfo
->XG21_LVDSCapList
[0].LVDSHT
1151 = pVideoMemory
[i
+ 2] |
1152 (pVideoMemory
[i
+ 3] << 8);
1153 pVBInfo
->XG21_LVDSCapList
[0].LVDSVT
1154 = pVideoMemory
[i
+ 4] |
1155 (pVideoMemory
[i
+ 5] << 8);
1156 pVBInfo
->XG21_LVDSCapList
[0].LVDSHDE
1157 = pVideoMemory
[i
+ 6] |
1158 (pVideoMemory
[i
+ 7] << 8);
1159 pVBInfo
->XG21_LVDSCapList
[0].LVDSVDE
1160 = pVideoMemory
[i
+ 8] |
1161 (pVideoMemory
[i
+ 9] << 8);
1162 pVBInfo
->XG21_LVDSCapList
[0].LVDSHFP
1163 = pVideoMemory
[i
+ 10] |
1164 (pVideoMemory
[i
+ 11] << 8);
1165 pVBInfo
->XG21_LVDSCapList
[0].LVDSVFP
1166 = pVideoMemory
[i
+ 12] |
1167 (pVideoMemory
[i
+ 13] << 8);
1168 pVBInfo
->XG21_LVDSCapList
[0].LVDSHSYNC
1169 = pVideoMemory
[i
+ 14] |
1170 (pVideoMemory
[i
+ 15] << 8);
1171 pVBInfo
->XG21_LVDSCapList
[0].LVDSVSYNC
1172 = pVideoMemory
[i
+ 16] |
1173 (pVideoMemory
[i
+ 17] << 8);
1174 pVBInfo
->XG21_LVDSCapList
[0].VCLKData1
1175 = pVideoMemory
[i
+ 18];
1176 pVBInfo
->XG21_LVDSCapList
[0].VCLKData2
1177 = pVideoMemory
[i
+ 19];
1178 pVBInfo
->XG21_LVDSCapList
[0].PSC_S1
1179 = pVideoMemory
[i
+ 20];
1180 pVBInfo
->XG21_LVDSCapList
[0].PSC_S2
1181 = pVideoMemory
[i
+ 21];
1182 pVBInfo
->XG21_LVDSCapList
[0].PSC_S3
1183 = pVideoMemory
[i
+ 22];
1184 pVBInfo
->XG21_LVDSCapList
[0].PSC_S4
1185 = pVideoMemory
[i
+ 23];
1186 pVBInfo
->XG21_LVDSCapList
[0].PSC_S5
1187 = pVideoMemory
[i
+ 24];
1193 static void XGINew_ChkSenseStatus(struct xgi_hw_device_info
*HwDeviceExtension
,
1194 struct vb_device_info
*pVBInfo
)
1196 unsigned short tempbx
= 0, temp
, tempcx
, CR3CData
;
1198 temp
= xgifb_reg_get(pVBInfo
->P3d4
, 0x32);
1200 if (temp
& Monitor1Sense
)
1201 tempbx
|= ActiveCRT1
;
1202 if (temp
& LCDSense
)
1203 tempbx
|= ActiveLCD
;
1204 if (temp
& Monitor2Sense
)
1205 tempbx
|= ActiveCRT2
;
1206 if (temp
& TVSense
) {
1208 if (temp
& AVIDEOSense
)
1209 tempbx
|= (ActiveAVideo
<< 8);
1210 if (temp
& SVIDEOSense
)
1211 tempbx
|= (ActiveSVideo
<< 8);
1212 if (temp
& SCARTSense
)
1213 tempbx
|= (ActiveSCART
<< 8);
1214 if (temp
& HiTVSense
)
1215 tempbx
|= (ActiveHiTV
<< 8);
1216 if (temp
& YPbPrSense
)
1217 tempbx
|= (ActiveYPbPr
<< 8);
1220 tempcx
= xgifb_reg_get(pVBInfo
->P3d4
, 0x3d);
1221 tempcx
|= (xgifb_reg_get(pVBInfo
->P3d4
, 0x3e) << 8);
1223 if (tempbx
& tempcx
) {
1224 CR3CData
= xgifb_reg_get(pVBInfo
->P3d4
, 0x3c);
1225 if (!(CR3CData
& DisplayDeviceFromCMOS
)) {
1227 if (*pVBInfo
->pSoftSetting
& ModeSoftSetting
)
1232 if (*pVBInfo
->pSoftSetting
& ModeSoftSetting
)
1237 xgifb_reg_set(pVBInfo
->P3d4
, 0x3d, (tempbx
& 0x00FF));
1238 xgifb_reg_set(pVBInfo
->P3d4
, 0x3e, ((tempbx
& 0xFF00) >> 8));
1241 static void XGINew_SetModeScratch(struct xgi_hw_device_info
*HwDeviceExtension
,
1242 struct vb_device_info
*pVBInfo
)
1244 unsigned short temp
, tempcl
= 0, tempch
= 0, CR31Data
, CR38Data
;
1246 temp
= xgifb_reg_get(pVBInfo
->P3d4
, 0x3d);
1247 temp
|= xgifb_reg_get(pVBInfo
->P3d4
, 0x3e) << 8;
1248 temp
|= (xgifb_reg_get(pVBInfo
->P3d4
, 0x31) & (DriverMode
>> 8)) << 8;
1250 if (pVBInfo
->IF_DEF_CRT2Monitor
== 1) {
1251 if (temp
& ActiveCRT2
)
1252 tempcl
= SetCRT2ToRAMDAC
;
1255 if (temp
& ActiveLCD
) {
1256 tempcl
|= SetCRT2ToLCD
;
1257 if (temp
& DriverMode
) {
1258 if (temp
& ActiveTV
) {
1259 tempch
= SetToLCDA
| EnableDualEdge
;
1260 temp
^= SetCRT2ToLCD
;
1262 if ((temp
>> 8) & ActiveAVideo
)
1263 tempcl
|= SetCRT2ToAVIDEO
;
1264 if ((temp
>> 8) & ActiveSVideo
)
1265 tempcl
|= SetCRT2ToSVIDEO
;
1266 if ((temp
>> 8) & ActiveSCART
)
1267 tempcl
|= SetCRT2ToSCART
;
1269 if (pVBInfo
->IF_DEF_HiVision
== 1) {
1270 if ((temp
>> 8) & ActiveHiTV
)
1271 tempcl
|= SetCRT2ToHiVisionTV
;
1274 if (pVBInfo
->IF_DEF_YPbPr
== 1) {
1275 if ((temp
>> 8) & ActiveYPbPr
)
1281 if ((temp
>> 8) & ActiveAVideo
)
1282 tempcl
|= SetCRT2ToAVIDEO
;
1283 if ((temp
>> 8) & ActiveSVideo
)
1284 tempcl
|= SetCRT2ToSVIDEO
;
1285 if ((temp
>> 8) & ActiveSCART
)
1286 tempcl
|= SetCRT2ToSCART
;
1288 if (pVBInfo
->IF_DEF_HiVision
== 1) {
1289 if ((temp
>> 8) & ActiveHiTV
)
1290 tempcl
|= SetCRT2ToHiVisionTV
;
1293 if (pVBInfo
->IF_DEF_YPbPr
== 1) {
1294 if ((temp
>> 8) & ActiveYPbPr
)
1299 tempcl
|= SetSimuScanMode
;
1300 if ((!(temp
& ActiveCRT1
)) && ((temp
& ActiveLCD
) || (temp
& ActiveTV
)
1301 || (temp
& ActiveCRT2
)))
1302 tempcl
^= (SetSimuScanMode
| SwitchToCRT2
);
1303 if ((temp
& ActiveLCD
) && (temp
& ActiveTV
))
1304 tempcl
^= (SetSimuScanMode
| SwitchToCRT2
);
1305 xgifb_reg_set(pVBInfo
->P3d4
, 0x30, tempcl
);
1307 CR31Data
= xgifb_reg_get(pVBInfo
->P3d4
, 0x31);
1308 CR31Data
&= ~(SetNotSimuMode
>> 8);
1309 if (!(temp
& ActiveCRT1
))
1310 CR31Data
|= (SetNotSimuMode
>> 8);
1311 CR31Data
&= ~(DisableCRT2Display
>> 8);
1312 if (!((temp
& ActiveLCD
) || (temp
& ActiveTV
) || (temp
& ActiveCRT2
)))
1313 CR31Data
|= (DisableCRT2Display
>> 8);
1314 xgifb_reg_set(pVBInfo
->P3d4
, 0x31, CR31Data
);
1316 CR38Data
= xgifb_reg_get(pVBInfo
->P3d4
, 0x38);
1317 CR38Data
&= ~SetYPbPr
;
1319 xgifb_reg_set(pVBInfo
->P3d4
, 0x38, CR38Data
);
1323 static void XGINew_GetXG21Sense(struct xgi_hw_device_info
*HwDeviceExtension
,
1324 struct vb_device_info
*pVBInfo
)
1327 volatile unsigned char *pVideoMemory
=
1328 (unsigned char *) pVBInfo
->ROMAddr
;
1330 pVBInfo
->IF_DEF_LVDS
= 0;
1333 if ((pVideoMemory
[0x65] & 0x01)) { /* For XG21 LVDS */
1334 pVBInfo
->IF_DEF_LVDS
= 1;
1335 xgifb_reg_or(pVBInfo
->P3d4
, 0x32, LCDSense
);
1337 xgifb_reg_and_or(pVBInfo
->P3d4
, 0x38, ~0xE0, 0xC0);
1340 /* Enable GPIOA/B read */
1341 xgifb_reg_and_or(pVBInfo
->P3d4
, 0x4A, ~0x03, 0x03);
1342 Temp
= xgifb_reg_get(pVBInfo
->P3d4
, 0x48) & 0xC0;
1343 if (Temp
== 0xC0) { /* DVI & DVO GPIOA/B pull high */
1344 XGINew_SenseLCD(HwDeviceExtension
, pVBInfo
);
1345 xgifb_reg_or(pVBInfo
->P3d4
, 0x32, LCDSense
);
1346 /* Enable read GPIOF */
1347 xgifb_reg_and_or(pVBInfo
->P3d4
, 0x4A, ~0x20, 0x20);
1348 Temp
= xgifb_reg_get(pVBInfo
->P3d4
, 0x48) & 0x04;
1350 xgifb_reg_and_or(pVBInfo
->P3d4
,
1353 0x80); /* TMDS on chip */
1355 xgifb_reg_and_or(pVBInfo
->P3d4
,
1358 0xA0); /* Only DVO on chip */
1359 /* Disable read GPIOF */
1360 xgifb_reg_and(pVBInfo
->P3d4
, 0x4A, ~0x20);
1367 static void XGINew_GetXG27Sense(struct xgi_hw_device_info
*HwDeviceExtension
,
1368 struct vb_device_info
*pVBInfo
)
1370 unsigned char Temp
, bCR4A
;
1372 pVBInfo
->IF_DEF_LVDS
= 0;
1373 bCR4A
= xgifb_reg_get(pVBInfo
->P3d4
, 0x4A);
1374 /* Enable GPIOA/B/C read */
1375 xgifb_reg_and_or(pVBInfo
->P3d4
, 0x4A, ~0x07, 0x07);
1376 Temp
= xgifb_reg_get(pVBInfo
->P3d4
, 0x48) & 0x07;
1377 xgifb_reg_set(pVBInfo
->P3d4
, 0x4A, bCR4A
);
1380 pVBInfo
->IF_DEF_LVDS
= 1;
1382 xgifb_reg_and_or(pVBInfo
->P3d4
, 0x38, ~0xE0, 0xC0);
1383 xgifb_reg_set(pVBInfo
->P3d4
, 0x30, 0x21);
1385 /* TMDS/DVO setting */
1386 xgifb_reg_and_or(pVBInfo
->P3d4
, 0x38, ~0xE0, 0xA0);
1388 xgifb_reg_or(pVBInfo
->P3d4
, 0x32, LCDSense
);
1392 static unsigned char GetXG21FPBits(struct vb_device_info
*pVBInfo
)
1394 unsigned char CR38
, CR4A
, temp
;
1396 CR4A
= xgifb_reg_get(pVBInfo
->P3d4
, 0x4A);
1397 /* enable GPIOE read */
1398 xgifb_reg_and_or(pVBInfo
->P3d4
, 0x4A, ~0x10, 0x10);
1399 CR38
= xgifb_reg_get(pVBInfo
->P3d4
, 0x38);
1401 if ((CR38
& 0xE0) > 0x80) {
1402 temp
= xgifb_reg_get(pVBInfo
->P3d4
, 0x48);
1407 xgifb_reg_set(pVBInfo
->P3d4
, 0x4A, CR4A
);
1412 static unsigned char GetXG27FPBits(struct vb_device_info
*pVBInfo
)
1414 unsigned char CR4A
, temp
;
1416 CR4A
= xgifb_reg_get(pVBInfo
->P3d4
, 0x4A);
1417 /* enable GPIOA/B/C read */
1418 xgifb_reg_and_or(pVBInfo
->P3d4
, 0x4A, ~0x03, 0x03);
1419 temp
= xgifb_reg_get(pVBInfo
->P3d4
, 0x48);
1423 temp
= ((temp
& 0x04) >> 1) || ((~temp
) & 0x01);
1425 xgifb_reg_set(pVBInfo
->P3d4
, 0x4A, CR4A
);
1430 unsigned char XGIInitNew(struct xgi_hw_device_info
*HwDeviceExtension
)
1432 struct vb_device_info VBINF
;
1433 struct vb_device_info
*pVBInfo
= &VBINF
;
1434 unsigned char i
, temp
= 0, temp1
;
1435 /* VBIOSVersion[5]; */
1436 volatile unsigned char *pVideoMemory
;
1438 /* unsigned long j, k; */
1442 pVBInfo
->ROMAddr
= HwDeviceExtension
->pjVirtualRomBase
;
1444 pVBInfo
->FBAddr
= HwDeviceExtension
->pjVideoMemoryAddress
;
1446 pVBInfo
->BaseAddr
= (unsigned long) HwDeviceExtension
->pjIOAddress
;
1448 pVideoMemory
= (unsigned char *) pVBInfo
->ROMAddr
;
1450 /* Newdebugcode(0x99); */
1453 /* if (pVBInfo->ROMAddr == 0) */
1456 if (pVBInfo
->FBAddr
== NULL
) {
1457 printk("\n pVBInfo->FBAddr == 0 ");
1461 if (pVBInfo
->BaseAddr
== 0) {
1462 printk("\npVBInfo->BaseAddr == 0 ");
1467 outb(0x67, (pVBInfo
->BaseAddr
+ 0x12)); /* 3c2 <- 67 ,ynlai */
1469 pVBInfo
->ISXPDOS
= 0;
1474 /* VBIOSVersion[4] = 0x0; */
1476 /* 09/07/99 modify by domao */
1478 pVBInfo
->P3c4
= pVBInfo
->BaseAddr
+ 0x14;
1479 pVBInfo
->P3d4
= pVBInfo
->BaseAddr
+ 0x24;
1480 pVBInfo
->P3c0
= pVBInfo
->BaseAddr
+ 0x10;
1481 pVBInfo
->P3ce
= pVBInfo
->BaseAddr
+ 0x1e;
1482 pVBInfo
->P3c2
= pVBInfo
->BaseAddr
+ 0x12;
1483 pVBInfo
->P3ca
= pVBInfo
->BaseAddr
+ 0x1a;
1484 pVBInfo
->P3c6
= pVBInfo
->BaseAddr
+ 0x16;
1485 pVBInfo
->P3c7
= pVBInfo
->BaseAddr
+ 0x17;
1486 pVBInfo
->P3c8
= pVBInfo
->BaseAddr
+ 0x18;
1487 pVBInfo
->P3c9
= pVBInfo
->BaseAddr
+ 0x19;
1488 pVBInfo
->P3da
= pVBInfo
->BaseAddr
+ 0x2A;
1489 pVBInfo
->Part0Port
= pVBInfo
->BaseAddr
+ XGI_CRT2_PORT_00
;
1490 pVBInfo
->Part1Port
= pVBInfo
->BaseAddr
+ XGI_CRT2_PORT_04
;
1491 pVBInfo
->Part2Port
= pVBInfo
->BaseAddr
+ XGI_CRT2_PORT_10
;
1492 pVBInfo
->Part3Port
= pVBInfo
->BaseAddr
+ XGI_CRT2_PORT_12
;
1493 pVBInfo
->Part4Port
= pVBInfo
->BaseAddr
+ XGI_CRT2_PORT_14
;
1494 pVBInfo
->Part5Port
= pVBInfo
->BaseAddr
+ XGI_CRT2_PORT_14
+ 2;
1497 if (HwDeviceExtension
->jChipType
< XG20
) /* kuku 2004/06/25 */
1498 /* Run XGI_GetVBType before InitTo330Pointer */
1499 XGI_GetVBType(pVBInfo
);
1501 InitTo330Pointer(HwDeviceExtension
->jChipType
, pVBInfo
);
1504 ReadVBIOSTablData(HwDeviceExtension
->jChipType
, pVBInfo
);
1507 xgifb_reg_set(pVBInfo
->P3c4
, 0x05, 0x86);
1510 /* GetXG21Sense (GPIO) */
1511 if (HwDeviceExtension
->jChipType
== XG21
)
1512 XGINew_GetXG21Sense(HwDeviceExtension
, pVBInfo
);
1514 if (HwDeviceExtension
->jChipType
== XG27
)
1515 XGINew_GetXG27Sense(HwDeviceExtension
, pVBInfo
);
1519 /* 2.Reset Extended register */
1521 for (i
= 0x06; i
< 0x20; i
++)
1522 xgifb_reg_set(pVBInfo
->P3c4
, i
, 0);
1524 for (i
= 0x21; i
<= 0x27; i
++)
1525 xgifb_reg_set(pVBInfo
->P3c4
, i
, 0);
1527 /* for(i = 0x06; i <= 0x27; i++) */
1528 /* xgifb_reg_set(pVBInfo->P3c4, i, 0); */
1532 for (i
= 0x31; i
<= 0x3B; i
++)
1533 xgifb_reg_set(pVBInfo
->P3c4
, i
, 0);
1536 /* [Hsuan] 2004/08/20 Auto over driver for XG42 */
1537 if (HwDeviceExtension
->jChipType
== XG42
)
1538 xgifb_reg_set(pVBInfo
->P3c4
, 0x3B, 0xC0);
1540 /* for (i = 0x30; i <= 0x3F; i++) */
1541 /* xgifb_reg_set(pVBInfo->P3d4, i, 0); */
1543 for (i
= 0x79; i
<= 0x7C; i
++)
1544 xgifb_reg_set(pVBInfo
->P3d4
, i
, 0); /* shampoo 0208 */
1548 if (HwDeviceExtension
->jChipType
>= XG20
)
1549 xgifb_reg_set(pVBInfo
->P3d4
, 0x97, *pVBInfo
->pXGINew_CR97
);
1553 XGINew_RAMType = (int)XGINew_GetXG20DRAMType(HwDeviceExtension,
1559 /* 4.SetDefExt1Regs begin */
1560 xgifb_reg_set(pVBInfo
->P3c4
, 0x07, *pVBInfo
->pSR07
);
1561 if (HwDeviceExtension
->jChipType
== XG27
) {
1562 xgifb_reg_set(pVBInfo
->P3c4
, 0x40, *pVBInfo
->pSR40
);
1563 xgifb_reg_set(pVBInfo
->P3c4
, 0x41, *pVBInfo
->pSR41
);
1565 xgifb_reg_set(pVBInfo
->P3c4
, 0x11, 0x0F);
1566 xgifb_reg_set(pVBInfo
->P3c4
, 0x1F, *pVBInfo
->pSR1F
);
1567 /* xgifb_reg_set(pVBInfo->P3c4, 0x20, 0x20); */
1568 /* alan, 2001/6/26 Frame buffer can read/write SR20 */
1569 xgifb_reg_set(pVBInfo
->P3c4
, 0x20, 0xA0);
1570 /* Hsuan, 2006/01/01 H/W request for slow corner chip */
1571 xgifb_reg_set(pVBInfo
->P3c4
, 0x36, 0x70);
1572 if (HwDeviceExtension
->jChipType
== XG27
) /* Alan 12/07/2006 */
1573 xgifb_reg_set(pVBInfo
->P3c4
, 0x36, *pVBInfo
->pSR36
);
1576 /* xgifb_reg_set(pVBInfo->P3c4, 0x11, SR11); */
1580 if (HwDeviceExtension
->jChipType
< XG20
) { /* kuku 2004/06/25 */
1583 temp1 = xgifb_reg_get(pVBInfo->P3c4, 0x3B);
1585 if (temp1 == 0x02) {
1586 outl(0x80000000, 0xcf8);
1587 ChipsetID = inl(0x0cfc);
1588 outl(0x8000002C, 0xcf8);
1589 VendorID = inl(0x0cfc);
1590 VendorID &= 0x0000FFFF;
1591 outl(0x8001002C, 0xcf8);
1592 GraphicVendorID = inl(0x0cfc);
1593 GraphicVendorID &= 0x0000FFFF;
1595 if (ChipsetID == 0x7301039)
1596 xgifb_reg_set(pVBInfo->P3d4, 0x5F, 0x09);
1598 ChipsetID &= 0x0000FFFF;
1600 if ((ChipsetID == 0x700E) ||
1601 (ChipsetID == 0x1022) ||
1602 (ChipsetID == 0x1106) ||
1603 (ChipsetID == 0x10DE)) {
1604 if (ChipsetID == 0x1106) {
1605 if ((VendorID == 0x1019) &&
1606 (GraphicVendorID == 0x1019))
1607 xgifb_reg_set(pVBInfo->P3d4,
1611 xgifb_reg_set(pVBInfo->P3d4,
1615 xgifb_reg_set(pVBInfo->P3d4,
1625 /* Set AGP customize registers (in SetDefAGPRegs) Start */
1626 for (i
= 0x47; i
<= 0x4C; i
++)
1627 xgifb_reg_set(pVBInfo
->P3d4
,
1629 pVBInfo
->AGPReg
[i
- 0x47]);
1631 for (i
= 0x70; i
<= 0x71; i
++)
1632 xgifb_reg_set(pVBInfo
->P3d4
,
1634 pVBInfo
->AGPReg
[6 + i
- 0x70]);
1636 for (i
= 0x74; i
<= 0x77; i
++)
1637 xgifb_reg_set(pVBInfo
->P3d4
,
1639 pVBInfo
->AGPReg
[8 + i
- 0x74]);
1640 /* Set AGP customize registers (in SetDefAGPRegs) End */
1641 /* [Hsuan]2004/12/14 AGP Input Delay Adjustment on 850 */
1642 /* outl(0x80000000, 0xcf8); */
1643 /* ChipsetID = inl(0x0cfc); */
1644 /* if (ChipsetID == 0x25308086) */
1645 /* xgifb_reg_set(pVBInfo->P3d4, 0x77, 0xF0); */
1647 HwDeviceExtension
->pQueryVGAConfigSpace(HwDeviceExtension
,
1655 xgifb_reg_set(pVBInfo
->P3d4
, 0x48, 0x20); /* CR48 */
1660 xgifb_reg_set(pVBInfo
->P3c4
, 0x23, *pVBInfo
->pSR23
);
1661 xgifb_reg_set(pVBInfo
->P3c4
, 0x24, *pVBInfo
->pSR24
);
1662 xgifb_reg_set(pVBInfo
->P3c4
, 0x25, pVBInfo
->SR25
[0]);
1665 if (HwDeviceExtension
->jChipType
< XG20
) { /* kuku 2004/06/25 */
1667 XGI_UnLockCRT2(HwDeviceExtension
, pVBInfo
);
1668 /* alan, disable VideoCapture */
1669 xgifb_reg_and_or(pVBInfo
->Part0Port
, 0x3F, 0xEF, 0x00);
1670 xgifb_reg_set(pVBInfo
->Part1Port
, 0x00, 0x00);
1671 /* chk if BCLK>=100MHz */
1672 temp1
= (unsigned char) xgifb_reg_get(pVBInfo
->P3d4
, 0x7B);
1673 temp
= (unsigned char) ((temp1
>> 4) & 0x0F);
1675 xgifb_reg_set(pVBInfo
->Part1Port
,
1677 (*pVBInfo
->pCRT2Data_1_2
));
1681 xgifb_reg_set(pVBInfo
->Part1Port
, 0x2E, 0x08); /* use VB */
1684 xgifb_reg_set(pVBInfo
->P3c4
, 0x27, 0x1F);
1686 if ((HwDeviceExtension
->jChipType
== XG42
) &&
1687 XGINew_GetXG20DRAMType(HwDeviceExtension
, pVBInfo
) != 0) {
1689 xgifb_reg_set(pVBInfo
->P3c4
,
1691 (*pVBInfo
->pSR31
& 0x3F) | 0x40);
1692 xgifb_reg_set(pVBInfo
->P3c4
,
1694 (*pVBInfo
->pSR32
& 0xFC) | 0x01);
1696 xgifb_reg_set(pVBInfo
->P3c4
, 0x31, *pVBInfo
->pSR31
);
1697 xgifb_reg_set(pVBInfo
->P3c4
, 0x32, *pVBInfo
->pSR32
);
1699 xgifb_reg_set(pVBInfo
->P3c4
, 0x33, *pVBInfo
->pSR33
);
1703 SetPowerConsume (HwDeviceExtension, pVBInfo->P3c4); */
1705 if (HwDeviceExtension
->jChipType
< XG20
) { /* kuku 2004/06/25 */
1706 if (XGI_BridgeIsOn(pVBInfo
) == 1) {
1707 if (pVBInfo
->IF_DEF_LVDS
== 0) {
1708 xgifb_reg_set(pVBInfo
->Part2Port
, 0x00, 0x1C);
1709 xgifb_reg_set(pVBInfo
->Part4Port
,
1711 *pVBInfo
->pCRT2Data_4_D
);
1712 xgifb_reg_set(pVBInfo
->Part4Port
,
1714 *pVBInfo
->pCRT2Data_4_E
);
1715 xgifb_reg_set(pVBInfo
->Part4Port
,
1717 *pVBInfo
->pCRT2Data_4_10
);
1718 xgifb_reg_set(pVBInfo
->Part4Port
, 0x0F, 0x3F);
1721 XGI_LockCRT2(HwDeviceExtension
, pVBInfo
);
1730 XGI_SenseCRT1(pVBInfo
);
1733 /* XGINew_DetectMonitor(HwDeviceExtension); */
1734 if (HwDeviceExtension
->jChipType
== XG21
) {
1737 xgifb_reg_and_or(pVBInfo
->P3d4
,
1740 Monitor1Sense
); /* Z9 default has CRT */
1741 temp
= GetXG21FPBits(pVBInfo
);
1742 xgifb_reg_and_or(pVBInfo
->P3d4
, 0x37, ~0x01, temp
);
1746 if (HwDeviceExtension
->jChipType
== XG27
) {
1747 xgifb_reg_and_or(pVBInfo
->P3d4
,
1750 Monitor1Sense
); /* Z9 default has CRT */
1751 temp
= GetXG27FPBits(pVBInfo
);
1752 xgifb_reg_and_or(pVBInfo
->P3d4
, 0x37, ~0x03, temp
);
1756 XGINew_RAMType
= (int) XGINew_GetXG20DRAMType(HwDeviceExtension
,
1759 XGINew_SetDRAMDefaultRegister340(HwDeviceExtension
,
1764 XGINew_SetDRAMSize_340(HwDeviceExtension
, pVBInfo
);
1769 /* SetDefExt2Regs begin */
1772 temp = (unsigned char) xgifb_reg_get(pVBInfo->P3c4, 0x3A);
1778 *pVBInfo->pSR21 &= 0xEF;
1780 xgifb_reg_set(pVBInfo->P3c4, 0x21, *pVBInfo->pSR21);
1782 *pVBInfo->pSR22 &= 0x20;
1783 xgifb_reg_set(pVBInfo->P3c4, 0x22, *pVBInfo->pSR22);
1785 /* base = 0x80000000; */
1786 /* OutPortLong(0xcf8, base); */
1787 /* Temp = (InPortLong(0xcfc) & 0xFFFF); */
1788 /* if (Temp == 0x1039) { */
1789 xgifb_reg_set(pVBInfo
->P3c4
,
1791 (unsigned char) ((*pVBInfo
->pSR22
) & 0xFE));
1793 /* xgifb_reg_set(pVBInfo->P3c4, 0x22, *pVBInfo->pSR22); */
1796 xgifb_reg_set(pVBInfo
->P3c4
, 0x21, *pVBInfo
->pSR21
);
1800 XGINew_ChkSenseStatus(HwDeviceExtension
, pVBInfo
);
1801 XGINew_SetModeScratch(HwDeviceExtension
, pVBInfo
);
1805 xgifb_reg_set(pVBInfo
->P3d4
, 0x8c, 0x87);
1806 xgifb_reg_set(pVBInfo
->P3c4
, 0x14, 0x31);