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