summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Simmons <jsimmons@maxwell.earthlink.net>2003-03-04 17:23:02 -0800
committerJames Simmons <jsimmons@maxwell.earthlink.net>2003-03-04 17:23:02 -0800
commit08c8d74317da1dcf38995964114a492b5fed29dc (patch)
tree49680af15fff749e4676cb2bf77f4d80ee5530d6
parentfdd82b90462618249c39e1b2b8f9e967339208fb (diff)
[FBDEV] Updates for the SIS fbdev driver to the new api. Removed poll. We wil use signals in the future instead.
-rw-r--r--drivers/video/Makefile2
-rw-r--r--drivers/video/hitfb.c2
-rw-r--r--drivers/video/sis/300vtbl.h1363
-rw-r--r--drivers/video/sis/310vtbl.h2461
-rw-r--r--drivers/video/sis/init.c5837
-rw-r--r--drivers/video/sis/init.h303
-rw-r--r--drivers/video/sis/init301.c12296
-rw-r--r--drivers/video/sis/init301.h502
-rw-r--r--drivers/video/sis/initdef.h114
-rw-r--r--drivers/video/sis/oem300.h468
-rw-r--r--drivers/video/sis/oem310.h218
-rw-r--r--drivers/video/sis/osdef.h13
-rw-r--r--drivers/video/sis/sis.h10
-rw-r--r--drivers/video/sis/sis_accel.c162
-rw-r--r--drivers/video/sis/sis_accel.h509
-rw-r--r--drivers/video/sis/sis_main.c4506
-rw-r--r--drivers/video/sis/sis_main.h674
-rw-r--r--drivers/video/sis/vgatypes.h26
-rw-r--r--drivers/video/sis/vstruct.h685
-rw-r--r--include/linux/fb.h5
-rw-r--r--include/video/sisfb.h (renamed from include/linux/sisfb.h)34
21 files changed, 19890 insertions, 10300 deletions
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index aec1d2a6d107..1145a7302da9 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -57,7 +57,7 @@ obj-$(CONFIG_FB_TX3912) += tx3912fb.o cfbfillrect.o cfbcopyarea.o cfbi
obj-$(CONFIG_FB_MATROX) += matrox/
obj-$(CONFIG_FB_RIVA) += riva/ cfbimgblt.o vgastate.o
-obj-$(CONFIG_FB_SIS) += sis/
+obj-$(CONFIG_FB_SIS) += sis/ cfbimgblt.o cfbfillrect.o cfbcopyarea.o
obj-$(CONFIG_FB_ATY) += aty/ cfbimgblt.o cfbfillrect.o cfbcopyarea.o
obj-$(CONFIG_FB_I810) += i810/ cfbfillrect.o cfbcopyarea.o \
cfbimgblt.o vgastate.o
diff --git a/drivers/video/hitfb.c b/drivers/video/hitfb.c
index 2fd15b181731..19dadead964b 100644
--- a/drivers/video/hitfb.c
+++ b/drivers/video/hitfb.c
@@ -107,14 +107,12 @@ static int hitfb_setcolreg(unsigned regno, unsigned red, unsigned green,
if (regno < 16) {
switch(info->var.bits_per_pixel) {
-#ifdef FBCON_HAS_CFB16
case 16:
((u16 *)(info->pseudo_palette))[regno] =
((red & 0xf800) ) |
((green & 0xfc00) >> 5) |
((blue & 0xf800) >> 11);
break;
-#endif
}
}
return 0;
diff --git a/drivers/video/sis/300vtbl.h b/drivers/video/sis/300vtbl.h
index 90226457257e..a00eaba17390 100644
--- a/drivers/video/sis/300vtbl.h
+++ b/drivers/video/sis/300vtbl.h
@@ -15,7 +15,7 @@ typedef struct _SiS300_StStruct
UCHAR VB_StTVYFilterIndex;
} SiS300_StStruct;
-SiS300_StStruct SiS300_SModeIDTable[]=
+static const SiS300_StStruct SiS300_SModeIDTable[] =
{
{0x01,0x9208,0x01,0x00,0x00,0x00,0x00,0x00},
{0x01,0x1210,0x14,0x01,0x01,0x00,0x00,0x00},
@@ -34,10 +34,9 @@ SiS300_StStruct SiS300_SModeIDTable[]=
{0x11,0x0212,0x1a,0x04,0x04,0x00,0x00,0x00},
{0x12,0x0212,0x1b,0x04,0x04,0x00,0x00,0x00},
{0x13,0x021b,0x1c,0x00,0x00,0x00,0x00,0x00},
- /* {0x12,0x0210,0x18,0x00,0x00,0x00,0x00,0x00}, */ /* <--- Different in BIOS */
{0x12,0x0010,0x18,0x02,0x02,0x00,0x00,0x00},
{0x12,0x0210,0x18,0x01,0x01,0x00,0x00,0x00},
- {0xff,0,0,0,0,0,0,0}
+ {0xff, 0, 0, 0, 0, 0, 0, 0}
};
typedef struct _SiS300_StandTableStruct
@@ -53,9 +52,9 @@ typedef struct _SiS300_StandTableStruct
UCHAR GRC[9];
} SiS300_StandTableStruct;
-SiS300_StandTableStruct SiS300_StandTable[]=
-{ /* TW: @ 0x38d4 in BIOS */
- {0x28,0x18,0x08,0x0800,
+static const SiS300_StandTableStruct SiS300_StandTable[] =
+{
+ {0x28,0x18,0x08,0x0800, /* 0x00 */
{0x09,0x03,0x00,0x02},
0x63,
{0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f,
@@ -67,7 +66,7 @@ SiS300_StandTableStruct SiS300_StandTable[]=
0x08,0x00,0x0f,0x00},
{0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
0xff} },
- {0x28,0x18,0x08,0x0800,
+ {0x28,0x18,0x08,0x0800, /* 0x01 */
{0x09,0x03,0x00,0x02},
0x63,
{0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f,
@@ -79,7 +78,7 @@ SiS300_StandTableStruct SiS300_StandTable[]=
0x08,0x00,0x0f,0x00},
{0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
0xff} },
- {0x50,0x18,0x08,0x1000,
+ {0x50,0x18,0x08,0x1000, /* 0x02 */
{0x01,0x03,0x00,0x02},
0x63,
{0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,
@@ -91,7 +90,7 @@ SiS300_StandTableStruct SiS300_StandTable[]=
0x08,0x00,0x0f,0x00},
{0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
0xff} },
- {0x50,0x18,0x08,0x1000,
+ {0x50,0x18,0x08,0x1000, /* 0x03 */
{0x01,0x03,0x00,0x02},
0x63,
{0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,
@@ -103,7 +102,7 @@ SiS300_StandTableStruct SiS300_StandTable[]=
0x08,0x00,0x0f,0x00},
{0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
0xff} },
- {0x28,0x18,0x08,0x4000,
+ {0x28,0x18,0x08,0x4000, /* 0x04 */
{0x09,0x03,0x00,0x02},
0x63,
{0x2d,0x27,0x28,0x90,0x2b,0x80,0xbf,0x1f,
@@ -115,7 +114,7 @@ SiS300_StandTableStruct SiS300_StandTable[]=
0x01,0x00,0x03,0x00},
{0x00,0x00,0x00,0x00,0x00,0x30,0x0f,0x00,
0xff} },
- {0x28,0x18,0x08,0x4000,
+ {0x28,0x18,0x08,0x4000, /* 0x05 */
{0x09,0x03,0x00,0x02},
0x63,
{0x2d,0x27,0x28,0x90,0x2b,0x80,0xbf,0x1f,
@@ -127,7 +126,7 @@ SiS300_StandTableStruct SiS300_StandTable[]=
0x01,0x00,0x03,0x00},
{0x00,0x00,0x00,0x00,0x00,0x30,0x0f,0x00,
0xff} },
- {0x50,0x18,0x08,0x4000,
+ {0x50,0x18,0x08,0x4000, /* 0x06 */
{0x01,0x01,0x00,0x06},
0x63,
{0x5f,0x4f,0x50,0x82,0x54,0x80,0xbf,0x1f,
@@ -139,7 +138,7 @@ SiS300_StandTableStruct SiS300_StandTable[]=
0x01,0x00,0x01,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x0d,0x00,
0xff} },
- {0x50,0x18,0x0e,0x1000,
+ {0x50,0x18,0x0e,0x1000, /* 0x07 */
{0x00,0x03,0x00,0x03},
0xa6,
{0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,
@@ -152,7 +151,7 @@ SiS300_StandTableStruct SiS300_StandTable[]=
{0x00,0x00,0x00,0x00,0x00,0x10,0x0a,0x00,
0xff} },
/* MDA_DAC*/
- {0x00,0x00,0x00,0x0000,
+ {0x00,0x00,0x00,0x0000, /* 0x08 */
{0x00,0x00,0x00,0x15},
0x15,
{0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,
@@ -165,7 +164,7 @@ SiS300_StandTableStruct SiS300_StandTable[]=
{0x15,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,
0x3f} },
/* CGA_DAC*/
- {0x00,0x10,0x04,0x0114,
+ {0x00,0x10,0x04,0x0114, /* 0x09 */
{0x11,0x09,0x15,0x00},
0x10,
{0x04,0x14,0x01,0x11,0x09,0x15,0x2a,0x3a,
@@ -178,7 +177,7 @@ SiS300_StandTableStruct SiS300_StandTable[]=
{0x3f,0x2a,0x3a,0x2e,0x3e,0x2b,0x3b,0x2f,
0x3f} },
/* EGA_DAC*/
- {0x00,0x10,0x04,0x0114,
+ {0x00,0x10,0x04,0x0114, /* 0x0a */
{0x11,0x05,0x15,0x20},
0x30,
{0x24,0x34,0x21,0x31,0x25,0x35,0x08,0x18,
@@ -191,7 +190,7 @@ SiS300_StandTableStruct SiS300_StandTable[]=
{0x1f,0x2a,0x3a,0x2e,0x3e,0x2b,0x3b,0x2f,
0x3f} },
/* VGA_DAC*/
- {0x00,0x10,0x04,0x0114,
+ {0x00,0x10,0x04,0x0114, /* 0x0b */
{0x11,0x09,0x15,0x2a},
0x3a,
{0x2e,0x3e,0x2b,0x3b,0x2f,0x3f,0x00,0x05,
@@ -203,7 +202,7 @@ SiS300_StandTableStruct SiS300_StandTable[]=
0x1c,0x0e,0x11,0x15},
{0x18,0x1c,0x14,0x16,0x18,0x1a,0x1c,0x00,
0x04} },
- {0x08,0x0c,0x10,0x0a08,
+ {0x08,0x0c,0x10,0x0a08, /* 0x0c */
{0x0c,0x0e,0x10,0x0b},
0x0c,
{0x0d,0x0f,0x10,0x10,0x01,0x08,0x00,0x00,
@@ -215,7 +214,7 @@ SiS300_StandTableStruct SiS300_StandTable[]=
0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00} },
- {0x28,0x18,0x08,0x2000,
+ {0x28,0x18,0x08,0x2000, /* 0x0d */
{0x09,0x0f,0x00,0x06},
0x63,
{0x2d,0x27,0x28,0x90,0x2b,0x80,0xbf,0x1f,
@@ -227,7 +226,7 @@ SiS300_StandTableStruct SiS300_StandTable[]=
0x01,0x00,0x0f,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f,
0xff} },
- {0x50,0x18,0x08,0x4000,
+ {0x50,0x18,0x08,0x4000, /* 0x0e */
{0x01,0x0f,0x00,0x06},
0x63,
{0x5f,0x4f,0x50,0x82,0x54,0x80,0xbf,0x1f,
@@ -239,8 +238,8 @@ SiS300_StandTableStruct SiS300_StandTable[]=
0x01,0x00,0x0f,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f,
0xff} },
- {0x00,0x00,0x00,0x0000, /* TW: Standtable for VGA modes */
- {0x01,0x0f,0x00,0x0e}, /* (identical to BIOS) */
+ {0x00,0x00,0x00,0x0000, /* 0x0f */ /* TW: Standtable for VGA modes */
+ {0x01,0x0f,0x00,0x0e},
0x23,
{0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e,
0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
@@ -251,7 +250,7 @@ SiS300_StandTableStruct SiS300_StandTable[]=
0x01,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0f,
0xff} },
- {0x4a,0x36,0x00,0x00c0,
+ {0x4a,0x36,0x00,0x00c0, /* 0x10 */
{0x00,0x00,0x00,0x00},
0x00,
{0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x3a,
@@ -263,7 +262,7 @@ SiS300_StandTableStruct SiS300_StandTable[]=
0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00} },
- {0x50,0x18,0x0e,0x8000,
+ {0x50,0x18,0x0e,0x8000, /* 0x11 */
{0x01,0x0f,0x00,0x06},
0xa2,
{0x5f,0x4f,0x50,0x82,0x54,0x80,0xbf,0x1f,
@@ -275,7 +274,7 @@ SiS300_StandTableStruct SiS300_StandTable[]=
0x0b,0x00,0x05,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x05,
0xff} },
- {0x50,0x18,0x0e,0x8000,
+ {0x50,0x18,0x0e,0x8000, /* 0x12 */
{0x01,0x0f,0x00,0x06},
0xa3,
{0x5f,0x4f,0x50,0x82,0x54,0x80,0xbf,0x1f,
@@ -287,7 +286,7 @@ SiS300_StandTableStruct SiS300_StandTable[]=
0x01,0x00,0x0f,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f,
0xff} },
- {0x28,0x18,0x0e,0x0800,
+ {0x28,0x18,0x0e,0x0800, /* 0x13 */
{0x09,0x03,0x00,0x02},
0xa3,
{0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f,
@@ -299,7 +298,7 @@ SiS300_StandTableStruct SiS300_StandTable[]=
0x08,0x00,0x0f,0x00},
{0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
0xff} },
- {0x28,0x18,0x0e,0x0800,
+ {0x28,0x18,0x0e,0x0800, /* 0x14 */
{0x09,0x03,0x00,0x02},
0xa3,
{0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f,
@@ -311,7 +310,7 @@ SiS300_StandTableStruct SiS300_StandTable[]=
0x08,0x00,0x0f,0x00},
{0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
0xff} },
- {0x50,0x18,0x0e,0x1000,
+ {0x50,0x18,0x0e,0x1000, /* 0x15 */
{0x01,0x03,0x00,0x02},
0xa3,
{0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,
@@ -323,7 +322,7 @@ SiS300_StandTableStruct SiS300_StandTable[]=
0x08,0x00,0x0f,0x00},
{0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
0xff} },
- {0x50,0x18,0x0e,0x1000,
+ {0x50,0x18,0x0e,0x1000, /* 0x16 */
{0x01,0x03,0x00,0x02},
0xa3,
{0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,
@@ -335,7 +334,7 @@ SiS300_StandTableStruct SiS300_StandTable[]=
0x08,0x00,0x0f,0x00},
{0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
0xff} },
- {0x28,0x18,0x10,0x0800,
+ {0x28,0x18,0x10,0x0800, /* 0x17 */
{0x08,0x03,0x00,0x02},
0x67,
{0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f,
@@ -347,7 +346,7 @@ SiS300_StandTableStruct SiS300_StandTable[]=
0x0c,0x00,0x0f,0x08},
{0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
0xff} },
- {0x50,0x18,0x10,0x1000,
+ {0x50,0x18,0x10,0x1000, /* 0x18 */
{0x00,0x03,0x00,0x02},
0x67,
{0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,
@@ -359,7 +358,7 @@ SiS300_StandTableStruct SiS300_StandTable[]=
0x0c,0x00,0x0f,0x08},
{0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
0xff} },
- {0x50,0x18,0x10,0x1000,
+ {0x50,0x18,0x10,0x1000, /* 0x19 */
{0x00,0x03,0x00,0x02},
0x66,
{0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,
@@ -371,7 +370,7 @@ SiS300_StandTableStruct SiS300_StandTable[]=
0x0e,0x00,0x0f,0x08},
{0x00,0x00,0x00,0x00,0x00,0x10,0x0a,0x00,
0xff} },
- {0x50,0x1d,0x10,0xa000,
+ {0x50,0x1d,0x10,0xa000, /* 0x1a */
{0x01,0x0f,0x00,0x06},
0xe3,
{0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e,
@@ -383,7 +382,7 @@ SiS300_StandTableStruct SiS300_StandTable[]=
0x01,0x00,0x0f,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x01,
0xff} },
- {0x50,0x1d,0x10,0xa000,
+ {0x50,0x1d,0x10,0xa000, /* 0x1b */
{0x01,0x0f,0x00,0x06},
0xe3,
{0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e,
@@ -395,7 +394,7 @@ SiS300_StandTableStruct SiS300_StandTable[]=
0x01,0x00,0x0f,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f,
0xff} },
- {0x28,0x18,0x08,0x2000,
+ {0x28,0x18,0x08,0x2000, /* 0x1c */
{0x01,0x0f,0x00,0x0e},
0x63,
{0x5f,0x4f,0x50,0x82,0x54,0x80,0xbf,0x1f,
@@ -424,61 +423,85 @@ typedef struct _SiS300_ExtStruct
UCHAR REFindex;
} SiS300_ExtStruct;
-SiS300_ExtStruct SiS300_EModeIDTable[]=
-{
- {0x6a,0x2212,0x47,0x3563,0x0102,0x08,0x07,0x00,0x00,0x00,0x00}, /* 37ed */ /* 800x600x? */
- {0x2e,0x0a1b,0x36,0x3539,0x0101,0x08,0x06,0x00,0x00,0x00,0x08}, /* 37c3 */
- {0x2f,0x021b,0x35,0x3532,0x0100,0x08,0x05,0x00,0x00,0x00,0x10}, /* 37bc */
- {0x30,0x2a1b,0x47,0x3563,0x0103,0x08,0x07,0x00,0x00,0x00,0x00}, /* 37ed */
- {0x31,0x0a1b,0xad,0x3630,0x0000,0x08,0x0c,0x00,0x00,0x00,0x11}, /* 38ba */ /* 720x480x8 */
- {0x32,0x2a1b,0xae,0x3637,0x0000,0x08,0x0d,0x00,0x00,0x00,0x12}, /* 38c1 */ /* 720x576x8 */
- {0x33,0x0a1d,0xad,0x3630,0x0000,0x08,0x0c,0x00,0x00,0x00,0x11}, /* 38ba */ /* 720x480x16 */
- {0x34,0x2a1d,0xae,0x3637,0x0000,0x08,0x0d,0x00,0x00,0x00,0x12}, /* 38c1 */ /* 720x576x16 */
- {0x35,0x0a1f,0xad,0x3630,0x0000,0x08,0x0c,0x00,0x00,0x00,0x11}, /* 38ba */ /* 720x480x32 */
- {0x36,0x2a1f,0xae,0x3637,0x0000,0x08,0x0d,0x00,0x00,0x00,0x12}, /* 38c1 */ /* 720x576x32 */
- {0x37,0x0212,0x58,0x358d,0x0104,0x08,0x08,0x00,0x00,0x00,0x13}, /* 3817 */ /* 1024x768x? */
- {0x38,0x0a1b,0x58,0x358d,0x0105,0x08,0x08,0x00,0x00,0x00,0x13}, /* 3817 */ /* 1024x768x8 */
- {0x3a,0x0e3b,0x69,0x35be,0x0107,0x08,0x09,0x00,0x00,0x00,0x1a}, /* 3848 */ /* 1280x1024x8 */
- {0x3c,0x063b,0x7a,0x35d4,0x0130,0x08,0x0a,0x00,0x00,0x00,0x1e}, /* 385e */
- {0x3d,0x067d,0x7a,0x35d4,0x0131,0x08,0x0a,0x00,0x00,0x00,0x1e}, /* 385e */
- {0x40,0x921c,0x00,0x3516,0x010d,0x08,0x00,0x00,0x00,0x00,0x23}, /* 37a0 */
- {0x41,0x921d,0x00,0x3516,0x010e,0x08,0x00,0x00,0x00,0x00,0x23}, /* 37a0 */
- {0x43,0x0a1c,0x36,0x3539,0x0110,0x08,0x06,0x00,0x00,0x00,0x08}, /* 37c3 */
- {0x44,0x0a1d,0x36,0x3539,0x0111,0x08,0x06,0x00,0x00,0x00,0x08}, /* 37c3 */
- {0x46,0x2a1c,0x47,0x3563,0x0113,0x08,0x07,0x00,0x00,0x00,0x00}, /* 37ed */
- {0x47,0x2a1d,0x47,0x3563,0x0114,0x08,0x07,0x00,0x00,0x00,0x00}, /* 37ed */
- {0x49,0x0a3c,0x58,0x358d,0x0116,0x08,0x08,0x00,0x00,0x00,0x13}, /* 3817 */
- {0x4a,0x0a3d,0x58,0x358d,0x0117,0x08,0x08,0x00,0x00,0x00,0x13}, /* 3817 */
- {0x4c,0x0e7c,0x69,0x35be,0x0119,0x08,0x09,0x00,0x00,0x00,0x1a}, /* 3848 */
- {0x4d,0x0e7d,0x69,0x35be,0x011a,0x08,0x09,0x00,0x00,0x00,0x1a}, /* 3848 */
- {0x50,0x921b,0x01,0x351d,0x0132,0x08,0x01,0x00,0x00,0x00,0x24}, /* 37a7 */
- {0x51,0xb21b,0x13,0x3524,0x0133,0x08,0x03,0x00,0x00,0x00,0x25}, /* 37ae */
- {0x52,0x921b,0x24,0x352b,0x0134,0x08,0x04,0x00,0x00,0x00,0x26}, /* 37b5 */
- {0x56,0x921d,0x01,0x351d,0x0135,0x08,0x01,0x00,0x00,0x00,0x24}, /* 37a7 */
- {0x57,0xb21d,0x13,0x3524,0x0136,0x08,0x03,0x00,0x00,0x00,0x25}, /* 37ae */
- {0x58,0x921d,0x24,0x352b,0x0137,0x08,0x04,0x00,0x00,0x00,0x26}, /* 37b5 */
- {0x59,0x921b,0x00,0x3516,0x0138,0x08,0x00,0x00,0x00,0x00,0x23}, /* 37a0 */
+static const SiS300_ExtStruct SiS300_EModeIDTable[] =
+{
+ {0x6a,0x2212,0x47,0x3563,0x0102,0x08,0x07,0x00,0x00,0x00,0x00}, /* 800x600x? */
+ {0x2e,0x0a1b,0x36,0x3539,0x0101,0x08,0x06,0x00,0x00,0x00,0x08},
+ {0x2f,0x021b,0x35,0x3532,0x0100,0x08,0x05,0x00,0x00,0x00,0x10}, /* 640x400x8 */
+ {0x30,0x2a1b,0x47,0x3563,0x0103,0x08,0x07,0x00,0x00,0x00,0x00},
+ {0x31,0x0a1b,0xad,0x3630,0x0000,0x08,0x0c,0x00,0x00,0x00,0x11}, /* 720x480x8 */
+ {0x32,0x2a1b,0xae,0x3637,0x0000,0x08,0x0d,0x00,0x00,0x00,0x12}, /* 720x576x8 */
+ {0x33,0x0a1d,0xad,0x3630,0x0000,0x08,0x0c,0x00,0x00,0x00,0x11}, /* 720x480x16 */
+ {0x34,0x2a1d,0xae,0x3637,0x0000,0x08,0x0d,0x00,0x00,0x00,0x12}, /* 720x576x16 */
+ {0x35,0x0a1f,0xad,0x3630,0x0000,0x08,0x0c,0x00,0x00,0x00,0x11}, /* 720x480x32 */
+ {0x36,0x2a1f,0xae,0x3637,0x0000,0x08,0x0d,0x00,0x00,0x00,0x12}, /* 720x576x32 */
+ {0x37,0x0212,0x58,0x358d,0x0104,0x08,0x08,0x00,0x00,0x00,0x13}, /* 1024x768x? */
+ {0x38,0x0a1b,0x58,0x358d,0x0105,0x08,0x08,0x00,0x00,0x00,0x13}, /* 1024x768x8 */
+ {0x3a,0x0e3b,0x69,0x35be,0x0107,0x08,0x09,0x00,0x00,0x00,0x1a}, /* 1280x1024x8 */
+ {0x3c,0x063b,0x7a,0x35d4,0x0130,0x08,0x0a,0x00,0x00,0x00,0x1e},
+ {0x3d,0x067d,0x7a,0x35d4,0x0131,0x08,0x0a,0x00,0x00,0x00,0x1e},
+ {0x40,0x921c,0x00,0x3516,0x010d,0x08,0x00,0x00,0x00,0x00,0x23},
+ {0x41,0x921d,0x00,0x3516,0x010e,0x08,0x00,0x00,0x00,0x00,0x23},
+ {0x43,0x0a1c,0x36,0x3539,0x0110,0x08,0x06,0x00,0x00,0x00,0x08},
+ {0x44,0x0a1d,0x36,0x3539,0x0111,0x08,0x06,0x00,0x00,0x00,0x08},
+ {0x46,0x2a1c,0x47,0x3563,0x0113,0x08,0x07,0x00,0x00,0x00,0x00}, /* 800x600 */
+ {0x47,0x2a1d,0x47,0x3563,0x0114,0x08,0x07,0x00,0x00,0x00,0x00}, /* 800x600 */
+ {0x49,0x0a3c,0x58,0x358d,0x0116,0x08,0x08,0x00,0x00,0x00,0x13},
+ {0x4a,0x0a3d,0x58,0x358d,0x0117,0x08,0x08,0x00,0x00,0x00,0x13},
+ {0x4c,0x0e7c,0x69,0x35be,0x0119,0x08,0x09,0x00,0x00,0x00,0x1a},
+ {0x4d,0x0e7d,0x69,0x35be,0x011a,0x08,0x09,0x00,0x00,0x00,0x1a},
+ {0x50,0x921b,0x01,0x351d,0x0132,0x08,0x01,0x00,0x00,0x00,0x24},
+ {0x51,0xb21b,0x13,0x3524,0x0133,0x08,0x03,0x00,0x00,0x00,0x25}, /* 400x300 */
+ {0x52,0x921b,0x24,0x352b,0x0134,0x08,0x04,0x00,0x00,0x00,0x26},
+ {0x56,0x921d,0x01,0x351d,0x0135,0x08,0x01,0x00,0x00,0x00,0x24},
+ {0x57,0xb21d,0x13,0x3524,0x0136,0x08,0x03,0x00,0x00,0x00,0x25}, /* 400x300 */
+ {0x58,0x921d,0x24,0x352b,0x0137,0x08,0x04,0x00,0x00,0x00,0x26},
+ {0x59,0x921b,0x00,0x3516,0x0138,0x08,0x00,0x00,0x00,0x00,0x23},
{0x5c,0x921f,0x24,0x352b,0x0000,0x08,0x04,0x00,0x00,0x00,0x26}, /* TW: inserted 512x384x32 */
- {0x5d,0x021d,0x35,0x3532,0x0139,0x08,0x05,0x00,0x00,0x00,0x10}, /* 37bc */
- {0x62,0x0a3f,0x36,0x3539,0x013a,0x08,0x06,0x00,0x00,0x00,0x08}, /* 37c3 */
- {0x63,0x2a3f,0x47,0x3563,0x013b,0x08,0x07,0x00,0x00,0x00,0x00}, /* 37ed */
- {0x64,0x0a7f,0x58,0x358d,0x013c,0x08,0x08,0x00,0x00,0x00,0x13}, /* 3817 */
- {0x65,0x0eff,0x69,0x35be,0x013d,0x08,0x09,0x00,0x00,0x00,0x1a}, /* 3848 */
- {0x66,0x06ff,0x7a,0x35d4,0x013e,0x08,0x0a,0x00,0x00,0x00,0x1e}, /* 385e */
- {0x68,0x067b,0x8b,0x35ef,0x013f,0x08,0x0b,0x00,0x00,0x00,0x27}, /* 3879 */
- {0x69,0x06fd,0x8b,0x35ef,0x0140,0x08,0x0b,0x00,0x00,0x00,0x27}, /* 3879 */
- {0x6b,0x07ff,0x8b,0x35ef,0x0000,0x10,0x0b,0x00,0x00,0x00,0x27}, /* 3879 */
- {0x6c,0x067b,0x9c,0x35f6,0x0000,0x08,0x0c,0x00,0x00,0x00,0x28}, /* 3880 */
- {0x6d,0x06fd,0x9c,0x35f6,0x0000,0x10,0x0c,0x00,0x00,0x00,0x28}, /* 3880 */
- {0x6e,0x0e3b,0x6f,0x35b2,0x0000,0x08,0x0e,0x00,0x00,0x00,0x29}, /* 383c */ /* 1280x960x8 */
- {0x6f,0x0e7d,0x6f,0x35b2,0x0000,0x08,0x0e,0x00,0x00,0x00,0x29}, /* 383c */ /* 1280x960x16 */
- {0x7b,0x0eff,0x6f,0x35b2,0x0000,0x08,0x0e,0x00,0x00,0x00,0x29}, /* 383c */ /* 1280x960x32 */
- {0x20,0x0a1b,0x54,0x0000,0x0000,0x08,0x0f,0x00,0x00,0x00,0x2b}, /* 1024x600 */
+ {0x5d,0x021d,0x35,0x3532,0x0139,0x08,0x05,0x00,0x00,0x00,0x10}, /* 640x400x16 */
+ {0x5e,0x021f,0x35,0x3532,0x0000,0x08,0x05,0x00,0x00,0x00,0x10}, /* TW: inserted 640x400x32 */
+ {0x62,0x0a3f,0x36,0x3539,0x013a,0x08,0x06,0x00,0x00,0x00,0x08},
+ {0x63,0x2a3f,0x47,0x3563,0x013b,0x08,0x07,0x00,0x00,0x00,0x00}, /* 800x600 */
+ {0x64,0x0a7f,0x58,0x358d,0x013c,0x08,0x08,0x00,0x00,0x00,0x13},
+ {0x65,0x0eff,0x69,0x35be,0x013d,0x08,0x09,0x00,0x00,0x00,0x1a},
+ {0x66,0x06ff,0x7a,0x35d4,0x013e,0x08,0x0a,0x00,0x00,0x00,0x1e},
+ {0x68,0x067b,0x8b,0x35ef,0x013f,0x08,0x0b,0x00,0x00,0x00,0x27},
+ {0x69,0x06fd,0x8b,0x35ef,0x0140,0x08,0x0b,0x00,0x00,0x00,0x27},
+ {0x6b,0x07ff,0x8b,0x35ef,0x0000,0x10,0x0b,0x00,0x00,0x00,0x27},
+ {0x6c,0x067b,0x9c,0x35f6,0x0000,0x08,0x11,0x00,0x00,0x00,0x28}, /* TW: 2048x1536x8 - not in BIOS! */
+ {0x6d,0x06fd,0x9c,0x35f6,0x0000,0x10,0x11,0x00,0x00,0x00,0x28}, /* TW: 2048x1536x16 - not in BIOS! */
+ {0x6e,0x0a3b,0x6f,0x35b2,0x0000,0x08,0x0e,0x00,0x00,0x00,0x29}, /* 1280x960x8 */
+ {0x6f,0x0a7d,0x6f,0x35b2,0x0000,0x08,0x0e,0x00,0x00,0x00,0x29}, /* 1280x960x16 */
+ /* TW: 16:9 modes copied from 310/325 series - not in ANY BIOS */
+ {0x70,0x2a1b,0x40,0x3b52,0x0000,0x08,0x12,0x00,0x00,0x07,0x2d}, /* 800x480x8 */
+ {0x71,0x0a1b,0x51,0x3b63,0x0000,0x08,0x13,0x00,0x00,0x00,0x30}, /* 1024x576x8 */
+ {0x74,0x0a1d,0x51,0x3b63,0x0000,0x08,0x13,0x00,0x00,0x00,0x30}, /* 1024x576x16 */
+ {0x75,0x0e3d,0x62,0x3b74,0x0000,0x08,0x14,0x00,0x00,0x00,0x33}, /* 1280x720x16 */
+ {0x76,0x2a1f,0x40,0x3b52,0x0000,0x08,0x12,0x00,0x00,0x07,0x2d}, /* 800x480x32 */
+ {0x77,0x0a3f,0x51,0x3b63,0x0000,0x08,0x13,0x00,0x00,0x00,0x30}, /* 1024x576x32 */
+ {0x78,0x0eff,0x62,0x3b74,0x0000,0x08,0x14,0x00,0x00,0x00,0x33}, /* 1280x720x32 */
+ {0x79,0x0e3b,0x62,0x3b74,0x0000,0x08,0x14,0x00,0x00,0x00,0x33}, /* 1280x720x8 */
+ {0x7a,0x2a1d,0x40,0x3b52,0x0000,0x08,0x12,0x00,0x00,0x07,0x2d}, /* 800x480x16 */
+ /* TW: End of new 16:9 modes */
+ {0x7b,0x0aff,0x6f,0x35b2,0x0000,0x08,0x0e,0x00,0x00,0x00,0x29}, /* 1280x960x32 */
+ {0x20,0x0a1b,0x54,0x0000,0x0000,0x08,0x0f,0x00,0x00,0x00,0x2b}, /* 1024x600 */
{0x21,0x0a3d,0x54,0x0000,0x0000,0x08,0x0f,0x00,0x00,0x00,0x2b},
{0x22,0x0a7f,0x54,0x0000,0x0000,0x08,0x0f,0x00,0x00,0x00,0x2b},
- {0x23,0x0a1b,0xc5,0x0000,0x0000,0x08,0x10,0x00,0x00,0x00,0x2c}, /* 1152x768 */
+ {0x23,0x0a1b,0xc5,0x0000,0x0000,0x08,0x10,0x00,0x00,0x00,0x2c}, /* 1152x768 */
{0x24,0x0a3d,0xc5,0x431d,0x0000,0x08,0x10,0x00,0x00,0x00,0x2c},
{0x25,0x0a7f,0xc5,0x431d,0x0000,0x08,0x10,0x00,0x00,0x00,0x2c},
+ {0x29,0x0e1b,0xc5,0x0000,0x0000,0x08,0x15,0x00,0x00,0x00,0x36}, /* TW: NEW 1152x864 - not in BIOS */
+ {0x2a,0x0e3d,0xc5,0x0000,0x0000,0x08,0x15,0x00,0x00,0x00,0x36},
+ {0x2b,0x0e7f,0xc5,0x0000,0x0000,0x08,0x15,0x00,0x00,0x00,0x36},
+ {0x39,0x2a1b,0xd6,0x0000,0x0000,0x08,0x16,0x00,0x00,0x00,0x38}, /* TW: NEW 848x480 - not in BIOS */
+ {0x3b,0x2a3d,0xd6,0x0000,0x0000,0x08,0x16,0x00,0x00,0x00,0x38},
+ {0x3e,0x2a7f,0xd6,0x0000,0x0000,0x08,0x16,0x00,0x00,0x00,0x38},
+ {0x3f,0x2a1b,0xd7,0x0000,0x0000,0x08,0x17,0x00,0x00,0x00,0x3a}, /* TW: NEW 856x480 - not in BIOS */
+ {0x42,0x2a3d,0xd7,0x0000,0x0000,0x08,0x17,0x00,0x00,0x00,0x3a},
+ {0x45,0x2a7f,0xd7,0x0000,0x0000,0x08,0x17,0x00,0x00,0x00,0x3a},
+ {0x48,0x223b,0xe8,0x0000,0x0000,0x08,0x18,0x00,0x00,0x00,0x3c}, /* TW: NEW 1360x768 - not in BIOS */
+ {0x4b,0x227d,0xe8,0x0000,0x0000,0x08,0x18,0x00,0x00,0x00,0x3c},
+ {0x4e,0x22ff,0xe8,0x0000,0x0000,0x08,0x18,0x00,0x00,0x00,0x3c},
{0xff,0x0000,0x00,0x0000,0xffff,0x00,0x00,0x00,0x00,0x00,0x00}
};
@@ -486,7 +509,7 @@ typedef struct _SiS300_Ext2Struct
{
USHORT Ext_InfoFlag;
UCHAR Ext_CRT1CRTC; /* TW: Index in SiS300_CRT1Table */
- UCHAR Ext_CRTVCLK;
+ UCHAR Ext_CRTVCLK; /* TW: Index in VCLK array */
UCHAR Ext_CRT2CRTC; /* TW: Index in LCD Paneltype arrays (&3f) */
UCHAR ModeID;
USHORT XRes;
@@ -494,15 +517,15 @@ typedef struct _SiS300_Ext2Struct
USHORT ROM_OFFSET;
} SiS300_Ext2Struct;
-SiS300_Ext2Struct SiS300_RefIndex[]=
+static const SiS300_Ext2Struct SiS300_RefIndex[] =
{ /* TW: Don't ever insert anything here, table is indexed */
{0x085f,0x0d,0x03,0x05,0x6a, 800, 600,0x3563}, /* 00 */
{0x0467,0x0e,0x44,0x05,0x6a, 800, 600,0x3568}, /* 01 */
- {0x0067,0x4f,0x07,0x48,0x6a, 800, 600,0x356d}, /* 02 */
+ {0x0067,0x0f,0x07,0x48,0x6a, 800, 600,0x356d}, /* 02 - CRT1CRTC was 0x4f */
{0x0067,0x10,0x06,0x8b,0x6a, 800, 600,0x3572}, /* 03 */
{0x0147,0x11,0x08,0x00,0x6a, 800, 600,0x3577}, /* 04 */
{0x0147,0x12,0x0c,0x00,0x6a, 800, 600,0x357c}, /* 05 */
- {0x0047,0x51,0x4e,0x00,0x6a, 800, 600,0x3581}, /* 06 */
+ {0x0047,0x11,0x4e,0x00,0x6a, 800, 600,0x3581}, /* 06 - CRT1CRTC was 0x51 */
{0x0047,0x11,0x13,0x00,0x6a, 800, 600,0x3586}, /* 07 */
{0xc85f,0x05,0x00,0x04,0x2e, 640, 480,0x3539}, /* 08 */
{0xc067,0x06,0x02,0x04,0x2e, 640, 480,0x353e}, /* 09 */
@@ -517,30 +540,46 @@ SiS300_Ext2Struct SiS300_RefIndex[]=
{0x000f,0x32,0x03,0x06,0x32, 720, 576,0x3637}, /* 12 */
{0x0187,0x15,0x05,0x00,0x37,1024, 768,0x358d}, /* 13 */
{0xc877,0x16,0x09,0x06,0x37,1024, 768,0x3592}, /* 14 */
- {0xc067,0x97,0x0b,0x49,0x37,1024, 768,0x3597}, /* 15 */
+ {0xc067,0x17,0x0b,0x49,0x37,1024, 768,0x3597}, /* 15 - CRT1CRTC was 0x97 */
{0x0267,0x18,0x0d,0x00,0x37,1024, 768,0x359c}, /* 16 */
- {0x0047,0x59,0x11,0x8c,0x37,1024, 768,0x35a1}, /* 17 */
+ {0x0047,0x19,0x11,0x8c,0x37,1024, 768,0x35a1}, /* 17 - CRT1CRTC was 0x59 */
{0x0047,0x1a,0x52,0x00,0x37,1024, 768,0x35a6}, /* 18 */
- {0x0047,0x5b,0x16,0x00,0x37,1024, 768,0x35ab}, /* 19 */
- {0x0387,0x5c,0x4d,0x00,0x3a,1280,1024,0x35be}, /* 1a */
+ {0x0007,0x1b,0x16,0x00,0x37,1024, 768,0x35ab}, /* 19 - CRT1CRTC was 0x5b */
+ {0x0387,0x1c,0x4d,0x00,0x3a,1280,1024,0x35be}, /* 1a - CRT1CRTC was 0x5c */
{0x0077,0x1d,0x14,0x07,0x3a,1280,1024,0x35c3}, /* 1b */
{0x0047,0x1e,0x17,0x00,0x3a,1280,1024,0x35c8}, /* 1c */
{0x0007,0x1f,0x98,0x00,0x3a,1280,1024,0x35cd}, /* 1d */
- {0x0007,0x60,0x59,0x00,0x3c,1600,1200,0x35d4}, /* 1e */
+ {0x0007,0x20,0x59,0x00,0x3c,1600,1200,0x35d4}, /* 1e - CRT1CRTC was 0x60 */
{0x0007,0x21,0x5a,0x00,0x3c,1600,1200,0x35d9}, /* 1f */
{0x0007,0x22,0x1b,0x00,0x3c,1600,1200,0x35de}, /* 20 */
- {0x0007,0x63,0x1d,0x00,0x3c,1600,1200,0x35e3}, /* 21 */
+ {0x0007,0x23,0x1d,0x00,0x3c,1600,1200,0x35e3}, /* 21 - CRT1CRTC was 0x63 */
{0x0007,0x24,0x1e,0x00,0x3c,1600,1200,0x35e8}, /* 22 */
{0x407f,0x00,0x00,0x00,0x40, 320, 200,0x3516}, /* 23 */
{0xc07f,0x01,0x00,0x04,0x50, 320, 240,0x351d}, /* 24 */
{0x0077,0x02,0x04,0x05,0x51, 400, 300,0x3524}, /* 25 */
- {0xc077,0x03,0x09,0x06,0x52, 512, 384,0x352b}, /* 26 */
+ {0xc877,0x03,0x09,0x06,0x52, 512, 384,0x352b}, /* 26 */ /* was c077 */
{0x8207,0x25,0x1f,0x00,0x68,1920,1440,0x35ef}, /* 27 */
- {0x0007,0x26,0x20,0x00,0x6c, 720, 480,0x35f6}, /* 28 */
- {0x0027,0x27,0x14,0x08,0x6e,1280, 960,0x35b2}, /* 29 */
- {0x0027,0x27,0x14,0x08,0x6e,1280, 960,0x35b7}, /* 2a */
+ {0x0007,0x26,0x20,0x00,0x6c,2048,1536,0x35f6}, /* 28 */
+ {0x0067,0x27,0x14,0x08,0x6e,1280, 960,0x35b7}, /* 29 - TW: 1280x960-60 */
+ {0x0027,0x45,0x3c,0x08,0x6e,1280, 960,0x35b7}, /* 2a - TW: 1280x960-85 */
{0xc077,0x33,0x09,0x06,0x20,1024, 600,0x0000}, /* 2b */
- {0xc077,0x34,0x09,0x06,0x23,1152, 768,0x0000}, /* 2c */
+ {0xc077,0x34,0x0b,0x06,0x23,1152, 768,0x0000}, /* 2c */ /* VCLK 0x09 */
+ {0x0057,0x35,0x27,0x08,0x70, 800, 480,0x3b52}, /* 2d - TW: 16:9 modes */
+ {0x0047,0x36,0x37,0x08,0x70, 800, 480,0x3b57}, /* 2e */
+ {0x0047,0x37,0x08,0x08,0x70, 800, 480,0x3b5c}, /* 2f */
+ {0x0057,0x38,0x09,0x09,0x71,1024, 576,0x3b63}, /* 30 */
+ {0x0047,0x39,0x38,0x09,0x71,1024, 576,0x3b68}, /* 31 */
+ {0x0047,0x3a,0x11,0x09,0x71,1024, 576,0x3b6d}, /* 32 */
+ {0x0057,0x3b,0x39,0x0a,0x75,1280, 720,0x3b74}, /* 33 */
+ {0x0047,0x3c,0x3a,0x0a,0x75,1280, 720,0x3b79}, /* 34 */
+ {0x0007,0x3d,0x3b,0x0a,0x75,1280, 720,0x3b7e}, /* 35 - TW: END of 16:9 modes */
+ {0x0047,0x3e,0x34,0x06,0x29,1152, 864,0x0000}, /* 36 TW: 1152x864-75Hz - Non-BIOS, new */
+ {0x0047,0x44,0x3a,0x06,0x29,1152, 864,0x0000}, /* 37 TW: 1152x864-85Hz - Non-BIOS, new */
+ {0x00c7,0x3f,0x28,0x00,0x39, 848, 480,0x0000}, /* 38 TW: 848x480-38Hzi - Non-BIOS, new */
+ {0xc047,0x40,0x3d,0x00,0x39, 848, 480,0x0000}, /* 39 TW: 848x480-60Hz - Non-BIOS, new */
+ {0x00c7,0x41,0x28,0x00,0x3f, 856, 480,0x0000}, /* 3a TW: 856x480-38Hzi - Non-BIOS, new */
+ {0xc047,0x42,0x28,0x00,0x3f, 856, 480,0x0000}, /* 3b TW: 856x480-60Hz - Non-BIOS, new */
+ {0x0047,0x43,0x3e,0x00,0x48,1360, 768,0x0000}, /* 3c TW: 1360x768-60Hz - Non-BIOS, new */
{0xffff,0,0,0,0,0,0,0}
};
@@ -557,9 +596,9 @@ typedef struct _SiS_VBModeIDTableStruct
UCHAR _VB_LCDVIndex;
}SiS_VBModeIDTableStruct;
-SiS_VBModeIDTableStruct SiS300_VBModeIDTable[]=
+static const SiS_VBModeIDTableStruct SiS300_VBModeIDTable[] =
{
- {0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, /* TW: Identical to 630/301B BIOS */
+ {0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01},
{0x01,0x00,0x00,0x00,0x01,0x00,0x01,0x02},
{0x03,0x00,0x00,0x00,0x02,0x00,0x02,0x00},
@@ -619,7 +658,7 @@ typedef struct _SiS300_CRT1TableStruct
UCHAR CR[17];
} SiS300_CRT1TableStruct;
-SiS300_CRT1TableStruct SiS300_CRT1Table[]=
+static const SiS300_CRT1TableStruct SiS300_CRT1Table[] =
{
{{0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f, /* 0x00 */
0x9c,0x8e,0x8f,0x96,0xb9,0x30,0x00,0x00,
@@ -636,29 +675,49 @@ SiS300_CRT1TableStruct SiS300_CRT1Table[]=
{{0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,
0x9c,0x8e,0x8f,0x96,0xb9,0x30,0x00,0x05,
0x00}},
- {{0x5f,0x4f,0x50,0x82,0x55,0x81,0x0b,0x3e,
+#if 0
+ {{0x5f,0x4f,0x50,0x82,0x55,0x81,0x0b,0x3e, /* 0x05 */
0xe9,0x8b,0xdf,0xe7,0x04,0x00,0x00,0x05,
0x00}},
- {{0x63,0x4f,0x50,0x86,0x56,0x9b,0x06,0x3e,
+#endif
+ {{0x5f,0x4f,0x4f,0x83,0x55,0x81,0x0b,0x3e, /* 0x05 - corrected 640x480-60 */
+ 0xe9,0x8b,0xdf,0xe8,0x0c,0x00,0x00,0x05,
+ 0x00}},
+ #if 0
+ {{0x63,0x4f,0x50,0x86,0x56,0x9b,0x06,0x3e, /* 0x06 */
0xe8,0x8b,0xdf,0xe7,0xff,0x10,0x00,0x01,
0x00}},
+#endif
+ {{0x63,0x4f,0x4f,0x87,0x56,0x9b,0x06,0x3e, /* 0x06 - corrected 640x480-72 */
+ 0xe8,0x8a,0xdf,0xe7,0x07,0x00,0x00,0x01,
+ 0x00}},
{{0x64,0x4f,0x4f,0x88,0x55,0x9d,0xf2,0x1f,
0xe0,0x83,0xdf,0xdf,0xf3,0x10,0x00,0x01,
0x00}},
{{0x63,0x4f,0x4f,0x87,0x5a,0x81,0xfb,0x1f,
0xe0,0x83,0xdf,0xdf,0xfc,0x10,0x00,0x05,
0x00}},
- {{0x66,0x4f,0x4f,0x86,0x56,0x9e,0x03,0x3e,
+#if 0
+ {{0x66,0x4f,0x4f,0x86,0x56,0x9e,0x03,0x3e, /* 0x09 */
0xe4,0x87,0xdf,0xdf,0x04,0x00,0x00,0x01,
0x00}},
+#endif
+ {{0x67,0x4f,0x4f,0x8b,0x57,0x83,0x10,0x3e, /* 0x09 - corrected 640x480-100 */
+ 0xe7,0x8d,0xdf,0xe6,0x11,0x00,0x00,0x05,
+ 0x00}},
+#if 0
{{0x6c,0x4f,0x4f,0x83,0x59,0x9e,0x00,0x3e, /* 0x0a */
0xe5,0x8d,0xdf,0xdf,0x01,0x00,0x00,0x01,
0x00}},
+#endif
+ {{0x67,0x4f,0x4f,0x8b,0x57,0x83,0x10,0x3e, /* 0x0a - corrected 640x480-120 */
+ 0xe7,0x8d,0xdf,0xe6,0x11,0x00,0x00,0x05,
+ 0x00}},
{{0x63,0x4f,0x4f,0x87,0x56,0x9d,0xfb,0x1f,
0xe0,0x83,0xdf,0xdf,0xfc,0x10,0x00,0x01,
0x00}},
{{0x65,0x4f,0x4f,0x89,0x57,0x9f,0xfb,0x1f,
- 0xe6,0x8a,0xe5,0xe5,0xfc,0x00,0x00,0x01,
+ 0xe6,0x8a,0xdf,0xdf,0xfc,0x10,0x00,0x01, /* TW: Corrected VDE, VBE */
0x00}},
{{0x7b,0x63,0x63,0x9f,0x6a,0x93,0x6f,0xf0,
0x58,0x8a,0x57,0x57,0x70,0x20,0x00,0x05,
@@ -699,7 +758,7 @@ SiS300_CRT1TableStruct SiS300_CRT1Table[]=
{{0xa7,0x7f,0x7f,0x8b,0x89,0x95,0x26,0xf5,
0x00,0x83,0xff,0xff,0x27,0x10,0x00,0x02,
0x01}},
- {{0x9f,0x7f,0x7f,0x83,0x83,0x93,0x1e,0xf5,
+ {{0x9f,0x7f,0x7f,0x83,0x83,0x93,0x1e,0xf5, /* 0x1a */
0x00,0x84,0xff,0xff,0x1f,0x10,0x00,0x02,
0x01}},
{{0xa2,0x7f,0x7f,0x86,0x84,0x94,0x37,0xf5,
@@ -738,9 +797,14 @@ SiS300_CRT1TableStruct SiS300_CRT1Table[]=
{{0x55,0xff,0xff,0x99,0x0d,0x0c,0x3e,0xba,
0x00,0x84,0xff,0xff,0x3f,0x0f,0x41,0x05,
0x00}},
- {{0xdc,0x9f,0x9f,0x00,0xab,0x19,0xe6,0xef,
+#if 0
+ {{0xdc,0x9f,0x9f,0x00,0xab,0x19,0xe6,0xef, /* 0x27: 1280x960-70 - invalid! */
0xc0,0xc3,0xbf,0xbf,0xe7,0x10,0x00,0x07,
0x01}},
+#endif
+ {{0xdc,0x9f,0x9f,0x80,0xaf,0x9d,0xe6,0xff, /* 0x27: 1280x960-60 - correct */
+ 0xc0,0x83,0xbf,0xbf,0xe7,0x10,0x00,0x07,
+ 0x01}},
{{0x7f,0x63,0x63,0x83,0x6c,0x1c,0x72,0xba, /* 0x28 */
0x27,0x8b,0xdf,0xdf,0x73,0x00,0x00,0x06,
0x01}},
@@ -777,9 +841,70 @@ SiS300_CRT1TableStruct SiS300_CRT1Table[]=
{{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x1e,0xf1, /* 0x33 - 1024x600 */
0xae,0x85,0x57,0x57,0x1f,0x30,0x00,0x02,
0x01}},
+#if 0
{{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf5, /* 0x34 - 1152x768 */
0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x02,
- 0x01}}
+ 0x01}},
+#endif
+ {{0xa3,0x8f,0x8f,0x97,0x96,0x97,0x24,0xf5, /* 0x34 - 1152x768 - TW: corrected */
+ 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x02,
+ 0x01}},
+ {{0x7f,0x63,0x63,0x83,0x6c,0x1c,0x72,0xba, /* 0x35 - NEW 16:9 modes, not in BIOS ------ */
+ 0x27,0x8b,0xdf,0xdf,0x73,0x00,0x00,0x06,
+ 0x01}}, /* 0x35 */
+ {{0x7f,0x63,0x63,0x83,0x69,0x13,0x6f,0xba,
+ 0x26,0x89,0xdf,0xdf,0x6f,0x00,0x00,0x06,
+ 0x01}}, /* 0x36 */
+ {{0x7f,0x63,0x63,0x82,0x6b,0x13,0x75,0xba,
+ 0x29,0x8c,0xdf,0xdf,0x75,0x00,0x00,0x06,
+ 0x01}}, /* 0x37 */
+ {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf1,
+ 0xaf,0x85,0x3f,0x3f,0x25,0x30,0x00,0x02,
+ 0x01}}, /* 0x38 */
+ {{0x9f,0x7f,0x7f,0x83,0x85,0x91,0x1e,0xf1,
+ 0xad,0x81,0x3f,0x3f,0x1f,0x30,0x00,0x02,
+ 0x01}}, /* 0x39 */
+ {{0xa7,0x7f,0x7f,0x88,0x89,0x95,0x26,0xf1, /* TW: 95 was 15 - illegal HBE! */
+ 0xb1,0x85,0x3f,0x3f,0x27,0x30,0x00,0x02,
+ 0x01}}, /* 0x3a */
+ {{0xce,0x9f,0x9f,0x92,0xa9,0x17,0x28,0xc4,
+ 0x7a,0x8e,0xcf,0xcf,0x29,0x21,0x00,0x07,
+ 0x01}}, /* 0x3b */
+ {{0xce,0x9f,0x9f,0x92,0xa5,0x17,0x28,0xd4,
+ 0x7a,0x8e,0xcf,0xcf,0x29,0x21,0x00,0x07,
+ 0x01}}, /* 0x3c */
+ {{0xd3,0x9f,0x9f,0x97,0xab,0x1f,0x2e,0xd4,
+ 0x7d,0x81,0xcf,0xcf,0x2f,0x21,0x00,0x07,
+ 0x01}}, /* 0x3d */ /* TW: End of 16:9 modes --------------- */
+ {{0xc3,0x8f,0x8f,0x87,0x9b,0x0b,0x82,0xef, /* TW: New, 1152x864-75 (not in any BIOS) */
+ 0x60,0x83,0x5f,0x5f,0x83,0x10,0x00,0x07,
+ 0x01}}, /* 0x3e */
+ {{0x86,0x69,0x69,0x8A,0x74,0x06,0x8C,0x15, /* TW: New, 848x480-38i, not in BIOS */
+ 0x4F,0x83,0xEF,0xEF,0x8D,0x30,0x00,0x02,
+ 0x00}}, /* 0x3f */
+#if 0
+ {{0x81,0x69,0x69,0x85,0x70,0x00,0x0F,0x3E, /* TW: New, 848x480-60, not in BIOS - incorrect for Philips panel */
+ 0xEB,0x8E,0xDF,0xDF,0x10,0x00,0x00,0x02,
+ 0x00}}, /* 0x40 */
+#endif
+ {{0x83,0x69,0x69,0x87,0x6f,0x1d,0x03,0x3E, /* TW: New, 848x480-60, not in BIOS */
+ 0xE5,0x8d,0xDF,0xe4,0x04,0x00,0x00,0x06,
+ 0x00}}, /* 0x40 */
+ {{0x86,0x6A,0x6A,0x8A,0x74,0x06,0x8C,0x15, /* TW: New, 856x480-38i, not in BIOS */
+ 0x4F,0x83,0xEF,0xEF,0x8D,0x30,0x00,0x02,
+ 0x00}}, /* 0x41 */
+ {{0x81,0x6A,0x6A,0x85,0x70,0x00,0x0F,0x3E, /* TW: New, 856x480-60, not in BIOS */
+ 0xEB,0x8E,0xDF,0xDF,0x10,0x00,0x00,0x02,
+ 0x00}}, /* 0x42 */
+ {{0xdd,0xa9,0xa9,0x81,0xb4,0x97,0x26,0xfd, /* TW: New, 1360x768-60, not in BIOS */
+ 0x01,0x8d,0xff,0x00,0x27,0x10,0x00,0x03,
+ 0x01}}, /* 0x43 */
+ {{0xd9,0x8f,0x8f,0x9d,0xba,0x0a,0x8a,0xff, /* TW: New, 1152x864-84 (not in any BIOS) */
+ 0x60,0x8b,0x5f,0x5f,0x8b,0x10,0x00,0x03,
+ 0x01}}, /* 0x44 */
+ {{0xd3,0x9f,0x9f,0x97,0xab,0x1f,0xf1,0xff, /* TW: New, 1280x960-85 (not in any BIOS) */
+ 0xc0,0x83,0xbf,0xbf,0xf2,0x10,0x00,0x07,
+ 0x01}} /* 0x45 */
};
typedef struct _SiS300_MCLKDataStruct
@@ -788,7 +913,7 @@ typedef struct _SiS300_MCLKDataStruct
USHORT CLOCK;
} SiS300_MCLKDataStruct;
-SiS300_MCLKDataStruct SiS300_MCLKData[]=
+static const SiS300_MCLKDataStruct SiS300_MCLKData_630[] = /* 630 */
{ /* TW: at 0x54 in BIOS */
{ 0x5a,0x64,0x80, 66},
{ 0xb3,0x45,0x80, 83},
@@ -800,13 +925,25 @@ SiS300_MCLKDataStruct SiS300_MCLKData[]=
{ 0x37,0x61,0x80,100}
};
+static const SiS300_MCLKDataStruct SiS300_MCLKData_300[] = /* 300 */
+{ /* TW: at 0x54 in BIOS */
+ { 0x68,0x43,0x80,125},
+ { 0x68,0x43,0x80,125},
+ { 0x68,0x43,0x80,125},
+ { 0x37,0x61,0x80,100},
+ { 0x37,0x61,0x80,100},
+ { 0x37,0x61,0x80,100},
+ { 0x37,0x61,0x80,100},
+ { 0x37,0x61,0x80,100}
+};
+
typedef struct _SiS300_ECLKDataStruct
{
UCHAR SR2E,SR2F,SR30;
USHORT CLOCK;
} SiS300_ECLKDataStruct;
-SiS300_ECLKDataStruct SiS300_ECLKData[]=
+static const SiS300_ECLKDataStruct SiS300_ECLKData[] =
{
{ 0x54,0x43,0x80,100},
{ 0x53,0x43,0x80,100},
@@ -824,68 +961,79 @@ typedef struct _SiS300_VCLKDataStruct
USHORT CLOCK;
} SiS300_VCLKDataStruct;
-SiS300_VCLKDataStruct SiS300_VCLKData[]=
+static const SiS300_VCLKDataStruct SiS300_VCLKData[] =
{
- { 0x1b,0xe1, 25},
+ { 0x1b,0xe1, 25}, /* 0x00 */
{ 0x4e,0xe4, 28},
- { 0x57,0xe4, 32},
+ { 0x57,0xe4, 32}, /* 0x02 */
{ 0xc3,0xc8, 36},
- { 0x42,0xc3, 40},
+ { 0x42,0xc3, 40}, /* 0x04 */
{ 0x5d,0xc4, 45},
- { 0x52,0x65, 50},
+ { 0x52,0x65, 50}, /* 0x06 */
{ 0x53,0x65, 50},
- { 0x6d,0x66, 56},
+ { 0x6d,0x66, 56}, /* 0x08 */
{ 0x5a,0x64, 65},
- { 0x46,0x44, 68},
+ { 0x46,0x44, 68}, /* 0x0a */
{ 0x3e,0x43, 75},
- { 0x6d,0x46, 76}, /* 0x0c: 800x600 | LVDS_2(CH), MITAC(CH); - LVDS2(CH), A901(301B): 0xb1,0x46, 76 */
+ { 0x6d,0x46, 76}, /* 0x0c: 800x600 | LVDS_2(CH), MITAC(CH); - 730, A901(301B): 0xb1,0x46, 76 */
{ 0x41,0x43, 79},
- { 0x31,0x42, 79},
+ { 0x31,0x42, 79}, /* 0x0e */
{ 0x46,0x25, 85},
{ 0x78,0x29, 87}, /* 0x10 */
{ 0x62,0x44, 95},
- { 0x2b,0x22,105},
+ { 0x2b,0x22,105}, /* 0x12 */
{ 0x49,0x24,106},
- { 0xc3,0x28,108},
+ { 0xc3,0x28,108}, /* 0x14 */
{ 0x3c,0x23,109},
- { 0xf7,0x2c,132},
+ { 0xf7,0x2c,132}, /* 0x16 */
{ 0xd4,0x28,136},
- { 0x41,0x05,158},
+ { 0x41,0x05,158}, /* 0x18 */
{ 0x43,0x05,162},
- { 0xe1,0x0f,175},
- { 0xfc,0x12,189},
- { 0xde,0x26,194},
+ { 0xe1,0x0f,175}, /* 0x1a */
+ { 0xfc,0x12,189}, /* 0x1b */
+ { 0xde,0x26,194}, /* 0x1c */
{ 0x54,0x05,203},
- { 0x3f,0x03,230},
+ { 0x3f,0x03,230}, /* 0x1e */
{ 0x30,0x02,234},
- { 0x24,0x01,266}, /* 0x20 */
- { 0x52,0x2a, 54}, /* 301 TV */
- { 0x52,0x6a, 27}, /* 301 TV */
- { 0x62,0x24, 70}, /* 301 TV */
- { 0x62,0x64, 70}, /* 301 TV */
- { 0xa8,0x4c, 30}, /* 301 TV */
- { 0x20,0x26, 33}, /* 301 TV */
+ { 0x24,0x01,266}, /* 0x20 */
+ { 0x52,0x2a, 54}, /* 301 TV */
+ { 0x52,0x6a, 27}, /* 301 TV */
+ { 0x62,0x24, 70}, /* 301 TV */
+ { 0x62,0x64, 70}, /* 301 TV */
+ { 0xa8,0x4c, 30}, /* 301 TV */
+ { 0x20,0x26, 33}, /* 301 TV */
{ 0x31,0xc2, 39},
- { 0xbf,0xc8, 35}, /* 0x28 */
- { 0x60,0x36, 30}, /* 0x29 CH/UNTSC TEXT | LVDS_2(CH) - LVDS2(CH), A901(301B), Mitac(CH): 0xe0, 0xb6, 30 */
+ { 0xbf,0xc8, 35}, /* 0x28 - 856x480 */
+ { 0x60,0x36, 30}, /* 0x29 CH/UNTSC TEXT | LVDS_2(CH) - 730, A901(301B), Mitac(CH): 0xe0, 0xb6, 30 */
{ 0x40,0x4a, 28},
{ 0x9f,0x46, 44},
{ 0x97,0x2c, 26},
{ 0x44,0xe4, 25},
{ 0x7e,0x32, 47},
- { 0x8a,0x24, 31}, /* 0x2f CH/PAL TEXT | LVDS_2(CH), Mitac(CH) - LVDS2(CH), A901(301B): 0x57, 0xe4, 31 */
+ { 0x8a,0x24, 31}, /* 0x2f CH/PAL TEXT | LVDS_2(CH), Mitac(CH) - 730, A901(301B): 0x57, 0xe4, 31 */
{ 0x97,0x2c, 26},
{ 0xce,0x3c, 39},
- { 0x52,0x4a, 36},
+ { 0x52,0x4a, 36}, /* 0x32 CH/PAL 800x600 5/6 */
{ 0x34,0x61, 95},
{ 0x78,0x27,108},
- { 0xce,0x25,189},
- { 0x45,0x6b, 21}, /* 0x36 */ /* TW: Added from Mitac */
- { 0xff,0x00, 0}
+ { 0xce,0x25,189}, /* 0x35 */
+ { 0x45,0x6b, 21}, /* 0x36 */ /* TW: Added from Mitac */
+ { 0x52,0xe2, 49}, /* 0x37 - added for 16:9 modes (not in any BIOS) */
+ { 0x2b,0x61, 78}, /* 0x38 - added for 16:9 modes (not in any BIOS) */
+ { 0x70,0x44,108}, /* 0x39 - added for 16:9 modes (not in any BIOS) */
+ { 0x54,0x42,135}, /* 0x3a - added for 16:9 modes (not in any BIOS) */
+ { 0x41,0x22,157}, /* 0x3b - added for 16:9 modes (not in any BIOS) */
+ { 0x52,0x07,149}, /* 0x3c - added for 1280x960-85 (not in any BIOS)*/
+ { 0x62,0xc6, 34}, /* 0x3d - added for 848x480-60 (not in any BIOS) */
+ { 0x30,0x23, 88}, /* 0x3e - added for 1360x768-60 (not in any BIOS)*/
+ { 0x3f,0x64, 46}, /* 0x3f - added for 640x480-100 (not in any BIOS)*/
+ { 0x72,0x2a, 76}, /* 0x40 - test for SiS730 */
+ { 0x15,0x21, 79}, /* 0x41 - test for SiS730 */
+ { 0xff,0x00, 0}
};
#if 0 /* TW: This table is in all BIOSes, but not used */
-SiS300_VCLKDataStruct SiS300_VBVCLKData[]=
+static const SiS300_VCLKDataStruct SiS300_VBVCLKData[] =
{
{ 0x1b,0xe1, 25},
{ 0x4e,0xe4, 28},
@@ -938,10 +1086,11 @@ SiS300_VCLKDataStruct SiS300_VBVCLKData[]=
};
#endif
-UCHAR SiS300_ScreenOffset[] =
+static const UCHAR SiS300_ScreenOffset[] =
{
0x14,0x19,0x20,0x28,0x32,0x40,0x50,
- 0x64,0x78,0x80,0x2d,0x35,0x48,0xff
+ 0x64,0x78,0x80,0x2d,0x35,0x48,0x35, /* 0x35 for 848 and 856 */
+ 0x55,0xff /* 0x55 for 1360 */
};
typedef struct _SiS300_StResInfoStruct
@@ -950,7 +1099,7 @@ typedef struct _SiS300_StResInfoStruct
USHORT VTotal;
} SiS300_StResInfoStruct;
-SiS300_StResInfoStruct SiS300_StResInfo[] =
+static const SiS300_StResInfoStruct SiS300_StResInfo[] =
{
{ 640,400},
{ 640,350},
@@ -967,7 +1116,7 @@ typedef struct _SiS300_ModeResInfoStruct
UCHAR YChar;
} SiS300_ModeResInfoStruct;
-SiS300_ModeResInfoStruct SiS300_ModeResInfo[] =
+static const SiS300_ModeResInfoStruct SiS300_ModeResInfo[] =
{
{ 320, 200, 8, 8}, /* 0x00 */
{ 320, 240, 8, 8}, /* 0x01 */
@@ -985,62 +1134,81 @@ SiS300_ModeResInfoStruct SiS300_ModeResInfo[] =
{ 720, 576, 8,16}, /* 0x0d */
{ 1280, 960, 8,16}, /* 0x0e */
{ 1024, 600, 8,16}, /* 0x0f */
- { 1152, 768, 8,16} /* 0x10 */
-};
-
-UCHAR SiS300_OutputSelect =0x40;
-UCHAR SiS300_SoftSetting = 30;
-UCHAR SiS300_SR07=0x10;
-UCHAR SiS300_SR15[8][4] =
-{
- {0x1,0x9,0xa3,0x0},
- {0x43,0x43,0x43,0x0},
- {0x1e,0x1e,0x1e,0x0},
- {0x2a,0x2a,0x2a,0x0},
- {0x6,0x6,0x6,0x0},
- {0x0,0x0,0x0,0x0},
- {0x0,0x0,0x0,0x0},
- {0x0,0x0,0x0,0x0}
-};
-UCHAR SiS300_SR1F=0x0;
-UCHAR SiS300_SR21=0x16;
-UCHAR SiS300_SR22=0xb2;
-UCHAR SiS300_SR23=0xf6;
-UCHAR SiS300_SR24=0xd;
-UCHAR SiS300_SR25[]={0x0,0x0};
-UCHAR SiS300_SR31=0x0;
-UCHAR SiS300_SR32=0x11;
-UCHAR SiS300_SR33=0x0;
-UCHAR SiS300_CRT2Data_1_2 = 0x40;
-UCHAR SiS300_CRT2Data_4_D = 0x0;
-UCHAR SiS300_CRT2Data_4_E = 0x0;
-UCHAR SiS300_CRT2Data_4_10 = 0x80;
-USHORT SiS300_RGBSenseData = 0xd1;
-USHORT SiS300_VideoSenseData = 0xb3;
-USHORT SiS300_YCSenseData = 0xb9;
-USHORT SiS300_RGBSenseData2 = 0x0190; /*301b*/
-USHORT SiS300_VideoSenseData2 = 0x0174;
-USHORT SiS300_YCSenseData2 = 0x016b;
-
-UCHAR SiS300_CR40[5][4];
-UCHAR SiS300_CR49[2];
-UCHAR SiS300_NTSCPhase[] = {0x21,0xed,0x8a,0x08};
-UCHAR SiS300_PALPhase[] = {0x2a,0x05,0xd3,0x00};
-UCHAR SiS300_NTSCPhase2[] = {0x21,0xF0,0x7B,0xD6}; /* 301b */
-UCHAR SiS300_PALPhase2[] = {0x2a,0x09,0x86,0xe9}; /* 301b */
-UCHAR SiS300_PALMPhase[] = {0x21,0xE4,0x2E,0x9B}; /* palmn */
-UCHAR SiS300_PALNPhase[] = {0x21,0xF4,0x3E,0xBA};
-UCHAR SiS300_PALMPhase2[] = {0x21,0xE6,0xEF,0xA4}; /* TW: palm 301b*/
-UCHAR SiS300_PALNPhase2[] = {0x21,0xF6,0x94,0x46}; /* TW: paln 301b*/
+ { 1152, 768, 8,16}, /* 0x10 */
+ { 2048,1536, 8,16}, /* 0x11 - TW: Not in BIOS! */
+ { 800, 480, 8,16}, /* 0x12 - TW: New, not in any BIOS */
+ { 1024, 576, 8,16}, /* 0x13 - TW: New, not in any BIOS */
+ { 1280, 720, 8,16}, /* 0x14 - TW: New, not in any BIOS */
+ { 1152, 864, 8,16}, /* 0x15 - TW: New, not in any BIOS */
+ { 848, 480, 8,16}, /* 0x16 - TW: New, not in any BIOS */
+ { 856, 480, 8,16}, /* 0x17 - TW: New, not in any BIOS */
+ { 1360, 768, 8,16} /* 0x18 - TW: New, not in any BIOS */
+};
+
+static const UCHAR SiS300_OutputSelect = 0x40;
+
+static const UCHAR SiS300_SoftSetting = 0x30;
+
+#ifndef LINUX_XF86
+static UCHAR SiS300_SR07 = 0x10;
+#endif
+
+static const UCHAR SiS300_SR15[8][4] =
+{
+ {0x01,0x09,0xa3,0x00},
+ {0x43,0x43,0x43,0x00},
+ {0x1e,0x1e,0x1e,0x00},
+ {0x2a,0x2a,0x2a,0x00},
+ {0x06,0x06,0x06,0x00},
+ {0x00,0x00,0x00,0x00},
+ {0x00,0x00,0x00,0x00},
+ {0x00,0x00,0x00,0x00}
+};
+
+#ifndef LINUX_XF86
+static UCHAR SiS300_SR1F = 0x00;
+static UCHAR SiS300_SR21 = 0x16;
+static UCHAR SiS300_SR22 = 0xb2;
+static UCHAR SiS300_SR23 = 0xf6;
+static UCHAR SiS300_SR24 = 0x0d;
+static UCHAR SiS300_SR25[] = {0x0,0x0};
+static UCHAR SiS300_SR31 = 0x00;
+static UCHAR SiS300_SR32 = 0x11;
+static UCHAR SiS300_SR33 = 0x00;
+static UCHAR SiS300_CRT2Data_1_2 = 0x40;
+static UCHAR SiS300_CRT2Data_4_D = 0x00;
+static UCHAR SiS300_CRT2Data_4_E = 0x00;
+static UCHAR SiS300_CRT2Data_4_10 = 0x80;
+
+static const USHORT SiS300_RGBSenseData = 0xd1;
+static const USHORT SiS300_VideoSenseData = 0xb3;
+static const USHORT SiS300_YCSenseData = 0xb9;
+static const USHORT SiS300_RGBSenseData2 = 0x0190; /*301b*/
+static const USHORT SiS300_VideoSenseData2 = 0x0174;
+static const USHORT SiS300_YCSenseData2 = 0x016b;
+
+static const UCHAR SiS300_CR40[5][4];
+
+static UCHAR SiS300_CR49[2];
+#endif
+
+static const UCHAR SiS300_NTSCPhase[] = {0x21,0xed,0xba,0x08}; /* TW: Was {0x21,0xed,0x8a,0x08}; */
+static const UCHAR SiS300_PALPhase[] = {0x2a,0x05,0xe3,0x00}; /* TW: Was {0x2a,0x05,0xd3,0x00}; */
+static const UCHAR SiS300_PALMPhase[] = {0x21,0xE4,0x2E,0x9B}; /* palmn */
+static const UCHAR SiS300_PALNPhase[] = {0x21,0xF4,0x3E,0xBA};
+static const UCHAR SiS300_NTSCPhase2[] = {0x21,0xF0,0x7B,0xD6}; /* 301b */
+static const UCHAR SiS300_PALPhase2[] = {0x2a,0x09,0x86,0xe9}; /* 301b */
+static const UCHAR SiS300_PALMPhase2[] = {0x21,0xE6,0xEF,0xA4}; /* TW: palm 301b*/
+static const UCHAR SiS300_PALNPhase2[] = {0x21,0xF6,0x94,0x46}; /* TW: paln 301b*/
typedef struct _SiS300_PanelDelayTblStruct
{
UCHAR timer[2];
} SiS300_PanelDelayTblStruct;
-SiS300_PanelDelayTblStruct SiS300_PanelDelayTbl[] =
+static const SiS300_PanelDelayTblStruct SiS300_PanelDelayTbl[] =
{
- {{0x05,0xaa}},
+ {{0x05,0xaa}}, /* TW: From 2.04.5a */
{{0x05,0x14}},
{{0x05,0x36}},
{{0x05,0x14}},
@@ -1052,13 +1220,13 @@ SiS300_PanelDelayTblStruct SiS300_PanelDelayTbl[] =
{{0x05,0x14}},
{{0x05,0x14}},
{{0x05,0x14}},
- {{0x05,0x64}},
- {{0x05,0x14}},
+ {{0x20,0x80}},
{{0x05,0x14}},
- {{0x05,0x14}}
+ {{0x05,0x40}},
+ {{0x05,0x60}}
};
-SiS300_PanelDelayTblStruct SiS300_PanelDelayTblLVDS[] =
+static const SiS300_PanelDelayTblStruct SiS300_PanelDelayTblLVDS[] =
{
{{0x05,0xaa}},
{{0x05,0x14}},
@@ -1071,7 +1239,7 @@ SiS300_PanelDelayTblStruct SiS300_PanelDelayTblLVDS[] =
{{0x05,0x14}},
{{0x05,0x14}},
{{0x05,0x14}},
- {{0x05,0x14}},
+ {{0x05,0x14}}, /* 2.07a (JVC): 14,96 */
{{0x05,0x28}}, /* 2.04.5c: 20, 80 - Clevo (2.04.2c): 05, 28 */
{{0x05,0x14}},
{{0x05,0x14}}, /* Some BIOSes: 05, 40 */
@@ -1088,7 +1256,7 @@ typedef struct _SiS300_LCDDataStruct
USHORT LCDVT;
} SiS300_LCDDataStruct;
-SiS300_LCDDataStruct SiS300_StLCD1024x768Data[]=
+static const SiS300_LCDDataStruct SiS300_StLCD1024x768Data[] =
{
{ 66, 31, 992, 510,1320, 816},
{ 66, 31, 992, 510,1320, 816},
@@ -1099,7 +1267,7 @@ SiS300_LCDDataStruct SiS300_StLCD1024x768Data[]=
{ 1, 1,1344, 806,1344, 806}
};
-SiS300_LCDDataStruct SiS300_ExtLCD1024x768Data[]=
+static const SiS300_LCDDataStruct SiS300_ExtLCD1024x768Data[] =
{
{ 12, 5, 896, 512,1344, 806},
{ 12, 5, 896, 510,1344, 806},
@@ -1116,7 +1284,7 @@ SiS300_LCDDataStruct SiS300_ExtLCD1024x768Data[]=
{ 1, 1,1344, 806,1344, 806}
};
-SiS300_LCDDataStruct SiS300_St2LCD1024x768Data[]=
+static const SiS300_LCDDataStruct SiS300_St2LCD1024x768Data[] =
{
{ 62, 25, 800, 546,1344, 806},
{ 32, 15, 930, 546,1344, 806},
@@ -1127,7 +1295,7 @@ SiS300_LCDDataStruct SiS300_St2LCD1024x768Data[]=
{ 1, 1,1344, 806,1344, 806}
};
-SiS300_LCDDataStruct SiS300_StLCD1280x1024Data[]=
+static const SiS300_LCDDataStruct SiS300_StLCD1280x1024Data[] =
{
{ 4, 1, 880, 510,1650,1088},
{ 4, 1, 880, 510,1650,1088},
@@ -1139,7 +1307,7 @@ SiS300_LCDDataStruct SiS300_StLCD1280x1024Data[]=
{ 1, 1,1688,1066,1688,1066}
};
-SiS300_LCDDataStruct SiS300_ExtLCD1280x1024Data[]=
+static const SiS300_LCDDataStruct SiS300_ExtLCD1280x1024Data[] =
{
{ 211, 60,1024, 501,1688,1066},
{ 211, 60,1024, 508,1688,1066},
@@ -1151,7 +1319,7 @@ SiS300_LCDDataStruct SiS300_ExtLCD1280x1024Data[]=
{ 1, 1,1688,1066,1688,1066}
};
-SiS300_LCDDataStruct SiS300_St2LCD1280x1024Data[]=
+static const SiS300_LCDDataStruct SiS300_St2LCD1280x1024Data[] =
{
{ 22, 5, 800, 510,1650,1088},
{ 22, 5, 800, 510,1650,1088},
@@ -1163,7 +1331,7 @@ SiS300_LCDDataStruct SiS300_St2LCD1280x1024Data[]=
{ 1, 1,1688,1066,1688,1066}
};
-SiS300_LCDDataStruct SiS300_NoScaleData1024x768[]=
+static const SiS300_LCDDataStruct SiS300_NoScaleData1024x768[] =
{
{ 1, 1, 800, 449, 800, 449},
{ 1, 1, 800, 449, 800, 449},
@@ -1175,7 +1343,7 @@ SiS300_LCDDataStruct SiS300_NoScaleData1024x768[]=
{ 1, 1,1688,1066,1688,1066}
};
-SiS300_LCDDataStruct SiS300_NoScaleData1280x1024[]= /* TW: Fake */
+static const SiS300_LCDDataStruct SiS300_NoScaleData1280x1024[] = /* TW: Fake */
{
{ 1, 1, 800, 449, 800, 449},
{ 1, 1, 800, 449, 800, 449},
@@ -1187,7 +1355,7 @@ SiS300_LCDDataStruct SiS300_NoScaleData1280x1024[]= /* TW: Fake */
{ 1, 1,1688,1066,1688,1066}
};
-SiS300_LCDDataStruct SiS300_LCD1280x960Data[]=
+static const SiS300_LCDDataStruct SiS300_LCD1280x960Data[] =
{
{ 9, 2, 800, 500,1800,1000},
{ 9, 2, 800, 500,1800,1000},
@@ -1200,6 +1368,91 @@ SiS300_LCDDataStruct SiS300_LCD1280x960Data[]=
{ 1, 1,1800,1000,1800,1000}
};
+static const SiS300_LCDDataStruct SiS300_ExtLCD1400x1050Data[] = /* TW: New */
+{
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0}
+};
+
+static const SiS300_LCDDataStruct SiS300_ExtLCD1600x1200Data[] = /* TW: New */
+{
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0}
+};
+
+static const SiS300_LCDDataStruct SiS300_StLCD1400x1050Data[] = /* TW: New */
+{
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0}
+};
+
+static const SiS300_LCDDataStruct SiS300_StLCD1600x1200Data[] = /* TW: New */
+{
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0}
+};
+
+static const SiS300_LCDDataStruct SiS300_NoScaleData1400x1050[] = /* TW: New */
+{
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0}
+};
+
+static const SiS300_LCDDataStruct SiS300_NoScaleData1600x1200[] = /* TW: New */
+{
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0}
+};
+
+
typedef struct _SiS300_TVDataStruct
{
USHORT RVBHCMAX;
@@ -1217,7 +1470,7 @@ typedef struct _SiS300_TVDataStruct
UCHAR RY4COE;
} SiS300_TVDataStruct;
-SiS300_TVDataStruct SiS300_StPALData[]=
+static const SiS300_TVDataStruct SiS300_StPALData[] =
{
{ 1, 1, 864, 525,1270, 400, 100, 0, 760,0xf4,0xff,0x1c,0x22},
{ 1, 1, 864, 525,1270, 350, 100, 0, 760,0xf4,0xff,0x1c,0x22},
@@ -1227,7 +1480,7 @@ SiS300_TVDataStruct SiS300_StPALData[]=
{ 1, 1, 864, 525,1270, 600, 50, 0, 0,0xf4,0xff,0x1c,0x22}
};
-SiS300_TVDataStruct SiS300_ExtPALData[]=
+static const SiS300_TVDataStruct SiS300_ExtPALData[] =
{
{ 27, 10, 848, 448,1270, 530, 50, 0, 50,0xf4,0xff,0x1c,0x22},
{ 108, 35, 848, 398,1270, 530, 50, 0, 50,0xf4,0xff,0x1c,0x22},
@@ -1236,11 +1489,11 @@ SiS300_TVDataStruct SiS300_ExtPALData[]=
{ 9, 4, 848, 528,1270, 530, 0, 0, 50,0xf5,0xfb,0x1b,0x2a},
{ 36, 25,1060, 648,1316, 530, 438, 0, 438,0xeb,0x05,0x25,0x16},
{ 3, 2,1080, 619,1270, 540, 438, 0, 438,0xf3,0x00,0x1d,0x20},
- { 1, 1,1170, 821,1270, 520, 686, 0, 686,0xF3,0x00,0x1D,0x20} /*301b*/
+ { 1, 1,1170, 821,1270, 520, 686, 0, 686,0xF3,0x00,0x1D,0x20}
};
-SiS300_TVDataStruct SiS300_StNTSCData[]=
+static const SiS300_TVDataStruct SiS300_StNTSCData[] =
{
{ 1, 1, 858, 525,1270, 400, 50, 0, 760,0xf1,0x04,0x1f,0x18},
{ 1, 1, 858, 525,1270, 350, 50, 0, 640,0xf1,0x04,0x1f,0x18},
@@ -1249,7 +1502,7 @@ SiS300_TVDataStruct SiS300_StNTSCData[]=
{ 1, 1, 858, 525,1270, 480, 0, 0, 760,0xf1,0x04,0x1f,0x18}
};
-SiS300_TVDataStruct SiS300_ExtNTSCData[]=
+static const SiS300_TVDataStruct SiS300_ExtNTSCData[] =
{
{ 143, 65, 858, 443,1270, 440, 171, 0, 171,0xf1,0x04,0x1f,0x18},
{ 88, 35, 858, 393,1270, 440, 171, 0, 171,0xf1,0x04,0x1f,0x18},
@@ -1258,59 +1511,152 @@ SiS300_TVDataStruct SiS300_ExtNTSCData[]=
{ 143, 76, 836, 523,1270, 440, 224, 0, 0,0xf1,0x05,0x1f,0x16},
{ 143, 120,1056, 643,1270, 440, 0, 128, 0,0xf4,0x10,0x1c,0x00},
{ 143, 76, 836, 523,1270, 440, 0, 128, 0,0xee,0x0c,0x22,0x08},
- { 65, 64,1056, 791,1270, 480, 638, 0, 0,0xf1,0x04,0x1f,0x18} /*301b*/
+ { 65, 64,1056, 791,1270, 480, 638, 0, 0,0xf1,0x04,0x1f,0x18}
};
-SiS_TVDataStruct SiS300_St1HiTVData[]=
+#if 0
+static const SiS310_TVDataStruct SiS300_St1HiTVData[]=
{
- {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
+
};
+#endif
-SiS_TVDataStruct SiS300_St2HiTVData[]=
+static const SiS300_TVDataStruct SiS300_St2HiTVData[]=
{
- {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
+ { 3, 1, 0x348,0x1e3,0x670,0x3c0,0x032, 0, 0, 0x00,0x00,0x00,0x00},
+ { 1, 1, 0x37c,0x233,0x2b2,0x2bc, 0, 0, 0, 0x00,0x00,0x00,0x00},
+ { 3, 1, 0x348,0x1e3,0x670,0x3c0,0x032, 0, 0, 0x00,0x00,0x00,0x00},
+ { 1, 1, 0x3e8,0x233,0x311,0x2bc, 0, 0, 0, 0x00,0x00,0x00,0x00},
+ { 5, 2, 0x348,0x233,0x670,0x3c0,0x08d,128, 0, 0x00,0x00,0x00,0x00},
+ { 8, 5, 0x41a,0x2ab,0x670,0x3c0,0x17c,128, 0, 0x00,0x00,0x00,0x00}
};
-SiS_TVDataStruct SiS300_ExtHiTVData[]=
+static const SiS300_TVDataStruct SiS300_ExtHiTVData[]=
{
- {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
+ { 6, 1, 0x348,0x233,0x660,0x3c0, 0, 0, 0, 0x00,0x00,0x00,0x00},
+ { 3, 1, 0x3c0,0x233,0x660,0x3c0, 0, 0, 0, 0x00,0x00,0x00,0x00},
+ { 3, 1, 0x348,0x1e3,0x660,0x3c0, 0, 0, 0, 0x00,0x00,0x00,0x00},
+ { 3, 1, 0x3c0,0x233,0x660,0x3c0, 0, 0, 0, 0x00,0x00,0x00,0x00},
+ { 5, 1, 0x348,0x233,0x670,0x3c0,0x166,128, 0, 0x00,0x00,0x00,0x00},
+ { 16, 5, 0x41a,0x2ab,0x670,0x3c0,0x143,128, 0, 0x00,0x00,0x00,0x00},
+ { 25, 12, 0x4ec,0x353,0x670,0x3c0,0x032, 0, 0, 0x00,0x00,0x00,0x00},
+ { 5, 4, 0x627,0x464,0x670,0x3c0,0x128, 0, 0, 0x00,0x00,0x00,0x00},
+ { 4, 1, 0x41a,0x233,0x670,0x3c0,0x143,128, 0, 0x00,0x00,0x00,0x00},
+ { 5, 2, 0x578,0x293,0x670,0x3c0,0x032, 0, 0, 0x00,0x00,0x00,0x00},
+ { 8, 5, 0x6d6,0x323,0x670,0x3c0,0x128, 0, 0, 0x00,0x00,0x00,0x00}
};
-UCHAR SiS300_NTSCTiming[] = {
+static const UCHAR SiS300_NTSCTiming[] =
+{
0x17,0x1d,0x03,0x09,0x05,0x06,0x0c,0x0c,
0x94,0x49,0x01,0x0a,0x06,0x0d,0x04,0x0a,
0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x1b,
- 0x0c,0x50,0x00,0x97,0x00,0xda,0x4a,0x17,
- 0x7d,0x05,0x4b,0x00,0x00,0xe2,0x00,0x02,
+ 0x0c,0x50,0x00,0x97,0x00,0xda,0x4a,0x17, /* (in 2.06.50) */
+/* 0x0c,0x50,0x00,0x99,0x00,0xec,0x4a,0x17, (in 2.04.5a) */
+ 0x7d,0x05,0x4b,0x00,0x00,0xe2,0x00,0x02, /* (in 2.06.50) */
+/* 0x88,0x00,0x4b,0x00,0x00,0xe2,0x00,0x02, (in 2.04.5a) */
0x03,0x0a,0x65,0x9d,0x08,0x92,0x8f,0x40,
0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x50,
0x00,0x40,0x44,0x00,0xdb,0x02,0x3b,0x00
};
-UCHAR SiS300_PALTiming[] = {
+static const UCHAR SiS300_PALTiming[] =
+{
0x19,0x52,0x35,0x6e,0x04,0x38,0x3d,0x70,
0x94,0x49,0x01,0x12,0x06,0x3e,0x35,0x6d,
0x06,0x14,0x3e,0x35,0x6d,0x00,0x45,0x2b,
- 0x70,0x50,0x00,0x9b,0x00,0xd9,0x5d,0x17,
- 0x7d,0x05,0x45,0x00,0x00,0xe8,0x00,0x02,
+ 0x70,0x50,0x00,0x9b,0x00,0xd9,0x5d,0x17, /* (in 2.06.50) */
+/* 0x70,0x50,0x00,0x97,0x00,0xd7,0x5d,0x17, (in 2.04.5a) */
+ 0x7d,0x05,0x45,0x00,0x00,0xe8,0x00,0x02, /* (in 2.06.50) */
+/* 0x88,0x00,0x45,0x00,0x00,0xe8,0x00,0x02, (in 2.04.5a) */
0x0d,0x00,0x68,0xb0,0x0b,0x92,0x8f,0x40,
0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x63,
0x00,0x40,0x3e,0x00,0xe1,0x02,0x28,0x00
};
-UCHAR SiS300_HiTVExtTiming[] = {0x00};
+static const UCHAR SiS300_HiTVExtTiming[] = /* TW: New */
+{
+ 0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x64,
+ 0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d,
+ 0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f,
+ 0x64,0x90,0x33,0x8c,0x18,0x36,0x3e,0x13,
+ 0x2a,0xde,0x2a,0x44,0x40,0x2a,0x44,0x40,
+ 0x8e,0x8e,0x82,0x07,0x0b,0x92,0x0f,0x40,
+ 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x3d,
+ 0x63,0x4f,0x27,0x00,0xfc,0xff,0x6a,0x00
+};
-UCHAR SiS300_HiTVSt1Timing[] = {0x00};
+static const UCHAR SiS300_HiTVSt1Timing[] = /* TW: New */
+{
+ 0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x65,
+ 0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d,
+ 0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f,
+ 0x65,0x90,0x7b,0xa8,0x03,0xf0,0x87,0x03,
+ 0x11,0x15,0x11,0xcf,0x10,0x11,0xcf,0x10,
+ 0x35,0x35,0x3b,0x69,0x1d,0x92,0x0f,0x40,
+ 0x60,0x80,0x14,0x90,0x8c,0x60,0x04,0x86,
+ 0xaf,0x5d,0x0e,0x00,0xfc,0xff,0x2d,0x00
+};
-UCHAR SiS300_HiTVSt2Timing[] = {0x00};
+static const UCHAR SiS300_HiTVSt2Timing[] = /* TW: New */
+{
+ 0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x64,
+ 0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d,
+ 0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f,
+ 0x64,0x90,0x33,0x8c,0x18,0x36,0x3e,0x13,
+ 0x2a,0xde,0x2a,0x44,0x40,0x2a,0x44,0x40,
+ 0x8e,0x8e,0x82,0x07,0x0b,0x92,0x0f,0x40,
+ 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x3d,
+ 0x63,0x4f,0x27,0x00,0xfc,0xff,0x6a,0x00
+};
-UCHAR SiS300_HiTVTextTiming[] = {0x00};
+static const UCHAR SiS300_HiTVTextTiming[] = /* TW: New */
+{
+ 0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x65,
+ 0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d,
+ 0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f,
+ 0x65,0x90,0xe7,0xbc,0x03,0x0c,0x97,0x03,
+ 0x14,0x78,0x14,0x08,0x20,0x14,0x08,0x20,
+ 0xc8,0xc8,0x3b,0xd2,0x26,0x92,0x0f,0x40,
+ 0x60,0x80,0x14,0x90,0x8c,0x60,0x04,0x96,
+ 0x72,0x5c,0x11,0x00,0xfc,0xff,0x32,0x00
+};
-UCHAR SiS300_HiTVGroup3Data[] = {0x00};
+static const UCHAR SiS300_HiTVGroup3Data[] = /* TW: New */
+{
+ 0x00,0x1a,0x22,0x63,0x62,0x22,0x08,0x5f,
+ 0x05,0x21,0xb2,0xb2,0x55,0x77,0x2a,0xa6,
+ 0x25,0x2f,0x47,0xfa,0xc8,0xff,0x8e,0x20,
+ 0x8c,0x6e,0x60,0x2e,0x58,0x48,0x72,0x44,
+ 0x56,0x36,0x4f,0x6e,0x3f,0x80,0x00,0x80,
+ 0x4f,0x7f,0x03,0xa8,0x7d,0x20,0x1a,0xa9,
+ 0x14,0x05,0x03,0x7e,0x64,0x31,0x14,0x75,
+ 0x18,0x05,0x18,0x05,0x4c,0xa8,0x01
+};
-UCHAR SiS300_HiTVGroup3Simu[] = {0x00};
+static const UCHAR SiS300_HiTVGroup3Simu[] = /* TW: New */
+{
+ 0x00,0x1a,0x22,0x63,0x62,0x22,0x08,0x95,
+ 0xdb,0x20,0xb8,0xb8,0x55,0x47,0x2a,0xa6,
+ 0x25,0x2f,0x47,0xfa,0xc8,0xff,0x8e,0x20,
+ 0x8c,0x6e,0x60,0x15,0x26,0xd3,0xe4,0x11,
+ 0x56,0x36,0x4f,0x6e,0x3f,0x80,0x00,0x80,
+ 0x67,0x36,0x01,0x47,0x0e,0x10,0xbe,0xb4,
+ 0x01,0x05,0x03,0x7e,0x65,0x31,0x14,0x75,
+ 0x18,0x05,0x18,0x05,0x4c,0xa8,0x01
+};
-UCHAR SiS300_HiTVGroup3Text[] = {0x00};
+static const UCHAR SiS300_HiTVGroup3Text[] = /* TW: New */
+{
+ 0x00,0x1a,0x22,0x63,0x62,0x22,0x08,0xa7,
+ 0xf5,0x20,0xce,0xce,0x55,0x47,0x2a,0xa6,
+ 0x25,0x2f,0x47,0xfa,0xc8,0xff,0x8e,0x20,
+ 0x8c,0x6e,0x60,0x18,0x2c,0x0c,0x20,0x22,
+ 0x56,0x36,0x4f,0x6e,0x3f,0x80,0x00,0x80,
+ 0x93,0x3c,0x01,0x50,0x2f,0x10,0xf4,0xca,
+ 0x01,0x05,0x03,0x7e,0x65,0x31,0x14,0x75,
+ 0x18,0x05,0x18,0x05,0x4c,0xa8,0x01
+};
typedef struct _SiS300_LVDSDataStruct
{
@@ -1320,7 +1666,20 @@ typedef struct _SiS300_LVDSDataStruct
USHORT LCDVT;
} SiS300_LVDSDataStruct;
-SiS300_LVDSDataStruct SiS300_LVDS800x600Data_1[]=
+static const SiS300_LVDSDataStruct SiS300_LVDS320x480Data_1[] =
+{
+ {848, 433,400, 525},
+ {848, 389,400, 525},
+ {848, 433,400, 525},
+ {848, 389,400, 525},
+ {848, 518,400, 525},
+ {1056,628,400, 525},
+ {400, 525,400, 525},
+ {800, 449,1000, 644},
+ {800, 525,1000, 635}
+};
+
+static const SiS300_LVDSDataStruct SiS300_LVDS800x600Data_1[] =
{
{848, 433,1060, 629},
{848, 389,1060, 629},
@@ -1333,7 +1692,7 @@ SiS300_LVDSDataStruct SiS300_LVDS800x600Data_1[]=
{800, 525,1000, 635}
};
-SiS300_LVDSDataStruct SiS300_LVDS800x600Data_2[]=
+static const SiS300_LVDSDataStruct SiS300_LVDS800x600Data_2[] =
{
{1056, 628,1056, 628},
{1056, 628,1056, 628},
@@ -1346,7 +1705,7 @@ SiS300_LVDSDataStruct SiS300_LVDS800x600Data_2[]=
{800, 525,1000, 635}
};
-SiS300_LVDSDataStruct SiS300_LVDS1024x768Data_1[]=
+static const SiS300_LVDSDataStruct SiS300_LVDS1024x768Data_1[] =
{
{840, 438,1344, 806},
{840, 409,1344, 806},
@@ -1359,7 +1718,7 @@ SiS300_LVDSDataStruct SiS300_LVDS1024x768Data_1[]=
{800, 525,1280, 813}
};
-SiS300_LVDSDataStruct SiS300_LVDS1024x768Data_2[]=
+static const SiS300_LVDSDataStruct SiS300_LVDS1024x768Data_2[] =
{
{1344, 806,1344, 806},
{1344, 806,1344, 806},
@@ -1372,7 +1731,7 @@ SiS300_LVDSDataStruct SiS300_LVDS1024x768Data_2[]=
{800, 525,1280, 813}
};
-SiS300_LVDSDataStruct SiS300_LVDS1280x1024Data_1[]=
+static const SiS300_LVDSDataStruct SiS300_LVDS1280x1024Data_1[] =
{
{840, 438,1344, 806},
{840, 409,1344, 806},
@@ -1385,7 +1744,7 @@ SiS300_LVDSDataStruct SiS300_LVDS1280x1024Data_1[]=
{800, 525,1280, 813}
};
-SiS300_LVDSDataStruct SiS300_LVDS1280x1024Data_2[]=
+static const SiS300_LVDSDataStruct SiS300_LVDS1280x1024Data_2[] =
{
{1344, 806,1344, 806},
{1344, 806,1344, 806},
@@ -1398,21 +1757,60 @@ SiS300_LVDSDataStruct SiS300_LVDS1280x1024Data_2[]=
{800, 525,1280, 813}
};
-SiS300_LVDSDataStruct SiS300_LVDS640x480Data_1[]=
+static const SiS300_LVDSDataStruct SiS300_LVDS1400x1050Data_1[] = /* TW: New */
{
- {800, 449, 800, 449},
- {800, 449, 800, 449},
- {800, 449, 800, 449},
- {800, 449, 800, 449},
- {800, 525, 800, 525},
- {1056, 628,1056, 628},
- {1056, 628,1056, 628},
- {1056, 628,1056, 628},
- {1056, 628,1056, 628}
+ {928, 416, 1688, 1066},
+ {928, 366, 1688, 1066},
+ {928, 416, 1688, 1066},
+ {928, 366, 1688, 1066},
+ {928, 496, 1688, 1066},
+ {1088, 616, 1688, 1066},
+ {1312, 784, 1688, 1066},
+ {1568, 1040, 1688, 1066},
+ {1688, 1066, 1688, 1066}
+};
+
+static const SiS300_LVDSDataStruct SiS300_LVDS1400x1050Data_2[] = /* TW: New */
+{
+ {1688,1066, 1688,1066},
+ {1688,1066, 1688,1066},
+ {1688,1066, 1688,1066},
+ {1688,1066, 1688,1066},
+ {1688,1066, 1688,1066},
+ {1688,1066, 1688,1066},
+ {1688,1066, 1688,1066},
+ {1688,1066, 1688,1066},
+ {1688,1066, 1688,1066},
+};
+
+static const SiS300_LVDSDataStruct SiS300_LVDS1280x768Data_1[]= /* TW: New - TODO */
+{ /* TW: Temp data, invalid (is identical to 1024x768) */
+ {840, 438,1344, 806},
+ {840, 409,1344, 806},
+ {840, 438,1344, 806},
+ {840, 409,1344, 806},
+ {840, 518,1344, 806},
+ {1050, 638,1344, 806},
+ {1344, 806,1344, 806},
+ {800, 449,1280, 801},
+ {800, 525,1280, 813}
+};
+
+static const SiS300_LVDSDataStruct SiS300_LVDS1280x768Data_2[]= /* TW: New - TODO */
+{ /* TW: Temp data, invalid (is identical to 1024x768) */
+ {1344, 806,1344, 806},
+ {1344, 806,1344, 806},
+ {1344, 806,1344, 806},
+ {1344, 806,1344, 806},
+ {1344, 806,1344, 806},
+ {1344, 806,1344, 806},
+ {1344, 806,1344, 806},
+ {800, 449,1280, 801},
+ {800, 525,1280, 813}
};
/* TW: New: */
-SiS300_LVDSDataStruct SiS300_LVDS1024x600Data_1[]=
+static const SiS300_LVDSDataStruct SiS300_LVDS1024x600Data_1[] =
{
{840, 604,1344, 800},
{840, 560,1344, 800},
@@ -1421,12 +1819,40 @@ SiS300_LVDSDataStruct SiS300_LVDS1024x600Data_1[]=
{840, 689,1344, 800},
{1050, 800,1344, 800},
{1344, 800,1344, 800},
+ {800, 449,1280, 789},
+ {800, 525,1280, 785}
+};
+
+/* TW: New: */
+static const SiS300_LVDSDataStruct SiS300_LVDS1024x600Data_2[] =
+{
+ {1344, 800,1344, 800},
+ {1344, 800,1344, 800},
+ {1344, 800,1344, 800},
+ {1344, 800,1344, 800},
+ {1344, 800,1344, 800},
+ {1344, 800,1344, 800},
+ {1344, 800,1344, 800},
+ {800, 449,1280, 801},
+ {800, 525,1280, 813}
+};
+
+/* TW: New: */
+static const SiS300_LVDSDataStruct SiS300_LVDS1152x768Data_1[] =
+{
+ {840, 438,1344, 806},
+ {840, 409,1344, 806},
+ {840, 438,1344, 806},
+ {840, 409,1344, 806},
+ {840, 518,1344, 806},
+ {1050, 638,1344, 806},
+ {1344, 806,1344, 806},
{800, 449,1280, 801},
{800, 525,1280, 813}
};
/* TW: New: */
-SiS300_LVDSDataStruct SiS300_LVDS1024x600Data_2[]=
+static const SiS300_LVDSDataStruct SiS300_LVDS1152x768Data_2[] =
{
{1344, 806,1344, 806},
{1344, 806,1344, 806},
@@ -1439,8 +1865,33 @@ SiS300_LVDSDataStruct SiS300_LVDS1024x600Data_2[]=
{800, 525,1280, 813}
};
-/* TW: New: */
-SiS300_LVDSDataStruct SiS300_LVDS1152x768Data_1[]=
+/* TW: New in 650/LVDS BIOS - 1:1 */
+static const SiS300_LVDSDataStruct SiS300_LVDSXXXxXXXData_1[] = /* TW: New */
+{
+ { 800, 449, 800, 449},
+ { 800, 449, 800, 449},
+ { 900, 449, 900, 449},
+ { 900, 449, 900, 449},
+ { 800, 525, 800, 525},
+ {1056, 628,1056, 628},
+ {1344, 806,1344, 806},
+ {1688, 806,1688, 806} /* 1280x768 ! */
+};
+
+static const SiS300_LVDSDataStruct SiS300_LVDS640x480Data_1[] =
+{
+ {800, 449, 800, 449},
+ {800, 449, 800, 449},
+ {800, 449, 800, 449},
+ {800, 449, 800, 449},
+ {800, 525, 800, 525},
+ {1056, 628,1056, 628},
+ {1056, 628,1056, 628},
+ {1056, 628,1056, 628},
+ {1056, 628,1056, 628}
+};
+
+static const SiS300_LVDSDataStruct SiS300_LVDS1280x960Data_1[] = /* TW: New */
{
{840, 438,1344, 806},
{840, 409,1344, 806},
@@ -1453,22 +1904,77 @@ SiS300_LVDSDataStruct SiS300_LVDS1152x768Data_1[]=
{800, 525,1280, 813}
};
-/* TW: New: */
-SiS300_LVDSDataStruct SiS300_LVDS1152x768Data_2[]=
+static const SiS300_LVDSDataStruct SiS300_LVDS1280x960Data_2[] = /* TW: New */
{
- {840, 438,1344, 806},
- {840, 409,1344, 806},
- {840, 438,1344, 806},
- {840, 409,1344, 806},
- {840, 518,1344, 806},
- {1050, 638,1344, 806},
+ {1344, 806,1344, 806},
+ {1344, 806,1344, 806},
+ {1344, 806,1344, 806},
+ {1344, 806,1344, 806},
+ {1344, 806,1344, 806},
+ {1344, 806,1344, 806},
{1344, 806,1344, 806},
{800, 449,1280, 801},
{800, 525,1280, 813}
};
+static const SiS300_LVDSDataStruct SiS300_LCDA1400x1050Data_1[] = /* TW: New */
+{ /* TW: Might be temporary (invalid) data */
+ {928, 416, 1688, 1066},
+ {928, 366, 1688, 1066},
+ {1008, 416, 1688, 1066},
+ {1008, 366, 1688, 1066},
+ {1200, 530, 1688, 1066},
+ {1088, 616, 1688, 1066},
+ {1312, 784, 1688, 1066},
+ {1568, 1040, 1688, 1066},
+ {1688, 1066, 1688, 1066}
+};
+
+static const SiS300_LVDSDataStruct SiS300_LCDA1400x1050Data_2[] = /* TW: New */
+{ /* TW: Temporary data. Not valid */
+ {1344, 806,1344, 806},
+ {1344, 806,1344, 806},
+ {1344, 806,1344, 806},
+ {1344, 806,1344, 806},
+ {1344, 806,1344, 806},
+ {1344, 806,1344, 806},
+ {1344, 806,1344, 806},
+ {800, 449,1280, 801},
+ {800, 525,1280, 813}
+};
+
+static const SiS300_LVDSDataStruct SiS300_LCDA1600x1200Data_1[] = /* TW: New */
+{ /* TW: Temporary data. Not valid */
+ {1344, 806,1344, 806},
+ {1344, 806,1344, 806},
+ {1344, 806,1344, 806},
+ {1344, 806,1344, 806},
+ {1344, 806,1344, 806},
+ {1344, 806,1344, 806},
+ {1344, 806,1344, 806},
+ {800, 449,1280, 801},
+ {800, 525,1280, 813}
+};
+
+static const SiS300_LVDSDataStruct SiS300_LCDA1600x1200Data_2[] = /* TW: New */
+{ /* TW: Temporary data. Not valid */
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0}
+};
+
+
/* TW: New: */
-SiS300_LVDSDataStruct SiS300_CHTVUNTSCData[]=
+static const SiS300_LVDSDataStruct SiS300_CHTVUNTSCData[] =
{
{840, 600, 840, 600},
{840, 600, 840, 600},
@@ -1478,7 +1984,7 @@ SiS300_LVDSDataStruct SiS300_CHTVUNTSCData[]=
{1064, 750,1064, 750}
};
-SiS300_LVDSDataStruct SiS300_CHTVONTSCData[]=
+static const SiS300_LVDSDataStruct SiS300_CHTVONTSCData[] =
{
{840, 525, 840, 525},
{840, 525, 840, 525},
@@ -1488,7 +1994,7 @@ SiS300_LVDSDataStruct SiS300_CHTVONTSCData[]=
{1040, 700,1040, 700}
};
-SiS300_LVDSDataStruct SiS300_CHTVUPALData[]=
+static const SiS300_LVDSDataStruct SiS300_CHTVUPALData[] =
{
{1008, 625,1008, 625},
{1008, 625,1008, 625},
@@ -1498,7 +2004,7 @@ SiS300_LVDSDataStruct SiS300_CHTVUPALData[]=
{936, 836, 936, 836}
};
-SiS300_LVDSDataStruct SiS300_CHTVOPALData[]=
+static const SiS300_LVDSDataStruct SiS300_CHTVOPALData[] =
{
{1008, 625,1008, 625},
{1008, 625,1008, 625},
@@ -1507,6 +2013,17 @@ SiS300_LVDSDataStruct SiS300_CHTVOPALData[]=
{840, 625, 840, 625},
{960, 750, 960, 750}
};
+
+static const SiS300_LVDSDataStruct SiS300_CHTVSOPALData[] =
+{
+ {1008, 625,1008, 625},
+ {1008, 625,1008, 625},
+ {1008, 625,1008, 625},
+ {1008, 625,1008, 625},
+ {840, 500, 840, 500},
+ {944, 625, 944, 625}
+};
+
/* TW: new end */
typedef struct _SiS300_LVDSDesStruct
@@ -1515,7 +2032,7 @@ typedef struct _SiS300_LVDSDesStruct
USHORT LCDVDES;
} SiS300_LVDSDesStruct;
-SiS300_LVDSDesStruct SiS300_PanelType00_1[]=
+static const SiS300_LVDSDesStruct SiS300_PanelType00_1[] =
{
{0, 626},
{0, 624},
@@ -1528,7 +2045,7 @@ SiS300_LVDSDesStruct SiS300_PanelType00_1[]=
{ 0, 0}
};
-SiS300_LVDSDesStruct SiS300_PanelType01_1[]=
+static const SiS300_LVDSDesStruct SiS300_PanelType01_1[] =
{
{1343, 798},
{1343, 794},
@@ -1541,7 +2058,7 @@ SiS300_LVDSDesStruct SiS300_PanelType01_1[]=
{ 0, 0}
};
-SiS300_LVDSDesStruct SiS300_PanelType02_1[]=
+static const SiS300_LVDSDesStruct SiS300_PanelType02_1[] =
{
{0, 626},
{0, 624},
@@ -1554,7 +2071,7 @@ SiS300_LVDSDesStruct SiS300_PanelType02_1[]=
{ 0, 0}
};
-SiS300_LVDSDesStruct SiS300_PanelType03_1[]=
+static const SiS300_LVDSDesStruct SiS300_PanelType03_1[] =
{
{ 8, 436},
{ 8, 440},
@@ -1567,7 +2084,7 @@ SiS300_LVDSDesStruct SiS300_PanelType03_1[]=
{1343, 794}
};
-SiS300_LVDSDesStruct SiS300_PanelType04_1[]=
+static const SiS300_LVDSDesStruct SiS300_PanelType04_1[] =
{
{1343, 798},
{1343, 794},
@@ -1580,7 +2097,7 @@ SiS300_LVDSDesStruct SiS300_PanelType04_1[]=
{ 0, 0}
};
-SiS300_LVDSDesStruct SiS300_PanelType05_1[]=
+static const SiS300_LVDSDesStruct SiS300_PanelType05_1[] =
{
{1343, 798},
{1343, 794},
@@ -1593,7 +2110,7 @@ SiS300_LVDSDesStruct SiS300_PanelType05_1[]=
{ 0, 0}
};
-SiS300_LVDSDesStruct SiS300_PanelType06_1[]=
+static const SiS300_LVDSDesStruct SiS300_PanelType06_1[] =
{
{1343, 798},
{1343, 794},
@@ -1606,7 +2123,7 @@ SiS300_LVDSDesStruct SiS300_PanelType06_1[]=
{ 0, 0}
};
-SiS300_LVDSDesStruct SiS300_PanelType07_1[]=
+static const SiS300_LVDSDesStruct SiS300_PanelType07_1[] =
{
{1343, 798},
{1343, 794},
@@ -1619,7 +2136,7 @@ SiS300_LVDSDesStruct SiS300_PanelType07_1[]=
{ 0, 0}
};
-SiS300_LVDSDesStruct SiS300_PanelType08_1[]=
+static const SiS300_LVDSDesStruct SiS300_PanelType08_1[] =
{
{1059, 626},
{1059, 624},
@@ -1632,7 +2149,7 @@ SiS300_LVDSDesStruct SiS300_PanelType08_1[]=
{ 0, 0}
};
-SiS300_LVDSDesStruct SiS300_PanelType09_1[]=
+static const SiS300_LVDSDesStruct SiS300_PanelType09_1[] =
{
{1343, 798},
{1343, 794},
@@ -1645,7 +2162,7 @@ SiS300_LVDSDesStruct SiS300_PanelType09_1[]=
{ 0, 0}
};
-SiS300_LVDSDesStruct SiS300_PanelType0a_1[]=
+static const SiS300_LVDSDesStruct SiS300_PanelType0a_1[] =
{
{1059, 626},
{1059, 624},
@@ -1658,20 +2175,20 @@ SiS300_LVDSDesStruct SiS300_PanelType0a_1[]=
{ 0, 0}
};
-SiS300_LVDSDesStruct SiS300_PanelType0b_1[]=
+static const SiS300_LVDSDesStruct SiS300_PanelType0b_1[] =
{
- {1343, 798},
- {1343, 794},
- {1343, 798},
- {1343, 794},
- {1343, 0},
- {1343, 0},
- { 0, 805},
- { 0, 794},
- { 0, 0}
+ {1343, 0},
+ {1343, 0},
+ {1343, 0},
+ {1343, 0},
+ {1343, 0}, /* 640x480 - BIOS 1343, 0 */
+ {1343, 0},
+ { 0, 799},
+ { 0, 0},
+ { 0, 0}
};
-SiS300_LVDSDesStruct SiS300_PanelType0c_1[]=
+static const SiS300_LVDSDesStruct SiS300_PanelType0c_1[] =
{
{1343, 798},
{1343, 794},
@@ -1684,7 +2201,7 @@ SiS300_LVDSDesStruct SiS300_PanelType0c_1[]=
{ 0, 0}
};
-SiS300_LVDSDesStruct SiS300_PanelType0d_1[]=
+static const SiS300_LVDSDesStruct SiS300_PanelType0d_1[] =
{
{1343, 798},
{1343, 794},
@@ -1697,7 +2214,7 @@ SiS300_LVDSDesStruct SiS300_PanelType0d_1[]=
{ 0, 0}
};
-SiS300_LVDSDesStruct SiS300_PanelType0e_1[]=
+static const SiS300_LVDSDesStruct SiS300_PanelType0e_1[] =
{
{1343, 798},
{1343, 794},
@@ -1710,7 +2227,7 @@ SiS300_LVDSDesStruct SiS300_PanelType0e_1[]=
{ 0, 0} /* 1280x960 - not applicable */
};
-SiS300_LVDSDesStruct SiS300_PanelType0f_1[]=
+static const SiS300_LVDSDesStruct SiS300_PanelType0f_1[] =
{
{1343, 798},
{1343, 794},
@@ -1723,7 +2240,7 @@ SiS300_LVDSDesStruct SiS300_PanelType0f_1[]=
{ 0, 0}
};
-SiS300_LVDSDesStruct SiS300_PanelType00_2[]=
+static const SiS300_LVDSDesStruct SiS300_PanelType00_2[] =
{
{976, 527},
{976, 502},
@@ -1736,7 +2253,7 @@ SiS300_LVDSDesStruct SiS300_PanelType00_2[]=
{ 0, 0}
};
-SiS300_LVDSDesStruct SiS300_PanelType01_2[]=
+static const SiS300_LVDSDesStruct SiS300_PanelType01_2[] =
{
{1152, 622},
{1152, 597},
@@ -1749,7 +2266,7 @@ SiS300_LVDSDesStruct SiS300_PanelType01_2[]=
{ 0, 0}
};
-SiS300_LVDSDesStruct SiS300_PanelType02_2[]=
+static const SiS300_LVDSDesStruct SiS300_PanelType02_2[] =
{
{976, 527},
{976, 502},
@@ -1762,7 +2279,7 @@ SiS300_LVDSDesStruct SiS300_PanelType02_2[]=
{ 0, 0}
};
-SiS300_LVDSDesStruct SiS300_PanelType03_2[]=
+static const SiS300_LVDSDesStruct SiS300_PanelType03_2[] =
{
{1152, 622},
{1152, 597},
@@ -1775,7 +2292,7 @@ SiS300_LVDSDesStruct SiS300_PanelType03_2[]=
{1152, 597}
};
-SiS300_LVDSDesStruct SiS300_PanelType04_2[]=
+static const SiS300_LVDSDesStruct SiS300_PanelType04_2[] =
{
{1152, 622},
{1152, 597},
@@ -1788,7 +2305,7 @@ SiS300_LVDSDesStruct SiS300_PanelType04_2[]=
{ 0, 0}
};
-SiS300_LVDSDesStruct SiS300_PanelType05_2[]=
+static const SiS300_LVDSDesStruct SiS300_PanelType05_2[] =
{
{1152, 622},
{1152, 597},
@@ -1801,7 +2318,7 @@ SiS300_LVDSDesStruct SiS300_PanelType05_2[]=
{ 0, 0}
};
-SiS300_LVDSDesStruct SiS300_PanelType06_2[]=
+static const SiS300_LVDSDesStruct SiS300_PanelType06_2[] =
{
{1152, 622},
{1152, 597},
@@ -1814,7 +2331,7 @@ SiS300_LVDSDesStruct SiS300_PanelType06_2[]=
{ 0, 0}
};
-SiS300_LVDSDesStruct SiS300_PanelType07_2[]=
+static const SiS300_LVDSDesStruct SiS300_PanelType07_2[] =
{
{1152, 622},
{1152, 597},
@@ -1827,7 +2344,7 @@ SiS300_LVDSDesStruct SiS300_PanelType07_2[]=
{ 0, 0}
};
-SiS300_LVDSDesStruct SiS300_PanelType08_2[]=
+static const SiS300_LVDSDesStruct SiS300_PanelType08_2[] =
{
{976, 527},
{976, 502},
@@ -1840,7 +2357,7 @@ SiS300_LVDSDesStruct SiS300_PanelType08_2[]=
{ 0, 0}
};
-SiS300_LVDSDesStruct SiS300_PanelType09_2[]=
+static const SiS300_LVDSDesStruct SiS300_PanelType09_2[] =
{
{1152, 622},
{1152, 597},
@@ -1853,7 +2370,7 @@ SiS300_LVDSDesStruct SiS300_PanelType09_2[]=
{ 0, 0}
};
-SiS300_LVDSDesStruct SiS300_PanelType0a_2[]=
+static const SiS300_LVDSDesStruct SiS300_PanelType0a_2[] =
{
{976, 527},
{976, 502},
@@ -1866,20 +2383,20 @@ SiS300_LVDSDesStruct SiS300_PanelType0a_2[]=
{ 0, 0}
};
-SiS300_LVDSDesStruct SiS300_PanelType0b_2[]=
+static const SiS300_LVDSDesStruct SiS300_PanelType0b_2[] =
{
- {1152, 622},
- {1152, 597},
- {1152, 622},
- {1152, 597},
- {1152, 662},
- {1232, 722},
- { 0, 805},
- { 0, 794},
- { 0, 0}
+ { 1152, 700},
+ { 1152, 675},
+ { 1152, 700},
+ { 1152, 675},
+ { 1152, 740},
+ { 1232, 799},
+ { 0, 799},
+ { 0, 0},
+ { 0, 0}
};
-SiS300_LVDSDesStruct SiS300_PanelType0c_2[]=
+static const SiS300_LVDSDesStruct SiS300_PanelType0c_2[] =
{
{1152, 622},
{1152, 597},
@@ -1892,7 +2409,7 @@ SiS300_LVDSDesStruct SiS300_PanelType0c_2[]=
{ 0, 0}
};
-SiS300_LVDSDesStruct SiS300_PanelType0d_2[]=
+static const SiS300_LVDSDesStruct SiS300_PanelType0d_2[] =
{
{1152, 622},
{1152, 597},
@@ -1905,7 +2422,7 @@ SiS300_LVDSDesStruct SiS300_PanelType0d_2[]=
{ 0, 0}
};
-SiS300_LVDSDesStruct SiS300_PanelType0e_2[]=
+static const SiS300_LVDSDesStruct SiS300_PanelType0e_2[] =
{
{1152, 622},
{1152, 597},
@@ -1918,7 +2435,7 @@ SiS300_LVDSDesStruct SiS300_PanelType0e_2[]=
{ 0, 0}
};
-SiS300_LVDSDesStruct SiS300_PanelType0f_2[]=
+static const SiS300_LVDSDesStruct SiS300_PanelType0f_2[] =
{
{1152, 622},
{1152, 597},
@@ -1931,7 +2448,7 @@ SiS300_LVDSDesStruct SiS300_PanelType0f_2[]=
{ 0, 0}
};
-SiS300_LVDSDesStruct SiS300_PanelType1076_1[]= /* TW: New */
+static const SiS300_LVDSDesStruct SiS300_PanelType1076_1[] = /* TW: New */
{
{ 0 , 0},
{ 0 , 0},
@@ -1944,7 +2461,7 @@ SiS300_LVDSDesStruct SiS300_PanelType1076_1[]= /* TW: New */
{ 0 , 0}
};
-SiS300_LVDSDesStruct SiS300_PanelType1076_2[]= /* TW: New */
+static const SiS300_LVDSDesStruct SiS300_PanelType1076_2[] = /* TW: New */
{
{ 1152, 622 },
{ 1152, 597 },
@@ -1957,7 +2474,7 @@ SiS300_LVDSDesStruct SiS300_PanelType1076_2[]= /* TW: New */
{ 0, 0 }
};
-SiS300_LVDSDesStruct SiS300_PanelType1210_1[]= /* TW: New */
+static const SiS300_LVDSDesStruct SiS300_PanelType1210_1[] = /* TW: New */
{
{ 0 , 0},
{ 0 , 0},
@@ -1970,7 +2487,7 @@ SiS300_LVDSDesStruct SiS300_PanelType1210_1[]= /* TW: New */
{ 0 , 0}
};
-SiS300_LVDSDesStruct SiS300_PanelType1210_2[]= /* TW: New */
+static const SiS300_LVDSDesStruct SiS300_PanelType1210_2[] = /* TW: New */
{
{ 0 , 0},
{ 0 , 0},
@@ -1983,7 +2500,7 @@ SiS300_LVDSDesStruct SiS300_PanelType1210_2[]= /* TW: New */
{ 0 , 0}
};
-SiS300_LVDSDesStruct SiS300_PanelType1296_1[]= /* TW: New */
+static const SiS300_LVDSDesStruct SiS300_PanelType1296_1[] = /* TW: New */
{
{ 0 , 0},
{ 0 , 0},
@@ -1996,7 +2513,7 @@ SiS300_LVDSDesStruct SiS300_PanelType1296_1[]= /* TW: New */
{ 0 , 0}
};
-SiS300_LVDSDesStruct SiS300_PanelType1296_2[]= /* TW: New */
+static const SiS300_LVDSDesStruct SiS300_PanelType1296_2[] = /* TW: New */
{
{ 0 , 0},
{ 0 , 0},
@@ -2011,7 +2528,7 @@ SiS300_LVDSDesStruct SiS300_PanelType1296_2[]= /* TW: New */
/* TW: New */
-SiS300_LVDSDesStruct SiS300_CHTVUNTSCDesData[]=
+static const SiS300_LVDSDesStruct SiS300_CHTVUNTSCDesData[] =
{
{ 0, 0},
{ 0, 0},
@@ -2021,7 +2538,7 @@ SiS300_LVDSDesStruct SiS300_CHTVUNTSCDesData[]=
{ 0, 0}
};
-SiS300_LVDSDesStruct SiS300_CHTVONTSCDesData[]=
+static const SiS300_LVDSDesStruct SiS300_CHTVONTSCDesData[] =
{
{ 0, 0},
{ 0, 0},
@@ -2031,7 +2548,7 @@ SiS300_LVDSDesStruct SiS300_CHTVONTSCDesData[]=
{ 0, 0}
};
-SiS300_LVDSDesStruct SiS300_CHTVUPALDesData[]=
+static const SiS300_LVDSDesStruct SiS300_CHTVUPALDesData[] =
{
{256, 0},
{256, 0},
@@ -2041,7 +2558,7 @@ SiS300_LVDSDesStruct SiS300_CHTVUPALDesData[]=
{ 0, 0}
};
-SiS300_LVDSDesStruct SiS300_CHTVOPALDesData[]=
+static const SiS300_LVDSDesStruct SiS300_CHTVOPALDesData[] =
{
{256, 0},
{256, 0},
@@ -2052,12 +2569,90 @@ SiS300_LVDSDesStruct SiS300_CHTVOPALDesData[]=
};
/* TW: New end */
+/* TW: New for SiS300+301LV */
+typedef struct _SiS300_Part2PortTblStruct
+{
+ UCHAR CR[12];
+} SiS300_Part2PortTblStruct;
+
+static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1024x768_1[] =
+{ /* VESA Timing */
+ {{0x21,0x12,0xbf,0xe4,0xc0,0x21,0x45,0x09,0x00,0xa9,0x09,0x04}},
+ {{0x2c,0x12,0x9a,0xae,0x88,0x21,0x45,0x09,0x00,0xa9,0x09,0x04}},
+ {{0x21,0x12,0xbf,0xe4,0xc0,0x21,0x45,0x09,0x00,0xa9,0x09,0x04}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
+ {{0x22,0x13,0xfe,0x25,0xff,0x21,0x45,0x0a,0x00,0xa9,0x0d,0x04}},
+ {{0x22,0x13,0xfe,0x25,0xff,0x21,0x45,0x0a,0x00,0xa9,0x0d,0x04}},
+ {{0x22,0x13,0xfe,0x25,0xff,0x21,0x45,0x0a,0x00,0xa9,0x0d,0x04}}
+};
+
+static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1280x1024_1[] =
+{ /* TW: Temporary data, invalid */
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}
+};
+
+static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1400x1050_1[] =
+{ /* TW: Temporary data, invalid */
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}
+};
+
+static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1600x1200_1[] =
+{ /* TW: Temporary data, invalid */
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}
+};
+
+static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1024x768_2[] =
+{ /* Non-VESA */
+ {{0x28,0x12,0xa3,0xd0,0xaa,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}},
+ {{0x2c,0x12,0x9a,0xae,0x88,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}},
+ {{0x28,0x12,0xa3,0xd0,0xaa,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}},
+ {{0x2c,0x12,0x9a,0xae,0x88,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}},
+ {{0x28,0x13,0xe7,0x0b,0xe8,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}},
+ {{0x38,0x18,0x16,0x00,0x00,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}},
+ {{0x36,0x13,0x13,0x25,0xff,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}
+};
+
+static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1280x1024_2[] =
+{
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}
+};
+
+static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1400x1050_2[] =
+{
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}
+};
+
+static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1600x1200_2[] =
+{ /* TW: Temporary data, invalid */
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}
+};
+
+static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1024x768_3[] =
+{ /* TW: Temporary data, invalid */
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}
+};
+
+static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1280x1024_3[] =
+{ /* TW: Temporary data, invalid */
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}
+};
+
+static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1400x1050_3[] =
+{ /* TW: Temporary data, invalid */
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}
+};
+
+static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1600x1200_3[] =
+{ /* TW: Temporary data, invalid */
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}
+};
+
typedef struct _SiS300_LVDSCRT1DataStruct
{
UCHAR CR[15];
} SiS300_LVDSCRT1DataStruct;
-SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_1[]=
+static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_1[] =
{
{{0x65,0x4f,0x89,0x56,0x83,0xaf,0x1f,
0x90,0x85,0x8f,0xab,0x30,0x00,0x05,
@@ -2079,7 +2674,7 @@ SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_1[]=
0x01 }}
};
-SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_1[]=
+static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_1[] =
{
{{0x64,0x4f,0x88,0x54,0x9f,0xc4,0x1f,
0x92,0x89,0x8f,0xb5,0x30,0x00,0x01,
@@ -2101,10 +2696,10 @@ SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_1[]=
0x01}},
{{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5,
0x02,0x88,0xff,0x25,0x10,0x00,0x02,
- 0x01} }
+ 0x01}}
};
-SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_1[]=
+static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_1[] =
{
{{0x63,0x4f,0x87,0x54,0x9f,0xb4,0x1f,
0x92,0x89,0x8f,0xb5,0x30,0x00,0x01,
@@ -2129,7 +2724,7 @@ SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_1[]=
0x01 }}
};
-SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_1_H[]=
+static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_1_H[] =
{
{{0x30,0x27,0x94,0x2c,0x92,0xaf,0x1f,
0x90,0x85,0x8f,0xab,0x30,0x00,0x04,
@@ -2151,7 +2746,7 @@ SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_1_H[]=
0x01 }}
};
-SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_1_H[]=
+static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_1_H[] =
{
{{0x37,0x27,0x9B,0x2b,0x94,0xc4,0x1f,
0x92,0x89,0x8f,0xb5,0x30,0x00,0x44,
@@ -2176,7 +2771,7 @@ SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_1_H[]=
0x01 }}
};
-SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_1_H[]=
+static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_1_H[] =
{
{{0x2f,0x27,0x93,0x2b,0x90,0xb4,0x1f,
0x92,0x89,0x8f,0xb5,0x30,0x00,0x04,
@@ -2201,7 +2796,7 @@ SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_1_H[]=
0x01 }}
};
-SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_2[]=
+static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_2[] =
{
{{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e,
0xf4,0x88,0x8f,0x73,0x20,0x00,0x06,
@@ -2223,7 +2818,7 @@ SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_2[]=
0x01 }}
};
-SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_2[]=
+static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_2[] =
{
{{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb,
0x4a,0x80,0x8f,0x25,0x30,0x00,0x06,
@@ -2248,7 +2843,7 @@ SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_2[]=
0x01 }}
};
-SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_2[]=
+static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_2[] =
{
{{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb,
0x4a,0x80,0x8f,0x25,0x30,0x00,0x06,
@@ -2273,7 +2868,7 @@ SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_2[]=
0x01 }}
};
-SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_2_H[]=
+static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_2_H[] =
{
{{0x3d,0x27,0x81,0x32,0x1a,0x72,0x3e,
0xf4,0x88,0x8f,0x73,0x20,0x00,0x05,
@@ -2295,7 +2890,7 @@ SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_2_H[]=
0x01 }}
};
-SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_2_H[]=
+static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_2_H[] =
{
{{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb,
0x4a,0x80,0x8f,0x25,0x30,0x00,0x01,
@@ -2320,7 +2915,7 @@ SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_2_H[]=
0x01 }}
};
-SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_2_H[]=
+static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_2_H[] =
{
{{0x4f,0x27,0x93,0x39,0x81,0x24,0xbb,
0x4a,0x80,0x8f,0x25,0x30,0x00,0x01,
@@ -2345,7 +2940,7 @@ SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_2_H[]=
0x01}}
};
-SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x600_1[] =
+static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x600_1[] =
{
{{0x64,0x4f,0x88,0x54,0x9f,0x5a,0x3e,
0xe8,0x8f,0x8f,0x5b,0x00,0x00,0x01,
@@ -2370,7 +2965,7 @@ SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x600_1[] =
0x01}}
};
-SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x600_1_H[] =
+static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x600_1_H[] =
{
{{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f,
0x92,0x89,0x8f,0xb5,0x30,0x00,0x44,
@@ -2395,7 +2990,7 @@ SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x600_1_H[] =
0x01}}
};
-SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x600_2[] =
+static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x600_2[] =
{
{{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb,
0x4a,0x80,0x8f,0x25,0x30,0x00,0x06,
@@ -2420,7 +3015,7 @@ SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x600_2[] =
0x01}}
};
-SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x600_2_H[] =
+static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x600_2_H[] =
{
{{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb,
0x4a,0x80,0x8f,0x25,0x30,0x00,0x01,
@@ -2445,7 +3040,7 @@ SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x600_2_H[] =
0x01}}
};
-SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11152x768_1[] =
+static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11152x768_1[] =
{
{{0x64,0x4f,0x88,0x54,0x9f,0xc4,0x1f,
0x92,0x89,0x8f,0xb5,0x30,0x00,0x01,
@@ -2470,7 +3065,7 @@ SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11152x768_1[] =
0x01}}
};
-SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11152x768_1_H[] =
+static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11152x768_1_H[] =
{
{{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f,
0x92,0x89,0x8f,0xb5,0x30,0x00,0x44,
@@ -2495,7 +3090,7 @@ SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11152x768_1_H[] =
0x01}}
};
-SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11152x768_2[] =
+static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11152x768_2[] =
{
{{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb,
0x4a,0x80,0x8f,0x25,0x30,0x00,0x06,
@@ -2520,7 +3115,7 @@ SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11152x768_2[] =
0x01}}
};
-SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11152x768_2_H[] =
+static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11152x768_2_H[] =
{
{{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb,
0x4a,0x80,0x8f,0x25,0x30,0x00,0x01,
@@ -2546,7 +3141,7 @@ SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11152x768_2_H[] =
};
/* TW: New */
-SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1UNTSC[]=
+static const SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1UNTSC[] =
{
{{0x64,0x4f,0x88,0x56,0x9f,0x56,0x3e,
0xe8,0x84,0x8f,0x57,0x20,0x00,0x01,
@@ -2568,7 +3163,7 @@ SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1UNTSC[]=
0x01 }}
};
-SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1ONTSC[]=
+static const SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1ONTSC[] =
{
{{0x64,0x4f,0x88,0x5a,0x9f,0x0b,0x3e,
0xc0,0x84,0x8f,0x0c,0x20,0x00,0x01,
@@ -2590,7 +3185,7 @@ SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1ONTSC[]=
0x01 }}
};
-SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1UPAL[]=
+static const SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1UPAL[] =
{
{{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e,
0xf8,0x83,0x8f,0x70,0x20,0x00,0x05,
@@ -2612,7 +3207,7 @@ SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1UPAL[]=
0x01 }}
};
-SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1OPAL[]=
+static const SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1OPAL[] =
{
{{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e,
0xf0,0x83,0x8f,0x70,0x20,0x00,0x05,
@@ -2633,6 +3228,28 @@ SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1OPAL[]=
0x90,0x8c,0x57,0xed,0x20,0x00,0x05,
0x01 }}
};
+
+static const SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1SOPAL[] =
+{
+ {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e,
+ 0xf0,0x83,0x8f,0x70,0x20,0x00,0x05,
+ 0x00 }},
+ {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e,
+ 0xde,0x81,0x5d,0x70,0x00,0x00,0x05,
+ 0x00 }},
+ {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e,
+ 0xf0,0x83,0x8f,0x70,0x20,0x00,0x05,
+ 0x00 }},
+ {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e,
+ 0xde,0x81,0x5d,0x70,0x00,0x00,0x05,
+ 0x00 }},
+ {{0x64,0x4f,0x88,0x55,0x80,0x6f,0xba, /* TODO */
+ 0x20,0x83,0xdf,0x70,0x00,0x00,0x05,
+ 0x00 }},
+ {{0x73,0x63,0x97,0x69,0x8e,0xec,0xf0, /* TODO */
+ 0x90,0x8c,0x57,0xed,0x20,0x00,0x05,
+ 0x01 }}
+};
/* TW: New end */
/* TW: New */
@@ -2641,7 +3258,8 @@ typedef struct _SiS300_CHTVRegDataStruct
UCHAR Reg[16];
} SiS300_CHTVRegDataStruct;
-SiS300_CHTVRegDataStruct SiS300_CHTVReg_UNTSC[] = {
+static const SiS300_CHTVRegDataStruct SiS300_CHTVReg_UNTSC[] =
+{
{{0x4a,0x94,0x00,0x48,0xfe,0,0,0,0,0,0,0,0,0,0,0}},
{{0x4a,0x94,0x00,0x48,0xfe,0,0,0,0,0,0,0,0,0,0,0}},
{{0x4a,0x94,0x00,0x48,0xfe,0,0,0,0,0,0,0,0,0,0,0}},
@@ -2650,7 +3268,8 @@ SiS300_CHTVRegDataStruct SiS300_CHTVReg_UNTSC[] = {
{{0x8d,0xc4,0x00,0x3b,0xfb,0,0,0,0,0,0,0,0,0,0,0}} /* Mode 24: 800x600 NTSC 7/10 */
};
-SiS300_CHTVRegDataStruct SiS300_CHTVReg_ONTSC[] = {
+static const SiS300_CHTVRegDataStruct SiS300_CHTVReg_ONTSC[] =
+{
{{0x49,0x94,0x00,0x34,0xfe,0,0,0,0,0,0,0,0,0,0,0}},
{{0x49,0x94,0x00,0x34,0xfe,0,0,0,0,0,0,0,0,0,0,0}},
{{0x49,0x94,0x00,0x34,0xfe,0,0,0,0,0,0,0,0,0,0,0}},
@@ -2659,37 +3278,51 @@ SiS300_CHTVRegDataStruct SiS300_CHTVReg_ONTSC[] = {
{{0x8c,0xb4,0x00,0x32,0xf9,0,0,0,0,0,0,0,0,0,0,0}} /* Mode 23: 800x600 NTSC 3/4 */
};
-SiS300_CHTVRegDataStruct SiS300_CHTVReg_UPAL[] = {
+static const SiS300_CHTVRegDataStruct SiS300_CHTVReg_UPAL[] =
+{
{{0x41,0x12,0x01,0x50,0x34,0,0,0,0,0,0,0,0,0,0,0}},
{{0x41,0x12,0x00,0x50,0x00,0,0,0,0,0,0,0,0,0,0,0}},
{{0x41,0x12,0x01,0x50,0x34,0,0,0,0,0,0,0,0,0,0,0}},
{{0x41,0x12,0x00,0x50,0x00,0,0,0,0,0,0,0,0,0,0,0}},
{{0x63,0x94,0x01,0x50,0x30,0,0,0,0,0,0,0,0,0,0,0}}, /* Mode 15: 640x480 PAL 5/6 */
- /* TW: For 800x600, 3/4 is VERY underscan */
{{0x84,0x64,0x01,0x4e,0x2f,0,0,0,0,0,0,0,0,0,0,0}} /* Mode 21: 800x600 PAL 3/4 */
- /* TW: Mode 20 is still underscan, use it instead? */
- /* {{0x83,0x76,0x01,0x40,0x31}} */ /* Mode 20: 800x600 PAL 5/6 */
+
};
-SiS300_CHTVRegDataStruct SiS300_CHTVReg_OPAL[] = {
+static const SiS300_CHTVRegDataStruct SiS300_CHTVReg_OPAL[] =
+{
{{0x41,0x12,0x01,0x50,0x34,0,0,0,0,0,0,0,0,0,0,0}}, /* Mode 9: 640x400 PAL 1/1 */
{{0x41,0x12,0x00,0x50,0x00,0,0,0,0,0,0,0,0,0,0,0}},
{{0x41,0x12,0x01,0x50,0x34,0,0,0,0,0,0,0,0,0,0,0}},
{{0x41,0x12,0x00,0x50,0x00,0,0,0,0,0,0,0,0,0,0,0}},
{{0x61,0x94,0x01,0x36,0x30,0,0,0,0,0,0,0,0,0,0,0}}, /* Mode 14: 640x480 PAL 1/1 */
{{0x83,0x76,0x01,0x40,0x31,0,0,0,0,0,0,0,0,0,0,0}} /* Mode 20: 800x600 PAL 5/6 */
- /* {{0x81,0x12,0x01,0x50,0x34}} */ /* TW: (test) Mode 19: 800x600 PAL 1/1 */
+
+};
+
+static const SiS300_CHTVRegDataStruct SiS300_CHTVReg_SOPAL[] =
+{
+ {{0x41,0x12,0x01,0x50,0x34,0,0,0,0,0,0,0,0,0,0,0}}, /* Mode 9: 640x400 PAL 5/4 */
+ {{0x41,0x12,0x00,0x50,0x00,0,0,0,0,0,0,0,0,0,0,0}},
+ {{0x41,0x12,0x01,0x50,0x34,0,0,0,0,0,0,0,0,0,0,0}},
+ {{0x41,0x12,0x00,0x50,0x00,0,0,0,0,0,0,0,0,0,0,0}},
+ {{0x60,0x30,0x00,0x10,0x00,0,0,0,0,0,0,0,0,0,0,0}}, /* TW: Mode 13: 640x480 PAL 5/4 */
+ {{0x81,0x50,0x00,0x1b,0x00,0,0,0,0,0,0,0,0,0,0,0}} /* TW: Mode 19: 800x600 PAL 1/1 */
};
/* TW: New end */
/* TW: New */
-UCHAR SiS300_CHTVVCLKUNTSC[] = {0x29,0x29,0x29,0x29,0x2a,0x2e};
+static const UCHAR SiS300_CHTVVCLKUNTSC[] = {0x29,0x29,0x29,0x29,0x2a,0x2e};
+
+static const UCHAR SiS300_CHTVVCLKONTSC[] = {0x2c,0x2c,0x2c,0x2c,0x2d,0x2b};
+
+static const UCHAR SiS300_CHTVVCLKSONTSC[] = {0x2c,0x2c,0x2c,0x2c,0x2d,0x2b};
-UCHAR SiS300_CHTVVCLKONTSC[] = {0x2c,0x2c,0x2c,0x2c,0x2d,0x2b};
+static const UCHAR SiS300_CHTVVCLKUPAL[] = {0x2f,0x2f,0x2f,0x2f,0x2f,0x31};
-UCHAR SiS300_CHTVVCLKUPAL[] = {0x2f,0x2f,0x2f,0x2f,0x2f,0x31};
+static const UCHAR SiS300_CHTVVCLKOPAL[] = {0x2f,0x2f,0x2f,0x2f,0x30,0x32};
-UCHAR SiS300_CHTVVCLKOPAL[] = {0x2f,0x2f,0x2f,0x2f,0x30,0x32};
+static const UCHAR SiS300_CHTVVCLKSOPAL[] = {0x2f,0x2f,0x2f,0x2f,0x36,0x29};
/* TW: New end */
diff --git a/drivers/video/sis/310vtbl.h b/drivers/video/sis/310vtbl.h
index af4eee909f50..4b039f86d1f5 100644
--- a/drivers/video/sis/310vtbl.h
+++ b/drivers/video/sis/310vtbl.h
@@ -1,6 +1,6 @@
-/* Register settings for SiS 310/325 series */
+/* Register settings for SiS 310/325/330 series */
typedef struct _SiS310_StStruct
@@ -15,7 +15,7 @@ typedef struct _SiS310_StStruct
UCHAR VB_StTVYFilterIndex;
} SiS310_StStruct;
-SiS310_StStruct SiS310_SModeIDTable[]=
+static const SiS310_StStruct SiS310_SModeIDTable[]=
{
{0x01,0x9208,0x01,0x00,0x00,0x00,0x01,0x00},
{0x01,0x1210,0x14,0x01,0x01,0x00,0x01,0x00},
@@ -52,9 +52,9 @@ typedef struct _SiS310_StandTableStruct
UCHAR GRC[9];
} SiS310_StandTableStruct;
-SiS310_StandTableStruct SiS310_StandTable[]=
+static const SiS310_StandTableStruct SiS310_StandTable[]=
{
-/* MD_0_200 */
+/* 0x00: MD_0_200 */
{
0x28,0x18,0x08,0x0800,
{0x09,0x03,0x00,0x02},
@@ -69,7 +69,7 @@ SiS310_StandTableStruct SiS310_StandTable[]=
{0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
0xff}
},
-/* MD_1_200 */
+/* 0x01: MD_1_200 */
{
0x28,0x18,0x08,0x0800,
{0x09,0x03,0x00,0x02},
@@ -84,7 +84,7 @@ SiS310_StandTableStruct SiS310_StandTable[]=
{0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
0xff}
},
-/* MD_2_200 */
+/* 0x02: MD_2_200 */
{
0x50,0x18,0x08,0x1000,
{0x01,0x03,0x00,0x02},
@@ -99,7 +99,7 @@ SiS310_StandTableStruct SiS310_StandTable[]=
{0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
0xff}
},
-/* MD_3_200 */
+/* 0x03: MD_3_200 - mode 0x03 - 0 */
{
0x50,0x18,0x08,0x1000,
{0x01,0x03,0x00,0x02},
@@ -114,7 +114,7 @@ SiS310_StandTableStruct SiS310_StandTable[]=
{0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
0xff}
},
-/* MD_4 */
+/* 0x04: MD_4 */
{
0x28,0x18,0x08,0x4000,
{0x09,0x03,0x00,0x02},
@@ -129,7 +129,7 @@ SiS310_StandTableStruct SiS310_StandTable[]=
{0x00,0x00,0x00,0x00,0x00,0x30,0x0f,0x00,
0xff}
},
-/* MD_5 */
+/* 0x05: MD_5 */
{
0x28,0x18,0x08,0x4000,
{0x09,0x03,0x00,0x02},
@@ -144,7 +144,7 @@ SiS310_StandTableStruct SiS310_StandTable[]=
{0x00,0x00,0x00,0x00,0x00,0x30,0x0f,0x00,
0xff}
},
-/* MD_6 */
+/* 0x06: MD_6 */
{
0x50,0x18,0x08,0x4000,
{0x01,0x01,0x00,0x06},
@@ -159,7 +159,7 @@ SiS310_StandTableStruct SiS310_StandTable[]=
{0x00,0x00,0x00,0x00,0x00,0x00,0x0d,0x00,
0xff}
},
-/* MD_7 */
+/* 0x07: MD_7 */
{
0x50,0x18,0x0e,0x1000,
{0x00,0x03,0x00,0x03},
@@ -174,7 +174,7 @@ SiS310_StandTableStruct SiS310_StandTable[]=
{0x00,0x00,0x00,0x00,0x00,0x10,0x0a,0x00,
0xff}
},
-/* MDA_DAC */
+/* 0x08: MDA_DAC */
{
0x00,0x00,0x00,0x0000,
{0x00,0x00,0x00,0x15},
@@ -189,7 +189,7 @@ SiS310_StandTableStruct SiS310_StandTable[]=
{0x15,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,
0x3f}
},
-/* CGA_DAC */
+/* 0x09: CGA_DAC */
{
0x00,0x10,0x04,0x0114,
{0x11,0x09,0x15,0x00},
@@ -204,7 +204,7 @@ SiS310_StandTableStruct SiS310_StandTable[]=
{0x3f,0x2a,0x3a,0x2e,0x3e,0x2b,0x3b,0x2f,
0x3f}
},
-/* EGA_DAC */
+/* 0x0a: EGA_DAC */
{
0x00,0x10,0x04,0x0114,
{0x11,0x05,0x15,0x20},
@@ -219,7 +219,7 @@ SiS310_StandTableStruct SiS310_StandTable[]=
{0x1f,0x2a,0x3a,0x2e,0x3e,0x2b,0x3b,0x2f,
0x3f}
},
-/* VGA_DAC */
+/* 0x0b: VGA_DAC */
{
0x00,0x10,0x04,0x0114,
{0x11,0x09,0x15,0x2a},
@@ -234,6 +234,7 @@ SiS310_StandTableStruct SiS310_StandTable[]=
{0x18,0x1c,0x14,0x16,0x18,0x1a,0x1c,0x00,
0x04}
},
+/* 0x0c */
{
0x08,0x0c,0x10,0x0a08,
{0x0c,0x0e,0x10,0x0b},
@@ -248,7 +249,7 @@ SiS310_StandTableStruct SiS310_StandTable[]=
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00}
},
-/* MD_D */
+/* 0x0d: MD_D */
{
0x28,0x18,0x08,0x2000,
{0x09,0x0f,0x00,0x06},
@@ -263,7 +264,7 @@ SiS310_StandTableStruct SiS310_StandTable[]=
{0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f,
0xff}
},
-/* MD_E */
+/* 0x0e: MD_E */
{
0x50,0x18,0x08,0x4000,
{0x01,0x0f,0x00,0x06},
@@ -278,7 +279,7 @@ SiS310_StandTableStruct SiS310_StandTable[]=
{0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f,
0xff}
},
-/* ExtVGATable */
+/* 0x0f: ExtVGATable - modes > 0x13 */
{
0x00,0x00,0x00,0x0000,
{0x01,0x0f,0x00,0x0e},
@@ -293,7 +294,7 @@ SiS310_StandTableStruct SiS310_StandTable[]=
{0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0f,
0xff}
},
-/* ROM_SAVEPTR */
+/* 0x10: ROM_SAVEPTR */
{
0x9f,0x3b,0x00,0x00c0,
{0x00,0x00,0x00,0x00},
@@ -308,7 +309,7 @@ SiS310_StandTableStruct SiS310_StandTable[]=
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00}
},
-/* MD_F */
+/* 0x11: MD_F */
{
0x50,0x18,0x0e,0x8000,
{0x01,0x0f,0x00,0x06},
@@ -323,7 +324,7 @@ SiS310_StandTableStruct SiS310_StandTable[]=
{0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x05,
0xff}
},
-/* MD_10 */
+/* 0x12: MD_10 */
{
0x50,0x18,0x0e,0x8000,
{0x01,0x0f,0x00,0x06},
@@ -338,7 +339,7 @@ SiS310_StandTableStruct SiS310_StandTable[]=
{0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f,
0xff}
},
-/* MD_0_350 */
+/* 0x13: MD_0_350 */
{
0x28,0x18,0x0e,0x0800,
{0x09,0x03,0x00,0x02},
@@ -353,7 +354,7 @@ SiS310_StandTableStruct SiS310_StandTable[]=
{0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
0xff}
},
-/* MD_1_350 */
+/* 0x14: MD_1_350 */
{
0x28,0x18,0x0e,0x0800,
{0x09,0x03,0x00,0x02},
@@ -368,7 +369,7 @@ SiS310_StandTableStruct SiS310_StandTable[]=
{0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
0xff}
},
-/* MD_2_350 */
+/* 0x15: MD_2_350 */
{
0x50,0x18,0x0e,0x1000,
{0x01,0x03,0x00,0x02},
@@ -383,7 +384,7 @@ SiS310_StandTableStruct SiS310_StandTable[]=
{0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
0xff}
},
-/* MD_3_350 */
+/* 0x16: MD_3_350 - mode 0x03 - 1 */
{
0x50,0x18,0x0e,0x1000,
{0x01,0x03,0x00,0x02},
@@ -398,7 +399,7 @@ SiS310_StandTableStruct SiS310_StandTable[]=
{0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
0xff}
},
-/* MD_0_1_400 */
+/* 0x17: MD_0_1_400 */
{
0x28,0x18,0x10,0x0800,
{0x08,0x03,0x00,0x02},
@@ -413,7 +414,7 @@ SiS310_StandTableStruct SiS310_StandTable[]=
{0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
0xff}
},
-/* MD_2_3_400 */
+/* 0x18: MD_2_3_400 - mode 0x03 - 2 */
{
0x50,0x18,0x10,0x1000,
{0x00,0x03,0x00,0x02},
@@ -428,7 +429,7 @@ SiS310_StandTableStruct SiS310_StandTable[]=
{0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
0xff}
},
-/* MD_7_400 */
+/* 0x19: MD_7_400 */
{
0x50,0x18,0x10,0x1000,
{0x00,0x03,0x00,0x02},
@@ -443,7 +444,7 @@ SiS310_StandTableStruct SiS310_StandTable[]=
{0x00,0x00,0x00,0x00,0x00,0x10,0x0a,0x00,
0xff}
},
-/* MD_11 */
+/* 0x1a: MD_11 */
{
0x50,0x1d,0x10,0xa000,
{0x01,0x0f,0x00,0x06},
@@ -458,7 +459,7 @@ SiS310_StandTableStruct SiS310_StandTable[]=
{0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x01,
0xff}
},
-/* ExtEGATable */
+/* 0x1b: ExtEGATable - Modes <= 0x02 */
{
0x50,0x1d,0x10,0xa000,
{0x01,0x0f,0x00,0x06},
@@ -473,7 +474,7 @@ SiS310_StandTableStruct SiS310_StandTable[]=
{0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f,
0xff}
},
-/* MD_13 */
+/* 0x1c: MD_13 */
{
0x28,0x18,0x08,0x2000,
{0x01,0x0f,0x00,0x0e},
@@ -505,7 +506,8 @@ typedef struct _SiS310_ExtStruct
UCHAR REFindex;
} SiS310_ExtStruct;
-SiS310_ExtStruct SiS310_EModeIDTable[]=
+/* TW: Checked with 650/LVDS and 650/301LVx 1.10.6s */
+static const SiS310_ExtStruct SiS310_EModeIDTable[]=
{
{0x6a,0x2212,0x0407,0x3a81,0x0102,0x08,0x07,0x00,0x00,0x07,0x00}, /* 800x600x? */
{0x2e,0x0a1b,0x0306,0x3a57,0x0101,0x08,0x06,0x00,0x00,0x05,0x08}, /* 640x480x8 */
@@ -521,14 +523,14 @@ SiS310_ExtStruct SiS310_EModeIDTable[]=
{0x34,0x2a1d,0x0a0e,0x3b8c,0x0000,0x08,0x0e,0x00,0x00,0x06,0x12}, /* 720x576x16 */
{0x35,0x0a1f,0x0a0d,0x3b85,0x0000,0x08,0x0d,0x00,0x00,0x06,0x11}, /* 720x480x32 */
{0x36,0x2a1f,0x0a0e,0x3b8c,0x0000,0x08,0x0e,0x00,0x00,0x06,0x12}, /* 720x576x32 */
- {0x37,0x0212,0x0508,0x3aab,0x0104,0x08,0x08,0x00,0x00,0x00,0x13}, /* 1024x768x? */
- {0x38,0x0a1b,0x0508,0x3aab,0x0105,0x08,0x08,0x00,0x00,0x00,0x13}, /* 1024x768x8 */
+ {0x37,0x0212,0x0508,0x3aab,0x0104,0x08,0x08,0x00,0x00,0x08,0x13}, /* 1024x768x? */
+ {0x38,0x0a1b,0x0508,0x3aab,0x0105,0x08,0x08,0x00,0x00,0x08,0x13}, /* 1024x768x8 */
/* {0x38,0x021b,0x0508,0x3aab,0x0105,0x08,0x08,0x00,0x00,0x00,0x13}, */ /* 1024x768x8 - 650/LVDS BIOS (no CRt2Mode) */
{0x3a,0x0e3b,0x0609,0x3adc,0x0107,0x08,0x09,0x00,0x00,0x00,0x1a}, /* 1280x1024x8 */
/* {0x3a,0x063b,0x0609,0x3adc,0x0107,0x08,0x09,0x00,0x00,0x00,0x1a}, */ /* 1280x1024x8 - 650/LVDS BIOS*/
- {0x3c,0x063b,0x070a,0x3af2,0x0130,0x08,0x0a,0x00,0x00,0x00,0x1e}, /* 1600x1200x8 */
+ {0x3c,0x0e3b,0x070a,0x3af2,0x0130,0x08,0x0a,0x00,0x00,0x00,0x1e}, /* 1600x1200x8 */
/* {0x3c,0x063b,0x070a,0x3af2,0x0130,0x08,0x0a,0x00,0x00,0x00,0x1e}, */ /* 1600x1200x8 - 650/LVDS BIOS */
- {0x3d,0x067d,0x070a,0x3af2,0x0131,0x08,0x0a,0x00,0x00,0x00,0x1e}, /* 1600x1200x16 */
+ {0x3d,0x067d,0x070a,0x3af2,0x0131,0x08,0x0a,0x00,0x00,0x00,0x1e}, /* 1600x1200x16 - 650/301LVx - no CRT2Mode? */
{0x40,0x9a1c,0x0000,0x3a34,0x010d,0x08,0x00,0x00,0x00,0x04,0x25},
{0x41,0x9a1d,0x0000,0x3a34,0x010e,0x08,0x00,0x00,0x00,0x04,0x25},
{0x43,0x0a1c,0x0306,0x3a57,0x0110,0x08,0x06,0x00,0x00,0x05,0x08},
@@ -536,10 +538,10 @@ SiS310_ExtStruct SiS310_EModeIDTable[]=
{0x46,0x2a1c,0x0407,0x3a81,0x0113,0x08,0x07,0x00,0x00,0x07,0x00},
{0x47,0x2a1d,0x0407,0x3a81,0x0114,0x08,0x07,0x00,0x00,0x07,0x00}, /* 800x600x16 */
{0x49,0x0a3c,0x0508,0x3aab,0x0116,0x08,0x08,0x00,0x00,0x00,0x13},
- {0x4a,0x0a3d,0x0508,0x3aab,0x0117,0x08,0x08,0x00,0x00,0x00,0x13}, /* 1024x768x16 */
+ {0x4a,0x0a3d,0x0508,0x3aab,0x0117,0x08,0x08,0x00,0x00,0x08,0x13}, /* 1024x768x16 */
{0x4c,0x0e7c,0x0609,0x3adc,0x0119,0x08,0x09,0x00,0x00,0x00,0x1a},
{0x4d,0x0e7d,0x0609,0x3adc,0x011a,0x08,0x09,0x00,0x00,0x00,0x1a}, /* 1280x1024x16 */
- {0x50,0x9a1b,0x0001,0x3a3b,0x0132,0x08,0x01,0x00,0x00,0x04,0x26},
+ {0x50,0x9a1b,0x0001,0x3a3b,0x0132,0x08,0x01,0x00,0x00,0x04,0x26}, /* 320x240 */
/* {0x50,0x921b,0x0001,0x3a3b,0x0132,0x08,0x01,0x00,0x00,0x04,0x26}, */ /* 650/LVDS BIOS */
{0x51,0xba1b,0x0103,0x3a42,0x0133,0x08,0x03,0x00,0x00,0x07,0x27},
/* {0x52,0x9a1b,0x0204,0x3a49,0x0134,0x08,0x04,0x00,0x00,0x00,0x28}, */
@@ -549,15 +551,16 @@ SiS310_ExtStruct SiS310_EModeIDTable[]=
{0x57,0xba1d,0x0103,0x3a42,0x0136,0x08,0x03,0x00,0x00,0x07,0x27},
/* {0x58,0x9a1d,0x0204,0x3a49,0x0137,0x08,0x04,0x00,0x00,0x00,0x28}, */
{0x58,0xba1d,0x0204,0x3a49,0x0137,0x08,0x04,0x00,0x00,0x00,0x28}, /* BIOS (301+LVDS) */
- {0x59,0x9a1b,0x0000,0x3a34,0x0138,0x08,0x00,0x00,0x00,0x04,0x25},
+ {0x59,0x9a1b,0x0000,0x3a34,0x0138,0x08,0x00,0x00,0x00,0x04,0x25}, /* 320x200 */
/* {0x59,0x921b,0x0000,0x3a34,0x0138,0x08,0x00,0x00,0x00,0x04,0x25}, */ /* 650/LVDS BIOS (no CRT2Mode) */
{0x5A,0x021b,0x0014,0x3b83,0x0138,0x08,0x01,0x00,0x00,0x04,0x3f}, /* 320x480x8 fstn add new mode*/
{0x5B,0x0a1d,0x0014,0x3b83,0x0135,0x08,0x01,0x00,0x00,0x04,0x3f}, /* 320x480x16 fstn add new mode*/
{0x5c,0xba1f,0x0204,0x3a49,0x0000,0x08,0x04,0x00,0x00,0x00,0x28}, /* TW: inserted 512x384x32 */
{0x5d,0x0a1d,0x0305,0x3a50,0x0139,0x08,0x05,0x00,0x00,0x07,0x10},
+ {0x5e,0x0a1f,0x0305,0x3a50,0x0000,0x08,0x05,0x00,0x00,0x07,0x10}, /* TW: Inserted 640x400x32 */
{0x62,0x0a3f,0x0306,0x3a57,0x013a,0x08,0x06,0x00,0x00,0x05,0x08}, /* 640x480x32 */
{0x63,0x2a3f,0x0407,0x3a81,0x013b,0x08,0x07,0x00,0x00,0x07,0x00}, /* 800x600x32 */
- {0x64,0x0a7f,0x0508,0x3aab,0x013c,0x08,0x08,0x00,0x00,0x00,0x13}, /* 1024x768x32 */
+ {0x64,0x0a7f,0x0508,0x3aab,0x013c,0x08,0x08,0x00,0x00,0x08,0x13}, /* 1024x768x32 */
{0x65,0x0eff,0x0609,0x3adc,0x013d,0x08,0x09,0x00,0x00,0x00,0x1a}, /* 1280x1024x32 */
{0x66,0x06ff,0x070a,0x3af2,0x013e,0x08,0x0a,0x00,0x00,0x00,0x1e}, /* 1600x1200x32 */
{0x68,0x067b,0x080b,0x3b17,0x013f,0x08,0x0b,0x00,0x00,0x00,0x29}, /* 1920x1440x8 */
@@ -587,6 +590,18 @@ SiS310_ExtStruct SiS310_EModeIDTable[]=
/* {0x26,0x063b,0x0c15,0x36fe,0x0000,0x08,0x15,0x00,0x00,0x00,0x41}, */ /* 1400x1050x8 - 650/LVDS BIOS */
{0x27,0x0e7d,0x0c15,0x36fe,0x0000,0x08,0x15,0x00,0x00,0x00,0x41}, /* 1400x1050x16 */
{0x28,0x0eff,0x0c15,0x36fe,0x0000,0x08,0x15,0x00,0x00,0x00,0x41}, /* 1400x1050x32*/
+ {0x29,0x0e1b,0x0d16,0x0000,0x0000,0x08,0x16,0x00,0x00,0x00,0x43}, /* TW: NEW 1152x864 - not in BIOS */
+ {0x2a,0x0e3d,0x0d16,0x0000,0x0000,0x08,0x16,0x00,0x00,0x00,0x43},
+ {0x2b,0x0e7f,0x0d16,0x0000,0x0000,0x08,0x16,0x00,0x00,0x00,0x43},
+ {0x39,0x2a1b,0x0b17,0x0000,0x0000,0x08,0x17,0x00,0x00,0x00,0x45}, /* TW: NEW 848x480 - not in BIOS */
+ {0x3b,0x2a3d,0x0b17,0x0000,0x0000,0x08,0x17,0x00,0x00,0x00,0x45},
+ {0x3e,0x2a7f,0x0b17,0x0000,0x0000,0x08,0x17,0x00,0x00,0x00,0x45},
+ {0x3f,0x2a1b,0x0b13,0x0000,0x0000,0x08,0x13,0x00,0x00,0x00,0x47}, /* TW: NEW 856x480 - not in BIOS */
+ {0x42,0x2a3d,0x0b13,0x0000,0x0000,0x08,0x13,0x00,0x00,0x00,0x47},
+ {0x45,0x2a7f,0x0b13,0x0000,0x0000,0x08,0x13,0x00,0x00,0x00,0x47},
+ {0x48,0x2a1b,0x0e18,0x0000,0x0000,0x08,0x18,0x00,0x00,0x00,0x49}, /* TW: NEW 1360x768 - not in BIOS */
+ {0x4b,0x2a3d,0x0e18,0x0000,0x0000,0x08,0x18,0x00,0x00,0x00,0x49},
+ {0x4e,0x2a7f,0x0e18,0x0000,0x0000,0x08,0x18,0x00,0x00,0x00,0x49},
{0xff,0x0000,0x0000,0x0000,0x0000,0x00,0x00,0x00,0x00,0x00,0x00}
};
@@ -602,7 +617,7 @@ typedef struct _SiS310_Ext2Struct
USHORT ROM_OFFSET;
} SiS310_Ext2Struct;
-SiS310_Ext2Struct SiS310_RefIndex[]=
+static const SiS310_Ext2Struct SiS310_RefIndex[]=
{
/* {0x005f,0x0d,0x03,0x05,0x6a, 800, 600,0x3a81}, 0x0 - TW: Patch for Chrontel 7019 */
{0x085f,0x0d,0x03,0x05,0x6a, 800, 600,0x3a81}, /* 0x0 */
@@ -610,28 +625,28 @@ SiS310_Ext2Struct SiS310_RefIndex[]=
{0x0067,0x0f,0x08,0x48,0x6a, 800, 600,0x3a8b}, /* 0x2 */
{0x0067,0x10,0x07,0x8b,0x6a, 800, 600,0x3a90}, /* 0x3 */
{0x0147,0x11,0x0a,0x00,0x6a, 800, 600,0x3a95}, /* 0x4 */
- {0x4147,0x12,0x0d,0x00,0x6a, 800, 600,0x3a9a}, /* 0x5 */
- {0x4047,0x13,0x13,0x00,0x6a, 800, 600,0x3a9f}, /* 0x6 */
- {0x4047,0x14,0x1c,0x00,0x6a, 800, 600,0x3aa4}, /* 0x7 */
+ {0x0147,0x12,0x0d,0x00,0x6a, 800, 600,0x3a9a}, /* 0x5 - 4147 TW: Test sync change */
+ {0x0047,0x13,0x13,0x00,0x6a, 800, 600,0x3a9f}, /* 0x6 - 4047 */
+ {0x0047,0x14,0x1c,0x00,0x6a, 800, 600,0x3aa4}, /* 0x7 - 4047 */
/* {0xc05f,0x05,0x00,0x04,0x2e, 640, 480,0x3a57}, 0x8 - TW: Patch for Chrontel 7019 */
{0xc85f,0x05,0x00,0x04,0x2e, 640, 480,0x3a57}, /* 0x8 */
{0xc067,0x06,0x02,0x04,0x2e, 640, 480,0x3a5c}, /* 0x9 */
{0xc067,0x07,0x02,0x47,0x2e, 640, 480,0x3a61}, /* 0xa */
{0xc067,0x08,0x03,0x8a,0x2e, 640, 480,0x3a66}, /* 0xb */
- {0x4047,0x09,0x05,0x00,0x2e, 640, 480,0x3a6b}, /* 0xc */
- {0x4047,0x0a,0x09,0x00,0x2e, 640, 480,0x3a70}, /* 0xd */
- {0x4047,0x0b,0x0e,0x00,0x2e, 640, 480,0x3a75}, /* 0xe */
+ {0xc047,0x09,0x05,0x00,0x2e, 640, 480,0x3a6b}, /* 0xc - 4047 */
+ {0xc047,0x0a,0x09,0x00,0x2e, 640, 480,0x3a70}, /* 0xd - 4047 */
+ {0xc047,0x0b,0x0e,0x00,0x2e, 640, 480,0x3a75}, /* 0xe - 4047 */
{0xc047,0x0c,0x15,0x00,0x2e, 640, 480,0x3a7a}, /* 0xf */
{0x407f,0x04,0x00,0x00,0x2f, 640, 400,0x3a50}, /* 0x10 */
{0xc00f,0x3c,0x01,0x06,0x31, 720, 480,0x3b85}, /* 0x11 */
{0x000f,0x3d,0x03,0x06,0x32, 720, 576,0x3b8c}, /* 0x12 */
{0x0187,0x15,0x06,0x00,0x37,1024, 768,0x3aab}, /* 0x13 */
- {0xc877,0x16,0x0b,0x06,0x37,1024, 768,0x3ab0}, /* 0x14 301b TV1024x768*/
+ {0xc877,0x16,0x0b,0x06,0x37,1024, 768,0x3ab0}, /* 0x14 */
{0xc067,0x17,0x0f,0x49,0x37,1024, 768,0x3ab5}, /* 0x15 */
{0x0267,0x18,0x11,0x00,0x37,1024, 768,0x3aba}, /* 0x16 */
{0x0047,0x19,0x16,0x8c,0x37,1024, 768,0x3abf}, /* 0x17 */
- {0x4047,0x1a,0x1b,0x00,0x37,1024, 768,0x3ac4}, /* 0x18 */
- {0x4047,0x1b,0x1f,0x00,0x37,1024, 768,0x3ac9}, /* 0x19 */
+ {0x0047,0x1a,0x1b,0x00,0x37,1024, 768,0x3ac4}, /* 0x18 - 4047 */
+ {0x0007,0x1b,0x1f,0x00,0x37,1024, 768,0x3ac9}, /* 0x19 - 4047 */
{0x0387,0x1c,0x11,0x00,0x3a,1280,1024,0x3adc}, /* 0x1a */
{0x0077,0x1d,0x19,0x07,0x3a,1280,1024,0x3ae1}, /* 0x1b */
{0x0047,0x1e,0x1e,0x00,0x3a,1280,1024,0x3ae6}, /* 0x1c */
@@ -666,20 +681,29 @@ SiS310_Ext2Struct SiS310_RefIndex[]=
{0x0047,0x37,0x16,0x09,0x71,1024, 576,0x3b6d}, /* 0x39 */
{0x0057,0x38,0x19,0x0a,0x75,1280, 720,0x3b74}, /* 0x3a */
{0x0047,0x39,0x1e,0x0a,0x75,1280, 720,0x3b79}, /* 0x3b */
- {0x0047,0x3a,0x20,0x0a,0x75,1280, 720,0x3b7e}, /* 0x3c */
- {0x0027,0x3b,0x19,0x08,0x7c,1280, 960,0x3ad0}, /* 0x3d */
- {0x0027,0x3b,0x19,0x08,0x7c,1280, 960,0x3ad5}, /* 0x3e */
+ {0x0007,0x3a,0x20,0x0a,0x75,1280, 720,0x3b7e}, /* 0x3c */
+ {0x0067,0x3b,0x19,0x08,0x7c,1280, 960,0x3ad0}, /* 0x3d */
+ {0x0027,0x4c,0x59,0x08,0x7c,1280, 960,0x3ad0}, /* 0x3e */
{0xc07f,0x01,0x00,0x06,0x5a, 320, 480,0x3b83}, /* 0x3f */ /* FSTN mode */
- {0x0077,0x42,0x12,0x07,0x23,1280, 768,0x0000}, /* 0x40 */ /* TW: 650/LVDS new mode */
- {0x0067,0x43,0x4d,0x08,0x26,1400,1050,0x0000}, /* 0x41 */ /* TW: 650/LVDS new mode */
- {0xffff,0x00,0x00,0x00,0x00,0000,0000,0x0000}
-};
+ {0x0077,0x42,0x12,0x07,0x23,1280, 768,0x0000}, /* 0x40 */ /* TW: 650/LVDS/30xLV new mode */
+ {0x0067,0x43,0x4d,0x08,0x26,1400,1050,0x0000}, /* 0x41 */ /* TW: 650/LVDS/302LV new mode */
+ {0x0007,0x4b,0x5a,0x08,0x26,1400,1050,0x0000}, /* 0x42 */ /* TW: new, not in any BIOS */
+ {0x0047,0x44,0x19,0x00,0x29,1152, 864,0x0000}, /* 0x43 TW: Non-BIOS, new */
+ {0x0047,0x4a,0x1e,0x00,0x29,1152, 864,0x0000}, /* 0x44 TW: Non-BIOS, new */
+ {0x00c7,0x45,0x57,0x00,0x39, 848, 480,0x0000}, /* 0x45 TW: 848x480-38Hzi - Non-BIOS, new */
+ {0xc047,0x46,0x55,0x00,0x39, 848, 480,0x0000}, /* 0x46 TW: 848x480-60Hz - Non-BIOS, new */
+ {0x00c7,0x47,0x57,0x00,0x3f, 856, 480,0x0000}, /* 0x47 TW: 856x480-38Hzi - Non-BIOS, new */
+ {0xc047,0x48,0x57,0x00,0x3f, 856, 480,0x0000}, /* 0x48 TW: 856x480-60Hz - Non-BIOS, new */
+ {0x0047,0x49,0x58,0x00,0x48,1360, 768,0x0000}, /* 0x49 TW: 1360x768-60Hz - Non-BIOS, new */
+ {0xffff,0x00,0x00,0x00,0x00, 0, 0,0x0000}
+};
typedef struct _SiS310_CRT1TableStruct
{
UCHAR CR[17];
} SiS310_CRT1TableStruct;
-SiS310_CRT1TableStruct SiS310_CRT1Table[]=
+
+static const SiS310_CRT1TableStruct SiS310_CRT1Table[]=
{
{{0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f,
0x9c,0x8e,0x8f,0x96,0xb9,0x30,0x00,0x00,
@@ -696,12 +720,22 @@ SiS310_CRT1TableStruct SiS310_CRT1Table[]=
{{0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,
0x9c,0x8e,0x8f,0x96,0xb9,0x30,0x00,0x05,
0x00}}, /* 0x4 */
+#if 0
{{0x5f,0x4f,0x50,0x82,0x55,0x81,0x0b,0x3e,
0xe9,0x8b,0xdf,0xe7,0x04,0x00,0x00,0x05,
0x00}}, /* 0x5 */
+#endif
+ {{0x5f,0x4f,0x4f,0x83,0x55,0x81,0x0b,0x3e, /* 0x05 - corrected 640x480-60 */
+ 0xe9,0x8b,0xdf,0xe8,0x0c,0x00,0x00,0x05,
+ 0x00}},
+#if 0
{{0x63,0x4f,0x50,0x86,0x56,0x9b,0x06,0x3e,
0xe8,0x8b,0xdf,0xe7,0xff,0x10,0x00,0x01,
0x00}}, /* 0x6 */
+#endif
+ {{0x63,0x4f,0x4f,0x87,0x56,0x9b,0x06,0x3e, /* 0x06 - corrected 640x480-72 */
+ 0xe8,0x8a,0xdf,0xe7,0x07,0x00,0x00,0x01,
+ 0x00}},
{{0x64,0x4f,0x4f,0x88,0x55,0x9d,0xf2,0x1f,
0xe0,0x83,0xdf,0xdf,0xf3,0x10,0x00,0x01,
0x00}}, /* 0x7 */
@@ -709,16 +743,16 @@ SiS310_CRT1TableStruct SiS310_CRT1Table[]=
0xe0,0x83,0xdf,0xdf,0xfc,0x10,0x00,0x05,
0x00}}, /* 0x8 */
{{0x65,0x4f,0x4f,0x89,0x58,0x80,0xfb,0x1f,
- 0xe0,0x83,0xdf,0xdf,0xfc,0x00,0x00,0x05,
+ 0xe0,0x83,0xdf,0xdf,0xfc,0x10,0x00,0x05, /* TW: Corrected VBE */
0x61}}, /* 0x9 */
{{0x65,0x4f,0x4f,0x89,0x58,0x80,0x01,0x3e,
0xe0,0x83,0xdf,0xdf,0x02,0x00,0x00,0x05,
0x61}}, /* 0xa */
{{0x67,0x4f,0x4f,0x8b,0x58,0x81,0x0d,0x3e,
- 0xe0,0x83,0xdf,0xdf,0x0e,0x10,0x00,0x05,
+ 0xe0,0x83,0xdf,0xdf,0x0e,0x00,0x00,0x05, /* TW: Corrected VBE */
0x61}}, /* 0xb */
{{0x65,0x4f,0x4f,0x89,0x57,0x9f,0xfb,0x1f,
- 0xe6,0x8a,0xe5,0xe5,0xfc,0x00,0x00,0x01,
+ 0xe6,0x8a,0xdf,0xdf,0xfc,0x10,0x00,0x01, /* TW: Corrected VDE, VBE */
0x00}}, /* 0xc */
{{0x7b,0x63,0x63,0x9f,0x6a,0x93,0x6f,0xf0,
0x58,0x8a,0x57,0x57,0x70,0x20,0x00,0x05,
@@ -826,11 +860,11 @@ SiS310_CRT1TableStruct SiS310_CRT1Table[]=
0x00,0x83,0xff,0xff,0x3e,0x0f,0x41,0x05,
0x44}}, /* 0x2f */
{{0x5d,0xff,0xff,0x81,0x19,0x95,0x41,0xba,
- 0x00,0x84,0xff,0xff,0x42,0x0f,0x41,0x05,
- 0x44}}, /* 0x30 */
+ 0x00,0x84,0xff,0xff,0x42,0x0f,0x41,0x05,
+ 0x44}}, /* 0x30 */
{{0x55,0xff,0xff,0x99,0x0d,0x0c,0x3e,0xba,
- 0x00,0x84,0xff,0xff,0x3f,0x0f,0x41,0x05,
- 0x00}}, /* 0x31 */
+ 0x00,0x84,0xff,0xff,0x3f,0x0f,0x41,0x05,
+ 0x00}}, /* 0x31 */
{{0x7f,0x63,0x63,0x83,0x6c,0x1c,0x72,0xba,
0x27,0x8b,0xdf,0xdf,0x73,0x00,0x00,0x06,
0x01}}, /* 0x32 */
@@ -846,7 +880,7 @@ SiS310_CRT1TableStruct SiS310_CRT1Table[]=
{{0x9f,0x7f,0x7f,0x83,0x85,0x91,0x1e,0xf1,
0xad,0x81,0x3f,0x3f,0x1f,0x30,0x00,0x02,
0x01}}, /* 0x36 */
- {{0xa7,0x7f,0x7f,0x88,0x89,0x15,0x26,0xf1,
+ {{0xa7,0x7f,0x7f,0x88,0x89,0x95,0x26,0xf1, /* TW: 95 was 15 - illegal HBE! */
0xb1,0x85,0x3f,0x3f,0x27,0x30,0x00,0x02,
0x01}}, /* 0x37 */
{{0xce,0x9f,0x9f,0x92,0xa9,0x17,0x28,0xc4,
@@ -858,9 +892,14 @@ SiS310_CRT1TableStruct SiS310_CRT1Table[]=
{{0xd3,0x9f,0x9f,0x97,0xab,0x1f,0x2e,0xd4,
0x7d,0x81,0xcf,0xcf,0x2f,0x21,0x00,0x07,
0x01}}, /* 0x3a */
- {{0xdc,0x9f,0x9f,0x00,0xab,0x19,0xe6,0xef,
+#if 0
+ {{0xdc,0x9f,0x9f,0x00,0xab,0x19,0xe6,0xef, /* 1280x960 - invalid */
0xc0,0xc3,0xbf,0xbf,0xe7,0x10,0x00,0x07,
0x01}}, /* 0x3b */
+#endif
+ {{0xdc,0x9f,0x9f,0x80,0xaf,0x9d,0xe6,0xff, /* 1280x960-60 - corrected */
+ 0xc0,0x83,0xbf,0xbf,0xe7,0x10,0x00,0x07,
+ 0x01}}, /* 0x3b */
{{0x6b,0x59,0x59,0x8f,0x5e,0x8c,0x0b,0x3e,
0xe9,0x8b,0xdf,0xe7,0x04,0x00,0x00,0x05,
0x00}}, /* 0x3c */
@@ -873,8 +912,7 @@ SiS310_CRT1TableStruct SiS310_CRT1Table[]=
{{0x81,0x6a,0x6a,0x85,0x70,0x00,0x0f,0x3e,
0xeb,0x8e,0xdf,0xdf,0x10,0x00,0x00,0x02,
0x00}}, /* 0x3f */
- /* TW: New from 650/LVDS BIOS */
- {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x1e,0xf1,
+ {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x1e,0xf1, /* TW: The following from 650/LVDS BIOS */
0xae,0x85,0x57,0x57,0x1f,0x30,0x00,0x02,
0x01}}, /* 0x40 */
{{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf5,
@@ -885,16 +923,44 @@ SiS310_CRT1TableStruct SiS310_CRT1Table[]=
0x01}}, /* 0x42 */
{{0xe6,0xae,0xae,0x8a,0xbd,0x90,0x3d,0x10,
0x1a,0x8d,0x19,0x19,0x3e,0x2f,0x00,0x03,
- 0x00}} /* 0x43 */
+ 0x00}}, /* 0x43 */
+ {{0xc3,0x8f,0x8f,0x87,0x9b,0x0b,0x82,0xef, /* TW: New, 1152x864-75, not in any BIOS */
+ 0x60,0x83,0x5f,0x5f,0x83,0x10,0x00,0x07,
+ 0x01}}, /* 0x44 */
+ {{0x86,0x69,0x69,0x8A,0x74,0x06,0x8C,0x15, /* TW: New, 848x480-38i, not in BIOS */
+ 0x4F,0x83,0xEF,0xEF,0x8D,0x30,0x00,0x02,
+ 0x00}}, /* 0x45 */
+ {{0x83,0x69,0x69,0x87,0x6f,0x1d,0x03,0x3E, /* TW: New, 848x480-60, not in BIOS */
+ 0xE5,0x8d,0xDF,0xe4,0x04,0x00,0x00,0x06,
+ 0x00}}, /* 0x46 */
+ {{0x86,0x6A,0x6A,0x8A,0x74,0x06,0x8C,0x15, /* TW: New, 856x480-38i, not in BIOS */
+ 0x4F,0x83,0xEF,0xEF,0x8D,0x30,0x00,0x02,
+ 0x00}}, /* 0x47 */
+ {{0x81,0x6A,0x6A,0x85,0x70,0x00,0x0F,0x3E, /* TW: New, 856x480-60, not in BIOS */
+ 0xEB,0x8E,0xDF,0xDF,0x10,0x00,0x00,0x02,
+ 0x00}}, /* 0x48 */
+ {{0xdd,0xa9,0xa9,0x81,0xb4,0x97,0x26,0xfd, /* TW: New, 1360x768-60, not in BIOS */
+ 0x01,0x8d,0xff,0x00,0x27,0x10,0x00,0x03,
+ 0x01}}, /* 0x49 */
+ {{0xd9,0x8f,0x8f,0x9d,0xba,0x0a,0x8a,0xff, /* TW: New, 1152x864-84, not in any BIOS */
+ 0x60,0x8b,0x5f,0x5f,0x8b,0x10,0x00,0x03,
+ 0x01}}, /* 0x4a */
+ {{0xea,0xae,0xae,0x8e,0xba,0x82,0x40,0x10, /* TW: New, 1400x1050-75, not in any BIOS */
+ 0x1b,0x87,0x19,0x1a,0x41,0x0f,0x00,0x03,
+ 0x00}}, /* 0x4b */
+ {{0xd3,0x9f,0x9f,0x97,0xab,0x1f,0xf1,0xff, /* TW: New, 1280x960-85, not in any BIOS */
+ 0xc0,0x83,0xbf,0xbf,0xf2,0x10,0x00,0x07,
+ 0x01}} /* 0x4c */
};
+
typedef struct _SiS310_MCLKDataStruct
{
UCHAR SR28,SR29,SR2A;
USHORT CLOCK;
} SiS310_MCLKDataStruct;
-SiS310_MCLKDataStruct SiS310_MCLKData_0_315[] =
+static const SiS310_MCLKDataStruct SiS310_MCLKData_0_315[] =
{
{ 0x3b,0x22,0x01,143}, /* TW: Was { 0x5c,0x23,0x01,166}, */
{ 0x5c,0x23,0x01,166},
@@ -906,7 +972,7 @@ SiS310_MCLKDataStruct SiS310_MCLKData_0_315[] =
{ 0x5c,0x23,0x01,166}
};
-SiS310_MCLKDataStruct SiS310_MCLKData_0_650[] = /* @ 0x54 */
+static const SiS310_MCLKDataStruct SiS310_MCLKData_0_650[] = /* @ 0x54 */
{
{ 0x5a,0x64,0x82, 66},
{ 0xb3,0x45,0x82, 83},
@@ -918,7 +984,19 @@ SiS310_MCLKDataStruct SiS310_MCLKData_0_650[] = /* @ 0x54 */
{ 0x37,0x22,0x82,133}
};
-SiS310_MCLKDataStruct SiS310_MCLKData_1[] = /* @ 0x155 */
+static const SiS310_MCLKDataStruct SiS310_MCLKData_0_330[] = /* @ 0x54 */
+{
+ { 0x5c,0x23,0x01,166},
+ { 0x5c,0x23,0x01,166},
+ { 0x7c,0x08,0x01,200},
+ { 0x79,0x06,0x01,250},
+ { 0x7c,0x08,0x01,200},
+ { 0x7c,0x08,0x01,200},
+ { 0x7c,0x08,0x01,200},
+ { 0x79,0x06,0x01,250}
+};
+
+static const SiS310_MCLKDataStruct SiS310_MCLKData_1[] = /* @ 0x155 */
{
{ 0x29,0x21,0x82,150},
{ 0x5c,0x23,0x82,166},
@@ -935,7 +1013,8 @@ typedef struct _SiS310_ECLKDataStruct
UCHAR SR2E,SR2F,SR30;
USHORT CLOCK;
} SiS310_ECLKDataStruct;
-SiS310_ECLKDataStruct SiS310_ECLKData[]=
+
+static const SiS310_ECLKDataStruct SiS310_ECLKData[]=
{
{ 0x5c,0x23,0x01,166},
{ 0x5c,0x23,0x01,166},
@@ -949,7 +1028,7 @@ typedef struct _SiS310_VCLKDataStruct
USHORT CLOCK;
} SiS310_VCLKDataStruct;
-SiS310_VCLKDataStruct SiS310_VCLKData[]=
+static const SiS310_VCLKDataStruct SiS310_VCLKData[]=
{
{ 0x1b,0xe1, 25}, /* 0x0 */ /* 650/LVDS BIOS: @ 0x5647 */
{ 0x4e,0xe4, 28}, /* 0x1 */
@@ -1016,7 +1095,6 @@ SiS310_VCLKDataStruct SiS310_VCLKData[]=
{ 0xa8,0x4c, 30}, /* 0x3e */
{ 0x20,0x26, 33}, /* 0x3f */
{ 0x31,0xc2, 39}, /* 0x40 */
- /* TW: 650/LVDS BIOS @ 0x574b new: */
{ 0x60,0x36, 30}, /* 0x41 */ /* Chrontel */
{ 0x40,0x4a, 28}, /* 0x42 */ /* Chrontel */
{ 0x9f,0x46, 44}, /* 0x43 */ /* Chrontel */
@@ -1036,7 +1114,13 @@ SiS310_VCLKDataStruct SiS310_VCLKData[]=
{ 0x54,0x46, 58}, /* 0x51 */ /* Chrontel */
{ 0x25,0x42, 61}, /* 0x52 */
{ 0x44,0x44, 66}, /* 0x53 */ /* Chrontel */
- { 0x3a,0x62, 70} /* 0x54 */ /* Chrontel */
+ { 0x3a,0x62, 70}, /* 0x54 */ /* Chrontel */
+ { 0x62,0xc6, 34}, /* 0x55 - added for 848x480-60 (not in any BIOS) */
+ { 0x6a,0xc6, 37}, /* 0x56 - added for 848x480-75 (not in any BIOS) - TEMP */
+ { 0xbf,0xc8, 35}, /* 0x57 - added for 856x480-38i,60 (not in any BIOS) */
+ { 0x30,0x23, 88}, /* 0x58 - added for 1360x768-62 (is 60Hz!) (not in any BIOS) */
+ { 0x52,0x07,149}, /* 0x59 - added for 1280x960-85 (Not in any BIOS) */
+ { 0x56,0x07,156} /* 0x5a - added for 1400x1050-75 */
};
typedef struct _SiS310_VBVCLKDataStruct
@@ -1045,7 +1129,7 @@ typedef struct _SiS310_VBVCLKDataStruct
USHORT CLOCK;
} SiS310_VBVCLKDataStruct;
-SiS310_VBVCLKDataStruct SiS310_VBVCLKData[]=
+static const SiS310_VBVCLKDataStruct SiS310_VBVCLKData[]=
{
{ 0x1b,0xe1, 25}, /* 0x0 */ /* 650/LVDS BIOS: @ 0x579c */
{ 0x4e,0xe4, 28}, /* 0x1 */
@@ -1112,19 +1196,40 @@ SiS310_VBVCLKDataStruct SiS310_VBVCLKData[]=
{ 0xa8,0x4c, 30}, /* 0x3e */
{ 0x20,0x26, 33}, /* 0x3f */
{ 0x31,0xc2, 39}, /* 0x40 */
- /* TW: 650/LVDS+301 BIOS (@ 0x58a0 in LVDS) new: */
{ 0x2e,0x48, 25}, /* 0x41 */
{ 0x24,0x46, 25}, /* 0x42 */
{ 0x26,0x64, 28}, /* 0x43 */
{ 0x37,0x64, 40}, /* 0x44 */
{ 0xa1,0x42,108}, /* 0x45 */
{ 0x37,0x61,100}, /* 0x46 */
- { 0x78,0x27,108} /* 0x47 */
- /* --- 0x58bc --- */
-};
-
-UCHAR SiS310_ScreenOffset[]= { 0x14,0x19,0x20,0x28,0x32,0x40,
- 0x50,0x64,0x78,0x80,0x2d,0x35,0x57}; /* TW: Added 1400x1050 offset */
+ { 0x78,0x27,108}, /* 0x47 */
+ { 0x97,0x2c, 26}, /* 0x48 */ /* UNUSED - Entries from here new, not in any BIOS */
+ { 0xce,0x3c, 39}, /* 0x49 */ /* UNUSED */
+ { 0x52,0x4a, 36}, /* 0x4a */ /* UNUSED */
+ { 0x34,0x61, 95}, /* 0x4b */ /* UNUSED */
+ { 0x78,0x27,108}, /* 0x4c */ /* UNUSED */
+ { 0x66,0x43,123}, /* 0x4d */ /* 1400x1050-60 */
+ { 0x41,0x4e, 21}, /* 0x4e */ /* UNUSED */
+ { 0xa1,0x4a, 29}, /* 0x4f */ /* UNUSED */
+ { 0x19,0x42, 42}, /* 0x50 */ /* UNUSED */
+ { 0x54,0x46, 58}, /* 0x51 */ /* UNUSED */
+ { 0x25,0x42, 61}, /* 0x52 */ /* UNUSED */
+ { 0x44,0x44, 66}, /* 0x53 */ /* UNUSED */
+ { 0x3a,0x62, 70}, /* 0x54 */ /* UNUSED */
+ { 0x62,0xc6, 34}, /* 0x55 */ /* 848x480-60 */
+ { 0x6a,0xc6, 37}, /* 0x56 */ /* 848x480-75 - TEMP, UNUSED */
+ { 0xbf,0xc8, 35}, /* 0x57 */ /* 856x480-38i,60 */
+ { 0x30,0x23, 88}, /* 0x58 */ /* 1360x768-62 (is 60Hz!) TEMP, UNUSED */
+ { 0x52,0x07,149}, /* 0x59 */ /* 1280x960-85 - UNUSED */
+ { 0x56,0x07,156} /* 0x5a */ /* 1400x1050-75 - UNUSED */
+};
+
+static const UCHAR SiS310_ScreenOffset[] =
+{
+ 0x14,0x19,0x20,0x28,0x32,0x40,0x50,0x64,
+ 0x78,0x80,0x2d,0x35,0x57,0x48,0x55,
+ 0xff
+}; /* TW: Added 1400x1050, 1152x864, 848/856x480, 1360x768 */
typedef struct _SiS310_StResInfoStruct
{
@@ -1132,7 +1237,7 @@ typedef struct _SiS310_StResInfoStruct
USHORT VTotal;
} SiS310_StResInfoStruct;
-SiS310_StResInfoStruct SiS310_StResInfo[]=
+static const SiS310_StResInfoStruct SiS310_StResInfo[]=
{
{ 640,400},
{ 640,350},
@@ -1149,7 +1254,7 @@ typedef struct _SiS310_ModeResInfoStruct
UCHAR YChar;
} SiS310_ModeResInfoStruct;
-SiS310_ModeResInfoStruct SiS310_ModeResInfo[]=
+static const SiS310_ModeResInfoStruct SiS310_ModeResInfo[] =
{
{ 320, 200, 8, 8}, /* 0x00 */
{ 320, 240, 8, 8}, /* 0x01 */
@@ -1170,18 +1275,19 @@ SiS310_ModeResInfoStruct SiS310_ModeResInfo[]=
{ 800, 480, 8,16}, /* 0x10 */
{ 1024, 576, 8,16}, /* 0x11 */
{ 1280, 720, 8,16}, /* 0x12 */
- { 856, 480, 8,16}, /* 0x13 19; TW: New from 650/LVDS BIOS */
- { 1280, 768, 8,16}, /* 0x14 20; TW: New from 650/LVDS BIOS */
- { 1400,1050, 8,16} /* 0x15 21; TW: New from 650/LVDS BIOS */
+ { 856, 480, 8,16}, /* 0x13 - TW: New, not in any BIOS */
+ { 1280, 768, 8,16}, /* 0x14 20; TW: New */
+ { 1400,1050, 8,16}, /* 0x15 21; TW: New */
+ { 1152, 864, 8,16}, /* 0x16 - TW: New, not in any BIOS */
+ { 848, 480, 8,16}, /* 0x17 - TW: New, not in any BIOS */
+ { 1360, 768, 8,16} /* 0x18 - TW: New, not in any BIOS */
};
-UCHAR SiS310_OutputSelect = 0x40;
-
-UCHAR SiS310_SoftSetting = 0x30; /* TW: RAM setting */
+static const UCHAR SiS310_OutputSelect = 0x40;
-UCHAR SiS310_SR07 = 0x18;
+static const UCHAR SiS310_SoftSetting = 0x30; /* TW: RAM setting */
-UCHAR SiS310_SR15[8][4]={
+static const UCHAR SiS310_SR15[8][4]={
{0x00,0x04,0x60,0x60},
{0x0f,0x0f,0x0f,0x0f},
{0xba,0xba,0xba,0xba},
@@ -1192,7 +1298,11 @@ UCHAR SiS310_SR15[8][4]={
{0x00,0xa5,0xfb,0xf6}
};
-UCHAR SiS310_CR40[5][4]={
+#ifndef LINUX_XF86
+
+static UCHAR SiS310_SR07 = 0x18;
+
+static const UCHAR SiS310_CR40[5][4]={
{0x77,0x77,0x33,0x33},
{0x77,0x77,0x33,0x33},
{0x00,0x00,0x00,0x00},
@@ -1200,34 +1310,37 @@ UCHAR SiS310_CR40[5][4]={
{0x00,0x00,0xf0,0xf8}
};
-UCHAR SiS310_CR49[] = {0xaa,0x88};
-UCHAR SiS310_SR1F = 0x0;
-UCHAR SiS310_SR21 = 0xa5;
-UCHAR SiS310_SR22 = 0xfb;
-UCHAR SiS310_SR23 = 0xf6;
-UCHAR SiS310_SR24 = 0xd;
-UCHAR SiS310_SR25[] = {0x33,0x3};
-UCHAR SiS310_SR31 = 0x00;
-UCHAR SiS310_SR32 = 0x11;
-UCHAR SiS310_SR33 = 0x00;
-UCHAR SiS310_CRT2Data_1_2 = 0x00;
-UCHAR SiS310_CRT2Data_4_D = 0x00;
-UCHAR SiS310_CRT2Data_4_E = 0x00;
-UCHAR SiS310_CRT2Data_4_10 = 0x80;
-USHORT SiS310_RGBSenseData = 0xd1;
-USHORT SiS310_VideoSenseData = 0xb9;
-USHORT SiS310_YCSenseData = 0xb3;
-USHORT SiS310_RGBSenseData2 = 0x0190; /*301b*/
-USHORT SiS310_VideoSenseData2 = 0x0174;
-USHORT SiS310_YCSenseData2 = 0x016b;
-UCHAR SiS310_NTSCPhase[] = {0x21,0xed,0xba,0x08}; /* TW: Was {0x21,0xed,0x8a,0x08}; */
-UCHAR SiS310_PALPhase[] = {0x2a,0x05,0xe3,0x00}; /* TW: Was {0x2a,0x05,0xd3,0x00}; */
-UCHAR SiS310_NTSCPhase2[] = {0x21,0xF0,0x7B,0xD6};
-UCHAR SiS310_PALPhase2[] = {0x2a,0x09,0x86,0xe9};
-UCHAR SiS310_PALMPhase[] = {0x21,0xE4,0x2E,0x9B}; /* TW: palm*/
-UCHAR SiS310_PALNPhase[] = {0x21,0xF4,0x3E,0xBA}; /* TW: paln*/
-UCHAR SiS310_PALMPhase2[] = {0x21,0xE6,0xEF,0xA4}; /* TW: palm 301b*/
-UCHAR SiS310_PALNPhase2[] = {0x21,0xF6,0x94,0x46}; /* TW: paln 301b*/
+static UCHAR SiS310_CR49[] = {0xaa,0x88};
+static UCHAR SiS310_SR1F = 0x00;
+static UCHAR SiS310_SR21 = 0xa5;
+static UCHAR SiS310_SR22 = 0xfb;
+static UCHAR SiS310_SR23 = 0xf6;
+static UCHAR SiS310_SR24 = 0x0d;
+static UCHAR SiS310_SR25[] = {0x33,0x3};
+static UCHAR SiS310_SR31 = 0x00;
+static UCHAR SiS310_SR32 = 0x11;
+static UCHAR SiS310_SR33 = 0x00;
+static UCHAR SiS310_CRT2Data_1_2 = 0x00;
+static UCHAR SiS310_CRT2Data_4_D = 0x00;
+static UCHAR SiS310_CRT2Data_4_E = 0x00;
+static UCHAR SiS310_CRT2Data_4_10 = 0x80;
+static const USHORT SiS310_RGBSenseData = 0xd1;
+static const USHORT SiS310_VideoSenseData = 0xb9;
+static const USHORT SiS310_YCSenseData = 0xb3;
+static const USHORT SiS310_RGBSenseData2 = 0x0190;
+static const USHORT SiS310_VideoSenseData2 = 0x0174;
+static const USHORT SiS310_YCSenseData2 = 0x016b;
+#endif
+
+static const UCHAR SiS310_NTSCPhase[] = {0x21,0xed,0xba,0x08}; /* TW: Was {0x21,0xed,0x8a,0x08}; */
+static const UCHAR SiS310_PALPhase[] = {0x2a,0x05,0xe3,0x00}; /* TW: Was {0x2a,0x05,0xd3,0x00}; */
+static const UCHAR SiS310_PALMPhase[] = {0x21,0xE4,0x2E,0x9B}; /* TW: palm*/
+static const UCHAR SiS310_PALNPhase[] = {0x21,0xF4,0x3E,0xBA}; /* TW: paln*/
+static const UCHAR SiS310_NTSCPhase2[] = {0x21,0xF0,0x7B,0xD6};
+static const UCHAR SiS310_PALPhase2[] = {0x2a,0x09,0x86,0xe9};
+static const UCHAR SiS310_PALMPhase2[] = {0x21,0xE6,0xEF,0xA4}; /* TW: palm 301b*/
+static const UCHAR SiS310_PALNPhase2[] = {0x21,0xF6,0x94,0x46}; /* TW: paln 301b*/
+static const UCHAR SiS310_SpecialPhase[] = {0x1e,0x8c,0x5c,0x7a};
typedef struct _SiS310_LCDDataStruct
{
@@ -1239,7 +1352,7 @@ typedef struct _SiS310_LCDDataStruct
USHORT LCDVT;
} SiS310_LCDDataStruct;
-SiS310_LCDDataStruct SiS310_StLCD1024x768Data[]=
+static const SiS310_LCDDataStruct SiS310_StLCD1024x768Data[]=
{
{ 62, 25, 800, 546,1344, 806},
{ 32, 15, 930, 546,1344, 806},
@@ -1250,7 +1363,8 @@ SiS310_LCDDataStruct SiS310_StLCD1024x768Data[]=
{ 1, 1,1344, 806,1344, 806}
};
-SiS310_LCDDataStruct SiS310_ExtLCD1024x768Data[] = /* TW: Checked */
+#if 0 /* Seems out-dated, all BIOSes since 03/27/2002 have the other version */
+static const SiS310_LCDDataStruct SiS310_ExtLCD1024x768Data[] =
{
{ 12, 5, 896, 512,1344, 806},
{ 12, 5, 896, 510,1344, 806},
@@ -1266,20 +1380,38 @@ SiS310_LCDDataStruct SiS310_ExtLCD1024x768Data[] = /* TW: Checked */
{ 42, 25,1024, 625,1344, 806},
{ 1, 1,1344, 806,1344, 806}
};
+#endif
-SiS310_LCDDataStruct SiS310_St2LCD1024x768Data[] = /* TW: Checked */
+static const SiS310_LCDDataStruct SiS310_ExtLCD1024x768Data[] =
+{
+ { 42, 25,1536, 419,1344, 806},
+ { 48, 25,1536, 369,1344, 806},
+ { 42, 25,1536, 419,1344, 806},
+ { 48, 25,1536, 369,1344, 806},
+ { 12, 5, 896, 500,1344, 806},
+ { 42, 25,1024, 625,1344, 806},
+ { 1, 1,1344, 806,1344, 806},
+ { 12, 5, 896, 500,1344, 806},
+ { 42, 25,1024, 625,1344, 806},
+ { 1, 1,1344, 806,1344, 806},
+ { 12, 5, 896, 500,1344, 806},
+ { 42, 25,1024, 625,1344, 806},
+ { 1, 1,1344, 806,1344, 806}
+
+};
+
+static const SiS310_LCDDataStruct SiS310_St2LCD1024x768Data[] =
{
{ 62, 25, 800, 546,1344, 806},
{ 32, 15, 930, 546,1344, 806},
-/* { 32, 15, 930, 546,1344, 806}, */
- { 62, 25, 800, 546,1344, 806}, /* TW: Different in 650/301LV BIOS */
+ { 62, 25, 800, 546,1344, 806},
{ 104, 45, 945, 496,1344, 806},
{ 62, 25, 800, 546,1344, 806},
{ 31, 18,1008, 624,1344, 806},
{ 1, 1,1344, 806,1344, 806}
};
-SiS310_LCDDataStruct SiS310_StLCD1280x1024Data[] =
+static const SiS310_LCDDataStruct SiS310_StLCD1280x1024Data[] =
{
{ 22, 5, 800, 510,1650,1088},
{ 22, 5, 800, 510,1650,1088},
@@ -1291,7 +1423,7 @@ SiS310_LCDDataStruct SiS310_StLCD1280x1024Data[] =
{ 1, 1,1688,1066,1688,1066}
};
-SiS310_LCDDataStruct SiS310_ExtLCD1280x1024Data[] = /* TW: Checked */
+static const SiS310_LCDDataStruct SiS310_ExtLCD1280x1024Data[] =
{
{ 211, 60,1024, 501,1688,1066},
{ 211, 60,1024, 508,1688,1066},
@@ -1300,10 +1432,11 @@ SiS310_LCDDataStruct SiS310_ExtLCD1280x1024Data[] = /* TW: Checked */
{ 211, 60,1024, 500,1688,1066},
{ 211, 75,1024, 625,1688,1066},
{ 211, 120,1280, 798,1688,1066},
- { 1, 1,1688,1066,1688,1066}
+ { 1, 1,1688,1066,1688,1066},
+ { 1, 1,1800,1000,1688,1066} /* 1280x960 - does not work, use panel scaler instead */
};
-SiS310_LCDDataStruct SiS310_St2LCD1280x1024Data[] =
+static const SiS310_LCDDataStruct SiS310_St2LCD1280x1024Data[] =
{
{ 22, 5, 800, 510,1650,1088},
{ 22, 5, 800, 510,1650,1088},
@@ -1315,29 +1448,19 @@ SiS310_LCDDataStruct SiS310_St2LCD1280x1024Data[] =
{ 1, 1,1688,1066,1688,1066}
};
-SiS310_LCDDataStruct SiS310_NoScaleData1024x768[] = /* TW: Checked */
+static const SiS310_LCDDataStruct SiS310_NoScaleData1024x768[] =
{
{ 1, 1,1344, 806,1344, 806},
{ 1, 1,1344, 806,1344, 806},
{ 1, 1,1344, 806,1344, 806},
- { 1, 1,1344, 806,1344, 806},
- { 1, 1,1344, 806,1344, 806},
+ { 1, 1,1344, 806,1344, 806}, /* 640x400 - does not work */
+ { 1, 1,1344, 806,1344, 806}, /* 640x480 - does not work */
{ 1, 1,1344, 806,1344, 806},
{ 1, 1,1344, 806,1344, 806},
{ 1, 1,1344, 806,1344, 806}
-#if 0
- { 1, 1, 800, 449, 800, 449},
- { 1, 1, 800, 449, 800, 449},
- { 1, 1, 900, 449, 900, 449},
- { 1, 1, 900, 449, 900, 449},
- { 1, 1, 800, 525, 800, 525},
- { 1, 1,1056, 628,1056, 628},
- { 1, 1,1344, 806,1344, 806},
- { 1, 1,1688,1066,1688,1066}
-#endif
};
-SiS310_LCDDataStruct SiS310_NoScaleData1280x1024[] = /* TW: New; Checked */
+static const SiS310_LCDDataStruct SiS310_NoScaleData1280x1024[] =
{
{ 1, 1,1688,1066,1688,1066},
{ 1, 1,1688,1066,1688,1066},
@@ -1346,10 +1469,11 @@ SiS310_LCDDataStruct SiS310_NoScaleData1280x1024[] = /* TW: New; Checked */
{ 1, 1,1688,1066,1688,1066},
{ 1, 1,1688,1066,1688,1066},
{ 1, 1,1688,1066,1688,1066},
+ { 1, 1,1688,1066,1688,1066},
{ 1, 1,1688,1066,1688,1066}
};
-SiS310_LCDDataStruct SiS310_LCD1280x960Data[] =
+static const SiS310_LCDDataStruct SiS310_LCD1280x960Data[] =
{
{ 9, 2, 800, 500,1800,1000},
{ 9, 2, 800, 500,1800,1000},
@@ -1362,6 +1486,60 @@ SiS310_LCDDataStruct SiS310_LCD1280x960Data[] =
{ 1, 1,1800,1000,1800,1000}
};
+static const SiS310_LCDDataStruct SiS310_StLCD1400x1050Data[] =
+{ /* TW: New from 1.11.6s */
+ { 211, 100, 2100, 408, 1688, 1066 },
+ { 211, 64, 1536, 358, 1688, 1066 },
+ { 211, 100, 2100, 408, 1688, 1066 },
+ { 211, 64, 1536, 358, 1688, 1066 },
+ { 211, 48, 840, 488, 1688, 1066 },
+ { 211, 72, 1008, 609, 1688, 1066 },
+ { 211, 128, 1400, 776, 1688, 1066 },
+ { 211, 205, 1680, 1041, 1688, 1066 },
+ { 1, 1, 1688, 1066, 1688, 1066 }
+};
+
+static const SiS310_LCDDataStruct SiS310_ExtLCD1400x1050Data[] =
+{ /* TW: New from 1.11.6s */
+ { 211, 100, 2100, 408, 1688, 1066 },
+ { 211, 64, 1536, 358, 1688, 1066 },
+ { 211, 100, 2100, 408, 1688, 1066 },
+ { 211, 64, 1536, 358, 1688, 1066 },
+ { 211, 48, 840, 488, 1688, 1066 },
+ { 211, 72, 1008, 609, 1688, 1066 },
+ { 211, 128, 1400, 776, 1688, 1066 },
+ { 211, 205, 1680, 1041, 1688, 1066 },
+ { 1, 1, 1688, 1066, 1688, 1066 }
+};
+
+static const SiS310_LCDDataStruct SiS310_NoScaleData1400x1050[] =
+{ /* TW: To be checked (BIOS uses 1280x1024 data, one line too short) */
+ { 1, 1, 1688, 1066, 1688, 1066 },
+ { 1, 1, 1688, 1066, 1688, 1066 },
+ { 1, 1, 1688, 1066, 1688, 1066 },
+ { 1, 1, 1688, 1066, 1688, 1066 },
+ { 1, 1, 1688, 1066, 1688, 1066 },
+ { 1, 1, 1688, 1066, 1688, 1066 },
+ { 1, 1, 1688, 1066, 1688, 1066 },
+ { 1, 1, 1688, 1066, 1688, 1066 },
+ { 1, 1, 1688, 1066, 1688, 1066 }
+};
+
+static const SiS310_LCDDataStruct SiS310_StLCD1600x1200Data[] =
+{ /* TODO */
+ { 0, 0, 0, 0, 0, 0}
+};
+
+static const SiS310_LCDDataStruct SiS310_ExtLCD1600x1200Data[] =
+{ /* TODO */
+ { 0, 0, 0, 0, 0, 0}
+};
+
+static const SiS310_LCDDataStruct SiS310_NoScaleData1600x1200[] =
+{ /* TODO */
+ { 0, 0, 0, 0, 0, 0}
+};
+
typedef struct _SiS310_TVDataStruct
{
USHORT RVBHCMAX;
@@ -1379,7 +1557,7 @@ typedef struct _SiS310_TVDataStruct
UCHAR RY4COE;
} SiS310_TVDataStruct;
-SiS310_TVDataStruct SiS310_StPALData[]=
+static const SiS310_TVDataStruct SiS310_StPALData[]=
{
{ 1, 1, 864, 525,1270, 400, 100, 0, 760,0xf4,0xff,0x1c,0x22},
{ 1, 1, 864, 525,1270, 350, 100, 0, 760,0xf4,0xff,0x1c,0x22},
@@ -1389,19 +1567,19 @@ SiS310_TVDataStruct SiS310_StPALData[]=
{ 1, 1, 864, 525,1270, 600, 50, 0, 0,0xf4,0xff,0x1c,0x22}
};
-SiS310_TVDataStruct SiS310_ExtPALData[]=
+static const SiS310_TVDataStruct SiS310_ExtPALData[] =
{
{ 27, 10, 848, 448,1270, 530, 50, 0, 50,0xf4,0xff,0x1c,0x22},
{ 108, 35, 848, 398,1270, 530, 50, 0, 50,0xf4,0xff,0x1c,0x22},
{ 12, 5, 954, 448,1270, 530, 50, 0, 50,0xf1,0x04,0x1f,0x18},
{ 9, 4, 960, 463,1644, 438, 50, 0, 50,0xf4,0x0b,0x1c,0x0a},
- { 9, 4, 848, 528,1270, 530, 0, 0, 50,0xf5,0xfb,0x1b,0x2a},
- { 36, 25,1060, 648,1316, 530, 438, 0, 438,0xeb,0x05,0x25,0x16},
- { 3, 2,1080, 619,1270, 540, 438, 0, 438,0xf3,0x00,0x1d,0x20},
- { 1, 1,1170, 821,1270, 520, 686, 0, 686,0xF3,0x00,0x1D,0x20} /*301b*/
+ { 9, 4, 848, 528,1270, 530, 0, 0, 50,0xf5,0xfb,0x1b,0x2a}, /* 640x480 */
+ { 36, 25,1060, 648,1316, 530, 438, 0, 438,0xeb,0x05,0x25,0x16}, /* 800x600 */
+ { 3, 2,1080, 619,1270, 540, 438, 0, 438,0xf3,0x00,0x1d,0x20}, /* 720x480/576 */
+ { 1, 1,1170, 821,1270, 520, 686, 0, 686,0xF3,0x00,0x1D,0x20} /* 1024x768 */
};
-SiS310_TVDataStruct SiS310_StNTSCData[]=
+static const SiS310_TVDataStruct SiS310_StNTSCData[]=
{
{ 1, 1, 858, 525,1270, 400, 50, 0, 760,0xf1,0x04,0x1f,0x18},
{ 1, 1, 858, 525,1270, 350, 50, 0, 640,0xf1,0x04,0x1f,0x18},
@@ -1410,35 +1588,51 @@ SiS310_TVDataStruct SiS310_StNTSCData[]=
{ 1, 1, 858, 525,1270, 480, 0, 0, 760,0xf1,0x04,0x1f,0x18}
};
-SiS310_TVDataStruct SiS310_ExtNTSCData[]=
+static const SiS310_TVDataStruct SiS310_ExtNTSCData[]=
{
{ 143, 65, 858, 443,1270, 440, 171, 0, 171,0xf1,0x04,0x1f,0x18},
{ 88, 35, 858, 393,1270, 440, 171, 0, 171,0xf1,0x04,0x1f,0x18},
{ 143, 70, 924, 443,1270, 440, 92, 0, 92,0xf1,0x04,0x1f,0x18},
{ 143, 70, 924, 393,1270, 440, 92, 0, 92,0xf4,0x0b,0x1c,0x0a},
- { 143, 76, 836, 523,1270, 440, 224, 0, 0,0xf1,0x05,0x1f,0x16},
- { 143, 120,1056, 643,1270, 440, 0, 128, 0,0xf4,0x10,0x1c,0x00},
- { 2, 1, 858, 503,1270, 480, 0, 128, 0,0xee,0x0c,0x22,0x08},
- { 65, 64,1056, 791,1270, 480, 638, 0, 0,0xEE,0x0C,0x22,0x08} /*301b*/
+ { 143, 76, 836, 523,1270, 440, 224, 0, 0,0xf1,0x05,0x1f,0x16}, /* 640x480 */
+ { 143, 120,1056, 643,1270, 440, 0, 128, 0,0xf4,0x10,0x1c,0x00}, /* 800x600 */
+ { 2, 1, 858, 503,1270, 480, 0, 128, 0,0xee,0x0c,0x22,0x08}, /* 720x480/576 */
+ { 65, 64,1056, 791,1270, 480, 638, 0, 0,0xEE,0x0C,0x22,0x08} /* 1024x768 */
};
-/* TW: These tables will need data ! */
-SiS310_TVDataStruct SiS310_St1HiTVData[]=
+#if 0
+static const SiS310_TVDataStruct SiS310_St1HiTVData[]=
{
- {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
+
};
+#endif
-SiS310_TVDataStruct SiS310_St2HiTVData[]=
+static const SiS310_TVDataStruct SiS310_St2HiTVData[]=
{
- {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
+ { 3, 1, 0x348,0x1e3,0x670,0x3c0,0x032, 0, 0, 0x00,0x00,0x00,0x00},
+ { 1, 1, 0x37c,0x233,0x2b2,0x2bc, 0, 0, 0, 0x00,0x00,0x00,0x00},
+ { 3, 1, 0x348,0x1e3,0x670,0x3c0,0x032, 0, 0, 0x00,0x00,0x00,0x00},
+ { 1, 1, 0x3e8,0x233,0x311,0x2bc, 0, 0, 0, 0x00,0x00,0x00,0x00},
+ { 5, 2, 0x348,0x233,0x670,0x3c0,0x08d,128, 0, 0x00,0x00,0x00,0x00},
+ { 8, 5, 0x41a,0x2ab,0x670,0x3c0,0x17c,128, 0, 0x00,0x00,0x00,0x00}
};
-SiS310_TVDataStruct SiS310_ExtHiTVData[]=
+static const SiS310_TVDataStruct SiS310_ExtHiTVData[]=
{
- {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
+ { 6, 1, 0x348,0x233,0x660,0x3c0, 0, 0, 0, 0x00,0x00,0x00,0x00},
+ { 3, 1, 0x3c0,0x233,0x660,0x3c0, 0, 0, 0, 0x00,0x00,0x00,0x00},
+ { 3, 1, 0x348,0x1e3,0x660,0x3c0, 0, 0, 0, 0x00,0x00,0x00,0x00},
+ { 3, 1, 0x3c0,0x233,0x660,0x3c0, 0, 0, 0, 0x00,0x00,0x00,0x00},
+ { 5, 1, 0x348,0x233,0x670,0x3c0,0x166,128, 0, 0x00,0x00,0x00,0x00},
+ { 16, 5, 0x41a,0x2ab,0x670,0x3c0,0x143,128, 0, 0x00,0x00,0x00,0x00},
+ { 25, 12, 0x4ec,0x353,0x670,0x3c0,0x032, 0, 0, 0x00,0x00,0x00,0x00},
+ { 5, 4, 0x627,0x464,0x670,0x3c0,0x128, 0, 0, 0x00,0x00,0x00,0x00},
+ { 4, 1, 0x41a,0x233,0x670,0x3c0,0x143,128, 0, 0x00,0x00,0x00,0x00},
+ { 5, 2, 0x578,0x293,0x670,0x3c0,0x032, 0, 0, 0x00,0x00,0x00,0x00},
+ { 8, 5, 0x6d6,0x323,0x670,0x3c0,0x128, 0, 0, 0x00,0x00,0x00,0x00}
};
-UCHAR SiS310_NTSCTiming[] = { /* TW: New */
+static const UCHAR SiS310_NTSCTiming[] = {
0x17,0x1d,0x03,0x09,0x05,0x06,0x0c,0x0c,
0x94,0x49,0x01,0x0a,0x06,0x0d,0x04,0x0a,
0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x1b,
@@ -1449,7 +1643,7 @@ UCHAR SiS310_NTSCTiming[] = { /* TW: New */
0x00,0x40,0x44,0x00,0xdb,0x02,0x3b,0x00
};
-UCHAR SiS310_PALTiming[] = { /* TW: New */
+static const UCHAR SiS310_PALTiming[] = {
0x19,0x52,0x35,0x6e,0x04,0x38,0x3d,0x70,
0x94,0x49,0x01,0x12,0x06,0x3e,0x35,0x6d,
0x06,0x14,0x3e,0x35,0x6d,0x00,0x45,0x2b,
@@ -1460,7 +1654,7 @@ UCHAR SiS310_PALTiming[] = { /* TW: New */
0x00,0x40,0x3e,0x00,0xe1,0x02,0x28,0x00
};
-UCHAR SiS310_HiTVExtTiming[] = { /* TW: New */
+static const UCHAR SiS310_HiTVExtTiming[] = {
0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x64,
0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d,
0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f,
@@ -1471,7 +1665,7 @@ UCHAR SiS310_HiTVExtTiming[] = { /* TW: New */
0x63,0x4f,0x27,0x00,0xfc,0xff,0x6a,0x00
};
-UCHAR SiS310_HiTVSt1Timing[] = { /* TW: New */
+static const UCHAR SiS310_HiTVSt1Timing[] = {
0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x65,
0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d,
0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f,
@@ -1482,7 +1676,7 @@ UCHAR SiS310_HiTVSt1Timing[] = { /* TW: New */
0xaf,0x5d,0x0e,0x00,0xfc,0xff,0x2d,0x00
};
-UCHAR SiS310_HiTVSt2Timing[] = { /* TW: New */
+static const UCHAR SiS310_HiTVSt2Timing[] = {
0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x64,
0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d,
0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f,
@@ -1493,7 +1687,7 @@ UCHAR SiS310_HiTVSt2Timing[] = { /* TW: New */
0x63,0x4f,0x27,0x00,0xfc,0xff,0x6a,0x00
};
-UCHAR SiS310_HiTVTextTiming[] = { /* TW: New */
+static const UCHAR SiS310_HiTVTextTiming[] = {
0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x65,
0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d,
0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f,
@@ -1504,7 +1698,7 @@ UCHAR SiS310_HiTVTextTiming[] = { /* TW: New */
0x72,0x5c,0x11,0x00,0xfc,0xff,0x32,0x00
};
-UCHAR SiS310_HiTVGroup3Data[] = { /* TW: New */
+static const UCHAR SiS310_HiTVGroup3Data[] = {
0x00,0x1a,0x22,0x63,0x62,0x22,0x08,0x5f,
0x05,0x21,0xb2,0xb2,0x55,0x77,0x2a,0xa6,
0x25,0x2f,0x47,0xfa,0xc8,0xff,0x8e,0x20,
@@ -1515,7 +1709,7 @@ UCHAR SiS310_HiTVGroup3Data[] = { /* TW: New */
0x18,0x05,0x18,0x05,0x4c,0xa8,0x01
};
-UCHAR SiS310_HiTVGroup3Simu[] = { /* TW: New */
+static const UCHAR SiS310_HiTVGroup3Simu[] = {
0x00,0x1a,0x22,0x63,0x62,0x22,0x08,0x95,
0xdb,0x20,0xb8,0xb8,0x55,0x47,0x2a,0xa6,
0x25,0x2f,0x47,0xfa,0xc8,0xff,0x8e,0x20,
@@ -1526,7 +1720,7 @@ UCHAR SiS310_HiTVGroup3Simu[] = { /* TW: New */
0x18,0x05,0x18,0x05,0x4c,0xa8,0x01
};
-UCHAR SiS310_HiTVGroup3Text[] = { /* TW: New */
+static const UCHAR SiS310_HiTVGroup3Text[] = {
0x00,0x1a,0x22,0x63,0x62,0x22,0x08,0xa7,
0xf5,0x20,0xce,0xce,0x55,0x47,0x2a,0xa6,
0x25,0x2f,0x47,0xfa,0xc8,0xff,0x8e,0x20,
@@ -1542,9 +1736,26 @@ typedef struct _SiS310_PanelDelayTblStruct
UCHAR timer[2];
} SiS310_PanelDelayTblStruct;
-SiS310_PanelDelayTblStruct SiS310_PanelDelayTbl[]= /* TW: New from 650/301LV BIOS */
-{
- {{0x28,0xc8}},
+static const SiS310_PanelDelayTblStruct SiS310_PanelDelayTbl[]=
+{
+ {{0x10,0x40}}, /* TW: from 650/301LVx 1.10.6s BIOS */
+ {{0x10,0x40}},
+ {{0x10,0x40}},
+ {{0x10,0x40}},
+ {{0x10,0x40}},
+ {{0x10,0x40}},
+ {{0x10,0x40}},
+ {{0x10,0x40}},
+ {{0x10,0x40}},
+ {{0x10,0x40}},
+ {{0x10,0x40}},
+ {{0x10,0x40}},
+ {{0x10,0x40}},
+ {{0x10,0x40}},
+ {{0x10,0x40}},
+ {{0x10,0x40}}
+#if 0
+ {{0x28,0xc8}}, /* TW: from 650/301LV BIOS */
{{0x28,0xc8}},
{{0x28,0xc8}},
{{0x28,0xc8}},
@@ -1560,9 +1771,10 @@ SiS310_PanelDelayTblStruct SiS310_PanelDelayTbl[]= /* TW: New from 650/301LV BI
{{0x28,0xc8}},
{{0x28,0xc8}},
{{0x28,0xc8}}
+#endif
};
-SiS310_PanelDelayTblStruct SiS310_PanelDelayTblLVDS[]=
+static const SiS310_PanelDelayTblStruct SiS310_PanelDelayTblLVDS[]=
{
{{0x28,0xc8}},
{{0x28,0xc8}},
@@ -1590,33 +1802,33 @@ typedef struct _SiS310_LVDSDataStruct
USHORT LCDVT;
} SiS310_LVDSDataStruct;
-SiS310_LVDSDataStruct SiS310_LVDS320x480Data_1[]=
+static const SiS310_LVDSDataStruct SiS310_LVDS320x480Data_1[]=
{
- {848, 433,400,525},
- {848, 389,400,525},
- {848, 433,400,525},
- {848, 389,400,525},
- {848, 518,400, 525},
- {1056, 628,400,525},
- {400, 525,400,525},
- {800, 449,1000, 644},
- {800, 525,1000, 635}
+ { 848, 433, 400, 525},
+ { 848, 389, 400, 525},
+ { 848, 433, 400, 525},
+ { 848, 389, 400, 525},
+ { 848, 518, 400, 525},
+ {1056, 628, 400, 525},
+ { 400, 525, 400, 525},
+ { 800, 449,1000, 644},
+ { 800, 525,1000, 635}
};
-SiS310_LVDSDataStruct SiS310_LVDS800x600Data_1[]= /* TW: New */
+static const SiS310_LVDSDataStruct SiS310_LVDS800x600Data_1[]=
{
- {848, 433,1060, 629},
- {848, 389,1060, 629},
- {848, 433,1060, 629},
- {848, 389,1060, 629},
- {848, 518,1060, 629},
+ { 848, 433,1060, 629},
+ { 848, 389,1060, 629},
+ { 848, 433,1060, 629},
+ { 848, 389,1060, 629},
+ { 848, 518,1060, 629},
{1056, 628,1056, 628},
{1056, 628,1056, 628},
- {800, 449,1000, 644},
- {800, 525,1000, 635}
+ { 800, 449,1000, 644},
+ { 800, 525,1000, 635}
};
-SiS310_LVDSDataStruct SiS310_LVDS800x600Data_2[]= /* TW: New */
+static const SiS310_LVDSDataStruct SiS310_LVDS800x600Data_2[]=
{
{1056, 628,1056, 628},
{1056, 628,1056, 628},
@@ -1625,24 +1837,24 @@ SiS310_LVDSDataStruct SiS310_LVDS800x600Data_2[]= /* TW: New */
{1056, 628,1056, 628},
{1056, 628,1056, 628},
{1056, 628,1056, 628},
- {800, 449,1000, 644},
- {800, 525,1000, 635}
+ { 800, 449,1000, 644},
+ { 800, 525,1000, 635}
};
-SiS310_LVDSDataStruct SiS310_LVDS1024x768Data_1[]= /* TW: New */
+static const SiS310_LVDSDataStruct SiS310_LVDS1024x768Data_1[]=
{
- {840, 438,1344, 806},
- {840, 409,1344, 806},
- {840, 438,1344, 806},
- {840, 409,1344, 806},
- {840, 518,1344, 806}, /* 640x480 */
+ { 840, 438,1344, 806},
+ { 840, 409,1344, 806},
+ { 840, 438,1344, 806},
+ { 840, 409,1344, 806},
+ { 840, 518,1344, 806}, /* 640x480 */
{1050, 638,1344, 806}, /* 800x600 */
{1344, 806,1344, 806}, /* 1024x768 */
- {800, 449,1280, 801},
- {800, 525,1280, 813}
+ { 800, 449,1280, 801},
+ { 800, 525,1280, 813}
};
-SiS310_LVDSDataStruct SiS310_LVDS1024x768Data_2[]= /* TW: New */
+static const SiS310_LVDSDataStruct SiS310_LVDS1024x768Data_2[]=
{
{1344, 806,1344, 806},
{1344, 806,1344, 806},
@@ -1651,25 +1863,25 @@ SiS310_LVDSDataStruct SiS310_LVDS1024x768Data_2[]= /* TW: New */
{1344, 806,1344, 806},
{1344, 806,1344, 806},
{1344, 806,1344, 806},
- {800, 449,1280, 801},
- {800, 525,1280, 813}
+ { 800, 449,1280, 801},
+ { 800, 525,1280, 813}
};
-SiS310_LVDSDataStruct SiS310_LVDS1280x1024Data_1[]= /* TW: New */
-{
- {840, 438,1344, 806},
- {840, 409,1344, 806},
- {840, 438,1344, 806},
- {840, 409,1344, 806},
- {840, 518,1344, 806},
+static const SiS310_LVDSDataStruct SiS310_LVDS1280x1024Data_1[]= /* TW: TODO */
+{ /* TW: Temp data, invalid (is identical to 1024x768) */
+ { 840, 438,1344, 806},
+ { 840, 409,1344, 806},
+ { 840, 438,1344, 806},
+ { 840, 409,1344, 806},
+ { 840, 518,1344, 806},
{1050, 638,1344, 806},
{1344, 806,1344, 806},
- {800, 449,1280, 801},
- {800, 525,1280, 813}
+ { 800, 449,1280, 801},
+ { 800, 525,1280, 813}
};
-SiS310_LVDSDataStruct SiS310_LVDS1280x1024Data_2[]= /* TW: New */
-{
+static const SiS310_LVDSDataStruct SiS310_LVDS1280x1024Data_2[]= /* TW: TODO */
+{ /* TW: Temp data, invalid (is identical to 1024x768) */
{1344, 806,1344, 806},
{1344, 806,1344, 806},
{1344, 806,1344, 806},
@@ -1677,24 +1889,24 @@ SiS310_LVDSDataStruct SiS310_LVDS1280x1024Data_2[]= /* TW: New */
{1344, 806,1344, 806},
{1344, 806,1344, 806},
{1344, 806,1344, 806},
- {800, 449,1280, 801},
- {800, 525,1280, 813}
+ { 800, 449,1280, 801},
+ { 800, 525,1280, 813}
};
-SiS310_LVDSDataStruct SiS310_LVDS1400x1050Data_1[]= /* TW: New */
+static const SiS310_LVDSDataStruct SiS310_LVDS1400x1050Data_1[]=
{
- {928, 416, 1688, 1066},
- {928, 366, 1688, 1066},
- {928, 416, 1688, 1066},
- {928, 366, 1688, 1066},
- {928, 496, 1688, 1066},
- {1088, 616, 1688, 1066},
- {1312, 784, 1688, 1066},
- {1568, 1040, 1688, 1066},
- {1688, 1066, 1688, 1066}
+ { 928, 416, 1688,1066},
+ { 928, 366, 1688,1066},
+ { 928, 416, 1688,1066},
+ { 928, 366, 1688,1066},
+ { 928, 496, 1688,1066},
+ {1088, 616, 1688,1066},
+ {1312, 784, 1688,1066},
+ {1568,1040, 1688,1066},
+ {1688,1066, 1688,1066}
};
-SiS310_LVDSDataStruct SiS310_LVDS1400x1050Data_2[]= /* TW: New */
+static const SiS310_LVDSDataStruct SiS310_LVDS1400x1050Data_2[]=
{
{1688,1066, 1688,1066},
{1688,1066, 1688,1066},
@@ -1707,102 +1919,129 @@ SiS310_LVDSDataStruct SiS310_LVDS1400x1050Data_2[]= /* TW: New */
{1688,1066, 1688,1066},
};
+static const SiS310_LVDSDataStruct SiS310_LVDS1280x768Data_1[]= /* TW: TODO */
+{ /* TW: Temp data, invalid (is identical to 1024x768) */
+ { 840, 438, 1344, 806},
+ { 840, 409, 1344, 806},
+ { 840, 438, 1344, 806},
+ { 840, 409, 1344, 806},
+ { 840, 518, 1344, 806},
+ {1050, 638, 1344, 806},
+ {1344, 806, 1344, 806},
+ { 800, 449, 1280, 801},
+ { 800, 525, 1280, 813}
+};
+
+static const SiS310_LVDSDataStruct SiS310_LVDS1280x768Data_2[]= /* TW: TODO */
+{ /* TW: Temp data, invalid (is identical to 1024x768) */
+ {1344, 806, 1344, 806},
+ {1344, 806, 1344, 806},
+ {1344, 806, 1344, 806},
+ {1344, 806, 1344, 806},
+ {1344, 806, 1344, 806},
+ {1344, 806, 1344, 806},
+ {1344, 806, 1344, 806},
+ { 800, 449, 1280, 801},
+ { 800, 525, 1280, 813}
+};
+
/* TW: New: - from 300 series */
-SiS310_LVDSDataStruct SiS310_LVDS1024x600Data_1[]=
+static const SiS310_LVDSDataStruct SiS310_LVDS1024x600Data_1[]=
{
- {840, 604,1344, 800},
- {840, 560,1344, 800},
- {840, 604,1344, 800},
- {840, 560,1344, 800},
- {840, 689,1344, 800},
- {1050, 800,1344, 800},
- {1344, 800,1344, 800},
- {800, 449,1280, 801},
- {800, 525,1280, 813}
+ { 840, 604, 1344, 800},
+ { 840, 560, 1344, 800},
+ { 840, 604, 1344, 800},
+ { 840, 560, 1344, 800},
+ { 840, 689, 1344, 800},
+ {1050, 800, 1344, 800},
+ {1344, 800, 1344, 800},
+ { 800, 449, 1280, 801},
+ { 800, 525, 1280, 813}
};
/* TW: New: - from 300 series */
-SiS310_LVDSDataStruct SiS310_LVDS1024x600Data_2[]=
+static const SiS310_LVDSDataStruct SiS310_LVDS1024x600Data_2[]=
{
- {1344, 806,1344, 806},
- {1344, 806,1344, 806},
- {1344, 806,1344, 806},
- {1344, 806,1344, 806},
- {1344, 806,1344, 806},
- {1344, 806,1344, 806},
- {1344, 806,1344, 806},
- {800, 449,1280, 801},
- {800, 525,1280, 813}
+ {1344, 800, 1344, 800},
+ {1344, 800, 1344, 800},
+ {1344, 800, 1344, 800},
+ {1344, 800, 1344, 800},
+ {1344, 800, 1344, 800},
+ {1344, 800, 1344, 800},
+ {1344, 800, 1344, 800},
+ { 800, 449, 1280, 801},
+ { 800, 525, 1280, 813}
};
/* TW: New: - from 300 series */
-SiS310_LVDSDataStruct SiS310_LVDS1152x768Data_1[]=
+static const SiS310_LVDSDataStruct SiS310_LVDS1152x768Data_1[]=
{
- {840, 438,1344, 806},
- {840, 409,1344, 806},
- {840, 438,1344, 806},
- {840, 409,1344, 806},
- {840, 518,1344, 806},
- {1050, 638,1344, 806},
- {1344, 806,1344, 806},
- {800, 449,1280, 801},
- {800, 525,1280, 813}
+ { 840, 438, 1344, 806},
+ { 840, 409, 1344, 806},
+ { 840, 438, 1344, 806},
+ { 840, 409, 1344, 806},
+ { 840, 518, 1344, 806},
+ {1050, 638, 1344, 806},
+ {1344, 806, 1344, 806},
+ { 800, 449, 1280, 801},
+ { 800, 525, 1280, 813}
};
/* TW: New: - from 300 series */
-SiS310_LVDSDataStruct SiS310_LVDS1152x768Data_2[]=
+static const SiS310_LVDSDataStruct SiS310_LVDS1152x768Data_2[]=
{
- {840, 438,1344, 806},
- {840, 409,1344, 806},
- {840, 438,1344, 806},
- {840, 409,1344, 806},
- {840, 518,1344, 806},
- {1050, 638,1344, 806},
- {1344, 806,1344, 806},
- {800, 449,1280, 801},
- {800, 525,1280, 813}
+ {1344, 806, 1344, 806},
+ {1344, 806, 1344, 806},
+ {1344, 806, 1344, 806},
+ {1344, 806, 1344, 806},
+ {1344, 806, 1344, 806},
+ {1344, 806, 1344, 806},
+ {1344, 806, 1344, 806},
+ { 800, 449, 1280, 801},
+ { 800, 525, 1280, 813}
};
-/* TW: New in 650/LVDS BIOS - resolution unknown */
-SiS310_LVDSDataStruct SiS310_LVDSXXXxXXXData_1[]= /* TW: New */
+/* TW: New in 650/LVDS BIOS - pass 1:1 data */
+static const SiS310_LVDSDataStruct SiS310_LVDSXXXxXXXData_1[]=
{
- { 800, 449, 800, 449},
- { 800, 449, 800, 449},
- { 900, 449, 900, 449},
- { 900, 449, 900, 449},
- { 800, 525, 800, 525},
- {1056, 628,1056, 628},
- {1344, 806,1344, 806},
- {1688, 806,1688, 806}
+ { 800, 449, 800, 449},
+ { 800, 449, 800, 449},
+ { 900, 449, 900, 449},
+ { 900, 449, 900, 449},
+ { 800, 525, 800, 525}, /* 640x480 */
+ {1056, 628, 1056, 628}, /* 800x600 */
+ {1344, 806, 1344, 806}, /* 1024x768 */
+ {1688, 806, 1688, 806} /* 1280x768 ! */
+ /* No other panels! */
};
-SiS310_LVDSDataStruct SiS310_LVDS640x480Data_1[]= /* TW: New */
+static const SiS310_LVDSDataStruct SiS310_LVDS640x480Data_1[]=
{
- {800, 449, 800, 449},
- {800, 449, 800, 449},
- {800, 449, 800, 449},
- {800, 449, 800, 449},
- {800, 525, 800, 525},
+ { 800, 449, 800, 449},
+ { 800, 449, 800, 449},
+ { 800, 449, 800, 449},
+ { 800, 449, 800, 449},
+ { 800, 525, 800, 525},
{1056, 628,1056, 628},
{1056, 628,1056, 628},
{1056, 628,1056, 628},
{1056, 628,1056, 628}
};
-SiS310_LVDSDataStruct SiS310_LVDS1280x960Data_1[]= /* TW: New */
+static const SiS310_LVDSDataStruct SiS310_LVDS1280x960Data_1[]=
{
- {840, 438,1344, 806},
- {840, 409,1344, 806},
- {840, 438,1344, 806},
- {840, 409,1344, 806},
- {840, 518,1344, 806},
+ { 840, 438,1344, 806},
+ { 840, 409,1344, 806},
+ { 840, 438,1344, 806},
+ { 840, 409,1344, 806},
+ { 840, 518,1344, 806},
{1050, 638,1344, 806},
{1344, 806,1344, 806},
- {800, 449,1280, 801},
- {800, 525,1280, 813}
+ { 800, 449,1280, 801},
+ { 800, 525,1280, 813}
};
-SiS310_LVDSDataStruct SiS310_LVDS1280x960Data_2[]= /* TW: New */
+static const SiS310_LVDSDataStruct SiS310_LVDS1280x960Data_2[]=
{
{1344, 806,1344, 806},
{1344, 806,1344, 806},
@@ -1811,11 +2050,114 @@ SiS310_LVDSDataStruct SiS310_LVDS1280x960Data_2[]= /* TW: New */
{1344, 806,1344, 806},
{1344, 806,1344, 806},
{1344, 806,1344, 806},
- {800, 449,1280, 801},
- {800, 525,1280, 813}
+ { 800, 449,1280, 801},
+ { 800, 525,1280, 813}
+};
+
+/* LCDA */
+
+static const SiS310_LVDSDataStruct SiS310_LCDA1400x1050Data_1[]=
+{ /* TW: Might be temporary (invalid) data */
+ { 928, 416, 1688,1066},
+ { 928, 366, 1688,1066},
+ {1008, 416, 1688,1066},
+ {1008, 366, 1688,1066},
+ {1200, 530, 1688,1066},
+ {1088, 616, 1688,1066},
+ {1312, 784, 1688,1066},
+ {1568,1040, 1688,1066},
+ {1688,1066, 1688,1066}
};
-SiS310_LVDSDataStruct SiS310_CHTVUNTSCData[]= /* TW: New */
+static const SiS310_LVDSDataStruct SiS310_LCDA1400x1050Data_2[]=
+{ /* TW: Temporary data. Not valid */
+ {1344, 806,1344, 806},
+ {1344, 806,1344, 806},
+ {1344, 806,1344, 806},
+ {1344, 806,1344, 806},
+ {1344, 806,1344, 806},
+ {1344, 806,1344, 806},
+ {1344, 806,1344, 806},
+ { 800, 449,1280, 801},
+ { 800, 525,1280, 813}
+};
+
+static const SiS310_LVDSDataStruct SiS310_LCDA1600x1200Data_1[]=
+{ /* TW: Temporary data. Not valid */
+ {1344, 806,1344, 806},
+ {1344, 806,1344, 806},
+ {1344, 806,1344, 806},
+ {1344, 806,1344, 806},
+ {1344, 806,1344, 806},
+ {1344, 806,1344, 806},
+ {1344, 806,1344, 806},
+ { 800, 449,1280, 801},
+ { 800, 525,1280, 813}
+};
+
+static const SiS310_LVDSDataStruct SiS310_LCDA1600x1200Data_2[]=
+{ /* TW: Temporary data. Not valid */
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0}
+};
+
+/* Chrontel TV */
+
+static const SiS310_LVDSDataStruct SiS310_CHTVUNTSCData[]=
+{
+ { 840, 600, 840, 600},
+ { 840, 600, 840, 600},
+ { 840, 600, 840, 600},
+ { 840, 600, 840, 600},
+ { 784, 600, 784, 600},
+ {1064, 750,1064, 750},
+ {1160, 945,1160, 945} /* TW: For Ch7019 1024 */
+};
+
+static const SiS310_LVDSDataStruct SiS310_CHTVONTSCData[]=
+{
+ { 840, 525, 840, 525},
+ { 840, 525, 840, 525},
+ { 840, 525, 840, 525},
+ { 840, 525, 840, 525},
+ { 784, 525, 784, 525},
+ {1040, 700,1040, 700},
+ {1160, 840,1160, 840} /* TW: For Ch7019 1024 */
+};
+
+static const SiS310_LVDSDataStruct SiS310_CHTVUPALData[]=
+{
+ {1008, 625,1008, 625},
+ {1008, 625,1008, 625},
+ {1008, 625,1008, 625},
+ {1008, 625,1008, 625},
+ { 840, 625, 840, 625},
+ { 960, 750, 960, 750},
+ {1400,1000,1400,1000} /* TW: For Ch7019 1024 */
+};
+
+static const SiS310_LVDSDataStruct SiS310_CHTVOPALData[]=
+{
+ {1008, 625,1008, 625},
+ {1008, 625,1008, 625},
+ {1008, 625,1008, 625},
+ {1008, 625,1008, 625},
+ { 840, 625, 840, 625},
+ { 944, 625, 944, 625},
+ {1400, 875,1400, 875} /* TW: For Ch7019 1024 */
+};
+
+static const SiS310_LVDSDataStruct SiS310_CHTVUPALMData[]=
{
{ 840, 600, 840, 600},
{ 840, 600, 840, 600},
@@ -1826,7 +2168,7 @@ SiS310_LVDSDataStruct SiS310_CHTVUNTSCData[]= /* TW: New */
{1160, 945,1160, 945} /* TW: For Ch7019 1024 */
};
-SiS310_LVDSDataStruct SiS310_CHTVONTSCData[]= /* TW: New */
+static const SiS310_LVDSDataStruct SiS310_CHTVOPALMData[]=
{
{ 840, 525, 840, 525},
{ 840, 525, 840, 525},
@@ -1837,7 +2179,7 @@ SiS310_LVDSDataStruct SiS310_CHTVONTSCData[]= /* TW: New */
{1160, 840,1160, 840} /* TW: For Ch7019 1024 */
};
-SiS310_LVDSDataStruct SiS310_CHTVUPALData[]= /* TW: New */
+static const SiS310_LVDSDataStruct SiS310_CHTVUPALNData[]=
{
{1008, 625,1008, 625},
{1008, 625,1008, 625},
@@ -1848,7 +2190,7 @@ SiS310_LVDSDataStruct SiS310_CHTVUPALData[]= /* TW: New */
{1400,1000,1400,1000} /* TW: For Ch7019 1024 */
};
-SiS310_LVDSDataStruct SiS310_CHTVOPALData[]= /* TW: New */
+static const SiS310_LVDSDataStruct SiS310_CHTVOPALNData[]=
{
{1008, 625,1008, 625},
{1008, 625,1008, 625},
@@ -1859,15 +2201,24 @@ SiS310_LVDSDataStruct SiS310_CHTVOPALData[]= /* TW: New */
{1400, 875,1400, 875} /* TW: For Ch7019 1024 */
};
+static const SiS310_LVDSDataStruct SiS310_CHTVSOPALData[]= /* TW: (super overscan - no effect on 7019) */
+{
+ {1008, 625,1008, 625},
+ {1008, 625,1008, 625},
+ {1008, 625,1008, 625},
+ {1008, 625,1008, 625},
+ { 840, 625, 840, 625},
+ { 944, 625, 944, 625},
+ {1400, 875,1400, 875}
+};
+
typedef struct _SiS310_LVDSDesStruct
{
USHORT LCDHDES;
USHORT LCDVDES;
} SiS310_LVDSDesStruct;
-/* TW: PanelType arrays taken from 650/LVDS BIOS 1.10.0 */
-
-SiS310_LVDSDesStruct SiS310_PanelType00_1[]= /* TW: New */
+static const SiS310_LVDSDesStruct SiS310_PanelType00_1[]=
{
{ 0, 0},
{ 0, 0},
@@ -1880,7 +2231,7 @@ SiS310_LVDSDesStruct SiS310_PanelType00_1[]= /* TW: New */
{ 0, 0}
};
-SiS310_LVDSDesStruct SiS310_PanelType01_1[]= /* TW: New */
+static const SiS310_LVDSDesStruct SiS310_PanelType01_1[]=
{
{ 0, 0},
{ 0, 0},
@@ -1893,7 +2244,7 @@ SiS310_LVDSDesStruct SiS310_PanelType01_1[]= /* TW: New */
{ 0, 0}
};
-SiS310_LVDSDesStruct SiS310_PanelType02_1[]= /* TW: New */
+static const SiS310_LVDSDesStruct SiS310_PanelType02_1[]=
{
{ 0, 0},
{ 0, 0},
@@ -1908,7 +2259,7 @@ SiS310_LVDSDesStruct SiS310_PanelType02_1[]= /* TW: New */
};
-SiS310_LVDSDesStruct SiS310_PanelType03_1[]= /* TW: New */
+static const SiS310_LVDSDesStruct SiS310_PanelType03_1[]=
{
{ 0, 0},
{ 0, 0},
@@ -1921,7 +2272,7 @@ SiS310_LVDSDesStruct SiS310_PanelType03_1[]= /* TW: New */
{ 0, 0}
};
-SiS310_LVDSDesStruct SiS310_PanelType04_1[]= /* TW: New */
+static const SiS310_LVDSDesStruct SiS310_PanelType04_1[]=
{
{1343, 798},
{1343, 794},
@@ -1934,7 +2285,7 @@ SiS310_LVDSDesStruct SiS310_PanelType04_1[]= /* TW: New */
{ 0, 0}
};
-SiS310_LVDSDesStruct SiS310_PanelType05_1[]= /* TW: New */
+static const SiS310_LVDSDesStruct SiS310_PanelType05_1[]=
{
{1343, 798},
{1343, 794},
@@ -1947,7 +2298,7 @@ SiS310_LVDSDesStruct SiS310_PanelType05_1[]= /* TW: New */
{ 0, 0}
};
-SiS310_LVDSDesStruct SiS310_PanelType06_1[]= /* TW: New */
+static const SiS310_LVDSDesStruct SiS310_PanelType06_1[]=
{
{1343, 798},
{1343, 794},
@@ -1960,7 +2311,7 @@ SiS310_LVDSDesStruct SiS310_PanelType06_1[]= /* TW: New */
{ 0, 0}
};
-SiS310_LVDSDesStruct SiS310_PanelType07_1[]= /* TW: New */
+static const SiS310_LVDSDesStruct SiS310_PanelType07_1[]=
{
{1343, 798},
{1343, 794},
@@ -1973,7 +2324,7 @@ SiS310_LVDSDesStruct SiS310_PanelType07_1[]= /* TW: New */
{ 0, 0}
};
-SiS310_LVDSDesStruct SiS310_PanelType08_1[]= /* TW: New */
+static const SiS310_LVDSDesStruct SiS310_PanelType08_1[]=
{
{ 0, 0},
{ 0, 0},
@@ -1988,7 +2339,7 @@ SiS310_LVDSDesStruct SiS310_PanelType08_1[]= /* TW: New */
{ 0, 0}
};
-SiS310_LVDSDesStruct SiS310_PanelType09_1[]= /* TW: New */
+static const SiS310_LVDSDesStruct SiS310_PanelType09_1[]= /* TW: To check (1280x768) */
{
{ 0, 448},
{ 0, 448},
@@ -2000,7 +2351,7 @@ SiS310_LVDSDesStruct SiS310_PanelType09_1[]= /* TW: New */
{ 0, 805},
};
-SiS310_LVDSDesStruct SiS310_PanelType0a_1[]= /* TW: New */
+static const SiS310_LVDSDesStruct SiS310_PanelType0a_1[]=
{
{1059, 626},
{1059, 624},
@@ -2013,7 +2364,7 @@ SiS310_LVDSDesStruct SiS310_PanelType0a_1[]= /* TW: New */
{ 0, 0}
};
-SiS310_LVDSDesStruct SiS310_PanelType0b_1[]= /* TW: New */
+static const SiS310_LVDSDesStruct SiS310_PanelType0b_1[]=
{
{1343, 798},
{1343, 794},
@@ -2026,7 +2377,7 @@ SiS310_LVDSDesStruct SiS310_PanelType0b_1[]= /* TW: New */
{ 0, 0}
};
-SiS310_LVDSDesStruct SiS310_PanelType0c_1[]= /* TW: New */
+static const SiS310_LVDSDesStruct SiS310_PanelType0c_1[]=
{
{1343, 798},
{1343, 794},
@@ -2039,7 +2390,7 @@ SiS310_LVDSDesStruct SiS310_PanelType0c_1[]= /* TW: New */
{ 0, 0}
};
-SiS310_LVDSDesStruct SiS310_PanelType0d_1[]= /* TW: New */
+static const SiS310_LVDSDesStruct SiS310_PanelType0d_1[]=
{
{1343, 798},
{1343, 794},
@@ -2052,7 +2403,7 @@ SiS310_LVDSDesStruct SiS310_PanelType0d_1[]= /* TW: New */
{ 0, 0}
};
-SiS310_LVDSDesStruct SiS310_PanelType0e_1[]= /* TW: New */
+static const SiS310_LVDSDesStruct SiS310_PanelType0e_1[]=
{
{1343, 798},
{1343, 794},
@@ -2065,7 +2416,7 @@ SiS310_LVDSDesStruct SiS310_PanelType0e_1[]= /* TW: New */
{ 0, 0}
};
-SiS310_LVDSDesStruct SiS310_PanelType0f_1[]= /* TW: New */
+static const SiS310_LVDSDesStruct SiS310_PanelType0f_1[]=
{
{1343, 798},
{1343, 794},
@@ -2078,7 +2429,7 @@ SiS310_LVDSDesStruct SiS310_PanelType0f_1[]= /* TW: New */
{ 0, 0}
};
-SiS310_LVDSDesStruct SiS310_PanelType00_2[]= /* TW: New */
+static const SiS310_LVDSDesStruct SiS310_PanelType00_2[]=
{
{980, 528},
{980, 503},
@@ -2091,7 +2442,7 @@ SiS310_LVDSDesStruct SiS310_PanelType00_2[]= /* TW: New */
{ 0, 0}
};
-SiS310_LVDSDesStruct SiS310_PanelType01_2[]= /* TW: New */
+static const SiS310_LVDSDesStruct SiS310_PanelType01_2[]=
{
{1152, 622},
{1152, 597},
@@ -2104,7 +2455,7 @@ SiS310_LVDSDesStruct SiS310_PanelType01_2[]= /* TW: New */
{ 0, 0}
};
-SiS310_LVDSDesStruct SiS310_PanelType02_2[]= /* TW: New */
+static const SiS310_LVDSDesStruct SiS310_PanelType02_2[]=
{
{1368, 754},
{1368, 729},
@@ -2119,7 +2470,7 @@ SiS310_LVDSDesStruct SiS310_PanelType02_2[]= /* TW: New */
{ 0, 0}
};
-SiS310_LVDSDesStruct SiS310_PanelType03_2[]= /* TW: New */
+static const SiS310_LVDSDesStruct SiS310_PanelType03_2[]=
{
{ 0, 0},
{ 0, 0},
@@ -2130,7 +2481,7 @@ SiS310_LVDSDesStruct SiS310_PanelType03_2[]= /* TW: New */
{ 0, 0}
};
-SiS310_LVDSDesStruct SiS310_PanelType04_2[]= /* TW: New */
+static const SiS310_LVDSDesStruct SiS310_PanelType04_2[]=
{
{ 0, 0},
{ 0, 0},
@@ -2143,7 +2494,7 @@ SiS310_LVDSDesStruct SiS310_PanelType04_2[]= /* TW: New */
{ 0, 0}
};
-SiS310_LVDSDesStruct SiS310_PanelType05_2[]= /* TW: New */
+static const SiS310_LVDSDesStruct SiS310_PanelType05_2[]=
{
{1152, 622},
{1152, 597},
@@ -2156,7 +2507,7 @@ SiS310_LVDSDesStruct SiS310_PanelType05_2[]= /* TW: New */
{ 0, 0}
};
-SiS310_LVDSDesStruct SiS310_PanelType06_2[]= /* TW: New */
+static const SiS310_LVDSDesStruct SiS310_PanelType06_2[]=
{
{1152, 622},
{1152, 597},
@@ -2169,7 +2520,7 @@ SiS310_LVDSDesStruct SiS310_PanelType06_2[]= /* TW: New */
{ 0, 0}
};
-SiS310_LVDSDesStruct SiS310_PanelType07_2[]= /* TW: New */
+static const SiS310_LVDSDesStruct SiS310_PanelType07_2[]=
{
{1152, 622},
{1152, 597},
@@ -2182,7 +2533,7 @@ SiS310_LVDSDesStruct SiS310_PanelType07_2[]= /* TW: New */
{ 0, 0}
};
-SiS310_LVDSDesStruct SiS310_PanelType08_2[]= /* TW: New */
+static const SiS310_LVDSDesStruct SiS310_PanelType08_2[]=
{
{976, 527},
{976, 502},
@@ -2195,7 +2546,7 @@ SiS310_LVDSDesStruct SiS310_PanelType08_2[]= /* TW: New */
{ 0, 0}
};
-SiS310_LVDSDesStruct SiS310_PanelType09_2[]= /* TW: New */
+static const SiS310_LVDSDesStruct SiS310_PanelType09_2[]= /* TW: To check (1280x768) */
{
{ 0, 0},
{ 0, 0},
@@ -2207,7 +2558,7 @@ SiS310_LVDSDesStruct SiS310_PanelType09_2[]= /* TW: New */
{ 0, 0}
};
-SiS310_LVDSDesStruct SiS310_PanelType0a_2[]= /* TW: New */
+static const SiS310_LVDSDesStruct SiS310_PanelType0a_2[]=
{
{976, 527},
{976, 502},
@@ -2220,7 +2571,7 @@ SiS310_LVDSDesStruct SiS310_PanelType0a_2[]= /* TW: New */
{ 0, 0}
};
-SiS310_LVDSDesStruct SiS310_PanelType0b_2[]= /* TW: New */
+static const SiS310_LVDSDesStruct SiS310_PanelType0b_2[]=
{
{1152, 622},
{1152, 597},
@@ -2233,7 +2584,7 @@ SiS310_LVDSDesStruct SiS310_PanelType0b_2[]= /* TW: New */
{ 0, 0}
};
-SiS310_LVDSDesStruct SiS310_PanelType0c_2[]= /* TW: New */
+static const SiS310_LVDSDesStruct SiS310_PanelType0c_2[]=
{
{1152, 622},
{1152, 597},
@@ -2246,7 +2597,7 @@ SiS310_LVDSDesStruct SiS310_PanelType0c_2[]= /* TW: New */
{ 0, 0}
};
-SiS310_LVDSDesStruct SiS310_PanelType0d_2[]= /* TW: New */
+static const SiS310_LVDSDesStruct SiS310_PanelType0d_2[]=
{
{1152, 622},
{1152, 597},
@@ -2259,7 +2610,7 @@ SiS310_LVDSDesStruct SiS310_PanelType0d_2[]= /* TW: New */
{ 0, 0}
};
-SiS310_LVDSDesStruct SiS310_PanelType0e_2[]= /* TW: New */
+static const SiS310_LVDSDesStruct SiS310_PanelType0e_2[]=
{
{1152, 622},
{1152, 597},
@@ -2272,7 +2623,7 @@ SiS310_LVDSDesStruct SiS310_PanelType0e_2[]= /* TW: New */
{ 0, 0}
};
-SiS310_LVDSDesStruct SiS310_PanelType0f_2[] = /* TW: New */
+static const SiS310_LVDSDesStruct SiS310_PanelType0f_2[] =
{
{1152, 622},
{1152, 597},
@@ -2285,8 +2636,8 @@ SiS310_LVDSDesStruct SiS310_PanelType0f_2[] = /* TW: New */
{ 0, 0}
};
-SiS310_LVDSDesStruct SiS310_PanelType1076_1[]= /* TW: New */
-{
+static const SiS310_LVDSDesStruct SiS310_PanelType1076_1[]=
+{ /* 1024x768 - Checked (1.10.6s) */
{ 0 , 0},
{ 0 , 0},
{ 0 , 0},
@@ -2298,12 +2649,12 @@ SiS310_LVDSDesStruct SiS310_PanelType1076_1[]= /* TW: New */
{ 0 , 0}
};
-SiS310_LVDSDesStruct SiS310_PanelType1076_2[]= /* TW: New */
-{
- { 1152, 622 },
- { 1152, 597 },
- { 1152, 622 },
- { 1152, 597 },
+static const SiS310_LVDSDesStruct SiS310_PanelType1076_2[]=
+{ /* 1024x768 - Checked (1.10.6s) */
+ { 1184, 622 },
+ { 1184, 597 },
+ { 1184, 622 },
+ { 1184, 597 },
{ 1152, 622 },
{ 1232, 722 },
{ 0, 0 },
@@ -2311,8 +2662,8 @@ SiS310_LVDSDesStruct SiS310_PanelType1076_2[]= /* TW: New */
{ 0, 0 }
};
-SiS310_LVDSDesStruct SiS310_PanelType1210_1[]= /* TW: New */
-{
+static const SiS310_LVDSDesStruct SiS310_PanelType1210_1[]=
+{ /* 1280x1024 - Checked (1.10.6s) */
{ 0 , 0},
{ 0 , 0},
{ 0 , 0},
@@ -2324,8 +2675,8 @@ SiS310_LVDSDesStruct SiS310_PanelType1210_1[]= /* TW: New */
{ 0 , 0}
};
-SiS310_LVDSDesStruct SiS310_PanelType1210_2[]= /* TW: New */
-{
+static const SiS310_LVDSDesStruct SiS310_PanelType1210_2[]=
+{ /* 1280x1024 - Checked (1.10.6s) */
{ 0 , 0},
{ 0 , 0},
{ 0 , 0},
@@ -2337,8 +2688,8 @@ SiS310_LVDSDesStruct SiS310_PanelType1210_2[]= /* TW: New */
{ 0 , 0}
};
-SiS310_LVDSDesStruct SiS310_PanelType1296_1[]= /* TW: New */
-{
+static const SiS310_LVDSDesStruct SiS310_PanelType1296_1[]=
+{ /* 1400x1050 - Checked (1.10.6s) */
{ 0 , 0},
{ 0 , 0},
{ 0 , 0},
@@ -2350,8 +2701,22 @@ SiS310_LVDSDesStruct SiS310_PanelType1296_1[]= /* TW: New */
{ 0 , 0}
};
-SiS310_LVDSDesStruct SiS310_PanelType1296_2[]= /* TW: New */
-{
+static const SiS310_LVDSDesStruct SiS310_PanelType1296_2[]=
+{ /* 1400x1050 - Checked (1.10.6s) - looks heavily invalid */
+ { 808 , 740},
+ { 0 , 715},
+ { 632 , 740},
+ { 632 , 715},
+ { 1307, 780},
+ { 1387,1157},
+ { 1499, 924},
+ { 1627,1052},
+ { 0 , 0}
+};
+
+static const SiS310_LVDSDesStruct SiS310_PanelType1600_1[]=
+{ /* 1600x1200 - Checked (1.10.6s) */
+ { 0 , 0},
{ 0 , 0},
{ 0 , 0},
{ 0 , 0},
@@ -2363,7 +2728,21 @@ SiS310_LVDSDesStruct SiS310_PanelType1296_2[]= /* TW: New */
{ 0 , 0}
};
-SiS310_LVDSDesStruct SiS310_CHTVUNTSCDesData[]=
+static const SiS310_LVDSDesStruct SiS310_PanelType1600_2[]=
+{ /* 1600x1200 - Checked (1.10.6s) - looks heavily invalid, not copied */
+ { 0 , 0},
+ { 0 , 0},
+ { 0 , 0},
+ { 0 , 0},
+ { 0 , 0},
+ { 0 , 0},
+ { 0 , 0},
+ { 0 , 0},
+ { 0 , 0},
+ { 0 , 0}
+};
+
+static const SiS310_LVDSDesStruct SiS310_CHTVUNTSCDesData[]=
{
{ 0, 0},
{ 0, 0},
@@ -2374,7 +2753,7 @@ SiS310_LVDSDesStruct SiS310_CHTVUNTSCDesData[]=
{ 0, 0}
};
-SiS310_LVDSDesStruct SiS310_CHTVONTSCDesData[]=
+static const SiS310_LVDSDesStruct SiS310_CHTVONTSCDesData[]=
{
{ 0, 0},
{ 0, 0},
@@ -2385,7 +2764,7 @@ SiS310_LVDSDesStruct SiS310_CHTVONTSCDesData[]=
{ 0, 0}
};
-SiS310_LVDSDesStruct SiS310_CHTVUPALDesData[]=
+static const SiS310_LVDSDesStruct SiS310_CHTVUPALDesData[]=
{
{256, 0},
{256, 0},
@@ -2396,7 +2775,7 @@ SiS310_LVDSDesStruct SiS310_CHTVUPALDesData[]=
{ 0, 0}
};
-SiS310_LVDSDesStruct SiS310_CHTVOPALDesData[]=
+static const SiS310_LVDSDesStruct SiS310_CHTVOPALDesData[]=
{
{256, 0},
{256, 0},
@@ -2412,7 +2791,7 @@ typedef struct _SiS310_Part2PortTblStruct
UCHAR CR[12];
} SiS310_Part2PortTblStruct;
-SiS310_Part2PortTblStruct SiS310_CRT2Part2_1024x768_1[] =
+static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1024x768_1[] =
{
{{0x25,0x12,0xc9,0xdc,0xb6,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}},
{{0x2c,0x12,0x9a,0xae,0x88,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}},
@@ -2421,22 +2800,50 @@ SiS310_Part2PortTblStruct SiS310_CRT2Part2_1024x768_1[] =
{{0x38,0x13,0x16,0x0c,0xe6,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}},
{{0x38,0x18,0x16,0x00,0x00,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}},
{{0x36,0x13,0x13,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}},
- {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}
-};
-
-SiS310_Part2PortTblStruct SiS310_CRT2Part2_1280x1024_1[] =
-{
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}
-};
-
-SiS310_Part2PortTblStruct SiS310_CRT2Part2_1024x768_2[] =
+ {{0x25,0x12,0xc9,0xdc,0xb6,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}
+};
+
+static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1280x1024_1[] =
+{ /* TW: Temporary data, invalid */
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}
+};
+
+static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1400x1050_1[] =
+{ /* TW: Temporary data, invalid */
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}
+};
+
+static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1600x1200_1[] =
+{ /* TW: Temporary data, invalid */
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}
+};
+
+static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1024x768_2[] =
{
{{0x25,0x12,0x51,0x6e,0x48,0x99,0x35,0x89,0x47,0xc1,0x49,0x33}},
{{0x2c,0x12,0x38,0x55,0x2f,0x99,0x35,0x89,0x47,0xc1,0x49,0x33}},
@@ -2445,10 +2852,11 @@ SiS310_Part2PortTblStruct SiS310_CRT2Part2_1024x768_2[] =
{{0x2d,0x12,0x79,0x96,0x70,0x99,0x35,0x89,0x47,0xc1,0x49,0x33}},
{{0x29,0x12,0xb5,0xd2,0xac,0xe9,0x35,0xd9,0x47,0x11,0x99,0x33}},
{{0x36,0x13,0x13,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}
};
-SiS310_Part2PortTblStruct SiS310_CRT2Part2_1280x1024_2[] =
+static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1280x1024_2[] =
{
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
@@ -2457,12 +2865,49 @@ SiS310_Part2PortTblStruct SiS310_CRT2Part2_1280x1024_2[] =
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}
};
-
-SiS310_Part2PortTblStruct SiS310_CRT2Part2_1024x768_3[] =
+static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1400x1050_2[] =
{
+ {{0x2b,0x12,0xd9,0xe5,0xd5,0x2c,0x23,0x98,0x27,0x3e,0x08,0x42}},
+ {{0x22,0x12,0xc0,0xcc,0xbc,0x2c,0x23,0x98,0x27,0x3e,0x08,0x42}},
+ {{0x2b,0x12,0xd9,0xe5,0xd5,0x2c,0x23,0x98,0x27,0x3e,0x08,0x42}},
+ {{0x22,0x12,0xc0,0xcc,0xbc,0x2c,0x23,0x98,0x27,0x3e,0x08,0x42}},
+ {{0x33,0x13,0x01,0x0d,0xfd,0x2c,0x23,0x98,0x27,0x3e,0x08,0x42}},
+ {{0x3f,0x1b,0x3d,0x49,0x39,0x54,0x23,0xc0,0x27,0x66,0x30,0x42}},
+ {{0x33,0x1b,0x91,0x9d,0x8d,0x8c,0x23,0xf8,0x27,0x9e,0x68,0x42}},
+ {{0x43,0x24,0x11,0x1d,0x0d,0xcc,0x23,0x38,0x37,0xde,0xa8,0x42}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}
+};
+
+static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1600x1200_2[] =
+{ /* TW: Temporary data, invalid */
+ {{0x2b,0x12,0xd9,0xe5,0xd5,0x2c,0x23,0x98,0x27,0x3e,0x08,0x42}},
+ {{0x22,0x12,0xc0,0xcc,0xbc,0x2c,0x23,0x98,0x27,0x3e,0x08,0x42}},
+ {{0x2b,0x12,0xd9,0xe5,0xd5,0x2c,0x23,0x98,0x27,0x3e,0x08,0x42}},
+ {{0x22,0x12,0xc0,0xcc,0xbc,0x2c,0x23,0x98,0x27,0x3e,0x08,0x42}},
+ {{0x33,0x13,0x01,0x0d,0xfd,0x2c,0x23,0x98,0x27,0x3e,0x08,0x42}},
+ {{0x3f,0x1b,0x3d,0x49,0x39,0x54,0x23,0xc0,0x27,0x66,0x30,0x42}},
+ {{0x33,0x1b,0x91,0x9d,0x8d,0x8c,0x23,0xf8,0x27,0x9e,0x68,0x42}},
+ {{0x43,0x24,0x11,0x1d,0x0d,0xcc,0x23,0x38,0x37,0xde,0xa8,0x42}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}
+};
+
+
+static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1024x768_3[] =
+{ /* TW: Data from 650/301LVx 1.10.6s */
+ {{0x25,0x13,0xc9,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}},
+ {{0x2c,0x13,0x9a,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}},
+ {{0x25,0x13,0xc9,0x24,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
+ {{0x38,0x13,0x13,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}},
+ {{0x38,0x18,0x16,0x00,0x00,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}},
+ {{0x36,0x13,0x13,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
+ {{0x25,0x13,0xc9,0x25,0xff,0xf9,0x45,0x09,0x07,0xf9,0x09,0x24}}
+#if 0 /* TW: Data from 650/301LV */
{{0x25,0x12,0xc9,0xdc,0xb6,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}},
{{0x2c,0x12,0x9a,0xae,0x88,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}},
{{0x25,0x12,0xc9,0xdc,0xb6,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}},
@@ -2471,50 +2916,84 @@ SiS310_Part2PortTblStruct SiS310_CRT2Part2_1024x768_3[] =
{{0x38,0x18,0x16,0x00,0x00,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}},
{{0x36,0x13,0x13,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}
+#endif
};
-SiS310_Part2PortTblStruct SiS310_CRT2Part2_1280x1024_3[] =
-{
- {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}
+/* 1 2 4 5 6 1c 1d 1f 20 21 23 25 */
+static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1280x1024_3[] =
+{ /* TW: Temporary data, invalid */
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}
+};
+
+static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1400x1050_3[] =
+{
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}
+};
+
+static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1600x1200_3[] =
+{ /* TW: Temporary data, invalid */
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}},
+ {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}
};
-/*add for LCDA*/
typedef struct _SiS310_LCDACRT1DataStruct
{
UCHAR CR[17];
}SiS310_LCDACRT1DataStruct;
-SiS310_LCDACRT1DataStruct SiS310_LCDACRT1800x600_1[] =
+static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT1800x600_1[] =
{
- {{0x65,0x4f,0x89,0x56,0x83,0xaf,0x1f,
- 0x90,0x85,0x8f,0xab,0x30,0x00,0x05,
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00}},
- {{0x65,0x4f,0x89,0x56,0x83,0x83,0x1f,
- 0x5e,0x83,0x5d,0x79,0x10,0x00,0x05,
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00}},
- {{0x65,0x4f,0x89,0x56,0x83,0xaf,0x1f,
- 0x90,0x85,0x8f,0xab,0x30,0x00,0x05,
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00}},
- {{0x65,0x4f,0x89,0x56,0x83,0x83,0x1f,
- 0x5e,0x83,0x5d,0x79,0x10,0x00,0x05,
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00}},
- {{0x65,0x4f,0x89,0x56,0x83,0x04,0x3e,
- 0xe0,0x85,0xdf,0xfb,0x10,0x00,0x05,
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00}},
- {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0,
- 0x58,0x8c,0x57,0x73,0x20,0x00,0x06,
- 0x01}}
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}}
};
-SiS310_LCDACRT1DataStruct SiS310_LCDACRT11024x768_1[]=
-{
+static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11024x768_1[]=
+{ /* TW: Checked (1.10.6s) */
{{0x73,0x4f,0x4f,0x97,0x55,0x86,0xc4,0x1f,
0x92,0x89,0x8f,0x8f,0xb5,0x30,0x00,0x05,
0x00}},
@@ -2538,253 +3017,534 @@ SiS310_LCDACRT1DataStruct SiS310_LCDACRT11024x768_1[]=
0x01}}
};
-SiS310_LCDACRT1DataStruct SiS310_LCDACRT11280x1024_1[]=
-{
- {{0x63,0x4f,0x87,0x54,0x9f,0xb4,0x1f,
- 0x92,0x89,0x8f,0xb5,0x30,0x00,0x01,
+static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11280x1024_1[]=
+{ /* Checked (1.10.6s) */
+ {{0x7e,0x4f,0x4f,0x82,0x58,0x06,0xb8,0x1f,
+ 0x90,0x84,0x8f,0x8f,0xb9,0x30,0x00,0x06,
0x00}},
- {{0x63,0x4f,0x87,0x54,0x9f,0x82,0x1f,
- 0x60,0x87,0x5d,0x83,0x10,0x00,0x01,
+ {{0x7e,0x4f,0x4f,0x82,0x58,0x06,0x86,0x1f,
+ 0x5e,0x82,0x5d,0x5d,0x87,0x10,0x00,0x06,
0x00}},
- {{0x63,0x4f,0x87,0x54,0x9f,0xb4,0x1f,
- 0x92,0x89,0x8f,0xb5,0x30,0x00,0x01,
+ {{0x7e,0x4f,0x4f,0x82,0x58,0x06,0xb8,0x1f,
+ 0x90,0x84,0x8f,0x8f,0xb9,0x30,0x00,0x06,
0x00}},
- {{0x63,0x4f,0x87,0x54,0x9f,0x82,0x1f,
- 0x60,0x87,0x5d,0x83,0x10,0x00,0x01,
+ {{0x7e,0x4f,0x4f,0x82,0x58,0x06,0x86,0x1f,
+ 0x5e,0x82,0x5d,0x5d,0x87,0x10,0x00,0x06,
0x00}},
- {{0x63,0x4f,0x87,0x54,0x9f,0x04,0x3e,
- 0xe2,0x89,0xdf,0x05,0x00,0x00,0x01,
+ {{0x7e,0x4f,0x4f,0x82,0x58,0x06,0x08,0x3e,
+ 0xe0,0x84,0xdf,0xdf,0x09,0x00,0x00,0x06,
0x00}},
- {{0x7e,0x63,0x82,0x68,0x15,0x7c,0xf0,
- 0x5a,0x8f,0x57,0x7d,0x20,0x00,0x26,
+ {{0x92,0x63,0x63,0x96,0x6c,0x1a,0x80,0xf0,
+ 0x58,0x8c,0x57,0x57,0x81,0x20,0x00,0x06,
0x01}},
- {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5,
- 0x02,0x88,0xff,0x25,0x10,0x00,0x02,
+ {{0xae,0x7f,0x7f,0x92,0x88,0x96,0x28,0xf5,
+ 0x00,0x84,0xff,0xff,0x29,0x10,0x00,0x02,
+ 0x01}},
+ {{0xce,0x9f,0x9f,0x92,0xa8,0x16,0x28,0x5a,
+ 0x00,0x84,0xff,0xff,0x29,0x01,0x00,0x07,
0x01}}
};
-SiS310_LCDACRT1DataStruct SiS310_LCDACRT1800x600_1_H[]=
-{
- {{0x30,0x27,0x94,0x2c,0x92,0xaf,0x1f,
- 0x90,0x85,0x8f,0xab,0x30,0x00,0x04,
+static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11400x1050_1[]=
+{ /* Checked (1.10.6s) */
+ {{0x6f,0x4f,0x4f,0x93,0x54,0x82,0x9e,0x1f,
+ 0x93,0x86,0x8f,0x8f,0x9f,0x30,0x00,0x05,
0x00}},
- {{0x30,0x27,0x94,0x2c,0x92,0x83,0x1f,
- 0x5e,0x83,0x5d,0x79,0x10,0x00,0x04,
+ {{0x6f,0x4f,0x4f,0x93,0x54,0x82,0x6c,0x1f,
+ 0x60,0x84,0x5d,0x5d,0x6d,0x10,0x00,0x05,
0x00}},
- {{0x30,0x27,0x94,0x2c,0x92,0xaf,0x1f,
- 0x90,0x85,0x8f,0xab,0x30,0x00,0x04,
+ {{0x6f,0x4f,0x4f,0x93,0x54,0x82,0x9e,0x1f,
+ 0x93,0x86,0x8f,0x8f,0x9f,0x30,0x00,0x05,
0x00}},
- {{0x30,0x27,0x94,0x2c,0x92,0x83,0x1f,
- 0x5e,0x83,0x5d,0x79,0x10,0x00,0x04,
+ {{0x6f,0x4f,0x4f,0x93,0x54,0x82,0x6c,0x1f,
+ 0x60,0x84,0x5d,0x5d,0x6d,0x10,0x00,0x05,
0x00}},
- {{0x30,0x27,0x94,0x2c,0x92,0x04,0x3e,
- 0xe0,0x85,0xdf,0xfb,0x10,0x00,0x04,
+ {{0x6f,0x4f,0x4f,0x93,0x54,0x82,0xee,0x1f,
+ 0xe2,0x86,0xdf,0xdf,0xef,0x10,0x00,0x05,
0x00}},
- {{0x3d,0x31,0x81,0x37,0x1f,0x72,0xf0,
- 0x58,0x8c,0x57,0x73,0x20,0x00,0x05,
- 0x01}}
+ {{0x83,0x63,0x63,0x87,0x68,0x16,0x66,0xf0,
+ 0x5a,0x8e,0x57,0x57,0x67,0x20,0x00,0x06,
+ 0x01}},
+ {{0x9f,0x7f,0x7f,0x83,0x84,0x92,0x0e,0xf5,
+ 0x02,0x86,0xff,0xff,0x0f,0x10,0x00,0x02,
+ 0x01}},
+ {{0xbf,0x9f,0x9f,0x83,0xa4,0x12,0x0e,0x5a,
+ 0x02,0x86,0xff,0xff,0x0f,0x09,0x00,0x07,
+ 0x01}},
+ {{0xce,0xae,0xae,0x92,0xb3,0x01,0x28,0x10,
+ 0x1a,0x80,0x19,0x19,0x29,0x0f,0x00,0x03,
+ 0x00}}
+};
+
+static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11600x1200_1[]=
+{ /* MISSING */
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}}
};
-SiS310_LCDACRT1DataStruct SiS310_LCDACRT11024x768_1_H[]=
+static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT1800x600_1_H[]=
{
- {{0x37,0x27,0x27,0x9B,0x2b,0x94,0xc4,0x1f,
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}}
+};
+
+static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11024x768_1_H[]=
+{ /* TW: Checked (1.10.6s) */
+ {{0x4b,0x27,0x27,0x8f,0x2b,0x03,0xc4,0x1f,
0x92,0x89,0x8f,0x8f,0xb5,0x30,0x00,0x44,
0x00}},
- {{0x37,0x27,0x27,0x9B,0x2b,0x94,0x97,0x1f,
+ {{0x4b,0x27,0x27,0x8f,0x2b,0x03,0x97,0x1f,
0x60,0x87,0x5D,0x5D,0x83,0x01,0x00,0x44,
0x00}},
- {{0x37,0x27,0x27,0x9B,0x2b,0x94,0xc4,0x1f,
+ {{0x4b,0x27,0x27,0x8f,0x2b,0x03,0xc4,0x1f,
0x92,0x89,0x8f,0x8f,0xb5,0x30,0x00,0x44,
0x00}},
- {{0x37,0x27,0x27,0x9B,0x2b,0x94,0x97,0x1f,
+ {{0x4b,0x27,0x27,0x8f,0x2b,0x03,0x97,0x1f,
0x60,0x87,0x5D,0x5D,0x83,0x01,0x00,0x44,
0x00}},
- {{0x37,0x27,0x27,0x9B,0x2b,0x94,0x04,0x3e,
- 0xE2,0x89,0xDf,0xDf,0x05,0x00,0x00,0x44,
+ {{0x4b,0x27,0x27,0x8f,0x32,0x1b,0x04,0x3e,
+ 0xE2,0x89,0xDf,0xDf,0x05,0x00,0x00,0x45,
0x00}},
- {{0x41,0x31,0x31,0x85,0x35,0x1d,0x7c,0xf0,
+ {{0x55,0x31,0x31,0x99,0x46,0x1d,0x7c,0xf0,
0x5A,0x8F,0x57,0x57,0x7D,0x20,0x00,0x55,
0x01}},
- {{0x4f,0x3F,0x3F,0x93,0x45,0x0D,0x24,0xf5,
+ {{0x63,0x3F,0x3F,0x87,0x4a,0x93,0x24,0xf5,
0x02,0x88,0xFf,0xFf,0x25,0x10,0x00,0x01,
0x01}}
};
-SiS310_LCDACRT1DataStruct SiS310_LCDACRT11280x1024_1_H[]=
-{
- {{0x2f,0x27,0x93,0x2b,0x90,0xb4,0x1f,
- 0x92,0x89,0x8f,0xb5,0x30,0x00,0x04,
- 0x00}},
-{{0x2f,0x27,0x93,0x2b,0x90,0x82,0x1f,
- 0x60,0x87,0x5d,0x83,0x10,0x00,0x04,
- 0x00}},
- {{0x2f,0x27,0x93,0x2b,0x90,0xb4,0x1f,
- 0x92,0x89,0x8f,0xb5,0x30,0x00,0x04,
+static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11280x1024_1_H[]=
+{ /* Checked (1.10.6s) */
+ {{0x56,0x27,0x27,0x9a,0x30,0x1e,0xb8,0x1f,
+ 0x90,0x84,0x8f,0x8f,0xb9,0x30,0x00,0x05,
0x00}},
- {{0x2f,0x27,0x93,0x2b,0x90,0x82,0x1f,
- 0x60,0x87,0x5d,0x83,0x10,0x00,0x04,
+ {{0x3c,0x4f,0x4f,0x82,0x58,0x06,0x86,0xd1, /* <-- Invalid data - one byte missing in BIOS */
+ 0xbc,0x80,0xbb,0xbb,0xe5,0x00,0x00,0x06,
+ 0x01}},
+ {{0x56,0x27,0x27,0x9a,0x30,0x1e,0xb8,0x1f,
+ 0x90,0x84,0x8f,0x8f,0xb9,0x30,0x00,0x05,
0x00}},
- {{0x2f,0x27,0x93,0x2b,0x90,0x04,0x3e,
- 0xe2,0x89,0xdf,0x05,0x00,0x00,0x04,
+ {{0x3c,0x4f,0x4f,0x82,0x58,0x06,0x86,0xd1,
+ 0xbc,0x80,0xbb,0xbb,0xe5,0x00,0x00,0x06,
+ 0x01}},
+ {{0x56,0x27,0x27,0x9a,0x30,0x1e,0x08,0x3e,
+ 0xe0,0x84,0xdf,0xdf,0x09,0x00,0x00,0x05,
0x00}},
- {{0x3c,0x31,0x80,0x35,0x1c,0x7c,0xf0,
- 0x5a,0x8f,0x57,0x7d,0x20,0x00,0x55,
+ {{0x60,0x31,0x31,0x84,0x3a,0x88,0x80,0xf0,
+ 0x58,0x8c,0x57,0x57,0x81,0x20,0x00,0x01,
0x01}},
- {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5,
- 0x02,0x88,0xff,0x25,0x10,0x00,0x01,
+ {{0x6e,0x3f,0x3f,0x92,0x48,0x96,0x28,0xf5,
+ 0x00,0x84,0xff,0xff,0x29,0x10,0x00,0x01,
0x01}}
};
-SiS310_LCDACRT1DataStruct SiS310_LCDACRT1800x600_2[]=
-{
- {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e,
- 0xf4,0x88,0x8f,0x73,0x20,0x00,0x06,
+static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11400x1050_1_H[]=
+{ /* Checked (1.10.6s) */
+ {{0x47,0x27,0x27,0x8b,0x2c,0x1a,0x9e,0x1f,
+ 0x93,0x86,0x8f,0x8f,0x9f,0x30,0x00,0x05,
+ 0x00}},
+ {{0x47,0x27,0x27,0x8b,0x2c,0x1a,0x6c,0x1f,
+ 0x60,0x84,0x5d,0x5d,0x6d,0x10,0x00,0x05,
+ 0x00}},
+ {{0x47,0x27,0x27,0x8b,0x30,0x1e,0x9e,0x1f,
+ 0x92,0x86,0x8f,0x8f,0x9f,0x30,0x00,0x05,
+ 0x00}},
+ {{0x47,0x27,0x27,0x8b,0x2c,0x1a,0x6c,0x1f,
+ 0x60,0x84,0x5d,0x5d,0x6d,0x10,0x00,0x05,
+ 0x00}},
+ {{0x47,0x27,0x27,0x8b,0x2c,0x1a,0xee,0x1f,
+ 0xe2,0x86,0xdf,0xdf,0xef,0x10,0x00,0x05,
+ 0x00}},
+ {{0x51,0x31,0x31,0x95,0x36,0x04,0x66,0xf0,
+ 0x5a,0x8e,0x57,0x57,0x67,0x20,0x00,0x01,
+ 0x01}},
+ {{0x5f,0x3f,0x3f,0x83,0x44,0x92,0x0e,0xf5,
+ 0x02,0x86,0xff,0xff,0x0f,0x10,0x00,0x01,
+ 0x01}},
+ {{0x6f,0x4f,0x4f,0x93,0x54,0x82,0x0e,0x5a,
+ 0x02,0x86,0xff,0xff,0x0f,0x09,0x00,0x05,
+ 0x01}},
+ {{0x76,0x56,0x56,0x9a,0x5b,0x89,0x28,0x10,
+ 0x1c,0x80,0x19,0x19,0x29,0x0b,0x00,0x05,
+ 0x00}}
+};
+
+static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11600x1200_1_H[]=
+{ /* MISSING */
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00}},
- {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e,
- 0xdb,0x8f,0x5d,0x73,0x20,0x00,0x06,
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00}},
- {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e,
- 0xf4,0x88,0x8f,0x73,0x20,0x00,0x06,
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00}},
- {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e,
- 0xdb,0x8f,0x5d,0x73,0x20,0x00,0x06,
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00}},
- {{0x7f,0x4f,0x83,0x62,0x12,0x72,0xba,
- 0x1c,0x80,0xdf,0x73,0x00,0x00,0x06,
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00}},
- {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0,
- 0x58,0x8c,0x57,0x73,0x20,0x00,0x06,
- 0x01}}
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}}
};
-SiS310_LCDACRT1DataStruct SiS310_LCDACRT11024x768_2[]=
-{
- {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb,
- 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06,
+static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT1800x600_2[]=
+{
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00}},
- {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb,
- 0x31,0x87,0x5d,0x25,0x30,0x00,0x06,
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00}},
- {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb,
- 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06,
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00}},
- {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb,
- 0x31,0x87,0x5d,0x25,0x30,0x00,0x06,
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00}},
- {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb,
- 0x72,0x88,0xdf,0x25,0x30,0x00,0x06,
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00}},
- {{0xa3,0x63,0x87,0x78,0x89,0x24,0xf1,
- 0xae,0x84,0x57,0x25,0x30,0x00,0x02,
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}}
+};
+
+static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11024x768_2[]=
+{ /* Checked (1.10.6s) */
+ {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb,
+ 0x4a,0x80,0x8f,0x8f,0x25,0x30,0x00,0x06,
+ 0x00}},
+ {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb,
+ 0x31,0x87,0x5d,0x5d,0x25,0x30,0x00,0x06,
+ 0x00}},
+ {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb,
+ 0x4a,0x80,0x8f,0x8f,0x25,0x30,0x00,0x06,
+ 0x00}},
+ {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb,
+ 0x31,0x87,0x5d,0x5d,0x25,0x30,0x00,0x06,
+ 0x00}},
+ {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb,
+ 0x72,0x88,0xdf,0xdf,0x25,0x30,0x00,0x06,
+ 0x00}},
+ {{0xa3,0x63,0x63,0x87,0x78,0x89,0x24,0xf1,
+ 0xae,0x84,0x57,0x57,0x25,0x30,0x00,0x02,
0x01}},
- {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5,
- 0x02,0x88,0xff,0x25,0x10,0x00,0x02,
+ {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf5,
+ 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x02,
0x01}}
};
-SiS310_LCDACRT1DataStruct SiS310_LCDACRT11280x1024_2[]=
-{
- {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb,
- 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06,
+static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11280x1024_2[]=
+{ /* Checked (1.10.6s) */
+ {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb,
+ 0x4a,0x80,0x8f,0x8f,0x25,0x30,0x00,0x06,
0x00}},
- {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb,
- 0x31,0x87,0x5d,0x25,0x30,0x00,0x06,
+ {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb,
+ 0x31,0x87,0x5d,0x5d,0x25,0x30,0x00,0x06,
0x00}},
- {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb,
- 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06,
+ {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb,
+ 0x4a,0x80,0x8f,0x8f,0x25,0x30,0x00,0x06,
0x00}},
- {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb,
- 0x31,0x87,0x5d,0x25,0x30,0x00,0x06,
+ {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb,
+ 0x31,0x87,0x5d,0x5d,0x25,0x30,0x00,0x06,
0x00}},
- {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb,
- 0x72,0x88,0xdf,0x25,0x30,0x00,0x06,
+ {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb,
+ 0x72,0x88,0xdf,0xdf,0x25,0x30,0x00,0x06,
0x00}},
- {{0xa3,0x63,0x87,0x78,0x89,0x24,0xf1,
- 0xae,0x84,0x57,0x25,0x30,0x00,0x02,
+ {{0xa3,0x63,0x63,0x87,0x78,0x89,0x24,0xf1,
+ 0xae,0x84,0x57,0x57,0x25,0x30,0x00,0x02,
0x01}},
- {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5,
- 0x02,0x88,0xff,0x25,0x10,0x00,0x02,
+ {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf5,
+ 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x02,
0x01}}
};
-SiS310_LCDACRT1DataStruct SiS310_LCDACRT1800x600_2_H[]=
-{
- {{0x3d,0x27,0x81,0x32,0x1a,0x72,0x3e,
- 0xf4,0x88,0x8f,0x73,0x20,0x00,0x05,
+static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11400x1050_2[]=
+{ /* Checked (1.10.6s) */
+ {{0xce,0x4f,0x4f,0x92,0x8c,0x1a,0x28,0x9a,
+ 0xdb,0x8f,0x8f,0x8f,0x29,0x21,0x00,0x03,
0x00}},
- {{0x3d,0x27,0x81,0x32,0x1a,0x72,0x3e,
- 0xdb,0x8f,0x5d,0x73,0x20,0x00,0x05,
+ {{0xce,0x4f,0x4f,0x92,0x8c,0x1a,0x28,0x9a,
+ 0xc2,0x86,0x5d,0x5d,0x29,0x01,0x00,0x03,
+ 0x01}},
+ {{0xce,0x4f,0x4f,0x92,0x8c,0x1a,0x28,0x9a,
+ 0xdb,0x8f,0x8f,0x8f,0x29,0x21,0x00,0x03,
0x00}},
- {{0x3d,0x27,0x81,0x32,0x1a,0x72,0x3e,
- 0xf4,0x88,0x8f,0x73,0x20,0x00,0x05,
+ {{0xce,0x4f,0x4f,0x92,0x8c,0x1a,0x28,0x9a,
+ 0xc2,0x86,0x5d,0x5d,0x29,0x01,0x00,0x03,
0x00}},
- {{0x3d,0x27,0x81,0x3a,0x1a,0x72,0x3e,
- 0xdb,0x8f,0x5d,0x73,0x20,0x00,0x05,
+ {{0xce,0x4f,0x4f,0x92,0x8c,0x1a,0x28,0x9e,
+ 0x03,0x87,0xdf,0xdf,0x29,0x01,0x00,0x03,
0x00}},
- {{0x3d,0x27,0x81,0x32,0x1a,0x72,0xba,
- 0x1c,0x80,0xdf,0x73,0x00,0x00,0x05,
+ {{0xce,0x63,0x63,0x92,0x96,0x04,0x28,0xd4,
+ 0x3f,0x83,0x57,0x57,0x29,0x01,0x00,0x07,
+ 0x01}},
+ {{0xce,0x7f,0x7f,0x92,0xa4,0x12,0x28,0xd4,
+ 0x93,0x87,0xff,0xff,0x29,0x21,0x00,0x07,
+ 0x01}},
+ {{0xce,0x9f,0x9f,0x92,0xb4,0x02,0x28,0x5a,
+ 0x13,0x87,0xff,0xff,0x29,0x29,0x00,0x03,
+ 0x01}},
+ {{0xce,0xae,0xae,0x92,0xbc,0x0a,0x28,0x10,
+ 0x20,0x84,0x19,0x19,0x29,0x0f,0x00,0x03,
+ 0x00}}
+};
+
+static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11600x1200_2[]=
+{ /* MISSING */
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00}},
- {{0x3d,0x31,0x81,0x37,0x1f,0x72,0xf0,
- 0x58,0x8c,0x57,0x73,0x20,0x00,0x05,
- 0x01}}
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}}
};
-SiS310_LCDACRT1DataStruct SiS310_LCDACRT11024x768_2_H[]=
-{
- {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb,
- 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01,
+static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT1800x600_2_H[]=
+{
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}}
+};
+
+static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11024x768_2_H[]=
+{ /* Checked (1.10.6s) */
+ {{0x4f,0x27,0x27,0x93,0x39,0x01,0x24,0xbb,
+ 0x4a,0x80,0x8f,0x8f,0x25,0x30,0x00,0x01,
0x00 }},
- {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb,
- 0x31,0x87,0x5d,0x25,0x30,0x00,0x01,
+ {{0x4f,0x27,0x27,0x93,0x39,0x01,0x24,0xbb,
+ 0x31,0x87,0x8d,0x5d,0x25,0x30,0x00,0x01, /* <-- invalid data */
0x00 }},
- {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb,
- 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01,
+ {{0x4f,0x27,0x27,0x93,0x39,0x01,0x24,0xbb,
+ 0x4a,0x80,0x8f,0x8f,0x25,0x30,0x00,0x01,
0x00 }},
- {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb,
- 0x31,0x87,0x5d,0x25,0x30,0x00,0x01,
+ {{0x4f,0x27,0x27,0x93,0x39,0x01,0x24,0xbb,
+ 0x31,0x87,0x5d,0x5d,0x25,0x30,0x00,0x01,
0x00 }},
- {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb,
- 0x72,0x88,0xdf,0x25,0x30,0x00,0x01,
+ {{0x4f,0x27,0x27,0x93,0x39,0x01,0x24,0xbb,
+ 0x72,0x88,0xdf,0xdf,0x25,0x30,0x00,0x01,
0x00 }},
- {{0x4f,0x31,0x93,0x3e,0x06,0x24,0xf1,
- 0xae,0x84,0x57,0x25,0x30,0x00,0x01,
+ {{0x4f,0x31,0x31,0x93,0x3e,0x06,0x24,0xf1,
+ 0xae,0x84,0x57,0x57,0x25,0x30,0x00,0x01, /* <-- invalid data */
0x01 }},
- {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5,
- 0x02,0x88,0xff,0x25,0x10,0x00,0x01,
+ {{0x4f,0x3f,0x3f,0x93,0x45,0x0d,0x24,0xf5,
+ 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x01,
0x01 }}
};
-SiS310_LCDACRT1DataStruct SiS310_LCDACRT11280x1024_2_H[]=
-{
- {{0x4f,0x27,0x93,0x39,0x81,0x24,0xbb,
- 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01,
+static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11280x1024_2_H[]=
+{ /* Checked (1.10.6s) */
+ {{0x4f,0x27,0x27,0x93,0x39,0x81,0x24,0xbb,
+ 0x4a,0x80,0x8f,0x8f,0x25,0x30,0x00,0x01,
0x00 }},
- {{0x4f,0x27,0x93,0x39,0x81,0x24,0xbb,
- 0x31,0x87,0x5d,0x25,0x30,0x00,0x01,
+ {{0x4f,0x27,0x27,0x93,0x39,0x81,0x24,0xbb,
+ 0x31,0x87,0x5d,0x5d,0x25,0x30,0x00,0x01,
0x00 }},
- {{0x4f,0x27,0x93,0x39,0x81,0x24,0xbb,
- 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01,
+ {{0x4f,0x27,0x27,0x93,0x39,0x81,0x24,0xbb,
+ 0x4a,0x80,0x8f,0x8f,0x25,0x30,0x00,0x01,
0x00 }},
- {{0x4f,0x27,0x93,0x39,0x81,0x24,0xbb,
- 0x31,0x87,0x5d,0x25,0x30,0x00,0x01,
+ {{0x4f,0x27,0x27,0x93,0x39,0x81,0x24,0xbb,
+ 0x31,0x87,0x5d,0x5d,0x25,0x30,0x00,0x01,
0x00 }},
- {{0x4f,0x27,0x93,0x39,0x81,0x24,0xbb,
- 0x72,0x88,0xdf,0x25,0x30,0x00,0x01,
+ {{0x4f,0x27,0x27,0x93,0x39,0x81,0x24,0xbb,
+ 0x72,0x88,0xdf,0xdf,0x25,0x30,0x00,0x01,
0x00 }},
- {{0x4f,0x31,0x93,0x3e,0x86,0x24,0xf1,
- 0xae,0x84,0x57,0x25,0x30,0x00,0x01,
+ {{0x4f,0x31,0x31,0x93,0x3e,0x86,0x24,0xf1,
+ 0xae,0x84,0x57,0x57,0x25,0x30,0x00,0x01,
0x01 }},
- {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5,
- 0x02,0x88,0xff,0x25,0x10,0x00,0x01,
+ {{0x4f,0x3f,0x3f,0x93,0x45,0x0d,0x24,0xf5,
+ 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x01,
0x01 }}
};
+static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11400x1050_2_H[]=
+{ /* Checked (1.10.6s) */
+ {{0xa6,0x27,0x27,0x8a,0x64,0x92,0x28,0x9a,
+ 0xdb,0x8f,0x8f,0x8f,0x29,0x21,0x00,0x06,
+ 0x00}},
+ {{0xa6,0x27,0x27,0x8a,0x64,0x92,0x28,0x9a,
+ 0xc2,0x86,0x5d,0x5d,0x29,0x01,0x00,0x06,
+ 0x00}},
+ {{0xa6,0x27,0x27,0x8a,0x64,0x92,0x28,0x9a,
+ 0xdb,0x8f,0x8f,0x8f,0x29,0x21,0x00,0x06,
+ 0x00}},
+ {{0xa6,0x27,0x27,0x8a,0x64,0x92,0x28,0x9a,
+ 0xc2,0x86,0x5d,0x5d,0x29,0x01,0x00,0x06,
+ 0x00}},
+ {{0xa6,0x27,0x27,0x8a,0x64,0x92,0x28,0x9e,
+ 0x03,0x87,0xdf,0xdf,0x29,0x01,0x00,0x06,
+ 0x00}},
+ {{0x9c,0x31,0x31,0x80,0x64,0x92,0x28,0xd4,
+ 0x3f,0x83,0x57,0x57,0x29,0x01,0x00,0x06,
+ 0x01}},
+ {{0x8e,0x3f,0x3f,0x92,0x64,0x12,0x28,0xd4,
+ 0x93,0x87,0xff,0xff,0x29,0x21,0x00,0x06,
+ 0x01}},
+ {{0x7e,0x4f,0x4f,0x82,0x64,0x12,0x28,0x5a,
+ 0x13,0x87,0xff,0xff,0x29,0x29,0x00,0x06,
+ 0x01}},
+ {{0x76,0x56,0x56,0x9a,0x64,0x92,0x28,0x10,
+ 0x20,0x84,0x19,0x19,0x29,0x0f,0x00,0x05,
+ 0x00}}
+};
+
+static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11600x1200_2_H[]=
+{ /* MISSING */
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}},
+ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00}}
+};
+
typedef struct _SiS310_LVDSCRT1DataStruct
{
UCHAR CR[15];
} SiS310_LVDSCRT1DataStruct;
-SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1320x480_1[] =
+static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1320x480_1[] =
{
{{0x65,0x4f,0x89,0x56,0x83,0xaa,0x1f,
0x90,0x85,0x8f,0xab,0x30,0x00,0x05,
@@ -2804,12 +3564,12 @@ SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1320x480_1[] =
{{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0,
0x58,0x8c,0x57,0x73,0x20,0x00,0x06,
0x01 }},
-{{0x2d,0x27,0x90,0x2c,0x80,0x0b,0x3e,
+ {{0x2d,0x27,0x90,0x2c,0x80,0x0b,0x3e,
0xe9,0x8b,0xe7,0x04,0x00,0x00,0x00,
0x00 }}
};
-SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_1[] = /* TW: New */
+static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_1[] =
{
{{0x6b,0x4f,0x8f,0x55,0x85,0xaa,0x1f,
0x90,0x85,0x8f,0xab,0x30,0x00,0x05,
@@ -2831,7 +3591,7 @@ SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_1[] = /* TW: New */
0x01 }}
};
-SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_1[] = /* TW: New */
+static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_1[] =
{
{{0x73,0x4f,0x97,0x53,0x84,0xb4,0x1f,
0x92,0x89,0x8f,0xb5,0x30,0x00,0x05,
@@ -2856,7 +3616,7 @@ SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_1[] = /* TW: New */
0x01}}
};
-SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_1[] = /* TW: New */
+static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_1[] =
{
{{0x7e,0x4f,0x82,0x56,0x04,0xb8,0x1f,
0x90,0x84,0x8f,0xb9,0x30,0x00,0x06,
@@ -2884,7 +3644,7 @@ SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_1[] = /* TW: New */
0x01}}
};
-SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_1_H[] = /* TW: New */
+static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_1_H[] =
{
{{0x43,0x27,0x87,0x2d,0x1d,0xaa,0x1f,
0x90,0x85,0x8f,0xab,0x30,0x00,0x05,
@@ -2906,7 +3666,7 @@ SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_1_H[] = /* TW: New */
0x01 }}
};
-SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_1_H[] = /* TW: New */
+static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_1_H[] =
{
{{0x4b,0x27,0x8f,0x2b,0x1c,0xb4,0x1f,
0x92,0x89,0x8f,0xb5,0x30,0x00,0x05,
@@ -2931,7 +3691,7 @@ SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_1_H[] = /* TW: New */
0x01 }}
};
-SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_1_H[] = /* TW: New */
+static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_1_H[] =
{
{{0x56,0x27,0x9a,0x2e,0x1c,0xb8,0x1f,
0x90,0x84,0x8f,0xb9,0x30,0x00,0x05,
@@ -2956,7 +3716,7 @@ SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_1_H[] = /* TW: New */
0x01 }}
};
-SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_2[]= /* TW: New */
+static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_2[]=
{
{{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e,
0xff,0x84,0x8f,0x73,0x00,0x00,0x06,
@@ -2978,7 +3738,7 @@ SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_2[]= /* TW: New */
0x01 }}
};
-SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_2[] = /* TW: New */
+static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_2[] =
{
{{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb,
0x57,0x8e,0x8f,0x25,0x30,0x00,0x06,
@@ -3003,7 +3763,7 @@ SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_2[] = /* TW: New */
0x01 }}
};
-SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_2[] = /* TW: New */
+static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_2[] =
{
{{0xce,0x4f,0x92,0x81,0x0f,0x28,0x9a,
0xdb,0x8f,0x8f,0x29,0x21,0x00,0x03,
@@ -3031,8 +3791,8 @@ SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_2[] = /* TW: New */
0x01}}
};
-SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_2_H[] = /* TW: New */
-{
+static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_2_H[] =
+{
{{0x57,0x27,0x9b,0x3a,0x0a,0x72,0x3e,
0xff,0x84,0x8f,0x73,0x00,0x00,0x01,
0x00 }},
@@ -3053,7 +3813,7 @@ SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_2_H[] = /* TW: New */
0x01 }}
};
-SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_2_H[] = /* TW: New */
+static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_2_H[] =
{
{{0x7b,0x27,0x9f,0x46,0x97,0x24,0xbb,
0x57,0x8e,0x8f,0x25,0x30,0x00,0x01,
@@ -3078,7 +3838,7 @@ SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_2_H[] = /* TW: New */
0x01 }}
};
-SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_2_H[] = /* TW: New */
+static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_2_H[] =
{
{{0xa6,0x27,0x8a,0x59,0x87,0x28,0x9a,
0xdb,0x8f,0x8f,0x29,0x21,0x00,0x06,
@@ -3103,7 +3863,7 @@ SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_2_H[] = /* TW: New */
0x01}}
};
-SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1XXXxXXX_1[] = /* TW: New */
+static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1XXXxXXX_1[] =
{
{{0x5f,0x4f,0x82,0x55,0x81,0xbf,0x1f,
0x9c,0x8e,0x96,0xb9,0x30,0x00,0x05,
@@ -3131,7 +3891,7 @@ SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1XXXxXXX_1[] = /* TW: New */
0x01}}
};
-SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1XXXxXXX_1_H[] = /* TW: New */
+static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1XXXxXXX_1_H[] =
{
{{0x38,0x27,0x9c,0x2c,0x80,0xbf,0x1f,
0x9c,0x8e,0x96,0xb9,0x30,0x00,0x00,
@@ -3156,7 +3916,7 @@ SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1XXXxXXX_1_H[] = /* TW: New */
0x01}}
};
-SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_1[] = /* TW: New */
+static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_1[] =
{
{{0x6f,0x4f,0x93,0x54,0x82,0x9e,0x1f,
0x93,0x86,0x8f,0x9f,0x30,0x00,0x05,
@@ -3187,7 +3947,7 @@ SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_1[] = /* TW: New */
0x00}}
};
-SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_1_H[] = /* TW: New */
+static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_1_H[] =
{
{{0x47,0x27,0x8b,0x2c,0x1a,0x9e,0x1f,
0x93,0x86,0x8f,0x9f,0x30,0x00,0x05,
@@ -3218,7 +3978,7 @@ SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_1_H[] = /* TW: New */
0x00}}
};
-SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_2[] = /* TW: New */
+static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_2[] =
{
{{0xce,0x4f,0x92,0x8c,0x1a,0x28,0x9a,
0xdb,0x8f,0x8f,0x29,0x21,0x00,0x03,
@@ -3249,7 +4009,7 @@ SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_2[] = /* TW: New */
0x00}}
};
-SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_2_H[] = /* TW: New */
+static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_2_H[] =
{
{{0xa6,0x27,0x8a,0x64,0x92,0x28,0x9a,
0xdb,0x8f,0x8f,0x29,0x21,0x00,0x06,
@@ -3280,7 +4040,113 @@ SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_2_H[] = /* TW: New */
0x00}}
};
-SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x600_1[] =
+static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x768_1[] =
+{ /* TW: Temp data, invalid */
+ {{0x7e,0x4f,0x82,0x56,0x04,0xb8,0x1f,
+ 0x90,0x84,0x8f,0xb9,0x30,0x00,0x06,
+ 0x00 }},
+ {{0x7e,0x4f,0x82,0x56,0x04,0x86,0x1f,
+ 0x5e,0x82,0x5d,0x87,0x10,0x00,0x06,
+ 0x00 }},
+ {{0x7e,0x4f,0x82,0x56,0x04,0xb8,0x1f,
+ 0x90,0x84,0x8f,0xb9,0x30,0x00,0x06,
+ 0x00 }},
+ {{0x7e,0x4f,0x82,0x56,0x04,0x86,0x1f,
+ 0x5e,0x82,0x5d,0x87,0x10,0x00,0x06,
+ 0x00 }},
+ {{0x7e,0x4f,0x82,0x56,0x04,0x08,0x3e,
+ 0xe0,0x84,0xdf,0x09,0x00,0x00,0x06,
+ 0x00 }},
+ {{0x92,0x63,0x96,0x6a,0x18,0x80,0xf0,
+ 0x58,0x8c,0x57,0x81,0x20,0x00,0x06,
+ 0x01 }},
+ {{0xae,0x7f,0x92,0x86,0x94,0x28,0xf5,
+ 0x00,0x84,0xff,0x29,0x10,0x00,0x02,
+ 0x01 }},
+ {{0xce,0x9f,0x92,0xa6,0x14,0x28,0x5a,
+ 0x00,0x84,0xff,0x29,0x09,0x00,0x07,
+ 0x01}}
+};
+
+static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x768_1_H[] =
+{ /* TW: Temp data, invalid */
+ {{0x56,0x27,0x9a,0x2e,0x1c,0xb8,0x1f,
+ 0x90,0x84,0x8f,0xb9,0x30,0x00,0x05,
+ 0x00 }},
+ {{0x56,0x27,0x9a,0x2e,0x1c,0x86,0x1f,
+ 0x5e,0x82,0x5d,0x87,0x10,0x00,0x05,
+ 0x00 }},
+ {{0x56,0x27,0x9a,0x2e,0x1c,0xb8,0x1f,
+ 0x90,0x84,0x8f,0xb9,0x30,0x00,0x05,
+ 0x00 }},
+ {{0x56,0x27,0x9a,0x2e,0x1c,0x86,0x1f,
+ 0x5e,0x82,0x5d,0x87,0x10,0x00,0x05,
+ 0x01 }},
+ {{0x56,0x27,0x9a,0x2e,0x1c,0x08,0x3e,
+ 0xe0,0x84,0xdf,0x09,0x00,0x00,0x05,
+ 0x00 }},
+ {{0x60,0x31,0x84,0x38,0x86,0x80,0xf0,
+ 0x58,0x8c,0x57,0x81,0x20,0x00,0x01,
+ 0x01 }},
+ {{0x6e,0x3f,0x92,0x46,0x94,0x28,0xf5,
+ 0x00,0x84,0xff,0x29,0x10,0x00,0x01,
+ 0x01 }}
+};
+
+static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x768_2[] =
+{ /* TW: Temp data, invalid */
+ {{0xce,0x4f,0x92,0x81,0x0f,0x28,0x9a,
+ 0xdb,0x8f,0x8f,0x29,0x21,0x00,0x03,
+ 0x00 }},
+ {{0xce,0x4f,0x92,0x81,0x0f,0x28,0x9a,
+ 0xc2,0x86,0x5d,0x29,0x01,0x00,0x03,
+ 0x00 }},
+ {{0xce,0x4f,0x92,0x81,0x0f,0x28,0x9a,
+ 0xdb,0x8f,0x8f,0x29,0x21,0x00,0x03,
+ 0x00 }},
+ {{0xce,0x4f,0x92,0x81,0x0f,0x28,0x9a,
+ 0xc2,0x86,0x5d,0x29,0x01,0x00,0x03,
+ 0x00 }},
+ {{0xce,0x4f,0x92,0x81,0x0f,0x28,0x9e,
+ 0x03,0x87,0xdf,0x29,0x01,0x00,0x03,
+ 0x00 }},
+ {{0xce,0x63,0x92,0x8b,0x19,0x28,0xd4,
+ 0x3f,0x83,0x57,0x29,0x01,0x00,0x03,
+ 0x01 }},
+ {{0xce,0x7f,0x92,0x99,0x07,0x28,0xd4,
+ 0x93,0x87,0xff,0x29,0x21,0x00,0x07,
+ 0x01 }},
+ {{0xce,0x9f,0x92,0xa6,0x14,0x28,0x5a,
+ 0x00,0x84,0xff,0x29,0x09,0x00,0x07,
+ 0x01}}
+};
+
+static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x768_2_H[] =
+{ /* TW: Temp data, invalid */
+ {{0xa6,0x27,0x8a,0x59,0x87,0x28,0x9a,
+ 0xdb,0x8f,0x8f,0x29,0x21,0x00,0x06,
+ 0x00 }},
+ {{0xa6,0x27,0x8a,0x59,0x87,0x28,0x9a,
+ 0xc2,0x86,0x5d,0x29,0x01,0x00,0x06,
+ 0x00 }},
+ {{0xa6,0x27,0x8a,0x59,0x87,0x28,0x9a,
+ 0xdb,0x8f,0x8f,0x29,0x21,0x00,0x06,
+ 0x00 }},
+ {{0xa6,0x27,0x8a,0x59,0x87,0x28,0x9a,
+ 0xc2,0x86,0x5d,0x29,0x01,0x00,0x06,
+ 0x00 }},
+ {{0xa6,0x27,0x8a,0x59,0x87,0x28,0x9e,
+ 0x03,0x87,0xdf,0x29,0x01,0x00,0x06,
+ 0x00 }},
+ {{0x9c,0x31,0x80,0x59,0x87,0x28,0xd4,
+ 0x3f,0x83,0x57,0x29,0x01,0x00,0x06,
+ 0x01 }},
+ {{0x8e,0x3f,0x92,0x79,0x07,0x28,0xd4,
+ 0x93,0x87,0xff,0x29,0x21,0x00,0x06,
+ 0x01}}
+};
+
+static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x600_1[] =
{
{{0x64,0x4f,0x88,0x54,0x9f,0x5a,0x3e,
0xe8,0x8f,0x8f,0x5b,0x00,0x00,0x01,
@@ -3305,7 +4171,7 @@ SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x600_1[] =
0x01}}
};
-SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x600_1_H[] =
+static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x600_1_H[] =
{
{{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f,
0x92,0x89,0x8f,0xb5,0x30,0x00,0x44,
@@ -3330,7 +4196,7 @@ SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x600_1_H[] =
0x01}}
};
-SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x600_2[] =
+static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x600_2[] =
{
{{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb,
0x4a,0x80,0x8f,0x25,0x30,0x00,0x06,
@@ -3355,7 +4221,7 @@ SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x600_2[] =
0x01}}
};
-SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x600_2_H[] =
+static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x600_2_H[] =
{
{{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb,
0x4a,0x80,0x8f,0x25,0x30,0x00,0x01,
@@ -3380,7 +4246,7 @@ SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x600_2_H[] =
0x01}}
};
-SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11152x768_1[] =
+static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11152x768_1[] =
{
{{0x64,0x4f,0x88,0x54,0x9f,0xc4,0x1f,
0x92,0x89,0x8f,0xb5,0x30,0x00,0x01,
@@ -3405,7 +4271,7 @@ SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11152x768_1[] =
0x01}}
};
-SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11152x768_1_H[] =
+static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11152x768_1_H[] =
{
{{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f,
0x92,0x89,0x8f,0xb5,0x30,0x00,0x44,
@@ -3430,7 +4296,7 @@ SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11152x768_1_H[] =
0x01}}
};
-SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11152x768_2[] =
+static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11152x768_2[] =
{
{{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb,
0x4a,0x80,0x8f,0x25,0x30,0x00,0x06,
@@ -3455,7 +4321,7 @@ SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11152x768_2[] =
0x01}}
};
-SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11152x768_2_H[] =
+static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11152x768_2_H[] =
{
{{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb,
0x4a,0x80,0x8f,0x25,0x30,0x00,0x01,
@@ -3480,113 +4346,264 @@ SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11152x768_2_H[] =
0x01}}
};
-SiS310_LVDSCRT1DataStruct SiS310_CHTVCRT1UNTSC[] = /* TW: New */
-{
- {{0x64,0x4f,0x88,0x56,0x9f,0x56,0x3e,
- 0xe8,0x84,0x8f,0x57,0x20,0x00,0x01,
- 0x00 }},
- {{0x64,0x4f,0x88,0x56,0x9f,0x56,0x3e,
- 0xd0,0x82,0x5d,0x57,0x00,0x00,0x01,
- 0x00 }},
- {{0x64,0x4f,0x88,0x56,0x9f,0x56,0x3e,
- 0xe8,0x84,0x8f,0x57,0x20,0x00,0x01,
- 0x00 }},
- {{0x64,0x4f,0x88,0x56,0x9f,0x56,0x3e,
- 0xd0,0x82,0x5d,0x57,0x00,0x00,0x01,
- 0x00 }},
- {{0x5d,0x4f,0x81,0x56,0x99,0x56,0xba,
- 0x0a,0x84,0xdf,0x57,0x00,0x00,0x01,
- 0x00 }},
- {{0x80,0x63,0x84,0x6d,0x0f,0xec,0xf0,
- 0x7a,0x8f,0x57,0xed,0x20,0x00,0x06,
- 0x01 }},
- {{0x8c,0x7f,0x90,0x86,0x09,0xaf,0xf5, /* TW: 1024x768 */
- 0x36,0x88,0xff,0xb0,0x10,0x00,0x02,
- 0x01}}
+static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11600x1200_1[] =
+{ /* TW: Temporary data - invalid */
+ {{0x6f,0x4f,0x93,0x54,0x82,0x9e,0x1f,
+ 0x93,0x86,0x8f,0x9f,0x30,0x00,0x05,
+ 0x00}},
+ {{0x6f,0x4f,0x93,0x54,0x82,0x6c,0x1f,
+ 0x60,0x84,0x5d,0x6d,0x10,0x00,0x05,
+ 0x00}},
+ {{0x6f,0x4f,0x93,0x54,0x82,0x9e,0x1f,
+ 0x93,0x86,0x8f,0x9f,0x30,0x00,0x05,
+ 0x00}},
+ {{0x6f,0x4f,0x93,0x54,0x82,0x6c,0x1f,
+ 0x60,0x84,0x5d,0x6d,0x10,0x00,0x05,
+ 0x00}},
+ {{0x6f,0x4f,0x93,0x54,0x82,0xee,0x1f,
+ 0xe2,0x86,0xdf,0xef,0x10,0x00,0x05,
+ 0x00}},
+ {{0x83,0x63,0x87,0x68,0x16,0x66,0xf0,
+ 0x5a,0x8e,0x57,0x67,0x20,0x00,0x06,
+ 0x01}},
+ {{0x9f,0x7f,0x83,0x84,0x92,0x0e,0xf5,
+ 0x02,0x86,0xff,0x0f,0x10,0x00,0x02,
+ 0x01}},
+ {{0xbf,0x9f,0x83,0xa4,0x12,0x0e,0x5a,
+ 0x02,0x86,0xff,0x0f,0x09,0x00,0x07,
+ 0x01}},
+ {{0xce,0xae,0x92,0xb3,0x01,0x28,0x10,
+ 0x1a,0x80,0x19,0x29,0x0f,0x00,0x03,
+ 0x00}}
};
-SiS310_LVDSCRT1DataStruct SiS310_CHTVCRT1ONTSC[] = /* TW: New */
-{
- {{0x63,0x4f,0x87,0x5a,0x9f,0x0b,0x3e,
- 0xc0,0x84,0x8f,0x0c,0x20,0x00,0x01,
- 0x00 }},
- {{0x63,0x4f,0x87,0x5a,0x9f,0x0b,0x3e,
- 0xb0,0x8d,0x5d,0x0c,0x00,0x00,0x01,
- 0x00 }},
- {{0x63,0x4f,0x87,0x5a,0x9f,0x0b,0x3e,
- 0xc0,0x84,0x8f,0x0c,0x20,0x00,0x01,
- 0x00 }},
- {{0x63,0x4f,0x87,0x5a,0x9f,0x0b,0x3e,
- 0xb0,0x8d,0x5d,0x0c,0x00,0x00,0x01,
- 0x00 }},
- {{0x5d,0x4f,0x81,0x58,0x9d,0x0b,0x3e,
- 0xe8,0x84,0xdf,0x0c,0x00,0x00,0x01,
- 0x00 }},
- {{0x7d,0x63,0x81,0x68,0x0e,0xba,0xf0,
- 0x78,0x8a,0x57,0xbb,0x20,0x00,0x06,
- 0x01 }},
- {{0x8c,0x7f,0x90,0x82,0x06,0x46,0xf5, /* TW: 1024x768 */
- 0x15,0x88,0xff,0x47,0x70,0x00,0x02,
- 0x01 }}
+static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11600x1200_1_H[] =
+{ /* TW: Temporary data - invalid */
+ {{0x47,0x27,0x8b,0x2c,0x1a,0x9e,0x1f,
+ 0x93,0x86,0x8f,0x9f,0x30,0x00,0x05,
+ 0x00}},
+ {{0x47,0x27,0x8b,0x2c,0x1a,0x6c,0x1f,
+ 0x60,0x84,0x5d,0x6d,0x10,0x00,0x05,
+ 0x00}},
+ {{0x47,0x27,0x8b,0x30,0x1e,0x9e,0x1f,
+ 0x92,0x86,0x8f,0x9f,0x30,0x00,0x05,
+ 0x00}},
+ {{0x47,0x27,0x8b,0x2c,0x1a,0x6c,0x1f,
+ 0x60,0x84,0x5d,0x6d,0x10,0x00,0x05,
+ 0x00}},
+ {{0x47,0x27,0x8b,0x2c,0x1a,0xee,0x1f,
+ 0xe2,0x86,0xdf,0xef,0x10,0x00,0x05,
+ 0x00}},
+ {{0x51,0x31,0x95,0x36,0x04,0x66,0xf0,
+ 0x5a,0x8e,0x57,0x67,0x20,0x00,0x01,
+ 0x01}},
+ {{0x5f,0x3f,0x83,0x44,0x92,0x0e,0xf5,
+ 0x02,0x86,0xff,0x0f,0x10,0x00,0x01,
+ 0x01}},
+ {{0x6f,0x4f,0x93,0x54,0x82,0x0e,0x5a,
+ 0x02,0x86,0xff,0x0f,0x09,0x00,0x05,
+ 0x01}},
+ {{0x76,0x56,0x9a,0x5b,0x89,0x28,0x10,
+ 0x1c,0x80,0x19,0x29,0x0b,0x00,0x05,
+ 0x00}}
+};
+
+static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11600x1200_2[] =
+{ /* TW: Temporary data - invalid */
+ {{0xce,0x4f,0x92,0x8c,0x1a,0x28,0x9a,
+ 0xdb,0x8f,0x8f,0x29,0x21,0x00,0x03,
+ 0x00}},
+ {{0xce,0x4f,0x92,0x8c,0x1a,0x28,0x9a,
+ 0xc2,0x86,0x5d,0x29,0x01,0x00,0x03,
+ 0x01}},
+ {{0xce,0x4f,0x92,0x8c,0x1a,0x28,0x9a,
+ 0xdb,0x8f,0x8f,0x29,0x21,0x00,0x03,
+ 0x00}},
+ {{0xce,0x4f,0x92,0x8c,0x1a,0x28,0x9a,
+ 0xc2,0x86,0x5d,0x29,0x01,0x00,0x03,
+ 0x00}},
+ {{0xce,0x4f,0x92,0x8c,0x1a,0x28,0x9e,
+ 0x03,0x87,0xdf,0x29,0x01,0x00,0x03,
+ 0x00}},
+ {{0xce,0x63,0x92,0x96,0x04,0x28,0xd4,
+ 0x3f,0x83,0x57,0x29,0x01,0x00,0x07,
+ 0x01}},
+ {{0xce,0x7f,0x92,0xa4,0x12,0x28,0xd4,
+ 0x93,0x87,0xff,0x29,0x21,0x00,0x07,
+ 0x01}},
+ {{0xce,0x9f,0x92,0xb4,0x02,0x28,0x5a,
+ 0x13,0x87,0xff,0x29,0x29,0x00,0x03,
+ 0x01}},
+ {{0xce,0xae,0x92,0xbc,0x0a,0x28,0x10,
+ 0x20,0x84,0x19,0x29,0x0f,0x00,0x03,
+ 0x00}}
+};
+
+static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11600x1200_2_H[] =
+{ /* TW: Temporary data - invalid */
+ {{0xa6,0x27,0x8a,0x64,0x92,0x28,0x9a,
+ 0xdb,0x8f,0x8f,0x29,0x21,0x00,0x06,
+ 0x00}},
+ {{0xa6,0x27,0x8a,0x64,0x92,0x28,0x9a,
+ 0xc2,0x86,0x5d,0x29,0x01,0x00,0x06,
+ 0x00}},
+ {{0xa6,0x27,0x8a,0x64,0x92,0x28,0x9a,
+ 0xdb,0x8f,0x8f,0x29,0x21,0x00,0x06,
+ 0x00}},
+ {{0xa6,0x27,0x8a,0x64,0x92,0x28,0x9a,
+ 0xc2,0x86,0x5d,0x29,0x01,0x00,0x06,
+ 0x00}},
+ {{0xa6,0x27,0x8a,0x64,0x92,0x28,0x9e,
+ 0x03,0x87,0xdf,0x29,0x01,0x00,0x06,
+ 0x00}},
+ {{0x9c,0x31,0x80,0x64,0x92,0x28,0xd4,
+ 0x3f,0x83,0x57,0x29,0x01,0x00,0x06,
+ 0x01}},
+ {{0x8e,0x3f,0x92,0x64,0x12,0x28,0xd4,
+ 0x93,0x87,0xff,0x29,0x21,0x00,0x06,
+ 0x01}},
+ {{0x7e,0x4f,0x82,0x64,0x12,0x28,0x5a,
+ 0x13,0x87,0xff,0x29,0x29,0x00,0x06,
+ 0x01}},
+ {{0x76,0x56,0x9a,0x64,0x92,0x28,0x10,
+ 0x20,0x84,0x19,0x29,0x0f,0x00,0x05,
+ 0x00}}
};
-SiS310_LVDSCRT1DataStruct SiS310_CHTVCRT1UPAL[] = /* TW: New */
+
+static const SiS310_LVDSCRT1DataStruct SiS310_CHTVCRT1UNTSC[] =
{
- {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e,
- 0xf8,0x83,0x8f,0x70,0x20,0x00,0x05,
- 0x00 }},
- {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e,
- 0xde,0x81,0x5d,0x70,0x00,0x00,0x05,
- 0x00 }},
- {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e,
- 0xf8,0x83,0x8f,0x70,0x20,0x00,0x05,
- 0x00 }},
- {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e,
- 0xde,0x81,0x5d,0x70,0x00,0x00,0x05,
- 0x00 }},
- {{0x64,0x4f,0x88,0x5a,0x9f,0x6f,0xba,
- 0x15,0x83,0xdf,0x70,0x00,0x00,0x01,
- 0x00 }},
- {{0x73,0x63,0x97,0x69,0x8b,0xec,0xf0,
- 0x90,0x8c,0x57,0xed,0x20,0x00,0x05,
- 0x01 }},
- {{0xaa,0x7f,0x8e,0x8e,0x96,0xe6,0xf5, /* TW: 1024x768 */
- 0x50,0x88,0xff,0xe7,0x10,0x00,0x02,
- 0x01}}
+ {{0x64,0x4f,0x88,0x56,0x9f,0x56,0x3e,
+ 0xe8,0x84,0x8f,0x57,0x20,0x00,0x01,
+ 0x00 }},
+ {{0x64,0x4f,0x88,0x56,0x9f,0x56,0x3e,
+ 0xd0,0x82,0x5d,0x57,0x00,0x00,0x01,
+ 0x00 }},
+ {{0x64,0x4f,0x88,0x56,0x9f,0x56,0x3e,
+ 0xe8,0x84,0x8f,0x57,0x20,0x00,0x01,
+ 0x00 }},
+ {{0x64,0x4f,0x88,0x56,0x9f,0x56,0x3e,
+ 0xd0,0x82,0x5d,0x57,0x00,0x00,0x01,
+ 0x00 }},
+ {{0x5d,0x4f,0x81,0x56,0x99,0x56,0xba,
+ 0x0a,0x84,0xdf,0x57,0x00,0x00,0x01,
+ 0x00 }},
+ {{0x80,0x63,0x84,0x6d,0x0f,0xec,0xf0,
+ 0x7a,0x8f,0x57,0xed,0x20,0x00,0x06,
+ 0x01 }},
+ {{0x8c,0x7f,0x90,0x86,0x09,0xaf,0xf5, /* TW: 1024x768 */
+ 0x36,0x88,0xff,0xb0,0x10,0x00,0x02,
+ 0x01}}
};
-SiS310_LVDSCRT1DataStruct SiS310_CHTVCRT1OPAL[] = /* TW: New */
+static const SiS310_LVDSCRT1DataStruct SiS310_CHTVCRT1ONTSC[] =
{
- {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e,
- 0xf0,0x83,0x8f,0x70,0x20,0x00,0x05,
- 0x00 }},
- {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e,
- 0xde,0x81,0x5d,0x70,0x00,0x00,0x05,
- 0x00 }},
- {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e,
- 0xf0,0x83,0x8f,0x70,0x20,0x00,0x05,
- 0x00 }},
- {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e,
- 0xde,0x81,0x5d,0x70,0x00,0x00,0x05,
- 0x00 }},
- {{0x64,0x4f,0x88,0x58,0x9d,0x6f,0xba,
- 0x15,0x83,0xdf,0x70,0x00,0x00,0x01,
- 0x00 }},
- {{0x71,0x63,0x95,0x69,0x8c,0x6f,0xf0,
- 0x5a,0x8b,0x57,0x70,0x20,0x00,0x05,
- 0x01 }},
- {{0xaa,0x7f,0x8e,0x8f,0x96,0x69,0xf5, /* TW: 1024x768 */
- 0x28,0x88,0xff,0x6a,0x10,0x00,0x02,
- 0x01 }}
+ {{0x63,0x4f,0x87,0x5a,0x9f,0x0b,0x3e,
+ 0xc0,0x84,0x8f,0x0c,0x20,0x00,0x01,
+ 0x00 }},
+ {{0x63,0x4f,0x87,0x5a,0x9f,0x0b,0x3e,
+ 0xb0,0x8d,0x5d,0x0c,0x00,0x00,0x01,
+ 0x00 }},
+ {{0x63,0x4f,0x87,0x5a,0x9f,0x0b,0x3e,
+ 0xc0,0x84,0x8f,0x0c,0x20,0x00,0x01,
+ 0x00 }},
+ {{0x63,0x4f,0x87,0x5a,0x9f,0x0b,0x3e,
+ 0xb0,0x8d,0x5d,0x0c,0x00,0x00,0x01,
+ 0x00 }},
+ {{0x5d,0x4f,0x81,0x58,0x9d,0x0b,0x3e,
+ 0xe8,0x84,0xdf,0x0c,0x00,0x00,0x01,
+ 0x00 }},
+ {{0x7d,0x63,0x81,0x68,0x0e,0xba,0xf0,
+ 0x78,0x8a,0x57,0xbb,0x20,0x00,0x06,
+ 0x01 }},
+ {{0x8c,0x7f,0x90,0x82,0x06,0x46,0xf5, /* TW: 1024x768 */
+ 0x15,0x88,0xff,0x47,0x70,0x00,0x02,
+ 0x01 }}
+};
+
+static const SiS310_LVDSCRT1DataStruct SiS310_CHTVCRT1UPAL[] =
+{
+ {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e,
+ 0xf8,0x83,0x8f,0x70,0x20,0x00,0x05,
+ 0x00 }},
+ {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e,
+ 0xde,0x81,0x5d,0x70,0x00,0x00,0x05,
+ 0x00 }},
+ {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e,
+ 0xf8,0x83,0x8f,0x70,0x20,0x00,0x05,
+ 0x00 }},
+ {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e,
+ 0xde,0x81,0x5d,0x70,0x00,0x00,0x05,
+ 0x00 }},
+ {{0x64,0x4f,0x88,0x5a,0x9f,0x6f,0xba,
+ 0x15,0x83,0xdf,0x70,0x00,0x00,0x01,
+ 0x00 }},
+ {{0x73,0x63,0x97,0x69,0x8b,0xec,0xf0,
+ 0x90,0x8c,0x57,0xed,0x20,0x00,0x05,
+ 0x01 }},
+ {{0xaa,0x7f,0x8e,0x8e,0x96,0xe6,0xf5, /* TW: 1024x768 */
+ 0x50,0x88,0xff,0xe7,0x10,0x00,0x02,
+ 0x01}}
};
-/* TW: New data for Chrontel 7019 (From 650/LVDS BIOS 1.10.0) */
+static const SiS310_LVDSCRT1DataStruct SiS310_CHTVCRT1OPAL[] =
+{
+ {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e,
+ 0xf0,0x83,0x8f,0x70,0x20,0x00,0x05,
+ 0x00 }},
+ {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e,
+ 0xde,0x81,0x5d,0x70,0x00,0x00,0x05,
+ 0x00 }},
+ {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e,
+ 0xf0,0x83,0x8f,0x70,0x20,0x00,0x05,
+ 0x00 }},
+ {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e,
+ 0xde,0x81,0x5d,0x70,0x00,0x00,0x05,
+ 0x00 }},
+ {{0x64,0x4f,0x88,0x58,0x9d,0x6f,0xba,
+ 0x15,0x83,0xdf,0x70,0x00,0x00,0x01,
+ 0x00 }},
+ {{0x71,0x63,0x95,0x69,0x8c,0x6f,0xf0,
+ 0x5a,0x8b,0x57,0x70,0x20,0x00,0x05,
+ 0x01 }},
+ {{0xaa,0x7f,0x8e,0x8f,0x96,0x69,0xf5, /* TW: 1024x768 */
+ 0x28,0x88,0xff,0x6a,0x10,0x00,0x02,
+ 0x01 }}
+};
+
+static const SiS310_LVDSCRT1DataStruct SiS310_CHTVCRT1SOPAL[] =
+{
+ {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e,
+ 0xf0,0x83,0x8f,0x70,0x20,0x00,0x05,
+ 0x00 }},
+ {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e,
+ 0xde,0x81,0x5d,0x70,0x00,0x00,0x05,
+ 0x00 }},
+ {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e,
+ 0xf0,0x83,0x8f,0x70,0x20,0x00,0x05,
+ 0x00 }},
+ {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e,
+ 0xde,0x81,0x5d,0x70,0x00,0x00,0x05,
+ 0x00 }},
+ {{0x64,0x4f,0x88,0x58,0x9d,0x6f,0xba,
+ 0x15,0x83,0xdf,0x70,0x00,0x00,0x01,
+ 0x00 }},
+ {{0x71,0x63,0x95,0x69,0x8c,0x6f,0xf0,
+ 0x5a,0x8b,0x57,0x70,0x20,0x00,0x05,
+ 0x01 }},
+ {{0xaa,0x7f,0x8e,0x8f,0x96,0x69,0xf5, /* TW: 1024x768 */
+ 0x28,0x88,0xff,0x6a,0x10,0x00,0x02,
+ 0x01 }}
+};
+
+/* TW: Data for Chrontel 7019 */
typedef struct _SiS310_CHTVRegDataStruct
{
UCHAR Reg[16];
} SiS310_CHTVRegDataStruct;
-SiS310_CHTVRegDataStruct SiS310_CHTVReg_UNTSC[] = {
+static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_UNTSC[] =
+{
{{0x4a,0x77,0xbb,0x94,0x84,0x48,0xfe,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}},
{{0x4a,0x77,0xbb,0x94,0x84,0x48,0xfe,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}},
{{0x4a,0x77,0xbb,0x94,0x84,0x48,0xfe,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}},
@@ -3596,7 +4613,8 @@ SiS310_CHTVRegDataStruct SiS310_CHTVReg_UNTSC[] = {
{{0xee,0x77,0xbb,0x66,0x87,0x32,0x01,0x5a,0x04,0x00,0x80,0x1b,0xd3,0xf2,0x36,0x00}}
};
-SiS310_CHTVRegDataStruct SiS310_CHTVReg_ONTSC[] = {
+static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_ONTSC[] =
+{
{{0x49,0x77,0xbb,0x7b,0x84,0x34,0x00,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}},
{{0x49,0x77,0xbb,0x7b,0x84,0x34,0x00,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}},
{{0x49,0x77,0xbb,0x7b,0x84,0x34,0x00,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}},
@@ -3606,7 +4624,8 @@ SiS310_CHTVRegDataStruct SiS310_CHTVReg_ONTSC[] = {
{{0xed,0x77,0xbb,0x66,0x8c,0x21,0x02,0x5a,0x04,0x00,0x80,0x1f,0x9f,0xc1,0x0c,0x00}}
};
-SiS310_CHTVRegDataStruct SiS310_CHTVReg_UPAL[] = {
+static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_UPAL[] =
+{
{{0x41,0x7f,0xb7,0x34,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}},
{{0x41,0x7f,0xb7,0x80,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}},
{{0x41,0x7f,0xb7,0x34,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}},
@@ -3616,7 +4635,8 @@ SiS310_CHTVRegDataStruct SiS310_CHTVReg_UPAL[] = {
{{0xe5,0x7f,0xb7,0x1d,0xa7,0x3e,0x04,0x5a,0x05,0x00,0x80,0x20,0x3e,0xe4,0x22,0x00}}
};
-SiS310_CHTVRegDataStruct SiS310_CHTVReg_OPAL[] = {
+static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_OPAL[] =
+{
{{0x41,0x7f,0xb7,0x36,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}},
{{0x41,0x7f,0xb7,0x86,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}},
{{0x41,0x7f,0xb7,0x36,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}},
@@ -3626,11 +4646,76 @@ SiS310_CHTVRegDataStruct SiS310_CHTVReg_OPAL[] = {
{{0xe4,0x7f,0xb7,0x1e,0xaf,0x29,0x37,0x5a,0x05,0x00,0x80,0x25,0x8c,0xb2,0x2a,0x00}}
};
-UCHAR SiS310_CHTVVCLKUNTSC[] = {0x41,0x41,0x41,0x41,0x42,0x46,0x53};
+static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_SOPAL[] =
+{
+ {{0x41,0x7f,0xb7,0x36,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}},
+ {{0x41,0x7f,0xb7,0x86,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}},
+ {{0x41,0x7f,0xb7,0x36,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}},
+ {{0x41,0x7f,0xb7,0x86,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}},
+ {{0x61,0x7f,0xb7,0x99,0x84,0x35,0x04,0x5a,0x05,0x00,0x80,0x26,0x2a,0x55,0x5d,0x00}},
+ {{0xc1,0x7f,0xb7,0x4d,0x8c,0x1e,0x31,0x5a,0x05,0x00,0x80,0x26,0x78,0x19,0x34,0x00}},
+ {{0xe4,0x7f,0xb7,0x1e,0xaf,0x29,0x37,0x5a,0x05,0x00,0x80,0x25,0x8c,0xb2,0x2a,0x00}}
+};
+
+static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_UPALM[] =
+{
+ {{0x52,0x77,0xbb,0x94,0x84,0x48,0xfe,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}},
+ {{0x52,0x77,0xbb,0x94,0x84,0x48,0xfe,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}},
+ {{0x52,0x77,0xbb,0x94,0x84,0x48,0xfe,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}},
+ {{0x52,0x77,0xbb,0x94,0x84,0x48,0xfe,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}},
+ {{0x72,0x77,0xbb,0x6e,0x84,0x2e,0x02,0x5a,0x04,0x00,0x80,0x20,0x76,0xdb,0x6e,0x00}},
+ {{0xd7,0x77,0xb7,0xc8,0x84,0x3b,0x02,0x5a,0x04,0x00,0x80,0x19,0x84,0x0a,0xc7,0x00}},
+ {{0xf6,0x77,0xbb,0x66,0x87,0x32,0x01,0x5a,0x04,0x00,0x80,0x1b,0xdc,0xb0,0x8d,0x00}}
+};
+
+static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_OPALM[] =
+{
+ {{0x51,0x77,0xbb,0x7b,0x84,0x34,0x00,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}},
+ {{0x51,0x77,0xbb,0x7b,0x84,0x34,0x00,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}},
+ {{0x51,0x77,0xbb,0x7b,0x84,0x34,0x00,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}},
+ {{0x51,0x77,0xbb,0x7b,0x84,0x34,0x00,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}},
+ {{0x71,0x77,0xbb,0x6e,0x84,0x1e,0x00,0x5a,0x04,0x00,0x80,0x25,0x1a,0x1f,0x59,0x00}},
+ {{0xd6,0x77,0xb7,0xb6,0x83,0x2c,0x02,0x5a,0x04,0x00,0x80,0x1b,0xf8,0x1f,0x82,0x00}},
+ {{0xf5,0x77,0xbb,0x66,0x8c,0x21,0x02,0x5a,0x04,0x00,0x80,0x1f,0x58,0x46,0x9f,0x00}}
+};
+
+static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_UPALN[] =
+{
+ {{0x41,0x7f,0xb7,0x34,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}},
+ {{0x41,0x7f,0xb7,0x80,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}},
+ {{0x41,0x7f,0xb7,0x34,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}},
+ {{0x41,0x7f,0xb7,0x12,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}},
+ {{0x61,0x7f,0xb7,0x99,0x84,0x35,0x04,0x5a,0x05,0x00,0x80,0x1f,0x0d,0x54,0x5e,0x00}},
+ {{0xc3,0x7f,0xb7,0x7a,0x84,0x40,0x02,0x5a,0x05,0x00,0x80,0x19,0x78,0xef,0x35,0x00}},
+ {{0xe5,0x7f,0xb7,0x1d,0xa7,0x3e,0x04,0x5a,0x05,0x00,0x80,0x1a,0x33,0x3f,0x2f,0x00}}
+};
+
+static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_OPALN[] =
+{
+ {{0x41,0x7f,0xb7,0x36,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}},
+ {{0x41,0x7f,0xb7,0x86,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}},
+ {{0x41,0x7f,0xb7,0x36,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}},
+ {{0x41,0x7f,0xb7,0x86,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}},
+ {{0x61,0x7f,0xb7,0x99,0x84,0x35,0x04,0x5a,0x05,0x00,0x80,0x1f,0x0d,0x54,0x5e,0x00}},
+ {{0xc1,0x7f,0xb7,0x4d,0x8c,0x1e,0x31,0x5a,0x05,0x00,0x80,0x1f,0x15,0xc0,0x1e,0x00}},
+ {{0xe4,0x7f,0xb7,0x1e,0xaf,0x29,0x37,0x5a,0x05,0x00,0x80,0x1d,0xf1,0x6c,0xcb,0x00}}
+};
+
+static const UCHAR SiS310_CHTVVCLKUNTSC[] = {0x41,0x41,0x41,0x41,0x42,0x46,0x53};
+
+static const UCHAR SiS310_CHTVVCLKONTSC[] = {0x48,0x48,0x48,0x48,0x45,0x43,0x51};
+
+static const UCHAR SiS310_CHTVVCLKUPAL[] = {0x47,0x47,0x47,0x47,0x48,0x4a,0x54};
+
+static const UCHAR SiS310_CHTVVCLKOPAL[] = {0x47,0x47,0x47,0x47,0x48,0x4f,0x52};
+
+static const UCHAR SiS310_CHTVVCLKSOPAL[] = {0x47,0x47,0x47,0x47,0x48,0x4f,0x52};
+
+static const UCHAR SiS310_CHTVVCLKUPALM[] = {0x41,0x41,0x41,0x41,0x42,0x46,0x53};
+
+static const UCHAR SiS310_CHTVVCLKOPALM[] = {0x48,0x48,0x48,0x48,0x45,0x43,0x51};
-UCHAR SiS310_CHTVVCLKONTSC[] = {0x48,0x48,0x48,0x48,0x45,0x43,0x51};
+static const UCHAR SiS310_CHTVVCLKUPALN[] = {0x47,0x47,0x47,0x47,0x48,0x4a,0x54};
-UCHAR SiS310_CHTVVCLKUPAL[] = {0x47,0x47,0x47,0x47,0x48,0x4a,0x54};
+static const UCHAR SiS310_CHTVVCLKOPALN[] = {0x47,0x47,0x47,0x47,0x48,0x4f,0x52};
-UCHAR SiS310_CHTVVCLKOPAL[] = {0x47,0x47,0x47,0x47,0x48,0x4f,0x52};
-/* TW: New end */
diff --git a/drivers/video/sis/init.c b/drivers/video/sis/init.c
index ac3f0c367a2b..ba0d4c402764 100644
--- a/drivers/video/sis/init.c
+++ b/drivers/video/sis/init.c
@@ -1,17 +1,23 @@
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init.c,v 1.3 2002/24/04 01:16:16 dawes Exp $ */
/*
- * Mode switching code (CRT1 section) for SiS 300/540/630/730/315/550/650/740
+ * Mode switching code (CRT1 section) for SiS 300/540/630/730/315/550/650/740/330
* (Universal module for Linux kernel framebuffer and XFree86 4.x)
*
* Assembler-To-C translation
- * Parts Copyright 2002 by Thomas Winischhofer <thomas@winischhofer.net>
+ * Copyright 2002 by Thomas Winischhofer <thomas@winischhofer.net>
+ * Minor parts Copyright SiS, Inc.
*
* Based on BIOS
- * 1.10.07 (1.10a) for SiS650/LVDS+CH7019
- * 1.07.1b for SiS650/301(B/LV)
+ * 1.10.07, 1.10a for SiS650/LVDS+CH7019
+ * 1.11.05 for 650/LVDS (w/o Chrontel)
+ * 1.07.1b, 1.11.6s, 1.11.6w, 1.11.7w, 1.11.8r for SiS650/301(B/LV)
* 2.04.50 (I) and 2.04.5c (II) for SiS630/301(B)
- * 2.02.3b, 2.03.02 and 2.04.5c for 630/LVDS/LVDS+CH7005
+ * 2.06.50 for 630/301B (dual VGA)
+ * 2.02.3b, 2.03.02, 2.04.5c, 2.07a and 2.08.b3 for 630/LVDS/LVDS+CH7005
+ * 2.04.5c, 2.04.6c for 730+LVDS+CH7005
* 1.09b for 315/301(B)
+ * 1.16.51 for 300+301LV (ECS A907)
+ * 1.01.03 for 330 (Xabre 400)
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
@@ -31,8 +37,16 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*
+ * TW says: This code looks awful, I know. But please don't do anything about
+ * this otherwise debugging will be hell.
+ * The code is extremely fragile as regards the different chipsets, different
+ * video bridges and combinations thereof. If anything is changed, extreme
+ * care has to be taken that that change doesn't break it for other chipsets,
+ * bridges or combinations thereof.
+ * All comments in this file are by me, regardless if they are marked TW or not.
+ *
*/
-
+
#include "init.h"
#ifdef SIS300
@@ -44,25 +58,27 @@
#endif
#ifdef LINUX_XF86
-BOOLEAN SiSBIOSSetMode(PSIS_HW_DEVICE_INFO HwDeviceExtension,
- ScrnInfoPtr pScrn, DisplayModePtr mode);
+BOOLEAN SiSBIOSSetMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,
+ ScrnInfoPtr pScrn, DisplayModePtr mode, BOOLEAN IsCustom);
+DisplayModePtr SiSBuildBuiltInModeList(ScrnInfoPtr pScrn);
#ifdef SISDUALHEAD /* TW: For dual head */
-BOOLEAN SiSBIOSSetModeCRT1(PSIS_HW_DEVICE_INFO HwDeviceExtension,
- ScrnInfoPtr pScrn, DisplayModePtr mode);
-BOOLEAN SiSBIOSSetModeCRT2(PSIS_HW_DEVICE_INFO HwDeviceExtension,
+BOOLEAN SiSBIOSSetModeCRT1(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,
+ ScrnInfoPtr pScrn, DisplayModePtr mode, BOOLEAN IsCustom);
+BOOLEAN SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,
ScrnInfoPtr pScrn, DisplayModePtr mode);
#endif /* dual head */
#endif /* linux_xf86 */
-#ifndef LINUX_XF86
-BOOLEAN SiSInit(PSIS_HW_DEVICE_INFO HwDeviceExtension);
+#ifdef LINUXBIOS
+BOOLEAN SiSInit(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension);
#endif
#ifdef LINUX_XF86
-BOOLEAN SiSSetMode(PSIS_HW_DEVICE_INFO HwDeviceExtension,
- ScrnInfoPtr pScrn,USHORT ModeNo);
+BOOLEAN SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,
+ ScrnInfoPtr pScrn,USHORT ModeNo, BOOLEAN dosetpitch);
#else
-BOOLEAN SiSSetMode(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo);
+BOOLEAN SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,
+ USHORT ModeNo);
#endif
#if defined(ALLOC_PRAGMA)
@@ -70,34 +86,43 @@ BOOLEAN SiSSetMode(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo);
#pragma alloc_text(PAGE,SiSInit)
#endif
-void DelaySeconds(int seconds);
-void DebugCode(UCHAR code);
+static ULONG GetDRAMSize(SiS_Private *SiS_Pr,
+ PSIS_HW_DEVICE_INFO HwDeviceExtension);
+
+static void DelaySeconds(int seconds);
+void SiS_DebugCode(SiS_Private *SiS_Pr, UCHAR code);
#ifdef LINUX_XF86
/* TW: Mode table for X driver */
-UShort ModeIndex_320x480[] = {0x5A, 0x5B, 0x00, 0x00}; /* DSTN/FSTN */
-UShort ModeIndex_512x384[] = {0x52, 0x58, 0x00, 0x5c};
-UShort ModeIndex_640x480[] = {0x2E, 0x44, 0x00, 0x62};
-UShort ModeIndex_720x480[] = {0x31, 0x33, 0x00, 0x35};
-UShort ModeIndex_720x576[] = {0x32, 0x34, 0x00, 0x36};
-UShort ModeIndex_800x480[] = {0x70, 0x7a, 0x00, 0x76}; /* 310/325 series only */
-UShort ModeIndex_800x600[] = {0x30, 0x47, 0x00, 0x63};
-UShort ModeIndex_1024x768[] = {0x38, 0x4A, 0x00, 0x64};
-UShort ModeIndex_1024x576[] = {0x71, 0x74, 0x00, 0x77}; /* 310/325 series only */
-UShort ModeIndex_1024x600[] = {0x20, 0x21, 0x00, 0x22}; /* 300 series only */
-UShort ModeIndex_1280x1024[] = {0x3A, 0x4D, 0x00, 0x65};
-UShort ModeIndex_300_1280x960[] = {0x6e, 0x6f, 0x00, 0x7b};
-UShort ModeIndex_310_1280x960[] = {0x7C, 0x7D, 0x00, 0x7E};
-UShort ModeIndex_1152x768[] = {0x23, 0x24, 0x00, 0x25}; /* 300 series only */
-UShort ModeIndex_1280x768[] = {0x23, 0x24, 0x00, 0x25}; /* 310/325 series only */
-UShort ModeIndex_1280x720[] = {0x79, 0x75, 0x00, 0x78}; /* 310/325 series only */
-UShort ModeIndex_1400x1050[] = {0x26, 0x27, 0x00, 0x28}; /* 310/325 series only */
-UShort ModeIndex_1600x1200[] = {0x3C, 0x3D, 0x00, 0x66};
-UShort ModeIndex_1920x1440[] = {0x68, 0x69, 0x00, 0x6B};
-UShort ModeIndex_2048x1536[] = {0x6c, 0x6d, 0x00, 0x6e}; /* 310/325 series only */
+const UShort ModeIndex_320x480[] = {0x5a, 0x5b, 0x00, 0x00}; /* DSTN/FSTN */
+const UShort ModeIndex_512x384[] = {0x52, 0x58, 0x00, 0x5c};
+const UShort ModeIndex_640x400[] = {0x2f, 0x5d, 0x00, 0x5e};
+const UShort ModeIndex_640x480[] = {0x2e, 0x44, 0x00, 0x62};
+const UShort ModeIndex_720x480[] = {0x31, 0x33, 0x00, 0x35};
+const UShort ModeIndex_720x576[] = {0x32, 0x34, 0x00, 0x36};
+const UShort ModeIndex_800x480[] = {0x70, 0x7a, 0x00, 0x76};
+const UShort ModeIndex_800x600[] = {0x30, 0x47, 0x00, 0x63};
+const UShort ModeIndex_848x480[] = {0x39, 0x3b, 0x00, 0x3e};
+const UShort ModeIndex_856x480[] = {0x3f, 0x42, 0x00, 0x45};
+const UShort ModeIndex_1024x768[] = {0x38, 0x4a, 0x00, 0x64};
+const UShort ModeIndex_1024x576[] = {0x71, 0x74, 0x00, 0x77};
+const UShort ModeIndex_1024x600[] = {0x20, 0x21, 0x00, 0x22}; /* 300 series only */
+const UShort ModeIndex_1280x1024[] = {0x3a, 0x4d, 0x00, 0x65};
+const UShort ModeIndex_300_1280x960[] = {0x6e, 0x6f, 0x00, 0x7b};
+const UShort ModeIndex_310_1280x960[] = {0x7c, 0x7d, 0x00, 0x7e};
+const UShort ModeIndex_1152x768[] = {0x23, 0x24, 0x00, 0x25}; /* 300 series only */
+const UShort ModeIndex_1152x864[] = {0x29, 0x2a, 0x00, 0x2b};
+const UShort ModeIndex_1280x768[] = {0x23, 0x24, 0x00, 0x25}; /* 310/325 series only */
+const UShort ModeIndex_1280x720[] = {0x79, 0x75, 0x00, 0x78};
+const UShort ModeIndex_1360x768[] = {0x48, 0x4b, 0x00, 0x4e};
+const UShort ModeIndex_1400x1050[] = {0x26, 0x27, 0x00, 0x28}; /* 310/325 series only */
+const UShort ModeIndex_1600x1200[] = {0x3c, 0x3d, 0x00, 0x66};
+const UShort ModeIndex_1920x1440[] = {0x68, 0x69, 0x00, 0x6b};
+const UShort ModeIndex_300_2048x1536[]= {0x6c, 0x6d, 0x00, 0x00};
+const UShort ModeIndex_310_2048x1536[]= {0x6c, 0x6d, 0x00, 0x6e};
#endif
-void
+static void
DelaySeconds(int seconds)
{
int i;
@@ -124,453 +149,575 @@ DelaySeconds(int seconds)
}
void
-DebugCode(UCHAR code)
+SiS_DebugCode(SiS_Private *SiS_Pr, UCHAR code)
{
- OutPortByte ( 0x80, code);
- /*OutPortByte ( 0x300, code);*/
+ OutPortByte(0x80, code);
DelaySeconds(0x3);
}
#ifdef SIS300
-void
-InitTo300Pointer(PSIS_HW_DEVICE_INFO HwDeviceExtension)
+static void
+InitTo300Pointer(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
- SiS_SModeIDTable = (SiS_StStruct *) SiS300_SModeIDTable;
- SiS_VBModeIDTable = (SiS_VBModeStruct *) SiS300_VBModeIDTable;
- SiS_StandTable = (SiS_StandTableStruct *) SiS300_StandTable;
- SiS_EModeIDTable = (SiS_ExtStruct *) SiS300_EModeIDTable;
- SiS_RefIndex = (SiS_Ext2Struct *) SiS300_RefIndex;
- SiS_CRT1Table = (SiS_CRT1TableStruct *) SiS300_CRT1Table;
- SiS_MCLKData_0 = (SiS_MCLKDataStruct *) SiS300_MCLKData;
- SiS_ECLKData = (SiS_ECLKDataStruct *) SiS300_ECLKData;
- SiS_VCLKData = (SiS_VCLKDataStruct *) SiS300_VCLKData;
- SiS_VBVCLKData = (SiS_VBVCLKDataStruct *) SiS300_VCLKData;
- SiS_ScreenOffset = SiS300_ScreenOffset;
- SiS_StResInfo = (SiS_StResInfoStruct *) SiS300_StResInfo;
- SiS_ModeResInfo = (SiS_ModeResInfoStruct *) SiS300_ModeResInfo;
-
- pSiS_OutputSelect = &SiS300_OutputSelect;
- pSiS_SoftSetting = &SiS300_SoftSetting;
- pSiS_SR07 = &SiS300_SR07;
- SiS_SR15 = SiS300_SR15;
- SiS_CR40 = SiS300_CR40;
- SiS_CR49 = SiS300_CR49;
- pSiS_SR1F = &SiS300_SR1F;
- pSiS_SR21 = &SiS300_SR21;
- pSiS_SR22 = &SiS300_SR22;
- pSiS_SR23 = &SiS300_SR23;
- pSiS_SR24 = &SiS300_SR24;
- SiS_SR25 = SiS300_SR25;
- pSiS_SR31 = &SiS300_SR31;
- pSiS_SR32 = &SiS300_SR32;
- pSiS_SR33 = &SiS300_SR33;
- pSiS_CRT2Data_1_2 = &SiS300_CRT2Data_1_2;
- pSiS_CRT2Data_4_D = &SiS300_CRT2Data_4_D;
- pSiS_CRT2Data_4_E = &SiS300_CRT2Data_4_E;
- pSiS_CRT2Data_4_10 = &SiS300_CRT2Data_4_10;
- pSiS_RGBSenseData = &SiS300_RGBSenseData;
- pSiS_VideoSenseData = &SiS300_VideoSenseData;
- pSiS_YCSenseData = &SiS300_YCSenseData;
- pSiS_RGBSenseData2 = &SiS300_RGBSenseData2;
- pSiS_VideoSenseData2 = &SiS300_VideoSenseData2;
- pSiS_YCSenseData2 = &SiS300_YCSenseData2;
-
- SiS_NTSCPhase = SiS300_NTSCPhase;
- SiS_PALPhase = SiS300_PALPhase;
- SiS_NTSCPhase2 = SiS300_NTSCPhase2;
- SiS_PALPhase2 = SiS300_PALPhase2;
- SiS_PALMPhase = SiS300_PALMPhase;
- SiS_PALNPhase = SiS300_PALNPhase;
- SiS_PALMPhase2 = SiS300_PALMPhase2;
- SiS_PALNPhase2 = SiS300_PALNPhase2;
-
- SiS_StLCD1024x768Data = (SiS_LCDDataStruct *) SiS300_StLCD1024x768Data;
- SiS_ExtLCD1024x768Data = (SiS_LCDDataStruct *) SiS300_ExtLCD1024x768Data;
- SiS_St2LCD1024x768Data = (SiS_LCDDataStruct *) SiS300_St2LCD1024x768Data;
- SiS_StLCD1280x1024Data = (SiS_LCDDataStruct *) SiS300_StLCD1280x1024Data;
- SiS_ExtLCD1280x1024Data = (SiS_LCDDataStruct *) SiS300_ExtLCD1280x1024Data;
- SiS_St2LCD1280x1024Data = (SiS_LCDDataStruct *) SiS300_St2LCD1280x1024Data;
- SiS_NoScaleData1024x768 = (SiS_LCDDataStruct *) SiS300_NoScaleData1024x768;
- SiS_NoScaleData1280x1024 = (SiS_LCDDataStruct *) SiS300_NoScaleData1280x1024;
- SiS_LCD1280x960Data = (SiS_LCDDataStruct *) SiS300_LCD1280x960Data;
- SiS_StPALData = (SiS_TVDataStruct *) SiS300_StPALData;
- SiS_ExtPALData = (SiS_TVDataStruct *) SiS300_ExtPALData;
- SiS_StNTSCData = (SiS_TVDataStruct *) SiS300_StNTSCData;
- SiS_ExtNTSCData = (SiS_TVDataStruct *) SiS300_ExtNTSCData;
- SiS_St1HiTVData = (SiS_TVDataStruct *) SiS300_St1HiTVData;
- SiS_St2HiTVData = (SiS_TVDataStruct *) SiS300_St2HiTVData;
- SiS_ExtHiTVData = (SiS_TVDataStruct *) SiS300_ExtHiTVData;
- SiS_NTSCTiming = SiS300_NTSCTiming;
- SiS_PALTiming = SiS300_PALTiming;
- SiS_HiTVSt1Timing = SiS300_HiTVSt1Timing;
- SiS_HiTVSt2Timing = SiS300_HiTVSt2Timing;
- SiS_HiTVTextTiming = SiS300_HiTVTextTiming;
- SiS_HiTVGroup3Data = SiS300_HiTVGroup3Data;
- SiS_HiTVGroup3Simu = SiS300_HiTVGroup3Simu;
- SiS_HiTVGroup3Text = SiS300_HiTVGroup3Text;
-
- SiS_PanelDelayTbl = (SiS_PanelDelayTblStruct *) SiS300_PanelDelayTbl;
- SiS_PanelDelayTblLVDS = (SiS_PanelDelayTblStruct *) SiS300_PanelDelayTblLVDS;
-
- SiS_LVDS800x600Data_1 = (SiS_LVDSDataStruct *) SiS300_LVDS800x600Data_1;
- SiS_LVDS800x600Data_2 = (SiS_LVDSDataStruct *) SiS300_LVDS800x600Data_2;
- SiS_LVDS1024x768Data_1 = (SiS_LVDSDataStruct *) SiS300_LVDS1024x768Data_1;
- SiS_LVDS1024x768Data_2 = (SiS_LVDSDataStruct *) SiS300_LVDS1024x768Data_2;
- SiS_LVDS1280x1024Data_1 = (SiS_LVDSDataStruct *) SiS300_LVDS1280x1024Data_1;
- SiS_LVDS1280x1024Data_2 = (SiS_LVDSDataStruct *) SiS300_LVDS1280x1024Data_2;
- SiS_LVDS1280x960Data_1 = (SiS_LVDSDataStruct *) SiS300_LVDS1280x1024Data_1;
- SiS_LVDS1280x960Data_2 = (SiS_LVDSDataStruct *) SiS300_LVDS1280x1024Data_2;
- SiS_LVDS640x480Data_1 = (SiS_LVDSDataStruct *) SiS300_LVDS640x480Data_1;
- SiS_LVDS1024x600Data_1 = (SiS_LVDSDataStruct *) SiS300_LVDS1024x600Data_1;
- SiS_LVDS1024x600Data_2 = (SiS_LVDSDataStruct *) SiS300_LVDS1024x600Data_2;
- SiS_LVDS1152x768Data_1 = (SiS_LVDSDataStruct *) SiS300_LVDS1152x768Data_1;
- SiS_LVDS1152x768Data_2 = (SiS_LVDSDataStruct *) SiS300_LVDS1152x768Data_2;
- SiS_CHTVUNTSCData = (SiS_LVDSDataStruct *) SiS300_CHTVUNTSCData;
- SiS_CHTVONTSCData = (SiS_LVDSDataStruct *) SiS300_CHTVONTSCData;
- SiS_CHTVUPALData = (SiS_LVDSDataStruct *) SiS300_CHTVUPALData;
- SiS_CHTVOPALData = (SiS_LVDSDataStruct *) SiS300_CHTVOPALData;
- SiS_PanelType00_1 = (SiS_LVDSDesStruct *) SiS300_PanelType00_1;
- SiS_PanelType01_1 = (SiS_LVDSDesStruct *) SiS300_PanelType01_1;
- SiS_PanelType02_1 = (SiS_LVDSDesStruct *) SiS300_PanelType02_1;
- SiS_PanelType03_1 = (SiS_LVDSDesStruct *) SiS300_PanelType03_1;
- SiS_PanelType04_1 = (SiS_LVDSDesStruct *) SiS300_PanelType04_1;
- SiS_PanelType05_1 = (SiS_LVDSDesStruct *) SiS300_PanelType05_1;
- SiS_PanelType06_1 = (SiS_LVDSDesStruct *) SiS300_PanelType06_1;
- SiS_PanelType07_1 = (SiS_LVDSDesStruct *) SiS300_PanelType07_1;
- SiS_PanelType08_1 = (SiS_LVDSDesStruct *) SiS300_PanelType08_1;
- SiS_PanelType09_1 = (SiS_LVDSDesStruct *) SiS300_PanelType09_1;
- SiS_PanelType0a_1 = (SiS_LVDSDesStruct *) SiS300_PanelType0a_1;
- SiS_PanelType0b_1 = (SiS_LVDSDesStruct *) SiS300_PanelType0b_1;
- SiS_PanelType0c_1 = (SiS_LVDSDesStruct *) SiS300_PanelType0c_1;
- SiS_PanelType0d_1 = (SiS_LVDSDesStruct *) SiS300_PanelType0d_1;
- SiS_PanelType0e_1 = (SiS_LVDSDesStruct *) SiS300_PanelType0e_1;
- SiS_PanelType0f_1 = (SiS_LVDSDesStruct *) SiS300_PanelType0f_1;
- SiS_PanelType00_2 = (SiS_LVDSDesStruct *) SiS300_PanelType00_2;
- SiS_PanelType01_2 = (SiS_LVDSDesStruct *) SiS300_PanelType01_2;
- SiS_PanelType02_2 = (SiS_LVDSDesStruct *) SiS300_PanelType02_2;
- SiS_PanelType03_2 = (SiS_LVDSDesStruct *) SiS300_PanelType03_2;
- SiS_PanelType04_2 = (SiS_LVDSDesStruct *) SiS300_PanelType04_2;
- SiS_PanelType05_2 = (SiS_LVDSDesStruct *) SiS300_PanelType05_2;
- SiS_PanelType06_2 = (SiS_LVDSDesStruct *) SiS300_PanelType06_2;
- SiS_PanelType07_2 = (SiS_LVDSDesStruct *) SiS300_PanelType07_2;
- SiS_PanelType08_2 = (SiS_LVDSDesStruct *) SiS300_PanelType08_2;
- SiS_PanelType09_2 = (SiS_LVDSDesStruct *) SiS300_PanelType09_2;
- SiS_PanelType0a_2 = (SiS_LVDSDesStruct *) SiS300_PanelType0a_2;
- SiS_PanelType0b_2 = (SiS_LVDSDesStruct *) SiS300_PanelType0b_2;
- SiS_PanelType0c_2 = (SiS_LVDSDesStruct *) SiS300_PanelType0c_2;
- SiS_PanelType0d_2 = (SiS_LVDSDesStruct *) SiS300_PanelType0d_2;
- SiS_PanelType0e_2 = (SiS_LVDSDesStruct *) SiS300_PanelType0e_2;
- SiS_PanelType0f_2 = (SiS_LVDSDesStruct *) SiS300_PanelType0f_2;
- SiS_CHTVUNTSCDesData = (SiS_LVDSDesStruct *) SiS300_CHTVUNTSCDesData;
- SiS_CHTVONTSCDesData = (SiS_LVDSDesStruct *) SiS300_CHTVONTSCDesData;
- SiS_CHTVUPALDesData = (SiS_LVDSDesStruct *) SiS300_CHTVUPALDesData;
- SiS_CHTVOPALDesData = (SiS_LVDSDesStruct *) SiS300_CHTVOPALDesData;
- SiS_LVDSCRT1800x600_1 = (SiS_LVDSCRT1DataStruct *) SiS300_LVDSCRT1800x600_1;
- SiS_LVDSCRT11024x768_1 = (SiS_LVDSCRT1DataStruct *) SiS300_LVDSCRT11024x768_1;
- SiS_LVDSCRT11280x1024_1 = (SiS_LVDSCRT1DataStruct *) SiS300_LVDSCRT11280x1024_1;
- SiS_LVDSCRT11024x600_1 = (SiS_LVDSCRT1DataStruct *) SiS300_LVDSCRT11024x600_1;
- SiS_LVDSCRT11152x768_1 = (SiS_LVDSCRT1DataStruct *) SiS300_LVDSCRT11152x768_1;
- SiS_LVDSCRT1800x600_1_H = (SiS_LVDSCRT1DataStruct *) SiS300_LVDSCRT1800x600_1_H;
- SiS_LVDSCRT11024x768_1_H = (SiS_LVDSCRT1DataStruct *) SiS300_LVDSCRT11024x768_1_H;
- SiS_LVDSCRT11280x1024_1_H = (SiS_LVDSCRT1DataStruct *) SiS300_LVDSCRT11280x1024_1_H;
- SiS_LVDSCRT11024x600_1_H = (SiS_LVDSCRT1DataStruct *) SiS300_LVDSCRT11024x600_1_H;
- SiS_LVDSCRT11152x768_1_H = (SiS_LVDSCRT1DataStruct *) SiS300_LVDSCRT11152x768_1_H;
- SiS_LVDSCRT1800x600_2 = (SiS_LVDSCRT1DataStruct *) SiS300_LVDSCRT1800x600_2;
- SiS_LVDSCRT11024x768_2 = (SiS_LVDSCRT1DataStruct *) SiS300_LVDSCRT11024x768_2;
- SiS_LVDSCRT11280x1024_2 = (SiS_LVDSCRT1DataStruct *) SiS300_LVDSCRT11280x1024_2;
- SiS_LVDSCRT11024x600_2 = (SiS_LVDSCRT1DataStruct *) SiS300_LVDSCRT11024x600_2;
- SiS_LVDSCRT11152x768_2 = (SiS_LVDSCRT1DataStruct *) SiS300_LVDSCRT11152x768_2;
- SiS_LVDSCRT1800x600_2_H = (SiS_LVDSCRT1DataStruct *) SiS300_LVDSCRT1800x600_2_H;
- SiS_LVDSCRT11024x768_2_H = (SiS_LVDSCRT1DataStruct *) SiS300_LVDSCRT11024x768_2_H;
- SiS_LVDSCRT11280x1024_2_H = (SiS_LVDSCRT1DataStruct *) SiS300_LVDSCRT11280x1024_2_H;
- SiS_LVDSCRT11024x600_2_H = (SiS_LVDSCRT1DataStruct *) SiS300_LVDSCRT11024x600_2_H;
- SiS_LVDSCRT11152x768_2_H = (SiS_LVDSCRT1DataStruct *) SiS300_LVDSCRT11152x768_2_H;
- SiS_CHTVCRT1UNTSC = (SiS_LVDSCRT1DataStruct *) SiS300_CHTVCRT1UNTSC;
- SiS_CHTVCRT1ONTSC = (SiS_LVDSCRT1DataStruct *) SiS300_CHTVCRT1ONTSC;
- SiS_CHTVCRT1UPAL = (SiS_LVDSCRT1DataStruct *) SiS300_CHTVCRT1UPAL;
- SiS_CHTVCRT1OPAL = (SiS_LVDSCRT1DataStruct *) SiS300_CHTVCRT1OPAL;
- SiS_CHTVReg_UNTSC = (SiS_CHTVRegDataStruct *) SiS300_CHTVReg_UNTSC;
- SiS_CHTVReg_ONTSC = (SiS_CHTVRegDataStruct *) SiS300_CHTVReg_ONTSC;
- SiS_CHTVReg_UPAL = (SiS_CHTVRegDataStruct *) SiS300_CHTVReg_UPAL;
- SiS_CHTVReg_OPAL = (SiS_CHTVRegDataStruct *) SiS300_CHTVReg_OPAL;
- SiS_CHTVVCLKUNTSC = SiS300_CHTVVCLKUNTSC;
- SiS_CHTVVCLKONTSC = SiS300_CHTVVCLKONTSC;
- SiS_CHTVVCLKUPAL = SiS300_CHTVVCLKUPAL;
- SiS_CHTVVCLKOPAL = SiS300_CHTVVCLKOPAL;
-
- Panel320x480 = Panel300_320x480;
- Panel640x480 = Panel300_640x480;
- Panel800x600 = Panel300_800x600;
- Panel1024x768 = Panel300_1024x768;
- Panel1280x1024 = Panel300_1280x1024;
- Panel1280x960 = Panel300_1280x960;
- Panel1024x600 = Panel300_1024x600;
- Panel1152x768 = Panel300_1152x768;
- Panel1600x1200 = 16; /*Panel300_1600x1200; OLD */
- Panel1400x1050 = 16; /* TW: Something illegal */
- Panel1152x864 = 16; /* TW: Something illegal */
- Panel1280x768 = 16; /* TW: Something illegal */
- Panel1024x600 = 16; /* TW: Something illegal */
- PanelMax = Panel300_320x480; /* TW: highest value */
- PanelMinLVDS = Panel300_800x600; /* TW: Lowest value LVDS */
- PanelMin301 = Panel310_1024x768; /* TW: lowest value 301 */
+ SiS_Pr->SiS_SModeIDTable = (SiS_StStruct *)SiS300_SModeIDTable;
+ SiS_Pr->SiS_VBModeIDTable = (SiS_VBModeStruct *)SiS300_VBModeIDTable;
+ SiS_Pr->SiS_StandTable = (SiS_StandTableStruct *)SiS300_StandTable;
+ SiS_Pr->SiS_EModeIDTable = (SiS_ExtStruct *)SiS300_EModeIDTable;
+ SiS_Pr->SiS_RefIndex = (SiS_Ext2Struct *)SiS300_RefIndex;
+ SiS_Pr->SiS_CRT1Table = (SiS_CRT1TableStruct *)SiS300_CRT1Table;
+ if(HwDeviceExtension->jChipType == SIS_300) {
+ SiS_Pr->SiS_MCLKData_0 = (SiS_MCLKDataStruct *)SiS300_MCLKData_300; /* 300 */
+ } else {
+ SiS_Pr->SiS_MCLKData_0 = (SiS_MCLKDataStruct *)SiS300_MCLKData_630; /* 630, 730 */
+ }
+ SiS_Pr->SiS_ECLKData = (SiS_ECLKDataStruct *)SiS300_ECLKData;
+ SiS_Pr->SiS_VCLKData = (SiS_VCLKDataStruct *)SiS300_VCLKData;
+ SiS_Pr->SiS_VBVCLKData = (SiS_VBVCLKDataStruct *)SiS300_VCLKData;
+ SiS_Pr->SiS_ScreenOffset = SiS300_ScreenOffset;
+ SiS_Pr->SiS_StResInfo = (SiS_StResInfoStruct *)SiS300_StResInfo;
+ SiS_Pr->SiS_ModeResInfo = (SiS_ModeResInfoStruct *)SiS300_ModeResInfo;
+
+ SiS_Pr->pSiS_OutputSelect = &SiS300_OutputSelect;
+ SiS_Pr->pSiS_SoftSetting = &SiS300_SoftSetting;
+
+ SiS_Pr->SiS_SR15 = SiS300_SR15;
+#ifndef LINUX_XF86
+ SiS_Pr->pSiS_SR07 = &SiS300_SR07;
+ SiS_Pr->SiS_CR40 = SiS300_CR40;
+ SiS_Pr->SiS_CR49 = SiS300_CR49;
+ SiS_Pr->pSiS_SR1F = &SiS300_SR1F;
+ SiS_Pr->pSiS_SR21 = &SiS300_SR21;
+ SiS_Pr->pSiS_SR22 = &SiS300_SR22;
+ SiS_Pr->pSiS_SR23 = &SiS300_SR23;
+ SiS_Pr->pSiS_SR24 = &SiS300_SR24;
+ SiS_Pr->SiS_SR25 = SiS300_SR25;
+ SiS_Pr->pSiS_SR31 = &SiS300_SR31;
+ SiS_Pr->pSiS_SR32 = &SiS300_SR32;
+ SiS_Pr->pSiS_SR33 = &SiS300_SR33;
+ SiS_Pr->pSiS_CRT2Data_1_2 = &SiS300_CRT2Data_1_2;
+ SiS_Pr->pSiS_CRT2Data_4_D = &SiS300_CRT2Data_4_D;
+ SiS_Pr->pSiS_CRT2Data_4_E = &SiS300_CRT2Data_4_E;
+ SiS_Pr->pSiS_CRT2Data_4_10 = &SiS300_CRT2Data_4_10;
+ SiS_Pr->pSiS_RGBSenseData = &SiS300_RGBSenseData;
+ SiS_Pr->pSiS_VideoSenseData = &SiS300_VideoSenseData;
+ SiS_Pr->pSiS_YCSenseData = &SiS300_YCSenseData;
+ SiS_Pr->pSiS_RGBSenseData2 = &SiS300_RGBSenseData2;
+ SiS_Pr->pSiS_VideoSenseData2 = &SiS300_VideoSenseData2;
+ SiS_Pr->pSiS_YCSenseData2 = &SiS300_YCSenseData2;
+#endif
+
+ SiS_Pr->SiS_NTSCPhase = SiS300_NTSCPhase;
+ SiS_Pr->SiS_PALPhase = SiS300_PALPhase;
+ SiS_Pr->SiS_NTSCPhase2 = SiS300_NTSCPhase2;
+ SiS_Pr->SiS_PALPhase2 = SiS300_PALPhase2;
+ SiS_Pr->SiS_PALMPhase = SiS300_PALMPhase;
+ SiS_Pr->SiS_PALNPhase = SiS300_PALNPhase;
+ SiS_Pr->SiS_PALMPhase2 = SiS300_PALMPhase2;
+ SiS_Pr->SiS_PALNPhase2 = SiS300_PALNPhase2;
+
+ SiS_Pr->SiS_StLCD1024x768Data = (SiS_LCDDataStruct *)SiS300_StLCD1024x768Data;
+ SiS_Pr->SiS_ExtLCD1024x768Data = (SiS_LCDDataStruct *)SiS300_ExtLCD1024x768Data;
+ SiS_Pr->SiS_St2LCD1024x768Data = (SiS_LCDDataStruct *)SiS300_St2LCD1024x768Data;
+ SiS_Pr->SiS_StLCD1280x1024Data = (SiS_LCDDataStruct *)SiS300_StLCD1280x1024Data;
+ SiS_Pr->SiS_ExtLCD1280x1024Data = (SiS_LCDDataStruct *)SiS300_ExtLCD1280x1024Data;
+ SiS_Pr->SiS_St2LCD1280x1024Data = (SiS_LCDDataStruct *)SiS300_St2LCD1280x1024Data;
+ SiS_Pr->SiS_NoScaleData1024x768 = (SiS_LCDDataStruct *)SiS300_NoScaleData1024x768;
+ SiS_Pr->SiS_NoScaleData1280x1024 = (SiS_LCDDataStruct *)SiS300_NoScaleData1280x1024;
+ SiS_Pr->SiS_LCD1280x960Data = (SiS_LCDDataStruct *)SiS300_LCD1280x960Data;
+ SiS_Pr->SiS_ExtLCD1400x1050Data = (SiS_LCDDataStruct *)SiS300_ExtLCD1400x1050Data;
+ SiS_Pr->SiS_ExtLCD1600x1200Data = (SiS_LCDDataStruct *)SiS300_ExtLCD1600x1200Data;
+ SiS_Pr->SiS_StLCD1400x1050Data = (SiS_LCDDataStruct *)SiS300_StLCD1400x1050Data;
+ SiS_Pr->SiS_StLCD1600x1200Data = (SiS_LCDDataStruct *)SiS300_StLCD1600x1200Data;
+ SiS_Pr->SiS_NoScaleData1400x1050 = (SiS_LCDDataStruct *)SiS300_NoScaleData1400x1050;
+ SiS_Pr->SiS_NoScaleData1600x1200 = (SiS_LCDDataStruct *)SiS300_NoScaleData1600x1200;
+
+ SiS_Pr->SiS_StPALData = (SiS_TVDataStruct *)SiS300_StPALData;
+ SiS_Pr->SiS_ExtPALData = (SiS_TVDataStruct *)SiS300_ExtPALData;
+ SiS_Pr->SiS_StNTSCData = (SiS_TVDataStruct *)SiS300_StNTSCData;
+ SiS_Pr->SiS_ExtNTSCData = (SiS_TVDataStruct *)SiS300_ExtNTSCData;
+/* SiS_Pr->SiS_St1HiTVData = (SiS_TVDataStruct *)SiS300_St1HiTVData; */
+ SiS_Pr->SiS_St2HiTVData = (SiS_TVDataStruct *)SiS300_St2HiTVData;
+ SiS_Pr->SiS_ExtHiTVData = (SiS_TVDataStruct *)SiS300_ExtHiTVData;
+
+ SiS_Pr->SiS_NTSCTiming = SiS300_NTSCTiming;
+ SiS_Pr->SiS_PALTiming = SiS300_PALTiming;
+ SiS_Pr->SiS_HiTVSt1Timing = SiS300_HiTVSt1Timing;
+ SiS_Pr->SiS_HiTVSt2Timing = SiS300_HiTVSt2Timing;
+ SiS_Pr->SiS_HiTVTextTiming = SiS300_HiTVTextTiming;
+ SiS_Pr->SiS_HiTVGroup3Data = SiS300_HiTVGroup3Data;
+ SiS_Pr->SiS_HiTVGroup3Simu = SiS300_HiTVGroup3Simu;
+ SiS_Pr->SiS_HiTVGroup3Text = SiS300_HiTVGroup3Text;
+
+ SiS_Pr->SiS_PanelDelayTbl = (SiS_PanelDelayTblStruct *)SiS300_PanelDelayTbl;
+ SiS_Pr->SiS_PanelDelayTblLVDS = (SiS_PanelDelayTblStruct *)SiS300_PanelDelayTblLVDS;
+
+ SiS_Pr->SiS_LVDS800x600Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS800x600Data_1;
+ SiS_Pr->SiS_LVDS800x600Data_2 = (SiS_LVDSDataStruct *)SiS300_LVDS800x600Data_2;
+ SiS_Pr->SiS_LVDS1024x768Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS1024x768Data_1;
+ SiS_Pr->SiS_LVDS1024x768Data_2 = (SiS_LVDSDataStruct *)SiS300_LVDS1024x768Data_2;
+ SiS_Pr->SiS_LVDS1280x1024Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS1280x1024Data_1;
+ SiS_Pr->SiS_LVDS1280x1024Data_2 = (SiS_LVDSDataStruct *)SiS300_LVDS1280x1024Data_2;
+ SiS_Pr->SiS_LVDS1280x960Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS1280x1024Data_1;
+ SiS_Pr->SiS_LVDS1280x960Data_2 = (SiS_LVDSDataStruct *)SiS300_LVDS1280x1024Data_2;
+ SiS_Pr->SiS_LVDS1400x1050Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS1400x1050Data_1;
+ SiS_Pr->SiS_LVDS1400x1050Data_2 = (SiS_LVDSDataStruct *)SiS300_LVDS1400x1050Data_2;
+ SiS_Pr->SiS_LVDS1280x768Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS1280x768Data_1;
+ SiS_Pr->SiS_LVDS1280x768Data_2 = (SiS_LVDSDataStruct *)SiS300_LVDS1280x768Data_2;
+ SiS_Pr->SiS_LVDS1024x600Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS1024x600Data_1;
+ SiS_Pr->SiS_LVDS1024x600Data_2 = (SiS_LVDSDataStruct *)SiS300_LVDS1024x600Data_2;
+ SiS_Pr->SiS_LVDS1152x768Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS1152x768Data_1;
+ SiS_Pr->SiS_LVDS1152x768Data_2 = (SiS_LVDSDataStruct *)SiS300_LVDS1152x768Data_2;
+ SiS_Pr->SiS_LVDSXXXxXXXData_1 = (SiS_LVDSDataStruct *)SiS300_LVDSXXXxXXXData_1;
+ SiS_Pr->SiS_LVDS320x480Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS320x480Data_1;
+ SiS_Pr->SiS_LVDS640x480Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS640x480Data_1;
+ SiS_Pr->SiS_LCDA1400x1050Data_1 = (SiS_LVDSDataStruct *)SiS300_LCDA1400x1050Data_1;
+ SiS_Pr->SiS_LCDA1400x1050Data_2 = (SiS_LVDSDataStruct *)SiS300_LCDA1400x1050Data_2;
+ SiS_Pr->SiS_LCDA1600x1200Data_1 = (SiS_LVDSDataStruct *)SiS300_LCDA1600x1200Data_1;
+ SiS_Pr->SiS_LCDA1600x1200Data_2 = (SiS_LVDSDataStruct *)SiS300_LCDA1600x1200Data_2;
+ SiS_Pr->SiS_CHTVUNTSCData = (SiS_LVDSDataStruct *)SiS300_CHTVUNTSCData;
+ SiS_Pr->SiS_CHTVONTSCData = (SiS_LVDSDataStruct *)SiS300_CHTVONTSCData;
+ SiS_Pr->SiS_CHTVUPALData = (SiS_LVDSDataStruct *)SiS300_CHTVUPALData;
+ SiS_Pr->SiS_CHTVOPALData = (SiS_LVDSDataStruct *)SiS300_CHTVOPALData;
+ SiS_Pr->SiS_CHTVUPALMData = (SiS_LVDSDataStruct *)SiS300_CHTVUNTSCData; /* not supported on 300 series */
+ SiS_Pr->SiS_CHTVOPALMData = (SiS_LVDSDataStruct *)SiS300_CHTVONTSCData; /* not supported on 300 series */
+ SiS_Pr->SiS_CHTVUPALNData = (SiS_LVDSDataStruct *)SiS300_CHTVUPALData; /* not supported on 300 series */
+ SiS_Pr->SiS_CHTVOPALNData = (SiS_LVDSDataStruct *)SiS300_CHTVOPALData; /* not supported on 300 series */
+ SiS_Pr->SiS_CHTVSOPALData = (SiS_LVDSDataStruct *)SiS300_CHTVSOPALData;
+ SiS_Pr->SiS_PanelType00_1 = (SiS_LVDSDesStruct *)SiS300_PanelType00_1;
+ SiS_Pr->SiS_PanelType01_1 = (SiS_LVDSDesStruct *)SiS300_PanelType01_1;
+ SiS_Pr->SiS_PanelType02_1 = (SiS_LVDSDesStruct *)SiS300_PanelType02_1;
+ SiS_Pr->SiS_PanelType03_1 = (SiS_LVDSDesStruct *)SiS300_PanelType03_1;
+ SiS_Pr->SiS_PanelType04_1 = (SiS_LVDSDesStruct *)SiS300_PanelType04_1;
+ SiS_Pr->SiS_PanelType05_1 = (SiS_LVDSDesStruct *)SiS300_PanelType05_1;
+ SiS_Pr->SiS_PanelType06_1 = (SiS_LVDSDesStruct *)SiS300_PanelType06_1;
+ SiS_Pr->SiS_PanelType07_1 = (SiS_LVDSDesStruct *)SiS300_PanelType07_1;
+ SiS_Pr->SiS_PanelType08_1 = (SiS_LVDSDesStruct *)SiS300_PanelType08_1;
+ SiS_Pr->SiS_PanelType09_1 = (SiS_LVDSDesStruct *)SiS300_PanelType09_1;
+ SiS_Pr->SiS_PanelType0a_1 = (SiS_LVDSDesStruct *)SiS300_PanelType0a_1;
+ SiS_Pr->SiS_PanelType0b_1 = (SiS_LVDSDesStruct *)SiS300_PanelType0b_1;
+ SiS_Pr->SiS_PanelType0c_1 = (SiS_LVDSDesStruct *)SiS300_PanelType0c_1;
+ SiS_Pr->SiS_PanelType0d_1 = (SiS_LVDSDesStruct *)SiS300_PanelType0d_1;
+ SiS_Pr->SiS_PanelType0e_1 = (SiS_LVDSDesStruct *)SiS300_PanelType0e_1;
+ SiS_Pr->SiS_PanelType0f_1 = (SiS_LVDSDesStruct *)SiS300_PanelType0f_1;
+ SiS_Pr->SiS_PanelType00_2 = (SiS_LVDSDesStruct *)SiS300_PanelType00_2;
+ SiS_Pr->SiS_PanelType01_2 = (SiS_LVDSDesStruct *)SiS300_PanelType01_2;
+ SiS_Pr->SiS_PanelType02_2 = (SiS_LVDSDesStruct *)SiS300_PanelType02_2;
+ SiS_Pr->SiS_PanelType03_2 = (SiS_LVDSDesStruct *)SiS300_PanelType03_2;
+ SiS_Pr->SiS_PanelType04_2 = (SiS_LVDSDesStruct *)SiS300_PanelType04_2;
+ SiS_Pr->SiS_PanelType05_2 = (SiS_LVDSDesStruct *)SiS300_PanelType05_2;
+ SiS_Pr->SiS_PanelType06_2 = (SiS_LVDSDesStruct *)SiS300_PanelType06_2;
+ SiS_Pr->SiS_PanelType07_2 = (SiS_LVDSDesStruct *)SiS300_PanelType07_2;
+ SiS_Pr->SiS_PanelType08_2 = (SiS_LVDSDesStruct *)SiS300_PanelType08_2;
+ SiS_Pr->SiS_PanelType09_2 = (SiS_LVDSDesStruct *)SiS300_PanelType09_2;
+ SiS_Pr->SiS_PanelType0a_2 = (SiS_LVDSDesStruct *)SiS300_PanelType0a_2;
+ SiS_Pr->SiS_PanelType0b_2 = (SiS_LVDSDesStruct *)SiS300_PanelType0b_2;
+ SiS_Pr->SiS_PanelType0c_2 = (SiS_LVDSDesStruct *)SiS300_PanelType0c_2;
+ SiS_Pr->SiS_PanelType0d_2 = (SiS_LVDSDesStruct *)SiS300_PanelType0d_2;
+ SiS_Pr->SiS_PanelType0e_2 = (SiS_LVDSDesStruct *)SiS300_PanelType0e_2;
+ SiS_Pr->SiS_PanelType0f_2 = (SiS_LVDSDesStruct *)SiS300_PanelType0f_2;
+ SiS_Pr->SiS_CHTVUNTSCDesData = (SiS_LVDSDesStruct *)SiS300_CHTVUNTSCDesData;
+ SiS_Pr->SiS_CHTVONTSCDesData = (SiS_LVDSDesStruct *)SiS300_CHTVONTSCDesData;
+ SiS_Pr->SiS_CHTVUPALDesData = (SiS_LVDSDesStruct *)SiS300_CHTVUPALDesData;
+ SiS_Pr->SiS_CHTVOPALDesData = (SiS_LVDSDesStruct *)SiS300_CHTVOPALDesData;
+ SiS_Pr->SiS_LVDSCRT1800x600_1 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT1800x600_1;
+ SiS_Pr->SiS_LVDSCRT11024x768_1 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11024x768_1;
+ SiS_Pr->SiS_LVDSCRT11280x1024_1 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11280x1024_1;
+ SiS_Pr->SiS_LVDSCRT11024x600_1 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11024x600_1;
+ SiS_Pr->SiS_LVDSCRT11152x768_1 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11152x768_1;
+ SiS_Pr->SiS_LVDSCRT1800x600_1_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT1800x600_1_H;
+ SiS_Pr->SiS_LVDSCRT11024x768_1_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11024x768_1_H;
+ SiS_Pr->SiS_LVDSCRT11280x1024_1_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11280x1024_1_H;
+ SiS_Pr->SiS_LVDSCRT11024x600_1_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11024x600_1_H;
+ SiS_Pr->SiS_LVDSCRT11152x768_1_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11152x768_1_H;
+ SiS_Pr->SiS_LVDSCRT1800x600_2 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT1800x600_2;
+ SiS_Pr->SiS_LVDSCRT11024x768_2 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11024x768_2;
+ SiS_Pr->SiS_LVDSCRT11280x1024_2 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11280x1024_2;
+ SiS_Pr->SiS_LVDSCRT11024x600_2 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11024x600_2;
+ SiS_Pr->SiS_LVDSCRT11152x768_2 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11152x768_2;
+ SiS_Pr->SiS_LVDSCRT1800x600_2_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT1800x600_2_H;
+ SiS_Pr->SiS_LVDSCRT11024x768_2_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11024x768_2_H;
+ SiS_Pr->SiS_LVDSCRT11280x1024_2_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11280x1024_2_H;
+ SiS_Pr->SiS_LVDSCRT11024x600_2_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11024x600_2_H;
+ SiS_Pr->SiS_LVDSCRT11152x768_2_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11152x768_2_H;
+ SiS_Pr->SiS_CHTVCRT1UNTSC = (SiS_LVDSCRT1DataStruct *)SiS300_CHTVCRT1UNTSC;
+ SiS_Pr->SiS_CHTVCRT1ONTSC = (SiS_LVDSCRT1DataStruct *)SiS300_CHTVCRT1ONTSC;
+ SiS_Pr->SiS_CHTVCRT1UPAL = (SiS_LVDSCRT1DataStruct *)SiS300_CHTVCRT1UPAL;
+ SiS_Pr->SiS_CHTVCRT1OPAL = (SiS_LVDSCRT1DataStruct *)SiS300_CHTVCRT1OPAL;
+ SiS_Pr->SiS_CHTVCRT1SOPAL = (SiS_LVDSCRT1DataStruct *)SiS300_CHTVCRT1SOPAL;
+ SiS_Pr->SiS_CHTVReg_UNTSC = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_UNTSC;
+ SiS_Pr->SiS_CHTVReg_ONTSC = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_ONTSC;
+ SiS_Pr->SiS_CHTVReg_UPAL = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_UPAL;
+ SiS_Pr->SiS_CHTVReg_OPAL = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_OPAL;
+ SiS_Pr->SiS_CHTVReg_UPALM = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_UNTSC; /* not supported on 300 series */
+ SiS_Pr->SiS_CHTVReg_OPALM = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_ONTSC; /* not supported on 300 series */
+ SiS_Pr->SiS_CHTVReg_UPALN = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_UPAL; /* not supported on 300 series */
+ SiS_Pr->SiS_CHTVReg_OPALN = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_OPAL; /* not supported on 300 series */
+ SiS_Pr->SiS_CHTVReg_SOPAL = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_SOPAL;
+ SiS_Pr->SiS_CHTVVCLKUNTSC = SiS300_CHTVVCLKUNTSC;
+ SiS_Pr->SiS_CHTVVCLKONTSC = SiS300_CHTVVCLKONTSC;
+ SiS_Pr->SiS_CHTVVCLKUPAL = SiS300_CHTVVCLKUPAL;
+ SiS_Pr->SiS_CHTVVCLKOPAL = SiS300_CHTVVCLKOPAL;
+ SiS_Pr->SiS_CHTVVCLKUPALM = SiS300_CHTVVCLKUNTSC; /* not supported on 300 series */
+ SiS_Pr->SiS_CHTVVCLKOPALM = SiS300_CHTVVCLKONTSC; /* not supported on 300 series */
+ SiS_Pr->SiS_CHTVVCLKUPALN = SiS300_CHTVVCLKUPAL; /* not supported on 300 series */
+ SiS_Pr->SiS_CHTVVCLKOPALN = SiS300_CHTVVCLKOPAL; /* not supported on 300 series */
+ SiS_Pr->SiS_CHTVVCLKSOPAL = SiS300_CHTVVCLKSOPAL;
+
+ /* TW: New from 300/301LV BIOS */
+ SiS_Pr->SiS_CRT2Part2_1024x768_1 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1024x768_1;
+ SiS_Pr->SiS_CRT2Part2_1280x1024_1 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1280x1024_1;
+ SiS_Pr->SiS_CRT2Part2_1400x1050_1 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1400x1050_1;
+ SiS_Pr->SiS_CRT2Part2_1600x1200_1 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1600x1200_1;
+ SiS_Pr->SiS_CRT2Part2_1024x768_2 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1024x768_2;
+ SiS_Pr->SiS_CRT2Part2_1280x1024_2 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1280x1024_2;
+ SiS_Pr->SiS_CRT2Part2_1400x1050_2 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1400x1050_2;
+ SiS_Pr->SiS_CRT2Part2_1600x1200_2 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1600x1200_2;
+ SiS_Pr->SiS_CRT2Part2_1024x768_3 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1024x768_3;
+ SiS_Pr->SiS_CRT2Part2_1280x1024_3 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1280x1024_3;
+ SiS_Pr->SiS_CRT2Part2_1400x1050_3 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1400x1050_3;
+ SiS_Pr->SiS_CRT2Part2_1600x1200_3 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1600x1200_3;
+
+ /* TW: LCDResInfo will on 300 series be translated to 310/325 series definitions */
+ SiS_Pr->SiS_Panel320x480 = Panel_320x480;
+ SiS_Pr->SiS_Panel640x480 = Panel_640x480;
+ SiS_Pr->SiS_Panel800x600 = Panel_800x600;
+ SiS_Pr->SiS_Panel1024x768 = Panel_1024x768;
+ SiS_Pr->SiS_Panel1280x1024 = Panel_1280x1024;
+ SiS_Pr->SiS_Panel1280x960 = Panel_1280x960;
+ SiS_Pr->SiS_Panel1024x600 = Panel_1024x600;
+ SiS_Pr->SiS_Panel1152x768 = Panel_1152x768;
+ SiS_Pr->SiS_Panel1600x1200 = 16; /* TW: Something illegal */
+ SiS_Pr->SiS_Panel1400x1050 = 16; /* TW: Something illegal */
+ SiS_Pr->SiS_Panel1152x864 = 16; /* TW: Something illegal */
+ SiS_Pr->SiS_Panel1280x768 = 16; /* TW: Something illegal */
+ SiS_Pr->SiS_PanelMax = Panel_320x480; /* TW: highest value */
+ SiS_Pr->SiS_PanelMinLVDS = Panel_800x600; /* TW: Lowest value LVDS */
+ SiS_Pr->SiS_PanelMin301 = Panel_1024x768; /* TW: lowest value 301 */
}
#endif
#ifdef SIS315H
-void
-InitTo310Pointer(PSIS_HW_DEVICE_INFO HwDeviceExtension)
+static void
+InitTo310Pointer(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
- SiS_SModeIDTable = (SiS_StStruct *) SiS310_SModeIDTable;
- SiS_StandTable = (SiS_StandTableStruct *) SiS310_StandTable;
- SiS_EModeIDTable = (SiS_ExtStruct *) SiS310_EModeIDTable;
- SiS_RefIndex = (SiS_Ext2Struct *) SiS310_RefIndex;
- SiS_CRT1Table = (SiS_CRT1TableStruct *) SiS310_CRT1Table;
-
+ SiS_Pr->SiS_SModeIDTable = (SiS_StStruct *)SiS310_SModeIDTable;
+ SiS_Pr->SiS_StandTable = (SiS_StandTableStruct *)SiS310_StandTable;
+ SiS_Pr->SiS_EModeIDTable = (SiS_ExtStruct *)SiS310_EModeIDTable;
+ SiS_Pr->SiS_RefIndex = (SiS_Ext2Struct *)SiS310_RefIndex;
+ SiS_Pr->SiS_CRT1Table = (SiS_CRT1TableStruct *)SiS310_CRT1Table;
/* TW: MCLK is different */
- if(HwDeviceExtension->jChipType > SIS_315PRO) {
- SiS_MCLKData_0 = (SiS_MCLKDataStruct *) SiS310_MCLKData_0_650; /* 550, 650 */
+ if(HwDeviceExtension->jChipType == SIS_330) {
+ SiS_Pr->SiS_MCLKData_0 = (SiS_MCLKDataStruct *)SiS310_MCLKData_0_330; /* 330 */
+ } else if(HwDeviceExtension->jChipType > SIS_315PRO) {
+ SiS_Pr->SiS_MCLKData_0 = (SiS_MCLKDataStruct *)SiS310_MCLKData_0_650; /* 550, 650, 740 */
} else {
- SiS_MCLKData_0 = (SiS_MCLKDataStruct *) SiS310_MCLKData_0_315; /* 315 */
+ SiS_Pr->SiS_MCLKData_0 = (SiS_MCLKDataStruct *)SiS310_MCLKData_0_315; /* 315 */
}
- SiS_MCLKData_1 = (SiS_MCLKDataStruct *) SiS310_MCLKData_1;
- SiS_ECLKData = (SiS_ECLKDataStruct *) SiS310_ECLKData;
- SiS_VCLKData = (SiS_VCLKDataStruct *) SiS310_VCLKData;
- SiS_VBVCLKData = (SiS_VBVCLKDataStruct *) SiS310_VBVCLKData;
-
- SiS_ScreenOffset = SiS310_ScreenOffset;
- SiS_StResInfo = (SiS_StResInfoStruct *) SiS310_StResInfo;
- SiS_ModeResInfo = (SiS_ModeResInfoStruct *) SiS310_ModeResInfo;
-
- pSiS_OutputSelect = &SiS310_OutputSelect;
- pSiS_SoftSetting = &SiS310_SoftSetting;
- pSiS_SR07 = &SiS310_SR07;
- SiS_SR15 = SiS310_SR15;
- SiS_CR40 = SiS310_CR40;
- SiS_CR49 = SiS310_CR49;
- pSiS_SR1F = &SiS310_SR1F;
- pSiS_SR21 = &SiS310_SR21;
- pSiS_SR22 = &SiS310_SR22;
- pSiS_SR23 = &SiS310_SR23;
- pSiS_SR24 = &SiS310_SR24;
- SiS_SR25 = SiS310_SR25;
- pSiS_SR31 = &SiS310_SR31;
- pSiS_SR32 = &SiS310_SR32;
- pSiS_SR33 = &SiS310_SR33;
- pSiS_CRT2Data_1_2 = &SiS310_CRT2Data_1_2;
- pSiS_CRT2Data_4_D = &SiS310_CRT2Data_4_D;
- pSiS_CRT2Data_4_E = &SiS310_CRT2Data_4_E;
- pSiS_CRT2Data_4_10 = &SiS310_CRT2Data_4_10;
- pSiS_RGBSenseData = &SiS310_RGBSenseData;
- pSiS_VideoSenseData = &SiS310_VideoSenseData;
- pSiS_YCSenseData = &SiS310_YCSenseData;
- pSiS_RGBSenseData2 = &SiS310_RGBSenseData2;
- pSiS_VideoSenseData2 = &SiS310_VideoSenseData2;
- pSiS_YCSenseData2 = &SiS310_YCSenseData2;
- SiS_NTSCPhase = SiS310_NTSCPhase;
- SiS_PALPhase = SiS310_PALPhase;
- SiS_NTSCPhase2 = SiS310_NTSCPhase2;
- SiS_PALPhase2 = SiS310_PALPhase2;
- SiS_PALMPhase = SiS310_PALMPhase;
- SiS_PALNPhase = SiS310_PALNPhase;
- SiS_PALMPhase2 = SiS310_PALMPhase2;
- SiS_PALNPhase2 = SiS310_PALNPhase2;
-
- SiS_StLCD1024x768Data = (SiS_LCDDataStruct *) SiS310_StLCD1024x768Data;
- SiS_ExtLCD1024x768Data = (SiS_LCDDataStruct *) SiS310_ExtLCD1024x768Data;
- SiS_St2LCD1024x768Data = (SiS_LCDDataStruct *) SiS310_St2LCD1024x768Data;
- SiS_StLCD1280x1024Data = (SiS_LCDDataStruct *) SiS310_StLCD1280x1024Data;
- SiS_ExtLCD1280x1024Data = (SiS_LCDDataStruct *) SiS310_ExtLCD1280x1024Data;
- SiS_St2LCD1280x1024Data = (SiS_LCDDataStruct *) SiS310_St2LCD1280x1024Data;
- SiS_NoScaleData1024x768 = (SiS_LCDDataStruct *) SiS310_NoScaleData1024x768;
- SiS_NoScaleData1280x1024 = (SiS_LCDDataStruct *) SiS310_NoScaleData1280x1024;
- SiS_LCD1280x960Data = (SiS_LCDDataStruct *) SiS310_LCD1280x960Data;
- SiS_StPALData = (SiS_TVDataStruct *) SiS310_StPALData;
- SiS_ExtPALData = (SiS_TVDataStruct *) SiS310_ExtPALData;
- SiS_StNTSCData = (SiS_TVDataStruct *) SiS310_StNTSCData;
- SiS_ExtNTSCData = (SiS_TVDataStruct *) SiS310_ExtNTSCData;
- SiS_St1HiTVData = (SiS_TVDataStruct *) SiS310_St1HiTVData;
- SiS_St2HiTVData = (SiS_TVDataStruct *) SiS310_St2HiTVData;
- SiS_ExtHiTVData = (SiS_TVDataStruct *) SiS310_ExtHiTVData;
- SiS_NTSCTiming = SiS310_NTSCTiming;
- SiS_PALTiming = SiS310_PALTiming;
- SiS_HiTVSt1Timing = SiS310_HiTVSt1Timing;
- SiS_HiTVSt2Timing = SiS310_HiTVSt2Timing;
- SiS_HiTVTextTiming = SiS310_HiTVTextTiming;
- SiS_HiTVGroup3Data = SiS310_HiTVGroup3Data;
- SiS_HiTVGroup3Simu = SiS310_HiTVGroup3Simu;
- SiS_HiTVGroup3Text = SiS310_HiTVGroup3Text;
-
- SiS_PanelDelayTbl = (SiS_PanelDelayTblStruct *) SiS310_PanelDelayTbl;
- SiS_PanelDelayTblLVDS = (SiS_PanelDelayTblStruct *) SiS310_PanelDelayTblLVDS;
-
- SiS_LVDS800x600Data_1 = (SiS_LVDSDataStruct *) SiS310_LVDS800x600Data_1;
- SiS_LVDS800x600Data_2 = (SiS_LVDSDataStruct *) SiS310_LVDS800x600Data_2;
- SiS_LVDS1024x768Data_1 = (SiS_LVDSDataStruct *) SiS310_LVDS1024x768Data_1;
- SiS_LVDS1024x768Data_2 = (SiS_LVDSDataStruct *) SiS310_LVDS1024x768Data_2;
- SiS_LVDS1280x1024Data_1 = (SiS_LVDSDataStruct *) SiS310_LVDS1280x1024Data_1;
- SiS_LVDS1280x1024Data_2 = (SiS_LVDSDataStruct *) SiS310_LVDS1280x1024Data_2;
- SiS_LVDS1280x960Data_1 = (SiS_LVDSDataStruct *) SiS310_LVDS1280x960Data_1;
- SiS_LVDS1280x960Data_2 = (SiS_LVDSDataStruct *) SiS310_LVDS1280x960Data_2;
- SiS_LVDS1400x1050Data_1 = (SiS_LVDSDataStruct *) SiS310_LVDS1400x1050Data_1;
- SiS_LVDS1400x1050Data_2 = (SiS_LVDSDataStruct *) SiS310_LVDS1400x1050Data_2;
- SiS_LVDS1024x600Data_1 = (SiS_LVDSDataStruct *) SiS310_LVDS1024x600Data_1;
- SiS_LVDS1024x600Data_2 = (SiS_LVDSDataStruct *) SiS310_LVDS1024x600Data_2;
- SiS_LVDS1152x768Data_1 = (SiS_LVDSDataStruct *) SiS310_LVDS1152x768Data_1;
- SiS_LVDS1152x768Data_2 = (SiS_LVDSDataStruct *) SiS310_LVDS1152x768Data_2;
- SiS_LVDSXXXxXXXData_1 = (SiS_LVDSDataStruct *) SiS310_LVDSXXXxXXXData_1;
- SiS_LVDS320x480Data_1 = (SiS_LVDSDataStruct *) SiS310_LVDS320x480Data_1;
- SiS_LVDS640x480Data_1 = (SiS_LVDSDataStruct *) SiS310_LVDS640x480Data_1;
- SiS_CHTVUNTSCData = (SiS_LVDSDataStruct *) SiS310_CHTVUNTSCData;
- SiS_CHTVONTSCData = (SiS_LVDSDataStruct *) SiS310_CHTVONTSCData;
- SiS_CHTVUPALData = (SiS_LVDSDataStruct *) SiS310_CHTVUPALData;
- SiS_CHTVOPALData = (SiS_LVDSDataStruct *) SiS310_CHTVOPALData;
- SiS_PanelType00_1 = (SiS_LVDSDesStruct *) SiS310_PanelType00_1;
- SiS_PanelType01_1 = (SiS_LVDSDesStruct *) SiS310_PanelType01_1;
- SiS_PanelType02_1 = (SiS_LVDSDesStruct *) SiS310_PanelType02_1;
- SiS_PanelType03_1 = (SiS_LVDSDesStruct *) SiS310_PanelType03_1;
- SiS_PanelType04_1 = (SiS_LVDSDesStruct *) SiS310_PanelType04_1;
- SiS_PanelType05_1 = (SiS_LVDSDesStruct *) SiS310_PanelType05_1;
- SiS_PanelType06_1 = (SiS_LVDSDesStruct *) SiS310_PanelType06_1;
- SiS_PanelType07_1 = (SiS_LVDSDesStruct *) SiS310_PanelType07_1;
- SiS_PanelType08_1 = (SiS_LVDSDesStruct *) SiS310_PanelType08_1;
- SiS_PanelType09_1 = (SiS_LVDSDesStruct *) SiS310_PanelType09_1;
- SiS_PanelType0a_1 = (SiS_LVDSDesStruct *) SiS310_PanelType0a_1;
- SiS_PanelType0b_1 = (SiS_LVDSDesStruct *) SiS310_PanelType0b_1;
- SiS_PanelType0c_1 = (SiS_LVDSDesStruct *) SiS310_PanelType0c_1;
- SiS_PanelType0d_1 = (SiS_LVDSDesStruct *) SiS310_PanelType0d_1;
- SiS_PanelType0e_1 = (SiS_LVDSDesStruct *) SiS310_PanelType0e_1;
- SiS_PanelType0f_1 = (SiS_LVDSDesStruct *) SiS310_PanelType0f_1;
- SiS_PanelType00_2 = (SiS_LVDSDesStruct *) SiS310_PanelType00_2;
- SiS_PanelType01_2 = (SiS_LVDSDesStruct *) SiS310_PanelType01_2;
- SiS_PanelType02_2 = (SiS_LVDSDesStruct *) SiS310_PanelType02_2;
- SiS_PanelType03_2 = (SiS_LVDSDesStruct *) SiS310_PanelType03_2;
- SiS_PanelType04_2 = (SiS_LVDSDesStruct *) SiS310_PanelType04_2;
- SiS_PanelType05_2 = (SiS_LVDSDesStruct *) SiS310_PanelType05_2;
- SiS_PanelType06_2 = (SiS_LVDSDesStruct *) SiS310_PanelType06_2;
- SiS_PanelType07_2 = (SiS_LVDSDesStruct *) SiS310_PanelType07_2;
- SiS_PanelType08_2 = (SiS_LVDSDesStruct *) SiS310_PanelType08_2;
- SiS_PanelType09_2 = (SiS_LVDSDesStruct *) SiS310_PanelType09_2;
- SiS_PanelType0a_2 = (SiS_LVDSDesStruct *) SiS310_PanelType0a_2;
- SiS_PanelType0b_2 = (SiS_LVDSDesStruct *) SiS310_PanelType0b_2;
- SiS_PanelType0c_2 = (SiS_LVDSDesStruct *) SiS310_PanelType0c_2;
- SiS_PanelType0d_2 = (SiS_LVDSDesStruct *) SiS310_PanelType0d_2;
- SiS_PanelType0e_2 = (SiS_LVDSDesStruct *) SiS310_PanelType0e_2;
- SiS_PanelType0f_2 = (SiS_LVDSDesStruct *) SiS310_PanelType0f_2;
-
- LVDS1024x768Des_1 = (SiS_LVDSDesStruct *) SiS310_PanelType1076_1;
- LVDS1280x1024Des_1= (SiS_LVDSDesStruct *) SiS310_PanelType1210_1;
- LVDS1280x960Des_1 = (SiS_LVDSDesStruct *) SiS310_PanelType1296_1 ;
- LVDS1024x768Des_2 = (SiS_LVDSDesStruct *) SiS310_PanelType1076_2;
- LVDS1280x1024Des_2= (SiS_LVDSDesStruct *) SiS310_PanelType1210_2;
- LVDS1280x960Des_2 = (SiS_LVDSDesStruct *) SiS310_PanelType1296_2;
+ SiS_Pr->SiS_MCLKData_1 = (SiS_MCLKDataStruct *)SiS310_MCLKData_1;
+ SiS_Pr->SiS_ECLKData = (SiS_ECLKDataStruct *)SiS310_ECLKData;
+ SiS_Pr->SiS_VCLKData = (SiS_VCLKDataStruct *)SiS310_VCLKData;
+ SiS_Pr->SiS_VBVCLKData = (SiS_VBVCLKDataStruct *)SiS310_VBVCLKData;
+ SiS_Pr->SiS_ScreenOffset = SiS310_ScreenOffset;
+ SiS_Pr->SiS_StResInfo = (SiS_StResInfoStruct *)SiS310_StResInfo;
+ SiS_Pr->SiS_ModeResInfo = (SiS_ModeResInfoStruct *)SiS310_ModeResInfo;
- /* TW: New from 650/301LV BIOS */
- SiS_CRT2Part2_1024x768_1 = (SiS_Part2PortTblStruct *) SiS310_CRT2Part2_1024x768_1;
- SiS_CRT2Part2_1280x1024_1 = (SiS_Part2PortTblStruct *) SiS310_CRT2Part2_1280x1024_1;
- SiS_CRT2Part2_1024x768_2 = (SiS_Part2PortTblStruct *) SiS310_CRT2Part2_1024x768_2;
- SiS_CRT2Part2_1280x1024_2 = (SiS_Part2PortTblStruct *) SiS310_CRT2Part2_1280x1024_2;
- SiS_CRT2Part2_1024x768_3 = (SiS_Part2PortTblStruct *) SiS310_CRT2Part2_1024x768_3;
- SiS_CRT2Part2_1280x1024_3 = (SiS_Part2PortTblStruct *) SiS310_CRT2Part2_1280x1024_3;
-
- SiS_CHTVUNTSCDesData = (SiS_LVDSDesStruct *) SiS310_CHTVUNTSCDesData;
- SiS_CHTVONTSCDesData = (SiS_LVDSDesStruct *) SiS310_CHTVONTSCDesData;
- SiS_CHTVUPALDesData = (SiS_LVDSDesStruct *) SiS310_CHTVUPALDesData;
- SiS_CHTVOPALDesData = (SiS_LVDSDesStruct *) SiS310_CHTVOPALDesData;
-
- SiS_LVDSCRT1800x600_1 = (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT1800x600_1;
- SiS_LVDSCRT11024x768_1 = (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT11024x768_1;
- SiS_LVDSCRT11280x1024_1 = (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT11280x1024_1;
- SiS_LVDSCRT11400x1050_1 = (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT11400x1050_1;
- SiS_LVDSCRT11024x600_1 = (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT11024x600_1;
- SiS_LVDSCRT11152x768_1 = (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT11152x768_1;
- SiS_LVDSCRT1800x600_1_H = (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT1800x600_1_H;
- SiS_LVDSCRT11024x768_1_H = (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT11024x768_1_H;
- SiS_LVDSCRT11280x1024_1_H = (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT11280x1024_1_H;
- SiS_LVDSCRT11400x1050_1_H = (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT11400x1050_1_H;
- SiS_LVDSCRT11024x600_1_H = (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT11024x600_1_H;
- SiS_LVDSCRT11152x768_1_H = (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT11152x768_1_H;
- SiS_LVDSCRT1800x600_2 = (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT1800x600_2;
- SiS_LVDSCRT11024x768_2 = (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT11024x768_2;
- SiS_LVDSCRT11280x1024_2 = (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT11280x1024_2;
- SiS_LVDSCRT11400x1050_2 = (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT11400x1050_2;
- SiS_LVDSCRT11024x600_2 = (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT11024x600_2;
- SiS_LVDSCRT11152x768_2 = (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT11152x768_2;
- SiS_LVDSCRT1800x600_2_H = (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT1800x600_2_H;
- SiS_LVDSCRT11024x768_2_H = (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT11024x768_2_H;
- SiS_LVDSCRT11280x1024_2_H = (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT11280x1024_2_H;
- SiS_LVDSCRT11400x1050_2_H = (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT11400x1050_2_H;
- SiS_LVDSCRT11024x600_2_H = (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT11024x600_2_H;
- SiS_LVDSCRT11152x768_2_H = (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT11152x768_2_H;
- SiS_LVDSCRT1XXXxXXX_1 = (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT1XXXxXXX_1;
- SiS_LVDSCRT1320x480_1 = (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT1320x480_1;
- SiS_CHTVCRT1UNTSC = (SiS_LVDSCRT1DataStruct *) SiS310_CHTVCRT1UNTSC;
- SiS_CHTVCRT1ONTSC = (SiS_LVDSCRT1DataStruct *) SiS310_CHTVCRT1ONTSC;
- SiS_CHTVCRT1UPAL = (SiS_LVDSCRT1DataStruct *) SiS310_CHTVCRT1UPAL;
- SiS_CHTVCRT1OPAL = (SiS_LVDSCRT1DataStruct *) SiS310_CHTVCRT1OPAL;
- SiS_CHTVReg_UNTSC = (SiS_CHTVRegDataStruct *) SiS310_CHTVReg_UNTSC;
- SiS_CHTVReg_ONTSC = (SiS_CHTVRegDataStruct *) SiS310_CHTVReg_ONTSC;
- SiS_CHTVReg_UPAL = (SiS_CHTVRegDataStruct *) SiS310_CHTVReg_UPAL;
- SiS_CHTVReg_OPAL = (SiS_CHTVRegDataStruct *) SiS310_CHTVReg_OPAL;
- SiS_LCDACRT1800x600_1 = (SiS_LCDACRT1DataStruct *) SiS310_LCDACRT1800x600_1;
- SiS_LCDACRT11024x768_1 = (SiS_LCDACRT1DataStruct *) SiS310_LCDACRT11024x768_1;
- SiS_LCDACRT11280x1024_1 = (SiS_LCDACRT1DataStruct *) SiS310_LCDACRT11280x1024_1;
- SiS_LCDACRT1800x600_1_H = (SiS_LCDACRT1DataStruct *) SiS310_LCDACRT1800x600_1_H;
- SiS_LCDACRT11024x768_1_H = (SiS_LCDACRT1DataStruct *) SiS310_LCDACRT11024x768_1_H;
- SiS_LCDACRT11280x1024_1_H = (SiS_LCDACRT1DataStruct *) SiS310_LCDACRT11280x1024_1_H;
- SiS_LCDACRT1800x600_2 = (SiS_LCDACRT1DataStruct *) SiS310_LCDACRT1800x600_2;
- SiS_LCDACRT11024x768_2 = (SiS_LCDACRT1DataStruct *) SiS310_LCDACRT11024x768_2;
- SiS_LCDACRT11280x1024_2 = (SiS_LCDACRT1DataStruct *) SiS310_LCDACRT11280x1024_2;
- SiS_LCDACRT1800x600_2_H = (SiS_LCDACRT1DataStruct *) SiS310_LCDACRT1800x600_2_H;
- SiS_LCDACRT11024x768_2_H = (SiS_LCDACRT1DataStruct *) SiS310_LCDACRT11024x768_2_H;
- SiS_LCDACRT11280x1024_2_H = (SiS_LCDACRT1DataStruct *) SiS310_LCDACRT11280x1024_2_H;
- SiS_CHTVVCLKUNTSC = SiS310_CHTVVCLKUNTSC;
- SiS_CHTVVCLKONTSC = SiS310_CHTVVCLKONTSC;
- SiS_CHTVVCLKUPAL = SiS310_CHTVVCLKUPAL;
- SiS_CHTVVCLKOPAL = SiS310_CHTVVCLKOPAL;
-
- Panel320x480 = Panel310_320x480;
- Panel640x480 = Panel310_640x480;
- Panel800x600 = Panel310_800x600;
- Panel1024x768 = Panel310_1024x768;
- Panel1280x1024 = Panel310_1280x1024;
- Panel1280x960 = Panel310_1280x960;
- Panel1600x1200 = Panel310_1600x1200;
- Panel1400x1050 = Panel310_1400x1050;
- Panel1152x768 = Panel310_1152x768;
- Panel1152x864 = Panel310_1152x864;
- Panel1280x768 = Panel310_1280x768;
- Panel1024x600 = Panel310_1024x600;
- PanelMax = Panel310_320x480; /* TW: highest value */
- PanelMinLVDS = Panel310_800x600; /* TW: lowest value LVDS */
- PanelMin301 = Panel310_1024x768; /* TW: lowest value 301 */
+ SiS_Pr->pSiS_OutputSelect = &SiS310_OutputSelect;
+ SiS_Pr->pSiS_SoftSetting = &SiS310_SoftSetting;
+
+ SiS_Pr->SiS_SR15 = SiS310_SR15;
+
+#ifndef LINUX_XF86
+ SiS_Pr->pSiS_SR07 = &SiS310_SR07;
+ SiS_Pr->SiS_CR40 = SiS310_CR40;
+ SiS_Pr->SiS_CR49 = SiS310_CR49;
+ SiS_Pr->pSiS_SR1F = &SiS310_SR1F;
+ SiS_Pr->pSiS_SR21 = &SiS310_SR21;
+ SiS_Pr->pSiS_SR22 = &SiS310_SR22;
+ SiS_Pr->pSiS_SR23 = &SiS310_SR23;
+ SiS_Pr->pSiS_SR24 = &SiS310_SR24;
+ SiS_Pr->SiS_SR25 = SiS310_SR25;
+ SiS_Pr->pSiS_SR31 = &SiS310_SR31;
+ SiS_Pr->pSiS_SR32 = &SiS310_SR32;
+ SiS_Pr->pSiS_SR33 = &SiS310_SR33;
+ SiS_Pr->pSiS_CRT2Data_1_2 = &SiS310_CRT2Data_1_2;
+ SiS_Pr->pSiS_CRT2Data_4_D = &SiS310_CRT2Data_4_D;
+ SiS_Pr->pSiS_CRT2Data_4_E = &SiS310_CRT2Data_4_E;
+ SiS_Pr->pSiS_CRT2Data_4_10 = &SiS310_CRT2Data_4_10;
+ SiS_Pr->pSiS_RGBSenseData = &SiS310_RGBSenseData;
+ SiS_Pr->pSiS_VideoSenseData = &SiS310_VideoSenseData;
+ SiS_Pr->pSiS_YCSenseData = &SiS310_YCSenseData;
+ SiS_Pr->pSiS_RGBSenseData2 = &SiS310_RGBSenseData2;
+ SiS_Pr->pSiS_VideoSenseData2 = &SiS310_VideoSenseData2;
+ SiS_Pr->pSiS_YCSenseData2 = &SiS310_YCSenseData2;
+#endif
+
+ SiS_Pr->SiS_NTSCPhase = SiS310_NTSCPhase;
+ SiS_Pr->SiS_PALPhase = SiS310_PALPhase;
+ SiS_Pr->SiS_NTSCPhase2 = SiS310_NTSCPhase2;
+ SiS_Pr->SiS_PALPhase2 = SiS310_PALPhase2;
+ SiS_Pr->SiS_PALMPhase = SiS310_PALMPhase;
+ SiS_Pr->SiS_PALNPhase = SiS310_PALNPhase;
+ SiS_Pr->SiS_PALMPhase2 = SiS310_PALMPhase2;
+ SiS_Pr->SiS_PALNPhase2 = SiS310_PALNPhase2;
+ SiS_Pr->SiS_SpecialPhase = SiS310_SpecialPhase;
+
+ SiS_Pr->SiS_StLCD1024x768Data = (SiS_LCDDataStruct *)SiS310_StLCD1024x768Data;
+ SiS_Pr->SiS_ExtLCD1024x768Data = (SiS_LCDDataStruct *)SiS310_ExtLCD1024x768Data;
+ SiS_Pr->SiS_St2LCD1024x768Data = (SiS_LCDDataStruct *)SiS310_St2LCD1024x768Data;
+ SiS_Pr->SiS_StLCD1280x1024Data = (SiS_LCDDataStruct *)SiS310_StLCD1280x1024Data;
+ SiS_Pr->SiS_ExtLCD1280x1024Data = (SiS_LCDDataStruct *)SiS310_ExtLCD1280x1024Data;
+ SiS_Pr->SiS_St2LCD1280x1024Data = (SiS_LCDDataStruct *)SiS310_St2LCD1280x1024Data;
+ SiS_Pr->SiS_NoScaleData1024x768 = (SiS_LCDDataStruct *)SiS310_NoScaleData1024x768;
+ SiS_Pr->SiS_NoScaleData1280x1024 = (SiS_LCDDataStruct *)SiS310_NoScaleData1280x1024;
+ SiS_Pr->SiS_LCD1280x960Data = (SiS_LCDDataStruct *)SiS310_LCD1280x960Data;
+ SiS_Pr->SiS_ExtLCD1400x1050Data = (SiS_LCDDataStruct *)SiS310_ExtLCD1400x1050Data;
+ SiS_Pr->SiS_ExtLCD1600x1200Data = (SiS_LCDDataStruct *)SiS310_ExtLCD1600x1200Data;
+ SiS_Pr->SiS_StLCD1400x1050Data = (SiS_LCDDataStruct *)SiS310_StLCD1400x1050Data;
+ SiS_Pr->SiS_StLCD1600x1200Data = (SiS_LCDDataStruct *)SiS310_StLCD1600x1200Data;
+ SiS_Pr->SiS_NoScaleData1400x1050 = (SiS_LCDDataStruct *)SiS310_NoScaleData1400x1050;
+ SiS_Pr->SiS_NoScaleData1600x1200 = (SiS_LCDDataStruct *)SiS310_NoScaleData1600x1200;
+
+ SiS_Pr->SiS_StPALData = (SiS_TVDataStruct *)SiS310_StPALData;
+ SiS_Pr->SiS_ExtPALData = (SiS_TVDataStruct *)SiS310_ExtPALData;
+ SiS_Pr->SiS_StNTSCData = (SiS_TVDataStruct *)SiS310_StNTSCData;
+ SiS_Pr->SiS_ExtNTSCData = (SiS_TVDataStruct *)SiS310_ExtNTSCData;
+/* SiS_Pr->SiS_St1HiTVData = (SiS_TVDataStruct *)SiS310_St1HiTVData; */
+ SiS_Pr->SiS_St2HiTVData = (SiS_TVDataStruct *)SiS310_St2HiTVData;
+ SiS_Pr->SiS_ExtHiTVData = (SiS_TVDataStruct *)SiS310_ExtHiTVData;
+
+ SiS_Pr->SiS_NTSCTiming = SiS310_NTSCTiming;
+ SiS_Pr->SiS_PALTiming = SiS310_PALTiming;
+ SiS_Pr->SiS_HiTVSt1Timing = SiS310_HiTVSt1Timing;
+ SiS_Pr->SiS_HiTVSt2Timing = SiS310_HiTVSt2Timing;
+ SiS_Pr->SiS_HiTVTextTiming = SiS310_HiTVTextTiming;
+ SiS_Pr->SiS_HiTVExtTiming = SiS310_HiTVExtTiming;
+ SiS_Pr->SiS_HiTVGroup3Data = SiS310_HiTVGroup3Data;
+ SiS_Pr->SiS_HiTVGroup3Simu = SiS310_HiTVGroup3Simu;
+ SiS_Pr->SiS_HiTVGroup3Text = SiS310_HiTVGroup3Text;
+
+ SiS_Pr->SiS_PanelDelayTbl = (SiS_PanelDelayTblStruct *)SiS310_PanelDelayTbl;
+ SiS_Pr->SiS_PanelDelayTblLVDS = (SiS_PanelDelayTblStruct *)SiS310_PanelDelayTblLVDS;
+
+ SiS_Pr->SiS_LVDS800x600Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS800x600Data_1;
+ SiS_Pr->SiS_LVDS800x600Data_2 = (SiS_LVDSDataStruct *)SiS310_LVDS800x600Data_2;
+ SiS_Pr->SiS_LVDS1024x768Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS1024x768Data_1;
+ SiS_Pr->SiS_LVDS1024x768Data_2 = (SiS_LVDSDataStruct *)SiS310_LVDS1024x768Data_2;
+ SiS_Pr->SiS_LVDS1280x1024Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS1280x1024Data_1;
+ SiS_Pr->SiS_LVDS1280x1024Data_2 = (SiS_LVDSDataStruct *)SiS310_LVDS1280x1024Data_2;
+ SiS_Pr->SiS_LVDS1280x960Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS1280x960Data_1;
+ SiS_Pr->SiS_LVDS1280x960Data_2 = (SiS_LVDSDataStruct *)SiS310_LVDS1280x960Data_2;
+ SiS_Pr->SiS_LVDS1400x1050Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS1400x1050Data_1;
+ SiS_Pr->SiS_LVDS1400x1050Data_2 = (SiS_LVDSDataStruct *)SiS310_LVDS1400x1050Data_2;
+ SiS_Pr->SiS_LVDS1280x768Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS1280x768Data_1;
+ SiS_Pr->SiS_LVDS1280x768Data_2 = (SiS_LVDSDataStruct *)SiS310_LVDS1280x768Data_2;
+ SiS_Pr->SiS_LVDS1024x600Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS1024x600Data_1;
+ SiS_Pr->SiS_LVDS1024x600Data_2 = (SiS_LVDSDataStruct *)SiS310_LVDS1024x600Data_2;
+ SiS_Pr->SiS_LVDS1152x768Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS1152x768Data_1;
+ SiS_Pr->SiS_LVDS1152x768Data_2 = (SiS_LVDSDataStruct *)SiS310_LVDS1152x768Data_2;
+ SiS_Pr->SiS_LVDSXXXxXXXData_1 = (SiS_LVDSDataStruct *)SiS310_LVDSXXXxXXXData_1;
+ SiS_Pr->SiS_LVDS320x480Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS320x480Data_1;
+ SiS_Pr->SiS_LVDS640x480Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS640x480Data_1;
+ SiS_Pr->SiS_LCDA1400x1050Data_1 = (SiS_LVDSDataStruct *)SiS310_LCDA1400x1050Data_1;
+ SiS_Pr->SiS_LCDA1400x1050Data_2 = (SiS_LVDSDataStruct *)SiS310_LCDA1400x1050Data_2;
+ SiS_Pr->SiS_LCDA1600x1200Data_1 = (SiS_LVDSDataStruct *)SiS310_LCDA1600x1200Data_1;
+ SiS_Pr->SiS_LCDA1600x1200Data_2 = (SiS_LVDSDataStruct *)SiS310_LCDA1600x1200Data_2;
+ SiS_Pr->SiS_CHTVUNTSCData = (SiS_LVDSDataStruct *)SiS310_CHTVUNTSCData;
+ SiS_Pr->SiS_CHTVONTSCData = (SiS_LVDSDataStruct *)SiS310_CHTVONTSCData;
+ SiS_Pr->SiS_CHTVUPALData = (SiS_LVDSDataStruct *)SiS310_CHTVUPALData;
+ SiS_Pr->SiS_CHTVOPALData = (SiS_LVDSDataStruct *)SiS310_CHTVOPALData;
+ SiS_Pr->SiS_CHTVUPALMData = (SiS_LVDSDataStruct *)SiS310_CHTVUPALMData;
+ SiS_Pr->SiS_CHTVOPALMData = (SiS_LVDSDataStruct *)SiS310_CHTVOPALMData;
+ SiS_Pr->SiS_CHTVUPALNData = (SiS_LVDSDataStruct *)SiS310_CHTVUPALNData;
+ SiS_Pr->SiS_CHTVOPALNData = (SiS_LVDSDataStruct *)SiS310_CHTVOPALNData;
+ SiS_Pr->SiS_CHTVSOPALData = (SiS_LVDSDataStruct *)SiS310_CHTVSOPALData;
+ SiS_Pr->SiS_PanelType00_1 = (SiS_LVDSDesStruct *)SiS310_PanelType00_1;
+ SiS_Pr->SiS_PanelType01_1 = (SiS_LVDSDesStruct *)SiS310_PanelType01_1;
+ SiS_Pr->SiS_PanelType02_1 = (SiS_LVDSDesStruct *)SiS310_PanelType02_1;
+ SiS_Pr->SiS_PanelType03_1 = (SiS_LVDSDesStruct *)SiS310_PanelType03_1;
+ SiS_Pr->SiS_PanelType04_1 = (SiS_LVDSDesStruct *)SiS310_PanelType04_1;
+ SiS_Pr->SiS_PanelType05_1 = (SiS_LVDSDesStruct *)SiS310_PanelType05_1;
+ SiS_Pr->SiS_PanelType06_1 = (SiS_LVDSDesStruct *)SiS310_PanelType06_1;
+ SiS_Pr->SiS_PanelType07_1 = (SiS_LVDSDesStruct *)SiS310_PanelType07_1;
+ SiS_Pr->SiS_PanelType08_1 = (SiS_LVDSDesStruct *)SiS310_PanelType08_1;
+ SiS_Pr->SiS_PanelType09_1 = (SiS_LVDSDesStruct *)SiS310_PanelType09_1;
+ SiS_Pr->SiS_PanelType0a_1 = (SiS_LVDSDesStruct *)SiS310_PanelType0a_1;
+ SiS_Pr->SiS_PanelType0b_1 = (SiS_LVDSDesStruct *)SiS310_PanelType0b_1;
+ SiS_Pr->SiS_PanelType0c_1 = (SiS_LVDSDesStruct *)SiS310_PanelType0c_1;
+ SiS_Pr->SiS_PanelType0d_1 = (SiS_LVDSDesStruct *)SiS310_PanelType0d_1;
+ SiS_Pr->SiS_PanelType0e_1 = (SiS_LVDSDesStruct *)SiS310_PanelType0e_1;
+ SiS_Pr->SiS_PanelType0f_1 = (SiS_LVDSDesStruct *)SiS310_PanelType0f_1;
+ SiS_Pr->SiS_PanelType00_2 = (SiS_LVDSDesStruct *)SiS310_PanelType00_2;
+ SiS_Pr->SiS_PanelType01_2 = (SiS_LVDSDesStruct *)SiS310_PanelType01_2;
+ SiS_Pr->SiS_PanelType02_2 = (SiS_LVDSDesStruct *)SiS310_PanelType02_2;
+ SiS_Pr->SiS_PanelType03_2 = (SiS_LVDSDesStruct *)SiS310_PanelType03_2;
+ SiS_Pr->SiS_PanelType04_2 = (SiS_LVDSDesStruct *)SiS310_PanelType04_2;
+ SiS_Pr->SiS_PanelType05_2 = (SiS_LVDSDesStruct *)SiS310_PanelType05_2;
+ SiS_Pr->SiS_PanelType06_2 = (SiS_LVDSDesStruct *)SiS310_PanelType06_2;
+ SiS_Pr->SiS_PanelType07_2 = (SiS_LVDSDesStruct *)SiS310_PanelType07_2;
+ SiS_Pr->SiS_PanelType08_2 = (SiS_LVDSDesStruct *)SiS310_PanelType08_2;
+ SiS_Pr->SiS_PanelType09_2 = (SiS_LVDSDesStruct *)SiS310_PanelType09_2;
+ SiS_Pr->SiS_PanelType0a_2 = (SiS_LVDSDesStruct *)SiS310_PanelType0a_2;
+ SiS_Pr->SiS_PanelType0b_2 = (SiS_LVDSDesStruct *)SiS310_PanelType0b_2;
+ SiS_Pr->SiS_PanelType0c_2 = (SiS_LVDSDesStruct *)SiS310_PanelType0c_2;
+ SiS_Pr->SiS_PanelType0d_2 = (SiS_LVDSDesStruct *)SiS310_PanelType0d_2;
+ SiS_Pr->SiS_PanelType0e_2 = (SiS_LVDSDesStruct *)SiS310_PanelType0e_2;
+ SiS_Pr->SiS_PanelType0f_2 = (SiS_LVDSDesStruct *)SiS310_PanelType0f_2;
+
+ SiS_Pr->LVDS1024x768Des_1 = (SiS_LVDSDesStruct *)SiS310_PanelType1076_1;
+ SiS_Pr->LVDS1280x1024Des_1 = (SiS_LVDSDesStruct *)SiS310_PanelType1210_1;
+ SiS_Pr->LVDS1400x1050Des_1 = (SiS_LVDSDesStruct *)SiS310_PanelType1296_1 ;
+ SiS_Pr->LVDS1600x1200Des_1 = (SiS_LVDSDesStruct *)SiS310_PanelType1600_1 ;
+ SiS_Pr->LVDS1024x768Des_2 = (SiS_LVDSDesStruct *)SiS310_PanelType1076_2;
+ SiS_Pr->LVDS1280x1024Des_2 = (SiS_LVDSDesStruct *)SiS310_PanelType1210_2;
+ SiS_Pr->LVDS1400x1050Des_2 = (SiS_LVDSDesStruct *)SiS310_PanelType1296_2;
+ SiS_Pr->LVDS1600x1200Des_2 = (SiS_LVDSDesStruct *)SiS310_PanelType1600_2 ;
+ /* TW: New from 650/301LV BIOS */
+ SiS_Pr->SiS_CRT2Part2_1024x768_1 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1024x768_1;
+ SiS_Pr->SiS_CRT2Part2_1280x1024_1 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1280x1024_1;
+ SiS_Pr->SiS_CRT2Part2_1400x1050_1 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1400x1050_1;
+ SiS_Pr->SiS_CRT2Part2_1600x1200_1 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1600x1200_1;
+ SiS_Pr->SiS_CRT2Part2_1024x768_2 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1024x768_2;
+ SiS_Pr->SiS_CRT2Part2_1280x1024_2 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1280x1024_2;
+ SiS_Pr->SiS_CRT2Part2_1400x1050_2 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1400x1050_2;
+ SiS_Pr->SiS_CRT2Part2_1600x1200_2 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1600x1200_2;
+ SiS_Pr->SiS_CRT2Part2_1024x768_3 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1024x768_3;
+ SiS_Pr->SiS_CRT2Part2_1280x1024_3 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1280x1024_3;
+ SiS_Pr->SiS_CRT2Part2_1400x1050_3 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1400x1050_3;
+ SiS_Pr->SiS_CRT2Part2_1600x1200_3 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1600x1200_3;
+
+ SiS_Pr->SiS_CHTVUNTSCDesData = (SiS_LVDSDesStruct *)SiS310_CHTVUNTSCDesData;
+ SiS_Pr->SiS_CHTVONTSCDesData = (SiS_LVDSDesStruct *)SiS310_CHTVONTSCDesData;
+ SiS_Pr->SiS_CHTVUPALDesData = (SiS_LVDSDesStruct *)SiS310_CHTVUPALDesData;
+ SiS_Pr->SiS_CHTVOPALDesData = (SiS_LVDSDesStruct *)SiS310_CHTVOPALDesData;
+
+ SiS_Pr->SiS_LVDSCRT1800x600_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT1800x600_1;
+ SiS_Pr->SiS_LVDSCRT11024x768_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11024x768_1;
+ SiS_Pr->SiS_LVDSCRT11280x1024_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11280x1024_1;
+ SiS_Pr->SiS_LVDSCRT11400x1050_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11400x1050_1;
+ SiS_Pr->SiS_LVDSCRT11280x768_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11280x768_1;
+ SiS_Pr->SiS_LVDSCRT11024x600_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11024x600_1;
+ SiS_Pr->SiS_LVDSCRT11152x768_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11152x768_1;
+ SiS_Pr->SiS_LVDSCRT11600x1200_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11600x1200_1;
+ SiS_Pr->SiS_LVDSCRT1800x600_1_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT1800x600_1_H;
+ SiS_Pr->SiS_LVDSCRT11024x768_1_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11024x768_1_H;
+ SiS_Pr->SiS_LVDSCRT11280x1024_1_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11280x1024_1_H;
+ SiS_Pr->SiS_LVDSCRT11400x1050_1_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11400x1050_1_H;
+ SiS_Pr->SiS_LVDSCRT11280x768_1_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11280x768_1_H;
+ SiS_Pr->SiS_LVDSCRT11024x600_1_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11024x600_1_H;
+ SiS_Pr->SiS_LVDSCRT11152x768_1_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11152x768_1_H;
+ SiS_Pr->SiS_LVDSCRT11600x1200_1_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11600x1200_1_H;
+ SiS_Pr->SiS_LVDSCRT1800x600_2 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT1800x600_2;
+ SiS_Pr->SiS_LVDSCRT11024x768_2 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11024x768_2;
+ SiS_Pr->SiS_LVDSCRT11280x1024_2 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11280x1024_2;
+ SiS_Pr->SiS_LVDSCRT11400x1050_2 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11400x1050_2;
+ SiS_Pr->SiS_LVDSCRT11280x768_2 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11280x768_2;
+ SiS_Pr->SiS_LVDSCRT11024x600_2 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11024x600_2;
+ SiS_Pr->SiS_LVDSCRT11152x768_2 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11152x768_2;
+ SiS_Pr->SiS_LVDSCRT11600x1200_2 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11600x1200_2;
+ SiS_Pr->SiS_LVDSCRT1800x600_2_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT1800x600_2_H;
+ SiS_Pr->SiS_LVDSCRT11024x768_2_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11024x768_2_H;
+ SiS_Pr->SiS_LVDSCRT11280x1024_2_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11280x1024_2_H;
+ SiS_Pr->SiS_LVDSCRT11400x1050_2_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11400x1050_2_H;
+ SiS_Pr->SiS_LVDSCRT11280x768_2_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11280x768_2_H;
+ SiS_Pr->SiS_LVDSCRT11024x600_2_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11024x600_2_H;
+ SiS_Pr->SiS_LVDSCRT11152x768_2_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11152x768_2_H;
+ SiS_Pr->SiS_LVDSCRT11600x1200_2_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11600x1200_2_H;
+ SiS_Pr->SiS_LVDSCRT1XXXxXXX_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT1XXXxXXX_1;
+ SiS_Pr->SiS_LVDSCRT1320x480_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT1320x480_1;
+ SiS_Pr->SiS_CHTVCRT1UNTSC = (SiS_LVDSCRT1DataStruct *)SiS310_CHTVCRT1UNTSC;
+ SiS_Pr->SiS_CHTVCRT1ONTSC = (SiS_LVDSCRT1DataStruct *)SiS310_CHTVCRT1ONTSC;
+ SiS_Pr->SiS_CHTVCRT1UPAL = (SiS_LVDSCRT1DataStruct *)SiS310_CHTVCRT1UPAL;
+ SiS_Pr->SiS_CHTVCRT1OPAL = (SiS_LVDSCRT1DataStruct *)SiS310_CHTVCRT1OPAL;
+ SiS_Pr->SiS_CHTVCRT1SOPAL = (SiS_LVDSCRT1DataStruct *)SiS310_CHTVCRT1SOPAL;
+ SiS_Pr->SiS_CHTVReg_UNTSC = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_UNTSC;
+ SiS_Pr->SiS_CHTVReg_ONTSC = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_ONTSC;
+ SiS_Pr->SiS_CHTVReg_UPAL = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_UPAL;
+ SiS_Pr->SiS_CHTVReg_OPAL = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_OPAL;
+ SiS_Pr->SiS_CHTVReg_UPALM = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_UPALM;
+ SiS_Pr->SiS_CHTVReg_OPALM = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_OPALM;
+ SiS_Pr->SiS_CHTVReg_UPALN = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_UPALN;
+ SiS_Pr->SiS_CHTVReg_OPALN = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_OPALN;
+ SiS_Pr->SiS_CHTVReg_SOPAL = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_SOPAL;
+ SiS_Pr->SiS_LCDACRT1800x600_1 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT1800x600_1;
+ SiS_Pr->SiS_LCDACRT11024x768_1 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11024x768_1;
+ SiS_Pr->SiS_LCDACRT11280x1024_1 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11280x1024_1;
+ SiS_Pr->SiS_LCDACRT11400x1050_1 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11400x1050_1;
+ SiS_Pr->SiS_LCDACRT11600x1200_1 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11600x1200_1;
+ SiS_Pr->SiS_LCDACRT1800x600_1_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT1800x600_1_H;
+ SiS_Pr->SiS_LCDACRT11024x768_1_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11024x768_1_H;
+ SiS_Pr->SiS_LCDACRT11280x1024_1_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11280x1024_1_H;
+ SiS_Pr->SiS_LCDACRT11400x1050_1_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11400x1050_1_H;
+ SiS_Pr->SiS_LCDACRT11600x1200_1_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11600x1200_1_H;
+ SiS_Pr->SiS_LCDACRT1800x600_2 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT1800x600_2;
+ SiS_Pr->SiS_LCDACRT11024x768_2 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11024x768_2;
+ SiS_Pr->SiS_LCDACRT11280x1024_2 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11280x1024_2;
+ SiS_Pr->SiS_LCDACRT11400x1050_2 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11400x1050_2;
+ SiS_Pr->SiS_LCDACRT11600x1200_2 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11600x1200_2;
+ SiS_Pr->SiS_LCDACRT1800x600_2_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT1800x600_2_H;
+ SiS_Pr->SiS_LCDACRT11024x768_2_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11024x768_2_H;
+ SiS_Pr->SiS_LCDACRT11280x1024_2_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11280x1024_2_H;
+ SiS_Pr->SiS_LCDACRT11400x1050_2_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11400x1050_2_H;
+ SiS_Pr->SiS_LCDACRT11600x1200_2_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11600x1200_2_H;
+ SiS_Pr->SiS_CHTVVCLKUNTSC = SiS310_CHTVVCLKUNTSC;
+ SiS_Pr->SiS_CHTVVCLKONTSC = SiS310_CHTVVCLKONTSC;
+ SiS_Pr->SiS_CHTVVCLKUPAL = SiS310_CHTVVCLKUPAL;
+ SiS_Pr->SiS_CHTVVCLKOPAL = SiS310_CHTVVCLKOPAL;
+ SiS_Pr->SiS_CHTVVCLKUPALM = SiS310_CHTVVCLKUPALM;
+ SiS_Pr->SiS_CHTVVCLKOPALM = SiS310_CHTVVCLKOPALM;
+ SiS_Pr->SiS_CHTVVCLKUPALN = SiS310_CHTVVCLKUPALN;
+ SiS_Pr->SiS_CHTVVCLKOPALN = SiS310_CHTVVCLKOPALN;
+ SiS_Pr->SiS_CHTVVCLKSOPAL = SiS310_CHTVVCLKSOPAL;
+
+ SiS_Pr->SiS_Panel320x480 = Panel_320x480;
+ SiS_Pr->SiS_Panel640x480 = Panel_640x480;
+ SiS_Pr->SiS_Panel800x600 = Panel_800x600;
+ SiS_Pr->SiS_Panel1024x768 = Panel_1024x768;
+ SiS_Pr->SiS_Panel1280x1024 = Panel_1280x1024;
+ SiS_Pr->SiS_Panel1280x960 = Panel_1280x960;
+ SiS_Pr->SiS_Panel1600x1200 = Panel_1600x1200;
+ SiS_Pr->SiS_Panel1400x1050 = Panel_1400x1050;
+ SiS_Pr->SiS_Panel1152x768 = Panel_1152x768;
+ SiS_Pr->SiS_Panel1152x864 = Panel_1152x864;
+ SiS_Pr->SiS_Panel1280x768 = Panel_1280x768;
+ SiS_Pr->SiS_Panel1024x600 = Panel_1024x600;
+ SiS_Pr->SiS_PanelMax = Panel_320x480; /* TW: highest value */
+ SiS_Pr->SiS_PanelMinLVDS = Panel_800x600; /* TW: lowest value LVDS/LCDA */
+ SiS_Pr->SiS_PanelMin301 = Panel_1024x768; /* TW: lowest value 301 */
}
#endif
-#ifndef LINUX_XF86
+#ifdef LINUXBIOS
/* -------------- SiSInit -----------------*/
+/* TW: I degraded this for LINUXBIOS only, because we
+ * don't need this otherwise. Under normal
+ * circumstances, the video BIOS has initialized
+ * the adapter for us. BTW, this code is incomplete
+ * and very possibly not functioning on newer chipsets.
+ */
BOOLEAN
-SiSInit(PSIS_HW_DEVICE_INFO HwDeviceExtension)
+SiSInit(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
UCHAR *ROMAddr = HwDeviceExtension->pjVirtualRomBase;
ULONG FBAddr = (ULONG)HwDeviceExtension->pjVideoMemoryAddress;
USHORT BaseAddr = (USHORT)HwDeviceExtension->ulIOAddress;
- UCHAR i,temp=0;
+ UCHAR i, temp=0;
UCHAR SR11;
#ifdef LINUX_KERNEL
UCHAR temp1;
ULONG base;
#endif
- UCHAR SR13=0,SR14=0,SR16=0,SR17=0,SR19=0,SR1A=0;
+ UCHAR SR13=0, SR14=0, SR16=0
+ UCHAR SR17=0, SR19=0, SR1A=0;
#ifdef SIS300
- UCHAR SR18=0,SR12=0;
+ UCHAR SR18=0, SR12=0;
#endif
#ifdef SIS315H
- UCHAR CR37=0,CR38=0,CR79=0,CR7A=0,CR7B=0,CR7C=0;
- UCHAR SR1B=0,SR15=0;
- PSIS_DSReg pSR;
+ UCHAR CR37=0, CR38=0, CR79=0,
+ UCHAR CR7A=0, CR7B=0, CR7C=0;
+ UCHAR SR1B=0, SR15=0;
+ PSIS_DSReg pSR;
ULONG Temp;
#endif
UCHAR VBIOSVersion[5];
@@ -578,61 +725,64 @@ SiSInit(PSIS_HW_DEVICE_INFO HwDeviceExtension)
if(FBAddr==0) return (FALSE);
if(BaseAddr==0) return (FALSE);
- SiS_SetReg3((USHORT)(BaseAddr+0x12), 0x67); /* 3c2 <- 67 ,ynlai */
+ SiS_SetReg3((USHORT)(BaseAddr+0x12), 0x67); /* Misc */
#ifdef SIS315H
- /*if(HwDeviceExtension->jChipType > SIS_315H)*/
if(HwDeviceExtension->jChipType > SIS_315PRO) {
if(!HwDeviceExtension->bIntegratedMMEnabled)
- return (FALSE); /* alan */
+ return (FALSE);
}
#endif
SiS_MemoryCopy(VBIOSVersion,HwDeviceExtension->szVBIOSVer,4);
- VBIOSVersion[4]= 0x0;
- /* 09/07/99 modify by domao */
+ VBIOSVersion[4]= 0x00;
+ SiSDetermineROMUsage(SiS_Pr, HwDeviceExtension, ROMAddr);
+
+ /* TW: Init pointers */
#ifdef SIS315H
- if((HwDeviceExtension->jChipType == SIS_315H)||
- (HwDeviceExtension->jChipType == SIS_315PRO)||
- (HwDeviceExtension->jChipType == SIS_550)||
- (HwDeviceExtension->jChipType == SIS_640)||
- (HwDeviceExtension->jChipType == SIS_740)||
- (HwDeviceExtension->jChipType == SIS_650))
- InitTo310Pointer(HwDeviceExtension);
+ if((HwDeviceExtension->jChipType == SIS_315H) ||
+ (HwDeviceExtension->jChipType == SIS_315) ||
+ (HwDeviceExtension->jChipType == SIS_315PRO) ||
+ (HwDeviceExtension->jChipType == SIS_550) ||
+ (HwDeviceExtension->jChipType == SIS_650) ||
+ (HwDeviceExtension->jChipType == SIS_740) ||
+ (HwDeviceExtension->jChipType == SIS_330))
+ InitTo310Pointer(SiS_Pr, HwDeviceExtension);
#endif
#ifdef SIS300
- if ((HwDeviceExtension->jChipType == SIS_540)||
- (HwDeviceExtension->jChipType == SIS_630)||
- (HwDeviceExtension->jChipType == SIS_730)||
- (HwDeviceExtension->jChipType == SIS_300))
- InitTo300Pointer(HwDeviceExtension);
+ if((HwDeviceExtension->jChipType == SIS_540) ||
+ (HwDeviceExtension->jChipType == SIS_630) ||
+ (HwDeviceExtension->jChipType == SIS_730) ||
+ (HwDeviceExtension->jChipType == SIS_300))
+ InitTo300Pointer(SiS_Pr, HwDeviceExtension);
#endif
- /* TW: Set SiS Register globals */
- SiSRegInit(BaseAddr);
+ /* TW: Set SiS Register definitions */
+ SiSRegInit(SiS_Pr, BaseAddr);
/* TW: Determine LVDS/CH70xx/TRUMPION */
- SiS_Set_LVDS_TRUMPION(HwDeviceExtension);
+ SiS_Set_LVDS_TRUMPION(SiS_Pr, HwDeviceExtension);
- SiS_SetReg1(SiS_P3c4,0x05,0x86); /* 1.Openkey - unlock registers */
+ /* TW: Unlock registers */
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x05,0x86);
#ifdef LINUX_KERNEL
-#ifdef SIS300 /* Set SR14*/
- if((HwDeviceExtension->jChipType==SIS_540)||
- (HwDeviceExtension->jChipType==SIS_630)||
+#ifdef SIS300 /* Set SR14 */
+ if((HwDeviceExtension->jChipType==SIS_540) ||
+ (HwDeviceExtension->jChipType==SIS_630) ||
(HwDeviceExtension->jChipType==SIS_730)) {
base=0x80000060;
OutPortLong(base,0xcf8);
- temp1=InPortLong(0xcfc);
+ temp1 = InPortLong(0xcfc);
temp1 >>= (16+8+4);
temp1 &= 0x07;
temp1++;
temp1 = 1 << temp1;
SR14 = temp1 - 1;
- base=0x80000064;
+ base = 0x80000064;
OutPortLong(base,0xcf8);
temp1 = InPortLong(0xcfc);
temp1 &= 0x00000020;
@@ -641,9 +791,9 @@ SiSInit(PSIS_HW_DEVICE_INFO HwDeviceExtension)
}
#endif
-#ifdef SIS315H /* Set SR14*/
- if(HwDeviceExtension->jChipType==SIS_550) {
- base=0x80000060;
+#ifdef SIS315H /* Set SR14 */
+ if(HwDeviceExtension->jChipType == SIS_550) {
+ base = 0x80000060;
OutPortLong(base,0xcf8);
temp1 = InPortLong(0xcfc);
temp1 >>= (16+8+4);
@@ -651,7 +801,7 @@ SiSInit(PSIS_HW_DEVICE_INFO HwDeviceExtension)
temp1++;
temp1 = 1 << temp1;
SR14 = temp1 - 1;
- base=0x80000064;
+ base = 0x80000064;
OutPortLong(base,0xcf8);
temp1 = InPortLong(0xcfc);
temp1 &= 0x00000020;
@@ -659,10 +809,9 @@ SiSInit(PSIS_HW_DEVICE_INFO HwDeviceExtension)
else SR14 |= 0x40;
}
- if((HwDeviceExtension->jChipType == SIS_640)||
- (HwDeviceExtension->jChipType == SIS_740)||
- (HwDeviceExtension->jChipType == SIS_650)) {
- base=0x80000064;
+ if((HwDeviceExtension->jChipType == SIS_740) || /* Set SR14 */
+ (HwDeviceExtension->jChipType == SIS_650)) {
+ base = 0x80000064;
OutPortLong(base,0xcf8);
temp1=InPortLong(0xcfc);
temp1 >>= 4;
@@ -670,17 +819,17 @@ SiSInit(PSIS_HW_DEVICE_INFO HwDeviceExtension)
if(temp1 > 2) {
temp = temp1;
switch(temp) {
- case 3: temp1=0x07; break;
- case 4: temp1=0x0F; break;
- case 5: temp1=0x1F; break;
- case 6: temp1=0x05; break;
- case 7: temp1=0x17; break;
+ case 3: temp1 = 0x07; break;
+ case 4: temp1 = 0x0F; break;
+ case 5: temp1 = 0x1F; break;
+ case 6: temp1 = 0x05; break;
+ case 7: temp1 = 0x17; break;
case 8: break;
case 9: break;
}
}
SR14 = temp1;
- base=0x8000007C;
+ base = 0x8000007C;
OutPortLong(base,0xcf8);
temp1 = InPortLong(0xcfc);
temp1 &= 0x00000020;
@@ -694,25 +843,24 @@ SiSInit(PSIS_HW_DEVICE_INFO HwDeviceExtension)
if((HwDeviceExtension->jChipType == SIS_540)||
(HwDeviceExtension->jChipType == SIS_630)||
(HwDeviceExtension->jChipType == SIS_730)) {
- SR12 = (UCHAR)SiS_GetReg1(SiS_P3c4,0x12);
- SR13 = (UCHAR)SiS_GetReg1(SiS_P3c4,0x13);
- SR14 = (UCHAR)SiS_GetReg1(SiS_P3c4,0x14);
- SR16 = (UCHAR)SiS_GetReg1(SiS_P3c4,0x16);
- SR17 = (UCHAR)SiS_GetReg1(SiS_P3c4,0x17);
- SR18 = (UCHAR)SiS_GetReg1(SiS_P3c4,0x18);
- SR19 = (UCHAR)SiS_GetReg1(SiS_P3c4,0x19);
- SR1A = (UCHAR)SiS_GetReg1(SiS_P3c4,0x1A);
+ SR12 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x12);
+ SR13 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13);
+ SR14 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14);
+ SR16 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16);
+ SR17 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x17);
+ SR18 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x18);
+ SR19 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x19);
+ SR1A = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1A);
} else if(HwDeviceExtension->jChipType == SIS_300){
- SR13 = (UCHAR)SiS_GetReg1(SiS_P3c4,0x13);
- SR14 = (UCHAR)SiS_GetReg1(SiS_P3c4,0x14);
+ SR13 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13);
+ SR14 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14);
}
#endif
#ifdef SIS315H
- if((HwDeviceExtension->jChipType == SIS_550)||
- (HwDeviceExtension->jChipType == SIS_640)||
- (HwDeviceExtension->jChipType == SIS_740)||
+ if((HwDeviceExtension->jChipType == SIS_550) ||
+ (HwDeviceExtension->jChipType == SIS_740) ||
(HwDeviceExtension->jChipType == SIS_650)) {
- SR19 = (UCHAR)SiS_GetReg1(SiS_P3c4,0x19);
+ SR19 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x19);
SR19 = (SR19)||0x01; /* TW: ??? || ??? */
if(SR19==0x00) {
SR13 = 0x22;
@@ -729,422 +877,419 @@ SiSInit(PSIS_HW_DEVICE_INFO HwDeviceExtension)
CR7B = 0x00;
CR7C = 0x00;
} else {
- SR13 = (UCHAR)SiS_GetReg1(SiS_P3c4,0x13);
- SR14 = (UCHAR)SiS_GetReg1(SiS_P3c4,0x14);
- SR15 = (UCHAR)SiS_GetReg1(SiS_P3c4,0x15);
- SR16 = (UCHAR)SiS_GetReg1(SiS_P3c4,0x16);
- SR17 = (UCHAR)SiS_GetReg1(SiS_P3c4,0x17);
- SR1A = (UCHAR)SiS_GetReg1(SiS_P3c4,0x1A);
- SR1B = (UCHAR)SiS_GetReg1(SiS_P3c4,0x1B);
- CR37 = (UCHAR)SiS_GetReg1(SiS_P3d4,0x37); /* TW: Was 0x02 - why? */
- CR38 = (UCHAR)SiS_GetReg1(SiS_P3d4,0x38);
- CR79 = (UCHAR)SiS_GetReg1(SiS_P3d4,0x79);
- CR7A = (UCHAR)SiS_GetReg1(SiS_P3d4,0x7A);
- CR7B = (UCHAR)SiS_GetReg1(SiS_P3d4,0x7B);
- CR7C = (UCHAR)SiS_GetReg1(SiS_P3d4,0x7C);
+ SR13 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13);
+ SR14 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14);
+ SR15 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x15);
+ SR16 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16);
+ SR17 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x17);
+ SR1A = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1A);
+ SR1B = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1B);
+ CR37 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3d4,0x37); /* TW: Was 0x02 - why? */
+ CR38 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38);
+ CR79 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3d4,0x79);
+ CR7A = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3d4,0x7A);
+ CR7B = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3d4,0x7B);
+ CR7C = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3d4,0x7C);
}
}
#endif
-/* ResetExtReg begin: Reset extended registers */
+ /* Reset extended registers */
- for(i=0x06;i< 0x20;i++) SiS_SetReg1(SiS_P3c4,i,0); /* 2.Reset Extended registers */
- for(i=0x21;i<=0x27;i++) SiS_SetReg1(SiS_P3c4,i,0);
- for(i=0x31;i<=0x3D;i++) SiS_SetReg1(SiS_P3c4,i,0);
+ for(i=0x06; i< 0x20; i++) SiS_SetReg1(SiS_Pr->SiS_P3c4,i,0);
+ for(i=0x21; i<=0x27; i++) SiS_SetReg1(SiS_Pr->SiS_P3c4,i,0);
+ for(i=0x31; i<=0x3D; i++) SiS_SetReg1(SiS_Pr->SiS_P3c4,i,0);
#ifdef SIS300
- if((HwDeviceExtension->jChipType == SIS_540)||
- (HwDeviceExtension->jChipType == SIS_630)||
- (HwDeviceExtension->jChipType == SIS_730)||
+ if((HwDeviceExtension->jChipType == SIS_540) ||
+ (HwDeviceExtension->jChipType == SIS_630) ||
+ (HwDeviceExtension->jChipType == SIS_730) ||
(HwDeviceExtension->jChipType == SIS_300)) {
- for(i=0x38;i<=0x3F;i++) SiS_SetReg1(SiS_P3d4,i,0);
+ for(i=0x38; i<=0x3F; i++) SiS_SetReg1(SiS_Pr->SiS_P3d4,i,0);
}
#endif
#ifdef SIS315H
- if((HwDeviceExtension->jChipType == SIS_315H)||
- (HwDeviceExtension->jChipType == SIS_315PRO)||
- (HwDeviceExtension->jChipType == SIS_550)||
- (HwDeviceExtension->jChipType == SIS_640)||
- (HwDeviceExtension->jChipType == SIS_740)||
- (HwDeviceExtension->jChipType == SIS_650)) {
- for(i=0x12;i<=0x1B;i++) SiS_SetReg1(SiS_P3c4,i,0);
- for(i=0x79;i<=0x7C;i++) SiS_SetReg1(SiS_P3d4,i,0);
+ if((HwDeviceExtension->jChipType == SIS_315H) ||
+ (HwDeviceExtension->jChipType == SIS_315) ||
+ (HwDeviceExtension->jChipType == SIS_315PRO) ||
+ (HwDeviceExtension->jChipType == SIS_550) ||
+ (HwDeviceExtension->jChipType == SIS_650) ||
+ (HwDeviceExtension->jChipType == SIS_740) ||
+ (HwDeviceExtension->jChipType == SIS_330)) {
+ for(i=0x12; i<=0x1B; i++) SiS_SetReg1(SiS_Pr->SiS_P3c4,i,0);
+ for(i=0x79; i<=0x7C; i++) SiS_SetReg1(SiS_Pr->SiS_P3d4,i,0);
}
#endif
-/* ResetExtReg end */
+ /* Restore Extended Registers */
#ifdef SIS300
- if((HwDeviceExtension->jChipType == SIS_540)||
- (HwDeviceExtension->jChipType == SIS_630)||
+ if((HwDeviceExtension->jChipType == SIS_540) ||
+ (HwDeviceExtension->jChipType == SIS_630) ||
(HwDeviceExtension->jChipType == SIS_730)) {
- SiS_SetReg1(SiS_P3c4,0x12,SR12);
- SiS_SetReg1(SiS_P3c4,0x13,SR13);
- SiS_SetReg1(SiS_P3c4,0x14,SR14);
- SiS_SetReg1(SiS_P3c4,0x16,SR16);
- SiS_SetReg1(SiS_P3c4,0x17,SR17);
- SiS_SetReg1(SiS_P3c4,0x18,SR18);
- SiS_SetReg1(SiS_P3c4,0x19,SR19);
- SiS_SetReg1(SiS_P3c4,0x1A,SR1A);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x12,SR12);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,SR13);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,SR14);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,SR16);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x17,SR17);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x18,SR18);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x19,SR19);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1A,SR1A);
}
#endif
#ifdef SIS315H
- if((HwDeviceExtension->jChipType == SIS_550)||
- (HwDeviceExtension->jChipType == SIS_640)||
- (HwDeviceExtension->jChipType == SIS_740)||
+ if((HwDeviceExtension->jChipType == SIS_550) ||
+ (HwDeviceExtension->jChipType == SIS_740) ||
(HwDeviceExtension->jChipType == SIS_650)) {
- SiS_SetReg1(SiS_P3c4,0x13,SR13);
- SiS_SetReg1(SiS_P3c4,0x14,SR14);
- SiS_SetReg1(SiS_P3c4,0x15,SR15);
- SiS_SetReg1(SiS_P3c4,0x16,SR16);
- SiS_SetReg1(SiS_P3c4,0x17,SR17);
- SiS_SetReg1(SiS_P3c4,0x19,SR19);
- SiS_SetReg1(SiS_P3c4,0x1A,SR1A);
- SiS_SetReg1(SiS_P3c4,0x1B,SR1B);
- SiS_SetReg1(SiS_P3d4,0x37,CR37);
- SiS_SetReg1(SiS_P3d4,0x38,CR38);
- SiS_SetReg1(SiS_P3d4,0x79,CR79);
- SiS_SetReg1(SiS_P3d4,0x7A,CR7A);
- SiS_SetReg1(SiS_P3d4,0x7B,CR7B);
- SiS_SetReg1(SiS_P3d4,0x7C,CR7C);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,SR13);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,SR14);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x15,SR15);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,SR16);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x17,SR17);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x19,SR19);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1A,SR1A);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1B,SR1B);
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x37,CR37);
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x38,CR38);
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x79,CR79);
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x7A,CR7A);
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x7B,CR7B);
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x7C,CR7C);
}
#endif
#ifdef SIS300
- if((HwDeviceExtension->jChipType==SIS_540)||
- (HwDeviceExtension->jChipType==SIS_630)||
+ if((HwDeviceExtension->jChipType==SIS_540) ||
+ (HwDeviceExtension->jChipType==SIS_630) ||
(HwDeviceExtension->jChipType==SIS_730)) {
temp = (UCHAR)SR1A & 0x03;
- } else if(HwDeviceExtension->jChipType==SIS_300) {
- /* TW: Nothing? */
+ } else if(HwDeviceExtension->jChipType == SIS_300) {
+ /* TW: Nothing */
}
#endif
#ifdef SIS315H
- if((HwDeviceExtension->jChipType == SIS_315H )||
- (HwDeviceExtension->jChipType == SIS_315PRO)) {
- if((*pSiS_SoftSetting & SoftDRAMType) == 0){
- temp = (UCHAR)SiS_GetReg1(SiS_P3c4,0x3A) & 0x03;
+ if((HwDeviceExtension->jChipType == SIS_315H) ||
+ (HwDeviceExtension->jChipType == SIS_315) ||
+ (HwDeviceExtension->jChipType == SIS_315PRO) ||
+ (HwDeviceExtension->jChipType == SIS_330) ) {
+ if((*SiS_Pr->pSiS_SoftSetting & SoftDRAMType) == 0) {
+ temp = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x3A) & 0x03;
}
}
- if((HwDeviceExtension->jChipType == SIS_550)||
- (HwDeviceExtension->jChipType == SIS_640)||
- (HwDeviceExtension->jChipType == SIS_740)||
+ if((HwDeviceExtension->jChipType == SIS_550) ||
+ (HwDeviceExtension->jChipType == SIS_740) ||
(HwDeviceExtension->jChipType == SIS_650)) {
- if((*pSiS_SoftSetting & SoftDRAMType) == 0){
- temp = (UCHAR)SiS_GetReg1(SiS_P3c4,0x13) & 0x07;
+ if((*SiS_Pr->pSiS_SoftSetting & SoftDRAMType) == 0) {
+ temp = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13) & 0x07;
}
}
#endif
- SiS_RAMType = temp;
- SiS_SetMemoryClock(ROMAddr,HwDeviceExtension);
+ SiS_Pr->SiS_RAMType = temp;
+ SiS_SetMemoryClock(SiS_Pr, ROMAddr, HwDeviceExtension);
-/* SetDefExt1Regs begin: Set default register contents */
+ /* Set default register contents */
- SiS_SetReg1(SiS_P3c4,0x07,*pSiS_SR07); /* DAC speed */
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x07,*SiS_Pr->pSiS_SR07); /* DAC speed */
if((HwDeviceExtension->jChipType != SIS_540) &&
(HwDeviceExtension->jChipType != SIS_630) &&
(HwDeviceExtension->jChipType != SIS_730)){
for(i=0x15;i<0x1C;i++) {
- SiS_SetReg1(SiS_P3c4,i,SiS_SR15[i-0x15][SiS_RAMType]);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,i,SiS_Pr->SiS_SR15[i-0x15][SiS_Pr->SiS_RAMType]);
}
}
#ifdef SIS315H
- if ((HwDeviceExtension->jChipType == SIS_315H )||
- (HwDeviceExtension->jChipType == SIS_315PRO)) {
+ if((HwDeviceExtension->jChipType == SIS_315H) ||
+ (HwDeviceExtension->jChipType == SIS_315) ||
+ (HwDeviceExtension->jChipType == SIS_315PRO) ||
+ (HwDeviceExtension->jChipType == SIS_330)) {
for(i=0x40;i<=0x44;i++) {
- SiS_SetReg1(SiS_P3d4,i,SiS_CR40[i-0x40][SiS_RAMType]);
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,i,SiS_Pr->SiS_CR40[i-0x40][SiS_Pr->SiS_RAMType]);
}
- SiS_SetReg1(SiS_P3d4,0x48,0x23);
- SiS_SetReg1(SiS_P3d4,0x49,SiS_CR49[0]);
- /* SiS_SetReg1(SiS_P3c4,0x25,SiS_SR25[0]); */
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x48,0x23);
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x49,SiS_Pr->SiS_CR49[0]);
+ /* SiS_SetReg1(SiS_Pr->SiS_P3c4,0x25,SiS_Pr->SiS_SR25[0]); */
}
#endif
- SiS_SetReg1(SiS_P3c4,0x1F,*pSiS_SR1F); /* DAC pedestal */
- SiS_SetReg1(SiS_P3c4,0x20,0xA0);
- SiS_SetReg1(SiS_P3c4,0x23,*pSiS_SR23);
- SiS_SetReg1(SiS_P3c4,0x24,*pSiS_SR24);
- SiS_SetReg1(SiS_P3c4,0x25,SiS_SR25[0]);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1F,*SiS_Pr->pSiS_SR1F); /* DAC pedestal */
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x20,0xA0);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x23,*SiS_Pr->pSiS_SR23);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x24,*SiS_Pr->pSiS_SR24);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x25,SiS_Pr->SiS_SR25[0]);
#ifdef SIS300
- if(HwDeviceExtension->jChipType==SIS_300) {
- SiS_SetReg1(SiS_P3c4,0x21,0x84);
- SiS_SetReg1(SiS_P3c4,0x22,0x00);
+ if(HwDeviceExtension->jChipType == SIS_300) {
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x21,0x84);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x22,0x00);
}
#endif
- SR11=0x0F;
- SiS_SetReg1(SiS_P3c4,0x11,SR11); /* Power Management & DDC port */
+ SR11 = 0x0F;
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x11,SR11); /* Power Management & DDC port */
- SiS_UnLockCRT2(HwDeviceExtension, BaseAddr);
- SiS_SetReg1(SiS_Part1Port,0x00,0x00);
- SiS_SetReg1(SiS_Part1Port,0x02,*pSiS_CRT2Data_1_2);
+ SiS_UnLockCRT2(SiS_Pr, HwDeviceExtension, BaseAddr);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x00,0x00);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x02,*SiS_Pr->pSiS_CRT2Data_1_2);
#ifdef SIS315H
if((HwDeviceExtension->jChipType == SIS_315H) ||
+ (HwDeviceExtension->jChipType == SIS_315) ||
(HwDeviceExtension->jChipType == SIS_315PRO) ||
- (HwDeviceExtension->jChipType == SIS_550)||
- (HwDeviceExtension->jChipType == SIS_640)||
- (HwDeviceExtension->jChipType == SIS_740)||
- (HwDeviceExtension->jChipType == SIS_650))
- SiS_SetReg1(SiS_Part1Port,0x2E,0x08); /* use VB */
+ (HwDeviceExtension->jChipType == SIS_550) ||
+ (HwDeviceExtension->jChipType == SIS_650) ||
+ (HwDeviceExtension->jChipType == SIS_740) ||
+ (HwDeviceExtension->jChipType == SIS_330))
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x2E,0x08); /* use VB */
#endif
- temp=*pSiS_SR32;
- if(SiS_BridgeIsOn(BaseAddr)) {
+ temp = *SiS_Pr->pSiS_SR32;
+ if(SiS_BridgeIsOn(SiS_Pr, BaseAddr)) {
temp &= 0xEF;
}
- SiS_SetReg1(SiS_P3c4,0x32,temp);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x32,temp);
#ifdef SIS315H
- if ((HwDeviceExtension->jChipType == SIS_315H) ||
- (HwDeviceExtension->jChipType == SIS_315PRO)) {
- HwDeviceExtension->pQueryVGAConfigSpace(HwDeviceExtension,0x50,0,&Temp); /* Get */
+ if((HwDeviceExtension->jChipType == SIS_315H) ||
+ (HwDeviceExtension->jChipType == SIS_315) ||
+ (HwDeviceExtension->jChipType == SIS_315PRO) ||
+ (HwDeviceExtension->jChipType == SIS_330)) {
+ HwDeviceExtension->pQueryVGAConfigSpace(HwDeviceExtension,0x50,0,&Temp);
Temp >>= 20;
Temp &= 0xF;
- if (Temp!=1) {
- SiS_SetReg1(SiS_P3c4,0x25,SiS_SR25[1]);
- SiS_SetReg1(SiS_P3d4,0x49,SiS_CR49[1]);
+ if (Temp != 1) {
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x25,SiS_Pr->SiS_SR25[1]);
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x49,SiS_Pr->SiS_CR49[1]);
}
- SiS_SetReg1(SiS_P3c4,0x27,0x1F);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x27,0x1F);
- SiS_SetReg1(SiS_P3c4,0x31,*pSiS_SR31);
- SiS_SetReg1(SiS_P3c4,0x32,*pSiS_SR32);
- SiS_SetReg1(SiS_P3c4,0x33,*pSiS_SR33);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x31,*SiS_Pr->pSiS_SR31);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x32,*SiS_Pr->pSiS_SR32);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x33,*SiS_Pr->pSiS_SR33);
}
#endif
- if (SiS_BridgeIsOn(BaseAddr) == 0) {
- if(SiS_IF_DEF_LVDS==0) {
- SiS_SetReg1(SiS_Part2Port,0x00,0x1C);
- SiS_SetReg1(SiS_Part4Port,0x0D,*pSiS_CRT2Data_4_D);
- SiS_SetReg1(SiS_Part4Port,0x0E,*pSiS_CRT2Data_4_E);
- SiS_SetReg1(SiS_Part4Port,0x10,*pSiS_CRT2Data_4_10);
- SiS_SetReg1(SiS_Part4Port,0x0F,0x3F);
+ if (SiS_BridgeIsOn(SiS_Pr, BaseAddr) == 0) {
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x00,0x1C);
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x0D,*SiS_Pr->pSiS_CRT2Data_4_D);
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x0E,*SiS_Pr->pSiS_CRT2Data_4_E);
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x10,*SiS_Pr->pSiS_CRT2Data_4_10);
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x0F,0x3F);
}
- SiS_LockCRT2(HwDeviceExtension, BaseAddr);
+ SiS_LockCRT2(SiS_Pr, HwDeviceExtension, BaseAddr);
}
- SiS_SetReg1(SiS_P3d4,0x83,0x00);
-
-/* SetDefExt1Regs end */
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x83,0x00);
#ifdef SIS315H
- if ((HwDeviceExtension->jChipType==SIS_315H)||
- (HwDeviceExtension->jChipType==SIS_315PRO)) {
- if (HwDeviceExtension->bSkipDramSizing==TRUE) {
- SiS_SetDRAMModeRegister(ROMAddr,HwDeviceExtension);
+ if((HwDeviceExtension->jChipType == SIS_315H) ||
+ (HwDeviceExtension->jChipType == SIS_315) ||
+ (HwDeviceExtension->jChipType == SIS_315PRO) ||
+ (HwDeviceExtension->jChipType == SIS_330)) {
+ if(HwDeviceExtension->bSkipDramSizing==TRUE) {
+ SiS_SetDRAMModeRegister(SiS_Pr, ROMAddr,HwDeviceExtension);
pSR = HwDeviceExtension->pSR;
- if (pSR!=NULL) {
- while (pSR->jIdx!=0xFF) {
- SiS_SetReg1(SiS_P3c4,pSR->jIdx,pSR->jVal);
+ if(pSR != NULL) {
+ while(pSR->jIdx != 0xFF) {
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,pSR->jIdx,pSR->jVal);
pSR++;
}
}
- } else SiS_SetDRAMSize_310(HwDeviceExtension);
+ } else SiS_SetDRAMSize_310(SiS_Pr, HwDeviceExtension);
}
#endif
#ifdef SIS315H
- if((HwDeviceExtension->jChipType==SIS_550)){
+ if(HwDeviceExtension->jChipType == SIS_550) {
/* SetDRAMConfig begin */
-/* SiS_SetReg1(SiS_P3c4,0x12,SR12);
- SiS_SetReg1(SiS_P3c4,0x13,SR13);
- SiS_SetReg1(SiS_P3c4,0x14,SR14);
- SiS_SetReg1(SiS_P3c4,0x16,SR16);
- SiS_SetReg1(SiS_P3c4,0x17,SR17);
- SiS_SetReg1(SiS_P3c4,0x18,SR18);
- SiS_SetReg1(SiS_P3c4,0x19,SR19);
- SiS_SetReg1(SiS_P3c4,0x1A,SR1A); */
+/* SiS_SetReg1(SiS_Pr->SiS_P3c4,0x12,SR12);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,SR13);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,SR14);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,SR16);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x17,SR17);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x18,SR18);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x19,SR19);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1A,SR1A); */
/* SetDRAMConfig end */
}
#endif
#ifdef SIS300
- if( HwDeviceExtension->jChipType==SIS_300) {
- if (HwDeviceExtension->bSkipDramSizing==TRUE) {
+ if(HwDeviceExtension->jChipType == SIS_300) {
+ if (HwDeviceExtension->bSkipDramSizing == TRUE) {
/* SiS_SetDRAMModeRegister(ROMAddr,HwDeviceExtension);
temp = (HwDeviceExtension->pSR)->jVal;
- SiS_SetReg1(SiS_P3c4,0x13,temp);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,temp);
temp = (HwDeviceExtension->pSR)->jVal;
- SiS_SetReg1(SiS_P3c4,0x14,temp); */
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,temp); */
} else {
#ifdef TC
- SiS_SetReg1(SiS_P3c4,0x13,SR13);
- SiS_SetReg1(SiS_P3c4,0x14,SR14);
- SiS_SetRegANDOR(SiS_P3c4,0x15,0xFF,0x04);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,SR13);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,SR14);
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x15,0xFF,0x04);
#else
- SiS_SetDRAMSize_300(HwDeviceExtension);
- SiS_SetDRAMSize_300(HwDeviceExtension);
+ SiS_SetDRAMSize_300(SiS_Pr, HwDeviceExtension);
+ SiS_SetDRAMSize_300(SiS_Pr, HwDeviceExtension);
#endif
}
}
if((HwDeviceExtension->jChipType==SIS_540)||
(HwDeviceExtension->jChipType==SIS_630)||
- (HwDeviceExtension->jChipType==SIS_730)){
- /* SetDRAMConfig begin */
+ (HwDeviceExtension->jChipType==SIS_730)) {
#if 0
- SiS_SetReg1(SiS_P3c4,0x12,SR12);
- SiS_SetReg1(SiS_P3c4,0x13,SR13);
- SiS_SetReg1(SiS_P3c4,0x14,SR14);
- SiS_SetReg1(SiS_P3c4,0x16,SR16);
- SiS_SetReg1(SiS_P3c4,0x17,SR17);
- SiS_SetReg1(SiS_P3c4,0x18,SR18);
- SiS_SetReg1(SiS_P3c4,0x19,SR19);
- SiS_SetReg1(SiS_P3c4,0x1A,SR1A);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x12,SR12);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,SR13);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,SR14);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,SR16);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x17,SR17);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x18,SR18);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x19,SR19);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1A,SR1A);
#endif
- /* SetDRAMConfig end */
}
/* SetDRAMSize end */
#endif /* SIS300 */
-/* SetDefExt2Regs begin */
+ /* Set default Ext2Regs */
#if 0
AGP=1;
- temp=(UCHAR)SiS_GetReg1(SiS_P3c4,0x3A);
- temp=temp&0x30;
- if(temp==0x30) AGP=0;
- if(AGP==0) *pSiS_SR21=*pSiS_SR21&0xEF;
- SiS_SetReg1(SiS_P3c4,0x21,*pSiS_SR21);
- if(AGP==1) *pSiS_SR22=*pSiS_SR22&0x20;
- SiS_SetReg1(SiS_P3c4,0x22,*pSiS_SR22);
+ temp=(UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x3A);
+ temp &= 0x30;
+ if(temp == 0x30) AGP=0;
+ if(AGP == 0) *SiS_Pr->pSiS_SR21 &= 0xEF;
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x21,*SiS_Pr->pSiS_SR21);
+ if(AGP == 1) *SiS_Pr->pSiS_SR22 &= 0x20;
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x22,*SiS_Pr->pSiS_SR22);
#endif
- SiS_SetReg1(SiS_P3c4,0x21,*pSiS_SR21);
- SiS_SetReg1(SiS_P3c4,0x22,*pSiS_SR22);
-/* SetDefExt2Regs end */
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x21,*SiS_Pr->pSiS_SR21);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x22,*SiS_Pr->pSiS_SR22);
#if 0
- SiS_SetReg3(SiS_P3c6,0xff);
- SiS_ClearDAC(SiS_P3c8); /* [ynlai] 05/22/01 */
+ SiS_SetReg3(SiS_Pr->SiS_P3c6,0xff);
+ SiS_ClearDAC(SiS_Pr, SiS_Pr->SiS_P3c8);
#endif
#ifdef LINUXBIOS /* TW: This is not needed for our purposes */
- SiS_DetectMonitor(HwDeviceExtension,BaseAddr);
- SiS_GetSenseStatus(HwDeviceExtension,ROMAddr); /* sense CRT2 */
+ SiS_DetectMonitor(SiS_Pr, HwDeviceExtension,BaseAddr); /* Sense CRT1 */
+ SiS_GetSenseStatus(SiS_Pr, HwDeviceExtension,ROMAddr); /* Sense CRT2 */
#endif
return(TRUE);
}
void
-SiS_Set_LVDS_TRUMPION(PSIS_HW_DEVICE_INFO HwDeviceExtension)
+SiS_Set_LVDS_TRUMPION(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
- USHORT temp=0;
+ USHORT temp = 0;
#ifdef SiS300
- if ((HwDeviceExtension->jChipType == SIS_540)||
- (HwDeviceExtension->jChipType == SIS_630)||
- (HwDeviceExtension->jChipType == SIS_730)) {
+ if((HwDeviceExtension->jChipType == SIS_540) ||
+ (HwDeviceExtension->jChipType == SIS_630) ||
+ (HwDeviceExtension->jChipType == SIS_730)) {
/* TW: Read POWER_ON_TRAP and copy to CR37 */
- temp = (UCHAR)SiS_GetReg1(SiS_P3c4,0x1A);
+ temp = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1A);
temp = (temp & 0xE0) >> 4;
- SiS_SetRegANDOR(SiS_P3d4,0x37,0xF1,temp);
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x37,0xF1,temp);
}
#endif
#ifdef SIS315H
- if ((HwDeviceExtension->jChipType == SIS_640)||
- (HwDeviceExtension->jChipType == SIS_740)||
- (HwDeviceExtension->jChipType == SIS_650)) {
+ if((HwDeviceExtension->jChipType == SIS_650) ||
+ (HwDeviceExtension->jChipType == SIS_740) ||
+ (HwDeviceExtension->jChipType == SIS_330)) {
#if 0 /* TW: This is not required */
/* TW: Read POWER_ON_TRAP and copy to CR37 */
- temp = (UCHAR)SiS_GetReg1(SiS_P3c4,0x1A);
+ temp = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1A);
temp = (temp & 0xE0) >> 4;
- SiS_SetRegANDOR(SiS_P3d4,0x37,0xF1,temp);
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x37,0xF1,temp);
#endif
}
#endif
- /* Set globals SiS_IF_DEF... */
- SiSSetLVDSetc(HwDeviceExtension, 0);
+ SiSSetLVDSetc(SiS_Pr, HwDeviceExtension, 0);
}
/* =============== SiS 300 dram sizing begin =============== */
#ifdef SIS300
void
-SiS_SetDRAMSize_300(PSIS_HW_DEVICE_INFO HwDeviceExtension)
+SiS_SetDRAMSize_300(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
ULONG FBAddr = (ULONG)HwDeviceExtension->pjVideoMemoryAddress;
- USHORT SR13,SR14=0,buswidth,Done;
- SHORT i,j,k;
+ USHORT SR13, SR14=0, buswidth, Done;
+ SHORT i, j, k;
USHORT data, TotalCapacity, PhysicalAdrOtherPage=0;
ULONG Addr;
UCHAR temp;
- int PseudoRankCapacity,PseudoTotalCapacity,PseudoAdrPinCount;
- int RankCapacity,AdrPinCount,BankNumHigh,BankNumMid,MB2Bank;
- int PageCapacity,PhysicalAdrHigh,PhysicalAdrHalfPage;
-
- SiSSetMode(HwDeviceExtension,0x2e);
-
- data=SiS_GetReg1(SiS_P3c4,0x01);
- data=data|0x20;
- SiS_SetReg1(SiS_P3c4,0x01,data); /* Turn OFF Display */
-
- SiS_SetReg1(SiS_P3c4,0x13,0x00);
- SiS_SetReg1(SiS_P3c4,0x14,0xBF);
- buswidth=SiS_ChkBUSWidth_300(FBAddr);
-
- MB2Bank=16;
- Done=0;
- for(i=6;i>=0;i--) {
- if(Done==1) break;
- PseudoRankCapacity=1<<i;
- for(j=4;j>=1;j--) {
- if(Done==1) break;
- PseudoTotalCapacity=PseudoRankCapacity*j;
- PseudoAdrPinCount=15-j;
+ int PseudoRankCapacity, PseudoTotalCapacity, PseudoAdrPinCount;
+ int RankCapacity, AdrPinCount, BankNumHigh, BankNumMid, MB2Bank;
+ int PageCapacity, PhysicalAdrHigh, PhysicalAdrHalfPage;
+
+ SiSSetMode(SiS_Pr, HwDeviceExtension, 0x2e);
+
+ SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x01,0x20); /* Turn OFF Display */
+
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,0x00);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,0xBF);
+
+ buswidth = SiS_ChkBUSWidth_300(SiS_Pr, FBAddr);
+
+ MB2Bank = 16;
+ Done = 0;
+ for(i=6; i>=0; i--) {
+ if(Done == 1) break;
+ PseudoRankCapacity = 1 << i;
+ for(j=4; j>=1; j--) {
+ if(Done == 1) break;
+ PseudoTotalCapacity = PseudoRankCapacity * j;
+ PseudoAdrPinCount = 15 - j;
if(PseudoTotalCapacity <= 64) {
- for(k=0;k<=16;k++) {
- if(Done==1) break;
- RankCapacity=buswidth*SiS_DRAMType[k][3];
- AdrPinCount=SiS_DRAMType[k][2]+SiS_DRAMType[k][0];
- if(RankCapacity==PseudoRankCapacity)
- if(AdrPinCount<=PseudoAdrPinCount) {
- if(j==3) { /* Rank No */
- BankNumHigh=RankCapacity*MB2Bank*3-1;
- BankNumMid=RankCapacity*MB2Bank*1-1;
- }
- else {
- BankNumHigh=RankCapacity*MB2Bank*j-1;
- BankNumMid=RankCapacity*MB2Bank*j/2-1;
+ for(k=0; k<=16; k++) {
+ if(Done == 1) break;
+ RankCapacity = buswidth * SiS_DRAMType[k][3];
+ AdrPinCount = SiS_DRAMType[k][2] + SiS_DRAMType[k][0];
+ if(RankCapacity == PseudoRankCapacity)
+ if(AdrPinCount <= PseudoAdrPinCount) {
+ if(j == 3) { /* Rank No */
+ BankNumHigh = RankCapacity * MB2Bank * 3 - 1;
+ BankNumMid = RankCapacity * MB2Bank * 1 - 1;
+ } else {
+ BankNumHigh = RankCapacity * MB2Bank * j - 1;
+ BankNumMid = RankCapacity * MB2Bank * j / 2 - 1;
}
- PageCapacity=(1<<SiS_DRAMType[k][1])*buswidth*4;
- PhysicalAdrHigh =BankNumHigh;
- PhysicalAdrHalfPage=(PageCapacity/2+PhysicalAdrHigh)%PageCapacity;
- PhysicalAdrOtherPage=PageCapacity*SiS_DRAMType[k][2]+PhysicalAdrHigh;
+ PageCapacity = (1 << SiS_DRAMType[k][1]) * buswidth * 4;
+ PhysicalAdrHigh = BankNumHigh;
+ PhysicalAdrHalfPage = (PageCapacity / 2 + PhysicalAdrHigh) % PageCapacity;
+ PhysicalAdrOtherPage = PageCapacity * SiS_DRAMType[k][2] + PhysicalAdrHigh;
/* Write data */
- /*Test */
- temp=(UCHAR)SiS_GetReg1(SiS_P3c4,0x15);
- SiS_SetReg1(SiS_P3c4,0x15,(USHORT)(temp&0xFB));
-
- temp=(UCHAR)SiS_GetReg1(SiS_P3c4,0x15);
- SiS_SetReg1(SiS_P3c4,0x15,(USHORT)(temp|0x04));
- /*Test */
- TotalCapacity=SiS_DRAMType[k][3]*buswidth;
- SR13=SiS_DRAMType[k][4];
- if(buswidth==4) SR14=(TotalCapacity-1)|0x80;
- if(buswidth==2) SR14=(TotalCapacity-1)|0x40;
- if(buswidth==1) SR14=(TotalCapacity-1)|0x00;
- SiS_SetReg1(SiS_P3c4,0x13,SR13);
- SiS_SetReg1(SiS_P3c4,0x14,SR14);
-
- Addr=FBAddr+(BankNumHigh)*64*1024+PhysicalAdrHigh;
- *((USHORT *)(Addr)) = (USHORT) PhysicalAdrHigh;
- Addr=FBAddr+(BankNumMid)*64*1024+PhysicalAdrHigh;
- *((USHORT *)(Addr)) = (USHORT) BankNumMid;
- Addr=FBAddr+(BankNumHigh)*64*1024+PhysicalAdrHalfPage;
- *((USHORT *)(Addr)) = (USHORT) PhysicalAdrHalfPage;
- Addr=FBAddr+(BankNumHigh)*64*1024+PhysicalAdrOtherPage;
- *((USHORT *)(Addr))=PhysicalAdrOtherPage;
+ /*Test*/
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x15,0xFB);
+ SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x15,0x04);
+ /*/Test*/
+ TotalCapacity = SiS_DRAMType[k][3] * buswidth;
+ SR13 = SiS_DRAMType[k][4];
+ if(buswidth == 4) SR14 = (TotalCapacity - 1) | 0x80;
+ if(buswidth == 2) SR14 = (TotalCapacity - 1) | 0x40;
+ if(buswidth == 1) SR14 = (TotalCapacity - 1) | 0x00;
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,SR13);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,SR14);
+
+ Addr = FBAddr + (BankNumHigh) * 64 * 1024 + PhysicalAdrHigh;
+ *((USHORT *)(Addr)) = (USHORT)PhysicalAdrHigh;
+ Addr = FBAddr + (BankNumMid) * 64 * 1024 + PhysicalAdrHigh;
+ *((USHORT *)(Addr)) = (USHORT)BankNumMid;
+ Addr = FBAddr + (BankNumHigh) * 64 * 1024 + PhysicalAdrHalfPage;
+ *((USHORT *)(Addr)) = (USHORT)PhysicalAdrHalfPage;
+ Addr = FBAddr + (BankNumHigh) * 64 * 1024 + PhysicalAdrOtherPage;
+ *((USHORT *)(Addr)) = PhysicalAdrOtherPage;
/* Read data */
- Addr=FBAddr+(BankNumHigh)*64*1024+PhysicalAdrHigh;
- data=*((USHORT *)(Addr));
- if(data==PhysicalAdrHigh) Done=1;
+ Addr = FBAddr + (BankNumHigh) * 64 * 1024 + PhysicalAdrHigh;
+ data = *((USHORT *)(Addr));
+ if(data == PhysicalAdrHigh) Done = 1;
} /* if struct */
} /* for loop (k) */
} /* if struct */
@@ -1153,21 +1298,20 @@ SiS_SetDRAMSize_300(PSIS_HW_DEVICE_INFO HwDeviceExtension)
}
USHORT
-SiS_ChkBUSWidth_300(ULONG FBAddress)
+SiS_ChkBUSWidth_300(SiS_Private *SiS_Pr, ULONG FBAddress)
{
- /*USHORT data;*/
PULONG pVideoMemory;
- pVideoMemory = (PULONG) FBAddress;
+ pVideoMemory = (PULONG)FBAddress;
pVideoMemory[0] = 0x01234567L;
pVideoMemory[1] = 0x456789ABL;
pVideoMemory[2] = 0x89ABCDEFL;
pVideoMemory[3] = 0xCDEF0123L;
- if (pVideoMemory[3]==0xCDEF0123L) { /*ChannelA128Bit */
+ if (pVideoMemory[3]==0xCDEF0123L) { /* Channel A 128bit */
return(4);
}
- if (pVideoMemory[1]==0x456789ABL) { /*ChannelB64Bit */
+ if (pVideoMemory[1]==0x456789ABL) { /* Channel B 64bit */
return(2);
}
return(1);
@@ -1175,99 +1319,93 @@ SiS_ChkBUSWidth_300(ULONG FBAddress)
#endif
/* =============== SiS 300 dram sizing end =============== */
-/* ============== SiS 310 dram sizing begin ================= */
+/* ============ SiS 310/325 dram sizing begin ============== */
#ifdef SIS315H
/* TW: Moved Get310DRAMType further down */
void
-SiS_Delay15us(ULONG ulMicrsoSec)
+SiS_Delay15us(SiS_Private *SiS_Pr, ULONG ulMicrsoSec)
{
}
void
-SiS_SDR_MRS(void)
+SiS_SDR_MRS(SiS_Private *SiS_Pr, )
{
USHORT data;
- data=SiS_GetReg1(SiS_P3c4,0x16);
- data=data & 0x3F; /* SR16 D7=0,D6=0 */
- SiS_SetReg1(SiS_P3c4,0x16,data); /* enable mode register set(MRS) low */
- SiS_Delay15us(0x100);
- data=data | 0x80; /* SR16 D7=1,D6=0 */
- SiS_SetReg1(SiS_P3c4,0x16,data); /* enable mode register set(MRS) high */
- SiS_Delay15us(0x100);
+ data = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16);
+ data &= 0x3F; /* SR16 D7=0, D6=0 */
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,data); /* enable mode register set(MRS) low */
+ SiS_Delay15us(SiS_Pr, 0x100);
+ data |= 0x80; /* SR16 D7=1, D6=0 */
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,data); /* enable mode register set(MRS) high */
+ SiS_Delay15us(SiS_Pr, 0x100);
}
void
-SiS_DDR_MRS(void)
+SiS_DDR_MRS(SiS_Private *SiS_Pr)
{
USHORT data;
/* SR16 <- 1F,DF,2F,AF */
/* enable DLL of DDR SD/SGRAM , SR16 D4=1 */
- data=SiS_GetReg1(SiS_P3c4,0x16);
+ data=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16);
data &= 0x0F;
data |= 0x10;
- SiS_SetReg1(SiS_P3c4,0x16,data);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,data);
- if (!(SiS_SR15[1][SiS_RAMType] & 0x10))
+ if (!(SiS_Pr->SiS_SR15[1][SiS_Pr->SiS_RAMType] & 0x10))
data &= 0x0F;
/* SR16 D7=1,D6=1 */
data |= 0xC0;
- SiS_SetReg1(SiS_P3c4,0x16,data);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,data);
/* SR16 D7=1,D6=0,D5=1,D4=0 */
data &= 0x0F;
data |= 0x20;
- SiS_SetReg1(SiS_P3c4,0x16,data);
- if (!(SiS_SR15[1][SiS_RAMType] & 0x10))
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,data);
+ if (!(SiS_Pr->SiS_SR15[1][SiS_Pr->SiS_RAMType] & 0x10))
data &= 0x0F;
/* SR16 D7=1 */
data |= 0x80;
- SiS_SetReg1(SiS_P3c4,0x16,data);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,data);
}
void
-SiS_SetDRAMModeRegister(UCHAR *ROMAddr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
+SiS_SetDRAMModeRegister(SiS_Private *SiS_Pr, UCHAR *ROMAddr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
if (SiS_Get310DRAMType(ROMAddr,HwDeviceExtension) < 2)
- SiS_SDR_MRS();
+ SiS_SDR_MRS(SiS_Pr);
else
/* SR16 <- 0F,CF,0F,8F */
- SiS_DDR_MRS();
+ SiS_DDR_MRS(SiS_Pr);
}
void
-SiS_DisableRefresh(void)
+SiS_DisableRefresh(SiS_Private *SiS_Pr)
{
- USHORT data;
-
- data=SiS_GetReg1(SiS_P3c4,0x17);
- data &= 0xF8;
- SiS_SetReg1(SiS_P3c4,0x17,data);
-
- data=SiS_GetReg1(SiS_P3c4,0x19);
- data |= 0x03;
- SiS_SetReg1(SiS_P3c4,0x19,data);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x17,0xF8);
+ SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x19,0x03);
}
void
-SiS_EnableRefresh(UCHAR *ROMAddr)
+SiS_EnableRefresh(SiS_Private *SiS_Pr, UCHAR *ROMAddr)
{
- SiS_SetReg1(SiS_P3c4,0x17,SiS_SR15[2][SiS_RAMType]); /* SR17 */
- SiS_SetReg1(SiS_P3c4,0x19,SiS_SR15[4][SiS_RAMType]); /* SR19 */
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x17,SiS_Pr->SiS_SR15[2][SiS_Pr->SiS_RAMType]);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x19,SiS_Pr->SiS_SR15[4][SiS_Pr->SiS_RAMType]);
}
void
-SiS_DisableChannelInterleaving(int index,USHORT SiS_DDRDRAM_TYPE[][5])
+SiS_DisableChannelInterleaving(SiS_Private *SiS_Pr, int index,
+ USHORT SiS_DDRDRAM_TYPE[][5])
{
USHORT data;
- data=SiS_GetReg1(SiS_P3c4,0x15);
+ data=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x15);
data &= 0x1F;
switch (SiS_DDRDRAM_TYPE[index][3])
{
@@ -1276,37 +1414,41 @@ SiS_DisableChannelInterleaving(int index,USHORT SiS_DDRDRAM_TYPE[][5])
case 16: data |= 0x40; break;
case 4: data |= 0x60; break;
}
- SiS_SetReg1(SiS_P3c4,0x15,data);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x15,data);
}
void
-SiS_SetDRAMSizingType(int index,USHORT DRAMTYPE_TABLE[][5])
+SiS_SetDRAMSizingType(SiS_Private *SiS_Pr, int index, USHORT DRAMTYPE_TABLE[][5])
{
- USHORT data;
-
- data = DRAMTYPE_TABLE[index][4];
- SiS_SetReg1(SiS_P3c4,0x13,data);
-
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,DRAMTYPE_TABLE[index][4]);
/* should delay 50 ns */
}
void
-SiS_CheckBusWidth_310(UCHAR *ROMAddress,ULONG FBAddress,
+SiS_CheckBusWidth_310(SiS_Private *SiS_Pr, UCHAR *ROMAddress,ULONG FBAddress,
PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
- USHORT data;
- PULONG volatile pVideoMemory;
+ USHORT data, temp;
+ PULONG volatile pVideoMemory;
+
+ pVideoMemory = (PULONG)FBAddress;
+
+ if(HwDeviceExtension->jChipType == SIS_330) temp = 1;
+ else temp = 2;
- pVideoMemory = (PULONG) FBAddress;
- if (SiS_Get310DRAMType(ROMAddress,HwDeviceExtension) < 2) {
+ if(SiS_Get310DRAMType(ROMAddress,HwDeviceExtension) < temp) {
- SiS_SetReg1(SiS_P3c4,0x13,0x00);
- SiS_SetReg1(SiS_P3c4,0x14,0x12);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,0x00);
+ if(HwDeviceExtension->jChipType != SIS_330) {
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,0x12);
+ } else {
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,0x02);
+ }
/* should delay */
- SiS_SDR_MRS();
+ SiS_SDR_MRS(SiS_Pr);
- SiS_ChannelAB = 0;
- SiS_DataBusWidth = 128;
+ SiS_Pr->SiS_ChannelAB = 0;
+ SiS_Pr->SiS_DataBusWidth = 128;
pVideoMemory[0] = 0x01234567L;
pVideoMemory[1] = 0x456789ABL;
pVideoMemory[2] = 0x89ABCDEFL;
@@ -1315,32 +1457,30 @@ SiS_CheckBusWidth_310(UCHAR *ROMAddress,ULONG FBAddress,
pVideoMemory[5] = 0x55555555L;
pVideoMemory[6] = 0xFFFFFFFFL;
pVideoMemory[7] = 0xFFFFFFFFL;
- if ((pVideoMemory[3]!=0xCDEF0123L) || (pVideoMemory[2] != 0x89ABCDEFL)) {
- /*ChannelA64Bit */
- SiS_DataBusWidth = 64;
- SiS_ChannelAB = 0;
- data=SiS_GetReg1(SiS_P3c4,0x14);
- SiS_SetReg1(SiS_P3c4, 0x14, (USHORT) (data & 0xFD));
+ if((pVideoMemory[3] != 0xCDEF0123L) || (pVideoMemory[2] != 0x89ABCDEFL)) {
+ /* Channel A 64Bit */
+ SiS_Pr->SiS_DataBusWidth = 64;
+ SiS_Pr->SiS_ChannelAB = 0;
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x14, 0xFD);
}
-
- if ((pVideoMemory[1]!=0x456789ABL) || (pVideoMemory[0] != 0x01234567L)) {
- /*ChannelB64Bit */
- SiS_DataBusWidth = 64;
- SiS_ChannelAB = 1;
- data=SiS_GetReg1(SiS_P3c4,0x14);
- SiS_SetReg1(SiS_P3c4,0x14,(USHORT)((data&0xFD)|0x01));
+ if((pVideoMemory[1] != 0x456789ABL) || (pVideoMemory[0] != 0x01234567L)) {
+ /* Channel B 64Bit */
+ SiS_Pr->SiS_DataBusWidth = 64;
+ SiS_Pr->SiS_ChannelAB = 1;
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x14,0xfd,0x01);
}
return;
} else {
+
/* DDR Dual channel */
- SiS_SetReg1(SiS_P3c4,0x13,0x00);
- SiS_SetReg1(SiS_P3c4,0x14,0x02); /* Channel A, 64bit */
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,0x00);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,0x02); /* Channel A, 64bit */
/* should delay */
- SiS_DDR_MRS();
+ SiS_DDR_MRS(SiS_Pr);
- SiS_ChannelAB = 0;
- SiS_DataBusWidth = 64;
+ SiS_Pr->SiS_ChannelAB = 0;
+ SiS_Pr->SiS_DataBusWidth = 64;
pVideoMemory[0] = 0x01234567L;
pVideoMemory[1] = 0x456789ABL;
pVideoMemory[2] = 0x89ABCDEFL;
@@ -1358,17 +1498,17 @@ SiS_CheckBusWidth_310(UCHAR *ROMAddress,ULONG FBAddress,
} else {
if (pVideoMemory[0] == 0x01234567L) {
/* Channel A 32bit */
- SiS_DataBusWidth = 32;
- SiS_SetReg1(SiS_P3c4,0x14,0x00);
+ SiS_Pr->SiS_DataBusWidth = 32;
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,0x00);
return;
}
}
- SiS_SetReg1(SiS_P3c4,0x14,0x03); /* Channel B, 64bit */
- SiS_DDR_MRS();
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,0x03); /* Channel B, 64bit */
+ SiS_DDR_MRS(SiS_Pr);
- SiS_ChannelAB = 1;
- SiS_DataBusWidth = 64;
+ SiS_Pr->SiS_ChannelAB = 1;
+ SiS_Pr->SiS_DataBusWidth = 64;
pVideoMemory[0] = 0x01234567L;
pVideoMemory[1] = 0x456789ABL;
pVideoMemory[2] = 0x89ABCDEFL;
@@ -1377,19 +1517,19 @@ SiS_CheckBusWidth_310(UCHAR *ROMAddress,ULONG FBAddress,
pVideoMemory[5] = 0x55555555L;
pVideoMemory[6] = 0xAAAAAAAAL;
pVideoMemory[7] = 0xAAAAAAAAL;
- if (pVideoMemory[1] == 0x456789ABL) {
+ if(pVideoMemory[1] == 0x456789ABL) {
/* Channel B 64 */
- if (pVideoMemory[0] == 0x01234567L) {
+ if(pVideoMemory[0] == 0x01234567L) {
/* Channel B 64bit */
return;
} else {
/* error */
}
} else {
- if (pVideoMemory[0] == 0x01234567L) {
+ if(pVideoMemory[0] == 0x01234567L) {
/* Channel B 32 */
- SiS_DataBusWidth = 32;
- SiS_SetReg1(SiS_P3c4,0x14,0x01);
+ SiS_Pr->SiS_DataBusWidth = 32;
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,0x01);
} else {
/* error */
}
@@ -1398,7 +1538,7 @@ SiS_CheckBusWidth_310(UCHAR *ROMAddress,ULONG FBAddress,
}
int
-SiS_SetRank(int index,UCHAR RankNo,UCHAR SiS_ChannelAB,USHORT DRAMTYPE_TABLE[][5])
+SiS_SetRank(SiS_Private *SiS_Pr, int index,UCHAR RankNo,USHORT DRAMTYPE_TABLE[][5])
{
USHORT data;
int RankSize;
@@ -1406,68 +1546,66 @@ SiS_SetRank(int index,UCHAR RankNo,UCHAR SiS_ChannelAB,USHORT DRAMTYPE_TABLE[][5
if ((RankNo==2)&&(DRAMTYPE_TABLE[index][0]==2))
return 0;
- RankSize = DRAMTYPE_TABLE[index][3]/2 * SiS_DataBusWidth/32;
+ RankSize = DRAMTYPE_TABLE[index][3]/2 * SiS_Pr->SiS_DataBusWidth / 32;
- if (RankNo*RankSize<=128) {
+ if (RankNo * RankSize <= 128) {
data = 0;
- while ((RankSize>>=1)>0) {
- data+=0x10;
+ while((RankSize >>= 1) > 0) {
+ data += 0x10;
}
- data |= (RankNo-1)<<2;
- data |= (SiS_DataBusWidth/64)&2;
- data |= SiS_ChannelAB;
- SiS_SetReg1(SiS_P3c4,0x14,data);
+ data |= (RankNo - 1) << 2;
+ data |= (SiS_Pr->SiS_DataBusWidth / 64) & 2;
+ data |= SiS_Pr->SiS_ChannelAB;
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,data);
/* should delay */
- SiS_SDR_MRS();
+ SiS_SDR_MRS(SiS_Pr);
return 1;
} else
return 0;
}
int
-SiS_SetDDRChannel(int index,UCHAR ChannelNo,UCHAR SiS_ChannelAB,
+SiS_SetDDRChannel(SiS_Private *SiS_Pr, int index,UCHAR ChannelNo,
USHORT DRAMTYPE_TABLE[][5])
{
USHORT data;
int RankSize;
- RankSize = DRAMTYPE_TABLE[index][3]/2 * SiS_DataBusWidth/32;
+ RankSize = DRAMTYPE_TABLE[index][3]/2 * SiS_Pr->SiS_DataBusWidth / 32;
/* RankSize = DRAMTYPE_TABLE[index][3]; */
- if (ChannelNo*RankSize<=128) {
+ if (ChannelNo * RankSize <= 128) {
data = 0;
- while ((RankSize>>=1)>0) {
- data+=0x10;
+ while((RankSize >>= 1) > 0) {
+ data += 0x10;
}
- if (ChannelNo==2)
- data |= 0x0C;
-
- data |= (SiS_DataBusWidth/32)&2;
- data |= SiS_ChannelAB;
- SiS_SetReg1(SiS_P3c4,0x14,data);
+ if(ChannelNo == 2) data |= 0x0C;
+ data |= (SiS_Pr->SiS_DataBusWidth / 32) & 2;
+ data |= SiS_Pr->SiS_ChannelAB;
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,data);
/* should delay */
- SiS_DDR_MRS();
+ SiS_DDR_MRS(SiS_Pr);
return 1;
} else
return 0;
}
int
-SiS_CheckColumn(int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress)
+SiS_CheckColumn(SiS_Private *SiS_Pr, int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress)
{
int i;
ULONG Increment,Position;
- /*Increment = 1<<(DRAMTYPE_TABLE[index][2] + SiS_DataBusWidth / 64 + 1); */
- Increment = 1<<(10 + SiS_DataBusWidth / 64);
+ /*Increment = 1<<(DRAMTYPE_TABLE[index][2] + SiS_Pr->SiS_DataBusWidth / 64 + 1); */
+ Increment = 1 << (10 + SiS_Pr->SiS_DataBusWidth / 64);
for (i=0,Position=0;i<2;i++) {
- *((PULONG)(FBAddress+Position))=Position;
+ *((PULONG)(FBAddress + Position)) = Position;
Position += Increment;
}
for (i=0,Position=0;i<2;i++) {
/* if (FBAddress[Position]!=Position) */
- if ( (*(PULONG) (FBAddress + Position)) !=Position)
+ if((*(PULONG)(FBAddress + Position)) != Position)
return 0;
Position += Increment;
}
@@ -1475,21 +1613,21 @@ SiS_CheckColumn(int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress)
}
int
-SiS_CheckBanks(int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress)
+SiS_CheckBanks(SiS_Private *SiS_Pr, int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress)
{
int i;
ULONG Increment,Position;
- Increment = 1<<(DRAMTYPE_TABLE[index][2] + SiS_DataBusWidth / 64 + 2);
+ Increment = 1 << (DRAMTYPE_TABLE[index][2] + SiS_Pr->SiS_DataBusWidth / 64 + 2);
for (i=0,Position=0;i<4;i++) {
/* FBAddress[Position]=Position; */
- *((PULONG)(FBAddress+Position))=Position;
+ *((PULONG)(FBAddress + Position)) = Position;
Position += Increment;
}
for (i=0,Position=0;i<4;i++) {
/* if (FBAddress[Position]!=Position) */
- if ( (*(PULONG) (FBAddress + Position)) !=Position)
+ if((*(PULONG)(FBAddress + Position)) != Position)
return 0;
Position += Increment;
}
@@ -1497,12 +1635,12 @@ SiS_CheckBanks(int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress)
}
int
-SiS_CheckRank(int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress)
+SiS_CheckRank(SiS_Private *SiS_Pr, int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress)
{
int i;
ULONG Increment,Position;
Increment = 1<<(DRAMTYPE_TABLE[index][2] + DRAMTYPE_TABLE[index][1] +
- DRAMTYPE_TABLE[index][0] + SiS_DataBusWidth / 64 + RankNo);
+ DRAMTYPE_TABLE[index][0] + SiS_Pr->SiS_DataBusWidth / 64 + RankNo);
for (i=0,Position=0;i<2;i++) {
/* FBAddress[Position]=Position; */
@@ -1522,90 +1660,91 @@ SiS_CheckRank(int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress)
}
int
-SiS_CheckDDRRank(int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress)
+SiS_CheckDDRRank(SiS_Private *SiS_Pr, int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress)
{
ULONG Increment,Position;
USHORT data;
-
+
Increment = 1<<(DRAMTYPE_TABLE[index][2] + DRAMTYPE_TABLE[index][1] +
- DRAMTYPE_TABLE[index][0] + SiS_DataBusWidth / 64 + RankNo);
+ DRAMTYPE_TABLE[index][0] + SiS_Pr->SiS_DataBusWidth / 64 + RankNo);
Increment += Increment/2;
-
+
Position =0;
- *((PULONG)(FBAddress+Position+0))=0x01234567;
- *((PULONG)(FBAddress+Position+1))=0x456789AB;
- *((PULONG)(FBAddress+Position+2))=0x55555555;
- *((PULONG)(FBAddress+Position+3))=0x55555555;
- *((PULONG)(FBAddress+Position+4))=0xAAAAAAAA;
- *((PULONG)(FBAddress+Position+5))=0xAAAAAAAA;
-
- if ( (*(PULONG) (FBAddress + 1))==0x456789AB)
+ *((PULONG)(FBAddress+Position + 0)) = 0x01234567;
+ *((PULONG)(FBAddress+Position + 1)) = 0x456789AB;
+ *((PULONG)(FBAddress+Position + 2)) = 0x55555555;
+ *((PULONG)(FBAddress+Position + 3)) = 0x55555555;
+ *((PULONG)(FBAddress+Position + 4)) = 0xAAAAAAAA;
+ *((PULONG)(FBAddress+Position + 5)) = 0xAAAAAAAA;
+
+ if ( (*(PULONG) (FBAddress + 1)) == 0x456789AB)
return 1;
- if ( (*(PULONG) (FBAddress + 0))==0x01234567)
+ if ( (*(PULONG) (FBAddress + 0)) == 0x01234567)
return 0;
- data=SiS_GetReg1(SiS_P3c4,0x14);
+ data=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14);
data &= 0xF3;
data |= 0x08;
- SiS_SetReg1(SiS_P3c4,0x14,data);
- data=SiS_GetReg1(SiS_P3c4,0x15);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,data);
+ data=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x15);
data += 0x20;
- SiS_SetReg1(SiS_P3c4,0x15,data);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x15,data);
return 1;
}
int
-SiS_CheckRanks(int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress)
+SiS_CheckRanks(SiS_Private *SiS_Pr, int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress)
{
int r;
for (r=RankNo;r>=1;r--) {
- if (!SiS_CheckRank(r,index,DRAMTYPE_TABLE,FBAddress))
+ if (!SiS_CheckRank(SiS_Pr, r, index, DRAMTYPE_TABLE, FBAddress))
return 0;
}
- if (!SiS_CheckBanks(index,DRAMTYPE_TABLE,FBAddress))
+ if (!SiS_CheckBanks(SiS_Pr, index, DRAMTYPE_TABLE, FBAddress))
return 0;
- if (!SiS_CheckColumn(index,DRAMTYPE_TABLE,FBAddress))
+ if (!SiS_CheckColumn(SiS_Pr, index, DRAMTYPE_TABLE, FBAddress))
return 0;
return 1;
}
int
-SiS_CheckDDRRanks(int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress)
+SiS_CheckDDRRanks(SiS_Private *SiS_Pr, int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],
+ ULONG FBAddress)
{
int r;
for (r=RankNo;r>=1;r--) {
- if (!SiS_CheckDDRRank(r,index,DRAMTYPE_TABLE,FBAddress))
+ if (!SiS_CheckDDRRank(SiS_Pr, r,index,DRAMTYPE_TABLE,FBAddress))
return 0;
}
- if (!SiS_CheckBanks(index,DRAMTYPE_TABLE,FBAddress))
+ if (!SiS_CheckBanks(SiS_Pr, index,DRAMTYPE_TABLE,FBAddress))
return 0;
- if (!SiS_CheckColumn(index,DRAMTYPE_TABLE,FBAddress))
+ if (!SiS_CheckColumn(SiS_Pr, index,DRAMTYPE_TABLE,FBAddress))
return 0;
return 1;
}
int
-SiS_SDRSizing(ULONG FBAddress)
+SiS_SDRSizing(SiS_Private *SiS_Pr, ULONG FBAddress)
{
int i;
UCHAR j;
for (i=0;i<13;i++) {
- SiS_SetDRAMSizingType(i, SiS_SDRDRAM_TYPE);
+ SiS_SetDRAMSizingType(SiS_Pr, i, SiS_SDRDRAM_TYPE);
for (j=2;j>0;j--) {
- if (!SiS_SetRank(i,(UCHAR) j, SiS_ChannelAB,SiS_SDRDRAM_TYPE))
+ if (!SiS_SetRank(SiS_Pr, i,(UCHAR) j, SiS_SDRDRAM_TYPE))
continue;
else {
- if (SiS_CheckRanks(j,i,SiS_SDRDRAM_TYPE, FBAddress))
+ if (SiS_CheckRanks(SiS_Pr, j,i,SiS_SDRDRAM_TYPE, FBAddress))
return 1;
}
}
@@ -1614,21 +1753,21 @@ SiS_SDRSizing(ULONG FBAddress)
}
int
-SiS_DDRSizing(ULONG FBAddress)
+SiS_DDRSizing(SiS_Private *SiS_Pr, ULONG FBAddress)
{
int i;
UCHAR j;
- for (i=0;i<4;i++){
- SiS_SetDRAMSizingType(i,SiS_DDRDRAM_TYPE);
- SiS_DisableChannelInterleaving(i,SiS_DDRDRAM_TYPE);
- for (j=2;j>0;j--) {
- SiS_SetDDRChannel(i, j, SiS_ChannelAB, SiS_DDRDRAM_TYPE);
- if (!SiS_SetRank(i,(UCHAR) j, SiS_ChannelAB,SiS_DDRDRAM_TYPE))
+ for (i=0; i<4; i++){
+ SiS_SetDRAMSizingType(SiS_Pr, i, SiS_DDRDRAM_TYPE);
+ SiS_DisableChannelInterleaving(SiS_Pr, i, SiS_DDRDRAM_TYPE);
+ for (j=2; j>0; j--) {
+ SiS_SetDDRChannel(SiS_Pr, i, j, SiS_DDRDRAM_TYPE);
+ if (!SiS_SetRank(SiS_Pr, i, (UCHAR) j, SiS_DDRDRAM_TYPE))
continue;
else {
- if (SiS_CheckDDRRanks(j,i,SiS_DDRDRAM_TYPE, FBAddress))
+ if (SiS_CheckDDRRanks(SiS_Pr, j, i, SiS_DDRDRAM_TYPE, FBAddress))
return 1;
}
}
@@ -1640,31 +1779,31 @@ SiS_DDRSizing(ULONG FBAddress)
check if read cache pointer is correct
*/
void
-SiS_VerifyMclk(ULONG FBAddr)
+SiS_VerifyMclk(SiS_Private *SiS_Pr, ULONG FBAddr)
{
PUCHAR pVideoMemory = (PUCHAR) FBAddr;
- UCHAR i,j;
- USHORT Temp,SR21;
-
- pVideoMemory[0]=0xaa; /* alan */
- pVideoMemory[16]=0x55; /* note: PCI read cache is off */
-
- if ((pVideoMemory[0]!=0xaa)||(pVideoMemory[16]!=0x55)) {
- for (i=0,j=16;i<2;i++,j+=16) {
- SR21 = SiS_GetReg1(SiS_P3c4, 0x21);
- Temp = SR21 & 0xFB; /* disable PCI post write buffer empty gating */
- SiS_SetReg1(SiS_P3c4, 0x21, Temp);
-
- Temp = SiS_GetReg1(SiS_P3c4, 0x3C);
- Temp = Temp | 0x01; /*MCLK reset */
- SiS_SetReg1(SiS_P3c4, 0x3C, Temp);
- Temp = SiS_GetReg1(SiS_P3c4, 0x3C);
- Temp = Temp & 0xFE; /* MCLK normal operation */
- SiS_SetReg1(SiS_P3c4, 0x3C, Temp);
- SiS_SetReg1(SiS_P3c4, 0x21, SR21);
+ UCHAR i, j;
+ USHORT Temp,SR21;
+
+ pVideoMemory[0] = 0xaa; /* alan */
+ pVideoMemory[16] = 0x55; /* note: PCI read cache is off */
+
+ if((pVideoMemory[0] != 0xaa) || (pVideoMemory[16] != 0x55)) {
+ for (i=0,j=16; i<2; i++,j+=16) {
+ SR21 = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x21);
+ Temp = SR21 & 0xFB; /* disable PCI post write buffer empty gating */
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x21,Temp);
+
+ Temp = SiS_GetReg1(SiS_Pr->SiS_P3c4, 0x3C);
+ Temp |= 0x01; /* MCLK reset */
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x3C,Temp);
+ Temp = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x3C);
+ Temp &= 0xFE; /* MCLK normal operation */
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x3C,Temp);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x21,SR21);
pVideoMemory[16+j] = j;
- if (pVideoMemory[16+j]==j) {
+ if(pVideoMemory[16+j] == j) {
pVideoMemory[j] = j;
break;
}
@@ -1674,109 +1813,124 @@ SiS_VerifyMclk(ULONG FBAddr)
/* TW: Is this a 315E? */
int
-Is315E(void)
+Is315E(SiS_Private *SiS_Pr)
{
USHORT data;
- data=SiS_GetReg1(SiS_P3d4,0x5F);
- if (data&0x10) return 1;
+ data = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x5F);
+ if(data & 0x10) return 1;
else return 0;
}
/* TW: For 315 only */
void
-SiS_SetDRAMSize_310(PSIS_HW_DEVICE_INFO HwDeviceExtension)
+SiS_SetDRAMSize_310(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
UCHAR *ROMAddr = HwDeviceExtension->pjVirtualRomBase;
ULONG FBAddr = (ULONG)HwDeviceExtension->pjVideoMemoryAddress;
USHORT data;
#ifdef SIS301 /* TW: SIS301 ??? */
- /*SiS_SetReg1(SiS_P3d4,0x30,0x40); */
+ /*SiS_SetReg1(SiS_Pr->SiS_P3d4,0x30,0x40); */
#endif
#ifdef SIS302 /* TW: SIS302 ??? */
- SiS_SetReg1(SiS_P3d4,0x30,0x4D); /* alan,should change value */
- SiS_SetReg1(SiS_P3d4,0x31,0xc0); /* alan,should change value */
- SiS_SetReg1(SiS_P3d4,0x34,0x3F); /* alan,should change value */
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x30,0x4D); /* alan,should change value */
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x31,0xc0); /* alan,should change value */
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x34,0x3F); /* alan,should change value */
#endif
- SiSSetMode(HwDeviceExtension,0x2e);
+ SiSSetMode(SiS_Pr, HwDeviceExtension, 0x2e);
+
+ data = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x21);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x21,0xDF); /* disable read cache */
- data=SiS_GetReg1(SiS_P3c4,0x21);
- SiS_SetReg1(SiS_P3c4,0x21,(USHORT) (data&0xDF)); /* disable read cache */
+ SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x01,0x20); /* Turn OFF Display */
- data=SiS_GetReg1(SiS_P3c4,0x1);
- data=data|0x20;
- SiS_SetReg1(SiS_P3c4,0x01,data); /* Turn OFF Display */
+ SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x16,0x0F); /* assume lowest speed DRAM */
- data=SiS_GetReg1(SiS_P3c4,0x16);
- SiS_SetReg1(SiS_P3c4,0x16,(USHORT) (data|0x0F)); /* assume lowest speed DRAM */
+ SiS_SetDRAMModeRegister(SiS_Pr, ROMAddr, HwDeviceExtension);
+ SiS_DisableRefresh(SiS_Pr);
+ SiS_CheckBusWidth_310(SiS_Pr, ROMAddr, FBAddr, HwDeviceExtension);
- SiS_SetDRAMModeRegister(ROMAddr,HwDeviceExtension);
- SiS_DisableRefresh();
- SiS_CheckBusWidth_310(ROMAddr,FBAddr,HwDeviceExtension);
+ SiS_VerifyMclk(SiS_Pr, FBAddr);
- SiS_VerifyMclk(FBAddr); /* alan 2000/7/3 */
+ if(HwDeviceExtension->jChipType == SIS_330) temp = 1;
+ else temp = 2;
- if (SiS_Get310DRAMType(ROMAddr, HwDeviceExtension)<2)
- SiS_SDRSizing(FBAddr);
+ if(SiS_Get310DRAMType(SiS_Pr, ROMAddr, HwDeviceExtension) < temp)
+ SiS_SDRSizing(SiS_Pr, FBAddr);
else
- SiS_DDRSizing(FBAddr);
-
- if (Is315E()) {
- data=SiS_GetReg1(SiS_P3c4,0x14);
- if ((data&0x0C)==0x0C) { /* dual channel */
- if ((data&0xF0)>0x40)
- data = (data & 0x0F) | 0x40;
- } else { /* single channel */
- if ((data&0xF0)>0x50)
- data = (data & 0x0F) | 0x50;
+ SiS_DDRSizing(SiS_Pr, FBAddr);
+
+ if(HwDeviceExtension->jChipType != SIS_330) {
+ if(Is315E(SiS_Pr)) {
+ data = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14);
+ if((data & 0x0C) == 0x0C) { /* dual channel */
+ if((data & 0xF0) > 0x40)
+ data = (data & 0x0F) | 0x40;
+ } else { /* single channel */
+ if((data & 0xF0) > 0x50)
+ data = (data & 0x0F) | 0x50;
+ }
}
}
- SiS_SetReg1(SiS_P3c4,0x16,SiS_SR15[1][SiS_RAMType]); /* restore SR16 */
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,SiS_Pr->SiS_SR15[1][SiS_Pr->SiS_RAMType]); /* restore SR16 */
- SiS_EnableRefresh(ROMAddr);
- data=SiS_GetReg1(SiS_P3c4,0x21);
- SiS_SetReg1(SiS_P3c4,0x21,(USHORT) (data|0x20)); /* enable read cache */
+ SiS_EnableRefresh(SiS_Pr, ROMAddr);
+ SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x21,0x20); /* enable read cache */
}
#endif
void
-SiS_SetMemoryClock(UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension)
+SiS_SetMemoryClock(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
- SiS_SetReg1(SiS_P3c4,0x28,SiS_MCLKData_0[SiS_RAMType].SR28);
- SiS_SetReg1(SiS_P3c4,0x29,SiS_MCLKData_0[SiS_RAMType].SR29);
- SiS_SetReg1(SiS_P3c4,0x2A,SiS_MCLKData_0[SiS_RAMType].SR2A);
- SiS_SetReg1(SiS_P3c4,0x2E,SiS_ECLKData[SiS_RAMType].SR2E);
- SiS_SetReg1(SiS_P3c4,0x2F,SiS_ECLKData[SiS_RAMType].SR2F);
- SiS_SetReg1(SiS_P3c4,0x30,SiS_ECLKData[SiS_RAMType].SR30);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x28,SiS_Pr->SiS_MCLKData_0[SiS_Pr->SiS_RAMType].SR28);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x29,SiS_Pr->SiS_MCLKData_0[SiS_Pr->SiS_RAMType].SR29);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2A,SiS_Pr->SiS_MCLKData_0[SiS_Pr->SiS_RAMType].SR2A);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2E,SiS_Pr->SiS_ECLKData[SiS_Pr->SiS_RAMType].SR2E);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2F,SiS_Pr->SiS_ECLKData[SiS_Pr->SiS_RAMType].SR2F);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x30,SiS_Pr->SiS_ECLKData[SiS_Pr->SiS_RAMType].SR30);
#ifdef SIS315H
- if (Is315E()) {
- SiS_SetReg1(SiS_P3c4,0x28,0x3B); /* 143 */
- SiS_SetReg1(SiS_P3c4,0x29,0x22);
- SiS_SetReg1(SiS_P3c4,0x2E,0x3B); /* 143 */
- SiS_SetReg1(SiS_P3c4,0x2F,0x22);
+ if (Is315E(SiS_Pr)) {
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x28,0x3B); /* 143 */
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x29,0x22);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2E,0x3B); /* 143 */
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2F,0x22);
}
#endif
}
-#endif /* ifndef LINUX_XF86 */
+#endif /* ifdef LINUXBIOS */
#ifdef SIS315H
UCHAR
-SiS_Get310DRAMType(UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension)
+SiS_Get310DRAMType(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
- UCHAR data;
+ UCHAR data, temp;
- if (*pSiS_SoftSetting & SoftDRAMType) {
- data = *pSiS_SoftSetting & 0x03;
+ if(*SiS_Pr->pSiS_SoftSetting & SoftDRAMType) {
+ data = *SiS_Pr->pSiS_SoftSetting & 0x03;
} else {
- if(HwDeviceExtension->jChipType > SIS_315PRO) {
- data = SiS_GetReg1(SiS_P3c4,0x13) & 0x07;
- } else { /* TW: 315 */
- data = SiS_GetReg1(SiS_P3c4,0x3a) & 0x03;
+ if((HwDeviceExtension->jChipType > SIS_315PRO) &&
+ (HwDeviceExtension->jChipType < SIS_330)) {
+ data = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13) & 0x07;
+ } else { /* TW: 315, 330 */
+ data = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x3a) & 0x03;
+ if(HwDeviceExtension->jChipType == SIS_330) {
+ if(data > 1) {
+ temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x5f) & 0x30;
+ switch(temp) {
+ case 0x00: data = 1; break;
+ case 0x10: data = 3; break;
+ case 0x20: data = 3; break;
+ case 0x30: data = 2; break;
+ }
+ } else {
+ data = 0;
+ }
+ }
}
}
@@ -1788,31 +1942,31 @@ SiS_Get310DRAMType(UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension)
/* ----------------------------------------- */
-void SiSRegInit(USHORT BaseAddr)
+void SiSRegInit(SiS_Private *SiS_Pr, USHORT BaseAddr)
{
- SiS_P3c4=BaseAddr+0x14;
- SiS_P3d4=BaseAddr+0x24;
- SiS_P3c0=BaseAddr+0x10;
- SiS_P3ce=BaseAddr+0x1e;
- SiS_P3c2=BaseAddr+0x12;
- SiS_P3ca=BaseAddr+0x1a;
- SiS_P3c6=BaseAddr+0x16;
- SiS_P3c7=BaseAddr+0x17;
- SiS_P3c8=BaseAddr+0x18;
- SiS_P3c9=BaseAddr+0x19;
- SiS_P3da=BaseAddr+0x2A;
- SiS_Part1Port=BaseAddr+SIS_CRT2_PORT_04; /* Digital video interface registers (LCD) */
- SiS_Part2Port=BaseAddr+SIS_CRT2_PORT_10; /* 301 TV Encoder registers */
- SiS_Part3Port=BaseAddr+SIS_CRT2_PORT_12; /* 301 Macrovision registers */
- SiS_Part4Port=BaseAddr+SIS_CRT2_PORT_14; /* 301 VGA2 registers */
- SiS_Part5Port=BaseAddr+SIS_CRT2_PORT_14+2; /* 301 palette address port registers */
- SiS_DDC_Port=BaseAddr+0x14; /* 0x3c4; */ /* DDC Port ( = P3C4) */
+ SiS_Pr->SiS_P3c4 = BaseAddr + 0x14;
+ SiS_Pr->SiS_P3d4 = BaseAddr + 0x24;
+ SiS_Pr->SiS_P3c0 = BaseAddr + 0x10;
+ SiS_Pr->SiS_P3ce = BaseAddr + 0x1e;
+ SiS_Pr->SiS_P3c2 = BaseAddr + 0x12;
+ SiS_Pr->SiS_P3ca = BaseAddr + 0x1a;
+ SiS_Pr->SiS_P3c6 = BaseAddr + 0x16;
+ SiS_Pr->SiS_P3c7 = BaseAddr + 0x17;
+ SiS_Pr->SiS_P3c8 = BaseAddr + 0x18;
+ SiS_Pr->SiS_P3c9 = BaseAddr + 0x19;
+ SiS_Pr->SiS_P3da = BaseAddr + 0x2A;
+ SiS_Pr->SiS_Part1Port = BaseAddr + SIS_CRT2_PORT_04; /* Digital video interface registers (LCD) */
+ SiS_Pr->SiS_Part2Port = BaseAddr + SIS_CRT2_PORT_10; /* 301 TV Encoder registers */
+ SiS_Pr->SiS_Part3Port = BaseAddr + SIS_CRT2_PORT_12; /* 301 Macrovision registers */
+ SiS_Pr->SiS_Part4Port = BaseAddr + SIS_CRT2_PORT_14; /* 301 VGA2 (and LCD) registers */
+ SiS_Pr->SiS_Part5Port = BaseAddr + SIS_CRT2_PORT_14+2; /* 301 palette address port registers */
+ SiS_Pr->SiS_DDC_Port = BaseAddr + 0x14; /* DDC Port ( = P3C4, SR11/0A) */
}
void
-SiSInitPCIetc(PSIS_HW_DEVICE_INFO HwDeviceExtension)
+SiSInitPCIetc(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
-#ifdef LINUX_XF86
+/* #ifdef LINUX_XF86 */
if ((HwDeviceExtension->jChipType == SIS_540)||
(HwDeviceExtension->jChipType == SIS_630)||
(HwDeviceExtension->jChipType == SIS_730)||
@@ -1821,214 +1975,309 @@ SiSInitPCIetc(PSIS_HW_DEVICE_INFO HwDeviceExtension)
- PCI IO ENABLE (0x20)
- MMIO ENABLE (0x1)
*/
- SiS_SetReg1(SiS_P3c4,0x20,0xa1);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x20,0xa1);
/* TW: Enable 2D (0x42) & 3D accelerator (0x18) */
- SiS_SetRegANDOR(SiS_P3c4,0x1E,0xFF,0x5A);
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x1E,0xFF,0x5A);
}
if((HwDeviceExtension->jChipType == SIS_315H)||
+ (HwDeviceExtension->jChipType == SIS_315) ||
(HwDeviceExtension->jChipType == SIS_315PRO)||
- (HwDeviceExtension->jChipType == SIS_550)||
- (HwDeviceExtension->jChipType == SIS_640)||
- (HwDeviceExtension->jChipType == SIS_740)||
- (HwDeviceExtension->jChipType == SIS_650)) {
+ (HwDeviceExtension->jChipType == SIS_550) ||
+ (HwDeviceExtension->jChipType == SIS_650) ||
+ (HwDeviceExtension->jChipType == SIS_740) ||
+ (HwDeviceExtension->jChipType == SIS_330)) {
/* TW: This seems to be done the same way on these chipsets */
- SiS_SetReg1(SiS_P3c4,0x20,0xa1);
- SiS_SetRegANDOR(SiS_P3c4,0x1E,0xFF,0x5A);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x20,0xa1);
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x1E,0xFF,0x5A);
}
-#endif
+/* #endif */
}
void
-SiSSetLVDSetc(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo)
+SiSSetLVDSetc(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo)
{
ULONG temp;
- SiS_IF_DEF_LVDS = 0;
- SiS_IF_DEF_TRUMPION = 0;
- SiS_IF_DEF_CH70xx = 0;
- SiS_IF_DEF_HiVision = 0;
- SiS_IF_DEF_DSTN = 0;
- SiS_IF_DEF_FSTN = 0;
+ SiS_Pr->SiS_IF_DEF_LVDS = 0;
+ SiS_Pr->SiS_IF_DEF_TRUMPION = 0;
+ SiS_Pr->SiS_IF_DEF_CH70xx = 0;
+ SiS_Pr->SiS_IF_DEF_HiVision = 0;
+ SiS_Pr->SiS_IF_DEF_DSTN = 0;
+ SiS_Pr->SiS_IF_DEF_FSTN = 0;
- SiS_ChrontelInit = 0;
+ SiS_Pr->SiS_ChrontelInit = 0;
if((ModeNo == 0x5a) || (ModeNo == 0x5b)) {
- SiS_IF_DEF_DSTN = 1; /* for 550 dstn */
- SiS_IF_DEF_FSTN = 1; /* for fstn */
+ SiS_Pr->SiS_IF_DEF_DSTN = 1; /* for 550 dstn */
+ SiS_Pr->SiS_IF_DEF_FSTN = 1; /* for fstn */
}
#ifdef SIS300
- if((HwDeviceExtension->jChipType == SIS_540)||
- (HwDeviceExtension->jChipType == SIS_630)||
+ if((HwDeviceExtension->jChipType == SIS_540) ||
+ (HwDeviceExtension->jChipType == SIS_630) ||
(HwDeviceExtension->jChipType == SIS_730))
{
- temp=SiS_GetReg1(SiS_P3d4,0x37);
+ /* TW: Check for SiS30x first */
+ temp = SiS_GetReg1(SiS_Pr->SiS_Part4Port,0x00);
+ if((temp == 1) || (temp == 2)) return;
+ temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x37);
temp = (temp & 0x0E) >> 1;
- if((temp >= 2) && (temp <= 5)) SiS_IF_DEF_LVDS = 1;
- if(temp == 3) SiS_IF_DEF_TRUMPION = 1;
+ if((temp >= 2) && (temp <= 5)) SiS_Pr->SiS_IF_DEF_LVDS = 1;
+ if(temp == 3) SiS_Pr->SiS_IF_DEF_TRUMPION = 1;
if((temp == 4) || (temp == 5)) {
- /* TW: Save power status (and error check) */
- SiS_Backup70xx = SiS_GetCH700x(0x0e);
- if (SiS_Backup70xx != 0xFFFF)
- SiS_IF_DEF_CH70xx = 1;
+ /* TW: Save power status (and error check) - UNUSED */
+ SiS_Pr->SiS_Backup70xx = SiS_GetCH700x(SiS_Pr, 0x0e);
+ SiS_Pr->SiS_IF_DEF_CH70xx = 1;
}
}
#endif
#ifdef SIS315H
- if((HwDeviceExtension->jChipType == SIS_550)||
- (HwDeviceExtension->jChipType == SIS_640)||
- (HwDeviceExtension->jChipType == SIS_740)||
- (HwDeviceExtension->jChipType == SIS_650))
+ if((HwDeviceExtension->jChipType == SIS_550) ||
+ (HwDeviceExtension->jChipType == SIS_650) ||
+ (HwDeviceExtension->jChipType == SIS_740) ||
+ (HwDeviceExtension->jChipType == SIS_330))
{
- /* TW: CR37 is different on 310 series */
- if (SiS_IF_DEF_FSTN) /* fstn: set CR37=0x04 */
- SiS_SetReg1(SiS_P3d4,0x37,0x04); /* (fake LVDS bridge) */
+ /* TW: CR37 is different on 310/325 series */
+ if(SiS_Pr->SiS_IF_DEF_FSTN) /* fstn: set CR37=0x04 */
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x37,0x04); /* (fake LVDS bridge) */
- temp=SiS_GetReg1(SiS_P3d4,0x37);
+ temp=SiS_GetReg1(SiS_Pr->SiS_P3d4,0x37);
temp = (temp & 0x0E) >> 1;
- if((temp >= 2) && (temp <= 3)) SiS_IF_DEF_LVDS = 1;
+ if((temp >= 2) && (temp <= 3)) SiS_Pr->SiS_IF_DEF_LVDS = 1;
if(temp == 3) {
-#if 0 /* Don't know how to do this on Chrontel 7019 */
- /* TW: Save power status (and error check) */
- SiS_Backup70xx = SiS_GetCH700x(0x0e);
- if (SiS_Backup70xx != 0xFFFF)
-#endif
- SiS_IF_DEF_CH70xx = 2;
+ SiS_Pr->SiS_IF_DEF_CH70xx = 2;
}
- SiS_IF_DEF_HiVision = 1;
+
+ /* HiVision (HDTV) is done differently now. */
+ /* SiS_Pr->SiS_IF_DEF_HiVision = 1; */
}
#endif
}
void
-SiSInitPtr(PSIS_HW_DEVICE_INFO HwDeviceExtension)
+SiSInitPtr(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
#ifdef SIS315H
- if((HwDeviceExtension->jChipType == SIS_315H)||
- (HwDeviceExtension->jChipType == SIS_315PRO)||
- (HwDeviceExtension->jChipType == SIS_550)||
- (HwDeviceExtension->jChipType == SIS_640)||
- (HwDeviceExtension->jChipType == SIS_740)||
- (HwDeviceExtension->jChipType == SIS_650))
- InitTo310Pointer(HwDeviceExtension);
+ if((HwDeviceExtension->jChipType == SIS_315H) ||
+ (HwDeviceExtension->jChipType == SIS_315) ||
+ (HwDeviceExtension->jChipType == SIS_315PRO) ||
+ (HwDeviceExtension->jChipType == SIS_550) ||
+ (HwDeviceExtension->jChipType == SIS_650) ||
+ (HwDeviceExtension->jChipType == SIS_740) ||
+ (HwDeviceExtension->jChipType == SIS_330))
+ InitTo310Pointer(SiS_Pr, HwDeviceExtension);
#endif
#ifdef SIS300
- if ((HwDeviceExtension->jChipType == SIS_540)||
- (HwDeviceExtension->jChipType == SIS_630)||
- (HwDeviceExtension->jChipType == SIS_730)||
+ if ((HwDeviceExtension->jChipType == SIS_540) ||
+ (HwDeviceExtension->jChipType == SIS_630) ||
+ (HwDeviceExtension->jChipType == SIS_730) ||
(HwDeviceExtension->jChipType == SIS_300))
- InitTo300Pointer(HwDeviceExtension);
+ InitTo300Pointer(SiS_Pr, HwDeviceExtension);
#endif
}
+void
+SiSDetermineROMUsage(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, UCHAR *ROMAddr)
+{
+ if((ROMAddr) && (HwDeviceExtension->UseROM)) {
+ if((ROMAddr[0x00] != 0x55) || (ROMAddr[0x01] != 0xAA)) {
+ SiS_Pr->SiS_UseROM = FALSE;
+ } else if(HwDeviceExtension->jChipType == SIS_300) {
+ /* TW: 300: We check if the code starts below 0x220 by
+ * checking the jmp instruction at the beginning
+ * of the BIOS image.
+ */
+ if((ROMAddr[3] == 0xe9) &&
+ ((ROMAddr[5] << 8) | ROMAddr[4]) > 0x21a)
+ SiS_Pr->SiS_UseROM = TRUE;
+ else SiS_Pr->SiS_UseROM = FALSE;
+ } else if(HwDeviceExtension->jChipType < SIS_315H) {
+ /* TW: Rest of 300 series: We don't use the ROM image if
+ * the BIOS version < 2.0.0 as such old BIOSes don't
+ * have the needed data at the expected locations.
+ */
+ if(ROMAddr[0x06] < '2') SiS_Pr->SiS_UseROM = FALSE;
+ else SiS_Pr->SiS_UseROM = TRUE;
+ } else {
+ /* TW: 310/325/330 series stick to the standard */
+ SiS_Pr->SiS_UseROM = TRUE;
+ }
+ } else SiS_Pr->SiS_UseROM = FALSE;
+
+}
+
/*
=========================================
- ======== SiS SetMode Function ==========
+ ======== SiS SetMode Functions ==========
=========================================
*/
#ifdef LINUX_XF86
/* TW: This is used for non-Dual-Head mode from X */
BOOLEAN
-SiSBIOSSetMode(PSIS_HW_DEVICE_INFO HwDeviceExtension, ScrnInfoPtr pScrn,
- DisplayModePtr mode)
+SiSBIOSSetMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, ScrnInfoPtr pScrn,
+ DisplayModePtr mode, BOOLEAN IsCustom)
{
+ SISPtr pSiS = SISPTR(pScrn);
UShort ModeNo=0;
+
+ SiS_Pr->UseCustomMode = FALSE;
+ if((IsCustom) && (SiS_CheckBuildCustomMode(pScrn, mode, pSiS->VBFlags))) {
+
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "Setting custom mode %dx%d\n",
+ SiS_Pr->CHDisplay, SiS_Pr->CVDisplay);
+
+ return(SiSSetMode(SiS_Pr, HwDeviceExtension, pScrn, ModeNo, TRUE));
+
+ }
+
ModeNo = SiS_CalcModeIndex(pScrn, mode);
- if (!ModeNo) return FALSE;
+ if(!ModeNo) return FALSE;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Setting mode 0x%x\n", ModeNo);
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "Setting mode 0x%x\n", ModeNo);
- return(SiSSetMode(HwDeviceExtension, pScrn, ModeNo));
+ return(SiSSetMode(SiS_Pr, HwDeviceExtension, pScrn, ModeNo, TRUE));
}
#ifdef SISDUALHEAD
/* TW: Set CRT1 mode (used for dual head) */
BOOLEAN
-SiSBIOSSetModeCRT1(PSIS_HW_DEVICE_INFO HwDeviceExtension, ScrnInfoPtr pScrn,
- DisplayModePtr mode)
+SiSBIOSSetModeCRT1(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, ScrnInfoPtr pScrn,
+ DisplayModePtr mode, BOOLEAN IsCustom)
{
ULONG temp;
USHORT ModeIdIndex;
-#ifndef LINUX_XF86
- USHORT KeepLockReg;
-#endif
UCHAR *ROMAddr = HwDeviceExtension->pjVirtualRomBase;
USHORT BaseAddr = (USHORT)HwDeviceExtension->ulIOAddress;
SISPtr pSiS = SISPTR(pScrn);
SISEntPtr pSiSEnt = pSiS->entityPrivate;
+ unsigned char backupreg=0;
+ BOOLEAN backupcustom;
UShort ModeNo=0;
+
+ SiS_Pr->UseCustomMode = FALSE;
+
+ if((IsCustom) && (SiS_CheckBuildCustomMode(pScrn, mode, pSiS->VBFlags))) {
+
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ "Setting custom mode %dx%d in CRT1\n",
+ SiS_Pr->CHDisplay, SiS_Pr->CVDisplay);
+ ModeNo = 0xfe;
+
+ } else {
- ModeNo = SiS_CalcModeIndex(pScrn, mode);
- if (!ModeNo) return FALSE;
+ ModeNo = SiS_CalcModeIndex(pScrn, mode);
+ if(!ModeNo) return FALSE;
+
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ "Setting mode 0x%x on CRT1\n", ModeNo);
+ }
+
+ SiSInitPtr(SiS_Pr, HwDeviceExtension);
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Setting mode 0x%x on CRT1\n", ModeNo);
+ SiSRegInit(SiS_Pr, BaseAddr);
- SiSInitPtr(HwDeviceExtension);
+ SiS_Pr->SiS_VGAINFO = SiS_GetSetBIOSScratch(pScrn, 0x489, 0xff);
- SiSRegInit(BaseAddr);
+ SiSInitPCIetc(SiS_Pr, HwDeviceExtension);
- SiSInitPCIetc(HwDeviceExtension);
+ SiSSetLVDSetc(SiS_Pr, HwDeviceExtension, ModeNo);
- SiSSetLVDSetc(HwDeviceExtension, ModeNo);
+ SiSDetermineROMUsage(SiS_Pr, HwDeviceExtension, ROMAddr);
/* TW: We don't clear the buffer under X */
- flag_clearbuffer=0;
+ SiS_Pr->SiS_flag_clearbuffer = 0;
- SiS_SetReg1(SiS_P3c4,0x05,0x86); /* 1.Openkey */
+ /* 1.Openkey */
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x05,0x86);
- SiS_UnLockCRT2(HwDeviceExtension, BaseAddr);
+ SiS_UnLockCRT2(SiS_Pr, HwDeviceExtension, BaseAddr);
- temp = SiS_SearchModeID(ROMAddr,&ModeNo,&ModeIdIndex); /* 2.Get ModeID Table */
- if(temp==0) return(0);
+ if(!SiS_Pr->UseCustomMode) {
+ /* 2.Get ModeID Table */
+ temp = SiS_SearchModeID(SiS_Pr, ROMAddr,&ModeNo,&ModeIdIndex);
+ if(temp == 0) return(0);
+ } else {
+ ModeIdIndex = 0;
+ }
/* TW: Determine VBType (301,301B,301LV,302B,302LV) */
- SiS_GetVBType(BaseAddr,HwDeviceExtension);
+ SiS_GetVBType(SiS_Pr, BaseAddr,HwDeviceExtension);
+
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ backupreg = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38);
+ } else {
+ backupreg = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x35);
+ }
+ }
/* TW: Get VB information (connectors, connected devices) */
- SiS_GetVBInfo301(BaseAddr,ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension);
- SiS_SetHiVision(BaseAddr,HwDeviceExtension);
- SiS_GetLCDResInfo301(ROMAddr,SiS_P3d4,ModeNo,ModeIdIndex,HwDeviceExtension);
+ /* (We don't care if the current mode is a CRT2 mode) */
+ SiS_GetVBInfo(SiS_Pr, BaseAddr,ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension,0);
+ SiS_SetHiVision(SiS_Pr, BaseAddr,HwDeviceExtension);
+ SiS_GetLCDResInfo(SiS_Pr, ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension);
+
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
+ if(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x17) & 0x08) {
+ if(ModeNo != 0x10) SiS_Pr->SiS_SetFlag |= SetDOSMode;
+ }
+ }
- /* TW: I am not sure the flag's name is correct */
- if((SiS_IF_DEF_LVDS == 1) && (HwDeviceExtension->jChipType >= SIS_315H)) {
- if(SiS_GetReg1(SiS_P3c4,0x17) & 0x08) SiS_SetFlag |= CRT2IsVGA;
+ /* TW: New from 650/LV 1.10.6x */
+ if(IS_SIS650) {
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x51,0x1f);
+ SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x56,0xe7);
+ }
+ }
}
/* TW: Set mode on CRT1 */
- SiS_SetCRT1Group(ROMAddr,HwDeviceExtension,ModeNo,ModeIdIndex,BaseAddr);
+ SiS_SetCRT1Group(SiS_Pr, ROMAddr,HwDeviceExtension,ModeNo,ModeIdIndex,BaseAddr);
pSiSEnt->CRT1ModeNo = ModeNo;
pSiSEnt->CRT1DMode = mode;
/* TW: SetPitch: Adapt to virtual size & position */
- SiS_SetPitchCRT1(pScrn, BaseAddr);
+ SiS_SetPitchCRT1(SiS_Pr, pScrn, BaseAddr);
/* We have to reset CRT2 if changing mode on CRT1 */
- if (pSiSEnt->CRT2ModeNo != -1) {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "(Re-)Setting mode 0x%x on CRT2\n",
+ if(pSiSEnt->CRT2ModeNo != -1) {
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ "(Re-)Setting mode 0x%x on CRT2\n",
pSiSEnt->CRT2ModeNo);
- SiSBIOSSetModeCRT2(HwDeviceExtension, pSiSEnt->pScrn_1,
+ backupcustom = SiS_Pr->UseCustomMode;
+ if(SiS_Pr->UseCustomMode) {
+ SiS_Pr->CRT1UsesCustomMode = TRUE;
+ } else {
+ SiS_Pr->CRT1UsesCustomMode = FALSE;
+ }
+ SiSBIOSSetModeCRT2(SiS_Pr, HwDeviceExtension, pSiSEnt->pScrn_1,
pSiSEnt->CRT2DMode);
+ SiS_Pr->UseCustomMode = backupcustom;
+ SiS_Pr->CRT1UsesCustomMode = FALSE;
}
-
- if((HwDeviceExtension->jChipType >= SIS_315H) && (SiS_IF_DEF_LVDS == 0)) {
- SiS_SetRegAND(SiS_P3d4,0x63,0xbf);
- temp = SiS_GetReg1(SiS_P3c4,0x15);
- if(!(temp & 0x01)) {
- if(!(temp & 0xa0)) {
- if(SiS_GetReg1(SiS_P3c4,0x16) & 0x01) {
- SiS_SetRegOR(SiS_P3d4,0x64,0x40);
- }
- } else {
- SiS_SetRegOR(SiS_P3d4,0x64,0x40);
- }
+
+ SiS_HandleCRT1(SiS_Pr);
+
+ SiS_DisplayOn(SiS_Pr);
+ SiS_SetReg3(SiS_Pr->SiS_P3c6,0xFF);
+
+ /* TW: New from 650/LV 1.10.6x and 1.10.7w, 630/301B 2.06.50 */
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x38,backupreg);
+ } else if((HwDeviceExtension->jChipType == SIS_630) ||
+ (HwDeviceExtension->jChipType == SIS_730)) {
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x35,backupreg);
}
}
- /* Backup/Set ModeNo in MMIO */
+ /* Backup/Set ModeNo in BIOS scratch area */
SiS_GetSetModeID(pScrn,ModeNo);
return TRUE;
@@ -2036,67 +2285,95 @@ SiSBIOSSetModeCRT1(PSIS_HW_DEVICE_INFO HwDeviceExtension, ScrnInfoPtr pScrn,
/* TW: Set CRT2 mode (used for dual head) */
BOOLEAN
-SiSBIOSSetModeCRT2(PSIS_HW_DEVICE_INFO HwDeviceExtension, ScrnInfoPtr pScrn,
+SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, ScrnInfoPtr pScrn,
DisplayModePtr mode)
{
ULONG temp;
USHORT ModeIdIndex;
-#ifndef LINUX_XF86
- USHORT KeepLockReg;
-#endif
UCHAR *ROMAddr = HwDeviceExtension->pjVirtualRomBase;
USHORT BaseAddr = (USHORT)HwDeviceExtension->ulIOAddress;
- UShort ModeNo=0;
- SISPtr pSiS = SISPTR(pScrn);
+ UShort ModeNo = 0;
+ SISPtr pSiS = SISPTR(pScrn);
SISEntPtr pSiSEnt = pSiS->entityPrivate;
-
+ unsigned char tempr1, tempr2, backupreg=0;
+
+ SiS_Pr->UseCustomMode = FALSE;
+
ModeNo = SiS_CalcModeIndex(pScrn, mode);
- if (!ModeNo) return FALSE;
+ if(!ModeNo) return FALSE;
+
+ SiSInitPtr(SiS_Pr, HwDeviceExtension);
- SiSInitPtr(HwDeviceExtension);
+ SiSRegInit(SiS_Pr, BaseAddr);
- SiSRegInit(BaseAddr);
+ SiS_Pr->SiS_VGAINFO = SiS_GetSetBIOSScratch(pScrn, 0x489, 0xff);
- SiSInitPCIetc(HwDeviceExtension);
+ SiSInitPCIetc(SiS_Pr, HwDeviceExtension);
- SiSSetLVDSetc(HwDeviceExtension, ModeNo);
+ SiSSetLVDSetc(SiS_Pr, HwDeviceExtension, ModeNo);
+
+ SiSDetermineROMUsage(SiS_Pr, HwDeviceExtension, ROMAddr);
/* TW: We don't clear the buffer under X */
- flag_clearbuffer=0;
+ SiS_Pr->SiS_flag_clearbuffer=0;
/* TW: Save ModeNo so we can set it from within SetMode for CRT1 */
pSiSEnt->CRT2ModeNo = ModeNo;
pSiSEnt->CRT2DMode = mode;
/* TW: We can't set CRT2 mode before CRT1 mode is set */
- if (pSiSEnt->CRT1ModeNo == -1) {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ if(pSiSEnt->CRT1ModeNo == -1) {
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
"Setting CRT2 mode delayed until after setting CRT1 mode\n");
return TRUE;
}
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Setting mode 0x%x on CRT2\n", ModeNo);
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ "Setting mode 0x%x on CRT2\n", ModeNo);
/* 1.Openkey */
- SiS_SetReg1(SiS_P3c4,0x05,0x86);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x05,0x86);
- SiS_UnLockCRT2(HwDeviceExtension, BaseAddr);
+ SiS_UnLockCRT2(SiS_Pr, HwDeviceExtension, BaseAddr);
/* 2.Get ModeID */
- temp = SiS_SearchModeID(ROMAddr,&ModeNo,&ModeIdIndex);
- if(temp==0) return(0);
+ temp = SiS_SearchModeID(SiS_Pr, ROMAddr,&ModeNo,&ModeIdIndex);
+ if(temp == 0) return(0);
/* TW: Determine VBType (301,301B,301LV,302B,302LV) */
- SiS_GetVBType(BaseAddr,HwDeviceExtension);
+ SiS_GetVBType(SiS_Pr, BaseAddr,HwDeviceExtension);
+
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ SiS_UnLockCRT2(SiS_Pr,HwDeviceExtension,BaseAddr);
+ if(HwDeviceExtension->jChipType < SIS_330) {
+ if(ROMAddr && SiS_Pr->SiS_UseROM) {
+ temp = ROMAddr[VB310Data_1_2_Offset];
+ temp |= 0x40;
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x02,temp);
+ }
+ }
+ SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x32,0x10);
+
+ SiS_SetRegOR(SiS_Pr->SiS_Part2Port,0x02,0x0c);
+
+ backupreg = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38);
+ } else {
+ backupreg = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x35);
+ }
+ }
/* TW: Get VB information (connectors, connected devices) */
- SiS_GetVBInfo301(BaseAddr,ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension);
- SiS_SetHiVision(BaseAddr,HwDeviceExtension);
- SiS_GetLCDResInfo301(ROMAddr,SiS_P3d4,ModeNo,ModeIdIndex,HwDeviceExtension);
+ SiS_GetVBInfo(SiS_Pr, BaseAddr,ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension,1);
+ SiS_SetHiVision(SiS_Pr, BaseAddr,HwDeviceExtension);
+ SiS_GetLCDResInfo(SiS_Pr, ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension);
- /* TW: I am not sure the flag's name is correct */
- if((SiS_IF_DEF_LVDS == 1) && (HwDeviceExtension->jChipType >= SIS_315H)) {
- if(SiS_GetReg1(SiS_P3c4,0x17) & 0x08) SiS_SetFlag |= CRT2IsVGA;
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
+ if(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x17) & 0x08) {
+ if(ModeNo != 0x10) SiS_Pr->SiS_SetFlag |= SetDOSMode;
+ }
+ }
}
/* Set mode on CRT2 */
@@ -2107,35 +2384,56 @@ SiSBIOSSetModeCRT2(PSIS_HW_DEVICE_INFO HwDeviceExtension, ScrnInfoPtr pScrn,
case VB_CHIP_302:
case VB_CHIP_302B:
case VB_CHIP_302LV:
- SiS_SetCRT2Group301(BaseAddr,ROMAddr,ModeNo,HwDeviceExtension);
- break;
- case VB_CHIP_303:
+ SiS_SetCRT2Group301(SiS_Pr, BaseAddr,ROMAddr,ModeNo,HwDeviceExtension);
break;
case VB_CHIP_UNKNOWN:
- if (SiS_IF_DEF_LVDS == 1 || SiS_IF_DEF_CH70xx == 1 || SiS_IF_DEF_TRUMPION != 0)
- SiS_SetCRT2Group301(BaseAddr,ROMAddr,ModeNo,HwDeviceExtension);
+ if (SiS_Pr->SiS_IF_DEF_LVDS == 1 ||
+ SiS_Pr->SiS_IF_DEF_CH70xx != 0 ||
+ SiS_Pr->SiS_IF_DEF_TRUMPION != 0) {
+ SiS_SetCRT2Group301(SiS_Pr,BaseAddr,ROMAddr,ModeNo,HwDeviceExtension);
+ }
break;
}
- if((HwDeviceExtension->jChipType >= SIS_315H) && (SiS_IF_DEF_LVDS == 0)) {
- SiS_SetRegAND(SiS_P3d4,0x63,0xbf);
- temp = SiS_GetReg1(SiS_P3c4,0x15);
- if(!(temp & 0x01)) {
- if(!(temp & 0xa0)) {
- if(SiS_GetReg1(SiS_P3c4,0x16) & 0x01) {
- SiS_SetRegOR(SiS_P3d4,0x64,0x40);
- }
- } else {
- SiS_SetRegOR(SiS_P3d4,0x64,0x40);
- }
+ SiS_DisplayOn(SiS_Pr);
+ SiS_SetReg3(SiS_Pr->SiS_P3c6,0xFF);
+
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
+ if(!(SiS_IsDualEdge(SiS_Pr, HwDeviceExtension, BaseAddr))) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x13,0xfb);
+ }
}
}
- /* TW: SetPitch: Adapt to virtual size & position */
- SiS_SetPitchCRT2(pScrn, BaseAddr);
+ /* TW: New from 650/LV 1.10.6x and 1.10.7w, 630 2.06.50 */
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ if(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) {
+ SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x35,0x01);
+ } else {
+ SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x35,0xFE);
+ }
+
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x38,backupreg);
+
+ tempr1 = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30);
+ tempr2 = SiS_GetReg1(SiS_Pr->SiS_Part2Port,0x00);
+ if(tempr1 & SetCRT2ToAVIDEO) tempr2 &= 0xF7;
+ if(tempr1 & SetCRT2ToSVIDEO) tempr2 &= 0xFB;
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x00,tempr2);
+
+ if(tempr1 & SetCRT2ToLCD) {
+ SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x38,0xfc);
+ }
+ } else if((HwDeviceExtension->jChipType == SIS_630) ||
+ (HwDeviceExtension->jChipType == SIS_730)) {
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x35,backupreg);
+ }
+ }
- /* Backup/Set ModeNo in MMIO - don't do this for CRT2 */
- /* SiS_GetSetModeID(pScrn,ModeNo); */
+ /* TW: SetPitch: Adapt to virtual size & position */
+ SiS_SetPitchCRT2(SiS_Pr, pScrn, BaseAddr);
return TRUE;
}
@@ -2145,75 +2443,144 @@ SiSBIOSSetModeCRT2(PSIS_HW_DEVICE_INFO HwDeviceExtension, ScrnInfoPtr pScrn,
#ifdef LINUX_XF86
/* TW: We need pScrn for setting the pitch correctly */
BOOLEAN
-SiSSetMode(PSIS_HW_DEVICE_INFO HwDeviceExtension,ScrnInfoPtr pScrn,USHORT ModeNo)
+SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,ScrnInfoPtr pScrn,USHORT ModeNo, BOOLEAN dosetpitch)
#else
BOOLEAN
-SiSSetMode(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo)
+SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo)
#endif
{
ULONG temp;
USHORT ModeIdIndex,KeepLockReg;
UCHAR *ROMAddr = HwDeviceExtension->pjVirtualRomBase;
USHORT BaseAddr = (USHORT)HwDeviceExtension->ulIOAddress;
+ unsigned char backupreg=0, tempr1, tempr2;
- SiSInitPtr(HwDeviceExtension);
+#ifndef LINUX_XF86
+ SiS_Pr->UseCustomMode = FALSE;
+ SiS_Pr->CRT1UsesCustomMode = FALSE;
+#endif
+
+ if(SiS_Pr->UseCustomMode) {
+ ModeNo = 0xfe;
+ }
+
+ SiSInitPtr(SiS_Pr, HwDeviceExtension);
+
+ SiSRegInit(SiS_Pr, BaseAddr);
+
+#ifdef LINUX_XF86
+ if(pScrn) SiS_Pr->SiS_VGAINFO = SiS_GetSetBIOSScratch(pScrn, 0x489, 0xff);
+ else
+#endif
+ SiS_Pr->SiS_VGAINFO = 0x11;
- SiSRegInit(BaseAddr);
+#ifdef LINUX_XF86
+#ifdef TWDEBUG
+ xf86DrvMsg(0, X_INFO, "VGAInfo 0x%02x\n", SiS_Pr->SiS_VGAINFO);
+#endif
+#endif
+
+ SiSInitPCIetc(SiS_Pr, HwDeviceExtension);
- SiSInitPCIetc(HwDeviceExtension);
+ SiSSetLVDSetc(SiS_Pr, HwDeviceExtension, ModeNo);
- SiSSetLVDSetc(HwDeviceExtension, ModeNo);
+ SiSDetermineROMUsage(SiS_Pr, HwDeviceExtension, ROMAddr);
+
+ if(!SiS_Pr->UseCustomMode) {
+ /* TW: Shift the clear-buffer-bit away */
+ ModeNo = ((ModeNo & 0x80) << 8) | (ModeNo & 0x7f);
+ }
#ifdef LINUX_XF86
- /* TW: We don't clear the buffer in X */
+ /* TW: We never clear the buffer in X */
ModeNo |= 0x8000;
#endif
if(ModeNo & 0x8000) {
- ModeNo &= 0x007F;
- flag_clearbuffer=0;
+ ModeNo &= 0x7fff;
+ SiS_Pr->SiS_flag_clearbuffer = 0;
} else {
- flag_clearbuffer=1;
+ SiS_Pr->SiS_flag_clearbuffer = 1;
}
/* 1.Openkey */
- KeepLockReg = SiS_GetReg1(SiS_P3c4,0x05);
- SiS_SetReg1(SiS_P3c4,0x05,0x86);
-
- SiS_UnLockCRT2(HwDeviceExtension, BaseAddr);
+ KeepLockReg = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x05);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x05,0x86);
- /* 2.Get ModeID Table */
- temp = SiS_SearchModeID(ROMAddr,&ModeNo,&ModeIdIndex);
- if(temp==0) return(0);
+ SiS_UnLockCRT2(SiS_Pr, HwDeviceExtension, BaseAddr);
+ if(!SiS_Pr->UseCustomMode) {
+
+ /* 2.Get ModeID Table */
+ temp = SiS_SearchModeID(SiS_Pr,ROMAddr,&ModeNo,&ModeIdIndex);
+ if(temp == 0) return(0);
+
+ } else {
+
+ ModeIdIndex = 0;
+
+ }
+
/* TW: Determine VBType (301,301B,301LV,302B,302LV) */
- SiS_GetVBType(BaseAddr,HwDeviceExtension);
+ SiS_GetVBType(SiS_Pr,BaseAddr,HwDeviceExtension);
+
+ /* TW: Init/restore some VB registers */
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ SiS_UnLockCRT2(SiS_Pr,HwDeviceExtension,BaseAddr);
+ if(HwDeviceExtension->jChipType < SIS_330) {
+ if(ROMAddr && SiS_Pr->SiS_UseROM) {
+ temp = ROMAddr[VB310Data_1_2_Offset];
+ temp |= 0x40;
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x02,temp);
+ }
+ }
+ SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x32,0x10);
- /* TW: Get VB information (connectors, connected devices) */
- SiS_GetVBInfo301(BaseAddr,ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension);
- SiS_SetHiVision(BaseAddr,HwDeviceExtension);
- SiS_GetLCDResInfo301(ROMAddr,SiS_P3d4,ModeNo,ModeIdIndex,HwDeviceExtension);
+ SiS_SetRegOR(SiS_Pr->SiS_Part2Port,0x02,0x0c);
- /* TW: I am not sure the flag's name is correct */
- if((SiS_IF_DEF_LVDS == 1) && (HwDeviceExtension->jChipType >= SIS_315H)) {
- if(SiS_GetReg1(SiS_P3c4,0x17) & 0x08) SiS_SetFlag |= CRT2IsVGA;
+ backupreg = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38);
+ } else {
+ backupreg = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x35);
+ }
}
+
+ /* TW: Get VB information (connectors, connected devices) */
+ SiS_GetVBInfo(SiS_Pr,BaseAddr,ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension,1);
+ SiS_SetHiVision(SiS_Pr,BaseAddr,HwDeviceExtension);
+ SiS_GetLCDResInfo(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension);
- /* 3.Check memory size */
- temp = SiS_CheckMemorySize(ROMAddr,HwDeviceExtension,ModeNo,ModeIdIndex);
+ /* 3. Check memory size */
+ temp = SiS_CheckMemorySize(SiS_Pr,ROMAddr,HwDeviceExtension,ModeNo,ModeIdIndex);
if(!temp) return(0);
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
+ if(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x17) & 0x08) {
+ if(ModeNo != 0x10) SiS_Pr->SiS_SetFlag |= SetDOSMode;
+ }
+ }
+
+ /* TW: New from 650/LV 1.10.6x; not in any BIOS for other chipsets */
+ if(IS_SIS650) {
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x51,0x1f);
+ SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x56,0xe7);
+ }
+ }
+ }
+
/* TW: Set mode on CRT1 */
- if(SiS_VBInfo & (SetSimuScanMode | SetCRT2ToLCDA)) {
- SiS_SetCRT1Group(ROMAddr,HwDeviceExtension,ModeNo,ModeIdIndex,BaseAddr);
+ if(SiS_Pr->SiS_VBInfo & (SetSimuScanMode | SetCRT2ToLCDA)) {
+ SiS_SetCRT1Group(SiS_Pr,ROMAddr,HwDeviceExtension,ModeNo,ModeIdIndex,BaseAddr);
} else {
- if(!(SiS_VBInfo & SwitchToCRT2)) {
- SiS_SetCRT1Group(ROMAddr,HwDeviceExtension,ModeNo,ModeIdIndex,BaseAddr);
+ if(!(SiS_Pr->SiS_VBInfo & SwitchToCRT2)) {
+ SiS_SetCRT1Group(SiS_Pr,ROMAddr,HwDeviceExtension,ModeNo,ModeIdIndex,BaseAddr);
}
}
/* TW: Set mode on CRT2 */
- if(SiS_VBInfo & (SetSimuScanMode | SwitchToCRT2 | SetCRT2ToLCDA)) {
+ if(SiS_Pr->SiS_VBInfo & (SetSimuScanMode | SwitchToCRT2 | SetCRT2ToLCDA)) {
switch (HwDeviceExtension->ujVBChipID) {
case VB_CHIP_301:
case VB_CHIP_301B:
@@ -2221,176 +2588,224 @@ SiSSetMode(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo)
case VB_CHIP_302:
case VB_CHIP_302B:
case VB_CHIP_302LV:
- SiS_SetCRT2Group301(BaseAddr,ROMAddr,ModeNo,HwDeviceExtension);
- break;
- case VB_CHIP_303:
+ SiS_SetCRT2Group301(SiS_Pr,BaseAddr,ROMAddr,ModeNo,HwDeviceExtension);
break;
case VB_CHIP_UNKNOWN:
- if (SiS_IF_DEF_LVDS == 1 || SiS_IF_DEF_CH70xx != 0 || SiS_IF_DEF_TRUMPION != 0)
- SiS_SetCRT2Group301(BaseAddr,ROMAddr,ModeNo,HwDeviceExtension);
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1 ||
+ SiS_Pr->SiS_IF_DEF_CH70xx != 0 ||
+ SiS_Pr->SiS_IF_DEF_TRUMPION != 0)
+ SiS_SetCRT2Group301(SiS_Pr,BaseAddr,ROMAddr,ModeNo,HwDeviceExtension);
break;
}
}
+
+ SiS_HandleCRT1(SiS_Pr);
+
+ SiS_DisplayOn(SiS_Pr);
+ SiS_SetReg3(SiS_Pr->SiS_P3c6,0xFF);
- /* TW: Inserted from 650/301LV BIOS */
- if((HwDeviceExtension->jChipType >= SIS_315H) && (SiS_IF_DEF_LVDS == 0)) {
- SiS_SetRegAND(SiS_P3d4,0x63,0xbf);
- temp = SiS_GetReg1(SiS_P3c4,0x15);
- if(!(temp & 0x01)) {
- if(!(temp & 0xa0)) {
- if(SiS_GetReg1(SiS_P3c4,0x16) & 0x01) {
- SiS_SetRegOR(SiS_P3d4,0x64,0x40);
- }
- } else {
- SiS_SetRegOR(SiS_P3d4,0x64,0x40);
- }
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
+ if(!(SiS_IsDualEdge(SiS_Pr, HwDeviceExtension, BaseAddr))) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x13,0xfb);
+ }
+ }
+ }
+
+ /* TW: New from 650/LV 1.10.6x and 1.10.7w */
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ if(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) {
+ SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x35,0x01);
+ } else {
+ SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x35,0xFE);
+ }
+
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x38,backupreg);
+
+ tempr1 = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30);
+ tempr2 = SiS_GetReg1(SiS_Pr->SiS_Part2Port,0x00);
+ if(tempr1 & SetCRT2ToAVIDEO) tempr2 &= 0xF7;
+ if(tempr1 & SetCRT2ToSVIDEO) tempr2 &= 0xFB;
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x00,tempr2);
+
+ if((IS_SIS650) && (SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30) & 0xfc)) {
+ if((ModeNo == 0x03) || (ModeNo == 0x10)) {
+ SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x51,0x80);
+ SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x56,0x08);
+ }
+ }
+
+ if(tempr1 & SetCRT2ToLCD) {
+ SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x38,0xfc);
+ }
+ } else if((HwDeviceExtension->jChipType == SIS_630) ||
+ (HwDeviceExtension->jChipType == SIS_730)) {
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x35,backupreg);
}
}
#ifdef LINUX_XF86
- /* TW: SetPitch: Adapt to virtual size & position */
- if(pScrn)
- SiS_SetPitch(pScrn, BaseAddr);
+ if(pScrn) {
+ /* TW: SetPitch: Adapt to virtual size & position */
+ if((ModeNo > 0x13) && (dosetpitch)) {
+ SiS_SetPitch(SiS_Pr, pScrn, BaseAddr);
+ }
- /* Backup/Set ModeNo in MMIO */
- SiS_GetSetModeID(pScrn,ModeNo);
+ /* Backup/Set ModeNo in BIOS scratch area */
+ SiS_GetSetModeID(pScrn, ModeNo);
+ }
#endif
#ifndef LINUX_XF86 /* TW: We never lock registers in XF86 */
- if(KeepLockReg==0xA1) SiS_SetReg1(SiS_P3c4,0x05,0x86);
- else SiS_SetReg1(SiS_P3c4,0x05,0x00);
+ if(KeepLockReg == 0xA1) SiS_SetReg1(SiS_Pr->SiS_P3c4,0x05,0x86);
+ else SiS_SetReg1(SiS_Pr->SiS_P3c4,0x05,0x00);
#endif
return TRUE;
}
void
-SetEnableDstn() /* TW: Called from sis_main.c */
+SiS_SetEnableDstn(SiS_Private *SiS_Pr) /* TW: Called from sis_main.c */
{
- SiS_IF_DEF_DSTN=1; /* for 550 dstn */
+ /* For 550 dstn */
+ SiS_Pr->SiS_IF_DEF_DSTN = 1;
}
void
-SiS_SetCRT1Group(UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension,
+SiS_HandleCRT1(SiS_Private *SiS_Pr)
+{
+ /* TW: We don't do this at all. There is a new
+ * CRT1-is-connected-at-boot-time logic in the 650 BIOS, which
+ * confuses our own. So just clear the bit and skip the rest.
+ */
+
+ SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x63,0xbf);
+
+#if 0
+ if(!(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x15) & 0x01))
+ SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x63,0x40);
+ }
+#endif
+}
+
+void
+SiS_SetCRT1Group(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension,
USHORT ModeNo,USHORT ModeIdIndex,USHORT BaseAddr)
{
USHORT StandTableIndex,RefreshRateTableIndex;
- SiS_CRT1Mode = ModeNo;
- StandTableIndex = SiS_GetModePtr(ROMAddr,ModeNo,ModeIdIndex);
- if(SiS_LowModeStuff(ModeNo,HwDeviceExtension)) {
- if(SiS_VBInfo & (SetSimuScanMode | SwitchToCRT2)) {
- SiS_DisableBridge(HwDeviceExtension,BaseAddr);
+ SiS_Pr->SiS_CRT1Mode = ModeNo;
+ StandTableIndex = SiS_GetModePtr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex);
+ if(SiS_LowModeStuff(SiS_Pr,ModeNo,HwDeviceExtension)) {
+ if(SiS_Pr->SiS_VBInfo & (SetSimuScanMode | SwitchToCRT2)) {
+ SiS_DisableBridge(SiS_Pr,HwDeviceExtension,BaseAddr);
}
}
- SiS_SetSeqRegs(ROMAddr,StandTableIndex);
- SiS_SetMiscRegs(ROMAddr,StandTableIndex);
- SiS_SetCRTCRegs(ROMAddr,HwDeviceExtension,StandTableIndex);
- SiS_SetATTRegs(ROMAddr,StandTableIndex,ModeNo,HwDeviceExtension);
- SiS_SetGRCRegs(ROMAddr,StandTableIndex);
- SiS_ClearExt1Regs(HwDeviceExtension);
- SiS_ResetCRT1VCLK(ROMAddr,HwDeviceExtension);
- SiS_SelectCRT2Rate=0;
- SiS_SetFlag &= (~ProgrammingCRT2);
+ SiS_SetSeqRegs(SiS_Pr,ROMAddr,StandTableIndex);
+ SiS_SetMiscRegs(SiS_Pr,ROMAddr,StandTableIndex);
+ SiS_SetCRTCRegs(SiS_Pr,ROMAddr,HwDeviceExtension,StandTableIndex);
+ SiS_SetATTRegs(SiS_Pr,ROMAddr,StandTableIndex,HwDeviceExtension);
+ SiS_SetGRCRegs(SiS_Pr,ROMAddr,StandTableIndex);
+ SiS_ClearExt1Regs(SiS_Pr,HwDeviceExtension);
+ SiS_ResetCRT1VCLK(SiS_Pr,ROMAddr,HwDeviceExtension);
+
+ SiS_Pr->SiS_SelectCRT2Rate = 0;
+ SiS_Pr->SiS_SetFlag &= (~ProgrammingCRT2);
#ifdef LINUX_XF86
- xf86DrvMsg(0, X_INFO, "(init: VBType = %x, LVDS=%d, VBInfo=%x)\n",
- SiS_VBType, SiS_IF_DEF_LVDS, SiS_VBInfo);
+ xf86DrvMsgVerb(0, X_PROBED, 3, "(init: VBType=0x%04x, VBInfo=0x%04x)\n",
+ SiS_Pr->SiS_VBType, SiS_Pr->SiS_VBInfo);
#endif
- /* TW: Inserted this entire if-section from 650/LVDS and 650/301 BIOS */
- if(SiS_VBInfo & SetSimuScanMode) {
- if(SiS_VBInfo & SetInSlaveMode) {
- SiS_SetFlag |= ProgrammingCRT2;
+ if(SiS_Pr->SiS_VBInfo & SetSimuScanMode) {
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
+ SiS_Pr->SiS_SetFlag |= ProgrammingCRT2;
}
}
- /* TW: Removed 301B301LV302B302LV check here */
- if(SiS_VBInfo & SetCRT2ToLCDA) {
- SiS_SetFlag |= ProgrammingCRT2;
+
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) {
+ SiS_Pr->SiS_SetFlag |= ProgrammingCRT2;
}
- RefreshRateTableIndex = SiS_GetRatePtrCRT2(ROMAddr,ModeNo,ModeIdIndex);
+ RefreshRateTableIndex = SiS_GetRatePtrCRT2(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension);
- /* TW: Removed 301B301LV302B302LV check here */
- if(!(SiS_VBInfo & SetCRT2ToLCDA)) {
- SiS_SetFlag &= (~ProgrammingCRT2);
+ if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) {
+ SiS_Pr->SiS_SetFlag &= ~ProgrammingCRT2;
}
- if (RefreshRateTableIndex != 0xFFFF) {
- SiS_SetSync(ROMAddr,RefreshRateTableIndex);
- SiS_SetCRT1CRTC(ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,HwDeviceExtension);
- SiS_SetCRT1Offset(ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,HwDeviceExtension);
- SiS_SetCRT1VCLK(ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension,RefreshRateTableIndex);
+ if(RefreshRateTableIndex != 0xFFFF) {
+ SiS_SetSync(SiS_Pr,ROMAddr,RefreshRateTableIndex);
+ SiS_SetCRT1CRTC(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,HwDeviceExtension);
+ SiS_SetCRT1Offset(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,HwDeviceExtension);
+ SiS_SetCRT1VCLK(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension,RefreshRateTableIndex);
}
#ifdef SIS300
- if((HwDeviceExtension->jChipType == SIS_630)||
- (HwDeviceExtension->jChipType == SIS_730)||
+ if(HwDeviceExtension->jChipType == SIS_300) {
+ SiS_SetCRT1FIFO_300(SiS_Pr,ROMAddr,ModeNo,HwDeviceExtension,RefreshRateTableIndex);
+ }
+ if((HwDeviceExtension->jChipType == SIS_630) ||
+ (HwDeviceExtension->jChipType == SIS_730) ||
(HwDeviceExtension->jChipType == SIS_540)) {
- SiS_SetCRT1FIFO_300(ROMAddr,ModeNo,HwDeviceExtension,RefreshRateTableIndex);
+ SiS_SetCRT1FIFO_630(SiS_Pr,ROMAddr,ModeNo,HwDeviceExtension,RefreshRateTableIndex);
}
#endif
#ifdef SIS315H
if(HwDeviceExtension->jChipType >= SIS_315H) {
- SiS_SetCRT1FIFO_310(ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension);
+ SiS_SetCRT1FIFO_310(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension);
}
#endif
- SiS_SetCRT1ModeRegs(ROMAddr,HwDeviceExtension,ModeNo,ModeIdIndex,RefreshRateTableIndex);
+ SiS_SetCRT1ModeRegs(SiS_Pr,ROMAddr,HwDeviceExtension,ModeNo,ModeIdIndex,RefreshRateTableIndex);
-#if 0 /* TW: Not done in any BIOS */
-#ifdef SIS315H
- if(HwDeviceExtension->jChipType >= SIS_315H) {
- if (RefreshRateTableIndex != 0xFFFF) {
- SiS_SetInterlace(ROMAddr,ModeNo,RefreshRateTableIndex);
- }
-#endif
+ SiS_LoadDAC(SiS_Pr,HwDeviceExtension,ROMAddr,ModeNo,ModeIdIndex);
+
+#ifndef LINUX_XF86
+ if(SiS_Pr->SiS_flag_clearbuffer) {
+ SiS_ClearBuffer(SiS_Pr,HwDeviceExtension,ModeNo);
}
#endif
- SiS_LoadDAC(ROMAddr,ModeNo,ModeIdIndex);
-
- if(flag_clearbuffer) SiS_ClearBuffer(HwDeviceExtension,ModeNo);
-
- if(!(SiS_VBInfo & (SetSimuScanMode | SwitchToCRT2 | SetCRT2ToLCDA))) {
- SiS_LongWait();
- SiS_DisplayOn();
+ if(!(SiS_Pr->SiS_VBInfo & (SetSimuScanMode | SwitchToCRT2 | SetCRT2ToLCDA))) {
+ SiS_LongWait(SiS_Pr);
+ SiS_DisplayOn(SiS_Pr);
}
}
#ifdef LINUX_XF86
void
-SiS_SetPitch(ScrnInfoPtr pScrn, UShort BaseAddr)
+SiS_SetPitch(SiS_Private *SiS_Pr, ScrnInfoPtr pScrn, UShort BaseAddr)
{
SISPtr pSiS = SISPTR(pScrn);
/* TW: We need to set pitch for CRT1 if bridge is in SlaveMode, too */
if( (pSiS->VBFlags & DISPTYPE_DISP1) ||
( (pSiS->VBFlags & VB_VIDEOBRIDGE) &&
- ( ((pSiS->VGAEngine == SIS_300_VGA) && (SiS_GetReg1(SiS_Part1Port,0x00) & 0xa0) == 0x20) ||
- ((pSiS->VGAEngine == SIS_315_VGA) && (SiS_GetReg1(SiS_Part1Port,0x00) & 0x50) == 0x10) ) ) ) {
- SiS_SetPitchCRT1(pScrn, BaseAddr);
+ ( ((pSiS->VGAEngine == SIS_300_VGA) && (SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x00) & 0xa0) == 0x20) ||
+ ((pSiS->VGAEngine == SIS_315_VGA) && (SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x00) & 0x50) == 0x10) ) ) ) {
+ SiS_SetPitchCRT1(SiS_Pr, pScrn, BaseAddr);
}
if (pSiS->VBFlags & DISPTYPE_DISP2) {
- SiS_SetPitchCRT2(pScrn, BaseAddr);
+ SiS_SetPitchCRT2(SiS_Pr, pScrn, BaseAddr);
}
}
void
-SiS_SetPitchCRT1(ScrnInfoPtr pScrn, UShort BaseAddr)
+SiS_SetPitchCRT1(SiS_Private *SiS_Pr, ScrnInfoPtr pScrn, UShort BaseAddr)
{
SISPtr pSiS = SISPTR(pScrn);
ULong HDisplay,temp;
HDisplay = pSiS->scrnPitch / 8;
- SiS_SetReg1(SiS_P3d4, 0x13, (HDisplay & 0xFF));
- temp = (SiS_GetReg1(SiS_P3c4, 0x0E) & 0xF0) | (HDisplay>>8);
- SiS_SetReg1(SiS_P3c4, 0x0E, temp);
+ SiS_SetReg1(SiS_Pr->SiS_P3d4, 0x13, (HDisplay & 0xFF));
+ temp = (SiS_GetReg1(SiS_Pr->SiS_P3c4, 0x0E) & 0xF0) | (HDisplay>>8);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4, 0x0E, temp);
}
void
-SiS_SetPitchCRT2(ScrnInfoPtr pScrn, UShort BaseAddr)
+SiS_SetPitchCRT2(SiS_Private *SiS_Pr, ScrnInfoPtr pScrn, UShort BaseAddr)
{
SISPtr pSiS = SISPTR(pScrn);
ULong HDisplay,temp;
@@ -2399,76 +2814,75 @@ SiS_SetPitchCRT2(ScrnInfoPtr pScrn, UShort BaseAddr)
/* Unlock CRT2 */
if (pSiS->VGAEngine == SIS_315_VGA)
- SiS_SetRegANDOR(SiS_Part1Port,0x2F, 0xFF, 0x01);
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2F, 0x01);
else
- SiS_SetRegANDOR(SiS_Part1Port,0x24, 0xFF, 0x01);
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x24, 0x01);
- SiS_SetReg1(SiS_Part1Port,0x07, (HDisplay & 0xFF));
- temp = (SiS_GetReg1(SiS_Part1Port,0x09) & 0xF0) | ((HDisplay >> 8) & 0xFF);
- SiS_SetReg1(SiS_Part1Port,0x09, temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x07, (HDisplay & 0xFF));
+ temp = (SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x09) & 0xF0) | ((HDisplay >> 8) & 0xFF);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x09, temp);
}
#endif
-/* TW: Checked against 650/301 and 630/301B BIOS */
void
-SiS_GetVBType(USHORT BaseAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension)
+SiS_GetVBType(SiS_Private *SiS_Pr, USHORT BaseAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
- USHORT flag;
+ USHORT flag=0, rev=0, nolcd=0;
- SiS_VBType = 0;
-
- if(SiS_IF_DEF_LVDS == 1) return;
+ SiS_Pr->SiS_VBType = 0;
- flag = SiS_GetReg1(SiS_Part4Port,0x00);
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1) return;
+
+ flag = SiS_GetReg1(SiS_Pr->SiS_Part4Port,0x00);
/* TW: Illegal values not welcome... */
- if(flag > 10) return;
+ if(flag > 3) return;
+
+ rev = SiS_GetReg1(SiS_Pr->SiS_Part4Port,0x01);
if (flag >= 2) {
- flag=SiS_GetReg1(SiS_Part4Port,0x01);
- if(flag >= 0xB0){
- SiS_VBType = VB_SIS302B;
- if(flag >= 0xD0)
- SiS_VBType = VB_SIS302LV;
- }
+ SiS_Pr->SiS_VBType = VB_SIS302B;
} else if (flag == 1) {
- flag=SiS_GetReg1(SiS_Part4Port,0x01);
- if(flag >= 0xB0){
- SiS_VBType = VB_SIS301B;
- if(flag >= 0xD0)
- SiS_VBType = VB_SIS301LV;
- } else
- SiS_VBType = VB_SIS301;
+ SiS_Pr->SiS_VBType = VB_SIS301;
+ if(rev >= 0xB0) {
+ SiS_Pr->SiS_VBType = VB_SIS301B;
+ /* Check if 30xB DH version (no LCD support, use Panel Link instead) */
+ nolcd = SiS_GetReg1(SiS_Pr->SiS_Part4Port,0x23);
+ if(!(nolcd & 0x02)) SiS_Pr->SiS_VBType |= VB_NoLCD;
+ }
}
- /* TW: This is checked in 630 BIOS, but not used */
- if(HwDeviceExtension->jChipType >= SIS_315H) {
- if(SiS_VBType & VB_SIS301BLV302BLV) {
- flag = SiS_GetReg1(SiS_Part4Port,0x23);
- if(!(flag & 0x02))
- SiS_VBType |= VB_NoLCD;
- }
+ if(SiS_Pr->SiS_VBType & (VB_SIS301B | VB_SIS302B)) {
+ if(rev >= 0xD0) {
+ SiS_Pr->SiS_VBType &= ~(VB_SIS301B | VB_SIS302B);
+ SiS_Pr->SiS_VBType |= VB_SIS301LV;
+ SiS_Pr->SiS_VBType &= ~(VB_NoLCD);
+ if(rev >= 0xE0) {
+ SiS_Pr->SiS_VBType &= ~(VB_SIS301LV);
+ SiS_Pr->SiS_VBType |= VB_SIS302LV;
+ }
+ }
}
}
BOOLEAN
-SiS_SearchModeID(UCHAR *ROMAddr,USHORT *ModeNo,USHORT *ModeIdIndex)
+SiS_SearchModeID(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT *ModeNo,USHORT *ModeIdIndex)
{
- UCHAR VGAINFO = 0x11; /* TW: Replaces ds:449 */
+ UCHAR VGAINFO = SiS_Pr->SiS_VGAINFO;
if(*ModeNo <= 0x13) {
- if((*ModeNo) <= 5) (*ModeNo) |= 1;
+ if((*ModeNo) <= 0x05) (*ModeNo) |= 0x01;
- for (*ModeIdIndex=0;;(*ModeIdIndex)++) {
- if (SiS_SModeIDTable[*ModeIdIndex].St_ModeID == (*ModeNo)) break;
- if (SiS_SModeIDTable[*ModeIdIndex].St_ModeID == 0xFF) return FALSE;
+ for(*ModeIdIndex = 0; ;(*ModeIdIndex)++) {
+ if(SiS_Pr->SiS_SModeIDTable[*ModeIdIndex].St_ModeID == (*ModeNo)) break;
+ if(SiS_Pr->SiS_SModeIDTable[*ModeIdIndex].St_ModeID == 0xFF) return FALSE;
}
if(*ModeNo == 0x07) {
if(VGAINFO & 0x10) (*ModeIdIndex)++; /* 400 lines */
/* else 350 lines */
}
- if(*ModeNo <= 3) {
+ if(*ModeNo <= 0x03) {
if(!(VGAINFO & 0x80)) (*ModeIdIndex)++;
if(VGAINFO & 0x10) (*ModeIdIndex)++; /* 400 lines */
/* else 350 lines */
@@ -2477,9 +2891,9 @@ SiS_SearchModeID(UCHAR *ROMAddr,USHORT *ModeNo,USHORT *ModeIdIndex)
} else {
- for (*ModeIdIndex=0;;(*ModeIdIndex)++) {
- if (SiS_EModeIDTable[*ModeIdIndex].Ext_ModeID == (*ModeNo)) break;
- if (SiS_EModeIDTable[*ModeIdIndex].Ext_ModeID == 0xFF) return FALSE;
+ for(*ModeIdIndex = 0; ;(*ModeIdIndex)++) {
+ if(SiS_Pr->SiS_EModeIDTable[*ModeIdIndex].Ext_ModeID == (*ModeNo)) break;
+ if(SiS_Pr->SiS_EModeIDTable[*ModeIdIndex].Ext_ModeID == 0xFF) return FALSE;
}
}
@@ -2488,16 +2902,16 @@ SiS_SearchModeID(UCHAR *ROMAddr,USHORT *ModeNo,USHORT *ModeIdIndex)
/* For SiS 300 oem util: Search VBModeID */
BOOLEAN
-SiS_SearchVBModeID(UCHAR *ROMAddr, USHORT *ModeNo)
+SiS_SearchVBModeID(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT *ModeNo)
{
USHORT ModeIdIndex;
- UCHAR VGAINFO = 0x11; /* TW: Replaces ds:449 */
+ UCHAR VGAINFO = SiS_Pr->SiS_VGAINFO;
if(*ModeNo <= 5) *ModeNo |= 1;
for(ModeIdIndex=0; ; ModeIdIndex++) {
- if (SiS_VBModeIDTable[ModeIdIndex].ModeID == *ModeNo) break;
- if (SiS_VBModeIDTable[ModeIdIndex].ModeID == 0xFF) return FALSE;
+ if(SiS_Pr->SiS_VBModeIDTable[ModeIdIndex].ModeID == *ModeNo) break;
+ if(SiS_Pr->SiS_VBModeIDTable[ModeIdIndex].ModeID == 0xFF) return FALSE;
}
if(*ModeNo != 0x07) {
@@ -2510,89 +2924,80 @@ SiS_SearchVBModeID(UCHAR *ROMAddr, USHORT *ModeNo)
return ((BOOLEAN)ModeIdIndex);
}
-/* TW: Checked against 630/301B and 315 BIOS */
BOOLEAN
-SiS_CheckMemorySize(UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension,
+SiS_CheckMemorySize(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension,
USHORT ModeNo,USHORT ModeIdIndex)
{
- USHORT memorysize,modeflag,temp;
-
- if((HwDeviceExtension->jChipType == SIS_550)||
- (HwDeviceExtension->jChipType == SIS_640)||
- (HwDeviceExtension->jChipType == SIS_740)||
- (HwDeviceExtension->jChipType == SIS_650))
- return(TRUE);
+ USHORT memorysize,modeflag;
+ ULONG temp;
- if (ModeNo<=0x13) {
- modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
+ if(SiS_Pr->UseCustomMode) {
+ modeflag = SiS_Pr->CModeFlag;
} else {
- modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ if(ModeNo <= 0x13) {
+ modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
+ } else {
+ modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ }
}
memorysize = modeflag & MemoryInfoFlag;
- memorysize >>= MemorySizeShift;
- memorysize++; /* Get memory size */
-
- temp = SiS_GetReg1(SiS_P3c4,0x14); /* Get DRAM Size */
+ memorysize >>= MemorySizeShift; /* Get required memory size */
+ memorysize++;
- if((HwDeviceExtension->jChipType == SIS_315H)||
- (HwDeviceExtension->jChipType == SIS_315PRO)) { /* 315 */
- temp = 1 << ((temp & 0x0F0) >> 4);
- if ((temp & 0x0c) == 0x08) { /* DDR asymetric */
- temp += (temp/2);
- } else {
- if ((temp & 0x0c) != 0) temp <<= 1;
- }
- } else { /* 300, 540, 630, 730 */
- temp &= 0x3F;
- temp++;
- }
+ temp = GetDRAMSize(SiS_Pr, HwDeviceExtension); /* Get adapter memory size */
+ temp /= (1024*1024); /* (in MB) */
if(temp < memorysize) return(FALSE);
else return(TRUE);
}
UCHAR
-SiS_GetModePtr(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex)
+SiS_GetModePtr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex)
{
UCHAR index;
- if(ModeNo<=0x13) {
- index = SiS_SModeIDTable[ModeIdIndex].St_StTableIndex;
+ if(ModeNo <= 0x13) {
+ index = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_StTableIndex;
} else {
- if(SiS_ModeType <= 0x02) index=0x1B; /* 02 -> ModeEGA */
- else index=0x0F;
+ if(SiS_Pr->SiS_ModeType <= 0x02) index = 0x1B; /* 02 -> ModeEGA */
+ else index = 0x0F;
}
return index;
}
-/* TW: Checked against 650/LVDS (1.10.07, 1.10a) and 650/301LV BIOS */
void
-SiS_SetSeqRegs(UCHAR *ROMAddr,USHORT StandTableIndex)
+SiS_SetSeqRegs(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT StandTableIndex)
{
UCHAR SRdata;
USHORT i;
- SiS_SetReg1(SiS_P3c4,0x00,0x03); /* Set SR0 */
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x00,0x03); /* Set SR0 */
- SRdata=SiS_StandTable[StandTableIndex].SR[0];
+ SRdata = SiS_Pr->SiS_StandTable[StandTableIndex].SR[0];
- if(SiS_VBType & VB_SIS301BLV302BLV) {
- if(SiS_VBInfo & SetCRT2ToLCDA) {
- SRdata |= 0x01;
- }
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) {
+ SRdata |= 0x01;
+ }
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ if(SiS_Pr->SiS_VBType & VB_NoLCD) {
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
+ SRdata |= 0x01; /* 8 dot clock */
+ }
+ }
+ }
}
- if(SiS_IF_DEF_LVDS == 1) {
- if(SiS_IF_DEF_CH70xx != 0) {
- if(SiS_VBInfo & SetCRT2ToTV) {
- if(SiS_VBInfo & SetInSlaveMode) {
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
+ if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
SRdata |= 0x01; /* 8 dot clock */
}
}
}
- if(SiS_VBInfo & SetCRT2ToLCD) {
- if(SiS_VBInfo & SetInSlaveMode) {
- /* TW: wdr/300: if(SiS_LCDInfo & LCDNonExpanding) { */
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
SRdata |= 0x01; /* 8 dot clock */
}
}
@@ -2600,66 +3005,63 @@ SiS_SetSeqRegs(UCHAR *ROMAddr,USHORT StandTableIndex)
SRdata |= 0x20; /* screen off */
- SiS_SetReg1(SiS_P3c4,0x01,SRdata);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x01,SRdata);
- for(i=02;i<=04;i++) {
- SRdata=SiS_StandTable[StandTableIndex].SR[i-1];
- SiS_SetReg1(SiS_P3c4,i,SRdata);
+ for(i = 2; i <= 4; i++) {
+ SRdata = SiS_Pr->SiS_StandTable[StandTableIndex].SR[i-1];
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,i,SRdata);
}
}
-/* Checked against 650/301LV and 65/LVDS 1.10.07 BIOS */
void
-SiS_SetMiscRegs(UCHAR *ROMAddr,USHORT StandTableIndex)
+SiS_SetMiscRegs(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT StandTableIndex)
{
UCHAR Miscdata;
- Miscdata = SiS_StandTable[StandTableIndex].MISC;
+ Miscdata = SiS_Pr->SiS_StandTable[StandTableIndex].MISC;
- if(SiS_VBType & VB_SIS301BLV302BLV) {
- if(SiS_VBInfo & SetCRT2ToLCDA) {
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) {
Miscdata |= 0x0C;
}
- }
+ }
- SiS_SetReg3(SiS_P3c2,Miscdata);
+ SiS_SetReg3(SiS_Pr->SiS_P3c2,Miscdata);
}
-/* Checked against 650/LVDS (1.10.07) and 650/301LV BIOS (630 code still there!) */
void
-SiS_SetCRTCRegs(UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension,
+SiS_SetCRTCRegs(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension,
USHORT StandTableIndex)
{
UCHAR CRTCdata;
USHORT i;
- SiS_SetRegAND(SiS_P3d4,0x11,0x7f); /* Unlock CRTC */
+ SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x11,0x7f); /* Unlock CRTC */
- for(i=0;i<=0x18;i++) {
- CRTCdata=SiS_StandTable[StandTableIndex].CRTC[i];
- SiS_SetReg1(SiS_P3d4,i,CRTCdata); /* Set CRTC(3d4) */
+ for(i = 0; i <= 0x18; i++) {
+ CRTCdata = SiS_Pr->SiS_StandTable[StandTableIndex].CRTC[i];
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,i,CRTCdata); /* Set CRTC(3d4) */
}
if( ( (HwDeviceExtension->jChipType == SIS_630) ||
(HwDeviceExtension->jChipType == SIS_730) ) &&
- (HwDeviceExtension->jChipRevision >= 0x30) ) { /* for 630S0 */
- if(SiS_VBInfo & SetInSlaveMode) {
- if(SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToTV)) {
- SiS_SetReg1(SiS_P3d4,0x18,0xFE);
+ (HwDeviceExtension->jChipRevision >= 0x30) ) { /* for 630S0 */
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
+ if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToTV)) {
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x18,0xFE);
}
}
}
}
-/* TW: Checked against 650/LVDS (1.10.07), 650/301LV and 630/301B BIOS */
void
-SiS_SetATTRegs(UCHAR *ROMAddr,USHORT StandTableIndex,USHORT ModeNo,
+SiS_SetATTRegs(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT StandTableIndex,
PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
UCHAR ARdata;
USHORT i;
- for(i=0;i<=0x13;i++) {
- ARdata = SiS_StandTable[StandTableIndex].ATTR[i];
+ for(i = 0; i <= 0x13; i++) {
+ ARdata = SiS_Pr->SiS_StandTable[StandTableIndex].ATTR[i];
#if 0
if((i <= 0x0f) || (i == 0x11)) {
if(ds:489 & 0x08) {
@@ -2668,217 +3070,304 @@ SiS_SetATTRegs(UCHAR *ROMAddr,USHORT StandTableIndex,USHORT ModeNo,
}
#endif
if(i == 0x13) {
- if(SiS_VBType & VB_SIS301BLV302BLV) {
- if(SiS_VBInfo & SetCRT2ToLCDA) ARdata=0;
+ /* Pixel shift. If screen on LCD or TV is shifted left or right,
+ * this might be the cause.
+ */
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) ARdata=0;
}
- if(SiS_IF_DEF_LVDS == 1) {
- if(SiS_IF_DEF_CH70xx != 0) {
- if(SiS_VBInfo & SetCRT2ToTV) {
- if(SiS_VBInfo & SetInSlaveMode) ARdata=0;
- }
- }
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
+ if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) ARdata=0;
+ }
+ }
}
- if(SiS_VBInfo & SetCRT2ToLCD) {
- if((HwDeviceExtension->jChipType >= SIS_315H) && (SiS_IF_DEF_LVDS == 1)) {
- /* TW: From 650/LVDS 1.10.07, 1.10a */
- ARdata = 0;
- } else {
- if(SiS_VBInfo & SetInSlaveMode) {
- /* TW: wdr: if(SiS_LCDInfo & LCDNonExpanding) { */
- ARdata=0;
- }
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ if(IS_SIS650740 || IS_SIS550) {
+ /* 315, 330 don't do this */
+ if(SiS_Pr->SiS_VBType & VB_SIS301B302B) {
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) ARdata=0;
+ } else {
+ ARdata = 0;
+ }
+ }
+ } else {
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) ARdata=0;
}
}
}
- SiS_GetReg2(SiS_P3da); /* reset 3da */
- SiS_SetReg3(SiS_P3c0,i); /* set index */
- SiS_SetReg3(SiS_P3c0,ARdata); /* set data */
+ SiS_GetReg2(SiS_Pr->SiS_P3da); /* reset 3da */
+ SiS_SetReg3(SiS_Pr->SiS_P3c0,i); /* set index */
+ SiS_SetReg3(SiS_Pr->SiS_P3c0,ARdata); /* set data */
}
- SiS_GetReg2(SiS_P3da); /* reset 3da */
- SiS_SetReg3(SiS_P3c0,0x14); /* set index */
- SiS_SetReg3(SiS_P3c0,0x00); /* set data */
+ SiS_GetReg2(SiS_Pr->SiS_P3da); /* reset 3da */
+ SiS_SetReg3(SiS_Pr->SiS_P3c0,0x14); /* set index */
+ SiS_SetReg3(SiS_Pr->SiS_P3c0,0x00); /* set data */
- SiS_GetReg2(SiS_P3da); /* Enable Attribute */
- SiS_SetReg3(SiS_P3c0,0x20);
+ SiS_GetReg2(SiS_Pr->SiS_P3da);
+ SiS_SetReg3(SiS_Pr->SiS_P3c0,0x20); /* Enable Attribute */
+ SiS_GetReg2(SiS_Pr->SiS_P3da);
}
-/* TW: Checked against 650/LVDS (1.10.07, 1.10a) and 650/301LV BIOS */
void
-SiS_SetGRCRegs(UCHAR *ROMAddr,USHORT StandTableIndex)
+SiS_SetGRCRegs(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT StandTableIndex)
{
UCHAR GRdata;
USHORT i;
- for(i=0;i<=0x08;i++) {
- GRdata = SiS_StandTable[StandTableIndex].GRC[i]; /* Get GR from file */
- SiS_SetReg1(SiS_P3ce,i,GRdata); /* Set GR(3ce) */
+ for(i = 0; i <= 0x08; i++) {
+ GRdata = SiS_Pr->SiS_StandTable[StandTableIndex].GRC[i];
+ SiS_SetReg1(SiS_Pr->SiS_P3ce,i,GRdata); /* Set GR(3ce) */
}
- if(SiS_ModeType > ModeVGA) {
- SiS_SetRegAND(SiS_P3ce,0x05,0xBF); /* 256 color disable */
+ if(SiS_Pr->SiS_ModeType > ModeVGA) {
+ SiS_SetRegAND(SiS_Pr->SiS_P3ce,0x05,0xBF); /* 256 color disable */
}
}
-/* TW: Checked against 650/LVDS (1.10.07, 1.10a), 650/301LV and 630/301B BIOS */
void
-SiS_ClearExt1Regs(PSIS_HW_DEVICE_INFO HwDeviceExtension)
+SiS_ClearExt1Regs(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
USHORT i;
- for(i=0x0A;i<=0x0E;i++) SiS_SetReg1(SiS_P3c4,i,0x00); /* Clear SR0A-SR0E */
+ for(i = 0x0A; i <= 0x0E; i++) {
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,i,0x00); /* Clear SR0A-SR0E */
+ }
- /* TW: New from 650/LVDS/301LV BIOSes: */
+ /* TW: New from 330, 650/LVDS/301LV BIOSes: */
if(HwDeviceExtension->jChipType >= SIS_315H) {
- SiS_SetRegAND(SiS_P3c4,0x37,0xFE);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x37,0xFE);
}
}
-/* TW: Checked against 650/LVDS (1.10.07) and 650/301LV BIOS */
void
-SiS_SetSync(UCHAR *ROMAddr,USHORT RefreshRateTableIndex)
+SiS_SetSync(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT RefreshRateTableIndex)
{
USHORT sync;
USHORT temp;
- sync = SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag >> 8;
+ if(SiS_Pr->UseCustomMode) {
+ sync = SiS_Pr->CInfoFlag >> 8;
+ } else {
+ sync = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag >> 8;
+ }
sync &= 0xC0;
temp = 0x2F | sync;
- SiS_SetReg3(SiS_P3c2,temp); /* Set Misc(3c2) */
+ SiS_SetReg3(SiS_Pr->SiS_P3c2,temp); /* Set Misc(3c2) */
}
-/* TW: Checked against 650/LVDS (1.10.07) and 650/301LV BIOS */
void
-SiS_SetCRT1CRTC(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+SiS_SetCRT1CRTC(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
USHORT RefreshRateTableIndex,
PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
UCHAR index;
- USHORT temp,tempah,i,modeflag,j;
+ USHORT tempah,i,modeflag,j;
+#ifdef SIS315H
+ USHORT temp;
USHORT ResInfo,DisplayType;
- SiS_LCDACRT1DataStruct *LCDACRT1Ptr=NULL;
+ const SiS_LCDACRT1DataStruct *LCDACRT1Ptr = NULL;
+#endif
- SiS_SetRegAND(SiS_P3d4,0x11,0x7f); /*unlock cr0-7 */
+ SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x11,0x7f); /*unlock cr0-7 */
- if(ModeNo<=0x13) {
- modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
+ if(SiS_Pr->UseCustomMode) {
+ modeflag = SiS_Pr->CModeFlag;
} else {
- modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
- }
+ if(ModeNo <= 0x13) {
+ modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
+ } else {
+ modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ }
+ }
- if((SiS_VBType & (VB_SIS302B | VB_SIS302LV))
- && (SiS_VBInfo & SetCRT2ToLCDA)) {
+ if((SiS_Pr->SiS_IF_DEF_LVDS == 0) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) {
- /* 302B LCDA - TW: Not done in any BIOS version */
+#ifdef SIS315H
+
+ /* LCDA */
- temp = SiS_GetLCDACRT1Ptr(ROMAddr,ModeNo,ModeIdIndex,
+ temp = SiS_GetLCDACRT1Ptr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,
RefreshRateTableIndex,&ResInfo,&DisplayType);
-
+
switch(DisplayType) {
- case 0 : LCDACRT1Ptr = SiS_LCDACRT1800x600_1; break;
- case 1 : LCDACRT1Ptr = SiS_LCDACRT11024x768_1; break;
- case 2 : LCDACRT1Ptr = SiS_LCDACRT11280x1024_1; break;
- case 3 : LCDACRT1Ptr = SiS_LCDACRT1800x600_1_H; break;
- case 4 : LCDACRT1Ptr = SiS_LCDACRT11024x768_1_H; break;
- case 5 : LCDACRT1Ptr = SiS_LCDACRT11280x1024_1_H; break;
- case 6 : LCDACRT1Ptr = SiS_LCDACRT1800x600_2; break;
- case 7 : LCDACRT1Ptr = SiS_LCDACRT11024x768_2; break;
- case 8 : LCDACRT1Ptr = SiS_LCDACRT11280x1024_2; break;
- case 9 : LCDACRT1Ptr = SiS_LCDACRT1800x600_2_H; break;
- case 10: LCDACRT1Ptr = SiS_LCDACRT11024x768_2_H; break;
- case 11: LCDACRT1Ptr = SiS_LCDACRT11280x1024_2_H; break;
+ case Panel_800x600 : LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT1800x600_1; break;
+ case Panel_1024x768 : LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11024x768_1; break;
+ case Panel_1280x1024 : LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11280x1024_1; break;
+ case Panel_1400x1050 : LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11400x1050_1; break;
+ case Panel_1600x1200 : LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11600x1200_1; break;
+ case Panel_800x600 + 16: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT1800x600_1_H; break;
+ case Panel_1024x768 + 16: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11024x768_1_H; break;
+ case Panel_1280x1024 + 16: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11280x1024_1_H; break;
+ case Panel_1400x1050 + 16: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11400x1050_1_H; break;
+ case Panel_1600x1200 + 16: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11600x1200_1_H; break;
+ case Panel_800x600 + 32: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT1800x600_2; break;
+ case Panel_1024x768 + 32: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11024x768_2; break;
+ case Panel_1280x1024 + 32: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11280x1024_2; break;
+ case Panel_1400x1050 + 32: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11400x1050_2; break;
+ case Panel_1600x1200 + 32: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11600x1200_2; break;
+ case Panel_800x600 + 48: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT1800x600_2_H; break;
+ case Panel_1024x768 + 48: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11024x768_2_H; break;
+ case Panel_1280x1024 + 48: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11280x1024_2_H; break;
+ case Panel_1400x1050 + 48: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11400x1050_2_H; break;
+ case Panel_1600x1200 + 48: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11600x1200_2_H; break;
+ default: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11024x768_1; break;
}
tempah = (LCDACRT1Ptr+ResInfo)->CR[0];
- SiS_SetReg1(SiS_P3d4,0x00,tempah);
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x00,tempah);
for(i=0x01,j=1;i<=0x07;i++,j++){
tempah = (LCDACRT1Ptr+ResInfo)->CR[j];
- SiS_SetReg1(SiS_P3d4,i,tempah);
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,i,tempah);
}
for(i=0x10,j=8;i<=0x12;i++,j++){
tempah = (LCDACRT1Ptr+ResInfo)->CR[j];
- SiS_SetReg1(SiS_P3d4,i,tempah);
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,i,tempah);
}
for(i=0x15,j=11;i<=0x16;i++,j++){
tempah =(LCDACRT1Ptr+ResInfo)->CR[j];
- SiS_SetReg1(SiS_P3d4,i,tempah);
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,i,tempah);
}
for(i=0x0A,j=13;i<=0x0C;i++,j++){
tempah = (LCDACRT1Ptr+ResInfo)->CR[j];
- SiS_SetReg1(SiS_P3c4,i,tempah);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,i,tempah);
}
-
+
tempah = (LCDACRT1Ptr+ResInfo)->CR[16];
tempah &= 0x0E0;
- SiS_SetReg1(SiS_P3c4,0x0E,tempah);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x0E,tempah);
tempah = (LCDACRT1Ptr+ResInfo)->CR[16];
tempah &= 0x01;
tempah <<= 5;
if(modeflag & DoubleScanMode) tempah |= 0x080;
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,~0x020,tempah);
- SiS_SetRegANDOR(SiS_P3d4,0x09,~0x020,tempah);
- if(SiS_ModeType > 0x03) SiS_SetReg1(SiS_P3d4,0x14,0x4F);
+#endif
} else {
- /* LVDS, 301, 301B, 301LV, 302LV, (302B non-LCDA) */
+ /* LVDS, 301, 301B, 301LV, 302LV, ... (non-LCDA) */
- index = SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; /* Get index */
- if(HwDeviceExtension->jChipType < SIS_315H) {
- index &= 0x3F;
- }
+ if(SiS_Pr->UseCustomMode) {
+
+ for(i=0,j=0;i<=07;i++,j++) {
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,j,SiS_Pr->CCRT1CRTC[i]);
+ }
+ for(j=0x10;i<=10;i++,j++) {
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,j,SiS_Pr->CCRT1CRTC[i]);
+ }
+ for(j=0x15;i<=12;i++,j++) {
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,j,SiS_Pr->CCRT1CRTC[i]);
+ }
+ for(j=0x0A;i<=15;i++,j++) {
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,j,SiS_Pr->CCRT1CRTC[i]);
+ }
+
+ tempah = SiS_Pr->CCRT1CRTC[16] & 0xE0;
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x0E,tempah);
+
+ tempah = SiS_Pr->CCRT1CRTC[16];
+ tempah &= 0x01;
+ tempah <<= 5;
+ if(modeflag & DoubleScanMode) tempah |= 0x80;
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,0xDF,tempah);
+
+
+ } else {
+
+ index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; /* Get index */
+#if 0 /* Not any longer... */
+ if(HwDeviceExtension->jChipType < SIS_315H) {
+ index &= 0x3F;
+ }
+#endif
+
+ for(i=0,j=0;i<=07;i++,j++) {
+ tempah=SiS_Pr->SiS_CRT1Table[index].CR[i];
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,j,tempah);
+ }
+ for(j=0x10;i<=10;i++,j++) {
+ tempah=SiS_Pr->SiS_CRT1Table[index].CR[i];
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,j,tempah);
+ }
+ for(j=0x15;i<=12;i++,j++) {
+ tempah=SiS_Pr->SiS_CRT1Table[index].CR[i];
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,j,tempah);
+ }
+ for(j=0x0A;i<=15;i++,j++) {
+ tempah=SiS_Pr->SiS_CRT1Table[index].CR[i];
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,j,tempah);
+ }
+
+ tempah = SiS_Pr->SiS_CRT1Table[index].CR[16];
+ tempah &= 0xE0;
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x0E,tempah);
+
+ tempah = SiS_Pr->SiS_CRT1Table[index].CR[16];
+ tempah &= 0x01;
+ tempah <<= 5;
+ if(modeflag & DoubleScanMode) tempah |= 0x80;
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,0xDF,tempah);
- for(i=0,j=0;i<=07;i++,j++) {
- tempah=SiS_CRT1Table[index].CR[i];
- SiS_SetReg1(SiS_P3d4,j,tempah);
- }
- for(j=0x10;i<=10;i++,j++) {
- tempah=SiS_CRT1Table[index].CR[i];
- SiS_SetReg1(SiS_P3d4,j,tempah);
- }
- for(j=0x15;i<=12;i++,j++) {
- tempah=SiS_CRT1Table[index].CR[i];
- SiS_SetReg1(SiS_P3d4,j,tempah);
- }
- for(j=0x0A;i<=15;i++,j++) {
- tempah=SiS_CRT1Table[index].CR[i];
- SiS_SetReg1(SiS_P3c4,j,tempah);
}
+ }
- tempah = SiS_CRT1Table[index].CR[16];
- tempah &= 0xE0;
- SiS_SetReg1(SiS_P3c4,0x0E,tempah);
+ if(SiS_Pr->SiS_ModeType > ModeVGA) SiS_SetReg1(SiS_Pr->SiS_P3d4,0x14,0x4F);
+}
- tempah = SiS_CRT1Table[index].CR[16];
- tempah &= 0x01;
- tempah <<= 5;
- if(modeflag & DoubleScanMode) tempah |= 0x80;
- SiS_SetRegANDOR(SiS_P3d4,0x09,0xDF,tempah);
+BOOLEAN
+SiS_GetLCDACRT1Ptr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+ USHORT RefreshRateTableIndex,USHORT *ResInfo,
+ USHORT *DisplayType)
+ {
+ USHORT tempbx=0,modeflag=0;
+ USHORT CRT2CRTC=0;
- if(SiS_ModeType > 0x03) SiS_SetReg1(SiS_P3d4,0x14,0x4F);
+ if(ModeNo <= 0x13) {
+ modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
+ CRT2CRTC = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC;
+ } else {
+ modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ CRT2CRTC = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
}
+
+ tempbx = SiS_Pr->SiS_LCDResInfo;
+
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx += 32;
+ if(modeflag & HalfDCLK) tempbx += 16;
+
+ *ResInfo = CRT2CRTC & 0x3F;
+ *DisplayType = tempbx;
+
+ return 1;
}
/* TW: Set offset and pitch - partly overruled by SetPitch() in XF86 */
-/* TW: Checked against 650/LVDS (1.10.07), 650/301LV and 315 BIOS */
void
-SiS_SetCRT1Offset(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+SiS_SetCRT1Offset(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
USHORT RefreshRateTableIndex,
PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
USHORT temp, DisplayUnit, infoflag;
- infoflag = SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag;
-
- DisplayUnit = SiS_GetOffset(ROMAddr,ModeNo,ModeIdIndex,
- RefreshRateTableIndex,HwDeviceExtension);
+ if(SiS_Pr->UseCustomMode) {
+ infoflag = SiS_Pr->CInfoFlag;
+ } else {
+ infoflag = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag;
+ }
+
+ DisplayUnit = SiS_GetOffset(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,
+ RefreshRateTableIndex,HwDeviceExtension);
temp = (DisplayUnit >> 8) & 0x0f;
- SiS_SetRegANDOR(SiS_P3c4,0x0E,0xF0,temp);
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0E,0xF0,temp);
temp = DisplayUnit & 0xFF;
- SiS_SetReg1(SiS_P3d4,0x13,temp);
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x13,temp);
if(infoflag & InterlaceMode) DisplayUnit >>= 1;
@@ -2886,210 +3375,223 @@ SiS_SetCRT1Offset(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
temp = (DisplayUnit & 0xff00) >> 8;
if (DisplayUnit & 0xff) temp++;
temp++;
- SiS_SetReg1(SiS_P3c4,0x10,temp);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x10,temp);
}
/* TW: New from 650/LVDS 1.10.07, 630/301B and 630/LVDS BIOS */
void
-SiS_ResetCRT1VCLK(UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension)
+SiS_ResetCRT1VCLK(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
USHORT index;
/* TW: We only need to do this if Panel Link is to be
- * initialized, thus on 630/LVDS/301B, and 650/LVDS
+ * initialized, thus on 630/LVDS/301BDH, and 650/LVDS
*/
if(HwDeviceExtension->jChipType >= SIS_315H) {
- if (SiS_IF_DEF_LVDS == 0) return;
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 0) return;
} else {
- if( (SiS_IF_DEF_LVDS == 0) &&
- (!(SiS_VBType & VB_SIS301BLV302BLV)) ) {
- return;
+ if( (SiS_Pr->SiS_IF_DEF_LVDS == 0) &&
+ (!(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) ) {
+ return;
}
}
if(HwDeviceExtension->jChipType >= SIS_315H) {
- SiS_SetRegANDOR(SiS_P3c4,0x31,0xCF,0x20);
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x31,0xCF,0x20);
} else {
- SiS_SetReg1(SiS_P3c4,0x31,0x20);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x31,0x20);
}
index = 1;
- SiS_SetReg1(SiS_P3c4,0x2B,SiS_VCLKData[index].SR2B);
- SiS_SetReg1(SiS_P3c4,0x2C,SiS_VCLKData[index].SR2C);
- SiS_SetReg1(SiS_P3c4,0x2D,0x80);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2B,SiS_Pr->SiS_VCLKData[index].SR2B);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2C,SiS_Pr->SiS_VCLKData[index].SR2C);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2D,0x80);
if(HwDeviceExtension->jChipType >= SIS_315H) {
- SiS_SetRegANDOR(SiS_P3c4,0x31,0xcf,0x10);
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x31,0xcf,0x10);
} else {
- SiS_SetReg1(SiS_P3c4,0x31,0x10);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x31,0x10);
}
index = 0;
- SiS_SetReg1(SiS_P3c4,0x2B,SiS_VCLKData[index].SR2B);
- SiS_SetReg1(SiS_P3c4,0x2C,SiS_VCLKData[index].SR2C);
- SiS_SetReg1(SiS_P3c4,0x2D,0x80);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2B,SiS_Pr->SiS_VCLKData[index].SR2B);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2C,SiS_Pr->SiS_VCLKData[index].SR2C);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2D,0x80);
}
-/* TW: Checked against 650/LVDS, 650/301LV, 315, 630/301B, 630/LVDS BIOS */
void
-SiS_SetCRT1VCLK(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+SiS_SetCRT1VCLK(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
PSIS_HW_DEVICE_INFO HwDeviceExtension,
USHORT RefreshRateTableIndex)
{
- USHORT index;
+ USHORT index=0;
-#if 0 /* TW: Wrong. 650/301LV uses same table for LCDA and CRT1 */
- if( (SiS_VBType & VB_SIS301BLV302BLV)
- && (SiS_VBInfo & SetCRT2ToLCDA) ){
-
- /* TW: For 302B/302LV LCDA */
+ if(!SiS_Pr->UseCustomMode) {
+ index = SiS_GetVCLK2Ptr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,
+ RefreshRateTableIndex,HwDeviceExtension);
+ }
- index = SiS_GetVCLK2Ptr(ROMAddr,ModeNo,ModeIdIndex,
- RefreshRateTableIndex,HwDeviceExtension);
+ if( (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) ){
- SiS_SetRegAND(SiS_P3c4,0x31,0xCF);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x31,0xCF);
- SiS_SetReg1(SiS_P3c4,0x2B,SiS_VBVCLKData[index].Part4_A);
- SiS_SetReg1(SiS_P3c4,0x2C,SiS_VBVCLKData[index].Part4_B);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2B,SiS_Pr->SiS_VBVCLKData[index].Part4_A);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2C,SiS_Pr->SiS_VBVCLKData[index].Part4_B);
if(HwDeviceExtension->jChipType >= SIS_315H) {
- SiS_SetReg1(SiS_P3c4,0x2D,0x01);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2D,0x01);
} else {
- SiS_SetReg1(SiS_P3c4,0x2D,0x80);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2D,0x80);
}
} else {
-#endif
-
- index = SiS_GetVCLK2Ptr(ROMAddr,ModeNo,ModeIdIndex,
- RefreshRateTableIndex,HwDeviceExtension);
-
-#if 0 /* TW: All BIOSes use GetVCLK2Ptr instead */
- index = SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
- index &= 0x3F;
-#endif
if(HwDeviceExtension->jChipType >= SIS_315H) {
- SiS_SetRegAND(SiS_P3c4,0x31,0xCF);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x31,0xCF);
} else {
- SiS_SetReg1(SiS_P3c4,0x31,0x00);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x31,0x00);
}
- SiS_SetReg1(SiS_P3c4,0x2B,SiS_VCLKData[index].SR2B);
- SiS_SetReg1(SiS_P3c4,0x2C,SiS_VCLKData[index].SR2C);
+ if(SiS_Pr->UseCustomMode) {
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2B,SiS_Pr->CSR2B);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2C,SiS_Pr->CSR2C);
+ } else {
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2B,SiS_Pr->SiS_VCLKData[index].SR2B);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2C,SiS_Pr->SiS_VCLKData[index].SR2C);
+ }
if(HwDeviceExtension->jChipType >= SIS_315H) {
- SiS_SetReg1(SiS_P3c4,0x2D,0x01);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2D,0x01);
} else {
- SiS_SetReg1(SiS_P3c4,0x2D,0x80);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2D,0x80);
}
-#if 0
}
-#endif
}
#if 0 /* TW: Not used */
void
-SiS_IsLowResolution(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex)
+SiS_IsLowResolution(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex)
{
USHORT ModeFlag;
- SiS_SetRegAND(SiS_P3c4,0x0F,0x7F);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x0F,0x7F);
if(ModeNo > 0x13) {
- ModeFlag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ ModeFlag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
if ((ModeFlag & HalfDCLK) && (ModeFlag & DoubleScanMode)) {
- SiS_SetRegOR(SiS_P3c4,0x0F,0x80);
- SiS_SetRegAND(SiS_P3c4,0x01,0xF7);
+ SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x0F,0x80);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x01,0xF7);
}
}
}
#endif
-/* TW: Checked against 630/LVDS, 650/LVDS and 315 BIOS */
void
-SiS_SetCRT1ModeRegs(UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension,
+SiS_SetCRT1ModeRegs(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension,
USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex)
{
USHORT data,data2,data3;
USHORT infoflag=0,modeflag;
USHORT resindex,xres;
- if(ModeNo > 0x13) {
- modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
- infoflag = SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag;
+ if(SiS_Pr->UseCustomMode) {
+ modeflag = SiS_Pr->CModeFlag;
+ infoflag = SiS_Pr->CInfoFlag;
} else {
- modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
+ if(ModeNo > 0x13) {
+ modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ infoflag = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag;
+ } else {
+ modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
+ }
}
- SiS_SetRegAND(SiS_P3c4,0x1F,0x3F); /* DAC pedestal */
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1F,0x3F); /* DAC pedestal */
if(ModeNo > 0x13) data = infoflag;
else data = 0;
- data2 = SiS_GetReg1(SiS_P3c4,0x06) & 0xC0; /* TW: Preserve Xv display mode (DCLK/TCLK) ! */
+ data2 = 0;
if(ModeNo > 0x13) {
- if(SiS_ModeType > 0x02) {
+ if(SiS_Pr->SiS_ModeType > 0x02) {
data2 |= 0x02;
- data3 = (SiS_ModeType - ModeVGA) << 2;
+ data3 = (SiS_Pr->SiS_ModeType - ModeVGA) << 2;
data2 |= data3;
}
}
+#ifdef TWDEBUG
+ xf86DrvMsg(0, X_INFO, "Debug: Mode infoflag = %x, Chiptype %d\n",
+ data, HwDeviceExtension->jChipType);
+#endif
if(data & InterlaceMode) data2 |= 0x20;
- SiS_SetReg1(SiS_P3c4,0x06,data2);
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x06,0xC0,data2);
- resindex = SiS_GetResInfo(ROMAddr,ModeNo,ModeIdIndex);
- if(ModeNo <= 0x13) {
- xres = SiS_StResInfo[resindex].HTotal;
+ if(SiS_Pr->UseCustomMode) {
+ xres = SiS_Pr->CHDisplay;
} else {
- xres = SiS_ModeResInfo[resindex].HTotal;
+ resindex = SiS_GetResInfo(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex);
+ if(ModeNo <= 0x13) {
+ xres = SiS_Pr->SiS_StResInfo[resindex].HTotal;
+ } else {
+ xres = SiS_Pr->SiS_ModeResInfo[resindex].HTotal;
+ }
}
- data = 0x0000;
- if(infoflag & InterlaceMode) {
- if(xres == 1024) data = 0x0035;
- else data = 0x0048;
+ if(HwDeviceExtension->jChipType != SIS_300) {
+ data = 0x0000;
+ if(infoflag & InterlaceMode) {
+ if(xres == 1024) data = 0x0035;
+ else data = 0x0048;
+ }
+ data2 = data & 0x00FF;
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x19,data2);
+ data2 = (data & 0xFF00) >> 8;
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x1a,0xFC,data2);
}
- data2 = data & 0x00FF;
- SiS_SetReg1(SiS_P3d4,0x19,data2);
- data2 = (data & 0xFF00) >> 8;
- SiS_SetRegANDOR(SiS_P3d4,0x1a,0xFC,data2);
if(modeflag & HalfDCLK) {
- SiS_SetRegOR(SiS_P3c4,0x01,0x08);
+ SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x01,0x08);
}
- if(HwDeviceExtension->jChipType < SIS_315H) {
+ if(HwDeviceExtension->jChipType == SIS_300) {
if(modeflag & LineCompareOff) {
- SiS_SetRegANDOR(SiS_P3c4,0x0F,0xB7,0x08);
+ SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x0F,0x08);
} else {
- SiS_SetRegAND(SiS_P3c4,0x0F,0xB7);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x0F,0xF7);
+ }
+ } else if(HwDeviceExtension->jChipType < SIS_315H) {
+ if(modeflag & LineCompareOff) {
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0F,0xB7,0x08);
+ } else {
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x0F,0xB7);
}
/* 630 BIOS does something for mode 0x12 here */
} else {
if(modeflag & LineCompareOff) {
- SiS_SetRegANDOR(SiS_P3c4,0x0F,0xB7,0x08);
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0F,0xB7,0x08);
} else {
- SiS_SetRegAND(SiS_P3c4,0x0F,0xB7);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x0F,0xB7);
}
}
- if(SiS_ModeType == ModeEGA) {
- if(ModeNo > 0x13) {
- SiS_SetRegOR(SiS_P3c4,0x0F,0x40);
+ if(HwDeviceExtension->jChipType != SIS_300) {
+ if(SiS_Pr->SiS_ModeType == ModeEGA) {
+ if(ModeNo > 0x13) {
+ SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x0F,0x40);
+ }
}
}
- /* TW: 315 BIOS sets SR17 here (0x18bf) */
#ifdef SIS315H
+ /* TW: 315 BIOS sets SR17 at this point */
if(HwDeviceExtension->jChipType == SIS_315PRO) {
- data = SiS_Get310DRAMType(ROMAddr,HwDeviceExtension);
- data = SiS_SR15[2][data];
- if(SiS_ModeType == ModeText) {
+ data = SiS_Get310DRAMType(SiS_Pr,ROMAddr,HwDeviceExtension);
+ data = SiS_Pr->SiS_SR15[2][data];
+ if(SiS_Pr->SiS_ModeType == ModeText) {
data &= 0xc7;
} else {
- data2 = SiS_GetOffset(ROMAddr,ModeNo,ModeIdIndex,
+ data2 = SiS_GetOffset(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,
RefreshRateTableIndex,HwDeviceExtension);
data2 >>= 1;
if(infoflag & InterlaceMode) data2 >>= 1;
- data3 = SiS_GetColorDepth(ROMAddr,ModeNo,ModeIdIndex);
+ data3 = SiS_GetColorDepth(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex);
data3 >>= 1;
if(data3 == 0) data3++;
data2 /= data3;
@@ -3098,36 +3600,78 @@ SiS_SetCRT1ModeRegs(UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension,
data |= 0x50;
}
}
- SiS_SetReg1(SiS_P3c4,0x17,data);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x17,data);
+ }
+
+ /* TW: 330 BIOS sets SR17 at this point */
+ if(HwDeviceExtension->jChipType == SIS_330) {
+ data = SiS_Get310DRAMType(SiS_Pr,ROMAddr,HwDeviceExtension);
+ data = SiS_Pr->SiS_SR15[2][data];
+ if(SiS_Pr->SiS_ModeType <= ModeEGA) {
+ data &= 0xc7;
+ } else {
+ if(SiS_Pr->UseCustomMode) {
+ data2 = SiS_Pr->CSRClock;
+ } else {
+ data2 = SiS_GetVCLK2Ptr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,
+ RefreshRateTableIndex,HwDeviceExtension);
+ data2 = SiS_Pr->SiS_VCLKData[data2].CLOCK;
+ }
+
+ data3 = SiS_GetColorDepth(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex);
+ data3 >>= 1;
+
+ data2 *= data3;
+
+ data3 = SiS_GetMCLK(SiS_Pr,ROMAddr, HwDeviceExtension);
+ data3 *= 1024;
+
+ data2 = data3 / data2;
+
+ if(SiS_Pr->SiS_ModeType != Mode16Bpp) {
+ if(data2 >= 0x19c) data = 0xba;
+ else if(data2 >= 0x140) data = 0x7a;
+ else if(data2 >= 0x101) data = 0x3a;
+ else if(data2 >= 0xf5) data = 0x32;
+ else if(data2 >= 0xe2) data = 0x2a;
+ else if(data2 >= 0xc4) data = 0x22;
+ else if(data2 >= 0xac) data = 0x1a;
+ else if(data2 >= 0x9e) data = 0x12;
+ else if(data2 >= 0x8e) data = 0x0a;
+ else data = 0x02;
+ } else {
+ if(data2 >= 0x127) data = 0xba;
+ else data = 0x7a;
+ }
+ }
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x17,data);
}
#endif
data = 0x60;
- if(SiS_ModeType != ModeText) {
- data = data ^ 0x60;
- if(SiS_ModeType != ModeEGA) {
- data = data ^ 0xA0;
+ if(SiS_Pr->SiS_ModeType != ModeText) {
+ data ^= 0x60;
+ if(SiS_Pr->SiS_ModeType != ModeEGA) {
+ data ^= 0xA0;
}
}
- SiS_SetRegANDOR(SiS_P3c4,0x21,0x1F,data);
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x21,0x1F,data);
- SiS_SetVCLKState(ROMAddr,HwDeviceExtension,ModeNo,RefreshRateTableIndex,ModeIdIndex);
+ SiS_SetVCLKState(SiS_Pr,ROMAddr,HwDeviceExtension,ModeNo,RefreshRateTableIndex,ModeIdIndex);
#ifdef SIS315H
- /* TW: New */
if(HwDeviceExtension->jChipType >= SIS_315H) {
- if (SiS_GetReg1(SiS_P3d4,0x31) & 0x40) {
- SiS_SetReg1(SiS_P3d4,0x52,0x2c);
+ if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x31) & 0x40) {
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x52,0x2c);
} else {
- SiS_SetReg1(SiS_P3d4,0x52,0x6c);
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x52,0x6c);
}
}
#endif
}
-/* TW: Checked against 315, 650/LVDS, 650/301LV, 630/301B and 630/LVDS BIOS */
void
-SiS_SetVCLKState(UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension,
+SiS_SetVCLKState(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension,
USHORT ModeNo,USHORT RefreshRateTableIndex,
USHORT ModeIdIndex)
{
@@ -3136,36 +3680,39 @@ SiS_SetVCLKState(UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension,
if (ModeNo <= 0x13) VCLK = 0;
else {
- index = SiS_GetVCLK2Ptr(ROMAddr,ModeNo,ModeIdIndex,
+ if(SiS_Pr->UseCustomMode) {
+ VCLK = SiS_Pr->CSRClock;
+ } else {
+ index = SiS_GetVCLK2Ptr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,
RefreshRateTableIndex,HwDeviceExtension);
- VCLK = SiS_VCLKData[index].CLOCK;
+ VCLK = SiS_Pr->SiS_VCLKData[index].CLOCK;
+ }
}
if(HwDeviceExtension->jChipType < SIS_315H) { /* 300 series */
data2 = 0x00;
if(VCLK > 150) data2 |= 0x80;
- SiS_SetRegANDOR(SiS_P3c4,0x07,0x7B,data2); /* DAC speed */
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x07,0x7B,data2); /* DAC speed */
data2 = 0x00;
if(VCLK >= 150) data2 |= 0x08; /* VCLK > 150 */
- SiS_SetRegANDOR(SiS_P3c4,0x32,0xF7,data2);
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x32,0xF7,data2);
} else { /* 310/325 series */
- data = SiS_GetReg1(SiS_P3c4,0x32);
- data &= 0xf3;
- if(VCLK >= 166) data |= 0x0c; /* TW: Was 200; is 166 in 650 and 315 BIOSes */
- SiS_SetReg1(SiS_P3c4,0x32,data);
+ data = 0;
+ if(VCLK >= 166) data |= 0x0c; /* TW: Was 200; is 166 in 650, 315 and 330 BIOSes */
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x32,0xf3,data);
- if(VCLK >= 166) { /* TW: Was 200, is 166 in 650 and 315 BIOSes */
- SiS_SetRegAND(SiS_P3c4,0x1f,0xe7);
+ if(VCLK >= 166) { /* TW: Was 200, is 166 in 650, 315 and 330 BIOSes */
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1f,0xe7);
}
#if 0 /* Not done in 315 and 650/301LV/LVDS BIOSes: */
- data = SiS_GetReg1(SiS_P3c4,0x1F); /* DAC pedestal */
+ data = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1F); /* DAC pedestal */
data &= 0xE7;
if(VCLK<200) data |= 0x10;
- SiS_SetReg1(SiS_P3c4,0x1F,data); /* DAC pedestal */
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1F,data); /* DAC pedestal */
#endif
}
@@ -3173,36 +3720,46 @@ SiS_SetVCLKState(UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension,
if((VCLK >= 135) && (VCLK < 160)) data2 = 0x02;
if((VCLK >= 160) && (VCLK < 260)) data2 = 0x01;
if(VCLK >= 260) data2 = 0x00;
- /* disable 24bit palette RAM gamma correction */
+
if(HwDeviceExtension->jChipType == SIS_540) {
if((VCLK == 203) || (VCLK < 234)) data2 = 0x02;
}
+
if(HwDeviceExtension->jChipType < SIS_315H) {
- SiS_SetRegANDOR(SiS_P3c4,0x07,0xFC,data2); /* DAC speed */
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x07,0xFC,data2); /* DAC speed */
} else {
- /* TW: This is done in 650/LVDS/301LV BIOSes; Not in 315 BIOS */
- if(ModeNo > 13) data2 &= 0xfc;
- SiS_SetRegANDOR(SiS_P3c4,0x07,0xF8,data2); /* DAC speed */
+ if(HwDeviceExtension->jChipType > SIS_315PRO) {
+ /* TW: This "if" is done in 330 and 650/LVDS/301LV BIOSes; Not in 315 BIOS */
+ if(ModeNo > 0x13) data2 &= 0xfc;
+ }
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x07,0xF8,data2); /* DAC speed */
}
}
void
-SiS_LoadDAC(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex)
+SiS_LoadDAC(SiS_Private *SiS_Pr,PSIS_HW_DEVICE_INFO HwDeviceExtension,
+ UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex)
{
USHORT data,data2;
USHORT time,i,j,k;
USHORT m,n,o;
USHORT si,di,bx,dl;
USHORT al,ah,dh;
- USHORT *table=NULL;
+ USHORT DACAddr, DACData, shiftflag;
+ const USHORT *table = NULL;
#if 0
USHORT tempah,tempch,tempcl,tempdh,tempal,tempbx;
#endif
- if (ModeNo<=0x13)
- data = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
- else
- data = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ if(ModeNo <= 0x13) {
+ data = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
+ } else {
+ if(SiS_Pr->UseCustomMode) {
+ data = SiS_Pr->CModeFlag;
+ } else {
+ data = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ }
+ }
#if 0
if(!(ds:489 & 0x08)) {
@@ -3218,10 +3775,23 @@ SiS_LoadDAC(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex)
table = SiS_VGA_DAC;
}
if(time == 256) j = 16;
- else j = time;
+ else j = time;
+
+ if( ( (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) && /* 301B-DH LCD */
+ (SiS_Pr->SiS_VBType & VB_NoLCD) ) ||
+ (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) || /* LCDA */
+ (!(SiS_Pr->SiS_SetFlag & ProgrammingCRT2)) ) { /* Programming CRT1 */
+ DACAddr = SiS_Pr->SiS_P3c8;
+ DACData = SiS_Pr->SiS_P3c9;
+ shiftflag = 0;
+ SiS_SetReg3(SiS_Pr->SiS_P3c6,0xFF);
+ } else {
+ shiftflag = 1;
+ DACAddr = SiS_Pr->SiS_Part5Port;
+ DACData = SiS_Pr->SiS_Part5Port + 1;
+ }
- SiS_SetReg3(SiS_P3c6,0xFF);
- SiS_SetReg3(SiS_P3c8,0x00);
+ SiS_SetReg3(DACAddr,0x00);
for(i=0; i<j; i++) {
data = table[i];
@@ -3229,41 +3799,43 @@ SiS_LoadDAC(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex)
data2 = 0;
if(data & 0x01) data2 = 0x2A;
if(data & 0x02) data2 += 0x15;
- SiS_SetReg3(SiS_P3c9,data2);
+ if(shiftflag) data2 <<= 2;
+ SiS_SetReg3(DACData,data2);
data >>= 2;
}
}
if(time == 256) {
- for(i=16; i<32; i++) {
+ for(i = 16; i < 32; i++) {
data = table[i];
- for(k=0; k<3; k++) SiS_SetReg3(SiS_P3c9,data);
+ if(shiftflag) data <<= 2;
+ for(k=0; k<3; k++) SiS_SetReg3(DACData,data);
}
si = 32;
- for(m=0; m<9; m++) {
+ for(m = 0; m < 9; m++) {
di = si;
- bx = si+0x04;
+ bx = si + 4;
dl = 0;
- for(n=0; n<3; n++) {
- for(o=0; o<5; o++) {
+ for(n = 0; n < 3; n++) {
+ for(o = 0; o < 5; o++) {
dh = table[si];
ah = table[di];
al = table[bx];
si++;
- SiS_WriteDAC(dl,ah,al,dh);
- } /* for 5 */
- si = si - 2;
- for(o=0; o<3; o++) {
+ SiS_WriteDAC(SiS_Pr,DACData,shiftflag,dl,ah,al,dh);
+ }
+ si -= 2;
+ for(o = 0; o < 3; o++) {
dh = table[bx];
ah = table[di];
al = table[si];
si--;
- SiS_WriteDAC(dl,ah,al,dh);
- } /* for 3 */
+ SiS_WriteDAC(SiS_Pr,DACData,shiftflag,dl,ah,al,dh);
+ }
dl++;
- } /* for 3 */
- si = si + 5;
- } /* for 9 */
+ } /* for n < 3 */
+ si += 5;
+ } /* for m < 9 */
}
#if 0
} /* ds:489 & 0x08 */
@@ -3273,10 +3845,10 @@ SiS_LoadDAC(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex)
if((!(ds:489 & 0x08)) && (ds:489 & 0x06)) {
tempbx = 0;
for(i=0; i< 256; i++) {
- SiS_SetReg3(SiS_P3c8-1,tempbx); /* 7f87 */
- tempah = SiS_GetReg3(SiS_P3c8+1); /* 7f83 */
- tempch = SiS_GetReg3(SiS_P3c8+1);
- tempcl = SiS_GetReg3(SiS_P3c8+1);
+ SiS_SetReg3(SiS_Pr->SiS_P3c8-1,tempbx); /* 7f87 */
+ tempah = SiS_GetReg3(SiS_Pr->SiS_P3c8+1); /* 7f83 */
+ tempch = SiS_GetReg3(SiS_Pr->SiS_P3c8+1);
+ tempcl = SiS_GetReg3(SiS_Pr->SiS_P3c8+1);
tempdh = tempah;
tempal = 0x4d * tempdh; /* 7fb8 */
tempbx += tempal;
@@ -3288,65 +3860,90 @@ SiS_LoadDAC(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex)
tempdh = (tempbx & 0x00ff) >> 8;
tempch = tempdh;
tempcl = tempdh;
- SiS_SetReg3(SiS_P3c8,(tempbx & 0xff)); /* 7f7c */
- SiS_SetReg3(SiS_P3c8+1,tempdh); /* 7f92 */
- SiS_SetReg3(SiS_P3c8+1,tempch);
- SiS_SetReg3(SiS_P3c8+1,tempcl);
+ SiS_SetReg3(SiS_Pr->SiS_P3c8,(tempbx & 0xff)); /* 7f7c */
+ SiS_SetReg3(SiS_Pr->SiS_P3c8+1,tempdh); /* 7f92 */
+ SiS_SetReg3(SiS_Pr->SiS_P3c8+1,tempch);
+ SiS_SetReg3(SiS_Pr->SiS_P3c8+1,tempcl);
}
}
#endif
}
void
-SiS_WriteDAC(USHORT dl, USHORT ah, USHORT al, USHORT dh)
+SiS_WriteDAC(SiS_Private *SiS_Pr, USHORT DACData, USHORT shiftflag,
+ USHORT dl, USHORT ah, USHORT al, USHORT dh)
{
USHORT temp;
USHORT bh,bl;
- bh=ah;
- bl=al;
- if(dl!=0) {
- temp=bh;
- bh=dh;
- dh=temp;
- if(dl==1) {
- temp=bl;
- bl=dh;
- dh=temp;
+ bh = ah;
+ bl = al;
+ if(dl != 0) {
+ temp = bh;
+ bh = dh;
+ dh = temp;
+ if(dl == 1) {
+ temp = bl;
+ bl = dh;
+ dh = temp;
} else {
- temp=bl;
- bl=bh;
- bh=temp;
+ temp = bl;
+ bl = bh;
+ bh = temp;
}
}
- SiS_SetReg3(SiS_P3c9,(USHORT)dh);
- SiS_SetReg3(SiS_P3c9,(USHORT)bh);
- SiS_SetReg3(SiS_P3c9,(USHORT)bl);
+ if(shiftflag) {
+ dh <<= 2;
+ bh <<= 2;
+ bl <<= 2;
+ }
+ SiS_SetReg3(DACData,(USHORT)dh);
+ SiS_SetReg3(DACData,(USHORT)bh);
+ SiS_SetReg3(DACData,(USHORT)bl);
}
-ULONG
-GetDRAMSize(PSIS_HW_DEVICE_INFO HwDeviceExtension)
+static ULONG
+GetDRAMSize(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
- ULONG AdapterMemorySize=0;
+ ULONG AdapterMemorySize = 0;
#ifdef SIS315H
USHORT counter;
#endif
-
+
#ifdef SIS315H
if ((HwDeviceExtension->jChipType == SIS_315H) ||
+ (HwDeviceExtension->jChipType == SIS_315) ||
(HwDeviceExtension->jChipType == SIS_315PRO)) {
- counter = SiS_GetReg1(SiS_P3c4,0x14) & 0xF0;
- counter >>= 4;
- AdapterMemorySize= 1 << counter;
- AdapterMemorySize *= 1024*1024;
+
+ counter = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14);
+ AdapterMemorySize = 1 << ((counter & 0xF0) >> 4);
+ counter >>= 2;
+ counter &= 0x03;
+ if(counter == 0x02) {
+ AdapterMemorySize += (AdapterMemorySize / 2); /* DDR asymetric */
+ } else if(counter != 0) {
+ AdapterMemorySize <<= 1; /* SINGLE_CHANNEL_2_RANK or DUAL_CHANNEL_1_RANK */
+ }
+ AdapterMemorySize *= (1024*1024);
+
+ } else if(HwDeviceExtension->jChipType == SIS_330) {
+
+ counter = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14);
+ AdapterMemorySize = 1 << ((counter & 0xF0) >> 4);
+ counter &= 0x0c;
+ if(counter != 0) {
+ AdapterMemorySize <<= 1;
+ }
+ AdapterMemorySize *= (1024*1024);
+
} else if((HwDeviceExtension->jChipType == SIS_550) ||
- (HwDeviceExtension->jChipType == SIS_640) ||
(HwDeviceExtension->jChipType == SIS_740) ||
(HwDeviceExtension->jChipType == SIS_650)) {
- counter = SiS_GetReg1(SiS_P3c4,0x14) & 0x3F;
- counter++;
- AdapterMemorySize = counter * 4;
- AdapterMemorySize *= 1024*1024;
+
+ counter = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14) & 0x3F;
+ counter++;
+ AdapterMemorySize = counter * 4;
+ AdapterMemorySize *= (1024*1024);
}
#endif
@@ -3355,27 +3952,29 @@ GetDRAMSize(PSIS_HW_DEVICE_INFO HwDeviceExtension)
(HwDeviceExtension->jChipType==SIS_540) ||
(HwDeviceExtension->jChipType==SIS_630) ||
(HwDeviceExtension->jChipType==SIS_730)) {
- AdapterMemorySize = SiS_GetReg1(SiS_P3c4,0x14);
- AdapterMemorySize = AdapterMemorySize&0x3F;
+
+ AdapterMemorySize = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14) & 0x3F;
AdapterMemorySize++;
- AdapterMemorySize *= 1024*1024;
+ AdapterMemorySize *= (1024*1024);
+
}
#endif
return AdapterMemorySize;
}
+#ifndef LINUX_XF86
void
-SiS_ClearBuffer(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo)
+SiS_ClearBuffer(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo)
{
PVOID VideoMemoryAddress = (PVOID)HwDeviceExtension->pjVideoMemoryAddress;
ULONG AdapterMemorySize = (ULONG)HwDeviceExtension->ulVideoMemorySize;
PUSHORT pBuffer;
int i;
- if (SiS_ModeType>=ModeEGA) {
- if (ModeNo>0x13) {
- AdapterMemorySize = GetDRAMSize(HwDeviceExtension);
+ if (SiS_Pr->SiS_ModeType>=ModeEGA) {
+ if(ModeNo > 0x13) {
+ AdapterMemorySize = GetDRAMSize(SiS_Pr, HwDeviceExtension);
SiS_SetMemory(VideoMemoryAddress,AdapterMemorySize,0);
} else {
pBuffer = VideoMemoryAddress;
@@ -3384,7 +3983,7 @@ SiS_ClearBuffer(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo)
}
} else {
pBuffer = VideoMemoryAddress;
- if (SiS_ModeType < ModeCGA) {
+ if (SiS_Pr->SiS_ModeType < ModeCGA) {
for(i=0; i<0x4000; i++)
pBuffer[i] = 0x0720;
} else {
@@ -3392,17 +3991,18 @@ SiS_ClearBuffer(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo)
}
}
}
+#endif
void
-SiS_DisplayOn(void)
+SiS_DisplayOn(SiS_Private *SiS_Pr)
{
- SiS_SetRegANDOR(SiS_P3c4,0x01,0xDF,0x00);
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x01,0xDF,0x00);
}
void
-SiS_DisplayOff(void)
+SiS_DisplayOff(SiS_Private *SiS_Pr)
{
- SiS_SetRegANDOR(SiS_P3c4,0x01,0xDF,0x20);
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x01,0xDF,0x20);
}
@@ -3418,12 +4018,12 @@ SiS_SetReg1(USHORT port, USHORT index, USHORT data)
/* ========================================== */
/* AR(3C0) */
void
-SiS_SetReg2(USHORT port, USHORT index, USHORT data)
+SiS_SetReg2(SiS_Private *SiS_Pr, USHORT port, USHORT index, USHORT data)
{
InPortByte(port+0x3da-0x3c0);
- OutPortByte(SiS_P3c0,index);
- OutPortByte(SiS_P3c0,data);
- OutPortByte(SiS_P3c0,0x20);
+ OutPortByte(SiS_Pr->SiS_P3c0,index);
+ OutPortByte(SiS_Pr->SiS_P3c0,data);
+ OutPortByte(SiS_Pr->SiS_P3c0,0x20);
}
void
@@ -3438,6 +4038,12 @@ SiS_SetReg4(USHORT port, ULONG data)
OutPortLong(port,data);
}
+void
+SiS_SetReg5(USHORT port, USHORT data)
+{
+ OutPortWord(port,data);
+}
+
UCHAR SiS_GetReg1(USHORT port, USHORT index)
{
UCHAR data;
@@ -3468,29 +4074,39 @@ SiS_GetReg3(USHORT port)
return(data);
}
+USHORT
+SiS_GetReg4(USHORT port)
+{
+ ULONG data;
+
+ data = InPortWord(port);
+
+ return(data);
+}
+
void
-SiS_ClearDAC(ULONG port)
+SiS_ClearDAC(SiS_Private *SiS_Pr, ULONG port)
{
int i;
OutPortByte(port, 0);
port++;
- for (i=0; i<256*3; i++) {
+ for (i=0; i < (256 * 3); i++) {
OutPortByte(port, 0);
}
}
-/* ========================================== */
-#if 0 /* TW: Not done in any BIOS */
+
+#if 0 /* TW: Unused */
void
-SiS_SetInterlace(UCHAR *ROMAddr,USHORT ModeNo,USHORT RefreshRateTableIndex)
+SiS_SetInterlace(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT RefreshRateTableIndex)
{
ULONG Temp;
USHORT data,Temp2;
if (ModeNo<=0x13) return;
- Temp = (ULONG)SiS_GetReg1(SiS_P3d4,0x01);
+ Temp = (ULONG)SiS_GetReg1(SiS_Pr->SiS_P3d4,0x01);
Temp++;
Temp <<= 3;
@@ -3498,66 +4114,200 @@ SiS_SetInterlace(UCHAR *ROMAddr,USHORT ModeNo,USHORT RefreshRateTableIndex)
else if(Temp == 1280) data = 0x0048;
else data = 0x0000;
- Temp2 = SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag;
+ Temp2 = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag;
Temp2 &= InterlaceMode;
if(Temp2 == 0) data=0x0000;
- SiS_SetReg1(SiS_P3d4,0x19,data);
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x19,data);
- Temp = (ULONG)SiS_GetReg1(SiS_P3d4,0x1A);
+ Temp = (ULONG)SiS_GetReg1(SiS_Pr->SiS_P3d4,0x1A);
Temp = (USHORT)(Temp & 0xFC);
- SiS_SetReg1(SiS_P3d4,0x1A,(USHORT)Temp);
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x1A,(USHORT)Temp);
- Temp = (ULONG)SiS_GetReg1(SiS_P3c4,0x0f);
+ Temp = (ULONG)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x0f);
Temp2 = (USHORT)Temp & 0xBF;
if(ModeNo==0x37) Temp2 |= 0x40;
- SiS_SetReg1(SiS_P3d4,0x1A,(USHORT)Temp2);
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x1A,(USHORT)Temp2);
}
#endif
-/* TW: Checked against 650/LVDS (1.10.07), 650/301LV and 315 BIOS */
#ifdef SIS315H
void
-SiS_SetCRT1FIFO_310(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+SiS_SetCRT1FIFO_310(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
USHORT modeflag;
- SiS_SetRegAND(SiS_P3c4,0x3D,0xFE); /* disable auto-threshold */
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x3D,0xFE); /* disable auto-threshold */
if(ModeNo > 0x13) {
- modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ if(SiS_Pr->UseCustomMode) {
+ modeflag = SiS_Pr->CModeFlag;
+ } else {
+ modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ }
if( (!(modeflag & DoubleScanMode)) || (!(modeflag & HalfDCLK))) {
- SiS_SetReg1(SiS_P3c4,0x08,0x34);
- SiS_SetRegAND(SiS_P3c4,0x09,0xF0);
- SiS_SetRegOR(SiS_P3c4,0x3D,0x01);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x08,0x34);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x09,0xF0);
+ SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x3D,0x01);
} else {
- SiS_SetReg1(SiS_P3c4,0x08,0xAE);
- SiS_SetRegAND(SiS_P3c4,0x09,0xF0);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x08,0xAE);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x09,0xF0);
}
} else {
- SiS_SetReg1(SiS_P3c4,0x08,0xAE);
- SiS_SetRegAND(SiS_P3c4,0x09,0xF0);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x08,0xAE);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x09,0xF0);
}
}
#endif
-#if 0 /* TW: Unused */
+#ifdef SIS300
+void
+SiS_SetCRT1FIFO_300(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,PSIS_HW_DEVICE_INFO HwDeviceExtension,
+ USHORT RefreshRateTableIndex)
+{
+ USHORT ThresholdLow = 0;
+ USHORT index, VCLK, MCLK, colorth=0;
+ USHORT tempah, temp;
+
+ if(ModeNo > 0x13) {
+
+ if(SiS_Pr->UseCustomMode) {
+ VCLK = SiS_Pr->CSRClock;
+ } else {
+ index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
+ index &= 0x3F;
+ VCLK = SiS_Pr->SiS_VCLKData[index].CLOCK; /* Get VCLK */
+ }
+
+ switch (SiS_Pr->SiS_ModeType - ModeEGA) { /* Get half colordepth */
+ case 0 : colorth = 1; break;
+ case 1 : colorth = 1; break;
+ case 2 : colorth = 2; break;
+ case 3 : colorth = 2; break;
+ case 4 : colorth = 3; break;
+ case 5 : colorth = 4; break;
+ }
+
+ index = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x3A);
+ index &= 0x07;
+ MCLK = SiS_Pr->SiS_MCLKData_0[index].CLOCK; /* Get MCLK */
+
+ tempah = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x35);
+ tempah &= 0xc3;
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x16,0x3c,tempah);
+
+ do {
+ ThresholdLow = SiS_CalcDelay(SiS_Pr, ROMAddr, VCLK, colorth, MCLK);
+ ThresholdLow++;
+ if(ThresholdLow < 0x13) break;
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x16,0xfc);
+ ThresholdLow = 0x13;
+ tempah = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16);
+ tempah >>= 6;
+ if(!(tempah)) break;
+ tempah--;
+ tempah <<= 6;
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x16,0x3f,tempah);
+ } while(0);
+
+ } else ThresholdLow = 2;
+
+ /* Write CRT/CPU threshold low, CRT/Engine threshold high */
+ temp = (ThresholdLow << 4) | 0x0f;
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x08,temp);
+
+ temp = (ThresholdLow & 0x10) << 1;
+ if(ModeNo > 0x13) temp |= 0x40;
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0f,0x9f,temp);
+
+ /* What is this? */
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x3B,0x09);
+
+ /* Write CRT/CPU threshold high */
+ temp = ThresholdLow + 3;
+ if(temp > 0x0f) temp = 0x0f;
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x09,temp);
+}
+
USHORT
-SiS_CalcDelay(UCHAR *ROMAddr,USHORT key)
+SiS_CalcDelay(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT VCLK, USHORT colordepth, USHORT MCLK)
+{
+ USHORT tempax, tempbx;
+
+ tempbx = SiS_DoCalcDelay(SiS_Pr, MCLK, VCLK, colordepth, 0);
+ tempax = SiS_DoCalcDelay(SiS_Pr, MCLK, VCLK, colordepth, 1);
+ if(tempax < 4) tempax = 4;
+ tempax -= 4;
+ if(tempbx < tempax) tempbx = tempax;
+ return(tempbx);
+}
+
+USHORT
+SiS_DoCalcDelay(SiS_Private *SiS_Pr, USHORT MCLK, USHORT VCLK, USHORT colordepth, USHORT key)
+{
+ const UCHAR ThLowA[] = { 61, 3,52, 5,68, 7,100,11,
+ 43, 3,42, 5,54, 7, 78,11,
+ 34, 3,37, 5,47, 7, 67,11 };
+
+ const UCHAR ThLowB[] = { 81, 4,72, 6,88, 8,120,12,
+ 55, 4,54, 6,66, 8, 90,12,
+ 42, 4,45, 6,55, 8, 75,12 };
+
+ const UCHAR ThTiming[] = { 1, 2, 2, 3, 0, 1, 1, 2 };
+
+ USHORT tempah, tempal, tempcl, tempbx, temp;
+ ULONG longtemp;
+
+ tempah = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x18);
+ tempah &= 0x62;
+ tempah >>= 1;
+ tempal = tempah;
+ tempah >>= 3;
+ tempal |= tempah;
+ tempal &= 0x07;
+ tempcl = ThTiming[tempal];
+ tempbx = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16);
+ tempbx >>= 6;
+ tempah = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14);
+ tempah >>= 4;
+ tempah &= 0x0c;
+ tempbx |= tempah;
+ tempbx <<= 1;
+ if(key == 0) {
+ tempal = ThLowA[tempbx + 1];
+ tempal *= tempcl;
+ tempal += ThLowA[tempbx];
+ } else {
+ tempal = ThLowB[tempbx + 1];
+ tempal *= tempcl;
+ tempal += ThLowB[tempbx];
+ }
+ longtemp = tempal * VCLK * colordepth;
+ temp = longtemp % (MCLK * 16);
+ longtemp /= (MCLK * 16);
+ if(temp) longtemp++;
+ return((USHORT)longtemp);
+}
+
+#if 0 /* TW: Old fragment, unused */
+USHORT
+SiS_CalcDelay(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT key)
{
USHORT data,data2,temp0,temp1;
UCHAR ThLowA[]= {61,3,52,5,68,7,100,11,
43,3,42,5,54,7, 78,11,
34,3,37,5,47,7, 67,11};
+
UCHAR ThLowB[]= {81,4,72,6,88,8,120,12,
55,4,54,6,66,8, 90,12,
42,4,45,6,55,8, 75,12};
+
UCHAR ThTiming[]= {1,2,2,3,0,1,1,2};
- data=SiS_GetReg1(SiS_P3c4,0x16);
+ data=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16);
data=data>>6;
- data2=SiS_GetReg1(SiS_P3c4,0x14);
+ data2=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14);
data2=(data2>>4)&0x0C;
data=data|data2;
data=data<1;
@@ -3570,7 +4320,7 @@ SiS_CalcDelay(UCHAR *ROMAddr,USHORT key)
}
data2=0;
- data=SiS_GetReg1(SiS_P3c4,0x18);
+ data=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x18);
if(data&0x02) data2=data2|0x01;
if(data&0x20) data2=data2|0x02;
if(data&0x40) data2=data2|0x04;
@@ -3580,30 +4330,45 @@ SiS_CalcDelay(UCHAR *ROMAddr,USHORT key)
}
#endif
-#ifdef SIS300
void
-SiS_SetCRT1FIFO_300(UCHAR *ROMAddr,USHORT ModeNo,PSIS_HW_DEVICE_INFO HwDeviceExtension,
+SiS_SetCRT1FIFO_630(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,
+ PSIS_HW_DEVICE_INFO HwDeviceExtension,
USHORT RefreshRateTableIndex)
{
USHORT i,index,data,VCLK,MCLK,colorth=0;
ULONG B,eax,bl,data2;
USHORT ThresholdLow=0;
- UCHAR FQBQData[]= { 0x01,0x21,0x41,0x61,0x81,
- 0x31,0x51,0x71,0x91,0xb1,
- 0x00,0x20,0x40,0x60,0x80,
- 0x30,0x50,0x70,0x90,0xb0,0xFF};
+ UCHAR FQBQData[]= {
+ 0x01,0x21,0x41,0x61,0x81,
+ 0x31,0x51,0x71,0x91,0xb1,
+ 0x00,0x20,0x40,0x60,0x80,
+ 0x30,0x50,0x70,0x90,0xb0,
+ 0xFF
+ };
+ UCHAR FQBQData730[]= {
+ 0x34,0x74,0xb4,
+ 0x23,0x63,0xa3,
+ 0x12,0x52,0x92,
+ 0x01,0x41,0x81,
+ 0x00,0x40,0x80,
+ 0xff
+ };
i=0;
- if(ModeNo >= 0x13) {
- index = SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
- index &= 0x3F;
- VCLK = SiS_VCLKData[index].CLOCK; /* Get VCLK */
+ if(ModeNo > 0x13) {
+ if(SiS_Pr->UseCustomMode) {
+ VCLK = SiS_Pr->CSRClock;
+ } else {
+ index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
+ index &= 0x3F;
+ VCLK = SiS_Pr->SiS_VCLKData[index].CLOCK; /* Get VCLK */
+ }
- index = SiS_GetReg1(SiS_P3c4,0x1A);
+ index = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1A);
index &= 0x07;
- MCLK = SiS_MCLKData_0[index].CLOCK; /* Get MCLK */
+ MCLK = SiS_Pr->SiS_MCLKData_0[index].CLOCK; /* Get MCLK */
- data2 = SiS_ModeType - ModeEGA;
+ data2 = SiS_Pr->SiS_ModeType - ModeEGA; /* Get half colordepth */
switch (data2) {
case 0 : colorth = 1; break;
case 1 : colorth = 1; break;
@@ -3613,295 +4378,501 @@ SiS_SetCRT1FIFO_300(UCHAR *ROMAddr,USHORT ModeNo,PSIS_HW_DEVICE_INFO HwDeviceExt
case 5 : colorth = 4; break;
}
- do{
- B = SiS_CalcDelay2(ROMAddr,FQBQData[i]) * VCLK * colorth;
- bl = B / (MCLK * 16);
+ if(HwDeviceExtension->jChipType == SIS_730) {
+
+ do {
+ B = SiS_CalcDelay2(SiS_Pr, ROMAddr, FQBQData730[i], HwDeviceExtension) * VCLK * colorth;
+ bl = B / (MCLK * 16);
- if (B==bl*16*MCLK) {
- bl = bl + 1;
- } else {
- bl = bl + 2;
- }
+ if(B == bl * 16 * MCLK) {
+ bl = bl + 1;
+ } else {
+ bl = bl + 2;
+ }
- if(bl > 0x13) {
- if(FQBQData[i+1] == 0xFF) {
- ThresholdLow = 0x13;
+ if(bl > 0x13) {
+ if(FQBQData730[i+1] == 0xFF) {
+ ThresholdLow = 0x13;
+ break;
+ }
+ i++;
+ } else {
+ ThresholdLow = bl;
break;
}
- i++;
- } else {
- ThresholdLow = bl;
- break;
- }
- } while(FQBQData[i] != 0xFF);
+ } while(FQBQData730[i] != 0xFF);
+
+ } else {
+
+ do {
+ B = SiS_CalcDelay2(SiS_Pr, ROMAddr, FQBQData[i], HwDeviceExtension) * VCLK * colorth;
+ bl = B / (MCLK * 16);
+
+ if(B == bl * 16 * MCLK) {
+ bl = bl + 1;
+ } else {
+ bl = bl + 2;
+ }
+
+ if(bl > 0x13) {
+ if(FQBQData[i+1] == 0xFF) {
+ ThresholdLow = 0x13;
+ break;
+ }
+ i++;
+ } else {
+ ThresholdLow = bl;
+ break;
+ }
+ } while(FQBQData[i] != 0xFF);
+ }
}
else {
+ if(HwDeviceExtension->jChipType == SIS_730) {
+ } else {
+ i = 9;
+ }
ThresholdLow = 0x02;
}
/* Write foreground and background queue */
- data2 = FQBQData[i];
- data2 = (data2 & 0xf0)>>4;
- data2 <<= 24;
+ if(HwDeviceExtension->jChipType == SIS_730) {
+
+ data2 = FQBQData730[i];
+ data2 = (data2 & 0xC0) >> 5;
+ data2 <<= 8;
#ifndef LINUX_XF86
- SiS_SetReg4(0xcf8,0x80000050);
- eax = SiS_GetReg3(0xcfc);
- eax &= 0xf0ffffff;
- eax |= data2;
- SiS_SetReg4(0xcfc,eax);
+ SiS_SetReg4(0xcf8,0x80000050);
+ eax = SiS_GetReg3(0xcfc);
+ eax &= 0xfffff9ff;
+ eax |= data2;
+ SiS_SetReg4(0xcfc,eax);
#else
- /* We use pci functions X offers. We use pcitag 0, because
- * we want to read/write to the host bridge (which is always
- * 00:00.0 on 630, 730 and 540), not the VGA device.
- */
- eax = pciReadLong(0x00000000, 0x50);
- eax &= 0xf0ffffff;
- eax |= data2;
- pciWriteLong(0x00000000, 0x50, eax);
+ /* We use pci functions X offers. We use pcitag 0, because
+ * we want to read/write to the host bridge (which is always
+ * 00:00.0 on 630, 730 and 540), not the VGA device.
+ */
+ eax = pciReadLong(0x00000000, 0x50);
+ eax &= 0xfffff9ff;
+ eax |= data2;
+ pciWriteLong(0x00000000, 0x50, eax);
+#endif
+
+ /* Write GUI grant timer (PCI config 0xA3) */
+ data2 = FQBQData730[i] << 8;
+ data2 = (data2 & 0x0f00) | ((data2 & 0x3000) >> 8);
+ data2 <<= 20;
+
+#ifndef LINUX_XF86
+ SiS_SetReg4(0xcf8,0x800000A0);
+ eax = SiS_GetReg3(0xcfc);
+ eax &= 0x00ffffff;
+ eax |= data2;
+ SiS_SetReg4(0xcfc,eax);
+#else
+ eax = pciReadLong(0x00000000, 0xA0);
+ eax &= 0x00ffffff;
+ eax |= data2;
+ pciWriteLong(0x00000000, 0xA0, eax);
+#endif
+
+ } else {
+
+ data2 = FQBQData[i];
+ data2 = (data2 & 0xf0) >> 4;
+ data2 <<= 24;
+
+#ifndef LINUX_XF86
+ SiS_SetReg4(0xcf8,0x80000050);
+ eax = SiS_GetReg3(0xcfc);
+ eax &= 0xf0ffffff;
+ eax |= data2;
+ SiS_SetReg4(0xcfc,eax);
+#else
+ eax = pciReadLong(0x00000000, 0x50);
+ eax &= 0xf0ffffff;
+ eax |= data2;
+ pciWriteLong(0x00000000, 0x50, eax);
#endif
- /* TODO: write GUI grant timer (PCI config 0xA3) */
+ /* Write GUI grant timer (PCI config 0xA3) */
+ data2 = FQBQData[i];
+ data2 &= 0x0f;
+ data2 <<= 24;
+
+#ifndef LINUX_XF86
+ SiS_SetReg4(0xcf8,0x800000A0);
+ eax = SiS_GetReg3(0xcfc);
+ eax &= 0xf0ffffff;
+ eax |= data2;
+ SiS_SetReg4(0xcfc,eax);
+#else
+ eax = pciReadLong(0x00000000, 0xA0);
+ eax &= 0xf0ffffff;
+ eax |= data2;
+ pciWriteLong(0x00000000, 0xA0, eax);
+#endif
+
+ }
/* Write CRT/CPU threshold low, CRT/Engine threshold high */
data = ((ThresholdLow & 0x0f) << 4) | 0x0f;
- SiS_SetReg1(SiS_P3c4,0x08,data);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x08,data);
data = (ThresholdLow & 0x10) << 1;
- SiS_SetRegANDOR(SiS_P3c4,0x0F,0xDF,data);
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0F,0xDF,data);
/* What is this? */
- SiS_SetReg1(SiS_P3c4,0x3B,0x09);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x3B,0x09);
- /* Write CRT/CPU threshold high */
+ /* Write CRT/CPU threshold high (gap = 3) */
data = ThresholdLow + 3;
if(data > 0x0f) data = 0x0f;
- SiS_SetRegANDOR(SiS_P3c4,0x09,0x80,data);
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x09,0x80,data);
}
USHORT
-SiS_CalcDelay2(UCHAR *ROMAddr,UCHAR key)
+SiS_CalcDelay2(SiS_Private *SiS_Pr, UCHAR *ROMAddr,UCHAR key, PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
USHORT data,index;
- UCHAR LatencyFactor[] ={ 97, 88, 86, 79, 77, 00, /*; 64 bit BQ=2 */
- 00, 87, 85, 78, 76, 54, /*; 64 bit BQ=1 */
- 97, 88, 86, 79, 77, 00, /*; 128 bit BQ=2 */
- 00, 79, 77, 70, 68, 48, /*; 128 bit BQ=1 */
- 80, 72, 69, 63, 61, 00, /*; 64 bit BQ=2 */
- 00, 70, 68, 61, 59, 37, /*; 64 bit BQ=1 */
- 86, 77, 75, 68, 66, 00, /*; 128 bit BQ=2 */
- 00, 68, 66, 59, 57, 37}; /*; 128 bit BQ=1 */
-
- index = (key & 0xE0) >> 5;
- if(key & 0x10) index +=6;
- if(!(key & 0x01)) index += 24;
- data = SiS_GetReg1(SiS_P3c4,0x14);
- if(data & 0x0080) index += 12;
-
- data = LatencyFactor[index];
+ const UCHAR LatencyFactor[] = {
+ 97, 88, 86, 79, 77, 00, /*; 64 bit BQ=2 */
+ 00, 87, 85, 78, 76, 54, /*; 64 bit BQ=1 */
+ 97, 88, 86, 79, 77, 00, /*; 128 bit BQ=2 */
+ 00, 79, 77, 70, 68, 48, /*; 128 bit BQ=1 */
+ 80, 72, 69, 63, 61, 00, /*; 64 bit BQ=2 */
+ 00, 70, 68, 61, 59, 37, /*; 64 bit BQ=1 */
+ 86, 77, 75, 68, 66, 00, /*; 128 bit BQ=2 */
+ 00, 68, 66, 59, 57, 37 /*; 128 bit BQ=1 */
+ };
+ const UCHAR LatencyFactor730[] = {
+ 69, 63, 61,
+ 86, 79, 77,
+ 103, 96, 94,
+ 120,113,111,
+ 137,130,128, /* --- Table ends with this entry, data below */
+ 137,130,128, /* to avoid using illegal values */
+ 137,130,128,
+ 137,130,128,
+ 137,130,128,
+ 137,130,128,
+ 137,130,128,
+ 137,130,128,
+ 137,130,128,
+ 137,130,128,
+ 137,130,128,
+ 137,130,128,
+ };
+
+ if(HwDeviceExtension->jChipType == SIS_730) {
+ index = ((key & 0x0f) * 3) + ((key & 0xC0) >> 6);
+ data = LatencyFactor730[index];
+ } else {
+ index = (key & 0xE0) >> 5;
+ if(key & 0x10) index +=6;
+ if(!(key & 0x01)) index += 24;
+ data = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14);
+ if(data & 0x0080) index += 12;
+ data = LatencyFactor[index];
+ }
return(data);
}
#endif
/* =============== Autodetection ================ */
+/* I N C O M P L E T E */
-#ifndef LINUX_XF86
+BOOLEAN
+SiS_GetPanelID(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
+{
+ const USHORT PanelTypeTable300[16] = {
+ 0xc101, 0xc117, 0x0121, 0xc135, 0xc142, 0xc152, 0xc162, 0xc072,
+ 0xc181, 0xc192, 0xc1a1, 0xc1b6, 0xc1c2, 0xc0d2, 0xc1e2, 0xc1f2
+ };
+ const USHORT PanelTypeTable31030x[16] = {
+ 0xc102, 0xc112, 0x0122, 0xc132, 0xc142, 0xc152, 0xc169, 0xc179,
+ 0x0189, 0xc192, 0xc1a2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+ };
+ const USHORT PanelTypeTable310LVDS[16] = {
+ 0xc111, 0xc122, 0xc133, 0xc144, 0xc155, 0xc166, 0xc177, 0xc188,
+ 0xc199, 0xc0aa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+ };
+ USHORT tempax,tempbx,tempah,temp;
+
+ if(HwDeviceExtension->jChipType < SIS_315H) {
+
+ tempax = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x18);
+ tempbx = tempax & 0x0F;
+ if(!(tempax & 0x10)){
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1){
+ tempbx = 0;
+ temp = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x38);
+ if(temp & 0x40) tempbx |= 0x08;
+ if(temp & 0x20) tempbx |= 0x02;
+ if(temp & 0x01) tempbx |= 0x01;
+ temp = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x39);
+ if(temp & 0x80) tempbx |= 0x04;
+ } else {
+ return 0;
+ }
+ }
+ tempbx = PanelTypeTable300[tempbx];
+ tempbx |= LCDSync;
+ temp = tempbx & 0x00FF;
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x36,temp);
+ temp = (tempbx & 0xFF00) >> 8;
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x37,~(LCDSyncBit|LCDRGB18Bit),temp);
+
+ } else {
+
+ tempax = tempah = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1a);
+ tempax &= 0x1e;
+ tempax >>= 1;
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
+ if(tempax == 0) {
+ /* TODO: Include HUGE detection routine
+ (Probably not worth bothering)
+ */
+ return 0;
+ }
+ temp = tempax & 0xff;
+ tempax--;
+ tempbx = PanelTypeTable310LVDS[tempax];
+ } else {
+ tempbx = PanelTypeTable31030x[tempax];
+ temp = tempbx & 0xff;
+ }
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x36,temp);
+ tempbx = (tempbx & 0xff00) >> 8;
+ temp = tempbx & 0xc1;
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x37,~(LCDSyncBit|LCDRGB18Bit),temp);
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
+ temp = tempbx & 0x04;
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x39,0xfb,temp);
+ }
+
+ }
+ return 1;
+}
+
+
+#ifdef LINUXBIOS
-/* (ynlai) */
void
-SiS_DetectMonitor(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr)
+SiS_DetectMonitor(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr)
{
- UCHAR DAC_TEST_PARMS[]={0x0F,0x0F,0x0F};
- UCHAR DAC_CLR_PARMS[]={0x00,0x00,0x00};
+ UCHAR DAC_TEST_PARMS[] = {0x0F,0x0F,0x0F};
+ UCHAR DAC_CLR_PARMS[] = {0x00,0x00,0x00};
USHORT SR1F;
- SR1F=SiS_GetReg1(SiS_P3c4,0x1F); /* DAC pedestal */
- SiS_SetRegANDOR(SiS_P3c4,0x1F,0xFF,0x04);
- if(SiS_IF_DEF_LVDS==0) {
- if(SiS_BridgeIsOn(BaseAddr)==0) { /* TW: Inserted "==0" */
- SiS_SetReg1(SiS_P3d4,0x30,0x41);
+ SR1F = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1F); /* backup DAC pedestal */
+ SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1F,0x04);
+
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
+ if(!(SiS_BridgeIsOn(SiS_Pr, BaseAddr))) {
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x30,0x41);
}
}
- /*SiSSetMode(HwDeviceExtension,0x03); */ /* ynlai InitMode */
-
- SiSSetMode(HwDeviceExtension,0x2E); /* alan */
- SiS_SetReg3(SiS_P3c6,0xff);
- SiS_ClearDAC(SiS_P3c8);
- SiS_LongWait();
- SiS_LongWait();
- SiS_SetRegANDOR(SiS_P3d4,0x32,0xDF,0x00);
- if(SiS_TestMonitorType(DAC_TEST_PARMS[0],DAC_TEST_PARMS[1],DAC_TEST_PARMS[2])) {
- SiS_SetRegANDOR(SiS_P3d4,0x32,0xDF,0x20);
+
+ SiSSetMode(SiS_Pr,HwDeviceExtension,0x2E);
+ if(HwDeviceExtension->jChipType >= SIS_650) {
+ /* TW: On 650 only - enable CRT1 */
+ SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x63,0xbf);
}
- if(SiS_TestMonitorType(DAC_TEST_PARMS[0],DAC_TEST_PARMS[1],DAC_TEST_PARMS[2])) {
- SiS_SetRegANDOR(SiS_P3d4,0x32,0xDF,0x20);
+ SiS_SetReg3(SiS_Pr->SiS_P3c6,0xff);
+ SiS_ClearDAC(SiS_Pr, SiS_Pr->SiS_P3c8);
+ SiS_LongWait(SiS_Pr);
+ SiS_LongWait(SiS_Pr);
+ SiS_LongWait(SiS_Pr);
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x32,0xDF,0x00);
+ if(SiS_TestMonitorType(SiS_Pr, DAC_TEST_PARMS[0],DAC_TEST_PARMS[1],DAC_TEST_PARMS[2])) {
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x32,0xDF,0x20);
+ } else if(SiS_TestMonitorType(SiS_Pr, DAC_TEST_PARMS[0],DAC_TEST_PARMS[1],DAC_TEST_PARMS[2])) {
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x32,0xDF,0x20);
}
- SiS_TestMonitorType(DAC_CLR_PARMS[0],DAC_CLR_PARMS[1],DAC_CLR_PARMS[2]);
- SiS_SetReg1(SiS_P3c4,0x1F,SR1F);
+ SiS_TestMonitorType(SiS_Pr, DAC_CLR_PARMS[0],DAC_CLR_PARMS[1],DAC_CLR_PARMS[2]);
+
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1F,SR1F);
}
USHORT
-SiS_TestMonitorType(UCHAR R_DAC,UCHAR G_DAC,UCHAR B_DAC)
+SiS_TestMonitorType(SiS_Private *SiS_Pr, UCHAR R_DAC,UCHAR G_DAC,UCHAR B_DAC)
{
USHORT temp,tempbx;
- tempbx=R_DAC*0x4d+G_DAC*0x97+B_DAC*0x1c;
- if(tempbx>0x80) tempbx=tempbx+0x100;
- tempbx = (tempbx&0xFF00)>>8;
+ tempbx = R_DAC * 0x4d + G_DAC * 0x97 + B_DAC * 0x1c;
+ if((tempbx & 0x00ff) > 0x80) tempbx += 0x100;
+ tempbx = (tempbx & 0xFF00) >> 8;
R_DAC = (UCHAR) tempbx;
G_DAC = (UCHAR) tempbx;
B_DAC = (UCHAR) tempbx;
- SiS_SetReg3(SiS_P3c8,0x00);
- SiS_SetReg3(SiS_P3c9,R_DAC);
- SiS_SetReg3(SiS_P3c9,G_DAC);
- SiS_SetReg3(SiS_P3c9,B_DAC);
- SiS_LongWait();
- temp=SiS_GetReg2(SiS_P3c2);
- if(temp&0x10) return(1);
+ SiS_SetReg3(SiS_Pr->SiS_P3c8,0x00);
+ SiS_SetReg3(SiS_Pr->SiS_P3c9,R_DAC);
+ SiS_SetReg3(SiS_Pr->SiS_P3c9,G_DAC);
+ SiS_SetReg3(SiS_Pr->SiS_P3c9,B_DAC);
+ SiS_LongWait(SiS_Pr);
+ temp=SiS_GetReg2(SiS_Pr->SiS_P3c2);
+ if(temp & 0x10) return(1);
else return(0);
}
-/* ---- test ----- */
void
-SiS_GetSenseStatus(PSIS_HW_DEVICE_INFO HwDeviceExtension,UCHAR *ROMAddr)
+SiS_GetSenseStatus(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,UCHAR *ROMAddr)
{
USHORT tempax=0,tempbx,tempcx,temp;
- USHORT P2reg0=0,SenseModeNo=0,OutputSelect=*pSiS_OutputSelect;
+ USHORT P2reg0=0,SenseModeNo=0,OutputSelect=*SiS_Pr->pSiS_OutputSelect;
USHORT ModeIdIndex,i;
USHORT BaseAddr = (USHORT)HwDeviceExtension->ulIOAddress;
- if(SiS_IF_DEF_LVDS==1){
- SiS_GetPanelID();
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1){
+ SiS_GetPanelID(SiS_Pr);
temp=LCDSense;
- temp=temp|SiS_SenseCHTV();
+ temp=temp|SiS_SenseCHTV(SiS_Pr);
tempbx=~(LCDSense|AVIDEOSense|SVIDEOSense);
- SiS_SetRegANDOR(SiS_P3d4,0x32,tempbx,temp);
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x32,tempbx,temp);
} else { /* for 301 */
- if(SiS_IF_DEF_HiVision==1) { /* for HiVision */
- tempax=SiS_GetReg1(SiS_P3c4,0x38);
+ if(SiS_Pr->SiS_IF_DEF_HiVision==1) { /* for HiVision */
+ tempax=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x38);
temp=tempax&0x01;
- tempax=SiS_GetReg1(SiS_P3c4,0x3A);
+ tempax=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x3A);
temp=temp|(tempax&0x02);
- SiS_SetRegANDOR(SiS_P3d4,0x32,0xA0,temp);
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x32,0xA0,temp);
} else {
- if(SiS_BridgeIsOn(BaseAddr)==0) { /* TW: Inserted "==0" */
- P2reg0 = SiS_GetReg1(SiS_Part2Port,0x00);
- if(!SiS_BridgeIsEnable(BaseAddr,HwDeviceExtension)) {
+ if(SiS_BridgeIsOn(SiS_Pr, BaseAddr)==0) { /* TW: Inserted "==0" */
+ P2reg0 = SiS_GetReg1(SiS_Pr->SiS_Part2Port,0x00);
+ if(!(SiS_BridgeIsEnable(SiS_Pr, BaseAddr,HwDeviceExtension))) {
SenseModeNo=0x2e;
- temp = SiS_SearchModeID(ROMAddr,&SenseModeNo,&ModeIdIndex);
- SiS_SetFlag = 0x00;
- SiS_ModeType = ModeVGA;
- SiS_VBInfo = SetCRT2ToRAMDAC |LoadDACFlag |SetInSlaveMode;
- SiS_SetCRT2Group301(BaseAddr,ROMAddr,SenseModeNo,HwDeviceExtension);
+ temp = SiS_SearchModeID(SiS_Pr, ROMAddr,&SenseModeNo,&ModeIdIndex);
+ SiS_Pr->SiS_SetFlag = 0x00;
+ SiS_Pr->SiS_ModeType = ModeVGA;
+ SiS_Pr->SiS_VBInfo = SetCRT2ToRAMDAC |LoadDACFlag |SetInSlaveMode;
+ SiS_SetCRT2Group301(SiS_Pr, BaseAddr,ROMAddr,SenseModeNo,HwDeviceExtension);
for(i=0;i<20;i++) {
- SiS_LongWait();
+ SiS_LongWait(SiS_Pr);
}
}
- SiS_SetReg1(SiS_Part2Port,0x00,0x1c);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x00,0x1c);
tempax=0;
- tempbx=*pSiS_RGBSenseData;
- if(SiS_Is301B(BaseAddr)){
- tempbx=*pSiS_RGBSenseData2;
+ tempbx=*SiS_Pr->pSiS_RGBSenseData;
+ if(SiS_Is301B(SiS_Pr, BaseAddr)){
+ tempbx=*SiS_Pr->pSiS_RGBSenseData2;
}
tempcx=0x0E08;
- if(SiS_Sense(SiS_Part4Port,tempbx,tempcx)){
- if(SiS_Sense(SiS_Part4Port,tempbx,tempcx)){
+ if(SiS_Sense(SiS_Pr, tempbx,tempcx)){
+ if(SiS_Sense(SiS_Pr, tempbx,tempcx)){
tempax=tempax|Monitor2Sense;
}
}
- tempbx=*pSiS_YCSenseData;
- if(SiS_Is301B(BaseAddr)){
- tempbx=*pSiS_YCSenseData2;
+ tempbx=*SiS_Pr->pSiS_YCSenseData;
+ if(SiS_Is301B(SiS_Pr, BaseAddr)){
+ tempbx=*SiS_Pr->pSiS_YCSenseData2;
}
tempcx=0x0604;
- if(SiS_Sense(SiS_Part4Port,tempbx,tempcx)){
- if(SiS_Sense(SiS_Part4Port,tempbx,tempcx)){
+ if(SiS_Sense(SiS_Pr, tempbx,tempcx)){
+ if(SiS_Sense(SiS_Pr,tempbx,tempcx)){
tempax=tempax|SVIDEOSense;
}
}
- if(OutputSelect&BoardTVType){
- tempbx=*pSiS_VideoSenseData;
- if(SiS_Is301B(BaseAddr)){
- tempbx=*pSiS_VideoSenseData2;
+ if(ROMAddr && SiS_Pr->SiS_UseROM) {
+#ifdef SIS300
+ if((HwDeviceExtension->jChipType==SIS_630)||
+ (HwDeviceExtension->jChipType==SIS_730)) {
+ OutputSelect = ROMAddr[0xfe];
+ }
+#endif
+#ifdef SIS315H
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ OutputSelect = ROMAddr[0xf3];
+ if(HwDeviceExtension->jChipType == SIS_330) {
+ OutputSelect = ROMAddr[0x11b];
+ }
+ }
+#endif
}
- tempcx=0x0804;
- if(SiS_Sense(SiS_Part4Port,tempbx,tempcx)){
- if(SiS_Sense(SiS_Part4Port,tempbx,tempcx)){
- tempax=tempax|AVIDEOSense;
+ if(OutputSelect & BoardTVType){
+ tempbx = *SiS_Pr->pSiS_VideoSenseData;
+ if(SiS_Is301B(SiS_Pr, BaseAddr)){
+ tempbx = *SiS_Pr->pSiS_VideoSenseData2;
+ }
+ tempcx = 0x0804;
+ if(SiS_Sense(SiS_Pr, tempbx,tempcx)){
+ if(SiS_Sense(SiS_Pr, tempbx,tempcx)){
+ tempax |= AVIDEOSense;
}
}
} else {
- if(!(tempax&SVIDEOSense)){
- tempbx=*pSiS_VideoSenseData;
- if(SiS_Is301B(BaseAddr)){
- tempbx=*pSiS_VideoSenseData2;
+ if(!(tempax & SVIDEOSense)){
+ tempbx = *SiS_Pr->pSiS_VideoSenseData;
+ if(SiS_Is301B(SiS_Pr, BaseAddr)){
+ tempbx = *SiS_Pr->pSiS_VideoSenseData2;
}
- tempcx=0x0804;
- if(SiS_Sense(SiS_Part4Port,tempbx,tempcx)){
- if(SiS_Sense(SiS_Part4Port,tempbx,tempcx)){
- tempax=tempax|AVIDEOSense;
+ tempcx = 0x0804;
+ if(SiS_Sense(SiS_Pr,tempbx,tempcx)){
+ if(SiS_Sense(SiS_Pr, tempbx,tempcx)){
+ tempax |= AVIDEOSense;
}
}
}
}
}
- if(SiS_SenseLCD(HwDeviceExtension)){
- tempax=tempax|LCDSense;
+ if(SiS_SenseLCD(SiS_Pr, HwDeviceExtension)){
+ tempax |= LCDSense;
}
tempbx=0;
tempcx=0;
- SiS_Sense(SiS_Part4Port,tempbx,tempcx);
-
- if((SiS_VBType & VB_SIS301LV)||(SiS_VBType & VB_SIS302LV)){
- tempax &= 0x00ef; /* 301lv to disable CRT2*/
+ SiS_Sense(SiS_Pr, tempbx,tempcx);
+
+ if(SiS_Pr->SiS_VBType & (VB_SIS301LV302LV)) {
+ tempax &= 0x00ef; /* 30xlv have no VGA2*/
}
- SiS_SetRegANDOR(SiS_P3d4,0x32,~0xDF,tempax);
- SiS_SetReg1(SiS_Part2Port,0x00,P2reg0);
- if(!(P2reg0&0x20)) {
- SiS_VBInfo = DisableCRT2Display;
- SiS_SetCRT2Group301(BaseAddr,ROMAddr,SenseModeNo,HwDeviceExtension);
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x32,~0xDF,tempax);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x00,P2reg0);
+ if(!(P2reg0 & 0x20)) {
+ SiS_Pr->SiS_VBInfo = DisableCRT2Display;
+ SiS_SetCRT2Group301(SiS_Pr,BaseAddr,ROMAddr,SenseModeNo,HwDeviceExtension);
}
}
}
}
BOOLEAN
-SiS_Sense(USHORT Part4Port,USHORT tempbx,USHORT tempcx)
+SiS_Sense(SiS_Private *SiS_Pr, USHORT tempbx,USHORT tempcx)
{
USHORT temp,i,tempch;
- temp=tempbx&0xFF;
- SiS_SetReg1(SiS_Part4Port,0x11,temp);
- temp=(tempbx&0xFF00)>>8;
- temp=temp|(tempcx&0x00FF);
- SiS_SetRegANDOR(SiS_Part4Port,0x10,~0x1F,temp);
+ temp = tempbx & 0xFF;
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x11,temp);
+ temp = (tempbx & 0xFF00) >> 8;
+ temp |= (tempcx & 0x00FF);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x10,~0x1F,temp);
- for(i=0;i<10;i++) SiS_LongWait();
+ for(i=0; i<10; i++) SiS_LongWait(SiS_Pr);
- tempch=(tempcx&0x7F00)>>8; /* ynlai [05/22/2001] */
- temp=SiS_GetReg1(SiS_Part4Port,0x03);
- temp=temp^(0x0E);
- temp=temp&tempch; /* ynlai [05/22/2001] */
+ tempch = (tempcx & 0x7F00) >> 8;
+ temp = SiS_GetReg1(SiS_Pr->SiS_Part4Port,0x03);
+ temp ^= 0x0E;
+ temp &= tempch;
if(temp>0) return 1;
else return 0;
}
USHORT
-SiS_SenseLCD(PSIS_HW_DEVICE_INFO HwDeviceExtension)
+SiS_SenseLCD(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
USHORT temp;
- temp=SiS_GetPanelID();
- if(!temp) temp=SiS_GetLCDDDCInfo(HwDeviceExtension);
+ temp=SiS_GetPanelID(SiS_Pr);
+ if(!temp) temp=SiS_GetLCDDDCInfo(SiS_Pr, HwDeviceExtension);
return(temp);
}
BOOLEAN
-SiS_GetLCDDDCInfo(PSIS_HW_DEVICE_INFO HwDeviceExtension)
+SiS_GetLCDDDCInfo(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
USHORT temp;
/*add lcd sense*/
@@ -3909,77 +4880,29 @@ SiS_GetLCDDDCInfo(PSIS_HW_DEVICE_INFO HwDeviceExtension)
return 0;
else{
temp=(USHORT)HwDeviceExtension->ulCRT2LCDType;
- SiS_SetReg1(SiS_P3d4,0x36,temp);
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x36,temp);
return 1;
}
}
-BOOLEAN
-SiS_GetPanelID(void)
-{
- USHORT PanelTypeTable[16]={ SyncNN | PanelRGB18Bit | Panel800x600 | _PanelType00,
- SyncNN | PanelRGB18Bit | Panel1024x768 | _PanelType01,
- SyncPP | PanelRGB18Bit | Panel800x600 | _PanelType02,
- SyncNN | PanelRGB18Bit | Panel640x480 | _PanelType03,
- SyncNN | PanelRGB18Bit | Panel1024x768 | _PanelType04,
- SyncNN | PanelRGB18Bit | Panel1024x768 | _PanelType05,
- SyncNN | PanelRGB18Bit | Panel1024x768 | _PanelType06,
- SyncNN | PanelRGB24Bit | Panel1024x768 | _PanelType07,
- SyncNN | PanelRGB18Bit | Panel800x600 | _PanelType08,
- SyncNN | PanelRGB18Bit | Panel1024x768 | _PanelType09,
- SyncNN | PanelRGB18Bit | Panel800x600 | _PanelType0A,
- SyncNN | PanelRGB18Bit | Panel1024x768 | _PanelType0B,
- SyncNN | PanelRGB18Bit | Panel1024x768 | _PanelType0C,
- SyncNN | PanelRGB24Bit | Panel1024x768 | _PanelType0D,
- SyncNN | PanelRGB18Bit | Panel1024x768 | _PanelType0E,
- SyncNN | PanelRGB18Bit | Panel1024x768 | _PanelType0F
- };
- USHORT tempax,tempbx,temp;
-
- tempax = SiS_GetReg1(SiS_P3c4,0x18);
- tempbx = tempax & 0x0F;
- if(!(tempax & 0x10)){
- if(SiS_IF_DEF_LVDS==1){
- tempbx = 0;
- temp = SiS_GetReg1(SiS_P3c4,0x38);
- if(temp & 0x40) tempbx |= 0x08;
- if(temp & 0x20) tempbx |= 0x02;
- if(temp & 0x01) tempbx |= 0x01;
- temp=SiS_GetReg1(SiS_P3c4,0x39);
- if(temp & 0x80) tempbx |= 0x04;
- } else {
- return 0;
- }
- }
-
- tempbx <<= 1;
- tempbx = PanelTypeTable[tempbx];
- tempbx |= LCDSync;
- temp = tempbx & 0x00FF;
- SiS_SetReg1(SiS_P3d4,0x36,temp);
- temp = (tempbx & 0xFF00) >> 8;
- SiS_SetRegANDOR(SiS_P3d4,0x37,~(LCDSyncBit|LCDRGB18Bit),temp);
- return 1;
-}
-
USHORT
-SiS_SenseCHTV(void)
+SiS_SenseCHTV(SiS_Private *SiS_Pr)
{
USHORT temp,push0e,status;
status=0;
- push0e = SiS_GetCH700x(0x0e);
+ push0e = SiS_GetCH700x(SiS_Pr, 0x0e);
push0e = (push0e << 8) | 0x0e;
- SiS_SetCH700x(0x0b0e);
- SiS_SetCH700x(0x0110);
- SiS_SetCH700x(0x0010);
- temp = SiS_GetCH700x(0x10);
+ SiS_SetCH700x(SiS_Pr, 0x0b0e);
+ SiS_SetCH700x(SiS_Pr, 0x0110);
+ SiS_SetCH700x(SiS_Pr, 0x0010);
+ temp = SiS_GetCH700x(SiS_Pr, 0x10);
if(temp & 0x08) status |= SVIDEOSense;
if(temp & 0x02) status |= AVIDEOSense;
- SiS_SetCH700x(push0e);
+ SiS_SetCH700x(SiS_Pr, push0e);
return(status);
}
-#endif /* LINUX_XF86 */
+#endif /* LINUXBIOS */
/* ================ for TC only ================= */
@@ -4081,21 +5004,26 @@ main(int argc, char *argv[])
/*ModeNo=0x4A; *//* 1024x768x 16bpp */
/*ModeNo=0x47;*/ /* 800x600x 16bpp */
}
- /* SiSInit(&HwDeviceExtension);*/
- SiSSetMode(&HwDeviceExtension,ModeNo);
+ /* SiSInit(SiS_Pr, &HwDeviceExtension);*/
+ SiSSetMode(SiS_Pr, &HwDeviceExtension, ModeNo);
}
#endif /* TC END */
/* ================ LINUX XFREE86 ====================== */
+/* Helper functions */
+
#ifdef LINUX_XF86
USHORT
SiS_CalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode)
{
- UShort i = (pScrn->bitsPerPixel+7)/8 - 1;
- UShort ModeIndex = 0;
SISPtr pSiS = SISPTR(pScrn);
+ UShort i = (pSiS->CurrentLayout.bitsPerPixel+7)/8 - 1;
+ UShort ModeIndex = 0;
+ if((pSiS->HaveCustomModes) && (!(mode->type & M_T_DEFAULT)))
+ return 0xfe;
+
switch(mode->HDisplay)
{
case 320:
@@ -4111,6 +5039,8 @@ SiS_CalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode)
case 640:
if(mode->VDisplay == 480) {
ModeIndex = ModeIndex_640x480[i];
+ } else if(mode->VDisplay == 400) {
+ ModeIndex = ModeIndex_640x400[i];
}
break;
case 720:
@@ -4123,19 +5053,25 @@ SiS_CalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode)
case 800:
if(mode->VDisplay == 600) {
ModeIndex = ModeIndex_800x600[i];
- } else if(pSiS->VGAEngine == SIS_315_VGA) {
- if(mode->VDisplay == 480) {
- ModeIndex = ModeIndex_800x480[i];
- }
+ } else if(mode->VDisplay == 480) {
+ ModeIndex = ModeIndex_800x480[i];
}
break;
+ case 848:
+ if(mode->VDisplay == 480) {
+ ModeIndex = ModeIndex_848x480[i];
+ }
+ break;
+ case 856:
+ if(mode->VDisplay == 480) {
+ ModeIndex = ModeIndex_856x480[i];
+ }
+ break;
case 1024:
if(mode->VDisplay == 768) {
ModeIndex = ModeIndex_1024x768[i];
- } else if(pSiS->VGAEngine == SIS_315_VGA) {
- if(mode->VDisplay == 576) {
+ } else if(mode->VDisplay == 576) {
ModeIndex = ModeIndex_1024x576[i];
- }
} else if(pSiS->VGAEngine == SIS_300_VGA) {
if(mode->VDisplay == 600) {
ModeIndex = ModeIndex_1024x600[i];
@@ -4143,7 +5079,9 @@ SiS_CalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode)
}
break;
case 1152:
- if(pSiS->VGAEngine == SIS_300_VGA) {
+ if(mode->VDisplay == 864) {
+ ModeIndex = ModeIndex_1152x864[i];
+ } else if(pSiS->VGAEngine == SIS_300_VGA) {
if(mode->VDisplay == 768) {
ModeIndex = ModeIndex_1152x768[i];
}
@@ -4158,12 +5096,17 @@ SiS_CalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode)
}
} else if (mode->VDisplay == 1024) {
ModeIndex = ModeIndex_1280x1024[i];
+ } else if (mode->VDisplay == 720) {
+ ModeIndex = ModeIndex_1280x720[i];
} else if(pSiS->VGAEngine == SIS_315_VGA) {
if (mode->VDisplay == 768) {
ModeIndex = ModeIndex_1280x768[i];
- } else if (mode->VDisplay == 720) {
- ModeIndex = ModeIndex_1280x720[i];
- }
+ }
+ }
+ break;
+ case 1360:
+ if(mode->VDisplay == 768) {
+ ModeIndex = ModeIndex_1360x768[i];
}
break;
case 1400:
@@ -4184,9 +5127,11 @@ SiS_CalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode)
}
break;
case 2048:
- if(pSiS->VGAEngine == SIS_315_VGA) {
- if(mode->VDisplay == 1536) {
- ModeIndex = ModeIndex_2048x1536[i];
+ if(mode->VDisplay == 1536) {
+ if(pSiS->VGAEngine == SIS_300_VGA) {
+ ModeIndex = ModeIndex_300_2048x1536[i];
+ } else {
+ ModeIndex = ModeIndex_310_2048x1536[i];
}
}
break;
@@ -4198,27 +5143,31 @@ SiS_CalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode)
USHORT
SiS_CheckCalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode, int VBFlags)
{
- UShort i = (pScrn->bitsPerPixel+7)/8 - 1;
- UShort ModeIndex = 0;
SISPtr pSiS = SISPTR(pScrn);
+ UShort i = (pSiS->CurrentLayout.bitsPerPixel+7)/8 - 1;
+ UShort ModeIndex = 0;
if(VBFlags & CRT2_LCD) {
if( (mode->HDisplay <= pSiS->LCDwidth) &&
(mode->VDisplay <= pSiS->LCDheight) ) {
- if(VBFlags & VB_LVDS) { /* LCD on LVDS */
+ if(VBFlags & (VB_LVDS | VB_30xBDH)) { /* LCD on Panel link (LVDS, 301BDH) */
switch(mode->HDisplay)
{
case 512:
if(mode->VDisplay == 384) {
- ModeIndex = ModeIndex_512x384[i];
+ if(pSiS->LCDwidth != 1024 || pSiS->LCDheight != 600) { /* not supported on 1024x600 panels */
+ ModeIndex = ModeIndex_512x384[i];
+ }
}
break;
case 640:
if(mode->VDisplay == 480) {
ModeIndex = ModeIndex_640x480[i];
+ } else if(mode->VDisplay == 400) {
+ ModeIndex = ModeIndex_640x400[i];
}
break;
case 800:
@@ -4231,7 +5180,9 @@ SiS_CheckCalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode, int VBFlags)
ModeIndex = ModeIndex_1024x768[i];
} else if(pSiS->VGAEngine == SIS_300_VGA) {
if(mode->VDisplay == 600) {
- ModeIndex = ModeIndex_1024x600[i];
+ if(pSiS->LCDheight == 600) { /* This mode only supported on 1024x600 panels */
+ ModeIndex = ModeIndex_1024x600[i];
+ }
}
}
break;
@@ -4246,8 +5197,10 @@ SiS_CheckCalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode, int VBFlags)
if(mode->VDisplay == 1024) {
ModeIndex = ModeIndex_1280x1024[i];
} else if(pSiS->VGAEngine == SIS_315_VGA) {
- if(mode->VDisplay == 768) {
- ModeIndex = ModeIndex_1280x768[i];
+ if(pSiS->LCDheight == 768) {
+ if(mode->VDisplay == 768) {
+ ModeIndex = ModeIndex_1280x768[i];
+ }
}
}
break;
@@ -4260,7 +5213,7 @@ SiS_CheckCalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode, int VBFlags)
break;
}
- } else { /* LCD on 301(B) */
+ } else { /* LCD on 301(B/LV) */
switch(mode->HDisplay)
{
@@ -4272,6 +5225,8 @@ SiS_CheckCalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode, int VBFlags)
case 640:
if(mode->VDisplay == 480) {
ModeIndex = ModeIndex_640x480[i];
+ } else if(mode->VDisplay == 400) {
+ ModeIndex = ModeIndex_640x400[i];
}
break;
case 800:
@@ -4282,32 +5237,35 @@ SiS_CheckCalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode, int VBFlags)
case 1024:
if(mode->VDisplay == 768) {
ModeIndex = ModeIndex_1024x768[i];
- } else if(pSiS->VGAEngine == SIS_300_VGA) {
- if(mode->VDisplay == 600) {
- ModeIndex = ModeIndex_1024x600[i];
- }
- }
- break;
- case 1152: /* ? */
- if(pSiS->VGAEngine == SIS_300_VGA) {
- if(mode->VDisplay == 768) {
- ModeIndex = ModeIndex_1152x768[i];
- }
- }
+ }
break;
case 1280:
if(mode->VDisplay == 960) {
- if(pSiS->VGAEngine == SIS_300_VGA) {
- ModeIndex = ModeIndex_300_1280x960[i];
- } else {
- ModeIndex = ModeIndex_310_1280x960[i];
- }
+ if(pSiS->LCDwidth != 1400) {
+ if(pSiS->VGAEngine == SIS_300_VGA) {
+ ModeIndex = ModeIndex_300_1280x960[i];
+ } else {
+ ModeIndex = ModeIndex_310_1280x960[i];
+ }
+ }
} else if (mode->VDisplay == 1024) {
ModeIndex = ModeIndex_1280x1024[i];
}
+ break;
+ case 1400:
+ if(VBFlags & (VB_302B | VB_302LV)) {
+ if(mode->VDisplay == 1050) {
+ if(pSiS->VGAEngine == SIS_315_VGA) {
+ ModeIndex = ModeIndex_1400x1050[i];
+ }
+ }
+ }
+ break;
case 1600:
- if(mode->VDisplay == 1200) {
- ModeIndex = ModeIndex_1600x1200[i];
+ if(VBFlags & (VB_302B | VB_302LV)) {
+ if(mode->VDisplay == 1200) {
+ ModeIndex = ModeIndex_1600x1200[i];
+ }
}
break;
}
@@ -4323,13 +5281,17 @@ SiS_CheckCalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode, int VBFlags)
switch(mode->HDisplay)
{
case 512:
- if(mode->VDisplay == 384) {
- ModeIndex = ModeIndex_512x384[i];
+ if(pSiS->VGAEngine == SIS_315_VGA) {
+ if(mode->VDisplay == 384) {
+ ModeIndex = ModeIndex_512x384[i];
+ }
}
break;
case 640:
if(mode->VDisplay == 480) {
ModeIndex = ModeIndex_640x480[i];
+ } else if(mode->VDisplay == 400) {
+ ModeIndex = ModeIndex_640x400[i];
}
break;
case 800:
@@ -4346,7 +5308,7 @@ SiS_CheckCalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode, int VBFlags)
break;
}
- } else { /* TV on 301(B) */
+ } else { /* TV on 301(B/LV) */
switch(mode->HDisplay)
{
@@ -4372,9 +5334,9 @@ SiS_CheckCalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode, int VBFlags)
ModeIndex = ModeIndex_800x600[i];
}
break;
- case 1024:
- if(mode->VDisplay == 768) {
- if(VBFlags & (VB_301B|VB_301LV|VB_302B|VB_302LV)) {
+ case 1024: /* Not supported with depth 32 */
+ if((mode->VDisplay == 768) && (i != 3) ) {
+ if(VBFlags & (VB_301B|VB_302B|VB_301LV|VB_302LV)) {
ModeIndex = ModeIndex_1024x768[i];
}
}
@@ -4387,36 +5349,41 @@ SiS_CheckCalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode, int VBFlags)
switch(mode->HDisplay)
{
- case 512:
- if(mode->VDisplay == 384) {
- ModeIndex = ModeIndex_512x384[i];
- }
- break;
case 640:
if(mode->VDisplay == 480) {
ModeIndex = ModeIndex_640x480[i];
+ } else if(mode->VDisplay == 400) {
+ ModeIndex = ModeIndex_640x400[i];
}
break;
case 800:
if(mode->VDisplay == 600) {
ModeIndex = ModeIndex_800x600[i];
- } else if(pSiS->VGAEngine == SIS_315_VGA) {
- if(mode->VDisplay == 480) {
- ModeIndex = ModeIndex_800x480[i];
- }
+ } else if(mode->VDisplay == 480) {
+ ModeIndex = ModeIndex_800x480[i];
+ }
+ break;
+ case 848:
+ if(mode->VDisplay == 480) {
+ ModeIndex = ModeIndex_848x480[i];
}
break;
+ case 856:
+ if(mode->VDisplay == 480) {
+ ModeIndex = ModeIndex_856x480[i];
+ }
+ break;
case 1024:
if(mode->VDisplay == 768) {
ModeIndex = ModeIndex_1024x768[i];
- } else if(pSiS->VGAEngine == SIS_315_VGA) {
- if(mode->VDisplay == 576) {
+ } else if(mode->VDisplay == 576) {
ModeIndex = ModeIndex_1024x576[i];
- }
}
break;
case 1152:
- if(pSiS->VGAEngine == SIS_300_VGA) {
+ if(mode->VDisplay == 864) {
+ ModeIndex = ModeIndex_1152x864[i];
+ } else if(pSiS->VGAEngine == SIS_300_VGA) {
if(mode->VDisplay == 768) {
ModeIndex = ModeIndex_1152x768[i];
}
@@ -4425,17 +5392,30 @@ SiS_CheckCalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode, int VBFlags)
case 1280:
if (mode->VDisplay == 1024) {
ModeIndex = ModeIndex_1280x1024[i];
+ } else if (mode->VDisplay == 720) {
+ ModeIndex = ModeIndex_1280x720[i];
+ } else if (mode->VDisplay == 960) {
+ if(pSiS->VGAEngine == SIS_315_VGA) {
+ ModeIndex = ModeIndex_310_1280x960[i];
+ } else {
+ ModeIndex = ModeIndex_300_1280x960[i];
+ }
} else if(pSiS->VGAEngine == SIS_315_VGA) {
if (mode->VDisplay == 768) {
ModeIndex = ModeIndex_1280x768[i];
- } else if (mode->VDisplay == 720) {
- ModeIndex = ModeIndex_1280x720[i];
}
}
break;
- case 1400:
- if(pSiS->VGAEngine == SIS_315_VGA) {
- ModeIndex = ModeIndex_1400x1050[i];
+ case 1360:
+ if(mode->VDisplay == 768) {
+ ModeIndex = ModeIndex_1360x768[i];
+ }
+ break;
+ case 1400:
+ if(mode->VDisplay == 1050) {
+ if(pSiS->VGAEngine == SIS_315_VGA) {
+ ModeIndex = ModeIndex_1400x1050[i];
+ }
}
break;
}
@@ -4449,26 +5429,759 @@ SiS_CheckCalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode, int VBFlags)
return(ModeIndex);
}
+USHORT
+SiS_CheckBuildCustomMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int VBFlags)
+{
+ SISPtr pSiS = SISPTR(pScrn);
+ int out_n, out_dn, out_div, out_sbit, out_scale;
+ int depth = pSiS->CurrentLayout.bitsPerPixel;
+
+#ifdef SISDUALHEAD
+ if( ((!pSiS->DualHeadMode) && (VBFlags & DISPTYPE_DISP2)) ||
+ ((pSiS->DualHeadMode) && (!pSiS->SecondHead)) ) return 0;
+#else
+ if(VBFlags & DISPTYPE_DISP2) return 0;
+#endif
+
+ pSiS->SiS_Pr->CDClock = mode->Clock;
+
+ pSiS->SiS_Pr->CHDisplay = mode->HDisplay;
+ pSiS->SiS_Pr->CHSyncStart = mode->HSyncStart;
+ pSiS->SiS_Pr->CHSyncEnd = mode->HSyncEnd;
+ pSiS->SiS_Pr->CHTotal = mode->HTotal;
+ pSiS->SiS_Pr->CHBlankStart = pSiS->SiS_Pr->CHDisplay;
+ pSiS->SiS_Pr->CHBlankEnd = pSiS->SiS_Pr->CHTotal;
+
+ pSiS->SiS_Pr->CVDisplay = mode->VDisplay;
+ pSiS->SiS_Pr->CVSyncStart = mode->VSyncStart;
+ pSiS->SiS_Pr->CVSyncEnd = mode->VSyncEnd;
+ pSiS->SiS_Pr->CVTotal = mode->VTotal;
+ pSiS->SiS_Pr->CVBlankStart = pSiS->SiS_Pr->CVSyncStart - 1;
+ pSiS->SiS_Pr->CVBlankEnd = pSiS->SiS_Pr->CVTotal;
+
+ pSiS->SiS_Pr->CFlags = mode->Flags;
+
+ SiS_compute_vclk(pSiS->SiS_Pr->CDClock, &out_n, &out_dn, &out_div, &out_sbit, &out_scale);
+
+#ifdef TWDEBUG
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Clock %d: n %d dn %d div %d sb %d sc %d\n",
+ pSiS->SiS_Pr->CDClock, out_n, out_dn, out_div, out_sbit, out_scale);
+#endif
+
+ pSiS->SiS_Pr->CSR2B = (out_div == 2) ? 0x80 : 0x00;
+ pSiS->SiS_Pr->CSR2B |= ((out_n - 1) & 0x7f);
+ pSiS->SiS_Pr->CSR2C = (out_dn - 1) & 0x1f;
+ pSiS->SiS_Pr->CSR2C |= (((out_scale - 1) & 3) << 5);
+ pSiS->SiS_Pr->CSR2C |= ((out_sbit & 0x01) << 7);
+ pSiS->SiS_Pr->CSRClock = (pSiS->SiS_Pr->CDClock / 1000) + 1;
+
+ pSiS->SiS_Pr->CCRT1CRTC[0] = ((pSiS->SiS_Pr->CHTotal >> 3) - 5) & 0xff;
+ pSiS->SiS_Pr->CCRT1CRTC[1] = (pSiS->SiS_Pr->CHDisplay >> 3) - 1;
+ pSiS->SiS_Pr->CCRT1CRTC[2] = (pSiS->SiS_Pr->CHBlankStart >> 3) - 1;
+ pSiS->SiS_Pr->CCRT1CRTC[3] = (((pSiS->SiS_Pr->CHBlankEnd >> 3) - 1) & 0x1F) | 0x80;
+ pSiS->SiS_Pr->CCRT1CRTC[4] = (pSiS->SiS_Pr->CHSyncStart >> 3) + 3;
+ pSiS->SiS_Pr->CCRT1CRTC[5] = ((((pSiS->SiS_Pr->CHBlankEnd >> 3) - 1) & 0x20) << 2) |
+ (((pSiS->SiS_Pr->CHSyncEnd >> 3) + 3) & 0x1F);
+
+ pSiS->SiS_Pr->CCRT1CRTC[6] = (pSiS->SiS_Pr->CVTotal - 2) & 0xFF;
+ pSiS->SiS_Pr->CCRT1CRTC[7] = (((pSiS->SiS_Pr->CVTotal - 2) & 0x100) >> 8)
+ | (((pSiS->SiS_Pr->CVDisplay - 1) & 0x100) >> 7)
+ | ((pSiS->SiS_Pr->CVSyncStart & 0x100) >> 6)
+ | (((pSiS->SiS_Pr->CVBlankStart - 1) & 0x100) >> 5)
+ | 0x10
+ | (((pSiS->SiS_Pr->CVTotal - 2) & 0x200) >> 4)
+ | (((pSiS->SiS_Pr->CVDisplay - 1) & 0x200) >> 3)
+ | ((pSiS->SiS_Pr->CVSyncStart & 0x200) >> 2);
+
+ pSiS->SiS_Pr->CCRT1CRTC[16] = ((((pSiS->SiS_Pr->CVBlankStart - 1) & 0x200) >> 4) >> 5); /* cr9 */
+
+#if 0
+ if (mode->VScan >= 32)
+ regp->CRTC[9] |= 0x1F;
+ else if (mode->VScan > 1)
+ regp->CRTC[9] |= mode->VScan - 1;
+#endif
+
+ pSiS->SiS_Pr->CCRT1CRTC[8] = (pSiS->SiS_Pr->CVSyncStart - 1) & 0xFF; /* cr10 */
+ pSiS->SiS_Pr->CCRT1CRTC[9] = ((pSiS->SiS_Pr->CVSyncEnd - 1) & 0x0F) | 0x80; /* cr11 */
+ pSiS->SiS_Pr->CCRT1CRTC[10] = (pSiS->SiS_Pr->CVDisplay - 1) & 0xFF; /* cr12 */
+ pSiS->SiS_Pr->CCRT1CRTC[11] = (pSiS->SiS_Pr->CVBlankStart - 1) & 0xFF; /* cr15 */
+ pSiS->SiS_Pr->CCRT1CRTC[12] = (pSiS->SiS_Pr->CVBlankEnd - 1) & 0xFF; /* cr16 */
+
+ pSiS->SiS_Pr->CCRT1CRTC[13] =
+ GETBITSTR((pSiS->SiS_Pr->CVTotal -2), 10:10, 0:0) |
+ GETBITSTR((pSiS->SiS_Pr->CVDisplay -1), 10:10, 1:1) |
+ GETBITSTR((pSiS->SiS_Pr->CVBlankStart-1), 10:10, 2:2) |
+ GETBITSTR((pSiS->SiS_Pr->CVSyncStart ), 10:10, 3:3) |
+ GETBITSTR((pSiS->SiS_Pr->CVBlankEnd -1), 8:8, 4:4) |
+ GETBITSTR((pSiS->SiS_Pr->CVSyncEnd -1), 4:4, 5:5) ;
+
+ pSiS->SiS_Pr->CCRT1CRTC[14] =
+ GETBITSTR((pSiS->SiS_Pr->CHTotal >> 3) - 5, 9:8, 1:0) |
+ GETBITSTR((pSiS->SiS_Pr->CHDisplay >> 3) - 1, 9:8, 3:2) |
+ GETBITSTR((pSiS->SiS_Pr->CHBlankStart >> 3) - 1, 9:8, 5:4) |
+ GETBITSTR((pSiS->SiS_Pr->CHSyncStart >> 3) + 3, 9:8, 7:6) ;
+
+
+ pSiS->SiS_Pr->CCRT1CRTC[15] =
+ GETBITSTR((pSiS->SiS_Pr->CHBlankEnd >> 3) - 1, 7:6, 1:0) |
+ GETBITSTR((pSiS->SiS_Pr->CHSyncEnd >> 3) + 3, 5:5, 2:2) ;
+
+ switch(depth) {
+ case 8:
+ pSiS->SiS_Pr->CModeFlag = 0x223b;
+ break;
+ case 16:
+ pSiS->SiS_Pr->CModeFlag = 0x227d;
+ break;
+ case 32:
+ pSiS->SiS_Pr->CModeFlag = 0x22ff;
+ break;
+ default:
+ return 0;
+ }
+
+ if(pSiS->SiS_Pr->CFlags & V_DBLSCAN)
+ pSiS->SiS_Pr->CModeFlag |= DoubleScanMode;
+ if((pSiS->SiS_Pr->CVDisplay >= 1024) ||
+ (pSiS->SiS_Pr->CVTotal >= 1024) ||
+ (pSiS->SiS_Pr->CHDisplay >= 1024))
+ pSiS->SiS_Pr->CModeFlag |= LineCompareOff;
+ if(pSiS->SiS_Pr->CFlags & V_CLKDIV2)
+ pSiS->SiS_Pr->CModeFlag |= HalfDCLK;
+
+ pSiS->SiS_Pr->CInfoFlag = 0x0007;
+ if(pSiS->SiS_Pr->CFlags & V_NHSYNC)
+ pSiS->SiS_Pr->CInfoFlag |= 0x4000;
+ if(pSiS->SiS_Pr->CFlags & V_NVSYNC)
+ pSiS->SiS_Pr->CInfoFlag |= 0x8000;
+ if(pSiS->SiS_Pr->CFlags & V_INTERLACE)
+ pSiS->SiS_Pr->CInfoFlag |= InterlaceMode;
+
+ pSiS->SiS_Pr->UseCustomMode = TRUE;
+#ifdef TWDEBUG
+ xf86DrvMsg(0, X_INFO, "Custom mode %dx%d:\n",
+ pSiS->SiS_Pr->CHDisplay,pSiS->SiS_Pr->CVDisplay);
+ xf86DrvMsg(0, X_INFO, "Modeflag %04x, Infoflag %04x\n",
+ pSiS->SiS_Pr->CModeFlag, pSiS->SiS_Pr->CInfoFlag);
+ xf86DrvMsg(0, X_INFO, " {{0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,\n",
+ pSiS->SiS_Pr->CCRT1CRTC[0],
+ pSiS->SiS_Pr->CCRT1CRTC[1],
+ pSiS->SiS_Pr->CCRT1CRTC[2],
+ pSiS->SiS_Pr->CCRT1CRTC[3],
+ pSiS->SiS_Pr->CCRT1CRTC[4],
+ pSiS->SiS_Pr->CCRT1CRTC[5],
+ pSiS->SiS_Pr->CCRT1CRTC[6],
+ pSiS->SiS_Pr->CCRT1CRTC[7]);
+ xf86DrvMsg(0, X_INFO, " 0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,\n",
+ pSiS->SiS_Pr->CCRT1CRTC[8],
+ pSiS->SiS_Pr->CCRT1CRTC[9],
+ pSiS->SiS_Pr->CCRT1CRTC[10],
+ pSiS->SiS_Pr->CCRT1CRTC[11],
+ pSiS->SiS_Pr->CCRT1CRTC[12],
+ pSiS->SiS_Pr->CCRT1CRTC[13],
+ pSiS->SiS_Pr->CCRT1CRTC[14],
+ pSiS->SiS_Pr->CCRT1CRTC[15]);
+ xf86DrvMsg(0, X_INFO, " 0x%02x}},\n", pSiS->SiS_Pr->CCRT1CRTC[16]);
+ xf86DrvMsg(0, X_INFO, "Clock: 0x%02x, 0x%02x, %d\n",
+ pSiS->SiS_Pr->CSR2B,
+ pSiS->SiS_Pr->CSR2C,
+ pSiS->SiS_Pr->CSRClock);
+#endif
+ return 1;
+}
+
+/* TW: Build a list of supported modes */
+DisplayModePtr
+SiSBuildBuiltInModeList(ScrnInfoPtr pScrn)
+{
+ SISPtr pSiS = SISPTR(pScrn);
+ unsigned short VRE, VBE, VRS, VBS, VDE, VT;
+ unsigned short HRE, HBE, HRS, HBS, HDE, HT;
+ unsigned char sr_data, cr_data, cr_data2, cr_data3;
+ unsigned char sr2b, sr2c;
+ float num, denum, postscalar, divider;
+ int A, B, C, D, E, F, temp, i, j, index, vclkindex;
+ DisplayModePtr new = NULL, current = NULL, first = NULL, backup = NULL;
+
+ pSiS->backupmodelist = NULL;
+
+ /* Initialize our pointers */
+ if(pSiS->VGAEngine == SIS_300_VGA) {
+#ifdef SIS300
+ InitTo300Pointer(pSiS->SiS_Pr, &pSiS->sishw_ext);
+#else
+ return NULL;
+#endif
+ } else if(pSiS->VGAEngine == SIS_315_VGA) {
+#ifdef SIS315H
+ InitTo310Pointer(pSiS->SiS_Pr, &pSiS->sishw_ext);
+#else
+ return NULL;
+#endif
+ } else return NULL;
+
+ i = 0;
+ while(pSiS->SiS_Pr->SiS_RefIndex[i].Ext_InfoFlag != 0xFFFF) {
+
+ index = pSiS->SiS_Pr->SiS_RefIndex[i].Ext_CRT1CRTC;
+#if 0 /* Not any longer */
+ if(pSiS->VGAEngine == SIS_300_VGA) index &= 0x3F;
+#endif
+
+ if(((pSiS->SiS_Pr->SiS_RefIndex[i].XRes < 512) && (!pSiS->DSTN)) ||
+ ((pSiS->DSTN) &&
+ (pSiS->SiS_Pr->SiS_RefIndex[i].XRes < 512) &&
+ (pSiS->SiS_Pr->SiS_RefIndex[i].XRes != 320) &&
+ (pSiS->SiS_Pr->SiS_RefIndex[i].YRes != 480))) {
+ i++;
+ continue;
+ }
+
+ if(!(new = xalloc(sizeof(DisplayModeRec)))) return first;
+ memset(new, 0, sizeof(DisplayModeRec));
+ if(!(new->name = xalloc(10))) {
+ xfree(new);
+ return first;
+ }
+ if(!first) first = new;
+ if(current) {
+ current->next = new;
+ new->prev = current;
+ }
+
+ current = new;
+
+ sprintf(current->name, "%dx%d", pSiS->SiS_Pr->SiS_RefIndex[i].XRes,
+ pSiS->SiS_Pr->SiS_RefIndex[i].YRes);
+
+ current->status = MODE_OK;
+
+ current->type = M_T_DEFAULT;
+
+ vclkindex = pSiS->SiS_Pr->SiS_RefIndex[i].Ext_CRTVCLK;
+ if(pSiS->VGAEngine == SIS_300_VGA) vclkindex &= 0x3F;
+
+ sr2b = pSiS->SiS_Pr->SiS_VCLKData[vclkindex].SR2B;
+ sr2c = pSiS->SiS_Pr->SiS_VCLKData[vclkindex].SR2C;
+
+ divider = (sr2b & 0x80) ? 2.0 : 1.0;
+ postscalar = (sr2c & 0x80) ?
+ ( (((sr2c >> 5) & 0x03) == 0x02) ? 6.0 : 8.0) : (((sr2c >> 5) & 0x03) + 1.0);
+ num = (sr2b & 0x7f) + 1.0;
+ denum = (sr2c & 0x1f) + 1.0;
+
+#ifdef TWDEBUG
+ xf86DrvMsg(0, X_INFO, "------------\n");
+ xf86DrvMsg(0, X_INFO, "sr2b: %x sr2c %x div %f ps %f num %f denum %f\n",
+ sr2b, sr2c, divider, postscalar, num, denum);
+#endif
+
+ current->Clock = (int)(14318 * (divider / postscalar) * (num / denum));
+
+ sr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[14];
+ /* inSISIDXREG(SISSR, 0x0b, sr_data); */
+
+ cr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[0];
+ /* inSISIDXREG(SISCR, 0x00, cr_data); */
+
+ /* Horizontal total */
+ HT = (cr_data & 0xff) |
+ ((unsigned short) (sr_data & 0x03) << 8);
+ A = HT + 5;
+
+ cr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[1];
+ /* inSISIDXREG(SISCR, 0x01, cr_data); */
+
+ /* Horizontal display enable end */
+ HDE = (cr_data & 0xff) |
+ ((unsigned short) (sr_data & 0x0C) << 6);
+ E = HDE + 1;
+
+ cr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[4];
+ /* inSISIDXREG(SISCR, 0x04, cr_data); */
+
+ /* Horizontal retrace (=sync) start */
+ HRS = (cr_data & 0xff) |
+ ((unsigned short) (sr_data & 0xC0) << 2);
+ F = HRS - E - 3;
+
+ cr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[2];
+ /* inSISIDXREG(SISCR, 0x02, cr_data); */
+
+ /* Horizontal blank start */
+ HBS = (cr_data & 0xff) |
+ ((unsigned short) (sr_data & 0x30) << 4);
+
+ sr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[15];
+ /* inSISIDXREG(SISSR, 0x0c, sr_data); */
+
+ cr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[3];
+ /* inSISIDXREG(SISCR, 0x03, cr_data); */
+
+ cr_data2 = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[5];
+ /* inSISIDXREG(SISCR, 0x05, cr_data2); */
+
+ /* Horizontal blank end */
+ HBE = (cr_data & 0x1f) |
+ ((unsigned short) (cr_data2 & 0x80) >> 2) |
+ ((unsigned short) (sr_data & 0x03) << 6);
+
+ /* Horizontal retrace (=sync) end */
+ HRE = (cr_data2 & 0x1f) | ((sr_data & 0x04) << 3);
+
+ temp = HBE - ((E - 1) & 255);
+ B = (temp > 0) ? temp : (temp + 256);
+
+ temp = HRE - ((E + F + 3) & 63);
+ C = (temp > 0) ? temp : (temp + 64);
+
+ D = B - F - C;
+
+ current->HDisplay = (E * 8);
+ current->HSyncStart = (E * 8) + (F * 8);
+ current->HSyncEnd = (E * 8) + (F * 8) + (C * 8);
+ current->HTotal = (E * 8) + (F * 8) + (C * 8) + (D * 8);
+
+#ifdef TWDEBUG
+ xf86DrvMsg(0, X_INFO,
+ "H: A %d B %d C %d D %d E %d F %d HT %d HDE %d HRS %d HBS %d HBE %d HRE %d\n",
+ A, B, C, D, E, F, HT, HDE, HRS, HBS, HBE, HRE);
+#endif
+
+ sr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[13];
+ /* inSISIDXREG(SISSR, 0x0A, sr_data); */
+
+ cr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[6];
+ /* inSISIDXREG(SISCR, 0x06, cr_data); */
+
+ cr_data2 = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[7];
+ /* inSISIDXREG(SISCR, 0x07, cr_data2); */
+
+ /* Vertical total */
+ VT = (cr_data & 0xFF) |
+ ((unsigned short) (cr_data2 & 0x01) << 8) |
+ ((unsigned short)(cr_data2 & 0x20) << 4) |
+ ((unsigned short) (sr_data & 0x01) << 10);
+ A = VT + 2;
+
+ cr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[10];
+ /* inSISIDXREG(SISCR, 0x12, cr_data); */
+
+ /* Vertical display enable end */
+ VDE = (cr_data & 0xff) |
+ ((unsigned short) (cr_data2 & 0x02) << 7) |
+ ((unsigned short) (cr_data2 & 0x40) << 3) |
+ ((unsigned short) (sr_data & 0x02) << 9);
+ E = VDE + 1;
+
+ cr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[8];
+ /* inSISIDXREG(SISCR, 0x10, cr_data); */
+
+ /* Vertical retrace (=sync) start */
+ VRS = (cr_data & 0xff) |
+ ((unsigned short) (cr_data2 & 0x04) << 6) |
+ ((unsigned short) (cr_data2 & 0x80) << 2) |
+ ((unsigned short) (sr_data & 0x08) << 7);
+ F = VRS + 1 - E;
+
+ cr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[11];
+ /* inSISIDXREG(SISCR, 0x15, cr_data); */
+
+ cr_data3 = (pSiS->SiS_Pr->SiS_CRT1Table[index].CR[16] & 0x01) << 5;
+ /* inSISIDXREG(SISCR, 0x09, cr_data3); */
+
+ /* Vertical blank start */
+ VBS = (cr_data & 0xff) |
+ ((unsigned short) (cr_data2 & 0x08) << 5) |
+ ((unsigned short) (cr_data3 & 0x20) << 4) |
+ ((unsigned short) (sr_data & 0x04) << 8);
+
+ cr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[12];
+ /* inSISIDXREG(SISCR, 0x16, cr_data); */
+
+ /* Vertical blank end */
+ VBE = (cr_data & 0xff) |
+ ((unsigned short) (sr_data & 0x10) << 4);
+ temp = VBE - ((E - 1) & 511);
+ B = (temp > 0) ? temp : (temp + 512);
+
+ cr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[9];
+ /* inSISIDXREG(SISCR, 0x11, cr_data); */
+
+ /* Vertical retrace (=sync) end */
+ VRE = (cr_data & 0x0f) | ((sr_data & 0x20) >> 1);
+ temp = VRE - ((E + F - 1) & 31);
+ C = (temp > 0) ? temp : (temp + 32);
+
+ D = B - F - C;
+
+ current->VDisplay = VDE + 1;
+ current->VSyncStart = VRS + 1;
+ current->VSyncEnd = ((VRS & ~0x1f) | VRE) + 1;
+ if(VRE <= (VRS & 0x1f)) current->VSyncEnd += 32;
+ current->VTotal = E + D + C + F;
+
+#if 0
+ current->VDisplay = E;
+ current->VSyncStart = E + D;
+ current->VSyncEnd = E + D + C;
+ current->VTotal = E + D + C + F;
+#endif
+
+#ifdef TWDEBUG
+ xf86DrvMsg(0, X_INFO,
+ "V: A %d B %d C %d D %d E %d F %d VT %d VDE %d VRS %d VBS %d VBE %d VRE %d\n",
+ A, B, C, D, E, F, VT, VDE, VRS, VBS, VBE, VRE);
+#endif
+
+ if(pSiS->SiS_Pr->SiS_RefIndex[i].Ext_InfoFlag & 0x4000)
+ current->Flags |= H_NHSYNC;
+ else
+ current->Flags |= H_PHSYNC;
+
+ if(pSiS->SiS_Pr->SiS_RefIndex[i].Ext_InfoFlag & 0x8000)
+ current->Flags |= V_NVSYNC;
+ else
+ current->Flags |= V_PVSYNC;
+
+ if(pSiS->SiS_Pr->SiS_RefIndex[i].Ext_InfoFlag & 0x0080)
+ current->Flags |= V_INTERLACE;
+
+ j = 0;
+ while(pSiS->SiS_Pr->SiS_EModeIDTable[j].Ext_ModeID != 0xff) {
+ if(pSiS->SiS_Pr->SiS_EModeIDTable[j].Ext_ModeID ==
+ pSiS->SiS_Pr->SiS_RefIndex[i].ModeID) {
+ if(pSiS->SiS_Pr->SiS_EModeIDTable[j].Ext_ModeFlag & DoubleScanMode) {
+ current->Flags |= V_DBLSCAN;
+ }
+ break;
+ }
+ j++;
+ }
+
+ if(current->Flags & V_INTERLACE) {
+ current->VDisplay <<= 1;
+ current->VSyncStart <<= 1;
+ current->VSyncEnd <<= 1;
+ current->VTotal <<= 1;
+ current->VTotal |= 1;
+ }
+ if(current->Flags & V_DBLSCAN) {
+ current->Clock >>= 1;
+ current->VDisplay >>= 1;
+ current->VSyncStart >>= 1;
+ current->VSyncEnd >>= 1;
+ current->VTotal >>= 1;
+ }
+
+ if((backup = xalloc(sizeof(DisplayModeRec)))) {
+ if(!pSiS->backupmodelist) pSiS->backupmodelist = backup;
+ else {
+ pSiS->backupmodelist->next = backup;
+ backup->prev = pSiS->backupmodelist;
+ }
+ backup->next = NULL;
+ backup->HDisplay = current->HDisplay;
+ backup->HSyncStart = current->HSyncStart;
+ backup->HSyncEnd = current->HSyncEnd;
+ backup->HTotal = current->HTotal;
+ backup->VDisplay = current->VDisplay;
+ backup->VSyncStart = current->VSyncStart;
+ backup->VSyncEnd = current->VSyncEnd;
+ backup->VTotal = current->VTotal;
+ backup->Flags = current->Flags;
+ backup->Clock = current->Clock;
+ }
+
+#ifdef TWDEBUG
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Built-in: %s %.2f %d %d %d %d %d %d %d %d\n",
+ current->name, (float)current->Clock / 1000,
+ current->HDisplay, current->HSyncStart, current->HSyncEnd, current->HTotal,
+ current->VDisplay, current->VSyncStart, current->VSyncEnd, current->VTotal);
+#endif
+
+ i++;
+ }
+
+ return first;
+
+}
+
#define MODEID_OFF 0x449
unsigned char
SiS_GetSetModeID(ScrnInfoPtr pScrn, unsigned char id)
{
+ return(SiS_GetSetBIOSScratch(pScrn, MODEID_OFF, id));
+}
+
+unsigned char
+SiS_GetSetBIOSScratch(ScrnInfoPtr pScrn, USHORT offset, unsigned char value)
+{
unsigned char ret;
+ unsigned char *base;
+
+ base = xf86MapVidMem(pScrn->scrnIndex, VIDMEM_MMIO, 0, 0x2000);
+ if(!base) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "(init.c: Could not map BIOS scratch area)\n");
+ return 0;
+ }
- unsigned char* base = xf86MapVidMem(pScrn->scrnIndex,
- VIDMEM_MMIO, 0, 0x2000);
- ret = *(base + MODEID_OFF);
+ ret = *(base + offset);
- /* id != 0xff means: set mode */
- if (id != 0xff)
- *(base + MODEID_OFF) = id;
- xf86UnMapVidMem(pScrn->scrnIndex,base,0x2000);
+ /* value != 0xff means: set register */
+ if (value != 0xff)
+ *(base + offset) = value;
+
+ xf86UnMapVidMem(pScrn->scrnIndex, base, 0x2000);
return ret;
}
#endif
+#ifdef LINUX_KERNEL
+int
+sisfb_mode_rate_to_dclock(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,
+ unsigned char modeno, unsigned char rateindex)
+{
+ USHORT ModeNo = modeno;
+ USHORT ModeIdIndex = 0, ClockIndex = 0;
+ USHORT RefreshRateTableIndex = 0;
+ UCHAR *ROMAddr = HwDeviceExtension->pjVirtualRomBase;
+ ULONG temp = 0;
+ int Clock;
+
+ if(HwDeviceExtension->jChipType < SIS_315H) {
+#ifdef SIS300
+ InitTo300Pointer(SiS_Pr, HwDeviceExtension);
+#else
+ return 65;
+#endif
+ } else {
+#ifdef SIS315H
+ InitTo310Pointer(SiS_Pr, HwDeviceExtension);
+#else
+ return 65;
+#endif
+ }
+
+ temp = SiS_SearchModeID(SiS_Pr, ROMAddr, &ModeNo, &ModeIdIndex);
+ if(!temp) {
+ printk(KERN_ERR "Could not find mode %x\n", ModeNo);
+ return 65;
+ }
+
+ RefreshRateTableIndex = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].REFindex;
+ RefreshRateTableIndex += (rateindex - 1);
+ ClockIndex = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
+ if(HwDeviceExtension->jChipType < SIS_315H) {
+ ClockIndex &= 0x3F;
+ }
+ Clock = SiS_Pr->SiS_VCLKData[ClockIndex].CLOCK * 1000 * 1000;
+
+ return(Clock);
+}
+int
+sisfb_mode_rate_to_ddata(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,
+ unsigned char modeno, unsigned char rateindex,
+ ULONG *left_margin, ULONG *right_margin,
+ ULONG *upper_margin, ULONG *lower_margin,
+ ULONG *hsync_len, ULONG *vsync_len,
+ ULONG *sync, ULONG *vmode)
+{
+ USHORT ModeNo = modeno;
+ USHORT ModeIdIndex = 0, index = 0;
+ USHORT RefreshRateTableIndex = 0;
+ UCHAR *ROMAddr = HwDeviceExtension->pjVirtualRomBase;
+ unsigned short VRE, VBE, VRS, VBS, VDE, VT;
+ unsigned short HRE, HBE, HRS, HBS, HDE, HT;
+ unsigned char sr_data, cr_data, cr_data2, cr_data3;
+ int A, B, C, D, E, F, temp, j;
+
+ if(HwDeviceExtension->jChipType < SIS_315H) {
+#ifdef SIS300
+ InitTo300Pointer(SiS_Pr, HwDeviceExtension);
+#else
+ return 0;
+#endif
+ } else {
+#ifdef SIS315H
+ InitTo310Pointer(SiS_Pr, HwDeviceExtension);
+#else
+ return 0;
+#endif
+ }
+
+ temp = SiS_SearchModeID(SiS_Pr, ROMAddr, &ModeNo, &ModeIdIndex);
+ if(!temp) return 0;
+
+ RefreshRateTableIndex = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].REFindex;
+ RefreshRateTableIndex += (rateindex - 1);
+ index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
+
+ sr_data = SiS_Pr->SiS_CRT1Table[index].CR[14];
+
+ cr_data = SiS_Pr->SiS_CRT1Table[index].CR[0];
+
+ /* Horizontal total */
+ HT = (cr_data & 0xff) |
+ ((unsigned short) (sr_data & 0x03) << 8);
+ A = HT + 5;
+
+ cr_data = SiS_Pr->SiS_CRT1Table[index].CR[1];
+
+ /* Horizontal display enable end */
+ HDE = (cr_data & 0xff) |
+ ((unsigned short) (sr_data & 0x0C) << 6);
+ E = HDE + 1;
+
+ cr_data = SiS_Pr->SiS_CRT1Table[index].CR[4];
+
+ /* Horizontal retrace (=sync) start */
+ HRS = (cr_data & 0xff) |
+ ((unsigned short) (sr_data & 0xC0) << 2);
+ F = HRS - E - 3;
+
+ cr_data = SiS_Pr->SiS_CRT1Table[index].CR[2];
+
+ /* Horizontal blank start */
+ HBS = (cr_data & 0xff) |
+ ((unsigned short) (sr_data & 0x30) << 4);
+
+ sr_data = SiS_Pr->SiS_CRT1Table[index].CR[15];
+
+ cr_data = SiS_Pr->SiS_CRT1Table[index].CR[3];
+
+ cr_data2 = SiS_Pr->SiS_CRT1Table[index].CR[5];
+
+ /* Horizontal blank end */
+ HBE = (cr_data & 0x1f) |
+ ((unsigned short) (cr_data2 & 0x80) >> 2) |
+ ((unsigned short) (sr_data & 0x03) << 6);
+
+ /* Horizontal retrace (=sync) end */
+ HRE = (cr_data2 & 0x1f) | ((sr_data & 0x04) << 3);
+
+ temp = HBE - ((E - 1) & 255);
+ B = (temp > 0) ? temp : (temp + 256);
+
+ temp = HRE - ((E + F + 3) & 63);
+ C = (temp > 0) ? temp : (temp + 64);
+
+ D = B - F - C;
+
+ *left_margin = D * 8;
+ *right_margin = F * 8;
+ *hsync_len = C * 8;
+
+ sr_data = SiS_Pr->SiS_CRT1Table[index].CR[13];
+
+ cr_data = SiS_Pr->SiS_CRT1Table[index].CR[6];
+
+ cr_data2 = SiS_Pr->SiS_CRT1Table[index].CR[7];
+
+ /* Vertical total */
+ VT = (cr_data & 0xFF) |
+ ((unsigned short) (cr_data2 & 0x01) << 8) |
+ ((unsigned short)(cr_data2 & 0x20) << 4) |
+ ((unsigned short) (sr_data & 0x01) << 10);
+ A = VT + 2;
+
+ cr_data = SiS_Pr->SiS_CRT1Table[index].CR[10];
+
+ /* Vertical display enable end */
+ VDE = (cr_data & 0xff) |
+ ((unsigned short) (cr_data2 & 0x02) << 7) |
+ ((unsigned short) (cr_data2 & 0x40) << 3) |
+ ((unsigned short) (sr_data & 0x02) << 9);
+ E = VDE + 1;
+
+ cr_data = SiS_Pr->SiS_CRT1Table[index].CR[8];
+
+ /* Vertical retrace (=sync) start */
+ VRS = (cr_data & 0xff) |
+ ((unsigned short) (cr_data2 & 0x04) << 6) |
+ ((unsigned short) (cr_data2 & 0x80) << 2) |
+ ((unsigned short) (sr_data & 0x08) << 7);
+ F = VRS + 1 - E;
+
+ cr_data = SiS_Pr->SiS_CRT1Table[index].CR[11];
+
+ cr_data3 = (SiS_Pr->SiS_CRT1Table[index].CR[16] & 0x01) << 5;
+
+ /* Vertical blank start */
+ VBS = (cr_data & 0xff) |
+ ((unsigned short) (cr_data2 & 0x08) << 5) |
+ ((unsigned short) (cr_data3 & 0x20) << 4) |
+ ((unsigned short) (sr_data & 0x04) << 8);
+
+ cr_data = SiS_Pr->SiS_CRT1Table[index].CR[12];
+
+ /* Vertical blank end */
+ VBE = (cr_data & 0xff) |
+ ((unsigned short) (sr_data & 0x10) << 4);
+ temp = VBE - ((E - 1) & 511);
+ B = (temp > 0) ? temp : (temp + 512);
+
+ cr_data = SiS_Pr->SiS_CRT1Table[index].CR[9];
+
+ /* Vertical retrace (=sync) end */
+ VRE = (cr_data & 0x0f) | ((sr_data & 0x20) >> 1);
+ temp = VRE - ((E + F - 1) & 31);
+ C = (temp > 0) ? temp : (temp + 32);
+
+ D = B - F - C;
+
+ *upper_margin = D;
+ *lower_margin = F;
+ *vsync_len = C;
+
+ if(SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag & 0x8000)
+ *sync &= ~FB_SYNC_VERT_HIGH_ACT;
+ else
+ *sync |= FB_SYNC_VERT_HIGH_ACT;
+
+ if(SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag & 0x4000)
+ *sync &= ~FB_SYNC_HOR_HIGH_ACT;
+ else
+ *sync |= FB_SYNC_HOR_HIGH_ACT;
+
+ *vmode = FB_VMODE_NONINTERLACED;
+ if(SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag & 0x0080)
+ *vmode = FB_VMODE_INTERLACED;
+ else {
+ j = 0;
+ while(SiS_Pr->SiS_EModeIDTable[j].Ext_ModeID != 0xff) {
+ if(SiS_Pr->SiS_EModeIDTable[j].Ext_ModeID ==
+ SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].ModeID) {
+ if(SiS_Pr->SiS_EModeIDTable[j].Ext_ModeFlag & DoubleScanMode) {
+ *vmode = FB_VMODE_DOUBLE;
+ }
+ break;
+ }
+ j++;
+ }
+ }
+
+#if 0 /* That's bullshit, only the resolution needs to be shifted */
+ if((*vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) {
+ *upper_margin <<= 1;
+ *lower_margin <<= 1;
+ *vsync_len <<= 1;
+ } else if((*vmode & FB_VMODE_MASK) == FB_VMODE_DOUBLE) {
+ *upper_margin >>= 1;
+ *lower_margin >>= 1;
+ *vsync_len >>= 1;
+ }
+#endif
+
+ return 1;
+}
+
+#endif
diff --git a/drivers/video/sis/init.h b/drivers/video/sis/init.h
index 05a2123a6c96..ab7f63fa6e5d 100644
--- a/drivers/video/sis/init.h
+++ b/drivers/video/sis/init.h
@@ -24,9 +24,16 @@
#endif
#ifdef LINUX_KERNEL
+#include <linux/config.h>
+#include <linux/version.h>
#include <linux/types.h>
#include <asm/io.h>
+#include <linux/fb.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
#include <linux/sisfb.h>
+#else
+#include <video/sisfb.h>
+#endif
#endif
#ifdef WIN2000
@@ -42,7 +49,7 @@
#include "tools.h"
#endif
-USHORT SiS_DRAMType[17][5]={
+const USHORT SiS_DRAMType[17][5]={
{0x0C,0x0A,0x02,0x40,0x39},
{0x0D,0x0A,0x01,0x40,0x48},
{0x0C,0x09,0x02,0x20,0x35},
@@ -62,7 +69,7 @@ USHORT SiS_DRAMType[17][5]={
{0x09,0x08,0x01,0x01,0x00}
};
-USHORT SiS_SDRDRAM_TYPE[13][5] =
+const USHORT SiS_SDRDRAM_TYPE[13][5] =
{
{ 2,12, 9,64,0x35},
{ 1,13, 9,64,0x44},
@@ -79,7 +86,7 @@ USHORT SiS_SDRDRAM_TYPE[13][5] =
{ 1, 9, 8, 2,0x00}
};
-USHORT SiS_DDRDRAM_TYPE[4][5] =
+const USHORT SiS_DDRDRAM_TYPE[4][5] =
{
{ 2,12, 9,64,0x35},
{ 2,12, 8,32,0x31},
@@ -87,9 +94,7 @@ USHORT SiS_DDRDRAM_TYPE[4][5] =
{ 2, 9, 8, 4,0x01}
};
-UCHAR SiS_ChannelAB, SiS_DataBusWidth;
-
-USHORT SiS_MDA_DAC[] =
+const USHORT SiS_MDA_DAC[] =
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,
@@ -101,7 +106,7 @@ USHORT SiS_MDA_DAC[] =
0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F
};
-USHORT SiS_CGA_DAC[] =
+const USHORT SiS_CGA_DAC[] =
{
0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15,
0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15,
@@ -113,7 +118,7 @@ USHORT SiS_CGA_DAC[] =
0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F
};
-USHORT SiS_EGA_DAC[] =
+const USHORT SiS_EGA_DAC[] =
{
0x00,0x10,0x04,0x14,0x01,0x11,0x05,0x15,
0x20,0x30,0x24,0x34,0x21,0x31,0x25,0x35,
@@ -125,7 +130,7 @@ USHORT SiS_EGA_DAC[] =
0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F
};
-USHORT SiS_VGA_DAC[] =
+const USHORT SiS_VGA_DAC[] =
{
0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15,
0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F,
@@ -139,195 +144,189 @@ USHORT SiS_VGA_DAC[] =
0x0B,0x0C,0x0D,0x0F,0x10
};
-USHORT SiS_P3c4,SiS_P3d4,SiS_P3c0,SiS_P3ce,SiS_P3c2;
-USHORT SiS_P3ca,SiS_P3c6,SiS_P3c7,SiS_P3c8,SiS_P3c9,SiS_P3da;
-USHORT SiS_Part1Port,SiS_Part2Port;
-USHORT SiS_Part3Port,SiS_Part4Port,SiS_Part5Port;
-USHORT SiS_CRT1Mode;
-
-USHORT flag_clearbuffer;
-int SiS_RAMType;
-USHORT SiS_ModeType;
-USHORT SiS_IF_DEF_LVDS, SiS_IF_DEF_TRUMPION, SiS_IF_DEF_DSTN, SiS_IF_DEF_FSTN;
-USHORT SiS_IF_DEF_CH70xx, SiS_IF_DEF_HiVision;
-USHORT SiS_Backup70xx=0xff;
-USHORT SiS_VBInfo, SiS_LCDResInfo, SiS_LCDTypeInfo, SiS_LCDInfo, SiS_VBType;
-USHORT SiS_VBExtInfo, SiS_HiVision;
-USHORT SiS_SelectCRT2Rate;
-
-extern USHORT SiS_SetFlag;
-extern USHORT SiS_DDC_Port;
-extern USHORT Panel800x600, Panel1024x768, Panel1280x1024, Panel1600x1200;
-extern USHORT Panel1280x960, Panel1400x1050, Panel320x480, Panel1152x768;
-extern USHORT Panel1152x864, Panel1280x768, Panel1024x600, Panel640x480;
-extern USHORT PanelMinLVDS, PanelMin301, PanelMax;
-extern USHORT SiS_ChrontelInit;
-
void SiS_SetReg1(USHORT, USHORT, USHORT);
-void SiS_SetReg2(USHORT, USHORT, USHORT);
+void SiS_SetReg2(SiS_Private *, USHORT, USHORT, USHORT);
void SiS_SetReg3(USHORT, USHORT);
void SiS_SetReg4(USHORT, ULONG);
+void SiS_SetReg5(USHORT, USHORT);
UCHAR SiS_GetReg1(USHORT, USHORT);
UCHAR SiS_GetReg2(USHORT);
ULONG SiS_GetReg3(USHORT);
-void SiS_ClearDAC(ULONG);
-void SiS_SetMemoryClock(UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension);
-void SiS_SetDRAMModeRegister(UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension);
-BOOLEAN SiS_SearchVBModeID(UCHAR *ROMAddr, USHORT *ModeNo);
-void SiS_IsLowResolution(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex);
-ULONG GetDRAMSize(PSIS_HW_DEVICE_INFO HwDeviceExtension);
+USHORT SiS_GetReg4(USHORT);
+void SiS_ClearDAC(SiS_Private *SiS_Pr, ULONG);
+void SiS_SetMemoryClock(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension);
+void SiS_SetDRAMModeRegister(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension);
+BOOLEAN SiS_SearchVBModeID(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT *ModeNo);
+void SiS_IsLowResolution(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex);
#ifdef SIS300
-void InitTo300Pointer(PSIS_HW_DEVICE_INFO HwDeviceExtension);
-void SiS_SetDRAMSize_300(PSIS_HW_DEVICE_INFO HwDeviceExtension);
-USHORT SiS_ChkBUSWidth_300(ULONG FBAddress);
+void SiS_SetDRAMSize_300(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension);
+USHORT SiS_ChkBUSWidth_300(SiS_Private *SiS_Pr, ULONG FBAddress);
#endif
#ifdef SIS315H
-void InitTo310Pointer(PSIS_HW_DEVICE_INFO HwDeviceExtension);
-UCHAR SiS_Get310DRAMType(UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension);
-void SiS_DDR_MRS(void);
-void SiS_SDR_MRS(void);
-void SiS_DisableRefresh(void);
-void SiS_EnableRefresh(UCHAR *ROMAddr);
-void SiS_SetDRAMSize_310(PSIS_HW_DEVICE_INFO);
-void SiS_DisableChannelInterleaving(int index,USHORT SiS_DDRDRAM_TYPE[][5]);
-void SiS_SetDRAMSizingType(int index,USHORT DRAMTYPE_TABLE[][5]);
-void SiS_CheckBusWidth_310(UCHAR *ROMAddress,ULONG FBAddress,
+UCHAR SiS_Get310DRAMType(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension);
+void SiS_DDR_MRS(SiS_Private *SiS_Pr);
+void SiS_SDR_MRS(SiS_Private *SiS_Pr);
+void SiS_DisableRefresh(SiS_Private *SiS_Pr);
+void SiS_EnableRefresh(SiS_Private *SiS_Pr, UCHAR *ROMAddr);
+void SiS_SetDRAMSize_310(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO);
+void SiS_DisableChannelInterleaving(SiS_Private *SiS_Pr, int index,USHORT SiS_DDRDRAM_TYPE[][5]);
+void SiS_SetDRAMSizingType(SiS_Private *SiS_Pr, int index,USHORT DRAMTYPE_TABLE[][5]);
+void SiS_CheckBusWidth_310(SiS_Private *SiS_Pr, UCHAR *ROMAddress,ULONG FBAddress,
PSIS_HW_DEVICE_INFO HwDeviceExtension);
-int SiS_SetRank(int index,UCHAR RankNo,UCHAR SiS_ChannelAB,USHORT DRAMTYPE_TABLE[][5]);
-int SiS_SetDDRChannel(int index,UCHAR ChannelNo,UCHAR SiS_ChannelAB,
+int SiS_SetRank(SiS_Private *SiS_Pr, int index,UCHAR RankNo,USHORT DRAMTYPE_TABLE[][5]);
+int SiS_SetDDRChannel(SiS_Private *SiS_Pr, int index,UCHAR ChannelNo,
USHORT DRAMTYPE_TABLE[][5]);
-int SiS_CheckColumn(int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress);
-int SiS_CheckBanks(int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress);
-int SiS_CheckRank(int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress);
-int SiS_CheckDDRRank(int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress);
-int SiS_CheckRanks(int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress);
-int SiS_CheckDDRRanks(int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress);
-int SiS_SDRSizing(ULONG FBAddress);
-int SiS_DDRSizing(ULONG FBAddress);
-int Is315E(void);
-void SiS_VerifyMclk(ULONG FBAddr);
+int SiS_CheckColumn(SiS_Private *SiS_Pr, int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress);
+int SiS_CheckBanks(SiS_Private *SiS_Pr, int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress);
+int SiS_CheckRank(SiS_Private *SiS_Pr, int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress);
+int SiS_CheckDDRRank(SiS_Private *SiS_Pr, int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress);
+int SiS_CheckRanks(SiS_Private *SiS_Pr, int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress);
+int SiS_CheckDDRRanks(SiS_Private *SiS_Pr, int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress);
+int SiS_SDRSizing(SiS_Private *SiS_Pr, ULONG FBAddress);
+int SiS_DDRSizing(SiS_Private *SiS_Pr, ULONG FBAddress);
+int Is315E(SiS_Private *SiS_Pr);
+void SiS_VerifyMclk(SiS_Private *SiS_Pr, ULONG FBAddr);
#endif
-void SetEnableDstn(void);
-void SiS_Delay15us(ULONG);
-BOOLEAN SiS_SearchModeID(UCHAR *ROMAddr, USHORT *ModeNo,USHORT *ModeIdIndex);
-BOOLEAN SiS_CheckMemorySize(UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension,
+void SiS_HandleCRT1(SiS_Private *SiS_Pr);
+void SiS_Handle301B_1400x1050(SiS_Private *SiS_Pr, USHORT ModeNo);
+void SiS_SetEnableDstn(SiS_Private *SiS_Pr);
+void SiS_Delay15us(SiS_Private *SiS_Pr);
+BOOLEAN SiS_SearchModeID(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT *ModeNo,USHORT *ModeIdIndex);
+BOOLEAN SiS_CheckMemorySize(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension,
USHORT ModeNo,USHORT ModeIdIndex);
-UCHAR SiS_GetModePtr(UCHAR *ROMAddr, USHORT ModeNo,USHORT ModeIdIndex);
-void SiS_SetSeqRegs(UCHAR *ROMAddr,USHORT StandTableIndex);
-void SiS_SetMiscRegs(UCHAR *ROMAddr,USHORT StandTableIndex);
-void SiS_SetCRTCRegs(UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension,
+UCHAR SiS_GetModePtr(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT ModeNo,USHORT ModeIdIndex);
+void SiS_SetSeqRegs(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT StandTableIndex);
+void SiS_SetMiscRegs(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT StandTableIndex);
+void SiS_SetCRTCRegs(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension,
USHORT StandTableIndex);
-void SiS_SetATTRegs(UCHAR *ROMAddr,USHORT StandTableIndex,USHORT ModeNo,
+void SiS_SetATTRegs(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT StandTableIndex,
PSIS_HW_DEVICE_INFO HwDeviceExtension);
-void SiS_SetGRCRegs(UCHAR *ROMAddr,USHORT StandTableIndex);
-void SiS_ClearExt1Regs(PSIS_HW_DEVICE_INFO HwDeviceExtension);
-void SiS_SetSync(UCHAR *ROMAddr,USHORT RefreshRateTableIndex);
-void SiS_SetCRT1CRTC(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+void SiS_SetGRCRegs(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT StandTableIndex);
+void SiS_ClearExt1Regs(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension);
+void SiS_SetSync(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT RefreshRateTableIndex);
+void SiS_SetCRT1CRTC(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
USHORT RefreshRateTableIndex,
PSIS_HW_DEVICE_INFO HwDeviceExtension);
-void SiS_ResetCRT1VCLK(UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension);
-void SiS_SetCRT1VCLK(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,PSIS_HW_DEVICE_INFO,
+BOOLEAN SiS_GetLCDACRT1Ptr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+ USHORT RefreshRateTableIndex,USHORT *ResInfo,USHORT *DisplayType);
+void SiS_ResetCRT1VCLK(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension);
+void SiS_SetCRT1VCLK(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,PSIS_HW_DEVICE_INFO,
USHORT RefreshRateTableIndex);
-void SiS_SetVCLKState(UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO, USHORT ModeNo,
+void SiS_SetVCLKState(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO, USHORT ModeNo,
USHORT RefreshRateTableIndex, USHORT ModeIdIndex);
-void SiS_LoadDAC(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex);
-void SiS_DisplayOn(void);
-void SiS_DisplayOff(void);
-void SiS_SetCRT1ModeRegs(UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO,USHORT ModeNo,
+void SiS_LoadDAC(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex);
+void SiS_WriteDAC(SiS_Private *SiS_Pr, USHORT, USHORT, USHORT, USHORT, USHORT, USHORT);
+void SiS_DisplayOn(SiS_Private *SiS_Pr);
+void SiS_DisplayOff(SiS_Private *SiS_Pr);
+void SiS_SetCRT1ModeRegs(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO,USHORT ModeNo,
USHORT ModeIdIndex,USHORT RefreshRateTableIndex);
-void SiS_WriteDAC(USHORT, USHORT, USHORT, USHORT);
-void SiS_GetVBType(USHORT BaseAddr,PSIS_HW_DEVICE_INFO);
-USHORT SiS_ChkBUSWidth(UCHAR *ROMAddr);
-USHORT SiS_GetModeIDLength(UCHAR *ROMAddr, USHORT);
-USHORT SiS_GetRefindexLength(UCHAR *ROMAddr, USHORT);
-void SiS_SetInterlace(UCHAR *ROMAddr,USHORT ModeNo,USHORT RefreshRateTableIndex);
-USHORT SiS_CalcDelay2(UCHAR *ROMAddr, UCHAR);
-USHORT SiS_CalcDelay(UCHAR *ROMAddr, USHORT);
-void SiS_Set_LVDS_TRUMPION(PSIS_HW_DEVICE_INFO HwDeviceExtension);
-void SiS_SetCRT1Offset(UCHAR *ROMAddr,USHORT,USHORT,USHORT,PSIS_HW_DEVICE_INFO);
+void SiS_GetVBType(SiS_Private *SiS_Pr, USHORT BaseAddr,PSIS_HW_DEVICE_INFO);
+USHORT SiS_ChkBUSWidth(SiS_Private *SiS_Pr, UCHAR *ROMAddr);
+USHORT SiS_GetModeIDLength(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT);
+USHORT SiS_GetRefindexLength(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT);
+void SiS_SetInterlace(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT RefreshRateTableIndex);
+void SiS_Set_LVDS_TRUMPION(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension);
+void SiS_SetCRT1Offset(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT,USHORT,USHORT,PSIS_HW_DEVICE_INFO);
#ifdef SIS315H
-void SiS_SetCRT1FIFO_310(UCHAR *ROMAddr,USHORT,USHORT,PSIS_HW_DEVICE_INFO);
+void SiS_SetCRT1FIFO_310(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT,USHORT,PSIS_HW_DEVICE_INFO);
#endif
#ifdef SIS300
-void SiS_SetCRT1FIFO_300(UCHAR *ROMAddr,USHORT ModeNo,PSIS_HW_DEVICE_INFO,
+void SiS_SetCRT1FIFO_300(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,PSIS_HW_DEVICE_INFO,
+ USHORT RefreshRateTableIndex);
+void SiS_SetCRT1FIFO_630(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,PSIS_HW_DEVICE_INFO,
USHORT RefreshRateTableIndex);
+USHORT SiS_CalcDelay(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT VCLK,
+ USHORT colordepth, USHORT MCLK);
+USHORT SiS_DoCalcDelay(SiS_Private *SiS_Pr, USHORT MCLK, USHORT VCLK, USHORT colordepth, USHORT key);
+USHORT SiS_CalcDelay2(SiS_Private *SiS_Pr, UCHAR *ROMAddr, UCHAR,PSIS_HW_DEVICE_INFO HwDeviceExtension);
#endif
-void SiS_ClearBuffer(PSIS_HW_DEVICE_INFO,USHORT ModeNo);
-void SiS_SetCRT1Group(UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension,
+void SiS_ClearBuffer(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO,USHORT ModeNo);
+void SiS_SetCRT1Group(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension,
USHORT ModeNo,USHORT ModeIdIndex,USHORT BaseAddr);
-void SiS_DetectMonitor(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr);
-void SiS_GetSenseStatus(PSIS_HW_DEVICE_INFO HwDeviceExtension,UCHAR *ROMAddr);
-USHORT SiS_TestMonitorType(UCHAR R_DAC,UCHAR G_DAC,UCHAR B_DAC);
-USHORT SiS_SenseCHTV(VOID);
-BOOLEAN SiS_Sense(USHORT Part4Port,USHORT tempbx,USHORT tempcx);
-BOOLEAN SiS_GetPanelID(VOID);
-BOOLEAN SiS_GetLCDDDCInfo(PSIS_HW_DEVICE_INFO);
-USHORT SiS_SenseLCD(PSIS_HW_DEVICE_INFO);
-void SiSRegInit(USHORT BaseAddr);
-void SiSInitPtr(PSIS_HW_DEVICE_INFO HwDeviceExtension);
-void SiSSetLVDSetc(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo);
-void SiSInitPCIetc(PSIS_HW_DEVICE_INFO HwDeviceExtension);
+void SiS_DetectMonitor(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr);
+void SiS_GetSenseStatus(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,UCHAR *ROMAddr);
+USHORT SiS_TestMonitorType(SiS_Private *SiS_Pr, UCHAR R_DAC,UCHAR G_DAC,UCHAR B_DAC);
+USHORT SiS_SenseCHTV(SiS_Private *SiS_Pr);
+BOOLEAN SiS_Sense(SiS_Private *SiS_Pr, USHORT tempbx,USHORT tempcx);
+BOOLEAN SiS_GetPanelID(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO);
+BOOLEAN SiS_GetLCDDDCInfo(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO);
+USHORT SiS_SenseLCD(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO);
+void SiSRegInit(SiS_Private *SiS_Pr, USHORT BaseAddr);
+void SiSInitPtr(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension);
+void SiSSetLVDSetc(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo);
+void SiSInitPCIetc(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension);
+void SiSDetermineROMUsage(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, UCHAR *ROMAddr);
#ifdef LINUX_XF86
USHORT SiS_CalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode);
USHORT SiS_CheckCalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode, int VBFlags);
-void SiS_SetPitch(ScrnInfoPtr pScrn, UShort BaseAddr);
-void SiS_SetPitchCRT1(ScrnInfoPtr pScrn, UShort BaseAddr);
-void SiS_SetPitchCRT2(ScrnInfoPtr pScrn, UShort BaseAddr);
+USHORT SiS_CheckBuildCustomMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int VBFlags);
+void SiS_SetPitch(SiS_Private *SiS_Pr, ScrnInfoPtr pScrn, UShort BaseAddr);
+void SiS_SetPitchCRT1(SiS_Private *SiS_Pr, ScrnInfoPtr pScrn, UShort BaseAddr);
+void SiS_SetPitchCRT2(SiS_Private *SiS_Pr, ScrnInfoPtr pScrn, UShort BaseAddr);
unsigned char SiS_GetSetModeID(ScrnInfoPtr pScrn, unsigned char id);
+unsigned char SiS_GetSetBIOSScratch(ScrnInfoPtr pScrn, USHORT offset, unsigned char value);
+extern int SiS_compute_vclk(int Clock, int *out_n, int *out_dn, int *out_div,
+ int *out_sbit, int *out_scale);
#endif
-extern USHORT SiS_GetOffset(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+extern USHORT SiS_GetOffset(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension);
-extern USHORT SiS_GetColorDepth(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex);
-extern void SiS_DisableBridge(PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr);
-extern BOOLEAN SiS_SetCRT2Group301(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,
+extern USHORT SiS_GetColorDepth(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex);
+extern void SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr);
+extern BOOLEAN SiS_SetCRT2Group301(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,
PSIS_HW_DEVICE_INFO HwDeviceExtension);
-extern void SiS_PresetScratchregister(USHORT SiS_P3d4,
+extern void SiS_PresetScratchregister(SiS_Private *SiS_Pr, USHORT SiS_P3d4,
PSIS_HW_DEVICE_INFO HwDeviceExtension);
-extern void SiS_UnLockCRT2(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr);
-extern void SiS_LockCRT2(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr);
-extern BOOLEAN SiS_BridgeIsOn(USHORT BaseAddr);
-extern BOOLEAN SiS_BridgeIsEnable(USHORT BaseAddr,PSIS_HW_DEVICE_INFO );
-extern void SiS_SetTVSystem301(VOID);
-extern BOOLEAN SiS_GetLCDDDCInfo301(PSIS_HW_DEVICE_INFO HwDeviceExtension);
-extern BOOLEAN SiS_GetSenseStatus301(PSIS_HW_DEVICE_INFO HwDeviceExtension,
- USHORT BaseAddr,UCHAR *ROMAddr);
-extern USHORT SiS_GetVCLKLen(UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension);
-extern BOOLEAN SiS_SetCRT2Group302(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,
- PSIS_HW_DEVICE_INFO HwDeviceExtension);
-extern void SiS_GetVBInfo301(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,
- USHORT ModeIdIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension);
-extern BOOLEAN SiS_GetLCDResInfo301(UCHAR *ROMAddr,USHORT P3d4,USHORT ModeNo,
- USHORT ModeIdIndex, PSIS_HW_DEVICE_INFO HwDeviceExtension);
-extern void SiS_SetHiVision(USHORT BaseAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension);
-/* extern USHORT SiS_VBInfo,LCDResInfo,LCDTypeInfo,LCDInfo; */ /* TW: redundant */
-extern USHORT SiS_GetRatePtrCRT2(UCHAR *ROMAddr, USHORT ModeNo,USHORT ModeIdIndex);
-extern void SiS_LongWait(VOID);
+extern void SiS_UnLockCRT2(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr);
+extern void SiS_LockCRT2(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr);
+extern BOOLEAN SiS_BridgeIsOn(SiS_Private *SiS_Pr, USHORT BaseAddr);
+extern BOOLEAN SiS_BridgeIsEnable(SiS_Private *SiS_Pr, USHORT BaseAddr,PSIS_HW_DEVICE_INFO );
+extern void SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,
+ USHORT ModeIdIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension, int chkcrt2mode);
+extern BOOLEAN SiS_GetLCDResInfo(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,
+ USHORT ModeIdIndex, PSIS_HW_DEVICE_INFO HwDeviceExtension);
+extern void SiS_SetHiVision(SiS_Private *SiS_Pr, USHORT BaseAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension);
+extern USHORT SiS_GetRatePtrCRT2(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT ModeNo,USHORT ModeIdIndex,
+ PSIS_HW_DEVICE_INFO HwDeviceExtension);
+extern void SiS_WhatIsThis(SiS_Private *SiS_Pr, USHORT myvbinfo);
+extern void SiS_LongWait(SiS_Private *SiS_Pr);
extern void SiS_SetRegOR(USHORT Port,USHORT Index,USHORT DataOR);
extern void SiS_SetRegAND(USHORT Port,USHORT Index,USHORT DataAND);
extern void SiS_SetRegANDOR(USHORT Port,USHORT Index,USHORT DataAND,USHORT DataOR);
-extern USHORT SiS_GetResInfo(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex);
-extern void SiS_SetCH700x(USHORT tempax);
-extern USHORT SiS_GetCH700x(USHORT tempax);
-extern void SiS_SetCH701x(USHORT tempax);
-extern USHORT SiS_GetCH701x(USHORT tempax);
-extern void SiS_SetCH70xx(USHORT tempax);
-extern USHORT SiS_GetCH70xx(USHORT tempax);
-extern BOOLEAN SiS_GetLVDSCRT1Ptr(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
- USHORT RefreshRateTableIndex,
- USHORT *ResInfo,USHORT *DisplayType);
-extern BOOLEAN SiS_GetLCDACRT1Ptr(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+extern USHORT SiS_GetResInfo(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex);
+extern void SiS_SetCH700x(SiS_Private *SiS_Pr, USHORT tempax);
+extern USHORT SiS_GetCH700x(SiS_Private *SiS_Pr, USHORT tempax);
+extern void SiS_SetCH701x(SiS_Private *SiS_Pr, USHORT tempax);
+extern USHORT SiS_GetCH701x(SiS_Private *SiS_Pr, USHORT tempax);
+extern void SiS_SetCH70xx(SiS_Private *SiS_Pr, USHORT tempax);
+extern USHORT SiS_GetCH70xx(SiS_Private *SiS_Pr, USHORT tempax);
+extern BOOLEAN SiS_GetLVDSCRT1Ptr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
USHORT RefreshRateTableIndex,
USHORT *ResInfo,USHORT *DisplayType);
-extern USHORT SiS_GetVCLK2Ptr(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+extern USHORT SiS_GetVCLK2Ptr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
USHORT RefreshRateTableIndex,
PSIS_HW_DEVICE_INFO HwDeviceExtension);
-extern BOOLEAN SiS_Is301B(USHORT BaseAddr);
-extern BOOLEAN SiS_LowModeStuff(USHORT ModeNo,PSIS_HW_DEVICE_INFO HwDeviceExtension);
+extern BOOLEAN SiS_Is301B(SiS_Private *SiS_Pr, USHORT BaseAddr);
+extern BOOLEAN SiS_IsM650(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr);
+extern BOOLEAN SiS_LowModeStuff(SiS_Private *SiS_Pr, USHORT ModeNo,PSIS_HW_DEVICE_INFO HwDeviceExtension);
+extern BOOLEAN SiS_IsVAMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr);
+extern BOOLEAN SiS_IsDualEdge(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr);
+extern USHORT SiS_GetMCLK(SiS_Private *SiS_Pr, UCHAR *ROMAddr, PSIS_HW_DEVICE_INFO HwDeviceExtension);
+
+#ifdef LINUX_KERNEL
+int sisfb_mode_rate_to_dclock(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,
+ unsigned char modeno, unsigned char rateindex);
+int sisfb_mode_rate_to_ddata(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,
+ unsigned char modeno, unsigned char rateindex,
+ ULONG *left_margin, ULONG *right_margin,
+ ULONG *upper_margin, ULONG *lower_margin,
+ ULONG *hsync_len, ULONG *vsync_len,
+ ULONG *sync, ULONG *vmode);
+#endif
#endif
diff --git a/drivers/video/sis/init301.c b/drivers/video/sis/init301.c
index be0c95defa5b..ce49c622e536 100644
--- a/drivers/video/sis/init301.c
+++ b/drivers/video/sis/init301.c
@@ -1,17 +1,26 @@
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c,v 1.3 2002/22/04 01:16:16 dawes Exp $ */
/*
- * Mode switching code (CRT2 section) for SiS 300/540/630/730/315/550/650/740
+ * Mode switching code (CRT2 section) for SiS 300/540/630/730/315/550/650/740/330
* (Universal module for Linux kernel framebuffer, XFree86 4.x)
*
* Assembler-To-C translation
- * Parts Copyright 2002 by Thomas Winischhofer <thomas@winischhofer.net>
+ * Copyright 2002, 2003 by Thomas Winischhofer <thomas@winischhofer.net>
+ * Minor parts Copyright SiS, Inc.
*
* Based on BIOS
* 1.10.07, 1.10a for SiS650/LVDS+CH7019
- * 1.07.1b for SiS650/301(B/LV)
+ * 1.11.05 for 650/LVDS (w/o Chrontel)
+ * 1.07.1b, 1.10.6s, 1.11.6w, 1.11.7w, 1.11.8r for SiS650/301(B/LV), 650/302LV
* 2.04.50 (I) and 2.04.5c (II) for SiS630/301(B)
- * 2.02.3b, 2.03.02, 2.04.2c and 2.04.5c for 630/LVDS/LVDS+CH7005
+ * 2.02.3b, 2.03.02, 2.04.2c, 2.04.5c, 2.07a and 2.08.b3 for 630/LVDS/LVDS+CH7005
+ * 2.04.5c, 2.04.6c for 730+LVDS+CH7005
* 1.09b for 315/301(B)
+ * 1.16.51 for 300+301LV (ECS A907)
+ * 1.01.03 for 330 (Xabre 400)
+ *
+ * Known bugs:
+ * 1024x768 panel, expanding (CR37=1): Mode 640x480 does not work
+ * 1280x1024 panel, non-expanding (CR37=0): Modes < 1280x1024 show color flicker
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
@@ -31,16 +40,20 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*
+ * TW says: This code looks awful, I know. But please don't do anything about
+ * this otherwise debugging will be hell.
+ * The code is extremely fragile as regards the different chipsets, different
+ * video bridges and combinations thereof. If anything is changed, extreme
+ * care has to be taken that that change doesn't break it for other chipsets,
+ * bridges or combinations thereof.
+ * All comments in this file are by me, regardless if they are marked TW or not.
+ *
*/
#include "init301.h"
#if 0
-#define TWPANEL
-#endif
-
-#if 0 /* TW: Emulate 650/LVDS BIOS 1.10a (1) or 1.10.07 (0) */
-#define TEST1400
+#define TWNEWPANEL
#endif
#ifdef SIS300
@@ -51,289 +64,333 @@
#include "oem310.h"
#endif
-#define SiS_I2CDELAY 1000
-#define SiS_I2CDELAYSHORT 333
+#define SiS_I2CDELAY 1000
+#define SiS_I2CDELAYSHORT 150
BOOLEAN
-SiS_SetCRT2Group301(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,
+SiS_SetCRT2Group301(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,
PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
USHORT ModeIdIndex;
USHORT RefreshRateTableIndex;
- SiS_SetFlag |= ProgrammingCRT2;
+ SiS_Pr->SiS_SetFlag |= ProgrammingCRT2;
- SiS_SearchModeID(ROMAddr,&ModeNo,&ModeIdIndex);
+ if(!SiS_Pr->UseCustomMode) {
+ SiS_SearchModeID(SiS_Pr,ROMAddr,&ModeNo,&ModeIdIndex);
+ } else {
+ ModeIdIndex = 0;
+ }
/* TW: Used for shifting CR33 */
- SiS_SelectCRT2Rate = 4;
+ SiS_Pr->SiS_SelectCRT2Rate = 4;
- SiS_UnLockCRT2(HwDeviceExtension, BaseAddr);
+ SiS_UnLockCRT2(SiS_Pr, HwDeviceExtension, BaseAddr);
- RefreshRateTableIndex = SiS_GetRatePtrCRT2(ROMAddr,ModeNo,ModeIdIndex);
+ RefreshRateTableIndex = SiS_GetRatePtrCRT2(SiS_Pr, ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension);
- SiS_SaveCRT2Info(ModeNo);
+ SiS_SaveCRT2Info(SiS_Pr,ModeNo);
- if(SiS_LowModeStuff(ModeNo,HwDeviceExtension)) {
- SiS_DisableBridge(HwDeviceExtension,BaseAddr);
- SiS_SetCRT2ModeRegs(BaseAddr,ModeNo,ModeIdIndex,HwDeviceExtension);
+ if(SiS_LowModeStuff(SiS_Pr,ModeNo,HwDeviceExtension)) {
+ SiS_DisableBridge(SiS_Pr,HwDeviceExtension,BaseAddr);
+ if((SiS_Pr->SiS_IF_DEF_LVDS == 1) && (HwDeviceExtension->jChipType == SIS_730)) {
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x00,0x80);
+ }
+ SiS_SetCRT2ModeRegs(SiS_Pr,BaseAddr,ModeNo,ModeIdIndex,HwDeviceExtension);
}
- if(SiS_VBInfo & DisableCRT2Display) {
- SiS_LockCRT2(HwDeviceExtension, BaseAddr);
- SiS_DisplayOn();
- return(FALSE);
+ if(SiS_Pr->SiS_VBInfo & DisableCRT2Display) {
+ SiS_LockCRT2(SiS_Pr,HwDeviceExtension, BaseAddr);
+ SiS_DisplayOn(SiS_Pr);
+ return(TRUE);
}
- SiS_GetCRT2Data(ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
+ if(SiS_Pr->UseCustomMode) return(FALSE);
+
+ SiS_GetCRT2Data(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
HwDeviceExtension);
- /* LVDS, 650/301LV(LCDA) and 630/301B BIOS set up Panel Link */
- if((SiS_IF_DEF_LVDS == 1) || (SiS_VBType & VB_SIS301BLV302BLV)) {
- SiS_GetLVDSDesData(ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
+ /* Set up Panel Link for LVDS, 301BDH and 650/30xLV(for LCDA) */
+ if( (SiS_Pr->SiS_IF_DEF_LVDS == 1) ||
+ ((SiS_Pr->SiS_VBType & VB_NoLCD) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) ||
+ ((HwDeviceExtension->jChipType >= SIS_315H) && (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) ) {
+ SiS_GetLVDSDesData(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
HwDeviceExtension);
+ } else {
+ SiS_Pr->SiS_LCDHDES = SiS_Pr->SiS_LCDVDES = 0;
}
- if(SiS_LowModeStuff(ModeNo,HwDeviceExtension)) {
- SiS_SetGroup1(BaseAddr,ROMAddr,ModeNo,ModeIdIndex,
+#ifdef LINUX_XF86
+#ifdef TWDEBUG
+ xf86DrvMsg(0, X_INFO, "(init301: LCDHDES 0x%03x LCDVDES 0x%03x)\n", SiS_Pr->SiS_LCDHDES, SiS_Pr->SiS_LCDVDES);
+ xf86DrvMsg(0, X_INFO, "(init301: HDE 0x%03x VDE 0x%03x)\n", SiS_Pr->SiS_HDE, SiS_Pr->SiS_VDE);
+ xf86DrvMsg(0, X_INFO, "(init301: VGAHDE 0x%03x VGAVDE 0x%03x)\n", SiS_Pr->SiS_VGAHDE, SiS_Pr->SiS_VGAVDE);
+ xf86DrvMsg(0, X_INFO, "(init301: HT 0x%03x VT 0x%03x)\n", SiS_Pr->SiS_HT, SiS_Pr->SiS_VT);
+ xf86DrvMsg(0, X_INFO, "(init301: VGAHT 0x%03x VGAVT 0x%03x)\n", SiS_Pr->SiS_VGAHT, SiS_Pr->SiS_VGAVT);
+#endif
+#endif
+
+ if(SiS_LowModeStuff(SiS_Pr,ModeNo,HwDeviceExtension)) {
+ SiS_SetGroup1(SiS_Pr,BaseAddr,ROMAddr,ModeNo,ModeIdIndex,
HwDeviceExtension,RefreshRateTableIndex);
}
- if( (SiS_VBType & VB_SIS301BLV302BLV) && (SiS_VBInfo & SetCRT2ToLCDA) ) {
-
- if(SiS_VBType & (VB_SIS301LV | VB_SIS302LV))
- SiS_SetReg1(SiS_Part4Port,0x24,0x0e);
-
- } else if((SiS_IF_DEF_LVDS == 0) && (!(SiS_VBInfo & SetCRT2ToLCDA))) {
-
- if(SiS_LowModeStuff(ModeNo,HwDeviceExtension)) {
-
- SiS_SetGroup2(BaseAddr,ROMAddr,ModeNo,ModeIdIndex,
- RefreshRateTableIndex,HwDeviceExtension);
- SiS_SetGroup3(BaseAddr,ROMAddr,ModeNo,ModeIdIndex,
- HwDeviceExtension);
- SiS_SetGroup4(BaseAddr,ROMAddr,ModeNo,ModeIdIndex,
- RefreshRateTableIndex,HwDeviceExtension);
- SiS_SetGroup5(BaseAddr,ROMAddr,ModeNo,ModeIdIndex);
-
- /* TW: 630/301B BIOS does all this: */
- if(HwDeviceExtension->jChipType < SIS_315H) {
- if(SiS_VBType & VB_SIS301BLV302BLV) {
- if(SiS_VBInfo & SetCRT2ToLCD) {
- if(SiS_LCDResInfo != Panel640x480) {
- SiS_ModCRT1CRTC(ROMAddr,ModeNo,ModeIdIndex,
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
+
+ if(SiS_LowModeStuff(SiS_Pr,ModeNo,HwDeviceExtension)) {
+
+ SiS_SetGroup2(SiS_Pr,BaseAddr,ROMAddr,ModeNo,ModeIdIndex,
+ RefreshRateTableIndex,HwDeviceExtension);
+ SiS_SetGroup3(SiS_Pr,BaseAddr,ROMAddr,ModeNo,ModeIdIndex,
+ HwDeviceExtension);
+ SiS_SetGroup4(SiS_Pr,BaseAddr,ROMAddr,ModeNo,ModeIdIndex,
+ RefreshRateTableIndex,HwDeviceExtension);
+ SiS_SetGroup5(SiS_Pr,HwDeviceExtension, BaseAddr,ROMAddr,
+ ModeNo,ModeIdIndex);
+
+ /* TW: For 301BDH (Panel link initialization): */
+ if((SiS_Pr->SiS_VBType & VB_NoLCD) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) {
+ if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) {
+ if(!((SiS_Pr->SiS_SetFlag & SetDOSMode) && ((ModeNo == 0x03) || (ModeNo = 0x10)))) {
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
+ SiS_ModCRT1CRTC(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,
RefreshRateTableIndex,HwDeviceExtension);
- }
- SiS_SetCRT2ECLK(ROMAddr,ModeNo,ModeIdIndex,
- RefreshRateTableIndex,HwDeviceExtension);
- }
- }
+ }
+ }
+ }
+ SiS_SetCRT2ECLK(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,
+ RefreshRateTableIndex,HwDeviceExtension);
}
-
}
} else {
- if(SiS_LCDResInfo != Panel640x480) {
- if (SiS_IF_DEF_TRUMPION == 0) {
- SiS_ModCRT1CRTC(ROMAddr,ModeNo,ModeIdIndex,
- RefreshRateTableIndex,HwDeviceExtension);
- }
+ if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) {
+ if(SiS_Pr->SiS_IF_DEF_TRUMPION == 0) {
+ SiS_ModCRT1CRTC(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,
+ RefreshRateTableIndex,HwDeviceExtension);
+ }
}
- if(SiS_IF_DEF_FSTN == 0) {
- SiS_SetCRT2ECLK(ROMAddr,ModeNo,ModeIdIndex,
- RefreshRateTableIndex,HwDeviceExtension);
+ if(SiS_Pr->SiS_IF_DEF_FSTN == 0) {
+ SiS_SetCRT2ECLK(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,
+ RefreshRateTableIndex,HwDeviceExtension);
}
- if(SiS_LowModeStuff(ModeNo,HwDeviceExtension)) {
- if(SiS_IF_DEF_CH70xx != 0) {
- /* TW: Inserted from 650/LVDS BIOS */
- if (SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
- if(SiS_IF_DEF_CH70xx == 2) {
- SiS_SetCHTVForLCD(HwDeviceExtension,BaseAddr);
- }
- }
- if(SiS_VBInfo & SetCRT2ToTV) {
- /* TW: Set Chrontel registers only if CRT2 is TV */
- SiS_SetCHTVReg(ROMAddr,ModeNo,ModeIdIndex,
+ if(SiS_LowModeStuff(SiS_Pr,ModeNo,HwDeviceExtension)) {
+ if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
+ if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
+ if(SiS_Pr->SiS_IF_DEF_CH70xx == 2) {
+ SiS_SetCH701xForLCD(SiS_Pr,HwDeviceExtension,BaseAddr);
+ }
+ }
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
+ SiS_SetCHTVReg(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,
RefreshRateTableIndex);
- }
- }
+ }
+ }
}
}
#ifdef SIS300
- if ( (HwDeviceExtension->jChipType==SIS_540)||
- (HwDeviceExtension->jChipType==SIS_630)||
- (HwDeviceExtension->jChipType==SIS_730)||
- (HwDeviceExtension->jChipType==SIS_300) )
+ if ( (HwDeviceExtension->jChipType == SIS_540) ||
+ (HwDeviceExtension->jChipType == SIS_630) ||
+ (HwDeviceExtension->jChipType == SIS_730) ||
+ (HwDeviceExtension->jChipType == SIS_300) )
{
- if(SiS_LowModeStuff(ModeNo,HwDeviceExtension)) {
- SiS_OEM300Setting(HwDeviceExtension,BaseAddr,ROMAddr,ModeNo);
+ if(SiS_LowModeStuff(SiS_Pr,ModeNo,HwDeviceExtension)) {
+ if(SiS_Pr->SiS_UseOEM) {
+ if((SiS_Pr->SiS_UseROM) && ROMAddr && (SiS_Pr->SiS_UseOEM == -1)) {
+ if((ROMAddr[0x233] == 0x12) && (ROMAddr[0x234] == 0x34)) {
+ SiS_OEM300Setting(SiS_Pr,HwDeviceExtension,BaseAddr,ROMAddr,ModeNo);
+ }
+ } else {
+ SiS_OEM300Setting(SiS_Pr,HwDeviceExtension,BaseAddr,ROMAddr,ModeNo);
+ }
+ }
}
}
#endif
#ifdef SIS315H
- if ( (HwDeviceExtension->jChipType==SIS_315H)||
- (HwDeviceExtension->jChipType==SIS_315PRO)||
- (HwDeviceExtension->jChipType==SIS_550) ||
- (HwDeviceExtension->jChipType==SIS_640) ||
- (HwDeviceExtension->jChipType==SIS_740) ||
- (HwDeviceExtension->jChipType==SIS_650))
+ if ( (HwDeviceExtension->jChipType == SIS_315H) ||
+ (HwDeviceExtension->jChipType == SIS_315) ||
+ (HwDeviceExtension->jChipType == SIS_315PRO)||
+ (HwDeviceExtension->jChipType == SIS_550) ||
+ (HwDeviceExtension->jChipType == SIS_740) ||
+ (HwDeviceExtension->jChipType == SIS_650) ||
+ (HwDeviceExtension->jChipType == SIS_330) )
{
- if(SiS_LowModeStuff(ModeNo,HwDeviceExtension)) {
- SiS_OEMLCD(HwDeviceExtension,BaseAddr,ROMAddr,ModeNo,ModeIdIndex);
- SiS_OEM310Setting(HwDeviceExtension,BaseAddr,ROMAddr,ModeNo,ModeIdIndex);
- SiS_CRT2AutoThreshold(BaseAddr);
+ if(SiS_LowModeStuff(SiS_Pr,ModeNo,HwDeviceExtension)) {
+ SiS_FinalizeLCD(SiS_Pr,BaseAddr,ROMAddr,ModeNo,ModeIdIndex, HwDeviceExtension);
+#if 0 /* Instead of FinalizeLCD(), older BIOSes (A92x) used OEMLCD() */
+ SiS_OEMLCD(SiS_Pr,HwDeviceExtension,BaseAddr,ROMAddr,ModeNo,ModeIdIndex);
+#endif
+ if(SiS_Pr->SiS_UseOEM) {
+ SiS_OEM310Setting(SiS_Pr,HwDeviceExtension,BaseAddr,ROMAddr,ModeNo,ModeIdIndex);
+ }
+ SiS_CRT2AutoThreshold(SiS_Pr,BaseAddr);
}
}
#endif
- if(SiS_LowModeStuff(ModeNo,HwDeviceExtension)) {
- SiS_DisplayOn();
- SiS_EnableBridge(HwDeviceExtension,BaseAddr);
+ if(HwDeviceExtension->jChipType < SIS_315H) {
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
+ if(HwDeviceExtension->jChipType != SIS_730) {
+ SiS_DisplayOn(SiS_Pr);
+ }
+ }
}
- if(SiS_IF_DEF_CH70xx == 1) {
- if(SiS_VBInfo & SetCRT2ToTV) {
+ if(SiS_LowModeStuff(SiS_Pr,ModeNo,HwDeviceExtension)) {
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
+ if(HwDeviceExtension->jChipType == SIS_730) {
+ SiS_DisplayOn(SiS_Pr);
+ }
+ }
+ SiS_EnableBridge(SiS_Pr,HwDeviceExtension,BaseAddr);
+ }
+
+ SiS_DisplayOn(SiS_Pr);
+
+ if(SiS_Pr->SiS_IF_DEF_CH70xx == 1) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
/* TW: Disable LCD panel when using TV */
- SiS_SetRegOR(SiS_P3c4,0x11,0x0C);
+ SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x11,0x0C);
} else {
/* TW: Disable TV when using LCD */
- SiS_SetCH70xxANDOR(0x010E,0xF8);
+ SiS_SetCH70xxANDOR(SiS_Pr,0x010E,0xF8);
}
}
- SiS_DisplayOn();
-
- if(SiS_LowModeStuff(ModeNo,HwDeviceExtension)) {
- SiS_LockCRT2(HwDeviceExtension, BaseAddr);
+ if(SiS_LowModeStuff(SiS_Pr,ModeNo,HwDeviceExtension)) {
+ SiS_LockCRT2(SiS_Pr,HwDeviceExtension, BaseAddr);
}
return 1;
}
-/* TW: Checked with 650/LVDS (1.10.07) and 630+301B/LVDS BIOS */
BOOLEAN
-SiS_LowModeStuff(USHORT ModeNo,PSIS_HW_DEVICE_INFO HwDeviceExtension)
+SiS_LowModeStuff(SiS_Private *SiS_Pr, USHORT ModeNo,
+ PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
USHORT temp,temp1,temp2;
if((ModeNo != 0x03) && (ModeNo != 0x10) && (ModeNo != 0x12))
return(1);
- temp = SiS_GetReg1(SiS_P3d4,0x11);
- SiS_SetRegOR(SiS_P3d4,0x11,0x80);
- temp1 = SiS_GetReg1(SiS_P3d4,0x00);
- SiS_SetReg1(SiS_P3d4,0x00,0x55);
- temp2 = SiS_GetReg1(SiS_P3d4,0x00);
- SiS_SetReg1(SiS_P3d4,0x00,temp1);
- SiS_SetReg1(SiS_P3d4,0x11,temp);
- if(HwDeviceExtension->jChipType >= SIS_315H) {
+ temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x11);
+ SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x11,0x80);
+ temp1 = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x00);
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x00,0x55);
+ temp2 = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x00);
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x00,temp1);
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x11,temp);
+ if((HwDeviceExtension->jChipType >= SIS_315H) ||
+ (HwDeviceExtension->jChipType == SIS_300)) {
if(temp2 == 0x55) return(0);
else return(1);
} else {
if(temp2 != 0x55) return(1);
else {
- SiS_SetRegOR(SiS_P3d4,0x35,0x01);
+ SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x35,0x01);
return(0);
}
}
}
/* TW: Set Part1 registers */
-/* TW: Checked with 650/LVDS (1.10.07), 650/301LV (II) and 630/301B (II) BIOS */
void
-SiS_SetGroup1(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
- PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT RefreshRateTableIndex)
+SiS_SetGroup1(SiS_Private *SiS_Pr,USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,
+ USHORT ModeIdIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension,
+ USHORT RefreshRateTableIndex)
{
- USHORT temp=0,tempax=0,tempbx=0,tempcx=0,tempbl=0;
- USHORT pushbx=0,CRT1Index=0;
- USHORT modeflag,resinfo=0;
+ USHORT temp=0, tempax=0, tempbx=0, tempcx=0;
+ USHORT pushbx=0, CRT1Index=0;
+#ifdef SIS315H
+ USHORT pushcx=0, tempbl=0;
+#endif
+ USHORT modeflag, resinfo=0;
if(ModeNo<=0x13) {
- modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
+ modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
} else {
- CRT1Index = SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
- resinfo = SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
- modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ CRT1Index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
+ resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
+ modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
}
- /* TW: Removed 301B301LV.. check here; LCDA exists with LVDS as well */
- if(SiS_VBInfo & SetCRT2ToLCDA) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) {
- /* TW: From 650/LVDS BIOS; 301(B+LV) version does not set Sync */
- if (SiS_IF_DEF_LVDS == 1) {
- SiS_SetCRT2Sync(BaseAddr,ROMAddr,ModeNo,
- RefreshRateTableIndex,HwDeviceExtension);
- }
+ SiS_SetCRT2Sync(SiS_Pr,BaseAddr,ROMAddr,ModeNo,
+ RefreshRateTableIndex,HwDeviceExtension);
- SiS_SetGroup1_LCDA(BaseAddr,ROMAddr,ModeNo,ModeIdIndex,
- HwDeviceExtension,RefreshRateTableIndex);
+ SiS_SetGroup1_LCDA(SiS_Pr,BaseAddr,ROMAddr,ModeNo,ModeIdIndex,
+ HwDeviceExtension,RefreshRateTableIndex);
} else {
if( (HwDeviceExtension->jChipType >= SIS_315H) &&
- (SiS_IF_DEF_LVDS == 1) &&
- (SiS_VBInfo & SetInSlaveMode)) {
+ (SiS_Pr->SiS_IF_DEF_LVDS == 1) &&
+ (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
- SiS_SetCRT2Sync(BaseAddr,ROMAddr,ModeNo,
+ SiS_SetCRT2Sync(SiS_Pr,BaseAddr,ROMAddr,ModeNo,
RefreshRateTableIndex,HwDeviceExtension);
} else {
- SiS_SetCRT2Offset(SiS_Part1Port,ROMAddr,ModeNo,ModeIdIndex,
- RefreshRateTableIndex,HwDeviceExtension);
+ SiS_SetCRT2Offset(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,
+ RefreshRateTableIndex,HwDeviceExtension);
if (HwDeviceExtension->jChipType < SIS_315H ) {
#ifdef SIS300
- SiS_SetCRT2FIFO_300(ROMAddr,ModeNo,HwDeviceExtension);
+ SiS_SetCRT2FIFO_300(SiS_Pr,ROMAddr,ModeNo,HwDeviceExtension);
#endif
} else {
#ifdef SIS315H
- SiS_SetCRT2FIFO_310(ROMAddr,ModeNo,HwDeviceExtension);
+ SiS_SetCRT2FIFO_310(SiS_Pr,ROMAddr,ModeNo,HwDeviceExtension);
#endif
}
- SiS_SetCRT2Sync(BaseAddr,ROMAddr,ModeNo,
+ SiS_SetCRT2Sync(SiS_Pr,BaseAddr,ROMAddr,ModeNo,
RefreshRateTableIndex,HwDeviceExtension);
/* 1. Horizontal setup */
if (HwDeviceExtension->jChipType < SIS_315H ) {
- /* ------------- 300 series --------------*/
+#ifdef SIS300 /* ------------- 300 series --------------*/
- temp = (SiS_VGAHT - 1) & 0x0FF; /* BTVGA2HT 0x08,0x09 */
- SiS_SetReg1(SiS_Part1Port,0x08,temp); /* TW: CRT2 Horizontal Total */
+ temp = (SiS_Pr->SiS_VGAHT - 1) & 0x0FF; /* BTVGA2HT 0x08,0x09 */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x08,temp); /* TW: CRT2 Horizontal Total */
- temp = (((SiS_VGAHT - 1) & 0xFF00) >> 8) << 4;
- SiS_SetRegANDOR(SiS_Part1Port,0x09,0x0f,temp); /* TW: CRT2 Horizontal Total Overflow [7:4] */
+ temp = (((SiS_Pr->SiS_VGAHT - 1) & 0xFF00) >> 8) << 4;
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x09,0x0f,temp); /* TW: CRT2 Horizontal Total Overflow [7:4] */
- temp = (SiS_VGAHDE + 12) & 0x0FF; /* BTVGA2HDEE 0x0A,0x0C */
- SiS_SetReg1(SiS_Part1Port,0x0A,temp); /* TW: CRT2 Horizontal Display Enable End */
+ temp = (SiS_Pr->SiS_VGAHDE + 12) & 0x0FF; /* BTVGA2HDEE 0x0A,0x0C */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0A,temp); /* TW: CRT2 Horizontal Display Enable End */
- pushbx = SiS_VGAHDE + 12; /* bx BTVGA@HRS 0x0B,0x0C */
- tempcx = (SiS_VGAHT - SiS_VGAHDE) >> 2;
+ pushbx = SiS_Pr->SiS_VGAHDE + 12; /* bx BTVGA@HRS 0x0B,0x0C */
+ tempcx = (SiS_Pr->SiS_VGAHT - SiS_Pr->SiS_VGAHDE) >> 2;
tempbx = pushbx + tempcx;
tempcx <<= 1;
tempcx += tempbx;
- if(SiS_IF_DEF_LVDS == 0) {
- if(SiS_VBInfo & SetCRT2ToRAMDAC){
- CRT1Index &= 0x3F;
- tempbx = SiS_CRT1Table[CRT1Index].CR[4];
- tempbx |= ((SiS_CRT1Table[CRT1Index].CR[14] & 0xC0) << 2);
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC){
+ /* CRT1Index &= 0x3F; - Not any longer */
+ tempbx = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[4];
+ tempbx |= ((SiS_Pr->SiS_CRT1Table[CRT1Index].CR[14] & 0xC0) << 2);
tempbx = (tempbx - 1) << 3;
- tempcx = SiS_CRT1Table[CRT1Index].CR[5];
+ tempcx = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[5];
tempcx &= 0x1F;
- temp = SiS_CRT1Table[CRT1Index].CR[15];
+ temp = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[15];
temp = (temp & 0x04) << (6-2);
- tempcx = ((tempcx | temp) - 1) << 3;
+ tempcx = (tempcx | temp);
+ tempcx--;
+ tempcx <<= 3;
}
- if((SiS_VBInfo & SetCRT2ToTV) && (resinfo == 0x08)){
- if(!(SiS_VBInfo & SetPALTV)){
+ if((SiS_Pr->SiS_VBInfo & SetCRT2ToTV) && (resinfo == 0x08)){
+ if(!(SiS_Pr->SiS_VBInfo & SetPALTV)){
tempbx = 1040;
tempcx = 1042;
}
@@ -341,101 +398,95 @@ SiS_SetGroup1(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
}
temp = tempbx & 0x00FF;
- SiS_SetReg1(SiS_Part1Port,0x0B,temp); /* TW: CRT2 Horizontal Retrace Start */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0B,temp); /* TW: CRT2 Horizontal Retrace Start */
+#endif /* SIS300 */
} else {
- /* ---------------------- 310 series ------------------*/ /* (BIOS label Gr1_301) */
-
- if (modeflag & HalfDCLK) { /* for low resolution modes */
-
- temp = ((SiS_VGAHT / 2) - 1) & 0xFF; /* BTVGA2HT 0x08,0x09 */
- SiS_SetReg1(SiS_Part1Port,0x08,temp); /* TW: CRT2 Horizontal Total */
-
- temp = ((((SiS_VGAHT / 2) - 1) & 0xFF00) >> 8) << 4;
- SiS_SetRegANDOR(SiS_Part1Port,0x09,0x0F,temp); /* TW: CRT2 Horizontal Total Overflow [7:4] */
-
- temp = ((SiS_VGAHDE / 2) + 16) & 0xFF; /* BTVGA2HDEE 0x0A,0x0C */
- SiS_SetReg1(SiS_Part1Port,0x0A,temp); /* TW: CRT2 Horizontal Display Enable End */
-
- pushbx = (SiS_VGAHDE / 2) + 16;
- tempcx = ((SiS_VGAHT - SiS_VGAHDE) / 2) >> 2; /* cx */
- if(SiS_IF_DEF_LVDS == 1)
- tempcx >>= 1; /* TW: From LVDS 1.10.07; not done on 301(LV) */
- tempbx = pushbx + tempcx; /* bx BTVGA@HRS 0x0B,0x0C */
- tempcx += tempbx;
-
- if(SiS_IF_DEF_LVDS == 0) {
- if(SiS_VBInfo & SetCRT2ToRAMDAC){
- tempbx = SiS_CRT1Table[CRT1Index].CR[4];
- tempbx |= ((SiS_CRT1Table[CRT1Index].CR[14] & 0xC0) << 2);
- tempbx = (tempbx - 3) << 3; /*(VGAHRS-3)*8 */
- tempcx = SiS_CRT1Table[CRT1Index].CR[5];
- tempcx &= 0x1F;
- temp = SiS_CRT1Table[CRT1Index].CR[15];
- temp = (temp & 0x04) << (5-2); /* VGAHRE D[5] */
- tempcx =((tempcx | temp) - 3) << 3; /* (VGAHRE-3)*8 */
- }
- /* TW: The following is not done in 650/LVDS BIOS */
- tempbx += 4;
- tempcx += 4;
-
- if (tempcx > (SiS_VGAHT / 2))
- tempcx = SiS_VGAHT / 2;
- }
-
- temp = tempbx & 0x00FF;
- SiS_SetReg1(SiS_Part1Port,0x0B,temp); /* TW: CRT2 Horizontal Retrace Start */
+#ifdef SIS315H /* ----------------- 310/325/330 series ------------- */
+
+ tempcx = SiS_Pr->SiS_VGAHT; /* BTVGA2HT 0x08,0x09 */
+ pushcx = tempcx;
+ if(modeflag & HalfDCLK) {
+ if((SiS_Pr->SiS_IF_DEF_LVDS == 1) && (SiS_Pr->SiS_IF_DEF_CH70xx == 0)) {
+ tempax = SiS_Pr->SiS_VGAHDE >> 1;
+ tempcx = SiS_Pr->SiS_HT - SiS_Pr->SiS_HDE + tempax;
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) {
+ tempcx = SiS_Pr->SiS_HT - tempax;
+ }
+ } else {
+ tempcx >>= 1;
+ }
+ }
+ tempcx--;
- } else { /* for high resolution modes */
+ temp = tempcx & 0xff;
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x08,temp); /* TW: CRT2 Horizontal Total */
- temp = (SiS_VGAHT - 1) & 0xFF; /* BTVGA2HT 0x08,0x09 */
- SiS_SetReg1(SiS_Part1Port,0x08,temp); /* TW: CRT2 Horizontal Total */
+ temp = ((tempcx & 0xff00) >> 8) << 4;
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x09,0x0F,temp); /* TW: CRT2 Horizontal Total Overflow [7:4] */
- temp = (((SiS_VGAHT - 1) & 0xFF00) >> 8 ) << 4;
- SiS_SetRegANDOR(SiS_Part1Port,0x09,0x0F,temp); /* TW: CRT2 Horizontal Total Overflow [7:4] */
+ tempcx = pushcx; /* BTVGA2HDEE 0x0A,0x0C */
+ tempbx = SiS_Pr->SiS_VGAHDE;
+ tempcx -= tempbx;
+ tempcx >>= 2;
+ if(modeflag & HalfDCLK) {
+ tempbx >>= 1;
+ tempcx >>= 1;
+ }
+ tempbx += 16;
- temp = (SiS_VGAHDE + 16) & 0xFF; /* BTVGA2HDEE 0x0A,0x0C */
- SiS_SetReg1(SiS_Part1Port,0x0A,temp); /* TW: CRT2 Horizontal Display Enable End */
+ temp = tempbx & 0xff;
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0A,temp); /* TW: CRT2 Horizontal Display Enable End */
- pushbx = SiS_VGAHDE + 16;
- tempcx = (SiS_VGAHT - SiS_VGAHDE) >> 2; /* cx */
- if(SiS_IF_DEF_LVDS == 1)
- tempcx >>= 1; /* TW: From LVDS 1.10.07; not done on 301(LV) */
- tempbx = pushbx + tempcx; /* bx BTVGA@HRS 0x0B,0x0C */
- tempcx += tempbx;
+ pushbx = tempbx;
+ tempcx >>= 1;
+ tempbx += tempcx;
+ tempcx += tempbx;
- if(SiS_IF_DEF_LVDS==0) {
- if(SiS_VBInfo & SetCRT2ToRAMDAC){
- tempbx = SiS_CRT1Table[CRT1Index].CR[4];
- tempbx |= ((SiS_CRT1Table[CRT1Index].CR[14] & 0xC0) << 2);
+ if(SiS_Pr->SiS_IF_DEF_LVDS==0) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC) {
+ tempbx = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[4];
+ tempbx |= ((SiS_Pr->SiS_CRT1Table[CRT1Index].CR[14] & 0xC0) << 2);
tempbx = (tempbx - 3) << 3; /*(VGAHRS-3)*8 */
- tempcx = SiS_CRT1Table[CRT1Index].CR[5];
+ tempcx = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[5];
tempcx &= 0x1F;
- temp = SiS_CRT1Table[CRT1Index].CR[15];
+ temp = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[15];
temp = (temp & 0x04) << (5-2); /* VGAHRE D[5] */
- tempcx = ((tempcx | temp) - 3) << 3; /* (VGAHRE-3)*8 */
+ tempcx = (tempcx | temp); /* (VGAHRE-3)*8 */
+ tempcx -= 3;
+ tempcx <<= 3;
+ tempcx &= 0x00FF;
+ tempcx |= (tempbx & 0xFF00);
tempbx += 16;
tempcx += 16;
+ tempax = SiS_Pr->SiS_VGAHT;
+ if(modeflag & HalfDCLK) tempax >>= 1;
+ tempax--;
+ if(tempcx > tempax) tempcx = tempax;
}
- /* TW: The entire following section is not done in 650/LVDS BIOS */
- if (tempcx > SiS_VGAHT)
- tempcx = SiS_VGAHT;
-
- if((SiS_VBInfo & SetCRT2ToTV) && (resinfo == 0x08)){
- if(!(SiS_VBInfo & SetPALTV)){
+ if((SiS_Pr->SiS_VBInfo & SetCRT2ToTV) && (resinfo == 0x08)){
+ if(!(SiS_Pr->SiS_VBInfo & SetPALTV)){
tempbx = 1040;
tempcx = 1042;
}
}
+ /* TW: Makes no sense, but is in 650/302LV 1.10.6s */
+ if((SiS_Pr->SiS_VBInfo & SetCRT2ToTV) && (resinfo == 0x08)){
+ if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV)) {
+ if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) {
+ tempbx = 1040;
+ tempcx = 1042;
+ }
+ }
+ }
}
- temp = tempbx & 0x00FF;
- SiS_SetReg1(SiS_Part1Port,0x0B,temp); /* TW: CRT2 Horizontal Retrace Start */
-
- } /* halfdclk */
+ temp = tempbx & 0xff;
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0B,temp); /* TW: CRT2 Horizontal Retrace Start */
+#endif /* SIS315H */
- } /* 310 series */
+ } /* 310/325/330 series */
/* TW: The following is done for all bridge/chip types/series */
@@ -444,368 +495,414 @@ SiS_SetGroup1(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
tempbx = (tempbx & 0x00FF) | ((tempbx & 0xFF00) << 4);
tempax |= (tempbx & 0xFF00);
temp = (tempax & 0xFF00) >> 8;
- SiS_SetReg1(SiS_Part1Port,0x0C,temp); /* TW: Overflow */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0C,temp); /* TW: Overflow */
temp = tempcx & 0x00FF;
- SiS_SetReg1(SiS_Part1Port,0x0D,temp); /* TW: CRT2 Horizontal Retrace End */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0D,temp); /* TW: CRT2 Horizontal Retrace End */
/* 2. Vertical setup */
- tempcx = SiS_VGAVT - 1;
+ tempcx = SiS_Pr->SiS_VGAVT - 1;
temp = tempcx & 0x00FF;
- /* TW: Matches 650/301LV, 650/LVDS, 630/LVDS(CLEVO), 630/LVDS(no-Ch7005) */
- if(SiS_IF_DEF_LVDS == 1) {
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
if(HwDeviceExtension->jChipType < SIS_315H) {
- if(SiS_IF_DEF_CH70xx != 0) {
-#ifndef TWPANEL
- if(SiS_VBInfo & (SetCRT2ToSVIDEO|SetCRT2ToAVIDEO)) {
+ if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
+ if(SiS_Pr->SiS_VBInfo & (SetCRT2ToSVIDEO | SetCRT2ToAVIDEO)) {
temp--;
}
-#else
- temp--;
-#endif
}
} else {
- if(SiS_IF_DEF_CH70xx != 0) {
temp--;
- }
}
- }
- SiS_SetReg1(SiS_Part1Port,0x0E,temp); /* TW: CRT2 Vertical Total */
+ } else if(HwDeviceExtension->jChipType >= SIS_315H) {
+ /* TW: Inserted from 650/302LV 1.10.6s */
+ temp--;
+ }
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0E,temp); /* TW: CRT2 Vertical Total */
- tempbx = SiS_VGAVDE - 1;
+ tempbx = SiS_Pr->SiS_VGAVDE - 1;
temp = tempbx & 0x00FF;
- SiS_SetReg1(SiS_Part1Port,0x0F,temp); /* TW: CRT2 Vertical Display Enable End */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0F,temp); /* TW: CRT2 Vertical Display Enable End */
temp = ((tempbx & 0xFF00) << 3) >> 8;
temp |= ((tempcx & 0xFF00) >> 8);
- SiS_SetReg1(SiS_Part1Port,0x12,temp); /* TW: Overflow (and HWCursor Test Mode) */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x12,temp); /* TW: Overflow (and HWCursor Test Mode) */
- /* TW: For 650/LVDS */
- if((HwDeviceExtension->jChipType >= SIS_315H) && (SiS_IF_DEF_LVDS == 1)) {
+ /* TW: For 650/LVDS (1.10.07), 650/302LV (1.10.6s) */
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
tempbx++;
tempax = tempbx;
tempcx++;
- tempcx = tempcx - tempax;
+ tempcx -= tempax;
tempcx >>= 2;
- tempbx = tempbx + tempcx;
+ tempbx += tempcx;
if(tempcx < 4) tempcx = 4;
tempcx >>= 2;
- tempcx = tempcx + tempbx;
+ tempcx += tempbx;
tempcx++;
} else {
- /* TW: For 630/LVDS/301B and 650/301LV: */
- tempbx = (SiS_VGAVT + SiS_VGAVDE) >> 1; /* BTVGA2VRS 0x10,0x11 */
- tempcx = ((SiS_VGAVT - SiS_VGAVDE) >> 4) + tempbx + 1; /* BTVGA2VRE 0x11 */
+ /* TW: For 300/630/LVDS/301B: */
+ tempbx = (SiS_Pr->SiS_VGAVT + SiS_Pr->SiS_VGAVDE) >> 1; /* BTVGA2VRS 0x10,0x11 */
+ tempcx = ((SiS_Pr->SiS_VGAVT - SiS_Pr->SiS_VGAVDE) >> 4) + tempbx + 1; /* BTVGA2VRE 0x11 */
}
- if(SiS_IF_DEF_LVDS == 0) {
- if(SiS_VBInfo & SetCRT2ToRAMDAC){
- tempbx = SiS_CRT1Table[CRT1Index].CR[8];
- temp = SiS_CRT1Table[CRT1Index].CR[7];
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC){
+ tempbx = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[8];
+ temp = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[7];
if(temp & 0x04) tempbx |= 0x0100;
if(temp & 0x80) tempbx |= 0x0200;
- temp = SiS_CRT1Table[CRT1Index].CR[13];
+ temp = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[13];
if(temp & 0x08) tempbx |= 0x0400;
- temp = SiS_CRT1Table[CRT1Index].CR[9];
+ temp = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[9];
tempcx = (tempcx & 0xFF00) | (temp & 0x00FF);
}
}
temp = tempbx & 0x00FF;
- SiS_SetReg1(SiS_Part1Port,0x10,temp); /* TW: CRT2 Vertical Retrace Start */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x10,temp); /* TW: CRT2 Vertical Retrace Start */
temp = ((tempbx & 0xFF00) >> 8) << 4;
temp |= (tempcx & 0x000F);
- SiS_SetReg1(SiS_Part1Port,0x11,temp); /* TW: CRT2 Vert. Retrace End; Overflow; "Enable CRTC Check" */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x11,temp); /* TW: CRT2 Vert. Retrace End; Overflow; "Enable CRTC Check" */
- /* 3. Paneldelay */
+ /* 3. Panel compensation delay */
- if (HwDeviceExtension->jChipType < SIS_315H ) {
+ if(HwDeviceExtension->jChipType < SIS_315H) {
- /* ---------- 300 series -------------- */
+#ifdef SIS300 /* ---------- 300 series -------------- */
- if(SiS_IF_DEF_LVDS == 0) {
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
temp = 0x20;
- if(SiS_LCDResInfo == Panel1280x960) temp = 0x24; /* TW: Not in 630/301B BIOS */
- if(SiS_VBInfo & SetCRT2ToTV) temp = 0x08;
- if(SiS_VBInfo & SetCRT2ToHiVisionTV) { /* TW: Not in 630/301B BIOS */
- if(SiS_VBInfo & SetInSlaveMode) temp = 0x2c; /* TW: Not in 630/301B BIOS */
- else temp = 0x20; /* TW: Not in 630/301B BIOS */
+
+ if(HwDeviceExtension->jChipType == SIS_300) {
+ temp = 0x10;
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) temp = 0x2c;
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) temp = 0x20;
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x960) temp = 0x24;
+ }
+ if(SiS_Pr->SiS_VBType & VB_SIS301) {
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) temp = 0x20;
+ }
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x960) temp = 0x24;
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) temp = 0x08;
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) {
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) temp = 0x2c;
+ else temp = 0x20;
}
- if((ROMAddr) && (SiS_VBType & VB_SIS301BLV302BLV)) {
+ if((ROMAddr) && (SiS_Pr->SiS_UseROM) && (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) {
if(ROMAddr[0x220] & 0x80) {
- if(SiS_VBInfo & (SetCRT2ToTV-SetCRT2ToHiVisionTV)) temp = ROMAddr[0x221];
- else if(SiS_VBInfo & SetCRT2ToHiVisionTV) temp = ROMAddr[0x222];
- else if(SiS_LCDResInfo == Panel1280x1024) temp = ROMAddr[0x223];
- else temp = ROMAddr[0x224];
+ if(SiS_Pr->SiS_VBInfo & (SetCRT2ToTV-SetCRT2ToHiVisionTV))
+ temp = ROMAddr[0x221];
+ else if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV)
+ temp = ROMAddr[0x222];
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024)
+ temp = ROMAddr[0x223];
+ else
+ temp = ROMAddr[0x224];
temp &= 0x3c;
}
}
- if(HwDeviceExtension->pdc) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ if(HwDeviceExtension->pdc) {
temp = HwDeviceExtension->pdc & 0x3c;
+ }
}
} else {
temp = 0x20;
- if(SiS_LCDResInfo == Panel640x480) temp = 0x04;
- if(ROMAddr) {
+ if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) {
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480) temp = 0x04;
+ }
+ if((ROMAddr) && SiS_Pr->SiS_UseROM) {
if(ROMAddr[0x220] & 0x80) {
temp = ROMAddr[0x220] & 0x3c;
}
}
- if(HwDeviceExtension->pdc) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ if(HwDeviceExtension->pdc) {
temp = HwDeviceExtension->pdc & 0x3c;
+ }
}
}
- SiS_SetRegANDOR(SiS_Part1Port,0x13,~0x03C,temp); /* TW: Panel Link Delay Compensation; (Software Command Reset; Power Saving) */
- /* TW: This register will be adapted according to LCD
- * panel type later in the OEM setup functions.
- * (Various panel types require a different delay
- * such as Clevo 2202; however, on most panels,
- * 0x20 does nicely.)
- */
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,~0x03C,temp); /* TW: Panel Link Delay Compensation; (Software Command Reset; Power Saving) */
+
+#endif /* SIS300 */
} else {
- /* ----------- 310/325 series ---------------*/
- if(SiS_IF_DEF_LVDS == 0) {
- temp = 0x10; /* TW: Modified (650/301 BIOS) */
- if(SiS_LCDResInfo == Panel1024x768) temp = 0x2c; /* TW: Modified (650/301 BIOS) */
- if(SiS_LCDResInfo == Panel1280x1024) temp = 0x20;
- if(SiS_LCDResInfo == Panel1280x960) temp = 0x24;
- if(SiS_VBInfo & SetCRT2ToHiVisionTV) {
- if(SiS_VBInfo & SetInSlaveMode) temp = 0x2c;
- else temp = 0x20;
- }
- tempbl = 0xF0;
+#ifdef SIS315H /* ----------- 310/325/330 series ---------------*/
+
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
+ temp = 0x10;
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) temp = 0x2c;
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) temp = 0x20;
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x960) temp = 0x24;
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
+ temp = 0x08;
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) {
+ switch(SiS_Pr->SiS_HiVision) {
+ case 2:
+ case 1:
+ case 0:
+ temp = 0x08;
+ break;
+ default:
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) temp = 0x2c;
+ else temp = 0x20;
+ }
+ }
+ }
+ if(SiS_Pr->SiS_VBType & VB_SIS301B302B) {
+ tempbl = 0x00;
+ if((ROMAddr) && (SiS_Pr->SiS_UseROM)) {
+ if(HwDeviceExtension->jChipType < SIS_330) {
+ if(ROMAddr[0x13c] & 0x80) tempbl = 0xf0;
+ } else {
+ if(ROMAddr[0x1bc] & 0x80) tempbl = 0xf0;
+ }
+ }
+ } else { /* LV (550/301LV checks ROM byte, other LCV BIOSes do not) */
+ tempbl = 0xF0;
+ }
} else {
temp = 0x00;
- if(SiS_VBInfo & SetCRT2ToTV) temp = 0x0a;
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) temp = 0x0a;
tempbl = 0xF0;
- if(!(SiS_VBInfo & SetCRT2ToTV)) tempbl = 0x0F;
- }
-
- if(SiS_IF_DEF_LVDS == 0) {
- temp >>= 2; /* TW: Only in 650/301LV BIOS */
+ if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
+ if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) tempbl = 0x0F;
+ }
}
-
- SiS_SetRegANDOR(SiS_Part1Port,0x2D,tempbl,temp); /* TW: Panel Link Delay Compensation */
- /* TW: This register will be adapted according to LCD
- * panel type later in the OEM setup functions.
- * (Various panel types require a different delay)
- */
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2D,tempbl,temp); /* TW: Panel Link Delay Compensation */
tempax = 0;
if (modeflag & DoubleScanMode) tempax |= 0x80;
if (modeflag & HalfDCLK) tempax |= 0x40;
- SiS_SetRegANDOR(SiS_Part1Port,0x2C,0x3f,tempax);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2C,0x3f,tempax);
+
+#endif /* SIS315H */
}
} /* Slavemode */
- if(SiS_IF_DEF_LVDS == 0) {
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
- /* TW: 630/301B BIOS sets up Panel Link, too! (650/LV does not) */
- if( (SiS_VBType & VB_SIS301BLV302BLV) && (SiS_VBInfo & SetCRT2ToLCD)
- && (HwDeviceExtension->jChipType < SIS_315H)) {
+ /* TW: For 301BDH, we set up the Panel Link */
+ if( (SiS_Pr->SiS_VBType & VB_NoLCD) &&
+ (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) ) {
- SiS_SetGroup1_LVDS(BaseAddr,ROMAddr,ModeNo,ModeIdIndex,
+ SiS_SetGroup1_LVDS(SiS_Pr,BaseAddr,ROMAddr,ModeNo,ModeIdIndex,
HwDeviceExtension,RefreshRateTableIndex);
- } else if(SiS_VBInfo & SetInSlaveMode) { /* Inserted (650/301 BIOS) */
+ } else if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
- SiS_SetGroup1_301(BaseAddr,ROMAddr,ModeNo,ModeIdIndex,
+ SiS_SetGroup1_301(SiS_Pr,BaseAddr,ROMAddr,ModeNo,ModeIdIndex,
HwDeviceExtension,RefreshRateTableIndex);
}
} else {
if(HwDeviceExtension->jChipType < SIS_315H) {
- SiS_SetGroup1_LVDS(BaseAddr,ROMAddr,ModeNo,ModeIdIndex,
+
+ SiS_SetGroup1_LVDS(SiS_Pr,BaseAddr,ROMAddr,ModeNo,ModeIdIndex,
HwDeviceExtension,RefreshRateTableIndex);
} else {
- /* TW: For 650/LVDS */
- if((!(SiS_VBInfo & SetCRT2ToTV)) || (SiS_VBInfo & SetInSlaveMode)) {
- SiS_SetGroup1_LVDS(BaseAddr,ROMAddr,ModeNo,ModeIdIndex,
- HwDeviceExtension,RefreshRateTableIndex);
- }
+
+ if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
+ if((!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) || (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
+ SiS_SetGroup1_LVDS(SiS_Pr,BaseAddr,ROMAddr,ModeNo,ModeIdIndex,
+ HwDeviceExtension,RefreshRateTableIndex);
+ }
+ } else {
+ SiS_SetGroup1_LVDS(SiS_Pr,BaseAddr,ROMAddr,ModeNo,ModeIdIndex,
+ HwDeviceExtension,RefreshRateTableIndex);
+ }
+
}
}
} /* LCDA */
}
-/* TW: Checked against 650/301LV and 630/301B (II) BIOS */
void
-SiS_SetGroup1_301(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+SiS_SetGroup1_301(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT RefreshRateTableIndex)
{
USHORT push1,push2;
USHORT tempax,tempbx,tempcx,temp;
USHORT resinfo,modeflag;
- if(ModeNo<=0x13) {
- modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
- resinfo = SiS_SModeIDTable[ModeIdIndex].St_ResInfo;
+ if(ModeNo <= 0x13) {
+ modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
+ resinfo = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo;
} else {
- modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
- resinfo = SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
+ modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
}
/* TW: The following is only done if bridge is in slave mode: */
tempax = 0xFFFF;
- if(!(SiS_VBInfo & SetCRT2ToTV)) tempax = SiS_GetVGAHT2();
+ if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) tempax = SiS_GetVGAHT2(SiS_Pr);
- /* TW: 630/301B does not check this flag, assumes it is set */
- /* 650/LV BIOS does not check this either; so we set it... */
- if(SiS_VBType & VB_SIS301BLV302BLV) {
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
modeflag |= Charx8Dot;
}
if(modeflag & Charx8Dot) tempcx = 0x08;
- else tempcx = 0x09;
+ else tempcx = 0x09;
- if(tempax >= SiS_VGAHT) tempax = SiS_VGAHT;
+ if(tempax >= SiS_Pr->SiS_VGAHT) tempax = SiS_Pr->SiS_VGAHT;
if(modeflag & HalfDCLK) tempax >>= 1;
tempax = (tempax / tempcx) - 5;
- tempbx = tempax & 0xFF;
+ tempbx = tempax & 0x00FF;
- temp = 0xFF; /* set MAX HT */
- SiS_SetReg1(SiS_Part1Port,0x03,temp);
+ temp = 0xFF; /* set MAX HT */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x03,temp);
- tempax = SiS_VGAHDE; /* 0x04 Horizontal Display End */
+ tempax = SiS_Pr->SiS_VGAHDE; /* 0x04 Horizontal Display End */
if(modeflag & HalfDCLK) tempax >>= 1;
tempax = (tempax / tempcx) - 1;
tempbx |= ((tempax & 0x00FF) << 8);
- temp = tempax & 0xFF;
- SiS_SetReg1(SiS_Part1Port,0x04,temp);
+ temp = tempax & 0x00FF;
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x04,temp);
temp = (tempbx & 0xFF00) >> 8;
- if(SiS_VBInfo & SetCRT2ToTV){
- if(!(SiS_VBType & VB_SIS301BLV302BLV)) { /* TW: Inserted from 650/301, 630/301 BIOS */
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
+ if(!(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) {
temp += 2;
- } /* TW: Inserted from 650/301, 630/301 BIOS */
-#ifdef oldHV
- if(SiS_VBInfo & SetCRT2ToHiVisionTV) {
- if(resinfo == 7) temp -= 2;
- }
-#endif
+ }
+ }
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) {
+ if(SiS_Pr->SiS_HiVision == 3) {
+ if(resinfo == 7) temp -= 2;
+ }
}
- SiS_SetReg1(SiS_Part1Port,0x05,temp); /* 0x05 Horizontal Display Start */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x05,temp); /* 0x05 Horizontal Display Start */
- SiS_SetReg1(SiS_Part1Port,0x06,0x03); /* 0x06 Horizontal Blank end */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x06,0x03); /* 0x06 Horizontal Blank end */
-#ifdef oldHV
- if(SiS_VBInfo & SetCRT2ToHiVisionTV) {
+ if((SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) &&
+ (SiS_Pr->SiS_HiVision == 3)) {
temp = (tempbx & 0x00FF) - 1;
if(!(modeflag & HalfDCLK)) {
temp -= 6;
- if(SiS_SetFlag & TVSimuMode) {
- temp -= 2; /* Modified according to 650/301 BIOS; was 4 */
+ if(SiS_Pr->SiS_SetFlag & TVSimuMode) {
+ temp -= 2;
if(ModeNo > 0x13) temp -= 10;
}
}
} else {
-#endif
tempcx = tempbx & 0x00FF;
tempbx = (tempbx & 0xFF00) >> 8;
tempcx = (tempcx + tempbx) >> 1;
temp = (tempcx & 0x00FF) + 2;
- if(SiS_VBInfo & SetCRT2ToTV){
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV){
temp--;
if(!(modeflag & HalfDCLK)){
if((modeflag & Charx8Dot)){
temp += 4;
- if(SiS_VGAHDE >= 800) temp -= 6;
- /* TW: Inserted from 650/301 BIOS, 630/301B/301 don't do this */
+ if(SiS_Pr->SiS_VGAHDE >= 800) temp -= 6;
if(HwDeviceExtension->jChipType >= SIS_315H) {
- if(SiS_VGAHDE == 800) temp += 2;
+ if(SiS_Pr->SiS_VGAHDE == 800) temp += 2;
}
}
}
} else {
- if(!(modeflag & HalfDCLK)){
- temp -= 4;
- if(SiS_LCDResInfo != Panel1280x960) {
- if(SiS_VGAHDE >= 800){
- temp -= 7;
- if(SiS_ModeType == ModeEGA){ /* 650/301LV does not do this */
- if(SiS_VGAVDE == 1024){ /* 650/301LV does not do this */
- temp += 15; /* 650/301LV does not do this */
- if(SiS_LCDResInfo != Panel1280x1024) temp += 7; /* 650/301LV does not do this */
- }
- }
- if(SiS_VGAHDE >= 1280){
- if(SiS_LCDResInfo != Panel1280x960) {
- if(SiS_LCDInfo & LCDNonExpanding) temp += 28;
- }
+ if(!(modeflag & HalfDCLK)) {
+ temp -= 4;
+ if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x960) {
+ if(SiS_Pr->SiS_VGAHDE >= 800) {
+ temp -= 7;
+ if(HwDeviceExtension->jChipType < SIS_315H) {
+ /* 650/301LV(x) does not do this, 630/301B, 300/301LV do */
+ if(SiS_Pr->SiS_ModeType == ModeEGA) {
+ if(SiS_Pr->SiS_VGAVDE == 1024) {
+ temp += 15;
+ if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x1024)
+ temp += 7;
+ }
+ }
+ }
+ if(SiS_Pr->SiS_VGAHDE >= 1280) {
+ if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x960) {
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) temp += 28;
+ }
+ }
}
- }
- }
+ }
}
}
-#ifdef oldHV
}
-#endif
- SiS_SetReg1(SiS_Part1Port,0x07,temp); /* 0x07 Horizontal Retrace Start */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x07,temp); /* 0x07 Horizontal Retrace Start */
- SiS_SetReg1(SiS_Part1Port,0x08,0x00); /* 0x08 Horizontal Retrace End */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x08,0x00); /* 0x08 Horizontal Retrace End */
- if(SiS_VBInfo & SetCRT2ToTV) {
- if(SiS_SetFlag & TVSimuMode) {
- if((ModeNo == 0x06) || (ModeNo == 0x10) || (ModeNo == 0x11) ||
- (ModeNo == 0x13) || (ModeNo == 0x0F)){
- SiS_SetReg1(SiS_Part1Port,0x07,0x5b);
- SiS_SetReg1(SiS_Part1Port,0x08,0x03);
- }
- if((ModeNo == 0x00) || (ModeNo == 0x01)) {
- if(SiS_VBInfo & SetNTSCTV) {
- SiS_SetReg1(SiS_Part1Port,0x07,0x2A);
- SiS_SetReg1(SiS_Part1Port,0x08,0x61);
- } else {
- SiS_SetReg1(SiS_Part1Port,0x07,0x2A);
- SiS_SetReg1(SiS_Part1Port,0x08,0x41);
- SiS_SetReg1(SiS_Part1Port,0x0C,0xF0);
- }
- }
- if((ModeNo == 0x02) || (ModeNo == 0x03) || (ModeNo == 0x07)){
- if(SiS_VBInfo & SetNTSCTV) {
- SiS_SetReg1(SiS_Part1Port,0x07,0x54);
- SiS_SetReg1(SiS_Part1Port,0x08,0x00);
- } else {
- SiS_SetReg1(SiS_Part1Port,0x07,0x55);
- SiS_SetReg1(SiS_Part1Port,0x08,0x00);
- SiS_SetReg1(SiS_Part1Port,0x0C,0xF0);
- }
- }
- if((ModeNo == 0x04) || (ModeNo == 0x05) || (ModeNo == 0x0D)
- || (ModeNo == 0x50)){
- if(SiS_VBInfo & SetNTSCTV) {
- SiS_SetReg1(SiS_Part1Port,0x07,0x30);
- SiS_SetReg1(SiS_Part1Port,0x08,0x03);
- } else {
- SiS_SetReg1(SiS_Part1Port,0x07,0x2f);
- SiS_SetReg1(SiS_Part1Port,0x08,0x02);
- }
- }
- }
- }
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
+ if(SiS_Pr->SiS_SetFlag & TVSimuMode) {
+ if(ModeNo <= 0x01) {
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x07,0x2a);
+ if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) {
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x08,0x61);
+ } else {
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x08,0x41);
+ }
+ } else if(SiS_Pr->SiS_ModeType == ModeText) {
+ if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) {
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x07,0x54);
+ } else {
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x07,0x55);
+ }
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x08,0x00);
+ } else if(ModeNo <= 0x13) {
+ if(modeflag & HalfDCLK) {
+ if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) {
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x07,0x30);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x08,0x03);
+ } else {
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x07,0x2f);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x08,0x02);
+ }
+ } else {
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x07,0x5b);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x08,0x03);
+ }
+ } else if( ((HwDeviceExtension->jChipType >= SIS_315H) && (ModeNo == 0x50)) ||
+ ((HwDeviceExtension->jChipType < SIS_315H) && (resinfo == 0 || resinfo == 1)) ) {
+ if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) {
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x07,0x30);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x08,0x03);
+ } else {
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x07,0x2f);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x08,0x03);
+ }
+ }
- SiS_SetReg1(SiS_Part1Port,0x18,0x03); /* 0x18 SR08 */
+ }
+ }
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) {
+ if(SiS_Pr->SiS_HiVision & 0x03) {
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x07,0xb2);
+ if(SiS_Pr->SiS_HiVision & 0x02) {
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x07,0xab);
+ }
+ }
+ }
- SiS_SetRegANDOR(SiS_Part1Port,0x19,0xF0,0x00);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x18,0x03); /* 0x18 SR08 (FIFO Threshold?) */
- SiS_SetReg1(SiS_Part1Port,0x09,0xFF); /* 0x09 Set Max VT */
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x19,0xF0);
- tempbx = SiS_VGAVT;
+ tempbx = SiS_Pr->SiS_VGAVT;
push1 = tempbx;
+
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x09,0xFF); /* 0x09 Set Max VT */
+
tempcx = 0x121;
- tempbx = SiS_VGAVDE; /* 0x0E Vertical Display End */
+ tempbx = SiS_Pr->SiS_VGAVDE; /* 0x0E Vertical Display End */
if(tempbx == 357) tempbx = 350;
if(tempbx == 360) tempbx = 350;
if(tempbx == 375) tempbx = 350;
@@ -813,9 +910,9 @@ SiS_SetGroup1_301(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdInd
if(tempbx == 420) tempbx = 400;
if(tempbx == 525) tempbx = 480;
push2 = tempbx;
- if(SiS_VBInfo & SetCRT2ToLCD) { /* TW: Entire if statement not in 630/301 BIOS */
- if(SiS_LCDResInfo == Panel1024x768) {
- if(!(SiS_SetFlag & LCDVESATiming)) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) {
+ if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) {
if(tempbx == 350) tempbx += 5;
if(tempbx == 480) tempbx += 5;
}
@@ -823,18 +920,24 @@ SiS_SetGroup1_301(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdInd
}
tempbx--;
temp = tempbx & 0x00FF;
- tempbx--; /* Not in 630/301 BIOS */
- temp = tempbx & 0x00FF; /* Not in 630/301 BIOS */
- SiS_SetReg1(SiS_Part1Port,0x10,temp); /* 0x10 vertical Blank Start */
+ tempbx--;
+ temp = tempbx & 0x00FF;
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x10,temp); /* 0x10 vertical Blank Start */
tempbx = push2;
tempbx--;
temp = tempbx & 0x00FF;
- SiS_SetReg1(SiS_Part1Port,0x0E,temp);
+#if 0
+ /* TW: Missing code from 630/301B 2.04.5a and 650/302LV 1.10.6s (calles int 2f) */
+ if(xxx()) {
+ if(temp == 0xdf) temp = 0xda;
+ }
+#endif
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0E,temp);
if(tempbx & 0x0100) {
tempcx |= 0x0002;
- if(SiS_VBType & VB_SIS301) tempcx |=0x000a;
+ if(SiS_Pr->SiS_VBType & VB_SIS301) tempcx |= 0x000a;
}
tempax = 0x000B;
@@ -842,12 +945,12 @@ SiS_SetGroup1_301(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdInd
if(tempbx & 0x0200) {
tempcx |= 0x0040;
- if(SiS_VBType & VB_SIS301) tempax |= 0x2000;
+ if(SiS_Pr->SiS_VBType & VB_SIS301) tempax |= 0x2000;
}
- if(SiS_VBType & VB_SIS301) {
- if(SiS_VBInfo & SetPALTV) {
- if(SiS_VGAVDE == 480) {
+ if(SiS_Pr->SiS_VBType & VB_SIS301) {
+ if(SiS_Pr->SiS_VBInfo & SetPALTV) {
+ if(SiS_Pr->SiS_VGAVDE == 480) {
tempax = (tempax & 0x00ff) | 0x2000;
if(modeflag & DoubleScanMode) tempax |= 0x8000;
}
@@ -855,161 +958,173 @@ SiS_SetGroup1_301(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdInd
}
temp = (tempax & 0xFF00) >> 8;
- SiS_SetReg1(SiS_Part1Port,0x0B,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0B,temp);
if(tempbx & 0x0400) tempcx |= 0x0600;
- SiS_SetReg1(SiS_Part1Port,0x11,0x00); /* 0x11 Vertical Blank End */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x11,0x00); /* 0x11 Vertical Blank End */
tempax = push1;
tempax -= tempbx;
tempax >>= 2;
push1 = tempax;
- if((resinfo != 0x09) || (SiS_VBType & VB_SIS301)) {
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ /* TW: Inserted from 650/30xLV 1.10.6s */
+ if(ModeNo > 0x13) {
+ if(resinfo != 0x09) { /* 1280x1024 */
+ tempax <<= 1;
+ tempbx += tempax;
+ }
+ } else {
+ if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1400x1050) {
+ tempax <<= 1;
+ tempbx += tempax;
+ }
+ }
+ } else if((resinfo != 0x09) || (SiS_Pr->SiS_VBType & VB_SIS301)) {
tempax <<= 1;
tempbx += tempax;
}
-#ifdef oldHV
- if(SiS_VBInfo & SetCRT2ToHiVisionTV) {
+
+ if( (SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) &&
+ (SiS_Pr->SiS_HiVision == 3) ) {
tempbx -= 10;
} else {
-#endif
- if(SiS_SetFlag & TVSimuMode) {
- if(SiS_VBInfo & SetPALTV) {
- if(!(SiS_HiVision & 0x03)) {
+ if(SiS_Pr->SiS_SetFlag & TVSimuMode) {
+ if(SiS_Pr->SiS_VBInfo & SetPALTV) {
+ if(!(SiS_Pr->SiS_HiVision & 0x03)) {
tempbx += 40;
if(HwDeviceExtension->jChipType >= SIS_315H) {
- if(SiS_VGAHDE == 800) tempbx += 10;
+ if(SiS_Pr->SiS_VGAHDE == 800) tempbx += 10;
}
}
}
}
-#ifdef oldHV
}
-#endif
tempax = push1;
tempax >>= 2;
tempax++;
tempax += tempbx;
push1 = tempax;
- if((SiS_VBInfo & SetPALTV)) {
+ if(SiS_Pr->SiS_VBInfo & SetPALTV) {
if(tempbx <= 513) {
if(tempax >= 513) tempbx = 513;
}
}
temp = tempbx & 0x00FF;
- SiS_SetReg1(SiS_Part1Port,0x0C,temp); /* 0x0C Vertical Retrace Start */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0C,temp); /* 0x0C Vertical Retrace Start */
- if(!(SiS_VBType & VB_SIS301)) {
+ if(!(SiS_Pr->SiS_VBType & VB_SIS301)) {
tempbx--;
temp = tempbx & 0x00FF;
- SiS_SetReg1(SiS_Part1Port,0x10,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x10,temp);
if(tempbx & 0x0100) tempcx |= 0x0008;
- if(tempbx & 0x0200)
- SiS_SetRegOR(SiS_Part1Port,0x0B,0x20);
+ if(tempbx & 0x0200) {
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x0B,0x20);
+ }
tempbx++;
}
if(tempbx & 0x0100) tempcx |= 0x0004;
if(tempbx & 0x0200) tempcx |= 0x0080;
if(tempbx & 0x0400) {
- if(SiS_VBType & VB_SIS301) tempcx |= 0x0800;
- else tempcx |= 0x0C00;
+ if(SiS_Pr->SiS_VBType & VB_SIS301) tempcx |= 0x0800;
+ else tempcx |= 0x0C00;
}
tempbx = push1;
temp = tempbx & 0x00FF;
temp &= 0x0F;
- SiS_SetReg1(SiS_Part1Port,0x0D,temp); /* 0x0D vertical Retrace End */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0D,temp); /* 0x0D vertical Retrace End */
if(tempbx & 0x0010) tempcx |= 0x2000;
temp = tempcx & 0x00FF;
-
- if(SiS_VBType & VB_SIS301) {
- if(SiS_VBInfo & SetPALTV) {
- if(SiS_VGAVDE == 480) temp = 0xa3;
+ if(SiS_Pr->SiS_VBType & VB_SIS301) {
+ if(SiS_Pr->SiS_VBInfo & SetPALTV) {
+ if(SiS_Pr->SiS_VGAVDE == 480) temp = 0xa3;
}
}
- SiS_SetReg1(SiS_Part1Port,0x0A,temp); /* 0x0A CR07 */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0A,temp); /* 0x0A CR07 */
temp = (tempcx & 0xFF00) >> 8;
- SiS_SetReg1(SiS_Part1Port,0x17,temp); /* 0x17 SR0A */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x17,temp); /* 0x17 SR0A */
tempax = modeflag;
temp = (tempax & 0xFF00) >> 8;
temp = (temp >> 1) & 0x09;
- /* TW: Inserted from 650/301 BIOS; not in 630/301B+301 BIOS */
- if(HwDeviceExtension->jChipType >= SIS_315H) {
+ if(!(SiS_Pr->SiS_VBType & VB_SIS301)) {
+ /* Only use 8 dot clock */
temp |= 0x01;
}
- SiS_SetReg1(SiS_Part1Port,0x16,temp); /* 0x16 SR01 */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x16,temp); /* 0x16 SR01 */
- SiS_SetReg1(SiS_Part1Port,0x0F,0x00); /* 0x0F CR14 */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0F,0x00); /* 0x0F CR14 */
- SiS_SetReg1(SiS_Part1Port,0x12,0x00); /* 0x12 CR17 */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x12,0x00); /* 0x12 CR17 */
- if(SiS_LCDInfo & LCDRGB18Bit) temp = 0x80;
- else temp = 0x00;
- SiS_SetReg1(SiS_Part1Port,0x1A,temp); /* 0x1A SR0E */
+ if(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit) {
+ if(IS_SIS650) {
+ /* TW: Inserted from 650/30xLV 1.10.6s */
+ if(SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x00) & 0x01) {
+ temp = 0x80;
+ }
+ } else temp = 0x80;
+ } else temp = 0x00;
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1A,temp); /* 0x1A SR0E */
return;
}
-/* TW: Checked against 650/LVDS 1.10.07, 630/301B (I,II) and 630/LVDS BIOS */
void
-SiS_SetGroup1_LVDS(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,
- USHORT ModeIdIndex,
- PSIS_HW_DEVICE_INFO HwDeviceExtension,
+SiS_SetGroup1_LVDS(SiS_Private *SiS_Pr,USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,
+ USHORT ModeIdIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension,
USHORT RefreshRateTableIndex)
{
- USHORT modeflag,resinfo;
- USHORT push1,push2,tempax,tempbx,tempcx,temp,pushcx;
- ULONG tempeax=0,tempebx,tempecx,tempvcfact=0;
+ USHORT modeflag, resinfo;
+ USHORT push1, push2, tempax, tempbx, tempcx, temp;
+#ifdef SIS315H
+ USHORT pushcx;
+#endif
+ ULONG tempeax=0, tempebx, tempecx, tempvcfact=0;
- if(ModeNo<=0x13) {
- modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
- resinfo = SiS_SModeIDTable[ModeIdIndex].St_ResInfo;
+ if(ModeNo <= 0x13) {
+ modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
+ resinfo = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo;
} else {
- modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
- resinfo = SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
+ modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
}
-#ifdef LINUX_XF86
-#ifdef TWDEBUG
- xf86DrvMsg(0, X_INFO, "(init301: LCDHDES 0x%03x LCDVDES 0x%03x)\n", SiS_LCDHDES, SiS_LCDVDES);
- xf86DrvMsg(0, X_INFO, "(init301: HDE 0x%03x VDE 0x%03x)\n", SiS_HDE, SiS_VDE);
- xf86DrvMsg(0, X_INFO, "(init301: VGAHDE 0x%03x VGAVDE 0x%03x)\n", SiS_VGAHDE, SiS_VGAVDE);
- xf86DrvMsg(0, X_INFO, "(init301: HT 0x%03x VT 0x%03x)\n", SiS_HT, SiS_VT);
- xf86DrvMsg(0, X_INFO, "(init301: VGAHT 0x%03x VGAVT 0x%03x)\n", SiS_VGAHT, SiS_VGAVT);
-#endif
-#endif
-
/* TW: Set up Panel Link */
/* 1. Horizontal setup */
- tempax = SiS_LCDHDES;
- /* TW: Inserted (650/LVDS,630/301B/LVDS) BIOS) */
- if((SiS_LCDResInfo == Panel640x480) && (!(SiS_VBInfo & SetInSlaveMode)))
+ tempax = SiS_Pr->SiS_LCDHDES;
+
+ if( (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480) &&
+ (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) ) {
tempax -= 8;
+ }
- tempcx = SiS_HT; /* Horiz. Total */
+ tempcx = SiS_Pr->SiS_HT; /* Horiz. Total */
- tempbx = SiS_HDE; /* Horiz. Display End */
+ tempbx = SiS_Pr->SiS_HDE; /* Horiz. Display End */
- if(SiS_LCDInfo & LCDNonExpanding) {
- if(!SiS_IF_DEF_DSTN) {
- if(SiS_LCDResInfo == Panel800x600) tempbx = 800;
- else if(SiS_LCDResInfo == Panel1024x768) tempbx = 1024;
-/* else if(SiS_LCDResInfo == Panel1024x600) tempbx = 1024; - not done in BIOS */
-/* else if(SiS_LCDResInfo == Panel1152x768) tempbx = 1152; - not done in BIOS */
- else if(SiS_LCDResInfo == Panel1280x1024) tempbx = 1280; /* TW */
- else if(SiS_LCDResInfo != Panel640x480) tempbx = 1400; /* TW */
- }
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) {
+ if((!SiS_Pr->SiS_IF_DEF_DSTN) && (SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480)) {
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) tempbx = 800;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) tempbx = 1024; /* TW: not done in BIOS */
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) tempbx = 1024;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1152x768) tempbx = 1152; /* TW: not done in BIOS */
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x768) tempbx = 1280;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) tempbx = 1280;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) tempbx = 1400;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) tempbx = 1600;
+ }
}
tempcx = (tempcx - tempbx) >> 2; /* HT-HDE / 4 */
@@ -1017,23 +1132,22 @@ SiS_SetGroup1_LVDS(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,
tempax += tempbx;
- if(tempax >= SiS_HT) tempax -= SiS_HT;
+ if(tempax >= SiS_Pr->SiS_HT) tempax -= SiS_Pr->SiS_HT;
push2 = tempax;
- /* TW: Inserted this entire "if"-section from 650/LVDS, 630/301B and 630/LVDS BIOS */
- if(SiS_VBInfo & SetCRT2ToLCD) {
- if(!SiS_IF_DEF_DSTN){
- if(SiS_LCDResInfo == Panel800x600) tempcx = 0x0028;
- else if(SiS_LCDResInfo == Panel1400x1050) tempcx = 0x0030;
- else if( (SiS_LCDResInfo == Panel1024x768) ||
- (SiS_LCDResInfo == Panel1024x600) ||
- (SiS_LCDResInfo == Panel1152x768) ) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ if((!SiS_Pr->SiS_IF_DEF_DSTN) && (SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480)) {
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) tempcx = 0x0028;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) tempcx = 0x0018;
+ else if( (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) ||
+ (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1152x768) ||
+ (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x768) ) {
if(HwDeviceExtension->jChipType < SIS_315H) {
- if(SiS_IF_DEF_LVDS == 1) {
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
tempcx = 0x0017;
-#ifdef TWPANEL
- tempcx++;
+#ifdef TWNEWPANEL
+ tempcx = 0x0018;
#endif
} else {
tempcx = 0x0017; /* A901; other 301B BIOS 0x0018; */
@@ -1042,173 +1156,168 @@ SiS_SetGroup1_LVDS(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,
tempcx = 0x0018;
}
}
- else if(SiS_LCDResInfo != Panel640x480) tempcx = 0x0030;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) tempcx = 0x0030;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) tempcx = 0x0030;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) tempcx = 0x0040;
}
}
tempcx += tempax; /* lcdhrs */
- if(tempcx >= SiS_HT) tempcx -= SiS_HT;
+ if(tempcx >= SiS_Pr->SiS_HT) tempcx -= SiS_Pr->SiS_HT;
tempax = tempcx >> 3; /* BPLHRS */
temp = tempax & 0x00FF;
- SiS_SetReg1(SiS_Part1Port,0x14,temp); /* Part1_14h; TW: Panel Link Horizontal Retrace Start */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x14,temp); /* Part1_14h; TW: Panel Link Horizontal Retrace Start */
temp = (tempax & 0x00FF) + 10;
- /* TW: Inserted this entire "if"-section from 650/LVDS BIOS */
- if(SiS_VBInfo & SetCRT2ToLCD) {
- if(!SiS_IF_DEF_DSTN){
- if(SiS_LCDResInfo != Panel640x480) {
- temp += 6;
- if(SiS_LCDResInfo != Panel800x600) {
- temp++;
- if(HwDeviceExtension->jChipType > SIS_315H) {
- if(SiS_LCDResInfo != Panel1024x768) {
- temp -= 3;
-#ifdef TEST1400
- temp = 0x0e;
-#endif
- }
- }
- }
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ if(!SiS_Pr->SiS_IF_DEF_DSTN){
+ if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) {
+ temp += 6;
+ if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel800x600) {
+ temp++;
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1024x768) {
+ temp += 7;
+ if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1600x1200) {
+ temp -= 10;
+ }
+ }
+ }
+ }
}
- }
+ }
}
temp &= 0x1F;
temp |= ((tempcx & 0x0007) << 5);
- if(SiS_IF_DEF_FSTN) temp=0x20;
- SiS_SetReg1(SiS_Part1Port,0x15,temp); /* Part1_15h; TW: Panel Link Horizontal Retrace End/Skew */
+ if(SiS_Pr->SiS_IF_DEF_FSTN) temp = 0x20;
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x15,temp); /* Part1_15h; TW: Panel Link Horizontal Retrace End/Skew */
tempbx = push2;
tempcx = push1; /* lcdhdes */
temp = (tempcx & 0x0007); /* BPLHDESKEW */
- SiS_SetReg1(SiS_Part1Port,0x1A,temp); /* Part1_1Ah; TW: Panel Link Vertical Retrace Start (2:0) */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1A,temp); /* Part1_1Ah; TW: Panel Link Vertical Retrace Start (2:0) */
tempcx >>= 3; /* BPLHDES */
temp = (tempcx & 0x00FF);
- if(ModeNo==0x5b) temp--; /* fix fstn mode=5b */
- SiS_SetReg1(SiS_Part1Port,0x16,temp); /* Part1_16h; TW: Panel Link Horizontal Display Enable Start */
+ if(ModeNo == 0x5b) temp--;
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x16,temp); /* Part1_16h; TW: Panel Link Horizontal Display Enable Start */
- if(HwDeviceExtension->jChipType < SIS_315H) { /* TW: Not done in LVDS BIOS 1.10.07 */
- if(tempbx & 0x07) tempbx += 8; /* TW: Done in 630/301B and 630/LVDS BIOSes */
+ if(HwDeviceExtension->jChipType < SIS_315H) {
+ if(tempbx & 0x07) tempbx += 8;
}
tempbx >>= 3; /* BPLHDEE */
temp = tempbx & 0x00FF;
- if(ModeNo==0x5b) temp--; /* fix fstn mode=5b */
- SiS_SetReg1(SiS_Part1Port,0x17,temp); /* Part1_17h; TW: Panel Link Horizontal Display Enable End */
+ if(ModeNo == 0x5b) temp--;
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x17,temp); /* Part1_17h; TW: Panel Link Horizontal Display Enable End */
/* 2. Vertical setup */
if(HwDeviceExtension->jChipType < SIS_315H) {
-
- /* TW: This entire section from 630/301B and 630/LVDS/LVDS+CH BIOS */
- tempcx = SiS_VGAVT;
- tempbx = SiS_VGAVDE;
- if(SiS_LCDInfo & LCDNonExpanding) {
- if(SiS_LCDResInfo != Panel640x480) {
- tempbx = 600;
- if(SiS_LCDResInfo != Panel800x600) {
- tempbx = 768;
- if( (SiS_LCDResInfo != Panel1024x768) && (SiS_LCDResInfo != Panel1152x768) ) {
- tempbx = 600;
- }
- }
- }
- }
- tempcx -= tempbx;
+ tempcx = SiS_Pr->SiS_VGAVT;
+ tempbx = SiS_Pr->SiS_VGAVDE;
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) {
+ if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) {
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) tempbx = 600;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) tempbx = 600;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) tempbx = 768;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1152x768) tempbx = 768;
+ else tempbx = 1024;
+ }
+ }
+ tempcx -= tempbx;
} else {
- tempcx = SiS_VGAVT - SiS_VGAVDE; /* VGAVT-VGAVDE */
+ tempcx = SiS_Pr->SiS_VGAVT - SiS_Pr->SiS_VGAVDE; /* VGAVT-VGAVDE */
}
- tempbx = SiS_LCDVDES; /* VGAVDES */
+ tempbx = SiS_Pr->SiS_LCDVDES; /* VGAVDES */
push1 = tempbx;
- tempax = SiS_VGAVDE;
-
- if((SiS_IF_DEF_TRUMPION == 0) && (!(SiS_LCDInfo & 0x0100))
- && (SiS_LCDResInfo != Panel640x480)) {
- if(SiS_VBInfo & SetCRT2ToLCD) {
- if(!SiS_IF_DEF_DSTN){
- if(SiS_LCDResInfo == Panel800x600) tempax = 600;
- else if(SiS_LCDResInfo == Panel1024x768) tempax = 768;
- else if(SiS_LCDResInfo == Panel1024x600) tempax = 600; /* TW */
- else if(SiS_LCDResInfo == Panel1152x768) tempax = 768; /* TW */
- else if(SiS_LCDResInfo == Panel1280x1024) tempax = 1024; /* TW */
- else if(SiS_LCDResInfo == Panel1400x1050) tempax = 1050; /* TW */
- else tempax = 600;
+ tempax = SiS_Pr->SiS_VGAVDE;
+
+ if( (SiS_Pr->SiS_IF_DEF_TRUMPION == 0) &&
+ (!(SiS_Pr->SiS_LCDInfo & LCDPass11)) &&
+ (SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) ) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ if(!SiS_Pr->SiS_IF_DEF_DSTN){
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) tempax = 600;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) tempax = 600;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) tempax = 768;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1152x768) tempax = 768;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x768) tempax = 768;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) tempax = 1024;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) tempax = 1050;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) tempax = 1200;
}
}
}
- tempbx = tempbx + tempax;
- if(tempbx >= SiS_VT) tempbx -= SiS_VT;
+ tempbx += tempax;
+ if(tempbx >= SiS_Pr->SiS_VT) tempbx -= SiS_Pr->SiS_VT;
- push2 = tempbx; /* push bx temppush */
+ push2 = tempbx;
tempcx >>= 1;
- /* TW: Inserted this entire "if" section (650/LVDS; 630/301B; 630/LVDS) */
- if((SiS_VBInfo & SetCRT2ToLCD) && (SiS_LCDResInfo != Panel640x480)){
- if(!SiS_IF_DEF_DSTN){
- if(SiS_LCDResInfo == Panel800x600) tempcx = 0x0001;
- else if( (SiS_LCDResInfo == Panel1024x768) ||
- (SiS_LCDResInfo == Panel1152x768) ) {
+ if((SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) && (SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480)){
+ if(!SiS_Pr->SiS_IF_DEF_DSTN){
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) tempcx = 0x0001;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) tempcx = 0x0001;
+ else if((SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) ||
+ (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1152x768)) {
if(HwDeviceExtension->jChipType < SIS_315H) {
- if(SiS_IF_DEF_LVDS == 1) {
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
tempcx = 0x0002;
-#ifdef TWPANEL
- tempcx++;
+#ifdef TWNEWPANEL
+ tempcx = 0x0003;
#endif
} else {
tempcx = 0x0002; /* TW: A901; other 301B BIOS sets 0x0003; */
}
} else tempcx = 0x0003;
}
- else if(SiS_LCDResInfo == Panel1280x768) tempcx = 0x0003;
- else if(SiS_LCDResInfo == Panel1280x1024) tempcx = 0x0001;
- else if(SiS_LCDResInfo == Panel1400x1050) tempcx = 0x0001;
- else tempcx = 0x0057;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x768) tempcx = 0x0003;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) tempcx = 0x0001;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) tempcx = 0x0001;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) tempcx = 0x0001;
+ else tempcx = 0x0057;
}
}
tempbx += tempcx; /* BPLVRS */
if(HwDeviceExtension->jChipType < SIS_315H) {
-#ifdef TWPANEL
- if(SiS_IF_DEF_CH70xx == 0)
-#endif
- tempbx++;
+ tempbx++;
}
-#ifdef TEST1400 /* Not done on 650/LVDS 1.10.07, done in 650/LVDS 1.10a */
- if(HwDeviceExtension->jChipType >= SIS_315H) {
- tempbx++;
- }
-#endif
+ if(tempbx >= SiS_Pr->SiS_VT) tempbx -= SiS_Pr->SiS_VT;
- if(tempbx >= SiS_VT) tempbx -= SiS_VT;
temp = tempbx & 0x00FF;
- SiS_SetReg1(SiS_Part1Port,0x18,temp); /* Part1_18h; TW: Panel Link Vertical Retrace Start */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x18,temp); /* Part1_18h; TW: Panel Link Vertical Retrace Start */
tempcx >>= 3;
- /* TW: Inserted this entire "if" section (650/LVDS, 630/LVDS, 630/301B) */
- if(SiS_VBInfo & SetCRT2ToLCD) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
if( (HwDeviceExtension->jChipType < SIS_315H) &&
- (SiS_LCDResInfo == Panel640x480) ) tempcx = 0x0001;
- else if(SiS_LCDResInfo == Panel1400x1050) tempcx = 0x0002;
- else if(SiS_LCDResInfo == Panel800x600) tempcx = 0x0003;
- else if(SiS_LCDResInfo != Panel640x480) {
+ (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480) ) tempcx = 0x0001;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) tempcx = 0x0003;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) tempcx = 0x0005;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1152x768) tempcx = 0x0005;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) tempcx = 0x0002;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) tempcx = 0x0002;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) tempcx = 0x0002;
+ else if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) {
if(HwDeviceExtension->jChipType < SIS_315H) {
- if(SiS_IF_DEF_LVDS == 1) {
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
tempcx = 0x0004;
-#ifdef TWPANEL
- tempcx++;
+#ifdef TWNEWPANEL
+ tempcx = 0x0005;
#endif
} else {
tempcx = 0x0004; /* A901; Other BIOS sets 0x0005; */
@@ -1221,14 +1330,14 @@ SiS_SetGroup1_LVDS(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,
tempcx = tempcx + tempbx + 1; /* BPLVRE */
temp = tempcx & 0x000F;
- SiS_SetRegANDOR(SiS_Part1Port,0x19,0xf0,temp); /* Part1_19h; TW: Panel Link Vertical Retrace End (3:0); Misc. */
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0xf0,temp); /* Part1_19h; TW: Panel Link Vertical Retrace End (3:0); Misc. */
temp = ((tempbx & 0x0700) >> 8) << 3; /* BPLDESKEW =0 */
- if(SiS_VGAVDE != SiS_VDE) temp |= 0x40;
- if(SiS_SetFlag & EnableLVDSDDA) temp |= 0x40;
- if(SiS_LCDInfo & LCDRGB18Bit) {
+ if(SiS_Pr->SiS_VGAVDE != SiS_Pr->SiS_VDE) temp |= 0x40;
+ if(SiS_Pr->SiS_SetFlag & EnableLVDSDDA) temp |= 0x40;
+ if(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit) {
if(HwDeviceExtension->jChipType >= SIS_315H) {
- if(SiS_GetReg1(SiS_Part1Port,0x00) & 0x01) { /* TW: Inserted from 650/LVDS 1.10.07 */
+ if(SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x00) & 0x01) {
temp |= 0x80;
}
} else {
@@ -1239,88 +1348,101 @@ SiS_SetGroup1_LVDS(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,
}
}
}
- } /* TW: in follwing line, 0x87 was 0x07 (modified according to 650/LVDS BIOS) */
- SiS_SetRegANDOR(SiS_Part1Port,0x1A,0x87,temp); /* Part1_1Ah; TW: Panel Link Control Signal (7:3); Vertical Retrace Start (2:0) */
+ }
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x1A,0x87,temp); /* Part1_1Ah; TW: Panel Link Control Signal (7:3); Vertical Retrace Start (2:0) */
if (HwDeviceExtension->jChipType < SIS_315H) {
- /* 300 series */
+#ifdef SIS300 /* 300 series */
- tempeax = SiS_VGAVDE << 6;
- temp = (USHORT)(tempeax % (ULONG)SiS_VDE);
- tempeax = tempeax / (ULONG)SiS_VDE;
+ tempeax = SiS_Pr->SiS_VGAVDE << 6;
+ temp = (USHORT)(tempeax % (ULONG)SiS_Pr->SiS_VDE);
+ tempeax = tempeax / (ULONG)SiS_Pr->SiS_VDE;
if(temp != 0) tempeax++;
tempebx = tempeax; /* BPLVCFACT */
- if(SiS_SetFlag & EnableLVDSDDA) {
- tempebx = 0x003F;
+ if(SiS_Pr->SiS_SetFlag & EnableLVDSDDA) {
+ tempebx = 0x003F;
}
temp = (USHORT)(tempebx & 0x00FF);
- SiS_SetReg1(SiS_Part1Port,0x1E,temp); /* Part1_1Eh; TW: Panel Link Vertical Scaling Factor */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1E,temp); /* Part1_1Eh; TW: Panel Link Vertical Scaling Factor */
+
+#endif /* SIS300 */
} else {
- /* 310 series */
+#ifdef SIS315H /* 310/325 series */
- SiS_SetReg1(SiS_Part1Port,0x1E,0x23); /* Inserted from 650/LVDS BIOS */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1E,0x23);
- tempeax = SiS_VGAVDE << 18;
- temp = (USHORT)(tempeax % (ULONG)SiS_VDE);
- tempeax = tempeax / SiS_VDE;
+ tempeax = SiS_Pr->SiS_VGAVDE << 18;
+ temp = (USHORT)(tempeax % (ULONG)SiS_Pr->SiS_VDE);
+ tempeax = tempeax / SiS_Pr->SiS_VDE;
if(temp != 0) tempeax++;
tempebx = tempeax; /* BPLVCFACT */
tempvcfact = tempeax;
temp = (USHORT)(tempebx & 0x00FF);
- SiS_SetReg1(SiS_Part1Port,0x37,temp); /* Part1_37h; TW: Panel Link Vertical Scaling Factor */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x37,temp); /* Part1_37h; TW: Panel Link Vertical Scaling Factor */
temp = (USHORT)((tempebx & 0x00FF00) >> 8);
- SiS_SetReg1(SiS_Part1Port,0x36,temp); /* Part1_36h; TW: Panel Link Vertical Scaling Factor */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x36,temp); /* Part1_36h; TW: Panel Link Vertical Scaling Factor */
temp = (USHORT)((tempebx & 0x00030000) >> 16);
- if(SiS_VDE == SiS_VGAVDE) temp |= 0x04;
- SiS_SetReg1(SiS_Part1Port,0x35,temp); /* Part1_35h; TW: Panel Link Vertical Scaling Factor */
+ if(SiS_Pr->SiS_VDE == SiS_Pr->SiS_VGAVDE) temp |= 0x04;
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x35,temp); /* Part1_35h; TW: Panel Link Vertical Scaling Factor */
+
+#endif /* SIS315H */
}
- tempbx = push2; /* p bx temppush1 BPLVDEE */
+ tempbx = push2; /* BPLVDEE */
tempcx = push1;
- push1 = temp; /* TW: For 630/301B and 630/LVDS */
+ push1 = temp;
- if(!(SiS_VBInfo & SetInSlaveMode)) {
- if(!SiS_IF_DEF_DSTN){
- if(SiS_LCDResInfo == Panel800x600) {
- if(resinfo == 7) tempcx++;
- }
- if(HwDeviceExtension->jChipType < SIS_315H) { /* TW: Not done in 650/LVDS 1.10.07 */
- if(resinfo == 8) tempcx++; /* TW: But in 630/301B and 630/LVDS */
+ if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
+ if(!SiS_Pr->SiS_IF_DEF_DSTN){
+ if(HwDeviceExtension->jChipType < SIS_315H) {
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) {
+ if(resinfo == 15) tempcx++;
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) {
+ if(resinfo == 7) tempcx++;
+ }
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) {
+ if(resinfo == 7) tempcx++;
+ if(resinfo == 8) tempcx++; /* TW: Doesnt make sense anyway... */
+ } else if(resinfo == 8) tempcx++;
+ } else {
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) {
+ if(resinfo == 7) tempcx++;
+ }
}
}
}
- /* TW: Inserted (650/LVDS, 630/LVDS, 630/301B) */
- if(SiS_LCDResInfo == Panel640x480) {
- tempcx = SiS_VGAVDE;
- tempbx = SiS_VGAVDE - 1;
+
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480) {
+ tempcx = SiS_Pr->SiS_VGAVDE;
+ tempbx = SiS_Pr->SiS_VGAVDE - 1;
}
temp = ((tempbx & 0x0700) >> 8) << 3;
temp |= ((tempcx & 0x0700) >> 8);
- SiS_SetReg1(SiS_Part1Port,0x1D,temp); /* Part1_1Dh; TW: Vertical Display Overflow; Control Signal */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1D,temp); /* Part1_1Dh; TW: Vertical Display Overflow; Control Signal */
temp = tempbx & 0x00FF;
- if(SiS_IF_DEF_FSTN) temp++;
- SiS_SetReg1(SiS_Part1Port,0x1C,temp); /* Part1_1Ch; TW: Panel Link Vertical Display Enable End */
+ if(SiS_Pr->SiS_IF_DEF_FSTN) temp++;
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1C,temp); /* Part1_1Ch; TW: Panel Link Vertical Display Enable End */
temp = tempcx & 0x00FF;
- SiS_SetReg1(SiS_Part1Port,0x1B,temp); /* Part1_1Bh; TW: Panel Link Vertical Display Enable Start */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1B,temp); /* Part1_1Bh; TW: Panel Link Vertical Display Enable Start */
/* 3. Additional horizontal setup (scaling, etc) */
- tempecx = SiS_VGAHDE;
+ tempecx = SiS_Pr->SiS_VGAHDE;
if(HwDeviceExtension->jChipType >= SIS_315H) {
- if(modeflag & HalfDCLK) /* TW: Added this entire if statement */
+ if(modeflag & HalfDCLK)
tempecx >>= 1;
}
- tempebx = SiS_HDE;
+ tempebx = SiS_Pr->SiS_HDE;
if(tempecx == tempebx) tempeax = 0xFFFF;
else {
tempeax = tempecx;
@@ -1328,135 +1450,136 @@ SiS_SetGroup1_LVDS(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,
temp = (USHORT)(tempeax % tempebx);
tempeax = tempeax / tempebx;
if(HwDeviceExtension->jChipType >= SIS_315H) {
- if(temp) tempeax++; /* TW: Not done in 630/301B or 630/LVDS, but for 650/LVDS */
+ if(temp) tempeax++;
}
}
tempecx = tempeax;
- if (HwDeviceExtension->jChipType >= SIS_315H) {
- tempeax = SiS_VGAHDE;
- if(modeflag & HalfDCLK) /* TW: Added this entire if statement */
- tempeax >>= 1;
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ tempeax = SiS_Pr->SiS_VGAHDE;
+ if(modeflag & HalfDCLK) tempeax >>= 1;
tempeax <<= 16;
tempeax = (tempeax / tempecx) - 1;
} else {
- tempeax = ((SiS_VGAHT << 16) / tempecx) - 1;
+ tempeax = ((SiS_Pr->SiS_VGAHT << 16) / tempecx) - 1;
}
tempecx <<= 16;
tempecx |= (tempeax & 0xFFFF);
temp = (USHORT)(tempecx & 0x00FF);
- SiS_SetReg1(SiS_Part1Port,0x1F,temp); /* Part1_1Fh; TW: Panel Link DDA Operational Number in each horiz. line */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1F,temp); /* Part1_1Fh; TW: Panel Link DDA Operational Number in each horiz. line */
- tempbx = SiS_VDE; /* TW: added following if statement */
- if (HwDeviceExtension->jChipType >= SIS_315H) {
- tempeax = (SiS_VGAVDE << 18) / tempvcfact;
+ tempbx = SiS_Pr->SiS_VDE;
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ tempeax = (SiS_Pr->SiS_VGAVDE << 18) / tempvcfact;
tempbx = (USHORT)(tempeax & 0x0FFFF);
} else {
- tempax = SiS_VGAVDE << 6;
+ tempax = SiS_Pr->SiS_VGAVDE << 6;
tempbx = push1;
tempbx &= 0x3f;
if(tempbx == 0) tempbx = 64;
tempax = tempax / tempbx;
tempbx = tempax;
}
- if(SiS_LCDResInfo == Panel1024x768) tempbx--;
- if(SiS_SetFlag & EnableLVDSDDA) tempbx = 1;
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) tempbx--;
+ if(SiS_Pr->SiS_SetFlag & EnableLVDSDDA) tempbx = 1;
temp = ((tempbx & 0xFF00) >> 8) << 3;
temp |= (USHORT)((tempecx & 0x0700) >> 8);
- SiS_SetReg1(SiS_Part1Port,0x20,temp); /* Part1_20h; TW: Overflow register */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x20,temp); /* Part1_20h; TW: Overflow register */
temp = tempbx & 0x00FF;
- SiS_SetReg1(SiS_Part1Port,0x21,temp); /* Part1_21h; TW: Panel Link Vertical Accumulator Register */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x21,temp); /* Part1_21h; TW: Panel Link Vertical Accumulator Register */
tempecx >>= 16; /* BPLHCFACT */
- if(HwDeviceExtension->jChipType < SIS_315H) { /* TW: Added this entire if statement from 630/301B+LVDS BIOSes */
+ if(HwDeviceExtension->jChipType < SIS_315H) {
if(modeflag & HalfDCLK) tempecx >>= 1;
}
temp = (USHORT)((tempecx & 0xFF00) >> 8);
- SiS_SetReg1(SiS_Part1Port,0x22,temp); /* Part1_22h; TW: Panel Link Horizontal Scaling Factor High */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x22,temp); /* Part1_22h; TW: Panel Link Horizontal Scaling Factor High */
temp = (USHORT)(tempecx & 0x00FF);
- SiS_SetReg1(SiS_Part1Port,0x23,temp); /* Part1_22h; TW: Panel Link Horizontal Scaling Factor Low */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x23,temp); /* Part1_22h; TW: Panel Link Horizontal Scaling Factor Low */
/* 630/301B and 630/LVDS do something for 640x480 panels here */
- /* add dstn new register */
- if(SiS_IF_DEF_DSTN){
- SiS_SetReg1(SiS_Part1Port,0x1E,0x01);
- SiS_SetReg1(SiS_Part1Port,0x25,0x00);
- SiS_SetReg1(SiS_Part1Port,0x26,0x00);
- SiS_SetReg1(SiS_Part1Port,0x27,0x00);
- SiS_SetReg1(SiS_Part1Port,0x28,0x87);
- SiS_SetReg1(SiS_Part1Port,0x29,0x5A);
- SiS_SetReg1(SiS_Part1Port,0x2A,0x4B);
- SiS_SetRegANDOR(SiS_Part1Port,0x44,~0x007,0x03);
- tempbx = SiS_HDE + 64; /*Blps = lcdhdee(lcdhdes+HDE) + 64*/
+#ifdef SIS315H
+ /* TW: DSTN/FSTN initialisation - hardcoded for 320x480 panel */
+ if(SiS_Pr->SiS_IF_DEF_DSTN) {
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1E,0x01);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x25,0x00);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x26,0x00);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x27,0x00);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x28,0x87);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x29,0x5A);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x2A,0x4B);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x44,~0x007,0x03);
+ tempbx = SiS_Pr->SiS_HDE + 64; /*Blps = lcdhdee(lcdhdes+HDE) + 64*/
temp = tempbx & 0x00FF;
- SiS_SetReg1(SiS_Part1Port,0x38,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x38,temp);
temp=((tempbx & 0xFF00) >> 8) << 3;
- SiS_SetRegANDOR(SiS_Part1Port,0x35,~0x078,temp);
- tempbx += 32; /*Blpe=lBlps+32*/
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x35,~0x078,temp);
+ tempbx += 32; /*Blpe=lBlps+32*/
temp = tempbx & 0x00FF;
- if(SiS_IF_DEF_FSTN) temp=0;
- SiS_SetReg1(SiS_Part1Port,0x39,temp);
- SiS_SetReg1(SiS_Part1Port,0x3A,0x00); /*Bflml=0*/
- SiS_SetRegANDOR(SiS_Part1Port,0x3C,~0x007,0x00);
- tempbx = SiS_VDE / 2;
+ if(SiS_Pr->SiS_IF_DEF_FSTN) temp=0;
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x39,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x3A,0x00); /*Bflml=0*/
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x3C,~0x007,0x00);
+ tempbx = SiS_Pr->SiS_VDE / 2;
temp = tempbx & 0x00FF;
- SiS_SetReg1(SiS_Part1Port,0x3B,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x3B,temp);
temp = ((tempbx & 0xFF00) >> 8) << 3;
- SiS_SetRegANDOR(SiS_Part1Port,0x3C,~0x038,temp);
- tempeax = SiS_HDE << 2; /* BDxFIFOSTOP = (HDE*4)/128 */
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x3C,~0x038,temp);
+ tempeax = SiS_Pr->SiS_HDE << 2; /* BDxFIFOSTOP = (HDE*4)/128 */
tempebx = 128;
temp = (USHORT)(tempeax % tempebx);
tempeax = tempeax / tempebx;
if(temp != 0) tempeax++;
temp = (USHORT)(tempeax & 0x003F);
- SiS_SetRegANDOR(SiS_Part1Port,0x45,~0x0FF,temp);
- SiS_SetReg1(SiS_Part1Port,0x3F,0x00); /* BDxWadrst0 */
- SiS_SetReg1(SiS_Part1Port,0x3E,0x00);
- SiS_SetReg1(SiS_Part1Port,0x3D,0x10);
- SiS_SetRegANDOR(SiS_Part1Port,0x3C,~0x040,0x00);
- tempax = SiS_HDE >> 4; /* BDxWadroff = HDE*4/8/8 */
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x45,~0x0FF,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x3F,0x00); /* BDxWadrst0 */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x3E,0x00);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x3D,0x10);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x3C,~0x040,0x00);
+ tempax = SiS_Pr->SiS_HDE >> 4; /* BDxWadroff = HDE*4/8/8 */
pushcx = tempax;
temp = tempax & 0x00FF;
- SiS_SetReg1(SiS_Part1Port,0x43,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x43,temp);
temp = ((tempax & 0xFF00) >> 8) << 3;
- SiS_SetRegANDOR(SiS_Part1Port,0x44,~0x0F8,temp);
- tempax = SiS_VDE; /*BDxWadrst1 = BDxWadrst0 + BDxWadroff * VDE */
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x44,~0x0F8,temp);
+ tempax = SiS_Pr->SiS_VDE; /*BDxWadrst1 = BDxWadrst0 + BDxWadroff * VDE */
tempeax = (tempax * pushcx);
tempebx = 0x00100000 + tempeax;
temp = (USHORT)tempebx & 0x000000FF;
- SiS_SetReg1(SiS_Part1Port,0x42,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x42,temp);
temp = (USHORT)((tempebx & 0x0000FF00)>>8);
- SiS_SetReg1(SiS_Part1Port,0x41,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x41,temp);
temp = (USHORT)((tempebx & 0x00FF0000)>>16);
- SiS_SetReg1(SiS_Part1Port,0x40,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x40,temp);
temp = (USHORT)(((tempebx & 0x01000000)>>24) << 7);
- SiS_SetRegANDOR(SiS_Part1Port,0x3C,~0x080,temp);
- SiS_SetReg1(SiS_Part1Port,0x2F,0x03);
- SiS_SetReg1(SiS_Part1Port,0x03,0x50);
- SiS_SetReg1(SiS_Part1Port,0x04,0x00);
- SiS_SetReg1(SiS_Part1Port,0x2F,0x01);
- SiS_SetReg1(SiS_Part1Port,0x13,0x00);
- SiS_SetReg1(SiS_P3c4,0x05,0x86); /* Unlock */
- SiS_SetReg1(SiS_P3c4,0x1e,0x62);
- if(SiS_IF_DEF_FSTN){
- SiS_SetReg1(SiS_P3c4,0x2b,0x1b);
- SiS_SetReg1(SiS_P3c4,0x2c,0xe3);
- SiS_SetReg1(SiS_P3c4,0x1e,0x62);
- SiS_SetReg1(SiS_P3c4,0x2e,0x04);
- SiS_SetReg1(SiS_P3c4,0x2f,0x42);
- SiS_SetReg1(SiS_P3c4,0x32,0x01);
- SiS_SetReg1(SiS_Part1Port,0x2b,0x02);
- SiS_SetReg1(SiS_Part1Port,0x2c,0x00);
- SiS_SetReg1(SiS_Part1Port,0x2d,0x00);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x3C,~0x080,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x2F,0x03);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x03,0x50);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x04,0x00);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x2F,0x01);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x13,0x00);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x05,0x86); /* Unlock */
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1e,0x62);
+ if(SiS_Pr->SiS_IF_DEF_FSTN){
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2b,0x1b);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2c,0xe3);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1e,0x62);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2e,0x04);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2f,0x42);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x32,0x01);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x2b,0x02);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x2c,0x00);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x2d,0x00);
}
- SiS_SetRegANDOR(SiS_Part1Port,0x19,0x0f,0x30);
- SiS_SetReg1(SiS_Part1Port,0x1e,0x7d);
- SiS_SetReg1(SiS_Part1Port,0x2e,0xe0);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0x0f,0x30);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1e,0x7d);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x2e,0xe0);
}
+#endif /* SIS315H */
return;
@@ -1464,302 +1587,346 @@ SiS_SetGroup1_LVDS(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,
#ifdef SIS315H
void
-SiS_CRT2AutoThreshold(USHORT BaseAddr)
+SiS_CRT2AutoThreshold(SiS_Private *SiS_Pr, USHORT BaseAddr)
{
- SiS_SetRegOR(SiS_Part1Port,0x01,0x40);
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x01,0x40);
}
#endif
-/* TW: For LVDS / 302b/lv - LCDA (this must only be called on 310/325 series!) */
-/* TW: Double-checked against 650/LVDS and 650/301 BIOS */
+/* TW: For LVDS / 302B/30xLV - LCDA (this must only be called on 310/325 series!) */
void
-SiS_SetGroup1_LCDA(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+SiS_SetGroup1_LCDA(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT RefreshRateTableIndex)
{
USHORT modeflag,resinfo;
USHORT push1,push2,tempax,tempbx,tempcx,temp;
ULONG tempeax=0,tempebx,tempecx,tempvcfact;
- if(SiS_IF_DEF_LVDS == 1) /* TW: From 650/LVDS BIOS */
- SiS_SetRegANDOR(SiS_Part1Port,0x13,0xfb,0x04); /* TW: From 650/LVDS BIOS */
+ if(IS_SIS330) {
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2D,0x10); /* From Xabre 1.01.03 */
+ } else if(IS_SIS740) {
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2D,0x10); /* From 740/301LV 1.10.1i */
+ } else {
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { /* TW: From 650/LVDS BIOS */
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,0xfb,0x04); /* TW: From 650/LVDS BIOS */
+ }
- if(SiS_IF_DEF_LVDS == 1) /* TW: From 650/LVDS 1.10.07 */
- SiS_SetRegOR(SiS_Part1Port,0x2D,0x00); /* TW: From 650/LVDS 1.10.07 */
- else
- SiS_SetRegOR(SiS_Part1Port,0x2D,0x20);
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { /* TW: From 650/LVDS 1.10.07 */
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2D,0x00); /* TW: From 650/LVDS 1.10.07 */
+ } else {
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2D,0x0f); /* TW: From 650/30xLv 1.10.6s */
+ }
+ }
- if(ModeNo<=0x13) {
- modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
- resinfo = SiS_SModeIDTable[ModeIdIndex].St_ResInfo;
+ if(ModeNo <= 0x13) {
+ modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
+ resinfo = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo;
} else {
- modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
- resinfo = SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
+ modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
}
- tempax = SiS_LCDHDES;
- tempbx = SiS_HDE;
- tempcx = SiS_HT;
-
- if(SiS_LCDInfo & LCDNonExpanding) {
- if(SiS_LCDResInfo == Panel1280x1024) tempbx = 1280;
- else if(SiS_LCDResInfo == Panel1024x768) tempbx = 1024;
- else tempbx = 1400; /* TW: From 650/LVDS BIOS; OK with 650/301 */
+ tempax = SiS_Pr->SiS_LCDHDES;
+ tempbx = SiS_Pr->SiS_HDE;
+ tempcx = SiS_Pr->SiS_HT;
+
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) {
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) tempbx = 1024;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) tempbx = 1400;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) tempbx = 1600;
+ else tempbx = 1280;
}
- tempcx = tempcx - tempbx; /* HT-HDE */
+ tempcx -= tempbx; /* HT-HDE */
push1 = tempax;
- tempax = tempax + tempbx; /* lcdhdee */
- tempbx = SiS_HT;
- if(tempax >= tempbx) tempax = tempax-tempbx;
- push2=tempax;
- /* push ax lcdhdee */
- tempcx >>= 2; /* temp */
- tempcx = tempcx + tempax; /* lcdhrs */
- if(tempcx >= tempbx) tempcx = tempcx - tempbx;
+ tempax += tempbx; /* lcdhdee */
+ tempbx = SiS_Pr->SiS_HT;
+ if(tempax >= tempbx) tempax -= tempbx;
+
+ push2 = tempax; /* push ax lcdhdee */
+
+ tempcx >>= 2;
+
+ if(IS_SIS650) {
+ /* TW: Inserted from 650/30xLV 1.10.6s */
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) {
+ if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) {
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) tempcx = 0x28;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) tempcx = 0x18;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) tempcx = 0x30;
+ else tempcx = 0x30;
+ }
+ }
+ }
+
+ tempcx += tempax; /* lcdhrs */
+ if(tempcx >= tempbx) tempcx -= tempbx;
/* v ah,cl */
tempax = tempcx;
- tempax = tempax >> 3; /* BPLHRS */
+ tempax >>= 3; /* BPLHRS */
temp = tempax & 0x00FF;
- SiS_SetReg1(SiS_Part1Port,0x14,temp); /* Part1_14h */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x14,temp); /* Part1_14h */
- temp = (tempax & 0x00FF) + 10;
- temp = temp & 0x01F;
- temp = temp | (((tempcx & 0x00ff) & 0x07) << 5);
- SiS_SetReg1(SiS_Part1Port,0x15,temp); /* Part1_15h */
+ temp += 10;
+ temp &= 0x1F;
+ temp |= ((tempcx & 0x07) << 5);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x15,temp); /* Part1_15h */
tempbx = push2; /* lcdhdee */
tempcx = push1; /* lcdhdes */
temp = (tempcx & 0x00FF);
- temp = temp & 0x07; /* BPLHDESKEW */
- SiS_SetReg1(SiS_Part1Port,0x1A,temp); /* Part1_1Ah */
+ temp &= 0x07; /* BPLHDESKEW */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1A,temp); /* Part1_1Ah */
- tempcx = tempcx >> 3; /* BPLHDES */
- temp = (tempcx & 0x00FF);
- SiS_SetReg1(SiS_Part1Port,0x16,temp); /* Part1_16h */
+ tempcx >>= 3; /* BPLHDES */
+ temp = tempcx & 0x00FF;
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x16,temp); /* Part1_16h */
if(tempbx & 0x07) tempbx += 8;
tempbx >>= 3; /* BPLHDEE */
temp = tempbx & 0x00FF;
- SiS_SetReg1(SiS_Part1Port,0x17,temp); /* Part1_17h */
-
- tempcx = SiS_VGAVT;
- tempbx = SiS_VGAVDE;
- tempcx = tempcx-tempbx; /* GAVT-VGAVDE */
- tempbx = SiS_LCDVDES; /* VGAVDES */
- push1 = tempbx; /* push bx temppush1 */
- if(SiS_IF_DEF_TRUMPION == 0){
- if(SiS_LCDResInfo == Panel1024x768) tempax = 768;
- if(SiS_LCDResInfo == Panel1280x1024) tempax = 1024;
- if(SiS_LCDResInfo == Panel1400x1050) tempax = 1050; /* TW: Inserted from 650/LVDS BIOS */
- else tempax = 960; /* TW: Inserted from 650/301 BIOS */
-#if 0 /* TW: Removed (650/LVDS BIOS) */
- if(SiS_IF_DEF_CH70xx == 1) {
- if(SiS_VBInfo & SetCRT2ToTV) {
- tempax = SiS_VGAVDE;
- }
- }
-#endif
- } else tempax = SiS_VGAVDE; /* Trumpion */
- tempbx = tempbx + tempax;
- tempax = SiS_VT; /* VT */
- if(tempbx >= SiS_VT) tempbx = tempbx - tempax;
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x17,temp); /* Part1_17h */
+
+ tempcx = SiS_Pr->SiS_VGAVT;
+ tempbx = SiS_Pr->SiS_VGAVDE;
+ tempcx -= tempbx; /* GAVT-VGAVDE */
+ tempbx = SiS_Pr->SiS_LCDVDES; /* VGAVDES */
+ push1 = tempbx;
+ if(SiS_Pr->SiS_IF_DEF_TRUMPION == 0){
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) tempax = 768;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x768) tempax = 768;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) tempax = 1024;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) tempax = 1050;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) tempax = 1200;
+ else tempax = 960;
+ } else tempax = SiS_Pr->SiS_VGAVDE; /* Trumpion */
+
+ tempbx += tempax;
+ tempax = SiS_Pr->SiS_VT; /* VT */
+ if(tempbx >= tempax) tempbx -= tempax;
+
+ push2 = tempbx;
+
+ tempcx >>= 2;
+
+ if(IS_SIS650) {
+ /* TW: Inserted from 650/30xLV 1.10.6s */
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) {
+ if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) {
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) tempcx = 1;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) tempcx = 3;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x768) tempcx = 3;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) tempcx = 1;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) tempcx = 1;
+ else tempcx = 0x0057;
+ }
+ }
+ }
- push2 = tempbx; /* push bx temppush2 */
- tempcx >>= 1;
- tempbx = tempbx + tempcx;
+ tempbx += tempcx;
tempbx++; /* BPLVRS */
- if(tempbx >= tempax) tempbx = tempbx - tempax;
- temp = tempbx&0x00FF;
- SiS_SetReg1(SiS_Part1Port,0x18,temp); /* Part1_18h */
+ if(tempbx >= tempax) tempbx -= tempax;
+ temp = tempbx & 0x00FF;
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x18,temp); /* Part1_18h */
tempcx >>= 3;
- tempcx = tempcx + tempbx;
+ tempcx += tempbx;
tempcx++; /* BPLVRE */
temp = tempcx & 0x00FF;
temp &= 0x0F;
- if(SiS_IF_DEF_LVDS == 1) {
- SiS_SetRegANDOR(SiS_Part1Port,0x19,0xf0,temp); /* TW: Inserted from 650/LVDS BIOS */
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
+ /* TW: Inserted from 650/LVDS BIOS */
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0xF0,temp);
} else {
- temp |= 0x30; /* TW: Inserted from 650/301 BIOS */
- SiS_SetRegANDOR(SiS_Part1Port,0x19,0xC0,temp); /* Part1_19h (Was ~0x0f) */
+ /* TW: Inserted from 650/30xLV 1.10.6s, Xabre */
+ temp |= 0xC0;
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0xF0,temp); /* Part1_19h */
}
temp = (tempbx & 0xFF00) >> 8;
temp &= 0x07;
temp <<= 3; /* BPLDESKEW =0 */
- tempbx = SiS_VGAVDE;
- if(tempbx != SiS_VDE) temp |= 0x40;
- if(SiS_SetFlag & EnableLVDSDDA) temp |= 0x40;
- if(SiS_IF_DEF_LVDS == 1) {
- if(SiS_LCDInfo & LCDRGB18Bit) temp |= 0x80; /* TW: 650/301 BIOS does not check this! */
- SiS_SetRegANDOR(SiS_Part1Port,0x1A,0x87,temp); /* Part1_1Ah */
+ tempbx = SiS_Pr->SiS_VGAVDE;
+ if(tempbx != SiS_Pr->SiS_VDE) temp |= 0x40;
+ if(SiS_Pr->SiS_SetFlag & EnableLVDSDDA) temp |= 0x40;
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
+ /* TW: Inserted from 650/LVDS 1.10.07 */
+ if(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit) temp |= 0x80;
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x1A,0x87,temp); /* Part1_1Ah */
} else {
- SiS_SetRegANDOR(SiS_Part1Port,0x1A,0x07,temp); /* Part1_1Ah */
+ if(IS_SIS650) {
+ /* TW: Inserted from 650/30xLV 1.10.6s */
+ if(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit) {
+ if(SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x00) & 0x01) temp |= 0x80;
+ }
+ } else {
+ if(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit) temp |= 0x80;
+ }
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x1A,0x87,temp); /* Part1_1Ah */
}
- tempbx = push2; /* p bx temppush2 BPLVDEE */
- tempcx = push1; /* pop cx temppush1 NPLVDES */
+ tempbx = push2; /* BPLVDEE */
+ tempcx = push1; /* NPLVDES */
push1 = (USHORT)(tempeax & 0xFFFF);
- if(!(SiS_VBInfo & SetInSlaveMode)) {
- if(SiS_LCDResInfo == Panel800x600) {
+ if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) {
if(resinfo == 7) tempcx++;
}
- if(SiS_IF_DEF_LVDS == 0) { /* TW: Inserted from 650/LVDS BIOS */
- if(resinfo == 8) tempcx++; /* TW: Modified according to 650/301 BIOSes */
- }
- if(SiS_LCDResInfo == Panel640x480) { /* TW: Inserted from 650/301+LVDS BIOSes */
- tempbx = SiS_VGAVDE; /* TW: Inserted from 650/301+LVDS BIOS */
- tempcx = tempbx; /* TW: Inserted from 650/301+LVDS BIOS */
- tempbx--; /* TW: Inserted from 650/301+LVDS BIOS */
- }
+ }
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480) {
+ tempbx = SiS_Pr->SiS_VGAVDE;
+ tempcx = tempbx;
+ tempbx--;
}
temp = (tempbx & 0xFF00) >> 8;
temp &= 0x07;
temp <<= 3;
temp = temp | (((tempcx & 0xFF00) >> 8) & 0x07);
- SiS_SetReg1(SiS_Part1Port,0x1D,temp); /* Part1_1Dh */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1D,temp); /* Part1_1Dh */
temp = tempbx & 0x00FF;
- SiS_SetReg1(SiS_Part1Port,0x1C,temp); /* Part1_1Ch */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1C,temp); /* Part1_1Ch */
temp = tempcx & 0x00FF;
- SiS_SetReg1(SiS_Part1Port,0x1B,temp); /* Part1_1Bh */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1B,temp); /* Part1_1Bh */
- tempecx = SiS_VGAVT;
- tempebx = SiS_VDE;
- tempeax = SiS_VGAVDE;
- tempecx = tempecx-tempeax; /* VGAVT-VGAVDE */
+ tempecx = SiS_Pr->SiS_VGAVT;
+ tempebx = SiS_Pr->SiS_VDE;
+ tempeax = SiS_Pr->SiS_VGAVDE;
+ tempecx -= tempeax; /* VGAVT-VGAVDE */
tempeax <<= 18;
temp = (USHORT)(tempeax % tempebx);
tempeax = tempeax / tempebx;
- if(temp != 0) tempeax++;
+ if(temp) tempeax++;
tempebx = tempeax; /* BPLVCFACT */
tempvcfact = tempeax;
- temp=(USHORT)(tempebx & 0x00FF);
- SiS_SetReg1(SiS_Part1Port,0x37,temp);
+ temp = (USHORT)(tempebx & 0x00FF);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x37,temp);
- temp=(USHORT)((tempebx & 0x00FF00) >> 8);
- SiS_SetReg1(SiS_Part1Port,0x36,temp);
+ temp = (USHORT)((tempebx & 0x00FF00) >> 8);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x36,temp);
temp = (USHORT)((tempebx & 0x00030000) >> 16);
- if(SiS_VDE==SiS_VGAVDE) temp |= 0x04;
- SiS_SetReg1(SiS_Part1Port,0x35,temp);
-
- tempecx = SiS_VGAHDE;
- tempebx = SiS_HDE;
+ if(SiS_Pr->SiS_VDE == SiS_Pr->SiS_VGAVDE) temp |= 0x04;
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x35,temp);
+
+ tempecx = SiS_Pr->SiS_VGAHDE;
+ tempebx = SiS_Pr->SiS_HDE;
tempeax = tempecx;
tempeax <<= 16;
+ temp = tempeax % tempebx;
tempeax = tempeax / tempebx;
+ if(temp) tempeax++;
if(tempebx == tempecx) tempeax = 0xFFFF;
tempecx = tempeax;
- tempeax = SiS_VGAHDE;
+ tempeax = SiS_Pr->SiS_VGAHDE;
tempeax <<= 16;
tempeax = tempeax / tempecx;
tempecx <<= 16;
tempeax--;
tempecx = tempecx | (tempeax & 0xFFFF);
- temp=(USHORT)(tempecx & 0x00FF);
- SiS_SetReg1(SiS_Part1Port,0x1F,temp); /* Part1_1Fh */
+ temp = (USHORT)(tempecx & 0x00FF);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1F,temp); /* Part1_1Fh */
- tempeax = SiS_VGAVDE;
+ tempeax = SiS_Pr->SiS_VGAVDE;
tempeax <<= 18;
tempeax = tempeax / tempvcfact;
tempbx = (USHORT)(tempeax & 0x0FFFF);
- if(SiS_LCDResInfo == Panel1024x768) tempbx--;
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) tempbx--;
- if(SiS_SetFlag & EnableLVDSDDA) tempbx = 1;
+ if(SiS_Pr->SiS_SetFlag & EnableLVDSDDA) tempbx = 1;
temp = ((tempbx & 0xFF00) >> 8) << 3;
temp = temp | (USHORT)(((tempecx & 0x0000FF00) >> 8) & 0x07);
- SiS_SetReg1(SiS_Part1Port,0x20,temp); /* Part1_20h */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x20,temp); /* Part1_20h */
temp = tempbx & 0x00FF;
- SiS_SetReg1(SiS_Part1Port,0x21,temp); /* Part1_21h */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x21,temp); /* Part1_21h */
tempecx >>= 16; /* BPLHCFACT */
- if(!(modeflag & HalfDCLK)) tempecx >>= 1; /* TW: Inserted from BIOS */
- temp=(USHORT)((tempecx & 0x0000FF00) >> 8);
- SiS_SetReg1(SiS_Part1Port,0x22,temp); /* Part1_22h */
+ if(modeflag & HalfDCLK) tempecx >>= 1;
+ temp = (USHORT)((tempecx & 0x0000FF00) >> 8);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x22,temp); /* Part1_22h */
temp=(USHORT)(tempecx & 0x000000FF);
- SiS_SetReg1(SiS_Part1Port,0x23,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x23,temp);
+
+#if 0
+ /* TW: Missing code (calles int 2f) (650/302LV 1.10.6s; 1.10.7w doesn't do this) */
+ if(xxx()) {
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x0e,0xda);
+ }
+#endif
/* TW: Only for 650/LVDS and 301LV/302LV */
- if((SiS_IF_DEF_LVDS == 1) || (SiS_VBInfo & (VB_SIS301LV|VB_SIS302LV))){
- SiS_SetReg1(SiS_Part1Port,0x1e,0x20);
+ if((SiS_Pr->SiS_IF_DEF_LVDS == 1) || (SiS_Pr->SiS_VBInfo & VB_SIS301LV302LV)){
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1e,0x20);
}
return;
}
-/* TW: Double-checked against 650/LVDS (1.10.07) and 650/301 BIOS */
-void SiS_SetCRT2Offset(USHORT SiS_Part1Port,UCHAR *ROMAddr,USHORT ModeNo,
+void SiS_SetCRT2Offset(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,
USHORT ModeIdIndex ,USHORT RefreshRateTableIndex,
PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
USHORT offset;
UCHAR temp;
- if(SiS_VBInfo & SetInSlaveMode) return;
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) return;
- offset = SiS_GetOffset(ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
+ offset = SiS_GetOffset(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
HwDeviceExtension);
+#if 0
+ if(SiS_Pr->LCDResInfo == 13) offset >>= 1;
+ if(SiS_Pr->LCDResInfo == 12) offset >>= 1;
+#endif
temp = (UCHAR)(offset & 0xFF);
- SiS_SetReg1(SiS_Part1Port,0x07,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x07,temp);
temp = (UCHAR)((offset & 0xFF00) >> 8);
- SiS_SetReg1(SiS_Part1Port,0x09,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x09,temp);
temp = (UCHAR)(((offset >> 3) & 0xFF) + 1);
- SiS_SetReg1(SiS_Part1Port,0x03,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x03,temp);
}
-/* TW: Checked with 650/LVDS and 650/301 BIOS */
USHORT
-SiS_GetOffset(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+SiS_GetOffset(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
USHORT temp,colordepth;
USHORT modeinfo,index,infoflag;
- USHORT mode960low, mode960high;
-#if 0
- USHORT ColorDepth[] = { 0x01, 0x02, 0x04 };
-#endif
- modeinfo = SiS_EModeIDTable[ModeIdIndex].Ext_ModeInfo;
- infoflag = SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag;
- if (HwDeviceExtension->jChipType < SIS_315H ) {
- index = (modeinfo >> 4) & 0xFF;
- /* TW: Modes 1280x960 changed number, so this is redundant */
- mode960low = 0x7c;
- mode960high = 0x7e;
+ if(SiS_Pr->UseCustomMode) {
+ infoflag = SiS_Pr->CInfoFlag;
+ temp = SiS_Pr->CHDisplay / 16;
} else {
- index = (modeinfo >> 8) & 0xFF; /* TW: In 650 BIOS (LVDS AND 301), 1280x960 modes are 7b-7d! */
- mode960low = 0x7c; /* TW: This is a bug in both BIOS versions ! */
- mode960high = 0x7e; /* TW: Corrected here in LVDS BIOS 1.10.07, but not in tables! */
- }
+ infoflag = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag;
+ modeinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeInfo;
+
+ if(HwDeviceExtension->jChipType < SIS_315H ) {
+ index = (modeinfo >> 4) & 0xFF;
+ } else {
+ index = (modeinfo >> 8) & 0xFF;
+ }
-#if 0
- /* TW: Not doing this strange stuff makes 1280x960 at least work on CRT1 */
- if((ModeNo >= mode960low) && (ModeNo <= mode960high)) {
- temp = ModeNo - mode960low;
- colordepth = ColorDepth[temp];
- temp = 0x6b; /* TW: Why the heck? */
- } else {
-#endif
- temp = SiS_ScreenOffset[index];
- colordepth = SiS_GetColorDepth(ROMAddr,ModeNo,ModeIdIndex);
-#if 0
+ temp = SiS_Pr->SiS_ScreenOffset[index];
}
-#endif
+
+ colordepth = SiS_GetColorDepth(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex);
if(infoflag & InterlaceMode) temp <<= 1;
temp *= colordepth;
- /* TW: Added this entire "if"-section from 650/LVDS BIOS */
- if((ModeNo >= 0x26) && (ModeNo <= 0x28)) {
+ /* TW: For 1400x1050 and 856x480 */
+ if( ( ((ModeNo >= 0x26) && (ModeNo <= 0x28)) ||
+ ModeNo == 0x3f ||
+ ModeNo == 0x42 ||
+ ModeNo == 0x45 ) ||
+ (SiS_Pr->UseCustomMode && (SiS_Pr->CHDisplay % 16)) ) {
colordepth >>= 1;
temp += colordepth;
}
@@ -1767,93 +1934,161 @@ SiS_GetOffset(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
return(temp);
}
-/* Checked with 650/LVDS BIOS */
USHORT
-SiS_GetColorDepth(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex)
+SiS_GetColorDepth(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex)
{
USHORT ColorDepth[6] = { 1, 2, 4, 4, 6, 8};
SHORT index;
USHORT modeflag;
- if(ModeNo <= 0x13)
- modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
- else
- modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ if(SiS_Pr->UseCustomMode) {
+ modeflag = SiS_Pr->CModeFlag;
+ } else {
+ if(ModeNo <= 0x13)
+ modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
+ else
+ modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ }
index = (modeflag & ModeInfoFlag) - ModeEGA;
if(index < 0) index = 0;
return(ColorDepth[index]);
}
-/* TW: Checked against 650/LVDS (1.10.07), 650/301 and 630/301B BIOS */
void
-SiS_SetCRT2Sync(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,
+SiS_SetCRT2Sync(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,
USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
USHORT tempah=0,tempbl,infoflag,flag;
flag = 0;
- tempbl = 0xC0; /* TW: Severe BIOS bug in all BIOSes except 650/LVDS 1.10.07 */
+ tempbl = 0xC0;
+
+ infoflag = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag;
- infoflag = SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag;
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { /* LVDS */
- if(SiS_IF_DEF_LVDS == 1) { /* LVDS */
- if(SiS_VBInfo & SetCRT2ToLCD) {
- tempah = SiS_LCDInfo;
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ tempah = SiS_Pr->SiS_LCDInfo;
if(HwDeviceExtension->jChipType >= SIS_315H) {
- tempbl = tempah & 0xc0;
+ tempbl = tempah & 0xc0;
}
- if(SiS_LCDInfo & LCDSync) {
- flag = 1;
+ if(SiS_Pr->SiS_LCDInfo & LCDSync) {
+ flag = 1;
}
}
- } else if ( (HwDeviceExtension->jChipType < SIS_315H) && /* 630/301B */
- (SiS_VBType & VB_SIS301BLV302BLV) ) {
- if(SiS_VBInfo & SetCRT2ToLCD) {
- tempah = SiS_LCDInfo;
- if(SiS_LCDInfo & LCDSync) {
- flag = 1;
- }
- }
- } else if (HwDeviceExtension->jChipType < SIS_315H) { /* 630/301 */
- if(SiS_VBInfo & SetCRT2ToLCD) {
- tempah = SiS_LCDInfo;
- if(SiS_LCDInfo & LCDNonExpandingShift) {
- flag = 1;
- }
- }
- }
+ if(flag != 1) tempah = infoflag >> 8;
+ tempah &= 0xC0;
+
+ tempah |= 0x20;
+ if(!(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit)) tempah |= 0x10;
+
+ if (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480) {
+ /* TW: BIOS does something here @@@ */
+ }
- if(flag != 1) tempah = infoflag >> 8;
+ tempah &= 0x3f;
+ tempah |= tempbl;
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0x0F,tempah);
- tempah &= 0xC0;
- tempah |= 0x20;
+ } else {
- if(!(SiS_LCDInfo & LCDRGB18Bit)) tempah |= 0x10;
+ if(HwDeviceExtension->jChipType < SIS_315H) {
- if (SiS_LCDResInfo == Panel640x480) {
- /* TW: BIOS does something here (301, 301LV and LVDS) @@@ */
- }
+#ifdef SIS300 /* ---- 300 series --- */
- if(!(SiS_VBType & VB_SIS301)) {
- tempah &= 0x3f;
- tempah |= tempbl;
- }
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { /* 630 - 301B(-DH) */
+
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ tempah = SiS_Pr->SiS_LCDInfo;
+ if(SiS_Pr->SiS_LCDInfo & LCDSync) {
+ flag = 1;
+ }
+ }
+ if(flag != 1) tempah = infoflag >> 8;
+ tempah &= 0xC0;
+
+ tempah |= 0x20;
+ if(!(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit)) tempah |= 0x10;
+
+ if (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480) {
+ /* TW: BIOS does something here @@@ */
+ }
+
+ tempah &= 0x3f;
+ tempah |= tempbl;
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0x0F,tempah);
+
+ } else { /* 630 - 301 */
+
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ tempah = SiS_Pr->SiS_LCDInfo;
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCDShift) { /* ! */
+ flag = 1;
+ }
+ }
+ if(flag != 1) tempah = infoflag >> 8;
+ tempah &= 0xC0;
+ tempah |= 0x30;
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0x3F,tempah);
+
+ }
+
+#endif /* SIS300 */
+
+ } else {
- SiS_SetRegANDOR(SiS_Part1Port,0x19,0x3F,tempah);
+#ifdef SIS315H /* ----- 310/325 series ---- */
+
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) { /* 310/325 - 30xLV */
+
+ tempah = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x37);
+ tempah &= 0xC0;
+ tempah |= 0x20;
+ if(!(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit)) tempah |= 0x10;
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0x0F,tempah);
+
+ } else { /* 310/325 - 301, 301B */
+
+ tempah = infoflag >> 8;
+ tempah &= 0xC0;
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ if(SiS_Pr->SiS_LCDInfo & LCDSync) {
+ tempah = SiS_Pr->SiS_LCDInfo;
+ tempah &= 0xC0;
+ }
+ }
+
+ tempah |= 0x20;
+ if(!(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit)) tempah |= 0x10;
+#if 0
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480) {
+ /* TW: BIOS does something here @@@ */
+ }
+#endif
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0x0F,tempah);
+
+ }
+
+#endif /* SIS315H */
+ }
+ }
}
-/* TW: Set FIFO on 300 series */
-/* TW: Checked against 630/301B BIOS; does not set PCI registers */
+/* TW: Set CRT2 FIFO on 300/630/730 */
+#ifdef SIS300
void
-SiS_SetCRT2FIFO_300(UCHAR *ROMAddr,USHORT ModeNo,
+SiS_SetCRT2FIFO_300(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,
PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
USHORT temp,index;
USHORT modeidindex,refreshratetableindex;
- USHORT VCLK,MCLK,colorth=0,data2;
+ USHORT VCLK=0,MCLK,colorth=0,data2=0;
+ USHORT tempal, tempah, tempbx, tempcl, tempax;
+ USHORT CRT1ModeNo,CRT2ModeNo;
+ USHORT SelectRate_backup;
ULONG data,eax;
- UCHAR LatencyFactor[] = {
+ const UCHAR LatencyFactor[] = {
97, 88, 86, 79, 77, 00, /*; 64 bit BQ=2 */
00, 87, 85, 78, 76, 54, /*; 64 bit BQ=1 */
97, 88, 86, 79, 77, 00, /*; 128 bit BQ=2 */
@@ -1861,88 +2096,247 @@ SiS_SetCRT2FIFO_300(UCHAR *ROMAddr,USHORT ModeNo,
80, 72, 69, 63, 61, 00, /*; 64 bit BQ=2 */
00, 70, 68, 61, 59, 37, /*; 64 bit BQ=1 */
86, 77, 75, 68, 66, 00, /*; 128 bit BQ=2 */
- 00, 68, 66, 59, 57, 37}; /*; 128 bit BQ=1 */
-
- SiS_SearchModeID(ROMAddr,&ModeNo,&modeidindex);
- SiS_SetFlag &= (~ProgrammingCRT2);
- SiS_SelectCRT2Rate = 0;
- refreshratetableindex = SiS_GetRatePtrCRT2(ROMAddr,ModeNo,modeidindex);
-
- if(ModeNo >= 0x13) {
- index = SiS_RefIndex[refreshratetableindex].Ext_CRTVCLK;
- index &= 0x3F;
- VCLK = SiS_VCLKData[index].CLOCK;
- index = SiS_GetReg1(SiS_P3c4,0x1A);
+ 00, 68, 66, 59, 57, 37 /*; 128 bit BQ=1 */
+ };
+ const UCHAR LatencyFactor730[] = {
+ 69, 63, 61,
+ 86, 79, 77,
+ 103, 96, 94,
+ 120,113,111,
+ 137,130,128, /* <-- last entry, data below */
+ 137,130,128, /* to avoid using illegal values */
+ 137,130,128,
+ 137,130,128,
+ 137,130,128,
+ 137,130,128,
+ 137,130,128,
+ 137,130,128,
+ 137,130,128,
+ 137,130,128,
+ 137,130,128,
+ 137,130,128,
+ };
+ const UCHAR ThLowB[] = {
+ 81, 4, 72, 6, 88, 8,120,12,
+ 55, 4, 54, 6, 66, 8, 90,12,
+ 42, 4, 45, 6, 55, 8, 75,12
+ };
+ const UCHAR ThTiming[] = {
+ 1, 2, 2, 3, 0, 1, 1, 2
+ };
+
+ SelectRate_backup = SiS_Pr->SiS_SelectCRT2Rate;
+
+ if(!SiS_Pr->CRT1UsesCustomMode) {
+
+ CRT1ModeNo = SiS_Pr->SiS_CRT1Mode; /* get CRT1 ModeNo */
+ SiS_SearchModeID(SiS_Pr,ROMAddr,&CRT1ModeNo,&modeidindex);
+ SiS_Pr->SiS_SetFlag &= (~ProgrammingCRT2);
+ SiS_Pr->SiS_SelectCRT2Rate = 0;
+ refreshratetableindex = SiS_GetRatePtrCRT2(SiS_Pr,ROMAddr,CRT1ModeNo,
+ modeidindex,HwDeviceExtension);
+
+ if(CRT1ModeNo >= 0x13) {
+ index = SiS_Pr->SiS_RefIndex[refreshratetableindex].Ext_CRTVCLK;
+ index &= 0x3F;
+ VCLK = SiS_Pr->SiS_VCLKData[index].CLOCK; /* Get VCLK */
+ data2 = SiS_Pr->SiS_ModeType - 2;
+ }
+
+ } else {
+
+ CRT1ModeNo = 0xfe;
+ VCLK = SiS_Pr->CSRClock; /* Get VCLK */
+ data2 = (SiS_Pr->CModeFlag & ModeInfoFlag) - 2;
+
+ }
+
+ if(CRT1ModeNo >= 0x13) {
+ if(HwDeviceExtension->jChipType == SIS_300) {
+ index = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x3A);
+ } else {
+ index = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1A);
+ }
index &= 0x07;
- MCLK = SiS_MCLKData_0[index].CLOCK;
- data2 = SiS_ModeType - 0x02;
- switch (data2) {
+ MCLK = SiS_Pr->SiS_MCLKData_0[index].CLOCK; /* Get MCLK */
+
+#ifdef TWDEBUG
+ xf86DrvMsg(0, X_INFO, "FIFO2: CRT1Mode 0x%x VCLK %d MCLK %d modetype-2 = %d\n",
+ CRT1ModeNo, VCLK, MCLK, data2);
+#endif
+
+ switch(data2) { /* Get color depth */
case 0 : colorth = 1; break;
case 1 : colorth = 1; break;
case 2 : colorth = 2; break;
case 3 : colorth = 2; break;
case 4 : colorth = 3; break;
case 5 : colorth = 4; break;
+ default: colorth = 2; break;
}
- /* data2=(data2*VCLK)/MCLK; */ /* bx */
- data2 = (colorth * VCLK) / MCLK; /* TW */
+ data2 = (colorth * VCLK) / MCLK;
- temp = SiS_GetReg1(SiS_P3c4,0x14);
- temp = ((temp&0x00FF)>>6)<<1;
- if(temp == 0) temp=1;
+ temp = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14);
+ temp = ((temp & 0x00FF) >> 6) << 1;
+ if(temp == 0) temp = 1;
temp <<= 2;
+ temp &= 0xff;
data2 = temp - data2;
+
+#ifdef TWDEBUG
+ xf86DrvMsg(0, X_INFO, "FIFO2: data2 (step1) = %d\n",
+ data2);
+#endif
-/* if(data2%(28*16)) { TW: WRONG
- data2=data2/(28*16);
- data2++;
- } else {
- data2=data2/(28*16);
- } */
- if((28*16) % data2) { /* TW */
+ if((28 * 16) % data2) {
data2 = (28 * 16) / data2;
data2++;
} else {
data2 = (28 * 16) / data2;
}
+
+#ifdef TWDEBUG
+ xf86DrvMsg(0, X_INFO, "FIFO2: data2 (step2) = %d\n",
+ data2);
+#endif
- index = 0;
- temp = SiS_GetReg1(SiS_P3c4,0x14);
- if(temp & 0x0080) index += 12;
+ if(HwDeviceExtension->jChipType == SIS_300) {
+
+ tempah = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x18);
+ tempah &= 0x62;
+ tempah >>= 1;
+ tempal = tempah;
+ tempah >>= 3;
+ tempal |= tempah;
+ tempal &= 0x07;
+ tempcl = ThTiming[tempal];
+ tempbx = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16);
+ tempbx >>= 6;
+ tempah = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14);
+ tempah >>= 4;
+ tempah &= 0x0c;
+ tempbx |= tempah;
+ tempbx <<= 1;
+ tempal = ThLowB[tempbx + 1];
+ tempal *= tempcl;
+ tempal += ThLowB[tempbx];
+ data = tempal;
+
+ } else if(HwDeviceExtension->jChipType == SIS_730) {
+
+#ifndef LINUX_XF86
+ SiS_SetReg4(0xcf8,0x80000050);
+ eax = SiS_GetReg3(0xcfc);
+#else
+ eax = pciReadLong(0x00000000, 0x50);
+#endif
+ tempal = (USHORT)(eax >> 8);
+ tempal &= 0x06;
+ tempal <<= 5;
#ifndef LINUX_XF86
- SiS_SetReg4(0xcf8,0x800000A0);
- eax=SiS_GetReg3(0xcfc);
+ SiS_SetReg4(0xcf8,0x800000A0);
+ eax = SiS_GetReg3(0xcfc);
#else
- /* TW: We use pci functions X offers. We use tag 0, because
- * we want to read/write to the host bridge (which is always
- * 00:00.0 on 630, 730 and 540), not the VGA device.
- */
- eax = pciReadLong(0x00000000, 0xA0);
+ eax = pciReadLong(0x00000000, 0xA0);
+#endif
+ temp = (USHORT)(eax >> 28);
+ temp &= 0x0F;
+ tempal |= temp;
+
+#ifdef TWDEBUG
+ xf86DrvMsg(0, X_INFO, "FIFO2: Latencyfactorindex = 0x%x\n", tempal);
#endif
- temp=(USHORT)(eax>>24);
- if(!(temp&0x01)) index += 24;
+
+ tempbx = tempal; /* BIOS BUG (2.04.5d, 2.04.6a use ah here, which is unset!) */
+ tempbx = 0; /* -- do it like the BIOS anyway... */
+ tempax = tempbx;
+ tempbx &= 0xc0;
+ tempbx >>= 6;
+ tempax &= 0x0f;
+ tempax *= 3;
+ tempbx += tempax;
+
+ data = LatencyFactor730[tempbx];
+ data += 15;
+ temp = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14);
+ if(!(temp & 0x80)) data += 5;
+
+ } else {
+
+ index = 0;
+ temp = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14);
+ if(temp & 0x0080) index += 12;
#ifndef LINUX_XF86
- SiS_SetReg4(0xcf8,0x80000050);
- eax=SiS_GetReg3(0xcfc);
+ SiS_SetReg4(0xcf8,0x800000A0);
+ eax = SiS_GetReg3(0xcfc);
#else
- eax = pciReadLong(0x00000000, 0x50);
+ /* TW: We use pci functions X offers. We use tag 0, because
+ * we want to read/write to the host bridge (which is always
+ * 00:00.0 on 630, 730 and 540), not the VGA device.
+ */
+ eax = pciReadLong(0x00000000, 0xA0);
#endif
- temp=(USHORT)(eax >> 24);
- if(temp & 0x01) index += 6;
+ temp = (USHORT)(eax >> 24);
+ if(!(temp&0x01)) index += 24;
- temp = (temp & 0x0F) >> 1;
- index += temp;
- data = LatencyFactor[index];
- data += 15;
- temp = SiS_GetReg1(SiS_P3c4,0x14);
- if(!(temp & 0x80)) data += 5;
+#ifndef LINUX_XF86
+ SiS_SetReg4(0xcf8,0x80000050);
+ eax = SiS_GetReg3(0xcfc);
+#else
+ eax = pciReadLong(0x00000000, 0x50);
+#endif
+ temp=(USHORT)(eax >> 24);
+ if(temp & 0x01) index += 6;
+
+ temp = (temp & 0x0F) >> 1;
+ index += temp;
+
+ data = LatencyFactor[index];
+ data += 15;
+ temp = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14);
+ if(!(temp & 0x80)) data += 5;
+ }
+
+#ifdef TWDEBUG
+ xf86DrvMsg(0, X_INFO, "FIFO2: latencyfactor (CRT1) = %d\n", data);
+#endif
+
+ data += data2; /* CRT1 Request Period */
+
+#ifdef TWDEBUG
+ xf86DrvMsg(0, X_INFO, "FIFO2: CRT1 request period = %d\n", data);
+#endif
- data += data2;
+ CRT2ModeNo = ModeNo;
+ SiS_Pr->SiS_SetFlag |= ProgrammingCRT2;
+ SiS_Pr->SiS_SelectCRT2Rate = SelectRate_backup;
+ SiS_SearchModeID(SiS_Pr,ROMAddr,&CRT2ModeNo,&modeidindex);
- SiS_SetFlag |= ProgrammingCRT2;
+ refreshratetableindex = SiS_GetRatePtrCRT2(SiS_Pr,ROMAddr,CRT2ModeNo,
+ modeidindex,HwDeviceExtension);
+
+ index = SiS_GetVCLK2Ptr(SiS_Pr,ROMAddr,CRT2ModeNo,modeidindex,
+ refreshratetableindex,HwDeviceExtension);
+ VCLK = SiS_Pr->SiS_VCLKData[index].CLOCK; /* Get VCLK */
+
+ data2 = SiS_Pr->SiS_ModeType - 2;
+ switch(data2) { /* Get color depth */
+ case 0 : colorth = 1; break;
+ case 1 : colorth = 1; break;
+ case 2 : colorth = 2; break;
+ case 3 : colorth = 2; break;
+ case 4 : colorth = 3; break;
+ case 5 : colorth = 4; break;
+ default: colorth = 2; break;
+ }
+
+#ifdef TWDEBUG
+ xf86DrvMsg(0, X_INFO, "FIFO2: CRT2Mode 0x%x VCLK %d MCLK %d modetype-2 = %d, colorth %d\n",
+ CRT2ModeNo, VCLK, MCLK, data2, colorth);
+#endif
data = data * VCLK * colorth;
if(data % (MCLK << 4)) {
@@ -1951,35 +2345,53 @@ SiS_SetCRT2FIFO_300(UCHAR *ROMAddr,USHORT ModeNo,
} else {
data = data / (MCLK << 4);
}
+
+#ifdef TWDEBUG
+ xf86DrvMsg(0, X_INFO, "FIFO2: data (unclipped) = 0x%x\n", data);
+#endif
+
+ if(data <= 6) data = 6;
+ if(data > 0x14) data = 0x14;
- /* TW: Inserted this entire section */
- temp = SiS_GetReg1(SiS_Part1Port,0x01);
- if( ( (HwDeviceExtension->jChipType == SIS_630) ||
- (HwDeviceExtension->jChipType == SIS_730) ) &&
- (HwDeviceExtension->jChipRevision >= 0x30) ) /* 630s or 730(s?) */
- {
- temp = (temp & (~0x1F)) | 0x1b;
+ temp = SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x01);
+ if(HwDeviceExtension->jChipType == SIS_300) {
+ if(data <= 0x0f) temp = (temp & (~0x1F)) | 0x13;
+ else temp = (temp & (~0x1F)) | 0x16;
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) {
+ temp = (temp & (~0x1F)) | 0x13;
+ }
} else {
- temp = (temp & (~0x1F)) | 0x16;
+ if( ( (HwDeviceExtension->jChipType == SIS_630) ||
+ (HwDeviceExtension->jChipType == SIS_730) ) &&
+ (HwDeviceExtension->jChipRevision >= 0x30) ) /* 630s or 730(s?) */
+ {
+ temp = (temp & (~0x1F)) | 0x1b;
+ } else {
+ temp = (temp & (~0x1F)) | 0x16;
+ }
}
- SiS_SetRegANDOR(SiS_Part1Port,0x01,0xe0,temp);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x01,0xe0,temp);
- if(data <= 6) data = 6;
- if(data > 0x14) data = 0x14;
if( (HwDeviceExtension->jChipType == SIS_630) &&
(HwDeviceExtension->jChipRevision >= 0x30) ) /* 630s, NOT 730 */
{
if(data > 0x13) data = 0x13;
}
- SiS_SetRegANDOR(SiS_Part1Port,0x02,~0x01F,data);
- /* TW end */
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x02,0xe0,data);
+
+ } else { /* If mode <= 0x13, we just restore everything */
+
+ SiS_Pr->SiS_SetFlag |= ProgrammingCRT2;
+ SiS_Pr->SiS_SelectCRT2Rate = SelectRate_backup;
+
}
}
+#endif
-/* TW: Set FIFO on 310 series */
+/* TW: Set FIFO on 310/325/330 series */
#ifdef SIS315H
void
-SiS_SetCRT2FIFO_310(UCHAR *ROMAddr,USHORT ModeNo,
+SiS_SetCRT2FIFO_310(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,
PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
@@ -1994,38 +2406,57 @@ SiS_SetCRT2FIFO_310(UCHAR *ROMAddr,USHORT ModeNo,
USHORT ModeIdIndex;
USHORT RefreshRateTableIndex;
USHORT SelectRate_backup;
+
+ SelectRate_backup = SiS_Pr->SiS_SelectCRT2Rate;
+
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x01,0x3B);
- SiS_SetReg1(SiS_Part1Port,0x01,0x3B);
-
- CRT1ModeNo = SiS_CRT1Mode; /* get CRT1 ModeNo */
- SiS_SearchModeID(ROMAddr,&CRT1ModeNo,&ModeIdIndex);
+ if(!SiS_Pr->CRT1UsesCustomMode) {
+
+ CRT1ModeNo = SiS_Pr->SiS_CRT1Mode; /* get CRT1 ModeNo */
+ SiS_SearchModeID(SiS_Pr,ROMAddr,&CRT1ModeNo,&ModeIdIndex);
- SiS_SetFlag &= (~ProgrammingCRT2);
- SelectRate_backup = SiS_SelectCRT2Rate;
- SiS_SelectCRT2Rate = 0;
+ SiS_Pr->SiS_SetFlag &= (~ProgrammingCRT2);
+ SiS_Pr->SiS_SelectCRT2Rate = 0;
- /* Set REFIndex for crt1 refreshrate */
- RefreshRateTableIndex = SiS_GetRatePtrCRT2(ROMAddr,CRT1ModeNo,
- ModeIdIndex);
+ /* Get REFIndex for crt1 refreshrate */
+ RefreshRateTableIndex = SiS_GetRatePtrCRT2(SiS_Pr,ROMAddr,CRT1ModeNo,
+ ModeIdIndex,HwDeviceExtension);
- index = SiS_GetVCLK2Ptr(ROMAddr,CRT1ModeNo,ModeIdIndex,
+ index = SiS_GetVCLK2Ptr(SiS_Pr,ROMAddr,CRT1ModeNo,ModeIdIndex,
RefreshRateTableIndex,HwDeviceExtension);
- tempax = SiS_VCLKData[index].CLOCK; /* Get DCLK (VCLK?) */
-
- tempbx = SiS_GetColorDepth(ROMAddr,CRT1ModeNo,ModeIdIndex); /* Get colordepth */
- tempbx >>= 1;
- if(!tempbx) tempbx++;
-
+ tempax = SiS_Pr->SiS_VCLKData[index].CLOCK; /* Get VCLK */
+
+ tempbx = SiS_GetColorDepth(SiS_Pr,ROMAddr,CRT1ModeNo,ModeIdIndex); /* Get colordepth */
+ tempbx >>= 1;
+ if(!tempbx) tempbx++;
+
+ } else {
+
+ tempax = SiS_Pr->CSRClock; /* Get VCLK */
+ tempbx = (SiS_Pr->CModeFlag & ModeInfoFlag) - 2;
+ switch(tempbx) { /* Get color depth */
+ case 0 : tempbx = 1; break;
+ case 1 : tempbx = 1; break;
+ case 2 : tempbx = 2; break;
+ case 3 : tempbx = 2; break;
+ case 4 : tempbx = 3; break;
+ case 5 : tempbx = 4; break;
+ default: tempbx = 2; break;
+ }
+
+ }
+
tempax *= tempbx;
- tempbx = SiS_GetMCLK(ROMAddr, HwDeviceExtension); /* Get MCLK */
+ tempbx = SiS_GetMCLK(SiS_Pr,ROMAddr, HwDeviceExtension); /* Get MCLK */
tempax /= tempbx;
tempbx = tempax;
#if 0 /* TW: BIOS code is skrewed */
- if(SiS_GetReg1(SiS_P3c4,0x14) & 0x02) {
+ if(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14) & 0x02) {
tempax = 16;
} else {
tempax = 8;
@@ -2046,8 +2477,8 @@ SiS_SetCRT2FIFO_310(UCHAR *ROMAddr,USHORT ModeNo,
tempcx += 40;
/* get DRAM latency */
- tempcl = (SiS_GetReg1(SiS_P3c4,0x17) >> 3) & 0x7; /* SR17[5:3] DRAM Queue depth */
- tempch = (SiS_GetReg1(SiS_P3c4,0x17) >> 6) & 0x3; /* SR17[7:6] DRAM Grant length */
+ tempcl = (SiS_GetReg1(SiS_Pr->SiS_P3c4,0x17) >> 3) & 0x7; /* SR17[5:3] DRAM Queue depth */
+ tempch = (SiS_GetReg1(SiS_Pr->SiS_P3c4,0x17) >> 6) & 0x3; /* SR17[7:6] DRAM Grant length */
for (temp3 = 0; temp3 < 16; temp3 += 2) {
if ((CombCode[temp3] == tempcl) && (CombCode[temp3+1] == tempch)) {
@@ -2057,20 +2488,24 @@ SiS_SetCRT2FIFO_310(UCHAR *ROMAddr,USHORT ModeNo,
tempcx += temp3; /* CRT1 Request Period */
- CRT2ModeNo = ModeNo; /* get CRT2 ModeNo */
- SiS_SearchModeID(ROMAddr,&CRT2ModeNo,&ModeIdIndex); /* Get ModeID Table */
+ CRT2ModeNo = ModeNo; /* get CRT2 ModeNo */
+ SiS_SearchModeID(SiS_Pr,ROMAddr,&CRT2ModeNo,&ModeIdIndex); /* Get ModeID Table */
- SiS_SetFlag |= ProgrammingCRT2;
- SiS_SelectCRT2Rate = SelectRate_backup;
+ SiS_Pr->SiS_SetFlag |= ProgrammingCRT2;
+ SiS_Pr->SiS_SelectCRT2Rate = SelectRate_backup;
- RefreshRateTableIndex=SiS_GetRatePtrCRT2(ROMAddr,CRT1ModeNo,
- ModeIdIndex);
+ RefreshRateTableIndex = SiS_GetRatePtrCRT2(SiS_Pr,ROMAddr,CRT2ModeNo,
+ ModeIdIndex,HwDeviceExtension);
- index = SiS_GetVCLK2Ptr(ROMAddr,CRT2ModeNo,ModeIdIndex,
+ index = SiS_GetVCLK2Ptr(SiS_Pr,ROMAddr,CRT2ModeNo,ModeIdIndex,
RefreshRateTableIndex,HwDeviceExtension);
- tempax = SiS_VCLKData[index].CLOCK; /* Get VCLK */
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) {
+ tempax = SiS_Pr->SiS_VCLKData[index].CLOCK; /* Get VCLK */
+ } else {
+ tempax = SiS_Pr->SiS_VBVCLKData[index].CLOCK; /* Get VCLK */
+ }
- tempbx = SiS_GetColorDepth(ROMAddr,CRT2ModeNo,ModeIdIndex); /* Get colordepth */
+ tempbx = SiS_GetColorDepth(SiS_Pr,ROMAddr,CRT2ModeNo,ModeIdIndex); /* Get colordepth */
tempbx >>= 1;
if(!tempbx) tempbx++;
@@ -2078,7 +2513,7 @@ SiS_SetCRT2FIFO_310(UCHAR *ROMAddr,USHORT ModeNo,
tempax *= tempcx;
- tempbx = SiS_GetMCLK(ROMAddr, HwDeviceExtension); /* Get MCLK */
+ tempbx = SiS_GetMCLK(SiS_Pr,ROMAddr, HwDeviceExtension); /* Get MCLK */
tempbx <<= 4;
tempcx = tempax;
@@ -2087,171 +2522,192 @@ SiS_SetCRT2FIFO_310(UCHAR *ROMAddr,USHORT ModeNo,
if (tempax > 0x37) tempax = 0x37;
- /* TW: 650/LVDS (1.10.07, 1.10.00), 650/301LV overrule calculated value; 315 does not */
- if(HwDeviceExtension->jChipType == SIS_650) {
+ /* TW: 650/LVDS (1.10.07, 1.10.00), 650/301LV, 740, 330 overrule calculated value; 315 does not */
+ if(HwDeviceExtension->jChipType >= SIS_650) {
tempax = 0x04;
}
-
- SiS_SetRegANDOR(SiS_Part1Port,0x02,~0x3F,tempax);
+
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x02,~0x3F,tempax);
}
USHORT
-SiS_GetMCLK(UCHAR *ROMAddr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
+SiS_GetMCLK(SiS_Private *SiS_Pr, UCHAR *ROMAddr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
USHORT index;
- index = SiS_Get310DRAMType(ROMAddr,HwDeviceExtension);
+ index = SiS_Get310DRAMType(SiS_Pr,ROMAddr,HwDeviceExtension);
if(index >= 4) {
index -= 4;
- return(SiS_MCLKData_1[index].CLOCK);
+ return(SiS_Pr->SiS_MCLKData_1[index].CLOCK);
} else {
- return(SiS_MCLKData_0[index].CLOCK);
+ return(SiS_Pr->SiS_MCLKData_0[index].CLOCK);
}
}
#endif
/* TW: Checked against 650/LVDS 1.10.07 BIOS */
void
-SiS_GetLVDSDesData(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+SiS_GetLVDSDesData(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
USHORT RefreshRateTableIndex,
PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
USHORT modeflag;
USHORT PanelIndex,ResIndex;
- SiS_LVDSDesStruct *PanelDesPtr=NULL;
+ const SiS_LVDSDesStruct *PanelDesPtr = NULL;
- if((SiS_VBType & VB_SIS301BLV302BLV) && (SiS_VBInfo & SetCRT2ToLCDA) ) {
+ if((SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) ) {
- SiS_GetLVDSDesPtrA(ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
+ SiS_GetLVDSDesPtrA(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
&PanelIndex,&ResIndex);
+
switch (PanelIndex)
{
- case 0: PanelDesPtr = LVDS1024x768Des_1; break; /* --- expanding --- */
- case 1: PanelDesPtr = LVDS1280x1024Des_1; break;
- case 2: PanelDesPtr = LVDS1280x960Des_1; break;
- case 3: PanelDesPtr = LVDS1024x768Des_2; break; /* --- non expanding --- */
- case 4: PanelDesPtr = LVDS1280x1024Des_2; break;
- case 5: PanelDesPtr = LVDS1280x960Des_2; break;
+ case 0: PanelDesPtr = SiS_Pr->LVDS1024x768Des_1; break; /* --- expanding --- */
+ case 1: PanelDesPtr = SiS_Pr->LVDS1280x1024Des_1; break;
+ case 2: PanelDesPtr = SiS_Pr->LVDS1400x1050Des_1; break;
+ case 3: PanelDesPtr = SiS_Pr->LVDS1600x1200Des_1; break;
+ case 4: PanelDesPtr = SiS_Pr->LVDS1024x768Des_2; break; /* --- non expanding --- */
+ case 5: PanelDesPtr = SiS_Pr->LVDS1280x1024Des_2; break;
+ case 6: PanelDesPtr = SiS_Pr->LVDS1400x1050Des_2; break;
+ case 7: PanelDesPtr = SiS_Pr->LVDS1600x1200Des_2; break;
+ default: PanelDesPtr = SiS_Pr->LVDS1024x768Des_1; break;
}
} else {
- SiS_GetLVDSDesPtr(ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
+ SiS_GetLVDSDesPtr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
&PanelIndex,&ResIndex,HwDeviceExtension);
switch (PanelIndex)
{
- case 0: PanelDesPtr = SiS_PanelType00_1; break; /* --- expanding --- | Gericom 1st supersonic (310) */
- case 1: PanelDesPtr = SiS_PanelType01_1; break;
- case 2: PanelDesPtr = SiS_PanelType02_1; break;
- case 3: PanelDesPtr = SiS_PanelType03_1; break;
- case 4: PanelDesPtr = SiS_PanelType04_1; break;
- case 5: PanelDesPtr = SiS_PanelType05_1; break;
- case 6: PanelDesPtr = SiS_PanelType06_1; break;
- case 7: PanelDesPtr = SiS_PanelType07_1; break;
- case 8: PanelDesPtr = SiS_PanelType08_1; break;
- case 9: PanelDesPtr = SiS_PanelType09_1; break;
- case 10: PanelDesPtr = SiS_PanelType0a_1; break;
- case 11: PanelDesPtr = SiS_PanelType0b_1; break;
- case 12: PanelDesPtr = SiS_PanelType0c_1; break; /* TW: Clevo 2202 (300) */
- case 13: PanelDesPtr = SiS_PanelType0d_1; break;
- case 14: PanelDesPtr = SiS_PanelType0e_1; break; /* TW: Uniwill N271S2 (300) */
- case 15: PanelDesPtr = SiS_PanelType0f_1; break;
- case 16: PanelDesPtr = SiS_PanelType00_2; break; /* --- non-expanding --- */
- case 17: PanelDesPtr = SiS_PanelType01_2; break;
- case 18: PanelDesPtr = SiS_PanelType02_2; break;
- case 19: PanelDesPtr = SiS_PanelType03_2; break;
- case 20: PanelDesPtr = SiS_PanelType04_2; break;
- case 21: PanelDesPtr = SiS_PanelType05_2; break;
- case 22: PanelDesPtr = SiS_PanelType06_2; break;
- case 23: PanelDesPtr = SiS_PanelType07_2; break;
- case 24: PanelDesPtr = SiS_PanelType08_2; break;
- case 25: PanelDesPtr = SiS_PanelType09_2; break;
- case 26: PanelDesPtr = SiS_PanelType0a_2; break;
- case 27: PanelDesPtr = SiS_PanelType0b_2; break;
- case 28: PanelDesPtr = SiS_PanelType0c_2; break; /* TW: Gericom 2200C (300) */
- case 29: PanelDesPtr = SiS_PanelType0d_2; break;
- case 30: PanelDesPtr = SiS_PanelType0e_2; break;
- case 31: PanelDesPtr = SiS_PanelType0f_2; break;
- case 32: PanelDesPtr = SiS_CHTVUNTSCDesData; break;
- case 33: PanelDesPtr = SiS_CHTVONTSCDesData; break;
- case 34: PanelDesPtr = SiS_CHTVUPALDesData; break;
- case 35: PanelDesPtr = SiS_CHTVOPALDesData; break;
+ case 0: PanelDesPtr = SiS_Pr->SiS_PanelType00_1; break; /* --- expanding --- | */
+ case 1: PanelDesPtr = SiS_Pr->SiS_PanelType01_1; break;
+ case 2: PanelDesPtr = SiS_Pr->SiS_PanelType02_1; break;
+ case 3: PanelDesPtr = SiS_Pr->SiS_PanelType03_1; break;
+ case 4: PanelDesPtr = SiS_Pr->SiS_PanelType04_1; break;
+ case 5: PanelDesPtr = SiS_Pr->SiS_PanelType05_1; break;
+ case 6: PanelDesPtr = SiS_Pr->SiS_PanelType06_1; break;
+ case 7: PanelDesPtr = SiS_Pr->SiS_PanelType07_1; break;
+ case 8: PanelDesPtr = SiS_Pr->SiS_PanelType08_1; break;
+ case 9: PanelDesPtr = SiS_Pr->SiS_PanelType09_1; break;
+ case 10: PanelDesPtr = SiS_Pr->SiS_PanelType0a_1; break;
+ case 11: PanelDesPtr = SiS_Pr->SiS_PanelType0b_1; break;
+ case 12: PanelDesPtr = SiS_Pr->SiS_PanelType0c_1; break;
+ case 13: PanelDesPtr = SiS_Pr->SiS_PanelType0d_1; break;
+ case 14: PanelDesPtr = SiS_Pr->SiS_PanelType0e_1; break;
+ case 15: PanelDesPtr = SiS_Pr->SiS_PanelType0f_1; break;
+ case 16: PanelDesPtr = SiS_Pr->SiS_PanelType00_2; break; /* --- non-expanding --- */
+ case 17: PanelDesPtr = SiS_Pr->SiS_PanelType01_2; break;
+ case 18: PanelDesPtr = SiS_Pr->SiS_PanelType02_2; break;
+ case 19: PanelDesPtr = SiS_Pr->SiS_PanelType03_2; break;
+ case 20: PanelDesPtr = SiS_Pr->SiS_PanelType04_2; break;
+ case 21: PanelDesPtr = SiS_Pr->SiS_PanelType05_2; break;
+ case 22: PanelDesPtr = SiS_Pr->SiS_PanelType06_2; break;
+ case 23: PanelDesPtr = SiS_Pr->SiS_PanelType07_2; break;
+ case 24: PanelDesPtr = SiS_Pr->SiS_PanelType08_2; break;
+ case 25: PanelDesPtr = SiS_Pr->SiS_PanelType09_2; break;
+ case 26: PanelDesPtr = SiS_Pr->SiS_PanelType0a_2; break;
+ case 27: PanelDesPtr = SiS_Pr->SiS_PanelType0b_2; break;
+ case 28: PanelDesPtr = SiS_Pr->SiS_PanelType0c_2; break;
+ case 29: PanelDesPtr = SiS_Pr->SiS_PanelType0d_2; break;
+ case 30: PanelDesPtr = SiS_Pr->SiS_PanelType0e_2; break;
+ case 31: PanelDesPtr = SiS_Pr->SiS_PanelType0f_2; break;
+ case 32: PanelDesPtr = SiS_Pr->SiS_CHTVUNTSCDesData; break;
+ case 33: PanelDesPtr = SiS_Pr->SiS_CHTVONTSCDesData; break;
+ case 34: PanelDesPtr = SiS_Pr->SiS_CHTVUPALDesData; break;
+ case 35: PanelDesPtr = SiS_Pr->SiS_CHTVOPALDesData; break;
+ default:
+ if(HwDeviceExtension->jChipType < SIS_315H)
+ PanelDesPtr = SiS_Pr->SiS_PanelType0e_1;
+ else
+ PanelDesPtr = SiS_Pr->SiS_PanelType01_1;
+ break;
}
}
- SiS_LCDHDES = (PanelDesPtr+ResIndex)->LCDHDES;
- SiS_LCDVDES = (PanelDesPtr+ResIndex)->LCDVDES;
-
- if(SiS_LCDInfo & LCDNonExpanding){
- if(!(SiS_SetFlag & CRT2IsVGA)) {
- if((HwDeviceExtension->jChipType < SIS_315H) || (SiS_LCDResInfo != Panel1280x1024)) { /* TW: New from 650/LVDS 1.10.07 */
- if(SiS_LCDResInfo >= Panel1024x768){
- if(ModeNo <= 0x13){
- modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
- if(HwDeviceExtension->jChipType < SIS_315H) {
- if(!(modeflag & HalfDCLK)) {
- SiS_LCDHDES = 320;
- }
- } else {
- /* TW: New from 650/LVDS 1.10.07 */
- if(SiS_LCDResInfo == Panel1024x768)
- SiS_LCDHDES = 480;
- if(SiS_LCDResInfo == Panel1400x1050)
- SiS_LCDHDES = 804;
- if(!(modeflag & HalfDCLK)) {
- SiS_LCDHDES = 320;
- if(SiS_LCDResInfo == Panel1400x1050)
- SiS_LCDHDES = 632;
+ SiS_Pr->SiS_LCDHDES = (PanelDesPtr+ResIndex)->LCDHDES;
+ SiS_Pr->SiS_LCDVDES = (PanelDesPtr+ResIndex)->LCDVDES;
+
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD){
+ if((SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) {
+ if(ModeNo <= 0x13) {
+ modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
+ if(!(modeflag & HalfDCLK)) {
+ SiS_Pr->SiS_LCDHDES = 632;
+ }
+ }
+ } else {
+ if(!(SiS_Pr->SiS_SetFlag & SetDOSMode)) {
+ if( (HwDeviceExtension->jChipType < SIS_315H) ||
+ (SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x1024) ) {
+ if(SiS_Pr->SiS_LCDResInfo >= SiS_Pr->SiS_Panel1024x768){
+ if(ModeNo <= 0x13) {
+ modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
+ if(HwDeviceExtension->jChipType < SIS_315H) {
+ if(!(modeflag & HalfDCLK)) SiS_Pr->SiS_LCDHDES = 320;
+ } else {
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768)
+ SiS_Pr->SiS_LCDHDES = 480;
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050)
+ SiS_Pr->SiS_LCDHDES = 804;
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200)
+ SiS_Pr->SiS_LCDHDES = 704;
+ if(!(modeflag & HalfDCLK)) {
+ SiS_Pr->SiS_LCDHDES = 320;
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050)
+ SiS_Pr->SiS_LCDHDES = 632;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200)
+ SiS_Pr->SiS_LCDHDES = 542;
+ }
+ }
}
- }
- }
+ }
+ }
}
- }
- }
+ }
}
return;
}
-/* TW: Checked against 630/LVDS (2.04.5c) and 650/LVDS (1.10.07) BIOS */
void
-SiS_GetLVDSDesPtr(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+SiS_GetLVDSDesPtr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
USHORT RefreshRateTableIndex,USHORT *PanelIndex,
USHORT *ResIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
USHORT tempbx,tempal,modeflag;
- if(ModeNo<=0x13) {
- modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
- tempal = SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC;
+ if(ModeNo <= 0x13) {
+ modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
+ tempal = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC;
} else {
- modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
- tempal = SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
+ modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ tempal = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
}
tempbx = 0;
- if(SiS_IF_DEF_CH70xx != 0) {
- if(!(SiS_VBInfo & SetCRT2ToLCD)) {
- tempbx = 32;
- if(SiS_VBInfo & SetPALTV) tempbx += 2;
- if(SiS_VBInfo & SetCHTVOverScan) tempbx += 1;
- }
+ if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
+ if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) {
+ tempbx = 32;
+ if((SiS_Pr->SiS_VBInfo & SetPALTV) && (!SiS_Pr->SiS_CHPALM)) tempbx += 2;
+ if(SiS_Pr->SiS_VBInfo & SetCHTVOverScan) tempbx += 1;
+ /* TW: Nothing special needed for SOverscan */
+ /* PALM uses NTSC data, PALN uses PAL data */
+ }
}
- if(SiS_VBInfo & SetCRT2ToLCD) {
- tempbx = SiS_LCDTypeInfo;
- if(SiS_LCDInfo & LCDNonExpanding) tempbx += 16;
- /* TW: Inserted from 650/LVDS (1.10.07) BIOS */
- if(SiS_LCDInfo & 0x0100) {
- if(modeflag & HalfDCLK) tempbx += 16;
- }
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ tempbx = SiS_Pr->SiS_LCDTypeInfo;
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx += 16;
+ if(SiS_Pr->SiS_LCDInfo & LCDPass11) {
+ if(modeflag & HalfDCLK) tempbx += 16;
+ }
}
/* TW: Inserted from 630/LVDS and 650/LVDS (1.10.07) BIOS */
- if(SiS_SetFlag & CRT2IsVGA) {
- if(SiS_LCDResInfo != Panel640x480) {
- tempal = 0x07;
- if(HwDeviceExtension->jChipType < SIS_315H) {
- if(SiS_GetReg1(SiS_P3c4,0x13) & 0x80) tempal++;
- }
- }
+ if(SiS_Pr->SiS_SetFlag & SetDOSMode) {
+ if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) {
+ tempal = 0x07;
+ if(HwDeviceExtension->jChipType < SIS_315H) {
+ if(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13) & 0x80) tempal++;
+ }
+ }
}
*PanelIndex = tempbx;
@@ -2259,196 +2715,222 @@ SiS_GetLVDSDesPtr(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
}
void
-SiS_GetLVDSDesPtrA(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
- USHORT RefreshRateTableIndex,USHORT *PanelIndex,
- USHORT *ResIndex)
+SiS_GetLVDSDesPtrA(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+ USHORT RefreshRateTableIndex,USHORT *PanelIndex,USHORT *ResIndex)
{
USHORT tempbx=0,tempal;
- tempbx = SiS_LCDResInfo - PanelMin301; /* TW: *not* PanelMinLVDS! */
- if(SiS_LCDInfo & LCDNonExpanding) tempbx += 3;
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) tempbx = 2;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) tempbx = 3;
+ else tempbx = SiS_Pr->SiS_LCDResInfo - SiS_Pr->SiS_PanelMinLVDS;
- if(ModeNo<=0x13)
- tempal = SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC;
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx += 4;
+
+ if(ModeNo <= 0x13)
+ tempal = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC;
else
- tempal = SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
+ tempal = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
*PanelIndex = tempbx;
*ResIndex = tempal & 0x1F;
}
-/* TW: Checked against 650/LVDS (1.10.07), 650/301LV, 630/301 and 630/301B (II) BIOS */
void
-SiS_SetCRT2ModeRegs(USHORT BaseAddr,USHORT ModeNo, USHORT ModeIdIndex,
+SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT BaseAddr, USHORT ModeNo, USHORT ModeIdIndex,
PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
USHORT i,j,modeflag;
- USHORT tempcl,tempah,tempbl,temp;
+ USHORT tempcl,tempah=0;
+#ifdef SIS300
+ USHORT temp;
+#endif
+#ifdef SIS315H
+ USHORT tempbl;
+#endif
- if(ModeNo<=0x13) {
- modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
+ if(ModeNo <= 0x13) {
+ modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
} else {
- modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ if(SiS_Pr->UseCustomMode) {
+ modeflag = SiS_Pr->CModeFlag;
+ } else {
+ modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ }
}
/* TW: BIOS does not do this (neither 301 nor LVDS) */
/* (But it's harmless; see SetCRT2Offset) */
- SiS_SetReg1(SiS_Part1Port,0x03,0x00); /* fix write part1 index 0 BTDRAM bit Bug */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x03,0x00); /* fix write part1 index 0 BTDRAM bit Bug */
/* TW: Removed 301B302B301LV302LV check here to match 650/LVDS BIOS */
- if(SiS_VBInfo & SetCRT2ToLCDA) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) {
/* TW: 1. for LVDS/302B/302LV **LCDA** */
- SiS_SetRegANDOR(SiS_Part1Port,0x00,0xAF,0x40); /* FUNCTION CONTROL */
- SiS_SetRegAND(SiS_Part1Port,0x2E,0xF7);
-#if 0 /* TW: Not done in 650/301, 650/LVDS or 650/301LV BIOS*/
- SiS_SetRegANDOR(SiS_Part1Port,0x13,0xFB,0x04);
- SiS_SetRegANDOR(SiS_Part1Port,0x2c,0xCF,0x30);
- SiS_SetRegANDOR(SiS_Part4Port,0x21,0x3F,0xC0);
- SiS_SetRegANDOR(SiS_Part4Port,0x23,0x7F,0x00);
-#endif
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x00,0xAF,0x40); /* FUNCTION CONTROL */
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2E,0xF7);
} else {
- for(i=0,j=4;i<3;i++,j++) SiS_SetReg1(SiS_Part1Port,j,0);
+ for(i=0,j=4; i<3; i++,j++) SiS_SetReg1(SiS_Pr->SiS_Part1Port,j,0);
- tempcl = SiS_ModeType;
+ tempcl = SiS_Pr->SiS_ModeType;
if(HwDeviceExtension->jChipType < SIS_315H) {
- /* ---- 300 series ---- */
+#ifdef SIS300 /* ---- 300 series ---- */
- /* TW: Inserted entire if-section from 630/301B BIOS */
- if(SiS_VBType & VB_SIS301BLV302BLV) {
- temp = SiS_GetReg1(SiS_P3c4,0x32);
+ /* For 301BDH: */
+ if(SiS_Pr->SiS_VBType & VB_NoLCD) {
+ temp = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x32);
temp &= 0xef;
temp |= 0x02;
- if(SiS_VBInfo & SetCRT2ToTV) {
+ if((SiS_Pr->SiS_VBInfo & SetCRT2ToTV) || (SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC)) {
temp |= 0x10;
temp &= 0xfd;
}
- SiS_SetReg1(SiS_P3c4,0x32,temp);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x32,temp);
}
- if(ModeNo > 0x13){
+ if(ModeNo > 0x13) {
tempcl -= ModeVGA;
- if((tempcl > 0) || (tempcl == 0)) { /* TW: tempcl is USHORT -> always true! */
- tempah = ((0x010 >> tempcl) | 0x080);
+ if((tempcl > 0) || (tempcl == 0)) { /* TW: tempcl is USHORT -> always true! */
+ tempah = ((0x10 >> tempcl) | 0x80);
}
- } else tempah = 0x080;
+ } else tempah = 0x80;
+
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) tempah ^= 0xA0;
- if(SiS_VBInfo & SetInSlaveMode) tempah = (tempah ^ 0x0A0);
+#endif /* SIS300 */
} else {
- /* ---- 310 series ---- */
+#ifdef SIS315H /* ---- 310/325/330 series ---- */
- /* TW: Inserted from 650/301/301LV BIOS */
- if(SiS_VBType & VB_SIS301BLV302BLV) {
- if(SiS_VBInfo & CRT2DisplayFlag) {
- SiS_SetRegOR(SiS_Part1Port,0x2e,0x08);
- }
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ if(SiS_Pr->SiS_VBInfo & CRT2DisplayFlag) {
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2e,0x08);
+ }
}
if(ModeNo > 0x13) {
tempcl -= ModeVGA;
if((tempcl > 0) || (tempcl == 0)) { /* TW: tempcl is USHORT -> always true! */
- tempah = (0x008 >> tempcl);
+ tempah = (0x08 >> tempcl);
if (tempah == 0) tempah = 1;
- tempah |= 0x040;
+ tempah |= 0x40;
}
- } else tempah = 0x040;
+ } else tempah = 0x40;
- if(SiS_VBInfo & SetInSlaveMode) tempah = (tempah ^ 0x050);
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) tempah ^= 0x50;
+
+#endif /* SIS315H */
}
- if(SiS_VBInfo & CRT2DisplayFlag) tempah = 0;
+ if(SiS_Pr->SiS_VBInfo & CRT2DisplayFlag) tempah = 0;
- SiS_SetReg1(SiS_Part1Port,0x00,tempah); /* FUNCTION CONTROL */
+ if(HwDeviceExtension->jChipType < SIS_315H) {
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x00,tempah); /* FUNCTION CONTROL */
+ } else {
+ if(IS_SIS740) {
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x00,tempah); /* FUNCTION CONTROL */
+ } else {
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x00,0xa0,tempah); /* FUNCTION CONTROL */
+ }
+ }
- if(SiS_IF_DEF_LVDS == 0) {
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
/* TW: 2. for 301 (301B, 302B 301LV, 302LV non-LCDA) */
tempah = 0x01;
- if(!(SiS_VBInfo & SetInSlaveMode)) {
+ if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
tempah |= 0x02;
}
- if(!(SiS_VBInfo & SetCRT2ToRAMDAC)) {
- tempah = (tempah ^ 0x05);
- if(!(SiS_VBInfo & SetCRT2ToLCD)) {
- tempah = (tempah ^ 0x01);
+ if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC)) {
+ tempah ^= 0x05;
+ if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) {
+ tempah ^= 0x01;
}
}
- tempcl = tempah;
+ if(SiS_Pr->SiS_VBInfo & CRT2DisplayFlag) tempah = 0;
if(HwDeviceExtension->jChipType < SIS_315H) {
/* --- 300 series --- */
- tempah = (tempah << 5) & 0xFF;
- if(SiS_VBInfo & CRT2DisplayFlag) tempah=0;
- SiS_SetReg1(SiS_Part1Port,0x01,tempah);
- tempah = tempcl;
+ tempah = (tempah << 5) & 0xFF;
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x01,tempah);
+ tempah = (tempah >> 5) & 0xFF;
} else {
/* --- 310 series --- */
- if(SiS_VBInfo & CRT2DisplayFlag) tempah = 0;
- tempah = (SiS_GetReg1(SiS_Part1Port,0x2E) & 0xF8) | tempah;
- SiS_SetReg1(SiS_Part1Port,0x2E,tempah);
- tempah = tempcl;
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2E,0xF8,tempah);
+
}
- if((SiS_ModeType == ModeVGA) && (!(SiS_VBInfo & SetInSlaveMode))) {
- tempah |= 0x010;
+ if((SiS_Pr->SiS_ModeType == ModeVGA) && (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode))) {
+ tempah |= 0x10;
}
/* TW: Inserted from 630/301 BIOS */
- if(SiS_VBType & VB_SIS301) {
- if(SiS_LCDResInfo == Panel1280x1024) {
+ if((HwDeviceExtension->jChipType < SIS_315H) && (SiS_Pr->SiS_VBType & VB_SIS301)) {
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) {
tempah |= 0x80;
}
} else {
tempah |= 0x80;
}
- if(SiS_VBInfo & (SetCRT2ToTV - SetCRT2ToHiVisionTV)){ /* TW: Added -HiVision like in BIOS (650+630) */
- if(SiS_VBInfo & SetInSlaveMode) {
- tempah |= 0x20;
+ if(SiS_Pr->SiS_VBInfo & (SetCRT2ToTV - SetCRT2ToHiVisionTV)) {
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
+ if(!(SiS_Pr->SiS_HiVision & 0x03)) {
+ tempah |= 0x20;
+ }
}
}
- SiS_SetRegANDOR(SiS_Part4Port,0x0D,0x40,tempah);
-
- tempah=0;
- if(SiS_VBInfo & SetCRT2ToTV) {
- if(SiS_VBInfo & SetInSlaveMode) {
- if(SiS_VBType & VB_SIS301BLV302BLV) {
- SiS_SetFlag |= RPLLDIV2XO;
- tempah |= 0x40;
- } else {
- if(!(SiS_SetFlag & TVSimuMode)) {
- if(!(SiS_VBInfo & SetCRT2ToHiVisionTV)) {
- SiS_SetFlag |= RPLLDIV2XO;
- tempah |= 0x40;
- }
- }
- }
- } else {
- SiS_SetFlag |= RPLLDIV2XO;
- tempah |= 0x40;
- }
+
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x0D,0x40,tempah);
+
+ tempah = 0;
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
+ if(!(SiS_Pr->SiS_HiVision & 0x03)) {
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
+ if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV)) {
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ SiS_Pr->SiS_SetFlag |= RPLLDIV2XO;
+ tempah |= 0x40;
+ } else {
+ if(!(SiS_Pr->SiS_SetFlag & TVSimuMode)) {
+ SiS_Pr->SiS_SetFlag |= RPLLDIV2XO;
+ tempah |= 0x40;
+ }
+ }
+ }
+ } else {
+ SiS_Pr->SiS_SetFlag |= RPLLDIV2XO;
+ tempah |= 0x40;
+ }
+ }
}
+ /* TW: For 302LV dual-channel */
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x39) & 0x04)
+ tempah |= 0x40;
+ }
+ }
- if(SiS_LCDResInfo == Panel1280x1024 || SiS_LCDResInfo == Panel1280x960) {
+ if((SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) ||
+ (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x960)) {
tempah |= 0x80;
}
- SiS_SetReg1(SiS_Part4Port,0x0C,tempah);
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x0C,tempah);
} else {
@@ -2461,38 +2943,38 @@ SiS_SetCRT2ModeRegs(USHORT BaseAddr,USHORT ModeNo, USHORT ModeIdIndex,
* (LVDS can only be slave in 8bpp modes)
*/
tempah = 0x80;
- if( (modeflag & CRT2Mode) && (SiS_ModeType > ModeVGA) ) {
- if (SiS_VBInfo & DriverMode) {
+ if( (modeflag & CRT2Mode) && (SiS_Pr->SiS_ModeType > ModeVGA) ) {
+ if (SiS_Pr->SiS_VBInfo & DriverMode) {
tempah |= 0x02;
}
}
- if(!(SiS_VBInfo & SetInSlaveMode)) {
+ if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
tempah |= 0x02;
}
- if(SiS_VBInfo & SetCRT2ToTV) {
- tempah = tempah ^ 0x01;
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
+ tempah ^= 0x01;
}
- if(SiS_VBInfo & DisableCRT2Display) {
+ if(SiS_Pr->SiS_VBInfo & DisableCRT2Display) {
tempah = 1;
}
- SiS_SetRegANDOR(SiS_Part1Port,0x2e,0xF0,tempah);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2e,0xF0,tempah);
} else {
- /* TW: Inserted entire section from 630/LVDS BIOS (added ModeType check) */
+ /* TW: (added ModeType check) */
tempah = 0;
- if( (!(SiS_VBInfo & SetInSlaveMode)) && (SiS_ModeType > ModeVGA) ) {
+ if( (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) && (SiS_Pr->SiS_ModeType > ModeVGA) ) {
tempah |= 0x02;
}
tempah <<= 5;
- if(SiS_VBInfo & DisableCRT2Display)
- tempah = 0;
- SiS_SetReg1(SiS_Part1Port,0x01,tempah);
+ if(SiS_Pr->SiS_VBInfo & DisableCRT2Display) tempah = 0;
+
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x01,tempah);
}
@@ -2502,221 +2984,333 @@ SiS_SetCRT2ModeRegs(USHORT BaseAddr,USHORT ModeNo, USHORT ModeIdIndex,
/* TW: Inserted the entire following section */
- if(SiS_IF_DEF_LVDS == 0) {
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
- if(HwDeviceExtension->jChipType >= SIS_315H) { /* TW: From 650/301 BIOS */
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
-#if 0 /* TW: This is not done in 650/301LV BIOS */
- tempah = 0x04;
- tempbl = 0xfb;
- if(!(SiS_VBInfo & SetCRT2ToLCDA)) {
- tempah = 0x00;
- if(SiS_IsDualEdge(HwDeviceExtension, BaseAddr))
- tempbl = 0xff;
- }
- SiS_SetRegANDOR(SiS_Part1Port,0x13,tempbl,tempah);
+#ifdef SIS315H
+ if(!(IS_SIS740)) {
+ tempah = 0x04; /* For all bridges */
+ tempbl = 0xfb;
+ if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) {
+ tempah = 0x00;
+ if(SiS_IsDualEdge(SiS_Pr, HwDeviceExtension, BaseAddr))
+ tempbl = 0xff;
+ }
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,tempbl,tempah);
+ }
+
+ if(IS_SIS740) {
+ tempah = 0x30;
+ tempbl = 0xcf;
+ if(SiS_Pr->SiS_VBInfo & DisableCRT2Display) {
+ tempah = 0x00;
+ }
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2c,tempbl,tempah);
+ } else {
+ /* TW: This in order to fix "TV-blue-bug" on 315+301 */
+ if(SiS_Pr->SiS_VBType & VB_SIS301) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2c,0xCF); /* For 301 */
+ } else {
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2c,0xCF,0x30); /* For 30xLV */
+ } else {
+ tempah = 0x30; /* For 301B */
+ tempbl = 0xcf;
+ if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) {
+ tempah = 0x00;
+ if(SiS_IsDualEdge(SiS_Pr, HwDeviceExtension, BaseAddr)) {
+ tempbl = 0xff;
+ }
+ }
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2c,tempbl,tempah);
+ }
+ }
+ }
- SiS_SetRegANDOR(SiS_Part1Port,0x2c,0xCF,0x30);
-#endif
- /* This is done instead: */
- tempah = 0x30;
- if(SiS_VBInfo & DisableCRT2Display) tempah = 0;
- SiS_SetRegANDOR(SiS_Part1Port,0x2c,0xcf,tempah);
+ if(IS_SIS740) {
+ tempah = 0xc0;
+ tempbl = 0x3f;
+ if(SiS_Pr->SiS_VBInfo & DisableCRT2Display) {
+ tempah = 0x00;
+ }
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x21,tempbl,tempah);
+ } else {
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) { /* For 30xLV */
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x21,0x3f,0xc0);
+ } else { /* For 301, 301B */
+ tempah = 0xc0;
+ tempbl = 0x3f;
+ if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) {
+ tempah = 0x00;
+ if(SiS_IsDualEdge(SiS_Pr, HwDeviceExtension, BaseAddr)) {
+ tempbl = 0xff;
+ }
+ }
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x21,tempbl,tempah);
+ }
+ }
-#if 0 /* TW: This is not done in 650/301LV BIOS */
- SiS_SetRegANDOR(SiS_Part4Port,0x21,0x3f,0xc0);
-#endif
- /* This is done instead: */
- tempah = 0xc0;
- if(SiS_VBInfo & DisableCRT2Display) tempah = 0;
- SiS_SetRegANDOR(SiS_Part4Port,0x21,0x3f,tempah);
-
-#if 0 /* TW: This is not done in 650/301LV BIOS */
- tempah = 0x00;
- tempbl = 0x7f;
- if(!(SiS_VBInfo & SetCRT2ToLCDA)) {
- tempbl = 0xff;
- if(!(SiS_IsDualEdge(HwDeviceExtension, BaseAddr)))
- tempah = 0x80;
- }
- SiS_SetRegANDOR(SiS_Part4Port,0x23,tempbl,tempah);
-#endif
- /* This is done instead: */
- tempah = 0x80;
- if(SiS_VBInfo & DisableCRT2Display) tempah = 0;
- SiS_SetRegANDOR(SiS_Part4Port,0x23,0x7F,tempah);
+ if(IS_SIS740) {
+ tempah = 0x80;
+ tempbl = 0x7f;
+ if(SiS_Pr->SiS_VBInfo & DisableCRT2Display) {
+ tempah = 0x00;
+ }
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x23,tempbl,tempah);
+ } else {
+ tempah = 0x00; /* For all bridges */
+ tempbl = 0x7f;
+ if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) {
+ tempbl = 0xff;
+ if(!(SiS_IsDualEdge(SiS_Pr, HwDeviceExtension, BaseAddr)))
+ tempah |= 0x80;
+ }
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x23,tempbl,tempah);
+ }
+
+#endif /* SIS315H */
- } else if(SiS_VBType & VB_SIS301BLV302BLV) { /* TW: From 630/301B BIOS */
+ } else if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
- SiS_SetRegAND(SiS_Part4Port,0x21,0x3f);
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x21,0x3f);
- if(SiS_VBInfo & (SetCRT2ToLCD | DisableCRT2Display))
- SiS_SetRegAND(SiS_Part4Port,0x23,0x7F);
- else
- SiS_SetRegOR(SiS_Part4Port,0x23,0x80);
+ if((SiS_Pr->SiS_VBInfo & DisableCRT2Display) ||
+ ( (SiS_Pr->SiS_VBType & VB_NoLCD) &&
+ (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) ) ) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x23,0x7F);
+ } else {
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x23,0x80);
+ }
}
- } else { /* TW: From 650/LVDS BIOS */
+ } else { /* LVDS */
+#ifdef SIS315H
if(HwDeviceExtension->jChipType >= SIS_315H) {
- tempah = 0x04;
- tempbl = 0xfb;
- if(!(SiS_VBInfo & SetCRT2ToLCDA)) {
- tempah = 0x00;
- if(SiS_IsDualEdge(HwDeviceExtension, BaseAddr))
- tempbl = 0xff;
- }
- SiS_SetRegANDOR(SiS_Part1Port,0x13,tempbl,tempah);
- if(SiS_VBInfo & DisableCRT2Display)
- SiS_SetRegANDOR(SiS_Part1Port,0x13,0xfb,0x00);
+ if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
+
+ tempah = 0x04;
+ tempbl = 0xfb;
+ if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) {
+ tempah = 0x00;
+ if(SiS_IsDualEdge(SiS_Pr, HwDeviceExtension, BaseAddr))
+ tempbl = 0xff;
+ }
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,tempbl,tempah);
+
+ if(SiS_Pr->SiS_VBInfo & DisableCRT2Display)
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,0xfb,0x00);
+
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2c,0xcf,0x30);
+
+ }
- SiS_SetRegANDOR(SiS_Part1Port,0x2c,0xcf,0x30);
}
+#endif
}
}
void
-SiS_GetCRT2Data(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+SiS_GetCRT2Data(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
USHORT RefreshRateTableIndex,
PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
- if(SiS_IF_DEF_LVDS == 0) {
- if(SiS_VBType & VB_SIS301BLV302BLV) {
- if(SiS_VBInfo & SetCRT2ToLCDA) {
- SiS_GetCRT2DataLVDS(ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,HwDeviceExtension);
+
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
+
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) {
+
+ SiS_GetCRT2DataLVDS(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
+ HwDeviceExtension);
} else {
- if((HwDeviceExtension->jChipType < SIS_315H) && (SiS_VBInfo & SetCRT2ToLCD)){
- SiS_GetCRT2Data301(ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,HwDeviceExtension);
- /* TW: Need LVDS Data for LCD on 630/301B! */
- SiS_GetCRT2DataLVDS(ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,HwDeviceExtension);
- } else {
- SiS_GetCRT2Data301(ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,HwDeviceExtension);
- }
+
+ if( (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) &&
+ (SiS_Pr->SiS_VBType & VB_NoLCD) ) {
+
+ /* TW: Need LVDS Data for LCD on 301BDH */
+ SiS_GetCRT2DataLVDS(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
+ HwDeviceExtension);
+
+ } else {
+
+ SiS_GetCRT2Data301(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
+ HwDeviceExtension);
+ }
+
}
- } else
- SiS_GetCRT2Data301(ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,HwDeviceExtension);
+
+ } else {
+
+ SiS_GetCRT2Data301(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
+ HwDeviceExtension);
+ }
+
} else {
- SiS_GetCRT2DataLVDS(ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,HwDeviceExtension);
+
+ SiS_GetCRT2DataLVDS(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
+ HwDeviceExtension);
}
}
/* Checked with 650/LVDS 1.10.07 BIOS */
void
-SiS_GetCRT2DataLVDS(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+SiS_GetCRT2DataLVDS(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
USHORT RefreshRateTableIndex,
PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
USHORT CRT2Index, ResIndex;
- SiS_LVDSDataStruct *LVDSData = NULL;
-
- SiS_GetCRT2ResInfo(ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension);
+ const SiS_LVDSDataStruct *LVDSData = NULL;
+
+ SiS_GetCRT2ResInfo(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension);
+
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ SiS_Pr->SiS_RVBHCMAX = 1;
+ SiS_Pr->SiS_RVBHCFACT = 1;
+ SiS_Pr->SiS_NewFlickerMode = 0;
+ SiS_Pr->SiS_RVBHRS = 50;
+ SiS_Pr->SiS_RY1COE = 0;
+ SiS_Pr->SiS_RY2COE = 0;
+ SiS_Pr->SiS_RY3COE = 0;
+ SiS_Pr->SiS_RY4COE = 0;
+ }
- if((SiS_VBType & VB_SIS301BLV302BLV) && (SiS_VBInfo & SetCRT2ToLCDA)) {
+ if((SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) {
- SiS_GetCRT2PtrA(ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
+ SiS_GetCRT2PtrA(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
&CRT2Index,&ResIndex);
switch (CRT2Index) {
- case 0: LVDSData = SiS_LVDS1024x768Data_1; break;
- case 1: LVDSData = SiS_LVDS1280x1024Data_1; break;
- case 2: LVDSData = SiS_LVDS1280x960Data_1; break;
- case 3: LVDSData = SiS_LVDS1024x768Data_2; break;
- case 4: LVDSData = SiS_LVDS1280x1024Data_2; break;
- case 5: LVDSData = SiS_LVDS1280x960Data_2; break;
+ case 0: LVDSData = SiS_Pr->SiS_LVDS1024x768Data_1; break;
+ case 1: LVDSData = SiS_Pr->SiS_LVDS1280x1024Data_1; break;
+ case 2: LVDSData = SiS_Pr->SiS_LVDS1280x960Data_1; break;
+ case 3: LVDSData = SiS_Pr->SiS_LCDA1400x1050Data_1; break;
+ case 4: LVDSData = SiS_Pr->SiS_LCDA1600x1200Data_1; break;
+ case 5: LVDSData = SiS_Pr->SiS_LVDS1024x768Data_2; break;
+ case 6: LVDSData = SiS_Pr->SiS_LVDS1280x1024Data_2; break;
+ case 7: LVDSData = SiS_Pr->SiS_LVDS1280x960Data_2; break;
+ case 8: LVDSData = SiS_Pr->SiS_LCDA1400x1050Data_2; break;
+ case 9: LVDSData = SiS_Pr->SiS_LCDA1600x1200Data_2; break;
+ default: LVDSData = SiS_Pr->SiS_LVDS1024x768Data_1; break;
}
} else {
- /* TW: SiS630/301B needs LVDS Data! */
- if( (HwDeviceExtension->jChipType < SIS_315H) &&
- (SiS_VBType & VB_SIS301BLV302BLV) &&
- (SiS_VBInfo & SetCRT2ToLCD) )
- SiS_IF_DEF_LVDS = 1;
+ /* TW: 301BDH needs LVDS Data */
+ if( (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) &&
+ (SiS_Pr->SiS_VBType & VB_NoLCD) ) {
+ SiS_Pr->SiS_IF_DEF_LVDS = 1;
+ }
- SiS_GetCRT2Ptr(ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
+ SiS_GetCRT2Ptr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
&CRT2Index,&ResIndex,HwDeviceExtension);
- /* TW: SiS630/301B needs LVDS Data! */
- if( (HwDeviceExtension->jChipType < SIS_315H) &&
- (SiS_VBType & VB_SIS301BLV302BLV) &&
- (SiS_VBInfo & SetCRT2ToLCD) )
- SiS_IF_DEF_LVDS = 0;
+ /* TW: 301BDH needs LVDS Data */
+ if( (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) &&
+ (SiS_Pr->SiS_VBType & VB_NoLCD) ) {
+ SiS_Pr->SiS_IF_DEF_LVDS = 0;
+ }
switch (CRT2Index) {
- case 0: LVDSData = SiS_LVDS800x600Data_1; break;
- case 1: LVDSData = SiS_LVDS1024x768Data_1; break;
- case 2: LVDSData = SiS_LVDS1280x1024Data_1; break;
- case 3: LVDSData = SiS_LVDS800x600Data_2; break;
- case 4: LVDSData = SiS_LVDS1024x768Data_2; break;
- case 5: LVDSData = SiS_LVDS1280x1024Data_2; break;
- case 6: LVDSData = SiS_LVDS640x480Data_1; break;
- case 7: LVDSData = SiS_LVDSXXXxXXXData_1; break; /* TW: New */
- case 8: LVDSData = SiS_LVDS1400x1050Data_1; break; /* TW: New */
- case 9: LVDSData = SiS_LVDS1400x1050Data_2; break; /* TW: New */
- case 10: LVDSData = SiS_CHTVUNTSCData; break;
- case 11: LVDSData = SiS_CHTVONTSCData; break;
- case 12: LVDSData = SiS_CHTVUPALData; break;
- case 13: LVDSData = SiS_CHTVOPALData; break;
- case 14: LVDSData = SiS_LVDS320x480Data_1; break;
- case 15: LVDSData = SiS_LVDS1024x600Data_1; break; /* TW: New */
- case 16: LVDSData = SiS_LVDS1152x768Data_1; break; /* TW: New */
- case 17: LVDSData = SiS_LVDS1024x600Data_2; break; /* TW: New */
- case 18: LVDSData = SiS_LVDS1152x768Data_2; break; /* TW: New */
+ case 0: LVDSData = SiS_Pr->SiS_LVDS800x600Data_1; break;
+ case 1: LVDSData = SiS_Pr->SiS_LVDS1024x768Data_1; break;
+ case 2: LVDSData = SiS_Pr->SiS_LVDS1280x1024Data_1; break;
+ case 3: LVDSData = SiS_Pr->SiS_LVDS800x600Data_2; break;
+ case 4: LVDSData = SiS_Pr->SiS_LVDS1024x768Data_2; break;
+ case 5: LVDSData = SiS_Pr->SiS_LVDS1280x1024Data_2; break;
+ case 6: LVDSData = SiS_Pr->SiS_LVDS640x480Data_1; break;
+ case 7: LVDSData = SiS_Pr->SiS_LVDSXXXxXXXData_1; break; /* TW: New */
+ case 8: LVDSData = SiS_Pr->SiS_LVDS1400x1050Data_1; break; /* TW: New */
+ case 9: LVDSData = SiS_Pr->SiS_LVDS1400x1050Data_2; break; /* TW: New */
+ case 10: LVDSData = SiS_Pr->SiS_CHTVUNTSCData; break;
+ case 11: LVDSData = SiS_Pr->SiS_CHTVONTSCData; break;
+ case 12: LVDSData = SiS_Pr->SiS_CHTVUPALData; break;
+ case 13: LVDSData = SiS_Pr->SiS_CHTVOPALData; break;
+ case 14: LVDSData = SiS_Pr->SiS_LVDS320x480Data_1; break;
+ case 15: LVDSData = SiS_Pr->SiS_LVDS1024x600Data_1; break; /* TW: New */
+ case 16: LVDSData = SiS_Pr->SiS_LVDS1152x768Data_1; break; /* TW: New */
+ case 17: LVDSData = SiS_Pr->SiS_LVDS1024x600Data_2; break; /* TW: New */
+ case 18: LVDSData = SiS_Pr->SiS_LVDS1152x768Data_2; break; /* TW: New */
+ case 19: LVDSData = SiS_Pr->SiS_LVDS1280x768Data_1; break; /* TW: New */
+ case 20: LVDSData = SiS_Pr->SiS_LVDS1280x768Data_2; break; /* TW: New */
+ case 90: LVDSData = SiS_Pr->SiS_CHTVUPALMData; break;
+ case 91: LVDSData = SiS_Pr->SiS_CHTVOPALMData; break;
+ case 92: LVDSData = SiS_Pr->SiS_CHTVUPALNData; break;
+ case 93: LVDSData = SiS_Pr->SiS_CHTVOPALNData; break;
+ case 99: LVDSData = SiS_Pr->SiS_CHTVSOPALData; break; /* TW: Super Overscan */
+ default: LVDSData = SiS_Pr->SiS_LVDS1024x768Data_1; break;
}
}
- SiS_VGAHT = (LVDSData+ResIndex)->VGAHT;
- SiS_VGAVT = (LVDSData+ResIndex)->VGAVT;
- SiS_HT = (LVDSData+ResIndex)->LCDHT;
- SiS_VT = (LVDSData+ResIndex)->LCDVT;
-
- if( (SiS_IF_DEF_LVDS == 0) && (SiS_VBType & VB_SIS301BLV302BLV)) {
-
- if(!(SiS_LCDInfo & LCDNonExpanding)){
- if(SiS_LCDResInfo == Panel1024x768){
- SiS_HDE = 1024;
- SiS_VDE = 768;
- } else if(SiS_LCDResInfo == Panel1280x1024){
- SiS_HDE = 1280;
- SiS_VDE = 1024;
+ SiS_Pr->SiS_VGAHT = (LVDSData+ResIndex)->VGAHT;
+ SiS_Pr->SiS_VGAVT = (LVDSData+ResIndex)->VGAVT;
+ SiS_Pr->SiS_HT = (LVDSData+ResIndex)->LCDHT;
+ SiS_Pr->SiS_VT = (LVDSData+ResIndex)->LCDVT;
+
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
+
+ if(!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)){
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768){
+ SiS_Pr->SiS_HDE = 1024;
+ SiS_Pr->SiS_VDE = 768;
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024){
+ SiS_Pr->SiS_HDE = 1280;
+ SiS_Pr->SiS_VDE = 1024;
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050){
+ SiS_Pr->SiS_HDE = 1400;
+ SiS_Pr->SiS_VDE = 1050;
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200){
+ SiS_Pr->SiS_HDE = 1600;
+ SiS_Pr->SiS_VDE = 1200;
} else {
- SiS_HDE = 1280;
- SiS_VDE = 960;
+ SiS_Pr->SiS_HDE = 1280;
+ SiS_Pr->SiS_VDE = 960;
}
}
} else {
- if(SiS_IF_DEF_TRUMPION == 0) {
- if((SiS_VBInfo & SetCRT2ToLCD) && (!(SiS_LCDInfo & 0x0100))) {
- if(SiS_LCDResInfo != Panel640x480) {
- if((!(SiS_LCDInfo & LCDNonExpanding)) || (SiS_SetFlag & CRT2IsVGA)) {
- if(SiS_LCDResInfo == Panel800x600) {
- SiS_HDE = 800;
- SiS_VDE = 600;
- } else if(SiS_LCDResInfo == Panel1024x768) {
- SiS_HDE = 1024;
- SiS_VDE = 768;
- } else if(SiS_LCDResInfo == Panel1280x1024) {
- SiS_HDE = 1280;
- SiS_VDE = 1024;
- } else if(SiS_LCDResInfo == Panel1024x600){
- SiS_HDE = 1024;
- SiS_VDE = 600;
- } else if(SiS_LCDResInfo == Panel1400x1050){
- SiS_HDE = 1400;
- SiS_VDE = 1050;
+ if(SiS_Pr->SiS_IF_DEF_TRUMPION == 0) {
+ if((SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) && (!(SiS_Pr->SiS_LCDInfo & LCDPass11))) {
+ if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) {
+ if((!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) || (SiS_Pr->SiS_SetFlag & SetDOSMode)) {
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) {
+ SiS_Pr->SiS_HDE = 800;
+ SiS_Pr->SiS_VDE = 600;
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) {
+ SiS_Pr->SiS_HDE = 1024;
+ SiS_Pr->SiS_VDE = 600;
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) {
+ SiS_Pr->SiS_HDE = 1024;
+ SiS_Pr->SiS_VDE = 768;
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1152x768) {
+ SiS_Pr->SiS_HDE = 1152;
+ SiS_Pr->SiS_VDE = 768;
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1152x864) {
+ SiS_Pr->SiS_HDE = 1152;
+ SiS_Pr->SiS_VDE = 864;
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x768) {
+ SiS_Pr->SiS_HDE = 1280;
+ SiS_Pr->SiS_VDE = 768;
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) {
+ SiS_Pr->SiS_HDE = 1280;
+ SiS_Pr->SiS_VDE = 1024;
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) {
+ SiS_Pr->SiS_HDE = 1400;
+ SiS_Pr->SiS_VDE = 1050;
} else {
- SiS_HDE = 1152;
- SiS_VDE = 768;
+ SiS_Pr->SiS_HDE = 1600;
+ SiS_Pr->SiS_VDE = 1200;
}
- if(SiS_IF_DEF_FSTN) {
- SiS_HDE = 320;
- SiS_VDE = 480;
+ if(SiS_Pr->SiS_IF_DEF_FSTN) {
+ SiS_Pr->SiS_HDE = 320;
+ SiS_Pr->SiS_VDE = 480;
}
}
}
@@ -2725,111 +3319,130 @@ SiS_GetCRT2DataLVDS(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
}
}
-/* TW: Checked against 630/301B BIOS; does not check VDE values for LCD */
void
-SiS_GetCRT2Data301(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
- USHORT RefreshRateTableIndex,
- PSIS_HW_DEVICE_INFO HwDeviceExtension)
+SiS_GetCRT2Data301(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+ USHORT RefreshRateTableIndex,
+ PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
USHORT tempax,tempbx,modeflag;
USHORT resinfo;
USHORT CRT2Index,ResIndex;
- SiS_LCDDataStruct *LCDPtr=NULL;
- SiS_TVDataStruct *TVPtr=NULL;
+ const SiS_LCDDataStruct *LCDPtr = NULL;
+ const SiS_TVDataStruct *TVPtr = NULL;
- if(ModeNo<=0x13) {
- modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
- resinfo = SiS_SModeIDTable[ModeIdIndex].St_ResInfo;
+ if(ModeNo <= 0x13) {
+ modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
+ resinfo = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo;
} else {
- modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
- resinfo = SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
+ modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
}
- SiS_NewFlickerMode = 0;
- SiS_RVBHRS = 50;
- SiS_RY1COE = 0;
- SiS_RY2COE = 0;
- SiS_RY3COE = 0;
- SiS_RY4COE = 0;
+
+ SiS_Pr->SiS_NewFlickerMode = 0;
+ SiS_Pr->SiS_RVBHRS = 50;
+ SiS_Pr->SiS_RY1COE = 0;
+ SiS_Pr->SiS_RY2COE = 0;
+ SiS_Pr->SiS_RY3COE = 0;
+ SiS_Pr->SiS_RY4COE = 0;
- SiS_GetCRT2ResInfo(ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension);
+ SiS_GetCRT2ResInfo(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension);
/* TW: For VGA2 ("RAMDAC2") */
- if(SiS_VBInfo & SetCRT2ToRAMDAC){
- SiS_GetRAMDAC2DATA(ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC){
+ SiS_GetRAMDAC2DATA(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
HwDeviceExtension);
return;
}
/* TW: For TV */
- if(SiS_VBInfo & SetCRT2ToTV) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
- SiS_GetCRT2Ptr(ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
+ SiS_GetCRT2Ptr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
&CRT2Index,&ResIndex,HwDeviceExtension);
switch (CRT2Index) {
- case 2: TVPtr = SiS_ExtHiTVData; break;
- case 3: TVPtr = SiS_ExtPALData; break;
- case 4: TVPtr = SiS_ExtNTSCData; break;
- case 7: TVPtr = SiS_St1HiTVData; break;
- case 8: TVPtr = SiS_StPALData; break;
- case 9: TVPtr = SiS_StNTSCData; break;
- case 12: TVPtr = SiS_St2HiTVData; break;
- default: TVPtr = SiS_StPALData; break; /* TW: Just to avoid a crash */
+ case 2: TVPtr = SiS_Pr->SiS_ExtHiTVData; break;
+/* case 7: TVPtr = SiS_Pr->SiS_St1HiTVData; break; */
+ case 12: TVPtr = SiS_Pr->SiS_St2HiTVData; break;
+ case 3: TVPtr = SiS_Pr->SiS_ExtPALData; break;
+ case 4: TVPtr = SiS_Pr->SiS_ExtNTSCData; break;
+ case 8: TVPtr = SiS_Pr->SiS_StPALData; break;
+ case 9: TVPtr = SiS_Pr->SiS_StNTSCData; break;
+ default: TVPtr = SiS_Pr->SiS_StPALData; break; /* TW: Just to avoid a crash */
}
- SiS_RVBHCMAX = (TVPtr+ResIndex)->RVBHCMAX;
- SiS_RVBHCFACT = (TVPtr+ResIndex)->RVBHCFACT;
- SiS_VGAHT = (TVPtr+ResIndex)->VGAHT;
- SiS_VGAVT = (TVPtr+ResIndex)->VGAVT;
- SiS_HDE = (TVPtr+ResIndex)->TVHDE;
- SiS_VDE = (TVPtr+ResIndex)->TVVDE;
- SiS_RVBHRS = (TVPtr+ResIndex)->RVBHRS;
- SiS_NewFlickerMode = (TVPtr+ResIndex)->FlickerMode;
-
- if(SiS_VBInfo & SetCRT2ToHiVisionTV) {
-
- if(resinfo == 0x08) SiS_NewFlickerMode = 0x40;
- if(resinfo == 0x09) SiS_NewFlickerMode = 0x40;
- if(resinfo == 0x12) SiS_NewFlickerMode = 0x40; /* TW: Was resinfo == 0x10 */
-
- if(SiS_VGAVDE == 350) SiS_SetFlag |= TVSimuMode;
-
- SiS_HT = ExtHiTVHT;
- SiS_VT = ExtHiTVVT;
- if(SiS_VBInfo & SetInSlaveMode) {
- if(SiS_SetFlag & TVSimuMode) {
- SiS_HT = StHiTVHT;
- SiS_VT = StHiTVVT;
- if(!(modeflag & Charx8Dot)){
- SiS_HT = StHiTextTVHT;
- SiS_VT = StHiTextTVVT;
- }
+ SiS_Pr->SiS_RVBHCMAX = (TVPtr+ResIndex)->RVBHCMAX;
+ SiS_Pr->SiS_RVBHCFACT = (TVPtr+ResIndex)->RVBHCFACT;
+ SiS_Pr->SiS_VGAHT = (TVPtr+ResIndex)->VGAHT;
+ SiS_Pr->SiS_VGAVT = (TVPtr+ResIndex)->VGAVT;
+ SiS_Pr->SiS_HDE = (TVPtr+ResIndex)->TVHDE;
+ SiS_Pr->SiS_VDE = (TVPtr+ResIndex)->TVVDE;
+ SiS_Pr->SiS_RVBHRS = (TVPtr+ResIndex)->RVBHRS;
+ SiS_Pr->SiS_NewFlickerMode = (TVPtr+ResIndex)->FlickerMode;
+ if(modeflag & HalfDCLK) {
+ SiS_Pr->SiS_RVBHRS = (TVPtr+ResIndex)->HALFRVBHRS;
+ }
+
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) {
+
+ if(SiS_Pr->SiS_HiVision != 3) {
+
+ if(resinfo == 0x08) SiS_Pr->SiS_NewFlickerMode = 0x40;
+ if(resinfo == 0x09) SiS_Pr->SiS_NewFlickerMode = 0x40;
+ if(resinfo == 0x12) SiS_Pr->SiS_NewFlickerMode = 0x40;
+
+ }
+
+ switch(SiS_Pr->SiS_HiVision) {
+ case 2:
+ case 1:
+ case 0:
+ SiS_Pr->SiS_HT = 0x6b4;
+ SiS_Pr->SiS_VT = 0x20d;
+ /* Don't care about TVSimuMode */
+ break;
+ default:
+ if(SiS_Pr->SiS_VGAVDE == 350) SiS_Pr->SiS_SetFlag |= TVSimuMode;
+
+ SiS_Pr->SiS_HT = ExtHiTVHT;
+ SiS_Pr->SiS_VT = ExtHiTVVT;
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
+ if(SiS_Pr->SiS_SetFlag & TVSimuMode) {
+ SiS_Pr->SiS_HT = StHiTVHT;
+ SiS_Pr->SiS_VT = StHiTVVT;
+ if(!(modeflag & Charx8Dot)){
+ SiS_Pr->SiS_HT = StHiTextTVHT;
+ SiS_Pr->SiS_VT = StHiTextTVVT;
+ }
+ }
}
- }
+ }
} else {
- SiS_RY1COE = (TVPtr+ResIndex)->RY1COE;
- SiS_RY2COE = (TVPtr+ResIndex)->RY2COE;
- SiS_RY3COE = (TVPtr+ResIndex)->RY3COE;
- SiS_RY4COE = (TVPtr+ResIndex)->RY4COE;
+ SiS_Pr->SiS_RY1COE = (TVPtr+ResIndex)->RY1COE;
+ SiS_Pr->SiS_RY2COE = (TVPtr+ResIndex)->RY2COE;
+ SiS_Pr->SiS_RY3COE = (TVPtr+ResIndex)->RY3COE;
+ SiS_Pr->SiS_RY4COE = (TVPtr+ResIndex)->RY4COE;
if(modeflag & HalfDCLK) {
- SiS_RY1COE = 0x00;
- SiS_RY2COE = 0xf4;
- SiS_RY3COE = 0x10;
- SiS_RY4COE = 0x38;
+ SiS_Pr->SiS_RY1COE = 0x00;
+ SiS_Pr->SiS_RY2COE = 0xf4;
+ SiS_Pr->SiS_RY3COE = 0x10;
+ SiS_Pr->SiS_RY4COE = 0x38;
}
- if(!(SiS_VBInfo & SetPALTV)){
- SiS_HT = NTSCHT;
- if((ModeNo == 0x4a) || (ModeNo == 0x38)) SiS_HT = NTSC2HT;
- SiS_VT = NTSCVT;
+ if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) {
+ SiS_Pr->SiS_HT = NTSCHT;
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ if((ModeNo == 0x4a) || (ModeNo == 0x38)) SiS_Pr->SiS_HT = NTSC2HT;
+ }
+ SiS_Pr->SiS_VT = NTSCVT;
} else {
- SiS_HT = PALHT;
- SiS_VT = PALVT;
+ SiS_Pr->SiS_HT = PALHT;
+ SiS_Pr->SiS_VT = PALVT;
}
}
@@ -2838,115 +3451,134 @@ SiS_GetCRT2Data301(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
}
/* TW: For LCD */
- /* TW: Checked against 650/301LV; CRT2Index different (but does not matter) */
- if(SiS_VBInfo & SetCRT2ToLCD) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
- SiS_GetCRT2Ptr(ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
+ SiS_GetCRT2Ptr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
&CRT2Index,&ResIndex,HwDeviceExtension);
switch (CRT2Index) {
- case 0: LCDPtr = SiS_ExtLCD1024x768Data; break; /* VESA Timing */
- case 1: LCDPtr = SiS_ExtLCD1280x1024Data; break; /* VESA Timing */
- case 5: LCDPtr = SiS_StLCD1024x768Data; break; /* Obviously unused */
- case 6: LCDPtr = SiS_StLCD1280x1024Data; break; /* Obviously unused */
- case 10: LCDPtr = SiS_St2LCD1024x768Data; break; /* Non-VESA Timing */
- case 11: LCDPtr = SiS_St2LCD1280x1024Data; break; /* Non-VESA Timing */
- case 13: LCDPtr = SiS_NoScaleData1024x768; break; /* Non-expanding */
- case 14: LCDPtr = SiS_NoScaleData1280x1024; break; /* Non-expanding */
- case 15: LCDPtr = SiS_LCD1280x960Data; break; /* 1280x960 */
- default: LCDPtr = SiS_ExtLCD1024x768Data; break; /* Just to avoid a crash */
+ case 0: LCDPtr = SiS_Pr->SiS_ExtLCD1024x768Data; break; /* VESA Timing */
+ case 1: LCDPtr = SiS_Pr->SiS_ExtLCD1280x1024Data; break; /* VESA Timing */
+ case 5: LCDPtr = SiS_Pr->SiS_StLCD1024x768Data; break; /* Obviously unused */
+ case 6: LCDPtr = SiS_Pr->SiS_StLCD1280x1024Data; break; /* Obviously unused */
+ case 10: LCDPtr = SiS_Pr->SiS_St2LCD1024x768Data; break; /* Non-VESA Timing */
+ case 11: LCDPtr = SiS_Pr->SiS_St2LCD1280x1024Data; break; /* Non-VESA Timing */
+ case 13: LCDPtr = SiS_Pr->SiS_NoScaleData1024x768; break; /* Non-expanding */
+ case 14: LCDPtr = SiS_Pr->SiS_NoScaleData1280x1024; break; /* Non-expanding */
+ case 15: LCDPtr = SiS_Pr->SiS_LCD1280x960Data; break; /* 1280x960 */
+ case 20: LCDPtr = SiS_Pr->SiS_ExtLCD1400x1050Data; break; /* VESA Timing */
+ case 21: LCDPtr = SiS_Pr->SiS_NoScaleData1400x1050; break; /* Non-expanding (let panel scale) */
+ case 22: LCDPtr = SiS_Pr->SiS_StLCD1400x1050Data; break; /* Non-VESA Timing (let panel scale) */
+ case 23: LCDPtr = SiS_Pr->SiS_ExtLCD1600x1200Data; break; /* VESA Timing */
+ case 24: LCDPtr = SiS_Pr->SiS_NoScaleData1600x1200; break; /* Non-expanding */
+ case 25: LCDPtr = SiS_Pr->SiS_StLCD1600x1200Data; break; /* Non-VESA Timing */
+ default: LCDPtr = SiS_Pr->SiS_ExtLCD1024x768Data; break; /* Just to avoid a crash */
}
- SiS_RVBHCMAX = (LCDPtr+ResIndex)->RVBHCMAX;
- SiS_RVBHCFACT = (LCDPtr+ResIndex)->RVBHCFACT;
- SiS_VGAHT = (LCDPtr+ResIndex)->VGAHT;
- SiS_VGAVT = (LCDPtr+ResIndex)->VGAVT;
- SiS_HT = (LCDPtr+ResIndex)->LCDHT;
- SiS_VT = (LCDPtr+ResIndex)->LCDVT;
+ SiS_Pr->SiS_RVBHCMAX = (LCDPtr+ResIndex)->RVBHCMAX;
+ SiS_Pr->SiS_RVBHCFACT = (LCDPtr+ResIndex)->RVBHCFACT;
+ SiS_Pr->SiS_VGAHT = (LCDPtr+ResIndex)->VGAHT;
+ SiS_Pr->SiS_VGAVT = (LCDPtr+ResIndex)->VGAVT;
+ SiS_Pr->SiS_HT = (LCDPtr+ResIndex)->LCDHT;
+ SiS_Pr->SiS_VT = (LCDPtr+ResIndex)->LCDVT;
+
+#ifdef TWDEBUG
+ xf86DrvMsg(0, X_INFO,
+ "GetCRT2Data: Index %d ResIndex %d\n", CRT2Index, ResIndex);
+#endif
tempax = 1024;
- if(SiS_SetFlag & LCDVESATiming) {
- if (SiS_VGAVDE == 350) tempbx = 560;
- else if(SiS_VGAVDE == 400) tempbx = 640;
- else tempbx = 768;
+ if(SiS_Pr->SiS_SetFlag & LCDVESATiming) {
+ if(HwDeviceExtension->jChipType < SIS_315H) {
+ if (SiS_Pr->SiS_VGAVDE == 350) tempbx = 560;
+ else if(SiS_Pr->SiS_VGAVDE == 400) tempbx = 640;
+ else tempbx = 768;
+ } else {
+ tempbx = 768;
+ }
} else {
- if (SiS_VGAVDE == 357) tempbx = 527;
- else if(SiS_VGAVDE == 420) tempbx = 620;
- else if(SiS_VGAVDE == 525) tempbx = 775;
- else if(SiS_VGAVDE == 600) tempbx = 775;
- else if(SiS_VGAVDE == 350) tempbx = 560;
- else if(SiS_VGAVDE == 400) tempbx = 640;
- else tempbx = 768;
+ if (SiS_Pr->SiS_VGAVDE == 357) tempbx = 527;
+ else if(SiS_Pr->SiS_VGAVDE == 420) tempbx = 620;
+ else if(SiS_Pr->SiS_VGAVDE == 525) tempbx = 775;
+ else if(SiS_Pr->SiS_VGAVDE == 600) tempbx = 775;
+ else if(SiS_Pr->SiS_VGAVDE == 350) tempbx = 560;
+ else if(SiS_Pr->SiS_VGAVDE == 400) tempbx = 640;
+ else tempbx = 768;
}
- if(SiS_LCDResInfo == Panel1280x1024){
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) {
tempax = 1280;
- if (SiS_VGAVDE == 360) tempbx = 768;
- else if(SiS_VGAVDE == 375) tempbx = 800;
- else if(SiS_VGAVDE == 405) tempbx = 864;
- else tempbx = 1024;
+ if (SiS_Pr->SiS_VGAVDE == 360) tempbx = 768;
+ else if(SiS_Pr->SiS_VGAVDE == 375) tempbx = 800;
+ else if(SiS_Pr->SiS_VGAVDE == 405) tempbx = 864;
+ else tempbx = 1024;
}
- if(SiS_LCDResInfo == Panel1280x960){
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x960) {
tempax = 1280;
- if (SiS_VGAVDE == 350) tempbx = 700;
- else if(SiS_VGAVDE == 400) tempbx = 800;
- else if(SiS_VGAVDE == 1024) tempbx = 960;
- else tempbx = 960;
+ if (SiS_Pr->SiS_VGAVDE == 350) tempbx = 700;
+ else if(SiS_Pr->SiS_VGAVDE == 400) tempbx = 800;
+ else if(SiS_Pr->SiS_VGAVDE == 1024) tempbx = 960;
+ else tempbx = 960;
+ }
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) {
+ tempax = 1400;
+ tempbx = 1050;
+ }
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) {
+ tempax = 1600;
+ tempbx = 1200;
}
- if(SiS_LCDInfo & LCDNonExpanding) {
- tempax = SiS_VGAHDE;
- tempbx = SiS_VGAVDE;
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) {
+ tempax = SiS_Pr->SiS_VGAHDE;
+ tempbx = SiS_Pr->SiS_VGAVDE;
}
- SiS_HDE = tempax;
- SiS_VDE = tempbx;
+ SiS_Pr->SiS_HDE = tempax;
+ SiS_Pr->SiS_VDE = tempbx;
return;
}
}
USHORT
-SiS_GetResInfo(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex)
+SiS_GetResInfo(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex)
{
USHORT resindex;
- if(ModeNo<=0x13)
- resindex=SiS_SModeIDTable[ModeIdIndex].St_ResInfo;
+ if(ModeNo <= 0x13)
+ resindex=SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo;
else
- resindex=SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
+ resindex=SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
return(resindex);
}
-/* TW: Checked against 650/301LV, 650/LVDS, 630/LVDS, 630/301 and 630/301B BIOS */
void
-SiS_GetCRT2ResInfo(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+SiS_GetCRT2ResInfo(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
USHORT xres,yres,modeflag=0,resindex;
- resindex = SiS_GetResInfo(ROMAddr,ModeNo,ModeIdIndex);
+ resindex = SiS_GetResInfo(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex);
if(ModeNo <= 0x13) {
- xres = SiS_StResInfo[resindex].HTotal;
- yres = SiS_StResInfo[resindex].VTotal;
+ xres = SiS_Pr->SiS_StResInfo[resindex].HTotal;
+ yres = SiS_Pr->SiS_StResInfo[resindex].VTotal;
} else {
- xres = SiS_ModeResInfo[resindex].HTotal;
- yres = SiS_ModeResInfo[resindex].VTotal;
- modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ xres = SiS_Pr->SiS_ModeResInfo[resindex].HTotal;
+ yres = SiS_Pr->SiS_ModeResInfo[resindex].VTotal;
+ modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
}
- /* TW: Inserted entire if-section from 650/LVDS BIOS 1.10.07: */
- if((HwDeviceExtension->jChipType >= SIS_315H) && (SiS_IF_DEF_LVDS == 1)) {
- if((ModeNo != 0x03) && (SiS_SetFlag & CRT2IsVGA)) {
+ if((HwDeviceExtension->jChipType >= SIS_315H) && (SiS_Pr->SiS_IF_DEF_LVDS == 1)) {
+ if((ModeNo != 0x03) && (SiS_Pr->SiS_SetFlag & SetDOSMode)) {
if(yres == 350) yres = 400;
}
- if(SiS_GetReg1(SiS_P3d4,0x3a) & 0x01) {
- if(SiS_GetReg1(SiS_P3d4,0x34) == 0x12)
- yres = 400;
+ if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x3a) & 0x01) {
+ if(ModeNo == 0x12) yres = 400;
}
}
if(ModeNo > 0x13) {
- if(SiS_IF_DEF_FSTN == 1){
+ if(SiS_Pr->SiS_IF_DEF_FSTN == 1){
xres *= 2;
yres *= 2;
} else {
@@ -2955,178 +3587,243 @@ SiS_GetCRT2ResInfo(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
}
}
- if(SiS_IF_DEF_LVDS == 0) {
- /* TW: Inserted from 650/301LV BIOS */
- if(SiS_VBInfo & SetCRT2ToLCDA) {
- if(xres == 720) xres = 640;
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) {
+ if(xres == 720) xres = 640;
} else {
- if(xres == 720) xres = 640;
- if(SiS_LCDResInfo == Panel1280x1024) {
- if(yres == 400) yres = 405;
- if(yres == 350) yres = 360;
- if(SiS_SetFlag & LCDVESATiming) {
- if(yres == 360) yres = 375;
- }
- }
- if(SiS_LCDResInfo == Panel1024x768){
- if(!(SiS_SetFlag & LCDVESATiming)) {
- if(!(SiS_LCDInfo & LCDNonExpanding)) {
- if(yres == 350) yres = 357;
- if(yres == 400) yres = 420;
- if(yres == 480) yres = 525;
- }
- }
- }
- /* TW: Inserted for 630/301B */
- if(HwDeviceExtension->jChipType < SIS_315H) {
- if(SiS_VBType & VB_SIS301BLV302BLV) {
- if(xres == 720) xres = 640;
+ if(SiS_Pr->SiS_VBType & VB_NoLCD) { /* TW: 301BDH */
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ if(xres == 720) xres = 640;
+ }
+ if(SiS_Pr->SiS_SetFlag & SetDOSMode) {
+ yres = 400;
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ if(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x17) & 0x80) yres = 480;
+ } else {
+ if(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13) & 0x80) yres = 480;
+ }
+ }
+ } else {
+ if(SiS_Pr->SiS_VBInfo & (SetCRT2ToAVIDEO | /* (Allow 720 for VGA2) */
+ SetCRT2ToSVIDEO |
+ SetCRT2ToSCART |
+ SetCRT2ToLCD |
+ SetCRT2ToHiVisionTV)) {
+ if(xres == 720) xres = 640;
+ }
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) {
+ if(ModeNo <= 0x13) {
+ /* TW: This is wrong for 640x400 *graphics* mode */
+ if(yres == 400) yres = 405;
+ }
+ if(yres == 350) yres = 360;
+ if(SiS_Pr->SiS_SetFlag & LCDVESATiming) {
+ if(yres == 360) yres = 375;
+ }
+ }
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768){
+ if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) {
+ if(!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) {
+ if(yres == 350) yres = 357;
+ if(yres == 400) yres = 420;
+ if(yres == 480) yres = 525;
+ }
+ }
+ }
}
}
}
} else {
if(xres == 720) xres = 640;
- /* TW: Inserted from 650/LVDS and 630/LVDS BIOS */
- if(SiS_SetFlag & CRT2IsVGA) {
+ if(SiS_Pr->SiS_SetFlag & SetDOSMode) {
yres = 400;
if(HwDeviceExtension->jChipType >= SIS_315H) {
- if(SiS_GetReg1(SiS_P3c4,0x17) & 0x80) yres = 480;
+ if(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x17) & 0x80) yres = 480;
} else {
- if(SiS_GetReg1(SiS_P3c4,0x13) & 0x80) yres = 480;
+ if(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13) & 0x80) yres = 480;
}
}
}
- SiS_VGAHDE = SiS_HDE = xres;
- SiS_VGAVDE = SiS_VDE = yres;
+ SiS_Pr->SiS_VGAHDE = SiS_Pr->SiS_HDE = xres;
+ SiS_Pr->SiS_VGAVDE = SiS_Pr->SiS_VDE = yres;
}
-/* TW: Checked against 650/301 and 650/LVDS (1.10.07) BIOS; modified for new panel resolutions */
-/* TW: Done differently in 630/301B BIOS; but same effect; checked against 630/301 */
void
-SiS_GetCRT2Ptr(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+SiS_GetCRT2Ptr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
USHORT RefreshRateTableIndex,USHORT *CRT2Index,USHORT *ResIndex,
PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
USHORT tempbx=0,tempal=0;
USHORT Flag,resinfo=0;
- if(SiS_IF_DEF_LVDS == 0) {
- if(SiS_VBInfo & SetCRT2ToLCD){ /* LCD */
- if(SiS_LCDResInfo == Panel1280x960) tempbx = 14;
- else if(SiS_LCDInfo & LCDNonExpanding) {
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
+
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { /* LCD */
+
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x960) {
+ tempbx = 15;
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) {
+ tempbx = 20;
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx = 21;
+ else if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) tempbx = 22;
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) {
+ tempbx = 23;
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx = 24;
+ else if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) tempbx = 25;
+ } else if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) {
tempbx = 13;
- if(SiS_LCDResInfo == Panel1280x1024) tempbx++;
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) tempbx++;
} else {
- tempbx = SiS_LCDResInfo - Panel1024x768;
- if(!(SiS_SetFlag & LCDVESATiming)) {
+ tempbx = SiS_Pr->SiS_LCDResInfo - SiS_Pr->SiS_Panel1024x768;
+ if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) {
tempbx += 5;
/* GetRevisionID(); */
/* TW: BIOS only adds 5 once */
tempbx += 5;
}
}
- } else { /* TV */
- if(SiS_VBInfo & SetCRT2ToHiVisionTV){
- if(SiS_VGAVDE > 480) SiS_SetFlag &= (~TVSimuMode); /* TW: Was "(!TVSimuMode)" - WRONG */
+
+ } else { /* TV */
+
+ if((SiS_Pr->SiS_VBType & VB_SIS301B302B) &&
+ (SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV)) {
+ if(SiS_Pr->SiS_VGAVDE > 480) SiS_Pr->SiS_SetFlag &= (~TVSimuMode);
tempbx = 2;
- if(SiS_VBInfo & SetInSlaveMode) {
- if(!(SiS_SetFlag & TVSimuMode)) tempbx = 12; /* TW: Was 10! - WRONG */
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
+ if(!(SiS_Pr->SiS_SetFlag & TVSimuMode)) tempbx = 12;
}
} else {
- if(SiS_VBInfo & SetPALTV) tempbx = 3;
+ if(SiS_Pr->SiS_VBInfo & SetPALTV) tempbx = 3;
else tempbx = 4;
- if(SiS_SetFlag & TVSimuMode) tempbx += 5;
+ if(SiS_Pr->SiS_SetFlag & TVSimuMode) tempbx += 5;
}
+
}
- if(ModeNo <= 0x13)
- tempal = SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC;
- else
- tempal = SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
+ if(ModeNo <= 0x13) {
+ tempal = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC;
+ } else {
+ tempal = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
+ resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
+ }
tempal &= 0x3F;
- if((SiS_VBType & VB_SIS301BLV302BLV)
- && (SiS_VBInfo & (SetCRT2ToTV-SetCRT2ToHiVisionTV))) { /* TW: Added -Hivision (BIOS) */
+ if((SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) &&
+ (SiS_Pr->SiS_VBInfo & (SetCRT2ToTV-SetCRT2ToHiVisionTV))) {
if(tempal == 0x06) tempal = 0x07;
}
- if(SiS_VBInfo & SetCRT2ToTV) {
- if((ModeNo == 0x31) || (ModeNo == 0x32)) tempal = 6;
+ /* TW: Inserted from 300/301LV BIOS */
+ if((HwDeviceExtension->jChipType == SIS_300) &&
+ (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) {
+ if(ModeNo > 0x13) {
+ if((resinfo == 0x0c) || (resinfo == 0x0d)) /* 720 (index diff. on 310/325!) */
+ tempal = 6;
+ }
+ }
+
+ if(HwDeviceExtension->jChipType != SIS_300) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
+ if((ModeNo == 0x31) || (ModeNo == 0x32)) tempal = 6;
+ }
}
*CRT2Index = tempbx;
*ResIndex = tempal;
- } else { /* LVDS */
+ } else { /* LVDS, 301B-DH (if running on LCD) */
Flag = 1;
tempbx = 0;
- if(SiS_IF_DEF_CH70xx != 0) {
- if(!(SiS_VBInfo & SetCRT2ToLCD)) {
+ if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
+
+ if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) {
Flag = 0;
tempbx = 10;
- if(SiS_VBInfo & SetPALTV) tempbx += 2;
- if(SiS_VBInfo & SetCHTVOverScan) tempbx += 1;
+ if(SiS_Pr->SiS_VBInfo & SetCHTVOverScan) tempbx += 1;
+ if(SiS_Pr->SiS_VBInfo & SetPALTV) {
+ tempbx += 2;
+ if(SiS_Pr->SiS_CHSOverScan) tempbx = 99;
+ if(SiS_Pr->SiS_CHPALM) {
+ tempbx = 90;
+ if(SiS_Pr->SiS_VBInfo & SetCHTVOverScan) tempbx += 1;
+ } else if(SiS_Pr->SiS_CHPALN) {
+ tempbx = 92;
+ if(SiS_Pr->SiS_VBInfo & SetCHTVOverScan) tempbx += 1;
+ }
+
+ }
}
+
}
- if(Flag == 1) {
- tempbx = SiS_LCDResInfo - PanelMinLVDS;
- if(SiS_LCDResInfo <= Panel1280x1024) {
- if(SiS_LCDInfo & LCDNonExpanding) tempbx += 3;
- } else {
- if(SiS_LCDResInfo == Panel1400x1050) {
- tempbx = 8;
- if(SiS_LCDInfo & LCDNonExpanding) tempbx++;
- }
- if(SiS_LCDInfo & 0x0100) {
- tempbx = 7;
- }
-
- if(SiS_LCDResInfo == Panel640x480) tempbx = 6;
-
- /* TW: Inserted from 630/LVDS 2.04.5c BIOS */
- if(SiS_LCDResInfo == Panel1024x600) {
- tempbx = 15;
- if(SiS_LCDInfo & LCDNonExpanding) tempbx += 2;
- }
- if(SiS_LCDResInfo == Panel1152x768) {
- tempbx = 16;
- if(SiS_LCDInfo & LCDNonExpanding) tempbx += 2;
- }
- }
+ if(Flag) {
+
+ if(SiS_Pr->SiS_LCDResInfo <= SiS_Pr->SiS_Panel1280x1024) {
+
+ tempbx = SiS_Pr->SiS_LCDResInfo - SiS_Pr->SiS_PanelMinLVDS;
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx += 3;
+
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x768) {
+
+ tempbx = 18;
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx++;
+
+ }
+
+ if(SiS_Pr->SiS_LCDInfo & LCDPass11) {
+ tempbx = 7;
+ }
+
+ /* The following panels overrule LCDPass11: */
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480) {
+ tempbx = 6;
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) {
+ tempbx = 15;
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx += 2;
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1152x768) {
+ tempbx = 16;
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx += 2;
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) {
+ tempbx = 8;
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx++;
+ }
+
}
if(ModeNo <= 0x13)
- tempal = SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC;
+ tempal = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC;
else {
- tempal = SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
- resinfo = SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
+ tempal = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
+ resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
}
- if(SiS_IF_DEF_FSTN){
- if(SiS_LCDResInfo == Panel320x480){
+ if(SiS_Pr->SiS_IF_DEF_FSTN){
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel320x480){
tempbx = 14;
tempal = 6;
}
}
- /* TW: Inserted from 650/LVDS BIOS */
- if(SiS_SetFlag & CRT2IsVGA) {
- if(SiS_LCDResInfo != Panel640x480) tempal = 7;
+ if(SiS_Pr->SiS_SetFlag & SetDOSMode) {
+ if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) tempal = 7;
if(HwDeviceExtension->jChipType < SIS_315H) {
- /* TW: Inserted from 630/LVDS (2.04.5c) and 630/301B (II) BIOS */
- if(SiS_GetReg1(SiS_P3c4,0x13) & 0x80) tempal++;
+ if(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13) & 0x80) tempal++;
}
}
- /* TW: Inserted from 630/301B BIOS */
- if(SiS_VBType & VB_SIS301BLV302BLV) {
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
if(ModeNo > 0x13) {
- if((resinfo == 0x0c) || (resinfo == 0x0d))
- tempal = 6;
+ if(HwDeviceExtension->jChipType < SIS_315H) {
+ if((resinfo == 0x0c) || (resinfo == 0x0d)) /* 720 */
+ tempal = 6;
+ } else {
+ if((resinfo == 0x0d) || (resinfo == 0x0e)) /* 720 */
+ tempal = 6;
+ }
}
}
@@ -3136,63 +3833,71 @@ SiS_GetCRT2Ptr(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
}
void
-SiS_GetCRT2PtrA(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+SiS_GetCRT2PtrA(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
USHORT RefreshRateTableIndex,USHORT *CRT2Index,
USHORT *ResIndex)
{
USHORT tempbx,tempal;
- tempbx = SiS_LCDResInfo - Panel1024x768;
+ tempbx = SiS_Pr->SiS_LCDResInfo;
- if(SiS_LCDInfo & LCDNonExpanding) tempbx += 3;
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) tempbx = 4;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) tempbx = 3;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x960) tempbx = 2;
+ else tempbx -= SiS_Pr->SiS_Panel1024x768;
+
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx += 5;
if(ModeNo <= 0x13)
- tempal = SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC;
+ tempal = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC;
else
- tempal = SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
+ tempal = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
*CRT2Index = tempbx;
*ResIndex = tempal & 0x1F;
}
-/* TW: New from 650/301LV BIOS */
void
-SiS_GetCRT2Part2Ptr(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+SiS_GetCRT2Part2Ptr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
USHORT RefreshRateTableIndex,USHORT *CRT2Index,
USHORT *ResIndex)
{
USHORT tempbx,tempal;
if(ModeNo <= 0x13)
- tempal = SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC;
+ tempal = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC;
else
- tempal = SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
+ tempal = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
- tempbx = SiS_LCDResInfo - Panel1024x768;
+ tempbx = SiS_Pr->SiS_LCDResInfo;
- if(SiS_LCDInfo & LCDNonExpanding) tempbx += 2;
- else if(SiS_SetFlag & LCDVESATiming) tempbx += 4;
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx += 16;
+ else if(SiS_Pr->SiS_SetFlag & LCDVESATiming) tempbx += 32;
*CRT2Index = tempbx;
*ResIndex = tempal & 0x3F;
}
-/* TW: Checked against 650/LVDS (1.10.07) and 630/301B BIOS */
USHORT
-SiS_GetRatePtrCRT2(UCHAR *ROMAddr, USHORT ModeNo, USHORT ModeIdIndex)
+SiS_GetRatePtrCRT2(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT ModeNo, USHORT ModeIdIndex,
+ PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
SHORT LCDRefreshIndex[] = { 0x00, 0x00, 0x03, 0x01,
- 0x01, 0x01, 0x01, 0x01 };
+ 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01 };
USHORT RefreshRateTableIndex,i,backup_i;
- USHORT modeflag,index,temp;
+ USHORT modeflag,index,temp,backupindex;
- if (ModeNo <= 0x13)
- modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
+ if(SiS_Pr->UseCustomMode) return 0;
+
+ if(ModeNo <= 0x13)
+ modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
else
- modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
- if(SiS_IF_DEF_CH70xx != 0) {
- if(SiS_VBInfo & SetCRT2ToTV) {
+ if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
if(modeflag & HalfDCLK) return(0);
}
}
@@ -3205,74 +3910,82 @@ SiS_GetRatePtrCRT2(UCHAR *ROMAddr, USHORT ModeNo, USHORT ModeIdIndex)
* to take the first non-interlaced mode in SiS_Ext2Struct
*/
- index = SiS_GetReg1(SiS_P3d4,0x33);
- index >>= SiS_SelectCRT2Rate;
+ index = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x33);
+ index >>= SiS_Pr->SiS_SelectCRT2Rate;
index &= 0x0F;
+ backupindex = index;
if(index > 0) index--;
- /* TW: Added SetFlag and VBInfo checks; we don't care about index if we
- * are setting CRT1 rate!
- */
- if( (SiS_SetFlag & ProgrammingCRT2) &&
- (SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) )
- index = 0;
+ if(SiS_Pr->SiS_SetFlag & ProgrammingCRT2) {
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
+ if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) index = 0;
+ } else {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ if(SiS_Pr->SiS_VBType & VB_NoLCD)
+ index = 0;
+ else if(SiS_Pr->SiS_LCDInfo & DontExpandLCD)
+ index = backupindex = 0;
+ }
+ }
+ }
- if(SiS_SetFlag & ProgrammingCRT2) {
- if(SiS_IF_DEF_CH70xx != 0) {
- if(SiS_VBInfo & SetCRT2ToTV) {
+ if(SiS_Pr->SiS_SetFlag & ProgrammingCRT2) {
+ if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
index = 0;
}
}
- if(SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
- if(SiS_IF_DEF_LVDS == 0) {
- /* TW: This is not done in 630/301B BIOS */
- temp = LCDRefreshIndex[SiS_LCDResInfo];
- if(index > temp) index = temp;
+ if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
+ if(!(SiS_Pr->SiS_VBType & VB_NoLCD)) {
+ temp = LCDRefreshIndex[SiS_Pr->SiS_LCDResInfo];
+ if(index > temp) index = temp;
+ }
} else {
- index=0;
+ index = 0;
}
}
}
- RefreshRateTableIndex = SiS_EModeIDTable[ModeIdIndex].REFindex;
- ModeNo = SiS_RefIndex[RefreshRateTableIndex].ModeID;
+ RefreshRateTableIndex = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].REFindex;
+ ModeNo = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].ModeID;
- /* TW: Inserted from 650/LVDS 1.10.07 */
- if(SiS_IF_DEF_LVDS == 1) {
- if(!(SiS_VBInfo & DriverMode)) {
- if( (SiS_EModeIDTable[ModeIdIndex].Ext_VESAID == 0x105) ||
- (SiS_EModeIDTable[ModeIdIndex].Ext_VESAID == 0x107) ) {
- if(SiS_LCDResInfo <= Panel800x600)
- RefreshRateTableIndex++;
- }
- }
+ /* TW: Inserted from 650/LVDS 1.10.07, 650/30xLV 1.10.6s */
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ if(!(SiS_Pr->SiS_VBInfo & DriverMode)) {
+ if( (SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_VESAID == 0x105) ||
+ (SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_VESAID == 0x107) ) {
+ if(backupindex <= 1) RefreshRateTableIndex++;
+ }
+ }
}
i = 0;
do {
- if (SiS_RefIndex[RefreshRateTableIndex+i].ModeID != ModeNo) break;
- temp = SiS_RefIndex[RefreshRateTableIndex+i].Ext_InfoFlag;
+ if(SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + i].ModeID != ModeNo) break;
+ temp = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + i].Ext_InfoFlag;
temp &= ModeInfoFlag;
- if(temp < SiS_ModeType) break;
+ if(temp < SiS_Pr->SiS_ModeType) break;
i++;
index--;
} while(index != 0xFFFF);
- if(!(SiS_VBInfo & SetCRT2ToRAMDAC)) {
- if(SiS_VBInfo & SetInSlaveMode) {
- temp = SiS_RefIndex[RefreshRateTableIndex + i - 1].Ext_InfoFlag;
- if(temp & InterlaceMode) {
- i++;
- }
+ if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC)) {
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
+ temp = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + i - 1].Ext_InfoFlag;
+ if(temp & InterlaceMode) {
+ i++;
+ }
}
}
+
i--;
- if((SiS_SetFlag & ProgrammingCRT2) && (!(SiS_VBInfo & DisableCRT2Display))) {
+ if((SiS_Pr->SiS_SetFlag & ProgrammingCRT2) && (!(SiS_Pr->SiS_VBInfo & DisableCRT2Display))) {
backup_i = i;
- if (!(SiS_AdjustCRT2Rate(ROMAddr,ModeNo,ModeIdIndex,
- RefreshRateTableIndex,&i))) {
+ if (!(SiS_AdjustCRT2Rate(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,
+ RefreshRateTableIndex,&i,HwDeviceExtension))) {
/* TW: This is for avoiding random data to be used; i is
* in an undefined state if no matching CRT2 mode is
* found.
@@ -3284,93 +3997,233 @@ SiS_GetRatePtrCRT2(UCHAR *ROMAddr, USHORT ModeNo, USHORT ModeIdIndex)
return(RefreshRateTableIndex + i);
}
-/* Checked against 650/LVDS (1.10.07) BIOS */
+/* Checked against all (incl 650/LVDS (1.10.07), 630/301) BIOSes */
BOOLEAN
-SiS_AdjustCRT2Rate(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
- USHORT RefreshRateTableIndex,USHORT *i)
+SiS_AdjustCRT2Rate(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+ USHORT RefreshRateTableIndex,USHORT *i,PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
USHORT tempax,tempbx,resinfo;
USHORT modeflag,infoflag;
if (ModeNo <= 0x13)
- modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
+ modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
else
- modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
- resinfo = SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
- tempbx = SiS_RefIndex[RefreshRateTableIndex + (*i)].ModeID;
+ resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
+ tempbx = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + (*i)].ModeID;
tempax = 0;
- if(SiS_IF_DEF_LVDS == 0) {
- /* TW: For 301, 301B, 302B, 301LV, 302LV */
- if(SiS_VBInfo & SetCRT2ToRAMDAC) {
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC) {
tempax |= SupportRAMDAC2;
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ tempax |= SupportTV;
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
+ if(resinfo == 0x0a) tempax |= SupportTV1024;
+ }
+ }
+ }
}
- if(SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
+ if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
tempax |= SupportLCD;
- if(SiS_LCDResInfo != Panel1280x1024) {
- if(SiS_LCDResInfo != Panel1280x960) {
- if(SiS_LCDInfo & LCDNonExpanding) {
- if(resinfo >= 9) {
- tempax = 0;
- return(0);
- }
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1600x1200) {
+ if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1400x1050) {
+ if((resinfo == 6) && (SiS_Pr->SiS_LCDInfo & DontExpandLCD)) {
+ (*i) = 0;
+ return(1);
+ } else {
+ if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x1024) {
+ if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x960) {
+ if((resinfo == 6) && (SiS_Pr->SiS_LCDInfo & DontExpandLCD)) {
+ return(0);
+ } else {
+ if((resinfo >= 9) && (resinfo != 0x14)) {
+ return(0);
+ }
}
- }
- }
+ }
+ }
+ }
+ }
+ }
+ } else {
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) {
+ if((resinfo != 0x0f) && ((resinfo == 4) || (resinfo >= 8))) return(0);
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1152x768) {
+ if((resinfo != 0x10) && (resinfo > 8)) return(0);
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x960) {
+ if((resinfo != 0x0e) && (resinfo > 8)) return(0);
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) {
+ if(resinfo > 9) return(0);
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) {
+ if(resinfo > 8) return(0);
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) {
+ if((resinfo == 4) || (resinfo > 7)) return(0);
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480) {
+ if((resinfo == 4) || (resinfo == 3) || (resinfo > 6)) return(0);
+ }
+ }
}
- if(SiS_VBInfo & SetCRT2ToHiVisionTV) { /* for HiTV */
- tempax |= SupportHiVisionTV;
- if(SiS_VBInfo & SetInSlaveMode){
- if(resinfo == 4) return(0);
- if(resinfo == 3) {
- if(SiS_SetFlag & TVSimuMode) return(0);
- }
- if(resinfo > 7) return(0);
- }
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) {
+ if(SiS_Pr->SiS_HiVision == 3) {
+ tempax |= SupportHiVisionTV2;
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode){
+ if(resinfo == 4) return(0);
+ if(resinfo == 3) return(0);
+ if(resinfo == 7) {
+ if(SiS_Pr->SiS_SetFlag & TVSimuMode) return(0);
+ }
+ if(resinfo > 7) return(0);
+ }
+ } else {
+ tempax |= SupportHiVisionTV;
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode){
+ if(resinfo == 4) return(0);
+ if((resinfo == 3) || (resinfo == 7)) {
+ if(SiS_Pr->SiS_SetFlag & TVSimuMode) return(0);
+ }
+ if(resinfo > 7) return(0);
+ }
+ }
} else {
- if(SiS_VBInfo & (SetCRT2ToAVIDEO|SetCRT2ToSVIDEO|SetCRT2ToSCART)) {
- tempax |= SupportTV;
- if(SiS_VBType & VB_SIS301BLV302BLV) {
- tempax |= SupportTV1024;
- }
- if(!(SiS_VBInfo & SetPALTV)) {
- if(modeflag & NoSupportSimuTV) {
- if(SiS_VBInfo & SetInSlaveMode) {
- if(!(SiS_VBInfo & SetNotSimuMode)) {
- return 0;
- }
- }
- }
- }
- }
+ if(SiS_Pr->SiS_VBInfo & (SetCRT2ToAVIDEO|SetCRT2ToSVIDEO|SetCRT2ToSCART)) {
+ tempax |= SupportTV;
+ tempax |= SupportTV1024;
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
+ if((SiS_Pr->SiS_VBInfo & SetNotSimuMode) && (SiS_Pr->SiS_VBInfo & SetPALTV)) {
+ if(resinfo != 8) {
+ if( (!(SiS_Pr->SiS_VBInfo & SetPALTV)) ||
+ ((SiS_Pr->SiS_VBInfo & SetPALTV) && (resinfo != 4)) ) {
+ tempax &= ~(SupportTV1024);
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ if((modeflag & NoSupportSimuTV) && (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
+ if( (!(SiS_Pr->SiS_VBInfo & SetPALTV)) ||
+ ((SiS_Pr->SiS_VBInfo & SetPALTV) && (resinfo != 7)) ) {
+ if(!(SiS_Pr->SiS_VBInfo & SetNotSimuMode)) return(0);
+ }
+ }
+ } else {
+ if( (resinfo != 3) ||
+ (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) ||
+ (SiS_Pr->SiS_VBInfo & SetNotSimuMode) ) {
+ if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) {
+ if((modeflag & NoSupportSimuTV) && (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
+ if(resinfo == 3) return(0);
+ if(!(SiS_Pr->SiS_VBInfo & SetNotSimuMode)) return (0);
+ }
+ }
+ } else return(0);
+ }
+ }
+ }
+ } else {
+ tempax &= ~(SupportTV1024);
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ if((modeflag & NoSupportSimuTV) && (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
+ if( (!(SiS_Pr->SiS_VBInfo & SetPALTV)) ||
+ ((SiS_Pr->SiS_VBInfo & SetPALTV) && (resinfo != 7)) ) {
+ if(!(SiS_Pr->SiS_VBInfo & SetNotSimuMode)) return(0);
+ }
+ }
+ } else {
+ if( (resinfo != 3) ||
+ (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) ||
+ (SiS_Pr->SiS_VBInfo & SetNotSimuMode) ) {
+ if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) {
+ if((modeflag & NoSupportSimuTV) && (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
+ if(resinfo == 3) return(0);
+ if(!(SiS_Pr->SiS_VBInfo & SetNotSimuMode)) return (0);
+ }
+ }
+ } else return(0);
+ }
+ }
+ } else { /* slavemode */
+ if(resinfo != 8) {
+ if( (!(SiS_Pr->SiS_VBInfo & SetPALTV)) ||
+ ((SiS_Pr->SiS_VBInfo & SetPALTV) && (resinfo != 4) ) ) {
+ tempax &= ~(SupportTV1024);
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ if((modeflag & NoSupportSimuTV) && (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
+ if( (!(SiS_Pr->SiS_VBInfo & SetPALTV)) ||
+ ((SiS_Pr->SiS_VBInfo & SetPALTV) && (resinfo != 7)) ) {
+ if(!(SiS_Pr->SiS_VBInfo & SetNotSimuMode)) return(0);
+ }
+ }
+ } else {
+ if( (resinfo != 3) ||
+ (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) ||
+ (SiS_Pr->SiS_VBInfo & SetNotSimuMode) ) {
+ if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) {
+ if((modeflag & NoSupportSimuTV) && (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
+ if(resinfo == 3) return(0);
+ if(!(SiS_Pr->SiS_VBInfo & SetNotSimuMode)) return (0);
+ }
+ }
+ } else return(0);
+ }
+ }
+ }
+ }
+ } else { /* 301 */
+ tempax &= ~(SupportTV1024);
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ if((modeflag & NoSupportSimuTV) && (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
+ if( (!(SiS_Pr->SiS_VBInfo & SetPALTV)) ||
+ ((SiS_Pr->SiS_VBInfo & SetPALTV) && (resinfo != 7)) ) {
+ if(!(SiS_Pr->SiS_VBInfo & SetNotSimuMode)) return(0);
+ }
+ }
+ } else {
+ if( (resinfo != 3) ||
+ (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) ||
+ (SiS_Pr->SiS_VBInfo & SetNotSimuMode) ) {
+ if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) {
+ if((modeflag & NoSupportSimuTV) && (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
+ if(resinfo == 3) return(0);
+ if(!(SiS_Pr->SiS_VBInfo & SetNotSimuMode)) return (0);
+ }
+ }
+ } else return(0);
+ }
+ }
+ }
}
- } else {
- /* TW: for LVDS */
- if(SiS_IF_DEF_CH70xx != 0) {
- if(SiS_VBInfo & SetCRT2ToTV) {
+
+ } else { /* TW: for LVDS */
+
+ if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
tempax |= SupportCHTV;
}
}
- if(SiS_VBInfo & SetCRT2ToLCD) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
tempax |= SupportLCD;
- if(SiS_LCDResInfo == Panel1280x768) {
- /* TW: Bios code makes no sense */
- } else if(SiS_LCDResInfo == Panel1400x1050) {
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x768) {
+ if((resinfo != 0x14) && (resinfo > 0x09)) return(0);
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) {
+ if((resinfo != 0x0f) && (resinfo > 0x08)) return(0);
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1152x768) {
+ if((resinfo != 0x10) && (resinfo > 0x08)) return(0);
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) {
if((resinfo != 0x15) && (resinfo > 0x09)) return(0);
- } else if(SiS_LCDResInfo == Panel1280x1024) {
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) {
if(resinfo > 0x09) return(0);
- } else if(SiS_LCDResInfo == Panel1024x768) {
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) {
if(resinfo > 0x08) return(0);
- } else if(SiS_LCDResInfo == Panel800x600){
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600){
if(resinfo > 0x07) return(0);
if(resinfo == 0x04) return(0);
}
}
}
/* TW: Look backwards in table for matching CRT2 mode */
- for(; SiS_RefIndex[RefreshRateTableIndex+(*i)].ModeID == tempbx; (*i)--) {
- infoflag = SiS_RefIndex[RefreshRateTableIndex + (*i)].Ext_InfoFlag;
+ for(; SiS_Pr->SiS_RefIndex[RefreshRateTableIndex+(*i)].ModeID == tempbx; (*i)--) {
+ infoflag = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + (*i)].Ext_InfoFlag;
if(infoflag & tempax) {
return(1);
}
@@ -3380,8 +4233,8 @@ SiS_AdjustCRT2Rate(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
* for a matching CRT2 mode if no mode was found yet.
*/
for((*i) = 0; ; (*i)++) {
- infoflag = SiS_RefIndex[RefreshRateTableIndex + (*i)].Ext_InfoFlag;
- if(SiS_RefIndex[RefreshRateTableIndex + (*i)].ModeID != tempbx) {
+ infoflag = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + (*i)].Ext_InfoFlag;
+ if(SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + (*i)].ModeID != tempbx) {
return(0);
}
if(infoflag & tempax) {
@@ -3391,91 +4244,143 @@ SiS_AdjustCRT2Rate(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
return(1);
}
-/* Checked against 650/LVDS (1.10.07) and 650/301LV BIOS */
void
-SiS_SaveCRT2Info(USHORT ModeNo)
+SiS_SaveCRT2Info(SiS_Private *SiS_Pr, USHORT ModeNo)
{
USHORT temp1,temp2;
/* TW: We store CRT1 ModeNo in CR34 */
- SiS_SetReg1(SiS_P3d4,0x34,ModeNo);
- temp1 = (SiS_VBInfo & SetInSlaveMode) >> 8;
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x34,ModeNo);
+ temp1 = (SiS_Pr->SiS_VBInfo & SetInSlaveMode) >> 8;
temp2 = ~(SetInSlaveMode >> 8);
- SiS_SetRegANDOR(SiS_P3d4,0x31,temp2,temp1);
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x31,temp2,temp1);
}
-/* TW: Checked against 650+301, 650/LVDS (1.10.07) and 650/301LV BIOS */
void
-SiS_GetVBInfo301(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,
- USHORT ModeIdIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension)
+SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,
+ USHORT ModeIdIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension,
+ int checkcrt2mode)
{
USHORT tempax,tempbx,temp;
USHORT modeflag, resinfo=0;
- UCHAR OutputSelect = *pSiS_OutputSelect;
+ UCHAR OutputSelect = *SiS_Pr->pSiS_OutputSelect;
- if (ModeNo<=0x13)
- modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
- else {
- modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
- resinfo = SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
- }
+ if(SiS_Pr->UseCustomMode) {
+ modeflag = SiS_Pr->CModeFlag;
+ } else {
+ if (ModeNo <= 0x13)
+ modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
+ else {
+ modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
+ }
+ }
- SiS_SetFlag = 0;
+ SiS_Pr->SiS_SetFlag = 0;
- SiS_ModeType = modeflag & ModeInfoFlag;
+ SiS_Pr->SiS_ModeType = modeflag & ModeInfoFlag;
tempbx = 0;
- if(SiS_BridgeIsOn(BaseAddr,HwDeviceExtension) == 0) { /* TW: "== 0" inserted from 630/301B BIOS */
- temp = SiS_GetReg1(SiS_P3d4,0x30);
- if(SiS_VBType & (VB_SIS301LV | VB_SIS302LV)) { /* TW: Not in (301B) BIOS */
- temp &= 0xbf; /* 301lvds disable CRT2RAMDAC */
- }
- if(SiS_IF_DEF_FSTN) { /* fstn must set CR30=0x21 */
- temp = 0x21;
- SiS_SetReg1(SiS_P3d4,0x30,temp);
+ if(SiS_BridgeIsOn(SiS_Pr,BaseAddr,HwDeviceExtension) == 0) {
+ temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30);
+#if 0
+ /* SiS_HiVision is only used on 310/325/330+30xLV */
+ if(SiS_Pr->SiS_VBType & (VB_SIS301LV302LV)) {
+ if(SiS_Pr->SiS_HiVision & 0x03) { /* TW: New from 650/30xLV 1.10.6s */
+ temp &= (SetCRT2ToHiVisionTV | SwitchToCRT2 | SetSimuScanMode); /* 0x83 */
+ temp |= SetCRT2ToHiVisionTV; /* 0x80 */
+ }
+ if(SiS_Pr->SiS_HiVision & 0x04) { /* TW: New from 650/30xLV 1.10.6s */
+ temp &= (SetCRT2ToHiVisionTV | SwitchToCRT2 | SetSimuScanMode); /* 0x83 */
+ temp |= SetCRT2ToSVIDEO; /* 0x08 */
+ }
+ }
+#endif
+ if(SiS_Pr->SiS_IF_DEF_FSTN) { /* fstn must set CR30=0x21 */
+ temp = (SetCRT2ToLCD | SetSimuScanMode);
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x30,temp);
}
tempbx |= temp;
- temp = SiS_GetReg1(SiS_P3d4,0x31);
- tempax = temp << 8;
- tempax &= (LoadDACFlag | DriverMode | SetDispDevSwitch | /* TW: Inserted from 650/LVDS+301LV BIOS */
- SetNotSimuMode | SetPALTV); /* TW: Inserted from 650/LVDS+301LV BIOS */
+ tempax = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x31) << 8;
+ tempax &= (LoadDACFlag | DriverMode | SetDispDevSwitch | SetNotSimuMode | SetPALTV);
tempbx |= tempax;
- temp = SetCHTVOverScan | SetInSlaveMode | DisableCRT2Display;
- temp = 0xFFFF ^ temp;
- tempbx &= temp;
+ tempbx &= ~(SetCHTVOverScan | SetInSlaveMode | DisableCRT2Display);;
+
#ifdef SIS315H
- if(HwDeviceExtension->jChipType >= SIS_315H) { /* TW: Inserted this "if" */
- temp = SiS_GetReg1(SiS_P3d4,0x38);
- if(SiS_VBType & (VB_SIS302B | VB_SIS302LV)) {
- if((temp & (EnableDualEdge | SetToLCDA))
- == (EnableDualEdge | SetToLCDA)) /* TW: BIOS only tests these bits, added "& ..." */
+
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ if(SiS_Pr->SiS_VBType & (VB_SIS302B | VB_SIS301LV | VB_SIS302LV)) {
+ /* From 1.10.7w, not in 1.10.8r */
+ if(ModeNo == 0x03) {
+ /* Mode 0x03 is never in driver mode */
+ SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x31,0xbf);
+ }
+ /* From 1.10.7w, not in 1.10.8r */
+ if(!(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x31) & (DriverMode >> 8))) {
+ /* Reset LCDA setting */
+ SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x38,0xfc);
+ }
+ if(IS_SIS650) {
+ if(SiS_Pr->SiS_UseLCDA) {
+ if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x5f) & 0xF0) {
+ if((ModeNo <= 0x13) || (!(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x31) & (DriverMode >> 8)))) {
+ SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x38,(EnableDualEdge | SetToLCDA)); /* 3 */
+ }
+ }
+ }
+#if 0 /* We can't detect it this way; there are machines which do not use LCDA despite
+ * the chip revision
+ */
+ if((tempbx & SetCRT2ToLCD) && (SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30) & SetCRT2ToLCD)) {
+ if((SiS_GetReg1(SiS_Pr->SiS_P3d4, 0x36) & 0x0f) == SiS_Pr->SiS_Panel1400x1050) {
+ if((ModeNo <= 0x13) || (!(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x31) & (DriverMode >> 8)))) {
+ if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x5f) & 0xF0) {
+ SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x38,(EnableDualEdge | SetToLCDA)); /* 3 */
+ }
+ }
+ } else {
+ if((ModeNo <= 0x13) || (!(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x31) & (DriverMode >> 8)))) {
+ if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x5f) & 0xF0) {
+ SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x38,(EnableDualEdge | SetToLCDA)); /* 3 */
+ }
+ }
+ }
+ }
+#endif
+ }
+ temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38);
+ if((temp & (EnableDualEdge | SetToLCDA)) == (EnableDualEdge | SetToLCDA)) {
tempbx |= SetCRT2ToLCDA;
+ }
}
- /* TW: Inserted from 650/LVDS BIOS: */
- if(SiS_IF_DEF_LVDS == 1) {
+
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
+ temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38);
if(temp & SetToLCDA)
- tempbx |= SetCRT2ToLCDA;
- if(temp & 0x08)
- tempbx |= SetCRT2ToHiVisionTV;
+ tempbx |= SetCRT2ToLCDA;
+ if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
+ if(temp & EnableLVDSHiVision)
+ tempbx |= SetCRT2ToHiVisionTV;
+ }
}
}
-#endif
- if(SiS_IF_DEF_LVDS == 0) {
- temp = SetCRT2ToLCDA | SetCRT2ToSCART | SetCRT2ToLCD |
- SetCRT2ToRAMDAC | SetCRT2ToSVIDEO | SetCRT2ToAVIDEO; /* = 0x807C; */
- if(SiS_IF_DEF_HiVision == 1)
- temp |= SetCRT2ToHiVisionTV; /* = 0x80FC; */
+
+#endif /* SIS315H */
+
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
+ temp = SetCRT2ToLCDA | SetCRT2ToSCART | SetCRT2ToLCD |
+ SetCRT2ToRAMDAC | SetCRT2ToSVIDEO | SetCRT2ToAVIDEO | /* = 0x807C; */
+ SetCRT2ToHiVisionTV; /* = 0x80FC; */
} else {
- /* TW: Inserted entire 315-section */
if(HwDeviceExtension->jChipType >= SIS_315H) {
- if(SiS_IF_DEF_CH70xx != 0)
+ if(SiS_Pr->SiS_IF_DEF_CH70xx != 0)
temp = SetCRT2ToLCDA | SetCRT2ToSCART |
SetCRT2ToLCD | SetCRT2ToHiVisionTV |
- SetCRT2ToAVIDEO | SetCRT2ToSVIDEO; /* 0x80bc */
+ SetCRT2ToAVIDEO | SetCRT2ToSVIDEO; /* = 0x80bc */
else
temp = SetCRT2ToLCDA | SetCRT2ToLCD;
} else {
- if(SiS_IF_DEF_CH70xx != 0)
+ if(SiS_Pr->SiS_IF_DEF_CH70xx != 0)
temp = SetCRT2ToTV | SetCRT2ToLCD;
else
temp = SetCRT2ToLCD;
@@ -3487,27 +4392,31 @@ SiS_GetVBInfo301(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,
tempbx = 0;
}
- if(SiS_IF_DEF_LVDS==0) {
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
if(tempbx & SetCRT2ToLCDA) {
tempbx &= (0xFF00|SwitchToCRT2|SetSimuScanMode);
- } else if(tempbx & SetCRT2ToRAMDAC) {
+ }
+ if(tempbx & SetCRT2ToRAMDAC) {
tempbx &= (0xFF00|SetCRT2ToRAMDAC|SwitchToCRT2|SetSimuScanMode);
- } else if((tempbx & SetCRT2ToLCD) && (!(SiS_VBType & VB_NoLCD)) ){
+ }
+ if((tempbx & SetCRT2ToLCD) /* && (!(SiS_Pr->SiS_VBType & VB_NoLCD)) */ ) {
+ /* We initialize the Panel Link of the type of bridge is DH */
tempbx &= (0xFF00|SetCRT2ToLCD|SwitchToCRT2|SetSimuScanMode);
- } else if(tempbx & SetCRT2ToSCART){
+ }
+ if(tempbx & SetCRT2ToSCART) {
tempbx &= (0xFF00|SetCRT2ToSCART|SwitchToCRT2|SetSimuScanMode);
tempbx |= SetPALTV;
- } else if(tempbx & SetCRT2ToHiVisionTV){
+ }
+ if(tempbx & SetCRT2ToHiVisionTV) {
tempbx &= (0xFF00|SetCRT2ToHiVisionTV|SwitchToCRT2|SetSimuScanMode);
tempbx |= SetPALTV;
}
} else { /* LVDS */
- /* TW: Inserted entire 315/325 section */
if(HwDeviceExtension->jChipType >= SIS_315H) {
if(tempbx & SetCRT2ToLCDA)
tempbx &= (0xFF00|SwitchToCRT2|SetSimuScanMode);
}
- if(SiS_IF_DEF_CH70xx != 0) {
+ if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
if(tempbx & SetCRT2ToTV)
tempbx &= (0xFF00|SetCRT2ToTV|SwitchToCRT2|SetSimuScanMode);
}
@@ -3519,424 +4428,713 @@ SiS_GetVBInfo301(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,
tempbx |= SetCRT2ToLCD;
}
}
+
if(tempax & DisableCRT2Display) {
if(!(tempbx & (SwitchToCRT2 | SetSimuScanMode))) {
tempbx = SetSimuScanMode | DisableCRT2Display;
}
}
+
if(!(tempbx & DriverMode)){
tempbx |= SetSimuScanMode;
}
- /* TW: LVDS (LCD/TV) and 630+301B (LCD) can only be slave in 8bpp modes */
- if( (SiS_IF_DEF_LVDS == 1) && (SiS_ModeType <= ModeVGA) ) {
- modeflag &= (~CRT2Mode);
- }
- if( (HwDeviceExtension->jChipType < SIS_315H) && (SiS_VBType & VB_SIS301BLV302BLV)) {
- if(SiS_ModeType <= ModeVGA) {
- if(tempbx & SetCRT2ToLCD) {
- modeflag &= (~CRT2Mode);
- }
- }
+ /* TW: LVDS (LCD/TV) and 301BDH (LCD) can only be slave in 8bpp modes */
+ if(SiS_Pr->SiS_ModeType <= ModeVGA) {
+ if( (SiS_Pr->SiS_IF_DEF_LVDS == 1) ||
+ ((tempbx & SetCRT2ToLCD) && (SiS_Pr->SiS_VBType & VB_NoLCD)) ) {
+ modeflag &= (~CRT2Mode);
+ }
}
- /* TW end */
-
+
if(!(tempbx & SetSimuScanMode)){
- if(tempbx & SwitchToCRT2) {
- if(!(modeflag & CRT2Mode)) {
- if( (HwDeviceExtension->jChipType >= SIS_315H) &&
- (SiS_VBType & VB_SIS301BLV302BLV) ) {
- if(resinfo != 0x0a)
- tempbx |= SetSimuScanMode;
- } else {
- tempbx |= SetSimuScanMode;
- }
-
- }
- } else {
- if(!(SiS_BridgeIsEnable(BaseAddr,HwDeviceExtension))) {
- if(!(tempbx & DriverMode)) {
- if(SiS_BridgeInSlave()) {
- tempbx |= SetSimuScanMode; /* TW: from BIOS 650/301/301LV/LVDS */
- }
- }
- }
- }
+ if(tempbx & SwitchToCRT2) {
+ if((!(modeflag & CRT2Mode)) && (checkcrt2mode)) {
+ if( (HwDeviceExtension->jChipType >= SIS_315H) &&
+ (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) ) {
+ if(resinfo != 0x0a)
+ tempbx |= SetSimuScanMode;
+ } else {
+ tempbx |= SetSimuScanMode;
+ }
+ }
+ } else {
+ if(!(SiS_BridgeIsEnable(SiS_Pr,BaseAddr,HwDeviceExtension))) {
+ if(!(tempbx & DriverMode)) {
+ if(SiS_BridgeInSlave(SiS_Pr)) {
+ tempbx |= SetSimuScanMode;
+ }
+ }
+ }
+ }
}
if(!(tempbx & DisableCRT2Display)) {
- if(tempbx & DriverMode) {
- if(tempbx & SetSimuScanMode) {
- if(!(modeflag & CRT2Mode)) {
- if( (HwDeviceExtension->jChipType >= SIS_315H) &&
- (SiS_VBType & VB_SIS301BLV302BLV) ) {
- if(resinfo != 0x0a) { /* TW: Inserted from 650/301 BIOS */
- tempbx |= SetInSlaveMode;
- if(SiS_IF_DEF_LVDS == 0) {
- if(tempbx & SetCRT2ToTV) {
- if(!(tempbx & SetNotSimuMode))
- SiS_SetFlag |= TVSimuMode;
- }
- }
- } /* TW: Inserted from 650/301 BIOS */
- } else {
- tempbx |= SetInSlaveMode;
- if(SiS_IF_DEF_LVDS == 0) {
- if(tempbx & SetCRT2ToTV) {
- if(!(tempbx & SetNotSimuMode))
- SiS_SetFlag |= TVSimuMode;
- }
- }
- }
- }
- }
- } else {
- tempbx |= SetInSlaveMode;
- if(SiS_IF_DEF_LVDS == 0) {
- if(tempbx & SetCRT2ToTV) {
- if(!(tempbx & SetNotSimuMode))
- SiS_SetFlag |= TVSimuMode;
- }
- }
- }
- }
- if(SiS_IF_DEF_CH70xx == 1) {
- temp = SiS_GetReg1(SiS_P3d4,0x35);
- if(temp & TVOverScan) tempbx |= SetCHTVOverScan;
- }
- if(SiS_IF_DEF_CH70xx == 2) {
- temp = SiS_GetReg1(SiS_P3d4,0x79);
- if(temp & 0x80) tempbx |= SetCHTVOverScan;
+ if(tempbx & DriverMode) {
+ if(tempbx & SetSimuScanMode) {
+ if((!(modeflag & CRT2Mode)) && (checkcrt2mode)) {
+ if( (HwDeviceExtension->jChipType >= SIS_315H) &&
+ (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) ) {
+ if(resinfo != 0x0a) { /* TW: Inserted from 650/301 BIOS */
+ tempbx |= SetInSlaveMode;
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
+ if(tempbx & SetCRT2ToTV) {
+ if(!(tempbx & SetNotSimuMode))
+ SiS_Pr->SiS_SetFlag |= TVSimuMode;
+ }
+ }
+ } /* TW: Inserted from 650/301 BIOS */
+ } else {
+ tempbx |= SetInSlaveMode;
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
+ if(tempbx & SetCRT2ToTV) {
+ if(!(tempbx & SetNotSimuMode))
+ SiS_Pr->SiS_SetFlag |= TVSimuMode;
+ }
+ }
+ }
+ }
+ }
+ } else {
+ tempbx |= SetInSlaveMode;
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
+ if(tempbx & SetCRT2ToTV) {
+ if(!(tempbx & SetNotSimuMode))
+ SiS_Pr->SiS_SetFlag |= TVSimuMode;
+ }
+ }
+ }
}
+
+ if(SiS_Pr->SiS_CHOverScan) {
+ if(SiS_Pr->SiS_IF_DEF_CH70xx == 1) {
+ temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x35);
+ if((temp & TVOverScan) || (SiS_Pr->SiS_CHOverScan == 1) )
+ tempbx |= SetCHTVOverScan;
+ }
+ if(SiS_Pr->SiS_IF_DEF_CH70xx == 2) {
+ temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x79);
+ if( (temp & 0x80) || (SiS_Pr->SiS_CHOverScan == 1) )
+ tempbx |= SetCHTVOverScan;
+ }
+ }
}
- if(SiS_IF_DEF_LVDS==0) {
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
#ifdef SIS300
- if((HwDeviceExtension->jChipType==SIS_630)||
+ if((HwDeviceExtension->jChipType==SIS_630) ||
(HwDeviceExtension->jChipType==SIS_730)) {
+ if(ROMAddr && SiS_Pr->SiS_UseROM) {
+ OutputSelect = ROMAddr[0xfe];
+ }
if(!(OutputSelect & EnablePALMN))
- SiS_SetRegAND(SiS_P3d4,0x35,0x3F);
+ SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x35,0x3F);
if(tempbx & SetCRT2ToTV) {
if(tempbx & SetPALTV) {
- temp=SiS_GetReg1(SiS_P3d4,0x35);
- temp &= 0xC0;
- if(temp == 0x40)
- tempbx &= (~SetPALTV);
+ temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x35);
+ if(temp & EnablePALM) tempbx &= (~SetPALTV);
}
}
}
#endif
#ifdef SIS315H
if(HwDeviceExtension->jChipType >= SIS_315H) {
+ if(ROMAddr && SiS_Pr->SiS_UseROM) {
+ OutputSelect = ROMAddr[0xf3];
+ if(HwDeviceExtension->jChipType == SIS_330) {
+ OutputSelect = ROMAddr[0x11b];
+ }
+ }
if(!(OutputSelect & EnablePALMN))
- SiS_SetRegAND(SiS_P3d4,0x38,0x3F);
+ SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x38,0x3F);
if(tempbx & SetCRT2ToTV) {
if(tempbx & SetPALTV) {
- temp = SiS_GetReg1(SiS_P3d4,0x38);
- /* temp &= 0xC0; */ /* TW: BIOS only tests 0x40, not 0x80 */
- if(temp & 0x40)
- tempbx &= (~SetPALTV);
+ temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38);
+ if(temp & EnablePALM) tempbx &= (~SetPALTV);
}
}
}
#endif
}
+
+ /* PALM/PALN on Chrontel 7019 */
+ SiS_Pr->SiS_CHPALM = SiS_Pr->SiS_CHPALN = FALSE;
+ if(SiS_Pr->SiS_IF_DEF_CH70xx == 2) {
+ if(tempbx & SetCRT2ToTV) {
+ if(tempbx & SetPALTV) {
+ temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38);
+ if(temp & EnablePALM) SiS_Pr->SiS_CHPALM = TRUE;
+ else if(temp & EnablePALN) SiS_Pr->SiS_CHPALN = TRUE;
+ }
+ }
+ }
- SiS_VBInfo=tempbx;
+ SiS_Pr->SiS_VBInfo = tempbx;
- /* TW: DevSwitch not supported here */
+ if(HwDeviceExtension->jChipType == SIS_630) {
+ SiS_WhatIsThis(SiS_Pr, SiS_Pr->SiS_VBInfo);
+ }
#ifdef TWDEBUG
#ifdef LINUX_KERNEL
- printk(KERN_INFO "sisfb: (VBInfo = %x, SetFlag = %x)\n", SiS_VBInfo, SiS_SetFlag);
+ printk(KERN_DEBUG "sisfb: (VBInfo= 0x%04x, SetFlag=0x%04x)\n",
+ SiS_Pr->SiS_VBInfo, SiS_Pr->SiS_SetFlag);
#endif
#ifdef LINUX_XF86
- xf86DrvMsg(0, X_INFO, "(init301: VBInfo = %x, SetFlag = %x)\n", SiS_VBInfo, SiS_SetFlag);
+ xf86DrvMsgVerb(0, X_PROBED, 3, "(init301: VBInfo=0x%04x, SetFlag=0x%04x)\n",
+ SiS_Pr->SiS_VBInfo, SiS_Pr->SiS_SetFlag);
#endif
#endif
-#if 0
- /* From 650/301LV BIOS: */
- if(ModeNo == 0x13) bp+4 = 0x03
- else bp+4 = ModeNo;
+#if 0 /* TW: Incomplete! (But does not seem to be required) */
+ if(HwDeviceExtension->jChipType < SIS_315H) {
+ /* TW: From A901/630+301B BIOS */
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ if(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13) & 0x80)
+ }
+ if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) {
+ if(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13) & 0x80)
+ if( [si] == 3) ModeIdIndex = 0x3f2b;
+ }
+ }
+ SiS_SetRegAND(SiS_Pr->SiS_P3d4, 0x31, 0xF7);
+ if(ModeNo == 0x13) bp+4 = 0x03;
+ } else {
+ /* From 650/30xLV BIOS: */
+ SiS_SetRegAND(SiS_Pr->SiS_P3d4, 0x31, 0xF7);
+ if(ModeNo == 0x13) bp+4 = 0x03;
+ else bp+4 = ModeNo;
+ }
#endif
- /* TW: 630/301B and 650/301 (not 301LV!) BIOS do more here, but this seems for DOS mode */
+ /* TW: 630/301B and 650/301 (not 301LV!) BIOSes do more here, but this seems for DOS mode */
}
void
-SiS_GetRAMDAC2DATA(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
- USHORT RefreshRateTableIndex,
- PSIS_HW_DEVICE_INFO HwDeviceExtension)
+SiS_WhatIsThis(SiS_Private *SiS_Pr, USHORT myvbinfo)
+{
+ unsigned long eax, temp;
+ unsigned short temp1;
+
+ if(!(SiS_Pr->SiS_ChSW)) return;
+
+#ifndef LINUX_XF86
+ SiS_SetReg4(0xcf8,0x80000874);
+ eax = SiS_GetReg3(0xcfc);
+#else
+ eax = pciReadLong(0x00000800, 0x74);
+#endif
+ eax &= 0xFFFF;
+ temp = eax;
+ eax += 0x3c;
+ temp1 = SiS_GetReg4((USHORT)eax);
+ temp1 &= 0xFEFF;
+ SiS_SetReg5((USHORT)eax, temp1);
+ temp1 = SiS_GetReg4((USHORT)eax);
+ eax = temp;
+ eax += 0x3a;
+ temp1 = SiS_GetReg4((USHORT)eax);
+ temp1 &= 0xFEFF;
+ if(!(myvbinfo & SetCRT2ToTV)) {
+ temp1 |= 0x0100;
+ }
+ SiS_SetReg5((USHORT)eax, temp1);
+ temp1 = SiS_GetReg4((USHORT)eax);
+}
+
+void
+SiS_GetRAMDAC2DATA(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+ USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
USHORT tempax,tempbx,temp;
- USHORT temp1,temp2,modeflag=0,tempcx;
+ USHORT temp1,modeflag=0,tempcx;
USHORT StandTableIndex,CRT1Index;
USHORT ResInfo,DisplayType;
- SiS_LVDSCRT1DataStruct *LVDSCRT1Ptr=NULL;
+ const SiS_LVDSCRT1DataStruct *LVDSCRT1Ptr = NULL;
- SiS_RVBHCMAX=1;
- SiS_RVBHCFACT=1;
+ SiS_Pr->SiS_RVBHCMAX = 1;
+ SiS_Pr->SiS_RVBHCFACT = 1;
if(ModeNo <= 0x13){
- modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
- StandTableIndex = SiS_GetModePtr(ROMAddr,ModeNo,ModeIdIndex);
- tempax = SiS_StandTable[StandTableIndex].CRTC[0];
- tempbx = SiS_StandTable[StandTableIndex].CRTC[6];
- temp1 = SiS_StandTable[StandTableIndex].CRTC[7];
+ modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
+ StandTableIndex = SiS_GetModePtr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex);
+ tempax = SiS_Pr->SiS_StandTable[StandTableIndex].CRTC[0];
+ tempbx = SiS_Pr->SiS_StandTable[StandTableIndex].CRTC[6];
+ temp1 = SiS_Pr->SiS_StandTable[StandTableIndex].CRTC[7];
} else {
- if( (SiS_VBType & VB_SIS301BLV302BLV) && (SiS_VBInfo&SetCRT2ToLCDA) ) {
+ if( (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) ) {
- temp=SiS_GetLVDSCRT1Ptr(ROMAddr,ModeNo,ModeIdIndex,
+ temp = SiS_GetLVDSCRT1Ptr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,
RefreshRateTableIndex,&ResInfo,&DisplayType);
- if(temp==0) return;
+ if(temp == 0) return;
switch(DisplayType) {
- case 0 : LVDSCRT1Ptr = SiS_LVDSCRT1800x600_1; break;
- case 1 : LVDSCRT1Ptr = SiS_LVDSCRT11024x768_1; break;
- case 2 : LVDSCRT1Ptr = SiS_LVDSCRT11280x1024_1; break;
- case 3 : LVDSCRT1Ptr = SiS_LVDSCRT1800x600_1_H; break;
- case 4 : LVDSCRT1Ptr = SiS_LVDSCRT11024x768_1_H; break;
- case 5 : LVDSCRT1Ptr = SiS_LVDSCRT11280x1024_1_H; break;
- case 6 : LVDSCRT1Ptr = SiS_LVDSCRT1800x600_2; break;
- case 7 : LVDSCRT1Ptr = SiS_LVDSCRT11024x768_2; break;
- case 8 : LVDSCRT1Ptr = SiS_LVDSCRT11280x1024_2; break;
- case 9 : LVDSCRT1Ptr = SiS_LVDSCRT1800x600_2_H; break;
- case 10: LVDSCRT1Ptr = SiS_LVDSCRT11024x768_2_H; break;
- case 11: LVDSCRT1Ptr = SiS_LVDSCRT11280x1024_2_H; break;
- case 12: LVDSCRT1Ptr = SiS_LVDSCRT1XXXxXXX_1; break;
- case 13: LVDSCRT1Ptr = SiS_LVDSCRT1XXXxXXX_1_H; break;
- case 14: LVDSCRT1Ptr = SiS_LVDSCRT11400x1050_1; break;
- case 15: LVDSCRT1Ptr = SiS_LVDSCRT11400x1050_1_H; break;
- case 16: LVDSCRT1Ptr = SiS_LVDSCRT11400x1050_2; break;
- case 17: LVDSCRT1Ptr = SiS_LVDSCRT11400x1050_2_H; break;
- case 18: LVDSCRT1Ptr = SiS_CHTVCRT1UNTSC; break;
- case 19: LVDSCRT1Ptr = SiS_CHTVCRT1ONTSC; break;
- case 20: LVDSCRT1Ptr = SiS_CHTVCRT1UPAL; break;
- case 21: LVDSCRT1Ptr = SiS_CHTVCRT1OPAL; break;
- case 22: LVDSCRT1Ptr = SiS_LVDSCRT1320x480_1; break;
-
+ case 0 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1800x600_1; break;
+ case 1 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_1; break;
+ case 2 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11280x1024_1; break;
+ case 3 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1800x600_1_H; break;
+ case 4 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_1_H; break;
+ case 5 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11280x1024_1_H; break;
+ case 6 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1800x600_2; break;
+ case 7 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_2; break;
+ case 8 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11280x1024_2; break;
+ case 9 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1800x600_2_H; break;
+ case 10: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_2_H; break;
+ case 11: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11280x1024_2_H; break;
+ case 12: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1XXXxXXX_1; break;
+ case 13: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1XXXxXXX_1_H; break;
+ case 14: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11400x1050_1; break;
+ case 15: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11400x1050_1_H; break;
+ case 16: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11400x1050_2; break;
+ case 17: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11400x1050_2_H; break;
+ case 18: LVDSCRT1Ptr = SiS_Pr->SiS_CHTVCRT1UNTSC; break;
+ case 19: LVDSCRT1Ptr = SiS_Pr->SiS_CHTVCRT1ONTSC; break;
+ case 20: LVDSCRT1Ptr = SiS_Pr->SiS_CHTVCRT1UPAL; break;
+ case 21: LVDSCRT1Ptr = SiS_Pr->SiS_CHTVCRT1OPAL; break;
+ case 22: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1320x480_1; break;
+ case 23: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x600_1; break;
+ case 24: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x600_1_H; break;
+ case 25: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x600_2; break;
+ case 26: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x600_2_H; break;
+ case 27: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11152x768_1; break;
+ case 28: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11152x768_1_H; break;
+ case 29: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11152x768_2; break;
+ case 30: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11152x768_2_H; break;
+ case 36: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11600x1200_1; break;
+ case 37: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11600x1200_1_H; break;
+ case 38: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11600x1200_2; break;
+ case 39: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11600x1200_2_H; break;
+ case 99: LVDSCRT1Ptr = SiS_Pr->SiS_CHTVCRT1OPAL; break;
+ default: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_1; break;
}
- temp1=(LVDSCRT1Ptr+ResInfo)->CR[0];
- temp2=(LVDSCRT1Ptr+ResInfo)->CR[14];
- tempax=(temp1&0xFF)|((temp2&0x03)<<8);
- tempbx=(LVDSCRT1Ptr+ResInfo)->CR[6];
- tempcx=(LVDSCRT1Ptr+ResInfo)->CR[13]<<8;
- tempcx = tempcx&0x0100;
- tempcx = tempcx << 2;
- tempbx = tempbx | tempcx;
- temp1=(LVDSCRT1Ptr+ResInfo)->CR[7];
+ tempax = (LVDSCRT1Ptr+ResInfo)->CR[0];
+ tempax |= (LVDSCRT1Ptr+ResInfo)->CR[14] << 8;
+ tempax &= 0x03FF;
+ tempbx = (LVDSCRT1Ptr+ResInfo)->CR[6];
+ tempcx = (LVDSCRT1Ptr+ResInfo)->CR[13] << 8;
+ tempcx &= 0x0100;
+ tempcx <<= 2;
+ tempbx |= tempcx;
+ temp1 = (LVDSCRT1Ptr+ResInfo)->CR[7];
} else {
- modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
- CRT1Index = SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
- if(HwDeviceExtension->jChipType < SIS_315H) {
- CRT1Index &= 0x3F;
- }
- temp1 = (USHORT)SiS_CRT1Table[CRT1Index].CR[0];
- temp2 = (USHORT)SiS_CRT1Table[CRT1Index].CR[14];
- tempax=(temp1&0xFF)|((temp2&0x03)<<8);
- tempbx = (USHORT)SiS_CRT1Table[CRT1Index].CR[6];
- tempcx = (USHORT)SiS_CRT1Table[CRT1Index].CR[13]<<8;
- tempcx = tempcx&0x0100;
- tempcx = tempcx << 2;
- tempbx = tempbx | tempcx;
- temp1 = (USHORT)SiS_CRT1Table[CRT1Index].CR[7];
+ modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ CRT1Index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
+#if 0 /* Not any longer */
+ if(HwDeviceExtension->jChipType < SIS_315H) CRT1Index &= 0x3F;
+#endif
+ tempax = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[0];
+ tempax |= SiS_Pr->SiS_CRT1Table[CRT1Index].CR[14] << 8;
+ tempax &= 0x03FF;
+ tempbx = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[6];
+ tempcx = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[13] << 8;
+ tempcx &= 0x0100;
+ tempcx <<= 2;
+ tempbx |= tempcx;
+ temp1 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[7];
}
}
- if(temp1&0x01) tempbx |= 0x0100;
- if(temp1&0x20) tempbx |= 0x0200;
+ if(temp1 & 0x01) tempbx |= 0x0100;
+ if(temp1 & 0x20) tempbx |= 0x0200;
+
tempax += 5;
+
+ /* Charx8Dot is no more used (and assumed), so we set it */
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ modeflag |= Charx8Dot;
+ }
+
if(modeflag & Charx8Dot) tempax *= 8;
- else tempax *= 9;
+ else tempax *= 9;
+
+ /* TW: From 650/30xLV 1.10.6s */
+ if(modeflag & HalfDCLK) tempax <<= 1;
- SiS_VGAHT = SiS_HT = tempax;
+ SiS_Pr->SiS_VGAHT = SiS_Pr->SiS_HT = tempax;
tempbx++;
- SiS_VGAVT = SiS_VT = tempbx;
+ SiS_Pr->SiS_VGAVT = SiS_Pr->SiS_VT = tempbx;
}
void
-SiS_UnLockCRT2(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr)
+SiS_UnLockCRT2(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr)
{
if(HwDeviceExtension->jChipType >= SIS_315H)
- SiS_SetRegOR(SiS_Part1Port,0x2f,0x01);
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2f,0x01);
else
- SiS_SetRegOR(SiS_Part1Port,0x24,0x01);
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x24,0x01);
}
void
-SiS_LockCRT2(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr)
+SiS_LockCRT2(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr)
{
if(HwDeviceExtension->jChipType >= SIS_315H)
- SiS_SetRegAND(SiS_Part1Port,0x2F,0xFE);
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2F,0xFE);
else
- SiS_SetRegAND(SiS_Part1Port,0x24,0xFE);
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x24,0xFE);
}
void
-SiS_EnableCRT2()
+SiS_EnableCRT2(SiS_Private *SiS_Pr)
{
- SiS_SetRegOR(SiS_P3c4,0x1E,0x20);
+ SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20);
}
-/* Checked against 650/LVDS(1.10.07)/301 and 630/301B BIOS */
+/* Checked against all BIOSes */
void
-SiS_DisableBridge(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr)
+SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr)
{
- USHORT tempah,temp;
+#ifdef SIS315H
+ USHORT tempah,pushax=0;
+#endif
+ USHORT temp=0, modenum;
UCHAR *ROMAddr = HwDeviceExtension->pjVirtualRomBase;
- if (SiS_IF_DEF_LVDS == 0) {
+ if (SiS_Pr->SiS_IF_DEF_LVDS == 0) {
- if(SiS_VBType & VB_SIS301BLV302BLV) { /* ===== TW: For 30xB/LV ===== */
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { /* ===== TW: For 30xB/LV ===== */
if(HwDeviceExtension->jChipType < SIS_315H) {
- /* 300 series */
+#ifdef SIS300 /* 300 series */
- if(!(SiS_CR36BIOSWord23b(HwDeviceExtension))) {
- SiS_SetRegANDOR(SiS_P3c4,0x11,0xF7,0x08);
- SiS_SetPanelDelay(ROMAddr, HwDeviceExtension, 3);
- }
- if(SiS_Is301B(BaseAddr)) {
- SiS_SetRegAND(SiS_Part4Port,0x1f,0x3f);
- SiS_ShortDelay(1);
- }
- SiS_SetRegAND(SiS_Part2Port,0x00,0xDF);
- SiS_DisplayOff();
- SiS_SetRegAND(SiS_P3c4,0x32,0xDF);
- SiS_SetRegAND(SiS_P3c4,0x1E,0xDF);
- SiS_UnLockCRT2(HwDeviceExtension,BaseAddr);
- SiS_SetRegOR(SiS_Part1Port,0x01,0x80);
- SiS_SetRegOR(SiS_Part1Port,0x02,0x40);
-/* SiS_DoSomeThingPCI(); */ /* TW: Is this really required ? */
- if( (!(SiS_CRT2IsLCD(BaseAddr))) || (!(SiS_CR36BIOSWord23d(HwDeviceExtension))) ) {
- SiS_SetPanelDelay(ROMAddr, HwDeviceExtension, 2);
- SiS_SetRegANDOR(SiS_P3c4,0x11,0xFB,0x04);
+ if(HwDeviceExtension->jChipType == SIS_300) { /* New for 300+301LV */
+
+ if(!(SiS_CR36BIOSWord23b(SiS_Pr,HwDeviceExtension))) {
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x26,0xFE,0x00);
+ SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3);
+ }
+ }
+ if(SiS_Is301B(SiS_Pr,BaseAddr)) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1f,0x3f);
+ SiS_ShortDelay(SiS_Pr,1);
+ }
+ SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xDF);
+ SiS_DisplayOff(SiS_Pr);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF);
+ if( (!(SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension))) ||
+ (!(SiS_CR36BIOSWord23d(SiS_Pr,HwDeviceExtension))) ) {
+ SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 2);
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xFB,0x04);
+ }
+
+ } else {
+
+ if(!(SiS_CR36BIOSWord23b(SiS_Pr,HwDeviceExtension))) {
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xF7,0x08);
+ SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3);
+ }
+ if(SiS_Is301B(SiS_Pr,BaseAddr)) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1f,0x3f);
+ SiS_ShortDelay(SiS_Pr,1);
+ }
+ SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xDF);
+ SiS_DisplayOff(SiS_Pr);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF);
+ SiS_UnLockCRT2(SiS_Pr,HwDeviceExtension,BaseAddr);
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x01,0x80);
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x02,0x40);
+ if( (!(SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension))) ||
+ (!(SiS_CR36BIOSWord23d(SiS_Pr,HwDeviceExtension))) ) {
+ SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 2);
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xFB,0x04);
+ }
}
+#endif /* SIS300 */
+
} else {
- /* 310 series */
+#ifdef SIS315H /* 310/325 series */
+
+ if(IS_SIS650740) { /* 650, 740 */
#if 0
- if(SiS_Is301B(BaseAddr)) {
+ if(SiS_GetReg1(SiS_Pr->SiS_Part4Port,0x00) != 1) return; /* From 1.10.7w */
#endif
- /* TW: Inserted from 650/301LV BIOS */
- if(!(SiS_IsDualEdge(HwDeviceExtension, BaseAddr))) {
- SiS_SetRegANDOR(SiS_Part4Port,0x26,0xFE,0x00);
- SiS_SetPanelDelay(ROMAddr, HwDeviceExtension, 3);
- } else if (SiS_IsVAMode(HwDeviceExtension, BaseAddr)) {
- SiS_SetRegANDOR(SiS_Part4Port,0x26,0xFE,0x00);
- SiS_SetPanelDelay(ROMAddr, HwDeviceExtension, 3);
- }
- /* TW end */
- /* TW: 301B dependent code starts here in 650/301LV BIOS */
- if(SiS_Is301B(BaseAddr)) {
- tempah = 0x3f;
-#if 0 /* TW: This is not done in 650/301LV BIOS, instead 0x3f is used in any case */
- if(SiS_IsDualEdge(HwDeviceExtension, BaseAddr)) {
- tempah = 0x7f;
- if(!(SiS_IsVAMode(HwDeviceExtension, BaseAddr))) {
- tempah = 0xbf;
- }
+
+ modenum = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x34);
+
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x30,0x00);
+
+ if( (modenum <= 0x13) ||
+ (!(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr))) ||
+ (SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) ) {
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x26,0xFE,0x00);
+ }
+ SiS_DDC2Delay(SiS_Pr,0xff00);
+ SiS_DDC2Delay(SiS_Pr,0x6000);
+ SiS_DDC2Delay(SiS_Pr,0x8000);
+
+ SiS_SetReg3(SiS_Pr->SiS_P3c6,0x00);
+
+ pushax = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x06);
+
+ if(IS_SIS740) {
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x06,0xE3);
+ }
+
+ SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3);
+
+ if(!(SiS_IsNotM650or651(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ tempah = 0xef;
+ if(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) {
+ tempah = 0xf7;
+ }
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x4c,tempah);
+ }
+
+ }
+
+ if(SiS_Pr->SiS_VBType & VB_SIS301B302B) {
+ tempah = 0x3f;
+ if(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr)) {
+ tempah = 0x7f;
+ if(!(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ tempah = 0xbf;
+ }
+ }
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1F,tempah);
+ }
+
+ if((SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) ||
+ ((SiS_Pr->SiS_VBType & VB_SIS301LV302LV) && (modenum <= 0x13))) {
+
+ if(SiS_Pr->SiS_VBType & VB_SIS301B302B) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x1E,0xDF);
+ SiS_DisplayOff(SiS_Pr);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF);
+ } else {
+ SiS_DisplayOff(SiS_Pr);
+ SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 2);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF);
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x1E,0xDF);
+ if((SiS_Pr->SiS_VBType & VB_SIS301LV302LV) && (modenum <= 0x13)) {
+ SiS_DisplayOff(SiS_Pr);
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x80);
+ SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 2);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF);
+ temp = SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x00);
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x10);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x00,temp);
+ }
+ }
+
+ } else {
+
+ if(SiS_Pr->SiS_VBType & VB_SIS301B302B) {
+ if(!(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xdf);
+ SiS_DisplayOff(SiS_Pr);
+ }
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x80);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF);
+ temp = SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x00);
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x10);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x00,temp);
+ } else {
+ SiS_DisplayOff(SiS_Pr);
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x80);
+ SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 2);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF);
+ temp = SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x00);
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x10);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x00,temp);
+ }
+
+ }
+
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1f,~0x10); /* 1.10.8r */
+
+ tempah = 0x3f;
+ if(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr)) {
+ tempah = 0x7f;
+ if(!(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ tempah = 0xbf;
+ }
+ }
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1F,tempah);
+
+ if(SiS_IsNotM650or651(SiS_Pr,HwDeviceExtension, BaseAddr)) { /* 1.10.8r */
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2e,0x7f);
+ } /* 1.10.8r */
+
+ if(!(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xdf);
+ }
+
+ if(!(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ if(!(SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension))) {
+ if(!(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x26,0xFD,0x00);
+ }
+ }
+ }
+
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x06,pushax);
+
+ }
+
+#if 0
+ } else if(IS_SIS740) { /* 740 */
+
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) { /* 30xLV */
+
+ if( (!(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr))) ||
+ (SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) ) {
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x26,0xFE,0x00);
+ }
+
+ SiS_SetReg3(SiS_Pr->SiS_P3c6,0x00);
+
+ pushax = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x06);
+
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x06,0xE3);
+
+ SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3);
+
+ if(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) {
+ SiS_DisplayOff(SiS_Pr);
+ SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 2);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF);
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x1E,0xDF);
+ } else {
+ SiS_DisplayOff(SiS_Pr);
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x80);
+ SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 2);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF);
+ temp = SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x00);
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x10);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x00,temp);
+ }
+
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1F,0x3F);
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1F,0xEF); /* (from 650) */
+
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2e,0x7f);
+
+ if(!(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xdf);
+ }
+
+ if(!(SiS_WeHaveBacklightCtrl(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ if(!(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ if(!(SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension))) {
+ if(!(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x26,0xFD,0x00);
+ }
+ }
+ }
+ }
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x06,pushax);
+
+ } else { /* (301,) 301B */
+
+ if(SiS_Is301B(SiS_Pr,BaseAddr)) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1F,0x3F);
+ }
+
+ SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xDF);
+ SiS_DisplayOff(SiS_Pr);
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x80);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF);
+
+ temp = SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x00);
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x10);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x00,temp);
+
}
-#endif
- SiS_SetRegAND(SiS_Part4Port,0x1F,tempah);
- } /* 301B dependent code ends here in 650/301V BIOS */
-#if 0 /* TW: This is not done in 650/301LV BIOS */
- if(SiS_IsVAMode(HwDeviceExtension, BaseAddr)) {
- SiS_SetRegAND(SiS_Part1Port,0x1E,0xDF);
- SiS_DisplayOff();
- SiS_SetRegAND(SiS_P3c4,0x32,0xDF);
- return;
- } else {
- if(!(SiS_IsDualEdge(HwDeviceExtension, BaseAddr))) {
- SiS_SetRegAND(SiS_Part2Port,0x00,0xDF);
- SiS_DisplayOff();
+#endif
+ } else { /* 315, 330 - all bridge types */
+
+ if(SiS_Is301B(SiS_Pr,BaseAddr)) {
+ tempah = 0x3f;
+ if(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr)) {
+ tempah = 0x7f;
+ if(!(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ tempah = 0xbf;
+ }
+ }
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1F,tempah);
+ if(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) {
+ SiS_DisplayOff(SiS_Pr);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF);
}
}
- } else {
-#endif
- SiS_SetRegAND(SiS_Part2Port,0x00,0xDF);
- SiS_DisplayOff();
-#if 0
- }
-#endif
+ if( (!(SiS_Is301B(SiS_Pr,BaseAddr))) ||
+ (!(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr))) ) {
- SiS_SetRegOR(SiS_Part1Port,0x00,0x80);
-
- SiS_SetRegAND(SiS_P3c4,0x32,0xDF);
-
- temp = SiS_GetReg1(SiS_Part1Port,0x00);
- SiS_SetRegOR(SiS_Part1Port,0x00,0x10);
- SiS_SetRegAND(SiS_P3c4,0x1E,0xDF);
- SiS_SetReg1(SiS_Part1Port,0x00,temp);
-
- /* TW: Inserted from 650/301LV BIOS */
- if(SiS_IsVAMode(HwDeviceExtension, BaseAddr)) {
- if(!(SiS_WeHaveBacklightCtrl(HwDeviceExtension, BaseAddr))) {
- if(!(SiS_IsDualEdge(HwDeviceExtension, BaseAddr))) {
- SiS_SetPanelDelay(ROMAddr, HwDeviceExtension, 2);
- SiS_SetRegANDOR(SiS_Part4Port,0x26,0xFD,0x00);
- SiS_SetPanelDelay(ROMAddr, HwDeviceExtension, 4);
- } else if(SiS_IsVAMode(HwDeviceExtension, BaseAddr)) {
- SiS_SetPanelDelay(ROMAddr, HwDeviceExtension, 2);
- SiS_SetRegANDOR(SiS_Part4Port,0x26,0xFD,0x00);
- SiS_SetPanelDelay(ROMAddr, HwDeviceExtension, 4);
- }
- }
- } else if(!(SiS_IsDualEdge(HwDeviceExtension, BaseAddr))) {
- if (!(SiS_CRT2IsLCD(BaseAddr))) {
- SiS_SetPanelDelay(ROMAddr, HwDeviceExtension, 2);
- SiS_SetRegANDOR(SiS_Part4Port,0x26,0xFD,0x00);
- SiS_SetPanelDelay(ROMAddr, HwDeviceExtension, 4);
- } else if(!(SiS_WeHaveBacklightCtrl(HwDeviceExtension, BaseAddr))) {
- if(!(SiS_IsDualEdge(HwDeviceExtension, BaseAddr))) {
- SiS_SetPanelDelay(ROMAddr, HwDeviceExtension, 2);
- SiS_SetRegANDOR(SiS_Part4Port,0x26,0xFD,0x00);
- SiS_SetPanelDelay(ROMAddr, HwDeviceExtension, 4);
- } else if(SiS_IsVAMode(HwDeviceExtension, BaseAddr)) {
- SiS_SetPanelDelay(ROMAddr, HwDeviceExtension, 2);
- SiS_SetRegANDOR(SiS_Part4Port,0x26,0xFD,0x00);
- SiS_SetPanelDelay(ROMAddr, HwDeviceExtension, 4);
- }
- }
- }
- /* TW: 650/301LV end */
+ if( (!(SiS_Is301B(SiS_Pr,BaseAddr))) ||
+ (!(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr))) ) {
- }
+ SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xDF);
+ SiS_DisplayOff(SiS_Pr);
- } else { /* ============ TW: For 301 ================ */
+ }
+
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x80);
+
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF);
+
+ temp = SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x00);
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x10);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x00,temp);
+
+ }
- if(HwDeviceExtension->jChipType < SIS_315H)
- SiS_SetRegANDOR(SiS_P3c4,0x11,0xF7,0x08);
+ } /* 315/330 */
- SiS_SetRegAND(SiS_Part2Port,0x00,0xDF); /* disable VB */
- SiS_DisplayOff();
+#endif /* SIS315H */
- if(HwDeviceExtension->jChipType >= SIS_315H)
- SiS_SetRegOR(SiS_Part1Port,0x00,0x80);
+ }
- SiS_SetRegAND(SiS_P3c4,0x32,0xDF); /* disable lock mode */
+ } else { /* ============ TW: For 301 ================ */
- temp = SiS_GetReg1(SiS_Part1Port,0x00);
- SiS_SetRegOR(SiS_Part1Port,0x00,0x10);
+ if(HwDeviceExtension->jChipType < SIS_315H) {
+ if(SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension)) {
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xF0,0x0B);
+ SiS_SetPanelDelay(SiS_Pr, ROMAddr, HwDeviceExtension, 1);
+ }
+ }
- SiS_SetRegAND(SiS_P3c4,0x1E,0xDF); /* disable CRT2 */
- SiS_SetReg1(SiS_Part1Port,0x00,temp);
+ SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xDF); /* disable VB */
+ SiS_DisplayOff(SiS_Pr);
- if(HwDeviceExtension->jChipType < SIS_315H)
- SiS_SetRegANDOR(SiS_P3c4,0x11,0xFB,0x04);
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x80);
+ }
+
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF); /* disable lock mode */
+
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ temp = SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x00);
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x10);
+ SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x00,temp);
+ } else {
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF); /* disable CRT2 */
+ }
}
@@ -3944,115 +5142,153 @@ SiS_DisableBridge(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr)
if(HwDeviceExtension->jChipType < SIS_315H) {
- /* 300 series */
+#ifdef SIS300 /* 300 series */
- if(SiS_IF_DEF_CH70xx == 1) {
- if(SiS_Backup70xx == 0xff) {
- SiS_Backup70xx = SiS_GetCH700x(0x0e);
- }
- SiS_SetCH700x(0x090E);
+ if(SiS_Pr->SiS_IF_DEF_CH70xx == 1) {
+ SiS_SetCH700x(SiS_Pr,0x090E);
}
- if(!(SiS_GetReg1(SiS_P3c4,0x11) & 0x08)) {
-
- if(!(SiS_GetReg1(SiS_P3c4,0x13) & 0x40)) {
+ if(HwDeviceExtension->jChipType == SIS_730) {
+ if(!(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x11) & 0x08)) {
+ SiS_WaitVBRetrace(SiS_Pr,HwDeviceExtension);
+ }
+ if(!(SiS_CR36BIOSWord23b(SiS_Pr,HwDeviceExtension))) {
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xF7,0x08);
+ SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3);
+ }
+ } else {
+ if(!(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x11) & 0x08)) {
- if(!(SiS_CR36BIOSWord23b(HwDeviceExtension))) {
+ if(!(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13) & 0x40)) {
+
+ if(!(SiS_CR36BIOSWord23b(SiS_Pr,HwDeviceExtension))) {
- SiS_WaitVBRetrace(HwDeviceExtension);
+ SiS_WaitVBRetrace(SiS_Pr,HwDeviceExtension);
- if(!(SiS_GetReg1(SiS_P3c4,0x06) & 0x1c)) {
- SiS_DisplayOff();
+ if(!(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x06) & 0x1c)) {
+ SiS_DisplayOff(SiS_Pr);
}
- SiS_SetRegANDOR(SiS_P3c4,0x11,0xF7,0x08);
- SiS_SetPanelDelay(ROMAddr, HwDeviceExtension, 3);
- }
- }
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xF7,0x08);
+ SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3);
+ }
+ }
+ }
}
- SiS_DisplayOff();
+ SiS_DisplayOff(SiS_Pr);
- SiS_SetRegAND(SiS_P3c4,0x32,0xDF);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF);
- SiS_SetRegAND(SiS_P3c4,0x1E,0xDF);
- SiS_UnLockCRT2(HwDeviceExtension,BaseAddr);
- SiS_SetRegOR(SiS_Part1Port,0x01,0x80);
- SiS_SetRegOR(SiS_Part1Port,0x02,0x40);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF);
+ SiS_UnLockCRT2(SiS_Pr,HwDeviceExtension,BaseAddr);
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x01,0x80);
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x02,0x40);
- if( (!(SiS_CRT2IsLCD(BaseAddr))) ||
- (!(SiS_CR36BIOSWord23d(HwDeviceExtension))) ) {
- SiS_SetPanelDelay(ROMAddr, HwDeviceExtension, 2);
- SiS_SetRegANDOR(SiS_P3c4,0x11,0xFB,0x04);
+ if( (!(SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension))) ||
+ (!(SiS_CR36BIOSWord23d(SiS_Pr,HwDeviceExtension))) ) {
+ SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 2);
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xFB,0x04);
}
+#endif /* SIS300 */
+
} else {
- /* 310 series */
+#ifdef SIS315H /* 310/325 series */
- if(SiS_IF_DEF_CH70xx == 2) {
- if(!(SiS_IsDualEdge(HwDeviceExtension, BaseAddr))) {
- SiS_Chrontel701xOff();
- SiS_Chrontel701xOff2();
- } else if(SiS_IsVAMode(HwDeviceExtension, BaseAddr)) {
- SiS_Chrontel701xOff();
- SiS_Chrontel701xOff2();
+ if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
+ if(!(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ SiS_Chrontel701xBLOff(SiS_Pr);
+ SiS_Chrontel701xOff(SiS_Pr);
+ } else if(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) {
+ SiS_Chrontel701xBLOff(SiS_Pr);
+ SiS_Chrontel701xOff(SiS_Pr);
}
- if(!(SiS_IsDualEdge(HwDeviceExtension, BaseAddr))) {
- SiS_SetCH701x(0x0149);
- } else if(SiS_IsTVOrSomething(HwDeviceExtension, BaseAddr)) {
- SiS_SetCH701x(0x0149);
+ if(!(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ SiS_SetCH701x(SiS_Pr,0x0149);
+ } else if(SiS_IsTVOrYPbPrOrScart(SiS_Pr,HwDeviceExtension, BaseAddr)) {
+ SiS_SetCH701x(SiS_Pr,0x0149);
}
}
- if(!(SiS_IsDualEdge(HwDeviceExtension, BaseAddr))) {
- SiS_DisplayOff();
- } else if(!(SiS_IsTVOrSomething(HwDeviceExtension, BaseAddr))) {
- SiS_DisplayOff();
+ if(SiS_Pr->SiS_IF_DEF_CH70xx == 0) {
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xF7,0x08);
+ SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3);
+ }
+
+ if(SiS_Pr->SiS_IF_DEF_CH70xx == 0) {
+ SiS_DisplayOff(SiS_Pr);
+ } else if(!(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ SiS_DisplayOff(SiS_Pr);
+ } else if(!(SiS_IsTVOrYPbPrOrScart(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ SiS_DisplayOff(SiS_Pr);
}
- if(!(SiS_IsDualEdge(HwDeviceExtension, BaseAddr))) {
- SiS_SetRegOR(SiS_Part1Port,0x00,0x80);
- } else if(!(SiS_IsVAMode(HwDeviceExtension, BaseAddr))) {
- SiS_SetRegOR(SiS_Part1Port,0x00,0x80);
+ if(SiS_Pr->SiS_IF_DEF_CH70xx == 0) {
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x80);
+ } else if(!(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x80);
+ } else if(!(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x80);
}
- SiS_SetRegAND(SiS_P3c4,0x32,0xDF);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF);
- if(!(SiS_IsDualEdge(HwDeviceExtension, BaseAddr))) {
- SiS_SetRegAND(SiS_P3c4,0x1E,0xDF);
- } else if(!(SiS_IsVAMode(HwDeviceExtension, BaseAddr))) {
- SiS_SetRegAND(SiS_P3c4,0x1E,0xDF);
+ if(SiS_Pr->SiS_IF_DEF_CH70xx == 0) {
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF);
+ } else if(!(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF);
+ } else if(!(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF);
}
- if(SiS_IsVAMode(HwDeviceExtension, BaseAddr)) {
- SiS_SetRegAND(SiS_Part1Port,0x1e,0xdf);
+ if(SiS_Pr->SiS_IF_DEF_CH70xx == 0) {
+ if(SiS_CRT2IsLCD(SiS_Pr, BaseAddr,HwDeviceExtension)) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x1e,0xdf);
+ }
+ } else if(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x1e,0xdf);
}
- if(SiS_IsDualEdge(HwDeviceExtension, BaseAddr)) {
- SiS_SetRegAND(SiS_Part1Port,0x13,0xff);
- } else {
- SiS_SetRegAND(SiS_Part1Port,0x13,0xfb);
+ if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
+ if(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr)) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x13,0xff);
+ } else {
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x13,0xfb);
+ }
}
- SiS_UnLockCRT2(HwDeviceExtension, BaseAddr);
+ SiS_UnLockCRT2(SiS_Pr,HwDeviceExtension, BaseAddr);
- if(!(SiS_IsDualEdge(HwDeviceExtension, BaseAddr))) {
- SiS_SetRegAND(SiS_Part1Port,0x2e,0xf7);
- } else if(!(SiS_IsVAMode(HwDeviceExtension, BaseAddr))) {
- SiS_SetRegAND(SiS_Part1Port,0x2e,0xf7);
+ if(SiS_Pr->SiS_IF_DEF_CH70xx == 0) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2e,0xf7);
+ } else if(!(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2e,0xf7);
+ } else if(!(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2e,0xf7);
}
#if 0 /* TW: BIOS code makes no sense */
- if(SiS_IsVAMode(HwDeviceExtension, BaseAddr)) {
- if(!(SiS_IsDualEdge(HwDeviceExtension, BaseAddr))) {
- if(SiS_WeHaveBacklightCtrl(HwDeviceExtension, BaseAddr)) {
+ if(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) {
+ if(!(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ if(SiS_WeHaveBacklightCtrl(SiS_Pr,HwDeviceExtension, BaseAddr)) {
/* Nothing there! */
}
}
}
#endif
+ if(SiS_Pr->SiS_IF_DEF_CH70xx == 0) {
+ if(SiS_CRT2IsLCD(SiS_Pr, BaseAddr,HwDeviceExtension)) {
+ if(!(SiS_WeHaveBacklightCtrl(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 2);
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xFB,0x04);
+ }
+ }
+ }
+
+#endif /* SIS315H */
} /* 310 series */
@@ -4060,181 +5296,440 @@ SiS_DisableBridge(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr)
}
-/* TW: Checked against 650/LVDS(1.10.07)/301 and 630/301B BIOS */
+/* TW: Checked against all BIOSes */
void
-SiS_EnableBridge(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr)
+SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr)
{
- USHORT temp=0,tempah,temp1;
+ USHORT temp=0,tempah;
+#ifdef SIS315H
+ USHORT temp1,pushax=0;
+ BOOLEAN delaylong = FALSE;
+#endif
UCHAR *ROMAddr = HwDeviceExtension->pjVirtualRomBase;
- if(SiS_IF_DEF_LVDS == 0) {
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
- if(SiS_VBType & VB_SIS301BLV302BLV) { /* TW: ====== For 301B ====== */
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { /* TW: ====== For 301B et al ====== */
if(HwDeviceExtension->jChipType < SIS_315H) {
- /* 300 series */
+#ifdef SIS300 /* 300 series */
+
+ if(HwDeviceExtension->jChipType == SIS_300) {
- if(SiS_CRT2IsLCD(BaseAddr)) {
- SiS_SetRegAND(SiS_P3c4,0x11,0xFB);
- if(!(SiS_CR36BIOSWord23d(HwDeviceExtension))) {
- SiS_SetPanelDelay(ROMAddr, HwDeviceExtension, 0);
+ if(SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension)) {
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x26,0x02);
+ if(!(SiS_CR36BIOSWord23d(SiS_Pr,HwDeviceExtension))) {
+ SiS_SetPanelDelay(SiS_Pr, ROMAddr, HwDeviceExtension, 0);
+ }
+ }
}
- SiS_SetRegOR(SiS_P3c4,0x1E,0x20); /* Enable CRT2 */
-/* DoSomeThingPCI_On() */
- SiS_DisplayOn();
- SiS_UnLockCRT2(HwDeviceExtension, BaseAddr);
- SiS_SetRegAND(SiS_Part1Port,0x02,0xBF);
- if(SiS_BridgeInSlave()) {
- SiS_SetRegAND(SiS_Part1Port,0x01,0x1F);
- } else {
- SiS_SetRegANDOR(SiS_Part1Port,0x01,0x1F,0x40);
+ temp = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x32) & 0xDF; /* lock mode */
+ if(SiS_BridgeInSlave(SiS_Pr)) {
+ tempah = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30);
+ if(!(tempah & SetCRT2ToRAMDAC)) temp |= 0x20;
}
- if(!(SiS_GetReg1(SiS_P3c4,0x13) & 0x40)) {
- if(!(SiS_GetReg1(SiS_P3c4,0x16) & 0x10)) {
- if(!(SiS_CR36BIOSWord23b(HwDeviceExtension))) {
- SiS_SetPanelDelay(ROMAddr, HwDeviceExtension, 1);
- }
- SiS_WaitVBRetrace(HwDeviceExtension);
- SiS_SetRegANDOR(SiS_P3c4,0x11,0xF7,0x00);
- }
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x32,temp);
+ SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x00,0x1F,0x20); /* enable VB processor */
+ if(SiS_Is301B(SiS_Pr,BaseAddr)) {
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x1F,0xC0);
+ SiS_DisplayOn(SiS_Pr);
+ } else {
+ SiS_VBLongWait(SiS_Pr);
+ SiS_DisplayOn(SiS_Pr);
+ SiS_VBLongWait(SiS_Pr);
}
- } else {
- temp = SiS_GetReg1(SiS_P3c4,0x32) & 0xDF; /* lock mode */
- if(SiS_BridgeInSlave()) {
- tempah = SiS_GetReg1(SiS_P3d4,0x30);
- if(!(tempah & SetCRT2ToRAMDAC)) temp |= 0x20;
- }
- SiS_SetReg1(SiS_P3c4,0x32,temp);
- SiS_SetRegOR(SiS_P3c4,0x1E,0x20);
- SiS_SetRegANDOR(SiS_Part2Port,0x00,0x1F,0x20); /* enable VB processor */
- if(SiS_Is301B(BaseAddr)) {
- SiS_SetRegOR(SiS_Part4Port,0x1F,0xC0);
- SiS_DisplayOn();
- } else {
- SiS_VBLongWait();
- SiS_DisplayOn();
- SiS_VBLongWait();
- }
- }
+ if(SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension)) {
+ if(!(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13) & 0x40)) {
+ if(!(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16) & 0x10)) {
+ if(!(SiS_CR36BIOSWord23b(SiS_Pr,HwDeviceExtension))) {
+ SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 1);
+ }
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x26,0xfe,0x01);
+ }
+ }
+ }
+ }
+
+ } else {
+
+ if((SiS_Pr->SiS_VBType & VB_NoLCD) &&
+ (SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension))) {
+ /* This is only for LCD output on 301B-DH via LVDS */
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x11,0xFB);
+ if(!(SiS_CR36BIOSWord23d(SiS_Pr,HwDeviceExtension))) {
+ SiS_SetPanelDelay(SiS_Pr, ROMAddr, HwDeviceExtension, 0);
+ }
+ SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20); /* Enable CRT2 */
+/* DoSomeThingPCI_On(SiS_Pr) */
+ SiS_DisplayOn(SiS_Pr);
+ SiS_UnLockCRT2(SiS_Pr,HwDeviceExtension, BaseAddr);
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x02,0xBF);
+ if(SiS_BridgeInSlave(SiS_Pr)) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x01,0x1F);
+ } else {
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x01,0x1F,0x40);
+ }
+ if(!(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13) & 0x40)) {
+ if(!(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16) & 0x10)) {
+ if(!(SiS_CR36BIOSWord23b(SiS_Pr,HwDeviceExtension))) {
+ SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 1);
+ }
+ SiS_WaitVBRetrace(SiS_Pr,HwDeviceExtension);
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xF7,0x00);
+ }
+ }
+ } else {
+ temp = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x32) & 0xDF; /* lock mode */
+ if(SiS_BridgeInSlave(SiS_Pr)) {
+ tempah = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30);
+ if(!(tempah & SetCRT2ToRAMDAC)) temp |= 0x20;
+ }
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x32,temp);
+ SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x00,0x1F,0x20); /* enable VB processor */
+ if(SiS_Is301B(SiS_Pr,BaseAddr)) {
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x1F,0xC0);
+ SiS_DisplayOn(SiS_Pr);
+ } else {
+ SiS_VBLongWait(SiS_Pr);
+ SiS_DisplayOn(SiS_Pr);
+ SiS_VBLongWait(SiS_Pr);
+ }
+ }
+
+ }
+#endif /* SIS300 */
} else {
- /* 310 series */
+#ifdef SIS315H /* 310/325 series */
- /* TW: Inserted from 650/301LV BIOS */
- if(SiS_IsVAMode(HwDeviceExtension, BaseAddr)) {
- SiS_SetRegANDOR(SiS_Part4Port,0x26,0xfd,0x02);
- SiS_SetPanelDelay(ROMAddr, HwDeviceExtension, 0);
- } else if(SiS_CRT2IsLCD(BaseAddr)) {
- SiS_SetRegANDOR(SiS_Part4Port,0x26,0xfd,0x02);
- SiS_SetPanelDelay(ROMAddr, HwDeviceExtension, 0);
- }
- /* TW: --- end --- */
+ if(IS_SIS650740) { /* 650 */
- if(!(SiS_IsVAMode(HwDeviceExtension, BaseAddr))) {
- temp = SiS_GetReg1(SiS_P3c4,0x32) & 0xDF;
- if(SiS_BridgeInSlave()) {
- tempah = SiS_GetReg1(SiS_P3d4,0x30);
- if(!(tempah & SetCRT2ToRAMDAC)) temp |= 0x20;
- }
- SiS_SetReg1(SiS_P3c4,0x32,temp);
+#if 0
+ if(SiS_GetReg1(SiS_Pr->SiS_Part4Port,0x00) != 1) return; /* From 1.10.7w */
+#endif
- SiS_SetRegOR(SiS_P3c4,0x1E,0x20); /* enable CRT2 */
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1f,0xef); /* 1.10.7u */
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x30,0x00); /* 1.10.7u */
-/* SiS_SetRegAND(SiS_Part1Port,0x2E,0x7F); */ /* TW: Not done in 650/301LV BIOS */
- temp=SiS_GetReg1(SiS_Part1Port,0x2E);
- if (!(temp & 0x80))
- SiS_SetRegOR(SiS_Part1Port,0x2E,0x80);
- }
+ if(!(IS_SIS740)) {
+ if(!(SiS_IsNotM650or651(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ tempah = 0x10;
+ if(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) {
+ tempah = 0x08;
+ }
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x4c,tempah);
+ }
+ }
- SiS_SetRegANDOR(SiS_Part2Port,0x00,0x1F,0x20); /* enable VB processor */
+ SiS_SetReg3(SiS_Pr->SiS_P3c6,0x00);
+ SiS_DisplayOff(SiS_Pr);
+ pushax = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x06);
+ if(IS_SIS740) {
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x06,0xE3);
+ }
- if(SiS_Is301B(BaseAddr)) {
-#if 0 /* TW: This is not done in 630/301LV BIOS */
- if(SiS_IsVAMode(HwDeviceExtension, BaseAddr)) {
- SiS_SetRegOR(SiS_P3c4,0x1E,0x20); /* enable CRT2 */
- }
+ if( (SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) ||
+ (SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension)) ) {
+ if(!(SiS_GetReg1(SiS_Pr->SiS_Part4Port,0x26) & 0x02)) {
+ SiS_SetPanelDelayLoop(SiS_Pr,ROMAddr, HwDeviceExtension, 3, 2);
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x26,0x02);
+ SiS_SetPanelDelayLoop(SiS_Pr,ROMAddr, HwDeviceExtension, 3, 2);
+ }
+ }
+
+ if(!(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x31) & 0x40)) {
+ SiS_SetPanelDelayLoop(SiS_Pr,ROMAddr, HwDeviceExtension, 3, 10);
+ delaylong = TRUE;
+ }
+
+ }
+
+ if(!(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ temp = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x32) & 0xDF;
+ if(SiS_BridgeInSlave(SiS_Pr)) {
+ tempah = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30);
+ if(!(tempah & SetCRT2ToRAMDAC)) temp |= 0x20;
+ }
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x32,temp);
+
+ SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20); /* enable CRT2 */
+
+ if(SiS_Pr->SiS_VBType & VB_SIS301B302B) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2e,0x7f);
+ temp = SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x2e);
+ if(!(temp & 0x80)) {
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2e,0x80);
+ }
+ } else {
+ SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 2);
+ }
+ }
+
+ if(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) {
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x1e,0x20);
+ }
+
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x00,0x1f,0x20);
+
+ if(SiS_Pr->SiS_VBType & VB_SIS301B302B) {
+ temp = SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x2e);
+ if(!(temp & 0x80)) {
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2e,0x80);
+ }
+ }
+
+ tempah = 0xc0;
+ if(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr)) {
+ tempah = 0x80;
+ if(!(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ tempah = 0x40;
+ }
+ }
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x1F,tempah);
+
+ if(SiS_Pr->SiS_VBType & VB_SIS301B302B) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x00,0x7f);
+ }
+
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x30,0x00); /* All this from 1.10.7u */
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x27,0x0c);
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x30,0x20);
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x31,0x05);
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x32,0x60);
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x33,0x00);
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x34,0x10);
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x30,0x40);
+
+ SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 2);
+
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x1f,0x10); /* 1.10.8r */
+
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2e,0x80);
+
+ if(!(SiS_WeHaveBacklightCtrl(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ if( (SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) ||
+ ((SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension))) ) {
+ SiS_SetPanelDelayLoop(SiS_Pr,ROMAddr, HwDeviceExtension, 3, 10);
+ if(delaylong) {
+ SiS_SetPanelDelayLoop(SiS_Pr,ROMAddr, HwDeviceExtension, 3, 10);
+ }
+ SiS_WaitVBRetrace(SiS_Pr,HwDeviceExtension);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x26,0xfe,0x01);
+ }
+ }
+
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x06,pushax);
+ SiS_DisplayOn(SiS_Pr);
+ SiS_SetReg3(SiS_Pr->SiS_P3c6,0xff);
+
+ if(!(SiS_WeHaveBacklightCtrl(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x00,0x7f);
+ }
+#if 0
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x30,0x00);
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x27,0x0c);
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x30,0x20);
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x31,0x05); /* 1.10.8r: 0x0d */
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x32,0x60); /* 1.10.8r: 0x70 */
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x33,0x00); /* 1.10.8r: 0x40 */
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x34,0x10);
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x30,0x40);
+#endif
+
+ }
+
+#if 0
+ } else if(IS_SIS740) { /* 740 */
+
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) { /* 30xLV */
+
+ SiS_SetReg3(SiS_Pr->SiS_P3c6,0x00);
+ SiS_DisplayOff(SiS_Pr);
+ pushax = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x06);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x06,0xE3);
+
+ if( (SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) ||
+ (SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension)) ) {
+ if(!(SiS_GetReg1(SiS_Pr->SiS_Part4Port,0x26) & 0x02)) {
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x26,0x02);
+ SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 3);
+ }
+ }
+
+ if(!(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ temp = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x32) & 0xDF;
+ if(SiS_BridgeInSlave(SiS_Pr)) {
+ tempah = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30);
+ if(!(tempah & SetCRT2ToRAMDAC)) temp |= 0x20;
+ }
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x32,temp);
+
+ SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20);
+ SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 2);
+ }
+
+ if(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) {
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x1E,0x20);
+ }
+
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x00,0x1f,0x20);
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x1F,0xC0);
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x1F,0x10); /* (taken from 650 1.10.8r) */
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2E,0x80);
+
+ if(!(SiS_WeHaveBacklightCtrl(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ if( (SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) ||
+ (SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension)) ) {
+ SiS_SetPanelDelayLoop(SiS_Pr,ROMAddr, HwDeviceExtension, 3, 10);
+ if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x31) & 0x40) {
+ SiS_WaitVBRetrace(SiS_Pr,HwDeviceExtension);
+ }
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x26,0xfe,0x01);
+ SiS_SetPanelDelayLoop(SiS_Pr,ROMAddr, HwDeviceExtension, 3, 10);
+ SiS_WaitVBRetrace(SiS_Pr,HwDeviceExtension);
+ }
+ }
+
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x06,pushax);
+ SiS_DisplayOn(SiS_Pr);
+ SiS_SetReg3(SiS_Pr->SiS_P3c6,0xff);
+
+ if(!(SiS_WeHaveBacklightCtrl(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x00,0x7f);
+ }
+
+ } else { /* (301), 301B */
+
+ if(!(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ temp = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x32) & 0xDF;
+ if(SiS_BridgeInSlave(SiS_Pr)) {
+ tempah = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30);
+ if(!(tempah & SetCRT2ToRAMDAC)) temp |= 0x20;
+ }
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x32,temp);
+
+ SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20); /* enable CRT2 */
+
+ temp = SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x2E);
+ if(!(temp & 0x80))
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2E,0x80);
+ }
+
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x00,0x1f,0x20);
+
+ if(SiS_Is301B(SiS_Pr,BaseAddr)) {
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x1F,0xC0);
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x00,0x7f);
+ } else {
+ SiS_VBLongWait(SiS_Pr);
+ SiS_DisplayOn(SiS_Pr);
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x00,0x7F);
+ SiS_VBLongWait(SiS_Pr);
+ }
+
+ }
#endif
- /* TW: This is done instead: */
- SiS_SetRegOR(SiS_Part4Port,0x1F,0xc0);
+
+ } else { /* 315, 330 */
+
+ if(!(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ temp = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x32) & 0xDF;
+ if(SiS_BridgeInSlave(SiS_Pr)) {
+ tempah = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30);
+ if(!(tempah & SetCRT2ToRAMDAC)) temp |= 0x20;
+ }
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x32,temp);
+
+ SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20); /* enable CRT2 */
+
+ temp = SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x2E);
+ if(!(temp & 0x80))
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2E,0x80);
+ }
-#if 0 /* TW: This is not done in 630/301LV BIOS */
- temp=SiS_GetReg1(SiS_Part1Port,0x2E);
- if (!(temp & 0x80))
- SiS_SetRegOR(SiS_Part1Port,0x2E,0x80);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x00,0x1f,0x20);
- tempah = 0xC0;
- if(SiS_IsDualEdge(HwDeviceExtension, BaseAddr)) {
+ if(SiS_Is301B(SiS_Pr,BaseAddr)) {
+
+ temp=SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x2E);
+ if (!(temp & 0x80))
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2E,0x80);
+
+ tempah = 0xc0;
+ if(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr)) {
tempah = 0x80;
- if(!(SiS_IsVAMode(HwDeviceExtension, BaseAddr))) {
- tempah = 0x40;
+ if(!(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ tempah = 0x40;
}
- }
- SiS_SetRegOR(SiS_Part4Port,0x1F,tempah);
-#endif
- if(!(SiS_WeHaveBacklightCtrl(HwDeviceExtension, BaseAddr))) /* TW: "if" new from 650/301LV BIOS */
- SiS_SetRegAND(SiS_Part1Port,0x00,0x7F);
+ }
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x1F,tempah);
- } else {
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x00,0x7f);
- SiS_VBLongWait();
- SiS_DisplayOn();
- if(!(SiS_WeHaveBacklightCtrl(HwDeviceExtension, BaseAddr))) { /* TW: "if" new from 650/301LV BIOS */
- SiS_SetRegAND(SiS_Part1Port,0x00,0x7F);
- SiS_VBLongWait();
- }
+ } else {
+
+ SiS_VBLongWait(SiS_Pr);
+ SiS_DisplayOn(SiS_Pr);
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x00,0x7F);
+ SiS_VBLongWait(SiS_Pr);
- }
+ }
- /* TW: Entire section from 650/301LV BIOS */
- if(!(SiS_WeHaveBacklightCtrl(HwDeviceExtension, BaseAddr))) {
- if(SiS_IsVAMode(HwDeviceExtension, BaseAddr)) {
-/* if (!(SiS_WeHaveBacklightCtrl(HwDeviceExtension, BaseAddr))) { */ /* TW: BIOS code makes no sense */
- SiS_SetPanelDelay(ROMAddr, HwDeviceExtension, 1);
- SiS_WaitVBRetrace(HwDeviceExtension);
- SiS_SetRegANDOR(SiS_Part4Port,0x26,0xFE,0x01);
-/* } */
- } else if(SiS_CRT2IsLCD(BaseAddr)) {
-/* if (!(SiS_WeHaveBacklightCtrl(HwDeviceExtension, BaseAddr))) { */ /* TW: BIOS code makes no sense */
- SiS_SetPanelDelay(ROMAddr, HwDeviceExtension, 1);
- SiS_WaitVBRetrace(HwDeviceExtension);
- SiS_SetRegANDOR(SiS_Part4Port,0x26,0xFE,0x01);
-/* } */
- }
- }
- /* TW: --- end --- */
+ } /* 315, 330 */
+
+#endif /* SIS315H */
}
} else { /* ============ TW: For 301 ================ */
- if(HwDeviceExtension->jChipType < SIS_315H)
- SiS_SetRegANDOR(SiS_P3c4,0x11,0xFB,0x00);
+ if(HwDeviceExtension->jChipType < SIS_315H) {
+ if(SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension)) {
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xF0,0x0B);
+ SiS_SetPanelDelay(SiS_Pr, ROMAddr, HwDeviceExtension, 0);
+ }
+ }
- temp = SiS_GetReg1(SiS_P3c4,0x32) & 0xDF; /* lock mode */
- if(SiS_BridgeInSlave()) {
- tempah = SiS_GetReg1(SiS_P3d4,0x30);
+ temp = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x32) & 0xDF; /* lock mode */
+ if(SiS_BridgeInSlave(SiS_Pr)) {
+ tempah = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30);
if(!(tempah & SetCRT2ToRAMDAC)) temp |= 0x20;
}
- SiS_SetReg1(SiS_P3c4,0x32,temp);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x32,temp);
- SiS_SetRegANDOR(SiS_P3c4,0x1E,0xFF,0x20); /* enable CRT2 */
+ SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20); /* enable CRT2 */
- if(HwDeviceExtension->jChipType >= SIS_315H) { /* 310 series */
- temp=SiS_GetReg1(SiS_Part1Port,0x2E);
- if (!(temp & 0x80))
- SiS_SetRegOR(SiS_Part1Port,0x2E,0x80); /* by alan,BVBDOENABLE=1 */
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ temp = SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x2E);
+ if(!(temp & 0x80))
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2E,0x80); /* BVBDOENABLE=1 */
}
- SiS_SetRegANDOR(SiS_Part2Port,0x00,0x1F,0x20); /* enable VB processor */
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x00,0x1F,0x20); /* enable VB processor */
- SiS_VBLongWait();
- SiS_DisplayOn();
- SiS_VBLongWait();
+ SiS_VBLongWait(SiS_Pr);
+ SiS_DisplayOn(SiS_Pr);
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x00,0x7f);
+ }
+ SiS_VBLongWait(SiS_Pr);
- if(HwDeviceExtension->jChipType < SIS_315H)
- SiS_SetRegANDOR(SiS_P3c4,0x11,0xF7,0x00);
+ if(HwDeviceExtension->jChipType < SIS_315H) {
+ if(SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension)) {
+ SiS_SetPanelDelay(SiS_Pr, ROMAddr, HwDeviceExtension, 1);
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xF0,0x03);
+ }
+ }
}
@@ -4242,50 +5737,54 @@ SiS_EnableBridge(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr)
if(HwDeviceExtension->jChipType < SIS_315H) {
- /* 300 series */
+#ifdef SIS300 /* 300 series */
- if(SiS_CRT2IsLCD(BaseAddr)) {
- SiS_SetRegAND(SiS_P3c4,0x11,0xFB);
- if(!(SiS_CR36BIOSWord23d(HwDeviceExtension))) {
- SiS_SetPanelDelay(ROMAddr, HwDeviceExtension, 0);
+ if(SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension)) {
+ if(HwDeviceExtension->jChipType == SIS_730) {
+ SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 1);
+ SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 1);
+ SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 1);
+ }
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x11,0xFB);
+ if(!(SiS_CR36BIOSWord23d(SiS_Pr,HwDeviceExtension))) {
+ SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 0);
}
}
- SiS_EnableCRT2();
- SiS_DisplayOn();
- SiS_UnLockCRT2(HwDeviceExtension, BaseAddr);
- SiS_SetRegAND(SiS_Part1Port,0x02,0xBF);
- if(SiS_BridgeInSlave()) {
- SiS_SetRegAND(SiS_Part1Port,0x01,0x1F);
+ SiS_EnableCRT2(SiS_Pr);
+ SiS_DisplayOn(SiS_Pr);
+ SiS_UnLockCRT2(SiS_Pr,HwDeviceExtension, BaseAddr);
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x02,0xBF);
+ if(SiS_BridgeInSlave(SiS_Pr)) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x01,0x1F);
} else {
- SiS_SetRegANDOR(SiS_Part1Port,0x01,0x1F,0x40);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x01,0x1F,0x40);
}
- if(SiS_IF_DEF_CH70xx == 1) {
- if(!(SiS_CRT2IsLCD(BaseAddr))) {
- if (SiS_Backup70xx != 0xff) {
- SiS_SetCH700x(((SiS_Backup70xx<<8)|0x0E));
- SiS_Backup70xx = 0xff;
- } else SiS_SetCH700x(0x0B0E);
+ if(SiS_Pr->SiS_IF_DEF_CH70xx == 1) {
+ if(!(SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension))) {
+ SiS_SetCH700x(SiS_Pr,0x0B0E);
}
}
- if(SiS_CRT2IsLCD(BaseAddr)) {
- if(!(SiS_GetReg1(SiS_P3c4,0x13) & 0x40)) {
- if(!(SiS_GetReg1(SiS_P3c4,0x16) & 0x10)) {
- if(!(SiS_CR36BIOSWord23b(HwDeviceExtension))) {
- SiS_SetPanelDelay(ROMAddr, HwDeviceExtension, 1);
- SiS_SetPanelDelay(ROMAddr, HwDeviceExtension, 1);
+ if(SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension)) {
+ if(!(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13) & 0x40)) {
+ if(!(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16) & 0x10)) {
+ if(!(SiS_CR36BIOSWord23b(SiS_Pr,HwDeviceExtension))) {
+ SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 1);
+ SiS_SetPanelDelay(SiS_Pr,ROMAddr, HwDeviceExtension, 1);
}
- SiS_WaitVBRetrace(HwDeviceExtension);
- SiS_SetRegAND(SiS_P3c4,0x11,0xF7);
+ SiS_WaitVBRetrace(SiS_Pr,HwDeviceExtension);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x11,0xF7);
}
}
}
+#endif /* SIS300 */
+
} else {
- /* 310 series */
+#ifdef SIS315H /* 310/325 series */
#if 0 /* BIOS code makes no sense */
if(SiS_IsVAMode()) {
@@ -4294,79 +5793,137 @@ SiS_EnableBridge(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr)
}
#endif
- SiS_EnableCRT2();
- SiS_UnLockCRT2(HwDeviceExtension, BaseAddr);
+ if(SiS_Pr->SiS_IF_DEF_CH70xx == 0) {
+ if(SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension)) {
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x11,0xFB);
+ SiS_SetPanelDelay(SiS_Pr, ROMAddr, HwDeviceExtension, 0);
+ }
+ }
+
+ SiS_EnableCRT2(SiS_Pr);
+ SiS_UnLockCRT2(SiS_Pr,HwDeviceExtension, BaseAddr);
- SiS_SetRegAND(SiS_Part1Port,0x2e,0xf7);
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2e,0xf7);
- if(SiS_IF_DEF_CH70xx == 2) {
- temp = SiS_GetCH701x(0x66);
+ if(SiS_Pr->SiS_IF_DEF_CH70xx == 2) {
+ temp = SiS_GetCH701x(SiS_Pr,0x66);
temp &= 0x20;
- SiS_Chrontel701xOff();
+ SiS_Chrontel701xBLOff(SiS_Pr);
}
- SiS_SetRegAND(SiS_Part1Port,0x2e,0x7f);
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2e,0x7f);
- temp1 = SiS_GetReg1(SiS_Part1Port,0x2E);
+ temp1 = SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x2E);
if (!(temp1 & 0x80))
- SiS_SetRegOR(SiS_Part1Port,0x2E,0x80);
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2E,0x80);
- if(SiS_IF_DEF_CH70xx == 2) {
+ if(SiS_Pr->SiS_IF_DEF_CH70xx == 2) {
if(temp) {
- SiS_Chrontel701xOn();
+ SiS_Chrontel701xBLOn(SiS_Pr);
}
}
- if(SiS_IsVAMode(HwDeviceExtension, BaseAddr)) {
- SiS_SetRegOR(SiS_Part1Port,0x1E,0x20);
+ if(SiS_Pr->SiS_IF_DEF_CH70xx == 0) {
+ if(SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension)) {
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x1E,0x20);
+ }
+ } else if(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) {
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x1E,0x20);
}
- if(!(SiS_WeHaveBacklightCtrl(HwDeviceExtension, BaseAddr))) {
- SiS_SetRegAND(SiS_Part1Port,0x00,0x7f);
+ if(!(SiS_WeHaveBacklightCtrl(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x00,0x7f);
}
- if(SiS_IF_DEF_CH70xx == 2) {
+ if(SiS_Pr->SiS_IF_DEF_CH70xx == 2) {
- if(SiS_IsTVOrSomething(HwDeviceExtension, BaseAddr)) {
- SiS_Chrontel701xOn2(HwDeviceExtension, BaseAddr);
+ if(SiS_IsTVOrYPbPrOrScart(SiS_Pr,HwDeviceExtension, BaseAddr)) {
+ SiS_Chrontel701xOn(SiS_Pr,HwDeviceExtension, BaseAddr);
}
- if(SiS_IsVAMode(HwDeviceExtension, BaseAddr)) {
- SiS_ChrontelDoSomething1(HwDeviceExtension, BaseAddr);
- } else if(SiS_IsLCDOrLCDA(HwDeviceExtension, BaseAddr)) {
- SiS_ChrontelDoSomething1(HwDeviceExtension, BaseAddr);
+ if(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) {
+ SiS_ChrontelDoSomething1(SiS_Pr,HwDeviceExtension, BaseAddr);
+ } else if(SiS_IsLCDOrLCDA(SiS_Pr,HwDeviceExtension, BaseAddr)) {
+ SiS_ChrontelDoSomething1(SiS_Pr,HwDeviceExtension, BaseAddr);
}
}
- if(SiS_IF_DEF_CH70xx == 2) {
- if(!(SiS_WeHaveBacklightCtrl(HwDeviceExtension, BaseAddr))) {
- if(SiS_IsVAMode(HwDeviceExtension, BaseAddr)) {
- SiS_Chrontel701xOn();
- SiS_ChrontelDoSomething4(HwDeviceExtension, BaseAddr);
- } else if(SiS_IsLCDOrLCDA(HwDeviceExtension, BaseAddr)) {
-/* if(!SiS_WeHaveBacklightCtrl(HwDeviceExtension, BaseAddr)) { */ /* TW: makes no sense */
- SiS_Chrontel701xOn();
- SiS_ChrontelDoSomething4(HwDeviceExtension, BaseAddr);
+ if(SiS_Pr->SiS_IF_DEF_CH70xx == 2) {
+ if(!(SiS_WeHaveBacklightCtrl(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ if(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) {
+ SiS_Chrontel701xBLOn(SiS_Pr);
+ SiS_ChrontelDoSomething4(SiS_Pr,HwDeviceExtension, BaseAddr);
+ } else if(SiS_IsLCDOrLCDA(SiS_Pr,HwDeviceExtension, BaseAddr)) {
+/* if(!SiS_WeHaveBacklightCtrl(SiS_Pr,HwDeviceExtension, BaseAddr)) { */ /* TW: makes no sense */
+ SiS_Chrontel701xBLOn(SiS_Pr);
+ SiS_ChrontelDoSomething4(SiS_Pr,HwDeviceExtension, BaseAddr);
/* } */
}
}
+ } else if(SiS_Pr->SiS_IF_DEF_CH70xx == 0) {
+ if(!(SiS_WeHaveBacklightCtrl(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ if(SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension)) {
+ SiS_SetPanelDelay(SiS_Pr, ROMAddr, HwDeviceExtension, 1);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x11,0xF7);
+ }
+ }
}
+#endif /* SIS315H */
+
} /* 310 series */
} /* LVDS */
}
+void
+SiS_SiS30xBLOn(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
+{
+ USHORT BaseAddr = (USHORT)HwDeviceExtension->ulIOAddress;
+
+ /* TW: Switch on LCD backlight on SiS30xLV */
+ if( (SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) ||
+ (SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension)) ) {
+ if(!(SiS_GetReg1(SiS_Pr->SiS_Part4Port,0x26) & 0x02)) {
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x26,0x02);
+ SiS_WaitVBRetrace(SiS_Pr,HwDeviceExtension);
+ }
+ if(!(SiS_GetReg1(SiS_Pr->SiS_Part4Port,0x26) & 0x01)) {
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x26,0x01);
+ }
+ }
+}
+
+void
+SiS_SiS30xBLOff(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
+{
+ USHORT BaseAddr = (USHORT)HwDeviceExtension->ulIOAddress;
+
+ /* TW: Switch off LCD backlight on SiS30xLV */
+ if( (!(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr))) ||
+ (SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) ) {
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x26,0xFE,0x00);
+ }
+
+ if(!(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ if(!(SiS_CRT2IsLCD(SiS_Pr,BaseAddr,HwDeviceExtension))) {
+ if(!(SiS_IsDualEdge(SiS_Pr,HwDeviceExtension, BaseAddr))) {
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x26,0xFD,0x00);
+ }
+ }
+ }
+}
+
BOOLEAN
-SiS_CR36BIOSWord23b(PSIS_HW_DEVICE_INFO HwDeviceExtension)
+SiS_CR36BIOSWord23b(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
USHORT temp,temp1;
UCHAR *ROMAddr;
- if((ROMAddr = (UCHAR *)HwDeviceExtension->pjVirtualRomBase)) {
- temp = SiS_GetReg1(SiS_P3d4,0x36) & 0xff;
+ if((ROMAddr = (UCHAR *)HwDeviceExtension->pjVirtualRomBase) && SiS_Pr->SiS_UseROM) {
+ temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x36) & 0xff;
temp >>= 4;
temp = 1 << temp;
temp1 = (ROMAddr[0x23c] << 8) | ROMAddr[0x23b];
@@ -4378,13 +5935,13 @@ SiS_CR36BIOSWord23b(PSIS_HW_DEVICE_INFO HwDeviceExtension)
}
BOOLEAN
-SiS_CR36BIOSWord23d(PSIS_HW_DEVICE_INFO HwDeviceExtension)
+SiS_CR36BIOSWord23d(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
USHORT temp,temp1;
UCHAR *ROMAddr;
- if((ROMAddr = (UCHAR *)HwDeviceExtension->pjVirtualRomBase)) {
- temp = SiS_GetReg1(SiS_P3d4,0x36) & 0xff;
+ if((ROMAddr = (UCHAR *)HwDeviceExtension->pjVirtualRomBase) && SiS_Pr->SiS_UseROM) {
+ temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x36) & 0xff;
temp >>= 4;
temp = 1 << temp;
temp1 = (ROMAddr[0x23e] << 8) | ROMAddr[0x23d];
@@ -4396,95 +5953,161 @@ SiS_CR36BIOSWord23d(PSIS_HW_DEVICE_INFO HwDeviceExtension)
}
void
-SiS_SetPanelDelay(UCHAR *ROMAddr, PSIS_HW_DEVICE_INFO HwDeviceExtension,
+SiS_SetPanelDelayLoop(SiS_Private *SiS_Pr, UCHAR *ROMAddr, PSIS_HW_DEVICE_INFO HwDeviceExtension,
+ USHORT DelayTime, USHORT DelayLoop)
+{
+ int i;
+ for(i=0; i<DelayLoop; i++) {
+ SiS_SetPanelDelay(SiS_Pr, ROMAddr, HwDeviceExtension, DelayTime);
+ }
+}
+
+void
+SiS_SetPanelDelay(SiS_Private *SiS_Pr, UCHAR *ROMAddr, PSIS_HW_DEVICE_INFO HwDeviceExtension,
USHORT DelayTime)
{
- USHORT PanelID, DelayIndex, Delay, temp;
+ USHORT PanelID, DelayIndex, Delay;
+#ifdef SIS300
+ USHORT temp;
+#endif
if(HwDeviceExtension->jChipType < SIS_315H) {
- if(SiS_VBType & VB_SIS301BLV302BLV) {
- if(ROMAddr) {
- if(!(ROMAddr[0x235] & 0x40)) return;
- }
- }
- }
- if(HwDeviceExtension->jChipType < SIS_315H) {
- temp = SiS_GetReg1(SiS_P3c4,0x18);
- } else {
- temp = SiS_GetReg1(SiS_P3c4,0x1b);
- }
+#ifdef SIS300
- if( (SiS_VBType & VB_SIS301BLV302BLV) && (!(temp & 0x10)) ) {
- PanelID = 0x12;
- } else {
- PanelID = SiS_GetReg1(SiS_P3d4,0x36);
- }
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { /* 300 series, LVDS */
- DelayIndex = PanelID >> 4;
+ PanelID = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x36);
- if((DelayTime >= 2) && (PanelID & 0x0f) == 1) {
- Delay = 3;
- } else {
- if(DelayTime >= 2) DelayTime -= 2;
- if(SiS_IF_DEF_LVDS == 0) {
- if(!(DelayTime & 0x01)) {
- Delay = SiS_PanelDelayTbl[DelayIndex].timer[0];
- } else {
- Delay = SiS_PanelDelayTbl[DelayIndex].timer[1];
- if(HwDeviceExtension->jChipType >= SIS_315H) {
- if(DelayTime & 0x04) Delay = 0x190;
- }
- }
- } else {
- if(!(DelayTime & 0x01)) {
- Delay = SiS_PanelDelayTblLVDS[DelayIndex].timer[0];
- } else {
- Delay = SiS_PanelDelayTblLVDS[DelayIndex].timer[1];
- }
- }
- if(ROMAddr) {
- if(HwDeviceExtension->jChipType < SIS_315H) {
- if(ROMAddr[0x220] & 0x40) {
- if(!(DelayTime & 0x01)) {
- Delay = (USHORT)ROMAddr[0x225];
- } else {
- Delay = (USHORT)ROMAddr[0x226];
- }
+ DelayIndex = PanelID >> 4;
+
+ if((DelayTime >= 2) && ((PanelID & 0x0f) == 1)) {
+ Delay = 3;
+ } else {
+ if(DelayTime >= 2) DelayTime -= 2;
+
+ if(!(DelayTime & 0x01)) {
+ Delay = SiS_Pr->SiS_PanelDelayTbl[DelayIndex].timer[0];
+ } else {
+ Delay = SiS_Pr->SiS_PanelDelayTbl[DelayIndex].timer[1];
+ }
+ if((ROMAddr) && (SiS_Pr->SiS_UseROM)) {
+ if(ROMAddr[0x220] & 0x40) {
+ if(!(DelayTime & 0x01)) {
+ Delay = (USHORT)ROMAddr[0x225];
+ } else {
+ Delay = (USHORT)ROMAddr[0x226];
+ }
+ }
+ }
}
- } else {
- if(ROMAddr[0x13c] & 0x40) {
- if(!(DelayTime & 0x01)) {
- Delay = (USHORT)ROMAddr[0x141];
- } else {
- Delay = (USHORT)ROMAddr[0x142];
- if(DelayTime & 0x04) Delay = 0x190;
- }
+ SiS_ShortDelay(SiS_Pr,Delay);
+
+ } else { /* 300 series, 301(B) */
+
+ PanelID = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x36);
+ temp = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x18);
+ if(!(temp & 0x10)) PanelID = 0x12;
+
+ DelayIndex = PanelID >> 4;
+
+ if((DelayTime >= 2) && ((PanelID & 0x0f) == 1)) {
+ Delay = 3;
+ } else {
+ if(DelayTime >= 2) DelayTime -= 2;
+
+ if(!(DelayTime & 0x01)) {
+ Delay = SiS_Pr->SiS_PanelDelayTbl[DelayIndex].timer[0];
+ } else {
+ Delay = SiS_Pr->SiS_PanelDelayTbl[DelayIndex].timer[1];
+ }
+ if((ROMAddr) && (SiS_Pr->SiS_UseROM)) {
+ if(ROMAddr[0x220] & 0x40) {
+ if(!(DelayTime & 0x01)) {
+ Delay = (USHORT)ROMAddr[0x225];
+ } else {
+ Delay = (USHORT)ROMAddr[0x226];
+ }
+ }
+ }
+ }
+ SiS_ShortDelay(SiS_Pr,Delay);
+
+ }
+
+#endif /* SIS300 */
+
+ } else {
+
+ if(HwDeviceExtension->jChipType == SIS_330) return;
+
+#ifdef SIS315H
+
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { /* 310/325 series, LVDS */
+
+ if(SiS_Pr->SiS_IF_DEF_CH70xx == 0) {
+ PanelID = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x36);
+ DelayIndex = PanelID >> 4;
+ if((DelayTime >= 2) && ((PanelID & 0x0f) == 1)) {
+ Delay = 3;
+ } else {
+ if(DelayTime >= 2) DelayTime -= 2;
+
+ if(!(DelayTime & 0x01)) {
+ Delay = SiS_Pr->SiS_PanelDelayTblLVDS[DelayIndex].timer[0];
+ } else {
+ Delay = SiS_Pr->SiS_PanelDelayTblLVDS[DelayIndex].timer[1];
+ }
+ if((ROMAddr) && (SiS_Pr->SiS_UseROM)) {
+ if(ROMAddr[0x13c] & 0x40) {
+ if(!(DelayTime & 0x01)) {
+ Delay = (USHORT)ROMAddr[0x17e];
+ } else {
+ Delay = (USHORT)ROMAddr[0x17f];
+ }
+ }
+ }
+ }
+ SiS_ShortDelay(SiS_Pr,Delay);
}
- }
- }
- }
- SiS_ShortDelay(Delay);
+
+ } else { /* 310/325 series, 301(B) */
+
+ PanelID = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x36);
+ DelayIndex = PanelID >> 4;
+ if(!(DelayTime & 0x01)) {
+ Delay = SiS_Pr->SiS_PanelDelayTbl[DelayIndex].timer[0];
+ } else {
+ Delay = SiS_Pr->SiS_PanelDelayTbl[DelayIndex].timer[1];
+ }
+ SiS_DDC2Delay(SiS_Pr, Delay * 4);
+
+ }
+
+#endif /* SIS315H */
+
+ }
+
}
void
-SiS_LongDelay(USHORT delay)
+SiS_LongDelay(SiS_Private *SiS_Pr, USHORT delay)
{
while(delay--) {
- SiS_GenericDelay(0x19df); /* 6623 */
+ SiS_GenericDelay(SiS_Pr,0x19df);
}
}
void
-SiS_ShortDelay(USHORT delay)
+SiS_ShortDelay(SiS_Private *SiS_Pr, USHORT delay)
{
while(delay--) {
- SiS_GenericDelay(0x42); /* 66 */
+ SiS_GenericDelay(SiS_Pr,0x42);
}
}
void
-SiS_GenericDelay(USHORT delay)
+SiS_GenericDelay(SiS_Private *SiS_Pr, USHORT delay)
{
USHORT temp,flag;
@@ -4499,68 +6122,76 @@ SiS_GenericDelay(USHORT delay)
}
BOOLEAN
-SiS_Is301B(USHORT BaseAddr)
+SiS_Is301B(SiS_Private *SiS_Pr, USHORT BaseAddr)
{
USHORT flag;
- flag = SiS_GetReg1(SiS_Part4Port,0x01);
+ flag = SiS_GetReg1(SiS_Pr->SiS_Part4Port,0x01);
if(flag >= 0x0B0) return(1);
else return(0);
}
BOOLEAN
-SiS_CRT2IsLCD(USHORT BaseAddr)
+SiS_CRT2IsLCD(SiS_Private *SiS_Pr, USHORT BaseAddr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
USHORT flag;
- flag = SiS_GetReg1(SiS_P3d4,0x30);
+ if(HwDeviceExtension->jChipType == SIS_730) {
+ flag = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13);
+ if(flag & 0x20) return(1);
+ }
+ flag = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30);
if(flag & 0x20) return(1);
else return(0);
}
BOOLEAN
-SiS_IsDualEdge(PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr)
+SiS_IsDualEdge(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr)
{
#ifdef SIS315H
USHORT flag;
if(HwDeviceExtension->jChipType >= SIS_315H) {
- flag = SiS_GetReg1(SiS_P3d4,0x38);
- if(flag & EnableDualEdge) return(1); /* TW: Inverted result */
- else return(0);
+ if((HwDeviceExtension->jChipType != SIS_650) || (SiS_GetReg1(SiS_Pr->SiS_P3d4,0x5f) & 0xf0)) {
+ flag = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38);
+ if(flag & EnableDualEdge) return(1);
+ else return(0);
+ } else return(0);
} else
#endif
return(0);
}
-/* TW: Inverted result! */
BOOLEAN
-SiS_IsVAMode(PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr)
+SiS_IsVAMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr)
{
#ifdef SIS315H
USHORT flag;
if(HwDeviceExtension->jChipType >= SIS_315H) {
- flag = SiS_GetReg1(SiS_P3d4,0x38);
- if((flag & EnableDualEdge) && (flag & SetToLCDA))
- return(1);
- else if(SiS_VBType & VB_SIS301BLV302BLV) { /* TW: Inserted from 650/301LV BIOS */
- if(flag) return(1); /* TW: Inserted from 650/301LV BIOS */
- else return(0); /* TW: Inserted from 650/301LV BIOS */
- } else return(0);
+ flag = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38);
+ if((flag & EnableDualEdge) && (flag & SetToLCDA)) return(1);
+#if 0 /* Not done in 650/30xLV 1.10.6s, but in 650/301LV */
+ else if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ if(flag) return(1);
+ else return(0);
+ }
+#endif
+ else
+ return(0);
} else
#endif
return(0);
}
BOOLEAN
-SiS_WeHaveBacklightCtrl(PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr)
+SiS_WeHaveBacklightCtrl(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr)
{
#ifdef SIS315H
USHORT flag;
if(HwDeviceExtension->jChipType >= SIS_315H) {
- flag = SiS_GetReg1(SiS_P3d4,0x79);
+ flag = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x79);
if(flag & 0x10) return(1);
else return(0);
} else
@@ -4570,13 +6201,13 @@ SiS_WeHaveBacklightCtrl(PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr)
#if 0
BOOLEAN
-SiS_Is315E(PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr)
+SiS_Is315E(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr)
{
#ifdef SIS315H
USHORT flag;
if(HwDeviceExtension->jChipType >= SIS_315H) {
- flag = SiS_GetReg1(SiS_P3d4,0x5f);
+ flag = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x5f);
if(flag & 0x10) return(1);
else return(0);
} else
@@ -4586,57 +6217,89 @@ SiS_Is315E(PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr)
#endif
BOOLEAN
-SiS_IsYPbPr(PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr)
+SiS_IsNotM650or651(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr)
+{
+#ifdef SIS315H
+ USHORT flag;
+
+ if(HwDeviceExtension->jChipType == SIS_650) {
+ flag = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x5f);
+ flag &= 0xF0;
+ if((flag == 0xb0) || (flag == 0x90)) return 0;
+ else return 1;
+ } else
+#endif
+ return 1;
+}
+
+BOOLEAN
+SiS_IsYPbPr(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr)
{
#ifdef SIS315H
USHORT flag;
if(HwDeviceExtension->jChipType >= SIS_315H) {
- flag = SiS_GetReg1(SiS_P3d4,0x38);
- if(flag & 0x08) return(1);
- else return(0);
+ flag = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38);
+ if(flag & EnableLVDSHiVision) return(1); /* = YPrPb = 0x08 */
+ else return(0);
} else
#endif
return(0);
}
BOOLEAN
-SiS_IsTVOrSomething(PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr)
+SiS_IsChScart(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr)
+{
+#ifdef SIS315H
+ USHORT flag;
+
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ flag = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38);
+ if(flag & EnableLVDSScart) return(1); /* = Scart = 0x04 */
+ else return(0);
+ } else
+#endif
+ return(0);
+}
+
+BOOLEAN
+SiS_IsTVOrYPbPrOrScart(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr)
{
USHORT flag;
#ifdef SIS315H
if(HwDeviceExtension->jChipType >= SIS_315H) {
- flag = SiS_GetReg1(SiS_P3d4,0x30);
- if(flag & SetCRT2ToTV) return(1);
- flag = SiS_GetReg1(SiS_P3d4,0x38);
- if(flag & 0x08) return(1);
- else return(0);
+ flag = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30);
+ if(flag & SetCRT2ToTV) return(1);
+ flag = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38);
+ if(flag & EnableLVDSHiVision) return(1); /* = YPrPb = 0x08 */
+ if(flag & EnableLVDSScart) return(1); /* = Scart = 0x04- TW inserted */
+ else return(0);
} else
#endif
{
- flag = SiS_GetReg1(SiS_P3d4,0x30);
+ flag = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30);
if(flag & SetCRT2ToTV) return(1);
}
return(0);
}
BOOLEAN
-SiS_IsLCDOrLCDA(PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr)
+SiS_IsLCDOrLCDA(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr)
{
USHORT flag;
#ifdef SIS315H
if(HwDeviceExtension->jChipType >= SIS_315H) {
- flag = SiS_GetReg1(SiS_P3d4,0x30);
+ flag = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30);
if(flag & SetCRT2ToLCD) return(1);
- flag = SiS_GetReg1(SiS_P3d4,0x38);
+ flag = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38);
if(flag & SetToLCDA) return(1);
else return(0);
} else
#endif
{
- flag = SiS_GetReg1(SiS_P3d4,0x30);
+ flag = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30);
if(flag & SetCRT2ToLCD) return(1);
}
return(0);
@@ -4644,339 +6307,457 @@ SiS_IsLCDOrLCDA(PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr)
}
BOOLEAN
-SiS_IsDisableCRT2(USHORT BaseAddr)
+SiS_IsDisableCRT2(SiS_Private *SiS_Pr, USHORT BaseAddr)
{
USHORT flag;
- flag = SiS_GetReg1(SiS_P3d4,0x30);
+ flag = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30);
if(flag & 0x20) return(0);
else return(1);
}
BOOLEAN
-SiS_BridgeIsOn(USHORT BaseAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension)
+SiS_BridgeIsOn(SiS_Private *SiS_Pr, USHORT BaseAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
USHORT flag;
- if(SiS_IF_DEF_LVDS == 1) {
- return(0); /* TW: Changed from 1 to 0! */
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
+ return(0);
} else {
-#if 0 /* TW: Commented for test on bridge-less systems */
- if(HwDeviceExtension->jChipType >= SIS_315H) { /* TW: New (from 630/301B BIOS - not done there) */
-#endif
- flag = SiS_GetReg1(SiS_Part4Port,0x00);
- if((flag == 1) || (flag == 2)) return(0); /* TW: Changed from 1 to 0! */
- else return(1); /* TW: Changed from 0 to 1! */
-#if 0
- } else return(0); /* TW: New (from 630/301B BIOS - always return 0) */
-#endif
+ flag = SiS_GetReg1(SiS_Pr->SiS_Part4Port,0x00);
+ if((flag == 1) || (flag == 2)) return(0);
+ else return(1);
}
}
-
BOOLEAN
-SiS_BridgeIsEnable(USHORT BaseAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension)
+SiS_BridgeIsEnable(SiS_Private *SiS_Pr, USHORT BaseAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
USHORT flag;
- if(SiS_BridgeIsOn(BaseAddr,HwDeviceExtension) == 0) {
- flag=SiS_GetReg1(SiS_Part1Port,0x00);
+ if(!(SiS_BridgeIsOn(SiS_Pr,BaseAddr,HwDeviceExtension))) {
+ flag = SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x00);
if(HwDeviceExtension->jChipType < SIS_315H) {
- /* 300 series */
- if(flag & 0x0a0) return 1;
- else return 0;
+ /* 300 series (630/301B 2.04.5a) */
+ flag &= 0xa0;
+ if((flag == 0x80) || (flag == 0x20)) return 0;
+ else return 1;
} else {
- /* 310 series */
- if(flag & 0x050) return 1;
- else return 0;
+ /* 310/325 series (650/30xLV 1.10.6s) */
+ flag &= 0x50;
+ if((flag == 0x40) || (flag == 0x10)) return 0;
+ else return 1;
}
}
- return 0;
+ return 1;
}
BOOLEAN
-SiS_BridgeInSlave()
+SiS_BridgeInSlave(SiS_Private *SiS_Pr)
{
USHORT flag1;
- flag1 = SiS_GetReg1(SiS_P3d4,0x31);
+ flag1 = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x31);
if(flag1 & (SetInSlaveMode >> 8)) return 1;
else return 0;
}
-/* TW: New from 650/301LV BIOS */
void
-SiS_SetHiVision(USHORT BaseAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension)
+SiS_SetHiVision(SiS_Private *SiS_Pr, USHORT BaseAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
- SiS_HiVision = 0;
+#ifdef SIS315H
+ USHORT temp;
+#endif
+
+ /* Note: This variable is only used on 30xLV systems.
+ CR38 has a different meaning on LVDS/CH7019 systems.
+ */
+
+ SiS_Pr->SiS_HiVision = 0;
if(HwDeviceExtension->jChipType >= SIS_315H) {
- if(SiS_VBType & VB_SIS301BLV302BLV) {
- if(SiS_VBInfo & SetCRT2ToHiVisionTV) {
- SiS_HiVision = SiS_GetReg1(SiS_P3d4,0x38);
- SiS_HiVision &= 0x38;
- SiS_HiVision >>= 3;
- }
+#ifdef SIS315H
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) {
+ temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38);
+ temp &= 0x38;
+ SiS_Pr->SiS_HiVision = (temp >> 3);
+ }
}
+#endif /* SIS315H */
}
}
-/* TW: Checked against 650/LVDS and 650/301LV BIOS */
BOOLEAN
-SiS_GetLCDResInfo301(UCHAR *ROMAddr,USHORT SiS_P3d4,USHORT ModeNo,
- USHORT ModeIdIndex, PSIS_HW_DEVICE_INFO HwDeviceExtension)
+SiS_GetLCDResInfo(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,
+ USHORT ModeIdIndex, PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
USHORT temp,modeflag,resinfo=0;
+ const unsigned char SiS300SeriesLCDRes[] =
+ { 0, 1, 2, 3, 7, 4, 5, 8,
+ 0, 0, 0, 0, 0, 0, 0, 0 };
- SiS_LCDResInfo = 0;
- SiS_LCDTypeInfo = 0;
- SiS_LCDInfo = 0;
+ SiS_Pr->SiS_LCDResInfo = 0;
+ SiS_Pr->SiS_LCDTypeInfo = 0;
+ SiS_Pr->SiS_LCDInfo = 0;
- if (ModeNo<=0x13) {
- modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
+ if(SiS_Pr->UseCustomMode) {
+ modeflag = SiS_Pr->CModeFlag;
} else {
- modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
- resinfo = SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
+ if(ModeNo <= 0x13) {
+ modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
+ } else {
+ modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
+ }
}
- if(!(SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA))) return 0;
+ if(!(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA))) return 0;
- if(!(SiS_VBInfo & (SetSimuScanMode | SwitchToCRT2))) return 0;
+ if(!(SiS_Pr->SiS_VBInfo & (SetSimuScanMode | SwitchToCRT2))) return 0;
- temp = SiS_GetReg1(SiS_P3d4,0x36);
+ temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x36);
- /*fstn*: Fake CR36 (TypeInfo 2, ResInfo Panel320x480) */
- if(SiS_IF_DEF_FSTN){
- temp = 0x20 | Panel320x480;
- SiS_SetReg1(SiS_P3d4,0x36,temp);
+ /* FSTN: Fake CR36 (TypeInfo 2, ResInfo SiS_Panel320x480) */
+ if(SiS_Pr->SiS_IF_DEF_FSTN) {
+ temp = 0x20 | SiS_Pr->SiS_Panel320x480;
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x36,temp);
}
- SiS_LCDTypeInfo = temp >> 4; /* BIOS uses entire CR36 - 1 */
- SiS_LCDResInfo = temp & 0x0F;
+ if(HwDeviceExtension->jChipType < SIS_315H) {
+ SiS_Pr->SiS_LCDTypeInfo = temp >> 4;
+ } else {
+ SiS_Pr->SiS_LCDTypeInfo = (temp & 0x0F) - 1;
+ }
+ temp &= 0x0f;
+ if(HwDeviceExtension->jChipType < SIS_315H) {
+ /* TW: Translate 300 series LCDRes to 310/325 series for unified usage */
+ temp = SiS300SeriesLCDRes[temp];
+ }
+ SiS_Pr->SiS_LCDResInfo = temp;
- if(SiS_IF_DEF_FSTN){
- SiS_LCDResInfo = Panel320x480;
+ if(SiS_Pr->SiS_IF_DEF_FSTN){
+ SiS_Pr->SiS_LCDResInfo = SiS_Pr->SiS_Panel320x480;
}
- if(SiS_IF_DEF_LVDS == 0) {
- if(SiS_LCDResInfo < PanelMin301) SiS_LCDResInfo = PanelMin301;
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
+ if(SiS_Pr->SiS_LCDResInfo < SiS_Pr->SiS_PanelMin301)
+ SiS_Pr->SiS_LCDResInfo = SiS_Pr->SiS_PanelMin301;
} else {
- if(SiS_LCDResInfo < PanelMinLVDS) SiS_LCDResInfo = PanelMinLVDS;
+ if(SiS_Pr->SiS_LCDResInfo < SiS_Pr->SiS_PanelMinLVDS)
+ SiS_Pr->SiS_LCDResInfo = SiS_Pr->SiS_PanelMinLVDS;
}
- if(SiS_LCDResInfo > PanelMax) SiS_LCDResInfo = Panel1024x768;
+ if(SiS_Pr->SiS_LCDResInfo > SiS_Pr->SiS_PanelMax)
+ SiS_Pr->SiS_LCDResInfo = SiS_Pr->SiS_Panel1024x768;
- temp=SiS_GetReg1(SiS_P3d4,0x37);
- if(SiS_IF_DEF_FSTN){
+ temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x37);
+ if(SiS_Pr->SiS_IF_DEF_FSTN){
/* TW: Fake LVDS bridge for FSTN */
temp = 0x04;
- SiS_SetReg1(SiS_P3d4,0x37,temp);
- }
- SiS_LCDInfo = temp;
- /* TW: Inserted entire 315-block from 650/LVDS BIOS */
- if(SiS_IF_DEF_LVDS == 1) {
- if (HwDeviceExtension->jChipType >= SIS_315H) {
- temp = SiS_GetReg1(SiS_P3d4,0x39);
- if(temp & 0x01) {
- SiS_LCDInfo &= 0xFFEF; /* TW: What is this? */
- SiS_LCDInfo |= 0x0100; /* TW: What is this? */
- }
- }
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x37,temp);
}
+ SiS_Pr->SiS_LCDInfo = temp;
+
+ if(!(SiS_Pr->UsePanelScaler)) SiS_Pr->SiS_LCDInfo &= ~DontExpandLCD;
+ else if(SiS_Pr->UsePanelScaler == 1) SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
-#ifdef LINUX_KERNEL
- printk(KERN_INFO "sisfb: (LCDInfo = 0x%x LCDResInfo = 0x%x LCDTypeInfo = 0x%x)\n",
- SiS_LCDInfo, SiS_LCDResInfo, SiS_LCDTypeInfo);
+ /* TW: Inserted entire 315-block from 650/LVDS/30xLV BIOSes */
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+#ifdef SIS315H
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) {
+ if(ModeNo == 0x3a || ModeNo == 0x4d || ModeNo == 0x65) {
+ /* Bridge does not scale to 1280x1024 */
+ SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
+ }
+ }
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) {
+ if(ModeNo == 0x7c || ModeNo == 0x7d || ModeNo == 0x7e) {
+ /* TW: Bridge does not scale to 1280x960 */
+ SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
+ }
+ if(ModeNo == 0x2f || ModeNo == 0x5d || ModeNo == 0x5e) {
+ /* TW: Bridge does not scale to 640x400 */
+ SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
+ }
+ }
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) {
+ if(ModeNo == 0x2f || ModeNo == 0x5d || ModeNo == 0x5e) {
+ /* TW: Most panels can't scale to 640x400 */
+ SiS_Pr->SiS_LCDInfo &= ~DontExpandLCD;
+ }
+ }
+ }
+ }
+ if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x39) & 0x01) {
+ SiS_Pr->SiS_LCDInfo &= 0xFFEF;
+ SiS_Pr->SiS_LCDInfo |= LCDPass11;
+ }
#endif
-#ifdef LINUX_XF86
- xf86DrvMsg(0, X_INFO, "(init301: LCDInfo = 0x%x LCDResInfo = 0x%x LCDTypeInfo = 0x%x)\n",
- SiS_LCDInfo, SiS_LCDResInfo, SiS_LCDTypeInfo);
+ } else {
+#ifdef SIS300
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
+ if((ROMAddr) && SiS_Pr->SiS_UseROM) {
+ if(!(ROMAddr[0x235] & 0x02)) {
+ SiS_Pr->SiS_LCDInfo &= 0xEF;
+ }
+ }
+ } else {
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ if((SiS_Pr->SiS_SetFlag & SetDOSMode) && ((ModeNo == 0x03) || (ModeNo == 0x10))) {
+ SiS_Pr->SiS_LCDInfo &= 0xEF;
+ }
+ }
+ }
#endif
-
+ }
+
/* TW: With Trumpion, always Expanding */
- if(SiS_IF_DEF_TRUMPION != 0){
- SiS_LCDInfo &= (~LCDNonExpanding);
- }
-
- /* TW: Removed LVDS==1 check here; done foe 301B BIOSes as well */
- if(modeflag & HalfDCLK){
- if(SiS_IF_DEF_TRUMPION == 0){
- if((!(SiS_LCDInfo & 0x0100)) || (SiS_IF_DEF_LVDS == 0)) { /* TW: Inserted from 650/LVDS BIOS */
- if(!(SiS_LCDInfo & LCDNonExpanding)){
- if(!((SiS_IF_DEF_LVDS == 1) && (SiS_LCDResInfo == Panel640x480))){ /* TW: Inserted from 650/LVDS BIOS */
- if(ModeNo > 0x13) {
- if(SiS_LCDResInfo == Panel1024x768){
- if(resinfo == 4){ /* 512x384 */
- SiS_SetFlag |= EnableLVDSDDA;
- }
- } else {
- if(SiS_LCDResInfo == Panel800x600){
- if(resinfo == 3){ /* 400x300 */
- SiS_SetFlag |= EnableLVDSDDA;
- }
- }
- }
- }
- } else {
- SiS_SetFlag |= EnableLVDSDDA;
- }
- } else { /* NonExpanding */
- SiS_SetFlag |= EnableLVDSDDA;
- }
- } else { /* TW: Inserted from 650/LVDS BIOS */
- SiS_SetFlag |= EnableLVDSDDA; /* TW: Inserted from 650/LVDS BIOS */
- } /* TW: Inserted from 650/LVDS BIOS */
- } else { /* TRUMPION */
- SiS_SetFlag |= EnableLVDSDDA;
+ if(SiS_Pr->SiS_IF_DEF_TRUMPION != 0){
+ SiS_Pr->SiS_LCDInfo &= (~DontExpandLCD);
+ }
+
+ if(!((HwDeviceExtension->jChipType < SIS_315H) && (SiS_Pr->SiS_SetFlag & SetDOSMode))) {
+
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) {
+ if(ModeNo > 0x13) {
+ if(!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) {
+ if((resinfo == 7) || (resinfo == 3)) {
+ SiS_Pr->SiS_SetFlag |= EnableLVDSDDA;
+ }
+ }
+ }
}
+ if(SiS_Pr->SiS_LCDInfo & LCDPass11) {
+ SiS_Pr->SiS_SetFlag |= EnableLVDSDDA;
+ }
+ }
+
+ if(modeflag & HalfDCLK) {
+ if(SiS_Pr->SiS_IF_DEF_TRUMPION == 0) {
+ if(!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) {
+ if(!(((SiS_Pr->SiS_IF_DEF_LVDS == 1) || (HwDeviceExtension->jChipType < SIS_315H)) &&
+ (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480))) {
+ if(ModeNo > 0x13) {
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) {
+ if(resinfo == 4) SiS_Pr->SiS_SetFlag |= EnableLVDSDDA; /* 512x384 */
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) {
+ if(resinfo == 3) SiS_Pr->SiS_SetFlag |= EnableLVDSDDA; /* 400x300 */
+ }
+ }
+ } else SiS_Pr->SiS_SetFlag |= EnableLVDSDDA;
+ } else SiS_Pr->SiS_SetFlag |= EnableLVDSDDA;
+ } else SiS_Pr->SiS_SetFlag |= EnableLVDSDDA;
+ }
+
}
- /* TW: wdr: if (VBInfo & LCD) && (VBInfo & (SetSimuScanMode | SwitchToCRT2)) { */
- if(SiS_VBInfo & SetInSlaveMode){
- if(SiS_VBInfo & SetNotSimuMode){
- SiS_SetFlag |= LCDVESATiming;
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
+ if(SiS_Pr->SiS_VBInfo & SetNotSimuMode) {
+ SiS_Pr->SiS_SetFlag |= LCDVESATiming;
}
} else {
- SiS_SetFlag |= LCDVESATiming;
+ SiS_Pr->SiS_SetFlag |= LCDVESATiming;
}
+#ifdef SIS315H
+ /* TW: Inserted from 650/30xLV BIOS 1.10.6s */
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ if(SiS_Pr->SiS_VBType & (VB_SIS302B | VB_SIS302LV)) {
+ /* Enable 302B/302LV dual link mode */
+ /* (302B is a theory - not in any BIOS */
+ temp = 0x00;
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) temp = 0x04;
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) temp = 0x04;
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) temp = 0x04;
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x39,temp);
+ } else if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x39,0x00);
+ }
+ }
+#endif
+
+#ifdef LINUX_KERNEL
+ printk(KERN_DEBUG "sisfb: (LCDInfo=0x%04x LCDResInfo=0x%02x LCDTypeInfo=0x%02x)\n",
+ SiS_Pr->SiS_LCDInfo, SiS_Pr->SiS_LCDResInfo, SiS_Pr->SiS_LCDTypeInfo);
+#endif
+#ifdef LINUX_XF86
+ xf86DrvMsgVerb(0, X_PROBED, 3,
+ "(init301: LCDInfo=0x%04x LCDResInfo=0x%02x LCDTypeInfo=0x%02x SetFlag=0x%04x)\n",
+ SiS_Pr->SiS_LCDInfo, SiS_Pr->SiS_LCDResInfo, SiS_Pr->SiS_LCDTypeInfo, SiS_Pr->SiS_SetFlag);
+#endif
+
return 1;
}
void
-SiS_PresetScratchregister(USHORT SiS_P3d4,PSIS_HW_DEVICE_INFO HwDeviceExtension)
+SiS_PresetScratchregister(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
- /*SiS_SetReg1(SiS_P3d4,0x30,0x21); */
- /*SiS_SetReg1(SiS_P3d4,0x31,0x41); */
- /*SiS_SetReg1(SiS_P3d4,0x32,0x28); */
- /*SiS_SetReg1(SiS_P3d4,0x33,0x22); */
- /*SiS_SetReg1(SiS_P3d4,0x35,0x43); */
- /*SiS_SetReg1(SiS_P3d4,0x36,0x01); */
- /*SiS_SetReg1(SiS_P3d4,0x37,0x00); */
+ return;
+ /*SiS_SetReg1(SiS_Pr->SiS_P3d4,0x30,0x21); */
+ /*SiS_SetReg1(SiS_Pr->SiS_P3d4,0x31,0x41); */
+ /*SiS_SetReg1(SiS_Pr->SiS_P3d4,0x32,0x28); */
+ /*SiS_SetReg1(SiS_Pr->SiS_P3d4,0x33,0x22); */
+ /*SiS_SetReg1(SiS_Pr->SiS_P3d4,0x35,0x43); */
+ /*SiS_SetReg1(SiS_Pr->SiS_P3d4,0x36,0x01); */
+ /*SiS_SetReg1(SiS_Pr->SiS_P3d4,0x37,0x00); */
}
void
-SiS_LongWait()
+SiS_LongWait(SiS_Private *SiS_Pr)
{
USHORT i;
- i=SiS_GetReg1(SiS_P3c4,0x1F);
- if(!(i&0xC0)) {
+ i = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1F);
+ if(!(i & 0xC0)) {
for(i=0; i<0xFFFF; i++) {
- if(!(SiS_GetReg2(SiS_P3da) & 0x08))
+ if(!(SiS_GetReg2(SiS_Pr->SiS_P3da) & 0x08))
break;
}
for(i=0; i<0xFFFF; i++) {
- if((SiS_GetReg2(SiS_P3da) & 0x08))
+ if((SiS_GetReg2(SiS_Pr->SiS_P3da) & 0x08))
break;
}
}
}
void
-SiS_VBLongWait()
+SiS_VBLongWait(SiS_Private *SiS_Pr)
{
- if(!(SiS_VBInfo & SetCRT2ToTV)) {
- SiS_VBWait();
+ if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) {
+ SiS_VBWait(SiS_Pr);
} else {
- SiS_LongWait();
+ SiS_LongWait(SiS_Pr);
}
return;
}
void
-SiS_VBWait(void)
+SiS_VBWait(SiS_Private *SiS_Pr)
{
USHORT tempal,temp,i,j;
- temp=0;
- for(i=0;i<3;i++) {
- for(j=0;j<100;j++) {
- tempal=SiS_GetReg2(SiS_P3da);
- if(temp&0x01) {
- if((tempal&0x08)) continue;
- if(!(tempal&0x08)) break;
+ temp = 0;
+ for(i=0; i<3; i++) {
+ for(j=0; j<100; j++) {
+ tempal = SiS_GetReg2(SiS_Pr->SiS_P3da);
+ if(temp & 0x01) {
+ if((tempal & 0x08)) continue;
+ if(!(tempal & 0x08)) break;
} else {
- if(!(tempal&0x08)) continue;
- if((tempal&0x08)) break;
+ if(!(tempal & 0x08)) continue;
+ if((tempal & 0x08)) break;
}
}
- temp=temp^0x01;
+ temp ^= 0x01;
}
}
void
-SiS_WaitVBRetrace(PSIS_HW_DEVICE_INFO HwDeviceExtension)
+SiS_WaitVBRetrace(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
if(HwDeviceExtension->jChipType < SIS_315H) {
- if(SiS_VBType & VB_SIS301BLV302BLV) {
- if(!(SiS_GetReg1(SiS_Part1Port,0x00) & 0x20)) return;
+#ifdef SIS300
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ if(!(SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x00) & 0x20)) return;
}
- if(!(SiS_GetReg1(SiS_Part1Port,0x00) & 0x80)) {
- SiS_WaitRetrace1(HwDeviceExtension);
+ if(!(SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x00) & 0x80)) {
+ SiS_WaitRetrace1(SiS_Pr,HwDeviceExtension);
} else {
- SiS_WaitRetrace2(HwDeviceExtension);
+ SiS_WaitRetrace2(SiS_Pr,HwDeviceExtension);
}
+#endif
} else {
- if(!(SiS_GetReg1(SiS_Part1Port,0x00) & 0x40)) {
- SiS_WaitRetrace1(HwDeviceExtension);
+#ifdef SIS315H
+ if(!(SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x00) & 0x40)) {
+ SiS_WaitRetrace1(SiS_Pr,HwDeviceExtension);
} else {
- SiS_WaitRetrace2(HwDeviceExtension);
+ SiS_WaitRetrace2(SiS_Pr,HwDeviceExtension);
}
+#endif
}
}
void
-SiS_WaitRetrace1(PSIS_HW_DEVICE_INFO HwDeviceExtension)
+SiS_WaitRetrace1(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
- USHORT i,watchdog;
-
+ USHORT watchdog;
+#ifdef SIS300
+ USHORT i;
+#endif
+
if(HwDeviceExtension->jChipType >= SIS_315H) {
- if(SiS_GetReg1(SiS_P3c4,0x1f) & 0xc0) return;
+#ifdef SIS315H
+ if(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1f) & 0xc0) return;
watchdog = 65535;
- while( (SiS_GetReg2(SiS_P3da) & 0x08) && --watchdog);
+ while( (SiS_GetReg2(SiS_Pr->SiS_P3da) & 0x08) && --watchdog);
watchdog = 65535;
- while( (!(SiS_GetReg2(SiS_P3da) & 0x08)) && --watchdog);
+ while( (!(SiS_GetReg2(SiS_Pr->SiS_P3da) & 0x08)) && --watchdog);
+#endif
} else {
+#ifdef SIS300
#if 0 /* TW: Not done in A901 BIOS */
- if(SiS_VBType & VB_SIS301BLV302BLV) {
- if(SiS_GetReg1(SiS_P3c4,0x1f) & 0xc0) return;
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ if(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1f) & 0xc0) return;
}
#endif
for(i=0; i<10; i++) {
watchdog = 65535;
- while( (SiS_GetReg2(SiS_P3da) & 0x08) && --watchdog);
+ while( (SiS_GetReg2(SiS_Pr->SiS_P3da) & 0x08) && --watchdog);
if(watchdog) break;
}
for(i=0; i<10; i++) {
watchdog = 65535;
- while( (!(SiS_GetReg2(SiS_P3da) & 0x08)) && --watchdog);
+ while( (!(SiS_GetReg2(SiS_Pr->SiS_P3da) & 0x08)) && --watchdog);
if(watchdog) break;
}
+#endif
}
}
void
-SiS_WaitRetrace2(PSIS_HW_DEVICE_INFO HwDeviceExtension)
+SiS_WaitRetraceDDC(SiS_Private *SiS_Pr)
{
- USHORT i,watchdog,temp;
+ USHORT watchdog;
+
+ if(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1f) & 0xc0) return;
+ watchdog = 65535;
+ while( (SiS_GetReg2(SiS_Pr->SiS_P3da) & 0x08) && --watchdog);
+ watchdog = 65535;
+ while( (!(SiS_GetReg2(SiS_Pr->SiS_P3da) & 0x08)) && --watchdog);
+}
+
+void
+SiS_WaitRetrace2(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
+{
+ USHORT watchdog;
+#ifdef SIS300
+ USHORT i;
+#endif
if(HwDeviceExtension->jChipType >= SIS_315H) {
+#ifdef SIS315H
watchdog = 65535;
- while( (SiS_GetReg1(SiS_Part1Port,0x30) & 0x02) && --watchdog);
+ while( (SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x30) & 0x02) && --watchdog);
watchdog = 65535;
- while( (!(SiS_GetReg1(SiS_Part1Port,0x30) & 0x02)) && --watchdog);
+ while( (!(SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x30) & 0x02)) && --watchdog);
+#endif
} else {
+#ifdef SIS300
for(i=0; i<10; i++) {
watchdog = 65535;
- while( (temp = SiS_GetReg1(SiS_Part1Port,0x25) & 0x02) && --watchdog);
+ while( (SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x25) & 0x02) && --watchdog);
if(watchdog) break;
}
for(i=0; i<10; i++) {
watchdog = 65535;
- while( (!(temp = SiS_GetReg1(SiS_Part1Port,0x25) & 0x02)) && --watchdog);
+ while( (!(SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x25) & 0x02)) && --watchdog);
if(watchdog) break;
}
+#endif
}
}
@@ -4987,8 +6768,8 @@ SiS_SetRegANDOR(USHORT Port,USHORT Index,USHORT DataAND,USHORT DataOR)
{
USHORT temp;
- temp=SiS_GetReg1(Port,Index); /* SiS_Part1Port index 02 */
- temp=(temp&(DataAND))|DataOR;
+ temp = SiS_GetReg1(Port,Index);
+ temp = (temp & (DataAND)) | DataOR;
SiS_SetReg1(Port,Index,temp);
}
@@ -4997,8 +6778,8 @@ SiS_SetRegAND(USHORT Port,USHORT Index,USHORT DataAND)
{
USHORT temp;
- temp=SiS_GetReg1(Port,Index); /* SiS_Part1Port index 02 */
- temp=temp&DataAND;
+ temp = SiS_GetReg1(Port,Index);
+ temp &= DataAND;
SiS_SetReg1(Port,Index,temp);
}
@@ -5006,47 +6787,86 @@ void SiS_SetRegOR(USHORT Port,USHORT Index,USHORT DataOR)
{
USHORT temp;
- temp=SiS_GetReg1(Port,Index); /* SiS_Part1Port index 02 */
- temp=temp|DataOR;
+ temp = SiS_GetReg1(Port,Index);
+ temp |= DataOR;
SiS_SetReg1(Port,Index,temp);
}
/* ========================================================= */
/* TW: Set 301 TV Encoder (and some LCD relevant) registers */
-/* TW: Checked against 650/301LV and 630/301B (I+II) */
void
-SiS_SetGroup2(USHORT BaseAddr,UCHAR *ROMAddr, USHORT ModeNo,
- USHORT ModeIdIndex,USHORT RefreshRateTableIndex,
- PSIS_HW_DEVICE_INFO HwDeviceExtension)
+SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr, USHORT ModeNo,
+ USHORT ModeIdIndex,USHORT RefreshRateTableIndex,
+ PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
- USHORT i,j,tempax,tempbx,tempcx,temp,temp3;
- USHORT push1,push2,temp1;
- UCHAR *PhasePoint;
- UCHAR *TimingPoint;
- SiS_Part2PortTblStruct *CRT2Part2Ptr = NULL;
- USHORT modeflag,resinfo,crt2crtc,resindex,CRT2Index;
- ULONG longtemp,tempeax,tempebx,temp2,tempecx;
- USHORT SiS_RY1COE=0,SiS_RY2COE=0,SiS_RY3COE=0,SiS_RY4COE=0;
- UCHAR atable[] = {
- 0xc3,0x9e,0xc3,0x9e,0x02,0x02,0x02,
- 0xab,0x87,0xab,0x9e,0xe7,0x02,0x02
+ USHORT i, j, tempax, tempbx, tempcx, temp, temp1;
+ USHORT push1, push2;
+ const UCHAR *PhasePoint;
+ const UCHAR *TimingPoint;
+ const SiS_Part2PortTblStruct *CRT2Part2Ptr = NULL;
+ USHORT modeflag, resinfo, crt2crtc, resindex, CRT2Index;
+ ULONG longtemp, tempeax, tempebx, temp2, tempecx;
+ const UCHAR atable[] = {
+ 0xc3,0x9e,0xc3,0x9e,0x02,0x02,0x02,
+ 0xab,0x87,0xab,0x9e,0xe7,0x02,0x02
};
/* TW: Inserted from 650/301LV BIOS */
- if(SiS_VBInfo & SetCRT2ToLCDA) return;
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) {
+ /* TW: Inserted from 650/30xLV 1.10.6s: (Is at end of SetGroup2!) */
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) {
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x1a,0xfc,0x03);
+ temp = 1;
+ if(ModeNo <= 0x13) temp = 3;
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x0b,temp);
+ }
+ }
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
+ if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) {
+ if((ModeNo == 0x4a) || (ModeNo == 0x38)) {
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x1c,0xa7);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x1d,0x07);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x1e,0xf2);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x1f,0x6e);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x20,0x17);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x21,0x8b);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x22,0x73);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x23,0x53);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x24,0x13);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x25,0x40);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x26,0x34);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x27,0xf4);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x28,0x63);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x29,0xbb);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2a,0xcc);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2b,0x7a);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2c,0x58);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2d,0xe4);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2e,0x73);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2f,0xda);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x30,0x13);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x43,0x72);
+ }
+ }
+ }
+ }
+ return;
+ }
if(ModeNo<=0x13) {
- modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */
- resinfo = SiS_SModeIDTable[ModeIdIndex].St_ResInfo;
- crt2crtc = SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC;
+ modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */
+ resinfo = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo;
+ crt2crtc = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC;
} else {
- modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */
- resinfo = SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
- crt2crtc = SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
+ modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */
+ resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
+ crt2crtc = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
}
- tempcx = SiS_VBInfo;
+ tempcx = SiS_Pr->SiS_VBInfo;
tempax = (tempcx & 0x00FF) << 8;
tempbx = (tempcx & 0x00FF) | ((tempcx & 0x00FF) << 8);
tempbx &= 0x0410;
@@ -5054,486 +6874,517 @@ SiS_SetGroup2(USHORT BaseAddr,UCHAR *ROMAddr, USHORT ModeNo,
temp >>= 1;
temp |= (((tempbx & 0xFF00) >> 8) << 1);
temp |= ((tempbx & 0x00FF) >> 3);
- temp = temp ^ 0x0C;
-
- PhasePoint = SiS_PALPhase;
-#ifdef oldHV
- if(SiS_VBInfo & SetCRT2ToHiVisionTV) { /* PALPhase */
- temp = temp ^ 0x01;
- if(SiS_VBInfo & SetInSlaveMode) {
- TimingPoint = SiS_HiTVSt2Timing;
- if(SiS_SetFlag & TVSimuMode) {
- if(modeflag & Charx8Dot) TimingPoint = SiS_HiTVSt1Timing;
- else TimingPoint = SiS_HiTVTextTiming;
+ temp ^= 0x0C;
+
+ /* TW: From 1.10.7w (no vb check there; don't care - this only disables SVIDEO and CVBS signal) */
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ temp |= 0x0c;
+ }
+
+ PhasePoint = SiS_Pr->SiS_PALPhase;
+ TimingPoint = SiS_Pr->SiS_PALTiming;
+
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) {
+
+ temp ^= 0x01;
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
+ TimingPoint = SiS_Pr->SiS_HiTVSt2Timing;
+ if(SiS_Pr->SiS_SetFlag & TVSimuMode) {
+ if(modeflag & Charx8Dot) TimingPoint = SiS_Pr->SiS_HiTVSt1Timing;
+ else TimingPoint = SiS_Pr->SiS_HiTVTextTiming;
}
- } else TimingPoint = SiS_HiTVExtTiming;
+ } else TimingPoint = SiS_Pr->SiS_HiTVExtTiming;
+
+ if(SiS_Pr->SiS_HiVision & 0x03) temp &= 0xfe;
+
} else {
-#endif
- if(SiS_VBInfo & SetPALTV){
- if( (SiS_VBType & VB_SIS301BLV302BLV) && /* TW: @@@ 650+301LV BIOS only tests 301B, 302B */
- ( (!(SiS_VBInfo & SetInSlaveMode)) || (SiS_SetFlag & TVSimuMode) ) )
- PhasePoint = SiS_PALPhase2;
- else
- PhasePoint = SiS_PALPhase;
-
- TimingPoint = SiS_PALTiming;
+
+ if(SiS_Pr->SiS_VBInfo & SetPALTV){
+
+ TimingPoint = SiS_Pr->SiS_PALTiming;
+ PhasePoint = SiS_Pr->SiS_PALPhase;
+
+ if( (SiS_Pr->SiS_VBType & VB_SIS301B302B) &&
+ ( (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) ||
+ (SiS_Pr->SiS_SetFlag & TVSimuMode) ) ) {
+ PhasePoint = SiS_Pr->SiS_PALPhase2;
+ }
+
} else {
+
temp |= 0x10;
- if( (SiS_VBType & VB_SIS301BLV302BLV) && /* TW: @@@ 650+301LV BIOS only tests 301B, 302B */
- ( (!(SiS_VBInfo & SetInSlaveMode)) || (SiS_SetFlag & TVSimuMode) ) )
- PhasePoint = SiS_NTSCPhase2;
- else
- PhasePoint = SiS_NTSCPhase;
-
- TimingPoint = SiS_NTSCTiming;
+ TimingPoint = SiS_Pr->SiS_NTSCTiming;
+ PhasePoint = SiS_Pr->SiS_NTSCPhase;
+
+ if( (SiS_Pr->SiS_VBType & VB_SIS301B302B) &&
+ ( (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) ||
+ (SiS_Pr->SiS_SetFlag & TVSimuMode) ) ) {
+ PhasePoint = SiS_Pr->SiS_NTSCPhase2;
+ }
+
}
-#ifdef oldHV
+
}
-#endif
- SiS_SetReg1(SiS_Part2Port,0x00,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x00,temp);
-#ifdef SIS300
- if((HwDeviceExtension->jChipType==SIS_630)||
- (HwDeviceExtension->jChipType==SIS_730)) {
- if(SiS_VBInfo & SetCRT2ToTV) {
- if(SiS_GetReg1(SiS_P3d4,0x31) & 0x01) {
- temp1 = SiS_GetReg1(SiS_P3d4,0x35);
- if(temp1 & 0x40)
- PhasePoint = SiS_PALMPhase;
- if( (SiS_VBType & VB_SIS301BLV302BLV) && /* TW: From 650/301LV BIOS (see note above) */
- ( (!(SiS_VBInfo & SetInSlaveMode)) || (SiS_SetFlag & TVSimuMode) ) )
- PhasePoint = SiS_PALMPhase2;
- if(temp1 & 0x80)
- PhasePoint = SiS_PALNPhase;
- if( (SiS_VBType & VB_SIS301BLV302BLV) && /* TW: From 650/301LV BIOS (see note above) */
- ( (!(SiS_VBInfo & SetInSlaveMode)) || (SiS_SetFlag & TVSimuMode) ) )
- PhasePoint = SiS_PALNPhase2;
- }
- }
+ temp = 0;
+ if((HwDeviceExtension->jChipType == SIS_630)||
+ (HwDeviceExtension->jChipType == SIS_730)) {
+ temp = 0x35;
+ }
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ temp = 0x38;
+ }
+ if(temp) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
+ if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x31) & 0x01) {
+ temp1 = SiS_GetReg1(SiS_Pr->SiS_P3d4,temp);
+ if(temp1 & EnablePALM) { /* 0x40 */
+ PhasePoint = SiS_Pr->SiS_PALMPhase;
+ if( (SiS_Pr->SiS_VBType & VB_SIS301B302B) &&
+ ( (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) ||
+ (SiS_Pr->SiS_SetFlag & TVSimuMode) ) ) {
+ PhasePoint = SiS_Pr->SiS_PALMPhase2;
+ }
+ }
+ if(temp1 & EnablePALN) { /* 0x80 */
+ PhasePoint = SiS_Pr->SiS_PALNPhase;
+ if( (SiS_Pr->SiS_VBType & VB_SIS301B302B) &&
+ ( (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) ||
+ (SiS_Pr->SiS_SetFlag & TVSimuMode) ) ) {
+ PhasePoint = SiS_Pr->SiS_PALNPhase2;
+ }
+ }
+ }
+ }
}
-#endif
#ifdef SIS315H
+ /* TW: Inserted from 650/301LV BIOS */
if(HwDeviceExtension->jChipType >= SIS_315H) {
- if(SiS_VBInfo & SetCRT2ToTV) {
- if(SiS_GetReg1(SiS_P3d4,0x31) & 0x01) {
- temp1 = SiS_GetReg1(SiS_P3d4,0x38);
- if(temp1 & 0x40) {
- PhasePoint = SiS_PALMPhase;
- if( (SiS_VBType & VB_SIS301BLV302BLV) && /* TW: @@@ From 650/301LV BIOS (see above) */
- ( (!(SiS_VBInfo & SetInSlaveMode)) || (SiS_SetFlag & TVSimuMode) ) )
- PhasePoint = SiS_PALMPhase2; /* TW: From 650/301LV BIOS */
- }
- if(temp1 & 0x80) {
- PhasePoint = SiS_PALNPhase;
- if( (SiS_VBType & VB_SIS301BLV302BLV) && /* TW: @@@ From 650/301LV BIOS (see above) */
- ( (!(SiS_VBInfo & SetInSlaveMode)) || (SiS_SetFlag & TVSimuMode) ) )
- PhasePoint = SiS_PALNPhase2; /* TW: From 650/301LV BIOS */
- }
- }
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
+ if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) {
+ if((ModeNo == 0x4a) || (ModeNo == 0x38)) {
+ PhasePoint = SiS_Pr->SiS_SpecialPhase;
+ }
}
+ }
+ }
}
#endif
- for(i=0x31, j=0; i<=0x34; i++, j++){
- SiS_SetReg1(SiS_Part2Port,i,PhasePoint[j]);
+ for(i=0x31, j=0; i<=0x34; i++, j++) {
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,PhasePoint[j]);
}
- /* TW: Inserted from 650/301LV BIOS */
- if(SiS_VBType & (VB_SIS301LV | VB_SIS302LV)) {
- if(SiS_VBInfo & SetCRT2ToTV) {
- if(!(SiS_VBInfo & SetPALTV)) {
- if((ModeNo == 0x4a) || (ModeNo == 0x38)) {
- SiS_SetReg1(SiS_Part2Port,0x31,0x1e);
- SiS_SetReg1(SiS_Part2Port,0x32,0x8c);
- SiS_SetReg1(SiS_Part2Port,0x33,0x5c);
- SiS_SetReg1(SiS_Part2Port,0x34,0x7a);
- }
- }
- }
+ for(i=0x01, j=0; i<=0x2D; i++, j++) {
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,TimingPoint[j]);
}
-
- for(i=0x01, j=0; i<=0x2D; i++, j++){
- SiS_SetReg1(SiS_Part2Port,i,TimingPoint[j]);
+ for(i=0x39; i<=0x45; i++, j++) {
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,TimingPoint[j]);
}
- for(i=0x39; i<=0x45; i++, j++){
- SiS_SetReg1(SiS_Part2Port,i,TimingPoint[j]);
- }
- if(SiS_VBInfo & SetCRT2ToTV) {
+
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
if(HwDeviceExtension->jChipType >= SIS_315H) {
- if (!(SiS_ModeType & 0x07))
- SiS_SetRegAND(SiS_Part2Port,0x3A,0x1F);
+ if(!(SiS_Pr->SiS_ModeType & 0x07))
+ SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x3A,0x1F);
} else {
- SiS_SetRegAND(SiS_Part2Port,0x3A,0x1F);
+ SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x3A,0x1F);
}
}
- SiS_SetRegOR(SiS_Part2Port,0x0A,SiS_NewFlickerMode);
+ SiS_SetRegOR(SiS_Pr->SiS_Part2Port,0x0A,SiS_Pr->SiS_NewFlickerMode);
-#if 0 /* TW: No BIOS does this */
- SiS_SetReg1(SiS_Part2Port,0x35,0x00); /*301b*/
- SiS_SetReg1(SiS_Part2Port,0x36,0x00);
- SiS_SetReg1(SiS_Part2Port,0x37,0x00);
- SiS_SetReg1(SiS_Part2Port,0x38,SiS_RY1COE);
- SiS_SetReg1(SiS_Part2Port,0x48,SiS_RY2COE);
- SiS_SetReg1(SiS_Part2Port,0x49,SiS_RY3COE);
- SiS_SetReg1(SiS_Part2Port,0x4a,SiS_RY4COE);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x35,SiS_Pr->SiS_RY1COE);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x36,SiS_Pr->SiS_RY2COE);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x37,SiS_Pr->SiS_RY3COE);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x38,SiS_Pr->SiS_RY4COE);
- /*add to change 630+301b filter*/
- resindex=SiS_GetResInfo(ROMAddr,ModeNo,ModeIdIndex);
- if(ModeNo<=0x13)
- xres = SiS_StResInfo[resindex].HTotal;
- else
- xres = SiS_ModeResInfo[resindex].HTotal;
-
- if(xres == 640) { SiS_RY1COE=0xFF; SiS_RY2COE=0x03; SiS_RY3COE=0x02; SiS_RY4COE=0xF6;
- SiS_RY5COE=0xFC; SiS_RY6COE=0x27; SiS_RY7COE=0x46;}
- if(xres == 800) { SiS_RY1COE=0x01; SiS_RY2COE=0x01; SiS_RY3COE=0xFC; SiS_RY4COE=0xF8;
- SiS_RY5COE=0x08; SiS_RY6COE=0x26; SiS_RY7COE=0x38;}
- if(xres == 1024){ SiS_RY1COE=0xFF; SiS_RY2COE=0xFF; SiS_RY3COE=0xFC; SiS_RY4COE=0x00;
- SiS_RY5COE=0x0F; SiS_RY6COE=0x22; SiS_RY7COE=0x28;}
- if(xres == 720) { SiS_RY1COE=0x01; SiS_RY2COE=0x02; SiS_RY3COE=0xFE; SiS_RY4COE=0xF7;
- SiS_RY5COE=0x03; SiS_RY6COE=0x27; SiS_RY7COE=0x3c;}
- SiS_SetReg1(SiS_Part2Port,0x35,SiS_RY1COE); /*301b*/
- SiS_SetReg1(SiS_Part2Port,0x36,SiS_RY2COE);
- SiS_SetReg1(SiS_Part2Port,0x37,SiS_RY3COE);
- SiS_SetReg1(SiS_Part2Port,0x38,SiS_RY4COE);
- SiS_SetReg1(SiS_Part2Port,0x48,SiS_RY5COE);
- SiS_SetReg1(SiS_Part2Port,0x49,SiS_RY6COE);
- SiS_SetReg1(SiS_Part2Port,0x4a,SiS_RY7COE);
- /*end add*/
-#endif
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) {
+ if(SiS_Pr->SiS_HiVision == 3) tempax = 950;
+ else tempax = 440;
+ } else {
+ if(SiS_Pr->SiS_VBInfo & SetPALTV) tempax = 520;
+ else tempax = 440;
+ }
- /* TW: From 650/301LV and 630/301B BIOS: */
- SiS_SetReg1(SiS_Part2Port,0x35,SiS_RY1COE);
- SiS_SetReg1(SiS_Part2Port,0x36,SiS_RY2COE);
- SiS_SetReg1(SiS_Part2Port,0x37,SiS_RY3COE);
- SiS_SetReg1(SiS_Part2Port,0x38,SiS_RY4COE);
+ if( ( ( (!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) || (SiS_Pr->SiS_HiVision == 3) ) && (SiS_Pr->SiS_VDE <= tempax) ) ||
+ ( (SiS_Pr->SiS_VBInfo & SetCRT2ToTV) && (SiS_Pr->SiS_HiVision != 3) &&
+ ( (SiS_Pr->SiS_VGAHDE == 1024) || ((SiS_Pr->SiS_VGAHDE != 1024) && (SiS_Pr->SiS_VDE <= tempax)) ) ) ) {
+
+ tempax -= SiS_Pr->SiS_VDE;
+ tempax >>= 2;
+ tempax = (tempax & 0x00FF) | ((tempax & 0x00FF) << 8);
+
+ temp = (tempax & 0xFF00) >> 8;
+ temp += (USHORT)TimingPoint[0];
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x01,temp);
+
+ temp = (tempax & 0xFF00) >> 8;
+ temp += (USHORT)TimingPoint[1];
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x02,temp);
+
+ if( (SiS_Pr->SiS_VBInfo & (SetCRT2ToTV - SetCRT2ToHiVisionTV)) &&
+ (SiS_Pr->SiS_HiVision != 3) &&
+ (SiS_Pr->SiS_VGAHDE >= 1024) ) {
+ if(SiS_Pr->SiS_VBInfo & SetPALTV) {
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x01,0x19);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x02,0x52);
+ } else {
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x01,0x17);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x02,0x1d);
+ } else {
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x01,0x0b);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x02,0x11);
+ }
+ }
+ }
-#ifdef oldHV
- if(SiS_VBInfo & SetCRT2ToHiVisionTV) tempax = 950;
- else {
-#endif
- if(SiS_VBInfo & SetPALTV) tempax = 520;
- else tempax = 440;
-#ifdef oldHV
}
-#endif
- if(SiS_VDE <= tempax) {
- tempax -= SiS_VDE;
- tempax >>= 2;
- tempax = (tempax & 0x00FF) | ((tempax & 0x00FF) << 8);
- push1 = tempax;
- temp = (tempax & 0xFF00) >> 8;
- temp += (USHORT)TimingPoint[0];
- SiS_SetReg1(SiS_Part2Port,0x01,temp);
+ tempcx = SiS_Pr->SiS_HT;
- tempax = push1;
- temp = (tempax & 0xFF00) >> 8;
- temp += TimingPoint[1];
- SiS_SetReg1(SiS_Part2Port,0x02,temp);
- }
-
- if( (SiS_VBType & VB_SIS301BLV302BLV) &&
- (SiS_VBInfo & SetCRT2ToTV) &&
- (SiS_VGAHDE >= 1024) &&
- (SiS_HiVision != 3) ) {
- if(SiS_VBInfo & SetPALTV) {
- SiS_SetReg1(SiS_Part2Port,0x01,0x19);
- SiS_SetReg1(SiS_Part2Port,0x02,0x52);
- } else {
- if(HwDeviceExtension->jChipType >= SIS_315H) {
- SiS_SetReg1(SiS_Part2Port,0x01,0x17);
- SiS_SetReg1(SiS_Part2Port,0x02,0x1d);
- } else {
- SiS_SetReg1(SiS_Part2Port,0x01,0x0b);
- SiS_SetReg1(SiS_Part2Port,0x02,0x11);
- }
- }
- }
-
- tempcx = SiS_HT - 1;
- if(SiS_VBType & VB_SIS301BLV302BLV) {
+ /* TW: Inserted from 650/30xLV 1.10.6s */
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x39) & 0x04) {
+ tempcx >>= 1;
+ }
+ }
+
+ tempcx--;
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
tempcx--;
}
temp = tempcx & 0x00FF;
- SiS_SetReg1(SiS_Part2Port,0x1B,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x1B,temp);
temp = (tempcx & 0xFF00) >> 8;
- SiS_SetRegANDOR(SiS_Part2Port,0x1D,0xF0,temp);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x1D,0xF0,temp);
+
+ tempcx++;
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ tempcx++;
+ }
+ tempcx >>= 1;
+
+ push1 = tempcx;
- tempcx = SiS_HT >> 1;
- push1 = tempcx; /* push cx */
tempcx += 7;
-#ifdef oldHV
- if(SiS_VBInfo & SetCRT2ToHiVisionTV) tempcx -= 4; /* TW: @@@ not done in 301LV/630+301B BIOS */
-#endif
+ if((SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) &&
+ (SiS_Pr->SiS_HiVision == 3)) {
+ tempcx -= 4;
+ }
temp = (tempcx & 0x00FF) << 4;
- SiS_SetRegANDOR(SiS_Part2Port,0x22,0x0F,temp);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x22,0x0F,temp);
tempbx = TimingPoint[j] | ((TimingPoint[j+1]) << 8);
tempbx += tempcx;
+
push2 = tempbx;
+
temp = tempbx & 0x00FF;
- SiS_SetReg1(SiS_Part2Port,0x24,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x24,temp);
temp = ((tempbx & 0xFF00) >> 8) << 4;
- SiS_SetRegANDOR(SiS_Part2Port,0x25,0x0F,temp);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x25,0x0F,temp);
tempbx = push2;
tempbx += 8;
-#ifdef oldHV
- if(SiS_VBInfo & SetCRT2ToHiVisionTV) { /* TW: @@@ not done in 301LV/630+301B BIOS */
- tempbx -= 4; /* TW: @@@ not done in 301LV/630+301B BIOS */
- tempcx = tempbx; /* TW: @@@ not done in 301LV/630+301B BIOS */
- } /* TW: @@@ not done in 301LV/630+301B BIOS */
-#endif
+ if((SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) &&
+ (SiS_Pr->SiS_HiVision == 3)) {
+ tempbx -= 4;
+ tempcx = tempbx;
+ }
temp = (tempbx & 0x00FF) << 4;
- SiS_SetRegANDOR(SiS_Part2Port,0x29,0x0F,temp);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x29,0x0F,temp);
j += 2;
tempcx += ((TimingPoint[j] | ((TimingPoint[j+1]) << 8)));
temp = tempcx & 0x00FF;
- SiS_SetReg1(SiS_Part2Port,0x27,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x27,temp);
temp = ((tempcx & 0xFF00) >> 8) << 4;
- SiS_SetRegANDOR(SiS_Part2Port,0x28,0x0F,temp);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x28,0x0F,temp);
tempcx += 8;
-#ifdef oldHV
- if(SiS_VBInfo & SetCRT2ToHiVisionTV) tempcx -= 4; /* TW: @@@ not done in 301LV BIOS */
-#endif
- temp = (tempcx & 0xFF) << 4;
- SiS_SetRegANDOR(SiS_Part2Port,0x2A,0x0F,temp);
+ if((SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) &&
+ (SiS_Pr->SiS_HiVision == 3)) {
+ tempcx -= 4;
+ }
+ temp = (tempcx & 0x00FF) << 4;
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x2A,0x0F,temp);
tempcx = push1;
+
j += 2;
tempcx -= (TimingPoint[j] | ((TimingPoint[j+1]) << 8));
temp = (tempcx & 0x00FF) << 4;
- SiS_SetRegANDOR(SiS_Part2Port,0x2D,0x0F,temp);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x2D,0x0F,temp);
tempcx -= 11;
- if(!(SiS_VBInfo & SetCRT2ToTV)){
- tempax = SiS_GetVGAHT2() - 1;
+ if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) {
+ tempax = SiS_GetVGAHT2(SiS_Pr) - 1;
tempcx = tempax;
}
temp = tempcx & 0x00FF;
- SiS_SetReg1(SiS_Part2Port,0x2E,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2E,temp);
- tempbx = SiS_VDE;
- if(SiS_VGAVDE == 360) tempbx = 746;
- if(SiS_VGAVDE == 375) tempbx = 746;
- if(SiS_VGAVDE == 405) tempbx = 853;
+ tempbx = SiS_Pr->SiS_VDE;
+ if(SiS_Pr->SiS_VGAVDE == 360) tempbx = 746;
+ if(SiS_Pr->SiS_VGAVDE == 375) tempbx = 746;
+ if(SiS_Pr->SiS_VGAVDE == 405) tempbx = 853;
if(HwDeviceExtension->jChipType < SIS_315H) {
- if(SiS_VBInfo & SetCRT2ToTV) tempbx >>= 1;
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) tempbx >>= 1;
} else {
- if((SiS_VBInfo & SetCRT2ToTV) && (!(SiS_HiVision & 0x03))) {
+ if((SiS_Pr->SiS_VBInfo & SetCRT2ToTV) && (!(SiS_Pr->SiS_HiVision & 0x03))) {
tempbx >>= 1;
- if(SiS_SetFlag & TVSimuMode) {
+ if(SiS_Pr->SiS_SetFlag & TVSimuMode) {
if(ModeNo <= 0x13) {
if(crt2crtc == 1) {
tempbx++;
}
}
} else {
- if(SiS_VBInfo & SetInSlaveMode) {
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
if(crt2crtc == 4) /* TW: BIOS calls GetRatePtrCRT2 here - does not make sense */
- if(SiS_ModeType <= 3) tempbx++;
+ if(SiS_Pr->SiS_ModeType <= 3) tempbx++;
}
}
}
}
tempbx -= 2;
temp = tempbx & 0x00FF;
-#ifdef oldHV
- if(SiS_VBInfo & SetCRT2ToHiVisionTV) {
- if(SiS_VBInfo & SetInSlaveMode) {
+ if((SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) &&
+ (SiS_Pr->SiS_HiVision == 3)) {
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
if(ModeNo == 0x2f) temp++;
}
}
-#endif
- SiS_SetReg1(SiS_Part2Port,0x2F,temp);
+ /* TW: From 1.10.7w - doesn't make sense */
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
+ if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) {
+ if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) { /* SetFlag?? */
+ if(ModeNo == 0x03) temp++;
+ }
+ }
+ }
+ }
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2F,temp);
- temp = (tempcx & 0xFF00) >> 8;
- temp |= (((tempbx & 0xFF00) >> 8) << 6);
-#ifdef oldHV
- if(!(SiS_VBInfo & SetCRT2ToHiVisionTV)) {
-#endif
- if(!(SiS_VBInfo & SetCRT2ToSCART)) { /* TW: New from 630/301B (II) BIOS */
- temp |= 0x10;
- if(!(SiS_VBInfo & SetCRT2ToSVIDEO)) temp |= 0x20;
- }
-#ifdef oldHV
+ tempax = (tempcx & 0xFF00) | (tempax & 0x00FF);
+ tempbx = ((tempbx & 0xFF00) << 6) | (tempbx & 0x00FF);
+ tempax |= (tempbx & 0xFF00);
+ if(HwDeviceExtension->jChipType < SIS_315H) {
+ if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV)) {
+ if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToSCART)) { /* TW: New from 630/301B (II) BIOS */
+ tempax |= 0x1000;
+ if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToSVIDEO)) tempax |= 0x2000;
+ }
+ }
+ } else {
+ /* TODO Check this with other BIOSes */
+ if((!(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV)) &&
+ (SiS_Pr->SiS_HiVision == 3)) {
+ tempax |= 0x1000;
+ if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToSVIDEO)) tempax |= 0x2000;
+ }
+ }
+ temp = (tempax & 0xFF00) >> 8;
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x30,temp);
+
+ /* TW: Inserted from 650/30xLV 1.10.6s */
+ if(HwDeviceExtension->jChipType > SIS_315H) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ if( (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) ||
+ (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) ) {
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x10,0x60);
+ }
+ }
+ }
+
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) {
+ if(SiS_Pr->SiS_HiVision != 3) {
+ for(i=0, j=0; i<=0x2d; i++, j++) {
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,SiS_HiVisionTable[SiS_Pr->SiS_HiVision][j]);
+ }
+ for(i=0x39; i<=0x45; i++, j++) {
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,SiS_HiVisionTable[SiS_Pr->SiS_HiVision][j]);
+ }
+ }
}
-#endif
- SiS_SetReg1(SiS_Part2Port,0x30,temp);
- if(SiS_VBType & VB_SIS301BLV302BLV) { /* tv gatingno */
- tempbx = SiS_VDE;
- if((SiS_VBInfo & SetCRT2ToTV) && (!(SiS_HiVision & 0x03))) {
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ tempbx = SiS_Pr->SiS_VDE;
+ if((SiS_Pr->SiS_VBInfo & SetCRT2ToTV) && (!(SiS_Pr->SiS_HiVision & 0x03))) {
tempbx >>= 1;
}
- temp = (((tempbx - 3) & 0x0300) >> 8) << 5;
- temp |= 0x18; /* TW: Inserted from 650/301/301LV BIOS */
- SiS_SetReg1(SiS_Part2Port,0x46,temp);
- temp = (tempbx - 3) & 0x00FF;
- SiS_SetReg1(SiS_Part2Port,0x47,temp);
- if(SiS_HiVision & 0x03) {
- if(SiS_HiVision & 0x01) temp = 0x30;
- else temp = 0x50;
- SiS_SetReg1(SiS_Part2Port,0x4d,temp);
+ tempbx -= 3;
+ tempbx &= 0x03ff;
+ temp = ((tempbx & 0xFF00) >> 8) << 5;
+ temp |= 0x18;
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x46,temp);
+ temp = tempbx & 0x00FF;
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x47,temp); /* tv gatingno */
+ if(HwDeviceExtension->jChipType >= SIS_315H) { /* TW: Inserted from 650/30xLV 1.10.6s */
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ tempax = 0;
+ if(SiS_Pr->SiS_HiVision & 0x03) {
+ tempax = 0x3000;
+ if(SiS_Pr->SiS_HiVision & 0x01) tempax = 0x5000;
+ }
+ temp = (tempax & 0xFF00) >> 8;
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x4d,temp);
+ }
}
}
tempbx &= 0x00FF;
- if(!(modeflag & HalfDCLK)){
- tempcx = SiS_VGAHDE;
- if(tempcx >= SiS_HDE){
+ if(!(modeflag & HalfDCLK)) {
+ tempcx = SiS_Pr->SiS_VGAHDE;
+ if(tempcx >= SiS_Pr->SiS_HDE) {
tempbx |= 0x2000;
tempax &= 0x00FF;
}
}
tempcx = 0x0101;
- if( (SiS_VBInfo & SetCRT2ToTV) && (!(SiS_HiVision & 0x03)) ) { /*301b- TW: BIOS BUG! */
- if(SiS_VGAHDE >= 1024) {
- if(!(modeflag & HalfDCLK)) { /* TW: "if" inserted from 650/301LV and 630/301B BIOS */
- tempcx = 0x1920;
- if(SiS_VGAHDE >= 1280) {
- tempcx = 0x1420;
- tempbx &= 0xDFFF;
+/*if(SiS_Pr->SiS_VBInfo & (SetPALTV | SetCRT2ToTV)) { */ /*301b- TW: BIOS BUG? */
+ if(SiS_Pr->SiS_VBInfo & (SetCRT2ToTV - SetCRT2ToHiVisionTV)) {
+ if(!(SiS_Pr->SiS_HiVision & 0x03)) {
+ if(SiS_Pr->SiS_VGAHDE >= 1024) {
+ if((!(modeflag & HalfDCLK)) || (HwDeviceExtension->jChipType < SIS_315H)) { /* TW: This check not in 630/301B */
+ tempcx = 0x1920;
+ if(SiS_Pr->SiS_VGAHDE >= 1280) {
+ tempcx = 0x1420;
+ tempbx &= 0xDFFF;
+ }
}
}
}
}
- if(!(tempbx & 0x2000)){
-
- if(modeflag & HalfDCLK){
- tempcx = (tempcx & 0xFF00) | (((tempcx & 0x00FF) << 1) & 0xff);
+ if(!(tempbx & 0x2000)) {
+ if(modeflag & HalfDCLK) {
+ tempcx = (tempcx & 0xFF00) | (((tempcx & 0x00FF) << 1) & 0xff);
}
push1 = tempbx;
- tempeax = SiS_VGAHDE;
+ tempeax = SiS_Pr->SiS_VGAHDE;
tempebx = (tempcx & 0xFF00) >> 8;
longtemp = tempeax * tempebx;
tempecx = tempcx & 0x00FF;
longtemp /= tempecx;
longtemp <<= 0x0d;
- if(SiS_VBType & VB_SIS301BLV302BLV) {
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
longtemp <<= 3;
}
- tempecx = SiS_HDE;
+ tempecx = SiS_Pr->SiS_HDE;
temp2 = longtemp % tempecx;
tempeax = longtemp / tempecx;
if(temp2 != 0) tempeax++;
tempax = (USHORT)tempeax;
tempbx = push1;
- if(SiS_VBType & VB_SIS301BLV302BLV) { /* TW: Done anyway in BIOS, but does not matter */
- tempcx = ((tempax & 0xFF00) >> 5) >> 8;
- }
+ tempcx = (tempcx & 0xff00) | (((tempax & 0xFF00) >> 8) >> 5);
tempbx |= (tempax & 0x1F00);
tempax = ((tempax & 0x00FF) << 8) | (tempax & 0x00FF);
}
temp = (tempax & 0xFF00) >> 8;
- SiS_SetReg1(SiS_Part2Port,0x44,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x44,temp);
temp = (tempbx & 0xFF00) >> 8;
- SiS_SetRegANDOR(SiS_Part2Port,0x45,0xC0,temp);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x45,0xC0,temp);
- if(SiS_VBType & VB_SIS301BLV302BLV) {
- if(tempbx & 0x2000)
- tempcx=0x00;
- temp = tempcx;
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ temp = tempcx & 0x00FF;
+ if(tempbx & 0x2000) temp = 0;
temp |= 0x18;
- SiS_SetRegANDOR(SiS_Part2Port,0x46,0xE0,temp);
- if(SiS_VBInfo & SetPALTV) {
- tempbx = 0x0382; /* TW: BIOS; Was 0x0364; */
- tempcx = 0x007e; /* TW: BIOS; Was 0x009c; */
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x46,0xE0,temp);
+ if(SiS_Pr->SiS_VBInfo & SetPALTV) {
+ tempbx = 0x0382;
+ tempcx = 0x007e;
} else {
- tempbx = 0x0369; /* TW: BIOS; Was 0x0346; */
- tempcx = 0x0061; /* TW: BIOS; Was 0x0078; */
+ tempbx = 0x0369;
+ tempcx = 0x0061;
}
temp = (tempbx & 0x00FF) ;
- SiS_SetReg1(SiS_Part2Port,0x4B,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x4B,temp);
temp = (tempcx & 0x00FF) ;
- SiS_SetReg1(SiS_Part2Port,0x4C,temp);
- tempbx &= 0x0300;
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x4C,temp);
+ tempbx &= 0x03FF;
temp = (tempcx & 0xFF00) >> 8;
temp = (temp & 0x0003) << 2;
temp |= (tempbx >> 8);
- SiS_SetRegOR(SiS_Part2Port,0x4D,temp); /* TW: 650/LV - was SetReg1() (not 630/301B) */
+ if(HwDeviceExtension->jChipType < SIS_315H) {
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x4D,temp);
+ } else {
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x4D,0xF0,temp);
+ }
- temp = SiS_GetReg1(SiS_Part2Port,0x43);
- SiS_SetReg1(SiS_Part2Port,0x43,(USHORT)(temp - 3));
+ temp = SiS_GetReg1(SiS_Pr->SiS_Part2Port,0x43);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x43,(USHORT)(temp - 3));
}
-#ifdef SIS300
- if((HwDeviceExtension->jChipType==SIS_630)||
- (HwDeviceExtension->jChipType==SIS_730)) {
- if(SiS_VBInfo & SetCRT2ToTV) {
- if(SiS_GetReg1(SiS_P3d4,0x31) & 0x01) {
- if(SiS_GetReg1(SiS_P3d4,0x35) & 0x40) {
- SiS_SetRegAND(SiS_Part2Port,0x00,0xEF);
- temp3=SiS_GetReg1(SiS_Part2Port,0x01);
- SiS_SetReg1(SiS_Part2Port,0x01,temp3-1);
- }
- }
- }
+ temp = 0;
+ if((HwDeviceExtension->jChipType == SIS_630) ||
+ (HwDeviceExtension->jChipType == SIS_730)) {
+ temp = 0x35;
+ } else if(HwDeviceExtension->jChipType >= SIS_315H) {
+ temp = 0x38;
}
-#endif
-
-#ifdef SIS315H
- if (HwDeviceExtension->jChipType >= SIS_315H) {
- if(SiS_VBInfo & SetCRT2ToTV) {
- if(SiS_GetReg1(SiS_P3d4,0x31) & 0x01) {
- if(SiS_GetReg1(SiS_P3d4,0x38) & 0x40) {
- SiS_SetRegAND(SiS_Part2Port,0x00,0xEF);
- temp3=SiS_GetReg1(SiS_Part2Port,0x01);
- SiS_SetReg1(SiS_Part2Port,0x01,temp3-1);
- }
+ if(temp) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
+ if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x31) & 0x01) {
+ if(SiS_GetReg1(SiS_Pr->SiS_P3d4,temp) & EnablePALM) { /* 0x40 */
+ SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xEF);
+ temp = SiS_GetReg1(SiS_Pr->SiS_Part2Port,0x01);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x01,temp - 1);
}
- }
+ }
+ }
}
- /*end add*/
-#endif
-#ifdef oldHV
- if(SiS_VBInfo & SetCRT2ToHiVisionTV) {
- if(!(SiS_VBInfo & SetInSlaveMode)) {
- SiS_SetReg1(SiS_Part2Port,0x0B,0x00);
+ if( (SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) &&
+ (!(SiS_Pr->SiS_VBType & VB_SIS301LV302LV)) ) {
+ if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x0B,0x00);
}
}
-#endif
if(HwDeviceExtension->jChipType < SIS_315H) {
- if(SiS_VBInfo & SetCRT2ToTV) return;
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
+ SiS_Set300Part2Regs(SiS_Pr, HwDeviceExtension, ModeIdIndex,
+ RefreshRateTableIndex, BaseAddr, ModeNo);
+ return;
+ }
} else {
- if(SiS_VBInfo & SetCRT2ToTV) {
- if(SiS_VBType & (VB_SIS301LV | VB_SIS302LV)) {
- if(SiS_VBInfo & SetCRT2ToTV) {
- if(!(SiS_VBInfo & SetPALTV)) {
+ /* TW: !!! The following is a duplicate, done for LCDA as well (see above) */
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
+ if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) {
if((ModeNo == 0x4a) || (ModeNo == 0x38)) {
- SiS_SetReg1(SiS_Part2Port,0x1c,0xa7);
- SiS_SetReg1(SiS_Part2Port,0x1d,0x07);
- SiS_SetReg1(SiS_Part2Port,0x1e,0xf2);
- SiS_SetReg1(SiS_Part2Port,0x1f,0x6e);
- SiS_SetReg1(SiS_Part2Port,0x20,0x17);
- SiS_SetReg1(SiS_Part2Port,0x21,0x8b);
- SiS_SetReg1(SiS_Part2Port,0x22,0x73);
- SiS_SetReg1(SiS_Part2Port,0x23,0x53);
- SiS_SetReg1(SiS_Part2Port,0x24,0x13);
- SiS_SetReg1(SiS_Part2Port,0x25,0x40);
- SiS_SetReg1(SiS_Part2Port,0x26,0x34);
- SiS_SetReg1(SiS_Part2Port,0x27,0xf4);
- SiS_SetReg1(SiS_Part2Port,0x28,0x63);
- SiS_SetReg1(SiS_Part2Port,0x29,0xbb);
- SiS_SetReg1(SiS_Part2Port,0x2a,0xcc);
- SiS_SetReg1(SiS_Part2Port,0x2b,0x7a);
- SiS_SetReg1(SiS_Part2Port,0x2c,0x58);
- SiS_SetReg1(SiS_Part2Port,0x2d,0xe4);
- SiS_SetReg1(SiS_Part2Port,0x2e,0x73);
- SiS_SetReg1(SiS_Part2Port,0x2f,0xda);
- SiS_SetReg1(SiS_Part2Port,0x30,0x13);
- SiS_SetReg1(SiS_Part2Port,0x43,0x72);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x1c,0xa7);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x1d,0x07);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x1e,0xf2);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x1f,0x6e);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x20,0x17);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x21,0x8b);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x22,0x73);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x23,0x53);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x24,0x13);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x25,0x40);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x26,0x34);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x27,0xf4);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x28,0x63);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x29,0xbb);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2a,0xcc);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2b,0x7a);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2c,0x58);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2d,0xe4);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2e,0x73);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2f,0xda);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x30,0x13);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x43,0x72);
}
}
}
@@ -5542,152 +7393,225 @@ SiS_SetGroup2(USHORT BaseAddr,UCHAR *ROMAddr, USHORT ModeNo,
}
}
- /* TW: From here: LCD Part2 group */
+ /* TW: From here: Part2 LCD setup */
- tempbx = SiS_HDE - 1; /* RHACTE=HDE-1 */
+ tempbx = SiS_Pr->SiS_HDE;
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ /* TW: Inserted from 650/30xLV 1.10.6s */
+ if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x39) & 0x04) tempbx >>= 1;
+ }
+ tempbx--; /* RHACTE=HDE-1 */
temp = tempbx & 0x00FF;
- SiS_SetReg1(SiS_Part2Port,0x2C,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2C,temp);
temp = (tempbx & 0xFF00) >> 8;
temp <<= 4;
- SiS_SetRegANDOR(SiS_Part2Port,0x2B,0x0F,temp);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x2B,0x0F,temp);
temp = 0x01;
- if(SiS_LCDResInfo == Panel1280x1024) {
- if(SiS_ModeType == ModeEGA) {
- if(SiS_VGAHDE >= 1024) {
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) {
+ if(SiS_Pr->SiS_ModeType == ModeEGA) {
+ if(SiS_Pr->SiS_VGAHDE >= 1024) {
temp = 0x02;
if(HwDeviceExtension->jChipType >= SIS_315H) {
- if (SiS_SetFlag & LCDVESATiming) {
+ if(SiS_Pr->SiS_SetFlag & LCDVESATiming) {
temp = 0x01;
}
}
}
}
}
- SiS_SetReg1(SiS_Part2Port,0x0B,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x0B,temp);
- tempbx = SiS_VDE; /* RTVACTEO=(VDE-1)&0xFF */
+ tempbx = SiS_Pr->SiS_VDE; /* RTVACTEO=(VDE-1)&0xFF */
push1 = tempbx;
+
tempbx--;
temp = tempbx & 0x00FF;
- SiS_SetReg1(SiS_Part2Port,0x03,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x03,temp);
temp = ((tempbx & 0xFF00) >> 8) & 0x07;
- SiS_SetRegANDOR(SiS_Part2Port,0x0C,0xF8,temp);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x0C,0xF8,temp);
- tempcx = SiS_VT;
+ tempcx = SiS_Pr->SiS_VT;
push2 = tempcx;
+
tempcx--;
- temp = tempcx & 0x00FF; /* RVTVT=VT-1 */
- SiS_SetReg1(SiS_Part2Port,0x19,temp);
+ temp = tempcx & 0x00FF; /* RVTVT=VT-1 */
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x19,temp);
temp = (tempcx & 0xFF00) >> 8;
temp <<= 5;
- if(HwDeviceExtension->jChipType < SIS_315H) {
- if(SiS_VBType & VB_SIS301BLV302BLV) temp |= 0x10;
+
+ /* Enable dithering; newer versions only do this for 32bpp mode */
+ if((HwDeviceExtension->jChipType == SIS_300) && (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) {
+ if(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit) temp |= 0x10;
+ } else if(HwDeviceExtension->jChipType < SIS_315H) {
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) temp |= 0x10;
else {
-#if 0
- if(SiS_LCDInfo & LCDRGB18Bit) /* TW: 630/301B (II) BIOS does not check this!!! */
-#endif
- if(SiS_LCDInfo & LCDSync) /* TW: 630/301 BIOS checks this */
+ if(SiS_Pr->SiS_LCDInfo & LCDSync) /* TW: 630/301 BIOS checks this */
temp |= 0x10;
}
- } else temp |= 0x10;
+ } else {
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ /* TW: Inserted from 650/30xLV 1.10.6s */
+ if(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit) {
+ if(SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x00) & 0x01) { /* 32bpp mode? */
+ temp |= 0x10;
+ }
+ }
+ } else {
+ temp |= 0x10;
+ }
+ }
/* 630/301 does not do all this */
- if((SiS_VBType & VB_SIS301BLV302BLV) && (SiS_VBInfo & SetCRT2ToLCD)) {
- tempbx = (tempbx & 0xFF00) | (SiS_LCDInfo & 0x0FF);
- if(tempbx & LCDSync) {
- tempbx &= (0xFF00 | LCDSyncBit);
- tempbx = (tempbx & 0xFF00) | ((tempbx & 0x00FF) >> LCDSyncShift);
- temp |= (tempbx & 0x00FF);
- }
+ if((SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) {
+ if((HwDeviceExtension->jChipType >= SIS_315H) && (SiS_Pr->SiS_VBType & VB_SIS301LV302LV)) {
+ /* TW: Inserted from 650/30xLV 1.10.6s */
+ temp |= (SiS_GetReg1(SiS_Pr->SiS_P3d4,0x37) >> 6);
+ temp |= 0x08; /* From 1.10.7w */
+ if(!(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit)) temp |= 0x04; /* From 1.10.7w */
+ } else {
+ tempbx = (tempbx & 0xFF00) | (SiS_Pr->SiS_LCDInfo & 0x0FF);
+ if(tempbx & LCDSync) {
+ tempbx &= 0xFFE0;
+ tempbx = (tempbx & 0xFF00) | ((tempbx & 0x00FF) >> 6);
+ temp |= (tempbx & 0x00FF);
+ }
+ }
}
- SiS_SetReg1(SiS_Part2Port,0x1A,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x1A,temp);
- SiS_SetRegAND(SiS_Part2Port,0x09,0xF0);
- SiS_SetRegAND(SiS_Part2Port,0x0A,0xF0);
+ SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x09,0xF0);
+ SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x0A,0xF0);
- SiS_SetRegAND(SiS_Part2Port,0x17,0xFB);
- SiS_SetRegAND(SiS_Part2Port,0x18,0xDF);
+ SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x17,0xFB);
+ SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x18,0xDF);
- if(HwDeviceExtension->jChipType >= SIS_315H) { /* 310 series */
+ /* 1280x960, 1280x1024 and 1600x1200 data invalid/missing in tables, use old calculation */
+ if((HwDeviceExtension->jChipType >= SIS_315H) &&
+ (SiS_Pr->SiS_VBType & VB_SIS301LV302LV) &&
+ (SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x1024) &&
+ (SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1600x1200) &&
+ (SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x960)) {
+ /* ------------- 310/325/330 series ------------ */
- /* TW: Inserted this entire section from 650/301LV BIOS */
+ /* TW: Inserted this entire section from 650/301LV(x) BIOS */
+
+ /* Using this on the 301B with an auto-expanding 1024 panel (CR37=1) results
+ * in a black bar in modes < 1024; if the panel is non-expanding, the bridge
+ * scales all modes to 1024. All modes in both variants (exp/non-exp) work.
+ */
- SiS_GetCRT2Part2Ptr(ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
+ SiS_GetCRT2Part2Ptr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
&CRT2Index,&resindex);
switch(CRT2Index) {
- case 0: CRT2Part2Ptr = SiS_CRT2Part2_1024x768_1; break; /* "Normal" */
- case 1: CRT2Part2Ptr = SiS_CRT2Part2_1280x1024_1; break;
- case 2: CRT2Part2Ptr = SiS_CRT2Part2_1024x768_2; break; /* Non-Expanding */
- case 3: CRT2Part2Ptr = SiS_CRT2Part2_1280x1024_2; break;
- case 4: CRT2Part2Ptr = SiS_CRT2Part2_1024x768_3; break; /* VESA Timing */
- case 5: CRT2Part2Ptr = SiS_CRT2Part2_1280x1024_3; break;
+ case Panel_1024x768 : CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1024x768_1; break; /* "Normal" */
+ case Panel_1280x1024 : CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1280x1024_1; break;
+ case Panel_1400x1050 : CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1400x1050_1; break;
+ case Panel_1600x1200 : CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1600x1200_1; break;
+ case Panel_1024x768 + 16: CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1024x768_2; break; /* Non-Expanding */
+ case Panel_1280x1024 + 16: CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1280x1024_2; break;
+ case Panel_1400x1050 + 16: CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1400x1050_2; break;
+ case Panel_1600x1200 + 16: CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1600x1200_2; break;
+ case Panel_1024x768 + 32: CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1024x768_3; break; /* VESA Timing */
+ case Panel_1280x1024 + 32: CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1280x1024_3; break;
+ case Panel_1400x1050 + 32: CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1400x1050_3; break;
+ case Panel_1600x1200 + 32: CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1600x1200_3; break;
+ default: CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1024x768_3; break;
}
- SiS_SetRegANDOR(SiS_Part2Port,0x01,0x80,(CRT2Part2Ptr+resindex)->CR[0]);
- SiS_SetRegANDOR(SiS_Part2Port,0x02,0x80,(CRT2Part2Ptr+resindex)->CR[1]);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x01,0x80,(CRT2Part2Ptr+resindex)->CR[0]);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x02,0x80,(CRT2Part2Ptr+resindex)->CR[1]);
for(i = 2, j = 0x04; j <= 0x06; i++, j++ ) {
- SiS_SetReg1(SiS_Part2Port,j,(CRT2Part2Ptr+resindex)->CR[i]);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,j,(CRT2Part2Ptr+resindex)->CR[i]);
}
for(j = 0x1c; j <= 0x1d; i++, j++ ) {
- SiS_SetReg1(SiS_Part2Port,j,(CRT2Part2Ptr+resindex)->CR[i]);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,j,(CRT2Part2Ptr+resindex)->CR[i]);
}
for(j = 0x1f; j <= 0x21; i++, j++ ) {
- SiS_SetReg1(SiS_Part2Port,j,(CRT2Part2Ptr+resindex)->CR[i]);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,j,(CRT2Part2Ptr+resindex)->CR[i]);
}
- SiS_SetReg1(SiS_Part2Port,0x23,(CRT2Part2Ptr+resindex)->CR[10]);
- SiS_SetRegANDOR(SiS_Part2Port,0x25,0x0f,(CRT2Part2Ptr+resindex)->CR[11]);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x23,(CRT2Part2Ptr+resindex)->CR[10]);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x25,0x0f,(CRT2Part2Ptr+resindex)->CR[11]);
- if(!(SiS_SetFlag & LCDVESATiming)) {
- if(SiS_VGAVDE == 0x20d) {
+ if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) {
+ if(SiS_Pr->SiS_VGAVDE == 525) {
temp = 0xc3;
- if(SiS_ModeType <= ModeVGA) {
+ if(SiS_Pr->SiS_ModeType <= ModeVGA) {
temp++;
- if(SiS_VBType & VB_SIS301BLV302BLV) temp += 2;
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) temp += 2;
}
- SiS_SetReg1(SiS_Part2Port,0x2f,temp);
- SiS_SetReg1(SiS_Part2Port,0x30,0xb3);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2f,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x30,0xb3);
}
- if(SiS_VGAVDE == 0x1a4) {
+ if(SiS_Pr->SiS_VGAVDE == 420) {
temp = 0x4d;
- if(SiS_ModeType <= ModeVGA) {
+ if(SiS_Pr->SiS_ModeType <= ModeVGA) {
temp++;
- if(SiS_VBType & VB_SIS301BLV302BLV) temp++;
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) temp++;
}
- SiS_SetReg1(SiS_Part2Port,0x2f,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2f,temp);
}
- } /* 2f5d */
+ }
- } else { /* 300 series */
+ /* TW: Inserted from 650/30xLV 1.10.6s: */
+ /* !!! This is a duplicate, done for LCDA as well - see above */
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) {
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x1a,0xfc,0x03); /* Not done in 1.10.7w */
+ temp = 1;
+ if(ModeNo <= 0x13) temp = 3;
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x0b,temp);
+ }
+ }
+ } else { /* ------ 300 series and other bridges, other LCD resolutions ------ */
+
+ /* Using this on the 301B with an auto-expanding 1024 panel (CR37=1) makes
+ * the panel scale at modes < 1024 (no black bars); if the panel is non-expanding,
+ * the bridge scales all modes to 1024.
+ * !!! Malfunction at 640x480 and 640x400 when panel is auto-expanding - black screen !!!
+ */
+
tempcx++;
+
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) tempbx = 768;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) tempbx = 1024;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) tempbx = 1200;
+ else if(SiS_Pr->SiS_VDE != 1024) tempbx = 960;
+ else tempbx = 1024;
+
+#if 0 /* old */
tempbx = 768;
- if(SiS_LCDResInfo != Panel1024x768) {
+ if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1024x768) {
tempbx = 1024;
- if(SiS_LCDResInfo != Panel1280x1024) {
+ if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x1024) {
tempbx = 1200;
- if(SiS_LCDResInfo != Panel1600x1200) {
- if(tempbx != SiS_VDE) {
+ if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1600x1200) {
+ if(tempbx != SiS_Pr->SiS_VDE) {
tempbx = 960;
}
}
}
}
- if(SiS_LCDInfo & LCDNonExpanding) {
- tempbx = SiS_VDE - 1;
+#endif
+
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) {
+ tempbx = SiS_Pr->SiS_VDE - 1;
tempcx--;
}
+
tempax = 1;
- if(!(SiS_LCDInfo & LCDNonExpanding)) {
- if(tempbx != SiS_VDE){
+ if(!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) {
+ if(tempbx != SiS_Pr->SiS_VDE) {
tempax = tempbx;
- if(tempax < SiS_VDE) {
+/* if(SiS_Pr->SiS_VGAVDE == 525) tempax += 60; in 650/301B BIOS */
+ if(tempax < SiS_Pr->SiS_VDE) {
tempax = 0;
tempcx = 0;
} else {
- tempax -= SiS_VDE;
+ tempax -= SiS_Pr->SiS_VDE;
}
tempax >>= 1;
}
@@ -5698,15 +7622,19 @@ SiS_SetGroup2(USHORT BaseAddr,UCHAR *ROMAddr, USHORT ModeNo,
tempcx -= tempax; /* lcdvdes */
tempbx -= tempax; /* lcdvdee */
}
+
+#ifdef TWDEBUG
+ xf86DrvMsg(0, X_INFO, "lcdvds 0x%x lcdvde 0x%x\n", tempcx, tempbx);
+#endif
- temp = tempcx & 0x00FF; /* RVEQ1EQ=lcdvdes */
- SiS_SetReg1(SiS_Part2Port,0x05,temp);
- temp = tempbx & 0x00FF; /* RVEQ2EQ=lcdvdee */
- SiS_SetReg1(SiS_Part2Port,0x06,temp);
+ temp = tempcx & 0x00FF; /* RVEQ1EQ=lcdvdes */
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x05,temp);
+ temp = tempbx & 0x00FF; /* RVEQ2EQ=lcdvdee */
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x06,temp);
- temp = ((tempbx & 0xFF00) >> 8 ) << 3;
+ temp = ((tempbx & 0xFF00) >> 8) << 3;
temp |= ((tempcx & 0xFF00) >> 8);
- SiS_SetReg1(SiS_Part2Port,0x02,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x02,temp);
tempbx = push2;
tempax = push1;
@@ -5715,343 +7643,438 @@ SiS_SetGroup2(USHORT BaseAddr,UCHAR *ROMAddr, USHORT ModeNo,
tempcx >>= 4;
tempbx += tempax;
tempbx >>= 1;
- if(SiS_LCDInfo & LCDNonExpanding) tempbx -= 10;
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx -= 10;
+
+#ifdef TWDEBUG
+ xf86DrvMsg(0, X_INFO, "lcdvrs 0x%x\n", tempbx);
+#endif
- temp = tempbx & 0x00FF; /* RTVACTEE=lcdvrs */
- SiS_SetReg1(SiS_Part2Port,0x04,temp);
+ temp = tempbx & 0x00FF; /* RTVACTEE=lcdvrs */
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x04,temp);
temp = ((tempbx & 0xFF00) >> 8) << 4;
tempbx += (tempcx + 1);
temp |= (tempbx & 0x000F);
- SiS_SetReg1(SiS_Part2Port,0x01,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x01,temp);
/* TW: Code from 630/301B (I+II) BIOS */
if( ( ( (HwDeviceExtension->jChipType == SIS_630) ||
(HwDeviceExtension->jChipType == SIS_730) ) &&
(HwDeviceExtension->jChipRevision > 2) ) &&
- (SiS_LCDResInfo == Panel1024x768) &&
- (!(SiS_SetFlag & LCDVESATiming)) &&
- (!(SiS_LCDInfo & LCDNonExpanding)) ) {
+ (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) &&
+ (!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) &&
+ (!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) ) {
if(ModeNo == 0x13) {
- SiS_SetReg1(SiS_Part2Port,0x04,0xB9);
- SiS_SetReg1(SiS_Part2Port,0x05,0xCC);
- SiS_SetReg1(SiS_Part2Port,0x06,0xA6);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x04,0xB9);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x05,0xCC);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x06,0xA6);
} else {
if((crt2crtc & 0x3F) == 4) {
- SiS_SetReg1(SiS_Part2Port,0x01,0x2B);
- SiS_SetReg1(SiS_Part2Port,0x02,0x13);
- SiS_SetReg1(SiS_Part2Port,0x04,0xE5);
- SiS_SetReg1(SiS_Part2Port,0x05,0x08);
- SiS_SetReg1(SiS_Part2Port,0x06,0xE2);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x01,0x2B);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x02,0x13);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x04,0xE5);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x05,0x08);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x06,0xE2);
}
}
}
- /* TW: Inserted missing code from 630/301B BIOS: (II: 3258) */
+ /* TW: Inserted missing code from 630/301B BIOS;
+ * Strangely, this is done in all 650 BIOSes as
+ * well (although LCDTypeInfo is not used there
+ * in the same way as on 300 series)
+ */
- if(SiS_LCDTypeInfo == 0x0c) {
+ if(SiS_Pr->SiS_LCDTypeInfo == 0x0c) {
crt2crtc &= 0x1f;
tempcx = 0;
- if(!(SiS_VBInfo & SetNotSimuMode)) {
- if (SiS_VBInfo & SetInSlaveMode) {
+ if(!(SiS_Pr->SiS_VBInfo & SetNotSimuMode)) {
+ if (SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
tempcx += 7;
}
}
tempcx += crt2crtc;
if (crt2crtc >= 4) {
- SiS_SetReg1(SiS_Part2Port,0x06,0xff);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x06,0xff);
}
- if(!(SiS_VBInfo & SetNotSimuMode)) {
- if (SiS_VBInfo & SetInSlaveMode) {
- if (crt2crtc == 4) {
- SiS_SetReg1(SiS_Part2Port,0x01,0x28);
+ if(!(SiS_Pr->SiS_VBInfo & SetNotSimuMode)) {
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
+ if(crt2crtc == 4) {
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x01,0x28);
}
}
}
- SiS_SetReg1(SiS_Part2Port,0x02,0x18);
- SiS_SetReg1(SiS_Part2Port,0x04,atable[tempcx]);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x02,0x18);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x04,atable[tempcx]);
}
- tempcx = (SiS_HT - SiS_HDE) >> 2; /* (HT-HDE)>>2 */
- tempbx = SiS_HDE + 7; /* lcdhdee */
- if(SiS_VBType & VB_SIS301BLV302BLV) {
+ tempcx = (SiS_Pr->SiS_HT - SiS_Pr->SiS_HDE) >> 2; /* (HT-HDE)>>2 */
+ tempbx = SiS_Pr->SiS_HDE + 7; /* lcdhdee */
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
tempbx += 2;
}
push1 = tempbx;
- temp = tempbx & 0x00FF; /* RHEQPLE=lcdhdee */
- SiS_SetReg1(SiS_Part2Port,0x23,temp);
+#ifdef TWDEBUG
+ xf86DrvMsg(0, X_INFO, "lcdhde 0x%x\n", tempbx);
+#endif
+ temp = tempbx & 0x00FF; /* RHEQPLE=lcdhdee */
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x23,temp);
temp = (tempbx & 0xFF00) >> 8;
- SiS_SetRegANDOR(SiS_Part2Port,0x25,0xF0,temp);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x25,0xF0,temp);
temp = 7;
- if(SiS_VBType & VB_SIS301BLV302BLV) {
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
temp += 2;
}
- SiS_SetReg1(SiS_Part2Port,0x1F,temp); /* RHBLKE=lcdhdes */
-
- SiS_SetRegAND(SiS_Part2Port,0x20,0x0F);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x1F,temp); /* RHBLKE=lcdhdes[7:0] */
+ SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x20,0x0F); /* lcdhdes [11:8] */
tempbx += tempcx;
push2 = tempbx;
- temp = tempbx & 0xFF; /* RHBURSTS=lcdhrs */
- if(SiS_LCDResInfo == Panel1280x1024) {
- if(SiS_LCDInfo & LCDNonExpanding) {
- if(SiS_HDE == 1280) temp = 0x47;
- }
+#ifdef TWDEBUG
+ xf86DrvMsg(0, X_INFO, "lcdhrs 0x%x\n", tempbx);
+#endif
+ temp = tempbx & 0x00FF; /* RHBURSTS=lcdhrs */
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) {
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) {
+ if(SiS_Pr->SiS_HDE == 1280) temp = 0x47;
+ }
}
- SiS_SetReg1(SiS_Part2Port,0x1C,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x1C,temp);
temp = ((tempbx & 0xFF00) >> 8) << 4;
- SiS_SetRegANDOR(SiS_Part2Port,0x1D,0x0F,temp);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x1D,0x0F,temp);
tempbx = push2;
tempcx <<= 1;
tempbx += tempcx;
- temp = tempbx & 0x00FF; /* RHSYEXP2S=lcdhre */
- SiS_SetReg1(SiS_Part2Port,0x21,temp);
-
- if(!(SiS_SetFlag & LCDVESATiming)) {
- if(SiS_VGAVDE == 525) {
-/* if(SiS_VBType & VB_SIS301BLV302BLV) */ /* TW: 630/301B (I+II) */
- if(SiS_ModeType <= ModeVGA)
+#ifdef TWDEBUG
+ xf86DrvMsg(0, X_INFO, "lcdhre 0x%x\n", tempbx);
+#endif
+ temp = tempbx & 0x00FF; /* RHSYEXP2S=lcdhre */
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x21,temp);
+
+ if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) {
+ if(SiS_Pr->SiS_VGAVDE == 525) {
+ if(SiS_Pr->SiS_ModeType <= ModeVGA)
temp=0xC6;
else
- temp=0xC3; /* 650: c4 */
- SiS_SetReg1(SiS_Part2Port,0x2f,temp);
- SiS_SetReg1(SiS_Part2Port,0x30,0xB3);
- } else if(SiS_VGAVDE==420) {
-/* if(SiS_VBType & VB_SIS301BLV302BLV) */ /* TW: 630/301B (I+II) */
- if(SiS_ModeType <= ModeVGA)
+ temp=0xC3;
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2f,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x30,0xB3);
+ } else if(SiS_Pr->SiS_VGAVDE == 420) {
+ if(SiS_Pr->SiS_ModeType <= ModeVGA)
temp=0x4F;
else
- temp=0x4D; /* 650: 4e */
- SiS_SetReg1(SiS_Part2Port,0x2f,temp);
+ temp=0x4D;
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x2f,temp);
}
}
+ SiS_Set300Part2Regs(SiS_Pr, HwDeviceExtension, ModeIdIndex,
+ RefreshRateTableIndex, BaseAddr, ModeNo);
} /* HwDeviceExtension */
}
USHORT
-SiS_GetVGAHT2()
+SiS_GetVGAHT2(SiS_Private *SiS_Pr)
{
ULONG tempax,tempbx;
- tempbx = ((SiS_VGAVT - SiS_VGAVDE) * SiS_RVBHCMAX) & 0xFFFF;
- tempax = (SiS_VT - SiS_VDE) * SiS_RVBHCFACT;
- tempax = (tempax * SiS_HT) / tempbx;
+ tempbx = ((SiS_Pr->SiS_VGAVT - SiS_Pr->SiS_VGAVDE) * SiS_Pr->SiS_RVBHCMAX) & 0xFFFF;
+ tempax = (SiS_Pr->SiS_VT - SiS_Pr->SiS_VDE) * SiS_Pr->SiS_RVBHCFACT;
+ tempax = (tempax * SiS_Pr->SiS_HT) / tempbx;
return((USHORT) tempax);
}
+/* TW: New from 300/301LV BIOS 1.16.51 for ECS A907. Seems highly preliminary. */
+void
+SiS_Set300Part2Regs(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,
+ USHORT ModeIdIndex, USHORT RefreshRateTableIndex,
+ USHORT BaseAddr, USHORT ModeNo)
+{
+ USHORT crt2crtc, resindex;
+ int i,j;
+ const SiS_Part2PortTblStruct *CRT2Part2Ptr = NULL;
+
+ if(HwDeviceExtension->jChipType != SIS_300) return;
+ if(!(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) return;
+
+ if(ModeNo<=0x13) {
+ crt2crtc = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC;
+ } else {
+ crt2crtc = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
+ }
+
+ resindex = crt2crtc & 0x3F;
+ if(SiS_Pr->SiS_SetFlag & LCDVESATiming) CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1024x768_1;
+ else CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1024x768_2;
+
+ /* TW: The BIOS code (1.16.51) is obviously a fragment! */
+ if(ModeNo > 0x13) {
+ CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1024x768_1;
+ resindex = 4;
+ }
+
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x01,0x80,(CRT2Part2Ptr+resindex)->CR[0]);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x02,0x80,(CRT2Part2Ptr+resindex)->CR[1]);
+ for(i = 2, j = 0x04; j <= 0x06; i++, j++ ) {
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,j,(CRT2Part2Ptr+resindex)->CR[i]);
+ }
+ for(j = 0x1c; j <= 0x1d; i++, j++ ) {
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,j,(CRT2Part2Ptr+resindex)->CR[i]);
+ }
+ for(j = 0x1f; j <= 0x21; i++, j++ ) {
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,j,(CRT2Part2Ptr+resindex)->CR[i]);
+ }
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x23,(CRT2Part2Ptr+resindex)->CR[10]);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x25,0x0f,(CRT2Part2Ptr+resindex)->CR[11]);
+}
+
/* TW: Set 301 Macrovision(tm) registers */
-/* TW: Double-Checked against 650/301LV and 630/301B BIOS */
void
-SiS_SetGroup3(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,
+SiS_SetGroup3(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,
USHORT ModeIdIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
+ USHORT temp;
USHORT i;
- UCHAR *tempdi;
+ const UCHAR *tempdi;
USHORT modeflag;
- if(SiS_VBInfo & SetCRT2ToLCDA) return; /* TW: Inserted from BIOS */
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) return;
if(ModeNo<=0x13)
- modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
+ modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
else
- modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
- SiS_SetReg1(SiS_Part3Port,0x00,0x00);
+ SiS_SetReg1(SiS_Pr->SiS_Part3Port,0x00,0x00);
- if(SiS_VBInfo & SetPALTV) {
- SiS_SetReg1(SiS_Part3Port,0x13,0xFA);
- SiS_SetReg1(SiS_Part3Port,0x14,0xC8);
+ if(SiS_Pr->SiS_VBInfo & SetPALTV) {
+ SiS_SetReg1(SiS_Pr->SiS_Part3Port,0x13,0xFA);
+ SiS_SetReg1(SiS_Pr->SiS_Part3Port,0x14,0xC8);
} else {
if(HwDeviceExtension->jChipType >= SIS_315H) {
- SiS_SetReg1(SiS_Part3Port,0x13,0xF5);
- SiS_SetReg1(SiS_Part3Port,0x14,0xB7);
+ SiS_SetReg1(SiS_Pr->SiS_Part3Port,0x13,0xF5);
+ SiS_SetReg1(SiS_Pr->SiS_Part3Port,0x14,0xB7);
} else {
- SiS_SetReg1(SiS_Part3Port,0x13,0xF6);
- SiS_SetReg1(SiS_Part3Port,0x14,0xBf);
+ SiS_SetReg1(SiS_Pr->SiS_Part3Port,0x13,0xF6);
+ SiS_SetReg1(SiS_Pr->SiS_Part3Port,0x14,0xBf);
}
}
-#ifdef SIS300
- if((HwDeviceExtension->jChipType==SIS_630)||
- (HwDeviceExtension->jChipType==SIS_730)) {
- if(SiS_VBInfo & SetCRT2ToTV) {
- if(SiS_GetReg1(SiS_P3d4,0x31) & 0x01) {
- if(SiS_GetReg1(SiS_P3d4,0x35) & 0x40){
- SiS_SetReg1(SiS_Part3Port,0x13,0xFA);
- SiS_SetReg1(SiS_Part3Port,0x14,0xC8);
- SiS_SetReg1(SiS_Part3Port,0x3D,0xA8);
- }
+ temp = 0;
+ if((HwDeviceExtension->jChipType == SIS_630)||
+ (HwDeviceExtension->jChipType == SIS_730)) {
+ temp = 0x35;
+ } else if(HwDeviceExtension->jChipType >= SIS_315H) {
+ temp = 0x38;
+ }
+ if(temp) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
+ if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x31) & 0x01) {
+ if(SiS_GetReg1(SiS_Pr->SiS_P3d4,temp) & EnablePALM){ /* 0x40 */
+ SiS_SetReg1(SiS_Pr->SiS_Part3Port,0x13,0xFA);
+ SiS_SetReg1(SiS_Pr->SiS_Part3Port,0x14,0xC8);
+ SiS_SetReg1(SiS_Pr->SiS_Part3Port,0x3D,0xA8);
}
}
+ }
}
-#endif
-
-#ifdef SIS315H
- if(HwDeviceExtension->jChipType >= SIS_315H) {
- if(SiS_VBInfo & SetCRT2ToTV) {
- if(SiS_GetReg1(SiS_P3d4,0x31) & 0x01) {
- if(SiS_GetReg1(SiS_P3d4,0x38) & 0x40){
- SiS_SetReg1(SiS_Part3Port,0x13,0xFA);
- SiS_SetReg1(SiS_Part3Port,0x14,0xC8);
- SiS_SetReg1(SiS_Part3Port,0x3D,0xA8);
- }
- }
- }
- }
-#endif
- if(SiS_VBInfo & SetCRT2ToHiVisionTV) {
- tempdi = SiS_HiTVGroup3Data;
- if(SiS_SetFlag & TVSimuMode) {
- tempdi = SiS_HiTVGroup3Simu;
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) {
+ tempdi = SiS_Pr->SiS_HiTVGroup3Data;
+ if(SiS_Pr->SiS_SetFlag & TVSimuMode) {
+ tempdi = SiS_Pr->SiS_HiTVGroup3Simu;
if(!(modeflag & Charx8Dot)) {
- tempdi = SiS_HiTVGroup3Text;
+ tempdi = SiS_Pr->SiS_HiTVGroup3Text;
}
}
+ if(SiS_Pr->SiS_HiVision & 0x03) {
+ tempdi = SiS_HiTVGroup3_1;
+ if(SiS_Pr->SiS_HiVision & 0x02) tempdi = SiS_HiTVGroup3_2;
+ }
for(i=0; i<=0x3E; i++){
- SiS_SetReg1(SiS_Part3Port,i,tempdi[i]);
+ SiS_SetReg1(SiS_Pr->SiS_Part3Port,i,tempdi[i]);
}
}
+
return;
}
/* TW: Set 301 VGA2 registers */
-/* TW: Double-Checked against 650/301LV and 630/301B BIOS */
void
-SiS_SetGroup4(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,
+SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,
USHORT ModeIdIndex,USHORT RefreshRateTableIndex,
PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
- USHORT tempax,tempcx,tempbx,modeflag,temp,temp2,push1;
+ USHORT tempax,tempcx,tempbx,modeflag,temp,temp2,resinfo;
ULONG tempebx,tempeax,templong;
- if(ModeNo<=0x13)
- modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
- else
- modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
- /* TW: From 650/301LV BIOS (done above as well, but does not matter) */
- if(SiS_VBType & (VB_SIS301LV | VB_SIS302LV)) {
- if(SiS_VBInfo & SetCRT2ToLCDA)
- SiS_SetReg1(SiS_Part4Port,0x24,0x0e);
+ if(ModeNo<=0x13) {
+ modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
+ resinfo = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo;
+ } else {
+ modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
}
- /* TW: From 650/301LV BIOS */
- if(SiS_VBInfo & SetCRT2ToLCDA) return;
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ /* TW: From 650/302LV 1.10.6s (not for 300/301LV - no LCDA on this combination) */
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) {
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x24,0x0e);
+ }
+ }
+ }
- temp = SiS_RVBHCFACT;
- SiS_SetReg1(SiS_Part4Port,0x13,temp);
+ if(SiS_Pr->SiS_VBType & VB_SIS302LV) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x10,0x9f);
+ }
+ }
- tempbx = SiS_RVBHCMAX;
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) {
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ /* TW: From 650/301LV (any, incl. 1.10.6s, 1.10.7w) */
+ /* TW: This is a duplicate; done at the end, too */
+ if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x39) & 0x04) {
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x27,0x2c);
+ }
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x2a,0x00);
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x30,0x00);
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x34,0x10);
+ }
+ return;
+ }
+ }
+
+ temp = SiS_Pr->SiS_RVBHCFACT;
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x13,temp);
+
+ tempbx = SiS_Pr->SiS_RVBHCMAX;
temp = tempbx & 0x00FF;
- SiS_SetReg1(SiS_Part4Port,0x14,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x14,temp);
temp2 = (((tempbx & 0xFF00) >> 8) << 7) & 0x00ff;
- tempcx = SiS_VGAHT - 1;
+ tempcx = SiS_Pr->SiS_VGAHT - 1;
temp = tempcx & 0x00FF;
- SiS_SetReg1(SiS_Part4Port,0x16,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x16,temp);
temp = (((tempcx & 0xFF00) >> 8) << 3) & 0x00ff;
temp2 |= temp;
- tempcx = SiS_VGAVT - 1;
- if(!(SiS_VBInfo & SetCRT2ToTV)) tempcx -= 5;
+ tempcx = SiS_Pr->SiS_VGAVT - 1;
+ if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) tempcx -= 5;
temp = tempcx & 0x00FF;
- SiS_SetReg1(SiS_Part4Port,0x17,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x17,temp);
temp = temp2 | ((tempcx & 0xFF00) >> 8);
- SiS_SetReg1(SiS_Part4Port,0x15,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x15,temp);
- tempcx = SiS_VBInfo;
- tempbx = SiS_VGAHDE;
+ tempbx = SiS_Pr->SiS_VGAHDE;
if(modeflag & HalfDCLK) tempbx >>= 1;
/* TW: New for 650/301LV and 630/301B */
temp = 0xA0;
- if(SiS_VBInfo & SetCRT2ToHiVisionTV) {
- temp = 0xA0;
- if(tempbx != 1024) {
- temp = 0xC0;
- if(tempbx != 1280) temp = 0;
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) {
+ temp = 0;
+ if(tempbx > 800) {
+ temp = 0xA0;
+ if(tempbx != 1024) {
+ temp = 0xC0;
+ if(tempbx != 1280) temp = 0;
+ }
}
- } else if(SiS_VBInfo & SetCRT2ToTV) {
+ } else
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
if(tempbx <= 800) {
temp = 0x80;
- if(SiS_VBInfo & SetCRT2ToLCD){
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
temp = 0;
if(tempbx > 800) temp = 0x60;
}
}
} else {
temp = 0x80;
- if(SiS_VBInfo & SetCRT2ToLCD){
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
temp = 0;
if(tempbx > 800) temp = 0x60;
}
}
- if(SiS_HiVision & 0x03) {
+ if(SiS_Pr->SiS_HiVision & 0x03) {
temp = 0;
- if(SiS_VGAHDE == 1024) temp = 0x20;
+ if(SiS_Pr->SiS_VGAHDE == 1024) temp = 0x20;
+ }
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x39) & 0x04) temp = 0;
+ }
+
+ if(SiS_Pr->SiS_VBType & VB_SIS301) {
+ if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x1024)
+ temp |= 0x0A;
}
- SiS_SetRegANDOR(SiS_Part4Port,0x0E,0x10,temp);
- tempebx = SiS_VDE;
- if(SiS_VBInfo & SetCRT2ToHiVisionTV) {
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x0E,0x10,temp);
+
+ tempebx = SiS_Pr->SiS_VDE;
+
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) {
if(!(temp & 0xE0)) tempebx >>=1;
}
- tempcx = SiS_RVBHRS;
+ tempcx = SiS_Pr->SiS_RVBHRS;
temp = tempcx & 0x00FF;
- SiS_SetReg1(SiS_Part4Port,0x18,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x18,temp);
- tempeax = SiS_VGAVDE;
+ tempeax = SiS_Pr->SiS_VGAVDE;
tempcx |= 0x4000;
if(tempeax <= tempebx){
- tempcx = ((tempcx & 0xFF00) ^ 0x4000) | (tempcx & 0x00ff);
+ tempcx ^= 0x4000;
} else {
tempeax -= tempebx;
}
- push1 = tempcx;
-
templong = (tempeax * 256 * 1024) % tempebx;
tempeax = (tempeax * 256 * 1024) / tempebx;
tempebx = tempeax;
if(templong != 0) tempebx++;
- tempcx = push1;
-
temp = (USHORT)(tempebx & 0x000000FF);
- SiS_SetReg1(SiS_Part4Port,0x1B,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x1B,temp);
temp = (USHORT)((tempebx & 0x0000FF00) >> 8);
- SiS_SetReg1(SiS_Part4Port,0x1A,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x1A,temp);
tempbx = (USHORT)(tempebx >> 16);
temp = tempbx & 0x00FF;
temp <<= 4;
temp |= ((tempcx & 0xFF00) >> 8);
- SiS_SetReg1(SiS_Part4Port,0x19,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x19,temp);
+
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
- if(SiS_VBType & VB_SIS301BLV302BLV) {
- SiS_SetReg1(SiS_Part4Port,0x1C,0x28);
- tempbx = 0; /* TW: From 630/301B and 650/301LV BIOS */
- tempax = SiS_VGAHDE;
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x1C,0x28);
+ tempbx = 0;
+ tempax = SiS_Pr->SiS_VGAHDE;
if(modeflag & HalfDCLK) tempax >>= 1;
- if((SiS_VBInfo & SetCRT2ToLCD) || (SiS_HiVision & 0x03)) {
- if(tempax > 800) tempax -= 800;
+ if((SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) || (SiS_Pr->SiS_HiVision & 0x03)) {
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x39) & 0x04) tempax >>= 1;
+ else if(tempax > 800) tempax -= 800;
+ } else {
+ if(tempax > 800) tempax -= 800;
+ }
}
- if((SiS_VBInfo & (SetCRT2ToTV | SetCRT2ToHiVisionTV)) &&
- (!(SiS_HiVision & 0x03))) {
+/* if((SiS_Pr->SiS_VBInfo & (SetCRT2ToTV | SetPALTV)) && (!(SiS_Pr->SiS_HiVision & 0x03))) { */
+ if((SiS_Pr->SiS_VBInfo & (SetCRT2ToTV - SetCRT2ToHiVisionTV)) && (!(SiS_Pr->SiS_HiVision & 0x03))) {
if(tempax > 800) {
- tempbx = 8; /* TW: From 630/301B and 650/301LV BIOS */
+ tempbx = 8;
if(tempax == 1024)
tempax *= 25;
else
@@ -6066,197 +8089,244 @@ SiS_SetGroup4(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,
tempax--;
temp = (tempax & 0xFF00) >> 8;
temp &= 0x03;
- SiS_SetReg1(SiS_Part4Port,0x1D,tempax & 0x00FF);
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { /* From 1.10.7w */
+ if(ModeNo > 0x13) { /* From 1.10.7w */
+ if(resinfo == 8) tempax = 0x1f; /* From 1.10.7w */
+ } /* From 1.10.7w */
+ } /* From 1.10.7w */
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x1D,tempax & 0x00FF);
temp <<= 4;
temp |= tempbx;
- SiS_SetReg1(SiS_Part4Port,0x1E,temp);
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x1E,temp);
- temp = 0x0036;
- if((SiS_VBInfo & (SetCRT2ToTV-SetCRT2ToHiVisionTV)) &&
- (!(SiS_HiVision & 0x03))) { /* TW: From 650/301LV BIOS */
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ if(IS_SIS650740) {
+ temp = 0x0026; /* 1.10.7w; 1.10.8r; needs corresponding code in Dis/EnableBridge! */
+ } else {
+ temp = 0x0036;
+ }
+ } else {
+ temp = 0x0036;
+ }
+ if((SiS_Pr->SiS_VBInfo & (SetCRT2ToTV - SetCRT2ToHiVisionTV)) &&
+ (!(SiS_Pr->SiS_HiVision & 0x03))) {
temp |= 0x01;
- if(SiS_VBInfo & SetInSlaveMode) { /* TW: From 650/301LV BIOS */
- if(!(SiS_SetFlag & TVSimuMode)) /* TW: From 650/301LV BIOS */
- temp &= 0xFE; /* TW: From 650/301LV BIOS */
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
+ if(!(SiS_Pr->SiS_SetFlag & TVSimuMode))
+ temp &= 0xFE;
}
}
- SiS_SetRegANDOR(SiS_Part4Port,0x1F,0xC0,temp);
- tempbx = (SiS_HT >> 1) - 2;
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x1F,0xC0,temp);
+
+ tempbx = SiS_Pr->SiS_HT;
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x39) & 0x04) tempbx >>= 1;
+ }
+ tempbx >>= 1;
+ tempbx -= 2;
temp = ((tempbx & 0x0700) >> 8) << 3;
- SiS_SetRegANDOR(SiS_Part4Port,0x21,0xC0,temp);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x21,0xC0,temp);
temp = tempbx & 0x00FF;
- SiS_SetReg1(SiS_Part4Port,0x22,temp);
- if( (SiS_VBType & (VB_SIS301LV | VB_SIS302LV)) &&
- (SiS_VBInfo & SetCRT2ToLCD) ) {
- SiS_SetReg1(SiS_Part4Port,0x24,0x0e);
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x22,temp);
+
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x24,0x0e);
+ }
}
- }
- SiS_SetCRT2VCLK(BaseAddr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,HwDeviceExtension);
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ /* TW: 650/LV BIOS does this for all bridge types - assumingly wrong */
+ /* 315, 330, 650+301B BIOS don't do this at all */
+ /* TW: This is a duplicate; done for LCDA as well (see above) */
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x39) & 0x04) {
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x27,0x2c);
+ }
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x2a,0x00);
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x30,0x00);
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x34,0x10);
+ }
+ } else if(HwDeviceExtension->jChipType == SIS_300) {
+ /* TW: 300/301LV BIOS does this for all bridge types - assumingly wrong */
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x2a,0x00);
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x30,0x00);
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x34,0x10);
+ }
+ }
+
+ } /* 301B */
+
+ SiS_SetCRT2VCLK(SiS_Pr,BaseAddr,ROMAddr,ModeNo,ModeIdIndex,
+ RefreshRateTableIndex,HwDeviceExtension);
}
-/* TW: Double-Checked against 650/301LV and 630/301B BIOS */
+
void
-SiS_SetCRT2VCLK(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+SiS_SetCRT2VCLK(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
USHORT vclkindex;
- USHORT tempah,temp1;
+ USHORT tempah;
- vclkindex = SiS_GetVCLK2Ptr(ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
+ vclkindex = SiS_GetVCLK2Ptr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
HwDeviceExtension);
- if(SiS_VBType & VB_SIS301BLV302BLV) {
- tempah = SiS_VBVCLKData[vclkindex].Part4_A;
- SiS_SetReg1(SiS_Part4Port,0x0A,tempah);
- tempah = SiS_VBVCLKData[vclkindex].Part4_B;
- SiS_SetReg1(SiS_Part4Port,0x0B,tempah);
- /* TW: New from 650/301LV BIOS */
- if(SiS_VBType & (VB_SIS301LV | VB_SIS302LV)) {
- if(SiS_VBInfo & SetCRT2ToTV) {
- if(!(SiS_VBInfo & SetPALTV)) {
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ tempah = SiS_Pr->SiS_VBVCLKData[vclkindex].Part4_A;
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x0A,tempah);
+ tempah = SiS_Pr->SiS_VBVCLKData[vclkindex].Part4_B;
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x0B,tempah);
+ if(HwDeviceExtension->jChipType >= SIS_315H) {
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
+ if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) {
if((ModeNo == 0x4a) || (ModeNo == 0x38)) {
- SiS_SetReg1(SiS_Part4Port,0x0a,0x57);
- SiS_SetReg1(SiS_Part4Port,0x0b,0x46);
- SiS_SetReg1(SiS_Part4Port,0x1f,0xf6);
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x0a,0x57);
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x0b,0x46);
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x1f,0xf6);
}
}
}
}
- } else {
- SiS_SetReg1(SiS_Part4Port,0x0A,0x01);
- tempah = SiS_VBVCLKData[vclkindex].Part4_B;
- SiS_SetReg1(SiS_Part4Port,0x0B,tempah);
- tempah = SiS_VBVCLKData[vclkindex].Part4_A;
- SiS_SetReg1(SiS_Part4Port,0x0A,tempah);
- }
- SiS_SetReg1(SiS_Part4Port,0x12,0x00);
+ }
+ } else {
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x0A,0x01);
+ tempah = SiS_Pr->SiS_VBVCLKData[vclkindex].Part4_B;
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x0B,tempah);
+ tempah = SiS_Pr->SiS_VBVCLKData[vclkindex].Part4_A;
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x0A,tempah);
+ }
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x12,0x00);
tempah = 0x08;
- if(SiS_VBInfo & SetCRT2ToRAMDAC) {
- tempah |= 0x020;
- }
- temp1 = SiS_GetReg1(SiS_Part4Port,0x12);
- tempah |= temp1;
- SiS_SetReg1(SiS_Part4Port,0x12,tempah);
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC) tempah |= 0x20;
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x12,tempah);
}
-/* TW: Double-checked against 650/LVDS (1.10.07), 630/301B/LVDS/LVDS+CH, 650/301LV BIOS */
USHORT
-SiS_GetVCLK2Ptr(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
- USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension)
+SiS_GetVCLK2Ptr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+ USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
USHORT tempbx;
+ const USHORT LCDXlat0VCLK[4] = {VCLK40, VCLK40, VCLK40, VCLK40};
+ const USHORT LVDSXlat1VCLK[4] = {VCLK40, VCLK40, VCLK40, VCLK40};
#ifdef SIS300
- USHORT LCDXlat1VCLK300[4] = {VCLK65, VCLK65, VCLK65, VCLK65};
- USHORT LCDXlat2VCLK300[4] = {VCLK108_2,VCLK108_2,VCLK108_2,VCLK108_2};
- USHORT LVDSXlat2VCLK300[4]= {VCLK65, VCLK65, VCLK65, VCLK65};
- USHORT LVDSXlat3VCLK300[4]= {VCLK65, VCLK65, VCLK65, VCLK65};
+ const USHORT LCDXlat1VCLK300[4] = {VCLK65, VCLK65, VCLK65, VCLK65};
+ const USHORT LCDXlat2VCLK300[4] = {VCLK108_2,VCLK108_2,VCLK108_2,VCLK108_2};
+ const USHORT LVDSXlat2VCLK300[4]= {VCLK65, VCLK65, VCLK65, VCLK65};
+ const USHORT LVDSXlat3VCLK300[4]= {VCLK65, VCLK65, VCLK65, VCLK65};
#endif
#ifdef SIS315H
- USHORT LCDXlat1VCLK310[4] = {VCLK65+2, VCLK65+2, VCLK65+2, VCLK65+2};
- USHORT LCDXlat2VCLK310[4] = {VCLK108_2+5,VCLK108_2+5,VCLK108_2+5,VCLK108_2+5};
- USHORT LVDSXlat2VCLK310[4]= {VCLK65+2, VCLK65+2, VCLK65+2, VCLK65+2};
- USHORT LVDSXlat3VCLK310[4]= {VCLK108_2+5,VCLK108_2+5,VCLK108_2+5,VCLK108_2+5};
- /* {VCLK65+2, VCLK65+2, VCLK65+2, VCLK65+2}; - 650/LVDS 1.10.07 */
+ const USHORT LCDXlat1VCLK310[4] = {VCLK65+2, VCLK65+2, VCLK65+2, VCLK65+2};
+ const USHORT LCDXlat2VCLK310[4] = {VCLK108_2+5,VCLK108_2+5,VCLK108_2+5,VCLK108_2+5};
+ const USHORT LVDSXlat2VCLK310[4]= {VCLK65+2, VCLK65+2, VCLK65+2, VCLK65+2};
+ const USHORT LVDSXlat3VCLK310[4]= {VCLK108_2+5,VCLK108_2+5,VCLK108_2+5,VCLK108_2+5};
#endif
- USHORT LCDXlat0VCLK[4] = {VCLK40, VCLK40, VCLK40, VCLK40};
- USHORT LVDSXlat1VCLK[4] = {VCLK40, VCLK40, VCLK40, VCLK40};
USHORT CRT2Index,VCLKIndex=0;
USHORT modeflag,resinfo;
- UCHAR *CHTVVCLKPtr=NULL;
- USHORT *LCDXlatVCLK1 = NULL;
- USHORT *LCDXlatVCLK2 = NULL;
- USHORT *LVDSXlatVCLK2 = NULL;
- USHORT *LVDSXlatVCLK3 = NULL;
+ const UCHAR *CHTVVCLKPtr=NULL;
+ const USHORT *LCDXlatVCLK1 = NULL;
+ const USHORT *LCDXlatVCLK2 = NULL;
+ const USHORT *LVDSXlatVCLK2 = NULL;
+ const USHORT *LVDSXlatVCLK3 = NULL;
-#ifdef SIS315H
if(HwDeviceExtension->jChipType >= SIS_315H) {
+#ifdef SIS315H
LCDXlatVCLK1 = LCDXlat1VCLK310;
LCDXlatVCLK2 = LCDXlat2VCLK310;
LVDSXlatVCLK2 = LVDSXlat2VCLK310;
LVDSXlatVCLK3 = LVDSXlat3VCLK310;
- } else {
#endif
+ } else {
#ifdef SIS300
LCDXlatVCLK1 = LCDXlat1VCLK300;
LCDXlatVCLK2 = LCDXlat2VCLK300;
LVDSXlatVCLK2 = LVDSXlat2VCLK300;
LVDSXlatVCLK3 = LVDSXlat3VCLK300;
#endif
-#ifdef SIS315H
}
-#endif
- if(ModeNo<=0x13) {
- modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
- resinfo = SiS_SModeIDTable[ModeIdIndex].St_ResInfo;
- CRT2Index = SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC;
+ if(ModeNo <= 0x13) {
+ modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
+ resinfo = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo;
+ CRT2Index = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC;
} else {
- modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
- resinfo = SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
- CRT2Index = SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
+ modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
+ CRT2Index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
}
- if(SiS_IF_DEF_LVDS==0) { /* 301 */
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { /* 30x/B/LV */
- if (SiS_SetFlag & ProgrammingCRT2) {
+ if(SiS_Pr->SiS_SetFlag & ProgrammingCRT2) {
CRT2Index >>= 6;
- if(SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)){ /* LCD */
+ if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)){ /* LCD */
if(HwDeviceExtension->jChipType < SIS_315H) {
- /* TW: Inserted from 630/301B BIOS */
- if(SiS_LCDResInfo == Panel800x600)
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600)
VCLKIndex = LCDXlat0VCLK[CRT2Index];
- else if(SiS_LCDResInfo == Panel1024x768)
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768)
+ VCLKIndex = LCDXlatVCLK1[CRT2Index];
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600)
+ VCLKIndex = LCDXlatVCLK1[CRT2Index];
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1152x768)
VCLKIndex = LCDXlatVCLK1[CRT2Index];
else
VCLKIndex = LCDXlatVCLK2[CRT2Index];
} else {
- /* TW: 650/301LV BIOS does not check expanding, 315 does */
+ /* TW: 330, 650/301LV BIOS does not check expanding, 315 does */
if( (HwDeviceExtension->jChipType > SIS_315PRO) ||
- (!(SiS_LCDInfo & LCDNonExpanding)) ) {
- if(SiS_LCDResInfo == Panel1024x768){
+ (!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) ) {
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) {
+ VCLKIndex = 0x19;
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) {
+ VCLKIndex = 0x19;
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) {
+ VCLKIndex = 0x21;
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) {
VCLKIndex = LCDXlatVCLK1[CRT2Index];
- } else if(SiS_LCDResInfo == Panel1280x960) {
- VCLKIndex = 0x45;
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x960) {
+ VCLKIndex = 0x45; /* TW: in VBVCLK table */
if(resinfo == 0x09) VCLKIndex++;
- } else {
+ } else {
VCLKIndex = LCDXlatVCLK2[CRT2Index];
- }
+ }
} else {
- VCLKIndex = (UCHAR)SiS_GetReg2((USHORT)(SiS_P3ca+0x02)); /* Port 3cch */
+ VCLKIndex = (UCHAR)SiS_GetReg2((USHORT)(SiS_Pr->SiS_P3ca+0x02)); /* Port 3cch */
VCLKIndex = ((VCLKIndex >> 2) & 0x03);
if(ModeNo > 0x13) {
- VCLKIndex = SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
+ VCLKIndex = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
}
if(ModeNo <= 0x13) { /* TW: Inserted from 315 BIOS */
- if(SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC == 1) VCLKIndex = 0x42;
+ if(SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC == 1) VCLKIndex = 0x42;
}
if(VCLKIndex == 0) VCLKIndex = 0x41;
if(VCLKIndex == 1) VCLKIndex = 0x43;
if(VCLKIndex == 4) VCLKIndex = 0x44;
}
}
- } else if(SiS_VBInfo & SetCRT2ToTV) { /* TV */
- if((SiS_IF_DEF_HiVision == 1) && (SiS_VBInfo & SetCRT2ToHiVisionTV)) {
- if(SiS_SetFlag & RPLLDIV2XO) VCLKIndex = HiTVVCLKDIV2;
- else VCLKIndex = HiTVVCLK;
- if(SiS_SetFlag & TVSimuMode) {
- if(modeflag & Charx8Dot) VCLKIndex = HiTVSimuVCLK;
- else VCLKIndex = HiTVTextVCLK;
+ } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { /* TV */
+ if( (SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) &&
+ (!(SiS_Pr->SiS_VBType & VB_SIS301LV302LV)) ) {
+ if(SiS_Pr->SiS_SetFlag & RPLLDIV2XO) VCLKIndex = HiTVVCLKDIV2;
+ else VCLKIndex = HiTVVCLK;
+ if(SiS_Pr->SiS_SetFlag & TVSimuMode) {
+ if(modeflag & Charx8Dot) VCLKIndex = HiTVSimuVCLK;
+ else VCLKIndex = HiTVTextVCLK;
}
} else {
- if(SiS_SetFlag & RPLLDIV2XO) VCLKIndex = TVVCLKDIV2;
- else VCLKIndex = TVVCLK;
+ if(SiS_Pr->SiS_SetFlag & RPLLDIV2XO) VCLKIndex = TVVCLKDIV2;
+ else VCLKIndex = TVVCLK;
}
if(HwDeviceExtension->jChipType >= SIS_315H) {
VCLKIndex += 25;
}
} else { /* RAMDAC2 */
- VCLKIndex = (UCHAR)SiS_GetReg2((USHORT)(SiS_P3ca+0x02));
+ VCLKIndex = (UCHAR)SiS_GetReg2((USHORT)(SiS_Pr->SiS_P3ca+0x02));
VCLKIndex = ((VCLKIndex >> 2) & 0x03);
if(ModeNo > 0x13) {
- VCLKIndex = SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
+ VCLKIndex = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
if(HwDeviceExtension->jChipType < SIS_315H) {
VCLKIndex &= 0x3f;
if( (HwDeviceExtension->jChipType == SIS_630) &&
@@ -6269,13 +8339,14 @@ SiS_GetVCLK2Ptr(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
} else { /* If not programming CRT2 */
- VCLKIndex = (UCHAR)SiS_GetReg2((USHORT)(SiS_P3ca+0x02));
+ VCLKIndex = (UCHAR)SiS_GetReg2((USHORT)(SiS_Pr->SiS_P3ca+0x02));
VCLKIndex = ((VCLKIndex >> 2) & 0x03);
if(ModeNo > 0x13) {
- VCLKIndex = SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
+ VCLKIndex = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
if(HwDeviceExtension->jChipType < SIS_315H) {
VCLKIndex &= 0x3f;
- if(HwDeviceExtension->jChipType != SIS_630) {
+ if( (HwDeviceExtension->jChipType != SIS_630) &&
+ (HwDeviceExtension->jChipType != SIS_300) ) {
if(VCLKIndex == 0x1b) VCLKIndex = 0x35;
}
}
@@ -6286,492 +8357,297 @@ SiS_GetVCLK2Ptr(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
VCLKIndex = CRT2Index;
- if(SiS_SetFlag & ProgrammingCRT2) { /* programming CRT2 */
+ if(SiS_Pr->SiS_SetFlag & ProgrammingCRT2) { /* programming CRT2 */
- if( (SiS_IF_DEF_CH70xx != 0) && (SiS_VBInfo & SetCRT2ToTV) ) {
+ if( (SiS_Pr->SiS_IF_DEF_CH70xx != 0) && (SiS_Pr->SiS_VBInfo & SetCRT2ToTV) ) {
VCLKIndex &= 0x1f;
tempbx = 0;
- if(SiS_VBInfo & SetPALTV) tempbx += 2;
- if(SiS_VBInfo & SetCHTVOverScan) tempbx += 1;
+ if(SiS_Pr->SiS_VBInfo & SetCHTVOverScan) tempbx += 1;
+ if(SiS_Pr->SiS_VBInfo & SetPALTV) {
+ tempbx += 2;
+ if(SiS_Pr->SiS_CHSOverScan) tempbx = 8;
+ if(SiS_Pr->SiS_CHPALM) {
+ tempbx = 4;
+ if(SiS_Pr->SiS_VBInfo & SetCHTVOverScan) tempbx += 1;
+ } else if(SiS_Pr->SiS_CHPALN) {
+ tempbx = 6;
+ if(SiS_Pr->SiS_VBInfo & SetCHTVOverScan) tempbx += 1;
+ }
+ }
switch(tempbx) {
- case 0: CHTVVCLKPtr = SiS_CHTVVCLKUNTSC; break;
- case 1: CHTVVCLKPtr = SiS_CHTVVCLKONTSC; break;
- case 2: CHTVVCLKPtr = SiS_CHTVVCLKUPAL; break;
- case 3: CHTVVCLKPtr = SiS_CHTVVCLKOPAL; break;
+ case 0: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKUNTSC; break;
+ case 1: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKONTSC; break;
+ case 2: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKUPAL; break;
+ case 3: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKOPAL; break;
+ case 4: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKUPALM; break;
+ case 5: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKOPALM; break;
+ case 6: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKUPALN; break;
+ case 7: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKOPALN; break;
+ case 8: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKSOPAL; break;
+ default: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKOPAL; break;
}
VCLKIndex = CHTVVCLKPtr[VCLKIndex];
- } else if(SiS_VBInfo & SetCRT2ToLCD) {
+ } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
VCLKIndex >>= 6;
- if((SiS_LCDResInfo==Panel800x600) || (SiS_LCDResInfo==Panel320x480))
+ if((SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) ||
+ (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel320x480))
VCLKIndex = LVDSXlat1VCLK[VCLKIndex];
- else if(SiS_LCDResInfo==Panel1024x768)
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768)
VCLKIndex = LVDSXlatVCLK2[VCLKIndex];
- else VCLKIndex = LVDSXlatVCLK3[VCLKIndex];
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600)
+ VCLKIndex = LVDSXlatVCLK2[VCLKIndex];
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1152x768)
+ VCLKIndex = LVDSXlatVCLK2[VCLKIndex];
+ else VCLKIndex = LVDSXlatVCLK3[VCLKIndex];
} else {
- VCLKIndex = (UCHAR)SiS_GetReg2((USHORT)(SiS_P3ca+0x02));
+ VCLKIndex = (UCHAR)SiS_GetReg2((USHORT)(SiS_Pr->SiS_P3ca+0x02));
VCLKIndex = ((VCLKIndex >> 2) & 0x03);
if(ModeNo > 0x13) {
- VCLKIndex = SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
+ VCLKIndex = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
+ if(HwDeviceExtension->jChipType < SIS_315H) {
+ VCLKIndex &= 0x3F;
+ }
if( (HwDeviceExtension->jChipType == SIS_630) &&
(HwDeviceExtension->jChipRevision >= 0x30) ) {
if(VCLKIndex == 0x14) VCLKIndex = 0x2e;
}
}
-
}
} else { /* if not programming CRT2 */
- VCLKIndex = (UCHAR)SiS_GetReg2((USHORT)(SiS_P3ca+0x02));
+ VCLKIndex = (UCHAR)SiS_GetReg2((USHORT)(SiS_Pr->SiS_P3ca+0x02));
VCLKIndex = ((VCLKIndex >> 2) & 0x03);
if(ModeNo > 0x13) {
- VCLKIndex = SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
+ VCLKIndex = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
if(HwDeviceExtension->jChipType < SIS_315H) {
- if(HwDeviceExtension->jChipType != SIS_630) {
+ VCLKIndex &= 0x3F;
+ if( (HwDeviceExtension->jChipType != SIS_630) &&
+ (HwDeviceExtension->jChipType != SIS_300) ) {
if(VCLKIndex == 0x1b) VCLKIndex = 0x35;
}
+#if 0
+ if(HwDeviceExtension->jChipType == SIS_730) {
+ if(VCLKIndex == 0x0b) VCLKIndex = 0x40; /* 1024x768-70 */
+ if(VCLKIndex == 0x0d) VCLKIndex = 0x41; /* 1024x768-75 */
+ }
+#endif
}
}
}
}
-
- if(HwDeviceExtension->jChipType < SIS_315H) {
- VCLKIndex &= 0x3F;
- }
+#ifdef TWDEBUG
+ xf86DrvMsg(0, X_INFO, "VCLKIndex %d (0x%x)\n", VCLKIndex, VCLKIndex);
+#endif
return (VCLKIndex);
}
/* TW: Set 301 Palette address port registers */
/* TW: Checked against 650/301LV BIOS */
void
-SiS_SetGroup5(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,
- USHORT ModeIdIndex)
+SiS_SetGroup5(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr,
+ UCHAR *ROMAddr, USHORT ModeNo, USHORT ModeIdIndex)
{
- if((SiS_VBType & VB_SIS301BLV302BLV) && (SiS_VBInfo & SetCRT2ToLCDA))
- return;
-
- if(SiS_ModeType == ModeVGA){
- if(!(SiS_VBInfo & (SetInSlaveMode|LoadDACFlag))){
- SiS_EnableCRT2();
- SiS_LoadDAC2(ROMAddr,SiS_Part5Port,ModeNo,ModeIdIndex);
- }
- }
- return;
-}
-
-/* TW: Checked against 650/301LV BIOS */
-void
-SiS_LoadDAC2(UCHAR *ROMAddr,USHORT SiS_Part5Port,
- USHORT ModeNo,USHORT ModeIdIndex)
-{
- USHORT data,data2;
- USHORT time,i,j,k;
- USHORT m,n,o;
- USHORT si,di,bx,dl;
- USHORT al,ah,dh;
- USHORT *table=0;
- USHORT Pindex,Pdata,modeflag;
-
-/* if(SiS_SetFlag & SetDispDevSwitchFlag) return; - TW: Not needed */
-
- if(ModeNo <= 0x13)
- modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */
- else
- modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */
-
-#if 0
- if(!(ds:489 & 0x08)) {
-#endif
-
- Pindex = SiS_Part5Port;
- Pdata = SiS_Part5Port + 1;
- data = modeflag & DACInfoFlag;
- time = 64;
- if(data == 0x00) table = SiS_MDA_DAC;
- if(data == 0x08) table = SiS_CGA_DAC;
- if(data == 0x10) table = SiS_EGA_DAC;
- if(data == 0x18) {
- time = 256;
- table = SiS_VGA_DAC;
- }
-
- if(time == 256) j = 16;
- else j = time;
-
- SiS_SetReg3(Pindex,0x00);
-
- for(i=0; i<j; i++) {
- data = table[i];
- for(k=0; k<3; k++) {
- data2 = 0;
- if(data & 0x01) data2 = 0x2A;
- if(data & 0x02) data2 += 0x15;
- data2 <<= 2; /* TW: New from 650/301LV BIOS */
- SiS_SetReg3(Pdata,data2);
- data >>= 2;
- }
- }
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) return;
- if(time == 256) {
- for(i=16;i<32;i++) {
- data = table[i];
- data <<= 2; /* TW: New from 650/301LV BIOS */
- for(k=0; k<3; k++) SiS_SetReg3(Pdata,data);
- }
- si = 32;
- for(m=0; m<9; m++) {
- di = si;
- bx = si + 0x04;
- dl = 0;
- for(n=0; n<3; n++) {
- for(o=0; o<5; o++) {
- dh = table[si];
- ah = table[di];
- al = table[bx];
- si++;
- SiS_WriteDAC2(Pdata,dl,ah,al,dh);
- } /* for 5 */
- si = si - 2;
- for(o=0; o<3; o++) {
- dh = table[bx];
- ah = table[di];
- al = table[si];
- si--;
- SiS_WriteDAC2(Pdata,dl,ah,al,dh);
- } /* for 3 */
- dl++;
- } /* for 3 */
- si = si + 5;
- } /* for 9 */
- }
-#if 0
- } /* ds:489 & 0x08 */
-#endif
-}
-
-/* TW: Checked against 650/301LV BIOS */
-void
-SiS_WriteDAC2(USHORT Pdata, USHORT dl, USHORT ah, USHORT al, USHORT dh)
-{
- USHORT temp;
- USHORT bh,bl;
-
- bh = ah;
- bl = al;
- if(dl != 0) {
- temp = bh;
- bh = dh;
- dh = temp;
- if(dl == 1) {
- temp = bl;
- bl = dh;
- dh = temp;
- } else {
- temp = bl;
- bl = bh;
- bh = temp;
- }
+ if(SiS_Pr->SiS_ModeType == ModeVGA){
+ if(!(SiS_Pr->SiS_VBInfo & (SetInSlaveMode | LoadDACFlag))){
+ SiS_EnableCRT2(SiS_Pr);
+ SiS_LoadDAC(SiS_Pr,HwDeviceExtension,ROMAddr,ModeNo,ModeIdIndex);
+ }
}
- dh <<= 2; /* TW: New from 650/301LV BIOS */
- bh <<= 2; /* TW: New from 650/301LV BIOS */
- bl <<= 2; /* TW: New from 650/301LV BIOS */
- SiS_SetReg3(Pdata,(USHORT)dh);
- SiS_SetReg3(Pdata,(USHORT)bh);
- SiS_SetReg3(Pdata,(USHORT)bl);
}
-/* TW: Checked against 650/LVDS and 630/301B BIOS */
void
-SiS_ModCRT1CRTC(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+SiS_ModCRT1CRTC(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
USHORT temp,tempah,i,modeflag,j;
USHORT ResInfo,DisplayType;
- SiS_LVDSCRT1DataStruct *LVDSCRT1Ptr=NULL;
+ const SiS_LVDSCRT1DataStruct *LVDSCRT1Ptr=NULL;
if(ModeNo <= 0x13) {
- modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
+ modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
} else {
- modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
}
- temp = SiS_GetLVDSCRT1Ptr(ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
+ temp = SiS_GetLVDSCRT1Ptr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
&ResInfo,&DisplayType);
if(temp == 0) return;
- /* TW: Inserted from 630/LVDS BIOS */
if(HwDeviceExtension->jChipType < SIS_315H) {
- if(SiS_SetFlag & CRT2IsVGA) return;
+ if(SiS_Pr->SiS_SetFlag & SetDOSMode) return;
}
switch(DisplayType) {
- case 0 : LVDSCRT1Ptr = SiS_LVDSCRT1800x600_1; break;
- case 1 : LVDSCRT1Ptr = SiS_LVDSCRT11024x768_1; break;
- case 2 : LVDSCRT1Ptr = SiS_LVDSCRT11280x1024_1; break;
- case 3 : LVDSCRT1Ptr = SiS_LVDSCRT1800x600_1_H; break;
- case 4 : LVDSCRT1Ptr = SiS_LVDSCRT11024x768_1_H; break;
- case 5 : LVDSCRT1Ptr = SiS_LVDSCRT11280x1024_1_H; break;
- case 6 : LVDSCRT1Ptr = SiS_LVDSCRT1800x600_2; break;
- case 7 : LVDSCRT1Ptr = SiS_LVDSCRT11024x768_2; break;
- case 8 : LVDSCRT1Ptr = SiS_LVDSCRT11280x1024_2; break;
- case 9 : LVDSCRT1Ptr = SiS_LVDSCRT1800x600_2_H; break;
- case 10: LVDSCRT1Ptr = SiS_LVDSCRT11024x768_2_H; break;
- case 11: LVDSCRT1Ptr = SiS_LVDSCRT11280x1024_2_H; break;
- case 12: LVDSCRT1Ptr = SiS_LVDSCRT1XXXxXXX_1; break;
- case 13: LVDSCRT1Ptr = SiS_LVDSCRT1XXXxXXX_1_H; break;
- case 14: LVDSCRT1Ptr = SiS_LVDSCRT11400x1050_1; break;
- case 15: LVDSCRT1Ptr = SiS_LVDSCRT11400x1050_1_H; break;
- case 16: LVDSCRT1Ptr = SiS_LVDSCRT11400x1050_2; break;
- case 17: LVDSCRT1Ptr = SiS_LVDSCRT11400x1050_2_H; break;
- case 18: LVDSCRT1Ptr = SiS_CHTVCRT1UNTSC; break;
- case 19: LVDSCRT1Ptr = SiS_CHTVCRT1ONTSC; break;
- case 20: LVDSCRT1Ptr = SiS_CHTVCRT1UPAL; break;
- case 21: LVDSCRT1Ptr = SiS_CHTVCRT1OPAL; break;
- case 22: LVDSCRT1Ptr = SiS_LVDSCRT1320x480_1; break; /* FSTN */
- case 23: LVDSCRT1Ptr = SiS_LVDSCRT11024x600_1; break;
- case 24: LVDSCRT1Ptr = SiS_LVDSCRT11024x600_1_H; break;
- case 25: LVDSCRT1Ptr = SiS_LVDSCRT11024x600_2; break;
- case 26: LVDSCRT1Ptr = SiS_LVDSCRT11024x600_2_H; break;
- case 27: LVDSCRT1Ptr = SiS_LVDSCRT11152x768_1; break;
- case 28: LVDSCRT1Ptr = SiS_LVDSCRT11152x768_1_H; break;
- case 29: LVDSCRT1Ptr = SiS_LVDSCRT11152x768_2; break;
- case 30: LVDSCRT1Ptr = SiS_LVDSCRT11152x768_2_H; break;
- }
-
- SiS_SetRegAND(SiS_P3d4,0x11,0x7f); /*unlock cr0-7 */
+ case 0 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1800x600_1; break;
+ case 1 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_1; break;
+ case 2 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11280x1024_1; break;
+ case 3 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1800x600_1_H; break;
+ case 4 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_1_H; break;
+ case 5 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11280x1024_1_H; break;
+ case 6 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1800x600_2; break;
+ case 7 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_2; break;
+ case 8 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11280x1024_2; break;
+ case 9 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1800x600_2_H; break;
+ case 10: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_2_H; break;
+ case 11: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11280x1024_2_H; break;
+ case 12: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1XXXxXXX_1; break;
+ case 13: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1XXXxXXX_1_H; break;
+ case 14: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11400x1050_1; break;
+ case 15: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11400x1050_1_H; break;
+ case 16: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11400x1050_2; break;
+ case 17: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11400x1050_2_H; break;
+ case 18: LVDSCRT1Ptr = SiS_Pr->SiS_CHTVCRT1UNTSC; break;
+ case 19: LVDSCRT1Ptr = SiS_Pr->SiS_CHTVCRT1ONTSC; break;
+ case 20: LVDSCRT1Ptr = SiS_Pr->SiS_CHTVCRT1UPAL; break;
+ case 21: LVDSCRT1Ptr = SiS_Pr->SiS_CHTVCRT1OPAL; break;
+ case 22: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1320x480_1; break; /* FSTN */
+ case 23: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x600_1; break;
+ case 24: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x600_1_H; break;
+ case 25: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x600_2; break;
+ case 26: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x600_2_H; break;
+ case 27: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11152x768_1; break;
+ case 28: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11152x768_1_H; break;
+ case 29: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11152x768_2; break;
+ case 30: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11152x768_2_H; break;
+ case 36: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11600x1200_1; break;
+ case 37: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11600x1200_1_H; break;
+ case 38: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11600x1200_2; break;
+ case 39: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11600x1200_2_H; break;
+ case 99: LVDSCRT1Ptr = SiS_Pr->SiS_CHTVCRT1SOPAL; break;
+ default: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_1; break;
+ }
+
+ SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x11,0x7f); /*unlock cr0-7 */
tempah = (LVDSCRT1Ptr+ResInfo)->CR[0];
- SiS_SetReg1(SiS_P3d4,0x00,tempah);
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x00,tempah);
for(i=0x02,j=1;i<=0x05;i++,j++){
tempah = (LVDSCRT1Ptr+ResInfo)->CR[j];
- SiS_SetReg1(SiS_P3d4,i,tempah);
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,i,tempah);
}
for(i=0x06,j=5;i<=0x07;i++,j++){
tempah = (LVDSCRT1Ptr+ResInfo)->CR[j];
- SiS_SetReg1(SiS_P3d4,i,tempah);
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,i,tempah);
}
for(i=0x10,j=7;i<=0x11;i++,j++){
tempah = (LVDSCRT1Ptr+ResInfo)->CR[j];
- SiS_SetReg1(SiS_P3d4,i,tempah);
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,i,tempah);
}
for(i=0x15,j=9;i<=0x16;i++,j++){
tempah = (LVDSCRT1Ptr+ResInfo)->CR[j];
- SiS_SetReg1(SiS_P3d4,i,tempah);
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,i,tempah);
}
for(i=0x0A,j=11;i<=0x0C;i++,j++){
tempah = (LVDSCRT1Ptr+ResInfo)->CR[j];
- SiS_SetReg1(SiS_P3c4,i,tempah);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,i,tempah);
}
tempah = (LVDSCRT1Ptr+ResInfo)->CR[14];
tempah &= 0xE0;
- SiS_SetRegANDOR(SiS_P3c4,0x0E,0x1f,tempah); /* TW: Modfied (650/LVDS); Was SetReg(tempah) */
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0E,0x1f,tempah);
tempah = (LVDSCRT1Ptr+ResInfo)->CR[14];
tempah &= 0x01;
tempah <<= 5;
- if(modeflag & DoubleScanMode){
- tempah |= 0x080;
- }
- SiS_SetRegANDOR(SiS_P3d4,0x09,~0x020,tempah);
+ if(modeflag & DoubleScanMode) tempah |= 0x080;
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,~0x020,tempah);
- /* TW: Inserted from 650/LVDS BIOS */
- if(SiS_VBInfo & SetCRT2ToTV) {
+ /* TW: Inserted from 650/LVDS BIOS - doesn't make sense */
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
if(modeflag & HalfDCLK)
- SiS_SetRegAND(SiS_P3d4,0x11,0x7f);
- }
-
- return;
-}
-
-#if 0 /* TW: Unused */
-/*301b*/
-void
-SiS_CHACRT1CRTC(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
- USHORT RefreshRateTableIndex)
-{
- USHORT temp,tempah,i,modeflag,j;
- USHORT ResInfo,DisplayType;
- SiS_LVDSCRT1DataStruct *LVDSCRT1Ptr=NULL;
-
- if(ModeNo<=0x13) {
- modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */
- } else {
- modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */
- }
-
- temp=SiS_GetLVDSCRT1Ptr(ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
- &ResInfo,&DisplayType);
- if(temp==0){
- return;
- }
-
- switch(DisplayType) {
- case 0 : LVDSCRT1Ptr = SiS_LVDSCRT1800x600_1; break;
- case 1 : LVDSCRT1Ptr = SiS_LVDSCRT11024x768_1; break;
- case 2 : LVDSCRT1Ptr = SiS_LVDSCRT11280x1024_1; break;
- case 3 : LVDSCRT1Ptr = SiS_LVDSCRT1800x600_1_H; break;
- case 4 : LVDSCRT1Ptr = SiS_LVDSCRT11024x768_1_H; break;
- case 5 : LVDSCRT1Ptr = SiS_LVDSCRT11280x1024_1_H; break;
- case 6 : LVDSCRT1Ptr = SiS_LVDSCRT1800x600_2; break;
- case 7 : LVDSCRT1Ptr = SiS_LVDSCRT11024x768_2; break;
- case 8 : LVDSCRT1Ptr = SiS_LVDSCRT11280x1024_2; break;
- case 9 : LVDSCRT1Ptr = SiS_LVDSCRT1800x600_2_H; break;
- case 10: LVDSCRT1Ptr = SiS_LVDSCRT11024x768_2_H; break;
- case 11: LVDSCRT1Ptr = SiS_LVDSCRT11280x1024_2_H; break;
- case 12: LVDSCRT1Ptr = SiS_LVDSCRT1XXXxXXX_1; break;
- case 13: LVDSCRT1Ptr = SiS_LVDSCRT1XXXxXXX_1_H; break;
- case 14: LVDSCRT1Ptr = SiS_LVDSCRT11400x1050_1; break;
- case 15: LVDSCRT1Ptr = SiS_LVDSCRT11400x1050_1_H; break;
- case 16: LVDSCRT1Ptr = SiS_LVDSCRT11400x1050_2; break;
- case 17: LVDSCRT1Ptr = SiS_LVDSCRT11400x1050_2_H; break;
- case 18: LVDSCRT1Ptr = SiS_CHTVCRT1UNTSC; break;
- case 19: LVDSCRT1Ptr = SiS_CHTVCRT1ONTSC; break;
- case 20: LVDSCRT1Ptr = SiS_CHTVCRT1UPAL; break;
- case 21: LVDSCRT1Ptr = SiS_CHTVCRT1OPAL; break;
- case 22: LVDSCRT1Ptr = SiS_LVDSCRT1320x480_1; break; /* FSTN */
- }
-
- tempah=(UCHAR)SiS_GetReg1(SiS_P3d4,0x11); /*unlock cr0-7 */
- tempah=tempah&0x7F;
- SiS_SetReg1(SiS_P3d4,0x11,tempah);
- tempah = (LVDSCRT1Ptr+ResInfo)->CR[0];
- SiS_SetReg1(SiS_P3d4,0x0,tempah);
- for(i=0x02,j=1;i<=0x05;i++,j++){
- tempah = (LVDSCRT1Ptr+ResInfo)->CR[j];
- SiS_SetReg1(SiS_P3d4,i,tempah);
- }
- for(i=0x06,j=5;i<=0x07;i++,j++){
- tempah = (LVDSCRT1Ptr+ResInfo)->CR[j];
- SiS_SetReg1(SiS_P3d4,i,tempah);
- }
- for(i=0x10,j=7;i<=0x11;i++,j++){
- tempah = (LVDSCRT1Ptr+ResInfo)->CR[j];
- SiS_SetReg1(SiS_P3d4,i,tempah);
- }
- for(i=0x15,j=9;i<=0x16;i++,j++){
- tempah = (LVDSCRT1Ptr+ResInfo)->CR[j];
- SiS_SetReg1(SiS_P3d4,i,tempah);
- }
-
- for(i=0x0A,j=11;i<=0x0C;i++,j++){
- tempah = (LVDSCRT1Ptr+ResInfo)->CR[j];
- SiS_SetReg1(SiS_P3c4,i,tempah);
- }
-
- tempah = (LVDSCRT1Ptr+ResInfo)->CR[14];
- tempah=tempah&0x0E0;
- SiS_SetReg1(SiS_P3c4,0x0E,tempah);
-
- tempah = (LVDSCRT1Ptr+ResInfo)->CR[14];
- tempah=tempah&0x01;
- tempah=tempah<<5;
- if(modeflag&DoubleScanMode){
- tempah=tempah|0x080;
- }
- SiS_SetRegANDOR(SiS_P3d4,0x09,~0x020,tempah);
- return;
-}
-/*add for LCDA*/
-#endif
-
-BOOLEAN
-SiS_GetLCDACRT1Ptr(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
- USHORT RefreshRateTableIndex,USHORT *ResInfo,
- USHORT *DisplayType)
- {
- USHORT tempbx=0,modeflag=0;
- USHORT CRT2CRTC=0;
-
- if(ModeNo<=0x13) {
- modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
- CRT2CRTC = SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC;
- } else {
- modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
- CRT2CRTC = SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
+ SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x11,0x7f);
}
-
- tempbx = SiS_LCDResInfo - PanelMinLVDS;
-
- if(SiS_LCDInfo & LCDNonExpanding) tempbx += 6;
-
- if(modeflag & HalfDCLK) tempbx += 3;
-
- *ResInfo = CRT2CRTC & 0x3F;
- *DisplayType = tempbx;
-
- return 1;
}
-/* TW: Checked against 650/LVDS BIOS: modified for new panel resolutions */
BOOLEAN
-SiS_GetLVDSCRT1Ptr(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+SiS_GetLVDSCRT1Ptr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
USHORT RefreshRateTableIndex,USHORT *ResInfo,
USHORT *DisplayType)
{
USHORT tempbx,modeflag=0;
USHORT Flag,CRT2CRTC;
- if(!(SiS_VBInfo & SetCRT2ToLCDA)) { /* TW: Inserted from 650/LVDS BIOS */
- if(!(SiS_VBInfo & SetInSlaveMode)) return 0;
- } /* TW: Inserted from 650/LVDS BIOS */
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
+ if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) {
+ if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) return 0;
+ }
+ } else {
+ if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) return 0;
+ }
if(ModeNo <= 0x13) {
- modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
- CRT2CRTC = SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC;
+ modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
+ CRT2CRTC = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC;
} else {
- modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
- CRT2CRTC = SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
+ modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ CRT2CRTC = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
}
Flag = 1;
tempbx = 0;
- if(SiS_IF_DEF_CH70xx != 0) {
- if(!(SiS_VBInfo & SetCRT2ToLCD)) {
- Flag = 0;
- tempbx = 18;
- if(SiS_VBInfo & SetPALTV) tempbx += 2;
- if(SiS_VBInfo & SetCHTVOverScan) tempbx++;
- }
+ if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
+ if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) {
+ Flag = 0;
+ tempbx = 18;
+ if(SiS_Pr->SiS_VBInfo & SetCHTVOverScan) tempbx++;
+ if(SiS_Pr->SiS_VBInfo & SetPALTV) {
+ tempbx += 2;
+ if(SiS_Pr->SiS_CHSOverScan) tempbx = 99;
+ if(SiS_Pr->SiS_CHPALM) {
+ tempbx = 18; /* PALM uses NTSC data */
+ if(SiS_Pr->SiS_VBInfo & SetCHTVOverScan) tempbx++;
+ } else if(SiS_Pr->SiS_CHPALN) {
+ tempbx = 20; /* PALN uses PAL data */
+ if(SiS_Pr->SiS_VBInfo & SetCHTVOverScan) tempbx++;
+ }
+ }
+ }
}
if(Flag) {
- tempbx = SiS_LCDResInfo;
- tempbx -= PanelMinLVDS;
- if(SiS_LCDResInfo <= Panel1280x1024) {
- if(SiS_LCDInfo & LCDNonExpanding) tempbx += 6;
- if(modeflag & HalfDCLK) tempbx += 3;
- } else {
- if(SiS_LCDResInfo == Panel1400x1050) {
+ tempbx = SiS_Pr->SiS_LCDResInfo;
+ tempbx -= SiS_Pr->SiS_PanelMinLVDS;
+ if(SiS_Pr->SiS_LCDResInfo <= SiS_Pr->SiS_Panel1280x1024) {
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx += 6;
+ if(modeflag & HalfDCLK) tempbx += 3;
+ } else {
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) {
tempbx = 14;
- if(SiS_LCDInfo & LCDNonExpanding) tempbx += 2;
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx += 2;
if(modeflag & HalfDCLK) tempbx++;
- } else if(SiS_LCDInfo & 0x0100) {
+ } else if(SiS_Pr->SiS_LCDInfo & LCDPass11) {
tempbx = 12;
if(modeflag & HalfDCLK) tempbx++;
- } else if(SiS_LCDResInfo == Panel1024x600) {
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) {
tempbx = 23;
- if(SiS_LCDInfo & LCDNonExpanding) tempbx += 2;
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx += 2;
if(modeflag & HalfDCLK) tempbx++;
- } else if(SiS_LCDResInfo == Panel1152x768) {
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1152x768) {
tempbx = 27;
- if(SiS_LCDInfo & LCDNonExpanding) tempbx += 2;
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx += 2;
if(modeflag & HalfDCLK) tempbx++;
- }
- }
+ } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) {
+ tempbx = 36;
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx += 2;
+ if(modeflag & HalfDCLK) tempbx++;
+ }
+ }
}
- if(SiS_IF_DEF_FSTN){
- if(SiS_LCDResInfo==Panel320x480){
- tempbx=22;
+ if(SiS_Pr->SiS_IF_DEF_FSTN){
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel320x480){
+ tempbx = 22;
}
}
*ResInfo = CRT2CRTC & 0x3F;
@@ -6779,79 +8655,72 @@ SiS_GetLVDSCRT1Ptr(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
return 1;
}
-/* TW: Checked against 650/LVDS (1.10a, 1.10.07), 630/301B (I/II) and 630/LVDS BIOS */
void
-SiS_SetCRT2ECLK(UCHAR *ROMAddr, USHORT ModeNo,USHORT ModeIdIndex,
+SiS_SetCRT2ECLK(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT ModeNo,USHORT ModeIdIndex,
USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
USHORT tempah,tempal,pushax;
USHORT vclkindex=0;
-
- if(HwDeviceExtension->jChipType < SIS_315H) {
- if(SiS_VBType & VB_SIS301BLV302BLV) {
- if(!(SiS_VBInfo & SetCRT2ToLCD)) return;
- }
- }
-
- if((SiS_LCDResInfo == Panel640x480) || (SiS_IF_DEF_TRUMPION == 1)) {
- SiS_SetFlag &= (~ProgrammingCRT2);
- tempal = SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
+
+ if((SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480) || (SiS_Pr->SiS_IF_DEF_TRUMPION == 1)) {
+ SiS_Pr->SiS_SetFlag &= (~ProgrammingCRT2);
+ tempal = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
tempal &= 0x3F;
if(tempal == 2) RefreshRateTableIndex--;
- vclkindex = SiS_GetVCLK2Ptr(ROMAddr,ModeNo,ModeIdIndex,
+ vclkindex = SiS_GetVCLK2Ptr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,
RefreshRateTableIndex,HwDeviceExtension);
- SiS_SetFlag |= ProgrammingCRT2;
+ SiS_Pr->SiS_SetFlag |= ProgrammingCRT2;
} else {
- vclkindex = SiS_GetVCLK2Ptr(ROMAddr,ModeNo,ModeIdIndex,
+ vclkindex = SiS_GetVCLK2Ptr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,
RefreshRateTableIndex,HwDeviceExtension);
}
-
+
tempal = 0x02B;
- if(!(SiS_VBInfo & SetCRT2ToLCDA)) {
- if(!(SiS_VBInfo & SetInSlaveMode)) {
+ if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) {
+ if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
tempal += 3;
}
}
- SiS_SetReg1(SiS_P3c4,0x05,0x86);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x05,0x86);
pushax = tempal;
- SiS_SetReg1(SiS_P3c4,0x31,0x20);
- tempah = SiS_VCLKData[vclkindex].SR2B;
- SiS_SetReg1(SiS_P3c4,tempal,tempah);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x31,0x20);
+ tempah = SiS_Pr->SiS_VCLKData[vclkindex].SR2B;
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,tempal,tempah);
tempal++;
- tempah = SiS_VCLKData[vclkindex].SR2C;
- SiS_SetReg1(SiS_P3c4,tempal,tempah);
- SiS_SetReg1(SiS_P3c4,0x31,0x10);
+ tempah = SiS_Pr->SiS_VCLKData[vclkindex].SR2C;
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,tempal,tempah);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x31,0x10);
tempal = pushax;
- tempah = SiS_VCLKData[vclkindex].SR2B;
- SiS_SetReg1(SiS_P3c4,tempal,tempah);
+ tempah = SiS_Pr->SiS_VCLKData[vclkindex].SR2B;
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,tempal,tempah);
tempal++;
- tempah = SiS_VCLKData[vclkindex].SR2C;
- SiS_SetReg1(SiS_P3c4,tempal,tempah);
- SiS_SetReg1(SiS_P3c4,0x31,0x00);
+ tempah = SiS_Pr->SiS_VCLKData[vclkindex].SR2C;
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,tempal,tempah);
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,0x31,0x00);
tempal = pushax;
- tempah = SiS_VCLKData[vclkindex].SR2B;
- SiS_SetReg1(SiS_P3c4,tempal,tempah);
+ tempah = SiS_Pr->SiS_VCLKData[vclkindex].SR2B;
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,tempal,tempah);
tempal++;
- tempah = SiS_VCLKData[vclkindex].SR2C;
- SiS_SetReg1(SiS_P3c4,tempal,tempah);
+ tempah = SiS_Pr->SiS_VCLKData[vclkindex].SR2C;
+ SiS_SetReg1(SiS_Pr->SiS_P3c4,tempal,tempah);
return;
}
#if 0 /* TW: Not used */
void
-SiS_SetDefCRT2ExtRegs(USHORT BaseAddr)
+SiS_SetDefCRT2ExtRegs(SiS_Private *SiS_Pr, USHORT BaseAddr)
{
USHORT temp;
- if(SiS_IF_DEF_LVDS==0) {
- SiS_SetReg1(SiS_Part1Port,0x02,0x40);
- SiS_SetReg1(SiS_Part4Port,0x10,0x80);
- temp=(UCHAR)SiS_GetReg1(SiS_P3c4,0x16);
+ if(SiS_Pr->SiS_IF_DEF_LVDS==0) {
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x02,0x40);
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x10,0x80);
+ temp=(UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16);
temp &= 0xC3;
- SiS_SetReg1(SiS_P3d4,0x35,temp);
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x35,temp);
} else {
- SiS_SetReg1(SiS_P3d4,0x32,0x02);
- SiS_SetReg1(SiS_Part1Port,0x02,0x00);
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x32,0x02);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x02,0x00);
}
}
#endif
@@ -6860,66 +8729,82 @@ SiS_SetDefCRT2ExtRegs(USHORT BaseAddr)
/* Set-up the Chrontel Registers */
void
-SiS_SetCHTVReg(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+SiS_SetCHTVReg(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
USHORT RefreshRateTableIndex)
{
- USHORT temp,tempbx,tempcl;
- USHORT TVType,resindex;
- SiS_CHTVRegDataStruct *CHTVRegData=NULL;
+ USHORT temp, tempbx, tempcl;
+ USHORT TVType, resindex;
+ const SiS_CHTVRegDataStruct *CHTVRegData = NULL;
- if(ModeNo<=0x13)
- tempcl = SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC;
+ if(ModeNo <= 0x13)
+ tempcl = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC;
else
- tempcl = SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
+ tempcl = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
TVType = 0;
- if(SiS_VBInfo & SetPALTV) TVType += 2;
- if(SiS_VBInfo & SetCHTVOverScan) TVType += 1;
+ if(SiS_Pr->SiS_VBInfo & SetCHTVOverScan) TVType += 1;
+ if(SiS_Pr->SiS_VBInfo & SetPALTV) {
+ TVType += 2;
+ if(SiS_Pr->SiS_CHSOverScan) TVType = 8;
+ if(SiS_Pr->SiS_CHPALM) {
+ TVType = 4;
+ if(SiS_Pr->SiS_VBInfo & SetCHTVOverScan) TVType += 1;
+ } else if(SiS_Pr->SiS_CHPALN) {
+ TVType = 6;
+ if(SiS_Pr->SiS_VBInfo & SetCHTVOverScan) TVType += 1;
+ }
+ }
switch(TVType) {
- case 0: CHTVRegData = SiS_CHTVReg_UNTSC; break;
- case 1: CHTVRegData = SiS_CHTVReg_ONTSC; break;
- case 2: CHTVRegData = SiS_CHTVReg_UPAL; break;
- case 3: CHTVRegData = SiS_CHTVReg_OPAL; break;
+ case 0: CHTVRegData = SiS_Pr->SiS_CHTVReg_UNTSC; break;
+ case 1: CHTVRegData = SiS_Pr->SiS_CHTVReg_ONTSC; break;
+ case 2: CHTVRegData = SiS_Pr->SiS_CHTVReg_UPAL; break;
+ case 3: CHTVRegData = SiS_Pr->SiS_CHTVReg_OPAL; break;
+ case 4: CHTVRegData = SiS_Pr->SiS_CHTVReg_UPALM; break;
+ case 5: CHTVRegData = SiS_Pr->SiS_CHTVReg_OPALM; break;
+ case 6: CHTVRegData = SiS_Pr->SiS_CHTVReg_UPALN; break;
+ case 7: CHTVRegData = SiS_Pr->SiS_CHTVReg_OPALN; break;
+ case 8: CHTVRegData = SiS_Pr->SiS_CHTVReg_SOPAL; break;
+ default: CHTVRegData = SiS_Pr->SiS_CHTVReg_OPAL; break;
}
resindex = tempcl & 0x3F;
- if(SiS_IF_DEF_CH70xx == 1) {
+ if(SiS_Pr->SiS_IF_DEF_CH70xx == 1) {
/* Chrontel 7005 */
/* TW: We don't support modes >800x600 */
if (resindex > 5) return;
- if(SiS_VBInfo & SetPALTV) {
- SiS_SetCH700x(0x4304); /* TW: 0x40=76uA (PAL); 0x03=15bit non-multi RGB*/
- SiS_SetCH700x(0x6909); /* TW: Black level for PAL (105)*/
+ if(SiS_Pr->SiS_VBInfo & SetPALTV) {
+ SiS_SetCH700x(SiS_Pr,0x4304); /* TW: 0x40=76uA (PAL); 0x03=15bit non-multi RGB*/
+ SiS_SetCH700x(SiS_Pr,0x6909); /* TW: Black level for PAL (105)*/
} else {
- SiS_SetCH700x(0x0304); /* TW: upper nibble=71uA (NTSC), 0x03=15bit non-multi RGB*/
- SiS_SetCH700x(0x7109); /* TW: Black level for NTSC (113)*/
+ SiS_SetCH700x(SiS_Pr,0x0304); /* TW: upper nibble=71uA (NTSC), 0x03=15bit non-multi RGB*/
+ SiS_SetCH700x(SiS_Pr,0x7109); /* TW: Black level for NTSC (113)*/
}
temp = CHTVRegData[resindex].Reg[0];
tempbx=((temp&0x00FF)<<8)|0x00; /* TW: Mode register */
- SiS_SetCH700x(tempbx);
+ SiS_SetCH700x(SiS_Pr,tempbx);
temp = CHTVRegData[resindex].Reg[1];
tempbx=((temp&0x00FF)<<8)|0x07; /* TW: Start active video register */
- SiS_SetCH700x(tempbx);
+ SiS_SetCH700x(SiS_Pr,tempbx);
temp = CHTVRegData[resindex].Reg[2];
tempbx=((temp&0x00FF)<<8)|0x08; /* TW: Position overflow register */
- SiS_SetCH700x(tempbx);
+ SiS_SetCH700x(SiS_Pr,tempbx);
temp = CHTVRegData[resindex].Reg[3];
tempbx=((temp&0x00FF)<<8)|0x0A; /* TW: Horiz Position register */
- SiS_SetCH700x(tempbx);
+ SiS_SetCH700x(SiS_Pr,tempbx);
temp = CHTVRegData[resindex].Reg[4];
tempbx=((temp&0x00FF)<<8)|0x0B; /* TW: Vertical Position register */
- SiS_SetCH700x(tempbx);
+ SiS_SetCH700x(SiS_Pr,tempbx);
/* TW: Set minimum flicker filter for Luma channel (SR1-0=00),
minimum text enhancement (S3-2=10),
maximum flicker filter for Chroma channel (S5-4=10)
=00101000=0x28 (When reading, S1-0->S3-2, and S3-2->S1-0!)
*/
- SiS_SetCH700x(0x2801);
+ SiS_SetCH700x(SiS_Pr,0x2801);
/* TW: Set video bandwidth
High bandwith Luma composite video filter(S0=1)
@@ -6928,74 +8813,73 @@ SiS_SetCHTVReg(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
high bandwidth Chroma Filter (S5-4=11)
=00110001=0x31
*/
- SiS_SetCH700x(0xb103); /* old: 3103 */
+ SiS_SetCH700x(SiS_Pr,0xb103); /* old: 3103 */
/* TW: Register 0x3D does not exist in non-macrovision register map
(Maybe this is a macrovision register?)
*/
- /* SiS_SetCH70xx(0x003D); */
+ /* SiS_SetCH70xx(SiS_Pr,0x003D); */
/* TW: Register 0x10 only contains 1 writable bit (S0) for sensing,
all other bits a read-only. Macrovision?
*/
- SiS_SetCH70xxANDOR(0x0010,0x1F);
+ SiS_SetCH70xxANDOR(SiS_Pr,0x0010,0x1F);
/* TW: Register 0x11 only contains 3 writable bits (S0-S2) for
- contrast enhancement (set to 010 -> gain 2 Yout = 9/8*(Yin-57) )
+ contrast enhancement (set to 010 -> gain 1 Yout = 17/16*(Yin-30) )
*/
- SiS_SetCH70xxANDOR(0x0211,0xF8);
+ SiS_SetCH70xxANDOR(SiS_Pr,0x0211,0xF8);
/* TW: Clear DSEN
*/
- SiS_SetCH70xxANDOR(0x001C,0xEF);
-
- if(!(SiS_VBInfo&SetPALTV)) { /* ---- NTSC ---- */
- tempcl=tempcl&0x3F;
- if(SiS_VBInfo&SetCHTVOverScan) {
- if(tempcl==0x04) { /* 640x480 overscan: Mode 16 */
- SiS_SetCH70xxANDOR(0x0020,0xEF); /* loop filter off */
- SiS_SetCH70xxANDOR(0x0121,0xFE); /* ACIV on, no need to set FSCI */
+ SiS_SetCH70xxANDOR(SiS_Pr,0x001C,0xEF);
+
+ if(!(SiS_Pr->SiS_VBInfo & SetPALTV)) { /* ---- NTSC ---- */
+ if(SiS_Pr->SiS_VBInfo & SetCHTVOverScan) {
+ if(resindex == 0x04) { /* 640x480 overscan: Mode 16 */
+ SiS_SetCH70xxANDOR(SiS_Pr,0x0020,0xEF); /* loop filter off */
+ SiS_SetCH70xxANDOR(SiS_Pr,0x0121,0xFE); /* ACIV on, no need to set FSCI */
} else {
- if(tempcl==0x05) { /* 800x600 overscan: Mode 23 */
- SiS_SetCH70xxANDOR(0x0118,0xF0); /* 0x18-0x1f: FSCI 469,762,048 */
- SiS_SetCH70xxANDOR(0x0C19,0xF0);
- SiS_SetCH70xxANDOR(0x001A,0xF0);
- SiS_SetCH70xxANDOR(0x001B,0xF0);
- SiS_SetCH70xxANDOR(0x001C,0xF0);
- SiS_SetCH70xxANDOR(0x001D,0xF0);
- SiS_SetCH70xxANDOR(0x001E,0xF0);
- SiS_SetCH70xxANDOR(0x001F,0xF0);
- SiS_SetCH70xxANDOR(0x1020,0xEF); /* Loop filter on for mode 23 */
- SiS_SetCH70xxANDOR(0x0021,0xFE); /* ACIV off, need to set FSCI */
+ if(resindex == 0x05) { /* 800x600 overscan: Mode 23 */
+ SiS_SetCH70xxANDOR(SiS_Pr,0x0118,0xF0); /* 0x18-0x1f: FSCI 469,762,048 */
+ SiS_SetCH70xxANDOR(SiS_Pr,0x0C19,0xF0);
+ SiS_SetCH70xxANDOR(SiS_Pr,0x001A,0xF0);
+ SiS_SetCH70xxANDOR(SiS_Pr,0x001B,0xF0);
+ SiS_SetCH70xxANDOR(SiS_Pr,0x001C,0xF0);
+ SiS_SetCH70xxANDOR(SiS_Pr,0x001D,0xF0);
+ SiS_SetCH70xxANDOR(SiS_Pr,0x001E,0xF0);
+ SiS_SetCH70xxANDOR(SiS_Pr,0x001F,0xF0);
+ SiS_SetCH70xxANDOR(SiS_Pr,0x0120,0xEF); /* Loop filter on for mode 23 */
+ SiS_SetCH70xxANDOR(SiS_Pr,0x0021,0xFE); /* ACIV off, need to set FSCI */
}
}
} else {
- if(tempcl==0x04) { /* ----- 640x480 underscan; Mode 17 */
- SiS_SetCH70xxANDOR(0x0020,0xEF); /* loop filter off */
- SiS_SetCH70xxANDOR(0x0121,0xFE);
+ if(resindex == 0x04) { /* ----- 640x480 underscan; Mode 17 */
+ SiS_SetCH70xxANDOR(SiS_Pr,0x0020,0xEF); /* loop filter off */
+ SiS_SetCH70xxANDOR(SiS_Pr,0x0121,0xFE);
} else {
- if(tempcl==0x05) { /* ----- 800x600 underscan: Mode 24 */
- SiS_SetCH70xxANDOR(0x0118,0xF0); /* (FSCI was 0x1f1c71c7 - this is for mode 22) */
- SiS_SetCH70xxANDOR(0x0919,0xF0); /* FSCI for mode 24 is 428,554,851 */
- SiS_SetCH70xxANDOR(0x081A,0xF0);
- SiS_SetCH70xxANDOR(0x0b1B,0xF0);
- SiS_SetCH70xxANDOR(0x031C,0xF0);
- SiS_SetCH70xxANDOR(0x0a1D,0xF0);
- SiS_SetCH70xxANDOR(0x061E,0xF0);
- SiS_SetCH70xxANDOR(0x031F,0xF0);
- SiS_SetCH70xxANDOR(0x0020,0xEF); /* loop filter off for mode 24 */
- SiS_SetCH70xxANDOR(0x0021,0xFE); /* ACIV off, need to set FSCI */
+ if(resindex == 0x05) { /* ----- 800x600 underscan: Mode 24 */
+ SiS_SetCH70xxANDOR(SiS_Pr,0x0118,0xF0); /* (FSCI was 0x1f1c71c7 - this is for mode 22) */
+ SiS_SetCH70xxANDOR(SiS_Pr,0x0919,0xF0); /* FSCI for mode 24 is 428,554,851 */
+ SiS_SetCH70xxANDOR(SiS_Pr,0x081A,0xF0);
+ SiS_SetCH70xxANDOR(SiS_Pr,0x0b1B,0xF0);
+ SiS_SetCH70xxANDOR(SiS_Pr,0x031C,0xF0);
+ SiS_SetCH70xxANDOR(SiS_Pr,0x0a1D,0xF0);
+ SiS_SetCH70xxANDOR(SiS_Pr,0x061E,0xF0);
+ SiS_SetCH70xxANDOR(SiS_Pr,0x031F,0xF0);
+ SiS_SetCH70xxANDOR(SiS_Pr,0x0020,0xEF); /* loop filter off for mode 24 */
+ SiS_SetCH70xxANDOR(SiS_Pr,0x0021,0xFE); /* ACIV off, need to set FSCI */
}
}
}
} else { /* ---- PAL ---- */
/* TW: We don't play around with FSCI in PAL mode */
- if (tempcl==0x04) {
- SiS_SetCH70xxANDOR(0x0020,0xEF); /* loop filter off */
- SiS_SetCH70xxANDOR(0x0121,0xFE); /* ACIV on */
+ if (resindex == 0x04) {
+ SiS_SetCH70xxANDOR(SiS_Pr,0x0020,0xEF); /* loop filter off */
+ SiS_SetCH70xxANDOR(SiS_Pr,0x0121,0xFE); /* ACIV on */
} else {
- SiS_SetCH70xxANDOR(0x0020,0xEF); /* loop filter off */
- SiS_SetCH70xxANDOR(0x0121,0xFE); /* ACIV on */
+ SiS_SetCH70xxANDOR(SiS_Pr,0x0020,0xEF); /* loop filter off */
+ SiS_SetCH70xxANDOR(SiS_Pr,0x0121,0xFE); /* ACIV on */
}
}
@@ -7008,395 +8892,405 @@ SiS_SetCHTVReg(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
temp = CHTVRegData[resindex].Reg[0];
tempbx=((temp & 0x00FF) <<8 ) | 0x00;
- SiS_SetCH701x(tempbx);
+ SiS_SetCH701x(SiS_Pr,tempbx);
temp = CHTVRegData[resindex].Reg[1];
tempbx=((temp & 0x00FF) <<8 ) | 0x01;
- SiS_SetCH701x(tempbx);
+ SiS_SetCH701x(SiS_Pr,tempbx);
temp = CHTVRegData[resindex].Reg[2];
tempbx=((temp & 0x00FF) <<8 ) | 0x02;
- SiS_SetCH701x(tempbx);
+ SiS_SetCH701x(SiS_Pr,tempbx);
temp = CHTVRegData[resindex].Reg[3];
tempbx=((temp & 0x00FF) <<8 ) | 0x04;
- SiS_SetCH701x(tempbx);
+ SiS_SetCH701x(SiS_Pr,tempbx);
temp = CHTVRegData[resindex].Reg[4];
tempbx=((temp & 0x00FF) <<8 ) | 0x03;
- SiS_SetCH701x(tempbx);
+ SiS_SetCH701x(SiS_Pr,tempbx);
temp = CHTVRegData[resindex].Reg[5];
tempbx=((temp & 0x00FF) <<8 ) | 0x05;
- SiS_SetCH701x(tempbx);
+ SiS_SetCH701x(SiS_Pr,tempbx);
temp = CHTVRegData[resindex].Reg[6];
tempbx=((temp & 0x00FF) <<8 ) | 0x06;
- SiS_SetCH701x(tempbx);
+ SiS_SetCH701x(SiS_Pr,tempbx);
temp = CHTVRegData[resindex].Reg[7];
tempbx=((temp & 0x00FF) <<8 ) | 0x07;
- SiS_SetCH701x(tempbx);
+ SiS_SetCH701x(SiS_Pr,tempbx);
temp = CHTVRegData[resindex].Reg[8];
tempbx=((temp & 0x00FF) <<8 ) | 0x08;
- SiS_SetCH701x(tempbx);
+ SiS_SetCH701x(SiS_Pr,tempbx);
temp = CHTVRegData[resindex].Reg[9];
tempbx=((temp & 0x00FF) <<8 ) | 0x15;
- SiS_SetCH701x(tempbx);
+ SiS_SetCH701x(SiS_Pr,tempbx);
temp = CHTVRegData[resindex].Reg[10];
tempbx=((temp & 0x00FF) <<8 ) | 0x1f;
- SiS_SetCH701x(tempbx);
+ SiS_SetCH701x(SiS_Pr,tempbx);
temp = CHTVRegData[resindex].Reg[11];
tempbx=((temp & 0x00FF) <<8 ) | 0x0c;
- SiS_SetCH701x(tempbx);
+ SiS_SetCH701x(SiS_Pr,tempbx);
temp = CHTVRegData[resindex].Reg[12];
tempbx=((temp & 0x00FF) <<8 ) | 0x0d;
- SiS_SetCH701x(tempbx);
+ SiS_SetCH701x(SiS_Pr,tempbx);
temp = CHTVRegData[resindex].Reg[13];
tempbx=((temp & 0x00FF) <<8 ) | 0x0e;
- SiS_SetCH701x(tempbx);
+ SiS_SetCH701x(SiS_Pr,tempbx);
temp = CHTVRegData[resindex].Reg[14];
tempbx=((temp & 0x00FF) <<8 ) | 0x0f;
- SiS_SetCH701x(tempbx);
+ SiS_SetCH701x(SiS_Pr,tempbx);
temp = CHTVRegData[resindex].Reg[15];
tempbx=((temp & 0x00FF) <<8 ) | 0x10;
- SiS_SetCH701x(tempbx);
+ SiS_SetCH701x(SiS_Pr,tempbx);
-#if 0 /* TW: Not done in BIOS 1.10.07 */
- SiS_SetCH701x(0x3848);
- SiS_DDC2Delay(SiS_I2CDELAYSHORT * 2);
- SiS_SetCH701x(0x1848);
-#endif
}
}
+/* TW: Chrontel 701x functions ================================= */
+
void
-SiS_SetCHTVForLCD(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr)
+SiS_SetCH701xForLCD(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr)
{
UCHAR regtable[] = { 0x1c, 0x5f, 0x64, 0x6f, 0x70, 0x71,
0x72, 0x73, 0x74, 0x76, 0x78, 0x7d };
- UCHAR table28b4[] = { 0x60, 0x02, 0x00, 0x07, 0x40, 0xed,
+ UCHAR table1024[] = { 0x60, 0x02, 0x00, 0x07, 0x40, 0xed,
0xa3, 0xc8, 0xc7, 0xac, 0x60, 0x02 };
- UCHAR table28c0[] = { 0x60, 0x03, 0x11, 0x00, 0x40, 0xef,
+ UCHAR table1400[] = { 0x60, 0x03, 0x11, 0x00, 0x40, 0xef,
0xad, 0xdb, 0xf6, 0xac, 0x60, 0x02 };
UCHAR *tableptr = NULL;
USHORT tempbh;
int i;
- if(SiS_LCDResInfo == Panel1400x1050) {
- tableptr = table28c0;
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) {
+ tableptr = table1400;
} else {
- tableptr = table28b4;
+ tableptr = table1024;
}
- tempbh = SiS_GetCH701x(0x74);
+ tempbh = SiS_GetCH701x(SiS_Pr,0x74);
if((tempbh == 0xf6) || (tempbh == 0xc7)) {
- tempbh = SiS_GetCH701x(0x73);
+ tempbh = SiS_GetCH701x(SiS_Pr,0x73);
if(tempbh == 0xc8) {
- if(SiS_LCDResInfo != Panel1400x1050) return;
+ if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1400x1050) return;
} else if(tempbh == 0xdb) {
- if(SiS_LCDResInfo == Panel1400x1050) return;
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) return;
}
}
for(i=0; i<0x0c; i++) {
- SiS_SetCH701x((tableptr[i] << 8) | regtable[i]);
+ SiS_SetCH701x(SiS_Pr,(tableptr[i] << 8) | regtable[i]);
}
- SiS_Chrontel19f2();
- tempbh = SiS_GetCH701x(0x1e); /* TW: NEW in BIOS 1.10.07 */
- tempbh |= 0xc0; /* TW: NEW in BIOS 1.10.07 */
- SiS_SetCH701x((tempbh << 8) | 0x1e); /* TW: NEW in BIOS 1.10.07 */
+ SiS_ChrontelPowerSequencing(SiS_Pr);
+ tempbh = SiS_GetCH701x(SiS_Pr,0x1e);
+ tempbh |= 0xc0;
+ SiS_SetCH701x(SiS_Pr,(tempbh << 8) | 0x1e);
}
-/* TW: Chrontel 701x functions ================================= */
-
void
-SiS_Chrontel19f2(void)
+SiS_ChrontelPowerSequencing(SiS_Private *SiS_Pr)
{
UCHAR regtable[] = { 0x67, 0x68, 0x69, 0x6a, 0x6b };
- UCHAR table19e8[] = { 0x01, 0x02, 0x01, 0x01, 0x02 };
- UCHAR table19ed[] = { 0x01, 0x02, 0x01, 0x01, 0x02 };
+ UCHAR table1024[] = { 0x01, 0x02, 0x01, 0x01, 0x02 };
+ UCHAR table1400[] = { 0x01, 0x02, 0x01, 0x01, 0x02 };
UCHAR *tableptr = NULL;
int i;
- if(SiS_LCDResInfo == Panel1400x1050) {
- tableptr = table19ed;
+ /* Set up Power up/down timing */
+
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) {
+ tableptr = table1400;
} else {
- tableptr = table19e8;
+ tableptr = table1024;
}
for(i=0; i<5; i++) {
- SiS_SetCH701x((tableptr[i] << 8) | regtable[i]);
+ SiS_SetCH701x(SiS_Pr,(tableptr[i] << 8) | regtable[i]);
}
}
void
-SiS_Chrontel701xOn()
+SiS_Chrontel701xBLOn(SiS_Private *SiS_Pr)
{
USHORT temp;
- if(SiS_IF_DEF_CH70xx == 2) {
- temp = SiS_GetCH701x(0x66);
+ /* TW: Enable Chrontel 7019 LCD panel backlight */
+ if(SiS_Pr->SiS_IF_DEF_CH70xx == 2) {
+ temp = SiS_GetCH701x(SiS_Pr,0x66);
temp |= 0x20;
- SiS_SetCH701x((temp << 8) | 0x66);
+ SiS_SetCH701x(SiS_Pr,(temp << 8) | 0x66);
}
}
void
-SiS_Chrontel701xOn2(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr)
+SiS_Chrontel701xOn(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr)
{
USHORT temp;
- if(SiS_IF_DEF_CH70xx == 2) {
- if(SiS_IsYPbPr(HwDeviceExtension, BaseAddr)) {
- temp = SiS_GetCH701x(0x01);
+ if(SiS_Pr->SiS_IF_DEF_CH70xx == 2) {
+ if(SiS_IsYPbPr(SiS_Pr,HwDeviceExtension, BaseAddr)) {
+ temp = SiS_GetCH701x(SiS_Pr,0x01);
temp &= 0x3f;
- temp |= 0x80;
- SiS_SetCH701x((temp << 8) | 0x01);
+ temp |= 0x80; /* TW: Enable YPrPb (HDTV) */
+ SiS_SetCH701x(SiS_Pr,(temp << 8) | 0x01);
+ }
+ if(SiS_IsChScart(SiS_Pr,HwDeviceExtension, BaseAddr)) {
+ temp = SiS_GetCH701x(SiS_Pr,0x01);
+ temp &= 0x3f;
+ temp |= 0xc0; /* TW: Enable SCART + CVBS */
+ SiS_SetCH701x(SiS_Pr,(temp << 8) | 0x01);
}
- SiS_SetCH701x(0x2049);
- temp = SiS_GetCH701x(0x49);
- if(SiS_IsYPbPr(HwDeviceExtension, BaseAddr)) {
- temp = SiS_GetCH701x(0x73);
+ SiS_SetCH701x(SiS_Pr,0x2049); /* TW: Enable TV path */
+ temp = SiS_GetCH701x(SiS_Pr,0x49);
+ if(SiS_IsYPbPr(SiS_Pr,HwDeviceExtension, BaseAddr)) {
+ temp = SiS_GetCH701x(SiS_Pr,0x73);
temp |= 0x60;
- SiS_SetCH701x((temp << 8) | 0x73);
+ SiS_SetCH701x(SiS_Pr,(temp << 8) | 0x73);
}
- /* TW: New from BIOS 1.10.07: */
- temp = SiS_GetCH701x(0x47);
+ temp = SiS_GetCH701x(SiS_Pr,0x47);
temp &= 0x7f;
- SiS_SetCH701x((temp << 8) | 0x47);
- SiS_LongDelay(2);
- temp = SiS_GetCH701x(0x47);
+ SiS_SetCH701x(SiS_Pr,(temp << 8) | 0x47);
+ SiS_LongDelay(SiS_Pr,2);
+ temp = SiS_GetCH701x(SiS_Pr,0x47);
temp |= 0x80;
- SiS_SetCH701x((temp << 8) | 0x47);
+ SiS_SetCH701x(SiS_Pr,(temp << 8) | 0x47);
}
}
void
-SiS_Chrontel701xOff()
+SiS_Chrontel701xBLOff(SiS_Private *SiS_Pr)
{
USHORT temp;
- if(SiS_IF_DEF_CH70xx == 2) {
- temp = SiS_GetCH701x(0x66);
+ /* TW: Disable Chrontel 7019 LCD panel backlight */
+ if(SiS_Pr->SiS_IF_DEF_CH70xx == 2) {
+ temp = SiS_GetCH701x(SiS_Pr,0x66);
temp &= 0xDF;
- SiS_SetCH701x((temp << 8) | 0x66);
+ SiS_SetCH701x(SiS_Pr,(temp << 8) | 0x66);
}
}
void
-SiS_Chrontel701xOff2()
+SiS_Chrontel701xOff(SiS_Private *SiS_Pr)
{
USHORT temp;
- if(SiS_IF_DEF_CH70xx == 2) {
- SiS_LongDelay(2);
- temp = SiS_GetCH701x(0x76);
+ if(SiS_Pr->SiS_IF_DEF_CH70xx == 2) {
+ SiS_LongDelay(SiS_Pr,2);
+ /* TW: Complete power down of LVDS */
+ temp = SiS_GetCH701x(SiS_Pr,0x76);
temp &= 0xfc;
- SiS_SetCH701x((temp << 8) | 0x76);
- SiS_SetCH701x(0x0066);
+ SiS_SetCH701x(SiS_Pr,(temp << 8) | 0x76);
+ SiS_SetCH701x(SiS_Pr,0x0066);
}
}
void
-SiS_ChrontelFlip0x48()
+SiS_ChrontelResetDB(SiS_Private *SiS_Pr)
{
- SiS_SetCH701x(0x1048);
- SiS_LongDelay(1);
- SiS_SetCH701x(0x1848);
+ /* TW: Reset Chrontel 7019 datapath */
+ SiS_SetCH701x(SiS_Pr,0x1048);
+ SiS_LongDelay(SiS_Pr,1);
+ SiS_SetCH701x(SiS_Pr,0x1848);
}
void
-SiS_ChrontelDoSomething4(PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr)
+SiS_ChrontelDoSomething4(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr)
{
USHORT temp;
- SiS_SetCH701x(0xaf76);
- temp = SiS_GetCH701x(0x49);
+ SiS_SetCH701x(SiS_Pr,0xaf76); /* Power up LVDS block */
+ temp = SiS_GetCH701x(SiS_Pr,0x49);
temp &= 1;
- if(temp != 1) {
- temp = SiS_GetCH701x(0x47);
+ if(temp != 1) { /* TV block powered? (0 = yes, 1 = no) */
+ temp = SiS_GetCH701x(SiS_Pr,0x47);
temp &= 0x70;
- SiS_SetCH701x((temp << 8) | 0x47);
- SiS_LongDelay(3);
- temp = SiS_GetCH701x(0x47);
+ SiS_SetCH701x(SiS_Pr,(temp << 8) | 0x47); /* enable VSYNC */
+ SiS_LongDelay(SiS_Pr,3);
+ temp = SiS_GetCH701x(SiS_Pr,0x47);
temp |= 0x80;
- SiS_SetCH701x((temp << 8) | 0x47);
+ SiS_SetCH701x(SiS_Pr,(temp << 8) | 0x47); /* disable VSYNC */
}
}
void
-SiS_ChrontelDoSomething3(USHORT ModeNo,PSIS_HW_DEVICE_INFO HwDeviceExtension,
+SiS_ChrontelDoSomething3(SiS_Private *SiS_Pr, USHORT ModeNo, PSIS_HW_DEVICE_INFO HwDeviceExtension,
USHORT BaseAddr)
{
USHORT temp,temp1;
temp1 = 0;
- temp = SiS_GetCH701x(0x61);
+ temp = SiS_GetCH701x(SiS_Pr,0x61);
if(temp < 2) {
temp++;
- SiS_SetCH701x((temp << 8) | 0x61);
+ SiS_SetCH701x(SiS_Pr,(temp << 8) | 0x61);
temp1 = 1;
}
- SiS_SetCH701x(0xac76);
- temp = SiS_GetCH701x(0x66);
+ SiS_SetCH701x(SiS_Pr,0xac76);
+ temp = SiS_GetCH701x(SiS_Pr,0x66);
temp |= 0x5f;
- SiS_SetCH701x((temp << 8) | 0x66);
+ SiS_SetCH701x(SiS_Pr,(temp << 8) | 0x66);
if(ModeNo > 0x13) {
- if(SiS_WeHaveBacklightCtrl(HwDeviceExtension, BaseAddr)) {
- SiS_GenericDelay(0x3ff);
+ if(SiS_WeHaveBacklightCtrl(SiS_Pr,HwDeviceExtension, BaseAddr)) {
+ SiS_GenericDelay(SiS_Pr,0x3ff);
} else {
- SiS_GenericDelay(0x2ff);
+ SiS_GenericDelay(SiS_Pr,0x2ff);
}
} else {
if(!temp1)
- SiS_GenericDelay(0x2ff);
+ SiS_GenericDelay(SiS_Pr,0x2ff);
}
- temp = SiS_GetCH701x(0x76);
+ temp = SiS_GetCH701x(SiS_Pr,0x76);
temp |= 0x03;
- SiS_SetCH701x((temp << 8) | 0x76);
- temp = SiS_GetCH701x(0x66);
+ SiS_SetCH701x(SiS_Pr,(temp << 8) | 0x76);
+ temp = SiS_GetCH701x(SiS_Pr,0x66);
temp &= 0x7f;
- SiS_SetCH701x((temp << 8) | 0x66);
- SiS_LongDelay(1);
+ SiS_SetCH701x(SiS_Pr,(temp << 8) | 0x66);
+ SiS_LongDelay(SiS_Pr,1);
}
void
-SiS_ChrontelDoSomething2(PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr)
+SiS_ChrontelDoSomething2(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr)
{
USHORT temp,tempcl,tempch;
- SiS_LongDelay(1);
+ SiS_LongDelay(SiS_Pr, 1);
tempcl = 3;
tempch = 0;
do {
- temp = SiS_GetCH701x(0x66);
+ temp = SiS_GetCH701x(SiS_Pr,0x66);
temp &= 0x04;
if(temp == 0x04) break;
- SiS_SetCHTVForLCD(HwDeviceExtension, BaseAddr);
+ SiS_SetCH701xForLCD(SiS_Pr,HwDeviceExtension,BaseAddr);
if(tempcl == 0) {
if(tempch == 3) break;
- SiS_ChrontelFlip0x48();
+ SiS_ChrontelResetDB(SiS_Pr);
tempcl = 3;
tempch++;
}
tempcl--;
- temp = SiS_GetCH701x(0x76);
+ temp = SiS_GetCH701x(SiS_Pr,0x76);
temp &= 0xfb;
- SiS_SetCH701x((temp << 8) | 0x76);
- SiS_LongDelay(2);
- temp = SiS_GetCH701x(0x76);
+ SiS_SetCH701x(SiS_Pr,(temp << 8) | 0x76);
+ SiS_LongDelay(SiS_Pr,2);
+ temp = SiS_GetCH701x(SiS_Pr,0x76);
temp |= 0x04;
- SiS_SetCH701x((temp << 8) | 0x76);
- SiS_SetCH701x(0x6078);
- SiS_LongDelay(2);
+ SiS_SetCH701x(SiS_Pr,(temp << 8) | 0x76);
+ SiS_SetCH701x(SiS_Pr,0x6078);
+ SiS_LongDelay(SiS_Pr,2);
} while(0);
- SiS_SetCH701x(0x0077);
+ SiS_SetCH701x(SiS_Pr,0x0077);
}
void
-SiS_ChrontelDoSomething1(PSIS_HW_DEVICE_INFO HwDeviceExtension,
+SiS_ChrontelDoSomething1(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,
USHORT BaseAddr)
{
USHORT temp;
- temp = SiS_GetCH701x(0x03);
- temp |= 0x80;
- temp &= 0xbf;
- SiS_SetCH701x((temp << 8) | 0x03);
+ temp = SiS_GetCH701x(SiS_Pr,0x03);
+ temp |= 0x80; /* Set datapath 1 to TV */
+ temp &= 0xbf; /* Set datapath 2 to LVDS */
+ SiS_SetCH701x(SiS_Pr,(temp << 8) | 0x03);
- SiS_ChrontelFlip0x48();
+ SiS_ChrontelResetDB(SiS_Pr);
- SiS_ChrontelDoSomething2(HwDeviceExtension, BaseAddr);
-
- temp = SiS_GetReg1(SiS_P3d4,0x34);
- SiS_ChrontelDoSomething3(temp, HwDeviceExtension, BaseAddr);
+ SiS_ChrontelDoSomething2(SiS_Pr,HwDeviceExtension,BaseAddr);
+
+ temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x34);
+ SiS_ChrontelDoSomething3(SiS_Pr,temp,HwDeviceExtension,BaseAddr);
- SiS_SetCH701x(0xaf76);
+ SiS_SetCH701x(SiS_Pr,0xaf76);
}
/* TW: End of Chrontel 701x functions ==================================== */
/* TW: Generic Read/write routines for Chrontel ========================== */
-/* The Chrontel seems to be connected to the 630/730 via
- * the 630/730's DDC port (which is used as a I2C port here).
+/* TW: The Chrontel is connected to the 630/730 via
+ * the 630/730's DDC/I2C port.
*
- * On 630(S)T chipset, the port changed from 0x11 to 0x0a
+ * On 630(S)T chipset, the index changed from 0x11 to 0x0a,
+ * possibly for working around the DDC problems
*/
void
-SiS_SetCH70xx(USHORT tempbx)
+SiS_SetCH70xx(SiS_Private *SiS_Pr, USHORT tempbx)
{
- if (SiS_IF_DEF_CH70xx == 1)
- SiS_SetCH700x(tempbx);
+ if (SiS_Pr->SiS_IF_DEF_CH70xx == 1)
+ SiS_SetCH700x(SiS_Pr,tempbx);
else
- SiS_SetCH701x(tempbx);
+ SiS_SetCH701x(SiS_Pr,tempbx);
}
/* TW: Write to Chrontel 700x */
/* Parameter is [Data (S15-S8) | Register no (S7-S0)] */
void
-SiS_SetCH700x(USHORT tempbx)
+SiS_SetCH700x(SiS_Private *SiS_Pr, USHORT tempbx)
{
USHORT tempah,temp,i;
- if(!(SiS_ChrontelInit)) {
- SiS_DDC_Index = 0x11; /* TW: Bit 0 = SC; Bit 1 = SD */
- SiS_DDC_Data = 0x02; /* Bitmask in IndexReg for Data */
- SiS_DDC_Clk = 0x01; /* Bitmask in IndexReg for Clk */
- SiS_DDC_DataShift = 0x00;
- SiS_DDC_DeviceAddr = 0xEA; /* TW: DAB (Device Address Byte) */
+ if(!(SiS_Pr->SiS_ChrontelInit)) {
+ SiS_Pr->SiS_DDC_Index = 0x11; /* TW: Bit 0 = SC; Bit 1 = SD */
+ SiS_Pr->SiS_DDC_Data = 0x02; /* Bitmask in IndexReg for Data */
+ SiS_Pr->SiS_DDC_Clk = 0x01; /* Bitmask in IndexReg for Clk */
+ SiS_Pr->SiS_DDC_DataShift = 0x00;
+ SiS_Pr->SiS_DDC_DeviceAddr = 0xEA; /* TW: DAB (Device Address Byte) */
}
for(i=0;i<10;i++) { /* TW: Do only 10 attempts to write */
- SiS_SetSwitchDDC2();
- if (SiS_SetStart()) continue; /* TW: Set start condition */
- tempah=SiS_DDC_DeviceAddr;
- temp=SiS_WriteDDC2Data(tempah); /* TW: Write DAB (S0=0=write) */
- if(temp) continue; /* TW: (ERROR: no ack) */
- tempah=tempbx&0x00FF;
- temp=SiS_WriteDDC2Data(tempah); /* TW: Write RAB */
- if(temp) continue; /* TW: (ERROR: no ack) */
- tempah=(tempbx&0xFF00)>>8;
- temp=SiS_WriteDDC2Data(tempah); /* TW: Write data */
- if(temp) continue; /* TW: (ERROR: no ack) */
- if (SiS_SetStop()) continue; /* TW: Set stop condition */
- SiS_ChrontelInit = 1;
+ /* SiS_SetSwitchDDC2(SiS_Pr); */
+ if(SiS_SetStart(SiS_Pr)) continue; /* TW: Set start condition */
+ tempah = SiS_Pr->SiS_DDC_DeviceAddr;
+ temp = SiS_WriteDDC2Data(SiS_Pr,tempah); /* TW: Write DAB (S0=0=write) */
+ if(temp) continue; /* TW: (ERROR: no ack) */
+ tempah = tempbx & 0x00FF; /* TW: Write RAB */
+ tempah |= 0x80; /* TW: (set bit 7, see datasheet) */
+ temp = SiS_WriteDDC2Data(SiS_Pr,tempah);
+ if(temp) continue; /* TW: (ERROR: no ack) */
+ tempah = (tempbx & 0xFF00) >> 8;
+ temp = SiS_WriteDDC2Data(SiS_Pr,tempah); /* TW: Write data */
+ if(temp) continue; /* TW: (ERROR: no ack) */
+ if(SiS_SetStop(SiS_Pr)) continue; /* TW: Set stop condition */
+ SiS_Pr->SiS_ChrontelInit = 1;
return;
}
- if(!(SiS_ChrontelInit)) {
- SiS_DDC_Index = 0x0a; /* TW: Bit 0 = SC; Bit 1 = SD */
- SiS_DDC_Data = 0x80; /* Bitmask in IndexReg for Data */
- SiS_DDC_Clk = 0x40; /* Bitmask in IndexReg for Clk */
- SiS_DDC_DataShift = 0x00;
- SiS_DDC_DeviceAddr = 0xEA; /* TW: DAB (Device Address Byte) */
+ /* TW: For 630ST */
+ if(!(SiS_Pr->SiS_ChrontelInit)) {
+ SiS_Pr->SiS_DDC_Index = 0x0a; /* TW: Bit 7 = SC; Bit 6 = SD */
+ SiS_Pr->SiS_DDC_Data = 0x80; /* Bitmask in IndexReg for Data */
+ SiS_Pr->SiS_DDC_Clk = 0x40; /* Bitmask in IndexReg for Clk */
+ SiS_Pr->SiS_DDC_DataShift = 0x00;
+ SiS_Pr->SiS_DDC_DeviceAddr = 0xEA; /* TW: DAB (Device Address Byte) */
for(i=0;i<10;i++) { /* TW: Do only 10 attempts to write */
- SiS_SetSwitchDDC2();
- if (SiS_SetStart()) continue; /* TW: Set start condition */
- tempah=SiS_DDC_DeviceAddr;
- temp=SiS_WriteDDC2Data(tempah); /* TW: Write DAB (S0=0=write) */
+ /* SiS_SetSwitchDDC2(SiS_Pr); */
+ if (SiS_SetStart(SiS_Pr)) continue; /* TW: Set start condition */
+ tempah = SiS_Pr->SiS_DDC_DeviceAddr;
+ temp = SiS_WriteDDC2Data(SiS_Pr,tempah); /* TW: Write DAB (S0=0=write) */
if(temp) continue; /* TW: (ERROR: no ack) */
- tempah=tempbx&0x00FF;
- temp=SiS_WriteDDC2Data(tempah); /* TW: Write RAB */
+ tempah = tempbx & 0x00FF; /* TW: Write RAB */
+ tempah |= 0x80; /* TW: (set bit 7, see datasheet) */
+ temp = SiS_WriteDDC2Data(SiS_Pr,tempah);
if(temp) continue; /* TW: (ERROR: no ack) */
- tempah=(tempbx&0xFF00)>>8;
- temp=SiS_WriteDDC2Data(tempah); /* TW: Write data */
+ tempah = (tempbx & 0xFF00) >> 8;
+ temp = SiS_WriteDDC2Data(SiS_Pr,tempah); /* TW: Write data */
if(temp) continue; /* TW: (ERROR: no ack) */
- if (SiS_SetStop()) continue; /* TW: Set stop condition */
- SiS_ChrontelInit = 1;
+ if(SiS_SetStop(SiS_Pr)) continue; /* TW: Set stop condition */
+ SiS_Pr->SiS_ChrontelInit = 1;
return;
}
}
@@ -7405,31 +9299,28 @@ SiS_SetCH700x(USHORT tempbx)
/* TW: Write to Chrontel 701x */
/* Parameter is [Data (S15-S8) | Register no (S7-S0)] */
void
-SiS_SetCH701x(USHORT tempbx)
+SiS_SetCH701x(SiS_Private *SiS_Pr, USHORT tempbx)
{
USHORT tempah,temp,i;
- /* TW: Toggle to DDC port */
- SiS_SetRegOR(SiS_P3c4,0x38,0x20);
-
- SiS_DDC_Index = 0x11; /* TW: Bit 0 = SC; Bit 1 = SD */
- SiS_DDC_Data = 0x08; /* Bitmask in IndexReg for Data */
- SiS_DDC_Clk = 0x04; /* Bitmask in IndexReg for Clk */
- SiS_DDC_DataShift = 0x00;
- SiS_DDC_DeviceAddr = 0xEA; /* TW: DAB (Device Address Byte) */
+ SiS_Pr->SiS_DDC_Index = 0x11; /* TW: Bit 0 = SC; Bit 1 = SD */
+ SiS_Pr->SiS_DDC_Data = 0x08; /* Bitmask in IndexReg for Data */
+ SiS_Pr->SiS_DDC_Clk = 0x04; /* Bitmask in IndexReg for Clk */
+ SiS_Pr->SiS_DDC_DataShift = 0x00;
+ SiS_Pr->SiS_DDC_DeviceAddr = 0xEA; /* TW: DAB (Device Address Byte) */
for(i=0;i<10;i++) { /* TW: Do only 10 attempts to write */
- if (SiS_SetStart()) continue; /* TW: Set start condition */
- tempah=SiS_DDC_DeviceAddr;
- temp=SiS_WriteDDC2Data(tempah); /* TW: Write DAB (S0=0=write) */
- if(temp) continue; /* TW: (ERROR: no ack) */
- tempah=tempbx&0x00FF;
- temp=SiS_WriteDDC2Data(tempah); /* TW: Write RAB */
- if(temp) continue; /* TW: (ERROR: no ack) */
- tempah=(tempbx&0xFF00)>>8;
- temp=SiS_WriteDDC2Data(tempah); /* TW: Write data */
- if(temp) continue; /* TW: (ERROR: no ack) */
- if (SiS_SetStop()) continue; /* TW: Set stop condition */
+ if (SiS_SetStart(SiS_Pr)) continue; /* TW: Set start condition */
+ tempah = SiS_Pr->SiS_DDC_DeviceAddr;
+ temp = SiS_WriteDDC2Data(SiS_Pr,tempah); /* TW: Write DAB (S0=0=write) */
+ if(temp) continue; /* TW: (ERROR: no ack) */
+ tempah = tempbx & 0x00FF;
+ temp = SiS_WriteDDC2Data(SiS_Pr,tempah); /* TW: Write RAB */
+ if(temp) continue; /* TW: (ERROR: no ack) */
+ tempah = (tempbx & 0xFF00) >> 8;
+ temp = SiS_WriteDDC2Data(SiS_Pr,tempah); /* TW: Write data */
+ if(temp) continue; /* TW: (ERROR: no ack) */
+ if(SiS_SetStop(SiS_Pr)) continue; /* TW: Set stop condition */
return;
}
}
@@ -7437,73 +9328,74 @@ SiS_SetCH701x(USHORT tempbx)
/* TW: Read from Chrontel 70xx */
/* Parameter is [Register no (S7-S0)] */
USHORT
-SiS_GetCH70xx(USHORT tempbx)
+SiS_GetCH70xx(SiS_Private *SiS_Pr, USHORT tempbx)
{
- if (SiS_IF_DEF_CH70xx == 1)
- return(SiS_GetCH700x(tempbx));
+ if (SiS_Pr->SiS_IF_DEF_CH70xx == 1)
+ return(SiS_GetCH700x(SiS_Pr,tempbx));
else
- return(SiS_GetCH701x(tempbx));
+ return(SiS_GetCH701x(SiS_Pr,tempbx));
}
/* TW: Read from Chrontel 700x */
/* Parameter is [Register no (S7-S0)] */
USHORT
-SiS_GetCH700x(USHORT tempbx)
+SiS_GetCH700x(SiS_Private *SiS_Pr, USHORT tempbx)
{
USHORT tempah,temp,i;
- if(!(SiS_ChrontelInit)) {
- SiS_DDC_Index = 0x11; /* TW: Bit 0 = SC; Bit 1 = SD */
- SiS_DDC_Data = 0x02; /* Bitmask in IndexReg for Data */
- SiS_DDC_Clk = 0x01; /* Bitmask in IndexReg for Clk */
- SiS_DDC_DataShift = 0x00;
- SiS_DDC_DeviceAddr = 0xEA; /* TW: DAB */
+ if(!(SiS_Pr->SiS_ChrontelInit)) {
+ SiS_Pr->SiS_DDC_Index = 0x11; /* TW: Bit 0 = SC; Bit 1 = SD */
+ SiS_Pr->SiS_DDC_Data = 0x02; /* Bitmask in IndexReg for Data */
+ SiS_Pr->SiS_DDC_Clk = 0x01; /* Bitmask in IndexReg for Clk */
+ SiS_Pr->SiS_DDC_DataShift = 0x00;
+ SiS_Pr->SiS_DDC_DeviceAddr = 0xEA; /* TW: DAB */
}
- SiS_DDC_ReadAddr = tempbx;
+ SiS_Pr->SiS_DDC_ReadAddr = tempbx;
for(i=0;i<20;i++) { /* TW: Do only 20 attempts to read */
- SiS_SetSwitchDDC2();
- if(SiS_SetStart()) continue; /* TW: Set start condition */
- tempah = SiS_DDC_DeviceAddr;
- temp = SiS_WriteDDC2Data(tempah); /* TW: Write DAB (S0=0=write) */
- if(temp) continue; /* TW: (ERROR: no ack) */
- tempah = SiS_DDC_ReadAddr; /* TW: Write RAB */
- temp = SiS_WriteDDC2Data(tempah);
- if(temp) continue; /* TW: (ERROR: no ack) */
- if (SiS_SetStart()) continue; /* TW: Re-start */
- tempah = SiS_DDC_DeviceAddr | 0x01; /* DAB | 0x01 = Read */
- temp = SiS_WriteDDC2Data(tempah); /* TW: DAB (S0=1=read) */
- if(temp) continue; /* TW: (ERROR: no ack) */
- tempah = SiS_ReadDDC2Data(tempah); /* TW: Read byte */
- if (SiS_SetStop()) continue; /* TW: Stop condition */
- SiS_ChrontelInit = 1;
+ /* SiS_SetSwitchDDC2(SiS_Pr); */
+ if(SiS_SetStart(SiS_Pr)) continue; /* TW: Set start condition */
+ tempah = SiS_Pr->SiS_DDC_DeviceAddr;
+ temp = SiS_WriteDDC2Data(SiS_Pr,tempah); /* TW: Write DAB (S0=0=write) */
+ if(temp) continue; /* TW: (ERROR: no ack) */
+ tempah = SiS_Pr->SiS_DDC_ReadAddr | 0x80; /* TW: Write RAB | 0x80 */
+ temp = SiS_WriteDDC2Data(SiS_Pr,tempah);
+ if(temp) continue; /* TW: (ERROR: no ack) */
+ if (SiS_SetStart(SiS_Pr)) continue; /* TW: Re-start */
+ tempah = SiS_Pr->SiS_DDC_DeviceAddr | 0x01; /* DAB | 0x01 = Read */
+ temp = SiS_WriteDDC2Data(SiS_Pr,tempah); /* TW: DAB (S0=1=read) */
+ if(temp) continue; /* TW: (ERROR: no ack) */
+ tempah = SiS_ReadDDC2Data(SiS_Pr,tempah); /* TW: Read byte */
+ if (SiS_SetStop(SiS_Pr)) continue; /* TW: Stop condition */
+ SiS_Pr->SiS_ChrontelInit = 1;
return(tempah);
}
- if(!SiS_ChrontelInit) {
- SiS_DDC_Index = 0x0a; /* TW: Bit 0 = SC; Bit 1 = SD */
- SiS_DDC_Data = 0x80; /* Bitmask in IndexReg for Data */
- SiS_DDC_Clk = 0x40; /* Bitmask in IndexReg for Clk */
- SiS_DDC_DataShift = 0x00;
- SiS_DDC_DeviceAddr = 0xEA; /* TW: DAB (Device Address Byte) */
+ /* TW: For 630ST */
+ if(!SiS_Pr->SiS_ChrontelInit) {
+ SiS_Pr->SiS_DDC_Index = 0x0a; /* TW: Bit 0 = SC; Bit 1 = SD */
+ SiS_Pr->SiS_DDC_Data = 0x80; /* Bitmask in IndexReg for Data */
+ SiS_Pr->SiS_DDC_Clk = 0x40; /* Bitmask in IndexReg for Clk */
+ SiS_Pr->SiS_DDC_DataShift = 0x00;
+ SiS_Pr->SiS_DDC_DeviceAddr = 0xEA; /* TW: DAB (Device Address Byte) */
for(i=0;i<20;i++) { /* TW: Do only 20 attempts to read */
- SiS_SetSwitchDDC2();
- if(SiS_SetStart()) continue; /* TW: Set start condition */
- tempah = SiS_DDC_DeviceAddr;
- temp = SiS_WriteDDC2Data(tempah); /* TW: Write DAB (S0=0=write) */
- if(temp) continue; /* TW: (ERROR: no ack) */
- tempah = SiS_DDC_ReadAddr; /* TW: Write RAB */
- temp = SiS_WriteDDC2Data(tempah);
- if(temp) continue; /* TW: (ERROR: no ack) */
- if (SiS_SetStart()) continue; /* TW: Re-start */
- tempah = SiS_DDC_DeviceAddr | 0x01; /* DAB | 0x01 = Read */
- temp = SiS_WriteDDC2Data(tempah); /* TW: DAB (S0=1=read) */
- if(temp) continue; /* TW: (ERROR: no ack) */
- tempah = SiS_ReadDDC2Data(tempah); /* TW: Read byte */
- if (SiS_SetStop()) continue; /* TW: Stop condition */
- SiS_ChrontelInit = 1;
+ /* SiS_SetSwitchDDC2(SiS_Pr); */
+ if(SiS_SetStart(SiS_Pr)) continue; /* TW: Set start condition */
+ tempah = SiS_Pr->SiS_DDC_DeviceAddr;
+ temp = SiS_WriteDDC2Data(SiS_Pr,tempah); /* TW: Write DAB (S0=0=write) */
+ if(temp) continue; /* TW: (ERROR: no ack) */
+ tempah = SiS_Pr->SiS_DDC_ReadAddr | 0x80; /* TW: Write RAB | 0x80 */
+ temp = SiS_WriteDDC2Data(SiS_Pr,tempah);
+ if(temp) continue; /* TW: (ERROR: no ack) */
+ if (SiS_SetStart(SiS_Pr)) continue; /* TW: Re-start */
+ tempah = SiS_Pr->SiS_DDC_DeviceAddr | 0x01; /* DAB | 0x01 = Read */
+ temp = SiS_WriteDDC2Data(SiS_Pr,tempah); /* TW: DAB (S0=1=read) */
+ if(temp) continue; /* TW: (ERROR: no ack) */
+ tempah = SiS_ReadDDC2Data(SiS_Pr,tempah); /* TW: Read byte */
+ if (SiS_SetStop(SiS_Pr)) continue; /* TW: Stop condition */
+ SiS_Pr->SiS_ChrontelInit = 1;
return(tempah);
}
}
@@ -7513,232 +9405,1202 @@ SiS_GetCH700x(USHORT tempbx)
/* TW: Read from Chrontel 701x */
/* Parameter is [Register no (S7-S0)] */
USHORT
-SiS_GetCH701x(USHORT tempbx)
+SiS_GetCH701x(SiS_Private *SiS_Pr, USHORT tempbx)
{
USHORT tempah,temp,i;
- /* TW: Toggle to DDC port */
- SiS_SetRegOR(SiS_P3c4,0x38,0x20);
-
- SiS_DDC_Index = 0x11; /* TW: Bit 0 = SC; Bit 1 = SD */
- SiS_DDC_Data = 0x08; /* Bitmask in IndexReg for Data */
- SiS_DDC_Clk = 0x04; /* Bitmask in IndexReg for Clk */
- SiS_DDC_DataShift = 0x00;
- SiS_DDC_DeviceAddr = 0xEA; /* TW: DAB */
- SiS_DDC_ReadAddr = tempbx;
+ SiS_Pr->SiS_DDC_Index = 0x11; /* TW: Bit 0 = SC; Bit 1 = SD */
+ SiS_Pr->SiS_DDC_Data = 0x08; /* Bitmask in IndexReg for Data */
+ SiS_Pr->SiS_DDC_Clk = 0x04; /* Bitmask in IndexReg for Clk */
+ SiS_Pr->SiS_DDC_DataShift = 0x00;
+ SiS_Pr->SiS_DDC_DeviceAddr = 0xEA; /* TW: DAB */
+ SiS_Pr->SiS_DDC_ReadAddr = tempbx;
for(i=0;i<20;i++) { /* TW: Do only 20 attempts to read */
- if(SiS_SetStart()) continue; /* TW: Set start condition */
- tempah = SiS_DDC_DeviceAddr;
- temp = SiS_WriteDDC2Data(tempah); /* TW: Write DAB (S0=0=write) */
- if(temp) continue; /* TW: (ERROR: no ack) */
- tempah = SiS_DDC_ReadAddr; /* TW: Write RAB */
- temp = SiS_WriteDDC2Data(tempah);
- if(temp) continue; /* TW: (ERROR: no ack) */
- if (SiS_SetStart()) continue; /* TW: Re-start */
- tempah = SiS_DDC_DeviceAddr | 0x01; /* DAB | 0x01 = Read */
- temp = SiS_WriteDDC2Data(tempah); /* TW: DAB (S0=1=read) */
- if(temp) continue; /* TW: (ERROR: no ack) */
- tempah = SiS_ReadDDC2Data(tempah); /* TW: Read byte */
- SiS_SetStop(); /* TW: Stop condition */
+ if(SiS_SetStart(SiS_Pr)) continue; /* TW: Set start condition */
+ tempah = SiS_Pr->SiS_DDC_DeviceAddr;
+ temp = SiS_WriteDDC2Data(SiS_Pr,tempah); /* TW: Write DAB (S0=0=write) */
+ if(temp) continue; /* TW: (ERROR: no ack) */
+ tempah = SiS_Pr->SiS_DDC_ReadAddr; /* TW: Write RAB */
+ temp = SiS_WriteDDC2Data(SiS_Pr,tempah);
+ if(temp) continue; /* TW: (ERROR: no ack) */
+ if (SiS_SetStart(SiS_Pr)) continue; /* TW: Re-start */
+ tempah = SiS_Pr->SiS_DDC_DeviceAddr | 0x01; /* DAB | 0x01 = Read */
+ temp = SiS_WriteDDC2Data(SiS_Pr,tempah); /* TW: DAB (S0=1=read) */
+ if(temp) continue; /* TW: (ERROR: no ack) */
+ tempah = SiS_ReadDDC2Data(SiS_Pr,tempah); /* TW: Read byte */
+ SiS_SetStop(SiS_Pr); /* TW: Stop condition */
return(tempah);
}
return 0xFFFF;
}
+#ifdef LINUX_XF86
+/* TW: Our own DDC functions */
+USHORT
+SiS_InitDDCRegs(SiS_Private *SiS_Pr, SISPtr pSiS, USHORT adaptnum, USHORT DDCdatatype,
+ BOOLEAN checkcr32)
+{
+ unsigned char ddcdtype[] = { 0xa0, 0xa0, 0xa0, 0xa2, 0xa6 };
+ unsigned char flag, cr32;
+ USHORT temp = 0, myadaptnum = adaptnum;
+
+ if(adaptnum != 0) {
+ if(!(pSiS->VBFlags & (VB_301|VB_301B|VB_302B))) return 0xFFFF;
+ if((pSiS->VBFlags & VB_30xBDH) && (adaptnum == 1)) return 0xFFFF;
+ }
+
+ /* adapternum for SiS bridges: 0 = CRT1, 1 = LCD, 2 = VGA2 */
+
+ SiS_Pr->SiS_ChrontelInit = 0; /* force re-detection! */
+
+ SiS_Pr->SiS_DDC_SecAddr = 0;
+ SiS_Pr->SiS_DDC_DeviceAddr = ddcdtype[DDCdatatype];
+ SiS_Pr->SiS_DDC_Port = SiS_Pr->SiS_P3c4;
+ SiS_Pr->SiS_DDC_Index = 0x11;
+ flag = 0xff;
+
+ cr32 = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x32);
+
+ if(pSiS->VBFlags & VB_SISBRIDGE) {
+ if(myadaptnum == 0) {
+ if(!(cr32 & 0x20)) {
+ myadaptnum = 2;
+ if(!(cr32 & 0x10)) {
+ myadaptnum = 1;
+ if(!(cr32 & 0x08)) {
+ myadaptnum = 0;
+ }
+ }
+ }
+ }
+ }
+
+ if(pSiS->VGAEngine == SIS_300_VGA) { /* 300 series */
+
+ if(myadaptnum != 0) {
+ flag = 0;
+ if(pSiS->VBFlags & VB_SISBRIDGE) {
+ SiS_Pr->SiS_DDC_Port = SiS_Pr->SiS_Part4Port;
+ SiS_Pr->SiS_DDC_Index = 0x0f;
+ }
+ }
+
+ if(!(pSiS->VBFlags & VB_301)) {
+ if((cr32 & 0x80) && (checkcr32)) {
+ if(myadaptnum >= 1) {
+ if(!(cr32 & 0x08)) {
+ myadaptnum = 1;
+ if(!(cr32 & 0x10)) return 0xFFFF;
+ }
+ }
+ }
+ }
+
+ temp = 4 - (myadaptnum * 2);
+ if(flag) temp = 0;
+
+ } else { /* 310/325/330 series */
+
+ /* here we simplify: 0 = CRT1, 1 = CRT2 (VGA, LCD) */
+
+ if(pSiS->VBFlags & VB_SISBRIDGE) {
+ if(myadaptnum == 2) {
+ myadaptnum = 1;
+ }
+ }
+
+ if(myadaptnum == 1) {
+ flag = 0;
+ if(pSiS->VBFlags & VB_SISBRIDGE) {
+ SiS_Pr->SiS_DDC_Port = SiS_Pr->SiS_Part4Port;
+ SiS_Pr->SiS_DDC_Index = 0x0f;
+ }
+ }
+
+ if((cr32 & 0x80) && (checkcr32)) {
+ if(myadaptnum >= 1) {
+ if(!(cr32 & 0x08)) {
+ myadaptnum = 1;
+ if(!(cr32 & 0x10)) return 0xFFFF;
+ }
+ }
+ }
+
+ temp = myadaptnum;
+ if(myadaptnum == 1) {
+ temp = 0;
+ if(pSiS->VBFlags & VB_LVDS) flag = 0xff;
+ }
+
+ if(flag) temp = 0;
+ }
+
+ SiS_Pr->SiS_DDC_Data = 0x02 << temp;
+ SiS_Pr->SiS_DDC_Clk = 0x01 << temp;
+
+#ifdef TWDEBUG
+ xf86DrvMsg(0, X_INFO, "DDC Port %x Index %x Shift %d\n",
+ SiS_Pr->SiS_DDC_Port, SiS_Pr->SiS_DDC_Index, temp);
+#endif
+
+ return 0;
+}
+
+USHORT
+SiS_WriteDABDDC(SiS_Private *SiS_Pr)
+{
+ if(SiS_SetStart(SiS_Pr)) return 0xFFFF;
+ if(SiS_WriteDDC2Data(SiS_Pr, SiS_Pr->SiS_DDC_DeviceAddr)) {
+#ifdef TWDEBUG
+ xf86DrvMsg(0, X_INFO, "WriteDAB 1 failed\n");
+#endif
+ return 0xFFFF;
+ }
+ if(SiS_WriteDDC2Data(SiS_Pr, SiS_Pr->SiS_DDC_SecAddr)) {
+#ifdef TWDEBUG
+ xf86DrvMsg(0, X_INFO, "WriteDAB 2 failed\n");
+#endif
+ return 0xFFFF;
+ }
+ return(0);
+}
+
+USHORT
+SiS_PrepareReadDDC(SiS_Private *SiS_Pr)
+{
+ if(SiS_SetStart(SiS_Pr)) return 0xFFFF;
+ if(SiS_WriteDDC2Data(SiS_Pr, (SiS_Pr->SiS_DDC_DeviceAddr | 0x01))) {
+#ifdef TWDEBUG
+ xf86DrvMsg(0, X_INFO, "PrepareReadDDC 1 failed\n");
+#endif
+ return 0xFFFF;
+ }
+ return(0);
+}
+
+USHORT
+SiS_PrepareDDC(SiS_Private *SiS_Pr)
+{
+ if(SiS_WriteDABDDC(SiS_Pr)) SiS_WriteDABDDC(SiS_Pr);
+ if(SiS_PrepareReadDDC(SiS_Pr)) return(SiS_PrepareReadDDC(SiS_Pr));
+ return(0);
+}
+
void
-SiS_SetCH70xxANDOR(USHORT tempax,USHORT tempbh)
+SiS_SendACK(SiS_Private *SiS_Pr, USHORT yesno)
+{
+ SiS_SetSCLKLow(SiS_Pr);
+ if(yesno) {
+ SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port, SiS_Pr->SiS_DDC_Index,
+ ~SiS_Pr->SiS_DDC_Data, SiS_Pr->SiS_DDC_Data);
+ } else {
+ SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port, SiS_Pr->SiS_DDC_Index,
+ ~SiS_Pr->SiS_DDC_Data, 0);
+ }
+ SiS_SetSCLKHigh(SiS_Pr);
+}
+
+USHORT
+SiS_DoProbeDDC(SiS_Private *SiS_Pr)
+{
+ unsigned char mask, value;
+ USHORT temp, ret=0;
+ BOOLEAN failed = FALSE;
+
+ SiS_SetSwitchDDC2(SiS_Pr);
+ if(SiS_PrepareDDC(SiS_Pr)) {
+ SiS_SetStop(SiS_Pr);
+#ifdef TWDEBUG
+ xf86DrvMsg(0, X_INFO, "DoProbeDDC 1 failed at PrepareDDC\n");
+#endif
+ return(0xFFFF);
+ }
+ mask = 0xf0;
+ value = 0x20;
+ if(SiS_Pr->SiS_DDC_DeviceAddr == 0xa0) {
+ temp = (unsigned char)SiS_ReadDDC2Data(SiS_Pr, 0);
+ SiS_SendACK(SiS_Pr, 0);
+ if(temp == 0) {
+ mask = 0xff;
+ value = 0xff;
+ } else {
+ failed = TRUE;
+ ret = 0xFFFF;
+ }
+ }
+ if(failed == FALSE) {
+ temp = (unsigned char)SiS_ReadDDC2Data(SiS_Pr, 0);
+ SiS_SendACK(SiS_Pr, 1);
+ temp &= mask;
+ if(temp == value) ret = 0;
+ else {
+ ret = 0xFFFF;
+ if(SiS_Pr->SiS_DDC_DeviceAddr == 0xa0) {
+ if(temp == 0x30) ret = 0;
+ }
+ }
+ }
+ SiS_SetStop(SiS_Pr);
+ return(ret);
+}
+
+USHORT
+SiS_ProbeDDC(SiS_Private *SiS_Pr)
+{
+ USHORT flag;
+
+ flag = 0x180;
+ SiS_Pr->SiS_DDC_DeviceAddr = 0xa0;
+ if(!(SiS_DoProbeDDC(SiS_Pr))) flag |= 0x02;
+ SiS_Pr->SiS_DDC_DeviceAddr = 0xa2;
+ if(!(SiS_DoProbeDDC(SiS_Pr))) flag |= 0x08;
+ SiS_Pr->SiS_DDC_DeviceAddr = 0xa6;
+ if(!(SiS_DoProbeDDC(SiS_Pr))) flag |= 0x10;
+ if(!(flag & 0x1a)) flag = 0;
+ return(flag);
+}
+
+USHORT
+SiS_ReadDDC(SiS_Private *SiS_Pr, SISPtr pSiS, USHORT DDCdatatype, unsigned char *buffer)
+{
+ USHORT flag, length, i;
+ unsigned char chksum,gotcha;
+
+ if(DDCdatatype > 4) return 0xFFFF;
+
+ flag = 0;
+ SiS_SetSwitchDDC2(SiS_Pr);
+ if(!(SiS_PrepareDDC(SiS_Pr))) {
+ length = 127;
+ if(DDCdatatype != 1) length = 255;
+ chksum = 0;
+ gotcha = 0;
+ for(i=0; i<length; i++) {
+ buffer[i] = (unsigned char)SiS_ReadDDC2Data(SiS_Pr, 0);
+ chksum += buffer[i];
+ gotcha |= buffer[i];
+ SiS_SendACK(SiS_Pr, 0);
+ }
+ buffer[i] = (unsigned char)SiS_ReadDDC2Data(SiS_Pr, 0);
+ chksum += buffer[i];
+ SiS_SendACK(SiS_Pr, 1);
+ if(gotcha) flag = (USHORT)chksum;
+ else flag = 0xFFFF;
+ } else {
+ flag = 0xFFFF;
+ }
+ SiS_SetStop(SiS_Pr);
+ return(flag);
+}
+
+USHORT
+SiS_ReadLCDDDC(SiS_Private *SiS_Pr, USHORT length, unsigned char *buffer)
+{
+ USHORT i=0, flag=0;
+
+ length--;
+
+ SiS_SetSwitchDDC2(SiS_Pr);
+ if(!(SiS_PrepareDDC(SiS_Pr))) {
+ for(i=0; i<length; i++) {
+ buffer[i] = (unsigned char)SiS_ReadDDC2Data(SiS_Pr, 0);
+ SiS_SendACK(SiS_Pr, 0);
+ }
+ buffer[i] = (unsigned char)SiS_ReadDDC2Data(SiS_Pr, 0);
+ SiS_SendACK(SiS_Pr, 1);
+ } else flag = 0xFFFF;
+
+ SiS_SetStop(SiS_Pr);
+ return(0);
+}
+
+/* TW: Our private DDC function
+
+ It complies somewhat with the corresponding VESA function
+ in arguments and return values.
+
+ Since this is probably called before the mode is changed,
+ we use our pre-detected pSiS-values instead of SiS_Pr as
+ regards chipset and video bridge type.
+
+ Arguments:
+ adaptnum: 0=CRT1, 1=LCD, 2=VGA2
+ CRT2 DDC is only supported on SiS301, 301B (non-DH version), 302B.
+ DDCdatatype: 0=Probe, 1=EDID, 2=EDID+VDIF, 3=EDID V2 (P&D), 4=EDID V2 (FPDI-2)
+ buffer: ptr to 256 data bytes which will be filled with read data.
+
+ Returns 0xFFFF if error, otherwise
+ if DDCdatatype > 0: Returns 0 if reading OK (included a correct checksum)
+ if DDCdatatype = 0: Returns supported DDC modes
+
+ */
+USHORT
+SiS_HandleDDC(SiS_Private *SiS_Pr, SISPtr pSiS, USHORT adaptnum,
+ USHORT DDCdatatype, unsigned char *buffer)
+{
+ if(adaptnum > 2) return 0xFFFF;
+ if(DDCdatatype > 4) return 0xFFFF;
+ if((!(pSiS->VBFlags & VB_VIDEOBRIDGE)) && (adaptnum > 0)) return 0xFFFF;
+ if(SiS_InitDDCRegs(SiS_Pr, pSiS, adaptnum, DDCdatatype, TRUE) == 0xFFFF) return 0xFFFF;
+ if(DDCdatatype == 0) {
+ return(SiS_ProbeDDC(SiS_Pr));
+ } else {
+ return(SiS_ReadDDC(SiS_Pr, pSiS, DDCdatatype, buffer));
+ }
+}
+
+/* Sense the LCD parameters (CR36, CR37) via DDC */
+/* SiS30x(B) only */
+USHORT
+SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
+{
+ USHORT DDCdatatype, paneltype, flag, xres, yres;
+ USHORT index, myindex, lumsize, numcodes;
+ unsigned char cr37=0, seekcode;
+ BOOLEAN checkexpand = FALSE;
+ int retry, i;
+ unsigned char buffer[256];
+
+ if(!(pSiS->VBFlags & (VB_301|VB_301B|VB_302B))) return 0;
+ if(pSiS->VBFlags & VB_30xBDH) return 0;
+
+ if(SiS_InitDDCRegs(SiS_Pr, pSiS, 1, 0, FALSE) == 0xFFFF) return 0;
+
+ SiS_Pr->SiS_DDC_SecAddr = 0x00;
+
+ /* Probe supported DA's */
+ flag = SiS_ProbeDDC(SiS_Pr);
+#ifdef TWDEBUG
+ xf86DrvMsg(pSiS->pScrn->scrnIndex, X_INFO,
+ "CRT2 DDC capabilities 0x%x\n", flag);
+#endif
+ if(flag & 0x10) {
+ SiS_Pr->SiS_DDC_DeviceAddr = 0xa6; /* EDID V2 (FP) */
+ DDCdatatype = 4;
+ } else if(flag & 0x08) {
+ SiS_Pr->SiS_DDC_DeviceAddr = 0xa2; /* EDID V2 (P&D-D Monitor) */
+ DDCdatatype = 3;
+ } else if(flag & 0x02) {
+ SiS_Pr->SiS_DDC_DeviceAddr = 0xa0; /* EDID V1 */
+ DDCdatatype = 1;
+ } else return 0; /* no DDC support (or no device attached) */
+
+ /* Read the entire EDID */
+ retry = 2;
+ do {
+ if(SiS_ReadDDC(SiS_Pr, pSiS, DDCdatatype, buffer)) {
+ xf86DrvMsg(pSiS->pScrn->scrnIndex, X_INFO,
+ "CRT2: DDC read failed (attempt %d), %s\n",
+ (3-retry), (retry == 1) ? "giving up" : "retrying");
+ retry--;
+ if(retry == 0) return 0xFFFF;
+ } else break;
+ } while(1);
+
+#ifdef TWDEBUG
+ for(i=0; i<256; i+=16) {
+ xf86DrvMsg(pSiS->pScrn->scrnIndex, X_INFO,
+ "%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
+ buffer[i], buffer[i+1], buffer[i+2], buffer[i+3],
+ buffer[i+4], buffer[i+5], buffer[i+6], buffer[i+7],
+ buffer[i+8], buffer[i+9], buffer[i+10], buffer[i+11],
+ buffer[i+12], buffer[i+13], buffer[i+14], buffer[i+15]);
+ }
+#endif
+
+ /* Analyze EDID and retrieve LCD panel information */
+ paneltype = 0;
+ switch(DDCdatatype) {
+ case 1: /* Analyze EDID V1 */
+ /* Catch a few clear cases: */
+ if(!(buffer[0x14] & 0x80)) {
+ xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
+ "CRT2: Attached display exspects analog input (0x%02x)\n",
+ buffer[0x14]);
+ return 0;
+ }
+
+ if((buffer[0x18] & 0x18) != 0x08) {
+ xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
+ "CRT2: Attached display is not of RGB but of %s type (0x%02x)\n",
+ ((buffer[0x18] & 0x18) == 0x00) ? "monochrome/greyscale" :
+ ( ((buffer[0x18] & 0x18) == 0x10) ? "non-RGB multicolor" :
+ "undefined"),
+ buffer[0x18]);
+ return 0;
+ }
+
+ /* Now analyze the first Detailed Timing Block and hope
+ * that the preferred timing mode is stored there.
+ */
+ xres = buffer[0x38] | ((buffer[0x3a] & 0xf0) << 4);
+ yres = buffer[0x3b] | ((buffer[0x3d] & 0xf0) << 4);
+ checkexpand = FALSE;
+ switch(xres) {
+ case 800:
+ if(yres == 600) {
+ paneltype = Panel310_800x600;
+ checkexpand = TRUE;
+ }
+ break;
+ case 1024:
+ if(yres == 768) {
+ paneltype = Panel310_1024x768;
+ checkexpand = FALSE; /* expand causes error at 640x480, should otherwise be TRUE; */
+ }
+ break;
+ case 1280:
+ if(yres == 960) {
+ if(pSiS->VGAEngine == SIS_300_VGA) {
+ paneltype = Panel300_1280x960;
+ } else {
+ paneltype = Panel310_1280x960;
+ }
+ } else if(yres == 1024) {
+ paneltype = Panel310_1280x1024;
+ checkexpand = TRUE;
+ } else if(pSiS->VGAEngine == SIS_315_VGA) {
+ if(yres == 768) {
+ paneltype = Panel310_1280x768; /* Panel size 1280x768 not supported yet */
+ checkexpand = TRUE;
+ }
+ }
+ break;
+ case 1400:
+ if(pSiS->VGAEngine == SIS_315_VGA) {
+ if(yres == 1050) {
+ paneltype = Panel310_1400x1050;
+ checkexpand = TRUE;
+ }
+ }
+ break;
+ case 1600:
+ if(pSiS->VGAEngine == SIS_315_VGA) {
+ if(yres == 1200) {
+ paneltype = Panel310_1600x1200;
+ checkexpand = TRUE;
+ }
+ }
+ break;
+ }
+
+ if(buffer[0x18] & 0x02) {
+ /* If the preferred timing mode is stored in the first
+ * detailed timing block, we now can extract the sync
+ * polarisation information as well. This only works
+ * if the Flags indicate a digital separate output.
+ */
+ if((buffer[0x47] & 0x18) == 0x18) {
+ cr37 |= ((((buffer[0x47] & 0x06) ^ 0x06) << 5) | 0x20);
+ } else {
+ /* What now? There is no digital separate output timing... */
+ xf86DrvMsg(pSiS->pScrn->scrnIndex, X_WARNING,
+ "CRT2: Unable to retrieve Sync polarity information\n");
+ }
+
+ } else {
+ /* If the preferred timing mode is *not* stored in the first
+ * detailed timing block, we need to guess the resolution
+ * from the supported Established Timings and assume the
+ * default sync polarity
+ */
+ paneltype = 0;
+ if(buffer[0x24] & 0x01) {
+ paneltype = Panel310_1280x1024;
+ checkexpand = TRUE;
+ cr37 |= 0x20;
+ } else if(buffer[0x24] & 0x0e) {
+ paneltype = Panel310_1024x768;
+ cr37 |= 0xe0;
+ checkexpand = FALSE; /* Bug at 640x480 */
+ } else if(buffer[0x23] & 0x01) {
+ paneltype = Panel310_800x600;
+ cr37 |= 0xe0;
+ checkexpand = TRUE;
+ }
+ }
+
+ if(checkexpand) {
+ /* If any of the Established low-res modes is supported, the
+ * panel can scale automatically. For 800x600 panels, we only
+ * check the even lower ones.
+ */
+ if(paneltype == Panel310_800x600) {
+ if(buffer[0x23] & 0xfc) cr37 |= 0x10;
+ } else {
+ if(buffer[0x23]) cr37 |= 0x10;
+ }
+ }
+
+ break;
+
+ case 3: /* Analyze EDID V2 */
+ case 4:
+ index = 0;
+ if((buffer[0x41] & 0x0f) == 0x03) {
+ index = 0x42 + 3;
+ xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
+ "CRT2: Display supports TMDS input on primary interface\n");
+ } else if((buffer[0x41] & 0xf0) == 0x30) {
+ index = 0x46 + 3;
+ xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
+ "CRT2: Display supports TMDS input on secondary interface\n");
+ } else {
+ xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
+ "CRT2: Display does not support TMDS video interface (0x%02x)\n",
+ buffer[0x41]);
+ return 0;
+ }
+
+ xres = buffer[0x76] | (buffer[0x77] << 8);
+ yres = buffer[0x78] | (buffer[0x79] << 8);
+ switch(xres) {
+ case 800:
+ if(yres == 600) {
+ paneltype = Panel310_800x600;
+ checkexpand = TRUE;
+ }
+ break;
+ case 1024:
+ if(yres == 768) {
+ paneltype = Panel310_1024x768;
+ checkexpand = FALSE; /* Bug at 640x480; we do the scaling ourselves */
+ }
+ break;
+ case 1280:
+ if(yres == 960) {
+ if(pSiS->VGAEngine == SIS_315_VGA) {
+ paneltype = Panel310_1280x960;
+ } else {
+ paneltype = Panel300_1280x960;
+ }
+ } else if(yres == 1024) {
+ paneltype = Panel310_1280x1024;
+ checkexpand = TRUE;
+ } else if(pSiS->VGAEngine == SIS_315_VGA) {
+ if(yres == 768) {
+ paneltype = Panel310_1280x768; /* Panel size 1280x768 not supported yet */
+ checkexpand = TRUE;
+ }
+ }
+ break;
+ case 1400:
+ if(pSiS->VGAEngine == SIS_315_VGA) {
+ if(yres == 1050) {
+ paneltype = Panel310_1400x1050;
+ checkexpand = TRUE;
+ }
+ }
+ break;
+ case 1600:
+ if(pSiS->VGAEngine == SIS_315_VGA) {
+ if(yres == 1200) {
+ paneltype = Panel310_1600x1200;
+ checkexpand = TRUE;
+ }
+ }
+ break;
+ }
+
+ /* Determine if RGB18 or RGB24 */
+ if(index) {
+ if((buffer[index] == 0x20) || (buffer[index] == 0x34)) {
+ cr37 |= 0x01;
+ }
+ }
+
+ if(checkexpand) {
+ /* TODO - for now, we let the panel scale */
+ cr37 |= 0x10;
+ }
+
+ /* Now seek 4-Byte Timing codes and extract sync pol info */
+ index = 0x80;
+ if(buffer[0x7e] & 0x20) { /* skip Luminance Table (if provided) */
+ lumsize = buffer[0x80] & 0x1f;
+ if(buffer[0x80] & 0x80) lumsize *= 3;
+ lumsize++;
+ index += lumsize;
+ }
+ index += (((buffer[0x7e] & 0x1c) >> 2) * 8); /* skip Frequency Ranges */
+ index += ((buffer[0x7e] & 0x03) * 27); /* skip Detailed Range Limits */
+ numcodes = (buffer[0x7f] & 0xf8) >> 3;
+ if(numcodes) {
+ myindex = index;
+ seekcode = (xres - 256) / 16;
+ for(i=0; i<numcodes; i++) {
+ if(buffer[myindex] == seekcode) break;
+ myindex += 4;
+ }
+ if(buffer[myindex] == seekcode) {
+ cr37 |= ((((buffer[myindex + 1] & 0x0c) ^ 0x0c) << 4) | 0x20);
+ } else {
+ xf86DrvMsg(pSiS->pScrn->scrnIndex, X_WARNING,
+ "CRT2: Unable to retrieve Sync polarity information\n");
+ }
+ } else {
+ xf86DrvMsg(pSiS->pScrn->scrnIndex, X_WARNING,
+ "CRT2: Unable to retrieve Sync polarity information\n");
+ }
+
+ break;
+
+ }
+
+ /* 1280x960 panels are always RGB24, unable to scale and use
+ * high active sync polarity
+ */
+ if(pSiS->VGAEngine == SIS_315_VGA) {
+ if(paneltype == Panel310_1280x960) cr37 &= 0x0e;
+ } else {
+ if(paneltype == Panel300_1280x960) cr37 &= 0x0e;
+ }
+
+ if(paneltype) {
+ cr37 &= 0xf1;
+ cr37 |= 0x02; /* SiS301 */
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x36,0xf0,paneltype);
+ SiS_SetReg1(SiS_Pr->SiS_P3d4,0x37,cr37);
+ SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x32,0x08);
+
+ xf86DrvMsgVerb(pSiS->pScrn->scrnIndex, X_PROBED, 3,
+ "CRT2: [DDC LCD results: 0x%02x, 0x%02x]\n", paneltype, cr37);
+ }
+ return 0;
+}
+
+USHORT
+SiS_SenseVGA2DDC(SiS_Private *SiS_Pr, SISPtr pSiS)
+{
+ USHORT DDCdatatype,flag;
+ BOOLEAN foundcrt = FALSE;
+ int retry;
+ unsigned char buffer[256];
+
+ if(!(pSiS->VBFlags & (VB_301|VB_301B|VB_302B))) return 0;
+/* if(pSiS->VBFlags & VB_30xBDH) return 0; */
+
+ if(SiS_InitDDCRegs(SiS_Pr, pSiS, 2, 0, FALSE) == 0xFFFF) return 0;
+
+ SiS_Pr->SiS_DDC_SecAddr = 0x00;
+
+ /* Probe supported DA's */
+ flag = SiS_ProbeDDC(SiS_Pr);
+ if(flag & 0x10) {
+ SiS_Pr->SiS_DDC_DeviceAddr = 0xa6; /* EDID V2 (FP) */
+ DDCdatatype = 4;
+ } else if(flag & 0x08) {
+ SiS_Pr->SiS_DDC_DeviceAddr = 0xa2; /* EDID V2 (P&D-D Monitor) */
+ DDCdatatype = 3;
+ } else if(flag & 0x02) {
+ SiS_Pr->SiS_DDC_DeviceAddr = 0xa0; /* EDID V1 */
+ DDCdatatype = 1;
+ } else {
+ xf86DrvMsg(pSiS->pScrn->scrnIndex, X_INFO,
+ "Do DDC answer\n");
+ return 0; /* no DDC support (or no device attached) */
+ }
+
+ /* Read the entire EDID */
+ retry = 2;
+ do {
+ if(SiS_ReadDDC(SiS_Pr, pSiS, DDCdatatype, buffer)) {
+ xf86DrvMsg(pSiS->pScrn->scrnIndex, X_INFO,
+ "CRT2: DDC read failed (attempt %d), %s\n",
+ (3-retry), (retry == 1) ? "giving up" : "retrying");
+ retry--;
+ if(retry == 0) return 0xFFFF;
+ } else break;
+ } while(1);
+
+ /* Analyze EDID. We don't have many chances to
+ * distinguish a flat panel from a CRT...
+ */
+ switch(DDCdatatype) {
+ case 1:
+ if(buffer[0x14] & 0x80) { /* Display uses digital input */
+ xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
+ "CRT2: Attached display exspects digital input\n");
+ return 0;
+ }
+ foundcrt = TRUE;
+ break;
+ case 3:
+ case 4:
+ if( ((buffer[0x41] & 0x0f) != 0x01) && /* Display does not support analog input */
+ ((buffer[0x41] & 0x0f) != 0x02) &&
+ ((buffer[0x41] & 0xf0) != 0x10) &&
+ ((buffer[0x41] & 0xf0) != 0x20) ) {
+ xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
+ "CRT2: Attached display does not support analog input (0x%02x)\n",
+ buffer[0x41]);
+ return 0;
+ }
+ foundcrt = TRUE;
+ break;
+ }
+
+ if(foundcrt) {
+ SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x32,0x10);
+ }
+ return(0);
+}
+
+#if 0
+ /* ----- */
+USHORT
+SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
+{
+ USHORT DDCdatatype, paneltype, flag;
+ unsigned char cr36=0, cr37=0;
+ unsigned char tempal, tempah, tempbl, tempbh;
+ USHORT tempax, tempbx, tempcx, push1, push2, push3;
+ unsigned char addresstable[] = { 0x00, 0x22, 0x30, 0x40 };
+ int i;
+ unsigned char buffer[256];
+
+ if(pSiS->VGAEngine != SIS_315_VGA) return 0xFFFF;
+ if(!(pSiS->VBFlags & (VB_301B|VB_302B))) return 0xFFFF;
+
+ if(SiS_InitDDCRegs(SiS_Pr, pSiS, 1, 0, FALSE) == 0xFFFF) return 0xFFFF;
+
+ flag = SiS_ProbeDDC(SiS_Pr);
+ if(flag & 0x02) {
+ SiS_Pr->SiS_DDC_DeviceAddr = 0xa0; /* EDID V1 */
+ DDCdatatype = 1;
+ SiS_Pr->SiS_DDC_SecAddr = 0x3a;
+ } else if(flag & 0x08) {
+ SiS_Pr->SiS_DDC_DeviceAddr = 0xa2; /* EDID V2 (P&D-D Monitor) */
+ DDCdatatype = 3;
+ SiS_Pr->SiS_DDC_SecAddr = 0x76;
+ } else if(flag & 0x10) {
+ SiS_Pr->SiS_DDC_DeviceAddr = 0xa6; /* EDID V2 (FP) */
+ DDCdatatype = 4;
+ SiS_Pr->SiS_DDC_SecAddr = 0x76;
+ } else return 0xFFFF;
+
+
+ SiS_ReadLCDDDC(SiS_Pr, 4, buffer);
+ tempbl = buffer[0]; /* 3a - 76 */
+ tempbh = buffer[1]; /* 3b - 77 */
+
+ if(SiS_Pr->SiS_DDC_DeviceAddr == 0xa0) {
+
+ /* Read and analyze EDID V1 (res) */
+
+ tempah = 0x02; /* 1024x768 by default */
+ tempbl &= 0xf0;
+ if(tempbl != 0x40) {
+ tempah = 0x03; /* 1280x1024 by default */
+ if(tempbl == 0x50) {
+ if(!tempbh) {
+ tempbh = buffer[3] & 0xf0;
+ if(tempbh == 0x30) {
+ SiS_Pr->SiS_DDC_DeviceAddr = 0xa0;
+ SiS_Pr->SiS_DDC_SecAddr = 0x23;
+ SiS_ReadLCDDDC(SiS_Pr, 2, buffer);
+ tempbl = buffer[0]; /* 0x23 */
+ tempbh = buffer[1]; /* 0x24 */
+ if(tempbl) cr37 |= 0x10;
+ tempah = 0x0a; /* 1280x768 */
+ }
+ if(tempbh == 0x40) {
+ SiS_Pr->SiS_DDC_DeviceAddr = 0xa0;
+ SiS_Pr->SiS_DDC_SecAddr = 0x23;
+ SiS_ReadLCDDDC(SiS_Pr, 2, buffer);
+ tempbl = buffer[0]; /* 0x23 */
+ tempbh = buffer[1]; /* 0x24 */
+ if(tempbl) cr37 |= 0x10;
+ tempah = 0x03; /* 1280x1024 */
+ }
+ tempbh = 0x00;
+ }
+ }
+ if(tempbh == 0x00) goto cr36ready;
+ tempah = 0x07; /* 1280x960 */
+ if(tempbh == 0xc0) goto cr36ready;
+ }
+ SiS_Pr->SiS_DDC_DeviceAddr = 0xa0;
+ SiS_Pr->SiS_DDC_SecAddr = 0x18; /* feature support */
+ SiS_ReadLCDDDC(SiS_Pr, 2, buffer);
+ tempbl = buffer[0];
+ tempbh = buffer[1];
+ if(tempbl & 0x02) goto cr36ready;
+ SiS_Pr->SiS_DDC_DeviceAddr = 0xa0;
+ SiS_Pr->SiS_DDC_SecAddr = 0x23; /* Established Timings */
+ SiS_ReadLCDDDC(SiS_Pr, 2, buffer);
+ tempbl = buffer[0];
+ tempbh = buffer[1];
+ tempah = 0x03;
+ if(!(tempbh & 0x01)) tempah = 0x02;
+ if(!tempbl) cr37 |= 0x10;
+
+ } else {
+
+ /* Read and analyze EDID V2 (res) */
+
+ tempah = 0x02;
+ tempbx = tempbl | (tempbh << 8);
+ if(tempbx != 1024) tempah = 0x03;
+
+ }
+
+cr36ready:
+ cr36 = tempah;
+
+ if(SiS_Pr->SiS_DDC_DeviceAddr == 0xa0) {
+
+ /* Read and analyze EDID V1 (pol) */
+
+ SiS_Pr->SiS_DDC_SecAddr = 0x47;
+ SiS_ReadLCDDDC(SiS_Pr, 2, buffer);
+ tempah = buffer[0];
+ tempah &= 0x06;
+ tempah ^= 0x06;
+ tempah <<= 5;
+ tempah |= 0x20;
+ cr37 &= 0x1f;
+ cr37 |= tempah;
+ if((cr36 & 0x07) == 0x07) cr37 &= 0x0e;
+
+ } else {
+
+ /* Read and analyze EDID V2 (depth, pol) */
+
+ push1 = tempah;
+ SiS_Pr->SiS_DDC_SecAddr = 0x45;
+ SiS_ReadLCDDDC(SiS_Pr, 2, buffer);
+ tempah = 0x01;
+ if((buffer[0] != 0x20) && (buffer[0] != 0x34)) { /* RGB18 or 24? */
+ tempah = 0x00;
+ }
+ cr37 &= 0xfe;
+ cr37 |= tempah;
+
+ SiS_Pr->SiS_DDC_SecAddr = 0x7e;
+ SiS_ReadLCDDDC(SiS_Pr, 2, buffer);
+ tempax = (USHORT)(buffer[0] | (buffer[1] << 8));
+ push2 = tempax;
+ tempax &= 0x0003;
+ tempax *= 0x1b;
+ push3 = tempax;
+ tempax = (USHORT)buffer[0];
+ tempax &= 0x001c;
+ tempax >>= 2;
+ tempax *= 8;
+ tempbx = push3;
+ tempbx += tempax;
+ if(buffer[0] & 0x20) { /* Luminance table provided? */
+ SiS_Pr->SiS_DDC_SecAddr = 0x80;
+ SiS_ReadLCDDDC(SiS_Pr, 2, buffer);
+ tempax = buffer[0] | (buffer[1] << 8);
+ tempax &= 0x1f;
+ if(buffer[0] & 0x70) tempax <<= 1;
+ tempax++;
+ tempbx += tempax; /* yes -> skip it */
+ }
+ tempcx = push2;
+ tempax = push1 << 8;
+ tempbx = (tempbx & 0xff00) | (((tempbx & 0x00ff) + 0x80) & 0x00ff);
+ if(tempcx & 0xf800) {
+ tempal = addresstable[((tempax & 0xff00) >> 8)];
+ tempcx &= 0xf8ff;
+ tempcx >>= 11;
+ for(i=0; i<tempcx; i++) {
+ SiS_Pr->SiS_DDC_SecAddr = (tempbx & 0x00ff);
+ SiS_ReadLCDDDC(SiS_Pr, 2, buffer);
+ tempbx += 0x04;
+ if(buffer[0] == tempal) break;
+ }
+ tempah = buffer[1];
+ tempah &= 0x0c;
+ tempah ^= 0x0c;
+ tempah <<= 4;
+ tempah |= 0x20;
+ cr37 &= 0x1f;
+ cr37 |= tempah;
+ if((cr36 & 0x07) == 0x07) cr37 &= 0x0e;
+ }
+ }
+ xf86DrvMsg(0, X_INFO, "DDC: cr36 = 0x%02x, cr37 = 0x%02x\n", cr36, cr37);
+ return 0;
+}
+#endif
+
+/* TW: Generic I2C functions (compliant to i2c library) */
+
+#if 0
+USHORT
+SiS_I2C_GetByte(SiS_Private *SiS_Pr)
+{
+ return(SiS_ReadDDC2Data(SiS_Pr,0));
+}
+
+Bool
+SiS_I2C_PutByte(SiS_Private *SiS_Pr, USHORT data)
+{
+ if(SiS_WriteDDC2Data(SiS_Pr,data)) return FALSE;
+ return TRUE;
+}
+
+Bool
+SiS_I2C_Address(SiS_Private *SiS_Pr, USHORT addr)
+{
+ if(SiS_SetStart(SiS_Pr)) return FALSE;
+ if(SiS_WriteDDC2Data(SiS_Pr,addr)) return FALSE;
+ return TRUE;
+}
+
+void
+SiS_I2C_Stop(SiS_Private *SiS_Pr)
+{
+ SiS_SetStop(SiS_Pr);
+}
+#endif
+
+#endif
+
+void
+SiS_SetCH70xxANDOR(SiS_Private *SiS_Pr, USHORT tempax,USHORT tempbh)
{
USHORT tempal,tempah,tempbl;
tempal = tempax & 0x00FF;
tempah =(tempax >> 8) & 0x00FF;
- tempbl = SiS_GetCH70xx(tempal);
+ tempbl = SiS_GetCH70xx(SiS_Pr,tempal);
tempbl = (((tempbl & tempbh) | tempah) << 8 | tempal);
- SiS_SetCH70xx(tempbl);
+ SiS_SetCH70xx(SiS_Pr,tempbl);
}
/* TW: Generic I2C functions for Chrontel --------- */
-/* I2C functions CHECKED FOR TV BUG */
void
-SiS_SetSwitchDDC2(void)
+SiS_SetSwitchDDC2(SiS_Private *SiS_Pr)
{
- SiS_SetSCLKHigh();
- SiS_DDC2Delay(SiS_I2CDELAY);
+ SiS_SetSCLKHigh(SiS_Pr);
+ /* SiS_DDC2Delay(SiS_Pr,SiS_I2CDELAY); */
+ SiS_WaitRetraceDDC(SiS_Pr);
- SiS_SetSCLKLow();
- SiS_DDC2Delay(SiS_I2CDELAY);
+ SiS_SetSCLKLow(SiS_Pr);
+ /* SiS_DDC2Delay(SiS_Pr,SiS_I2CDELAY); */
+ SiS_WaitRetraceDDC(SiS_Pr);
}
/* TW: Set I2C start condition */
/* TW: This is done by a SD high-to-low transition while SC is high */
USHORT
-SiS_SetStart(void)
+SiS_SetStart(SiS_Private *SiS_Pr)
{
- if (SiS_SetSCLKLow()) return 0xFFFF; /* TW: (SC->low) */
- SiS_SetRegANDOR(SiS_DDC_Port,SiS_DDC_Index,~SiS_DDC_Data,SiS_DDC_Data); /* TW: SD->high */
- if (SiS_SetSCLKHigh()) return 0xFFFF; /* TW: SC->high */
- SiS_SetRegANDOR(SiS_DDC_Port,SiS_DDC_Index,~SiS_DDC_Data,0x00); /* TW: SD->low = start condition */
- if (SiS_SetSCLKHigh()) return 0xFFFF; /* TW: (SC->low) */
+ if(SiS_SetSCLKLow(SiS_Pr)) return 0xFFFF; /* TW: (SC->low) */
+ SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index,
+ ~SiS_Pr->SiS_DDC_Data,SiS_Pr->SiS_DDC_Data); /* TW: SD->high */
+ if(SiS_SetSCLKHigh(SiS_Pr)) return 0xFFFF; /* TW: SC->high */
+ SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index,
+ ~SiS_Pr->SiS_DDC_Data,0x00); /* TW: SD->low = start condition */
+ if(SiS_SetSCLKHigh(SiS_Pr)) return 0xFFFF; /* TW: (SC->low) */
return 0;
}
/* TW: Set I2C stop condition */
/* TW: This is done by a SD low-to-high transition while SC is high */
USHORT
-SiS_SetStop(void)
+SiS_SetStop(SiS_Private *SiS_Pr)
{
- if (SiS_SetSCLKLow()) return 0xFFFF; /* TW: (SC->low) */
- SiS_SetRegANDOR(SiS_DDC_Port,SiS_DDC_Index,~SiS_DDC_Data,0x00); /* TW: SD->low */
- if (SiS_SetSCLKHigh()) return 0xFFFF; /* TW: SC->high */
- SiS_SetRegANDOR(SiS_DDC_Port,SiS_DDC_Index,~SiS_DDC_Data,SiS_DDC_Data); /* TW: SD->high = stop condition */
- if (SiS_SetSCLKHigh()) return 0xFFFF; /* TW: (SC->high) */
+ if(SiS_SetSCLKLow(SiS_Pr)) return 0xFFFF; /* TW: (SC->low) */
+ SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index,
+ ~SiS_Pr->SiS_DDC_Data,0x00); /* TW: SD->low */
+ if(SiS_SetSCLKHigh(SiS_Pr)) return 0xFFFF; /* TW: SC->high */
+ SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index,
+ ~SiS_Pr->SiS_DDC_Data,SiS_Pr->SiS_DDC_Data); /* TW: SD->high = stop condition */
+ if(SiS_SetSCLKHigh(SiS_Pr)) return 0xFFFF; /* TW: (SC->high) */
return 0;
}
/* TW: Write 8 bits of data */
USHORT
-SiS_WriteDDC2Data(USHORT tempax)
+SiS_WriteDDC2Data(SiS_Private *SiS_Pr, USHORT tempax)
{
USHORT i,flag,temp;
flag=0x80;
for(i=0;i<8;i++) {
- SiS_SetSCLKLow(); /* TW: SC->low */
+ SiS_SetSCLKLow(SiS_Pr); /* TW: SC->low */
if(tempax & flag) {
- SiS_SetRegANDOR(SiS_DDC_Port,SiS_DDC_Index,~SiS_DDC_Data,SiS_DDC_Data); /* TW: Write bit (1) to SD */
+ SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index,
+ ~SiS_Pr->SiS_DDC_Data,SiS_Pr->SiS_DDC_Data); /* TW: Write bit (1) to SD */
} else {
- SiS_SetRegANDOR(SiS_DDC_Port,SiS_DDC_Index,~SiS_DDC_Data,0x00); /* TW: Write bit (0) to SD */
+ SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index,
+ ~SiS_Pr->SiS_DDC_Data,0x00); /* TW: Write bit (0) to SD */
}
- SiS_SetSCLKHigh(); /* TW: SC->high */
+ SiS_SetSCLKHigh(SiS_Pr); /* TW: SC->high */
flag >>= 1;
}
- temp=SiS_CheckACK(); /* TW: Check acknowledge */
+ temp = SiS_CheckACK(SiS_Pr); /* TW: Check acknowledge */
return(temp);
}
USHORT
-SiS_ReadDDC2Data(USHORT tempax)
+SiS_ReadDDC2Data(SiS_Private *SiS_Pr, USHORT tempax)
{
USHORT i,temp,getdata;
getdata=0;
for(i=0; i<8; i++) {
getdata <<= 1;
- SiS_SetSCLKLow();
- SiS_SetRegANDOR(SiS_DDC_Port,SiS_DDC_Index,~SiS_DDC_Data,SiS_DDC_Data);
- SiS_SetSCLKHigh();
- temp = SiS_GetReg1(SiS_DDC_Port,SiS_DDC_Index);
- if(temp & SiS_DDC_Data) getdata |= 0x01;
+ SiS_SetSCLKLow(SiS_Pr);
+ SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index,
+ ~SiS_Pr->SiS_DDC_Data,SiS_Pr->SiS_DDC_Data);
+ SiS_SetSCLKHigh(SiS_Pr);
+ temp = SiS_GetReg1(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index);
+ if(temp & SiS_Pr->SiS_DDC_Data) getdata |= 0x01;
}
return(getdata);
}
USHORT
-SiS_SetSCLKLow(void)
+SiS_SetSCLKLow(SiS_Private *SiS_Pr)
{
- USHORT temp, watchdog=50000;
-
- SiS_SetRegANDOR(SiS_DDC_Port,SiS_DDC_Index,~SiS_DDC_Clk,0x00); /* SetSCLKLow() */
- do {
- temp = SiS_GetReg1(SiS_DDC_Port,SiS_DDC_Index);
- } while((temp & SiS_DDC_Clk) && --watchdog);
- if (!watchdog) return 0xFFFF;
- SiS_DDC2Delay(SiS_I2CDELAYSHORT);
+ SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index,
+ ~SiS_Pr->SiS_DDC_Clk,0x00); /* SetSCLKLow() */
+ SiS_DDC2Delay(SiS_Pr,SiS_I2CDELAYSHORT);
return 0;
}
USHORT
-SiS_SetSCLKHigh(void)
+SiS_SetSCLKHigh(SiS_Private *SiS_Pr)
{
- USHORT temp,watchdog=50000;
+ USHORT temp,watchdog=1000;
- SiS_SetRegANDOR(SiS_DDC_Port,SiS_DDC_Index,~SiS_DDC_Clk,SiS_DDC_Clk); /* SetSCLKHigh() */
+ SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index,
+ ~SiS_Pr->SiS_DDC_Clk,SiS_Pr->SiS_DDC_Clk); /* SetSCLKHigh() */
do {
- temp = SiS_GetReg1(SiS_DDC_Port,SiS_DDC_Index);
- } while((!(temp & SiS_DDC_Clk)) && --watchdog);
- if (!watchdog) return 0xFFFF;
- SiS_DDC2Delay(SiS_I2CDELAYSHORT);
+ temp = SiS_GetReg1(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index);
+ } while((!(temp & SiS_Pr->SiS_DDC_Clk)) && --watchdog);
+ if (!watchdog) {
+#ifdef TWDEBUG
+ xf86DrvMsg(0, X_INFO, "SetClkHigh failed\n");
+#endif
+ return 0xFFFF;
+ }
+ SiS_DDC2Delay(SiS_Pr,SiS_I2CDELAYSHORT);
return 0;
}
void
-SiS_DDC2Delay(USHORT delaytime)
+SiS_DDC2Delay(SiS_Private *SiS_Pr, USHORT delaytime)
{
USHORT i;
for(i=0; i<delaytime; i++) {
- SiS_GetReg1(SiS_P3c4,0x05);
+ SiS_GetReg1(SiS_Pr->SiS_P3c4,0x05);
}
}
/* TW: Check I2C acknowledge */
/* Returns 0 if ack ok, non-0 if ack not ok */
USHORT
-SiS_CheckACK(void)
+SiS_CheckACK(SiS_Private *SiS_Pr)
{
USHORT tempah;
- SiS_SetSCLKLow(); /* TW: (SC->low) */
- SiS_SetRegANDOR(SiS_DDC_Port,SiS_DDC_Index,~SiS_DDC_Data,SiS_DDC_Data); /* TW: (SD->high) */
- SiS_SetSCLKHigh(); /* TW: SC->high = clock impulse for ack */
- tempah = SiS_GetReg1(SiS_DDC_Port,SiS_DDC_Index); /* TW: Read SD */
- SiS_SetSCLKLow(); /* TW: SC->low = end of clock impulse */
- if(tempah & SiS_DDC_Data) return(1); /* TW: Ack OK if bit = 0 */
+ SiS_SetSCLKLow(SiS_Pr); /* TW: (SC->low) */
+ SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index,
+ ~SiS_Pr->SiS_DDC_Data,SiS_Pr->SiS_DDC_Data); /* TW: (SD->high) */
+ SiS_SetSCLKHigh(SiS_Pr); /* TW: SC->high = clock impulse for ack */
+ tempah = SiS_GetReg1(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index);/* TW: Read SD */
+ SiS_SetSCLKLow(SiS_Pr); /* TW: SC->low = end of clock impulse */
+ if(tempah & SiS_Pr->SiS_DDC_Data) return(1); /* TW: Ack OK if bit = 0 */
else return(0);
}
/* TW: End of I2C functions ----------------------- */
-/* =============== SiS 310 O.E.M. ================= */
+/* =============== SiS 310/325/330 O.E.M. ================= */
#ifdef SIS315H
-/*
----------------------------------------------------------
- LCDResInfo 1 : 800x600 TW: Table wrong for LVDS!
- 2 : 1024x768
- 3 : 1280x1024
- 4 : 1280x960 TW: 1400x1050
- 5 : 640x480 TW: 1600x1200
- 6 : 1600x1200
- 7 : 1920x1440
- VESA
- non-VESA
- non-Expanding
----------------------------------------------------------
-*/
-USHORT
-GetLCDPtrIndex (void)
+static USHORT
+GetRAMDACromptr(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, UCHAR *ROMAddr)
{
- USHORT index;
+ USHORT romptr;
- if(SiS_IF_DEF_LVDS == 1) { /* TW: Inserted entire if statement */
+ if(HwDeviceExtension->jChipType < SIS_330) {
+ romptr = ROMAddr[0x128] | (ROMAddr[0x129] << 8);
+ if(SiS_Pr->SiS_VBType & VB_SIS301B302B)
+ romptr = ROMAddr[0x12a] | (ROMAddr[0x12b] << 8);
+ } else {
+ romptr = ROMAddr[0x1a8] | (ROMAddr[0x1a9] << 8);
+ if(SiS_Pr->SiS_VBType & VB_SIS301B302B)
+ romptr = ROMAddr[0x1aa] | (ROMAddr[0x1ab] << 8);
+ }
+ return(romptr);
+}
- index = SiS_LCDResInfo & 0x0F;
- if(SiS_LCDResInfo == Panel1400x1050) index -= 5;
- if(SiS_LCDResInfo == Panel1600x1200) index -= 6;
- index--;
- index *= 3;
- if(SiS_LCDInfo & LCDNonExpanding) index += 2;
- else if(!(SiS_SetFlag & LCDVESATiming)) index++;
+static USHORT
+GetLCDromptr(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, UCHAR *ROMAddr)
+{
+ USHORT romptr;
- } else {
+ if(HwDeviceExtension->jChipType < SIS_330) {
+ romptr = ROMAddr[0x120] | (ROMAddr[0x121] << 8);
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)
+ romptr = ROMAddr[0x122] | (ROMAddr[0x123] << 8);
+ } else {
+ romptr = ROMAddr[0x1a0] | (ROMAddr[0x1a1] << 8);
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)
+ romptr = ROMAddr[0x1a2] | (ROMAddr[0x1a3] << 8);
+ }
+ return(romptr);
+}
- index = (SiS_LCDResInfo & 0x0F) - 1;
- index *= 3;
- if (SiS_LCDInfo & LCDNonExpanding)
- index += 2;
- else if (!(SiS_SetFlag & LCDVESATiming))
- index++;
+static USHORT
+GetTVromptr(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, UCHAR *ROMAddr)
+{
+ USHORT romptr;
- }
+ if(HwDeviceExtension->jChipType < SIS_330) {
+ romptr = ROMAddr[0x114] | (ROMAddr[0x115] << 8);
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)
+ romptr = ROMAddr[0x11a] | (ROMAddr[0x11b] << 8);
+ } else {
+ romptr = ROMAddr[0x194] | (ROMAddr[0x195] << 8);
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)
+ romptr = ROMAddr[0x19a] | (ROMAddr[0x19b] << 8);
+ }
+ return(romptr);
+}
+
+static USHORT
+GetLCDPtrIndexBIOS(SiS_Private *SiS_Pr)
+{
+ USHORT index;
+
+ index = SiS_Pr->SiS_LCDResInfo & 0x0F;
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) index -= 5;
+ else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) index -= 6;
+ index--;
+ index *= 3;
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) index += 2;
+ else if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) index++;
return index;
- }
+}
+
+static USHORT
+GetLCDPtrIndex(SiS_Private *SiS_Pr)
+{
+ USHORT index;
+ index = SiS_Pr->SiS_LCDResInfo & 0x0F;
+ index--;
+ index *= 3;
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) index += 2;
+ else if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) index++;
+
+ return index;
+}
/*
---------------------------------------------------------
@@ -7751,282 +10613,594 @@ GetLCDPtrIndex (void)
5 : HiVision Standard TVSimuMode
---------------------------------------------------------
*/
-USHORT
-GetTVPtrIndex(void)
+static USHORT
+GetTVPtrIndex(SiS_Private *SiS_Pr)
{
USHORT index;
index = 0;
- if (SiS_VBInfo & SetPALTV)
- index++;
- if (SiS_VBInfo & SetCRT2ToHiVisionTV) /* Hivision TV use PAL */
- index++;
+ if(SiS_Pr->SiS_VBInfo & SetPALTV) index++;
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) index++; /* Hivision TV use PAL */
index <<= 1;
- if((SiS_VBInfo & SetInSlaveMode) && (SiS_SetFlag & TVSimuMode))
+ if((SiS_Pr->SiS_VBInfo & SetInSlaveMode) && (SiS_Pr->SiS_SetFlag & TVSimuMode))
index++;
return index;
}
-/* TW: Checked against 650/LVDS (1.10.07) and 650/301LV BIOS (including data) */
-void
-SetDelayComp(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
- UCHAR *ROMAddr,USHORT ModeNo)
-{
- USHORT Part1Port;
- USHORT delay,index;
-
- if (SiS_VBInfo & SetCRT2ToRAMDAC) {
- delay = SiS310_CRT2DelayCompensation1;
- if (SiS_VBType & (VB_SIS301B | VB_SIS302B))
- delay = SiS310_CRT2DelayCompensation2;
- if(SiS_IF_DEF_LVDS == 1)
- delay = SiS310_CRT2DelayCompensation3;
- } else if (SiS_VBInfo & SetCRT2ToLCD) {
- index = GetLCDPtrIndex();
- delay = SiS310_LCDDelayCompensation1[index];
- if (SiS_VBType & (VB_SIS301B|VB_SIS302B|VB_SIS301LV))
- delay = SiS310_LCDDelayCompensation2[index];
- if(SiS_IF_DEF_LVDS == 1)
- delay = SiS310_LCDDelayCompensation3[index];
- } else {
- index = GetTVPtrIndex();
- delay = SiS310_TVDelayCompensation1[index];
- if (SiS_VBType & (VB_SIS301B | VB_SIS302B))
- delay = SiS310_TVDelayCompensation2[index];
- if(SiS_IF_DEF_LVDS == 1)
- delay = SiS310_TVDelayCompensation3[index];
- }
- Part1Port=BaseAddr+SIS_CRT2_PORT_04;
- if(SiS_IF_DEF_LVDS == 1) {
- if(SiS_VBInfo & SetCRT2ToTV) {
- SiS_SetRegANDOR(Part1Port,0x2D,0xF0,delay);
- } else {
- delay <<= 4;
- SiS_SetRegANDOR(Part1Port,0x2D,0x0F,delay);
- }
+static void
+SetDelayComp(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
+ UCHAR *ROMAddr, USHORT ModeNo)
+{
+ USHORT delay,index,myindex,temp,romptr=0;
+
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC) { /* VGA */
+
+ if((ROMAddr) && SiS_Pr->SiS_UseROM) {
+ romptr = GetRAMDACromptr(SiS_Pr, HwDeviceExtension, ROMAddr);
+ if(!romptr) return;
+ delay = ROMAddr[romptr];
+ } else {
+ delay = 0x04;
+ if(SiS_Pr->SiS_VBType & VB_SIS301B302B) {
+ if(IS_SIS650) {
+ delay = 0x0a;
+ } else if(IS_SIS740) {
+ delay = 0x00;
+ } else if(HwDeviceExtension->jChipType < SIS_330) {
+ delay = 0x0c;
+ } else {
+ delay = 0x0c;
+ }
+ }
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1)
+ delay = 0x00;
+ }
+
+ } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { /* LCD */
+
+ index = GetLCDPtrIndexBIOS(SiS_Pr);
+ myindex = GetLCDPtrIndex(SiS_Pr);
+
+ if(IS_SIS650 && (SiS_Pr->SiS_VBType & VB_SIS301LV302LV)) { /* 650+30xLV */
+ if(SiS_IsNotM650or651(SiS_Pr,HwDeviceExtension, BaseAddr)) {
+ if((ROMAddr) && SiS_Pr->SiS_UseROM) {
+#if 0 /* Always use the second pointer on 650; some BIOSes */
+ /* still carry old 301 data at the first location */
+ romptr = ROMAddr[0x120] | (ROMAddr[0x121] << 8);
+ if(SiS_Pr->SiS_VBType & VB_SIS302LV)
+#endif
+ romptr = ROMAddr[0x122] | (ROMAddr[0x123] << 8);
+ if(!romptr) return;
+ delay = ROMAddr[(romptr + index)];
+ } else {
+ delay = SiS310_LCDDelayCompensation_650301B[myindex];
+#if 0
+ if(SiS_Pr->SiS_VBType & VB_SIS302LV)
+ delay = SiS310_LCDDelayCompensation_650301B[myindex];
+#endif
+ }
+ } else {
+ delay = SiS310_LCDDelayCompensation_651301LV[myindex];
+ if(SiS_Pr->SiS_VBType & VB_SIS302LV)
+ delay = SiS310_LCDDelayCompensation_651302LV[myindex];
+ }
+ } else {
+ if((ROMAddr) && SiS_Pr->SiS_UseROM && /* 315, 330, 740, 650+301B */
+ (SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x1024)) {
+ romptr = GetLCDromptr(SiS_Pr, HwDeviceExtension, ROMAddr);
+ if(!romptr) return;
+ delay = ROMAddr[(romptr + index)];
+ } else {
+ delay = SiS310_LCDDelayCompensation_301[myindex];
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+#if 0 /* This data is (like the one in the BIOS) wrong. */
+ if(IS_SIS650740) { /* V */
+ delay = SiS310_LCDDelayCompensation_650301B[myindex];
+ } else {
+#endif
+ delay = SiS310_LCDDelayCompensation_3xx301B[myindex];
+#if 0
+ }
+#endif
+ }
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1)
+ delay = SiS310_LCDDelayCompensation_LVDS[myindex];
+ }
+ }
+
+ } else { /* TV */
+
+ index = GetTVPtrIndex(SiS_Pr);
+
+ if(IS_SIS650 && (SiS_Pr->SiS_VBType & VB_SIS301LV302LV)) {
+ if(SiS_IsNotM650or651(SiS_Pr,HwDeviceExtension, BaseAddr)) {
+ if((ROMAddr) && SiS_Pr->SiS_UseROM) {
+#if 0 /* Always use the second pointer on 650; some BIOSes */
+ /* still carry old 301 data at the first location */
+ romptr = ROMAddr[0x114] | (ROMAddr[0x115] << 8);
+ if(SiS_Pr->SiS_VBType & VB_SIS302LV)
+#endif
+ romptr = ROMAddr[0x11a] | (ROMAddr[0x11b] << 8);
+ if(!romptr) return;
+ delay = ROMAddr[romptr + index];
+ } else {
+ delay = SiS310_TVDelayCompensation_301B[index];
+#if 0
+ if(SiS_Pr->SiS_VBType & VB_SIS302LV)
+ delay = SiS310_TVDelayCompensation_301B[index];
+#endif
+ }
+ } else {
+ delay = SiS310_TVDelayCompensation_651301LV[index];
+ if(SiS_Pr->SiS_VBType & VB_SIS302LV)
+ delay = SiS310_TVDelayCompensation_651302LV[index];
+ }
+ } else {
+ if((ROMAddr) && SiS_Pr->SiS_UseROM) {
+ romptr = GetTVromptr(SiS_Pr, HwDeviceExtension, ROMAddr);
+ if(!romptr) return;
+ delay = ROMAddr[romptr + index];
+ } else {
+ delay = SiS310_TVDelayCompensation_301[index];
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ if(IS_SIS740)
+ delay = SiS310_TVDelayCompensation_740301B[index];
+ else
+ delay = SiS310_TVDelayCompensation_301B[index];
+ }
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1)
+ delay = SiS310_TVDelayCompensation_LVDS[index];
+ }
+ }
+
+ }
+
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2D,0xF0,delay);
+ } else {
+ if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
+ delay <<= 4;
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2D,0x0F,delay);
+ } else {
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2D,0xF0,delay);
+ }
+ }
} else {
- SiS_SetRegANDOR(Part1Port,0x2D,0xF0,delay); /* index 2D D[3:0] */
+ if(IS_SIS650 && (SiS_Pr->SiS_VBType & VB_SIS301LV302LV)) {
+ temp = (SiS_GetReg1(SiS_Pr->SiS_P3d4,0x36) & 0xf0) >> 4;
+ if(temp == 8) {
+ delay &= 0x0f;
+ delay |= 0xb0;
+ } else if(temp == 6) {
+ delay &= 0x0f;
+ delay |= 0xc0;
+ }
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x2D,delay); /* index 2D D[3:0] */
+ } else {
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2D,0xF0,delay);
+ }
}
}
-/* TW: Checked against 650/301LV BIOS (including data) */
-void
-SetAntiFlicker(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
+static void
+SetAntiFlicker(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex)
{
- USHORT Part2Port;
- USHORT index,temp;
-
- Part2Port=BaseAddr+SIS_CRT2_PORT_10;
+ USHORT index,temp,romptr=0;
- temp = GetTVPtrIndex();
- temp >>= 1; /* 0: NTSC, 1 :PAL, 2:HiTV */
+ temp = GetTVPtrIndex(SiS_Pr);
+ temp >>= 1; /* 0: NTSC, 1: PAL, 2: HiTV */
- if (ModeNo<=0x13)
- index = SiS_SModeIDTable[ModeIdIndex].VB_StTVFlickerIndex;
+ if(ModeNo<=0x13)
+ index = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].VB_StTVFlickerIndex;
else
- index = SiS_EModeIDTable[ModeIdIndex].VB_ExtTVFlickerIndex;
+ index = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].VB_ExtTVFlickerIndex;
- temp = SiS310_TVAntiFlick1[temp][index];
- temp <<= 4;
+ if(ROMAddr && SiS_Pr->SiS_UseROM) {
+ romptr = ROMAddr[0x112] | (ROMAddr[0x113] << 8);
+ if(HwDeviceExtension->jChipType == SIS_330) {
+ romptr = ROMAddr[0x192] | (ROMAddr[0x193] << 8);
+ }
+ }
- SiS_SetRegANDOR(Part2Port,0x0A,0x8f,temp); /* index 0A D[6:4] */
+ if(romptr) {
+ temp <<= 1;
+ temp = ROMAddr[romptr + temp + index];
+ } else {
+ temp = SiS310_TVAntiFlick1[temp][index];
+ }
+ temp <<= 4;
+
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x0A,0x8f,temp); /* index 0A D[6:4] */
}
-/* TW: Checked against 650/301LV BIOS (including data) */
-void
-SetEdgeEnhance(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
+static void
+SetEdgeEnhance(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex)
{
- USHORT Part2Port;
- USHORT index,temp;
+ USHORT index,temp,romptr=0;
- Part2Port = BaseAddr + SIS_CRT2_PORT_10;
+ temp = GetTVPtrIndex(SiS_Pr);
+ temp >>= 1; /* 0: NTSC, 1: PAL, 2: HiTV */
- temp = GetTVPtrIndex();
- temp >>= 1; /* 0: NTSC, 1 :PAL, 2:HiTV */
-
- if (ModeNo<=0x13)
- index = SiS_SModeIDTable[ModeIdIndex].VB_StTVEdgeIndex;
+ if(ModeNo<=0x13)
+ index = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].VB_StTVEdgeIndex;
else
- index = SiS_EModeIDTable[ModeIdIndex].VB_ExtTVEdgeIndex;
+ index = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].VB_ExtTVEdgeIndex;
+
+ if(ROMAddr && SiS_Pr->SiS_UseROM) {
+ romptr = ROMAddr[0x124] | (ROMAddr[0x125] << 8);
+ if(HwDeviceExtension->jChipType == SIS_330) {
+ romptr = ROMAddr[0x1a4] | (ROMAddr[0x1a5] << 8);
+ }
+ }
- temp = SiS310_TVEdge1[temp][index];
+ if(romptr) {
+ temp <<= 1;
+ temp = ROMAddr[romptr + temp + index];
+ } else {
+ temp = SiS310_TVEdge1[temp][index];
+ }
temp <<= 5;
- SiS_SetRegANDOR(Part2Port,0x3A,0x1F,temp); /* index 0A D[7:5] */
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x3A,0x1F,temp); /* index 0A D[7:5] */
}
-/* TW: Checked against 650/301LV BIOS */
-void
-SetYFilter(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
+static void
+SetYFilter(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex)
{
- USHORT Part2Port;
- USHORT index,temp,i,j;
- UCHAR OutputSelect=*pSiS_OutputSelect;
-
- Part2Port = BaseAddr + SIS_CRT2_PORT_10;
+ USHORT index, temp, i, j;
+ UCHAR OutputSelect = *SiS_Pr->pSiS_OutputSelect;
- temp = GetTVPtrIndex();
- temp >>= 1; /* 0: NTSC, 1 :PAL, 2:HiTV */
+ temp = GetTVPtrIndex(SiS_Pr);
+ temp >>= 1; /* 0: NTSC, 1: PAL, 2: HiTV */
if (ModeNo<=0x13) {
- index = SiS_SModeIDTable[ModeIdIndex].VB_StTVYFilterIndex;
+ index = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].VB_StTVYFilterIndex;
} else {
- index = SiS_EModeIDTable[ModeIdIndex].VB_ExtTVYFilterIndex;
+ index = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].VB_ExtTVYFilterIndex;
}
- if (SiS_VBInfo&SetCRT2ToHiVisionTV) /* Hivision TV uses PAL */
- temp = 0;
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) temp = 1; /* Hivision TV uses PAL */
- if(SiS_VBType & VB_SIS301BLV302BLV) {
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
for(i=0x35, j=0; i<=0x38; i++, j++) {
- SiS_SetReg1(Part2Port,i,SiS310_TVYFilter2[temp][index][j]);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,SiS310_TVYFilter2[temp][index][j]);
}
for(i=0x48; i<=0x4A; i++, j++) {
- SiS_SetReg1(Part2Port,i,SiS310_TVYFilter2[temp][index][j]);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,SiS310_TVYFilter2[temp][index][j]);
}
} else {
for(i=0x35, j=0; i<=0x38; i++, j++){
- SiS_SetReg1(Part2Port,i,SiS310_TVYFilter1[temp][index][j]);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,SiS310_TVYFilter1[temp][index][j]);
}
}
+ if(ROMAddr && SiS_Pr->SiS_UseROM) {
+ OutputSelect = ROMAddr[0xf3];
+ if(HwDeviceExtension->jChipType == SIS_330) {
+ OutputSelect = ROMAddr[0x11b];
+ }
+ }
if(OutputSelect & EnablePALMN) {
- if(SiS_GetReg1(SiS_P3d4,0x31) & 0x01) {
- temp = SiS_GetReg1(SiS_P3d4,0x38);
- temp &= (EnablePALMN | EnablePALN);
- if(temp == EnablePALMN) {
- if(SiS_VBType & VB_SIS301BLV302BLV) {
- for(i=0x35, j=0; i<=0x38; i++, j++){
- SiS_SetReg1(Part2Port,i,SiS310_PALMFilter2[index][j]);
+ if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x31) & 0x01) {
+ temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38);
+ temp &= (EnablePALM | EnablePALN);
+ if(temp == EnablePALM) {
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ for(i=0x35, j=0; i<=0x38; i++, j++) {
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,SiS310_PALMFilter2[index][j]);
}
for(i=0x48; i<=0x4A; i++, j++) {
- SiS_SetReg1(Part2Port,i,SiS310_PALMFilter2[index][j]);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,SiS310_PALMFilter2[index][j]);
}
} else {
for(i=0x35, j=0; i<=0x38; i++, j++) {
- SiS_SetReg1(Part2Port,i,SiS310_PALMFilter[index][j]);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,SiS310_PALMFilter[index][j]);
}
}
}
if(temp == EnablePALN) {
- if(SiS_VBType & VB_SIS301BLV302BLV) {
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
for(i=0x35, j=0; i<=0x38; i++, j++) {
- SiS_SetReg1(Part2Port,i,SiS310_PALNFilter2[index][j]);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,SiS310_PALNFilter2[index][j]);
}
for(i=0x48, j=0; i<=0x4A; i++, j++) {
- SiS_SetReg1(Part2Port,i,SiS310_PALNFilter2[index][j]);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,SiS310_PALNFilter2[index][j]);
}
} else {
- for(i=0x35, j=0; i<=0x38; i++, j++)
- SiS_SetReg1(Part2Port,i,SiS310_PALNFilter[index][j]);
+ for(i=0x35, j=0; i<=0x38; i++, j++) {
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,SiS310_PALNFilter[index][j]);
+ }
}
}
}
}
}
-/* TW: Checked against 650/301LV BIOS (including data) */
-void
-SetPhaseIncr(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
- UCHAR *ROMAddr,USHORT ModeNo)
+static void
+SetPhaseIncr(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
+ UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex)
{
- USHORT Part2Port;
- USHORT index,temp,temp1,i,j;
+ USHORT index,temp,temp1,i,j,resinfo,romptr=0;
- if(!(SiS_VBInfo & SetCRT2ToTV)) return;
+ if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) return;
- temp1 = SiS_GetReg1(SiS_P3d4,0x38); /* if PALM/N not set */
- temp1 &= (EnablePALMN | EnablePALN);
+ temp1 = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38); /* if PALM/N not set */
+ temp1 &= (EnablePALM | EnablePALN);
if(temp1) return;
- Part2Port=BaseAddr + SIS_CRT2_PORT_10;
+ if (ModeNo<=0x13) {
+ resinfo = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo;
+ } else {
+ resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
+ }
- temp = GetTVPtrIndex();
- /* 0: NTSC Graphics, 1: NTSC Text, 2:PAL Graphics,
- * 3: PAL Text, 4: HiTV Graphics 5:HiTV Text
+ temp = GetTVPtrIndex(SiS_Pr);
+ /* 0: NTSC Graphics, 1: NTSC Text, 2: PAL Graphics,
+ * 3: PAL Text, 4: HiTV Graphics 5: HiTV Text
*/
- index = temp % 2;
- temp >>= 1; /* 0:NTSC, 1:PAL, 2:HiTV */
-
- for(j=0, i=0x31; i<=0x34; i++, j++) {
- if(!(SiS_VBType & VB_SIS301BLV302BLV))
- SiS_SetReg1(Part2Port,i,SiS310_TVPhaseIncr1[temp][index][j]);
- else if((!(SiS_VBInfo & SetInSlaveMode)) || (SiS_SetFlag & TVSimuMode))
- SiS_SetReg1(Part2Port,i,SiS310_TVPhaseIncr2[temp][index][j]);
- else
- SiS_SetReg1(Part2Port,i,SiS310_TVPhaseIncr1[temp][index][j]);
- }
- if(SiS_VBType & (VB_SIS301LV | VB_SIS302LV)) {
- if(!(SiS_VBInfo & SetPALTV)) {
- if((ModeNo == 0x38) || (ModeNo == 0x4a)) {
- SiS_SetReg1(SiS_Part2Port,0x31,0x1e);
- SiS_SetReg1(SiS_Part2Port,0x32,0x8c);
- SiS_SetReg1(SiS_Part2Port,0x33,0x5c);
- SiS_SetReg1(SiS_Part2Port,0x34,0x7a);
+ if((ROMAddr) && SiS_Pr->SiS_UseROM) {
+ romptr = ROMAddr[0x116] | (ROMAddr[0x117] << 8);
+ if(HwDeviceExtension->jChipType == SIS_330) {
+ romptr = ROMAddr[0x196] | (ROMAddr[0x197] << 8);
+ }
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ romptr = ROMAddr[0x11c] | (ROMAddr[0x11d] << 8);
+ if(HwDeviceExtension->jChipType == SIS_330) {
+ romptr = ROMAddr[0x19c] | (ROMAddr[0x19d] << 8);
+ }
+ if((SiS_Pr->SiS_VBInfo & SetInSlaveMode) && (!(SiS_Pr->SiS_SetFlag & TVSimuMode))) {
+ romptr = ROMAddr[0x116] | (ROMAddr[0x117] << 8);
+ if(HwDeviceExtension->jChipType == SIS_330) {
+ romptr = ROMAddr[0x196] | (ROMAddr[0x197] << 8);
+ }
+ }
+ }
+ }
+ if(romptr) {
+ romptr += (temp << 2);
+ for(j=0, i=0x31; i<=0x34; i++, j++) {
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,ROMAddr[romptr + j]);
+ }
+ } else {
+ index = temp % 2;
+ temp >>= 1; /* 0:NTSC, 1:PAL, 2:HiTV */
+ for(j=0, i=0x31; i<=0x34; i++, j++) {
+ if(!(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV))
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,SiS310_TVPhaseIncr1[temp][index][j]);
+ else if((!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) || (SiS_Pr->SiS_SetFlag & TVSimuMode))
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,SiS310_TVPhaseIncr2[temp][index][j]);
+ else
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,SiS310_TVPhaseIncr1[temp][index][j]);
+ }
+ }
+
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { /* TW: 650/301LV: (VB_SIS301LV | VB_SIS302LV)) */
+ if((!(SiS_Pr->SiS_VBInfo & SetPALTV)) && (ModeNo > 0x13)) {
+ if(resinfo == 6) {
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x31,0x21);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x32,0xf0);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x33,0xf5);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x34,0x7f);
+ } else if (resinfo == 7) {
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x31,0x21);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x32,0xf0);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x33,0xf5);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x34,0x7f);
+ } else if (resinfo == 8) {
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x31,0x1e);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x32,0x8b);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x33,0xfb);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x34,0x7b);
}
}
}
}
void
-SiS_OEM310Setting(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
+SiS_OEM310Setting(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex)
{
- SetDelayComp(HwDeviceExtension,BaseAddr,ROMAddr,ModeNo);
- /* TW: The TV funtions are not for LVDS */
- if( (SiS_IF_DEF_LVDS == 0) && (SiS_VBInfo & SetCRT2ToTV) ) {
- SetAntiFlicker(HwDeviceExtension,BaseAddr,ROMAddr,ModeNo,ModeIdIndex);
- SetPhaseIncr(HwDeviceExtension,BaseAddr,ROMAddr,ModeNo);
- SetYFilter(HwDeviceExtension,BaseAddr,ROMAddr,ModeNo,ModeIdIndex);
- if(!(SiS_VBType & VB_SIS301BLV302BLV)) {
- SetEdgeEnhance(HwDeviceExtension,BaseAddr,ROMAddr,ModeNo,ModeIdIndex);
+ SetDelayComp(SiS_Pr,HwDeviceExtension,BaseAddr,ROMAddr,ModeNo);
+ /* TW: The TV functions are not for LVDS */
+ if( (SiS_Pr->SiS_IF_DEF_LVDS == 0) && (SiS_Pr->SiS_VBInfo & SetCRT2ToTV) ) {
+ SetAntiFlicker(SiS_Pr,HwDeviceExtension,BaseAddr,ROMAddr,ModeNo,ModeIdIndex);
+ SetPhaseIncr(SiS_Pr,HwDeviceExtension,BaseAddr,ROMAddr,ModeNo,ModeIdIndex);
+ SetYFilter(SiS_Pr,HwDeviceExtension,BaseAddr,ROMAddr,ModeNo,ModeIdIndex);
+ if(!(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) {
+ SetEdgeEnhance(SiS_Pr,HwDeviceExtension,BaseAddr,ROMAddr,ModeNo,ModeIdIndex);
}
}
}
+/* FinalizeLCD
+ * This finalizes some Part1 registers for the very panel used.
+ * If we have a backup if these registers, we use it; otherwise
+ * we set the register according to most BIOSes. However, this
+ * function looks quite different in every BIOS, so you better
+ * pray that we have a backup...
+ */
+void
+SiS_FinalizeLCD(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,
+ USHORT ModeIdIndex, PSIS_HW_DEVICE_INFO HwDeviceExtension)
+{
+ USHORT tempcl,tempch,tempbl,tempbh,tempbx,tempax,temp;
+ USHORT resinfo,modeflag;
+
+ if(!(SiS_Pr->SiS_VBType & VB_SIS301LV302LV)) return;
+
+ if(ModeNo <= 0x13) {
+ resinfo = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo;
+ modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
+ } else {
+ resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
+ modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ }
+
+ if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) {
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x2a,0x00);
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x30,0x00);
+ SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x34,0x10);
+ }
+ tempch = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x36);
+ tempch &= 0xf0;
+ tempch >>= 4;
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) {
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) {
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1f,0x76);
+ }
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) {
+ if((SiS_Pr->Backup == TRUE) && (SiS_Pr->Backup_Mode == ModeNo)) {
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x14,SiS_Pr->Backup_14);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x15,SiS_Pr->Backup_15);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x16,SiS_Pr->Backup_16);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x17,SiS_Pr->Backup_17);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x18,SiS_Pr->Backup_18);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x19,SiS_Pr->Backup_19);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1a,SiS_Pr->Backup_1a);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1b,SiS_Pr->Backup_1b);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1c,SiS_Pr->Backup_1c);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1d,SiS_Pr->Backup_1d);
+ } else if(!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) { /* From 1.10.8w */
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x14,0x90);
+ if(ModeNo <= 0x13) {
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x18,0x11);
+ if((resinfo == 0) && (resinfo == 2)) return;
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x18,0x18);
+ if((resinfo == 1) && (resinfo == 3)) return;
+ }
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x18,0x02);
+ if((ModeNo > 0x13) && (resinfo == 8)) {
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x18,0x02); /* 1.10.7u */
+#if 0
+ tempbx = 806; /* 0x326 */ /* other older BIOSes */
+ tempbx--;
+ temp = tempbx & 0xff;
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1b,temp);
+ temp = (tempbx >> 8) & 0x03;
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x1d,0xf8,temp);
+#endif
+ }
+ } else {
+ if(ModeNo <= 0x13) {
+ if(ModeNo <= 1) {
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x18,0x70);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x19,0xff);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1b,0x48);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1d,0x12);
+ }
+ if(!(modeflag & HalfDCLK)) {
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x14,0x20);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x15,0x1a);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x16,0x28);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x17,0x00);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x18,0x4c);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x19,0xdc);
+ if(ModeNo == 0x12) {
+ switch(tempch) {
+ case 0:
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x18,0x95);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x19,0xdc);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1a,0x10);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1b,0x95);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1c,0x48);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1d,0x12);
+ break;
+ case 2:
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x18,0x95);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1b,0x48);
+ break;
+ case 3:
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x1b,0x95);
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ } else {
+ tempcl = tempbh = SiS_GetReg1(SiS_Pr->SiS_Part2Port,0x01);
+ tempcl &= 0x0f;
+ tempbh &= 0x70;
+ tempbh >>= 4;
+ tempbl = SiS_GetReg1(SiS_Pr->SiS_Part2Port,0x04);
+ tempbx = (tempbh << 8) | tempbl;
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) {
+ if((resinfo == 8) || (!(SiS_Pr->SiS_LCDInfo & DontExpandLCD))) {
+ if(SiS_Pr->SiS_SetFlag & LCDVESATiming) {
+ tempbx = 770;
+ } else {
+ if(tempbx > 770) tempbx = 770;
+ if(SiS_Pr->SiS_VGAVDE < 600) {
+ tempax = 768 - SiS_Pr->SiS_VGAVDE;
+ tempax >>= 4; /* From 1.10.7w; 1.10.6s: 3; */
+ if(SiS_Pr->SiS_VGAVDE <= 480) tempax >>= 4; /* From 1.10.7w; 1.10.6s: < 480; >>=1; */
+ tempbx -= tempax;
+ }
+ }
+ } else return;
+ }
+#if 0
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) {
+ }
+#endif
+ temp = tempbx & 0xff;
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x04,temp);
+ temp = (tempbx & 0xff00) >> 8;
+ temp <<= 4;
+ temp |= tempcl;
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x01,0x80,temp);
+ }
+ }
+}
+
+#if 0
/* TW: New and checked from 650/301LV BIOS */
+/* This might clash with newer "FinalizeLCD()" function */
void
-SiS_OEMLCD(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
+SiS_OEMLCD(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex)
{
USHORT tempbx,tempah,tempbl,tempbh,tempcl;
- if(SiS_IF_DEF_LVDS == 1) return;
+ if(!(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) return;
- if(SiS_VBInfo & SetCRT2ToLCDA) {
- SiS_UnLockCRT2(HwDeviceExtension,BaseAddr);
- tempbh = SiS_GetReg1(SiS_Part1Port,0x1a);
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) {
+ SiS_UnLockCRT2(SiS_Pr,HwDeviceExtension,BaseAddr);
+ tempbh = SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x1a);
tempbh &= 0x38;
tempbh >>= 3;
- tempbl = SiS_GetReg1(SiS_Part1Port,0x18);
+ tempbl = SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x18);
tempbx = (tempbh << 8) | tempbl;
- if(SiS_LCDTypeInfo == 1) tempbx -= 0x12;
- SiS_SetReg1(SiS_Part1Port,0x18,tempbx & 0x00ff);
+ if(SiS_Pr->SiS_LCDTypeInfo == 1) tempbx -= 0x12;
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x18,tempbx & 0x00ff);
tempah = (tempbx & 0xff00) >> 8;
tempah &= 0x07;
tempah <<= 3;
- SiS_SetRegANDOR(SiS_Part1Port,0x1a,0xc7,tempah);
- tempah = SiS_GetReg1(SiS_Part1Port,0x19);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x1a,0xc7,tempah);
+ tempah = SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x19);
tempah &= 0x0f;
- if(SiS_LCDTypeInfo == 1) tempah -= 2;
+ if(SiS_Pr->SiS_LCDTypeInfo == 1) tempah -= 2;
tempah &= 0x0f;
- SiS_SetRegANDOR(SiS_Part1Port,0x19,0xF0,tempah);
- tempah = SiS_GetReg1(SiS_Part1Port,0x14);
- if(SiS_LCDTypeInfo == 1) tempah++;
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0xF0,tempah);
+ tempah = SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x14);
+ if(SiS_Pr->SiS_LCDTypeInfo == 1) tempah++;
tempah -= 8;
- SiS_SetReg1(SiS_Part1Port,0x14,tempah);
- } else if(SiS_VBInfo & SetCRT2ToLCD) {
- tempcl = tempbh = SiS_GetReg1(SiS_Part2Port,0x01);
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x14,tempah);
+ } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ tempcl = tempbh = SiS_GetReg1(SiS_Pr->SiS_Part2Port,0x01);
tempbh &= 0x70;
tempbh >>= 4;
- tempbl = SiS_GetReg1(SiS_Part2Port,0x04);
+ tempbl = SiS_GetReg1(SiS_Pr->SiS_Part2Port,0x04);
tempbx = (tempbh << 8) | tempbl;
- if(SiS_LCDTypeInfo == 1) {
+ if(SiS_Pr->SiS_LCDTypeInfo == 1) {
tempbx -= 0x1e;
tempcl &= 0x0f;
tempcl -= 4;
@@ -8034,22 +11208,24 @@ SiS_OEMLCD(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
}
tempbl = tempbx & 0x00ff;
tempbh = (tempbx >> 8) & 0x00ff;
- SiS_SetReg1(SiS_Part2Port,0x04,tempbl);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x04,tempbl);
tempbh <<= 4;
tempbh |= tempcl;
- SiS_SetRegANDOR(SiS_Part2Port,0x01,0x80,tempbh);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x01,0x80,tempbh);
}
}
#endif
+#endif
+
/* ================= SiS 300 O.E.M. ================== */
#ifdef SIS300
#if 0 /* Not used */
-USHORT
-GetRevisionID(PSIS_HW_DEVICE_INFO HwDeviceExtension)
+static USHORT
+GetRevisionID(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension)
{
ULONG temp1;
#ifndef LINUX_XF86
@@ -8075,225 +11251,357 @@ GetRevisionID(PSIS_HW_DEVICE_INFO HwDeviceExtension)
}
#endif
-/* TW: Checked against 630/301B BIOS (incl data) */
-USHORT
-GetOEMLCDPtr(PSIS_HW_DEVICE_INFO HwDeviceExtension, int Flag)
+static USHORT
+GetOEMLCDPtr(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, UCHAR *ROMAddr, int Flag)
{
- USHORT tempbx=0;
- UCHAR customtable[] = {
+ USHORT tempbx=0,romptr=0;
+ UCHAR customtable300[] = {
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
+ };
+ UCHAR customtable630[] = {
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
};
- if(Flag) {
- if(customtable[SiS_LCDTypeInfo] == 0xFF) return 0xFFFF;
- }
- if(SiS_IF_DEF_LVDS == 0) {
- tempbx = SiS_LCDTypeInfo << 2;
- if(SiS_VBInfo & SetInSlaveMode) tempbx += 2;
- if(SiS_LCDInfo & LCDNonExpanding) tempbx++;
+ if(HwDeviceExtension->jChipType == SIS_300) {
+
+ tempbx = SiS_Pr->SiS_LCDResInfo - 2;
+ if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) tempbx += 4;
+ if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) {
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx += 3;
+ }
+ if((ROMAddr) && SiS_Pr->SiS_UseROM) {
+ if(ROMAddr[0x235] & 0x80) {
+ tempbx = SiS_Pr->SiS_LCDTypeInfo;
+ if(Flag) {
+ romptr = ROMAddr[0x255] | (ROMAddr[0x256] << 8);
+ if(romptr) {
+ tempbx = ROMAddr[romptr + SiS_Pr->SiS_LCDTypeInfo];
+ } else {
+ tempbx = customtable300[SiS_Pr->SiS_LCDTypeInfo];
+ }
+ if(tempbx == 0xFF) return 0xFFFF;
+ }
+ tempbx <<= 1;
+ if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) tempbx++;
+ }
+ }
+
} else {
- tempbx = SiS_LCDTypeInfo;
- if(SiS_LCDInfo & LCDNonExpanding) tempbx += 16;
+
+ if(Flag) {
+ if((ROMAddr) && SiS_Pr->SiS_UseROM) {
+ romptr = ROMAddr[0x255] | (ROMAddr[0x256] << 8);
+ if(romptr) {
+ tempbx = ROMAddr[romptr + SiS_Pr->SiS_LCDTypeInfo];
+ } else {
+ tempbx = 0xff;
+ }
+ } else {
+ tempbx = customtable630[SiS_Pr->SiS_LCDTypeInfo];
+ }
+ if(tempbx == 0xFF) return 0xFFFF;
+ tempbx <<= 2;
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) tempbx += 2;
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx++;
+ return tempbx;
+ }
+ tempbx = SiS_Pr->SiS_LCDTypeInfo << 2;
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) tempbx += 2;
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx++;
}
return tempbx;
}
-/* TW: Checked against 630/301B and 630/LVDS BIOS (incl data) */
-void
-SetOEMLCDDelay(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
+static void
+SetOEMLCDDelay(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex)
{
- USHORT Part1Port;
- USHORT index,temp;
+ USHORT index,temp,romptr=0;
- /* TW: The Panel Compensation Delay should be set according to tables
- * here. Unfortunately, the different BIOS versions don't case about
- * a uniform way using eg. ROM byte 0x220, but use different
- * hard coded delays (0x04, 0x20, 0x18) in SetGroup1(). So we can't
- * rely on the other OEM bits in 0x237, 0x238 here either.
- */
-#if 0
- if(ROMAddr) {
+ if((ROMAddr) && SiS_Pr->SiS_UseROM) {
if(!(ROMAddr[0x237] & 0x01)) return;
if(!(ROMAddr[0x237] & 0x02)) return;
+ romptr = ROMAddr[0x24b] | (ROMAddr[0x24c] << 8);
}
-#endif
- /* TW: We just check if a non-standard delay has been set; if not,
- * we use our tables. Otherwise don't do anything here.
+
+ /* TW: The Panel Compensation Delay should be set according to tables
+ * here. Unfortunately, various BIOS versions don't case about
+ * a uniform way using eg. ROM byte 0x220, but use different
+ * hard coded delays (0x04, 0x20, 0x18) in SetGroup1().
+ * Thus we don't set this if the user select a custom pdc or if
+ * we otherwise detected a valid pdc.
*/
- if(ROMAddr) {
- if(ROMAddr[0x220] & 0x80) return;
- }
- /* TW: We don't need to set this if the user select a custom pdc */
if(HwDeviceExtension->pdc) return;
- Part1Port = BaseAddr + SIS_CRT2_PORT_04;
+ temp = GetOEMLCDPtr(SiS_Pr,HwDeviceExtension, ROMAddr, 0);
- temp = GetOEMLCDPtr(HwDeviceExtension, 0);
+ index = SiS_Pr->SiS_VBModeIDTable[ModeIdIndex].VB_LCDDelayIndex;
- index = SiS_VBModeIDTable[ModeIdIndex].VB_LCDDelayIndex;
-
- if (SiS_IF_DEF_LVDS == 0) {
- temp = SiS300_OEMLCDDelay2[temp][index];
+ if(HwDeviceExtension->jChipType != SIS_300) {
+ if(romptr) {
+ romptr += (temp * 2);
+ romptr = ROMAddr[romptr] | (ROMAddr[romptr + 1] << 8);
+ romptr += index;
+ temp = ROMAddr[romptr];
+ } else {
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
+ temp = SiS300_OEMLCDDelay2[temp][index];
+ } else {
+ temp = SiS300_OEMLCDDelay3[temp][index];
+ }
+ }
} else {
- temp = SiS300_OEMLCDDelay3[temp][index];
+ if((ROMAddr) && SiS_Pr->SiS_UseROM && (ROMAddr[0x235] & 0x80)) {
+ if(romptr) {
+ romptr += (temp * 2);
+ romptr = ROMAddr[romptr] | (ROMAddr[romptr + 1] << 8);
+ romptr += index;
+ temp = ROMAddr[romptr];
+ } else {
+ temp = SiS300_OEMLCDDelay5[temp][index];
+ }
+ } else {
+ if((ROMAddr) && SiS_Pr->SiS_UseROM) {
+ romptr = ROMAddr[0x249] | (ROMAddr[0x24a] << 8);
+ if(romptr) {
+ romptr += (temp * 2);
+ romptr = ROMAddr[romptr] | (ROMAddr[romptr + 1] << 8);
+ romptr += index;
+ temp = ROMAddr[romptr];
+ } else {
+ temp = SiS300_OEMLCDDelay4[temp][index];
+ }
+ } else {
+ temp = SiS300_OEMLCDDelay4[temp][index];
+ }
+ }
}
temp &= 0x3c;
- SiS_SetRegANDOR(Part1Port,0x13,~0x3C,temp); /* index 0A D[6:4] */
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,~0x3C,temp); /* index 0A D[6:4] */
}
-/* TW: Checked against 630/301B and 630/LVDS BIOS */
-USHORT
-GetOEMTVPtr(void)
+static void
+SetOEMLCDData(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
+ UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex)
+{
+#if 0 /* TW: Unfinished; VData table missing */
+ USHORT index,temp;
+
+ if((ROMAddr) && SiS_Pr->SiS_UseROM) {
+ if(!(ROMAddr[0x237] & 0x01)) return;
+ if(!(ROMAddr[0x237] & 0x04)) return;
+ /* No rom pointer in BIOS header! */
+ }
+
+ temp = GetOEMLCDPtr(SiS_Pr,HwDeviceExtension, ROMAddr, 1);
+ if(temp = 0xFFFF) return;
+
+ index = SiS_Pr->SiS_VBModeIDTable[ModeIdIndex]._VB_LCDHIndex;
+ for(i=0x14, j=0; i<=0x17; i++, j++) {
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,i,SiS300_LCDHData[temp][index][j]);
+ }
+ SiS_SetRegANDOR(SiS_SiS_Part1Port,0x1a, 0xf8, (SiS300_LCDHData[temp][index][j] & 0x07));
+
+ index = SiS_Pr->SiS_VBModeIDTable[ModeIdIndex]._VB_LCDVIndex;
+ SiS_SetReg1(SiS_SiS_Part1Port,0x18, SiS300_LCDVData[temp][index][0]);
+ SiS_SetRegANDOR(SiS_SiS_Part1Port,0x19, 0xF0, SiS300_LCDVData[temp][index][1]);
+ SiS_SetRegANDOR(SiS_SiS_Part1Port,0x1A, 0xC7, (SiS300_LCDVData[temp][index][2] & 0x38));
+ for(i=0x1b, j=3; i<=0x1d; i++, j++) {
+ SiS_SetReg1(SiS_Pr->SiS_Part1Port,i,SiS300_LCDVData[temp][index][j]);
+ }
+#endif
+}
+
+static USHORT
+GetOEMTVPtr(SiS_Private *SiS_Pr)
{
USHORT index;
index = 0;
- if(!(SiS_VBInfo & SetInSlaveMode)) index += 4;
- if(SiS_IF_DEF_LVDS == 0) {
- if(SiS_VBInfo & SetCRT2ToSCART) index += 2;
- else if (SiS_VBInfo & SetCRT2ToHiVisionTV) index += 3;
- else if(SiS_VBInfo & SetPALTV) index += 1;
+ if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) index += 4;
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToSCART) index += 2;
+ else if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) index += 3;
+ else if(SiS_Pr->SiS_VBInfo & SetPALTV) index += 1;
} else {
- if(SiS_VBInfo & SetCHTVOverScan) index += 2;
- if(SiS_VBInfo & SetPALTV) index += 1;
+ if(SiS_Pr->SiS_VBInfo & SetCHTVOverScan) index += 2;
+ if(SiS_Pr->SiS_VBInfo & SetPALTV) index += 1;
}
return index;
}
-/* TW: Checked against 630/301B and 630/LVDS BIOS (incl data) */
-void
-SetOEMTVDelay(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
+static void
+SetOEMTVDelay(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex)
{
- USHORT Part1Port;
- USHORT index,temp;
+ USHORT index,temp,romptr=0;
-#if 0
- if(ROMAddr) {
+ if((ROMAddr) && SiS_Pr->SiS_UseROM) {
if(!(ROMAddr[0x238] & 0x01)) return;
if(!(ROMAddr[0x238] & 0x02)) return;
+ romptr = ROMAddr[0x241] | (ROMAddr[0x242] << 8);
}
-#endif
-
- Part1Port = BaseAddr + SIS_CRT2_PORT_04;
- temp = GetOEMTVPtr();
+ temp = GetOEMTVPtr(SiS_Pr);
- index = SiS_VBModeIDTable[ModeIdIndex].VB_TVDelayIndex;
+ index = SiS_Pr->SiS_VBModeIDTable[ModeIdIndex].VB_TVDelayIndex;
- if(SiS_IF_DEF_LVDS == 0) {
- temp = SiS300_OEMTVDelay301[temp][index];
+ if(romptr) {
+ romptr += (temp * 2);
+ romptr = ROMAddr[romptr] | (ROMAddr[romptr + 1] << 8);
+ romptr += index;
+ temp = ROMAddr[romptr];
} else {
- temp = SiS300_OEMTVDelayLVDS[temp][index];
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
+ temp = SiS300_OEMTVDelay301[temp][index];
+ } else {
+ temp = SiS300_OEMTVDelayLVDS[temp][index];
+ }
}
temp &= 0x3c;
- SiS_SetRegANDOR(Part1Port,0x13,~0x3C,temp); /* index 0A D[6:4] */
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,~0x3C,temp); /* index 0A D[6:4] */
}
-/* TW: Checked against 630/301B BIOS (incl data) */
-void
-SetOEMAntiFlicker(PSIS_HW_DEVICE_INFO HwDeviceExtension,
+static void
+SetOEMAntiFlicker(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,
USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,
USHORT ModeIdIndex)
{
- USHORT Part2Port;
- USHORT index,temp;
+ USHORT index,temp,romptr=0;
- Part2Port = BaseAddr + SIS_CRT2_PORT_10;
+ if((ROMAddr) && SiS_Pr->SiS_UseROM) {
+ if(!(ROMAddr[0x238] & 0x01)) return;
+ if(!(ROMAddr[0x238] & 0x04)) return;
+ romptr = ROMAddr[0x243] | (ROMAddr[0x244] << 8);
+ }
- temp = GetOEMTVPtr();
+ temp = GetOEMTVPtr(SiS_Pr);
- index = SiS_VBModeIDTable[ModeIdIndex].VB_TVFlickerIndex;
+ index = SiS_Pr->SiS_VBModeIDTable[ModeIdIndex].VB_TVFlickerIndex;
- temp = SiS300_OEMTVFlicker[temp][index];
+ if(romptr) {
+ romptr += (temp * 2);
+ romptr = ROMAddr[romptr] | (ROMAddr[romptr + 1] << 8);
+ romptr += index;
+ temp = ROMAddr[romptr];
+ } else {
+ temp = SiS300_OEMTVFlicker[temp][index];
+ }
temp &= 0x70;
- SiS_SetRegANDOR(Part2Port,0x0A,0x8F,temp); /* index 0A D[6:4] */
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x0A,0x8F,temp); /* index 0A D[6:4] */
}
-/* TW: Checked against 630/301B BIOS (incl data) */
-void
-SetOEMPhaseIncr(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
+static void
+SetOEMPhaseIncr(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex)
{
- USHORT Part2Port;
- USHORT index,i,j,temp;
+ USHORT index,i,j,temp,romptr=0;
- if(SiS_VBInfo & SetCRT2ToHiVisionTV) return;
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) return;
- Part2Port = BaseAddr + SIS_CRT2_PORT_10;
+ if((ROMAddr) && SiS_Pr->SiS_UseROM) {
+ if(!(ROMAddr[0x238] & 0x01)) return;
+ if(!(ROMAddr[0x238] & 0x08)) return;
+ romptr = ROMAddr[0x245] | (ROMAddr[0x246] << 8);
+ }
- temp = GetOEMTVPtr();
+ temp = GetOEMTVPtr(SiS_Pr);
- index = SiS_VBModeIDTable[ModeIdIndex].VB_TVPhaseIndex;
+ index = SiS_Pr->SiS_VBModeIDTable[ModeIdIndex].VB_TVPhaseIndex;
- if(SiS_VBType & VB_SIS301BLV302BLV) {
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
for(i=0x31, j=0; i<=0x34; i++, j++) {
- SiS_SetReg1(Part2Port,i,SiS300_Phase2[temp][index][j]);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,SiS300_Phase2[temp][index][j]);
}
} else {
- for(i=0x31, j=0; i<=0x34; i++, j++) {
- SiS_SetReg1(Part2Port,i,SiS300_Phase1[temp][index][j]);
+ if(romptr) {
+ romptr += (temp * 2);
+ romptr = ROMAddr[romptr] | (ROMAddr[romptr + 1] << 8);
+ romptr += (index * 4);
+ for(i=0x31, j=0; i<=0x34; i++, j++) {
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,ROMAddr[romptr + j]);
+ }
+ } else {
+ for(i=0x31, j=0; i<=0x34; i++, j++) {
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,SiS300_Phase1[temp][index][j]);
+ }
}
}
}
-/* TW: Checked against 630/301B BIOS (incl data) */
-void
-SetOEMYFilter(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
+static void
+SetOEMYFilter(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex)
{
- USHORT Part2Port;
- USHORT index,temp,temp1,i,j;
+ USHORT index,temp,temp1,i,j,romptr=0;
- if(SiS_VBInfo & (SetCRT2ToSCART | SetCRT2ToHiVisionTV)) return;
+ if(SiS_Pr->SiS_VBInfo & (SetCRT2ToSCART | SetCRT2ToHiVisionTV)) return;
- Part2Port = BaseAddr + SIS_CRT2_PORT_10;
+ if((ROMAddr) && SiS_Pr->SiS_UseROM) {
+ if(!(ROMAddr[0x238] & 0x01)) return;
+ if(!(ROMAddr[0x238] & 0x10)) return;
+ romptr = ROMAddr[0x247] | (ROMAddr[0x248] << 8);
+ }
- temp = GetOEMTVPtr();
+ temp = GetOEMTVPtr(SiS_Pr);
- index = SiS_VBModeIDTable[ModeIdIndex].VB_TVYFilterIndex;
+ index = SiS_Pr->SiS_VBModeIDTable[ModeIdIndex].VB_TVYFilterIndex;
- if(SiS_GetReg1(SiS_P3d4,0x31) & 0x01) {
- temp1 = SiS_GetReg1(SiS_P3d4,0x35);
- if(temp1 & (EnablePALMN | EnablePALN)) {
- temp = 16;
- if(temp1 & EnablePALN) temp = 18;
+ if(HwDeviceExtension->jChipType > SIS_300) {
+ if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x31) & 0x01) {
+ temp1 = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x35);
+ if(temp1 & (EnablePALM | EnablePALN)) {
+ temp = 8;
+ if(!(temp1 & EnablePALM)) temp = 9;
}
+ }
}
- if(SiS_VBType & VB_SIS301BLV302BLV) {
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
for(i=0x35, j=0; i<=0x38; i++, j++) {
- SiS_SetReg1(Part2Port,i,SiS300_Filter2[temp][index][j]);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,SiS300_Filter2[temp][index][j]);
}
for(i=0x48; i<=0x4A; i++, j++) {
- SiS_SetReg1(Part2Port,i,SiS300_Filter2[temp][index][j]);
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,SiS300_Filter2[temp][index][j]);
}
} else {
- for(i=0x35, j=0; i<=0x38; i++, j++) {
- SiS_SetReg1(Part2Port,i,SiS300_Filter1[temp][index][j]);
+ if(romptr) {
+ romptr += (temp * 2);
+ romptr = ROMAddr[romptr] | (ROMAddr[romptr + 1] << 8);
+ romptr += (index * 4);
+ for(i=0x35, j=0; i<=0x38; i++, j++) {
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,ROMAddr[romptr + j]);
+ }
+ } else {
+ for(i=0x35, j=0; i<=0x38; i++, j++) {
+ SiS_SetReg1(SiS_Pr->SiS_Part2Port,i,SiS300_Filter1[temp][index][j]);
+ }
}
}
}
void
-SiS_OEM300Setting(PSIS_HW_DEVICE_INFO HwDeviceExtension,
+SiS_OEM300Setting(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,
USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo)
{
USHORT ModeIdIndex;
- ModeIdIndex = SiS_SearchVBModeID(ROMAddr,&ModeNo);
+ ModeIdIndex = SiS_SearchVBModeID(SiS_Pr,ROMAddr,&ModeNo);
if(!(ModeIdIndex)) return;
- if (SiS_VBInfo & SetCRT2ToLCD) {
- SetOEMLCDDelay(HwDeviceExtension,BaseAddr,ROMAddr,ModeNo,ModeIdIndex);
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ SetOEMLCDDelay(SiS_Pr,HwDeviceExtension,BaseAddr,ROMAddr,ModeNo,ModeIdIndex);
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
+ SetOEMLCDData(SiS_Pr,HwDeviceExtension,BaseAddr,ROMAddr,ModeNo,ModeIdIndex);
+ }
}
- if (SiS_VBInfo & SetCRT2ToTV) {
- SetOEMTVDelay(HwDeviceExtension,BaseAddr,ROMAddr,ModeNo,ModeIdIndex);
- if(SiS_IF_DEF_LVDS==0) {
- SetOEMAntiFlicker(HwDeviceExtension,BaseAddr,ROMAddr,ModeNo,ModeIdIndex);
- SetOEMPhaseIncr(HwDeviceExtension,BaseAddr,ROMAddr,ModeNo,ModeIdIndex);
- SetOEMYFilter(HwDeviceExtension,BaseAddr,ROMAddr,ModeNo,ModeIdIndex);
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
+ SetOEMTVDelay(SiS_Pr,HwDeviceExtension,BaseAddr,ROMAddr,ModeNo,ModeIdIndex);
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
+ SetOEMAntiFlicker(SiS_Pr,HwDeviceExtension,BaseAddr,ROMAddr,ModeNo,ModeIdIndex);
+ SetOEMPhaseIncr(SiS_Pr,HwDeviceExtension,BaseAddr,ROMAddr,ModeNo,ModeIdIndex);
+ SetOEMYFilter(SiS_Pr,HwDeviceExtension,BaseAddr,ROMAddr,ModeNo,ModeIdIndex);
}
}
}
diff --git a/drivers/video/sis/init301.h b/drivers/video/sis/init301.h
index 6d24c931b7e5..a30b98319110 100644
--- a/drivers/video/sis/init301.h
+++ b/drivers/video/sis/init301.h
@@ -24,9 +24,15 @@
#endif
#ifdef LINUX_KERNEL
+#include <linux/config.h>
+#include <linux/version.h>
#include <asm/io.h>
#include <linux/types.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
#include <linux/sisfb.h>
+#else
+#include <video/sisfb.h>
+#endif
#endif
#ifdef WIN2000
@@ -41,274 +47,306 @@
#include "sisv.h"
#endif
-USHORT SiS_SetFlag;
-USHORT SiS_RVBHCFACT,SiS_RVBHCMAX,SiS_RVBHRS;
-USHORT SiS_VGAVT,SiS_VGAHT;
-USHORT SiS_VT,SiS_HT;
-USHORT SiS_VGAVDE,SiS_VGAHDE;
-USHORT SiS_VDE,SiS_HDE;
-USHORT SiS_NewFlickerMode,SiS_RY1COE,SiS_RY2COE,SiS_RY3COE,SiS_RY4COE;
-USHORT SiS_LCDHDES,SiS_LCDVDES;
-USHORT SiS_DDC_Port, SiS_DDC_Index,SiS_DDC_Data, SiS_DDC_Clk;
-USHORT SiS_DDC_DataShift, SiS_DDC_DeviceAddr, SiS_DDC_Flag;
-USHORT SiS_DDC_ReadAddr, SiS_DDC_Buffer;
-
-USHORT Panel800x600, Panel1024x768, Panel1280x1024, Panel1600x1200;
-USHORT Panel1280x960, Panel1400x1050, Panel320x480, Panel1152x768;
-USHORT Panel1280x768, Panel1024x600, Panel640x480, Panel1152x864;
-USHORT PanelMax, PanelMinLVDS, PanelMin301;
-
-USHORT SiS_ChrontelInit;
-
-extern USHORT SiS_CRT1Mode;
-extern USHORT SiS_P3c4,SiS_P3d4;
-extern USHORT SiS_P3ca;
-extern USHORT SiS_P3c9;
-extern USHORT SiS_P3da;
-extern USHORT SiS_Part1Port,SiS_Part2Port;
-extern USHORT SiS_Part3Port,SiS_Part4Port,SiS_Part5Port;
-extern USHORT SiS_MDA_DAC[];
-extern USHORT SiS_CGA_DAC[];
-extern USHORT SiS_EGA_DAC[];
-extern USHORT SiS_VGA_DAC[];
-extern USHORT SiS_ModeType;
-extern USHORT SiS_SelectCRT2Rate;
-extern USHORT SiS_IF_DEF_LVDS;
-extern USHORT SiS_IF_DEF_TRUMPION;
-extern USHORT SiS_IF_DEF_CH70xx;
-extern USHORT SiS_Backup70xx;
-extern USHORT SiS_IF_DEF_HiVision;
-extern USHORT SiS_IF_DEF_DSTN; /*add for dstn*/
-extern USHORT SiS_IF_DEF_FSTN; /*add for fstn*/
-extern USHORT SiS_VBInfo;
-extern USHORT SiS_VBType;
-extern USHORT SiS_VBExtInfo;
-extern USHORT SiS_LCDResInfo;
-extern USHORT SiS_LCDTypeInfo;
-extern USHORT SiS_LCDInfo;
-extern USHORT SiS_HiVision;
-
-extern BOOLEAN SiS_SearchVBModeID(UCHAR *RomAddr, USHORT *);
+#if 0
+extern const USHORT SiS_MDA_DAC[];
+extern const USHORT SiS_CGA_DAC[];
+extern const USHORT SiS_EGA_DAC[];
+extern const USHORT SiS_VGA_DAC[];
+#endif
-BOOLEAN SiS_Is301B(USHORT BaseAddr);
-BOOLEAN SiS_IsDisableCRT2(USHORT BaseAddr);
-BOOLEAN SiS_IsVAMode(PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr);
-BOOLEAN SiS_IsDualEdge(PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr);
-BOOLEAN SiS_CRT2IsLCD(USHORT BaseAddr);
+extern BOOLEAN SiS_SearchVBModeID(SiS_Private *SiS_Pr, UCHAR *RomAddr, USHORT *);
-void SiS_SetDefCRT2ExtRegs(USHORT BaseAddr);
-USHORT SiS_GetRatePtrCRT2(UCHAR *ROMAddr, USHORT ModeNo,USHORT ModeIdIndex);
-BOOLEAN SiS_AdjustCRT2Rate(UCHAR *ROMAddr,USHORT ModeNo,USHORT MODEIdIndex,USHORT RefreshRateTableIndex,USHORT *i);
-void SiS_SaveCRT2Info(USHORT ModeNo);
-void SiS_GetCRT2Data(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,
- PSIS_HW_DEVICE_INFO HwDeviceExtension);
-void SiS_GetCRT2DataLVDS(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,
- PSIS_HW_DEVICE_INFO HwDeviceExtension);
-void SiS_GetCRT2PtrA(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,
- USHORT *CRT2Index,USHORT *ResIndex);
-void SiS_GetCRT2Part2Ptr(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
- USHORT RefreshRateTableIndex,USHORT *CRT2Index,
- USHORT *ResIndex);
-void SiS_GetCRT2Data301(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,
- PSIS_HW_DEVICE_INFO HwDeviceExtension);
-USHORT SiS_GetResInfo(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex);
-void SiS_GetCRT2ResInfo(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension);
-void SiS_GetRAMDAC2DATA(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,
+BOOLEAN SiS_Is301B(SiS_Private *SiS_Pr, USHORT BaseAddr);
+BOOLEAN SiS_IsNotM650or651(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr);
+BOOLEAN SiS_IsDisableCRT2(SiS_Private *SiS_Pr, USHORT BaseAddr);
+BOOLEAN SiS_IsVAMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr);
+BOOLEAN SiS_IsDualEdge(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr);
+BOOLEAN SiS_CRT2IsLCD(SiS_Private *SiS_Pr, USHORT BaseAddr, PSIS_HW_DEVICE_INFO HwDeviceExtension);
+void SiS_SetDefCRT2ExtRegs(SiS_Private *SiS_Pr, USHORT BaseAddr);
+USHORT SiS_GetRatePtrCRT2(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT ModeNo,USHORT ModeIdIndex,
PSIS_HW_DEVICE_INFO HwDeviceExtension);
-void SiS_GetCRT2Ptr(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,
- USHORT *CRT2Index,USHORT *ResIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension);
-void SiS_SetCRT2ModeRegs(USHORT BaseAddr,USHORT ModeNo,USHORT ModeIdIndex, PSIS_HW_DEVICE_INFO );
-void SiS_SetHiVision(USHORT BaseAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension);
-
-void SiS_GetLVDSDesData(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,
+BOOLEAN SiS_AdjustCRT2Rate(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT MODEIdIndex,
+ USHORT RefreshRateTableIndex,USHORT *i,PSIS_HW_DEVICE_INFO HwDeviceExtension);
+void SiS_SaveCRT2Info(SiS_Private *SiS_Pr, USHORT ModeNo);
+void SiS_GetCRT2Data(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+ USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension);
+void SiS_GetCRT2DataLVDS(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+ USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension);
+void SiS_GetCRT2PtrA(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+ USHORT RefreshRateTableIndex,USHORT *CRT2Index,USHORT *ResIndex);
+void SiS_GetCRT2Part2Ptr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+ USHORT RefreshRateTableIndex,USHORT *CRT2Index, USHORT *ResIndex);
+void SiS_GetCRT2Data301(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+ USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension);
+USHORT SiS_GetResInfo(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex);
+void SiS_GetCRT2ResInfo(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
PSIS_HW_DEVICE_INFO HwDeviceExtension);
-void SiS_SetCRT2Offset(USHORT Part1Port,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+void SiS_GetRAMDAC2DATA(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+ USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension);
+void SiS_GetCRT2Ptr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+ USHORT RefreshRateTableIndex,USHORT *CRT2Index,USHORT *ResIndex,
+ PSIS_HW_DEVICE_INFO HwDeviceExtension);
+void SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT BaseAddr,USHORT ModeNo,USHORT ModeIdIndex,
+ PSIS_HW_DEVICE_INFO );
+void SiS_SetHiVision(SiS_Private *SiS_Pr, USHORT BaseAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension);
+void SiS_GetLVDSDesData(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+ USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension);
+void SiS_SetCRT2Offset(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension);
-USHORT SiS_GetOffset(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,
- PSIS_HW_DEVICE_INFO HwDeviceExtension);
-USHORT SiS_GetColorDepth(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex);
-USHORT SiS_GetMCLK(UCHAR *ROMAddr, PSIS_HW_DEVICE_INFO HwDeviceExtension);
-USHORT SiS_CalcDelayVB(void);
-USHORT SiS_GetVCLK2Ptr(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+USHORT SiS_GetOffset(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+ USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension);
+USHORT SiS_GetColorDepth(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex);
+USHORT SiS_GetMCLK(SiS_Private *SiS_Pr, UCHAR *ROMAddr, PSIS_HW_DEVICE_INFO HwDeviceExtension);
+USHORT SiS_CalcDelayVB(SiS_Private *SiS_Pr);
+USHORT SiS_GetVCLK2Ptr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+ USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension);
+void SiS_SetCRT2Sync(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,
USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension);
-void SiS_SetCRT2Sync(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT RefreshRateTableIndex,
- PSIS_HW_DEVICE_INFO HwDeviceExtension);
void SiS_SetRegANDOR(USHORT Port,USHORT Index,USHORT DataAND,USHORT DataOR);
void SiS_SetRegOR(USHORT Port,USHORT Index,USHORT DataOR);
void SiS_SetRegAND(USHORT Port,USHORT Index,USHORT DataAND);
-USHORT SiS_GetVGAHT2(void);
-void SiS_SetGroup2(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+USHORT SiS_GetVGAHT2(SiS_Private *SiS_Pr);
+void SiS_Set300Part2Regs(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,
+ USHORT ModeIdIndex, USHORT RefreshRateTableIndex,
+ USHORT BaseAddr, USHORT ModeNo);
+void SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension);
-void SiS_SetGroup3(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+void SiS_SetGroup3(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
PSIS_HW_DEVICE_INFO HwDeviceExtension);
-void SiS_SetGroup4(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+void SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension);
-void SiS_SetGroup5(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex);
-void SiS_SetCRT2VCLK(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
- USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension);
-void SiS_EnableCRT2(void);
-void SiS_LoadDAC2(UCHAR *ROMAddr,USHORT Part5Port,USHORT ModeNo,USHORT ModeIdIndex);
-void SiS_WriteDAC2(USHORT Pdata,USHORT dl, USHORT ah, USHORT al, USHORT dh);
-void SiS_GetVBInfo301(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
- PSIS_HW_DEVICE_INFO HwDeviceExtension);
-BOOLEAN SiS_GetLCDResInfo(UCHAR *ROMAddr,USHORT P3d4,USHORT ModeNo,USHORT ModeIdIndex);
-BOOLEAN SiS_BridgeIsOn(USHORT BaseAddr,PSIS_HW_DEVICE_INFO);
-BOOLEAN SiS_BridgeIsEnable(USHORT BaseAddr,PSIS_HW_DEVICE_INFO);
-BOOLEAN SiS_BridgeInSlave(void);
-void SiS_PresetScratchregister(USHORT SiS_P3d4,PSIS_HW_DEVICE_INFO HwDeviceExtension);
-void SiS_SetTVSystem(VOID);
-void SiS_LongWait(VOID);
-USHORT SiS_GetQueueConfig(VOID);
-void SiS_VBLongWait(VOID);
-USHORT SiS_GetVCLKLen(UCHAR *ROMAddr);
-void SiS_WaitVBRetrace(PSIS_HW_DEVICE_INFO HwDeviceExtension);
-void SiS_WaitRetrace1(PSIS_HW_DEVICE_INFO HwDeviceExtension);
-void SiS_WaitRetrace2(PSIS_HW_DEVICE_INFO HwDeviceExtension);
-void SiS_SetCRT2ECLK(UCHAR *ROMAddr, USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,
+void SiS_SetGroup5(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,
+ USHORT ModeIdIndex);
+void SiS_FinalizeLCD(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
PSIS_HW_DEVICE_INFO HwDeviceExtension);
-void SiS_GetLVDSDesPtr(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,
- USHORT *PanelIndex,USHORT *ResIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension);
-void SiS_GetLVDSDesPtrA(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,
- USHORT *PanelIndex,USHORT *ResIndex);
-void SiS_SetTPData(VOID);
-void SiS_ModCRT1CRTC(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,
- PSIS_HW_DEVICE_INFO HwDeviceExtension);
-extern BOOLEAN SiS_GetLVDSCRT1Ptr(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex,
- USHORT *ResInfo,USHORT *DisplayType);
-void SiS_SetCHTVReg(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex);
-void SiS_GetCHTVRegPtr(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex);
-void SiS_SetCH700x(USHORT tempax);
-USHORT SiS_GetCH700x(USHORT tempax);
-void SiS_SetCH701x(USHORT tempax);
-USHORT SiS_GetCH701x(USHORT tempax);
-void SiS_SetCH70xx(USHORT tempax);
-USHORT SiS_GetCH70xx(USHORT tempax);
-void SiS_SetCH70xxANDOR(USHORT tempax,USHORT tempbh);
-void SiS_SetSwitchDDC2(void);
-USHORT SiS_SetStart(void);
-USHORT SiS_SetStop(void);
-void SiS_DDC2Delay(USHORT delaytime);
-USHORT SiS_SetSCLKLow(void);
-USHORT SiS_SetSCLKHigh(void);
-USHORT SiS_ReadDDC2Data(USHORT tempax);
-USHORT SiS_WriteDDC2Data(USHORT tempax);
-USHORT SiS_CheckACK(void);
+void SiS_SetCRT2VCLK(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+ USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension);
+void SiS_EnableCRT2(SiS_Private *SiS_Pr);
+void SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+ PSIS_HW_DEVICE_INFO HwDeviceExtension, int checkcrt2mode);
+BOOLEAN SiS_BridgeIsOn(SiS_Private *SiS_Pr, USHORT BaseAddr,PSIS_HW_DEVICE_INFO);
+BOOLEAN SiS_BridgeIsEnable(SiS_Private *SiS_Pr, USHORT BaseAddr,PSIS_HW_DEVICE_INFO);
+BOOLEAN SiS_BridgeInSlave(SiS_Private *SiS_Pr);
+void SiS_PresetScratchregister(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension);
+void SiS_SetTVSystem(SiS_Private *SiS_Pr);
+void SiS_LongWait(SiS_Private *SiS_Pr);
+USHORT SiS_GetQueueConfig(SiS_Private *SiS_Pr);
+void SiS_VBLongWait(SiS_Private *SiS_Pr);
+USHORT SiS_GetVCLKLen(SiS_Private *SiS_Pr, UCHAR *ROMAddr);
+void SiS_WaitVBRetrace(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension);
+void SiS_WaitRetrace1(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension);
+void SiS_WaitRetrace2(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension);
+void SiS_WaitRetraceDDC(SiS_Private *SiS_Pr);
+void SiS_SetCRT2ECLK(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT ModeNo,USHORT ModeIdIndex,
+ USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension);
+void SiS_GetLVDSDesPtr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+ USHORT RefreshRateTableIndex,USHORT *PanelIndex,USHORT *ResIndex,
+ PSIS_HW_DEVICE_INFO HwDeviceExtension);
+void SiS_GetLVDSDesPtrA(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+ USHORT RefreshRateTableIndex,USHORT *PanelIndex,USHORT *ResIndex);
+void SiS_SetTPData(SiS_Private *SiS_Pr);
+void SiS_WhatIsThis(SiS_Private *SiS_Pr, USHORT myvbinfo);
+void SiS_ModCRT1CRTC(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+ USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension);
+void SiS_SetCHTVReg(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+ USHORT RefreshRateTableIndex);
+void SiS_GetCHTVRegPtr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+ USHORT RefreshRateTableIndex);
+void SiS_SetCH700x(SiS_Private *SiS_Pr, USHORT tempax);
+USHORT SiS_GetCH700x(SiS_Private *SiS_Pr, USHORT tempax);
+void SiS_SetCH701x(SiS_Private *SiS_Pr, USHORT tempax);
+USHORT SiS_GetCH701x(SiS_Private *SiS_Pr, USHORT tempax);
+void SiS_SetCH70xx(SiS_Private *SiS_Pr, USHORT tempax);
+USHORT SiS_GetCH70xx(SiS_Private *SiS_Pr, USHORT tempax);
+#ifdef LINUX_XF86
+USHORT SiS_I2C_GetByte(SiS_Private *SiS_Pr);
+Bool SiS_I2C_PutByte(SiS_Private *SiS_Pr, USHORT data);
+Bool SiS_I2C_Address(SiS_Private *SiS_Pr, USHORT addr);
+void SiS_I2C_Stop(SiS_Private *SiS_Pr);
+#endif
+void SiS_SetCH70xxANDOR(SiS_Private *SiS_Pr, USHORT tempax,USHORT tempbh);
+void SiS_SetSwitchDDC2(SiS_Private *SiS_Pr);
+USHORT SiS_SetStart(SiS_Private *SiS_Pr);
+USHORT SiS_SetStop(SiS_Private *SiS_Pr);
+void SiS_DDC2Delay(SiS_Private *SiS_Pr, USHORT delaytime);
+USHORT SiS_SetSCLKLow(SiS_Private *SiS_Pr);
+USHORT SiS_SetSCLKHigh(SiS_Private *SiS_Pr);
+USHORT SiS_ReadDDC2Data(SiS_Private *SiS_Pr, USHORT tempax);
+USHORT SiS_WriteDDC2Data(SiS_Private *SiS_Pr, USHORT tempax);
+USHORT SiS_CheckACK(SiS_Private *SiS_Pr);
+USHORT SiS_ReadLCDDDC(SiS_Private *SiS_Pr, USHORT length, unsigned char *buffer);
+#ifdef LINUX_XF86
+USHORT SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS);
+USHORT SiS_SenseVGA2DDC(SiS_Private *SiS_Pr, SISPtr pSiS);
+#endif
#ifdef SIS315H
-void SiS_OEM310Setting(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
+void SiS_OEM310Setting(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex);
-void SiS_OEMLCD(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
+void SiS_OEMLCD(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex);
#endif
#ifdef SIS300
-void SiS_OEM300Setting(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
+void SiS_OEM300Setting(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
UCHAR *ROMAddr,USHORT ModeNo);
#endif
-USHORT GetRevisionID(PSIS_HW_DEVICE_INFO HwDeviceExtension);
-BOOLEAN SiS_LowModeStuff(USHORT ModeNo,PSIS_HW_DEVICE_INFO HwDeviceExtension);
+BOOLEAN SiS_LowModeStuff(SiS_Private *SiS_Pr, USHORT ModeNo,PSIS_HW_DEVICE_INFO HwDeviceExtension);
-BOOLEAN SiS_GetLCDResInfo301(UCHAR *ROMAddr,USHORT SiS_P3d4, USHORT ModeNo, USHORT ModeIdIndex,
- PSIS_HW_DEVICE_INFO HwDeviceExtension);
-/* void SiS_CHACRT1CRTC(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+BOOLEAN SiS_GetLCDResInfo(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo, USHORT ModeIdIndex,
+ PSIS_HW_DEVICE_INFO HwDeviceExtension);
+/* void SiS_CHACRT1CRTC(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
USHORT RefreshRateTableIndex); */
-BOOLEAN SiS_GetLCDACRT1Ptr(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
- USHORT RefreshRateTableIndex,USHORT *ResInfo,
- USHORT *DisplayType);
-/* 310 series OEM */
-USHORT GetLCDPtrIndex (void);
-USHORT GetTVPtrIndex(void);
-void SetDelayComp(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
- UCHAR *ROMAddr,USHORT ModeNo);
-void SetAntiFlicker(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
- UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex);
-void SetEdgeEnhance (PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
- UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex);
-void SetYFilter(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
- UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex);
-void SetPhaseIncr(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
- UCHAR *ROMAddr,USHORT ModeNo);
-/* 300 series OEM */
-USHORT GetOEMLCDPtr(PSIS_HW_DEVICE_INFO HwDeviceExtension, int Flag);
-USHORT GetOEMTVPtr(void);
-void SetOEMTVDelay(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
- UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex);
-void SetOEMLCDDelay(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
- UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex);
-void SetOEMAntiFlicker(PSIS_HW_DEVICE_INFO HwDeviceExtension,
- USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex);
-void SetOEMPhaseIncr(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
- UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex);
-void SetOEMYFilter(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr,
- UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex);
-extern void SiS_SetReg1(USHORT, USHORT, USHORT);
-extern void SiS_SetReg3(USHORT, USHORT);
-extern UCHAR SiS_GetReg1(USHORT, USHORT);
-extern UCHAR SiS_GetReg2(USHORT);
-extern BOOLEAN SiS_SearchModeID(UCHAR *ROMAddr, USHORT *ModeNo,USHORT *ModeIdIndex);
-extern BOOLEAN SiS_GetRatePtr(ULONG, USHORT);
-extern void SiS_SetReg4(USHORT, ULONG);
-extern ULONG SiS_GetReg3(USHORT);
-extern void SiS_DisplayOff(void);
-extern void SiS_DisplayOn(void);
-extern UCHAR SiS_GetModePtr(UCHAR *ROMAddr, USHORT ModeNo,USHORT ModeIdIndex);
-#ifdef SIS315H
-extern UCHAR SiS_Get310DRAMType(UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension);
-#endif
-
-BOOLEAN SiS_SetCRT2Group301(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,
+BOOLEAN SiS_SetCRT2Group301(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,
PSIS_HW_DEVICE_INFO HwDeviceExtension);
-void SiS_SetGroup1(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+void SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT RefreshRateTableIndex);
-void SiS_SetGroup1_LVDS(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+void SiS_SetGroup1_LVDS(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT RefreshRateTableIndex);
-void SiS_SetGroup1_LCDA(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
- PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT RefreshRateTableIndex);/*301b*/
-void SiS_SetGroup1_301(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+void SiS_SetGroup1_LCDA(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+ PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT RefreshRateTableIndex);
+void SiS_SetGroup1_301(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT RefreshRateTableIndex);
#ifdef SIS300
-void SiS_SetCRT2FIFO_300(UCHAR *ROMAddr,USHORT ModeNo,
+void SiS_SetCRT2FIFO_300(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,
PSIS_HW_DEVICE_INFO HwDeviceExtension);
#endif
#ifdef SIS315H
-void SiS_SetCRT2FIFO_310(UCHAR *ROMAddr,USHORT ModeNo,
+void SiS_SetCRT2FIFO_310(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,
PSIS_HW_DEVICE_INFO HwDeviceExtension);
-void SiS_CRT2AutoThreshold(USHORT BaseAddr);
+void SiS_CRT2AutoThreshold(SiS_Private *SiS_Pr, USHORT BaseAddr);
#endif
-BOOLEAN SiS_GetLCDDDCInfo(PSIS_HW_DEVICE_INFO HwDeviceExtension);
-void SiS_UnLockCRT2(PSIS_HW_DEVICE_INFO,USHORT BaseAddr);
-void SiS_LockCRT2(PSIS_HW_DEVICE_INFO,USHORT BaseAddr);
-void SiS_DisableBridge(PSIS_HW_DEVICE_INFO,USHORT BaseAddr);
-void SiS_EnableBridge(PSIS_HW_DEVICE_INFO,USHORT BaseAddr);
-void SiS_SetPanelDelay(UCHAR* ROMAddr,PSIS_HW_DEVICE_INFO,USHORT DelayTime);
-void SiS_ShortDelay(USHORT delay);
-void SiS_LongDelay(USHORT delay);
-void SiS_GenericDelay(USHORT delay);
-void SiS_VBWait(void);
+BOOLEAN SiS_GetLCDDDCInfo(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension);
+void SiS_UnLockCRT2(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO,USHORT BaseAddr);
+void SiS_LockCRT2(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO,USHORT BaseAddr);
+void SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO,USHORT BaseAddr);
+void SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO,USHORT BaseAddr);
+void SiS_SetPanelDelay(SiS_Private *SiS_Pr, UCHAR* ROMAddr,PSIS_HW_DEVICE_INFO,USHORT DelayTime);
+void SiS_SetPanelDelayLoop(SiS_Private *SiS_Pr, UCHAR *ROMAddr, PSIS_HW_DEVICE_INFO HwDeviceExtension,
+ USHORT DelayTime, USHORT DelayLoop);
+void SiS_ShortDelay(SiS_Private *SiS_Pr, USHORT delay);
+void SiS_LongDelay(SiS_Private *SiS_Pr, USHORT delay);
+void SiS_GenericDelay(SiS_Private *SiS_Pr, USHORT delay);
+void SiS_VBWait(SiS_Private *SiS_Pr);
+
+void SiS_SiS30xBLOn(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension);
+void SiS_SiS30xBLOff(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension);
-/* TW: New functions (with temporary names) */
-void SiS_Chrontel701xOn(void);
-void SiS_Chrontel701xOn2(PSIS_HW_DEVICE_INFO HwDeviceExtension,
- USHORT BaseAddr);
-void SiS_Chrontel701xOff(void);
-void SiS_Chrontel701xOff2(void);
-void SiS_ChrontelFlip0x48(void);
-void SiS_ChrontelDoSomething4(PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr);
-void SiS_ChrontelDoSomething3(USHORT ModeNo, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr);
-void SiS_ChrontelDoSomething2(PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr);
-void SiS_ChrontelDoSomething1(PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr);
-BOOLEAN SiS_WeHaveBacklightCtrl(PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr);
+/* TW: New functions (with mostly temporary names) */
+void SiS_Chrontel701xBLOn(SiS_Private *SiS_Pr);
+void SiS_Chrontel701xOn(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,
+ USHORT BaseAddr);
+void SiS_Chrontel701xBLOff(SiS_Private *SiS_Pr);
+void SiS_Chrontel701xOff(SiS_Private *SiS_Pr);
+void SiS_ChrontelResetDB(SiS_Private *SiS_Pr);
+void SiS_ChrontelDoSomething4(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr);
+void SiS_ChrontelDoSomething3(SiS_Private *SiS_Pr, USHORT ModeNo, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr);
+void SiS_ChrontelDoSomething2(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr);
+void SiS_ChrontelDoSomething1(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr);
+BOOLEAN SiS_WeHaveBacklightCtrl(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr);
#if 0
-BOOLEAN SiS_IsSomethingCR5F(PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr);
+BOOLEAN SiS_IsSomethingCR5F(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr);
#endif
-BOOLEAN SiS_IsYPbPr(PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr);
-BOOLEAN SiS_IsTVOrSomething(PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr);
-BOOLEAN SiS_IsLCDOrLCDA(PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr);
-void SiS_SetCHTVForLCD(PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr);
-void SiS_Chrontel19f2(void);
-BOOLEAN SiS_CR36BIOSWord23b(PSIS_HW_DEVICE_INFO HwDeviceExtension);
-BOOLEAN SiS_CR36BIOSWord23d(PSIS_HW_DEVICE_INFO HwDeviceExtension);
-BOOLEAN SiS_IsSR13_CR30(PSIS_HW_DEVICE_INFO HwDeviceExtension);
-
+BOOLEAN SiS_IsYPbPr(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr);
+BOOLEAN SiS_IsChScart(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr);
+BOOLEAN SiS_IsTVOrYPbPrOrScart(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr);
+BOOLEAN SiS_IsLCDOrLCDA(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr);
+void SiS_SetCH701xForLCD(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr);
+void SiS_ChrontelPowerSequencing(SiS_Private *SiS_Pr);
+BOOLEAN SiS_CR36BIOSWord23b(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension);
+BOOLEAN SiS_CR36BIOSWord23d(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension);
+BOOLEAN SiS_IsSR13_CR30(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension);
/* TW end */
+extern void SiS_SetReg1(USHORT, USHORT, USHORT);
+extern void SiS_SetReg3(USHORT, USHORT);
+extern UCHAR SiS_GetReg1(USHORT, USHORT);
+extern UCHAR SiS_GetReg2(USHORT);
+extern BOOLEAN SiS_SearchModeID(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT *ModeNo,USHORT *ModeIdIndex);
+extern BOOLEAN SiS_GetRatePtr(SiS_Private *SiS_Pr, ULONG, USHORT);
+extern void SiS_SetReg4(USHORT, ULONG);
+extern ULONG SiS_GetReg3(USHORT);
+extern void SiS_SetReg5(USHORT, USHORT);
+extern USHORT SiS_GetReg4(USHORT);
+extern void SiS_DisplayOff(SiS_Private *SiS_Pr);
+extern void SiS_DisplayOn(SiS_Private *SiS_Pr);
+extern UCHAR SiS_GetModePtr(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT ModeNo,USHORT ModeIdIndex);
+extern BOOLEAN SiS_GetLCDACRT1Ptr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+ USHORT RefreshRateTableIndex,USHORT *ResInfo,USHORT *DisplayType);
+extern BOOLEAN SiS_GetLVDSCRT1Ptr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex,
+ USHORT RefreshRateTableIndex,USHORT *ResInfo,USHORT *DisplayType);
+extern void SiS_LoadDAC(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO, UCHAR *ROMAddr,USHORT ModeNo,
+ USHORT ModeIdIndex);
+#ifdef SIS315H
+extern UCHAR SiS_Get310DRAMType(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension);
+#endif
+
+#ifdef LINUX_XF86
+/* DDC functions */
+USHORT SiS_InitDDCRegs(SiS_Private *SiS_Pr, SISPtr pSiS, USHORT adaptnum, USHORT DDCdatatype, BOOLEAN checkcr32);
+USHORT SiS_WriteDABDDC(SiS_Private *SiS_Pr);
+USHORT SiS_PrepareReadDDC(SiS_Private *SiS_Pr);
+USHORT SiS_PrepareDDC(SiS_Private *SiS_Pr);
+void SiS_SendACK(SiS_Private *SiS_Pr, USHORT yesno);
+USHORT SiS_DoProbeDDC(SiS_Private *SiS_Pr);
+USHORT SiS_ProbeDDC(SiS_Private *SiS_Pr);
+USHORT SiS_ReadDDC(SiS_Private *SiS_Pr, SISPtr pSiS, USHORT DDCdatatype, unsigned char *buffer);
+USHORT SiS_HandleDDC(SiS_Private *SiS_Pr, SISPtr pSiS, USHORT adaptnum,
+ USHORT DDCdatatype, unsigned char *buffer);
+#endif
+
+const UCHAR SiS_HiVisionTable[3][64] = {
+ {
+ 0x17, 0x1d, 0x03, 0x09, 0x05, 0x06, 0x0c, 0x0c,
+ 0x94, 0x49, 0x01, 0x0a, 0x06, 0x0d, 0x04, 0x0a,
+ 0x06, 0x14, 0x0d, 0x04, 0x0a, 0x00, 0x85, 0x1b,
+ 0x0c, 0x50, 0x00, 0x97, 0x00, 0xd4, 0x4a, 0x17,
+ 0x7d, 0x05, 0x4b, 0x00, 0x00, 0xe2, 0x00, 0x02,
+ 0x03, 0x0a, 0x65, 0x9d, 0x08, 0x92, 0x8f, 0x40,
+ 0x60, 0x80, 0x14, 0x90, 0x8c, 0x60, 0x14, 0x53,
+ 0x00, 0x40, 0x44, 0x00, 0xdb, 0x02, 0x3b, 0x00
+ },
+ {
+ 0x1d, 0x1d, 0x06, 0x09, 0x0b, 0x0c, 0x0c, 0x0c,
+ 0x98, 0x0a, 0x01, 0x0d, 0x06, 0x0d, 0x04, 0x0a,
+ 0x06, 0x14, 0x0d, 0x04, 0x0a, 0x00, 0x85, 0x3f,
+ 0x0c, 0x50, 0xb2, 0x2e, 0x16, 0xb5, 0xf4, 0x03,
+ 0x7d, 0x11, 0x7d, 0xea, 0x30, 0x36, 0x18, 0x96,
+ 0x21, 0x0a, 0x58, 0xee, 0x42, 0x92, 0x0f, 0x40,
+ 0x60, 0x80, 0x14, 0x90, 0x8c, 0x60, 0x04, 0xf3,
+ 0x00, 0x40, 0x11, 0x00, 0xfc, 0xff, 0x32, 0x00
+ },
+ {
+ 0x13, 0x1d, 0xe8, 0x09, 0x09, 0xed, 0x0c, 0x0c,
+ 0x98, 0x0a, 0x01, 0x0c, 0x06, 0x0d, 0x04, 0x0a,
+ 0x06, 0x14, 0x0d, 0x04, 0x0a, 0x00, 0x85, 0x3f,
+ 0xed, 0x50, 0x70, 0x9f, 0x16, 0x59, 0x2b, 0x13,
+ 0x27, 0x0b, 0x27, 0xfc, 0x30, 0x27, 0x1c, 0xb0,
+ 0x4b, 0x4b, 0x6f, 0x2f, 0x63, 0x92, 0x0f, 0x40,
+ 0x60, 0x80, 0x14, 0x90, 0x8c, 0x60, 0x14, 0x2a,
+ 0x00, 0x40, 0x11, 0x00, 0xfc, 0xff, 0x32, 0x00
+ }
+};
+
+const UCHAR SiS_HiTVGroup3_1[] = {
+ 0x00, 0x14, 0x15, 0x25, 0x55, 0x15, 0x0b, 0x13,
+ 0xb1, 0x41, 0x62, 0x62, 0xff, 0xf4, 0x45, 0xa6,
+ 0x25, 0x2f, 0x67, 0xf6, 0xbf, 0xff, 0x8e, 0x20,
+ 0xac, 0xda, 0x60, 0xfe, 0x6a, 0x9a, 0x06, 0x10,
+ 0xd1, 0x04, 0x18, 0x0a, 0xff, 0x80, 0x00, 0x80,
+ 0x3b, 0x77, 0x00, 0xef, 0xe0, 0x10, 0xb0, 0xe0,
+ 0x10, 0x4f, 0x0f, 0x0f, 0x05, 0x0f, 0x08, 0x6e,
+ 0x1a, 0x1f, 0x25, 0x2a, 0x4c, 0xaa, 0x01
+};
+
+const UCHAR SiS_HiTVGroup3_2[] = {
+ 0x00, 0x14, 0x15, 0x25, 0x55, 0x15, 0x0b, 0x7a,
+ 0x54, 0x41, 0xe7, 0xe7, 0xff, 0xf4, 0x45, 0xa6,
+ 0x25, 0x2f, 0x67, 0xf6, 0xbf, 0xff, 0x8e, 0x20,
+ 0xac, 0x6a, 0x60, 0x2b, 0x52, 0xcd, 0x61, 0x10,
+ 0x51, 0x04, 0x18, 0x0a, 0x1f, 0x80, 0x00, 0x80,
+ 0xff, 0xa4, 0x04, 0x2b, 0x94, 0x21, 0x72, 0x94,
+ 0x26, 0x05, 0x01, 0x0f, 0xed, 0x0f, 0x0a, 0x64,
+ 0x18, 0x1d, 0x23, 0x28, 0x4c, 0xaa, 0x01
+};
+
#endif
diff --git a/drivers/video/sis/initdef.h b/drivers/video/sis/initdef.h
index a4b344e6ab4d..fbca131f51fd 100644
--- a/drivers/video/sis/initdef.h
+++ b/drivers/video/sis/initdef.h
@@ -15,8 +15,19 @@
#define VB_SIS302B 0x0004
#define VB_SIS301LV 0x0008
#define VB_SIS302LV 0x0010
+#define VB_SIS30xLV VB_SIS301LV
+#define VB_SIS30xNEW VB_SIS302LV
#define VB_NoLCD 0x8000
#define VB_SIS301BLV302BLV (VB_SIS301B|VB_SIS302B|VB_SIS301LV|VB_SIS302LV)
+#define VB_SIS301B302B (VB_SIS301B|VB_SIS302B)
+#define VB_SIS301LV302LV (VB_SIS301LV|VB_SIS302LV)
+
+#define IS_SIS650740 ((HwDeviceExtension->jChipType >= SIS_650) && (HwDeviceExtension->jChipType < SIS_330))
+
+#define IS_SIS650 (HwDeviceExtension->jChipType == SIS_650)
+#define IS_SIS740 (HwDeviceExtension->jChipType == SIS_740)
+#define IS_SIS330 (HwDeviceExtension->jChipType == SIS_330)
+#define IS_SIS550 (HwDeviceExtension->jChipType == SIS_550)
#define CRT1Len 17
#define LVDSCRT1Len 15
@@ -35,9 +46,9 @@
#define ModeInfoFlag 0x07
#define IsTextMode 0x07
-#define DACInfoFlag 0x18
-#define MemoryInfoFlag 0x1E0
-#define MemorySizeShift 0x05
+#define DACInfoFlag 0x0018
+#define MemoryInfoFlag 0x01E0
+#define MemorySizeShift 5
/* modeflag */
#define Charx8Dot 0x0200
@@ -57,8 +68,9 @@
#define NoSupportHiVisionTV 0x0060
#define NoSupportLCD 0x0058
#define SupportCHTV 0x0800
-#define SupportTV1024 0x0800 /*301b*/
+#define SupportTV1024 0x0800
#define InterlaceMode 0x0080
+#define SupportHiVisionTV2 0x1000
#define SyncPP 0x0000
#define SyncPN 0x4000
#define SyncNP 0x8000
@@ -72,13 +84,13 @@
/* VBInfo */
#define SetSimuScanMode 0x0001 /* CR 30 */
#define SwitchToCRT2 0x0002
-#define SetCRT2ToTV 0x009C
#define SetCRT2ToAVIDEO 0x0004
#define SetCRT2ToSVIDEO 0x0008
#define SetCRT2ToSCART 0x0010
#define SetCRT2ToLCD 0x0020
#define SetCRT2ToRAMDAC 0x0040
#define SetCRT2ToHiVisionTV 0x0080
+#define SetCRT2ToTV 0x009C /* alias */
#define SetNTSCTV 0x0000 /* CR 31 */
#define SetPALTV 0x0100
#define SetInSlaveMode 0x0200
@@ -92,6 +104,7 @@
#define DriverMode 0x4000
#define HotKeySwitch 0x8000 /* TW: ? */
#define SetCRT2ToLCDA 0x8000
+
#define PanelRGB18Bit 0x0100
#define PanelRGB24Bit 0x0000
@@ -126,12 +139,12 @@
010 LVDS
011 LVDS + Chrontel 7019
All other combinations reserved
- [4] LVDS: Expanding(0)/Non-expanding(1) LCD display
- 30x: SiS30x(0)/LCD monitor(1) scaling display
+ [4] LVDS: 0: Panel Link expands / 1: Panel Link does not expand
+ 30x: 0: Bridge scales / 1: Bridge does not scale = Panel scales (if possible)
[5] LCD polarity select
0: VESA DMT Standard
1: EDID 2.x defined
- [6] LCD honrizontal polarity select
+ [6] LCD horizontal polarity select
0: High active
1: Low active
[7] LCD vertical polarity select
@@ -139,12 +152,37 @@
1: Low active
*/
-#define EnableDualEdge 0x01 /* CR38 (310/325 series) */
-/* #define PAL_NTSC 0x01 (only on 315PRO) */
-#define SetToLCDA 0x02 /* TW: LCD channel A (302 only) */
-#define SetYPbPr 0x10 /* TW: ? */
-#define EnablePALMN 0x40
-#define EnablePALN 0x80
+/* CR37: LCDInfo */
+#define LCDRGB18Bit 0x0001
+#define LCDNonExpanding 0x0010
+#define DontExpandLCD LCDNonExpanding
+#define LCDNonExpandingShift 4
+#define DontExpandLCDShift LCDNonExpandingShift
+#define LCDSync 0x0020
+#define LCDPass11 0x0100
+#define LCDSyncBit 0x00e0
+#define LCDSyncShift 6
+
+/* CR38 (310/325 series) */
+#define EnableDualEdge 0x01
+#define SetToLCDA 0x02 /* LCD channel A (302B/LV and 650+LVDS only) */
+#define EnableSiSHiVision 0x04 /* HiVision (HDTV) on SiS bridge */
+#define EnableLVDSScart 0x04 /* Scart on Ch7019 (unofficial definition - TW) */
+#define EnableLVDSHiVision 0x08 /* YPbPr color format (480i HDTV); only on 650/Ch7019 systems */
+#define SiSHiVision1 0x10 /* See SetHiVision() */
+#define SiSHiVision2 0x20
+#define EnablePALM 0x40 /* 1 = Set PALM */
+#define EnablePALN 0x80 /* 1 = Set PALN */
+
+#define SetSCARTOutput 0x01
+#define BoardTVType 0x02
+
+#define EnablePALMN 0x40 /* Romflag: 1 = Allow PALM/PALN */
+
+/* CR39 (650) */
+#define LCDPass1_1 0x01 /* LVDS only; set by driver to pass 1:1 data to LVDS output */
+#define Enable302LV_DualLink 0x04 /* 30xNEW (302LV) only; set by mode switching function */
+
/* CR79 (310/325 series only)
[3-0] Notify driver
@@ -155,16 +193,15 @@
0101 Set Contrast event
0110 Set Mute event
0111 Set Volume Up/Down event
- [4] Enable Backlight Control by BIOS/driver (set by driver)
+ [4] Enable Backlight Control by BIOS/driver
+ (set by driver; set means that the BIOS should
+ not touch the backlight registers because eg.
+ the driver already switched off the backlight)
[5] PAL/NTSC (set by BIOS)
- [6] Expansion On/Off (set by BIOS)
+ [6] Expansion On/Off (set by BIOS; copied to CR32[4])
[7] TV UnderScan/OverScan (set by BIOS)
*/
-
-#define SetSCARTOutput 0x01
-#define BoardTVType 0x02
-
/* SetFlag */
#define ProgrammingCRT2 0x01
#define TVSimuMode 0x02
@@ -173,8 +210,7 @@
#define EnableLVDSDDA 0x10
#define SetDispDevSwitchFlag 0x20
#define CheckWinDos 0x40
-#define SetJDOSMode 0x80
-#define CRT2IsVGA 0x80 /* TW: Not sure about this name... */
+#define SetDOSMode 0x80
/* LCDResInfo */
#define Panel300_800x600 0x01 /* CR36 */
@@ -184,7 +220,6 @@
#define Panel300_640x480 0x05
#define Panel300_1024x600 0x06
#define Panel300_1152x768 0x07
-/* #define Panel300_1600x1200 0x06 OLD */
#define Panel300_320x480 0x08 /* fstn - TW: This is fake, can be any */
#define Panel310_800x600 0x01
@@ -194,35 +229,40 @@
#define Panel310_1024x600 0x05
#define Panel310_1152x864 0x06
#define Panel310_1280x960 0x07
-#define Panel310_1152x768 0x08
+#define Panel310_1152x768 0x08 /* LVDS only */
#define Panel310_1400x1050 0x09
-#define Panel310_1280x768 0x0a
+#define Panel310_1280x768 0x0a /* LVDS only */
#define Panel310_1600x1200 0x0b
-#define Panel310_320x480 0x0c /* fstn - TW: This is fake, can be any */
+#define Panel310_320x480 0x0c /* fstn - TW: This is fake, can be any */
+
+#define Panel_800x600 0x01 /* Unified values */
+#define Panel_1024x768 0x02
+#define Panel_1280x1024 0x03
+#define Panel_640x480 0x04
+#define Panel_1024x600 0x05
+#define Panel_1152x864 0x06
+#define Panel_1280x960 0x07
+#define Panel_1152x768 0x08 /* LVDS only */
+#define Panel_1400x1050 0x09
+#define Panel_1280x768 0x0a /* LVDS only */
+#define Panel_1600x1200 0x0b
+#define Panel_320x480 0x0c /* fstn - TW: This is fake, can be any */
#define ExtChipType 0x0e
#define ExtChip301 0x02
#define ExtChipLVDS 0x04
#define ExtChipTrumpion 0x06
#define ExtChipCH7005 0x08
-#define ExtChipMitacTV 0x0a /* TW: Incorrect, 0x0a = Chrontel 7005 only */
-
-#define IsM650 0x80 /* TW: CR5F */
+#define ExtChipMitacTV 0x0a /* TW: Incorrect, 0x0a = Chrontel 7005 only */
-/* LCDInfo */
-#define LCDRGB18Bit 0x01
-#define LCDNonExpandingShift 0x04
-#define LCDNonExpanding 0x10
-#define LCDSync 0x20
-/* TW: What is.. */ /* 0x100 */
-#define LCDSyncBit 0xe0
-#define LCDSyncShift 6
+#define IsM650 0x80 /* TW: CR5F */
#define LCDDataLen 8
#define HiTVDataLen 12
#define TVDataLen 16
#define SetPALTV 0x0100
#define HalfDCLK 0x1000 /* modeflag */
+
#define NTSCHT 1716
#define NTSC2HT 1920
#define NTSCVT 525
diff --git a/drivers/video/sis/oem300.h b/drivers/video/sis/oem300.h
index 2a6ac988cc74..6e5664368226 100644
--- a/drivers/video/sis/oem300.h
+++ b/drivers/video/sis/oem300.h
@@ -1,7 +1,7 @@
/* OEM Data for 300 series */
-UCHAR SiS300_OEMTVDelay301[8][4] =
+const UCHAR SiS300_OEMTVDelay301[8][4] =
{
{0x08,0x08,0x08,0x08},
{0x08,0x08,0x08,0x08},
@@ -13,7 +13,7 @@ UCHAR SiS300_OEMTVDelay301[8][4] =
{0x20,0x20,0x20,0x20}
};
-UCHAR SiS300_OEMTVDelayLVDS[8][4] =
+const UCHAR SiS300_OEMTVDelayLVDS[8][4] =
{
{0x20,0x20,0x20,0x20},
{0x20,0x20,0x20,0x20},
@@ -25,7 +25,7 @@ UCHAR SiS300_OEMTVDelayLVDS[8][4] =
{0x20,0x20,0x20,0x20}
};
-UCHAR SiS300_OEMTVFlicker[8][4] =
+const UCHAR SiS300_OEMTVFlicker[8][4] =
{
{0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00},
@@ -38,7 +38,7 @@ UCHAR SiS300_OEMTVFlicker[8][4] =
};
#if 0 /* TW: Not used */
-UCHAR SiS300_OEMLCDDelay1[12][4]={
+const UCHAR SiS300_OEMLCDDelay1[12][4]={
{0x2c,0x2c,0x2c,0x2c},
{0x20,0x20,0x20,0x20},
{0x20,0x20,0x20,0x20},
@@ -55,7 +55,7 @@ UCHAR SiS300_OEMLCDDelay1[12][4]={
#endif
/* TW: From 630/301B BIOS */
-UCHAR SiS300_OEMLCDDelay2[64][4] = /* for 301/301b/302b/301LV/302LV */
+const UCHAR SiS300_OEMLCDDelay2[64][4] = /* for 301/301b/302b/301LV/302LV */
{
{0x20,0x20,0x20,0x20},
{0x20,0x20,0x20,0x20},
@@ -123,9 +123,99 @@ UCHAR SiS300_OEMLCDDelay2[64][4] = /* for 301/301b/302b/301LV/302LV */
{0x20,0x20,0x20,0x20}
};
+/* TW: From 300/301LV BIOS */
+const UCHAR SiS300_OEMLCDDelay4[12][4] =
+{
+ {0x2c,0x2c,0x2c,0x2c},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x2c,0x2c,0x2c,0x2c},
+ {0x2c,0x2c,0x2c,0x2c},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x24,0x24,0x24,0x24},
+ {0x24,0x24,0x24,0x24},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x24,0x24,0x24,0x24}
+};
+
+/* TW: From 300/301LV BIOS */
+const UCHAR SiS300_OEMLCDDelay5[32][4] =
+{
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+};
+
/* TW: Added for LVDS */
-UCHAR SiS300_OEMLCDDelay3[32][4] = { /* For LVDS */
- {0x20,0x20,0x20,0x20}, /* --- Expanding panels */
+const UCHAR SiS300_OEMLCDDelay3[64][4] = { /* For LVDS */
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
+ {0x20,0x20,0x20,0x20},
{0x20,0x20,0x20,0x20},
{0x20,0x20,0x20,0x20},
{0x20,0x20,0x20,0x20},
@@ -137,11 +227,8 @@ UCHAR SiS300_OEMLCDDelay3[32][4] = { /* For LVDS */
{0x20,0x20,0x20,0x20},
{0x20,0x20,0x20,0x20},
{0x20,0x20,0x20,0x20},
- {0x04,0x04,0x04,0x04}, /* Clevo 2202 (PanelType 12); Mitac needs 0x20! */
{0x20,0x20,0x20,0x20},
- {0x20,0x20,0x20,0x20}, /* Uniwill N241S2 (PanelType 14)*/
{0x20,0x20,0x20,0x20},
- {0x20,0x20,0x20,0x20}, /* ---- NonExpanding panels */
{0x20,0x20,0x20,0x20},
{0x20,0x20,0x20,0x20},
{0x20,0x20,0x20,0x20},
@@ -153,13 +240,12 @@ UCHAR SiS300_OEMLCDDelay3[32][4] = { /* For LVDS */
{0x20,0x20,0x20,0x20},
{0x20,0x20,0x20,0x20},
{0x20,0x20,0x20,0x20},
- {0x04,0x04,0x04,0x04}, /* Gericom 2200C (PanelType 28) */
{0x20,0x20,0x20,0x20},
{0x20,0x20,0x20,0x20},
{0x20,0x20,0x20,0x20}
};
-UCHAR SiS300_Phase1[8][6][4] =
+const UCHAR SiS300_Phase1[8][6][4] =
{
{
{0x21,0xed,0x00,0x08},
@@ -228,7 +314,7 @@ UCHAR SiS300_Phase1[8][6][4] =
};
-UCHAR SiS300_Phase2[8][6][4] =
+const UCHAR SiS300_Phase2[8][6][4] =
{
{
{0x21,0xed,0x00,0x08},
@@ -296,7 +382,7 @@ UCHAR SiS300_Phase2[8][6][4] =
}
};
-UCHAR SiS300_Filter1[10][17][4] =
+const UCHAR SiS300_Filter1[10][16][4] =
{
{
{0x00,0xf4,0x10,0x38},
@@ -314,8 +400,7 @@ UCHAR SiS300_Filter1[10][17][4] =
{0xeb,0x04,0x25,0x18},
{0xeb,0x04,0x25,0x18},
{0xeb,0x04,0x25,0x18},
- {0xeb,0x04,0x25,0x18},
- {0xff,0xff,0xff,0xff}
+ {0xeb,0x04,0x25,0x18}
},
{
{0x00,0xf4,0x10,0x38},
@@ -333,8 +418,7 @@ UCHAR SiS300_Filter1[10][17][4] =
{0xf1,0xf7,0x1f,0x32},
{0xf1,0xf7,0x1f,0x32},
{0xf1,0xf7,0x1f,0x32},
- {0xf1,0xf7,0x1f,0x32},
- {0xff,0xff,0xff,0xff}
+ {0xf1,0xf7,0x1f,0x32}
},
{
{0x00,0xf4,0x10,0x38},
@@ -352,8 +436,7 @@ UCHAR SiS300_Filter1[10][17][4] =
{0xf1,0xf7,0x1f,0x32},
{0xf1,0xf7,0x1f,0x32},
{0xf1,0xf7,0x1f,0x32},
- {0xf1,0xf7,0x1f,0x32},
- {0xff,0xff,0xff,0xff}
+ {0xf1,0xf7,0x1f,0x32}
},
{
{0x00,0xf4,0x10,0x38},
@@ -371,8 +454,7 @@ UCHAR SiS300_Filter1[10][17][4] =
{0xf1,0xf7,0x1f,0x32},
{0xf1,0xf7,0x1f,0x32},
{0xf1,0xf7,0x1f,0x32},
- {0xf1,0xf7,0x1f,0x32},
- {0xff,0xff,0xff,0xff}
+ {0xf1,0xf7,0x1f,0x32}
},
{
{0x00,0xf4,0x10,0x38},
@@ -390,8 +472,7 @@ UCHAR SiS300_Filter1[10][17][4] =
{0xeb,0x04,0x25,0x18},
{0xeb,0x04,0x25,0x18},
{0xeb,0x04,0x25,0x18},
- {0xeb,0x04,0x25,0x18},
- {0xff,0xff,0xff,0xff}
+ {0xeb,0x04,0x25,0x18}
},
{
{0x00,0xf4,0x10,0x38},
@@ -409,8 +490,7 @@ UCHAR SiS300_Filter1[10][17][4] =
{0xf1,0xf7,0x1f,0x32},
{0xf1,0xf7,0x1f,0x32},
{0xf1,0xf7,0x1f,0x32},
- {0xf1,0xf7,0x1f,0x32},
- {0xff,0xff,0xff,0xff}
+ {0xf1,0xf7,0x1f,0x32}
},
{
{0x00,0xf4,0x10,0x38},
@@ -428,8 +508,7 @@ UCHAR SiS300_Filter1[10][17][4] =
{0xf1,0xf7,0x1f,0x32},
{0xf1,0xf7,0x1f,0x32},
{0xf1,0xf7,0x1f,0x32},
- {0xf1,0xf7,0x1f,0x32},
- {0xff,0xff,0xff,0xff}
+ {0xf1,0xf7,0x1f,0x32}
},
{
{0x00,0xf4,0x10,0x38},
@@ -447,8 +526,7 @@ UCHAR SiS300_Filter1[10][17][4] =
{0xf1,0xf7,0x1f,0x32},
{0xf1,0xf7,0x1f,0x32},
{0xf1,0xf7,0x1f,0x32},
- {0xf1,0xf7,0x1f,0x32},
- {0xff,0xff,0xff,0xff}
+ {0xf1,0xf7,0x1f,0x32}
},
{
{0x00,0xf4,0x10,0x38},
@@ -466,8 +544,7 @@ UCHAR SiS300_Filter1[10][17][4] =
{0xeb,0x04,0x25,0x18},
{0xeb,0x04,0x25,0x18},
{0xeb,0x04,0x25,0x18},
- {0xeb,0x04,0x25,0x18},
- {0xff,0xff,0xff,0xff}
+ {0xeb,0x04,0x25,0x18}
},
{
{0x00,0xf4,0x10,0x38},
@@ -485,12 +562,11 @@ UCHAR SiS300_Filter1[10][17][4] =
{0xeb,0x04,0x25,0x18},
{0xeb,0x04,0x25,0x18},
{0xeb,0x04,0x25,0x18},
- {0xeb,0x04,0x25,0x18},
- {0xff,0xff,0xff,0xff}
+ {0xeb,0x04,0x25,0x18}
},
};
-UCHAR SiS300_Filter2[10][9][7] =
+const UCHAR SiS300_Filter2[10][9][7] =
{
{
{0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46},
@@ -604,3 +680,325 @@ UCHAR SiS300_Filter2[10][9][7] =
}
};
+const UCHAR SiS300_LCDHData[24][11][5] = {
+ {
+ {0x67,0x91,0x84,0x5e,0x00},
+ {0x67,0x91,0x84,0x5e,0x00},
+ {0x67,0x91,0x84,0x5e,0x00},
+ {0x67,0x91,0x84,0x5e,0x00},
+ {0x67,0x91,0x84,0x5e,0x00},
+ {0x67,0x91,0x84,0x5e,0x00},
+ {0x67,0x91,0x84,0x5e,0x00},
+ {0x65,0xef,0x83,0x5c,0x00},
+ {0x65,0xef,0x83,0x5c,0x00},
+ {0x8a,0x14,0x00,0x80,0x00},
+ {0x8a,0x14,0x00,0x80,0x00}
+ },
+ {
+ {0x4e,0x18,0x90,0x38,0x00},
+ {0x4e,0x18,0x90,0x38,0x00},
+ {0x8e,0x18,0x28,0x78,0x00},
+ {0x8e,0x18,0x28,0x78,0x00},
+ {0x8e,0x18,0x28,0x78,0x00},
+ {0x4e,0x18,0x90,0x38,0x00},
+ {0x4e,0x18,0x90,0x38,0x00},
+ {0x67,0x11,0x9a,0x56,0x00},
+ {0x67,0x11,0x9a,0x56,0x00},
+ {0x8a,0x14,0x00,0x80,0x00},
+ {0x8a,0x14,0x00,0x80,0x00}
+ },
+ {
+ {0x67,0x91,0x84,0x5e,0x00},
+ {0x67,0x91,0x84,0x5e,0x00},
+ {0x67,0x91,0x84,0x5e,0x00},
+ {0x67,0x91,0x84,0x5e,0x00},
+ {0x67,0x91,0x84,0x5e,0x00},
+ {0x67,0x91,0x84,0x5e,0x00},
+ {0x67,0x91,0x84,0x5e,0x00},
+ {0x65,0xef,0x83,0x5c,0x00},
+ {0x65,0xef,0x83,0x5c,0x00},
+ {0x8a,0x14,0x00,0x80,0x00},
+ {0x8a,0x14,0x00,0x80,0x00}
+ },
+ {
+ {0x4e,0x18,0x90,0x38,0x00},
+ {0x4e,0x18,0x90,0x38,0x00},
+ {0x8e,0x18,0x28,0x78,0x00},
+ {0x8e,0x18,0x28,0x78,0x00},
+ {0x8e,0x18,0x28,0x78,0x00},
+ {0x4e,0x18,0x90,0x38,0x00},
+ {0x4e,0x18,0x90,0x38,0x00},
+ {0x67,0x11,0x9a,0x56,0x00},
+ {0x67,0x11,0x9a,0x56,0x00},
+ {0x8a,0x14,0x00,0x80,0x00},
+ {0x8a,0x14,0x00,0x80,0x00}
+ },
+ {
+ {0x67,0x91,0x84,0x5e,0x00},
+ {0x67,0x91,0x84,0x5e,0x00},
+ {0x67,0x91,0x84,0x5e,0x00},
+ {0x67,0x91,0x84,0x5e,0x00},
+ {0x67,0x91,0x84,0x5e,0x00},
+ {0x67,0x91,0x84,0x5e,0x00},
+ {0x67,0x91,0x84,0x5e,0x00},
+ {0x65,0xef,0x83,0x5c,0x00},
+ {0x65,0xef,0x83,0x5c,0x00},
+ {0x8a,0x14,0x00,0x80,0x00},
+ {0x8a,0x14,0x00,0x80,0x00}
+ },
+ {
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x8E,0x18,0x28,0x78,0x00},
+ {0x8E,0x18,0x28,0x78,0x00},
+ {0x8E,0x18,0x28,0x78,0x00},
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x67,0x11,0x9A,0x56,0x00},
+ {0x67,0x11,0x9A,0x56,0x00},
+ {0x8A,0x14,0x00,0x80,0x00},
+ {0x8A,0x14,0x00,0x80,0x00}
+ },
+ {
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x65,0xEF,0x83,0x5C,0x00},
+ {0x65,0xEF,0x83,0x5C,0x00},
+ {0x8A,0x14,0x00,0x80,0x00},
+ {0x8A,0x14,0x00,0x80,0x00}
+ },
+ {
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x8E,0x18,0x28,0x78,0x00},
+ {0x8E,0x18,0x28,0x78,0x00},
+ {0x8E,0x18,0x28,0x78,0x00},
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x67,0x11,0x9A,0x56,0x00},
+ {0x67,0x11,0x9A,0x56,0x00},
+ {0x8A,0x14,0x00,0x80,0x00},
+ {0x8A,0x14,0x00,0x80,0x00}
+ },
+ {
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x65,0xEF,0x83,0x5C,0x00},
+ {0x65,0xEF,0x83,0x5C,0x00},
+ {0x8A,0x14,0x00,0x80,0x00},
+ {0x8A,0x14,0x00,0x80,0x00}
+ },
+ {
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x8E,0x18,0x28,0x78,0x00},
+ {0x8E,0x18,0x28,0x78,0x00},
+ {0x8E,0x18,0x28,0x78,0x00},
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x67,0x11,0x9A,0x56,0x00},
+ {0x67,0x11,0x9A,0x56,0x00},
+ {0x8A,0x14,0x00,0x80,0x00},
+ {0x8A,0x14,0x00,0x80,0x00}
+ },
+ {
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x65,0xEF,0x83,0x5C,0x00},
+ {0x65,0xEF,0x83,0x5C,0x00},
+ {0x8A,0x14,0x00,0x80,0x00},
+ {0x8A,0x14,0x00,0x80,0x00}
+ },
+ {
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x8E,0x18,0x28,0x78,0x00},
+ {0x8E,0x18,0x28,0x78,0x00},
+ {0x8E,0x18,0x28,0x78,0x00},
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x67,0x11,0x9A,0x56,0x00},
+ {0x67,0x11,0x9A,0x56,0x00},
+ {0x8A,0x14,0x00,0x80,0x00},
+ {0x8A,0x14,0x00,0x80,0x00}
+ },
+ {
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x65,0xEF,0x83,0x5C,0x00},
+ {0x65,0xEF,0x83,0x5C,0x00},
+ {0x8A,0x14,0x00,0x80,0x00},
+ {0x8A,0x14,0x00,0x80,0x00}
+ },
+ {
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x8E,0x18,0x28,0x78,0x00},
+ {0x8E,0x18,0x28,0x78,0x00},
+ {0x8E,0x18,0x28,0x78,0x00},
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x67,0x11,0x9A,0x56,0x00},
+ {0x67,0x11,0x9A,0x56,0x00},
+ {0x8A,0x14,0x00,0x80,0x00},
+ {0x8A,0x14,0x00,0x80,0x00}
+ },
+ {
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x65,0xEF,0x83,0x5C,0x00},
+ {0x65,0xEF,0x83,0x5C,0x00},
+ {0x8A,0x14,0x00,0x80,0x00},
+ {0x8A,0x14,0x00,0x80,0x00}
+ },
+ {
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x8E,0x18,0x28,0x78,0x00},
+ {0x8E,0x18,0x28,0x78,0x00},
+ {0x8E,0x18,0x28,0x78,0x00},
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x67,0x11,0x9A,0x56,0x00},
+ {0x67,0x11,0x9A,0x56,0x00},
+ {0x8A,0x14,0x00,0x80,0x00},
+ {0x8A,0x14,0x00,0x80,0x00}
+ },
+ {
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x65,0xEF,0x83,0x5C,0x00},
+ {0x65,0xEF,0x83,0x5C,0x00},
+ {0x8A,0x14,0x00,0x80,0x00},
+ {0x8A,0x14,0x00,0x80,0x00}
+ },
+ {
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x8E,0x18,0x28,0x78,0x00},
+ {0x8E,0x18,0x28,0x78,0x00},
+ {0x8E,0x18,0x28,0x78,0x00},
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x67,0x11,0x9A,0x56,0x00},
+ {0x67,0x11,0x9A,0x56,0x00},
+ {0x8A,0x14,0x00,0x80,0x00},
+ {0x8A,0x14,0x00,0x80,0x00}
+ },
+ {
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x65,0xEF,0x83,0x5C,0x00},
+ {0x65,0xEF,0x83,0x5C,0x00},
+ {0x8A,0x14,0x00,0x80,0x00},
+ {0x8A,0x14,0x00,0x80,0x00}
+ },
+ {
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x8E,0x18,0x28,0x78,0x00},
+ {0x8E,0x18,0x28,0x78,0x00},
+ {0x8E,0x18,0x28,0x78,0x00},
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x67,0x11,0x9A,0x56,0x00},
+ {0x67,0x11,0x9A,0x56,0x00},
+ {0x8A,0x14,0x00,0x80,0x00},
+ {0x8A,0x14,0x00,0x80,0x00}
+ },
+ {
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x65,0xEF,0x83,0x5C,0x00},
+ {0x65,0xEF,0x83,0x5C,0x00},
+ {0x8A,0x14,0x00,0x80,0x00},
+ {0x8A,0x14,0x00,0x80,0x00}
+ },
+ {
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x8E,0x18,0x28,0x78,0x00},
+ {0x8E,0x18,0x28,0x78,0x00},
+ {0x8E,0x18,0x28,0x78,0x00},
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x67,0x11,0x9A,0x56,0x00},
+ {0x67,0x11,0x9A,0x56,0x00},
+ {0x8A,0x14,0x00,0x80,0x00},
+ {0x8A,0x14,0x00,0x80,0x00}
+ },
+ {
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x67,0x91,0x84,0x5E,0x00},
+ {0x65,0xEF,0x83,0x5C,0x00},
+ {0x65,0xEF,0x83,0x5C,0x00},
+ {0x8A,0x14,0x00,0x80,0x00},
+ {0x8A,0x14,0x00,0x80,0x00}
+ },
+ {
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x8E,0x18,0x28,0x78,0x00},
+ {0x8E,0x18,0x28,0x78,0x00},
+ {0x8E,0x18,0x28,0x78,0x00},
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x4E,0x18,0x90,0x38,0x00},
+ {0x67,0x11,0x9A,0x56,0x00},
+ {0x67,0x11,0x9A,0x56,0x00},
+ {0x8A,0x14,0x00,0x80,0x00},
+ {0x8A,0x14,0x00,0x80,0x00}
+ }
+};
+
+#if 0
+const UCHAR SiS300_LCDVData[24][11][6] = {
+ {
+ {
+ },
+};
+#endif
diff --git a/drivers/video/sis/oem310.h b/drivers/video/sis/oem310.h
index 76a79d504f44..098e7ea6a329 100644
--- a/drivers/video/sis/oem310.h
+++ b/drivers/video/sis/oem310.h
@@ -1,93 +1,179 @@
-/* OEM Data for 300 series */
+/* OEM Data for 310/325/330 series */
-UCHAR SiS310_CRT2DelayCompensation1 = 0x04; /* 301A */
+const UCHAR SiS310_LCDDelayCompensation_301[] = /* 301 */
+{
+ 0x00,0x00,0x00, /* 800x600 */
+ 0x0b,0x0b,0x0b, /* 1024x768 */
+ 0x08,0x08,0x08, /* 1280x1024 */
+ 0x00,0x00,0x00, /* 640x480 (unknown) */
+ 0x00,0x00,0x00, /* 1024x600 (unknown) */
+ 0x00,0x00,0x00, /* 1152x864 (unknown) */
+ 0x08,0x08,0x08, /* 1280x960 (guessed) */
+ 0x00,0x00,0x00, /* 1152x768 (unknown) */
+ 0x08,0x08,0x08, /* 1400x1050 */
+ 0x08,0x08,0x08, /* 1280x768 (guessed) */
+ 0x00,0x00,0x00, /* 1600x1200 */
+ 0x00,0x00,0x00, /* 320x480 (unknown) */
+ 0x00,0x00,0x00,
+ 0x00,0x00,0x00,
+ 0x00,0x00,0x00
+};
+
+/* This is contained in 650+301B BIOSes, but it is wrong - so we don't use it */
+UCHAR SiS310_LCDDelayCompensation_650301B[] = /* 30xB,LV */
+{
+ 0x01,0x01,0x01, /* 800x600 */
+ 0x01,0x01,0x01, /* 1024x768 */
+ 0x01,0x01,0x01, /* 1280x1024 */
+ 0x01,0x01,0x01, /* 640x480 (unknown) */
+ 0x01,0x01,0x01, /* 1024x600 (unknown) */
+ 0x01,0x01,0x01, /* 1152x864 (unknown) */
+ 0x01,0x01,0x01, /* 1280x960 (guessed) */
+ 0x01,0x01,0x01, /* 1152x768 (unknown) */
+ 0x01,0x01,0x01, /* 1400x1050 */
+ 0x01,0x01,0x01, /* 1280x768 (guessed) */
+ 0x01,0x01,0x01, /* 1600x1200 */
+ 0x02,0x02,0x02,
+ 0x02,0x02,0x02,
+ 0x02,0x02,0x02,
+ 0x02,0x02,0x02
+};
+
+/* This data is correct, so we use it instead of the table above */
+UCHAR SiS310_LCDDelayCompensation_3xx301B[] = /* 30xB,LV */
+{
+ 0x01,0x01,0x01, /* 800x600 */
+ 0x0C,0x0C,0x0C, /* 1024x768 */
+ 0x0C,0x0C,0x0C, /* 1280x1024 */
+ 0x08,0x08,0x08, /* 640x480 */
+ 0x0C,0x0C,0x0C, /* 1024x600 (guessed) */
+ 0x0C,0x0C,0x0C, /* 1152x864 (guessed) */
+ 0x0C,0x0C,0x0C, /* 1280x960 (guessed) */
+ 0x0C,0x0C,0x0C, /* 1152x768 (guessed) */
+ 0x0C,0x0C,0x0C, /* 1400x1050 (guessed) */
+ 0x0C,0x0C,0x0C, /* 1280x768 (guessed) */
+ 0x0C,0x0C,0x0C, /* 1600x1200 (guessed) */
+ 0x02,0x02,0x02,
+ 0x02,0x02,0x02,
+ 0x02,0x02,0x02,
+ 0x02,0x02,0x02
+};
-UCHAR SiS310_LCDDelayCompensation1[] =
+const UCHAR SiS310_LCDDelayCompensation_LVDS[] = /* LVDS */
{
+ 0x00,0x00,0x00, /* 800x600 */
+ 0x00,0x00,0x00, /* 1024x768 */
+ 0x00,0x00,0x00, /* 1280x1024 */
+ 0x00,0x00,0x00, /* 640x480 (unknown) */
+ 0x00,0x00,0x00, /* 1024x600 (unknown) */
+ 0x00,0x00,0x00, /* 1152x864 (unknown) */
+ 0x00,0x00,0x00, /* 1280x960 (guessed) */
+ 0x00,0x00,0x00, /* 1152x768 (unknown) */
+ 0x00,0x00,0x00, /* 1400x1050 */
+ 0x00,0x00,0x00, /* 1280x768 (guessed) */
+ 0x00,0x00,0x00, /* 1600x1200 */
0x00,0x00,0x00,
- 0x0b,0x0b,0x0b,
- 0x08,0x08,0x08,
- 0x08,0x08,0x08,
0x00,0x00,0x00,
0x00,0x00,0x00,
0x00,0x00,0x00
};
-UCHAR SiS310_TVDelayCompensation1[] =
+const UCHAR SiS310_LCDDelayCompensation_651301LV[] = /* M650/651 301LV */
{
- 0x02,0x02, /* NTSC Enhanced, Standard */
- 0x02,0x02, /* PAL */
- 0x08,0x0b /* HiVision */
+ 0x33,0x33,0x33, /* 800x600 (guessed) */
+ 0x33,0x33,0x33, /* 1024x768 */
+ 0x33,0x33,0x33, /* 1280x1024 */
+ 0x33,0x33,0x33, /* 640x480 (unknown) */
+ 0x33,0x33,0x33, /* 1024x600 (unknown) */
+ 0x33,0x33,0x33, /* 1152x864 (unknown) */
+ 0x33,0x33,0x33, /* 1280x960 (guessed) */
+ 0x33,0x33,0x33, /* 1152x768 (unknown) */
+ 0x33,0x33,0x33, /* 1400x1050 */
+ 0x33,0x33,0x33, /* 1280x768 (guessed) */
+ 0x33,0x33,0x33, /* 1600x1200 */
+ 0x33,0x33,0x33,
+ 0x33,0x33,0x33,
+ 0x33,0x33,0x33,
+ 0x33,0x33,0x33
};
-UCHAR SiS310_CRT2DelayCompensation2 = 0x00; /* TW: From 650/301LV BIOS; was 0x0C; */ /* 301B */
+const UCHAR SiS310_LCDDelayCompensation_651302LV[] = /* M650/651 302LV */
+{
+ 0x33,0x33,0x33, /* 800x600 (guessed) */
+ 0x33,0x33,0x33, /* 1024x768 */
+ 0x33,0x33,0x33, /* 1280x1024 */
+ 0x33,0x33,0x33, /* 640x480 (unknown) */
+ 0x33,0x33,0x33, /* 1024x600 (unknown) */
+ 0x33,0x33,0x33, /* 1152x864 (unknown) */
+ 0x33,0x33,0x33, /* 1280x960 (guessed) */
+ 0x33,0x33,0x33, /* 1152x768 (unknown) */
+ 0x33,0x33,0x33, /* 1400x1050 */
+ 0x33,0x33,0x33, /* 1280x768 (guessed) */
+ 0x33,0x33,0x33, /* 1600x1200 */
+ 0x33,0x33,0x33,
+ 0x33,0x33,0x33,
+ 0x33,0x33,0x33,
+ 0x33,0x33,0x33
+};
+
+const UCHAR SiS310_TVDelayCompensation_301[] = /* 301 */
+{
+ 0x02,0x02, /* NTSC Enhanced, Standard */
+ 0x02,0x02, /* PAL */
+ 0x08,0x0b /* HiVision */
+};
-UCHAR SiS310_LCDDelayCompensation2[] =
+const UCHAR SiS310_TVDelayCompensation_301B[] = /* 30xB, 30xLV */
{
- 0x01,0x01,0x01, /* TW: From 650/301LV BIOS */
- 0x01,0x01,0x01,
- 0x01,0x01,0x01,
- 0x01,0x01,0x01,
- 0x01,0x01,0x01,
- 0x01,0x01,0x01,
- 0x01,0x01,0x01
-#if 0
- 0x00,0x00,0x00, /* 800x600 VESA, non-VESA, non-expanding */
- 0x0C,0x0C,0x0C, /* 1024x768 */
- 0x0C,0x0C,0x0C, /* 1280x1024 */
- 0x08,0x08,0x08, /* 1280x960 */
- 0x00,0x00,0x00, /* 640x480 */
- 0x00,0x00,0x00, /* 1600x1200 */
- 0x00,0x00,0x00 /* 1920x1440 */
-#endif
+ 0x03,0x03,
+ 0x03,0x03,
+ 0x03,0x03
};
-UCHAR SiS310_TVDelayCompensation2[] =
+const UCHAR SiS310_TVDelayCompensation_740301B[] = /* 740 + 30xB (30xLV?) */
{
- 0x05,0x05, /* TW: From 650/301LV BIOS */
- 0x05,0x05,
- 0x05,0x05
-#if 0
- 0x03,0x03, /* NTSC Enhanced, Standard */
- 0x03,0x03, /* PAL */
- 0x08,0x0b /* HiVision */
-#endif
+ 0x05,0x05,
+ 0x05,0x05,
+ 0x05,0x05
};
-UCHAR SiS310_CRT2DelayCompensation3 = 0x00; /* LVDS */
+const UCHAR SiS310_TVDelayCompensation_LVDS[] = /* LVDS */
+{
+ 0x0a,0x0a,
+ 0x0a,0x0a,
+ 0x0a,0x0a
+};
-UCHAR SiS310_LCDDelayCompensation3[] =
+const UCHAR SiS310_TVDelayCompensation_651301LV[] = /* M650, 651, 301LV */
{
- 0x00,0x00,0x00, /* 800x600 */
- 0x00,0x00,0x00, /* 1024x768 */
- 0x00,0x00,0x00, /* 1280x1024 */
- 0x00,0x00,0x00, /* 1400x1050 */
- 0x00,0x00,0x00 /* 1600x1200 */
+ 0x33,0x33,
+ 0x33,0x33,
+ 0x33,0x33
};
-UCHAR SiS310_TVDelayCompensation3[] =
+const UCHAR SiS310_TVDelayCompensation_651302LV[] = /* M650, 651, 302LV */
{
- 0x0a,0x0a,
- 0x0a,0x0a,
- 0x0a,0x0a
+ 0x33,0x33,
+ 0x33,0x33,
+ 0x33,0x33
};
-UCHAR SiS310_TVAntiFlick1[3][2] =
+const UCHAR SiS310_TVAntiFlick1[3][2] =
{
{0x4,0x0},
{0x4,0x8},
{0x0,0x0}
};
-UCHAR SiS310_TVEdge1[3][2] =
+const UCHAR SiS310_TVEdge1[3][2] =
{
{0x0,0x4},
{0x0,0x4},
{0x0,0x0}
};
-UCHAR SiS310_TVYFilter1[3][8][4] =
+const UCHAR SiS310_TVYFilter1[3][8][4] =
{
{
{0x00,0xf4,0x10,0x38},
@@ -121,7 +207,7 @@ UCHAR SiS310_TVYFilter1[3][8][4] =
}
};
-UCHAR SiS310_TVYFilter2[3][9][7] =
+const UCHAR SiS310_TVYFilter2[3][9][7] =
{
{
{0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46},
@@ -135,7 +221,7 @@ UCHAR SiS310_TVYFilter2[3][9][7] =
{0xFF,0xFF,0xFC,0x00,0x0F,0x22,0x28}
},
{
- {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46},
+ {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46},
{0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C},
{0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46},
{0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C},
@@ -157,7 +243,7 @@ UCHAR SiS310_TVYFilter2[3][9][7] =
}
};
-UCHAR SiS310_PALMFilter[17][4] =
+const UCHAR SiS310_PALMFilter[16][4] =
{
{0x00,0xf4,0x10,0x38},
{0x00,0xf4,0x10,0x38},
@@ -174,11 +260,10 @@ UCHAR SiS310_PALMFilter[17][4] =
{0xeb,0x04,0x25,0x18},
{0xeb,0x04,0x25,0x18},
{0xeb,0x04,0x25,0x18},
- {0xeb,0x04,0x25,0x18},
- {0xff,0xff,0xff,0xff}
+ {0xeb,0x04,0x25,0x18}
};
-UCHAR SiS310_PALNFilter[17][4] =
+const UCHAR SiS310_PALNFilter[16][4] =
{
{0x00,0xf4,0x10,0x38},
{0x00,0xf4,0x10,0x38},
@@ -195,12 +280,11 @@ UCHAR SiS310_PALNFilter[17][4] =
{0xeb,0x04,0x25,0x18},
{0xeb,0x04,0x25,0x18},
{0xeb,0x04,0x25,0x18},
- {0xeb,0x04,0x25,0x18},
- {0xff,0xff,0xff,0xff}
+ {0xeb,0x04,0x25,0x18}
};
-UCHAR SiS310_PALMFilter2[9][7] =
+const UCHAR SiS310_PALMFilter2[9][7] =
{
{0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46},
{0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C},
@@ -213,7 +297,7 @@ UCHAR SiS310_PALMFilter2[9][7] =
{0xFF,0xFF,0xFC,0x00,0x0F,0x22,0x28}
};
-UCHAR SiS310_PALNFilter2[9][7] =
+const UCHAR SiS310_PALNFilter2[9][7] =
{
{0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46},
{0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C},
@@ -226,7 +310,7 @@ UCHAR SiS310_PALNFilter2[9][7] =
{0xFF,0xFF,0xFC,0x00,0x0F,0x22,0x28}
};
-UCHAR SiS310_TVPhaseIncr1[3][2][4]=
+const UCHAR SiS310_TVPhaseIncr1[3][2][4] =
{
{
{0x21,0xed,0xba,0x08},
@@ -242,15 +326,15 @@ UCHAR SiS310_TVPhaseIncr1[3][2][4]=
}
};
-UCHAR SiS310_TVPhaseIncr2[3][2][4]=
+const UCHAR SiS310_TVPhaseIncr2[3][2][4] =
{
{
- {0x21,0xF1,0x37,0x56},
- {0x21,0xF1,0x37,0x56}
+ {0x21,0xf0,0x7b,0xd6}, /* 1.10.7w; 1.10.6s: {0x1e,0x8b,0xda,0xa7}, old: {0x21,0xF1,0x37,0x56} */
+ {0x21,0xf0,0x7b,0xd6} /* 1.10.7w; 1.10.6s: {0x1e,0x8b,0xda,0xa7} old: {0x21,0xF1,0x37,0x56} */
},
{
- {0x2a,0x09,0x86,0xe9},
- {0x2a,0x09,0x86,0xe9}
+ {0x2a,0x0a,0x41,0xe9}, /* 1.10.7w, 1.10.6s. old: {0x2a,0x09,0x86,0xe9}, */
+ {0x2a,0x0a,0x41,0xe9} /* 1.10.7w, 1.10.6s. old: {0x2a,0x09,0x86,0xe9} */
},
{
{0x2a,0x05,0xd3,0x00},
diff --git a/drivers/video/sis/osdef.h b/drivers/video/sis/osdef.h
index acd87d59b6b9..596f88359d98 100644
--- a/drivers/video/sis/osdef.h
+++ b/drivers/video/sis/osdef.h
@@ -7,6 +7,7 @@
/**********************************************************************/
#ifdef LINUX_KERNEL
#include <linux/config.h>
+ #include <linux/version.h>
#ifdef CONFIG_FB_SIS_300
#define SIS300
#endif
@@ -14,6 +15,12 @@
#ifdef CONFIG_FB_SIS_315
#define SIS315H
#endif
+ #if 1
+ #define SISFBACCEL /* Include 2D acceleration */
+ #endif
+ #if 1
+ #define SISFB_PAN /* Include Y-Panning code */
+ #endif
#else
/* #define SIS300*/
#define SIS315H
@@ -122,6 +129,10 @@
#define InPortLong(p) inl((CARD16)(p))
#endif
+/**********************************************************************/
+/* LINUX KERNEL */
+/**********************************************************************/
+
#ifdef LINUX_KERNEL
#define OutPortByte(p,v) outb((u8)(v),(u16)(p))
#define OutPortWord(p,v) outw((u16)(v),(u16)(p))
@@ -146,7 +157,7 @@
/**********************************************************************/
-/* WIN CE */
+/* WIN CE */
/**********************************************************************/
#ifdef WINCE_HEADER
diff --git a/drivers/video/sis/sis.h b/drivers/video/sis/sis.h
new file mode 100644
index 000000000000..5fa107db7e0c
--- /dev/null
+++ b/drivers/video/sis/sis.h
@@ -0,0 +1,10 @@
+#ifndef _SIS_H
+#define _SIS_H
+
+#if 1
+#define TWDEBUG(x)
+#else
+#define TWDEBUG(x) printk(KERN_INFO x "\n");
+#endif
+
+#endif
diff --git a/drivers/video/sis/sis_accel.c b/drivers/video/sis/sis_accel.c
index f59976ea08c1..f8a53bdcbd00 100644
--- a/drivers/video/sis/sis_accel.c
+++ b/drivers/video/sis/sis_accel.c
@@ -37,13 +37,21 @@
#include <linux/agp_backend.h>
#include <linux/types.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
#include <linux/sisfb.h>
+#else
+#include <video/sisfb.h>
+#endif
#include <asm/io.h>
+
+#ifdef CONFIG_MTRR
#include <asm/mtrr.h>
+#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
#include <video/fbcon.h>
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,33)
#include <video/fbcon-cfb8.h>
#include <video/fbcon-cfb16.h>
#include <video/fbcon-cfb24.h>
@@ -54,9 +62,11 @@
#include "vgatypes.h"
#include "vstruct.h"
#include "sis_accel.h"
+#include "sis.h"
extern struct video_info ivideo;
extern VGA_ENGINE sisvga_engine;
+extern int sisfb_accel;
static const int sisALUConv[] =
{
@@ -228,15 +238,38 @@ SiS310SubsequentScreenToScreenCopy(int src_x, int src_y, int dst_x, int dst_y,
int width, int height)
{
long srcbase, dstbase;
+ int mymin, mymax;
srcbase = dstbase = 0;
- if (src_y >= 2048) {
- srcbase = ivideo.video_linelength * src_y;
- src_y = 0;
- }
- if (dst_y >= 2048) {
- dstbase = ivideo.video_linelength * dst_y;
- dst_y = 0;
+ mymin = min(src_y, dst_y);
+ mymax = max(src_y, dst_y);
+
+ /* Although the chip knows the direction to use
+ * if the source and destination areas overlap,
+ * that logic fails if we fiddle with the bitmap
+ * addresses. Therefore, we check if the source
+ * and destination blitting areas overlap and
+ * adapt the bitmap addresses synchronously
+ * if the coordinates exceed the valid range.
+ * The the areas do not overlap, we do our
+ * normal check.
+ */
+ if((mymax - mymin) < height) {
+ if((src_y >= 2048) || (dst_y >= 2048)) {
+ srcbase = ivideo.video_linelength * mymin;
+ dstbase = ivideo.video_linelength * mymin;
+ src_y -= mymin;
+ dst_y -= mymin;
+ }
+ } else {
+ if(src_y >= 2048) {
+ srcbase = ivideo.video_linelength * src_y;
+ src_y = 0;
+ }
+ if(dst_y >= 2048) {
+ dstbase = ivideo.video_linelength * dst_y;
+ dst_y = 0;
+ }
}
SiS310SetupSRCBase(srcbase);
@@ -286,25 +319,62 @@ int sisfb_initaccel(void)
return(0);
}
+void sisfb_syncaccel(void)
+{
+ if(sisvga_engine == SIS_300_VGA) {
+ SiS300Sync();
+ } else {
+ SiS310Sync();
+ }
+}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,34) /* --- KERNEL 2.5.34 and later --- */
-void fbcon_sis_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
+int sisfb_sync(struct fb_info *info)
{
+ if(!sisfb_accel) return 0;
CRITFLAGS
+ if(sisvga_engine == SIS_300_VGA) {
+ SiS300Sync();
+ } else {
+ SiS310Sync();
+ }
+ CRITEND
+ return 0;
+}
+void sisfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
+{
+ int col=0;
+ CRITFLAGS
+
+ TWDEBUG("Inside sisfb_fillrect");
if(!rect->width || !rect->height)
return;
+ if(!sisfb_accel) {
+ cfb_fillrect(info, rect);
+ return;
+ }
+
+ switch(info->var.bits_per_pixel) {
+ case 8: col = rect->color;
+ break;
+ case 16: col = ((u32 *)(info->pseudo_palette))[rect->color];
+ break;
+ case 32: col = ((u32 *)(info->pseudo_palette))[rect->color];
+ break;
+ }
+
if(sisvga_engine == SIS_300_VGA) {
CRITBEGIN
- SiS300SetupForSolidFill(rect->color, myrops[rect->rop], 0);
+ SiS300SetupForSolidFill(col, myrops[rect->rop], 0);
SiS300SubsequentSolidFillRect(rect->dx, rect->dy, rect->width, rect->height);
CRITEND
SiS300Sync();
} else {
CRITBEGIN
- SiS310SetupForSolidFill(rect->color, myrops[rect->rop], 0);
+ SiS310SetupForSolidFill(col, myrops[rect->rop], 0);
SiS310SubsequentSolidFillRect(rect->dx, rect->dy, rect->width, rect->height);
CRITEND
SiS310Sync();
@@ -312,11 +382,17 @@ void fbcon_sis_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
}
-void fbcon_sis_copyarea(struct fb_info *info, const struct fb_copyarea *area)
+void sisfb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
{
int xdir, ydir;
CRITFLAGS
+ TWDEBUG("Inside sis_copyarea");
+ if(!sisfb_accel) {
+ cfb_copyarea(info, area);
+ return;
+ }
+
if(!area->width || !area->height)
return;
@@ -350,6 +426,27 @@ void fbcon_sis_bmove(struct display *p, int srcy, int srcx,
int xdir, ydir;
CRITFLAGS
+ if(!ivideo.accel) {
+ switch(ivideo.video_bpp) {
+ case 8:
+#ifdef FBCON_HAS_CFB8
+ fbcon_cfb8_bmove(p, srcy, srcx, dsty, dstx, height, width);
+#endif
+ break;
+ case 16:
+#ifdef FBCON_HAS_CFB16
+ fbcon_cfb16_bmove(p, srcy, srcx, dsty, dstx, height, width);
+#endif
+ break;
+ case 32:
+#ifdef FBCON_HAS_CFB32
+ fbcon_cfb32_bmove(p, srcy, srcx, dsty, dstx, height, width);
+#endif
+ break;
+ }
+ return;
+ }
+
srcx *= fontwidth(p);
srcy *= fontheight(p);
dstx *= fontwidth(p);
@@ -357,7 +454,6 @@ void fbcon_sis_bmove(struct display *p, int srcy, int srcx,
width *= fontwidth(p);
height *= fontheight(p);
-
if(srcx < dstx) xdir = 0;
else xdir = 1;
if(srcy < dsty) ydir = 0;
@@ -375,6 +471,10 @@ void fbcon_sis_bmove(struct display *p, int srcy, int srcx,
SiS310SubsequentScreenToScreenCopy(srcx, srcy, dstx, dsty, width, height);
CRITEND
SiS310Sync();
+#if 0
+ printk(KERN_INFO "sis_bmove sx %d sy %d dx %d dy %d w %d h %d\n",
+ srcx, srcy, dstx, dsty, width, height);
+#endif
}
}
@@ -409,6 +509,13 @@ void fbcon_sis_clear8(struct vc_data *conp, struct display *p,
{
u32 bgx;
+ if(!ivideo.accel) {
+#ifdef FBCON_HAS_CFB8
+ fbcon_cfb8_clear(conp, p, srcy, srcx, height, width);
+#endif
+ return;
+ }
+
bgx = attr_bgcol_ec(p, conp);
fbcon_sis_clear(conp, p, srcy, srcx, height, width, bgx);
}
@@ -417,6 +524,12 @@ void fbcon_sis_clear16(struct vc_data *conp, struct display *p,
int srcy, int srcx, int height, int width)
{
u32 bgx;
+ if(!ivideo.accel) {
+#ifdef FBCON_HAS_CFB16
+ fbcon_cfb16_clear(conp, p, srcy, srcx, height, width);
+#endif
+ return;
+ }
bgx = ((u_int16_t*)p->dispsw_data)[attr_bgcol_ec(p, conp)];
fbcon_sis_clear(conp, p, srcy, srcx, height, width, bgx);
@@ -427,6 +540,13 @@ void fbcon_sis_clear32(struct vc_data *conp, struct display *p,
{
u32 bgx;
+ if(!ivideo.accel) {
+#ifdef FBCON_HAS_CFB32
+ fbcon_cfb32_clear(conp, p, srcy, srcx, height, width);
+#endif
+ return;
+ }
+
bgx = ((u_int32_t*)p->dispsw_data)[attr_bgcol_ec(p, conp)];
fbcon_sis_clear(conp, p, srcy, srcx, height, width, bgx);
}
@@ -435,6 +555,22 @@ void fbcon_sis_revc(struct display *p, int srcx, int srcy)
{
CRITFLAGS
+ if(!ivideo.accel) {
+ switch(ivideo.video_bpp) {
+ case 16:
+#ifdef FBCON_HAS_CFB16
+ fbcon_cfb16_revc(p, srcx, srcy);
+#endif
+ break;
+ case 32:
+#ifdef FBCON_HAS_CFB32
+ fbcon_cfb32_revc(p, srcx, srcy);
+#endif
+ break;
+ }
+ return;
+ }
+
srcx *= fontwidth(p);
srcy *= fontheight(p);
diff --git a/drivers/video/sis/sis_accel.h b/drivers/video/sis/sis_accel.h
new file mode 100644
index 000000000000..863ea11087ca
--- /dev/null
+++ b/drivers/video/sis/sis_accel.h
@@ -0,0 +1,509 @@
+/*
+ * SiS 300/630/730/540/315/550/650/740 frame buffer driver
+ * for Linux kernels 2.4.x and 2.5.x
+ *
+ * 2D acceleration part
+ *
+ * Based on the X driver's sis300_accel.h which is
+ * Copyright Xavier Ducoin <x.ducoin@lectra.com>
+ * Copyright 2002 by Thomas Winischhofer, Vienna, Austria
+ * and sis310_accel.h which is
+ * Copyright 2002 by Thomas Winischhofer, Vienna, Austria
+ *
+ * Author: Thomas Winischhofer <thomas@winischhofer.net>:
+ * (see http://www.winischhofer.net/
+ * for more information and updates)
+ */
+
+#ifndef _SISFB_ACCEL_H
+#define _SISFB_ACCEL_H
+
+/* Guard accelerator accesses with spin_lock_irqsave? Works well without. */
+#undef SISFB_USE_SPINLOCKS
+
+#ifdef SISFB_USE_SPINLOCKS
+#include <linux/spinlock.h>
+#define CRITBEGIN spin_lock_irqsave(&ivideo.lockaccel), critflags);
+#define CRITEND spin_unlock_irqrestore(&ivideo.lockaccel), critflags);
+#define CRITFLAGS unsigned long critflags;
+#else
+#define CRITBEGIN
+#define CRITEND
+#define CRITFLAGS
+#endif
+
+/* Definitions for the SIS engine communication. */
+
+#define PATREGSIZE 384 /* Pattern register size. 384 bytes @ 0x8300 */
+#define BR(x) (0x8200 | (x) << 2)
+#define PBR(x) (0x8300 | (x) << 2)
+
+/* SiS300 engine commands */
+#define BITBLT 0x00000000 /* Blit */
+#define COLOREXP 0x00000001 /* Color expand */
+#define ENCOLOREXP 0x00000002 /* Enhanced color expand */
+#define MULTIPLE_SCANLINE 0x00000003 /* ? */
+#define LINE 0x00000004 /* Draw line */
+#define TRAPAZOID_FILL 0x00000005 /* Fill trapezoid */
+#define TRANSPARENT_BITBLT 0x00000006 /* Transparent Blit */
+
+/* Additional engine commands for 310/325 */
+#define ALPHA_BLEND 0x00000007 /* Alpha blend ? */
+#define A3D_FUNCTION 0x00000008 /* 3D command ? */
+#define CLEAR_Z_BUFFER 0x00000009 /* ? */
+#define GRADIENT_FILL 0x0000000A /* Gradient fill */
+#define STRETCH_BITBLT 0x0000000B /* Stretched Blit */
+
+/* source select */
+#define SRCVIDEO 0x00000000 /* source is video RAM */
+#define SRCSYSTEM 0x00000010 /* source is system memory */
+#define SRCCPUBLITBUF SRCSYSTEM /* source is CPU-driven BitBuffer (for color expand) */
+#define SRCAGP 0x00000020 /* source is AGP memory (?) */
+
+/* Pattern flags */
+#define PATFG 0x00000000 /* foreground color */
+#define PATPATREG 0x00000040 /* pattern in pattern buffer (0x8300) */
+#define PATMONO 0x00000080 /* mono pattern */
+
+/* blitting direction (300 series only) */
+#define X_INC 0x00010000
+#define X_DEC 0x00000000
+#define Y_INC 0x00020000
+#define Y_DEC 0x00000000
+
+/* Clipping flags */
+#define NOCLIP 0x00000000
+#define NOMERGECLIP 0x04000000
+#define CLIPENABLE 0x00040000
+#define CLIPWITHOUTMERGE 0x04040000
+
+/* Transparency */
+#define OPAQUE 0x00000000
+#define TRANSPARENT 0x00100000
+
+/* ? */
+#define DSTAGP 0x02000000
+#define DSTVIDEO 0x02000000
+
+/* Line */
+#define LINE_STYLE 0x00800000
+#define NO_RESET_COUNTER 0x00400000
+#define NO_LAST_PIXEL 0x00200000
+
+/* Subfunctions for Color/Enhanced Color Expansion (310/325 only) */
+#define COLOR_TO_MONO 0x00100000
+#define AA_TEXT 0x00200000
+
+/* Some general registers for 310/325 series */
+#define SRC_ADDR 0x8200
+#define SRC_PITCH 0x8204
+#define AGP_BASE 0x8206 /* color-depth dependent value */
+#define SRC_Y 0x8208
+#define SRC_X 0x820A
+#define DST_Y 0x820C
+#define DST_X 0x820E
+#define DST_ADDR 0x8210
+#define DST_PITCH 0x8214
+#define DST_HEIGHT 0x8216
+#define RECT_WIDTH 0x8218
+#define RECT_HEIGHT 0x821A
+#define PAT_FGCOLOR 0x821C
+#define PAT_BGCOLOR 0x8220
+#define SRC_FGCOLOR 0x8224
+#define SRC_BGCOLOR 0x8228
+#define MONO_MASK 0x822C
+#define LEFT_CLIP 0x8234
+#define TOP_CLIP 0x8236
+#define RIGHT_CLIP 0x8238
+#define BOTTOM_CLIP 0x823A
+#define COMMAND_READY 0x823C
+#define FIRE_TRIGGER 0x8240
+
+#define PATTERN_REG 0x8300 /* 384 bytes pattern buffer */
+
+/* Line registers */
+#define LINE_X0 SRC_Y
+#define LINE_X1 DST_Y
+#define LINE_Y0 SRC_X
+#define LINE_Y1 DST_X
+#define LINE_COUNT RECT_WIDTH
+#define LINE_STYLE_PERIOD RECT_HEIGHT
+#define LINE_STYLE_0 MONO_MASK
+#define LINE_STYLE_1 0x8230
+#define LINE_XN PATTERN_REG
+#define LINE_YN PATTERN_REG+2
+
+/* Transparent bitblit registers */
+#define TRANS_DST_KEY_HIGH PAT_FGCOLOR
+#define TRANS_DST_KEY_LOW PAT_BGCOLOR
+#define TRANS_SRC_KEY_HIGH SRC_FGCOLOR
+#define TRANS_SRC_KEY_LOW SRC_BGCOLOR
+
+/* Queue */
+#define Q_BASE_ADDR 0x85C0 /* Base address of software queue (?) */
+#define Q_WRITE_PTR 0x85C4 /* Current write pointer (?) */
+#define Q_READ_PTR 0x85C8 /* Current read pointer (?) */
+#define Q_STATUS 0x85CC /* queue status */
+
+
+#define MMIO_IN8(base, offset) \
+ *(volatile u8 *)(((u8*)(base)) + (offset))
+#define MMIO_IN16(base, offset) \
+ *(volatile u16 *)(void *)(((u8*)(base)) + (offset))
+#define MMIO_IN32(base, offset) \
+ *(volatile u32 *)(void *)(((u8*)(base)) + (offset))
+#define MMIO_OUT8(base, offset, val) \
+ *(volatile u8 *)(((u8*)(base)) + (offset)) = (val)
+#define MMIO_OUT16(base, offset, val) \
+ *(volatile u16 *)(void *)(((u8*)(base)) + (offset)) = (val)
+#define MMIO_OUT32(base, offset, val) \
+ *(volatile u32 *)(void *)(((u8*)(base)) + (offset)) = (val)
+
+/* ------------- SiS 300 series -------------- */
+
+/* Macros to do useful things with the SIS BitBLT engine */
+
+/* BR(16) (0x8420):
+
+ bit 31 2D engine: 1 is idle,
+ bit 30 3D engine: 1 is idle,
+ bit 29 Command queue: 1 is empty
+
+ bits 28:24: Current CPU driven BitBlt buffer stage bit[4:0]
+
+ bits 15:0: Current command queue length
+
+*/
+
+/* TW: BR(16)+2 = 0x8242 */
+
+int CmdQueLen;
+
+#define SiS300Idle \
+ { \
+ while( (MMIO_IN16(ivideo.mmio_vbase, BR(16)+2) & 0xE000) != 0xE000){}; \
+ while( (MMIO_IN16(ivideo.mmio_vbase, BR(16)+2) & 0xE000) != 0xE000){}; \
+ while( (MMIO_IN16(ivideo.mmio_vbase, BR(16)+2) & 0xE000) != 0xE000){}; \
+ CmdQueLen=MMIO_IN16(ivideo.mmio_vbase, 0x8240); \
+ }
+/* TW: (do three times, because 2D engine seems quite unsure about whether or not it's idle) */
+
+#define SiS300SetupSRCBase(base) \
+ if (CmdQueLen <= 0) SiS300Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, BR(0), base);\
+ CmdQueLen --;
+
+#define SiS300SetupSRCPitch(pitch) \
+ if (CmdQueLen <= 0) SiS300Idle;\
+ MMIO_OUT16(ivideo.mmio_vbase, BR(1), pitch);\
+ CmdQueLen --;
+
+#define SiS300SetupSRCXY(x,y) \
+ if (CmdQueLen <= 0) SiS300Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, BR(2), (x)<<16 | (y) );\
+ CmdQueLen --;
+
+#define SiS300SetupDSTBase(base) \
+ if (CmdQueLen <= 0) SiS300Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, BR(4), base);\
+ CmdQueLen --;
+
+#define SiS300SetupDSTXY(x,y) \
+ if (CmdQueLen <= 0) SiS300Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, BR(3), (x)<<16 | (y) );\
+ CmdQueLen --;
+
+#define SiS300SetupDSTRect(x,y) \
+ if (CmdQueLen <= 0) SiS300Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, BR(5), (y)<<16 | (x) );\
+ CmdQueLen --;
+
+#define SiS300SetupDSTColorDepth(bpp) \
+ if (CmdQueLen <= 0) SiS300Idle;\
+ MMIO_OUT16(ivideo.mmio_vbase, BR(1)+2, bpp);\
+ CmdQueLen --;
+
+#define SiS300SetupRect(w,h) \
+ if (CmdQueLen <= 0) SiS300Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, BR(6), (h)<<16 | (w) );\
+ CmdQueLen --;
+
+#define SiS300SetupPATFG(color) \
+ if (CmdQueLen <= 0) SiS300Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, BR(7), color);\
+ CmdQueLen --;
+
+#define SiS300SetupPATBG(color) \
+ if (CmdQueLen <= 0) SiS300Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, BR(8), color);\
+ CmdQueLen --;
+
+#define SiS300SetupSRCFG(color) \
+ if (CmdQueLen <= 0) SiS300Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, BR(9), color);\
+ CmdQueLen --;
+
+#define SiS300SetupSRCBG(color) \
+ if (CmdQueLen <= 0) SiS300Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, BR(10), color);\
+ CmdQueLen --;
+
+/* 0x8224 src colorkey high */
+/* 0x8228 src colorkey low */
+/* 0x821c dest colorkey high */
+/* 0x8220 dest colorkey low */
+#define SiS300SetupSRCTrans(color) \
+ if (CmdQueLen <= 1) SiS300Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, 0x8224, color);\
+ MMIO_OUT32(ivideo.mmio_vbase, 0x8228, color);\
+ CmdQueLen -= 2;
+
+#define SiS300SetupDSTTrans(color) \
+ if (CmdQueLen <= 1) SiS300Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, 0x821C, color); \
+ MMIO_OUT32(ivideo.mmio_vbase, 0x8220, color); \
+ CmdQueLen -= 2;
+
+#define SiS300SetupMONOPAT(p0,p1) \
+ if (CmdQueLen <= 1) SiS300Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, BR(11), p0);\
+ MMIO_OUT32(ivideo.mmio_vbase, BR(12), p1);\
+ CmdQueLen -= 2;
+
+#define SiS300SetupClipLT(left,top) \
+ if (CmdQueLen <= 0) SiS300Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, BR(13), ((left) & 0xFFFF) | (top)<<16 );\
+ CmdQueLen--;
+
+#define SiS300SetupClipRB(right,bottom) \
+ if (CmdQueLen <= 0) SiS300Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, BR(14), ((right) & 0xFFFF) | (bottom)<<16 );\
+ CmdQueLen--;
+
+/* General */
+#define SiS300SetupROP(rop) \
+ ivideo.CommandReg = (rop) << 8;
+
+#define SiS300SetupCMDFlag(flags) \
+ ivideo.CommandReg |= (flags);
+
+#define SiS300DoCMD \
+ if (CmdQueLen <= 1) SiS300Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, BR(15), ivideo.CommandReg); \
+ MMIO_OUT32(ivideo.mmio_vbase, BR(16), 0);\
+ CmdQueLen -= 2;
+
+/* Line */
+#define SiS300SetupX0Y0(x,y) \
+ if (CmdQueLen <= 0) SiS300Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, BR(2), (y)<<16 | (x) );\
+ CmdQueLen--;
+
+#define SiS300SetupX1Y1(x,y) \
+ if (CmdQueLen <= 0) SiS300Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, BR(3), (y)<<16 | (x) );\
+ CmdQueLen--;
+
+#define SiS300SetupLineCount(c) \
+ if (CmdQueLen <= 0) SiS300Idle;\
+ MMIO_OUT16(ivideo.mmio_vbase, BR(6), c);\
+ CmdQueLen--;
+
+#define SiS300SetupStylePeriod(p) \
+ if (CmdQueLen <= 0) SiS300Idle;\
+ MMIO_OUT16(ivideo.mmio_vbase, BR(6)+2, p);\
+ CmdQueLen--;
+
+#define SiS300SetupStyleLow(ls) \
+ if (CmdQueLen <= 0) SiS300Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, BR(11), ls);\
+ CmdQueLen--;
+
+#define SiS300SetupStyleHigh(ls) \
+ if (CmdQueLen <= 0) SiS300Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, BR(12), ls);\
+ CmdQueLen--;
+
+
+
+/* ----------- SiS 310/325 series --------------- */
+
+/* Q_STATUS:
+ bit 31 = 1: All engines idle and all queues empty
+ bit 30 = 1: Hardware Queue (=HW CQ, 2D queue, 3D queue) empty
+ bit 29 = 1: 2D engine is idle
+ bit 28 = 1: 3D engine is idle
+ bit 27 = 1: HW command queue empty
+ bit 26 = 1: 2D queue empty
+ bit 25 = 1: 3D queue empty
+ bit 24 = 1: SW command queue empty
+ bits 23:16: 2D counter 3
+ bits 15:8: 2D counter 2
+ bits 7:0: 2D counter 1
+
+ Where is the command queue length (current amount of commands the queue
+ can accept) on the 310/325 series? (The current implementation is taken
+ from 300 series and certainly wrong...)
+*/
+
+/* TW: FIXME: CmdQueLen is... where....? */
+#define SiS310Idle \
+ { \
+ while( (MMIO_IN16(ivideo.mmio_vbase, Q_STATUS+2) & 0x8000) != 0x8000){}; \
+ while( (MMIO_IN16(ivideo.mmio_vbase, Q_STATUS+2) & 0x8000) != 0x8000){}; \
+ CmdQueLen=MMIO_IN16(ivideo.mmio_vbase, Q_STATUS); \
+ }
+
+#define SiS310SetupSRCBase(base) \
+ if (CmdQueLen <= 0) SiS310Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, SRC_ADDR, base);\
+ CmdQueLen--;
+
+#define SiS310SetupSRCPitch(pitch) \
+ if (CmdQueLen <= 0) SiS310Idle;\
+ MMIO_OUT16(ivideo.mmio_vbase, SRC_PITCH, pitch);\
+ CmdQueLen--;
+
+#define SiS310SetupSRCXY(x,y) \
+ if (CmdQueLen <= 0) SiS310Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, SRC_Y, (x)<<16 | (y) );\
+ CmdQueLen--;
+
+#define SiS310SetupDSTBase(base) \
+ if (CmdQueLen <= 0) SiS310Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, DST_ADDR, base);\
+ CmdQueLen--;
+
+#define SiS310SetupDSTXY(x,y) \
+ if (CmdQueLen <= 0) SiS310Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, DST_Y, (x)<<16 | (y) );\
+ CmdQueLen--;
+
+#define SiS310SetupDSTRect(x,y) \
+ if (CmdQueLen <= 0) SiS310Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, DST_PITCH, (y)<<16 | (x) );\
+ CmdQueLen--;
+
+#define SiS310SetupDSTColorDepth(bpp) \
+ if (CmdQueLen <= 0) SiS310Idle;\
+ MMIO_OUT16(ivideo.mmio_vbase, AGP_BASE, bpp);\
+ CmdQueLen--;
+
+#define SiS310SetupRect(w,h) \
+ if (CmdQueLen <= 0) SiS310Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, RECT_WIDTH, (h)<<16 | (w) );\
+ CmdQueLen--;
+
+#define SiS310SetupPATFG(color) \
+ if (CmdQueLen <= 0) SiS310Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, PAT_FGCOLOR, color);\
+ CmdQueLen--;
+
+#define SiS310SetupPATBG(color) \
+ if (CmdQueLen <= 0) SiS310Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, PAT_BGCOLOR, color);\
+ CmdQueLen--;
+
+#define SiS310SetupSRCFG(color) \
+ if (CmdQueLen <= 0) SiS310Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, SRC_FGCOLOR, color);\
+ CmdQueLen--;
+
+#define SiS310SetupSRCBG(color) \
+ if (CmdQueLen <= 0) SiS310Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, SRC_BGCOLOR, color);\
+ CmdQueLen--;
+
+#define SiS310SetupSRCTrans(color) \
+ if (CmdQueLen <= 1) SiS310Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, TRANS_SRC_KEY_HIGH, color);\
+ MMIO_OUT32(ivideo.mmio_vbase, TRANS_SRC_KEY_LOW, color);\
+ CmdQueLen -= 2;
+
+#define SiS310SetupDSTTrans(color) \
+ if (CmdQueLen <= 1) SiS310Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, TRANS_DST_KEY_HIGH, color); \
+ MMIO_OUT32(ivideo.mmio_vbase, TRANS_DST_KEY_LOW, color); \
+ CmdQueLen -= 2;
+
+#define SiS310SetupMONOPAT(p0,p1) \
+ if (CmdQueLen <= 1) SiS310Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, MONO_MASK, p0);\
+ MMIO_OUT32(ivideo.mmio_vbase, MONO_MASK+4, p1);\
+ CmdQueLen -= 2;
+
+#define SiS310SetupClipLT(left,top) \
+ if (CmdQueLen <= 0) SiS310Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, LEFT_CLIP, ((left) & 0xFFFF) | (top)<<16 );\
+ CmdQueLen--;
+
+#define SiS310SetupClipRB(right,bottom) \
+ if (CmdQueLen <= 0) SiS310Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, RIGHT_CLIP, ((right) & 0xFFFF) | (bottom)<<16 );\
+ CmdQueLen--;
+
+#define SiS310SetupROP(rop) \
+ ivideo.CommandReg = (rop) << 8;
+
+#define SiS310SetupCMDFlag(flags) \
+ ivideo.CommandReg |= (flags);
+
+#define SiS310DoCMD \
+ if (CmdQueLen <= 1) SiS310Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, COMMAND_READY, ivideo.CommandReg); \
+ MMIO_OUT32(ivideo.mmio_vbase, FIRE_TRIGGER, 0); \
+ CmdQueLen -= 2;
+
+#define SiS310SetupX0Y0(x,y) \
+ if (CmdQueLen <= 0) SiS310Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, LINE_X0, (y)<<16 | (x) );\
+ CmdQueLen--;
+
+#define SiS310SetupX1Y1(x,y) \
+ if (CmdQueLen <= 0) SiS310Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, LINE_X1, (y)<<16 | (x) );\
+ CmdQueLen--;
+
+#define SiS310SetupLineCount(c) \
+ if (CmdQueLen <= 0) SiS310Idle;\
+ MMIO_OUT16(ivideo.mmio_vbase, LINE_COUNT, c);\
+ CmdQueLen--;
+
+#define SiS310SetupStylePeriod(p) \
+ if (CmdQueLen <= 0) SiS310Idle;\
+ MMIO_OUT16(ivideo.mmio_vbase, LINE_STYLE_PERIOD, p);\
+ CmdQueLen--;
+
+#define SiS310SetupStyleLow(ls) \
+ if (CmdQueLen <= 0) SiS310Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, LINE_STYLE_0, ls);\
+ CmdQueLen--;
+
+#define SiS310SetupStyleHigh(ls) \
+ if (CmdQueLen <= 0) SiS310Idle;\
+ MMIO_OUT32(ivideo.mmio_vbase, LINE_STYLE_1, ls);\
+ CmdQueLen--;
+
+int sisfb_initaccel(void);
+void sisfb_syncaccel(void);
+
+extern struct video_info ivideo;
+
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,33)
+void fbcon_sis_bmove(struct display *p, int srcy, int srcx, int dsty,
+ int dstx, int height, int width);
+void fbcon_sis_revc(struct display *p, int srcy, int srcx);
+void fbcon_sis_clear8(struct vc_data *conp, struct display *p, int srcy,
+ int srcx, int height, int width);
+void fbcon_sis_clear16(struct vc_data *conp, struct display *p, int srcy,
+ int srcx, int height, int width);
+void fbcon_sis_clear32(struct vc_data *conp, struct display *p, int srcy,
+ int srcx, int height, int width);
+#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,34)
+extern int sisfb_accel;
+void sisfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect);
+void sisfb_copyarea(struct fb_info *info, const struct fb_copyarea *area);
+#endif
+
+#endif
diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c
index a6cb38550bc7..83f63d73df8e 100644
--- a/drivers/video/sis/sis_main.c
+++ b/drivers/video/sis/sis_main.c
@@ -8,14 +8,17 @@
* Authors: SiS (www.sis.com.tw)
* (Various others)
* Thomas Winischhofer <thomas@winischhofer.net>:
- * - many fixes and enhancements for 630 & 310/325 series,
- * - extended bridge handling, TV output for Chrontel
+ * - SiS Xabre (330) support
+ * - many fixes and enhancements for all chipset series,
+ * - extended bridge handling, TV output for Chrontel 7005
* - 650/LVDS support (for LCD panels up to 1400x1050)
* - 650/Chrontel 7019 support
- * - 301B/301LV LCD and TV support
+ * - 30xB/30xLV LCD, TV and VGA2 support
* - memory queue handling enhancements,
- * - everything marked with "TW"
- * (see http://www.winischhofer.net/linuxsis630.shtml
+ * - 2D acceleration and y-panning,
+ * - portation to 2.5 API (yet incomplete)
+ * - everything marked with "TW" and more
+ * (see http://www.winischhofer.net/
* for more information and updates)
*/
@@ -39,81 +42,74 @@
#include <linux/capability.h>
#include <linux/fs.h>
#include <linux/agp_backend.h>
-
#include <linux/types.h>
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+#include <linux/spinlock.h>
+#endif
+
+#include "osdef.h"
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+#include <video/sisfb.h>
+#else
#include <linux/sisfb.h>
+#endif
#include <asm/io.h>
-#include <asm/mtrr.h>
+#ifdef CONFIG_MTRR
+#include <asm/mtrr.h>
+#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
#include <video/fbcon.h>
#include <video/fbcon-cfb8.h>
#include <video/fbcon-cfb16.h>
#include <video/fbcon-cfb24.h>
#include <video/fbcon-cfb32.h>
+#endif
-#include "osdef.h"
#include "vgatypes.h"
#include "sis_main.h"
-//#ifdef LINUXBIOS
-//#include "bios.h"
-//#endif
+#include "sis.h"
+
+#if 0
+#ifdef LINUXBIOS
+#include "bios.h"
+#endif
+#endif
/* -------------------- Macro definitions ---------------------------- */
-// #define SISFBDEBUG
-#undef SISFBDEBUG /* TW */
+
+#undef SISFBDEBUG /* TW: no debugging */
+
#ifdef SISFBDEBUG
#define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args)
#else
#define DPRINTK(fmt, args...)
#endif
-#define vgawb(reg,data) \
- (outb(data, ivideo.vga_base+reg))
-#define vgaww(reg,data) \
- (outw(data, ivideo.vga_base+reg))
-#define vgawl(reg,data) \
- (outl(data, ivideo.vga_base+reg))
-#define vgarb(reg) \
- (inb(ivideo.vga_base+reg))
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+#ifdef SISFBACCEL
+#ifdef FBCON_HAS_CFB8
+extern struct display_switch fbcon_sis8;
+#endif
+#ifdef FBCON_HAS_CFB16
+extern struct display_switch fbcon_sis16;
+#endif
+#ifdef FBCON_HAS_CFB32
+extern struct display_switch fbcon_sis32;
+#endif
+#endif
+#endif
/* --------------- Hardware Access Routines -------------------------- */
-void sisfb_set_reg1(u16 port, u16 index, u16 data)
-{
- outb((u8) (index & 0xff), port);
- port++;
- outb((u8) (data & 0xff), port);
-}
-
-void sisfb_set_reg3(u16 port, u16 data)
-{
- outb((u8) (data & 0xff), port);
-}
-
void sisfb_set_reg4(u16 port, unsigned long data)
{
outl((u32) (data & 0xffffffff), port);
}
-u8 sisfb_get_reg1(u16 port, u16 index)
-{
- u8 data;
-
- outb((u8) (index & 0xff), port);
- port += 1;
- data = inb(port);
- return (data);
-}
-
-u8 sisfb_get_reg2(u16 port)
-{
- u8 data;
-
- data = inb(port);
- return (data);
-}
-
u32 sisfb_get_reg3(u16 port)
{
u32 data;
@@ -122,25 +118,7 @@ u32 sisfb_get_reg3(u16 port)
return (data);
}
-// Eden Chen
-//void sisfb_clear_DAC(u16 port)
-//{
-// int i,j;
-//
-// vgawb(DAC_ADR, 0x00);
-// for(i=0; i<256; i++)
-// for(j=0; j<3; j++)
-// vgawb(DAC_DATA, 0);
-//}
-
-//void sisfb_clear_buffer(PHW_DEVICE_EXTENSION psishw_ext)
-//{
-// memset((char *) ivideo.video_vbase, 0,
-// video_linelength * ivideo.video_height);
-//}
-// ~Eden Chen
-
-/* --------------- Interface to BIOS code ---------------------------- */
+/* ------------ Interface for init & mode switching code ------------- */
BOOLEAN
sisfb_query_VGA_config_space(PSIS_HW_DEVICE_INFO psishw_ext,
@@ -206,6 +184,9 @@ BOOLEAN sisfb_query_north_bridge_space(PSIS_HW_DEVICE_INFO psishw_ext,
case SIS_650:
nbridge_id = PCI_DEVICE_ID_SI_650;
break;
+ case SIS_740:
+ nbridge_id = PCI_DEVICE_ID_SI_740;
+ break;
default:
nbridge_id = 0;
break;
@@ -236,186 +217,188 @@ BOOLEAN sisfb_query_north_bridge_space(PSIS_HW_DEVICE_INFO psishw_ext,
return TRUE;
}
-/* -------------------- Export functions ----------------------------- */
+/* ------------------ Internal helper routines ----------------- */
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,23)
-static void sis_get_glyph(SIS_GLYINFO *gly)
-#else
-static void sis_get_glyph(struct fb_info *info, SIS_GLYINFO *gly)
-#endif
+static void sisfb_search_mode(const char *name)
{
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,23)
- struct display *p = &fb_display[currcon];
-#else
- struct display *p = &fb_display[info->currcon];
-#endif
- u16 c;
- u8 *cdat;
- int widthb;
- u8 *gbuf = gly->gmask;
- int size;
-
-
- gly->fontheight = fontheight(p);
- gly->fontwidth = fontwidth(p);
- widthb = (fontwidth(p) + 7) / 8;
+ int i = 0, j = 0;
- c = gly->ch & p->charmask;
- if (fontwidth(p) <= 8)
- cdat = p->fontdata + c * fontheight(p);
- else
- cdat = p->fontdata + (c * fontheight(p) << 1);
-
- size = fontheight(p) * widthb;
- memcpy(gbuf, cdat, size);
- gly->ngmask = size;
-}
+ if(name == NULL) {
+ printk(KERN_ERR "sisfb: Internal error, using default mode.\n");
+ sisfb_mode_idx = DEFAULT_MODE;
+ return;
+ }
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+ if (!strcmp(name, sisbios_mode[MODE_INDEX_NONE].name)) {
+ printk(KERN_ERR "sisfb: Mode 'none' not supported anymore. Using default.\n");
+ sisfb_mode_idx = DEFAULT_MODE;
+ return;
+ }
+#endif
-void sis_dispinfo(struct ap_data *rec)
-{
- rec->minfo.bpp = ivideo.video_bpp;
- rec->minfo.xres = ivideo.video_width;
- rec->minfo.yres = ivideo.video_height;
- rec->minfo.v_xres = ivideo.video_vwidth;
- rec->minfo.v_yres = ivideo.video_vheight;
- rec->minfo.org_x = ivideo.org_x;
- rec->minfo.org_y = ivideo.org_y;
- rec->minfo.vrate = ivideo.refresh_rate;
- rec->iobase = ivideo.vga_base - 0x30;
- rec->mem_size = ivideo.video_size;
- rec->disp_state = ivideo.disp_state;
- rec->version = (VER_MAJOR << 24) | (VER_MINOR << 16) | VER_LEVEL;
- rec->hasVB = ivideo.hasVB;
- rec->TV_type = ivideo.TV_type;
- rec->TV_plug = ivideo.TV_plug;
- rec->chip = ivideo.chip;
+ while(sisbios_mode[i].mode_no != 0) {
+ if (!strcmp(name, sisbios_mode[i].name)) {
+ sisfb_mode_idx = i;
+ j = 1;
+ break;
+ }
+ i++;
+ }
+ if(!j) printk(KERN_INFO "sisfb: Invalid mode '%s'\n", name);
}
-/* ------------------ Internal Routines ------------------------------ */
-
-static void sisfb_search_mode(const char *name)
+static void sisfb_search_vesamode(unsigned int vesamode)
{
- int i = 0;
+ int i = 0, j = 0;
- if (name == NULL)
+ if(vesamode == 0) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+ sisfb_mode_idx = MODE_INDEX_NONE;
+#else
+ printk(KERN_ERR "sisfb: Mode 'none' not supported anymore. Using default.\n");
+ sisfb_mode_idx = DEFAULT_MODE;
+#endif
return;
+ }
- while (sisbios_mode[i].mode_no != 0) {
- if (!strcmp(name, sisbios_mode[i].name)) {
+ vesamode &= 0x1dff; /* Clean VESA mode number from other flags */
+
+ while(sisbios_mode[i].mode_no != 0) {
+ if( (sisbios_mode[i].vesa_mode_no_1 == vesamode) ||
+ (sisbios_mode[i].vesa_mode_no_2 == vesamode) ) {
sisfb_mode_idx = i;
+ j = 1;
break;
}
i++;
}
- if (sisfb_mode_idx < 0)
- printk(KERN_INFO "sisfb: Invalid mode '%s'\n", name);
+ if(!j) printk(KERN_INFO "sisfb: Invalid VESA mode 0x%x'\n", vesamode);
}
-static void sisfb_validate_mode(void)
+static int sisfb_validate_mode(int myindex)
{
u16 xres, yres;
- switch (ivideo.disp_state & DISPTYPE_DISP2) {
- case DISPTYPE_LCD:
- switch (sishw_ext.ulCRT2LCDType) {
- case LCD_1024x768:
- xres = 1024; yres = 768; break;
- case LCD_1280x1024:
- xres = 1280; yres = 1024; break;
- case LCD_1280x960:
- xres = 1280; yres = 960; break;
- case LCD_2048x1536:
- xres = 2048; yres = 1536; break;
- case LCD_1920x1440:
- xres = 1920; yres = 1440; break;
- case LCD_1600x1200:
- xres = 1600; yres = 1200; break;
- case LCD_800x600:
- xres = 800; yres = 600; break;
- case LCD_640x480:
- xres = 640; yres = 480; break;
- case LCD_320x480: /* TW: FSTN */
- xres = 320; yres = 480; break;
- case LCD_1024x600:
- xres = 1024; yres = 600; break;
- case LCD_1152x864:
- xres = 1152; yres = 864; break;
- case LCD_1152x768:
- xres = 1152; yres = 768; break;
- case LCD_1280x768:
- xres = 1280; yres = 768; break;
- case LCD_1400x1050:
- xres = 1400; yres = 1050; break;
- default:
- xres = 0; yres = 0; break;
- }
- if(sisbios_mode[sisfb_mode_idx].xres > xres)
- sisfb_mode_idx = -1;
- if(sisbios_mode[sisfb_mode_idx].yres > yres)
- sisfb_mode_idx = -1;
- if (sisbios_mode[sisfb_mode_idx].xres == 720)
- sisfb_mode_idx = -1;
+#ifdef CONFIG_FB_SIS_300
+ if(sisvga_engine == SIS_300_VGA) {
+ if(!(sisbios_mode[myindex].chipset & MD_SIS300)) {
+ return(-1);
+ }
+ }
+#endif
+#ifdef CONFIG_FB_SIS_315
+ if(sisvga_engine == SIS_315_VGA) {
+ if(!(sisbios_mode[myindex].chipset & MD_SIS315)) {
+ return(-1);
+ }
+ }
+#endif
+
+ switch (ivideo.disp_state & DISPTYPE_DISP2) {
+ case DISPTYPE_LCD:
+ switch (sishw_ext.ulCRT2LCDType) {
+ case LCD_1024x768:
+ xres = 1024; yres = 768; break;
+ case LCD_1280x1024:
+ xres = 1280; yres = 1024; break;
+ case LCD_1280x960:
+ xres = 1280; yres = 960; break;
+ case LCD_2048x1536:
+ xres = 2048; yres = 1536; break;
+ case LCD_1920x1440:
+ xres = 1920; yres = 1440; break;
+ case LCD_1600x1200:
+ xres = 1600; yres = 1200; break;
+ case LCD_800x600:
+ xres = 800; yres = 600; break;
+ case LCD_640x480:
+ xres = 640; yres = 480; break;
+ case LCD_320x480: /* TW: FSTN */
+ xres = 320; yres = 480; break;
+ case LCD_1024x600:
+ xres = 1024; yres = 600; break;
+ case LCD_1152x864:
+ xres = 1152; yres = 864; break;
+ case LCD_1152x768:
+ xres = 1152; yres = 768; break;
+ case LCD_1280x768:
+ xres = 1280; yres = 768; break;
+ case LCD_1400x1050:
+ xres = 1400; yres = 1050; break;
+ default:
+ xres = 0; yres = 0; break;
+ }
+ if(sisbios_mode[myindex].xres > xres) {
+ return(-1);
+ }
+ if(sisbios_mode[myindex].yres > yres) {
+ return(-1);
+ }
+ if (sisbios_mode[myindex].xres == 720) {
+ return(-1);
+ }
+ break;
+ case DISPTYPE_TV:
+ switch (sisbios_mode[myindex].xres) {
+ case 512:
+ case 640:
+ case 800:
break;
- case DISPTYPE_TV:
- switch (sisbios_mode[sisfb_mode_idx].xres) {
- case 512:
- case 640:
- case 800:
- break;
- case 720:
- if (ivideo.TV_type == TVMODE_NTSC) {
- if (sisbios_mode[sisfb_mode_idx].yres != 480)
- sisfb_mode_idx = -1;
- } else if (ivideo.TV_type == TVMODE_PAL) {
- if (sisbios_mode[sisfb_mode_idx].yres != 576)
- sisfb_mode_idx = -1;
+ case 720:
+ if (ivideo.TV_type == TVMODE_NTSC) {
+ if (sisbios_mode[myindex].yres != 480) {
+ return(-1);
}
- /* TW: LVDS/CHRONTEL does not support 720 */
- if (ivideo.hasVB == HASVB_LVDS_CHRONTEL ||
- ivideo.hasVB == HASVB_CHRONTEL)
- sisfb_mode_idx = -1;
- break;
- case 1024:
- if (ivideo.TV_type == TVMODE_NTSC) {
- if(sisbios_mode[sisfb_mode_idx].bpp == 32)
- sisfb_mode_idx = -1;
+ } else if (ivideo.TV_type == TVMODE_PAL) {
+ if (sisbios_mode[myindex].yres != 576) {
+ return(-1);
}
- /* TW: LVDS/CHRONTEL only supports < 800 (1024 on 650/Ch7019)*/
- if (ivideo.hasVB == HASVB_LVDS_CHRONTEL ||
- ivideo.hasVB == HASVB_CHRONTEL) {
- if(ivideo.chip < SIS_315H) {
- sisfb_mode_idx = -1;
- }
+ }
+ /* TW: LVDS/CHRONTEL does not support 720 */
+ if (ivideo.hasVB == HASVB_LVDS_CHRONTEL ||
+ ivideo.hasVB == HASVB_CHRONTEL) {
+ return(-1);
+ }
+ break;
+ case 1024:
+ if (ivideo.TV_type == TVMODE_NTSC) {
+ if(sisbios_mode[myindex].bpp == 32) {
+ return(-1);
}
- break;
- default:
- sisfb_mode_idx = -1;
+ }
+ /* TW: LVDS/CHRONTEL only supports < 800 (1024 on 650/Ch7019)*/
+ if (ivideo.hasVB == HASVB_LVDS_CHRONTEL ||
+ ivideo.hasVB == HASVB_CHRONTEL) {
+ if(ivideo.chip < SIS_315H) {
+ return(-1);
+ }
}
break;
+ default:
+ return(-1);
}
-
- if(ivideo.chip < SIS_315H) {
- if(sisbios_mode[sisfb_mode_idx].xres > 1920)
- sisfb_mode_idx = -1;
- }
- /* TW: TODO: Validate modes available on either 300 or 310/325 series only */
+ break;
+ }
+ return(myindex);
}
static void sisfb_search_crt2type(const char *name)
{
int i = 0;
- if (name == NULL)
+ if(name == NULL)
return;
- while (sis_crt2type[i].type_no != -1) {
+ while(sis_crt2type[i].type_no != -1) {
if (!strcmp(name, sis_crt2type[i].name)) {
sisfb_crt2type = sis_crt2type[i].type_no;
+ sisfb_tvplug = sis_crt2type[i].tvplug_no;
break;
}
i++;
}
- if (sisfb_crt2type < 0)
+ if(sisfb_crt2type < 0)
printk(KERN_INFO "sisfb: Invalid CRT2 type: %s\n", name);
}
@@ -423,7 +406,7 @@ static void sisfb_search_queuemode(const char *name)
{
int i = 0;
- if (name == NULL)
+ if(name == NULL)
return;
while (sis_queuemode[i].type_no != -1) {
@@ -452,7 +435,7 @@ static u8 sisfb_search_refresh_rate(unsigned int rate)
sisfb_rate_idx = sisfb_vrate[i].idx;
break;
} else if (sisfb_vrate[i].refresh > rate) {
- if ((sisfb_vrate[i].refresh - rate) <= 2) {
+ if ((sisfb_vrate[i].refresh - rate) <= 3) {
DPRINTK("sisfb: Adjusting rate from %d up to %d\n",
rate, sisfb_vrate[i].refresh);
sisfb_rate_idx = sisfb_vrate[i].idx;
@@ -463,9 +446,14 @@ static u8 sisfb_search_refresh_rate(unsigned int rate)
rate, sisfb_vrate[i-1].refresh);
sisfb_rate_idx = sisfb_vrate[i-1].idx;
ivideo.refresh_rate = sisfb_vrate[i-1].refresh;
- }
+ }
break;
- }
+ } else if((rate - sisfb_vrate[i].refresh) <= 2) {
+ DPRINTK("sisfb: Adjusting rate from %d down to %d\n",
+ rate, sisfb_vrate[i].refresh);
+ sisfb_rate_idx = sisfb_vrate[i].idx;
+ break;
+ }
}
i++;
}
@@ -478,113 +466,136 @@ static u8 sisfb_search_refresh_rate(unsigned int rate)
}
}
-static int sis_getcolreg(unsigned regno, unsigned *red, unsigned *green, unsigned *blue,
- unsigned *transp, struct fb_info *fb_info)
+static void sisfb_search_tvstd(const char *name)
{
- if (regno >= video_cmap_len)
- return 1;
+ int i = 0;
- *red = palette[regno].red;
- *green = palette[regno].green;
- *blue = palette[regno].blue;
- *transp = 0;
- return 0;
+ if(name == NULL)
+ return;
+
+ while (sis_tvtype[i].type_no != -1) {
+ if (!strcmp(name, sis_tvtype[i].name)) {
+ sisfb_tvmode = sis_tvtype[i].type_no;
+ break;
+ }
+ i++;
+ }
}
+static BOOLEAN sisfb_bridgeisslave(void)
+{
+ unsigned char usScratchP1_00;
-static int sisfb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue,
- unsigned transp, struct fb_info *fb_info)
+ if(ivideo.hasVB == HASVB_NONE) return FALSE;
+
+ inSISIDXREG(SISPART1,0x00,usScratchP1_00);
+ if( ((sisvga_engine == SIS_300_VGA) && (usScratchP1_00 & 0xa0) == 0x20) ||
+ ((sisvga_engine == SIS_315_VGA) && (usScratchP1_00 & 0x50) == 0x10) ) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
+
+static BOOLEAN sisfbcheckvretracecrt1(void)
{
- if (regno >= video_cmap_len)
- return 1;
+ unsigned char temp;
+
+ inSISIDXREG(SISCR,0x17,temp);
+ if(!(temp & 0x80)) return FALSE;
+
+ if(sisvga_engine == SIS_315_VGA) {
+ inSISIDXREG(SISSR,0x1f,temp);
+ if(temp & 0xc0) return FALSE;
+ }
+
+ if(inSISREG(SISINPSTAT) & 0x08) return TRUE;
+ else return FALSE;
+}
- palette[regno].red = red;
- palette[regno].green = green;
- palette[regno].blue = blue;
+static BOOLEAN sisfbcheckvretracecrt2(void)
+{
+ unsigned char temp, reg;
+
+ switch(sisvga_engine) {
+ case SIS_300_VGA:
+ reg = 0x25;
+ break;
+ case SIS_315_VGA:
+ reg = 0x30;
+ break;
+ default:
+ return FALSE;
+ }
+
+ inSISIDXREG(SISPART1, reg, temp);
+ if(temp & 0x02) return FALSE;
+ else return TRUE;
+}
- switch (ivideo.video_bpp) {
-#ifdef FBCON_HAS_CFB8
- case 8:
- vgawb(DAC_ADR, regno);
- vgawb(DAC_DATA, red >> 10);
- vgawb(DAC_DATA, green >> 10);
- vgawb(DAC_DATA, blue >> 10);
- if (ivideo.disp_state & DISPTYPE_DISP2) {
- vgawb(DAC2_ADR, regno);
- vgawb(DAC2_DATA, red >> 8);
- vgawb(DAC2_DATA, green >> 8);
- vgawb(DAC2_DATA, blue >> 8);
- }
- break;
-#endif
-#ifdef FBCON_HAS_CFB16
- case 15:
- case 16:
- fbcon_cmap.cfb16[regno] =
- ((red & 0xf800)) |
- ((green & 0xfc00) >> 5) | ((blue & 0xf800) >> 11);
- break;
-#endif
-#ifdef FBCON_HAS_CFB24
- case 24:
- red >>= 8;
- green >>= 8;
- blue >>= 8;
- fbcon_cmap.cfb24[regno] =
- (red << 16) | (green << 8) | (blue);
- break;
-#endif
-#ifdef FBCON_HAS_CFB32
- case 32:
- red >>= 8;
- green >>= 8;
- blue >>= 8;
- fbcon_cmap.cfb32[regno] =
- (red << 16) | (green << 8) | (blue);
- break;
-#endif
- }
- return 0;
+static BOOLEAN sisfb_CheckVBRetrace(void)
+{
+ if(ivideo.disp_state & DISPTYPE_DISP2) {
+ if(sisfb_bridgeisslave()) {
+ return(sisfbcheckvretracecrt1());
+ } else {
+ return(sisfbcheckvretracecrt2());
+ }
+ }
+ return(sisfbcheckvretracecrt1());
}
+/* ----------- FBDev related routines for all series ----------- */
+
static int sisfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
struct fb_info *info)
{
unsigned int htotal =
var->left_margin + var->xres + var->right_margin +
var->hsync_len;
- unsigned int vtotal = 0; /* TW */
- /* var->upper_margin + var->yres + var->lower_margin +
- var->vsync_len; */
+ unsigned int vtotal = 0;
double drate = 0, hrate = 0;
int found_mode = 0;
int old_mode;
+ unsigned char reg;
+
+ TWDEBUG("Inside do_set_var");
+
+ inSISIDXREG(SISCR,0x34,reg);
+ if(reg & 0x80) {
+ printk(KERN_INFO "sisfb: Cannot change display mode, X server is active\n");
+ return -EBUSY;
+ }
- if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_NONINTERLACED) {
+ if((var->vmode & FB_VMODE_MASK) == FB_VMODE_NONINTERLACED) {
vtotal = var->upper_margin + var->yres + var->lower_margin +
- var->vsync_len; /* TW */
+ var->vsync_len;
vtotal <<= 1;
- } else if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_DOUBLE) {
+ } else if((var->vmode & FB_VMODE_MASK) == FB_VMODE_DOUBLE) {
vtotal = var->upper_margin + var->yres + var->lower_margin +
- var->vsync_len; /* TW */
+ var->vsync_len;
vtotal <<= 2;
- } else if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) {
+ } else if((var->vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) {
vtotal = var->upper_margin + (var->yres/2) + var->lower_margin +
- var->vsync_len; /* TW */
- /* var->yres <<= 1; */ /* TW */
+ var->vsync_len;
} else vtotal = var->upper_margin + var->yres + var->lower_margin +
var->vsync_len;
- if (!(htotal) || !(vtotal)) {
+ if(!(htotal) || !(vtotal)) {
DPRINTK("sisfb: Invalid 'var' information\n");
return -EINVAL;
}
- drate = 1E12 / var->pixclock;
- hrate = drate / htotal;
- ivideo.refresh_rate = (unsigned int) (hrate / vtotal * 2 + 0.5);
+ if(var->pixclock && htotal && vtotal) {
+ drate = 1E12 / var->pixclock;
+ hrate = drate / htotal;
+ ivideo.refresh_rate = (unsigned int) (hrate / vtotal * 2 + 0.5);
+ } else ivideo.refresh_rate = 60;
- printk("sisfb: Change mode to %dx%dx%d-%dHz\n",
+ /* TW: Calculation wrong for 1024x600 - force it to 60Hz */
+ if((var->xres == 1024) && (var->yres == 600)) ivideo.refresh_rate = 60;
+
+ printk(KERN_DEBUG "sisfb: Change mode to %dx%dx%d-%dHz\n",
var->xres,var->yres,var->bits_per_pixel,ivideo.refresh_rate);
old_mode = sisfb_mode_idx;
@@ -602,67 +613,440 @@ static int sisfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
sisfb_mode_idx++;
}
- if (found_mode)
- sisfb_validate_mode();
+ if(found_mode)
+ sisfb_mode_idx = sisfb_validate_mode(sisfb_mode_idx);
else
sisfb_mode_idx = -1;
- if (sisfb_mode_idx < 0) {
- printk("sisfb: Mode %dx%d-%d not supported\n", var->xres,
+ if(sisfb_mode_idx < 0) {
+ printk(KERN_ERR "sisfb: Mode %dx%dx%d not supported\n", var->xres,
var->yres, var->bits_per_pixel);
sisfb_mode_idx = old_mode;
return -EINVAL;
}
- if (sisfb_search_refresh_rate(ivideo.refresh_rate) == 0) {
+ if(sisfb_search_refresh_rate(ivideo.refresh_rate) == 0) {
sisfb_rate_idx = sisbios_mode[sisfb_mode_idx].rate_idx;
ivideo.refresh_rate = 60;
}
- if (((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) && isactive) {
-
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+ if(((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) && isactive) {
+#else
+ if(isactive) {
+#endif
sisfb_pre_setmode();
- if (SiSSetMode(&sishw_ext, sisfb_mode_no) == 0) {
- printk("sisfb: Setting mode[0x%x] failed\n", sisfb_mode_no);
- return -1;
+ if(SiSSetMode(&SiS_Pr, &sishw_ext, sisfb_mode_no) == 0) {
+ printk(KERN_ERR "sisfb: Setting mode[0x%x] failed\n", sisfb_mode_no);
+ return -EINVAL;
}
- vgawb(SEQ_ADR, IND_SIS_PASSWORD);
- vgawb(SEQ_DATA, SIS_PASSWORD);
+ outSISIDXREG(SISSR, IND_SIS_PASSWORD, SIS_PASSWORD);
sisfb_post_setmode();
- DPRINTK("sisfb: Set new mode: %dx%dx%d-%d \n", sisbios_mode[sisfb_mode_idx].xres,
- sisbios_mode[sisfb_mode_idx].yres, sisbios_mode[sisfb_mode_idx].bpp,
+ DPRINTK("sisfb: Set new mode: %dx%dx%d-%d \n",
+ sisbios_mode[sisfb_mode_idx].xres,
+ sisbios_mode[sisfb_mode_idx].yres,
+ sisbios_mode[sisfb_mode_idx].bpp,
ivideo.refresh_rate);
ivideo.video_bpp = sisbios_mode[sisfb_mode_idx].bpp;
ivideo.video_vwidth = ivideo.video_width = sisbios_mode[sisfb_mode_idx].xres;
ivideo.video_vheight = ivideo.video_height = sisbios_mode[sisfb_mode_idx].yres;
ivideo.org_x = ivideo.org_y = 0;
- video_linelength = ivideo.video_width * (ivideo.video_bpp >> 3);
+ ivideo.video_linelength = ivideo.video_width * (ivideo.video_bpp >> 3);
+ ivideo.accel = 0;
+ if(sisfb_accel) {
+ ivideo.accel = (var->accel_flags & FB_ACCELF_TEXT) ? -1 : 0;
+ }
+ switch(ivideo.video_bpp) {
+ case 8:
+ ivideo.DstColor = 0x0000;
+ ivideo.SiS310_AccelDepth = 0x00000000;
+ ivideo.video_cmap_len = 256;
+ break;
+ case 16:
+ ivideo.DstColor = 0x8000;
+ ivideo.SiS310_AccelDepth = 0x00010000;
+ ivideo.video_cmap_len = 16;
+ break;
+ case 32:
+ ivideo.DstColor = 0xC000;
+ ivideo.SiS310_AccelDepth = 0x00020000;
+ ivideo.video_cmap_len = 16;
+ break;
+ default:
+ ivideo.video_cmap_len = 16;
+ printk(KERN_ERR "sisfb: Unsupported depth %d", ivideo.video_bpp);
+ ivideo.accel = 0;
+ break;
+ }
+
+ }
+ TWDEBUG("End of do_set_var");
+ return 0;
+}
+
+#ifdef SISFB_PAN
+static int sisfb_pan_var(struct fb_var_screeninfo *var)
+{
+ unsigned int base;
+
+ TWDEBUG("Inside pan_var");
+
+ if (var->xoffset > (var->xres_virtual - var->xres)) {
+ printk(KERN_INFO "Pan: xo: %d xv %d xr %d\n",
+ var->xoffset, var->xres_virtual, var->xres);
+ return -EINVAL;
+ }
+ if(var->yoffset > (var->yres_virtual - var->yres)) {
+ printk(KERN_INFO "Pan: yo: %d yv %d yr %d\n",
+ var->yoffset, var->yres_virtual, var->yres);
+ return -EINVAL;
+ }
+
+ base = var->yoffset * var->xres_virtual + var->xoffset;
+
+ /* calculate base bpp dep. */
+ switch(var->bits_per_pixel) {
+ case 16:
+ base >>= 1;
+ break;
+ case 32:
+ break;
+ case 8:
+ default:
+ base >>= 2;
+ break;
+ }
+
+ outSISIDXREG(SISSR, IND_SIS_PASSWORD, SIS_PASSWORD);
+
+ outSISIDXREG(SISCR, 0x0D, base & 0xFF);
+ outSISIDXREG(SISCR, 0x0C, (base >> 8) & 0xFF);
+ outSISIDXREG(SISSR, 0x0D, (base >> 16) & 0xFF);
+ if(sisvga_engine == SIS_315_VGA) {
+ setSISIDXREG(SISSR, 0x37, 0xFE, (base >> 24) & 0x01);
+ }
+ if(ivideo.disp_state & DISPTYPE_DISP2) {
+ orSISIDXREG(SISPART1, sisfb_CRT2_write_enable, 0x01);
+ outSISIDXREG(SISPART1, 0x06, (base & 0xFF));
+ outSISIDXREG(SISPART1, 0x05, ((base >> 8) & 0xFF));
+ outSISIDXREG(SISPART1, 0x04, ((base >> 16) & 0xFF));
+ if(sisvga_engine == SIS_315_VGA) {
+ setSISIDXREG(SISPART1, 0x02, 0x7F, ((base >> 24) & 0x01) << 7);
+ }
+ }
+ TWDEBUG("End of pan_var");
+ return 0;
+}
+#endif
+
+static void sisfb_bpp_to_var(struct fb_var_screeninfo *var)
+{
+ switch(var->bits_per_pixel) {
+ case 8:
+ var->red.offset = var->green.offset = var->blue.offset = 0;
+ var->red.length = var->green.length = var->blue.length = 6;
+ ivideo.video_cmap_len = 256;
+ break;
+ case 16:
+ var->red.offset = 11;
+ var->red.length = 5;
+ var->green.offset = 5;
+ var->green.length = 6;
+ var->blue.offset = 0;
+ var->blue.length = 5;
+ var->transp.offset = 0;
+ var->transp.length = 0;
+ ivideo.video_cmap_len = 16;
+ break;
+ case 32:
+ var->red.offset = 16;
+ var->red.length = 8;
+ var->green.offset = 8;
+ var->green.length = 8;
+ var->blue.offset = 0;
+ var->blue.length = 8;
+ var->transp.offset = 24;
+ var->transp.length = 8;
+ ivideo.video_cmap_len = 16;
+ break;
+ }
+}
+
+void sis_dispinfo(struct ap_data *rec)
+{
+ rec->minfo.bpp = ivideo.video_bpp;
+ rec->minfo.xres = ivideo.video_width;
+ rec->minfo.yres = ivideo.video_height;
+ rec->minfo.v_xres = ivideo.video_vwidth;
+ rec->minfo.v_yres = ivideo.video_vheight;
+ rec->minfo.org_x = ivideo.org_x;
+ rec->minfo.org_y = ivideo.org_y;
+ rec->minfo.vrate = ivideo.refresh_rate;
+ rec->iobase = ivideo.vga_base - 0x30;
+ rec->mem_size = ivideo.video_size;
+ rec->disp_state = ivideo.disp_state;
+ rec->version = (VER_MAJOR << 24) | (VER_MINOR << 16) | VER_LEVEL;
+ rec->hasVB = ivideo.hasVB;
+ rec->TV_type = ivideo.TV_type;
+ rec->TV_plug = ivideo.TV_plug;
+ rec->chip = ivideo.chip;
+}
+
+/* ------------ FBDev related routines for 2.4 series ----------- */
+
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,0)
+
+static void sisfb_crtc_to_var(struct fb_var_screeninfo *var)
+{
+ u16 VRE, VBE, VRS, VBS, VDE, VT;
+ u16 HRE, HBE, HRS, HBS, HDE, HT;
+ u8 sr_data, cr_data, cr_data2, cr_data3, mr_data;
+ int A, B, C, D, E, F, temp;
+ double hrate, drate;
+
+ TWDEBUG("Inside crtc_to_var");
+ inSISIDXREG(SISSR, IND_SIS_COLOR_MODE, sr_data);
+
+ if (sr_data & SIS_INTERLACED_MODE)
+ var->vmode = FB_VMODE_INTERLACED;
+ else
+ var->vmode = FB_VMODE_NONINTERLACED;
+
+ switch ((sr_data & 0x1C) >> 2) {
+ case SIS_8BPP_COLOR_MODE:
+ var->bits_per_pixel = 8;
+ break;
+ case SIS_16BPP_COLOR_MODE:
+ var->bits_per_pixel = 16;
+ break;
+ case SIS_32BPP_COLOR_MODE:
+ var->bits_per_pixel = 32;
+ break;
+ }
+
+ sisfb_bpp_to_var(var);
+
+ inSISIDXREG(SISSR, 0x0A, sr_data);
+
+ inSISIDXREG(SISCR, 0x06, cr_data);
+
+ inSISIDXREG(SISCR, 0x07, cr_data2);
+
+ VT = (cr_data & 0xFF) | ((u16) (cr_data2 & 0x01) << 8) |
+ ((u16) (cr_data2 & 0x20) << 4) | ((u16) (sr_data & 0x01) << 10);
+ A = VT + 2;
+
+ inSISIDXREG(SISCR, 0x12, cr_data);
+
+ VDE = (cr_data & 0xff) | ((u16) (cr_data2 & 0x02) << 7) |
+ ((u16) (cr_data2 & 0x40) << 3) | ((u16) (sr_data & 0x02) << 9);
+ E = VDE + 1;
+
+ inSISIDXREG(SISCR, 0x10, cr_data);
+
+ VRS = (cr_data & 0xff) | ((u16) (cr_data2 & 0x04) << 6) |
+ ((u16) (cr_data2 & 0x80) << 2) | ((u16) (sr_data & 0x08) << 7);
+ F = VRS + 1 - E;
+
+ inSISIDXREG(SISCR, 0x15, cr_data);
+
+ inSISIDXREG(SISCR, 0x09, cr_data3);
+
+ VBS = (cr_data & 0xff) | ((u16) (cr_data2 & 0x08) << 5) |
+ ((u16) (cr_data3 & 0x20) << 4) | ((u16) (sr_data & 0x04) << 8);
+
+ inSISIDXREG(SISCR, 0x16, cr_data);
+
+ VBE = (cr_data & 0xff) | ((u16) (sr_data & 0x10) << 4);
+ temp = VBE - ((E - 1) & 511);
+ B = (temp > 0) ? temp : (temp + 512);
+
+ inSISIDXREG(SISCR, 0x11, cr_data);
+
+ VRE = (cr_data & 0x0f) | ((sr_data & 0x20) >> 1);
+ temp = VRE - ((E + F - 1) & 31);
+ C = (temp > 0) ? temp : (temp + 32);
+
+ D = B - F - C;
+
+ var->yres = E;
+#ifndef SISFB_PAN
+ var->yres_virtual = E;
+#endif
+ /* TW: We have to report the physical dimension to the console! */
+ if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) {
+ var->yres <<= 1;
+#ifndef SISFB_PAN
+ var->yres_virtual <<= 1;
+#endif
+ } else if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_DOUBLE) {
+ var->yres >>= 1;
+#ifndef SISFB_PAN
+ var->yres_virtual >>= 1;
+#endif
+ }
+
+ var->upper_margin = D;
+ var->lower_margin = F;
+ var->vsync_len = C;
+
+ inSISIDXREG(SISSR, 0x0b, sr_data);
+
+ inSISIDXREG(SISCR, 0x00, cr_data);
+
+ HT = (cr_data & 0xff) | ((u16) (sr_data & 0x03) << 8);
+ A = HT + 5;
+
+ inSISIDXREG(SISCR, 0x01, cr_data);
+
+ HDE = (cr_data & 0xff) | ((u16) (sr_data & 0x0C) << 6);
+ E = HDE + 1;
+
+ inSISIDXREG(SISCR, 0x04, cr_data);
+
+ HRS = (cr_data & 0xff) | ((u16) (sr_data & 0xC0) << 2);
+ F = HRS - E - 3;
+
+ inSISIDXREG(SISCR, 0x02, cr_data);
+
+ HBS = (cr_data & 0xff) | ((u16) (sr_data & 0x30) << 4);
+
+ inSISIDXREG(SISSR, 0x0c, sr_data);
+
+ inSISIDXREG(SISCR, 0x03, cr_data);
+
+ inSISIDXREG(SISCR, 0x05, cr_data2);
+
+ HBE = (cr_data & 0x1f) | ((u16) (cr_data2 & 0x80) >> 2) |
+ ((u16) (sr_data & 0x03) << 6);
+ HRE = (cr_data2 & 0x1f) | ((sr_data & 0x04) << 3);
+
+ temp = HBE - ((E - 1) & 255);
+ B = (temp > 0) ? temp : (temp + 256);
+
+ temp = HRE - ((E + F + 3) & 63);
+ C = (temp > 0) ? temp : (temp + 64);
+
+ D = B - F - C;
+
+ var->xres = var->xres_virtual = E * 8;
+ var->left_margin = D * 8;
+ var->right_margin = F * 8;
+ var->hsync_len = C * 8;
+
+ var->activate = FB_ACTIVATE_NOW;
+
+ var->sync = 0;
+
+ mr_data = inSISREG(SISMISCR);
+ if (mr_data & 0x80)
+ var->sync &= ~FB_SYNC_VERT_HIGH_ACT;
+ else
+ var->sync |= FB_SYNC_VERT_HIGH_ACT;
+
+ if (mr_data & 0x40)
+ var->sync &= ~FB_SYNC_HOR_HIGH_ACT;
+ else
+ var->sync |= FB_SYNC_HOR_HIGH_ACT;
+
+ VT += 2;
+ VT <<= 1;
+ HT = (HT + 5) * 8;
+
+ hrate = (double) ivideo.refresh_rate * (double) VT / 2;
+ drate = hrate * HT;
+ var->pixclock = (u32) (1E12 / drate);
+
+#ifdef SISFB_PAN
+ if(sisfb_ypan) {
+ var->yres_virtual = ivideo.heapstart / (var->xres * (var->bits_per_pixel >> 3));
+ if(var->yres_virtual <= var->yres) {
+ var->yres_virtual = var->yres;
+ }
+ } else
+#endif
+ var->yres_virtual = var->yres;
+
+ TWDEBUG("end of crtc_to_var");
+}
+
+static int sis_getcolreg(unsigned regno, unsigned *red, unsigned *green, unsigned *blue,
+ unsigned *transp, struct fb_info *fb_info)
+{
+ if (regno >= ivideo.video_cmap_len)
+ return 1;
+
+ *red = sis_palette[regno].red;
+ *green = sis_palette[regno].green;
+ *blue = sis_palette[regno].blue;
+ *transp = 0;
+ return 0;
+}
+
+static int sisfb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue,
+ unsigned transp, struct fb_info *fb_info)
+{
+ if (regno >= ivideo.video_cmap_len)
+ return 1;
+
+ sis_palette[regno].red = red;
+ sis_palette[regno].green = green;
+ sis_palette[regno].blue = blue;
+
+ switch (ivideo.video_bpp) {
+#ifdef FBCON_HAS_CFB8
+ case 8:
+ outSISREG(SISDACA, regno);
+ outSISREG(SISDACD, (red >> 10));
+ outSISREG(SISDACD, (green >> 10));
+ outSISREG(SISDACD, (blue >> 10));
+ if (ivideo.disp_state & DISPTYPE_DISP2) {
+ outSISREG(SISDAC2A, regno);
+ outSISREG(SISDAC2D, (red >> 8));
+ outSISREG(SISDAC2D, (green >> 8));
+ outSISREG(SISDAC2D, (blue >> 8));
+ }
+ break;
+#endif
+#ifdef FBCON_HAS_CFB16
+ case 16:
+ sis_fbcon_cmap.cfb16[regno] =
+ ((red & 0xf800)) | ((green & 0xfc00) >> 5) | ((blue & 0xf800) >> 11);
+ break;
+#endif
+#ifdef FBCON_HAS_CFB32
+ case 32:
+ red >>= 8;
+ green >>= 8;
+ blue >>= 8;
+ sis_fbcon_cmap.cfb32[regno] = (red << 16) | (green << 8) | (blue);
+ break;
+#endif
}
return 0;
}
-static void sisfb_set_disp(int con, struct fb_var_screeninfo *var)
+static void sisfb_set_disp(int con, struct fb_var_screeninfo *var,
+ struct fb_info *info)
{
struct fb_fix_screeninfo fix;
+ long flags;
struct display *display;
struct display_switch *sw;
- long flags;
- if (con >= 0)
+ if(con >= 0)
display = &fb_display[con];
else
- display = &disp;
+ display = &sis_disp;
sisfb_get_fix(&fix, con, 0);
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,23)
display->screen_base = ivideo.video_vbase;
-#endif
display->visual = fix.visual;
display->type = fix.type;
display->type_aux = fix.type_aux;
@@ -675,29 +1059,35 @@ static void sisfb_set_disp(int con, struct fb_var_screeninfo *var)
display->var = *var;
save_flags(flags);
+
switch (ivideo.video_bpp) {
#ifdef FBCON_HAS_CFB8
case 8:
+#ifdef SISFBACCEL
+ sw = ivideo.accel ? &fbcon_sis8 : &fbcon_cfb8;
+#else
sw = &fbcon_cfb8;
+#endif
break;
#endif
#ifdef FBCON_HAS_CFB16
- case 15:
case 16:
+#ifdef SISFBACCEL
+ sw = ivideo.accel ? &fbcon_sis16 : &fbcon_cfb16;
+#else
sw = &fbcon_cfb16;
- display->dispsw_data = fbcon_cmap.cfb16;
- break;
#endif
-#ifdef FBCON_HAS_CFB24
- case 24:
- sw = &fbcon_cfb24;
- display->dispsw_data = fbcon_cmap.cfb24;
+ display->dispsw_data = sis_fbcon_cmap.cfb16;
break;
#endif
#ifdef FBCON_HAS_CFB32
case 32:
+#ifdef SISFBACCEL
+ sw = ivideo.accel ? &fbcon_sis32 : &fbcon_cfb32;
+#else
sw = &fbcon_cfb32;
- display->dispsw_data = fbcon_cmap.cfb32;
+#endif
+ display->dispsw_data = sis_fbcon_cmap.cfb32;
break;
#endif
default:
@@ -708,37 +1098,916 @@ static void sisfb_set_disp(int con, struct fb_var_screeninfo *var)
display->dispsw = &sisfb_sw;
restore_flags(flags);
+#ifdef SISFB_PAN
+ if((ivideo.accel) && (sisfb_ypan)) {
+ /* display->scrollmode = SCROLL_YPAN; - not defined */
+ } else {
+ display->scrollmode = SCROLL_YREDRAW;
+ sisfb_sw.bmove = fbcon_redraw_bmove;
+ }
+#else
display->scrollmode = SCROLL_YREDRAW;
sisfb_sw.bmove = fbcon_redraw_bmove;
+#endif
}
static void sisfb_do_install_cmap(int con, struct fb_info *info)
{
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,23)
- if (con != info->currcon)
- return;
-
- if (fb_display[con].cmap.len)
- fb_set_cmap(&fb_display[con].cmap, 1, info);
- else
- fb_set_cmap(fb_default_cmap(video_cmap_len), 1, info);
-#else
if (con != currcon)
return;
if (fb_display[con].cmap.len)
fb_set_cmap(&fb_display[con].cmap, 1, sisfb_setcolreg, info);
else
- fb_set_cmap(fb_default_cmap(video_cmap_len), 1,
+ fb_set_cmap(fb_default_cmap(ivideo.video_cmap_len), 1,
sisfb_setcolreg, info);
+}
+
+
+static int sisfb_get_var(struct fb_var_screeninfo *var, int con,
+ struct fb_info *info)
+{
+ TWDEBUG("inside get_var");
+ if(con == -1)
+ memcpy(var, &default_var, sizeof(struct fb_var_screeninfo));
+ else
+ *var = fb_display[con].var;
+
+ /* For FSTN, DSTN */
+ if (var->xres == 320 && var->yres == 480)
+ var->yres = 240;
+
+ TWDEBUG("end of get_var");
+ return 0;
+}
+
+static int sisfb_set_var(struct fb_var_screeninfo *var, int con,
+ struct fb_info *info)
+{
+ int err;
+ unsigned int cols, rows;
+
+ TWDEBUG("inside set_var");
+
+ fb_display[con].var.activate = FB_ACTIVATE_NOW;
+ if(sisfb_do_set_var(var, con == currcon, info)) {
+ sisfb_crtc_to_var(var);
+ return -EINVAL;
+ }
+
+ sisfb_crtc_to_var(var);
+
+ sisfb_set_disp(con, var, info);
+
+ if(info->changevar)
+ (*info->changevar) (con);
+
+ if((err = fb_alloc_cmap(&fb_display[con].cmap, 0, 0)))
+ return err;
+
+ sisfb_do_install_cmap(con, info);
+
+ cols = sisbios_mode[sisfb_mode_idx].cols;
+ rows = sisbios_mode[sisfb_mode_idx].rows;
+ vc_resize_con(rows, cols, fb_display[con].conp->vc_num);
+
+ TWDEBUG("end of set_var");
+ return 0;
+}
+
+static int sisfb_get_cmap(struct fb_cmap *cmap, int kspc, int con,
+ struct fb_info *info)
+{
+ TWDEBUG("inside get_cmap");
+ if (con == currcon)
+ return fb_get_cmap(cmap, kspc, sis_getcolreg, info);
+
+ else if (fb_display[con].cmap.len)
+ fb_copy_cmap(&fb_display[con].cmap, cmap, kspc ? 0 : 2);
+ else
+ fb_copy_cmap(fb_default_cmap(ivideo.video_cmap_len), cmap, kspc ? 0 : 2);
+
+ TWDEBUG("end of get_cmap");
+ return 0;
+}
+
+static int sisfb_set_cmap(struct fb_cmap *cmap, int kspc, int con,
+ struct fb_info *info)
+{
+ int err;
+
+ TWDEBUG("inside set_cmap");
+ if (!fb_display[con].cmap.len) {
+ err = fb_alloc_cmap(&fb_display[con].cmap, ivideo.video_cmap_len, 0);
+ if (err)
+ return err;
+ }
+
+ if (con == currcon)
+ return fb_set_cmap(cmap, kspc, sisfb_setcolreg, info);
+
+ else
+ fb_copy_cmap(cmap, &fb_display[con].cmap, kspc ? 0 : 1);
+ TWDEBUG("end of set_cmap");
+ return 0;
+}
+
+#ifdef SISFB_PAN
+static int sisfb_pan_display(struct fb_var_screeninfo *var, int con,
+ struct fb_info* info)
+{
+ int err;
+
+ TWDEBUG("inside pan_display");
+ if (var->vmode & FB_VMODE_YWRAP) {
+ if (var->yoffset < 0 || var->yoffset >= fb_display[con].var.yres_virtual || var->xoffset)
+ return -EINVAL;
+ } else {
+ if (var->xoffset+fb_display[con].var.xres > fb_display[con].var.xres_virtual ||
+ var->yoffset+fb_display[con].var.yres > fb_display[con].var.yres_virtual)
+ return -EINVAL;
+ }
+
+ if(con == currcon) {
+ if((err = sisfb_pan_var(var)) < 0) return err;
+ }
+
+ fb_display[con].var.xoffset = var->xoffset;
+ fb_display[con].var.yoffset = var->yoffset;
+ if (var->vmode & FB_VMODE_YWRAP)
+ fb_display[con].var.vmode |= FB_VMODE_YWRAP;
+ else
+ fb_display[con].var.vmode &= ~FB_VMODE_YWRAP;
+
+ TWDEBUG("end of pan_display");
+ return 0;
+}
+#endif
+
+static int sisfb_mmap(struct fb_info *info, struct file *file,
+ struct vm_area_struct *vma)
+{
+ struct fb_var_screeninfo var;
+ unsigned long start;
+ unsigned long off;
+ u32 len, mmio_off;
+
+ TWDEBUG("inside mmap");
+ if(vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) return -EINVAL;
+
+ off = vma->vm_pgoff << PAGE_SHIFT;
+
+ start = (unsigned long) ivideo.video_base;
+ len = PAGE_ALIGN((start & ~PAGE_MASK) + ivideo.video_size);
+#if 0
+ if (off >= len) {
+ off -= len;
+#endif
+ /* By Jake Page: Treat mmap request with offset beyond heapstart
+ * as request for mapping the mmio area
+ */
+ mmio_off = PAGE_ALIGN((start & ~PAGE_MASK) + ivideo.heapstart);
+ if(off >= mmio_off) {
+ off -= mmio_off;
+ sisfb_get_var(&var, currcon, info);
+ if(var.accel_flags) return -EINVAL;
+
+ start = (unsigned long) ivideo.mmio_base;
+ len = PAGE_ALIGN((start & ~PAGE_MASK) + sisfb_mmio_size);
+ }
+
+ start &= PAGE_MASK;
+ if((vma->vm_end - vma->vm_start + off) > len) return -EINVAL;
+
+ off += start;
+ vma->vm_pgoff = off >> PAGE_SHIFT;
+ vma->vm_flags |= VM_IO; /* by Jake Page; is that really needed? */
+
+#if defined(__i386__) || defined(__x86_64__)
+ if (boot_cpu_data.x86 > 3)
+ pgprot_val(vma->vm_page_prot) |= _PAGE_PCD;
+#endif
+ if (io_remap_page_range(vma->vm_start, off, vma->vm_end - vma->vm_start,
+ vma->vm_page_prot))
+ return -EAGAIN;
+
+ TWDEBUG("end of mmap");
+ return 0;
+}
+
+static void sis_get_glyph(struct fb_info *info, SIS_GLYINFO *gly)
+{
+ struct display *p = &fb_display[currcon];
+ u16 c;
+ u8 *cdat;
+ int widthb;
+ u8 *gbuf = gly->gmask;
+ int size;
+
+ TWDEBUG("Inside get_glyph");
+ gly->fontheight = fontheight(p);
+ gly->fontwidth = fontwidth(p);
+ widthb = (fontwidth(p) + 7) / 8;
+
+ c = gly->ch & p->charmask;
+ if (fontwidth(p) <= 8)
+ cdat = p->fontdata + c * fontheight(p);
+ else
+ cdat = p->fontdata + (c * fontheight(p) << 1);
+
+ size = fontheight(p) * widthb;
+ memcpy(gbuf, cdat, size);
+ gly->ngmask = size;
+ TWDEBUG("End of get_glyph");
+}
+
+static int sisfb_update_var(int con, struct fb_info *info)
+{
+#ifdef SISFB_PAN
+ return(sisfb_pan_var(&fb_display[con].var));
+#else
+ return 0;
+#endif
+}
+
+static int sisfb_switch(int con, struct fb_info *info)
+{
+ int cols, rows;
+
+ if(fb_display[currcon].cmap.len)
+ fb_get_cmap(&fb_display[currcon].cmap, 1, sis_getcolreg, info);
+
+ fb_display[con].var.activate = FB_ACTIVATE_NOW;
+
+ if(!memcmp(&fb_display[con].var, &fb_display[currcon].var,
+ sizeof(struct fb_var_screeninfo))) {
+ currcon = con;
+ return 1;
+ }
+
+ currcon = con;
+
+ sisfb_do_set_var(&fb_display[con].var, 1, info);
+
+ sisfb_set_disp(con, &fb_display[con].var, info);
+
+ sisfb_do_install_cmap(con, info);
+
+ cols = sisbios_mode[sisfb_mode_idx].cols;
+ rows = sisbios_mode[sisfb_mode_idx].rows;
+ vc_resize_con(rows, cols, fb_display[con].conp->vc_num);
+
+ sisfb_update_var(con, info);
+
+ return 1;
+}
+
+static void sisfb_blank(int blank, struct fb_info *info)
+{
+ u8 reg;
+
+ inSISIDXREG(SISCR, 0x17, reg);
+
+ if(blank > 0)
+ reg &= 0x7f;
+ else
+ reg |= 0x80;
+
+ outSISIDXREG(SISCR, 0x17, reg);
+ outSISIDXREG(SISSR, 0x00, 0x01); /* Synchronous Reset */
+ outSISIDXREG(SISSR, 0x00, 0x03); /* End Reset */
+ printk(KERN_DEBUG "sisfb_blank() called (%d)\n", blank);
+}
+
+
+static int sisfb_ioctl(struct inode *inode, struct file *file,
+ unsigned int cmd, unsigned long arg, int con,
+ struct fb_info *info)
+{
+ TWDEBUG("inside ioctl");
+ switch (cmd) {
+ case FBIO_ALLOC:
+ if (!capable(CAP_SYS_RAWIO))
+ return -EPERM;
+ sis_malloc((struct sis_memreq *) arg);
+ break;
+ case FBIO_FREE:
+ if (!capable(CAP_SYS_RAWIO))
+ return -EPERM;
+ sis_free(*(unsigned long *) arg);
+ break;
+ case FBIOGET_GLYPH:
+ sis_get_glyph(info,(SIS_GLYINFO *) arg);
+ break;
+ case FBIOGET_HWCINFO:
+ {
+ unsigned long *hwc_offset = (unsigned long *) arg;
+
+ if (sisfb_caps & HW_CURSOR_CAP)
+ *hwc_offset = sisfb_hwcursor_vbase -
+ (unsigned long) ivideo.video_vbase;
+ else
+ *hwc_offset = 0;
+
+ break;
+ }
+ case FBIOPUT_MODEINFO:
+ {
+ struct mode_info *x = (struct mode_info *)arg;
+
+ ivideo.video_bpp = x->bpp;
+ ivideo.video_width = x->xres;
+ ivideo.video_height = x->yres;
+ ivideo.video_vwidth = x->v_xres;
+ ivideo.video_vheight = x->v_yres;
+ ivideo.org_x = x->org_x;
+ ivideo.org_y = x->org_y;
+ ivideo.refresh_rate = x->vrate;
+ ivideo.video_linelength = ivideo.video_vwidth * (ivideo.video_bpp >> 3);
+ switch(ivideo.video_bpp) {
+ case 8:
+ ivideo.DstColor = 0x0000;
+ ivideo.SiS310_AccelDepth = 0x00000000;
+ ivideo.video_cmap_len = 256;
+ break;
+ case 16:
+ ivideo.DstColor = 0x8000;
+ ivideo.SiS310_AccelDepth = 0x00010000;
+ ivideo.video_cmap_len = 16;
+ break;
+ case 32:
+ ivideo.DstColor = 0xC000;
+ ivideo.SiS310_AccelDepth = 0x00020000;
+ ivideo.video_cmap_len = 16;
+ break;
+ default:
+ ivideo.video_cmap_len = 16;
+ printk(KERN_ERR "sisfb: Unsupported depth %d", ivideo.video_bpp);
+ ivideo.accel = 0;
+ break;
+ }
+
+ break;
+ }
+ case FBIOGET_DISPINFO:
+ sis_dispinfo((struct ap_data *)arg);
+ break;
+ case SISFB_GET_INFO: /* TW: New for communication with X driver */
+ {
+ sisfb_info *x = (sisfb_info *)arg;
+
+ x->sisfb_id = SISFB_ID;
+ x->sisfb_version = VER_MAJOR;
+ x->sisfb_revision = VER_MINOR;
+ x->sisfb_patchlevel = VER_LEVEL;
+ x->chip_id = ivideo.chip_id;
+ x->memory = ivideo.video_size / 1024;
+ x->heapstart = ivideo.heapstart / 1024;
+ x->fbvidmode = sisfb_mode_no;
+ x->sisfb_caps = sisfb_caps;
+ x->sisfb_tqlen = 512; /* yet unused */
+ x->sisfb_pcibus = ivideo.pcibus;
+ x->sisfb_pcislot = ivideo.pcislot;
+ x->sisfb_pcifunc = ivideo.pcifunc;
+ x->sisfb_lcdpdc = sisfb_detectedpdc;
+ x->sisfb_lcda = sisfb_detectedlcda;
+ break;
+ }
+ case SISFB_GET_VBRSTATUS:
+ {
+ unsigned long *vbrstatus = (unsigned long *) arg;
+ if(sisfb_CheckVBRetrace()) *vbrstatus = 1;
+ else *vbrstatus = 0;
+ }
+ default:
+ return -EINVAL;
+ }
+ TWDEBUG("end of ioctl");
+ return 0;
+
+}
+#endif
+
+/* ------------ FBDev related routines for 2.5 series ----------- */
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+
+static int sisfb_open(struct fb_info *info, int user)
+{
+ return 0;
+}
+
+static int sisfb_release(struct fb_info *info, int user)
+{
+ return 0;
+}
+
+static int sisfb_get_cmap_len(const struct fb_var_screeninfo *var)
+{
+ int rc = 16;
+
+ switch(var->bits_per_pixel) {
+ case 8:
+ rc = 256;
+ break;
+ case 16:
+ rc = 16;
+ break;
+ case 32:
+ rc = 16;
+ break;
+ }
+ return rc;
+}
+
+static int sisfb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue,
+ unsigned transp, struct fb_info *info)
+{
+ if (regno >= sisfb_get_cmap_len(&info->var))
+ return 1;
+
+ switch (info->var.bits_per_pixel) {
+ case 8:
+ outSISREG(SISDACA, regno);
+ outSISREG(SISDACD, (red >> 10));
+ outSISREG(SISDACD, (green >> 10));
+ outSISREG(SISDACD, (blue >> 10));
+ if (ivideo.disp_state & DISPTYPE_DISP2) {
+ outSISREG(SISDAC2A, regno);
+ outSISREG(SISDAC2D, (red >> 8));
+ outSISREG(SISDAC2D, (green >> 8));
+ outSISREG(SISDAC2D, (blue >> 8));
+ }
+ break;
+ case 16:
+ ((u32 *)(info->pseudo_palette))[regno] =
+ ((red & 0xf800)) | ((green & 0xfc00) >> 5) | ((blue & 0xf800) >> 11);
+ break;
+ case 32:
+ red >>= 8;
+ green >>= 8;
+ blue >>= 8;
+ ((u32 *) (info->pseudo_palette))[regno] =
+ (red << 16) | (green << 8) | (blue);
+ break;
+ }
+ return 0;
+}
+
+static int sisfb_set_par(struct fb_info *info)
+{
+ int err;
+
+ TWDEBUG("inside set_par");
+ if((err = sisfb_do_set_var(&info->var, 1, info)))
+ return err;
+
+ sisfb_get_fix(&info->fix, info->currcon, info);
+
+ TWDEBUG("end of set_par");
+ return 0;
+}
+
+static int sisfb_check_var(struct fb_var_screeninfo *var,
+ struct fb_info *info)
+{
+ unsigned int htotal =
+ var->left_margin + var->xres + var->right_margin +
+ var->hsync_len;
+ unsigned int vtotal = 0;
+ double drate = 0, hrate = 0;
+ int found_mode = 0;
+ int refresh_rate, search_idx;
+
+ TWDEBUG("Inside check_var");
+
+ if((var->vmode & FB_VMODE_MASK) == FB_VMODE_NONINTERLACED) {
+ vtotal = var->upper_margin + var->yres + var->lower_margin +
+ var->vsync_len;
+ vtotal <<= 1;
+ } else if((var->vmode & FB_VMODE_MASK) == FB_VMODE_DOUBLE) {
+ vtotal = var->upper_margin + var->yres + var->lower_margin +
+ var->vsync_len;
+ vtotal <<= 2;
+ } else if((var->vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) {
+ vtotal = var->upper_margin + (var->yres/2) + var->lower_margin +
+ var->vsync_len;
+ } else vtotal = var->upper_margin + var->yres + var->lower_margin +
+ var->vsync_len;
+
+ if(!(htotal) || !(vtotal)) {
+ SISFAIL("sisfb: no valid timing data");
+ }
+
+ if((var->pixclock) && (htotal)) {
+ drate = 1E12 / var->pixclock;
+ hrate = drate / htotal;
+ refresh_rate = (unsigned int) (hrate / vtotal * 2 + 0.5);
+ } else refresh_rate = 60;
+
+ /* TW: Calculation wrong for 1024x600 - force it to 60Hz */
+ if((var->xres == 1024) && (var->yres == 600)) refresh_rate = 60;
+
+ search_idx = 0;
+ while( (sisbios_mode[search_idx].mode_no != 0) &&
+ (sisbios_mode[search_idx].xres <= var->xres) ) {
+ if( (sisbios_mode[search_idx].xres == var->xres) &&
+ (sisbios_mode[search_idx].yres == var->yres) &&
+ (sisbios_mode[search_idx].bpp == var->bits_per_pixel)) {
+ found_mode = 1;
+ break;
+ }
+ search_idx++;
+ }
+
+ if(found_mode)
+ search_idx = sisfb_validate_mode(search_idx);
+ else {
+ printk(KERN_ERR "sisfb: %dx%dx%d is no valid mode\n",
+ var->xres, var->yres, var->bits_per_pixel);
+ search_idx = 0;
+ while( (sisbios_mode[search_idx].mode_no != 0) &&
+ (sisbios_mode[search_idx].xres <= (var->xres + 16)) ) {
+ if( ((sisbios_mode[search_idx].xres >= var->xres) &&
+ (sisbios_mode[search_idx].xres <= (var->xres + 16))) &&
+ ((sisbios_mode[search_idx].yres >= var->yres) &&
+ (sisbios_mode[search_idx].yres <= (var->yres + 16))) &&
+ (sisbios_mode[search_idx].bpp == var->bits_per_pixel) ) {
+ found_mode = 1;
+ break;
+ }
+ search_idx++;
+ }
+ if(found_mode) {
+ var->xres = sisbios_mode[search_idx].xres;
+ var->yres = sisbios_mode[search_idx].yres;
+ printk(KERN_DEBUG "sisfb: Adapted to mode %dx%dx%d\n",
+ var->xres, var->yres, var->bits_per_pixel);
+ } else {
+ printk(KERN_ERR "sisfb: Failed to find similar mode to %dx%dx%d",
+ var->xres, var->yres, var->bits_per_pixel);
+ return -EINVAL;
+ }
+ }
+
+ /* TW: TODO: Check the refresh rate */
+
+ /* Adapt RGB settings */
+ sisfb_bpp_to_var(var);
+
+ /* Sanity check for offsets */
+ if (var->xoffset < 0)
+ var->xoffset = 0;
+ if (var->yoffset < 0)
+ var->yoffset = 0;
+
+ /* Horiz-panning not supported */
+ if(var->xres != var->xres_virtual)
+ var->xres_virtual = var->xres;
+
+ if(!sisfb_ypan) {
+ if(var->yres != var->yres_virtual)
+ var->yres_virtual = var->yres;
+ } else {
+ /* TW: Now patch yres_virtual if we use panning */
+ /* *** May I do this? *** */
+ var->yres_virtual = ivideo.heapstart / (var->xres * (var->bits_per_pixel >> 3));
+ if(var->yres_virtual <= var->yres) {
+ /* TW: Paranoia check */
+ var->yres_virtual = var->yres;
+ }
+ }
+
+ /* Truncate offsets to maximum if too high */
+ if (var->xoffset > var->xres_virtual - var->xres)
+ var->xoffset = var->xres_virtual - var->xres - 1;
+
+ if (var->yoffset > var->yres_virtual - var->yres)
+ var->yoffset = var->yres_virtual - var->yres - 1;
+
+ /* Set everything else to 0 */
+ var->red.msb_right =
+ var->green.msb_right =
+ var->blue.msb_right =
+ var->transp.offset = var->transp.length = var->transp.msb_right = 0;
+
+ TWDEBUG("end of check_var");
+ return 0;
+}
+
+#ifdef SISFB_PAN
+static int sisfb_pan_display(struct fb_var_screeninfo *var,
+ struct fb_info* info)
+{
+ int err;
+
+ TWDEBUG("inside pan_display");
+
+ if (var->xoffset > (var->xres_virtual - var->xres))
+ return -EINVAL;
+ if (var->yoffset > (var->yres_virtual - var->yres))
+ return -EINVAL;
+
+ if (var->vmode & FB_VMODE_YWRAP) {
+ if (var->yoffset < 0
+ || var->yoffset >= info->var.yres_virtual
+ || var->xoffset) return -EINVAL;
+ } else {
+ if (var->xoffset + info->var.xres > info->var.xres_virtual ||
+ var->yoffset + info->var.yres > info->var.yres_virtual)
+ return -EINVAL;
+ }
+
+ if((err = sisfb_pan_var(var)) < 0) return err;
+
+ info->var.xoffset = var->xoffset;
+ info->var.yoffset = var->yoffset;
+ if (var->vmode & FB_VMODE_YWRAP)
+ info->var.vmode |= FB_VMODE_YWRAP;
+ else
+ info->var.vmode &= ~FB_VMODE_YWRAP;
+
+ TWDEBUG("end of pan_display");
+ return 0;
+}
+#endif
+
+static int sisfb_mmap(struct fb_info *info, struct file *file,
+ struct vm_area_struct *vma)
+{
+ unsigned long start;
+ unsigned long off;
+ u32 len, mmio_off;
+
+ TWDEBUG("inside mmap");
+ if(vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) return -EINVAL;
+
+ off = vma->vm_pgoff << PAGE_SHIFT;
+
+ start = (unsigned long) ivideo.video_base;
+ len = PAGE_ALIGN((start & ~PAGE_MASK) + ivideo.video_size);
+#if 0
+ if (off >= len) {
+ off -= len;
+#endif
+ /* By Jake Page: Treat mmap request with offset beyond heapstart
+ * as request for mapping the mmio area
+ */
+ mmio_off = PAGE_ALIGN((start & ~PAGE_MASK) + ivideo.heapstart);
+ if(off >= mmio_off) {
+ off -= mmio_off;
+ if(info->var.accel_flags) return -EINVAL;
+
+ start = (unsigned long) ivideo.mmio_base;
+ len = PAGE_ALIGN((start & ~PAGE_MASK) + sisfb_mmio_size);
+ }
+
+ start &= PAGE_MASK;
+ if((vma->vm_end - vma->vm_start + off) > len) return -EINVAL;
+
+ off += start;
+ vma->vm_pgoff = off >> PAGE_SHIFT;
+ vma->vm_flags |= VM_IO; /* by Jake Page; is that really needed? */
+
+#if defined(__i386__) || defined(__x86_64__)
+ if (boot_cpu_data.x86 > 3)
+ pgprot_val(vma->vm_page_prot) |= _PAGE_PCD;
+#endif
+ if (io_remap_page_range(vma, vma->vm_start, off, vma->vm_end - vma->vm_start,
+ vma->vm_page_prot))
+ return -EAGAIN;
+
+ TWDEBUG("end of mmap");
+ return 0;
+}
+
+static int sisfb_blank(int blank, struct fb_info *info)
+{
+ u8 reg;
+
+ inSISIDXREG(SISCR, 0x17, reg);
+
+ if(blank > 0)
+ reg &= 0x7f;
+ else
+ reg |= 0x80;
+
+ outSISIDXREG(SISCR, 0x17, reg);
+ outSISIDXREG(SISSR, 0x00, 0x01); /* Synchronous Reset */
+ outSISIDXREG(SISSR, 0x00, 0x03); /* End Reset */
+ return(0);
+}
+
+static int sisfb_ioctl(struct inode *inode, struct file *file,
+ unsigned int cmd, unsigned long arg,
+ struct fb_info *info)
+{
+ TWDEBUG("inside ioctl");
+ switch (cmd) {
+ case FBIO_ALLOC:
+ if (!capable(CAP_SYS_RAWIO))
+ return -EPERM;
+ sis_malloc((struct sis_memreq *) arg);
+ break;
+ case FBIO_FREE:
+ if (!capable(CAP_SYS_RAWIO))
+ return -EPERM;
+ sis_free(*(unsigned long *) arg);
+ break;
+ case FBIOGET_HWCINFO:
+ {
+ unsigned long *hwc_offset = (unsigned long *) arg;
+
+ if (sisfb_caps & HW_CURSOR_CAP)
+ *hwc_offset = sisfb_hwcursor_vbase -
+ (unsigned long) ivideo.video_vbase;
+ else
+ *hwc_offset = 0;
+
+ break;
+ }
+ case FBIOPUT_MODEINFO:
+ {
+ struct mode_info *x = (struct mode_info *)arg;
+
+ ivideo.video_bpp = x->bpp;
+ ivideo.video_width = x->xres;
+ ivideo.video_height = x->yres;
+ ivideo.video_vwidth = x->v_xres;
+ ivideo.video_vheight = x->v_yres;
+ ivideo.org_x = x->org_x;
+ ivideo.org_y = x->org_y;
+ ivideo.refresh_rate = x->vrate;
+ ivideo.video_linelength = ivideo.video_vwidth * (ivideo.video_bpp >> 3);
+ switch(ivideo.video_bpp) {
+ case 8:
+ ivideo.DstColor = 0x0000;
+ ivideo.SiS310_AccelDepth = 0x00000000;
+ ivideo.video_cmap_len = 256;
+ break;
+ case 16:
+ ivideo.DstColor = 0x8000;
+ ivideo.SiS310_AccelDepth = 0x00010000;
+ ivideo.video_cmap_len = 16;
+ break;
+ case 32:
+ ivideo.DstColor = 0xC000;
+ ivideo.SiS310_AccelDepth = 0x00020000;
+ ivideo.video_cmap_len = 16;
+ break;
+ default:
+ ivideo.video_cmap_len = 16;
+ printk(KERN_ERR "sisfb: Unsupported accel depth %d", ivideo.video_bpp);
+ ivideo.accel = 0;
+ break;
+ }
+
+ break;
+ }
+ case FBIOGET_DISPINFO:
+ sis_dispinfo((struct ap_data *)arg);
+ break;
+ case SISFB_GET_INFO: /* TW: New for communication with X driver */
+ {
+ sisfb_info *x = (sisfb_info *)arg;
+
+ x->sisfb_id = SISFB_ID;
+ x->sisfb_version = VER_MAJOR;
+ x->sisfb_revision = VER_MINOR;
+ x->sisfb_patchlevel = VER_LEVEL;
+ x->chip_id = ivideo.chip_id;
+ x->memory = ivideo.video_size / 1024;
+ x->heapstart = ivideo.heapstart / 1024;
+ x->fbvidmode = sisfb_mode_no;
+ x->sisfb_caps = sisfb_caps;
+ x->sisfb_tqlen = 512; /* yet unused */
+ x->sisfb_pcibus = ivideo.pcibus;
+ x->sisfb_pcislot = ivideo.pcislot;
+ x->sisfb_pcifunc = ivideo.pcifunc;
+ x->sisfb_lcdpdc = sisfb_detectedpdc;
+ x->sisfb_lcda = sisfb_detectedlcda;
+ break;
+ }
+ case SISFB_GET_VBRSTATUS:
+ {
+ unsigned long *vbrstatus = (unsigned long *) arg;
+ if(sisfb_CheckVBRetrace()) *vbrstatus = 1;
+ else *vbrstatus = 0;
+ }
+ default:
+ return -EINVAL;
+ }
+ TWDEBUG("end of ioctl");
+ return 0;
+
+}
+
+#endif
+
+/* ----------- FBDev related routines for all series ---------- */
+
+static int sisfb_get_fix(struct fb_fix_screeninfo *fix, int con,
+ struct fb_info *info)
+{
+ TWDEBUG("inside get_fix");
+ memset(fix, 0, sizeof(struct fb_fix_screeninfo));
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+ strcpy(fix->id, sis_fb_info.modename);
+#else
+ strcpy(fix->id, myid);
+#endif
+
+ fix->smem_start = ivideo.video_base;
+
+ /* TW */
+ if((!sisfb_mem) || (sisfb_mem > (ivideo.video_size/1024))) {
+ if (ivideo.video_size > 0x1000000) {
+ fix->smem_len = 0xc00000;
+ } else if (ivideo.video_size > 0x800000)
+ fix->smem_len = 0x800000;
+ else
+ fix->smem_len = 0x400000;
+ } else
+ fix->smem_len = sisfb_mem * 1024;
+
+ fix->type = video_type;
+ fix->type_aux = 0;
+ if(ivideo.video_bpp == 8)
+ fix->visual = FB_VISUAL_PSEUDOCOLOR;
+ else
+ fix->visual = FB_VISUAL_TRUECOLOR;
+ fix->xpanstep = 0;
+#ifdef SISFB_PAN
+ if(sisfb_ypan) fix->ypanstep = 1;
#endif
+ fix->ywrapstep = 0;
+ fix->line_length = ivideo.video_linelength;
+ fix->mmio_start = ivideo.mmio_base;
+ fix->mmio_len = sisfb_mmio_size;
+ if(sisvga_engine == SIS_300_VGA)
+ fix->accel = FB_ACCEL_SIS_GLAMOUR;
+ else if(ivideo.chip == SIS_330)
+ fix->accel = FB_ACCEL_SIS_XABRE;
+ else
+ fix->accel = FB_ACCEL_SIS_GLAMOUR_2;
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+ fix->reserved[0] = ivideo.video_size & 0xFFFF;
+ fix->reserved[1] = (ivideo.video_size >> 16) & 0xFFFF;
+ fix->reserved[2] = sisfb_caps;
+#endif
+ TWDEBUG("end of get_fix");
+ return 0;
}
+/* ---------------- fb_ops structures ----------------- */
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+static struct fb_ops sisfb_ops = {
+ owner: THIS_MODULE,
+ fb_get_fix: sisfb_get_fix,
+ fb_get_var: sisfb_get_var,
+ fb_set_var: sisfb_set_var,
+ fb_get_cmap: sisfb_get_cmap,
+ fb_set_cmap: sisfb_set_cmap,
+#ifdef SISFB_PAN
+ fb_pan_display: sisfb_pan_display,
+#endif
+ fb_ioctl: sisfb_ioctl,
+ fb_mmap: sisfb_mmap,
+};
+#endif
+
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+static struct fb_ops sisfb_ops = {
+ .owner = THIS_MODULE,
+ .fb_open = sisfb_open,
+ .fb_release = sisfb_release,
+ .fb_check_var = sisfb_check_var,
+ .fb_set_par = sisfb_set_par,
+ .fb_setcolreg = sisfb_setcolreg,
+#ifdef SISFB_PAN
+ .fb_pan_display = sisfb_pan_display,
+#endif
+ .fb_blank = sisfb_blank,
+ .fb_fillrect = sisfb_fillrect,
+ .fb_copyarea = sisfb_copyarea,
+ .fb_imageblit = cfb_imageblit,
+ .fb_cursor = soft_cursor,
+ .fb_sync = sisfb_sync,
+ .fb_ioctl = sisfb_ioctl,
+ .fb_mmap = sisfb_mmap,
+};
+#endif
+
-/* --------------- Chip-dependent Routines --------------------------- */
+/* ---------------- Chip generation dependent routines ---------------- */
#ifdef CONFIG_FB_SIS_300 /* for SiS 300/630/540/730 */
+
static int sisfb_get_dram_size_300(void)
{
struct pci_dev *pdev = NULL;
@@ -762,20 +2031,23 @@ static int sisfb_get_dram_size_300(void)
}
if (nbridge_id == 0) { /* 300 */
- vgawb(SEQ_ADR, IND_SIS_DRAM_SIZE);
+
+ inSISIDXREG(SISSR, IND_SIS_DRAM_SIZE,reg);
ivideo.video_size =
- ((unsigned int) ((vgarb(SEQ_DATA) & SIS_DRAM_SIZE_MASK) + 1) << 20);
+ ((unsigned int) ((reg & SIS_DRAM_SIZE_MASK) + 1) << 20);
+
} else { /* 540, 630, 730 */
+
pci_for_each_dev(pdev) {
+
if ((pdev->vendor == PCI_VENDOR_ID_SI)
- && (pdev->device == nbridge_id)) {
+ && (pdev->device == nbridge_id)) {
pci_read_config_byte(pdev, IND_BRI_DRAM_STATUS, &pci_data);
pci_data = (pci_data & BRI_DRAM_SIZE_MASK) >> 4;
ivideo.video_size = (unsigned int)(1 << (pci_data+21));
pdev_valid = 1;
reg = SIS_DATA_BUS_64 << 6;
- vgawb(SEQ_ADR, IND_SIS_DRAM_SIZE);
switch (pci_data) {
case BRI_DRAM_SIZE_2MB:
reg |= SIS_DRAM_SIZE_2MB;
@@ -796,13 +2068,12 @@ static int sisfb_get_dram_size_300(void)
reg |= SIS_DRAM_SIZE_64MB;
break;
}
- vgawb(SEQ_DATA, reg);
+ outSISIDXREG(SISSR, IND_SIS_DRAM_SIZE, reg);
break;
}
}
- if (!pdev_valid)
- return -1;
+ if (!pdev_valid) return -1;
}
return 0;
}
@@ -811,13 +2082,24 @@ static void sisfb_detect_VB_connect_300()
{
u8 sr16, sr17, cr32, temp;
- vgawb(SEQ_ADR, IND_SIS_SCRATCH_REG_17);
- sr17 = vgarb(SEQ_DATA);
- vgawb(CRTC_ADR, IND_SIS_SCRATCH_REG_CR32);
- cr32 = vgarb(CRTC_DATA);
-
ivideo.TV_plug = ivideo.TV_type = 0;
+
+ switch(ivideo.hasVB) {
+ case HASVB_LVDS_CHRONTEL:
+ case HASVB_CHRONTEL:
+ SiS_SenseCh();
+ break;
+ case HASVB_301:
+ case HASVB_302:
+ SiS_Sense30x();
+ break;
+ }
+
+ inSISIDXREG(SISSR, IND_SIS_SCRATCH_REG_17, sr17);
+ inSISIDXREG(SISCR, IND_SIS_SCRATCH_REG_CR32, cr32);
+
if ((sr17 & 0x0F) && (ivideo.chip != SIS_300)) {
+
if ((sr17 & 0x01) && !sisfb_crt1off)
sisfb_crt1off = 0;
else {
@@ -839,18 +2121,22 @@ static void sisfb_detect_VB_connect_300()
else
ivideo.disp_state = 0;
- if (sr17 & 0x20)
+ if(sisfb_tvplug != -1)
+ /* PR/TW: override detected TV type */
+ ivideo.TV_plug = sisfb_tvplug;
+ else if (sr17 & 0x20)
ivideo.TV_plug = TVPLUG_SVIDEO;
else if (sr17 & 0x10)
ivideo.TV_plug = TVPLUG_COMPOSITE;
- vgawb(SEQ_ADR, IND_SIS_SCRATCH_REG_16);
- sr16 = vgarb(SEQ_DATA);
+ inSISIDXREG(SISSR, IND_SIS_SCRATCH_REG_16, sr16);
if (sr16 & 0x20)
ivideo.TV_type = TVMODE_PAL;
else
ivideo.TV_type = TVMODE_NTSC;
+
} else {
+
if ((cr32 & SIS_CRT1) && !sisfb_crt1off)
sisfb_crt1off = 0;
else {
@@ -872,8 +2158,11 @@ static void sisfb_detect_VB_connect_300()
else
ivideo.disp_state = 0;
- /* TW: Detect TV plug & type anyway */
- if (cr32 & SIS_VB_HIVISION) {
+ /* TW: Detect TV plug & type */
+ if(sisfb_tvplug != -1)
+ /* PR/TW: override with option */
+ ivideo.TV_plug = sisfb_tvplug;
+ else if (cr32 & SIS_VB_HIVISION) {
ivideo.TV_type = TVMODE_HIVISION;
ivideo.TV_plug = TVPLUG_SVIDEO;
}
@@ -885,34 +2174,19 @@ static void sisfb_detect_VB_connect_300()
ivideo.TV_plug = TVPLUG_SCART;
if (ivideo.TV_type == 0) {
- // Eden Chen
- //temp = *((u8 *)(sishw_ext.VirtualRomBase+0x52));
- //if (temp&0x40) {
- // temp=*((u8 *)(sishw_ext.VirtualRomBase+0x53));
- //} else {
- vgawb(SEQ_ADR, IND_SIS_POWER_ON_TRAP);
- temp = vgarb(SEQ_DATA);
- //}
- // ~Eden Chen
+ inSISIDXREG(SISSR, IND_SIS_POWER_ON_TRAP, temp);
if (temp & 0x01)
ivideo.TV_type = TVMODE_PAL;
else
ivideo.TV_type = TVMODE_NTSC;
}
+
}
/* TW: Copy forceCRT1 option to CRT1off if option is given */
if (sisfb_forcecrt1 != -1) {
- vgawb(SEQ_ADR, IND_SIS_SCRATCH_REG_17);
- sr17 = vgarb(SEQ_DATA);
- if (sisfb_forcecrt1) {
- sisfb_crt1off=0;
- sr17 |= 0x80;
- } else {
- sisfb_crt1off=1;
- sr17 &= ~0x80;
- }
- vgawb(SEQ_DATA, sr17);
+ if(sisfb_forcecrt1) sisfb_crt1off = 0;
+ else sisfb_crt1off = 1;
}
}
@@ -920,15 +2194,10 @@ static void sisfb_get_VB_type_300(void)
{
u8 reg;
- if (ivideo.chip != SIS_300) {
- if (!sisfb_has_VB_300()) {
- vgawb(CRTC_ADR, IND_SIS_SCRATCH_REG_CR37);
- reg = vgarb(CRTC_DATA);
-
+ if(ivideo.chip != SIS_300) {
+ if(!sisfb_has_VB_300()) {
+ inSISIDXREG(SISCR, IND_SIS_SCRATCH_REG_CR37, reg);
switch ((reg & SIS_EXTERNAL_CHIP_MASK) >> 1) {
- case SIS_EXTERNAL_CHIP_SIS301:
- ivideo.hasVB = HASVB_301;
- break;
case SIS_EXTERNAL_CHIP_LVDS:
ivideo.hasVB = HASVB_LVDS;
break;
@@ -952,17 +2221,9 @@ static void sisfb_get_VB_type_300(void)
static int sisfb_has_VB_300(void)
{
- // Eden Chen
- //u8 sr38, sr39, vb_chipid;
u8 vb_chipid;
- //vgawb(SEQ_ADR, IND_SIS_POWER_ON_TRAP);
- //sr38 = vgarb(SEQ_DATA);
- //vgawb(SEQ_ADR, IND_SIS_POWER_ON_TRAP2);
- //sr39 = vgarb(SEQ_DATA);
- vgawb(VB_PART4_ADR, 0x0);
- vb_chipid = vgarb(VB_PART4_DATA);
-
+ inSISIDXREG(SISPART4, 0x00, vb_chipid);
switch (vb_chipid) {
case 0x01:
ivideo.hasVB = HASVB_301;
@@ -970,40 +2231,19 @@ static int sisfb_has_VB_300(void)
case 0x02:
ivideo.hasVB = HASVB_302;
break;
- case 0x03:
- ivideo.hasVB = HASVB_303;
- break;
default:
ivideo.hasVB = HASVB_NONE;
return FALSE;
}
return TRUE;
- //if (
- // ( (ivideo.chip == SIS_300) && (sr38 & 0x20) )
- // ||
- // ( (ivideo.chip == SIS_540) && (sr38 & 0x20) && (!(sr39 & 0x80)) )
- // ||
- // ( (ivideo.chip == SIS_630 ) && (sr38 & 0x20) && (!(sr39 & 0x80)) &&
- // ((ivideo.revision_id & 0xf0) < 0x30) && (vb_chipid == 1) )
- // ||
- // ( (ivideo.chip == SIS_630 ) && ((ivideo.revision_id & 0xf0) >= 0x30) &&
- // (vb_chipid == 1) )
- // ||
- // ( (ivideo.chip == SIS_730) && (vb_chipid == 1) ) /* 730 */
- //) {
- // ivideo.hasVB = HASVB_301;
- // return TRUE;
- //} else {
- // ivideo.hasVB = HASVB_NONE;
- // return FALSE;
- //}
-
- // ~Eden Chen
}
+
#endif /* CONFIG_FB_SIS_300 */
-#ifdef CONFIG_FB_SIS_315 /* for SiS 315/550/650/740 */
+
+#ifdef CONFIG_FB_SIS_315 /* for SiS 315/550/650/740/330 */
+
static int sisfb_get_dram_size_315(void)
{
struct pci_dev *pdev = NULL;
@@ -1011,26 +2251,26 @@ static int sisfb_get_dram_size_315(void)
u8 pci_data;
u8 reg = 0;
- if (ivideo.chip == SIS_550 || ivideo.chip == SIS_650) {
+ if (ivideo.chip == SIS_550 || ivideo.chip == SIS_650 || ivideo.chip == SIS_740) {
+
#ifdef LINUXBIOS
+
pci_for_each_dev(pdev) {
+
if ( (pdev->vendor == PCI_VENDOR_ID_SI)
- && ( (pdev->device == PCI_DEVICE_ID_SI_550)
- || (pdev->device == PCI_DEVICE_ID_SI_650))) {
+ && ( (pdev->device == PCI_DEVICE_ID_SI_550) ||
+ (pdev->device == PCI_DEVICE_ID_SI_650) ||
+ (pdev->device == PCI_DEVICE_ID_SI_740))) {
pci_read_config_byte(pdev, IND_BRI_DRAM_STATUS,
&pci_data);
pci_data = (pci_data & BRI_DRAM_SIZE_MASK) >> 4;
- ivideo.video_size =
- (unsigned int)(1 << (pci_data+21));
+ ivideo.video_size = (unsigned int)(1 << (pci_data + 21));
pdev_valid = 1;
/* TW: Initialize SR14 "by hand" */
- vgawb(SEQ_ADR, IND_SIS_DRAM_SIZE);
- reg = vgarb(SEQ_DATA) & 0xC0;
-
+ inSISIDXREG(SISSR, IND_SIS_DRAM_SIZE, reg);
+ reg &= 0xC0;
switch (pci_data) {
- //case BRI_DRAM_SIZE_2MB:
- // reg |= (SIS315_DRAM_SIZE_2MB << 4); break;
case BRI_DRAM_SIZE_4MB:
reg |= SIS550_DRAM_SIZE_4MB;
break;
@@ -1046,22 +2286,20 @@ static int sisfb_get_dram_size_315(void)
case BRI_DRAM_SIZE_64MB:
reg |= SIS550_DRAM_SIZE_64MB;
break;
- /* case BRI_DRAM_SIZE_128MB:
- reg |= (SIS315_DRAM_SIZE_128MB << 4); break; */
}
- /* TODO : set Dual channel and bus width bits here */
+ /* TODO: set Dual channel and bus width bits here */
- vgawb(SEQ_DATA, reg);
+ outSISIDXREG(SISSR, IND_SIS_DRAM_SIZE, reg);
break;
}
}
- if (!pdev_valid)
- return -1;
+ if (!pdev_valid) return -1;
+
#else
- vgawb(SEQ_ADR, IND_SIS_DRAM_SIZE);
- reg = vgarb(SEQ_DATA);
+
+ inSISIDXREG(SISSR, IND_SIS_DRAM_SIZE, reg);
switch (reg & SIS550_DRAM_SIZE_MASK) {
case SIS550_DRAM_SIZE_4MB:
ivideo.video_size = 0x400000; break;
@@ -1090,17 +2328,20 @@ static int sisfb_get_dram_size_315(void)
"sisfb: Warning: Could not determine memory size, "
"now reading from PCI config\n");
pdev_valid = 0;
+
pci_for_each_dev(pdev) {
+
if ( (pdev->vendor == PCI_VENDOR_ID_SI)
&& (pdev->device == PCI_DEVICE_ID_SI_550) ) {
+
pci_read_config_byte(pdev, IND_BRI_DRAM_STATUS,
&pci_data);
pci_data = (pci_data & BRI_DRAM_SIZE_MASK) >> 4;
ivideo.video_size = (unsigned int)(1 << (pci_data+21));
pdev_valid = 1;
/* TW: Initialize SR14=IND_SIS_DRAM_SIZE */
- vgawb(SEQ_ADR, IND_SIS_DRAM_SIZE);
- reg = vgarb(SEQ_DATA) & 0xC0;
+ inSISIDXREG(SISSR, IND_SIS_DRAM_SIZE, reg);
+ reg &= 0xC0;
switch (pci_data) {
case BRI_DRAM_SIZE_4MB:
reg |= SIS550_DRAM_SIZE_4MB; break;
@@ -1112,13 +2353,11 @@ static int sisfb_get_dram_size_315(void)
reg |= SIS550_DRAM_SIZE_32MB; break;
case BRI_DRAM_SIZE_64MB:
reg |= SIS550_DRAM_SIZE_64MB; break;
- /* case BRI_DRAM_SIZE_128MB:
- reg |= (SIS315_DRAM_SIZE_128MB << 4); break; */
default:
printk(KERN_INFO "sisfb: Unable to determine memory size, giving up.\n");
return -1;
}
- vgawb(SEQ_DATA, reg);
+ outSISIDXREG(SISSR, IND_SIS_DRAM_SIZE, reg);
}
}
if (!pdev_valid) {
@@ -1129,9 +2368,10 @@ static int sisfb_get_dram_size_315(void)
}
#endif
return 0;
+
} else { /* 315 */
- vgawb(SEQ_ADR, IND_SIS_DRAM_SIZE);
- reg = vgarb(SEQ_DATA);
+
+ inSISIDXREG(SISSR, IND_SIS_DRAM_SIZE, reg);
switch ((reg & SIS315_DRAM_SIZE_MASK) >> 4) {
case SIS315_DRAM_SIZE_2MB:
ivideo.video_size = 0x200000;
@@ -1157,33 +2397,55 @@ static int sisfb_get_dram_size_315(void)
default:
return -1;
}
- }
+
+ reg &= SIS315_DUAL_CHANNEL_MASK;
+ reg >>= 2;
+
+ if(ivideo.chip == SIS_330) {
+
+ if(reg) ivideo.video_size <<= 1;
+
+ } else {
+
+ switch (reg) {
+ case SIS315_SINGLE_CHANNEL_2_RANK:
+ ivideo.video_size <<= 1;
+ break;
+ case SIS315_DUAL_CHANNEL_1_RANK:
+ ivideo.video_size <<= 1;
+ break;
+ case SIS315_ASYM_DDR: /* TW: DDR asymentric */
+ ivideo.video_size += (ivideo.video_size/2);
+ break;
+ }
+ }
- reg &= SIS315_DUAL_CHANNEL_MASK;
- reg >>= 2;
- switch (reg) {
- case SIS315_SINGLE_CHANNEL_2_RANK:
- ivideo.video_size <<= 1;
- break;
- case SIS315_DUAL_CHANNEL_1_RANK:
- ivideo.video_size <<= 1;
- break;
- case SIS315_ASYM_DDR: /* TW: DDR asymentric */
- ivideo.video_size += (ivideo.video_size/2);
- break;
+ return 0;
}
-
- return 0;
+
+ return -1;
+
}
static void sisfb_detect_VB_connect_315(void)
{
- u8 sr17, cr32, temp;
-
- vgawb(CRTC_ADR, IND_SIS_SCRATCH_REG_CR32);
- cr32 = vgarb(CRTC_DATA);
+ u8 cr32, temp=0;
ivideo.TV_plug = ivideo.TV_type = 0;
+
+ switch(ivideo.hasVB) {
+ case HASVB_LVDS_CHRONTEL:
+ case HASVB_CHRONTEL:
+ SiS_SenseCh();
+ break;
+ case HASVB_301:
+ case HASVB_302:
+ SiS_Sense30x();
+ break;
+ }
+
+ inSISIDXREG(SISCR, IND_SIS_SCRATCH_REG_CR32, cr32);
+
if ((cr32 & SIS_CRT1) && !sisfb_crt1off)
sisfb_crt1off = 0;
else {
@@ -1205,33 +2467,34 @@ static void sisfb_detect_VB_connect_315(void)
else
ivideo.disp_state = 0;
- if (cr32 & SIS_VB_HIVISION) {
+ if(sisfb_tvplug != -1)
+ /* PR/TW: Override with option */
+ ivideo.TV_plug = sisfb_tvplug;
+ else if (cr32 & SIS_VB_HIVISION) {
ivideo.TV_type = TVMODE_HIVISION;
ivideo.TV_plug = TVPLUG_SVIDEO;
- } else if (cr32 & SIS_VB_SVIDEO)
+ }
+ else if (cr32 & SIS_VB_SVIDEO)
ivideo.TV_plug = TVPLUG_SVIDEO;
else if (cr32 & SIS_VB_COMPOSITE)
ivideo.TV_plug = TVPLUG_COMPOSITE;
else if (cr32 & SIS_VB_SCART)
ivideo.TV_plug = TVPLUG_SCART;
- if (ivideo.TV_type == 0) {
- /* TW: PAL/NTSC changed for 315/650 */
- if(ivideo.chip <= SIS_315PRO) {
-#if 0
- vgawb(SEQ_ADR, IND_SIS_POWER_ON_TRAP);
- temp = vgarb(SEQ_DATA);
-#endif
- vgawb(CRTC_ADR, 0x38);
- temp = vgarb(CRTC_DATA);
- if (temp & 0x10)
+ if(ivideo.TV_type == 0) {
+ /* TW: PAL/NTSC changed for 650 */
+ if((ivideo.chip <= SIS_315PRO) || (ivideo.chip >= SIS_330)) {
+
+ inSISIDXREG(SISCR, 0x38, temp);
+ if(temp & 0x10)
ivideo.TV_type = TVMODE_PAL;
else
ivideo.TV_type = TVMODE_NTSC;
+
} else {
- vgawb(CRTC_ADR, 0x79);
- temp = vgarb(CRTC_DATA);
- if (temp & 0x20)
+
+ inSISIDXREG(SISCR, 0x79, temp);
+ if(temp & 0x20)
ivideo.TV_type = TVMODE_PAL;
else
ivideo.TV_type = TVMODE_NTSC;
@@ -1240,16 +2503,8 @@ static void sisfb_detect_VB_connect_315(void)
/* TW: Copy forceCRT1 option to CRT1off if option is given */
if (sisfb_forcecrt1 != -1) {
- vgawb(SEQ_ADR, IND_SIS_SCRATCH_REG_17);
- sr17 = vgarb(SEQ_DATA);
- if (sisfb_forcecrt1) {
- sisfb_crt1off=0;
- sr17 |= 0x80;
- } else {
- sisfb_crt1off=1;
- sr17 &= ~0x80;
- }
- vgawb(SEQ_DATA, sr17);
+ if (sisfb_forcecrt1) sisfb_crt1off = 0;
+ else sisfb_crt1off = 1;
}
}
@@ -1257,25 +2512,19 @@ static void sisfb_get_VB_type_315(void)
{
u8 reg;
- if (!sisfb_has_VB_315()) {
- vgawb(CRTC_ADR, IND_SIS_SCRATCH_REG_CR37);
- reg = vgarb(CRTC_DATA);
-
- /* TW: CR37 changed on 310/325 series */
- switch ((reg & SIS_EXTERNAL_CHIP_MASK) >> 1) {
- case SIS_EXTERNAL_CHIP_SIS301:
- ivideo.hasVB = HASVB_301;
- break;
- case SIS310_EXTERNAL_CHIP_LVDS:
- ivideo.hasVB = HASVB_LVDS;
- break;
- case SIS310_EXTERNAL_CHIP_LVDS_CHRONTEL:
- ivideo.hasVB = HASVB_LVDS_CHRONTEL;
- break;
- default:
- break;
- }
+ if (!sisfb_has_VB_315()) {
+ inSISIDXREG(SISCR, IND_SIS_SCRATCH_REG_CR37, reg);
+ switch ((reg & SIS_EXTERNAL_CHIP_MASK) >> 1) {
+ case SIS310_EXTERNAL_CHIP_LVDS:
+ ivideo.hasVB = HASVB_LVDS;
+ break;
+ case SIS310_EXTERNAL_CHIP_LVDS_CHRONTEL:
+ ivideo.hasVB = HASVB_LVDS_CHRONTEL;
+ break;
+ default:
+ break;
}
+ }
}
@@ -1283,9 +2532,7 @@ static int sisfb_has_VB_315(void)
{
u8 vb_chipid;
- vgawb(VB_PART4_ADR, 0x00);
- vb_chipid = vgarb(VB_PART4_DATA);
-
+ inSISIDXREG(SISPART4, 0x00, vb_chipid);
switch (vb_chipid) {
case 0x01:
ivideo.hasVB = HASVB_301;
@@ -1293,9 +2540,6 @@ static int sisfb_has_VB_315(void)
case 0x02:
ivideo.hasVB = HASVB_302;
break;
- case 0x03:
- ivideo.hasVB = HASVB_303;
- break;
default:
ivideo.hasVB = HASVB_NONE;
return FALSE;
@@ -1305,7 +2549,233 @@ static int sisfb_has_VB_315(void)
#endif /* CONFIG_FB_SIS_315 */
-/* --------------------- Heap Routines ------------------------------- */
+/* ------------------ Sensing routines ------------------ */
+
+/* TW: Determine and detect attached devices on SiS30x */
+int
+SISDoSense(int tempbl, int tempbh, int tempcl, int tempch)
+{
+ int temp,i;
+
+ outSISIDXREG(SISPART4,0x11,tempbl);
+ temp = tempbh | tempcl;
+ setSISIDXREG(SISPART4,0x10,0xe0,temp);
+ for(i=0; i<10; i++) SiS_LongWait(&SiS_Pr);
+ tempch &= 0x7f;
+ inSISIDXREG(SISPART4,0x03,temp);
+ temp ^= 0x0e;
+ temp &= tempch;
+ return(temp);
+}
+
+void
+SiS_Sense30x(void)
+{
+ u8 backupP4_0d;
+ u8 testsvhs_tempbl, testsvhs_tempbh;
+ u8 testsvhs_tempcl, testsvhs_tempch;
+ u8 testcvbs_tempbl, testcvbs_tempbh;
+ u8 testcvbs_tempcl, testcvbs_tempch;
+ u8 testvga2_tempbl, testvga2_tempbh;
+ u8 testvga2_tempcl, testvga2_tempch;
+ int myflag, result;
+
+ inSISIDXREG(SISPART4,0x0d,backupP4_0d);
+ outSISIDXREG(SISPART4,0x0d,(backupP4_0d | 0x04));
+
+ if(sisvga_engine == SIS_300_VGA) {
+
+ testvga2_tempbh = 0x00; testvga2_tempbl = 0xd1;
+ testsvhs_tempbh = 0x00; testsvhs_tempbl = 0xb9;
+ testcvbs_tempbh = 0x00; testcvbs_tempbl = 0xb3;
+ if((sishw_ext.ujVBChipID != VB_CHIP_301) &&
+ (sishw_ext.ujVBChipID != VB_CHIP_302) ) {
+ testvga2_tempbh = 0x01; testvga2_tempbl = 0x90;
+ testsvhs_tempbh = 0x01; testsvhs_tempbl = 0x6b;
+ testcvbs_tempbh = 0x01; testcvbs_tempbl = 0x74;
+ }
+ inSISIDXREG(SISPART4,0x01,myflag);
+ if(myflag & 0x04) {
+ testvga2_tempbh = 0x00; testvga2_tempbl = 0xfd;
+ testsvhs_tempbh = 0x00; testsvhs_tempbl = 0xdd;
+ testcvbs_tempbh = 0x00; testcvbs_tempbl = 0xee;
+ }
+ testvga2_tempch = 0x0e; testvga2_tempcl = 0x08;
+ testsvhs_tempch = 0x06; testsvhs_tempcl = 0x04;
+ testcvbs_tempch = 0x08; testcvbs_tempcl = 0x04;
+ if(ivideo.chip == SIS_300) {
+ inSISIDXREG(SISSR,0x3b,myflag);
+ if(!(myflag & 0x01)) {
+ testvga2_tempbh = 0x00; testvga2_tempbl = 0x00;
+ testvga2_tempch = 0x00; testvga2_tempcl = 0x00;
+ }
+ }
+
+ } else {
+
+ testvga2_tempbh = 0x00; testvga2_tempbl = 0xd1;
+ testsvhs_tempbh = 0x00; testsvhs_tempbl = 0xb9;
+ testcvbs_tempbh = 0x00; testcvbs_tempbl = 0xb3;
+ if((sishw_ext.ujVBChipID != VB_CHIP_301) &&
+ (sishw_ext.ujVBChipID != VB_CHIP_302)) {
+ testvga2_tempbh = 0x01; testvga2_tempbl = 0x90;
+ testsvhs_tempbh = 0x01; testsvhs_tempbl = 0x6b;
+ testcvbs_tempbh = 0x01; testcvbs_tempbl = 0x74;
+ if(sishw_ext.ujVBChipID == VB_CHIP_301LV ||
+ sishw_ext.ujVBChipID == VB_CHIP_302LV) {
+ testvga2_tempbh = 0x00; testvga2_tempbl = 0x00;
+ testsvhs_tempbh = 0x02; testsvhs_tempbl = 0x00;
+ testcvbs_tempbh = 0x01; testcvbs_tempbl = 0x00;
+ }
+ }
+ if(sishw_ext.ujVBChipID != VB_CHIP_301LV &&
+ sishw_ext.ujVBChipID != VB_CHIP_302LV) {
+ inSISIDXREG(SISPART4,0x01,myflag);
+ if(myflag & 0x04) {
+ testvga2_tempbh = 0x00; testvga2_tempbl = 0xfd;
+ testsvhs_tempbh = 0x00; testsvhs_tempbl = 0xdd;
+ testcvbs_tempbh = 0x00; testcvbs_tempbl = 0xee;
+ }
+ }
+ if((sishw_ext.ujVBChipID == VB_CHIP_301LV) ||
+ (sishw_ext.ujVBChipID == VB_CHIP_302LV) ) {
+ testvga2_tempbh = 0x00; testvga2_tempbl = 0x00;
+ testvga2_tempch = 0x00; testvga2_tempcl = 0x00;
+ testsvhs_tempch = 0x04; testsvhs_tempcl = 0x08;
+ testcvbs_tempch = 0x08; testcvbs_tempcl = 0x08;
+ } else {
+ testvga2_tempch = 0x0e; testvga2_tempcl = 0x08;
+ testsvhs_tempch = 0x06; testsvhs_tempcl = 0x04;
+ testcvbs_tempch = 0x08; testcvbs_tempcl = 0x04;
+ }
+ }
+
+ if(testvga2_tempch || testvga2_tempcl || testvga2_tempbh || testvga2_tempbl) {
+ result = SISDoSense(testvga2_tempbl, testvga2_tempbh,
+ testvga2_tempcl, testvga2_tempch);
+ if(result) {
+ printk(KERN_INFO "sisfb: Detected secondary VGA connection\n");
+ orSISIDXREG(SISCR, 0x32, 0x10);
+ }
+ }
+
+ result = SISDoSense(testsvhs_tempbl, testsvhs_tempbh,
+ testsvhs_tempcl, testsvhs_tempch);
+ if(result) {
+ printk(KERN_INFO "sisfb: Detected TV connected to SVHS output\n");
+ /* TW: So we can be sure that there IS a SVHS output */
+ ivideo.TV_plug = TVPLUG_SVIDEO;
+ orSISIDXREG(SISCR, 0x32, 0x02);
+ }
+
+ if(!result) {
+ result = SISDoSense(testcvbs_tempbl, testcvbs_tempbh,
+ testcvbs_tempcl, testcvbs_tempch);
+ if(result) {
+ printk(KERN_INFO "sisfb: Detected TV connected to CVBS output\n");
+ /* TW: So we can be sure that there IS a CVBS output */
+ ivideo.TV_plug = TVPLUG_COMPOSITE;
+ orSISIDXREG(SISCR, 0x32, 0x01);
+ }
+ }
+ SISDoSense(0, 0, 0, 0);
+
+ outSISIDXREG(SISPART4,0x0d,backupP4_0d);
+}
+
+/* TW: Determine and detect attached TV's on Chrontel */
+void
+SiS_SenseCh(void)
+{
+
+ u8 temp1;
+#ifdef CONFIG_FB_SIS_315
+ u8 temp2;
+#endif
+
+ if(ivideo.chip < SIS_315H) {
+
+#ifdef CONFIG_FB_SIS_300
+ SiS_Pr.SiS_IF_DEF_CH70xx = 1; /* TW: Chrontel 7005 */
+ temp1 = SiS_GetCH700x(&SiS_Pr, 0x25);
+ if ((temp1 >= 50) && (temp1 <= 100)) {
+ /* TW: Read power status */
+ temp1 = SiS_GetCH700x(&SiS_Pr, 0x0e);
+ if((temp1 & 0x03) != 0x03) {
+ /* TW: Power all outputs */
+ SiS_SetCH70xxANDOR(&SiS_Pr, 0x030E,0xF8);
+ }
+ /* TW: Sense connected TV devices */
+ SiS_SetCH700x(&SiS_Pr, 0x0110);
+ SiS_SetCH700x(&SiS_Pr, 0x0010);
+ temp1 = SiS_GetCH700x(&SiS_Pr, 0x10);
+ if(!(temp1 & 0x08)) {
+ printk(KERN_INFO
+ "sisfb: Chrontel: Detected TV connected to SVHS output\n");
+ /* TW: So we can be sure that there IS a SVHS output */
+ ivideo.TV_plug = TVPLUG_SVIDEO;
+ orSISIDXREG(SISCR, 0x32, 0x02);
+ } else if (!(temp1 & 0x02)) {
+ printk(KERN_INFO
+ "sisfb: Chrontel: Detected TV connected to CVBS output\n");
+ /* TW: So we can be sure that there IS a CVBS output */
+ ivideo.TV_plug = TVPLUG_COMPOSITE;
+ orSISIDXREG(SISCR, 0x32, 0x01);
+ } else {
+ SiS_SetCH70xxANDOR(&SiS_Pr, 0x010E,0xF8);
+ }
+ } else if(temp1 == 0) {
+ SiS_SetCH70xxANDOR(&SiS_Pr, 0x010E,0xF8);
+ }
+#endif
+
+ } else {
+
+#ifdef CONFIG_FB_SIS_315
+ SiS_Pr.SiS_IF_DEF_CH70xx = 2; /* TW: Chrontel 7019 */
+ temp1 = SiS_GetCH701x(&SiS_Pr, 0x49);
+ SiS_SetCH701x(&SiS_Pr, 0x2049);
+ SiS_DDC2Delay(&SiS_Pr, 0x96);
+ temp2 = SiS_GetCH701x(&SiS_Pr, 0x20);
+ temp2 |= 0x01;
+ SiS_SetCH701x(&SiS_Pr, (temp2 << 8) | 0x20);
+ SiS_DDC2Delay(&SiS_Pr, 0x96);
+ temp2 ^= 0x01;
+ SiS_SetCH701x(&SiS_Pr, (temp2 << 8) | 0x20);
+ SiS_DDC2Delay(&SiS_Pr, 0x96);
+ temp2 = SiS_GetCH701x(&SiS_Pr, 0x20);
+ SiS_SetCH701x(&SiS_Pr, (temp1 << 8) | 0x49);
+ temp1 = 0;
+ if(temp2 & 0x02) temp1 |= 0x01;
+ if(temp2 & 0x10) temp1 |= 0x01;
+ if(temp2 & 0x04) temp1 |= 0x02;
+ if( (temp1 & 0x01) && (temp1 & 0x02) ) temp1 = 0x04;
+ switch(temp1) {
+ case 0x01:
+ printk(KERN_INFO
+ "sisfb: Chrontel: Detected TV connected to CVBS output\n");
+ ivideo.TV_plug = TVPLUG_COMPOSITE;
+ orSISIDXREG(SISCR, 0x32, 0x01);
+ break;
+ case 0x02:
+ printk(KERN_INFO
+ "sisfb: Chrontel: Detected TV connected to SVHS output\n");
+ ivideo.TV_plug = TVPLUG_SVIDEO;
+ orSISIDXREG(SISCR, 0x32, 0x02);
+ break;
+ case 0x04:
+ /* TW: This should not happen */
+ printk(KERN_INFO
+ "sisfb: Chrontel: Detected TV connected to SCART output\n");
+ break;
+ }
+#endif
+
+ }
+}
+
+
+/* ------------------------ Heap routines -------------------------- */
static int sisfb_heap_init(void)
{
@@ -1357,8 +2827,8 @@ static int sisfb_heap_init(void)
#ifdef CONFIG_FB_SIS_315
if (sisvga_engine == SIS_315_VGA) {
/* TW: Now initialize the 310 series' command queue mode.
- * On 310, there are three queue modes available which
- * are chosen by setting bits 7:5 in SR26:
+ * On 310/325, there are three queue modes available which
+ * are chosen by setting bits 7:5 in SR26:
* 1. MMIO queue mode (bit 5, 0x20). The hardware will keep
* track of the queue, the FIFO, command parsing and so
* on. This is the one comparable to the 300 series.
@@ -1419,7 +2889,7 @@ static int sisfb_heap_init(void)
}
}
#else
- agp_enabled= 0;
+ agp_enabled = 0;
#endif
/* TW: Now select the queue mode */
@@ -1454,26 +2924,22 @@ static int sisfb_heap_init(void)
switch (cmd_type) {
case AGP_CMD_QUEUE:
#ifndef AGPOFF
- DPRINTK("sisfb: AGP buffer base:0x%lx, offset:0x%x, size: %dK\n",
+ DPRINTK("sisfb: AGP buffer base = 0x%lx, offset = 0x%x, size = %dK\n",
agp_info->aper_base, agp->physical, agp_size/1024);
agp_phys = agp_info->aper_base + agp->physical;
- vgawb(CRTC_ADR, IND_SIS_AGP_IO_PAD);
- vgawb(CRTC_DATA, 0);
- vgawb(CRTC_DATA, SIS_AGP_2X);
+ outSISIDXREG(SISCR, IND_SIS_AGP_IO_PAD, 0);
+ outSISIDXREG(SISCR, IND_SIS_AGP_IO_PAD, SIS_AGP_2X);
- vgawb(SEQ_ADR, IND_SIS_CMDQUEUE_THRESHOLD);
- vgawb(SEQ_DATA, COMMAND_QUEUE_THRESHOLD);
+ outSISIDXREG(SISSR, IND_SIS_CMDQUEUE_THRESHOLD, COMMAND_QUEUE_THRESHOLD);
- vgawb(SEQ_ADR, IND_SIS_CMDQUEUE_SET);
- vgawb(SEQ_DATA, SIS_CMD_QUEUE_RESET);
+ outSISIDXREG(SISSR, IND_SIS_CMDQUEUE_SET, SIS_CMD_QUEUE_RESET);
*write_port = *read_port;
temp |= SIS_AGP_CMDQUEUE_ENABLE;
- vgawb(SEQ_ADR, IND_SIS_CMDQUEUE_SET);
- vgawb(SEQ_DATA, temp);
+ outSISIDXREG(SISSR, IND_SIS_CMDQUEUE_SET, temp);
*cmdq_baseport = agp_phys;
@@ -1485,17 +2951,14 @@ static int sisfb_heap_init(void)
sisfb_heap_end -= COMMAND_QUEUE_AREA_SIZE;
sisfb_heap_size -= COMMAND_QUEUE_AREA_SIZE;
- vgawb(SEQ_ADR, IND_SIS_CMDQUEUE_THRESHOLD);
- vgawb(SEQ_DATA, COMMAND_QUEUE_THRESHOLD);
+ outSISIDXREG(SISSR, IND_SIS_CMDQUEUE_THRESHOLD, COMMAND_QUEUE_THRESHOLD);
- vgawb(SEQ_ADR, IND_SIS_CMDQUEUE_SET);
- vgawb(SEQ_DATA, SIS_CMD_QUEUE_RESET);
+ outSISIDXREG(SISSR, IND_SIS_CMDQUEUE_SET, SIS_CMD_QUEUE_RESET);
*write_port = *read_port;
temp |= SIS_VRAM_CMDQUEUE_ENABLE;
- vgawb(SEQ_ADR, IND_SIS_CMDQUEUE_SET);
- vgawb(SEQ_DATA, temp);
+ outSISIDXREG(SISSR, IND_SIS_CMDQUEUE_SET, temp);
*cmdq_baseport = ivideo.video_size - COMMAND_QUEUE_AREA_SIZE;
@@ -1513,23 +2976,19 @@ static int sisfb_heap_init(void)
sisfb_heap_end -= COMMAND_QUEUE_AREA_SIZE;
sisfb_heap_size -= COMMAND_QUEUE_AREA_SIZE;
- vgawb(SEQ_ADR, IND_SIS_CMDQUEUE_THRESHOLD);
- vgawb(SEQ_DATA, COMMAND_QUEUE_THRESHOLD);
-
- vgawb(SEQ_ADR, IND_SIS_CMDQUEUE_SET);
- vgawb(SEQ_DATA, SIS_CMD_QUEUE_RESET);
+ outSISIDXREG(SISSR, IND_SIS_CMDQUEUE_THRESHOLD, COMMAND_QUEUE_THRESHOLD);
+ outSISIDXREG(SISSR, IND_SIS_CMDQUEUE_SET, SIS_CMD_QUEUE_RESET);
*write_port = *read_port;
- /* TW: Set Auto_Correction bit; this works in sisfb lite,
- * so why not.
- */
+ /* TW: Set Auto_Correction bit */
temp |= (SIS_MMIO_CMD_ENABLE | SIS_CMD_AUTO_CORR);
- vgawb(SEQ_ADR, IND_SIS_CMDQUEUE_SET);
- vgawb(SEQ_DATA, temp);
+ outSISIDXREG(SISSR, IND_SIS_CMDQUEUE_SET, temp);
*cmdq_baseport = ivideo.video_size - COMMAND_QUEUE_AREA_SIZE;
+ sisfb_caps |= MMIO_CMD_QUEUE_CAP;
+
DPRINTK("sisfb: MMIO Cmd Queue offset = 0x%lx, size is %dK\n",
*cmdq_baseport, COMMAND_QUEUE_AREA_SIZE/1024);
break;
@@ -1547,15 +3006,16 @@ static int sisfb_heap_init(void)
tqueue_pos = (ivideo.video_size -
TURBO_QUEUE_AREA_SIZE) / (64 * 1024);
+
temp = (u8) (tqueue_pos & 0xff);
- vgawb(SEQ_ADR, IND_SIS_TURBOQUEUE_SET);
- tq_state = vgarb(SEQ_DATA);
+
+ inSISIDXREG(SISSR, IND_SIS_TURBOQUEUE_SET, tq_state);
tq_state |= 0xf0;
tq_state &= 0xfc;
tq_state |= (u8) (tqueue_pos >> 8);
- vgawb(SEQ_DATA, tq_state);
- vgawb(SEQ_ADR, IND_SIS_TURBOQUEUE_ADR);
- vgawb(SEQ_DATA, temp);
+ outSISIDXREG(SISSR, IND_SIS_TURBOQUEUE_SET, tq_state);
+
+ outSISIDXREG(SISSR, IND_SIS_TURBOQUEUE_ADR, temp);
sisfb_caps |= TURBO_QUEUE_CAP;
@@ -1566,9 +3026,9 @@ static int sisfb_heap_init(void)
}
}
#endif
- /* TW: Now reserve memory for the HWCursor. It is always located at the very
- top of the videoRAM, right below the TB memory area (if used). */
- if (sisfb_heap_size >= sisfb_hwcursor_size) {
+ /* TW: Now reserve memory for the HWCursor. It is always located at the very
+ top of the videoRAM, right below the TB memory area (if used). */
+ if (sisfb_heap_size >= sisfb_hwcursor_size) {
sisfb_heap_end -= sisfb_hwcursor_size;
sisfb_heap_size -= sisfb_hwcursor_size;
sisfb_hwcursor_vbase = sisfb_heap_end;
@@ -1577,58 +3037,54 @@ static int sisfb_heap_init(void)
DPRINTK("sisfb: Hardware Cursor start at 0x%lx, size is %dK\n",
sisfb_heap_end, sisfb_hwcursor_size/1024);
- }
+ }
- sisfb_heap.poha_chain = NULL;
- sisfb_heap.poh_freelist = NULL;
+ sisfb_heap.poha_chain = NULL;
+ sisfb_heap.poh_freelist = NULL;
- poh = sisfb_poh_new_node();
+ poh = sisfb_poh_new_node();
- if (poh == NULL)
- return 1;
+ if(poh == NULL) return 1;
- poh->poh_next = &sisfb_heap.oh_free;
- poh->poh_prev = &sisfb_heap.oh_free;
- poh->size = sisfb_heap_end - sisfb_heap_start + 1;
- poh->offset = sisfb_heap_start - (unsigned long) ivideo.video_vbase;
+ poh->poh_next = &sisfb_heap.oh_free;
+ poh->poh_prev = &sisfb_heap.oh_free;
+ poh->size = sisfb_heap_end - sisfb_heap_start + 1;
+ poh->offset = sisfb_heap_start - (unsigned long) ivideo.video_vbase;
- DPRINTK("sisfb: Heap start:0x%p, end:0x%p, len=%dk\n",
+ DPRINTK("sisfb: Heap start:0x%p, end:0x%p, len=%dk\n",
(char *) sisfb_heap_start, (char *) sisfb_heap_end,
(unsigned int) poh->size / 1024);
- DPRINTK("sisfb: First Node offset:0x%x, size:%dk\n",
+ DPRINTK("sisfb: First Node offset:0x%x, size:%dk\n",
(unsigned int) poh->offset, (unsigned int) poh->size / 1024);
-
- sisfb_heap.oh_free.poh_next = poh;
- sisfb_heap.oh_free.poh_prev = poh;
- sisfb_heap.oh_free.size = 0;
- sisfb_heap.max_freesize = poh->size;
- sisfb_heap.oh_used.poh_next = &sisfb_heap.oh_used;
- sisfb_heap.oh_used.poh_prev = &sisfb_heap.oh_used;
- sisfb_heap.oh_used.size = SENTINEL;
+ sisfb_heap.oh_free.poh_next = poh;
+ sisfb_heap.oh_free.poh_prev = poh;
+ sisfb_heap.oh_free.size = 0;
+ sisfb_heap.max_freesize = poh->size;
- return 0;
+ sisfb_heap.oh_used.poh_next = &sisfb_heap.oh_used;
+ sisfb_heap.oh_used.poh_prev = &sisfb_heap.oh_used;
+ sisfb_heap.oh_used.size = SENTINEL;
+
+ return 0;
}
static SIS_OH *sisfb_poh_new_node(void)
{
- int i;
+ int i;
unsigned long cOhs;
- SIS_OHALLOC *poha;
- SIS_OH *poh;
+ SIS_OHALLOC *poha;
+ SIS_OH *poh;
if (sisfb_heap.poh_freelist == NULL) {
poha = kmalloc(OH_ALLOC_SIZE, GFP_KERNEL);
- if(!poha)
- return NULL;
+ if(!poha) return NULL;
poha->poha_next = sisfb_heap.poha_chain;
sisfb_heap.poha_chain = poha;
- cOhs =
- (OH_ALLOC_SIZE -
- sizeof(SIS_OHALLOC)) / sizeof(SIS_OH) + 1;
+ cOhs = (OH_ALLOC_SIZE - sizeof(SIS_OHALLOC)) / sizeof(SIS_OH) + 1;
poh = &poha->aoh[0];
for (i = cOhs - 1; i != 0; i--) {
@@ -1650,7 +3106,7 @@ static SIS_OH *sisfb_poh_allocate(unsigned long size)
{
SIS_OH *pohThis;
SIS_OH *pohRoot;
- int bAllocated = 0;
+ int bAllocated = 0;
if (size > sisfb_heap.max_freesize) {
DPRINTK("sisfb: Can't allocate %dk size on offscreen\n",
@@ -1704,14 +3160,12 @@ static void sisfb_delete_node(SIS_OH *poh)
SIS_OH *poh_prev;
SIS_OH *poh_next;
-
poh_prev = poh->poh_prev;
poh_next = poh->poh_next;
poh_prev->poh_next = poh_next;
poh_next->poh_prev = poh_prev;
- return;
}
static void sisfb_insert_node(SIS_OH *pohList, SIS_OH *poh)
@@ -1739,8 +3193,8 @@ static SIS_OH *sisfb_poh_free(unsigned long base)
poh_freed = sisfb_heap.oh_used.poh_next;
- while (poh_freed != &sisfb_heap.oh_used) {
- if (poh_freed->offset == base) {
+ while(poh_freed != &sisfb_heap.oh_used) {
+ if(poh_freed->offset == base) {
foundNode = 1;
break;
}
@@ -1748,8 +3202,7 @@ static SIS_OH *sisfb_poh_free(unsigned long base)
poh_freed = poh_freed->poh_next;
}
- if (!foundNode)
- return (NULL);
+ if (!foundNode) return (NULL);
sisfb_heap.max_freesize += poh_freed->size;
@@ -1800,14 +3253,11 @@ static SIS_OH *sisfb_poh_free(unsigned long base)
static void sisfb_free_node(SIS_OH *poh)
{
- if (poh == NULL) {
- return;
- }
+ if(poh == NULL) return;
poh->poh_next = sisfb_heap.poh_freelist;
sisfb_heap.poh_freelist = poh;
- return;
}
void sis_malloc(struct sis_memreq *req)
@@ -1816,14 +3266,13 @@ void sis_malloc(struct sis_memreq *req)
poh = sisfb_poh_allocate(req->size);
- if (poh == NULL) {
+ if(poh == NULL) {
req->offset = 0;
req->size = 0;
DPRINTK("sisfb: Video RAM allocation failed\n");
} else {
DPRINTK("sisfb: Video RAM allocation succeeded: 0x%p\n",
- (char *) (poh->offset +
- (unsigned long) ivideo.video_vbase));
+ (char *) (poh->offset + (unsigned long) ivideo.video_vbase));
req->offset = poh->offset;
req->size = poh->size;
@@ -1837,34 +3286,31 @@ void sis_free(unsigned long base)
poh = sisfb_poh_free(base);
- if (poh == NULL) {
+ if(poh == NULL) {
DPRINTK("sisfb: sisfb_poh_free() failed at base 0x%x\n",
(unsigned int) base);
}
}
-/* ------------------ SetMode Routines ------------------------------- */
+/* --------------------- SetMode routines ------------------------- */
static void sisfb_pre_setmode(void)
{
u8 cr30 = 0, cr31 = 0;
- vgawb(CRTC_ADR, 0x31);
- cr31 = vgarb(CRTC_DATA) & ~0x60;
+ inSISIDXREG(SISCR, 0x31, cr31);
+ cr31 &= ~0x60;
switch (ivideo.disp_state & DISPTYPE_DISP2) {
case DISPTYPE_CRT2:
- printk(KERN_INFO "sisfb: CRT2 type is VGA\n");
cr30 = (SIS_VB_OUTPUT_CRT2 | SIS_SIMULTANEOUS_VIEW_ENABLE);
cr31 |= SIS_DRIVER_MODE;
break;
case DISPTYPE_LCD:
- printk(KERN_INFO "sisfb: CRT2 type is LCD\n");
cr30 = (SIS_VB_OUTPUT_LCD | SIS_SIMULTANEOUS_VIEW_ENABLE);
cr31 |= SIS_DRIVER_MODE;
break;
case DISPTYPE_TV:
- printk(KERN_INFO "sisfb: CRT2 type is TV\n");
if (ivideo.TV_type == TVMODE_HIVISION)
cr30 = (SIS_VB_OUTPUT_HIVISION | SIS_SIMULTANEOUS_VIEW_ENABLE);
else if (ivideo.TV_plug == TVPLUG_SVIDEO)
@@ -1874,90 +3320,79 @@ static void sisfb_pre_setmode(void)
else if (ivideo.TV_plug == TVPLUG_SCART)
cr30 = (SIS_VB_OUTPUT_SCART | SIS_SIMULTANEOUS_VIEW_ENABLE);
cr31 |= SIS_DRIVER_MODE;
- /* cr31 &= ~0x04; */ /* TW @@@ 5/5/02 */ /* TW: No NotSimuMode by default */
- /*karl*/
+
if (sisfb_tvmode == 1 || ivideo.TV_type == TVMODE_PAL)
- cr31 |= 0x1;
- if (sisfb_tvmode == 2 || ivideo.TV_type == TVMODE_NTSC)
- cr31 &= ~0x1;
+ cr31 |= 0x01;
+ else
+ cr31 &= ~0x01;
break;
- default: /* CRT2 disable */
- printk(KERN_INFO "sisfb: CRT2 is disabled\n");
+ default: /* disable CRT2 */
cr30 = 0x00;
cr31 |= (SIS_DRIVER_MODE | SIS_VB_OUTPUT_DISABLE);
}
- vgawb(CRTC_ADR, IND_SIS_SCRATCH_REG_CR30);
- vgawb(CRTC_DATA, cr30);
- vgawb(CRTC_ADR, IND_SIS_SCRATCH_REG_CR31);
- vgawb(CRTC_DATA, cr31);
+ outSISIDXREG(SISCR, IND_SIS_SCRATCH_REG_CR30, cr30);
+ outSISIDXREG(SISCR, IND_SIS_SCRATCH_REG_CR31, cr31);
- vgawb(CRTC_ADR, IND_SIS_SCRATCH_REG_CR33);
-/*
- if (ivideo.disp_state & DISPTYPE_CRT2) {
- sisfb_rate_idx &= 0x0F;
- sisfb_rate_idx |= (sisfb_rate_idx << 4);
- vgawb(CRTC_DATA, sisfb_rate_idx);
- } else {
- vgawb(CRTC_DATA, sisfb_rate_idx & 0x0F);
- }
-*/
- vgawb(CRTC_DATA, sisfb_rate_idx & 0x0F);
+ outSISIDXREG(SISCR, IND_SIS_SCRATCH_REG_CR33, (sisfb_rate_idx & 0x0F));
+
+ if(ivideo.accel) sisfb_syncaccel();
+
+ SiS_Pr.SiS_UseOEM = sisfb_useoem;
}
static void sisfb_post_setmode(void)
{
u8 reg;
-
- /* TW: We can't switch off CRT1 on LVDS/Chrontel in 8bpp Modes */
- if ((ivideo.hasVB == HASVB_LVDS) || (ivideo.hasVB == HASVB_LVDS_CHRONTEL)) {
- if (ivideo.video_bpp == 8) {
- sisfb_crt1off = 0;
- }
+ BOOLEAN doit = TRUE;
+#if 0 /* TW: Wrong: Is not in MMIO space, but in RAM */
+ /* Backup mode number to MMIO space */
+ if(ivideo.mmio_vbase) {
+ *(volatile u8 *)(((u8*)ivideo.mmio_vbase) + 0x449) = (unsigned char)sisfb_mode_no;
}
+#endif
- /* TW: We can't switch off CRT1 on 630+301B in 8bpp Modes */
- if ( (sishw_ext.ujVBChipID == VB_CHIP_301B) && (sisvga_engine == SIS_300_VGA) &&
- (ivideo.disp_state & DISPTYPE_LCD) ) {
- if (ivideo.video_bpp == 8) {
- sisfb_crt1off = 0;
+ if (ivideo.video_bpp == 8) {
+ /* TW: We can't switch off CRT1 on LVDS/Chrontel in 8bpp Modes */
+ if ((ivideo.hasVB == HASVB_LVDS) || (ivideo.hasVB == HASVB_LVDS_CHRONTEL)) {
+ doit = FALSE;
+ }
+ /* TW: We can't switch off CRT1 on 301B-DH in 8bpp Modes if using LCD */
+ if ( (sishw_ext.Is301BDH) && (ivideo.disp_state & DISPTYPE_LCD) ) {
+ doit = FALSE;
}
}
/* TW: We can't switch off CRT1 if bridge is in slave mode */
- vgawb(VB_PART1_ADR,0x00);
- reg = vgarb(VB_PART1_DATA);
- if(sisvga_engine == SIS_300_VGA) {
- if((reg & 0xa0) == 0x20) {
- sisfb_crt1off = 0;
+ if(ivideo.hasVB != HASVB_NONE) {
+ inSISIDXREG(SISPART1, 0x00, reg);
+ if(sisvga_engine == SIS_300_VGA) {
+ if((reg & 0xa0) == 0x20) {
+ doit = FALSE;
+ }
}
- }
- if(sisvga_engine == SIS_315_VGA) {
- if((reg & 0x50) == 0x10) {
- sisfb_crt1off = 0;
+ if(sisvga_engine == SIS_315_VGA) {
+ if((reg & 0x50) == 0x10) {
+ doit = FALSE;
+ }
}
- }
+ } else sisfb_crt1off = 0;
- vgawb(CRTC_ADR, 0x17);
- reg = vgarb(CRTC_DATA);
- if (sisfb_crt1off)
+ inSISIDXREG(SISCR, 0x17, reg);
+ if((sisfb_crt1off) && (doit))
reg &= ~0x80;
else
reg |= 0x80;
- vgawb(CRTC_DATA, reg);
-
- vgawb(SEQ_ADR, IND_SIS_RAMDAC_CONTROL);
- reg = vgarb(SEQ_DATA);
- reg &= ~0x04;
- vgawb(SEQ_DATA, reg);
-
- if ((ivideo.disp_state & DISPTYPE_TV) && (ivideo.hasVB == HASVB_301)) {
-
- vgawb(VB_PART4_ADR,0x01);
- reg = vgarb(VB_PART4_DATA);
- if (reg < 0xB0) /* 301B Revision ID */
- {
- // Eden Chen
+ outSISIDXREG(SISCR, 0x17, reg);
+
+ andSISIDXREG(SISSR, IND_SIS_RAMDAC_CONTROL, ~0x04);
+
+ if((ivideo.disp_state & DISPTYPE_TV) && (ivideo.hasVB == HASVB_301)) {
+
+ inSISIDXREG(SISPART4, 0x01, reg);
+
+ if(reg < 0xB0) { /* Set filter for SiS301 */
+
switch (ivideo.video_width) {
case 320:
filter_tb = (ivideo.TV_type == TVMODE_NTSC) ? 4 : 12;
@@ -1975,117 +3410,78 @@ static void sisfb_post_setmode(void)
filter = -1;
break;
}
- // ~Eden Chen
- // Eden Chen
- //vgawb(VB_PART1_ADR, 0x24);
- vgawb(VB_PART1_ADR, sisfb_CRT2_write_enable);
- // ~Eden Chen
- vgawb(VB_PART1_DATA, 0x01);
-
- if (ivideo.TV_type == TVMODE_NTSC) {
- vgawb(VB_PART2_ADR, 0x3A);
- reg = vgarb(VB_PART2_DATA);
- reg &= 0x1F;
- vgawb(VB_PART2_DATA, reg);
+ orSISIDXREG(SISPART1, sisfb_CRT2_write_enable, 0x01);
+
+ if(ivideo.TV_type == TVMODE_NTSC) {
+
+ andSISIDXREG(SISPART2, 0x3a, 0x1f);
if (ivideo.TV_plug == TVPLUG_SVIDEO) {
- vgawb(VB_PART2_ADR, 0x30);
- reg = vgarb(VB_PART2_DATA);
- reg &= 0xDF;
- vgawb(VB_PART2_DATA, reg);
+
+ andSISIDXREG(SISPART2, 0x30, 0xdf);
+
} else if (ivideo.TV_plug == TVPLUG_COMPOSITE) {
- vgawb(VB_PART2_ADR, 0x30);
- reg = vgarb(VB_PART2_DATA);
- reg |= 0x20;
- vgawb(VB_PART2_DATA, reg);
+
+ orSISIDXREG(SISPART2, 0x30, 0x20);
switch (ivideo.video_width) {
case 640:
- vgawb(VB_PART2_ADR, 0x35);
- vgawb(VB_PART2_DATA, 0xEB);
- vgawb(VB_PART2_ADR, 0x36);
- vgawb(VB_PART2_DATA, 0x04);
- vgawb(VB_PART2_ADR, 0x37);
- vgawb(VB_PART2_DATA, 0x25);
- vgawb(VB_PART2_ADR, 0x38);
- vgawb(VB_PART2_DATA, 0x18);
+ outSISIDXREG(SISPART2, 0x35, 0xEB);
+ outSISIDXREG(SISPART2, 0x36, 0x04);
+ outSISIDXREG(SISPART2, 0x37, 0x25);
+ outSISIDXREG(SISPART2, 0x38, 0x18);
break;
case 720:
- vgawb(VB_PART2_ADR, 0x35);
- vgawb(VB_PART2_DATA, 0xEE);
- vgawb(VB_PART2_ADR, 0x36);
- vgawb(VB_PART2_DATA, 0x0C);
- vgawb(VB_PART2_ADR, 0x37);
- vgawb(VB_PART2_DATA, 0x22);
- vgawb(VB_PART2_ADR, 0x38);
- vgawb(VB_PART2_DATA, 0x08);
+ outSISIDXREG(SISPART2, 0x35, 0xEE);
+ outSISIDXREG(SISPART2, 0x36, 0x0C);
+ outSISIDXREG(SISPART2, 0x37, 0x22);
+ outSISIDXREG(SISPART2, 0x38, 0x08);
break;
case 800:
- vgawb(VB_PART2_ADR, 0x35);
- vgawb(VB_PART2_DATA, 0xEB);
- vgawb(VB_PART2_ADR, 0x36);
- vgawb(VB_PART2_DATA, 0x15);
- vgawb(VB_PART2_ADR, 0x37);
- vgawb(VB_PART2_DATA, 0x25);
- vgawb(VB_PART2_ADR, 0x38);
- vgawb(VB_PART2_DATA, 0xF6);
+ outSISIDXREG(SISPART2, 0x35, 0xEB);
+ outSISIDXREG(SISPART2, 0x36, 0x15);
+ outSISIDXREG(SISPART2, 0x37, 0x25);
+ outSISIDXREG(SISPART2, 0x38, 0xF6);
break;
}
}
- } else if (ivideo.TV_type == TVMODE_PAL) {
- vgawb(VB_PART2_ADR, 0x3A);
- reg = vgarb(VB_PART2_DATA);
- reg &= 0x1F;
- vgawb(VB_PART2_DATA, reg);
+
+ } else if(ivideo.TV_type == TVMODE_PAL) {
+
+ andSISIDXREG(SISPART2, 0x3A, 0x1F);
if (ivideo.TV_plug == TVPLUG_SVIDEO) {
- vgawb(VB_PART2_ADR, 0x30);
- reg = vgarb(VB_PART2_DATA);
- reg &= 0xDF;
- vgawb(VB_PART2_DATA, reg);
+
+ andSISIDXREG(SISPART2, 0x30, 0xDF);
+
} else if (ivideo.TV_plug == TVPLUG_COMPOSITE) {
- vgawb(VB_PART2_ADR, 0x30);
- reg = vgarb(VB_PART2_DATA);
- reg |= 0x20;
- vgawb(VB_PART2_DATA, reg);
+
+ orSISIDXREG(SISPART2, 0x30, 0x20);
switch (ivideo.video_width) {
case 640:
- vgawb(VB_PART2_ADR, 0x35);
- vgawb(VB_PART2_DATA, 0xF1);
- vgawb(VB_PART2_ADR, 0x36);
- vgawb(VB_PART2_DATA, 0xF7);
- vgawb(VB_PART2_ADR, 0x37);
- vgawb(VB_PART2_DATA, 0x1F);
- vgawb(VB_PART2_ADR, 0x38);
- vgawb(VB_PART2_DATA, 0x32);
+ outSISIDXREG(SISPART2, 0x35, 0xF1);
+ outSISIDXREG(SISPART2, 0x36, 0xF7);
+ outSISIDXREG(SISPART2, 0x37, 0x1F);
+ outSISIDXREG(SISPART2, 0x38, 0x32);
break;
case 720:
- vgawb(VB_PART2_ADR, 0x35);
- vgawb(VB_PART2_DATA, 0xF3);
- vgawb(VB_PART2_ADR, 0x36);
- vgawb(VB_PART2_DATA, 0x00);
- vgawb(VB_PART2_ADR, 0x37);
- vgawb(VB_PART2_DATA, 0x1D);
- vgawb(VB_PART2_ADR, 0x38);
- vgawb(VB_PART2_DATA, 0x20);
+ outSISIDXREG(SISPART2, 0x35, 0xF3);
+ outSISIDXREG(SISPART2, 0x36, 0x00);
+ outSISIDXREG(SISPART2, 0x37, 0x1D);
+ outSISIDXREG(SISPART2, 0x38, 0x20);
break;
case 800:
- vgawb(VB_PART2_ADR, 0x35);
- vgawb(VB_PART2_DATA, 0xFC);
- vgawb(VB_PART2_ADR, 0x36);
- vgawb(VB_PART2_DATA, 0xFB);
- vgawb(VB_PART2_ADR, 0x37);
- vgawb(VB_PART2_DATA, 0x14);
- vgawb(VB_PART2_ADR, 0x38);
- vgawb(VB_PART2_DATA, 0x2A);
+ outSISIDXREG(SISPART2, 0x35, 0xFC);
+ outSISIDXREG(SISPART2, 0x36, 0xFB);
+ outSISIDXREG(SISPART2, 0x37, 0x14);
+ outSISIDXREG(SISPART2, 0x38, 0x2A);
break;
}
}
}
- // Eden
if ((filter >= 0) && (filter <=7)) {
DPRINTK("FilterTable[%d]-%d: %02x %02x %02x %02x\n", filter_tb, filter,
sis_TV_filter[filter_tb].filter[filter][0],
@@ -2093,583 +3489,57 @@ static void sisfb_post_setmode(void)
sis_TV_filter[filter_tb].filter[filter][2],
sis_TV_filter[filter_tb].filter[filter][3]
);
- vgawb(VB_PART2_ADR, 0x35);
- vgawb(VB_PART2_DATA, sis_TV_filter[filter_tb].filter[filter][0]);
- vgawb(VB_PART2_ADR, 0x36);
- vgawb(VB_PART2_DATA, sis_TV_filter[filter_tb].filter[filter][1]);
- vgawb(VB_PART2_ADR, 0x37);
- vgawb(VB_PART2_DATA, sis_TV_filter[filter_tb].filter[filter][2]);
- vgawb(VB_PART2_ADR, 0x38);
- vgawb(VB_PART2_DATA, sis_TV_filter[filter_tb].filter[filter][3]);
- }
- // ~Eden
- }
-
- }
-
-}
-
-static void sisfb_crtc_to_var(struct fb_var_screeninfo *var)
-{
- u16 VRE, VBE, VRS, VBS, VDE, VT;
- u16 HRE, HBE, HRS, HBS, HDE, HT;
- u8 sr_data, cr_data, cr_data2, cr_data3, mr_data;
- int A, B, C, D, E, F, temp;
- double hrate, drate;
-
- vgawb(SEQ_ADR, IND_SIS_COLOR_MODE);
- sr_data = vgarb(SEQ_DATA);
-
- if (sr_data & SIS_INTERLACED_MODE)
- var->vmode = FB_VMODE_INTERLACED;
- else
- var->vmode = FB_VMODE_NONINTERLACED;
-
- switch ((sr_data & 0x1C) >> 2) {
- case SIS_8BPP_COLOR_MODE:
- var->bits_per_pixel = 8;
- break;
- case SIS_16BPP_COLOR_MODE:
- var->bits_per_pixel = 16;
- break;
- case SIS_32BPP_COLOR_MODE:
- var->bits_per_pixel = 32;
- break;
- }
-
- switch (var->bits_per_pixel) {
- case 8:
- var->red.length = 6;
- var->green.length = 6;
- var->blue.length = 6;
- video_cmap_len = 256;
- break;
- case 16:
- var->red.offset = 11;
- var->red.length = 5;
- var->green.offset = 5;
- var->green.length = 6;
- var->blue.offset = 0;
- var->blue.length = 5;
- var->transp.offset = 0;
- var->transp.length = 0;
- video_cmap_len = 16;
- break;
- case 24:
- var->red.offset = 16;
- var->red.length = 8;
- var->green.offset = 8;
- var->green.length = 8;
- var->blue.offset = 0;
- var->blue.length = 8;
- var->transp.offset = 0;
- var->transp.length = 0;
- video_cmap_len = 16;
- break;
- case 32:
- var->red.offset = 16;
- var->red.length = 8;
- var->green.offset = 8;
- var->green.length = 8;
- var->blue.offset = 0;
- var->blue.length = 8;
- var->transp.offset = 24;
- var->transp.length = 8;
- video_cmap_len = 16;
- break;
- }
-
- vgawb(SEQ_ADR, 0xA);
- sr_data = vgarb(SEQ_DATA);
-
- vgawb(CRTC_ADR, 0x6);
- cr_data = vgarb(CRTC_DATA);
- vgawb(CRTC_ADR, 0x7);
- cr_data2 = vgarb(CRTC_DATA);
- VT = (cr_data & 0xFF) | ((u16) (cr_data2 & 0x01) << 8) |
- ((u16) (cr_data2 & 0x20) << 4) | ((u16) (sr_data & 0x01) <<
- 10);
- A = VT + 2;
-
- vgawb(CRTC_ADR, 0x12);
- cr_data = vgarb(CRTC_DATA);
- VDE = (cr_data & 0xff) | ((u16) (cr_data2 & 0x02) << 7) |
- ((u16) (cr_data2 & 0x40) << 3) | ((u16) (sr_data & 0x02) << 9);
- E = VDE + 1;
-
- vgawb(CRTC_ADR, 0x10);
- cr_data = vgarb(CRTC_DATA);
- VRS = (cr_data & 0xff) | ((u16) (cr_data2 & 0x04) << 6) |
- ((u16) (cr_data2 & 0x80) << 2) | ((u16) (sr_data & 0x08) << 7);
- F = VRS + 1 - E;
-
- vgawb(CRTC_ADR, 0x15);
- cr_data = vgarb(CRTC_DATA);
- vgawb(CRTC_ADR, 0x9);
- cr_data3 = vgarb(CRTC_DATA);
- VBS = (cr_data & 0xff) | ((u16) (cr_data2 & 0x08) << 5) |
- ((u16) (cr_data3 & 0x20) << 4) | ((u16) (sr_data & 0x04) << 8);
-
- vgawb(CRTC_ADR, 0x16);
- cr_data = vgarb(CRTC_DATA);
- VBE = (cr_data & 0xff) | ((u16) (sr_data & 0x10) << 4);
- temp = VBE - ((E - 1) & 511);
- B = (temp > 0) ? temp : (temp + 512);
-
- vgawb(CRTC_ADR, 0x11);
- cr_data = vgarb(CRTC_DATA);
- VRE = (cr_data & 0x0f) | ((sr_data & 0x20) >> 1);
- temp = VRE - ((E + F - 1) & 31);
- C = (temp > 0) ? temp : (temp + 32);
-
- D = B - F - C;
-
- var->yres = var->yres_virtual = E;
- /* TW: We have to report the physical dimension to the console! */
- if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) {
- var->yres <<= 1;
- var->yres_virtual <<=1;
- }
- /* TW end */
- var->upper_margin = D;
- var->lower_margin = F;
- var->vsync_len = C;
-
- vgawb(SEQ_ADR, 0xb);
- sr_data = vgarb(SEQ_DATA);
-
- vgawb(CRTC_ADR, 0x0);
- cr_data = vgarb(CRTC_DATA);
- HT = (cr_data & 0xff) | ((u16) (sr_data & 0x03) << 8);
- A = HT + 5;
-
- vgawb(CRTC_ADR, 0x1);
- cr_data = vgarb(CRTC_DATA);
- HDE = (cr_data & 0xff) | ((u16) (sr_data & 0x0C) << 6);
- E = HDE + 1;
-
- vgawb(CRTC_ADR, 0x4);
- cr_data = vgarb(CRTC_DATA);
- HRS = (cr_data & 0xff) | ((u16) (sr_data & 0xC0) << 2);
- F = HRS - E - 3;
-
- vgawb(CRTC_ADR, 0x2);
- cr_data = vgarb(CRTC_DATA);
- HBS = (cr_data & 0xff) | ((u16) (sr_data & 0x30) << 4);
-
- vgawb(SEQ_ADR, 0xc);
- sr_data = vgarb(SEQ_DATA);
- vgawb(CRTC_ADR, 0x3);
- cr_data = vgarb(CRTC_DATA);
- vgawb(CRTC_ADR, 0x5);
- cr_data2 = vgarb(CRTC_DATA);
- HBE = (cr_data & 0x1f) | ((u16) (cr_data2 & 0x80) >> 2) |
- ((u16) (sr_data & 0x03) << 6);
- HRE = (cr_data2 & 0x1f) | ((sr_data & 0x04) << 3);
-
- temp = HBE - ((E - 1) & 255);
- B = (temp > 0) ? temp : (temp + 256);
-
- temp = HRE - ((E + F + 3) & 63);
- C = (temp > 0) ? temp : (temp + 64);
-
- D = B - F - C;
-
- var->xres = var->xres_virtual = E * 8;
- var->left_margin = D * 8;
- var->right_margin = F * 8;
- var->hsync_len = C * 8;
-
- var->activate = FB_ACTIVATE_NOW;
-
- var->sync = 0;
-
- mr_data = vgarb(0x1C);
- if (mr_data & 0x80)
- var->sync &= ~FB_SYNC_VERT_HIGH_ACT;
- else
- var->sync |= FB_SYNC_VERT_HIGH_ACT;
-
- if (mr_data & 0x40)
- var->sync &= ~FB_SYNC_HOR_HIGH_ACT;
- else
- var->sync |= FB_SYNC_HOR_HIGH_ACT;
-
- VT += 2;
- VT <<= 1;
- HT = (HT + 5) * 8;
-
- hrate = (double) ivideo.refresh_rate * (double) VT / 2;
- drate = hrate * HT;
- var->pixclock = (u32) (1E12 / drate);
-}
-
-/* ------------------ Public Routines -------------------------------- */
-
-static int sisfb_get_fix(struct fb_fix_screeninfo *fix, int con,
- struct fb_info *info)
-{
- memset(fix, 0, sizeof(struct fb_fix_screeninfo));
- strcpy(fix->id, fb_info.modename);
-
- fix->smem_start = ivideo.video_base;
-
- /*karl:10/01/2001*/ /* TW */
- if ((!sisfb_mem) || (sisfb_mem > (ivideo.video_size/1024))) {
- if (ivideo.video_size > 0x1000000) {
- fix->smem_len = 0xc00000;
- } else if (ivideo.video_size > 0x800000)
- fix->smem_len = 0x800000;
- else
- fix->smem_len = 0x400000;
- } else
- fix->smem_len = sisfb_mem * 1024;
-
- fix->type = video_type;
- fix->type_aux = 0;
- if (ivideo.video_bpp == 8)
- fix->visual = FB_VISUAL_PSEUDOCOLOR;
- else
- fix->visual = FB_VISUAL_TRUECOLOR;
- fix->xpanstep = 0;
- fix->ypanstep = 0;
- fix->ywrapstep = 0;
- fix->line_length = video_linelength;
- fix->mmio_start = ivideo.mmio_base;
- fix->mmio_len = sisfb_mmio_size;
- fix->accel = FB_ACCEL_SIS_GLAMOUR;
- fix->reserved[0] = ivideo.video_size & 0xFFFF;
- fix->reserved[1] = (ivideo.video_size >> 16) & 0xFFFF;
- fix->reserved[2] = sisfb_caps;
-
- return 0;
-}
-
-static int sisfb_get_var(struct fb_var_screeninfo *var, int con,
- struct fb_info *info)
-{
- if (con == -1)
- memcpy(var, &default_var, sizeof(struct fb_var_screeninfo));
- else
- *var = fb_display[con].var;
-
- /* JennyLee 2001126: for FSTN */
- if (var->xres == 320 && var->yres == 480)
- var->yres = 240;
- /* ~JennyLee */
-
- return 0;
-}
-
-static int sisfb_set_var(struct fb_var_screeninfo *var, int con,
- struct fb_info *info)
-{
- int err;
- unsigned int cols, rows;
-
- fb_display[con].var.activate = FB_ACTIVATE_NOW;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,23)
- if (sisfb_do_set_var(var, con == info->currcon, info)) {
-#else
- if (sisfb_do_set_var(var, con == currcon, info)) {
-#endif
- sisfb_crtc_to_var(var);
- return -EINVAL;
- }
-
- sisfb_crtc_to_var(var);
-
- sisfb_set_disp(con, var);
-
- if (info->changevar)
- (*info->changevar) (con);
-
- if ((err = fb_alloc_cmap(&fb_display[con].cmap, 0, 0)))
- return err;
-
- sisfb_do_install_cmap(con, info);
-
- cols = sisbios_mode[sisfb_mode_idx].cols;
- rows = sisbios_mode[sisfb_mode_idx].rows;
- vc_resize_con(rows, cols, fb_display[con].conp->vc_num);
-
- return 0;
-}
-
-static int sisfb_get_cmap(struct fb_cmap *cmap, int kspc, int con,
- struct fb_info *info)
-{
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,23)
- if (con == info->currcon)
-#else
- if (con == currcon)
-#endif
- return fb_get_cmap(cmap, kspc, sis_getcolreg, info);
- else if (fb_display[con].cmap.len)
- fb_copy_cmap(&fb_display[con].cmap, cmap, kspc ? 0 : 2);
- else
- fb_copy_cmap(fb_default_cmap(video_cmap_len), cmap, kspc ? 0 : 2);
-
- return 0;
-}
-
-static int sisfb_set_cmap(struct fb_cmap *cmap, int kspc, int con,
- struct fb_info *info)
-{
- int err;
-
- if (!fb_display[con].cmap.len) {
- err = fb_alloc_cmap(&fb_display[con].cmap, video_cmap_len, 0);
- if (err)
- return err;
- }
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,23)
- if (con == info->currcon)
- return fb_set_cmap(cmap, kspc, info);
-#else
- if (con == currcon)
- return fb_set_cmap(cmap, kspc, sisfb_setcolreg, info);
-#endif
- else
- fb_copy_cmap(cmap, &fb_display[con].cmap, kspc ? 0 : 1);
- return 0;
-}
-
-static int sisfb_ioctl(struct inode *inode, struct file *file,
- unsigned int cmd, unsigned long arg, int con,
- struct fb_info *info)
-{
- switch (cmd) {
- case FBIO_ALLOC:
- if (!capable(CAP_SYS_RAWIO))
- return -EPERM;
- sis_malloc((struct sis_memreq *) arg);
- break;
- case FBIO_FREE:
- if (!capable(CAP_SYS_RAWIO))
- return -EPERM;
- sis_free(*(unsigned long *) arg);
- break;
- case FBIOGET_GLYPH:
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,23)
- sis_get_glyph((SIS_GLYINFO *) arg);
-#else
- sis_get_glyph(info,(SIS_GLYINFO *) arg);
-#endif
- break;
- case FBIOGET_HWCINFO:
- {
- unsigned long *hwc_offset = (unsigned long *) arg;
-
- if (sisfb_caps & HW_CURSOR_CAP)
- *hwc_offset = sisfb_hwcursor_vbase -
- (unsigned long) ivideo.video_vbase;
- else
- *hwc_offset = 0;
-
- break;
- }
- case FBIOPUT_MODEINFO:
- {
- struct mode_info *x = (struct mode_info *)arg;
-
- ivideo.video_bpp = x->bpp;
- ivideo.video_width = x->xres;
- ivideo.video_height = x->yres;
- ivideo.video_vwidth = x->v_xres;
- ivideo.video_vheight = x->v_yres;
- ivideo.org_x = x->org_x;
- ivideo.org_y = x->org_y;
- ivideo.refresh_rate = x->vrate;
-
- break;
- }
- case FBIOGET_DISPINFO:
- sis_dispinfo((struct ap_data *)arg);
- break;
- case SISFB_GET_INFO: /* TW: New for communication with X driver */
- {
- sisfb_info *x = (sisfb_info *)arg;
-
- x->sisfb_id = SISFB_ID;
- x->sisfb_version = VER_MAJOR;
- x->sisfb_revision = VER_MINOR;
- x->sisfb_patchlevel = VER_LEVEL;
- x->chip_id = ivideo.chip_id;
- x->memory = ivideo.video_size / 1024;
- x->heapstart = ivideo.heapstart / 1024;
- x->fbvidmode = sisfb_mode_no;
- break;
+ outSISIDXREG(SISPART2, 0x35, (sis_TV_filter[filter_tb].filter[filter][0]));
+ outSISIDXREG(SISPART2, 0x36, (sis_TV_filter[filter_tb].filter[filter][1]));
+ outSISIDXREG(SISPART2, 0x37, (sis_TV_filter[filter_tb].filter[filter][2]));
+ outSISIDXREG(SISPART2, 0x38, (sis_TV_filter[filter_tb].filter[filter][3]));
}
- default:
- return -EINVAL;
- }
- return 0;
-
-}
-
-static int sisfb_mmap(struct fb_info *info, struct file *file,
- struct vm_area_struct *vma)
-{
- struct fb_var_screeninfo var;
- unsigned long start;
- unsigned long off;
- u32 len;
-
- if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT))
- return -EINVAL;
- off = vma->vm_pgoff << PAGE_SHIFT;
-
- start = (unsigned long) ivideo.video_base;
- len = PAGE_ALIGN((start & ~PAGE_MASK) + ivideo.video_size);
-
- if (off >= len) {
- off -= len;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,23)
- sisfb_get_var(&var, info->currcon, info);
-#else
- sisfb_get_var(&var, currcon, info);
-#endif
- if (var.accel_flags)
- return -EINVAL;
- start = (unsigned long) ivideo.mmio_base;
- len = PAGE_ALIGN((start & ~PAGE_MASK) + sisfb_mmio_size);
- }
-
- start &= PAGE_MASK;
- if ((vma->vm_end - vma->vm_start + off) > len)
- return -EINVAL;
- off += start;
- vma->vm_pgoff = off >> PAGE_SHIFT;
-
-#if defined(__i386__) || defined(__x86_64__)
- if (boot_cpu_data.x86 > 3)
- pgprot_val(vma->vm_page_prot) |= _PAGE_PCD;
-#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- if (io_remap_page_range(vma->vm_start, off, vma->vm_end - vma->vm_start,
- vma->vm_page_prot))
-#else /* TW: 2.5 API */
- if (io_remap_page_range(vma, vma->vm_start, off, vma->vm_end - vma->vm_start,
- vma->vm_page_prot))
-#endif
- return -EAGAIN;
- return 0;
-
-}
-static struct fb_ops sisfb_ops = {
- .owner = THIS_MODULE,
- .fb_get_fix = sisfb_get_fix,
- .fb_get_var = sisfb_get_var,
- .fb_set_var = sisfb_set_var,
- .fb_get_cmap = sisfb_get_cmap,
- .fb_set_cmap = sisfb_set_cmap,
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,23)
- .fb_setcolreg = sisfb_setcolreg,
- .fb_blank = sisfb_blank,
-#endif
- .fb_ioctl = sisfb_ioctl,
- .fb_mmap = sisfb_mmap,
-};
-
-/* ------------ Interface to the low level console driver -------------*/
-
-static int sisfb_update_var(int con, struct fb_info *info)
-{
- return 0;
-}
-
-static int sisfb_switch(int con, struct fb_info *info)
-{
- int cols, rows;
-
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,23)
- if (fb_display[info->currcon].cmap.len)
- fb_get_cmap(&fb_display[info->currcon].cmap, 1, sis_getcolreg, info);
-#else
- if (fb_display[currcon].cmap.len)
- fb_get_cmap(&fb_display[currcon].cmap, 1, sis_getcolreg, info);
-#endif
-
- fb_display[con].var.activate = FB_ACTIVATE_NOW;
-
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,23)
- if (!memcmp(&fb_display[con].var, &fb_display[info->currcon].var,
- sizeof(struct fb_var_screeninfo))) {
- info->currcon = con;
- return 1;
- }
-
- info->currcon = con;
-#else
- if (!memcmp(&fb_display[con].var, &fb_display[currcon].var,
- sizeof(struct fb_var_screeninfo))) {
- currcon = con;
- return 1;
+ }
+
}
- currcon = con;
-#endif
-
- sisfb_do_set_var(&fb_display[con].var, 1, info);
-
- sisfb_set_disp(con, &fb_display[con].var);
-
- sisfb_do_install_cmap(con, info);
-
- cols = sisbios_mode[sisfb_mode_idx].cols;
- rows = sisbios_mode[sisfb_mode_idx].rows;
- vc_resize_con(rows, cols, fb_display[con].conp->vc_num);
-
- sisfb_update_var(con, info);
-
- return 1;
-}
-
-static void sisfb_blank(int blank, struct fb_info *info)
-{
- u8 reg;
-
- vgawb(CRTC_ADR, 0x17);
- reg = vgarb(CRTC_DATA);
-
- if (blank > 0)
- reg &= 0x7f;
- else
- reg |= 0x80;
-
- vgawb(CRTC_ADR, 0x17);
- vgawb(CRTC_DATA, reg);
}
+#ifndef MODULE
int sisfb_setup(char *options)
{
char *this_opt;
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+ sis_fb_info.fontname[0] = '\0';
+#endif
- fb_info.fontname[0] = '\0';
ivideo.refresh_rate = 0;
+ printk(KERN_INFO "sisfb: Options %s\n", options);
+
if (!options || !*options)
return 0;
while((this_opt = strsep(&options, ",")) != NULL) {
- if (!*this_opt)
- continue;
- if (!strcmp(this_opt, "inverse")) {
+ if (!*this_opt) continue;
+
+ if (!strncmp(this_opt, "mode:", 5)) {
+ sisfb_search_mode(this_opt + 5);
+ } else if (!strncmp(this_opt, "vesa:", 5)) {
+ sisfb_search_vesamode(simple_strtoul(this_opt + 5, NULL, 0));
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+ } else if (!strcmp(this_opt, "inverse")) {
sisfb_inverse = 1;
- fb_invert_cmaps();
+ /* fb_invert_cmaps(); */
} else if (!strncmp(this_opt, "font:", 5)) {
- strcpy(fb_info.fontname, this_opt + 5);
+ strcpy(sis_fb_info.fontname, this_opt + 5);
+#endif
} else if (!strncmp(this_opt, "mode:", 5)) {
sisfb_search_mode(this_opt + 5);
+ } else if (!strncmp(this_opt, "vesa:", 5)) {
+ sisfb_search_vesamode(simple_strtoul(this_opt + 5, NULL, 0));
} else if (!strncmp(this_opt, "vrate:", 6)) {
- ivideo.refresh_rate =
- simple_strtoul(this_opt + 6, NULL, 0);
+ ivideo.refresh_rate = simple_strtoul(this_opt + 6, NULL, 0);
} else if (!strncmp(this_opt, "rate:", 5)) {
- ivideo.refresh_rate =
- simple_strtoul(this_opt + 5, NULL, 0);
+ ivideo.refresh_rate = simple_strtoul(this_opt + 5, NULL, 0);
} else if (!strncmp(this_opt, "off", 3)) {
sisfb_off = 1;
} else if (!strncmp(this_opt, "crt1off", 7)) {
@@ -2681,16 +3551,15 @@ int sisfb_setup(char *options)
} else if (!strncmp(this_opt, "forcecrt1:", 10)) {
sisfb_forcecrt1 = (int)simple_strtoul(this_opt + 10, NULL, 0);
} else if (!strncmp(this_opt, "tvmode:",7)) {
- if (!strncmp(this_opt + 7, "pal",3))
- sisfb_tvmode = 1;
- if (!strncmp(this_opt + 7, "ntsc",4))
- sisfb_tvmode = 2;
+ sisfb_search_tvstd(this_opt + 7);
+ } else if (!strncmp(this_opt, "tvstandard:",11)) {
+ sisfb_search_tvstd(this_opt + 7);
} else if (!strncmp(this_opt, "mem:",4)) {
sisfb_mem = simple_strtoul(this_opt + 4, NULL, 0);
- } else if (!strncmp(this_opt, "dstn:", 5)) {
- enable_dstn = simple_strtoul(this_opt + 5, NULL, 0);
+ } else if (!strncmp(this_opt, "dstn", 4)) {
+ enable_dstn = 1;
/* TW: DSTN overrules forcecrt2type */
- if (enable_dstn) sisfb_crt2type = DISPTYPE_LCD;
+ sisfb_crt2type = DISPTYPE_LCD;
} else if (!strncmp(this_opt, "queuemode:", 10)) {
sisfb_search_queuemode(this_opt + 10);
} else if (!strncmp(this_opt, "pdc:", 4)) {
@@ -2699,25 +3568,120 @@ int sisfb_setup(char *options)
printk(KERN_INFO "sisfb: Illegal pdc parameter\n");
sisfb_pdc = 0;
}
+ } else if (!strncmp(this_opt, "noaccel", 7)) {
+ sisfb_accel = 0;
+ } else if (!strncmp(this_opt, "noypan", 6)) {
+ sisfb_ypan = 0;
+ } else if (!strncmp(this_opt, "userom:", 7)) {
+ sisfb_userom = (int)simple_strtoul(this_opt + 7, NULL, 0);
+ } else if (!strncmp(this_opt, "useoem:", 7)) {
+ sisfb_useoem = (int)simple_strtoul(this_opt + 7, NULL, 0);
} else {
- printk(KERN_INFO "sisfb: Invalid parameter %s\n", this_opt);
+ printk(KERN_INFO "sisfb: Invalid option %s\n", this_opt);
+ }
+
+ /* TW: Acceleration only with MMIO mode */
+ if((sisfb_queuemode != -1) && (sisfb_queuemode != MMIO_CMD)) {
+ sisfb_ypan = 0;
+ sisfb_accel = 0;
}
+ /* TW: Panning only with acceleration */
+ if(sisfb_accel == 0) sisfb_ypan = 0;
+
}
return 0;
}
+#endif
+
+static char *sis_find_rom(void)
+{
+#if defined(__i386__)
+ u32 segstart;
+ unsigned char *rom_base;
+ unsigned char *rom;
+ int stage;
+ int i;
+ char sis_rom_sig[] = "Silicon Integrated Systems";
+ char *sis_sig_300[4] = {
+ "300", "540", "630", "730"
+ };
+ char *sis_sig_310[7] = {
+ "315", "315", "315", "5315", "6325", "6325", "Xabre"
+ };
+ ushort sis_nums_300[4] = {
+ SIS_300, SIS_540, SIS_630, SIS_730
+ };
+ unsigned short sis_nums_310[7] = {
+ SIS_315PRO, SIS_315H, SIS_315, SIS_550, SIS_650, SIS_740, SIS_330
+ };
+
+ for(segstart=0x000c0000; segstart<0x000f0000; segstart+=0x00001000) {
+
+ stage = 1;
+
+ rom_base = (char *)ioremap(segstart, 0x1000);
+
+ if ((*rom_base == 0x55) && (((*(rom_base + 1)) & 0xff) == 0xaa))
+ stage = 2;
+
+ if (stage != 2) {
+ iounmap(rom_base);
+ continue;
+ }
+
+
+ rom = rom_base + (unsigned short)(*(rom_base + 0x12) | (*(rom_base + 0x13) << 8));
+ if(strncmp(sis_rom_sig, rom, strlen(sis_rom_sig)) == 0) {
+ stage = 3;
+ }
+ if(stage != 3) {
+ iounmap(rom_base);
+ continue;
+ }
+
+ rom = rom_base + (unsigned short)(*(rom_base + 0x14) | (*(rom_base + 0x15) << 8));
+ for(i = 0;(i < 4) && (stage != 4); i++) {
+ if(strncmp(sis_sig_300[i], rom, strlen(sis_sig_300[i])) == 0) {
+ if(sis_nums_300[i] == ivideo.chip) {
+ stage = 4;
+ break;
+ }
+ }
+ }
+ if(stage != 4) {
+ for(i = 0;(i < 7) && (stage != 4); i++) {
+ if(strncmp(sis_sig_310[i], rom, strlen(sis_sig_310[i])) == 0) {
+ if(sis_nums_310[i] == ivideo.chip) {
+ stage = 4;
+ break;
+ }
+ }
+ }
+ }
+
+ if(stage != 4) {
+ iounmap(rom_base);
+ continue;
+ }
+
+ return rom_base;
+ }
+#endif
+ return NULL;
+}
+
+
int __init sisfb_init(void)
{
struct pci_dev *pdev = NULL;
struct board *b;
int pdev_valid = 0;
- //unsigned long rom_vbase;
u32 reg32;
u16 reg16;
- u8 reg;
- int temp1, temp2;
+ u8 reg, reg1;
- outb(0x77, 0x80);
+ /* outb(0x77, 0x80); */ /* What is this? */
#if 0
/* for DOC VB */
@@ -2732,20 +3696,37 @@ int __init sisfb_init(void)
return -ENXIO;
if (enable_dstn)
- SetEnableDstn();
+ SiS_SetEnableDstn(&SiS_Pr);
+
+ sisfb_registered = 0;
+
+ memset(&sis_fb_info, 0, sizeof(sis_fb_info));
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+ memset(&sis_disp, 0, sizeof(sis_disp));
+#endif
pci_for_each_dev(pdev) {
for (b = sisdev_list; b->vendor; b++) {
if ((b->vendor == pdev->vendor)
&& (b->device == pdev->device)) {
pdev_valid = 1;
- strcpy(fb_info.modename, b->name);
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,0)
+ strcpy(sis_fb_info.modename, b->name);
+#else
+ strcpy(myid, b->name);
+#endif
ivideo.chip_id = pdev->device;
pci_read_config_byte(pdev, PCI_REVISION_ID,
&ivideo.revision_id);
pci_read_config_word(pdev, PCI_COMMAND, &reg16);
sishw_ext.jChipRevision = ivideo.revision_id;
- sisvga_enabled = reg16 & 0x1;
+ sisvga_enabled = reg16 & 0x01;
+ ivideo.pcibus = pdev->bus->number;
+ ivideo.pcislot = PCI_SLOT(pdev->devfn);
+ ivideo.pcifunc = PCI_FUNC(pdev->devfn);
+ ivideo.subsysvendor = pdev->subsystem_vendor;
+ ivideo.subsysdevice = pdev->subsystem_device;
break;
}
}
@@ -2755,157 +3736,180 @@ int __init sisfb_init(void)
}
if (!pdev_valid)
- return -1;
+ return -ENODEV;
-// Eden Chen
switch (ivideo.chip_id) {
+#ifdef CONFIG_FB_SIS_300
case PCI_DEVICE_ID_SI_300:
ivideo.chip = SIS_300;
sisvga_engine = SIS_300_VGA;
- sisfb_hwcursor_size = HW_CURSOR_AREA_SIZE_300;
+ sisfb_hwcursor_size = HW_CURSOR_AREA_SIZE_300 * 2; /* New X driver uses 2 buffers */
sisfb_CRT2_write_enable = IND_SIS_CRT2_WRITE_ENABLE_300;
break;
case PCI_DEVICE_ID_SI_630_VGA:
{
sisfb_set_reg4(0xCF8, 0x80000000);
reg32 = sisfb_get_reg3(0xCFC);
- if (reg32 == 0x07301039) {
+ if(reg32 == 0x07301039) {
ivideo.chip = SIS_730;
- strcpy(fb_info.modename, "SIS 730");
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,0)
+ strcpy(sis_fb_info.modename, "SIS 730");
+#else
+ strcpy(myid, "SIS 730");
+#endif
} else
ivideo.chip = SIS_630;
sisvga_engine = SIS_300_VGA;
- sisfb_hwcursor_size = HW_CURSOR_AREA_SIZE_300;
+ sisfb_hwcursor_size = HW_CURSOR_AREA_SIZE_300 * 2;
sisfb_CRT2_write_enable = IND_SIS_CRT2_WRITE_ENABLE_300;
break;
}
case PCI_DEVICE_ID_SI_540_VGA:
ivideo.chip = SIS_540;
sisvga_engine = SIS_300_VGA;
- sisfb_hwcursor_size = HW_CURSOR_AREA_SIZE_300;
+ sisfb_hwcursor_size = HW_CURSOR_AREA_SIZE_300 * 2;
sisfb_CRT2_write_enable = IND_SIS_CRT2_WRITE_ENABLE_300;
break;
+#endif
+#ifdef CONFIG_FB_SIS_315
case PCI_DEVICE_ID_SI_315H:
ivideo.chip = SIS_315H;
sisvga_engine = SIS_315_VGA;
- sisfb_hwcursor_size = HW_CURSOR_AREA_SIZE_315;
+ sisfb_hwcursor_size = HW_CURSOR_AREA_SIZE_315 * 2;
sisfb_CRT2_write_enable = IND_SIS_CRT2_WRITE_ENABLE_315;
break;
case PCI_DEVICE_ID_SI_315:
ivideo.chip = SIS_315;
sisvga_engine = SIS_315_VGA;
- sisfb_hwcursor_size = HW_CURSOR_AREA_SIZE_315;
+ sisfb_hwcursor_size = HW_CURSOR_AREA_SIZE_315 * 2;
sisfb_CRT2_write_enable = IND_SIS_CRT2_WRITE_ENABLE_315;
break;
case PCI_DEVICE_ID_SI_315PRO:
ivideo.chip = SIS_315PRO;
sisvga_engine = SIS_315_VGA;
- sisfb_hwcursor_size = HW_CURSOR_AREA_SIZE_315;
+ sisfb_hwcursor_size = HW_CURSOR_AREA_SIZE_315 * 2;
sisfb_CRT2_write_enable = IND_SIS_CRT2_WRITE_ENABLE_315;
break;
case PCI_DEVICE_ID_SI_550_VGA:
ivideo.chip = SIS_550;
sisvga_engine = SIS_315_VGA;
- sisfb_hwcursor_size = HW_CURSOR_AREA_SIZE_315;
+ sisfb_hwcursor_size = HW_CURSOR_AREA_SIZE_315 * 2;
sisfb_CRT2_write_enable = IND_SIS_CRT2_WRITE_ENABLE_315;
break;
case PCI_DEVICE_ID_SI_650_VGA:
- ivideo.chip = SIS_650;
+ {
+ ivideo.chip = SIS_650;
+ sisfb_set_reg4(0xCF8, 0x80000000);
+ reg32 = sisfb_get_reg3(0xCFC);
+ if(reg32 == 0x07401039) {
+ ivideo.chip = SIS_740;
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,0)
+ strcpy(sis_fb_info.modename, "SIS 740");
+#else
+ strcpy(myid, "SIS 740");
+#endif
+ }
+ sisvga_engine = SIS_315_VGA;
+ sisfb_hwcursor_size = HW_CURSOR_AREA_SIZE_315 * 2;
+ sisfb_CRT2_write_enable = IND_SIS_CRT2_WRITE_ENABLE_315;
+ break;
+ }
+ case PCI_DEVICE_ID_SI_330:
+ ivideo.chip = SIS_330;
sisvga_engine = SIS_315_VGA;
- sisfb_hwcursor_size = HW_CURSOR_AREA_SIZE_315;
+ sisfb_hwcursor_size = HW_CURSOR_AREA_SIZE_315 * 2;
sisfb_CRT2_write_enable = IND_SIS_CRT2_WRITE_ENABLE_315;
break;
+#endif
+ default:
+ return -ENODEV;
}
sishw_ext.jChipType = ivideo.chip;
- // for Debug
- if ((sishw_ext.jChipType == SIS_315PRO)
- || (sishw_ext.jChipType == SIS_315) )
- sishw_ext.jChipType = SIS_315H;
- DPRINTK("%s is used as %s device(VGA Engine %d).\n",
- fb_info.modename, sisvga_enabled ? "primary" : "secondary", sisvga_engine);
+ /* for Debug */
+ if( (sishw_ext.jChipType == SIS_315PRO) ||
+ (sishw_ext.jChipType == SIS_315) )
+ sishw_ext.jChipType = SIS_315H;
ivideo.video_base = pci_resource_start(pdev, 0);
ivideo.mmio_base = pci_resource_start(pdev, 1);
sishw_ext.ulIOAddress = (unsigned short) ivideo.vga_base =
- pci_resource_start(pdev, 2) + 0x30;
+ (unsigned short) SiS_Pr.RelIO = pci_resource_start(pdev, 2) + 0x30;
sisfb_mmio_size = pci_resource_len(pdev, 1);
- if (!sisvga_enabled)
+ if(!sisvga_enabled) {
if (pci_enable_device(pdev)) return -EIO;
+ }
+
+ SiS_Pr.SiS_Backup70xx = 0xff;
+ SiS_Pr.SiS_CHOverScan = -1;
+ SiS_Pr.SiS_ChSW = FALSE;
+ SiS_Pr.SiS_UseLCDA = FALSE;
+ SiS_Pr.UsePanelScaler = -1;
+ SiSRegInit(&SiS_Pr, (USHORT)sishw_ext.ulIOAddress);
-// Eden Eden
-//#ifdef LINUXBIOS
-// sishw_ext.VirtualRomBase = rom_vbase = (unsigned long) rom_data;
-//#else
-// {
-// unsigned long rom_base = 0x000C0000;
-//
-// request_region(rom_base, 32, "sisfb");
-// sishw_ext.VirtualRomBase = rom_vbase
-// = (unsigned long) ioremap(rom_base, MAX_ROM_SCAN);
-// }
-//#endif
-// ~Eden Chen
+#ifdef CONFIG_FB_SIS_300
+ /* TW: Find PCI systems for Chrontel/ISA bridge manipulation */
+ if(ivideo.chip == SIS_630) {
+ int i=0;
+ do {
+ if(mychswtable[i].subsysVendor == ivideo.subsysvendor &&
+ mychswtable[i].subsysCard == ivideo.subsysdevice) {
+ SiS_Pr.SiS_ChSW = TRUE;
+ }
+ i++;
+ } while(mychswtable[i].subsysVendor != 0);
+ }
+#endif
+
+ outSISIDXREG(SISSR, IND_SIS_PASSWORD, SIS_PASSWORD);
- vgawb(SEQ_ADR, IND_SIS_PASSWORD);
- vgawb(SEQ_DATA, SIS_PASSWORD);
+#ifdef MODULE
+ inSISIDXREG(SISCR,0x34,reg);
+ if(reg & 0x80) {
+ if((sisbios_mode[sisfb_mode_idx].mode_no) != 0xFF) {
+ printk(KERN_INFO "sisfb: Cannot initialize display mode, X server is active\n");
+ return -EBUSY;
+ }
+ }
+#endif
- /* TW: Debug kernel 2.5 problem */
- vgawb(SEQ_ADR, 0x14);
- reg = vgarb(SEQ_DATA);
- printk("sisfb: SR14 = 0x%02x\n", reg);
- /* /TW */
+#ifdef LINUXBIOS /* -------------------------------- */
-#ifdef LINUXBIOS
#ifdef CONFIG_FB_SIS_300
if (sisvga_engine == SIS_300_VGA) {
- vgawb(SEQ_ADR, 0x28);
- vgawb(SEQ_DATA, 0x37);
+ outSISIDXREG(SISSR, 0x28, 0x37);
- vgawb(SEQ_ADR, 0x29);
- vgawb(SEQ_DATA, 0x61);
+ outSISIDXREG(SISSR, 0x29, 0x61);
- vgawb(SEQ_ADR, IND_SIS_SCRATCH_REG_1A);
- reg = vgarb(SEQ_DATA);
- reg |= SIS_SCRATCH_REG_1A_MASK;
- vgawb(SEQ_DATA, reg);
+ orSISIDXREG(SISSR, IND_SIS_SCRATCH_REG_1A, SIS_SCRATCH_REG_1A_MASK);
}
#endif
#ifdef CONFIG_FB_SIS_315
- if (ivideo.chip == SIS_550 || ivideo.chip == SIS_650) {
- vgawb(SEQ_ADR, 0x28);
- vgawb(SEQ_DATA, 0x5A);
+ if (ivideo.chip == SIS_550 || ivideo.chip == SIS_650 || ivideo.chip == SIS_740) {
+ outSISIDXREG(SISSR, 0x28, 0x5a);
- vgawb(SEQ_ADR, 0x29);
- vgawb(SEQ_DATA, 0x64);
+ outSISIDXREG(SISSR, 0x29, 0x64);
- vgawb(CRTC_ADR, 0x3A);
- vgawb(CRTC_DATA, 0x00);
+ outSISIDXREG(SISCR, 0x3a, 0x00);
}
-#endif
-#endif /* LinuxBIOS */
+#endif
+
+#endif /* LinuxBIOS -------------------------------- */
if (sisvga_engine == SIS_315_VGA) {
switch (ivideo.chip) {
case SIS_315H:
case SIS_315:
+ case SIS_330:
sishw_ext.bIntegratedMMEnabled = TRUE;
break;
case SIS_550:
case SIS_650:
- // Eden Chen
- //vgawb(SEQ_ADR, IND_SIS_SCRATCH_REG_1A);
- //reg = vgarb(SEQ_DATA);
- //if (reg & SIS_SCRATCH_REG_1A_MASK)
- // sishw_ext.bIntegratedMMEnabled = TRUE;
- //else
- // sishw_ext.bIntegratedMMEnabled = FALSE;
- //for Debug
+ case SIS_740:
sishw_ext.bIntegratedMMEnabled = TRUE;
- // ~Eden Chen
break;
default:
break;
@@ -2914,8 +3918,7 @@ int __init sisfb_init(void)
if (ivideo.chip == SIS_300) {
sishw_ext.bIntegratedMMEnabled = TRUE;
} else {
- vgawb(SEQ_ADR, IND_SIS_SCRATCH_REG_1A);
- reg = vgarb(SEQ_DATA);
+ inSISIDXREG(SISSR, IND_SIS_SCRATCH_REG_1A, reg);
if (reg & SIS_SCRATCH_REG_1A_MASK)
sishw_ext.bIntegratedMMEnabled = TRUE;
else
@@ -2924,7 +3927,21 @@ int __init sisfb_init(void)
}
sishw_ext.pDevice = NULL;
- sishw_ext.pjVirtualRomBase = NULL;
+ if(sisfb_userom) {
+ sishw_ext.pjVirtualRomBase = sis_find_rom();
+ if(sishw_ext.pjVirtualRomBase) {
+ printk(KERN_INFO "sisfb: Video ROM found and mapped to %p\n",
+ sishw_ext.pjVirtualRomBase);
+ sishw_ext.UseROM = TRUE;
+ } else {
+ sishw_ext.UseROM = FALSE;
+ printk(KERN_INFO "sisfb: Video ROM not found\n");
+ }
+ } else {
+ sishw_ext.pjVirtualRomBase = NULL;
+ sishw_ext.UseROM = FALSE;
+ printk(KERN_INFO "sisfb: Video ROM usage disabled\n");
+ }
sishw_ext.pjCustomizedROMImage = NULL;
sishw_ext.bSkipDramSizing = 0;
sishw_ext.pQueryVGAConfigSpace = &sisfb_query_VGA_config_space;
@@ -2941,48 +3958,49 @@ int __init sisfb_init(void)
sishw_ext.pSR = vmalloc(sizeof(SIS_DSReg) * SR_BUFFER_SIZE);
if (sishw_ext.pSR == NULL) {
- printk(KERN_INFO "sisfb: Fatal error: Allocating SRReg space failed.\n");
+ printk(KERN_ERR "sisfb: Fatal error: Allocating SRReg space failed.\n");
return -ENODEV;
}
sishw_ext.pSR[0].jIdx = sishw_ext.pSR[0].jVal = 0xFF;
sishw_ext.pCR = vmalloc(sizeof(SIS_DSReg) * CR_BUFFER_SIZE);
if (sishw_ext.pCR == NULL) {
- printk(KERN_INFO "sisfb: Fatal error: Allocating CRReg space failed.\n");
+ vfree(sishw_ext.pSR);
+ printk(KERN_ERR "sisfb: Fatal error: Allocating CRReg space failed.\n");
return -ENODEV;
}
sishw_ext.pCR[0].jIdx = sishw_ext.pCR[0].jVal = 0xFF;
#ifdef CONFIG_FB_SIS_300
- if (sisvga_engine == SIS_300_VGA) {
- if (!sisvga_enabled) {
+ if(sisvga_engine == SIS_300_VGA) {
+ if(!sisvga_enabled) {
+ /* Mapping Max FB Size for 300 Init */
sishw_ext.pjVideoMemoryAddress
- = ioremap(ivideo.video_base, 0x2000000);
- if ((sisbios_mode[sisfb_mode_idx].mode_no) != 0xFF) { /* TW: for mode "none" */
- SiSInit(&sishw_ext);
- vgawb(SEQ_ADR, IND_SIS_PASSWORD);
- vgawb(SEQ_DATA, SIS_PASSWORD);
+ = ioremap(ivideo.video_base, 0x4000000);
+ if((sisfb_mode_idx < 0) || ((sisbios_mode[sisfb_mode_idx].mode_no) != 0xFF)) {
+#ifdef LINUXBIOS /* TW: SiSInit now for LinuxBIOS only */
+ SiSInit(&SiS_Pr, &sishw_ext);
+#endif
+ outSISIDXREG(SISSR, IND_SIS_PASSWORD, SIS_PASSWORD);
}
}
#ifdef LINUXBIOS
else {
sishw_ext.pjVideoMemoryAddress
- = ioremap(ivideo.video_base, 0x2000000);
- if ((sisbios_mode[sisfb_mode_idx].mode_no) != 0xFF) { /* TW: for mode "none" */
- SiSInit(&sishw_ext);
- vgawb(SEQ_ADR, IND_SIS_PASSWORD);
- vgawb(SEQ_DATA, SIS_PASSWORD);
+ = ioremap(ivideo.video_base, 0x4000000);
+ if((sisfb_mode_idx < 0) || ((sisbios_mode[sisfb_mode_idx].mode_no) != 0xFF)) {
+ SiSInit(&SiS_Pr, &sishw_ext);
+ outSISIDXREG(SISSR, IND_SIS_PASSWORD, SIS_PASSWORD);
}
}
- if ((sisbios_mode[sisfb_mode_idx].mode_no) != 0xFF) { /* TW: for mode "none" */
- vgawb(SEQ_ADR, 0x7);
- reg = vgarb(SEQ_DATA);
- reg |= 0x10;
- vgawb(SEQ_DATA, reg);
+ if((sisfb_mode_idx < 0) || ((sisbios_mode[sisfb_mode_idx].mode_no) != 0xFF)) {
+ orSISIDXREG(SISSR, 0x07, 0x10);
}
#endif
- if (sisfb_get_dram_size_300()) {
- printk(KERN_INFO "sisfb: Fatal error: Unable to determine RAM size\n");
+ if(sisfb_get_dram_size_300()) {
+ vfree(sishw_ext.pSR);
+ vfree(sishw_ext.pCR);
+ printk(KERN_ERR "sisfb: Fatal error: Unable to determine RAM size\n");
return -ENODEV;
}
}
@@ -2992,24 +4010,22 @@ int __init sisfb_init(void)
if (sisvga_engine == SIS_315_VGA) {
if (!sisvga_enabled) {
/* Mapping Max FB Size for 315 Init */
- // Eden Chen
- //sishw_ext.VirtualVideoMemoryAddress
sishw_ext.pjVideoMemoryAddress
= ioremap(ivideo.video_base, 0x8000000);
- if ((sisbios_mode[sisfb_mode_idx].mode_no) != 0xFF) { /* TW: for mode "none" */
- SiSInit(&sishw_ext);
+ if((sisfb_mode_idx < 0) || ((sisbios_mode[sisfb_mode_idx].mode_no) != 0xFF)) {
+#ifdef LINUXBIOS
+ /* TW: SISInit is now for LINUXBIOS only */
+ SiSInit(&SiS_Pr, &sishw_ext);
+#endif
- vgawb(SEQ_ADR, IND_SIS_PASSWORD);
- vgawb(SEQ_DATA, SIS_PASSWORD);
+ outSISIDXREG(SISSR, IND_SIS_PASSWORD, SIS_PASSWORD);
sishw_ext.bSkipDramSizing = TRUE;
- vgawb(SEQ_ADR, 0x13);
sishw_ext.pSR[0].jIdx = 0x13;
- sishw_ext.pSR[0].jVal = vgarb(SEQ_DATA);
- vgawb(SEQ_ADR, 0x14);
sishw_ext.pSR[1].jIdx = 0x14;
- sishw_ext.pSR[1].jVal = vgarb(SEQ_DATA);
sishw_ext.pSR[2].jIdx = 0xFF;
+ inSISIDXREG(SISSR, 0x13, sishw_ext.pSR[0].jVal);
+ inSISIDXREG(SISSR, 0x14, sishw_ext.pSR[1].jVal);
sishw_ext.pSR[2].jVal = 0xFF;
}
}
@@ -3017,41 +4033,38 @@ int __init sisfb_init(void)
else {
sishw_ext.pjVideoMemoryAddress
= ioremap(ivideo.video_base, 0x8000000);
- if ((sisbios_mode[sisfb_mode_idx].mode_no) != 0xFF) { /* TW: for mode "none" */
- SiSInit(&sishw_ext);
- vgawb(SEQ_ADR, IND_SIS_PASSWORD);
- vgawb(SEQ_DATA, SIS_PASSWORD);
+ if((sisfb_mode_idx < 0) || ((sisbios_mode[sisfb_mode_idx].mode_no) != 0xFF)) {
+
+ SiSInit(&SiS_Pr, &sishw_ext);
+
+ outSISIDXREG(SISSR, IND_SIS_PASSWORD, SIS_PASSWORD);
sishw_ext.bSkipDramSizing = TRUE;
- vgawb(SEQ_ADR, 0x13);
sishw_ext.pSR[0].jIdx = 0x13;
- sishw_ext.pSR[0].jVal = vgarb(SEQ_DATA);
- vgawb(SEQ_ADR, 0x14);
sishw_ext.pSR[1].jIdx = 0x14;
- sishw_ext.pSR[1].jVal = vgarb(SEQ_DATA);
sishw_ext.pSR[2].jIdx = 0xFF;
+ inSISIDXREG(SISSR, 0x13, sishw_ext.pSR[0].jVal);
+ inSISIDXREG(SISSR, 0x14, sishw_ext.pSR[1].jVal);
sishw_ext.pSR[2].jVal = 0xFF;
}
}
#endif
if (sisfb_get_dram_size_315()) {
+ vfree(sishw_ext.pSR);
+ vfree(sishw_ext.pCR);
printk(KERN_INFO "sisfb: Fatal error: Unable to determine RAM size.\n");
return -ENODEV;
}
}
#endif
- if ((sisbios_mode[sisfb_mode_idx].mode_no) != 0xFF) { /* TW: for mode "none" */
- vgawb(SEQ_ADR, IND_SIS_PCI_ADDRESS_SET);
- reg = vgarb(SEQ_DATA);
- reg |= SIS_PCI_ADDR_ENABLE; /* Enable PCI_LINEAR_ADDRESSING */
- reg |= SIS_MEM_MAP_IO_ENABLE; /* Enable MMIO_ENABLE */
- vgawb(SEQ_DATA, reg);
+ if((sisfb_mode_idx < 0) || ((sisbios_mode[sisfb_mode_idx].mode_no) != 0xFF)) {
- vgawb(SEQ_ADR, IND_SIS_MODULE_ENABLE);
- reg = vgarb(SEQ_DATA);
- reg |= SIS_ENABLE_2D; /* Enable 2D accelerator engine */
- vgawb(SEQ_DATA, reg);
+ /* Enable PCI_LINEAR_ADDRESSING and MMIO_ENABLE */
+ orSISIDXREG(SISSR, IND_SIS_PCI_ADDRESS_SET, (SIS_PCI_ADDR_ENABLE | SIS_MEM_MAP_IO_ENABLE));
+
+ /* Enable 2D accelerator engine */
+ orSISIDXREG(SISSR, IND_SIS_MODULE_ENABLE, SIS_ENABLE_2D);
}
@@ -3066,86 +4079,95 @@ int __init sisfb_init(void)
if (!request_mem_region(ivideo.video_base, ivideo.video_size, "sisfb FB")) {
printk(KERN_ERR "sisfb: Fatal error: Unable to reserve frame buffer memory\n");
printk(KERN_ERR "sisfb: Is there another framebuffer driver active?\n");
+ vfree(sishw_ext.pSR);
+ vfree(sishw_ext.pCR);
return -ENODEV;
}
if (!request_mem_region(ivideo.mmio_base, sisfb_mmio_size, "sisfb MMIO")) {
printk(KERN_ERR "sisfb: Fatal error: Unable to reserve MMIO region\n");
release_mem_region(ivideo.video_base, ivideo.video_size);
+ vfree(sishw_ext.pSR);
+ vfree(sishw_ext.pCR);
return -ENODEV;
}
- sishw_ext.pjVideoMemoryAddress = ivideo.video_vbase
- = ioremap(ivideo.video_base, ivideo.video_size);
+ ivideo.video_vbase = sishw_ext.pjVideoMemoryAddress =
+ ioremap(ivideo.video_base, ivideo.video_size);
ivideo.mmio_vbase = ioremap(ivideo.mmio_base, sisfb_mmio_size);
- printk(KERN_INFO
- "sisfb: Framebuffer at 0x%lx, mapped to 0x%p, size %dk\n",
+ printk(KERN_INFO "sisfb: Framebuffer at 0x%lx, mapped to 0x%p, size %dk\n",
ivideo.video_base, ivideo.video_vbase,
ivideo.video_size / 1024);
- printk(KERN_INFO
- "sisfb: MMIO at 0x%lx, mapped to 0x%p, size %ldk\n",
+ printk(KERN_INFO "sisfb: MMIO at 0x%lx, mapped to 0x%p, size %ldk\n",
ivideo.mmio_base, ivideo.mmio_vbase,
sisfb_mmio_size / 1024);
- if ((sisbios_mode[sisfb_mode_idx].mode_no) != 0xFF) { /* TW: for mode "none" */
+ if(sisfb_heap_init()) {
+ printk(KERN_WARNING "sisfb: Failed to initialize offscreen memory heap\n");
+ }
+
+ ivideo.mtrr = (unsigned int) 0;
+
+ if((sisfb_mode_idx < 0) || ((sisbios_mode[sisfb_mode_idx].mode_no) != 0xFF)) {
#ifdef CONFIG_FB_SIS_300
if (sisvga_engine == SIS_300_VGA) {
sisfb_get_VB_type_300();
- if (ivideo.hasVB != HASVB_NONE) {
- sisfb_detect_VB_connect_300();
- }
}
#endif
#ifdef CONFIG_FB_SIS_315
if (sisvga_engine == SIS_315_VGA) {
sisfb_get_VB_type_315();
- if (ivideo.hasVB != HASVB_NONE) {
- sisfb_detect_VB_connect_315();
- }
}
#endif
sishw_ext.ujVBChipID = VB_CHIP_UNKNOWN;
+ sishw_ext.Is301BDH = FALSE;
sishw_ext.usExternalChip = 0;
switch (ivideo.hasVB) {
case HASVB_301:
- vgawb(VB_PART4_ADR,0x01);
- reg = vgarb(VB_PART4_DATA);
- if (reg >= 0xD0) {
+ inSISIDXREG(SISPART4, 0x01, reg);
+ if (reg >= 0xE0) {
+ sishw_ext.ujVBChipID = VB_CHIP_302LV;
+ printk(KERN_INFO "sisfb: SiS302LV bridge detected (revision 0x%02x)\n",reg);
+ } else if (reg >= 0xD0) {
sishw_ext.ujVBChipID = VB_CHIP_301LV;
printk(KERN_INFO "sisfb: SiS301LV bridge detected (revision 0x%02x)\n",reg);
} else if (reg >= 0xB0) {
sishw_ext.ujVBChipID = VB_CHIP_301B;
- printk(KERN_INFO "sisfb: SiS301B bridge detected (revision 0x%02x\n",reg);
+ inSISIDXREG(SISPART4,0x23,reg1);
+ if(!(reg1 & 0x02)) sishw_ext.Is301BDH = TRUE;
+ printk(KERN_INFO "sisfb: SiS301B%s bridge detected (revision 0x%02x)\n",
+ (sishw_ext.Is301BDH ? "-DH" : ""), reg);
} else {
sishw_ext.ujVBChipID = VB_CHIP_301;
printk(KERN_INFO "sisfb: SiS301 bridge detected\n");
}
break;
case HASVB_302:
- vgawb(VB_PART4_ADR,0x01);
- reg = vgarb(VB_PART4_DATA);
- if (reg >= 0xD0) {
+ inSISIDXREG(SISPART4, 0x01, reg);
+ if (reg >= 0xE0) {
sishw_ext.ujVBChipID = VB_CHIP_302LV;
printk(KERN_INFO "sisfb: SiS302LV bridge detected (revision 0x%02x)\n",reg);
+ } else if (reg >= 0xD0) {
+ sishw_ext.ujVBChipID = VB_CHIP_301LV;
+ printk(KERN_INFO "sisfb: SiS302LV bridge detected (revision 0x%02x)\n",reg);
} else if (reg >= 0xB0) {
+ inSISIDXREG(SISPART4,0x23,reg1);
+ if(!(reg1 & 0x02)) sishw_ext.Is301BDH = TRUE;
sishw_ext.ujVBChipID = VB_CHIP_302B;
- printk(KERN_INFO "sisfb: SiS302B bridge detected (revision 0x%02x)\n",reg);
+ printk(KERN_INFO "sisfb: SiS302B%s bridge detected (revision 0x%02x)\n",
+ (sishw_ext.Is301BDH ? "-DH" : ""), reg);
} else {
sishw_ext.ujVBChipID = VB_CHIP_302;
printk(KERN_INFO "sisfb: SiS302 bridge detected\n");
}
break;
- case HASVB_303:
- sishw_ext.ujVBChipID = VB_CHIP_303;
- printk(KERN_INFO "sisfb: SiS303 bridge detected (not supported)\n");
- break;
case HASVB_LVDS:
sishw_ext.usExternalChip = 0x1;
printk(KERN_INFO "sisfb: LVDS transmitter detected\n");
@@ -3167,93 +4189,18 @@ int __init sisfb_init(void)
break;
}
- /* TW: Determine and detect attached TV's on Chrontel */
- if (sishw_ext.usExternalChip == 0x04 || sishw_ext.usExternalChip == 0x05) {
- SiSRegInit(sishw_ext.ulIOAddress);
- if(ivideo.chip < SIS_315H) { /* TW: Chrontel 7005 */
+ if (ivideo.hasVB != HASVB_NONE) {
#ifdef CONFIG_FB_SIS_300
- SiS_IF_DEF_CH70xx = 1;
- temp1=SiS_GetCH700x(0x25);
- if ((temp1 >= 50) && (temp1 <= 100)) {
- /* TW: Read power status */
- temp1 = SiS_GetCH700x(0x0e);
- if ((temp1&0x03)!=0x03) {
- /* TW: Power all outputs */
- SiS_SetCH70xxANDOR(0x030E,0xF8);
- }
- /* TW: Sense connected TV devices */
- SiS_SetCH700x(0x0110);
- SiS_SetCH700x(0x0010);
- temp1 = SiS_GetCH700x(0x10);
- if (!(temp1 & 0x08)) {
- /* TW: So we can be sure that there IS a SVHS output */
- printk(KERN_INFO
- "sisfb: Chrontel: Detected TV connected to SVHS output\n");
- ivideo.TV_plug = TVPLUG_SVIDEO;
- vgawb(CRTC_ADR, 0x32);
- temp2 = vgarb(CRTC_DATA) | 0x02;
- vgawb(CRTC_DATA, temp2);
- } else if (!(temp1 & 0x02)) {
- /* TW: So we can be sure that there IS a CVBS output */
- printk(KERN_INFO
- "sisfb: Chrontel: Detected TV connected to CVBS output\n");
- ivideo.TV_plug = TVPLUG_COMPOSITE;
- vgawb(CRTC_ADR, 0x32);
- temp2 = vgarb(CRTC_DATA) | 0x01;
- vgawb(CRTC_DATA, temp2);
- } else {
- SiS_SetCH70xxANDOR(0x010E,0xF8);
- }
- } else if (temp1==0) {
- SiS_SetCH70xxANDOR(0x010E,0xF8);
- }
-#endif
- } else { /* TW: Chrontel 7019 */
+ if (sisvga_engine == SIS_300_VGA) {
+ sisfb_detect_VB_connect_300();
+ }
+#endif
#ifdef CONFIG_FB_SIS_315
- SiS_IF_DEF_CH70xx = 2;
- temp1 = SiS_GetCH701x(0x49);
- SiS_SetCH701x(0x2049);
- SiS_DDC2Delay(0x96);
- temp2 = SiS_GetCH701x(0x20);
- temp2 |= 0x01;
- SiS_SetCH701x((temp2 << 8) | 0x20);
- SiS_DDC2Delay(0x96);
- temp2 ^= 0x01;
- SiS_SetCH701x((temp2 << 8) | 0x20);
- SiS_DDC2Delay(0x96);
- temp2 = SiS_GetCH701x(0x20);
- SiS_SetCH701x((temp1 << 8) | 0x49);
- temp1 = 0;
- if(temp2 & 0x02) temp1 |= 0x01;
- if(temp2 & 0x10) temp1 |= 0x01;
- if(temp2 & 0x04) temp1 |= 0x02;
- if( (temp1 & 0x01) && (temp1 & 0x02) ) temp1 = 0x04;
- switch(temp1) {
- case 0x01:
- printk(KERN_INFO
- "sisfb: Chrontel: Detected TV connected to CVBS output\n");
- ivideo.TV_plug = TVPLUG_COMPOSITE;
- vgawb(CRTC_ADR, 0x32);
- temp2 = vgarb(CRTC_DATA) | 0x01;
- vgawb(CRTC_DATA, temp2);
- break;
- case 0x02:
- printk(KERN_INFO
- "sisfb: Chrontel: Detected TV connected to SVHS output\n");
- ivideo.TV_plug = TVPLUG_SVIDEO;
- vgawb(CRTC_ADR, 0x32);
- temp2 = vgarb(CRTC_DATA) | 0x02;
- vgawb(CRTC_DATA, temp2);
- break;
- case 0x04:
- /* TW: This should not happen */
- printk(KERN_INFO
- "sisfb: Chrontel: Detected TV connected to SCART output!?\n");
- break;
- }
+ if (sisvga_engine == SIS_315_VGA) {
+ sisfb_detect_VB_connect_315();
+ }
#endif
- }
- }
+ }
if (ivideo.disp_state & DISPTYPE_DISP2) {
if (sisfb_crt1off)
@@ -3266,8 +4213,8 @@ int __init sisfb_init(void)
if (ivideo.disp_state & DISPTYPE_LCD) {
if (!enable_dstn) {
- vgawb(CRTC_ADR, IND_SIS_LCD_PANEL);
- reg = vgarb(CRTC_DATA) & 0x0f;
+ inSISIDXREG(SISCR, IND_SIS_LCD_PANEL, reg);
+ reg &= 0x0f;
if (sisvga_engine == SIS_300_VGA) {
sishw_ext.ulCRT2LCDType = sis300paneltype[reg];
} else {
@@ -3278,9 +4225,84 @@ int __init sisfb_init(void)
sishw_ext.ulCRT2LCDType = LCD_320x480;
}
}
+
+ sisfb_detectedpdc = 0;
+#ifndef LINUXBIOS
+#ifdef CONFIG_FB_SIS_300
+ /* TW: Save the current PanelDelayCompensation if the LCD is currently used */
+ if(sisvga_engine == SIS_300_VGA) {
+ if((sishw_ext.usExternalChip == 0x01) || /* LVDS */
+ (sishw_ext.usExternalChip == 0x05) || /* LVDS+Chrontel */
+ (sishw_ext.Is301BDH)) { /* 301B-DH */
+ int tmp;
+ inSISIDXREG(SISCR,0x30,tmp);
+ if(tmp & 0x20) {
+ /* Currently on LCD? If yes, read current pdc */
+ inSISIDXREG(SISPART1,0x13,sisfb_detectedpdc);
+ sisfb_detectedpdc &= 0x3c;
+ if(sishw_ext.pdc == 0) {
+ /* Let option override detection */
+ sishw_ext.pdc = sisfb_detectedpdc;
+ }
+ printk(KERN_INFO
+ "sisfb: Detected LCD PanelDelayCompensation %d\n",
+ sisfb_detectedpdc);
+ }
+ if((sishw_ext.pdc) && (sishw_ext.pdc != sisfb_detectedpdc)) {
+ printk(KERN_INFO
+ "sisfb: Using LCD PanelDelayCompensation %d\n",
+ sishw_ext.pdc);
+ }
+ }
+ }
+#endif
+#endif
+ sisfb_detectedlcda = 0xff;
+#ifndef LINUXBIOS
+#ifdef CONFIG_FB_SIS_315
+ /* TW: Try to find about LCDA */
+ if(sisvga_engine == SIS_315_VGA) {
+ if((sishw_ext.ujVBChipID == VB_CHIP_302B) ||
+ (sishw_ext.ujVBChipID == VB_CHIP_301LV) ||
+ (sishw_ext.ujVBChipID == VB_CHIP_302LV)) {
+ int tmp;
+ inSISIDXREG(SISCR,0x34,tmp);
+ if(tmp <= 0x13) {
+ /* Currently on LCDA? (Some BIOSes leave CR38) */
+ inSISIDXREG(SISCR,0x38,tmp);
+ if((tmp & 0x03) == 0x03) {
+ SiS_Pr.SiS_UseLCDA = TRUE;
+ } else {
+ /* Currently on LCDA? (Some newer BIOSes set D0 in CR35) */
+ inSISIDXREG(SISCR,0x35,tmp);
+ if(tmp & 0x01) {
+ SiS_Pr.SiS_UseLCDA = TRUE;
+ } else {
+ /* Currently on LCD? If so, we can find out
+ by peeking the mode register
+ */
+ inSISIDXREG(SISCR,0x30,tmp);
+ if(tmp & 0x20) {
+ inSISIDXREG(SISPART1,0x13,tmp);
+ if(tmp & 0x04) {
+ SiS_Pr.SiS_UseLCDA = TRUE;
+ }
+ }
+ }
+ }
+ }
+ if(SiS_Pr.SiS_UseLCDA) {
+ sisfb_detectedlcda = 0x03;
+ printk(KERN_INFO
+ "sisfb: Bridge uses LCDA for low resolution and text modes\n");
+ }
+ }
+ }
+#endif
+#endif
if (sisfb_mode_idx >= 0)
- sisfb_validate_mode();
+ sisfb_mode_idx = sisfb_validate_mode(sisfb_mode_idx);
if (sisfb_mode_idx < 0) {
switch (ivideo.disp_state & DISPTYPE_DISP2) {
@@ -3310,214 +4332,384 @@ int __init sisfb_init(void)
ivideo.video_vwidth = ivideo.video_width = sisbios_mode[sisfb_mode_idx].xres;
ivideo.video_vheight = ivideo.video_height = sisbios_mode[sisfb_mode_idx].yres;
ivideo.org_x = ivideo.org_y = 0;
- video_linelength = ivideo.video_width * (ivideo.video_bpp >> 3);
+ ivideo.video_linelength = ivideo.video_width * (ivideo.video_bpp >> 3);
+ switch(ivideo.video_bpp) {
+ case 8:
+ ivideo.DstColor = 0x0000;
+ ivideo.SiS310_AccelDepth = 0x00000000;
+ ivideo.video_cmap_len = 256;
+ break;
+ case 16:
+ ivideo.DstColor = 0x8000;
+ ivideo.SiS310_AccelDepth = 0x00010000;
+ ivideo.video_cmap_len = 16;
+ break;
+ case 32:
+ ivideo.DstColor = 0xC000;
+ ivideo.SiS310_AccelDepth = 0x00020000;
+ ivideo.video_cmap_len = 16;
+ break;
+ default:
+ ivideo.video_cmap_len = 16;
+ printk(KERN_INFO "sisfb: Unsupported depth %d", ivideo.video_bpp);
+ break;
+ }
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- printk(KERN_INFO "sisfb: Mode is %dx%dx%d (%dHz), linelength=%d\n",
+ /* ---------------- For 2.4: Now switch the mode ------------------ */
+
+ printk(KERN_INFO "sisfb: Mode is %dx%dx%d (%dHz)\n",
ivideo.video_width, ivideo.video_height, ivideo.video_bpp,
- ivideo.refresh_rate, video_linelength);
-
- // Eden Chen
- // Check interface correction For Debug
- DPRINTK("VM Adr=0x%p\n", sishw_ext.pjVideoMemoryAddress);
- DPRINTK("VM Size=%ldK\n", sishw_ext.ulVideoMemorySize/1024);
- DPRINTK("IO Adr=0x%lx\n", sishw_ext.ulIOAddress);
- DPRINTK("Chip=%d\n", sishw_ext.jChipType);
- DPRINTK("ChipRevision=%d\n", sishw_ext.jChipRevision);
- DPRINTK("VBChip=%d\n", sishw_ext.ujVBChipID);
- DPRINTK("ExtVB=%d\n", sishw_ext.usExternalChip);
- DPRINTK("LCD=%ld\n", sishw_ext.ulCRT2LCDType);
- DPRINTK("bIntegratedMMEnabled=%d\n", sishw_ext.bIntegratedMMEnabled);
- // ~Eden Chen
+ ivideo.refresh_rate);
sisfb_pre_setmode();
- if (SiSSetMode(&sishw_ext, sisfb_mode_no) == 0) {
- printk("sisfb: Setting mode[0x%x] failed, using default mode\n", sisfb_mode_no);
+ if (SiSSetMode(&SiS_Pr, &sishw_ext, sisfb_mode_no) == 0) {
+ printk(KERN_ERR "sisfb: Setting mode[0x%x] failed, using default mode\n",
+ sisfb_mode_no);
return -1;
}
- vgawb(SEQ_ADR, IND_SIS_PASSWORD);
- vgawb(SEQ_DATA, SIS_PASSWORD);
+ outSISIDXREG(SISSR, IND_SIS_PASSWORD, SIS_PASSWORD);
sisfb_post_setmode();
sisfb_crtc_to_var(&default_var);
+
+#else /* --------- For 2.5: Setup a somewhat sane default var ------------ */
- fb_info.changevar = NULL;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- fb_info.node = -1;
-#else
- fb_info.node = NODEV;
-#endif
- fb_info.fbops = &sisfb_ops;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,23)
- fb_info.screen_base = ivideo.video_vbase;
- fb_info.currcon = -1;
+ printk(KERN_INFO "sisfb: Default mode is %dx%dx%d (%dHz)\n",
+ ivideo.video_width, ivideo.video_height, ivideo.video_bpp,
+ ivideo.refresh_rate);
+
+ default_var.xres = default_var.xres_virtual = ivideo.video_width;
+ default_var.yres = default_var.yres_virtual = ivideo.video_height;
+ default_var.bits_per_pixel = ivideo.video_bpp;
+
+ sisfb_bpp_to_var(&default_var);
+
+ default_var.pixclock = (u32) (1E12 /
+ sisfb_mode_rate_to_dclock(&SiS_Pr, &sishw_ext,
+ sisfb_mode_no, sisfb_rate_idx));
+
+ if(sisfb_mode_rate_to_ddata(&SiS_Pr, &sishw_ext,
+ sisfb_mode_no, sisfb_rate_idx,
+ &default_var.left_margin, &default_var.right_margin,
+ &default_var.upper_margin, &default_var.lower_margin,
+ &default_var.hsync_len, &default_var.vsync_len,
+ &default_var.sync, &default_var.vmode)) {
+
+ if((default_var.vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) {
+ default_var.yres <<= 1;
+ default_var.yres_virtual <<= 1;
+ } else if((default_var.vmode & FB_VMODE_MASK) == FB_VMODE_DOUBLE) {
+ default_var.pixclock >>= 1;
+ default_var.yres >>= 1;
+ default_var.yres_virtual >>= 1;
+ }
+
+ }
+#ifdef SISFB_PAN
+ if(sisfb_ypan) {
+ default_var.yres_virtual =
+ ivideo.heapstart / (default_var.xres * (default_var.bits_per_pixel >> 3));
+ if(default_var.yres_virtual <= default_var.yres) {
+ default_var.yres_virtual = default_var.yres;
+ }
+ }
#endif
- fb_info.disp = &disp;
- fb_info.switch_con = &sisfb_switch;
- fb_info.updatevar = &sisfb_update_var;
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,23)
- fb_info.blank = &sisfb_blank;
+
#endif
- fb_info.flags = FBINFO_FLAG_DEFAULT;
- sisfb_set_disp(-1, &default_var);
+ ivideo.accel = 0;
+ if(sisfb_accel) {
+ ivideo.accel = -1;
+ default_var.accel_flags |= FB_ACCELF_TEXT;
+ sisfb_initaccel();
+ }
- } /* TW: if mode = "none" */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) /* ---- 2.4 series init ---- */
+ sis_fb_info.node = -1;
+ sis_fb_info.flags = FBINFO_FLAG_DEFAULT;
+ sis_fb_info.blank = &sisfb_blank;
+ sis_fb_info.fbops = &sisfb_ops;
+ sis_fb_info.switch_con = &sisfb_switch;
+ sis_fb_info.updatevar = &sisfb_update_var;
+ sis_fb_info.changevar = NULL;
+ sis_fb_info.disp = &sis_disp;
+
+ sisfb_set_disp(-1, &default_var, &sis_fb_info);
+#endif
- if (sisfb_heap_init()) {
- printk("sisfb: Failed to initialize offscreen memory heap\n");
- }
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) /* ---- 2.5 series init ---- */
+ sis_fb_info.node = NODEV;
+ sis_fb_info.flags = FBINFO_FLAG_DEFAULT;
+ sis_fb_info.var = default_var;
+ sis_fb_info.fix = sisfb_fix;
+ sis_fb_info.par = &ivideo;
+ sis_fb_info.screen_base = ivideo.video_vbase;
+ sis_fb_info.fbops = &sisfb_ops;
+ sisfb_get_fix(&sis_fb_info.fix, -1, &sis_fb_info);
+ sis_fb_info.pseudo_palette = pseudo_palette;
+
+ fb_alloc_cmap(&sis_fb_info.cmap, 256 , 0);
+#endif
- ivideo.mtrr = (unsigned int) 0;
- if ((sisbios_mode[sisfb_mode_idx].mode_no) != 0xFF) { /* TW: for mode "none" */
- /*H.C.*/
+#ifdef CONFIG_MTRR
ivideo.mtrr = mtrr_add((unsigned int) ivideo.video_base,
(unsigned int) ivideo.video_size,
MTRR_TYPE_WRCOMB, 1);
- /*
- if (ivideo.mtrr >= 0) {
- printk(KERN_INFO "Succeed to turn on Write-Combining on VideoMemory %08XH, Size: %08XH\n",
- ivideo.video_base, ivideo.video_size);
- } else {
- printk(KERN_INFO "Fail to turn on Write-Combining on Video Memory 0x%08X, Size: 0x%08X\n",
- ivideo.video_base, ivideo.video_size);
- }
- */
+ if(ivideo.mtrr) {
+ printk(KERN_INFO "sisfb: Added MTRRs\n");
+ }
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
vc_resize_con(1, 1, 0);
+#endif
- if (register_framebuffer(&fb_info) < 0)
+ TWDEBUG("Before calling register_framebuffer");
+
+ if(register_framebuffer(&sis_fb_info) < 0)
return -EINVAL;
+
+ sisfb_registered = 1;
+ printk(KERN_INFO "sisfb: Installed SISFB_GET_INFO ioctl (%x)\n", SISFB_GET_INFO);
+
+ printk(KERN_INFO "sisfb: 2D acceleration is %s, scrolling mode %s\n",
+ sisfb_accel ? "enabled" : "disabled",
+ sisfb_ypan ? "ypan" : "redraw");
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
printk(KERN_INFO "fb%d: %s frame buffer device, Version %d.%d.%02d\n",
- minor(fb_info.node), fb_info.modename, VER_MAJOR, VER_MINOR,
- VER_LEVEL);
+ GET_FB_IDX(sis_fb_info.node), sis_fb_info.modename, VER_MAJOR, VER_MINOR,
+ VER_LEVEL);
+#endif
- printk(KERN_INFO "sisfb: Added SISFB_GET_INFO ioctl = %x\n", SISFB_GET_INFO);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+ printk(KERN_INFO "fb%d: %s frame buffer device, Version %d.%d.%02d\n",
+ minor(sis_fb_info.node), myid, VER_MAJOR, VER_MINOR, VER_LEVEL);
+#endif
} /* TW: if mode = "none" */
return 0;
}
+
#ifdef MODULE
-static char *mode = NULL;
+static char *mode = NULL;
+static int vesa = -1;
static unsigned int rate = 0;
static unsigned int crt1off = 1;
static unsigned int mem = 0;
static unsigned int dstn = 0;
-static char *forcecrt2type = NULL;
-static int forcecrt1 = -1;
-static char *queuemode = NULL;
-static int pdc = 0;
-
-MODULE_DESCRIPTION("SiS 300/540/630/730/315/550/650/740 framebuffer driver");
-MODULE_LICENSE("GPL"); /* TW (Code is officially open says SiS) */
-MODULE_AUTHOR("Various; SiS; Thomas Winischhofer <thomas@winischhofer.net>");
+static char *forcecrt2type = NULL;
+static int forcecrt1 = -1;
+static char *queuemode = NULL;
+static int pdc = 0;
+static int noaccel = -1;
+static int noypan = -1;
+static int inverse = 0;
+static int userom = 1;
+static int useoem = -1;
+static char *tvstandard = NULL;
+
+MODULE_DESCRIPTION("SiS 300/540/630/730/315/550/650/740/330 framebuffer driver");
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("SiS; Thomas Winischhofer <thomas@winischhofer.net>; Various others");
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+MODULE_PARM(mode, "s");
+MODULE_PARM_DESC(mode,
+ "\nSelects the desired display mode in the format [X]x[Y]x[Depth], eg.\n"
+ "800x600x16 (default: none if sisfb is a module; this leaves the\n"
+ "console untouched and the driver will only do the video memory\n"
+ "management for eg. DRM/DRI; 800x600x8 if sisfb is in the kernel)");
+#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
MODULE_PARM(mode, "s");
MODULE_PARM_DESC(mode,
- "Selects the desired display mode in the format [X]x[Y]x[Depth], eg. 800x600x16 "
- "(default: none; this leaves the console untouched and the driver will only do "
- "the video memory management for eg. DRM/DRI)");
+ "\nSelects the desired default display mode in the format [X]x[Y]x[Depth],\n"
+ "eg. 1024x768x16 (default: 800x600x8)");
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+MODULE_PARM(vesa, "i");
+MODULE_PARM_DESC(vesa,
+ "\nSelects the desired display mode by VESA defined mode number, eg. 0x117\n"
+ "(default: 0x0000 if sisfb is a module; this leaves the console untouched\n"
+ "and the driver will only do the video memory management for eg. DRM/DRI;\n"
+ "0x0103 if sisfb is in the kernel)");
+#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+MODULE_PARM(vesa, "i");
+MODULE_PARM_DESC(vesa,
+ "\nSelects the desired default display mode by VESA defined mode number, eg.\n"
+ "0x117 (default: 0x0103)");
+#endif
MODULE_PARM(rate, "i");
MODULE_PARM_DESC(rate,
- "Selects the desired vertical refresh rate for CRT1 (external VGA) in Hz. "
+ "\nSelects the desired vertical refresh rate for CRT1 (external VGA) in Hz.\n"
"(default: 60)");
MODULE_PARM(crt1off, "i");
MODULE_PARM_DESC(crt1off,
- "If this option is set, the driver will switch off CRT1 (external VGA). "
"(Deprecated, please use forcecrt1)");
MODULE_PARM(filter, "i");
MODULE_PARM_DESC(filter,
- "Selects TV flicker filter type (only for SiS30x video bridges). "
- "(Possible values 0-7, default: [no filter])");
+ "\nSelects TV flicker filter type (only for systems with a SiS301 video bridge).\n"
+ "(Possible values 0-7, default: [no filter])");
-MODULE_PARM(dstn, "i"); /* JennyLee 20011211 */
+MODULE_PARM(dstn, "i");
MODULE_PARM_DESC(dstn,
- "Selects DSTN/FSTN display mode for SiS550. This sets CRT2 type to LCD and "
- "overrides forcecrt2type setting. (1=ON, 0=OFF) (default: 0)");
+ "\nSelects DSTN/FSTN display mode for SiS550. This sets CRT2 type to LCD and\n"
+ "overrides forcecrt2type setting. (1=ON, 0=OFF) (default: 0)");
MODULE_PARM(queuemode, "s");
MODULE_PARM_DESC(queuemode,
- "Selects the queue mode on 315/550/650/740. Possible choices are AGP, VRAM "
- "or MMIO. AGP is only available if the kernel has AGP support. "
- "The queue mode is important to programs using the 2D/3D accelerator of "
- "the SiS chip. The modes require a totally different way of programming "
- "the engines. On 300/540/630/730, this option is ignored. (default: MMIO)");
+ "\nSelects the queue mode on 315/550/650/740/330. Possible choices are AGP, VRAM or\n"
+ "MMIO. AGP is only available if the kernel has AGP support. The queue mode is\n"
+ "important to programs using the 2D/3D accelerator of the SiS chip. The modes\n"
+ "require a totally different way of programming the engines. If any mode than\n"
+ "MMIO is selected, sisfb will disable its own 2D acceleration. On\n"
+ "300/540/630/730, this option is ignored. (default: MMIO)");
/* TW: "Import" the options from the X driver */
MODULE_PARM(mem, "i");
MODULE_PARM_DESC(mem,
- "Determines the beginning of the video memory heap in KB. This heap is used for "
- "video RAM management for eg. DRM/DRI. The default depends on the amount of video "
- "memory available. If 8MB of video RAM or less is available, "
- "the heap starts at 4096KB, if between 8 and 16MB are available at 8192KB, otherwise at 12288MB."
- "The value is to be specified without 'KB' and should match MaxXFBMem setting for "
- "XFree 4.x (x>=2). See http://www.winischhofer.net/linuxsis630.shtml for a closer description.");
+ "\nDetermines the beginning of the video memory heap in KB. This heap is used\n"
+ "for video RAM management for eg. DRM/DRI. The default depends on the amount\n"
+ "of video RAM available. If 8MB of video RAM or less is available, the heap\n"
+ "starts at 4096KB, if between 8 and 16MB are available at 8192KB, otherwise\n"
+ "at 12288KB. The value is to be specified without 'KB' and should match\n"
+ "the MaxXFBMem setting for XFree 4.x (x>=2).");
MODULE_PARM(forcecrt2type, "s");
MODULE_PARM_DESC(forcecrt2type,
- "If this option is omitted, the driver autodetects CRT2 output devices, such as LCD, "
- "TV or secondary VGA (in this order; so if eg. an LCD is there, it will be used regardless "
- "of a connected TV set). With this option, this autodetection can be overridden. "
- "Possible parameters are LCD, TV, VGA or NONE. NONE disables CRT2 and makes it "
- "possible to use higher resolutions on CRT1 than eg. your LCD panel supports. TV "
- "selects TV output (only resolutions 640x480 and 800x600 are supported for TV!). "
- "VGA refers to _secondary_ VGA which is unlikely to be available; the VGA plug found "
- "on most machines is CRT1. (default: [autodetected])");
+ "\nIf this option is omitted, the driver autodetects CRT2 output devices, such as\n"
+ "LCD, TV or secondary VGA. With this option, this autodetection can be\n"
+ "overridden. Possible parameters are LCD, TV, VGA or NONE. NONE disables CRT2.\n"
+ "On systems with a 301(B/LV) bridge, parameters SVIDEO, COMPOSITE or SCART can be\n"
+ "used instead of TV to override the TV detection. (default: [autodetected])");
MODULE_PARM(forcecrt1, "i");
MODULE_PARM_DESC(forcecrt1,
- "Normally, the driver autodetects whether or not CRT1 (external VGA) is connected. "
- "With this option, the detection can be overridden (1=CRT1 ON, 0=CRT1 off) "
- "(default: [autodetected])");
+ "\nNormally, the driver autodetects whether or not CRT1 (external VGA) is \n"
+ "connected. With this option, the detection can be overridden (1=CRT1 ON,\n"
+ " 0=CRT1 off) (default: [autodetected])");
MODULE_PARM(pdc, "i");
MODULE_PARM_DESC(pdc,
- "(300 series only) This is for manually selecting the LCD panel delay compensation. The "
- "driver should detect this correctly in most cases; however, sometimes this is not possible. If "
- "you see 'small waves' on the LCD, try setting this to 4, 32 or 24. If the problem persists, "
- "try other values between 4 and 60 in steps of 4. "
- "(default: [autodetected])");
-
+ "\n(300 series only) This is for manually selecting the LCD panel delay\n"
+ "compensation. The driver should detect this correctly in most cases; however,\n"
+ "sometimes this is not possible. If you see 'small waves' on the LCD, try\n"
+ "setting this to 4, 32 or 24. If the problem persists, try other values\n"
+ "between 4 and 60 in steps of 4. (default: [autodetected])");
+
+MODULE_PARM(noaccel, "i");
+MODULE_PARM_DESC(noaccel,
+ "\nIf set to anything other than 0, 2D acceleration and y-panning will be\n"
+ "disabled. (default: 0)");
+
+MODULE_PARM(noypan, "i");
+MODULE_PARM_DESC(noypan,
+ "\nIf set to anything other than 0, y-panning will be disabled and scrolling\n"
+ "will be performed by redrawing the screen. This required 2D acceleration, so\n"
+ "if the option noaccel is set, y-panning will be disabled. (default: 0)");
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+MODULE_PARM(inverse, "i");
+MODULE_PARM_DESC(inverse,
+ "\nSetting this to anything but 0 should invert the display colors, but this\n"
+ "does not seem to work. (default: 0)");
+#endif
+
+MODULE_PARM(userom, "i");
+MODULE_PARM_DESC(userom,
+ "\nSetting this to 0 keeps sisfb from using the video BIOS data which is needed\n"
+ "for some LCD and TV setup. (default: 1)");
+
+MODULE_PARM(useoem, "i");
+MODULE_PARM_DESC(useoem,
+ "\nSetting this to 0 keeps sisfb from using its internel OEM data for some LCD\n"
+ "panels and TV connector types. (default: auto)");
+
+MODULE_PARM(tvstandard, "s");
+MODULE_PARM_DESC(tvstandard,
+ "\nThis allows overriding the BIOS default for the TV standard. Valid choices are\n"
+ "pal and ntsc. (default: auto)");
int init_module(void)
{
- if (mode)
+ int err;
+
+ if(mode)
sisfb_search_mode(mode);
- else /* TW: set mode=none if no mode parameter is given */
+ else if(vesa != -1)
+ sisfb_search_vesamode(vesa);
+ else
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+ /* For 2.4, set mode=none if no mode is given */
sisfb_mode_idx = MODE_INDEX_NONE;
+#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+ /* For 2.5, we don't need this "mode=none" stuff anymore */
+ sisfb_mode_idx = DEFAULT_MODE;
+#endif
ivideo.refresh_rate = rate;
- if (forcecrt2type)
+ if(forcecrt2type)
sisfb_search_crt2type(forcecrt2type);
- if (crt1off == 0)
+ if(tvstandard)
+ sisfb_search_tvstd(tvstandard);
+
+ if(crt1off == 0)
sisfb_crt1off = 1;
else
sisfb_crt1off = 0;
sisfb_forcecrt1 = forcecrt1;
- if (forcecrt1 == 1)
+ if(forcecrt1 == 1)
sisfb_crt1off = 0;
- else if (forcecrt1 == 0)
+ else if(forcecrt1 == 0)
sisfb_crt1off = 1;
- if (mem)
- sisfb_mem = mem;
+ if(noaccel == 1) sisfb_accel = 0;
+ else if(noaccel == 0) sisfb_accel = 1;
+
+ if(noypan == 1) sisfb_ypan = 0;
+ else if(noypan == 0) sisfb_ypan = 1;
+
+ /* TW: Panning only with acceleration */
+ if(sisfb_accel == 0) sisfb_ypan = 0;
+
+ if(inverse) sisfb_inverse = 1;
+
+ if(mem) sisfb_mem = mem;
+
+ sisfb_userom = userom;
+
+ sisfb_useoem = useoem;
+
+ enable_dstn = dstn;
- enable_dstn = dstn; /* JennyLee 20011211 */
/* TW: DSTN overrules forcecrt2type */
- if (enable_dstn) sisfb_crt2type = DISPTYPE_LCD;
+ if (enable_dstn) sisfb_crt2type = DISPTYPE_LCD;
- if (queuemode)
- sisfb_search_queuemode(queuemode);
+ if (queuemode) sisfb_search_queuemode(queuemode);
+
+ /* TW: If other queuemode than MMIO, disable 2D accel and ypan */
+ if((sisfb_queuemode != -1) && (sisfb_queuemode != MMIO_CMD)) {
+ sisfb_accel = 0;
+ sisfb_ypan = 0;
+ }
if(pdc) {
if(!(pdc & ~0x3c)) {
@@ -3525,7 +4717,7 @@ int init_module(void)
}
}
- sisfb_init();
+ if((err = sisfb_init()) < 0) return err;
return 0;
}
@@ -3535,12 +4727,26 @@ void cleanup_module(void)
/* TW: Release mem regions */
release_mem_region(ivideo.video_base, ivideo.video_size);
release_mem_region(ivideo.mmio_base, sisfb_mmio_size);
+
+#ifdef CONFIG_MTRR
/* TW: Release MTRR region */
- if (ivideo.mtrr) mtrr_del(ivideo.mtrr,
- (unsigned int)ivideo.video_base,
- (unsigned int)ivideo.video_size);
+ if(ivideo.mtrr) {
+ mtrr_del(ivideo.mtrr,
+ (unsigned int)ivideo.video_base,
+ (unsigned int)ivideo.video_size);
+ }
+#endif
+
/* Unregister the framebuffer */
- unregister_framebuffer(&fb_info);
+ if(sisfb_registered) {
+ unregister_framebuffer(&sis_fb_info);
+ }
+
+ if(sishw_ext.pSR) vfree(sishw_ext.pSR);
+ if(sishw_ext.pCR) vfree(sishw_ext.pCR);
+
+ /* TODO: Restore the initial mode */
+
printk(KERN_INFO "sisfb: Module unloaded\n");
}
diff --git a/drivers/video/sis/sis_main.h b/drivers/video/sis/sis_main.h
index 6246cdc4b2dc..6c2dcbde56ed 100644
--- a/drivers/video/sis/sis_main.h
+++ b/drivers/video/sis/sis_main.h
@@ -1,16 +1,22 @@
#ifndef _SISFB_MAIN
#define _SISFB_MAIN
-/* Comments and changes marked with "TW" by Thomas Winischhofer <tw@webit.com> */
+/* Comments and changes marked with "TW" by Thomas Winischhofer <thomas@winischhofer.net> */
+
+#include "vstruct.h"
/* ------------------- Constant Definitions ------------------------- */
-#undef LINUXBIOS /* turn on when use LINUXBIOS */
+#undef LINUXBIOS /* turn this on when compiling for LINUXBIOS */
#define AGPOFF /* default is turn off AGP */
+#define SISFAIL(x) do { printk(x "\n"); return -EINVAL; } while(0)
+
#define VER_MAJOR 1
-#define VER_MINOR 4
-#define VER_LEVEL 1
+#define VER_MINOR 6
+#define VER_LEVEL 0
+
+#include "sis.h"
/* TW: To be included in pci_ids.h */
#ifndef PCI_DEVICE_ID_SI_650_VGA
@@ -19,14 +25,28 @@
#ifndef PCI_DEVICE_ID_SI_650
#define PCI_DEVICE_ID_SI_650 0x0650
#endif
-/* TW end */
+#ifndef PCI_DEVICE_ID_SI_740
+#define PCI_DEVICE_ID_SI_740 0x0740
+#endif
+#ifndef PCI_DEVICE_ID_SI_330
+#define PCI_DEVICE_ID_SI_330 0x0330
+#endif
+
+/* To be included in fb.h */
+#ifndef FB_ACCEL_SIS_GLAMOUR_2
+#define FB_ACCEL_SIS_GLAMOUR_2 40 /* SiS 315, 650, 740 */
+#endif
+#ifndef FB_ACCEL_SIS_XABRE
+#define FB_ACCEL_SIS_XABRE 41 /* SiS 330 ("Xabre") */
+#endif
#define MAX_ROM_SCAN 0x10000
-#define TURBO_QUEUE_CAP 0x80
-#define HW_CURSOR_CAP 0x40
-#define AGP_CMD_QUEUE_CAP 0x80
-#define VM_CMD_QUEUE_CAP 0x20
+#define HW_CURSOR_CAP 0x80
+#define TURBO_QUEUE_CAP 0x40
+#define AGP_CMD_QUEUE_CAP 0x20
+#define VM_CMD_QUEUE_CAP 0x10
+#define MMIO_CMD_QUEUE_CAP 0x08
/* For 300 series */
#ifdef CONFIG_FB_SIS_300
@@ -63,6 +83,20 @@
#define VB_PART4_ADR (0x14-0x30)
#define VB_PART4_DATA (0x15-0x30)
+#define SISSR SiS_Pr.SiS_P3c4
+#define SISCR SiS_Pr.SiS_P3d4
+#define SISDACA SiS_Pr.SiS_P3c8
+#define SISDACD SiS_Pr.SiS_P3c9
+#define SISPART1 SiS_Pr.SiS_Part1Port
+#define SISPART2 SiS_Pr.SiS_Part2Port
+#define SISPART3 SiS_Pr.SiS_Part3Port
+#define SISPART4 SiS_Pr.SiS_Part4Port
+#define SISPART5 SiS_Pr.SiS_Part5Port
+#define SISDAC2A SISPART5
+#define SISDAC2D (SISPART5 + 1)
+#define SISMISCR (SiS_Pr.RelIO + 0x1c)
+#define SISINPSTAT (SiS_Pr.RelIO + 0x2a)
+
#define IND_SIS_PASSWORD 0x05 /* SRs */
#define IND_SIS_COLOR_MODE 0x06
#define IND_SIS_RAMDAC_CONTROL 0x07
@@ -93,10 +127,8 @@
#define MMIO_QUEUE_WRITEPORT 0x85C4
#define MMIO_QUEUE_READPORT 0x85C8
-/* Eden Chen; TW */
#define IND_SIS_CRT2_WRITE_ENABLE_300 0x24
#define IND_SIS_CRT2_WRITE_ENABLE_315 0x2F
-/* ~Eden Chen; TW */
#define SIS_PASSWORD 0x86 /* SR05 */
#define SIS_INTERLACED_MODE 0x20 /* SR06 */
@@ -104,7 +136,7 @@
#define SIS_15BPP_COLOR_MODE 0x1
#define SIS_16BPP_COLOR_MODE 0x2
#define SIS_32BPP_COLOR_MODE 0x4
-#define SIS_DRAM_SIZE_MASK 0x3F /* SR14 */
+#define SIS_DRAM_SIZE_MASK 0x3F /* 300/630/730 SR14 */
#define SIS_DRAM_SIZE_1MB 0x00
#define SIS_DRAM_SIZE_2MB 0x01
#define SIS_DRAM_SIZE_4MB 0x03
@@ -204,23 +236,55 @@
#define BRI_DRAM_SIZE_32MB 0x04
#define BRI_DRAM_SIZE_64MB 0x05
-// Eden Chen
#define HW_DEVICE_EXTENSION SIS_HW_DEVICE_INFO
#define PHW_DEVICE_EXTENSION PSIS_HW_DEVICE_INFO
#define SR_BUFFER_SIZE 5
#define CR_BUFFER_SIZE 5
-// ~Eden Chen
+
+/* Useful macros */
+#define inSISREG(base) inb(base)
+#define outSISREG(base,val) outb(val,base)
+#define orSISREG(base,val) do { \
+ unsigned char __Temp = inb(base); \
+ outSISREG(base, __Temp | (val)); \
+ } while (0)
+#define andSISREG(base,val) do { \
+ unsigned char __Temp = inb(base); \
+ outSISREG(base, __Temp & (val)); \
+ } while (0)
+#define inSISIDXREG(base,idx,var) do { \
+ outb(idx,base); var=inb((base)+1); \
+ } while (0)
+#define outSISIDXREG(base,idx,val) do { \
+ outb(idx,base); outb((val),(base)+1); \
+ } while (0)
+#define orSISIDXREG(base,idx,val) do { \
+ unsigned char __Temp; \
+ outb(idx,base); \
+ __Temp = inb((base)+1)|(val); \
+ outSISIDXREG(base,idx,__Temp); \
+ } while (0)
+#define andSISIDXREG(base,idx,and) do { \
+ unsigned char __Temp; \
+ outb(idx,base); \
+ __Temp = inb((base)+1)&(and); \
+ outSISIDXREG(base,idx,__Temp); \
+ } while (0)
+#define setSISIDXREG(base,idx,and,or) do { \
+ unsigned char __Temp; \
+ outb(idx,base); \
+ __Temp = (inb((base)+1)&(and))|(or); \
+ outSISIDXREG(base,idx,__Temp); \
+ } while (0)
/* ------------------- Global Variables ----------------------------- */
/* Fbcon variables */
-static struct fb_info fb_info;
-static struct display disp;
-static int video_type = FB_TYPE_PACKED_PIXELS;
-static int video_linelength;
-static int video_cmap_len;
-static struct display_switch sisfb_sw;
+static struct fb_info sis_fb_info;
+
+static int video_type = FB_TYPE_PACKED_PIXELS;
+
static struct fb_var_screeninfo default_var = {
xres: 0,
yres: 0,
@@ -248,51 +312,79 @@ static struct fb_var_screeninfo default_var = {
vsync_len: 0,
sync: 0,
vmode: FB_VMODE_NONINTERLACED,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
reserved: {0, 0, 0, 0, 0, 0}
+#endif
};
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+static struct fb_fix_screeninfo sisfb_fix = {
+ id: "SiS",
+ type: FB_TYPE_PACKED_PIXELS,
+ xpanstep: 1,
+ ypanstep: 1,
+};
+static char myid[20];
+static u32 pseudo_palette[17];
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+static struct display sis_disp;
+
+static struct display_switch sisfb_sw;
+
static struct {
u16 blue, green, red, pad;
-} palette[256];
+} sis_palette[256];
+
static union {
#ifdef FBCON_HAS_CFB16
u16 cfb16[16];
#endif
-#ifdef FBCON_HAS_CFB24
- u32 cfb24[16];
-#endif
#ifdef FBCON_HAS_CFB32
u32 cfb32[16];
#endif
-} fbcon_cmap;
+} sis_fbcon_cmap;
+
+static int sisfb_inverse = 0;
+#endif
/* display status */
static int sisfb_off = 0;
static int sisfb_crt1off = 0;
static int sisfb_forcecrt1 = -1;
-static int sisfb_inverse = 0;
static int sisvga_enabled = 0;
+static int sisfb_userom = 1;
+static int sisfb_useoem = -1;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
static int currcon = 0;
+#endif
+
+/* global flags */
+static int sisfb_registered;
static int sisfb_tvmode = 0;
static int sisfb_mem = 0;
static int sisfb_pdc = 0;
static int enable_dstn = 0;
+static int sisfb_ypan = -1;
-static enum _VGA_ENGINE {
- UNKNOWN_VGA = 0,
- SIS_300_VGA,
- SIS_315_VGA,
-} sisvga_engine = UNKNOWN_VGA;
+VGA_ENGINE sisvga_engine = UNKNOWN_VGA;
+int sisfb_accel = -1;
/* TW: These are to adapted according to VGA_ENGINE type */
static int sisfb_hwcursor_size = 0;
static int sisfb_CRT2_write_enable = 0;
-int sisfb_crt2type = -1; /* TW: CRT2 type (for overriding autodetection) */
+int sisfb_crt2type = -1; /* TW: CRT2 type (for overriding autodetection) */
+int sisfb_tvplug = -1; /* PR: Tv plug type (for overriding autodetection) */
+
+int sisfb_queuemode = -1; /* TW: Use MMIO queue mode by default (310/325 series only) */
-int sisfb_queuemode = -1; /* TW: Use MMIO queue mode by default (310 series only) */
+unsigned char sisfb_detectedpdc = 0;
-/* data for sis components*/
+unsigned char sisfb_detectedlcda = 0xff;
+
+/* data for sis components */
struct video_info ivideo;
/* TW: For ioctl SISFB_GET_INFO */
@@ -300,16 +392,19 @@ sisfb_info sisfbinfo;
/* TW: Hardware extension; contains data on hardware */
HW_DEVICE_EXTENSION sishw_ext = {
- NULL, NULL, NULL, NULL,
+ NULL, NULL, FALSE, NULL, NULL,
0, 0, 0, 0, 0, 0, 0, 0, 0,
NULL, NULL, NULL, NULL,
{0, 0, 0, 0},
0
};
+/* TW: SiS private structure */
+SiS_Private SiS_Pr;
+
/* card parameters */
static unsigned long sisfb_mmio_size = 0;
-static u8 sisfb_caps = 0;
+static u8 sisfb_caps = 0;
typedef enum _SIS_CMDTYPE {
MMIO_CMD = 0,
@@ -323,138 +418,157 @@ static struct board {
const char *name;
} sisdev_list[] = {
{PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_300, "SIS 300"},
- {PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_540_VGA, "SIS 540"},
- {PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_630_VGA, "SIS 630/730"},
+ {PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_540_VGA, "SIS 540 VGA"},
+ {PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_630_VGA, "SIS 630/730 VGA"},
{PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_315H, "SIS 315H"},
{PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_315, "SIS 315"},
{PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_315PRO, "SIS 315PRO"},
- {PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_550_VGA, "SIS 550"},
- {PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_650_VGA, "SIS 650/M650/740 VGA"},
+ {PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_550_VGA, "SIS 550 VGA"},
+ {PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_650_VGA, "SIS 650/M650/651/740 VGA"},
+ {PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_330, "SIS 330"},
{0, 0, NULL}
};
+#define MD_SIS300 1
+#define MD_SIS315 2
+
/* mode table */
+/* NOT const - will be patched for 1280x960 mode number chaos reasons */
struct _sisbios_mode {
char name[15];
u8 mode_no;
+ u16 vesa_mode_no_1; /* "SiS defined" VESA mode number */
+ u16 vesa_mode_no_2; /* Real VESA mode numbers */
u16 xres;
u16 yres;
u16 bpp;
u16 rate_idx;
u16 cols;
u16 rows;
+ u8 chipset;
} sisbios_mode[] = {
#define MODE_INDEX_NONE 0 /* TW: index for mode=none */
- {"none", 0xFF, 0, 0, 0, 0, 0, 0}, /* TW: for mode "none" */
- {"320x240x16", 0x56, 320, 240, 16, 1, 40, 15},
- {"320x480x8", 0x5A, 320, 480, 8, 1, 40, 30}, /* TW: FSTN */
- {"320x480x16", 0x5B, 320, 480, 16, 1, 40, 30}, /* TW: FSTN */
- {"640x480x8", 0x2E, 640, 480, 8, 1, 80, 30},
- {"640x480x16", 0x44, 640, 480, 16, 1, 80, 30},
- {"640x480x24", 0x62, 640, 480, 32, 1, 80, 30}, /* TW: That's for people who mix up color- and fb depth */
- {"640x480x32", 0x62, 640, 480, 32, 1, 80, 30},
- {"720x480x8", 0x31, 720, 480, 8, 1, 90, 30},
- {"720x480x16", 0x33, 720, 480, 16, 1, 90, 30},
- {"720x480x24", 0x35, 720, 480, 32, 1, 90, 30},
- {"720x480x32", 0x35, 720, 480, 32, 1, 90, 30},
- {"720x576x8", 0x32, 720, 576, 8, 1, 90, 36},
- {"720x576x16", 0x34, 720, 576, 16, 1, 90, 36},
- {"720x576x24", 0x36, 720, 576, 32, 1, 90, 36},
- {"720x576x32", 0x36, 720, 576, 32, 1, 90, 36},
- {"800x480x8", 0x70, 800, 480, 8, 1, 100, 30}, /* TW: 310/325 series only */
- {"800x480x16", 0x7a, 800, 480, 16, 1, 100, 30},
- {"800x480x24", 0x76, 800, 480, 32, 1, 100, 30},
- {"800x480x32", 0x76, 800, 480, 32, 1, 100, 30},
+ {"none", 0xFF, 0x0000, 0x0000, 0, 0, 0, 0, 0, 0, MD_SIS300|MD_SIS315}, /* TW: for mode "none" */
+ {"320x240x16", 0x56, 0x0000, 0x0000, 320, 240, 16, 1, 40, 15, MD_SIS315},
+ {"320x480x8", 0x5A, 0x0000, 0x0000, 320, 480, 8, 1, 40, 30, MD_SIS315}, /* TW: FSTN */
+ {"320x480x16", 0x5B, 0x0000, 0x0000, 320, 480, 16, 1, 40, 30, MD_SIS315}, /* TW: FSTN */
+ {"640x480x8", 0x2E, 0x0101, 0x0101, 640, 480, 8, 1, 80, 30, MD_SIS300|MD_SIS315},
+ {"640x480x16", 0x44, 0x0111, 0x0111, 640, 480, 16, 1, 80, 30, MD_SIS300|MD_SIS315},
+ {"640x480x24", 0x62, 0x013a, 0x0112, 640, 480, 32, 1, 80, 30, MD_SIS300|MD_SIS315}, /* TW: That's for people who mix up color- and fb depth */
+ {"640x480x32", 0x62, 0x013a, 0x0112, 640, 480, 32, 1, 80, 30, MD_SIS300|MD_SIS315},
+ {"720x480x8", 0x31, 0x0000, 0x0000, 720, 480, 8, 1, 90, 30, MD_SIS300|MD_SIS315},
+ {"720x480x16", 0x33, 0x0000, 0x0000, 720, 480, 16, 1, 90, 30, MD_SIS300|MD_SIS315},
+ {"720x480x24", 0x35, 0x0000, 0x0000, 720, 480, 32, 1, 90, 30, MD_SIS300|MD_SIS315},
+ {"720x480x32", 0x35, 0x0000, 0x0000, 720, 480, 32, 1, 90, 30, MD_SIS300|MD_SIS315},
+ {"720x576x8", 0x32, 0x0000, 0x0000, 720, 576, 8, 1, 90, 36, MD_SIS300|MD_SIS315},
+ {"720x576x16", 0x34, 0x0000, 0x0000, 720, 576, 16, 1, 90, 36, MD_SIS300|MD_SIS315},
+ {"720x576x24", 0x36, 0x0000, 0x0000, 720, 576, 32, 1, 90, 36, MD_SIS300|MD_SIS315},
+ {"720x576x32", 0x36, 0x0000, 0x0000, 720, 576, 32, 1, 90, 36, MD_SIS300|MD_SIS315},
+ {"800x480x8", 0x70, 0x0000, 0x0000, 800, 480, 8, 1, 100, 30, MD_SIS300|MD_SIS315},
+ {"800x480x16", 0x7a, 0x0000, 0x0000, 800, 480, 16, 1, 100, 30, MD_SIS300|MD_SIS315},
+ {"800x480x24", 0x76, 0x0000, 0x0000, 800, 480, 32, 1, 100, 30, MD_SIS300|MD_SIS315},
+ {"800x480x32", 0x76, 0x0000, 0x0000, 800, 480, 32, 1, 100, 30, MD_SIS300|MD_SIS315},
#define DEFAULT_MODE 20 /* TW: index for 800x600x8 */
#define DEFAULT_LCDMODE 20 /* TW: index for 800x600x8 */
#define DEFAULT_TVMODE 20 /* TW: index for 800x600x8 */
- {"800x600x8", 0x30, 800, 600, 8, 2, 100, 37},
- {"800x600x16", 0x47, 800, 600, 16, 2, 100, 37},
- {"800x600x24", 0x63, 800, 600, 32, 2, 100, 37},
- {"800x600x32", 0x63, 800, 600, 32, 2, 100, 37},
- {"1024x576x8", 0x71, 1024, 576, 8, 1, 128, 36}, /* TW: 310/325 series only */
- {"1024x576x16", 0x74, 1024, 576, 16, 1, 128, 36},
- {"1024x576x24", 0x77, 1024, 576, 32, 1, 128, 36},
- {"1024x576x32", 0x77, 1024, 576, 32, 1, 128, 36},
- {"1024x600x8", 0x20, 1024, 600, 8, 1, 128, 37}, /* TW: 300 series only */
- {"1024x600x16", 0x21, 1024, 600, 16, 1, 128, 37},
- {"1024x600x24", 0x22, 1024, 600, 32, 1, 128, 37},
- {"1024x600x32", 0x22, 1024, 600, 32, 1, 128, 37},
- {"1024x768x8", 0x38, 1024, 768, 8, 2, 128, 48},
- {"1024x768x16", 0x4A, 1024, 768, 16, 2, 128, 48},
- {"1024x768x24", 0x64, 1024, 768, 32, 2, 128, 48},
- {"1024x768x32", 0x64, 1024, 768, 32, 2, 128, 48},
- {"1152x768x8", 0x23, 1152, 768, 8, 1, 144, 48}, /* TW: 300 series only */
- {"1152x768x16", 0x24, 1152, 768, 16, 1, 144, 48},
- {"1152x768x24", 0x25, 1152, 768, 32, 1, 144, 48},
- {"1152x768x32", 0x25, 1152, 768, 32, 1, 144, 48},
- {"1280x720x8", 0x79, 1280, 720, 8, 1, 160, 45}, /* TW: 310/325 series only */
- {"1280x720x16", 0x75, 1280, 720, 16, 1, 160, 45},
- {"1280x720x24", 0x78, 1280, 720, 32, 1, 160, 45},
- {"1280x720x32", 0x78, 1280, 720, 32, 1, 160, 45},
- {"1280x768x8", 0x23, 1280, 768, 8, 1, 160, 48}, /* TW: 3107325 series only */
- {"1280x768x16", 0x24, 1280, 768, 16, 1, 160, 48},
- {"1280x768x24", 0x25, 1280, 768, 32, 1, 160, 48},
- {"1280x768x32", 0x25, 1280, 768, 32, 1, 160, 48},
+ {"800x600x8", 0x30, 0x0103, 0x0103, 800, 600, 8, 2, 100, 37, MD_SIS300|MD_SIS315},
+ {"800x600x16", 0x47, 0x0114, 0x0114, 800, 600, 16, 2, 100, 37, MD_SIS300|MD_SIS315},
+ {"800x600x24", 0x63, 0x013b, 0x0115, 800, 600, 32, 2, 100, 37, MD_SIS300|MD_SIS315},
+ {"800x600x32", 0x63, 0x013b, 0x0115, 800, 600, 32, 2, 100, 37, MD_SIS300|MD_SIS315},
+ {"1024x576x8", 0x71, 0x0000, 0x0000, 1024, 576, 8, 1, 128, 36, MD_SIS300|MD_SIS315},
+ {"1024x576x16", 0x74, 0x0000, 0x0000, 1024, 576, 16, 1, 128, 36, MD_SIS300|MD_SIS315},
+ {"1024x576x24", 0x77, 0x0000, 0x0000, 1024, 576, 32, 1, 128, 36, MD_SIS300|MD_SIS315},
+ {"1024x576x32", 0x77, 0x0000, 0x0000, 1024, 576, 32, 1, 128, 36, MD_SIS300|MD_SIS315},
+ {"1024x600x8", 0x20, 0x0000, 0x0000, 1024, 600, 8, 1, 128, 37, MD_SIS300 }, /* TW: 300 series only */
+ {"1024x600x16", 0x21, 0x0000, 0x0000, 1024, 600, 16, 1, 128, 37, MD_SIS300 },
+ {"1024x600x24", 0x22, 0x0000, 0x0000, 1024, 600, 32, 1, 128, 37, MD_SIS300 },
+ {"1024x600x32", 0x22, 0x0000, 0x0000, 1024, 600, 32, 1, 128, 37, MD_SIS300 },
+ {"1024x768x8", 0x38, 0x0105, 0x0105, 1024, 768, 8, 2, 128, 48, MD_SIS300|MD_SIS315},
+ {"1024x768x16", 0x4A, 0x0117, 0x0117, 1024, 768, 16, 2, 128, 48, MD_SIS300|MD_SIS315},
+ {"1024x768x24", 0x64, 0x013c, 0x0118, 1024, 768, 32, 2, 128, 48, MD_SIS300|MD_SIS315},
+ {"1024x768x32", 0x64, 0x013c, 0x0118, 1024, 768, 32, 2, 128, 48, MD_SIS300|MD_SIS315},
+ {"1152x768x8", 0x23, 0x0000, 0x0000, 1152, 768, 8, 1, 144, 48, MD_SIS300 }, /* TW: 300 series only */
+ {"1152x768x16", 0x24, 0x0000, 0x0000, 1152, 768, 16, 1, 144, 48, MD_SIS300 },
+ {"1152x768x24", 0x25, 0x0000, 0x0000, 1152, 768, 32, 1, 144, 48, MD_SIS300 },
+ {"1152x768x32", 0x25, 0x0000, 0x0000, 1152, 768, 32, 1, 144, 48, MD_SIS300 },
+ {"1280x720x8", 0x79, 0x0000, 0x0000, 1280, 720, 8, 1, 160, 45, MD_SIS300|MD_SIS315},
+ {"1280x720x16", 0x75, 0x0000, 0x0000, 1280, 720, 16, 1, 160, 45, MD_SIS300|MD_SIS315},
+ {"1280x720x24", 0x78, 0x0000, 0x0000, 1280, 720, 32, 1, 160, 45, MD_SIS300|MD_SIS315},
+ {"1280x720x32", 0x78, 0x0000, 0x0000, 1280, 720, 32, 1, 160, 45, MD_SIS300|MD_SIS315},
+ {"1280x768x8", 0x23, 0x0000, 0x0000, 1280, 768, 8, 1, 160, 48, MD_SIS315}, /* TW: 310/325 series only */
+ {"1280x768x16", 0x24, 0x0000, 0x0000, 1280, 768, 16, 1, 160, 48, MD_SIS315},
+ {"1280x768x24", 0x25, 0x0000, 0x0000, 1280, 768, 32, 1, 160, 48, MD_SIS315},
+ {"1280x768x32", 0x25, 0x0000, 0x0000, 1280, 768, 32, 1, 160, 48, MD_SIS315},
#define MODEINDEX_1280x960 48
- {"1280x960x8", 0x7C, 1280, 960, 8, 1, 160, 60}, /* TW: Modenumbers being patched */
- {"1280x960x16", 0x7D, 1280, 960, 16, 1, 160, 60},
- {"1280x960x24", 0x7E, 1280, 960, 32, 1, 160, 60},
- {"1280x960x32", 0x7E, 1280, 960, 32, 1, 160, 60},
- {"1280x1024x8", 0x3A, 1280, 1024, 8, 2, 160, 64},
- {"1280x1024x16", 0x4D, 1280, 1024, 16, 2, 160, 64},
- {"1280x1024x24", 0x65, 1280, 1024, 32, 2, 160, 64},
- {"1280x1024x32", 0x65, 1280, 1024, 32, 2, 160, 64},
- {"1400x1050x8", 0x26, 1400, 1050, 8, 1, 175, 65}, /* TW: 310/325 series only */
- {"1400x1050x16", 0x27, 1400, 1050, 16, 1, 175, 65},
- {"1400x1050x24", 0x28, 1400, 1050, 32, 1, 175, 65},
- {"1400x1050x32", 0x28, 1400, 1050, 32, 1, 175, 65},
- {"1600x1200x8", 0x3C, 1600, 1200, 8, 1, 200, 75},
- {"1600x1200x16", 0x3D, 1600, 1200, 16, 1, 200, 75},
- {"1600x1200x24", 0x66, 1600, 1200, 32, 1, 200, 75},
- {"1600x1200x32", 0x66, 1600, 1200, 32, 1, 200, 75},
- {"1920x1440x8", 0x68, 1920, 1440, 8, 1, 240, 75},
- {"1920x1440x16", 0x69, 1920, 1440, 16, 1, 240, 75},
- {"1920x1440x24", 0x6B, 1920, 1440, 32, 1, 240, 75},
- {"1920x1440x32", 0x6B, 1920, 1440, 32, 1, 240, 75},
- {"2048x1536x8", 0x6c, 2048, 1536, 8, 1, 256, 96}, /* TW: 310/325 series only */
- {"2048x1536x16", 0x6d, 2048, 1536, 16, 1, 256, 96},
- {"2048x1536x24", 0x6e, 2048, 1536, 32, 1, 256, 96},
- {"2048x1536x32", 0x6e, 2048, 1536, 32, 1, 256, 96},
- {"\0", 0x00, 0, 0, 0, 0, 0, 0}
+ {"1280x960x8", 0x7C, 0x0000, 0x0000, 1280, 960, 8, 1, 160, 60, MD_SIS300|MD_SIS315}, /* TW: Modenumbers being patched */
+ {"1280x960x16", 0x7D, 0x0000, 0x0000, 1280, 960, 16, 1, 160, 60, MD_SIS300|MD_SIS315},
+ {"1280x960x24", 0x7E, 0x0000, 0x0000, 1280, 960, 32, 1, 160, 60, MD_SIS300|MD_SIS315},
+ {"1280x960x32", 0x7E, 0x0000, 0x0000, 1280, 960, 32, 1, 160, 60, MD_SIS300|MD_SIS315},
+ {"1280x1024x8", 0x3A, 0x0107, 0x0107, 1280, 1024, 8, 2, 160, 64, MD_SIS300|MD_SIS315},
+ {"1280x1024x16", 0x4D, 0x011a, 0x011a, 1280, 1024, 16, 2, 160, 64, MD_SIS300|MD_SIS315},
+ {"1280x1024x24", 0x65, 0x013d, 0x011b, 1280, 1024, 32, 2, 160, 64, MD_SIS300|MD_SIS315},
+ {"1280x1024x32", 0x65, 0x013d, 0x011b, 1280, 1024, 32, 2, 160, 64, MD_SIS300|MD_SIS315},
+ {"1400x1050x8", 0x26, 0x0000, 0x0000, 1400, 1050, 8, 1, 175, 65, MD_SIS315}, /* TW: 310/325 series only */
+ {"1400x1050x16", 0x27, 0x0000, 0x0000, 1400, 1050, 16, 1, 175, 65, MD_SIS315},
+ {"1400x1050x24", 0x28, 0x0000, 0x0000, 1400, 1050, 32, 1, 175, 65, MD_SIS315},
+ {"1400x1050x32", 0x28, 0x0000, 0x0000, 1400, 1050, 32, 1, 175, 65, MD_SIS315},
+ {"1600x1200x8", 0x3C, 0x0130, 0x011c, 1600, 1200, 8, 1, 200, 75, MD_SIS300|MD_SIS315},
+ {"1600x1200x16", 0x3D, 0x0131, 0x011e, 1600, 1200, 16, 1, 200, 75, MD_SIS300|MD_SIS315},
+ {"1600x1200x24", 0x66, 0x013e, 0x011f, 1600, 1200, 32, 1, 200, 75, MD_SIS300|MD_SIS315},
+ {"1600x1200x32", 0x66, 0x013e, 0x011f, 1600, 1200, 32, 1, 200, 75, MD_SIS300|MD_SIS315},
+ {"1920x1440x8", 0x68, 0x013f, 0x0000, 1920, 1440, 8, 1, 240, 75, MD_SIS300|MD_SIS315},
+ {"1920x1440x16", 0x69, 0x0140, 0x0000, 1920, 1440, 16, 1, 240, 75, MD_SIS300|MD_SIS315},
+ {"1920x1440x24", 0x6B, 0x0141, 0x0000, 1920, 1440, 32, 1, 240, 75, MD_SIS300|MD_SIS315},
+ {"1920x1440x32", 0x6B, 0x0141, 0x0000, 1920, 1440, 32, 1, 240, 75, MD_SIS300|MD_SIS315},
+ {"2048x1536x8", 0x6c, 0x0000, 0x0000, 2048, 1536, 8, 1, 256, 96, MD_SIS315}, /* TW: 310/325 series only */
+ {"2048x1536x16", 0x6d, 0x0000, 0x0000, 2048, 1536, 16, 1, 256, 96, MD_SIS315},
+ {"2048x1536x24", 0x6e, 0x0000, 0x0000, 2048, 1536, 32, 1, 256, 96, MD_SIS315},
+ {"2048x1536x32", 0x6e, 0x0000, 0x0000, 2048, 1536, 32, 1, 256, 96, MD_SIS315},
+ {"\0", 0x00, 0, 0, 0, 0, 0, 0, 0}
};
/* mode-related variables */
-int sisfb_mode_idx = MODE_INDEX_NONE;
-u8 sisfb_mode_no = 0;
+#ifdef MODULE
+int sisfb_mode_idx = MODE_INDEX_NONE; /* Don't use a mode by default if we are a module */
+#else
+int sisfb_mode_idx = -1; /* Use a default mode if we are inside the kernel */
+#endif
+u8 sisfb_mode_no = 0;
u8 sisfb_rate_idx = 0;
/* TW: CR36 evaluation */
-USHORT sis300paneltype[] =
+const USHORT sis300paneltype[] =
{ LCD_UNKNOWN, LCD_800x600, LCD_1024x768, LCD_1280x1024,
LCD_1280x960, LCD_640x480, LCD_1024x600, LCD_1152x768,
LCD_320x480, LCD_1024x768, LCD_1024x768, LCD_1024x768,
LCD_1024x768, LCD_1024x768, LCD_1024x768, LCD_1024x768 };
-USHORT sis310paneltype[] =
+const USHORT sis310paneltype[] =
{ LCD_UNKNOWN, LCD_800x600, LCD_1024x768, LCD_1280x1024,
LCD_640x480, LCD_1024x600, LCD_1152x864, LCD_1280x960,
LCD_1152x768, LCD_1400x1050,LCD_1280x768, LCD_1600x1200,
LCD_320x480, LCD_1024x768, LCD_1024x768, LCD_1024x768 };
static const struct _sis_crt2type {
- char name[6];
+ char name[10];
int type_no;
+ int tvplug_no;
} sis_crt2type[] = {
- {"NONE", 0},
- {"LCD", DISPTYPE_LCD},
- {"TV", DISPTYPE_TV},
- {"VGA", DISPTYPE_CRT2},
- {"none", 0}, /* TW: make it fool-proof */
- {"lcd", DISPTYPE_LCD},
- {"tv", DISPTYPE_TV},
- {"vga", DISPTYPE_CRT2},
- {"\0", -1}
+ {"NONE", 0, -1},
+ {"LCD", DISPTYPE_LCD, -1},
+ {"TV", DISPTYPE_TV, -1},
+ {"VGA", DISPTYPE_CRT2, -1},
+ {"SVIDEO", DISPTYPE_TV, TVPLUG_SVIDEO},
+ {"COMPOSITE", DISPTYPE_TV, TVPLUG_COMPOSITE},
+ {"SCART", DISPTYPE_TV, TVPLUG_SCART},
+ {"none", 0, -1},
+ {"lcd", DISPTYPE_LCD, -1},
+ {"tv", DISPTYPE_TV, -1},
+ {"vga", DISPTYPE_CRT2, -1},
+ {"svideo", DISPTYPE_TV, TVPLUG_SVIDEO},
+ {"composite", DISPTYPE_TV, TVPLUG_COMPOSITE},
+ {"scart", DISPTYPE_TV, TVPLUG_SCART},
+ {"\0", -1, -1}
};
/* Queue mode selection for 310 series */
@@ -462,16 +576,28 @@ static const struct _sis_queuemode {
char name[6];
int type_no;
} sis_queuemode[] = {
- {"AGP", AGP_CMD_QUEUE},
- {"VRAM", VM_CMD_QUEUE},
- {"MMIO", MMIO_CMD},
- {"agp", AGP_CMD_QUEUE},
- {"vram", VM_CMD_QUEUE},
- {"mmio", MMIO_CMD},
- {"\0", -1}
+ {"AGP", AGP_CMD_QUEUE},
+ {"VRAM", VM_CMD_QUEUE},
+ {"MMIO", MMIO_CMD},
+ {"agp", AGP_CMD_QUEUE},
+ {"vram", VM_CMD_QUEUE},
+ {"mmio", MMIO_CMD},
+ {"\0", -1}
+};
+
+/* TV standard */
+static const struct _sis_tvtype {
+ char name[6];
+ int type_no;
+} sis_tvtype[] = {
+ {"PAL", 1},
+ {"NTSC", 2},
+ {"pal", 1},
+ {"ntsc", 2},
+ {"\0", -1}
};
-static struct _sis_vrate {
+static const struct _sis_vrate {
u16 idx;
u16 xres;
u16 yres;
@@ -486,25 +612,34 @@ static struct _sis_vrate {
{5, 800, 600, 85}, {6, 800, 600, 100}, {7, 800, 600, 120}, {8, 800, 600, 160},
{1, 1024, 768, 43}, {2, 1024, 768, 60}, {3, 1024, 768, 70}, {4, 1024, 768, 75},
{5, 1024, 768, 85}, {6, 1024, 768, 100}, {7, 1024, 768, 120},
- {1, 1024, 576, 60}, {2, 1024, 576, 65}, {3, 1024, 576, 75},
+ {1, 1024, 576, 60}, {2, 1024, 576, 75}, {3, 1024, 576, 85},
{1, 1024, 600, 60},
{1, 1152, 768, 60},
{1, 1280, 720, 60}, {2, 1280, 720, 75}, {3, 1280, 720, 85},
{1, 1280, 768, 60},
{1, 1280, 1024, 43}, {2, 1280, 1024, 60}, {3, 1280, 1024, 75}, {4, 1280, 1024, 85},
- {1, 1280, 960, 60},
+ {1, 1280, 960, 70},
{1, 1400, 1050, 60},
{1, 1600, 1200, 60}, {2, 1600, 1200, 65}, {3, 1600, 1200, 70}, {4, 1600, 1200, 75},
{5, 1600, 1200, 85}, {6, 1600, 1200, 100}, {7, 1600, 1200, 120},
- /* TW: Clock values for 1920x1440 guessed (except for the first one) */
- {1, 1920, 1440, 60}, {2, 1920, 1440, 70}, {3, 1920, 1440, 75}, {4, 1920, 1440, 85},
- {5, 1920, 1440,100}, {6, 1920, 1440, 120},
- /* TW: Clock values for 2048x1536 guessed */
- {1, 2048, 1536, 60}, {2, 2048, 1536, 70}, {3, 2048, 1536, 75}, {4, 2048, 1536, 85},
- {5, 2048, 1536,100},
+ {1, 1920, 1440, 60}, {2, 1920, 1440, 65}, {3, 1920, 1440, 70}, {4, 1920, 1440, 75},
+ {5, 1920, 1440, 85}, {6, 1920, 1440, 100},
+ {1, 2048, 1536, 60}, {2, 2048, 1536, 65}, {3, 2048, 1536, 70}, {4, 2048, 1536, 75},
+ {5, 2048, 1536, 85},
{0, 0, 0, 0}
};
+static const struct _chswtable {
+ int subsysVendor;
+ int subsysCard;
+ char *vendorName;
+ char *cardName;
+} mychswtable[] = {
+ { 0x1631, 0x1002, "Mitachi", "0x1002" },
+ { 0, 0, "" , "" }
+};
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
/* Offscreen layout */
typedef struct _SIS_GLYINFO {
unsigned char ch;
@@ -513,6 +648,7 @@ typedef struct _SIS_GLYINFO {
u8 gmask[72];
int ngmask;
} SIS_GLYINFO;
+#endif
typedef struct _SIS_OH {
struct _SIS_OH *poh_next;
@@ -539,10 +675,10 @@ static unsigned long sisfb_hwcursor_vbase;
static unsigned long sisfb_heap_start;
static unsigned long sisfb_heap_end;
static unsigned long sisfb_heap_size;
-static SIS_HEAP sisfb_heap;
+static SIS_HEAP sisfb_heap;
// Eden Chen
-static struct _sis_TV_filter {
+static const struct _sis_TV_filter {
u8 filter[9][4];
} sis_TV_filter[] = {
{ {{0x00,0x00,0x00,0x40}, /* NTSCFilter_0 */
@@ -691,114 +827,172 @@ static struct _sis_TV_filter {
{0xFF,0xFF,0xFF,0xFF} }}
};
-static int filter = -1;
+static int filter = -1;
static unsigned char filter_tb;
//~Eden Chen
-/* ---------------------- Routine Prototype ------------------------- */
+/* ---------------------- Routine prototypes ------------------------- */
/* Interface used by the world */
-int sisfb_setup(char *options);
-static int sisfb_get_fix(struct fb_fix_screeninfo *fix, int con,
- struct fb_info *info);
-static int sisfb_get_var(struct fb_var_screeninfo *var, int con,
- struct fb_info *info);
-static int sisfb_set_var(struct fb_var_screeninfo *var, int con,
- struct fb_info *info);
-static int sisfb_get_cmap(struct fb_cmap *cmap, int kspc, int con,
- struct fb_info *info);
-static int sisfb_set_cmap(struct fb_cmap *cmap, int kspc, int con,
- struct fb_info *info);
-static int sisfb_ioctl(struct inode *inode, struct file *file,
- unsigned int cmd, unsigned long arg, int con,
- struct fb_info *info);
+#ifndef MODULE
+int sisfb_setup(char *options);
+#endif
/* Interface to the low level console driver */
-int sisfb_init(void);
-static int sisfb_update_var(int con, struct fb_info *info);
-static int sisfb_switch(int con, struct fb_info *info);
-static void sisfb_blank(int blank, struct fb_info *info);
-
-/* hardware access routines */
-void sisfb_set_reg1(u16 port, u16 index, u16 data);
-void sisfb_set_reg3(u16 port, u16 data);
-void sisfb_set_reg4(u16 port, unsigned long data);
-u8 sisfb_get_reg1(u16 port, u16 index);
-u8 sisfb_get_reg2(u16 port);
-u32 sisfb_get_reg3(u16 port);
-
-/* Internal routines */
-static void sisfb_search_mode(const char *name);
-static void sisfb_validate_mode(void);
-static u8 sisfb_search_refresh_rate(unsigned int rate);
-static int sis_getcolreg(unsigned regno, unsigned *red, unsigned *green,
- unsigned *blue, unsigned *transp,
- struct fb_info *fb_info);
-static int sisfb_setcolreg(unsigned regno, unsigned red, unsigned green,
- unsigned blue, unsigned transp,
- struct fb_info *fb_info);
-static int sisfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
- struct fb_info *info);
-static void sisfb_set_disp(int con, struct fb_var_screeninfo *var);
-static void sisfb_do_install_cmap(int con, struct fb_info *info);
-
-/* Chip-dependent Routines */
+int sisfb_init(void);
+
+/* fbdev routines */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+static int sisfb_get_fix(struct fb_fix_screeninfo *fix,
+ int con,
+ struct fb_info *info);
+static int sisfb_get_var(struct fb_var_screeninfo *var,
+ int con,
+ struct fb_info *info);
+static int sisfb_set_var(struct fb_var_screeninfo *var,
+ int con,
+ struct fb_info *info);
+static void sisfb_crtc_to_var(struct fb_var_screeninfo *var);
+static int sisfb_get_cmap(struct fb_cmap *cmap,
+ int kspc,
+ int con,
+ struct fb_info *info);
+static int sisfb_set_cmap(struct fb_cmap *cmap,
+ int kspc,
+ int con,
+ struct fb_info *info);
+static int sisfb_update_var(int con,
+ struct fb_info *info);
+static int sisfb_switch(int con,
+ struct fb_info *info);
+static void sisfb_blank(int blank,
+ struct fb_info *info);
+static void sisfb_set_disp(int con,
+ struct fb_var_screeninfo *var,
+ struct fb_info *info);
+static int sis_getcolreg(unsigned regno, unsigned *red, unsigned *green,
+ unsigned *blue, unsigned *transp,
+ struct fb_info *fb_info);
+static void sisfb_do_install_cmap(int con,
+ struct fb_info *info);
+static void sis_get_glyph(struct fb_info *info,
+ SIS_GLYINFO *gly);
+static int sisfb_mmap(struct fb_info *info, struct file *file,
+ struct vm_area_struct *vma);
+static int sisfb_ioctl(struct inode *inode, struct file *file,
+ unsigned int cmd, unsigned long arg, int con,
+ struct fb_info *info);
+#endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+static int sisfb_set_par(struct fb_info *info);
+static int sisfb_blank(int blank,
+ struct fb_info *info);
+static int sisfb_mmap(struct fb_info *info, struct file *file,
+ struct vm_area_struct *vma);
+extern void sisfb_fillrect(struct fb_info *info,
+ const struct fb_fillrect *rect);
+extern void sisfb_copyarea(struct fb_info *info,
+ const struct fb_copyarea *area);
+extern int sisfb_sync(struct fb_info *info);
+static int sisfb_ioctl(struct inode *inode,
+ struct file *file,
+ unsigned int cmd,
+ unsigned long arg,
+ struct fb_info *info);
+extern int sisfb_mode_rate_to_dclock(SiS_Private *SiS_Pr,
+ PSIS_HW_DEVICE_INFO HwDeviceExtension,
+ unsigned char modeno, unsigned char rateindex);
+extern int sisfb_mode_rate_to_ddata(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,
+ unsigned char modeno, unsigned char rateindex,
+ unsigned int *left_margin, unsigned int *right_margin,
+ unsigned int *upper_margin, unsigned int *lower_margin,
+ unsigned int *hsync_len, unsigned int *vsync_len,
+ unsigned int *sync, unsigned int *vmode);
+#endif
+
+static int sisfb_get_fix(struct fb_fix_screeninfo *fix, int con,
+ struct fb_info *info);
+
+/* Internal 2D accelerator functions */
+extern int sisfb_initaccel(void);
+extern void sisfb_syncaccel(void);
+
+/* Internal general routines */
+static void sisfb_search_mode(const char *name);
+static int sisfb_validate_mode(int modeindex);
+static u8 sisfb_search_refresh_rate(unsigned int rate);
+static int sisfb_setcolreg(unsigned regno, unsigned red, unsigned green,
+ unsigned blue, unsigned transp,
+ struct fb_info *fb_info);
+static int sisfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
+ struct fb_info *info);
+static void sisfb_pre_setmode(void);
+static void sisfb_post_setmode(void);
+
+static char * sis_find_rom(void);
+static BOOLEAN sisfb_CheckVBRetrace(void);
+static BOOLEAN sisfbcheckvretracecrt2(void);
+static BOOLEAN sisfbcheckvretracecrt1(void);
+static BOOLEAN sisfb_bridgeisslave(void);
+
+/* SiS-specific Export functions */
+void sis_dispinfo(struct ap_data *rec);
+void sis_malloc(struct sis_memreq *req);
+void sis_free(unsigned long base);
+
+/* Internal hardware access routines */
+void sisfb_set_reg4(u16 port, unsigned long data);
+u32 sisfb_get_reg3(u16 port);
+
+/* Chipset-dependent internal routines */
#ifdef CONFIG_FB_SIS_300
-static int sisfb_get_dram_size_300(void);
-static void sisfb_detect_VB_connect_300(void);
-static void sisfb_get_VB_type_300(void);
-static int sisfb_has_VB_300(void);
+static int sisfb_get_dram_size_300(void);
+static void sisfb_detect_VB_connect_300(void);
+static void sisfb_get_VB_type_300(void);
+static int sisfb_has_VB_300(void);
#endif
#ifdef CONFIG_FB_SIS_315
-static int sisfb_get_dram_size_315(void);
-static void sisfb_detect_VB_connect_315(void);
-static void sisfb_get_VB_type_315(void);
-static int sisfb_has_VB_315(void);
+static int sisfb_get_dram_size_315(void);
+static void sisfb_detect_VB_connect_315(void);
+static void sisfb_get_VB_type_315(void);
+static int sisfb_has_VB_315(void);
#endif
-/* Routines from init.c/init301.c */
+/* Internal heap routines */
+static int sisfb_heap_init(void);
+static SIS_OH *sisfb_poh_new_node(void);
+static SIS_OH *sisfb_poh_allocate(unsigned long size);
+static void sisfb_delete_node(SIS_OH *poh);
+static void sisfb_insert_node(SIS_OH *pohList, SIS_OH *poh);
+static SIS_OH *sisfb_poh_free(unsigned long base);
+static void sisfb_free_node(SIS_OH *poh);
-extern void SiSRegInit(USHORT BaseAddr);
-extern BOOLEAN SiSInit(PSIS_HW_DEVICE_INFO HwDeviceExtension);
-extern BOOLEAN SiSSetMode(PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT ModeNo);
-extern void SetEnableDstn(void);
+/* Internal routines to access PCI configuration space */
+BOOLEAN sisfb_query_VGA_config_space(PSIS_HW_DEVICE_INFO psishw_ext,
+ unsigned long offset, unsigned long set, unsigned long *value);
+BOOLEAN sisfb_query_north_bridge_space(PSIS_HW_DEVICE_INFO psishw_ext,
+ unsigned long offset, unsigned long set, unsigned long *value);
-/* TW: Chrontel TV functions */
-extern USHORT SiS_IF_DEF_CH70xx;
-extern USHORT SiS_GetCH700x(USHORT tempbx);
-extern void SiS_SetCH700x(USHORT tempbx);
-extern USHORT SiS_GetCH701x(USHORT tempbx);
-extern void SiS_SetCH701x(USHORT tempbx);
-extern void SiS_SetCH70xxANDOR(USHORT tempax,USHORT tempbh);
-extern void SiS_DDC2Delay(USHORT delaytime);
-
-static void sisfb_pre_setmode(void);
-static void sisfb_post_setmode(void);
-static void sisfb_crtc_to_var(struct fb_var_screeninfo *var);
-
-/* Export functions */
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,23)
-static void sis_get_glyph(SIS_GLYINFO *gly);
-#else
-static void sis_get_glyph(struct fb_info *info, SIS_GLYINFO *gly);
-#endif
-void sis_dispinfo(struct ap_data *rec);
-void sis_malloc(struct sis_memreq *req);
-void sis_free(unsigned long base);
-
-/* heap routines */
-static int sisfb_heap_init(void);
-static SIS_OH *sisfb_poh_new_node(void);
-static SIS_OH *sisfb_poh_allocate(unsigned long size);
-static void sisfb_delete_node(SIS_OH *poh);
-static void sisfb_insert_node(SIS_OH *pohList, SIS_OH *poh);
-static SIS_OH *sisfb_poh_free(unsigned long base);
-static void sisfb_free_node(SIS_OH *poh);
-
-/* routines to access PCI configuration space */
-BOOLEAN sisfb_query_VGA_config_space(PSIS_HW_DEVICE_INFO psishw_ext,
- unsigned long offset, unsigned long set, unsigned long *value);
-BOOLEAN sisfb_query_north_bridge_space(PSIS_HW_DEVICE_INFO psishw_ext,
- unsigned long offset, unsigned long set, unsigned long *value);
+/* Routines from init.c/init301.c */
+extern void SiSRegInit(SiS_Private *SiS_Pr, USHORT BaseAddr);
+extern BOOLEAN SiSInit(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension);
+extern BOOLEAN SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT ModeNo);
+extern void SiS_SetEnableDstn(SiS_Private *SiS_Pr);
+extern void SiS_LongWait(SiS_Private *SiS_Pr);
+
+/* TW: Chrontel TV functions */
+extern USHORT SiS_GetCH700x(SiS_Private *SiS_Pr, USHORT tempbx);
+extern void SiS_SetCH700x(SiS_Private *SiS_Pr, USHORT tempbx);
+extern USHORT SiS_GetCH701x(SiS_Private *SiS_Pr, USHORT tempbx);
+extern void SiS_SetCH701x(SiS_Private *SiS_Pr, USHORT tempbx);
+extern void SiS_SetCH70xxANDOR(SiS_Private *SiS_Pr, USHORT tempax,USHORT tempbh);
+extern void SiS_DDC2Delay(SiS_Private *SiS_Pr, USHORT delaytime);
+
+/* TW: Sensing routines */
+void SiS_Sense30x(void);
+int SISDoSense(int tempbl, int tempbh, int tempcl, int tempch);
+void SiS_SenseCh(void);
+
#endif
diff --git a/drivers/video/sis/vgatypes.h b/drivers/video/sis/vgatypes.h
index 2385034e3401..b88e67ad9711 100644
--- a/drivers/video/sis/vgatypes.h
+++ b/drivers/video/sis/vgatypes.h
@@ -99,9 +99,8 @@ typedef enum _SIS_CHIP_TYPE {
SIS_315,
SIS_315PRO, /* SiS 325 */
SIS_550,
- SIS_640,
- SIS_740,
SIS_650,
+ SIS_740,
SIS_330,
MAX_SIS_CHIP
} SIS_CHIP_TYPE;
@@ -119,7 +118,6 @@ typedef enum _SIS_VB_CHIP_TYPE {
VB_CHIP_302,
VB_CHIP_302B,
VB_CHIP_302LV,
- VB_CHIP_303,
VB_CHIP_UNKNOWN, /* other video bridge or no video bridge */
MAX_VB_CHIP
} SIS_VB_CHIP_TYPE;
@@ -174,6 +172,7 @@ struct _SIS_HW_DEVICE_INFO
/* if NULL, then read from pjROMImage; */
/* Note:ROM image file is the file of VBIOS ROM */
+ BOOLEAN UseROM; /* TW: Use the ROM image if provided */
UCHAR *pjCustomizedROMImage;/* base virtual address of ROM image file. */
/* wincE:ROM image file is the file for OEM */
@@ -208,6 +207,7 @@ struct _SIS_HW_DEVICE_INFO
/* 011:Trumpion LVDS Scaling Chip */
/* 100:LVDS(LCD-out)+Chrontel 7005 */
/* 101:Single Chrontel 7005 */
+ /* TW: This has changed on 310/325 series! */
ULONG ulCRT2LCDType; /* defined in the data structure type */
/* "SIS_LCD_TYPE" */
@@ -234,13 +234,17 @@ struct _SIS_HW_DEVICE_INFO
UCHAR szVBIOSVer[VBIOS_VER_MAX_LENGTH];
UCHAR pdc; /* TW: PanelDelayCompensation */
+
+#ifdef LINUX_KERNEL
+ BOOLEAN Is301BDH;
+#endif
#ifdef LINUX_XF86
PCITAG PciTag; /* PCI Tag for Linux XF86 */
#endif
};
#endif
-#endif /*~ mark by Paul ,Move definition to sisv.h */
+#endif
/* TW: Addtional IOCTL for communication sisfb <> X driver */
@@ -268,7 +272,19 @@ struct _SISFB_INFO {
unsigned char sisfb_revision;
unsigned char sisfb_patchlevel;
- char reserved[253]; /* for future use */
+ unsigned char sisfb_caps; /* sisfb's capabilities */
+
+ int sisfb_tqlen; /* turbo queue length (in KB) */
+
+ unsigned int sisfb_pcibus; /* The card's PCI ID */
+ unsigned int sisfb_pcislot;
+ unsigned int sisfb_pcifunc;
+
+ unsigned char sisfb_lcdpdc;
+
+ unsigned char sisfb_lcda;
+
+ char reserved[235]; /* for future use */
};
#endif
diff --git a/drivers/video/sis/vstruct.h b/drivers/video/sis/vstruct.h
index e903f420406f..c355ac9eaf88 100644
--- a/drivers/video/sis/vstruct.h
+++ b/drivers/video/sis/vstruct.h
@@ -4,9 +4,12 @@
#define EXTERN extern
#endif /* _INIT_ */
+#ifndef _VSTRUCT_
+#define _VSTRUCT_
+
typedef struct _SiS_PanelDelayTblStruct
{
- UCHAR timer[2];
+ UCHAR timer[2];
} SiS_PanelDelayTblStruct;
typedef struct _SiS_LCDDataStruct
@@ -28,12 +31,12 @@ typedef struct _SiS_TVDataStruct
USHORT TVHDE;
USHORT TVVDE;
USHORT RVBHRS;
- UCHAR FlickerMode;
+ UCHAR FlickerMode;
USHORT HALFRVBHRS;
- UCHAR RY1COE;
- UCHAR RY2COE;
- UCHAR RY3COE;
- UCHAR RY4COE;
+ UCHAR RY1COE;
+ UCHAR RY2COE;
+ UCHAR RY3COE;
+ UCHAR RY4COE;
} SiS_TVDataStruct;
typedef struct _SiS_LVDSDataStruct
@@ -52,30 +55,30 @@ typedef struct _SiS_LVDSDesStruct
typedef struct _SiS_LVDSCRT1DataStruct
{
- UCHAR CR[15];
+ UCHAR CR[15];
} SiS_LVDSCRT1DataStruct;
/*add for LCDA*/
typedef struct _SiS_LCDACRT1DataStruct
{
- UCHAR CR[17];
+ UCHAR CR[17];
} SiS_LCDACRT1DataStruct;
typedef struct _SiS_CHTVRegDataStruct
{
- UCHAR Reg[16];
+ UCHAR Reg[16];
} SiS_CHTVRegDataStruct;
typedef struct _SiS_StStruct
{
- UCHAR St_ModeID;
+ UCHAR St_ModeID;
USHORT St_ModeFlag;
- UCHAR St_StTableIndex;
- UCHAR St_CRT2CRTC;
- UCHAR St_ResInfo;
- UCHAR VB_StTVFlickerIndex;
- UCHAR VB_StTVEdgeIndex;
- UCHAR VB_StTVYFilterIndex;
+ UCHAR St_StTableIndex;
+ UCHAR St_CRT2CRTC;
+ UCHAR St_ResInfo;
+ UCHAR VB_StTVFlickerIndex;
+ UCHAR VB_StTVEdgeIndex;
+ UCHAR VB_StTVYFilterIndex;
} SiS_StStruct;
typedef struct _SiS_VBModeStruct
@@ -92,38 +95,38 @@ typedef struct _SiS_VBModeStruct
typedef struct _SiS_StandTableStruct
{
- UCHAR CRT_COLS;
- UCHAR ROWS;
- UCHAR CHAR_HEIGHT;
+ UCHAR CRT_COLS;
+ UCHAR ROWS;
+ UCHAR CHAR_HEIGHT;
USHORT CRT_LEN;
- UCHAR SR[4];
- UCHAR MISC;
- UCHAR CRTC[0x19];
- UCHAR ATTR[0x14];
- UCHAR GRC[9];
+ UCHAR SR[4];
+ UCHAR MISC;
+ UCHAR CRTC[0x19];
+ UCHAR ATTR[0x14];
+ UCHAR GRC[9];
} SiS_StandTableStruct;
typedef struct _SiS_ExtStruct
{
- UCHAR Ext_ModeID;
+ UCHAR Ext_ModeID;
USHORT Ext_ModeFlag;
USHORT Ext_ModeInfo;
USHORT Ext_Point;
USHORT Ext_VESAID;
- UCHAR Ext_VESAMEMSize;
- UCHAR Ext_RESINFO;
- UCHAR VB_ExtTVFlickerIndex;
- UCHAR VB_ExtTVEdgeIndex;
- UCHAR VB_ExtTVYFilterIndex;
- UCHAR REFindex;
+ UCHAR Ext_VESAMEMSize;
+ UCHAR Ext_RESINFO;
+ UCHAR VB_ExtTVFlickerIndex;
+ UCHAR VB_ExtTVEdgeIndex;
+ UCHAR VB_ExtTVYFilterIndex;
+ UCHAR REFindex;
} SiS_ExtStruct;
typedef struct _SiS_Ext2Struct
{
USHORT Ext_InfoFlag;
- UCHAR Ext_CRT1CRTC;
- UCHAR Ext_CRTVCLK;
- UCHAR Ext_CRT2CRTC;
+ UCHAR Ext_CRT1CRTC;
+ UCHAR Ext_CRTVCLK;
+ UCHAR Ext_CRT2CRTC;
UCHAR ModeID;
USHORT XRes;
USHORT YRes;
@@ -132,35 +135,35 @@ typedef struct _SiS_Ext2Struct
typedef struct _SiS_Part2PortTblStruct
{
- UCHAR CR[12];
+ UCHAR CR[12];
} SiS_Part2PortTblStruct;
typedef struct _SiS_CRT1TableStruct
{
- UCHAR CR[17];
+ UCHAR CR[17];
} SiS_CRT1TableStruct;
typedef struct _SiS_MCLKDataStruct
{
- UCHAR SR28,SR29,SR2A;
+ UCHAR SR28,SR29,SR2A;
USHORT CLOCK;
} SiS_MCLKDataStruct;
typedef struct _SiS_ECLKDataStruct
{
- UCHAR SR2E,SR2F,SR30;
+ UCHAR SR2E,SR2F,SR30;
USHORT CLOCK;
} SiS_ECLKDataStruct;
typedef struct _SiS_VCLKDataStruct
{
- UCHAR SR2B,SR2C;
+ UCHAR SR2B,SR2C;
USHORT CLOCK;
} SiS_VCLKDataStruct;
typedef struct _SiS_VBVCLKDataStruct
{
- UCHAR Part4_A,Part4_B;
+ UCHAR Part4_A,Part4_B;
USHORT CLOCK;
} SiS_VBVCLKDataStruct;
@@ -178,213 +181,401 @@ typedef struct _SiS_ModeResInfoStruct
UCHAR YChar;
} SiS_ModeResInfoStruct;
-EXTERN SiS_StStruct *SiS_SModeIDTable;
-EXTERN SiS_StandTableStruct *SiS_StandTable;
-EXTERN SiS_ExtStruct *SiS_EModeIDTable;
-EXTERN SiS_Ext2Struct *SiS_RefIndex;
-EXTERN SiS_VBModeStruct *SiS_VBModeIDTable;
-EXTERN SiS_CRT1TableStruct *SiS_CRT1Table;
-EXTERN SiS_MCLKDataStruct *SiS_MCLKData_0;
-EXTERN SiS_MCLKDataStruct *SiS_MCLKData_1;
-EXTERN SiS_ECLKDataStruct *SiS_ECLKData;
-EXTERN SiS_VCLKDataStruct *SiS_VCLKData;
-EXTERN SiS_VBVCLKDataStruct *SiS_VBVCLKData;
-EXTERN SiS_StResInfoStruct *SiS_StResInfo;
-EXTERN SiS_ModeResInfoStruct *SiS_ModeResInfo;
-EXTERN UCHAR *SiS_ScreenOffset;
-
-EXTERN UCHAR *pSiS_OutputSelect;
-EXTERN UCHAR *pSiS_SoftSetting;
-EXTERN UCHAR *pSiS_SR07;
-
typedef UCHAR DRAM4Type[4];
-EXTERN DRAM4Type *SiS_SR15; /* pointer : point to array */
-EXTERN DRAM4Type *SiS_CR40; /* pointer : point to array */
-EXTERN UCHAR *SiS_CR49;
-EXTERN UCHAR *SiS_SR25;
-
-EXTERN UCHAR *pSiS_SR1F;
-EXTERN UCHAR *pSiS_SR21;
-EXTERN UCHAR *pSiS_SR22;
-EXTERN UCHAR *pSiS_SR23;
-EXTERN UCHAR *pSiS_SR24;
-EXTERN UCHAR *pSiS_SR31;
-EXTERN UCHAR *pSiS_SR32;
-EXTERN UCHAR *pSiS_SR33;
-EXTERN UCHAR *pSiS_CRT2Data_1_2;
-EXTERN UCHAR *pSiS_CRT2Data_4_D;
-EXTERN UCHAR *pSiS_CRT2Data_4_E;
-EXTERN UCHAR *pSiS_CRT2Data_4_10;
-EXTERN USHORT *pSiS_RGBSenseData;
-EXTERN USHORT *pSiS_VideoSenseData;
-EXTERN USHORT *pSiS_YCSenseData;
-EXTERN USHORT *pSiS_RGBSenseData2; /*301b*/
-EXTERN USHORT *pSiS_VideoSenseData2;
-EXTERN USHORT *pSiS_YCSenseData2;
-
-EXTERN UCHAR *SiS_NTSCPhase;
-EXTERN UCHAR *SiS_PALPhase;
-EXTERN UCHAR *SiS_NTSCPhase2;
-EXTERN UCHAR *SiS_PALPhase2;
-EXTERN UCHAR *SiS_PALMPhase;
-EXTERN UCHAR *SiS_PALNPhase;
-EXTERN UCHAR *SiS_PALMPhase2;
-EXTERN UCHAR *SiS_PALNPhase2;
-EXTERN SiS_LCDDataStruct *SiS_StLCD1024x768Data;
-EXTERN SiS_LCDDataStruct *SiS_ExtLCD1024x768Data;
-EXTERN SiS_LCDDataStruct *SiS_St2LCD1024x768Data;
-EXTERN SiS_LCDDataStruct *SiS_StLCD1280x1024Data;
-EXTERN SiS_LCDDataStruct *SiS_ExtLCD1280x1024Data;
-EXTERN SiS_LCDDataStruct *SiS_St2LCD1280x1024Data;
-EXTERN SiS_LCDDataStruct *SiS_NoScaleData1024x768;
-EXTERN SiS_LCDDataStruct *SiS_NoScaleData1280x1024;
-EXTERN SiS_LCDDataStruct *SiS_LCD1280x960Data;
-EXTERN SiS_TVDataStruct *SiS_StPALData;
-EXTERN SiS_TVDataStruct *SiS_ExtPALData;
-EXTERN SiS_TVDataStruct *SiS_StNTSCData;
-EXTERN SiS_TVDataStruct *SiS_ExtNTSCData;
-EXTERN SiS_TVDataStruct *SiS_St1HiTVData;
-EXTERN SiS_TVDataStruct *SiS_St2HiTVData;
-EXTERN SiS_TVDataStruct *SiS_ExtHiTVData;
-EXTERN UCHAR *SiS_NTSCTiming;
-EXTERN UCHAR *SiS_PALTiming;
-EXTERN UCHAR *SiS_HiTVExtTiming;
-EXTERN UCHAR *SiS_HiTVSt1Timing;
-EXTERN UCHAR *SiS_HiTVSt2Timing;
-EXTERN UCHAR *SiS_HiTVTextTiming;
-EXTERN UCHAR *SiS_HiTVGroup3Data;
-EXTERN UCHAR *SiS_HiTVGroup3Simu;
-EXTERN UCHAR *SiS_HiTVGroup3Text;
-
-EXTERN SiS_PanelDelayTblStruct *SiS_PanelDelayTbl;
-EXTERN SiS_PanelDelayTblStruct *SiS_PanelDelayTblLVDS;
-EXTERN SiS_LVDSDataStruct *SiS_LVDS800x600Data_1;
-EXTERN SiS_LVDSDataStruct *SiS_LVDS800x600Data_2;
-EXTERN SiS_LVDSDataStruct *SiS_LVDS1024x768Data_1;
-EXTERN SiS_LVDSDataStruct *SiS_LVDS1024x768Data_2;
-EXTERN SiS_LVDSDataStruct *SiS_LVDS1280x1024Data_1;
-EXTERN SiS_LVDSDataStruct *SiS_LVDS1280x1024Data_2;
-EXTERN SiS_LVDSDataStruct *SiS_LVDS1280x960Data_1;
-EXTERN SiS_LVDSDataStruct *SiS_LVDS1280x960Data_2;
-EXTERN SiS_LVDSDataStruct *SiS_LVDS1400x1050Data_1;
-EXTERN SiS_LVDSDataStruct *SiS_LVDS1400x1050Data_2;
-EXTERN SiS_LVDSDataStruct *SiS_LVDS1024x600Data_1;
-EXTERN SiS_LVDSDataStruct *SiS_LVDS1024x600Data_2;
-EXTERN SiS_LVDSDataStruct *SiS_LVDS1152x768Data_1;
-EXTERN SiS_LVDSDataStruct *SiS_LVDS1152x768Data_2;
-EXTERN SiS_LVDSDataStruct *SiS_LVDS640x480Data_1;
-EXTERN SiS_LVDSDataStruct *SiS_LVDS320x480Data_1;
-EXTERN SiS_LVDSDataStruct *SiS_LVDSXXXxXXXData_1;
-EXTERN SiS_LVDSDataStruct *SiS_CHTVUNTSCData;
-EXTERN SiS_LVDSDataStruct *SiS_CHTVONTSCData;
-EXTERN SiS_LVDSDataStruct *SiS_CHTVUPALData;
-EXTERN SiS_LVDSDataStruct *SiS_CHTVOPALData;
-EXTERN SiS_LVDSDesStruct *SiS_PanelType00_1;
-EXTERN SiS_LVDSDesStruct *SiS_PanelType01_1;
-EXTERN SiS_LVDSDesStruct *SiS_PanelType02_1;
-EXTERN SiS_LVDSDesStruct *SiS_PanelType03_1;
-EXTERN SiS_LVDSDesStruct *SiS_PanelType04_1;
-EXTERN SiS_LVDSDesStruct *SiS_PanelType05_1;
-EXTERN SiS_LVDSDesStruct *SiS_PanelType06_1;
-EXTERN SiS_LVDSDesStruct *SiS_PanelType07_1;
-EXTERN SiS_LVDSDesStruct *SiS_PanelType08_1;
-EXTERN SiS_LVDSDesStruct *SiS_PanelType09_1;
-EXTERN SiS_LVDSDesStruct *SiS_PanelType0a_1;
-EXTERN SiS_LVDSDesStruct *SiS_PanelType0b_1;
-EXTERN SiS_LVDSDesStruct *SiS_PanelType0c_1;
-EXTERN SiS_LVDSDesStruct *SiS_PanelType0d_1;
-EXTERN SiS_LVDSDesStruct *SiS_PanelType0e_1;
-EXTERN SiS_LVDSDesStruct *SiS_PanelType0f_1;
-EXTERN SiS_LVDSDesStruct *SiS_PanelType00_2;
-EXTERN SiS_LVDSDesStruct *SiS_PanelType01_2;
-EXTERN SiS_LVDSDesStruct *SiS_PanelType02_2;
-EXTERN SiS_LVDSDesStruct *SiS_PanelType03_2;
-EXTERN SiS_LVDSDesStruct *SiS_PanelType04_2;
-EXTERN SiS_LVDSDesStruct *SiS_PanelType05_2;
-EXTERN SiS_LVDSDesStruct *SiS_PanelType06_2;
-EXTERN SiS_LVDSDesStruct *SiS_PanelType07_2;
-EXTERN SiS_LVDSDesStruct *SiS_PanelType08_2;
-EXTERN SiS_LVDSDesStruct *SiS_PanelType09_2;
-EXTERN SiS_LVDSDesStruct *SiS_PanelType0a_2;
-EXTERN SiS_LVDSDesStruct *SiS_PanelType0b_2;
-EXTERN SiS_LVDSDesStruct *SiS_PanelType0c_2;
-EXTERN SiS_LVDSDesStruct *SiS_PanelType0d_2;
-EXTERN SiS_LVDSDesStruct *SiS_PanelType0e_2;
-EXTERN SiS_LVDSDesStruct *SiS_PanelType0f_2;
-
-EXTERN SiS_LVDSDesStruct *LVDS1024x768Des_1;
-EXTERN SiS_LVDSDesStruct *LVDS1280x1024Des_1;
-EXTERN SiS_LVDSDesStruct *LVDS1280x960Des_1;
-EXTERN SiS_LVDSDesStruct *LVDS1024x768Des_2;
-EXTERN SiS_LVDSDesStruct *LVDS1280x1024Des_2;
-EXTERN SiS_LVDSDesStruct *LVDS1280x960Des_2;
-
-EXTERN SiS_LVDSDesStruct *SiS_CHTVUNTSCDesData;
-EXTERN SiS_LVDSDesStruct *SiS_CHTVONTSCDesData;
-EXTERN SiS_LVDSDesStruct *SiS_CHTVUPALDesData;
-EXTERN SiS_LVDSDesStruct *SiS_CHTVOPALDesData;
-EXTERN SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1800x600_1;
-EXTERN SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x768_1;
-EXTERN SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11280x1024_1;
-EXTERN SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11400x1050_1;
-EXTERN SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x600_1;
-EXTERN SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11152x768_1;
-EXTERN SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1800x600_1_H;
-EXTERN SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x768_1_H;
-EXTERN SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11280x1024_1_H;
-EXTERN SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11400x1050_1_H;
-EXTERN SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x600_1_H;
-EXTERN SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11152x768_1_H;
-EXTERN SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1800x600_2;
-EXTERN SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x768_2;
-EXTERN SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11280x1024_2;
-EXTERN SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11400x1050_2;
-EXTERN SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x600_2;
-EXTERN SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11152x768_2;
-EXTERN SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1800x600_2_H;
-EXTERN SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x768_2_H;
-EXTERN SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11280x1024_2_H;
-EXTERN SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11400x1050_2_H;
-EXTERN SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x600_2_H;
-EXTERN SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11152x768_2_H;
-EXTERN SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1XXXxXXX_1;
-EXTERN SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1XXXxXXX_1_H;
-EXTERN SiS_LVDSCRT1DataStruct *SiS_CHTVCRT1UNTSC;
-EXTERN SiS_LVDSCRT1DataStruct *SiS_CHTVCRT1ONTSC;
-EXTERN SiS_LVDSCRT1DataStruct *SiS_CHTVCRT1UPAL;
-EXTERN SiS_LVDSCRT1DataStruct *SiS_CHTVCRT1OPAL;
-
-EXTERN SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1320x480_1;
-
-EXTERN SiS_LCDACRT1DataStruct *SiS_LCDACRT1800x600_1;
-EXTERN SiS_LCDACRT1DataStruct *SiS_LCDACRT11024x768_1;
-EXTERN SiS_LCDACRT1DataStruct *SiS_LCDACRT11280x1024_1;
-EXTERN SiS_LCDACRT1DataStruct *SiS_LCDACRT1800x600_1_H;
-EXTERN SiS_LCDACRT1DataStruct *SiS_LCDACRT11024x768_1_H;
-EXTERN SiS_LCDACRT1DataStruct *SiS_LCDACRT11280x1024_1_H;
-EXTERN SiS_LCDACRT1DataStruct *SiS_LCDACRT1800x600_2;
-EXTERN SiS_LCDACRT1DataStruct *SiS_LCDACRT11024x768_2;
-EXTERN SiS_LCDACRT1DataStruct *SiS_LCDACRT11280x1024_2;
-EXTERN SiS_LCDACRT1DataStruct *SiS_LCDACRT1800x600_2_H;
-EXTERN SiS_LCDACRT1DataStruct *SiS_LCDACRT11024x768_2_H;
-EXTERN SiS_LCDACRT1DataStruct *SiS_LCDACRT11280x1024_2_H;
-
-/* TW: New from 650/301LV BIOS */
-EXTERN SiS_Part2PortTblStruct *SiS_CRT2Part2_1024x768_1;
-EXTERN SiS_Part2PortTblStruct *SiS_CRT2Part2_1280x1024_1;
-EXTERN SiS_Part2PortTblStruct *SiS_CRT2Part2_1024x768_2;
-EXTERN SiS_Part2PortTblStruct *SiS_CRT2Part2_1280x1024_2;
-EXTERN SiS_Part2PortTblStruct *SiS_CRT2Part2_1024x768_3;
-EXTERN SiS_Part2PortTblStruct *SiS_CRT2Part2_1280x1024_3;
-
-EXTERN SiS_CHTVRegDataStruct *SiS_CHTVReg_UNTSC;
-EXTERN SiS_CHTVRegDataStruct *SiS_CHTVReg_ONTSC;
-EXTERN SiS_CHTVRegDataStruct *SiS_CHTVReg_UPAL;
-EXTERN SiS_CHTVRegDataStruct *SiS_CHTVReg_OPAL;
-EXTERN UCHAR *SiS_CHTVVCLKUNTSC;
-EXTERN UCHAR *SiS_CHTVVCLKONTSC;
-EXTERN UCHAR *SiS_CHTVVCLKUPAL;
-EXTERN UCHAR *SiS_CHTVVCLKOPAL;
-
+typedef struct _SiS_Private
+{
+#ifdef LINUX_KERNEL
+ USHORT RelIO;
+#endif
+ USHORT SiS_P3c4;
+ USHORT SiS_P3d4;
+ USHORT SiS_P3c0;
+ USHORT SiS_P3ce;
+ USHORT SiS_P3c2;
+ USHORT SiS_P3ca;
+ USHORT SiS_P3c6;
+ USHORT SiS_P3c7;
+ USHORT SiS_P3c8;
+ USHORT SiS_P3c9;
+ USHORT SiS_P3da;
+ USHORT SiS_Part1Port;
+ USHORT SiS_Part2Port;
+ USHORT SiS_Part3Port;
+ USHORT SiS_Part4Port;
+ USHORT SiS_Part5Port;
+ USHORT SiS_IF_DEF_LVDS;
+ USHORT SiS_IF_DEF_TRUMPION;
+ USHORT SiS_IF_DEF_DSTN;
+ USHORT SiS_IF_DEF_FSTN;
+ USHORT SiS_IF_DEF_CH70xx;
+ USHORT SiS_IF_DEF_HiVision;
+ UCHAR SiS_VGAINFO;
+ BOOLEAN SiS_UseROM;
+ int SiS_CHOverScan;
+ BOOLEAN SiS_CHSOverScan;
+ BOOLEAN SiS_ChSW;
+ BOOLEAN SiS_UseLCDA;
+ int SiS_UseOEM;
+ USHORT SiS_Backup70xx;
+ USHORT SiS_CRT1Mode;
+ USHORT SiS_flag_clearbuffer;
+ int SiS_RAMType;
+ UCHAR SiS_ChannelAB;
+ UCHAR SiS_DataBusWidth;
+ USHORT SiS_ModeType;
+ USHORT SiS_VBInfo;
+ USHORT SiS_LCDResInfo;
+ USHORT SiS_LCDTypeInfo;
+ USHORT SiS_LCDInfo;
+ USHORT SiS_VBType;
+ USHORT SiS_VBExtInfo;
+ USHORT SiS_HiVision;
+ USHORT SiS_SelectCRT2Rate;
+ USHORT SiS_SetFlag;
+ USHORT SiS_RVBHCFACT;
+ USHORT SiS_RVBHCMAX;
+ USHORT SiS_RVBHRS;
+ USHORT SiS_VGAVT;
+ USHORT SiS_VGAHT;
+ USHORT SiS_VT;
+ USHORT SiS_HT;
+ USHORT SiS_VGAVDE;
+ USHORT SiS_VGAHDE;
+ USHORT SiS_VDE;
+ USHORT SiS_HDE;
+ USHORT SiS_NewFlickerMode;
+ USHORT SiS_RY1COE;
+ USHORT SiS_RY2COE;
+ USHORT SiS_RY3COE;
+ USHORT SiS_RY4COE;
+ USHORT SiS_LCDHDES;
+ USHORT SiS_LCDVDES;
+ USHORT SiS_DDC_Port;
+ USHORT SiS_DDC_Index;
+ USHORT SiS_DDC_Data;
+ USHORT SiS_DDC_Clk;
+ USHORT SiS_DDC_DataShift;
+ USHORT SiS_DDC_DeviceAddr;
+ USHORT SiS_DDC_ReadAddr;
+ USHORT SiS_DDC_SecAddr;
+ USHORT SiS_Panel800x600;
+ USHORT SiS_Panel1024x768;
+ USHORT SiS_Panel1280x1024;
+ USHORT SiS_Panel1600x1200;
+ USHORT SiS_Panel1280x960;
+ USHORT SiS_Panel1400x1050;
+ USHORT SiS_Panel320x480;
+ USHORT SiS_Panel1152x768;
+ USHORT SiS_Panel1280x768;
+ USHORT SiS_Panel1024x600;
+ USHORT SiS_Panel640x480;
+ USHORT SiS_Panel1152x864;
+ USHORT SiS_PanelMax;
+ USHORT SiS_PanelMinLVDS;
+ USHORT SiS_PanelMin301;
+ USHORT SiS_ChrontelInit;
+
+ /* Pointers: */
+ const SiS_StStruct *SiS_SModeIDTable;
+ const SiS_StandTableStruct *SiS_StandTable;
+ const SiS_ExtStruct *SiS_EModeIDTable;
+ const SiS_Ext2Struct *SiS_RefIndex;
+ const SiS_VBModeStruct *SiS_VBModeIDTable;
+ const SiS_CRT1TableStruct *SiS_CRT1Table;
+ const SiS_MCLKDataStruct *SiS_MCLKData_0;
+ const SiS_MCLKDataStruct *SiS_MCLKData_1;
+ const SiS_ECLKDataStruct *SiS_ECLKData;
+ const SiS_VCLKDataStruct *SiS_VCLKData;
+ const SiS_VBVCLKDataStruct *SiS_VBVCLKData;
+ const SiS_StResInfoStruct *SiS_StResInfo;
+ const SiS_ModeResInfoStruct *SiS_ModeResInfo;
+ const UCHAR *SiS_ScreenOffset;
+
+ const UCHAR *pSiS_OutputSelect;
+ const UCHAR *pSiS_SoftSetting;
+
+ const DRAM4Type *SiS_SR15; /* pointer : point to array */
+#ifndef LINUX_XF86
+ UCHAR *pSiS_SR07;
+ const DRAM4Type *SiS_CR40; /* pointer : point to array */
+ UCHAR *SiS_CR49;
+ UCHAR *SiS_SR25;
+ UCHAR *pSiS_SR1F;
+ UCHAR *pSiS_SR21;
+ UCHAR *pSiS_SR22;
+ UCHAR *pSiS_SR23;
+ UCHAR *pSiS_SR24;
+ UCHAR *pSiS_SR31;
+ UCHAR *pSiS_SR32;
+ UCHAR *pSiS_SR33;
+ UCHAR *pSiS_CRT2Data_1_2;
+ UCHAR *pSiS_CRT2Data_4_D;
+ UCHAR *pSiS_CRT2Data_4_E;
+ UCHAR *pSiS_CRT2Data_4_10;
+ const USHORT *pSiS_RGBSenseData;
+ const USHORT *pSiS_VideoSenseData;
+ const USHORT *pSiS_YCSenseData;
+ const USHORT *pSiS_RGBSenseData2; /*301b*/
+ const USHORT *pSiS_VideoSenseData2;
+ const USHORT *pSiS_YCSenseData2;
+#endif
+ const UCHAR *SiS_NTSCPhase;
+ const UCHAR *SiS_PALPhase;
+ const UCHAR *SiS_NTSCPhase2;
+ const UCHAR *SiS_PALPhase2;
+ const UCHAR *SiS_PALMPhase;
+ const UCHAR *SiS_PALNPhase;
+ const UCHAR *SiS_PALMPhase2;
+ const UCHAR *SiS_PALNPhase2;
+ const UCHAR *SiS_SpecialPhase;
+ const SiS_LCDDataStruct *SiS_StLCD1024x768Data;
+ const SiS_LCDDataStruct *SiS_ExtLCD1024x768Data;
+ const SiS_LCDDataStruct *SiS_St2LCD1024x768Data;
+ const SiS_LCDDataStruct *SiS_StLCD1280x1024Data;
+ const SiS_LCDDataStruct *SiS_ExtLCD1280x1024Data;
+ const SiS_LCDDataStruct *SiS_St2LCD1280x1024Data;
+ const SiS_LCDDataStruct *SiS_NoScaleData1024x768;
+ const SiS_LCDDataStruct *SiS_NoScaleData1280x1024;
+ const SiS_LCDDataStruct *SiS_LCD1280x960Data;
+ const SiS_LCDDataStruct *SiS_NoScaleData1400x1050;
+ const SiS_LCDDataStruct *SiS_NoScaleData1600x1200;
+ const SiS_LCDDataStruct *SiS_StLCD1400x1050Data;
+ const SiS_LCDDataStruct *SiS_StLCD1600x1200Data;
+ const SiS_LCDDataStruct *SiS_ExtLCD1400x1050Data;
+ const SiS_LCDDataStruct *SiS_ExtLCD1600x1200Data;
+ const SiS_TVDataStruct *SiS_StPALData;
+ const SiS_TVDataStruct *SiS_ExtPALData;
+ const SiS_TVDataStruct *SiS_StNTSCData;
+ const SiS_TVDataStruct *SiS_ExtNTSCData;
+/* const SiS_TVDataStruct *SiS_St1HiTVData; */
+ const SiS_TVDataStruct *SiS_St2HiTVData;
+ const SiS_TVDataStruct *SiS_ExtHiTVData;
+ const UCHAR *SiS_NTSCTiming;
+ const UCHAR *SiS_PALTiming;
+ const UCHAR *SiS_HiTVExtTiming;
+ const UCHAR *SiS_HiTVSt1Timing;
+ const UCHAR *SiS_HiTVSt2Timing;
+ const UCHAR *SiS_HiTVTextTiming;
+ const UCHAR *SiS_HiTVGroup3Data;
+ const UCHAR *SiS_HiTVGroup3Simu;
+ const UCHAR *SiS_HiTVGroup3Text;
+ const SiS_PanelDelayTblStruct *SiS_PanelDelayTbl;
+ const SiS_PanelDelayTblStruct *SiS_PanelDelayTblLVDS;
+ const SiS_LVDSDataStruct *SiS_LVDS800x600Data_1;
+ const SiS_LVDSDataStruct *SiS_LVDS800x600Data_2;
+ const SiS_LVDSDataStruct *SiS_LVDS1024x768Data_1;
+ const SiS_LVDSDataStruct *SiS_LVDS1024x768Data_2;
+ const SiS_LVDSDataStruct *SiS_LVDS1280x1024Data_1;
+ const SiS_LVDSDataStruct *SiS_LVDS1280x1024Data_2;
+ const SiS_LVDSDataStruct *SiS_LVDS1280x960Data_1;
+ const SiS_LVDSDataStruct *SiS_LVDS1280x960Data_2;
+ const SiS_LVDSDataStruct *SiS_LVDS1400x1050Data_1;
+ const SiS_LVDSDataStruct *SiS_LVDS1400x1050Data_2;
+ const SiS_LVDSDataStruct *SiS_LVDS1280x768Data_1;
+ const SiS_LVDSDataStruct *SiS_LVDS1280x768Data_2;
+ const SiS_LVDSDataStruct *SiS_LVDS1024x600Data_1;
+ const SiS_LVDSDataStruct *SiS_LVDS1024x600Data_2;
+ const SiS_LVDSDataStruct *SiS_LVDS1152x768Data_1;
+ const SiS_LVDSDataStruct *SiS_LVDS1152x768Data_2;
+ const SiS_LVDSDataStruct *SiS_LVDS640x480Data_1;
+ const SiS_LVDSDataStruct *SiS_LVDS320x480Data_1;
+ const SiS_LVDSDataStruct *SiS_LCDA1400x1050Data_1;
+ const SiS_LVDSDataStruct *SiS_LCDA1400x1050Data_2;
+ const SiS_LVDSDataStruct *SiS_LCDA1600x1200Data_1;
+ const SiS_LVDSDataStruct *SiS_LCDA1600x1200Data_2;
+ const SiS_LVDSDataStruct *SiS_LVDSXXXxXXXData_1;
+ const SiS_LVDSDataStruct *SiS_CHTVUNTSCData;
+ const SiS_LVDSDataStruct *SiS_CHTVONTSCData;
+ const SiS_LVDSDataStruct *SiS_CHTVUPALData;
+ const SiS_LVDSDataStruct *SiS_CHTVOPALData;
+ const SiS_LVDSDataStruct *SiS_CHTVUPALMData;
+ const SiS_LVDSDataStruct *SiS_CHTVOPALMData;
+ const SiS_LVDSDataStruct *SiS_CHTVUPALNData;
+ const SiS_LVDSDataStruct *SiS_CHTVOPALNData;
+ const SiS_LVDSDataStruct *SiS_CHTVSOPALData;
+ const SiS_LVDSDesStruct *SiS_PanelType00_1;
+ const SiS_LVDSDesStruct *SiS_PanelType01_1;
+ const SiS_LVDSDesStruct *SiS_PanelType02_1;
+ const SiS_LVDSDesStruct *SiS_PanelType03_1;
+ const SiS_LVDSDesStruct *SiS_PanelType04_1;
+ const SiS_LVDSDesStruct *SiS_PanelType05_1;
+ const SiS_LVDSDesStruct *SiS_PanelType06_1;
+ const SiS_LVDSDesStruct *SiS_PanelType07_1;
+ const SiS_LVDSDesStruct *SiS_PanelType08_1;
+ const SiS_LVDSDesStruct *SiS_PanelType09_1;
+ const SiS_LVDSDesStruct *SiS_PanelType0a_1;
+ const SiS_LVDSDesStruct *SiS_PanelType0b_1;
+ const SiS_LVDSDesStruct *SiS_PanelType0c_1;
+ const SiS_LVDSDesStruct *SiS_PanelType0d_1;
+ const SiS_LVDSDesStruct *SiS_PanelType0e_1;
+ const SiS_LVDSDesStruct *SiS_PanelType0f_1;
+ const SiS_LVDSDesStruct *SiS_PanelType00_2;
+ const SiS_LVDSDesStruct *SiS_PanelType01_2;
+ const SiS_LVDSDesStruct *SiS_PanelType02_2;
+ const SiS_LVDSDesStruct *SiS_PanelType03_2;
+ const SiS_LVDSDesStruct *SiS_PanelType04_2;
+ const SiS_LVDSDesStruct *SiS_PanelType05_2;
+ const SiS_LVDSDesStruct *SiS_PanelType06_2;
+ const SiS_LVDSDesStruct *SiS_PanelType07_2;
+ const SiS_LVDSDesStruct *SiS_PanelType08_2;
+ const SiS_LVDSDesStruct *SiS_PanelType09_2;
+ const SiS_LVDSDesStruct *SiS_PanelType0a_2;
+ const SiS_LVDSDesStruct *SiS_PanelType0b_2;
+ const SiS_LVDSDesStruct *SiS_PanelType0c_2;
+ const SiS_LVDSDesStruct *SiS_PanelType0d_2;
+ const SiS_LVDSDesStruct *SiS_PanelType0e_2;
+ const SiS_LVDSDesStruct *SiS_PanelType0f_2;
+
+ const SiS_LVDSDesStruct *LVDS1024x768Des_1;
+ const SiS_LVDSDesStruct *LVDS1280x1024Des_1;
+ const SiS_LVDSDesStruct *LVDS1400x1050Des_1;
+ const SiS_LVDSDesStruct *LVDS1600x1200Des_1;
+ const SiS_LVDSDesStruct *LVDS1024x768Des_2;
+ const SiS_LVDSDesStruct *LVDS1280x1024Des_2;
+ const SiS_LVDSDesStruct *LVDS1400x1050Des_2;
+ const SiS_LVDSDesStruct *LVDS1600x1200Des_2;
+
+ const SiS_LVDSDesStruct *SiS_CHTVUNTSCDesData;
+ const SiS_LVDSDesStruct *SiS_CHTVONTSCDesData;
+ const SiS_LVDSDesStruct *SiS_CHTVUPALDesData;
+ const SiS_LVDSDesStruct *SiS_CHTVOPALDesData;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1800x600_1;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x768_1;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11280x1024_1;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11400x1050_1;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11280x768_1;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x600_1;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11152x768_1;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11600x1200_1;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1800x600_1_H;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x768_1_H;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11280x1024_1_H;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11400x1050_1_H;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11280x768_1_H;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x600_1_H;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11152x768_1_H;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11600x1200_1_H;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1800x600_2;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x768_2;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11280x1024_2;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11400x1050_2;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11280x768_2;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x600_2;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11152x768_2;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11600x1200_2;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1800x600_2_H;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x768_2_H;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11280x1024_2_H;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11400x1050_2_H;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11280x768_2_H;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x600_2_H;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11152x768_2_H;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11600x1200_2_H;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1XXXxXXX_1;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1XXXxXXX_1_H;
+ const SiS_LVDSCRT1DataStruct *SiS_CHTVCRT1UNTSC;
+ const SiS_LVDSCRT1DataStruct *SiS_CHTVCRT1ONTSC;
+ const SiS_LVDSCRT1DataStruct *SiS_CHTVCRT1UPAL;
+ const SiS_LVDSCRT1DataStruct *SiS_CHTVCRT1OPAL;
+ const SiS_LVDSCRT1DataStruct *SiS_CHTVCRT1SOPAL;
+
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1320x480_1;
+
+ const SiS_LCDACRT1DataStruct *SiS_LCDACRT1800x600_1;
+ const SiS_LCDACRT1DataStruct *SiS_LCDACRT11024x768_1;
+ const SiS_LCDACRT1DataStruct *SiS_LCDACRT11280x1024_1;
+ const SiS_LCDACRT1DataStruct *SiS_LCDACRT11400x1050_1;
+ const SiS_LCDACRT1DataStruct *SiS_LCDACRT11600x1200_1;
+ const SiS_LCDACRT1DataStruct *SiS_LCDACRT1800x600_1_H;
+ const SiS_LCDACRT1DataStruct *SiS_LCDACRT11024x768_1_H;
+ const SiS_LCDACRT1DataStruct *SiS_LCDACRT11280x1024_1_H;
+ const SiS_LCDACRT1DataStruct *SiS_LCDACRT11400x1050_1_H;
+ const SiS_LCDACRT1DataStruct *SiS_LCDACRT11600x1200_1_H;
+ const SiS_LCDACRT1DataStruct *SiS_LCDACRT1800x600_2;
+ const SiS_LCDACRT1DataStruct *SiS_LCDACRT11024x768_2;
+ const SiS_LCDACRT1DataStruct *SiS_LCDACRT11280x1024_2;
+ const SiS_LCDACRT1DataStruct *SiS_LCDACRT11400x1050_2;
+ const SiS_LCDACRT1DataStruct *SiS_LCDACRT11600x1200_2;
+ const SiS_LCDACRT1DataStruct *SiS_LCDACRT1800x600_2_H;
+ const SiS_LCDACRT1DataStruct *SiS_LCDACRT11024x768_2_H;
+ const SiS_LCDACRT1DataStruct *SiS_LCDACRT11280x1024_2_H;
+ const SiS_LCDACRT1DataStruct *SiS_LCDACRT11400x1050_2_H;
+ const SiS_LCDACRT1DataStruct *SiS_LCDACRT11600x1200_2_H;
+
+ /* TW: New for 650/301LV */
+ const SiS_Part2PortTblStruct *SiS_CRT2Part2_1024x768_1;
+ const SiS_Part2PortTblStruct *SiS_CRT2Part2_1280x1024_1;
+ const SiS_Part2PortTblStruct *SiS_CRT2Part2_1400x1050_1;
+ const SiS_Part2PortTblStruct *SiS_CRT2Part2_1600x1200_1;
+ const SiS_Part2PortTblStruct *SiS_CRT2Part2_1024x768_2;
+ const SiS_Part2PortTblStruct *SiS_CRT2Part2_1280x1024_2;
+ const SiS_Part2PortTblStruct *SiS_CRT2Part2_1400x1050_2;
+ const SiS_Part2PortTblStruct *SiS_CRT2Part2_1600x1200_2;
+ const SiS_Part2PortTblStruct *SiS_CRT2Part2_1024x768_3;
+ const SiS_Part2PortTblStruct *SiS_CRT2Part2_1280x1024_3;
+ const SiS_Part2PortTblStruct *SiS_CRT2Part2_1400x1050_3;
+ const SiS_Part2PortTblStruct *SiS_CRT2Part2_1600x1200_3;
+
+ const SiS_CHTVRegDataStruct *SiS_CHTVReg_UNTSC;
+ const SiS_CHTVRegDataStruct *SiS_CHTVReg_ONTSC;
+ const SiS_CHTVRegDataStruct *SiS_CHTVReg_UPAL;
+ const SiS_CHTVRegDataStruct *SiS_CHTVReg_OPAL;
+ const SiS_CHTVRegDataStruct *SiS_CHTVReg_UPALM;
+ const SiS_CHTVRegDataStruct *SiS_CHTVReg_OPALM;
+ const SiS_CHTVRegDataStruct *SiS_CHTVReg_UPALN;
+ const SiS_CHTVRegDataStruct *SiS_CHTVReg_OPALN;
+ const SiS_CHTVRegDataStruct *SiS_CHTVReg_SOPAL;
+ const UCHAR *SiS_CHTVVCLKUNTSC;
+ const UCHAR *SiS_CHTVVCLKONTSC;
+ const UCHAR *SiS_CHTVVCLKUPAL;
+ const UCHAR *SiS_CHTVVCLKOPAL;
+ const UCHAR *SiS_CHTVVCLKUPALM;
+ const UCHAR *SiS_CHTVVCLKOPALM;
+ const UCHAR *SiS_CHTVVCLKUPALN;
+ const UCHAR *SiS_CHTVVCLKOPALN;
+ const UCHAR *SiS_CHTVVCLKSOPAL;
+
+ BOOLEAN UseCustomMode;
+ BOOLEAN CRT1UsesCustomMode;
+ USHORT CHDisplay;
+ USHORT CHSyncStart;
+ USHORT CHSyncEnd;
+ USHORT CHTotal;
+ USHORT CHBlankStart;
+ USHORT CHBlankEnd;
+ USHORT CVDisplay;
+ USHORT CVSyncStart;
+ USHORT CVSyncEnd;
+ USHORT CVTotal;
+ USHORT CVBlankStart;
+ USHORT CVBlankEnd;
+ ULONG CDClock;
+ ULONG CFlags;
+ UCHAR CCRT1CRTC[17];
+ UCHAR CSR2B;
+ UCHAR CSR2C;
+ USHORT CSRClock;
+ USHORT CModeFlag;
+ USHORT CInfoFlag;
+ BOOLEAN SiS_CHPALM;
+ BOOLEAN SiS_CHPALN;
+
+ BOOLEAN Backup;
+ UCHAR Backup_Mode;
+ UCHAR Backup_14;
+ UCHAR Backup_15;
+ UCHAR Backup_16;
+ UCHAR Backup_17;
+ UCHAR Backup_18;
+ UCHAR Backup_19;
+ UCHAR Backup_1a;
+ UCHAR Backup_1b;
+ UCHAR Backup_1c;
+ UCHAR Backup_1d;
+
+ int UsePanelScaler;
+} SiS_Private;
+
+#endif
diff --git a/include/linux/fb.h b/include/linux/fb.h
index f6d5c02c493f..0e0fbfb1922f 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -98,6 +98,8 @@
#define FB_ACCEL_3DLABS_PERMEDIA3 37 /* 3Dlabs Permedia 3 */
#define FB_ACCEL_ATI_RADEON 38 /* ATI Radeon family */
#define FB_ACCEL_I810 39 /* Intel 810/815 */
+#define FB_ACCEL_SIS_GLAMOUR_2 40 /* SiS 315, 650, 740 */
+#define FB_ACCEL_SIS_XABRE 41 /* SiS 330 ("Xabre") */
#define FB_ACCEL_NEOMAGIC_NM2070 90 /* NeoMagic NM2070 */
#define FB_ACCEL_NEOMAGIC_NM2090 91 /* NeoMagic NM2090 */
@@ -345,7 +347,6 @@ struct fb_pixmap {
#ifdef __KERNEL__
#include <linux/fs.h>
-#include <linux/poll.h>
#include <linux/init.h>
#include <linux/devfs_fs_kernel.h>
@@ -386,8 +387,6 @@ struct fb_ops {
int (*fb_cursor)(struct fb_info *info, struct fb_cursor *cursor);
/* Rotates the display */
void (*fb_rotate)(struct fb_info *info, int angle);
- /* perform polling on fb device */
- int (*fb_poll)(struct fb_info *info, poll_table *wait);
/* wait for blit idle, optional */
int (*fb_sync)(struct fb_info *info);
/* perform fb specific ioctl (optional) */
diff --git a/include/linux/sisfb.h b/include/video/sisfb.h
index f45257643986..438746dc51fa 100644
--- a/include/linux/sisfb.h
+++ b/include/video/sisfb.h
@@ -34,11 +34,10 @@ typedef enum _SIS_CHIP_TYPE {
SIS_730,
SIS_315H,
SIS_315,
- SIS_550,
SIS_315PRO,
- SIS_640,
- SIS_740,
+ SIS_550,
SIS_650,
+ SIS_740,
SIS_330,
MAX_SIS_CHIP
} SIS_CHIP_TYPE;
@@ -129,7 +128,16 @@ struct video_info {
spinlock_t lockaccel;
- char reserved[256];
+ unsigned int pcibus;
+ unsigned int pcislot;
+ unsigned int pcifunc;
+
+ int accel;
+
+ unsigned short subsysvendor;
+ unsigned short subsysdevice;
+
+ char reserved[236];
};
@@ -137,7 +145,9 @@ struct video_info {
/* If changing this, vgatypes.h must also be changed (for X driver) */
/* TW: ioctl for identifying and giving some info (esp. memory heap start) */
-#define SISFB_GET_INFO _IOR('n',0xF8,sizeof(__u32))
+#define SISFB_GET_INFO _IOR('n',0xF8,sizeof(__u32))
+
+#define SISFB_GET_VBRSTATUS _IOR('n',0xF9,sizeof(__u32))
/* TW: Structure argument for SISFB_GET_INFO ioctl */
typedef struct _SISFB_INFO sisfb_info, *psisfb_info;
@@ -156,7 +166,19 @@ struct _SISFB_INFO {
unsigned char sisfb_revision;
unsigned char sisfb_patchlevel;
- char reserved[253]; /* for future use */
+ unsigned char sisfb_caps; /* Sisfb capabilities */
+
+ int sisfb_tqlen; /* turbo queue length (in KB) */
+
+ unsigned int sisfb_pcibus; /* The card's PCI ID */
+ unsigned int sisfb_pcislot;
+ unsigned int sisfb_pcifunc;
+
+ unsigned char sisfb_lcdpdc; /* PanelDelayCompensation */
+
+ unsigned char sisfb_lcda; /* Detected status of LCDA for low res/text modes */
+
+ char reserved[235]; /* for future use */
};
#ifdef __KERNEL__