Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
[pandora-kernel.git] / drivers / staging / xgifb / vb_def.h
1 /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/xgi/initdef.h,v 1.4 2000/12/02 01:16:17 dawes Exp $ */
2 #ifndef _INITDEF_
3 #define _INITDEF_
4
5 #ifndef NewScratch
6 #define NewScratch
7 #endif
8 /* shampoo */
9 #ifdef LINUX_KERNEL
10 #define SEQ_ADDRESS_PORT          0x0014
11 #define SEQ_DATA_PORT             0x0015
12 #define MISC_OUTPUT_REG_READ_PORT 0x001C
13 #define MISC_OUTPUT_REG_WRITE_PORT 0x0012
14 #define GRAPH_DATA_PORT           0x1F
15 #define GRAPH_ADDRESS_PORT        0x1E
16 #define XGI_MASK_DUAL_CHIP        0x04  /* SR3A */
17 #define CRTC_ADDRESS_PORT_COLOR   0x0024
18 #define VIDEO_SUBSYSTEM_ENABLE_PORT 0x0013
19 #define PCI_COMMAND             0x04
20 #endif
21 /* ~shampoo */
22
23
24 #define VB_XGI301             0x0001  /*301b*/
25 #define VB_XGI301B        0x0002
26 #define VB_XGI302B        0x0004
27 #define VB_XGI301LV     0x0008 /*301lv*/
28 #define VB_XGI302LV     0x0010
29 #define VB_XGI301C      0x0020       /* for 301C */
30 #define  VB_NoLCD        0x8000
31 /*end 301b*/
32
33 #define VB_YPbPrInfo     0x07          /*301lv*/
34 #define VB_YPbPr525i     0x00
35 #define VB_YPbPr525p     0x01
36 #define VB_YPbPr750p     0x02
37 #define VB_YPbPr1080i    0x03
38
39 /* #define CRT1Len 17 */
40 #define LVDSCRT1Len             15
41 #define CHTVRegDataLen          5
42
43 /* #define ModeInfoFlag 0x07 */
44 /* #define IsTextMode 0x07 */
45 /* #define ModeText 0x00 */
46 /* #define ModeCGA 0x01 */
47 /* #define ModeEGA 0x02 */
48 /* #define ModeVGA 0x03 */
49 /* #define Mode15Bpp 0x04 */
50 /* #define Mode16Bpp 0x05 */
51 /* #define Mode24Bpp 0x06 */
52 /* #define Mode32Bpp 0x07 */
53
54 /* #define DACInfoFlag 0x18 */
55 /* #define MemoryInfoFlag 0x1E0 */
56 /* #define MemorySizeShift 0x05 */
57
58 #define Charx8Dot               0x0200
59 #define LineCompareOff          0x0400
60 #define CRT2Mode                0x0800
61 #define HalfDCLK                0x1000
62 #define NoSupportSimuTV         0x2000
63 #define DoubleScanMode          0x8000
64
65 #define SupportAllCRT2          0x0078
66 #define SupportTV               0x0008
67 #define SupportHiVisionTV       0x0010
68 #define SupportLCD              0x0020
69 #define SupportRAMDAC2          0x0040
70 #define NoSupportTV             0x0070
71 #define NoSupportHiVisionTV     0x0060
72 #define NoSupportLCD            0x0058
73 #define SupportCHTV             0x0800
74 #define SupportCRT2in301C       0x0100       /* for 301C */
75 #define SupportTV1024           0x0800  /*301b*/
76 #define SupportYPbPr            0x1000  /*301lv*/
77 #define InterlaceMode           0x0080
78 #define SyncPP                  0x0000
79 #define SyncPN                  0x4000
80 #define SyncNP                  0x8000
81 /* #define SyncNN 0xc000 */
82 #define ECLKindex0              0x0000
83 #define ECLKindex1              0x0100
84 #define ECLKindex2              0x0200
85 #define ECLKindex3              0x0300
86 #define ECLKindex4              0x0400
87
88 #define SetSimuScanMode         0x0001
89 #define SwitchToCRT2            0x0002
90 /* #define SetCRT2ToTV 0x009C */
91 #define SetCRT2ToAVIDEO         0x0004
92 #define SetCRT2ToSVIDEO         0x0008
93 #define SetCRT2ToSCART          0x0010
94 #define SetCRT2ToLCD            0x0020
95 #define SetCRT2ToRAMDAC         0x0040
96 #define SetCRT2ToHiVisionTV     0x0080
97 #define SetNTSCTV               0x0000
98 /* #define SetPALTV 0x0100 */
99 #define SetInSlaveMode          0x0200
100 #define SetNotSimuMode          0x0400
101 #define SetNotSimuTVMode        0x0400
102 #define SetDispDevSwitch        0x0800
103 #define LoadDACFlag             0x1000
104 #define DisableCRT2Display      0x2000
105 #define DriverMode              0x4000
106 #define HotKeySwitch            0x8000
107 #define SetCHTVOverScan         0x8000
108 /* #define SetCRT2ToLCDA 0x8000 301b */
109 #define PanelRGB18Bit           0x0100
110 #define PanelRGB24Bit           0x0000
111
112 #define TVOverScan              0x10
113 #define TVOverScanShift         4
114 #define ClearBufferFlag         0x20
115 #define EnableDualEdge          0x01            /*301b*/
116 #define SetToLCDA               0x02
117
118 #define YPbPrModeInfo           0x38
119 /* #define YPbPrMode525i 0x00 */
120 /* #define YPbPrMode525p 0x08 */
121 /* #define YPbPrMode750p 0x10 */
122 /* #define YPbPrMode1080i 0x18 */
123
124 #define SetSCARTOutput          0x01
125 #define BoardTVType             0x02
126 #define  EnablePALMN           0x40
127 /* #define ProgrammingCRT2 0x01 */
128 /* #define TVSimuMode 0x02 */
129 /* #define RPLLDIV2XO 0x04 */
130 /* #define LCDVESATiming 0x08 */
131 /* #define EnableLVDSDDA 0x10 */
132 #define SetDispDevSwitchFlag    0x20
133 #define CheckWinDos             0x40
134 #define SetJDOSMode             0x80
135
136 #define Panel320x480              0x07/*fstn*/
137 /* [ycchen] 02/12/03 Modify for Multi-Sync. LCD Support */
138 #define PanelResInfo            0x1F    /* CR36 Panel Type/LCDResInfo */
139 #define PanelRefInfo            0x60
140 #define Panel800x600            0x01
141 #define Panel1024x768           0x02
142 #define Panel1024x768x75        0x22
143 #define Panel1280x1024          0x03
144 #define Panel1280x1024x75       0x23
145 #define Panel640x480            0x04
146 #define Panel1024x600           0x05
147 #define Panel1152x864           0x06
148 #define Panel1280x960           0x07
149 #define Panel1152x768           0x08
150 #define Panel1400x1050          0x09
151 #define Panel1280x768           0x0A
152 #define Panel1600x1200          0x0B
153
154 #define PanelRef60Hz            0x00
155 #define PanelRef75Hz            0x20
156 #define LCDRGB18Bit             0x01
157
158 #define ExtChipTrumpion         0x06
159 #define ExtChipCH7005           0x08
160 #define ExtChipMitacTV          0x0a
161 #define LCDNonExpanding         0x10
162 #define LCDNonExpandingShift    4
163 #define LCDSync                 0x20
164 #define LCDSyncBit              0xe0
165 #define LCDSyncShift            6
166
167 /* #define DDC2DelayTime 300 */
168
169 #define CRT2DisplayFlag         0x2000
170 /* #define LCDDataLen 8 */
171 /* #define HiTVDataLen 12 */
172 /* #define TVDataLen 16 */
173 /* #define SetPALTV 0x0100 */
174 #define HalfDCLK                0x1000
175 #define NTSCHT                  1716
176 #define NTSCVT                  525
177 #define PALHT                   1728
178 #define PALVT                   625
179 #define StHiTVHT                892
180 #define StHiTVVT                1126
181 #define StHiTextTVHT            1000
182 #define StHiTextTVVT            1126
183 #define ExtHiTVHT               2100
184 #define ExtHiTVVT               1125
185
186 #define St750pTVHT              1716
187 #define St750pTVVT               525
188 #define Ext750pTVHT             1716
189 #define Ext750pTVVT              525
190 #define St525pTVHT              1716
191 #define St525pTVVT               525
192 #define Ext525pTVHT             1716
193 #define Ext525pTVVT              525
194 #define St525iTVHT              1716
195 #define St525iTVVT               525
196 #define Ext525iTVHT             1716
197 #define Ext525iTVVT              525
198
199 #define VCLKStartFreq           25
200 #define SoftDramType            0x80
201 #define VCLK40                  0x04
202
203 #define VCLK162                 0x21
204
205 #define LCDRGB18Bit             0x01
206 #define LoadDACFlag             0x1000
207 #define AfterLockCRT2           0x4000
208 #define SetCRT2ToAVIDEO         0x0004
209 #define SetCRT2ToSCART          0x0010
210 #define Ext2StructSize          5
211
212
213 #define YPbPr525iVCLK           0x03B
214 #define YPbPr525iVCLK_2         0x03A
215
216 #define SwitchToCRT2            0x0002
217 /* #define LCDVESATiming 0x08 */
218 #define SetSCARTOutput          0x01
219 #define AVIDEOSense             0x01
220 #define SVIDEOSense             0x02
221 #define SCARTSense              0x04
222 #define LCDSense                0x08
223 #define Monitor1Sense           0x20
224 #define Monitor2Sense           0x10
225 #define HiTVSense               0x40
226 #define BoardTVType             0x02
227 #define HotPlugFunction         0x08
228 #define StStructSize            0x06
229
230
231 #define XGI_CRT2_PORT_00        0x00 - 0x030
232 #define XGI_CRT2_PORT_04        0x04 - 0x030
233 #define XGI_CRT2_PORT_10        0x10 - 0x30
234 #define XGI_CRT2_PORT_12        0x12 - 0x30
235 #define XGI_CRT2_PORT_14        0x14 - 0x30
236
237
238 #define LCDNonExpanding         0x10
239 #define ADR_CRT2PtrData         0x20E
240 #define offset_Zurac            0x210
241 #define ADR_LVDSDesPtrData      0x212
242 #define ADR_LVDSCRT1DataPtr     0x214
243 #define ADR_CHTVVCLKPtr         0x216
244 #define ADR_CHTVRegDataPtr      0x218
245
246 #define LVDSDataLen             6
247 /* #define EnableLVDSDDA 0x10 */
248 /* #define LVDSDesDataLen 3 */
249 #define ActiveNonExpanding      0x40
250 #define ActiveNonExpandingShift 6
251 /* #define ActivePAL 0x20 */
252 #define ActivePALShift          5
253 /* #define ModeSwitchStatus 0x0F */
254 #define SoftTVType              0x40
255 #define SoftSettingAddr         0x52
256 #define ModeSettingAddr         0x53
257
258 /* #define SelectCRT1Rate 0x4 */
259
260 #define _PanelType00             0x00
261 #define _PanelType01             0x08
262 #define _PanelType02             0x10
263 #define _PanelType03             0x18
264 #define _PanelType04             0x20
265 #define _PanelType05             0x28
266 #define _PanelType06             0x30
267 #define _PanelType07             0x38
268 #define _PanelType08             0x40
269 #define _PanelType09             0x48
270 #define _PanelType0A             0x50
271 #define _PanelType0B             0x58
272 #define _PanelType0C             0x60
273 #define _PanelType0D             0x68
274 #define _PanelType0E             0x70
275 #define _PanelType0F             0x78
276
277
278 #define PRIMARY_VGA       0     /* 1: XGI is primary vga 0:XGI is secondary vga */
279 #define BIOSIDCodeAddr          0x235
280 #define OEMUtilIDCodeAddr       0x237
281 #define VBModeIDTableAddr       0x239
282 #define OEMTVPtrAddr            0x241
283 #define PhaseTableAddr          0x243
284 #define NTSCFilterTableAddr     0x245
285 #define PALFilterTableAddr      0x247
286 #define OEMLCDPtr_1Addr         0x249
287 #define OEMLCDPtr_2Addr         0x24B
288 #define LCDHPosTable_1Addr      0x24D
289 #define LCDHPosTable_2Addr      0x24F
290 #define LCDVPosTable_1Addr      0x251
291 #define LCDVPosTable_2Addr      0x253
292 #define OEMLCDPIDTableAddr      0x255
293
294 #define VBModeStructSize        5
295 #define PhaseTableSize          4
296 #define FilterTableSize         4
297 #define LCDHPosTableSize        7
298 #define LCDVPosTableSize        5
299 #define OEMLVDSPIDTableSize     4
300 #define LVDSHPosTableSize       4
301 #define LVDSVPosTableSize       6
302
303 #define VB_ModeID               0
304 #define VB_TVTableIndex         1
305 #define VB_LCDTableIndex        2
306 #define VB_LCDHIndex            3
307 #define VB_LCDVIndex            4
308
309 #define OEMLCDEnable            0x0001
310 #define OEMLCDDelayEnable       0x0002
311 #define OEMLCDPOSEnable         0x0004
312 #define OEMTVEnable             0x0100
313 #define OEMTVDelayEnable        0x0200
314 #define OEMTVFlickerEnable      0x0400
315 #define OEMTVPhaseEnable        0x0800
316 #define OEMTVFilterEnable       0x1000
317
318 #define OEMLCDPanelIDSupport    0x0080
319
320 /* #define LCDVESATiming 0x0001 //LCD Info CR37 */
321 /* #define EnableLVDSDDA 0x0002 */
322 #define EnableScalingLCD        0x0008
323 #define SetPWDEnable            0x0004
324 #define SetLCDtoNonExpanding    0x0010
325 /* #define SetLCDPolarity 0x00E0 */
326 #define SetLCDDualLink          0x0100
327 #define SetLCDLowResolution     0x0200
328 #define SetLCDStdMode           0x0400
329 #define SetTVStdMode            0x0200
330 #define SetTVLowResolution      0x0400
331 /* =============================================================
332    for 310
333 ============================================================== */
334 #define SoftDRAMType        0x80
335 #define SoftSetting_OFFSET  0x52
336 #define SR07_OFFSET  0x7C
337 #define SR15_OFFSET  0x7D
338 #define SR16_OFFSET  0x81
339 #define SR17_OFFSET  0x85
340 #define SR19_OFFSET  0x8D
341 #define SR1F_OFFSET  0x99
342 #define SR21_OFFSET  0x9A
343 #define SR22_OFFSET  0x9B
344 #define SR23_OFFSET  0x9C
345 #define SR24_OFFSET  0x9D
346 #define SR25_OFFSET  0x9E
347 #define SR31_OFFSET  0x9F
348 #define SR32_OFFSET  0xA0
349 #define SR33_OFFSET  0xA1
350
351 #define CR40_OFFSET  0xA2
352 #define SR25_1_OFFSET  0xF6
353 #define CR49_OFFSET  0xF7
354
355 #define VB310Data_1_2_Offset  0xB6
356 #define VB310Data_4_D_Offset  0xB7
357 #define VB310Data_4_E_Offset  0xB8
358 #define VB310Data_4_10_Offset 0xBB
359
360 #define RGBSenseDataOffset    0xBD
361 #define YCSenseDataOffset     0xBF
362 #define VideoSenseDataOffset  0xC1
363 #define OutputSelectOffset    0xF3
364
365 #define ECLK_MCLK_DISTANCE  0x14
366 #define VBIOSTablePointerStart    0x200
367 #define StandTablePtrOffset       VBIOSTablePointerStart+0x02
368 #define EModeIDTablePtrOffset     VBIOSTablePointerStart+0x04
369 #define CRT1TablePtrOffset        VBIOSTablePointerStart+0x06
370 #define ScreenOffsetPtrOffset     VBIOSTablePointerStart+0x08
371 #define VCLKDataPtrOffset         VBIOSTablePointerStart+0x0A
372 #define MCLKDataPtrOffset         VBIOSTablePointerStart+0x0E
373 #define CRT2PtrDataPtrOffset      VBIOSTablePointerStart+0x10
374 #define TVAntiFlickPtrOffset      VBIOSTablePointerStart+0x12
375 #define TVDelayPtr1Offset         VBIOSTablePointerStart+0x14
376 #define TVPhaseIncrPtr1Offset     VBIOSTablePointerStart+0x16
377 #define TVYFilterPtr1Offset       VBIOSTablePointerStart+0x18
378 #define LCDDelayPtr1Offset        VBIOSTablePointerStart+0x20
379 #define TVEdgePtr1Offset          VBIOSTablePointerStart+0x24
380 #define CRT2Delay1Offset          VBIOSTablePointerStart+0x28
381 #define LCDDataDesOffset     VBIOSTablePointerStart-0x02
382 #define LCDDataPtrOffset          VBIOSTablePointerStart+0x2A
383 #define LCDDesDataPtrOffset     VBIOSTablePointerStart+0x2C
384 #define LCDDataList             VBIOSTablePointerStart+0x22     /* add for GetLCDPtr */
385 #define TVDataList              VBIOSTablePointerStart+0x36     /* add for GetTVPtr */
386 /*  */
387 /* Modify from 310.inc */
388 /*  */
389 /*  */
390
391
392 #define         ShowMsgFlag                  0x20               /* SoftSetting */
393 #define         ShowVESAFlag                 0x10
394 #define         HotPlugFunction              0x08
395 #define         ModeSoftSetting              0x04
396 #define         TVSoftSetting                0x02
397 #define         LCDSoftSetting               0x01
398
399 #define         GatingCRTinLCDA              0x10
400 #define         SetHiTVOutput                0x08
401 #define         SetYPbPrOutput               0x04
402 #define         BoardTVType                  0x02
403 #define         SetSCARTOutput               0x01
404
405 #define         ModeSettingYPbPr             0x02               /* TVModeSetting, Others as same as CR30 */
406
407 /* TVModeSetting same as CR35 */
408
409 /* LCDModeSetting same as CR37 */
410
411 #define         EnableNewTVFont              0x10               /* MiscCapability */
412
413 #define         EnableLCDOutput              0x80               /* LCDCfgSetting */
414
415 #define         SoftDRAMType                 0x80               /* DRAMSetting */
416 #define         SoftDRAMConfig               0x40
417 #define         MosSelDRAMType               0x20
418 #define         SDRAM                        000h
419 #define         SGRAM                        0x01
420 #define         ESDRAM                       0x02
421
422 #define         EnableAGPCfgSetting          0x01               /* AGPCfgSetting */
423
424 /* ---------------- SetMode Stack */
425 #define         CRT1Len                      15
426 #define         VCLKLen                      4
427 #define         DefThreshold                 0x0100
428 #define         ExtRegsSize                  (57+8+37+70+63+28+768+1)/64+1
429
430 #define         VGA_XGI315                   0x0001       /* VGA Type Info */
431 #define         VGA_SNewis315e                  0x0002       /* 315 series */
432 #define         VGA_XGI550                   0x0004
433 #define         VGA_XGI640                   0x0008
434 #define         VGA_XGI740                   0x0010
435 #define         VGA_XGI650                   0x0020
436 #define         VGA_XGI650M                  0x0040
437 #define         VGA_XGI651                   0x0080
438 #define         VGA_XGI340                   0x0001       /* 340 series */
439 #define         VGA_XGI330                   0x0001       /* 330 series */
440 #define         VGA_XGI660                   0x0001       /* 660 series */
441
442 #define         VB_XGI301                    0x0001       /* VB Type Info */
443 #define         VB_XGI301B                   0x0002       /* 301 series */
444 #define         VB_XGI302B                   0x0004
445 #define         VB_NoLCD                     0x8000
446 #define         VB_XGI301LV                  0x0008
447 #define         VB_XGI302LV                  0x0010
448 #define         VB_LVDS_NS                   0x0001       /* 3rd party chip */
449 #define         VB_CH7017                    0x0002
450 #define         VB_CH7007                    0x0080       /* [Billy] 07/05/03 */
451 /* #define VB_LVDS_SI 0x0004 */
452
453 #define         ModeInfoFlag                 0x0007
454 #define         IsTextMode                   0x0007
455 #define         ModeText                     0x0000
456 #define         ModeCGA                      0x0001
457 #define         ModeEGA                      0x0002       /* 16 colors mode */
458 #define         ModeVGA                      0x0003       /* 256 colors mode */
459 #define         Mode15Bpp                    0x0004       /* 15 Bpp Color Mode */
460 #define         Mode16Bpp                    0x0005       /* 16 Bpp Color Mode */
461 #define         Mode24Bpp                    0x0006       /* 24 Bpp Color Mode */
462 #define         Mode32Bpp                    0x0007       /* 32 Bpp Color Mode */
463
464 #define         DACInfoFlag                  0x0018
465 #define         MONODAC                      0x0000
466 #define         CGADAC                       0x0008
467 #define         EGADAC                       0x0010
468 #define         VGADAC                       0x0018
469
470 #define         MemoryInfoFlag               0x01e0
471 #define         MemorySizeShift              5
472 #define         Need1MSize                   0x0000
473 #define         Need2MSize                   0x0020
474 #define         Need4MSize                   0x0060
475 #define         Need8MSize                   0x00e0
476 #define         Need16MSize                  0x01e0
477
478 #define         Charx8Dot                    0x0200
479 #define         LineCompareOff               0x0400
480 #define         CRT2Mode                     0x0800
481 #define         HalfDCLK                     0x1000
482 #define         NoSupportSimuTV              0x2000
483 #define         DoubleScanMode               0x8000
484
485 /* -------------- Ext_InfoFlag */
486 #define         SupportModeInfo              0x0007
487 #define         Support256                   0x0003
488 #define         Support15Bpp                 0x0004
489 #define         Support16Bpp                 0x0005
490 #define         Support24Bpp                 0x0006
491 #define         Support32Bpp                 0x0007
492
493 #define         SupportAllCRT2               0x0078
494 #define         SupportTV                    0x0008
495 #define         SupportHiVisionTV            0x0010
496 #define         SupportLCD                   0x0020
497 #define         SupportRAMDAC2               0x0040
498 #define         NoSupportTV                  0x0070
499 #define         NoSupportHiVisionTV          0x0060
500 #define         NoSupportLCD                 0x0058
501 #define         SupportTV1024                0x0800       /* 301btest */
502 #define         SupportYPbPr                 0x1000       /* 301lv */
503 #define         InterlaceMode                0x0080
504 #define         SyncPP                       0x0000
505 #define         SyncPN                       0x4000
506 #define         SyncNP                       0x8000
507 #define         SyncNN                       0xC000
508
509 /* -------------- SetMode Stack/Scratch */
510 #define         SetSimuScanMode              0x0001       /* VBInfo/CR30 & CR31 */
511 #define         SwitchToCRT2                 0x0002
512 #define         SetCRT2ToTV1                 0x009C
513 #define         SetCRT2ToTV                  0x089C
514 #define         SetCRT2ToAVIDEO              0x0004
515 #define         SetCRT2ToSVIDEO              0x0008
516 #define         SetCRT2ToSCART               0x0010
517 #define         SetCRT2ToLCD                 0x0020
518 #define         SetCRT2ToRAMDAC              0x0040
519 #define         SetCRT2ToHiVisionTV          0x0080
520 #define         SetCRT2ToLCDA                0x0100
521 #define         SetInSlaveMode               0x0200
522 #define         SetNotSimuMode               0x0400
523 #define         HKEventMode                  0x0800
524 #define         SetCRT2ToYPbPr               0x0800
525 #define         LoadDACFlag                  0x1000
526 #define         DisableCRT2Display           0x2000
527 #define         DriverMode                   0x4000
528 #define         SetCRT2ToDualEdge            0x8000
529 #define         HotKeySwitch                 0x8000
530
531 #define         ProgrammingCRT2              0x0001       /* Set Flag */
532 #define         EnableVCMode                 0x0002
533 #define         SetHKEventMode               0x0004
534 #define         ReserveTVOption              0x0008
535 #define         DisableRelocateIO            0x0010
536 #define         Win9xDOSMode                 0x0020
537 #define         JDOSMode                     0x0040
538 /* #define SetWin9xforJap 0x0080 // not used now */
539 /* #define SetWin9xforKorea 0x0100 // not used now */
540 #define         GatingCRT                    0x0800
541 #define         DisableChB                   0x1000
542 #define         EnableChB                    0x2000
543 #define         DisableChA                   0x4000
544 #define         EnableChA                    0x8000
545
546 #define         SetNTSCTV                    0x0000       /* TV Info */
547 #define         SetPALTV                     0x0001
548 #define         SetNTSCJ                     0x0002
549 #define         SetPALMTV                    0x0004
550 #define         SetPALNTV                    0x0008
551 #define         SetCHTVUnderScan             0x0000
552 /* #define SetCHTVOverScan 0x0010 */
553 #define         SetYPbPrMode525i             0x0020
554 #define         SetYPbPrMode525p             0x0040
555 #define         SetYPbPrMode750p             0x0080
556 #define         SetYPbPrMode1080i            0x0100
557 #define         SetTVStdMode                 0x0200
558 #define         SetTVLowResolution           0x0400
559 #define         SetTVSimuMode                0x0800
560 #define         TVSimuMode                   0x0800
561 #define         RPLLDIV2XO                   0x1000
562 #define         NTSC1024x768                 0x2000
563 #define         SetTVLockMode                0x4000
564
565 #define         LCDVESATiming                0x0001       /* LCD Info/CR37 */
566 #define         EnableLVDSDDA                0x0002
567 #define         EnableScalingLCD             0x0008
568 #define         SetPWDEnable                 0x0004
569 #define         SetLCDtoNonExpanding         0x0010
570 #define         SetLCDPolarity               0x00e0
571 #define         SetLCDDualLink               0x0100
572 #define         SetLCDLowResolution          0x0200
573 #define         SetLCDStdMode                0x0400
574
575 #define         DefaultLCDCap                0x80ea       /* LCD Capability shampoo */
576 #define         RLVDSDHL00                   0x0000
577 #define         RLVDSDHL01                   0x0001
578 #define         RLVDSDHL10                   0x0002       /* default */
579 #define         RLVDSDHL11                   0x0003
580 #define         EnableLCD24bpp               0x0004       /* default */
581 #define         DisableLCD24bpp              0x0000
582 #define         RLVDSClkSFT0                 0x0000
583 #define         RLVDSClkSFT1                 0x0008       /* default */
584 #define         EnableLVDSDCBal              0x0010
585 #define         DisableLVDSDCBal             0x0000       /* default */
586 #define         SinglePolarity               0x0020       /* default */
587 #define         MultiPolarity                0x0000
588 #define         LCDPolarity                  0x00c0       /* default: SyncNN */
589 #define         LCDSingleLink                0x0000       /* default */
590 #define         LCDDualLink                  0x0100
591 #define         EnableSpectrum               0x0200
592 #define         DisableSpectrum              0x0000       /* default */
593 #define         PWDEnable                    0x0400
594 #define         PWDDisable                   0x0000       /* default */
595 #define         PWMEnable                    0x0800
596 #define         PWMDisable                   0x0000       /* default */
597 #define         EnableVBCLKDRVLOW            0x4000
598 #define         EnableVBCLKDRVHigh           0x0000       /* default */
599 #define         EnablePLLSPLOW               0x8000
600 #define         EnablePLLSPHigh              0x0000       /* default */
601
602 #define         LCDBToA                      0x20               /* LCD SetFlag */
603 #define         StLCDBToA                    0x40
604 #define         LockLCDBToA                  0x80
605 #define         LCDToFull                    0x10
606 #define         AVIDEOSense                  0x01               /* CR32 */
607 #define         SVIDEOSense                  0x02
608 #define         SCARTSense                   0x04
609 #define         LCDSense                     0x08
610 #define         Monitor2Sense                0x10
611 #define         Monitor1Sense                0x20
612 #define         HiTVSense                    0x40
613
614 #ifdef                   NewScratch
615 #define         YPbPrSense                   0x80    /* NEW SCRATCH */
616 #endif
617
618 #define         TVSense                      0xc7
619
620 #define         TVOverScan                   0x10               /* CR35 */
621 #define         TVOverScanShift              4
622
623 #ifdef                   NewScratch
624 #define         NTSCMode                     0x00
625 #define         PALMode                      0x00
626 #define         NTSCJMode                    0x02
627 #define         PALMNMode                    0x0c
628 #define         YPbPrMode                    0xe0
629 #define         YPbPrMode525i                0x00
630 #define         YPbPrMode525p                0x20
631 #define         YPbPrMode750p                0x40
632 #define         YPbPrMode1080i               0x60
633 #else                    /* Old Scratch */
634 #define         ClearBufferFlag              0x20
635 #endif
636
637
638 #define         LCDRGB18Bit                  0x01               /* CR37 */
639 #define         LCDNonExpanding              0x10
640 #define         LCDNonExpandingShift         4
641 #define         LCDSync                      0x20
642 #define         LCDSyncBit                   0xe0               /* H/V polarity & sync ID */
643 #define         LCDSyncShift                 6
644
645 #ifdef                   NewScratch
646 #define         ScalingLCD                   0x08
647 #else                    /* Old Scratch */
648 #define         ExtChipType                  0x0e
649 #define         ExtChip301                   0x02
650 #define         ExtChipLVDS                  0x04
651 #define         ExtChipCH7019                0x06
652 #define         ScalingLCD                   0x10
653 #endif
654
655 #define         EnableDualEdge               0x01               /* CR38 */
656 #define         SetToLCDA                    0x02
657 #ifdef                   NewScratch
658 #define         SetYPbPr                     0x04
659 #define         DisableChannelA              0x08
660 #define         DisableChannelB              0x10
661 #define         ExtChipType                  0xe0
662 #define         ExtChip301                   0x20
663 #define         ExtChipLVDS                  0x40
664 #define         ExtChipCH7019                0x60
665 #else                    /* Old Scratch */
666 #define         YPbPrSense                   0x04
667 #define         SetYPbPr                     0x08
668 #define         YPbPrMode                    0x30
669 #define         YPbPrMode525i                0x00
670 #define         YPbPrMode525p                0x10
671 #define         YPbPrMode750p                0x20
672 #define         YPbPrMode1080i               0x30
673 #define         PALMNMode                    0xc0
674 #endif
675
676 #define         BacklightControlBit          0x01               /* CR3A */
677 #define         Win9xforJap                  0x40
678 #define         Win9xforKorea                0x80
679
680 #define         ForceMDBits                  0x07               /* CR3B */
681 #define         ForceMD_JDOS                 0x00
682 #define         ForceMD_640x400T             0x01
683 #define         ForceMD_640x350T             0x02
684 #define         ForceMD_720x400T             0x03
685 #define         ForceMD_640x480E             0x04
686 #define         ForceMD_640x400E             0x05
687 #define         ForceP1Bit                   0x10
688 #define         ForceP2Bit                   0x20
689 #define         EnableForceMDinBIOS          0x40
690 #define         EnableForceMDinDrv           0x80
691
692 #ifdef                   NewScratch                      /* New Scratch */
693 /* ---------------------- VUMA Information */
694 #define         LCDSettingFromCMOS           0x04               /* CR3C */
695 #define         TVSettingFromCMOS            0x08
696 #define         DisplayDeviceFromCMOS        0x10
697 #define         HKSupportInSBIOS             0x20
698 #define         OSDSupportInSBIOS            0x40
699 #define         DisableLogo                  0x80
700
701 /* ---------------------- HK Evnet Definition */
702 #define         HKEvent                      0x0f               /* CR3D */
703 #define         HK_ModeSwitch                0x01
704 #define         HK_Expanding                 0x02
705 #define         HK_OverScan                  0x03
706 #define         HK_Brightness                0x04
707 #define         HK_Contrast                  0x05
708 #define         HK_Mute                      0x06
709 #define         HK_Volume                    0x07
710 #define         ModeSwitchStatus             0xf0
711 #define         ActiveCRT1                   0x10
712 #define         ActiveLCD                    0x0020
713 #define         ActiveTV                     0x40
714 #define         ActiveCRT2                   0x80
715
716 #define         TVSwitchStatus               0x1f               /* CR3E */
717 #define         ActiveAVideo                 0x01
718 #define         ActiveSVideo                 0x02
719 #define         ActiveSCART                  0x04
720 #define         ActiveHiTV                   0x08
721 #define         ActiveYPbPr                  0x10
722
723 #define         EnableHKEvent                0x01               /* CR3F */
724 #define         EnableOSDEvent               0x02
725 #define         StartOSDEvent                0x04
726 #define         IgnoreHKEvent                0x08
727 #define         IgnoreOSDEvent               0x10
728 #else                    /* Old Scratch */
729 #define         OSD_SBIOS                    0x02       /* SR17 */
730 #define         DisableLogo                  0x04
731 #define         SelectKDOS                   0x08
732 #define         KorWinMode                   0x10
733 #define         KorMode3Bit                  0x0020
734 #define         PSCCtrlBit                  0x40
735 #define         NPSCCtrlBitShift             6
736 #define         BlueScreenBit                0x80
737
738 #define         HKEvent                      0x0f       /* CR79 */
739 #define         HK_ModeSwitch                0x01
740 #define         HK_Expanding                 0x02
741 #define         HK_OverScan                  0x03
742 #define         HK_Brightness                0x04
743 #define         HK_Contrast                  0x05
744 #define         HK_Mute                      0x06
745 #define         HK_Volume                    0x07
746 #define         ActivePAL                    0x0020
747 #define         ActivePALShift               5
748 #define         ActiveNonExpanding           0x40
749 #define         ActiveNonExpandingShift      6
750 #define         ActiveOverScan               0x80
751 #define         ActiveOverScanShift          7
752
753 #define         ModeSwitchStatus             0x0b       /* SR15 */
754 #define         ActiveCRT1                   0x01
755 #define         ActiveLCD                    0x02
756 #define         ActiveCRT2                   0x08
757
758 #define         TVSwitchStatus               0xf0       /* SR16 */
759 #define         TVConfigShift                3
760 #define         ActiveTV                     0x01
761 #define         ActiveYPbPr                  0x04
762 #define         ActiveAVideo                 0x10
763 #define         ActiveSVideo                 0x0020
764 #define         ActiveSCART                  0x40
765 #define         ActiveHiTV                   0x80
766
767 #define         EnableHKEvent                0x01       /* CR7A */
768 #define         EnableOSDEvent               0x02
769 #define         StartOSDEvent                0x04
770 #define         CMOSSupport                  0x08
771 #define         HotKeySupport                0x10
772 #define         IngoreHKOSDEvent             0x20
773 #endif
774
775 /* //------------- Misc. Definition */
776 #define         SelectCRT1Rate               00h
777 /* #define SelectCRT2Rate 04h */
778
779 #define         DDC1DelayTime                1000
780 #ifdef           TRUMPION
781 #define         DDC2DelayTime                15
782 #else
783 #define         DDC2DelayTime                150
784 #endif
785
786 #define         R_FACTOR                     04Dh
787 #define         G_FACTOR                     097h
788 #define         B_FACTOR                     01Ch
789 /* --------------------------------------------------------- */
790 /* translated from asm code 301def.h */
791 /*  */
792 /* --------------------------------------------------------- */
793 #define         LCDDataLen                   8
794 #define         HiTVDataLen                  12
795 #define         TVDataLen                    12
796 #define         LVDSCRT1Len_H                8
797 #define         LVDSCRT1Len_V                7
798 #define         LVDSDataLen                  6
799 #define         LVDSDesDataLen               6
800 #define         LCDDesDataLen                6
801 #define         LVDSDesDataLen2              8
802 #define         LCDDesDataLen2               8
803 #define         CHTVRegLen                   16
804 #define         CHLVRegLen                   12
805
806 #define         StHiTVHT                     892
807 #define         StHiTVVT                     1126
808 #define         StHiTextTVHT                 1000
809 #define         StHiTextTVVT                 1126
810 #define         ExtHiTVHT                    2100
811 #define         ExtHiTVVT                    1125
812 #define         NTSCHT                       1716
813 #define         NTSCVT                        525
814 #define         NTSC1024x768HT               1908
815 #define         NTSC1024x768VT                525
816 #define         PALHT                        1728
817 #define         PALVT                         625
818
819 #define         YPbPrTV525iHT                1716            /* YPbPr */
820 #define         YPbPrTV525iVT                 525
821 #define         YPbPrTV525pHT                1716
822 #define         YPbPrTV525pVT                 525
823 #define         YPbPrTV750pHT                1650
824 #define         YPbPrTV750pVT                 750
825
826 #define         CRT2VCLKSel                  0xc0
827
828 #define         CRT2Delay1                   0x04            /* XGI301 */
829 #define         CRT2Delay2                   0x0A            /* 301B,302 */
830
831
832 #define         VCLK25_175           0x00
833 #define         VCLK28_322           0x01
834 #define         VCLK31_5             0x02
835 #define         VCLK36               0x03
836 #define         VCLK40               0x04
837 #define         VCLK43_163           0x05
838 #define         VCLK44_9             0x06
839 #define         VCLK49_5             0x07
840 #define         VCLK50               0x08
841 #define         VCLK52_406           0x09
842 #define         VCLK56_25            0x0A
843 #define         VCLK65               0x0B
844 #define         VCLK67_765           0x0C
845 #define         VCLK68_179           0x0D
846 #define         VCLK72_852           0x0E
847 #define         VCLK75               0x0F
848 #define         VCLK75_8             0x10
849 #define         VCLK78_75            0x11
850 #define         VCLK79_411           0x12
851 #define         VCLK83_95            0x13
852 #define         VCLK84_8             0x14
853 #define         VCLK86_6             0x15
854 #define         VCLK94_5             0x16
855 #define         VCLK104_998          0x17
856 #define         VCLK105_882          0x18
857 #define         VCLK108_2            0x19
858 #define         VCLK109_175          0x1A
859 #define         VCLK113_309          0x1B
860 #define         VCLK116_406          0x1C
861 #define         VCLK132_258          0x1D
862 #define         VCLK135_5            0x1E
863 #define         VCLK139_054          0x1F
864 #define         VCLK157_5            0x20
865 #define         VCLK162              0x21
866 #define         VCLK175              0x22
867 #define         VCLK189              0x23
868 #define         VCLK194_4            0x24
869 #define         VCLK202_5            0x25
870 #define         VCLK229_5            0x26
871 #define         VCLK234              0x27
872 #define         VCLK252_699          0x28
873 #define         VCLK254_817          0x29
874 #define         VCLK265_728          0x2A
875 #define         VCLK266_952          0x2B
876 #define         VCLK269_655          0x2C
877 #define         VCLK272_042          0x2D
878 #define         VCLK277_015          0x2E
879 #define         VCLK286_359          0x2F
880 #define         VCLK291_132          0x30
881 #define         VCLK291_766          0x31
882 #define         VCLK309_789          0x32
883 #define         VCLK315_195          0x33
884 #define         VCLK323_586          0x34
885 #define         VCLK330_615          0x35
886 #define         VCLK332_177          0x36
887 #define         VCLK340_477          0x37
888 #define         VCLK375_847          0x38
889 #define         VCLK388_631          0x39
890 #define         VCLK125_999          0x51
891 #define         VCLK148_5            0x52
892 #define         VCLK178_992          0x54
893 #define         VCLK217_325          0x55
894 #define         VCLK299_505          0x56
895 #define         YPbPr750pVCLK        0x57
896
897 #define         TVVCLKDIV2              0x3A
898 #define         TVVCLK                  0x3B
899 #define         HiTVVCLKDIV2          0x3C
900 #define         HiTVVCLK              0x3D
901 #define         HiTVSimuVCLK          0x3E
902 #define         HiTVTextVCLK          0x3F
903 #define         VCLK39_77              0x40
904 /* #define YPbPr750pVCLK 0x0F */
905 #define         YPbPr525pVCLK           0x3A
906 /* #define ;;YPbPr525iVCLK 0x3B */
907 /* #define ;;YPbPr525iVCLK_2 0x3A */
908 #define         NTSC1024VCLK         0x41
909 #define         VCLK25_175_41        0x42                  /* ; ScaleLCD */
910 #define         VCLK25_175_42        0x43
911 #define         VCLK28_322_43        0x44
912 #define         VCLK40_44            0x45
913 #define         VCLKQVGA_1           0x46                   /* ; QVGA */
914 #define         VCLKQVGA_2           0x47
915 #define         VCLKQVGA_3           0x48
916 #define         VCLK35_2             0x49                    /* ; 800x480 */
917 #define         VCLK122_61           0x4A
918 #define         VCLK80_350           0x4B
919 #define         VCLK107_385          0x4C
920
921 #define         CHTVVCLK30_2         0x50                 /* ;;CHTV */
922 #define         CHTVVCLK28_1         0x51
923 #define         CHTVVCLK43_6         0x52
924 #define         CHTVVCLK26_4         0x53
925 #define         CHTVVCLK24_6         0x54
926 #define         CHTVVCLK47_8         0x55
927 #define         CHTVVCLK31_5         0x56
928 #define         CHTVVCLK26_2         0x57
929 #define         CHTVVCLK39           0x58
930 #define         CHTVVCLK36           0x59
931
932 #define         CH7007TVVCLK30_2     0x00                 /* [Billy] 2007/05/18 For CH7007 */
933 #define         CH7007TVVCLK28_1     0x01
934 #define         CH7007TVVCLK43_6     0x02
935 #define         CH7007TVVCLK26_4     0x03
936 #define         CH7007TVVCLK24_6     0x04
937 #define         CH7007TVVCLK47_8     0x05
938 #define         CH7007TVVCLK31_5     0x06
939 #define         CH7007TVVCLK26_2     0x07
940 #define         CH7007TVVCLK39       0x08
941 #define         CH7007TVVCLK36       0x09
942
943 #define         RES320x200                   0x00
944 #define         RES320x240                   0x01
945 #define         RES400x300                   0x02
946 #define         RES512x384                   0x03
947 #define         RES640x400                   0x04
948 #define         RES640x480x60                0x05
949 #define         RES640x480x72                0x06
950 #define         RES640x480x75                0x07
951 #define         RES640x480x85                0x08
952 #define         RES640x480x100               0x09
953 #define         RES640x480x120               0x0A
954 #define         RES640x480x160               0x0B
955 #define         RES640x480x200               0x0C
956 #define         RES800x600x56                0x0D
957 #define         RES800x600x60                0x0E
958 #define         RES800x600x72                0x0F
959 #define         RES800x600x75                0x10
960 #define         RES800x600x85                0x11
961 #define         RES800x600x100               0x12
962 #define         RES800x600x120               0x13
963 #define         RES800x600x160               0x14
964 #define         RES1024x768x43               0x15
965 #define         RES1024x768x60               0x16
966 #define         RES1024x768x70               0x17
967 #define         RES1024x768x75               0x18
968 #define         RES1024x768x85               0x19
969 #define         RES1024x768x100              0x1A
970 #define         RES1024x768x120              0x1B
971 #define         RES1280x1024x43              0x1C
972 #define         RES1280x1024x60              0x1D
973 #define         RES1280x1024x75              0x1E
974 #define         RES1280x1024x85              0x1F
975 #define         RES1600x1200x60              0x20
976 #define         RES1600x1200x65              0x21
977 #define         RES1600x1200x70              0x22
978 #define         RES1600x1200x75              0x23
979 #define         RES1600x1200x85              0x24
980 #define         RES1600x1200x100             0x25
981 #define         RES1600x1200x120             0x26
982 #define         RES1920x1440x60              0x27
983 #define         RES1920x1440x65              0x28
984 #define         RES1920x1440x70              0x29
985 #define         RES1920x1440x75              0x2A
986 #define         RES1920x1440x85              0x2B
987 #define         RES1920x1440x100             0x2C
988 #define         RES2048x1536x60              0x2D
989 #define         RES2048x1536x65              0x2E
990 #define         RES2048x1536x70              0x2F
991 #define         RES2048x1536x75              0x30
992 #define         RES2048x1536x85              0x31
993 #define         RES800x480x60                0x32
994 #define         RES800x480x75                0x33
995 #define         RES800x480x85                0x34
996 #define         RES1024x576x60               0x35
997 #define         RES1024x576x75               0x36
998 #define         RES1024x576x85               0x37
999 #define         RES1280x720x60               0x38
1000 #define         RES1280x720x75               0x39
1001 #define         RES1280x720x85               0x3A
1002 #define         RES1280x960x60               0x3B
1003 #define         RES720x480x60                0x3C
1004 #define         RES720x576x56                0x3D
1005 #define         RES856x480x79I               0x3E
1006 #define         RES856x480x60                0x3F
1007 #define         RES1280x768x60               0x40
1008 #define         RES1400x1050x60              0x41
1009 #define         RES1152x864x60               0x42
1010 #define         RES1152x864x75               0x43
1011 #define         RES1024x768x160              0x44
1012 #define         RES1280x960x75               0x45
1013 #define         RES1280x960x85               0x46
1014 #define         RES1280x960x120              0x47
1015
1016 #define         LFBDRAMTrap                  0x30
1017 #endif