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