1 /* $XFree86$ */
2 /* $XdotOrg$ */
3 /*
4  * Global definitions for init.c and init301.c
5  *
6  * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
7  *
8  * If distributed as part of the Linux kernel, the following license terms
9  * apply:
10  *
11  * * This program is free software; you can redistribute it and/or modify
12  * * it under the terms of the GNU General Public License as published by
13  * * the Free Software Foundation; either version 2 of the named License,
14  * * or any later version.
15  * *
16  * * This program is distributed in the hope that it will be useful,
17  * * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * * GNU General Public License for more details.
20  * *
21  * * You should have received a copy of the GNU General Public License
22  * * along with this program; if not, write to the Free Software
23  * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
24  *
25  * Otherwise, the following license terms apply:
26  *
27  * * Redistribution and use in source and binary forms, with or without
28  * * modification, are permitted provided that the following conditions
29  * * are met:
30  * * 1) Redistributions of source code must retain the above copyright
31  * *    notice, this list of conditions and the following disclaimer.
32  * * 2) Redistributions in binary form must reproduce the above copyright
33  * *    notice, this list of conditions and the following disclaimer in the
34  * *    documentation and/or other materials provided with the distribution.
35  * * 3) The name of the author may not be used to endorse or promote products
36  * *    derived from this software without specific prior written permission.
37  * *
38  * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
39  * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
40  * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
41  * * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
42  * * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
43  * * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
44  * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
45  * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
46  * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
47  * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
48  *
49  * Author: 	Thomas Winischhofer <thomas@winischhofer.net>
50  *
51  */
52 
53 #ifndef _INITDEF_
54 #define _INITDEF_
55 
56 #define IS_SIS330		(HwInfo->jChipType == SIS_330)
57 #define IS_SIS550		(HwInfo->jChipType == SIS_550)
58 #define IS_SIS650		(HwInfo->jChipType == SIS_650)  /* All versions, incl 651, M65x */
59 #define IS_SIS740		(HwInfo->jChipType == SIS_740)
60 #define IS_SIS651	        (SiS_Pr->SiS_SysFlags & (SF_Is651 | SF_Is652))
61 #define IS_SISM650	        (SiS_Pr->SiS_SysFlags & (SF_IsM650 | SF_IsM652 | SF_IsM653))
62 #define IS_SIS65x               (IS_SIS651 || IS_SISM650)       /* Only special versions of 65x */
63 #define IS_SIS661		(HwInfo->jChipType == SIS_661)
64 #define IS_SIS741		(HwInfo->jChipType == SIS_741)
65 #define IS_SIS660		(HwInfo->jChipType == SIS_660)
66 #define IS_SIS760		(HwInfo->jChipType == SIS_760)
67 #define IS_SIS661741660760	(IS_SIS661 || IS_SIS741 || IS_SIS660 || IS_SIS760)
68 #define IS_SIS650740            ((HwInfo->jChipType >= SIS_650) && (HwInfo->jChipType < SIS_330))
69 #define IS_SIS550650740         (IS_SIS550 || IS_SIS650740)
70 #define IS_SIS650740660         (IS_SIS650 || IS_SIS740 || IS_SIS661741660760)
71 #define IS_SIS550650740660      (IS_SIS550 || IS_SIS650740660)
72 
73 #define SISGETROMW(x)		(ROMAddr[(x)] | (ROMAddr[(x)+1] << 8))
74 
75 /* SiS_VBType */
76 #define VB_SIS301	      	0x0001
77 #define VB_SIS301B        	0x0002
78 #define VB_SIS302B        	0x0004
79 #define VB_SIS301LV     	0x0008
80 #define VB_SIS302LV     	0x0010
81 #define VB_SIS302ELV		0x0020
82 #define VB_SIS301C              0x0040
83 #define VB_NoLCD        	0x8000
84 #define VB_SIS301BLV302BLV      (VB_SIS301B|VB_SIS301C|VB_SIS302B|VB_SIS301LV|VB_SIS302LV|VB_SIS302ELV)
85 #define VB_SIS301B302B          (VB_SIS301B|VB_SIS301C|VB_SIS302B)
86 #define VB_SIS301LV302LV        (VB_SIS301LV|VB_SIS302LV|VB_SIS302ELV)
87 #define VB_SISVB		(VB_SIS301 | VB_SIS301BLV302BLV)
88 #define VB_SISTMDS		(VB_SIS301 | VB_SIS301B302B)
89 #define VB_SISLVDS		VB_SIS301LV302LV
90 
91 /* VBInfo */
92 #define SetSimuScanMode         0x0001   /* CR 30 */
93 #define SwitchCRT2              0x0002
94 #define SetCRT2ToAVIDEO         0x0004
95 #define SetCRT2ToSVIDEO         0x0008
96 #define SetCRT2ToSCART          0x0010
97 #define SetCRT2ToLCD            0x0020
98 #define SetCRT2ToRAMDAC         0x0040
99 #define SetCRT2ToHiVision       0x0080   		/* for SiS bridge */
100 #define SetCRT2ToCHYPbPr       	SetCRT2ToHiVision	/* for Chrontel   */
101 #define SetNTSCTV               0x0000   /* CR 31 */
102 #define SetPALTV                0x0100   		/* Deprecated here, now in TVMode */
103 #define SetInSlaveMode          0x0200
104 #define SetNotSimuMode          0x0400
105 #define SetNotSimuTVMode        SetNotSimuMode
106 #define SetDispDevSwitch        0x0800
107 #define SetCRT2ToYPbPr525750    0x0800
108 #define LoadDACFlag             0x1000
109 #define DisableCRT2Display      0x2000
110 #define DriverMode              0x4000
111 #define HotKeySwitch            0x8000
112 #define SetCRT2ToLCDA           0x8000
113 
114 /* v-- Needs change in sis_vga.c if changed (GPIO) --v */
115 #define SetCRT2ToTV             (SetCRT2ToYPbPr525750|SetCRT2ToHiVision|SetCRT2ToSCART|SetCRT2ToSVIDEO|SetCRT2ToAVIDEO)
116 #define SetCRT2ToTVNoYPbPrHiVision (SetCRT2ToSCART | SetCRT2ToSVIDEO | SetCRT2ToAVIDEO)
117 #define SetCRT2ToTVNoHiVision  	(SetCRT2ToYPbPr525750 | SetCRT2ToSCART | SetCRT2ToSVIDEO | SetCRT2ToAVIDEO)
118 
119 /* SiS_ModeType */
120 #define ModeText                0x00
121 #define ModeCGA                 0x01
122 #define ModeEGA                 0x02
123 #define ModeVGA                 0x03
124 #define Mode15Bpp               0x04
125 #define Mode16Bpp               0x05
126 #define Mode24Bpp               0x06
127 #define Mode32Bpp               0x07
128 
129 #define ModeInfoFlag            0x07
130 #define IsTextMode              0x07
131 
132 #define DACInfoFlag             0x0018
133 #define MemoryInfoFlag          0x01E0
134 #define MemorySizeShift         5
135 
136 /* modeflag */
137 #define Charx8Dot               0x0200
138 #define LineCompareOff          0x0400
139 #define CRT2Mode                0x0800
140 #define HalfDCLK                0x1000
141 #define NoSupportSimuTV         0x2000
142 #define NoSupportLCDScale	0x4000 /* TMDS: No scaling possible (no matter what panel) */
143 #define DoubleScanMode          0x8000
144 
145 /* Infoflag */
146 #define SupportTV               0x0008
147 #define SupportTV1024           0x0800
148 #define SupportCHTV 		0x0800
149 #define Support64048060Hz       0x0800  /* Special for 640x480 LCD */
150 #define SupportHiVision         0x0010
151 #define SupportYPbPr750p        0x1000
152 #define SupportLCD              0x0020
153 #define SupportRAMDAC2          0x0040	/* All           (<= 100Mhz) */
154 #define SupportRAMDAC2_135      0x0100  /* All except DH (<= 135Mhz) */
155 #define SupportRAMDAC2_162      0x0200  /* B, C          (<= 162Mhz) */
156 #define SupportRAMDAC2_202      0x0400  /* C             (<= 202Mhz) */
157 #define InterlaceMode           0x0080
158 #define SyncPP                  0x0000
159 #define SyncPN                  0x4000
160 #define SyncNP                  0x8000
161 #define SyncNN                  0xc000
162 
163 /* SetFlag */
164 #define ProgrammingCRT2         0x0001
165 #define LowModeTests		0x0002
166 /* #define TVSimuMode           0x0002 - deprecated */
167 /* #define RPLLDIV2XO           0x0004 - deprecated */
168 #define LCDVESATiming           0x0008
169 #define EnableLVDSDDA           0x0010
170 #define SetDispDevSwitchFlag    0x0020
171 #define CheckWinDos             0x0040
172 #define SetDOSMode              0x0080
173 
174 /* TVMode flag */
175 #define TVSetPAL		0x0001
176 #define TVSetNTSCJ		0x0002
177 #define TVSetPALM		0x0004
178 #define TVSetPALN		0x0008
179 #define TVSetCHOverScan		0x0010
180 #define TVSetYPbPr525i		0x0020 /* new 0x10 */
181 #define TVSetYPbPr525p		0x0040 /* new 0x20 */
182 #define TVSetYPbPr750p		0x0080 /* new 0x40 */
183 #define TVSetHiVision		0x0100 /* new 0x80; = 1080i, software-wise identical */
184 #define TVSetTVSimuMode		0x0200 /* new 0x200, prev. 0x800 */
185 #define TVRPLLDIV2XO		0x0400 /* prev 0x1000 */
186 #define TVSetNTSC1024		0x0800 /* new 0x100, prev. 0x2000 */
187 #define TVAspect43		0x2000
188 #define TVAspect169		0x4000
189 #define TVAspect43LB		0x8000
190 
191 /* YPbPr flag (>=315, <661; converted to TVMode) */
192 #define YPbPr525p               0x0001
193 #define YPbPr750p               0x0002
194 #define YPbPr525i               0x0004
195 #define YPbPrHiVision           0x0008
196 #define YPbPrModeMask           (YPbPr750p | YPbPr525p | YPbPr525i | YPbPrHiVision)
197 
198 /* SysFlags (to identify special versions) */
199 #define SF_Is651                0x0001
200 #define SF_IsM650               0x0002
201 #define SF_Is652		0x0004
202 #define SF_IsM652		0x0008
203 #define SF_IsM653		0x0010
204 #define SF_IsM661		0x0020
205 #define SF_IsM741		0x0040
206 #define SF_IsM760		0x0080
207 #define SF_760LFB		0x8000  /* 760: We have LFB */
208 
209 /* CR32 (Newer 630, and 315 series)
210 
211    [0]   VB connected with CVBS
212    [1]   VB connected with SVHS
213    [2]   VB connected with SCART
214    [3]   VB connected with LCD
215    [4]   VB connected with CRT2 (secondary VGA)
216    [5]   CRT1 monitor is connected
217    [6]   VB connected with Hi-Vision TV
218    [7]   <= 330: VB connected with DVI combo connector
219          >= 661: VB connected to YPbPr
220 */
221 
222 /* CR35 (300 series only) */
223 #define TVOverScan              0x10
224 #define TVOverScanShift         4
225 
226 /* CR35 (661 series only)
227 
228    [0]    1 = PAL, 0 = NTSC
229    [1]    1 = NTSC-J (if D0 = 0)
230    [2]    1 = PALM (if D0 = 1)
231    [3]    1 = PALN (if D0 = 1)
232    [4]    1 = Overscan (Chrontel only)
233    [7:5]  (only if D2 in CR38 is set)
234           000  525i
235  	  001  525p
236 	  010  750p
237 	  011  1080i (or HiVision on 301, 301B)
238 
239    These bits are being translated to TVMode flag.
240 
241 */
242 
243 /*
244    CR37
245 
246    [0]   Set 24/18 bit (0/1) RGB to LVDS/TMDS transmitter (set by BIOS)
247    [3:1] External chip
248          300 series:
249 	    001   SiS301 (never seen)
250 	    010   LVDS
251 	    011   LVDS + Tumpion Zurac
252 	    100   LVDS + Chrontel 7005
253 	    110   Chrontel 7005
254 	  315/330 series
255 	    001   SiS30x (never seen)
256 	    010   LVDS
257 	    011   LVDS + Chrontel 7019
258 	  660 series [2:1] only:
259 	     reserved (now in CR38)
260 	  All other combinations reserved
261    [3]    661 only: Pass 1:1 data
262    [4]    LVDS: 0: Panel Link expands / 1: Panel Link does not expand
263           30x:  0: Bridge scales      / 1: Bridge does not scale = Panel scales (if possible)
264    [5]    LCD polarity select
265           0: VESA DMT Standard
266 	  1: EDID 2.x defined
267    [6]    LCD horizontal polarity select
268           0: High active
269 	  1: Low active
270    [7]    LCD vertical polarity select
271           0: High active
272 	  1: Low active
273 */
274 
275 /* CR37: LCDInfo */
276 #define LCDRGB18Bit           0x0001
277 #define LCDNonExpanding       0x0010
278 #define LCDSync               0x0020
279 #define LCDPass11             0x0100   /* 0: center screen, 1: Pass 1:1 data */
280 #define LCDDualLink	      0x0200
281 
282 #define DontExpandLCD	      LCDNonExpanding
283 #define LCDNonExpandingShift       4
284 #define DontExpandLCDShift    LCDNonExpandingShift
285 #define LCDSyncBit            0x00e0
286 #define LCDSyncShift               6
287 
288 /* CR38 (315 series) */
289 #define EnableDualEdge 		0x01
290 #define SetToLCDA		0x02   /* LCD channel A (301C/302B/30x(E)LV and 650+LVDS only) */
291 #define EnableCHScart           0x04   /* Scart on Ch7019 (unofficial definition - TW) */
292 #define EnableCHYPbPr           0x08   /* YPbPr on Ch7019 (480i HDTV); only on 650/Ch7019 systems */
293 #define EnableSiSYPbPr          0x08   /* Enable YPbPr mode (30xLV/301C only) */
294 #define EnableYPbPr525i         0x00   /* Enable 525i YPbPr mode (30xLV/301C only) (mask 0x30) */
295 #define EnableYPbPr525p         0x10   /* Enable 525p YPbPr mode (30xLV/301C only) (mask 0x30) */
296 #define EnableYPbPr750p         0x20   /* Enable 750p YPbPr mode (30xLV/301C only) (mask 0x30) */
297 #define EnableYPbPr1080i        0x30   /* Enable 1080i YPbPr mode (30xLV/301C only) (mask 0x30) */
298 #define EnablePALM              0x40   /* 1 = Set PALM */
299 #define EnablePALN              0x80   /* 1 = Set PALN */
300 #define EnableNTSCJ             EnablePALM  /* Not BIOS */
301 
302 /* CR38 (661 and later)
303   D[7:5]  000 No VB
304           001 301 series VB
305 	  010 LVDS
306 	  011 Chrontel 7019
307 	  100 Conexant
308   D2      Enable YPbPr output (see CR35)
309   D[1:0]  LCDA (like before)
310 */
311 
312 #define EnablePALMN             0x40   /* Romflag: 1 = Allow PALM/PALN */
313 
314 /* CR39 (650 only) */
315 #define LCDPass1_1		0x01   /* 0: center screen, 1: pass 1:1 data output  */
316 #define Enable302LV_DualLink    0x04   /* 302LV only; enable dual link */
317 
318 /* CR39 (661 and later)
319    D[1:0] YPbPr Aspect Ratio
320           00 4:3 letterbox
321 	  01 4:3
322 	  10 16:9
323 	  11 4:3
324 */
325 
326 /* CR3B (651+301C)
327    D[1:0] YPbPr Aspect Ratio
328           ?
329 */
330 
331 /* CR79 (315/330 series only; not 661 and later)
332    [3-0] Notify driver
333          0001 Mode Switch event (set by BIOS)
334 	 0010 Epansion On/Off event
335 	 0011 TV UnderScan/OverScan event
336 	 0100 Set Brightness event
337 	 0101 Set Contrast event
338 	 0110 Set Mute event
339 	 0111 Set Volume Up/Down event
340    [4]   Enable Backlight Control by BIOS/driver
341          (set by driver; set means that the BIOS should
342 	 not touch the backlight registers because eg.
343 	 the driver already switched off the backlight)
344    [5]   PAL/NTSC (set by BIOS)
345    [6]   Expansion On/Off (set by BIOS; copied to CR32[4])
346    [7]   TV UnderScan/OverScan (set by BIOS)
347 */
348 
349 /* LCDResInfo */
350 #define Panel300_800x600        0x01	/* CR36 */
351 #define Panel300_1024x768       0x02
352 #define Panel300_1280x1024      0x03
353 #define Panel300_1280x960       0x04
354 #define Panel300_640x480        0x05
355 #define Panel300_1024x600       0x06
356 #define Panel300_1152x768       0x07
357 #define Panel300_1280x768       0x0a
358 #define Panel300_320x480        0x0e 	/* fstn - This is fake, can be any */
359 #define Panel300_Custom		0x0f
360 #define Panel300_Barco1366      0x10
361 
362 #define Panel310_800x600        0x01
363 #define Panel310_1024x768       0x02
364 #define Panel310_1280x1024      0x03
365 #define Panel310_640x480        0x04
366 #define Panel310_1024x600       0x05
367 #define Panel310_1152x864       0x06
368 #define Panel310_1280x960       0x07
369 #define Panel310_1152x768       0x08	/* LVDS only */
370 #define Panel310_1400x1050      0x09
371 #define Panel310_1280x768       0x0a
372 #define Panel310_1600x1200      0x0b
373 #define Panel310_640x480_2      0x0c
374 #define Panel310_640x480_3      0x0d
375 #define Panel310_320x480        0x0e    /* fstn - TW: This is fake, can be any */
376 #define Panel310_Custom		0x0f
377 
378 #define Panel661_800x600        0x01
379 #define Panel661_1024x768       0x02
380 #define Panel661_1280x1024      0x03
381 #define Panel661_640x480        0x04
382 #define Panel661_1024x600       0x05
383 #define Panel661_1152x864       0x06
384 #define Panel661_1280x960       0x07
385 #define Panel661_1152x768       0x08
386 #define Panel661_1400x1050      0x09
387 #define Panel661_1280x768       0x0a
388 #define Panel661_1600x1200      0x0b
389 #define Panel661_1280x800       0x0c
390 #define Panel661_1680x1050      0x0d
391 #define Panel661_1280x720       0x0e
392 #define Panel661_Custom		0x0f
393 
394 #define Panel_800x600           0x01	/* Unified values */
395 #define Panel_1024x768          0x02    /* MUST match BIOS values from 0-e */
396 #define Panel_1280x1024         0x03
397 #define Panel_640x480           0x04
398 #define Panel_1024x600          0x05
399 #define Panel_1152x864          0x06
400 #define Panel_1280x960          0x07
401 #define Panel_1152x768          0x08	/* LVDS only */
402 #define Panel_1400x1050         0x09
403 #define Panel_1280x768          0x0a    /* 30xB/C and LVDS only (BIOS: all) */
404 #define Panel_1600x1200         0x0b
405 #define Panel_1280x800		0x0c    /* 661etc  */
406 #define Panel_1680x1050         0x0d    /* 661etc  */
407 #define Panel_1280x720		0x0e    /* 661etc  */
408 #define Panel_Custom		0x0f	/* MUST BE 0x0f (for DVI DDC detection */
409 #define Panel_320x480           0x10    /* SiS 550 fstn - TW: This is fake, can be any */
410 #define Panel_Barco1366         0x11
411 #define Panel_848x480		0x12
412 #define Panel_640x480_2		0x13    /* SiS 550 */
413 #define Panel_640x480_3		0x14    /* SiS 550 */
414 #define Panel_1280x768_2        0x15	/* 30xLV */
415 #define Panel_1280x768_3        0x16    /* 30xLV */
416 
417 /* Index in ModeResInfo table */
418 #define SIS_RI_320x200    0
419 #define SIS_RI_320x240    1
420 #define SIS_RI_320x400    2
421 #define SIS_RI_400x300    3
422 #define SIS_RI_512x384    4
423 #define SIS_RI_640x400    5
424 #define SIS_RI_640x480    6
425 #define SIS_RI_800x600    7
426 #define SIS_RI_1024x768   8
427 #define SIS_RI_1280x1024  9
428 #define SIS_RI_1600x1200 10
429 #define SIS_RI_1920x1440 11
430 #define SIS_RI_2048x1536 12
431 #define SIS_RI_720x480   13
432 #define SIS_RI_720x576   14
433 #define SIS_RI_1280x960  15
434 #define SIS_RI_800x480   16
435 #define SIS_RI_1024x576  17
436 #define SIS_RI_1280x720  18
437 #define SIS_RI_856x480   19
438 #define SIS_RI_1280x768  20
439 #define SIS_RI_1400x1050 21
440 #define SIS_RI_1152x864  22  /* Up to this SiS conforming */
441 #define SIS_RI_848x480   23
442 #define SIS_RI_1360x768  24
443 #define SIS_RI_1024x600  25
444 #define SIS_RI_1152x768  26
445 #define SIS_RI_768x576   27
446 #define SIS_RI_1360x1024 28
447 #define SIS_RI_1680x1050 29
448 #define SIS_RI_1280x800  30
449 
450 /* CR5F */
451 #define IsM650                  0x80
452 
453 /* Timing data */
454 #define NTSCHT                  1716
455 #define NTSC2HT                 1920
456 #define NTSCVT                  525
457 #define PALHT                   1728
458 #define PALVT                   625
459 #define StHiTVHT                892
460 #define StHiTVVT                1126
461 #define StHiTextTVHT            1000
462 #define StHiTextTVVT            1126
463 #define ExtHiTVHT               2100
464 #define ExtHiTVVT               1125
465 
466 /* Indices in (VB)VCLKData tables */
467 
468 #define VCLK28                  0x00   /* Index in VCLKData table (300 and 315) */
469 #define VCLK40                  0x04   /* Index in VCLKData table (300 and 315) */
470 #define VCLK65_300              0x09   /* Index in VCLKData table (300) */
471 #define VCLK108_2_300           0x14   /* Index in VCLKData table (300) */
472 #define VCLK81_300		0x3f   /* Index in VCLKData table (300) */
473 #define VCLK108_3_300           0x42   /* Index in VCLKData table (300) */
474 #define VCLK100_300             0x43   /* Index in VCLKData table (300) */
475 #define VCLK34_300              0x3d   /* Index in VCLKData table (300) */
476 #define VCLK_CUSTOM_300		0x46
477 #define VCLK65_315              0x0b   /* Index in (VB)VCLKData table (315) */
478 #define VCLK108_2_315           0x19   /* Index in (VB)VCLKData table (315) */
479 #define VCLK81_315		0x5b   /* Index in (VB)VCLKData table (315) */
480 #define VCLK162_315             0x5e   /* Index in (VB)VCLKData table (315) */
481 #define VCLK108_3_315           0x45   /* Index in VBVCLKData table (315) */
482 #define VCLK100_315             0x46   /* Index in VBVCLKData table (315) */
483 #define VCLK34_315              0x55
484 #define VCLK68_315		0x0d
485 #define VCLK69_315		0x5c   /* deprecated ! Index in VBVCLKData table (315) */
486 #define VCLK83_315		0x5c   /* Index in VBVCLKData table (315) */
487 #define VCLK121_315		0x5d   /* Index in VBVCLKData table (315) */
488 #define VCLK_1280x720		0x5f
489 #define VCLK_1280x768_2		0x60
490 #define VCLK_1280x768_3		0x61
491 #define VCLK_CUSTOM_315		0x62
492 #define VCLK_1280x720_2		0x63
493 #define VCLK_720x480		0x67
494 #define VCLK_720x576		0x68
495 #define VCLK_768x576		0x68
496 #define VCLK_848x480		0x65
497 #define VCLK_856x480		0x66
498 #define VCLK_800x480		0x65
499 #define VCLK_1024x576		0x51
500 #define VCLK_1152x864		0x64
501 #define VCLK_1360x768		0x58
502 
503 #define TVCLKBASE_300		0x21   /* Indices on TV clocks in VCLKData table (300) */
504 #define TVCLKBASE_315	        0x3a   /* Indices on TV clocks in (VB)VCLKData table (315) */
505 #define TVVCLKDIV2              0x00   /* Index relative to TVCLKBASE */
506 #define TVVCLK                  0x01   /* Index relative to TVCLKBASE */
507 #define HiTVVCLKDIV2            0x02   /* Index relative to TVCLKBASE */
508 #define HiTVVCLK                0x03   /* Index relative to TVCLKBASE */
509 #define HiTVSimuVCLK            0x04   /* Index relative to TVCLKBASE */
510 #define HiTVTextVCLK            0x05   /* Index relative to TVCLKBASE */
511 #define YPbPr750pVCLK		0x25   /* Index relative to TVCLKBASE; was 0x0f NOT relative */
512 
513 /* ------------------------------ */
514 
515 #define SetSCARTOutput          0x01
516 
517 #define HotPlugFunction         0x08
518 
519 #define StStructSize            0x06
520 
521 #define SIS_VIDEO_CAPTURE       0x00 - 0x30
522 #define SIS_VIDEO_PLAYBACK      0x02 - 0x30
523 #define SIS_CRT2_PORT_04        0x04 - 0x30
524 #define SIS_CRT2_PORT_10        0x10 - 0x30
525 #define SIS_CRT2_PORT_12        0x12 - 0x30
526 #define SIS_CRT2_PORT_14        0x14 - 0x30
527 
528 #define ADR_CRT2PtrData         0x20E
529 #define offset_Zurac            0x210   /* TW: Trumpion Zurac data pointer */
530 #define ADR_LVDSDesPtrData      0x212
531 #define ADR_LVDSCRT1DataPtr     0x214
532 #define ADR_CHTVVCLKPtr         0x216
533 #define ADR_CHTVRegDataPtr      0x218
534 
535 #define LCDDataLen              8
536 #define HiTVDataLen             12
537 #define TVDataLen               16
538 
539 #define LVDSDataLen             6
540 #define LVDSDesDataLen          3
541 #define ActiveNonExpanding      0x40
542 #define ActiveNonExpandingShift 6
543 #define ActivePAL               0x20
544 #define ActivePALShift          5
545 #define ModeSwitchStatus        0x0F
546 #define SoftTVType              0x40
547 #define SoftSettingAddr         0x52
548 #define ModeSettingAddr         0x53
549 
550 #define _PanelType00             0x00
551 #define _PanelType01             0x08
552 #define _PanelType02             0x10
553 #define _PanelType03             0x18
554 #define _PanelType04             0x20
555 #define _PanelType05             0x28
556 #define _PanelType06             0x30
557 #define _PanelType07             0x38
558 #define _PanelType08             0x40
559 #define _PanelType09             0x48
560 #define _PanelType0A             0x50
561 #define _PanelType0B             0x58
562 #define _PanelType0C             0x60
563 #define _PanelType0D             0x68
564 #define _PanelType0E             0x70
565 #define _PanelType0F             0x78
566 
567 #define PRIMARY_VGA       	0     /* 1: SiS is primary vga 0:SiS is secondary vga */
568 
569 #define BIOSIDCodeAddr          0x235  /* Offsets to ptrs in BIOS image */
570 #define OEMUtilIDCodeAddr       0x237
571 #define VBModeIDTableAddr       0x239
572 #define OEMTVPtrAddr            0x241
573 #define PhaseTableAddr          0x243
574 #define NTSCFilterTableAddr     0x245
575 #define PALFilterTableAddr      0x247
576 #define OEMLCDPtr_1Addr         0x249
577 #define OEMLCDPtr_2Addr         0x24B
578 #define LCDHPosTable_1Addr      0x24D
579 #define LCDHPosTable_2Addr      0x24F
580 #define LCDVPosTable_1Addr      0x251
581 #define LCDVPosTable_2Addr      0x253
582 #define OEMLCDPIDTableAddr      0x255
583 
584 #define VBModeStructSize        5
585 #define PhaseTableSize          4
586 #define FilterTableSize         4
587 #define LCDHPosTableSize        7
588 #define LCDVPosTableSize        5
589 #define OEMLVDSPIDTableSize     4
590 #define LVDSHPosTableSize       4
591 #define LVDSVPosTableSize       6
592 
593 #define VB_ModeID               0
594 #define VB_TVTableIndex         1
595 #define VB_LCDTableIndex        2
596 #define VB_LCDHIndex            3
597 #define VB_LCDVIndex            4
598 
599 #define OEMLCDEnable            0x0001
600 #define OEMLCDDelayEnable       0x0002
601 #define OEMLCDPOSEnable         0x0004
602 #define OEMTVEnable             0x0100
603 #define OEMTVDelayEnable        0x0200
604 #define OEMTVFlickerEnable      0x0400
605 #define OEMTVPhaseEnable        0x0800
606 #define OEMTVFilterEnable       0x1000
607 
608 #define OEMLCDPanelIDSupport    0x0080
609 
610 /*
611   =============================================================
612    		  for 315 series (old data layout)
613   =============================================================
614 */
615 #define SoftDRAMType        0x80
616 #define SoftSetting_OFFSET  0x52
617 #define SR07_OFFSET  0x7C
618 #define SR15_OFFSET  0x7D
619 #define SR16_OFFSET  0x81
620 #define SR17_OFFSET  0x85
621 #define SR19_OFFSET  0x8D
622 #define SR1F_OFFSET  0x99
623 #define SR21_OFFSET  0x9A
624 #define SR22_OFFSET  0x9B
625 #define SR23_OFFSET  0x9C
626 #define SR24_OFFSET  0x9D
627 #define SR25_OFFSET  0x9E
628 #define SR31_OFFSET  0x9F
629 #define SR32_OFFSET  0xA0
630 #define SR33_OFFSET  0xA1
631 
632 #define CR40_OFFSET  0xA2
633 #define SR25_1_OFFSET  0xF6
634 #define CR49_OFFSET  0xF7
635 
636 #define VB310Data_1_2_Offset  0xB6
637 #define VB310Data_4_D_Offset  0xB7
638 #define VB310Data_4_E_Offset  0xB8
639 #define VB310Data_4_10_Offset 0xBB
640 
641 #define RGBSenseDataOffset    0xBD
642 #define YCSenseDataOffset     0xBF
643 #define VideoSenseDataOffset  0xC1
644 #define OutputSelectOffset    0xF3
645 
646 #define ECLK_MCLK_DISTANCE  0x14
647 #define VBIOSTablePointerStart    0x100
648 #define StandTablePtrOffset       VBIOSTablePointerStart+0x02
649 #define EModeIDTablePtrOffset     VBIOSTablePointerStart+0x04
650 #define CRT1TablePtrOffset        VBIOSTablePointerStart+0x06
651 #define ScreenOffsetPtrOffset     VBIOSTablePointerStart+0x08
652 #define VCLKDataPtrOffset         VBIOSTablePointerStart+0x0A
653 #define MCLKDataPtrOffset         VBIOSTablePointerStart+0x0E
654 #define CRT2PtrDataPtrOffset      VBIOSTablePointerStart+0x10
655 #define TVAntiFlickPtrOffset      VBIOSTablePointerStart+0x12
656 #define TVDelayPtr1Offset         VBIOSTablePointerStart+0x14
657 #define TVPhaseIncrPtr1Offset     VBIOSTablePointerStart+0x16
658 #define TVYFilterPtr1Offset       VBIOSTablePointerStart+0x18
659 #define LCDDelayPtr1Offset        VBIOSTablePointerStart+0x20
660 #define TVEdgePtr1Offset          VBIOSTablePointerStart+0x24
661 #define CRT2Delay1Offset          VBIOSTablePointerStart+0x28
662 
663 #endif
664