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