[PATCH] intelfb: extend partial support of i915G to include i915GM
[safe/jmp/linux-2.6] / drivers / video / sis / init.h
1 /* $XFree86$ */
2 /* $XdotOrg$ */
3 /*
4  * Data and prototypes for init.c
5  *
6  * Copyright (C) 2001-2005 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 EXPRESS 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 _INIT_H_
54 #define _INIT_H_
55
56 #include "osdef.h"
57 #include "initdef.h"
58
59 #ifdef SIS_XORG_XF86
60 #include "sis.h"
61 #define SIS_NEED_inSISREG
62 #define SIS_NEED_inSISREGW
63 #define SIS_NEED_inSISREGL
64 #define SIS_NEED_outSISREG
65 #define SIS_NEED_outSISREGW
66 #define SIS_NEED_outSISREGL
67 #include "sis_regs.h"
68 #endif
69
70 #ifdef SIS_LINUX_KERNEL
71 #include "vgatypes.h"
72 #include "vstruct.h"
73 #ifdef SIS_CP
74 #undef SIS_CP
75 #endif
76 #include <linux/config.h>
77 #include <linux/version.h>
78 #include <linux/types.h>
79 #include <asm/io.h>
80 #include <linux/fb.h>
81 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
82 #include <video/fbcon.h>
83 #endif
84 #include "sis.h"
85 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
86 #include <linux/sisfb.h>
87 #else
88 #include <video/sisfb.h>
89 #endif
90 #endif
91
92 /* Mode numbers */
93 static const unsigned short ModeIndex_320x200[]      = {0x59, 0x41, 0x00, 0x4f};
94 static const unsigned short ModeIndex_320x240[]      = {0x50, 0x56, 0x00, 0x53};
95 static const unsigned short ModeIndex_320x240_FSTN[] = {0x5a, 0x5b, 0x00, 0x00};  /* FSTN */
96 static const unsigned short ModeIndex_400x300[]      = {0x51, 0x57, 0x00, 0x54};
97 static const unsigned short ModeIndex_512x384[]      = {0x52, 0x58, 0x00, 0x5c};
98 static const unsigned short ModeIndex_640x400[]      = {0x2f, 0x5d, 0x00, 0x5e};
99 static const unsigned short ModeIndex_640x480[]      = {0x2e, 0x44, 0x00, 0x62};
100 static const unsigned short ModeIndex_720x480[]      = {0x31, 0x33, 0x00, 0x35};
101 static const unsigned short ModeIndex_720x576[]      = {0x32, 0x34, 0x00, 0x36};
102 static const unsigned short ModeIndex_768x576[]      = {0x5f, 0x60, 0x00, 0x61};
103 static const unsigned short ModeIndex_800x480[]      = {0x70, 0x7a, 0x00, 0x76};
104 static const unsigned short ModeIndex_800x600[]      = {0x30, 0x47, 0x00, 0x63};
105 static const unsigned short ModeIndex_848x480[]      = {0x39, 0x3b, 0x00, 0x3e};
106 static const unsigned short ModeIndex_856x480[]      = {0x3f, 0x42, 0x00, 0x45};
107 static const unsigned short ModeIndex_960x540[]      = {0x1d, 0x1e, 0x00, 0x1f};  /* 315 series only */
108 static const unsigned short ModeIndex_960x600[]      = {0x20, 0x21, 0x00, 0x22};  /* 315 series only */
109 static const unsigned short ModeIndex_1024x768[]     = {0x38, 0x4a, 0x00, 0x64};
110 static const unsigned short ModeIndex_1024x576[]     = {0x71, 0x74, 0x00, 0x77};
111 static const unsigned short ModeIndex_1024x600[]     = {0x20, 0x21, 0x00, 0x22};  /* 300 series only */
112 static const unsigned short ModeIndex_1280x1024[]    = {0x3a, 0x4d, 0x00, 0x65};
113 static const unsigned short ModeIndex_1280x960[]     = {0x7c, 0x7d, 0x00, 0x7e};
114 static const unsigned short ModeIndex_1152x768[]     = {0x23, 0x24, 0x00, 0x25};  /* 300 series only */
115 static const unsigned short ModeIndex_1152x864[]     = {0x29, 0x2a, 0x00, 0x2b};
116 static const unsigned short ModeIndex_300_1280x768[] = {0x55, 0x5a, 0x00, 0x5b};
117 static const unsigned short ModeIndex_310_1280x768[] = {0x23, 0x24, 0x00, 0x25};
118 static const unsigned short ModeIndex_1280x720[]     = {0x79, 0x75, 0x00, 0x78};
119 static const unsigned short ModeIndex_1280x800[]     = {0x14, 0x15, 0x00, 0x16};
120 static const unsigned short ModeIndex_1280x854[]     = {0x1a, 0x1b, 0x00, 0x1c};
121 static const unsigned short ModeIndex_1360x768[]     = {0x48, 0x4b, 0x00, 0x4e};
122 static const unsigned short ModeIndex_300_1360x1024[]= {0x67, 0x6f, 0x00, 0x72};  /* 300 series, BARCO only */
123 static const unsigned short ModeIndex_1400x1050[]    = {0x26, 0x27, 0x00, 0x28};  /* 315 series only */
124 static const unsigned short ModeIndex_1680x1050[]    = {0x17, 0x18, 0x00, 0x19};  /* 315 series only */
125 static const unsigned short ModeIndex_1600x1200[]    = {0x3c, 0x3d, 0x00, 0x66};
126 static const unsigned short ModeIndex_1920x1080[]    = {0x2c, 0x2d, 0x00, 0x73};  /* 315 series only */
127 static const unsigned short ModeIndex_1920x1440[]    = {0x68, 0x69, 0x00, 0x6b};
128 static const unsigned short ModeIndex_300_2048x1536[]= {0x6c, 0x6d, 0x00, 0x00};
129 static const unsigned short ModeIndex_310_2048x1536[]= {0x6c, 0x6d, 0x00, 0x6e};
130
131 static const unsigned short SiS_DRAMType[17][5]={
132         {0x0C,0x0A,0x02,0x40,0x39},
133         {0x0D,0x0A,0x01,0x40,0x48},
134         {0x0C,0x09,0x02,0x20,0x35},
135         {0x0D,0x09,0x01,0x20,0x44},
136         {0x0C,0x08,0x02,0x10,0x31},
137         {0x0D,0x08,0x01,0x10,0x40},
138         {0x0C,0x0A,0x01,0x20,0x34},
139         {0x0C,0x09,0x01,0x08,0x32},
140         {0x0B,0x08,0x02,0x08,0x21},
141         {0x0C,0x08,0x01,0x08,0x30},
142         {0x0A,0x08,0x02,0x04,0x11},
143         {0x0B,0x0A,0x01,0x10,0x28},
144         {0x09,0x08,0x02,0x02,0x01},
145         {0x0B,0x09,0x01,0x08,0x24},
146         {0x0B,0x08,0x01,0x04,0x20},
147         {0x0A,0x08,0x01,0x02,0x10},
148         {0x09,0x08,0x01,0x01,0x00}
149 };
150
151 static const unsigned short SiS_SDRDRAM_TYPE[13][5] =
152 {
153         { 2,12, 9,64,0x35},
154         { 1,13, 9,64,0x44},
155         { 2,12, 8,32,0x31},
156         { 2,11, 9,32,0x25},
157         { 1,12, 9,32,0x34},
158         { 1,13, 8,32,0x40},
159         { 2,11, 8,16,0x21},
160         { 1,12, 8,16,0x30},
161         { 1,11, 9,16,0x24},
162         { 1,11, 8, 8,0x20},
163         { 2, 9, 8, 4,0x01},
164         { 1,10, 8, 4,0x10},
165         { 1, 9, 8, 2,0x00}
166 };
167
168 static const unsigned short SiS_DDRDRAM_TYPE[4][5] =
169 {
170         { 2,12, 9,64,0x35},
171         { 2,12, 8,32,0x31},
172         { 2,11, 8,16,0x21},
173         { 2, 9, 8, 4,0x01}
174 };
175
176 static const unsigned char SiS_MDA_DAC[] =
177 {
178         0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
179         0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,
180         0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,
181         0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,
182         0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
183         0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,
184         0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,
185         0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F
186 };
187
188 static const unsigned char SiS_CGA_DAC[] =
189 {
190         0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15,
191         0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15,
192         0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F,
193         0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F,
194         0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15,
195         0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15,
196         0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F,
197         0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F
198 };
199
200 static const unsigned char SiS_EGA_DAC[] =
201 {
202         0x00,0x10,0x04,0x14,0x01,0x11,0x05,0x15,
203         0x20,0x30,0x24,0x34,0x21,0x31,0x25,0x35,
204         0x08,0x18,0x0C,0x1C,0x09,0x19,0x0D,0x1D,
205         0x28,0x38,0x2C,0x3C,0x29,0x39,0x2D,0x3D,
206         0x02,0x12,0x06,0x16,0x03,0x13,0x07,0x17,
207         0x22,0x32,0x26,0x36,0x23,0x33,0x27,0x37,
208         0x0A,0x1A,0x0E,0x1E,0x0B,0x1B,0x0F,0x1F,
209         0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F
210 };
211
212 static const unsigned char SiS_VGA_DAC[] =
213 {
214         0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15,
215         0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F,
216         0x00,0x05,0x08,0x0B,0x0E,0x11,0x14,0x18,
217         0x1C,0x20,0x24,0x28,0x2D,0x32,0x38,0x3F,
218         0x00,0x10,0x1F,0x2F,0x3F,0x1F,0x27,0x2F,
219         0x37,0x3F,0x2D,0x31,0x36,0x3A,0x3F,0x00,
220         0x07,0x0E,0x15,0x1C,0x0E,0x11,0x15,0x18,
221         0x1C,0x14,0x16,0x18,0x1A,0x1C,0x00,0x04,
222         0x08,0x0C,0x10,0x08,0x0A,0x0C,0x0E,0x10,
223         0x0B,0x0C,0x0D,0x0F,0x10
224 };
225
226 static const struct SiS_St SiS_SModeIDTable[] =
227 {
228         {0x01,0x9208,0x01,0x00,0x00,0x00,0x01,0x00,0x40},
229         {0x01,0x1210,0x14,0x01,0x01,0x00,0x01,0x00,0x40},
230         {0x01,0x1010,0x17,0x02,0x02,0x00,0x01,0x01,0x40},
231         {0x03,0x8208,0x03,0x00,0x00,0x00,0x01,0x02,0x40},
232         {0x03,0x0210,0x16,0x01,0x01,0x00,0x01,0x02,0x40},
233         {0x03,0x0010,0x18,0x02,0x02,0x00,0x01,0x03,0x40},
234         {0x05,0x9209,0x05,0x00,0x00,0x00,0x00,0x04,0x40},
235         {0x06,0x8209,0x06,0x00,0x00,0x00,0x00,0x05,0x40},
236         {0x07,0x0000,0x07,0x03,0x03,0x00,0x01,0x03,0x40},
237         {0x07,0x0000,0x19,0x02,0x02,0x00,0x01,0x03,0x40},
238         {0x0d,0x920a,0x0d,0x00,0x00,0x00,0x00,0x04,0x40},
239         {0x0e,0x820a,0x0e,0x00,0x00,0x00,0x00,0x05,0x40},
240         {0x0f,0x0202,0x11,0x01,0x01,0x00,0x00,0x05,0x40},
241         {0x10,0x0212,0x12,0x01,0x01,0x00,0x00,0x05,0x40},
242         {0x11,0x0212,0x1a,0x04,0x04,0x00,0x00,0x05,0x40},
243         {0x12,0x0212,0x1b,0x04,0x04,0x00,0x00,0x05,0x40},
244         {0x13,0x021b,0x1c,0x00,0x00,0x00,0x00,0x04,0x40},
245         {0x12,0x0010,0x18,0x02,0x02,0x00,0x00,0x05,0x40},
246         {0x12,0x0210,0x18,0x01,0x01,0x00,0x00,0x05,0x40},
247         {0xff,0x0000,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
248 };
249
250 static const struct SiS_StResInfo_S SiS_StResInfo[]=
251 {
252         { 640,400},
253         { 640,350},
254         { 720,400},
255         { 720,350},
256         { 640,480}
257 };
258
259 static const struct SiS_ModeResInfo_S SiS_ModeResInfo[] =
260 {
261         {  320, 200, 8, 8},   /* 0x00 */
262         {  320, 240, 8, 8},   /* 0x01 */
263         {  320, 400, 8, 8},   /* 0x02 */
264         {  400, 300, 8, 8},   /* 0x03 */
265         {  512, 384, 8, 8},   /* 0x04 */
266         {  640, 400, 8,16},   /* 0x05 */
267         {  640, 480, 8,16},   /* 0x06 */
268         {  800, 600, 8,16},   /* 0x07 */
269         { 1024, 768, 8,16},   /* 0x08 */
270         { 1280,1024, 8,16},   /* 0x09 */
271         { 1600,1200, 8,16},   /* 0x0a */
272         { 1920,1440, 8,16},   /* 0x0b */
273         { 2048,1536, 8,16},   /* 0x0c */
274         {  720, 480, 8,16},   /* 0x0d */
275         {  720, 576, 8,16},   /* 0x0e */
276         { 1280, 960, 8,16},   /* 0x0f */
277         {  800, 480, 8,16},   /* 0x10 */
278         { 1024, 576, 8,16},   /* 0x11 */
279         { 1280, 720, 8,16},   /* 0x12 */
280         {  856, 480, 8,16},   /* 0x13 */
281         { 1280, 768, 8,16},   /* 0x14 */
282         { 1400,1050, 8,16},   /* 0x15 */
283         { 1152, 864, 8,16},   /* 0x16 */
284         {  848, 480, 8,16},   /* 0x17 */
285         { 1360, 768, 8,16},   /* 0x18 */
286         { 1024, 600, 8,16},   /* 0x19 */
287         { 1152, 768, 8,16},   /* 0x1a */
288         {  768, 576, 8,16},   /* 0x1b */
289         { 1360,1024, 8,16},   /* 0x1c */
290         { 1680,1050, 8,16},   /* 0x1d */
291         { 1280, 800, 8,16},   /* 0x1e */
292         { 1920,1080, 8,16},   /* 0x1f */
293         {  960, 540, 8,16},   /* 0x20 */
294         {  960, 600, 8,16},   /* 0x21 */
295         { 1280, 854, 8,16}    /* 0x22 */
296 };
297
298 #if defined(SIS300) || defined(SIS315H)
299 static const struct SiS_StandTable_S SiS_StandTable[]=
300 {
301 /* 0x00: MD_0_200 */
302  {
303   0x28,0x18,0x08,0x0800,
304   {0x09,0x03,0x00,0x02},
305   0x63,
306   {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f,
307    0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00,
308    0x9c,0x8e,0x8f,0x14,0x1f,0x96,0xb9,0xa3,
309    0xff},
310   {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
311    0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
312    0x08,0x00,0x0f,0x00},
313   {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
314    0xff}
315  },
316 /* 0x01: MD_1_200 */
317  {
318   0x28,0x18,0x08,0x0800,
319   {0x09,0x03,0x00,0x02},
320   0x63,
321   {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f,
322    0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00,
323    0x9c,0x8e,0x8f,0x14,0x1f,0x96,0xb9,0xa3,
324    0xff},
325   {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
326    0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
327    0x08,0x00,0x0f,0x00},
328   {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
329    0xff}
330  },
331 /* 0x02: MD_2_200 */
332  {
333   0x50,0x18,0x08,0x1000,
334   {0x01,0x03,0x00,0x02},
335   0x63,
336   {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,
337    0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00,
338    0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3,
339    0xff},
340   {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
341    0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
342    0x08,0x00,0x0f,0x00},
343   {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
344    0xff}
345  },
346 /* 0x03: MD_3_200 - mode 0x03 - 0 */
347  {
348   0x50,0x18,0x08,0x1000,
349   {0x01,0x03,0x00,0x02},
350   0x63,
351   {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,
352    0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00,
353    0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3,
354    0xff},
355   {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
356    0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
357    0x08,0x00,0x0f,0x00},
358   {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
359    0xff}
360  },
361 /* 0x04: MD_4 */
362  {
363   0x28,0x18,0x08,0x4000,
364   {0x09,0x03,0x00,0x02},
365   0x63,
366   {0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f,   /* 0x2c is 2b for 300 */
367    0x00,0xc1,0x00,0x00,0x00,0x00,0x00,0x00,
368    0x9c,0x8e,0x8f,0x14,0x00,0x96,0xb9,0xa2,
369    0xff},
370   {0x00,0x13,0x15,0x17,0x02,0x04,0x06,0x07,
371    0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
372    0x01,0x00,0x03,0x00},
373   {0x00,0x00,0x00,0x00,0x00,0x30,0x0f,0x00,
374    0xff}
375  },
376 /* 0x05: MD_5 */
377  {
378   0x28,0x18,0x08,0x4000,
379   {0x09,0x03,0x00,0x02},
380   0x63,
381   {0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f,   /* 0x2c is 2b for 300 */
382    0x00,0xc1,0x00,0x00,0x00,0x00,0x00,0x00,
383    0x9c,0x8e,0x8f,0x14,0x00,0x96,0xb9,0xa2,
384    0xff},
385   {0x00,0x13,0x15,0x17,0x02,0x04,0x06,0x07,
386    0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
387    0x01,0x00,0x03,0x00},
388   {0x00,0x00,0x00,0x00,0x00,0x30,0x0f,0x00,
389    0xff}
390  },
391 /* 0x06: MD_6 */
392  {
393   0x50,0x18,0x08,0x4000,
394   {0x01,0x01,0x00,0x06},
395   0x63,
396   {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,   /* 55,81 is 54,80 for 300 */
397    0x00,0xc1,0x00,0x00,0x00,0x00,0x00,0x00,
398    0x9c,0x8e,0x8f,0x28,0x00,0x96,0xb9,0xc2,
399    0xff},
400   {0x00,0x17,0x17,0x17,0x17,0x17,0x17,0x17,
401    0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,
402    0x01,0x00,0x01,0x00},
403   {0x00,0x00,0x00,0x00,0x00,0x00,0x0d,0x00,
404    0xff}
405  },
406 /* 0x07: MD_7 */
407  {
408   0x50,0x18,0x0e,0x1000,
409   {0x00,0x03,0x00,0x03},
410   0xa6,
411   {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,
412    0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00,
413    0x83,0x85,0x5d,0x28,0x0d,0x63,0xba,0xa3,
414    0xff},
415   {0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08,
416    0x10,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
417    0x0e,0x00,0x0f,0x08},
418   {0x00,0x00,0x00,0x00,0x00,0x10,0x0a,0x00,
419    0xff}
420  },
421 /* 0x08: MDA_DAC */
422  {
423   0x00,0x00,0x00,0x0000,
424   {0x00,0x00,0x00,0x15},
425   0x15,
426   {0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,
427    0x15,0x15,0x15,0x15,0x15,0x15,0x3f,0x3f,
428    0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x00,
429    0x00},
430   {0x00,0x00,0x00,0x00,0x00,0x15,0x15,0x15,
431    0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,
432    0x15,0x15,0x15,0x15},
433   {0x15,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,
434    0x3f}
435  },
436 /* 0x09: CGA_DAC */
437  {
438   0x00,0x10,0x04,0x0114,
439   {0x11,0x09,0x15,0x00},
440   0x10,
441   {0x04,0x14,0x01,0x11,0x09,0x15,0x2a,0x3a,
442    0x2e,0x3e,0x2b,0x3b,0x2f,0x3f,0x2a,0x3a,
443    0x2e,0x3e,0x2b,0x3b,0x2f,0x3f,0x00,0x10,
444    0x04},
445   {0x14,0x01,0x11,0x09,0x15,0x00,0x10,0x04,
446    0x14,0x01,0x11,0x09,0x15,0x2a,0x3a,0x2e,
447    0x3e,0x2b,0x3b,0x2f},
448   {0x3f,0x2a,0x3a,0x2e,0x3e,0x2b,0x3b,0x2f,
449    0x3f}
450  },
451 /* 0x0a: EGA_DAC */
452  {
453   0x00,0x10,0x04,0x0114,
454   {0x11,0x05,0x15,0x20},
455   0x30,
456   {0x24,0x34,0x21,0x31,0x25,0x35,0x08,0x18,
457    0x0c,0x1c,0x09,0x19,0x0d,0x1d,0x28,0x38,
458    0x2c,0x3c,0x29,0x39,0x2d,0x3d,0x02,0x12,
459    0x06},
460   {0x16,0x03,0x13,0x07,0x17,0x22,0x32,0x26,
461    0x36,0x23,0x33,0x27,0x37,0x0a,0x1a,0x0e,
462    0x1e,0x0b,0x1b,0x0f},
463   {0x1f,0x2a,0x3a,0x2e,0x3e,0x2b,0x3b,0x2f,
464    0x3f}
465  },
466 /* 0x0b: VGA_DAC */
467  {
468   0x00,0x10,0x04,0x0114,
469   {0x11,0x09,0x15,0x2a},
470   0x3a,
471   {0x2e,0x3e,0x2b,0x3b,0x2f,0x3f,0x00,0x05,
472    0x08,0x0b,0x0e,0x11,0x14,0x18,0x1c,0x20,
473    0x24,0x28,0x2d,0x32,0x38,0x3f,0x00,0x10,
474    0x1f},
475   {0x2f,0x3f,0x1f,0x27,0x2f,0x37,0x3f,0x2d,
476    0x31,0x36,0x3a,0x3f,0x00,0x07,0x0e,0x15,
477    0x1c,0x0e,0x11,0x15},
478   {0x18,0x1c,0x14,0x16,0x18,0x1a,0x1c,0x00,
479    0x04}
480  },
481 /* 0x0c */
482  {
483   0x08,0x0c,0x10,0x0a08,
484   {0x0c,0x0e,0x10,0x0b},
485   0x0c,
486   {0x0d,0x0f,0x10,0x10,0x01,0x08,0x00,0x00,
487    0x00,0x00,0x01,0x00,0x02,0x02,0x01,0x00,
488    0x04,0x04,0x01,0x00,0x05,0x02,0x05,0x00,
489    0x06},
490   {0x01,0x06,0x05,0x06,0x00,0x08,0x01,0x08,
491    0x00,0x07,0x02,0x07,0x06,0x07,0x00,0x00,
492    0x00,0x00,0x00,0x00},
493   {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
494    0x00}
495  },
496 /* 0x0d: MD_D */
497  {
498   0x28,0x18,0x08,0x2000,
499   {0x09,0x0f,0x00,0x06},
500   0x63,
501   {0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f,     /* 2c is 2b for 300 */
502    0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,
503    0x9c,0x8e,0x8f,0x14,0x00,0x96,0xb9,0xe3,
504    0xff},
505   {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
506    0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
507    0x01,0x00,0x0f,0x00},
508   {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f,
509    0xff}
510  },
511 /* 0x0e: MD_E */
512  {
513   0x50,0x18,0x08,0x4000,
514   {0x01,0x0f,0x00,0x06},
515   0x63,
516   {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,     /* 55,81 is 54,80 for 300 */
517    0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,
518    0x9c,0x8e,0x8f,0x28,0x00,0x96,0xb9,0xe3,
519    0xff},
520   {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
521    0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
522    0x01,0x00,0x0f,0x00},
523   {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f,
524    0xff}
525  },
526 /* 0x0f: ExtVGATable - modes > 0x13 */
527  {
528   0x00,0x00,0x00,0x0000,
529   {0x01,0x0f,0x00,0x0e},
530   0x23,
531   {0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e,
532    0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
533    0xea,0x8c,0xdf,0x28,0x40,0xe7,0x04,0xa3,
534    0xff},
535   {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
536    0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
537    0x01,0x00,0x00,0x00},
538   {0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0f,
539    0xff}
540  },
541 /* 0x10: ROM_SAVEPTR - totally different for 300 */
542  {
543   0x9f,0x3b,0x00,0x00c0,
544   {0x00,0x00,0x00,0x00},
545   0x00,
546   {0x00,0x00,0x00,0x00,0x00,0x00,0xbb,0x3f,
547    0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,
548    0x00,0x00,0x1a,0x00,0xac,0x3e,0x00,0xc0,
549    0x00},
550   {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
551    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
552    0x00,0x00,0x00,0x00},
553   {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
554    0x00}
555  },
556 /* 0x11: MD_F */
557  {
558   0x50,0x18,0x0e,0x8000,
559   {0x01,0x0f,0x00,0x06},
560   0xa2,
561   {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,    /* 55,81 is 54,80 on 300 */
562    0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
563    0x82,0x84,0x5d,0x28,0x0f,0x63,0xba,0xe3,    /* 82,84 is 83,85 on 300 */
564    0xff},
565   {0x00,0x08,0x00,0x00,0x18,0x18,0x00,0x00,
566    0x00,0x08,0x00,0x00,0x00,0x18,0x00,0x00,
567    0x0b,0x00,0x05,0x00},
568   {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x05,
569    0xff}
570  },
571 /* 0x12: MD_10 */
572  {
573   0x50,0x18,0x0e,0x8000,
574   {0x01,0x0f,0x00,0x06},
575   0xa3,
576   {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,    /* 55,81 is 54,80 on 300 */
577    0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
578    0x82,0x84,0x5d,0x28,0x0f,0x63,0xba,0xe3,    /* 82,84 is 83,85 on 300 */
579    0xff},
580   {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,
581    0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
582    0x01,0x00,0x0f,0x00},
583   {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f,
584    0xff}
585  },
586 /* 0x13: MD_0_350 */
587  {
588   0x28,0x18,0x0e,0x0800,
589   {0x09,0x03,0x00,0x02},
590   0xa3,
591   {0x2d,0x27,0x28,0x90,0x2b,0xb1,0xbf,0x1f,    /* b1 is a0 on 300 */
592    0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00,
593    0x83,0x85,0x5d,0x14,0x1f,0x63,0xba,0xa3,
594    0xff},
595   {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,
596    0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
597    0x08,0x00,0x0f,0x00},
598   {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
599    0xff}
600  },
601 /* 0x14: MD_1_350 */
602  {
603   0x28,0x18,0x0e,0x0800,
604   {0x09,0x03,0x00,0x02},
605   0xa3,
606   {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f,
607    0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00,
608    0x83,0x85,0x5d,0x14,0x1f,0x63,0xba,0xa3,
609    0xff},
610   {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,
611    0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
612    0x08,0x00,0x0f,0x00},
613   {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
614    0xff}
615  },
616 /* 0x15: MD_2_350 */
617  {
618   0x50,0x18,0x0e,0x1000,
619   {0x01,0x03,0x00,0x02},
620   0xa3,
621   {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,
622    0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00,
623    0x83,0x85,0x5d,0x28,0x1f,0x63,0xba,0xa3,
624    0xff},
625   {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,
626    0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
627    0x08,0x00,0x0f,0x00},
628   {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
629    0xff}
630  },
631 /* 0x16: MD_3_350 - mode 0x03 - 1 */
632  {
633   0x50,0x18,0x0e,0x1000,
634   {0x01,0x03,0x00,0x02},
635   0xa3,
636   {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,
637    0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00,
638    0x83,0x85,0x5d,0x28,0x1f,0x63,0xba,0xa3,
639    0xff},
640   {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,
641    0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
642    0x08,0x00,0x0f,0x00},
643   {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
644    0xff}
645  },
646 /* 0x17: MD_0_1_400 */
647  {
648   0x28,0x18,0x10,0x0800,
649   {0x08,0x03,0x00,0x02},
650   0x67,
651   {0x2d,0x27,0x28,0x90,0x2b,0xb1,0xbf,0x1f,    /* b1 is a0 on 300 */
652    0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00,
653    0x9c,0x8e,0x8f,0x14,0x1f,0x96,0xb9,0xa3,
654    0xff},
655   {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,
656    0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
657    0x0c,0x00,0x0f,0x08},
658   {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
659    0xff}
660  },
661 /* 0x18: MD_2_3_400 - mode 0x03 - 2 */
662  {
663   0x50,0x18,0x10,0x1000,
664   {0x00,0x03,0x00,0x02},
665   0x67,
666   {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,
667    0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00,
668    0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3,
669    0xff},
670   {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,
671    0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
672    0x0c,0x00,0x0f,0x08},
673   {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
674    0xff}
675  },
676 /* 0x19: MD_7_400 */
677  {
678   0x50,0x18,0x10,0x1000,
679   {0x00,0x03,0x00,0x02},
680   0x66,
681   {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,
682    0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00,
683    0x9c,0x8e,0x8f,0x28,0x0f,0x96,0xb9,0xa3,
684    0xff},
685   {0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08,
686    0x10,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
687    0x0e,0x00,0x0f,0x08},
688   {0x00,0x00,0x00,0x00,0x00,0x10,0x0a,0x00,
689    0xff}
690  },
691 /* 0x1a: MD_11 */
692  {
693   0x50,0x1d,0x10,0xa000,
694   {0x01,0x0f,0x00,0x06},
695   0xe3,
696   {0x5f,0x4f,0x50,0x82,0x55,0x81,0x0b,0x3e,    /* 55,81 is 54,80 on 300 */
697    0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
698    0xe9,0x8b,0xdf,0x28,0x00,0xe7,0x04,0xc3,    /* e9,8b is ea,8c on 300 */
699    0xff},
700   {0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,
701    0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,
702    0x01,0x00,0x0f,0x00},
703   {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x01,
704    0xff}
705  },
706 /* 0x1b: ExtEGATable - Modes <= 0x02 */
707  {
708   0x50,0x1d,0x10,0xa000,
709   {0x01,0x0f,0x00,0x06},
710   0xe3,
711   {0x5f,0x4f,0x50,0x82,0x55,0x81,0x0b,0x3e,    /* 55,81 is 54,80 on 300 */
712    0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
713    0xe9,0x8b,0xdf,0x28,0x00,0xe7,0x04,0xe3,    /* e9,8b is ea,8c on 300 */
714    0xff},
715   {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,
716    0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
717    0x01,0x00,0x0f,0x00},
718   {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f,
719    0xff}
720  },
721 /* 0x1c: MD_13 */
722  {
723   0x28,0x18,0x08,0x2000,
724   {0x01,0x0f,0x00,0x0e},
725   0x63,
726   {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,    /* 55,81 is 54,80 on 300 */
727    0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,
728    0x9c,0x8e,0x8f,0x28,0x40,0x96,0xb9,0xa3,
729    0xff},
730   {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
731    0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
732    0x41,0x00,0x0f,0x00},
733   {0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0f,
734    0xff}
735  }
736 };
737 #endif
738
739 /**************************************************************/
740 /* SIS VIDEO BRIDGE ----------------------------------------- */
741 /**************************************************************/
742
743 static const unsigned char SiS_SoftSetting  = 0x30;   /* RAM setting */
744
745 static const unsigned char SiS_OutputSelect = 0x40;
746
747 static const unsigned char SiS_NTSCTiming[] = {
748         0x17,0x1d,0x03,0x09,0x05,0x06,0x0c,0x0c,
749         0x94,0x49,0x01,0x0a,0x06,0x0d,0x04,0x0a,
750         0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x1b,
751         0x0c,0x50,0x00,0x97,0x00,0xda,0x4a,0x17,
752         0x7d,0x05,0x4b,0x00,0x00,0xe2,0x00,0x02,
753         0x03,0x0a,0x65,0x9d,0x08,0x92,0x8f,0x40,
754         0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x50,
755         0x00,0x40,0x44,0x00,0xdb,0x02,0x3b,0x00
756 };
757
758 static const unsigned char SiS_PALTiming[] = {
759         0x19,0x52,0x35,0x6e,0x04,0x38,0x3d,0x70,
760         0x94,0x49,0x01,0x12,0x06,0x3e,0x35,0x6d,
761         0x06,0x14,0x3e,0x35,0x6d,0x00,0x45,0x2b,
762         0x70,0x50,0x00,0x9b,0x00,0xd9,0x5d,0x17,
763         0x7d,0x05,0x45,0x00,0x00,0xe8,0x00,0x02,
764         0x0d,0x00,0x68,0xb0,0x0b,0x92,0x8f,0x40,
765         0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x63,
766         0x00,0x40,0x3e,0x00,0xe1,0x02,0x28,0x00
767 };
768
769 static const unsigned char SiS_HiTVExtTiming[] = {
770         0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x64,
771         0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d,
772         0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f,
773         0x64,0x90,0x33,0x8c,0x18,0x36,0x3e,0x13,
774         0x2a,0xde,0x2a,0x44,0x40,0x2a,0x44,0x40,
775         0x8e,0x8e,0x82,0x07,0x0b,0x92,0x0f,0x40,
776         0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x3d,
777         0x63,0x4f,0x27,0x00,0xfc,0xff,0x6a,0x00
778 };
779
780 static const unsigned char SiS_HiTVSt1Timing[] = {
781         0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x65,
782         0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d,
783         0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f,
784         0x65,0x90,0x7b,0xa8,0x03,0xf0,0x87,0x03,
785         0x11,0x15,0x11,0xcf,0x10,0x11,0xcf,0x10,
786         0x35,0x35,0x3b,0x69,0x1d,0x92,0x0f,0x40,
787         0x60,0x80,0x14,0x90,0x8c,0x60,0x04,0x86,
788         0xaf,0x5d,0x0e,0x00,0xfc,0xff,0x2d,0x00
789 };
790
791 static const unsigned char SiS_HiTVSt2Timing[] = {
792         0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x64,
793         0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d,
794         0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f,
795         0x64,0x90,0x33,0x8c,0x18,0x36,0x3e,0x13,
796         0x2a,0xde,0x2a,0x44,0x40,0x2a,0x44,0x40,
797         0x8e,0x8e,0x82,0x07,0x0b,0x92,0x0f,0x40,
798         0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x3d,
799         0x63,0x4f,0x27,0x00,0xfc,0xff,0x6a,0x00
800 };
801
802 #if 0
803 static const unsigned char SiS_HiTVTextTiming[] = {
804         0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x65,
805         0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d,
806         0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f,
807         0x65,0x90,0xe7,0xbc,0x03,0x0c,0x97,0x03,
808         0x14,0x78,0x14,0x08,0x20,0x14,0x08,0x20,
809         0xc8,0xc8,0x3b,0xd2,0x26,0x92,0x0f,0x40,
810         0x60,0x80,0x14,0x90,0x8c,0x60,0x04,0x96,
811         0x72,0x5c,0x11,0x00,0xfc,0xff,0x32,0x00
812 };
813 #endif
814
815 static const unsigned char SiS_HiTVGroup3Data[] = {
816         0x00,0x1a,0x22,0x63,0x62,0x22,0x08,0x5f,
817         0x05,0x21,0xb2,0xb2,0x55,0x77,0x2a,0xa6,
818         0x25,0x2f,0x47,0xfa,0xc8,0xff,0x8e,0x20,
819         0x8c,0x6e,0x60,0x2e,0x58,0x48,0x72,0x44,
820         0x56,0x36,0x4f,0x6e,0x3f,0x80,0x00,0x80,
821         0x4f,0x7f,0x03,0xa8,0x7d,0x20,0x1a,0xa9,
822         0x14,0x05,0x03,0x7e,0x64,0x31,0x14,0x75,
823         0x18,0x05,0x18,0x05,0x4c,0xa8,0x01
824 };
825
826 static const unsigned char SiS_HiTVGroup3Simu[] = {
827         0x00,0x1a,0x22,0x63,0x62,0x22,0x08,0x95,
828         0xdb,0x20,0xb8,0xb8,0x55,0x47,0x2a,0xa6,
829         0x25,0x2f,0x47,0xfa,0xc8,0xff,0x8e,0x20,
830         0x8c,0x6e,0x60,0x15,0x26,0xd3,0xe4,0x11,
831         0x56,0x36,0x4f,0x6e,0x3f,0x80,0x00,0x80,
832         0x67,0x36,0x01,0x47,0x0e,0x10,0xbe,0xb4,
833         0x01,0x05,0x03,0x7e,0x65,0x31,0x14,0x75,
834         0x18,0x05,0x18,0x05,0x4c,0xa8,0x01
835 };
836
837 #if 0
838 static const unsigned char SiS_HiTVGroup3Text[] = {
839         0x00,0x1a,0x22,0x63,0x62,0x22,0x08,0xa7,
840         0xf5,0x20,0xce,0xce,0x55,0x47,0x2a,0xa6,
841         0x25,0x2f,0x47,0xfa,0xc8,0xff,0x8e,0x20,
842         0x8c,0x6e,0x60,0x18,0x2c,0x0c,0x20,0x22,
843         0x56,0x36,0x4f,0x6e,0x3f,0x80,0x00,0x80,
844         0x93,0x3c,0x01,0x50,0x2f,0x10,0xf4,0xca,
845         0x01,0x05,0x03,0x7e,0x65,0x31,0x14,0x75,
846         0x18,0x05,0x18,0x05,0x4c,0xa8,0x01
847 };
848 #endif
849
850 static const struct SiS_TVData SiS_StPALData[] =
851 {
852  {    1,   1, 864, 525,1270, 400, 100, 0, 760,    0,0xf4,0xff,0x1c,0x22},
853  {    1,   1, 864, 525,1270, 350, 100, 0, 760,    0,0xf4,0xff,0x1c,0x22},
854  {    1,   1, 864, 525,1270, 400,   0, 0, 720,    0,0xf1,0x04,0x1f,0x18},
855  {    1,   1, 864, 525,1270, 350,   0, 0, 720,    0,0xf4,0x0b,0x1c,0x0a},
856  {    1,   1, 864, 525,1270, 480,  50, 0, 760,    0,0xf4,0xff,0x1c,0x22},
857  {    1,   1, 864, 525,1270, 600,  50, 0,   0,0x300,0xf4,0xff,0x1c,0x22}
858 };
859
860 static const struct SiS_TVData SiS_ExtPALData[] =
861 {
862  {   27,  10, 848, 448,1270, 530,  50, 0,  50,    0,0xf4,0xff,0x1c,0x22},  /* 640x400, 320x200 */
863  {  108,  35, 848, 398,1270, 530,  50, 0,  50,    0,0xf4,0xff,0x1c,0x22},
864  {   12,   5, 954, 448,1270, 530,  50, 0,  50,    0,0xf1,0x04,0x1f,0x18},
865  {    9,   4, 960, 463,1644, 438,  50, 0,  50,    0,0xf4,0x0b,0x1c,0x0a},
866  {    9,   4, 848, 528,1270, 530,   0, 0,  50,    0,0xf5,0xfb,0x1b,0x2a},  /* 640x480, 320x240 */
867  {   36,  25,1060, 648,1270, 530, 438, 0, 438,    0,0xeb,0x05,0x25,0x16},  /* 800x600, 400x300 */
868  {    3,   2,1080, 619,1270, 540, 438, 0, 438,    0,0xf3,0x00,0x1d,0x20},  /* 720x576 */
869  {    1,   1,1170, 821,1270, 520, 686, 0, 686,    0,0xF3,0x00,0x1D,0x20},  /* 1024x768 */
870  {    1,   1,1170, 821,1270, 520, 686, 0, 686,    0,0xF3,0x00,0x1D,0x20},  /* 1024x768 (for NTSC equ) */
871  {    9,   4, 848, 528,1270, 530,   0, 0,  50,    0,0xf5,0xfb,0x1b,0x2a}   /* 720x480 */
872 };
873
874 static const struct SiS_TVData SiS_StNTSCData[] =
875 {
876  {    1,   1, 858, 525,1270, 400,  50, 0, 760,    0,0xf1,0x04,0x1f,0x18},
877  {    1,   1, 858, 525,1270, 350,  50, 0, 640,    0,0xf1,0x04,0x1f,0x18},
878  {    1,   1, 858, 525,1270, 400,   0, 0, 720,    0,0xf1,0x04,0x1f,0x18},
879  {    1,   1, 858, 525,1270, 350,   0, 0, 720,    0,0xf4,0x0b,0x1c,0x0a},
880  {    1,   1, 858, 525,1270, 480,   0, 0, 760,    0,0xf1,0x04,0x1f,0x18}
881 };
882
883 static const struct SiS_TVData SiS_ExtNTSCData[] =
884 {
885  {  143,  65, 858, 443,1270, 440, 171, 0, 171,    0,0xf1,0x04,0x1f,0x18},    /* 640x400, 320x200 */
886  {   88,  35, 858, 393,1270, 440, 171, 0, 171,    0,0xf1,0x04,0x1f,0x18},
887  {  143,  70, 924, 443,1270, 440,  92, 0,  92,    0,0xf1,0x04,0x1f,0x18},
888  {  143,  70, 924, 393,1270, 440,  92, 0,  92,    0,0xf4,0x0b,0x1c,0x0a},
889  {  143,  76, 836, 523,1270, 440, 224, 0,   0,    0,0xf1,0x05,0x1f,0x16},    /* 640x480, 320x240 */
890  {  143, 120,1056, 643,1270, 440,   0, 1,   0,    0,0xf4,0x10,0x1c,0x00},    /* 800x600, 400x300  */
891  {  143,  76, 836, 523,1270, 440,   0, 1,   0,    0,0xee,0x0c,0x22,0x08},    /* 720x480 - BETTER (from 300 series) */
892  {    1,   1,1100, 811,1412, 440,   0, 1,   0,    0,0xee,0x0c,0x22,0x08},    /* 1024x768 (525i) CORRECTED */
893 #if 0  /* flimmert und ist unten abgeschnitten (NTSCHT, NTSC clock) */
894  {   65,  64,1056, 791,1270, 480, 455, 0,   0,    0,0x00,0x00,0x00,0x00}     /* 1024x768 (525p) */
895 #endif
896 #if 0
897  {    1,   1,1100, 811,1412, 440,   0, 1,   0,    0,0x00,0x00,0x00,0x00}     /* 1024x768 (525p) */
898 #endif
899 #if 0
900  {    1,   1,1120, 821,1516, 420,   0, 1,   0,    0,0x00,0x00,0x00,0x00}     /* 1024x768 (525p) */
901 #endif
902 #if 0
903  {    1,   1, 938, 821,1516, 420,   0, 1,   0,    0,0x00,0x00,0x00,0x00}     /* 1024x768 (525p) */
904 #endif
905 #if 0 /* zoom hin, unten abgeschnitten (NTSC2HT, NTSC1024 clock) */
906  {    1,   1,1072, 791,1270, 480, 455, 0,   0,    0,0x00,0x00,0x00,0x00}     /* 1024x768 (525p) */
907 #endif
908 #if 1 /* zu weit links (squeezed) (NTSC2HT, NTSC1024 clock) */
909  {    1,   1,1100, 846,1270, 440, 455, 0,   0,    0,0x00,0x00,0x00,0x00}     /* 1024x768 (525p) */
910 #endif
911 #if 0 /* zu weit links, rechts abgeschnitten (NTSC2HT, NTSC1024 clock) */
912  {    1,   1,1100, 846,1412, 440, 455, 0,   0,    0,0x00,0x00,0x00,0x00}     /* 1024x768 (525p) */
913 #endif
914 };
915
916 static const struct SiS_TVData SiS_StHiTVData[] =  /* Slave + TVSimu */
917 {
918  {    1,   1, 0x37c,0x233,0x2b2,0x320,    0, 0, 0, 0, 0, 0, 0, 0},
919  {    1,   1, 0x37c,0x233,0x2b2,0x2bc,    0, 0, 0, 0, 0, 0, 0, 0},
920  {    1,   1, 0x37c,0x233,0x2b2,0x320,    0, 0, 0, 0, 0, 0, 0, 0},
921  {    1,   1, 0x37c,0x233,0x2b2,0x2bc,    0, 0, 0, 0, 0, 0, 0, 0},
922  {    1,   1, 0x37c,0x233,0x2b2,0x3c0,    0, 0, 0, 0, 0, 0, 0, 0},
923  {    8,   5, 0x41a,0x2ab,0x670,0x3c0,0x150, 1, 0, 0, 0, 0, 0, 0}
924 };
925
926 static const struct SiS_TVData SiS_St2HiTVData[] = /* Slave */
927 {
928  {    3,   1, 0x348,0x1e3,0x670,0x3c0,0x032, 0, 0, 0, 0, 0, 0, 0},
929  {    1,   1, 0x37c,0x233,0x2b2,0x2bc,    0, 0, 0, 0, 0, 0, 0, 0},
930  {    3,   1, 0x348,0x1e3,0x670,0x3c0,0x032, 0, 0, 0, 0, 0, 0, 0},
931  {    1,   1, 0x37c,0x233,0x2b2,0x2bc,    0, 0, 0, 0, 0, 0, 0, 0},
932  {    5,   2, 0x348,0x233,0x670,0x3c0,0x08d, 1, 0, 0, 0, 0, 0, 0},
933  {    8,   5, 0x41a,0x2ab,0x670,0x3c0,0x17c, 1, 0, 0, 0, 0, 0, 0}
934 };
935
936 static const struct SiS_TVData SiS_ExtHiTVData[] =
937 { /* all ok */
938  {    6,   1, 0x348,0x233,0x660,0x3c0,    0, 0, 0, 0, 0, 0, 0, 0},
939  {    3,   1, 0x3c0,0x233,0x660,0x3c0,    0, 0, 0, 0, 0, 0, 0, 0},
940  {    6,   1, 0x348,0x233,0x660,0x3c0,    0, 0, 0, 0, 0, 0, 0, 0},
941  {    3,   1, 0x3c0,0x233,0x660,0x3c0,    0, 0, 0, 0, 0, 0, 0, 0},
942  {    5,   1, 0x348,0x233,0x670,0x3c0,0x166, 1, 0, 0, 0, 0, 0, 0},  /* 640x480   */
943  {   16,   5, 0x41a,0x2ab,0x670,0x3c0,0x143, 1, 0, 0, 0, 0, 0, 0},  /* 800x600   */
944  {   25,  12, 0x4ec,0x353,0x670,0x3c0,0x032, 0, 0, 0, 0, 0, 0, 0},  /* 1024x768  */
945  {    5,   4, 0x627,0x464,0x670,0x3c0,0x128, 0, 0, 0, 0, 0, 0, 0},  /* 1280x1024 */
946  {    4,   1, 0x41a,0x233,0x60c,0x3c0,0x143, 1, 0, 0, 0, 0, 0, 0},  /* 800x480   */
947  {    5,   2, 0x578,0x293,0x670,0x3c0,0x032, 0, 0, 0, 0, 0, 0, 0},  /* 1024x576  */
948  {    8,   5, 0x6d6,0x323,0x670,0x3c0,0x128, 0, 0, 0, 0, 0, 0, 0},  /* 1280x720  */
949  {    8,   3, 0x4ec,0x353,0x670,0x3c0,0x032, 0, 0, 0, 0, 0, 0, 0},  /* 960x600  */
950 };
951
952 static const struct SiS_TVData SiS_St525pData[] =
953 {
954  {    1,   1, 0x6b4,0x20d,0x4f6,0x190,   50, 0, 0x2f8, 0, 0, 0, 0, 0},
955  {    1,   1, 0x6b4,0x20d,0x4f6,0x15e,   50, 0, 0x280, 0, 0, 0, 0, 0},
956  {    1,   1, 0x6b4,0x20d,0x4f6,0x190,   50, 0, 0x2f8, 0, 0, 0, 0, 0},
957  {    1,   1, 0x6b4,0x20d,0x4f6,0x15e,   50, 0, 0x280, 0, 0, 0, 0, 0},
958  {    1,   1, 0x6b4,0x20d,0x4f6,0x1e0,    0, 0, 0x2f8, 0, 0, 0, 0, 0}
959 };
960
961 static const struct SiS_TVData SiS_St750pData[] =
962 {
963  {    1,   1, 0x672,0x2ee,0x500,0x190,   50, 0, 0x2f8, 0, 0, 0, 0, 0},
964  {    1,   1, 0x672,0x2ee,0x500,0x15e,   50, 0, 0x280, 0, 0, 0, 0, 0},
965  {    1,   1, 0x672,0x2ee,0x500,0x190,    0, 0, 0x2d0, 0, 0, 0, 0, 0},
966  {    1,   1, 0x672,0x2ee,0x500,0x15e,    0, 0, 0x2d0, 0, 0, 0, 0, 0},
967  {    1,   1, 0x672,0x2ee,0x500,0x1e0,    0, 0, 0x2f8, 0, 0, 0, 0, 0}
968 };
969
970 static const struct SiS_TVData SiS_Ext750pData[] =
971 { /* all ok */
972  {    3,  1,  935, 470, 1130, 680,  50, 0, 0, 0, 0, 0, 0, 0},  /* 320x200/640x400 */
973  {   24,  7,  935, 420, 1130, 680,  50, 0, 0, 0, 0, 0, 0, 0},
974  {    3,  1,  935, 470, 1130, 680,  50, 0, 0, 0, 0, 0, 0, 0},
975  {   24,  7,  935, 420, 1130, 680,  50, 0, 0, 0, 0, 0, 0, 0},
976  {    2,  1, 1100, 590, 1130, 640,  50, 0, 0, 0, 0, 0, 0, 0},  /* 640x480 */
977  {    3,  2, 1210, 690, 1130, 660,  50, 0, 0, 0, 0, 0, 0, 0},  /* 800x600 OK */
978  {    2,  1, 1100, 562, 1130, 640,   0, 1, 0, 0, 0, 0, 0, 0},  /* 720x480 OK */
979  {    1,  1, 1375, 878, 1130, 640, 638, 0, 0, 0, 0, 0, 0, 0},  /* 1024x768 OK */
980  {    5,  3, 1100, 675, 1130, 640,   0, 1, 0, 0, 0, 0, 0, 0},  /* 720/768x576 OK */
981  {   25, 24, 1496, 755, 1120, 680,  50, 0, 0, 0, 0, 0, 0, 0}   /* 1280x720 OK */
982 };
983
984 static const struct SiS_LCDData SiS_LCD1280x720Data[] =  /* 2.03.00 */
985 {
986         {  44,   15,  864,  430, 1408,  806 }, /* 640x400 */
987         { 128,   35,  792,  385, 1408,  806 },
988         {  44,   15,  864,  430, 1408,  806 },
989         { 128,   35,  792,  385, 1408,  806 },
990         {  22,    9,  864,  516, 1408,  806 }, /* 640x480 */
991         {   8,    5, 1056,  655, 1408,  806 }, /* 800x600 */
992         {   0,    0,    0,    0,    0,    0 }, /* 1024x768 */
993         {   0,    0,    0,    0,    0,    0 }, /* 1280x1024 */
994         {   0,    0,    0,    0,    0,    0 },
995         {   0,    0,    0,    0,    0,    0 },
996         {   1,    1, 1408,  806, 1408,  806 }  /* 1280x720 */
997 };
998
999 /* About 1280x768: For TMDS, Panel_1280x768 will only be set if
1000  * the panel is a Fujitsu 7911 (VL-17WDX8) (with clock 81, 1688x802)
1001  * Other TMDS panels of this resolution will be treated as custom.
1002  * For LVDS, we know another type (_2).
1003  * (Note: 1280x768_3 is now special for SiS301/NetVista
1004  */
1005
1006 static const struct SiS_LCDData SiS_StLCD1280x768_2Data[] = /* 2.03.00 */
1007 {
1008         {  64,   21,  858,  434, 1408,  806 }, /* 640x400 */
1009         {  32,    9,  858,  372, 1408,  806 },
1010         {  64,   21,  858,  434, 1408,  806 },
1011         {  32,    9,  858,  372, 1408,  806 },
1012         { 143,   68, 1024,  527, 1408,  806 }, /* 640x480 */
1013         {  64,   51, 1364,  663, 1408,  806 }, /* 800x600 */
1014         {  88,   81, 1296,  806, 1408,  806 }, /* 1024x768 */
1015         {   0,    0,    0,    0,    0,    0 },
1016         {   1,    1, 1408,  806, 1408,  806 }, /* 1280x768 */
1017         {   0,    0,    0,    0,    0,    0 },
1018         {  16,   15, 1600,  750, 1600,  806 }  /* 1280x720 - from Ext */
1019 };
1020
1021 static const struct SiS_LCDData SiS_ExtLCD1280x768_2Data[] = /* 2.03.00 */
1022 {
1023         {  16,    5,  960,  410, 1600,  806 }, /* 640x400 */
1024         {  64,   21, 1152,  364, 1600,  806 },
1025         {  16,    5,  960,  410, 1600,  806 },
1026         {  64,   21, 1152,  364, 1600,  806 },
1027         {  32,   13, 1040,  493, 1600,  806 }, /* 640x480 */
1028         {  16,    9, 1152,  618, 1600,  806 }, /* 800x600 */
1029         {  25,   21, 1344,  796, 1600,  806 }, /* 1024x768 */
1030         {   0,    0,    0,    0,    0,    0 },
1031         {   1,    1, 1600,  806, 1600,  806 }, /* 1280x768 */
1032         {   0,    0,    0,    0,    0,    0 },
1033         {  16,   15, 1600,  750, 1600,  806 }  /* 1280x720 */
1034 };
1035
1036 #if 0  /* Not used; _3 now reserved for NetVista (SiS301) */
1037 static const struct SiS_LCDData SiS_LCD1280x768_3Data[] =
1038 {
1039         {  64,   25, 1056,  422, 1664,  798 },                  /* 640x400 */
1040         { 128,   39,  884,  396, 1408,  806 }, /* ,640 */
1041         {  64,   25, 1056,  422, 1664,  798 },                  /* 640x400 */
1042         { 128,   39,  884,  396, 1408,  806 }, /* ,640 */
1043         {  32,   15, 1056,  513, 1408,  806 }, /* ,664 */       /* 640x480 */
1044         { 176,  125, 1280,  640, 1408,  806 }, /* ,768 */       /* 800x600 */
1045         {  64,   61, 1342,  806, 1408,  806 },                  /* 1024x768 */
1046         {   0,    0,    0,    0,    0,    0 },
1047         {   1,    1, 1408,  806, 1408,  806 },                  /* 1280x768 */
1048         {   0,    0,    0,    0,    0,    0 },
1049         {  16,   15, 1600,  750, 1600,  806 }  /* 1280x720  from above */
1050 };
1051 #endif
1052
1053 static const struct SiS_LCDData SiS_LCD1280x800Data[] = /* 0.93.12a (TMDS) */
1054 {
1055         { 128,   51, 1122,  412, 1408,  816 },  /* 640x400 */
1056         { 128,   49, 1232,  361, 1408,  816 },
1057         { 128,   51, 1122,  412, 1408,  816 },
1058         { 128,   49, 1232,  361, 1408,  816 },
1059         {   8,    3,  880,  491, 1408,  816 },  /* 640x480 */
1060         {  11,    6, 1024,  612, 1408,  816 },  /* 800x600 */
1061         {  22,   21, 1400,  784, 1408,  816 },  /* 1024x768 */
1062         {   0,    0,    0,    0,    0,    0 },  /* 1280x1024 */
1063         {   1,    1, 1408,  816, 1408,  816 },  /* 1280x800 */
1064         {   0,    0,    0,    0,    0,    0 },  /* 1280x768 (patch index) */
1065         {   0,    0,    0,    0,    0,    0 }   /* 1280x720 */
1066 };
1067
1068 static const struct SiS_LCDData SiS_LCD1280x800_2Data[] = /* 2.03.00 (LVDS) */
1069 {
1070         {  97,   42, 1344,  409, 1552,  812 }, /* 640x400 */
1071         {  97,   35, 1280,  358, 1552,  812 },
1072         {  97,   42, 1344,  409, 1552,  812 },
1073         {  97,   35, 1280,  358, 1552,  812 },
1074         {  97,   39, 1040,  488, 1552,  812 }, /* 640x480 */
1075         { 194,  105, 1120,  608, 1552,  812 }, /* 800x600 */
1076         {  97,   84, 1400,  780, 1552,  812 }, /* 1024x768 */
1077         {   0,    0,    0,    0,    0,    0 }, /* 1280x1024 */
1078         {   1,    1, 1552,  812, 1552,  812 }, /* 1280x800 */
1079         {  97,   96, 1600,  780, 1552,  812 }, /* 1280x768 - patch index */
1080         {  97,   90, 1600,  730, 1552,  812 }  /* 1280x720 */
1081 };
1082
1083 #if 0
1084 static const struct SiS_LCDData SiS_LCD1280x800_3Data[] = /* 2.02.05a (LVDS); m250 */
1085 {
1086         { 128,   51, 1122,  412, 1408,  816 }, /* 640x400 */
1087         { 128,   49, 1232,  361, 1408,  816 },
1088         { 128,   51, 1122,  412, 1408,  816 },
1089         { 128,   49, 1232,  361, 1408,  816 },
1090         {   8,    3,  880,  491, 1408,  816 }, /* 640x480 */
1091         {  11,    6, 1024,  612, 1408,  816 }, /* 800x600 */
1092         {  22,   21, 1400,  784, 1408,  816 }, /* 1024x768 */
1093         {   0,    0,    0,    0,    0,    0 }, /* 1280x1024 */
1094         {   1,    1, 1408,  816, 1408,  816 }, /* 1280x800 */
1095         {   0,    0,    0,    0,    0,    0 }, /* 1280x768 - patch index */
1096         {   0,    0,    0,    0,    0,    0 }  /* 1280x720 */
1097 };
1098 #endif
1099
1100 static const struct SiS_LCDData SiS_LCD1280x854Data[] = /* 2.21.00CS (LVDS) */
1101 {
1102         {  56,   15,  936,  410, 1664,  861 },  /* 640x400 */
1103         {  64,   25, 1586,  355, 1664,  861 },
1104         {  56,   15,  936,  410, 1664,  861 },
1105         {  64,   25, 1586,  355, 1664,  861 },
1106         {  91,   45, 1464,  485, 1664,  861 },  /* 640x480 */
1107         { 182,   75,  976,  605, 1664,  861 },  /* 800x600 */
1108         {  91,   66, 1342,  774, 1664,  861 },  /* 1024x768 */
1109         {   0,    0,    0,    0,    0,    0 },  /* 1280x1024 */
1110         {  26,   25, 1708,  807, 1664,  861 },  /* 1280x800 */
1111         {  13,   12, 1708,  774, 1664,  861 },  /* 1280x768 - patch index */
1112         {  52,   45, 1708,  725, 1664,  861 },  /* 1280x720 */
1113         {   0,    0,    0,    0,    0,    0 },
1114         {   0,    0,    0,    0,    0,    0 },
1115         {   1,    1, 1664,  861, 1664,  861 }   /* 1280x854 */
1116 };
1117
1118 static const struct SiS_LCDData SiS_LCD1280x960Data[] =
1119 {
1120         {    9,   2,  800,  500, 1800, 1000 },
1121         {    9,   2,  800,  500, 1800, 1000 },
1122         {    4,   1,  900,  500, 1800, 1000 },
1123         {    4,   1,  900,  500, 1800, 1000 },
1124         {    9,   2,  800,  500, 1800, 1000 },
1125         {   30,  11, 1056,  625, 1800, 1000 },
1126         {    5,   3, 1350,  800, 1800, 1000 },
1127         {    1,   1, 1576, 1050, 1576, 1050 },
1128         {    1,   1, 1800, 1000, 1800, 1000 },
1129         {   0,    0,    0,    0,    0,    0 },
1130         {   0,    0,    0,    0,    0,    0 },
1131         {   0,    0,    0,    0,    0,    0 },
1132         {   0,    0,    0,    0,    0,    0 },
1133         {   0,    0,    0,    0,    0,    0 }
1134 };
1135
1136 static const struct SiS_LCDData SiS_StLCD1400x1050Data[] =
1137 {
1138         { 211,  100, 2100,  408, 1688, 1066 },
1139         { 211,   64, 1536,  358, 1688, 1066 },
1140         { 211,  100, 2100,  408, 1688, 1066 },
1141         { 211,   64, 1536,  358, 1688, 1066 },
1142         { 211,   48,  840,  488, 1688, 1066 },
1143         { 211,   72, 1008,  609, 1688, 1066 },
1144         { 211,  128, 1400,  776, 1688, 1066 },
1145         { 211,  205, 1680, 1041, 1688, 1066 },
1146         {   1,    1, 1688, 1066, 1688, 1066 },
1147         {   0,    0,    0,    0,    0,    0 },
1148         {   0,    0,    0,    0,    0,    0 },
1149         {   0,    0,    0,    0,    0,    0 },
1150         {   0,    0,    0,    0,    0,    0 },
1151         {   0,    0,    0,    0,    0,    0 }
1152 };
1153
1154 static const struct SiS_LCDData SiS_ExtLCD1400x1050Data[] =
1155 {
1156 /*      { 211,   60, 1260,  410, 1688, 1066 },    640x400 (6330) */
1157         { 211,  100, 2100,  408, 1688, 1066 }, /* 640x400 (6325) WORKS */
1158         { 211,   64, 1536,  358, 1688, 1066 },
1159         { 211,  100, 2100,  408, 1688, 1066 },
1160         { 211,   64, 1536,  358, 1688, 1066 },
1161 /*      { 211,   80, 1400,  490, 1688, 1066 },    640x480 (6330) */
1162         { 211,   48,  840,  488, 1688, 1066 }, /* 640x480 (6325) WORKS */
1163 /*      { 211,  117, 1638,  613, 1688, 1066 },    800x600 (6330) */
1164         { 211,   72, 1008,  609, 1688, 1066 }, /* 800x600 (6325) WORKS */
1165         { 211,  128, 1400,  776, 1688, 1066 }, /* 1024x768 */
1166         { 211,  205, 1680, 1041, 1688, 1066 }, /* 1280x1024 - not used (always unscaled) */
1167         {   1,    1, 1688, 1066, 1688, 1066 }, /* 1400x1050 */
1168         {   0,    0,    0,    0,    0,    0 }, /* kludge */
1169         { 211,  120, 1400,  730, 1688, 1066 }, /* 1280x720 */
1170         {   0,    0,    0,    0,    0,    0 },
1171         {   0,    0,    0,    0,    0,    0 },
1172         {   0,    0,    0,    0,    0,    0 }
1173 };
1174
1175 static const struct SiS_LCDData SiS_LCD1680x1050Data[] =
1176 {
1177         {  95,   24, 1260,  410, 1900, 1066 }, /*  0 640x400 */
1178         {  10,    3, 1710,  362, 1900, 1066 },
1179         {  95,   24, 1260,  410, 1900, 1066 },
1180         {  10,    3, 1710,  362, 1900, 1066 },
1181         {  95,   32, 1400,  490, 1900, 1066 }, /*  4 640x480 */
1182         {  95,   42, 1470,  610, 1900, 1066 }, /*  5 800x600 */
1183         {  95,   64, 1750,  784, 1900, 1066 }, /*  6 1024x768 */
1184         {  95,   94, 1900, 1055, 1900, 1066 }, /*  7 1280x1024 */
1185         {  41,   31, 1900,  806, 1900, 1066 }, /*  8 1280x768 */
1186         {  95,   69, 1800,  817, 1900, 1066 }, /*  9 1280x800 patch index */
1187         {  13,    9, 1900,  739, 1900, 1066 }, /* 10 1280x720 */
1188         {  95,   94, 1880, 1066, 1900, 1066 }, /* 11 1400x1050 patch index */
1189         {   1,    1, 1900, 1066, 1900, 1066 }, /* 12 1680x1050 */
1190         {   0,    0,    0,    0,    0,    0 }
1191 };
1192
1193 static const struct SiS_LCDData SiS_StLCD1600x1200Data[] =
1194 {
1195         {27,  4, 800, 500, 2160, 1250 },
1196         {27,  4, 800, 500, 2160, 1250 },
1197         { 6,  1, 900, 500, 2160, 1250 },
1198         { 6,  1, 900, 500, 2160, 1250 },
1199         {27,  1, 800, 500, 2160, 1250 },
1200         { 4,  1,1080, 625, 2160, 1250 },
1201         { 5,  2,1350, 800, 2160, 1250 },
1202         {135,88,1600,1100, 2160, 1250 },
1203         {72, 49,1680,1092, 2160, 1250 },
1204         { 1,  1,2160,1250, 2160, 1250 },
1205         { 0,  0,   0,   0,    0,    0 },
1206         { 0,  0,   0,   0,    0,    0 },
1207         { 0,  0,   0,   0,    0,    0 },
1208         { 0,  0,   0,   0,    0,    0 }
1209 };
1210
1211 static const struct SiS_LCDData SiS_ExtLCD1600x1200Data[] =
1212 {
1213         {72,11, 990, 422, 2160, 1250 }, /* 640x400 (6330) WORKS */
1214 /*      {27, 4, 800, 500, 2160, 1250 },    640x400 (6235) */
1215         {27, 4, 800, 500, 2160, 1250 },
1216         { 6, 1, 900, 500, 2160, 1250 },
1217         { 6, 1, 900, 500, 2160, 1250 },
1218         {45, 8, 960, 505, 2160, 1250 }, /* 640x480 (6330) WORKS */
1219 /*      {27, 1, 800, 500, 2160, 1250 },    640x480 (6325) */
1220         { 4, 1,1080, 625, 2160, 1250 },
1221         { 5, 2,1350, 800, 2160, 1250 },
1222         {27,16,1500,1064, 2160, 1250 }, /* 1280x1024 */
1223         {72,49,1680,1092, 2160, 1250 }, /* 1400x1050 (6330, was not supported on 6325) */
1224         { 1, 1,2160,1250, 2160, 1250 },
1225         { 0, 0,   0,   0,    0,    0 },
1226         { 0, 0,   0,   0,    0,    0 },
1227         { 0, 0,   0,   0,    0,    0 },
1228         { 0, 0,   0,   0,    0,    0 }
1229 };
1230
1231 static const struct SiS_LCDData SiS_NoScaleData[] =
1232 {
1233         { 1, 1, 800, 449, 800, 449 },  /* 0x00: 320x200, 640x400 */
1234         { 1, 1, 800, 449, 800, 449 },
1235         { 1, 1, 900, 449, 900, 449 },
1236         { 1, 1, 900, 449, 900, 449 },
1237         { 1, 1, 800, 525, 800, 525 },  /* 0x04: 320x240, 640x480  */
1238         { 1, 1,1056, 628,1056, 628 },  /* 0x05: 400x300, 800x600  */
1239         { 1, 1,1344, 806,1344, 806 },  /* 0x06: 512x384, 1024x768 */
1240         { 1, 1,1688,1066,1688,1066 },  /* 0x07: 1280x1024 */
1241         { 1, 1,1688, 802,1688, 802 },  /* 0x08: 1280x768: Fujitsu, TMDS only */
1242         { 1, 1,2160,1250,2160,1250 },  /* 0x09: 1600x1200 */
1243         { 1, 1,1800,1000,1800,1000 },  /* 0x0a: 1280x960  */
1244         { 1, 1,1688,1066,1688,1066 },  /* 0x0b: 1400x1050 */
1245         { 1, 1,1650, 750,1650, 750 },  /* 0x0c: 1280x720 (TMDS, projector)  */
1246         { 1, 1,1552, 812,1552, 812 },  /* 0x0d: 1280x800_2 (LVDS) (was: 1408,816/ 1656,841) */
1247         { 1, 1,1900,1066,1900,1066 },  /* 0x0e: 1680x1050 (LVDS) */
1248         { 1, 1,1660, 806,1660, 806 },  /* 0x0f: 1280x768_2 (LVDS) */
1249         { 1, 1,1664, 798,1664, 798 },  /* 0x10: 1280x768_3 (NetVista SiS 301) - TODO */
1250         { 1, 1,1688, 802,1688, 802 },  /* 0x11: 1280x768   (TMDS Fujitsu) */
1251         { 1, 1,1408, 806,1408, 806 },  /* 0x12: 1280x720 (LVDS) */
1252         { 1, 1, 896, 497, 896, 497 },  /* 0x13: 720x480 */
1253         { 1, 1, 912, 597, 912, 597 },  /* 0x14: 720x576 */
1254         { 1, 1, 912, 597, 912, 597 },  /* 0x15: 768x576 */
1255         { 1, 1,1056, 497,1056, 497 },  /* 0x16: 848x480 */
1256         { 1, 1,1064, 497,1064, 497 },  /* 0x17: 856x480 */
1257         { 1, 1,1056, 497,1056, 497 },  /* 0x18: 800x480 */
1258         { 1, 1,1328, 739,1328, 739 },  /* 0x19: 1024x576 */
1259         { 1, 1,1680, 892,1680, 892 },  /* 0x1a: 1152x864 */
1260         { 1, 1,1808, 808,1808, 808 },  /* 0x1b: 1360x768 */
1261         { 1, 1,1104, 563,1104, 563 },  /* 0x1c: 960x540 */
1262         { 1, 1,1120, 618,1120, 618 },  /* 0x1d: 960x600 */
1263         { 1, 1,1408, 816,1408, 816 },  /* 0x1f: 1280x800 (TMDS special) */
1264         { 1, 1,1760,1235,1760,1235 },  /* 0x20: 1600x1200 for LCDA */
1265         { 1, 1,2048,1320,2048,1320 },  /* 0x21: 1600x1200 for non-SiS LVDS */
1266         { 1, 1,1664, 861,1664, 861 }   /* 0x22: 1280x854 */
1267 };
1268
1269 /**************************************************************/
1270 /* LVDS ----------------------------------------------------- */
1271 /**************************************************************/
1272
1273 /* FSTN/DSTN 320x240, 2 variants */
1274 static const struct SiS_LVDSData SiS_LVDS320x240Data_1[]=
1275 {
1276         { 848, 433, 400, 525},
1277         { 848, 389, 400, 525},
1278         { 848, 433, 400, 525},
1279         { 848, 389, 400, 525},
1280         { 848, 518, 400, 525},
1281         {1056, 628, 400, 525},
1282         { 400, 525, 400, 525}  /* xSTN */
1283 };
1284
1285 static const struct SiS_LVDSData SiS_LVDS320x240Data_2[]=
1286 {
1287         { 800, 445, 800, 525},
1288         { 800, 395, 800, 525},
1289         { 800, 445, 800, 525},
1290         { 800, 395, 800, 525},
1291         { 800, 525, 800, 525},
1292         {1056, 628,1056, 628},
1293         { 480, 525, 480, 525} /* xSTN */
1294 };
1295
1296 static const struct SiS_LVDSData SiS_LVDS640x480Data_1[]=
1297 {
1298         { 800, 445, 800, 525},   /* 800, 449, 800, 449 */
1299         { 800, 395, 800, 525},
1300         { 800, 445, 800, 525},
1301         { 800, 395, 800, 525},
1302         { 800, 525, 800, 525}
1303 };
1304
1305 static const struct SiS_LVDSData SiS_LVDS800x600Data_1[]=
1306 {
1307         { 848, 433,1060, 629},
1308         { 848, 389,1060, 629},
1309         { 848, 433,1060, 629},
1310         { 848, 389,1060, 629},
1311         { 848, 518,1060, 629},
1312         {1056, 628,1056, 628}
1313 };
1314
1315 static const struct SiS_LVDSData SiS_LVDS1024x600Data_1[] =
1316 {
1317         { 840, 604,1344, 800},
1318         { 840, 560,1344, 800},
1319         { 840, 604,1344, 800},
1320         { 840, 560,1344, 800},
1321         { 840, 689,1344, 800},
1322         {1050, 800,1344, 800},
1323         {1344, 800,1344, 800}
1324 };
1325
1326 static const struct SiS_LVDSData SiS_LVDS1024x768Data_1[]=
1327 {
1328         { 840, 438,1344, 806},
1329         { 840, 409,1344, 806},
1330         { 840, 438,1344, 806},
1331         { 840, 409,1344, 806},
1332         { 840, 518,1344, 806},   /* 640x480 */
1333         {1050, 638,1344, 806},   /* 800x600 */
1334         {1344, 806,1344, 806},   /* 1024x768 */
1335 };
1336
1337 static const struct SiS_LVDSData SiS_CHTVUNTSCData[]=
1338 {
1339         { 840, 600, 840, 600},
1340         { 840, 600, 840, 600},
1341         { 840, 600, 840, 600},
1342         { 840, 600, 840, 600},
1343         { 784, 600, 784, 600},
1344         {1064, 750,1064, 750},
1345         {1160, 945,1160, 945}
1346 };
1347
1348 static const struct SiS_LVDSData SiS_CHTVONTSCData[]=
1349 {
1350         { 840, 525, 840, 525},
1351         { 840, 525, 840, 525},
1352         { 840, 525, 840, 525},
1353         { 840, 525, 840, 525},
1354         { 784, 525, 784, 525},
1355         {1040, 700,1040, 700},
1356         {1160, 840,1160, 840}
1357 };
1358
1359 /* CRT1 CRTC data for slave modes */
1360
1361 static const struct SiS_LVDSCRT1Data SiS_LVDSCRT1320x240_1[] =
1362 {
1363  {{0x65,0x4f,0x89,0x56,0x83,0xaa,0x1f,
1364    0x90,0x85,0x8f,0xab,0x30,0x00,0x05,
1365    0x00 }},
1366  {{0x65,0x4f,0x89,0x56,0x83,0x83,0x1f,
1367    0x5e,0x83,0x5d,0x79,0x10,0x00,0x05,
1368    0x00 }},
1369  {{0x65,0x4f,0x89,0x54,0x9f,0xc4,0x1f,
1370    0x92,0x89,0x8f,0xb5,0x30,0x00,0x01,
1371    0x00 }},
1372  {{0x65,0x4f,0x89,0x56,0x83,0x83,0x1f,
1373    0x5e,0x83,0x5d,0x79,0x10,0x00,0x05,
1374    0x00 }},
1375  {{0x65,0x4f,0x89,0x56,0x83,0x04,0x3e,
1376    0xe0,0x85,0xdf,0xfb,0x10,0x00,0x05,
1377    0x00 }},
1378  {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0,
1379    0x58,0x8c,0x57,0x73,0x20,0x00,0x06,
1380    0x01 }},
1381  {{0x2d,0x27,0x90,0x2c,0x80,0x0b,0x3e,
1382    0xe9,0x8b,0xe7,0x04,0x00,0x00,0x00,
1383    0x00 }}
1384 };
1385
1386 static const struct SiS_LVDSCRT1Data SiS_LVDSCRT1320x240_2[] =
1387 {
1388  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1389    0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
1390    0x00}},
1391  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1392    0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
1393    0x00}},
1394  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1395    0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
1396    0x00}},
1397  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1398    0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
1399    0x00}},
1400  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1401    0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
1402    0x00}},
1403  {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0,
1404    0x58,0x8c,0x57,0x73,0x20,0x00,0x06,
1405    0x01}},
1406 #if 0
1407  {{0x2d,0x27,0x90,0x2c,0x80,0x0b,0x3e,
1408    0xe9,0x8b,0xe7,0x04,0x00,0x00,0x00,
1409    0x00}}
1410 #endif
1411  {{0x5f,0x4f,0x83,0x55,0x81,0x0b,0x3e,
1412    0xe9,0x8b,0xe8,0x0c,0x00,0x00,0x05,
1413    0x00}},
1414 };
1415
1416 static const struct SiS_LVDSCRT1Data SiS_LVDSCRT1320x240_2_H[] =
1417 {
1418  {{0x65,0x4f,0x89,0x56,0x83,0xaa,0x1f,
1419    0x90,0x85,0x8f,0xab,0x30,0x00,0x05,
1420    0x00}},
1421  {{0x65,0x4f,0x89,0x56,0x83,0x83,0x1f,
1422    0x5e,0x83,0x5d,0x79,0x10,0x00,0x05,
1423    0x00}},
1424  {{0x65,0x4f,0x89,0x54,0x9f,0xc4,0x1f,
1425    0x92,0x89,0x8f,0xb5,0x30,0x00,0x01,
1426    0x00}},
1427  {{0x65,0x4f,0x89,0x56,0x83,0x83,0x1f,
1428    0x5e,0x83,0x5d,0x79,0x10,0x00,0x05,
1429    0x00}},
1430  {{0x65,0x4f,0x89,0x56,0x83,0x04,0x3e,
1431    0xe0,0x85,0xdf,0xfb,0x10,0x00,0x05,
1432    0x00}},
1433  {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0,
1434    0x58,0x8c,0x57,0x73,0x20,0x00,0x06,
1435    0x01}},
1436  {{0x2d,0x27,0x90,0x2c,0x80,0x0b,0x3e,
1437    0xe9,0x8b,0xe7,0x04,0x00,0x00,0x00,
1438    0x00}}
1439 };
1440
1441 static const struct SiS_LVDSCRT1Data SiS_LVDSCRT1320x240_3[] =
1442 {
1443  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1444    0xe9,0x8b,0xdf,0x04,0x00,0x00,0x05,
1445    0x00}},
1446  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1447    0xe9,0x8b,0xdf,0x04,0x00,0x00,0x05,
1448    0x00}},
1449  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1450    0xe9,0x8b,0xdf,0x04,0x00,0x00,0x05,
1451    0x00}},
1452  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1453    0xe9,0x8b,0xdf,0x04,0x00,0x00,0x05,
1454    0x00}},
1455  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1456    0xe9,0x8b,0xdf,0x04,0x00,0x00,0x05,
1457    0x00}},
1458  {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0,
1459    0x58,0x8c,0x57,0x73,0x20,0x00,0x06,
1460    0x01}},
1461  {{0x2d,0x27,0x90,0x2c,0x80,0x0b,0x3e,
1462    0xe9,0x8b,0xe7,0x04,0x00,0x00,0x00,
1463    0x00}}
1464 };
1465
1466 static const struct SiS_LVDSCRT1Data SiS_LVDSCRT1320x240_3_H[] =
1467 {
1468  {{0x65,0x4f,0x89,0x56,0x83,0xaa,0x1f,
1469    0x90,0x85,0x8f,0xab,0x30,0x00,0x05,
1470    0x00}},
1471  {{0x65,0x4f,0x89,0x56,0x83,0x83,0x1f,
1472    0x5e,0x83,0x5d,0x79,0x10,0x00,0x05,
1473    0x00}},
1474  {{0x65,0x4f,0x89,0x54,0x9f,0xc4,0x1f,
1475    0x92,0x89,0x8f,0xb5,0x30,0x00,0x01,
1476    0x00}},
1477  {{0x65,0x4f,0x89,0x56,0x83,0x83,0x1f,
1478    0x5e,0x83,0x5d,0x79,0x10,0x00,0x05,
1479    0x00}},
1480  {{0x65,0x4f,0x89,0x56,0x83,0x04,0x3e,
1481    0xe0,0x85,0xdf,0xfb,0x10,0x00,0x05,
1482    0x00}},
1483  {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0,
1484    0x58,0x8c,0x57,0x73,0x20,0x00,0x06,
1485    0x01}},
1486  {{0x2d,0x27,0x90,0x2c,0x80,0x0b,0x3e,
1487    0xe9,0x8b,0xe7,0x04,0x00,0x00,0x00,
1488    0x00}}
1489 };
1490
1491 static const struct SiS_LVDSCRT1Data SiS_LVDSCRT1640x480_1[] =
1492 {
1493  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1494    0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
1495    0x00}},
1496  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1497    0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
1498    0x00}},
1499  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1500    0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
1501    0x00}},
1502  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1503    0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
1504    0x00}},
1505  {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
1506    0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
1507    0x00}},
1508  {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0,
1509    0x58,0x8c,0x57,0x73,0x20,0x00,0x06,
1510    0x01}}
1511 };
1512
1513 static const struct SiS_LVDSCRT1Data SiS_LVDSCRT1640x480_1_H[] =
1514 {
1515  {{0x2d,0x28,0x90,0x2b,0xa0,0xbf,0x1f,
1516    0x9c,0x8e,0x96,0xb9,0x00,0x00,0x00,
1517    0x00}},
1518  {{0x2d,0x28,0x90,0x2b,0xa0,0xbf,0x1f,
1519    0x83,0x85,0x63,0xba,0x00,0x00,0x00,
1520    0x00}},
1521  {{0x2d,0x28,0x90,0x2b,0xa0,0xbf,0x1f,
1522    0x9c,0x8e,0x96,0xb9,0x00,0x00,0x00,
1523    0x00}},
1524  {{0x2d,0x28,0x90,0x2b,0xa0,0xbf,0x1f,
1525    0x83,0x85,0x63,0xba,0x00,0x00,0x00,
1526    0x00}},
1527  {{0x2d,0x28,0x90,0x2c,0x80,0x0b,0x3e,
1528    0xe9,0x8b,0xe7,0x04,0x00,0x00,0x00,
1529    0x00}}
1530 };
1531
1532 BOOLEAN         SiSInitPtr(struct SiS_Private *SiS_Pr);
1533 #ifdef SIS_XORG_XF86
1534 unsigned short  SiS_GetModeID(int VGAEngine, unsigned int VBFlags, int HDisplay, int VDisplay,
1535                                 int Depth, BOOLEAN FSTN, int LCDwith, int LCDheight);
1536 #endif
1537 unsigned short  SiS_GetModeID_LCD(int VGAEngine, unsigned int VBFlags, int HDisplay,
1538                                 int VDisplay, int Depth, BOOLEAN FSTN,
1539                                 unsigned short CustomT, int LCDwith, int LCDheight,
1540                                 unsigned int VBFlags2);
1541 unsigned short  SiS_GetModeID_TV(int VGAEngine, unsigned int VBFlags, int HDisplay,
1542                                 int VDisplay, int Depth, unsigned int VBFlags2);
1543 unsigned short  SiS_GetModeID_VGA2(int VGAEngine, unsigned int VBFlags, int HDisplay,
1544                                 int VDisplay, int Depth, unsigned int VBFlags2);
1545
1546 void            SiS_SetReg(SISIOADDRESS port, unsigned short index, unsigned short data);
1547 void            SiS_SetRegByte(SISIOADDRESS port, unsigned short data);
1548 void            SiS_SetRegShort(SISIOADDRESS port, unsigned short data);
1549 void            SiS_SetRegLong(SISIOADDRESS port, unsigned int data);
1550 unsigned char   SiS_GetReg(SISIOADDRESS port, unsigned short index);
1551 unsigned char   SiS_GetRegByte(SISIOADDRESS port);
1552 unsigned short  SiS_GetRegShort(SISIOADDRESS port);
1553 unsigned int    SiS_GetRegLong(SISIOADDRESS port);
1554 void            SiS_SetRegANDOR(SISIOADDRESS Port, unsigned short Index, unsigned short DataAND,
1555                                 unsigned short DataOR);
1556 void            SiS_SetRegAND(SISIOADDRESS Port,unsigned short Index, unsigned short DataAND);
1557 void            SiS_SetRegOR(SISIOADDRESS Port,unsigned short Index, unsigned short DataOR);
1558
1559 void            SiS_DisplayOn(struct SiS_Private *SiS_Pr);
1560 void            SiS_DisplayOff(struct SiS_Private *SiS_Pr);
1561 void            SiSRegInit(struct SiS_Private *SiS_Pr, SISIOADDRESS BaseAddr);
1562 #ifndef SIS_LINUX_KERNEL
1563 void            SiSSetLVDSetc(struct SiS_Private *SiS_Pr);
1564 #endif
1565 void            SiS_SetEnableDstn(struct SiS_Private *SiS_Pr, int enable);
1566 void            SiS_SetEnableFstn(struct SiS_Private *SiS_Pr, int enable);
1567 unsigned short  SiS_GetModeFlag(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
1568                                 unsigned short ModeIdIndex);
1569 BOOLEAN         SiSDetermineROMLayout661(struct SiS_Private *SiS_Pr);
1570 #ifndef SIS_LINUX_KERNEL
1571 void            SiS_GetVBType(struct SiS_Private *SiS_Pr);
1572 #endif
1573
1574 BOOLEAN         SiS_SearchModeID(struct SiS_Private *SiS_Pr, unsigned short *ModeNo,
1575                                 unsigned short *ModeIdIndex);
1576 unsigned short  SiS_GetModePtr(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
1577                                 unsigned short ModeIdIndex);
1578 unsigned short  SiS_GetRefCRTVCLK(struct SiS_Private *SiS_Pr, unsigned short Index, int UseWide);
1579 unsigned short  SiS_GetRefCRT1CRTC(struct SiS_Private *SiS_Pr, unsigned short Index, int UseWide);
1580 unsigned short  SiS_GetColorDepth(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
1581                                 unsigned short ModeIdIndex);
1582 unsigned short  SiS_GetOffset(struct SiS_Private *SiS_Pr,unsigned short ModeNo,
1583                                 unsigned short ModeIdIndex, unsigned short RRTI);
1584 #ifdef SIS300
1585 void            SiS_GetFIFOThresholdIndex300(struct SiS_Private *SiS_Pr, unsigned short *idx1,
1586                                 unsigned short *idx2);
1587 unsigned short  SiS_GetFIFOThresholdB300(unsigned short idx1, unsigned short idx2);
1588 unsigned short  SiS_GetLatencyFactor630(struct SiS_Private *SiS_Pr, unsigned short index);
1589 #endif
1590 void            SiS_LoadDAC(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short ModeIdIndex);
1591 #ifdef SIS_XORG_XF86
1592 BOOLEAN         SiSSetMode(struct SiS_Private *SiS_Pr, ScrnInfoPtr pScrn, unsigned short ModeNo,
1593                                 BOOLEAN dosetpitch);
1594 BOOLEAN         SiSBIOSSetMode(struct SiS_Private *SiS_Pr, ScrnInfoPtr pScrn,
1595                                 DisplayModePtr mode, BOOLEAN IsCustom);
1596 BOOLEAN         SiSBIOSSetModeCRT2(struct SiS_Private *SiS_Pr, ScrnInfoPtr pScrn,
1597                                 DisplayModePtr mode, BOOLEAN IsCustom);
1598 BOOLEAN         SiSBIOSSetModeCRT1(struct SiS_Private *SiS_Pr, ScrnInfoPtr pScrn,
1599                                 DisplayModePtr mode, BOOLEAN IsCustom);
1600 #endif
1601 #ifdef SIS_LINUX_KERNEL
1602 BOOLEAN         SiSSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo);
1603 #endif
1604 void            SiS_CalcCRRegisters(struct SiS_Private *SiS_Pr, int depth);
1605 void            SiS_CalcLCDACRT1Timing(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
1606                                 unsigned short ModeIdIndex);
1607 #ifdef SIS_XORG_XF86
1608 void            SiS_Generic_ConvertCRData(struct SiS_Private *SiS_Pr, unsigned char *crdata, int xres,
1609                                 int yres, DisplayModePtr current);
1610 #endif
1611 #ifdef SIS_LINUX_KERNEL
1612 void            SiS_Generic_ConvertCRData(struct SiS_Private *SiS_Pr, unsigned char *crdata, int xres,
1613                                 int yres, struct fb_var_screeninfo *var, BOOLEAN writeres);
1614 #endif
1615
1616 /* From init301.c: */
1617 extern void             SiS_GetVBInfo(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
1618                                 unsigned short ModeIdIndex, int chkcrt2mode);
1619 extern void             SiS_GetLCDResInfo(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
1620                                 unsigned short ModeIdIndex);
1621 extern void             SiS_SetYPbPr(struct SiS_Private *SiS_Pr);
1622 extern void             SiS_SetTVMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
1623                                 unsigned short ModeIdIndex);
1624 extern void             SiS_UnLockCRT2(struct SiS_Private *SiS_Pr);
1625 extern void             SiS_DisableBridge(struct SiS_Private *);
1626 extern BOOLEAN          SiS_SetCRT2Group(struct SiS_Private *, unsigned short);
1627 extern unsigned short   SiS_GetRatePtr(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
1628                                 unsigned short ModeIdIndex);
1629 extern void             SiS_WaitRetrace1(struct SiS_Private *SiS_Pr);
1630 extern unsigned short   SiS_GetResInfo(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
1631                                 unsigned short ModeIdIndex);
1632 extern unsigned short   SiS_GetCH700x(struct SiS_Private *SiS_Pr, unsigned short tempax);
1633 extern unsigned short   SiS_GetVCLK2Ptr(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
1634                                 unsigned short ModeIdIndex, unsigned short RRTI);
1635 extern BOOLEAN          SiS_IsVAMode(struct SiS_Private *);
1636 extern BOOLEAN          SiS_IsDualEdge(struct SiS_Private *);
1637
1638 #ifdef SIS_XORG_XF86
1639 /* From other modules: */
1640 extern unsigned short   SiS_CheckBuildCustomMode(ScrnInfoPtr pScrn, DisplayModePtr mode,
1641                                 unsigned int VBFlags);
1642 extern unsigned char    SiS_GetSetBIOSScratch(ScrnInfoPtr pScrn, unsigned short offset,
1643                                 unsigned char value);
1644 extern unsigned char    SiS_GetSetModeID(ScrnInfoPtr pScrn, unsigned char id);
1645 extern unsigned short   SiS_GetModeNumber(ScrnInfoPtr pScrn, DisplayModePtr mode,
1646                                 unsigned int VBFlags);
1647 #endif
1648
1649 #ifdef SIS_LINUX_KERNEL
1650 #ifdef SIS300
1651 extern unsigned int     sisfb_read_nbridge_pci_dword(struct SiS_Private *SiS_Pr, int reg);
1652 extern void             sisfb_write_nbridge_pci_dword(struct SiS_Private *SiS_Pr, int reg,
1653                                 unsigned int val);
1654 #endif
1655 #ifdef SIS315H
1656 extern void             sisfb_write_nbridge_pci_byte(struct SiS_Private *SiS_Pr, int reg,
1657                                 unsigned char val);
1658 extern unsigned int     sisfb_read_mio_pci_word(struct SiS_Private *SiS_Pr, int reg);
1659 #endif
1660 #endif
1661
1662 #endif
1663