5 /* ------------------- Constant Definitions ------------------------- */
12 //#define LINUXBIOS /* turn this on when compiling for LINUXBIOS */
13 #define AGPOFF /* default is turn off AGP */
15 #define XGIFAIL(x) do { printk(x "\n"); return -EINVAL; } while(0)
21 #define DRIVER_DESC "XGI Volari Frame Buffer Module Version 0.8.1"
23 #ifndef PCI_VENDOR_ID_XG
24 #define PCI_VENDOR_ID_XG 0x18CA
27 #ifndef PCI_DEVICE_ID_XG_40
28 #define PCI_DEVICE_ID_XG_40 0x040
30 #ifndef PCI_DEVICE_ID_XG_41
31 #define PCI_DEVICE_ID_XG_41 0x041
33 #ifndef PCI_DEVICE_ID_XG_42
34 #define PCI_DEVICE_ID_XG_42 0x042
36 #ifndef PCI_DEVICE_ID_XG_20
37 #define PCI_DEVICE_ID_XG_20 0x020
39 #ifndef PCI_DEVICE_ID_XG_27
40 #define PCI_DEVICE_ID_XG_27 0x027
45 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,8)
46 #define XGI_IOTYPE1 void __iomem
47 #define XGI_IOTYPE2 __iomem
48 #define XGIINITSTATIC static
50 #define XGI_IOTYPE1 unsigned char
55 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
56 static struct pci_device_id __devinitdata xgifb_pci_table[] = {
58 { PCI_VENDOR_ID_XG, PCI_DEVICE_ID_XG_20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
59 { PCI_VENDOR_ID_XG, PCI_DEVICE_ID_XG_27, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1},
60 { PCI_VENDOR_ID_XG, PCI_DEVICE_ID_XG_40, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2},
61 { PCI_VENDOR_ID_XG, PCI_DEVICE_ID_XG_42, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 3},
65 MODULE_DEVICE_TABLE(pci, xgifb_pci_table);
67 /* To be included in fb.h */
68 #ifndef FB_ACCEL_XGI_GLAMOUR_2
69 #define FB_ACCEL_XGI_GLAMOUR_2 40 /* XGI 315, 650, 740 */
71 #ifndef FB_ACCEL_XGI_XABRE
72 #define FB_ACCEL_XGI_XABRE 41 /* XGI 330 ("Xabre") */
75 #define MAX_ROM_SCAN 0x10000
77 #define HW_CURSOR_CAP 0x80
78 #define TURBO_QUEUE_CAP 0x40
79 #define AGP_CMD_QUEUE_CAP 0x20
80 #define VM_CMD_QUEUE_CAP 0x10
81 #define MMIO_CMD_QUEUE_CAP 0x08
87 #define COMMAND_QUEUE_AREA_SIZE 0x80000 /* 512K */
88 #define COMMAND_QUEUE_THRESHOLD 0x1F
92 #define HW_CURSOR_AREA_SIZE_315 0x4000 /* 16K */
93 #define HW_CURSOR_AREA_SIZE_300 0x1000 /* 4K */
95 #define OH_ALLOC_SIZE 4000
96 #define SENTINEL 0x7fffffff
101 #define DAC_DATA 0x19
102 #define CRTC_ADR 0x24
103 #define CRTC_DATA 0x25
104 #define DAC2_ADR (0x16-0x30)
105 #define DAC2_DATA (0x17-0x30)
106 #define VB_PART1_ADR (0x04-0x30)
107 #define VB_PART1_DATA (0x05-0x30)
108 #define VB_PART2_ADR (0x10-0x30)
109 #define VB_PART2_DATA (0x11-0x30)
110 #define VB_PART3_ADR (0x12-0x30)
111 #define VB_PART3_DATA (0x13-0x30)
112 #define VB_PART4_ADR (0x14-0x30)
113 #define VB_PART4_DATA (0x15-0x30)
115 #define XGISR XGI_Pr.P3c4
116 #define XGICR XGI_Pr.P3d4
117 #define XGIDACA XGI_Pr.P3c8
118 #define XGIDACD XGI_Pr.P3c9
119 #define XGIPART1 XGI_Pr.Part1Port
120 #define XGIPART2 XGI_Pr.Part2Port
121 #define XGIPART3 XGI_Pr.Part3Port
122 #define XGIPART4 XGI_Pr.Part4Port
123 #define XGIPART5 XGI_Pr.Part5Port
124 #define XGIDAC2A XGIPART5
125 #define XGIDAC2D (XGIPART5 + 1)
126 #define XGIMISCR (XGI_Pr.RelIO + 0x1c)
127 #define XGIINPSTAT (XGI_Pr.RelIO + 0x2a)
129 #define IND_XGI_PASSWORD 0x05 /* SRs */
130 #define IND_XGI_COLOR_MODE 0x06
131 #define IND_XGI_RAMDAC_CONTROL 0x07
132 #define IND_XGI_DRAM_SIZE 0x14
133 #define IND_XGI_SCRATCH_REG_16 0x16
134 #define IND_XGI_SCRATCH_REG_17 0x17
135 #define IND_XGI_SCRATCH_REG_1A 0x1A
136 #define IND_XGI_MODULE_ENABLE 0x1E
137 #define IND_XGI_PCI_ADDRESS_SET 0x20
138 #define IND_XGI_TURBOQUEUE_ADR 0x26
139 #define IND_XGI_TURBOQUEUE_SET 0x27
140 #define IND_XGI_POWER_ON_TRAP 0x38
141 #define IND_XGI_POWER_ON_TRAP2 0x39
142 #define IND_XGI_CMDQUEUE_SET 0x26
143 #define IND_XGI_CMDQUEUE_THRESHOLD 0x27
145 #define IND_XGI_SCRATCH_REG_CR30 0x30 /* CRs */
146 #define IND_XGI_SCRATCH_REG_CR31 0x31
147 #define IND_XGI_SCRATCH_REG_CR32 0x32
148 #define IND_XGI_SCRATCH_REG_CR33 0x33
149 #define IND_XGI_LCD_PANEL 0x36
150 #define IND_XGI_SCRATCH_REG_CR37 0x37
151 #define IND_XGI_AGP_IO_PAD 0x48
153 #define IND_BRI_DRAM_STATUS 0x63 /* PCI config memory size offset */
155 #define MMIO_QUEUE_PHYBASE 0x85C0
156 #define MMIO_QUEUE_WRITEPORT 0x85C4
157 #define MMIO_QUEUE_READPORT 0x85C8
159 #define IND_XGI_CRT2_WRITE_ENABLE_300 0x24
160 #define IND_XGI_CRT2_WRITE_ENABLE_315 0x2F
162 #define XGI_PASSWORD 0x86 /* SR05 */
163 #define XGI_INTERLACED_MODE 0x20 /* SR06 */
164 #define XGI_8BPP_COLOR_MODE 0x0
165 #define XGI_15BPP_COLOR_MODE 0x1
166 #define XGI_16BPP_COLOR_MODE 0x2
167 #define XGI_32BPP_COLOR_MODE 0x4
169 #define XGI_DRAM_SIZE_MASK 0xF0 /*SR14 */
170 #define XGI_DRAM_SIZE_1MB 0x00
171 #define XGI_DRAM_SIZE_2MB 0x01
172 #define XGI_DRAM_SIZE_4MB 0x02
173 #define XGI_DRAM_SIZE_8MB 0x03
174 #define XGI_DRAM_SIZE_16MB 0x04
175 #define XGI_DRAM_SIZE_32MB 0x05
176 #define XGI_DRAM_SIZE_64MB 0x06
177 #define XGI_DRAM_SIZE_128MB 0x07
178 #define XGI_DRAM_SIZE_256MB 0x08
179 #define XGI_DATA_BUS_MASK 0x02
180 #define XGI_DATA_BUS_64 0x00
181 #define XGI_DATA_BUS_128 0x01
182 #define XGI_DUAL_CHANNEL_MASK 0x0C
183 #define XGI_SINGLE_CHANNEL_1_RANK 0x0
184 #define XGI_SINGLE_CHANNEL_2_RANK 0x1
185 #define XGI_ASYM_DDR 0x02
186 #define XGI_DUAL_CHANNEL_1_RANK 0x3
188 #define XGI550_DRAM_SIZE_MASK 0x3F /* 550/650/740 SR14 */
189 #define XGI550_DRAM_SIZE_4MB 0x00
190 #define XGI550_DRAM_SIZE_8MB 0x01
191 #define XGI550_DRAM_SIZE_16MB 0x03
192 #define XGI550_DRAM_SIZE_24MB 0x05
193 #define XGI550_DRAM_SIZE_32MB 0x07
194 #define XGI550_DRAM_SIZE_64MB 0x0F
195 #define XGI550_DRAM_SIZE_96MB 0x17
196 #define XGI550_DRAM_SIZE_128MB 0x1F
197 #define XGI550_DRAM_SIZE_256MB 0x3F
199 #define XGI_SCRATCH_REG_1A_MASK 0x10
201 #define XGI_ENABLE_2D 0x40 /* SR1E */
203 #define XGI_MEM_MAP_IO_ENABLE 0x01 /* SR20 */
204 #define XGI_PCI_ADDR_ENABLE 0x80
206 #define XGI_AGP_CMDQUEUE_ENABLE 0x80 /* 315/650/740 SR26 */
207 #define XGI_VRAM_CMDQUEUE_ENABLE 0x40
208 #define XGI_MMIO_CMD_ENABLE 0x20
209 #define XGI_CMD_QUEUE_SIZE_512k 0x00
210 #define XGI_CMD_QUEUE_SIZE_1M 0x04
211 #define XGI_CMD_QUEUE_SIZE_2M 0x08
212 #define XGI_CMD_QUEUE_SIZE_4M 0x0C
213 #define XGI_CMD_QUEUE_RESET 0x01
214 #define XGI_CMD_AUTO_CORR 0x02
216 #define XGI_SIMULTANEOUS_VIEW_ENABLE 0x01 /* CR30 */
217 #define XGI_MODE_SELECT_CRT2 0x02
218 #define XGI_VB_OUTPUT_COMPOSITE 0x04
219 #define XGI_VB_OUTPUT_SVIDEO 0x08
220 #define XGI_VB_OUTPUT_SCART 0x10
221 #define XGI_VB_OUTPUT_LCD 0x20
222 #define XGI_VB_OUTPUT_CRT2 0x40
223 #define XGI_VB_OUTPUT_HIVISION 0x80
225 #define XGI_VB_OUTPUT_DISABLE 0x20 /* CR31 */
226 #define XGI_DRIVER_MODE 0x40
228 #define XGI_VB_COMPOSITE 0x01 /* CR32 */
229 #define XGI_VB_SVIDEO 0x02
230 #define XGI_VB_SCART 0x04
231 #define XGI_VB_LCD 0x08
232 #define XGI_VB_CRT2 0x10
233 #define XGI_CRT1 0x20
234 #define XGI_VB_HIVISION 0x40
235 #define XGI_VB_YPBPR 0x80
236 #define XGI_VB_TV (XGI_VB_COMPOSITE | XGI_VB_SVIDEO | \
237 XGI_VB_SCART | XGI_VB_HIVISION|XGI_VB_YPBPR)
239 #define XGI_EXTERNAL_CHIP_MASK 0x0E /* CR37 */
240 #define XGI_EXTERNAL_CHIP_XGI301 0x01 /* in CR37 << 1 ! */
241 #define XGI_EXTERNAL_CHIP_LVDS 0x02 /* in CR37 << 1 ! */
242 #define XGI_EXTERNAL_CHIP_TRUMPION 0x03 /* in CR37 << 1 ! */
243 #define XGI_EXTERNAL_CHIP_LVDS_CHRONTEL 0x04 /* in CR37 << 1 ! */
244 #define XGI_EXTERNAL_CHIP_CHRONTEL 0x05 /* in CR37 << 1 ! */
245 #define XGI310_EXTERNAL_CHIP_LVDS 0x02 /* in CR37 << 1 ! */
246 #define XGI310_EXTERNAL_CHIP_LVDS_CHRONTEL 0x03 /* in CR37 << 1 ! */
248 #define XGI_AGP_2X 0x20 /* CR48 */
250 #define BRI_DRAM_SIZE_MASK 0x70 /* PCI bridge config data */
251 #define BRI_DRAM_SIZE_2MB 0x00
252 #define BRI_DRAM_SIZE_4MB 0x01
253 #define BRI_DRAM_SIZE_8MB 0x02
254 #define BRI_DRAM_SIZE_16MB 0x03
255 #define BRI_DRAM_SIZE_32MB 0x04
256 #define BRI_DRAM_SIZE_64MB 0x05
258 #define HW_DEVICE_EXTENSION XGI_HW_DEVICE_INFO
259 #define PHW_DEVICE_EXTENSION PXGI_HW_DEVICE_INFO
261 #define SR_BUFFER_SIZE 5
262 #define CR_BUFFER_SIZE 5
265 #define inXGIREG(base) inb(base)
266 #define outXGIREG(base,val) outb(val,base)
267 #define orXGIREG(base,val) do { \
268 unsigned char __Temp = inb(base); \
269 outXGIREG(base, __Temp | (val)); \
271 #define andXGIREG(base,val) do { \
272 unsigned char __Temp = inb(base); \
273 outXGIREG(base, __Temp & (val)); \
275 #define inXGIIDXREG(base,idx,var) do { \
276 outb(idx,base); var=inb((base)+1); \
278 #define outXGIIDXREG(base,idx,val) do { \
279 outb(idx,base); outb((val),(base)+1); \
281 #define orXGIIDXREG(base,idx,val) do { \
282 unsigned char __Temp; \
284 __Temp = inb((base)+1)|(val); \
285 outXGIIDXREG(base,idx,__Temp); \
287 #define andXGIIDXREG(base,idx,and) do { \
288 unsigned char __Temp; \
290 __Temp = inb((base)+1)&(and); \
291 outXGIIDXREG(base,idx,__Temp); \
293 #define setXGIIDXREG(base,idx,and,or) do { \
294 unsigned char __Temp; \
296 __Temp = (inb((base)+1)&(and))|(or); \
297 outXGIIDXREG(base,idx,__Temp); \
300 /* ------------------- Global Variables ----------------------------- */
302 /* Fbcon variables */
303 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
304 static struct fb_info* fb_info;
306 static struct fb_info XGI_fb_info;
310 static int video_type = FB_TYPE_PACKED_PIXELS;
312 static struct fb_var_screeninfo default_var = {
326 .activate = FB_ACTIVATE_NOW,
338 .vmode = FB_VMODE_NONINTERLACED,
339 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
340 .reserved = {0, 0, 0, 0, 0, 0}
344 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
345 static struct fb_fix_screeninfo XGIfb_fix = {
347 .type = FB_TYPE_PACKED_PIXELS,
351 static char myid[20];
352 static u32 pseudo_palette[17];
355 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
356 static struct display XGI_disp;
358 static struct display_switch XGIfb_sw;
361 u16 blue, green, red, pad;
365 #ifdef FBCON_HAS_CFB16
368 #ifdef FBCON_HAS_CFB32
373 static int XGIfb_inverse = 0;
377 static int XGIfb_off = 0;
378 static int XGIfb_crt1off = 0;
379 static int XGIfb_forcecrt1 = -1;
380 static int XGIvga_enabled = 0;
381 static int XGIfb_userom = 0;
382 //static int XGIfb_useoem = -1;
383 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
384 static int currcon = 0;
388 static int XGIfb_registered;
389 static int XGIfb_tvmode = 0;
390 static int XGIfb_mem = 0;
391 static int XGIfb_pdc = 0;
392 static int enable_dstn = 0;
393 static int XGIfb_ypan = -1;
399 static int XGIfb_hwcursor_size = 0;
400 static int XGIfb_CRT2_write_enable = 0;
402 int XGIfb_crt2type = -1; /* TW: CRT2 type (for overriding autodetection) */
403 int XGIfb_tvplug = -1; /* PR: Tv plug type (for overriding autodetection) */
405 int XGIfb_queuemode = -1; /* TW: Use MMIO queue mode by default (310/325 series only) */
407 unsigned char XGIfb_detectedpdc = 0;
409 unsigned char XGIfb_detectedlcda = 0xff;
414 /* TW: For ioctl XGIFB_GET_INFO */
415 /* XGIfb_info XGIfbinfo; */
417 /* TW: Hardware extension; contains data on hardware */
418 HW_DEVICE_EXTENSION XGIhw_ext;
420 /* TW: XGI private structure */
421 VB_DEVICE_INFO XGI_Pr;
423 /* card parameters */
424 static unsigned long XGIfb_mmio_size = 0;
425 static u8 XGIfb_caps = 0;
427 typedef enum _XGI_CMDTYPE {
437 /* NOT const - will be patched for 1280x960 mode number chaos reasons */
438 struct _XGIbios_mode {
441 u16 vesa_mode_no_1; /* "XGI defined" VESA mode number */
442 u16 vesa_mode_no_2; /* Real VESA mode numbers */
451 #define MODE_INDEX_NONE 0 /* TW: index for mode=none */
452 {"none", 0xFF, 0x0000, 0x0000, 0, 0, 0, 0, 0, 0, MD_XGI300|MD_XGI315}, /* TW: for mode "none" */
453 {"320x240x16", 0x56, 0x0000, 0x0000, 320, 240, 16, 1, 40, 15, MD_XGI315},
454 {"320x480x8", 0x5A, 0x0000, 0x0000, 320, 480, 8, 1, 40, 30, MD_XGI315}, /* TW: FSTN */
455 {"320x480x16", 0x5B, 0x0000, 0x0000, 320, 480, 16, 1, 40, 30, MD_XGI315}, /* TW: FSTN */
456 {"640x480x8", 0x2E, 0x0101, 0x0101, 640, 480, 8, 1, 80, 30, MD_XGI300|MD_XGI315},
457 {"640x480x16", 0x44, 0x0111, 0x0111, 640, 480, 16, 1, 80, 30, MD_XGI300|MD_XGI315},
458 {"640x480x24", 0x62, 0x013a, 0x0112, 640, 480, 32, 1, 80, 30, MD_XGI300|MD_XGI315}, /* TW: That's for people who mix up color- and fb depth */
459 {"640x480x32", 0x62, 0x013a, 0x0112, 640, 480, 32, 1, 80, 30, MD_XGI300|MD_XGI315},
460 {"720x480x8", 0x31, 0x0000, 0x0000, 720, 480, 8, 1, 90, 30, MD_XGI300|MD_XGI315},
461 {"720x480x16", 0x33, 0x0000, 0x0000, 720, 480, 16, 1, 90, 30, MD_XGI300|MD_XGI315},
462 {"720x480x24", 0x35, 0x0000, 0x0000, 720, 480, 32, 1, 90, 30, MD_XGI300|MD_XGI315},
463 {"720x480x32", 0x35, 0x0000, 0x0000, 720, 480, 32, 1, 90, 30, MD_XGI300|MD_XGI315},
464 {"720x576x8", 0x32, 0x0000, 0x0000, 720, 576, 8, 1, 90, 36, MD_XGI300|MD_XGI315},
465 {"720x576x16", 0x34, 0x0000, 0x0000, 720, 576, 16, 1, 90, 36, MD_XGI300|MD_XGI315},
466 {"720x576x24", 0x36, 0x0000, 0x0000, 720, 576, 32, 1, 90, 36, MD_XGI300|MD_XGI315},
467 {"720x576x32", 0x36, 0x0000, 0x0000, 720, 576, 32, 1, 90, 36, MD_XGI300|MD_XGI315},
468 {"800x480x8", 0x70, 0x0000, 0x0000, 800, 480, 8, 1, 100, 30, MD_XGI300|MD_XGI315},
469 {"800x480x16", 0x7a, 0x0000, 0x0000, 800, 480, 16, 1, 100, 30, MD_XGI300|MD_XGI315},
470 {"800x480x24", 0x76, 0x0000, 0x0000, 800, 480, 32, 1, 100, 30, MD_XGI300|MD_XGI315},
471 {"800x480x32", 0x76, 0x0000, 0x0000, 800, 480, 32, 1, 100, 30, MD_XGI300|MD_XGI315},
472 #define DEFAULT_MODE 21 /* TW: index for 800x600x8 */
473 #define DEFAULT_LCDMODE 21 /* TW: index for 800x600x8 */
474 #define DEFAULT_TVMODE 21 /* TW: index for 800x600x8 */
475 {"800x600x8", 0x30, 0x0103, 0x0103, 800, 600, 8, 1, 100, 37, MD_XGI300|MD_XGI315},
476 {"800x600x16", 0x47, 0x0114, 0x0114, 800, 600, 16, 1, 100, 37, MD_XGI300|MD_XGI315},
477 {"800x600x24", 0x63, 0x013b, 0x0115, 800, 600, 32, 1, 100, 37, MD_XGI300|MD_XGI315},
478 {"800x600x32", 0x63, 0x013b, 0x0115, 800, 600, 32, 1, 100, 37, MD_XGI300|MD_XGI315},
479 {"1024x576x8", 0x71, 0x0000, 0x0000, 1024, 576, 8, 1, 128, 36, MD_XGI300|MD_XGI315},
480 {"1024x576x16", 0x74, 0x0000, 0x0000, 1024, 576, 16, 1, 128, 36, MD_XGI300|MD_XGI315},
481 {"1024x576x24", 0x77, 0x0000, 0x0000, 1024, 576, 32, 1, 128, 36, MD_XGI300|MD_XGI315},
482 {"1024x576x32", 0x77, 0x0000, 0x0000, 1024, 576, 32, 1, 128, 36, MD_XGI300|MD_XGI315},
483 {"1024x600x8", 0x20, 0x0000, 0x0000, 1024, 600, 8, 1, 128, 37, MD_XGI300 }, /* TW: 300 series only */
484 {"1024x600x16", 0x21, 0x0000, 0x0000, 1024, 600, 16, 1, 128, 37, MD_XGI300 },
485 {"1024x600x24", 0x22, 0x0000, 0x0000, 1024, 600, 32, 1, 128, 37, MD_XGI300 },
486 {"1024x600x32", 0x22, 0x0000, 0x0000, 1024, 600, 32, 1, 128, 37, MD_XGI300 },
487 {"1024x768x8", 0x38, 0x0105, 0x0105, 1024, 768, 8, 1, 128, 48, MD_XGI300|MD_XGI315},
488 {"1024x768x16", 0x4A, 0x0117, 0x0117, 1024, 768, 16, 1, 128, 48, MD_XGI300|MD_XGI315},
489 {"1024x768x24", 0x64, 0x013c, 0x0118, 1024, 768, 32, 1, 128, 48, MD_XGI300|MD_XGI315},
490 {"1024x768x32", 0x64, 0x013c, 0x0118, 1024, 768, 32, 1, 128, 48, MD_XGI300|MD_XGI315},
491 {"1152x768x8", 0x23, 0x0000, 0x0000, 1152, 768, 8, 1, 144, 48, MD_XGI300 }, /* TW: 300 series only */
492 {"1152x768x16", 0x24, 0x0000, 0x0000, 1152, 768, 16, 1, 144, 48, MD_XGI300 },
493 {"1152x768x24", 0x25, 0x0000, 0x0000, 1152, 768, 32, 1, 144, 48, MD_XGI300 },
494 {"1152x768x32", 0x25, 0x0000, 0x0000, 1152, 768, 32, 1, 144, 48, MD_XGI300 },
495 {"1280x720x8", 0x79, 0x0000, 0x0000, 1280, 720, 8, 1, 160, 45, MD_XGI300|MD_XGI315},
496 {"1280x720x16", 0x75, 0x0000, 0x0000, 1280, 720, 16, 1, 160, 45, MD_XGI300|MD_XGI315},
497 {"1280x720x24", 0x78, 0x0000, 0x0000, 1280, 720, 32, 1, 160, 45, MD_XGI300|MD_XGI315},
498 {"1280x720x32", 0x78, 0x0000, 0x0000, 1280, 720, 32, 1, 160, 45, MD_XGI300|MD_XGI315},
499 {"1280x768x8", 0x23, 0x0000, 0x0000, 1280, 768, 8, 1, 160, 48, MD_XGI315}, /* TW: 310/325 series only */
500 {"1280x768x16", 0x24, 0x0000, 0x0000, 1280, 768, 16, 1, 160, 48, MD_XGI315},
501 {"1280x768x24", 0x25, 0x0000, 0x0000, 1280, 768, 32, 1, 160, 48, MD_XGI315},
502 {"1280x768x32", 0x25, 0x0000, 0x0000, 1280, 768, 32, 1, 160, 48, MD_XGI315},
503 #define MODEINDEX_1280x960 48
504 {"1280x960x8", 0x7C, 0x0000, 0x0000, 1280, 960, 8, 1, 160, 60, MD_XGI300|MD_XGI315}, /* TW: Modenumbers being patched */
505 {"1280x960x16", 0x7D, 0x0000, 0x0000, 1280, 960, 16, 1, 160, 60, MD_XGI300|MD_XGI315},
506 {"1280x960x24", 0x7E, 0x0000, 0x0000, 1280, 960, 32, 1, 160, 60, MD_XGI300|MD_XGI315},
507 {"1280x960x32", 0x7E, 0x0000, 0x0000, 1280, 960, 32, 1, 160, 60, MD_XGI300|MD_XGI315},
508 {"1280x1024x8", 0x3A, 0x0107, 0x0107, 1280, 1024, 8, 1, 160, 64, MD_XGI300|MD_XGI315},
509 {"1280x1024x16", 0x4D, 0x011a, 0x011a, 1280, 1024, 16, 1, 160, 64, MD_XGI300|MD_XGI315},
510 {"1280x1024x24", 0x65, 0x013d, 0x011b, 1280, 1024, 32, 1, 160, 64, MD_XGI300|MD_XGI315},
511 {"1280x1024x32", 0x65, 0x013d, 0x011b, 1280, 1024, 32, 1, 160, 64, MD_XGI300|MD_XGI315},
512 {"1400x1050x8", 0x26, 0x0000, 0x0000, 1400, 1050, 8, 1, 175, 65, MD_XGI315}, /* TW: 310/325 series only */
513 {"1400x1050x16", 0x27, 0x0000, 0x0000, 1400, 1050, 16, 1, 175, 65, MD_XGI315},
514 {"1400x1050x24", 0x28, 0x0000, 0x0000, 1400, 1050, 32, 1, 175, 65, MD_XGI315},
515 {"1400x1050x32", 0x28, 0x0000, 0x0000, 1400, 1050, 32, 1, 175, 65, MD_XGI315},
516 {"1600x1200x8", 0x3C, 0x0130, 0x011c, 1600, 1200, 8, 1, 200, 75, MD_XGI300|MD_XGI315},
517 {"1600x1200x16", 0x3D, 0x0131, 0x011e, 1600, 1200, 16, 1, 200, 75, MD_XGI300|MD_XGI315},
518 {"1600x1200x24", 0x66, 0x013e, 0x011f, 1600, 1200, 32, 1, 200, 75, MD_XGI300|MD_XGI315},
519 {"1600x1200x32", 0x66, 0x013e, 0x011f, 1600, 1200, 32, 1, 200, 75, MD_XGI300|MD_XGI315},
520 {"1920x1440x8", 0x68, 0x013f, 0x0000, 1920, 1440, 8, 1, 240, 75, MD_XGI300|MD_XGI315},
521 {"1920x1440x16", 0x69, 0x0140, 0x0000, 1920, 1440, 16, 1, 240, 75, MD_XGI300|MD_XGI315},
522 {"1920x1440x24", 0x6B, 0x0141, 0x0000, 1920, 1440, 32, 1, 240, 75, MD_XGI300|MD_XGI315},
523 {"1920x1440x32", 0x6B, 0x0141, 0x0000, 1920, 1440, 32, 1, 240, 75, MD_XGI300|MD_XGI315},
524 {"2048x1536x8", 0x6c, 0x0000, 0x0000, 2048, 1536, 8, 1, 256, 96, MD_XGI315}, /* TW: 310/325 series only */
525 {"2048x1536x16", 0x6d, 0x0000, 0x0000, 2048, 1536, 16, 1, 256, 96, MD_XGI315},
526 {"2048x1536x24", 0x6e, 0x0000, 0x0000, 2048, 1536, 32, 1, 256, 96, MD_XGI315},
527 {"2048x1536x32", 0x6e, 0x0000, 0x0000, 2048, 1536, 32, 1, 256, 96, MD_XGI315},
528 {"\0", 0x00, 0, 0, 0, 0, 0, 0, 0}
531 /* mode-related variables */
533 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
534 static int xgifb_mode_idx = 1;
536 static int XGIfb_mode_idx = MODE_INDEX_NONE; /* Don't use a mode by default if we are a module */
539 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
540 static int xgifb_mode_idx = -1; /* Use a default mode if we are inside the kernel */
542 static int XGIfb_mode_idx = -1;
545 u8 XGIfb_mode_no = 0;
546 u8 XGIfb_rate_idx = 0;
548 /* TW: CR36 evaluation */
549 const USHORT XGI300paneltype[] =
550 { LCD_UNKNOWN, LCD_800x600, LCD_1024x768, LCD_1280x1024,
551 LCD_1280x960, LCD_640x480, LCD_1024x600, LCD_1152x768,
552 LCD_1024x768, LCD_1024x768, LCD_1024x768,
553 LCD_1024x768, LCD_1024x768, LCD_1024x768, LCD_1024x768 };
555 const USHORT XGI310paneltype[] =
556 { LCD_UNKNOWN, LCD_800x600, LCD_1024x768, LCD_1280x1024,
557 LCD_640x480, LCD_1024x600, LCD_1152x864, LCD_1280x960,
558 LCD_1152x768, LCD_1400x1050,LCD_1280x768, LCD_1600x1200,
559 LCD_1024x768, LCD_1024x768, LCD_1024x768 };
561 static const struct _XGI_crt2type {
567 {"LCD", DISPTYPE_LCD, -1},
568 {"TV", DISPTYPE_TV, -1},
569 {"VGA", DISPTYPE_CRT2, -1},
570 {"SVIDEO", DISPTYPE_TV, TVPLUG_SVIDEO},
571 {"COMPOSITE", DISPTYPE_TV, TVPLUG_COMPOSITE},
572 {"SCART", DISPTYPE_TV, TVPLUG_SCART},
574 {"lcd", DISPTYPE_LCD, -1},
575 {"tv", DISPTYPE_TV, -1},
576 {"vga", DISPTYPE_CRT2, -1},
577 {"svideo", DISPTYPE_TV, TVPLUG_SVIDEO},
578 {"composite", DISPTYPE_TV, TVPLUG_COMPOSITE},
579 {"scart", DISPTYPE_TV, TVPLUG_SCART},
583 /* Queue mode selection for 310 series */
584 static const struct _XGI_queuemode {
587 } XGI_queuemode[] = {
588 {"AGP", AGP_CMD_QUEUE},
589 {"VRAM", VM_CMD_QUEUE},
591 {"agp", AGP_CMD_QUEUE},
592 {"vram", VM_CMD_QUEUE},
598 static const struct _XGI_tvtype {
609 static const struct _XGI_vrate {
615 {1, 640, 480, 60}, {2, 640, 480, 72}, {3, 640, 480, 75}, {4, 640, 480, 85},
616 {5, 640, 480,100}, {6, 640, 480, 120}, {7, 640, 480, 160}, {8, 640, 480, 200},
619 {1, 800, 480, 60}, {2, 800, 480, 75}, {3, 800, 480, 85},
620 {1, 800, 600, 60}, {2, 800, 600, 72}, {3, 800, 600, 75},
621 {4, 800, 600, 85}, {5, 800, 600, 100}, {6, 800, 600, 120}, {7, 800, 600, 160},
622 {1, 1024, 768, 60}, {2, 1024, 768, 70}, {3, 1024, 768, 75},
623 {4, 1024, 768, 85}, {5, 1024, 768, 100}, {6, 1024, 768, 120},
624 {1, 1024, 576, 60}, {2, 1024, 576, 75}, {3, 1024, 576, 85},
627 {1, 1280, 720, 60}, {2, 1280, 720, 75}, {3, 1280, 720, 85},
629 {1, 1280, 1024, 60}, {2, 1280, 1024, 75}, {3, 1280, 1024, 85},
632 {1, 1600, 1200, 60}, {2, 1600, 1200, 65}, {3, 1600, 1200, 70}, {4, 1600, 1200, 75},
633 {5, 1600, 1200, 85}, {6, 1600, 1200, 100}, {7, 1600, 1200, 120},
634 {1, 1920, 1440, 60}, {2, 1920, 1440, 65}, {3, 1920, 1440, 70}, {4, 1920, 1440, 75},
635 {5, 1920, 1440, 85}, {6, 1920, 1440, 100},
636 {1, 2048, 1536, 60}, {2, 2048, 1536, 65}, {3, 2048, 1536, 70}, {4, 2048, 1536, 75},
641 static const struct _chswtable {
647 { 0x1631, 0x1002, "Mitachi", "0x1002" },
651 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
652 /* Offscreen layout */
653 typedef struct _XGI_GLYINFO {
662 typedef struct _XGI_OH {
663 struct _XGI_OH *poh_next;
664 struct _XGI_OH *poh_prev;
665 unsigned long offset;
669 typedef struct _XGI_OHALLOC {
670 struct _XGI_OHALLOC *poha_next;
674 typedef struct _XGI_HEAP {
677 XGI_OH *poh_freelist;
678 XGI_OHALLOC *poha_chain;
679 unsigned long max_freesize;
682 static unsigned long XGIfb_hwcursor_vbase;
684 static unsigned long XGIfb_heap_start;
685 static unsigned long XGIfb_heap_end;
686 static unsigned long XGIfb_heap_size;
687 static XGI_HEAP XGIfb_heap;
690 static const struct _XGI_TV_filter {
692 } XGI_TV_filter[] = {
693 { {{0x00,0x00,0x00,0x40}, /* NTSCFilter_0 */
694 {0x00,0xE0,0x10,0x60},
695 {0x00,0xEE,0x10,0x44},
696 {0x00,0xF4,0x10,0x38},
697 {0xF8,0xF4,0x18,0x38},
698 {0xFC,0xFB,0x14,0x2A},
699 {0x00,0x00,0x10,0x20},
700 {0x00,0x04,0x10,0x18},
701 {0xFF,0xFF,0xFF,0xFF} }},
702 { {{0x00,0x00,0x00,0x40}, /* NTSCFilter_1 */
703 {0x00,0xE0,0x10,0x60},
704 {0x00,0xEE,0x10,0x44},
705 {0x00,0xF4,0x10,0x38},
706 {0xF8,0xF4,0x18,0x38},
707 {0xFC,0xFB,0x14,0x2A},
708 {0x00,0x00,0x10,0x20},
709 {0x00,0x04,0x10,0x18},
710 {0xFF,0xFF,0xFF,0xFF} }},
711 { {{0x00,0x00,0x00,0x40}, /* NTSCFilter_2 */
712 {0xF5,0xEE,0x1B,0x44},
713 {0xF8,0xF4,0x18,0x38},
714 {0xEB,0x04,0x25,0x18},
715 {0xF1,0x05,0x1F,0x16},
716 {0xF6,0x06,0x1A,0x14},
717 {0xFA,0x06,0x16,0x14},
718 {0x00,0x04,0x10,0x18},
719 {0xFF,0xFF,0xFF,0xFF} }},
720 { {{0x00,0x00,0x00,0x40}, /* NTSCFilter_3 */
721 {0xF1,0x04,0x1F,0x18},
722 {0xEE,0x0D,0x22,0x06},
723 {0xF7,0x06,0x19,0x14},
724 {0xF4,0x0B,0x1C,0x0A},
725 {0xFA,0x07,0x16,0x12},
726 {0xF9,0x0A,0x17,0x0C},
727 {0x00,0x07,0x10,0x12},
728 {0xFF,0xFF,0xFF,0xFF} }},
729 { {{0x00,0x00,0x00,0x40}, /* NTSCFilter_4 */
730 {0x00,0xE0,0x10,0x60},
731 {0x00,0xEE,0x10,0x44},
732 {0x00,0xF4,0x10,0x38},
733 {0xF8,0xF4,0x18,0x38},
734 {0xFC,0xFB,0x14,0x2A},
735 {0x00,0x00,0x10,0x20},
736 {0x00,0x04,0x10,0x18},
737 {0xFF,0xFF,0xFF,0xFF} }},
738 { {{0x00,0x00,0x00,0x40}, /* NTSCFilter_5 */
739 {0xF5,0xEE,0x1B,0x44},
740 {0xF8,0xF4,0x18,0x38},
741 {0xEB,0x04,0x25,0x18},
742 {0xF1,0x05,0x1F,0x16},
743 {0xF6,0x06,0x1A,0x14},
744 {0xFA,0x06,0x16,0x14},
745 {0x00,0x04,0x10,0x18},
746 {0xFF,0xFF,0xFF,0xFF} }},
747 { {{0x00,0x00,0x00,0x40}, /* NTSCFilter_6 */
748 {0xEB,0x04,0x25,0x18},
749 {0xE7,0x0E,0x29,0x04},
750 {0xEE,0x0C,0x22,0x08},
751 {0xF6,0x0B,0x1A,0x0A},
752 {0xF9,0x0A,0x17,0x0C},
753 {0xFC,0x0A,0x14,0x0C},
754 {0x00,0x08,0x10,0x10},
755 {0xFF,0xFF,0xFF,0xFF} }},
756 { {{0x00,0x00,0x00,0x40}, /* NTSCFilter_7 */
757 {0xEC,0x02,0x24,0x1C},
758 {0xF2,0x04,0x1E,0x18},
759 {0xEB,0x15,0x25,0xF6},
760 {0xF4,0x10,0x1C,0x00},
761 {0xF8,0x0F,0x18,0x02},
762 {0x00,0x04,0x10,0x18},
763 {0x01,0x06,0x0F,0x14},
764 {0xFF,0xFF,0xFF,0xFF} }},
765 { {{0x00,0x00,0x00,0x40}, /* PALFilter_0 */
766 {0x00,0xE0,0x10,0x60},
767 {0x00,0xEE,0x10,0x44},
768 {0x00,0xF4,0x10,0x38},
769 {0xF8,0xF4,0x18,0x38},
770 {0xFC,0xFB,0x14,0x2A},
771 {0x00,0x00,0x10,0x20},
772 {0x00,0x04,0x10,0x18},
773 {0xFF,0xFF,0xFF,0xFF} }},
774 { {{0x00,0x00,0x00,0x40}, /* PALFilter_1 */
775 {0x00,0xE0,0x10,0x60},
776 {0x00,0xEE,0x10,0x44},
777 {0x00,0xF4,0x10,0x38},
778 {0xF8,0xF4,0x18,0x38},
779 {0xFC,0xFB,0x14,0x2A},
780 {0x00,0x00,0x10,0x20},
781 {0x00,0x04,0x10,0x18},
782 {0xFF,0xFF,0xFF,0xFF} }},
783 { {{0x00,0x00,0x00,0x40}, /* PALFilter_2 */
784 {0xF5,0xEE,0x1B,0x44},
785 {0xF8,0xF4,0x18,0x38},
786 {0xF1,0xF7,0x01,0x32},
787 {0xF5,0xFB,0x1B,0x2A},
788 {0xF9,0xFF,0x17,0x22},
789 {0xFB,0x01,0x15,0x1E},
790 {0x00,0x04,0x10,0x18},
791 {0xFF,0xFF,0xFF,0xFF} }},
792 { {{0x00,0x00,0x00,0x40}, /* PALFilter_3 */
793 {0xF5,0xFB,0x1B,0x2A},
794 {0xEE,0xFE,0x22,0x24},
795 {0xF3,0x00,0x1D,0x20},
796 {0xF9,0x03,0x17,0x1A},
797 {0xFB,0x02,0x14,0x1E},
798 {0xFB,0x04,0x15,0x18},
799 {0x00,0x06,0x10,0x14},
800 {0xFF,0xFF,0xFF,0xFF} }},
801 { {{0x00,0x00,0x00,0x40}, /* PALFilter_4 */
802 {0x00,0xE0,0x10,0x60},
803 {0x00,0xEE,0x10,0x44},
804 {0x00,0xF4,0x10,0x38},
805 {0xF8,0xF4,0x18,0x38},
806 {0xFC,0xFB,0x14,0x2A},
807 {0x00,0x00,0x10,0x20},
808 {0x00,0x04,0x10,0x18},
809 {0xFF,0xFF,0xFF,0xFF} }},
810 { {{0x00,0x00,0x00,0x40}, /* PALFilter_5 */
811 {0xF5,0xEE,0x1B,0x44},
812 {0xF8,0xF4,0x18,0x38},
813 {0xF1,0xF7,0x1F,0x32},
814 {0xF5,0xFB,0x1B,0x2A},
815 {0xF9,0xFF,0x17,0x22},
816 {0xFB,0x01,0x15,0x1E},
817 {0x00,0x04,0x10,0x18},
818 {0xFF,0xFF,0xFF,0xFF} }},
819 { {{0x00,0x00,0x00,0x40}, /* PALFilter_6 */
820 {0xF5,0xEE,0x1B,0x2A},
821 {0xEE,0xFE,0x22,0x24},
822 {0xF3,0x00,0x1D,0x20},
823 {0xF9,0x03,0x17,0x1A},
824 {0xFB,0x02,0x14,0x1E},
825 {0xFB,0x04,0x15,0x18},
826 {0x00,0x06,0x10,0x14},
827 {0xFF,0xFF,0xFF,0xFF} }},
828 { {{0x00,0x00,0x00,0x40}, /* PALFilter_7 */
829 {0xF5,0xEE,0x1B,0x44},
830 {0xF8,0xF4,0x18,0x38},
831 {0xFC,0xFB,0x14,0x2A},
832 {0xEB,0x05,0x25,0x16},
833 {0xF1,0x05,0x1F,0x16},
834 {0xFA,0x07,0x16,0x12},
835 {0x00,0x07,0x10,0x12},
836 {0xFF,0xFF,0xFF,0xFF} }}
839 static int filter = -1;
840 static unsigned char filter_tb;
843 /* ---------------------- Routine prototypes ------------------------- */
845 /* Interface used by the world */
847 XGIINITSTATIC int __init XGIfb_setup(char *options);
850 /* Interface to the low level console driver */
855 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
856 int XGIfb_init(void);
857 static int XGIfb_get_fix(struct fb_fix_screeninfo *fix,
859 struct fb_info *info);
860 static int XGIfb_get_var(struct fb_var_screeninfo *var,
862 struct fb_info *info);
863 static int XGIfb_set_var(struct fb_var_screeninfo *var,
865 struct fb_info *info);
866 static void XGIfb_crtc_to_var(struct fb_var_screeninfo *var);
867 static int XGIfb_get_cmap(struct fb_cmap *cmap,
870 struct fb_info *info);
871 static int XGIfb_set_cmap(struct fb_cmap *cmap,
874 struct fb_info *info);
875 static int XGIfb_update_var(int con,
876 struct fb_info *info);
877 static int XGIfb_switch(int con,
878 struct fb_info *info);
879 static void XGIfb_blank(int blank,
880 struct fb_info *info);
881 static void XGIfb_set_disp(int con,
882 struct fb_var_screeninfo *var,
883 struct fb_info *info);
884 static int XGI_getcolreg(unsigned regno, unsigned *red, unsigned *green,
885 unsigned *blue, unsigned *transp,
886 struct fb_info *fb_info);
887 static void XGIfb_do_install_cmap(int con,
888 struct fb_info *info);
889 static void XGI_get_glyph(struct fb_info *info,
891 static int XGIfb_mmap(struct fb_info *info, struct file *file,
892 struct vm_area_struct *vma);
893 static int XGIfb_ioctl(struct inode *inode, struct file *file,
894 unsigned int cmd, unsigned long arg, int con,
895 struct fb_info *info);
898 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
899 XGIINITSTATIC int __init xgifb_init(void);
900 static int XGIfb_set_par(struct fb_info *info);
901 static int XGIfb_blank(int blank,
902 struct fb_info *info);
903 /*static int XGIfb_mmap(struct fb_info *info, struct file *file,
904 struct vm_area_struct *vma);
906 extern void fbcon_XGI_fillrect(struct fb_info *info,
907 const struct fb_fillrect *rect);
908 extern void fbcon_XGI_copyarea(struct fb_info *info,
909 const struct fb_copyarea *area);
911 extern void cfb_imageblit(struct fb_info *info,
912 const struct fb_image *image);
914 extern int fbcon_XGI_sync(struct fb_info *info);
916 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15)
917 static int XGIfb_ioctl(struct fb_info *info, unsigned int cmd,
920 static int XGIfb_ioctl(struct inode *inode,
924 struct fb_info *info);
928 extern int XGIfb_mode_rate_to_dclock(VB_DEVICE_INFO *XGI_Pr,
929 PXGI_HW_DEVICE_INFO HwDeviceExtension,
930 unsigned char modeno, unsigned char rateindex);
931 extern int XGIfb_mode_rate_to_ddata(VB_DEVICE_INFO *XGI_Pr, PXGI_HW_DEVICE_INFO HwDeviceExtension,
932 unsigned char modeno, unsigned char rateindex,
933 unsigned int *left_margin, unsigned int *right_margin,
934 unsigned int *upper_margin, unsigned int *lower_margin,
935 unsigned int *hsync_len, unsigned int *vsync_len,
936 unsigned int *sync, unsigned int *vmode);
939 extern BOOLEAN XGI_SearchModeID( USHORT ModeNo,USHORT *ModeIdIndex, PVB_DEVICE_INFO );
940 static int XGIfb_get_fix(struct fb_fix_screeninfo *fix, int con,
941 struct fb_info *info);
943 /* Internal 2D accelerator functions */
944 extern int XGIfb_initaccel(void);
945 extern void XGIfb_syncaccel(void);
947 /* Internal general routines */
948 static void XGIfb_search_mode(const char *name);
949 static int XGIfb_validate_mode(int modeindex);
950 static u8 XGIfb_search_refresh_rate(unsigned int rate);
951 static int XGIfb_setcolreg(unsigned regno, unsigned red, unsigned green,
952 unsigned blue, unsigned transp,
953 struct fb_info *fb_info);
954 static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
955 struct fb_info *info);
956 static void XGIfb_pre_setmode(void);
957 static void XGIfb_post_setmode(void);
959 static BOOLEAN XGIfb_CheckVBRetrace(void);
960 static BOOLEAN XGIfbcheckvretracecrt2(void);
961 static BOOLEAN XGIfbcheckvretracecrt1(void);
962 static BOOLEAN XGIfb_bridgeisslave(void);
965 unsigned long offset;
969 /* XGI-specific Export functions */
970 void XGI_dispinfo(struct ap_data *rec);
971 void XGI_malloc(struct XGI_memreq *req);
972 void XGI_free(unsigned long base);
974 /* Internal hardware access routines */
975 void XGIfb_set_reg4(u16 port, unsigned long data);
976 u32 XGIfb_get_reg3(u16 port);
978 /* Chipset-dependent internal routines */
981 static int XGIfb_get_dram_size(void);
982 static void XGIfb_detect_VB(void);
983 static void XGIfb_get_VB_type(void);
984 static int XGIfb_has_VB(void);
987 /* Internal heap routines */
988 static int XGIfb_heap_init(void);
989 static XGI_OH *XGIfb_poh_new_node(void);
990 static XGI_OH *XGIfb_poh_allocate(unsigned long size);
991 static void XGIfb_delete_node(XGI_OH *poh);
992 static void XGIfb_insert_node(XGI_OH *pohList, XGI_OH *poh);
993 static XGI_OH *XGIfb_poh_free(unsigned long base);
994 static void XGIfb_free_node(XGI_OH *poh);
996 /* Internal routines to access PCI configuration space */
997 BOOLEAN XGIfb_query_VGA_config_space(PXGI_HW_DEVICE_INFO pXGIhw_ext,
998 unsigned long offset, unsigned long set, unsigned long *value);
999 //BOOLEAN XGIfb_query_north_bridge_space(PXGI_HW_DEVICE_INFO pXGIhw_ext,
1000 // unsigned long offset, unsigned long set, unsigned long *value);
1003 /* Routines from init.c/init301.c */
1004 extern void InitTo330Pointer(UCHAR,PVB_DEVICE_INFO pVBInfo);
1005 extern BOOLEAN XGIInitNew(PXGI_HW_DEVICE_INFO HwDeviceExtension);
1006 extern BOOLEAN XGISetModeNew(PXGI_HW_DEVICE_INFO HwDeviceExtension, USHORT ModeNo);
1007 //extern void XGI_SetEnableDstn(VB_DEVICE_INFO *XGI_Pr);
1008 extern void XGI_LongWait(VB_DEVICE_INFO *XGI_Pr);
1009 extern USHORT XGI_GetRatePtrCRT2( PXGI_HW_DEVICE_INFO pXGIHWDE, USHORT ModeNo,USHORT ModeIdIndex,PVB_DEVICE_INFO pVBInfo );
1010 /* TW: Chrontel TV functions */
1011 extern USHORT XGI_GetCH700x(VB_DEVICE_INFO *XGI_Pr, USHORT tempbx);
1012 extern void XGI_SetCH700x(VB_DEVICE_INFO *XGI_Pr, USHORT tempbx);
1013 extern USHORT XGI_GetCH701x(VB_DEVICE_INFO *XGI_Pr, USHORT tempbx);
1014 extern void XGI_SetCH701x(VB_DEVICE_INFO *XGI_Pr, USHORT tempbx);
1015 extern void XGI_SetCH70xxANDOR(VB_DEVICE_INFO *XGI_Pr, USHORT tempax,USHORT tempbh);
1016 extern void XGI_DDC2Delay(VB_DEVICE_INFO *XGI_Pr, USHORT delaytime);
1018 /* TW: Sensing routines */
1019 void XGI_Sense30x(void);
1020 int XGIDoSense(int tempbl, int tempbh, int tempcl, int tempch);
1022 extern XGI21_LVDSCapStruct XGI21_LCDCapList[13];