diff options
| -rw-r--r-- | drivers/video/sis/300vtbl.h | 3817 | ||||
| -rw-r--r-- | drivers/video/sis/310vtbl.h | 5392 | ||||
| -rw-r--r-- | drivers/video/sis/325vtbl.h | 4337 | ||||
| -rw-r--r-- | drivers/video/sis/init.c | 7296 | ||||
| -rw-r--r-- | drivers/video/sis/init.h | 498 | ||||
| -rw-r--r-- | drivers/video/sis/init301.c | 13143 | ||||
| -rw-r--r-- | drivers/video/sis/init301.h | 507 | ||||
| -rw-r--r-- | drivers/video/sis/initdef.h | 327 | ||||
| -rw-r--r-- | drivers/video/sis/oem300.h | 957 | ||||
| -rw-r--r-- | drivers/video/sis/oem310.h | 464 | ||||
| -rw-r--r-- | drivers/video/sis/osdef.h | 136 | ||||
| -rw-r--r-- | drivers/video/sis/sis_main.c | 3316 | ||||
| -rw-r--r-- | drivers/video/sis/sis_main.h | 885 | ||||
| -rw-r--r-- | drivers/video/sis/sisfb.h | 153 | ||||
| -rw-r--r-- | drivers/video/sis/vgatypes.h | 368 | ||||
| -rw-r--r-- | drivers/video/sis/vstruct.h | 366 |
16 files changed, 24493 insertions, 17469 deletions
diff --git a/drivers/video/sis/300vtbl.h b/drivers/video/sis/300vtbl.h index 8103ec200c08..90226457257e 100644 --- a/drivers/video/sis/300vtbl.h +++ b/drivers/video/sis/300vtbl.h @@ -1,4 +1,10 @@ -typedef struct _SiS300_StStruct { + + +/* Register settings for SiS 300 series */ + + +typedef struct _SiS300_StStruct +{ UCHAR St_ModeID; USHORT St_ModeFlag; UCHAR St_StTableIndex; @@ -9,31 +15,33 @@ typedef struct _SiS300_StStruct { UCHAR VB_StTVYFilterIndex; } SiS300_StStruct; -SiS300_StStruct SiS300_SModeIDTable[] = -{ - {0x01, 0x9208, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x01, 0x1210, 0x14, 0x01, 0x01, 0x00, 0x00, 0x00}, - {0x01, 0x1010, 0x17, 0x02, 0x02, 0x00, 0x00, 0x00}, - {0x03, 0x8208, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x03, 0x0210, 0x16, 0x01, 0x01, 0x00, 0x00, 0x00}, - {0x03, 0x0010, 0x18, 0x02, 0x02, 0x00, 0x00, 0x00}, - {0x05, 0x9209, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x06, 0x8209, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x07, 0x0000, 0x07, 0x03, 0x03, 0x00, 0x00, 0x00}, - {0x07, 0x0000, 0x19, 0x02, 0x02, 0x00, 0x00, 0x00}, - {0x0d, 0x920a, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x0e, 0x820a, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x0f, 0x0202, 0x11, 0x01, 0x01, 0x00, 0x00, 0x00}, - {0x10, 0x0212, 0x12, 0x01, 0x01, 0x00, 0x00, 0x00}, - {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}, - {0x12, 0x0210, 0x18, 0x01, 0x01, 0x00, 0x00, 0x00}, - {0xff, 0, 0, 0, 0, 0, 0, 0} -}; - -typedef struct _SiS300_StandTableStruct { +SiS300_StStruct SiS300_SModeIDTable[]= +{ + {0x01,0x9208,0x01,0x00,0x00,0x00,0x00,0x00}, + {0x01,0x1210,0x14,0x01,0x01,0x00,0x00,0x00}, + {0x01,0x1010,0x17,0x02,0x02,0x00,0x00,0x00}, + {0x03,0x8208,0x03,0x00,0x00,0x00,0x00,0x00}, + {0x03,0x0210,0x16,0x01,0x01,0x00,0x00,0x00}, + {0x03,0x0010,0x18,0x02,0x02,0x00,0x00,0x00}, + {0x05,0x9209,0x05,0x00,0x00,0x00,0x00,0x00}, + {0x06,0x8209,0x06,0x00,0x00,0x00,0x00,0x00}, + {0x07,0x0000,0x07,0x03,0x03,0x00,0x00,0x00}, + {0x07,0x0000,0x19,0x02,0x02,0x00,0x00,0x00}, + {0x0d,0x920a,0x0d,0x00,0x00,0x00,0x00,0x00}, + {0x0e,0x820a,0x0e,0x00,0x00,0x00,0x00,0x00}, + {0x0f,0x0202,0x11,0x01,0x01,0x00,0x00,0x00}, + {0x10,0x0212,0x12,0x01,0x01,0x00,0x00,0x00}, + {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} +}; + +typedef struct _SiS300_StandTableStruct +{ UCHAR CRT_COLS; UCHAR ROWS; UCHAR CHAR_HEIGHT; @@ -45,362 +53,364 @@ typedef struct _SiS300_StandTableStruct { UCHAR GRC[9]; } SiS300_StandTableStruct; -SiS300_StandTableStruct SiS300_StandTable[] = { - {0x28, 0x18, 0x08, 0x0800, - {0x09, 0x03, 0x00, 0x02}, - 0x63, - {0x2d, 0x27, 0x28, 0x90, 0x2b, 0xa0, 0xbf, 0x1f, - 0x00, 0xc7, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x14, 0x1f, 0x96, 0xb9, 0xa3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x08, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00, - 0xff}}, - {0x28, 0x18, 0x08, 0x0800, - {0x09, 0x03, 0x00, 0x02}, - 0x63, - {0x2d, 0x27, 0x28, 0x90, 0x2b, 0xa0, 0xbf, 0x1f, - 0x00, 0xc7, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x14, 0x1f, 0x96, 0xb9, 0xa3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x08, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00, - 0xff}}, - {0x50, 0x18, 0x08, 0x1000, - {0x01, 0x03, 0x00, 0x02}, - 0x63, - {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f, - 0x00, 0xc7, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x28, 0x1f, 0x96, 0xb9, 0xa3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x08, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00, - 0xff}}, - {0x50, 0x18, 0x08, 0x1000, - {0x01, 0x03, 0x00, 0x02}, - 0x63, - {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f, - 0x00, 0xc7, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x28, 0x1f, 0x96, 0xb9, 0xa3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x08, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00, - 0xff}}, - {0x28, 0x18, 0x08, 0x4000, - {0x09, 0x03, 0x00, 0x02}, - 0x63, - {0x2d, 0x27, 0x28, 0x90, 0x2b, 0x80, 0xbf, 0x1f, - 0x00, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x14, 0x00, 0x96, 0xb9, 0xa2, - 0xff}, - {0x00, 0x13, 0x15, 0x17, 0x02, 0x04, 0x06, 0x07, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x01, 0x00, 0x03, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0f, 0x00, - 0xff}}, - {0x28, 0x18, 0x08, 0x4000, - {0x09, 0x03, 0x00, 0x02}, - 0x63, - {0x2d, 0x27, 0x28, 0x90, 0x2b, 0x80, 0xbf, 0x1f, - 0x00, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x14, 0x00, 0x96, 0xb9, 0xa2, - 0xff}, - {0x00, 0x13, 0x15, 0x17, 0x02, 0x04, 0x06, 0x07, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x01, 0x00, 0x03, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0f, 0x00, - 0xff}}, - {0x50, 0x18, 0x08, 0x4000, - {0x01, 0x01, 0x00, 0x06}, - 0x63, - {0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0xbf, 0x1f, - 0x00, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x28, 0x00, 0x96, 0xb9, 0xc2, - 0xff}, - {0x00, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, - 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, - 0x01, 0x00, 0x01, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, - 0xff}}, - {0x50, 0x18, 0x0e, 0x1000, - {0x00, 0x03, 0x00, 0x03}, - 0xa6, - {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f, - 0x00, 0x4d, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00, - 0x83, 0x85, 0x5d, 0x28, 0x0d, 0x63, 0xba, 0xa3, - 0xff}, - {0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x10, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x0e, 0x00, 0x0f, 0x08}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0a, 0x00, - 0xff}}, +SiS300_StandTableStruct SiS300_StandTable[]= +{ /* TW: @ 0x38d4 in BIOS */ + {0x28,0x18,0x08,0x0800, + {0x09,0x03,0x00,0x02}, + 0x63, + {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f, + 0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x14,0x1f,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} }, + {0x28,0x18,0x08,0x0800, + {0x09,0x03,0x00,0x02}, + 0x63, + {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f, + 0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x14,0x1f,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} }, + {0x50,0x18,0x08,0x1000, + {0x01,0x03,0x00,0x02}, + 0x63, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} }, + {0x50,0x18,0x08,0x1000, + {0x01,0x03,0x00,0x02}, + 0x63, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} }, + {0x28,0x18,0x08,0x4000, + {0x09,0x03,0x00,0x02}, + 0x63, + {0x2d,0x27,0x28,0x90,0x2b,0x80,0xbf,0x1f, + 0x00,0xc1,0x00,0x00,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x14,0x00,0x96,0xb9,0xa2, + 0xff}, + {0x00,0x13,0x15,0x17,0x02,0x04,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x01,0x00,0x03,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x30,0x0f,0x00, + 0xff} }, + {0x28,0x18,0x08,0x4000, + {0x09,0x03,0x00,0x02}, + 0x63, + {0x2d,0x27,0x28,0x90,0x2b,0x80,0xbf,0x1f, + 0x00,0xc1,0x00,0x00,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x14,0x00,0x96,0xb9,0xa2, + 0xff}, + {0x00,0x13,0x15,0x17,0x02,0x04,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x01,0x00,0x03,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x30,0x0f,0x00, + 0xff} }, + {0x50,0x18,0x08,0x4000, + {0x01,0x01,0x00,0x06}, + 0x63, + {0x5f,0x4f,0x50,0x82,0x54,0x80,0xbf,0x1f, + 0x00,0xc1,0x00,0x00,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x28,0x00,0x96,0xb9,0xc2, + 0xff}, + {0x00,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x01,0x00,0x01,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x0d,0x00, + 0xff} }, + {0x50,0x18,0x0e,0x1000, + {0x00,0x03,0x00,0x03}, + 0xa6, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00, + 0x83,0x85,0x5d,0x28,0x0d,0x63,0xba,0xa3, + 0xff}, + {0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08, + 0x10,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x0e,0x00,0x0f,0x08}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0a,0x00, + 0xff} }, /* MDA_DAC*/ - {0x00, 0x00, 0x00, 0x0000, - {0x00, 0x00, 0x00, 0x15}, - 0x15, - {0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, - 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x3f, 0x3f, - 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x00, 0x00, - 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x15, 0x15, - 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, - 0x15, 0x15, 0x15, 0x15}, - {0x15, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, - 0x3f}}, + {0x00,0x00,0x00,0x0000, + {0x00,0x00,0x00,0x15}, + 0x15, + {0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x3f,0x3f, + 0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x00, + 0x00}, + {0x00,0x00,0x00,0x00,0x00,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15}, + {0x15,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3f} }, /* CGA_DAC*/ - {0x00, 0x10, 0x04, 0x0114, - {0x11, 0x09, 0x15, 0x00}, - 0x10, - {0x04, 0x14, 0x01, 0x11, 0x09, 0x15, 0x2a, 0x3a, - 0x2e, 0x3e, 0x2b, 0x3b, 0x2f, 0x3f, 0x2a, 0x3a, - 0x2e, 0x3e, 0x2b, 0x3b, 0x2f, 0x3f, 0x00, 0x10, - 0x04}, - {0x14, 0x01, 0x11, 0x09, 0x15, 0x00, 0x10, 0x04, - 0x14, 0x01, 0x11, 0x09, 0x15, 0x2a, 0x3a, 0x2e, - 0x3e, 0x2b, 0x3b, 0x2f}, - {0x3f, 0x2a, 0x3a, 0x2e, 0x3e, 0x2b, 0x3b, 0x2f, - 0x3f}}, + {0x00,0x10,0x04,0x0114, + {0x11,0x09,0x15,0x00}, + 0x10, + {0x04,0x14,0x01,0x11,0x09,0x15,0x2a,0x3a, + 0x2e,0x3e,0x2b,0x3b,0x2f,0x3f,0x2a,0x3a, + 0x2e,0x3e,0x2b,0x3b,0x2f,0x3f,0x00,0x10, + 0x04}, + {0x14,0x01,0x11,0x09,0x15,0x00,0x10,0x04, + 0x14,0x01,0x11,0x09,0x15,0x2a,0x3a,0x2e, + 0x3e,0x2b,0x3b,0x2f}, + {0x3f,0x2a,0x3a,0x2e,0x3e,0x2b,0x3b,0x2f, + 0x3f} }, /* EGA_DAC*/ - {0x00, 0x10, 0x04, 0x0114, - {0x11, 0x05, 0x15, 0x20}, - 0x30, - {0x24, 0x34, 0x21, 0x31, 0x25, 0x35, 0x08, 0x18, - 0x0c, 0x1c, 0x09, 0x19, 0x0d, 0x1d, 0x28, 0x38, - 0x2c, 0x3c, 0x29, 0x39, 0x2d, 0x3d, 0x02, 0x12, - 0x06}, - {0x16, 0x03, 0x13, 0x07, 0x17, 0x22, 0x32, 0x26, - 0x36, 0x23, 0x33, 0x27, 0x37, 0x0a, 0x1a, 0x0e, - 0x1e, 0x0b, 0x1b, 0x0f}, - {0x1f, 0x2a, 0x3a, 0x2e, 0x3e, 0x2b, 0x3b, 0x2f, - 0x3f}}, + {0x00,0x10,0x04,0x0114, + {0x11,0x05,0x15,0x20}, + 0x30, + {0x24,0x34,0x21,0x31,0x25,0x35,0x08,0x18, + 0x0c,0x1c,0x09,0x19,0x0d,0x1d,0x28,0x38, + 0x2c,0x3c,0x29,0x39,0x2d,0x3d,0x02,0x12, + 0x06}, + {0x16,0x03,0x13,0x07,0x17,0x22,0x32,0x26, + 0x36,0x23,0x33,0x27,0x37,0x0a,0x1a,0x0e, + 0x1e,0x0b,0x1b,0x0f}, + {0x1f,0x2a,0x3a,0x2e,0x3e,0x2b,0x3b,0x2f, + 0x3f} }, /* VGA_DAC*/ - {0x00, 0x10, 0x04, 0x0114, - {0x11, 0x09, 0x15, 0x2a}, - 0x3a, - {0x2e, 0x3e, 0x2b, 0x3b, 0x2f, 0x3f, 0x00, 0x05, - 0x08, 0x0b, 0x0e, 0x11, 0x14, 0x18, 0x1c, 0x20, - 0x24, 0x28, 0x2d, 0x32, 0x38, 0x3f, 0x00, 0x10, - 0x1f}, - {0x2f, 0x3f, 0x1f, 0x27, 0x2f, 0x37, 0x3f, 0x2d, - 0x31, 0x36, 0x3a, 0x3f, 0x00, 0x07, 0x0e, 0x15, - 0x1c, 0x0e, 0x11, 0x15}, - {0x18, 0x1c, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x00, - 0x04}}, - {0x08, 0x0c, 0x10, 0x0a08, - {0x0c, 0x0e, 0x10, 0x0b}, - 0x0c, - {0x0d, 0x0f, 0x10, 0x10, 0x01, 0x08, 0x00, 0x00, - 0x00, 0x00, 0x01, 0x00, 0x02, 0x02, 0x01, 0x00, - 0x04, 0x04, 0x01, 0x00, 0x05, 0x02, 0x05, 0x00, - 0x06}, - {0x01, 0x06, 0x05, 0x06, 0x00, 0x08, 0x01, 0x08, - 0x00, 0x07, 0x02, 0x07, 0x06, 0x07, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00}}, - {0x28, 0x18, 0x08, 0x2000, - {0x09, 0x0f, 0x00, 0x06}, - 0x63, - {0x2d, 0x27, 0x28, 0x90, 0x2b, 0x80, 0xbf, 0x1f, - 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x14, 0x00, 0x96, 0xb9, 0xe3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x01, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0f, - 0xff}}, - {0x50, 0x18, 0x08, 0x4000, - {0x01, 0x0f, 0x00, 0x06}, - 0x63, - {0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0xbf, 0x1f, - 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x28, 0x00, 0x96, 0xb9, 0xe3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x01, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0f, - 0xff}}, - {0x00, 0x00, 0x00, 0x0000, - {0x01, 0x0f, 0x00, 0x0e}, - 0x23, - {0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0x0b, 0x3e, - 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xea, 0x8c, 0xdf, 0x28, 0x40, 0xe7, 0x04, 0xa3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x01, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0f, - 0xff}}, - {0x4a, 0x36, 0x00, 0x00c0, - {0x00, 0x00, 0x00, 0x00}, - 0x00, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3a, - 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x1a, 0x00, 0x57, 0x39, 0x00, 0xc0, - 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00}}, - {0x50, 0x18, 0x0e, 0x8000, - {0x01, 0x0f, 0x00, 0x06}, - 0xa2, - {0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0xbf, 0x1f, - 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x83, 0x85, 0x5d, 0x28, 0x0f, 0x63, 0xba, 0xe3, - 0xff}, - {0x00, 0x08, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, - 0x00, 0x08, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, - 0x0b, 0x00, 0x05, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x05, - 0xff}}, - {0x50, 0x18, 0x0e, 0x8000, - {0x01, 0x0f, 0x00, 0x06}, - 0xa3, - {0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0xbf, 0x1f, - 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x83, 0x85, 0x5d, 0x28, 0x0f, 0x63, 0xba, 0xe3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, - 0x01, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0f, - 0xff}}, - {0x28, 0x18, 0x0e, 0x0800, - {0x09, 0x03, 0x00, 0x02}, - 0xa3, - {0x2d, 0x27, 0x28, 0x90, 0x2b, 0xa0, 0xbf, 0x1f, - 0x00, 0x4d, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00, - 0x83, 0x85, 0x5d, 0x14, 0x1f, 0x63, 0xba, 0xa3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, - 0x08, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00, - 0xff}}, - {0x28, 0x18, 0x0e, 0x0800, - {0x09, 0x03, 0x00, 0x02}, - 0xa3, - {0x2d, 0x27, 0x28, 0x90, 0x2b, 0xa0, 0xbf, 0x1f, - 0x00, 0x4d, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00, - 0x83, 0x85, 0x5d, 0x14, 0x1f, 0x63, 0xba, 0xa3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, - 0x08, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00, - 0xff}}, - {0x50, 0x18, 0x0e, 0x1000, - {0x01, 0x03, 0x00, 0x02}, - 0xa3, - {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f, - 0x00, 0x4d, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00, - 0x83, 0x85, 0x5d, 0x28, 0x1f, 0x63, 0xba, 0xa3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, - 0x08, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00, - 0xff}}, - {0x50, 0x18, 0x0e, 0x1000, - {0x01, 0x03, 0x00, 0x02}, - 0xa3, - {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f, - 0x00, 0x4d, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00, - 0x83, 0x85, 0x5d, 0x28, 0x1f, 0x63, 0xba, 0xa3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, - 0x08, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00, - 0xff}}, - {0x28, 0x18, 0x10, 0x0800, - {0x08, 0x03, 0x00, 0x02}, - 0x67, - {0x2d, 0x27, 0x28, 0x90, 0x2b, 0xa0, 0xbf, 0x1f, - 0x00, 0x4f, 0x0d, 0x0e, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x14, 0x1f, 0x96, 0xb9, 0xa3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, - 0x0c, 0x00, 0x0f, 0x08}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00, - 0xff}}, - {0x50, 0x18, 0x10, 0x1000, - {0x00, 0x03, 0x00, 0x02}, - 0x67, - {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f, - 0x00, 0x4f, 0x0d, 0x0e, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x28, 0x1f, 0x96, 0xb9, 0xa3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, - 0x0c, 0x00, 0x0f, 0x08}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00, - 0xff}}, - {0x50, 0x18, 0x10, 0x1000, - {0x00, 0x03, 0x00, 0x02}, - 0x66, - {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f, - 0x00, 0x4f, 0x0d, 0x0e, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x28, 0x0f, 0x96, 0xb9, 0xa3, - 0xff}, - {0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x10, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x0e, 0x00, 0x0f, 0x08}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0a, 0x00, - 0xff}}, - {0x50, 0x1d, 0x10, 0xa000, - {0x01, 0x0f, 0x00, 0x06}, - 0xe3, - {0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0x0b, 0x3e, - 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xea, 0x8c, 0xdf, 0x28, 0x00, 0xe7, 0x04, 0xc3, - 0xff}, - {0x00, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, - 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, - 0x01, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x01, - 0xff}}, - {0x50, 0x1d, 0x10, 0xa000, - {0x01, 0x0f, 0x00, 0x06}, - 0xe3, - {0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0x0b, 0x3e, - 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xea, 0x8c, 0xdf, 0x28, 0x00, 0xe7, 0x04, 0xe3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, - 0x01, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0f, - 0xff}}, - {0x28, 0x18, 0x08, 0x2000, - {0x01, 0x0f, 0x00, 0x0e}, - 0x63, - {0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0xbf, 0x1f, - 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x28, 0x40, 0x96, 0xb9, 0xa3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x41, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0f, - 0xff}} -}; - -typedef struct _SiS300_ExtStruct { + {0x00,0x10,0x04,0x0114, + {0x11,0x09,0x15,0x2a}, + 0x3a, + {0x2e,0x3e,0x2b,0x3b,0x2f,0x3f,0x00,0x05, + 0x08,0x0b,0x0e,0x11,0x14,0x18,0x1c,0x20, + 0x24,0x28,0x2d,0x32,0x38,0x3f,0x00,0x10, + 0x1f}, + {0x2f,0x3f,0x1f,0x27,0x2f,0x37,0x3f,0x2d, + 0x31,0x36,0x3a,0x3f,0x00,0x07,0x0e,0x15, + 0x1c,0x0e,0x11,0x15}, + {0x18,0x1c,0x14,0x16,0x18,0x1a,0x1c,0x00, + 0x04} }, + {0x08,0x0c,0x10,0x0a08, + {0x0c,0x0e,0x10,0x0b}, + 0x0c, + {0x0d,0x0f,0x10,0x10,0x01,0x08,0x00,0x00, + 0x00,0x00,0x01,0x00,0x02,0x02,0x01,0x00, + 0x04,0x04,0x01,0x00,0x05,0x02,0x05,0x00, + 0x06}, + {0x01,0x06,0x05,0x06,0x00,0x08,0x01,0x08, + 0x00,0x07,0x02,0x07,0x06,0x07,0x00,0x00, + 0x00,0x00,0x00,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00} }, + {0x28,0x18,0x08,0x2000, + {0x09,0x0f,0x00,0x06}, + 0x63, + {0x2d,0x27,0x28,0x90,0x2b,0x80,0xbf,0x1f, + 0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x14,0x00,0x96,0xb9,0xe3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x01,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f, + 0xff} }, + {0x50,0x18,0x08,0x4000, + {0x01,0x0f,0x00,0x06}, + 0x63, + {0x5f,0x4f,0x50,0x82,0x54,0x80,0xbf,0x1f, + 0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x28,0x00,0x96,0xb9,0xe3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 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) */ + 0x23, + {0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e, + 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 0xea,0x8c,0xdf,0x28,0x40,0xe7,0x04,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, + 0x01,0x00,0x00,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0f, + 0xff} }, + {0x4a,0x36,0x00,0x00c0, + {0x00,0x00,0x00,0x00}, + 0x00, + {0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x3a, + 0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x1a,0x00,0x57,0x39,0x00,0xc0, + 0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00} }, + {0x50,0x18,0x0e,0x8000, + {0x01,0x0f,0x00,0x06}, + 0xa2, + {0x5f,0x4f,0x50,0x82,0x54,0x80,0xbf,0x1f, + 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 0x83,0x85,0x5d,0x28,0x0f,0x63,0xba,0xe3, + 0xff}, + {0x00,0x08,0x00,0x00,0x18,0x18,0x00,0x00, + 0x00,0x08,0x00,0x00,0x00,0x18,0x00,0x00, + 0x0b,0x00,0x05,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x05, + 0xff} }, + {0x50,0x18,0x0e,0x8000, + {0x01,0x0f,0x00,0x06}, + 0xa3, + {0x5f,0x4f,0x50,0x82,0x54,0x80,0xbf,0x1f, + 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 0x83,0x85,0x5d,0x28,0x0f,0x63,0xba,0xe3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x01,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f, + 0xff} }, + {0x28,0x18,0x0e,0x0800, + {0x09,0x03,0x00,0x02}, + 0xa3, + {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f, + 0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00, + 0x83,0x85,0x5d,0x14,0x1f,0x63,0xba,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} }, + {0x28,0x18,0x0e,0x0800, + {0x09,0x03,0x00,0x02}, + 0xa3, + {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f, + 0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00, + 0x83,0x85,0x5d,0x14,0x1f,0x63,0xba,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} }, + {0x50,0x18,0x0e,0x1000, + {0x01,0x03,0x00,0x02}, + 0xa3, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00, + 0x83,0x85,0x5d,0x28,0x1f,0x63,0xba,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} }, + {0x50,0x18,0x0e,0x1000, + {0x01,0x03,0x00,0x02}, + 0xa3, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00, + 0x83,0x85,0x5d,0x28,0x1f,0x63,0xba,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} }, + {0x28,0x18,0x10,0x0800, + {0x08,0x03,0x00,0x02}, + 0x67, + {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f, + 0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x14,0x1f,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x0c,0x00,0x0f,0x08}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} }, + {0x50,0x18,0x10,0x1000, + {0x00,0x03,0x00,0x02}, + 0x67, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x0c,0x00,0x0f,0x08}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} }, + {0x50,0x18,0x10,0x1000, + {0x00,0x03,0x00,0x02}, + 0x66, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x28,0x0f,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08, + 0x10,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x0e,0x00,0x0f,0x08}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0a,0x00, + 0xff} }, + {0x50,0x1d,0x10,0xa000, + {0x01,0x0f,0x00,0x06}, + 0xe3, + {0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e, + 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 0xea,0x8c,0xdf,0x28,0x00,0xe7,0x04,0xc3, + 0xff}, + {0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x01,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x01, + 0xff} }, + {0x50,0x1d,0x10,0xa000, + {0x01,0x0f,0x00,0x06}, + 0xe3, + {0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e, + 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 0xea,0x8c,0xdf,0x28,0x00,0xe7,0x04,0xe3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x01,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f, + 0xff} }, + {0x28,0x18,0x08,0x2000, + {0x01,0x0f,0x00,0x0e}, + 0x63, + {0x5f,0x4f,0x50,0x82,0x54,0x80,0xbf,0x1f, + 0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x28,0x40,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, + 0x41,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0f, + 0xff} } +}; + +typedef struct _SiS300_ExtStruct +{ UCHAR Ext_ModeID; USHORT Ext_ModeFlag; USHORT Ext_ModeInfo; @@ -413,502 +423,594 @@ typedef struct _SiS300_ExtStruct { UCHAR VB_ExtTVYFilterIndex; UCHAR REFindex; } SiS300_ExtStruct; -SiS300_ExtStruct SiS300_EModeIDTable[] = { - {0x6a, 0x2212, 0x47, 0x3563, 0x0102, 0x08, 0x07, 0x00, 0x00, 0x00, 0x00}, - {0x2e, 0x0a1b, 0x36, 0x3539, 0x0101, 0x08, 0x06, 0x00, 0x00, 0x00, 0x08}, - {0x2f, 0x021b, 0x35, 0x3532, 0x0100, 0x08, 0x05, 0x00, 0x00, 0x00, 0x10}, - {0x30, 0x2a1b, 0x47, 0x3563, 0x0103, 0x08, 0x07, 0x00, 0x00, 0x00, 0x00}, - {0x31, 0x0a1b, 0xad, 0x3630, 0x0000, 0x08, 0x0c, 0x00, 0x00, 0x00, 0x11}, - {0x32, 0x2a1b, 0xae, 0x3637, 0x0000, 0x08, 0x0d, 0x00, 0x00, 0x00, 0x12}, - {0x33, 0x0a1d, 0xad, 0x3630, 0x0000, 0x08, 0x0c, 0x00, 0x00, 0x00, 0x11}, - {0x34, 0x2a1d, 0xae, 0x3637, 0x0000, 0x08, 0x0d, 0x00, 0x00, 0x00, 0x12}, - {0x35, 0x0a1f, 0xad, 0x3630, 0x0000, 0x08, 0x0c, 0x00, 0x00, 0x00, 0x11}, - {0x36, 0x2a1f, 0xae, 0x3637, 0x0000, 0x08, 0x0d, 0x00, 0x00, 0x00, 0x12}, - {0x37, 0x0212, 0x58, 0x358d, 0x0104, 0x08, 0x08, 0x00, 0x00, 0x00, 0x13}, - {0x38, 0x0a1b, 0x58, 0x358d, 0x0105, 0x08, 0x08, 0x00, 0x00, 0x00, 0x13}, - {0x3a, 0x0e3b, 0x69, 0x35be, 0x0107, 0x08, 0x09, 0x00, 0x00, 0x00, 0x1a}, - {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}, - {0x47, 0x2a1d, 0x47, 0x3563, 0x0114, 0x08, 0x07, 0x00, 0x00, 0x00, 0x00}, - {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, 0x921b, 0x13, 0x3524, 0x0133, 0x08, 0x03, 0x00, 0x00, 0x00, 0x25}, - {0x52, 0x921b, 0x24, 0x352b, 0x0134, 0x08, 0x04, 0x00, 0x00, 0x00, 0x26}, - {0x56, 0x921d, 0x01, 0x351d, 0x0135, 0x08, 0x01, 0x00, 0x00, 0x00, 0x24}, - {0x57, 0x921d, 0x13, 0x3524, 0x0136, 0x08, 0x03, 0x00, 0x00, 0x00, 0x25}, - {0x58, 0x921d, 0x24, 0x352b, 0x0137, 0x08, 0x04, 0x00, 0x00, 0x00, 0x26}, - {0x59, 0x921b, 0x00, 0x3516, 0x0138, 0x08, 0x00, 0x00, 0x00, 0x00, 0x23}, - {0x5d, 0x021d, 0x35, 0x3532, 0x0139, 0x08, 0x05, 0x00, 0x00, 0x00, 0x10}, - {0x62, 0x0a3f, 0x36, 0x3539, 0x013a, 0x08, 0x06, 0x00, 0x00, 0x00, 0x08}, - {0x63, 0x2a3f, 0x47, 0x3563, 0x013b, 0x08, 0x07, 0x00, 0x00, 0x00, 0x00}, - {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, 0x0c, 0x00, 0x00, 0x00, 0x28}, - {0x6d, 0x06fd, 0x9c, 0x35f6, 0x0000, 0x10, 0x0c, 0x00, 0x00, 0x00, 0x28}, - {0x6e, 0x0e3b, 0x6f, 0x35b2, 0x0000, 0x08, 0x0e, 0x00, 0x00, 0x00, 0x29}, - {0x6f, 0x0e7d, 0x6f, 0x35b2, 0x0000, 0x08, 0x0e, 0x00, 0x00, 0x00, 0x29}, - {0x7b, 0x0eff, 0x6f, 0x35b2, 0x0000, 0x08, 0x0e, 0x00, 0x00, 0x00, 0x29}, - {0x7c, 0x221b, 0xb3, 0x363e, 0x0000, 0x08, 0x0f, 0x00, 0x00, 0x00, 0x2b}, - {0x7d, 0x221d, 0xb3, 0x363e, 0x0000, 0x08, 0x0f, 0x00, 0x00, 0x00, 0x2b}, - {0x7e, 0x223f, 0xb3, 0x363e, 0x0000, 0x08, 0x0f, 0x00, 0x00, 0x00, 0x2b}, - {0xff, 0x0000, 0x00, 0x0000, 0xffff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} -}; - -typedef struct _SiS300_Ext2Struct { + +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 */ + {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 */ + {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 */ + {0x24,0x0a3d,0xc5,0x431d,0x0000,0x08,0x10,0x00,0x00,0x00,0x2c}, + {0x25,0x0a7f,0xc5,0x431d,0x0000,0x08,0x10,0x00,0x00,0x00,0x2c}, + {0xff,0x0000,0x00,0x0000,0xffff,0x00,0x00,0x00,0x00,0x00,0x00} +}; + +typedef struct _SiS300_Ext2Struct +{ USHORT Ext_InfoFlag; - UCHAR Ext_CRT1CRTC; + UCHAR Ext_CRT1CRTC; /* TW: Index in SiS300_CRT1Table */ UCHAR Ext_CRTVCLK; - UCHAR Ext_CRT2CRTC; - UCHAR ModeID; + UCHAR Ext_CRT2CRTC; /* TW: Index in LCD Paneltype arrays (&3f) */ + UCHAR ModeID; USHORT XRes; USHORT YRes; USHORT ROM_OFFSET; } SiS300_Ext2Struct; -SiS300_Ext2Struct SiS300_RefIndex[] = { - {0x085f, 0x0d, 0x03, 0x05, 0x6a, 800, 600, 0x3563}, - {0x0467, 0x0e, 0x44, 0x05, 0x6a, 800, 600, 0x3568}, - {0x0067, 0x4f, 0x07, 0x48, 0x6a, 800, 600, 0x356d}, - {0x0067, 0x10, 0x06, 0x8b, 0x6a, 800, 600, 0x3572}, - {0x0147, 0x11, 0x08, 0x00, 0x6a, 800, 600, 0x3577}, - {0x0147, 0x12, 0x0c, 0x00, 0x6a, 800, 600, 0x357c}, - {0x0047, 0x51, 0x4e, 0x00, 0x6a, 800, 600, 0x3581}, - {0x0047, 0x11, 0x13, 0x00, 0x6a, 800, 600, 0x3586}, - {0xc85f, 0x05, 0x00, 0x04, 0x2e, 640, 480, 0x3539}, - {0xc067, 0x06, 0x02, 0x04, 0x2e, 640, 480, 0x353e}, - {0xc067, 0x07, 0x02, 0x47, 0x2e, 640, 480, 0x3543}, - {0xc067, 0x08, 0x03, 0x8a, 0x2e, 640, 480, 0x3548}, - {0xc047, 0x09, 0x05, 0x00, 0x2e, 640, 480, 0x354d}, - {0xc047, 0x0a, 0x08, 0x00, 0x2e, 640, 480, 0x3552}, - {0xc047, 0x0b, 0x0a, 0x00, 0x2e, 640, 480, 0x3557}, - {0xc047, 0x0c, 0x10, 0x00, 0x2e, 640, 480, 0x355c}, - {0x487f, 0x04, 0x00, 0x00, 0x2f, 640, 400, 0x3532}, - {0xc00f, 0x31, 0x01, 0x06, 0x31, 2048, 1536, 0x3630}, - {0x000f, 0x32, 0x03, 0x06, 0x32, 720, 480, 0x3637}, - {0x0187, 0x15, 0x05, 0x00, 0x37, 1024, 768, 0x358d}, - {0xc877, 0x16, 0x09, 0x06, 0x37, 1024, 768, 0x3592}, - {0xc067, 0x97, 0x0b, 0x49, 0x37, 1024, 768, 0x3597}, - {0x0267, 0x18, 0x0d, 0x00, 0x37, 1024, 768, 0x359c}, - {0x0047, 0x59, 0x11, 0x8c, 0x37, 1024, 768, 0x35a1}, - {0x0047, 0x1a, 0x52, 0x00, 0x37, 1024, 768, 0x35a6}, - {0x0047, 0x5b, 0x16, 0x00, 0x37, 1024, 768, 0x35ab}, - {0x0387, 0x5c, 0x4d, 0x00, 0x3a, 1280, 1024, 0x35be}, - {0x0077, 0x1d, 0x14, 0x07, 0x3a, 1280, 1024, 0x35c3}, - {0x0047, 0x1e, 0x17, 0x00, 0x3a, 1280, 1024, 0x35c8}, - {0x0007, 0x1f, 0x98, 0x00, 0x3a, 1280, 1024, 0x35cd}, - {0x0007, 0x60, 0x59, 0x00, 0x3c, 1600, 1200, 0x35d4}, - {0x0007, 0x21, 0x5a, 0x00, 0x3c, 1600, 1200, 0x35d9}, - {0x0007, 0x22, 0x1b, 0x00, 0x3c, 1600, 1200, 0x35de}, - {0x0007, 0x63, 0x1d, 0x00, 0x3c, 1600, 1200, 0x35e3}, - {0x0007, 0x24, 0x1e, 0x00, 0x3c, 1600, 1200, 0x35e8}, - {0x407f, 0x00, 0x00, 0x00, 0x40, 320, 200, 0x3516}, - {0xc07f, 0x01, 0x00, 0x04, 0x50, 320, 240, 0x351d}, - {0x0077, 0x02, 0x04, 0x05, 0x51, 400, 300, 0x3524}, - {0xc077, 0x03, 0x09, 0x06, 0x52, 512, 384, 0x352b}, - {0x8207, 0x25, 0x1f, 0x00, 0x68, 1920, 1440, 0x35ef}, - {0x0007, 0x26, 0x20, 0x00, 0x6c, 2048, 1536, 0x35f6}, - {0x0027, 0x27, 0x14, 0x08, 0x6e, 720, 576, 0x35b2}, - {0x0027, 0x27, 0x14, 0x08, 0x6e, 720, 576, 0x35b7}, - {0x00df, 0x33, 0x28, 0x00, 0x7c, 1280, 960, 0x363e}, - {0xc05f, 0x34, 0x28, 0x00, 0x7c, 1280, 960, 0x3643}, - {0xffff, 0, 0, 0, 0, 0, 0, 0} + +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,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,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 */ + {0xc067,0x07,0x02,0x47,0x2e, 640, 480,0x3543}, /* 0a */ + {0xc067,0x08,0x03,0x8a,0x2e, 640, 480,0x3548}, /* 0b */ + {0xc047,0x09,0x05,0x00,0x2e, 640, 480,0x354d}, /* 0c */ + {0xc047,0x0a,0x08,0x00,0x2e, 640, 480,0x3552}, /* 0d */ + {0xc047,0x0b,0x0a,0x00,0x2e, 640, 480,0x3557}, /* 0e */ + {0xc047,0x0c,0x10,0x00,0x2e, 640, 480,0x355c}, /* 0f */ + {0x487f,0x04,0x00,0x00,0x2f, 640, 400,0x3532}, /* 10 */ + {0xc00f,0x31,0x01,0x06,0x31, 720, 480,0x3630}, /* 11 */ + {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 */ + {0x0267,0x18,0x0d,0x00,0x37,1024, 768,0x359c}, /* 16 */ + {0x0047,0x59,0x11,0x8c,0x37,1024, 768,0x35a1}, /* 17 */ + {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 */ + {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,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,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 */ + {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 */ + {0xc077,0x33,0x09,0x06,0x20,1024, 600,0x0000}, /* 2b */ + {0xc077,0x34,0x09,0x06,0x23,1152, 768,0x0000}, /* 2c */ + {0xffff,0,0,0,0,0,0,0} }; /*add for 300 oem util*/ -typedef struct _SiS_VBModeIDTableStruct { - UCHAR ModeID; - UCHAR VB_TVDelayIndex; - UCHAR VB_TVFlickerIndex; - UCHAR VB_TVPhaseIndex; - UCHAR VB_TVYFilterIndex; - UCHAR VB_LCDDelayIndex; - UCHAR _VB_LCDHIndex; - UCHAR _VB_LCDVIndex; -} SiS_VBModeIDTableStruct; -SiS_VBModeIDTableStruct SiS300_VBModeIDTable[] = { - {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}, - {0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x01}, - {0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x02}, - {0x05, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00}, - {0x06, 0x00, 0x00, 0x01, 0x05, 0x00, 0x02, 0x00}, - {0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x01}, - {0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x02}, - {0x0d, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00}, - {0x0e, 0x00, 0x00, 0x01, 0x05, 0x00, 0x02, 0x00}, - {0x0f, 0x00, 0x00, 0x01, 0x05, 0x00, 0x02, 0x01}, - {0x10, 0x00, 0x00, 0x01, 0x05, 0x00, 0x02, 0x01}, - {0x11, 0x00, 0x00, 0x01, 0x05, 0x00, 0x02, 0x03}, - {0x12, 0x00, 0x00, 0x01, 0x05, 0x00, 0x02, 0x03}, - {0x13, 0x00, 0x00, 0x01, 0x04, 0x00, 0x04, 0x00}, - {0x6a, 0x00, 0x00, 0x01, 0x07, 0x00, 0x08, 0x0a}, - {0x2e, 0x00, 0x00, 0x01, 0x05, 0x00, 0x06, 0x08}, - {0x2f, 0x00, 0x00, 0x01, 0x05, 0x00, 0x06, 0x06}, - {0x30, 0x00, 0x00, 0x01, 0x07, 0x00, 0x08, 0x0a}, - {0x31, 0x00, 0x00, 0x01, 0x06, 0x00, 0x00, 0x00}, - {0x32, 0x00, 0x00, 0x01, 0x06, 0x00, 0x00, 0x00}, - {0x37, 0x00, 0x00, 0x01, 0x00, 0x00, 0x0a, 0x0c}, - {0x38, 0x00, 0x00, 0x01, 0x00, 0x00, 0x0a, 0x0c}, - {0x3a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x0b, 0x0d}, - {0x40, 0x00, 0x00, 0x01, 0x04, 0x00, 0x05, 0x05}, - {0x41, 0x00, 0x00, 0x01, 0x04, 0x00, 0x05, 0x05}, - {0x43, 0x00, 0x00, 0x01, 0x05, 0x00, 0x06, 0x08}, - {0x44, 0x00, 0x00, 0x01, 0x05, 0x00, 0x06, 0x08}, - {0x46, 0x00, 0x00, 0x01, 0x07, 0x00, 0x08, 0x0a}, - {0x47, 0x00, 0x00, 0x01, 0x07, 0x00, 0x08, 0x0a}, - {0x49, 0x00, 0x00, 0x01, 0x00, 0x00, 0x0a, 0x0c}, - {0x4a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x0a, 0x0c}, - {0x4c, 0x00, 0x00, 0x01, 0x00, 0x00, 0x0b, 0x0d}, - {0x4d, 0x00, 0x00, 0x01, 0x00, 0x00, 0x0b, 0x0d}, - {0x50, 0x00, 0x00, 0x01, 0x04, 0x00, 0x05, 0x07}, - {0x51, 0x00, 0x00, 0x01, 0x07, 0x00, 0x07, 0x09}, - {0x52, 0x00, 0x00, 0x01, 0x00, 0x00, 0x09, 0x0b}, - {0x56, 0x00, 0x00, 0x01, 0x04, 0x00, 0x05, 0x07}, - {0x57, 0x00, 0x00, 0x01, 0x07, 0x00, 0x07, 0x09}, - {0x58, 0x00, 0x00, 0x01, 0x00, 0x00, 0x09, 0x0b}, - {0x59, 0x00, 0x00, 0x01, 0x04, 0x00, 0x05, 0x05}, - {0x5d, 0x00, 0x00, 0x01, 0x07, 0x00, 0x06, 0x06}, - {0x62, 0x00, 0x00, 0x01, 0x05, 0x00, 0x06, 0x08}, - {0x63, 0x00, 0x00, 0x01, 0x07, 0x00, 0x08, 0x0a}, - {0x64, 0x00, 0x00, 0x01, 0x00, 0x00, 0x0a, 0x0c}, - {0x65, 0x00, 0x00, 0x01, 0x00, 0x00, 0x0b, 0x0d}, - {0x6e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x0b, 0x0d}, - {0x6f, 0x00, 0x00, 0x01, 0x00, 0x00, 0x0b, 0x0d}, - {0x7b, 0x00, 0x00, 0x01, 0x00, 0x00, 0x0b, 0x0d} +typedef struct _SiS_VBModeIDTableStruct +{ + UCHAR ModeID; + UCHAR VB_TVDelayIndex; + UCHAR VB_TVFlickerIndex; + UCHAR VB_TVPhaseIndex; + UCHAR VB_TVYFilterIndex; + UCHAR VB_LCDDelayIndex; + UCHAR _VB_LCDHIndex; + UCHAR _VB_LCDVIndex; +}SiS_VBModeIDTableStruct; + +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,0x01}, + {0x01,0x00,0x00,0x00,0x01,0x00,0x01,0x02}, + {0x03,0x00,0x00,0x00,0x02,0x00,0x02,0x00}, + {0x03,0x00,0x00,0x00,0x02,0x00,0x02,0x01}, + {0x03,0x00,0x00,0x00,0x03,0x00,0x03,0x02}, + {0x05,0x00,0x00,0x01,0x04,0x00,0x00,0x00}, + {0x06,0x00,0x00,0x01,0x05,0x00,0x02,0x00}, + {0x07,0x00,0x00,0x00,0x03,0x00,0x03,0x01}, + {0x07,0x00,0x00,0x00,0x03,0x00,0x03,0x02}, + {0x0d,0x00,0x00,0x01,0x04,0x00,0x00,0x00}, + {0x0e,0x00,0x00,0x01,0x05,0x00,0x02,0x00}, + {0x0f,0x00,0x00,0x01,0x05,0x00,0x02,0x01}, + {0x10,0x00,0x00,0x01,0x05,0x00,0x02,0x01}, + {0x11,0x00,0x00,0x01,0x05,0x00,0x02,0x03}, + {0x12,0x00,0x00,0x01,0x05,0x00,0x02,0x03}, + {0x13,0x00,0x00,0x01,0x04,0x00,0x04,0x00}, + {0x6a,0x00,0x00,0x01,0x07,0x00,0x08,0x0a}, + {0x2e,0x00,0x00,0x01,0x05,0x00,0x06,0x08}, + {0x2f,0x00,0x00,0x01,0x05,0x00,0x06,0x06}, + {0x30,0x00,0x00,0x01,0x07,0x00,0x08,0x0a}, + {0x31,0x00,0x00,0x01,0x06,0x00,0x00,0x00}, + {0x32,0x00,0x00,0x01,0x06,0x00,0x00,0x00}, + {0x37,0x00,0x00,0x01,0x00,0x00,0x0a,0x0c}, + {0x38,0x00,0x00,0x01,0x00,0x00,0x0a,0x0c}, + {0x3a,0x00,0x00,0x01,0x00,0x00,0x0b,0x0d}, + {0x40,0x00,0x00,0x01,0x04,0x00,0x05,0x05}, + {0x41,0x00,0x00,0x01,0x04,0x00,0x05,0x05}, + {0x43,0x00,0x00,0x01,0x05,0x00,0x06,0x08}, + {0x44,0x00,0x00,0x01,0x05,0x00,0x06,0x08}, + {0x46,0x00,0x00,0x01,0x07,0x00,0x08,0x0a}, + {0x47,0x00,0x00,0x01,0x07,0x00,0x08,0x0a}, + {0x49,0x00,0x00,0x01,0x00,0x00,0x0a,0x0c}, + {0x4a,0x00,0x00,0x01,0x00,0x00,0x0a,0x0c}, + {0x4c,0x00,0x00,0x01,0x00,0x00,0x0b,0x0d}, + {0x4d,0x00,0x00,0x01,0x00,0x00,0x0b,0x0d}, + {0x50,0x00,0x00,0x01,0x04,0x00,0x05,0x07}, + {0x51,0x00,0x00,0x01,0x07,0x00,0x07,0x09}, + {0x52,0x00,0x00,0x01,0x00,0x00,0x09,0x0b}, + {0x56,0x00,0x00,0x01,0x04,0x00,0x05,0x07}, + {0x57,0x00,0x00,0x01,0x07,0x00,0x07,0x09}, + {0x58,0x00,0x00,0x01,0x00,0x00,0x09,0x0b}, + {0x59,0x00,0x00,0x01,0x04,0x00,0x05,0x05}, + {0x5d,0x00,0x00,0x01,0x07,0x00,0x06,0x06}, + {0x62,0x00,0x00,0x01,0x05,0x00,0x06,0x08}, + {0x63,0x00,0x00,0x01,0x07,0x00,0x08,0x0a}, + {0x64,0x00,0x00,0x01,0x00,0x00,0x0a,0x0c}, + {0x65,0x00,0x00,0x01,0x00,0x00,0x0b,0x0d}, + {0x6e,0x00,0x00,0x01,0x00,0x00,0x0b,0x0d}, + {0x6f,0x00,0x00,0x01,0x00,0x00,0x0b,0x0d}, + {0x7b,0x00,0x00,0x01,0x00,0x00,0x0b,0x0d}, + {0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00} /* TW: added! */ }; /*end*/ -typedef struct _SiS300_CRT1TableStruct { +typedef struct _SiS300_CRT1TableStruct +{ UCHAR CR[17]; } SiS300_CRT1TableStruct; -SiS300_CRT1TableStruct SiS300_CRT1Table[] = { - {{0x2d, 0x27, 0x28, 0x90, 0x2c, 0x80, 0xbf, 0x1f, - 0x9c, 0x8e, 0x8f, 0x96, 0xb9, 0x30, 0x00, 0x04, - 0x00}}, - {{0x2d, 0x27, 0x28, 0x90, 0x2c, 0x80, 0x0b, 0x3e, - 0xe9, 0x8b, 0xdf, 0xe7, 0x04, 0x00, 0x00, 0x04, - 0x00}}, - {{0x3d, 0x31, 0x31, 0x81, 0x37, 0x1f, 0x72, 0xf0, - 0x58, 0x8c, 0x57, 0x57, 0x73, 0x20, 0x00, 0x05, - 0x01}}, - {{0x4f, 0x3f, 0x3f, 0x93, 0x45, 0x0d, 0x24, 0xf5, - 0x02, 0x88, 0xff, 0xff, 0x25, 0x10, 0x00, 0x01, - 0x01}}, - {{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, - 0xe9, 0x8b, 0xdf, 0xe7, 0x04, 0x00, 0x00, 0x05, - 0x00}}, - {{0x63, 0x4f, 0x50, 0x86, 0x56, 0x9b, 0x06, 0x3e, - 0xe8, 0x8b, 0xdf, 0xe7, 0xff, 0x10, 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, - 0xe4, 0x87, 0xdf, 0xdf, 0x04, 0x00, 0x00, 0x01, - 0x00}}, - {{0x6c, 0x4f, 0x4f, 0x83, 0x59, 0x9e, 0x00, 0x3e, - 0xe5, 0x8d, 0xdf, 0xdf, 0x01, 0x00, 0x00, 0x01, - 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, - 0x00}}, - {{0x7b, 0x63, 0x63, 0x9f, 0x6a, 0x93, 0x6f, 0xf0, - 0x58, 0x8a, 0x57, 0x57, 0x70, 0x20, 0x00, 0x05, - 0x01}}, - {{0x7f, 0x63, 0x63, 0x83, 0x6c, 0x1c, 0x72, 0xf0, - 0x58, 0x8c, 0x57, 0x57, 0x73, 0x20, 0x00, 0x06, - 0x01}}, - {{0x7d, 0x63, 0x63, 0x81, 0x6e, 0x1d, 0x98, 0xf0, - 0x7c, 0x82, 0x57, 0x57, 0x99, 0x00, 0x00, 0x06, - 0x01}}, - {{0x7f, 0x63, 0x63, 0x83, 0x69, 0x13, 0x6f, 0xf0, - 0x58, 0x8b, 0x57, 0x57, 0x70, 0x20, 0x00, 0x06, - 0x01}}, - {{0x7e, 0x63, 0x63, 0x82, 0x6b, 0x13, 0x75, 0xf0, - 0x58, 0x8b, 0x57, 0x57, 0x76, 0x20, 0x00, 0x06, - 0x01}}, - {{0x8c, 0x63, 0x63, 0x87, 0x72, 0x16, 0x7e, 0xf0, - 0x59, 0x8d, 0x57, 0x57, 0x7f, 0x00, 0x00, 0x06, - 0x01}}, - {{0x7e, 0x63, 0x63, 0x82, 0x6c, 0x14, 0x75, 0xe0, - 0x58, 0x0b, 0x57, 0x57, 0x76, 0x20, 0x00, 0x06, - 0x01}}, - {{0x7e, 0x63, 0x63, 0x82, 0x6c, 0x14, 0x75, 0xe0, - 0x58, 0x0b, 0x57, 0x57, 0x76, 0x20, 0x00, 0x06, - 0x01}}, - {{0x99, 0x7f, 0x7f, 0x9d, 0x84, 0x1a, 0x96, 0x1f, - 0x7f, 0x83, 0x7f, 0x7f, 0x97, 0x10, 0x00, 0x02, - 0x00}}, - {{0xa3, 0x7f, 0x7f, 0x87, 0x86, 0x97, 0x24, 0xf5, - 0x02, 0x88, 0xff, 0xff, 0x25, 0x10, 0x00, 0x02, - 0x01}}, - {{0xa1, 0x7f, 0x7f, 0x85, 0x86, 0x97, 0x24, 0xf5, - 0x02, 0x88, 0xff, 0xff, 0x25, 0x10, 0x00, 0x02, - 0x01}}, - {{0x9f, 0x7f, 0x7f, 0x83, 0x85, 0x91, 0x1e, 0xf5, - 0x00, 0x83, 0xff, 0xff, 0x1f, 0x10, 0x00, 0x02, - 0x01}}, - {{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, - 0x00, 0x84, 0xff, 0xff, 0x1f, 0x10, 0x00, 0x02, - 0x01}}, - {{0xa2, 0x7f, 0x7f, 0x86, 0x84, 0x94, 0x37, 0xf5, - 0x0b, 0x82, 0xff, 0xff, 0x38, 0x10, 0x00, 0x02, - 0x01}}, - {{0xcf, 0x9f, 0x9f, 0x93, 0xb2, 0x01, 0x14, 0xba, - 0x00, 0x83, 0xff, 0xff, 0x15, 0x00, 0x00, 0x03, - 0x00}}, - {{0xce, 0x9f, 0x9f, 0x92, 0xa9, 0x17, 0x28, 0x5a, - 0x00, 0x83, 0xff, 0xff, 0x29, 0x09, 0x00, 0x07, - 0x01}}, - {{0xce, 0x9f, 0x9f, 0x92, 0xa5, 0x17, 0x28, 0x5a, - 0x00, 0x83, 0xff, 0xff, 0x29, 0x09, 0x00, 0x07, - 0x01}}, - {{0xd3, 0x9f, 0x9f, 0x97, 0xab, 0x1f, 0x2e, 0x5a, - 0x00, 0x83, 0xff, 0xff, 0x2f, 0x09, 0x00, 0x07, - 0x01}}, - {{0x09, 0xc7, 0xc7, 0x8d, 0xd3, 0x0b, 0xe0, 0x10, - 0xb0, 0x83, 0xaf, 0xaf, 0xe1, 0x2f, 0x01, 0x04, - 0x00}}, - {{0x09, 0xc7, 0xc7, 0x8d, 0xd3, 0x0b, 0xe0, 0x10, - 0xb0, 0x83, 0xaf, 0xaf, 0xe1, 0x2f, 0x01, 0x04, - 0x00}}, - {{0x09, 0xc7, 0xc7, 0x8d, 0xd3, 0x0b, 0xe0, 0x10, - 0xb0, 0x83, 0xaf, 0xaf, 0xe1, 0x2f, 0x01, 0x04, - 0x00}}, - {{0x09, 0xc7, 0xc7, 0x8d, 0xd3, 0x0b, 0xe0, 0x10, - 0xb0, 0x83, 0xaf, 0xaf, 0xe1, 0x2f, 0x01, 0x04, - 0x00}}, - {{0x09, 0xc7, 0xc7, 0x8d, 0xd3, 0x0b, 0xe0, 0x10, - 0xb0, 0x83, 0xaf, 0xaf, 0xe1, 0x2f, 0x01, 0x04, - 0x00}}, - {{0x3f, 0xef, 0xef, 0x83, 0xfd, 0x1a, 0xda, 0x1f, - 0xa0, 0x84, 0x9f, 0x9f, 0xdb, 0x1f, 0x01, 0x01, - 0x00}}, - {{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, - 0xc0, 0xc3, 0xbf, 0xbf, 0xe7, 0x10, 0x00, 0x07, - 0x01}}, - {{0x7f, 0x63, 0x63, 0x83, 0x6c, 0x1c, 0x72, 0xba, - 0x27, 0x8b, 0xdf, 0xdf, 0x73, 0x00, 0x00, 0x06, - 0x01}}, - {{0x7f, 0x63, 0x63, 0x83, 0x69, 0x13, 0x6f, 0xba, - 0x26, 0x89, 0xdf, 0xdf, 0x6f, 0x00, 0x00, 0x06, - 0x01}}, - {{0x7f, 0x63, 0x63, 0x82, 0x6b, 0x13, 0x75, 0xba, - 0x29, 0x8c, 0xdf, 0xdf, 0x75, 0x00, 0x00, 0x06, - 0x01}}, - {{0xa3, 0x7f, 0x7f, 0x87, 0x86, 0x97, 0x24, 0xf1, - 0xaf, 0x85, 0x3f, 0x3f, 0x25, 0x30, 0x00, 0x02, - 0x01}}, - {{0x9f, 0x7f, 0x7f, 0x83, 0x85, 0x91, 0x1e, 0xf1, - 0xad, 0x81, 0x3f, 0x3f, 0x1f, 0x30, 0x00, 0x02, - 0x01}}, - {{0xa7, 0x7f, 0x7f, 0x88, 0x89, 0x15, 0x26, 0xf1, - 0xb1, 0x85, 0x3f, 0x3f, 0x27, 0x30, 0x00, 0x02, - 0x01}}, - {{0xce, 0x9f, 0x9f, 0x92, 0xa9, 0x17, 0x28, 0xc4, - 0x7a, 0x8e, 0xcf, 0xcf, 0x29, 0x21, 0x00, 0x07, - 0x01}}, - {{0xce, 0x9f, 0x9f, 0x92, 0xa5, 0x17, 0x28, 0xd4, - 0x7a, 0x8e, 0xcf, 0xcf, 0x29, 0x21, 0x00, 0x07, - 0x01}}, - {{0xd3, 0x9f, 0x9f, 0x97, 0xab, 0x1f, 0x2e, 0xd4, - 0x7d, 0x81, 0xcf, 0xcf, 0x2f, 0x21, 0x00, 0x07, - 0x01}}, - {{0x6b, 0x59, 0x59, 0x8f, 0x5e, 0x8c, 0x0b, 0x3e, - 0xe9, 0x8b, 0xdf, 0xe7, 0x04, 0x00, 0x00, 0x05, - 0x00}}, - {{0x7b, 0x59, 0x63, 0x9f, 0x6a, 0x93, 0x6f, 0xf0, - 0x58, 0x8a, 0x3f, 0x57, 0x70, 0x20, 0x00, 0x05, - 0x01}}, - {{0x86, 0x6a, 0x6a, 0x8a, 0x74, 0x06, 0x8c, 0x15, - 0x4f, 0x83, 0xef, 0xef, 0x8d, 0x30, 0x00, 0x02, - 0x00}}, - {{0x81, 0x6a, 0x6a, 0x85, 0x70, 0x00, 0x0f, 0x3e, - 0xeb, 0x8e, 0xdf, 0xdf, 0x10, 0x00, 0x00, 0x02, - 0x00}} -}; -typedef struct _SiS300_MCLKDataStruct { - UCHAR SR28, SR29, SR2A; +SiS300_CRT1TableStruct SiS300_CRT1Table[]= +{ + {{0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f, /* 0x00 */ + 0x9c,0x8e,0x8f,0x96,0xb9,0x30,0x00,0x00, + 0x00}}, + {{0x2d,0x27,0x28,0x90,0x2c,0x80,0x0b,0x3e, + 0xe9,0x8b,0xdf,0xe7,0x04,0x00,0x00,0x00, + 0x00}}, + {{0x3d,0x31,0x31,0x81,0x37,0x1f,0x72,0xf0, + 0x58,0x8c,0x57,0x57,0x73,0x20,0x00,0x05, + 0x01}}, + {{0x4f,0x3f,0x3f,0x93,0x45,0x0d,0x24,0xf5, + 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x01, + 0x01}}, + {{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, + 0xe9,0x8b,0xdf,0xe7,0x04,0x00,0x00,0x05, + 0x00}}, + {{0x63,0x4f,0x50,0x86,0x56,0x9b,0x06,0x3e, + 0xe8,0x8b,0xdf,0xe7,0xff,0x10,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, + 0xe4,0x87,0xdf,0xdf,0x04,0x00,0x00,0x01, + 0x00}}, + {{0x6c,0x4f,0x4f,0x83,0x59,0x9e,0x00,0x3e, /* 0x0a */ + 0xe5,0x8d,0xdf,0xdf,0x01,0x00,0x00,0x01, + 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, + 0x00}}, + {{0x7b,0x63,0x63,0x9f,0x6a,0x93,0x6f,0xf0, + 0x58,0x8a,0x57,0x57,0x70,0x20,0x00,0x05, + 0x01}}, + {{0x7f,0x63,0x63,0x83,0x6c,0x1c,0x72,0xf0, + 0x58,0x8c,0x57,0x57,0x73,0x20,0x00,0x06, + 0x01}}, + {{0x7d,0x63,0x63,0x81,0x6e,0x1d,0x98,0xf0, + 0x7c,0x82,0x57,0x57,0x99,0x00,0x00,0x06, + 0x01}}, + {{0x7f,0x63,0x63,0x83,0x69,0x13,0x6f,0xf0, + 0x58,0x8b,0x57,0x57,0x70,0x20,0x00,0x06, + 0x01}}, + {{0x7e,0x63,0x63,0x82,0x6b,0x13,0x75,0xf0, + 0x58,0x8b,0x57,0x57,0x76,0x20,0x00,0x06, + 0x01}}, + {{0x8c,0x63,0x63,0x87,0x72,0x16,0x7e,0xf0, + 0x59,0x8d,0x57,0x57,0x7f,0x00,0x00,0x06, + 0x01}}, + {{0x7e,0x63,0x63,0x82,0x6c,0x14,0x75,0xe0, + 0x58,0x0b,0x57,0x57,0x76,0x20,0x00,0x06, + 0x01}}, + {{0x7e,0x63,0x63,0x82,0x6c,0x14,0x75,0xe0, /* 0x14 */ + 0x58,0x0b,0x57,0x57,0x76,0x20,0x00,0x06, + 0x01}}, + {{0x99,0x7f,0x7f,0x9d,0x84,0x1a,0x96,0x1f, + 0x7f,0x83,0x7f,0x7f,0x97,0x10,0x00,0x02, + 0x00}}, + {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x02, + 0x01}}, + {{0xa1,0x7f,0x7f,0x85,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x02, + 0x01}}, + {{0x9f,0x7f,0x7f,0x83,0x85,0x91,0x1e,0xf5, + 0x00,0x83,0xff,0xff,0x1f,0x10,0x00,0x02, + 0x01}}, + {{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, + 0x00,0x84,0xff,0xff,0x1f,0x10,0x00,0x02, + 0x01}}, + {{0xa2,0x7f,0x7f,0x86,0x84,0x94,0x37,0xf5, + 0x0b,0x82,0xff,0xff,0x38,0x10,0x00,0x02, + 0x01}}, + {{0xcf,0x9f,0x9f,0x93,0xb2,0x01,0x14,0xba, + 0x00,0x83,0xff,0xff,0x15,0x00,0x00,0x03, + 0x00}}, + {{0xce,0x9f,0x9f,0x92,0xa9,0x17,0x28,0x5a, + 0x00,0x83,0xff,0xff,0x29,0x09,0x00,0x07, + 0x01}}, + {{0xce,0x9f,0x9f,0x92,0xa5,0x17,0x28,0x5a, /* 0x1e */ + 0x00,0x83,0xff,0xff,0x29,0x09,0x00,0x07, + 0x01}}, + {{0xd3,0x9f,0x9f,0x97,0xab,0x1f,0x2e,0x5a, + 0x00,0x83,0xff,0xff,0x2f,0x09,0x00,0x07, + 0x01}}, + {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, + 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, + 0x00}}, + {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, + 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, + 0x00}}, + {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, + 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, + 0x00}}, + {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, + 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, + 0x00}}, + {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, /* 36: 1600x1200x85Hz */ + 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, + 0x00}}, + {{0x3f,0xef,0xef,0x83,0xfd,0x1a,0xda,0x1f, /* 37: 1920x1440x60Hz */ + 0xa0,0x84,0x9f,0x9f,0xdb,0x1f,0x01,0x01, + 0x00}}, + {{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, + 0xc0,0xc3,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}}, + {{0x7f,0x63,0x63,0x83,0x69,0x13,0x6f,0xba, + 0x26,0x89,0xdf,0xdf,0x6f,0x00,0x00,0x06, + 0x01}}, + {{0x7f,0x63,0x63,0x82,0x6b,0x13,0x75,0xba, + 0x29,0x8c,0xdf,0xdf,0x75,0x00,0x00,0x06, + 0x01}}, + {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf1, + 0xaf,0x85,0x3f,0x3f,0x25,0x30,0x00,0x02, + 0x01}}, + {{0x9f,0x7f,0x7f,0x83,0x85,0x91,0x1e,0xf1, + 0xad,0x81,0x3f,0x3f,0x1f,0x30,0x00,0x02, + 0x01}}, + {{0xa7,0x7f,0x7f,0x88,0x89,0x15,0x26,0xf1, + 0xb1,0x85,0x3f,0x3f,0x27,0x30,0x00,0x02, + 0x01}}, + {{0xce,0x9f,0x9f,0x92,0xa9,0x17,0x28,0xc4, + 0x7a,0x8e,0xcf,0xcf,0x29,0x21,0x00,0x07, + 0x01}}, + {{0xce,0x9f,0x9f,0x92,0xa5,0x17,0x28,0xd4, + 0x7a,0x8e,0xcf,0xcf,0x29,0x21,0x00,0x07, + 0x01}}, + {{0xd3,0x9f,0x9f,0x97,0xab,0x1f,0x2e,0xd4, + 0x7d,0x81,0xcf,0xcf,0x2f,0x21,0x00,0x07, + 0x01}}, + {{0x6b,0x59,0x59,0x8f,0x5e,0x8c,0x0b,0x3e, + 0xe9,0x8b,0xdf,0xe7,0x04,0x00,0x00,0x05, + 0x00}}, + {{0x7b,0x59,0x63,0x9f,0x6a,0x93,0x6f,0xf0, /* 0x32 */ + 0x58,0x8a,0x3f,0x57,0x70,0x20,0x00,0x05, + 0x01}}, + {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x1e,0xf1, /* 0x33 - 1024x600 */ + 0xae,0x85,0x57,0x57,0x1f,0x30,0x00,0x02, + 0x01}}, + {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf5, /* 0x34 - 1152x768 */ + 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x02, + 0x01}} +}; + +typedef struct _SiS300_MCLKDataStruct +{ + UCHAR SR28,SR29,SR2A; USHORT CLOCK; } SiS300_MCLKDataStruct; -SiS300_MCLKDataStruct SiS300_MCLKData[] = { - {0x5a, 0x64, 0x80, 66}, - {0xb3, 0x45, 0x80, 83}, - {0x37, 0x61, 0x80, 100}, - {0x37, 0x22, 0x80, 133}, - {0x37, 0x61, 0x80, 100}, - {0x37, 0x61, 0x80, 100}, - {0x37, 0x61, 0x80, 100}, - {0x37, 0x61, 0x80, 100} -}; - -typedef struct _SiS300_ECLKDataStruct { - UCHAR SR2E, SR2F, SR30; + +SiS300_MCLKDataStruct SiS300_MCLKData[]= +{ /* TW: at 0x54 in BIOS */ + { 0x5a,0x64,0x80, 66}, + { 0xb3,0x45,0x80, 83}, + { 0x37,0x61,0x80,100}, + { 0x37,0x22,0x80,133}, + { 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[] = { - {0x54, 0x43, 0x80, 100}, - {0x53, 0x43, 0x80, 100}, - {0x55, 0x43, 0x80, 100}, - {0x52, 0x43, 0x80, 100}, - {0x3f, 0x42, 0x80, 100}, - {0x54, 0x43, 0x80, 100}, - {0x54, 0x43, 0x80, 100}, - {0x54, 0x43, 0x80, 100} -}; - -typedef struct _SiS300_VCLKDataStruct { - UCHAR SR2B, SR2C; + +SiS300_ECLKDataStruct SiS300_ECLKData[]= +{ + { 0x54,0x43,0x80,100}, + { 0x53,0x43,0x80,100}, + { 0x55,0x43,0x80,100}, + { 0x52,0x43,0x80,100}, + { 0x3f,0x42,0x80,100}, + { 0x54,0x43,0x80,100}, + { 0x54,0x43,0x80,100}, + { 0x54,0x43,0x80,100} +}; + +typedef struct _SiS300_VCLKDataStruct +{ + UCHAR SR2B,SR2C; USHORT CLOCK; } SiS300_VCLKDataStruct; -SiS300_VCLKDataStruct SiS300_VCLKData[] = { - {0x1b, 0xe1, 25}, - {0x4e, 0xe4, 28}, - {0x57, 0xe4, 32}, - {0xc3, 0xc8, 36}, - {0x42, 0xc3, 40}, - {0x5d, 0xc4, 45}, - {0x52, 0x65, 50}, - {0x53, 0x65, 50}, - {0x6d, 0x66, 56}, - {0x5a, 0x64, 65}, - {0x46, 0x44, 68}, - {0x3e, 0x43, 75}, - {0x6d, 0x46, 76}, - {0x41, 0x43, 79}, - {0x31, 0x42, 79}, - {0x46, 0x25, 85}, - {0x78, 0x29, 87}, - {0x62, 0x44, 95}, - {0x2b, 0x22, 105}, - {0x49, 0x24, 106}, - {0xc3, 0x28, 108}, - {0x3c, 0x23, 109}, - {0xf7, 0x2c, 132}, - {0xd4, 0x28, 136}, - {0x41, 0x05, 158}, - {0x43, 0x05, 162}, - {0xe1, 0x0f, 175}, - {0xfc, 0x12, 189}, - {0xde, 0x26, 194}, - {0x54, 0x05, 203}, - {0x3f, 0x03, 230}, - {0x30, 0x02, 234}, - {0x24, 0x01, 266}, - {0x52, 0x2a, 54}, - {0x52, 0x6a, 27}, - {0x62, 0x24, 70}, - {0x62, 0x64, 70}, - {0xa8, 0x4c, 30}, - {0x20, 0x26, 33}, - {0x31, 0xc2, 39}, - {0xbf, 0xc8, 35}, - {0x60, 0x36, 30}, - {0x40, 0x4a, 28}, - {0x9f, 0x46, 44}, - {0x97, 0x2c, 26}, - {0x44, 0xe4, 25}, - {0x7e, 0x32, 47}, - {0x8a, 0x24, 31}, - {0x97, 0x2c, 26}, - {0xce, 0x3c, 39}, - {0x52, 0x4a, 36}, - {0x34, 0x61, 95}, - {0x78, 0x27, 108}, - {0xff, 0x1b, 6625} -}; + +SiS300_VCLKDataStruct SiS300_VCLKData[]= +{ + { 0x1b,0xe1, 25}, + { 0x4e,0xe4, 28}, + { 0x57,0xe4, 32}, + { 0xc3,0xc8, 36}, + { 0x42,0xc3, 40}, + { 0x5d,0xc4, 45}, + { 0x52,0x65, 50}, + { 0x53,0x65, 50}, + { 0x6d,0x66, 56}, + { 0x5a,0x64, 65}, + { 0x46,0x44, 68}, + { 0x3e,0x43, 75}, + { 0x6d,0x46, 76}, /* 0x0c: 800x600 | LVDS_2(CH), MITAC(CH); - LVDS2(CH), A901(301B): 0xb1,0x46, 76 */ + { 0x41,0x43, 79}, + { 0x31,0x42, 79}, + { 0x46,0x25, 85}, + { 0x78,0x29, 87}, /* 0x10 */ + { 0x62,0x44, 95}, + { 0x2b,0x22,105}, + { 0x49,0x24,106}, + { 0xc3,0x28,108}, + { 0x3c,0x23,109}, + { 0xf7,0x2c,132}, + { 0xd4,0x28,136}, + { 0x41,0x05,158}, + { 0x43,0x05,162}, + { 0xe1,0x0f,175}, + { 0xfc,0x12,189}, + { 0xde,0x26,194}, + { 0x54,0x05,203}, + { 0x3f,0x03,230}, + { 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 */ + { 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 */ + { 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 */ + { 0x97,0x2c, 26}, + { 0xce,0x3c, 39}, + { 0x52,0x4a, 36}, + { 0x34,0x61, 95}, + { 0x78,0x27,108}, + { 0xce,0x25,189}, + { 0x45,0x6b, 21}, /* 0x36 */ /* TW: Added from Mitac */ + { 0xff,0x00, 0} +}; + +#if 0 /* TW: This table is in all BIOSes, but not used */ +SiS300_VCLKDataStruct SiS300_VBVCLKData[]= +{ + { 0x1b,0xe1, 25}, + { 0x4e,0xe4, 28}, + { 0x57,0xe4, 31}, + { 0xc3,0xc8, 36}, + { 0x42,0x47, 40}, + { 0x5d,0xc4, 44}, + { 0x52,0x47, 49}, + { 0x53,0x47, 50}, + { 0x6d,0x66, 56}, + { 0x5a,0x64, 65}, + { 0x46,0x44, 67}, + { 0x29,0x61, 75}, + { 0x6d,0x46, 75}, + { 0x41,0x43, 78}, + { 0x31,0x42, 79}, + { 0x46,0x25, 84}, + { 0x78,0x29, 86}, /* 0x10 */ + { 0x62,0x44, 94}, + { 0x2b,0x22,104}, + { 0x49,0x24,105}, + { 0x43,0x42,108}, + { 0x3c,0x23,109}, + { 0xe0,0x46,132}, + { 0x70,0x25,135}, + { 0x41,0x22,157}, + { 0x43,0x22,162}, + { 0x30,0x21,175}, + { 0xc1,0x24,189}, + { 0xde,0x26,194}, + { 0x70,0x07,202}, + { 0x3f,0x03,229}, + { 0x30,0x02,234}, /* 0x1f */ + { 0x24,0x01,265}, /* 0x20 */ + { 0x52,0x2a, 54}, + { 0x52,0x6a, 27}, + { 0x62,0x24, 70}, + { 0x62,0x64, 70}, + { 0xa8,0x4c, 30}, + { 0x20,0x26, 33}, + { 0x31,0xc2, 39}, + { 0x2e,0x48, 25}, /* 0x28 */ + { 0x24,0x46, 25}, /* 0x29 */ + { 0x26,0x64, 28}, + { 0x37,0x64, 40}, + { 0xa1,0x42,108}, + { 0x37,0x61,100}, + { 0x78,0x27,108}, + { 0xff,0x00, 0} +}; +#endif UCHAR SiS300_ScreenOffset[] = - { 0x14, 0x19, 0x20, 0x28, 0x32, 0x40, 0x50, 0x64, 0x78, 0x80, 0x2d, 0x35, - 0xff }; +{ + 0x14,0x19,0x20,0x28,0x32,0x40,0x50, + 0x64,0x78,0x80,0x2d,0x35,0x48,0xff +}; -typedef struct _SiS300_StResInfoStruct { +typedef struct _SiS300_StResInfoStruct +{ USHORT HTotal; USHORT VTotal; } SiS300_StResInfoStruct; -SiS300_StResInfoStruct SiS300_StResInfo[] = { - {640, 400}, - {640, 350}, - {720, 400}, - {720, 350}, - {640, 480} + +SiS300_StResInfoStruct SiS300_StResInfo[] = +{ + { 640,400}, + { 640,350}, + { 720,400}, + { 720,350}, + { 640,480} }; -typedef struct _SiS300_ModeResInfoStruct { +typedef struct _SiS300_ModeResInfoStruct +{ USHORT HTotal; USHORT VTotal; - UCHAR XChar; - UCHAR YChar; + UCHAR XChar; + UCHAR YChar; } SiS300_ModeResInfoStruct; -SiS300_ModeResInfoStruct SiS300_ModeResInfo[] = { - {320, 200, 8, 8}, - {320, 240, 8, 8}, - {320, 400, 8, 8}, - {400, 300, 8, 8}, - {512, 384, 8, 8}, - {640, 400, 8, 16}, - {640, 480, 8, 16}, - {800, 600, 8, 16}, - {1024, 768, 8, 16}, - {1280, 1024, 8, 16}, - {1600, 1200, 8, 16}, - {1920, 1440, 8, 16}, - {720, 480, 8, 16}, - {720, 576, 8, 16}, - {1280, 960, 8, 16} -}; - -UCHAR SiS300_OutputSelect = 0x40; + +SiS300_ModeResInfoStruct SiS300_ModeResInfo[] = +{ + { 320, 200, 8, 8}, /* 0x00 */ + { 320, 240, 8, 8}, /* 0x01 */ + { 320, 400, 8, 8}, /* 0x02 */ + { 400, 300, 8, 8}, /* 0x03 */ + { 512, 384, 8, 8}, /* 0x04 */ + { 640, 400, 8,16}, /* 0x05 */ + { 640, 480, 8,16}, /* 0x06 */ + { 800, 600, 8,16}, /* 0x07 */ + { 1024, 768, 8,16}, /* 0x08 */ + { 1280,1024, 8,16}, /* 0x09 */ + { 1600,1200, 8,16}, /* 0x0a */ + { 1920,1440, 8,16}, /* 0x0b */ + { 720, 480, 8,16}, /* 0x0c */ + { 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_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; @@ -916,42 +1018,68 @@ 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_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, 0x8 }; -UCHAR SiS300_PALPhase[] = { 0x2a, 0x5, 0xd3, 0x0 }; -UCHAR SiS300_NTSCPhase2[] = { 0x21, 0xF0, 0x7B, 0xD6 }; /*301b */ -UCHAR SiS300_PALPhase2[] = { 0x2a, 0x09, 0x86, 0xe9 }; -UCHAR SiS300_PALMPhase[] = { 0x21, 0xE4, 0x2E, 0x9B }; /*palmn */ -UCHAR SiS300_PALNPhase[] = { 0x21, 0xF4, 0x3E, 0xBA }; - -typedef struct _SiS300_PanelDelayTblStruct { +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*/ + +typedef struct _SiS300_PanelDelayTblStruct +{ UCHAR timer[2]; } SiS300_PanelDelayTblStruct; -SiS300_PanelDelayTblStruct SiS300_PanelDelayTbl[] = { - {{0x05, 0xaa}}, - {{0x05, 0x14}}, - {{0x05, 0x36}}, - {{0x05, 0x14}}, - {{0x05, 0x14}}, - {{0x05, 0x14}}, - {{0x05, 0x90}}, - {{0x05, 0x90}}, - {{0x05, 0x14}}, - {{0x05, 0x14}}, - {{0x05, 0x14}}, - {{0x05, 0x14}}, - {{0x05, 0x64}}, - {{0x05, 0x14}}, - {{0x05, 0x14}}, - {{0x05, 0x14}} -}; - -typedef struct _SiS300_LCDDataStruct { + +SiS300_PanelDelayTblStruct SiS300_PanelDelayTbl[] = +{ + {{0x05,0xaa}}, + {{0x05,0x14}}, + {{0x05,0x36}}, + {{0x05,0x14}}, + {{0x05,0x14}}, + {{0x05,0x14}}, + {{0x05,0x90}}, + {{0x05,0x90}}, + {{0x05,0x14}}, + {{0x05,0x14}}, + {{0x05,0x14}}, + {{0x05,0x14}}, + {{0x05,0x64}}, + {{0x05,0x14}}, + {{0x05,0x14}}, + {{0x05,0x14}} +}; + +SiS300_PanelDelayTblStruct SiS300_PanelDelayTblLVDS[] = +{ + {{0x05,0xaa}}, + {{0x05,0x14}}, + {{0x05,0x36}}, + {{0x05,0x14}}, + {{0x05,0x14}}, + {{0x05,0x14}}, + {{0x05,0x90}}, + {{0x05,0x90}}, + {{0x05,0x14}}, + {{0x05,0x14}}, + {{0x05,0x14}}, + {{0x05,0x14}}, + {{0x05,0x28}}, /* 2.04.5c: 20, 80 - Clevo (2.04.2c): 05, 28 */ + {{0x05,0x14}}, + {{0x05,0x14}}, /* Some BIOSes: 05, 40 */ + {{0x05,0x60}} +}; + +typedef struct _SiS300_LCDDataStruct +{ USHORT RVBHCMAX; USHORT RVBHCFACT; USHORT VGAHT; @@ -959,99 +1087,121 @@ typedef struct _SiS300_LCDDataStruct { USHORT LCDHT; USHORT LCDVT; } SiS300_LCDDataStruct; -SiS300_LCDDataStruct SiS300_StLCD1024x768Data[] = { - {66, 31, 992, 510, 1320, 816}, - {66, 31, 992, 510, 1320, 816}, - {176, 75, 900, 510, 1320, 816}, - {176, 75, 900, 510, 1320, 816}, - {66, 31, 992, 510, 1320, 816}, - {27, 16, 1024, 650, 1350, 832}, - {1, 1, 1344, 806, 1344, 806} -}; - -SiS300_LCDDataStruct SiS300_ExtLCD1024x768Data[] = { - {12, 5, 896, 512, 1344, 806}, - {12, 5, 896, 510, 1344, 806}, - {32, 15, 1008, 505, 1344, 806}, - {32, 15, 1008, 514, 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} -}; - -SiS300_LCDDataStruct SiS300_St2LCD1024x768Data[] = { - {62, 25, 800, 546, 1344, 806}, - {32, 15, 930, 546, 1344, 806}, - {32, 15, 930, 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} -}; - -SiS300_LCDDataStruct SiS300_StLCD1280x1024Data[] = { - {4, 1, 880, 510, 1650, 1088}, - {4, 1, 880, 510, 1650, 1088}, - {176, 45, 900, 510, 1650, 1088}, - {176, 45, 900, 510, 1650, 1088}, - {4, 1, 880, 510, 1650, 1088}, - {13, 5, 1024, 675, 1560, 1152}, - {16, 9, 1266, 804, 1688, 1072}, - {1, 1, 1688, 1066, 1688, 1066} -}; - -SiS300_LCDDataStruct SiS300_ExtLCD1280x1024Data[] = { - {211, 60, 1024, 501, 1688, 1066}, - {211, 60, 1024, 508, 1688, 1066}, - {211, 60, 1024, 501, 1688, 1066}, - {211, 60, 1024, 508, 1688, 1066}, - {211, 60, 1024, 500, 1688, 1066}, - {211, 75, 1024, 625, 1688, 1066}, - {211, 120, 1280, 798, 1688, 1066}, - {1, 1, 1688, 1066, 1688, 1066} -}; - -SiS300_LCDDataStruct SiS300_St2LCD1280x1024Data[] = { - {22, 5, 800, 510, 1650, 1088}, - {22, 5, 800, 510, 1650, 1088}, - {176, 45, 900, 510, 1650, 1088}, - {176, 45, 900, 510, 1650, 1088}, - {22, 5, 800, 510, 1650, 1088}, - {13, 5, 1024, 675, 1560, 1152}, - {16, 9, 1266, 804, 1688, 1072}, - {1, 1, 1688, 1066, 1688, 1066} -}; - -SiS300_LCDDataStruct SiS300_NoScaleData[] = { - {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} -}; - -SiS300_LCDDataStruct SiS300_LCD1280x960Data[] = { - {9, 2, 800, 500, 1800, 1000}, - {9, 2, 800, 500, 1800, 1000}, - {4, 1, 900, 500, 1800, 1000}, - {4, 1, 900, 500, 1800, 1000}, - {9, 2, 800, 500, 1800, 1000}, - {30, 11, 1056, 625, 1800, 1000}, - {5, 3, 1350, 800, 1800, 1000}, - {1, 1, 1576, 1050, 1576, 1050}, - {1, 1, 1800, 1000, 1800, 1000} -}; - -typedef struct _SiS300_TVDataStruct { + +SiS300_LCDDataStruct SiS300_StLCD1024x768Data[]= +{ + { 66, 31, 992, 510,1320, 816}, + { 66, 31, 992, 510,1320, 816}, + { 176, 75, 900, 510,1320, 816}, + { 176, 75, 900, 510,1320, 816}, + { 66, 31, 992, 510,1320, 816}, + { 27, 16,1024, 650,1350, 832}, + { 1, 1,1344, 806,1344, 806} +}; + +SiS300_LCDDataStruct SiS300_ExtLCD1024x768Data[]= +{ + { 12, 5, 896, 512,1344, 806}, + { 12, 5, 896, 510,1344, 806}, + { 32, 15,1008, 505,1344, 806}, + { 32, 15,1008, 514,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} +}; + +SiS300_LCDDataStruct SiS300_St2LCD1024x768Data[]= +{ + { 62, 25, 800, 546,1344, 806}, + { 32, 15, 930, 546,1344, 806}, + { 32, 15, 930, 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} +}; + +SiS300_LCDDataStruct SiS300_StLCD1280x1024Data[]= +{ + { 4, 1, 880, 510,1650,1088}, + { 4, 1, 880, 510,1650,1088}, + { 176, 45, 900, 510,1650,1088}, + { 176, 45, 900, 510,1650,1088}, + { 4, 1, 880, 510,1650,1088}, + { 13, 5,1024, 675,1560,1152}, + { 16, 9,1266, 804,1688,1072}, + { 1, 1,1688,1066,1688,1066} +}; + +SiS300_LCDDataStruct SiS300_ExtLCD1280x1024Data[]= +{ + { 211, 60,1024, 501,1688,1066}, + { 211, 60,1024, 508,1688,1066}, + { 211, 60,1024, 501,1688,1066}, + { 211, 60,1024, 508,1688,1066}, + { 211, 60,1024, 500,1688,1066}, + { 211, 75,1024, 625,1688,1066}, + { 211, 120,1280, 798,1688,1066}, + { 1, 1,1688,1066,1688,1066} +}; + +SiS300_LCDDataStruct SiS300_St2LCD1280x1024Data[]= +{ + { 22, 5, 800, 510,1650,1088}, + { 22, 5, 800, 510,1650,1088}, + { 176, 45, 900, 510,1650,1088}, + { 176, 45, 900, 510,1650,1088}, + { 22, 5, 800, 510,1650,1088}, + { 13, 5,1024, 675,1560,1152}, + { 16, 9,1266, 804,1688,1072}, + { 1, 1,1688,1066,1688,1066} +}; + +SiS300_LCDDataStruct SiS300_NoScaleData1024x768[]= +{ + { 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} +}; + +SiS300_LCDDataStruct SiS300_NoScaleData1280x1024[]= /* TW: Fake */ +{ + { 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} +}; + +SiS300_LCDDataStruct SiS300_LCD1280x960Data[]= +{ + { 9, 2, 800, 500,1800,1000}, + { 9, 2, 800, 500,1800,1000}, + { 4, 1, 900, 500,1800,1000}, + { 4, 1, 900, 500,1800,1000}, + { 9, 2, 800, 500,1800,1000}, + { 30, 11,1056, 625,1800,1000}, + { 5, 3,1350, 800,1800,1000}, + { 1, 1,1576,1050,1576,1050}, + { 1, 1,1800,1000,1800,1000} +}; + +typedef struct _SiS300_TVDataStruct +{ USHORT RVBHCMAX; USHORT RVBHCFACT; USHORT VGAHT; @@ -1066,457 +1216,1480 @@ typedef struct _SiS300_TVDataStruct { UCHAR RY3COE; UCHAR RY4COE; } SiS300_TVDataStruct; -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}, - {1, 1, 864, 525, 1270, 400, 0, 0, 720, 0xf1, 0x04, 0x1f, 0x18}, - {1, 1, 864, 525, 1270, 350, 0, 0, 720, 0xf4, 0x0b, 0x1c, 0x0a}, - {1, 1, 864, 525, 1270, 480, 50, 0, 760, 0xf4, 0xff, 0x1c, 0x22}, - {1, 1, 864, 525, 1270, 600, 50, 0, 0, 0xf4, 0xff, 0x1c, 0x22} + +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}, + { 1, 1, 864, 525,1270, 400, 0, 0, 720,0xf1,0x04,0x1f,0x18}, + { 1, 1, 864, 525,1270, 350, 0, 0, 720,0xf4,0x0b,0x1c,0x0a}, + { 1, 1, 864, 525,1270, 480, 50, 0, 760,0xf4,0xff,0x1c,0x22}, + { 1, 1, 864, 525,1270, 600, 50, 0, 0,0xf4,0xff,0x1c,0x22} }; -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}, - {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 */ +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}, + { 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*/ }; -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}, - {1, 1, 858, 525, 1270, 400, 0, 0, 720, 0xf1, 0x04, 0x1f, 0x18}, - {1, 1, 858, 525, 1270, 350, 0, 0, 720, 0xf4, 0x0b, 0x1c, 0x0a}, - {1, 1, 858, 525, 1270, 480, 0, 0, 760, 0xf1, 0x04, 0x1f, 0x18} +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}, + { 1, 1, 858, 525,1270, 400, 0, 0, 720,0xf1,0x04,0x1f,0x18}, + { 1, 1, 858, 525,1270, 350, 0, 0, 720,0xf4,0x0b,0x1c,0x0a}, + { 1, 1, 858, 525,1270, 480, 0, 0, 760,0xf1,0x04,0x1f,0x18} }; -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}, - {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}, - {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 */ +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}, + { 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}, + { 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*/ }; -SiS_TVDataStruct SiS300_St1HiTVData[] = { - - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00} +SiS_TVDataStruct SiS300_St1HiTVData[]= +{ + {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} }; -SiS_TVDataStruct SiS300_St2HiTVData[] = { - - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00} +SiS_TVDataStruct SiS300_St2HiTVData[]= +{ + {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} }; -SiS_TVDataStruct SiS300_ExtHiTVData[] = { - - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00} +SiS_TVDataStruct SiS300_ExtHiTVData[]= +{ + {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} }; 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, - 0x03, 0x0a, 0x65, 0x9d, 0x08, 0x92, 0x8f, 0x40, - 0x60, 0x80, 0x14, 0x90, 0x8c, 0x60, 0x14, 0x50, - 0x00, 0x40, 0x44, 0x00, 0xdb, 0x02, 0x3b, 0x00 + 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, + 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[] = { - 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, - 0x0d, 0x00, 0x68, 0xb0, 0x0b, 0x92, 0x8f, 0x40, - 0x60, 0x80, 0x14, 0x90, 0x8c, 0x60, 0x14, 0x63, - 0x00, 0x40, 0x3e, 0x00, 0xe1, 0x02, 0x28, 0x00 + 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, + 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 }; +UCHAR SiS300_HiTVExtTiming[] = {0x00}; -UCHAR SiS300_HiTVSt1Timing[] = { 0x00 }; +UCHAR SiS300_HiTVSt1Timing[] = {0x00}; -UCHAR SiS300_HiTVSt2Timing[] = { 0x00 }; +UCHAR SiS300_HiTVSt2Timing[] = {0x00}; -UCHAR SiS300_HiTVTextTiming[] = { 0x00 }; +UCHAR SiS300_HiTVTextTiming[] = {0x00}; -UCHAR SiS300_HiTVGroup3Data[] = { 0x00 }; +UCHAR SiS300_HiTVGroup3Data[] = {0x00}; -UCHAR SiS300_HiTVGroup3Simu[] = { 0x00 }; +UCHAR SiS300_HiTVGroup3Simu[] = {0x00}; -UCHAR SiS300_HiTVGroup3Text[] = { 0x00 }; +UCHAR SiS300_HiTVGroup3Text[] = {0x00}; -typedef struct _SiS300_LVDSDataStruct { +typedef struct _SiS300_LVDSDataStruct +{ USHORT VGAHT; USHORT VGAVT; USHORT LCDHT; USHORT LCDVT; } SiS300_LVDSDataStruct; -SiS300_LVDSDataStruct SiS300_LVDS800x600Data_1[] = { - {0x00, 0x00, 0x00, 0x00} -}; - -SiS300_LVDSDataStruct SiS300_LVDS800x600Data_2[] = { - {0x00, 0x00, 0x00, 0x00} -}; - -SiS300_LVDSDataStruct SiS300_LVDS1024x768Data_1[] = { - {0x00, 0x00, 0x00, 0x00} -}; -SiS300_LVDSDataStruct SiS300_LVDS1024x768Data_2[] = { - {0x00, 0x00, 0x00, 0x00} -}; - -SiS300_LVDSDataStruct SiS300_LVDS1280x1024Data_1[] = { - {0x00, 0x00, 0x00, 0x00} -}; - -SiS300_LVDSDataStruct SiS300_LVDS1280x1024Data_2[] = { - {0x00, 0x00, 0x00, 0x00} -}; - -SiS300_LVDSDataStruct SiS300_LVDS640x480Data_1[] = { - {0x00, 0x00, 0x00, 0x00} -}; - -SiS300_LVDSDataStruct SiS300_CHTVUNTSCData[] = { - {0x00, 0x00, 0x00, 0x00} +SiS300_LVDSDataStruct SiS300_LVDS800x600Data_1[]= +{ + {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} +}; + +SiS300_LVDSDataStruct SiS300_LVDS800x600Data_2[]= +{ + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {800, 449,1000, 644}, + {800, 525,1000, 635} +}; + +SiS300_LVDSDataStruct SiS300_LVDS1024x768Data_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} +}; + +SiS300_LVDSDataStruct SiS300_LVDS1024x768Data_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} +}; + +SiS300_LVDSDataStruct SiS300_LVDS1280x1024Data_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} +}; + +SiS300_LVDSDataStruct SiS300_LVDS1280x1024Data_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} +}; + +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} +}; + +/* TW: New: */ +SiS300_LVDSDataStruct SiS300_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} +}; + +/* TW: New: */ +SiS300_LVDSDataStruct SiS300_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} +}; + +/* TW: New: */ +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_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} +}; + +/* TW: New: */ +SiS300_LVDSDataStruct SiS300_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} }; -SiS300_LVDSDataStruct SiS300_CHTVONTSCData[] = { - {0x00, 0x00, 0x00, 0x00} +SiS300_LVDSDataStruct SiS300_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} }; -SiS300_LVDSDataStruct SiS300_CHTVUPALData[] = { - {0x00, 0x00, 0x00, 0x00} +SiS300_LVDSDataStruct SiS300_CHTVUPALData[]= +{ + {1008, 625,1008, 625}, + {1008, 625,1008, 625}, + {1008, 625,1008, 625}, + {1008, 625,1008, 625}, + {840, 750, 840, 750}, + {936, 836, 936, 836} }; -SiS300_LVDSDataStruct SiS300_CHTVOPALData[] = { - {0x00, 0x00, 0x00, 0x00} +SiS300_LVDSDataStruct SiS300_CHTVOPALData[]= +{ + {1008, 625,1008, 625}, + {1008, 625,1008, 625}, + {1008, 625,1008, 625}, + {1008, 625,1008, 625}, + {840, 625, 840, 625}, + {960, 750, 960, 750} }; +/* TW: new end */ -typedef struct _SiS300_LVDSDesStruct { +typedef struct _SiS300_LVDSDesStruct +{ USHORT LCDHDES; USHORT LCDVDES; } SiS300_LVDSDesStruct; -SiS300_LVDSDesStruct SiS300_PanelType00_1[] = { - {0x00, 0x00} -}; - -SiS300_LVDSDesStruct SiS300_PanelType01_1[] = { - {0x00, 0x00} -}; - -SiS300_LVDSDesStruct SiS300_PanelType02_1[] = { - {0x00, 0x00} -}; - -SiS300_LVDSDesStruct SiS300_PanelType03_1[] = { - {0x00, 0x00} -}; - -SiS300_LVDSDesStruct SiS300_PanelType04_1[] = { - {0x00, 0x00} -}; - -SiS300_LVDSDesStruct SiS300_PanelType05_1[] = { - {0x00, 0x00} -}; - -SiS300_LVDSDesStruct SiS300_PanelType06_1[] = { - {0x00, 0x00} -}; - -SiS300_LVDSDesStruct SiS300_PanelType07_1[] = { - {0x00, 0x00} -}; - -SiS300_LVDSDesStruct SiS300_PanelType08_1[] = { - {0x00, 0x00} -}; - -SiS300_LVDSDesStruct SiS300_PanelType09_1[] = { - {0x00, 0x00} -}; - -SiS300_LVDSDesStruct SiS300_PanelType0a_1[] = { - {0x00, 0x00} -}; - -SiS300_LVDSDesStruct SiS300_PanelType0b_1[] = { - {0x00, 0x00} -}; - -SiS300_LVDSDesStruct SiS300_PanelType0c_1[] = { - {0x00, 0x00} -}; - -SiS300_LVDSDesStruct SiS300_PanelType0d_1[] = { - {0x00, 0x00} -}; - -SiS300_LVDSDesStruct SiS300_PanelType0e_1[] = { - {0x00, 0x00} -}; - -SiS300_LVDSDesStruct SiS300_PanelType0f_1[] = { - {0x00, 0x00} -}; - -SiS300_LVDSDesStruct SiS300_PanelType00_2[] = { - {0x00, 0x00} -}; - -SiS300_LVDSDesStruct SiS300_PanelType01_2[] = { - {0x00, 0x00} -}; - -SiS300_LVDSDesStruct SiS300_PanelType02_2[] = { - {0x00, 0x00} -}; - -SiS300_LVDSDesStruct SiS300_PanelType03_2[] = { - {0x00, 0x00} -}; - -SiS300_LVDSDesStruct SiS300_PanelType04_2[] = { - {0x00, 0x00} -}; - -SiS300_LVDSDesStruct SiS300_PanelType05_2[] = { - {0x00, 0x00} -}; - -SiS300_LVDSDesStruct SiS300_PanelType06_2[] = { - {0x00, 0x00} -}; -SiS300_LVDSDesStruct SiS300_PanelType07_2[] = { - {0x00, 0x00} -}; - -SiS300_LVDSDesStruct SiS300_PanelType08_2[] = { - {0x00, 0x00} -}; - -SiS300_LVDSDesStruct SiS300_PanelType09_2[] = { - {0x00, 0x00} -}; - -SiS300_LVDSDesStruct SiS300_PanelType0a_2[] = { - {0x00, 0x00} -}; - -SiS300_LVDSDesStruct SiS300_PanelType0b_2[] = { - {0x00, 0x00} -}; - -SiS300_LVDSDesStruct SiS300_PanelType0c_2[] = { - {0x00, 0x00} -}; - -SiS300_LVDSDesStruct SiS300_PanelType0d_2[] = { - {0x00, 0x00} -}; - -SiS300_LVDSDesStruct SiS300_PanelType0e_2[] = { - {0x00, 0x00} -}; - -SiS300_LVDSDesStruct SiS300_PanelType0f_2[] = { - {0x00, 0x00} +SiS300_LVDSDesStruct SiS300_PanelType00_1[]= +{ + {0, 626}, + {0, 624}, + {0, 626}, + {0, 624}, + {0, 624}, + { 0, 627}, + { 0, 627}, + { 0, 0}, + { 0, 0} +}; + +SiS300_LVDSDesStruct SiS300_PanelType01_1[]= +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS300_LVDSDesStruct SiS300_PanelType02_1[]= +{ + {0, 626}, + {0, 624}, + {0, 626}, + {0, 624}, + {0, 624}, + { 0, 627}, + { 0, 627}, + { 0, 0}, + { 0, 0} +}; + +SiS300_LVDSDesStruct SiS300_PanelType03_1[]= +{ + { 8, 436}, + { 8, 440}, + { 8, 436}, + { 8, 440}, + { 8, 512}, + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794} +}; + +SiS300_LVDSDesStruct SiS300_PanelType04_1[]= +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS300_LVDSDesStruct SiS300_PanelType05_1[]= +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS300_LVDSDesStruct SiS300_PanelType06_1[]= +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS300_LVDSDesStruct SiS300_PanelType07_1[]= +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS300_LVDSDesStruct SiS300_PanelType08_1[]= +{ + {1059, 626}, + {1059, 624}, + {1059, 626}, + {1059, 624}, + {1059, 624}, + { 0, 627}, + { 0, 627}, + { 0, 0}, + { 0, 0} +}; + +SiS300_LVDSDesStruct SiS300_PanelType09_1[]= +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS300_LVDSDesStruct SiS300_PanelType0a_1[]= +{ + {1059, 626}, + {1059, 624}, + {1059, 626}, + {1059, 624}, + {1059, 624}, + { 0, 627}, + { 0, 627}, + { 0, 0}, + { 0, 0} +}; + +SiS300_LVDSDesStruct SiS300_PanelType0b_1[]= +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS300_LVDSDesStruct SiS300_PanelType0c_1[]= +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS300_LVDSDesStruct SiS300_PanelType0d_1[]= +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS300_LVDSDesStruct SiS300_PanelType0e_1[]= +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, /* 640x480 */ + {1343, 0}, /* 800x600 */ + { 0, 805}, /* 1024x768 */ + { 0, 794}, /* 1280x1024 */ + { 0, 0} /* 1280x960 - not applicable */ +}; + +SiS300_LVDSDesStruct SiS300_PanelType0f_1[]= +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS300_LVDSDesStruct SiS300_PanelType00_2[]= +{ + {976, 527}, + {976, 502}, + {976, 527}, + {976, 502}, + {976, 567}, + { 0, 627}, + { 0, 627}, + { 0, 0}, + { 0, 0} +}; + +SiS300_LVDSDesStruct SiS300_PanelType01_2[]= +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS300_LVDSDesStruct SiS300_PanelType02_2[]= +{ + {976, 527}, + {976, 502}, + {976, 527}, + {976, 502}, + {976, 567}, + { 0, 627}, + { 0, 627}, + { 0, 0}, + { 0, 0} +}; + +SiS300_LVDSDesStruct SiS300_PanelType03_2[]= +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + {1152, 622}, + {1152, 597} +}; + +SiS300_LVDSDesStruct SiS300_PanelType04_2[]= +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS300_LVDSDesStruct SiS300_PanelType05_2[]= +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS300_LVDSDesStruct SiS300_PanelType06_2[]= +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS300_LVDSDesStruct SiS300_PanelType07_2[]= +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS300_LVDSDesStruct SiS300_PanelType08_2[]= +{ + {976, 527}, + {976, 502}, + {976, 527}, + {976, 502}, + {976, 567}, + { 0, 627}, + { 0, 627}, + { 0, 0}, + { 0, 0} +}; + +SiS300_LVDSDesStruct SiS300_PanelType09_2[]= +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS300_LVDSDesStruct SiS300_PanelType0a_2[]= +{ + {976, 527}, + {976, 502}, + {976, 527}, + {976, 502}, + {976, 567}, + { 0, 627}, + { 0, 627}, + { 0, 0}, + { 0, 0} +}; + +SiS300_LVDSDesStruct SiS300_PanelType0b_2[]= +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS300_LVDSDesStruct SiS300_PanelType0c_2[]= +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS300_LVDSDesStruct SiS300_PanelType0d_2[]= +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS300_LVDSDesStruct SiS300_PanelType0e_2[]= +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS300_LVDSDesStruct SiS300_PanelType0f_2[]= +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS300_LVDSDesStruct SiS300_PanelType1076_1[]= /* TW: New */ +{ + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0} +}; + +SiS300_LVDSDesStruct SiS300_PanelType1076_2[]= /* TW: New */ +{ + { 1152, 622 }, + { 1152, 597 }, + { 1152, 622 }, + { 1152, 597 }, + { 1152, 622 }, + { 1232, 722 }, + { 0, 0 }, + { 0, 794 }, + { 0, 0 } +}; + +SiS300_LVDSDesStruct SiS300_PanelType1210_1[]= /* TW: New */ +{ + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0} +}; + +SiS300_LVDSDesStruct SiS300_PanelType1210_2[]= /* TW: New */ +{ + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0} +}; + +SiS300_LVDSDesStruct SiS300_PanelType1296_1[]= /* TW: New */ +{ + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0} +}; + +SiS300_LVDSDesStruct SiS300_PanelType1296_2[]= /* TW: New */ +{ + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0} }; -/*301b*/ -SiS300_LVDSDesStruct SiS300_PanelType1076_1[] = { - {0x00, 0x00} -}; -SiS300_LVDSDesStruct SiS300_PanelType1210_1[] = { - {0x00, 0x00} -}; -SiS300_LVDSDesStruct SiS300_PanelType1296_1[] = { - {0x00, 0x00} -}; -SiS300_LVDSDesStruct SiS300_PanelType1076_2[] = { - {0x00, 0x00} -}; -SiS300_LVDSDesStruct SiS300_PanelType1210_2[] = { - {0x00, 0x00} -}; -SiS300_LVDSDesStruct SiS300_PanelType1296_2[] = { - {0x00, 0x00} -}; -/*end 301b*/ -SiS300_LVDSDesStruct SiS300_CHTVUNTSCDesData[] = { - {0x00, 0x00} +/* TW: New */ +SiS300_LVDSDesStruct SiS300_CHTVUNTSCDesData[]= +{ + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0} }; -SiS300_LVDSDesStruct SiS300_CHTVONTSCDesData[] = { - {0x00, 0x00} +SiS300_LVDSDesStruct SiS300_CHTVONTSCDesData[]= +{ + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0} }; -SiS300_LVDSDesStruct SiS300_CHTVUPALDesData[] = { - {0x00, 0x00} +SiS300_LVDSDesStruct SiS300_CHTVUPALDesData[]= +{ + {256, 0}, + {256, 0}, + {256, 0}, + {256, 0}, + { 0, 0}, + { 0, 0} }; -SiS300_LVDSDesStruct SiS300_CHTVOPALDesData[] = { - {0x00, 0x00} +SiS300_LVDSDesStruct SiS300_CHTVOPALDesData[]= +{ + {256, 0}, + {256, 0}, + {256, 0}, + {256, 0}, + { 0, 0}, + { 0, 0} }; +/* TW: New end */ -typedef struct _SiS300_LVDSCRT1DataStruct { - UCHAR CR[15]; +typedef struct _SiS300_LVDSCRT1DataStruct +{ +UCHAR CR[15]; } SiS300_LVDSCRT1DataStruct; -SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_1[] = { - - { - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00}} -}; - -SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_1[] = { - - { - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00}} -}; - -SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_1[] = { - - { - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00}} -}; - -SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_1_H[] = { - - { - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00}} -}; - -SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_1_H[] = { - - { - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00}} -}; - -SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_1_H[] = { - - { - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00}} -}; -SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_2[] = { - - { - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00}} +SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_1[]= +{ + {{0x65,0x4f,0x89,0x56,0x83,0xaf,0x1f, + 0x90,0x85,0x8f,0xab,0x30,0x00,0x05, + 0x00 }}, + {{0x65,0x4f,0x89,0x56,0x83,0x83,0x1f, + 0x5e,0x83,0x5d,0x79,0x10,0x00,0x05, + 0x00 }}, + {{0x65,0x4f,0x89,0x56,0x83,0xaf,0x1f, + 0x90,0x85,0x8f,0xab,0x30,0x00,0x05, + 0x00 }}, + {{0x65,0x4f,0x89,0x56,0x83,0x83,0x1f, + 0x5e,0x83,0x5d,0x79,0x10,0x00,0x05, + 0x00 }}, + {{0x65,0x4f,0x89,0x56,0x83,0x04,0x3e, + 0xe0,0x85,0xdf,0xfb,0x10,0x00,0x05, + 0x00 }}, + {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0, + 0x58,0x8c,0x57,0x73,0x20,0x00,0x06, + 0x01 }} +}; + +SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_1[]= +{ + {{0x64,0x4f,0x88,0x54,0x9f,0xc4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x01, + 0x00}}, + {{0x64,0x4f,0x88,0x54,0x9f,0x97,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x01, + 0x00}}, + {{0x64,0x4f,0x88,0x54,0x9f,0xc4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x01, + 0x00}}, + {{0x64,0x4f,0x88,0x54,0x9f,0x97,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x01, + 0x00}}, + {{0x64,0x4f,0x88,0x54,0x9f,0x04,0x3e, + 0xe2,0x89,0xdf,0x05,0x00,0x00,0x01, + 0x00}}, + {{0x7e,0x63,0x82,0x68,0x15,0x7c,0xf0, + 0x5a,0x8f,0x57,0x7d,0x20,0x00,0x26, + 0x01}}, + {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x02, + 0x01} } }; -SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_2[] = { - - { - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00}} +SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_1[]= +{ + {{0x63,0x4f,0x87,0x54,0x9f,0xb4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x01, + 0x00 }}, + {{0x63,0x4f,0x87,0x54,0x9f,0x82,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x01, + 0x00 }}, + {{0x63,0x4f,0x87,0x54,0x9f,0xb4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x01, + 0x00 }}, + {{0x63,0x4f,0x87,0x54,0x9f,0x82,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x01, + 0x00 }}, + {{0x63,0x4f,0x87,0x54,0x9f,0x04,0x3e, + 0xe2,0x89,0xdf,0x05,0x00,0x00,0x01, + 0x00 }}, + {{0x7e,0x63,0x82,0x68,0x15,0x7c,0xf0, + 0x5a,0x8f,0x57,0x7d,0x20,0x00,0x26, + 0x01 }}, + {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x02, + 0x01 }} +}; + +SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_1_H[]= +{ + {{0x30,0x27,0x94,0x2c,0x92,0xaf,0x1f, + 0x90,0x85,0x8f,0xab,0x30,0x00,0x04, + 0x00 }}, + {{0x30,0x27,0x94,0x2c,0x92,0x83,0x1f, + 0x5e,0x83,0x5d,0x79,0x10,0x00,0x04, + 0x00 }}, + {{0x30,0x27,0x94,0x2c,0x92,0xaf,0x1f, + 0x90,0x85,0x8f,0xab,0x30,0x00,0x04, + 0x00 }}, + {{0x30,0x27,0x94,0x2c,0x92,0x83,0x1f, + 0x5e,0x83,0x5d,0x79,0x10,0x00,0x04, + 0x00 }}, + {{0x30,0x27,0x94,0x2c,0x92,0x04,0x3e, + 0xe0,0x85,0xdf,0xfb,0x10,0x00,0x04, + 0x00 }}, + {{0x3d,0x31,0x81,0x37,0x1f,0x72,0xf0, + 0x58,0x8c,0x57,0x73,0x20,0x00,0x05, + 0x01 }} +}; + +SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_1_H[]= +{ + {{0x37,0x27,0x9B,0x2b,0x94,0xc4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x44, + 0x00 }}, + {{0x37,0x27,0x9B,0x2b,0x94,0x97,0x1f, + 0x60,0x87,0x5D,0x83,0x01,0x00,0x44, + 0x00}}, + {{0x37,0x27,0x9B,0x2b,0x94,0xc4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x44, + 0x00}}, + {{0x37,0x27,0x9B,0x2b,0x94,0x97,0x1f, + 0x60,0x87,0x5D,0x83,0x01,0x00,0x44, + 0x00}}, + {{0x37,0x27,0x9B,0x2b,0x94,0x04,0x3e, + 0xE2,0x89,0xDf,0x05,0x00,0x00,0x44, + 0x00}}, + {{0x41,0x31,0x85,0x35,0x1d,0x7c,0xf0, + 0x5A,0x8F,0x57,0x7D,0x20,0x00,0x55, + 0x01}}, + {{0x4f,0x3F,0x93,0x45,0x0D,0x24,0xf5, + 0x02,0x88,0xFf,0x25,0x10,0x00,0x01, + 0x01 }} }; -SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_2[] = { - - { - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00}} +SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_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, + 0x00 }}, + {{0x2f,0x27,0x93,0x2b,0x90,0x82,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x04, + 0x00 }}, + {{0x2f,0x27,0x93,0x2b,0x90,0x04,0x3e, + 0xe2,0x89,0xdf,0x05,0x00,0x00,0x04, + 0x00 }}, + {{0x3c,0x31,0x80,0x35,0x1c,0x7c,0xf0, + 0x5a,0x8f,0x57,0x7d,0x20,0x00,0x55, + 0x01 }}, + {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x01, + 0x01 }} +}; + +SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_2[]= +{ + {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, + 0xf4,0x88,0x8f,0x73,0x20,0x00,0x06, + 0x00 }}, + {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, + 0xdb,0x8f,0x5d,0x73,0x20,0x00,0x06, + 0x00 }}, + {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, + 0xf4,0x88,0x8f,0x73,0x20,0x00,0x06, + 0x00 }}, + {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, + 0xdb,0x8f,0x5d,0x73,0x20,0x00,0x06, + 0x00 }}, + {{0x7f,0x4f,0x83,0x62,0x12,0x72,0xba, + 0x1c,0x80,0xdf,0x73,0x00,0x00,0x06, + 0x00 }}, + {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0, + 0x58,0x8c,0x57,0x73,0x20,0x00,0x06, + 0x01 }} +}; + +SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_2[]= +{ + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, + 0x00 }}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, + 0x00 }}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, + 0x00 }}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, + 0x00 }}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x72,0x88,0xdf,0x25,0x30,0x00,0x06, + 0x00 }}, + {{0xa3,0x63,0x87,0x78,0x89,0x24,0xf1, + 0xae,0x84,0x57,0x25,0x30,0x00,0x02, + 0x01 }}, + {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x02, + 0x01 }} +}; + +SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_2[]= +{ + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, + 0x00 }}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, + 0x00 }}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, + 0x00 }}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, + 0x00 }}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x72,0x88,0xdf,0x25,0x30,0x00,0x06, + 0x00 }}, + {{0xa3,0x63,0x87,0x78,0x89,0x24,0xf1, + 0xae,0x84,0x57,0x25,0x30,0x00,0x02, + 0x01 }}, + {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x02, + 0x01 }} +}; + +SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_2_H[]= +{ + {{0x3d,0x27,0x81,0x32,0x1a,0x72,0x3e, + 0xf4,0x88,0x8f,0x73,0x20,0x00,0x05, + 0x00 }}, + {{0x3d,0x27,0x81,0x32,0x1a,0x72,0x3e, + 0xdb,0x8f,0x5d,0x73,0x20,0x00,0x05, + 0x00 }}, + {{0x3d,0x27,0x81,0x32,0x1a,0x72,0x3e, + 0xf4,0x88,0x8f,0x73,0x20,0x00,0x05, + 0x00 }}, + {{0x3d,0x27,0x81,0x3a,0x1a,0x72,0x3e, + 0xdb,0x8f,0x5d,0x73,0x20,0x00,0x05, + 0x00 }}, + {{0x3d,0x27,0x81,0x32,0x1a,0x72,0xba, + 0x1c,0x80,0xdf,0x73,0x00,0x00,0x05, + 0x00 }}, + {{0x3d,0x31,0x81,0x37,0x1f,0x72,0xf0, + 0x58,0x8c,0x57,0x73,0x20,0x00,0x05, + 0x01 }} +}; + +SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_2_H[]= +{ + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x72,0x88,0xdf,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x31,0x93,0x3e,0x06,0x24,0xf1, + 0xae,0x84,0x57,0x25,0x30,0x00,0x01, + 0x01 }}, + {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x01, + 0x01 }} +}; + +SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_2_H[]= +{ + {{0x4f,0x27,0x93,0x39,0x81,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x27,0x93,0x39,0x81,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x27,0x93,0x39,0x81,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x27,0x93,0x39,0x81,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x27,0x93,0x39,0x81,0x24,0xbb, + 0x72,0x88,0xdf,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x31,0x93,0x3e,0x86,0x24,0xf1, + 0xae,0x84,0x57,0x25,0x30,0x00,0x01, + 0x01 }}, + {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x01, + 0x01}} +}; + +SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x600_1[] = +{ + {{0x64,0x4f,0x88,0x54,0x9f,0x5a,0x3e, + 0xe8,0x8f,0x8f,0x5b,0x00,0x00,0x01, + 0x00}}, + {{0x64,0x4f,0x88,0x54,0x9f,0x2e,0x3e, + 0xb9,0x80,0x5d,0x2f,0x00,0x00,0x01, + 0x00}}, + {{0x64,0x4f,0x88,0x54,0x9f,0x5a,0x3e, + 0xe8,0x8f,0x8f,0x5b,0x00,0x00,0x01, + 0x00}}, + {{0x64,0x4f,0x88,0x54,0x9f,0x2e,0x3e, + 0xb9,0x80,0x5d,0x2f,0x00,0x00,0x01, + 0x00}}, + {{0x64,0x4f,0x88,0x54,0x9f,0xaf,0xba, + 0x3b,0x82,0xdf,0xb0,0x00,0x00,0x01, + 0x00}}, + {{0x7e,0x63,0x82,0x68,0x15,0x1e,0xf1, + 0xae,0x85,0x57,0x1f,0x30,0x00,0x26, + 0x01}}, + {{0xa3,0x7f,0x87,0x86,0x97,0x1e,0xf1, + 0xae,0x85,0x57,0x1f,0x30,0x00,0x02, + 0x01}} }; -SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_2_H[] = { - - { - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00}} +SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x600_1_H[] = +{ + {{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x44, + 0x00}}, + {{0x2f,0x27,0x93,0x2b,0x90,0x97,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x44, + 0x00}}, + {{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x44, + 0x00}}, + {{0x2f,0x27,0x93,0x2b,0x90,0x97,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x44, + 0x00}}, + {{0x2f,0x27,0x93,0x2b,0x90,0x04,0x3e, + 0xe2,0x89,0xdf,0x05,0x00,0x00,0x44, + 0x00}}, + {{0x3c,0x31,0x80,0x35,0x1c,0x7c,0xf0, + 0x5a,0x8f,0x57,0x7d,0x20,0x00,0x55, + 0x01}}, + {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x01, + 0x01}} }; -SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_2_H[] = { - - { - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00}} +SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x600_2[] = +{ + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x72,0x88,0xdf,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x63,0x87,0x78,0x89,0x24,0xf1, + 0xae,0x84,0x57,0x25,0x30,0x00,0x02, + 0x01}}, + {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x02, + 0x01}} }; -SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_2_H[] = { - - { - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00}} +SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x600_2_H[] = +{ + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, + 0x00}}, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, + 0x00}}, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, + 0x00}}, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, + 0x00}}, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x72,0x88,0xdf,0x25,0x30,0x00,0x01, + 0x00}}, + {{0x4f,0x31,0x93,0x3e,0x06,0x24,0xf1, + 0xae,0x84,0x57,0x25,0x30,0x00,0x01, + 0x01}}, + {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x01, + 0x01}} }; -SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1UNTSC[] = { - - { - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00}} +SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11152x768_1[] = +{ + {{0x64,0x4f,0x88,0x54,0x9f,0xc4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x01, + 0x00}}, + {{0x64,0x4f,0x88,0x54,0x9f,0x97,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x01, + 0x00}}, + {{0x64,0x4f,0x88,0x54,0x9f,0xc4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x01, + 0x00}}, + {{0x64,0x4f,0x88,0x54,0x9f,0x97,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x01, + 0x00}}, + {{0x64,0x4f,0x88,0x54,0x9f,0x04,0x3e, + 0xe2,0x89,0xdf,0x05,0x00,0x00,0x01, + 0x00}}, + {{0x7e,0x63,0x82,0x68,0x15,0x7c,0xf0, + 0x5a,0x8f,0x57,0x7d,0x20,0x00,0x26, + 0x01}}, + {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x02, + 0x01}} }; -SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1ONTSC[] = { - - { - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00}} +SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11152x768_1_H[] = +{ + {{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x44, + 0x00}}, + {{0x2f,0x27,0x93,0x2b,0x90,0x97,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x44, + 0x00}}, + {{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x44, + 0x00}}, + {{0x2f,0x27,0x93,0x2b,0x90,0x97,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x44, + 0x00}}, + {{0x2f,0x27,0x93,0x2b,0x90,0x04,0x3e, + 0xe2,0x89,0xdf,0x05,0x00,0x00,0x44, + 0x00}}, + {{0x3c,0x31,0x80,0x35,0x1c,0x7c,0xf0, + 0x5a,0x8f,0x57,0x7d,0x20,0x00,0x55, + 0x01}}, + {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x01, + 0x01}} }; -SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1UPAL[] = { - - { - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00}} +SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11152x768_2[] = +{ + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x72,0x88,0xdf,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x63,0x87,0x78,0x89,0x24,0xf1, + 0xae,0x84,0x57,0x25,0x30,0x00,0x02, + 0x01}}, + {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x02, + 0x01}} }; -SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1OPAL[] = { - - { - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00}} +SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11152x768_2_H[] = +{ + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, + 0x00}}, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, + 0x00}}, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, + 0x00}}, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, + 0x00}}, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x72,0x88,0xdf,0x25,0x30,0x00,0x01, + 0x00}}, + {{0x4f,0x31,0x93,0x3e,0x06,0x24,0xf1, + 0xae,0x84,0x57,0x25,0x30,0x00,0x01, + 0x01}}, + {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x01, + 0x01}} }; -typedef struct _SiS300_CHTVRegDataStruct { - UCHAR Reg[5]; +/* TW: New */ +SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1UNTSC[]= +{ + {{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,0x53,0x9c,0x56,0xba, + 0x18,0x84,0xdf,0x57,0x00,0x00,0x01, + 0x00 }}, + {{0x80,0x63,0x84,0x6c,0x17,0xec,0xf0, + 0x90,0x8c,0x57,0xed,0x20,0x00,0x06, + 0x01 }} +}; + +SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1ONTSC[]= +{ + {{0x64,0x4f,0x88,0x5a,0x9f,0x0b,0x3e, + 0xc0,0x84,0x8f,0x0c,0x20,0x00,0x01, + 0x00 }}, + {{0x64,0x4f,0x88,0x5a,0x9f,0x0b,0x3e, + 0xb0,0x8d,0x5d,0x0c,0x00,0x00,0x01, + 0x00 }}, + {{0x64,0x4f,0x88,0x5a,0x9f,0x0b,0x3e, + 0xc0,0x84,0x8f,0x0c,0x20,0x00,0x01, + 0x00 }}, + {{0x64,0x4f,0x88,0x5a,0x9f,0x0b,0x3e, + 0xb0,0x8d,0x5d,0x0c,0x00,0x00,0x01, + 0x00 }}, + {{0x5d,0x4f,0x81,0x56,0x9c,0x0b,0x3e, + 0xe8,0x84,0xdf,0x0c,0x00,0x00,0x01, + 0x00 }}, + {{0x7d,0x63,0x81,0x6a,0x16,0xba,0xf0, + 0x7f,0x86,0x57,0xbb,0x00,0x00,0x06, + 0x01 }} +}; + +SiS300_LVDSCRT1DataStruct SiS300_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,0x55,0x80,0xec,0xba, + 0x50,0x84,0xdf,0xed,0x00,0x00,0x05, + 0x00 }}, + {{0x70,0x63,0x94,0x68,0x8d,0x42,0xf1, + 0xc8,0x8c,0x57,0xe9,0x20,0x00,0x05, + 0x01 }} +}; + +SiS300_LVDSCRT1DataStruct SiS300_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,0x55,0x80,0x6f,0xba, + 0x20,0x83,0xdf,0x70,0x00,0x00,0x05, + 0x00 }}, + {{0x73,0x63,0x97,0x69,0x8e,0xec,0xf0, + 0x90,0x8c,0x57,0xed,0x20,0x00,0x05, + 0x01 }} +}; +/* TW: New end */ + +/* TW: New */ +typedef struct _SiS300_CHTVRegDataStruct +{ + UCHAR Reg[16]; } SiS300_CHTVRegDataStruct; + SiS300_CHTVRegDataStruct SiS300_CHTVReg_UNTSC[] = { - {{0x00, 0x00, 0x00, 0x00, 0x00}} + {{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}}, + {{0x4a,0x94,0x00,0x48,0xfe,0,0,0,0,0,0,0,0,0,0,0}}, + {{0x6a,0x6a,0x00,0x2d,0xfa,0,0,0,0,0,0,0,0,0,0,0}}, /* Mode 17: 640x480 NTSC 7/8 */ + {{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[] = { - {{0x00, 0x00, 0x00, 0x00, 0x00}} + {{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}}, + {{0x49,0x94,0x00,0x34,0xfe,0,0,0,0,0,0,0,0,0,0,0}}, + {{0x69,0x6a,0x00,0x1e,0xfd,0,0,0,0,0,0,0,0,0,0,0}}, /* Mode 16: 640x480 NTSC 1/1 */ + {{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[] = { - {{0x00, 0x00, 0x00, 0x00, 0x00}} + {{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[] = { - {{0x00, 0x00, 0x00, 0x00, 0x00}} + {{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 */ }; +/* TW: New end */ + +/* TW: New */ +UCHAR SiS300_CHTVVCLKUNTSC[] = {0x29,0x29,0x29,0x29,0x2a,0x2e}; + +UCHAR SiS300_CHTVVCLKONTSC[] = {0x2c,0x2c,0x2c,0x2c,0x2d,0x2b}; -UCHAR SiS300_CHTVVCLKUNTSC[] = { 0x00 }; +UCHAR SiS300_CHTVVCLKUPAL[] = {0x2f,0x2f,0x2f,0x2f,0x2f,0x31}; -UCHAR SiS300_CHTVVCLKONTSC[] = { 0x00 }; +UCHAR SiS300_CHTVVCLKOPAL[] = {0x2f,0x2f,0x2f,0x2f,0x30,0x32}; +/* TW: New end */ -UCHAR SiS300_CHTVVCLKUPAL[] = { 0x00 }; -UCHAR SiS300_CHTVVCLKOPAL[] = { 0x00 }; diff --git a/drivers/video/sis/310vtbl.h b/drivers/video/sis/310vtbl.h index 2f3a1fc9e4b9..af4eee909f50 100644 --- a/drivers/video/sis/310vtbl.h +++ b/drivers/video/sis/310vtbl.h @@ -1,4 +1,10 @@ -typedef struct _SiS310_StStruct { + + +/* Register settings for SiS 310/325 series */ + + +typedef struct _SiS310_StStruct +{ UCHAR St_ModeID; USHORT St_ModeFlag; UCHAR St_StTableIndex; @@ -9,31 +15,32 @@ typedef struct _SiS310_StStruct { UCHAR VB_StTVYFilterIndex; } SiS310_StStruct; -SiS310_StStruct SiS310_SModeIDTable[] = -{ - {0x01, 0x9208, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00}, - {0x01, 0x1210, 0x14, 0x01, 0x01, 0x00, 0x01, 0x00}, - {0x01, 0x1010, 0x17, 0x02, 0x02, 0x00, 0x01, 0x01}, - {0x03, 0x8208, 0x03, 0x00, 0x00, 0x00, 0x01, 0x02}, - {0x03, 0x0210, 0x16, 0x01, 0x01, 0x00, 0x01, 0x02}, - {0x03, 0x0010, 0x18, 0x02, 0x02, 0x00, 0x01, 0x03}, - {0x05, 0x9209, 0x05, 0x00, 0x00, 0x00, 0x00, 0x04}, - {0x06, 0x8209, 0x06, 0x00, 0x00, 0x00, 0x00, 0x05}, - {0x07, 0x0000, 0x07, 0x03, 0x03, 0x00, 0x01, 0x03}, - {0x07, 0x0000, 0x19, 0x02, 0x02, 0x00, 0x01, 0x03}, - {0x0d, 0x920a, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x04}, - {0x0e, 0x820a, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x05}, - {0x0f, 0x0202, 0x11, 0x01, 0x01, 0x00, 0x00, 0x05}, - {0x10, 0x0212, 0x12, 0x01, 0x01, 0x00, 0x00, 0x05}, - {0x11, 0x0212, 0x1a, 0x04, 0x04, 0x00, 0x00, 0x05}, - {0x12, 0x0212, 0x1b, 0x04, 0x04, 0x00, 0x00, 0x05}, - {0x13, 0x021b, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x04}, - {0x12, 0x0010, 0x18, 0x02, 0x02, 0x00, 0x00, 0x05}, - {0x12, 0x0210, 0x18, 0x01, 0x01, 0x00, 0x00, 0x05}, - {0xff, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} -}; - -typedef struct _SiS310_StandTableStruct { +SiS310_StStruct SiS310_SModeIDTable[]= +{ + {0x01,0x9208,0x01,0x00,0x00,0x00,0x01,0x00}, + {0x01,0x1210,0x14,0x01,0x01,0x00,0x01,0x00}, + {0x01,0x1010,0x17,0x02,0x02,0x00,0x01,0x01}, + {0x03,0x8208,0x03,0x00,0x00,0x00,0x01,0x02}, + {0x03,0x0210,0x16,0x01,0x01,0x00,0x01,0x02}, + {0x03,0x0010,0x18,0x02,0x02,0x00,0x01,0x03}, + {0x05,0x9209,0x05,0x00,0x00,0x00,0x00,0x04}, + {0x06,0x8209,0x06,0x00,0x00,0x00,0x00,0x05}, + {0x07,0x0000,0x07,0x03,0x03,0x00,0x01,0x03}, + {0x07,0x0000,0x19,0x02,0x02,0x00,0x01,0x03}, + {0x0d,0x920a,0x0d,0x00,0x00,0x00,0x00,0x04}, + {0x0e,0x820a,0x0e,0x00,0x00,0x00,0x00,0x05}, + {0x0f,0x0202,0x11,0x01,0x01,0x00,0x00,0x05}, + {0x10,0x0212,0x12,0x01,0x01,0x00,0x00,0x05}, + {0x11,0x0212,0x1a,0x04,0x04,0x00,0x00,0x05}, + {0x12,0x0212,0x1b,0x04,0x04,0x00,0x00,0x05}, + {0x13,0x021b,0x1c,0x00,0x00,0x00,0x00,0x04}, + {0x12,0x0010,0x18,0x02,0x02,0x00,0x00,0x05}, + {0x12,0x0210,0x18,0x01,0x01,0x00,0x00,0x05}, + {0xff,0x0000,0x00,0x00,0x00,0x00,0x00,0x00} +}; + +typedef struct _SiS310_StandTableStruct +{ UCHAR CRT_COLS; UCHAR ROWS; UCHAR CHAR_HEIGHT; @@ -45,448 +52,450 @@ typedef struct _SiS310_StandTableStruct { UCHAR GRC[9]; } SiS310_StandTableStruct; -SiS310_StandTableStruct SiS310_StandTable[] = { +SiS310_StandTableStruct SiS310_StandTable[]= +{ /* MD_0_200 */ - { - 0x28, 0x18, 0x08, 0x0800, - {0x09, 0x03, 0x00, 0x02}, - 0x63, - {0x2d, 0x27, 0x28, 0x90, 0x2b, 0xa0, 0xbf, 0x1f, - 0x00, 0xc7, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x14, 0x1f, 0x96, 0xb9, 0xa3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x08, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00, - 0xff} - }, + { + 0x28,0x18,0x08,0x0800, + {0x09,0x03,0x00,0x02}, + 0x63, + {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f, + 0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x14,0x1f,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} + }, /* MD_1_200 */ - { - 0x28, 0x18, 0x08, 0x0800, - {0x09, 0x03, 0x00, 0x02}, - 0x63, - {0x2d, 0x27, 0x28, 0x90, 0x2b, 0xa0, 0xbf, 0x1f, - 0x00, 0xc7, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x14, 0x1f, 0x96, 0xb9, 0xa3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x08, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00, - 0xff} - }, + { + 0x28,0x18,0x08,0x0800, + {0x09,0x03,0x00,0x02}, + 0x63, + {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f, + 0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x14,0x1f,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} + }, /* MD_2_200 */ - { - 0x50, 0x18, 0x08, 0x1000, - {0x01, 0x03, 0x00, 0x02}, - 0x63, - {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f, - 0x00, 0xc7, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x28, 0x1f, 0x96, 0xb9, 0xa3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x08, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00, - 0xff} - }, + { + 0x50,0x18,0x08,0x1000, + {0x01,0x03,0x00,0x02}, + 0x63, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} + }, /* MD_3_200 */ - { - 0x50, 0x18, 0x08, 0x1000, - {0x01, 0x03, 0x00, 0x02}, - 0x63, - {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f, - 0x00, 0xc7, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x28, 0x1f, 0x96, 0xb9, 0xa3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x08, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00, - 0xff} - }, + { + 0x50,0x18,0x08,0x1000, + {0x01,0x03,0x00,0x02}, + 0x63, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} + }, /* MD_4 */ - { - 0x28, 0x18, 0x08, 0x4000, - {0x09, 0x03, 0x00, 0x02}, - 0x63, - {0x2d, 0x27, 0x28, 0x90, 0x2c, 0x80, 0xbf, 0x1f, - 0x00, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x14, 0x00, 0x96, 0xb9, 0xa2, - 0xff}, - {0x00, 0x13, 0x15, 0x17, 0x02, 0x04, 0x06, 0x07, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x01, 0x00, 0x03, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0f, 0x00, - 0xff} - }, + { + 0x28,0x18,0x08,0x4000, + {0x09,0x03,0x00,0x02}, + 0x63, + {0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f, + 0x00,0xc1,0x00,0x00,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x14,0x00,0x96,0xb9,0xa2, + 0xff}, + {0x00,0x13,0x15,0x17,0x02,0x04,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x01,0x00,0x03,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x30,0x0f,0x00, + 0xff} + }, /* MD_5 */ - { - 0x28, 0x18, 0x08, 0x4000, - {0x09, 0x03, 0x00, 0x02}, - 0x63, - {0x2d, 0x27, 0x28, 0x90, 0x2c, 0x80, 0xbf, 0x1f, - 0x00, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x14, 0x00, 0x96, 0xb9, 0xa2, - 0xff}, - {0x00, 0x13, 0x15, 0x17, 0x02, 0x04, 0x06, 0x07, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x01, 0x00, 0x03, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0f, 0x00, - 0xff} - }, + { + 0x28,0x18,0x08,0x4000, + {0x09,0x03,0x00,0x02}, + 0x63, + {0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f, + 0x00,0xc1,0x00,0x00,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x14,0x00,0x96,0xb9,0xa2, + 0xff}, + {0x00,0x13,0x15,0x17,0x02,0x04,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x01,0x00,0x03,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x30,0x0f,0x00, + 0xff} + }, /* MD_6 */ - { - 0x50, 0x18, 0x08, 0x4000, - {0x01, 0x01, 0x00, 0x06}, - 0x63, - {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f, - 0x00, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x28, 0x00, 0x96, 0xb9, 0xc2, - 0xff}, - {0x00, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, - 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, - 0x01, 0x00, 0x01, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, - 0xff} - }, + { + 0x50,0x18,0x08,0x4000, + {0x01,0x01,0x00,0x06}, + 0x63, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0xc1,0x00,0x00,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x28,0x00,0x96,0xb9,0xc2, + 0xff}, + {0x00,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x01,0x00,0x01,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x0d,0x00, + 0xff} + }, /* MD_7 */ - { - 0x50, 0x18, 0x0e, 0x1000, - {0x00, 0x03, 0x00, 0x03}, - 0xa6, - {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f, - 0x00, 0x4d, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00, - 0x83, 0x85, 0x5d, 0x28, 0x0d, 0x63, 0xba, 0xa3, - 0xff}, - {0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x10, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x0e, 0x00, 0x0f, 0x08}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0a, 0x00, - 0xff} - }, + { + 0x50,0x18,0x0e,0x1000, + {0x00,0x03,0x00,0x03}, + 0xa6, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00, + 0x83,0x85,0x5d,0x28,0x0d,0x63,0xba,0xa3, + 0xff}, + {0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08, + 0x10,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x0e,0x00,0x0f,0x08}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0a,0x00, + 0xff} + }, /* MDA_DAC */ - { - 0x00, 0x00, 0x00, 0x0000, - {0x00, 0x00, 0x00, 0x15}, - 0x15, - {0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, - 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x3f, 0x3f, - 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x00, 0x00, - 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x15, 0x15, - 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, - 0x15, 0x15, 0x15, 0x15}, - {0x15, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, - 0x3f} - }, + { + 0x00,0x00,0x00,0x0000, + {0x00,0x00,0x00,0x15}, + 0x15, + {0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x3f,0x3f, + 0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x00, + 0x00}, + {0x00,0x00,0x00,0x00,0x00,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15}, + {0x15,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3f} + }, /* CGA_DAC */ - { - 0x00, 0x10, 0x04, 0x0114, - {0x11, 0x09, 0x15, 0x00}, - 0x10, - {0x04, 0x14, 0x01, 0x11, 0x09, 0x15, 0x2a, 0x3a, - 0x2e, 0x3e, 0x2b, 0x3b, 0x2f, 0x3f, 0x2a, 0x3a, - 0x2e, 0x3e, 0x2b, 0x3b, 0x2f, 0x3f, 0x00, 0x10, - 0x04}, - {0x14, 0x01, 0x11, 0x09, 0x15, 0x00, 0x10, 0x04, - 0x14, 0x01, 0x11, 0x09, 0x15, 0x2a, 0x3a, 0x2e, - 0x3e, 0x2b, 0x3b, 0x2f}, - {0x3f, 0x2a, 0x3a, 0x2e, 0x3e, 0x2b, 0x3b, 0x2f, - 0x3f} - }, + { + 0x00,0x10,0x04,0x0114, + {0x11,0x09,0x15,0x00}, + 0x10, + {0x04,0x14,0x01,0x11,0x09,0x15,0x2a,0x3a, + 0x2e,0x3e,0x2b,0x3b,0x2f,0x3f,0x2a,0x3a, + 0x2e,0x3e,0x2b,0x3b,0x2f,0x3f,0x00,0x10, + 0x04}, + {0x14,0x01,0x11,0x09,0x15,0x00,0x10,0x04, + 0x14,0x01,0x11,0x09,0x15,0x2a,0x3a,0x2e, + 0x3e,0x2b,0x3b,0x2f}, + {0x3f,0x2a,0x3a,0x2e,0x3e,0x2b,0x3b,0x2f, + 0x3f} + }, /* EGA_DAC */ - { - 0x00, 0x10, 0x04, 0x0114, - {0x11, 0x05, 0x15, 0x20}, - 0x30, - {0x24, 0x34, 0x21, 0x31, 0x25, 0x35, 0x08, 0x18, - 0x0c, 0x1c, 0x09, 0x19, 0x0d, 0x1d, 0x28, 0x38, - 0x2c, 0x3c, 0x29, 0x39, 0x2d, 0x3d, 0x02, 0x12, - 0x06}, - {0x16, 0x03, 0x13, 0x07, 0x17, 0x22, 0x32, 0x26, - 0x36, 0x23, 0x33, 0x27, 0x37, 0x0a, 0x1a, 0x0e, - 0x1e, 0x0b, 0x1b, 0x0f}, - {0x1f, 0x2a, 0x3a, 0x2e, 0x3e, 0x2b, 0x3b, 0x2f, - 0x3f} - }, + { + 0x00,0x10,0x04,0x0114, + {0x11,0x05,0x15,0x20}, + 0x30, + {0x24,0x34,0x21,0x31,0x25,0x35,0x08,0x18, + 0x0c,0x1c,0x09,0x19,0x0d,0x1d,0x28,0x38, + 0x2c,0x3c,0x29,0x39,0x2d,0x3d,0x02,0x12, + 0x06}, + {0x16,0x03,0x13,0x07,0x17,0x22,0x32,0x26, + 0x36,0x23,0x33,0x27,0x37,0x0a,0x1a,0x0e, + 0x1e,0x0b,0x1b,0x0f}, + {0x1f,0x2a,0x3a,0x2e,0x3e,0x2b,0x3b,0x2f, + 0x3f} + }, /* VGA_DAC */ - { - 0x00, 0x10, 0x04, 0x0114, - {0x11, 0x09, 0x15, 0x2a}, - 0x3a, - {0x2e, 0x3e, 0x2b, 0x3b, 0x2f, 0x3f, 0x00, 0x05, - 0x08, 0x0b, 0x0e, 0x11, 0x14, 0x18, 0x1c, 0x20, - 0x24, 0x28, 0x2d, 0x32, 0x38, 0x3f, 0x00, 0x10, - 0x1f}, - {0x2f, 0x3f, 0x1f, 0x27, 0x2f, 0x37, 0x3f, 0x2d, - 0x31, 0x36, 0x3a, 0x3f, 0x00, 0x07, 0x0e, 0x15, - 0x1c, 0x0e, 0x11, 0x15}, - {0x18, 0x1c, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x00, - 0x04} - }, - { - 0x08, 0x0c, 0x10, 0x0a08, - {0x0c, 0x0e, 0x10, 0x0b}, - 0x0c, - {0x0d, 0x0f, 0x10, 0x10, 0x01, 0x08, 0x00, 0x00, - 0x00, 0x00, 0x01, 0x00, 0x02, 0x02, 0x01, 0x00, - 0x04, 0x04, 0x01, 0x00, 0x05, 0x02, 0x05, 0x00, - 0x06}, - {0x01, 0x06, 0x05, 0x06, 0x00, 0x08, 0x01, 0x08, - 0x00, 0x07, 0x02, 0x07, 0x06, 0x07, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00} - }, + { + 0x00,0x10,0x04,0x0114, + {0x11,0x09,0x15,0x2a}, + 0x3a, + {0x2e,0x3e,0x2b,0x3b,0x2f,0x3f,0x00,0x05, + 0x08,0x0b,0x0e,0x11,0x14,0x18,0x1c,0x20, + 0x24,0x28,0x2d,0x32,0x38,0x3f,0x00,0x10, + 0x1f}, + {0x2f,0x3f,0x1f,0x27,0x2f,0x37,0x3f,0x2d, + 0x31,0x36,0x3a,0x3f,0x00,0x07,0x0e,0x15, + 0x1c,0x0e,0x11,0x15}, + {0x18,0x1c,0x14,0x16,0x18,0x1a,0x1c,0x00, + 0x04} + }, + { + 0x08,0x0c,0x10,0x0a08, + {0x0c,0x0e,0x10,0x0b}, + 0x0c, + {0x0d,0x0f,0x10,0x10,0x01,0x08,0x00,0x00, + 0x00,0x00,0x01,0x00,0x02,0x02,0x01,0x00, + 0x04,0x04,0x01,0x00,0x05,0x02,0x05,0x00, + 0x06}, + {0x01,0x06,0x05,0x06,0x00,0x08,0x01,0x08, + 0x00,0x07,0x02,0x07,0x06,0x07,0x00,0x00, + 0x00,0x00,0x00,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00} + }, /* MD_D */ - { - 0x28, 0x18, 0x08, 0x2000, - {0x09, 0x0f, 0x00, 0x06}, - 0x63, - {0x2d, 0x27, 0x28, 0x90, 0x2c, 0x80, 0xbf, 0x1f, - 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x14, 0x00, 0x96, 0xb9, 0xe3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x01, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0f, - 0xff} - }, + { + 0x28,0x18,0x08,0x2000, + {0x09,0x0f,0x00,0x06}, + 0x63, + {0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f, + 0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x14,0x00,0x96,0xb9,0xe3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x01,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f, + 0xff} + }, /* MD_E */ - { - 0x50, 0x18, 0x08, 0x4000, - {0x01, 0x0f, 0x00, 0x06}, - 0x63, - {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f, - 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x28, 0x00, 0x96, 0xb9, 0xe3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x01, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0f, - 0xff} - }, + { + 0x50,0x18,0x08,0x4000, + {0x01,0x0f,0x00,0x06}, + 0x63, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x28,0x00,0x96,0xb9,0xe3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x01,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f, + 0xff} + }, /* ExtVGATable */ - { - 0x00, 0x00, 0x00, 0x0000, - {0x01, 0x0f, 0x00, 0x0e}, - 0x23, - {0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0x0b, 0x3e, - 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xea, 0x8c, 0xdf, 0x28, 0x40, 0xe7, 0x04, 0xa3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x01, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0f, - 0xff} - }, + { + 0x00,0x00,0x00,0x0000, + {0x01,0x0f,0x00,0x0e}, + 0x23, + {0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e, + 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 0xea,0x8c,0xdf,0x28,0x40,0xe7,0x04,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, + 0x01,0x00,0x00,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0f, + 0xff} + }, /* ROM_SAVEPTR */ - { - 0x9f, 0x3b, 0x00, 0x00c0, - {0x00, 0x00, 0x00, 0x00}, - 0x00, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbb, 0x3f, - 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x1a, 0x00, 0xac, 0x3e, 0x00, 0xc0, - 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00} - }, + { + 0x9f,0x3b,0x00,0x00c0, + {0x00,0x00,0x00,0x00}, + 0x00, + {0x00,0x00,0x00,0x00,0x00,0x00,0xbb,0x3f, + 0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x1a,0x00,0xac,0x3e,0x00,0xc0, + 0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00} + }, /* MD_F */ - { - 0x50, 0x18, 0x0e, 0x8000, - {0x01, 0x0f, 0x00, 0x06}, - 0xa2, - {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f, - 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x82, 0x84, 0x5d, 0x28, 0x0f, 0x63, 0xba, 0xe3, - 0xff}, - {0x00, 0x08, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, - 0x00, 0x08, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, - 0x0b, 0x00, 0x05, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x05, - 0xff} - }, + { + 0x50,0x18,0x0e,0x8000, + {0x01,0x0f,0x00,0x06}, + 0xa2, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 0x82,0x84,0x5d,0x28,0x0f,0x63,0xba,0xe3, + 0xff}, + {0x00,0x08,0x00,0x00,0x18,0x18,0x00,0x00, + 0x00,0x08,0x00,0x00,0x00,0x18,0x00,0x00, + 0x0b,0x00,0x05,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x05, + 0xff} + }, /* MD_10 */ - { - 0x50, 0x18, 0x0e, 0x8000, - {0x01, 0x0f, 0x00, 0x06}, - 0xa3, - {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f, - 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x82, 0x84, 0x5d, 0x28, 0x0f, 0x63, 0xba, 0xe3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, - 0x01, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0f, - 0xff} - }, + { + 0x50,0x18,0x0e,0x8000, + {0x01,0x0f,0x00,0x06}, + 0xa3, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 0x82,0x84,0x5d,0x28,0x0f,0x63,0xba,0xe3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x01,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f, + 0xff} + }, /* MD_0_350 */ - { - 0x28, 0x18, 0x0e, 0x0800, - {0x09, 0x03, 0x00, 0x02}, - 0xa3, - {0x2d, 0x27, 0x28, 0x90, 0x2b, 0xb1, 0xbf, 0x1f, - 0x00, 0x4d, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00, - 0x83, 0x85, 0x5d, 0x14, 0x1f, 0x63, 0xba, 0xa3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, - 0x08, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00, - 0xff} - }, + { + 0x28,0x18,0x0e,0x0800, + {0x09,0x03,0x00,0x02}, + 0xa3, + {0x2d,0x27,0x28,0x90,0x2b,0xb1,0xbf,0x1f, + 0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00, + 0x83,0x85,0x5d,0x14,0x1f,0x63,0xba,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} + }, /* MD_1_350 */ - { - 0x28, 0x18, 0x0e, 0x0800, - {0x09, 0x03, 0x00, 0x02}, - 0xa3, - {0x2d, 0x27, 0x28, 0x90, 0x2b, 0xa0, 0xbf, 0x1f, - 0x00, 0x4d, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00, - 0x83, 0x85, 0x5d, 0x14, 0x1f, 0x63, 0xba, 0xa3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, - 0x08, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00, - 0xff} - }, + { + 0x28,0x18,0x0e,0x0800, + {0x09,0x03,0x00,0x02}, + 0xa3, + {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f, + 0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00, + 0x83,0x85,0x5d,0x14,0x1f,0x63,0xba,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} + }, /* MD_2_350 */ - { - 0x50, 0x18, 0x0e, 0x1000, - {0x01, 0x03, 0x00, 0x02}, - 0xa3, - {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f, - 0x00, 0x4d, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00, - 0x83, 0x85, 0x5d, 0x28, 0x1f, 0x63, 0xba, 0xa3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, - 0x08, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00, - 0xff} - }, + { + 0x50,0x18,0x0e,0x1000, + {0x01,0x03,0x00,0x02}, + 0xa3, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00, + 0x83,0x85,0x5d,0x28,0x1f,0x63,0xba,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} + }, /* MD_3_350 */ - { - 0x50, 0x18, 0x0e, 0x1000, - {0x01, 0x03, 0x00, 0x02}, - 0xa3, - {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f, - 0x00, 0x4d, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00, - 0x83, 0x85, 0x5d, 0x28, 0x1f, 0x63, 0xba, 0xa3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, - 0x08, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00, - 0xff} - }, + { + 0x50,0x18,0x0e,0x1000, + {0x01,0x03,0x00,0x02}, + 0xa3, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00, + 0x83,0x85,0x5d,0x28,0x1f,0x63,0xba,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} + }, /* MD_0_1_400 */ - { - 0x28, 0x18, 0x10, 0x0800, - {0x08, 0x03, 0x00, 0x02}, - 0x67, - {0x2d, 0x27, 0x28, 0x90, 0x2b, 0xb1, 0xbf, 0x1f, - 0x00, 0x4f, 0x0d, 0x0e, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x14, 0x1f, 0x96, 0xb9, 0xa3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, - 0x0c, 0x00, 0x0f, 0x08}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00, - 0xff} - }, + { + 0x28,0x18,0x10,0x0800, + {0x08,0x03,0x00,0x02}, + 0x67, + {0x2d,0x27,0x28,0x90,0x2b,0xb1,0xbf,0x1f, + 0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x14,0x1f,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x0c,0x00,0x0f,0x08}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} + }, /* MD_2_3_400 */ - { - 0x50, 0x18, 0x10, 0x1000, - {0x00, 0x03, 0x00, 0x02}, - 0x67, - {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f, - 0x00, 0x4f, 0x0d, 0x0e, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x28, 0x1f, 0x96, 0xb9, 0xa3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, - 0x0c, 0x00, 0x0f, 0x08}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00, - 0xff} - }, + { + 0x50,0x18,0x10,0x1000, + {0x00,0x03,0x00,0x02}, + 0x67, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x0c,0x00,0x0f,0x08}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} + }, /* MD_7_400 */ - { - 0x50, 0x18, 0x10, 0x1000, - {0x00, 0x03, 0x00, 0x02}, - 0x66, - {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f, - 0x00, 0x4f, 0x0d, 0x0e, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x28, 0x0f, 0x96, 0xb9, 0xa3, - 0xff}, - {0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x10, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x0e, 0x00, 0x0f, 0x08}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0a, 0x00, - 0xff} - }, + { + 0x50,0x18,0x10,0x1000, + {0x00,0x03,0x00,0x02}, + 0x66, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x28,0x0f,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08, + 0x10,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x0e,0x00,0x0f,0x08}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0a,0x00, + 0xff} + }, /* MD_11 */ - { - 0x50, 0x1d, 0x10, 0xa000, - {0x01, 0x0f, 0x00, 0x06}, - 0xe3, - {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0x0b, 0x3e, - 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xe9, 0x8b, 0xdf, 0x28, 0x00, 0xe7, 0x04, 0xc3, - 0xff}, - {0x00, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, - 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, - 0x01, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x01, - 0xff} - }, + { + 0x50,0x1d,0x10,0xa000, + {0x01,0x0f,0x00,0x06}, + 0xe3, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0x0b,0x3e, + 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 0xe9,0x8b,0xdf,0x28,0x00,0xe7,0x04,0xc3, + 0xff}, + {0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x01,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x01, + 0xff} + }, /* ExtEGATable */ - { - 0x50, 0x1d, 0x10, 0xa000, - {0x01, 0x0f, 0x00, 0x06}, - 0xe3, - {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0x0b, 0x3e, - 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xe9, 0x8b, 0xdf, 0x28, 0x00, 0xe7, 0x04, 0xe3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, - 0x01, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0f, - 0xff} - }, + { + 0x50,0x1d,0x10,0xa000, + {0x01,0x0f,0x00,0x06}, + 0xe3, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0x0b,0x3e, + 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 0xe9,0x8b,0xdf,0x28,0x00,0xe7,0x04,0xe3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x01,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f, + 0xff} + }, /* MD_13 */ - { - 0x28, 0x18, 0x08, 0x2000, - {0x01, 0x0f, 0x00, 0x0e}, - 0x63, - {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f, - 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x28, 0x40, 0x96, 0xb9, 0xa3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x41, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0f, - 0xff} - } -}; - -typedef struct _SiS310_ExtStruct { + { + 0x28,0x18,0x08,0x2000, + {0x01,0x0f,0x00,0x0e}, + 0x63, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x28,0x40,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, + 0x41,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0f, + 0xff} + } +}; + +typedef struct _SiS310_ExtStruct +{ UCHAR Ext_ModeID; USHORT Ext_ModeFlag; USHORT Ext_ModeInfo; - USHORT Ext_Point; + USHORT Ext_Point; /* TW: Address of table entry in (older) BIOS image */ USHORT Ext_VESAID; UCHAR Ext_VESAMEMSize; UCHAR Ext_RESINFO; @@ -495,651 +504,733 @@ typedef struct _SiS310_ExtStruct { UCHAR VB_ExtTVYFilterIndex; UCHAR REFindex; } SiS310_ExtStruct; -SiS310_ExtStruct SiS310_EModeIDTable[] = { - - {0x6a, 0x2212, 0x0407, 0x3a81, 0x0102, 0x08, 0x07, 0x00, 0x00, 0x07, - 0x00}, - {0x2e, 0x0a1b, 0x0306, 0x3a57, 0x0101, 0x08, 0x06, 0x00, 0x00, 0x05, - 0x08}, - {0x2f, 0x0a1b, 0x0305, 0x3a50, 0x0100, 0x08, 0x05, 0x00, 0x00, 0x05, - 0x10}, - {0x30, 0x2a1b, 0x0407, 0x3a81, 0x0103, 0x08, 0x07, 0x00, 0x00, 0x07, - 0x00}, - {0x31, 0x0a1b, 0x030d, 0x3b85, 0x0000, 0x08, 0x0d, 0x00, 0x00, 0x06, - 0x11}, - {0x32, 0x0a1b, 0x0a0e, 0x3b8c, 0x0000, 0x08, 0x0e, 0x00, 0x00, 0x06, - 0x12}, - {0x33, 0x0a1d, 0x0a0d, 0x3b85, 0x0000, 0x08, 0x0d, 0x00, 0x00, 0x06, - 0x11}, - {0x34, 0x2a1d, 0x0a0e, 0x3b8c, 0x0000, 0x08, 0x0e, 0x00, 0x00, 0x06, - 0x12}, - {0x35, 0x0a1f, 0x0a0d, 0x3b85, 0x0000, 0x08, 0x0d, 0x00, 0x00, 0x06, - 0x11}, - {0x36, 0x2a1f, 0x0a0e, 0x3b8c, 0x0000, 0x08, 0x0e, 0x00, 0x00, 0x06, - 0x12}, - {0x37, 0x0212, 0x0508, 0x3aab, 0x0104, 0x08, 0x08, 0x00, 0x00, 0x00, - 0x13}, - {0x38, 0x0a1b, 0x0508, 0x3aab, 0x0105, 0x08, 0x08, 0x00, 0x00, 0x00, - 0x13}, - {0x3a, 0x0e3b, 0x0609, 0x3adc, 0x0107, 0x08, 0x09, 0x00, 0x00, 0x00, - 0x1a}, - {0x3c, 0x063b, 0x070a, 0x3af2, 0x0130, 0x08, 0x0a, 0x00, 0x00, 0x00, - 0x1e}, - {0x3d, 0x067d, 0x070a, 0x3af2, 0x0131, 0x08, 0x0a, 0x00, 0x00, 0x00, - 0x1e}, - {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}, - {0x44, 0x0a1d, 0x0306, 0x3a57, 0x0111, 0x08, 0x06, 0x00, 0x00, 0x05, - 0x08}, - {0x46, 0x2a1c, 0x0407, 0x3a81, 0x0113, 0x08, 0x07, 0x00, 0x00, 0x07, - 0x00}, - {0x47, 0x2a1d, 0x0407, 0x3a81, 0x0114, 0x08, 0x07, 0x00, 0x00, 0x07, - 0x00}, - {0x49, 0x0a3c, 0x0508, 0x3aab, 0x0116, 0x08, 0x08, 0x00, 0x00, 0x00, - 0x13}, - {0x4a, 0x0a3d, 0x0508, 0x3aab, 0x0117, 0x08, 0x08, 0x00, 0x00, 0x00, - 0x13}, - {0x4c, 0x0e7c, 0x0609, 0x3adc, 0x0119, 0x08, 0x09, 0x00, 0x00, 0x00, - 0x1a}, - {0x4d, 0x0e7d, 0x0609, 0x3adc, 0x011a, 0x08, 0x09, 0x00, 0x00, 0x00, - 0x1a}, - {0x50, 0x9a1b, 0x0001, 0x3a3b, 0x0132, 0x08, 0x01, 0x00, 0x00, 0x04, - 0x26}, - {0x51, 0xba1b, 0x0103, 0x3a42, 0x0133, 0x08, 0x03, 0x00, 0x00, 0x07, - 0x27}, - {0x52, 0x9a1b, 0x0204, 0x3a49, 0x0134, 0x08, 0x04, 0x00, 0x00, 0x00, - 0x28}, - {0x56, 0x9a1d, 0x0001, 0x3a3b, 0x0135, 0x08, 0x01, 0x00, 0x00, 0x04, - 0x26}, - {0x57, 0xba1d, 0x0103, 0x3a42, 0x0136, 0x08, 0x03, 0x00, 0x00, 0x07, - 0x27}, - {0x58, 0x9a1d, 0x0204, 0x3a49, 0x0137, 0x08, 0x04, 0x00, 0x00, 0x00, - 0x28}, - {0x59, 0x9a1b, 0x0000, 0x3a34, 0x0138, 0x08, 0x00, 0x00, 0x00, 0x04, - 0x25}, - {0x5d, 0x0a1d, 0x0305, 0x3a50, 0x0139, 0x08, 0x05, 0x00, 0x00, 0x07, - 0x10}, - {0x62, 0x0a3f, 0x0306, 0x3a57, 0x013a, 0x08, 0x06, 0x00, 0x00, 0x05, - 0x08}, - {0x63, 0x2a3f, 0x0407, 0x3a81, 0x013b, 0x08, 0x07, 0x00, 0x00, 0x07, - 0x00}, - {0x64, 0x0a7f, 0x0508, 0x3aab, 0x013c, 0x08, 0x08, 0x00, 0x00, 0x00, - 0x13}, - {0x65, 0x0eff, 0x0609, 0x3adc, 0x013d, 0x08, 0x09, 0x00, 0x00, 0x00, - 0x1a}, - {0x66, 0x06ff, 0x070a, 0x3af2, 0x013e, 0x08, 0x0a, 0x00, 0x00, 0x00, - 0x1e}, - {0x68, 0x067b, 0x080b, 0x3b17, 0x013f, 0x08, 0x0b, 0x00, 0x00, 0x00, - 0x29}, - {0x69, 0x06fd, 0x080b, 0x3b17, 0x0140, 0x08, 0x0b, 0x00, 0x00, 0x00, - 0x29}, - {0x6b, 0x07ff, 0x080b, 0x3b17, 0x0141, 0x10, 0x0b, 0x00, 0x00, 0x00, - 0x29}, - {0x6c, 0x067b, 0x090c, 0x3b37, 0x0000, 0x08, 0x0c, 0x00, 0x00, 0x00, - 0x2f}, - {0x6d, 0x06fd, 0x090c, 0x3b37, 0x0000, 0x10, 0x0c, 0x00, 0x00, 0x00, - 0x2f}, - {0x6e, 0x07ff, 0x090c, 0x3b37, 0x0000, 0x10, 0x0c, 0x00, 0x00, 0x00, - 0x2f}, - {0x70, 0x2a1b, 0x0410, 0x3b52, 0x0000, 0x08, 0x10, 0x00, 0x00, 0x07, - 0x34}, - {0x71, 0x0a1b, 0x0511, 0x3b63, 0x0000, 0x08, 0x11, 0x00, 0x00, 0x00, - 0x37}, - {0x74, 0x0a1d, 0x0511, 0x3b63, 0x0000, 0x08, 0x11, 0x00, 0x00, 0x00, - 0x37}, - {0x75, 0x0a3d, 0x0612, 0x3b74, 0x0000, 0x08, 0x12, 0x00, 0x00, 0x00, - 0x3a}, - {0x76, 0x2a1f, 0x0410, 0x3b52, 0x0000, 0x08, 0x10, 0x00, 0x00, 0x07, - 0x34}, - {0x77, 0x0a1f, 0x0511, 0x3b63, 0x0000, 0x08, 0x11, 0x00, 0x00, 0x00, - 0x37}, - {0x78, 0x0a3f, 0x0612, 0x3b74, 0x0000, 0x08, 0x12, 0x00, 0x00, 0x00, - 0x3a}, - {0x79, 0x0a3b, 0x0612, 0x3b74, 0x0000, 0x08, 0x12, 0x00, 0x00, 0x00, - 0x3a}, - {0x7a, 0x2a1d, 0x0410, 0x3b52, 0x0000, 0x08, 0x10, 0x00, 0x00, 0x07, - 0x34}, - {0x7b, 0x0e3b, 0x060f, 0x3ad0, 0x0000, 0x08, 0x0f, 0x00, 0x00, 0x00, - 0x3d}, - {0x7c, 0x0e7d, 0x060f, 0x3ad0, 0x0000, 0x08, 0x0f, 0x00, 0x00, 0x00, - 0x3d}, - {0x7d, 0x0eff, 0x060f, 0x3ad0, 0x0000, 0x08, 0x0f, 0x00, 0x00, 0x00, - 0x3d}, - {0xff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00} -}; - -typedef struct _SiS310_Ext2Struct { + +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 */ +/* {0x2e,0x021b,0x0306,0x3a57,0x0101,0x08,0x06,0x00,0x00,0x05,0x08}, */ /* 640x480x8 - 650/LVDS BIOS (no CRt2Mode) */ + {0x2f,0x0a1b,0x0305,0x3a50,0x0100,0x08,0x05,0x00,0x00,0x05,0x10}, /* 640x400x8 */ +/* {0x2f,0x021b,0x0305,0x3a50,0x0100,0x08,0x05,0x00,0x00,0x05,0x10}, */ /* 640x400x8 - 650/LVDS BIOS (no CRt2Mode) */ + {0x30,0x2a1b,0x0407,0x3a81,0x0103,0x08,0x07,0x00,0x00,0x07,0x00}, /* 800x600x8 */ +/* {0x30,0x221b,0x0407,0x3a81,0x0103,0x08,0x07,0x00,0x00,0x07,0x00}, */ /* 800x600x8 - 650/LVDS BIOS (no CRt2Mode) */ +/* {0x31,0x0a1b,0x030d,0x3b85,0x0000,0x08,0x0d,0x00,0x00,0x06,0x11}, */ /* 720x480x8 */ + {0x31,0x0a1b,0x0a0d,0x3b85,0x0000,0x08,0x0d,0x00,0x00,0x06,0x11}, /* 720x480x8 BIOS (301/LVDS) */ + {0x32,0x0a1b,0x0a0e,0x3b8c,0x0000,0x08,0x0e,0x00,0x00,0x06,0x12}, /* 720x576x8 */ + {0x33,0x0a1d,0x0a0d,0x3b85,0x0000,0x08,0x0d,0x00,0x00,0x06,0x11}, /* 720x480x16 */ + {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 */ +/* {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,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 */ + {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}, + {0x44,0x0a1d,0x0306,0x3a57,0x0111,0x08,0x06,0x00,0x00,0x05,0x08}, /* 640x480x16 */ + {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 */ + {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,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}, */ + {0x52,0xba1b,0x0204,0x3a49,0x0134,0x08,0x04,0x00,0x00,0x00,0x28}, /* 650/301 BIOS */ +/* {0x52,0xb21b,0x0204,0x3a49,0x0134,0x08,0x04,0x00,0x00,0x00,0x28}, */ /* 650/LVDS BIOS (no CRT2Mode) */ + {0x56,0x9a1d,0x0001,0x3a3b,0x0135,0x08,0x01,0x00,0x00,0x04,0x26}, + {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,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}, + {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 */ + {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 */ + {0x69,0x06fd,0x080b,0x3b17,0x0140,0x08,0x0b,0x00,0x00,0x00,0x29}, /* 1920x1440x16 */ + {0x6b,0x07ff,0x080b,0x3b17,0x0141,0x10,0x0b,0x00,0x00,0x00,0x29}, /* 1920x1440x32 */ + {0x6c,0x067b,0x090c,0x3b37,0x0000,0x08,0x0c,0x00,0x00,0x00,0x2f}, /* 2048x1536x8 */ + {0x6d,0x06fd,0x090c,0x3b37,0x0000,0x10,0x0c,0x00,0x00,0x00,0x2f}, /* 2048x1536x16 */ + {0x6e,0x07ff,0x090c,0x3b37,0x0000,0x10,0x0c,0x00,0x00,0x00,0x2f}, /* 2048x1536x32 */ + {0x70,0x2a1b,0x0410,0x3b52,0x0000,0x08,0x10,0x00,0x00,0x07,0x34}, /* 800x480x8 */ + {0x71,0x0a1b,0x0511,0x3b63,0x0000,0x08,0x11,0x00,0x00,0x00,0x37}, /* 1024x576x8 */ + {0x74,0x0a1d,0x0511,0x3b63,0x0000,0x08,0x11,0x00,0x00,0x00,0x37}, /* 1024x576x16 */ + {0x75,0x0a3d,0x0612,0x3b74,0x0000,0x08,0x12,0x00,0x00,0x00,0x3a}, /* 1280x720x16 */ + {0x76,0x2a1f,0x0410,0x3b52,0x0000,0x08,0x10,0x00,0x00,0x07,0x34}, /* 800x480x32 */ + {0x77,0x0a1f,0x0511,0x3b63,0x0000,0x08,0x11,0x00,0x00,0x00,0x37}, /* 1024x576x32 */ + {0x78,0x0a3f,0x0612,0x3b74,0x0000,0x08,0x12,0x00,0x00,0x00,0x3a}, /* 1280x720x32 */ + {0x79,0x0a3b,0x0612,0x3b74,0x0000,0x08,0x12,0x00,0x00,0x00,0x3a}, /* 1280x720x8 */ + {0x7a,0x2a1d,0x0410,0x3b52,0x0000,0x08,0x10,0x00,0x00,0x07,0x34}, /* 800x480x16 */ + {0x7c,0x0e3b,0x060f,0x3ad0,0x0000,0x08,0x0f,0x00,0x00,0x00,0x3d}, /* 1280x960x8 - TW */ + {0x7d,0x0e7d,0x060f,0x3ad0,0x0000,0x08,0x0f,0x00,0x00,0x00,0x3d}, /* 1280x960x16 - TW */ + {0x7e,0x0eff,0x060f,0x3ad0,0x0000,0x08,0x0f,0x00,0x00,0x00,0x3d}, /* 1280x960x32 - TW */ + /* TW: 650/LVDS BIOS new modes */ +/* {0x23,0x063b,0x0614,0x36f7,0x0000,0x08,0x14,0x00,0x00,0x00,0x40}, */ /* 1280x768x8 - 650/LVDS BIOS */ + {0x23,0x0e3b,0x0614,0x36f7,0x0000,0x08,0x14,0x00,0x00,0x00,0x40}, /* 1280x768x8 */ + {0x24,0x0e7d,0x0614,0x36f7,0x0000,0x08,0x14,0x00,0x00,0x00,0x40}, /* 1280x768x16 */ + {0x25,0x0eff,0x0614,0x36f7,0x0000,0x08,0x14,0x00,0x00,0x00,0x40}, /* 1280x768x32 */ + {0x26,0x0e3b,0x0c15,0x36fe,0x0000,0x08,0x15,0x00,0x00,0x00,0x41}, /* 1400x1050x8 */ +/* {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*/ + {0xff,0x0000,0x0000,0x0000,0x0000,0x00,0x00,0x00,0x00,0x00,0x00} +}; + +typedef struct _SiS310_Ext2Struct +{ USHORT Ext_InfoFlag; UCHAR Ext_CRT1CRTC; UCHAR Ext_CRTVCLK; UCHAR Ext_CRT2CRTC; - UCHAR ModeID; + UCHAR ModeID; USHORT XRes; USHORT YRes; USHORT ROM_OFFSET; } SiS310_Ext2Struct; -SiS310_Ext2Struct SiS310_RefIndex[] = { - {0x005f, 0x0d, 0x03, 0x05, 0x6a, 800, 600, 0x3a81}, /* 0x0 */ - {0x0467, 0x0e, 0x04, 0x05, 0x6a, 800, 600, 0x3a86}, /* 0x1 */ - {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 */ - {0xc05f, 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, 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 */ - {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 */ - {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 */ - {0x0007, 0x1f, 0x20, 0x00, 0x3a, 1280, 1024, 0x3aeb}, /* 0x1d */ - {0x0007, 0x20, 0x21, 0x00, 0x3c, 1600, 1200, 0x3af2}, /* 0x1e */ - {0x0007, 0x21, 0x22, 0x00, 0x3c, 1600, 1200, 0x3af7}, /* 0x1f */ - {0x0007, 0x22, 0x23, 0x00, 0x3c, 1600, 1200, 0x3afc}, /* 0x20 */ - {0x0007, 0x23, 0x25, 0x00, 0x3c, 1600, 1200, 0x3b01}, /* 0x21 */ - {0x0007, 0x24, 0x26, 0x00, 0x3c, 1600, 1200, 0x3b06}, /* 0x22 */ - {0x0007, 0x25, 0x2c, 0x00, 0x3c, 1600, 1200, 0x3b0b}, /* 0x23 */ - {0x0007, 0x26, 0x34, 0x00, 0x3c, 1600, 1200, 0x3b10}, /* 0x24 */ - {0x407f, 0x00, 0x00, 0x00, 0x40, 320, 200, 0x3a34}, /* 0x25 */ - {0xc07f, 0x01, 0x00, 0x04, 0x50, 320, 240, 0x3a3b}, /* 0x26 */ - {0x007f, 0x02, 0x04, 0x05, 0x51, 400, 300, 0x3a42}, /* 0x27 */ - {0xc077, 0x03, 0x0b, 0x06, 0x52, 512, 384, 0x3a49}, /* 0x28 */ - {0x8007, 0x27, 0x27, 0x00, 0x68, 1920, 1440, 0x3b17}, /* 0x29 */ - {0x4007, 0x28, 0x29, 0x00, 0x68, 1920, 1440, 0x3b1c}, /* 0x2a */ - {0x4007, 0x29, 0x2e, 0x00, 0x68, 1920, 1440, 0x3b21}, /* 0x2b */ - {0x4007, 0x2a, 0x30, 0x00, 0x68, 1920, 1440, 0x3b26}, /* 0x2c */ - {0x4007, 0x2b, 0x35, 0x00, 0x68, 1920, 1440, 0x3b2b}, /* 0x2d */ - {0x4005, 0x2c, 0x39, 0x00, 0x68, 1920, 1440, 0x3b30}, /* 0x2e */ - {0x4007, 0x2d, 0x2b, 0x00, 0x6c, 2048, 1536, 0x3b37}, /* 0x2f */ - {0x4007, 0x2e, 0x31, 0x00, 0x6c, 2048, 1536, 0x3b3c}, /* 0x30 */ - {0x4007, 0x2f, 0x33, 0x00, 0x6c, 2048, 1536, 0x3b41}, /* 0x31 */ - {0x4007, 0x30, 0x37, 0x00, 0x6c, 2048, 1536, 0x3b46}, /* 0x32 */ - {0x4005, 0x31, 0x38, 0x00, 0x6c, 2048, 1536, 0x3b4b}, /* 0x33 */ - {0x0057, 0x32, 0x40, 0x08, 0x70, 800, 480, 0x3b52}, /* 0x34 */ - {0x0047, 0x33, 0x07, 0x08, 0x70, 800, 480, 0x3b57}, /* 0x35 */ - {0x0047, 0x34, 0x0a, 0x08, 0x70, 800, 480, 0x3b5c}, /* 0x36 */ - {0x0057, 0x35, 0x0b, 0x09, 0x71, 1024, 576, 0x3b63}, /* 0x37 */ - {0x0047, 0x36, 0x11, 0x09, 0x71, 1024, 576, 0x3b68}, /* 0x38 */ - {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, 0x7b, 1280, 960, 0x3ad0}, /* 0x3d */ - {0x0027, 0x3b, 0x19, 0x08, 0x7b, 1280, 960, 0x3ad5}, /* 0x3e */ - {0xffff, 0x00, 0x00, 0x00, 0x00, 0000, 0000, 0x0000} -}; - -typedef struct _SiS310_CRT1TableStruct { - UCHAR CR[17]; -} SiS310_CRT1TableStruct; -SiS310_CRT1TableStruct SiS310_CRT1Table[] = { - {{0x2d, 0x27, 0x28, 0x90, 0x2c, 0x80, 0xbf, 0x1f, - 0x9c, 0x8e, 0x8f, 0x96, 0xb9, 0x30, 0x00, 0x00, - 0x00}}, /* 0x0 */ - {{0x2d, 0x27, 0x28, 0x90, 0x2c, 0x80, 0x0b, 0x3e, - 0xe9, 0x8b, 0xdf, 0xe7, 0x04, 0x00, 0x00, 0x00, - 0x00}}, /* 0x1 */ - {{0x3d, 0x31, 0x31, 0x81, 0x37, 0x1f, 0x72, 0xf0, - 0x58, 0x8c, 0x57, 0x57, 0x73, 0x20, 0x00, 0x05, - 0x01}}, /* 0x2 */ - {{0x4f, 0x3f, 0x3f, 0x93, 0x45, 0x0d, 0x24, 0xf5, - 0x02, 0x88, 0xff, 0xff, 0x25, 0x10, 0x00, 0x01, - 0x01}}, /* 0x3 */ - {{0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f, - 0x9c, 0x8e, 0x8f, 0x96, 0xb9, 0x30, 0x00, 0x05, - 0x00}}, /* 0x4 */ - {{0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0x0b, 0x3e, - 0xe9, 0x8b, 0xdf, 0xe7, 0x04, 0x00, 0x00, 0x05, - 0x00}}, /* 0x5 */ - {{0x63, 0x4f, 0x50, 0x86, 0x56, 0x9b, 0x06, 0x3e, - 0xe8, 0x8b, 0xdf, 0xe7, 0xff, 0x10, 0x00, 0x01, - 0x00}}, /* 0x6 */ - {{0x64, 0x4f, 0x4f, 0x88, 0x55, 0x9d, 0xf2, 0x1f, - 0xe0, 0x83, 0xdf, 0xdf, 0xf3, 0x10, 0x00, 0x01, - 0x00}}, /* 0x7 */ - {{0x63, 0x4f, 0x4f, 0x87, 0x5a, 0x81, 0xfb, 0x1f, - 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, - 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, - 0x61}}, /* 0xb */ - {{0x65, 0x4f, 0x4f, 0x89, 0x57, 0x9f, 0xfb, 0x1f, - 0xe6, 0x8a, 0xe5, 0xe5, 0xfc, 0x00, 0x00, 0x01, - 0x00}}, /* 0xc */ - {{0x7b, 0x63, 0x63, 0x9f, 0x6a, 0x93, 0x6f, 0xf0, - 0x58, 0x8a, 0x57, 0x57, 0x70, 0x20, 0x00, 0x05, - 0x01}}, /* 0xd */ - {{0x7f, 0x63, 0x63, 0x83, 0x6c, 0x1c, 0x72, 0xf0, - 0x58, 0x8c, 0x57, 0x57, 0x73, 0x20, 0x00, 0x06, - 0x01}}, /* 0xe */ - {{0x7d, 0x63, 0x63, 0x81, 0x6e, 0x1d, 0x98, 0xf0, - 0x7c, 0x82, 0x57, 0x57, 0x99, 0x00, 0x00, 0x06, - 0x01}}, /* 0xf */ - {{0x7f, 0x63, 0x63, 0x83, 0x69, 0x13, 0x6f, 0xf0, - 0x58, 0x8b, 0x57, 0x57, 0x70, 0x20, 0x00, 0x06, - 0x01}}, /* 0x10 */ - {{0x7e, 0x63, 0x63, 0x82, 0x6b, 0x13, 0x75, 0xf0, - 0x58, 0x8b, 0x57, 0x57, 0x76, 0x20, 0x00, 0x06, - 0x01}}, /* 0x11 */ - {{0x81, 0x63, 0x63, 0x85, 0x6d, 0x18, 0x7a, 0xf0, - 0x58, 0x8b, 0x57, 0x57, 0x7b, 0x20, 0x00, 0x06, - 0x61}}, /* 0x12 */ - {{0x83, 0x63, 0x63, 0x87, 0x6e, 0x19, 0x81, 0xf0, - 0x58, 0x8b, 0x57, 0x57, 0x82, 0x20, 0x00, 0x06, - 0x61}}, /* 0x13 */ - {{0x85, 0x63, 0x63, 0x89, 0x6f, 0x1a, 0x91, 0xf0, - 0x58, 0x8b, 0x57, 0x57, 0x92, 0x20, 0x00, 0x06, - 0x61}}, /* 0x14 */ - {{0x99, 0x7f, 0x7f, 0x9d, 0x84, 0x1a, 0x96, 0x1f, - 0x7f, 0x83, 0x7f, 0x7f, 0x97, 0x10, 0x00, 0x02, - 0x00}}, /* 0x15 */ - {{0xa3, 0x7f, 0x7f, 0x87, 0x86, 0x97, 0x24, 0xf5, - 0x02, 0x88, 0xff, 0xff, 0x25, 0x10, 0x00, 0x02, - 0x01}}, /* 0x16 */ - {{0xa1, 0x7f, 0x7f, 0x85, 0x86, 0x97, 0x24, 0xf5, - 0x02, 0x88, 0xff, 0xff, 0x25, 0x10, 0x00, 0x02, - 0x01}}, /* 0x17 */ - {{0x9f, 0x7f, 0x7f, 0x83, 0x85, 0x91, 0x1e, 0xf5, - 0x00, 0x83, 0xff, 0xff, 0x1f, 0x10, 0x00, 0x02, - 0x01}}, /* 0x18 */ - {{0xa7, 0x7f, 0x7f, 0x8b, 0x89, 0x95, 0x26, 0xf5, - 0x00, 0x83, 0xff, 0xff, 0x27, 0x10, 0x00, 0x02, - 0x01}}, /* 0x19 */ - {{0xa9, 0x7f, 0x7f, 0x8d, 0x8c, 0x9a, 0x2c, 0xf5, - 0x00, 0x83, 0xff, 0xff, 0x2d, 0x14, 0x00, 0x02, - 0x62}}, /* 0x1a */ - {{0xab, 0x7f, 0x7f, 0x8f, 0x8d, 0x9b, 0x35, 0xf5, - 0x00, 0x83, 0xff, 0xff, 0x36, 0x14, 0x00, 0x02, - 0x62}}, /* 0x1b */ - {{0xcf, 0x9f, 0x9f, 0x93, 0xb2, 0x01, 0x14, 0xba, - 0x00, 0x83, 0xff, 0xff, 0x15, 0x00, 0x00, 0x03, - 0x00}}, /* 0x1c */ - {{0xce, 0x9f, 0x9f, 0x92, 0xa9, 0x17, 0x28, 0x5a, - 0x00, 0x83, 0xff, 0xff, 0x29, 0x09, 0x00, 0x07, - 0x01}}, /* 0x1d */ - {{0xce, 0x9f, 0x9f, 0x92, 0xa5, 0x17, 0x28, 0x5a, - 0x00, 0x83, 0xff, 0xff, 0x29, 0x09, 0x00, 0x07, - 0x01}}, /* 0x1e */ - {{0xd3, 0x9f, 0x9f, 0x97, 0xab, 0x1f, 0x2e, 0x5a, - 0x00, 0x83, 0xff, 0xff, 0x2f, 0x09, 0x00, 0x07, - 0x01}}, /* 0x1f */ - {{0x09, 0xc7, 0xc7, 0x8d, 0xd3, 0x0b, 0xe0, 0x10, - 0xb0, 0x83, 0xaf, 0xaf, 0xe1, 0x2f, 0x01, 0x04, - 0x00}}, /* 0x20 */ - {{0x09, 0xc7, 0xc7, 0x8d, 0xd3, 0x0b, 0xe0, 0x10, - 0xb0, 0x83, 0xaf, 0xaf, 0xe1, 0x2f, 0x01, 0x04, - 0x00}}, /* 0x21 */ - {{0x09, 0xc7, 0xc7, 0x8d, 0xd3, 0x0b, 0xe0, 0x10, - 0xb0, 0x83, 0xaf, 0xaf, 0xe1, 0x2f, 0x01, 0x04, - 0x00}}, /* 0x22 */ - {{0x09, 0xc7, 0xc7, 0x8d, 0xd3, 0x0b, 0xe0, 0x10, - 0xb0, 0x83, 0xaf, 0xaf, 0xe1, 0x2f, 0x01, 0x04, - 0x00}}, /* 0x23 */ - {{0x09, 0xc7, 0xc7, 0x8d, 0xd3, 0x0b, 0xe0, 0x10, - 0xb0, 0x83, 0xaf, 0xaf, 0xe1, 0x2f, 0x01, 0x04, - 0x00}}, /* 0x24 */ - {{0x09, 0xc7, 0xc7, 0x8d, 0xd3, 0x0b, 0xe0, 0x10, - 0xb0, 0x83, 0xaf, 0xaf, 0xe1, 0x2f, 0x01, 0x04, - 0x00}}, /* 0x25 */ - {{0x09, 0xc7, 0xc7, 0x8d, 0xd3, 0x0b, 0xe0, 0x10, - 0xb0, 0x83, 0xaf, 0xaf, 0xe1, 0x2f, 0x01, 0x04, - 0x00}}, /* 0x26 */ - {{0x40, 0xef, 0xef, 0x84, 0x03, 0x1d, 0xda, 0x1f, - 0xa0, 0x83, 0x9f, 0x9f, 0xdb, 0x1f, 0x41, 0x01, - 0x00}}, /* 0x27 */ - {{0x43, 0xef, 0xef, 0x87, 0x06, 0x00, 0xd4, 0x1f, - 0xa0, 0x83, 0x9f, 0x9f, 0xd5, 0x1f, 0x41, 0x05, - 0x63}}, /* 0x28 */ - {{0x45, 0xef, 0xef, 0x89, 0x07, 0x01, 0xd9, 0x1f, - 0xa0, 0x83, 0x9f, 0x9f, 0xda, 0x1f, 0x41, 0x05, - 0x63}}, /* 0x29 */ - {{0x40, 0xef, 0xef, 0x84, 0x03, 0x1d, 0xda, 0x1f, - 0xa0, 0x83, 0x9f, 0x9f, 0xdb, 0x1f, 0x41, 0x01, - 0x00}}, /* 0x2a */ - {{0x40, 0xef, 0xef, 0x84, 0x03, 0x1d, 0xda, 0x1f, - 0xa0, 0x83, 0x9f, 0x9f, 0xdb, 0x1f, 0x41, 0x01, - 0x00}}, /* 0x2b */ - {{0x40, 0xef, 0xef, 0x84, 0x03, 0x1d, 0xda, 0x1f, - 0xa0, 0x83, 0x9f, 0x9f, 0xdb, 0x1f, 0x41, 0x01, - 0x00}}, /* 0x2c */ - {{0x59, 0xff, 0xff, 0x9d, 0x17, 0x13, 0x33, 0xba, - 0x00, 0x83, 0xff, 0xff, 0x34, 0x0f, 0x41, 0x05, - 0x44}}, /* 0x2d */ - {{0x5b, 0xff, 0xff, 0x9f, 0x18, 0x14, 0x38, 0xba, - 0x00, 0x83, 0xff, 0xff, 0x39, 0x0f, 0x41, 0x05, - 0x44}}, /* 0x2e */ - {{0x5b, 0xff, 0xff, 0x9f, 0x18, 0x14, 0x3d, 0xba, - 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 */ - {{0x55, 0xff, 0xff, 0x99, 0x0d, 0x0c, 0x3e, 0xba, - 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 */ - {{0x7f, 0x63, 0x63, 0x83, 0x69, 0x13, 0x6f, 0xba, - 0x26, 0x89, 0xdf, 0xdf, 0x6f, 0x00, 0x00, 0x06, - 0x01}}, /* 0x33 */ - {{0x7f, 0x63, 0x63, 0x82, 0x6b, 0x13, 0x75, 0xba, - 0x29, 0x8c, 0xdf, 0xdf, 0x75, 0x00, 0x00, 0x06, - 0x01}}, /* 0x34 */ - {{0xa3, 0x7f, 0x7f, 0x87, 0x86, 0x97, 0x24, 0xf1, - 0xaf, 0x85, 0x3f, 0x3f, 0x25, 0x30, 0x00, 0x02, - 0x01}}, /* 0x35 */ - {{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, - 0xb1, 0x85, 0x3f, 0x3f, 0x27, 0x30, 0x00, 0x02, - 0x01}}, /* 0x37 */ - {{0xce, 0x9f, 0x9f, 0x92, 0xa9, 0x17, 0x28, 0xc4, - 0x7a, 0x8e, 0xcf, 0xcf, 0x29, 0x21, 0x00, 0x07, - 0x01}}, /* 0x38 */ - {{0xce, 0x9f, 0x9f, 0x92, 0xa5, 0x17, 0x28, 0xd4, - 0x7a, 0x8e, 0xcf, 0xcf, 0x29, 0x21, 0x00, 0x07, - 0x01}}, /* 0x39 */ - {{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, - 0xc0, 0xc3, 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 */ - {{0x7b, 0x59, 0x63, 0x9f, 0x6a, 0x93, 0x6f, 0xf0, - 0x58, 0x8a, 0x3f, 0x57, 0x70, 0x20, 0x00, 0x05, - 0x01}} /* 0x3d */ -}; - -typedef struct _SiS310_MCLKDataStruct { - UCHAR SR28, SR29, SR2A; +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 */ + {0x0467,0x0e,0x04,0x05,0x6a, 800, 600,0x3a86}, /* 0x1 */ + {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 */ +/* {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,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*/ + {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 */ + {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 */ + {0x0007,0x1f,0x20,0x00,0x3a,1280,1024,0x3aeb}, /* 0x1d */ + {0x0007,0x20,0x21,0x00,0x3c,1600,1200,0x3af2}, /* 0x1e */ + {0x0007,0x21,0x22,0x00,0x3c,1600,1200,0x3af7}, /* 0x1f */ + {0x0007,0x22,0x23,0x00,0x3c,1600,1200,0x3afc}, /* 0x20 */ + {0x0007,0x23,0x25,0x00,0x3c,1600,1200,0x3b01}, /* 0x21 */ + {0x0007,0x24,0x26,0x00,0x3c,1600,1200,0x3b06}, /* 0x22 */ + {0x0007,0x25,0x2c,0x00,0x3c,1600,1200,0x3b0b}, /* 0x23 */ + {0x0007,0x26,0x34,0x00,0x3c,1600,1200,0x3b10}, /* 0x24 */ + {0x407f,0x00,0x00,0x00,0x40, 320, 200,0x3a34}, /* 0x25 */ + {0xc07f,0x01,0x00,0x04,0x50, 320, 240,0x3a3b}, /* 0x26 */ + {0x007f,0x02,0x04,0x05,0x51, 400, 300,0x3a42}, /* 0x27 */ + {0xc077,0x03,0x0b,0x06,0x52, 512, 384,0x3a49}, /* 0x28 */ + {0x8007,0x27,0x27,0x00,0x68,1920,1440,0x3b17}, /* 0x29 */ + {0x4007,0x28,0x29,0x00,0x68,1920,1440,0x3b1c}, /* 0x2a */ + {0x4007,0x29,0x2e,0x00,0x68,1920,1440,0x3b21}, /* 0x2b */ + {0x4007,0x2a,0x30,0x00,0x68,1920,1440,0x3b26}, /* 0x2c */ + {0x4007,0x2b,0x35,0x00,0x68,1920,1440,0x3b2b}, /* 0x2d */ + {0x4005,0x2c,0x39,0x00,0x68,1920,1440,0x3b30}, /* 0x2e */ + {0x4007,0x2d,0x2b,0x00,0x6c,2048,1536,0x3b37}, /* 0x2f */ + {0x4007,0x2e,0x31,0x00,0x6c,2048,1536,0x3b3c}, /* 0x30 */ + {0x4007,0x2f,0x33,0x00,0x6c,2048,1536,0x3b41}, /* 0x31 */ + {0x4007,0x30,0x37,0x00,0x6c,2048,1536,0x3b46}, /* 0x32 */ + {0x4005,0x31,0x38,0x00,0x6c,2048,1536,0x3b4b}, /* 0x33 */ + {0x0057,0x32,0x40,0x08,0x70, 800, 480,0x3b52}, /* 0x34 */ + {0x0047,0x33,0x07,0x08,0x70, 800, 480,0x3b57}, /* 0x35 */ + {0x0047,0x34,0x0a,0x08,0x70, 800, 480,0x3b5c}, /* 0x36 */ + {0x0057,0x35,0x0b,0x09,0x71,1024, 576,0x3b63}, /* 0x37 */ + {0x0047,0x36,0x11,0x09,0x71,1024, 576,0x3b68}, /* 0x38 */ + {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 */ + {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} +}; + +typedef struct _SiS310_CRT1TableStruct +{ + UCHAR CR[17]; +} SiS310_CRT1TableStruct; +SiS310_CRT1TableStruct SiS310_CRT1Table[]= +{ + {{0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f, + 0x9c,0x8e,0x8f,0x96,0xb9,0x30,0x00,0x00, + 0x00}}, /* 0x0 */ + {{0x2d,0x27,0x28,0x90,0x2c,0x80,0x0b,0x3e, + 0xe9,0x8b,0xdf,0xe7,0x04,0x00,0x00,0x00, + 0x00}}, /* 0x1 */ + {{0x3d,0x31,0x31,0x81,0x37,0x1f,0x72,0xf0, + 0x58,0x8c,0x57,0x57,0x73,0x20,0x00,0x05, + 0x01}}, /* 0x2 */ + {{0x4f,0x3f,0x3f,0x93,0x45,0x0d,0x24,0xf5, + 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x01, + 0x01}}, /* 0x3 */ + {{0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x9c,0x8e,0x8f,0x96,0xb9,0x30,0x00,0x05, + 0x00}}, /* 0x4 */ + {{0x5f,0x4f,0x50,0x82,0x55,0x81,0x0b,0x3e, + 0xe9,0x8b,0xdf,0xe7,0x04,0x00,0x00,0x05, + 0x00}}, /* 0x5 */ + {{0x63,0x4f,0x50,0x86,0x56,0x9b,0x06,0x3e, + 0xe8,0x8b,0xdf,0xe7,0xff,0x10,0x00,0x01, + 0x00}}, /* 0x6 */ + {{0x64,0x4f,0x4f,0x88,0x55,0x9d,0xf2,0x1f, + 0xe0,0x83,0xdf,0xdf,0xf3,0x10,0x00,0x01, + 0x00}}, /* 0x7 */ + {{0x63,0x4f,0x4f,0x87,0x5a,0x81,0xfb,0x1f, + 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, + 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, + 0x61}}, /* 0xb */ + {{0x65,0x4f,0x4f,0x89,0x57,0x9f,0xfb,0x1f, + 0xe6,0x8a,0xe5,0xe5,0xfc,0x00,0x00,0x01, + 0x00}}, /* 0xc */ + {{0x7b,0x63,0x63,0x9f,0x6a,0x93,0x6f,0xf0, + 0x58,0x8a,0x57,0x57,0x70,0x20,0x00,0x05, + 0x01}}, /* 0xd */ + {{0x7f,0x63,0x63,0x83,0x6c,0x1c,0x72,0xf0, + 0x58,0x8c,0x57,0x57,0x73,0x20,0x00,0x06, + 0x01}}, /* 0xe */ + {{0x7d,0x63,0x63,0x81,0x6e,0x1d,0x98,0xf0, + 0x7c,0x82,0x57,0x57,0x99,0x00,0x00,0x06, + 0x01}}, /* 0xf */ + {{0x7f,0x63,0x63,0x83,0x69,0x13,0x6f,0xf0, + 0x58,0x8b,0x57,0x57,0x70,0x20,0x00,0x06, + 0x01}}, /* 0x10 */ + {{0x7e,0x63,0x63,0x82,0x6b,0x13,0x75,0xf0, + 0x58,0x8b,0x57,0x57,0x76,0x20,0x00,0x06, + 0x01}}, /* 0x11 */ + {{0x81,0x63,0x63,0x85,0x6d,0x18,0x7a,0xf0, + 0x58,0x8b,0x57,0x57,0x7b,0x20,0x00,0x06, + 0x61}}, /* 0x12 */ + {{0x83,0x63,0x63,0x87,0x6e,0x19,0x81,0xf0, + 0x58,0x8b,0x57,0x57,0x82,0x20,0x00,0x06, + 0x61}}, /* 0x13 */ + {{0x85,0x63,0x63,0x89,0x6f,0x1a,0x91,0xf0, + 0x58,0x8b,0x57,0x57,0x92,0x20,0x00,0x06, + 0x61}}, /* 0x14 */ + {{0x99,0x7f,0x7f,0x9d,0x84,0x1a,0x96,0x1f, + 0x7f,0x83,0x7f,0x7f,0x97,0x10,0x00,0x02, + 0x00}}, /* 0x15 */ + {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x02, + 0x01}}, /* 0x16 */ + {{0xa1,0x7f,0x7f,0x85,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x02, + 0x01}}, /* 0x17 */ + {{0x9f,0x7f,0x7f,0x83,0x85,0x91,0x1e,0xf5, + 0x00,0x83,0xff,0xff,0x1f,0x10,0x00,0x02, + 0x01}}, /* 0x18 */ + {{0xa7,0x7f,0x7f,0x8b,0x89,0x95,0x26,0xf5, + 0x00,0x83,0xff,0xff,0x27,0x10,0x00,0x02, + 0x01}}, /* 0x19 */ + {{0xa9,0x7f,0x7f,0x8d,0x8c,0x9a,0x2c,0xf5, + 0x00,0x83,0xff,0xff,0x2d,0x14,0x00,0x02, + 0x62}}, /* 0x1a */ + {{0xab,0x7f,0x7f,0x8f,0x8d,0x9b,0x35,0xf5, + 0x00,0x83,0xff,0xff,0x36,0x14,0x00,0x02, + 0x62}}, /* 0x1b */ + {{0xcf,0x9f,0x9f,0x93,0xb2,0x01,0x14,0xba, + 0x00,0x83,0xff,0xff,0x15,0x00,0x00,0x03, + 0x00}}, /* 0x1c */ + {{0xce,0x9f,0x9f,0x92,0xa9,0x17,0x28,0x5a, + 0x00,0x83,0xff,0xff,0x29,0x09,0x00,0x07, + 0x01}}, /* 0x1d */ + {{0xce,0x9f,0x9f,0x92,0xa5,0x17,0x28,0x5a, + 0x00,0x83,0xff,0xff,0x29,0x09,0x00,0x07, + 0x01}}, /* 0x1e */ + {{0xd3,0x9f,0x9f,0x97,0xab,0x1f,0x2e,0x5a, + 0x00,0x83,0xff,0xff,0x2f,0x09,0x00,0x07, + 0x01}}, /* 0x1f */ + {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, + 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, + 0x00}}, /* 0x20 */ + {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, + 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, + 0x00}}, /* 0x21 @ 4084 */ + {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, + 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, + 0x00}}, /* 0x22 */ + {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, + 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, + 0x00}}, /* 0x23 */ + {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, + 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, + 0x00}}, /* 0x24 */ + {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, + 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, + 0x00}}, /* 0x25 */ + {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, + 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, + 0x00}}, /* 0x26 */ + {{0x40,0xef,0xef,0x84,0x03,0x1d,0xda,0x1f, + 0xa0,0x83,0x9f,0x9f,0xdb,0x1f,0x41,0x01, + 0x00}}, /* 0x27 */ + {{0x43,0xef,0xef,0x87,0x06,0x00,0xd4,0x1f, + 0xa0,0x83,0x9f,0x9f,0xd5,0x1f,0x41,0x05, + 0x63}}, /* 0x28 */ + {{0x45,0xef,0xef,0x89,0x07,0x01,0xd9,0x1f, + 0xa0,0x83,0x9f,0x9f,0xda,0x1f,0x41,0x05, + 0x63}}, /* 0x29 */ + {{0x40,0xef,0xef,0x84,0x03,0x1d,0xda,0x1f, + 0xa0,0x83,0x9f,0x9f,0xdb,0x1f,0x41,0x01, + 0x00}}, /* 0x2a */ + {{0x40,0xef,0xef,0x84,0x03,0x1d,0xda,0x1f, + 0xa0,0x83,0x9f,0x9f,0xdb,0x1f,0x41,0x01, + 0x00}}, /* 0x2b */ + {{0x40,0xef,0xef,0x84,0x03,0x1d,0xda,0x1f, + 0xa0,0x83,0x9f,0x9f,0xdb,0x1f,0x41,0x01, + 0x00}}, /* 0x2c */ + {{0x59,0xff,0xff,0x9d,0x17,0x13,0x33,0xba, + 0x00,0x83,0xff,0xff,0x34,0x0f,0x41,0x05, + 0x44}}, /* 0x2d */ + {{0x5b,0xff,0xff,0x9f,0x18,0x14,0x38,0xba, + 0x00,0x83,0xff,0xff,0x39,0x0f,0x41,0x05, + 0x44}}, /* 0x2e */ + {{0x5b,0xff,0xff,0x9f,0x18,0x14,0x3d,0xba, + 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 */ + {{0x55,0xff,0xff,0x99,0x0d,0x0c,0x3e,0xba, + 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 */ + {{0x7f,0x63,0x63,0x83,0x69,0x13,0x6f,0xba, + 0x26,0x89,0xdf,0xdf,0x6f,0x00,0x00,0x06, + 0x01}}, /* 0x33 */ + {{0x7f,0x63,0x63,0x82,0x6b,0x13,0x75,0xba, + 0x29,0x8c,0xdf,0xdf,0x75,0x00,0x00,0x06, + 0x01}}, /* 0x34 */ + {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf1, + 0xaf,0x85,0x3f,0x3f,0x25,0x30,0x00,0x02, + 0x01}}, /* 0x35 */ + {{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, + 0xb1,0x85,0x3f,0x3f,0x27,0x30,0x00,0x02, + 0x01}}, /* 0x37 */ + {{0xce,0x9f,0x9f,0x92,0xa9,0x17,0x28,0xc4, + 0x7a,0x8e,0xcf,0xcf,0x29,0x21,0x00,0x07, + 0x01}}, /* 0x38 */ + {{0xce,0x9f,0x9f,0x92,0xa5,0x17,0x28,0xd4, + 0x7a,0x8e,0xcf,0xcf,0x29,0x21,0x00,0x07, + 0x01}}, /* 0x39 */ + {{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, + 0xc0,0xc3,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 */ + {{0x7b,0x59,0x63,0x9f,0x6a,0x93,0x6f,0xf0, + 0x58,0x8a,0x3f,0x57,0x70,0x20,0x00,0x05, + 0x01}}, /* 0x3d */ + {{0x86,0x6a,0x6a,0x8a,0x74,0x06,0x8c,0x15, + 0x4f,0x83,0xef,0xef,0x8d,0x30,0x00,0x02, + 0x00}}, /* 0x3e */ + {{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, + 0xae,0x85,0x57,0x57,0x1f,0x30,0x00,0x02, + 0x01}}, /* 0x40 */ + {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x02, + 0x01}}, /* 0x41 */ + {{0xce,0x9f,0x9f,0x92,0xa9,0x17,0x20,0xf5, + 0x03,0x88,0xff,0xff,0x21,0x10,0x00,0x07, + 0x01}}, /* 0x42 */ + {{0xe6,0xae,0xae,0x8a,0xbd,0x90,0x3d,0x10, + 0x1a,0x8d,0x19,0x19,0x3e,0x2f,0x00,0x03, + 0x00}} /* 0x43 */ +}; + +typedef struct _SiS310_MCLKDataStruct +{ + UCHAR SR28,SR29,SR2A; USHORT CLOCK; } SiS310_MCLKDataStruct; -SiS310_MCLKDataStruct SiS310_MCLKData[] = { - {0x5c, 0x23, 0x01, 166}, - {0x5c, 0x23, 0x01, 166}, - {0x5c, 0x23, 0x01, 166}, - {0x5c, 0x23, 0x01, 166} + +SiS310_MCLKDataStruct SiS310_MCLKData_0_315[] = +{ + { 0x3b,0x22,0x01,143}, /* TW: Was { 0x5c,0x23,0x01,166}, */ + { 0x5c,0x23,0x01,166}, + { 0x5c,0x23,0x01,166}, + { 0x5c,0x23,0x01,166}, + { 0x5c,0x23,0x01,166}, + { 0x5c,0x23,0x01,166}, + { 0x5c,0x23,0x01,166}, + { 0x5c,0x23,0x01,166} }; -typedef struct _SiS310_ECLKDataStruct { - UCHAR SR2E, SR2F, SR30; - USHORT CLOCK; +SiS310_MCLKDataStruct SiS310_MCLKData_0_650[] = /* @ 0x54 */ +{ + { 0x5a,0x64,0x82, 66}, + { 0xb3,0x45,0x82, 83}, + { 0x37,0x61,0x82,100}, + { 0x37,0x22,0x82,133}, + { 0x37,0x61,0x82,100}, + { 0x37,0x22,0x82,133}, + { 0x37,0x22,0x82,133}, + { 0x37,0x22,0x82,133} +}; + +SiS310_MCLKDataStruct SiS310_MCLKData_1[] = /* @ 0x155 */ +{ + { 0x29,0x21,0x82,150}, + { 0x5c,0x23,0x82,166}, + { 0x65,0x23,0x82,183}, + { 0x37,0x21,0x82,200}, + { 0x37,0x22,0x82,133}, + { 0x37,0x22,0x82,133}, + { 0x37,0x22,0x82,133}, + { 0x37,0x22,0x82,133} +}; + +typedef struct _SiS310_ECLKDataStruct +{ + UCHAR SR2E,SR2F,SR30; + USHORT CLOCK; } SiS310_ECLKDataStruct; -SiS310_ECLKDataStruct SiS310_ECLKData[] = { - {0x5c, 0x23, 0x01, 166}, - {0x5c, 0x23, 0x01, 166}, - {0x5c, 0x23, 0x01, 166}, - {0x5c, 0x23, 0x01, 166} +SiS310_ECLKDataStruct SiS310_ECLKData[]= +{ + { 0x5c,0x23,0x01,166}, + { 0x5c,0x23,0x01,166}, + { 0x5c,0x23,0x01,166}, + { 0x5c,0x23,0x01,166} }; -typedef struct _SiS310_VCLKDataStruct { - UCHAR SR2B, SR2C; +typedef struct _SiS310_VCLKDataStruct +{ + UCHAR SR2B,SR2C; USHORT CLOCK; } SiS310_VCLKDataStruct; -SiS310_VCLKDataStruct SiS310_VCLKData[] = { - {0x1b, 0xe1, 25}, /* 0x0 */ - {0x4e, 0xe4, 28}, /* 0x1 */ - {0x57, 0xe4, 31}, /* 0x2 */ - {0xc3, 0xc8, 36}, /* 0x3 */ - {0x42, 0xe2, 40}, /* 0x4 */ - {0xfe, 0xcd, 43}, /* 0x5 */ - {0x5d, 0xc4, 44}, /* 0x6 */ - {0x52, 0xe2, 49}, /* 0x7 */ - {0x53, 0xe2, 50}, /* 0x8 */ - {0x74, 0x67, 52}, /* 0x9 */ - {0x6d, 0x66, 56}, /* 0xa */ - {0x6c, 0xc3, 65}, /* 0xb */ - {0x46, 0x44, 67}, /* 0xc */ - {0xb1, 0x46, 68}, /* 0xd */ - {0xd3, 0x4a, 72}, /* 0xe */ - {0x29, 0x61, 75}, /* 0xf */ - {0x6e, 0x46, 76}, /* 0x10 */ - {0x2b, 0x61, 78}, /* 0x11 */ - {0x31, 0x42, 79}, /* 0x12 */ - {0xab, 0x44, 83}, /* 0x13 */ - {0x46, 0x25, 84}, /* 0x14 */ - {0x78, 0x29, 86}, /* 0x15 */ - {0x62, 0x44, 94}, /* 0x16 */ - {0x2b, 0x41, 104}, /* 0x17 */ - {0x3a, 0x23, 105}, /* 0x18 */ - {0x70, 0x44, 108}, /* 0x19 */ - {0x3c, 0x23, 109}, /* 0x1a */ - {0x5e, 0x43, 113}, /* 0x1b */ - {0xbc, 0x44, 116}, /* 0x1c */ - {0xe0, 0x46, 132}, /* 0x1d */ - {0x54, 0x42, 135}, /* 0x1e */ - {0xea, 0x2a, 139}, /* 0x1f */ - {0x41, 0x22, 157}, /* 0x20 */ - {0x70, 0x24, 162}, /* 0x21 */ - {0x30, 0x21, 175}, /* 0x22 */ - {0x4e, 0x22, 189}, /* 0x23 */ - {0xde, 0x26, 194}, /* 0x24 */ - {0x62, 0x06, 202}, /* 0x25 */ - {0x3f, 0x03, 229}, /* 0x26 */ - {0xb8, 0x06, 234}, /* 0x27 */ - {0x34, 0x02, 253}, /* 0x28 */ - {0x58, 0x04, 255}, /* 0x29 */ - {0x24, 0x01, 265}, /* 0x2a */ - {0x9b, 0x02, 267}, /* 0x2b */ - {0x70, 0x05, 270}, /* 0x2c */ - {0x25, 0x01, 272}, /* 0x2d */ - {0x9c, 0x02, 277}, /* 0x2e */ - {0x27, 0x01, 286}, /* 0x2f */ - {0x3c, 0x02, 291}, /* 0x30 */ - {0xef, 0x0a, 292}, /* 0x31 */ - {0xf6, 0x0a, 310}, /* 0x32 */ - {0x95, 0x01, 315}, /* 0x33 */ - {0xf0, 0x09, 324}, /* 0x34 */ - {0xfe, 0x0a, 331}, /* 0x35 */ - {0xf3, 0x09, 332}, /* 0x36 */ - {0xea, 0x08, 340}, /* 0x37 */ - {0xe8, 0x07, 376}, /* 0x38 */ - {0xde, 0x06, 389}, /* 0x39 */ - {0x52, 0x2a, 54}, /* 0x3a */ - {0x52, 0x6a, 27}, /* 0x3b */ - {0x62, 0x24, 70}, /* 0x3c */ - {0x62, 0x64, 70}, /* 0x3d */ - {0xa8, 0x4c, 30}, /* 0x3e */ - {0x20, 0x26, 33}, /* 0x3f */ - {0x31, 0xc2, 39} /* 0x40 */ -}; - -typedef struct _SiS310_VBVCLKDataStruct { - UCHAR Part4_A, Part4_B; + +SiS310_VCLKDataStruct SiS310_VCLKData[]= +{ + { 0x1b,0xe1, 25}, /* 0x0 */ /* 650/LVDS BIOS: @ 0x5647 */ + { 0x4e,0xe4, 28}, /* 0x1 */ + { 0x57,0xe4, 31}, /* 0x2 */ + { 0xc3,0xc8, 36}, /* 0x3 */ + { 0x42,0xe2, 40}, /* 0x4 */ + { 0xfe,0xcd, 43}, /* 0x5 */ + { 0x5d,0xc4, 44}, /* 0x6 */ + { 0x52,0xe2, 49}, /* 0x7 */ + { 0x53,0xe2, 50}, /* 0x8 */ + { 0x74,0x67, 52}, /* 0x9 */ + { 0x6d,0x66, 56}, /* 0xa */ + { 0x5a,0x64, 65}, /* 0xb */ /* TW: was 6c c3 - WRONG */ + { 0x46,0x44, 67}, /* 0xc */ + { 0xb1,0x46, 68}, /* 0xd */ + { 0xd3,0x4a, 72}, /* 0xe */ + { 0x29,0x61, 75}, /* 0xf */ + { 0x6e,0x46, 76}, /* 0x10 */ + { 0x2b,0x61, 78}, /* 0x11 */ + { 0x31,0x42, 79}, /* 0x12 */ + { 0xab,0x44, 83}, /* 0x13 */ + { 0x46,0x25, 84}, /* 0x14 */ + { 0x78,0x29, 86}, /* 0x15 */ + { 0x62,0x44, 94}, /* 0x16 */ + { 0x2b,0x41,104}, /* 0x17 */ + { 0x3a,0x23,105}, /* 0x18 */ + { 0x70,0x44,108}, /* 0x19 */ + { 0x3c,0x23,109}, /* 0x1a */ + { 0x5e,0x43,113}, /* 0x1b */ + { 0xbc,0x44,116}, /* 0x1c */ + { 0xe0,0x46,132}, /* 0x1d */ + { 0x54,0x42,135}, /* 0x1e */ + { 0xea,0x2a,139}, /* 0x1f */ + { 0x41,0x22,157}, /* 0x20 */ + { 0x70,0x24,162}, /* 0x21 */ + { 0x30,0x21,175}, /* 0x22 */ + { 0x4e,0x22,189}, /* 0x23 */ + { 0xde,0x26,194}, /* 0x24 */ + { 0x62,0x06,202}, /* 0x25 */ + { 0x3f,0x03,229}, /* 0x26 */ + { 0xb8,0x06,234}, /* 0x27 */ + { 0x34,0x02,253}, /* 0x28 */ + { 0x58,0x04,255}, /* 0x29 */ + { 0x24,0x01,265}, /* 0x2a */ + { 0x9b,0x02,267}, /* 0x2b */ + { 0x70,0x05,270}, /* 0x2c */ + { 0x25,0x01,272}, /* 0x2d */ + { 0x9c,0x02,277}, /* 0x2e */ + { 0x27,0x01,286}, /* 0x2f */ + { 0x3c,0x02,291}, /* 0x30 */ + { 0xef,0x0a,292}, /* 0x31 */ + { 0xf6,0x0a,310}, /* 0x32 */ + { 0x95,0x01,315}, /* 0x33 */ + { 0xf0,0x09,324}, /* 0x34 */ + { 0xfe,0x0a,331}, /* 0x35 */ + { 0xf3,0x09,332}, /* 0x36 */ + { 0xea,0x08,340}, /* 0x37 */ + { 0xe8,0x07,376}, /* 0x38 */ + { 0xde,0x06,389}, /* 0x39 */ + { 0x52,0x2a, 54}, /* 0x3a */ + { 0x52,0x6a, 27}, /* 0x3b */ + { 0x62,0x24, 70}, /* 0x3c */ + { 0x62,0x64, 70}, /* 0x3d */ + { 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 */ + { 0x97,0x2c, 26}, /* 0x44 */ + { 0x44,0xe4, 25}, /* 0x45 */ /* Chrontel */ + { 0x7e,0x32, 47}, /* 0x46 */ /* Chrontel */ + { 0x8a,0x24, 31}, /* 0x47 */ /* Chrontel */ + { 0x97,0x2c, 26}, /* 0x48 */ /* Chrontel */ + { 0xce,0x3c, 39}, /* 0x49 */ + { 0x52,0x4a, 36}, /* 0x4a */ /* Chrontel */ + { 0x34,0x61, 95}, /* 0x4b */ + { 0x78,0x27,108}, /* 0x4c - was 102 */ /* TW: Last entry in 650/301 BIOS */ + { 0x66,0x43,123}, /* 0x4d */ /* Modes 0x26-0x28 (1400x1050) */ + { 0x41,0x4e, 21}, /* 0x4e */ + { 0xa1,0x4a, 29}, /* 0x4f */ /* Chrontel */ + { 0x19,0x42, 42}, /* 0x50 */ + { 0x54,0x46, 58}, /* 0x51 */ /* Chrontel */ + { 0x25,0x42, 61}, /* 0x52 */ + { 0x44,0x44, 66}, /* 0x53 */ /* Chrontel */ + { 0x3a,0x62, 70} /* 0x54 */ /* Chrontel */ +}; + +typedef struct _SiS310_VBVCLKDataStruct +{ + UCHAR Part4_A,Part4_B; USHORT CLOCK; } SiS310_VBVCLKDataStruct; -SiS310_VBVCLKDataStruct SiS310_VBVCLKData[] = { - {0x1b, 0xe1, 25}, /* 0x0 */ - {0x4e, 0xe4, 28}, /* 0x1 */ - {0x57, 0xe4, 31}, /* 0x2 */ - {0xc3, 0xc8, 36}, /* 0x3 */ - {0x42, 0x47, 40}, /* 0x4 */ - {0xfe, 0xcd, 43}, /* 0x5 */ - {0x5d, 0xc4, 44}, /* 0x6 */ - {0x52, 0x47, 49}, /* 0x7 */ - {0x53, 0x47, 50}, /* 0x8 */ - {0x74, 0x67, 52}, /* 0x9 */ - {0x6d, 0x66, 56}, /* 0xa */ - {0x5a, 0x64, 65}, /* 0xb */ - {0x46, 0x44, 67}, /* 0xc */ - {0xb1, 0x46, 68}, /* 0xd */ - {0xd3, 0x4a, 72}, /* 0xe */ - {0x29, 0x61, 75}, /* 0xf */ - {0x6d, 0x46, 75}, /* 0x10 */ - {0x41, 0x43, 78}, /* 0x11 */ - {0x31, 0x42, 79}, /* 0x12 */ - {0xab, 0x44, 83}, /* 0x13 */ - {0x46, 0x25, 84}, /* 0x14 */ - {0x78, 0x29, 86}, /* 0x15 */ - {0x62, 0x44, 94}, /* 0x16 */ - {0x2b, 0x22, 104}, /* 0x17 */ - {0x49, 0x24, 105}, /* 0x18 */ - {0xf8, 0x2f, 108}, /* 0x19 */ - {0x3c, 0x23, 109}, /* 0x1a */ - {0x5e, 0x43, 113}, /* 0x1b */ - {0xbc, 0x44, 116}, /* 0x1c */ - {0xe0, 0x46, 132}, /* 0x1d */ - {0xd4, 0x28, 135}, /* 0x1e */ - {0xea, 0x2a, 139}, /* 0x1f */ - {0x41, 0x22, 157}, /* 0x20 */ - {0x70, 0x24, 162}, /* 0x21 */ - {0x30, 0x21, 175}, /* 0x22 */ - {0x4e, 0x22, 189}, /* 0x23 */ - {0xde, 0x26, 194}, /* 0x24 */ - {0x70, 0x07, 202}, /* 0x25 */ - {0x3f, 0x03, 229}, /* 0x26 */ - {0xb8, 0x06, 234}, /* 0x27 */ - {0x34, 0x02, 253}, /* 0x28 */ - {0x58, 0x04, 255}, /* 0x29 */ - {0x24, 0x01, 265}, /* 0x2a */ - {0x9b, 0x02, 267}, /* 0x2b */ - {0x70, 0x05, 270}, /* 0x2c */ - {0x25, 0x01, 272}, /* 0x2d */ - {0x9c, 0x02, 277}, /* 0x2e */ - {0x27, 0x01, 286}, /* 0x2f */ - {0x3c, 0x02, 291}, /* 0x30 */ - {0xef, 0x0a, 292}, /* 0x31 */ - {0xf6, 0x0a, 310}, /* 0x32 */ - {0x95, 0x01, 315}, /* 0x33 */ - {0xf0, 0x09, 324}, /* 0x34 */ - {0xfe, 0x0a, 331}, /* 0x35 */ - {0xf3, 0x09, 332}, /* 0x36 */ - {0xea, 0x08, 340}, /* 0x37 */ - {0xe8, 0x07, 376}, /* 0x38 */ - {0xde, 0x06, 389}, /* 0x39 */ - {0x52, 0x2a, 54}, /* 0x3a */ - {0x52, 0x6a, 27}, /* 0x3b */ - {0x62, 0x24, 70}, /* 0x3c */ - {0x62, 0x64, 70}, /* 0x3d */ - {0xa8, 0x4c, 30}, /* 0x3e */ - {0x20, 0x26, 33}, /* 0x3f */ - {0x31, 0xc2, 39} /* 0x40 */ -}; - -UCHAR SiS310_ScreenOffset[] = - { 0x14, 0x19, 0x20, 0x28, 0x32, 0x40, 0x50, 0x64, 0x78, 0x80, 0x2d, 0x35 }; - -typedef struct _SiS310_StResInfoStruct { + +SiS310_VBVCLKDataStruct SiS310_VBVCLKData[]= +{ + { 0x1b,0xe1, 25}, /* 0x0 */ /* 650/LVDS BIOS: @ 0x579c */ + { 0x4e,0xe4, 28}, /* 0x1 */ + { 0x57,0xe4, 31}, /* 0x2 */ + { 0xc3,0xc8, 36}, /* 0x3 */ + { 0x42,0x47, 40}, /* 0x4 */ + { 0xfe,0xcd, 43}, /* 0x5 */ + { 0x5d,0xc4, 44}, /* 0x6 */ + { 0x52,0x47, 49}, /* 0x7 */ + { 0x53,0x47, 50}, /* 0x8 */ + { 0x74,0x67, 52}, /* 0x9 */ + { 0x6d,0x66, 56}, /* 0xa */ + { 0x35,0x62, 65}, /* 0xb */ /* Was 0x5a,0x64 - 650/LVDS+301 bios: 35,62 */ + { 0x46,0x44, 67}, /* 0xc */ + { 0xb1,0x46, 68}, /* 0xd */ + { 0xd3,0x4a, 72}, /* 0xe */ + { 0x29,0x61, 75}, /* 0xf */ + { 0x6d,0x46, 75}, /* 0x10 */ + { 0x41,0x43, 78}, /* 0x11 */ + { 0x31,0x42, 79}, /* 0x12 */ + { 0xab,0x44, 83}, /* 0x13 */ + { 0x46,0x25, 84}, /* 0x14 */ + { 0x78,0x29, 86}, /* 0x15 */ + { 0x62,0x44, 94}, /* 0x16 */ + { 0x2b,0x22,104}, /* 0x17 */ + { 0x49,0x24,105}, /* 0x18 */ + { 0xf8,0x2f,108}, /* 0x19 */ + { 0x3c,0x23,109}, /* 0x1a */ + { 0x5e,0x43,113}, /* 0x1b */ + { 0xbc,0x44,116}, /* 0x1c */ + { 0xe0,0x46,132}, /* 0x1d */ + { 0xd4,0x28,135}, /* 0x1e */ + { 0xea,0x2a,139}, /* 0x1f */ + { 0x41,0x22,157}, /* 0x20 */ + { 0x70,0x24,162}, /* 0x21 */ + { 0x30,0x21,175}, /* 0x22 */ + { 0x4e,0x22,189}, /* 0x23 */ + { 0xde,0x26,194}, /* 0x24 */ + { 0x70,0x07,202}, /* 0x25 */ + { 0x3f,0x03,229}, /* 0x26 */ + { 0xb8,0x06,234}, /* 0x27 */ + { 0x34,0x02,253}, /* 0x28 */ + { 0x58,0x04,255}, /* 0x29 */ + { 0x24,0x01,265}, /* 0x2a */ + { 0x9b,0x02,267}, /* 0x2b */ + { 0x70,0x05,270}, /* 0x2c */ + { 0x25,0x01,272}, /* 0x2d */ + { 0x9c,0x02,277}, /* 0x2e */ + { 0x27,0x01,286}, /* 0x2f */ + { 0x3c,0x02,291}, /* 0x30 */ + { 0xef,0x0a,292}, /* 0x31 */ + { 0xf6,0x0a,310}, /* 0x32 */ + { 0x95,0x01,315}, /* 0x33 */ + { 0xf0,0x09,324}, /* 0x34 */ + { 0xfe,0x0a,331}, /* 0x35 */ + { 0xf3,0x09,332}, /* 0x36 */ + { 0xea,0x08,340}, /* 0x37 */ + { 0xe8,0x07,376}, /* 0x38 */ + { 0xde,0x06,389}, /* 0x39 */ + { 0x52,0x2a, 54}, /* 0x3a */ + { 0x52,0x6a, 27}, /* 0x3b */ + { 0x62,0x24, 70}, /* 0x3c */ + { 0x62,0x64, 70}, /* 0x3d */ + { 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 */ + +typedef struct _SiS310_StResInfoStruct +{ USHORT HTotal; USHORT VTotal; } SiS310_StResInfoStruct; -SiS310_StResInfoStruct SiS310_StResInfo[] = { - {640, 400}, - {640, 350}, - {720, 400}, - {720, 350}, - {640, 480} + +SiS310_StResInfoStruct SiS310_StResInfo[]= +{ + { 640,400}, + { 640,350}, + { 720,400}, + { 720,350}, + { 640,480} }; -typedef struct _SiS310_ModeResInfoStruct { +typedef struct _SiS310_ModeResInfoStruct +{ USHORT HTotal; USHORT VTotal; - UCHAR XChar; - UCHAR YChar; + UCHAR XChar; + UCHAR YChar; } SiS310_ModeResInfoStruct; -SiS310_ModeResInfoStruct SiS310_ModeResInfo[] = { - {320, 200, 8, 8}, - {320, 240, 8, 8}, - {320, 400, 8, 8}, - {400, 300, 8, 8}, - {512, 384, 8, 8}, - {640, 400, 8, 16}, - {640, 480, 8, 16}, - {800, 600, 8, 16}, - {1024, 768, 8, 16}, - {1280, 1024, 8, 16}, - {1600, 1200, 8, 16}, - {1920, 1440, 8, 16}, - {2048, 1536, 8, 16}, - {720, 480, 8, 16}, - {720, 576, 8, 16}, - {1280, 960, 8, 16}, - {800, 480, 8, 16}, - {1024, 576, 8, 16}, - {1280, 720, 8, 16} + +SiS310_ModeResInfoStruct SiS310_ModeResInfo[]= +{ + { 320, 200, 8, 8}, /* 0x00 */ + { 320, 240, 8, 8}, /* 0x01 */ + { 320, 400, 8, 8}, /* 0x02 */ + { 400, 300, 8, 8}, /* 0x03 */ + { 512, 384, 8, 8}, /* 0x04 */ + { 640, 400, 8,16}, /* 0x05 */ + { 640, 480, 8,16}, /* 0x06 */ + { 800, 600, 8,16}, /* 0x07 */ + { 1024, 768, 8,16}, /* 0x08 */ + { 1280,1024, 8,16}, /* 0x09 */ + { 1600,1200, 8,16}, /* 0x0a */ + { 1920,1440, 8,16}, /* 0x0b */ + { 2048,1536, 8,16}, /* 0x0c */ + { 720, 480, 8,16}, /* 0x0d */ + { 720, 576, 8,16}, /* 0x0e */ + { 1280, 960, 8,16}, /* 0x0f */ + { 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 */ }; UCHAR SiS310_OutputSelect = 0x40; -UCHAR SiS310_SoftSetting = 30; + +UCHAR SiS310_SoftSetting = 0x30; /* TW: RAM setting */ + UCHAR SiS310_SR07 = 0x18; -UCHAR SiS310_SR15[8][4] = { - {0x0, 0x4, 0x60, 0x60}, - {0xf, 0xf, 0xf, 0xf}, - {0xba, 0xba, 0xba, 0xba}, - {0xa9, 0xa9, 0xac, 0xac}, - {0xa0, 0xa0, 0xa0, 0xa8}, - {0x0, 0x0, 0x2, 0x2}, - {0x30, 0x30, 0x40, 0x40}, - {0x0, 0xa5, 0xfb, 0xf6} -}; -UCHAR SiS310_CR40[5][4] = { - {0x77, 0x77, 0x33, 0x33}, - {0x77, 0x77, 0x33, 0x33}, - {0x0, 0x0, 0x0, 0x0}, - {0x5b, 0x5b, 0x3, 0x3}, - {0x0, 0x0, 0xf0, 0xf8} -}; -UCHAR SiS310_CR49[] = { 0xaa, 0x88 }; + +UCHAR SiS310_SR15[8][4]={ + {0x00,0x04,0x60,0x60}, + {0x0f,0x0f,0x0f,0x0f}, + {0xba,0xba,0xba,0xba}, + {0xa9,0xa9,0xac,0xac}, + {0xa0,0xa0,0xa0,0xa8}, + {0x00,0x00,0x02,0x02}, + {0x30,0x30,0x40,0x40}, + {0x00,0xa5,0xfb,0xf6} +}; + +UCHAR SiS310_CR40[5][4]={ + {0x77,0x77,0x33,0x33}, + {0x77,0x77,0x33,0x33}, + {0x00,0x00,0x00,0x00}, + {0x5b,0x5b,0x03,0x03}, + {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 = 0x0; +UCHAR SiS310_SR25[] = {0x33,0x3}; +UCHAR SiS310_SR31 = 0x00; UCHAR SiS310_SR32 = 0x11; -UCHAR SiS310_SR33 = 0x0; -UCHAR SiS310_CRT2Data_1_2 = 0x0; -UCHAR SiS310_CRT2Data_4_D = 0x0; -UCHAR SiS310_CRT2Data_4_E = 0x0; +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_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, 0x8a, 0x8 }; -UCHAR SiS310_PALPhase[] = { 0x2a, 0x5, 0xd3, 0x0 }; -UCHAR SiS310_NTSCPhase2[] = { 0x21, 0xF0, 0x7B, 0xD6 }; /*301b */ -UCHAR SiS310_PALPhase2[] = { 0x2a, 0x09, 0x86, 0xe9 }; -UCHAR SiS310_PALMPhase[] = { 0x21, 0xE4, 0x2E, 0x9B }; /*palmn */ -UCHAR SiS310_PALNPhase[] = { 0x21, 0xF4, 0x3E, 0xBA }; - -typedef struct _SiS310_LCDDataStruct { +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*/ + +typedef struct _SiS310_LCDDataStruct +{ USHORT RVBHCMAX; USHORT RVBHCFACT; USHORT VGAHT; @@ -1147,99 +1238,132 @@ typedef struct _SiS310_LCDDataStruct { USHORT LCDHT; USHORT LCDVT; } SiS310_LCDDataStruct; -SiS310_LCDDataStruct SiS310_StLCD1024x768Data[] = { - {62, 25, 800, 546, 1344, 806}, - {32, 15, 930, 546, 1344, 806}, - {32, 15, 930, 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_ExtLCD1024x768Data[] = { - {12, 5, 896, 512, 1344, 806}, - {12, 5, 896, 510, 1344, 806}, - {32, 15, 1008, 505, 1344, 806}, - {32, 15, 1008, 514, 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} -}; - -SiS310_LCDDataStruct SiS310_St2LCD1024x768Data[] = { - {62, 25, 800, 546, 1344, 806}, - {32, 15, 930, 546, 1344, 806}, - {32, 15, 930, 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[] = { - {22, 5, 800, 510, 1650, 1088}, - {22, 5, 800, 510, 1650, 1088}, - {176, 45, 900, 510, 1650, 1088}, - {176, 45, 900, 510, 1650, 1088}, - {22, 5, 800, 510, 1650, 1088}, - {13, 5, 1024, 675, 1560, 1152}, - {16, 9, 1266, 804, 1688, 1072}, - {1, 1, 1688, 1066, 1688, 1066} -}; - -SiS310_LCDDataStruct SiS310_ExtLCD1280x1024Data[] = { - {211, 60, 1024, 501, 1688, 1066}, - {211, 60, 1024, 508, 1688, 1066}, - {211, 60, 1024, 501, 1688, 1066}, - {211, 60, 1024, 508, 1688, 1066}, - {211, 60, 1024, 500, 1688, 1066}, - {211, 75, 1024, 625, 1688, 1066}, - {211, 120, 1280, 798, 1688, 1066}, - {1, 1, 1688, 1066, 1688, 1066} -}; - -SiS310_LCDDataStruct SiS310_St2LCD1280x1024Data[] = { - {22, 5, 800, 510, 1650, 1088}, - {22, 5, 800, 510, 1650, 1088}, - {176, 45, 900, 510, 1650, 1088}, - {176, 45, 900, 510, 1650, 1088}, - {22, 5, 800, 510, 1650, 1088}, - {13, 5, 1024, 675, 1560, 1152}, - {16, 9, 1266, 804, 1688, 1072}, - {1, 1, 1688, 1066, 1688, 1066} -}; - -SiS310_LCDDataStruct SiS310_NoScaleData[] = { - {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} -}; - -SiS310_LCDDataStruct SiS310_LCD1280x960Data[] = { - {9, 2, 800, 500, 1800, 1000}, - {9, 2, 800, 500, 1800, 1000}, - {4, 1, 900, 500, 1800, 1000}, - {4, 1, 900, 500, 1800, 1000}, - {9, 2, 800, 500, 1800, 1000}, - {30, 11, 1056, 625, 1800, 1000}, - {5, 3, 1350, 800, 1800, 1000}, - {1, 1, 1576, 1050, 1576, 1050}, - {1, 1, 1800, 1000, 1800, 1000} -}; - -typedef struct _SiS310_TVDataStruct { + +SiS310_LCDDataStruct SiS310_StLCD1024x768Data[]= +{ + { 62, 25, 800, 546,1344, 806}, + { 32, 15, 930, 546,1344, 806}, + { 32, 15, 930, 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_ExtLCD1024x768Data[] = /* TW: Checked */ +{ + { 12, 5, 896, 512,1344, 806}, + { 12, 5, 896, 510,1344, 806}, + { 32, 15,1008, 505,1344, 806}, + { 32, 15,1008, 514,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} +}; + +SiS310_LCDDataStruct SiS310_St2LCD1024x768Data[] = /* TW: Checked */ +{ + { 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 */ + { 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[] = +{ + { 22, 5, 800, 510,1650,1088}, + { 22, 5, 800, 510,1650,1088}, + { 176, 45, 900, 510,1650,1088}, + { 176, 45, 900, 510,1650,1088}, + { 22, 5, 800, 510,1650,1088}, + { 13, 5,1024, 675,1560,1152}, + { 16, 9,1266, 804,1688,1072}, + { 1, 1,1688,1066,1688,1066} +}; + +SiS310_LCDDataStruct SiS310_ExtLCD1280x1024Data[] = /* TW: Checked */ +{ + { 211, 60,1024, 501,1688,1066}, + { 211, 60,1024, 508,1688,1066}, + { 211, 60,1024, 501,1688,1066}, + { 211, 60,1024, 508,1688,1066}, + { 211, 60,1024, 500,1688,1066}, + { 211, 75,1024, 625,1688,1066}, + { 211, 120,1280, 798,1688,1066}, + { 1, 1,1688,1066,1688,1066} +}; + +SiS310_LCDDataStruct SiS310_St2LCD1280x1024Data[] = +{ + { 22, 5, 800, 510,1650,1088}, + { 22, 5, 800, 510,1650,1088}, + { 176, 45, 900, 510,1650,1088}, + { 176, 45, 900, 510,1650,1088}, + { 22, 5, 800, 510,1650,1088}, + { 13, 5,1024, 675,1560,1152}, + { 16, 9,1266, 804,1688,1072}, + { 1, 1,1688,1066,1688,1066} +}; + +SiS310_LCDDataStruct SiS310_NoScaleData1024x768[] = /* TW: Checked */ +{ + { 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}, + { 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 */ +{ + { 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} +}; + +SiS310_LCDDataStruct SiS310_LCD1280x960Data[] = +{ + { 9, 2, 800, 500,1800,1000}, + { 9, 2, 800, 500,1800,1000}, + { 4, 1, 900, 500,1800,1000}, + { 4, 1, 900, 500,1800,1000}, + { 9, 2, 800, 500,1800,1000}, + { 30, 11,1056, 625,1800,1000}, + { 5, 3,1350, 800,1800,1000}, + { 1, 1,1576,1050,1576,1050}, + { 1, 1,1800,1000,1800,1000} +}; + +typedef struct _SiS310_TVDataStruct +{ USHORT RVBHCMAX; USHORT RVBHCFACT; USHORT VGAHT; @@ -1254,1351 +1378,2259 @@ typedef struct _SiS310_TVDataStruct { UCHAR RY3COE; UCHAR RY4COE; } SiS310_TVDataStruct; -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}, - {1, 1, 864, 525, 1270, 400, 0, 0, 720, 0xf1, 0x04, 0x1f, 0x18}, - {1, 1, 864, 525, 1270, 350, 0, 0, 720, 0xf4, 0x0b, 0x1c, 0x0a}, - {1, 1, 864, 525, 1270, 480, 50, 0, 760, 0xf4, 0xff, 0x1c, 0x22}, - {1, 1, 864, 525, 1270, 600, 50, 0, 0, 0xf4, 0xff, 0x1c, 0x22} -}; -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 */ -}; - -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}, - {1, 1, 858, 525, 1270, 400, 0, 0, 720, 0xf1, 0x04, 0x1f, 0x18}, - {1, 1, 858, 525, 1270, 350, 0, 0, 720, 0xf4, 0x0b, 0x1c, 0x0a}, - {1, 1, 858, 525, 1270, 480, 0, 0, 760, 0xf1, 0x04, 0x1f, 0x18} -}; - -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 */ -}; - -SiS310_TVDataStruct SiS310_St1HiTVData[] = { - {0x00} +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}, + { 1, 1, 864, 525,1270, 400, 0, 0, 720,0xf1,0x04,0x1f,0x18}, + { 1, 1, 864, 525,1270, 350, 0, 0, 720,0xf4,0x0b,0x1c,0x0a}, + { 1, 1, 864, 525,1270, 480, 50, 0, 760,0xf4,0xff,0x1c,0x22}, + { 1, 1, 864, 525,1270, 600, 50, 0, 0,0xf4,0xff,0x1c,0x22} }; -SiS310_TVDataStruct SiS310_St2HiTVData[] = { - {0x00} +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*/ }; -SiS310_TVDataStruct SiS310_ExtHiTVData[] = { - {0x00} +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}, + { 1, 1, 858, 525,1270, 400, 0, 0, 720,0xf1,0x04,0x1f,0x18}, + { 1, 1, 858, 525,1270, 350, 0, 0, 720,0xf4,0x0b,0x1c,0x0a}, + { 1, 1, 858, 525,1270, 480, 0, 0, 760,0xf1,0x04,0x1f,0x18} }; -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, - 0x0c, 0x50, 0x00, 0x97, 0x00, 0xda, 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, 0x50, - 0x00, 0x40, 0x44, 0x00, 0xdb, 0x02, 0x3b, 0x00 +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*/ +}; + +/* TW: These tables will need data ! */ +SiS310_TVDataStruct SiS310_St1HiTVData[]= +{ + {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} }; -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, - 0x70, 0x50, 0x00, 0x9b, 0x00, 0xd9, 0x5d, 0x17, - 0x7d, 0x05, 0x45, 0x00, 0x00, 0xe8, 0x00, 0x02, - 0x0d, 0x00, 0x68, 0xb0, 0x0b, 0x92, 0x8f, 0x40, - 0x60, 0x80, 0x14, 0x90, 0x8c, 0x60, 0x14, 0x63, - 0x00, 0x40, 0x3e, 0x00, 0xe1, 0x02, 0x28, 0x00 +SiS310_TVDataStruct SiS310_St2HiTVData[]= +{ + {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} }; -UCHAR SiS310_HiTVExtTiming[] = { 0x00 }; - -UCHAR SiS310_HiTVSt1Timing[] = { 0x00 }; - -UCHAR SiS310_HiTVSt2Timing[] = { 0x00 }; - -UCHAR SiS310_HiTVTextTiming[] = { 0x00 }; - -UCHAR SiS310_HiTVGroup3Data[] = { 0x00 }; - -UCHAR SiS310_HiTVGroup3Simu[] = { 0x00 }; - -UCHAR SiS310_HiTVGroup3Text[] = { 0x00 }; - -typedef struct _SiS310_PanelDelayTblStruct { - UCHAR timer[2]; +SiS310_TVDataStruct SiS310_ExtHiTVData[]= +{ + {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} +}; + +UCHAR SiS310_NTSCTiming[] = { /* TW: New */ + 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, + 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 SiS310_PALTiming[] = { /* TW: New */ + 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, + 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 SiS310_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 SiS310_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 SiS310_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 SiS310_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 SiS310_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 SiS310_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 SiS310_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 _SiS310_PanelDelayTblStruct +{ + UCHAR timer[2]; } SiS310_PanelDelayTblStruct; -SiS310_PanelDelayTblStruct SiS310_PanelDelayTbl[] = { - {{0x00, 0x00}}, - {{0x00, 0x00}}, - {{0x00, 0x00}}, - {{0x00, 0x00}}, - {{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_LVDSDataStruct { + +SiS310_PanelDelayTblStruct SiS310_PanelDelayTbl[]= /* TW: New from 650/301LV BIOS */ +{ + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}} +}; + +SiS310_PanelDelayTblStruct SiS310_PanelDelayTblLVDS[]= +{ + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}} +}; + +typedef struct _SiS310_LVDSDataStruct +{ USHORT VGAHT; USHORT VGAVT; USHORT LCDHT; USHORT LCDVT; } SiS310_LVDSDataStruct; -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}, - {1056, 628, 1056, 628}, - {1056, 628, 1056, 628}, - {800, 449, 1000, 644}, - {800, 525, 1000, 635} -}; - -SiS310_LVDSDataStruct SiS310_LVDS800x600Data_2[] = { - {1056, 628, 1056, 628}, - {1056, 628, 1056, 628}, - {1056, 628, 1056, 628}, - {1056, 628, 1056, 628}, - {1056, 628, 1056, 628}, - {1056, 628, 1056, 628}, - {1056, 628, 1056, 628}, - {800, 449, 1000, 644}, - {800, 525, 1000, 635} -}; - -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}, - {1050, 638, 1344, 806}, - {1344, 806, 1344, 806}, - {800, 449, 1280, 801}, - {800, 525, 1280, 813} -}; - -SiS310_LVDSDataStruct SiS310_LVDS1024x768Data_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} -}; - -SiS310_LVDSDataStruct SiS310_LVDS1280x1024Data_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} -}; - -SiS310_LVDSDataStruct SiS310_LVDS1280x1024Data_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} -}; - -SiS310_LVDSDataStruct SiS310_LVDS640x480Data_1[] = { + +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} +}; + +SiS310_LVDSDataStruct SiS310_LVDS800x600Data_1[]= /* TW: New */ +{ + {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} +}; + +SiS310_LVDSDataStruct SiS310_LVDS800x600Data_2[]= /* TW: New */ +{ + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {800, 449,1000, 644}, + {800, 525,1000, 635} +}; + +SiS310_LVDSDataStruct SiS310_LVDS1024x768Data_1[]= /* TW: New */ +{ + {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} +}; + +SiS310_LVDSDataStruct SiS310_LVDS1024x768Data_2[]= /* TW: New */ +{ + {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} +}; + +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}, + {1050, 638,1344, 806}, + {1344, 806,1344, 806}, + {800, 449,1280, 801}, + {800, 525,1280, 813} +}; + +SiS310_LVDSDataStruct SiS310_LVDS1280x1024Data_2[]= /* TW: New */ +{ + {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} +}; + +SiS310_LVDSDataStruct SiS310_LVDS1400x1050Data_1[]= /* TW: New */ +{ + {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 */ +{ + {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}, +}; + +/* TW: New: - from 300 series */ +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} +}; + +/* TW: New: - from 300 series */ +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} +}; + +/* TW: New: - from 300 series */ +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} +}; + +/* TW: New: - from 300 series */ +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} +}; + +/* TW: New in 650/LVDS BIOS - resolution unknown */ +SiS310_LVDSDataStruct SiS310_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} +}; + +SiS310_LVDSDataStruct SiS310_LVDS640x480Data_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} + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628} }; -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} +SiS310_LVDSDataStruct SiS310_LVDS1280x960Data_1[]= /* 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}, + {800, 449,1280, 801}, + {800, 525,1280, 813} +}; + +SiS310_LVDSDataStruct SiS310_LVDS1280x960Data_2[]= /* TW: New */ +{ + {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} +}; + +SiS310_LVDSDataStruct SiS310_CHTVUNTSCData[]= /* TW: New */ +{ + { 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 */ }; -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} +SiS310_LVDSDataStruct SiS310_CHTVONTSCData[]= /* TW: New */ +{ + { 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 */ }; -SiS310_LVDSDataStruct SiS310_CHTVUPALData[] = { - {1008, 625, 1008, 625}, - {1008, 625, 1008, 625}, - {1008, 625, 1008, 625}, - {1008, 625, 1008, 625}, - {840, 750, 840, 750}, - {936, 836, 936, 836} +SiS310_LVDSDataStruct SiS310_CHTVUPALData[]= /* TW: New */ +{ + {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 */ }; -SiS310_LVDSDataStruct SiS310_CHTVOPALData[] = { - {1008, 625, 1008, 625}, - {1008, 625, 1008, 625}, - {1008, 625, 1008, 625}, - {1008, 625, 1008, 625}, - {840, 625, 840, 625}, - {960, 750, 960, 750} +SiS310_LVDSDataStruct SiS310_CHTVOPALData[]= /* TW: New */ +{ + {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 */ }; -typedef struct _SiS310_LVDSDesStruct { +typedef struct _SiS310_LVDSDesStruct +{ USHORT LCDHDES; USHORT LCDVDES; } SiS310_LVDSDesStruct; -SiS310_LVDSDesStruct SiS310_PanelType00_1[] = { - {0, 626}, - {0, 624}, - {0, 626}, - {0, 624}, - {0, 624}, - {0, 627}, - {0, 627}, - {0, 0}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_PanelType01_1[] = { - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - {0, 805}, - {0, 794}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_PanelType02_1[] = { - {0, 626}, - {0, 624}, - {0, 626}, - {0, 624}, - {0, 624}, - {0, 627}, - {0, 627}, - {0, 0}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_PanelType03_1[] = { - {8, 436}, - {8, 440}, - {8, 436}, - {8, 440}, - {8, 512}, - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794} + +/* TW: PanelType arrays taken from 650/LVDS BIOS 1.10.0 */ + +SiS310_LVDSDesStruct SiS310_PanelType00_1[]= /* TW: New */ +{ + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType01_1[]= /* TW: New */ +{ + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 805}, + { 0, 0}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType02_1[]= /* TW: New */ +{ + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 1065}, + { 0, 0}, + { 0, 0} }; -SiS310_LVDSDesStruct SiS310_PanelType04_1[] = { + +SiS310_LVDSDesStruct SiS310_PanelType03_1[]= /* TW: New */ +{ + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType04_1[]= /* TW: New */ +{ {1343, 798}, {1343, 794}, {1343, 798}, {1343, 794}, - {1343, 0}, - {1343, 0}, - {0, 805}, - {0, 794}, - {0, 0} + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} }; -SiS310_LVDSDesStruct SiS310_PanelType05_1[] = { +SiS310_LVDSDesStruct SiS310_PanelType05_1[]= /* TW: New */ +{ {1343, 798}, {1343, 794}, {1343, 798}, {1343, 794}, - {1343, 0}, - {1343, 0}, - {0, 805}, - {0, 794}, - {0, 0} + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} }; -SiS310_LVDSDesStruct SiS310_PanelType06_1[] = { +SiS310_LVDSDesStruct SiS310_PanelType06_1[]= /* TW: New */ +{ {1343, 798}, {1343, 794}, {1343, 798}, {1343, 794}, - {1343, 0}, - {1343, 0}, - {0, 805}, - {0, 794}, - {0, 0} + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} }; -SiS310_LVDSDesStruct SiS310_PanelType07_1[] = { +SiS310_LVDSDesStruct SiS310_PanelType07_1[]= /* TW: New */ +{ {1343, 798}, {1343, 794}, {1343, 798}, {1343, 794}, - {1343, 0}, - {1343, 0}, - {0, 805}, - {0, 794}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_PanelType08_1[] = { - {1059, 626}, - {1059, 624}, - {1059, 626}, - {1059, 624}, - {1059, 624}, - {0, 627}, - {0, 627}, - {0, 0}, - {0, 0} + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} }; -SiS310_LVDSDesStruct SiS310_PanelType09_1[] = { - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - {0, 805}, - {0, 794}, - {0, 0} +SiS310_LVDSDesStruct SiS310_PanelType08_1[]= /* TW: New */ +{ + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType09_1[]= /* TW: New */ +{ + { 0, 448}, + { 0, 448}, + { 0, 448}, + { 0, 448}, + { 0, 524}, + { 0, 627}, + { 0, 805}, + { 0, 805}, }; -SiS310_LVDSDesStruct SiS310_PanelType0a_1[] = { +SiS310_LVDSDesStruct SiS310_PanelType0a_1[]= /* TW: New */ +{ {1059, 626}, {1059, 624}, {1059, 626}, {1059, 624}, {1059, 624}, - {0, 627}, - {0, 627}, - {0, 0}, - {0, 0} + { 0, 627}, + { 0, 627}, + { 0, 0}, + { 0, 0} }; -SiS310_LVDSDesStruct SiS310_PanelType0b_1[] = { +SiS310_LVDSDesStruct SiS310_PanelType0b_1[]= /* TW: New */ +{ {1343, 798}, {1343, 794}, {1343, 798}, {1343, 794}, - {1343, 0}, - {1343, 0}, - {0, 805}, - {0, 794}, - {0, 0} + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} }; -SiS310_LVDSDesStruct SiS310_PanelType0c_1[] = { +SiS310_LVDSDesStruct SiS310_PanelType0c_1[]= /* TW: New */ +{ {1343, 798}, {1343, 794}, {1343, 798}, {1343, 794}, - {1343, 0}, - {1343, 0}, - {0, 805}, - {0, 794}, - {0, 0} + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} }; -SiS310_LVDSDesStruct SiS310_PanelType0d_1[] = { +SiS310_LVDSDesStruct SiS310_PanelType0d_1[]= /* TW: New */ +{ {1343, 798}, {1343, 794}, {1343, 798}, {1343, 794}, - {1343, 0}, - {1343, 0}, - {0, 805}, - {0, 794}, - {0, 0} + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} }; -SiS310_LVDSDesStruct SiS310_PanelType0e_1[] = { +SiS310_LVDSDesStruct SiS310_PanelType0e_1[]= /* TW: New */ +{ {1343, 798}, {1343, 794}, {1343, 798}, {1343, 794}, - {1343, 0}, - {1343, 0}, - {0, 805}, - {0, 794}, - {0, 0} + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} }; -SiS310_LVDSDesStruct SiS310_PanelType0f_1[] = { +SiS310_LVDSDesStruct SiS310_PanelType0f_1[]= /* TW: New */ +{ {1343, 798}, {1343, 794}, {1343, 798}, {1343, 794}, - {1343, 0}, - {1343, 0}, - {0, 805}, - {0, 794}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_PanelType00_2[] = { - {976, 527}, - {976, 502}, - {976, 527}, - {976, 502}, - {976, 567}, - {0, 627}, - {0, 627}, - {0, 0}, - {0, 0} + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} }; -SiS310_LVDSDesStruct SiS310_PanelType01_2[] = { - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - {0, 805}, - {0, 794}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_PanelType02_2[] = { - {976, 527}, - {976, 502}, - {976, 527}, - {976, 502}, - {976, 567}, - {0, 627}, - {0, 627}, - {0, 0}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_PanelType03_2[] = { +SiS310_LVDSDesStruct SiS310_PanelType00_2[]= /* TW: New */ +{ + {980, 528}, + {980, 503}, + {980, 528}, + {980, 503}, + {980, 568}, + { 0, 628}, + { 0, 0}, + { 0, 0}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType01_2[]= /* TW: New */ +{ {1152, 622}, {1152, 597}, {1152, 622}, {1152, 597}, {1152, 662}, {1232, 722}, - {0, 805}, - {1152, 622}, - {1152, 597} + { 0, 806}, + { 0, 0}, + { 0, 0} }; -SiS310_LVDSDesStruct SiS310_PanelType04_2[] = { - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - {0, 805}, - {0, 794}, - {0, 0} +SiS310_LVDSDesStruct SiS310_PanelType02_2[]= /* TW: New */ +{ + {1368, 754}, + {1368, 729}, + {1368, 754}, + {1368, 729}, + {1368, 794}, + {1448, 854}, + {1560, 938}, + { 0,1066}, + { 0, 0}, + { 0, 0}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType03_2[]= /* TW: New */ +{ + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0} }; -SiS310_LVDSDesStruct SiS310_PanelType05_2[] = { +SiS310_LVDSDesStruct SiS310_PanelType04_2[]= /* TW: New */ +{ + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType05_2[]= /* TW: New */ +{ {1152, 622}, {1152, 597}, {1152, 622}, {1152, 597}, {1152, 662}, {1232, 722}, - {0, 805}, - {0, 794}, - {0, 0} + { 0, 805}, + { 0, 794}, + { 0, 0} }; -SiS310_LVDSDesStruct SiS310_PanelType06_2[] = { +SiS310_LVDSDesStruct SiS310_PanelType06_2[]= /* TW: New */ +{ {1152, 622}, {1152, 597}, {1152, 622}, {1152, 597}, {1152, 662}, {1232, 722}, - {0, 805}, - {0, 794}, - {0, 0} + { 0, 805}, + { 0, 794}, + { 0, 0} }; -SiS310_LVDSDesStruct SiS310_PanelType07_2[] = { +SiS310_LVDSDesStruct SiS310_PanelType07_2[]= /* TW: New */ +{ {1152, 622}, {1152, 597}, {1152, 622}, {1152, 597}, {1152, 662}, {1232, 722}, - {0, 805}, - {0, 794}, - {0, 0} + { 0, 805}, + { 0, 794}, + { 0, 0} }; -SiS310_LVDSDesStruct SiS310_PanelType08_2[] = { +SiS310_LVDSDesStruct SiS310_PanelType08_2[]= /* TW: New */ +{ {976, 527}, {976, 502}, {976, 527}, {976, 502}, {976, 567}, - {0, 627}, - {0, 627}, - {0, 0}, - {0, 0} + { 0, 627}, + { 0, 627}, + { 0, 0}, + { 0, 0} }; -SiS310_LVDSDesStruct SiS310_PanelType09_2[] = { - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - {0, 805}, - {0, 794}, - {0, 0} +SiS310_LVDSDesStruct SiS310_PanelType09_2[]= /* TW: New */ +{ + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0} }; -SiS310_LVDSDesStruct SiS310_PanelType0a_2[] = { +SiS310_LVDSDesStruct SiS310_PanelType0a_2[]= /* TW: New */ +{ {976, 527}, {976, 502}, {976, 527}, {976, 502}, {976, 567}, - {0, 627}, - {0, 627}, - {0, 0}, - {0, 0} + { 0, 627}, + { 0, 627}, + { 0, 0}, + { 0, 0} }; -SiS310_LVDSDesStruct SiS310_PanelType0b_2[] = { +SiS310_LVDSDesStruct SiS310_PanelType0b_2[]= /* TW: New */ +{ {1152, 622}, {1152, 597}, {1152, 622}, {1152, 597}, {1152, 662}, {1232, 722}, - {0, 805}, - {0, 794}, - {0, 0} + { 0, 805}, + { 0, 794}, + { 0, 0} }; -SiS310_LVDSDesStruct SiS310_PanelType0c_2[] = { +SiS310_LVDSDesStruct SiS310_PanelType0c_2[]= /* TW: New */ +{ {1152, 622}, {1152, 597}, {1152, 622}, {1152, 597}, {1152, 662}, {1232, 722}, - {0, 805}, - {0, 794}, - {0, 0} + { 0, 805}, + { 0, 794}, + { 0, 0} }; -SiS310_LVDSDesStruct SiS310_PanelType0d_2[] = { +SiS310_LVDSDesStruct SiS310_PanelType0d_2[]= /* TW: New */ +{ {1152, 622}, {1152, 597}, {1152, 622}, {1152, 597}, {1152, 662}, {1232, 722}, - {0, 805}, - {0, 794}, - {0, 0} + { 0, 805}, + { 0, 794}, + { 0, 0} }; -SiS310_LVDSDesStruct SiS310_PanelType0e_2[] = { +SiS310_LVDSDesStruct SiS310_PanelType0e_2[]= /* TW: New */ +{ {1152, 622}, {1152, 597}, {1152, 622}, {1152, 597}, {1152, 662}, {1232, 722}, - {0, 805}, - {0, 794}, - {0, 0} + { 0, 805}, + { 0, 794}, + { 0, 0} }; -SiS310_LVDSDesStruct SiS310_PanelType0f_2[] = { +SiS310_LVDSDesStruct SiS310_PanelType0f_2[] = /* TW: New */ +{ {1152, 622}, {1152, 597}, {1152, 622}, {1152, 597}, {1152, 662}, {1232, 722}, - {0, 805}, - {0, 794}, - {0, 0} -}; -/*301b*/ -SiS310_LVDSDesStruct SiS310_PanelType1076_1[] = { - {0x00, 0x00} -}; -SiS310_LVDSDesStruct SiS310_PanelType1210_1[] = { - {0x00, 0x00} -}; -SiS310_LVDSDesStruct SiS310_PanelType1296_1[] = { - {0x00, 0x00} -}; -SiS310_LVDSDesStruct SiS310_PanelType1076_2[] = { - {0x00, 0x00} -}; -SiS310_LVDSDesStruct SiS310_PanelType1210_2[] = { - {0x00, 0x00} -}; -SiS310_LVDSDesStruct SiS310_PanelType1296_2[] = { - {0x00, 0x00} -}; -/*end 301b*/ - -SiS310_LVDSDesStruct SiS310_CHTVUNTSCDesData[] = { - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0} + { 0, 805}, + { 0, 794}, + { 0, 0} }; -SiS310_LVDSDesStruct SiS310_CHTVONTSCDesData[] = { - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_CHTVUPALDesData[] = { - {256, 0}, - {256, 0}, - {256, 0}, - {256, 0}, - {0, 0}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_CHTVOPALDesData[] = { - {256, 0}, - {256, 0}, - {256, 0}, - {256, 0}, - {0, 0}, - {0, 0} +SiS310_LVDSDesStruct SiS310_PanelType1076_1[]= /* TW: New */ +{ + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType1076_2[]= /* TW: New */ +{ + { 1152, 622 }, + { 1152, 597 }, + { 1152, 622 }, + { 1152, 597 }, + { 1152, 622 }, + { 1232, 722 }, + { 0, 0 }, + { 0, 794 }, + { 0, 0 } +}; + +SiS310_LVDSDesStruct SiS310_PanelType1210_1[]= /* TW: New */ +{ + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType1210_2[]= /* TW: New */ +{ + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType1296_1[]= /* TW: New */ +{ + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType1296_2[]= /* TW: New */ +{ + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0} +}; + +SiS310_LVDSDesStruct SiS310_CHTVUNTSCDesData[]= +{ + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0} }; -/*add for LCDA*/ -typedef struct _SiS310_LCDACRT1DataStruct { - UCHAR CR[17]; -} SiS310_LCDACRT1DataStruct; -SiS310_LCDACRT1DataStruct SiS310_LCDACRT1800x600_1[] = { - {{0x65, 0x4f, 0x89, 0x56, 0x83, 0xaf, 0x1f, - 0x90, 0x85, 0x8f, 0xab, 0x30, 0x00, 0x05, - 0x00}}, - {{0x65, 0x4f, 0x89, 0x56, 0x83, 0x83, 0x1f, - 0x5e, 0x83, 0x5d, 0x79, 0x10, 0x00, 0x05, - 0x00}}, - {{0x65, 0x4f, 0x89, 0x56, 0x83, 0xaf, 0x1f, - 0x90, 0x85, 0x8f, 0xab, 0x30, 0x00, 0x05, - 0x00}}, - {{0x65, 0x4f, 0x89, 0x56, 0x83, 0x83, 0x1f, - 0x5e, 0x83, 0x5d, 0x79, 0x10, 0x00, 0x05, - 0x00}}, - {{0x65, 0x4f, 0x89, 0x56, 0x83, 0x04, 0x3e, - 0xe0, 0x85, 0xdf, 0xfb, 0x10, 0x00, 0x05, - 0x00}}, - {{0x7f, 0x63, 0x83, 0x6c, 0x1c, 0x72, 0xf0, - 0x58, 0x8c, 0x57, 0x73, 0x20, 0x00, 0x06, - 0x01}} +SiS310_LVDSDesStruct SiS310_CHTVONTSCDesData[]= +{ + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0} }; -SiS310_LCDACRT1DataStruct SiS310_LCDACRT11024x768_1[] = { - {{0x73, 0x4f, 0x4f, 0x97, 0x55, 0x86, 0xc4, 0x1f, - 0x92, 0x89, 0x8f, 0x8f, 0xb5, 0x30, 0x00, 0x05, - 0x00}}, - {{0x73, 0x4f, 0x4f, 0x97, 0x55, 0x86, 0x97, 0x1f, - 0x60, 0x87, 0x5d, 0x5d, 0x83, 0x10, 0x00, 0x05, - 0x00}}, - {{0x73, 0x4f, 0x4f, 0x97, 0x55, 0x86, 0xc4, 0x1f, - 0x92, 0x89, 0x8f, 0x8f, 0xb5, 0x30, 0x00, 0x05, - 0x00}}, - {{0x73, 0x4f, 0x4f, 0x97, 0x55, 0x86, 0x97, 0x1f, - 0x60, 0x87, 0x5d, 0x5d, 0x83, 0x10, 0x00, 0x05, - 0x00}}, - {{0x73, 0x4f, 0x4f, 0x97, 0x55, 0x86, 0x04, 0x3e, - 0xE2, 0x89, 0xDf, 0xDf, 0x05, 0x00, 0x00, 0x05, - 0x00}}, - {{0x87, 0x63, 0x63, 0x8B, 0x69, 0x1A, 0x7c, 0xf0, - 0x5A, 0x8F, 0x57, 0x57, 0x7D, 0x20, 0x00, 0x26, - 0x01}}, - {{0xA3, 0x7f, 0x7f, 0x87, 0x86, 0x97, 0x24, 0xf5, - 0x02, 0x88, 0xFf, 0xFf, 0x25, 0x10, 0x00, 0x02, - 0x01}} +SiS310_LVDSDesStruct SiS310_CHTVUPALDesData[]= +{ + {256, 0}, + {256, 0}, + {256, 0}, + {256, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0} }; -SiS310_LCDACRT1DataStruct SiS310_LCDACRT11280x1024_1[] = { - {{0x63, 0x4f, 0x87, 0x54, 0x9f, 0xb4, 0x1f, - 0x92, 0x89, 0x8f, 0xb5, 0x30, 0x00, 0x01, - 0x00}}, - {{0x63, 0x4f, 0x87, 0x54, 0x9f, 0x82, 0x1f, - 0x60, 0x87, 0x5d, 0x83, 0x10, 0x00, 0x01, - 0x00}}, - {{0x63, 0x4f, 0x87, 0x54, 0x9f, 0xb4, 0x1f, - 0x92, 0x89, 0x8f, 0xb5, 0x30, 0x00, 0x01, - 0x00}}, - {{0x63, 0x4f, 0x87, 0x54, 0x9f, 0x82, 0x1f, - 0x60, 0x87, 0x5d, 0x83, 0x10, 0x00, 0x01, - 0x00}}, - {{0x63, 0x4f, 0x87, 0x54, 0x9f, 0x04, 0x3e, - 0xe2, 0x89, 0xdf, 0x05, 0x00, 0x00, 0x01, - 0x00}}, - {{0x7e, 0x63, 0x82, 0x68, 0x15, 0x7c, 0xf0, - 0x5a, 0x8f, 0x57, 0x7d, 0x20, 0x00, 0x26, - 0x01}}, - {{0xa3, 0x7f, 0x87, 0x86, 0x97, 0x24, 0xf5, - 0x02, 0x88, 0xff, 0x25, 0x10, 0x00, 0x02, - 0x01}} +SiS310_LVDSDesStruct SiS310_CHTVOPALDesData[]= +{ + {256, 0}, + {256, 0}, + {256, 0}, + {256, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0} }; -SiS310_LCDACRT1DataStruct SiS310_LCDACRT1800x600_1_H[] = { - {{0x30, 0x27, 0x94, 0x2c, 0x92, 0xaf, 0x1f, - 0x90, 0x85, 0x8f, 0xab, 0x30, 0x00, 0x04, - 0x00}}, - {{0x30, 0x27, 0x94, 0x2c, 0x92, 0x83, 0x1f, - 0x5e, 0x83, 0x5d, 0x79, 0x10, 0x00, 0x04, - 0x00}}, - {{0x30, 0x27, 0x94, 0x2c, 0x92, 0xaf, 0x1f, - 0x90, 0x85, 0x8f, 0xab, 0x30, 0x00, 0x04, - 0x00}}, - {{0x30, 0x27, 0x94, 0x2c, 0x92, 0x83, 0x1f, - 0x5e, 0x83, 0x5d, 0x79, 0x10, 0x00, 0x04, - 0x00}}, - {{0x30, 0x27, 0x94, 0x2c, 0x92, 0x04, 0x3e, - 0xe0, 0x85, 0xdf, 0xfb, 0x10, 0x00, 0x04, - 0x00}}, - {{0x3d, 0x31, 0x81, 0x37, 0x1f, 0x72, 0xf0, - 0x58, 0x8c, 0x57, 0x73, 0x20, 0x00, 0x05, - 0x01}} -}; +typedef struct _SiS310_Part2PortTblStruct +{ + UCHAR CR[12]; +} SiS310_Part2PortTblStruct; -SiS310_LCDACRT1DataStruct SiS310_LCDACRT11024x768_1_H[] = { - {{0x37, 0x27, 0x27, 0x9B, 0x2b, 0x94, 0xc4, 0x1f, - 0x92, 0x89, 0x8f, 0x8f, 0xb5, 0x30, 0x00, 0x44, - 0x00}}, - {{0x37, 0x27, 0x27, 0x9B, 0x2b, 0x94, 0x97, 0x1f, - 0x60, 0x87, 0x5D, 0x5D, 0x83, 0x01, 0x00, 0x44, - 0x00}}, - {{0x37, 0x27, 0x27, 0x9B, 0x2b, 0x94, 0xc4, 0x1f, - 0x92, 0x89, 0x8f, 0x8f, 0xb5, 0x30, 0x00, 0x44, - 0x00}}, - {{0x37, 0x27, 0x27, 0x9B, 0x2b, 0x94, 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, - 0x00}}, - {{0x41, 0x31, 0x31, 0x85, 0x35, 0x1d, 0x7c, 0xf0, - 0x5A, 0x8F, 0x57, 0x57, 0x7D, 0x20, 0x00, 0x55, - 0x01}}, - {{0x4f, 0x3F, 0x3F, 0x93, 0x45, 0x0D, 0x24, 0xf5, - 0x02, 0x88, 0xFf, 0xFf, 0x25, 0x10, 0x00, 0x01, - 0x01}} +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}}, + {{0x25,0x12,0xc9,0xdc,0xb6,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, + {{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_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, - 0x00}}, - {{0x2f, 0x27, 0x93, 0x2b, 0x90, 0x82, 0x1f, - 0x60, 0x87, 0x5d, 0x83, 0x10, 0x00, 0x04, - 0x00}}, - {{0x2f, 0x27, 0x93, 0x2b, 0x90, 0x04, 0x3e, - 0xe2, 0x89, 0xdf, 0x05, 0x00, 0x00, 0x04, - 0x00}}, - {{0x3c, 0x31, 0x80, 0x35, 0x1c, 0x7c, 0xf0, - 0x5a, 0x8f, 0x57, 0x7d, 0x20, 0x00, 0x55, - 0x01}}, - {{0x4f, 0x3f, 0x93, 0x45, 0x0d, 0x24, 0xf5, - 0x02, 0x88, 0xff, 0x25, 0x10, 0x00, 0x01, - 0x01}} +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_LCDACRT1DataStruct SiS310_LCDACRT1800x600_2[] = { - {{0x7f, 0x4f, 0x83, 0x62, 0x12, 0x72, 0x3e, - 0xf4, 0x88, 0x8f, 0x73, 0x20, 0x00, 0x06, - 0x00}}, - {{0x7f, 0x4f, 0x83, 0x62, 0x12, 0x72, 0x3e, - 0xdb, 0x8f, 0x5d, 0x73, 0x20, 0x00, 0x06, - 0x00}}, - {{0x7f, 0x4f, 0x83, 0x62, 0x12, 0x72, 0x3e, - 0xf4, 0x88, 0x8f, 0x73, 0x20, 0x00, 0x06, - 0x00}}, - {{0x7f, 0x4f, 0x83, 0x62, 0x12, 0x72, 0x3e, - 0xdb, 0x8f, 0x5d, 0x73, 0x20, 0x00, 0x06, - 0x00}}, - {{0x7f, 0x4f, 0x83, 0x62, 0x12, 0x72, 0xba, - 0x1c, 0x80, 0xdf, 0x73, 0x00, 0x00, 0x06, - 0x00}}, - {{0x7f, 0x63, 0x83, 0x6c, 0x1c, 0x72, 0xf0, - 0x58, 0x8c, 0x57, 0x73, 0x20, 0x00, 0x06, - 0x01}} +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}}, + {{0x25,0x12,0x51,0x6e,0x48,0x99,0x35,0x89,0x47,0xc1,0x49,0x33}}, + {{0x2c,0x12,0x38,0x55,0x2f,0xc1,0x35,0xb1,0x47,0xe9,0x71,0x33}}, + {{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}} }; -SiS310_LCDACRT1DataStruct SiS310_LCDACRT11024x768_2[] = { - {{0xa3, 0x4f, 0x87, 0x6e, 0x9f, 0x24, 0xbb, - 0x4a, 0x80, 0x8f, 0x25, 0x30, 0x00, 0x06, - 0x00}}, - {{0xa3, 0x4f, 0x87, 0x6e, 0x9f, 0x24, 0xbb, - 0x31, 0x87, 0x5d, 0x25, 0x30, 0x00, 0x06, - 0x00}}, - {{0xa3, 0x4f, 0x87, 0x6e, 0x9f, 0x24, 0xbb, - 0x4a, 0x80, 0x8f, 0x25, 0x30, 0x00, 0x06, - 0x00}}, - {{0xa3, 0x4f, 0x87, 0x6e, 0x9f, 0x24, 0xbb, - 0x31, 0x87, 0x5d, 0x25, 0x30, 0x00, 0x06, - 0x00}}, - {{0xa3, 0x4f, 0x87, 0x6e, 0x9f, 0x24, 0xbb, - 0x72, 0x88, 0xdf, 0x25, 0x30, 0x00, 0x06, - 0x00}}, - {{0xa3, 0x63, 0x87, 0x78, 0x89, 0x24, 0xf1, - 0xae, 0x84, 0x57, 0x25, 0x30, 0x00, 0x02, - 0x01}}, - {{0xa3, 0x7f, 0x87, 0x86, 0x97, 0x24, 0xf5, - 0x02, 0x88, 0xff, 0x25, 0x10, 0x00, 0x02, - 0x01}} +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}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, + {{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_LCDACRT11280x1024_2[] = { - {{0xa3, 0x4f, 0x87, 0x6e, 0x9f, 0x24, 0xbb, - 0x4a, 0x80, 0x8f, 0x25, 0x30, 0x00, 0x06, - 0x00}}, - {{0xa3, 0x4f, 0x87, 0x6e, 0x9f, 0x24, 0xbb, - 0x31, 0x87, 0x5d, 0x25, 0x30, 0x00, 0x06, - 0x00}}, - {{0xa3, 0x4f, 0x87, 0x6e, 0x9f, 0x24, 0xbb, - 0x4a, 0x80, 0x8f, 0x25, 0x30, 0x00, 0x06, - 0x00}}, - {{0xa3, 0x4f, 0x87, 0x6e, 0x9f, 0x24, 0xbb, - 0x31, 0x87, 0x5d, 0x25, 0x30, 0x00, 0x06, - 0x00}}, - {{0xa3, 0x4f, 0x87, 0x6e, 0x9f, 0x24, 0xbb, - 0x72, 0x88, 0xdf, 0x25, 0x30, 0x00, 0x06, - 0x00}}, - {{0xa3, 0x63, 0x87, 0x78, 0x89, 0x24, 0xf1, - 0xae, 0x84, 0x57, 0x25, 0x30, 0x00, 0x02, - 0x01}}, - {{0xa3, 0x7f, 0x87, 0x86, 0x97, 0x24, 0xf5, - 0x02, 0x88, 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, - 0x00}}, - {{0x3d, 0x27, 0x81, 0x32, 0x1a, 0x72, 0x3e, - 0xdb, 0x8f, 0x5d, 0x73, 0x20, 0x00, 0x05, - 0x00}}, - {{0x3d, 0x27, 0x81, 0x32, 0x1a, 0x72, 0x3e, - 0xf4, 0x88, 0x8f, 0x73, 0x20, 0x00, 0x05, - 0x00}}, - {{0x3d, 0x27, 0x81, 0x3a, 0x1a, 0x72, 0x3e, - 0xdb, 0x8f, 0x5d, 0x73, 0x20, 0x00, 0x05, - 0x00}}, - {{0x3d, 0x27, 0x81, 0x32, 0x1a, 0x72, 0xba, - 0x1c, 0x80, 0xdf, 0x73, 0x00, 0x00, 0x05, - 0x00}}, - {{0x3d, 0x31, 0x81, 0x37, 0x1f, 0x72, 0xf0, - 0x58, 0x8c, 0x57, 0x73, 0x20, 0x00, 0x05, - 0x01}} +SiS310_Part2PortTblStruct SiS310_CRT2Part2_1024x768_3[] = +{ + {{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}}, + {{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}} }; -SiS310_LCDACRT1DataStruct SiS310_LCDACRT11024x768_2_H[] = { - {{0x4f, 0x27, 0x93, 0x39, 0x01, 0x24, 0xbb, - 0x4a, 0x80, 0x8f, 0x25, 0x30, 0x00, 0x01, - 0x00}}, - {{0x4f, 0x27, 0x93, 0x39, 0x01, 0x24, 0xbb, - 0x31, 0x87, 0x5d, 0x25, 0x30, 0x00, 0x01, - 0x00}}, - {{0x4f, 0x27, 0x93, 0x39, 0x01, 0x24, 0xbb, - 0x4a, 0x80, 0x8f, 0x25, 0x30, 0x00, 0x01, - 0x00}}, - {{0x4f, 0x27, 0x93, 0x39, 0x01, 0x24, 0xbb, - 0x31, 0x87, 0x5d, 0x25, 0x30, 0x00, 0x01, - 0x00}}, - {{0x4f, 0x27, 0x93, 0x39, 0x01, 0x24, 0xbb, - 0x72, 0x88, 0xdf, 0x25, 0x30, 0x00, 0x01, - 0x00}}, - {{0x4f, 0x31, 0x93, 0x3e, 0x06, 0x24, 0xf1, - 0xae, 0x84, 0x57, 0x25, 0x30, 0x00, 0x01, - 0x01}}, - {{0x4f, 0x3f, 0x93, 0x45, 0x0d, 0x24, 0xf5, - 0x02, 0x88, 0xff, 0x25, 0x10, 0x00, 0x01, - 0x01}} +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}} }; -SiS310_LCDACRT1DataStruct SiS310_LCDACRT11280x1024_2_H[] = { - {{0x4f, 0x27, 0x93, 0x39, 0x81, 0x24, 0xbb, - 0x4a, 0x80, 0x8f, 0x25, 0x30, 0x00, 0x01, - 0x00}}, - {{0x4f, 0x27, 0x93, 0x39, 0x81, 0x24, 0xbb, - 0x31, 0x87, 0x5d, 0x25, 0x30, 0x00, 0x01, - 0x00}}, - {{0x4f, 0x27, 0x93, 0x39, 0x81, 0x24, 0xbb, - 0x4a, 0x80, 0x8f, 0x25, 0x30, 0x00, 0x01, - 0x00}}, - {{0x4f, 0x27, 0x93, 0x39, 0x81, 0x24, 0xbb, - 0x31, 0x87, 0x5d, 0x25, 0x30, 0x00, 0x01, - 0x00}}, - {{0x4f, 0x27, 0x93, 0x39, 0x81, 0x24, 0xbb, - 0x72, 0x88, 0xdf, 0x25, 0x30, 0x00, 0x01, - 0x00}}, - {{0x4f, 0x31, 0x93, 0x3e, 0x86, 0x24, 0xf1, - 0xae, 0x84, 0x57, 0x25, 0x30, 0x00, 0x01, - 0x01}}, - {{0x4f, 0x3f, 0x93, 0x45, 0x0d, 0x24, 0xf5, - 0x02, 0x88, 0xff, 0x25, 0x10, 0x00, 0x01, - 0x01}} -}; +/*add for LCDA*/ +typedef struct _SiS310_LCDACRT1DataStruct +{ + UCHAR CR[17]; +}SiS310_LCDACRT1DataStruct; -typedef struct _SiS310_LVDSCRT1DataStruct { - UCHAR CR[15]; +SiS310_LCDACRT1DataStruct SiS310_LCDACRT1800x600_1[] = +{ + {{0x65,0x4f,0x89,0x56,0x83,0xaf,0x1f, + 0x90,0x85,0x8f,0xab,0x30,0x00,0x05, + 0x00}}, + {{0x65,0x4f,0x89,0x56,0x83,0x83,0x1f, + 0x5e,0x83,0x5d,0x79,0x10,0x00,0x05, + 0x00}}, + {{0x65,0x4f,0x89,0x56,0x83,0xaf,0x1f, + 0x90,0x85,0x8f,0xab,0x30,0x00,0x05, + 0x00}}, + {{0x65,0x4f,0x89,0x56,0x83,0x83,0x1f, + 0x5e,0x83,0x5d,0x79,0x10,0x00,0x05, + 0x00}}, + {{0x65,0x4f,0x89,0x56,0x83,0x04,0x3e, + 0xe0,0x85,0xdf,0xfb,0x10,0x00,0x05, + 0x00}}, + {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0, + 0x58,0x8c,0x57,0x73,0x20,0x00,0x06, + 0x01}} +}; + +SiS310_LCDACRT1DataStruct SiS310_LCDACRT11024x768_1[]= +{ + {{0x73,0x4f,0x4f,0x97,0x55,0x86,0xc4,0x1f, + 0x92,0x89,0x8f,0x8f,0xb5,0x30,0x00,0x05, + 0x00}}, + {{0x73,0x4f,0x4f,0x97,0x55,0x86,0x97,0x1f, + 0x60,0x87,0x5d,0x5d,0x83,0x10,0x00,0x05, + 0x00}}, + {{0x73,0x4f,0x4f,0x97,0x55,0x86,0xc4,0x1f, + 0x92,0x89,0x8f,0x8f,0xb5,0x30,0x00,0x05, + 0x00}}, + {{0x73,0x4f,0x4f,0x97,0x55,0x86,0x97,0x1f, + 0x60,0x87,0x5d,0x5d,0x83,0x10,0x00,0x05, + 0x00}}, + {{0x73,0x4f,0x4f,0x97,0x55,0x86,0x04,0x3e, + 0xE2,0x89,0xDf,0xDf,0x05,0x00,0x00,0x05, + 0x00}}, + {{0x87,0x63,0x63,0x8B,0x69,0x1A,0x7c,0xf0, + 0x5A,0x8F,0x57,0x57,0x7D,0x20,0x00,0x26, + 0x01}}, + {{0xA3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xFf,0xFf,0x25,0x10,0x00,0x02, + 0x01}} +}; + +SiS310_LCDACRT1DataStruct SiS310_LCDACRT11280x1024_1[]= +{ + {{0x63,0x4f,0x87,0x54,0x9f,0xb4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x01, + 0x00}}, + {{0x63,0x4f,0x87,0x54,0x9f,0x82,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x01, + 0x00}}, + {{0x63,0x4f,0x87,0x54,0x9f,0xb4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x01, + 0x00}}, + {{0x63,0x4f,0x87,0x54,0x9f,0x82,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x01, + 0x00}}, + {{0x63,0x4f,0x87,0x54,0x9f,0x04,0x3e, + 0xe2,0x89,0xdf,0x05,0x00,0x00,0x01, + 0x00}}, + {{0x7e,0x63,0x82,0x68,0x15,0x7c,0xf0, + 0x5a,0x8f,0x57,0x7d,0x20,0x00,0x26, + 0x01}}, + {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x02, + 0x01}} +}; + +SiS310_LCDACRT1DataStruct SiS310_LCDACRT1800x600_1_H[]= +{ + {{0x30,0x27,0x94,0x2c,0x92,0xaf,0x1f, + 0x90,0x85,0x8f,0xab,0x30,0x00,0x04, + 0x00}}, + {{0x30,0x27,0x94,0x2c,0x92,0x83,0x1f, + 0x5e,0x83,0x5d,0x79,0x10,0x00,0x04, + 0x00}}, + {{0x30,0x27,0x94,0x2c,0x92,0xaf,0x1f, + 0x90,0x85,0x8f,0xab,0x30,0x00,0x04, + 0x00}}, + {{0x30,0x27,0x94,0x2c,0x92,0x83,0x1f, + 0x5e,0x83,0x5d,0x79,0x10,0x00,0x04, + 0x00}}, + {{0x30,0x27,0x94,0x2c,0x92,0x04,0x3e, + 0xe0,0x85,0xdf,0xfb,0x10,0x00,0x04, + 0x00}}, + {{0x3d,0x31,0x81,0x37,0x1f,0x72,0xf0, + 0x58,0x8c,0x57,0x73,0x20,0x00,0x05, + 0x01}} +}; + +SiS310_LCDACRT1DataStruct SiS310_LCDACRT11024x768_1_H[]= +{ + {{0x37,0x27,0x27,0x9B,0x2b,0x94,0xc4,0x1f, + 0x92,0x89,0x8f,0x8f,0xb5,0x30,0x00,0x44, + 0x00}}, + {{0x37,0x27,0x27,0x9B,0x2b,0x94,0x97,0x1f, + 0x60,0x87,0x5D,0x5D,0x83,0x01,0x00,0x44, + 0x00}}, + {{0x37,0x27,0x27,0x9B,0x2b,0x94,0xc4,0x1f, + 0x92,0x89,0x8f,0x8f,0xb5,0x30,0x00,0x44, + 0x00}}, + {{0x37,0x27,0x27,0x9B,0x2b,0x94,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, + 0x00}}, + {{0x41,0x31,0x31,0x85,0x35,0x1d,0x7c,0xf0, + 0x5A,0x8F,0x57,0x57,0x7D,0x20,0x00,0x55, + 0x01}}, + {{0x4f,0x3F,0x3F,0x93,0x45,0x0D,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, + 0x00}}, + {{0x2f,0x27,0x93,0x2b,0x90,0x82,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x04, + 0x00}}, + {{0x2f,0x27,0x93,0x2b,0x90,0x04,0x3e, + 0xe2,0x89,0xdf,0x05,0x00,0x00,0x04, + 0x00}}, + {{0x3c,0x31,0x80,0x35,0x1c,0x7c,0xf0, + 0x5a,0x8f,0x57,0x7d,0x20,0x00,0x55, + 0x01}}, + {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x01, + 0x01}} +}; + +SiS310_LCDACRT1DataStruct SiS310_LCDACRT1800x600_2[]= +{ + {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, + 0xf4,0x88,0x8f,0x73,0x20,0x00,0x06, + 0x00}}, + {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, + 0xdb,0x8f,0x5d,0x73,0x20,0x00,0x06, + 0x00}}, + {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, + 0xf4,0x88,0x8f,0x73,0x20,0x00,0x06, + 0x00}}, + {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, + 0xdb,0x8f,0x5d,0x73,0x20,0x00,0x06, + 0x00}}, + {{0x7f,0x4f,0x83,0x62,0x12,0x72,0xba, + 0x1c,0x80,0xdf,0x73,0x00,0x00,0x06, + 0x00}}, + {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0, + 0x58,0x8c,0x57,0x73,0x20,0x00,0x06, + 0x01}} +}; + +SiS310_LCDACRT1DataStruct SiS310_LCDACRT11024x768_2[]= +{ + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x72,0x88,0xdf,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x63,0x87,0x78,0x89,0x24,0xf1, + 0xae,0x84,0x57,0x25,0x30,0x00,0x02, + 0x01}}, + {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,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, + 0x00}}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x72,0x88,0xdf,0x25,0x30,0x00,0x06, + 0x00}}, + {{0xa3,0x63,0x87,0x78,0x89,0x24,0xf1, + 0xae,0x84,0x57,0x25,0x30,0x00,0x02, + 0x01}}, + {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,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, + 0x00}}, + {{0x3d,0x27,0x81,0x32,0x1a,0x72,0x3e, + 0xdb,0x8f,0x5d,0x73,0x20,0x00,0x05, + 0x00}}, + {{0x3d,0x27,0x81,0x32,0x1a,0x72,0x3e, + 0xf4,0x88,0x8f,0x73,0x20,0x00,0x05, + 0x00}}, + {{0x3d,0x27,0x81,0x3a,0x1a,0x72,0x3e, + 0xdb,0x8f,0x5d,0x73,0x20,0x00,0x05, + 0x00}}, + {{0x3d,0x27,0x81,0x32,0x1a,0x72,0xba, + 0x1c,0x80,0xdf,0x73,0x00,0x00,0x05, + 0x00}}, + {{0x3d,0x31,0x81,0x37,0x1f,0x72,0xf0, + 0x58,0x8c,0x57,0x73,0x20,0x00,0x05, + 0x01}} +}; + +SiS310_LCDACRT1DataStruct SiS310_LCDACRT11024x768_2_H[]= +{ + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x72,0x88,0xdf,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x31,0x93,0x3e,0x06,0x24,0xf1, + 0xae,0x84,0x57,0x25,0x30,0x00,0x01, + 0x01 }}, + {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, + 0x02,0x88,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, + 0x00 }}, + {{0x4f,0x27,0x93,0x39,0x81,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x27,0x93,0x39,0x81,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x27,0x93,0x39,0x81,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x27,0x93,0x39,0x81,0x24,0xbb, + 0x72,0x88,0xdf,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x4f,0x31,0x93,0x3e,0x86,0x24,0xf1, + 0xae,0x84,0x57,0x25,0x30,0x00,0x01, + 0x01 }}, + {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x01, + 0x01 }} +}; + +typedef struct _SiS310_LVDSCRT1DataStruct +{ + UCHAR CR[15]; } SiS310_LVDSCRT1DataStruct; -SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_1[] = { - {{0x65, 0x4f, 0x89, 0x56, 0x83, 0xaf, 0x1f, - 0x90, 0x85, 0x8f, 0xab, 0x30, 0x00, 0x05, - 0x00}}, - {{0x65, 0x4f, 0x89, 0x56, 0x83, 0x83, 0x1f, - 0x5e, 0x83, 0x5d, 0x79, 0x10, 0x00, 0x05, - 0x00}}, - {{0x65, 0x4f, 0x89, 0x56, 0x83, 0xaf, 0x1f, - 0x90, 0x85, 0x8f, 0xab, 0x30, 0x00, 0x05, - 0x00}}, - {{0x65, 0x4f, 0x89, 0x56, 0x83, 0x83, 0x1f, - 0x5e, 0x83, 0x5d, 0x79, 0x10, 0x00, 0x05, - 0x00}}, - {{0x65, 0x4f, 0x89, 0x56, 0x83, 0x04, 0x3e, - 0xe0, 0x85, 0xdf, 0xfb, 0x10, 0x00, 0x05, - 0x00}}, - {{0x7f, 0x63, 0x83, 0x6c, 0x1c, 0x72, 0xf0, - 0x58, 0x8c, 0x57, 0x73, 0x20, 0x00, 0x06, - 0x01}} -}; -SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_1[] = { - {{0x73, 0x4f, 0x97, 0x55, 0x86, 0xc4, 0x1f, - 0x92, 0x89, 0x8f, 0xb5, 0x30, 0x00, 0x05, +SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1320x480_1[] = +{ + {{0x65,0x4f,0x89,0x56,0x83,0xaa,0x1f, + 0x90,0x85,0x8f,0xab,0x30,0x00,0x05, + 0x00 }}, + {{0x65,0x4f,0x89,0x56,0x83,0x83,0x1f, + 0x5e,0x83,0x5d,0x79,0x10,0x00,0x05, + 0x00 }}, + {{0x65,0x4f,0x89,0x54,0x9f,0xc4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x01, + 0x00 }}, + {{0x65,0x4f,0x89,0x56,0x83,0x83,0x1f, + 0x5e,0x83,0x5d,0x79,0x10,0x00,0x05, + 0x00 }}, + {{0x65,0x4f,0x89,0x56,0x83,0x04,0x3e, + 0xe0,0x85,0xdf,0xfb,0x10,0x00,0x05, + 0x00 }}, + {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0, + 0x58,0x8c,0x57,0x73,0x20,0x00,0x06, + 0x01 }}, +{{0x2d,0x27,0x90,0x2c,0x80,0x0b,0x3e, + 0xe9,0x8b,0xe7,0x04,0x00,0x00,0x00, + 0x00 }} +}; + +SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_1[] = /* TW: New */ +{ + {{0x6b,0x4f,0x8f,0x55,0x85,0xaa,0x1f, + 0x90,0x85,0x8f,0xab,0x30,0x00,0x05, + 0x00 }}, + {{0x6b,0x4f,0x8f,0x55,0x85,0x78,0x1f, + 0x5e,0x83,0x5d,0x79,0x10,0x00,0x05, + 0x00 }}, + {{0x6b,0x4f,0x8f,0x55,0x85,0xaa,0x1f, + 0x90,0x85,0x8f,0xab,0x30,0x00,0x05, + 0x00 }}, + {{0x6b,0x4f,0x8f,0x55,0x85,0x78,0x1f, + 0x5e,0x83,0x5d,0x79,0x10,0x00,0x05, + 0x00 }}, + {{0x6b,0x4f,0x8f,0x55,0x85,0xfa,0x1f, + 0xe0,0x85,0xdf,0xfb,0x10,0x00,0x05, + 0x00 }}, + {{0x7f,0x63,0x83,0x69,0x19,0x72,0xf0, + 0x58,0x8c,0x57,0x73,0x20,0x00,0x06, + 0x01 }} +}; + +SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_1[] = /* TW: New */ +{ + {{0x73,0x4f,0x97,0x53,0x84,0xb4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x05, + 0x00}}, + {{0x73,0x4f,0x97,0x53,0x84,0x82,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x05, + 0x00}}, + {{0x73,0x4f,0x97,0x53,0x84,0xb4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x05, + 0x00}}, + {{0x73,0x4f,0x97,0x53,0x84,0x82,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x05, + 0x00}}, + {{0x73,0x4f,0x97,0x53,0x84,0x04,0x3e, + 0xE2,0x89,0xDf,0x05,0x00,0x00,0x05, + 0x00}}, + {{0x87,0x63,0x8B,0x67,0x18,0x7c,0xf0, + 0x5A,0x81,0x57,0x7D,0x00,0x00,0x06, + 0x01}}, + {{0xA3,0x7f,0x87,0x83,0x94,0x24,0xf5, + 0x02,0x89,0xFf,0x25,0x10,0x00,0x02, + 0x01}} +}; + +SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_1[] = /* TW: New */ +{ + {{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}} +}; + +SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_1_H[] = /* TW: New */ +{ + {{0x43,0x27,0x87,0x2d,0x1d,0xaa,0x1f, + 0x90,0x85,0x8f,0xab,0x30,0x00,0x05, + 0x00 }}, + {{0x43,0x27,0x87,0x2d,0x1d,0x78,0x1f, + 0x5e,0x83,0x5d,0x79,0x10,0x00,0x05, + 0x00 }}, + {{0x43,0x27,0x87,0x2d,0x1d,0xfa,0x1f, + 0xe0,0x85,0xdf,0xfb,0x10,0x00,0x05, + 0x00 }}, + {{0x43,0x27,0x87,0x2d,0x1d,0x78,0x1f, + 0x5e,0x83,0x5d,0x79,0x10,0x00,0x05, + 0x00 }}, + {{0x43,0x27,0x87,0x2d,0x1d,0xfa,0x1f, + 0xe0,0x85,0xdf,0xfb,0x10,0x00,0x05, + 0x00 }}, + {{0x4d,0x31,0x91,0x37,0x07,0x72,0xf0, + 0x58,0x8d,0x57,0x73,0x20,0x00,0x01, + 0x01 }} +}; + +SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_1_H[] = /* TW: New */ +{ + {{0x4b,0x27,0x8f,0x2b,0x1c,0xb4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x05, + 0x00 }}, + {{0x4b,0x27,0x8f,0x2b,0x1c,0x82,0x1f, + 0x60,0x87,0x5D,0x83,0x01,0x00,0x05, + 0x00}}, + {{0x4b,0x27,0x8f,0x2b,0x1c,0xb4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x05, + 0x00}}, + {{0x4b,0x27,0x8f,0x2b,0x1c,0x82,0x1f, + 0x60,0x87,0x5D,0x83,0x01,0x00,0x05, + 0x00}}, + {{0x4b,0x27,0x8f,0x2b,0x1c,0x04,0x3e, + 0xE2,0x89,0xDf,0x05,0x00,0x00,0x05, + 0x00}}, + {{0x55,0x31,0x99,0x35,0x06,0x7c,0xf0, + 0x5A,0x81,0x57,0x7D,0x00,0x00,0x01, + 0x01}}, + {{0x63,0x3F,0x87,0x43,0x94,0x24,0xf5, + 0x02,0x89,0xFf,0x25,0x10,0x00,0x01, + 0x01 }} +}; + +SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_1_H[] = /* TW: New */ +{ + {{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 }} +}; + +SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_2[]= /* TW: New */ +{ + {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, + 0xff,0x84,0x8f,0x73,0x00,0x00,0x06, + 0x00 }}, + {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, + 0xe6,0x8b,0x5d,0x73,0x00,0x00,0x06, + 0x00 }}, + {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, + 0xff,0x84,0x8f,0x73,0x00,0x00,0x06, + 0x00 }}, + {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, + 0xe6,0x8b,0x5d,0x73,0x00,0x00,0x06, + 0x00 }}, + {{0x7f,0x4f,0x83,0x62,0x12,0x72,0xba, + 0x27,0x8c,0xdf,0x73,0x00,0x00,0x06, + 0x00 }}, + {{0x7f,0x63,0x83,0x69,0x19,0x72,0xf0, + 0x58,0x8d,0x57,0x73,0x20,0x00,0x06, + 0x01 }} +}; + +SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_2[] = /* TW: New */ +{ + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x57,0x8e,0x8f,0x25,0x30,0x00,0x06, + 0x00 }}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x3e,0x85,0x5d,0x25,0x10,0x00,0x06, + 0x00 }}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x57,0x8e,0x8f,0x25,0x30,0x00,0x06, + 0x00 }}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x3e,0x85,0x5d,0x25,0x10,0x00,0x06, + 0x01 }}, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x7f,0x86,0xdf,0x25,0x10,0x00,0x06, + 0x00 }}, + {{0xa3,0x63,0x87,0x78,0x89,0x24,0xf1, + 0xbb,0x82,0x57,0x25,0x10,0x00,0x02, + 0x01 }}, + {{0xa3,0x7f,0x87,0x83,0x94,0x24,0xf5, + 0x02,0x89,0xff,0x25,0x10,0x00,0x02, + 0x01 }} +}; + +SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_2[] = /* TW: New */ +{ + {{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}} +}; + +SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_2_H[] = /* TW: New */ +{ + {{0x57,0x27,0x9b,0x3a,0x0a,0x72,0x3e, + 0xff,0x84,0x8f,0x73,0x00,0x00,0x01, + 0x00 }}, + {{0x57,0x27,0x9b,0x3a,0x0a,0x72,0x3e, + 0xd6,0x8b,0x5d,0x73,0x00,0x00,0x01, + 0x00 }}, + {{0x57,0x27,0x9b,0x3a,0x0a,0x72,0x3e, + 0xff,0x84,0x8f,0x73,0x00,0x00,0x01, + 0x00 }}, + {{0x57,0x27,0x9b,0x3a,0x0a,0x72,0x3e, + 0xd6,0x8b,0x5d,0x73,0x00,0x00,0x01, + 0x00 }}, + {{0x57,0x27,0x9b,0x3a,0x0a,0x72,0xba, + 0x27,0x8c,0xdf,0x73,0x00,0x00,0x01, + 0x00 }}, + {{0x4d,0x31,0x91,0x3a,0x0a,0x72,0xf0, + 0x63,0x88,0x57,0x73,0x00,0x00,0x01, + 0x01 }} +}; + +SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_2_H[] = /* TW: New */ +{ + {{0x7b,0x27,0x9f,0x46,0x97,0x24,0xbb, + 0x57,0x8e,0x8f,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x7b,0x27,0x9f,0x46,0x97,0x24,0xbb, + 0x3e,0x85,0x5d,0x25,0x10,0x00,0x01, + 0x00 }}, + {{0x7b,0x27,0x9f,0x46,0x97,0x24,0xbb, + 0x57,0x8e,0x8f,0x25,0x30,0x00,0x01, + 0x00 }}, + {{0x7b,0x27,0x9f,0x46,0x97,0x24,0xbb, + 0x3e,0x85,0x5d,0x25,0x10,0x00,0x01, + 0x00 }}, + {{0x7b,0x27,0x9f,0x46,0x97,0x24,0xbb, + 0x7f,0x86,0xdf,0x25,0x10,0x00,0x01, + 0x00 }}, + {{0x71,0x31,0x95,0x46,0x97,0x24,0xf1, + 0xbb,0x82,0x57,0x25,0x10,0x00,0x01, + 0x01 }}, + {{0x63,0x3f,0x87,0x46,0x97,0x24,0xf5, + 0x0f,0x86,0xff,0x25,0x30,0x00,0x01, + 0x01 }} +}; + +SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_2_H[] = /* TW: New */ +{ + {{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}} +}; + +SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1XXXxXXX_1[] = /* TW: New */ +{ + {{0x5f,0x4f,0x82,0x55,0x81,0xbf,0x1f, + 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x05, + 0x00}}, + {{0x5f,0x4f,0x82,0x55,0x81,0xbf,0x1f, + 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x05, + 0x00}}, + {{0x5f,0x4f,0x82,0x55,0x81,0xbf,0x1f, + 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x05, + 0x00}}, + {{0x5f,0x4f,0x82,0x55,0x81,0xbf,0x1f, + 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x05, + 0x00}}, + {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e, + 0xe9,0x8b,0xe7,0x04,0x00,0x00,0x05, + 0x00}}, + {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0, + 0x58,0x8c,0x57,0x73,0x20,0x00,0x06, + 0x01}}, + {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x02, + 0x01}}, + {{0xce,0x9f,0x92,0xa9,0x17,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x07, + 0x01}} +}; + +SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1XXXxXXX_1_H[] = /* TW: New */ +{ + {{0x38,0x27,0x9c,0x2c,0x80,0xbf,0x1f, + 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x00, + 0x00}}, + {{0x38,0x27,0x9c,0x2c,0x80,0xbf,0x1f, + 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x00, + 0x00}}, + {{0x38,0x27,0x9c,0x2c,0x80,0xbf,0x1f, + 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x00, + 0x00}}, + {{0x38,0x27,0x9c,0x2c,0x80,0xbf,0x1f, + 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x00, + 0x00}}, + {{0x38,0x27,0x9c,0x2c,0x80,0x0b,0x3e, + 0xe9,0x8b,0xe7,0x04,0x00,0x00,0x00, + 0x00}}, + {{0x4d,0x31,0x91,0x3b,0x03,0x72,0xf0, + 0x58,0x8c,0x57,0x73,0x20,0x00,0x01, + 0x01}}, + {{0x63,0x3f,0x87,0x4a,0x92,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x01, + 0x01}} +}; + +SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_1[] = /* TW: New */ +{ + {{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_LVDSCRT11400x1050_1_H[] = /* TW: New */ +{ + {{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}} +}; + +SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_2[] = /* TW: New */ +{ + {{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}} +}; + +SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_2_H[] = /* TW: New */ +{ + {{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_LVDSCRT11024x600_1[] = +{ + {{0x64,0x4f,0x88,0x54,0x9f,0x5a,0x3e, + 0xe8,0x8f,0x8f,0x5b,0x00,0x00,0x01, 0x00}}, - {{0x73, 0x4f, 0x97, 0x55, 0x86, 0x97, 0x1f, - 0x60, 0x87, 0x5d, 0x83, 0x10, 0x00, 0x05, + {{0x64,0x4f,0x88,0x54,0x9f,0x2e,0x3e, + 0xb9,0x80,0x5d,0x2f,0x00,0x00,0x01, 0x00}}, - {{0x73, 0x4f, 0x97, 0x55, 0x86, 0xc4, 0x1f, - 0x92, 0x89, 0x8f, 0xb5, 0x30, 0x00, 0x05, + {{0x64,0x4f,0x88,0x54,0x9f,0x5a,0x3e, + 0xe8,0x8f,0x8f,0x5b,0x00,0x00,0x01, 0x00}}, - {{0x73, 0x4f, 0x97, 0x55, 0x86, 0x97, 0x1f, - 0x60, 0x87, 0x5d, 0x83, 0x10, 0x00, 0x05, + {{0x64,0x4f,0x88,0x54,0x9f,0x2e,0x3e, + 0xb9,0x80,0x5d,0x2f,0x00,0x00,0x01, 0x00}}, - {{0x73, 0x4f, 0x97, 0x55, 0x86, 0x04, 0x3e, - 0xE2, 0x89, 0xDf, 0x05, 0x00, 0x00, 0x05, + {{0x64,0x4f,0x88,0x54,0x9f,0xaf,0xba, + 0x3b,0x82,0xdf,0xb0,0x00,0x00,0x01, 0x00}}, - {{0x87, 0x63, 0x8B, 0x69, 0x1A, 0x7c, 0xf0, - 0x5A, 0x8F, 0x57, 0x7D, 0x20, 0x00, 0x26, + {{0x7e,0x63,0x82,0x68,0x15,0x1e,0xf1, + 0xae,0x85,0x57,0x1f,0x30,0x00,0x26, 0x01}}, - {{0xA3, 0x7f, 0x87, 0x86, 0x97, 0x24, 0xf5, - 0x02, 0x88, 0xFf, 0x25, 0x10, 0x00, 0x02, + {{0xa3,0x7f,0x87,0x86,0x97,0x1e,0xf1, + 0xae,0x85,0x57,0x1f,0x30,0x00,0x02, 0x01}} }; -SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_1[] = { - {{0x63, 0x4f, 0x87, 0x54, 0x9f, 0xb4, 0x1f, - 0x92, 0x89, 0x8f, 0xb5, 0x30, 0x00, 0x01, - 0x00}}, - {{0x63, 0x4f, 0x87, 0x54, 0x9f, 0x82, 0x1f, - 0x60, 0x87, 0x5d, 0x83, 0x10, 0x00, 0x01, +SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x600_1_H[] = +{ + {{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x44, 0x00}}, - {{0x63, 0x4f, 0x87, 0x54, 0x9f, 0xb4, 0x1f, - 0x92, 0x89, 0x8f, 0xb5, 0x30, 0x00, 0x01, + {{0x2f,0x27,0x93,0x2b,0x90,0x97,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x44, + 0x00}}, + {{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x44, 0x00}}, - {{0x63, 0x4f, 0x87, 0x54, 0x9f, 0x82, 0x1f, - 0x60, 0x87, 0x5d, 0x83, 0x10, 0x00, 0x01, + {{0x2f,0x27,0x93,0x2b,0x90,0x97,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x44, 0x00}}, - {{0x63, 0x4f, 0x87, 0x54, 0x9f, 0x04, 0x3e, - 0xe2, 0x89, 0xdf, 0x05, 0x00, 0x00, 0x01, + {{0x2f,0x27,0x93,0x2b,0x90,0x04,0x3e, + 0xe2,0x89,0xdf,0x05,0x00,0x00,0x44, 0x00}}, - {{0x7e, 0x63, 0x82, 0x68, 0x15, 0x7c, 0xf0, - 0x5a, 0x8f, 0x57, 0x7d, 0x20, 0x00, 0x26, + {{0x3c,0x31,0x80,0x35,0x1c,0x7c,0xf0, + 0x5a,0x8f,0x57,0x7d,0x20,0x00,0x55, 0x01}}, - {{0xa3, 0x7f, 0x87, 0x86, 0x97, 0x24, 0xf5, - 0x02, 0x88, 0xff, 0x25, 0x10, 0x00, 0x02, + {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x01, 0x01}} }; -SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_1_H[] = { - {{0x30, 0x27, 0x94, 0x2c, 0x92, 0xaf, 0x1f, - 0x90, 0x85, 0x8f, 0xab, 0x30, 0x00, 0x04, - 0x00}}, - {{0x30, 0x27, 0x94, 0x2c, 0x92, 0x83, 0x1f, - 0x5e, 0x83, 0x5d, 0x79, 0x10, 0x00, 0x04, - 0x00}}, - {{0x30, 0x27, 0x94, 0x2c, 0x92, 0xaf, 0x1f, - 0x90, 0x85, 0x8f, 0xab, 0x30, 0x00, 0x04, - 0x00}}, - {{0x30, 0x27, 0x94, 0x2c, 0x92, 0x83, 0x1f, - 0x5e, 0x83, 0x5d, 0x79, 0x10, 0x00, 0x04, - 0x00}}, - {{0x30, 0x27, 0x94, 0x2c, 0x92, 0x04, 0x3e, - 0xe0, 0x85, 0xdf, 0xfb, 0x10, 0x00, 0x04, - 0x00}}, - {{0x3d, 0x31, 0x81, 0x37, 0x1f, 0x72, 0xf0, - 0x58, 0x8c, 0x57, 0x73, 0x20, 0x00, 0x05, - 0x01}} -}; - -SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_1_H[] = { - {{0x37, 0x27, 0x9B, 0x2b, 0x94, 0xc4, 0x1f, - 0x92, 0x89, 0x8f, 0xb5, 0x30, 0x00, 0x44, +SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x600_2[] = +{ + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, 0x00}}, - {{0x37, 0x27, 0x9B, 0x2b, 0x94, 0x97, 0x1f, - 0x60, 0x87, 0x5D, 0x83, 0x01, 0x00, 0x44, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, 0x00}}, - {{0x37, 0x27, 0x9B, 0x2b, 0x94, 0xc4, 0x1f, - 0x92, 0x89, 0x8f, 0xb5, 0x30, 0x00, 0x44, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, 0x00}}, - {{0x37, 0x27, 0x9B, 0x2b, 0x94, 0x97, 0x1f, - 0x60, 0x87, 0x5D, 0x83, 0x01, 0x00, 0x44, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, 0x00}}, - {{0x37, 0x27, 0x9B, 0x2b, 0x94, 0x04, 0x3e, - 0xE2, 0x89, 0xDf, 0x05, 0x00, 0x00, 0x44, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x72,0x88,0xdf,0x25,0x30,0x00,0x06, 0x00}}, - {{0x41, 0x31, 0x85, 0x35, 0x1d, 0x7c, 0xf0, - 0x5A, 0x8F, 0x57, 0x7D, 0x20, 0x00, 0x55, + {{0xa3,0x63,0x87,0x78,0x89,0x24,0xf1, + 0xae,0x84,0x57,0x25,0x30,0x00,0x02, 0x01}}, - {{0x4f, 0x3F, 0x93, 0x45, 0x0D, 0x24, 0xf5, - 0x02, 0x88, 0xFf, 0x25, 0x10, 0x00, 0x01, + {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x02, 0x01}} }; -SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_1_H[] = { - {{0x2f, 0x27, 0x93, 0x2b, 0x90, 0xb4, 0x1f, - 0x92, 0x89, 0x8f, 0xb5, 0x30, 0x00, 0x04, +SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x600_2_H[] = +{ + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, 0x00}}, - {{0x2f, 0x27, 0x93, 0x2b, 0x90, 0x82, 0x1f, - 0x60, 0x87, 0x5d, 0x83, 0x10, 0x00, 0x04, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, 0x00}}, - {{0x2f, 0x27, 0x93, 0x2b, 0x90, 0xb4, 0x1f, - 0x92, 0x89, 0x8f, 0xb5, 0x30, 0x00, 0x04, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, 0x00}}, - {{0x2f, 0x27, 0x93, 0x2b, 0x90, 0x82, 0x1f, - 0x60, 0x87, 0x5d, 0x83, 0x10, 0x00, 0x04, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, 0x00}}, - {{0x2f, 0x27, 0x93, 0x2b, 0x90, 0x04, 0x3e, - 0xe2, 0x89, 0xdf, 0x05, 0x00, 0x00, 0x04, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x72,0x88,0xdf,0x25,0x30,0x00,0x01, 0x00}}, - {{0x3c, 0x31, 0x80, 0x35, 0x1c, 0x7c, 0xf0, - 0x5a, 0x8f, 0x57, 0x7d, 0x20, 0x00, 0x55, + {{0x4f,0x31,0x93,0x3e,0x06,0x24,0xf1, + 0xae,0x84,0x57,0x25,0x30,0x00,0x01, 0x01}}, - {{0x4f, 0x3f, 0x93, 0x45, 0x0d, 0x24, 0xf5, - 0x02, 0x88, 0xff, 0x25, 0x10, 0x00, 0x01, - 0x01}} -}; - -SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_2[] = { - {{0x7f, 0x4f, 0x83, 0x62, 0x12, 0x72, 0x3e, - 0xf4, 0x88, 0x8f, 0x73, 0x20, 0x00, 0x06, - 0x00}}, - {{0x7f, 0x4f, 0x83, 0x62, 0x12, 0x72, 0x3e, - 0xdb, 0x8f, 0x5d, 0x73, 0x20, 0x00, 0x06, - 0x00}}, - {{0x7f, 0x4f, 0x83, 0x62, 0x12, 0x72, 0x3e, - 0xf4, 0x88, 0x8f, 0x73, 0x20, 0x00, 0x06, - 0x00}}, - {{0x7f, 0x4f, 0x83, 0x62, 0x12, 0x72, 0x3e, - 0xdb, 0x8f, 0x5d, 0x73, 0x20, 0x00, 0x06, - 0x00}}, - {{0x7f, 0x4f, 0x83, 0x62, 0x12, 0x72, 0xba, - 0x1c, 0x80, 0xdf, 0x73, 0x00, 0x00, 0x06, - 0x00}}, - {{0x7f, 0x63, 0x83, 0x6c, 0x1c, 0x72, 0xf0, - 0x58, 0x8c, 0x57, 0x73, 0x20, 0x00, 0x06, + {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x01, 0x01}} }; -SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_2[] = { - {{0xa3, 0x4f, 0x87, 0x6e, 0x9f, 0x24, 0xbb, - 0x4a, 0x80, 0x8f, 0x25, 0x30, 0x00, 0x06, +SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11152x768_1[] = +{ + {{0x64,0x4f,0x88,0x54,0x9f,0xc4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x01, 0x00}}, - {{0xa3, 0x4f, 0x87, 0x6e, 0x9f, 0x24, 0xbb, - 0x31, 0x87, 0x5d, 0x25, 0x30, 0x00, 0x06, + {{0x64,0x4f,0x88,0x54,0x9f,0x97,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x01, 0x00}}, - {{0xa3, 0x4f, 0x87, 0x6e, 0x9f, 0x24, 0xbb, - 0x4a, 0x80, 0x8f, 0x25, 0x30, 0x00, 0x06, + {{0x64,0x4f,0x88,0x54,0x9f,0xc4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x01, 0x00}}, - {{0xa3, 0x4f, 0x87, 0x6e, 0x9f, 0x24, 0xbb, - 0x31, 0x87, 0x5d, 0x25, 0x30, 0x00, 0x06, + {{0x64,0x4f,0x88,0x54,0x9f,0x97,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x01, 0x00}}, - {{0xa3, 0x4f, 0x87, 0x6e, 0x9f, 0x24, 0xbb, - 0x72, 0x88, 0xdf, 0x25, 0x30, 0x00, 0x06, + {{0x64,0x4f,0x88,0x54,0x9f,0x04,0x3e, + 0xe2,0x89,0xdf,0x05,0x00,0x00,0x01, 0x00}}, - {{0xa3, 0x63, 0x87, 0x78, 0x89, 0x24, 0xf1, - 0xae, 0x84, 0x57, 0x25, 0x30, 0x00, 0x02, + {{0x7e,0x63,0x82,0x68,0x15,0x7c,0xf0, + 0x5a,0x8f,0x57,0x7d,0x20,0x00,0x26, 0x01}}, - {{0xa3, 0x7f, 0x87, 0x86, 0x97, 0x24, 0xf5, - 0x02, 0x88, 0xff, 0x25, 0x10, 0x00, 0x02, + {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x02, 0x01}} }; -SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_2[] = { - {{0xa3, 0x4f, 0x87, 0x6e, 0x9f, 0x24, 0xbb, - 0x4a, 0x80, 0x8f, 0x25, 0x30, 0x00, 0x06, +SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11152x768_1_H[] = +{ + {{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x44, 0x00}}, - {{0xa3, 0x4f, 0x87, 0x6e, 0x9f, 0x24, 0xbb, - 0x31, 0x87, 0x5d, 0x25, 0x30, 0x00, 0x06, + {{0x2f,0x27,0x93,0x2b,0x90,0x97,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x44, 0x00}}, - {{0xa3, 0x4f, 0x87, 0x6e, 0x9f, 0x24, 0xbb, - 0x4a, 0x80, 0x8f, 0x25, 0x30, 0x00, 0x06, + {{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x44, 0x00}}, - {{0xa3, 0x4f, 0x87, 0x6e, 0x9f, 0x24, 0xbb, - 0x31, 0x87, 0x5d, 0x25, 0x30, 0x00, 0x06, + {{0x2f,0x27,0x93,0x2b,0x90,0x97,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x44, 0x00}}, - {{0xa3, 0x4f, 0x87, 0x6e, 0x9f, 0x24, 0xbb, - 0x72, 0x88, 0xdf, 0x25, 0x30, 0x00, 0x06, + {{0x2f,0x27,0x93,0x2b,0x90,0x04,0x3e, + 0xe2,0x89,0xdf,0x05,0x00,0x00,0x44, 0x00}}, - {{0xa3, 0x63, 0x87, 0x78, 0x89, 0x24, 0xf1, - 0xae, 0x84, 0x57, 0x25, 0x30, 0x00, 0x02, + {{0x3c,0x31,0x80,0x35,0x1c,0x7c,0xf0, + 0x5a,0x8f,0x57,0x7d,0x20,0x00,0x55, 0x01}}, - {{0xa3, 0x7f, 0x87, 0x86, 0x97, 0x24, 0xf5, - 0x02, 0x88, 0xff, 0x25, 0x10, 0x00, 0x02, + {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x01, 0x01}} }; -SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_2_H[] = { - {{0x3d, 0x27, 0x81, 0x32, 0x1a, 0x72, 0x3e, - 0xf4, 0x88, 0x8f, 0x73, 0x20, 0x00, 0x05, - 0x00}}, - {{0x3d, 0x27, 0x81, 0x32, 0x1a, 0x72, 0x3e, - 0xdb, 0x8f, 0x5d, 0x73, 0x20, 0x00, 0x05, - 0x00}}, - {{0x3d, 0x27, 0x81, 0x32, 0x1a, 0x72, 0x3e, - 0xf4, 0x88, 0x8f, 0x73, 0x20, 0x00, 0x05, - 0x00}}, - {{0x3d, 0x27, 0x81, 0x3a, 0x1a, 0x72, 0x3e, - 0xdb, 0x8f, 0x5d, 0x73, 0x20, 0x00, 0x05, - 0x00}}, - {{0x3d, 0x27, 0x81, 0x32, 0x1a, 0x72, 0xba, - 0x1c, 0x80, 0xdf, 0x73, 0x00, 0x00, 0x05, - 0x00}}, - {{0x3d, 0x31, 0x81, 0x37, 0x1f, 0x72, 0xf0, - 0x58, 0x8c, 0x57, 0x73, 0x20, 0x00, 0x05, - 0x01}} -}; - -SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_2_H[] = { - {{0x4f, 0x27, 0x93, 0x39, 0x01, 0x24, 0xbb, - 0x4a, 0x80, 0x8f, 0x25, 0x30, 0x00, 0x01, +SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11152x768_2[] = +{ + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, 0x00}}, - {{0x4f, 0x27, 0x93, 0x39, 0x01, 0x24, 0xbb, - 0x31, 0x87, 0x5d, 0x25, 0x30, 0x00, 0x01, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, 0x00}}, - {{0x4f, 0x27, 0x93, 0x39, 0x01, 0x24, 0xbb, - 0x4a, 0x80, 0x8f, 0x25, 0x30, 0x00, 0x01, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, 0x00}}, - {{0x4f, 0x27, 0x93, 0x39, 0x01, 0x24, 0xbb, - 0x31, 0x87, 0x5d, 0x25, 0x30, 0x00, 0x01, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, 0x00}}, - {{0x4f, 0x27, 0x93, 0x39, 0x01, 0x24, 0xbb, - 0x72, 0x88, 0xdf, 0x25, 0x30, 0x00, 0x01, + {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x72,0x88,0xdf,0x25,0x30,0x00,0x06, 0x00}}, - {{0x4f, 0x31, 0x93, 0x3e, 0x06, 0x24, 0xf1, - 0xae, 0x84, 0x57, 0x25, 0x30, 0x00, 0x01, + {{0xa3,0x63,0x87,0x78,0x89,0x24,0xf1, + 0xae,0x84,0x57,0x25,0x30,0x00,0x02, 0x01}}, - {{0x4f, 0x3f, 0x93, 0x45, 0x0d, 0x24, 0xf5, - 0x02, 0x88, 0xff, 0x25, 0x10, 0x00, 0x01, + {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x02, 0x01}} }; -SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_2_H[] = { - {{0x4f, 0x27, 0x93, 0x39, 0x81, 0x24, 0xbb, - 0x4a, 0x80, 0x8f, 0x25, 0x30, 0x00, 0x01, +SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11152x768_2_H[] = +{ + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, 0x00}}, - {{0x4f, 0x27, 0x93, 0x39, 0x81, 0x24, 0xbb, - 0x31, 0x87, 0x5d, 0x25, 0x30, 0x00, 0x01, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, 0x00}}, - {{0x4f, 0x27, 0x93, 0x39, 0x81, 0x24, 0xbb, - 0x4a, 0x80, 0x8f, 0x25, 0x30, 0x00, 0x01, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, 0x00}}, - {{0x4f, 0x27, 0x93, 0x39, 0x81, 0x24, 0xbb, - 0x31, 0x87, 0x5d, 0x25, 0x30, 0x00, 0x01, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, 0x00}}, - {{0x4f, 0x27, 0x93, 0x39, 0x81, 0x24, 0xbb, - 0x72, 0x88, 0xdf, 0x25, 0x30, 0x00, 0x01, + {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x72,0x88,0xdf,0x25,0x30,0x00,0x01, 0x00}}, - {{0x4f, 0x31, 0x93, 0x3e, 0x86, 0x24, 0xf1, - 0xae, 0x84, 0x57, 0x25, 0x30, 0x00, 0x01, + {{0x4f,0x31,0x93,0x3e,0x06,0x24,0xf1, + 0xae,0x84,0x57,0x25,0x30,0x00,0x01, 0x01}}, - {{0x4f, 0x3f, 0x93, 0x45, 0x0d, 0x24, 0xf5, - 0x02, 0x88, 0xff, 0x25, 0x10, 0x00, 0x01, - 0x01}} -}; - -SiS310_LVDSCRT1DataStruct SiS310_CHTVCRT1UNTSC[] = { - {{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, 0x53, 0x9c, 0x56, 0xba, - 0x18, 0x84, 0xdf, 0x57, 0x00, 0x00, 0x01, - 0x00}}, - {{0x80, 0x63, 0x84, 0x6c, 0x17, 0xec, 0xf0, - 0x90, 0x8c, 0x57, 0xed, 0x20, 0x00, 0x06, + {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x01, 0x01}} }; -SiS310_LVDSCRT1DataStruct SiS310_CHTVCRT1ONTSC[] = { - {{0x64, 0x4f, 0x88, 0x5a, 0x9f, 0x0b, 0x3e, - 0xc0, 0x84, 0x8f, 0x0c, 0x20, 0x00, 0x01, - 0x00}}, - {{0x64, 0x4f, 0x88, 0x5a, 0x9f, 0x0b, 0x3e, - 0xb0, 0x8d, 0x5d, 0x0c, 0x00, 0x00, 0x01, - 0x00}}, - {{0x64, 0x4f, 0x88, 0x5a, 0x9f, 0x0b, 0x3e, - 0xc0, 0x84, 0x8f, 0x0c, 0x20, 0x00, 0x01, - 0x00}}, - {{0x64, 0x4f, 0x88, 0x5a, 0x9f, 0x0b, 0x3e, - 0xb0, 0x8d, 0x5d, 0x0c, 0x00, 0x00, 0x01, - 0x00}}, - {{0x5d, 0x4f, 0x81, 0x56, 0x9c, 0x0b, 0x3e, - 0xe8, 0x84, 0xdf, 0x0c, 0x00, 0x00, 0x01, - 0x00}}, - {{0x7d, 0x63, 0x81, 0x6a, 0x16, 0xba, 0xf0, - 0x7f, 0x86, 0x57, 0xbb, 0x00, 0x00, 0x06, - 0x01}} -}; - -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, 0x55, 0x80, 0xec, 0xba, - 0x50, 0x84, 0xdf, 0xed, 0x00, 0x00, 0x05, - 0x00}}, - {{0x70, 0x63, 0x94, 0x68, 0x8d, 0x42, 0xf1, - 0xc8, 0x8c, 0x57, 0xe9, 0x20, 0x00, 0x05, - 0x01}} -}; - -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, 0x55, 0x80, 0x6f, 0xba, - 0x20, 0x83, 0xdf, 0x70, 0x00, 0x00, 0x05, - 0x00}}, - {{0x73, 0x63, 0x97, 0x69, 0x8e, 0xec, 0xf0, - 0x90, 0x8c, 0x57, 0xed, 0x20, 0x00, 0x05, - 0x01}} -}; - -typedef struct _SiS310_CHTVRegDataStruct { - UCHAR Reg[5]; +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}} +}; + +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 }} +}; + +SiS310_LVDSCRT1DataStruct SiS310_CHTVCRT1UPAL[] = /* TW: New */ +{ + {{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}} +}; + +SiS310_LVDSCRT1DataStruct SiS310_CHTVCRT1OPAL[] = /* TW: New */ +{ + {{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: New data for Chrontel 7019 (From 650/LVDS BIOS 1.10.0) */ +typedef struct _SiS310_CHTVRegDataStruct +{ + UCHAR Reg[16]; } SiS310_CHTVRegDataStruct; + SiS310_CHTVRegDataStruct SiS310_CHTVReg_UNTSC[] = { - {{0x00}} + {{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}}, + {{0x4a,0x77,0xbb,0x94,0x84,0x48,0xfe,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x6a,0x77,0xbb,0x6e,0x84,0x2e,0x02,0x5a,0x04,0x00,0x80,0x20,0x7e,0x80,0x98,0x00}}, + {{0xcf,0x77,0xb7,0xc8,0x84,0x3b,0x02,0x5a,0x04,0x00,0x80,0x19,0x88,0x30,0x7f,0x00}}, + {{0xee,0x77,0xbb,0x66,0x87,0x32,0x01,0x5a,0x04,0x00,0x80,0x1b,0xd3,0xf2,0x36,0x00}} }; SiS310_CHTVRegDataStruct SiS310_CHTVReg_ONTSC[] = { - {{0x00}} + {{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}}, + {{0x49,0x77,0xbb,0x7b,0x84,0x34,0x00,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x69,0x77,0xbb,0x6e,0x84,0x1e,0x00,0x5a,0x04,0x00,0x80,0x25,0x1a,0x43,0x04,0x00}}, + {{0xce,0x77,0xb7,0xb6,0x83,0x2c,0x02,0x5a,0x04,0x00,0x80,0x1c,0x00,0x82,0x97,0x00}}, + {{0xed,0x77,0xbb,0x66,0x8c,0x21,0x02,0x5a,0x04,0x00,0x80,0x1f,0x9f,0xc1,0x0c,0x00}} }; SiS310_CHTVRegDataStruct SiS310_CHTVReg_UPAL[] = { - {{0x00}} + {{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,0x26,0x2a,0x55,0x5d,0x00}}, + {{0xc3,0x7f,0xb7,0x7a,0x84,0x40,0x02,0x5a,0x05,0x00,0x80,0x1f,0x84,0x3d,0x28,0x00}}, + {{0xe5,0x7f,0xb7,0x1d,0xa7,0x3e,0x04,0x5a,0x05,0x00,0x80,0x20,0x3e,0xe4,0x22,0x00}} }; SiS310_CHTVRegDataStruct SiS310_CHTVReg_OPAL[] = { - {{0x00}} + {{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}} }; -UCHAR SiS310_CHTVVCLKUNTSC[] = { 0x00 }; +UCHAR SiS310_CHTVVCLKUNTSC[] = {0x41,0x41,0x41,0x41,0x42,0x46,0x53}; -UCHAR SiS310_CHTVVCLKONTSC[] = { 0x00 }; +UCHAR SiS310_CHTVVCLKONTSC[] = {0x48,0x48,0x48,0x48,0x45,0x43,0x51}; -UCHAR SiS310_CHTVVCLKUPAL[] = { 0x00 }; +UCHAR SiS310_CHTVVCLKUPAL[] = {0x47,0x47,0x47,0x47,0x48,0x4a,0x54}; -UCHAR SiS310_CHTVVCLKOPAL[] = { 0x00 }; +UCHAR SiS310_CHTVVCLKOPAL[] = {0x47,0x47,0x47,0x47,0x48,0x4f,0x52}; +/* TW: New end */ diff --git a/drivers/video/sis/325vtbl.h b/drivers/video/sis/325vtbl.h index 16a1e597b093..237668212253 100644 --- a/drivers/video/sis/325vtbl.h +++ b/drivers/video/sis/325vtbl.h @@ -1,4 +1,5 @@ -typedef struct _SiS310_StStruct { +typedef struct _SiS310_StStruct +{ UCHAR St_ModeID; USHORT St_ModeFlag; UCHAR St_StTableIndex; @@ -8,31 +9,32 @@ typedef struct _SiS310_StStruct { UCHAR VB_StTVEdgeIndex; UCHAR VB_StTVYFilterIndex; } SiS310_StStruct; -SiS310_StStruct SiS310_SModeIDTable[] = -{ - {0x01, 0x9208, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00}, - {0x01, 0x1210, 0x14, 0x01, 0x01, 0x00, 0x01, 0x00}, - {0x01, 0x1010, 0x17, 0x02, 0x02, 0x00, 0x01, 0x01}, - {0x03, 0x8208, 0x03, 0x00, 0x00, 0x00, 0x01, 0x02}, - {0x03, 0x0210, 0x16, 0x01, 0x01, 0x00, 0x01, 0x02}, - {0x03, 0x0010, 0x18, 0x02, 0x02, 0x00, 0x01, 0x03}, - {0x05, 0x9209, 0x05, 0x00, 0x00, 0x00, 0x00, 0x04}, - {0x06, 0x8209, 0x06, 0x00, 0x00, 0x00, 0x00, 0x05}, - {0x07, 0x0000, 0x07, 0x03, 0x03, 0x00, 0x01, 0x03}, - {0x07, 0x0000, 0x19, 0x02, 0x02, 0x00, 0x01, 0x03}, - {0x0d, 0x920a, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x04}, - {0x0e, 0x820a, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x05}, - {0x0f, 0x0202, 0x11, 0x01, 0x01, 0x00, 0x00, 0x05}, - {0x10, 0x0212, 0x12, 0x01, 0x01, 0x00, 0x00, 0x05}, - {0x11, 0x0212, 0x1a, 0x04, 0x04, 0x00, 0x00, 0x05}, - {0x12, 0x0212, 0x1b, 0x04, 0x04, 0x00, 0x00, 0x05}, - {0x13, 0x021b, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x04}, - {0x12, 0x0010, 0x18, 0x02, 0x02, 0x00, 0x00, 0x05}, - {0x12, 0x0210, 0x18, 0x01, 0x01, 0x00, 0x00, 0x05}, - {0xff, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} -}; - -typedef struct _SiS310_StandTableStruct { +SiS310_StStruct SiS310_SModeIDTable[]= +{ + {0x01,0x9208,0x01,0x00,0x00,0x00,0x01,0x00}, + {0x01,0x1210,0x14,0x01,0x01,0x00,0x01,0x00}, + {0x01,0x1010,0x17,0x02,0x02,0x00,0x01,0x01}, + {0x03,0x8208,0x03,0x00,0x00,0x00,0x01,0x02}, + {0x03,0x0210,0x16,0x01,0x01,0x00,0x01,0x02}, + {0x03,0x0010,0x18,0x02,0x02,0x00,0x01,0x03}, + {0x05,0x9209,0x05,0x00,0x00,0x00,0x00,0x04}, + {0x06,0x8209,0x06,0x00,0x00,0x00,0x00,0x05}, + {0x07,0x0000,0x07,0x03,0x03,0x00,0x01,0x03}, + {0x07,0x0000,0x19,0x02,0x02,0x00,0x01,0x03}, + {0x0d,0x920a,0x0d,0x00,0x00,0x00,0x00,0x04}, + {0x0e,0x820a,0x0e,0x00,0x00,0x00,0x00,0x05}, + {0x0f,0x0202,0x11,0x01,0x01,0x00,0x00,0x05}, + {0x10,0x0212,0x12,0x01,0x01,0x00,0x00,0x05}, + {0x11,0x0212,0x1a,0x04,0x04,0x00,0x00,0x05}, + {0x12,0x0212,0x1b,0x04,0x04,0x00,0x00,0x05}, + {0x13,0x021b,0x1c,0x00,0x00,0x00,0x00,0x04}, + {0x12,0x0010,0x18,0x02,0x02,0x00,0x00,0x05}, + {0x12,0x0210,0x18,0x01,0x01,0x00,0x00,0x05}, + {0xff,0x0000,0x00,0x00,0x00,0x00,0x00,0x00} +}; + +typedef struct _SiS310_StandTableStruct +{ UCHAR CRT_COLS; UCHAR ROWS; UCHAR CHAR_HEIGHT; @@ -44,444 +46,446 @@ typedef struct _SiS310_StandTableStruct { UCHAR GRC[9]; } SiS310_StandTableStruct; -SiS310_StandTableStruct SiS310_StandTable[] = { +SiS310_StandTableStruct SiS310_StandTable[]= +{ /* MD_0_200 */ - { - 0x28, 0x18, 0x08, 0x0800, - {0x09, 0x03, 0x00, 0x02}, - 0x63, - {0x2d, 0x27, 0x28, 0x90, 0x2b, 0xa0, 0xbf, 0x1f, - 0x00, 0xc7, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x14, 0x1f, 0x96, 0xb9, 0xa3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x08, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00, - 0xff} - }, + { + 0x28,0x18,0x08,0x0800, + {0x09,0x03,0x00,0x02}, + 0x63, + {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f, + 0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x14,0x1f,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} + }, /* MD_1_200 */ - { - 0x28, 0x18, 0x08, 0x0800, - {0x09, 0x03, 0x00, 0x02}, - 0x63, - {0x2d, 0x27, 0x28, 0x90, 0x2b, 0xa0, 0xbf, 0x1f, - 0x00, 0xc7, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x14, 0x1f, 0x96, 0xb9, 0xa3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x08, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00, - 0xff} - }, + { + 0x28,0x18,0x08,0x0800, + {0x09,0x03,0x00,0x02}, + 0x63, + {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f, + 0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x14,0x1f,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} + }, /* MD_2_200 */ - { - 0x50, 0x18, 0x08, 0x1000, - {0x01, 0x03, 0x00, 0x02}, - 0x63, - {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f, - 0x00, 0xc7, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x28, 0x1f, 0x96, 0xb9, 0xa3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x08, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00, - 0xff} - }, + { + 0x50,0x18,0x08,0x1000, + {0x01,0x03,0x00,0x02}, + 0x63, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} + }, /* MD_3_200 */ - { - 0x50, 0x18, 0x08, 0x1000, - {0x01, 0x03, 0x00, 0x02}, - 0x63, - {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f, - 0x00, 0xc7, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x28, 0x1f, 0x96, 0xb9, 0xa3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x08, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00, - 0xff} - }, + { + 0x50,0x18,0x08,0x1000, + {0x01,0x03,0x00,0x02}, + 0x63, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} + }, /* MD_4 */ - { - 0x28, 0x18, 0x08, 0x4000, - {0x09, 0x03, 0x00, 0x02}, - 0x63, - {0x2d, 0x27, 0x28, 0x90, 0x2c, 0x80, 0xbf, 0x1f, - 0x00, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x14, 0x00, 0x96, 0xb9, 0xa2, - 0xff}, - {0x00, 0x13, 0x15, 0x17, 0x02, 0x04, 0x06, 0x07, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x01, 0x00, 0x03, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0f, 0x00, - 0xff} - }, + { + 0x28,0x18,0x08,0x4000, + {0x09,0x03,0x00,0x02}, + 0x63, + {0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f, + 0x00,0xc1,0x00,0x00,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x14,0x00,0x96,0xb9,0xa2, + 0xff}, + {0x00,0x13,0x15,0x17,0x02,0x04,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x01,0x00,0x03,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x30,0x0f,0x00, + 0xff} + }, /* MD_5 */ - { - 0x28, 0x18, 0x08, 0x4000, - {0x09, 0x03, 0x00, 0x02}, - 0x63, - {0x2d, 0x27, 0x28, 0x90, 0x2c, 0x80, 0xbf, 0x1f, - 0x00, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x14, 0x00, 0x96, 0xb9, 0xa2, - 0xff}, - {0x00, 0x13, 0x15, 0x17, 0x02, 0x04, 0x06, 0x07, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x01, 0x00, 0x03, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0f, 0x00, - 0xff} - }, + { + 0x28,0x18,0x08,0x4000, + {0x09,0x03,0x00,0x02}, + 0x63, + {0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f, + 0x00,0xc1,0x00,0x00,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x14,0x00,0x96,0xb9,0xa2, + 0xff}, + {0x00,0x13,0x15,0x17,0x02,0x04,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x01,0x00,0x03,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x30,0x0f,0x00, + 0xff} + }, /* MD_6 */ - { - 0x50, 0x18, 0x08, 0x4000, - {0x01, 0x01, 0x00, 0x06}, - 0x63, - {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f, - 0x00, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x28, 0x00, 0x96, 0xb9, 0xc2, - 0xff}, - {0x00, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, - 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, - 0x01, 0x00, 0x01, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, - 0xff} - }, + { + 0x50,0x18,0x08,0x4000, + {0x01,0x01,0x00,0x06}, + 0x63, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0xc1,0x00,0x00,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x28,0x00,0x96,0xb9,0xc2, + 0xff}, + {0x00,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, + 0x01,0x00,0x01,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x0d,0x00, + 0xff} + }, /* MD_7 */ - { - 0x50, 0x18, 0x0e, 0x1000, - {0x00, 0x03, 0x00, 0x03}, - 0xa6, - {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f, - 0x00, 0x4d, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00, - 0x83, 0x85, 0x5d, 0x28, 0x0d, 0x63, 0xba, 0xa3, - 0xff}, - {0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x10, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x0e, 0x00, 0x0f, 0x08}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0a, 0x00, - 0xff} - }, + { + 0x50,0x18,0x0e,0x1000, + {0x00,0x03,0x00,0x03}, + 0xa6, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00, + 0x83,0x85,0x5d,0x28,0x0d,0x63,0xba,0xa3, + 0xff}, + {0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08, + 0x10,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x0e,0x00,0x0f,0x08}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0a,0x00, + 0xff} + }, /* MDA_DAC */ - { - 0x00, 0x00, 0x00, 0x0000, - {0x00, 0x00, 0x00, 0x15}, - 0x15, - {0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, - 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x3f, 0x3f, - 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x00, 0x00, - 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x15, 0x15, - 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, - 0x15, 0x15, 0x15, 0x15}, - {0x15, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, - 0x3f} - }, + { + 0x00,0x00,0x00,0x0000, + {0x00,0x00,0x00,0x15}, + 0x15, + {0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x3f,0x3f, + 0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x00, + 0x00}, + {0x00,0x00,0x00,0x00,0x00,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15}, + {0x15,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3f} + }, /* CGA_DAC */ - { - 0x00, 0x10, 0x04, 0x0114, - {0x11, 0x09, 0x15, 0x00}, - 0x10, - {0x04, 0x14, 0x01, 0x11, 0x09, 0x15, 0x2a, 0x3a, - 0x2e, 0x3e, 0x2b, 0x3b, 0x2f, 0x3f, 0x2a, 0x3a, - 0x2e, 0x3e, 0x2b, 0x3b, 0x2f, 0x3f, 0x00, 0x10, - 0x04}, - {0x14, 0x01, 0x11, 0x09, 0x15, 0x00, 0x10, 0x04, - 0x14, 0x01, 0x11, 0x09, 0x15, 0x2a, 0x3a, 0x2e, - 0x3e, 0x2b, 0x3b, 0x2f}, - {0x3f, 0x2a, 0x3a, 0x2e, 0x3e, 0x2b, 0x3b, 0x2f, - 0x3f} - }, + { + 0x00,0x10,0x04,0x0114, + {0x11,0x09,0x15,0x00}, + 0x10, + {0x04,0x14,0x01,0x11,0x09,0x15,0x2a,0x3a, + 0x2e,0x3e,0x2b,0x3b,0x2f,0x3f,0x2a,0x3a, + 0x2e,0x3e,0x2b,0x3b,0x2f,0x3f,0x00,0x10, + 0x04}, + {0x14,0x01,0x11,0x09,0x15,0x00,0x10,0x04, + 0x14,0x01,0x11,0x09,0x15,0x2a,0x3a,0x2e, + 0x3e,0x2b,0x3b,0x2f}, + {0x3f,0x2a,0x3a,0x2e,0x3e,0x2b,0x3b,0x2f, + 0x3f} + }, /* EGA_DAC */ - { - 0x00, 0x10, 0x04, 0x0114, - {0x11, 0x05, 0x15, 0x20}, - 0x30, - {0x24, 0x34, 0x21, 0x31, 0x25, 0x35, 0x08, 0x18, - 0x0c, 0x1c, 0x09, 0x19, 0x0d, 0x1d, 0x28, 0x38, - 0x2c, 0x3c, 0x29, 0x39, 0x2d, 0x3d, 0x02, 0x12, - 0x06}, - {0x16, 0x03, 0x13, 0x07, 0x17, 0x22, 0x32, 0x26, - 0x36, 0x23, 0x33, 0x27, 0x37, 0x0a, 0x1a, 0x0e, - 0x1e, 0x0b, 0x1b, 0x0f}, - {0x1f, 0x2a, 0x3a, 0x2e, 0x3e, 0x2b, 0x3b, 0x2f, - 0x3f} - }, + { + 0x00,0x10,0x04,0x0114, + {0x11,0x05,0x15,0x20}, + 0x30, + {0x24,0x34,0x21,0x31,0x25,0x35,0x08,0x18, + 0x0c,0x1c,0x09,0x19,0x0d,0x1d,0x28,0x38, + 0x2c,0x3c,0x29,0x39,0x2d,0x3d,0x02,0x12, + 0x06}, + {0x16,0x03,0x13,0x07,0x17,0x22,0x32,0x26, + 0x36,0x23,0x33,0x27,0x37,0x0a,0x1a,0x0e, + 0x1e,0x0b,0x1b,0x0f}, + {0x1f,0x2a,0x3a,0x2e,0x3e,0x2b,0x3b,0x2f, + 0x3f} + }, /* VGA_DAC */ - { - 0x00, 0x10, 0x04, 0x0114, - {0x11, 0x09, 0x15, 0x2a}, - 0x3a, - {0x2e, 0x3e, 0x2b, 0x3b, 0x2f, 0x3f, 0x00, 0x05, - 0x08, 0x0b, 0x0e, 0x11, 0x14, 0x18, 0x1c, 0x20, - 0x24, 0x28, 0x2d, 0x32, 0x38, 0x3f, 0x00, 0x10, - 0x1f}, - {0x2f, 0x3f, 0x1f, 0x27, 0x2f, 0x37, 0x3f, 0x2d, - 0x31, 0x36, 0x3a, 0x3f, 0x00, 0x07, 0x0e, 0x15, - 0x1c, 0x0e, 0x11, 0x15}, - {0x18, 0x1c, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x00, - 0x04} - }, - { - 0x08, 0x0c, 0x10, 0x0a08, - {0x0c, 0x0e, 0x10, 0x0b}, - 0x0c, - {0x0d, 0x0f, 0x10, 0x10, 0x01, 0x08, 0x00, 0x00, - 0x00, 0x00, 0x01, 0x00, 0x02, 0x02, 0x01, 0x00, - 0x04, 0x04, 0x01, 0x00, 0x05, 0x02, 0x05, 0x00, - 0x06}, - {0x01, 0x06, 0x05, 0x06, 0x00, 0x08, 0x01, 0x08, - 0x00, 0x07, 0x02, 0x07, 0x06, 0x07, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00} - }, + { + 0x00,0x10,0x04,0x0114, + {0x11,0x09,0x15,0x2a}, + 0x3a, + {0x2e,0x3e,0x2b,0x3b,0x2f,0x3f,0x00,0x05, + 0x08,0x0b,0x0e,0x11,0x14,0x18,0x1c,0x20, + 0x24,0x28,0x2d,0x32,0x38,0x3f,0x00,0x10, + 0x1f}, + {0x2f,0x3f,0x1f,0x27,0x2f,0x37,0x3f,0x2d, + 0x31,0x36,0x3a,0x3f,0x00,0x07,0x0e,0x15, + 0x1c,0x0e,0x11,0x15}, + {0x18,0x1c,0x14,0x16,0x18,0x1a,0x1c,0x00, + 0x04} + }, + { + 0x08,0x0c,0x10,0x0a08, + {0x0c,0x0e,0x10,0x0b}, + 0x0c, + {0x0d,0x0f,0x10,0x10,0x01,0x08,0x00,0x00, + 0x00,0x00,0x01,0x00,0x02,0x02,0x01,0x00, + 0x04,0x04,0x01,0x00,0x05,0x02,0x05,0x00, + 0x06}, + {0x01,0x06,0x05,0x06,0x00,0x08,0x01,0x08, + 0x00,0x07,0x02,0x07,0x06,0x07,0x00,0x00, + 0x00,0x00,0x00,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00} + }, /* MD_D */ - { - 0x28, 0x18, 0x08, 0x2000, - {0x09, 0x0f, 0x00, 0x06}, - 0x63, - {0x2d, 0x27, 0x28, 0x90, 0x2c, 0x80, 0xbf, 0x1f, - 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x14, 0x00, 0x96, 0xb9, 0xe3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x01, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0f, - 0xff} - }, + { + 0x28,0x18,0x08,0x2000, + {0x09,0x0f,0x00,0x06}, + 0x63, + {0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f, + 0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x14,0x00,0x96,0xb9,0xe3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x01,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f, + 0xff} + }, /* MD_E */ - { - 0x50, 0x18, 0x08, 0x4000, - {0x01, 0x0f, 0x00, 0x06}, - 0x63, - {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f, - 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x28, 0x00, 0x96, 0xb9, 0xe3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x01, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0f, - 0xff} - }, + { + 0x50,0x18,0x08,0x4000, + {0x01,0x0f,0x00,0x06}, + 0x63, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x28,0x00,0x96,0xb9,0xe3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x01,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f, + 0xff} + }, /* ExtVGATable */ - { - 0x00, 0x00, 0x00, 0x0000, - {0x01, 0x0f, 0x00, 0x0e}, - 0x23, - {0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0x0b, 0x3e, - 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xea, 0x8c, 0xdf, 0x28, 0x40, 0xe7, 0x04, 0xa3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x01, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0f, - 0xff} - }, + { + 0x00,0x00,0x00,0x0000, + {0x01,0x0f,0x00,0x0e}, + 0x23, + {0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e, + 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 0xea,0x8c,0xdf,0x28,0x40,0xe7,0x04,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, + 0x01,0x00,0x00,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0f, + 0xff} + }, /* ROM_SAVEPTR */ - { - 0x9f, 0x3b, 0x00, 0x00c0, - {0x00, 0x00, 0x00, 0x00}, - 0x00, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbb, 0x3f, - 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x1a, 0x00, 0xac, 0x3e, 0x00, 0xc0, - 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00} - }, + { + 0x9f,0x3b,0x00,0x00c0, + {0x00,0x00,0x00,0x00}, + 0x00, + {0x00,0x00,0x00,0x00,0x00,0x00,0xbb,0x3f, + 0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x1a,0x00,0xac,0x3e,0x00,0xc0, + 0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00} + }, /* MD_F */ - { - 0x50, 0x18, 0x0e, 0x8000, - {0x01, 0x0f, 0x00, 0x06}, - 0xa2, - {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f, - 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x82, 0x84, 0x5d, 0x28, 0x0f, 0x63, 0xba, 0xe3, - 0xff}, - {0x00, 0x08, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, - 0x00, 0x08, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, - 0x0b, 0x00, 0x05, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x05, - 0xff} - }, + { + 0x50,0x18,0x0e,0x8000, + {0x01,0x0f,0x00,0x06}, + 0xa2, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 0x82,0x84,0x5d,0x28,0x0f,0x63,0xba,0xe3, + 0xff}, + {0x00,0x08,0x00,0x00,0x18,0x18,0x00,0x00, + 0x00,0x08,0x00,0x00,0x00,0x18,0x00,0x00, + 0x0b,0x00,0x05,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x05, + 0xff} + }, /* MD_10 */ - { - 0x50, 0x18, 0x0e, 0x8000, - {0x01, 0x0f, 0x00, 0x06}, - 0xa3, - {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f, - 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x82, 0x84, 0x5d, 0x28, 0x0f, 0x63, 0xba, 0xe3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, - 0x01, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0f, - 0xff} - }, + { + 0x50,0x18,0x0e,0x8000, + {0x01,0x0f,0x00,0x06}, + 0xa3, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 0x82,0x84,0x5d,0x28,0x0f,0x63,0xba,0xe3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x01,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f, + 0xff} + }, /* MD_0_350 */ - { - 0x28, 0x18, 0x0e, 0x0800, - {0x09, 0x03, 0x00, 0x02}, - 0xa3, - {0x2d, 0x27, 0x28, 0x90, 0x2b, 0xb1, 0xbf, 0x1f, - 0x00, 0x4d, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00, - 0x83, 0x85, 0x5d, 0x14, 0x1f, 0x63, 0xba, 0xa3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, - 0x08, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00, - 0xff} - }, + { + 0x28,0x18,0x0e,0x0800, + {0x09,0x03,0x00,0x02}, + 0xa3, + {0x2d,0x27,0x28,0x90,0x2b,0xb1,0xbf,0x1f, + 0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00, + 0x83,0x85,0x5d,0x14,0x1f,0x63,0xba,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} + }, /* MD_1_350 */ - { - 0x28, 0x18, 0x0e, 0x0800, - {0x09, 0x03, 0x00, 0x02}, - 0xa3, - {0x2d, 0x27, 0x28, 0x90, 0x2b, 0xa0, 0xbf, 0x1f, - 0x00, 0x4d, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00, - 0x83, 0x85, 0x5d, 0x14, 0x1f, 0x63, 0xba, 0xa3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, - 0x08, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00, - 0xff} - }, + { + 0x28,0x18,0x0e,0x0800, + {0x09,0x03,0x00,0x02}, + 0xa3, + {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f, + 0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00, + 0x83,0x85,0x5d,0x14,0x1f,0x63,0xba,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} + }, /* MD_2_350 */ - { - 0x50, 0x18, 0x0e, 0x1000, - {0x01, 0x03, 0x00, 0x02}, - 0xa3, - {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f, - 0x00, 0x4d, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00, - 0x83, 0x85, 0x5d, 0x28, 0x1f, 0x63, 0xba, 0xa3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, - 0x08, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00, - 0xff} - }, + { + 0x50,0x18,0x0e,0x1000, + {0x01,0x03,0x00,0x02}, + 0xa3, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00, + 0x83,0x85,0x5d,0x28,0x1f,0x63,0xba,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} + }, /* MD_3_350 */ - { - 0x50, 0x18, 0x0e, 0x1000, - {0x01, 0x03, 0x00, 0x02}, - 0xa3, - {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f, - 0x00, 0x4d, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00, - 0x83, 0x85, 0x5d, 0x28, 0x1f, 0x63, 0xba, 0xa3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, - 0x08, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00, - 0xff} - }, + { + 0x50,0x18,0x0e,0x1000, + {0x01,0x03,0x00,0x02}, + 0xa3, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00, + 0x83,0x85,0x5d,0x28,0x1f,0x63,0xba,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x08,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} + }, /* MD_0_1_400 */ - { - 0x28, 0x18, 0x10, 0x0800, - {0x08, 0x03, 0x00, 0x02}, - 0x67, - {0x2d, 0x27, 0x28, 0x90, 0x2b, 0xb1, 0xbf, 0x1f, - 0x00, 0x4f, 0x0d, 0x0e, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x14, 0x1f, 0x96, 0xb9, 0xa3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, - 0x0c, 0x00, 0x0f, 0x08}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00, - 0xff} - }, + { + 0x28,0x18,0x10,0x0800, + {0x08,0x03,0x00,0x02}, + 0x67, + {0x2d,0x27,0x28,0x90,0x2b,0xb1,0xbf,0x1f, + 0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x14,0x1f,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x0c,0x00,0x0f,0x08}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} + }, /* MD_2_3_400 */ - { - 0x50, 0x18, 0x10, 0x1000, - {0x00, 0x03, 0x00, 0x02}, - 0x67, - {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f, - 0x00, 0x4f, 0x0d, 0x0e, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x28, 0x1f, 0x96, 0xb9, 0xa3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, - 0x0c, 0x00, 0x0f, 0x08}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00, - 0xff} - }, + { + 0x50,0x18,0x10,0x1000, + {0x00,0x03,0x00,0x02}, + 0x67, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x0c,0x00,0x0f,0x08}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, + 0xff} + }, /* MD_7_400 */ - { - 0x50, 0x18, 0x10, 0x1000, - {0x00, 0x03, 0x00, 0x02}, - 0x66, - {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f, - 0x00, 0x4f, 0x0d, 0x0e, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x28, 0x0f, 0x96, 0xb9, 0xa3, - 0xff}, - {0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x10, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x0e, 0x00, 0x0f, 0x08}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0a, 0x00, - 0xff} - }, + { + 0x50,0x18,0x10,0x1000, + {0x00,0x03,0x00,0x02}, + 0x66, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x28,0x0f,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08, + 0x10,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x0e,0x00,0x0f,0x08}, + {0x00,0x00,0x00,0x00,0x00,0x10,0x0a,0x00, + 0xff} + }, /* MD_11 */ - { - 0x50, 0x1d, 0x10, 0xa000, - {0x01, 0x0f, 0x00, 0x06}, - 0xe3, - {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0x0b, 0x3e, - 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xe9, 0x8b, 0xdf, 0x28, 0x00, 0xe7, 0x04, 0xc3, - 0xff}, - {0x00, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, - 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, - 0x01, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x01, - 0xff} - }, + { + 0x50,0x1d,0x10,0xa000, + {0x01,0x0f,0x00,0x06}, + 0xe3, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0x0b,0x3e, + 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 0xe9,0x8b,0xdf,0x28,0x00,0xe7,0x04,0xc3, + 0xff}, + {0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x01,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x01, + 0xff} + }, /* ExtEGATable */ - { - 0x50, 0x1d, 0x10, 0xa000, - {0x01, 0x0f, 0x00, 0x06}, - 0xe3, - {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0x0b, 0x3e, - 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xe9, 0x8b, 0xdf, 0x28, 0x00, 0xe7, 0x04, 0xe3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, - 0x01, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0f, - 0xff} - }, + { + 0x50,0x1d,0x10,0xa000, + {0x01,0x0f,0x00,0x06}, + 0xe3, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0x0b,0x3e, + 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 0xe9,0x8b,0xdf,0x28,0x00,0xe7,0x04,0xe3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, + 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, + 0x01,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f, + 0xff} + }, /* MD_13 */ - { - 0x28, 0x18, 0x08, 0x2000, - {0x01, 0x0f, 0x00, 0x0e}, - 0x63, - {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f, - 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x8e, 0x8f, 0x28, 0x40, 0x96, 0xb9, 0xa3, - 0xff}, - {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x41, 0x00, 0x0f, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0f, - 0xff} - } -}; - -typedef struct _SiS310_ExtStruct { + { + 0x28,0x18,0x08,0x2000, + {0x01,0x0f,0x00,0x0e}, + 0x63, + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00, + 0x9c,0x8e,0x8f,0x28,0x40,0x96,0xb9,0xa3, + 0xff}, + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, + 0x41,0x00,0x0f,0x00}, + {0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0f, + 0xff} + } +}; + +typedef struct _SiS310_ExtStruct +{ UCHAR Ext_ModeID; USHORT Ext_ModeFlag; USHORT Ext_ModeInfo; @@ -494,632 +498,599 @@ typedef struct _SiS310_ExtStruct { UCHAR VB_ExtTVYFilterIndex; UCHAR REFindex; } SiS310_ExtStruct; -SiS310_ExtStruct SiS310_EModeIDTable[] = { - - {0x6a, 0x2212, 0x0407, 0x3a81, 0x0102, 0x08, 0x07, 0x00, 0x00, 0x07, - 0x00}, - {0x2e, 0x0a1b, 0x0306, 0x3a57, 0x0101, 0x08, 0x06, 0x00, 0x00, 0x05, - 0x08}, - {0x2f, 0x0a1b, 0x0305, 0x3a50, 0x0100, 0x08, 0x05, 0x00, 0x00, 0x05, - 0x10}, - {0x30, 0x2a1b, 0x0407, 0x3a81, 0x0103, 0x08, 0x07, 0x00, 0x00, 0x07, - 0x00}, - {0x31, 0x0a1b, 0x030d, 0x3b85, 0x0000, 0x08, 0x0d, 0x00, 0x00, 0x06, - 0x11}, - {0x32, 0x0a1b, 0x0a0e, 0x3b8c, 0x0000, 0x08, 0x0e, 0x00, 0x00, 0x06, - 0x12}, - {0x33, 0x0a1d, 0x0a0d, 0x3b85, 0x0000, 0x08, 0x0d, 0x00, 0x00, 0x06, - 0x11}, - {0x34, 0x2a1d, 0x0a0e, 0x3b8c, 0x0000, 0x08, 0x0e, 0x00, 0x00, 0x06, - 0x12}, - {0x35, 0x0a1f, 0x0a0d, 0x3b85, 0x0000, 0x08, 0x0d, 0x00, 0x00, 0x06, - 0x11}, - {0x36, 0x2a1f, 0x0a0e, 0x3b8c, 0x0000, 0x08, 0x0e, 0x00, 0x00, 0x06, - 0x12}, - {0x37, 0x0212, 0x0508, 0x3aab, 0x0104, 0x08, 0x08, 0x00, 0x00, 0x00, - 0x13}, - {0x38, 0x0a1b, 0x0508, 0x3aab, 0x0105, 0x08, 0x08, 0x00, 0x00, 0x00, - 0x13}, - {0x3a, 0x0e3b, 0x0609, 0x3adc, 0x0107, 0x08, 0x09, 0x00, 0x00, 0x00, - 0x1a}, - {0x3c, 0x063b, 0x070a, 0x3af2, 0x0130, 0x08, 0x0a, 0x00, 0x00, 0x00, - 0x1e}, - {0x3d, 0x067d, 0x070a, 0x3af2, 0x0131, 0x08, 0x0a, 0x00, 0x00, 0x00, - 0x1e}, - {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}, - {0x44, 0x0a1d, 0x0306, 0x3a57, 0x0111, 0x08, 0x06, 0x00, 0x00, 0x05, - 0x08}, - {0x46, 0x2a1c, 0x0407, 0x3a81, 0x0113, 0x08, 0x07, 0x00, 0x00, 0x07, - 0x00}, - {0x47, 0x2a1d, 0x0407, 0x3a81, 0x0114, 0x08, 0x07, 0x00, 0x00, 0x07, - 0x00}, - {0x49, 0x0a3c, 0x0508, 0x3aab, 0x0116, 0x08, 0x08, 0x00, 0x00, 0x00, - 0x13}, - {0x4a, 0x0a3d, 0x0508, 0x3aab, 0x0117, 0x08, 0x08, 0x00, 0x00, 0x00, - 0x13}, - {0x4c, 0x0e7c, 0x0609, 0x3adc, 0x0119, 0x08, 0x09, 0x00, 0x00, 0x00, - 0x1a}, - {0x4d, 0x0e7d, 0x0609, 0x3adc, 0x011a, 0x08, 0x09, 0x00, 0x00, 0x00, - 0x1a}, - {0x50, 0x9a1b, 0x0001, 0x3a3b, 0x0132, 0x08, 0x01, 0x00, 0x00, 0x04, - 0x26}, - {0x51, 0xba1b, 0x0103, 0x3a42, 0x0133, 0x08, 0x03, 0x00, 0x00, 0x07, - 0x27}, - {0x52, 0x9a1b, 0x0204, 0x3a49, 0x0134, 0x08, 0x04, 0x00, 0x00, 0x00, - 0x28}, - {0x56, 0x9a1d, 0x0001, 0x3a3b, 0x0135, 0x08, 0x01, 0x00, 0x00, 0x04, - 0x26}, - {0x57, 0xba1d, 0x0103, 0x3a42, 0x0136, 0x08, 0x03, 0x00, 0x00, 0x07, - 0x27}, - {0x58, 0x9a1d, 0x0204, 0x3a49, 0x0137, 0x08, 0x04, 0x00, 0x00, 0x00, - 0x28}, - {0x59, 0x9a1b, 0x0000, 0x3a34, 0x0138, 0x08, 0x00, 0x00, 0x00, 0x04, - 0x25}, - {0x5d, 0x0a1d, 0x0305, 0x3a50, 0x0139, 0x08, 0x05, 0x00, 0x00, 0x07, - 0x10}, - {0x62, 0x0a3f, 0x0306, 0x3a57, 0x013a, 0x08, 0x06, 0x00, 0x00, 0x05, - 0x08}, - {0x63, 0x2a3f, 0x0407, 0x3a81, 0x013b, 0x08, 0x07, 0x00, 0x00, 0x07, - 0x00}, - {0x64, 0x0a7f, 0x0508, 0x3aab, 0x013c, 0x08, 0x08, 0x00, 0x00, 0x00, - 0x13}, - {0x65, 0x0eff, 0x0609, 0x3adc, 0x013d, 0x08, 0x09, 0x00, 0x00, 0x00, - 0x1a}, - {0x66, 0x06ff, 0x070a, 0x3af2, 0x013e, 0x08, 0x0a, 0x00, 0x00, 0x00, - 0x1e}, - {0x68, 0x067b, 0x080b, 0x3b17, 0x013f, 0x08, 0x0b, 0x00, 0x00, 0x00, - 0x29}, - {0x69, 0x06fd, 0x080b, 0x3b17, 0x0140, 0x08, 0x0b, 0x00, 0x00, 0x00, - 0x29}, - {0x6b, 0x07ff, 0x080b, 0x3b17, 0x0141, 0x10, 0x0b, 0x00, 0x00, 0x00, - 0x29}, - {0x6c, 0x067b, 0x090c, 0x3b37, 0x0000, 0x08, 0x0c, 0x00, 0x00, 0x00, - 0x2f}, - {0x6d, 0x06fd, 0x090c, 0x3b37, 0x0000, 0x10, 0x0c, 0x00, 0x00, 0x00, - 0x2f}, - {0x6e, 0x07ff, 0x090c, 0x3b37, 0x0000, 0x10, 0x0c, 0x00, 0x00, 0x00, - 0x2f}, - {0x70, 0x2a1b, 0x0410, 0x3b52, 0x0000, 0x08, 0x10, 0x00, 0x00, 0x07, - 0x34}, - {0x71, 0x0a1b, 0x0511, 0x3b63, 0x0000, 0x08, 0x11, 0x00, 0x00, 0x00, - 0x37}, - {0x74, 0x0a1d, 0x0511, 0x3b63, 0x0000, 0x08, 0x11, 0x00, 0x00, 0x00, - 0x37}, - {0x75, 0x0a3d, 0x0612, 0x3b74, 0x0000, 0x08, 0x12, 0x00, 0x00, 0x00, - 0x3a}, - {0x76, 0x2a1f, 0x0410, 0x3b52, 0x0000, 0x08, 0x10, 0x00, 0x00, 0x07, - 0x34}, - {0x77, 0x0a1f, 0x0511, 0x3b63, 0x0000, 0x08, 0x11, 0x00, 0x00, 0x00, - 0x37}, - {0x78, 0x0a3f, 0x0612, 0x3b74, 0x0000, 0x08, 0x12, 0x00, 0x00, 0x00, - 0x3a}, - {0x79, 0x0a3b, 0x0612, 0x3b74, 0x0000, 0x08, 0x12, 0x00, 0x00, 0x00, - 0x3a}, - {0x7a, 0x2a1d, 0x0410, 0x3b52, 0x0000, 0x08, 0x10, 0x00, 0x00, 0x07, - 0x34}, - {0x7b, 0x0e3b, 0x060f, 0x3ad0, 0x0000, 0x08, 0x0f, 0x00, 0x00, 0x00, - 0x3d}, - {0x7c, 0x0e7d, 0x060f, 0x3ad0, 0x0000, 0x08, 0x0f, 0x00, 0x00, 0x00, - 0x3d}, - {0x7d, 0x0eff, 0x060f, 0x3ad0, 0x0000, 0x08, 0x0f, 0x00, 0x00, 0x00, - 0x3d}, - {0xff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00} -}; - -typedef struct _SiS310_Ext2Struct { + +SiS310_ExtStruct SiS310_EModeIDTable[]= +{ + {0x6a,0x2212,0x0407,0x3a81,0x0102,0x08,0x07,0x00,0x00,0x07,0x00}, + {0x2e,0x0a1b,0x0306,0x3a57,0x0101,0x08,0x06,0x00,0x00,0x05,0x08}, + {0x2f,0x0a1b,0x0305,0x3a50,0x0100,0x08,0x05,0x00,0x00,0x05,0x10}, + {0x30,0x2a1b,0x0407,0x3a81,0x0103,0x08,0x07,0x00,0x00,0x07,0x00}, + {0x31,0x0a1b,0x030d,0x3b85,0x0000,0x08,0x0d,0x00,0x00,0x06,0x11}, + {0x32,0x0a1b,0x0a0e,0x3b8c,0x0000,0x08,0x0e,0x00,0x00,0x06,0x12}, + {0x33,0x0a1d,0x0a0d,0x3b85,0x0000,0x08,0x0d,0x00,0x00,0x06,0x11}, + {0x34,0x2a1d,0x0a0e,0x3b8c,0x0000,0x08,0x0e,0x00,0x00,0x06,0x12}, + {0x35,0x0a1f,0x0a0d,0x3b85,0x0000,0x08,0x0d,0x00,0x00,0x06,0x11}, + {0x36,0x2a1f,0x0a0e,0x3b8c,0x0000,0x08,0x0e,0x00,0x00,0x06,0x12}, + {0x37,0x0212,0x0508,0x3aab,0x0104,0x08,0x08,0x00,0x00,0x00,0x13}, + {0x38,0x0a1b,0x0508,0x3aab,0x0105,0x08,0x08,0x00,0x00,0x00,0x13}, + {0x3a,0x0e3b,0x0609,0x3adc,0x0107,0x08,0x09,0x00,0x00,0x00,0x1a}, + {0x3c,0x063b,0x070a,0x3af2,0x0130,0x08,0x0a,0x00,0x00,0x00,0x1e}, + {0x3d,0x067d,0x070a,0x3af2,0x0131,0x08,0x0a,0x00,0x00,0x00,0x1e}, + {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}, + {0x44,0x0a1d,0x0306,0x3a57,0x0111,0x08,0x06,0x00,0x00,0x05,0x08}, + {0x46,0x2a1c,0x0407,0x3a81,0x0113,0x08,0x07,0x00,0x00,0x07,0x00}, + {0x47,0x2a1d,0x0407,0x3a81,0x0114,0x08,0x07,0x00,0x00,0x07,0x00}, + {0x49,0x0a3c,0x0508,0x3aab,0x0116,0x08,0x08,0x00,0x00,0x00,0x13}, + {0x4a,0x0a3d,0x0508,0x3aab,0x0117,0x08,0x08,0x00,0x00,0x00,0x13}, + {0x4c,0x0e7c,0x0609,0x3adc,0x0119,0x08,0x09,0x00,0x00,0x00,0x1a}, + {0x4d,0x0e7d,0x0609,0x3adc,0x011a,0x08,0x09,0x00,0x00,0x00,0x1a}, + {0x50,0x9a1b,0x0001,0x3a3b,0x0132,0x08,0x01,0x00,0x00,0x04,0x26}, + {0x51,0xba1b,0x0103,0x3a42,0x0133,0x08,0x03,0x00,0x00,0x07,0x27}, + {0x52,0x9a1b,0x0204,0x3a49,0x0134,0x08,0x04,0x00,0x00,0x00,0x28}, + {0x56,0x9a1d,0x0001,0x3a3b,0x0135,0x08,0x01,0x00,0x00,0x04,0x26}, + {0x57,0xba1d,0x0103,0x3a42,0x0136,0x08,0x03,0x00,0x00,0x07,0x27}, + {0x58,0x9a1d,0x0204,0x3a49,0x0137,0x08,0x04,0x00,0x00,0x00,0x28}, + {0x59,0x9a1b,0x0000,0x3a34,0x0138,0x08,0x00,0x00,0x00,0x04,0x25}, + {0x5d,0x0a1d,0x0305,0x3a50,0x0139,0x08,0x05,0x00,0x00,0x07,0x10}, + {0x62,0x0a3f,0x0306,0x3a57,0x013a,0x08,0x06,0x00,0x00,0x05,0x08}, + {0x63,0x2a3f,0x0407,0x3a81,0x013b,0x08,0x07,0x00,0x00,0x07,0x00}, + {0x64,0x0a7f,0x0508,0x3aab,0x013c,0x08,0x08,0x00,0x00,0x00,0x13}, + {0x65,0x0eff,0x0609,0x3adc,0x013d,0x08,0x09,0x00,0x00,0x00,0x1a}, + {0x66,0x06ff,0x070a,0x3af2,0x013e,0x08,0x0a,0x00,0x00,0x00,0x1e}, + {0x68,0x067b,0x080b,0x3b17,0x013f,0x08,0x0b,0x00,0x00,0x00,0x29}, + {0x69,0x06fd,0x080b,0x3b17,0x0140,0x08,0x0b,0x00,0x00,0x00,0x29}, + {0x6b,0x07ff,0x080b,0x3b17,0x0141,0x10,0x0b,0x00,0x00,0x00,0x29}, + {0x6c,0x067b,0x090c,0x3b37,0x0000,0x08,0x0c,0x00,0x00,0x00,0x2f}, + {0x6d,0x06fd,0x090c,0x3b37,0x0000,0x10,0x0c,0x00,0x00,0x00,0x2f}, + {0x6e,0x07ff,0x090c,0x3b37,0x0000,0x10,0x0c,0x00,0x00,0x00,0x2f}, + {0x70,0x2a1b,0x0410,0x3b52,0x0000,0x08,0x10,0x00,0x00,0x07,0x34}, + {0x71,0x0a1b,0x0511,0x3b63,0x0000,0x08,0x11,0x00,0x00,0x00,0x37}, + {0x74,0x0a1d,0x0511,0x3b63,0x0000,0x08,0x11,0x00,0x00,0x00,0x37}, + {0x75,0x0a3d,0x0612,0x3b74,0x0000,0x08,0x12,0x00,0x00,0x00,0x3a}, + {0x76,0x2a1f,0x0410,0x3b52,0x0000,0x08,0x10,0x00,0x00,0x07,0x34}, + {0x77,0x0a1f,0x0511,0x3b63,0x0000,0x08,0x11,0x00,0x00,0x00,0x37}, + {0x78,0x0a3f,0x0612,0x3b74,0x0000,0x08,0x12,0x00,0x00,0x00,0x3a}, + {0x79,0x0a3b,0x0612,0x3b74,0x0000,0x08,0x12,0x00,0x00,0x00,0x3a}, + {0x7a,0x2a1d,0x0410,0x3b52,0x0000,0x08,0x10,0x00,0x00,0x07,0x34}, + {0x7b,0x0e3b,0x060f,0x3ad0,0x0000,0x08,0x0f,0x00,0x00,0x00,0x3d}, + {0x7c,0x0e7d,0x060f,0x3ad0,0x0000,0x08,0x0f,0x00,0x00,0x00,0x3d}, + {0x7d,0x0eff,0x060f,0x3ad0,0x0000,0x08,0x0f,0x00,0x00,0x00,0x3d}, + {0xff,0x0000,0x0000,0x0000,0x0000,0x00,0x00,0x00,0x00,0x00,0x00} +}; + +typedef struct _SiS310_Ext2Struct +{ USHORT Ext_InfoFlag; UCHAR Ext_CRT1CRTC; UCHAR Ext_CRTVCLK; UCHAR Ext_CRT2CRTC; - UCHAR ModeID; + UCHAR ModeID; USHORT XRes; USHORT YRes; USHORT ROM_OFFSET; } SiS310_Ext2Struct; -SiS310_Ext2Struct SiS310_RefIndex[] = { - {0x005f, 0x0d, 0x03, 0x05, 0x6a, 800, 600, 0x3a81}, /* 0x0 */ - {0x0467, 0x0e, 0x04, 0x05, 0x6a, 800, 600, 0x3a86}, /* 0x1 */ - {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 */ - {0xc05f, 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, 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 */ - {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 */ - {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 */ - {0x0007, 0x1f, 0x20, 0x00, 0x3a, 1280, 1024, 0x3aeb}, /* 0x1d */ - {0x0007, 0x20, 0x21, 0x00, 0x3c, 1600, 1200, 0x3af2}, /* 0x1e */ - {0x0007, 0x21, 0x22, 0x00, 0x3c, 1600, 1200, 0x3af7}, /* 0x1f */ - {0x0007, 0x22, 0x23, 0x00, 0x3c, 1600, 1200, 0x3afc}, /* 0x20 */ - {0x0007, 0x23, 0x25, 0x00, 0x3c, 1600, 1200, 0x3b01}, /* 0x21 */ - {0x0007, 0x24, 0x26, 0x00, 0x3c, 1600, 1200, 0x3b06}, /* 0x22 */ - {0x0007, 0x25, 0x2c, 0x00, 0x3c, 1600, 1200, 0x3b0b}, /* 0x23 */ - {0x0007, 0x26, 0x34, 0x00, 0x3c, 1600, 1200, 0x3b10}, /* 0x24 */ - {0x407f, 0x00, 0x00, 0x00, 0x40, 320, 200, 0x3a34}, /* 0x25 */ - {0xc07f, 0x01, 0x00, 0x04, 0x50, 320, 240, 0x3a3b}, /* 0x26 */ - {0x007f, 0x02, 0x04, 0x05, 0x51, 400, 300, 0x3a42}, /* 0x27 */ - {0xc077, 0x03, 0x0b, 0x06, 0x52, 512, 384, 0x3a49}, /* 0x28 */ - {0x8007, 0x27, 0x27, 0x00, 0x68, 1920, 1440, 0x3b17}, /* 0x29 */ - {0x4007, 0x28, 0x29, 0x00, 0x68, 1920, 1440, 0x3b1c}, /* 0x2a */ - {0x4007, 0x29, 0x2e, 0x00, 0x68, 1920, 1440, 0x3b21}, /* 0x2b */ - {0x4007, 0x2a, 0x30, 0x00, 0x68, 1920, 1440, 0x3b26}, /* 0x2c */ - {0x4007, 0x2b, 0x35, 0x00, 0x68, 1920, 1440, 0x3b2b}, /* 0x2d */ - {0x4005, 0x2c, 0x39, 0x00, 0x68, 1920, 1440, 0x3b30}, /* 0x2e */ - {0x4007, 0x2d, 0x2b, 0x00, 0x6c, 2048, 1536, 0x3b37}, /* 0x2f */ - {0x4007, 0x2e, 0x31, 0x00, 0x6c, 2048, 1536, 0x3b3c}, /* 0x30 */ - {0x4007, 0x2f, 0x33, 0x00, 0x6c, 2048, 1536, 0x3b41}, /* 0x31 */ - {0x4007, 0x30, 0x37, 0x00, 0x6c, 2048, 1536, 0x3b46}, /* 0x32 */ - {0x4005, 0x31, 0x38, 0x00, 0x6c, 2048, 1536, 0x3b4b}, /* 0x33 */ - {0x0057, 0x32, 0x40, 0x08, 0x70, 800, 480, 0x3b52}, /* 0x34 */ - {0x0047, 0x33, 0x07, 0x08, 0x70, 800, 480, 0x3b57}, /* 0x35 */ - {0x0047, 0x34, 0x0a, 0x08, 0x70, 800, 480, 0x3b5c}, /* 0x36 */ - {0x0057, 0x35, 0x0b, 0x09, 0x71, 1024, 576, 0x3b63}, /* 0x37 */ - {0x0047, 0x36, 0x11, 0x09, 0x71, 1024, 576, 0x3b68}, /* 0x38 */ - {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, 0x7b, 1280, 960, 0x3ad0}, /* 0x3d */ - {0x0027, 0x3b, 0x19, 0x08, 0x7b, 1280, 960, 0x3ad5}, /* 0x3e */ - {0xffff, 0x00, 0x00, 0x00, 0x00, 0000, 0000, 0x0000} -}; - -typedef struct _SiS310_CRT1TableStruct { +SiS310_Ext2Struct SiS310_RefIndex[]= +{ + {0x005f,0x0d,0x03,0x05,0x6a, 800, 600,0x3a81}, /* 0x0 */ + {0x0467,0x0e,0x04,0x05,0x6a, 800, 600,0x3a86}, /* 0x1 */ + {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 */ + {0xc05f,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,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*/ + {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 */ + {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 */ + {0x0007,0x1f,0x20,0x00,0x3a,1280,1024,0x3aeb}, /* 0x1d */ + {0x0007,0x20,0x21,0x00,0x3c,1600,1200,0x3af2}, /* 0x1e */ + {0x0007,0x21,0x22,0x00,0x3c,1600,1200,0x3af7}, /* 0x1f */ + {0x0007,0x22,0x23,0x00,0x3c,1600,1200,0x3afc}, /* 0x20 */ + {0x0007,0x23,0x25,0x00,0x3c,1600,1200,0x3b01}, /* 0x21 */ + {0x0007,0x24,0x26,0x00,0x3c,1600,1200,0x3b06}, /* 0x22 */ + {0x0007,0x25,0x2c,0x00,0x3c,1600,1200,0x3b0b}, /* 0x23 */ + {0x0007,0x26,0x34,0x00,0x3c,1600,1200,0x3b10}, /* 0x24 */ + {0x407f,0x00,0x00,0x00,0x40, 320, 200,0x3a34}, /* 0x25 */ + {0xc07f,0x01,0x00,0x04,0x50, 320, 240,0x3a3b}, /* 0x26 */ + {0x007f,0x02,0x04,0x05,0x51, 400, 300,0x3a42}, /* 0x27 */ + {0xc077,0x03,0x0b,0x06,0x52, 512, 384,0x3a49}, /* 0x28 */ + {0x8007,0x27,0x27,0x00,0x68,1920,1440,0x3b17}, /* 0x29 */ + {0x4007,0x28,0x29,0x00,0x68,1920,1440,0x3b1c}, /* 0x2a */ + {0x4007,0x29,0x2e,0x00,0x68,1920,1440,0x3b21}, /* 0x2b */ + {0x4007,0x2a,0x30,0x00,0x68,1920,1440,0x3b26}, /* 0x2c */ + {0x4007,0x2b,0x35,0x00,0x68,1920,1440,0x3b2b}, /* 0x2d */ + {0x4005,0x2c,0x39,0x00,0x68,1920,1440,0x3b30}, /* 0x2e */ + {0x4007,0x2d,0x2b,0x00,0x6c,2048,1536,0x3b37}, /* 0x2f */ + {0x4007,0x2e,0x31,0x00,0x6c,2048,1536,0x3b3c}, /* 0x30 */ + {0x4007,0x2f,0x33,0x00,0x6c,2048,1536,0x3b41}, /* 0x31 */ + {0x4007,0x30,0x37,0x00,0x6c,2048,1536,0x3b46}, /* 0x32 */ + {0x4005,0x31,0x38,0x00,0x6c,2048,1536,0x3b4b}, /* 0x33 */ + {0x0057,0x32,0x40,0x08,0x70, 800, 480,0x3b52}, /* 0x34 */ + {0x0047,0x33,0x07,0x08,0x70, 800, 480,0x3b57}, /* 0x35 */ + {0x0047,0x34,0x0a,0x08,0x70, 800, 480,0x3b5c}, /* 0x36 */ + {0x0057,0x35,0x0b,0x09,0x71,1024, 576,0x3b63}, /* 0x37 */ + {0x0047,0x36,0x11,0x09,0x71,1024, 576,0x3b68}, /* 0x38 */ + {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,0x7b,1280, 960,0x3ad0}, /* 0x3d */ + {0x0027,0x3b,0x19,0x08,0x7b,1280, 960,0x3ad5}, /* 0x3e */ + {0xffff,0x00,0x00,0x00,0x00,0000,0000,0x0000} +}; + +typedef struct _SiS310_CRT1TableStruct +{ UCHAR CR[17]; } SiS310_CRT1TableStruct; -SiS310_CRT1TableStruct SiS310_CRT1Table[] = { - {0x2d, 0x27, 0x28, 0x90, 0x2c, 0x80, 0xbf, 0x1f, - 0x9c, 0x8e, 0x8f, 0x96, 0xb9, 0x30, 0x00, 0x00, - 0x00}, /* 0x0 */ - {0x2d, 0x27, 0x28, 0x90, 0x2c, 0x80, 0x0b, 0x3e, - 0xe9, 0x8b, 0xdf, 0xe7, 0x04, 0x00, 0x00, 0x00, - 0x00}, /* 0x1 */ - {0x3d, 0x31, 0x31, 0x81, 0x37, 0x1f, 0x72, 0xf0, - 0x58, 0x8c, 0x57, 0x57, 0x73, 0x20, 0x00, 0x05, - 0x01}, /* 0x2 */ - {0x4f, 0x3f, 0x3f, 0x93, 0x45, 0x0d, 0x24, 0xf5, - 0x02, 0x88, 0xff, 0xff, 0x25, 0x10, 0x00, 0x01, - 0x01}, /* 0x3 */ - {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f, - 0x9c, 0x8e, 0x8f, 0x96, 0xb9, 0x30, 0x00, 0x05, - 0x00}, /* 0x4 */ - {0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0x0b, 0x3e, - 0xe9, 0x8b, 0xdf, 0xe7, 0x04, 0x00, 0x00, 0x05, - 0x00}, /* 0x5 */ - {0x63, 0x4f, 0x50, 0x86, 0x56, 0x9b, 0x06, 0x3e, - 0xe8, 0x8b, 0xdf, 0xe7, 0xff, 0x10, 0x00, 0x01, - 0x00}, /* 0x6 */ - {0x64, 0x4f, 0x4f, 0x88, 0x55, 0x9d, 0xf2, 0x1f, - 0xe0, 0x83, 0xdf, 0xdf, 0xf3, 0x10, 0x00, 0x01, - 0x00}, /* 0x7 */ - {0x63, 0x4f, 0x4f, 0x87, 0x5a, 0x81, 0xfb, 0x1f, - 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, - 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, - 0x61}, /* 0xb */ - {0x65, 0x4f, 0x4f, 0x89, 0x57, 0x9f, 0xfb, 0x1f, - 0xe6, 0x8a, 0xe5, 0xe5, 0xfc, 0x00, 0x00, 0x01, - 0x00}, /* 0xc */ - {0x7b, 0x63, 0x63, 0x9f, 0x6a, 0x93, 0x6f, 0xf0, - 0x58, 0x8a, 0x57, 0x57, 0x70, 0x20, 0x00, 0x05, - 0x01}, /* 0xd */ - {0x7f, 0x63, 0x63, 0x83, 0x6c, 0x1c, 0x72, 0xf0, - 0x58, 0x8c, 0x57, 0x57, 0x73, 0x20, 0x00, 0x06, - 0x01}, /* 0xe */ - {0x7d, 0x63, 0x63, 0x81, 0x6e, 0x1d, 0x98, 0xf0, - 0x7c, 0x82, 0x57, 0x57, 0x99, 0x00, 0x00, 0x06, - 0x01}, /* 0xf */ - {0x7f, 0x63, 0x63, 0x83, 0x69, 0x13, 0x6f, 0xf0, - 0x58, 0x8b, 0x57, 0x57, 0x70, 0x20, 0x00, 0x06, - 0x01}, /* 0x10 */ - {0x7e, 0x63, 0x63, 0x82, 0x6b, 0x13, 0x75, 0xf0, - 0x58, 0x8b, 0x57, 0x57, 0x76, 0x20, 0x00, 0x06, - 0x01}, /* 0x11 */ - {0x81, 0x63, 0x63, 0x85, 0x6d, 0x18, 0x7a, 0xf0, - 0x58, 0x8b, 0x57, 0x57, 0x7b, 0x20, 0x00, 0x06, - 0x61}, /* 0x12 */ - {0x83, 0x63, 0x63, 0x87, 0x6e, 0x19, 0x81, 0xf0, - 0x58, 0x8b, 0x57, 0x57, 0x82, 0x20, 0x00, 0x06, - 0x61}, /* 0x13 */ - {0x85, 0x63, 0x63, 0x89, 0x6f, 0x1a, 0x91, 0xf0, - 0x58, 0x8b, 0x57, 0x57, 0x92, 0x20, 0x00, 0x06, - 0x61}, /* 0x14 */ - {0x99, 0x7f, 0x7f, 0x9d, 0x84, 0x1a, 0x96, 0x1f, - 0x7f, 0x83, 0x7f, 0x7f, 0x97, 0x10, 0x00, 0x02, - 0x00}, /* 0x15 */ - {0xa3, 0x7f, 0x7f, 0x87, 0x86, 0x97, 0x24, 0xf5, - 0x02, 0x88, 0xff, 0xff, 0x25, 0x10, 0x00, 0x02, - 0x01}, /* 0x16 */ - {0xa1, 0x7f, 0x7f, 0x85, 0x86, 0x97, 0x24, 0xf5, - 0x02, 0x88, 0xff, 0xff, 0x25, 0x10, 0x00, 0x02, - 0x01}, /* 0x17 */ - {0x9f, 0x7f, 0x7f, 0x83, 0x85, 0x91, 0x1e, 0xf5, - 0x00, 0x83, 0xff, 0xff, 0x1f, 0x10, 0x00, 0x02, - 0x01}, /* 0x18 */ - {0xa7, 0x7f, 0x7f, 0x8b, 0x89, 0x95, 0x26, 0xf5, - 0x00, 0x83, 0xff, 0xff, 0x27, 0x10, 0x00, 0x02, - 0x01}, /* 0x19 */ - {0xa9, 0x7f, 0x7f, 0x8d, 0x8c, 0x9a, 0x2c, 0xf5, - 0x00, 0x83, 0xff, 0xff, 0x2d, 0x14, 0x00, 0x02, - 0x62}, /* 0x1a */ - {0xab, 0x7f, 0x7f, 0x8f, 0x8d, 0x9b, 0x35, 0xf5, - 0x00, 0x83, 0xff, 0xff, 0x36, 0x14, 0x00, 0x02, - 0x62}, /* 0x1b */ - {0xcf, 0x9f, 0x9f, 0x93, 0xb2, 0x01, 0x14, 0xba, - 0x00, 0x83, 0xff, 0xff, 0x15, 0x00, 0x00, 0x03, - 0x00}, /* 0x1c */ - {0xce, 0x9f, 0x9f, 0x92, 0xa9, 0x17, 0x28, 0x5a, - 0x00, 0x83, 0xff, 0xff, 0x29, 0x09, 0x00, 0x07, - 0x01}, /* 0x1d */ - {0xce, 0x9f, 0x9f, 0x92, 0xa5, 0x17, 0x28, 0x5a, - 0x00, 0x83, 0xff, 0xff, 0x29, 0x09, 0x00, 0x07, - 0x01}, /* 0x1e */ - {0xd3, 0x9f, 0x9f, 0x97, 0xab, 0x1f, 0x2e, 0x5a, - 0x00, 0x83, 0xff, 0xff, 0x2f, 0x09, 0x00, 0x07, - 0x01}, /* 0x1f */ - {0x09, 0xc7, 0xc7, 0x8d, 0xd3, 0x0b, 0xe0, 0x10, - 0xb0, 0x83, 0xaf, 0xaf, 0xe1, 0x2f, 0x01, 0x04, - 0x00}, /* 0x20 */ - {0x09, 0xc7, 0xc7, 0x8d, 0xd3, 0x0b, 0xe0, 0x10, - 0xb0, 0x83, 0xaf, 0xaf, 0xe1, 0x2f, 0x01, 0x04, - 0x00}, /* 0x21 */ - {0x09, 0xc7, 0xc7, 0x8d, 0xd3, 0x0b, 0xe0, 0x10, - 0xb0, 0x83, 0xaf, 0xaf, 0xe1, 0x2f, 0x01, 0x04, - 0x00}, /* 0x22 */ - {0x09, 0xc7, 0xc7, 0x8d, 0xd3, 0x0b, 0xe0, 0x10, - 0xb0, 0x83, 0xaf, 0xaf, 0xe1, 0x2f, 0x01, 0x04, - 0x00}, /* 0x23 */ - {0x09, 0xc7, 0xc7, 0x8d, 0xd3, 0x0b, 0xe0, 0x10, - 0xb0, 0x83, 0xaf, 0xaf, 0xe1, 0x2f, 0x01, 0x04, - 0x00}, /* 0x24 */ - {0x09, 0xc7, 0xc7, 0x8d, 0xd3, 0x0b, 0xe0, 0x10, - 0xb0, 0x83, 0xaf, 0xaf, 0xe1, 0x2f, 0x01, 0x04, - 0x00}, /* 0x25 */ - {0x09, 0xc7, 0xc7, 0x8d, 0xd3, 0x0b, 0xe0, 0x10, - 0xb0, 0x83, 0xaf, 0xaf, 0xe1, 0x2f, 0x01, 0x04, - 0x00}, /* 0x26 */ - {0x40, 0xef, 0xef, 0x84, 0x03, 0x1d, 0xda, 0x1f, - 0xa0, 0x83, 0x9f, 0x9f, 0xdb, 0x1f, 0x41, 0x01, - 0x00}, /* 0x27 */ - {0x43, 0xef, 0xef, 0x87, 0x06, 0x00, 0xd4, 0x1f, - 0xa0, 0x83, 0x9f, 0x9f, 0xd5, 0x1f, 0x41, 0x05, - 0x63}, /* 0x28 */ - {0x45, 0xef, 0xef, 0x89, 0x07, 0x01, 0xd9, 0x1f, - 0xa0, 0x83, 0x9f, 0x9f, 0xda, 0x1f, 0x41, 0x05, - 0x63}, /* 0x29 */ - {0x40, 0xef, 0xef, 0x84, 0x03, 0x1d, 0xda, 0x1f, - 0xa0, 0x83, 0x9f, 0x9f, 0xdb, 0x1f, 0x41, 0x01, - 0x00}, /* 0x2a */ - {0x40, 0xef, 0xef, 0x84, 0x03, 0x1d, 0xda, 0x1f, - 0xa0, 0x83, 0x9f, 0x9f, 0xdb, 0x1f, 0x41, 0x01, - 0x00}, /* 0x2b */ - {0x40, 0xef, 0xef, 0x84, 0x03, 0x1d, 0xda, 0x1f, - 0xa0, 0x83, 0x9f, 0x9f, 0xdb, 0x1f, 0x41, 0x01, - 0x00}, /* 0x2c */ - {0x59, 0xff, 0xff, 0x9d, 0x17, 0x13, 0x33, 0xba, - 0x00, 0x83, 0xff, 0xff, 0x34, 0x0f, 0x41, 0x05, - 0x44}, /* 0x2d */ - {0x5b, 0xff, 0xff, 0x9f, 0x18, 0x14, 0x38, 0xba, - 0x00, 0x83, 0xff, 0xff, 0x39, 0x0f, 0x41, 0x05, - 0x44}, /* 0x2e */ - {0x5b, 0xff, 0xff, 0x9f, 0x18, 0x14, 0x3d, 0xba, - 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 */ - {0x55, 0xff, 0xff, 0x99, 0x0d, 0x0c, 0x3e, 0xba, - 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 */ - {0x7f, 0x63, 0x63, 0x83, 0x69, 0x13, 0x6f, 0xba, - 0x26, 0x89, 0xdf, 0xdf, 0x6f, 0x00, 0x00, 0x06, - 0x01}, /* 0x33 */ - {0x7f, 0x63, 0x63, 0x82, 0x6b, 0x13, 0x75, 0xba, - 0x29, 0x8c, 0xdf, 0xdf, 0x75, 0x00, 0x00, 0x06, - 0x01}, /* 0x34 */ - {0xa3, 0x7f, 0x7f, 0x87, 0x86, 0x97, 0x24, 0xf1, - 0xaf, 0x85, 0x3f, 0x3f, 0x25, 0x30, 0x00, 0x02, - 0x01}, /* 0x35 */ - {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, - 0xb1, 0x85, 0x3f, 0x3f, 0x27, 0x30, 0x00, 0x02, - 0x01}, /* 0x37 */ - {0xce, 0x9f, 0x9f, 0x92, 0xa9, 0x17, 0x28, 0xc4, - 0x7a, 0x8e, 0xcf, 0xcf, 0x29, 0x21, 0x00, 0x07, - 0x01}, /* 0x38 */ - {0xce, 0x9f, 0x9f, 0x92, 0xa5, 0x17, 0x28, 0xd4, - 0x7a, 0x8e, 0xcf, 0xcf, 0x29, 0x21, 0x00, 0x07, - 0x01}, /* 0x39 */ - {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, - 0xc0, 0xc3, 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 */ - {0x7b, 0x59, 0x63, 0x9f, 0x6a, 0x93, 0x6f, 0xf0, - 0x58, 0x8a, 0x3f, 0x57, 0x70, 0x20, 0x00, 0x05, - 0x01} /* 0x3d */ -}; - -typedef struct _SiS310_MCLKDataStruct { - UCHAR SR28, SR29, SR2A; +SiS310_CRT1TableStruct SiS310_CRT1Table[]= +{ + {0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f, + 0x9c,0x8e,0x8f,0x96,0xb9,0x30,0x00,0x00, + 0x00}, /* 0x0 */ + {0x2d,0x27,0x28,0x90,0x2c,0x80,0x0b,0x3e, + 0xe9,0x8b,0xdf,0xe7,0x04,0x00,0x00,0x00, + 0x00}, /* 0x1 */ + {0x3d,0x31,0x31,0x81,0x37,0x1f,0x72,0xf0, + 0x58,0x8c,0x57,0x57,0x73,0x20,0x00,0x05, + 0x01}, /* 0x2 */ + {0x4f,0x3f,0x3f,0x93,0x45,0x0d,0x24,0xf5, + 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x01, + 0x01}, /* 0x3 */ + {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, + 0x9c,0x8e,0x8f,0x96,0xb9,0x30,0x00,0x05, + 0x00}, /* 0x4 */ + {0x5f,0x4f,0x50,0x82,0x55,0x81,0x0b,0x3e, + 0xe9,0x8b,0xdf,0xe7,0x04,0x00,0x00,0x05, + 0x00}, /* 0x5 */ + {0x63,0x4f,0x50,0x86,0x56,0x9b,0x06,0x3e, + 0xe8,0x8b,0xdf,0xe7,0xff,0x10,0x00,0x01, + 0x00}, /* 0x6 */ + {0x64,0x4f,0x4f,0x88,0x55,0x9d,0xf2,0x1f, + 0xe0,0x83,0xdf,0xdf,0xf3,0x10,0x00,0x01, + 0x00}, /* 0x7 */ + {0x63,0x4f,0x4f,0x87,0x5a,0x81,0xfb,0x1f, + 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, + 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, + 0x61}, /* 0xb */ + {0x65,0x4f,0x4f,0x89,0x57,0x9f,0xfb,0x1f, + 0xe6,0x8a,0xe5,0xe5,0xfc,0x00,0x00,0x01, + 0x00}, /* 0xc */ + {0x7b,0x63,0x63,0x9f,0x6a,0x93,0x6f,0xf0, + 0x58,0x8a,0x57,0x57,0x70,0x20,0x00,0x05, + 0x01}, /* 0xd */ + {0x7f,0x63,0x63,0x83,0x6c,0x1c,0x72,0xf0, + 0x58,0x8c,0x57,0x57,0x73,0x20,0x00,0x06, + 0x01}, /* 0xe */ + {0x7d,0x63,0x63,0x81,0x6e,0x1d,0x98,0xf0, + 0x7c,0x82,0x57,0x57,0x99,0x00,0x00,0x06, + 0x01}, /* 0xf */ + {0x7f,0x63,0x63,0x83,0x69,0x13,0x6f,0xf0, + 0x58,0x8b,0x57,0x57,0x70,0x20,0x00,0x06, + 0x01}, /* 0x10 */ + {0x7e,0x63,0x63,0x82,0x6b,0x13,0x75,0xf0, + 0x58,0x8b,0x57,0x57,0x76,0x20,0x00,0x06, + 0x01}, /* 0x11 */ + {0x81,0x63,0x63,0x85,0x6d,0x18,0x7a,0xf0, + 0x58,0x8b,0x57,0x57,0x7b,0x20,0x00,0x06, + 0x61}, /* 0x12 */ + {0x83,0x63,0x63,0x87,0x6e,0x19,0x81,0xf0, + 0x58,0x8b,0x57,0x57,0x82,0x20,0x00,0x06, + 0x61}, /* 0x13 */ + {0x85,0x63,0x63,0x89,0x6f,0x1a,0x91,0xf0, + 0x58,0x8b,0x57,0x57,0x92,0x20,0x00,0x06, + 0x61}, /* 0x14 */ + {0x99,0x7f,0x7f,0x9d,0x84,0x1a,0x96,0x1f, + 0x7f,0x83,0x7f,0x7f,0x97,0x10,0x00,0x02, + 0x00}, /* 0x15 */ + {0xa3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x02, + 0x01}, /* 0x16 */ + {0xa1,0x7f,0x7f,0x85,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x02, + 0x01}, /* 0x17 */ + {0x9f,0x7f,0x7f,0x83,0x85,0x91,0x1e,0xf5, + 0x00,0x83,0xff,0xff,0x1f,0x10,0x00,0x02, + 0x01}, /* 0x18 */ + {0xa7,0x7f,0x7f,0x8b,0x89,0x95,0x26,0xf5, + 0x00,0x83,0xff,0xff,0x27,0x10,0x00,0x02, + 0x01}, /* 0x19 */ + {0xa9,0x7f,0x7f,0x8d,0x8c,0x9a,0x2c,0xf5, + 0x00,0x83,0xff,0xff,0x2d,0x14,0x00,0x02, + 0x62}, /* 0x1a */ + {0xab,0x7f,0x7f,0x8f,0x8d,0x9b,0x35,0xf5, + 0x00,0x83,0xff,0xff,0x36,0x14,0x00,0x02, + 0x62}, /* 0x1b */ + {0xcf,0x9f,0x9f,0x93,0xb2,0x01,0x14,0xba, + 0x00,0x83,0xff,0xff,0x15,0x00,0x00,0x03, + 0x00}, /* 0x1c */ + {0xce,0x9f,0x9f,0x92,0xa9,0x17,0x28,0x5a, + 0x00,0x83,0xff,0xff,0x29,0x09,0x00,0x07, + 0x01}, /* 0x1d */ + {0xce,0x9f,0x9f,0x92,0xa5,0x17,0x28,0x5a, + 0x00,0x83,0xff,0xff,0x29,0x09,0x00,0x07, + 0x01}, /* 0x1e */ + {0xd3,0x9f,0x9f,0x97,0xab,0x1f,0x2e,0x5a, + 0x00,0x83,0xff,0xff,0x2f,0x09,0x00,0x07, + 0x01}, /* 0x1f */ + {0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, + 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, + 0x00}, /* 0x20 */ + {0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, + 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, + 0x00}, /* 0x21 */ + {0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, + 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, + 0x00}, /* 0x22 */ + {0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, + 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, + 0x00}, /* 0x23 */ + {0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, + 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, + 0x00}, /* 0x24 */ + {0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, + 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, + 0x00}, /* 0x25 */ + {0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, + 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, + 0x00}, /* 0x26 */ + {0x40,0xef,0xef,0x84,0x03,0x1d,0xda,0x1f, + 0xa0,0x83,0x9f,0x9f,0xdb,0x1f,0x41,0x01, + 0x00}, /* 0x27 */ + {0x43,0xef,0xef,0x87,0x06,0x00,0xd4,0x1f, + 0xa0,0x83,0x9f,0x9f,0xd5,0x1f,0x41,0x05, + 0x63}, /* 0x28 */ + {0x45,0xef,0xef,0x89,0x07,0x01,0xd9,0x1f, + 0xa0,0x83,0x9f,0x9f,0xda,0x1f,0x41,0x05, + 0x63}, /* 0x29 */ + {0x40,0xef,0xef,0x84,0x03,0x1d,0xda,0x1f, + 0xa0,0x83,0x9f,0x9f,0xdb,0x1f,0x41,0x01, + 0x00}, /* 0x2a */ + {0x40,0xef,0xef,0x84,0x03,0x1d,0xda,0x1f, + 0xa0,0x83,0x9f,0x9f,0xdb,0x1f,0x41,0x01, + 0x00}, /* 0x2b */ + {0x40,0xef,0xef,0x84,0x03,0x1d,0xda,0x1f, + 0xa0,0x83,0x9f,0x9f,0xdb,0x1f,0x41,0x01, + 0x00}, /* 0x2c */ + {0x59,0xff,0xff,0x9d,0x17,0x13,0x33,0xba, + 0x00,0x83,0xff,0xff,0x34,0x0f,0x41,0x05, + 0x44}, /* 0x2d */ + {0x5b,0xff,0xff,0x9f,0x18,0x14,0x38,0xba, + 0x00,0x83,0xff,0xff,0x39,0x0f,0x41,0x05, + 0x44}, /* 0x2e */ + {0x5b,0xff,0xff,0x9f,0x18,0x14,0x3d,0xba, + 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 */ + {0x55,0xff,0xff,0x99,0x0d,0x0c,0x3e,0xba, + 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 */ + {0x7f,0x63,0x63,0x83,0x69,0x13,0x6f,0xba, + 0x26,0x89,0xdf,0xdf,0x6f,0x00,0x00,0x06, + 0x01}, /* 0x33 */ + {0x7f,0x63,0x63,0x82,0x6b,0x13,0x75,0xba, + 0x29,0x8c,0xdf,0xdf,0x75,0x00,0x00,0x06, + 0x01}, /* 0x34 */ + {0xa3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf1, + 0xaf,0x85,0x3f,0x3f,0x25,0x30,0x00,0x02, + 0x01}, /* 0x35 */ + {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, + 0xb1,0x85,0x3f,0x3f,0x27,0x30,0x00,0x02, + 0x01}, /* 0x37 */ + {0xce,0x9f,0x9f,0x92,0xa9,0x17,0x28,0xc4, + 0x7a,0x8e,0xcf,0xcf,0x29,0x21,0x00,0x07, + 0x01}, /* 0x38 */ + {0xce,0x9f,0x9f,0x92,0xa5,0x17,0x28,0xd4, + 0x7a,0x8e,0xcf,0xcf,0x29,0x21,0x00,0x07, + 0x01}, /* 0x39 */ + {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, + 0xc0,0xc3,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 */ + {0x7b,0x59,0x63,0x9f,0x6a,0x93,0x6f,0xf0, + 0x58,0x8a,0x3f,0x57,0x70,0x20,0x00,0x05, + 0x01} /* 0x3d */ +}; + +typedef struct _SiS310_MCLKDataStruct +{ + UCHAR SR28,SR29,SR2A; USHORT CLOCK; } SiS310_MCLKDataStruct; -SiS310_MCLKDataStruct SiS310_MCLKData[] = { - {0x5c, 0x23, 0x01, 166}, - {0x5c, 0x23, 0x01, 166}, - {0x5c, 0x23, 0x01, 166}, - {0x5c, 0x23, 0x01, 166} + +SiS310_MCLKDataStruct SiS310_MCLKData[]= +{ + { 0x5c,0x23,0x01,166}, + { 0x5c,0x23,0x01,166}, + { 0x5c,0x23,0x01,166}, + { 0x5c,0x23,0x01,166} }; -typedef struct _SiS310_ECLKDataStruct { - UCHAR SR2E, SR2F, SR30; +typedef struct _SiS310_ECLKDataStruct +{ + UCHAR SR2E,SR2F,SR30; USHORT CLOCK; } SiS310_ECLKDataStruct; -SiS310_ECLKDataStruct SiS310_ECLKData[] = { - {0x5c, 0x23, 0x01, 166}, - {0x5c, 0x23, 0x01, 166}, - {0x5c, 0x23, 0x01, 166}, - {0x5c, 0x23, 0x01, 166} +SiS310_ECLKDataStruct SiS310_ECLKData[]= +{ + { 0x5c,0x23,0x01,166}, + { 0x5c,0x23,0x01,166}, + { 0x5c,0x23,0x01,166}, + { 0x5c,0x23,0x01,166} }; -typedef struct _SiS310_VCLKDataStruct { - UCHAR SR2B, SR2C; +typedef struct _SiS310_VCLKDataStruct +{ + UCHAR SR2B,SR2C; USHORT CLOCK; } SiS310_VCLKDataStruct; -SiS310_VCLKDataStruct SiS310_VCLKData[] = { - {0x1b, 0xe1, 25}, /* 0x0 */ - {0x4e, 0xe4, 28}, /* 0x1 */ - {0x57, 0xe4, 31}, /* 0x2 */ - {0xc3, 0xc8, 36}, /* 0x3 */ - {0x42, 0xe2, 40}, /* 0x4 */ - {0xfe, 0xcd, 43}, /* 0x5 */ - {0x5d, 0xc4, 44}, /* 0x6 */ - {0x52, 0xe2, 49}, /* 0x7 */ - {0x53, 0xe2, 50}, /* 0x8 */ - {0x74, 0x67, 52}, /* 0x9 */ - {0x6d, 0x66, 56}, /* 0xa */ - {0x6c, 0xc3, 65}, /* 0xb */ - {0x46, 0x44, 67}, /* 0xc */ - {0xb1, 0x46, 68}, /* 0xd */ - {0xd3, 0x4a, 72}, /* 0xe */ - {0x29, 0x61, 75}, /* 0xf */ - {0x6e, 0x46, 76}, /* 0x10 */ - {0x2b, 0x61, 78}, /* 0x11 */ - {0x31, 0x42, 79}, /* 0x12 */ - {0xab, 0x44, 83}, /* 0x13 */ - {0x46, 0x25, 84}, /* 0x14 */ - {0x78, 0x29, 86}, /* 0x15 */ - {0x62, 0x44, 94}, /* 0x16 */ - {0x2b, 0x41, 104}, /* 0x17 */ - {0x3a, 0x23, 105}, /* 0x18 */ - {0x70, 0x44, 108}, /* 0x19 */ - {0x3c, 0x23, 109}, /* 0x1a */ - {0x5e, 0x43, 113}, /* 0x1b */ - {0xbc, 0x44, 116}, /* 0x1c */ - {0xe0, 0x46, 132}, /* 0x1d */ - {0x54, 0x42, 135}, /* 0x1e */ - {0xea, 0x2a, 139}, /* 0x1f */ - {0x41, 0x22, 157}, /* 0x20 */ - {0x70, 0x24, 162}, /* 0x21 */ - {0x30, 0x21, 175}, /* 0x22 */ - {0x4e, 0x22, 189}, /* 0x23 */ - {0xde, 0x26, 194}, /* 0x24 */ - {0x62, 0x06, 202}, /* 0x25 */ - {0x3f, 0x03, 229}, /* 0x26 */ - {0xb8, 0x06, 234}, /* 0x27 */ - {0x34, 0x02, 253}, /* 0x28 */ - {0x58, 0x04, 255}, /* 0x29 */ - {0x24, 0x01, 265}, /* 0x2a */ - {0x9b, 0x02, 267}, /* 0x2b */ - {0x70, 0x05, 270}, /* 0x2c */ - {0x25, 0x01, 272}, /* 0x2d */ - {0x9c, 0x02, 277}, /* 0x2e */ - {0x27, 0x01, 286}, /* 0x2f */ - {0x3c, 0x02, 291}, /* 0x30 */ - {0xef, 0x0a, 292}, /* 0x31 */ - {0xf6, 0x0a, 310}, /* 0x32 */ - {0x95, 0x01, 315}, /* 0x33 */ - {0xf0, 0x09, 324}, /* 0x34 */ - {0xfe, 0x0a, 331}, /* 0x35 */ - {0xf3, 0x09, 332}, /* 0x36 */ - {0xea, 0x08, 340}, /* 0x37 */ - {0xe8, 0x07, 376}, /* 0x38 */ - {0xde, 0x06, 389}, /* 0x39 */ - {0x52, 0x2a, 54}, /* 0x3a */ - {0x52, 0x6a, 27}, /* 0x3b */ - {0x62, 0x24, 70}, /* 0x3c */ - {0x62, 0x64, 70}, /* 0x3d */ - {0xa8, 0x4c, 30}, /* 0x3e */ - {0x20, 0x26, 33}, /* 0x3f */ - {0x31, 0xc2, 39} /* 0x40 */ -}; - -typedef struct _SiS310_VBVCLKDataStruct { - UCHAR Part4_A, Part4_B; +SiS310_VCLKDataStruct SiS310_VCLKData[]= +{ + { 0x1b,0xe1, 25}, /* 0x0 */ + { 0x4e,0xe4, 28}, /* 0x1 */ + { 0x57,0xe4, 31}, /* 0x2 */ + { 0xc3,0xc8, 36}, /* 0x3 */ + { 0x42,0xe2, 40}, /* 0x4 */ + { 0xfe,0xcd, 43}, /* 0x5 */ + { 0x5d,0xc4, 44}, /* 0x6 */ + { 0x52,0xe2, 49}, /* 0x7 */ + { 0x53,0xe2, 50}, /* 0x8 */ + { 0x74,0x67, 52}, /* 0x9 */ + { 0x6d,0x66, 56}, /* 0xa */ + { 0x6c,0xc3, 65}, /* 0xb */ + { 0x46,0x44, 67}, /* 0xc */ + { 0xb1,0x46, 68}, /* 0xd */ + { 0xd3,0x4a, 72}, /* 0xe */ + { 0x29,0x61, 75}, /* 0xf */ + { 0x6e,0x46, 76}, /* 0x10 */ + { 0x2b,0x61, 78}, /* 0x11 */ + { 0x31,0x42, 79}, /* 0x12 */ + { 0xab,0x44, 83}, /* 0x13 */ + { 0x46,0x25, 84}, /* 0x14 */ + { 0x78,0x29, 86}, /* 0x15 */ + { 0x62,0x44, 94}, /* 0x16 */ + { 0x2b,0x41,104}, /* 0x17 */ + { 0x3a,0x23,105}, /* 0x18 */ + { 0x70,0x44,108}, /* 0x19 */ + { 0x3c,0x23,109}, /* 0x1a */ + { 0x5e,0x43,113}, /* 0x1b */ + { 0xbc,0x44,116}, /* 0x1c */ + { 0xe0,0x46,132}, /* 0x1d */ + { 0x54,0x42,135}, /* 0x1e */ + { 0xea,0x2a,139}, /* 0x1f */ + { 0x41,0x22,157}, /* 0x20 */ + { 0x70,0x24,162}, /* 0x21 */ + { 0x30,0x21,175}, /* 0x22 */ + { 0x4e,0x22,189}, /* 0x23 */ + { 0xde,0x26,194}, /* 0x24 */ + { 0x62,0x06,202}, /* 0x25 */ + { 0x3f,0x03,229}, /* 0x26 */ + { 0xb8,0x06,234}, /* 0x27 */ + { 0x34,0x02,253}, /* 0x28 */ + { 0x58,0x04,255}, /* 0x29 */ + { 0x24,0x01,265}, /* 0x2a */ + { 0x9b,0x02,267}, /* 0x2b */ + { 0x70,0x05,270}, /* 0x2c */ + { 0x25,0x01,272}, /* 0x2d */ + { 0x9c,0x02,277}, /* 0x2e */ + { 0x27,0x01,286}, /* 0x2f */ + { 0x3c,0x02,291}, /* 0x30 */ + { 0xef,0x0a,292}, /* 0x31 */ + { 0xf6,0x0a,310}, /* 0x32 */ + { 0x95,0x01,315}, /* 0x33 */ + { 0xf0,0x09,324}, /* 0x34 */ + { 0xfe,0x0a,331}, /* 0x35 */ + { 0xf3,0x09,332}, /* 0x36 */ + { 0xea,0x08,340}, /* 0x37 */ + { 0xe8,0x07,376}, /* 0x38 */ + { 0xde,0x06,389}, /* 0x39 */ + { 0x52,0x2a, 54}, /* 0x3a */ + { 0x52,0x6a, 27}, /* 0x3b */ + { 0x62,0x24, 70}, /* 0x3c */ + { 0x62,0x64, 70}, /* 0x3d */ + { 0xa8,0x4c, 30}, /* 0x3e */ + { 0x20,0x26, 33}, /* 0x3f */ + { 0x31,0xc2, 39} /* 0x40 */ +}; + +typedef struct _SiS310_VBVCLKDataStruct +{ + UCHAR Part4_A,Part4_B; USHORT CLOCK; } SiS310_VBVCLKDataStruct; -SiS310_VBVCLKDataStruct SiS310_VBVCLKData[] = { - {0x1b, 0xe1, 25}, /* 0x0 */ - {0x4e, 0xe4, 28}, /* 0x1 */ - {0x57, 0xe4, 31}, /* 0x2 */ - {0xc3, 0xc8, 36}, /* 0x3 */ - {0x42, 0x47, 40}, /* 0x4 */ - {0xfe, 0xcd, 43}, /* 0x5 */ - {0x5d, 0xc4, 44}, /* 0x6 */ - {0x52, 0x47, 49}, /* 0x7 */ - {0x53, 0x47, 50}, /* 0x8 */ - {0x74, 0x67, 52}, /* 0x9 */ - {0x6d, 0x66, 56}, /* 0xa */ - {0x5a, 0x64, 65}, /* 0xb */ - {0x46, 0x44, 67}, /* 0xc */ - {0xb1, 0x46, 68}, /* 0xd */ - {0xd3, 0x4a, 72}, /* 0xe */ - {0x29, 0x61, 75}, /* 0xf */ - {0x6d, 0x46, 75}, /* 0x10 */ - {0x41, 0x43, 78}, /* 0x11 */ - {0x31, 0x42, 79}, /* 0x12 */ - {0xab, 0x44, 83}, /* 0x13 */ - {0x46, 0x25, 84}, /* 0x14 */ - {0x78, 0x29, 86}, /* 0x15 */ - {0x62, 0x44, 94}, /* 0x16 */ - {0x2b, 0x22, 104}, /* 0x17 */ - {0x49, 0x24, 105}, /* 0x18 */ - {0xf8, 0x2f, 108}, /* 0x19 */ - {0x3c, 0x23, 109}, /* 0x1a */ - {0x5e, 0x43, 113}, /* 0x1b */ - {0xbc, 0x44, 116}, /* 0x1c */ - {0xe0, 0x46, 132}, /* 0x1d */ - {0xd4, 0x28, 135}, /* 0x1e */ - {0xea, 0x2a, 139}, /* 0x1f */ - {0x41, 0x22, 157}, /* 0x20 */ - {0x70, 0x24, 162}, /* 0x21 */ - {0x30, 0x21, 175}, /* 0x22 */ - {0x4e, 0x22, 189}, /* 0x23 */ - {0xde, 0x26, 194}, /* 0x24 */ - {0x70, 0x07, 202}, /* 0x25 */ - {0x3f, 0x03, 229}, /* 0x26 */ - {0xb8, 0x06, 234}, /* 0x27 */ - {0x34, 0x02, 253}, /* 0x28 */ - {0x58, 0x04, 255}, /* 0x29 */ - {0x24, 0x01, 265}, /* 0x2a */ - {0x9b, 0x02, 267}, /* 0x2b */ - {0x70, 0x05, 270}, /* 0x2c */ - {0x25, 0x01, 272}, /* 0x2d */ - {0x9c, 0x02, 277}, /* 0x2e */ - {0x27, 0x01, 286}, /* 0x2f */ - {0x3c, 0x02, 291}, /* 0x30 */ - {0xef, 0x0a, 292}, /* 0x31 */ - {0xf6, 0x0a, 310}, /* 0x32 */ - {0x95, 0x01, 315}, /* 0x33 */ - {0xf0, 0x09, 324}, /* 0x34 */ - {0xfe, 0x0a, 331}, /* 0x35 */ - {0xf3, 0x09, 332}, /* 0x36 */ - {0xea, 0x08, 340}, /* 0x37 */ - {0xe8, 0x07, 376}, /* 0x38 */ - {0xde, 0x06, 389}, /* 0x39 */ - {0x52, 0x2a, 54}, /* 0x3a */ - {0x52, 0x6a, 27}, /* 0x3b */ - {0x62, 0x24, 70}, /* 0x3c */ - {0x62, 0x64, 70}, /* 0x3d */ - {0xa8, 0x4c, 30}, /* 0x3e */ - {0x20, 0x26, 33}, /* 0x3f */ - {0x31, 0xc2, 39} /* 0x40 */ -}; - -UCHAR SiS310_ScreenOffset[] = - { 0x14, 0x19, 0x20, 0x28, 0x32, 0x40, 0x50, 0x64, 0x78, 0x80, 0x2d, 0x35 }; - -typedef struct _SiS310_StResInfoStruct { + +SiS310_VBVCLKDataStruct SiS310_VBVCLKData[]= +{ + { 0x1b,0xe1, 25}, /* 0x0 */ + { 0x4e,0xe4, 28}, /* 0x1 */ + { 0x57,0xe4, 31}, /* 0x2 */ + { 0xc3,0xc8, 36}, /* 0x3 */ + { 0x42,0x47, 40}, /* 0x4 */ + { 0xfe,0xcd, 43}, /* 0x5 */ + { 0x5d,0xc4, 44}, /* 0x6 */ + { 0x52,0x47, 49}, /* 0x7 */ + { 0x53,0x47, 50}, /* 0x8 */ + { 0x74,0x67, 52}, /* 0x9 */ + { 0x6d,0x66, 56}, /* 0xa */ + { 0x5a,0x64, 65}, /* 0xb */ + { 0x46,0x44, 67}, /* 0xc */ + { 0xb1,0x46, 68}, /* 0xd */ + { 0xd3,0x4a, 72}, /* 0xe */ + { 0x29,0x61, 75}, /* 0xf */ + { 0x6d,0x46, 75}, /* 0x10 */ + { 0x41,0x43, 78}, /* 0x11 */ + { 0x31,0x42, 79}, /* 0x12 */ + { 0xab,0x44, 83}, /* 0x13 */ + { 0x46,0x25, 84}, /* 0x14 */ + { 0x78,0x29, 86}, /* 0x15 */ + { 0x62,0x44, 94}, /* 0x16 */ + { 0x2b,0x22,104}, /* 0x17 */ + { 0x49,0x24,105}, /* 0x18 */ + { 0xf8,0x2f,108}, /* 0x19 */ + { 0x3c,0x23,109}, /* 0x1a */ + { 0x5e,0x43,113}, /* 0x1b */ + { 0xbc,0x44,116}, /* 0x1c */ + { 0xe0,0x46,132}, /* 0x1d */ + { 0xd4,0x28,135}, /* 0x1e */ + { 0xea,0x2a,139}, /* 0x1f */ + { 0x41,0x22,157}, /* 0x20 */ + { 0x70,0x24,162}, /* 0x21 */ + { 0x30,0x21,175}, /* 0x22 */ + { 0x4e,0x22,189}, /* 0x23 */ + { 0xde,0x26,194}, /* 0x24 */ + { 0x70,0x07,202}, /* 0x25 */ + { 0x3f,0x03,229}, /* 0x26 */ + { 0xb8,0x06,234}, /* 0x27 */ + { 0x34,0x02,253}, /* 0x28 */ + { 0x58,0x04,255}, /* 0x29 */ + { 0x24,0x01,265}, /* 0x2a */ + { 0x9b,0x02,267}, /* 0x2b */ + { 0x70,0x05,270}, /* 0x2c */ + { 0x25,0x01,272}, /* 0x2d */ + { 0x9c,0x02,277}, /* 0x2e */ + { 0x27,0x01,286}, /* 0x2f */ + { 0x3c,0x02,291}, /* 0x30 */ + { 0xef,0x0a,292}, /* 0x31 */ + { 0xf6,0x0a,310}, /* 0x32 */ + { 0x95,0x01,315}, /* 0x33 */ + { 0xf0,0x09,324}, /* 0x34 */ + { 0xfe,0x0a,331}, /* 0x35 */ + { 0xf3,0x09,332}, /* 0x36 */ + { 0xea,0x08,340}, /* 0x37 */ + { 0xe8,0x07,376}, /* 0x38 */ + { 0xde,0x06,389}, /* 0x39 */ + { 0x52,0x2a, 54}, /* 0x3a */ + { 0x52,0x6a, 27}, /* 0x3b */ + { 0x62,0x24, 70}, /* 0x3c */ + { 0x62,0x64, 70}, /* 0x3d */ + { 0xa8,0x4c, 30}, /* 0x3e */ + { 0x20,0x26, 33}, /* 0x3f */ + { 0x31,0xc2, 39} /* 0x40 */ +}; + +UCHAR SiS310_ScreenOffset[]={ 0x14,0x19,0x20,0x28,0x32,0x40, + 0x50,0x64,0x78,0x80,0x2d,0x35 }; + +typedef struct _SiS310_StResInfoStruct +{ USHORT HTotal; USHORT VTotal; } SiS310_StResInfoStruct; -SiS310_StResInfoStruct SiS310_StResInfo[] = { - {640, 400}, - {640, 350}, - {720, 400}, - {720, 350}, - {640, 480} + +SiS310_StResInfoStruct SiS310_StResInfo[]= +{ + { 640,400}, + { 640,350}, + { 720,400}, + { 720,350}, + { 640,480} }; -typedef struct _SiS310_ModeResInfoStruct { +typedef struct _SiS310_ModeResInfoStruct +{ USHORT HTotal; USHORT VTotal; - UCHAR XChar; - UCHAR YChar; + UCHAR XChar; + UCHAR YChar; } SiS310_ModeResInfoStruct; -SiS310_ModeResInfoStruct SiS310_ModeResInfo[] = { - {320, 200, 8, 8}, - {320, 240, 8, 8}, - {320, 400, 8, 8}, - {400, 300, 8, 8}, - {512, 384, 8, 8}, - {640, 400, 8, 16}, - {640, 480, 8, 16}, - {800, 600, 8, 16}, - {1024, 768, 8, 16}, - {1280, 1024, 8, 16}, - {1600, 1200, 8, 16}, - {1920, 1440, 8, 16}, - {2048, 1536, 8, 16}, - {720, 480, 8, 16}, - {720, 576, 8, 16}, - {1280, 960, 8, 16}, - {800, 480, 8, 16}, - {1024, 576, 8, 16}, - {1280, 720, 8, 16} + +SiS310_ModeResInfoStruct SiS310_ModeResInfo[]= +{ + { 320, 200, 8, 8}, + { 320, 240, 8, 8}, + { 320, 400, 8, 8}, + { 400, 300, 8, 8}, + { 512, 384, 8, 8}, + { 640, 400, 8,16}, + { 640, 480, 8,16}, + { 800, 600, 8,16}, + { 1024, 768, 8,16}, + { 1280,1024, 8,16}, + { 1600,1200, 8,16}, + { 1920,1440, 8,16}, + { 2048,1536, 8,16}, + { 720, 480, 8,16}, + { 720, 576, 8,16}, + { 1280, 960, 8,16}, + { 800, 480, 8,16}, + { 1024, 576, 8,16}, + { 1280, 720, 8,16} }; UCHAR SiS310_OutputSelect = 0; + UCHAR SiS310_SoftSetting = 30; -UCHAR SiS310_SR07 = 0x18; -UCHAR SiS310_SR15[8][4] = { - {0x0, 0x4, 0x60, 0x60}, - {0xf, 0xf, 0xf, 0xf}, - {0xba, 0xba, 0xba, 0xba}, - {0xa9, 0xa9, 0xac, 0xac}, - {0xa0, 0xa0, 0xa0, 0xa8}, - {0x0, 0x0, 0x2, 0x2}, - {0x30, 0x30, 0x40, 0x40}, - {0x0, 0xa5, 0xfb, 0xf6} -}; -UCHAR SiS310_CR40[5][4] = { - {0x77, 0x77, 0x33, 0x33}, - {0x77, 0x77, 0x33, 0x33}, - {0x0, 0x0, 0x0, 0x0}, - {0x5b, 0x5b, 0x3, 0x3}, - {0x0, 0x0, 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 = 0x0; -UCHAR SiS310_SR32 = 0x11; -UCHAR SiS310_SR33 = 0x0; + +UCHAR SiS310_SR07=0x18; + +UCHAR SiS310_SR15[8][4]={ + {0x00,0x04,0x60,0x60}, + {0x0f,0x0f,0x0f,0x0f}, + {0xba,0xba,0xba,0xba}, + {0xa9,0xa9,0xac,0xac}, + {0xa0,0xa0,0xa0,0xa8}, + {0x00,0x00,0x02,0x02}, + {0x30,0x30,0x40,0x40}, + {0x00,0xa5,0xfb,0xf6} +}; +UCHAR SiS310_CR40[5][4]={ + {0x77,0x77,0x33,0x33}, + {0x77,0x77,0x33,0x33}, + {0x00,0x00,0x00,0x00}, + {0x5b,0x5b,0x03,0x03}, + {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=0x0; +UCHAR SiS310_SR32=0x11; +UCHAR SiS310_SR33=0x0; UCHAR SiS310_CRT2Data_1_2 = 0x0; UCHAR SiS310_CRT2Data_4_D = 0x0; UCHAR SiS310_CRT2Data_4_E = 0x0; @@ -1127,14 +1098,15 @@ 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_RGBSenseData2 = 0x0190; /*301b*/ USHORT SiS310_VideoSenseData2 = 0x0174; USHORT SiS310_YCSenseData2 = 0x016b; -UCHAR SiS310_NTSCPhase[] = { 0x21, 0xed, 0x8a, 0x8 }; +UCHAR SiS310_NTSCPhase[] = {0x21,0xed,0x8a,0x8}; -UCHAR SiS310_PALPhase[] = { 0x2a, 0x5, 0xd3, 0x0 }; +UCHAR SiS310_PALPhase[] = {0x2a,0x5,0xd3,0x0}; -typedef struct _SiS310_LCDDataStruct { +typedef struct _SiS310_LCDDataStruct +{ USHORT RVBHCMAX; USHORT RVBHCFACT; USHORT VGAHT; @@ -1142,99 +1114,109 @@ typedef struct _SiS310_LCDDataStruct { USHORT LCDHT; USHORT LCDVT; } SiS310_LCDDataStruct; -SiS310_LCDDataStruct SiS310_StLCD1024x768Data[] = { - {62, 25, 800, 546, 1344, 806}, - {32, 15, 930, 546, 1344, 806}, - {32, 15, 930, 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_ExtLCD1024x768Data[] = { - {12, 5, 896, 512, 1344, 806}, - {12, 5, 896, 510, 1344, 806}, - {32, 15, 1008, 505, 1344, 806}, - {32, 15, 1008, 514, 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} -}; - -SiS310_LCDDataStruct SiS310_St2LCD1024x768Data[] = { - {62, 25, 800, 546, 1344, 806}, - {32, 15, 930, 546, 1344, 806}, - {32, 15, 930, 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[] = { - {22, 5, 800, 510, 1650, 1088}, - {22, 5, 800, 510, 1650, 1088}, - {176, 45, 900, 510, 1650, 1088}, - {176, 45, 900, 510, 1650, 1088}, - {22, 5, 800, 510, 1650, 1088}, - {13, 5, 1024, 675, 1560, 1152}, - {16, 9, 1266, 804, 1688, 1072}, - {1, 1, 1688, 1066, 1688, 1066} -}; - -SiS310_LCDDataStruct SiS310_ExtLCD1280x1024Data[] = { - {211, 60, 1024, 501, 1688, 1066}, - {211, 60, 1024, 508, 1688, 1066}, - {211, 60, 1024, 501, 1688, 1066}, - {211, 60, 1024, 508, 1688, 1066}, - {211, 60, 1024, 500, 1688, 1066}, - {211, 75, 1024, 625, 1688, 1066}, - {211, 120, 1280, 798, 1688, 1066}, - {1, 1, 1688, 1066, 1688, 1066} -}; - -SiS310_LCDDataStruct SiS310_St2LCD1280x1024Data[] = { - {22, 5, 800, 510, 1650, 1088}, - {22, 5, 800, 510, 1650, 1088}, - {176, 45, 900, 510, 1650, 1088}, - {176, 45, 900, 510, 1650, 1088}, - {22, 5, 800, 510, 1650, 1088}, - {13, 5, 1024, 675, 1560, 1152}, - {16, 9, 1266, 804, 1688, 1072}, - {1, 1, 1688, 1066, 1688, 1066} -}; - -SiS310_LCDDataStruct SiS310_NoScaleData[] = { - {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} -}; - -SiS310_LCDDataStruct SiS310_LCD1280x960Data[] = { - {9, 2, 800, 500, 1800, 1000}, - {9, 2, 800, 500, 1800, 1000}, - {4, 1, 900, 500, 1800, 1000}, - {4, 1, 900, 500, 1800, 1000}, - {9, 2, 800, 500, 1800, 1000}, - {30, 11, 1056, 625, 1800, 1000}, - {5, 3, 1350, 800, 1800, 1000}, - {1, 1, 1576, 1050, 1576, 1050}, - {1, 1, 1800, 1000, 1800, 1000} -}; - -typedef struct _SiS310_TVDataStruct { + +SiS310_LCDDataStruct SiS310_StLCD1024x768Data[]= +{ + { 62, 25, 800, 546,1344, 806}, + { 32, 15, 930, 546,1344, 806}, + { 32, 15, 930, 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_ExtLCD1024x768Data[]= +{ + { 12, 5, 896, 512,1344, 806}, + { 12, 5, 896, 510,1344, 806}, + { 32, 15,1008, 505,1344, 806}, + { 32, 15,1008, 514,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} +}; + +SiS310_LCDDataStruct SiS310_St2LCD1024x768Data[]= +{ + { 62, 25, 800, 546,1344, 806}, + { 32, 15, 930, 546,1344, 806}, + { 32, 15, 930, 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[]= +{ + { 22, 5, 800, 510,1650,1088}, + { 22, 5, 800, 510,1650,1088}, + { 176, 45, 900, 510,1650,1088}, + { 176, 45, 900, 510,1650,1088}, + { 22, 5, 800, 510,1650,1088}, + { 13, 5,1024, 675,1560,1152}, + { 16, 9,1266, 804,1688,1072}, + { 1, 1,1688,1066,1688,1066} +}; + +SiS310_LCDDataStruct SiS310_ExtLCD1280x1024Data[]= +{ + { 211, 60,1024, 501,1688,1066}, + { 211, 60,1024, 508,1688,1066}, + { 211, 60,1024, 501,1688,1066}, + { 211, 60,1024, 508,1688,1066}, + { 211, 60,1024, 500,1688,1066}, + { 211, 75,1024, 625,1688,1066}, + { 211, 120,1280, 798,1688,1066}, + { 1, 1,1688,1066,1688,1066} +}; + +SiS310_LCDDataStruct SiS310_St2LCD1280x1024Data[]= +{ + { 22, 5, 800, 510,1650,1088}, + { 22, 5, 800, 510,1650,1088}, + { 176, 45, 900, 510,1650,1088}, + { 176, 45, 900, 510,1650,1088}, + { 22, 5, 800, 510,1650,1088}, + { 13, 5,1024, 675,1560,1152}, + { 16, 9,1266, 804,1688,1072}, + { 1, 1,1688,1066,1688,1066} +}; + +SiS310_LCDDataStruct SiS310_NoScaleData[]= +{ + { 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} +}; + +SiS310_LCDDataStruct SiS310_LCD1280x960Data[]= +{ + { 9, 2, 800, 500,1800,1000}, + { 9, 2, 800, 500,1800,1000}, + { 4, 1, 900, 500,1800,1000}, + { 4, 1, 900, 500,1800,1000}, + { 9, 2, 800, 500,1800,1000}, + { 30, 11,1056, 625,1800,1000}, + { 5, 3,1350, 800,1800,1000}, + { 1, 1,1576,1050,1576,1050}, + { 1, 1,1800,1000,1800,1000} +}; + +typedef struct _SiS310_TVDataStruct +{ USHORT RVBHCMAX; USHORT RVBHCFACT; USHORT VGAHT; @@ -1249,1070 +1231,1105 @@ typedef struct _SiS310_TVDataStruct { UCHAR RY3COE; UCHAR RY4COE; } SiS310_TVDataStruct; -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}, - {1, 1, 864, 525, 1270, 400, 0, 0, 720, 0xf1, 0x04, 0x1f, 0x18}, - {1, 1, 864, 525, 1270, 350, 0, 0, 720, 0xf4, 0x0b, 0x1c, 0x0a}, - {1, 1, 864, 525, 1270, 480, 50, 0, 760, 0xf4, 0xff, 0x1c, 0x22}, - {1, 1, 864, 525, 1270, 600, 50, 0, 0, 0xf4, 0xff, 0x1c, 0x22} -}; - -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 */ -}; - -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}, - {1, 1, 858, 525, 1270, 400, 0, 0, 720, 0xf1, 0x04, 0x1f, 0x18}, - {1, 1, 858, 525, 1270, 350, 0, 0, 720, 0xf4, 0x0b, 0x1c, 0x0a}, - {1, 1, 858, 525, 1270, 480, 0, 0, 760, 0xf1, 0x04, 0x1f, 0x18} -}; - -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, 1288, 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 */ -}; - -SiS310_TVDataStruct SiS310_St1HiTVData[] = { - 0x00 -}; - -SiS310_TVDataStruct SiS310_St2HiTVData[] = { - 0x00 -}; - -SiS310_TVDataStruct SiS310_ExtHiTVData[] = { - 0x00 -}; +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}, + { 1, 1, 864, 525,1270, 400, 0, 0, 720,0xf1,0x04,0x1f,0x18}, + { 1, 1, 864, 525,1270, 350, 0, 0, 720,0xf4,0x0b,0x1c,0x0a}, + { 1, 1, 864, 525,1270, 480, 50, 0, 760,0xf4,0xff,0x1c,0x22}, + { 1, 1, 864, 525,1270, 600, 50, 0, 0,0xf4,0xff,0x1c,0x22} +}; + +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*/ +}; + +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}, + { 1, 1, 858, 525,1270, 400, 0, 0, 720,0xf1,0x04,0x1f,0x18}, + { 1, 1, 858, 525,1270, 350, 0, 0, 720,0xf4,0x0b,0x1c,0x0a}, + { 1, 1, 858, 525,1270, 480, 0, 0, 760,0xf1,0x04,0x1f,0x18} +}; + +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,1288, 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*/ +}; + +SiS310_TVDataStruct SiS310_St1HiTVData[]= +{ +0x00}; + +SiS310_TVDataStruct SiS310_St2HiTVData[]= +{ +0x00}; + +SiS310_TVDataStruct SiS310_ExtHiTVData[]= +{ +0x00}; 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, - 0x0c, 0x50, 0x00, 0x97, 0x00, 0xda, 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, 0x50, - 0x00, 0x40, 0x44, 0x00, 0xdb, 0x02, 0x3b, 0x00 -}; + 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, + 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 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, - 0x70, 0x50, 0x00, 0x9b, 0x00, 0xd9, 0x5d, 0x17, - 0x7d, 0x05, 0x45, 0x00, 0x00, 0xe8, 0x00, 0x02, - 0x0d, 0x00, 0x68, 0xb0, 0x0b, 0x92, 0x8f, 0x40, - 0x60, 0x80, 0x14, 0x90, 0x8c, 0x60, 0x14, 0x63, - 0x00, 0x40, 0x3e, 0x00, 0xe1, 0x02, 0x28, 0x00 -}; + 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, + 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 SiS310_HiTVExtTiming[] = { 0x00 }; +UCHAR SiS310_HiTVExtTiming[] = {0x00}; -UCHAR SiS310_HiTVSt1Timing[] = { 0x00 }; +UCHAR SiS310_HiTVSt1Timing[] = {0x00}; -UCHAR SiS310_HiTVSt2Timing[] = { 0x00 }; +UCHAR SiS310_HiTVSt2Timing[] = {0x00}; -UCHAR SiS310_HiTVTextTiming[] = { 0x00 }; +UCHAR SiS310_HiTVTextTiming[] = {0x00}; -UCHAR SiS310_HiTVGroup3Data[] = { 0x00 }; +UCHAR SiS310_HiTVGroup3Data[] = {0x00}; -UCHAR SiS310_HiTVGroup3Simu[] = { 0x00 }; +UCHAR SiS310_HiTVGroup3Simu[] = {0x00}; -UCHAR SiS310_HiTVGroup3Text[] = { 0x00 }; +UCHAR SiS310_HiTVGroup3Text[] = {0x00}; -typedef struct _SiS310_PanelDelayTblStruct { - UCHAR timer[2]; +typedef struct _SiS310_PanelDelayTblStruct +{ + UCHAR timer[2]; } SiS310_PanelDelayTblStruct; -SiS310_PanelDelayTblStruct SiS310_PanelDelayTbl[] = { {0x00, 0x00}, -{0x00, 0x00}, -{0x00, 0x00}, -{0x00, 0x00}, -{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_LVDSDataStruct { - USHORT VGAHT; - USHORT VGAVT; - USHORT LCDHT; - USHORT LCDVT; +SiS310_PanelDelayTblStruct SiS310_PanelDelayTbl[]= +{{0x00,0x00}, +{0x00,0x00}, +{0x00,0x00}, +{0x00,0x00}, +{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_LVDSDataStruct +{ + USHORT VGAHT; + USHORT VGAVT; + USHORT LCDHT; + USHORT LCDVT; } SiS310_LVDSDataStruct; -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}, - {1056, 628, 1056, 628}, - {1056, 628, 1056, 628}, - {800, 449, 1000, 644}, - {800, 525, 1000, 635} -}; - -SiS310_LVDSDataStruct SiS310_LVDS800x600Data_2[] = { - {1056, 628, 1056, 628}, - {1056, 628, 1056, 628}, - {1056, 628, 1056, 628}, - {1056, 628, 1056, 628}, - {1056, 628, 1056, 628}, - {1056, 628, 1056, 628}, - {1056, 628, 1056, 628}, - {800, 449, 1000, 644}, - {800, 525, 1000, 635} -}; - -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}, - {1050, 638, 1344, 806}, - {1344, 806, 1344, 806}, - {800, 449, 1280, 801}, - {800, 525, 1280, 813} -}; - -SiS310_LVDSDataStruct SiS310_LVDS1024x768Data_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} -}; - -SiS310_LVDSDataStruct SiS310_LVDS1280x1024Data_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} -}; - -SiS310_LVDSDataStruct SiS310_LVDS1280x1024Data_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} -}; - -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}, - {1056, 628, 1056, 628}, - {1056, 628, 1056, 628}, - {1056, 628, 1056, 628}, - {1056, 628, 1056, 628} -}; - -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} -}; - -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} -}; - -SiS310_LVDSDataStruct SiS310_CHTVUPALData[] = { - {1008, 625, 1008, 625}, - {1008, 625, 1008, 625}, - {1008, 625, 1008, 625}, - {1008, 625, 1008, 625}, - {840, 750, 840, 750}, - {936, 836, 936, 836} -}; - -SiS310_LVDSDataStruct SiS310_CHTVOPALData[] = { - {1008, 625, 1008, 625}, - {1008, 625, 1008, 625}, - {1008, 625, 1008, 625}, - {1008, 625, 1008, 625}, - {840, 625, 840, 625}, - {960, 750, 960, 750} -}; - -typedef struct _SiS310_LVDSDesStruct { - USHORT LCDHDES; - USHORT LCDVDES; +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}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {800, 449,1000, 644}, + {800, 525,1000, 635} +}; + +SiS310_LVDSDataStruct SiS310_LVDS800x600Data_2[]= +{ + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {800, 449,1000, 644}, + {800, 525,1000, 635} +}; + +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}, + {1050, 638,1344, 806}, + {1344, 806,1344, 806}, + {800, 449,1280, 801}, + {800, 525,1280, 813} +}; + +SiS310_LVDSDataStruct SiS310_LVDS1024x768Data_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} +}; + +SiS310_LVDSDataStruct SiS310_LVDS1280x1024Data_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} +}; + +SiS310_LVDSDataStruct SiS310_LVDS1280x1024Data_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} +}; + +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}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628}, + {1056, 628,1056, 628} +}; + +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} +}; + +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} +}; + +SiS310_LVDSDataStruct SiS310_CHTVUPALData[]= +{ + {1008, 625,1008, 625}, + {1008, 625,1008, 625}, + {1008, 625,1008, 625}, + {1008, 625,1008, 625}, + {840, 750, 840, 750}, + {936, 836, 936, 836} +}; + +SiS310_LVDSDataStruct SiS310_CHTVOPALData[]= +{ + {1008, 625,1008, 625}, + {1008, 625,1008, 625}, + {1008, 625,1008, 625}, + {1008, 625,1008, 625}, + {840, 625, 840, 625}, + {960, 750, 960, 750} +}; + +typedef struct _SiS310_LVDSDesStruct +{ + USHORT LCDHDES; + USHORT LCDVDES; } SiS310_LVDSDesStruct; -SiS310_LVDSDesStruct SiS310_PanelType00_1[] = { - {1059, 626}, - {1059, 624}, - {1059, 626}, - {1059, 624}, - {1059, 624}, - {0, 627}, - {0, 627}, - {0, 0}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_PanelType01_1[] = { - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - {0, 805}, - {0, 794}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_PanelType02_1[] = { - {1059, 626}, - {1059, 624}, - {1059, 626}, - {1059, 624}, - {1059, 624}, - {0, 627}, - {0, 627}, - {0, 0}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_PanelType03_1[] = { - {8, 436}, - {8, 440}, - {8, 436}, - {8, 440}, - {8, 512}, - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794} -}; - -SiS310_LVDSDesStruct SiS310_PanelType04_1[] = { - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - {0, 805}, - {0, 794}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_PanelType05_1[] = { - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - {0, 805}, - {0, 794}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_PanelType06_1[] = { - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - {0, 805}, - {0, 794}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_PanelType07_1[] = { - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - {0, 805}, - {0, 794}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_PanelType08_1[] = { - {1059, 626}, - {1059, 624}, - {1059, 626}, - {1059, 624}, - {1059, 624}, - {0, 627}, - {0, 627}, - {0, 0}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_PanelType09_1[] = { - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - {0, 805}, - {0, 794}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_PanelType0a_1[] = { - {1059, 626}, - {1059, 624}, - {1059, 626}, - {1059, 624}, - {1059, 624}, - {0, 627}, - {0, 627}, - {0, 0}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_PanelType0b_1[] = { - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - {0, 805}, - {0, 794}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_PanelType0c_1[] = { - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - {0, 805}, - {0, 794}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_PanelType0d_1[] = { - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - {0, 805}, - {0, 794}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_PanelType0e_1[] = { - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - {0, 805}, - {0, 794}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_PanelType0f_1[] = { - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - {0, 805}, - {0, 794}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_PanelType00_2[] = { - {976, 527}, - {976, 502}, - {976, 527}, - {976, 502}, - {976, 567}, - {0, 627}, - {0, 627}, - {0, 0}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_PanelType01_2[] = { - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - {0, 805}, - {0, 794}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_PanelType02_2[] = { - {976, 527}, - {976, 502}, - {976, 527}, - {976, 502}, - {976, 567}, - {0, 627}, - {0, 627}, - {0, 0}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_PanelType03_2[] = { - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - {0, 805}, - {1152, 622}, - {1152, 597} -}; - -SiS310_LVDSDesStruct SiS310_PanelType04_2[] = { - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - {0, 805}, - {0, 794}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_PanelType05_2[] = { - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - {0, 805}, - {0, 794}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_PanelType06_2[] = { - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - {0, 805}, - {0, 794}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_PanelType07_2[] = { - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - {0, 805}, - {0, 794}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_PanelType08_2[] = { - {976, 527}, - {976, 502}, - {976, 527}, - {976, 502}, - {976, 567}, - {0, 627}, - {0, 627}, - {0, 0}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_PanelType09_2[] = { - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - {0, 805}, - {0, 794}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_PanelType0a_2[] = { - {976, 527}, - {976, 502}, - {976, 527}, - {976, 502}, - {976, 567}, - {0, 627}, - {0, 627}, - {0, 0}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_PanelType0b_2[] = { - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - {0, 805}, - {0, 794}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_PanelType0c_2[] = { - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - {0, 805}, - {0, 794}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_PanelType0d_2[] = { - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - {0, 805}, - {0, 794}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_PanelType0e_2[] = { - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - {0, 805}, - {0, 794}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_PanelType0f_2[] = { - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - {0, 805}, - {0, 794}, - {0, 0} +SiS310_LVDSDesStruct SiS310_PanelType00_1[]= +{ + {1059, 626}, + {1059, 624}, + {1059, 626}, + {1059, 624}, + {1059, 624}, + { 0, 627}, + { 0, 627}, + { 0, 0}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType01_1[]= +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType02_1[]= +{ + {1059, 626}, + {1059, 624}, + {1059, 626}, + {1059, 624}, + {1059, 624}, + { 0, 627}, + { 0, 627}, + { 0, 0}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType03_1[]= +{ + { 8, 436}, + { 8, 440}, + { 8, 436}, + { 8, 440}, + { 8, 512}, + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794} +}; + +SiS310_LVDSDesStruct SiS310_PanelType04_1[]= +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType05_1[]= +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType06_1[]= +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType07_1[]= +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType08_1[]= +{ + {1059, 626}, + {1059, 624}, + {1059, 626}, + {1059, 624}, + {1059, 624}, + { 0, 627}, + { 0, 627}, + { 0, 0}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType09_1[]= +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType0a_1[]= +{ + {1059, 626}, + {1059, 624}, + {1059, 626}, + {1059, 624}, + {1059, 624}, + { 0, 627}, + { 0, 627}, + { 0, 0}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType0b_1[]= +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType0c_1[]= +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType0d_1[]= +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType0e_1[]= +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType0f_1[]= +{ + {1343, 798}, + {1343, 794}, + {1343, 798}, + {1343, 794}, + {1343, 0}, + {1343, 0}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType00_2[]= +{ + {976, 527}, + {976, 502}, + {976, 527}, + {976, 502}, + {976, 567}, + { 0, 627}, + { 0, 627}, + { 0, 0}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType01_2[]= +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType02_2[]= +{ + {976, 527}, + {976, 502}, + {976, 527}, + {976, 502}, + {976, 567}, + { 0, 627}, + { 0, 627}, + { 0, 0}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType03_2[]= +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + {1152, 622}, + {1152, 597} +}; + +SiS310_LVDSDesStruct SiS310_PanelType04_2[]= +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType05_2[]= +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType06_2[]= +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType07_2[]= +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType08_2[]= +{ + {976, 527}, + {976, 502}, + {976, 527}, + {976, 502}, + {976, 567}, + { 0, 627}, + { 0, 627}, + { 0, 0}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType09_2[]= +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType0a_2[]= +{ + {976, 527}, + {976, 502}, + {976, 527}, + {976, 502}, + {976, 567}, + { 0, 627}, + { 0, 627}, + { 0, 0}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType0b_2[]= +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType0c_2[]= +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType0d_2[]= +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType0e_2[]= +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_PanelType0f_2[]= +{ + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + { 0, 794}, + { 0, 0} }; /*301b*/ -SiS310_LVDSDesStruct SiS310_PanelType1076_1[] = { - 0x00, 0x00 -}; -SiS310_LVDSDesStruct SiS310_PanelType1210_1[] = { - 0x00, 0x00 -}; -SiS310_LVDSDesStruct SiS310_PanelType1296_1[] = { - 0x00, 0x00 -}; -SiS310_LVDSDesStruct SiS310_PanelType1076_2[] = { - 0x00, 0x00 -}; -SiS310_LVDSDesStruct SiS310_PanelType1210_2[] = { - 0x00, 0x00 -}; -SiS310_LVDSDesStruct SiS310_PanelType1296_2[] = { - 0x00, 0x00 -}; +SiS310_LVDSDesStruct SiS310_PanelType1076_1[]= +{ +0x00,0x00}; +SiS310_LVDSDesStruct SiS310_PanelType1210_1[]= +{ +0x00,0x00}; +SiS310_LVDSDesStruct SiS310_PanelType1296_1[]= +{ +0x00,0x00}; +SiS310_LVDSDesStruct SiS310_PanelType1076_2[]= +{ +0x00,0x00}; +SiS310_LVDSDesStruct SiS310_PanelType1210_2[]= +{ +0x00,0x00}; +SiS310_LVDSDesStruct SiS310_PanelType1296_2[]= +{ +0x00,0x00}; /*end 301b*/ -SiS310_LVDSDesStruct SiS310_CHTVUNTSCDesData[] = { - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_CHTVONTSCDesData[] = { - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_CHTVUPALDesData[] = { - {256, 0}, - {256, 0}, - {256, 0}, - {256, 0}, - {0, 0}, - {0, 0} -}; - -SiS310_LVDSDesStruct SiS310_CHTVOPALDesData[] = { - {256, 0}, - {256, 0}, - {256, 0}, - {256, 0}, - {0, 0}, - {0, 0} -}; - -typedef struct _SiS310_LVDSCRT1DataStruct { - UCHAR CR[17]; +SiS310_LVDSDesStruct SiS310_CHTVUNTSCDesData[]= +{ + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_CHTVONTSCDesData[]= +{ + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_CHTVUPALDesData[]= +{ + {256, 0}, + {256, 0}, + {256, 0}, + {256, 0}, + { 0, 0}, + { 0, 0} +}; + +SiS310_LVDSDesStruct SiS310_CHTVOPALDesData[]= +{ + {256, 0}, + {256, 0}, + {256, 0}, + {256, 0}, + { 0, 0}, + { 0, 0} +}; + +typedef struct _SiS310_LVDSCRT1DataStruct +{ + UCHAR CR[17]; } SiS310_LVDSCRT1DataStruct; -SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_1[] = - { {0x65, 0x4f, 0x89, 0x56, 0x83, 0xaf, 0x1f, - 0x90, 0x85, 0x8f, 0xab, 0x30, 0x00, 0x05, - 0x00}, -{0x65, 0x4f, 0x89, 0x56, 0x83, 0x83, 0x1f, - 0x5e, 0x83, 0x5d, 0x79, 0x10, 0x00, 0x05, - 0x00}, -{0x65, 0x4f, 0x89, 0x56, 0x83, 0xaf, 0x1f, - 0x90, 0x85, 0x8f, 0xab, 0x30, 0x00, 0x05, - 0x00}, -{0x65, 0x4f, 0x89, 0x56, 0x83, 0x83, 0x1f, - 0x5e, 0x83, 0x5d, 0x79, 0x10, 0x00, 0x05, - 0x00}, -{0x65, 0x4f, 0x89, 0x56, 0x83, 0x04, 0x3e, - 0xe0, 0x85, 0xdf, 0xfb, 0x10, 0x00, 0x05, - 0x00}, -{0x7f, 0x63, 0x83, 0x6c, 0x1c, 0x72, 0xf0, - 0x58, 0x8c, 0x57, 0x73, 0x20, 0x00, 0x06, - 0x01} -}; - -SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_1[] = - { {0x73, 0x4f, 0x4f, 0x97, 0x55, 0x86, 0xc4, 0x1f, - 0x92, 0x89, 0x8f, 0x8f, 0xb5, 0x30, 0x00, 0x05, - 0x00}, -{0x73, 0x4f, 0x4f, 0x97, 0x55, 0x86, 0x97, 0x1f, - 0x60, 0x87, 0x5d, 0x5d, 0x83, 0x10, 0x00, 0x05, - 0x00}, -{0x73, 0x4f, 0x4f, 0x97, 0x55, 0x86, 0xc4, 0x1f, - 0x92, 0x89, 0x8f, 0x8f, 0xb5, 0x30, 0x00, 0x05, - 0x00}, -{0x73, 0x4f, 0x4f, 0x97, 0x55, 0x86, 0x97, 0x1f, - 0x60, 0x87, 0x5d, 0x5d, 0x83, 0x10, 0x00, 0x05, - 0x00}, -{0x73, 0x4f, 0x4f, 0x97, 0x55, 0x86, 0x04, 0x3e, - 0xE2, 0x89, 0xDf, 0xDf, 0x05, 0x00, 0x00, 0x05, - 0x00}, -{0x87, 0x63, 0x63, 0x8B, 0x69, 0x1A, 0x7c, 0xf0, - 0x5A, 0x8F, 0x57, 0x57, 0x7D, 0x20, 0x00, 0x26, - 0x01}, -{0xA3, 0x7f, 0x7f, 0x87, 0x86, 0x97, 0x24, 0xf5, - 0x02, 0x88, 0xFf, 0xFf, 0x25, 0x10, 0x00, 0x02, - 0x01} -}; - -SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_1[] = - { {0x63, 0x4f, 0x87, 0x54, 0x9f, 0xb4, 0x1f, - 0x92, 0x89, 0x8f, 0xb5, 0x30, 0x00, 0x01, - 0x00}, -{0x63, 0x4f, 0x87, 0x54, 0x9f, 0x82, 0x1f, - 0x60, 0x87, 0x5d, 0x83, 0x10, 0x00, 0x01, - 0x00}, -{0x63, 0x4f, 0x87, 0x54, 0x9f, 0xb4, 0x1f, - 0x92, 0x89, 0x8f, 0xb5, 0x30, 0x00, 0x01, - 0x00}, -{0x63, 0x4f, 0x87, 0x54, 0x9f, 0x82, 0x1f, - 0x60, 0x87, 0x5d, 0x83, 0x10, 0x00, 0x01, - 0x00}, -{0x63, 0x4f, 0x87, 0x54, 0x9f, 0x04, 0x3e, - 0xe2, 0x89, 0xdf, 0x05, 0x00, 0x00, 0x01, - 0x00}, -{0x7e, 0x63, 0x82, 0x68, 0x15, 0x7c, 0xf0, - 0x5a, 0x8f, 0x57, 0x7d, 0x20, 0x00, 0x26, - 0x01}, -{0xa3, 0x7f, 0x87, 0x86, 0x97, 0x24, 0xf5, - 0x02, 0x88, 0xff, 0x25, 0x10, 0x00, 0x02, - 0x01} -}; - -SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_1_H[] = - { {0x30, 0x27, 0x94, 0x2c, 0x92, 0xaf, 0x1f, - 0x90, 0x85, 0x8f, 0xab, 0x30, 0x00, 0x04, - 0x00}, -{0x30, 0x27, 0x94, 0x2c, 0x92, 0x83, 0x1f, - 0x5e, 0x83, 0x5d, 0x79, 0x10, 0x00, 0x04, - 0x00}, -{0x30, 0x27, 0x94, 0x2c, 0x92, 0xaf, 0x1f, - 0x90, 0x85, 0x8f, 0xab, 0x30, 0x00, 0x04, - 0x00}, -{0x30, 0x27, 0x94, 0x2c, 0x92, 0x83, 0x1f, - 0x5e, 0x83, 0x5d, 0x79, 0x10, 0x00, 0x04, - 0x00}, -{0x30, 0x27, 0x94, 0x2c, 0x92, 0x04, 0x3e, - 0xe0, 0x85, 0xdf, 0xfb, 0x10, 0x00, 0x04, - 0x00}, -{0x3d, 0x31, 0x81, 0x37, 0x1f, 0x72, 0xf0, - 0x58, 0x8c, 0x57, 0x73, 0x20, 0x00, 0x05, - 0x01} -}; - -SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_1_H[] = - { {0x37, 0x27, 0x27, 0x9B, 0x2b, 0x94, 0xc4, 0x1f, - 0x92, 0x89, 0x8f, 0x8f, 0xb5, 0x30, 0x00, 0x44, - 0x00}, -{0x37, 0x27, 0x27, 0x9B, 0x2b, 0x94, 0x97, 0x1f, - 0x60, 0x87, 0x5D, 0x5D, 0x83, 0x01, 0x00, 0x44, - 0x00}, -{0x37, 0x27, 0x27, 0x9B, 0x2b, 0x94, 0xc4, 0x1f, - 0x92, 0x89, 0x8f, 0x8f, 0xb5, 0x30, 0x00, 0x44, - 0x00}, -{0x37, 0x27, 0x27, 0x9B, 0x2b, 0x94, 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, - 0x00}, -{0x41, 0x31, 0x31, 0x85, 0x35, 0x1d, 0x7c, 0xf0, - 0x5A, 0x8F, 0x57, 0x57, 0x7D, 0x20, 0x00, 0x55, - 0x01}, -{0x4f, 0x3F, 0x3F, 0x93, 0x45, 0x0D, 0x24, 0xf5, - 0x02, 0x88, 0xFf, 0xFf, 0x25, 0x10, 0x00, 0x01, - 0x01} -}; - -SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_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, - 0x00}, -{0x2f, 0x27, 0x93, 0x2b, 0x90, 0x82, 0x1f, - 0x60, 0x87, 0x5d, 0x83, 0x10, 0x00, 0x04, - 0x00}, -{0x2f, 0x27, 0x93, 0x2b, 0x90, 0x04, 0x3e, - 0xe2, 0x89, 0xdf, 0x05, 0x00, 0x00, 0x04, - 0x00}, -{0x3c, 0x31, 0x80, 0x35, 0x1c, 0x7c, 0xf0, - 0x5a, 0x8f, 0x57, 0x7d, 0x20, 0x00, 0x55, - 0x01}, -{0x4f, 0x3f, 0x93, 0x45, 0x0d, 0x24, 0xf5, - 0x02, 0x88, 0xff, 0x25, 0x10, 0x00, 0x01, - 0x01} -}; - -SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_2[] = - { {0x7f, 0x4f, 0x83, 0x62, 0x12, 0x72, 0x3e, - 0xf4, 0x88, 0x8f, 0x73, 0x20, 0x00, 0x06, - 0x00}, -{0x7f, 0x4f, 0x83, 0x62, 0x12, 0x72, 0x3e, - 0xdb, 0x8f, 0x5d, 0x73, 0x20, 0x00, 0x06, - 0x00}, -{0x7f, 0x4f, 0x83, 0x62, 0x12, 0x72, 0x3e, - 0xf4, 0x88, 0x8f, 0x73, 0x20, 0x00, 0x06, - 0x00}, -{0x7f, 0x4f, 0x83, 0x62, 0x12, 0x72, 0x3e, - 0xdb, 0x8f, 0x5d, 0x73, 0x20, 0x00, 0x06, - 0x00}, -{0x7f, 0x4f, 0x83, 0x62, 0x12, 0x72, 0xba, - 0x1c, 0x80, 0xdf, 0x73, 0x00, 0x00, 0x06, - 0x00}, -{0x7f, 0x63, 0x83, 0x6c, 0x1c, 0x72, 0xf0, - 0x58, 0x8c, 0x57, 0x73, 0x20, 0x00, 0x06, - 0x01} -}; - -SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_2[] = - { {0xa3, 0x4f, 0x87, 0x6e, 0x9f, 0x24, 0xbb, - 0x4a, 0x80, 0x8f, 0x25, 0x30, 0x00, 0x06, - 0x00}, -{0xa3, 0x4f, 0x87, 0x6e, 0x9f, 0x24, 0xbb, - 0x31, 0x87, 0x5d, 0x25, 0x30, 0x00, 0x06, - 0x00}, -{0xa3, 0x4f, 0x87, 0x6e, 0x9f, 0x24, 0xbb, - 0x4a, 0x80, 0x8f, 0x25, 0x30, 0x00, 0x06, - 0x00}, -{0xa3, 0x4f, 0x87, 0x6e, 0x9f, 0x24, 0xbb, - 0x31, 0x87, 0x5d, 0x25, 0x30, 0x00, 0x06, - 0x00}, -{0xa3, 0x4f, 0x87, 0x6e, 0x9f, 0x24, 0xbb, - 0x72, 0x88, 0xdf, 0x25, 0x30, 0x00, 0x06, - 0x00}, -{0xa3, 0x63, 0x87, 0x78, 0x89, 0x24, 0xf1, - 0xae, 0x84, 0x57, 0x25, 0x30, 0x00, 0x02, - 0x01}, -{0xa3, 0x7f, 0x87, 0x86, 0x97, 0x24, 0xf5, - 0x02, 0x88, 0xff, 0x25, 0x10, 0x00, 0x02, - 0x01} -}; - -SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_2[] = - { {0xa3, 0x4f, 0x87, 0x6e, 0x9f, 0x24, 0xbb, - 0x4a, 0x80, 0x8f, 0x25, 0x30, 0x00, 0x06, - 0x00}, -{0xa3, 0x4f, 0x87, 0x6e, 0x9f, 0x24, 0xbb, - 0x31, 0x87, 0x5d, 0x25, 0x30, 0x00, 0x06, - 0x00}, -{0xa3, 0x4f, 0x87, 0x6e, 0x9f, 0x24, 0xbb, - 0x4a, 0x80, 0x8f, 0x25, 0x30, 0x00, 0x06, - 0x00}, -{0xa3, 0x4f, 0x87, 0x6e, 0x9f, 0x24, 0xbb, - 0x31, 0x87, 0x5d, 0x25, 0x30, 0x00, 0x06, - 0x00}, -{0xa3, 0x4f, 0x87, 0x6e, 0x9f, 0x24, 0xbb, - 0x72, 0x88, 0xdf, 0x25, 0x30, 0x00, 0x06, - 0x00}, -{0xa3, 0x63, 0x87, 0x78, 0x89, 0x24, 0xf1, - 0xae, 0x84, 0x57, 0x25, 0x30, 0x00, 0x02, - 0x01}, -{0xa3, 0x7f, 0x87, 0x86, 0x97, 0x24, 0xf5, - 0x02, 0x88, 0xff, 0x25, 0x10, 0x00, 0x02, - 0x01} -}; - -SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_2_H[] = - { {0x3d, 0x27, 0x81, 0x32, 0x1a, 0x72, 0x3e, - 0xf4, 0x88, 0x8f, 0x73, 0x20, 0x00, 0x05, - 0x00}, -{0x3d, 0x27, 0x81, 0x32, 0x1a, 0x72, 0x3e, - 0xdb, 0x8f, 0x5d, 0x73, 0x20, 0x00, 0x05, - 0x00}, -{0x3d, 0x27, 0x81, 0x32, 0x1a, 0x72, 0x3e, - 0xf4, 0x88, 0x8f, 0x73, 0x20, 0x00, 0x05, - 0x00}, -{0x3d, 0x27, 0x81, 0x3a, 0x1a, 0x72, 0x3e, - 0xdb, 0x8f, 0x5d, 0x73, 0x20, 0x00, 0x05, - 0x00}, -{0x3d, 0x27, 0x81, 0x32, 0x1a, 0x72, 0xba, - 0x1c, 0x80, 0xdf, 0x73, 0x00, 0x00, 0x05, - 0x00}, -{0x3d, 0x31, 0x81, 0x37, 0x1f, 0x72, 0xf0, - 0x58, 0x8c, 0x57, 0x73, 0x20, 0x00, 0x05, - 0x01} -}; - -SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_2_H[] = - { {0x4f, 0x27, 0x93, 0x39, 0x01, 0x24, 0xbb, - 0x4a, 0x80, 0x8f, 0x25, 0x30, 0x00, 0x01, - 0x00}, -{0x4f, 0x27, 0x93, 0x39, 0x01, 0x24, 0xbb, - 0x31, 0x87, 0x5d, 0x25, 0x30, 0x00, 0x01, - 0x00}, -{0x4f, 0x27, 0x93, 0x39, 0x01, 0x24, 0xbb, - 0x4a, 0x80, 0x8f, 0x25, 0x30, 0x00, 0x01, - 0x00}, -{0x4f, 0x27, 0x93, 0x39, 0x01, 0x24, 0xbb, - 0x31, 0x87, 0x5d, 0x25, 0x30, 0x00, 0x01, - 0x00}, -{0x4f, 0x27, 0x93, 0x39, 0x01, 0x24, 0xbb, - 0x72, 0x88, 0xdf, 0x25, 0x30, 0x00, 0x01, - 0x00}, -{0x4f, 0x31, 0x93, 0x3e, 0x06, 0x24, 0xf1, - 0xae, 0x84, 0x57, 0x25, 0x30, 0x00, 0x01, - 0x01}, -{0x4f, 0x3f, 0x93, 0x45, 0x0d, 0x24, 0xf5, - 0x02, 0x88, 0xff, 0x25, 0x10, 0x00, 0x01, - 0x01} -}; - -SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_2_H[] = - { {0x4f, 0x27, 0x93, 0x39, 0x81, 0x24, 0xbb, - 0x4a, 0x80, 0x8f, 0x25, 0x30, 0x00, 0x01, - 0x00}, -{0x4f, 0x27, 0x93, 0x39, 0x81, 0x24, 0xbb, - 0x31, 0x87, 0x5d, 0x25, 0x30, 0x00, 0x01, - 0x00}, -{0x4f, 0x27, 0x93, 0x39, 0x81, 0x24, 0xbb, - 0x4a, 0x80, 0x8f, 0x25, 0x30, 0x00, 0x01, - 0x00}, -{0x4f, 0x27, 0x93, 0x39, 0x81, 0x24, 0xbb, - 0x31, 0x87, 0x5d, 0x25, 0x30, 0x00, 0x01, - 0x00}, -{0x4f, 0x27, 0x93, 0x39, 0x81, 0x24, 0xbb, - 0x72, 0x88, 0xdf, 0x25, 0x30, 0x00, 0x01, - 0x00}, -{0x4f, 0x31, 0x93, 0x3e, 0x86, 0x24, 0xf1, - 0xae, 0x84, 0x57, 0x25, 0x30, 0x00, 0x01, - 0x01}, -{0x4f, 0x3f, 0x93, 0x45, 0x0d, 0x24, 0xf5, - 0x02, 0x88, 0xff, 0x25, 0x10, 0x00, 0x01, - 0x01} -}; - -SiS310_LVDSCRT1DataStruct SiS310_CHTVCRT1UNTSC[] = - { {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, 0x53, 0x9c, 0x56, 0xba, - 0x18, 0x84, 0xdf, 0x57, 0x00, 0x00, 0x01, - 0x00}, -{0x80, 0x63, 0x84, 0x6c, 0x17, 0xec, 0xf0, - 0x90, 0x8c, 0x57, 0xed, 0x20, 0x00, 0x06, - 0x01} -}; - -SiS310_LVDSCRT1DataStruct SiS310_CHTVCRT1ONTSC[] = - { {0x64, 0x4f, 0x88, 0x5a, 0x9f, 0x0b, 0x3e, - 0xc0, 0x84, 0x8f, 0x0c, 0x20, 0x00, 0x01, - 0x00}, -{0x64, 0x4f, 0x88, 0x5a, 0x9f, 0x0b, 0x3e, - 0xb0, 0x8d, 0x5d, 0x0c, 0x00, 0x00, 0x01, - 0x00}, -{0x64, 0x4f, 0x88, 0x5a, 0x9f, 0x0b, 0x3e, - 0xc0, 0x84, 0x8f, 0x0c, 0x20, 0x00, 0x01, - 0x00}, -{0x64, 0x4f, 0x88, 0x5a, 0x9f, 0x0b, 0x3e, - 0xb0, 0x8d, 0x5d, 0x0c, 0x00, 0x00, 0x01, - 0x00}, -{0x5d, 0x4f, 0x81, 0x56, 0x9c, 0x0b, 0x3e, - 0xe8, 0x84, 0xdf, 0x0c, 0x00, 0x00, 0x01, - 0x00}, -{0x7d, 0x63, 0x81, 0x6a, 0x16, 0xba, 0xf0, - 0x7f, 0x86, 0x57, 0xbb, 0x00, 0x00, 0x06, - 0x01} -}; - -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, 0x55, 0x80, 0xec, 0xba, - 0x50, 0x84, 0xdf, 0xed, 0x00, 0x00, 0x05, - 0x00}, -{0x70, 0x63, 0x94, 0x68, 0x8d, 0x42, 0xf1, - 0xc8, 0x8c, 0x57, 0xe9, 0x20, 0x00, 0x05, - 0x01} -}; - -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, 0x55, 0x80, 0x6f, 0xba, - 0x20, 0x83, 0xdf, 0x70, 0x00, 0x00, 0x05, - 0x00}, -{0x73, 0x63, 0x97, 0x69, 0x8e, 0xec, 0xf0, - 0x90, 0x8c, 0x57, 0xed, 0x20, 0x00, 0x05, - 0x01} -}; - -typedef struct _SiS310_CHTVRegDataStruct { - UCHAR Reg[5]; +SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_1[]= +{{0x65,0x4f,0x89,0x56,0x83,0xaf,0x1f, + 0x90,0x85,0x8f,0xab,0x30,0x00,0x05, + 0x00 }, + {0x65,0x4f,0x89,0x56,0x83,0x83,0x1f, + 0x5e,0x83,0x5d,0x79,0x10,0x00,0x05, + 0x00 }, + {0x65,0x4f,0x89,0x56,0x83,0xaf,0x1f, + 0x90,0x85,0x8f,0xab,0x30,0x00,0x05, + 0x00 }, + {0x65,0x4f,0x89,0x56,0x83,0x83,0x1f, + 0x5e,0x83,0x5d,0x79,0x10,0x00,0x05, + 0x00 }, + {0x65,0x4f,0x89,0x56,0x83,0x04,0x3e, + 0xe0,0x85,0xdf,0xfb,0x10,0x00,0x05, + 0x00 }, + {0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0, + 0x58,0x8c,0x57,0x73,0x20,0x00,0x06, + 0x01 }}; + +SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_1[]= +{{0x73,0x4f,0x4f,0x97,0x55,0x86,0xc4,0x1f, + 0x92,0x89,0x8f,0x8f,0xb5,0x30,0x00,0x05, + 0x00 }, + {0x73,0x4f,0x4f,0x97,0x55,0x86,0x97,0x1f, + 0x60,0x87,0x5d,0x5d,0x83,0x10,0x00,0x05, + 0x00 }, + {0x73,0x4f,0x4f,0x97,0x55,0x86,0xc4,0x1f, + 0x92,0x89,0x8f,0x8f,0xb5,0x30,0x00,0x05, + 0x00}, + {0x73,0x4f,0x4f,0x97,0x55,0x86,0x97,0x1f, + 0x60,0x87,0x5d,0x5d,0x83,0x10,0x00,0x05, + 0x00 }, + {0x73,0x4f,0x4f,0x97,0x55,0x86,0x04,0x3e, + 0xE2,0x89,0xDf,0xDf,0x05,0x00,0x00,0x05, + 0x00}, + {0x87,0x63,0x63,0x8B,0x69,0x1A,0x7c,0xf0, + 0x5A,0x8F,0x57,0x57,0x7D,0x20,0x00,0x26, + 0x01}, + {0xA3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xFf,0xFf,0x25,0x10,0x00,0x02, + 0x01 }}; + +SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_1[]= +{{0x63,0x4f,0x87,0x54,0x9f,0xb4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x01, + 0x00 }, + {0x63,0x4f,0x87,0x54,0x9f,0x82,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x01, + 0x00 }, + {0x63,0x4f,0x87,0x54,0x9f,0xb4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x01, + 0x00 }, + {0x63,0x4f,0x87,0x54,0x9f,0x82,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x01, + 0x00 }, + {0x63,0x4f,0x87,0x54,0x9f,0x04,0x3e, + 0xe2,0x89,0xdf,0x05,0x00,0x00,0x01, + 0x00 }, + {0x7e,0x63,0x82,0x68,0x15,0x7c,0xf0, + 0x5a,0x8f,0x57,0x7d,0x20,0x00,0x26, + 0x01 }, + {0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x02, + 0x01 }}; + +SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_1_H[]= +{{0x30,0x27,0x94,0x2c,0x92,0xaf,0x1f, + 0x90,0x85,0x8f,0xab,0x30,0x00,0x04, + 0x00 }, + {0x30,0x27,0x94,0x2c,0x92,0x83,0x1f, + 0x5e,0x83,0x5d,0x79,0x10,0x00,0x04, + 0x00 }, + {0x30,0x27,0x94,0x2c,0x92,0xaf,0x1f, + 0x90,0x85,0x8f,0xab,0x30,0x00,0x04, + 0x00 }, + {0x30,0x27,0x94,0x2c,0x92,0x83,0x1f, + 0x5e,0x83,0x5d,0x79,0x10,0x00,0x04, + 0x00 }, + {0x30,0x27,0x94,0x2c,0x92,0x04,0x3e, + 0xe0,0x85,0xdf,0xfb,0x10,0x00,0x04, + 0x00 }, + {0x3d,0x31,0x81,0x37,0x1f,0x72,0xf0, + 0x58,0x8c,0x57,0x73,0x20,0x00,0x05, + 0x01 }}; + +SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_1_H[]= +{{0x37,0x27,0x27,0x9B,0x2b,0x94,0xc4,0x1f, + 0x92,0x89,0x8f,0x8f,0xb5,0x30,0x00,0x44, + 0x00 }, + {0x37,0x27,0x27,0x9B,0x2b,0x94,0x97,0x1f, + 0x60,0x87,0x5D,0x5D,0x83,0x01,0x00,0x44, + 0x00}, + {0x37,0x27,0x27,0x9B,0x2b,0x94,0xc4,0x1f, + 0x92,0x89,0x8f,0x8f,0xb5,0x30,0x00,0x44, + 0x00}, + {0x37,0x27,0x27,0x9B,0x2b,0x94,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, + 0x00}, + {0x41,0x31,0x31,0x85,0x35,0x1d,0x7c,0xf0, + 0x5A,0x8F,0x57,0x57,0x7D,0x20,0x00,0x55, + 0x01}, + {0x4f,0x3F,0x3F,0x93,0x45,0x0D,0x24,0xf5, + 0x02,0x88,0xFf,0xFf,0x25,0x10,0x00,0x01, + 0x01 }}; + +SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_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, + 0x00 }, + {0x2f,0x27,0x93,0x2b,0x90,0x82,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x04, + 0x00 }, + {0x2f,0x27,0x93,0x2b,0x90,0x04,0x3e, + 0xe2,0x89,0xdf,0x05,0x00,0x00,0x04, + 0x00 }, + {0x3c,0x31,0x80,0x35,0x1c,0x7c,0xf0, + 0x5a,0x8f,0x57,0x7d,0x20,0x00,0x55, + 0x01 }, + {0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x01, + 0x01 }}; + +SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_2[]= +{ {0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, + 0xf4,0x88,0x8f,0x73,0x20,0x00,0x06, + 0x00 }, + {0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, + 0xdb,0x8f,0x5d,0x73,0x20,0x00,0x06, + 0x00 }, + {0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, + 0xf4,0x88,0x8f,0x73,0x20,0x00,0x06, + 0x00 }, + {0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, + 0xdb,0x8f,0x5d,0x73,0x20,0x00,0x06, + 0x00 }, + {0x7f,0x4f,0x83,0x62,0x12,0x72,0xba, + 0x1c,0x80,0xdf,0x73,0x00,0x00,0x06, + 0x00 }, + {0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0, + 0x58,0x8c,0x57,0x73,0x20,0x00,0x06, + 0x01 }}; + +SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_2[]= +{ {0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, + 0x00 }, + {0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, + 0x00 }, + {0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, + 0x00 }, + {0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, + 0x00 }, + {0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x72,0x88,0xdf,0x25,0x30,0x00,0x06, + 0x00 }, + {0xa3,0x63,0x87,0x78,0x89,0x24,0xf1, + 0xae,0x84,0x57,0x25,0x30,0x00,0x02, + 0x01 }, + {0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x02, + 0x01 }}; + +SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_2[]= +{ {0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, + 0x00 }, + {0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, + 0x00 }, + {0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, + 0x00 }, + {0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, + 0x00 }, + {0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, + 0x72,0x88,0xdf,0x25,0x30,0x00,0x06, + 0x00 }, + {0xa3,0x63,0x87,0x78,0x89,0x24,0xf1, + 0xae,0x84,0x57,0x25,0x30,0x00,0x02, + 0x01 }, + {0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x02, + 0x01 }}; + +SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_2_H[]= +{ {0x3d,0x27,0x81,0x32,0x1a,0x72,0x3e, + 0xf4,0x88,0x8f,0x73,0x20,0x00,0x05, + 0x00 }, + {0x3d,0x27,0x81,0x32,0x1a,0x72,0x3e, + 0xdb,0x8f,0x5d,0x73,0x20,0x00,0x05, + 0x00 }, + {0x3d,0x27,0x81,0x32,0x1a,0x72,0x3e, + 0xf4,0x88,0x8f,0x73,0x20,0x00,0x05, + 0x00 }, + {0x3d,0x27,0x81,0x3a,0x1a,0x72,0x3e, + 0xdb,0x8f,0x5d,0x73,0x20,0x00,0x05, + 0x00 }, + {0x3d,0x27,0x81,0x32,0x1a,0x72,0xba, + 0x1c,0x80,0xdf,0x73,0x00,0x00,0x05, + 0x00 }, + {0x3d,0x31,0x81,0x37,0x1f,0x72,0xf0, + 0x58,0x8c,0x57,0x73,0x20,0x00,0x05, + 0x01 }}; + +SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_2_H[]= +{ {0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, + 0x00 }, + {0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, + 0x00 }, + {0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, + 0x00 }, + {0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, + 0x00 }, + {0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, + 0x72,0x88,0xdf,0x25,0x30,0x00,0x01, + 0x00 }, + {0x4f,0x31,0x93,0x3e,0x06,0x24,0xf1, + 0xae,0x84,0x57,0x25,0x30,0x00,0x01, + 0x01 }, + {0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x01, + 0x01 }}; + +SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_2_H[]= +{ {0x4f,0x27,0x93,0x39,0x81,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, + 0x00 }, + {0x4f,0x27,0x93,0x39,0x81,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, + 0x00 }, + {0x4f,0x27,0x93,0x39,0x81,0x24,0xbb, + 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, + 0x00 }, + {0x4f,0x27,0x93,0x39,0x81,0x24,0xbb, + 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, + 0x00 }, + {0x4f,0x27,0x93,0x39,0x81,0x24,0xbb, + 0x72,0x88,0xdf,0x25,0x30,0x00,0x01, + 0x00 }, + {0x4f,0x31,0x93,0x3e,0x86,0x24,0xf1, + 0xae,0x84,0x57,0x25,0x30,0x00,0x01, + 0x01 }, + {0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x01, + 0x01 }}; + +SiS310_LVDSCRT1DataStruct SiS310_CHTVCRT1UNTSC[]= +{ {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,0x53,0x9c,0x56,0xba, + 0x18,0x84,0xdf,0x57,0x00,0x00,0x01, + 0x00 }, + {0x80,0x63,0x84,0x6c,0x17,0xec,0xf0, + 0x90,0x8c,0x57,0xed,0x20,0x00,0x06, + 0x01 }}; + +SiS310_LVDSCRT1DataStruct SiS310_CHTVCRT1ONTSC[]= +{ {0x64,0x4f,0x88,0x5a,0x9f,0x0b,0x3e, + 0xc0,0x84,0x8f,0x0c,0x20,0x00,0x01, + 0x00 }, + {0x64,0x4f,0x88,0x5a,0x9f,0x0b,0x3e, + 0xb0,0x8d,0x5d,0x0c,0x00,0x00,0x01, + 0x00 }, + {0x64,0x4f,0x88,0x5a,0x9f,0x0b,0x3e, + 0xc0,0x84,0x8f,0x0c,0x20,0x00,0x01, + 0x00 }, + {0x64,0x4f,0x88,0x5a,0x9f,0x0b,0x3e, + 0xb0,0x8d,0x5d,0x0c,0x00,0x00,0x01, + 0x00 }, + {0x5d,0x4f,0x81,0x56,0x9c,0x0b,0x3e, + 0xe8,0x84,0xdf,0x0c,0x00,0x00,0x01, + 0x00 }, + {0x7d,0x63,0x81,0x6a,0x16,0xba,0xf0, + 0x7f,0x86,0x57,0xbb,0x00,0x00,0x06, + 0x01 }}; + +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,0x55,0x80,0xec,0xba, + 0x50,0x84,0xdf,0xed,0x00,0x00,0x05, + 0x00 }, + {0x70,0x63,0x94,0x68,0x8d,0x42,0xf1, + 0xc8,0x8c,0x57,0xe9,0x20,0x00,0x05, + 0x01 }}; + +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,0x55,0x80,0x6f,0xba, + 0x20,0x83,0xdf,0x70,0x00,0x00,0x05, + 0x00 }, + {0x73,0x63,0x97,0x69,0x8e,0xec,0xf0, + 0x90,0x8c,0x57,0xed,0x20,0x00,0x05, + 0x01 }}; + +typedef struct _SiS310_CHTVRegDataStruct +{ + UCHAR Reg[5]; } SiS310_CHTVRegDataStruct; SiS310_CHTVRegDataStruct SiS310_CHTVReg_UNTSC[] = { - 0x00 -}; +0x00 }; SiS310_CHTVRegDataStruct SiS310_CHTVReg_ONTSC[] = { - 0x00 -}; +0x00 }; SiS310_CHTVRegDataStruct SiS310_CHTVReg_UPAL[] = { - 0x00 -}; +0x00 }; SiS310_CHTVRegDataStruct SiS310_CHTVReg_OPAL[] = { - 0x00 -}; +0x00 }; + +UCHAR SiS310_CHTVVCLKUNTSC[]={0x00 }; -UCHAR SiS310_CHTVVCLKUNTSC[] = { 0x00 }; +UCHAR SiS310_CHTVVCLKONTSC[]={0x00 }; -UCHAR SiS310_CHTVVCLKONTSC[] = { 0x00 }; +UCHAR SiS310_CHTVVCLKUPAL[]={0x00 }; -UCHAR SiS310_CHTVVCLKUPAL[] = { 0x00 }; +UCHAR SiS310_CHTVVCLKOPAL[]={0x00 }; -UCHAR SiS310_CHTVVCLKOPAL[] = { 0x00 }; diff --git a/drivers/video/sis/init.c b/drivers/video/sis/init.c index 1573adbb0989..ac3f0c367a2b 100644 --- a/drivers/video/sis/init.c +++ b/drivers/video/sis/init.c @@ -1,809 +1,958 @@ -/* Function: Support NT X.0 MM function */ -/* Version : V 0.80 [ynlai] 04/12/98 */ +/* $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 + * (Universal module for Linux kernel framebuffer and XFree86 4.x) + * + * Assembler-To-C translation + * Parts Copyright 2002 by Thomas Winischhofer <thomas@winischhofer.net> + * + * Based on BIOS + * 1.10.07 (1.10a) for SiS650/LVDS+CH7019 + * 1.07.1b 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 + * 1.09b for 315/301(B) + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of the copyright holder not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. The copyright holder makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + */ #include "init.h" -#ifdef CONFIG_FB_SIS_300 + +#ifdef SIS300 #include "300vtbl.h" #endif -#ifdef CONFIG_FB_SIS_315 + +#ifdef SIS315H #include "310vtbl.h" #endif -BOOLEAN SiSInit (PSIS_HW_DEVICE_INFO HwDeviceExtension); -BOOLEAN SiSSetMode (PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT ModeNo); +#ifdef LINUX_XF86 +BOOLEAN SiSBIOSSetMode(PSIS_HW_DEVICE_INFO HwDeviceExtension, + ScrnInfoPtr pScrn, DisplayModePtr mode); +#ifdef SISDUALHEAD /* TW: For dual head */ +BOOLEAN SiSBIOSSetModeCRT1(PSIS_HW_DEVICE_INFO HwDeviceExtension, + ScrnInfoPtr pScrn, DisplayModePtr mode); +BOOLEAN SiSBIOSSetModeCRT2(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); +#endif + +#ifdef LINUX_XF86 +BOOLEAN SiSSetMode(PSIS_HW_DEVICE_INFO HwDeviceExtension, + ScrnInfoPtr pScrn,USHORT ModeNo); +#else +BOOLEAN SiSSetMode(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo); +#endif #if defined(ALLOC_PRAGMA) #pragma alloc_text(PAGE,SiSSetMode) #pragma alloc_text(PAGE,SiSInit) #endif -void SiS_SetReg1 (USHORT, USHORT, USHORT); -void SiS_SetReg2 (USHORT, USHORT, USHORT); -void SiS_SetReg3 (USHORT, USHORT); -void SiS_SetReg4 (USHORT, ULONG); -UCHAR SiS_GetReg1 (USHORT, USHORT); -UCHAR SiS_GetReg2 (USHORT); -ULONG SiS_GetReg3 (USHORT); -void SiS_ClearDAC (ULONG); +void DelaySeconds(int seconds); +void DebugCode(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 */ +#endif + +void +DelaySeconds(int seconds) +{ + int i; +#ifdef WIN2000 + int j; +#endif + + for (i=0;i<seconds;i++) { +#ifdef TC + delay(1000); +#endif + +#ifdef WIN2000 + for (j=0;j<20000;j++) + VideoPortStallExecution(50); +#endif + +#ifdef WINCE_HEADER +#endif + +#ifdef LINUX_KERNEL +#endif + } +} + +void +DebugCode(UCHAR code) +{ + OutPortByte ( 0x80, code); + /*OutPortByte ( 0x300, code);*/ + DelaySeconds(0x3); +} -#ifdef CONFIG_FB_SIS_300 +#ifdef SIS300 void -InitTo300Pointer (void) -{ - SiS_SModeIDTable = (SiS_StStruct *) SiS300_SModeIDTable; - SiS_VBModeIDTable = (SiS_VBModeStruct *) SiS300_VBModeIDTable; /*add for 300 oem util */ - 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 = (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; /*add for PALMN */ - SiS_PALNPhase = SiS300_PALNPhase; - - 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_NoScaleData = (SiS_LCDDataStruct *) SiS300_NoScaleData; - 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_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_LVDS640x480Data_1 = (SiS_LVDSDataStruct *) SiS300_LVDS640x480Data_1; - 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_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_LVDSCRT1800x600_2 = - (SiS_LVDSCRT1DataStruct *) SiS300_LVDSCRT1800x600_2; - SiS_LVDSCRT11024x768_2 = - (SiS_LVDSCRT1DataStruct *) SiS300_LVDSCRT11024x768_2; - SiS_LVDSCRT11280x1024_2 = - (SiS_LVDSCRT1DataStruct *) SiS300_LVDSCRT11280x1024_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_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; - /* 300 customization related */ -} -#endif - -#ifdef CONFIG_FB_SIS_315 +InitTo300Pointer(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 */ + +} +#endif + +#ifdef SIS315H void -InitTo310Pointer (void) -{ - 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_MCLKData = (SiS_MCLKDataStruct *) SiS310_MCLKData; - 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; /*add for PALMN */ - SiS_PALNPhase = SiS310_PALNPhase; - - 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_NoScaleData = (SiS_LCDDataStruct *) SiS310_NoScaleData; - 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_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_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; - /*301b */ - 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; - /*end 301b */ - - 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_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_LVDSCRT1800x600_2 = - (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT1800x600_2; - SiS_LVDSCRT11024x768_2 = - (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT11024x768_2; - SiS_LVDSCRT11280x1024_2 = - (SiS_LVDSCRT1DataStruct *) SiS310_LVDSCRT11280x1024_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_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; - /*add for LCDA */ - 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; - /*end for 301b */ - - SiS_CHTVVCLKUNTSC = SiS310_CHTVVCLKUNTSC; - SiS_CHTVVCLKONTSC = SiS310_CHTVVCLKONTSC; - SiS_CHTVVCLKUPAL = SiS310_CHTVVCLKUPAL; - SiS_CHTVVCLKOPAL = SiS310_CHTVVCLKOPAL; - /* 310 customization related */ +InitTo310Pointer(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; + + /* TW: MCLK is different */ + if(HwDeviceExtension->jChipType > SIS_315PRO) { + SiS_MCLKData_0 = (SiS_MCLKDataStruct *) SiS310_MCLKData_0_650; /* 550, 650 */ + } else { + 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; + + /* 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 */ } #endif +#ifndef LINUX_XF86 +/* -------------- SiSInit -----------------*/ BOOLEAN -SiSInit (PSIS_HW_DEVICE_INFO HwDeviceExtension) -{ - ULONG ROMAddr = (ULONG) HwDeviceExtension->pjVirtualRomBase; - ULONG FBAddr = (ULONG) HwDeviceExtension->pjVideoMemoryAddress; - USHORT BaseAddr = (USHORT) HwDeviceExtension->ulIOAddress; - UCHAR i, temp = 0; - UCHAR SR11, temp1; - ULONG base; - UCHAR SR12 = 0, SR13 = 0, SR14 = 0, SR16 = 0, SR17 = 0, SR18 = 0, SR19 = - 0, SR1A = 0; -#ifdef CONFIG_FB_SIS_315 - /* ULONG j, k; */ - UCHAR CR39 = 0, CR3A = 0, CR3B = 0, CR3C = 0, CR3D = 0, CR3E = 0, CR3F = - 0; - UCHAR CR79 = 0, CR7A = 0, CR7B = 0, CR7C = 0; - PSIS_DSReg pSR; - ULONG Temp; -#endif - UCHAR VBIOSVersion[5]; - -/* if(ROMAddr==0) return (FALSE);*/ - if (FBAddr == 0) - return (FALSE); - if (BaseAddr == 0) - return (FALSE); - - SiS_SetReg3 ((USHORT) (BaseAddr + 0x12), 0x67); /* 3c2 <- 67 ,ynlai */ -#ifdef CONFIG_FB_SIS_315 - /*if(HwDeviceExtension->jChipType > SIS_315H) */ - if (HwDeviceExtension->jChipType > SIS_315PRO) { - if (!HwDeviceExtension->bIntegratedMMEnabled) - return (FALSE); /* alan */ - } +SiSInit(PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + UCHAR *ROMAddr = HwDeviceExtension->pjVirtualRomBase; + ULONG FBAddr = (ULONG)HwDeviceExtension->pjVideoMemoryAddress; + USHORT BaseAddr = (USHORT)HwDeviceExtension->ulIOAddress; + 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; +#ifdef SIS300 + 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; + ULONG Temp; +#endif + UCHAR VBIOSVersion[5]; - SiS_MemoryCopy (VBIOSVersion, HwDeviceExtension->szVBIOSVer, 4); - - VBIOSVersion[4] = 0x0; - /* 09/07/99 modify by domao */ - -#ifdef CONFIG_FB_SIS_315 - if ((HwDeviceExtension->jChipType == SIS_315H) || - (HwDeviceExtension->jChipType == SIS_315PRO) || - (HwDeviceExtension->jChipType == SIS_550) || /* 05/02/01 ynlai for 550 */ - (HwDeviceExtension->jChipType == SIS_640) || /* 08/20/01 chiawen for 640/740 */ - (HwDeviceExtension->jChipType == SIS_740)) /* 09/03/01 chiawen for 650 */ - InitTo310Pointer (); -#endif - -#ifdef CONFIG_FB_SIS_300 - if ((HwDeviceExtension->jChipType == SIS_540) || - (HwDeviceExtension->jChipType == SIS_630) || - (HwDeviceExtension->jChipType == SIS_730) || - (HwDeviceExtension->jChipType == SIS_300)) - InitTo300Pointer (); -#endif - - 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; - SiS_Part2Port = BaseAddr + SIS_CRT2_PORT_10; - SiS_Part3Port = BaseAddr + SIS_CRT2_PORT_12; - SiS_Part4Port = BaseAddr + SIS_CRT2_PORT_14; - SiS_Part5Port = BaseAddr + SIS_CRT2_PORT_14 + 2; - SiS_Set_LVDS_TRUMPION (HwDeviceExtension); /*2/29/00 by Mars Wen for LVDS and Trumpion */ - - SiS_SetReg1 (SiS_P3c4, 0x05, 0x86); /* 1.Openkey */ + if(FBAddr==0) return (FALSE); + if(BaseAddr==0) return (FALSE); -#ifdef LINUX_KERNEL -#ifdef CONFIG_FB_SIS_300 /* add to set SR14 */ - if ((HwDeviceExtension->jChipType == SIS_540) || - (HwDeviceExtension->jChipType == SIS_630) || - (HwDeviceExtension->jChipType == SIS_730)) { - base = 0x80000060; - OutPortLong (base, 0xcf8); - temp1 = InPortLong (0xcfc); - temp1 = temp1 >> (16 + 8 + 4); - temp1 = temp1 & (0x07); - temp1 = temp1 + 1; - temp1 = 1 << temp1; - SR14 = temp1 - 1; - base = 0x80000064; - OutPortLong (base, 0xcf8); - temp1 = InPortLong (0xcfc); - temp1 = temp1 & (0x00000020); - if (temp1) - SR14 = (0x10000000) | SR14; - else - SR14 = (0x01000000) | SR14; - } + SiS_SetReg3((USHORT)(BaseAddr+0x12), 0x67); /* 3c2 <- 67 ,ynlai */ + +#ifdef SIS315H + /*if(HwDeviceExtension->jChipType > SIS_315H)*/ + if(HwDeviceExtension->jChipType > SIS_315PRO) { + if(!HwDeviceExtension->bIntegratedMMEnabled) + return (FALSE); /* alan */ + } #endif -#ifdef CONFIG_FB_SIS_315 /* add to set SR14 */ - if ((HwDeviceExtension->jChipType == SIS_550)) { - base = 0x80000060; - OutPortLong (base, 0xcf8); - temp1 = InPortLong (0xcfc); - temp1 = temp1 >> (16 + 8 + 4); - temp1 = temp1 & (0x07); - temp1 = temp1 + 1; - temp1 = 1 << temp1; - SR14 = temp1 - 1; - base = 0x80000064; - OutPortLong (base, 0xcf8); - temp1 = InPortLong (0xcfc); - temp1 = temp1 & (0x00000020); - if (temp1) - SR14 = (0x10000000) | SR14; - else - SR14 = (0x01000000) | SR14; - } + SiS_MemoryCopy(VBIOSVersion,HwDeviceExtension->szVBIOSVer,4); + VBIOSVersion[4]= 0x0; + /* 09/07/99 modify by domao */ + +#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); +#endif - if ((HwDeviceExtension->jChipType == SIS_640) - || (HwDeviceExtension->jChipType == SIS_740)) { - base = 0x80000064; - OutPortLong (base, 0xcf8); - temp1 = InPortLong (0xcfc); - temp1 = temp >> 4; - temp1 = temp1 & (0x07); - 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 8: - break; - case 9: - break; - } - } - SR14 = temp1; - base = 0x8000007C; - OutPortLong (base, 0xcf8); - temp1 = InPortLong (0xcfc); - temp1 = temp1 & (0x00000020); - if (temp1) - SR14 = (0x10000000) | SR14; - } +#ifdef SIS300 + if ((HwDeviceExtension->jChipType == SIS_540)|| + (HwDeviceExtension->jChipType == SIS_630)|| + (HwDeviceExtension->jChipType == SIS_730)|| + (HwDeviceExtension->jChipType == SIS_300)) + InitTo300Pointer(HwDeviceExtension); #endif + /* TW: Set SiS Register globals */ + SiSRegInit(BaseAddr); + + /* TW: Determine LVDS/CH70xx/TRUMPION */ + SiS_Set_LVDS_TRUMPION(HwDeviceExtension); + + SiS_SetReg1(SiS_P3c4,0x05,0x86); /* 1.Openkey - unlock registers */ + +#ifdef LINUX_KERNEL + +#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 >>= (16+8+4); + temp1 &= 0x07; + temp1++; + temp1 = 1 << temp1; + SR14 = temp1 - 1; + base=0x80000064; + OutPortLong(base,0xcf8); + temp1 = InPortLong(0xcfc); + temp1 &= 0x00000020; + if(temp1) SR14 |= 0x80; + else SR14 |= 0x40; + } #endif -#ifdef CONFIG_FB_SIS_300 - 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); - } else { - SR13 = (UCHAR) SiS_GetReg1 (SiS_P3c4, 0x13); - SR14 = (UCHAR) SiS_GetReg1 (SiS_P3c4, 0x14); - } +#ifdef SIS315H /* Set SR14*/ + if(HwDeviceExtension->jChipType==SIS_550) { + base=0x80000060; + OutPortLong(base,0xcf8); + temp1 = InPortLong(0xcfc); + temp1 >>= (16+8+4); + temp1 &= 0x07; + temp1++; + temp1 = 1 << temp1; + SR14 = temp1 - 1; + base=0x80000064; + OutPortLong(base,0xcf8); + temp1 = InPortLong(0xcfc); + temp1 &= 0x00000020; + if(temp1) SR14 |= 0x80; + else SR14 |= 0x40; + } + + if((HwDeviceExtension->jChipType == SIS_640)|| + (HwDeviceExtension->jChipType == SIS_740)|| + (HwDeviceExtension->jChipType == SIS_650)) { + base=0x80000064; + OutPortLong(base,0xcf8); + temp1=InPortLong(0xcfc); + temp1 >>= 4; + temp1 &= 0x07; + 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 8: break; + case 9: break; + } + } + SR14 = temp1; + base=0x8000007C; + OutPortLong(base,0xcf8); + temp1 = InPortLong(0xcfc); + temp1 &= 0x00000020; + if(temp1) SR14 |= 0x80; + } #endif -#ifdef CONFIG_FB_SIS_315 - if ((HwDeviceExtension->jChipType == SIS_550)) { - CR39 = (UCHAR) SiS_GetReg1 (SiS_P3d4, 0x39); - CR3A = (UCHAR) SiS_GetReg1 (SiS_P3d4, 0x3A); - CR3B = (UCHAR) SiS_GetReg1 (SiS_P3d4, 0x3B); - CR3C = (UCHAR) SiS_GetReg1 (SiS_P3d4, 0x3C); - CR3D = (UCHAR) SiS_GetReg1 (SiS_P3d4, 0x3D); - CR3E = (UCHAR) SiS_GetReg1 (SiS_P3d4, 0x3E); - CR3F = (UCHAR) SiS_GetReg1 (SiS_P3d4, 0x3F); - 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); - } else if ((HwDeviceExtension->jChipType == SIS_640) || /* 08/20/01 chiawen for 640/740 */ - (HwDeviceExtension->jChipType == SIS_740)) { - 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); - } + +#endif /* Linux kernel */ + +#ifdef SIS300 + 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); + } else if(HwDeviceExtension->jChipType == SIS_300){ + SR13 = (UCHAR)SiS_GetReg1(SiS_P3c4,0x13); + SR14 = (UCHAR)SiS_GetReg1(SiS_P3c4,0x14); + } +#endif +#ifdef SIS315H + if((HwDeviceExtension->jChipType == SIS_550)|| + (HwDeviceExtension->jChipType == SIS_640)|| + (HwDeviceExtension->jChipType == SIS_740)|| + (HwDeviceExtension->jChipType == SIS_650)) { + SR19 = (UCHAR)SiS_GetReg1(SiS_P3c4,0x19); + SR19 = (SR19)||0x01; /* TW: ??? || ??? */ + if(SR19==0x00) { + SR13 = 0x22; + SR14 = 0x00; + SR15 = 0x01; + SR16 = 0x00; + SR17 = 0x00; + SR1A = 0x00; + SR1B = 0x00; + CR37 = 0x00; + CR38 = 0x00; + CR79 = 0x00; + CR7A = 0x00; + 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); + } + } #endif -/* ResetExtReg begin */ - for (i = 0x06; i < 0x20; i++) - SiS_SetReg1 (SiS_P3c4, i, 0); /* 2.Reset Extended register */ - for (i = 0x21; i <= 0x27; i++) - SiS_SetReg1 (SiS_P3c4, i, 0); /* Reset Extended register */ - for (i = 0x31; i <= 0x3D; i++) - SiS_SetReg1 (SiS_P3c4, i, 0); -#ifdef CONFIG_FB_SIS_300H - for (i = 0x38; i <= 0x3F; i++) - SiS_SetReg1 (SiS_P3d4, i, 0); +/* ResetExtReg begin: 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); + +#ifdef SIS300 + 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); + } #endif -#ifdef CONFIG_FB_SIS_315 - for (i = 0x37; i <= 0x3F; i++) - SiS_SetReg1 (SiS_P3d4, i, 0); - for (i = 0x79; i <= 0x7C; i++) - SiS_SetReg1 (SiS_P3d4, i, 0); +#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); + } #endif + /* ResetExtReg end */ -#ifdef CONFIG_FB_SIS_300 - 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); - } -#endif -#ifdef CONFIG_FB_SIS_315 - if ((HwDeviceExtension->jChipType == SIS_550)) { - SiS_SetReg1 (SiS_P3d4, 0x39, CR39); - SiS_SetReg1 (SiS_P3d4, 0x3A, CR3A); - SiS_SetReg1 (SiS_P3d4, 0x3B, CR3B); - SiS_SetReg1 (SiS_P3d4, 0x3C, CR3C); - SiS_SetReg1 (SiS_P3d4, 0x3D, CR3D); - SiS_SetReg1 (SiS_P3d4, 0x3E, CR3E); - SiS_SetReg1 (SiS_P3d4, 0x3F, CR3F); - SiS_SetReg1 (SiS_P3d4, 0x79, CR79); - SiS_SetReg1 (SiS_P3d4, 0x7A, CR7A); - SiS_SetReg1 (SiS_P3d4, 0x7B, CR7B); - SiS_SetReg1 (SiS_P3d4, 0x7C, CR7C); - } else if ((HwDeviceExtension->jChipType == SIS_640) || /* 08/20/01 chiawen for 640/740 */ - (HwDeviceExtension->jChipType == SIS_740)) { - 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); - } + +#ifdef SIS300 + 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); + } #endif -/* detect ExtChip Type */ - SiS_Set_LVDS_TRUMPION (HwDeviceExtension); /*2/29/00 by Mars Wen for LVDS and Trumpion */ +#ifdef SIS315H + if((HwDeviceExtension->jChipType == SIS_550)|| + (HwDeviceExtension->jChipType == SIS_640)|| + (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); + } +#endif -#ifdef CONFIG_FB_SIS_300 - if ((HwDeviceExtension->jChipType == SIS_540) || - (HwDeviceExtension->jChipType == SIS_630) || - (HwDeviceExtension->jChipType == SIS_730)) { - temp = (UCHAR) SR1A; - } else +#ifdef SIS300 + 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? */ + } +#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_550)|| + (HwDeviceExtension->jChipType == SIS_640)|| + (HwDeviceExtension->jChipType == SIS_740)|| + (HwDeviceExtension->jChipType == SIS_650)) { + if((*pSiS_SoftSetting & SoftDRAMType) == 0){ + temp = (UCHAR)SiS_GetReg1(SiS_P3c4,0x13) & 0x07; + } + } #endif - { - if ((*pSiS_SoftSetting & SoftDRAMType) == 0) { - temp = (UCHAR) SiS_GetReg1 (SiS_P3c4, 0x3A); - } - } - SiS_RAMType = temp & 0x03; - SiS_SetMemoryClock (ROMAddr); - -/* SetDefExt1Regs begin */ - SiS_SetReg1 (SiS_P3c4, 0x07, *pSiS_SR07); - 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]); - } - } -#ifdef CONFIG_FB_SIS_315 - if ((HwDeviceExtension->jChipType == SIS_315H) || - (HwDeviceExtension->jChipType == SIS_315PRO)) { - for (i = 0x40; i <= 0x44; i++) { - SiS_SetReg1 (SiS_P3d4, i, - SiS_CR40[i - 0x40][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_RAMType = temp; + SiS_SetMemoryClock(ROMAddr,HwDeviceExtension); + +/* SetDefExt1Regs begin: Set default register contents */ + + SiS_SetReg1(SiS_P3c4,0x07,*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]); + } + } + +#ifdef SIS315H + if ((HwDeviceExtension->jChipType == SIS_315H )|| + (HwDeviceExtension->jChipType == SIS_315PRO)) { + for(i=0x40;i<=0x44;i++) { + SiS_SetReg1(SiS_P3d4,i,SiS_CR40[i-0x40][SiS_RAMType]); + } + SiS_SetReg1(SiS_P3d4,0x48,0x23); + SiS_SetReg1(SiS_P3d4,0x49,SiS_CR49[0]); + /* SiS_SetReg1(SiS_P3c4,0x25,SiS_SR25[0]); */ + } #endif - SiS_SetReg1 (SiS_P3c4, 0x1F, *pSiS_SR1F); - /*SiS_SetReg1(SiS_P3c4,0x20,0x20); */ - SiS_SetReg1 (SiS_P3c4, 0x20, 0xA0); /* alan, 2001/6/26 Frame buffer can read/write */ - SiS_SetReg1 (SiS_P3c4, 0x23, *pSiS_SR23); - SiS_SetReg1 (SiS_P3c4, 0x24, *pSiS_SR24); - SiS_SetReg1 (SiS_P3c4, 0x25, SiS_SR25[0]); -#ifdef CONFIG_FB_SIS_300 - if (HwDeviceExtension->jChipType == SIS_300) { - SiS_SetReg1 (SiS_P3c4, 0x21, 0x84); - SiS_SetReg1 (SiS_P3c4, 0x22, 0x00); - } + 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]); + +#ifdef SIS300 + if(HwDeviceExtension->jChipType==SIS_300) { + SiS_SetReg1(SiS_P3c4,0x21,0x84); + SiS_SetReg1(SiS_P3c4,0x22,0x00); + } #endif - SR11 = 0x0F; - SiS_SetReg1 (SiS_P3c4, 0x11, SR11); - - SiS_UnLockCRT2 (HwDeviceExtension, BaseAddr); - SiS_SetReg1 (SiS_Part1Port, 0x00, 0x00); - SiS_SetReg1 (SiS_Part1Port, 0x02, *pSiS_CRT2Data_1_2); -#ifdef CONFIG_FB_SIS_315 /* 05/02/01 ynlai for sis550 */ - if ((HwDeviceExtension->jChipType == SIS_315H) || - (HwDeviceExtension->jChipType == SIS_315PRO) || - (HwDeviceExtension->jChipType == SIS_550) || - (HwDeviceExtension->jChipType == SIS_640) || /* 08/20/01 chiawen for 640/740 */ - (HwDeviceExtension->jChipType == SIS_740)) - /* 09/03/01 chiawen for 650 */ - SiS_SetReg1 (SiS_Part1Port, 0x2E, 0x08); /* use VB */ -#endif - - temp = *pSiS_SR32; - if (SiS_BridgeIsOn (BaseAddr)) { - temp = temp & 0xEF; - } - SiS_SetReg1 (SiS_P3c4, 0x32, temp); - -#ifdef CONFIG_FB_SIS_315 - if ((HwDeviceExtension->jChipType == SIS_315H) || - (HwDeviceExtension->jChipType == SIS_315PRO)) { - HwDeviceExtension->pQueryVGAConfigSpace (HwDeviceExtension, - 0x50, 0, &Temp); /* Get */ - - Temp >>= 20; - Temp &= 0xF; - if (Temp != 1) { - SiS_SetReg1 (SiS_P3c4, 0x25, SiS_SR25[1]); - SiS_SetReg1 (SiS_P3d4, 0x49, SiS_CR49[1]); - } - SiS_SetReg1 (SiS_P3c4, 0x27, 0x1F); + SR11=0x0F; + SiS_SetReg1(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); + +#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)) + SiS_SetReg1(SiS_Part1Port,0x2E,0x08); /* use VB */ +#endif - SiS_SetReg1 (SiS_P3c4, 0x31, *pSiS_SR31); - SiS_SetReg1 (SiS_P3c4, 0x32, *pSiS_SR32); - SiS_SetReg1 (SiS_P3c4, 0x33, *pSiS_SR33); - } + temp=*pSiS_SR32; + if(SiS_BridgeIsOn(BaseAddr)) { + temp &= 0xEF; + } + SiS_SetReg1(SiS_P3c4,0x32,temp); + +#ifdef SIS315H + if ((HwDeviceExtension->jChipType == SIS_315H) || + (HwDeviceExtension->jChipType == SIS_315PRO)) { + HwDeviceExtension->pQueryVGAConfigSpace(HwDeviceExtension,0x50,0,&Temp); /* Get */ + Temp >>= 20; + Temp &= 0xF; + if (Temp!=1) { + SiS_SetReg1(SiS_P3c4,0x25,SiS_SR25[1]); + SiS_SetReg1(SiS_P3d4,0x49,SiS_CR49[1]); + } + + SiS_SetReg1(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); + } #endif - if (SiS_BridgeIsOn (BaseAddr) == 1) { - 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); - } - SiS_LockCRT2 (HwDeviceExtension, BaseAddr); - } - SiS_SetReg1 (SiS_P3d4, 0x83, 0x00); + 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); + } + SiS_LockCRT2(HwDeviceExtension, BaseAddr); + } + SiS_SetReg1(SiS_P3d4,0x83,0x00); + /* SetDefExt1Regs end */ -#ifdef CONFIG_FB_SIS_315 - if ((HwDeviceExtension->jChipType == SIS_315H) || - (HwDeviceExtension->jChipType == SIS_315PRO) - ) { /* 05/02/01 ynlai */ - /* For SiS 300,310 Chip */ - if (HwDeviceExtension->bSkipDramSizing == TRUE) { - SiS_SetDRAMModeRegister (ROMAddr); - pSR = HwDeviceExtension->pSR; - if (pSR != NULL) { - while (pSR->jIdx != 0xFF) { - SiS_SetReg1 (SiS_P3c4, pSR->jIdx, - pSR->jVal); - pSR++; - } - } - } else - SiS_SetDRAMSize_310 (HwDeviceExtension); - } +#ifdef SIS315H + if ((HwDeviceExtension->jChipType==SIS_315H)|| + (HwDeviceExtension->jChipType==SIS_315PRO)) { + if (HwDeviceExtension->bSkipDramSizing==TRUE) { + SiS_SetDRAMModeRegister(ROMAddr,HwDeviceExtension); + pSR = HwDeviceExtension->pSR; + if (pSR!=NULL) { + while (pSR->jIdx!=0xFF) { + SiS_SetReg1(SiS_P3c4,pSR->jIdx,pSR->jVal); + pSR++; + } + } + } else SiS_SetDRAMSize_310(HwDeviceExtension); + } #endif -#ifdef CONFIG_FB_SIS_315 - if ((HwDeviceExtension->jChipType == SIS_550)) { /* 05/02/01 ynlai For SiS 550 */ - /* SetDRAMConfig begin */ + +#ifdef SIS315H + 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); @@ -812,2973 +961,3514 @@ SiSInit (PSIS_HW_DEVICE_INFO HwDeviceExtension) SiS_SetReg1(SiS_P3c4,0x18,SR18); SiS_SetReg1(SiS_P3c4,0x19,SR19); SiS_SetReg1(SiS_P3c4,0x1A,SR1A); */ - /* SetDRAMConfig end */ - } + /* SetDRAMConfig end */ + } #endif -#ifdef CONFIG_FB_SIS_300 - if (HwDeviceExtension->jChipType == SIS_300) { /* For SiS 300 Chip */ - if (HwDeviceExtension->bSkipDramSizing == TRUE) { -/* SiS_SetDRAMModeRegister(ROMAddr); - temp = (HwDeviceExtension->pSR)->jVal; - SiS_SetReg1(SiS_P3c4,0x13,temp); - temp = (HwDeviceExtension->pSR)->jVal; - SiS_SetReg1(SiS_P3c4,0x14,temp); */ - } else { + +#ifdef SIS300 + if( HwDeviceExtension->jChipType==SIS_300) { + if (HwDeviceExtension->bSkipDramSizing==TRUE) { +/* SiS_SetDRAMModeRegister(ROMAddr,HwDeviceExtension); + temp = (HwDeviceExtension->pSR)->jVal; + SiS_SetReg1(SiS_P3c4,0x13,temp); + temp = (HwDeviceExtension->pSR)->jVal; + SiS_SetReg1(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_P3c4,0x13,SR13); + SiS_SetReg1(SiS_P3c4,0x14,SR14); + SiS_SetRegANDOR(SiS_P3c4,0x15,0xFF,0x04); #else - SiS_SetDRAMSize_300 (HwDeviceExtension); - SiS_SetDRAMSize_300 (HwDeviceExtension); + SiS_SetDRAMSize_300(HwDeviceExtension); + SiS_SetDRAMSize_300(HwDeviceExtension); #endif - } - } - if ((HwDeviceExtension->jChipType == SIS_540) || /* For SiS 630/540/730 Chip */ - (HwDeviceExtension->jChipType == SIS_630) || - (HwDeviceExtension->jChipType == SIS_730)) { - /* 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); */ - /* SetDRAMConfig end */ - } -/* SetDRAMSize end */ + } + } + if((HwDeviceExtension->jChipType==SIS_540)|| + (HwDeviceExtension->jChipType==SIS_630)|| + (HwDeviceExtension->jChipType==SIS_730)){ + /* SetDRAMConfig begin */ +#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); #endif + /* SetDRAMConfig end */ + } +/* SetDRAMSize end */ +#endif /* SIS300 */ /* SetDefExt2Regs begin */ -/* AGP=1; +#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); */ - - SiS_SetReg1 (SiS_P3c4, 0x21, *pSiS_SR21); - SiS_SetReg1 (SiS_P3c4, 0x22, *pSiS_SR22); + SiS_SetReg1(SiS_P3c4,0x22,*pSiS_SR22); +#endif + SiS_SetReg1(SiS_P3c4,0x21,*pSiS_SR21); + SiS_SetReg1(SiS_P3c4,0x22,*pSiS_SR22); /* SetDefExt2Regs end */ -/* SiS_SetReg3(SiS_P3c6,0xff); - SiS_ClearDAC(SiS_P3c8); [ynlai] 05/22/01 */ +#if 0 + SiS_SetReg3(SiS_P3c6,0xff); + SiS_ClearDAC(SiS_P3c8); /* [ynlai] 05/22/01 */ +#endif - SiS_DetectMonitor (HwDeviceExtension, BaseAddr); - SiS_GetSenseStatus (HwDeviceExtension, ROMAddr); /* sense CRT2 */ +#ifdef LINUXBIOS /* TW: This is not needed for our purposes */ + SiS_DetectMonitor(HwDeviceExtension,BaseAddr); + SiS_GetSenseStatus(HwDeviceExtension,ROMAddr); /* sense CRT2 */ +#endif - return (TRUE); + return(TRUE); } void -SiS_Set_LVDS_TRUMPION (PSIS_HW_DEVICE_INFO HwDeviceExtension) -{ - USHORT temp; - -#ifdef CONFIG_FB_SIS_300 - if ((HwDeviceExtension->jChipType == SIS_540) || - (HwDeviceExtension->jChipType == SIS_630) || - (HwDeviceExtension->jChipType == SIS_730)) { - temp = (UCHAR) SiS_GetReg1 (SiS_P3c4, 0x1A); - temp = (temp & 0xE0) >> 4; - SiS_SetRegANDOR (SiS_P3d4, 0x37, 0xF1, temp); - temp = temp >> 1; - if ((temp == 0) || (temp == 1)) { /* for 301 */ - SiS_IF_DEF_LVDS = 0; - SiS_IF_DEF_CH7005 = 0; - SiS_IF_DEF_TRUMPION = 0; - } - if ((temp >= 2) && (temp <= 5)) { - SiS_IF_DEF_LVDS = 1; - } - if (temp == 3) - SiS_IF_DEF_TRUMPION = 1; - if ((temp == 4) || (temp == 5)) - SiS_IF_DEF_CH7005 = 1; - } else { - SiS_IF_DEF_LVDS = 0; - SiS_IF_DEF_TRUMPION = 0; - SiS_IF_DEF_CH7005 = 0; - } -#else - if ((HwDeviceExtension->jChipType == SIS_550) || - (HwDeviceExtension->jChipType == SIS_640) || /* 08/20/01 chiawen for 640/740 */ - (HwDeviceExtension->jChipType == SIS_740)) - { /* 09/03/01 chiawen for 650 */ - SiS_IF_DEF_LVDS = 0; - SiS_IF_DEF_TRUMPION = 0; - SiS_IF_DEF_CH7005 = 0; - } +SiS_Set_LVDS_TRUMPION(PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT temp=0; + +#ifdef SiS300 + 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 = (temp & 0xE0) >> 4; + SiS_SetRegANDOR(SiS_P3d4,0x37,0xF1,temp); + } +#endif +#ifdef SIS315H + if ((HwDeviceExtension->jChipType == SIS_640)|| + (HwDeviceExtension->jChipType == SIS_740)|| + (HwDeviceExtension->jChipType == SIS_650)) { +#if 0 /* TW: This is not required */ + /* TW: Read POWER_ON_TRAP and copy to CR37 */ + temp = (UCHAR)SiS_GetReg1(SiS_P3c4,0x1A); + temp = (temp & 0xE0) >> 4; + SiS_SetRegANDOR(SiS_P3d4,0x37,0xF1,temp); #endif + } +#endif + + /* Set globals SiS_IF_DEF... */ + SiSSetLVDSetc(HwDeviceExtension, 0); } -/* =============== for 300 dram sizing begin =============== */ -#ifdef CONFIG_FB_SIS_300 +/* =============== SiS 300 dram sizing begin =============== */ +#ifdef SIS300 void -SiS_SetDRAMSize_300 (PSIS_HW_DEVICE_INFO HwDeviceExtension) -{ - /*ULONG ROMAddr = (ULONG)HwDeviceExtension->pjVirtualRomBase; */ - ULONG FBAddr = (ULONG) HwDeviceExtension->pjVideoMemoryAddress; - /*USHORT BaseAddr = (USHORT)HwDeviceExtension->ulIOAddress; */ - 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,PhysicalAdrAnotherPage; */ - int PageCapacity, PhysicalAdrHigh, PhysicalAdrHalfPage; - - SiSSetMode (HwDeviceExtension, 0x2e); - data = SiS_GetReg1 (SiS_P3c4, 0x1); - 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; - 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; - } - 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; - - /* Read data */ - Addr = - FBAddr + - (BankNumHigh) * 64 * - 1024 + - PhysicalAdrHigh; - data = - *((USHORT *) - (Addr)); - if (data == - PhysicalAdrHigh) - Done = 1; - } /* if struct */ - } /* for loop (k) */ - } /* if struct */ - } /* for loop (j) */ - } /* for loop (i) */ +SiS_SetDRAMSize_300(PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + ULONG FBAddr = (ULONG)HwDeviceExtension->pjVideoMemoryAddress; + 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; + 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; + } + 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; + + /* Read data */ + Addr=FBAddr+(BankNumHigh)*64*1024+PhysicalAdrHigh; + data=*((USHORT *)(Addr)); + if(data==PhysicalAdrHigh) Done=1; + } /* if struct */ + } /* for loop (k) */ + } /* if struct */ + } /* for loop (j) */ + } /* for loop (i) */ } USHORT -SiS_ChkBUSWidth_300 (ULONG FBAddress) +SiS_ChkBUSWidth_300(ULONG FBAddress) { - /*USHORT data; */ - PULONG pVideoMemory; - - pVideoMemory = (PULONG) FBAddress; - - pVideoMemory[0] = 0x01234567L; - pVideoMemory[1] = 0x456789ABL; - pVideoMemory[2] = 0x89ABCDEFL; - pVideoMemory[3] = 0xCDEF0123L; - if (pVideoMemory[3] == 0xCDEF0123L) { /*ChannelA128Bit */ - return (4); - } - if (pVideoMemory[1] == 0x456789ABL) { /*ChannelB64Bit */ - return (2); - } - return (1); + /*USHORT data;*/ + PULONG pVideoMemory; + + pVideoMemory = (PULONG) FBAddress; + + pVideoMemory[0] = 0x01234567L; + pVideoMemory[1] = 0x456789ABL; + pVideoMemory[2] = 0x89ABCDEFL; + pVideoMemory[3] = 0xCDEF0123L; + if (pVideoMemory[3]==0xCDEF0123L) { /*ChannelA128Bit */ + return(4); + } + if (pVideoMemory[1]==0x456789ABL) { /*ChannelB64Bit */ + return(2); + } + return(1); } #endif +/* =============== SiS 300 dram sizing end =============== */ -/* =============== for 300 dram sizing end =============== */ +/* ============== SiS 310 dram sizing begin ================= */ +#ifdef SIS315H -/* ============== alan ====================== */ -#ifdef CONFIG_FB_SIS_315 -UCHAR -SiS_Get310DRAMType (ULONG ROMAddr) -{ - UCHAR data; - - /* - index=SiS_GetReg1(SiS_P3c4,0x1A); - index=index&07; - */ - if (*pSiS_SoftSetting & SoftDRAMType) - data = *pSiS_SoftSetting & 0x03; - else - data = SiS_GetReg1 (SiS_P3c4, 0x3a) & 0x03; - - return data; -} +/* TW: Moved Get310DRAMType further down */ void -SiS_Delay15us (ULONG ulMicrsoSec) +SiS_Delay15us(ULONG ulMicrsoSec) { } void -SiS_SDR_MRS (void) +SiS_SDR_MRS(void) { - 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); + 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); } void -SiS_DDR_MRS (void) +SiS_DDR_MRS(void) { - USHORT data; - - /* SR16 <- 1F,DF,2F,AF */ - - /* enable DLL of DDR SD/SGRAM , SR16 D4=1 */ - data = SiS_GetReg1 (SiS_P3c4, 0x16); - data &= 0x0F; - data |= 0x10; - SiS_SetReg1 (SiS_P3c4, 0x16, data); - - if (!(SiS_SR15[1][SiS_RAMType] & 0x10)) { - data &= 0x0F; - } - /* SR16 D7=1,D6=1 */ - data |= 0xC0; - SiS_SetReg1 (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)) { - data &= 0x0F; - } - /* SR16 D7=1 */ - data |= 0x80; - SiS_SetReg1 (SiS_P3c4, 0x16, data); + USHORT data; + + /* SR16 <- 1F,DF,2F,AF */ + + /* enable DLL of DDR SD/SGRAM , SR16 D4=1 */ + data=SiS_GetReg1(SiS_P3c4,0x16); + data &= 0x0F; + data |= 0x10; + SiS_SetReg1(SiS_P3c4,0x16,data); + + if (!(SiS_SR15[1][SiS_RAMType] & 0x10)) + data &= 0x0F; + + /* SR16 D7=1,D6=1 */ + data |= 0xC0; + SiS_SetReg1(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)) + data &= 0x0F; + + /* SR16 D7=1 */ + data |= 0x80; + SiS_SetReg1(SiS_P3c4,0x16,data); } void -SiS_SetDRAMModeRegister (ULONG ROMAddr) +SiS_SetDRAMModeRegister(UCHAR *ROMAddr, PSIS_HW_DEVICE_INFO HwDeviceExtension) { - - if (SiS_Get310DRAMType (ROMAddr) < 2) { - SiS_SDR_MRS (); - } else { - /* SR16 <- 0F,CF,0F,8F */ - SiS_DDR_MRS (); - } + if (SiS_Get310DRAMType(ROMAddr,HwDeviceExtension) < 2) + SiS_SDR_MRS(); + else + /* SR16 <- 0F,CF,0F,8F */ + SiS_DDR_MRS(); } void -SiS_DisableRefresh (void) +SiS_DisableRefresh(void) { - USHORT data; + 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); + 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); } void -SiS_EnableRefresh (ULONG ROMAddr) +SiS_EnableRefresh(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_P3c4,0x17,SiS_SR15[2][SiS_RAMType]); /* SR17 */ + SiS_SetReg1(SiS_P3c4,0x19,SiS_SR15[4][SiS_RAMType]); /* SR19 */ } void -SiS_DisableChannelInterleaving (int index, USHORT SiS_DDRDRAM_TYPE[][5]) +SiS_DisableChannelInterleaving(int index,USHORT SiS_DDRDRAM_TYPE[][5]) { - USHORT data; - - data = SiS_GetReg1 (SiS_P3c4, 0x15); - data &= 0x1F; - switch (SiS_DDRDRAM_TYPE[index][3]) { - case 64: - data |= 0; - break; - case 32: - data |= 0x20; - break; - case 16: - data |= 0x40; - break; - case 4: - data |= 0x60; - break; - } - SiS_SetReg1 (SiS_P3c4, 0x15, data); - + USHORT data; + + data=SiS_GetReg1(SiS_P3c4,0x15); + data &= 0x1F; + switch (SiS_DDRDRAM_TYPE[index][3]) + { + case 64: data |= 0; break; + case 32: data |= 0x20; break; + case 16: data |= 0x40; break; + case 4: data |= 0x60; break; + } + SiS_SetReg1(SiS_P3c4,0x15,data); } void -SiS_SetDRAMSizingType (int index, USHORT DRAMTYPE_TABLE[][5]) +SiS_SetDRAMSizingType(int index,USHORT DRAMTYPE_TABLE[][5]) { - USHORT data; + USHORT data; - data = DRAMTYPE_TABLE[index][4]; - SiS_SetReg1 (SiS_P3c4, 0x13, data); - - /* should delay 50 ns */ + data = DRAMTYPE_TABLE[index][4]; + SiS_SetReg1(SiS_P3c4,0x13,data); + /* should delay 50 ns */ } void -SiS_CheckBusWidth_310 (ULONG ROMAddress, ULONG FBAddress) -{ - USHORT data; - PULONG volatile pVideoMemory; - - pVideoMemory = (PULONG) FBAddress; - if (SiS_Get310DRAMType (ROMAddress) < 2) { - - SiS_SetReg1 (SiS_P3c4, 0x13, 0x00); - SiS_SetReg1 (SiS_P3c4, 0x14, 0x12); - /* should delay */ - SiS_SDR_MRS (); - - SiS_ChannelAB = 0; - SiS_DataBusWidth = 128; - pVideoMemory[0] = 0x01234567L; - pVideoMemory[1] = 0x456789ABL; - pVideoMemory[2] = 0x89ABCDEFL; - pVideoMemory[3] = 0xCDEF0123L; - pVideoMemory[4] = 0x55555555L; - 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[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)); - } - return; - - } else { - /* DDR Dual channel */ - SiS_SetReg1 (SiS_P3c4, 0x13, 0x00); - SiS_SetReg1 (SiS_P3c4, 0x14, 0x02); /* Channel A, 64bit */ - /* should delay */ - SiS_DDR_MRS (); - - SiS_ChannelAB = 0; - SiS_DataBusWidth = 64; - pVideoMemory[0] = 0x01234567L; - pVideoMemory[1] = 0x456789ABL; - pVideoMemory[2] = 0x89ABCDEFL; - pVideoMemory[3] = 0xCDEF0123L; - pVideoMemory[4] = 0x55555555L; - pVideoMemory[5] = 0x55555555L; - pVideoMemory[6] = 0xAAAAAAAAL; - pVideoMemory[7] = 0xAAAAAAAAL; - - if (pVideoMemory[1] == 0x456789ABL) { - if (pVideoMemory[0] == 0x01234567L) { - /* Channel A 64bit */ - return; - } - } else { - if (pVideoMemory[0] == 0x01234567L) { - /* Channel A 32bit */ - SiS_DataBusWidth = 32; - SiS_SetReg1 (SiS_P3c4, 0x14, 0x00); - return; - } - - } - - SiS_SetReg1 (SiS_P3c4, 0x14, 0x03); /* Channel B, 64bit */ - SiS_DDR_MRS (); - - SiS_ChannelAB = 1; - SiS_DataBusWidth = 64; - pVideoMemory[0] = 0x01234567L; - pVideoMemory[1] = 0x456789ABL; - pVideoMemory[2] = 0x89ABCDEFL; - pVideoMemory[3] = 0xCDEF0123L; - pVideoMemory[4] = 0x55555555L; - pVideoMemory[5] = 0x55555555L; - pVideoMemory[6] = 0xAAAAAAAAL; - pVideoMemory[7] = 0xAAAAAAAAL; - if (pVideoMemory[1] == 0x456789ABL) { - /* Channel B 64 */ - if (pVideoMemory[0] == 0x01234567L) { - /* Channel B 64bit */ - return; - } else { - /* error */ - } - } else { - if (pVideoMemory[0] == 0x01234567L) { - /* Channel B 32 */ - SiS_DataBusWidth = 32; - SiS_SetReg1 (SiS_P3c4, 0x14, 0x01); - } else { - /* error */ - } - } - } +SiS_CheckBusWidth_310(UCHAR *ROMAddress,ULONG FBAddress, + PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT data; + PULONG volatile pVideoMemory; + + pVideoMemory = (PULONG) FBAddress; + if (SiS_Get310DRAMType(ROMAddress,HwDeviceExtension) < 2) { + + SiS_SetReg1(SiS_P3c4,0x13,0x00); + SiS_SetReg1(SiS_P3c4,0x14,0x12); + /* should delay */ + SiS_SDR_MRS(); + + SiS_ChannelAB = 0; + SiS_DataBusWidth = 128; + pVideoMemory[0] = 0x01234567L; + pVideoMemory[1] = 0x456789ABL; + pVideoMemory[2] = 0x89ABCDEFL; + pVideoMemory[3] = 0xCDEF0123L; + pVideoMemory[4] = 0x55555555L; + 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[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)); + } + return; + + } else { + /* DDR Dual channel */ + SiS_SetReg1(SiS_P3c4,0x13,0x00); + SiS_SetReg1(SiS_P3c4,0x14,0x02); /* Channel A, 64bit */ + /* should delay */ + SiS_DDR_MRS(); + + SiS_ChannelAB = 0; + SiS_DataBusWidth = 64; + pVideoMemory[0] = 0x01234567L; + pVideoMemory[1] = 0x456789ABL; + pVideoMemory[2] = 0x89ABCDEFL; + pVideoMemory[3] = 0xCDEF0123L; + pVideoMemory[4] = 0x55555555L; + pVideoMemory[5] = 0x55555555L; + pVideoMemory[6] = 0xAAAAAAAAL; + pVideoMemory[7] = 0xAAAAAAAAL; + + if (pVideoMemory[1] == 0x456789ABL) { + if (pVideoMemory[0] == 0x01234567L) { + /* Channel A 64bit */ + return; + } + } else { + if (pVideoMemory[0] == 0x01234567L) { + /* Channel A 32bit */ + SiS_DataBusWidth = 32; + SiS_SetReg1(SiS_P3c4,0x14,0x00); + return; + } + } + + SiS_SetReg1(SiS_P3c4,0x14,0x03); /* Channel B, 64bit */ + SiS_DDR_MRS(); + + SiS_ChannelAB = 1; + SiS_DataBusWidth = 64; + pVideoMemory[0] = 0x01234567L; + pVideoMemory[1] = 0x456789ABL; + pVideoMemory[2] = 0x89ABCDEFL; + pVideoMemory[3] = 0xCDEF0123L; + pVideoMemory[4] = 0x55555555L; + pVideoMemory[5] = 0x55555555L; + pVideoMemory[6] = 0xAAAAAAAAL; + pVideoMemory[7] = 0xAAAAAAAAL; + if (pVideoMemory[1] == 0x456789ABL) { + /* Channel B 64 */ + if (pVideoMemory[0] == 0x01234567L) { + /* Channel B 64bit */ + return; + } else { + /* error */ + } + } else { + if (pVideoMemory[0] == 0x01234567L) { + /* Channel B 32 */ + SiS_DataBusWidth = 32; + SiS_SetReg1(SiS_P3c4,0x14,0x01); + } else { + /* error */ + } + } + } } int -SiS_SetRank (int index, UCHAR RankNo, UCHAR SiS_ChannelAB, - USHORT DRAMTYPE_TABLE[][5]) +SiS_SetRank(int index,UCHAR RankNo,UCHAR SiS_ChannelAB,USHORT DRAMTYPE_TABLE[][5]) { - USHORT data; - int RankSize; - - if ((RankNo == 2) && (DRAMTYPE_TABLE[index][0] == 2)) - return 0; - - RankSize = DRAMTYPE_TABLE[index][3] / 2 * SiS_DataBusWidth / 32; - - if (RankNo * RankSize <= 128) { - data = 0; - while ((RankSize >>= 1) > 0) { - data += 0x10; - } - data |= (RankNo - 1) << 2; - data |= (SiS_DataBusWidth / 64) & 2; - data |= SiS_ChannelAB; - SiS_SetReg1 (SiS_P3c4, 0x14, data); - /* should delay */ - SiS_SDR_MRS (); - return 1; - } else - return 0; - + USHORT data; + int RankSize; + + if ((RankNo==2)&&(DRAMTYPE_TABLE[index][0]==2)) + return 0; + + RankSize = DRAMTYPE_TABLE[index][3]/2 * SiS_DataBusWidth/32; + + if (RankNo*RankSize<=128) { + data = 0; + while ((RankSize>>=1)>0) { + data+=0x10; + } + data |= (RankNo-1)<<2; + data |= (SiS_DataBusWidth/64)&2; + data |= SiS_ChannelAB; + SiS_SetReg1(SiS_P3c4,0x14,data); + /* should delay */ + SiS_SDR_MRS(); + return 1; + } else + return 0; } int -SiS_SetDDRChannel (int index, UCHAR ChannelNo, UCHAR SiS_ChannelAB, - USHORT DRAMTYPE_TABLE[][5]) -{ - USHORT data; - int RankSize; - - RankSize = DRAMTYPE_TABLE[index][3] / 2 * SiS_DataBusWidth / 32; - /* RankSize = DRAMTYPE_TABLE[index][3]; */ - if (ChannelNo * RankSize <= 128) { - data = 0; - 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); - /* should delay */ - SiS_DDR_MRS (); - return 1; - } else - return 0; - +SiS_SetDDRChannel(int index,UCHAR ChannelNo,UCHAR SiS_ChannelAB, + USHORT DRAMTYPE_TABLE[][5]) +{ + USHORT data; + int RankSize; + + RankSize = DRAMTYPE_TABLE[index][3]/2 * SiS_DataBusWidth/32; + /* RankSize = DRAMTYPE_TABLE[index][3]; */ + if (ChannelNo*RankSize<=128) { + data = 0; + 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); + /* should delay */ + SiS_DDR_MRS(); + return 1; + } else + return 0; } int -SiS_CheckColumn (int index, USHORT DRAMTYPE_TABLE[][5], ULONG FBAddress) +SiS_CheckColumn(int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress) { - int i; - ULONG Increment, Position; + 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_DataBusWidth / 64 + 1); */ + Increment = 1<<(10 + SiS_DataBusWidth / 64); - for (i = 0, Position = 0; i < 2; i++) { - *((PULONG) (FBAddress + Position)) = Position; - Position += Increment; - } + for (i=0,Position=0;i<2;i++) { + *((PULONG)(FBAddress+Position))=Position; + Position += Increment; + } - for (i = 0, Position = 0; i < 2; i++) { + for (i=0,Position=0;i<2;i++) { /* if (FBAddress[Position]!=Position) */ - if ((*(PULONG) (FBAddress + Position)) != Position) - return 0; - Position += Increment; - } - return 1; + if ( (*(PULONG) (FBAddress + Position)) !=Position) + return 0; + Position += Increment; + } + return 1; } int -SiS_CheckBanks (int index, USHORT DRAMTYPE_TABLE[][5], ULONG FBAddress) +SiS_CheckBanks(int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress) { - int i; - ULONG Increment, Position; - Increment = 1 << (DRAMTYPE_TABLE[index][2] + SiS_DataBusWidth / 64 + 2); + int i; + ULONG Increment,Position; + Increment = 1<<(DRAMTYPE_TABLE[index][2] + SiS_DataBusWidth / 64 + 2); - for (i = 0, Position = 0; i < 4; i++) { + for (i=0,Position=0;i<4;i++) { /* FBAddress[Position]=Position; */ - *((PULONG) (FBAddress + Position)) = Position; - Position += Increment; - } + *((PULONG)(FBAddress+Position))=Position; + Position += Increment; + } - for (i = 0, Position = 0; i < 4; i++) { + for (i=0,Position=0;i<4;i++) { /* if (FBAddress[Position]!=Position) */ - if ((*(PULONG) (FBAddress + Position)) != Position) - return 0; - Position += Increment; - } - return 1; + if ( (*(PULONG) (FBAddress + Position)) !=Position) + return 0; + Position += Increment; + } + return 1; } int -SiS_CheckRank (int RankNo, int index, USHORT DRAMTYPE_TABLE[][5], - ULONG FBAddress) +SiS_CheckRank(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); + int i; + ULONG Increment,Position; + Increment = 1<<(DRAMTYPE_TABLE[index][2] + DRAMTYPE_TABLE[index][1] + + DRAMTYPE_TABLE[index][0] + SiS_DataBusWidth / 64 + RankNo); - for (i = 0, Position = 0; i < 2; i++) { + for (i=0,Position=0;i<2;i++) { /* FBAddress[Position]=Position; */ - *((PULONG) (FBAddress + Position)) = Position; - /* *((PULONG)(FBAddress))=Position; */ - Position += Increment; - } + *((PULONG)(FBAddress+Position))=Position; + /* *((PULONG)(FBAddress))=Position; */ + Position += Increment; + } - for (i = 0, Position = 0; i < 2; i++) { + for (i=0,Position=0;i<2;i++) { /* if (FBAddress[Position]!=Position) */ - if ((*(PULONG) (FBAddress + Position)) != Position) - /*if ( (*(PULONG) (FBAddress )) !=Position) */ - return 0; - Position += Increment; - } - return 1; - + if ( (*(PULONG) (FBAddress + Position)) !=Position) + /*if ( (*(PULONG) (FBAddress )) !=Position) */ + return 0; + Position += Increment; + } + return 1; } int -SiS_CheckDDRRank (int RankNo, int index, USHORT DRAMTYPE_TABLE[][5], - ULONG FBAddress) +SiS_CheckDDRRank(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); - - 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) - return 1; - - if ((*(PULONG) (FBAddress + 0)) == 0x01234567) - return 0; - - data = SiS_GetReg1 (SiS_P3c4, 0x14); - data &= 0xF3; - data |= 0x08; - SiS_SetReg1 (SiS_P3c4, 0x14, data); - data = SiS_GetReg1 (SiS_P3c4, 0x15); - data += 0x20; - SiS_SetReg1 (SiS_P3c4, 0x15, data); - - return 1; - + ULONG Increment,Position; + USHORT data; + + Increment = 1<<(DRAMTYPE_TABLE[index][2] + DRAMTYPE_TABLE[index][1] + + DRAMTYPE_TABLE[index][0] + 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) + return 1; + + if ( (*(PULONG) (FBAddress + 0))==0x01234567) + return 0; + + data=SiS_GetReg1(SiS_P3c4,0x14); + data &= 0xF3; + data |= 0x08; + SiS_SetReg1(SiS_P3c4,0x14,data); + data=SiS_GetReg1(SiS_P3c4,0x15); + data += 0x20; + SiS_SetReg1(SiS_P3c4,0x15,data); + + return 1; } int -SiS_CheckRanks (int RankNo, int index, USHORT DRAMTYPE_TABLE[][5], - ULONG FBAddress) +SiS_CheckRanks(int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress) { - int r; + int r; - for (r = RankNo; r >= 1; r--) { - if (!SiS_CheckRank (r, index, DRAMTYPE_TABLE, FBAddress)) - return 0; - } - if (!SiS_CheckBanks (index, DRAMTYPE_TABLE, FBAddress)) - return 0; + for (r=RankNo;r>=1;r--) { + if (!SiS_CheckRank(r,index,DRAMTYPE_TABLE,FBAddress)) + return 0; + } + if (!SiS_CheckBanks(index,DRAMTYPE_TABLE,FBAddress)) + return 0; - if (!SiS_CheckColumn (index, DRAMTYPE_TABLE, FBAddress)) - return 0; - return 1; + if (!SiS_CheckColumn(index,DRAMTYPE_TABLE,FBAddress)) + return 0; + return 1; } int -SiS_CheckDDRRanks (int RankNo, int index, USHORT DRAMTYPE_TABLE[][5], - ULONG FBAddress) +SiS_CheckDDRRanks(int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress) { - int r; + int r; - for (r = RankNo; r >= 1; r--) { - if (!SiS_CheckDDRRank (r, index, DRAMTYPE_TABLE, FBAddress)) - return 0; - } - if (!SiS_CheckBanks (index, DRAMTYPE_TABLE, FBAddress)) - return 0; + for (r=RankNo;r>=1;r--) { + if (!SiS_CheckDDRRank(r,index,DRAMTYPE_TABLE,FBAddress)) + return 0; + } + if (!SiS_CheckBanks(index,DRAMTYPE_TABLE,FBAddress)) + return 0; - if (!SiS_CheckColumn (index, DRAMTYPE_TABLE, FBAddress)) - return 0; - return 1; + if (!SiS_CheckColumn(index,DRAMTYPE_TABLE,FBAddress)) + return 0; + return 1; } int -SiS_SDRSizing (ULONG FBAddress) -{ - int i; - UCHAR j; - - for (i = 0; i < 13; i++) { - SiS_SetDRAMSizingType (i, SiS_SDRDRAM_TYPE); - for (j = 2; j > 0; j--) { - - if (!SiS_SetRank - (i, (UCHAR) j, SiS_ChannelAB, - SiS_SDRDRAM_TYPE)) continue; - else { - if (SiS_CheckRanks - (j, i, SiS_SDRDRAM_TYPE, - FBAddress)) return 1; - } - } - } - return 0; +SiS_SDRSizing(ULONG FBAddress) +{ + int i; + UCHAR j; + + for (i=0;i<13;i++) { + SiS_SetDRAMSizingType(i, SiS_SDRDRAM_TYPE); + for (j=2;j>0;j--) { + if (!SiS_SetRank(i,(UCHAR) j, SiS_ChannelAB,SiS_SDRDRAM_TYPE)) + continue; + else { + if (SiS_CheckRanks(j,i,SiS_SDRDRAM_TYPE, FBAddress)) + return 1; + } + } + } + return 0; } int -SiS_DDRSizing (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)) continue; - else { - if (SiS_CheckDDRRanks - (j, i, SiS_DDRDRAM_TYPE, - FBAddress)) return 1; - } - } - } - return 0; +SiS_DDRSizing(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)) + continue; + else { + if (SiS_CheckDDRRanks(j,i,SiS_DDRDRAM_TYPE, FBAddress)) + return 1; + } + } + } + return 0; } /* - check if read cache pointer is correct - */ void -SiS_VerifyMclk (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); - - pVideoMemory[16 + j] = j; - if (pVideoMemory[16 + j] == j) { - pVideoMemory[j] = j; - break; - } - } - } - +SiS_VerifyMclk(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); + + pVideoMemory[16+j] = j; + if (pVideoMemory[16+j]==j) { + pVideoMemory[j] = j; + break; + } + } + } } +/* TW: Is this a 315E? */ int -Is315E (void) +Is315E(void) { - USHORT data; + USHORT data; - data = SiS_GetReg1 (SiS_P3d4, 0x5F); - if (data & 0x10) - return 1; - else - return 0; + data=SiS_GetReg1(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(PSIS_HW_DEVICE_INFO HwDeviceExtension) { - ULONG ROMAddr = (ULONG) HwDeviceExtension->pjVirtualRomBase; - ULONG FBAddr = (ULONG) HwDeviceExtension->pjVideoMemoryAddress; - /*USHORT BaseAddr = (USHORT)HwDeviceExtension->ulIOAddress; */ - USHORT data; + UCHAR *ROMAddr = HwDeviceExtension->pjVirtualRomBase; + ULONG FBAddr = (ULONG)HwDeviceExtension->pjVideoMemoryAddress; + USHORT data; -#ifdef SIS301 - /*SiS_SetReg1(SiS_P3d4,0x30,0x40); */ +#ifdef SIS301 /* TW: SIS301 ??? */ + /*SiS_SetReg1(SiS_P3d4,0x30,0x40); */ #endif -#ifdef 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 */ +#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 */ #endif - SiSSetMode (HwDeviceExtension, 0x2e); + SiSSetMode(HwDeviceExtension,0x2e); - data = SiS_GetReg1 (SiS_P3c4, 0x21); - SiS_SetReg1 (SiS_P3c4, 0x21, (USHORT) (data & 0xDF)); /* disable read cache */ + data=SiS_GetReg1(SiS_P3c4,0x21); + SiS_SetReg1(SiS_P3c4,0x21,(USHORT) (data&0xDF)); /* disable read cache */ - data = SiS_GetReg1 (SiS_P3c4, 0x1); - data = data | 0x20; - SiS_SetReg1 (SiS_P3c4, 0x01, data); /* Turn OFF Display */ + data=SiS_GetReg1(SiS_P3c4,0x1); + data=data|0x20; + SiS_SetReg1(SiS_P3c4,0x01,data); /* Turn OFF Display */ - data = SiS_GetReg1 (SiS_P3c4, 0x16); - SiS_SetReg1 (SiS_P3c4, 0x16, (USHORT) (data | 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 (ROMAddr); - SiS_DisableRefresh (); - SiS_CheckBusWidth_310 (ROMAddr, FBAddr); + SiS_SetDRAMModeRegister(ROMAddr,HwDeviceExtension); + SiS_DisableRefresh(); + SiS_CheckBusWidth_310(ROMAddr,FBAddr,HwDeviceExtension); - SiS_VerifyMclk (FBAddr); /* alan 2000/7/3 */ + SiS_VerifyMclk(FBAddr); /* alan 2000/7/3 */ - if (SiS_Get310DRAMType (ROMAddr) < 2) { - SiS_SDRSizing (FBAddr); - } else { - SiS_DDRSizing (FBAddr); - } + if (SiS_Get310DRAMType(ROMAddr, HwDeviceExtension)<2) + SiS_SDRSizing(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 (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; + } + } - if ((data & 0xF0) > 0x50) - data = (data & 0x0F) | 0x50; - } - - } - - SiS_SetReg1 (SiS_P3c4, 0x16, SiS_SR15[1][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_SetReg1(SiS_P3c4,0x16,SiS_SR15[1][SiS_RAMType]); /* restore SR16 */ + SiS_EnableRefresh(ROMAddr); + data=SiS_GetReg1(SiS_P3c4,0x21); + SiS_SetReg1(SiS_P3c4,0x21,(USHORT) (data|0x20)); /* enable read cache */ } #endif void -SiS_SetMemoryClock (ULONG ROMAddr) -{ - SiS_SetReg1 (SiS_P3c4, 0x28, SiS_MCLKData[SiS_RAMType].SR28); - SiS_SetReg1 (SiS_P3c4, 0x29, SiS_MCLKData[SiS_RAMType].SR29); - SiS_SetReg1 (SiS_P3c4, 0x2A, SiS_MCLKData[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); - -#ifdef CONFIG_FB_SIS_315 - 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); - } +SiS_SetMemoryClock(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); + +#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); + } #endif - } -/* -========================================= - ======== SiS SetMode Function ========== -========================================= -*/ -BOOLEAN -SiSSetMode (PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT ModeNo) -{ - ULONG temp; - USHORT ModeIdIndex, KeepLockReg; - ULONG ROMAddr = (ULONG) HwDeviceExtension->pjVirtualRomBase; - /*ULONG FBAddr = (ULONG)HwDeviceExtension->pjVideoMemoryAddress; */ - USHORT BaseAddr = (USHORT) HwDeviceExtension->ulIOAddress; - -#ifdef CONFIG_FB_SIS_315 - if ((HwDeviceExtension->jChipType == SIS_315H) || /* 05/02/01 ynlai for sis550 */ - (HwDeviceExtension->jChipType == SIS_315PRO) || - (HwDeviceExtension->jChipType == SIS_550) || - (HwDeviceExtension->jChipType == SIS_640) || /* 08/20/01 chiawen for 640/740 */ - (HwDeviceExtension->jChipType == SIS_740)) /* 09/03/01 chiawen for 650 */ - InitTo310Pointer (); -#endif - -#ifdef CONFIG_FB_SIS_300 - if ((HwDeviceExtension->jChipType == SIS_540) || - (HwDeviceExtension->jChipType == SIS_630) || - (HwDeviceExtension->jChipType == SIS_730) || - (HwDeviceExtension->jChipType == SIS_300)) - InitTo300Pointer (); -#endif - - 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; - SiS_Part2Port = BaseAddr + SIS_CRT2_PORT_10; - SiS_Part3Port = BaseAddr + SIS_CRT2_PORT_12; - SiS_Part4Port = BaseAddr + SIS_CRT2_PORT_14; - SiS_Part5Port = BaseAddr + SIS_CRT2_PORT_14 + 2; - - SiS_IF_DEF_LVDS = 0; - SiS_IF_DEF_CH7005 = 0; - SiS_IF_DEF_HiVision = 0; - SiS_IF_DEF_DSTN = 0; /*for 550 dstn */ - if ((HwDeviceExtension->jChipType == SIS_540) || - (HwDeviceExtension->jChipType == SIS_630) || - (HwDeviceExtension->jChipType == SIS_730) || - (HwDeviceExtension->jChipType == SIS_550) || - (HwDeviceExtension->jChipType == SIS_640) || /* 08/20/01 chiawen for 640/740 */ - (HwDeviceExtension->jChipType == SIS_740)) { /* 09/03/01 chiawen for 650 */ - temp = SiS_GetReg1 (SiS_P3d4, 0x37); - temp = (temp & 0x0E) >> 1; - if ((temp == 0) || (temp == 1)) { /* for 301 */ - SiS_IF_DEF_LVDS = 0; - SiS_IF_DEF_CH7005 = 0; - SiS_IF_DEF_TRUMPION = 0; - } - if ((temp >= 2) && (temp <= 5)) { - SiS_IF_DEF_LVDS = 1; - } - if (temp == 3) - SiS_IF_DEF_TRUMPION = 1; - if ((temp == 4) || (temp == 5)) - SiS_IF_DEF_CH7005 = 1; - } else { - SiS_IF_DEF_LVDS = 0; - SiS_IF_DEF_TRUMPION = 0; - SiS_IF_DEF_CH7005 = 0; - } +#endif /* ifndef LINUX_XF86 */ - if (ModeNo & 0x80) { - ModeNo = ModeNo & 0x7F; - flag_clearbuffer = 0; - } else { - flag_clearbuffer = 1; - } +#ifdef SIS315H +UCHAR +SiS_Get310DRAMType(UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + UCHAR data; + + if (*pSiS_SoftSetting & SoftDRAMType) { + data = *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; + } + } + + return data; +} +#endif - SiS_PresetScratchregister (SiS_P3d4, HwDeviceExtension); /*add for CRT2 */ - KeepLockReg = SiS_GetReg1 (SiS_P3c4, 0x05); - SiS_SetReg1 (SiS_P3c4, 0x05, 0x86); /* 1.Openkey */ - temp = SiS_SearchModeID (ROMAddr, ModeNo, &ModeIdIndex); /* 2.Get ModeID Table */ - if (temp == 0) - return (0); - /*301b */ - SiS_GetVBType (BaseAddr); - /*end 301b */ - SiS_GetVBInfo301 (BaseAddr, ROMAddr, ModeNo, ModeIdIndex, HwDeviceExtension); /*add for CRT2 */ - SiS_GetLCDResInfo301 (ROMAddr, SiS_P3d4, ModeNo, ModeIdIndex); /*add for CRT2 */ - - temp = SiS_CheckMemorySize (ROMAddr, HwDeviceExtension, ModeNo, ModeIdIndex); /*3.Check memory size */ - if (temp == 0) - return (0); - if (SiS_VBInfo & (SetSimuScanMode | SetCRT2ToLCDA)) { /*301b */ - SiS_SetCRT1Group (ROMAddr, HwDeviceExtension, ModeNo, - ModeIdIndex); - } else { - if (!(SiS_VBInfo & SwitchToCRT2)) { - SiS_SetCRT1Group (ROMAddr, HwDeviceExtension, ModeNo, - ModeIdIndex); - } - } +/* SiSInit END */ - if (SiS_VBInfo & (SetSimuScanMode | SwitchToCRT2 | SetCRT2ToLCDA)) { /*301b */ - switch (HwDeviceExtension->ujVBChipID) { -/*karl*/ - case VB_CHIP_301: - case VB_CHIP_301B: - SiS_SetCRT2Group301 (BaseAddr, ROMAddr, ModeNo, HwDeviceExtension); /*add for CRT2 */ - break; - case VB_CHIP_302: - SiS_SetCRT2Group301 (BaseAddr, ROMAddr, ModeNo, - HwDeviceExtension); - break; - case VB_CHIP_303: -/* SetCRT2Group302(BaseAddr,ROMAddr,ModeNo, HwDeviceExtension); add for CRT2 */ - break; - case VB_CHIP_UNKNOWN: /*add for lvds ch7005 */ - temp = SiS_GetReg1 (SiS_P3d4, 0x37); - if (temp & - (ExtChipLVDS | ExtChipTrumpion | ExtChipCH7005)) { - SiS_SetCRT2Group301 (BaseAddr, ROMAddr, ModeNo, - HwDeviceExtension); - } - break; - } - } - if (KeepLockReg == 0xA1) - SiS_SetReg1 (SiS_P3c4, 0x05, 0x86); /* 05/02/01 ynlai */ - else - SiS_SetReg1 (SiS_P3c4, 0x05, 0x00); - return TRUE; +/* ----------------------------------------- */ + +void SiSRegInit(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) */ } void -SiS_SetCRT1Group (ULONG ROMAddr, PSIS_HW_DEVICE_INFO HwDeviceExtension, - USHORT ModeNo, USHORT ModeIdIndex) -{ - USHORT StandTableIndex, RefreshRateTableIndex; - USHORT temp; - - /*SiS_SetReg1(SiS_P3d4,0x34,ModeNo); */ - SiS_CRT1Mode = ModeNo; - /* set CR34->CRT1 ModeNofor CRT2 FIFO */ - StandTableIndex = SiS_GetModePtr (ROMAddr, ModeNo, ModeIdIndex); /* 4.GetModePtr */ - SiS_SetSeqRegs (ROMAddr, StandTableIndex); /* 5.SetSeqRegs */ - SiS_SetMiscRegs (ROMAddr, StandTableIndex); /* 6.SetMiscRegs */ - SiS_SetCRTCRegs (ROMAddr, HwDeviceExtension, StandTableIndex); /* 7.SetCRTCRegs */ - SiS_SetATTRegs (ROMAddr, StandTableIndex); /* 8.SetATTRegs */ - SiS_SetGRCRegs (ROMAddr, StandTableIndex); /* 9.SetGRCRegs */ - SiS_ClearExt1Regs (); /* 10.Clear Ext1Regs */ - temp = ~ProgrammingCRT2; /* 11.GetRatePtr */ - SiS_SetFlag = SiS_SetFlag & temp; - SiS_SelectCRT2Rate = 0; - /*301b */ - if ((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B)) { - if (SiS_VBInfo & SetCRT2ToLCDA) { - SiS_SetFlag = SiS_SetFlag | ProgrammingCRT2; - /* SiS_SelectCRT2Rate=4; */ - } - } - /*end 301b */ - - RefreshRateTableIndex = SiS_GetRatePtrCRT2 (ROMAddr, ModeNo, ModeIdIndex); /* 11.GetRatePtr */ +SiSInitPCIetc(PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ +#ifdef LINUX_XF86 + if ((HwDeviceExtension->jChipType == SIS_540)|| + (HwDeviceExtension->jChipType == SIS_630)|| + (HwDeviceExtension->jChipType == SIS_730)|| + (HwDeviceExtension->jChipType == SIS_300)) { + /* TW: Set - PCI LINEAR ADDRESSING ENABLE (0x80) + - PCI IO ENABLE (0x20) + - MMIO ENABLE (0x1) + */ + SiS_SetReg1(SiS_P3c4,0x20,0xa1); + /* TW: Enable 2D (0x42) & 3D accelerator (0x18) */ + SiS_SetRegANDOR(SiS_P3c4,0x1E,0xFF,0x5A); + } + 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)) { + /* 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); + } +#endif +} - /*301b */ - if ((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B)) { - if (!(SiS_VBInfo & SetCRT2ToLCDA)) { - SiS_SetFlag = SiS_SetFlag & (~ProgrammingCRT2); - } - } - /*end 301b */ - - if (RefreshRateTableIndex != 0xFFFF) { - SiS_SetSync (ROMAddr, RefreshRateTableIndex); /* 12.SetSync */ - SiS_SetCRT1CRTC (ROMAddr, ModeNo, ModeIdIndex, RefreshRateTableIndex); /* 13.SetCRT1CRTC */ - SiS_SetCRT1Offset (ROMAddr, ModeNo, ModeIdIndex, - RefreshRateTableIndex, HwDeviceExtension); /* 14.SetCRT1Offset */ - SiS_SetCRT1VCLK (ROMAddr, ModeNo, ModeIdIndex, - HwDeviceExtension, RefreshRateTableIndex); /* 15.SetCRT1VCLK */ - } -#ifdef CONFIG_FB_SIS_300 - if ((HwDeviceExtension->jChipType == SIS_630) || - (HwDeviceExtension->jChipType == SIS_540)) { - SiS_SetCRT1FIFO2 (ROMAddr, ModeNo, HwDeviceExtension, - RefreshRateTableIndex); - } +void +SiSSetLVDSetc(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_ChrontelInit = 0; + + if((ModeNo == 0x5a) || (ModeNo == 0x5b)) { + SiS_IF_DEF_DSTN = 1; /* for 550 dstn */ + SiS_IF_DEF_FSTN = 1; /* for fstn */ + } + +#ifdef SIS300 + if((HwDeviceExtension->jChipType == SIS_540)|| + (HwDeviceExtension->jChipType == SIS_630)|| + (HwDeviceExtension->jChipType == SIS_730)) + { + temp=SiS_GetReg1(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 == 4) || (temp == 5)) { + /* TW: Save power status (and error check) */ + SiS_Backup70xx = SiS_GetCH700x(0x0e); + if (SiS_Backup70xx != 0xFFFF) + SiS_IF_DEF_CH70xx = 1; + } + } #endif -#ifdef CONFIG_FB_SIS_315 - if (HwDeviceExtension->jChipType >= SIS_315H) { - SiS_SetCRT1FIFO (ROMAddr, ModeNo, HwDeviceExtension); - } +#ifdef SIS315H + if((HwDeviceExtension->jChipType == SIS_550)|| + (HwDeviceExtension->jChipType == SIS_640)|| + (HwDeviceExtension->jChipType == SIS_740)|| + (HwDeviceExtension->jChipType == SIS_650)) + { + /* 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) */ + + temp=SiS_GetReg1(SiS_P3d4,0x37); + temp = (temp & 0x0E) >> 1; + if((temp >= 2) && (temp <= 3)) 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_IF_DEF_HiVision = 1; + } #endif - SiS_SetCRT1ModeRegs (ROMAddr, HwDeviceExtension, ModeNo, ModeIdIndex, - RefreshRateTableIndex); - SiS_SetVCLKState (ROMAddr, HwDeviceExtension, ModeNo, - RefreshRateTableIndex); -#ifdef CONFIG_FB_SIS_315 - if (HwDeviceExtension->jChipType > SIS_315H) - SiS_SetInterlace (ROMAddr, ModeNo, RefreshRateTableIndex); -#endif - SiS_LoadDAC (ROMAddr, ModeNo, ModeIdIndex); - if (flag_clearbuffer) - SiS_ClearBuffer (HwDeviceExtension, ModeNo); - - if (!(SiS_VBInfo & (SetSimuScanMode | SwitchToCRT2 | SetCRT2ToLCDA))) { /*301b */ - SiS_LongWait (); - SiS_DisplayOn (); - } } void -SiS_GetVBType (USHORT BaseAddr) -{ - USHORT flag; - - flag = SiS_GetReg1 (SiS_Part4Port, 0x00); - if (flag >= 2) - SiS_VBType = VB_SIS302B; - else { - flag = SiS_GetReg1 (SiS_Part4Port, 0x01); - if (flag >= 0xB0) - SiS_VBType = VB_SIS301B; - else - SiS_VBType = VB_SIS301; - - flag = SiS_GetReg1 (SiS_Part4Port, 0x23); /*301dlvds */ - if (!(flag & 0x02)) - SiS_VBType = SiS_VBType | VB_NoLCD; - } +SiSInitPtr(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); +#endif +#ifdef SIS300 + if ((HwDeviceExtension->jChipType == SIS_540)|| + (HwDeviceExtension->jChipType == SIS_630)|| + (HwDeviceExtension->jChipType == SIS_730)|| + (HwDeviceExtension->jChipType == SIS_300)) + InitTo300Pointer(HwDeviceExtension); +#endif } -/* win2000 MM adapter not support standard mode */ +/* + ========================================= + ======== SiS SetMode Function ========== + ========================================= +*/ +#ifdef LINUX_XF86 +/* TW: This is used for non-Dual-Head mode from X */ BOOLEAN -SiS_SearchModeID (ULONG ROMAddr, USHORT ModeNo, USHORT * ModeIdIndex) -{ - PUCHAR VGA_INFO = "\0x11"; - - if (ModeNo <= 5) - ModeNo |= 1; - if (ModeNo <= 0x13) { - /* for (*ModeIdIndex=0;*ModeIdIndex<sizeof(SiS_SModeIDTable)/sizeof(SiS_StStruct);(*ModeIdIndex)++) */ - for (*ModeIdIndex = 0;; (*ModeIdIndex)++) { - if (SiS_SModeIDTable[*ModeIdIndex].St_ModeID == ModeNo) - break; - if (SiS_SModeIDTable[*ModeIdIndex].St_ModeID == 0xFF) - return FALSE; - } +SiSBIOSSetMode(PSIS_HW_DEVICE_INFO HwDeviceExtension, ScrnInfoPtr pScrn, + DisplayModePtr mode) +{ + UShort ModeNo=0; -#ifdef TC - VGA_INFO = (PUCHAR) MK_FP (0, 0x489); -#endif - if (ModeNo == 0x07) { - if ((*VGA_INFO & 0x10) != 0) - (*ModeIdIndex)++; /* 400 lines */ - /* else 350 lines */ - } - if (ModeNo <= 3) { - if ((*VGA_INFO & 0x80) == 0) { - (*ModeIdIndex)++; - if ((*VGA_INFO & 0x10) != 0) - (*ModeIdIndex)++;; /* 400 lines */ - /* else 350 lines */ - } - /* else 200 lines */ - } - } else { - /* for (*ModeIdIndex=0;*ModeIdIndex<sizeof(SiS_EModeIDTable)/sizeof(SiS_ExtStruct);(*ModeIdIndex)++) */ - for (*ModeIdIndex = 0;; (*ModeIdIndex)++) { - if (SiS_EModeIDTable[*ModeIdIndex].Ext_ModeID == ModeNo) - break; - if (SiS_EModeIDTable[*ModeIdIndex].Ext_ModeID == 0xFF) - return FALSE; - } - } - return TRUE; + ModeNo = SiS_CalcModeIndex(pScrn, mode); + if (!ModeNo) return FALSE; + + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Setting mode 0x%x\n", ModeNo); + + return(SiSSetMode(HwDeviceExtension, pScrn, ModeNo)); } -/*add for 300 oem util for search VBModeID*/ +#ifdef SISDUALHEAD +/* TW: Set CRT1 mode (used for dual head) */ BOOLEAN -SiS_SearchVBModeID (ULONG ROMAddr, USHORT ModeNo) +SiSBIOSSetModeCRT1(PSIS_HW_DEVICE_INFO HwDeviceExtension, ScrnInfoPtr pScrn, + DisplayModePtr mode) { - USHORT ModeIdIndex; + 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; - // PUCHAR VGA_INFO; + UShort ModeNo=0; - if (ModeNo <= 5) - ModeNo |= 1; - /* for (ModeIdIndex=0;ModeIdIndex<sizeof(SiS_SModeIDTable)/sizeof(SiS_StStruct);(*ModeIdIndex)++) */ - for (ModeIdIndex = 0;; (ModeIdIndex)++) { - if (SiS_VBModeIDTable[ModeIdIndex].ModeID == ModeNo) - break; - if (SiS_VBModeIDTable[ModeIdIndex].ModeID == 0xFF) - return FALSE; - } -#ifdef TC - VGA_INFO = (PUCHAR) MK_FP (0, 0x489); - if (ModeNo == 0x07) { - if ((*VGA_INFO & 0x10) != 0) - (ModeIdIndex)++; /* 400 lines */ - /* else 350 lines */ - } - if (ModeNo <= 3) { - if ((*VGA_INFO & 0x80) == 0) { - (ModeIdIndex)++; - if ((*VGA_INFO & 0x10) != 0) - (ModeIdIndex)++;; /* 400 lines */ - /* else 350 lines */ - } - /* else 200 lines */ - } -#endif - return ((BOOLEAN) ModeIdIndex); -} + ModeNo = SiS_CalcModeIndex(pScrn, mode); + if (!ModeNo) return FALSE; -/*end*/ + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Setting mode 0x%x on CRT1\n", ModeNo); -/* win2000 MM adapter not support standard mode! */ + SiSInitPtr(HwDeviceExtension); -BOOLEAN -SiS_CheckMemorySize (ULONG ROMAddr, PSIS_HW_DEVICE_INFO HwDeviceExtension, - USHORT ModeNo, USHORT ModeIdIndex) -{ - USHORT memorysize; - USHORT modeflag; - USHORT temp; + SiSRegInit(BaseAddr); - if (ModeNo <= 0x13) { - modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; - } else { - modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - } + SiSInitPCIetc(HwDeviceExtension); -/* ModeType=modeflag&ModeInfoFlag; Get mode type */ - - memorysize = modeflag & MemoryInfoFlag; - memorysize = memorysize > MemorySizeShift; - memorysize++; /* Get memory size */ - - temp = SiS_GetReg1 (SiS_P3c4, 0x14); /* Get DRAM Size */ - if ((HwDeviceExtension->jChipType == SIS_315H) || - (HwDeviceExtension->jChipType == SIS_315PRO)) { - 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 */ + SiSSetLVDSetc(HwDeviceExtension, ModeNo); - temp = temp & 0x3F; - temp++; - /* temp=1 << ((temp&0x0F0)>>4); */ - } + /* TW: We don't clear the buffer under X */ + flag_clearbuffer=0; - if ((HwDeviceExtension->jChipType == SIS_550) || /* 05/02/01 ynlai for sis550 */ - (HwDeviceExtension->jChipType == SIS_640) || /* 08/20/01 chiawen for 640/740 */ - (HwDeviceExtension->jChipType == SIS_740)) { /* 09/03/01 chiawen for 650 */ - return (TRUE); - } + SiS_SetReg1(SiS_P3c4,0x05,0x86); /* 1.Openkey */ - if (temp < memorysize) - return (FALSE); - else - return (TRUE); -} + SiS_UnLockCRT2(HwDeviceExtension, BaseAddr); -UCHAR -SiS_GetModePtr (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex) -{ - UCHAR index; + temp = SiS_SearchModeID(ROMAddr,&ModeNo,&ModeIdIndex); /* 2.Get ModeID Table */ + if(temp==0) return(0); - if (ModeNo <= 0x13) { - index = SiS_SModeIDTable[ModeIdIndex].St_StTableIndex; - } else { - if (SiS_ModeType <= 0x02) - index = 0x1B; /* 02 -> ModeEGA */ - else - index = 0x0F; - } + /* TW: Determine VBType (301,301B,301LV,302B,302LV) */ + SiS_GetVBType(BaseAddr,HwDeviceExtension); + + /* 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); + + /* 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: Set mode on CRT1 */ + SiS_SetCRT1Group(ROMAddr,HwDeviceExtension,ModeNo,ModeIdIndex,BaseAddr); + + pSiSEnt->CRT1ModeNo = ModeNo; + pSiSEnt->CRT1DMode = mode; + + /* TW: SetPitch: Adapt to virtual size & position */ + SiS_SetPitchCRT1(pScrn, BaseAddr); - return index; /* Get SiS_StandTable index */ + /* 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", + pSiSEnt->CRT2ModeNo); + SiSBIOSSetModeCRT2(HwDeviceExtension, pSiSEnt->pScrn_1, + pSiSEnt->CRT2DMode); + } + + 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); + } + } + } + + /* Backup/Set ModeNo in MMIO */ + SiS_GetSetModeID(pScrn,ModeNo); + + return TRUE; } -void -SiS_SetSeqRegs (ULONG ROMAddr, USHORT StandTableIndex) +/* TW: Set CRT2 mode (used for dual head) */ +BOOLEAN +SiSBIOSSetModeCRT2(PSIS_HW_DEVICE_INFO HwDeviceExtension, ScrnInfoPtr pScrn, + DisplayModePtr mode) { - UCHAR SRdata; - USHORT i; + 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); + SISEntPtr pSiSEnt = pSiS->entityPrivate; + + ModeNo = SiS_CalcModeIndex(pScrn, mode); + if (!ModeNo) return FALSE; + + SiSInitPtr(HwDeviceExtension); + + SiSRegInit(BaseAddr); + + SiSInitPCIetc(HwDeviceExtension); + + SiSSetLVDSetc(HwDeviceExtension, ModeNo); + + /* TW: We don't clear the buffer under X */ + 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, + "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); + + /* 1.Openkey */ + SiS_SetReg1(SiS_P3c4,0x05,0x86); + + SiS_UnLockCRT2(HwDeviceExtension, BaseAddr); + + /* 2.Get ModeID */ + temp = SiS_SearchModeID(ROMAddr,&ModeNo,&ModeIdIndex); + if(temp==0) return(0); + + /* TW: Determine VBType (301,301B,301LV,302B,302LV) */ + SiS_GetVBType(BaseAddr,HwDeviceExtension); + + /* 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); + + /* 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; + } + + /* Set mode on CRT2 */ + switch (HwDeviceExtension->ujVBChipID) { + case VB_CHIP_301: + case VB_CHIP_301B: + case VB_CHIP_301LV: + case VB_CHIP_302: + case VB_CHIP_302B: + case VB_CHIP_302LV: + SiS_SetCRT2Group301(BaseAddr,ROMAddr,ModeNo,HwDeviceExtension); + break; + case VB_CHIP_303: + 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); + 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); + } + } + } + + /* TW: SetPitch: Adapt to virtual size & position */ + SiS_SetPitchCRT2(pScrn, BaseAddr); + + /* Backup/Set ModeNo in MMIO - don't do this for CRT2 */ + /* SiS_GetSetModeID(pScrn,ModeNo); */ + + return TRUE; +} +#endif /* Dualhead */ +#endif /* Linux_XF86 */ - SiS_SetReg1 (SiS_P3c4, 0x00, 0x03); /* Set SR0 */ - SRdata = SiS_StandTable[StandTableIndex].SR[0]; - /*301b */ - if ((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B)) { - if (SiS_VBInfo & SetCRT2ToLCDA) { - SRdata = SRdata | 0x01; - } - } +#ifdef LINUX_XF86 +/* TW: We need pScrn for setting the pitch correctly */ +BOOLEAN +SiSSetMode(PSIS_HW_DEVICE_INFO HwDeviceExtension,ScrnInfoPtr pScrn,USHORT ModeNo) +#else +BOOLEAN +SiSSetMode(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo) +#endif +{ + ULONG temp; + USHORT ModeIdIndex,KeepLockReg; + UCHAR *ROMAddr = HwDeviceExtension->pjVirtualRomBase; + USHORT BaseAddr = (USHORT)HwDeviceExtension->ulIOAddress; - /*end 301b */ + SiSInitPtr(HwDeviceExtension); - if (SiS_IF_DEF_LVDS == 1) { - if (SiS_IF_DEF_CH7005 == 1) { - if (SiS_VBInfo & SetCRT2ToTV) { - if (SiS_VBInfo & SetInSlaveMode) { - SRdata = SRdata | 0x01; /* 8 dot clock */ - } - } - } - if (SiS_VBInfo & SetCRT2ToLCD) { - if (SiS_VBInfo & SetInSlaveMode) { - SRdata = SRdata | 0x01; /* 8 dot clock */ - } - } - } + SiSRegInit(BaseAddr); - SRdata = SRdata | 0x20; /* screen off */ - SiS_SetReg1 (SiS_P3c4, 0x01, SRdata); /* Set SR1 */ - for (i = 02; i <= 04; i++) { - SRdata = SiS_StandTable[StandTableIndex].SR[i - 1]; /* Get SR2,3,4 from file */ - SiS_SetReg1 (SiS_P3c4, i, SRdata); /* Set SR2 3 4 */ - } + SiSInitPCIetc(HwDeviceExtension); + + SiSSetLVDSetc(HwDeviceExtension, ModeNo); + +#ifdef LINUX_XF86 + /* TW: We don't clear the buffer in X */ + ModeNo |= 0x8000; +#endif + + if(ModeNo & 0x8000) { + ModeNo &= 0x007F; + flag_clearbuffer=0; + } else { + flag_clearbuffer=1; + } + + /* 1.Openkey */ + KeepLockReg = SiS_GetReg1(SiS_P3c4,0x05); + SiS_SetReg1(SiS_P3c4,0x05,0x86); + + SiS_UnLockCRT2(HwDeviceExtension, BaseAddr); + + /* 2.Get ModeID Table */ + temp = SiS_SearchModeID(ROMAddr,&ModeNo,&ModeIdIndex); + if(temp==0) return(0); + + /* TW: Determine VBType (301,301B,301LV,302B,302LV) */ + SiS_GetVBType(BaseAddr,HwDeviceExtension); + + /* 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); + + /* 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; + } + + /* 3.Check memory size */ + temp = SiS_CheckMemorySize(ROMAddr,HwDeviceExtension,ModeNo,ModeIdIndex); + if(!temp) return(0); + + /* TW: Set mode on CRT1 */ + if(SiS_VBInfo & (SetSimuScanMode | SetCRT2ToLCDA)) { + SiS_SetCRT1Group(ROMAddr,HwDeviceExtension,ModeNo,ModeIdIndex,BaseAddr); + } else { + if(!(SiS_VBInfo & SwitchToCRT2)) { + SiS_SetCRT1Group(ROMAddr,HwDeviceExtension,ModeNo,ModeIdIndex,BaseAddr); + } + } + + /* TW: Set mode on CRT2 */ + if(SiS_VBInfo & (SetSimuScanMode | SwitchToCRT2 | SetCRT2ToLCDA)) { + switch (HwDeviceExtension->ujVBChipID) { + case VB_CHIP_301: + case VB_CHIP_301B: + case VB_CHIP_301LV: + case VB_CHIP_302: + case VB_CHIP_302B: + case VB_CHIP_302LV: + SiS_SetCRT2Group301(BaseAddr,ROMAddr,ModeNo,HwDeviceExtension); + break; + case VB_CHIP_303: + 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); + break; + } + } + + /* 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); + } + } + } + +#ifdef LINUX_XF86 + /* TW: SetPitch: Adapt to virtual size & position */ + if(pScrn) + SiS_SetPitch(pScrn, BaseAddr); + + /* Backup/Set ModeNo in MMIO */ + 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); +#endif + + return TRUE; } void -SiS_SetMiscRegs (ULONG ROMAddr, USHORT StandTableIndex) +SetEnableDstn() /* TW: Called from sis_main.c */ { - UCHAR Miscdata; - - Miscdata = SiS_StandTable[StandTableIndex].MISC; /* Get Misc from file */ - /*301b */ - if ((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B)) { - if (SiS_VBInfo & SetCRT2ToLCDA) { - Miscdata = Miscdata | 0x0C; - } - } - /*end 301b */ - SiS_SetReg3 (SiS_P3c2, Miscdata); /* Set Misc(3c2) */ + SiS_IF_DEF_DSTN=1; /* for 550 dstn */ } void -SiS_SetCRTCRegs (ULONG ROMAddr, PSIS_HW_DEVICE_INFO HwDeviceExtension, - USHORT StandTableIndex) +SiS_SetCRT1Group(UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension, + USHORT ModeNo,USHORT ModeIdIndex,USHORT BaseAddr) { - UCHAR CRTCdata; - USHORT i; + 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_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); + +#ifdef LINUX_XF86 + xf86DrvMsg(0, X_INFO, "(init: VBType = %x, LVDS=%d, VBInfo=%x)\n", + SiS_VBType, SiS_IF_DEF_LVDS, SiS_VBInfo); +#endif - CRTCdata = (UCHAR) SiS_GetReg1 (SiS_P3d4, 0x11); - CRTCdata = CRTCdata & 0x7f; - SiS_SetReg1 (SiS_P3d4, 0x11, CRTCdata); /* Unlock CRTC */ + /* TW: Inserted this entire if-section from 650/LVDS and 650/301 BIOS */ + if(SiS_VBInfo & SetSimuScanMode) { + if(SiS_VBInfo & SetInSlaveMode) { + SiS_SetFlag |= ProgrammingCRT2; + } + } + /* TW: Removed 301B301LV302B302LV check here */ + if(SiS_VBInfo & SetCRT2ToLCDA) { + SiS_SetFlag |= ProgrammingCRT2; + } + + RefreshRateTableIndex = SiS_GetRatePtrCRT2(ROMAddr,ModeNo,ModeIdIndex); + + /* TW: Removed 301B301LV302B302LV check here */ + if(!(SiS_VBInfo & SetCRT2ToLCDA)) { + 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); + } + +#ifdef SIS300 + if((HwDeviceExtension->jChipType == SIS_630)|| + (HwDeviceExtension->jChipType == SIS_730)|| + (HwDeviceExtension->jChipType == SIS_540)) { + SiS_SetCRT1FIFO_300(ROMAddr,ModeNo,HwDeviceExtension,RefreshRateTableIndex); + } +#endif +#ifdef SIS315H + if(HwDeviceExtension->jChipType >= SIS_315H) { + SiS_SetCRT1FIFO_310(ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension); + } +#endif - for (i = 0; i <= 0x18; i++) { - CRTCdata = SiS_StandTable[StandTableIndex].CRTC[i]; /* Get CRTC from file */ - SiS_SetReg1 (SiS_P3d4, i, CRTCdata); /* Set CRTC(3d4) */ - } - if ((HwDeviceExtension->jChipType == SIS_630) && - (HwDeviceExtension->jChipRevision == 0x30)) { /* for 630S0 */ - if (SiS_VBInfo & SetInSlaveMode) { - if (SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToTV)) { - SiS_SetReg1 (SiS_P3d4, 0x18, 0xFE); - } - } - } -} + SiS_SetCRT1ModeRegs(ROMAddr,HwDeviceExtension,ModeNo,ModeIdIndex,RefreshRateTableIndex); -void -SiS_SetATTRegs (ULONG ROMAddr, USHORT StandTableIndex) -{ - UCHAR ARdata; - USHORT i; - - for (i = 0; i <= 0x13; i++) { - ARdata = SiS_StandTable[StandTableIndex].ATTR[i]; /* Get AR for file */ - /*301b */ - if ((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B)) { - if (SiS_VBInfo & SetCRT2ToLCDA) { - if (i == 0x13) { - ARdata = 0; - } - } - } - /*end 301b */ - if (SiS_IF_DEF_LVDS == 1) { /*for LVDS */ - if (SiS_IF_DEF_CH7005 == 1) { - if (SiS_VBInfo & SetCRT2ToTV) { - if (SiS_VBInfo & SetInSlaveMode) { - if (i == 0x13) { - ARdata = 0; - } - } - } - } - if (SiS_VBInfo & SetCRT2ToLCD) { - if (SiS_VBInfo & SetInSlaveMode) { - if (SiS_LCDInfo & LCDNonExpanding) { - if (i == 0x13) { - 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_P3da); /* reset 3da */ - SiS_SetReg3 (SiS_P3c0, 0x14); /* set index */ - SiS_SetReg3 (SiS_P3c0, 0x00); /* set data */ +#if 0 /* TW: Not done in any BIOS */ +#ifdef SIS315H + if(HwDeviceExtension->jChipType >= SIS_315H) { + if (RefreshRateTableIndex != 0xFFFF) { + SiS_SetInterlace(ROMAddr,ModeNo,RefreshRateTableIndex); + } +#endif + } +#endif + + SiS_LoadDAC(ROMAddr,ModeNo,ModeIdIndex); + + if(flag_clearbuffer) SiS_ClearBuffer(HwDeviceExtension,ModeNo); - SiS_GetReg2 (SiS_P3da); /* Enable Attribute */ - SiS_SetReg3 (SiS_P3c0, 0x20); + if(!(SiS_VBInfo & (SetSimuScanMode | SwitchToCRT2 | SetCRT2ToLCDA))) { + SiS_LongWait(); + SiS_DisplayOn(); + } } +#ifdef LINUX_XF86 void -SiS_SetGRCRegs (ULONG ROMAddr, USHORT StandTableIndex) +SiS_SetPitch(ScrnInfoPtr pScrn, UShort BaseAddr) { - 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) */ - } - - if (SiS_ModeType > ModeVGA) { - GRdata = (UCHAR) SiS_GetReg1 (SiS_P3ce, 0x05); - GRdata = GRdata & 0xBF; /* 256 color disable */ - SiS_SetReg1 (SiS_P3ce, 0x05, GRdata); - } + 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); + } + if (pSiS->VBFlags & DISPTYPE_DISP2) { + SiS_SetPitchCRT2(pScrn, BaseAddr); + } } void -SiS_ClearExt1Regs () +SiS_SetPitchCRT1(ScrnInfoPtr pScrn, UShort BaseAddr) { - USHORT i; + SISPtr pSiS = SISPTR(pScrn); + ULong HDisplay,temp; - for (i = 0x0A; i <= 0x0E; i++) - SiS_SetReg1 (SiS_P3c4, i, 0x00); /* Clear SR0A-SR0E */ + 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); } void -SiS_SetSync (ULONG ROMAddr, USHORT RefreshRateTableIndex) +SiS_SetPitchCRT2(ScrnInfoPtr pScrn, UShort BaseAddr) { - USHORT sync; - USHORT temp; + SISPtr pSiS = SISPTR(pScrn); + ULong HDisplay,temp; + + HDisplay = pSiS->scrnPitch / 8; - sync = SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag >> 8; /* di+0x00 */ + /* Unlock CRT2 */ + if (pSiS->VGAEngine == SIS_315_VGA) + SiS_SetRegANDOR(SiS_Part1Port,0x2F, 0xFF, 0x01); + else + SiS_SetRegANDOR(SiS_Part1Port,0x24, 0xFF, 0x01); - sync = sync & 0xC0; - temp = 0x2F; - temp = temp | sync; - SiS_SetReg3 (SiS_P3c2, temp); /* Set Misc(3c2) */ + SiS_SetReg1(SiS_Part1Port,0x07, (HDisplay & 0xFF)); + temp = (SiS_GetReg1(SiS_Part1Port,0x09) & 0xF0) | ((HDisplay >> 8) & 0xFF); + SiS_SetReg1(SiS_Part1Port,0x09, temp); } +#endif +/* TW: Checked against 650/301 and 630/301B BIOS */ void -SiS_SetCRT1CRTC (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex) -{ - UCHAR index; - UCHAR data; - USHORT temp, tempah, i, modeflag, j; - USHORT ResInfo, DisplayType; - SiS_LCDACRT1DataStruct *LCDACRT1Ptr = NULL; - if ((SiS_VBType & VB_SIS302B) && (SiS_VBInfo & SetCRT2ToLCDA)) { - /*add crt1ptr */ - if (ModeNo <= 0x13) { - modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ - } else { - modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */ - } - temp = - SiS_GetLCDACRT1Ptr (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 12: LCDACRT1Ptr = SiS_CHTVCRT1UNTSC; break; - case 13: LCDACRT1Ptr = SiS_CHTVCRT1ONTSC; break; - case 14: LCDACRT1Ptr = SiS_CHTVCRT1UPAL; break; - case 15: LCDACRT1Ptr = SiS_CHTVCRT1OPAL; break; */ - } +SiS_GetVBType(USHORT BaseAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT flag; + + SiS_VBType = 0; + + if(SiS_IF_DEF_LVDS == 1) return; + + flag = SiS_GetReg1(SiS_Part4Port,0x00); + + /* TW: Illegal values not welcome... */ + if(flag > 10) return; + + if (flag >= 2) { + flag=SiS_GetReg1(SiS_Part4Port,0x01); + if(flag >= 0xB0){ + SiS_VBType = VB_SIS302B; + if(flag >= 0xD0) + SiS_VBType = VB_SIS302LV; + } + } 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; + } + /* 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; + } + } +} - tempah = (UCHAR) SiS_GetReg1 (SiS_P3d4, 0x11); /*unlock cr0-7 */ - tempah = tempah & 0x7F; - SiS_SetReg1 (SiS_P3d4, 0x11, tempah); - tempah = (LCDACRT1Ptr + ResInfo)->CR[0]; - SiS_SetReg1 (SiS_P3d4, 0x0, tempah); - for (i = 0x01, j = 1; i <= 0x07; i++, j++) { - tempah = (LCDACRT1Ptr + ResInfo)->CR[j]; - SiS_SetReg1 (SiS_P3d4, i, tempah); - } -/* for(i=0x06,j=5;i<=0x07;i++,j++){ - tempah = (LCDACRT1Ptr+ResInfo)->CR[j]; - SiS_SetReg1(SiS_P3d4,i,tempah); - }*/ - for (i = 0x10, j = 8; i <= 0x12; i++, j++) { - tempah = (LCDACRT1Ptr + ResInfo)->CR[j]; - SiS_SetReg1 (SiS_P3d4, i, tempah); - } - for (i = 0x15, j = 11; i <= 0x16; i++, j++) { - tempah = (LCDACRT1Ptr + ResInfo)->CR[j]; - SiS_SetReg1 (SiS_P3d4, i, tempah); - } +BOOLEAN +SiS_SearchModeID(UCHAR *ROMAddr,USHORT *ModeNo,USHORT *ModeIdIndex) +{ + UCHAR VGAINFO = 0x11; /* TW: Replaces ds:449 */ - for (i = 0x0A, j = 13; i <= 0x0C; i++, j++) { - tempah = (LCDACRT1Ptr + ResInfo)->CR[j]; - SiS_SetReg1 (SiS_P3c4, i, tempah); - } + if(*ModeNo <= 0x13) { - tempah = (LCDACRT1Ptr + ResInfo)->CR[16]; - tempah = tempah & 0x0E0; - SiS_SetReg1 (SiS_P3c4, 0x0E, tempah); + if((*ModeNo) <= 5) (*ModeNo) |= 1; - tempah = (LCDACRT1Ptr + ResInfo)->CR[16]; - tempah = tempah & 0x01; - tempah = tempah << 5; - if (modeflag & DoubleScanMode) { - tempah = tempah | 0x080; - } - SiS_SetRegANDOR (SiS_P3d4, 0x09, ~0x020, tempah); - if (SiS_ModeType > 0x03) - SiS_SetReg1 (SiS_P3d4, 0x14, 0x4F); -/*end 301b*/ - } else { - index = SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; /* Get index */ - index = index & 0x3F; + for (*ModeIdIndex=0;;(*ModeIdIndex)++) { + if (SiS_SModeIDTable[*ModeIdIndex].St_ModeID == (*ModeNo)) break; + if (SiS_SModeIDTable[*ModeIdIndex].St_ModeID == 0xFF) return FALSE; + } - data = (UCHAR) SiS_GetReg1 (SiS_P3d4, 0x11); - data = data & 0x7F; - SiS_SetReg1 (SiS_P3d4, 0x11, data); /* Unlock CRTC */ + if(*ModeNo == 0x07) { + if(VGAINFO & 0x10) (*ModeIdIndex)++; /* 400 lines */ + /* else 350 lines */ + } + if(*ModeNo <= 3) { + if(!(VGAINFO & 0x80)) (*ModeIdIndex)++; + if(VGAINFO & 0x10) (*ModeIdIndex)++; /* 400 lines */ + /* else 350 lines */ + } + /* else 200 lines */ - for (i = 0, j = 0; i <= 07; i++, j++) { - data = SiS_CRT1Table[index].CR[i]; - SiS_SetReg1 (SiS_P3d4, j, data); - } - for (j = 0x10; i <= 10; i++, j++) { - data = SiS_CRT1Table[index].CR[i]; - SiS_SetReg1 (SiS_P3d4, j, data); - } - for (j = 0x15; i <= 12; i++, j++) { - data = SiS_CRT1Table[index].CR[i]; - SiS_SetReg1 (SiS_P3d4, j, data); - } - for (j = 0x0A; i <= 15; i++, j++) { - data = SiS_CRT1Table[index].CR[i]; - SiS_SetReg1 (SiS_P3c4, j, data); - } + } else { - data = SiS_CRT1Table[index].CR[16]; - data = data & 0xE0; - SiS_SetReg1 (SiS_P3c4, 0x0E, data); - - data = (UCHAR) SiS_GetReg1 (SiS_P3d4, 0x09); - data = data & 0xDF; /* clear CR9 D[5] */ - i = SiS_CRT1Table[index].CR[16]; - i = i & 0x01; - i = i << 5; - data = data | i; - - if (ModeNo <= 0x13) - i = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; - else - i = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - - i = i & DoubleScanMode; - if (i) - data = data | 0x80; - SiS_SetReg1 (SiS_P3d4, 0x09, data); - - if (SiS_ModeType > 0x03) - SiS_SetReg1 (SiS_P3d4, 0x14, 0x4F); - } + for (*ModeIdIndex=0;;(*ModeIdIndex)++) { + if (SiS_EModeIDTable[*ModeIdIndex].Ext_ModeID == (*ModeNo)) break; + if (SiS_EModeIDTable[*ModeIdIndex].Ext_ModeID == 0xFF) return FALSE; + } + + } + return TRUE; +} + +/* For SiS 300 oem util: Search VBModeID */ +BOOLEAN +SiS_SearchVBModeID(UCHAR *ROMAddr, USHORT *ModeNo) +{ + USHORT ModeIdIndex; + UCHAR VGAINFO = 0x11; /* TW: Replaces ds:449 */ + + 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(*ModeNo != 0x07) { + if(*ModeNo > 0x03) return ((BOOLEAN)ModeIdIndex); + if(VGAINFO & 0x80) return ((BOOLEAN)ModeIdIndex); + ModeIdIndex++; + } + if(VGAINFO & 0x10) ModeIdIndex++; /* 400 lines */ + /* else 350 lines */ + return ((BOOLEAN)ModeIdIndex); +} + +/* TW: Checked against 630/301B and 315 BIOS */ +BOOLEAN +SiS_CheckMemorySize(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); + + if (ModeNo<=0x13) { + modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + } else { + modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + } + + memorysize = modeflag & MemoryInfoFlag; + memorysize >>= MemorySizeShift; + memorysize++; /* Get memory size */ + + temp = SiS_GetReg1(SiS_P3c4,0x14); /* Get DRAM Size */ + + 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++; + } + + if(temp < memorysize) return(FALSE); + else return(TRUE); +} + +UCHAR +SiS_GetModePtr(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex) +{ + UCHAR index; + + if(ModeNo<=0x13) { + index = SiS_SModeIDTable[ModeIdIndex].St_StTableIndex; + } else { + if(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_SetCRT1Offset (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex, - PSIS_HW_DEVICE_INFO HwDeviceExtension) -{ - USHORT temp, ah, al; - USHORT temp2, i; - USHORT DisplayUnit; - - /* Alan */ - temp = SiS_EModeIDTable[ModeIdIndex].Ext_ModeInfo; - if (HwDeviceExtension->jChipType >= SIS_315H) { - temp = temp >> 8; /* sis310 *//* index */ - } else { - temp = temp >> 4; /* sis300 *//* index */ - } - temp = SiS_ScreenOffset[temp]; - if ((ModeNo >= 0x7C) && (ModeNo <= 0x7E)) { - temp = 0x6B; - temp2 = ModeNo - 0x7C; - } else { - temp2 = SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag; - temp2 = temp2 & InterlaceMode; - if (temp2) - temp = temp << 1; - temp2 = SiS_ModeType - ModeEGA; - } - switch (temp2) { - case 0: - temp2 = 1; - break; - case 1: - temp2 = 2; - break; - case 2: - temp2 = 4; - break; - case 3: - temp2 = 4; - break; - case 4: - temp2 = 6; - break; - case 5: - temp2 = 8; - break; - } - temp = temp * temp2; - DisplayUnit = temp; - - temp2 = temp; - temp = temp >> 8; /* ah */ - temp = temp & 0x0F; - i = SiS_GetReg1 (SiS_P3c4, 0x0E); - i = i & 0xF0; - i = i | temp; - SiS_SetReg1 (SiS_P3c4, 0x0E, i); - - temp = (UCHAR) temp2; - temp = temp & 0xFF; /* al */ - SiS_SetReg1 (SiS_P3d4, 0x13, temp); - - temp2 = SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag; - temp2 = temp2 & InterlaceMode; - if (temp2) - DisplayUnit >>= 1; - - DisplayUnit = DisplayUnit << 5; - ah = (DisplayUnit & 0xff00) >> 8; - al = DisplayUnit & 0x00ff; - if (al == 0) - ah = ah + 1; - else - ah = ah + 2; - SiS_SetReg1 (SiS_P3c4, 0x10, ah); +SiS_SetSeqRegs(UCHAR *ROMAddr,USHORT StandTableIndex) +{ + UCHAR SRdata; + USHORT i; + + SiS_SetReg1(SiS_P3c4,0x00,0x03); /* Set SR0 */ + + SRdata=SiS_StandTable[StandTableIndex].SR[0]; + + if(SiS_VBType & VB_SIS301BLV302BLV) { + if(SiS_VBInfo & SetCRT2ToLCDA) { + SRdata |= 0x01; + } + } + if(SiS_IF_DEF_LVDS == 1) { + if(SiS_IF_DEF_CH70xx != 0) { + if(SiS_VBInfo & SetCRT2ToTV) { + if(SiS_VBInfo & SetInSlaveMode) { + SRdata |= 0x01; /* 8 dot clock */ + } + } + } + if(SiS_VBInfo & SetCRT2ToLCD) { + if(SiS_VBInfo & SetInSlaveMode) { + /* TW: wdr/300: if(SiS_LCDInfo & LCDNonExpanding) { */ + SRdata |= 0x01; /* 8 dot clock */ + } + } + } + + SRdata |= 0x20; /* screen off */ + + SiS_SetReg1(SiS_P3c4,0x01,SRdata); + + for(i=02;i<=04;i++) { + SRdata=SiS_StandTable[StandTableIndex].SR[i-1]; + SiS_SetReg1(SiS_P3c4,i,SRdata); + } } +/* Checked against 650/301LV and 65/LVDS 1.10.07 BIOS */ void -SiS_SetCRT1VCLK (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - PSIS_HW_DEVICE_INFO HwDeviceExtension, - USHORT RefreshRateTableIndex) -{ - UCHAR index, data; - USHORT vclkindex; - if (SiS_IF_DEF_LVDS == 1) { - vclkindex = - SiS_GetVCLK2Ptr (ROMAddr, ModeNo, ModeIdIndex, - RefreshRateTableIndex, HwDeviceExtension); - data = SiS_GetReg1 (SiS_P3c4, 0x31) & 0xCF; - SiS_SetReg1 (SiS_P3c4, 0x31, data); - - data = SiS_VCLKData[vclkindex].SR2B; - SiS_SetReg1 (SiS_P3c4, 0x2B, data); - data = SiS_VCLKData[vclkindex].SR2C; - SiS_SetReg1 (SiS_P3c4, 0x2C, data); - - if (HwDeviceExtension->jChipType < SIS_315H) - SiS_SetReg1 (SiS_P3c4, 0x2D, 0x80); - else - SiS_SetReg1 (SiS_P3c4, 0x2D, 0x01); +SiS_SetMiscRegs(UCHAR *ROMAddr,USHORT StandTableIndex) +{ + UCHAR Miscdata; - } - else - if (((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B)) - && (SiS_VBInfo & SetCRT2ToLCDA) && (SiS_IF_DEF_LVDS == 0)) { - vclkindex = - SiS_GetVCLK2Ptr (ROMAddr, ModeNo, ModeIdIndex, - RefreshRateTableIndex, HwDeviceExtension); - data = SiS_GetReg1 (SiS_P3c4, 0x31) & 0xCF; - SiS_SetReg1 (SiS_P3c4, 0x31, data); - - data = SiS_VBVCLKData[vclkindex].Part4_A; - SiS_SetReg1 (SiS_P3c4, 0x2B, data); - data = SiS_VBVCLKData[vclkindex].Part4_B; - SiS_SetReg1 (SiS_P3c4, 0x2C, data); - - if (HwDeviceExtension->jChipType < SIS_315H) - SiS_SetReg1 (SiS_P3c4, 0x2D, 0x80); /* for300 series */ - else - SiS_SetReg1 (SiS_P3c4, 0x2D, 0x01); + Miscdata = SiS_StandTable[StandTableIndex].MISC; - } else { - index = SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; - /*if(HwDeviceExtension->jChipType < SIS_315H) { */ - index = index & 0x3F; - /*} */ - data = SiS_GetReg1 (SiS_P3c4, 0x31) & 0xCF; -/*SiS_SetReg1(SiS_P3c4,0x31,0x00); *//* for300 */ - SiS_SetReg1 (SiS_P3c4, 0x31, data); - SiS_SetReg1 (SiS_P3c4, 0x2B, SiS_VCLKData[index].SR2B); - SiS_SetReg1 (SiS_P3c4, 0x2C, SiS_VCLKData[index].SR2C); - if (HwDeviceExtension->jChipType < SIS_315H) - SiS_SetReg1 (SiS_P3c4, 0x2D, 0x80); /* for300 series */ - else - SiS_SetReg1 (SiS_P3c4, 0x2D, 0x01); /* for310 series */ - } + if(SiS_VBType & VB_SIS301BLV302BLV) { + if(SiS_VBInfo & SetCRT2ToLCDA) { + Miscdata |= 0x0C; + } + } + + SiS_SetReg3(SiS_P3c2,Miscdata); } + +/* Checked against 650/LVDS (1.10.07) and 650/301LV BIOS (630 code still there!) */ void -SiS_IsLowResolution (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex) -{ - USHORT data; - USHORT ModeFlag; - - data = SiS_GetReg1 (SiS_P3c4, 0x0F); - data = data & 0x7F; - SiS_SetReg1 (SiS_P3c4, 0x0F, data); - - if (ModeNo > 0x13) { - ModeFlag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - if ((ModeFlag & HalfDCLK) && (ModeFlag & DoubleScanMode)) { - data = SiS_GetReg1 (SiS_P3c4, 0x0F); - data = data | 0x80; - SiS_SetReg1 (SiS_P3c4, 0x0F, data); - data = SiS_GetReg1 (SiS_P3c4, 0x01); - data = data & 0xF7; - SiS_SetReg1 (SiS_P3c4, 0x01, data); - } - } +SiS_SetCRTCRegs(UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension, + USHORT StandTableIndex) +{ + UCHAR CRTCdata; + USHORT i; + + SiS_SetRegAND(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) */ + } + 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); + } + } + } } +/* TW: Checked against 650/LVDS (1.10.07), 650/301LV and 630/301B BIOS */ void -SiS_SetCRT1ModeRegs (ULONG ROMAddr, PSIS_HW_DEVICE_INFO HwDeviceExtension, - USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex) +SiS_SetATTRegs(UCHAR *ROMAddr,USHORT StandTableIndex,USHORT ModeNo, + PSIS_HW_DEVICE_INFO HwDeviceExtension) { - 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; + UCHAR ARdata; + USHORT i; + + for(i=0;i<=0x13;i++) { + ARdata = SiS_StandTable[StandTableIndex].ATTR[i]; +#if 0 + if((i <= 0x0f) || (i == 0x11)) { + if(ds:489 & 0x08) { + continue; + } + } +#endif + if(i == 0x13) { + if(SiS_VBType & VB_SIS301BLV302BLV) { + if(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_VBInfo & SetCRT2ToLCD) { + if((HwDeviceExtension->jChipType >= SIS_315H) && (SiS_IF_DEF_LVDS == 1)) { + /* TW: From 650/LVDS 1.10.07, 1.10a */ + ARdata = 0; } else { - modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ModeFlag */ - } - SiS_SetRegANDOR (SiS_P3c4, 0x1F, 0x3F, 0x00); - if (ModeNo > 0x13) - data = infoflag; - else - data = 0; - data2 = 0; - if (ModeNo > 0x13) { - if (SiS_ModeType > 0x02) { - data2 = data2 | 0x02; - data3 = SiS_ModeType - ModeVGA; - data3 = data3 << 2; - data2 = data2 | data3; - } - } - data = data & InterlaceMode; - if (data) - data2 = data2 | 0x20; - SiS_SetReg1 (SiS_P3c4, 0x06, data2); - if ((HwDeviceExtension->jChipType == SIS_630) || - (HwDeviceExtension->jChipType == SIS_540) || - (HwDeviceExtension->jChipType == SIS_730)) { - resindex = SiS_GetResInfo (ROMAddr, ModeNo, ModeIdIndex); - if (ModeNo <= 0x13) { - xres = SiS_StResInfo[resindex].HTotal; - } else { - xres = SiS_ModeResInfo[resindex].HTotal; /* xres->ax */ - } - data = 0x0000; - if (infoflag & InterlaceMode) { - if (xres == 1024) - data = 0x0035; - if (xres == 1280) - data = 0x0048; - } - data2 = data & 0x00FF; - SiS_SetRegANDOR (SiS_P3d4, 0x19, 0xFF, data2); - data2 = (data & 0xFF00) >> 8; - SiS_SetRegANDOR (SiS_P3d4, 0x19, 0xFC, data2); - } - if (modeflag & HalfDCLK) { - SiS_SetRegANDOR (SiS_P3c4, 0x01, 0xFF, 0x01); + if(SiS_VBInfo & SetInSlaveMode) { + /* TW: wdr: if(SiS_LCDInfo & LCDNonExpanding) { */ + 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_P3da); /* reset 3da */ + SiS_SetReg3(SiS_P3c0,0x14); /* set index */ + SiS_SetReg3(SiS_P3c0,0x00); /* set data */ + + SiS_GetReg2(SiS_P3da); /* Enable Attribute */ + SiS_SetReg3(SiS_P3c0,0x20); +} - if ((HwDeviceExtension->jChipType == SIS_630) || - (HwDeviceExtension->jChipType == SIS_540) || - (HwDeviceExtension->jChipType == SIS_730)) { - } else { - if (modeflag & LineCompareOff) { - SiS_SetRegANDOR (SiS_P3c4, 0x0F, 0xF7, 0x08); - } else { - SiS_SetRegANDOR (SiS_P3c4, 0x0F, 0xF7, 0x00); - } - } +/* TW: Checked against 650/LVDS (1.10.07, 1.10a) and 650/301LV BIOS */ +void +SiS_SetGRCRegs(UCHAR *ROMAddr,USHORT StandTableIndex) +{ + UCHAR GRdata; + USHORT i; - data = 0x60; - if (SiS_ModeType != ModeText) { - data = data ^ 0x60; - if (SiS_ModeType != ModeEGA) { - data = data ^ 0xA0; - } - } - SiS_SetRegANDOR (SiS_P3c4, 0x21, 0x1F, data); + 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) */ + } + + if(SiS_ModeType > ModeVGA) { + SiS_SetRegAND(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_SetVCLKState (ULONG ROMAddr, PSIS_HW_DEVICE_INFO HwDeviceExtension, - USHORT ModeNo, USHORT RefreshRateTableIndex) -{ - USHORT data, data2 = 0; - USHORT VCLK; - UCHAR index; - - if (ModeNo <= 0x13) - VCLK = 0; - else { - index = SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; - /*if(HwDeviceExtension->jChipType < SIS_315H) { */ - index = index & 0x3F; - /*} */ - VCLK = SiS_VCLKData[index].CLOCK; - } +SiS_ClearExt1Regs(PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT i; - if (HwDeviceExtension->jChipType < SIS_315H) { - data2 = 0x00; - if (VCLK > 150) - data2 = data2 | 0x80; - SiS_SetRegANDOR (SiS_P3c4, 0x07, 0x7B, data2); - - data2 = 0x00; - if (VCLK >= 150) - data2 = data2 | 0x08; /* VCLK > 150 */ - SiS_SetRegANDOR (SiS_P3c4, 0x32, 0xF7, data2); - } else { /* 310 series */ - - data = SiS_GetReg1 (SiS_P3c4, 0x32); - data = data & 0xf3; - if (VCLK >= 200) - data = data | 0x0c; /* VCLK > 200 */ - SiS_SetReg1 (SiS_P3c4, 0x32, data); - data = SiS_GetReg1 (SiS_P3c4, 0x1F); - data &= 0xE7; - if (VCLK < 200) - data |= 0x10; - SiS_SetReg1 (SiS_P3c4, 0x1F, data); - } + for(i=0x0A;i<=0x0E;i++) SiS_SetReg1(SiS_P3c4,i,0x00); /* Clear SR0A-SR0E */ - if ((VCLK >= 0) && (VCLK < 135)) - data2 = 0x03; - 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; - } - SiS_SetRegANDOR (SiS_P3c4, 0x07, 0xFC, data2); + /* TW: New from 650/LVDS/301LV BIOSes: */ + if(HwDeviceExtension->jChipType >= SIS_315H) { + SiS_SetRegAND(SiS_P3c4,0x37,0xFE); + } } +/* TW: Checked against 650/LVDS (1.10.07) and 650/301LV BIOS */ void -SiS_LoadDAC (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex) +SiS_SetSync(UCHAR *ROMAddr,USHORT RefreshRateTableIndex) { - 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 sync; + USHORT temp; - if (ModeNo <= 0x13) - data = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; - else - data = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + sync = SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag >> 8; - data = data & 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; + sync &= 0xC0; + temp = 0x2F | sync; + SiS_SetReg3(SiS_P3c2,temp); /* Set Misc(3c2) */ +} - SiS_SetReg3 (SiS_P3c6, 0xFF); - SiS_SetReg3 (SiS_P3c8, 0x00); +/* TW: Checked against 650/LVDS (1.10.07) and 650/301LV BIOS */ +void +SiS_SetCRT1CRTC(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + UCHAR index; + USHORT temp,tempah,i,modeflag,j; + USHORT ResInfo,DisplayType; + SiS_LCDACRT1DataStruct *LCDACRT1Ptr=NULL; + + SiS_SetRegAND(SiS_P3d4,0x11,0x7f); /*unlock cr0-7 */ + + if(ModeNo<=0x13) { + modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + } else { + modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + } + + if((SiS_VBType & (VB_SIS302B | VB_SIS302LV)) + && (SiS_VBInfo & SetCRT2ToLCDA)) { + + /* 302B LCDA - TW: Not done in any BIOS version */ + + temp = SiS_GetLCDACRT1Ptr(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; + } + + tempah = (LCDACRT1Ptr+ResInfo)->CR[0]; + SiS_SetReg1(SiS_P3d4,0x00,tempah); + for(i=0x01,j=1;i<=0x07;i++,j++){ + tempah = (LCDACRT1Ptr+ResInfo)->CR[j]; + SiS_SetReg1(SiS_P3d4,i,tempah); + } + for(i=0x10,j=8;i<=0x12;i++,j++){ + tempah = (LCDACRT1Ptr+ResInfo)->CR[j]; + SiS_SetReg1(SiS_P3d4,i,tempah); + } + for(i=0x15,j=11;i<=0x16;i++,j++){ + tempah =(LCDACRT1Ptr+ResInfo)->CR[j]; + SiS_SetReg1(SiS_P3d4,i,tempah); + } + for(i=0x0A,j=13;i<=0x0C;i++,j++){ + tempah = (LCDACRT1Ptr+ResInfo)->CR[j]; + SiS_SetReg1(SiS_P3c4,i,tempah); + } + + tempah = (LCDACRT1Ptr+ResInfo)->CR[16]; + tempah &= 0x0E0; + SiS_SetReg1(SiS_P3c4,0x0E,tempah); + + tempah = (LCDACRT1Ptr+ResInfo)->CR[16]; + tempah &= 0x01; + tempah <<= 5; + if(modeflag & DoubleScanMode) tempah |= 0x080; + + SiS_SetRegANDOR(SiS_P3d4,0x09,~0x020,tempah); + if(SiS_ModeType > 0x03) SiS_SetReg1(SiS_P3d4,0x14,0x4F); + + } else { + + /* LVDS, 301, 301B, 301LV, 302LV, (302B non-LCDA) */ + + index = SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; /* Get index */ + if(HwDeviceExtension->jChipType < SIS_315H) { + index &= 0x3F; + } + + 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); + + tempah = SiS_CRT1Table[index].CR[16]; + tempah &= 0x01; + tempah <<= 5; + if(modeflag & DoubleScanMode) tempah |= 0x80; + SiS_SetRegANDOR(SiS_P3d4,0x09,0xDF,tempah); + + if(SiS_ModeType > 0x03) SiS_SetReg1(SiS_P3d4,0x14,0x4F); + } +} - 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 = data2 + 0x15; - SiS_SetReg3 (SiS_P3c9, data2); - data = data >> 2; - } - } +/* 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, + USHORT RefreshRateTableIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT temp, DisplayUnit, infoflag; - if (time == 256) { - for (i = 16; i < 32; i++) { - data = table[i]; - for (k = 0; k < 3; k++) - SiS_SetReg3 (SiS_P3c9, 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_WriteDAC (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_WriteDAC (dl, ah, al, dh); - } /* for 3 */ - dl++; - } /* for 3 */ - si = si + 5; - } /* for 9 */ - } + infoflag = SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag; + + DisplayUnit = SiS_GetOffset(ROMAddr,ModeNo,ModeIdIndex, + RefreshRateTableIndex,HwDeviceExtension); + + temp = (DisplayUnit >> 8) & 0x0f; + SiS_SetRegANDOR(SiS_P3c4,0x0E,0xF0,temp); + + temp = DisplayUnit & 0xFF; + SiS_SetReg1(SiS_P3d4,0x13,temp); + + if(infoflag & InterlaceMode) DisplayUnit >>= 1; + + DisplayUnit <<= 5; + temp = (DisplayUnit & 0xff00) >> 8; + if (DisplayUnit & 0xff) temp++; + temp++; + SiS_SetReg1(SiS_P3c4,0x10,temp); } +/* TW: New from 650/LVDS 1.10.07, 630/301B and 630/LVDS BIOS */ void -SiS_WriteDAC (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; - } - } - SiS_SetReg3 (SiS_P3c9, (USHORT) dh); - SiS_SetReg3 (SiS_P3c9, (USHORT) bh); - SiS_SetReg3 (SiS_P3c9, (USHORT) bl); +SiS_ResetCRT1VCLK(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 + */ + if(HwDeviceExtension->jChipType >= SIS_315H) { + if (SiS_IF_DEF_LVDS == 0) return; + } else { + if( (SiS_IF_DEF_LVDS == 0) && + (!(SiS_VBType & VB_SIS301BLV302BLV)) ) { + return; + } + } + + if(HwDeviceExtension->jChipType >= SIS_315H) { + SiS_SetRegANDOR(SiS_P3c4,0x31,0xCF,0x20); + } else { + SiS_SetReg1(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); + if(HwDeviceExtension->jChipType >= SIS_315H) { + SiS_SetRegANDOR(SiS_P3c4,0x31,0xcf,0x10); + } else { + SiS_SetReg1(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); } +/* TW: Checked against 650/LVDS, 650/301LV, 315, 630/301B, 630/LVDS BIOS */ void -SiS_ClearBuffer (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) { - SiS_SetMemory (VideoMemoryAddress, AdapterMemorySize, - 0); - } else { - pBuffer = VideoMemoryAddress; - for (i = 0; i < 0x4000; i++) - pBuffer[i] = 0x0000; - } +SiS_SetCRT1VCLK(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension, + USHORT RefreshRateTableIndex) +{ + USHORT index; + +#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 */ + + index = SiS_GetVCLK2Ptr(ROMAddr,ModeNo,ModeIdIndex, + RefreshRateTableIndex,HwDeviceExtension); + + SiS_SetRegAND(SiS_P3c4,0x31,0xCF); + + SiS_SetReg1(SiS_P3c4,0x2B,SiS_VBVCLKData[index].Part4_A); + SiS_SetReg1(SiS_P3c4,0x2C,SiS_VBVCLKData[index].Part4_B); + + if(HwDeviceExtension->jChipType >= SIS_315H) { + SiS_SetReg1(SiS_P3c4,0x2D,0x01); + } else { + SiS_SetReg1(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); } else { - pBuffer = VideoMemoryAddress; - if (SiS_ModeType == ModeCGA) { - for (i = 0; i < 0x4000; i++) - pBuffer[i] = 0x0720; - } else { - for (i = 0; i < 0x4000; i++) - pBuffer[i] = 0x0000; - } + SiS_SetReg1(SiS_P3c4,0x31,0x00); } + + SiS_SetReg1(SiS_P3c4,0x2B,SiS_VCLKData[index].SR2B); + SiS_SetReg1(SiS_P3c4,0x2C,SiS_VCLKData[index].SR2C); + + if(HwDeviceExtension->jChipType >= SIS_315H) { + SiS_SetReg1(SiS_P3c4,0x2D,0x01); + } else { + SiS_SetReg1(SiS_P3c4,0x2D,0x80); + } +#if 0 + } +#endif } +#if 0 /* TW: Not used */ void -SiS_DisplayOn (void) +SiS_IsLowResolution(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex) { + USHORT ModeFlag; + + SiS_SetRegAND(SiS_P3c4,0x0F,0x7F); - SiS_SetRegANDOR (SiS_P3c4, 0x01, 0xDF, 0x00); + if(ModeNo > 0x13) { + ModeFlag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + if ((ModeFlag & HalfDCLK) && (ModeFlag & DoubleScanMode)) { + SiS_SetRegOR(SiS_P3c4,0x0F,0x80); + SiS_SetRegAND(SiS_P3c4,0x01,0xF7); + } + } } +#endif +/* TW: Checked against 630/LVDS, 650/LVDS and 315 BIOS */ void -SiS_DisplayOff (void) +SiS_SetCRT1ModeRegs(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; + } else { + modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + } + + SiS_SetRegAND(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) ! */ + if(ModeNo > 0x13) { + if(SiS_ModeType > 0x02) { + data2 |= 0x02; + data3 = (SiS_ModeType - ModeVGA) << 2; + data2 |= data3; + } + } + if(data & InterlaceMode) data2 |= 0x20; + SiS_SetReg1(SiS_P3c4,0x06,data2); + + resindex = SiS_GetResInfo(ROMAddr,ModeNo,ModeIdIndex); + if(ModeNo <= 0x13) { + xres = SiS_StResInfo[resindex].HTotal; + } else { + xres = SiS_ModeResInfo[resindex].HTotal; + } + + data = 0x0000; + if(infoflag & InterlaceMode) { + if(xres == 1024) data = 0x0035; + else data = 0x0048; + } + 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); + } + + if(HwDeviceExtension->jChipType < SIS_315H) { + if(modeflag & LineCompareOff) { + SiS_SetRegANDOR(SiS_P3c4,0x0F,0xB7,0x08); + } else { + SiS_SetRegAND(SiS_P3c4,0x0F,0xB7); + } + /* 630 BIOS does something for mode 0x12 here */ + } else { + if(modeflag & LineCompareOff) { + SiS_SetRegANDOR(SiS_P3c4,0x0F,0xB7,0x08); + } else { + SiS_SetRegAND(SiS_P3c4,0x0F,0xB7); + } + } + + if(SiS_ModeType == ModeEGA) { + if(ModeNo > 0x13) { + SiS_SetRegOR(SiS_P3c4,0x0F,0x40); + } + } + + /* TW: 315 BIOS sets SR17 here (0x18bf) */ +#ifdef SIS315H + if(HwDeviceExtension->jChipType == SIS_315PRO) { + data = SiS_Get310DRAMType(ROMAddr,HwDeviceExtension); + data = SiS_SR15[2][data]; + if(SiS_ModeType == ModeText) { + data &= 0xc7; + } else { + data2 = SiS_GetOffset(ROMAddr,ModeNo,ModeIdIndex, + RefreshRateTableIndex,HwDeviceExtension); + data2 >>= 1; + if(infoflag & InterlaceMode) data2 >>= 1; + data3 = SiS_GetColorDepth(ROMAddr,ModeNo,ModeIdIndex); + data3 >>= 1; + if(data3 == 0) data3++; + data2 /= data3; + if(data2 >= 0x50) { + data &= 0x0f; + data |= 0x50; + } + } + SiS_SetReg1(SiS_P3c4,0x17,data); + } +#endif - SiS_SetRegANDOR (SiS_P3c4, 0x01, 0xDF, 0x20); + data = 0x60; + if(SiS_ModeType != ModeText) { + data = data ^ 0x60; + if(SiS_ModeType != ModeEGA) { + data = data ^ 0xA0; + } + } + SiS_SetRegANDOR(SiS_P3c4,0x21,0x1F,data); + + SiS_SetVCLKState(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); + } else { + SiS_SetReg1(SiS_P3d4,0x52,0x6c); + } + } +#endif } -/* ========================================== */ -/* SR CRTC GR */ +/* TW: Checked against 315, 650/LVDS, 650/301LV, 630/301B and 630/LVDS BIOS */ void -SiS_SetReg1 (USHORT port, USHORT index, USHORT data) -{ - OutPortByte (port, index); - OutPortByte (port + 1, data); - - /* - _asm - { - mov dx, port - mov ax, index - mov bx, data - out dx, al - mov ax, bx - inc dx - out dx, al - } - */ - +SiS_SetVCLKState(UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension, + USHORT ModeNo,USHORT RefreshRateTableIndex, + USHORT ModeIdIndex) +{ + USHORT data, data2=0; + USHORT VCLK, index=0; + + if (ModeNo <= 0x13) VCLK = 0; + else { + index = SiS_GetVCLK2Ptr(ROMAddr,ModeNo,ModeIdIndex, + RefreshRateTableIndex,HwDeviceExtension); + VCLK = 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 */ + + data2 = 0x00; + if(VCLK >= 150) data2 |= 0x08; /* VCLK > 150 */ + SiS_SetRegANDOR(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); + + if(VCLK >= 166) { /* TW: Was 200, is 166 in 650 and 315 BIOSes */ + SiS_SetRegAND(SiS_P3c4,0x1f,0xe7); + } +#if 0 /* Not done in 315 and 650/301LV/LVDS BIOSes: */ + data = SiS_GetReg1(SiS_P3c4,0x1F); /* DAC pedestal */ + data &= 0xE7; + if(VCLK<200) data |= 0x10; + SiS_SetReg1(SiS_P3c4,0x1F,data); /* DAC pedestal */ +#endif + } + + data2 = 0x03; + 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 */ + } 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 */ + } } -/* ========================================== */ -/* AR(3C0) */ void -SiS_SetReg2 (USHORT port, USHORT index, USHORT data) +SiS_LoadDAC(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; +#if 0 + USHORT tempah,tempch,tempcl,tempdh,tempal,tempbx; +#endif - InPortByte (port + 0x3da - 0x3c0); - OutPortByte (SiS_P3c0, index); - OutPortByte (SiS_P3c0, data); - OutPortByte (SiS_P3c0, 0x20); - - /* - _asm - { - mov dx, port - mov cx, index - mov bx, data + if (ModeNo<=0x13) + data = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + else + data = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - add dx, 3dah-3c0h - in al, dx +#if 0 + if(!(ds:489 & 0x08)) { +#endif - mov ax, cx - mov dx, 3c0h - out dx, al - mov ax, bx - out dx, al + data &= 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(SiS_P3c6,0xFF); + SiS_SetReg3(SiS_P3c8,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; + SiS_SetReg3(SiS_P3c9,data2); + data >>= 2; + } + } - mov ax, 20h - out dx, al + if(time == 256) { + for(i=16; i<32; i++) { + data = table[i]; + for(k=0; k<3; k++) SiS_SetReg3(SiS_P3c9,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_WriteDAC(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_WriteDAC(dl,ah,al,dh); + } /* for 3 */ + dl++; + } /* for 3 */ + si = si + 5; + } /* for 9 */ + } +#if 0 + } /* ds:489 & 0x08 */ +#endif +#if 0 + 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); + tempdh = tempah; + tempal = 0x4d * tempdh; /* 7fb8 */ + tempbx += tempal; + tempal = 0x97 * tempch; + tempbx += tempal; + tempal = 0x1c * tempcl; + tempbx += tempal; + if((tempbx & 0x00ff) > 0x80) tempbx += 0x100; + 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); + } + } +#endif } -/* ========================================== */ void -SiS_SetReg3 (USHORT port, USHORT data) +SiS_WriteDAC(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; + } + } + SiS_SetReg3(SiS_P3c9,(USHORT)dh); + SiS_SetReg3(SiS_P3c9,(USHORT)bh); + SiS_SetReg3(SiS_P3c9,(USHORT)bl); +} - OutPortByte (port, data); +ULONG +GetDRAMSize(PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + ULONG AdapterMemorySize=0; +#ifdef SIS315H + USHORT counter; +#endif + +#ifdef SIS315H + if ((HwDeviceExtension->jChipType == SIS_315H) || + (HwDeviceExtension->jChipType == SIS_315PRO)) { + counter = SiS_GetReg1(SiS_P3c4,0x14) & 0xF0; + counter >>= 4; + AdapterMemorySize= 1 << counter; + 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; + } +#endif - /* - _asm - { - mov dx, port - mov ax, data - out dx, al +#ifdef SIS300 + if ((HwDeviceExtension->jChipType==SIS_300) || + (HwDeviceExtension->jChipType==SIS_540) || + (HwDeviceExtension->jChipType==SIS_630) || + (HwDeviceExtension->jChipType==SIS_730)) { + AdapterMemorySize = SiS_GetReg1(SiS_P3c4,0x14); + AdapterMemorySize = AdapterMemorySize&0x3F; + AdapterMemorySize++; + AdapterMemorySize *= 1024*1024; + } +#endif - } - */ + return AdapterMemorySize; +} +void +SiS_ClearBuffer(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); + SiS_SetMemory(VideoMemoryAddress,AdapterMemorySize,0); + } else { + pBuffer = VideoMemoryAddress; + for(i=0; i<0x4000; i++) + pBuffer[i] = 0x0000; + } + } else { + pBuffer = VideoMemoryAddress; + if (SiS_ModeType < ModeCGA) { + for(i=0; i<0x4000; i++) + pBuffer[i] = 0x0720; + } else { + SiS_SetMemory(VideoMemoryAddress,0x8000,0); + } + } } -/* ========================================== */ void -SiS_SetReg4 (USHORT port, ULONG data) +SiS_DisplayOn(void) { + SiS_SetRegANDOR(SiS_P3c4,0x01,0xDF,0x00); +} - OutPortLong (port, data); +void +SiS_DisplayOff(void) +{ + SiS_SetRegANDOR(SiS_P3c4,0x01,0xDF,0x20); +} - /* - _asm - { - mov dx, port ;; port - mov eax, data ;; data - out dx, eax - } - */ +/* ========================================== */ +/* SR CRTC GR */ +void +SiS_SetReg1(USHORT port, USHORT index, USHORT data) +{ + OutPortByte(port,index); + OutPortByte(port+1,data); } -/* ========================================= */ -UCHAR SiS_GetReg1 (USHORT port, USHORT index) +/* ========================================== */ +/* AR(3C0) */ +void +SiS_SetReg2(USHORT port, USHORT index, USHORT data) { - UCHAR data; - - OutPortByte (port, index); - data = InPortByte (port + 1); + InPortByte(port+0x3da-0x3c0); + OutPortByte(SiS_P3c0,index); + OutPortByte(SiS_P3c0,data); + OutPortByte(SiS_P3c0,0x20); +} - /* - _asm - { - mov dx, port ;; port - mov ax, index ;; index +void +SiS_SetReg3(USHORT port, USHORT data) +{ + OutPortByte(port,data); +} - out dx, al - mov ax, bx - inc dx - xor eax, eax - in al, dx - mov data, al - } - */ - return (data); +void +SiS_SetReg4(USHORT port, ULONG data) +{ + OutPortLong(port,data); } -/* ========================================== */ -UCHAR SiS_GetReg2 (USHORT port) +UCHAR SiS_GetReg1(USHORT port, USHORT index) { - UCHAR data; + UCHAR data; - data = InPortByte (port); + OutPortByte(port,index); + data = InPortByte(port+1); - /* - _asm - { - mov dx, port ;; port - xor eax, eax - in al, dx - mov data, al - } - */ - return (data); + return(data); } -/* ========================================== */ -ULONG SiS_GetReg3 (USHORT port) +UCHAR +SiS_GetReg2(USHORT port) { - ULONG data; + UCHAR data; - data = InPortLong (port); + data= InPortByte(port); - /* - _asm - { - mov dx, port ;; port - xor eax, eax - in eax, dx - mov data, eax - } - */ - return (data); + return(data); } -/* ========================================== */ -void -SiS_ClearDAC (ULONG port) +ULONG +SiS_GetReg3(USHORT port) { - int i; + ULONG data; - OutPortByte (port, 0); - port++; - for (i = 0; i < 256 * 3; i++) { - OutPortByte (port, 0); - } + data = InPortLong(port); + return(data); } -/*========================================== */ +void +SiS_ClearDAC(ULONG port) +{ + int i; + + OutPortByte(port, 0); + port++; + for (i=0; i<256*3; i++) { + OutPortByte(port, 0); + } +} +/* ========================================== */ +#if 0 /* TW: Not done in any BIOS */ void -SiS_SetInterlace (ULONG ROMAddr, USHORT ModeNo, USHORT RefreshRateTableIndex) +SiS_SetInterlace(UCHAR *ROMAddr,USHORT ModeNo,USHORT RefreshRateTableIndex) { - ULONG Temp; - USHORT data, Temp2; + ULONG Temp; + USHORT data,Temp2; + + if (ModeNo<=0x13) return; - Temp = (ULONG) SiS_GetReg1 (SiS_P3d4, 0x01); - Temp++; - Temp = Temp * 8; + Temp = (ULONG)SiS_GetReg1(SiS_P3d4,0x01); + Temp++; + Temp <<= 3; - if (Temp == 1024) - data = 0x0035; - else if (Temp == 1280) - data = 0x0048; - else - data = 0x0000; + if(Temp == 1024) data = 0x0035; + else if(Temp == 1280) data = 0x0048; + else data = 0x0000; - Temp2 = SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag; - Temp2 &= InterlaceMode; - if (Temp2 == 0) - data = 0x0000; + Temp2 = SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag; + Temp2 &= InterlaceMode; + if(Temp2 == 0) data=0x0000; - SiS_SetReg1 (SiS_P3d4, 0x19, data); + SiS_SetReg1(SiS_P3d4,0x19,data); - Temp = (ULONG) SiS_GetReg1 (SiS_P3d4, 0x1A); - Temp2 = (USHORT) (Temp & 0xFC); - SiS_SetReg1 (SiS_P3d4, 0x1A, (USHORT) Temp); + Temp = (ULONG)SiS_GetReg1(SiS_P3d4,0x1A); + Temp = (USHORT)(Temp & 0xFC); + SiS_SetReg1(SiS_P3d4,0x1A,(USHORT)Temp); - Temp = (ULONG) SiS_GetReg1 (SiS_P3c4, 0x0f); - Temp2 = (USHORT) Temp & 0xBF; - if (ModeNo == 0x37) - Temp2 = Temp2 | 0x40; - SiS_SetReg1 (SiS_P3d4, 0x1A, (USHORT) Temp2); + Temp = (ULONG)SiS_GetReg1(SiS_P3c4,0x0f); + Temp2 = (USHORT)Temp & 0xBF; + if(ModeNo==0x37) Temp2 |= 0x40; + SiS_SetReg1(SiS_P3d4,0x1A,(USHORT)Temp2); } +#endif +/* TW: Checked against 650/LVDS (1.10.07), 650/301LV and 315 BIOS */ +#ifdef SIS315H void -SiS_SetCRT1FIFO (ULONG ROMAddr, USHORT ModeNo, - PSIS_HW_DEVICE_INFO HwDeviceExtension) +SiS_SetCRT1FIFO_310(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension) { - - USHORT data; - - data = SiS_GetReg1 (SiS_P3c4, 0x3D); - data &= 0xfe; - SiS_SetReg1 (SiS_P3c4, 0x3D, data); /* diable auto-threshold */ - if (ModeNo > 0x13) { - SiS_SetReg1 (SiS_P3c4, 0x08, 0x34); - data = SiS_GetReg1 (SiS_P3c4, 0x09); - data &= 0xF0; - SiS_SetReg1 (SiS_P3c4, 0x09, data); - - data = SiS_GetReg1 (SiS_P3c4, 0x3D); - data |= 0x01; - SiS_SetReg1 (SiS_P3c4, 0x3D, data); - } else { - SiS_SetReg1 (SiS_P3c4, 0x08, 0xAE); - data = SiS_GetReg1 (SiS_P3c4, 0x09); - data &= 0xF0; - SiS_SetReg1 (SiS_P3c4, 0x09, data); - } - + USHORT modeflag; + + SiS_SetRegAND(SiS_P3c4,0x3D,0xFE); /* disable auto-threshold */ + + if(ModeNo > 0x13) { + modeflag = 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); + } else { + SiS_SetReg1(SiS_P3c4,0x08,0xAE); + SiS_SetRegAND(SiS_P3c4,0x09,0xF0); + } + } else { + SiS_SetReg1(SiS_P3c4,0x08,0xAE); + SiS_SetRegAND(SiS_P3c4,0x09,0xF0); + } } +#endif +#if 0 /* TW: Unused */ USHORT -SiS_CalcDelay (ULONG 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 = data >> 6; - data2 = SiS_GetReg1 (SiS_P3c4, 0x14); - data2 = (data2 >> 4) & 0x0C; - data = data | data2; - data = data < 1; - if (key == 0) { - temp0 = (USHORT) ThLowA[data]; - temp1 = (USHORT) ThLowA[data + 1]; - } else { - temp0 = (USHORT) ThLowB[data]; - temp1 = (USHORT) ThLowB[data + 1]; - } - - data2 = 0; - data = SiS_GetReg1 (SiS_P3c4, 0x18); - if (data & 0x02) - data2 = data2 | 0x01; - if (data & 0x20) - data2 = data2 | 0x02; - if (data & 0x40) - data2 = data2 | 0x04; - - data = temp1 * ThTiming[data2] + temp0; - return (data); +SiS_CalcDelay(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=data>>6; + data2=SiS_GetReg1(SiS_P3c4,0x14); + data2=(data2>>4)&0x0C; + data=data|data2; + data=data<1; + if(key==0) { + temp0=(USHORT)ThLowA[data]; + temp1=(USHORT)ThLowA[data+1]; + } else { + temp0=(USHORT)ThLowB[data]; + temp1=(USHORT)ThLowB[data+1]; + } + + data2=0; + data=SiS_GetReg1(SiS_P3c4,0x18); + if(data&0x02) data2=data2|0x01; + if(data&0x20) data2=data2|0x02; + if(data&0x40) data2=data2|0x04; + + data=temp1*ThTiming[data2]+temp0; + return(data); } +#endif +#ifdef SIS300 void -SiS_SetCRT1FIFO2 (ULONG ROMAddr, USHORT ModeNo, - PSIS_HW_DEVICE_INFO HwDeviceExtension, - USHORT RefreshRateTableIndex) -{ - USHORT i, index, data, VCLK, data2, MCLK, colorth = 0; - USHORT ah, bl, B; - ULONG eax; - 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 - }; - - if (ModeNo >= 0x13) { - index = SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; - if (HwDeviceExtension->jChipType < SIS_315H) { /* for300 serial */ - index = index & 0x3F; - } - VCLK = SiS_VCLKData[index].CLOCK; /* Get VCLK */ - index = SiS_GetReg1 (SiS_P3c4, 0x1A); - index = index & 07; - MCLK = SiS_MCLKData[index].CLOCK; /* Get MCLK */ - data2 = SiS_ModeType - 0x02; - switch (data2) { - case 0: - colorth = 1; - break; - case 1: - colorth = 2; - break; - case 2: - colorth = 4; - break; - case 3: - colorth = 4; - break; - case 4: - colorth = 6; - break; - case 5: - colorth = 8; - break; - } - - i = 0; - do { - B = - (SiS_CalcDelay2 (ROMAddr, FQBQData[i]) * VCLK * - colorth); - bl = B / (16 * MCLK); - if (B == bl * 16 * MCLK) { - bl = bl + 1; - } else { - bl = bl + 1; - } - - if (bl > 0x13) { - if (FQBQData[i + 1] == 0xFF) { - ThresholdLow = 0x13; - break; - } - i++; - } else { - ThresholdLow = bl; - break; - } - } while (FQBQData[i] != 0xFF); - } else { - ThresholdLow = 0x02; - } +SiS_SetCRT1FIFO_300(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}; + + i=0; + if(ModeNo >= 0x13) { + index = SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; + index &= 0x3F; + VCLK = SiS_VCLKData[index].CLOCK; /* Get VCLK */ + + index = SiS_GetReg1(SiS_P3c4,0x1A); + index &= 0x07; + MCLK = SiS_MCLKData_0[index].CLOCK; /* Get MCLK */ + + data2 = SiS_ModeType - ModeEGA; + switch (data2) { + 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; + } + + do{ + B = SiS_CalcDelay2(ROMAddr,FQBQData[i]) * 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 { + ThresholdLow = 0x02; + } + + /* Write foreground and background queue */ + 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 + /* 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); +#endif - data2 = FQBQData[i]; - data2 = (data2 & 0xf0) >> 4; - data2 = data2 << 24; + /* TODO: write GUI grant timer (PCI config 0xA3) */ - SiS_SetReg4 (0xcf8, 0x80000050); - eax = SiS_GetReg3 (0xcfc); - eax = eax & 0x0f0ffffff; - eax = eax | data2; - SiS_SetReg4 (0xcfc, eax); + /* Write CRT/CPU threshold low, CRT/Engine threshold high */ + data = ((ThresholdLow & 0x0f) << 4) | 0x0f; + SiS_SetReg1(SiS_P3c4,0x08,data); - ah = ThresholdLow; - ah = ah << 4; - ah = ah | 0x0f; - SiS_SetReg1 (SiS_P3c4, 0x08, ah); + data = (ThresholdLow & 0x10) << 1; + SiS_SetRegANDOR(SiS_P3c4,0x0F,0xDF,data); - data = ThresholdLow; - data = data & 0x10; - data = data << 1; - SiS_SetRegANDOR (SiS_P3c4, 0x0F, 0xDF, data); - SiS_SetReg1 (SiS_P3c4, 0x3B, 0x09); + /* What is this? */ + SiS_SetReg1(SiS_P3c4,0x3B,0x09); - data = ThresholdLow + 3; - if (data > 0x0f) - data = 0x0f; - SiS_SetRegANDOR (SiS_P3c4, 0x09, 0x80, data); + /* Write CRT/CPU threshold high */ + data = ThresholdLow + 3; + if(data > 0x0f) data = 0x0f; + SiS_SetRegANDOR(SiS_P3c4,0x09,0x80,data); } USHORT -SiS_CalcDelay2 (ULONG ROMAddr, UCHAR key) -{ - 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 = index + 6; - if (!(key & 0x01)) - index = index + 24; - data = SiS_GetReg1 (SiS_P3c4, 0x14); - if (data & 0x0080) - index = index + 12; - - data = LatencyFactor[index]; - return (data); -} - -void -SiS_CRT2AutoThreshold (USHORT BaseAddr) +SiS_CalcDelay2(UCHAR *ROMAddr,UCHAR key) { - USHORT temp1; - USHORT Part1Port; - Part1Port = BaseAddr + SIS_CRT2_PORT_04; - temp1 = SiS_GetReg1 (SiS_Part1Port, 0x1); - temp1 |= 0x40; - SiS_SetReg1 (SiS_Part1Port, 0x1, temp1); + 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]; + return(data); } +#endif + +/* =============== Autodetection ================ */ -/* ============= ynlai ============== */ +#ifndef LINUX_XF86 + +/* (ynlai) */ void -SiS_DetectMonitor (PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr) +SiS_DetectMonitor(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr) { - UCHAR DAC_TEST_PARMS[] = { 0x0F, 0x0F, 0x0F }; - UCHAR DAC_CLR_PARMS[] = { 0x00, 0x00, 0x00 }; - USHORT SR1F; - - SR1F = SiS_GetReg1 (SiS_P3c4, 0x1F); - SiS_SetRegANDOR (SiS_P3c4, 0x1F, 0xFF, 0x04); - if (SiS_IF_DEF_LVDS == 0) { - if (SiS_BridgeIsOn (BaseAddr)) { - SiS_SetReg1 (SiS_P3d4, 0x30, 0x41); - } - } - SiSSetMode (HwDeviceExtension, 0x03); /* InitMode */ - 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); - } - if (SiS_TestMonitorType - (DAC_TEST_PARMS[0], DAC_TEST_PARMS[1], DAC_TEST_PARMS[2])) { - SiS_SetRegANDOR (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); + 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); + } + } + /*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); + } + if(SiS_TestMonitorType(DAC_TEST_PARMS[0],DAC_TEST_PARMS[1],DAC_TEST_PARMS[2])) { + SiS_SetRegANDOR(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); } USHORT -SiS_TestMonitorType (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; - 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); - else - return (0); +SiS_TestMonitorType(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; + 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); + else return(0); } /* ---- test ----- */ void -SiS_GetSenseStatus (PSIS_HW_DEVICE_INFO HwDeviceExtension, ULONG ROMAddr) -{ - USHORT tempax = 0, tempbx, tempcx, temp; - USHORT P2reg0 = 0, SenseModeNo = 0, OutputSelect = *pSiS_OutputSelect; - USHORT ModeIdIndex, i; - USHORT BaseAddr = (USHORT) HwDeviceExtension->ulIOAddress; - - if (SiS_IF_DEF_LVDS == 1) { - SiS_GetPanelID (); - temp = LCDSense; - temp = temp | SiS_SenseCHTV (); - tempbx = ~(LCDSense | AVIDEOSense | SVIDEOSense); - SiS_SetRegANDOR (SiS_P3d4, 0x32, tempbx, temp); - } else { /* for 301 */ - if (SiS_IF_DEF_HiVision == 1) { /* for HiVision */ - tempax = SiS_GetReg1 (SiS_P3c4, 0x38); - temp = tempax & 0x01; - tempax = SiS_GetReg1 (SiS_P3c4, 0x3A); - temp = temp | (tempax & 0x02); - SiS_SetRegANDOR (SiS_P3d4, 0x32, 0xA0, temp); - } else { - if (SiS_BridgeIsOn (BaseAddr)) { - P2reg0 = SiS_GetReg1 (SiS_Part2Port, 0x00); - if (!SiS_BridgeIsEnable - (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); - for (i = 0; i < 20; i++) { - SiS_LongWait (); - } - } - SiS_SetReg1 (SiS_Part2Port, 0x00, 0x1c); - tempax = 0; - tempbx = *pSiS_RGBSenseData; - /*301b */ - if (!(SiS_Is301B (BaseAddr))) { - tempbx = *pSiS_RGBSenseData2; - } - /*end 301b */ - tempcx = 0x0E08; - if (SiS_Sense (SiS_Part4Port, tempbx, tempcx)) { - if (SiS_Sense - (SiS_Part4Port, tempbx, tempcx)) { - tempax = tempax | Monitor2Sense; - } - } - - tempbx = *pSiS_YCSenseData; - /*301b */ - if (!(SiS_Is301B (BaseAddr))) { - tempbx = *pSiS_YCSenseData2; - } - /*301b */ - tempcx = 0x0604; - if (SiS_Sense (SiS_Part4Port, tempbx, tempcx)) { - if (SiS_Sense - (SiS_Part4Port, tempbx, tempcx)) { - tempax = tempax | SVIDEOSense; - } - } - - if (OutputSelect & BoardTVType) { - tempbx = *pSiS_VideoSenseData; - /*301b */ - if (!(SiS_Is301B (BaseAddr))) { - tempbx = *pSiS_VideoSenseData2; - } - /*end 301b */ - tempcx = 0x0804; - if (SiS_Sense - (SiS_Part4Port, tempbx, tempcx)) { - if (SiS_Sense - (SiS_Part4Port, tempbx, - tempcx)) { - tempax = - tempax | - AVIDEOSense; - } - } - } else { - if (!(tempax & SVIDEOSense)) { - tempbx = *pSiS_VideoSenseData; - /*301b */ - if (!(SiS_Is301B (BaseAddr))) { - tempbx = - *pSiS_VideoSenseData2; - } - /*end 301b */ - tempcx = 0x0804; - if (SiS_Sense - (SiS_Part4Port, tempbx, - tempcx)) { - if (SiS_Sense - (SiS_Part4Port, - tempbx, tempcx)) { - tempax = - tempax | - AVIDEOSense; - } - } - } - } - } - - if (SiS_SenseLCD (HwDeviceExtension)) { - tempax = tempax | LCDSense; - } - - tempbx = 0; - tempcx = 0; - SiS_Sense (SiS_Part4Port, tempbx, tempcx); - - 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_GetSenseStatus(PSIS_HW_DEVICE_INFO HwDeviceExtension,UCHAR *ROMAddr) +{ + USHORT tempax=0,tempbx,tempcx,temp; + USHORT P2reg0=0,SenseModeNo=0,OutputSelect=*pSiS_OutputSelect; + USHORT ModeIdIndex,i; + USHORT BaseAddr = (USHORT)HwDeviceExtension->ulIOAddress; + + if(SiS_IF_DEF_LVDS==1){ + SiS_GetPanelID(); + temp=LCDSense; + temp=temp|SiS_SenseCHTV(); + tempbx=~(LCDSense|AVIDEOSense|SVIDEOSense); + SiS_SetRegANDOR(SiS_P3d4,0x32,tempbx,temp); + } else { /* for 301 */ + if(SiS_IF_DEF_HiVision==1) { /* for HiVision */ + tempax=SiS_GetReg1(SiS_P3c4,0x38); + temp=tempax&0x01; + tempax=SiS_GetReg1(SiS_P3c4,0x3A); + temp=temp|(tempax&0x02); + SiS_SetRegANDOR(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)) { + 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); + for(i=0;i<20;i++) { + SiS_LongWait(); + } + } + SiS_SetReg1(SiS_Part2Port,0x00,0x1c); + tempax=0; + tempbx=*pSiS_RGBSenseData; + if(SiS_Is301B(BaseAddr)){ + tempbx=*pSiS_RGBSenseData2; + } + tempcx=0x0E08; + if(SiS_Sense(SiS_Part4Port,tempbx,tempcx)){ + if(SiS_Sense(SiS_Part4Port,tempbx,tempcx)){ + tempax=tempax|Monitor2Sense; + } + } + tempbx=*pSiS_YCSenseData; + if(SiS_Is301B(BaseAddr)){ + tempbx=*pSiS_YCSenseData2; + } + tempcx=0x0604; + if(SiS_Sense(SiS_Part4Port,tempbx,tempcx)){ + if(SiS_Sense(SiS_Part4Port,tempbx,tempcx)){ + tempax=tempax|SVIDEOSense; + } + } + + if(OutputSelect&BoardTVType){ + tempbx=*pSiS_VideoSenseData; + if(SiS_Is301B(BaseAddr)){ + tempbx=*pSiS_VideoSenseData2; + } + tempcx=0x0804; + if(SiS_Sense(SiS_Part4Port,tempbx,tempcx)){ + if(SiS_Sense(SiS_Part4Port,tempbx,tempcx)){ + tempax=tempax|AVIDEOSense; + } + } + } else { + if(!(tempax&SVIDEOSense)){ + tempbx=*pSiS_VideoSenseData; + if(SiS_Is301B(BaseAddr)){ + tempbx=*pSiS_VideoSenseData2; + } + tempcx=0x0804; + if(SiS_Sense(SiS_Part4Port,tempbx,tempcx)){ + if(SiS_Sense(SiS_Part4Port,tempbx,tempcx)){ + tempax=tempax|AVIDEOSense; + } + } + } + } + } + + if(SiS_SenseLCD(HwDeviceExtension)){ + tempax=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_SetRegANDOR(SiS_P3d4,0x32,~0xDF,tempax); + SiS_SetReg1(SiS_Part2Port,0x00,P2reg0); + if(!(P2reg0&0x20)) { + SiS_VBInfo = DisableCRT2Display; + SiS_SetCRT2Group301(BaseAddr,ROMAddr,SenseModeNo,HwDeviceExtension); + } + } + } } BOOLEAN -SiS_Sense (USHORT Part4Port, USHORT tempbx, USHORT tempcx) +SiS_Sense(USHORT Part4Port,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); - - for (i = 0; i < 10; i++) - SiS_LongWait (); - - tempch = (tempcx & 0x7F00) >> 8; /* ynlai [05/22/2001] */ - temp = SiS_GetReg1 (SiS_Part4Port, 0x03); - temp = temp ^ (0x0E); - temp = temp & tempch; /* ynlai [05/22/2001] */ - if (temp > 0) - return 1; - else - return 0; + 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); + + for(i=0;i<10;i++) SiS_LongWait(); + + tempch=(tempcx&0x7F00)>>8; /* ynlai [05/22/2001] */ + temp=SiS_GetReg1(SiS_Part4Port,0x03); + temp=temp^(0x0E); + temp=temp&tempch; /* ynlai [05/22/2001] */ + if(temp>0) return 1; + else return 0; } USHORT -SiS_SenseLCD (PSIS_HW_DEVICE_INFO HwDeviceExtension) +SiS_SenseLCD(PSIS_HW_DEVICE_INFO HwDeviceExtension) { -/* USHORT SoftSetting; */ - USHORT temp; + USHORT temp; - temp = SiS_GetPanelID (); - if (!temp) - temp = SiS_GetLCDDDCInfo (HwDeviceExtension); - return (temp); + temp=SiS_GetPanelID(); + if(!temp) temp=SiS_GetLCDDDCInfo(HwDeviceExtension); + return(temp); } BOOLEAN -SiS_GetLCDDDCInfo (PSIS_HW_DEVICE_INFO HwDeviceExtension) -{ - USHORT temp; - //add lcd sense - if (HwDeviceExtension->ulCRT2LCDType == LCD_UNKNOWN) - return 0; - else { - temp = (USHORT) HwDeviceExtension->ulCRT2LCDType; - SiS_SetReg1 (SiS_P3d4, 0x36, temp); - return 1; - } +SiS_GetLCDDDCInfo(PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT temp; + /*add lcd sense*/ + if(HwDeviceExtension->ulCRT2LCDType==LCD_UNKNOWN) + return 0; + else{ + temp=(USHORT)HwDeviceExtension->ulCRT2LCDType; + SiS_SetReg1(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; -/* USHORT return_flag; */ - - 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 = tempbx | 0x08; - if (temp & 0x20) - tempbx = tempbx | 0x02; - if (temp & 0x01) - tempbx = tempbx | 0x01; - temp = SiS_GetReg1 (SiS_P3c4, 0x39); - if (temp & 0x80) - tempbx = tempbx | 0x04; - } else { - return 0; - } - } - - tempbx = tempbx << 1; - tempbx = PanelTypeTable[tempbx]; - 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; +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) -{ - USHORT temp, push0e, status; - - status = 0; - push0e = SiS_GetCH7005 (0x0e); - push0e = (push0e << 8) | 0x0e; - SiS_SetCH7005 (0x0b0e); - SiS_SetCH7005 (0x0110); - SiS_SetCH7005 (0x0010); - temp = SiS_GetCH7005 (0x10); - if (temp & 0x08) - status = status | SVIDEOSense; - if (temp & 0x02) - status = status | AVIDEOSense; - SiS_SetCH7005 (push0e); - return (status); -} - -/* ========================================== */ +SiS_SenseCHTV(void) +{ + USHORT temp,push0e,status; + + status=0; + push0e = SiS_GetCH700x(0x0e); + push0e = (push0e << 8) | 0x0e; + SiS_SetCH700x(0x0b0e); + SiS_SetCH700x(0x0110); + SiS_SetCH700x(0x0010); + temp = SiS_GetCH700x(0x10); + if(temp & 0x08) status |= SVIDEOSense; + if(temp & 0x02) status |= AVIDEOSense; + SiS_SetCH700x(push0e); + return(status); +} +#endif /* LINUX_XF86 */ + +/* ================ for TC only ================= */ + #ifdef TC int -INT1AReturnCode (union REGS regs) +INT1AReturnCode(union REGS regs) { - if (regs.x.cflag) { - /*printf("Error to find pci device!\n"); */ - return 1; - } + if (regs.x.cflag) + { + /*printf("Error to find pci device!\n"); */ + return 1; + } + + switch(regs.h.ah) + { + case 0: return 0; + break; + case 0x81: printf("Function not support\n"); + break; + case 0x83: printf("bad vendor id\n"); + break; + case 0x86: printf("device not found\n"); + break; + case 0x87: printf("bad register number\n"); + break; + case 0x88: printf("set failed\n"); + break; + case 0x89: printf("buffer too small"); + break; + } + return 1; +} + +unsigned +FindPCIIOBase(unsigned index,unsigned deviceid) +{ + union REGS regs; + + regs.h.ah = 0xb1; /*PCI_FUNCTION_ID */ + regs.h.al = 0x02; /*FIND_PCI_DEVICE */ + regs.x.cx = deviceid; + regs.x.dx = 0x1039; + regs.x.si = index; /* find n-th device */ + + int86(0x1A, ®s, ®s); + + if (INT1AReturnCode(regs)!=0) + return 0; + + /* regs.h.bh *//* bus number */ + /* regs.h.bl *//* device number */ + regs.h.ah = 0xb1; /*PCI_FUNCTION_ID */ + regs.h.al = 0x09; /*READ_CONFIG_WORD */ + regs.x.cx = deviceid; + regs.x.dx = 0x1039; + regs.x.di = 0x18; /* register number */ + int86(0x1A, ®s, ®s); + + if (INT1AReturnCode(regs)!=0) + return 0; + return regs.x.cx; +} + + +void +main(int argc, char *argv[]) +{ + SIS_HW_DEVICE_INFO HwDeviceExtension; + USHORT temp; + USHORT ModeNo; + + /*HwDeviceExtension.pjVirtualRomBase =(PUCHAR) MK_FP(0xC000,0); */ + /*HwDeviceExtension.pjVideoMemoryAddress = (PUCHAR)MK_FP(0xA000,0);*/ + +#ifdef SIS300 + HwDeviceExtension.ulIOAddress = (FindPCIIOBase(0,0x6300)&0xFF80) + 0x30; + HwDeviceExtension.jChipType = SIS_630; +#endif + +#ifdef SIS315H +// HwDeviceExtension.ulIOAddress = (FindPCIIOBase(0,0x5315)&0xFF80) + 0x30; +// HwDeviceExtension.jChipType = SIS_550; + HwDeviceExtension.ulIOAddress = (FindPCIIOBase(0,0x325)&0xFF80) + 0x30; + HwDeviceExtension.jChipType = SIS_315H; +#endif + + HwDeviceExtension.ujVBChipID = VB_CHIP_301; + strcpy(HwDeviceExtension.szVBIOSVer,"0.84"); + HwDeviceExtension.bSkipDramSizing = FALSE; + HwDeviceExtension.ulVideoMemorySize = 0; + if(argc==2) { + ModeNo=atoi(argv[1]); + } + else { + ModeNo=0x2e; + /*ModeNo=0x37; */ /* 1024x768x 4bpp */ + /*ModeNo=0x38; *//* 1024x768x 8bpp */ + /*ModeNo=0x4A; *//* 1024x768x 16bpp */ + /*ModeNo=0x47;*/ /* 800x600x 16bpp */ + } + /* SiSInit(&HwDeviceExtension);*/ + SiSSetMode(&HwDeviceExtension,ModeNo); +} +#endif /* TC END */ + +/* ================ LINUX XFREE86 ====================== */ + +#ifdef LINUX_XF86 +USHORT +SiS_CalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode) +{ + UShort i = (pScrn->bitsPerPixel+7)/8 - 1; + UShort ModeIndex = 0; + SISPtr pSiS = SISPTR(pScrn); + + switch(mode->HDisplay) + { + case 320: + if(mode->VDisplay == 480) { + ModeIndex = ModeIndex_320x480[i]; + } + break; + case 512: + if(mode->VDisplay == 384) { + ModeIndex = ModeIndex_512x384[i]; + } + break; + case 640: + if(mode->VDisplay == 480) { + ModeIndex = ModeIndex_640x480[i]; + } + break; + case 720: + if(mode->VDisplay == 480) { + ModeIndex = ModeIndex_720x480[i]; + } else if(mode->VDisplay == 576) { + ModeIndex = ModeIndex_720x576[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]; + } + } + break; + case 1024: + if(mode->VDisplay == 768) { + ModeIndex = ModeIndex_1024x768[i]; + } else if(pSiS->VGAEngine == SIS_315_VGA) { + if(mode->VDisplay == 576) { + ModeIndex = ModeIndex_1024x576[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]; + } + } else if (mode->VDisplay == 1024) { + ModeIndex = ModeIndex_1280x1024[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) { + if(mode->VDisplay == 1050) { + ModeIndex = ModeIndex_1400x1050[i]; + } + } + break; + case 1600: + if(mode->VDisplay == 1200) { + ModeIndex = ModeIndex_1600x1200[i]; + } + break; + case 1920: + if(mode->VDisplay == 1440) { + ModeIndex = ModeIndex_1920x1440[i]; + } + break; + case 2048: + if(pSiS->VGAEngine == SIS_315_VGA) { + if(mode->VDisplay == 1536) { + ModeIndex = ModeIndex_2048x1536[i]; + } + } + break; + } + + return(ModeIndex); +} + +USHORT +SiS_CheckCalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode, int VBFlags) +{ + UShort i = (pScrn->bitsPerPixel+7)/8 - 1; + UShort ModeIndex = 0; + SISPtr pSiS = SISPTR(pScrn); + + if(VBFlags & CRT2_LCD) { - switch (regs.h.ah) { - case 0: - return 0; + if( (mode->HDisplay <= pSiS->LCDwidth) && + (mode->VDisplay <= pSiS->LCDheight) ) { + + if(VBFlags & VB_LVDS) { /* LCD on LVDS */ + + switch(mode->HDisplay) + { + case 512: + if(mode->VDisplay == 384) { + ModeIndex = ModeIndex_512x384[i]; + } break; - case 0x81: - printf ("Function not support\n"); + case 640: + if(mode->VDisplay == 480) { + ModeIndex = ModeIndex_640x480[i]; + } break; - case 0x83: - printf ("bad vendor id\n"); + case 800: + if(mode->VDisplay == 600) { + ModeIndex = ModeIndex_800x600[i]; + } break; - case 0x86: - printf ("device not found\n"); + 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 0x87: - printf ("bad register number\n"); + case 1152: + if(pSiS->VGAEngine == SIS_300_VGA) { + if(mode->VDisplay == 768) { + ModeIndex = ModeIndex_1152x768[i]; + } + } break; - case 0x88: - printf ("set failed\n"); + case 1280: + if(mode->VDisplay == 1024) { + ModeIndex = ModeIndex_1280x1024[i]; + } else if(pSiS->VGAEngine == SIS_315_VGA) { + if(mode->VDisplay == 768) { + ModeIndex = ModeIndex_1280x768[i]; + } + } break; - case 0x89: - printf ("buffer too small"); + case 1400: + if(mode->VDisplay == 1050) { + if(pSiS->VGAEngine == SIS_315_VGA) { + ModeIndex = ModeIndex_1400x1050[i]; + } + } break; - } - return 1; -} + } -unsigned -FindPCIIOBase (unsigned index, unsigned deviceid) -{ - union REGS regs; + } else { /* LCD on 301(B) */ + + switch(mode->HDisplay) + { + case 512: + if(mode->VDisplay == 384) { + ModeIndex = ModeIndex_512x384[i]; + } + break; + case 640: + if(mode->VDisplay == 480) { + ModeIndex = ModeIndex_640x480[i]; + } + break; + case 800: + if(mode->VDisplay == 600) { + ModeIndex = ModeIndex_800x600[i]; + } + break; + 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]; + } + } else if (mode->VDisplay == 1024) { + ModeIndex = ModeIndex_1280x1024[i]; + } + case 1600: + if(mode->VDisplay == 1200) { + ModeIndex = ModeIndex_1600x1200[i]; + } + break; + } - regs.h.ah = 0xb1; /*PCI_FUNCTION_ID */ - regs.h.al = 0x02; /*FIND_PCI_DEVICE */ - regs.x.cx = deviceid; - regs.x.dx = 0x1039; - regs.x.si = index; /* find n-th device */ + } - int86 (0x1A, ®s, ®s); + } - if (INT1AReturnCode (regs) != 0) - return 0; + } else if(VBFlags & CRT2_TV) { -/* regs.h.bh *//* bus number */ -/* regs.h.bl *//* device number */ - regs.h.ah = 0xb1; /*PCI_FUNCTION_ID */ - regs.h.al = 0x09; /*READ_CONFIG_WORD */ - regs.x.cx = deviceid; - regs.x.dx = 0x1039; - regs.x.di = 0x18; /* register number */ - int86 (0x1A, ®s, ®s); + if(VBFlags & VB_CHRONTEL) { /* TV on Chrontel */ - if (INT1AReturnCode (regs) != 0) - return 0; - return regs.x.cx; + switch(mode->HDisplay) + { + case 512: + if(mode->VDisplay == 384) { + ModeIndex = ModeIndex_512x384[i]; + } + break; + case 640: + if(mode->VDisplay == 480) { + ModeIndex = ModeIndex_640x480[i]; + } + break; + case 800: + if(mode->VDisplay == 600) { + ModeIndex = ModeIndex_800x600[i]; + } + break; + case 1024: + if(mode->VDisplay == 768) { + if(pSiS->VGAEngine == SIS_315_VGA) { + ModeIndex = ModeIndex_1024x768[i]; + } + } + break; + } + + } else { /* TV on 301(B) */ + + switch(mode->HDisplay) + { + case 512: + if(mode->VDisplay == 384) { + ModeIndex = ModeIndex_512x384[i]; + } + break; + case 640: + if(mode->VDisplay == 480) { + ModeIndex = ModeIndex_640x480[i]; + } + break; + case 720: + if(mode->VDisplay == 480) { + ModeIndex = ModeIndex_720x480[i]; + } else if(mode->VDisplay == 576) { + ModeIndex = ModeIndex_720x576[i]; + } + break; + case 800: + if(mode->VDisplay == 600) { + ModeIndex = ModeIndex_800x600[i]; + } + break; + case 1024: + if(mode->VDisplay == 768) { + if(VBFlags & (VB_301B|VB_301LV|VB_302B|VB_302LV)) { + ModeIndex = ModeIndex_1024x768[i]; + } + } + break; + } + + } + + } else if(VBFlags & CRT2_VGA) { /* CRT2 is VGA2 */ + + switch(mode->HDisplay) + { + case 512: + if(mode->VDisplay == 384) { + ModeIndex = ModeIndex_512x384[i]; + } + break; + case 640: + if(mode->VDisplay == 480) { + ModeIndex = ModeIndex_640x480[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]; + } + } + break; + case 1024: + if(mode->VDisplay == 768) { + ModeIndex = ModeIndex_1024x768[i]; + } else if(pSiS->VGAEngine == SIS_315_VGA) { + if(mode->VDisplay == 576) { + ModeIndex = ModeIndex_1024x576[i]; + } + } + break; + case 1152: + if(pSiS->VGAEngine == SIS_300_VGA) { + if(mode->VDisplay == 768) { + ModeIndex = ModeIndex_1152x768[i]; + } + } + break; + case 1280: + if (mode->VDisplay == 1024) { + ModeIndex = ModeIndex_1280x1024[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]; + } + break; + } + + } else { /* CRT1 only, no CRT2 */ + + ModeIndex = SiS_CalcModeIndex(pScrn, mode); + + } + + return(ModeIndex); } -void -main (int argc, char *argv[]) -/* void main() */ +#define MODEID_OFF 0x449 + +unsigned char +SiS_GetSetModeID(ScrnInfoPtr pScrn, unsigned char id) { - SIS_HW_DEVICE_INFO HwDeviceExtension; - USHORT temp; - USHORT ModeNo; + unsigned char ret; - /*HwDeviceExtension.pjVirtualRomBase =(PUCHAR) MK_FP(0xC000,0); */ - /*HwDeviceExtension.pjVideoMemoryAddress = (PUCHAR)MK_FP(0xA000,0); */ -#ifdef CONFIG_FB_SIS_300 - HwDeviceExtension.ulIOAddress = - (FindPCIIOBase (0, 0x6300) & 0xFF80) + 0x30; - HwDeviceExtension.jChipType = SIS_630; -#endif + unsigned char* base = xf86MapVidMem(pScrn->scrnIndex, + VIDMEM_MMIO, 0, 0x2000); + ret = *(base + MODEID_OFF); -#ifdef CONFIG_FB_SIS_315 -// HwDeviceExtension.ulIOAddress = (FindPCIIOBase(0,0x5315)&0xFF80) + 0x30; -// HwDeviceExtension.jChipType = SIS_550; - HwDeviceExtension.ulIOAddress = - (FindPCIIOBase (0, 0x325) & 0xFF80) + 0x30; - HwDeviceExtension.jChipType = SIS_315H; -#endif - HwDeviceExtension.ujVBChipID = VB_CHIP_301; - strcpy (HwDeviceExtension.szVBIOSVer, "0.84"); - HwDeviceExtension.bSkipDramSizing = FALSE; - HwDeviceExtension.ulVideoMemorySize = 0; - if (argc == 2) { - ModeNo = atoi (argv[1]); - } else { - ModeNo = 0x2e; - /*ModeNo=0x37; 1024x768x 4bpp */ - /*ModeNo=0x38; 1024x768x 8bpp */ - /*ModeNo=0x4A; 1024x768x 16bpp */ - /*ModeNo=0x47; 800x600x 16bpp */ - } - // SiSInit(&HwDeviceExtension); - SiSSetMode (&HwDeviceExtension, ModeNo); + /* id != 0xff means: set mode */ + if (id != 0xff) + *(base + MODEID_OFF) = id; + xf86UnMapVidMem(pScrn->scrnIndex,base,0x2000); + return ret; } + #endif + + + diff --git a/drivers/video/sis/init.h b/drivers/video/sis/init.h index 724df4d5d87f..05a2123a6c96 100644 --- a/drivers/video/sis/init.h +++ b/drivers/video/sis/init.h @@ -6,222 +6,328 @@ #include "vgatypes.h" #include "vstruct.h" +#ifdef TC +#include <stdio.h> +#include <string.h> +#include <conio.h> +#include <dos.h> +#include <stdlib.h> +#endif + +#ifdef LINUX_XF86 +#include "xf86.h" +#include "xf86Pci.h" +#include "xf86PciInfo.h" +#include "xf86_OSproc.h" +#include "sis.h" +#include "sis_regs.h" +#endif + +#ifdef LINUX_KERNEL #include <linux/types.h> #include <asm/io.h> #include <linux/sisfb.h> +#endif +#ifdef WIN2000 +#include <stdio.h> +#include <string.h> +#include <miniport.h> +#include "dderror.h" +#include "devioctl.h" +#include "miniport.h" +#include "ntddvdeo.h" +#include "video.h" +#include "sisv.h" +#include "tools.h" +#endif -USHORT SiS_DRAMType[17][5] = { - {0x0C, 0x0A, 0x02, 0x40, 0x39}, - {0x0D, 0x0A, 0x01, 0x40, 0x48}, - {0x0C, 0x09, 0x02, 0x20, 0x35}, - {0x0D, 0x09, 0x01, 0x20, 0x44}, - {0x0C, 0x08, 0x02, 0x10, 0x31}, - {0x0D, 0x08, 0x01, 0x10, 0x40}, - {0x0C, 0x0A, 0x01, 0x20, 0x34}, - {0x0C, 0x09, 0x01, 0x08, 0x32}, - {0x0B, 0x08, 0x02, 0x08, 0x21}, - {0x0C, 0x08, 0x01, 0x08, 0x30}, - {0x0A, 0x08, 0x02, 0x04, 0x11}, - {0x0B, 0x0A, 0x01, 0x10, 0x28}, - {0x09, 0x08, 0x02, 0x02, 0x01}, - {0x0B, 0x09, 0x01, 0x08, 0x24}, - {0x0B, 0x08, 0x01, 0x04, 0x20}, - {0x0A, 0x08, 0x01, 0x02, 0x10}, - {0x09, 0x08, 0x01, 0x01, 0x00} +USHORT SiS_DRAMType[17][5]={ + {0x0C,0x0A,0x02,0x40,0x39}, + {0x0D,0x0A,0x01,0x40,0x48}, + {0x0C,0x09,0x02,0x20,0x35}, + {0x0D,0x09,0x01,0x20,0x44}, + {0x0C,0x08,0x02,0x10,0x31}, + {0x0D,0x08,0x01,0x10,0x40}, + {0x0C,0x0A,0x01,0x20,0x34}, + {0x0C,0x09,0x01,0x08,0x32}, + {0x0B,0x08,0x02,0x08,0x21}, + {0x0C,0x08,0x01,0x08,0x30}, + {0x0A,0x08,0x02,0x04,0x11}, + {0x0B,0x0A,0x01,0x10,0x28}, + {0x09,0x08,0x02,0x02,0x01}, + {0x0B,0x09,0x01,0x08,0x24}, + {0x0B,0x08,0x01,0x04,0x20}, + {0x0A,0x08,0x01,0x02,0x10}, + {0x09,0x08,0x01,0x01,0x00} }; -USHORT SiS_SDRDRAM_TYPE[13][5] = { - {2, 12, 9, 64, 0x35}, - {1, 13, 9, 64, 0x44}, - {2, 12, 8, 32, 0x31}, - {2, 11, 9, 32, 0x25}, - {1, 12, 9, 32, 0x34}, - {1, 13, 8, 32, 0x40}, - {2, 11, 8, 16, 0x21}, - {1, 12, 8, 16, 0x30}, - {1, 11, 9, 16, 0x24}, - {1, 11, 8, 8, 0x20}, - {2, 9, 8, 4, 0x01}, - {1, 10, 8, 4, 0x10}, - {1, 9, 8, 2, 0x00} +USHORT SiS_SDRDRAM_TYPE[13][5] = +{ + { 2,12, 9,64,0x35}, + { 1,13, 9,64,0x44}, + { 2,12, 8,32,0x31}, + { 2,11, 9,32,0x25}, + { 1,12, 9,32,0x34}, + { 1,13, 8,32,0x40}, + { 2,11, 8,16,0x21}, + { 1,12, 8,16,0x30}, + { 1,11, 9,16,0x24}, + { 1,11, 8, 8,0x20}, + { 2, 9, 8, 4,0x01}, + { 1,10, 8, 4,0x10}, + { 1, 9, 8, 2,0x00} }; -USHORT SiS_DDRDRAM_TYPE[4][5] = { - {2, 12, 9, 64, 0x35}, - {2, 12, 8, 32, 0x31}, - {2, 11, 8, 16, 0x21}, - {2, 9, 8, 4, 0x01} +USHORT SiS_DDRDRAM_TYPE[4][5] = +{ + { 2,12, 9,64,0x35}, + { 2,12, 8,32,0x31}, + { 2,11, 8,16,0x21}, + { 2, 9, 8, 4,0x01} }; UCHAR SiS_ChannelAB, SiS_DataBusWidth; -USHORT SiS_MDA_DAC[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, - 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, - 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, - 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, - 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F +USHORT SiS_MDA_DAC[] = +{ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F }; -USHORT SiS_CGA_DAC[] = { - 0x00, 0x10, 0x04, 0x14, 0x01, 0x11, 0x09, 0x15, - 0x00, 0x10, 0x04, 0x14, 0x01, 0x11, 0x09, 0x15, - 0x2A, 0x3A, 0x2E, 0x3E, 0x2B, 0x3B, 0x2F, 0x3F, - 0x2A, 0x3A, 0x2E, 0x3E, 0x2B, 0x3B, 0x2F, 0x3F, - 0x00, 0x10, 0x04, 0x14, 0x01, 0x11, 0x09, 0x15, - 0x00, 0x10, 0x04, 0x14, 0x01, 0x11, 0x09, 0x15, - 0x2A, 0x3A, 0x2E, 0x3E, 0x2B, 0x3B, 0x2F, 0x3F, - 0x2A, 0x3A, 0x2E, 0x3E, 0x2B, 0x3B, 0x2F, 0x3F +USHORT SiS_CGA_DAC[] = +{ + 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, + 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, + 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, + 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, + 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, + 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, + 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, + 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F }; -USHORT SiS_EGA_DAC[] = { - 0x00, 0x10, 0x04, 0x14, 0x01, 0x11, 0x05, 0x15, - 0x20, 0x30, 0x24, 0x34, 0x21, 0x31, 0x25, 0x35, - 0x08, 0x18, 0x0C, 0x1C, 0x09, 0x19, 0x0D, 0x1D, - 0x28, 0x38, 0x2C, 0x3C, 0x29, 0x39, 0x2D, 0x3D, - 0x02, 0x12, 0x06, 0x16, 0x03, 0x13, 0x07, 0x17, - 0x22, 0x32, 0x26, 0x36, 0x23, 0x33, 0x27, 0x37, - 0x0A, 0x1A, 0x0E, 0x1E, 0x0B, 0x1B, 0x0F, 0x1F, - 0x2A, 0x3A, 0x2E, 0x3E, 0x2B, 0x3B, 0x2F, 0x3F +USHORT SiS_EGA_DAC[] = +{ + 0x00,0x10,0x04,0x14,0x01,0x11,0x05,0x15, + 0x20,0x30,0x24,0x34,0x21,0x31,0x25,0x35, + 0x08,0x18,0x0C,0x1C,0x09,0x19,0x0D,0x1D, + 0x28,0x38,0x2C,0x3C,0x29,0x39,0x2D,0x3D, + 0x02,0x12,0x06,0x16,0x03,0x13,0x07,0x17, + 0x22,0x32,0x26,0x36,0x23,0x33,0x27,0x37, + 0x0A,0x1A,0x0E,0x1E,0x0B,0x1B,0x0F,0x1F, + 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F }; -USHORT SiS_VGA_DAC[] = { - 0x00, 0x10, 0x04, 0x14, 0x01, 0x11, 0x09, 0x15, - 0x2A, 0x3A, 0x2E, 0x3E, 0x2B, 0x3B, 0x2F, 0x3F, - 0x00, 0x05, 0x08, 0x0B, 0x0E, 0x11, 0x14, 0x18, - 0x1C, 0x20, 0x24, 0x28, 0x2D, 0x32, 0x38, 0x3F, - - 0x00, 0x10, 0x1F, 0x2F, 0x3F, 0x1F, 0x27, 0x2F, - 0x37, 0x3F, 0x2D, 0x31, 0x36, 0x3A, 0x3F, 0x00, - 0x07, 0x0E, 0x15, 0x1C, 0x0E, 0x11, 0x15, 0x18, - 0x1C, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x00, 0x04, - 0x08, 0x0C, 0x10, 0x08, 0x0A, 0x0C, 0x0E, 0x10, - 0x0B, 0x0C, 0x0D, 0x0F, 0x10 +USHORT SiS_VGA_DAC[] = +{ + 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, + 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, + 0x00,0x05,0x08,0x0B,0x0E,0x11,0x14,0x18, + 0x1C,0x20,0x24,0x28,0x2D,0x32,0x38,0x3F, + 0x00,0x10,0x1F,0x2F,0x3F,0x1F,0x27,0x2F, + 0x37,0x3F,0x2D,0x31,0x36,0x3A,0x3F,0x00, + 0x07,0x0E,0x15,0x1C,0x0E,0x11,0x15,0x18, + 0x1C,0x14,0x16,0x18,0x1A,0x1C,0x00,0x04, + 0x08,0x0C,0x10,0x08,0x0A,0x0C,0x0E,0x10, + 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; /*0: no clear frame buffer 1:clear frame buffer */ -int SiS_RAMType; /*int ModeIDOffset,StandTable,CRT1Table,ScreenOffset,REFIndex; */ -USHORT SiS_ModeType; -USHORT SiS_IF_DEF_LVDS, SiS_IF_DEF_TRUMPION, SiS_IF_DEF_DSTN; /*add for dstn */ -USHORT SiS_IF_DEF_CH7005, SiS_IF_DEF_HiVision; -USHORT SiS_VBInfo, SiS_LCDResInfo, SiS_LCDTypeInfo, SiS_LCDInfo, SiS_VBType; /*301b */ -USHORT SiS_SelectCRT2Rate; - -extern USHORT SiS_SetFlag; - -void SiS_SetMemoryClock (ULONG ROMAddr); -void SiS_SetDRAMModeRegister (ULONG ROMAddr); -void SiS_SetDRAMSize_310 (PSIS_HW_DEVICE_INFO); -void SiS_SetDRAMSize_300 (PSIS_HW_DEVICE_INFO HwDeviceExtension); -USHORT SiS_ChkBUSWidth_300 (ULONG FBAddress); -UCHAR SiS_Get310DRAMType (ULONG ROMAddr); - -void SiS_Delay15us (ULONG); -BOOLEAN SiS_SearchModeID (ULONG ROMAddr, USHORT ModeNo, USHORT * ModeIdIndex); -BOOLEAN SiS_CheckMemorySize (ULONG ROMAddr, - PSIS_HW_DEVICE_INFO HwDeviceExtension, - USHORT ModeNo, USHORT ModeIdIndex); -UCHAR SiS_GetModePtr (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex); -void SiS_SetSeqRegs (ULONG, USHORT StandTableIndex); -void SiS_SetMiscRegs (ULONG, USHORT StandTableIndex); -void SiS_SetCRTCRegs (ULONG, PSIS_HW_DEVICE_INFO HwDeviceExtension, - USHORT StandTableIndex); -void SiS_SetATTRegs (ULONG, USHORT StandTableIndex); -void SiS_SetGRCRegs (ULONG, USHORT StandTableIndex); -void SiS_ClearExt1Regs (void); -void SiS_SetSync (ULONG ROMAddr, USHORT RefreshRateTableIndex); -void SiS_SetCRT1CRTC (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex); -void SiS_SetCRT1VCLK (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - PSIS_HW_DEVICE_INFO, USHORT RefreshRateTableIndex); -void SiS_SetVCLKState (ULONG ROMAddr, PSIS_HW_DEVICE_INFO, USHORT ModeNo, - USHORT RefreshRateTableIndex); -void SiS_LoadDAC (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex); -void SiS_DisplayOn (void); -void SiS_SetCRT1ModeRegs (ULONG ROMAddr, PSIS_HW_DEVICE_INFO, USHORT ModeNo, - USHORT ModeIdIndex, USHORT RefreshRateTableIndex); -void SiS_WriteDAC (USHORT, USHORT, USHORT, USHORT); -void SiS_GetVBType (USHORT BaseAddr); /*301b */ -USHORT SiS_ChkBUSWidth (ULONG); -USHORT SiS_GetModeIDLength (ULONG, USHORT); -USHORT SiS_GetRefindexLength (ULONG, USHORT); -void SiS_SetInterlace (ULONG ROMAddr, USHORT ModeNo, - USHORT RefreshRateTableIndex); -USHORT SiS_CalcDelay2 (ULONG, UCHAR); -USHORT SiS_CalcDelay (ULONG, USHORT); -void SiS_Set_LVDS_TRUMPION (PSIS_HW_DEVICE_INFO HwDeviceExtension); -void SiS_SetCRT1Offset (ULONG, USHORT, USHORT, USHORT, PSIS_HW_DEVICE_INFO); -void SiS_SetCRT1FIFO (ULONG, USHORT, PSIS_HW_DEVICE_INFO); -void SiS_SetCRT1FIFO2 (ULONG, USHORT ModeNo, PSIS_HW_DEVICE_INFO, - USHORT RefreshRateTableIndex); -void SiS_CRT2AutoThreshold (USHORT BaseAddr); -void SiS_ClearBuffer (PSIS_HW_DEVICE_INFO, USHORT ModeNo); -void SiS_SetCRT1Group (ULONG ROMAddr, PSIS_HW_DEVICE_INFO HwDeviceExtension, - USHORT ModeNo, USHORT ModeIdIndex); -void SiS_DetectMonitor (PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr); -void SiS_GetSenseStatus (PSIS_HW_DEVICE_INFO HwDeviceExtension, ULONG 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); - -extern BOOLEAN SiS_SetCRT2Group301 (USHORT BaseAddr, ULONG ROMAddr, - USHORT ModeNo, - PSIS_HW_DEVICE_INFO HwDeviceExtension); -extern void SiS_PresetScratchregister (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, ULONG ROMAddr); -extern USHORT SiS_GetVCLKLen (ULONG ROMAddr, - PSIS_HW_DEVICE_INFO HwDeviceExtension); -extern BOOLEAN SiS_SetCRT2Group302 (USHORT BaseAddr, ULONG ROMAddr, - USHORT ModeNo, - PSIS_HW_DEVICE_INFO HwDeviceExtension); -extern void SiS_GetVBInfo301 (USHORT BaseAddr, ULONG ROMAddr, USHORT ModeNo, - USHORT ModeIdIndex, - PSIS_HW_DEVICE_INFO HwDeviceExtension); -extern BOOLEAN SiS_GetLCDResInfo301 (ULONG ROMAddr, USHORT P3d4, USHORT ModeNo, - USHORT ModeIdIndex); -extern USHORT SiS_VBInfo, LCDResInfo, LCDTypeInfo, LCDInfo; -extern USHORT SiS_GetRatePtrCRT2 (ULONG ROMAddr, USHORT ModeNo, - USHORT ModeIdIndex); -extern void SiS_LongWait (VOID); -extern void SiS_SetRegANDOR (USHORT Port, USHORT Index, USHORT DataAND, - USHORT DataOR); -extern USHORT SiS_GetResInfo (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex); -extern void SiS_SetCH7005 (USHORT tempax); -extern USHORT SiS_GetCH7005 (USHORT tempax); -extern BOOLEAN SiS_GetLVDSCRT1Ptr (ULONG ROMAddr, USHORT ModeNo, - USHORT ModeIdIndex, - USHORT RefreshRateTableIndex, - USHORT * ResInfo, USHORT * DisplayType); -extern BOOLEAN SiS_GetLCDACRT1Ptr (ULONG ROMAddr, USHORT ModeNo, - USHORT ModeIdIndex, - USHORT RefreshRateTableIndex, - USHORT * ResInfo, USHORT * DisplayType); -extern USHORT SiS_GetVCLK2Ptr (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex, - PSIS_HW_DEVICE_INFO HwDeviceExtension); -extern BOOLEAN SiS_Is301B (USHORT BaseAddr); /*301b */ +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_SetReg3(USHORT, USHORT); +void SiS_SetReg4(USHORT, ULONG); +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); + +#ifdef SIS300 +void InitTo300Pointer(PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_SetDRAMSize_300(PSIS_HW_DEVICE_INFO HwDeviceExtension); +USHORT SiS_ChkBUSWidth_300(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, + 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, + 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); +#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, + 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, + USHORT StandTableIndex); +void SiS_SetATTRegs(UCHAR *ROMAddr,USHORT StandTableIndex,USHORT ModeNo, + 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, + 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, + USHORT RefreshRateTableIndex); +void SiS_SetVCLKState(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, + 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); +#ifdef SIS315H +void SiS_SetCRT1FIFO_310(UCHAR *ROMAddr,USHORT,USHORT,PSIS_HW_DEVICE_INFO); +#endif +#ifdef SIS300 +void SiS_SetCRT1FIFO_300(UCHAR *ROMAddr,USHORT ModeNo,PSIS_HW_DEVICE_INFO, + USHORT RefreshRateTableIndex); +#endif +void SiS_ClearBuffer(PSIS_HW_DEVICE_INFO,USHORT ModeNo); +void SiS_SetCRT1Group(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); +#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); +unsigned char SiS_GetSetModeID(ScrnInfoPtr pScrn, unsigned char id); #endif + +extern USHORT SiS_GetOffset(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, + PSIS_HW_DEVICE_INFO HwDeviceExtension); +extern void SiS_PresetScratchregister(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_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, + USHORT RefreshRateTableIndex, + USHORT *ResInfo,USHORT *DisplayType); +extern USHORT SiS_GetVCLK2Ptr(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); + +#endif + diff --git a/drivers/video/sis/init301.c b/drivers/video/sis/init301.c index c05c563a736c..be0c95defa5b 100644 --- a/drivers/video/sis/init301.c +++ b/drivers/video/sis/init301.c @@ -1,5416 +1,7708 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c,v 1.3 2000/12/02 01:16:16 dawes Exp $ */ +/* $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 + * (Universal module for Linux kernel framebuffer, XFree86 4.x) + * + * Assembler-To-C translation + * Parts Copyright 2002 by Thomas Winischhofer <thomas@winischhofer.net> + * + * Based on BIOS + * 1.10.07, 1.10a for SiS650/LVDS+CH7019 + * 1.07.1b for SiS650/301(B/LV) + * 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 + * 1.09b for 315/301(B) + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of the copyright holder not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. The copyright holder makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + */ #include "init301.h" -#ifdef CONFIG_FB_SIS_300 + +#if 0 +#define TWPANEL +#endif + +#if 0 /* TW: Emulate 650/LVDS BIOS 1.10a (1) or 1.10.07 (0) */ +#define TEST1400 +#endif + +#ifdef SIS300 #include "oem300.h" #endif -#ifdef CONFIG_FB_SIS_315 + +#ifdef SIS315H #include "oem310.h" #endif +#define SiS_I2CDELAY 1000 +#define SiS_I2CDELAYSHORT 333 + BOOLEAN -SiS_SetCRT2Group301 (USHORT BaseAddr, ULONG ROMAddr, USHORT ModeNo, - PSIS_HW_DEVICE_INFO HwDeviceExtension) +SiS_SetCRT2Group301(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo, + PSIS_HW_DEVICE_INFO HwDeviceExtension) { - USHORT ModeIdIndex; - USHORT RefreshRateTableIndex; - - SiS_SetFlag = SiS_SetFlag | ProgrammingCRT2; - SiS_SearchModeID (ROMAddr, ModeNo, &ModeIdIndex); - SiS_SelectCRT2Rate = 4; - RefreshRateTableIndex = - SiS_GetRatePtrCRT2 (ROMAddr, ModeNo, ModeIdIndex); - SiS_SaveCRT2Info (ModeNo); - SiS_DisableBridge (HwDeviceExtension, BaseAddr); - SiS_UnLockCRT2 (HwDeviceExtension, BaseAddr); - SiS_SetCRT2ModeRegs (BaseAddr, ModeNo, HwDeviceExtension); - if (SiS_VBInfo & DisableCRT2Display) { - SiS_LockCRT2 (HwDeviceExtension, BaseAddr); - SiS_DisplayOn (); - return (FALSE); - } -/* SetDefCRT2ExtRegs(BaseAddr); */ - SiS_GetCRT2Data (ROMAddr, ModeNo, ModeIdIndex, RefreshRateTableIndex); - /*301b */ - if (((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B)) - && (SiS_VBInfo & SetCRT2ToLCDA)) { - SiS_GetLVDSDesData (ROMAddr, ModeNo, ModeIdIndex, - RefreshRateTableIndex); - } - /*end 301b */ - if (SiS_IF_DEF_LVDS == 1) { - SiS_GetLVDSDesData (ROMAddr, ModeNo, ModeIdIndex, - RefreshRateTableIndex); - } + USHORT ModeIdIndex; + USHORT RefreshRateTableIndex; - SiS_SetGroup1 (BaseAddr, ROMAddr, ModeNo, ModeIdIndex, - HwDeviceExtension, RefreshRateTableIndex); - /*301b */ - if (((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B)) - && (SiS_VBInfo & SetCRT2ToLCDA) && (SiS_IF_DEF_LVDS == 0)) { - } else if (SiS_IF_DEF_LVDS == 0 && (!(SiS_VBInfo & SetCRT2ToLCDA))) { - 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); - } else { - if (SiS_IF_DEF_CH7005 == 1) { - SiS_SetCHTVReg (ROMAddr, ModeNo, ModeIdIndex, - RefreshRateTableIndex); - } - SiS_ModCRT1CRTC (ROMAddr, ModeNo, ModeIdIndex, - RefreshRateTableIndex); - SiS_SetCRT2ECLK (ROMAddr, ModeNo, ModeIdIndex, - RefreshRateTableIndex, HwDeviceExtension); - } + SiS_SetFlag |= ProgrammingCRT2; -#ifdef CONFIG_FB_SIS_300 - if ((HwDeviceExtension->jChipType == SIS_540) || - (HwDeviceExtension->jChipType == SIS_630) || - (HwDeviceExtension->jChipType == SIS_730) || - (HwDeviceExtension->jChipType == SIS_300)) - SiS_OEM300Setting (HwDeviceExtension, BaseAddr, ROMAddr, - ModeNo); + SiS_SearchModeID(ROMAddr,&ModeNo,&ModeIdIndex); + /* TW: Used for shifting CR33 */ + SiS_SelectCRT2Rate = 4; + + SiS_UnLockCRT2(HwDeviceExtension, BaseAddr); + + RefreshRateTableIndex = SiS_GetRatePtrCRT2(ROMAddr,ModeNo,ModeIdIndex); + + SiS_SaveCRT2Info(ModeNo); + + if(SiS_LowModeStuff(ModeNo,HwDeviceExtension)) { + SiS_DisableBridge(HwDeviceExtension,BaseAddr); + SiS_SetCRT2ModeRegs(BaseAddr,ModeNo,ModeIdIndex,HwDeviceExtension); + } + + if(SiS_VBInfo & DisableCRT2Display) { + SiS_LockCRT2(HwDeviceExtension, BaseAddr); + SiS_DisplayOn(); + return(FALSE); + } + + SiS_GetCRT2Data(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, + HwDeviceExtension); + } + + if(SiS_LowModeStuff(ModeNo,HwDeviceExtension)) { + SiS_SetGroup1(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, + RefreshRateTableIndex,HwDeviceExtension); + } + SiS_SetCRT2ECLK(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_IF_DEF_FSTN == 0) { + SiS_SetCRT2ECLK(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, + RefreshRateTableIndex); + } + } + } + + } + +#ifdef SIS300 + 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); + } + } #endif -#ifdef CONFIG_FB_SIS_315 - if ((HwDeviceExtension->jChipType == SIS_315H) || /* 05/02/01 ynlai for sis550 */ - (HwDeviceExtension->jChipType == SIS_315PRO) || - (HwDeviceExtension->jChipType == SIS_550) || /* 05/02/01 ynlai for 550 */ - (HwDeviceExtension->jChipType == SIS_640) || /* 08/20/01 chiawen for 640/740 */ - (HwDeviceExtension->jChipType == SIS_740)) { /* 09/03/01 chiawen for 640/740 */ - SiS_OEM310Setting (HwDeviceExtension, BaseAddr, ROMAddr, ModeNo, - ModeIdIndex); - SiS_CRT2AutoThreshold (BaseAddr); - } +#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(SiS_LowModeStuff(ModeNo,HwDeviceExtension)) { + SiS_OEMLCD(HwDeviceExtension,BaseAddr,ROMAddr,ModeNo,ModeIdIndex); + SiS_OEM310Setting(HwDeviceExtension,BaseAddr,ROMAddr,ModeNo,ModeIdIndex); + SiS_CRT2AutoThreshold(BaseAddr); + } + } #endif - SiS_EnableBridge (HwDeviceExtension, BaseAddr); - SiS_DisplayOn (); - SiS_LockCRT2 (HwDeviceExtension, BaseAddr); - return 1; + if(SiS_LowModeStuff(ModeNo,HwDeviceExtension)) { + SiS_DisplayOn(); + SiS_EnableBridge(HwDeviceExtension,BaseAddr); + } + + if(SiS_IF_DEF_CH70xx == 1) { + if(SiS_VBInfo & SetCRT2ToTV) { + /* TW: Disable LCD panel when using TV */ + SiS_SetRegOR(SiS_P3c4,0x11,0x0C); + } else { + /* TW: Disable TV when using LCD */ + SiS_SetCH70xxANDOR(0x010E,0xF8); + } + } + + SiS_DisplayOn(); + + if(SiS_LowModeStuff(ModeNo,HwDeviceExtension)) { + SiS_LockCRT2(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) +{ + 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) { + if(temp2 == 0x55) return(0); + else return(1); + } else { + if(temp2 != 0x55) return(1); + else { + SiS_SetRegOR(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, ULONG ROMAddr, USHORT ModeNo, - USHORT ModeIdIndex, PSIS_HW_DEVICE_INFO HwDeviceExtension, - USHORT RefreshRateTableIndex) +SiS_SetGroup1(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT RefreshRateTableIndex) { - USHORT temp = 0, tempax = 0, tempbx = 0, tempcx = 0; - USHORT pushbx = 0, CRT1Index = 0; - USHORT modeflag, resinfo = 0; + USHORT temp=0,tempax=0,tempbx=0,tempcx=0,tempbl=0; + USHORT pushbx=0,CRT1Index=0; + USHORT modeflag,resinfo=0; - if (ModeNo <= 0x13) { - } else { - CRT1Index = SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; - CRT1Index = CRT1Index & 0x3F; - resinfo = SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; - } + if(ModeNo<=0x13) { + modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + } else { + CRT1Index = SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; + resinfo = SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; + modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + } - /*301b */ - if (((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B)) - && (SiS_VBInfo & SetCRT2ToLCDA)) { - } else { - SiS_SetCRT2Offset (SiS_Part1Port, ROMAddr, ModeNo, ModeIdIndex, - RefreshRateTableIndex, HwDeviceExtension); - if (HwDeviceExtension->jChipType < SIS_315H) /* 300 series */ - SiS_SetCRT2FIFO (SiS_Part1Port, ROMAddr, ModeNo, - HwDeviceExtension); - else /* 310 series */ - SiS_SetCRT2FIFO2 (SiS_Part1Port, ROMAddr, ModeNo, - HwDeviceExtension); - - SiS_SetCRT2Sync (BaseAddr, ROMAddr, ModeNo, - RefreshRateTableIndex); - } - if (ModeNo <= 0x13) { - modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; - } else { - modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - } - /*301b */ - if (((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B)) - && (SiS_VBInfo & SetCRT2ToLCDA)) { - SiS_SetGroup1_LCDA (BaseAddr, ROMAddr, ModeNo, ModeIdIndex, - HwDeviceExtension, RefreshRateTableIndex); - } - /*end 301b */ - else if (HwDeviceExtension->jChipType < SIS_315H) { /* 300 series */ - temp = (SiS_VGAHT - 1) & 0x0FF; /* BTVGA2HT 0x08,0x09 */ - SiS_SetReg1 (SiS_Part1Port, 0x08, temp); - temp = (((SiS_VGAHT - 1) & 0xFF00) >> 8) << 4; - SiS_SetRegANDOR (SiS_Part1Port, 0x09, ~0x0F0, temp); - - temp = (SiS_VGAHDE + 12) & 0x0FF; /* BTVGA2HDEE 0x0A,0x0C */ - SiS_SetReg1 (SiS_Part1Port, 0x0A, temp); - - pushbx = SiS_VGAHDE + 12; /* bx BTVGA@HRS 0x0B,0x0C */ - tempcx = (SiS_VGAHT - SiS_VGAHDE) >> 2; /* cx */ - tempbx = pushbx + tempcx; - tempcx = tempcx << 1; - tempcx = tempcx + tempbx; - - if (SiS_IF_DEF_LVDS == 0) { - if (SiS_VBInfo & SetCRT2ToRAMDAC) { - tempbx = SiS_CRT1Table[CRT1Index].CR[4]; - tempbx = - tempbx | - ((SiS_CRT1Table[CRT1Index].CR[14] & 0xC0) << - 2); - tempbx = (tempbx - 1) << 3; - tempcx = SiS_CRT1Table[CRT1Index].CR[5]; - tempcx = tempcx & 0x1F; - temp = SiS_CRT1Table[CRT1Index].CR[15]; - temp = (temp & 0x04) << (6 - 2); - tempcx = ((tempcx | temp) - 1) << 3; - } - } - /*add for hardware request */ - if ((SiS_VBInfo & SetCRT2ToTV) && (resinfo == 0x08)) { - if (SiS_VBInfo & SetPALTV) { - tempbx = 1040; - tempcx = 1042; - } else { - tempbx = 1040; - tempcx = 1042; - } - } - - temp = tempbx & 0x00FF; - SiS_SetReg1 (SiS_Part1Port, 0x0B, temp); - - } else { /* 310 series */ - - if (modeflag & HalfDCLK) { /* for low resolution mode */ - temp = (SiS_VGAHT / 2 - 1) & 0x0FF; /* BTVGA2HT 0x08,0x09 */ - SiS_SetReg1 (SiS_Part1Port, 0x08, temp); - temp = (((SiS_VGAHT / 2 - 1) & 0xFF00) >> 8) << 4; - SiS_SetRegANDOR (SiS_Part1Port, 0x09, ~0x0F0, temp); - temp = (SiS_VGAHDE / 2 + 16) & 0x0FF; /* BTVGA2HDEE 0x0A,0x0C */ - SiS_SetReg1 (SiS_Part1Port, 0x0A, temp); - - pushbx = SiS_VGAHDE / 2 + 16; - tempcx = ((SiS_VGAHT - SiS_VGAHDE) / 2) >> 2; /* cx */ - tempbx = pushbx + tempcx; /* bx BTVGA@HRS 0x0B,0x0C */ - tempcx = tempcx + tempbx; - - if (SiS_IF_DEF_LVDS == 0) { - if (SiS_VBInfo & SetCRT2ToRAMDAC) { - tempbx = SiS_CRT1Table[CRT1Index].CR[4]; - tempbx = - tempbx | - ((SiS_CRT1Table - [CRT1Index].CR[14] & 0xC0) << 2); - tempbx = (tempbx - 3) << 3; /*(VGAHRS-3)*8 */ - tempcx = SiS_CRT1Table[CRT1Index].CR[5]; - tempcx = tempcx & 0x1F; - temp = SiS_CRT1Table[CRT1Index].CR[15]; - temp = (temp & 0x04) << (5 - 2); /*VGAHRE D[5] */ - tempcx = ((tempcx | temp) - 3) << 3; /* (VGAHRE-3)*8 */ - } - } - tempbx += 4; - tempcx += 4; - if (tempcx > (SiS_VGAHT / 2)) - tempcx = SiS_VGAHT / 2; - temp = tempbx & 0x00FF; - SiS_SetReg1 (SiS_Part1Port, 0x0B, temp); + /* TW: Removed 301B301LV.. check here; LCDA exists with LVDS as well */ + if(SiS_VBInfo & SetCRT2ToLCDA) { - } else { - temp = (SiS_VGAHT - 1) & 0x0FF; /* BTVGA2HT 0x08,0x09 */ - SiS_SetReg1 (SiS_Part1Port, 0x08, temp); - temp = (((SiS_VGAHT - 1) & 0xFF00) >> 8) << 4; - SiS_SetRegANDOR (SiS_Part1Port, 0x09, ~0x0F0, temp); - temp = (SiS_VGAHDE + 16) & 0x0FF; /* BTVGA2HDEE 0x0A,0x0C */ - SiS_SetReg1 (SiS_Part1Port, 0x0A, temp); - - pushbx = SiS_VGAHDE + 16; - tempcx = (SiS_VGAHT - SiS_VGAHDE) >> 2; /* cx */ - tempbx = pushbx + tempcx; /* bx BTVGA@HRS 0x0B,0x0C */ - tempcx = tempcx + tempbx; - - if (SiS_IF_DEF_LVDS == 0) { - if (SiS_VBInfo & SetCRT2ToRAMDAC) { - tempbx = SiS_CRT1Table[CRT1Index].CR[4]; - tempbx = - tempbx | - ((SiS_CRT1Table - [CRT1Index].CR[14] & 0xC0) << 2); - tempbx = (tempbx - 3) << 3; /*(VGAHRS-3)*8 */ - tempcx = SiS_CRT1Table[CRT1Index].CR[5]; - tempcx = tempcx & 0x1F; - temp = SiS_CRT1Table[CRT1Index].CR[15]; - temp = (temp & 0x04) << (5 - 2); /*VGAHRE D[5] */ - tempcx = ((tempcx | temp) - 3) << 3; /* (VGAHRE-3)*8 */ - tempbx += 16; - tempcx += 16; + /* 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); + } - } - } - if (tempcx > SiS_VGAHT) - tempcx = SiS_VGAHT; - /*add for hardware request */ - if ((SiS_VBInfo & SetCRT2ToTV) && (resinfo == 0x08)) { - if (SiS_VBInfo & SetPALTV) { - tempbx = 1040; - tempcx = 1042; - } else { - tempbx = 1040; - tempcx = 1042; - } - } - temp = tempbx & 0x00FF; - SiS_SetReg1 (SiS_Part1Port, 0x0B, temp); - } + SiS_SetGroup1_LCDA(BaseAddr,ROMAddr,ModeNo,ModeIdIndex, + HwDeviceExtension,RefreshRateTableIndex); - } + } else { - tempax = (tempax & 0x00FF) | (tempbx & 0xFF00); - tempbx = pushbx; - tempbx = (tempbx & 0x00FF) | ((tempbx & 0xFF00) << 4); - tempax = tempax | (tempbx & 0xFF00); - temp = (tempax & 0xFF00) >> 8; - SiS_SetReg1 (SiS_Part1Port, 0x0C, temp); - temp = tempcx & 0x00FF; - SiS_SetReg1 (SiS_Part1Port, 0x0D, temp); - tempcx = (SiS_VGAVT - 1); - temp = tempcx & 0x00FF; - if (SiS_IF_DEF_CH7005 == 1) { - if (SiS_VBInfo & 0x0C) { - temp--; - } - } - SiS_SetReg1 (SiS_Part1Port, 0x0E, temp); - tempbx = SiS_VGAVDE - 1; - temp = tempbx & 0x00FF; - SiS_SetReg1 (SiS_Part1Port, 0x0F, temp); - temp = ((tempbx & 0xFF00) << 3) >> 8; - temp = temp | ((tempcx & 0xFF00) >> 8); - SiS_SetReg1 (SiS_Part1Port, 0x12, temp); - - tempax = SiS_VGAVDE; - tempbx = SiS_VGAVDE; - tempcx = SiS_VGAVT; - tempbx = (SiS_VGAVT + SiS_VGAVDE) >> 1; /* BTVGA2VRS 0x10,0x11 */ - tempcx = ((SiS_VGAVT - 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 (temp & 0x04) - tempbx = tempbx | 0x0100; - if (temp & 0x080) - tempbx = tempbx | 0x0200; - temp = SiS_CRT1Table[CRT1Index].CR[13]; - if (temp & 0x08) - tempbx = tempbx | 0x0400; - temp = SiS_CRT1Table[CRT1Index].CR[9]; - tempcx = (tempcx & 0xFF00) | (temp & 0x00FF); - } - } - temp = tempbx & 0x00FF; - SiS_SetReg1 (SiS_Part1Port, 0x10, temp); - temp = ((tempbx & 0xFF00) >> 8) << 4; - temp = ((tempcx & 0x000F) | (temp)); - SiS_SetReg1 (SiS_Part1Port, 0x11, temp); - if (SiS_IF_DEF_LVDS == 0) { - temp = 0x20; - if (SiS_LCDResInfo == Panel1280x1024) - temp = 0x20; - if (SiS_LCDResInfo == Panel1280x960) - temp = 0x24; - if (SiS_VBInfo & SetCRT2ToTV) - temp = 0x08; - if (SiS_VBInfo & SetCRT2ToHiVisionTV) { - if (SiS_VBInfo & SetInSlaveMode) - temp = 0x2c; - else - temp = 0x20; - } - } else { - temp = 0x20; - } - if (HwDeviceExtension->jChipType < SIS_315H) /* 300 series */ - SiS_SetRegANDOR (SiS_Part1Port, 0x13, ~0x03C, temp); - else { /* 310 series */ - - temp >>= 2; - temp = 0x11; /* ynlai 05/30/2001 for delay compenation */ - SiS_SetReg1 (SiS_Part1Port, 0x2D, temp); - /*SiS_SetRegANDOR(SiS_Part1Port,0x2D,~0x00F,temp); */ - SiS_SetRegAND (SiS_Part1Port, 0x13, 0xEF); /* BDirectLCD=0 for lcd ?? */ - tempax = 0; - - if (modeflag & DoubleScanMode) - tempax |= 0x80; - if (modeflag & HalfDCLK) - tempax |= 0x40; - SiS_SetRegANDOR (SiS_Part1Port, 0x2C, ~0x0C0, tempax); + if( (HwDeviceExtension->jChipType >= SIS_315H) && + (SiS_IF_DEF_LVDS == 1) && + (SiS_VBInfo & SetInSlaveMode)) { - } + SiS_SetCRT2Sync(BaseAddr,ROMAddr,ModeNo, + RefreshRateTableIndex,HwDeviceExtension); - if (SiS_IF_DEF_LVDS == 0) { /* 301 */ - SiS_SetGroup1_301 (BaseAddr, ROMAddr, ModeNo, ModeIdIndex, - HwDeviceExtension, RefreshRateTableIndex); - } else { /* LVDS */ - SiS_SetGroup1_LVDS (BaseAddr, ROMAddr, ModeNo, ModeIdIndex, - HwDeviceExtension, RefreshRateTableIndex); - } -} + } else { -void -SiS_SetGroup1_301 (USHORT BaseAddr, ULONG ROMAddr, USHORT ModeNo, - USHORT ModeIdIndex, PSIS_HW_DEVICE_INFO HwDeviceExtension, - USHORT RefreshRateTableIndex) -{ - USHORT push1, push2; - USHORT tempax, tempbx, tempcx, temp; - USHORT resinfo, modeflag; - USHORT CRT1Index; - - if (ModeNo <= 0x13) { - modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ - resinfo = SiS_SModeIDTable[ModeIdIndex].St_ResInfo; - } else { - modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */ - resinfo = SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; - CRT1Index = SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; - CRT1Index = CRT1Index & 0x3F; - } + SiS_SetCRT2Offset(SiS_Part1Port,ROMAddr,ModeNo,ModeIdIndex, + RefreshRateTableIndex,HwDeviceExtension); - if (!(SiS_VBInfo & SetInSlaveMode)) { - return; - } - tempax = 0xFFFF; - if (!(SiS_VBInfo & SetCRT2ToTV)) { - tempax = SiS_GetVGAHT2 (); - } - if (modeflag & Charx8Dot) - tempcx = 0x08; - else - tempcx = 0x09; - if (tempax >= SiS_VGAHT) { - tempax = SiS_VGAHT; - } - if (modeflag & HalfDCLK) { - tempax = tempax >> 1; - } - tempax = (tempax / tempcx) - 5; - tempbx = tempax; - temp = 0xFF; /* set MAX HT */ - SiS_SetReg1 (SiS_Part1Port, 0x03, temp); - - tempax = SiS_VGAHDE; /* 0x04 Horizontal Display End */ - if (modeflag & HalfDCLK) - tempax = tempax >> 1; - tempax = (tempax / tempcx) - 1; - tempbx = tempbx | ((tempax & 0x00FF) << 8); - temp = tempax & 0x00FF; - SiS_SetReg1 (SiS_Part1Port, 0x04, temp); - - temp = (tempbx & 0xFF00) >> 8; - if (SiS_VBInfo & SetCRT2ToTV) { - temp = temp + 2; - if (SiS_VBInfo & SetCRT2ToHiVisionTV) { - if (resinfo == 7) - temp = temp - 2; - } - } - SiS_SetReg1 (SiS_Part1Port, 0x05, temp); /* 0x05 Horizontal Display Start */ - SiS_SetReg1 (SiS_Part1Port, 0x06, 0x03); /* 0x06 Horizontal Blank end */ - /* 0x07 horizontal Retrace Start */ - if (SiS_VBInfo & SetCRT2ToHiVisionTV) { - temp = (tempbx & 0x00FF) - 1; - if (!(modeflag & HalfDCLK)) { - temp = temp - 6; - if (SiS_SetFlag & TVSimuMode) { - temp = temp - 4; - if (ModeNo > 0x13) - temp = temp - 10; - } - } - } else { - tempcx = tempbx & 0x00FF; - tempbx = (tempbx & 0xFF00) >> 8; - tempcx = (tempcx + tempbx) >> 1; - temp = (tempcx & 0x00FF) + 2; - if (SiS_VBInfo & SetCRT2ToTV) { - temp = temp - 1; - if (!(modeflag & HalfDCLK)) { - if ((modeflag & Charx8Dot)) { - temp = temp + 4; - if (SiS_VGAHDE >= 800) { - temp = temp - 6; - } - } - } - } else { - if (!(modeflag & HalfDCLK)) { - temp = temp - 4; - if (SiS_LCDResInfo != Panel1280x960) { - if (SiS_VGAHDE >= 800) { - temp = temp - 7; - if (SiS_ModeType == ModeEGA) { - if (SiS_VGAVDE == 1024) { - temp = - temp + 15; - if - (SiS_LCDResInfo - != - Panel1280x1024) - { - temp = - temp - + 7; - } - } - } - if (SiS_VGAHDE >= 1280) { - if (SiS_LCDResInfo != - Panel1280x960) { - if (SiS_LCDInfo - & - LCDNonExpanding) - { - temp = - temp - + - 28; - } - } - } - } - } - } - } + if (HwDeviceExtension->jChipType < SIS_315H ) { +#ifdef SIS300 + SiS_SetCRT2FIFO_300(ROMAddr,ModeNo,HwDeviceExtension); +#endif + } else { +#ifdef SIS315H + SiS_SetCRT2FIFO_310(ROMAddr,ModeNo,HwDeviceExtension); +#endif } - SiS_SetReg1 (SiS_Part1Port, 0x07, temp); /* 0x07 Horizontal Retrace Start */ - SiS_SetReg1 (SiS_Part1Port, 0x08, 0); /* 0x08 Horizontal Retrace End */ + SiS_SetCRT2Sync(BaseAddr,ROMAddr,ModeNo, + RefreshRateTableIndex,HwDeviceExtension); - 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); - } - } - } - } + /* 1. Horizontal setup */ - SiS_SetReg1 (SiS_Part1Port, 0x18, 0x03); /* 0x18 SR08 */ - SiS_SetRegANDOR (SiS_Part1Port, 0x19, 0xF0, 0x00); - SiS_SetReg1 (SiS_Part1Port, 0x09, 0xFF); /* 0x09 Set Max VT */ - - tempbx = SiS_VGAVT; - push1 = tempbx; - tempcx = 0x121; - tempbx = SiS_VGAVDE; /* 0x0E Virtical Display End */ - if (tempbx == 357) - tempbx = 350; - if (tempbx == 360) - tempbx = 350; - if (tempbx == 375) - tempbx = 350; - if (tempbx == 405) - tempbx = 400; - if (tempbx == 420) - tempbx = 400; - if (tempbx == 525) - tempbx = 480; - push2 = tempbx; - if (SiS_VBInfo & SetCRT2ToLCD) { - if (SiS_LCDResInfo == Panel1024x768) { - if (!(SiS_SetFlag & LCDVESATiming)) { - if (tempbx == 350) - tempbx = tempbx + 5; - if (tempbx == 480) - tempbx = tempbx + 5; - } - } - } - tempbx--; - temp = tempbx & 0x00FF; - tempbx--; - temp = tempbx & 0x00FF; - SiS_SetReg1 (SiS_Part1Port, 0x10, temp); /* 0x10 vertical Blank Start */ - tempbx = push2; - tempbx--; - temp = tempbx & 0x00FF; - SiS_SetReg1 (SiS_Part1Port, 0x0E, temp); - if (tempbx & 0x0100) { - tempcx = tempcx | 0x0002; - } - tempax = 0x000B; - if (modeflag & DoubleScanMode) { - tempax = tempax | 0x08000; - } - if (tempbx & 0x0200) { - tempcx = tempcx | 0x0040; - } + if (HwDeviceExtension->jChipType < SIS_315H ) { - temp = (tempax & 0xFF00) >> 8; - SiS_SetReg1 (SiS_Part1Port, 0x0B, temp); - if (tempbx & 0x0400) { - tempcx = tempcx | 0x0600; - } - SiS_SetReg1 (SiS_Part1Port, 0x11, 0x00); /* 0x11 Vertival Blank End */ + /* ------------- 300 series --------------*/ - tempax = push1; - tempax = tempax - tempbx; /* 0x0C Vertical Retrace Start */ - tempax = tempax >> 2; - push1 = tempax; /* push ax */ + temp = (SiS_VGAHT - 1) & 0x0FF; /* BTVGA2HT 0x08,0x09 */ + SiS_SetReg1(SiS_Part1Port,0x08,temp); /* TW: CRT2 Horizontal Total */ - if (resinfo != 0x09) { - tempax = tempax << 1; - tempbx = tempax + tempbx; - } - if (SiS_VBInfo & SetCRT2ToHiVisionTV) { - tempbx = tempbx - 10; + temp = (((SiS_VGAHT - 1) & 0xFF00) >> 8) << 4; + SiS_SetRegANDOR(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 */ + + pushbx = SiS_VGAHDE + 12; /* bx BTVGA@HRS 0x0B,0x0C */ + tempcx = (SiS_VGAHT - 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); + tempbx = (tempbx - 1) << 3; + tempcx = SiS_CRT1Table[CRT1Index].CR[5]; + tempcx &= 0x1F; + temp = SiS_CRT1Table[CRT1Index].CR[15]; + temp = (temp & 0x04) << (6-2); + tempcx = ((tempcx | temp) - 1) << 3; + } + + if((SiS_VBInfo & SetCRT2ToTV) && (resinfo == 0x08)){ + if(!(SiS_VBInfo & SetPALTV)){ + tempbx = 1040; + tempcx = 1042; + } + } + } + + temp = tempbx & 0x00FF; + SiS_SetReg1(SiS_Part1Port,0x0B,temp); /* TW: CRT2 Horizontal Retrace Start */ + + } 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 */ + + } else { /* for high resolution modes */ + + temp = (SiS_VGAHT - 1) & 0xFF; /* BTVGA2HT 0x08,0x09 */ + SiS_SetReg1(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_VGAHDE + 16) & 0xFF; /* BTVGA2HDEE 0x0A,0x0C */ + SiS_SetReg1(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; + + 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 */ + tempbx += 16; + tempcx += 16; + } + /* 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)){ + tempbx = 1040; + tempcx = 1042; + } + } + } + + temp = tempbx & 0x00FF; + SiS_SetReg1(SiS_Part1Port,0x0B,temp); /* TW: CRT2 Horizontal Retrace Start */ + + } /* halfdclk */ + + } /* 310 series */ + + /* TW: The following is done for all bridge/chip types/series */ + + tempax = tempbx & 0xFF00; + tempbx = pushbx; + tempbx = (tempbx & 0x00FF) | ((tempbx & 0xFF00) << 4); + tempax |= (tempbx & 0xFF00); + temp = (tempax & 0xFF00) >> 8; + SiS_SetReg1(SiS_Part1Port,0x0C,temp); /* TW: Overflow */ + + temp = tempcx & 0x00FF; + SiS_SetReg1(SiS_Part1Port,0x0D,temp); /* TW: CRT2 Horizontal Retrace End */ + + /* 2. Vertical setup */ + + tempcx = 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(HwDeviceExtension->jChipType < SIS_315H) { + if(SiS_IF_DEF_CH70xx != 0) { +#ifndef TWPANEL + if(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 */ + + tempbx = SiS_VGAVDE - 1; + temp = tempbx & 0x00FF; + SiS_SetReg1(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) */ + + /* TW: For 650/LVDS */ + if((HwDeviceExtension->jChipType >= SIS_315H) && (SiS_IF_DEF_LVDS == 1)) { + tempbx++; + tempax = tempbx; + tempcx++; + tempcx = tempcx - tempax; + tempcx >>= 2; + tempbx = tempbx + tempcx; + if(tempcx < 4) tempcx = 4; + tempcx >>= 2; + tempcx = tempcx + tempbx; + tempcx++; } else { - if (SiS_SetFlag & TVSimuMode) { - if (SiS_VBInfo & SetPALTV) { - tempbx = tempbx + 40; - } - } - } - tempax = push1; - tempax = tempax >> 2; - tempax++; - tempax = tempax + tempbx; - push1 = tempax; /* push ax */ - if ((SiS_VBInfo & SetPALTV)) { - if (tempbx <= 513) { - if (tempax >= 513) { - tempbx = 513; - } - } - } - temp = (tempbx & 0x00FF); - SiS_SetReg1 (SiS_Part1Port, 0x0C, temp); - tempbx--; - temp = tempbx & 0x00FF; - SiS_SetReg1 (SiS_Part1Port, 0x10, temp); - if (tempbx & 0x0100) { - tempcx = tempcx | 0x0008; - } - if (tempbx & 0x0200) { - SiS_SetRegANDOR (SiS_Part1Port, 0x0B, 0x0FF, 0x20); - } - tempbx++; - if (tempbx & 0x0100) { - tempcx = tempcx | 0x0004; - } - if (tempbx & 0x0200) { - tempcx = tempcx | 0x0080; - } - if (tempbx & 0x0400) { - tempcx = tempcx | 0x0C00; + /* 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 */ + } + + if(SiS_IF_DEF_LVDS == 0) { + if(SiS_VBInfo & SetCRT2ToRAMDAC){ + tempbx = SiS_CRT1Table[CRT1Index].CR[8]; + temp = SiS_CRT1Table[CRT1Index].CR[7]; + if(temp & 0x04) tempbx |= 0x0100; + if(temp & 0x80) tempbx |= 0x0200; + temp = SiS_CRT1Table[CRT1Index].CR[13]; + if(temp & 0x08) tempbx |= 0x0400; + temp = SiS_CRT1Table[CRT1Index].CR[9]; + tempcx = (tempcx & 0xFF00) | (temp & 0x00FF); + } + } + temp = tempbx & 0x00FF; + SiS_SetReg1(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" */ + + /* 3. Paneldelay */ + + if (HwDeviceExtension->jChipType < SIS_315H ) { + + /* ---------- 300 series -------------- */ + + if(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((ROMAddr) && (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]; + temp &= 0x3c; + } + } + if(HwDeviceExtension->pdc) { + temp = HwDeviceExtension->pdc & 0x3c; + } + } else { + temp = 0x20; + if(SiS_LCDResInfo == Panel640x480) temp = 0x04; + if(ROMAddr) { + if(ROMAddr[0x220] & 0x80) { + temp = ROMAddr[0x220] & 0x3c; + } + } + 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.) + */ + + } 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; + } else { + temp = 0x00; + if(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 */ + } + + 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) + */ + + tempax = 0; + if (modeflag & DoubleScanMode) tempax |= 0x80; + if (modeflag & HalfDCLK) tempax |= 0x40; + SiS_SetRegANDOR(SiS_Part1Port,0x2C,0x3f,tempax); + + } + + } /* Slavemode */ + + if(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)) { + + SiS_SetGroup1_LVDS(BaseAddr,ROMAddr,ModeNo,ModeIdIndex, + HwDeviceExtension,RefreshRateTableIndex); + + } else if(SiS_VBInfo & SetInSlaveMode) { /* Inserted (650/301 BIOS) */ + + SiS_SetGroup1_301(BaseAddr,ROMAddr,ModeNo,ModeIdIndex, + HwDeviceExtension,RefreshRateTableIndex); + } + + } else { + + if(HwDeviceExtension->jChipType < SIS_315H) { + SiS_SetGroup1_LVDS(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); + } } - tempbx = push1; /* pop ax */ - temp = tempbx & 0x00FF; - temp = temp & 0x0F; - SiS_SetReg1 (SiS_Part1Port, 0x0D, temp); /* 0x0D vertical Retrace End */ - if (tempbx & 0x0010) { - tempcx = tempcx | 0x2000; - } + } + } /* LCDA */ +} - temp = tempcx & 0x00FF; - SiS_SetReg1 (SiS_Part1Port, 0x0A, temp); /* 0x0A CR07 */ - temp = (tempcx & 0x0FF00) >> 8; - SiS_SetReg1 (SiS_Part1Port, 0x17, temp); /* 0x17 SR0A */ - tempax = modeflag; - temp = (tempax & 0xFF00) >> 8; - - temp = (temp >> 1) & 0x09; - SiS_SetReg1 (SiS_Part1Port, 0x16, temp); /* 0x16 SR01 */ - SiS_SetReg1 (SiS_Part1Port, 0x0F, 0); /* 0x0F CR14 */ - SiS_SetReg1 (SiS_Part1Port, 0x12, 0); /* 0x12 CR17 */ - if (SiS_LCDInfo & LCDRGB18Bit) - temp = 0x80; - else - temp = 0x00; - SiS_SetReg1 (SiS_Part1Port, 0x1A, temp); /* 0x1A SR0E */ - return; +/* TW: Checked against 650/301LV and 630/301B (II) BIOS */ +void +SiS_SetGroup1_301(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; + } else { + modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + resinfo = 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(); + + /* 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) { + modeflag |= Charx8Dot; + } + + if(modeflag & Charx8Dot) tempcx = 0x08; + else tempcx = 0x09; + + if(tempax >= SiS_VGAHT) tempax = SiS_VGAHT; + + if(modeflag & HalfDCLK) tempax >>= 1; + + tempax = (tempax / tempcx) - 5; + tempbx = tempax & 0xFF; + + temp = 0xFF; /* set MAX HT */ + SiS_SetReg1(SiS_Part1Port,0x03,temp); + + tempax = 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 = (tempbx & 0xFF00) >> 8; + if(SiS_VBInfo & SetCRT2ToTV){ + if(!(SiS_VBType & VB_SIS301BLV302BLV)) { /* TW: Inserted from 650/301, 630/301 BIOS */ + temp += 2; + } /* TW: Inserted from 650/301, 630/301 BIOS */ +#ifdef oldHV + if(SiS_VBInfo & SetCRT2ToHiVisionTV) { + if(resinfo == 7) temp -= 2; + } +#endif + } + SiS_SetReg1(SiS_Part1Port,0x05,temp); /* 0x05 Horizontal Display Start */ + + SiS_SetReg1(SiS_Part1Port,0x06,0x03); /* 0x06 Horizontal Blank end */ + +#ifdef oldHV + if(SiS_VBInfo & SetCRT2ToHiVisionTV) { + temp = (tempbx & 0x00FF) - 1; + if(!(modeflag & HalfDCLK)) { + temp -= 6; + if(SiS_SetFlag & TVSimuMode) { + temp -= 2; /* Modified according to 650/301 BIOS; was 4 */ + 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){ + 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(HwDeviceExtension->jChipType >= SIS_315H) { + if(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; + } + } + } + } + } + } +#ifdef oldHV + } +#endif + SiS_SetReg1(SiS_Part1Port,0x07,temp); /* 0x07 Horizontal Retrace Start */ + + SiS_SetReg1(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); + } + } + } + } + + SiS_SetReg1(SiS_Part1Port,0x18,0x03); /* 0x18 SR08 */ + + SiS_SetRegANDOR(SiS_Part1Port,0x19,0xF0,0x00); + + SiS_SetReg1(SiS_Part1Port,0x09,0xFF); /* 0x09 Set Max VT */ + + tempbx = SiS_VGAVT; + push1 = tempbx; + tempcx = 0x121; + tempbx = SiS_VGAVDE; /* 0x0E Vertical Display End */ + if(tempbx == 357) tempbx = 350; + if(tempbx == 360) tempbx = 350; + if(tempbx == 375) tempbx = 350; + if(tempbx == 405) tempbx = 400; + 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(tempbx == 350) tempbx += 5; + if(tempbx == 480) tempbx += 5; + } + } + } + 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 = push2; + tempbx--; + temp = tempbx & 0x00FF; + SiS_SetReg1(SiS_Part1Port,0x0E,temp); + + if(tempbx & 0x0100) { + tempcx |= 0x0002; + if(SiS_VBType & VB_SIS301) tempcx |=0x000a; + } + + tempax = 0x000B; + if(modeflag & DoubleScanMode) tempax |= 0x8000; + + if(tempbx & 0x0200) { + tempcx |= 0x0040; + if(SiS_VBType & VB_SIS301) tempax |= 0x2000; + } + + if(SiS_VBType & VB_SIS301) { + if(SiS_VBInfo & SetPALTV) { + if(SiS_VGAVDE == 480) { + tempax = (tempax & 0x00ff) | 0x2000; + if(modeflag & DoubleScanMode) tempax |= 0x8000; + } + } + } + + temp = (tempax & 0xFF00) >> 8; + SiS_SetReg1(SiS_Part1Port,0x0B,temp); + + if(tempbx & 0x0400) tempcx |= 0x0600; + + SiS_SetReg1(SiS_Part1Port,0x11,0x00); /* 0x11 Vertical Blank End */ + + tempax = push1; + tempax -= tempbx; + tempax >>= 2; + push1 = tempax; + + if((resinfo != 0x09) || (SiS_VBType & VB_SIS301)) { + tempax <<= 1; + tempbx += tempax; + } +#ifdef oldHV + if(SiS_VBInfo & SetCRT2ToHiVisionTV) { + tempbx -= 10; + } else { +#endif + if(SiS_SetFlag & TVSimuMode) { + if(SiS_VBInfo & SetPALTV) { + if(!(SiS_HiVision & 0x03)) { + tempbx += 40; + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(SiS_VGAHDE == 800) tempbx += 10; + } + } + } + } +#ifdef oldHV + } +#endif + tempax = push1; + tempax >>= 2; + tempax++; + tempax += tempbx; + push1 = tempax; + if((SiS_VBInfo & SetPALTV)) { + if(tempbx <= 513) { + if(tempax >= 513) tempbx = 513; + } + } + temp = tempbx & 0x00FF; + SiS_SetReg1(SiS_Part1Port,0x0C,temp); /* 0x0C Vertical Retrace Start */ + + if(!(SiS_VBType & VB_SIS301)) { + tempbx--; + temp = tempbx & 0x00FF; + SiS_SetReg1(SiS_Part1Port,0x10,temp); + + if(tempbx & 0x0100) tempcx |= 0x0008; + + if(tempbx & 0x0200) + SiS_SetRegOR(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; + } + + tempbx = push1; + temp = tempbx & 0x00FF; + temp &= 0x0F; + SiS_SetReg1(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; + } + } + SiS_SetReg1(SiS_Part1Port,0x0A,temp); /* 0x0A CR07 */ + + temp = (tempcx & 0xFF00) >> 8; + SiS_SetReg1(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) { + temp |= 0x01; + } + SiS_SetReg1(SiS_Part1Port,0x16,temp); /* 0x16 SR01 */ + + SiS_SetReg1(SiS_Part1Port,0x0F,0x00); /* 0x0F CR14 */ + + SiS_SetReg1(SiS_Part1Port,0x12,0x00); /* 0x12 CR17 */ + + if(SiS_LCDInfo & LCDRGB18Bit) temp = 0x80; + else temp = 0x00; + SiS_SetReg1(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, ULONG ROMAddr, USHORT ModeNo, - USHORT ModeIdIndex, PSIS_HW_DEVICE_INFO HwDeviceExtension, - USHORT RefreshRateTableIndex) +SiS_SetGroup1_LVDS(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,pushcx; + ULONG tempeax=0,tempebx,tempecx,tempvcfact=0; + + if(ModeNo<=0x13) { + modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + resinfo = SiS_SModeIDTable[ModeIdIndex].St_ResInfo; + } else { + modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + resinfo = 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 - if (ModeNo <= 0x13) { - modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ - resinfo = SiS_SModeIDTable[ModeIdIndex].St_ResInfo; - } else { - modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */ - resinfo = SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; - } + /* TW: Set up Panel Link */ - tempax = SiS_LCDHDES; - tempbx = SiS_HDE; - tempcx = SiS_HT; - tempcx = tempcx - tempbx; /* HT-HDE */ - if (SiS_LCDInfo & LCDNonExpanding) { - if (SiS_LCDResInfo == Panel800x600) - tempbx = 800; - if (SiS_LCDResInfo == Panel1024x768) - tempbx = 1024; - } - push1 = tempax; - tempax = tempax + tempbx; /* lcdhdee */ - tempbx = SiS_HT; - if (tempax >= tempbx) { - tempax = tempax - tempbx; - } - push2 = tempax; - /* push ax lcdhdee */ - tempcx = tempcx >> 2; /* temp */ - tempcx = tempcx + tempax; /* lcdhrs */ - if (tempcx >= tempbx) { - tempcx = tempcx - tempbx; - } - /* v ah,cl */ - tempax = tempcx; - tempax = tempax >> 3; /* BPLHRS */ - temp = tempax & 0x00FF; - SiS_SetReg1 (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 */ - tempbx = push2; /* lcdhdee */ - tempcx = push1; /* lcdhdes */ - temp = (tempcx & 0x00FF); - temp = temp & 0x07; /* BPLHDESKEW */ - SiS_SetReg1 (SiS_Part1Port, 0x1A, temp); /* Part1_1Ah */ - tempcx = tempcx >> 3; /* BPLHDES */ - temp = (tempcx & 0x00FF); - SiS_SetReg1 (SiS_Part1Port, 0x16, temp); /* Part1_16h */ - if (tempbx & 0x07) - tempbx = tempbx + 8; - tempbx = 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_IF_DEF_CH7005 == 1) { - if (SiS_VBInfo & SetCRT2ToTV) { - tempax = SiS_VGAVDE; - } - } - if (SiS_VBInfo & SetCRT2ToLCD) { - if (SiS_LCDResInfo == Panel800x600) - tempax = 600; - if (SiS_LCDResInfo == Panel1024x768) - tempax = 768; - } - } else - tempax = SiS_VGAVDE; - tempbx = tempbx + tempax; - tempax = SiS_VT; /* VT */ - if (tempbx >= SiS_VT) { - tempbx = tempbx - tempax; - } - push2 = tempbx; /* push bx temppush2 */ - tempcx = tempcx >> 1; - tempbx = tempbx + tempcx; - tempbx++; /* BPLVRS */ - if (tempbx >= tempax) { - tempbx = tempbx - tempax; - } - temp = tempbx & 0x00FF; - SiS_SetReg1 (SiS_Part1Port, 0x18, temp); /* Part1_18h */ - tempcx = tempcx >> 3; - tempcx = tempcx + tempbx; - tempcx++; /* BPLVRE */ - temp = tempcx & 0x00FF; - temp = temp & 0x0F; - SiS_SetRegANDOR (SiS_Part1Port, 0x19, ~0x00F, temp); /* Part1_19h */ - temp = (tempbx & 0xFF00) >> 8; - temp = temp & 0x07; - temp = temp << 3; /* BPLDESKEW =0 */ - tempbx = SiS_VGAVDE; - if (tempbx != SiS_VDE) { - temp = temp | 0x40; - } - if (SiS_SetFlag & EnableLVDSDDA) { - temp = temp | 0x40; - } - if (SiS_LCDInfo & LCDRGB18Bit) { - temp = temp | 0x80; - } - SiS_SetRegANDOR (SiS_Part1Port, 0x1A, 0x07, temp); /* Part1_1Ah */ - - tempecx = SiS_VGAVT; - tempebx = SiS_VDE; - tempeax = SiS_VGAVDE; - tempecx = tempecx - tempeax; /* VGAVT-VGAVDE */ - tempeax = tempeax << 6; - temp = (USHORT) (tempeax % tempebx); - tempeax = tempeax / tempebx; - if (temp != 0) { - tempeax++; - } - tempebx = tempeax; /* BPLVCFACT */ - if (SiS_SetFlag & EnableLVDSDDA) { - tempebx = tempebx & 0x003F; - } - temp = (USHORT) (tempebx & 0x00FF); - SiS_SetReg1 (SiS_Part1Port, 0x1E, temp); /* Part1_1Eh */ - - /*add for 301b different 301 */ - if ((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B)) { - tempecx = SiS_VGAVT; - tempebx = SiS_VDE; - tempeax = SiS_VGAVDE; - tempecx = tempecx - tempeax; /* VGAVT-VGAVDE */ - tempeax = tempeax << 18; - temp = (USHORT) (tempeax % tempebx); - tempeax = tempeax / tempebx; - if (temp != 0) { - tempeax++; - } - tempebx = tempeax; /* BPLVCFACT */ - tempvcfact = tempeax; /*301b */ - temp = (USHORT) (tempebx & 0x00FF); - SiS_SetReg1 (SiS_Part1Port, 0x37, temp); - temp = (USHORT) ((tempebx & 0x00FF00) >> 8); - SiS_SetReg1 (SiS_Part1Port, 0x36, temp); - temp = (USHORT) ((tempebx & 0x00030000) >> 16); - if (SiS_VDE == SiS_VGAVDE) { - temp = temp | 0x04; - } + /* 1. Horizontal setup */ - SiS_SetReg1 (SiS_Part1Port, 0x35, temp); - } - /*end for 301b */ - - tempbx = push2; /* p bx temppush2 BPLVDEE */ - tempcx = push1; /* pop cx temppush1 NPLVDES */ - push1 = (USHORT) (tempeax & 0xFFFF); - if (!(SiS_VBInfo & SetInSlaveMode)) { - if (SiS_LCDResInfo == Panel800x600) { - if (resinfo == 7) - tempcx++; - } else { - if (SiS_LCDResInfo == Panel1024x768) { - if (resinfo == 8) - tempcx++; - } - } - } + tempax = SiS_LCDHDES; + /* TW: Inserted (650/LVDS,630/301B/LVDS) BIOS) */ + if((SiS_LCDResInfo == Panel640x480) && (!(SiS_VBInfo & SetInSlaveMode))) + tempax -= 8; - temp = (tempbx & 0xFF00) >> 8; - temp = temp & 0x07; - temp = temp << 3; - temp = temp | (((tempcx & 0xFF00) >> 8) & 0x07); - SiS_SetReg1 (SiS_Part1Port, 0x1D, temp); /* Part1_1Dh */ - temp = tempbx & 0x00FF; - SiS_SetReg1 (SiS_Part1Port, 0x1C, temp); /* Part1_1Ch */ - temp = tempcx & 0x00FF; - SiS_SetReg1 (SiS_Part1Port, 0x1B, temp); /* Part1_1Bh */ - - tempecx = SiS_VGAHDE; - tempebx = SiS_HDE; - tempeax = tempecx; - tempeax = tempeax << 6; - tempeax = tempeax << 10; - tempeax = tempeax / tempebx; - if (tempebx == tempecx) { - tempeax = 65535; - } - tempecx = tempeax; - tempeax = SiS_VGAHDE; /*change VGAHT->VGAHDE */ - tempeax = tempeax << 6; - tempeax = tempeax << 10; - tempeax = tempeax / tempecx; - tempecx = tempecx << 16; - tempeax = tempeax - 1; - tempecx = tempecx | (tempeax & 0x00FFFF); - temp = (USHORT) (tempecx & 0x00FF); - SiS_SetReg1 (SiS_Part1Port, 0x1F, temp); /* Part1_1Fh */ - - tempeax = SiS_VGAVDE; - tempeax = tempeax << 18; /*301b */ - tempeax = tempeax / tempvcfact; - tempbx = (USHORT) (tempeax & 0x0FFFF); - if (SiS_LCDResInfo == Panel1024x768) - tempbx--; - if (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 */ - temp = tempbx & 0x00FF; - SiS_SetReg1 (SiS_Part1Port, 0x21, temp); /* Part1_21h */ - tempecx = tempecx >> 16; /* BPLHCFACT */ - if (modeflag & HalfDCLK) { - tempecx = tempecx >> 1; - } - temp = (USHORT) ((tempecx & 0x0000FF00) >> 8); - SiS_SetReg1 (SiS_Part1Port, 0x22, temp); /* Part1_22h */ - temp = (USHORT) (tempecx & 0x000000FF); - SiS_SetReg1 (SiS_Part1Port, 0x23, temp); - /*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; /*Blps=lcdhdee(lcdhdes+HDE) +64 */ - tempbx = tempbx + 64; - temp = tempbx & 0x00FF; - SiS_SetReg1 (SiS_Part1Port, 0x38, temp); - temp = ((tempbx & 0xFF00) >> 8) << 3; - SiS_SetRegANDOR (SiS_Part1Port, 0x35, ~0x078, temp); - tempbx = tempbx + 32; /*Blpe=lBlps+32 */ - temp = tempbx & 0x00FF; - SiS_SetReg1 (SiS_Part1Port, 0x39, temp); - SiS_SetReg1 (SiS_Part1Port, 0x3A, 0x00); /*Bflml=0 */ - SiS_SetRegANDOR (SiS_Part1Port, 0x3C, ~0x007, 0x00); - tempbx = SiS_VDE; - tempbx = tempbx / 2; - temp = tempbx & 0x00FF; - SiS_SetReg1 (SiS_Part1Port, 0x3B, temp); - temp = ((tempbx & 0xFF00) >> 8) << 3; - SiS_SetRegANDOR (SiS_Part1Port, 0x3C, ~0x038, temp); - tempeax = SiS_HDE; /* BDxFIFOSTOP= (HDE*4)/128 */ - tempeax = tempeax * 4; - tempebx = 128; - temp = (USHORT) (tempeax % tempebx); - tempeax = tempeax / tempebx; - if (temp != 0) { - tempeax++; - } - temp = (USHORT) (tempeax & 0x0000003F); - 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; - tempax = tempax >> 4; /*BDxWadroff = HDE*4/8/8 */ - pushcx = tempax; - temp = tempax & 0x00FF; - SiS_SetReg1 (SiS_Part1Port, 0x43, temp); - temp = ((tempax & 0xFF00) >> 8) << 3; - SiS_SetRegANDOR (SiS_Part1Port, 0x44, ~0x0F8, temp); - tempax = SiS_VDE; /*BDxWadrst1 = BDxWadrst0+BDxWadroff*VDE */ - tempeax = (tempax * pushcx); - tempebx = 0x00100000 + tempeax; - temp = (USHORT) tempebx & 0x000000FF; - SiS_SetReg1 (SiS_Part1Port, 0x42, temp); - temp = (USHORT) ((tempebx & 0x0000FF00) >> 8); - SiS_SetReg1 (SiS_Part1Port, 0x41, temp); - temp = (USHORT) ((tempebx & 0x00FF0000) >> 16); - SiS_SetReg1 (SiS_Part1Port, 0x40, temp); - temp = (USHORT) ((tempebx & 0x01000000) >> 24); - temp = temp << 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); - SiS_SetReg1 (SiS_P3c4, 0x1e, 0x62); - SiS_SetReg1 (SiS_Part1Port, 0x19, 0x38); - SiS_SetReg1 (SiS_Part1Port, 0x1e, 0x7d); - } - /*end add dstn */ + tempcx = SiS_HT; /* Horiz. Total */ - return; -} + tempbx = SiS_HDE; /* Horiz. Display End */ -/*301b*/ -void -SiS_SetGroup1_LCDA (USHORT BaseAddr, ULONG 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; /*301b */ - SiS_SetRegOR (SiS_Part1Port, 0x2D, 0x20); - - if (ModeNo <= 0x13) { - modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ - resinfo = SiS_SModeIDTable[ModeIdIndex].St_ResInfo; - } else { - modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */ - resinfo = SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; - } + 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 */ + } + } + tempcx = (tempcx - tempbx) >> 2; /* HT-HDE / 4 */ - tempax = SiS_LCDHDES; - tempbx = SiS_HDE; - tempcx = SiS_HT; + push1 = tempax; - if (SiS_LCDInfo & LCDNonExpanding) { - if (SiS_LCDResInfo == Panel1280x1024) - tempbx = 1280; - if (SiS_LCDResInfo == Panel1024x768) - tempbx = 1024; - } - tempcx = 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 = tempcx >> 2; /* temp */ - tempcx = tempcx + tempax; /* lcdhrs */ - if (tempcx >= tempbx) { - tempcx = tempcx - tempbx; - } - /* v ah,cl */ - tempax = tempcx; - tempax = tempax >> 3; /* BPLHRS */ - temp = tempax & 0x00FF; - SiS_SetReg1 (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 */ - tempbx = push2; /* lcdhdee */ - tempcx = push1; /* lcdhdes */ - temp = (tempcx & 0x00FF); - temp = temp & 0x07; /* BPLHDESKEW */ - SiS_SetReg1 (SiS_Part1Port, 0x1A, temp); /* Part1_1Ah */ - tempcx = tempcx >> 3; /* BPLHDES */ - temp = (tempcx & 0x00FF); - SiS_SetReg1 (SiS_Part1Port, 0x16, temp); /* Part1_16h */ - if (tempbx & 0x07) - tempbx = tempbx + 8; - tempbx = 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_IF_DEF_CH7005 == 1) { - if (SiS_VBInfo & SetCRT2ToTV) { - tempax = SiS_VGAVDE; - } - } + tempax += tempbx; - if (SiS_LCDResInfo == Panel1024x768) - tempax = 768; - if (SiS_LCDResInfo == Panel1280x1024) - tempax = 1024; - - } else - tempax = SiS_VGAVDE; - tempbx = tempbx + tempax; - tempax = SiS_VT; /* VT */ - if (tempbx >= SiS_VT) { - tempbx = tempbx - tempax; - } - push2 = tempbx; /* push bx temppush2 */ - tempcx = tempcx >> 1; - tempbx = tempbx + tempcx; - tempbx++; /* BPLVRS */ - if (tempbx >= tempax) { - tempbx = tempbx - tempax; - } - temp = tempbx & 0x00FF; - SiS_SetReg1 (SiS_Part1Port, 0x18, temp); /* Part1_18h */ - tempcx = tempcx >> 3; - tempcx = tempcx + tempbx; - tempcx++; /* BPLVRE */ - temp = tempcx & 0x00FF; - temp = temp & 0x0F; - SiS_SetRegANDOR (SiS_Part1Port, 0x19, ~0x00F, temp); /* Part1_19h */ - temp = (tempbx & 0xFF00) >> 8; - temp = temp & 0x07; - temp = temp << 3; /* BPLDESKEW =0 */ - tempbx = SiS_VGAVDE; - if (tempbx != SiS_VDE) { - temp = temp | 0x40; - } - if (SiS_SetFlag & EnableLVDSDDA) { - temp = temp | 0x40; - } - if (SiS_LCDInfo & LCDRGB18Bit) { - temp = temp | 0x80; - } - SiS_SetRegANDOR (SiS_Part1Port, 0x1A, 0x07, temp); /* Part1_1Ah */ + if(tempax >= SiS_HT) tempax -= SiS_HT; - tempbx = push2; /* p bx temppush2 BPLVDEE */ - tempcx = push1; /* pop cx temppush1 NPLVDES */ - push1 = (USHORT) (tempeax & 0xFFFF); + push2 = tempax; - if (!(SiS_VBInfo & SetInSlaveMode)) { - if (SiS_LCDResInfo == Panel800x600) { - if (resinfo == 7) - tempcx++; + /* 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(HwDeviceExtension->jChipType < SIS_315H) { + if(SiS_IF_DEF_LVDS == 1) { + tempcx = 0x0017; +#ifdef TWPANEL + tempcx++; +#endif + } else { + tempcx = 0x0017; /* A901; other 301B BIOS 0x0018; */ + } } else { - if (SiS_LCDResInfo == Panel1024x768) { - if (resinfo == 8) - tempcx++; - } - } - } + tempcx = 0x0018; + } + } + else if(SiS_LCDResInfo != Panel640x480) tempcx = 0x0030; + } + } + + tempcx += tempax; /* lcdhrs */ + if(tempcx >= SiS_HT) tempcx -= SiS_HT; + + tempax = tempcx >> 3; /* BPLHRS */ + temp = tempax & 0x00FF; + SiS_SetReg1(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 + } + } + } + } + } + } + + 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 */ + + 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) */ + + 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(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 */ + } + 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 */ + + /* 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; + + } else { + + tempcx = SiS_VGAVT - SiS_VGAVDE; /* VGAVT-VGAVDE */ + + } + + tempbx = 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; + } + } + } + + tempbx = tempbx + tempax; + if(tempbx >= SiS_VT) tempbx -= SiS_VT; + + push2 = tempbx; /* push bx temppush */ + + 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(HwDeviceExtension->jChipType < SIS_315H) { + if(SiS_IF_DEF_LVDS == 1) { + tempcx = 0x0002; +#ifdef TWPANEL + tempcx++; +#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; + } + } - temp = (tempbx & 0xFF00) >> 8; - temp = temp & 0x07; - temp = temp << 3; - temp = temp | (((tempcx & 0xFF00) >> 8) & 0x07); - SiS_SetReg1 (SiS_Part1Port, 0x1D, temp); /* Part1_1Dh */ - temp = tempbx & 0x00FF; - SiS_SetReg1 (SiS_Part1Port, 0x1C, temp); /* Part1_1Ch */ - temp = tempcx & 0x00FF; - SiS_SetReg1 (SiS_Part1Port, 0x1B, temp); /* Part1_1Bh */ - - tempecx = SiS_VGAVT; - tempebx = SiS_VDE; - tempeax = SiS_VGAVDE; - tempecx = tempecx - tempeax; /* VGAVT-VGAVDE */ - tempeax = tempeax << 18; - temp = (USHORT) (tempeax % tempebx); - tempeax = tempeax / tempebx; - if (temp != 0) { - tempeax++; - } - tempebx = tempeax; /* BPLVCFACT */ - tempvcfact = tempeax; /*301b */ - temp = (USHORT) (tempebx & 0x00FF); - SiS_SetReg1 (SiS_Part1Port, 0x37, temp); - temp = (USHORT) ((tempebx & 0x00FF00) >> 8); - SiS_SetReg1 (SiS_Part1Port, 0x36, temp); - temp = (USHORT) ((tempebx & 0x00030000) >> 16); - if (SiS_VDE == SiS_VGAVDE) { - temp = temp | 0x04; - } + tempbx += tempcx; /* BPLVRS */ - SiS_SetReg1 (SiS_Part1Port, 0x35, temp); + if(HwDeviceExtension->jChipType < SIS_315H) { +#ifdef TWPANEL + if(SiS_IF_DEF_CH70xx == 0) +#endif + 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_VT) tempbx -= SiS_VT; + temp = tempbx & 0x00FF; + SiS_SetReg1(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( (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) { + if(HwDeviceExtension->jChipType < SIS_315H) { + if(SiS_IF_DEF_LVDS == 1) { + tempcx = 0x0004; +#ifdef TWPANEL + tempcx++; +#endif + } else { + tempcx = 0x0004; /* A901; Other BIOS sets 0x0005; */ + } + } else { + tempcx = 0x0005; + } + } + } + + 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. */ + + 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(HwDeviceExtension->jChipType >= SIS_315H) { + if(SiS_GetReg1(SiS_Part1Port,0x00) & 0x01) { /* TW: Inserted from 650/LVDS 1.10.07 */ + temp |= 0x80; + } + } else { + if( (HwDeviceExtension->jChipType == SIS_630) || + (HwDeviceExtension->jChipType == SIS_730) ) { + if(HwDeviceExtension->jChipRevision >= 0x30) { + temp |= 0x80; + } + } + } + } /* 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) */ + + if (HwDeviceExtension->jChipType < SIS_315H) { + + /* 300 series */ + + tempeax = SiS_VGAVDE << 6; + temp = (USHORT)(tempeax % (ULONG)SiS_VDE); + tempeax = tempeax / (ULONG)SiS_VDE; + if(temp != 0) tempeax++; + tempebx = tempeax; /* BPLVCFACT */ + + if(SiS_SetFlag & EnableLVDSDDA) { + tempebx = 0x003F; + } + + temp = (USHORT)(tempebx & 0x00FF); + SiS_SetReg1(SiS_Part1Port,0x1E,temp); /* Part1_1Eh; TW: Panel Link Vertical Scaling Factor */ + + } else { + + /* 310 series */ + + SiS_SetReg1(SiS_Part1Port,0x1E,0x23); /* Inserted from 650/LVDS BIOS */ + + tempeax = SiS_VGAVDE << 18; + temp = (USHORT)(tempeax % (ULONG)SiS_VDE); + tempeax = tempeax / 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 */ + temp = (USHORT)((tempebx & 0x00FF00) >> 8); + SiS_SetReg1(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 */ + + } + + tempbx = push2; /* p bx temppush1 BPLVDEE */ + tempcx = push1; + + push1 = temp; /* TW: For 630/301B and 630/LVDS */ + + 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 */ + } + } + } + /* TW: Inserted (650/LVDS, 630/LVDS, 630/301B) */ + if(SiS_LCDResInfo == Panel640x480) { + tempcx = SiS_VGAVDE; + tempbx = 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 */ + + temp = tempbx & 0x00FF; + if(SiS_IF_DEF_FSTN) temp++; + SiS_SetReg1(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 */ + + /* 3. Additional horizontal setup (scaling, etc) */ + + tempecx = SiS_VGAHDE; + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(modeflag & HalfDCLK) /* TW: Added this entire if statement */ + tempecx >>= 1; + } + tempebx = SiS_HDE; + if(tempecx == tempebx) tempeax = 0xFFFF; + else { + tempeax = tempecx; + tempeax <<= 16; + 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 */ + } + } + tempecx = tempeax; + + if (HwDeviceExtension->jChipType >= SIS_315H) { + tempeax = SiS_VGAHDE; + if(modeflag & HalfDCLK) /* TW: Added this entire if statement */ + tempeax >>= 1; + tempeax <<= 16; + tempeax = (tempeax / tempecx) - 1; + } else { + tempeax = ((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 */ + + tempbx = SiS_VDE; /* TW: added following if statement */ + if (HwDeviceExtension->jChipType >= SIS_315H) { + tempeax = (SiS_VGAVDE << 18) / tempvcfact; + tempbx = (USHORT)(tempeax & 0x0FFFF); + } else { + tempax = 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; + + temp = ((tempbx & 0xFF00) >> 8) << 3; + temp |= (USHORT)((tempecx & 0x0700) >> 8); + SiS_SetReg1(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 */ + + tempecx >>= 16; /* BPLHCFACT */ + if(HwDeviceExtension->jChipType < SIS_315H) { /* TW: Added this entire if statement from 630/301B+LVDS BIOSes */ + 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 */ + + temp = (USHORT)(tempecx & 0x00FF); + SiS_SetReg1(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*/ + temp = tempbx & 0x00FF; + SiS_SetReg1(SiS_Part1Port,0x38,temp); + temp=((tempbx & 0xFF00) >> 8) << 3; + SiS_SetRegANDOR(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; + temp = tempbx & 0x00FF; + SiS_SetReg1(SiS_Part1Port,0x3B,temp); + temp = ((tempbx & 0xFF00) >> 8) << 3; + SiS_SetRegANDOR(SiS_Part1Port,0x3C,~0x038,temp); + tempeax = 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 */ + pushcx = tempax; + temp = tempax & 0x00FF; + SiS_SetReg1(SiS_Part1Port,0x43,temp); + temp = ((tempax & 0xFF00) >> 8) << 3; + SiS_SetRegANDOR(SiS_Part1Port,0x44,~0x0F8,temp); + tempax = SiS_VDE; /*BDxWadrst1 = BDxWadrst0 + BDxWadroff * VDE */ + tempeax = (tempax * pushcx); + tempebx = 0x00100000 + tempeax; + temp = (USHORT)tempebx & 0x000000FF; + SiS_SetReg1(SiS_Part1Port,0x42,temp); + temp = (USHORT)((tempebx & 0x0000FF00)>>8); + SiS_SetReg1(SiS_Part1Port,0x41,temp); + temp = (USHORT)((tempebx & 0x00FF0000)>>16); + SiS_SetReg1(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_Part1Port,0x19,0x0f,0x30); + SiS_SetReg1(SiS_Part1Port,0x1e,0x7d); + SiS_SetReg1(SiS_Part1Port,0x2e,0xe0); + } + + return; - tempecx = SiS_VGAHDE; - tempebx = SiS_HDE; - tempeax = tempecx; - tempeax = tempeax << 6; - tempeax = tempeax << 10; - tempeax = tempeax / tempebx; - if (tempebx == tempecx) { - tempeax = 65535; - } - tempecx = tempeax; - tempeax = SiS_VGAHDE; /*301b to change HT->HDE */ - tempeax = tempeax << 6; - tempeax = tempeax << 10; - tempeax = tempeax / tempecx; - tempecx = tempecx << 16; - tempeax = tempeax - 1; - tempecx = tempecx | (tempeax & 0x00FFFF); - temp = (USHORT) (tempecx & 0x00FF); - SiS_SetReg1 (SiS_Part1Port, 0x1F, temp); /* Part1_1Fh */ - - tempeax = SiS_VGAVDE; - tempeax = tempeax << 18; /*301b */ - tempeax = tempeax / tempvcfact; - tempbx = (USHORT) (tempeax & 0x0FFFF); - if (SiS_LCDResInfo == Panel1024x768) - tempbx--; - if (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 */ - temp = tempbx & 0x00FF; - SiS_SetReg1 (SiS_Part1Port, 0x21, temp); /* Part1_21h */ - tempecx = tempecx >> 16; /* BPLHCFACT */ - - temp = (USHORT) ((tempecx & 0x0000FF00) >> 8); - SiS_SetReg1 (SiS_Part1Port, 0x22, temp); /* Part1_22h */ - temp = (USHORT) (tempecx & 0x000000FF); - SiS_SetReg1 (SiS_Part1Port, 0x23, temp); - return; } -/*end 301b*/ +#ifdef SIS315H void -SiS_SetTPData () +SiS_CRT2AutoThreshold(USHORT BaseAddr) { - return; + SiS_SetRegOR(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 */ void -SiS_SetCRT2Offset (USHORT SiS_Part1Port, ULONG ROMAddr, USHORT ModeNo, - USHORT ModeIdIndex, USHORT RefreshRateTableIndex, - PSIS_HW_DEVICE_INFO HwDeviceExtension) +SiS_SetGroup1_LCDA(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT RefreshRateTableIndex) { - USHORT offset; - UCHAR temp; + 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(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(ModeNo<=0x13) { + modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + resinfo = SiS_SModeIDTable[ModeIdIndex].St_ResInfo; + } else { + modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + resinfo = 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 */ + } + tempcx = 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; + /* v ah,cl */ + tempax = tempcx; + tempax = tempax >> 3; /* BPLHRS */ + temp = tempax & 0x00FF; + SiS_SetReg1(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 */ + + tempbx = push2; /* lcdhdee */ + tempcx = push1; /* lcdhdes */ + temp = (tempcx & 0x00FF); + temp = temp & 0x07; /* BPLHDESKEW */ + SiS_SetReg1(SiS_Part1Port,0x1A,temp); /* Part1_1Ah */ + + tempcx = tempcx >> 3; /* BPLHDES */ + temp = (tempcx & 0x00FF); + SiS_SetReg1(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; + + push2 = tempbx; /* push bx temppush2 */ + tempcx >>= 1; + tempbx = tempbx + tempcx; + tempbx++; /* BPLVRS */ + if(tempbx >= tempax) tempbx = tempbx - tempax; + temp = tempbx&0x00FF; + SiS_SetReg1(SiS_Part1Port,0x18,temp); /* Part1_18h */ + + tempcx >>= 3; + tempcx = 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 */ + } else { + temp |= 0x30; /* TW: Inserted from 650/301 BIOS */ + SiS_SetRegANDOR(SiS_Part1Port,0x19,0xC0,temp); /* Part1_19h (Was ~0x0f) */ + } + + 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 */ + } else { + SiS_SetRegANDOR(SiS_Part1Port,0x1A,0x07,temp); /* Part1_1Ah */ + } + + tempbx = push2; /* p bx temppush2 BPLVDEE */ + tempcx = push1; /* pop cx temppush1 NPLVDES */ + push1 = (USHORT)(tempeax & 0xFFFF); + + if(!(SiS_VBInfo & SetInSlaveMode)) { + if(SiS_LCDResInfo == 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 */ + } + } + + temp = (tempbx & 0xFF00) >> 8; + temp &= 0x07; + temp <<= 3; + temp = temp | (((tempcx & 0xFF00) >> 8) & 0x07); + SiS_SetReg1(SiS_Part1Port,0x1D,temp); /* Part1_1Dh */ + + temp = tempbx & 0x00FF; + SiS_SetReg1(SiS_Part1Port,0x1C,temp); /* Part1_1Ch */ + + temp = tempcx & 0x00FF; + SiS_SetReg1(SiS_Part1Port,0x1B,temp); /* Part1_1Bh */ + + tempecx = SiS_VGAVT; + tempebx = SiS_VDE; + tempeax = SiS_VGAVDE; + tempecx = tempecx-tempeax; /* VGAVT-VGAVDE */ + tempeax <<= 18; + temp = (USHORT)(tempeax % tempebx); + tempeax = tempeax / tempebx; + if(temp != 0) tempeax++; + tempebx = tempeax; /* BPLVCFACT */ + tempvcfact = tempeax; + temp=(USHORT)(tempebx & 0x00FF); + SiS_SetReg1(SiS_Part1Port,0x37,temp); + + temp=(USHORT)((tempebx & 0x00FF00) >> 8); + SiS_SetReg1(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; + tempeax = tempecx; + tempeax <<= 16; + tempeax = tempeax / tempebx; + if(tempebx == tempecx) tempeax = 0xFFFF; + tempecx = tempeax; + tempeax = 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 */ + + tempeax = SiS_VGAVDE; + tempeax <<= 18; + tempeax = tempeax / tempvcfact; + tempbx = (USHORT)(tempeax & 0x0FFFF); + + if(SiS_LCDResInfo == Panel1024x768) tempbx--; + + if(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 */ + + temp = tempbx & 0x00FF; + SiS_SetReg1(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 */ + + temp=(USHORT)(tempecx & 0x000000FF); + SiS_SetReg1(SiS_Part1Port,0x23,temp); + + /* 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); + } + + return; +} - if (SiS_VBInfo & SetInSlaveMode) { - return; - } - offset = - SiS_GetOffset (ROMAddr, ModeNo, ModeIdIndex, RefreshRateTableIndex, - HwDeviceExtension); - temp = (UCHAR) (offset & 0xFF); - SiS_SetReg1 (SiS_Part1Port, 0x07, temp); - temp = (UCHAR) ((offset & 0xFF00) >> 8); - SiS_SetReg1 (SiS_Part1Port, 0x09, temp); - temp = (UCHAR) (((offset >> 3) & 0xFF) + 1); - SiS_SetReg1 (SiS_Part1Port, 0x03, temp); +/* TW: Double-checked against 650/LVDS (1.10.07) and 650/301 BIOS */ +void SiS_SetCRT2Offset(USHORT SiS_Part1Port,UCHAR *ROMAddr,USHORT ModeNo, + USHORT ModeIdIndex ,USHORT RefreshRateTableIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT offset; + UCHAR temp; + + if(SiS_VBInfo & SetInSlaveMode) return; + + offset = SiS_GetOffset(ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex, + HwDeviceExtension); + temp = (UCHAR)(offset & 0xFF); + SiS_SetReg1(SiS_Part1Port,0x07,temp); + temp = (UCHAR)((offset & 0xFF00) >> 8); + SiS_SetReg1(SiS_Part1Port,0x09,temp); + temp = (UCHAR)(((offset >> 3) & 0xFF) + 1); + SiS_SetReg1(SiS_Part1Port,0x03,temp); } +/* TW: Checked with 650/LVDS and 650/301 BIOS */ USHORT -SiS_GetOffset (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex, - PSIS_HW_DEVICE_INFO HwDeviceExtension) +SiS_GetOffset(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension) { - USHORT temp, colordepth; - USHORT modeinfo, index, infoflag; - USHORT ColorDepth[] = { 0x01, 0x02, 0x04 }; + 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) { /* 300 series */ - index = (modeinfo >> 4) & 0xFF; - } else { /* 310 series */ + 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; + } 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! */ + } + +#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 + } +#endif - index = (modeinfo >> 8) & 0xFF; - } - temp = SiS_ScreenOffset[index]; - if (infoflag & InterlaceMode) { - temp = temp << 1; - } - colordepth = SiS_GetColorDepth (ROMAddr, ModeNo, ModeIdIndex); - - if ((ModeNo >= 0x7C) && (ModeNo <= 0x7E)) { - temp = ModeNo - 0x7C; - colordepth = ColorDepth[temp]; - temp = 0x6B; - if (infoflag & InterlaceMode) { - temp = temp << 1; - } - return (temp * colordepth); - } else - return (temp * colordepth); -} + if(infoflag & InterlaceMode) temp <<= 1; -USHORT -SiS_GetColorDepth (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex) -{ - USHORT ColorDepth[6] = { 1, 2, 4, 4, 6, 8 }; - SHORT index; - USHORT modeflag; + temp *= colordepth; - if (ModeNo <= 0x13) { - modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; - } else { - modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - } - index = (modeflag & ModeInfoFlag) - ModeEGA; - if (index < 0) - index = 0; - return (ColorDepth[index]); + /* TW: Added this entire "if"-section from 650/LVDS BIOS */ + if((ModeNo >= 0x26) && (ModeNo <= 0x28)) { + colordepth >>= 1; + temp += colordepth; + } + + return(temp); } -void -SiS_SetCRT2Sync (USHORT BaseAddr, ULONG ROMAddr, USHORT ModeNo, - USHORT RefreshRateTableIndex) +/* Checked with 650/LVDS BIOS */ +USHORT +SiS_GetColorDepth(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex) { - USHORT tempah = 0, infoflag, flag; - - flag = 0; - infoflag = SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag; - if (SiS_IF_DEF_LVDS == 1) { - if (SiS_VBInfo & SetCRT2ToLCD) { - tempah = SiS_LCDInfo; - if (tempah & LCDSync) { - flag = 1; - } - } - } - if (flag != 1) - tempah = infoflag >> 8; - tempah = tempah & 0xC0; - tempah = tempah | 0x20; - if (!(SiS_LCDInfo & LCDRGB18Bit)) - tempah = tempah | 0x10; - if (SiS_IF_DEF_CH7005 == 1) - tempah = tempah | 0xC0; - - SiS_SetRegANDOR (SiS_Part1Port, 0x19, 0x3F, tempah); + 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; + + 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_SetCRT2FIFO (USHORT SiS_Part1Port, ULONG ROMAddr, USHORT ModeNo, - PSIS_HW_DEVICE_INFO HwDeviceExtension) +SiS_SetCRT2Sync(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo, + USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension) { - USHORT temp, index; - USHORT modeidindex, refreshratetableindex; - USHORT VCLK, MCLK, colorth = 0, data, data2; - ULONG eax; - 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 */ - - SiS_SearchModeID (ROMAddr, ModeNo, &modeidindex); - SiS_SetFlag = SiS_SetFlag & (~ProgrammingCRT2); - SiS_SelectCRT2Rate = 0; - refreshratetableindex = SiS_GetRatePtrCRT2 (ROMAddr, ModeNo, modeidindex); /* 11.GetRatePtr */ - if (ModeNo >= 0x13) { - index = SiS_RefIndex[refreshratetableindex].Ext_CRTVCLK; - index = index & 0x3F; - VCLK = SiS_VCLKData[index].CLOCK; /* Get VCLK */ - index = SiS_GetReg1 (SiS_P3c4, 0x1A); - index = index & 07; - MCLK = SiS_MCLKData[index].CLOCK; /* Get MCLK */ - data2 = SiS_ModeType - 0x02; - switch (data2) { - 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; - } - data2 = (data2 * VCLK) / MCLK; /* bx */ - - temp = SiS_GetReg1 (SiS_P3c4, 0x14); - temp = ((temp & 0x00FF) >> 6) << 1; - if (temp == 0) - temp = 1; - temp = temp << 2; - - data2 = temp - data2; - if (data2 % (28 * 16)) { - data2 = data2 / (28 * 16); - data2++; - } else { - data2 = data2 / (28 * 16); - } + USHORT tempah=0,tempbl,infoflag,flag; + + flag = 0; + tempbl = 0xC0; /* TW: Severe BIOS bug in all BIOSes except 650/LVDS 1.10.07 */ + + infoflag = SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag; + + if(SiS_IF_DEF_LVDS == 1) { /* LVDS */ + if(SiS_VBInfo & SetCRT2ToLCD) { + tempah = SiS_LCDInfo; + if(HwDeviceExtension->jChipType >= SIS_315H) { + tempbl = tempah & 0xc0; + } + if(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; + } + } + } - index = 0; - temp = SiS_GetReg1 (SiS_P3c4, 0x14); - if (temp & 0x0080) - index = index + 12; - SiS_SetReg4 (0xcf8, 0x800000A0); - eax = SiS_GetReg3 (0xcfc); - temp = (USHORT) (eax >> 24); - if (!(temp & 0x01)) - index = index + 24; - - SiS_SetReg4 (0xcf8, 0x80000050); - eax = SiS_GetReg3 (0xcfc); - temp = (USHORT) (eax >> 24); - if (temp & 0x01) - index = index + 6; - temp = (temp & 0x0F) >> 1; - index = index + temp; - data = LatencyFactor[index]; - data = data + 15; - temp = SiS_GetReg1 (SiS_P3c4, 0x14); - if (!(temp & 0x80)) - data = data + 5; - data = data + data2; - - SiS_SetFlag = SiS_SetFlag | ProgrammingCRT2; - data = data * VCLK * colorth; - if (data % (MCLK << 4)) { - data = data / (MCLK << 4); - data++; - } else { - data = data / (MCLK << 4); - } - temp = 0x16; -/* Revision ID */ - temp = 0x13; -/* Revision ID */ - SiS_SetRegANDOR (SiS_Part1Port, 0x01, ~0x01F, temp); - SiS_SetRegANDOR (SiS_Part1Port, 0x02, ~0x01F, temp); - } + if(flag != 1) tempah = infoflag >> 8; + + tempah &= 0xC0; + tempah |= 0x20; + + if(!(SiS_LCDInfo & LCDRGB18Bit)) tempah |= 0x10; + + if (SiS_LCDResInfo == Panel640x480) { + /* TW: BIOS does something here (301, 301LV and LVDS) @@@ */ + } + + if(!(SiS_VBType & VB_SIS301)) { + tempah &= 0x3f; + tempah |= tempbl; + } + + SiS_SetRegANDOR(SiS_Part1Port,0x19,0x3F,tempah); } +/* TW: Set FIFO on 300 series */ +/* TW: Checked against 630/301B BIOS; does not set PCI registers */ void -SiS_SetCRT2FIFO2 (USHORT SiS_Part1Port, ULONG ROMAddr, USHORT ModeNo, - PSIS_HW_DEVICE_INFO HwDeviceExtension) +SiS_SetCRT2FIFO_300(UCHAR *ROMAddr,USHORT ModeNo, + PSIS_HW_DEVICE_INFO HwDeviceExtension) { -#ifdef CONFIG_FB_SIS_315 - UCHAR CombCode[] = { 1, 1, 1, 4, 3, 1, 3, 4, 4, 1, 4, 4, 5, 1, 5, 4 }; - UCHAR CRT2ThLow[] = - { 39, 63, 55, 79, 78, 102, 90, 114, 55, 87, 84, 116, 103, 135, 119, - 151 }; + USHORT temp,index; + USHORT modeidindex,refreshratetableindex; + USHORT VCLK,MCLK,colorth=0,data2; + ULONG data,eax; + 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 */ + + 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); + index &= 0x07; + MCLK = SiS_MCLKData_0[index].CLOCK; + data2 = SiS_ModeType - 0x02; + switch (data2) { + 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; + } + /* data2=(data2*VCLK)/MCLK; */ /* bx */ + data2 = (colorth * VCLK) / MCLK; /* TW */ + + temp = SiS_GetReg1(SiS_P3c4,0x14); + temp = ((temp&0x00FF)>>6)<<1; + if(temp == 0) temp=1; + temp <<= 2; + + data2 = temp - data2; + +/* if(data2%(28*16)) { TW: WRONG + data2=data2/(28*16); + data2++; + } else { + data2=data2/(28*16); + } */ + if((28*16) % data2) { /* TW */ + data2 = (28 * 16) / data2; + data2++; + } else { + data2 = (28 * 16) / data2; + } + + index = 0; + temp = SiS_GetReg1(SiS_P3c4,0x14); + if(temp & 0x0080) index += 12; + +#ifndef LINUX_XF86 + 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); #endif - USHORT temp, temp1, temp2, temp3; - USHORT index; - USHORT CRT1ModeNo, CRT2ModeNo; - USHORT ModeIdIndex; - USHORT RefreshRateTableIndex; - - SiS_SetReg1 (SiS_Part1Port, 0x1, 0x3B); -/* CRT1ModeNo=(UCHAR)SiS_GetReg1(SiS_P3d4,0x34); *//* get CRT1 ModeNo */ - CRT1ModeNo = SiS_CRT1Mode; - /* CRT1ModeNo =ModeNo; */ - SiS_SearchModeID (ROMAddr, CRT1ModeNo, &ModeIdIndex); /* Get ModeID Table */ - SiS_SetFlag = SiS_SetFlag & (~ProgrammingCRT2); - - RefreshRateTableIndex = SiS_GetRatePtrCRT2 (ROMAddr, CRT1ModeNo, ModeIdIndex); /* Set REFIndex-> for crt1 refreshrate */ - index = - SiS_GetVCLK2Ptr (ROMAddr, CRT1ModeNo, ModeIdIndex, - RefreshRateTableIndex, HwDeviceExtension); - temp1 = SiS_VCLKData[index].CLOCK; /* Get VCLK */ - - temp2 = SiS_GetColorDepth (ROMAddr, CRT1ModeNo, ModeIdIndex); -#ifdef CONFIG_FB_SIS_315 - index = SiS_Get310DRAMType (ROMAddr); -#endif - temp3 = SiS_MCLKData[index].CLOCK; /* Get MCLK */ - - temp = SiS_GetReg1 (SiS_P3c4, 0x14); - if (temp & 0x02) - temp = 16; - else - temp = 8; - - temp = temp - temp1 * temp2 / temp3; /* 16-DRamBus - DCLK*BytePerPixel/MCLK */ - - if ((52 * 16 % temp) == 0) - temp = 52 * 16 / temp + 40; - else - temp = 52 * 16 / temp + 40 + 1; - - /* get DRAM latency */ - temp1 = (SiS_GetReg1 (SiS_P3c4, 0x17) >> 3) & 0x7; /* SR17[5:3] DRAM Queue depth */ - temp2 = (SiS_GetReg1 (SiS_P3c4, 0x17) >> 6) & 0x3; /* SR17[7:6] DRAM Grant length */ - -#ifdef CONFIG_FB_SIS_315 - if (SiS_Get310DRAMType (ROMAddr) < 2) { - for (temp3 = 0; temp3 < 16; temp3 += 2) { - if ((CombCode[temp3] == temp1) - && (CombCode[temp3 + 1] == temp2)) { - temp3 = CRT2ThLow[temp3 >> 1]; - } - } - } else { - for (temp3 = 0; temp3 < 16; temp3 += 2) { - if ((CombCode[temp3] == temp1) - && (CombCode[temp3 + 1] == temp2)) { - temp3 = CRT2ThLow[8 + (temp3 >> 1)]; - } - } - } + temp=(USHORT)(eax>>24); + if(!(temp&0x01)) index += 24; + +#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_P3c4,0x14); + if(!(temp & 0x80)) data += 5; + + data += data2; + + SiS_SetFlag |= ProgrammingCRT2; + + data = data * VCLK * colorth; + if(data % (MCLK << 4)) { + data = data / (MCLK << 4); + data++; + } else { + data = data / (MCLK << 4); + } + + /* 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; + } else { + temp = (temp & (~0x1F)) | 0x16; + } + SiS_SetRegANDOR(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 */ + } +} + +/* TW: Set FIFO on 310 series */ +#ifdef SIS315H +void +SiS_SetCRT2FIFO_310(UCHAR *ROMAddr,USHORT ModeNo, + PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + + UCHAR CombCode[] = { 1, 1, 1, 4, 3, 1, 3, 4, + 4, 1, 4, 4, 5, 1, 5, 4}; + UCHAR CRT2ThLow[] = { 39, 63, 55, 79, 78,102, 90,114, + 55, 87, 84,116,103,135,119,151}; + USHORT temp3,tempax,tempbx,tempcx; + USHORT tempcl, tempch; + USHORT index; + USHORT CRT1ModeNo,CRT2ModeNo; + USHORT ModeIdIndex; + USHORT RefreshRateTableIndex; + USHORT SelectRate_backup; + + SiS_SetReg1(SiS_Part1Port,0x01,0x3B); + + CRT1ModeNo = SiS_CRT1Mode; /* get CRT1 ModeNo */ + SiS_SearchModeID(ROMAddr,&CRT1ModeNo,&ModeIdIndex); + + SiS_SetFlag &= (~ProgrammingCRT2); + SelectRate_backup = SiS_SelectCRT2Rate; + SiS_SelectCRT2Rate = 0; - temp += temp3; /* CRT1 Request Period */ + /* Set REFIndex for crt1 refreshrate */ + RefreshRateTableIndex = SiS_GetRatePtrCRT2(ROMAddr,CRT1ModeNo, + ModeIdIndex); - CRT2ModeNo = ModeNo; /* get CRT2 ModeNo */ - SiS_SearchModeID (ROMAddr, CRT2ModeNo, &ModeIdIndex); /* Get ModeID Table */ - SiS_SetFlag = SiS_SetFlag | ProgrammingCRT2; - RefreshRateTableIndex = SiS_GetRatePtrCRT2 (ROMAddr, CRT1ModeNo, ModeIdIndex); /* Set REFIndex-> for crt1 refreshrate */ - index = - SiS_GetVCLK2Ptr (ROMAddr, CRT2ModeNo, ModeIdIndex, - RefreshRateTableIndex, HwDeviceExtension); - temp1 = SiS_VCLKData[index].CLOCK; /* Get VCLK */ + index = SiS_GetVCLK2Ptr(ROMAddr,CRT1ModeNo,ModeIdIndex, + RefreshRateTableIndex,HwDeviceExtension); + tempax = SiS_VCLKData[index].CLOCK; /* Get DCLK (VCLK?) */ - temp2 = SiS_GetColorDepth (ROMAddr, CRT2ModeNo, ModeIdIndex); -#ifdef CONFIG_FB_SIS_315 - index = SiS_Get310DRAMType (ROMAddr); + tempbx = SiS_GetColorDepth(ROMAddr,CRT1ModeNo,ModeIdIndex); /* Get colordepth */ + tempbx >>= 1; + if(!tempbx) tempbx++; + + tempax *= tempbx; + + tempbx = SiS_GetMCLK(ROMAddr, HwDeviceExtension); /* Get MCLK */ + + tempax /= tempbx; + + tempbx = tempax; + +#if 0 /* TW: BIOS code is skrewed */ + if(SiS_GetReg1(SiS_P3c4,0x14) & 0x02) { + tempax = 16; + } else { + tempax = 8; + } #endif - temp3 = SiS_MCLKData[index].CLOCK; /* Get MCLK */ + tempax = 16; + + tempax -= tempbx; + + tempbx = tempax; /* tempbx = 16-DRamBus - DCLK*BytePerPixel/MCLK */ + + tempax = ((52 * 16) / tempbx); + + if ((52*16 % tempbx) != 0) { + tempax++; + } + tempcx = tempax; + 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 */ - if ((temp * temp1 * temp2) % (16 * temp3) == 0) - temp = temp * temp1 * temp2 / (16 * temp3); /* CRT1 Request period * TCLK*BytePerPixel/(MCLK*16) */ - else - temp = temp * temp1 * temp2 / (16 * temp3) + 1; /* CRT1 Request period * TCLK*BytePerPixel/(MCLK*16) */ + for (temp3 = 0; temp3 < 16; temp3 += 2) { + if ((CombCode[temp3] == tempcl) && (CombCode[temp3+1] == tempch)) { + temp3 = CRT2ThLow[temp3 >> 1]; + } + } - if (temp > 0x37) - temp = 0x37; + tempcx += temp3; /* CRT1 Request Period */ - SiS_SetRegANDOR (SiS_Part1Port, 0x02, ~0x3F, temp); + CRT2ModeNo = ModeNo; /* get CRT2 ModeNo */ + SiS_SearchModeID(ROMAddr,&CRT2ModeNo,&ModeIdIndex); /* Get ModeID Table */ + SiS_SetFlag |= ProgrammingCRT2; + SiS_SelectCRT2Rate = SelectRate_backup; + + RefreshRateTableIndex=SiS_GetRatePtrCRT2(ROMAddr,CRT1ModeNo, + ModeIdIndex); + + index = SiS_GetVCLK2Ptr(ROMAddr,CRT2ModeNo,ModeIdIndex, + RefreshRateTableIndex,HwDeviceExtension); + tempax = SiS_VCLKData[index].CLOCK; /* Get VCLK */ + + tempbx = SiS_GetColorDepth(ROMAddr,CRT2ModeNo,ModeIdIndex); /* Get colordepth */ + tempbx >>= 1; + if(!tempbx) tempbx++; + + tempax *= tempbx; + + tempax *= tempcx; + + tempbx = SiS_GetMCLK(ROMAddr, HwDeviceExtension); /* Get MCLK */ + tempbx <<= 4; + + tempcx = tempax; + tempax /= tempbx; + if(tempcx % tempbx) tempax++; /* CRT1 Request period * TCLK * BytePerPixel / (MCLK*16) */ + + 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) { + tempax = 0x04; + } + + SiS_SetRegANDOR(SiS_Part1Port,0x02,~0x3F,tempax); } +USHORT +SiS_GetMCLK(UCHAR *ROMAddr, PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT index; + + index = SiS_Get310DRAMType(ROMAddr,HwDeviceExtension); + if(index >= 4) { + index -= 4; + return(SiS_MCLKData_1[index].CLOCK); + } else { + return(SiS_MCLKData_0[index].CLOCK); + } +} +#endif + +/* TW: Checked against 650/LVDS 1.10.07 BIOS */ void -SiS_GetLVDSDesData (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex) +SiS_GetLVDSDesData(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension) { + USHORT modeflag; + USHORT PanelIndex,ResIndex; + SiS_LVDSDesStruct *PanelDesPtr=NULL; - USHORT modeflag; - USHORT PanelIndex, ResIndex; - SiS_LVDSDesStruct *PanelDesPtr = NULL; - if ((SiS_IF_DEF_LVDS == 0) - && ((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B))) { /*301b *//*for test */ - SiS_GetLVDSDesPtrA (ROMAddr, ModeNo, ModeIdIndex, - RefreshRateTableIndex, &PanelIndex, - &ResIndex); - switch (PanelIndex) { - case 0: - PanelDesPtr = LVDS1024x768Des_1; - break; - case 1: - PanelDesPtr = LVDS1280x1024Des_1; - break; - case 2: - PanelDesPtr = LVDS1280x960Des_1; - break; - case 3: - PanelDesPtr = LVDS1024x768Des_2; - break; - case 4: - PanelDesPtr = LVDS1280x1024Des_2; - break; - case 5: - PanelDesPtr = LVDS1280x960Des_2; - break; - } - } else { - SiS_GetLVDSDesPtr (ROMAddr, ModeNo, ModeIdIndex, - RefreshRateTableIndex, &PanelIndex, - &ResIndex); - switch (PanelIndex) { - case 0: - PanelDesPtr = SiS_PanelType00_1; - break; - 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; - case 13: - PanelDesPtr = SiS_PanelType0d_1; - break; - case 14: - PanelDesPtr = SiS_PanelType0e_1; - break; - case 15: - PanelDesPtr = SiS_PanelType0f_1; - break; - case 16: - PanelDesPtr = SiS_PanelType00_2; - break; - 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; - 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; - } - } - SiS_LCDHDES = (PanelDesPtr + ResIndex)->LCDHDES; - SiS_LCDVDES = (PanelDesPtr + ResIndex)->LCDVDES; - if (SiS_LCDInfo & LCDNonExpanding) { - if (SiS_LCDResInfo >= Panel1024x768) { - if (ModeNo <= 0x13) { - modeflag = - SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; - if (!(modeflag & HalfDCLK)) { - SiS_LCDHDES = 320; - } - } - } - } - return; + if((SiS_VBType & VB_SIS301BLV302BLV) && (SiS_VBInfo & SetCRT2ToLCDA) ) { + + SiS_GetLVDSDesPtrA(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; + } + + } else { + + SiS_GetLVDSDesPtr(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; + } + } + 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; + } + } + } + } + } + } + } + return; } +/* TW: Checked against 630/LVDS (2.04.5c) and 650/LVDS (1.10.07) BIOS */ void -SiS_GetLVDSDesPtr (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex, USHORT * PanelIndex, - USHORT * ResIndex) +SiS_GetLVDSDesPtr(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,USHORT *PanelIndex, + USHORT *ResIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension) { - USHORT tempbx, tempal; - - tempbx = 0; - if (SiS_IF_DEF_CH7005 == 1) { - if (!(SiS_VBInfo & SetCRT2ToLCD)) { - tempbx = 32; - if (SiS_VBInfo & SetPALTV) - tempbx = tempbx + 2; - if (SiS_VBInfo & SetCHTVOverScan) - tempbx = tempbx + 1; - } - } - if (SiS_VBInfo & SetCRT2ToLCD) { - tempbx = SiS_LCDTypeInfo; - if (SiS_LCDInfo & LCDNonExpanding) { - tempbx = tempbx + 16; - } - } - if (ModeNo <= 0x13) { - tempal = SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; - } else { - tempal = SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; - } - tempal = tempal & 0x1F; - *PanelIndex = tempbx; - *ResIndex = tempal; + USHORT tempbx,tempal,modeflag; + + if(ModeNo<=0x13) { + modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + tempal = SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; + } else { + modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + tempal = 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_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; + } + } + /* 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++; + } + } + } + + *PanelIndex = tempbx; + *ResIndex = tempal & 0x1F; } -/*301b*/ void -SiS_GetLVDSDesPtrA (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex, USHORT * PanelIndex, - USHORT * ResIndex) +SiS_GetLVDSDesPtrA(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,USHORT *PanelIndex, + USHORT *ResIndex) { - USHORT tempbx, tempal; + USHORT tempbx=0,tempal; - tempbx = 0; - tempbx = SiS_LCDResInfo; - tempbx = tempbx - Panel1024x768; - if (SiS_LCDInfo & LCDNonExpanding) { - tempbx = tempbx + 3; - } + tempbx = SiS_LCDResInfo - PanelMin301; /* TW: *not* PanelMinLVDS! */ + if(SiS_LCDInfo & LCDNonExpanding) tempbx += 3; - if (ModeNo <= 0x13) { - tempal = SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; - } else { - tempal = SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; - } - tempal = tempal & 0x1F; - *PanelIndex = tempbx; - *ResIndex = tempal; -} + if(ModeNo<=0x13) + tempal = SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; + else + tempal = SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; -/*end 301b*/ + *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, - PSIS_HW_DEVICE_INFO HwDeviceExtension) +SiS_SetCRT2ModeRegs(USHORT BaseAddr,USHORT ModeNo, USHORT ModeIdIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension) { - USHORT i, j; - USHORT tempcl, tempah; -/*301b*/ - if (((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B)) - && (SiS_VBInfo & SetCRT2ToLCDA)) { - SiS_SetRegANDOR (SiS_Part1Port, 0x00, ~0x050, 0x40); - SiS_SetRegAND (SiS_Part1Port, 0x2E, 0xF7); - 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); - } - /*end 301b */ - else { - for (i = 0, j = 4; i < 3; i++, j++) - SiS_SetReg1 (SiS_Part1Port, j, 0); - - tempcl = SiS_ModeType; - if (HwDeviceExtension->jChipType < SIS_315H) { /* 300 series */ - if (ModeNo > 0x13) { - tempcl = tempcl - ModeVGA; - if ((tempcl > 0) || (tempcl == 0)) { - tempah = ((0x010 >> tempcl) | 0x080); - } - } else { - tempah = 0x080; - } - if (SiS_VBInfo & SetInSlaveMode) { - tempah = (tempah ^ 0x0A0); - } - } else { /* 310 series */ - - if (ModeNo > 0x13) { - tempcl = tempcl - ModeVGA; - if ((tempcl > 0) || (tempcl == 0)) { - tempah = (0x008 >> tempcl); - if (tempah == 0) - tempah = 1; - tempah |= 0x040; - } - } else { - tempah = 0x040; - } + USHORT i,j,modeflag; + USHORT tempcl,tempah,tempbl,temp; + + if(ModeNo<=0x13) { + modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + } else { + modeflag = 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 */ + + /* TW: Removed 301B302B301LV302LV check here to match 650/LVDS BIOS */ + if(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 - if (SiS_VBInfo & SetInSlaveMode) { - tempah = (tempah ^ 0x050); - } + } else { - } + for(i=0,j=4;i<3;i++,j++) SiS_SetReg1(SiS_Part1Port,j,0); - if (SiS_VBInfo & CRT2DisplayFlag) { - tempah = 0; - } - SiS_SetReg1 (SiS_Part1Port, 0x00, tempah); + tempcl = SiS_ModeType; - if (SiS_IF_DEF_LVDS == 0) { /* ifdef 301 */ - tempah = 0x01; - if (!(SiS_VBInfo & SetInSlaveMode)) { - tempah = (tempah | 0x02); - } - if (!(SiS_VBInfo & SetCRT2ToRAMDAC)) { - tempah = (tempah ^ 0x05); - if (!(SiS_VBInfo & SetCRT2ToLCD)) { - tempah = (tempah ^ 0x01); - } - } + if(HwDeviceExtension->jChipType < SIS_315H) { - tempcl = tempah; /* 05/03/01 ynlai for TV display bug */ + /* ---- 300 series ---- */ - if (HwDeviceExtension->jChipType < SIS_315H) { /* 300 series */ - tempah = (tempah << 5) & 0xFF; - if (SiS_VBInfo & CRT2DisplayFlag) { - tempah = 0; - } - SiS_SetReg1 (SiS_Part1Port, 0x01, tempah); + /* TW: Inserted entire if-section from 630/301B BIOS */ + if(SiS_VBType & VB_SIS301BLV302BLV) { + temp = SiS_GetReg1(SiS_P3c4,0x32); + temp &= 0xef; + temp |= 0x02; + if(SiS_VBInfo & SetCRT2ToTV) { + temp |= 0x10; + temp &= 0xfd; + } + SiS_SetReg1(SiS_P3c4,0x32,temp); + } - tempah = tempah >> 5; - } else { /* 310 series */ + if(ModeNo > 0x13){ + tempcl -= ModeVGA; + if((tempcl > 0) || (tempcl == 0)) { /* TW: tempcl is USHORT -> always true! */ + tempah = ((0x010 >> tempcl) | 0x080); + } + } else tempah = 0x080; - if (SiS_VBInfo & CRT2DisplayFlag) { - tempah = 0; - } - tempah = - (SiS_GetReg1 (SiS_Part1Port, 0x2E) & 0xF8) | - tempah; - SiS_SetReg1 (SiS_Part1Port, 0x2E, tempah); - tempah = tempcl; - } + if(SiS_VBInfo & SetInSlaveMode) tempah = (tempah ^ 0x0A0); - if ((SiS_ModeType == ModeVGA) - && (!(SiS_VBInfo & SetInSlaveMode))) { - tempah = tempah | 0x010; - } + } else { - if (SiS_LCDResInfo == Panel1024x768) - tempah = tempah | 0x080; + /* ---- 310 series ---- */ - if ((SiS_LCDResInfo == Panel1280x1024) - || (SiS_LCDResInfo == Panel1280x960)) { - tempah = tempah | 0x080; - } - if (SiS_VBInfo & SetCRT2ToTV) { - if (SiS_VBInfo & SetInSlaveMode) { - if ( - ((SiS_VBType & VB_SIS301B) - || (SiS_VBType & VB_SIS302B))) { /*301b */ - if (SiS_SetFlag & TVSimuMode) - tempah = tempah | 0x020; - } else - tempah = tempah | 0x020; - } - } - SiS_SetRegANDOR (SiS_Part4Port, 0x0D, ~0x0BF, tempah); - tempah = 0; - if (SiS_VBInfo & SetCRT2ToTV) { - if (SiS_VBInfo & SetInSlaveMode) { - if ( - ((SiS_VBType & VB_SIS301B) - || (SiS_VBType & VB_SIS302B))) { /*301b */ - { - SiS_SetFlag = - SiS_SetFlag | - RPLLDIV2XO; - tempah = tempah | 0x40; - } - } else { - if (!(SiS_SetFlag & TVSimuMode)) { - if (! - (SiS_VBInfo & - SetCRT2ToHiVisionTV)) - { - SiS_SetFlag = - SiS_SetFlag - | - RPLLDIV2XO; - tempah = - tempah | - 0x40; - } - } - } - } else { - SiS_SetFlag = SiS_SetFlag | RPLLDIV2XO; - tempah = tempah | 0x40; - } - } - if (SiS_LCDResInfo == Panel1280x1024) - tempah = tempah | 0x80; - if (SiS_LCDResInfo == Panel1280x960) - tempah = tempah | 0x80; - SiS_SetReg1 (SiS_Part4Port, 0x0C, tempah); - } else { - /*LVDS*/ tempah = 0; - if (!(SiS_VBInfo & SetInSlaveMode)) { - tempah = tempah | 0x02; - } - SiS_SetRegANDOR (SiS_Part1Port, 0x2e, 0xF0, tempah); - } + /* TW: Inserted from 650/301/301LV BIOS */ + if(SiS_VBType & VB_SIS301BLV302BLV) { + if(SiS_VBInfo & CRT2DisplayFlag) { + SiS_SetRegOR(SiS_Part1Port,0x2e,0x08); + } + } + + if(ModeNo > 0x13) { + tempcl -= ModeVGA; + if((tempcl > 0) || (tempcl == 0)) { /* TW: tempcl is USHORT -> always true! */ + tempah = (0x008 >> tempcl); + if (tempah == 0) tempah = 1; + tempah |= 0x040; + } + } else tempah = 0x040; + + if(SiS_VBInfo & SetInSlaveMode) tempah = (tempah ^ 0x050); + + } + + if(SiS_VBInfo & CRT2DisplayFlag) tempah = 0; + + SiS_SetReg1(SiS_Part1Port,0x00,tempah); /* FUNCTION CONTROL */ + + if(SiS_IF_DEF_LVDS == 0) { + + /* TW: 2. for 301 (301B, 302B 301LV, 302LV non-LCDA) */ + + tempah = 0x01; + if(!(SiS_VBInfo & SetInSlaveMode)) { + tempah |= 0x02; + } + if(!(SiS_VBInfo & SetCRT2ToRAMDAC)) { + tempah = (tempah ^ 0x05); + if(!(SiS_VBInfo & SetCRT2ToLCD)) { + tempah = (tempah ^ 0x01); + } + } + + tempcl = tempah; + + 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; + + } 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; + } + + if((SiS_ModeType == ModeVGA) && (!(SiS_VBInfo & SetInSlaveMode))) { + tempah |= 0x010; } -/*301b*/ - if (((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B)) - && (!(SiS_VBInfo & SetCRT2ToLCDA))) { - if (SiS_IsDualEdge (BaseAddr)) - SiS_SetRegANDOR (SiS_Part1Port, 0x13, 0xFB, 0x00); - else - SiS_SetRegANDOR (SiS_Part1Port, 0x13, 0xFF, 0x00); - if (SiS_IsDualEdge (BaseAddr)) - SiS_SetRegANDOR (SiS_Part1Port, 0x2c, 0xCF, 0x00); - else - SiS_SetRegANDOR (SiS_Part1Port, 0x2c, 0xFF, 0x00); - if (SiS_IsDualEdge (BaseAddr)) - SiS_SetRegANDOR (SiS_Part4Port, 0x21, 0x3F, 0x00); - else - SiS_SetRegANDOR (SiS_Part4Port, 0x21, 0xFF, 0x00); - - if (SiS_IsDualEdge (BaseAddr)) - SiS_SetRegANDOR (SiS_Part4Port, 0x23, 0xFF, 0x80); - else - SiS_SetRegANDOR (SiS_Part4Port, 0x23, 0xFF, 0x00); + + /* TW: Inserted from 630/301 BIOS */ + if(SiS_VBType & VB_SIS301) { + if(SiS_LCDResInfo == 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; + } + } + 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; + } + } + + if(SiS_LCDResInfo == Panel1280x1024 || SiS_LCDResInfo == Panel1280x960) { + tempah |= 0x80; + } + + SiS_SetReg1(SiS_Part4Port,0x0C,tempah); + + } else { + + /* TW: 3. for LVDS */ + + /* TW: Inserted if-statement - Part1Port 0x2e not assigned on 300 series */ + if(HwDeviceExtension->jChipType >= SIS_315H) { + + /* TW: Inserted this entire section (BIOS 650/LVDS); added ModeType check + * (LVDS can only be slave in 8bpp modes) + */ + tempah = 0x80; + if( (modeflag & CRT2Mode) && (SiS_ModeType > ModeVGA) ) { + if (SiS_VBInfo & DriverMode) { + tempah |= 0x02; + } + } + + if(!(SiS_VBInfo & SetInSlaveMode)) { + tempah |= 0x02; + } + + if(SiS_VBInfo & SetCRT2ToTV) { + tempah = tempah ^ 0x01; + } + + if(SiS_VBInfo & DisableCRT2Display) { + tempah = 1; + } + + SiS_SetRegANDOR(SiS_Part1Port,0x2e,0xF0,tempah); + + } else { + + /* TW: Inserted entire section from 630/LVDS BIOS (added ModeType check) */ + tempah = 0; + if( (!(SiS_VBInfo & SetInSlaveMode)) && (SiS_ModeType > ModeVGA) ) { + tempah |= 0x02; + } + tempah <<= 5; + if(SiS_VBInfo & DisableCRT2Display) + tempah = 0; + + SiS_SetReg1(SiS_Part1Port,0x01,tempah); + } -/*end 301b*/ + } + + } + + /* TW: Inserted the entire following section */ + + if(SiS_IF_DEF_LVDS == 0) { + + if(HwDeviceExtension->jChipType >= SIS_315H) { /* TW: From 650/301 BIOS */ + +#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); + + 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 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); + + } else if(SiS_VBType & VB_SIS301BLV302BLV) { /* TW: From 630/301B BIOS */ + + SiS_SetRegAND(SiS_Part4Port,0x21,0x3f); + + if(SiS_VBInfo & (SetCRT2ToLCD | DisableCRT2Display)) + SiS_SetRegAND(SiS_Part4Port,0x23,0x7F); + else + SiS_SetRegOR(SiS_Part4Port,0x23,0x80); + + } + + } else { /* TW: From 650/LVDS BIOS */ + + 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); + + SiS_SetRegANDOR(SiS_Part1Port,0x2c,0xcf,0x30); + } + + } + } + void -SiS_GetCRT2Data (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex) +SiS_GetCRT2Data(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension) { - if (SiS_IF_DEF_LVDS == 0) { /*301 */ - if ((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B)) { - if (SiS_VBInfo & SetCRT2ToLCDA) - SiS_GetCRT2DataLVDS (ROMAddr, ModeNo, - ModeIdIndex, - RefreshRateTableIndex); - else - SiS_GetCRT2Data301 (ROMAddr, ModeNo, - ModeIdIndex, - RefreshRateTableIndex); - } else - SiS_GetCRT2Data301 (ROMAddr, ModeNo, ModeIdIndex, - RefreshRateTableIndex); - return; - } else { /*LVDS */ - SiS_GetCRT2DataLVDS (ROMAddr, ModeNo, ModeIdIndex, - RefreshRateTableIndex); - return; - } + if(SiS_IF_DEF_LVDS == 0) { + if(SiS_VBType & VB_SIS301BLV302BLV) { + if(SiS_VBInfo & SetCRT2ToLCDA) { + SiS_GetCRT2DataLVDS(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); + } + } + } else + SiS_GetCRT2Data301(ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,HwDeviceExtension); + } else { + SiS_GetCRT2DataLVDS(ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,HwDeviceExtension); + } } +/* Checked with 650/LVDS 1.10.07 BIOS */ void -SiS_GetCRT2DataLVDS (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex) +SiS_GetCRT2DataLVDS(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension) { - USHORT tempax, tempbx; - USHORT CRT2Index, ResIndex; - SiS_LVDSDataStruct *LVDSData = NULL; - - SiS_GetCRT2ResInfo (ROMAddr, ModeNo, ModeIdIndex); - /*301b */ - if (((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B)) - && (SiS_VBInfo & SetCRT2ToLCDA)) { - SiS_GetCRT2PtrA (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_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_LVDS1280x1024Data_2; - break; - /* case 5: LVDSData=SiS_LVDS1280x960Data_2; break; */ - } - } - - else { - SiS_GetCRT2Ptr (ROMAddr, ModeNo, ModeIdIndex, - RefreshRateTableIndex, &CRT2Index, &ResIndex); - 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_CHTVUNTSCData; - break; - case 8: - LVDSData = SiS_CHTVONTSCData; - break; - case 9: - LVDSData = SiS_CHTVUPALData; - break; - case 10: - LVDSData = SiS_CHTVOPALData; - break; - } - } - SiS_VGAHT = (LVDSData + ResIndex)->VGAHT; - SiS_VGAVT = (LVDSData + ResIndex)->VGAVT; - SiS_HT = (LVDSData + ResIndex)->LCDHT; - SiS_VT = (LVDSData + ResIndex)->LCDVT; -/*301b*/ - if ((SiS_IF_DEF_LVDS == 0) - && ((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B))) { /*for test */ - if (!(SiS_LCDInfo & LCDNonExpanding)) { - if (SiS_LCDResInfo == Panel1024x768) { - tempax = 1024; - tempbx = 768; - } else { - tempax = 1280; - tempbx = 1024; - } - SiS_HDE = tempax; - SiS_VDE = tempbx; - } - } else { - if (SiS_IF_DEF_TRUMPION == 0) { - if (SiS_VBInfo & SetCRT2ToLCD) { - if (!(SiS_LCDInfo & LCDNonExpanding)) { - if (SiS_LCDResInfo == Panel800x600) { - tempax = 800; - tempbx = 600; - } else if (SiS_LCDResInfo == - Panel1024x768) { - tempax = 1024; - tempbx = 768; - } else { - tempax = 1280; - tempbx = 1024; - } - SiS_HDE = tempax; - SiS_VDE = tempbx; - } - } - } - } - return; + USHORT CRT2Index, ResIndex; + SiS_LVDSDataStruct *LVDSData = NULL; + + SiS_GetCRT2ResInfo(ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension); + + if((SiS_VBType & VB_SIS301BLV302BLV) && (SiS_VBInfo & SetCRT2ToLCDA)) { + + SiS_GetCRT2PtrA(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; + } + + } else { + + /* TW: SiS630/301B needs LVDS Data! */ + if( (HwDeviceExtension->jChipType < SIS_315H) && + (SiS_VBType & VB_SIS301BLV302BLV) && + (SiS_VBInfo & SetCRT2ToLCD) ) + SiS_IF_DEF_LVDS = 1; + + SiS_GetCRT2Ptr(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; + + 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 */ + } + } + + 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; + } else { + SiS_HDE = 1280; + 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; + } else { + SiS_HDE = 1152; + SiS_VDE = 768; + } + if(SiS_IF_DEF_FSTN) { + SiS_HDE = 320; + SiS_VDE = 480; + } + } + } + } + } + } } +/* TW: Checked against 630/301B BIOS; does not check VDE values for LCD */ void -SiS_GetCRT2Data301 (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex) +SiS_GetCRT2Data301(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; - - if (ModeNo <= 0x13) { - modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ - resinfo = SiS_SModeIDTable[ModeIdIndex].St_ResInfo; - } else { - modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */ - resinfo = SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; - } - SiS_NewFlickerMode = 0; - SiS_RVBHRS = 50; - SiS_RY1COE = 0; - SiS_RY2COE = 0; - SiS_RY3COE = 0; - SiS_RY4COE = 0; - - SiS_GetCRT2ResInfo (ROMAddr, ModeNo, ModeIdIndex); - if (SiS_VBInfo & SetCRT2ToRAMDAC) { - SiS_GetRAMDAC2DATA (ROMAddr, ModeNo, ModeIdIndex, - RefreshRateTableIndex); - return; - } - - if (SiS_VBInfo & SetCRT2ToTV) { - SiS_GetCRT2Ptr (ROMAddr, ModeNo, ModeIdIndex, - RefreshRateTableIndex, &CRT2Index, &ResIndex); - 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; - } - - 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 == 0x10) - SiS_NewFlickerMode = 0x40; - } - if (SiS_VBInfo & SetCRT2ToHiVisionTV) { - if (SiS_VGAVDE == 350) - SiS_SetFlag = SiS_SetFlag | TVSimuMode; - tempax = ExtHiTVHT; - tempbx = ExtHiTVVT; - if (SiS_VBInfo & SetInSlaveMode) { - if (SiS_SetFlag & TVSimuMode) { - tempax = StHiTVHT; - tempbx = StHiTVVT; - if (!(modeflag & Charx8Dot)) { - tempax = StHiTextTVHT; - tempbx = StHiTextTVVT; - } - } - } - } - if (!(SiS_VBInfo & SetCRT2ToHiVisionTV)) { - SiS_RY1COE = (TVPtr + ResIndex)->RY1COE; - SiS_RY2COE = (TVPtr + ResIndex)->RY2COE; - if (modeflag & HalfDCLK) { - SiS_RY1COE = 0x00; - SiS_RY2COE = 0xf4; - } - SiS_RY3COE = (TVPtr + ResIndex)->RY3COE; - SiS_RY4COE = (TVPtr + ResIndex)->RY4COE; - if (modeflag & HalfDCLK) { - SiS_RY3COE = 0x10; - SiS_RY4COE = 0x38; - } - if (!(SiS_VBInfo & SetPALTV)) { - tempax = NTSCHT; - tempbx = NTSCVT; - } else { - tempax = PALHT; - tempbx = PALVT; - } - } - SiS_HT = tempax; - SiS_VT = tempbx; - return; - } - - if (SiS_VBInfo & SetCRT2ToLCD) { - SiS_GetCRT2Ptr (ROMAddr, ModeNo, ModeIdIndex, - RefreshRateTableIndex, &CRT2Index, &ResIndex); - switch (CRT2Index) { - case 0: - LCDPtr = SiS_ExtLCD1024x768Data; - break; - case 1: - LCDPtr = SiS_ExtLCD1280x1024Data; - break; - case 5: - LCDPtr = SiS_StLCD1024x768Data; - break; - case 6: - LCDPtr = SiS_StLCD1280x1024Data; - break; - case 10: - LCDPtr = SiS_St2LCD1024x768Data; - break; - case 11: - LCDPtr = SiS_St2LCD1280x1024Data; - break; - case 13: - LCDPtr = SiS_NoScaleData; - break; - case 14: - LCDPtr = SiS_LCD1280x960Data; - break; - } - - 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; - tempax = 1024; - if (SiS_SetFlag & LCDVESATiming) { - if (SiS_VGAVDE == 350) - tempbx = 560; - else if (SiS_VGAVDE == 400) - tempbx = 640; - 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_LCDResInfo == 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_LCDResInfo == 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_LCDInfo & LCDNonExpanding) { - tempax = SiS_VGAHDE; - tempbx = SiS_VGAVDE; - } - SiS_HDE = tempax; - SiS_VDE = tempbx; - return; - } + USHORT tempax,tempbx,modeflag; + USHORT resinfo; + USHORT CRT2Index,ResIndex; + SiS_LCDDataStruct *LCDPtr=NULL; + SiS_TVDataStruct *TVPtr=NULL; + + if(ModeNo<=0x13) { + modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + resinfo = SiS_SModeIDTable[ModeIdIndex].St_ResInfo; + } else { + modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + resinfo = SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; + } + SiS_NewFlickerMode = 0; + SiS_RVBHRS = 50; + SiS_RY1COE = 0; + SiS_RY2COE = 0; + SiS_RY3COE = 0; + SiS_RY4COE = 0; + + SiS_GetCRT2ResInfo(ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension); + + /* TW: For VGA2 ("RAMDAC2") */ + + if(SiS_VBInfo & SetCRT2ToRAMDAC){ + SiS_GetRAMDAC2DATA(ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex, + HwDeviceExtension); + return; + } + + /* TW: For TV */ + + if(SiS_VBInfo & SetCRT2ToTV) { + + SiS_GetCRT2Ptr(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 */ + } + + 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; + } + } + } + + } else { + + SiS_RY1COE = (TVPtr+ResIndex)->RY1COE; + SiS_RY2COE = (TVPtr+ResIndex)->RY2COE; + SiS_RY3COE = (TVPtr+ResIndex)->RY3COE; + SiS_RY4COE = (TVPtr+ResIndex)->RY4COE; + + if(modeflag & HalfDCLK) { + SiS_RY1COE = 0x00; + SiS_RY2COE = 0xf4; + SiS_RY3COE = 0x10; + SiS_RY4COE = 0x38; + } + + if(!(SiS_VBInfo & SetPALTV)){ + SiS_HT = NTSCHT; + if((ModeNo == 0x4a) || (ModeNo == 0x38)) SiS_HT = NTSC2HT; + SiS_VT = NTSCVT; + } else { + SiS_HT = PALHT; + SiS_VT = PALVT; + } + + } + + return; + } + + /* TW: For LCD */ + /* TW: Checked against 650/301LV; CRT2Index different (but does not matter) */ + + if(SiS_VBInfo & SetCRT2ToLCD) { + + SiS_GetCRT2Ptr(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 */ + } + + 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; + + tempax = 1024; + if(SiS_SetFlag & LCDVESATiming) { + if (SiS_VGAVDE == 350) tempbx = 560; + else if(SiS_VGAVDE == 400) tempbx = 640; + 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_LCDResInfo == 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_LCDResInfo == 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_LCDInfo & LCDNonExpanding) { + tempax = SiS_VGAHDE; + tempbx = SiS_VGAVDE; + } + SiS_HDE = tempax; + SiS_VDE = tempbx; + return; + } } USHORT -SiS_GetResInfo (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex) +SiS_GetResInfo(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex) { - USHORT resindex; + USHORT resindex; - if (ModeNo <= 0x13) { - resindex = SiS_SModeIDTable[ModeIdIndex].St_ResInfo; /* si+St_ResInfo */ - } else { - resindex = SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; /* si+Ext_ResInfo */ - } - return (resindex); + if(ModeNo<=0x13) + resindex=SiS_SModeIDTable[ModeIdIndex].St_ResInfo; + else + resindex=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 (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex) +SiS_GetCRT2ResInfo(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension) { - USHORT xres, yres, modeflag, resindex; - - resindex = SiS_GetResInfo (ROMAddr, ModeNo, ModeIdIndex); - if (ModeNo <= 0x13) { - xres = SiS_StResInfo[resindex].HTotal; - yres = SiS_StResInfo[resindex].VTotal; + USHORT xres,yres,modeflag=0,resindex; + + resindex = SiS_GetResInfo(ROMAddr,ModeNo,ModeIdIndex); + + if(ModeNo <= 0x13) { + xres = SiS_StResInfo[resindex].HTotal; + yres = SiS_StResInfo[resindex].VTotal; + } else { + xres = SiS_ModeResInfo[resindex].HTotal; + yres = SiS_ModeResInfo[resindex].VTotal; + modeflag = 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(yres == 350) yres = 400; + } + if(SiS_GetReg1(SiS_P3d4,0x3a) & 0x01) { + if(SiS_GetReg1(SiS_P3d4,0x34) == 0x12) + yres = 400; + } + } + + if(ModeNo > 0x13) { + if(SiS_IF_DEF_FSTN == 1){ + xres *= 2; + yres *= 2; + } else { + if(modeflag & HalfDCLK) xres *= 2; + if(modeflag & DoubleScanMode) yres *= 2; + } + } + + if(SiS_IF_DEF_LVDS == 0) { + /* TW: Inserted from 650/301LV BIOS */ + if(SiS_VBInfo & SetCRT2ToLCDA) { + if(xres == 720) xres = 640; } else { - xres = SiS_ModeResInfo[resindex].HTotal; /* xres->ax */ - yres = SiS_ModeResInfo[resindex].VTotal; /* yres->bx */ - modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+St_ModeFlag */ - if (modeflag & HalfDCLK) { - xres = xres * 2; - } - if (modeflag & DoubleScanMode) { - yres = yres * 2; - } - } - if (SiS_IF_DEF_LVDS == 0) { - 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(!OldBios) */ - if (yres == 480) - yres = 525; - } - } - } - } else { - if (xres == 720) - xres = 640; - } - SiS_VGAHDE = xres; - SiS_HDE = xres; - SiS_VGAVDE = yres; - SiS_VDE = yres; + 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; + } + } + } + } else { + if(xres == 720) xres = 640; + /* TW: Inserted from 650/LVDS and 630/LVDS BIOS */ + if(SiS_SetFlag & CRT2IsVGA) { + yres = 400; + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(SiS_GetReg1(SiS_P3c4,0x17) & 0x80) yres = 480; + } else { + if(SiS_GetReg1(SiS_P3c4,0x13) & 0x80) yres = 480; + } + } + } + SiS_VGAHDE = SiS_HDE = xres; + SiS_VGAVDE = 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 (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex, USHORT * CRT2Index, - USHORT * ResIndex) +SiS_GetCRT2Ptr(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,USHORT *CRT2Index,USHORT *ResIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension) { - USHORT tempbx, tempal; - USHORT Flag; - if (SiS_IF_DEF_LVDS == 0) { - if (SiS_VBInfo & SetCRT2ToLCD) { /* LCD */ - tempbx = SiS_LCDResInfo; - tempbx = tempbx - Panel1024x768; - if (!(SiS_SetFlag & LCDVESATiming)) { - tempbx += 5; -/* GetRevisionID(); */ - tempbx += 5; - } - } else { - if (SiS_VBInfo & SetCRT2ToHiVisionTV) { /* TV */ - if (SiS_VGAVDE > 480) - SiS_SetFlag = - SiS_SetFlag & (!TVSimuMode); - tempbx = 2; - if (SiS_VBInfo & SetInSlaveMode) { - if (!(SiS_SetFlag & TVSimuMode)) - tempbx = 10; - } - } else { - if (SiS_VBInfo & SetPALTV) { - tempbx = 3; - } else { - tempbx = 4; - } - if (SiS_SetFlag & TVSimuMode) { - tempbx = tempbx + 5; - } - } - } - if (ModeNo <= 0x13) { - tempal = SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; + 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) { + tempbx = 13; + if(SiS_LCDResInfo == Panel1280x1024) tempbx++; } else { - tempal = - SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; - } - tempal = tempal & 0x3F; - /*301b */ - if (((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B)) - && (SiS_VBInfo & SetCRT2ToTV)) { - /*look */ - if (tempal == 0x06) - tempal = 0x07; - - } - /*end 301b */ - if ((0x31 <= ModeNo) && (ModeNo <= 0x35)) - tempal = 6; - if (SiS_LCDInfo & LCDNonExpanding) - tempbx = 0x0D; - if (SiS_LCDResInfo == Panel1280x960) - tempbx = 0x0E; - *CRT2Index = tempbx; - *ResIndex = tempal; - } else { /* LVDS */ - Flag = 1; - tempbx = 0; - if (SiS_IF_DEF_CH7005 == 1) { - if (!(SiS_VBInfo & SetCRT2ToLCD)) { - Flag = 0; - tempbx = 7; - if (SiS_VBInfo & SetPALTV) - tempbx = tempbx + 2; - if (SiS_VBInfo & SetCHTVOverScan) - tempbx = tempbx + 1; - } - } - if (Flag == 1) { - tempbx = SiS_LCDResInfo - Panel800x600; - if (SiS_LCDInfo & LCDNonExpanding) { - tempbx = tempbx + 3; - } - } - if (ModeNo <= 0x13) { - tempal = SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; + tempbx = SiS_LCDResInfo - Panel1024x768; + if(!(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 */ + tempbx = 2; + if(SiS_VBInfo & SetInSlaveMode) { + if(!(SiS_SetFlag & TVSimuMode)) tempbx = 12; /* TW: Was 10! - WRONG */ + } + } else { + if(SiS_VBInfo & SetPALTV) tempbx = 3; + else tempbx = 4; + if(SiS_SetFlag & TVSimuMode) tempbx += 5; + } + } + + if(ModeNo <= 0x13) + tempal = SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; + else + tempal = SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; + + tempal &= 0x3F; + + if((SiS_VBType & VB_SIS301BLV302BLV) + && (SiS_VBInfo & (SetCRT2ToTV-SetCRT2ToHiVisionTV))) { /* TW: Added -Hivision (BIOS) */ + if(tempal == 0x06) tempal = 0x07; + } + + if(SiS_VBInfo & SetCRT2ToTV) { + if((ModeNo == 0x31) || (ModeNo == 0x32)) tempal = 6; + } + + *CRT2Index = tempbx; + *ResIndex = tempal; + + } else { /* LVDS */ + + Flag = 1; + tempbx = 0; + if(SiS_IF_DEF_CH70xx != 0) { + if(!(SiS_VBInfo & SetCRT2ToLCD)) { + Flag = 0; + tempbx = 10; + if(SiS_VBInfo & SetPALTV) tempbx += 2; + if(SiS_VBInfo & SetCHTVOverScan) tempbx += 1; + } + } + + if(Flag == 1) { + tempbx = SiS_LCDResInfo - PanelMinLVDS; + if(SiS_LCDResInfo <= Panel1280x1024) { + if(SiS_LCDInfo & LCDNonExpanding) tempbx += 3; } else { - tempal = - SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; - } - tempal = tempal & 0x1F; - *CRT2Index = tempbx; - *ResIndex = tempal; + 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(ModeNo <= 0x13) + tempal = SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; + else { + tempal = SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; + resinfo = SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; } -} -void -SiS_GetCRT2PtrA (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex, USHORT * CRT2Index, - USHORT * ResIndex) -{ - USHORT tempbx, tempal; + if(SiS_IF_DEF_FSTN){ + if(SiS_LCDResInfo == Panel320x480){ + tempbx = 14; + tempal = 6; + } + } + + /* TW: Inserted from 650/LVDS BIOS */ + if(SiS_SetFlag & CRT2IsVGA) { + if(SiS_LCDResInfo != 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++; + } - tempbx = SiS_LCDResInfo - Panel1024x768; - if (SiS_LCDInfo & LCDNonExpanding) { - tempbx = tempbx + 3; } - if (ModeNo <= 0x13) { - tempal = SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; - } else { - tempal = SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; + + /* TW: Inserted from 630/301B BIOS */ + if(SiS_VBType & VB_SIS301BLV302BLV) { + if(ModeNo > 0x13) { + if((resinfo == 0x0c) || (resinfo == 0x0d)) + tempal = 6; + } } - tempal = tempal & 0x1F; - *CRT2Index = tempbx; - *ResIndex = tempal; -} -/*end 301b*/ + *CRT2Index = tempbx; + *ResIndex = tempal & 0x1F; + } +} -USHORT -SiS_GetRatePtrCRT2 (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex) +void +SiS_GetCRT2PtrA(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,USHORT *CRT2Index, + USHORT *ResIndex) { - SHORT LCDRefreshIndex[] = { 0x00, 0x00, 0x03, 0x01 }; - SHORT LCDARefreshIndex[] = { 0x00, 0x00, 0x03, 0x01, 0x01, 0x01, 0x01 }; - USHORT RefreshRateTableIndex, i; - USHORT modeflag, index, temp; + USHORT tempbx,tempal; - if (ModeNo <= 0x13) { - modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; - } else { - modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - } + tempbx = SiS_LCDResInfo - Panel1024x768; - if (SiS_IF_DEF_CH7005 == 1) { - if (SiS_VBInfo & SetCRT2ToTV) { - if (modeflag & HalfDCLK) - return (0); - } - } - if (ModeNo < 0x14) - return (0xFFFF); - index = SiS_GetReg1 (SiS_P3d4, 0x33); - index = index >> SiS_SelectCRT2Rate; - index = index & 0x0F; - if (SiS_LCDInfo & LCDNonExpanding) - index = 0; - if (index > 0) - index--; - - if (SiS_SetFlag & ProgrammingCRT2) { - if (SiS_IF_DEF_CH7005 == 1) { - if (SiS_VBInfo & SetCRT2ToTV) { - index = 0; - } - } - if (SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { - if (SiS_IF_DEF_LVDS == 0) { - if ((SiS_VBType & VB_SIS301B) - || (SiS_VBType & VB_SIS302B)) temp = - LCDARefreshIndex[SiS_LCDResInfo]; /*301b */ - else - temp = LCDRefreshIndex[SiS_LCDResInfo]; - if (index > temp) { - index = temp; - } - } else { - index = 0; - } - } - } + if(SiS_LCDInfo & LCDNonExpanding) tempbx += 3; - RefreshRateTableIndex = SiS_EModeIDTable[ModeIdIndex].REFindex; - ModeNo = SiS_RefIndex[RefreshRateTableIndex].ModeID; - i = 0; - do { - if (SiS_RefIndex[RefreshRateTableIndex + i].ModeID != ModeNo) - break; - temp = SiS_RefIndex[RefreshRateTableIndex + i].Ext_InfoFlag; - temp = temp & ModeInfoFlag; - if (temp < 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(ModeNo <= 0x13) + tempal = SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; + else + tempal = SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; - i--; - if ((SiS_SetFlag & ProgrammingCRT2)) { - temp = - SiS_AjustCRT2Rate (ROMAddr, ModeNo, ModeIdIndex, - RefreshRateTableIndex, &i); - } - return (RefreshRateTableIndex + i); /*return(0x01|(temp1<<1)); */ + *CRT2Index = tempbx; + *ResIndex = tempal & 0x1F; } -BOOLEAN -SiS_AjustCRT2Rate (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex, USHORT * i) +/* TW: New from 650/301LV BIOS */ +void +SiS_GetCRT2Part2Ptr(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,USHORT *CRT2Index, + USHORT *ResIndex) { - USHORT tempax, tempbx, resinfo; - USHORT modeflag, infoflag; + USHORT tempbx,tempal; - if (ModeNo <= 0x13) { - modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ModeFlag */ - } else { - modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - } + if(ModeNo <= 0x13) + tempal = SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; + else + tempal = SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; - resinfo = SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; - tempbx = SiS_RefIndex[RefreshRateTableIndex + (*i)].ModeID; - tempax = 0; - if (SiS_IF_DEF_LVDS == 0) { - if (SiS_VBInfo & SetCRT2ToRAMDAC) { - tempax = tempax | SupportRAMDAC2; - } - if (SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { /*301b */ - tempax = tempax | SupportLCD; - if (SiS_LCDResInfo != Panel1280x1024) { - if (SiS_LCDResInfo != Panel1280x960) { - if (SiS_LCDInfo & LCDNonExpanding) { - if (resinfo >= 9) { - tempax = 0; - return (0); - } - } - } - } - } - if (SiS_VBInfo & SetCRT2ToHiVisionTV) { /* for HiTV */ - tempax = 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); - } - } else { - if (SiS_VBInfo & - (SetCRT2ToAVIDEO | SetCRT2ToSVIDEO | - SetCRT2ToSCART)) { - tempax = tempax | SupportTV; - /*301b */ - if ((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B)) { /*301b */ + tempbx = SiS_LCDResInfo - Panel1024x768; - tempax = tempax | SupportTV1024; + if(SiS_LCDInfo & LCDNonExpanding) tempbx += 2; + else if(SiS_SetFlag & LCDVESATiming) tempbx += 4; - } - /*end 301b */ - - if (!(SiS_VBInfo & SetPALTV)) { - if (modeflag & NoSupportSimuTV) { - if (SiS_VBInfo & SetInSlaveMode) { - if (! - (SiS_VBInfo & - SetNotSimuMode)) { - return 0; - } - } - } - } - } - } - } else { /* for LVDS */ - if (SiS_IF_DEF_CH7005 == 1) { - if (SiS_VBInfo & SetCRT2ToTV) { - tempax = tempax | SupportCHTV; - } - } - if (SiS_VBInfo & SetCRT2ToLCD) { - tempax = tempax | SupportLCD; - if (resinfo > 0x08) - return (0); /*1024x768 */ - if (SiS_LCDResInfo < Panel1024x768) { - if (resinfo > 0x07) - return (0); /*800x600 */ - if (resinfo == 0x04) - return (0); /*512x384 */ - } - } - } + *CRT2Index = tempbx; + *ResIndex = tempal & 0x3F; +} - for (; SiS_RefIndex[RefreshRateTableIndex + (*i)].ModeID == tempbx; - (*i)--) { - infoflag = - SiS_RefIndex[RefreshRateTableIndex + (*i)].Ext_InfoFlag; - if (infoflag & tempax) { - return (1); - } - if ((*i) == 0) - break; - } +/* TW: Checked against 650/LVDS (1.10.07) and 630/301B BIOS */ +USHORT +SiS_GetRatePtrCRT2(UCHAR *ROMAddr, USHORT ModeNo, USHORT ModeIdIndex) +{ + SHORT LCDRefreshIndex[] = { 0x00, 0x00, 0x03, 0x01, + 0x01, 0x01, 0x01, 0x01 }; + USHORT RefreshRateTableIndex,i,backup_i; + USHORT modeflag,index,temp; + + if (ModeNo <= 0x13) + modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + else + modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + + if(SiS_IF_DEF_CH70xx != 0) { + if(SiS_VBInfo & SetCRT2ToTV) { + if(modeflag & HalfDCLK) return(0); + } + } + + if(ModeNo < 0x14) return(0xFFFF); + + /* TW: CR33 holds refresh rate index for CRT1 [3:0] and CRT2 [7:4]. + * On LVDS machines, CRT2 index is always 0 and will be + * set to 0 by the following code; this causes the function + * to take the first non-interlaced mode in SiS_Ext2Struct + */ + + index = SiS_GetReg1(SiS_P3d4,0x33); + index >>= SiS_SelectCRT2Rate; + index &= 0x0F; + + 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_SetFlag & ProgrammingCRT2) { + if(SiS_IF_DEF_CH70xx != 0) { + if(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; + } else { + index=0; + } + } + } + + RefreshRateTableIndex = SiS_EModeIDTable[ModeIdIndex].REFindex; + ModeNo = 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++; + } + } + } + + i = 0; + do { + if (SiS_RefIndex[RefreshRateTableIndex+i].ModeID != ModeNo) break; + temp = SiS_RefIndex[RefreshRateTableIndex+i].Ext_InfoFlag; + temp &= ModeInfoFlag; + if(temp < 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++; + } + } + } + i--; + + if((SiS_SetFlag & ProgrammingCRT2) && (!(SiS_VBInfo & DisableCRT2Display))) { + backup_i = i; + if (!(SiS_AdjustCRT2Rate(ROMAddr,ModeNo,ModeIdIndex, + RefreshRateTableIndex,&i))) { + /* TW: This is for avoiding random data to be used; i is + * in an undefined state if no matching CRT2 mode is + * found. + */ + i = backup_i; + } + } + + return(RefreshRateTableIndex + i); +} - for ((*i) = 0;; (*i)++) { - infoflag = - SiS_RefIndex[RefreshRateTableIndex + (*i)].Ext_InfoFlag; - if (SiS_RefIndex[RefreshRateTableIndex + (*i)].ModeID != tempbx) { - return (0); - } - if (infoflag & tempax) { - return (1); - } - } - return (1); +/* Checked against 650/LVDS (1.10.07) BIOS */ +BOOLEAN +SiS_AdjustCRT2Rate(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,USHORT *i) +{ + USHORT tempax,tempbx,resinfo; + USHORT modeflag,infoflag; + + if (ModeNo <= 0x13) + modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + else + modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + + resinfo = SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; + tempbx = SiS_RefIndex[RefreshRateTableIndex + (*i)].ModeID; + + tempax = 0; + if(SiS_IF_DEF_LVDS == 0) { + /* TW: For 301, 301B, 302B, 301LV, 302LV */ + if(SiS_VBInfo & SetCRT2ToRAMDAC) { + tempax |= SupportRAMDAC2; + } + if(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(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); + } + } 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; + } + } + } + } + } + } + } else { + /* TW: for LVDS */ + if(SiS_IF_DEF_CH70xx != 0) { + if(SiS_VBInfo & SetCRT2ToTV) { + tempax |= SupportCHTV; + } + } + if(SiS_VBInfo & SetCRT2ToLCD) { + tempax |= SupportLCD; + if(SiS_LCDResInfo == Panel1280x768) { + /* TW: Bios code makes no sense */ + } else if(SiS_LCDResInfo == Panel1400x1050) { + if((resinfo != 0x15) && (resinfo > 0x09)) return(0); + } else if(SiS_LCDResInfo == Panel1280x1024) { + if(resinfo > 0x09) return(0); + } else if(SiS_LCDResInfo == Panel1024x768) { + if(resinfo > 0x08) return(0); + } else if(SiS_LCDResInfo == 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; + if(infoflag & tempax) { + return(1); + } + if ((*i) == 0) break; + } + /* TW: Look through the whole mode-section of the table from the beginning + * 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) { + return(0); + } + if(infoflag & tempax) { + return(1); + } + } + return(1); } +/* Checked against 650/LVDS (1.10.07) and 650/301LV BIOS */ void -SiS_SaveCRT2Info (USHORT ModeNo) +SiS_SaveCRT2Info(USHORT ModeNo) { - USHORT temp1, temp2; + USHORT temp1,temp2; - SiS_SetReg1 (SiS_P3d4, 0x34, ModeNo); /* reserve CR34 for CRT1 Mode No */ - temp1 = (SiS_VBInfo & SetInSlaveMode) >> 8; - temp2 = ~(SetInSlaveMode >> 8); - SiS_SetRegANDOR (SiS_P3d4, 0x31, temp2, temp1); + /* TW: We store CRT1 ModeNo in CR34 */ + SiS_SetReg1(SiS_P3d4,0x34,ModeNo); + temp1 = (SiS_VBInfo & SetInSlaveMode) >> 8; + temp2 = ~(SetInSlaveMode >> 8); + SiS_SetRegANDOR(SiS_P3d4,0x31,temp2,temp1); } +/* TW: Checked against 650+301, 650/LVDS (1.10.07) and 650/301LV BIOS */ void -SiS_GetVBInfo301 (USHORT BaseAddr, ULONG ROMAddr, USHORT ModeNo, - USHORT ModeIdIndex, PSIS_HW_DEVICE_INFO HwDeviceExtension) +SiS_GetVBInfo301(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo, + USHORT ModeIdIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension) { - USHORT tempax, tempbx, temp; - USHORT modeflag; - UCHAR OutputSelect = *pSiS_OutputSelect; - if (ModeNo <= 0x13) { - modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; - } else { - modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + USHORT tempax,tempbx,temp; + USHORT modeflag, resinfo=0; + UCHAR OutputSelect = *pSiS_OutputSelect; + + if (ModeNo<=0x13) + modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + else { + modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + resinfo = SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; + } + + SiS_SetFlag = 0; + + 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); + } + 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 */ + tempbx |= tempax; + temp = SetCHTVOverScan | SetInSlaveMode | DisableCRT2Display; + temp = 0xFFFF ^ temp; + tempbx &= temp; +#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 "& ..." */ + tempbx |= SetCRT2ToLCDA; + } + /* TW: Inserted from 650/LVDS BIOS: */ + if(SiS_IF_DEF_LVDS == 1) { + if(temp & SetToLCDA) + tempbx |= SetCRT2ToLCDA; + if(temp & 0x08) + tempbx |= SetCRT2ToHiVisionTV; + } } - SiS_SetFlag = 0; - - SiS_ModeType = modeflag & ModeInfoFlag; - tempbx = 0; - if (SiS_BridgeIsOn (BaseAddr)) { - temp = SiS_GetReg1 (SiS_P3d4, 0x30); - tempbx = tempbx | temp; - temp = SiS_GetReg1 (SiS_P3d4, 0x31); - tempax = temp << 8; - tempbx = tempbx | tempax; - temp = SetCHTVOverScan | SetInSlaveMode | DisableCRT2Display; /* ynlai */ - temp = 0xFFFF ^ temp; - tempbx = tempbx & temp; -#ifdef CONFIG_FB_SIS_315 - /*301b */ - if ((SiS_VBType & VB_SIS302B)) { - temp = SiS_GetReg1 (SiS_P3d4, 0x38); - if (temp == 0x03) - tempbx = tempbx | (SetCRT2ToLCDA); - } - /*end301b */ #endif - if (SiS_IF_DEF_LVDS == 0) { - if (SiS_IF_DEF_HiVision) - temp = 0x80FC; - else - temp = 0x807C; - } else { - if (SiS_IF_DEF_CH7005 == 1) { - temp = SetCRT2ToTV | SetCRT2ToLCD; - } else { - temp = SetCRT2ToLCD; - } - } - if (!(tempbx & temp)) { - tempax = tempax | DisableCRT2Display; - tempbx = 0; - } - - if (SiS_IF_DEF_LVDS == 0) { - if (tempbx & SetCRT2ToLCDA) { /*301b */ - tempbx = - tempbx & (0xFF00 | SwitchToCRT2 | - SetSimuScanMode); - } else if (tempbx & SetCRT2ToRAMDAC) { - tempbx = - tempbx & (0xFF00 | SetCRT2ToRAMDAC | - SwitchToCRT2 | SetSimuScanMode); - } else if ((tempbx & SetCRT2ToLCD) && (!(SiS_VBType & VB_NoLCD))) { /*301dlvds */ - tempbx = - tempbx & (0xFF00 | SetCRT2ToLCD | - SwitchToCRT2 | SetSimuScanMode); - } else if (tempbx & SetCRT2ToSCART) { - tempbx = - tempbx & (0xFF00 | SetCRT2ToSCART | - SwitchToCRT2 | SetSimuScanMode); - tempbx = tempbx | SetPALTV; - } else if (tempbx & SetCRT2ToHiVisionTV) { - tempbx = - tempbx & (0xFF00 | SetCRT2ToHiVisionTV | - SwitchToCRT2 | SetSimuScanMode); - /* ynlai begin */ - tempbx = tempbx | SetPALTV; - /* ynlai end */ - } + if(SiS_IF_DEF_LVDS == 0) { + temp = SetCRT2ToLCDA | SetCRT2ToSCART | SetCRT2ToLCD | + SetCRT2ToRAMDAC | SetCRT2ToSVIDEO | SetCRT2ToAVIDEO; /* = 0x807C; */ + if(SiS_IF_DEF_HiVision == 1) + temp |= SetCRT2ToHiVisionTV; /* = 0x80FC; */ + } else { + /* TW: Inserted entire 315-section */ + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(SiS_IF_DEF_CH70xx != 0) + temp = SetCRT2ToLCDA | SetCRT2ToSCART | + SetCRT2ToLCD | SetCRT2ToHiVisionTV | + SetCRT2ToAVIDEO | SetCRT2ToSVIDEO; /* 0x80bc */ + else + temp = SetCRT2ToLCDA | SetCRT2ToLCD; } else { - if (SiS_IF_DEF_CH7005 == 1) { - if (tempbx & SetCRT2ToTV) - tempbx = - tempbx & (0xFF00 | SetCRT2ToTV | - SwitchToCRT2 | - SetSimuScanMode); - } - if (tempbx & SetCRT2ToLCD) - tempbx = - tempbx & (0xFF00 | SetCRT2ToLCD | - SwitchToCRT2 | SetSimuScanMode); - } - if (tempax & DisableCRT2Display) { - if (!(tempbx & (SwitchToCRT2 | SetSimuScanMode))) { - tempbx = SetSimuScanMode | DisableCRT2Display; - } - } - if (!(tempbx & DriverMode)) { - tempbx = tempbx | SetSimuScanMode; - } - if (!(tempbx & SetSimuScanMode)) { - if (tempbx & SwitchToCRT2) { - if (!(modeflag & CRT2Mode)) { - tempbx = tempbx | SetSimuScanMode; - } - } else { - if (! - (SiS_BridgeIsEnable - (BaseAddr, HwDeviceExtension))) { - if (!(tempbx & DriverMode)) { - if (SiS_BridgeInSlave ()) { - tempbx = - tempbx | - SetInSlaveMode; - } - } - } - } - } - if (!(tempbx & DisableCRT2Display)) { - if (tempbx & DriverMode) { - if (tempbx & SetSimuScanMode) { - if (!(modeflag & CRT2Mode)) { - tempbx = - tempbx | SetInSlaveMode; - if (SiS_IF_DEF_LVDS == 0) { - if (tempbx & - SetCRT2ToTV) { - if (! - (tempbx & - SetNotSimuMode)) - SiS_SetFlag = - SiS_SetFlag - | - TVSimuMode; - } - } - } - } - } else { - tempbx = tempbx | SetInSlaveMode; - if (SiS_IF_DEF_LVDS == 0) { - if (tempbx & SetCRT2ToTV) { - if (!(tempbx & SetNotSimuMode)) - SiS_SetFlag = - SiS_SetFlag | - TVSimuMode; - } - } + if(SiS_IF_DEF_CH70xx != 0) + temp = SetCRT2ToTV | SetCRT2ToLCD; + else + temp = SetCRT2ToLCD; + } + } + + if(!(tempbx & temp)) { + tempax = DisableCRT2Display; + tempbx = 0; + } + + if(SiS_IF_DEF_LVDS==0) { + if(tempbx & SetCRT2ToLCDA) { + tempbx &= (0xFF00|SwitchToCRT2|SetSimuScanMode); + } else if(tempbx & SetCRT2ToRAMDAC) { + tempbx &= (0xFF00|SetCRT2ToRAMDAC|SwitchToCRT2|SetSimuScanMode); + } else if((tempbx & SetCRT2ToLCD) && (!(SiS_VBType & VB_NoLCD)) ){ + tempbx &= (0xFF00|SetCRT2ToLCD|SwitchToCRT2|SetSimuScanMode); + } else if(tempbx & SetCRT2ToSCART){ + tempbx &= (0xFF00|SetCRT2ToSCART|SwitchToCRT2|SetSimuScanMode); + tempbx |= SetPALTV; + } else 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(tempbx & SetCRT2ToTV) + tempbx &= (0xFF00|SetCRT2ToTV|SwitchToCRT2|SetSimuScanMode); + } + if(tempbx & SetCRT2ToLCD) { + tempbx &= (0xFF00|SetCRT2ToLCD|SwitchToCRT2|SetSimuScanMode); + } + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(tempbx & SetCRT2ToLCDA) + 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); } - } - if (SiS_IF_DEF_CH7005 == 1) { - temp = SiS_GetReg1 (SiS_P3d4, 0x35); - if (temp & TVOverScan) - tempbx = tempbx | SetCHTVOverScan; - } - } -#ifdef CONFIG_FB_SIS_300 - /*add PALMN */ - if (SiS_IF_DEF_LVDS == 0) { - if ((HwDeviceExtension->jChipType == SIS_630) || - (HwDeviceExtension->jChipType == SIS_730)) { - if (!(OutputSelect & EnablePALMN)) - SiS_SetRegAND (SiS_P3d4, 0x35, 0x3F); - if (tempbx & SetCRT2ToTV) { - if (tempbx & SetPALTV) { - temp = SiS_GetReg1 (SiS_P3d4, 0x35); - temp = temp & 0xC0; - if (temp == 0x40) - tempbx = tempbx & (~SetPALTV); + } + } + /* 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 & 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; + } + } + } } - } - } - } - /*end add */ + } + } 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(SiS_IF_DEF_LVDS==0) { +#ifdef SIS300 + if((HwDeviceExtension->jChipType==SIS_630)|| + (HwDeviceExtension->jChipType==SIS_730)) { + if(!(OutputSelect & EnablePALMN)) + SiS_SetRegAND(SiS_P3d4,0x35,0x3F); + if(tempbx & SetCRT2ToTV) { + if(tempbx & SetPALTV) { + temp=SiS_GetReg1(SiS_P3d4,0x35); + temp &= 0xC0; + if(temp == 0x40) + tempbx &= (~SetPALTV); + } + } + } #endif -#ifdef CONFIG_FB_SIS_315 - /*add PALMN */ - if (SiS_IF_DEF_LVDS == 0) { - if (!(OutputSelect & EnablePALMN)) - SiS_SetRegAND (SiS_P3d4, 0x38, 0x3F); - if (tempbx & SetCRT2ToTV) { - if (tempbx & SetPALTV) { - temp = SiS_GetReg1 (SiS_P3d4, 0x38); - temp = temp & 0xC0; - if (temp == 0x40) - tempbx = tempbx & (~SetPALTV); - } - } - } - /*end add */ +#ifdef SIS315H + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(!(OutputSelect & EnablePALMN)) + SiS_SetRegAND(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); + } + } + } +#endif + } + + SiS_VBInfo=tempbx; + + /* TW: DevSwitch not supported here */ + +#ifdef TWDEBUG +#ifdef LINUX_KERNEL + printk(KERN_INFO "sisfb: (VBInfo = %x, SetFlag = %x)\n", SiS_VBInfo, SiS_SetFlag); +#endif +#ifdef LINUX_XF86 + xf86DrvMsg(0, X_INFO, "(init301: VBInfo = %x, SetFlag = %x)\n", SiS_VBInfo, SiS_SetFlag); #endif - SiS_VBInfo = tempbx; +#endif + +#if 0 + /* From 650/301LV BIOS: */ + 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 */ + } void -SiS_GetRAMDAC2DATA (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex) +SiS_GetRAMDAC2DATA(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension) { - USHORT tempax, tempbx, temp; - USHORT temp1, temp2, modeflag = 0, tempcx; - - USHORT StandTableIndex, CRT1Index; - USHORT ResInfo, DisplayType; - SiS_LVDSCRT1DataStruct *LVDSCRT1Ptr = NULL; - - SiS_RVBHCMAX = 1; - 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]; - } else { - if (((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B)) - && (SiS_VBInfo & SetCRT2ToLCDA)) { - /*add crt1ptr */ - 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_CHTVCRT1UNTSC; - break; - case 13: - LVDSCRT1Ptr = SiS_CHTVCRT1ONTSC; - break; - case 14: - LVDSCRT1Ptr = SiS_CHTVCRT1UPAL; - break; - case 15: - LVDSCRT1Ptr = SiS_CHTVCRT1OPAL; - 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]; - } /*add 301b */ - else { - modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - CRT1Index = - SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; - CRT1Index = 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]; - } - } - if (temp1 & 0x01) - tempbx = tempbx | 0x0100; - if (temp1 & 0x20) - tempbx = tempbx | 0x0200; - tempax = tempax + 5; - if (modeflag & Charx8Dot) - tempax = tempax * 8; - else - tempax = tempax * 9; - - SiS_VGAHT = tempax; - SiS_HT = tempax; - tempbx++; - SiS_VGAVT = tempbx; - SiS_VT = tempbx; + USHORT tempax,tempbx,temp; + USHORT temp1,temp2,modeflag=0,tempcx; + USHORT StandTableIndex,CRT1Index; + USHORT ResInfo,DisplayType; + SiS_LVDSCRT1DataStruct *LVDSCRT1Ptr=NULL; + + SiS_RVBHCMAX=1; + 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]; + + } else { + + if( (SiS_VBType & VB_SIS301BLV302BLV) && (SiS_VBInfo&SetCRT2ToLCDA) ) { + + 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; + + } + 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]; + + } 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]; + + } + + } + + if(temp1&0x01) tempbx |= 0x0100; + if(temp1&0x20) tempbx |= 0x0200; + tempax += 5; + if(modeflag & Charx8Dot) tempax *= 8; + else tempax *= 9; + + SiS_VGAHT = SiS_HT = tempax; + tempbx++; + SiS_VGAVT = SiS_VT = tempbx; } void -SiS_UnLockCRT2 (PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr) +SiS_UnLockCRT2(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr) { - if (HwDeviceExtension->jChipType >= SIS_315H) { - SiS_SetRegANDOR (SiS_Part1Port, 0x2f, 0xFF, 0x01); - } else { - SiS_SetRegANDOR (SiS_Part1Port, 0x24, 0xFF, 0x01); - } + if(HwDeviceExtension->jChipType >= SIS_315H) + SiS_SetRegOR(SiS_Part1Port,0x2f,0x01); + else + SiS_SetRegOR(SiS_Part1Port,0x24,0x01); } void -SiS_LockCRT2 (PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr) +SiS_LockCRT2(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr) { - if (HwDeviceExtension->jChipType >= SIS_315H) { - SiS_SetRegANDOR (SiS_Part1Port, 0x2F, 0xFE, 0x00); - } else { - SiS_SetRegANDOR (SiS_Part1Port, 0x24, 0xFE, 0x00); - } + if(HwDeviceExtension->jChipType >= SIS_315H) + SiS_SetRegAND(SiS_Part1Port,0x2F,0xFE); + else + SiS_SetRegAND(SiS_Part1Port,0x24,0xFE); } void -SiS_EnableCRT2 () +SiS_EnableCRT2() { - SiS_SetRegANDOR (SiS_P3c4, 0x1E, 0xFF, 0x20); + SiS_SetRegOR(SiS_P3c4,0x1E,0x20); } +/* Checked against 650/LVDS(1.10.07)/301 and 630/301B BIOS */ void -SiS_DisableBridge (PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr) +SiS_DisableBridge(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr) { + USHORT tempah,temp; + UCHAR *ROMAddr = HwDeviceExtension->pjVirtualRomBase; + + if (SiS_IF_DEF_LVDS == 0) { + + if(SiS_VBType & VB_SIS301BLV302BLV) { /* ===== TW: For 30xB/LV ===== */ + + if(HwDeviceExtension->jChipType < SIS_315H) { + + /* 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); + } + + } else { + + /* 310 series */ + +#if 0 + if(SiS_Is301B(BaseAddr)) { +#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; + } + } +#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(); + } + } + } else { +#endif + SiS_SetRegAND(SiS_Part2Port,0x00,0xDF); + SiS_DisplayOff(); +#if 0 + } +#endif + + 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 */ - USHORT temp1, tempah, temp; - SiS_SetRegANDOR (SiS_P3c4, 0x11, 0xF7, 0x08); -/*SetPanelDelay(1); */ - temp1 = 0x01; - if ((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B)) { /*301b */ - if ((SiS_IsVAMode (BaseAddr))) - temp1 = 0x00; /*no disable vb */ } - if (SiS_IF_DEF_LVDS == 0) { - if (!temp1) { /*301b */ - SiS_SetRegANDOR (SiS_Part2Port, 0x00, 0x0DF, 0x00); /* disable VB */ - SiS_DisplayOff (); - if (HwDeviceExtension->jChipType >= SIS_315H) { /* 310 series */ - SiS_SetRegOR (SiS_Part1Port, 0x00, 0x80); /* alan,BScreenOff */ - } - SiS_SetRegANDOR (SiS_P3c4, 0x32, 0xDF, 0x00); + } else { /* ============ TW: For 301 ================ */ - temp = SiS_GetReg1 (SiS_Part1Port, 0); - SiS_SetRegOR (SiS_Part1Port, 0x00, 0x10); /* alan,BScreenOff */ -/* - if(HwDeviceExtension->jChipType >= SIS_315H) - { - SiS_SetRegAND(SiS_Part1Port,0x2E,0x7F); - } - */ - SiS_SetRegANDOR (SiS_P3c4, 0x1E, 0xDF, 0x00); - SiS_SetReg1 (SiS_Part1Port, 0, temp); - } else { - if ((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B)) { /*301b */ - if (!(SiS_Is301B (BaseAddr))) { - SiS_SetRegAND (SiS_P3c4, 0x32, 0xDF); - if ((!(SiS_IsDualEdge (BaseAddr))) - && (!(SiS_IsVAMode (BaseAddr)))) - tempah = 0x7F; - else if ((!(SiS_IsDualEdge (BaseAddr))) - && (SiS_IsVAMode (BaseAddr))) - tempah = 0xBF; - else - tempah = 0x3F; - SiS_SetRegAND (SiS_Part4Port, 0x1F, - tempah); - } - } + if(HwDeviceExtension->jChipType < SIS_315H) + SiS_SetRegANDOR(SiS_P3c4,0x11,0xF7,0x08); + + SiS_SetRegAND(SiS_Part2Port,0x00,0xDF); /* disable VB */ + SiS_DisplayOff(); + + if(HwDeviceExtension->jChipType >= SIS_315H) + SiS_SetRegOR(SiS_Part1Port,0x00,0x80); + + SiS_SetRegAND(SiS_P3c4,0x32,0xDF); /* disable lock mode */ + + temp = SiS_GetReg1(SiS_Part1Port,0x00); + SiS_SetRegOR(SiS_Part1Port,0x00,0x10); + + SiS_SetRegAND(SiS_P3c4,0x1E,0xDF); /* disable CRT2 */ + SiS_SetReg1(SiS_Part1Port,0x00,temp); + + if(HwDeviceExtension->jChipType < SIS_315H) + SiS_SetRegANDOR(SiS_P3c4,0x11,0xFB,0x04); + + } + + } else { /* ============ TW: For LVDS =============*/ + + if(HwDeviceExtension->jChipType < SIS_315H) { + + /* 300 series */ + + if(SiS_IF_DEF_CH70xx == 1) { + if(SiS_Backup70xx == 0xff) { + SiS_Backup70xx = SiS_GetCH700x(0x0e); + } + SiS_SetCH700x(0x090E); + } + + if(!(SiS_GetReg1(SiS_P3c4,0x11) & 0x08)) { + + if(!(SiS_GetReg1(SiS_P3c4,0x13) & 0x40)) { + + if(!(SiS_CR36BIOSWord23b(HwDeviceExtension))) { + + SiS_WaitVBRetrace(HwDeviceExtension); + + if(!(SiS_GetReg1(SiS_P3c4,0x06) & 0x1c)) { + SiS_DisplayOff(); + } + + SiS_SetRegANDOR(SiS_P3c4,0x11,0xF7,0x08); + SiS_SetPanelDelay(ROMAddr, HwDeviceExtension, 3); + } + } + } + + 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); + + if( (!(SiS_CRT2IsLCD(BaseAddr))) || + (!(SiS_CR36BIOSWord23d(HwDeviceExtension))) ) { + SiS_SetPanelDelay(ROMAddr, HwDeviceExtension, 2); + SiS_SetRegANDOR(SiS_P3c4,0x11,0xFB,0x04); + } + + } else { + + /* 310 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(); } - } else { - if (SiS_IF_DEF_CH7005) { - SiS_SetCH7005 (0x090E); + + if(!(SiS_IsDualEdge(HwDeviceExtension, BaseAddr))) { + SiS_SetCH701x(0x0149); + } else if(SiS_IsTVOrSomething(HwDeviceExtension, BaseAddr)) { + SiS_SetCH701x(0x0149); } - SiS_DisplayOff (); - SiS_SetRegANDOR (SiS_P3c4, 0x32, 0xDF, 0x00); - SiS_SetRegANDOR (SiS_P3c4, 0x1E, 0xDF, 0x00); - SiS_UnLockCRT2 (HwDeviceExtension, BaseAddr); - SiS_SetRegANDOR (SiS_Part1Port, 0x01, 0xFF, 0x80); - SiS_SetRegANDOR (SiS_Part1Port, 0x02, 0xFF, 0x40); } -/*SetPanelDelay(0); */ - SiS_SetRegANDOR (SiS_P3c4, 0x11, 0xFB, 0x04); + + if(!(SiS_IsDualEdge(HwDeviceExtension, BaseAddr))) { + SiS_DisplayOff(); + } else if(!(SiS_IsTVOrSomething(HwDeviceExtension, BaseAddr))) { + SiS_DisplayOff(); + } + + if(!(SiS_IsDualEdge(HwDeviceExtension, BaseAddr))) { + SiS_SetRegOR(SiS_Part1Port,0x00,0x80); + } else if(!(SiS_IsVAMode(HwDeviceExtension, BaseAddr))) { + SiS_SetRegOR(SiS_Part1Port,0x00,0x80); + } + + SiS_SetRegAND(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_IsVAMode(HwDeviceExtension, BaseAddr)) { + SiS_SetRegAND(SiS_Part1Port,0x1e,0xdf); + } + + if(SiS_IsDualEdge(HwDeviceExtension, BaseAddr)) { + SiS_SetRegAND(SiS_Part1Port,0x13,0xff); + } else { + SiS_SetRegAND(SiS_Part1Port,0x13,0xfb); + } + + SiS_UnLockCRT2(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 0 /* TW: BIOS code makes no sense */ + if(SiS_IsVAMode(HwDeviceExtension, BaseAddr)) { + if(!(SiS_IsDualEdge(HwDeviceExtension, BaseAddr))) { + if(SiS_WeHaveBacklightCtrl(HwDeviceExtension, BaseAddr)) { + /* Nothing there! */ + } + } + } +#endif + + } /* 310 series */ + + } /* LVDS */ + } +/* TW: Checked against 650/LVDS(1.10.07)/301 and 630/301B BIOS */ void -SiS_EnableBridge (PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr) +SiS_EnableBridge(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr) { - USHORT temp, tempah; - - SiS_SetRegANDOR (SiS_P3c4, 0x11, 0xFB, 0x00); -/*SetPanelDelay(0); */ - if (SiS_IF_DEF_LVDS == 0) { - if ((!(SiS_IsVAMode (BaseAddr))) - && ((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B))) { - SiS_SetRegANDOR (SiS_Part2Port, 0x00, 0x1F, 0x20); - } else { - temp = SiS_GetReg1 (SiS_P3c4, 0x32); - temp = temp & 0xDF; - if (SiS_BridgeInSlave ()) { - tempah = SiS_GetReg1 (SiS_P3d4, 0x30); - if (!(tempah & SetCRT2ToRAMDAC)) { - temp = temp | 0x20; - } - } - SiS_SetReg1 (SiS_P3c4, 0x32, temp); - SiS_SetRegANDOR (SiS_P3c4, 0x1E, 0xFF, 0x20); - 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 */ + USHORT temp=0,tempah,temp1; + UCHAR *ROMAddr = HwDeviceExtension->pjVirtualRomBase; + + if(SiS_IF_DEF_LVDS == 0) { + + if(SiS_VBType & VB_SIS301BLV302BLV) { /* TW: ====== For 301B ====== */ + + if(HwDeviceExtension->jChipType < SIS_315H) { + + /* 300 series */ + + if(SiS_CRT2IsLCD(BaseAddr)) { + SiS_SetRegAND(SiS_P3c4,0x11,0xFB); + if(!(SiS_CR36BIOSWord23d(HwDeviceExtension))) { + SiS_SetPanelDelay(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); + } + 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); + } + } + } 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(); + } + } + + } else { + + /* 310 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(!(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); + + SiS_SetRegOR(SiS_P3c4,0x1E,0x20); /* enable CRT2 */ + +/* 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); + } + + SiS_SetRegANDOR(SiS_Part2Port,0x00,0x1F,0x20); /* enable VB processor */ + + 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 */ + } +#endif + /* TW: This is done instead: */ + SiS_SetRegOR(SiS_Part4Port,0x1F,0xc0); + +#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); + + tempah = 0xC0; + if(SiS_IsDualEdge(HwDeviceExtension, BaseAddr)) { + tempah = 0x80; + if(!(SiS_IsVAMode(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); + + } else { + + SiS_VBLongWait(); + SiS_DisplayOn(); + if(!(SiS_WeHaveBacklightCtrl(HwDeviceExtension, BaseAddr))) { /* TW: "if" new from 650/301LV BIOS */ + SiS_SetRegAND(SiS_Part1Port,0x00,0x7F); + SiS_VBLongWait(); + } + + } + + /* 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 --- */ + + } + + } else { /* ============ TW: For 301 ================ */ + + if(HwDeviceExtension->jChipType < SIS_315H) + SiS_SetRegANDOR(SiS_P3c4,0x11,0xFB,0x00); + + 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_SetRegANDOR(SiS_P3c4,0x1E,0xFF,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 */ + } + + SiS_SetRegANDOR(SiS_Part2Port,0x00,0x1F,0x20); /* enable VB processor */ + + SiS_VBLongWait(); + SiS_DisplayOn(); + SiS_VBLongWait(); + + if(HwDeviceExtension->jChipType < SIS_315H) + SiS_SetRegANDOR(SiS_P3c4,0x11,0xF7,0x00); + + } + + } else { /* =================== TW: For LVDS ================== */ + + if(HwDeviceExtension->jChipType < SIS_315H) { + + /* 300 series */ + + if(SiS_CRT2IsLCD(BaseAddr)) { + SiS_SetRegAND(SiS_P3c4,0x11,0xFB); + if(!(SiS_CR36BIOSWord23d(HwDeviceExtension))) { + SiS_SetPanelDelay(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); + } else { + SiS_SetRegANDOR(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_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); + } + SiS_WaitVBRetrace(HwDeviceExtension); + SiS_SetRegAND(SiS_P3c4,0x11,0xF7); + } + } + } + + } else { + + /* 310 series */ + +#if 0 /* BIOS code makes no sense */ + if(SiS_IsVAMode()) { + if(SiS_IsLCDOrLCDA()) { + } + } +#endif - } - SiS_SetRegANDOR (SiS_Part2Port, 0x00, 0x1F, 0x20); + SiS_EnableCRT2(); + SiS_UnLockCRT2(HwDeviceExtension, BaseAddr); - 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 */ - } + SiS_SetRegAND(SiS_Part1Port,0x2e,0xf7); - SiS_SetRegANDOR (SiS_Part2Port, 0x00, 0x1F, 0x20); - SiS_VBLongWait (); - SiS_DisplayOn (); - SiS_VBLongWait (); - } - /*add301b */ - if ((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B)) { - if (!(SiS_Is301B (BaseAddr))) { - temp = SiS_GetReg1 (SiS_Part1Port, 0x2E); - if (!(temp & 0x80)) - SiS_SetRegOR (SiS_Part1Port, 0x2E, - 0x80); - if ((!(SiS_IsDualEdge (BaseAddr))) - && (!(SiS_IsVAMode (BaseAddr)))) - tempah = 0x80; - else if ((!(SiS_IsDualEdge (BaseAddr))) - && (SiS_IsVAMode (BaseAddr))) - tempah = 0x40; - else - tempah = 0xC0; - SiS_SetRegOR (SiS_Part4Port, 0x1F, tempah); - } - } - /*end 301b */ - } else { - /*LVDS*/ SiS_EnableCRT2 (); - SiS_DisplayOn (); - SiS_UnLockCRT2 (HwDeviceExtension, BaseAddr); - SiS_SetRegANDOR (SiS_Part1Port, 0x02, 0xBF, 0x00); - if (SiS_BridgeInSlave ()) { - SiS_SetRegANDOR (SiS_Part1Port, 0x01, 0x1F, 0x00); - } else { - SiS_SetRegANDOR (SiS_Part1Port, 0x01, 0x1F, 0x40); - } - if (SiS_IF_DEF_CH7005) { - SiS_SetCH7005 (0x0B0E); - } - } -/*SetPanelDelay(1); */ - SiS_SetRegANDOR (SiS_P3c4, 0x11, 0xF7, 0x00); + if(SiS_IF_DEF_CH70xx == 2) { + temp = SiS_GetCH701x(0x66); + temp &= 0x20; + SiS_Chrontel701xOff(); + } + + SiS_SetRegAND(SiS_Part1Port,0x2e,0x7f); + + temp1 = SiS_GetReg1(SiS_Part1Port,0x2E); + if (!(temp1 & 0x80)) + SiS_SetRegOR(SiS_Part1Port,0x2E,0x80); + + if(SiS_IF_DEF_CH70xx == 2) { + if(temp) { + SiS_Chrontel701xOn(); + } + } + + if(SiS_IsVAMode(HwDeviceExtension, BaseAddr)) { + SiS_SetRegOR(SiS_Part1Port,0x1E,0x20); + } + + if(!(SiS_WeHaveBacklightCtrl(HwDeviceExtension, BaseAddr))) { + SiS_SetRegAND(SiS_Part1Port,0x00,0x7f); + } + + if(SiS_IF_DEF_CH70xx == 2) { + + if(SiS_IsTVOrSomething(HwDeviceExtension, BaseAddr)) { + SiS_Chrontel701xOn2(HwDeviceExtension, BaseAddr); + } + + if(SiS_IsVAMode(HwDeviceExtension, BaseAddr)) { + SiS_ChrontelDoSomething1(HwDeviceExtension, BaseAddr); + } else if(SiS_IsLCDOrLCDA(HwDeviceExtension, BaseAddr)) { + SiS_ChrontelDoSomething1(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); +/* } */ + } + } + } + + } /* 310 series */ + + } /* LVDS */ + +} + +BOOLEAN +SiS_CR36BIOSWord23b(PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT temp,temp1; + UCHAR *ROMAddr; + + if((ROMAddr = (UCHAR *)HwDeviceExtension->pjVirtualRomBase)) { + temp = SiS_GetReg1(SiS_P3d4,0x36) & 0xff; + temp >>= 4; + temp = 1 << temp; + temp1 = (ROMAddr[0x23c] << 8) | ROMAddr[0x23b]; + if(temp1 & temp) return(1); + else return(0); + } else { + return(0); + } +} + +BOOLEAN +SiS_CR36BIOSWord23d(PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT temp,temp1; + UCHAR *ROMAddr; + + if((ROMAddr = (UCHAR *)HwDeviceExtension->pjVirtualRomBase)) { + temp = SiS_GetReg1(SiS_P3d4,0x36) & 0xff; + temp >>= 4; + temp = 1 << temp; + temp1 = (ROMAddr[0x23e] << 8) | ROMAddr[0x23d]; + if(temp1 & temp) return(1); + else return(0); + } else { + return(0); + } } void -SiS_SetPanelDelay (USHORT DelayTime) +SiS_SetPanelDelay(UCHAR *ROMAddr, PSIS_HW_DEVICE_INFO HwDeviceExtension, + USHORT DelayTime) { - USHORT PanelID; + USHORT PanelID, DelayIndex, Delay, temp; - PanelID = SiS_GetReg1 (SiS_P3d4, 0x36); - PanelID = PanelID >> 4; + 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); + } + + if( (SiS_VBType & VB_SIS301BLV302BLV) && (!(temp & 0x10)) ) { + PanelID = 0x12; + } else { + PanelID = SiS_GetReg1(SiS_P3d4,0x36); + } + + DelayIndex = PanelID >> 4; + + 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]; + } + } + } else { + if(ROMAddr[0x13c] & 0x40) { + if(!(DelayTime & 0x01)) { + Delay = (USHORT)ROMAddr[0x141]; + } else { + Delay = (USHORT)ROMAddr[0x142]; + if(DelayTime & 0x04) Delay = 0x190; + } + } + } + } + } + SiS_ShortDelay(Delay); +} - if (DelayTime == 0) - SiS_LCD_Wait_Time (SiS_PanelDelayTbl[PanelID].timer[0]); - else - SiS_LCD_Wait_Time (SiS_PanelDelayTbl[PanelID].timer[1]); +void +SiS_LongDelay(USHORT delay) +{ + while(delay--) { + SiS_GenericDelay(0x19df); /* 6623 */ + } } void -SiS_LCD_Wait_Time (UCHAR DelayTime) +SiS_ShortDelay(USHORT delay) { - USHORT i, j; - ULONG temp, flag; - - flag = 0; - for (i = 0; i < DelayTime; i++) { - for (j = 0; j < 66; j++) { - temp = SiS_GetReg3 (0x61); - temp = temp & 0x10; - if (temp == flag) - continue; - flag = temp; - } - } + while(delay--) { + SiS_GenericDelay(0x42); /* 66 */ + } } -/*301b*/ +void +SiS_GenericDelay(USHORT delay) +{ + USHORT temp,flag; + + flag = SiS_GetReg3(0x61) & 0x10; + + while(delay) { + temp = SiS_GetReg3(0x61) & 0x10; + if(temp == flag) continue; + flag = temp; + delay--; + } +} BOOLEAN -SiS_Is301B (USHORT BaseAddr) +SiS_Is301B(USHORT BaseAddr) { - USHORT flag; - flag = SiS_GetReg1 (SiS_Part4Port, 0x01); - if (flag > (0x0B0)) - return (0); /*301b */ - else - return (1); + USHORT flag; + + flag = SiS_GetReg1(SiS_Part4Port,0x01); + if(flag >= 0x0B0) return(1); + else return(0); } BOOLEAN -SiS_IsDualEdge (USHORT BaseAddr) +SiS_CRT2IsLCD(USHORT BaseAddr) { -#ifdef CONFIG_FB_SIS_315 - USHORT flag; - flag = SiS_GetReg1 (SiS_P3d4, 0x38); - if (flag & EnableDualEdge) - return (0); - else - return (1); -#endif - return (1); + USHORT flag; + + flag = SiS_GetReg1(SiS_P3d4,0x30); + if(flag & 0x20) return(1); + else return(0); } BOOLEAN -SiS_IsVAMode (USHORT BaseAddr) +SiS_IsDualEdge(PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr) { - USHORT flag; - flag = SiS_GetReg1 (SiS_P3d4, 0x38); -#ifdef CONFIG_FB_SIS_315 - if ((flag & EnableDualEdge) && (flag & SetToLCDA)) - return (0); - else - return (1); +#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); + } else #endif - return (1); + return(0); } +/* TW: Inverted result! */ BOOLEAN -SiS_IsDisableCRT2 (USHORT BaseAddr) +SiS_IsVAMode(PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr) { - USHORT flag; - flag = SiS_GetReg1 (SiS_P3d4, 0x30); - if (flag & 0x20) - return (0); /*301b */ - else - return (1); -} +#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); + } else +#endif + return(0); + } -/*end 301b*/ +BOOLEAN +SiS_WeHaveBacklightCtrl(PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr) +{ +#ifdef SIS315H + USHORT flag; + + if(HwDeviceExtension->jChipType >= SIS_315H) { + flag = SiS_GetReg1(SiS_P3d4,0x79); + if(flag & 0x10) return(1); + else return(0); + } else +#endif + return(0); + } +#if 0 BOOLEAN -SiS_BridgeIsOn (USHORT BaseAddr) +SiS_Is315E(PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr) { - USHORT flag; +#ifdef SIS315H + USHORT flag; + + if(HwDeviceExtension->jChipType >= SIS_315H) { + flag = SiS_GetReg1(SiS_P3d4,0x5f); + if(flag & 0x10) return(1); + else return(0); + } else +#endif + return(0); +} +#endif - if (SiS_IF_DEF_LVDS == 1) { - return (1); - } else { - flag = SiS_GetReg1 (SiS_Part4Port, 0x00); - if ((flag == 1) || (flag == 2)) - return (1); /*301b */ - else - return (0); - } +BOOLEAN +SiS_IsYPbPr(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); + } else +#endif + return(0); } BOOLEAN -SiS_BridgeIsEnable (USHORT BaseAddr, PSIS_HW_DEVICE_INFO HwDeviceExtension) +SiS_IsTVOrSomething(PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr) { - USHORT flag; - - if (SiS_BridgeIsOn (BaseAddr) == 0) { - flag = SiS_GetReg1 (SiS_Part1Port, 0x0); - if (HwDeviceExtension->jChipType < SIS_315H) { /* 300 series */ - if (flag & 0x0a0) { - return 1; - } else { - return 0; - } - } else { /* 310 series */ + 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); + } else +#endif + { + flag = SiS_GetReg1(SiS_P3d4,0x30); + if(flag & SetCRT2ToTV) return(1); + } + return(0); +} - if (flag & 0x050) { - return 1; - } else { - return 0; - } +BOOLEAN +SiS_IsLCDOrLCDA(PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr) +{ + USHORT flag; + +#ifdef SIS315H + if(HwDeviceExtension->jChipType >= SIS_315H) { + flag = SiS_GetReg1(SiS_P3d4,0x30); + if(flag & SetCRT2ToLCD) return(1); + flag = SiS_GetReg1(SiS_P3d4,0x38); + if(flag & SetToLCDA) return(1); + else return(0); + } else +#endif + { + flag = SiS_GetReg1(SiS_P3d4,0x30); + if(flag & SetCRT2ToLCD) return(1); + } + return(0); - } - } - return 0; } BOOLEAN -SiS_BridgeInSlave () +SiS_IsDisableCRT2(USHORT BaseAddr) { - USHORT flag1; + USHORT flag; - flag1 = SiS_GetReg1 (SiS_P3d4, 0x31); - if (flag1 & (SetInSlaveMode >> 8)) { - return 1; - } else { - return 0; - } + flag = SiS_GetReg1(SiS_P3d4,0x30); + if(flag & 0x20) return(0); + else return(1); } BOOLEAN -SiS_GetLCDResInfo301 (ULONG ROMAddr, USHORT SiS_P3d4, USHORT ModeNo, - USHORT ModeIdIndex) +SiS_BridgeIsOn(USHORT BaseAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension) { - USHORT temp, modeflag, resinfo = 0; + USHORT flag; - SiS_LCDResInfo = 0; - SiS_LCDTypeInfo = 0; - SiS_LCDInfo = 0; + if(SiS_IF_DEF_LVDS == 1) { + return(0); /* TW: Changed from 1 to 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 + } +} - if (ModeNo <= 0x13) { - modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ModeFlag */ - } else { - modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - resinfo = SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; /*si+Ext_ResInfo */ - } - if (!(SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA))) { - return 0; - } - if (!(SiS_VBInfo & (SetSimuScanMode | SwitchToCRT2))) { - return 0; - } - temp = SiS_GetReg1 (SiS_P3d4, 0x36); - SiS_LCDTypeInfo = temp >> 4; - SiS_LCDResInfo = temp & 0x0F; - if (SiS_IF_DEF_LVDS == 0) { - if (SiS_LCDResInfo < Panel1024x768) - SiS_LCDResInfo = Panel1024x768; - } else { - if (SiS_LCDResInfo < Panel800x600) - SiS_LCDResInfo = Panel800x600; - } - if (SiS_LCDResInfo > Panel640x480) - SiS_LCDResInfo = Panel1024x768; - - temp = SiS_GetReg1 (SiS_P3d4, 0x37); - SiS_LCDInfo = temp; - - if (SiS_IF_DEF_LVDS == 1) { - if (modeflag & HalfDCLK) { - if (SiS_IF_DEF_TRUMPION == 0) { - if (!(SiS_LCDInfo & LCDNonExpanding)) { - if (ModeNo > 0x13) { - if (SiS_LCDResInfo == - Panel1024x768) { - if (resinfo == 4) { /* 512x384 */ - SiS_SetFlag = - SiS_SetFlag - | - EnableLVDSDDA; - } - } else { - if (SiS_LCDResInfo == - Panel800x600) { - if (resinfo == 3) { /*400x300 */ - SiS_SetFlag - = - SiS_SetFlag - | - EnableLVDSDDA; - } - } - } - } - } else { - SiS_SetFlag = - SiS_SetFlag | EnableLVDSDDA; - } - } else { - SiS_SetFlag = SiS_SetFlag | EnableLVDSDDA; - } - } - } +BOOLEAN +SiS_BridgeIsEnable(USHORT BaseAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT flag; + + if(SiS_BridgeIsOn(BaseAddr,HwDeviceExtension) == 0) { + flag=SiS_GetReg1(SiS_Part1Port,0x00); + if(HwDeviceExtension->jChipType < SIS_315H) { + /* 300 series */ + if(flag & 0x0a0) return 1; + else return 0; + } else { + /* 310 series */ + if(flag & 0x050) return 1; + else return 0; + } + } + return 0; +} - if (SiS_VBInfo & SetInSlaveMode) { - if (SiS_VBInfo & SetNotSimuMode) { - SiS_SetFlag = SiS_SetFlag | LCDVESATiming; - } - } else { - SiS_SetFlag = SiS_SetFlag | LCDVESATiming; - } - return 1; +BOOLEAN +SiS_BridgeInSlave() +{ + USHORT flag1; + + flag1 = SiS_GetReg1(SiS_P3d4,0x31); + if(flag1 & (SetInSlaveMode >> 8)) return 1; + else return 0; } +/* TW: New from 650/301LV BIOS */ void -SiS_PresetScratchregister (USHORT SiS_P3d4, - PSIS_HW_DEVICE_INFO HwDeviceExtension) +SiS_SetHiVision(USHORT BaseAddr,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); */ + 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; + } + } + } } -void -SiS_LongWait () +/* 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) { - USHORT i; + USHORT temp,modeflag,resinfo=0; + + SiS_LCDResInfo = 0; + SiS_LCDTypeInfo = 0; + SiS_LCDInfo = 0; + + if (ModeNo<=0x13) { + modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + } else { + modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + resinfo = SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; + } + + if(!(SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA))) return 0; + + if(!(SiS_VBInfo & (SetSimuScanMode | SwitchToCRT2))) return 0; + + temp = SiS_GetReg1(SiS_P3d4,0x36); + + /*fstn*: Fake CR36 (TypeInfo 2, ResInfo Panel320x480) */ + if(SiS_IF_DEF_FSTN){ + temp = 0x20 | Panel320x480; + SiS_SetReg1(SiS_P3d4,0x36,temp); + } + + SiS_LCDTypeInfo = temp >> 4; /* BIOS uses entire CR36 - 1 */ + SiS_LCDResInfo = temp & 0x0F; + + if(SiS_IF_DEF_FSTN){ + SiS_LCDResInfo = Panel320x480; + } + + if(SiS_IF_DEF_LVDS == 0) { + if(SiS_LCDResInfo < PanelMin301) SiS_LCDResInfo = PanelMin301; + } else { + if(SiS_LCDResInfo < PanelMinLVDS) SiS_LCDResInfo = PanelMinLVDS; + } + + if(SiS_LCDResInfo > PanelMax) SiS_LCDResInfo = Panel1024x768; + + temp=SiS_GetReg1(SiS_P3d4,0x37); + if(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? */ + } + } + } - i = SiS_GetReg1 (SiS_P3c4, 0x1F); - if (!(i & 0xC0)) { +#ifdef LINUX_KERNEL + printk(KERN_INFO "sisfb: (LCDInfo = 0x%x LCDResInfo = 0x%x LCDTypeInfo = 0x%x)\n", + SiS_LCDInfo, SiS_LCDResInfo, SiS_LCDTypeInfo); +#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); +#endif - for (i = 0; i < 0xFFFF; i++) { - if (!(SiS_GetReg2 (SiS_P3da) & 0x08)) - break; - } - for (i = 0; i < 0xFFFF; i++) { - if ((SiS_GetReg2 (SiS_P3da) & 0x08)) - break; - } - } + /* 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; + } + } + + /* TW: wdr: if (VBInfo & LCD) && (VBInfo & (SetSimuScanMode | SwitchToCRT2)) { */ + if(SiS_VBInfo & SetInSlaveMode){ + if(SiS_VBInfo & SetNotSimuMode){ + SiS_SetFlag |= LCDVESATiming; + } + } else { + SiS_SetFlag |= LCDVESATiming; + } + + return 1; } void -SiS_VBLongWait () +SiS_PresetScratchregister(USHORT SiS_P3d4,PSIS_HW_DEVICE_INFO HwDeviceExtension) { - USHORT tempal, temp, i, j; - - if (!(SiS_VBInfo & SetCRT2ToTV)) { - temp = 0; - for (i = 0; i < 3; i++) { - for (j = 0; j < 100; j++) { - tempal = SiS_GetReg2 (SiS_P3da); - if (temp & 0x01) { /* VBWaitMode2 */ - if ((tempal & 0x08)) { - continue; - } - if (!(tempal & 0x08)) { - break; - } - } else { /* VBWaitMode1 */ - if (!(tempal & 0x08)) { - continue; - } - if ((tempal & 0x08)) { - break; - } - } - } - temp = temp ^ 0x01; - } - } else { - SiS_LongWait (); - } - return; + /*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); */ } -BOOLEAN -SiS_WaitVBRetrace (USHORT BaseAddr) +void +SiS_LongWait() { - USHORT temp; + USHORT i; + + i=SiS_GetReg1(SiS_P3c4,0x1F); + if(!(i&0xC0)) { + + for(i=0; i<0xFFFF; i++) { + if(!(SiS_GetReg2(SiS_P3da) & 0x08)) + break; + } + for(i=0; i<0xFFFF; i++) { + if((SiS_GetReg2(SiS_P3da) & 0x08)) + break; + } + } +} - return 0; +void +SiS_VBLongWait() +{ + if(!(SiS_VBInfo & SetCRT2ToTV)) { + SiS_VBWait(); + } else { + SiS_LongWait(); + } + return; +} - temp = SiS_GetReg1 (SiS_Part1Port, 0x00); - if (!(temp & 0x80)) { - return 0; - } +void +SiS_VBWait(void) +{ + 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; + } else { + if(!(tempal&0x08)) continue; + if((tempal&0x08)) break; + } + } + temp=temp^0x01; + } +} - for (temp = 0; temp == 0;) { - temp = SiS_GetReg1 (SiS_Part1Port, 0x25); - temp = temp & 0x01; - } - for (; temp > 0;) { - temp = SiS_GetReg1 (SiS_Part1Port, 0x25); - temp = temp & 0x01; - } - return 1; +void +SiS_WaitVBRetrace(PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + if(HwDeviceExtension->jChipType < SIS_315H) { + if(SiS_VBType & VB_SIS301BLV302BLV) { + if(!(SiS_GetReg1(SiS_Part1Port,0x00) & 0x20)) return; + } + if(!(SiS_GetReg1(SiS_Part1Port,0x00) & 0x80)) { + SiS_WaitRetrace1(HwDeviceExtension); + } else { + SiS_WaitRetrace2(HwDeviceExtension); + } + } else { + if(!(SiS_GetReg1(SiS_Part1Port,0x00) & 0x40)) { + SiS_WaitRetrace1(HwDeviceExtension); + } else { + SiS_WaitRetrace2(HwDeviceExtension); + } + } } void -SiS_SetRegANDOR (USHORT Port, USHORT Index, USHORT DataAND, USHORT DataOR) +SiS_WaitRetrace1(PSIS_HW_DEVICE_INFO HwDeviceExtension) { - USHORT temp; + USHORT i,watchdog; + + if(HwDeviceExtension->jChipType >= SIS_315H) { + if(SiS_GetReg1(SiS_P3c4,0x1f) & 0xc0) return; + watchdog = 65535; + while( (SiS_GetReg2(SiS_P3da) & 0x08) && --watchdog); + watchdog = 65535; + while( (!(SiS_GetReg2(SiS_P3da) & 0x08)) && --watchdog); + } else { +#if 0 /* TW: Not done in A901 BIOS */ + if(SiS_VBType & VB_SIS301BLV302BLV) { + if(SiS_GetReg1(SiS_P3c4,0x1f) & 0xc0) return; + } +#endif + for(i=0; i<10; i++) { + watchdog = 65535; + while( (SiS_GetReg2(SiS_P3da) & 0x08) && --watchdog); + if(watchdog) break; + } + for(i=0; i<10; i++) { + watchdog = 65535; + while( (!(SiS_GetReg2(SiS_P3da) & 0x08)) && --watchdog); + if(watchdog) break; + } + } +} - temp = SiS_GetReg1 (Port, Index); /* SiS_Part1Port index 02 */ - temp = (temp & (DataAND)) | DataOR; - SiS_SetReg1 (Port, Index, temp); +void +SiS_WaitRetrace2(PSIS_HW_DEVICE_INFO HwDeviceExtension) +{ + USHORT i,watchdog,temp; + + if(HwDeviceExtension->jChipType >= SIS_315H) { + watchdog = 65535; + while( (SiS_GetReg1(SiS_Part1Port,0x30) & 0x02) && --watchdog); + watchdog = 65535; + while( (!(SiS_GetReg1(SiS_Part1Port,0x30) & 0x02)) && --watchdog); + } else { + for(i=0; i<10; i++) { + watchdog = 65535; + while( (temp = SiS_GetReg1(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); + if(watchdog) break; + } + } } +/* =========== Set and Get register routines ========== */ + void -SiS_SetRegAND (USHORT Port, USHORT Index, USHORT DataAND) +SiS_SetRegANDOR(USHORT Port,USHORT Index,USHORT DataAND,USHORT DataOR) { - USHORT temp; + USHORT temp; - temp = SiS_GetReg1 (Port, Index); /* SiS_Part1Port index 02 */ - temp = temp & DataAND; - SiS_SetReg1 (Port, Index, temp); + temp=SiS_GetReg1(Port,Index); /* SiS_Part1Port index 02 */ + temp=(temp&(DataAND))|DataOR; + SiS_SetReg1(Port,Index,temp); } void -SiS_SetRegOR (USHORT Port, USHORT Index, USHORT DataOR) +SiS_SetRegAND(USHORT Port,USHORT Index,USHORT DataAND) { - USHORT temp; + USHORT temp; - temp = SiS_GetReg1 (Port, Index); /* SiS_Part1Port index 02 */ - temp = temp | DataOR; - SiS_SetReg1 (Port, Index, temp); + temp=SiS_GetReg1(Port,Index); /* SiS_Part1Port index 02 */ + temp=temp&DataAND; + SiS_SetReg1(Port,Index,temp); } -void -SiS_SetGroup2 (USHORT BaseAddr, ULONG ROMAddr, USHORT ModeNo, - USHORT ModeIdIndex, USHORT RefreshRateTableIndex, - PSIS_HW_DEVICE_INFO HwDeviceExtension) +void SiS_SetRegOR(USHORT Port,USHORT Index,USHORT DataOR) { - USHORT i, j, tempax, tempbx, tempcx, temp, temp3; - USHORT push1, push2, temp1; - UCHAR *PhasePoint; - UCHAR *TimingPoint; - USHORT modeflag, resinfo, crt2crtc, resindex, xres; - ULONG longtemp, tempeax, tempebx, temp2, tempecx; - USHORT SiS_RY1COE = 0, SiS_RY2COE = 0, SiS_RY3COE = 0, SiS_RY4COE = - 0, SiS_RY5COE = 0, SiS_RY6COE = 0, SiS_RY7COE = 0; - if (ModeNo <= 0x13) { - modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ - resinfo = SiS_SModeIDTable[ModeIdIndex].St_ResInfo; - crt2crtc = 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; - } + USHORT temp; - tempcx = SiS_VBInfo; - tempax = (tempcx & 0x00FF) << 8; - tempbx = (tempcx & 0x00FF) | ((tempcx & 0x00FF) << 8); - tempbx = tempbx & 0x0410; - temp = (tempax & 0x0800) >> 8; - temp = temp >> 1; - temp = temp | (((tempbx & 0xFF00) >> 8) << 1); - temp = temp | ((tempbx & 0x00FF) >> 3); - temp = temp ^ 0x0C; - - PhasePoint = SiS_PALPhase; - 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; - } - } else - TimingPoint = SiS_HiTVExtTiming; - } else { - if (SiS_VBInfo & SetPALTV) { - if ((SiS_VBType & VB_SIS301B) - || (SiS_VBType & VB_SIS302B)) PhasePoint = SiS_PALPhase2; /* PALPhase */ - else - PhasePoint = SiS_PALPhase; + temp=SiS_GetReg1(Port,Index); /* SiS_Part1Port index 02 */ + temp=temp|DataOR; + SiS_SetReg1(Port,Index,temp); +} - TimingPoint = SiS_PALTiming; - } else { - temp = temp | 0x10; - if ((SiS_VBType & VB_SIS301B) - || (SiS_VBType & VB_SIS302B)) PhasePoint = SiS_NTSCPhase2; /* PALPhase */ - else - PhasePoint = SiS_NTSCPhase; +/* ========================================================= */ - TimingPoint = SiS_NTSCTiming; - } - } - SiS_SetReg1 (SiS_Part2Port, 0x0, temp); - -#ifdef CONFIG_FB_SIS_300 - /*add PALMN */ - if ((HwDeviceExtension->jChipType == SIS_630) || - (HwDeviceExtension->jChipType == SIS_730)) { - if (SiS_VBInfo & SetCRT2ToTV) { - temp = SiS_GetReg1 (SiS_P3d4, 0x31); - temp = temp & 0x01; - if (temp) { - temp1 = SiS_GetReg1 (SiS_P3d4, 0x35); - temp1 = temp1 & 0x40; - if (temp1) - PhasePoint = SiS_PALMPhase; - temp1 = SiS_GetReg1 (SiS_P3d4, 0x35); - temp1 = temp1 & 0x80; - if (temp1) - PhasePoint = SiS_PALNPhase; - } - } - } -/*end add*/ +/* 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) +{ + 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 + }; + + /* TW: Inserted from 650/301LV BIOS */ + if(SiS_VBInfo & SetCRT2ToLCDA) 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; + } else { + modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */ + resinfo = SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; + crt2crtc = SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; + } + + tempcx = SiS_VBInfo; + tempax = (tempcx & 0x00FF) << 8; + tempbx = (tempcx & 0x00FF) | ((tempcx & 0x00FF) << 8); + tempbx &= 0x0410; + temp = (tempax & 0x0800) >> 8; + 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; + } + } else TimingPoint = SiS_HiTVExtTiming; + } else { #endif -#ifdef CONFIG_FB_SIS_315 - /*add PALMN */ - if (SiS_VBInfo & SetCRT2ToTV) { - temp = SiS_GetReg1 (SiS_P3d4, 0x31); - temp = temp & 0x01; - if (temp) { - temp1 = SiS_GetReg1 (SiS_P3d4, 0x38); - temp1 = temp1 & 0x40; - if (temp1) - PhasePoint = SiS_PALMPhase; - temp1 = SiS_GetReg1 (SiS_P3d4, 0x38); - temp1 = temp1 & 0x80; - if (temp1) - PhasePoint = SiS_PALNPhase; - } - } - /*end add */ + 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; + } 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; + } +#ifdef oldHV + } +#endif + SiS_SetReg1(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; + } + } + } #endif - for (i = 0x31, j = 0; i <= 0x34; i++, j++) { - SiS_SetReg1 (SiS_Part2Port, i, PhasePoint[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_Part2Port, i, TimingPoint[j]); /* di->temp2[j] */ - } - if (SiS_VBInfo & SetCRT2ToTV) { - SiS_SetRegANDOR (SiS_Part2Port, 0x3A, 0x1F, 0x00); - } - temp = SiS_NewFlickerMode; - SiS_SetRegANDOR (SiS_Part2Port, 0x0A, 0xFF, temp); - - 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); -/*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; /* xres->ax */ - } - 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*/ - - if (SiS_VBInfo & SetCRT2ToHiVisionTV) - tempax = 950; - else { - if (SiS_VBInfo & SetPALTV) - tempax = 520; - else - tempax = 440; - } - if (SiS_VDE <= tempax) { - tempax = tempax - SiS_VDE; - tempax = tempax >> 2; - tempax = (tempax & 0x00FF) | ((tempax & 0x00FF) << 8); - push1 = tempax; - temp = (tempax & 0xFF00) >> 8; - temp = temp + (USHORT) TimingPoint[0]; - SiS_SetReg1 (SiS_Part2Port, 0x01, temp); - tempax = push1; - temp = (tempax & 0xFF00) >> 8; - temp = temp + TimingPoint[1]; - SiS_SetReg1 (SiS_Part2Port, 0x02, temp); - } - /*301b */ - if (((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B)) - && (SiS_VBInfo & SetCRT2ToTV) && (SiS_VGAHDE == 1024)) { - if (SiS_VBInfo & SetPALTV) { - SiS_SetReg1 (SiS_Part2Port, 0x01, 0x19); - SiS_SetReg1 (SiS_Part2Port, 0x02, 0x52); - } else { - SiS_SetReg1 (SiS_Part2Port, 0x01, 0x0B); - SiS_SetReg1 (SiS_Part2Port, 0x02, 0x11); - } - } - tempcx = SiS_HT - 1; - /*301b */ - if (((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B))) { - tempcx = tempcx - 1; - } - temp = tempcx & 0x00FF; - SiS_SetReg1 (SiS_Part2Port, 0x1B, temp); - temp = (tempcx & 0xFF00) >> 8; - SiS_SetRegANDOR (SiS_Part2Port, 0x1D, ~0x0F, temp); - - tempcx = SiS_HT >> 1; - push1 = tempcx; /* push cx */ - tempcx = tempcx + 7; - if (SiS_VBInfo & SetCRT2ToHiVisionTV) { - tempcx = tempcx - 4; - } - temp = (tempcx & 0x00FF); - temp = temp << 4; - SiS_SetRegANDOR (SiS_Part2Port, 0x22, 0x0F, temp); - - tempbx = TimingPoint[j] | ((TimingPoint[j + 1]) << 8); - tempbx = tempbx + tempcx; - push2 = tempbx; - temp = tempbx & 0x00FF; - SiS_SetReg1 (SiS_Part2Port, 0x24, temp); - temp = (tempbx & 0xFF00) >> 8; - temp = temp << 4; - SiS_SetRegANDOR (SiS_Part2Port, 0x25, 0x0F, temp); - - tempbx = push2; - tempbx = tempbx + 8; - if (SiS_VBInfo & SetCRT2ToHiVisionTV) { - tempbx = tempbx - 4; - tempcx = tempbx; - } - temp = (tempbx & 0x00FF) << 4; - SiS_SetRegANDOR (SiS_Part2Port, 0x29, 0x0F, temp); - - j = j + 2; - tempcx = tempcx + (TimingPoint[j] | ((TimingPoint[j + 1]) << 8)); - temp = tempcx & 0x00FF; - SiS_SetReg1 (SiS_Part2Port, 0x27, temp); - temp = ((tempcx & 0xFF00) >> 8) << 4; - SiS_SetRegANDOR (SiS_Part2Port, 0x28, 0x0F, temp); - - tempcx = tempcx + 8; - if (SiS_VBInfo & SetCRT2ToHiVisionTV) { - tempcx = tempcx - 4; - } - temp = tempcx & 0xFF; - temp = temp << 4; - SiS_SetRegANDOR (SiS_Part2Port, 0x2A, 0x0F, temp); - - tempcx = push1; /* pop cx */ - j = j + 2; - temp = TimingPoint[j] | ((TimingPoint[j + 1]) << 8); - tempcx = tempcx - temp; - temp = tempcx & 0x00FF; - temp = temp << 4; - SiS_SetRegANDOR (SiS_Part2Port, 0x2D, 0x0F, temp); - - tempcx = tempcx - 11; - if (!(SiS_VBInfo & SetCRT2ToTV)) { - tempax = SiS_GetVGAHT2 (); - tempcx = tempax - 1; - } - temp = tempcx & 0x00FF; - SiS_SetReg1 (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; - if (SiS_VBInfo & SetCRT2ToTV) { - tempbx = tempbx >> 1; - } - tempbx = tempbx - 2; - temp = tempbx & 0x00FF; - if (SiS_VBInfo & SetCRT2ToHiVisionTV) { - if (SiS_VBInfo & SetInSlaveMode) { - if (ModeNo == 0x2f) - temp = temp + 1; - } - } - SiS_SetReg1 (SiS_Part2Port, 0x2F, temp); - - temp = (tempcx & 0xFF00) >> 8; - temp = temp | (((tempbx & 0xFF00) >> 8) << 6); - if (!(SiS_VBInfo & SetCRT2ToHiVisionTV)) { - temp = temp | 0x10; - if (!(SiS_VBInfo & SetCRT2ToSVIDEO)) { - temp = temp | 0x20; - } - } - SiS_SetReg1 (SiS_Part2Port, 0x30, temp); - /*301b */ - if (((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B))) { /*tv gatingno */ - tempbx = SiS_VDE; - if (SiS_VBInfo & SetCRT2ToTV) { - tempbx = tempbx >> 1; - } - temp = (((tempbx - 3) & 0x0300) >> 8) << 5; - SiS_SetReg1 (SiS_Part2Port, 0x46, temp); - temp = (tempbx - 3) & 0x00FF; - SiS_SetReg1 (SiS_Part2Port, 0x47, temp); - } -/*end 301b*/ - - tempbx = tempbx & 0x00FF; - if (!(modeflag & HalfDCLK)) { - tempcx = SiS_VGAHDE; - if (tempcx >= SiS_HDE) { - tempbx = tempbx | 0x2000; - tempax = tempax & 0x00FF; - } - } - tempcx = 0x0101; - - if (SiS_VBInfo & (SetCRT2ToHiVisionTV | SetCRT2ToTV)) { /*301b */ - if (SiS_VGAHDE >= 1024) { - tempcx = 0x1920; - if (SiS_VGAHDE >= 1280) { - tempcx = 0x1420; - tempbx = tempbx & 0xDFFF; - } - } - } - if (!(tempbx & 0x2000)) { - if (modeflag & HalfDCLK) { - tempcx = (tempcx & 0xFF00) | ((tempcx & 0x00FF) << 1); - } - push1 = tempbx; - tempeax = SiS_VGAHDE; - tempebx = (tempcx & 0xFF00) >> 8; - longtemp = tempeax * tempebx; - tempecx = tempcx & 0x00FF; - longtemp = longtemp / tempecx; - /*301b */ - tempecx = 8 * 1024; - if (((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B))) { - tempecx = tempecx * 8; - } - longtemp = longtemp * tempecx; - tempecx = SiS_HDE; - temp2 = longtemp % tempecx; - tempeax = longtemp / tempecx; - if (temp2 != 0) { - tempeax = tempeax + 1; - } - tempax = (USHORT) tempeax; - /*301b */ - if (((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B))) { - tempcx = ((tempax & 0xFF00) >> 5) >> 8; - } - /*end 301b */ - tempbx = push1; - tempbx = - (USHORT) (((tempeax & 0x0000FF00) & 0x1F00) | - (tempbx & 0x00FF)); - tempax = - (USHORT) (((tempeax & 0x000000FF) << 8) | - (tempax & 0x00FF)); - temp = (tempax & 0xFF00) >> 8; - } else { - temp = (tempax & 0x00FF) >> 8; - } - SiS_SetReg1 (SiS_Part2Port, 0x44, temp); - temp = (tempbx & 0xFF00) >> 8; - SiS_SetRegANDOR (SiS_Part2Port, 0x45, ~0x03F, temp); - /*301b */ - if (((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B))) { - if ((tempcx & 0x00FF) == 0x01) - tempcx = 0x00; - SiS_SetRegANDOR (SiS_Part2Port, 0x46, ~0x007, tempcx); - SiS_SetRegOR (SiS_Part2Port, 0x46, 0x18); - if (SiS_VBInfo & SetPALTV) { - tempbx = 0x0364; - tempcx = 0x009c; - } else { - tempbx = 0x0346; - tempcx = 0x0078; - } - temp = (tempbx & 0x00FF); - SiS_SetReg1 (SiS_Part2Port, 0x4B, temp); - temp = (tempcx & 0x00FF); - SiS_SetReg1 (SiS_Part2Port, 0x4C, temp); - tempbx = (tempbx & 0x0300); - temp = (tempcx & 0xFF00) >> 8; - temp = (temp & 0x0003) << 2; - temp = temp | (tempbx >> 8); - SiS_SetReg1 (SiS_Part2Port, 0x4D, temp); - temp = SiS_GetReg1 (SiS_Part2Port, 0x43); - SiS_SetReg1 (SiS_Part2Port, 0x43, temp - 3); - } -/*end 301b*/ - -#ifdef CONFIG_FB_SIS_300 -/*add PALMN*/ - if ((HwDeviceExtension->jChipType == SIS_630) || - (HwDeviceExtension->jChipType == SIS_730)) { - if (SiS_VBInfo & SetCRT2ToTV) { - temp = SiS_GetReg1 (SiS_P3d4, 0x31); - temp = temp & 0x01; - if (temp) { - temp1 = SiS_GetReg1 (SiS_P3d4, 0x35); - temp1 = temp1 & 0x40; - if (temp1) { - SiS_SetRegANDOR (SiS_Part2Port, 0x00, - 0xEF, 0x00); - temp3 = - SiS_GetReg1 (SiS_Part2Port, 0x01); - temp3 = temp3 - 1; - SiS_SetReg1 (SiS_Part2Port, 0x01, - temp3); - } - } - } - } - /*end add */ +#ifdef SIS315H + 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 */ + } + } + } + } #endif -#ifdef CONFIG_FB_SIS_315 -/*add PALMN*/ - if (SiS_VBInfo & SetCRT2ToTV) { - temp = SiS_GetReg1 (SiS_P3d4, 0x31); - temp = temp & 0x01; - if (temp) { - temp1 = SiS_GetReg1 (SiS_P3d4, 0x38); - temp1 = temp1 & 0x40; - if (temp1) { - SiS_SetRegANDOR (SiS_Part2Port, 0x00, 0xEF, - 0x00); - temp3 = SiS_GetReg1 (SiS_Part2Port, 0x01); - temp3 = temp3 - 1; - SiS_SetReg1 (SiS_Part2Port, 0x01, temp3); - } - } - } - /*end add */ + for(i=0x31, j=0; i<=0x34; i++, j++){ + SiS_SetReg1(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_Part2Port,i,TimingPoint[j]); + } + for(i=0x39; i<=0x45; i++, j++){ + SiS_SetReg1(SiS_Part2Port,i,TimingPoint[j]); + } + if(SiS_VBInfo & SetCRT2ToTV) { + if(HwDeviceExtension->jChipType >= SIS_315H) { + if (!(SiS_ModeType & 0x07)) + SiS_SetRegAND(SiS_Part2Port,0x3A,0x1F); + } else { + SiS_SetRegAND(SiS_Part2Port,0x3A,0x1F); + } + } + + SiS_SetRegOR(SiS_Part2Port,0x0A,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); + + /*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_VBInfo & SetCRT2ToHiVisionTV) { - if (!(SiS_VBInfo & SetInSlaveMode)) { - SiS_SetReg1 (SiS_Part2Port, 0x0B, 0x00); - } - } - if (SiS_VBInfo & SetCRT2ToTV) { - return; - } + /* 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); - tempbx = SiS_HDE - 1; /* RHACTE=HDE-1 */ - temp = tempbx & 0x00FF; - SiS_SetReg1 (SiS_Part2Port, 0x2C, temp); - temp = (tempbx & 0xFF00) >> 8; - temp = temp << 4; - SiS_SetRegANDOR (SiS_Part2Port, 0x2B, 0x0F, temp); - temp = 0x01; - if (SiS_LCDResInfo == Panel1280x1024) { - if (SiS_ModeType == ModeEGA) { - if (SiS_VGAHDE >= 1024) { - temp = 0x02; - if (SiS_SetFlag & LCDVESATiming) - temp = 0x01; - } - } - } - SiS_SetReg1 (SiS_Part2Port, 0x0B, temp); - - tempbx = SiS_VDE; /* RTVACTEO=(VDE-1)&0xFF */ - push1 = tempbx; - tempbx--; - temp = tempbx & 0x00FF; - SiS_SetReg1 (SiS_Part2Port, 0x03, temp); - temp = ((tempbx & 0xFF00) >> 8) & 0x07; - SiS_SetRegANDOR (SiS_Part2Port, 0x0C, ~0x07, temp); - - tempcx = SiS_VT - 1; - push2 = tempcx + 1; - temp = tempcx & 0x00FF; /* RVTVT=VT-1 */ - SiS_SetReg1 (SiS_Part2Port, 0x19, temp); - temp = (tempcx & 0xFF00) >> 8; - temp = temp << 5; - if (SiS_LCDInfo & LCDRGB18Bit) { - temp = temp | 0x10; - } - if (SiS_VBInfo & SetCRT2ToLCD) { - tempbx = (tempbx & 0xFF00) | (SiS_LCDInfo & 0x0FF); - if (tempbx & LCDSync) { - tempbx = tempbx & LCDSyncBit; - tempbx = - (tempbx & 0xFF00) | ((tempbx & 0x00FF) >> - LCDSyncShift); - temp = temp | (tempbx & 0x00FF); - } - } - SiS_SetReg1 (SiS_Part2Port, 0x1A, temp); - - tempcx++; - tempbx = 768; - if (SiS_LCDResInfo != Panel1024x768) { - tempbx = 1024; - if (SiS_LCDResInfo != Panel1280x1024) { - tempbx = 1200; /*301b */ - if (SiS_LCDResInfo != Panel1600x1200) { - if (tempbx != SiS_VDE) { - tempbx = 960; - } - } - } - } - if (SiS_LCDInfo & LCDNonExpanding) { - tempbx = SiS_VDE; - tempbx--; - tempcx--; - } - tempax = 1; - if (!(SiS_LCDInfo & LCDNonExpanding)) { - if (tempbx != SiS_VDE) { - tempax = tempbx; - if (tempax < SiS_VDE) { - tempax = 0; - tempcx = 0; - } else { - tempax = tempax - SiS_VDE; - } - tempax = tempax >> 1; - } - tempcx = tempcx - tempax; /* lcdvdes */ - tempbx = tempbx - tempax; /* lcdvdee */ - } else { - tempax = tempax >> 1; - tempcx = tempcx - tempax; /* lcdvdes */ - tempbx = tempbx - tempax; /* lcdvdee */ - } +#ifdef oldHV + if(SiS_VBInfo & SetCRT2ToHiVisionTV) tempax = 950; + else { +#endif + if(SiS_VBInfo & SetPALTV) tempax = 520; + else tempax = 440; +#ifdef oldHV + } +#endif - temp = tempcx & 0x00FF; /* RVEQ1EQ=lcdvdes */ - SiS_SetReg1 (SiS_Part2Port, 0x05, temp); - temp = tempbx & 0x00FF; /* RVEQ2EQ=lcdvdee */ - SiS_SetReg1 (SiS_Part2Port, 0x06, temp); - - temp = (tempbx & 0xFF00) >> 8; - temp = temp << 3; - temp = temp | ((tempcx & 0xFF00) >> 8); - SiS_SetReg1 (SiS_Part2Port, 0x02, temp); - - tempbx = push2; - tempax = push1; - tempcx = tempbx; - tempcx = tempcx - tempax; - tempcx = tempcx >> 4; - tempbx = tempbx + tempax; - tempbx = tempbx >> 1; - if (SiS_LCDInfo & LCDNonExpanding) { - tempbx = tempbx - 10; - } - temp = tempbx & 0x00FF; /* RTVACTEE=lcdvrs */ - SiS_SetReg1 (SiS_Part2Port, 0x04, temp); - - temp = (tempbx & 0xFF00) >> 8; - temp = temp << 4; - tempbx = tempbx + tempcx + 1; - temp = temp | (tempbx & 0x000F); - SiS_SetReg1 (SiS_Part2Port, 0x01, temp); - - if (SiS_LCDResInfo == Panel1024x768) { - if (!(SiS_SetFlag & LCDVESATiming)) { - if (!(SiS_LCDInfo & LCDNonExpanding)) { - if (ModeNo == 0x13) { - SiS_SetReg1 (SiS_Part2Port, 0x04, 0xB9); - SiS_SetReg1 (SiS_Part2Port, 0x05, 0xCC); - SiS_SetReg1 (SiS_Part2Port, 0x06, 0xA6); - } else { - temp = crt2crtc & 0x3F; - if (temp == 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); - } - } - } - } - } + 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); + + 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) { + tempcx--; + } + temp = tempcx & 0x00FF; + SiS_SetReg1(SiS_Part2Port,0x1B,temp); + temp = (tempcx & 0xFF00) >> 8; + SiS_SetRegANDOR(SiS_Part2Port,0x1D,0xF0,temp); + + 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 + temp = (tempcx & 0x00FF) << 4; + SiS_SetRegANDOR(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); + temp = ((tempbx & 0xFF00) >> 8) << 4; + SiS_SetRegANDOR(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 + temp = (tempbx & 0x00FF) << 4; + SiS_SetRegANDOR(SiS_Part2Port,0x29,0x0F,temp); + + j += 2; + tempcx += ((TimingPoint[j] | ((TimingPoint[j+1]) << 8))); + temp = tempcx & 0x00FF; + SiS_SetReg1(SiS_Part2Port,0x27,temp); + temp = ((tempcx & 0xFF00) >> 8) << 4; + SiS_SetRegANDOR(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); + + tempcx = push1; + j += 2; + tempcx -= (TimingPoint[j] | ((TimingPoint[j+1]) << 8)); + temp = (tempcx & 0x00FF) << 4; + SiS_SetRegANDOR(SiS_Part2Port,0x2D,0x0F,temp); + + tempcx -= 11; + if(!(SiS_VBInfo & SetCRT2ToTV)){ + tempax = SiS_GetVGAHT2() - 1; + tempcx = tempax; + } + temp = tempcx & 0x00FF; + SiS_SetReg1(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; + if(HwDeviceExtension->jChipType < SIS_315H) { + if(SiS_VBInfo & SetCRT2ToTV) tempbx >>= 1; + } else { + if((SiS_VBInfo & SetCRT2ToTV) && (!(SiS_HiVision & 0x03))) { + tempbx >>= 1; + if(SiS_SetFlag & TVSimuMode) { + if(ModeNo <= 0x13) { + if(crt2crtc == 1) { + tempbx++; + } + } + } else { + if(SiS_VBInfo & SetInSlaveMode) { + if(crt2crtc == 4) /* TW: BIOS calls GetRatePtrCRT2 here - does not make sense */ + if(SiS_ModeType <= 3) tempbx++; + } + } + } + } + tempbx -= 2; + temp = tempbx & 0x00FF; +#ifdef oldHV + if(SiS_VBInfo & SetCRT2ToHiVisionTV) { + if(SiS_VBInfo & SetInSlaveMode) { + if(ModeNo == 0x2f) temp++; + } + } +#endif + SiS_SetReg1(SiS_Part2Port,0x2F,temp); - SiS_SetRegANDOR (SiS_Part2Port, 0x09, 0xF0, 0x00); - SiS_SetRegANDOR (SiS_Part2Port, 0x0A, 0xF0, 0x00); + 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 + } +#endif + SiS_SetReg1(SiS_Part2Port,0x30,temp); + + if(SiS_VBType & VB_SIS301BLV302BLV) { /* tv gatingno */ + tempbx = SiS_VDE; + if((SiS_VBInfo & SetCRT2ToTV) && (!(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 &= 0x00FF; + if(!(modeflag & HalfDCLK)){ + tempcx = SiS_VGAHDE; + if(tempcx >= 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(!(tempbx & 0x2000)){ + + if(modeflag & HalfDCLK){ + tempcx = (tempcx & 0xFF00) | (((tempcx & 0x00FF) << 1) & 0xff); + } + push1 = tempbx; + tempeax = SiS_VGAHDE; + tempebx = (tempcx & 0xFF00) >> 8; + longtemp = tempeax * tempebx; + tempecx = tempcx & 0x00FF; + longtemp /= tempecx; + longtemp <<= 0x0d; + if(SiS_VBType & VB_SIS301BLV302BLV) { + longtemp <<= 3; + } + tempecx = 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; + } + tempbx |= (tempax & 0x1F00); + tempax = ((tempax & 0x00FF) << 8) | (tempax & 0x00FF); + } + + temp = (tempax & 0xFF00) >> 8; + SiS_SetReg1(SiS_Part2Port,0x44,temp); + temp = (tempbx & 0xFF00) >> 8; + SiS_SetRegANDOR(SiS_Part2Port,0x45,0xC0,temp); + + if(SiS_VBType & VB_SIS301BLV302BLV) { + if(tempbx & 0x2000) + tempcx=0x00; + temp = tempcx; + 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; */ + } else { + tempbx = 0x0369; /* TW: BIOS; Was 0x0346; */ + tempcx = 0x0061; /* TW: BIOS; Was 0x0078; */ + } + temp = (tempbx & 0x00FF) ; + SiS_SetReg1(SiS_Part2Port,0x4B,temp); + temp = (tempcx & 0x00FF) ; + SiS_SetReg1(SiS_Part2Port,0x4C,temp); + tempbx &= 0x0300; + 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) */ + + temp = SiS_GetReg1(SiS_Part2Port,0x43); + SiS_SetReg1(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); + } + } + } + } +#endif - tempcx = (SiS_HT - SiS_HDE) >> 2; /* (HT-HDE)>>2 */ - tempbx = (SiS_HDE + 7); /* lcdhdee */ - /*301b */ - if (((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B))) { - tempbx = tempbx + 2; - } - push1 = tempbx; - temp = tempbx & 0x00FF; /* RHEQPLE=lcdhdee */ - SiS_SetReg1 (SiS_Part2Port, 0x23, temp); - temp = (tempbx & 0xFF00) >> 8; - SiS_SetRegANDOR (SiS_Part2Port, 0x25, ~0x0F, temp); - /*301b */ - temp = 7; - if (((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B))) { - temp = temp + 2; - } - SiS_SetReg1 (SiS_Part2Port, 0x1F, temp); /* RHBLKE=lcdhdes */ - SiS_SetRegANDOR (SiS_Part2Port, 0x20, 0x0F, 0x00); - - tempbx = tempbx + tempcx; - push2 = tempbx; - temp = tempbx & 0xFF; /* RHBURSTS=lcdhrs */ - if (SiS_LCDResInfo == Panel1280x1024) { - if (!(SiS_LCDInfo & LCDNonExpanding)) { - if (SiS_HDE == 1280) { - temp = 0x47; - } - } - } - SiS_SetReg1 (SiS_Part2Port, 0x1C, temp); - temp = (tempbx & 0xFF00) >> 8; - temp = temp << 4; - SiS_SetRegANDOR (SiS_Part2Port, 0x1D, ~0x0F0, temp); - - tempbx = push2; - tempcx = tempcx << 1; - tempbx = tempbx + tempcx; - temp = tempbx & 0x00FF; /* RHSYEXP2S=lcdhre */ - SiS_SetReg1 (SiS_Part2Port, 0x21, temp); - - SiS_SetRegANDOR (SiS_Part2Port, 0x17, 0xFB, 0x00); - SiS_SetRegANDOR (SiS_Part2Port, 0x18, 0xDF, 0x00); - - if (!(SiS_SetFlag & LCDVESATiming)) { - if (SiS_VGAVDE == 525) { - if (((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B))) { /*301b */ - temp = 0xC6; - } else - temp = 0xC4; - SiS_SetReg1 (SiS_Part2Port, 0x2f, temp); - SiS_SetReg1 (SiS_Part2Port, 0x30, 0xB3); - } - if (SiS_VGAVDE == 420) { - if ( - ((SiS_VBType & VB_SIS301B) - || (SiS_VBType & VB_SIS302B))) { - temp = 0x4F; - } else - temp = 0x4E; - SiS_SetReg1 (SiS_Part2Port, 0x2f, temp); - } - } +#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); + } + } + } + } + /*end add*/ +#endif + +#ifdef oldHV + if(SiS_VBInfo & SetCRT2ToHiVisionTV) { + if(!(SiS_VBInfo & SetInSlaveMode)) { + SiS_SetReg1(SiS_Part2Port,0x0B,0x00); + } + } +#endif + + if(HwDeviceExtension->jChipType < SIS_315H) { + if(SiS_VBInfo & SetCRT2ToTV) return; + } else { + if(SiS_VBInfo & SetCRT2ToTV) { + if(SiS_VBType & (VB_SIS301LV | VB_SIS302LV)) { + if(SiS_VBInfo & SetCRT2ToTV) { + if(!(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); + } + } + } + } + return; + } + } + + /* TW: From here: LCD Part2 group */ + + tempbx = SiS_HDE - 1; /* RHACTE=HDE-1 */ + temp = tempbx & 0x00FF; + SiS_SetReg1(SiS_Part2Port,0x2C,temp); + temp = (tempbx & 0xFF00) >> 8; + temp <<= 4; + SiS_SetRegANDOR(SiS_Part2Port,0x2B,0x0F,temp); + + temp = 0x01; + if(SiS_LCDResInfo == Panel1280x1024) { + if(SiS_ModeType == ModeEGA) { + if(SiS_VGAHDE >= 1024) { + temp = 0x02; + if(HwDeviceExtension->jChipType >= SIS_315H) { + if (SiS_SetFlag & LCDVESATiming) { + temp = 0x01; + } + } + } + } + } + SiS_SetReg1(SiS_Part2Port,0x0B,temp); + + tempbx = SiS_VDE; /* RTVACTEO=(VDE-1)&0xFF */ + push1 = tempbx; + tempbx--; + temp = tempbx & 0x00FF; + SiS_SetReg1(SiS_Part2Port,0x03,temp); + temp = ((tempbx & 0xFF00) >> 8) & 0x07; + SiS_SetRegANDOR(SiS_Part2Port,0x0C,0xF8,temp); + + tempcx = SiS_VT; + push2 = tempcx; + tempcx--; + temp = tempcx & 0x00FF; /* RVTVT=VT-1 */ + SiS_SetReg1(SiS_Part2Port,0x19,temp); + + temp = (tempcx & 0xFF00) >> 8; + temp <<= 5; + if(HwDeviceExtension->jChipType < SIS_315H) { + if(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 */ + 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); + } + } + SiS_SetReg1(SiS_Part2Port,0x1A,temp); + + SiS_SetRegAND(SiS_Part2Port,0x09,0xF0); + SiS_SetRegAND(SiS_Part2Port,0x0A,0xF0); + + SiS_SetRegAND(SiS_Part2Port,0x17,0xFB); + SiS_SetRegAND(SiS_Part2Port,0x18,0xDF); + + if(HwDeviceExtension->jChipType >= SIS_315H) { /* 310 series */ + + /* TW: Inserted this entire section from 650/301LV BIOS */ + + SiS_GetCRT2Part2Ptr(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; + } + + SiS_SetRegANDOR(SiS_Part2Port,0x01,0x80,(CRT2Part2Ptr+resindex)->CR[0]); + SiS_SetRegANDOR(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]); + } + for(j = 0x1c; j <= 0x1d; i++, j++ ) { + SiS_SetReg1(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_Part2Port,0x23,(CRT2Part2Ptr+resindex)->CR[10]); + SiS_SetRegANDOR(SiS_Part2Port,0x25,0x0f,(CRT2Part2Ptr+resindex)->CR[11]); + + if(!(SiS_SetFlag & LCDVESATiming)) { + if(SiS_VGAVDE == 0x20d) { + temp = 0xc3; + if(SiS_ModeType <= ModeVGA) { + temp++; + if(SiS_VBType & VB_SIS301BLV302BLV) temp += 2; + } + SiS_SetReg1(SiS_Part2Port,0x2f,temp); + SiS_SetReg1(SiS_Part2Port,0x30,0xb3); + } + if(SiS_VGAVDE == 0x1a4) { + temp = 0x4d; + if(SiS_ModeType <= ModeVGA) { + temp++; + if(SiS_VBType & VB_SIS301BLV302BLV) temp++; + } + SiS_SetReg1(SiS_Part2Port,0x2f,temp); + } + } /* 2f5d */ + + } else { /* 300 series */ + + tempcx++; + tempbx = 768; + if(SiS_LCDResInfo != Panel1024x768) { + tempbx = 1024; + if(SiS_LCDResInfo != Panel1280x1024) { + tempbx = 1200; + if(SiS_LCDResInfo != Panel1600x1200) { + if(tempbx != SiS_VDE) { + tempbx = 960; + } + } + } + } + if(SiS_LCDInfo & LCDNonExpanding) { + tempbx = SiS_VDE - 1; + tempcx--; + } + tempax = 1; + if(!(SiS_LCDInfo & LCDNonExpanding)) { + if(tempbx != SiS_VDE){ + tempax = tempbx; + if(tempax < SiS_VDE) { + tempax = 0; + tempcx = 0; + } else { + tempax -= SiS_VDE; + } + tempax >>= 1; + } + tempcx -= tempax; /* lcdvdes */ + tempbx -= tempax; /* lcdvdee */ + } else { + tempax >>= 1; + tempcx -= tempax; /* lcdvdes */ + tempbx -= tempax; /* lcdvdee */ + } + + temp = tempcx & 0x00FF; /* RVEQ1EQ=lcdvdes */ + SiS_SetReg1(SiS_Part2Port,0x05,temp); + temp = tempbx & 0x00FF; /* RVEQ2EQ=lcdvdee */ + SiS_SetReg1(SiS_Part2Port,0x06,temp); + + temp = ((tempbx & 0xFF00) >> 8 ) << 3; + temp |= ((tempcx & 0xFF00) >> 8); + SiS_SetReg1(SiS_Part2Port,0x02,temp); + + tempbx = push2; + tempax = push1; + tempcx = tempbx; + tempcx -= tempax; + tempcx >>= 4; + tempbx += tempax; + tempbx >>= 1; + if(SiS_LCDInfo & LCDNonExpanding) tempbx -= 10; + + temp = tempbx & 0x00FF; /* RTVACTEE=lcdvrs */ + SiS_SetReg1(SiS_Part2Port,0x04,temp); + + temp = ((tempbx & 0xFF00) >> 8) << 4; + tempbx += (tempcx + 1); + temp |= (tempbx & 0x000F); + SiS_SetReg1(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)) ) { + if(ModeNo == 0x13) { + SiS_SetReg1(SiS_Part2Port,0x04,0xB9); + SiS_SetReg1(SiS_Part2Port,0x05,0xCC); + SiS_SetReg1(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); + } + } + } + + /* TW: Inserted missing code from 630/301B BIOS: (II: 3258) */ + + if(SiS_LCDTypeInfo == 0x0c) { + crt2crtc &= 0x1f; + tempcx = 0; + if(!(SiS_VBInfo & SetNotSimuMode)) { + if (SiS_VBInfo & SetInSlaveMode) { + tempcx += 7; + } + } + tempcx += crt2crtc; + if (crt2crtc >= 4) { + SiS_SetReg1(SiS_Part2Port,0x06,0xff); + } + + if(!(SiS_VBInfo & SetNotSimuMode)) { + if (SiS_VBInfo & SetInSlaveMode) { + if (crt2crtc == 4) { + SiS_SetReg1(SiS_Part2Port,0x01,0x28); + } + } + } + SiS_SetReg1(SiS_Part2Port,0x02,0x18); + SiS_SetReg1(SiS_Part2Port,0x04,atable[tempcx]); + } + + tempcx = (SiS_HT - SiS_HDE) >> 2; /* (HT-HDE)>>2 */ + tempbx = SiS_HDE + 7; /* lcdhdee */ + if(SiS_VBType & VB_SIS301BLV302BLV) { + tempbx += 2; + } + push1 = tempbx; + temp = tempbx & 0x00FF; /* RHEQPLE=lcdhdee */ + SiS_SetReg1(SiS_Part2Port,0x23,temp); + temp = (tempbx & 0xFF00) >> 8; + SiS_SetRegANDOR(SiS_Part2Port,0x25,0xF0,temp); + + temp = 7; + if(SiS_VBType & VB_SIS301BLV302BLV) { + temp += 2; + } + SiS_SetReg1(SiS_Part2Port,0x1F,temp); /* RHBLKE=lcdhdes */ + + SiS_SetRegAND(SiS_Part2Port,0x20,0x0F); + + tempbx += tempcx; + push2 = tempbx; + temp = tempbx & 0xFF; /* RHBURSTS=lcdhrs */ + if(SiS_LCDResInfo == Panel1280x1024) { + if(SiS_LCDInfo & LCDNonExpanding) { + if(SiS_HDE == 1280) temp = 0x47; + } + } + SiS_SetReg1(SiS_Part2Port,0x1C,temp); + temp = ((tempbx & 0xFF00) >> 8) << 4; + SiS_SetRegANDOR(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) + 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=0x4F; + else + temp=0x4D; /* 650: 4e */ + SiS_SetReg1(SiS_Part2Port,0x2f,temp); + } + } + + } /* HwDeviceExtension */ } USHORT -SiS_GetVGAHT2 () +SiS_GetVGAHT2() { - ULONG tempax, tempbx; + ULONG tempax,tempbx; - tempbx = ((SiS_VGAVT - SiS_VGAVDE) * SiS_RVBHCMAX) & 0xFFFF; - tempax = (SiS_VT - SiS_VDE) * SiS_RVBHCFACT; - tempax = (tempax * SiS_HT) / tempbx; - return ((USHORT) tempax); + tempbx = ((SiS_VGAVT - SiS_VGAVDE) * SiS_RVBHCMAX) & 0xFFFF; + tempax = (SiS_VT - SiS_VDE) * SiS_RVBHCFACT; + tempax = (tempax * SiS_HT) / tempbx; + return((USHORT) tempax); } +/* TW: Set 301 Macrovision(tm) registers */ +/* TW: Double-Checked against 650/301LV and 630/301B BIOS */ void -SiS_SetGroup3 (USHORT BaseAddr, ULONG ROMAddr, USHORT ModeNo, - USHORT ModeIdIndex, PSIS_HW_DEVICE_INFO HwDeviceExtension) +SiS_SetGroup3(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo, + USHORT ModeIdIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension) { - USHORT i; - UCHAR *tempdi; - USHORT modeflag, temp, temp1; - - if (ModeNo <= 0x13) { - modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ - } else { - modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */ - } - - SiS_SetReg1 (SiS_Part3Port, 0x00, 0x00); - if (SiS_VBInfo & SetPALTV) { - SiS_SetReg1 (SiS_Part3Port, 0x13, 0xFA); - SiS_SetReg1 (SiS_Part3Port, 0x14, 0xC8); - } else { - SiS_SetReg1 (SiS_Part3Port, 0x13, 0xF6); - SiS_SetReg1 (SiS_Part3Port, 0x14, 0xBF); - } -#ifdef CONFIG_FB_SIS_300 - /*add PALMN */ - if ((HwDeviceExtension->jChipType == SIS_630) || - (HwDeviceExtension->jChipType == SIS_730)) { - if (SiS_VBInfo & SetCRT2ToTV) { - temp = SiS_GetReg1 (SiS_P3d4, 0x31); - temp = temp & 0x01; - if (temp) { - temp1 = SiS_GetReg1 (SiS_P3d4, 0x35); - temp1 = temp1 & 0x40; - if (temp1) { - SiS_SetReg1 (SiS_Part3Port, 0x13, 0xFA); - SiS_SetReg1 (SiS_Part3Port, 0x14, 0xC8); - SiS_SetReg1 (SiS_Part3Port, 0x3D, 0xA8); - } - } - } - } - /*end add */ + USHORT i; + UCHAR *tempdi; + USHORT modeflag; + + if(SiS_VBInfo & SetCRT2ToLCDA) return; /* TW: Inserted from BIOS */ + + if(ModeNo<=0x13) + modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + else + modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + + SiS_SetReg1(SiS_Part3Port,0x00,0x00); + + if(SiS_VBInfo & SetPALTV) { + SiS_SetReg1(SiS_Part3Port,0x13,0xFA); + SiS_SetReg1(SiS_Part3Port,0x14,0xC8); + } else { + if(HwDeviceExtension->jChipType >= SIS_315H) { + SiS_SetReg1(SiS_Part3Port,0x13,0xF5); + SiS_SetReg1(SiS_Part3Port,0x14,0xB7); + } else { + SiS_SetReg1(SiS_Part3Port,0x13,0xF6); + SiS_SetReg1(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); + } + } + } + } #endif -#ifdef CONFIG_FB_SIS_315 -/*add PALMN*/ - if (SiS_VBInfo & SetCRT2ToTV) { - temp = SiS_GetReg1 (SiS_P3d4, 0x31); - temp = temp & 0x01; - if (temp) { - temp1 = SiS_GetReg1 (SiS_P3d4, 0x38); - temp1 = temp1 & 0x40; - if (temp1) { - SiS_SetReg1 (SiS_Part3Port, 0x13, 0xFA); - SiS_SetReg1 (SiS_Part3Port, 0x14, 0xC8); - SiS_SetReg1 (SiS_Part3Port, 0x3D, 0xA8); - } - } - } - /*end add */ + +#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 (!(modeflag & Charx8Dot)) { - tempdi = SiS_HiTVGroup3Text; - } - } - for (i = 0; i <= 0x3E; i++) { - SiS_SetReg1 (SiS_Part3Port, i, tempdi[i]); - } - } - return; + + if(SiS_VBInfo & SetCRT2ToHiVisionTV) { + tempdi = SiS_HiTVGroup3Data; + if(SiS_SetFlag & TVSimuMode) { + tempdi = SiS_HiTVGroup3Simu; + if(!(modeflag & Charx8Dot)) { + tempdi = SiS_HiTVGroup3Text; + } + } + for(i=0; i<=0x3E; i++){ + SiS_SetReg1(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, ULONG ROMAddr, USHORT ModeNo, - USHORT ModeIdIndex, USHORT RefreshRateTableIndex, - PSIS_HW_DEVICE_INFO HwDeviceExtension) +SiS_SetGroup4(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo, + USHORT ModeIdIndex,USHORT RefreshRateTableIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension) { - USHORT tempax, tempcx, tempbx, modeflag, temp, temp2, push1; - ULONG tempebx, tempeax, templong; - - if (ModeNo <= 0x13) { - modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ - } else { - modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */ - } - temp = SiS_RVBHCFACT; - SiS_SetReg1 (SiS_Part4Port, 0x13, temp); - - tempbx = SiS_RVBHCMAX; - temp = tempbx & 0x00FF; - SiS_SetReg1 (SiS_Part4Port, 0x14, temp); - temp2 = ((tempbx & 0xFF00) >> 8) << 7; - - tempcx = SiS_VGAHT - 1; - temp = tempcx & 0x00FF; - SiS_SetReg1 (SiS_Part4Port, 0x16, temp); - temp = ((tempcx & 0xFF00) >> 8) << 3; - temp2 = temp | temp2; - - tempcx = SiS_VGAVT - 1; - if (!(SiS_VBInfo & SetCRT2ToTV)) { - tempcx = tempcx - 5; - } - temp = tempcx & 0x00FF; - SiS_SetReg1 (SiS_Part4Port, 0x17, temp); - temp = temp2 | ((tempcx & 0xFF00) >> 8); - SiS_SetReg1 (SiS_Part4Port, 0x15, temp); - - tempcx = SiS_VBInfo; - tempbx = SiS_VGAHDE; - if (modeflag & HalfDCLK) { - tempbx = tempbx >> 1; - } - if (tempcx & SetCRT2ToHiVisionTV) { - temp = 0xA0; - if (tempbx != 1024) { - temp = 0xC0; - if (tempbx != 1280) - temp = 0; - } - } else if ((tempcx & SetCRT2ToTV) && (SiS_VGAHDE == 1024)) { /*301b */ - temp = 0xA0; - } else { - temp = 0x80; - if (SiS_VBInfo & SetCRT2ToLCD) { - temp = 0; - if (tempbx > 800) - temp = 0x60; - } - } - if (SiS_LCDResInfo != Panel1280x1024) - temp = temp | 0x0A; - SiS_SetRegANDOR (SiS_Part4Port, 0x0E, ~0xEF, temp); - - tempebx = SiS_VDE; - if (tempcx & SetCRT2ToHiVisionTV) { - /* if(!(tempax&0xE000)) tempbx=tempbx>>1; */ - if (!(temp & 0xE000)) - tempbx = tempbx >> 1; /* alan ???? */ - - } - - tempcx = SiS_RVBHRS; - temp = tempcx & 0x00FF; - SiS_SetReg1 (SiS_Part4Port, 0x18, temp); - - tempebx = tempebx; - tempeax = SiS_VGAVDE; - tempcx = tempcx | 0x04000; -/*tempeax=tempeax-tempebx; */ - if (tempeax <= tempebx) { - tempcx = ((tempcx & 0xFF00) ^ 0x4000) | (tempcx & 0x00ff); - tempeax = SiS_VGAVDE; - } - - else { - tempeax = 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); - temp = (USHORT) ((tempebx & 0x0000FF00) >> 8); - SiS_SetReg1 (SiS_Part4Port, 0x1A, temp); - tempbx = (USHORT) (tempebx >> 16); - temp = tempbx & 0x00FF; - temp = temp << 4; - temp = temp | ((tempcx & 0xFF00) >> 8); - SiS_SetReg1 (SiS_Part4Port, 0x19, temp); - /*301b */ - - if (((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B))) { - temp = 0x0028; - SiS_SetReg1 (SiS_Part4Port, 0x1C, temp); - tempax = SiS_VGAHDE; - if (modeflag & HalfDCLK) { - tempax = tempax >> 1; - } - if (SiS_VBInfo & (SetCRT2ToLCD)) { - if (tempax > 800) - tempax = tempax - 800; - } - tempax = tempax - 1; - - if (SiS_VBInfo & (SetCRT2ToTV | SetCRT2ToHiVisionTV)) { - if (SiS_VGAHDE > 800) { - if (SiS_VGAHDE == 1024) - tempax = (tempax * 25 / 32) - 1; - else - tempax = (tempax * 20 / 32) - 1; - } - } - temp = (tempax & 0xFF00) >> 8; - temp = ((temp & 0x0003) << 4); - SiS_SetReg1 (SiS_Part4Port, 0x1E, temp); - temp = (tempax & 0x00FF); - SiS_SetReg1 (SiS_Part4Port, 0x1D, temp); - - if (SiS_VBInfo & (SetCRT2ToTV | SetCRT2ToHiVisionTV)) { - if (SiS_VGAHDE > 800) { - SiS_SetRegOR (SiS_Part4Port, 0x1E, 0x08); - } - } - temp = 0x0036; - if (SiS_VBInfo & SetCRT2ToTV) { - temp = temp | 0x0001; - } - SiS_SetRegANDOR (SiS_Part4Port, 0x1F, 0x00C0, temp); - tempbx = (SiS_HT / 2) - 2; - temp = ((tempbx & 0x0700) >> 8) << 3; - SiS_SetRegANDOR (SiS_Part4Port, 0x21, 0x00C0, temp); - temp = tempbx & 0x00FF; - SiS_SetReg1 (SiS_Part4Port, 0x22, temp); - } -/*end 301b*/ - SiS_SetCRT2VCLK (BaseAddr, ROMAddr, ModeNo, ModeIdIndex, - RefreshRateTableIndex, HwDeviceExtension); + USHORT tempax,tempcx,tempbx,modeflag,temp,temp2,push1; + 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); + } + + /* TW: From 650/301LV BIOS */ + if(SiS_VBInfo & SetCRT2ToLCDA) return; + + temp = SiS_RVBHCFACT; + SiS_SetReg1(SiS_Part4Port,0x13,temp); + + tempbx = SiS_RVBHCMAX; + temp = tempbx & 0x00FF; + SiS_SetReg1(SiS_Part4Port,0x14,temp); + + temp2 = (((tempbx & 0xFF00) >> 8) << 7) & 0x00ff; + + tempcx = SiS_VGAHT - 1; + temp = tempcx & 0x00FF; + SiS_SetReg1(SiS_Part4Port,0x16,temp); + + temp = (((tempcx & 0xFF00) >> 8) << 3) & 0x00ff; + temp2 |= temp; + + tempcx = SiS_VGAVT - 1; + if(!(SiS_VBInfo & SetCRT2ToTV)) tempcx -= 5; + + temp = tempcx & 0x00FF; + SiS_SetReg1(SiS_Part4Port,0x17,temp); + + temp = temp2 | ((tempcx & 0xFF00) >> 8); + SiS_SetReg1(SiS_Part4Port,0x15,temp); + + tempcx = SiS_VBInfo; + tempbx = 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; + } + } else if(SiS_VBInfo & SetCRT2ToTV) { + if(tempbx <= 800) { + temp = 0x80; + if(SiS_VBInfo & SetCRT2ToLCD){ + temp = 0; + if(tempbx > 800) temp = 0x60; + } + } + } else { + temp = 0x80; + if(SiS_VBInfo & SetCRT2ToLCD){ + temp = 0; + if(tempbx > 800) temp = 0x60; + } + } + if(SiS_HiVision & 0x03) { + temp = 0; + if(SiS_VGAHDE == 1024) temp = 0x20; + } + SiS_SetRegANDOR(SiS_Part4Port,0x0E,0x10,temp); + + tempebx = SiS_VDE; + if(SiS_VBInfo & SetCRT2ToHiVisionTV) { + if(!(temp & 0xE0)) tempebx >>=1; + } + + tempcx = SiS_RVBHRS; + temp = tempcx & 0x00FF; + SiS_SetReg1(SiS_Part4Port,0x18,temp); + + tempeax = SiS_VGAVDE; + tempcx |= 0x4000; + if(tempeax <= tempebx){ + tempcx = ((tempcx & 0xFF00) ^ 0x4000) | (tempcx & 0x00ff); + } 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); + temp = (USHORT)((tempebx & 0x0000FF00) >> 8); + SiS_SetReg1(SiS_Part4Port,0x1A,temp); + + tempbx = (USHORT)(tempebx >> 16); + temp = tempbx & 0x00FF; + temp <<= 4; + temp |= ((tempcx & 0xFF00) >> 8); + SiS_SetReg1(SiS_Part4Port,0x19,temp); + + if(SiS_VBType & VB_SIS301BLV302BLV) { + SiS_SetReg1(SiS_Part4Port,0x1C,0x28); + tempbx = 0; /* TW: From 630/301B and 650/301LV BIOS */ + tempax = SiS_VGAHDE; + if(modeflag & HalfDCLK) tempax >>= 1; + if((SiS_VBInfo & SetCRT2ToLCD) || (SiS_HiVision & 0x03)) { + if(tempax > 800) tempax -= 800; + } + + if((SiS_VBInfo & (SetCRT2ToTV | SetCRT2ToHiVisionTV)) && + (!(SiS_HiVision & 0x03))) { + if(tempax > 800) { + tempbx = 8; /* TW: From 630/301B and 650/301LV BIOS */ + if(tempax == 1024) + tempax *= 25; + else + tempax *= 20; + + temp = tempax % 32; + tempax /= 32; + tempax--; + if (temp!=0) tempax++; + } + } + tempax--; + temp = (tempax & 0xFF00) >> 8; + temp &= 0x03; + SiS_SetReg1(SiS_Part4Port,0x1D,tempax & 0x00FF); + temp <<= 4; + temp |= tempbx; + SiS_SetReg1(SiS_Part4Port,0x1E,temp); + + temp = 0x0036; + if((SiS_VBInfo & (SetCRT2ToTV-SetCRT2ToHiVisionTV)) && + (!(SiS_HiVision & 0x03))) { /* TW: From 650/301LV BIOS */ + 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 */ + } + } + SiS_SetRegANDOR(SiS_Part4Port,0x1F,0xC0,temp); + tempbx = (SiS_HT >> 1) - 2; + temp = ((tempbx & 0x0700) >> 8) << 3; + SiS_SetRegANDOR(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_SetCRT2VCLK(BaseAddr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,HwDeviceExtension); } +/* TW: Double-Checked against 650/301LV and 630/301B BIOS */ void -SiS_SetCRT2VCLK (USHORT BaseAddr, ULONG ROMAddr, USHORT ModeNo, - USHORT ModeIdIndex, USHORT RefreshRateTableIndex, - PSIS_HW_DEVICE_INFO HwDeviceExtension) +SiS_SetCRT2VCLK(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension) { - USHORT vclkindex; - USHORT tempah, temp1; - - vclkindex = - SiS_GetVCLK2Ptr (ROMAddr, ModeNo, ModeIdIndex, - RefreshRateTableIndex, HwDeviceExtension); - /*301b */ - if (((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B))) { - tempah = SiS_VBVCLKData[vclkindex].Part4_A; - SiS_SetReg1 (SiS_Part4Port, 0x0A, tempah); - tempah = SiS_VBVCLKData[vclkindex].Part4_B; - SiS_SetReg1 (SiS_Part4Port, 0x0B, tempah); - } 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); - tempah = 0x08; - if (SiS_VBInfo & SetCRT2ToRAMDAC) { - tempah = tempah | 0x020; - } - temp1 = SiS_GetReg1 (SiS_Part4Port, 0x12); - tempah = tempah | temp1; - SiS_SetReg1 (SiS_Part4Port, 0x12, tempah); + USHORT vclkindex; + USHORT tempah,temp1; + + vclkindex = SiS_GetVCLK2Ptr(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((ModeNo == 0x4a) || (ModeNo == 0x38)) { + SiS_SetReg1(SiS_Part4Port,0x0a,0x57); + SiS_SetReg1(SiS_Part4Port,0x0b,0x46); + SiS_SetReg1(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); + tempah = 0x08; + if(SiS_VBInfo & SetCRT2ToRAMDAC) { + tempah |= 0x020; + } + temp1 = SiS_GetReg1(SiS_Part4Port,0x12); + tempah |= temp1; + SiS_SetReg1(SiS_Part4Port,0x12,tempah); } +/* TW: Double-checked against 650/LVDS (1.10.07), 630/301B/LVDS/LVDS+CH, 650/301LV BIOS */ USHORT -SiS_GetVCLK2Ptr (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex, - PSIS_HW_DEVICE_INFO HwDeviceExtension) +SiS_GetVCLK2Ptr(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension) { - USHORT tempbx; -#ifdef CONFIG_FB_SIS_300 - USHORT LCDXlat1VCLK[4] = { VCLK65, VCLK65, VCLK65, VCLK65 }; - USHORT LCDXlat2VCLK[4] = { VCLK108_2, VCLK108_2, VCLK108_2, VCLK108_2 }; - USHORT LVDSXlat2VCLK[4] = { VCLK65, VCLK65, VCLK65, VCLK65 }; - USHORT LVDSXlat3VCLK[4] = { VCLK65, VCLK65, VCLK65, VCLK65 }; -#else /* SIS315H */ - USHORT LCDXlat1VCLK[4] = - { VCLK65 + 2, VCLK65 + 2, VCLK65 + 2, VCLK65 + 2 }; - USHORT LCDXlat2VCLK[4] = - { VCLK108_2 + 5, VCLK108_2 + 5, VCLK108_2 + 5, VCLK108_2 + 5 }; - USHORT LVDSXlat2VCLK[4] = - { VCLK65 + 2, VCLK65 + 2, VCLK65 + 2, VCLK65 + 2 }; - USHORT LVDSXlat3VCLK[4] = - { VCLK65 + 2, VCLK65 + 2, VCLK65 + 2, VCLK65 + 2 }; + USHORT tempbx; +#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}; +#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 */ +#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; + +#ifdef SIS315H + if(HwDeviceExtension->jChipType >= SIS_315H) { + LCDXlatVCLK1 = LCDXlat1VCLK310; + LCDXlatVCLK2 = LCDXlat2VCLK310; + LVDSXlatVCLK2 = LVDSXlat2VCLK310; + LVDSXlatVCLK3 = LVDSXlat3VCLK310; + } else { +#endif +#ifdef SIS300 + LCDXlatVCLK1 = LCDXlat1VCLK300; + LCDXlatVCLK2 = LCDXlat2VCLK300; + LVDSXlatVCLK2 = LVDSXlat2VCLK300; + LVDSXlatVCLK3 = LVDSXlat3VCLK300; +#endif +#ifdef SIS315H + } #endif - USHORT LVDSXlat1VCLK[4] = { VCLK40, VCLK40, VCLK40, VCLK40 }; - USHORT CRT2Index, VCLKIndex; - USHORT modeflag, resinfo; - UCHAR *CHTVVCLKPtr = NULL; - - if (ModeNo <= 0x13) { - modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ - resinfo = SiS_SModeIDTable[ModeIdIndex].St_ResInfo; - CRT2Index = SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; - } else { - modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */ - resinfo = SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; - CRT2Index = SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; - } - if (SiS_IF_DEF_LVDS == 0) { - CRT2Index = CRT2Index >> 6; /* for LCD */ - if ((SiS_VBInfo & SetCRT2ToLCD) || (SiS_VBInfo & SetCRT2ToLCDA)) { /*301b */ - if (SiS_LCDResInfo != Panel1024x768) { - VCLKIndex = LCDXlat2VCLK[CRT2Index]; - } else { - VCLKIndex = LCDXlat1VCLK[CRT2Index]; - } - } else { /* for TV */ - if (SiS_VBInfo & SetCRT2ToTV) { - if (SiS_IF_DEF_HiVision == 1) { - if (SiS_SetFlag & RPLLDIV2XO) { - VCLKIndex = HiTVVCLKDIV2; - if (HwDeviceExtension-> - jChipType >= SIS_315H) { /* 310 series */ -/* VCLKIndex += 11; for chip310 0x2E */ - VCLKIndex += 25; /* for chip315 */ - } - } else { - VCLKIndex = HiTVVCLK; - if (HwDeviceExtension-> - jChipType >= SIS_315H) { /* 310 series */ -/* VCLKIndex += 11; for chip310 0x2E */ - VCLKIndex += 25; /* for chip315 */ - } - } - if (SiS_SetFlag & TVSimuMode) { - if (modeflag & Charx8Dot) { - VCLKIndex = - HiTVSimuVCLK; - if (HwDeviceExtension-> - jChipType >= SIS_315H) { /* 310 series */ -/* VCLKIndex += 11; for chip310 0x2E */ - VCLKIndex += 25; /* for chip315 */ - } - } else { - VCLKIndex = - HiTVTextVCLK; - if (HwDeviceExtension-> - jChipType >= SIS_315H) { /* 310 series */ -/* VCLKIndex += 11; for chip310 0x2E */ - VCLKIndex += 25; /* for chip315 */ - } - } - } - } else { - if (SiS_VBInfo & SetCRT2ToTV) { - if (SiS_SetFlag & RPLLDIV2XO) { - VCLKIndex = TVVCLKDIV2; - if (HwDeviceExtension-> - jChipType >= SIS_315H) { /* 310 series */ -/* VCLKIndex += 11; for chip310 0x2E */ - VCLKIndex += 25; /* for chip315 */ - } - } else { - VCLKIndex = TVVCLK; - if (HwDeviceExtension-> - jChipType >= SIS_315H) { /* 310 series */ -/* VCLKIndex += 11; for chip310 0x2E */ - VCLKIndex += 25; /* for chip315 */ - } - } - } - } - } else { /* for CRT2 */ - VCLKIndex = - (UCHAR) SiS_GetReg2 ((USHORT) (SiS_P3ca + 0x02)); /* Port 3cch */ - VCLKIndex = ((VCLKIndex >> 2) & 0x03); - if (ModeNo > 0x13) { - VCLKIndex = - SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; /* di+Ext_CRTVCLK */ - VCLKIndex = VCLKIndex & 0x3f; + if(ModeNo<=0x13) { + modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + resinfo = SiS_SModeIDTable[ModeIdIndex].St_ResInfo; + CRT2Index = SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; + } else { + modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + resinfo = SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; + CRT2Index = SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; + } + + if(SiS_IF_DEF_LVDS==0) { /* 301 */ + + if (SiS_SetFlag & ProgrammingCRT2) { + + CRT2Index >>= 6; + if(SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)){ /* LCD */ + if(HwDeviceExtension->jChipType < SIS_315H) { + /* TW: Inserted from 630/301B BIOS */ + if(SiS_LCDResInfo == Panel800x600) + VCLKIndex = LCDXlat0VCLK[CRT2Index]; + else if(SiS_LCDResInfo == Panel1024x768) + VCLKIndex = LCDXlatVCLK1[CRT2Index]; + else + VCLKIndex = LCDXlatVCLK2[CRT2Index]; + } else { + /* TW: 650/301LV BIOS does not check expanding, 315 does */ + if( (HwDeviceExtension->jChipType > SIS_315PRO) || + (!(SiS_LCDInfo & LCDNonExpanding)) ) { + if(SiS_LCDResInfo == Panel1024x768){ + VCLKIndex = LCDXlatVCLK1[CRT2Index]; + } else if(SiS_LCDResInfo == Panel1280x960) { + VCLKIndex = 0x45; + if(resinfo == 0x09) VCLKIndex++; + } else { + VCLKIndex = LCDXlatVCLK2[CRT2Index]; + } + } else { + VCLKIndex = (UCHAR)SiS_GetReg2((USHORT)(SiS_P3ca+0x02)); /* Port 3cch */ + VCLKIndex = ((VCLKIndex >> 2) & 0x03); + if(ModeNo > 0x13) { + VCLKIndex = SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; + } + if(ModeNo <= 0x13) { /* TW: Inserted from 315 BIOS */ + if(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_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 = ((VCLKIndex >> 2) & 0x03); + if(ModeNo > 0x13) { + VCLKIndex = 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 { /* LVDS */ - if (ModeNo <= 0x13) - VCLKIndex = CRT2Index; - else - VCLKIndex = CRT2Index; - if (SiS_IF_DEF_CH7005 == 1) { - if (!(SiS_VBInfo & SetCRT2ToLCD)) { - VCLKIndex = VCLKIndex & 0x1f; - tempbx = 0; - if (SiS_VBInfo & SetPALTV) - tempbx = tempbx + 2; - if (SiS_VBInfo & SetCHTVOverScan) - tempbx = 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; - } - VCLKIndex = CHTVVCLKPtr[VCLKIndex]; - } - } else { - VCLKIndex = VCLKIndex >> 6; - if (SiS_LCDResInfo == Panel800x600) - VCLKIndex = LVDSXlat1VCLK[VCLKIndex]; - else if (SiS_LCDResInfo == Panel1024x768) - VCLKIndex = LVDSXlat2VCLK[VCLKIndex]; - else - VCLKIndex = LVDSXlat3VCLK[VCLKIndex]; - } - } -/*VCLKIndex=VCLKIndex&0x3F; */ - if (HwDeviceExtension->jChipType < SIS_315H) { /* for300 serial */ - VCLKIndex = VCLKIndex & 0x3F; - } - return (VCLKIndex); + } + } + + } else { /* If not programming CRT2 */ + + VCLKIndex = (UCHAR)SiS_GetReg2((USHORT)(SiS_P3ca+0x02)); + VCLKIndex = ((VCLKIndex >> 2) & 0x03); + if(ModeNo > 0x13) { + VCLKIndex = SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; + if(HwDeviceExtension->jChipType < SIS_315H) { + VCLKIndex &= 0x3f; + if(HwDeviceExtension->jChipType != SIS_630) { + if(VCLKIndex == 0x1b) VCLKIndex = 0x35; + } + } + } + } + + } else { /* LVDS */ + + VCLKIndex = CRT2Index; + + if(SiS_SetFlag & ProgrammingCRT2) { /* programming CRT2 */ + + if( (SiS_IF_DEF_CH70xx != 0) && (SiS_VBInfo & SetCRT2ToTV) ) { + + VCLKIndex &= 0x1f; + tempbx = 0; + if(SiS_VBInfo & SetPALTV) tempbx += 2; + if(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; + } + VCLKIndex = CHTVVCLKPtr[VCLKIndex]; + + } else if(SiS_VBInfo & SetCRT2ToLCD) { + + VCLKIndex >>= 6; + if((SiS_LCDResInfo==Panel800x600) || (SiS_LCDResInfo==Panel320x480)) + VCLKIndex = LVDSXlat1VCLK[VCLKIndex]; + else if(SiS_LCDResInfo==Panel1024x768) + VCLKIndex = LVDSXlatVCLK2[VCLKIndex]; + else VCLKIndex = LVDSXlatVCLK3[VCLKIndex]; + + } else { + + VCLKIndex = (UCHAR)SiS_GetReg2((USHORT)(SiS_P3ca+0x02)); + VCLKIndex = ((VCLKIndex >> 2) & 0x03); + if(ModeNo > 0x13) { + VCLKIndex = SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; + 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 = ((VCLKIndex >> 2) & 0x03); + if(ModeNo > 0x13) { + VCLKIndex = SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; + if(HwDeviceExtension->jChipType < SIS_315H) { + if(HwDeviceExtension->jChipType != SIS_630) { + if(VCLKIndex == 0x1b) VCLKIndex = 0x35; + } + } + } + + } + + } + + if(HwDeviceExtension->jChipType < SIS_315H) { + VCLKIndex &= 0x3F; + } + return (VCLKIndex); } +/* TW: Set 301 Palette address port registers */ +/* TW: Checked against 650/301LV BIOS */ void -SiS_SetGroup5 (USHORT BaseAddr, ULONG ROMAddr, USHORT ModeNo, - USHORT ModeIdIndex) +SiS_SetGroup5(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo, + USHORT ModeIdIndex) { - USHORT Pindex, Pdata; - Pindex = SiS_Part5Port; - Pdata = SiS_Part5Port + 1; - if (SiS_ModeType == ModeVGA) { - if (! - (SiS_VBInfo & - (SetInSlaveMode | LoadDACFlag | CRT2DisplayFlag))) { - SiS_EnableCRT2 (); -/* LoadDAC2(ROMAddr,SiS_Part5Port,ModeNo,ModeIdIndex); */ - } - } - return; + 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 (ULONG ROMAddr, USHORT SiS_Part5Port, USHORT ModeNo, - USHORT ModeIdIndex) +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 (ModeNo <= 0x13) { - modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ - } else { - modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */ - } + 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(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); + if(time == 256) j = 16; + else j = time; - 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 = data2 + 0x15; - SiS_SetReg3 (Pdata, data2); - data = data >> 2; - } - } + SiS_SetReg3(Pindex,0x00); - if (time == 256) { - for (i = 16; i < 32; i++) { - data = table[i]; - 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 */ + 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(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) +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; - } - } - SiS_SetReg3 (Pdata, (USHORT) dh); - SiS_SetReg3 (Pdata, (USHORT) bh); - SiS_SetReg3 (Pdata, (USHORT) bl); + 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; + } + } + 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_SetCHTVReg (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex) +SiS_ModCRT1CRTC(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension) { - USHORT temp, tempbx, tempcl; -/* USHORT CRT2CRTC; */ - USHORT TVType, resindex; - SiS_CHTVRegDataStruct *CHTVRegData = NULL; + USHORT temp,tempah,i,modeflag,j; + USHORT ResInfo,DisplayType; + SiS_LVDSCRT1DataStruct *LVDSCRT1Ptr=NULL; + + if(ModeNo <= 0x13) { + modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + } else { + modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + } + + temp = SiS_GetLVDSCRT1Ptr(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; + } + + 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 */ + + tempah = (LVDSCRT1Ptr+ResInfo)->CR[0]; + SiS_SetReg1(SiS_P3d4,0x00,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 &= 0xE0; + SiS_SetRegANDOR(SiS_P3c4,0x0E,0x1f,tempah); /* TW: Modfied (650/LVDS); Was SetReg(tempah) */ + + tempah = (LVDSCRT1Ptr+ResInfo)->CR[14]; + tempah &= 0x01; + tempah <<= 5; + if(modeflag & DoubleScanMode){ + tempah |= 0x080; + } + SiS_SetRegANDOR(SiS_P3d4,0x09,~0x020,tempah); + + /* TW: Inserted from 650/LVDS BIOS */ + if(SiS_VBInfo & SetCRT2ToTV) { + if(modeflag & HalfDCLK) + SiS_SetRegAND(SiS_P3d4,0x11,0x7f); + } + + return; +} - if (ModeNo <= 0x13) { - tempcl = SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; - } else { - tempcl = SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; - } - TVType = 0; - if (SiS_VBInfo & SetPALTV) - TVType = TVType + 2; - if (SiS_VBInfo & SetCHTVOverScan) - TVType = 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; - } - resindex = tempcl & 0x3F; +#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 - if (SiS_VBInfo & SetPALTV) { - SiS_SetCH7005 (0x4304); - SiS_SetCH7005 (0x6909); - } else { - SiS_SetCH7005 (0x0304); - SiS_SetCH7005 (0x7109); - } +BOOLEAN +SiS_GetLCDACRT1Ptr(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,USHORT *ResInfo, + USHORT *DisplayType) + { + USHORT tempbx=0,modeflag=0; + USHORT CRT2CRTC=0; - temp = CHTVRegData[resindex].Reg[0]; - tempbx = ((temp & 0x00FF) << 8) | 0x00; - SiS_SetCH7005 (tempbx); - temp = CHTVRegData[resindex].Reg[1]; - tempbx = ((temp & 0x00FF) << 8) | 0x07; - SiS_SetCH7005 (tempbx); - temp = CHTVRegData[resindex].Reg[2]; - tempbx = ((temp & 0x00FF) << 8) | 0x08; - SiS_SetCH7005 (tempbx); - temp = CHTVRegData[resindex].Reg[3]; - tempbx = ((temp & 0x00FF) << 8) | 0x0A; - SiS_SetCH7005 (tempbx); - temp = CHTVRegData[resindex].Reg[4]; - tempbx = ((temp & 0x00FF) << 8) | 0x0B; - SiS_SetCH7005 (tempbx); - - SiS_SetCH7005 (0x2801); - SiS_SetCH7005 (0x3103); - SiS_SetCH7005 (0x003D); - SiS_SetCHTVRegANDOR (0x0010, 0x1F); - SiS_SetCHTVRegANDOR (0x0211, 0xF8); - SiS_SetCHTVRegANDOR (0x001C, 0xEF); - - if (!(SiS_VBInfo & SetPALTV)) { - /* tempcl=CRT2CRTC; */ - tempcl = tempcl & 0x3F; - if (SiS_VBInfo & SetCHTVOverScan) { - if (tempcl == 0x04) { /* 640x480 underscan */ - SiS_SetCHTVRegANDOR (0x0020, 0xEF); - SiS_SetCHTVRegANDOR (0x0121, 0xFE); - } else { - if (tempcl == 0x05) { /* 800x600 underscan */ - SiS_SetCHTVRegANDOR (0x0118, 0xF0); - SiS_SetCHTVRegANDOR (0x0C19, 0xF0); - SiS_SetCHTVRegANDOR (0x001A, 0xF0); - SiS_SetCHTVRegANDOR (0x001B, 0xF0); - SiS_SetCHTVRegANDOR (0x001C, 0xF0); - SiS_SetCHTVRegANDOR (0x001D, 0xF0); - SiS_SetCHTVRegANDOR (0x001E, 0xF0); - SiS_SetCHTVRegANDOR (0x001F, 0xF0); - SiS_SetCHTVRegANDOR (0x0120, 0xEF); - SiS_SetCHTVRegANDOR (0x0021, 0xFE); - } - } - } else { - if (tempcl == 0x04) { /* 640x480 overscan */ - SiS_SetCHTVRegANDOR (0x0020, 0xEF); - SiS_SetCHTVRegANDOR (0x0121, 0xFE); - } else { - if (tempcl == 0x05) { /* 800x600 overscan */ - SiS_SetCHTVRegANDOR (0x0118, 0xF0); - SiS_SetCHTVRegANDOR (0x0F19, 0xF0); - SiS_SetCHTVRegANDOR (0x011A, 0xF0); - SiS_SetCHTVRegANDOR (0x0C1B, 0xF0); - SiS_SetCHTVRegANDOR (0x071C, 0xF0); - SiS_SetCHTVRegANDOR (0x011D, 0xF0); - SiS_SetCHTVRegANDOR (0x0C1E, 0xF0); - SiS_SetCHTVRegANDOR (0x071F, 0xF0); - SiS_SetCHTVRegANDOR (0x0120, 0xEF); - SiS_SetCHTVRegANDOR (0x0021, 0xFE); - } - } - } - } + 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; + } + + 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, + 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(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; + } + + 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(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 = 14; + if(SiS_LCDInfo & LCDNonExpanding) tempbx += 2; + if(modeflag & HalfDCLK) tempbx++; + } else if(SiS_LCDInfo & 0x0100) { + tempbx = 12; + if(modeflag & HalfDCLK) tempbx++; + } else if(SiS_LCDResInfo == Panel1024x600) { + tempbx = 23; + if(SiS_LCDInfo & LCDNonExpanding) tempbx += 2; + if(modeflag & HalfDCLK) tempbx++; + } else if(SiS_LCDResInfo == Panel1152x768) { + tempbx = 27; + if(SiS_LCDInfo & LCDNonExpanding) tempbx += 2; + if(modeflag & HalfDCLK) tempbx++; + } + } + } + if(SiS_IF_DEF_FSTN){ + if(SiS_LCDResInfo==Panel320x480){ + tempbx=22; + } + } + *ResInfo = CRT2CRTC & 0x3F; + *DisplayType = tempbx; + return 1; } +/* TW: Checked against 650/LVDS (1.10a, 1.10.07), 630/301B (I/II) and 630/LVDS BIOS */ void -SiS_SetCHTVRegANDOR (USHORT tempax, USHORT tempbh) +SiS_SetCRT2ECLK(UCHAR *ROMAddr, USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension) { - USHORT tempal, tempah, tempbl; + USHORT tempah,tempal,pushax; + USHORT vclkindex=0; - tempal = tempax & 0x00FF; - tempah = (tempax >> 8) & 0x00FF; - tempbl = SiS_GetCH7005 (tempal); - tempbl = (((tempbl & tempbh) | tempah) << 8 | tempal); - SiS_SetCH7005 (tempbl); + 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; + tempal &= 0x3F; + if(tempal == 2) RefreshRateTableIndex--; + vclkindex = SiS_GetVCLK2Ptr(ROMAddr,ModeNo,ModeIdIndex, + RefreshRateTableIndex,HwDeviceExtension); + SiS_SetFlag |= ProgrammingCRT2; + } else { + vclkindex = SiS_GetVCLK2Ptr(ROMAddr,ModeNo,ModeIdIndex, + RefreshRateTableIndex,HwDeviceExtension); + } + + tempal = 0x02B; + if(!(SiS_VBInfo & SetCRT2ToLCDA)) { + if(!(SiS_VBInfo & SetInSlaveMode)) { + tempal += 3; + } + } + SiS_SetReg1(SiS_P3c4,0x05,0x86); + pushax = tempal; + SiS_SetReg1(SiS_P3c4,0x31,0x20); + tempah = SiS_VCLKData[vclkindex].SR2B; + SiS_SetReg1(SiS_P3c4,tempal,tempah); + tempal++; + tempah = SiS_VCLKData[vclkindex].SR2C; + SiS_SetReg1(SiS_P3c4,tempal,tempah); + SiS_SetReg1(SiS_P3c4,0x31,0x10); + tempal = pushax; + tempah = SiS_VCLKData[vclkindex].SR2B; + SiS_SetReg1(SiS_P3c4,tempal,tempah); + tempal++; + tempah = SiS_VCLKData[vclkindex].SR2C; + SiS_SetReg1(SiS_P3c4,tempal,tempah); + SiS_SetReg1(SiS_P3c4,0x31,0x00); + tempal = pushax; + tempah = SiS_VCLKData[vclkindex].SR2B; + SiS_SetReg1(SiS_P3c4,tempal,tempah); + tempal++; + tempah = SiS_VCLKData[vclkindex].SR2C; + SiS_SetReg1(SiS_P3c4,tempal,tempah); + return; } +#if 0 /* TW: Not used */ void -SiS_SetCH7005 (USHORT tempbx) +SiS_SetDefCRT2ExtRegs(USHORT BaseAddr) { - USHORT tempah, temp; - - SiS_DDC_Port = 0x3c4; - SiS_DDC_Index = 0x11; - SiS_DDC_DataShift = 0x00; - SiS_DDC_DeviceAddr = 0xEA; - - temp = 1; - for (; temp != 0;) { - SiS_SetSwitchDDC2 (); - SiS_SetStart (); - tempah = SiS_DDC_DeviceAddr; - temp = SiS_WriteDDC2Data (tempah); - if (temp) - continue; - tempah = tempbx & 0x00FF; - temp = SiS_WriteDDC2Data (tempah); - if (temp) - continue; - tempah = (tempbx & 0xFF00) >> 8; - temp = SiS_WriteDDC2Data (tempah); - if (temp) - continue; - SiS_SetStop (); - } + 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); + temp &= 0xC3; + SiS_SetReg1(SiS_P3d4,0x35,temp); + } else { + SiS_SetReg1(SiS_P3d4,0x32,0x02); + SiS_SetReg1(SiS_Part1Port,0x02,0x00); + } } +#endif -USHORT -SiS_GetCH7005 (USHORT tempbx) -{ - USHORT tempah, temp; - - SiS_DDC_Port = 0x3c4; - SiS_DDC_Index = 0x11; - SiS_DDC_DataShift = 0x00; - SiS_DDC_DeviceAddr = 0xEA; - SiS_DDC_ReadAddr = tempbx; - - for (;;) { - SiS_SetSwitchDDC2 (); - SiS_SetStart (); - tempah = SiS_DDC_DeviceAddr; - temp = SiS_WriteDDC2Data (tempah); - if (temp) - continue; - tempah = SiS_DDC_ReadAddr; - temp = SiS_WriteDDC2Data (tempah); - if (temp) - continue; - - SiS_SetStart (); - tempah = SiS_DDC_DeviceAddr; - tempah = tempah | 0x01; - temp = SiS_WriteDDC2Data (tempah); - if (temp) - continue; - tempah = SiS_ReadDDC2Data (tempah); - SiS_SetStop (); - return (tempah); - } -} +/* TW: Start of Chrontel 70xx functions ---------------------- */ +/* Set-up the Chrontel Registers */ void -SiS_SetSwitchDDC2 (void) +SiS_SetCHTVReg(UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex) { - USHORT i; + USHORT temp,tempbx,tempcl; + USHORT TVType,resindex; + SiS_CHTVRegDataStruct *CHTVRegData=NULL; + + if(ModeNo<=0x13) + tempcl = SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; + else + tempcl = SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; + + TVType = 0; + if(SiS_VBInfo & SetPALTV) TVType += 2; + if(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; + } + resindex = tempcl & 0x3F; + + if(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)*/ + } else { + SiS_SetCH700x(0x0304); /* TW: upper nibble=71uA (NTSC), 0x03=15bit non-multi RGB*/ + SiS_SetCH700x(0x7109); /* TW: Black level for NTSC (113)*/ + } - SiS_SetSCLKHigh (); - for (i = 0; i < 1000; i++) { - SiS_GetReg1 (SiS_DDC_Port, 0x05); - } - SiS_SetSCLKLow (); - for (i = 0; i < 1000; i++) { - SiS_GetReg1 (SiS_DDC_Port, 0x05); - } + temp = CHTVRegData[resindex].Reg[0]; + tempbx=((temp&0x00FF)<<8)|0x00; /* TW: Mode register */ + SiS_SetCH700x(tempbx); + temp = CHTVRegData[resindex].Reg[1]; + tempbx=((temp&0x00FF)<<8)|0x07; /* TW: Start active video register */ + SiS_SetCH700x(tempbx); + temp = CHTVRegData[resindex].Reg[2]; + tempbx=((temp&0x00FF)<<8)|0x08; /* TW: Position overflow register */ + SiS_SetCH700x(tempbx); + temp = CHTVRegData[resindex].Reg[3]; + tempbx=((temp&0x00FF)<<8)|0x0A; /* TW: Horiz Position register */ + SiS_SetCH700x(tempbx); + temp = CHTVRegData[resindex].Reg[4]; + tempbx=((temp&0x00FF)<<8)|0x0B; /* TW: Vertical Position register */ + SiS_SetCH700x(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); + + /* TW: Set video bandwidth + High bandwith Luma composite video filter(S0=1) + low bandwith Luma S-video filter (S2-1=00) + disable peak filter in S-video channel (S3=0) + high bandwidth Chroma Filter (S5-4=11) + =00110001=0x31 + */ + SiS_SetCH700x(0xb103); /* old: 3103 */ + + /* TW: Register 0x3D does not exist in non-macrovision register map + (Maybe this is a macrovision register?) + */ + /* SiS_SetCH70xx(0x003D); */ + + /* TW: Register 0x10 only contains 1 writable bit (S0) for sensing, + all other bits a read-only. Macrovision? + */ + SiS_SetCH70xxANDOR(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) ) + */ + SiS_SetCH70xxANDOR(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 */ + } 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 */ + } + } + } else { + if(tempcl==0x04) { /* ----- 640x480 underscan; Mode 17 */ + SiS_SetCH70xxANDOR(0x0020,0xEF); /* loop filter off */ + SiS_SetCH70xxANDOR(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 */ + } + } + } + } 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 */ + } else { + SiS_SetCH70xxANDOR(0x0020,0xEF); /* loop filter off */ + SiS_SetCH70xxANDOR(0x0121,0xFE); /* ACIV on */ + } + } + + } else { + + /* Chrontel 7019 */ + + /* TW: We don't support modes >1024x768 */ + if (resindex > 6) return; + + temp = CHTVRegData[resindex].Reg[0]; + tempbx=((temp & 0x00FF) <<8 ) | 0x00; + SiS_SetCH701x(tempbx); + + temp = CHTVRegData[resindex].Reg[1]; + tempbx=((temp & 0x00FF) <<8 ) | 0x01; + SiS_SetCH701x(tempbx); + + temp = CHTVRegData[resindex].Reg[2]; + tempbx=((temp & 0x00FF) <<8 ) | 0x02; + SiS_SetCH701x(tempbx); + + temp = CHTVRegData[resindex].Reg[3]; + tempbx=((temp & 0x00FF) <<8 ) | 0x04; + SiS_SetCH701x(tempbx); + + temp = CHTVRegData[resindex].Reg[4]; + tempbx=((temp & 0x00FF) <<8 ) | 0x03; + SiS_SetCH701x(tempbx); + + temp = CHTVRegData[resindex].Reg[5]; + tempbx=((temp & 0x00FF) <<8 ) | 0x05; + SiS_SetCH701x(tempbx); + + temp = CHTVRegData[resindex].Reg[6]; + tempbx=((temp & 0x00FF) <<8 ) | 0x06; + SiS_SetCH701x(tempbx); + + temp = CHTVRegData[resindex].Reg[7]; + tempbx=((temp & 0x00FF) <<8 ) | 0x07; + SiS_SetCH701x(tempbx); + + temp = CHTVRegData[resindex].Reg[8]; + tempbx=((temp & 0x00FF) <<8 ) | 0x08; + SiS_SetCH701x(tempbx); + + temp = CHTVRegData[resindex].Reg[9]; + tempbx=((temp & 0x00FF) <<8 ) | 0x15; + SiS_SetCH701x(tempbx); + + temp = CHTVRegData[resindex].Reg[10]; + tempbx=((temp & 0x00FF) <<8 ) | 0x1f; + SiS_SetCH701x(tempbx); + + temp = CHTVRegData[resindex].Reg[11]; + tempbx=((temp & 0x00FF) <<8 ) | 0x0c; + SiS_SetCH701x(tempbx); + + temp = CHTVRegData[resindex].Reg[12]; + tempbx=((temp & 0x00FF) <<8 ) | 0x0d; + SiS_SetCH701x(tempbx); + + temp = CHTVRegData[resindex].Reg[13]; + tempbx=((temp & 0x00FF) <<8 ) | 0x0e; + SiS_SetCH701x(tempbx); + + temp = CHTVRegData[resindex].Reg[14]; + tempbx=((temp & 0x00FF) <<8 ) | 0x0f; + SiS_SetCH701x(tempbx); + + temp = CHTVRegData[resindex].Reg[15]; + tempbx=((temp & 0x00FF) <<8 ) | 0x10; + SiS_SetCH701x(tempbx); + +#if 0 /* TW: Not done in BIOS 1.10.07 */ + SiS_SetCH701x(0x3848); + SiS_DDC2Delay(SiS_I2CDELAYSHORT * 2); + SiS_SetCH701x(0x1848); +#endif + } } void -SiS_SetStart (void) +SiS_SetCHTVForLCD(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr) { - - SiS_SetSCLKLow (); - SiS_SetRegANDOR (SiS_DDC_Port, SiS_DDC_Index, 0xFD, 0x02); /* SetSDA(0x01); */ - SiS_SetSCLKHigh (); - SiS_SetRegANDOR (SiS_DDC_Port, SiS_DDC_Index, 0xFD, 0x00); /* SetSDA(0x00); */ - SiS_SetSCLKHigh (); + UCHAR regtable[] = { 0x1c, 0x5f, 0x64, 0x6f, 0x70, 0x71, + 0x72, 0x73, 0x74, 0x76, 0x78, 0x7d }; + UCHAR table28b4[] = { 0x60, 0x02, 0x00, 0x07, 0x40, 0xed, + 0xa3, 0xc8, 0xc7, 0xac, 0x60, 0x02 }; + UCHAR table28c0[] = { 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; + } else { + tableptr = table28b4; + } + tempbh = SiS_GetCH701x(0x74); + if((tempbh == 0xf6) || (tempbh == 0xc7)) { + tempbh = SiS_GetCH701x(0x73); + if(tempbh == 0xc8) { + if(SiS_LCDResInfo != Panel1400x1050) return; + } else if(tempbh == 0xdb) { + if(SiS_LCDResInfo == Panel1400x1050) return; + } + } + for(i=0; i<0x0c; i++) { + SiS_SetCH701x((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 */ } +/* TW: Chrontel 701x functions ================================= */ + void -SiS_SetStop (void) +SiS_Chrontel19f2(void) { - SiS_SetSCLKLow (); - SiS_SetRegANDOR (SiS_DDC_Port, SiS_DDC_Index, 0xFD, 0x00); /* SetSDA(0x00); */ - SiS_SetSCLKHigh (); - SiS_SetRegANDOR (SiS_DDC_Port, SiS_DDC_Index, 0xFD, 0x02); /* SetSDA(0x01); */ - SiS_SetSCLKHigh (); + UCHAR regtable[] = { 0x67, 0x68, 0x69, 0x6a, 0x6b }; + UCHAR table19e8[] = { 0x01, 0x02, 0x01, 0x01, 0x02 }; + UCHAR table19ed[] = { 0x01, 0x02, 0x01, 0x01, 0x02 }; + UCHAR *tableptr = NULL; + int i; + + if(SiS_LCDResInfo == Panel1400x1050) { + tableptr = table19ed; + } else { + tableptr = table19e8; + } + + for(i=0; i<5; i++) { + SiS_SetCH701x((tableptr[i] << 8) | regtable[i]); + } } -USHORT -SiS_WriteDDC2Data (USHORT tempax) +void +SiS_Chrontel701xOn() { - USHORT i, flag, temp; - - flag = 0x80; - for (i = 0; i < 8; i++) { - SiS_SetSCLKLow (); - if (tempax & flag) { - SiS_SetRegANDOR (SiS_DDC_Port, SiS_DDC_Index, 0xFD, - 0x02); - } else { - SiS_SetRegANDOR (SiS_DDC_Port, SiS_DDC_Index, 0xFD, - 0x00); - } - SiS_SetSCLKHigh (); - flag = flag >> 1; - } - temp = SiS_CheckACK (); - return (temp); + USHORT temp; + + if(SiS_IF_DEF_CH70xx == 2) { + temp = SiS_GetCH701x(0x66); + temp |= 0x20; + SiS_SetCH701x((temp << 8) | 0x66); + } } -USHORT -SiS_ReadDDC2Data (USHORT tempax) +void +SiS_Chrontel701xOn2(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr) { - USHORT i, temp, getdata; - - getdata = 0; - for (i = 0; i < 8; i++) { - getdata = getdata << 1; - SiS_SetSCLKLow (); - SiS_SetRegANDOR (SiS_DDC_Port, SiS_DDC_Index, 0xFD, 0x02); - SiS_SetSCLKHigh (); - temp = SiS_GetReg1 (SiS_DDC_Port, SiS_DDC_Index); - if (temp & 0x02) - getdata = getdata | 0x01; - } - return (getdata); + USHORT temp; + + if(SiS_IF_DEF_CH70xx == 2) { + if(SiS_IsYPbPr(HwDeviceExtension, BaseAddr)) { + temp = SiS_GetCH701x(0x01); + temp &= 0x3f; + temp |= 0x80; + SiS_SetCH701x((temp << 8) | 0x01); + } + SiS_SetCH701x(0x2049); + temp = SiS_GetCH701x(0x49); + if(SiS_IsYPbPr(HwDeviceExtension, BaseAddr)) { + temp = SiS_GetCH701x(0x73); + temp |= 0x60; + SiS_SetCH701x((temp << 8) | 0x73); + } + /* TW: New from BIOS 1.10.07: */ + temp = SiS_GetCH701x(0x47); + temp &= 0x7f; + SiS_SetCH701x((temp << 8) | 0x47); + SiS_LongDelay(2); + temp = SiS_GetCH701x(0x47); + temp |= 0x80; + SiS_SetCH701x((temp << 8) | 0x47); + } } void -SiS_SetSCLKLow (void) +SiS_Chrontel701xOff() { - USHORT temp; + USHORT temp; - SiS_SetRegANDOR (SiS_DDC_Port, SiS_DDC_Index, 0xFE, 0x00); /* SetSCLKLow() */ - do { - temp = SiS_GetReg1 (SiS_DDC_Port, SiS_DDC_Index); - } while (temp & 0x01); - SiS_DDC2Delay (); + if(SiS_IF_DEF_CH70xx == 2) { + temp = SiS_GetCH701x(0x66); + temp &= 0xDF; + SiS_SetCH701x((temp << 8) | 0x66); + } } void -SiS_SetSCLKHigh (void) +SiS_Chrontel701xOff2() { - USHORT temp; + USHORT temp; + + if(SiS_IF_DEF_CH70xx == 2) { + SiS_LongDelay(2); + temp = SiS_GetCH701x(0x76); + temp &= 0xfc; + SiS_SetCH701x((temp << 8) | 0x76); + SiS_SetCH701x(0x0066); + } +} - SiS_SetRegANDOR (SiS_DDC_Port, SiS_DDC_Index, 0xFE, 0x01); /* SetSCLKHigh() */ - do { - temp = SiS_GetReg1 (SiS_DDC_Port, SiS_DDC_Index); - } while (!(temp & 0x01)); - SiS_DDC2Delay (); +void +SiS_ChrontelFlip0x48() +{ + SiS_SetCH701x(0x1048); + SiS_LongDelay(1); + SiS_SetCH701x(0x1848); } void -SiS_DDC2Delay (void) +SiS_ChrontelDoSomething4(PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr) { - USHORT i; + USHORT temp; + + SiS_SetCH701x(0xaf76); + temp = SiS_GetCH701x(0x49); + temp &= 1; + if(temp != 1) { + temp = SiS_GetCH701x(0x47); + temp &= 0x70; + SiS_SetCH701x((temp << 8) | 0x47); + SiS_LongDelay(3); + temp = SiS_GetCH701x(0x47); + temp |= 0x80; + SiS_SetCH701x((temp << 8) | 0x47); + } +} - for (i = 0; i < DDC2DelayTime; i++) { - SiS_GetReg1 (SiS_P3c4, 0x05); - } +void +SiS_ChrontelDoSomething3(USHORT ModeNo,PSIS_HW_DEVICE_INFO HwDeviceExtension, + USHORT BaseAddr) +{ + USHORT temp,temp1; + + temp1 = 0; + temp = SiS_GetCH701x(0x61); + if(temp < 2) { + temp++; + SiS_SetCH701x((temp << 8) | 0x61); + temp1 = 1; + } + SiS_SetCH701x(0xac76); + temp = SiS_GetCH701x(0x66); + temp |= 0x5f; + SiS_SetCH701x((temp << 8) | 0x66); + if(ModeNo > 0x13) { + if(SiS_WeHaveBacklightCtrl(HwDeviceExtension, BaseAddr)) { + SiS_GenericDelay(0x3ff); + } else { + SiS_GenericDelay(0x2ff); + } + } else { + if(!temp1) + SiS_GenericDelay(0x2ff); + } + temp = SiS_GetCH701x(0x76); + temp |= 0x03; + SiS_SetCH701x((temp << 8) | 0x76); + temp = SiS_GetCH701x(0x66); + temp &= 0x7f; + SiS_SetCH701x((temp << 8) | 0x66); + SiS_LongDelay(1); } -USHORT -SiS_CheckACK (void) +void +SiS_ChrontelDoSomething2(PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr) { - USHORT tempah; - - SiS_SetSCLKLow (); - SiS_SetRegANDOR (SiS_DDC_Port, SiS_DDC_Index, 0xFD, 0x02); - SiS_SetSCLKHigh (); - tempah = SiS_GetReg1 (SiS_DDC_Port, SiS_DDC_Index); - SiS_SetSCLKLow (); - if (tempah & 0x02) - return (1); - else - return (0); + USHORT temp,tempcl,tempch; + + SiS_LongDelay(1); + tempcl = 3; + tempch = 0; + + do { + temp = SiS_GetCH701x(0x66); + temp &= 0x04; + if(temp == 0x04) break; + + SiS_SetCHTVForLCD(HwDeviceExtension, BaseAddr); + + if(tempcl == 0) { + if(tempch == 3) break; + SiS_ChrontelFlip0x48(); + tempcl = 3; + tempch++; + } + tempcl--; + temp = SiS_GetCH701x(0x76); + temp &= 0xfb; + SiS_SetCH701x((temp << 8) | 0x76); + SiS_LongDelay(2); + temp = SiS_GetCH701x(0x76); + temp |= 0x04; + SiS_SetCH701x((temp << 8) | 0x76); + SiS_SetCH701x(0x6078); + SiS_LongDelay(2); + } while(0); + + SiS_SetCH701x(0x0077); } void -SiS_ModCRT1CRTC (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex) +SiS_ChrontelDoSomething1(PSIS_HW_DEVICE_INFO HwDeviceExtension, + USHORT BaseAddr) { - USHORT temp, tempah, i, modeflag, j; - USHORT ResInfo, DisplayType; - SiS_LVDSCRT1DataStruct *LVDSCRT1Ptr = NULL; + USHORT temp; - if (ModeNo <= 0x13) { - modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ - } else { - modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */ - } + temp = SiS_GetCH701x(0x03); + temp |= 0x80; + temp &= 0xbf; + SiS_SetCH701x((temp << 8) | 0x03); - temp = - SiS_GetLVDSCRT1Ptr (ROMAddr, ModeNo, ModeIdIndex, - RefreshRateTableIndex, &ResInfo, &DisplayType); - if (temp == 0) { - return; - } + SiS_ChrontelFlip0x48(); - 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_CHTVCRT1UNTSC; - break; - case 13: - LVDSCRT1Ptr = SiS_CHTVCRT1ONTSC; - break; - case 14: - LVDSCRT1Ptr = SiS_CHTVCRT1UPAL; - break; - case 15: - LVDSCRT1Ptr = SiS_CHTVCRT1OPAL; - break; - } + SiS_ChrontelDoSomething2(HwDeviceExtension, BaseAddr); + + temp = SiS_GetReg1(SiS_P3d4,0x34); + SiS_ChrontelDoSomething3(temp, HwDeviceExtension, BaseAddr); - 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); - } + SiS_SetCH701x(0xaf76); +} - for (i = 0x0A, j = 11; i <= 0x0C; i++, j++) { - tempah = (LVDSCRT1Ptr + ResInfo)->CR[j]; - SiS_SetReg1 (SiS_P3c4, i, tempah); - } +/* TW: End of Chrontel 701x functions ==================================== */ - tempah = (LVDSCRT1Ptr + ResInfo)->CR[14]; - tempah = tempah & 0x0E0; - SiS_SetReg1 (SiS_P3c4, 0x0E, tempah); +/* TW: Generic Read/write routines for Chrontel ========================== */ - 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; +/* 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). + * + * On 630(S)T chipset, the port changed from 0x11 to 0x0a + */ + +void +SiS_SetCH70xx(USHORT tempbx) +{ + if (SiS_IF_DEF_CH70xx == 1) + SiS_SetCH700x(tempbx); + else + SiS_SetCH701x(tempbx); } -/*301b*/ +/* TW: Write to Chrontel 700x */ +/* Parameter is [Data (S15-S8) | Register no (S7-S0)] */ void -SiS_CHACRT1CRTC (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex) +SiS_SetCH700x(USHORT tempbx) { - USHORT temp, tempah, i, modeflag, j; - USHORT ResInfo, DisplayType; - SiS_LVDSCRT1DataStruct *LVDSCRT1Ptr = NULL; + 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) */ + } + + 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; + 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) */ + + 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; + return; + } + } +} - if (ModeNo <= 0x13) { - modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ - } else { - modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */ - } +/* TW: Write to Chrontel 701x */ +/* Parameter is [Data (S15-S8) | Register no (S7-S0)] */ +void +SiS_SetCH701x(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) */ + + 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 */ + return; + } +} - temp = - SiS_GetLVDSCRT1Ptr (ROMAddr, ModeNo, ModeIdIndex, - RefreshRateTableIndex, &ResInfo, &DisplayType); - if (temp == 0) { - return; - } +/* TW: Read from Chrontel 70xx */ +/* Parameter is [Register no (S7-S0)] */ +USHORT +SiS_GetCH70xx(USHORT tempbx) +{ + if (SiS_IF_DEF_CH70xx == 1) + return(SiS_GetCH700x(tempbx)); + else + return(SiS_GetCH701x(tempbx)); +} - 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_CHTVCRT1UNTSC; - break; - case 13: - LVDSCRT1Ptr = SiS_CHTVCRT1ONTSC; - break; - case 14: - LVDSCRT1Ptr = SiS_CHTVCRT1UPAL; - break; - case 15: - LVDSCRT1Ptr = SiS_CHTVCRT1OPAL; - break; - } +/* TW: Read from Chrontel 700x */ +/* Parameter is [Register no (S7-S0)] */ +USHORT +SiS_GetCH700x(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 */ + } + + 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; + 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) */ + + 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; + return(tempah); + } + } + return(0xFFFF); +} - 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); - } +/* TW: Read from Chrontel 701x */ +/* Parameter is [Register no (S7-S0)] */ +USHORT +SiS_GetCH701x(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; + + 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 */ + return(tempah); + } + return 0xFFFF; +} - for (i = 0x0A, j = 11; i <= 0x0C; i++, j++) { - tempah = (LVDSCRT1Ptr + ResInfo)->CR[j]; - SiS_SetReg1 (SiS_P3c4, i, tempah); - } +void +SiS_SetCH70xxANDOR(USHORT tempax,USHORT tempbh) +{ + USHORT tempal,tempah,tempbl; - tempah = (LVDSCRT1Ptr + ResInfo)->CR[14]; - tempah = tempah & 0x0E0; - SiS_SetReg1 (SiS_P3c4, 0x0E, tempah); + tempal = tempax & 0x00FF; + tempah =(tempax >> 8) & 0x00FF; + tempbl = SiS_GetCH70xx(tempal); + tempbl = (((tempbl & tempbh) | tempah) << 8 | tempal); + SiS_SetCH70xx(tempbl); +} - 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; +/* TW: Generic I2C functions for Chrontel --------- */ + +/* I2C functions CHECKED FOR TV BUG */ +void +SiS_SetSwitchDDC2(void) +{ + SiS_SetSCLKHigh(); + SiS_DDC2Delay(SiS_I2CDELAY); + + SiS_SetSCLKLow(); + SiS_DDC2Delay(SiS_I2CDELAY); } -/*add for LCDA*/ +/* TW: Set I2C start condition */ +/* TW: This is done by a SD high-to-low transition while SC is high */ +USHORT +SiS_SetStart(void) +{ + 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) */ + return 0; +} -BOOLEAN -SiS_GetLCDACRT1Ptr (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex, USHORT * ResInfo, - USHORT * DisplayType) +/* TW: Set I2C stop condition */ +/* TW: This is done by a SD low-to-high transition while SC is high */ +USHORT +SiS_SetStop(void) { - USHORT tempbx = 0, modeflag = 0; - USHORT CRT2CRTC = 0; - /*301b */ - if (((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B)) - && (SiS_VBInfo & SetCRT2ToLCDA)) { - tempbx = SiS_LCDResInfo; - tempbx -= Panel800x600; - if (SiS_LCDInfo & LCDNonExpanding) - tempbx += 6; - if (modeflag & HalfDCLK) - tempbx += +3; - if (ModeNo <= 0x13) { - modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ - CRT2CRTC = SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; - } else { - modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */ - CRT2CRTC = - SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; - } - } - *ResInfo = CRT2CRTC & 0x3F; - *DisplayType = tempbx; - return 1; + 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) */ + return 0; } -/*end for 301b*/ +/* TW: Write 8 bits of data */ +USHORT +SiS_WriteDDC2Data(USHORT tempax) +{ + USHORT i,flag,temp; + + flag=0x80; + for(i=0;i<8;i++) { + SiS_SetSCLKLow(); /* 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 */ + } else { + SiS_SetRegANDOR(SiS_DDC_Port,SiS_DDC_Index,~SiS_DDC_Data,0x00); /* TW: Write bit (0) to SD */ + } + SiS_SetSCLKHigh(); /* TW: SC->high */ + flag >>= 1; + } + temp=SiS_CheckACK(); /* TW: Check acknowledge */ + return(temp); +} -BOOLEAN -SiS_GetLVDSCRT1Ptr (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex, USHORT * ResInfo, - USHORT * DisplayType) +USHORT +SiS_ReadDDC2Data(USHORT tempax) { - USHORT tempbx, modeflag = 0; - USHORT Flag, CRT2CRTC; + 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; + } + return(getdata); +} - if (ModeNo <= 0x13) { - modeflag = SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; /* si+St_ResInfo */ - CRT2CRTC = SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; - } else { - modeflag = SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; /* si+Ext_ResInfo */ - CRT2CRTC = SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; - } - if (!(SiS_VBInfo & SetInSlaveMode)) { - return 0; - } - Flag = 1; - tempbx = 0; - if (SiS_IF_DEF_CH7005 == 1) { - if (!(SiS_VBInfo & SetCRT2ToLCD)) { - Flag = 0; - tempbx = 12; - if (SiS_VBInfo & SetPALTV) - tempbx += 2; - if (SiS_VBInfo & SetCHTVOverScan) - tempbx += 1; - } - } - if (Flag) { - tempbx = SiS_LCDResInfo; - tempbx -= Panel800x600; - if (SiS_LCDInfo & LCDNonExpanding) - tempbx += 6; - if (modeflag & HalfDCLK) - tempbx += +3; - } +USHORT +SiS_SetSCLKLow(void) +{ + 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); + return 0; +} - *ResInfo = CRT2CRTC & 0x3F; - *DisplayType = tempbx; - return 1; +USHORT +SiS_SetSCLKHigh(void) +{ + USHORT temp,watchdog=50000; + + SiS_SetRegANDOR(SiS_DDC_Port,SiS_DDC_Index,~SiS_DDC_Clk,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); + return 0; } void -SiS_SetCRT2ECLK (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex, - PSIS_HW_DEVICE_INFO HwDeviceExtension) +SiS_DDC2Delay(USHORT delaytime) { - USHORT tempah, tempal; - USHORT P3cc = SiS_P3c9 + 3; - USHORT vclkindex = 0; - - if (SiS_IF_DEF_TRUMPION == 0) { /*no trumpion */ - tempal = SiS_GetReg2 (P3cc); - tempal = tempal & 0x0C; - vclkindex = - SiS_GetVCLK2Ptr (ROMAddr, ModeNo, ModeIdIndex, - RefreshRateTableIndex, HwDeviceExtension); - } else { /*trumpion */ - SiS_SetFlag = SiS_SetFlag & (~ProgrammingCRT2); -/* tempal=*((UCHAR *)(ROMAddr+SiS_RefIndex+0x03)); &di+Ext_CRTVCLK */ - tempal = tempal & 0x03F; - if (tempal == 0x02) { /*31.5MHz */ -/* SiS_RefIndex=SiS_RefIndex-Ext2StructSize; */ - } -/* SiS_RefIndex=GetVCLKPtr(ROMAddr,ModeNo); */ - SiS_SetFlag = SiS_SetFlag | ProgrammingCRT2; - } - tempal = 0x02B; - if (!(SiS_VBInfo & SetInSlaveMode)) { - tempal = tempal + 3; - } - SiS_SetReg1 (SiS_P3c4, 0x05, 0x86); - tempah = SiS_VCLKData[vclkindex].SR2B; - SiS_SetReg1 (SiS_P3c4, tempal, tempah); - tempal++; - tempah = SiS_VCLKData[vclkindex].SR2C; - SiS_SetReg1 (SiS_P3c4, tempal, tempah); - tempal++; - SiS_SetReg1 (SiS_P3c4, tempal, 0x80); - return; + USHORT i; + + for(i=0; i<delaytime; i++) { + SiS_GetReg1(SiS_P3c4,0x05); + } } -void -SiS_SetDefCRT2ExtRegs (USHORT BaseAddr) +/* TW: Check I2C acknowledge */ +/* Returns 0 if ack ok, non-0 if ack not ok */ +USHORT +SiS_CheckACK(void) { - 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); - temp = temp & 0xC3; - SiS_SetReg1 (SiS_P3d4, 0x35, temp); - } else { - SiS_SetReg1 (SiS_P3d4, 0x32, 0x02); - SiS_SetReg1 (SiS_Part1Port, 0x02, 0x00); - } + 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 */ + else return(0); } -#ifdef CONFIG_FB_SIS_315 -/* - for SIS310 O.E.M. -*/ +/* TW: End of I2C functions ----------------------- */ + + +/* =============== SiS 310 O.E.M. ================= */ + +#ifdef SIS315H + /* --------------------------------------------------------- - LCDResInfo 1 : 800x600 + LCDResInfo 1 : 800x600 TW: Table wrong for LVDS! 2 : 1024x768 3 : 1280x1024 - 4 : 1280x960 - 5 : 640x480 + 4 : 1280x960 TW: 1400x1050 + 5 : 640x480 TW: 1600x1200 6 : 1600x1200 7 : 1920x1440 VESA @@ -5421,19 +7713,32 @@ SiS_SetDefCRT2ExtRegs (USHORT BaseAddr) USHORT GetLCDPtrIndex (void) { - USHORT index; - - index = (SiS_LCDResInfo & 0x0F) - 1; - index *= 3; - if (SiS_LCDInfo & LCDNonExpanding) - index += 2; - else { - if (!(SiS_LCDInfo & LCDVESATiming)) - index++; - } + USHORT index; + + if(SiS_IF_DEF_LVDS == 1) { /* TW: Inserted entire if statement */ + + 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++; + + } else { + + index = (SiS_LCDResInfo & 0x0F) - 1; + index *= 3; + if (SiS_LCDInfo & LCDNonExpanding) + index += 2; + else if (!(SiS_SetFlag & LCDVESATiming)) + index++; + + } + + return index; + } - return index; -} /* --------------------------------------------------------- @@ -5447,555 +7752,551 @@ GetLCDPtrIndex (void) --------------------------------------------------------- */ USHORT -GetTVPtrIndex (void) +GetTVPtrIndex(void) { - USHORT index; + USHORT index; + + index = 0; + if (SiS_VBInfo & SetPALTV) + index++; + if (SiS_VBInfo & SetCRT2ToHiVisionTV) /* Hivision TV use PAL */ + index++; - index = 0; - if (SiS_VBInfo & SetPALTV) - index++; - if (SiS_VBInfo & SetCRT2ToHiVisionTV) /* Hivision TV use PAL */ - index++; - index *= 2; + index <<= 1; - if ((SiS_VBInfo & SetInSlaveMode) && (SiS_SetFlag & TVSimuMode)) - index++; + if((SiS_VBInfo & SetInSlaveMode) && (SiS_SetFlag & TVSimuMode)) + index++; - return 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, - ULONG ROMAddr, USHORT ModeNo) +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) || (SiS_VBType & VB_SIS302B)) - delay = SiS310_CRT2DelayCompensation2; - } else if (SiS_VBInfo & SetCRT2ToLCD) { - index = GetLCDPtrIndex (); - delay = SiS310_LCDDelayCompensation1[index]; - if ((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B)) - delay = SiS310_LCDDelayCompensation2[index]; - } else { - index = GetTVPtrIndex (); - delay = SiS310_TVDelayCompensation1[index]; - if ((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B)) - delay = SiS310_TVDelayCompensation2[index]; - } - - Part1Port = BaseAddr + SIS_CRT2_PORT_04; - SiS_SetRegANDOR (Part1Port, 0x2D, ~0x0F, delay); /* index 2D D[3:0] */ - + 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); + } + } else { + SiS_SetRegANDOR(Part1Port,0x2D,0xF0,delay); /* index 2D D[3:0] */ + } } -/* -*/ +/* TW: Checked against 650/301LV BIOS (including data) */ void -SetAntiFlicker (PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr, - ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex) +SetAntiFlicker(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr, + UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex) { - USHORT Part2Port; - USHORT index, temp; - - Part2Port = BaseAddr + SIS_CRT2_PORT_10; - temp = GetTVPtrIndex (); - temp = (temp >> 1); /* 0: NTSC, 1 :PAL, 2:HiTV */ - if (ModeNo <= 0x13) { - index = SiS_SModeIDTable[ModeIdIndex].VB_StTVFlickerIndex; - } else { - index = SiS_EModeIDTable[ModeIdIndex].VB_ExtTVFlickerIndex; - } - temp = SiS310_TVAntiFlick1[temp][index]; - temp <<= 4; + USHORT Part2Port; + USHORT index,temp; + + Part2Port=BaseAddr+SIS_CRT2_PORT_10; + + temp = GetTVPtrIndex(); + temp >>= 1; /* 0: NTSC, 1 :PAL, 2:HiTV */ - SiS_SetRegANDOR (Part2Port, 0x0A, ~0x70, temp); /* index 0A D[6:4] */ + if (ModeNo<=0x13) + index = SiS_SModeIDTable[ModeIdIndex].VB_StTVFlickerIndex; + else + index = SiS_EModeIDTable[ModeIdIndex].VB_ExtTVFlickerIndex; + temp = SiS310_TVAntiFlick1[temp][index]; + temp <<= 4; + + SiS_SetRegANDOR(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, - ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex) +SetEdgeEnhance(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr, + UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex) { - USHORT Part2Port; - USHORT index, temp; - - Part2Port = BaseAddr + SIS_CRT2_PORT_10; - temp = GetTVPtrIndex (); - temp = (temp >> 1); /* 0: NTSC, 1 :PAL, 2:HiTV */ - if (ModeNo <= 0x13) { - index = SiS_SModeIDTable[ModeIdIndex].VB_StTVEdgeIndex; /* si+VB_StTVEdgeIndex */ - } else { - index = SiS_EModeIDTable[ModeIdIndex].VB_ExtTVEdgeIndex; /* si+VB_ExtTVEdgeIndex */ - } - temp = SiS310_TVEdge1[temp][index]; - temp <<= 5; + USHORT Part2Port; + USHORT index,temp; + + Part2Port = BaseAddr + SIS_CRT2_PORT_10; + + temp = GetTVPtrIndex(); + temp >>= 1; /* 0: NTSC, 1 :PAL, 2:HiTV */ - SiS_SetRegANDOR (Part2Port, 0x3A, ~0xE0, temp); /* index 0A D[7:5] */ + if (ModeNo<=0x13) + index = SiS_SModeIDTable[ModeIdIndex].VB_StTVEdgeIndex; + else + index = SiS_EModeIDTable[ModeIdIndex].VB_ExtTVEdgeIndex; + temp = SiS310_TVEdge1[temp][index]; + temp <<= 5; + SiS_SetRegANDOR(Part2Port,0x3A,0x1F,temp); /* index 0A D[7:5] */ } +/* TW: Checked against 650/301LV BIOS */ void -SetYFilter (PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr, - ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex) +SetYFilter(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr, + UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex) { - USHORT Part2Port, temp1, temp2; - USHORT index, temp, i, index1; - UCHAR OutputSelect = *pSiS_OutputSelect; - Part2Port = BaseAddr + SIS_CRT2_PORT_10; - temp = GetTVPtrIndex (); - temp >>= 1; /* 0: NTSC, 1 :PAL, 2:HiTV */ - - if (ModeNo <= 0x13) { - index = SiS_SModeIDTable[ModeIdIndex].VB_StTVYFilterIndex; - } else { - index = SiS_EModeIDTable[ModeIdIndex].VB_ExtTVYFilterIndex; - } - - if (SiS_VBInfo & SetCRT2ToHiVisionTV) /* Hivision TV use PAL */ - temp = 0; - - /*301b */ - if ((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B)) { - for (i = 0x35; i <= 0x38; i++) { - SiS_SetReg1 (Part2Port, i, - SiS310_TVYFilter2[temp][index][i - 0x35]); - } - for (i = 0x48; i <= 0x4A; i++) { - SiS_SetReg1 (Part2Port, i, - SiS310_TVYFilter2[temp][index][(i - 0x48) + - 0x04]); - } - } - /*end 301b */ - else { - for (i = 0x35; i <= 0x38; i++) { - SiS_SetReg1 (Part2Port, i, - SiS310_TVYFilter1[temp][index][i - 0x35]); - } - } -/*add PALMN*/ - if (OutputSelect & EnablePALMN) { - index1 = SiS_GetReg1 (SiS_P3d4, 0x31); - temp1 = index1 & 0x01; - index1 = SiS_GetReg1 (SiS_P3d4, 0x38); - temp2 = index1 & 0xC0; - if (temp1) { - if (temp2 == 0x40) { - if ((SiS_VBType & VB_SIS301B) - || (SiS_VBType & VB_SIS302B)) { - for (i = 0x35; i <= 0x38; i++) { - SiS_SetReg1 (Part2Port, i, - SiS310_PALMFilter2 - [index][i - 0x35]); - } - for (i = 0x48; i <= 0x4A; i++) { - SiS_SetReg1 (Part2Port, i, - SiS310_PALMFilter2 - [index][(i - 0x48) - + 0x04]); - } - } else { - for (i = 0x35; i <= 0x38; i++) - SiS_SetReg1 (Part2Port, i, - SiS310_PALMFilter - [index][i - 0x35]); - } - } - if (temp2 == 0x80) { - if ((SiS_VBType & VB_SIS301B) - || (SiS_VBType & VB_SIS302B)) { - for (i = 0x35; i <= 0x38; i++) { - SiS_SetReg1 (Part2Port, i, - SiS310_PALNFilter2 - [index][i - 0x35]); - } - for (i = 0x48; i <= 0x4A; i++) { - SiS_SetReg1 (Part2Port, i, - SiS310_PALNFilter2 - [index][(i - 0x48) - + 0x04]); - } - } else { - for (i = 0x35; i <= 0x38; i++) - SiS_SetReg1 (Part2Port, i, - SiS310_PALNFilter - [index][i - 0x35]); - } - } - } - } - /*end PALMN */ + USHORT Part2Port; + USHORT index,temp,i,j; + UCHAR OutputSelect=*pSiS_OutputSelect; + + Part2Port = BaseAddr + SIS_CRT2_PORT_10; + + temp = GetTVPtrIndex(); + temp >>= 1; /* 0: NTSC, 1 :PAL, 2:HiTV */ + + if (ModeNo<=0x13) { + index = SiS_SModeIDTable[ModeIdIndex].VB_StTVYFilterIndex; + } else { + index = SiS_EModeIDTable[ModeIdIndex].VB_ExtTVYFilterIndex; + } + + if (SiS_VBInfo&SetCRT2ToHiVisionTV) /* Hivision TV uses PAL */ + temp = 0; + + if(SiS_VBType & VB_SIS301BLV302BLV) { + for(i=0x35, j=0; i<=0x38; i++, j++) { + SiS_SetReg1(Part2Port,i,SiS310_TVYFilter2[temp][index][j]); + } + for(i=0x48; i<=0x4A; i++, j++) { + SiS_SetReg1(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]); + } + } + + 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]); + } + for(i=0x48; i<=0x4A; i++, j++) { + SiS_SetReg1(Part2Port,i,SiS310_PALMFilter2[index][j]); + } + } else { + for(i=0x35, j=0; i<=0x38; i++, j++) { + SiS_SetReg1(Part2Port,i,SiS310_PALMFilter[index][j]); + } + } + } + if(temp == EnablePALN) { + if(SiS_VBType & VB_SIS301BLV302BLV) { + for(i=0x35, j=0; i<=0x38; i++, j++) { + SiS_SetReg1(Part2Port,i,SiS310_PALNFilter2[index][j]); + } + for(i=0x48, j=0; i<=0x4A; i++, j++) { + SiS_SetReg1(Part2Port,i,SiS310_PALNFilter2[index][j]); + } + } else { + for(i=0x35, j=0; i<=0x38; i++, j++) + SiS_SetReg1(Part2Port,i,SiS310_PALNFilter[index][j]); + } + } + } + } } +/* TW: Checked against 650/301LV BIOS (including data) */ void -SetPhaseIncr (PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr, - ULONG ROMAddr, USHORT ModeNo) +SetPhaseIncr(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr, + UCHAR *ROMAddr,USHORT ModeNo) { - USHORT Part2Port; - USHORT index, temp, temp1, i; - - Part2Port = BaseAddr + SIS_CRT2_PORT_10; - temp = GetTVPtrIndex (); - /* 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 */ - temp1 = SiS_GetReg1 (SiS_P3d4, 0x38); /*if PALMN Not Set */ - temp1 = temp1 & 0xC0; - if (!temp1) { - for (i = 0x31; i <= 0x34; i++) { - if ((SiS_VBType & VB_SIS301B) - || (SiS_VBType & VB_SIS302B)) - SiS_SetReg1 (Part2Port, i, - SiS310_TVPhaseIncr2[temp] - [index][i - 0x31]); - else - SiS_SetReg1 (Part2Port, i, - SiS310_TVPhaseIncr1[temp][index][i - - - 0x31]); - } + USHORT Part2Port; + USHORT index,temp,temp1,i,j; + + if(!(SiS_VBInfo & SetCRT2ToTV)) return; + + temp1 = SiS_GetReg1(SiS_P3d4,0x38); /* if PALM/N not set */ + temp1 &= (EnablePALMN | EnablePALN); + if(temp1) return; + + Part2Port=BaseAddr + SIS_CRT2_PORT_10; + + temp = GetTVPtrIndex(); + /* 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); } + } + } } + void -SiS_OEM310Setting (PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr, - ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex) +SiS_OEM310Setting(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr, + UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex) { - SetDelayComp (HwDeviceExtension, BaseAddr, ROMAddr, ModeNo); - if (SiS_VBInfo & SetCRT2ToTV) { - SetAntiFlicker (HwDeviceExtension, BaseAddr, ROMAddr, ModeNo, - ModeIdIndex); - SetPhaseIncr (HwDeviceExtension, BaseAddr, ROMAddr, ModeNo); - SetYFilter (HwDeviceExtension, BaseAddr, ROMAddr, ModeNo, - ModeIdIndex); - SetEdgeEnhance (HwDeviceExtension, BaseAddr, ROMAddr, ModeNo, - 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); + } + } } +/* TW: New and checked from 650/301LV BIOS */ +void +SiS_OEMLCD(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_VBInfo & SetCRT2ToLCDA) { + SiS_UnLockCRT2(HwDeviceExtension,BaseAddr); + tempbh = SiS_GetReg1(SiS_Part1Port,0x1a); + tempbh &= 0x38; + tempbh >>= 3; + tempbl = SiS_GetReg1(SiS_Part1Port,0x18); + tempbx = (tempbh << 8) | tempbl; + if(SiS_LCDTypeInfo == 1) tempbx -= 0x12; + SiS_SetReg1(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); + tempah &= 0x0f; + if(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++; + tempah -= 8; + SiS_SetReg1(SiS_Part1Port,0x14,tempah); + } else if(SiS_VBInfo & SetCRT2ToLCD) { + tempcl = tempbh = SiS_GetReg1(SiS_Part2Port,0x01); + tempbh &= 0x70; + tempbh >>= 4; + tempbl = SiS_GetReg1(SiS_Part2Port,0x04); + tempbx = (tempbh << 8) | tempbl; + if(SiS_LCDTypeInfo == 1) { + tempbx -= 0x1e; + tempcl &= 0x0f; + tempcl -= 4; + tempcl &= 0x0f; + } + tempbl = tempbx & 0x00ff; + tempbh = (tempbx >> 8) & 0x00ff; + SiS_SetReg1(SiS_Part2Port,0x04,tempbl); + tempbh <<= 4; + tempbh |= tempcl; + SiS_SetRegANDOR(SiS_Part2Port,0x01,0x80,tempbh); + } +} #endif -#ifdef CONFIG_FB_SIS_300 -/* - for SIS300 O.E.M. -*/ +/* ================= SiS 300 O.E.M. ================== */ + +#ifdef SIS300 + +#if 0 /* Not used */ USHORT -GetRevisionID (PSIS_HW_DEVICE_INFO HwDeviceExtension) +GetRevisionID(PSIS_HW_DEVICE_INFO HwDeviceExtension) { -#ifdef CONFIG_FB_SIS_300 - ULONG temp1, base; - USHORT temp2 = 0; - /* add to set SR14 */ - if ((HwDeviceExtension->jChipType == SIS_540) || - (HwDeviceExtension->jChipType == SIS_630) || - (HwDeviceExtension->jChipType == SIS_730)) { - base = 0x80000008; - OutPortLong (base, 0xcf8); - temp1 = InPortLong (0xcfc); - temp1 = temp1 & 0x000000FF; - temp2 = (USHORT) (temp1); - return temp2; - } + ULONG temp1; +#ifndef LINUX_XF86 + ULONG base; #endif + USHORT temp2 = 0; + + if((HwDeviceExtension->jChipType==SIS_540)|| + (HwDeviceExtension->jChipType==SIS_630)|| + (HwDeviceExtension->jChipType==SIS_730)) { +#ifndef LINUX_XF86 + base = 0x80000008; + OutPortLong(base,0xcf8); + temp1 = InPortLong(0xcfc); +#else + temp1=pciReadLong(0x00000000, 0x08); +#endif + temp1 &= 0x000000FF; + temp2 = (USHORT)(temp1); + return temp2; + } + return 0; } +#endif +/* TW: Checked against 630/301B BIOS (incl data) */ USHORT -GetOEMLCDPtr (PSIS_HW_DEVICE_INFO HwDeviceExtension) +GetOEMLCDPtr(PSIS_HW_DEVICE_INFO HwDeviceExtension, int Flag) { - USHORT temp, tempbx = 0, tempax; - - if (SiS_IF_DEF_LVDS == 0) { - if (SiS_VBInfo & SetCRT2ToLCD) { /* LCD */ - tempax = SiS_LCDResInfo; - tempbx = SiS_LCDResInfo; - tempbx = tempbx - Panel1024x768; - if (!(SiS_SetFlag & LCDVESATiming)) { - tempbx += 4; - temp = GetRevisionID (HwDeviceExtension); - if ((HwDeviceExtension->jChipType == SIS_540) - && (temp < 1)) - tempbx += 4; - if ((HwDeviceExtension->jChipType == SIS_630) - && (temp < 3)) - tempbx += 4; - } - if ((tempax == Panel1024x768) - && (SiS_LCDInfo == LCDNonExpanding)) { - tempbx = tempbx + 3; - } - /*add OEMLCDPanelIDSupport */ - tempbx = SiS_LCDTypeInfo; - tempbx = tempbx << 1; - if (!(SiS_SetFlag & LCDVESATiming)) - tempbx = tempbx + 1; - } - } - tempbx *= 2; - return tempbx; + USHORT tempbx=0; + UCHAR customtable[] = { + 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++; + } else { + tempbx = SiS_LCDTypeInfo; + if(SiS_LCDInfo & LCDNonExpanding) tempbx += 16; + } + return tempbx; } -USHORT -GetOEMTVPtr (void) +/* TW: Checked against 630/301B and 630/LVDS BIOS (incl data) */ +void +SetOEMLCDDelay(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr, + UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex) { - USHORT index; - - index = 0; - if (!(SiS_VBInfo & SetInSlaveMode)) - index = index + 4; - - if (SiS_VBInfo & SetCRT2ToSCART) { - index = index + 2; - } else { - if (SiS_VBInfo & SetCRT2ToHiVisionTV) - index = index + 3; - else { - if (SiS_VBInfo & SetPALTV) - index = index + 1; - } - } - return index; + USHORT Part1Port; + USHORT index,temp; + + /* 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[0x237] & 0x01)) return; + if(!(ROMAddr[0x237] & 0x02)) return; + } +#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. + */ + 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(HwDeviceExtension, 0); + + index = SiS_VBModeIDTable[ModeIdIndex].VB_LCDDelayIndex; + + if (SiS_IF_DEF_LVDS == 0) { + temp = SiS300_OEMLCDDelay2[temp][index]; + } else { + temp = SiS300_OEMLCDDelay3[temp][index]; + } + temp &= 0x3c; + SiS_SetRegANDOR(Part1Port,0x13,~0x3C,temp); /* index 0A D[6:4] */ } -void -SetOEMTVDelay (PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr, - ULONG ROMAddr, USHORT ModeNo) +/* TW: Checked against 630/301B and 630/LVDS BIOS */ +USHORT +GetOEMTVPtr(void) { - USHORT Part1Port; - USHORT index, temp, ModeIdIndex; - Part1Port = BaseAddr + SIS_CRT2_PORT_04; - ModeIdIndex = SiS_SearchVBModeID (ROMAddr, ModeNo); - temp = GetOEMTVPtr (); - index = SiS_VBModeIDTable[ModeIdIndex].VB_TVDelayIndex; - temp = SiS300_OEMTVDelay[temp][index]; - temp = temp & 0x3c; - SiS_SetRegANDOR (Part1Port, 0x13, ~0x3C, temp); /* index 0A D[6:4] */ + 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; + } else { + if(SiS_VBInfo & SetCHTVOverScan) index += 2; + if(SiS_VBInfo & SetPALTV) index += 1; + } + return index; } +/* TW: Checked against 630/301B and 630/LVDS BIOS (incl data) */ void -SetOEMLCDDelay (PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr, - ULONG ROMAddr, USHORT ModeNo) +SetOEMTVDelay(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr, + UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex) { - USHORT Part2Port; - USHORT index, temp, ModeIdIndex; - Part2Port = BaseAddr + SIS_CRT2_PORT_10; - ModeIdIndex = SiS_SearchVBModeID (ROMAddr, ModeNo); - temp = GetOEMLCDPtr (HwDeviceExtension); - index = SiS_VBModeIDTable[ModeIdIndex].VB_LCDDelayIndex; - temp = SiS300_OEMLCDDelay1[temp][index]; - /*add OEMLCDPanelIDSupport */ - temp = SiS300_OEMLCDDelay2[temp][index]; - temp = temp & 0x3c; - SiS_SetRegANDOR (Part2Port, 0x13, ~0x3C, temp); /* index 0A D[6:4] */ + USHORT Part1Port; + USHORT index,temp; + +#if 0 + if(ROMAddr) { + if(!(ROMAddr[0x238] & 0x01)) return; + if(!(ROMAddr[0x238] & 0x02)) return; + } +#endif + + Part1Port = BaseAddr + SIS_CRT2_PORT_04; + + temp = GetOEMTVPtr(); + + index = SiS_VBModeIDTable[ModeIdIndex].VB_TVDelayIndex; + + if(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] */ } -/* -*/ +/* TW: Checked against 630/301B BIOS (incl data) */ void -SetOEMAntiFlicker (PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr, - ULONG ROMAddr, USHORT ModeNo) +SetOEMAntiFlicker(PSIS_HW_DEVICE_INFO HwDeviceExtension, + USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo, + USHORT ModeIdIndex) { - USHORT Part2Port; - USHORT index, temp; - USHORT ModeIdIndex; - Part2Port = BaseAddr + SIS_CRT2_PORT_10; - ModeIdIndex = SiS_SearchVBModeID (ROMAddr, ModeNo); - temp = GetOEMTVPtr (); - index = SiS_VBModeIDTable[ModeIdIndex].VB_TVFlickerIndex; - temp = SiS300_OEMTVFlicker[temp][index]; - temp = temp & 0x70; - SiS_SetRegANDOR (Part2Port, 0x0A, ~0x70, temp); /* index 0A D[6:4] */ + USHORT Part2Port; + USHORT index,temp; + + Part2Port = BaseAddr + SIS_CRT2_PORT_10; + + temp = GetOEMTVPtr(); + + index = SiS_VBModeIDTable[ModeIdIndex].VB_TVFlickerIndex; + temp = SiS300_OEMTVFlicker[temp][index]; + temp &= 0x70; + SiS_SetRegANDOR(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, - ULONG ROMAddr, USHORT ModeNo) +SetOEMPhaseIncr(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr, + UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex) { - USHORT Part2Port; - USHORT index, i, ModeIdIndex; - - Part2Port = BaseAddr + SIS_CRT2_PORT_10; - // temp = GetTVPtrIndex(); - /* 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 */ - ModeIdIndex = SiS_SearchVBModeID (ROMAddr, ModeNo); - index = SiS_VBModeIDTable[ModeIdIndex].VB_TVPhaseIndex; - if (SiS_VBInfo & SetInSlaveMode) { - if (SiS_VBInfo & SetPALTV) { - for (i = 0x31; i <= 0x34; i++) - SiS_SetReg1 (Part2Port, i, - SiS300_StPALPhase[index][i - - 0x31]); - } else { - for (i = 0x31; i <= 0x34; i++) - SiS_SetReg1 (Part2Port, i, - SiS300_StNTSCPhase[index][i - - 0x31]); - } - if (SiS_VBInfo & SetCRT2ToSCART) { - for (i = 0x31; i <= 0x34; i++) - SiS_SetReg1 (Part2Port, i, - SiS300_StSCARTPhase[index][i - - 0x31]); - } - } else { - if (SiS_VBInfo & SetPALTV) { - for (i = 0x31; i <= 0x34; i++) - SiS_SetReg1 (Part2Port, i, - SiS300_ExtPALPhase[index][i - - 0x31]); - } else { - for (i = 0x31; i <= 0x34; i++) - SiS_SetReg1 (Part2Port, i, - SiS300_ExtNTSCPhase[index][i - - 0x31]); - } - if (SiS_VBInfo & SetCRT2ToSCART) { - for (i = 0x31; i <= 0x34; i++) - SiS_SetReg1 (Part2Port, i, - SiS300_ExtSCARTPhase[index][i - - 0x31]); - } - } + USHORT Part2Port; + USHORT index,i,j,temp; + + if(SiS_VBInfo & SetCRT2ToHiVisionTV) return; + + Part2Port = BaseAddr + SIS_CRT2_PORT_10; + + temp = GetOEMTVPtr(); + + index = SiS_VBModeIDTable[ModeIdIndex].VB_TVPhaseIndex; + + if(SiS_VBType & VB_SIS301BLV302BLV) { + for(i=0x31, j=0; i<=0x34; i++, j++) { + SiS_SetReg1(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]); + } + } } +/* TW: Checked against 630/301B BIOS (incl data) */ void -SetOEMYFilter (PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr, - ULONG ROMAddr, USHORT ModeNo) +SetOEMYFilter(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr, + UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex) { - USHORT Part2Port; - USHORT index, temp1, temp2, i, ModeIdIndex, index1; - Part2Port = BaseAddr + SIS_CRT2_PORT_10; - /*301b */ - ModeIdIndex = SiS_SearchVBModeID (ROMAddr, ModeNo); - index = SiS_VBModeIDTable[ModeIdIndex].VB_TVYFilterIndex; - if (SiS_VBInfo & SetInSlaveMode) { - if (SiS_VBInfo & SetPALTV) { - for (i = 0x35; i <= 0x38; i++) - SiS_SetReg1 (Part2Port, i, - SiS300_StPALFilter[index][i - - 0x35]); - } else { - for (i = 0x35; i <= 0x38; i++) - SiS_SetReg1 (Part2Port, i, - SiS300_StNTSCFilter[index][i - - 0x35]); - } - } else { - if (SiS_VBInfo & SetPALTV) { - for (i = 0x35; i <= 0x38; i++) - SiS_SetReg1 (Part2Port, i, - SiS300_ExtPALFilter[index][i - - 0x35]); - } else { - for (i = 0x35; i <= 0x38; i++) - SiS_SetReg1 (Part2Port, i, - SiS300_ExtNTSCFilter[index][i - - 0x35]); - } - } - - if ((SiS_VBType & VB_SIS301B) || (SiS_VBType & VB_SIS302B)) { - if (SiS_VBInfo & SetPALTV) { - for (i = 0x35; i <= 0x38; i++) { - SiS_SetReg1 (Part2Port, i, - SiS300_PALFilter2[index][i - - 0x35]); - } - for (i = 0x48; i <= 0x4A; i++) { - SiS_SetReg1 (Part2Port, i, - SiS300_PALFilter2[index][(i - 0x48) - + 0x04]); - } - } else { - for (i = 0x35; i <= 0x38; i++) { - SiS_SetReg1 (Part2Port, i, - SiS300_NTSCFilter2[index][i - - 0x35]); - } - for (i = 0x48; i <= 0x4A; i++) { - SiS_SetReg1 (Part2Port, i, - SiS300_NTSCFilter2[index][ - (i - - 0x48) + - 0x04]); - } - } - } - -/*add PALMN*/ - if ((HwDeviceExtension->jChipType == SIS_630) || - (HwDeviceExtension->jChipType == SIS_730)) { - index1 = SiS_GetReg1 (SiS_P3d4, 0x31); - temp1 = index1 & 0x01; - index1 = SiS_GetReg1 (SiS_P3d4, 0x35); - temp2 = index1 & 0xC0; - if (temp1) { - if (temp2 == 0x40) { - if ((SiS_VBType & VB_SIS301B) - || (SiS_VBType & VB_SIS302B)) { - for (i = 0x35; i <= 0x38; i++) { - SiS_SetReg1 (Part2Port, i, - SiS300_PALMFilter2 - [index][i - 0x35]); - } - for (i = 0x48; i <= 0x4A; i++) { - SiS_SetReg1 (Part2Port, i, - SiS300_PALMFilter2 - [index][(i - 0x48) - + 0x04]); - } - } else { - for (i = 0x35; i <= 0x38; i++) - SiS_SetReg1 (Part2Port, i, - SiS300_PALMFilter - [index][i - 0x35]); - } - } - if (temp2 == 0x80) { - if ((SiS_VBType & VB_SIS301B) - || (SiS_VBType & VB_SIS302B)) { - for (i = 0x35; i <= 0x38; i++) { - SiS_SetReg1 (Part2Port, i, - SiS300_PALNFilter2 - [index][i - 0x35]); - } - for (i = 0x48; i <= 0x4A; i++) { - SiS_SetReg1 (Part2Port, i, - SiS300_PALNFilter2 - [index][(i - 0x48) - + 0x04]); - } - } else { - for (i = 0x35; i <= 0x38; i++) - SiS_SetReg1 (Part2Port, i, - SiS300_PALNFilter - [index][i - 0x35]); - } - } - } - } - /*end PALMN */ + USHORT Part2Port; + USHORT index,temp,temp1,i,j; + + if(SiS_VBInfo & (SetCRT2ToSCART | SetCRT2ToHiVisionTV)) return; + + Part2Port = BaseAddr + SIS_CRT2_PORT_10; + + temp = GetOEMTVPtr(); + + index = 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(SiS_VBType & VB_SIS301BLV302BLV) { + for(i=0x35, j=0; i<=0x38; i++, j++) { + SiS_SetReg1(Part2Port,i,SiS300_Filter2[temp][index][j]); + } + for(i=0x48; i<=0x4A; i++, j++) { + SiS_SetReg1(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]); + } + } } void -SiS_OEM300Setting (PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr, - ULONG ROMAddr, USHORT ModeNo) +SiS_OEM300Setting(PSIS_HW_DEVICE_INFO HwDeviceExtension, + USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo) { - if (SiS_VBInfo & SetCRT2ToLCD) { - SetOEMLCDDelay (HwDeviceExtension, BaseAddr, ROMAddr, ModeNo); - } - if (SiS_VBInfo & SetCRT2ToTV) { - SetOEMTVDelay (HwDeviceExtension, BaseAddr, ROMAddr, ModeNo); - SetOEMAntiFlicker (HwDeviceExtension, BaseAddr, ROMAddr, - ModeNo); - /* SetOEMPhaseIncr(HwDeviceExtension,BaseAddr,ROMAddr,ModeNo); */ - SetOEMYFilter (HwDeviceExtension, BaseAddr, ROMAddr, ModeNo); - } + USHORT ModeIdIndex; + + ModeIdIndex = SiS_SearchVBModeID(ROMAddr,&ModeNo); + if(!(ModeIdIndex)) return; + + if (SiS_VBInfo & SetCRT2ToLCD) { + SetOEMLCDDelay(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); + } + } } #endif + + diff --git a/drivers/video/sis/init301.h b/drivers/video/sis/init301.h index 557a7cd7605d..6d24c931b7e5 100644 --- a/drivers/video/sis/init301.h +++ b/drivers/video/sis/init301.h @@ -7,217 +7,308 @@ #include "vgatypes.h" #include "vstruct.h" +#ifdef TC +#include <stdio.h> +#include <string.h> +#include <conio.h> +#include <dos.h> +#include <stdlib.h> +#endif + +#ifdef LINUX_XF86 +#include "xf86.h" +#include "xf86Pci.h" +#include "xf86PciInfo.h" +#include "sis.h" +#include "sis_regs.h" +#endif + +#ifdef LINUX_KERNEL #include <asm/io.h> #include <linux/types.h> #include <linux/sisfb.h> +#endif + +#ifdef WIN2000 +#include <stdio.h> +#include <string.h> +#include <miniport.h> +#include "dderror.h" +#include "devioctl.h" +#include "miniport.h" +#include "ntddvdeo.h" +#include "video.h" +#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 *); + +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); + +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, + 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, + PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_SetCRT2Offset(USHORT Part1Port,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 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 RefreshRateTableIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_SetGroup3(USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, + PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_SetGroup4(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, + 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); +#ifdef SIS315H +void SiS_OEM310Setting(PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr, + UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex); +void SiS_OEMLCD(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, + UCHAR *ROMAddr,USHORT ModeNo); +#endif +USHORT GetRevisionID(PSIS_HW_DEVICE_INFO HwDeviceExtension); +BOOLEAN SiS_LowModeStuff(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, + 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, + PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_SetGroup1(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, + 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, + PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT RefreshRateTableIndex); +#ifdef SIS300 +void SiS_SetCRT2FIFO_300(UCHAR *ROMAddr,USHORT ModeNo, + PSIS_HW_DEVICE_INFO HwDeviceExtension); +#endif +#ifdef SIS315H +void SiS_SetCRT2FIFO_310(UCHAR *ROMAddr,USHORT ModeNo, + PSIS_HW_DEVICE_INFO HwDeviceExtension); +void SiS_CRT2AutoThreshold(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); + +/* 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); +#if 0 +BOOLEAN SiS_IsSomethingCR5F(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); -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; -USHORT SiS_DDC_Index; -USHORT SiS_DDC_DataShift; -USHORT SiS_DDC_DeviceAddr; -USHORT SiS_DDC_Flag; -USHORT SiS_DDC_ReadAddr; -USHORT SiS_DDC_Buffer; - -extern USHORT SiS_CRT1Mode; -extern USHORT SiS_P3c4, SiS_P3d4; -/*extern USHORT SiS_P3c0,SiS_P3ce,SiS_P3c2;*/ -extern USHORT SiS_P3ca; -/*extern USHORT SiS_P3c6,SiS_P3c7,SiS_P3c8;*/ -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_CH7005; -extern USHORT SiS_IF_DEF_HiVision; -extern USHORT SiS_IF_DEF_DSTN; /*add for dstn */ -extern USHORT SiS_VBInfo; -extern USHORT SiS_VBType; /*301b */ -extern USHORT SiS_LCDResInfo; -extern USHORT SiS_LCDTypeInfo; -extern USHORT SiS_LCDInfo; -extern BOOLEAN SiS_SearchVBModeID (ULONG, USHORT); -extern BOOLEAN SiS_Is301B (USHORT BaseAddr); /*301b */ -extern BOOLEAN SiS_IsDisableCRT2 (USHORT BaseAddr); -extern BOOLEAN SiS_IsVAMode (USHORT BaseAddr); -extern BOOLEAN SiS_IsDualEdge (USHORT BaseAddr); -/*end 301b*/ - -void SiS_SetDefCRT2ExtRegs (USHORT BaseAddr); -USHORT SiS_GetRatePtrCRT2 (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex); -BOOLEAN SiS_AjustCRT2Rate (ULONG ROMAddr, USHORT ModeNo, USHORT MODEIdIndex, - USHORT RefreshRateTableIndex, USHORT * i); -void SiS_SaveCRT2Info (USHORT ModeNo); -void SiS_GetCRT2Data (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex); -void SiS_GetCRT2DataLVDS (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex); -void SiS_GetCRT2PtrA (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex, USHORT * CRT2Index, USHORT * ResIndex); /*301b */ -void SiS_GetCRT2Data301 (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex); -USHORT SiS_GetResInfo (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex); -void SiS_GetCRT2ResInfo (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex); -void SiS_GetRAMDAC2DATA (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex); -void SiS_GetCRT2Ptr (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex, USHORT * CRT2Index, - USHORT * ResIndex); -void SiS_SetCRT2ModeRegs (USHORT BaseAddr, USHORT ModeNo, PSIS_HW_DEVICE_INFO); - -void SiS_GetLVDSDesData (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex); -void SiS_SetCRT2Offset (USHORT Part1Port, ULONG ROMAddr, USHORT ModeNo, - USHORT ModeIdIndex, USHORT RefreshRateTableIndex, - PSIS_HW_DEVICE_INFO HwDeviceExtension); -USHORT SiS_GetOffset (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex, - PSIS_HW_DEVICE_INFO HwDeviceExtension); -USHORT SiS_GetColorDepth (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex); -USHORT SiS_GetVCLK (ULONG ROMAddr, USHORT ModeNo); -USHORT SiS_GetVCLKPtr (ULONG ROMAddr, USHORT ModeNo); -USHORT SiS_GetColorTh (ULONG ROMAddr); -USHORT SiS_GetMCLK (ULONG ROMAddr); -USHORT SiS_GetMCLKPtr (ULONG ROMAddr); -USHORT SiS_GetDRAMType (ULONG ROMAddr); -USHORT SiS_CalcDelayVB (void); -extern USHORT SiS_GetVCLK2Ptr (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex, - PSIS_HW_DEVICE_INFO HwDeviceExtension); -void SiS_SetCRT2Sync (USHORT BaseAddr, ULONG ROMAddr, USHORT ModeNo, - USHORT RefreshRateTableIndex); -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, ULONG ROMAddr, USHORT ModeNo, - USHORT ModeIdIndex, USHORT RefreshRateTableIndex, - PSIS_HW_DEVICE_INFO HwDeviceExtension); -void SiS_SetGroup3 (USHORT BaseAddr, ULONG ROMAddr, USHORT ModeNo, - USHORT ModeIdIndex, PSIS_HW_DEVICE_INFO HwDeviceExtension); -void SiS_SetGroup4 (USHORT BaseAddr, ULONG ROMAddr, USHORT ModeNo, - USHORT ModeIdIndex, USHORT RefreshRateTableIndex, - PSIS_HW_DEVICE_INFO HwDeviceExtension); -void SiS_SetGroup5 (USHORT BaseAddr, ULONG ROMAddr, USHORT ModeNo, - USHORT ModeIdIndex); -void SiS_SetCRT2VCLK (USHORT BaseAddr, ULONG ROMAddr, USHORT ModeNo, - USHORT ModeIdIndex, USHORT RefreshRateTableIndex, - PSIS_HW_DEVICE_INFO HwDeviceExtension); -void SiS_EnableCRT2 (void); -void SiS_LoadDAC2 (ULONG 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, ULONG ROMAddr, USHORT ModeNo, - USHORT ModeIdIndex, - PSIS_HW_DEVICE_INFO HwDeviceExtension); -BOOLEAN SiS_GetLCDResInfo (ULONG ROMAddr, USHORT P3d4, USHORT ModeNo, - USHORT ModeIdIndex); -BOOLEAN SiS_BridgeIsOn (USHORT BaseAddr); -BOOLEAN SiS_BridgeIsEnable (USHORT BaseAddr, PSIS_HW_DEVICE_INFO); -BOOLEAN SiS_BridgeInSlave (void); -/*void SiS_PresetScratchregister(USHORT P3d4);*/ -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 (ULONG ROMAddr); -BOOLEAN SiS_WaitVBRetrace (USHORT BaseAddr); -void SiS_SetCRT2ECLK (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex, - PSIS_HW_DEVICE_INFO HwDeviceExtension); -void SiS_GetLVDSDesPtr (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex, USHORT * PanelIndex, - USHORT * ResIndex); -void SiS_GetLVDSDesPtrA (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex, USHORT * PanelIndex, - USHORT * ResIndex); /*301b */ -void SiS_SetTPData (VOID); -void SiS_ModCRT1CRTC (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex); -extern BOOLEAN SiS_GetLVDSCRT1Ptr (ULONG ROMAddr, USHORT ModeNo, - USHORT ModeIdIndex, - USHORT RefreshRateTableIndex, - USHORT * ResInfo, USHORT * DisplayType); -void SiS_SetCHTVReg (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex); -void SiS_SetCHTVRegANDOR (USHORT tempax, USHORT tempbh); -void SiS_GetCHTVRegPtr (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex); -void SiS_SetCH7005 (USHORT tempax); -USHORT SiS_GetCH7005 (USHORT tempax); -void SiS_SetSwitchDDC2 (void); -void SiS_SetStart (void); -void SiS_SetStop (void); -void SiS_DDC2Delay (void); -void SiS_SetSCLKLow (void); -void SiS_SetSCLKHigh (void); -USHORT SiS_ReadDDC2Data (USHORT tempax); -USHORT SiS_WriteDDC2Data (USHORT tempax); -USHORT SiS_CheckACK (void); -void SiS_OEM310Setting (PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr, - ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex); -void SiS_OEM300Setting (PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT BaseAddr, - ULONG ROMAddr, USHORT ModeNo); -USHORT GetRevisionID (PSIS_HW_DEVICE_INFO HwDeviceExtension); -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 (ULONG 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_CRT2AutoThreshold (USHORT BaseAddr); -extern void SiS_DisplayOn (void); -extern UCHAR SiS_GetModePtr (ULONG ROMAddr, USHORT ModeNo, USHORT ModeIdIndex); -extern UCHAR SiS_Get310DRAMType (ULONG ROMAddr); - -BOOLEAN SiS_SetCRT2Group301 (USHORT BaseAddr, ULONG ROMAddr, USHORT ModeNo, - PSIS_HW_DEVICE_INFO HwDeviceExtension); -void SiS_SetGroup1 (USHORT BaseAddr, ULONG ROMAddr, USHORT ModeNo, - USHORT ModeIdIndex, PSIS_HW_DEVICE_INFO HwDeviceExtension, - USHORT RefreshRateTableIndex); -void SiS_SetGroup1_LVDS (USHORT BaseAddr, ULONG ROMAddr, USHORT ModeNo, - USHORT ModeIdIndex, - PSIS_HW_DEVICE_INFO HwDeviceExtension, - USHORT RefreshRateTableIndex); -void SiS_SetGroup1_LCDA (USHORT BaseAddr, ULONG ROMAddr, USHORT ModeNo, - USHORT ModeIdIndex, - PSIS_HW_DEVICE_INFO HwDeviceExtension, USHORT RefreshRateTableIndex); /*301b */ -void SiS_SetGroup1_301 (USHORT BaseAddr, ULONG ROMAddr, USHORT ModeNo, - USHORT ModeIdIndex, - PSIS_HW_DEVICE_INFO HwDeviceExtension, - USHORT RefreshRateTableIndex); -void SiS_SetCRT2FIFO (USHORT Part1Port, ULONG ROMAddr, USHORT ModeNo, - PSIS_HW_DEVICE_INFO HwDeviceExtension); -void SiS_SetCRT2FIFO2 (USHORT Part1Port, ULONG ROMAddr, USHORT ModeNo, - PSIS_HW_DEVICE_INFO HwDeviceExtension); -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 (USHORT DelayTime); -void SiS_LCD_Wait_Time (UCHAR DelayTime); +/* TW end */ #endif diff --git a/drivers/video/sis/initdef.h b/drivers/video/sis/initdef.h index 4d6247fd479a..a4b344e6ab4d 100644 --- a/drivers/video/sis/initdef.h +++ b/drivers/video/sis/initdef.h @@ -1,4 +1,6 @@ /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h,v 1.4 2000/12/02 01:16:17 dawes Exp $ */ + + #ifndef _INITDEF_ #define _INITDEF_ @@ -6,18 +8,21 @@ #define SiS540 0x5300 #define SiS630 0x6300 #define SiS730 0x6300 -#define VB_SIS301 0x0001 /*301b */ -#define VB_SIS301B 0x0002 -#define VB_SIS302B 0x0004 -#define VB_NoLCD 0x8000 -/*end 301b*/ +/* SiS_VBType */ +#define VB_SIS301 0x0001 +#define VB_SIS301B 0x0002 +#define VB_SIS302B 0x0004 +#define VB_SIS301LV 0x0008 +#define VB_SIS302LV 0x0010 +#define VB_NoLCD 0x8000 +#define VB_SIS301BLV302BLV (VB_SIS301B|VB_SIS302B|VB_SIS301LV|VB_SIS302LV) + #define CRT1Len 17 #define LVDSCRT1Len 15 #define CHTVRegDataLen 5 -#define ModeInfoFlag 0x07 -#define IsTextMode 0x07 +/* SiS_ModeType */ #define ModeText 0x00 #define ModeCGA 0x01 #define ModeEGA 0x02 @@ -27,10 +32,14 @@ #define Mode24Bpp 0x06 #define Mode32Bpp 0x07 +#define ModeInfoFlag 0x07 +#define IsTextMode 0x07 + #define DACInfoFlag 0x18 #define MemoryInfoFlag 0x1E0 #define MemorySizeShift 0x05 +/* modeflag */ #define Charx8Dot 0x0200 #define LineCompareOff 0x0400 #define CRT2Mode 0x0800 @@ -38,16 +47,17 @@ #define NoSupportSimuTV 0x2000 #define DoubleScanMode 0x8000 +/* Infoflag */ #define SupportAllCRT2 0x0078 #define SupportTV 0x0008 #define SupportHiVisionTV 0x0010 #define SupportLCD 0x0020 -#define SupportRAMDAC2 0x0040 +#define SupportRAMDAC2 0x0040 #define NoSupportTV 0x0070 #define NoSupportHiVisionTV 0x0060 #define NoSupportLCD 0x0058 #define SupportCHTV 0x0800 -#define SupportTV1024 0x0800 /*301b */ +#define SupportTV1024 0x0800 /*301b*/ #define InterlaceMode 0x0080 #define SyncPP 0x0000 #define SyncPN 0x4000 @@ -59,7 +69,8 @@ #define ECLKindex3 0x0300 #define ECLKindex4 0x0400 -#define SetSimuScanMode 0x0001 +/* VBInfo */ +#define SetSimuScanMode 0x0001 /* CR 30 */ #define SwitchToCRT2 0x0002 #define SetCRT2ToTV 0x009C #define SetCRT2ToAVIDEO 0x0004 @@ -68,30 +79,93 @@ #define SetCRT2ToLCD 0x0020 #define SetCRT2ToRAMDAC 0x0040 #define SetCRT2ToHiVisionTV 0x0080 -#define SetNTSCTV 0x0000 +#define SetNTSCTV 0x0000 /* CR 31 */ #define SetPALTV 0x0100 #define SetInSlaveMode 0x0200 #define SetNotSimuMode 0x0400 #define SetNotSimuTVMode 0x0400 #define SetDispDevSwitch 0x0800 #define LoadDACFlag 0x1000 +#define SetCHTVOverScan 0x1000 /* TW: Re-defined (from 0x8000) */ #define DisableCRT2Display 0x2000 +#define CRT2DisplayFlag 0x2000 #define DriverMode 0x4000 -#define HotKeySwitch 0x8000 -#define SetCHTVOverScan 0x8000 -#define SetCRT2ToLCDA 0x8000 /*301b */ +#define HotKeySwitch 0x8000 /* TW: ? */ +#define SetCRT2ToLCDA 0x8000 #define PanelRGB18Bit 0x0100 #define PanelRGB24Bit 0x0000 -#define TVOverScan 0x10 +#define TVOverScan 0x10 /* Bit in CR35 (300 series only) */ #define TVOverScanShift 4 #define ClearBufferFlag 0x20 -#define EnableDualEdge 0x01 /*301b */ -#define SetToLCDA 0x02 + +/* CR32 (Newer 630, and 310/325 series) + + [0] VB connected with CVBS + [1] VB connected with SVHS + [2] VB connected with SCART + [3] VB connected with LCD + [4] VB connected with CRT2 (secondary VGA) + [5] CRT1 monitor is connected + [6] VB connected with Hi-Vision TV + [7] VB connected with DVI combo connector + + + CR37 + + [0] Set 24/18 bit (0/1) RGB to LVDS/TMDS transmitter (set by BIOS) + [3:1] External chip + 300 series: + 001 SiS301 (never seen) + 010 LVDS + 011 LVDS + Tumpion Zurac + 100 LVDS + Chrontel 7005 + 110 Chrontel 7005 + 310/325 series + 001 SiS30x (never seen) + 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 + [5] LCD polarity select + 0: VESA DMT Standard + 1: EDID 2.x defined + [6] LCD honrizontal polarity select + 0: High active + 1: Low active + [7] LCD vertical polarity select + 0: High active + 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 + +/* CR79 (310/325 series only) + [3-0] Notify driver + 0001 Mode Switch event (set by BIOS) + 0010 Epansion On/Off event + 0011 TV UnderScan/OverScan event + 0100 Set Brightness event + 0101 Set Contrast event + 0110 Set Mute event + 0111 Set Volume Up/Down event + [4] Enable Backlight Control by BIOS/driver (set by driver) + [5] PAL/NTSC (set by BIOS) + [6] Expansion On/Off (set by BIOS) + [7] TV UnderScan/OverScan (set by BIOS) +*/ + #define SetSCARTOutput 0x01 #define BoardTVType 0x02 -#define EnablePALMN 0x40 + +/* SetFlag */ #define ProgrammingCRT2 0x01 #define TVSimuMode 0x02 #define RPLLDIV2XO 0x04 @@ -100,35 +174,57 @@ #define SetDispDevSwitchFlag 0x20 #define CheckWinDos 0x40 #define SetJDOSMode 0x80 +#define CRT2IsVGA 0x80 /* TW: Not sure about this name... */ + +/* LCDResInfo */ +#define Panel300_800x600 0x01 /* CR36 */ +#define Panel300_1024x768 0x02 +#define Panel300_1280x1024 0x03 +#define Panel300_1280x960 0x04 +#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 +#define Panel310_1024x768 0x02 +#define Panel310_1280x1024 0x03 +#define Panel310_640x480 0x04 +#define Panel310_1024x600 0x05 +#define Panel310_1152x864 0x06 +#define Panel310_1280x960 0x07 +#define Panel310_1152x768 0x08 +#define Panel310_1400x1050 0x09 +#define Panel310_1280x768 0x0a +#define Panel310_1600x1200 0x0b +#define Panel310_320x480 0x0c /* fstn - TW: This is fake, can be any */ -#define Panel800x600 0x01 -#define Panel1024x768 0x02 -#define Panel1280x1024 0x03 -#define Panel1280x960 0x04 -#define Panel640x480 0x05 -#define Panel1600x1200 0x06 /*301b */ -#define LCDRGB18Bit 0x01 #define ExtChipType 0x0e #define ExtChip301 0x02 #define ExtChipLVDS 0x04 #define ExtChipTrumpion 0x06 #define ExtChipCH7005 0x08 -#define ExtChipMitacTV 0x0a +#define ExtChipMitacTV 0x0a /* TW: Incorrect, 0x0a = Chrontel 7005 only */ + +#define IsM650 0x80 /* TW: CR5F */ + +/* LCDInfo */ +#define LCDRGB18Bit 0x01 +#define LCDNonExpandingShift 0x04 #define LCDNonExpanding 0x10 -#define LCDNonExpandingShift 4 #define LCDSync 0x20 +/* TW: What is.. */ /* 0x100 */ #define LCDSyncBit 0xe0 #define LCDSyncShift 6 -#define DDC2DelayTime 300 - -#define CRT2DisplayFlag 0x2000 #define LCDDataLen 8 #define HiTVDataLen 12 #define TVDataLen 16 #define SetPALTV 0x0100 -#define HalfDCLK 0x1000 +#define HalfDCLK 0x1000 /* modeflag */ #define NTSCHT 1716 +#define NTSC2HT 1920 #define NTSCVT 525 #define PALHT 1728 #define PALVT 625 @@ -141,25 +237,23 @@ #define VCLKStartFreq 25 #define SoftDramType 0x80 -#define VCLK40 0x04 -#define VCLK65 0x09 -#define VCLK108_2 0x14 -#define LCDRGB18Bit 0x01 + +#define VCLK40 0x04 /* Index in VCLKData array */ +#define VCLK65 0x09 /* Index in VCLKData array */ +#define VCLK108_2 0x14 /* Index in VCLKData array */ +#define TVVCLKDIV2 0x21 /* Indices in (VB)VCLKData arrays */ +#define TVVCLK 0x22 +#define HiTVVCLKDIV2 0x23 +#define HiTVVCLK 0x24 +#define HiTVSimuVCLK 0x25 +#define HiTVTextVCLK 0x26 + #define LoadDACFlag 0x1000 #define AfterLockCRT2 0x4000 #define SetCRT2ToAVIDEO 0x0004 #define SetCRT2ToSCART 0x0010 #define Ext2StructSize 5 -#define TVVCLKDIV2 0x021 -#define TVVCLK 0x022 - -#define HiTVVCLKDIV2 0x023 -#define HiTVVCLK 0x024 -#define HiTVSimuVCLK 0x025 -#define HiTVTextVCLK 0x026 -#define SwitchToCRT2 0x0002 -#define LCDVESATiming 0x08 #define SetSCARTOutput 0x01 #define AVIDEOSense 0x01 #define SVIDEOSense 0x02 @@ -172,14 +266,13 @@ #define HotPlugFunction 0x08 #define StStructSize 0x06 -#define SIS_CRT2_PORT_04 0x04 - 0x030 +#define SIS_CRT2_PORT_04 0x04 - 0x30 #define SIS_CRT2_PORT_10 0x10 - 0x30 #define SIS_CRT2_PORT_12 0x12 - 0x30 #define SIS_CRT2_PORT_14 0x14 - 0x30 -#define LCDNonExpanding 0x10 #define ADR_CRT2PtrData 0x20E -#define offset_Zurac 0x210 +#define offset_Zurac 0x210 /* TW: Trumpion Zurac data pointer */ #define ADR_LVDSDesPtrData 0x212 #define ADR_LVDSCRT1DataPtr 0x214 #define ADR_CHTVVCLKPtr 0x216 @@ -198,26 +291,26 @@ #define ModeSettingAddr 0x53 #define SelectCRT1Rate 0x4 + +#define _PanelType00 0x00 +#define _PanelType01 0x08 +#define _PanelType02 0x10 +#define _PanelType03 0x18 +#define _PanelType04 0x20 +#define _PanelType05 0x28 +#define _PanelType06 0x30 +#define _PanelType07 0x38 +#define _PanelType08 0x40 +#define _PanelType09 0x48 +#define _PanelType0A 0x50 +#define _PanelType0B 0x58 +#define _PanelType0C 0x60 +#define _PanelType0D 0x68 +#define _PanelType0E 0x70 +#define _PanelType0F 0x78 -#define _PanelType00 0x00 -#define _PanelType01 0x08 -#define _PanelType02 0x10 -#define _PanelType03 0x18 -#define _PanelType04 0x20 -#define _PanelType05 0x28 -#define _PanelType06 0x30 -#define _PanelType07 0x38 -#define _PanelType08 0x40 -#define _PanelType09 0x48 -#define _PanelType0A 0x50 -#define _PanelType0B 0x58 -#define _PanelType0C 0x60 -#define _PanelType0D 0x68 -#define _PanelType0E 0x70 -#define _PanelType0F 0x78 - -#define PRIMARY_VGA 0 /* 1: SiS is primary vga 0:SiS is secondary vga */ -#define BIOSIDCodeAddr 0x235 +#define PRIMARY_VGA 0 /* 1: SiS is primary vga 0:SiS is secondary vga */ +#define BIOSIDCodeAddr 0x235 /* TW: Offsets to ptrs in BIOS image */ #define OEMUtilIDCodeAddr 0x237 #define VBModeIDTableAddr 0x239 #define OEMTVPtrAddr 0x241 @@ -258,55 +351,57 @@ #define OEMLCDPanelIDSupport 0x0080 -/* ============================================================= - for 310 -============================================================== */ -#define SoftDRAMType 0x80 -#define SoftSetting_OFFSET 0x52 -#define SR07_OFFSET 0x7C -#define SR15_OFFSET 0x7D -#define SR16_OFFSET 0x81 -#define SR17_OFFSET 0x85 -#define SR19_OFFSET 0x8D -#define SR1F_OFFSET 0x99 -#define SR21_OFFSET 0x9A -#define SR22_OFFSET 0x9B -#define SR23_OFFSET 0x9C -#define SR24_OFFSET 0x9D -#define SR25_OFFSET 0x9E -#define SR31_OFFSET 0x9F -#define SR32_OFFSET 0xA0 -#define SR33_OFFSET 0xA1 - -#define CR40_OFFSET 0xA2 -#define SR25_1_OFFSET 0xF6 -#define CR49_OFFSET 0xF7 - -#define VB310Data_1_2_Offset 0xB6 -#define VB310Data_4_D_Offset 0xB7 -#define VB310Data_4_E_Offset 0xB8 -#define VB310Data_4_10_Offset 0xBB - -#define RGBSenseDataOffset 0xBD -#define YCSenseDataOffset 0xBF -#define VideoSenseDataOffset 0xC1 -#define OutputSelectOffset 0xF3 - -#define ECLK_MCLK_DISTANCE 0x14 -#define VBIOSTablePointerStart 0x100 -#define StandTablePtrOffset VBIOSTablePointerStart+0x02 -#define EModeIDTablePtrOffset VBIOSTablePointerStart+0x04 -#define CRT1TablePtrOffset VBIOSTablePointerStart+0x06 -#define ScreenOffsetPtrOffset VBIOSTablePointerStart+0x08 -#define VCLKDataPtrOffset VBIOSTablePointerStart+0x0A -#define MCLKDataPtrOffset VBIOSTablePointerStart+0x0E -#define CRT2PtrDataPtrOffset VBIOSTablePointerStart+0x10 -#define TVAntiFlickPtrOffset VBIOSTablePointerStart+0x12 -#define TVDelayPtr1Offset VBIOSTablePointerStart+0x14 -#define TVPhaseIncrPtr1Offset VBIOSTablePointerStart+0x16 -#define TVYFilterPtr1Offset VBIOSTablePointerStart+0x18 -#define LCDDelayPtr1Offset VBIOSTablePointerStart+0x20 -#define TVEdgePtr1Offset VBIOSTablePointerStart+0x24 -#define CRT2Delay1Offset VBIOSTablePointerStart+0x28 +/* + ============================================================= + for 310/325 series + ============================================================= +*/ +#define SoftDRAMType 0x80 +#define SoftSetting_OFFSET 0x52 +#define SR07_OFFSET 0x7C +#define SR15_OFFSET 0x7D +#define SR16_OFFSET 0x81 +#define SR17_OFFSET 0x85 +#define SR19_OFFSET 0x8D +#define SR1F_OFFSET 0x99 +#define SR21_OFFSET 0x9A +#define SR22_OFFSET 0x9B +#define SR23_OFFSET 0x9C +#define SR24_OFFSET 0x9D +#define SR25_OFFSET 0x9E +#define SR31_OFFSET 0x9F +#define SR32_OFFSET 0xA0 +#define SR33_OFFSET 0xA1 + +#define CR40_OFFSET 0xA2 +#define SR25_1_OFFSET 0xF6 +#define CR49_OFFSET 0xF7 + +#define VB310Data_1_2_Offset 0xB6 +#define VB310Data_4_D_Offset 0xB7 +#define VB310Data_4_E_Offset 0xB8 +#define VB310Data_4_10_Offset 0xBB + +#define RGBSenseDataOffset 0xBD +#define YCSenseDataOffset 0xBF +#define VideoSenseDataOffset 0xC1 +#define OutputSelectOffset 0xF3 + +#define ECLK_MCLK_DISTANCE 0x14 +#define VBIOSTablePointerStart 0x100 +#define StandTablePtrOffset VBIOSTablePointerStart+0x02 +#define EModeIDTablePtrOffset VBIOSTablePointerStart+0x04 +#define CRT1TablePtrOffset VBIOSTablePointerStart+0x06 +#define ScreenOffsetPtrOffset VBIOSTablePointerStart+0x08 +#define VCLKDataPtrOffset VBIOSTablePointerStart+0x0A +#define MCLKDataPtrOffset VBIOSTablePointerStart+0x0E +#define CRT2PtrDataPtrOffset VBIOSTablePointerStart+0x10 +#define TVAntiFlickPtrOffset VBIOSTablePointerStart+0x12 +#define TVDelayPtr1Offset VBIOSTablePointerStart+0x14 +#define TVPhaseIncrPtr1Offset VBIOSTablePointerStart+0x16 +#define TVYFilterPtr1Offset VBIOSTablePointerStart+0x18 +#define LCDDelayPtr1Offset VBIOSTablePointerStart+0x20 +#define TVEdgePtr1Offset VBIOSTablePointerStart+0x24 +#define CRT2Delay1Offset VBIOSTablePointerStart+0x28 #endif diff --git a/drivers/video/sis/oem300.h b/drivers/video/sis/oem300.h index 0d42507b7ee8..2a6ac988cc74 100644 --- a/drivers/video/sis/oem300.h +++ b/drivers/video/sis/oem300.h @@ -1,397 +1,606 @@ -UCHAR SiS300_TVEdge1[3][2] = { - {0x0, 0x4}, - {0x0, 0x4}, - {0x0, 0x0} -}; - -UCHAR SiS300_OEMTVDelay[8][4] = { - {0x08, 0x08, 0x08, 0x08}, - {0x08, 0x08, 0x08, 0x08}, - {0x08, 0x08, 0x08, 0x08}, - {0x2c, 0x2c, 0x2c, 0x2c}, - {0x08, 0x08, 0x08, 0x08}, - {0x08, 0x08, 0x08, 0x08}, - {0x08, 0x08, 0x08, 0x08}, - {0x20, 0x20, 0x20, 0x20} -}; - -UCHAR SiS300_OEMTVFlicker[8][4] = { - {0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00} -}; - -UCHAR SiS300_OEMLCDDelay1[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} -}; - -UCHAR SiS300_OEMLCDDelay2[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} -}; - -UCHAR SiS300_StNTSCPhase[6][4] = { - {0x21, 0xed, 0x00, 0x08}, - {0x21, 0xed, 0x8a, 0x08}, - {0x21, 0xed, 0x8a, 0x08}, - {0x21, 0xed, 0x8a, 0x08}, - {0x21, 0xed, 0x8a, 0x08}, - {0xff, 0xff, 0xff, 0xff} -}; - -UCHAR SiS300_StPALPhase[6][4] = { - {0x2a, 0x05, 0xd3, 0x00}, - {0x2a, 0x05, 0xd3, 0x00}, - {0x2a, 0x05, 0xd3, 0x00}, - {0x2a, 0x05, 0xd3, 0x00}, - {0x2a, 0x05, 0xd3, 0x00}, - {0xff, 0xff, 0xff, 0xff} -}; - -UCHAR SiS300_StSCARTPhase[6][4] = { - {0x2a, 0x05, 0xd3, 0x00}, - {0x2a, 0x05, 0xd3, 0x00}, - {0x2a, 0x05, 0xd3, 0x00}, - {0x2a, 0x05, 0xd3, 0x00}, - {0x2a, 0x05, 0xd3, 0x00}, - {0xff, 0xff, 0xff, 0xff} -}; -UCHAR SiS300_StHiTVPhase[6][4] = { - {0x2a, 0x05, 0xd3, 0x00}, - {0x2a, 0x05, 0xd3, 0x00}, - {0x2a, 0x05, 0xd3, 0x00}, - {0x2a, 0x05, 0xd3, 0x00}, - {0x2a, 0x05, 0xd3, 0x00}, - {0xff, 0xff, 0xff, 0xff} -}; - -UCHAR SiS300_ExtNTSCPhase[6][4] = { - {0x21, 0xed, 0x00, 0x08}, - {0x21, 0xed, 0x8a, 0x08}, - {0x21, 0xed, 0x8a, 0x08}, - {0x21, 0xed, 0x8a, 0x08}, - {0x21, 0xed, 0x8a, 0x08}, - {0xff, 0xff, 0xff, 0xff} -}; - -UCHAR SiS300_ExtPALPhase[6][4] = { - {0x2a, 0x05, 0xd3, 0x00}, - {0x2a, 0x05, 0xd3, 0x00}, - {0x2a, 0x05, 0xd3, 0x00}, - {0x2a, 0x05, 0xd3, 0x00}, - {0x2a, 0x05, 0xd3, 0x00}, - {0xff, 0xff, 0xff, 0xff} -}; - -UCHAR SiS300_ExtSCARTPhase[6][4] = { - {0x2a, 0x05, 0xd3, 0x00}, - {0x2a, 0x05, 0xd3, 0x00}, - {0x2a, 0x05, 0xd3, 0x00}, - {0x2a, 0x05, 0xd3, 0x00}, - {0x2a, 0x05, 0xd3, 0x00}, - {0xff, 0xff, 0xff, 0xff} -}; +/* OEM Data for 300 series */ -UCHAR SiS300_ExtHiTVPhase[6][4] = { - {0x2a, 0x05, 0xd3, 0x00}, - {0x2a, 0x05, 0xd3, 0x00}, - {0x2a, 0x05, 0xd3, 0x00}, - {0x2a, 0x05, 0xd3, 0x00}, - {0x2a, 0x05, 0xd3, 0x00}, - {0xff, 0xff, 0xff, 0xff} +UCHAR SiS300_OEMTVDelay301[8][4] = +{ + {0x08,0x08,0x08,0x08}, + {0x08,0x08,0x08,0x08}, + {0x08,0x08,0x08,0x08}, + {0x2c,0x2c,0x2c,0x2c}, + {0x08,0x08,0x08,0x08}, + {0x08,0x08,0x08,0x08}, + {0x08,0x08,0x08,0x08}, + {0x20,0x20,0x20,0x20} }; -UCHAR SiS300_StNTSCFilter[17][4] = { - {0x00, 0xf4, 0x10, 0x38}, - {0x00, 0xf4, 0x10, 0x38}, - {0xeb, 0x04, 0x10, 0x18}, - {0xf7, 0x06, 0x19, 0x14}, - {0x00, 0xf4, 0x10, 0x38}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x15, 0x25, 0xf6}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xff, 0xff, 0xff, 0xff} +UCHAR SiS300_OEMTVDelayLVDS[8][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} }; -UCHAR SiS300_StPALFilter[17][4] = { - {0x00, 0xf4, 0x10, 0x38}, - {0x00, 0xf4, 0x10, 0x38}, - {0xf1, 0xf7, 0x10, 0x32}, - {0xf3, 0x00, 0x1d, 0x20}, - {0x00, 0xf4, 0x10, 0x38}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xfc, 0xfb, 0x14, 0x2a}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xff, 0xff, 0xff, 0xff} +UCHAR SiS300_OEMTVFlicker[8][4] = +{ + {0x00,0x00,0x00,0x00}, + {0x00,0x00,0x00,0x00}, + {0x00,0x00,0x00,0x00}, + {0x00,0x00,0x00,0x00}, + {0x00,0x00,0x00,0x00}, + {0x00,0x00,0x00,0x00}, + {0x00,0x00,0x00,0x00}, + {0x00,0x00,0x00,0x00} }; -UCHAR SiS300_StSCARTFilter[17][4] = { - {0x00, 0xf4, 0x10, 0x38}, - {0x00, 0xf4, 0x10, 0x38}, - {0xf1, 0xf7, 0x10, 0x32}, - {0xf3, 0x00, 0x1d, 0x20}, - {0x00, 0xf4, 0x10, 0x38}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xfc, 0xfb, 0x14, 0x2a}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xff, 0xff, 0xff, 0xff} +#if 0 /* TW: Not used */ +UCHAR SiS300_OEMLCDDelay1[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} }; +#endif -UCHAR SiS300_StHiTVFilter[17][4] = { - {0x00, 0xf4, 0x10, 0x38}, - {0x00, 0xf4, 0x10, 0x38}, - {0xf1, 0xf7, 0x10, 0x32}, - {0xf3, 0x00, 0x1d, 0x20}, - {0x00, 0xf4, 0x10, 0x38}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xfc, 0xfb, 0x14, 0x2a}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xff, 0xff, 0xff, 0xff} +/* TW: From 630/301B BIOS */ +UCHAR SiS300_OEMLCDDelay2[64][4] = /* for 301/301b/302b/301LV/302LV */ +{ + {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}, + {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} }; -UCHAR SiS300_ExtNTSCFilter[17][4] = { - {0x00, 0xf4, 0x10, 0x38}, - {0x00, 0xf4, 0x10, 0x38}, - {0xeb, 0x04, 0x10, 0x18}, - {0xf7, 0x06, 0x19, 0x14}, - {0x00, 0xf4, 0x10, 0x38}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x15, 0x25, 0xf6}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xff, 0xff, 0xff, 0xff} +/* TW: Added for LVDS */ +UCHAR SiS300_OEMLCDDelay3[32][4] = { /* For LVDS */ + {0x20,0x20,0x20,0x20}, /* --- Expanding panels */ + {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}, + {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}, + {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}, + {0x04,0x04,0x04,0x04}, /* Gericom 2200C (PanelType 28) */ + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20}, + {0x20,0x20,0x20,0x20} }; -UCHAR SiS300_ExtPALFilter[17][4] = { - {0x00, 0xf4, 0x10, 0x38}, - {0x00, 0xf4, 0x10, 0x38}, - {0xf1, 0xf7, 0x10, 0x32}, - {0xf3, 0x00, 0x1d, 0x20}, - {0x00, 0xf4, 0x10, 0x38}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xfc, 0xfb, 0x14, 0x2a}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xff, 0xff, 0xff, 0xff} +UCHAR SiS300_Phase1[8][6][4] = +{ + { + {0x21,0xed,0x00,0x08}, + {0x21,0xed,0x8a,0x08}, + {0x21,0xed,0x8a,0x08}, + {0x21,0xed,0x8a,0x08}, + {0x21,0xed,0x8a,0x08}, + {0xff,0xff,0xff,0xff} + }, + { + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0xff,0xff,0xff,0xff} + }, + { + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0xff,0xff,0xff,0xff} + }, + { + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0xff,0xff,0xff,0xff} + }, + { + {0x21,0xed,0x00,0x08}, + {0x21,0xed,0x8a,0x08}, + {0x21,0xed,0x8a,0x08}, + {0x21,0xed,0x8a,0x08}, + {0x21,0xed,0x8a,0x08}, + {0xff,0xff,0xff,0xff} + }, + { + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0xff,0xff,0xff,0xff} + }, + { + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0xff,0xff,0xff,0xff} + }, + { + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0xff,0xff,0xff,0xff} + } }; -UCHAR SiS300_ExtSCARTFilter[17][4] = { - {0x00, 0xf4, 0x10, 0x38}, - {0x00, 0xf4, 0x10, 0x38}, - {0xf1, 0xf7, 0x10, 0x32}, - {0xf3, 0x00, 0x1d, 0x20}, - {0x00, 0xf4, 0x10, 0x38}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xfc, 0xfb, 0x14, 0x2a}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xff, 0xff, 0xff, 0xff} -}; -UCHAR SiS300_ExtHiTVFilter[17][4] = { - {0x00, 0xf4, 0x10, 0x38}, - {0x00, 0xf4, 0x10, 0x38}, - {0xf1, 0xf7, 0x10, 0x32}, - {0xf3, 0x00, 0x1d, 0x20}, - {0x00, 0xf4, 0x10, 0x38}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xfc, 0xfb, 0x14, 0x2a}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xff, 0xff, 0xff, 0xff} +UCHAR SiS300_Phase2[8][6][4] = +{ + { + {0x21,0xed,0x00,0x08}, + {0x21,0xed,0x8a,0x08}, + {0x21,0xed,0x8a,0x08}, + {0x21,0xed,0x8a,0x08}, + {0x21,0xed,0x8a,0x08}, + {0xff,0xff,0xff,0xff} + }, + { + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0xff,0xff,0xff,0xff} + }, + { + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0xff,0xff,0xff,0xff} + }, + { + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0xff,0xff,0xff,0xff} + }, + { + {0x21,0xed,0x00,0x08}, + {0x21,0xed,0x8a,0x08}, + {0x21,0xed,0x8a,0x08}, + {0x21,0xed,0x8a,0x08}, + {0x21,0xed,0x8a,0x08}, + {0xff,0xff,0xff,0xff} + }, + { + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0xff,0xff,0xff,0xff} + }, + { + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0xff,0xff,0xff,0xff} + }, + { + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00}, + {0xff,0xff,0xff,0xff} + } }; -UCHAR SiS300_NTSCFilter2[9][7] = { - {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}, - {0xFF, 0x03, 0x02, 0xF6, 0xFC, 0x27, 0x46}, - {0xFF, 0x03, 0x02, 0xF6, 0xFC, 0x27, 0x46}, - {0x01, 0x02, 0xFE, 0xF7, 0x03, 0x27, 0x3C}, - {0x01, 0x01, 0xFC, 0xF8, 0x08, 0x26, 0x38}, - {0xFF, 0xFF, 0xFC, 0x00, 0x0F, 0x22, 0x28} +UCHAR SiS300_Filter1[10][17][4] = +{ + { + {0x00,0xf4,0x10,0x38}, + {0x00,0xf4,0x10,0x38}, + {0xeb,0x04,0x10,0x18}, + {0xf7,0x06,0x19,0x14}, + {0x00,0xf4,0x10,0x38}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x15,0x25,0xf6}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xff,0xff,0xff,0xff} + }, + { + {0x00,0xf4,0x10,0x38}, + {0x00,0xf4,0x10,0x38}, + {0xf1,0xf7,0x10,0x32}, + {0xf3,0x00,0x1d,0x20}, + {0x00,0xf4,0x10,0x38}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xfc,0xfb,0x14,0x2a}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xff,0xff,0xff,0xff} + }, + { + {0x00,0xf4,0x10,0x38}, + {0x00,0xf4,0x10,0x38}, + {0xf1,0xf7,0x10,0x32}, + {0xf3,0x00,0x1d,0x20}, + {0x00,0xf4,0x10,0x38}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xfc,0xfb,0x14,0x2a}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xff,0xff,0xff,0xff} + }, + { + {0x00,0xf4,0x10,0x38}, + {0x00,0xf4,0x10,0x38}, + {0xf1,0xf7,0x10,0x32}, + {0xf3,0x00,0x1d,0x20}, + {0x00,0xf4,0x10,0x38}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xfc,0xfb,0x14,0x2a}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xff,0xff,0xff,0xff} + }, + { + {0x00,0xf4,0x10,0x38}, + {0x00,0xf4,0x10,0x38}, + {0xeb,0x04,0x10,0x18}, + {0xf7,0x06,0x19,0x14}, + {0x00,0xf4,0x10,0x38}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x15,0x25,0xf6}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xff,0xff,0xff,0xff} + }, + { + {0x00,0xf4,0x10,0x38}, + {0x00,0xf4,0x10,0x38}, + {0xf1,0xf7,0x10,0x32}, + {0xf3,0x00,0x1d,0x20}, + {0x00,0xf4,0x10,0x38}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xfc,0xfb,0x14,0x2a}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xff,0xff,0xff,0xff} + }, + { + {0x00,0xf4,0x10,0x38}, + {0x00,0xf4,0x10,0x38}, + {0xf1,0xf7,0x10,0x32}, + {0xf3,0x00,0x1d,0x20}, + {0x00,0xf4,0x10,0x38}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xfc,0xfb,0x14,0x2a}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xff,0xff,0xff,0xff} + }, + { + {0x00,0xf4,0x10,0x38}, + {0x00,0xf4,0x10,0x38}, + {0xf1,0xf7,0x10,0x32}, + {0xf3,0x00,0x1d,0x20}, + {0x00,0xf4,0x10,0x38}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xfc,0xfb,0x14,0x2a}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xf1,0xf7,0x1f,0x32}, + {0xff,0xff,0xff,0xff} + }, + { + {0x00,0xf4,0x10,0x38}, + {0x00,0xf4,0x10,0x38}, + {0xeb,0x04,0x10,0x18}, + {0xf7,0x06,0x19,0x14}, + {0x00,0xf4,0x10,0x38}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x15,0x25,0xf6}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xff,0xff,0xff,0xff} + }, + { + {0x00,0xf4,0x10,0x38}, + {0x00,0xf4,0x10,0x38}, + {0xeb,0x04,0x10,0x18}, + {0xf7,0x06,0x19,0x14}, + {0x00,0xf4,0x10,0x38}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x15,0x25,0xf6}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xff,0xff,0xff,0xff} + }, }; -UCHAR SiS300_PALFilter2[9][7] = { - {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}, - {0xFF, 0x03, 0x02, 0xF6, 0xFC, 0x27, 0x46}, - {0xFF, 0x03, 0x02, 0xF6, 0xFC, 0x27, 0x46}, - {0x01, 0x02, 0xFE, 0xF7, 0x03, 0x27, 0x3C}, - {0x01, 0x01, 0xFC, 0xF8, 0x08, 0x26, 0x38}, - {0xFF, 0xFF, 0xFC, 0x00, 0x0F, 0x22, 0x28} +UCHAR SiS300_Filter2[10][9][7] = +{ + { + {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}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0x01,0x01,0xFC,0xF8,0x08,0x26,0x38}, + {0xFF,0xFF,0xFC,0x00,0x0F,0x22,0x28} + }, + { + {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}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0x01,0x01,0xFC,0xF8,0x08,0x26,0x38}, + {0xFF,0xFF,0xFC,0x00,0x0F,0x22,0x28} + }, + { + {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}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0x01,0x01,0xFC,0xF8,0x08,0x26,0x38}, + {0xFF,0xFF,0xFC,0x00,0x0F,0x22,0x28} + }, + { + {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}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0x01,0x01,0xFC,0xF8,0x08,0x26,0x38}, + {0xFF,0xFF,0xFC,0x00,0x0F,0x22,0x28} + }, + { + {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}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0x01,0x01,0xFC,0xF8,0x08,0x26,0x38}, + {0xFF,0xFF,0xFC,0x00,0x0F,0x22,0x28} + }, + { + {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}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0x01,0x01,0xFC,0xF8,0x08,0x26,0x38}, + {0xFF,0xFF,0xFC,0x00,0x0F,0x22,0x28} + }, + { + {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}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0x01,0x01,0xFC,0xF8,0x08,0x26,0x38}, + {0xFF,0xFF,0xFC,0x00,0x0F,0x22,0x28} + }, + { + {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}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0x01,0x01,0xFC,0xF8,0x08,0x26,0x38}, + {0xFF,0xFF,0xFC,0x00,0x0F,0x22,0x28} + }, + { + {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}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0x01,0x01,0xFC,0xF8,0x08,0x26,0x38}, + {0xFF,0xFF,0xFC,0x00,0x0F,0x22,0x28} + }, + { + {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}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0x01,0x01,0xFC,0xF8,0x08,0x26,0x38}, + {0xFF,0xFF,0xFC,0x00,0x0F,0x22,0x28} + } }; -UCHAR SiS300_PALMFilter[17][4] = { - {0x00, 0xf4, 0x10, 0x38}, - {0x00, 0xf4, 0x10, 0x38}, - {0xeb, 0x04, 0x10, 0x18}, - {0xf7, 0x06, 0x19, 0x14}, - {0x00, 0xf4, 0x10, 0x38}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x15, 0x25, 0xf6}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xff, 0xff, 0xff, 0xff} -}; - -UCHAR SiS300_PALNFilter[17][4] = { - {0x00, 0xf4, 0x10, 0x38}, - {0x00, 0xf4, 0x10, 0x38}, - {0xeb, 0x04, 0x10, 0x18}, - {0xf7, 0x06, 0x19, 0x14}, - {0x00, 0xf4, 0x10, 0x38}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x15, 0x25, 0xf6}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xff, 0xff, 0xff, 0xff} -}; - -UCHAR SiS300_PALMFilter2[9][7] = { - {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}, - {0xFF, 0x03, 0x02, 0xF6, 0xFC, 0x27, 0x46}, - {0xFF, 0x03, 0x02, 0xF6, 0xFC, 0x27, 0x46}, - {0x01, 0x02, 0xFE, 0xF7, 0x03, 0x27, 0x3C}, - {0x01, 0x01, 0xFC, 0xF8, 0x08, 0x26, 0x38}, - {0xFF, 0xFF, 0xFC, 0x00, 0x0F, 0x22, 0x28} -}; - -UCHAR SiS300_PALNFilter2[9][7] = { - {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}, - {0xFF, 0x03, 0x02, 0xF6, 0xFC, 0x27, 0x46}, - {0xFF, 0x03, 0x02, 0xF6, 0xFC, 0x27, 0x46}, - {0x01, 0x02, 0xFE, 0xF7, 0x03, 0x27, 0x3C}, - {0x01, 0x01, 0xFC, 0xF8, 0x08, 0x26, 0x38}, - {0xFF, 0xFF, 0xFC, 0x00, 0x0F, 0x22, 0x28} -}; diff --git a/drivers/video/sis/oem310.h b/drivers/video/sis/oem310.h index 327129b7f83d..76a79d504f44 100644 --- a/drivers/video/sis/oem310.h +++ b/drivers/video/sis/oem310.h @@ -1,204 +1,262 @@ -UCHAR SiS310_CRT2DelayCompensation1 = 0x4; /* 301A */ - -UCHAR SiS310_LCDDelayCompensation1[] = { - 0x0, 0x0, 0x0, 0xb, 0xb, 0xb, 0x8, 0x8, - 0x8, 0x8, 0x8, 0x8, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0 -}; - -UCHAR SiS310_TVDelayCompensation1[] = { 0x2, 0x2, 0x2, 0x2, 0x8, 0xb }; -UCHAR SiS310_CRT2DelayCompensation2 = 0xC; /* 301B */ -UCHAR SiS310_LCDDelayCompensation2[] = { - 0x0, 0x0, 0x0, 0x0C, 0x0C, 0x0C, 0x0C, - 0x0C, 0x0C, 0x8, 0x8, 0x8, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 -}; - -UCHAR SiS310_TVDelayCompensation2[] = { 0x3, 0x3, 0x3, 0x3, 0x8, 0xb }; - -UCHAR SiS310_TVAntiFlick1[3][2] = { - {0x4, 0x0}, - {0x4, 0x8}, - {0x0, 0x0} -}; - -UCHAR SiS310_TVEdge1[3][2] = { - {0x0, 0x4}, - {0x0, 0x4}, - {0x0, 0x0} -}; - -UCHAR SiS310_TVYFilter1[3][8][4] = { - { - {0x0, 0xf4, 0x10, 0x38}, - {0x0, 0xf4, 0x10, 0x38}, - {0xeb, 0x4, 0x25, 0x18}, - {0xf7, 0x6, 0x19, 0x14}, - {0x0, 0xf4, 0x10, 0x38}, - {0xeb, 0x4, 0x25, 0x18}, - {0xee, 0xc, 0x22, 0x8}, - {0xeb, 0x15, 0x25, 0xf6} - } - , - { - {0x0, 0xf4, 0x10, 0x38}, - {0x0, 0xf4, 0x10, 0x38}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf3, 0x0, 0x1d, 0x20}, - {0x0, 0xf4, 0x10, 0x38}, - {0xf1, 0xf7, 0x1f, 0x32}, - {0xf3, 0x0, 0x1d, 0x20}, - {0xfc, 0xfb, 0x14, 0x2a} - } - , - { - {0x0, 0x0, 0x0, 0x0}, - {0x0, 0xf4, 0x10, 0x38}, - {0x0, 0xf4, 0x10, 0x38}, - {0xeb, 0x4, 0x25, 0x18}, - {0xf7, 0x6, 0x19, 0x14}, - {0x0, 0xf4, 0x10, 0x38}, - {0xeb, 0x4, 0x25, 0x18}, - {0xee, 0xc, 0x22, 0x8} - } -}; - -/*301b*/ -UCHAR SiS310_TVYFilter2[3][9][7] = { - { - {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}, - {0xFF, 0x03, 0x02, 0xF6, 0xFC, 0x27, 0x46}, - {0xFF, 0x03, 0x02, 0xF6, 0xFC, 0x27, 0x46}, - {0x01, 0x02, 0xFE, 0xF7, 0x03, 0x27, 0x3C}, - {0x01, 0x01, 0xFC, 0xF8, 0x08, 0x26, 0x38}, - {0xFF, 0xFF, 0xFC, 0x00, 0x0F, 0x22, 0x28} - } - , - { - {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}, - {0xFF, 0x03, 0x02, 0xF6, 0xFC, 0x27, 0x46}, - {0xFF, 0x03, 0x02, 0xF6, 0xFC, 0x27, 0x46}, - {0x01, 0x02, 0xFE, 0xF7, 0x03, 0x27, 0x3C}, - {0x01, 0x01, 0xFC, 0xF8, 0x08, 0x26, 0x38}, - {0xFF, 0xFF, 0xFC, 0x00, 0x0F, 0x22, 0x28} - } - , - { - - {0x0, 0x0, 0x0, 0xF4, 0xFF, 0x1C, 0x22}, - {0x0, 0x0, 0x0, 0xF4, 0xFF, 0x1C, 0x22}, - {0x0, 0x0, 0x0, 0xF4, 0xFF, 0x1C, 0x22}, - {0x0, 0x0, 0x0, 0xF4, 0xFF, 0x1C, 0x22}, - {0x0, 0x0, 0x0, 0xF4, 0xFF, 0x1C, 0x22}, - {0x0, 0x0, 0x0, 0xF4, 0xFF, 0x1C, 0x22}, - {0x0, 0x0, 0x0, 0xF4, 0xFF, 0x1C, 0x22}, - {0x0, 0x0, 0x0, 0xF4, 0xFF, 0x1C, 0x22} - } -}; -/*end 301b*/ -/*add PALMN*/ - -UCHAR SiS310_PALMFilter[17][4] = { - {0x00, 0xf4, 0x10, 0x38}, - {0x00, 0xf4, 0x10, 0x38}, - {0xeb, 0x04, 0x10, 0x18}, - {0xf7, 0x06, 0x19, 0x14}, - {0x00, 0xf4, 0x10, 0x38}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x15, 0x25, 0xf6}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xff, 0xff, 0xff, 0xff} -}; - -UCHAR SiS310_PALNFilter[17][4] = { - {0x00, 0xf4, 0x10, 0x38}, - {0x00, 0xf4, 0x10, 0x38}, - {0xeb, 0x04, 0x10, 0x18}, - {0xf7, 0x06, 0x19, 0x14}, - {0x00, 0xf4, 0x10, 0x38}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x15, 0x25, 0xf6}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xeb, 0x04, 0x25, 0x18}, - {0xff, 0xff, 0xff, 0xff} -}; - -UCHAR SiS310_PALMFilter2[9][7] = { - {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}, - {0xFF, 0x03, 0x02, 0xF6, 0xFC, 0x27, 0x46}, - {0xFF, 0x03, 0x02, 0xF6, 0xFC, 0x27, 0x46}, - {0x01, 0x02, 0xFE, 0xF7, 0x03, 0x27, 0x3C}, - {0x01, 0x01, 0xFC, 0xF8, 0x08, 0x26, 0x38}, - {0xFF, 0xFF, 0xFC, 0x00, 0x0F, 0x22, 0x28} -}; - -UCHAR SiS310_PALNFilter2[9][7] = { - {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}, - {0xFF, 0x03, 0x02, 0xF6, 0xFC, 0x27, 0x46}, - {0xFF, 0x03, 0x02, 0xF6, 0xFC, 0x27, 0x46}, - {0x01, 0x02, 0xFE, 0xF7, 0x03, 0x27, 0x3C}, - {0x01, 0x01, 0xFC, 0xF8, 0x08, 0x26, 0x38}, - {0xFF, 0xFF, 0xFC, 0x00, 0x0F, 0x22, 0x28} -}; - -/*end PALMN*/ -UCHAR SiS310_TVPhaseIncr1[3][2][4] = { - { - {0x21, 0xed, 0x8a, 0x8}, - {0x21, 0xed, 0x8a, 0x8} - } - , - { - {0x2a, 0x5, 0xd3, 0x0}, - {0x2a, 0x5, 0xd3, 0x0} - } - , - { - {0x2a, 0x5, 0xd3, 0x0}, - {0x2a, 0x5, 0xd3, 0x0} - } -}; - -UCHAR SiS310_TVPhaseIncr2[3][2][4] = { - { - {0x21, 0xF0, 0x7b, 0xd6}, - {0x21, 0xF0, 0x7b, 0xd6} - } - , - { - {0x2a, 0x09, 0x86, 0xe9}, - {0x2a, 0x09, 0x86, 0xe9} - } - , - { - {0x2a, 0x5, 0xd3, 0x0}, - {0x2a, 0x5, 0xd3, 0x0} - } + +/* OEM Data for 300 series */ + +UCHAR SiS310_CRT2DelayCompensation1 = 0x04; /* 301A */ + +UCHAR SiS310_LCDDelayCompensation1[] = +{ + 0x00,0x00,0x00, + 0x0b,0x0b,0x0b, + 0x08,0x08,0x08, + 0x08,0x08,0x08, + 0x00,0x00,0x00, + 0x00,0x00,0x00, + 0x00,0x00,0x00 +}; + +UCHAR SiS310_TVDelayCompensation1[] = +{ + 0x02,0x02, /* NTSC Enhanced, Standard */ + 0x02,0x02, /* PAL */ + 0x08,0x0b /* HiVision */ +}; + +UCHAR SiS310_CRT2DelayCompensation2 = 0x00; /* TW: From 650/301LV BIOS; was 0x0C; */ /* 301B */ + +UCHAR SiS310_LCDDelayCompensation2[] = +{ + 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 +}; + +UCHAR SiS310_TVDelayCompensation2[] = +{ + 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 }; + +UCHAR SiS310_CRT2DelayCompensation3 = 0x00; /* LVDS */ + +UCHAR SiS310_LCDDelayCompensation3[] = +{ + 0x00,0x00,0x00, /* 800x600 */ + 0x00,0x00,0x00, /* 1024x768 */ + 0x00,0x00,0x00, /* 1280x1024 */ + 0x00,0x00,0x00, /* 1400x1050 */ + 0x00,0x00,0x00 /* 1600x1200 */ +}; + +UCHAR SiS310_TVDelayCompensation3[] = +{ + 0x0a,0x0a, + 0x0a,0x0a, + 0x0a,0x0a +}; + +UCHAR SiS310_TVAntiFlick1[3][2] = +{ + {0x4,0x0}, + {0x4,0x8}, + {0x0,0x0} +}; + +UCHAR SiS310_TVEdge1[3][2] = +{ + {0x0,0x4}, + {0x0,0x4}, + {0x0,0x0} +}; + +UCHAR SiS310_TVYFilter1[3][8][4] = +{ + { + {0x00,0xf4,0x10,0x38}, + {0x00,0xf4,0x10,0x38}, + {0xeb,0x04,0x25,0x18}, + {0xf1,0x04,0x1f,0x18}, + {0x00,0xf4,0x10,0x38}, + {0xeb,0x04,0x25,0x18}, + {0xee,0x0c,0x22,0x08}, + {0xeb,0x15,0x25,0xf6} + }, + { + {0x00,0xf4,0x10,0x38}, + {0x00,0xf4,0x10,0x38}, + {0xf1,0xf7,0x1f,0x32}, + {0xf3,0x00,0x1d,0x20}, + {0x00,0xf4,0x10,0x38}, + {0xf1,0xf7,0x1f,0x32}, + {0xf3,0x00,0x1d,0x20}, + {0xfc,0xfb,0x14,0x2a} + }, + { + {0x00,0x00,0x00,0x00}, + {0x00,0xf4,0x10,0x38}, + {0x00,0xf4,0x10,0x38}, + {0xeb,0x04,0x25,0x18}, + {0xf7,0x06,0x19,0x14}, + {0x00,0xf4,0x10,0x38}, + {0xeb,0x04,0x25,0x18}, + {0xee,0x0c,0x22,0x08} + } +}; + +UCHAR SiS310_TVYFilter2[3][9][7] = +{ + { + {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}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0x01,0x01,0xFC,0xF8,0x08,0x26,0x38}, + {0xFF,0xFF,0xFC,0x00,0x0F,0x22,0x28} + }, + { + {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}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0x01,0x01,0xFC,0xF8,0x08,0x26,0x38}, + {0xFF,0xFF,0xFC,0x00,0x0F,0x22,0x28} + }, + { + {0x00,0x00,0x00,0xF4,0xFF,0x1C,0x22}, + {0x00,0x00,0x00,0xF4,0xFF,0x1C,0x22}, + {0x00,0x00,0x00,0xF4,0xFF,0x1C,0x22}, + {0x00,0x00,0x00,0xF4,0xFF,0x1C,0x22}, + {0x00,0x00,0x00,0xF4,0xFF,0x1C,0x22}, + {0x00,0x00,0x00,0xF4,0xFF,0x1C,0x22}, + {0x00,0x00,0x00,0xF4,0xFF,0x1C,0x22}, + {0x00,0x00,0x00,0xF4,0xFF,0x1C,0x22} + } +}; + +UCHAR SiS310_PALMFilter[17][4] = +{ + {0x00,0xf4,0x10,0x38}, + {0x00,0xf4,0x10,0x38}, + {0xeb,0x04,0x10,0x18}, + {0xf7,0x06,0x19,0x14}, + {0x00,0xf4,0x10,0x38}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x15,0x25,0xf6}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xff,0xff,0xff,0xff} +}; + +UCHAR SiS310_PALNFilter[17][4] = +{ + {0x00,0xf4,0x10,0x38}, + {0x00,0xf4,0x10,0x38}, + {0xeb,0x04,0x10,0x18}, + {0xf7,0x06,0x19,0x14}, + {0x00,0xf4,0x10,0x38}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x15,0x25,0xf6}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xeb,0x04,0x25,0x18}, + {0xff,0xff,0xff,0xff} +}; + + +UCHAR SiS310_PALMFilter2[9][7] = +{ + {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}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0x01,0x01,0xFC,0xF8,0x08,0x26,0x38}, + {0xFF,0xFF,0xFC,0x00,0x0F,0x22,0x28} +}; + +UCHAR SiS310_PALNFilter2[9][7] = +{ + {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}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0xFF,0x03,0x02,0xF6,0xFC,0x27,0x46}, + {0x01,0x02,0xFE,0xF7,0x03,0x27,0x3C}, + {0x01,0x01,0xFC,0xF8,0x08,0x26,0x38}, + {0xFF,0xFF,0xFC,0x00,0x0F,0x22,0x28} +}; + +UCHAR SiS310_TVPhaseIncr1[3][2][4]= +{ + { + {0x21,0xed,0xba,0x08}, + {0x21,0xed,0xba,0x08} + }, + { + {0x2a,0x05,0xe3,0x00}, + {0x2a,0x05,0xe3,0x00} + }, + { + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00} + } +}; + +UCHAR SiS310_TVPhaseIncr2[3][2][4]= +{ + { + {0x21,0xF1,0x37,0x56}, + {0x21,0xF1,0x37,0x56} + }, + { + {0x2a,0x09,0x86,0xe9}, + {0x2a,0x09,0x86,0xe9} + }, + { + {0x2a,0x05,0xd3,0x00}, + {0x2a,0x05,0xd3,0x00} + } +}; + + + diff --git a/drivers/video/sis/osdef.h b/drivers/video/sis/osdef.h index 1c3ad2b40f20..acd87d59b6b9 100644 --- a/drivers/video/sis/osdef.h +++ b/drivers/video/sis/osdef.h @@ -1,37 +1,159 @@ -#define LINUX_KERNEL +/* #define WINCE_HEADER */ +/* #define WIN2000 */ +/* #define TC */ +#define LINUX_KERNEL /* Kernel framebuffer */ +/* #define LINUX_XF86 */ /* XFree86 */ +/**********************************************************************/ +#ifdef LINUX_KERNEL + #include <linux/config.h> + #ifdef CONFIG_FB_SIS_300 + #define SIS300 + #endif + + #ifdef CONFIG_FB_SIS_315 + #define SIS315H + #endif +#else +/* #define SIS300*/ + #define SIS315H +#endif +#ifdef LINUX_XF86 + #define SIS300 + /* #define SIS315H */ /* TW: done above */ +#endif + +/**********************************************************************/ +#ifdef TC +#endif +#ifdef WIN2000 +#endif +#ifdef WINCE_HEADER +#endif +#ifdef LINUX_XF86 +#endif +#ifdef LINUX_KERNEL +#endif +/**********************************************************************/ +#ifdef TC +#define SiS_SetMemory(MemoryAddress,MemorySize,value) memset(MemoryAddress, value, MemorySize); +#endif +#ifdef WIN2000 +#define SiS_SetMemory(MemoryAddress,MemorySize,value) MemFill((PVOID) MemoryAddress,(ULONG) MemorySize,(UCHAR) value); +#endif +#ifdef WINCE_HEADER +#define SiS_SetMemory(MemoryAddress,MemorySize,value) memset(MemoryAddress, value, MemorySize); +#endif +#ifdef LINUX_XF86 +#define SiS_SetMemory(MemoryAddress,MemorySize,value) memset(MemoryAddress, value, MemorySize) +#endif +#ifdef LINUX_KERNEL #define SiS_SetMemory(MemoryAddress,MemorySize,value) memset(MemoryAddress, value, MemorySize) +#endif +/**********************************************************************/ + +/**********************************************************************/ + +#ifdef TC +#define SiS_MemoryCopy(Destination,Soruce,Length) memmove(Destination, Soruce, Length); +#endif +#ifdef WIN2000 +#define SiS_MemoryCopy(Destination,Soruce,Length) /*VideoPortMoveMemory((PUCHAR)Destination , Soruce,length);*/ +#endif +#ifdef WINCE_HEADER +#define SiS_MemoryCopy(Destination,Soruce,Length) memmove(Destination, Soruce, Length); +#endif +#ifdef LINUX_XF86 +#define SiS_MemoryCopy(Destination,Soruce,Length) memcpy(Destination,Soruce,Length) +#endif +#ifdef LINUX_KERNEL #define SiS_MemoryCopy(Destination,Soruce,Length) memcpy(Destination,Soruce,Length) +#endif /**********************************************************************/ #ifdef OutPortByte #undef OutPortByte -#endif /* OutPortByte */ +#endif /* OutPortByte */ #ifdef OutPortWord #undef OutPortWord -#endif /* OutPortWord */ +#endif /* OutPortWord */ #ifdef OutPortLong #undef OutPortLong -#endif /* OutPortLong */ +#endif /* OutPortLong */ #ifdef InPortByte #undef InPortByte -#endif /* InPortByte */ +#endif /* InPortByte */ #ifdef InPortWord #undef InPortWord -#endif /* InPortWord */ +#endif /* InPortWord */ #ifdef InPortLong #undef InPortLong -#endif /* InPortLong */ +#endif /* InPortLong */ + +/**********************************************************************/ +/* TC */ +/**********************************************************************/ +#ifdef TC +#define OutPortByte(p,v) outp((unsigned short)(p),(unsigned char)(v)) +#define OutPortWord(p,v) outp((unsigned short)(p),(unsigned short)(v)) +#define OutPortLong(p,v) outp((unsigned short)(p),(unsigned long)(v)) +#define InPortByte(p) inp((unsigned short)(p)) +#define InPortWord(p) inp((unsigned short)(p)) +#define InPortLong(p) ((inp((unsigned short)(p+2))<<16) | inp((unsigned short)(p))) +#endif + +/**********************************************************************/ +/* LINUX XF86 */ +/**********************************************************************/ + +#ifdef LINUX_XF86 +#define OutPortByte(p,v) outb((CARD16)(p),(CARD8)(v)) +#define OutPortWord(p,v) outw((CARD16)(p),(CARD16)(v)) +#define OutPortLong(p,v) outl((CARD16)(p),(CARD32)(v)) +#define InPortByte(p) inb((CARD16)(p)) +#define InPortWord(p) inw((CARD16)(p)) +#define InPortLong(p) inl((CARD16)(p)) +#endif + +#ifdef LINUX_KERNEL #define OutPortByte(p,v) outb((u8)(v),(u16)(p)) #define OutPortWord(p,v) outw((u16)(v),(u16)(p)) #define OutPortLong(p,v) outl((u32)(v),(u16)(p)) #define InPortByte(p) inb((u16)(p)) #define InPortWord(p) inw((u16)(p)) #define InPortLong(p) inl((u16)(p)) +#endif + +/**********************************************************************/ +/* WIN 2000 */ +/**********************************************************************/ + +#ifdef WIN2000 +#define OutPortByte(p,v) VideoPortWritePortUchar ((PUCHAR) (p), (UCHAR) (v)) +#define OutPortWord(p,v) VideoPortWritePortUshort((PUSHORT) (p), (USHORT) (v)) +#define OutPortLong(p,v) VideoPortWritePortUlong ((PULONG) (p), (ULONG) (v)) +#define InPortByte(p) VideoPortReadPortUchar ((PUCHAR) (p)) +#define InPortWord(p) VideoPortReadPortUshort ((PUSHORT) (p)) +#define InPortLong(p) VideoPortReadPortUlong ((PULONG) (p)) +#endif + + +/**********************************************************************/ +/* WIN CE */ +/**********************************************************************/ + +#ifdef WINCE_HEADER +#define OutPortByte(p,v) WRITE_PORT_UCHAR ((PUCHAR) (p), (UCHAR) (v)) +#define OutPortWord(p,v) WRITE_PORT_USHORT((PUSHORT) (p), (USHORT) (v)) +#define OutPortLong(p,v) WRITE_PORT_ULONG ((PULONG) (p), (ULONG) (v)) +#define InPortByte(p) READ_PORT_UCHAR ((PUCHAR) (p)) +#define InPortWord(p) READ_PORT_USHORT ((PUSHORT) (p)) +#define InPortLong(p) READ_PORT_ULONG ((PULONG) (p)) +#endif diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c index 43a751fddea6..f112d9202103 100644 --- a/drivers/video/sis/sis_main.c +++ b/drivers/video/sis/sis_main.c @@ -1,16 +1,26 @@ /* - * SiS 300/630/540/315H/315 frame buffer device For Kernal 2.4.x + * SiS 300/630/730/540/315/550/650/740 frame buffer device + * for Linux kernels 2.4.x and 2.5.x * - * This driver is partly based on the VBE 2.0 compliant graphic - * boards framebuffer driver, which is - * - * (c) 1998 Gerd Knorr <kraxel@goldbach.in-berlin.de> + * Partly based on the VBE 2.0 compliant graphic boards framebuffer driver, + * which is (c) 1998 Gerd Knorr <kraxel@goldbach.in-berlin.de> * + * 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 + * - 650/LVDS support (for LCD panels up to 1400x1050) + * - 650/Chrontel 7019 support + * - 301B/301LV LCD and TV support + * - memory queue handling enhancements, + * - everything marked with "TW" + * (see http://www.winischhofer.net/linuxsis630.shtml + * for more information and updates) */ -//#undef SISFBDEBUG - #include <linux/config.h> +#include <linux/version.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> @@ -29,11 +39,12 @@ #include <linux/capability.h> #include <linux/fs.h> #include <linux/agp_backend.h> + #include <linux/types.h> #include <linux/sisfb.h> #include <asm/io.h> -#include <asm/mtrr.h> +#include <asm/mtrr.h> #include <video/fbcon.h> #include <video/fbcon-cfb8.h> @@ -44,9 +55,13 @@ #include "osdef.h" #include "vgatypes.h" #include "sis_main.h" +//#ifdef LINUXBIOS +//#include "bios.h" +//#endif /* -------------------- Macro definitions ---------------------------- */ - +// #define SISFBDEBUG +#undef SISFBDEBUG /* TW */ #ifdef SISFBDEBUG #define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args) #else @@ -64,71 +79,88 @@ /* --------------- Hardware Access Routines -------------------------- */ -void sisfb_set_reg1 (u16 port, u16 index, u16 data) +void sisfb_set_reg1(u16 port, u16 index, u16 data) { - outb ((u8) (index & 0xff), port); + outb((u8) (index & 0xff), port); port++; - outb ((u8) (data & 0xff), port); + outb((u8) (data & 0xff), port); } -void sisfb_set_reg3 (u16 port, u16 data) +void sisfb_set_reg3(u16 port, u16 data) { - outb ((u8) (data & 0xff), port); + outb((u8) (data & 0xff), port); } -void sisfb_set_reg4 (u16 port, unsigned long data) +void sisfb_set_reg4(u16 port, unsigned long data) { - outl ((u32) (data & 0xffffffff), port); + outl((u32) (data & 0xffffffff), port); } -u8 sisfb_get_reg1 (u16 port, u16 index) +u8 sisfb_get_reg1(u16 port, u16 index) { u8 data; - outb ((u8) (index & 0xff), port); + outb((u8) (index & 0xff), port); port += 1; - data = inb (port); + data = inb(port); return (data); } -u8 sisfb_get_reg2 (u16 port) +u8 sisfb_get_reg2(u16 port) { u8 data; - data = inb (port); - + data = inb(port); return (data); } -u32 sisfb_get_reg3 (u16 port) +u32 sisfb_get_reg3(u16 port) { u32 data; - data = inl (port); + data = inl(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 ---------------------------- */ -BOOLEAN sisfb_query_VGA_config_space (PSIS_HW_DEVICE_INFO psishw_ext, - unsigned long offset, unsigned long set, - unsigned long *value) +BOOLEAN +sisfb_query_VGA_config_space(PSIS_HW_DEVICE_INFO psishw_ext, + unsigned long offset, unsigned long set, unsigned long *value) { static struct pci_dev *pdev = NULL; static unsigned char init = 0, valid_pdev = 0; if (!set) - DPRINTK ("Get VGA offset 0x%lx\n", offset); + DPRINTK("sisfb: Get VGA offset 0x%lx\n", offset); else - DPRINTK ("Set offset 0x%lx to 0x%lx\n", offset, *value); + DPRINTK("sisfb: Set offset 0x%lx to 0x%lx\n", offset, *value); if (!init) { init = TRUE; - pci_for_each_dev (pdev) { - DPRINTK ("Current: 0x%x, target: 0x%x\n", pdev->device, - ivideo.chip_id); + pci_for_each_dev(pdev) { + DPRINTK("sisfb: Current: 0x%x, target: 0x%x\n", + pdev->device, ivideo.chip_id); if ((pdev->vendor == PCI_VENDOR_ID_SI) - && (pdev->device == ivideo.chip_id)) { + && (pdev->device == ivideo.chip_id)) { valid_pdev = TRUE; break; } @@ -136,22 +168,21 @@ BOOLEAN sisfb_query_VGA_config_space (PSIS_HW_DEVICE_INFO psishw_ext, } if (!valid_pdev) { - printk (KERN_DEBUG "Can't find SiS %d VGA device.\n", - ivideo.chip_id); + printk(KERN_DEBUG "sisfb: Can't find SiS %d VGA device.\n", + ivideo.chip_id); return FALSE; } if (set == 0) - pci_read_config_dword (pdev, offset, (u32 *) value); + pci_read_config_dword(pdev, offset, (u32 *)value); else - pci_write_config_dword (pdev, offset, (u32) (*value)); + pci_write_config_dword(pdev, offset, (u32)(*value)); return TRUE; } -BOOLEAN sisfb_query_north_bridge_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) { static struct pci_dev *pdev = NULL; static unsigned char init = 0, valid_pdev = 0; @@ -172,16 +203,19 @@ BOOLEAN sisfb_query_north_bridge_space (PSIS_HW_DEVICE_INFO psishw_ext, case SIS_550: nbridge_id = PCI_DEVICE_ID_SI_550; break; + case SIS_650: + nbridge_id = PCI_DEVICE_ID_SI_650; + break; default: nbridge_id = 0; break; } - pci_for_each_dev (pdev) { - DPRINTK ("Current: 0x%x, target: 0x%x\n", pdev->device, - ivideo.chip_id); + pci_for_each_dev(pdev) { + DPRINTK("Current: 0x%x, target: 0x%x\n", + pdev->device, ivideo.chip_id); if ((pdev->vendor == PCI_VENDOR_ID_SI) - && (pdev->device == nbridge_id)) { + && (pdev->device == nbridge_id)) { valid_pdev = TRUE; break; } @@ -189,68 +223,77 @@ BOOLEAN sisfb_query_north_bridge_space (PSIS_HW_DEVICE_INFO psishw_ext, } if (!valid_pdev) { - printk (KERN_DEBUG "Can't find SiS %d North Bridge device.\n", - nbridge_id); + printk(KERN_DEBUG "sisfb: Can't find SiS %d North Bridge device.\n", + nbridge_id); return FALSE; } if (set == 0) - pci_read_config_dword (pdev, offset, (u32 *) value); + pci_read_config_dword(pdev, offset, (u32 *)value); else - pci_write_config_dword (pdev, offset, (u32) (*value)); + pci_write_config_dword(pdev, offset, (u32)(*value)); return TRUE; } /* -------------------- Export functions ----------------------------- */ -static void sis_get_glyph (struct fb_info *info, SIS_GLYINFO * gly) +#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 { - struct display *p = &fb_display[info->currcon]; +#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; + + 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); + if (fontwidth(p) <= 8) + cdat = p->fontdata + c * fontheight(p); else - cdat = p->fontdata + (c * fontheight (p) << 1); + cdat = p->fontdata + (c * fontheight(p) << 1); - size = fontheight (p) * widthb; - memcpy (gbuf, cdat, size); + size = fontheight(p) * widthb; + memcpy(gbuf, cdat, size); gly->ngmask = size; } -void sis_dispinfo (struct ap_data *rec) +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.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; + 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; } /* ------------------ Internal Routines ------------------------------ */ -static void sisfb_search_mode (const char *name) +static void sisfb_search_mode(const char *name) { int i = 0; @@ -258,64 +301,66 @@ static void sisfb_search_mode (const char *name) return; while (sisbios_mode[i].mode_no != 0) { - if (!strcmp (name, sisbios_mode[i].name)) { + if (!strcmp(name, sisbios_mode[i].name)) { sisfb_mode_idx = i; break; } i++; } - if (sisfb_mode_idx < 0) - DPRINTK ("Invalid user mode : %s\n", name); + printk(KERN_INFO "sisfb: Invalid mode '%s'\n", name); } -static void sisfb_validate_mode (void) +static void sisfb_validate_mode(void) { + u16 xres, yres; + switch (ivideo.disp_state & DISPTYPE_DISP2) { case DISPTYPE_LCD: -// Eden Chen - switch (sishw_ext.ulCRT2LCDType) { + switch (sishw_ext.ulCRT2LCDType) { case LCD_1024x768: - if (sisbios_mode[sisfb_mode_idx].xres > 1024) - sisfb_mode_idx = -1; - break; + xres = 1024; yres = 768; break; case LCD_1280x1024: + xres = 1280; yres = 1024; break; case LCD_1280x960: - if (sisbios_mode[sisfb_mode_idx].xres > 1280) - sisfb_mode_idx = -1; - break; + xres = 1280; yres = 960; break; case LCD_2048x1536: - if (sisbios_mode[sisfb_mode_idx].xres > 2048) - sisfb_mode_idx = -1; - break; + xres = 2048; yres = 1536; break; case LCD_1920x1440: - if (sisbios_mode[sisfb_mode_idx].xres > 1920) - sisfb_mode_idx = -1; - break; + xres = 1920; yres = 1440; break; case LCD_1600x1200: - if (sisbios_mode[sisfb_mode_idx].xres > 1600) - sisfb_mode_idx = -1; - break; + xres = 1600; yres = 1200; break; case LCD_800x600: - if (sisbios_mode[sisfb_mode_idx].xres > 800) - sisfb_mode_idx = -1; - break; + xres = 800; yres = 600; break; case LCD_640x480: - if (sisbios_mode[sisfb_mode_idx].xres > 640) - sisfb_mode_idx = -1; - break; + 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: - sisfb_mode_idx = -1; + xres = 0; yres = 0; break; } -// ~Eden Chen - + 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; break; case DISPTYPE_TV: - switch (sisbios_mode[sisfb_mode_idx].xres) { - case 800: + switch (sisbios_mode[sisfb_mode_idx].xres) { + case 512: case 640: + case 800: break; case 720: if (ivideo.TV_type == TVMODE_NTSC) { @@ -325,12 +370,22 @@ static void sisfb_validate_mode (void) if (sisbios_mode[sisfb_mode_idx].yres != 576) sisfb_mode_idx = -1; } + /* TW: LVDS/CHRONTEL does not support 720 */ + if (ivideo.hasVB == HASVB_LVDS_CHRONTEL || + ivideo.hasVB == HASVB_CHRONTEL) + sisfb_mode_idx = -1; break; - /*karl */ case 1024: if (ivideo.TV_type == TVMODE_NTSC) { - if (sisbios_mode[sisfb_mode_idx].bpp == 32) - sisfb_mode_idx -= 1; + if(sisbios_mode[sisfb_mode_idx].bpp == 32) + 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) { + sisfb_mode_idx = -1; + } } break; default: @@ -338,9 +393,51 @@ static void sisfb_validate_mode (void) } break; } + + 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 */ +} + +static void sisfb_search_crt2type(const char *name) +{ + int i = 0; + + if (name == NULL) + return; + + while (sis_crt2type[i].type_no != -1) { + if (!strcmp(name, sis_crt2type[i].name)) { + sisfb_crt2type = sis_crt2type[i].type_no; + break; + } + i++; + } + if (sisfb_crt2type < 0) + printk(KERN_INFO "sisfb: Invalid CRT2 type: %s\n", name); +} + +static void sisfb_search_queuemode(const char *name) +{ + int i = 0; + + if (name == NULL) + return; + + while (sis_queuemode[i].type_no != -1) { + if (!strcmp(name, sis_queuemode[i].name)) { + sisfb_queuemode = sis_queuemode[i].type_no; + break; + } + i++; + } + if (sisfb_queuemode < 0) + printk(KERN_INFO "sisfb: Invalid queuemode type: %s\n", name); } -static u8 sisfb_search_refresh_rate (unsigned int rate) +static u8 sisfb_search_refresh_rate(unsigned int rate) { u16 xres, yres; int i = 0; @@ -350,44 +447,39 @@ static u8 sisfb_search_refresh_rate (unsigned int rate) sisfb_rate_idx = 0; while ((sisfb_vrate[i].idx != 0) && (sisfb_vrate[i].xres <= xres)) { - if ((sisfb_vrate[i].xres == xres) - && (sisfb_vrate[i].yres == yres)) { + if ((sisfb_vrate[i].xres == xres) && (sisfb_vrate[i].yres == yres)) { if (sisfb_vrate[i].refresh == rate) { sisfb_rate_idx = sisfb_vrate[i].idx; break; } else if (sisfb_vrate[i].refresh > rate) { if ((sisfb_vrate[i].refresh - rate) <= 2) { - DPRINTK - ("Adjust rate from %d up to %d\n", - rate, sisfb_vrate[i].refresh); + DPRINTK("sisfb: Adjusting rate from %d up to %d\n", + rate, sisfb_vrate[i].refresh); sisfb_rate_idx = sisfb_vrate[i].idx; - ivideo.refresh_rate = - sisfb_vrate[i].refresh; - } else if (((rate - sisfb_vrate[i - 1].refresh) <= 2) - && (sisfb_vrate[i].idx != 1)) { - DPRINTK("Adjust rate from %d down to %d\n", - rate, sisfb_vrate[i - 1].refresh); - sisfb_rate_idx = sisfb_vrate[i - 1].idx; - ivideo.refresh_rate = sisfb_vrate[i - 1].refresh; + ivideo.refresh_rate = sisfb_vrate[i].refresh; + } else if (((rate - sisfb_vrate[i-1].refresh) <= 2) + && (sisfb_vrate[i].idx != 1)) { + DPRINTK("sisfb: Adjusting rate from %d down to %d\n", + rate, sisfb_vrate[i-1].refresh); + sisfb_rate_idx = sisfb_vrate[i-1].idx; + ivideo.refresh_rate = sisfb_vrate[i-1].refresh; } break; } } i++; } - if (sisfb_rate_idx > 0) { return sisfb_rate_idx; } else { - DPRINTK ("Unsupported rate %d for %dx%d mode\n", rate, xres, - yres); + printk(KERN_INFO + "sisfb: Unsupported rate %d for %dx%d\n", rate, xres, yres); return 0; } - } -static int sis_getcolreg (unsigned regno, unsigned *red, unsigned *green, unsigned *blue, - unsigned *transp, struct fb_info *fb_info) +static int sis_getcolreg(unsigned regno, unsigned *red, unsigned *green, unsigned *blue, + unsigned *transp, struct fb_info *fb_info) { if (regno >= video_cmap_len) return 1; @@ -399,10 +491,10 @@ static int sis_getcolreg (unsigned regno, unsigned *red, unsigned *green, unsign return 0; } -static int sisfb_setcolreg (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) +{ if (regno >= video_cmap_len) return 1; @@ -413,17 +505,16 @@ static int sisfb_setcolreg (unsigned regno, unsigned red, unsigned green, unsign 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); + 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); + 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 @@ -439,7 +530,8 @@ static int sisfb_setcolreg (unsigned regno, unsigned red, unsigned green, unsign red >>= 8; green >>= 8; blue >>= 8; - fbcon_cmap.cfb24[regno] = (red << 16) | (green << 8) | (blue); + fbcon_cmap.cfb24[regno] = + (red << 16) | (green << 8) | (blue); break; #endif #ifdef FBCON_HAS_CFB32 @@ -447,33 +539,44 @@ static int sisfb_setcolreg (unsigned regno, unsigned red, unsigned green, unsign red >>= 8; green >>= 8; blue >>= 8; - fbcon_cmap.cfb32[regno] = (red << 16) | (green << 8) | (blue); + fbcon_cmap.cfb32[regno] = + (red << 16) | (green << 8) | (blue); break; #endif } return 0; } -static int sisfb_do_set_var (struct fb_var_screeninfo *var, int isactive, - struct fb_info *info) +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 = - var->upper_margin + var->yres + var->lower_margin + var->vsync_len; + 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; */ double drate = 0, hrate = 0; int found_mode = 0; int old_mode; - 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 */ 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 */ vtotal <<= 2; - else if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) - var->yres <<= 1; - - if (!htotal || !vtotal) { - DPRINTK ("Invalid 'var' Information!\n"); + } 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 */ + } else vtotal = var->upper_margin + var->yres + var->lower_margin + + var->vsync_len; + + if (!(htotal) || !(vtotal)) { + DPRINTK("sisfb: Invalid 'var' information\n"); return -EINVAL; } @@ -481,19 +584,17 @@ static int sisfb_do_set_var (struct fb_var_screeninfo *var, int isactive, hrate = drate / htotal; ivideo.refresh_rate = (unsigned int) (hrate / vtotal * 2 + 0.5); - DPRINTK ("Chagne mode to %dx%dx%d-%dMHz\n", - var->xres, var->yres, var->bits_per_pixel, - ivideo.refresh_rate); + printk("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; sisfb_mode_idx = 0; - while ((sisbios_mode[sisfb_mode_idx].mode_no != 0) - && (sisbios_mode[sisfb_mode_idx].xres <= var->xres)) { - if ((sisbios_mode[sisfb_mode_idx].xres == var->xres) - && (sisbios_mode[sisfb_mode_idx].yres == var->yres) - && (sisbios_mode[sisfb_mode_idx].bpp == - var->bits_per_pixel)) { + while( (sisbios_mode[sisfb_mode_idx].mode_no != 0) && + (sisbios_mode[sisfb_mode_idx].xres <= var->xres) ) { + if( (sisbios_mode[sisfb_mode_idx].xres == var->xres) && + (sisbios_mode[sisfb_mode_idx].yres == var->yres) && + (sisbios_mode[sisfb_mode_idx].bpp == var->bits_per_pixel)) { sisfb_mode_no = sisbios_mode[sisfb_mode_idx].mode_no; found_mode = 1; break; @@ -502,83 +603,66 @@ static int sisfb_do_set_var (struct fb_var_screeninfo *var, int isactive, } if (found_mode) - sisfb_validate_mode (); + sisfb_validate_mode(); else sisfb_mode_idx = -1; - if (sisfb_mode_idx < 0) { - DPRINTK ("sisfb does not support mode %dx%d-%d\n", var->xres, - var->yres, var->bits_per_pixel); + if (sisfb_mode_idx < 0) { + printk("sisfb: Mode %dx%d-%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) { - sisfb_pre_setmode (); -// Eden Chen -/* -#ifdef CONFIG_FB_SIS_300 - if (SiSSetMode(&sishw_ext, sisfb_mode_no)) { - DPRINTK("set mode[0x%x]: failed\n", sisfb_mode_no); - return -1; - } -#endif + sisfb_pre_setmode(); -#ifdef CONFIG_FB_SIS_315 - if (SiSSetMode310(&sishw_ext, sisfb_mode_no)) { - DPRINTK("set mode[0x%x]: failed\n", sisfb_mode_no); + if (SiSSetMode(&sishw_ext, sisfb_mode_no) == 0) { + printk("sisfb: Setting mode[0x%x] failed\n", sisfb_mode_no); return -1; } -#endif -*/ - if (SiSSetMode (&sishw_ext, sisfb_mode_no) == 0) { - DPRINTK ("set mode[0x%x]: failed\n", sisfb_mode_no); - return -1; - } + vgawb(SEQ_ADR, IND_SIS_PASSWORD); + vgawb(SEQ_DATA, SIS_PASSWORD); - vgawb (SEQ_ADR, IND_SIS_PASSWORD); - vgawb (SEQ_DATA, SIS_PASSWORD); -// ~Eden Chen - sisfb_post_setmode (); + sisfb_post_setmode(); - DPRINTK ("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); + 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.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); - } 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_fix_screeninfo fix; struct display *display; struct display_switch *sw; - u32 flags; + long flags; if (con >= 0) display = &fb_display[con]; else - display = &disp; + display = &disp; - sisfb_get_fix (&fix, con, 0); + 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; @@ -590,139 +674,147 @@ static void sisfb_set_disp (int con, struct fb_var_screeninfo *var) display->inverse = sisfb_inverse; display->var = *var; - save_flags (flags); + save_flags(flags); switch (ivideo.video_bpp) { #ifdef FBCON_HAS_CFB8 - case 8: + case 8: sw = &fbcon_cfb8; break; #endif #ifdef FBCON_HAS_CFB16 - case 15: - case 16: + case 15: + case 16: sw = &fbcon_cfb16; display->dispsw_data = fbcon_cmap.cfb16; break; #endif #ifdef FBCON_HAS_CFB24 - case 24: + case 24: sw = &fbcon_cfb24; display->dispsw_data = fbcon_cmap.cfb24; break; #endif #ifdef FBCON_HAS_CFB32 - case 32: + case 32: sw = &fbcon_cfb32; display->dispsw_data = fbcon_cmap.cfb32; break; #endif - default: + default: sw = &fbcon_dummy; return; } - memcpy (&sisfb_sw, sw, sizeof (*sw)); + memcpy(&sisfb_sw, sw, sizeof(*sw)); display->dispsw = &sisfb_sw; - restore_flags (flags); + restore_flags(flags); display->scrollmode = SCROLL_YREDRAW; sisfb_sw.bmove = fbcon_redraw_bmove; } -static void sisfb_do_install_cmap (int con, struct fb_info *info) +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); + 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, + sisfb_setcolreg, info); +#endif + } + /* --------------- Chip-dependent Routines --------------------------- */ -#ifdef CONFIG_FB_SIS_300 /* for SiS 300/630/540/730 */ -static int sisfb_get_dram_size_300 (void) +#ifdef CONFIG_FB_SIS_300 /* for SiS 300/630/540/730 */ +static int sisfb_get_dram_size_300(void) { struct pci_dev *pdev = NULL; int pdev_valid = 0; - u8 pci_data, reg; + u8 pci_data, reg; u16 nbridge_id; switch (ivideo.chip) { - case SIS_540: + case SIS_540: nbridge_id = PCI_DEVICE_ID_SI_540; break; - case SIS_630: + case SIS_630: nbridge_id = PCI_DEVICE_ID_SI_630; break; - case SIS_730: + case SIS_730: nbridge_id = PCI_DEVICE_ID_SI_730; break; - default: + default: nbridge_id = 0; break; } - if (nbridge_id == 0) { - vgawb (SEQ_ADR, IND_SIS_DRAM_SIZE); + if (nbridge_id == 0) { /* 300 */ + vgawb(SEQ_ADR, IND_SIS_DRAM_SIZE); ivideo.video_size = - ((unsigned - int) ((vgarb (SEQ_DATA) & SIS_DRAM_SIZE_MASK) + 1) << 20); - } else { - pci_for_each_dev (pdev) { - if ((pdev->vendor == PCI_VENDOR_ID_SI) - && (pdev->device == nbridge_id)) { - //&& (pdev->device == PCI_DEVICE_ID_SI_630)) { - pci_read_config_byte (pdev, IND_BRI_DRAM_STATUS, - &pci_data); + ((unsigned int) ((vgarb(SEQ_DATA) & 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)) { + 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; - + reg = SIS_DATA_BUS_64 << 6; - vgawb (SEQ_ADR, IND_SIS_DRAM_SIZE); + vgawb(SEQ_ADR, IND_SIS_DRAM_SIZE); switch (pci_data) { - case BRI_DRAM_SIZE_2MB: + case BRI_DRAM_SIZE_2MB: reg |= SIS_DRAM_SIZE_2MB; break; - case BRI_DRAM_SIZE_4MB: + case BRI_DRAM_SIZE_4MB: reg |= SIS_DRAM_SIZE_4MB; break; - case BRI_DRAM_SIZE_8MB: + case BRI_DRAM_SIZE_8MB: reg |= SIS_DRAM_SIZE_8MB; break; - case BRI_DRAM_SIZE_16MB: + case BRI_DRAM_SIZE_16MB: reg |= SIS_DRAM_SIZE_16MB; break; - case BRI_DRAM_SIZE_32MB: + case BRI_DRAM_SIZE_32MB: reg |= SIS_DRAM_SIZE_32MB; break; - case BRI_DRAM_SIZE_64MB: + case BRI_DRAM_SIZE_64MB: reg |= SIS_DRAM_SIZE_64MB; break; } - vgawb (SEQ_DATA, reg); + vgawb(SEQ_DATA, reg); break; - } - } - + } + } + if (!pdev_valid) return -1; } - return 0; } -static void sisfb_detect_VB_connect_300(void) +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); + 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; if ((sr17 & 0x0F) && (ivideo.chip != SIS_300)) { @@ -735,25 +827,29 @@ static void sisfb_detect_VB_connect_300(void) sisfb_crt1off = 0; } - if (sr17 & 0x08) + if (sisfb_crt2type != -1) + /* TW: override detected CRT2 type */ + ivideo.disp_state = sisfb_crt2type; + else if (sr17 & 0x08 ) ivideo.disp_state = DISPTYPE_CRT2; else if (sr17 & 0x02) ivideo.disp_state = DISPTYPE_LCD; - else if (sr17 & 0x04) { + else if (sr17 & 0x04) ivideo.disp_state = DISPTYPE_TV; - 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); - if (sr16 & 0x20) - ivideo.TV_type = TVMODE_PAL; - else - ivideo.TV_type = TVMODE_NTSC; - } else + else ivideo.disp_state = 0; + + 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); + if (sr16 & 0x20) + ivideo.TV_type = TVMODE_PAL; + else + ivideo.TV_type = TVMODE_NTSC; } else { if ((cr32 & SIS_CRT1) && !sisfb_crt1off) sisfb_crt1off = 0; @@ -764,79 +860,97 @@ static void sisfb_detect_VB_connect_300(void) sisfb_crt1off = 0; } - if (cr32 & SIS_VB_CRT2) + if (sisfb_crt2type != -1) + /* TW: override detected CRT2 type */ + ivideo.disp_state = sisfb_crt2type; + else if (cr32 & SIS_VB_CRT2) ivideo.disp_state = DISPTYPE_CRT2; else if (cr32 & SIS_VB_LCD) ivideo.disp_state = DISPTYPE_LCD; - else if (cr32 & SIS_VB_TV) { + else if (cr32 & SIS_VB_TV) ivideo.disp_state = DISPTYPE_TV; - if (cr32 & SIS_VB_HIVISION) { - ivideo.TV_type = TVMODE_HIVISION; - ivideo.TV_plug = TVPLUG_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) { - // 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 - if (temp & 0x01) - ivideo.TV_type = TVMODE_PAL; - else - ivideo.TV_type = TVMODE_NTSC; - } - } else + else ivideo.disp_state = 0; + + /* TW: Detect TV plug & type anyway */ + if (cr32 & SIS_VB_HIVISION) { + ivideo.TV_type = TVMODE_HIVISION; + ivideo.TV_plug = TVPLUG_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) { + // 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 + 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); + } } -static void sisfb_get_VB_type_300 (void) +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 (!sisfb_has_VB_300()) { + vgawb(CRTC_ADR, IND_SIS_SCRATCH_REG_CR37); + reg = vgarb(CRTC_DATA); switch ((reg & SIS_EXTERNAL_CHIP_MASK) >> 1) { - case SIS_EXTERNAL_CHIP_SIS301: + case SIS_EXTERNAL_CHIP_SIS301: ivideo.hasVB = HASVB_301; break; - case SIS_EXTERNAL_CHIP_LVDS: + case SIS_EXTERNAL_CHIP_LVDS: ivideo.hasVB = HASVB_LVDS; break; - case SIS_EXTERNAL_CHIP_TRUMPION: + case SIS_EXTERNAL_CHIP_TRUMPION: ivideo.hasVB = HASVB_TRUMPION; break; - case SIS_EXTERNAL_CHIP_LVDS_CHRONTEL: + case SIS_EXTERNAL_CHIP_LVDS_CHRONTEL: ivideo.hasVB = HASVB_LVDS_CHRONTEL; break; - case SIS_EXTERNAL_CHIP_CHRONTEL: + case SIS_EXTERNAL_CHIP_CHRONTEL: ivideo.hasVB = HASVB_CHRONTEL; break; - default: + default: break; } } } else { - sisfb_has_VB_300 (); + sisfb_has_VB_300(); } - - //sishw_ext.hasVB = ivideo.hasVB; } -static int sisfb_has_VB_300 (void) +static int sisfb_has_VB_300(void) { // Eden Chen //u8 sr38, sr39, vb_chipid; @@ -846,146 +960,201 @@ static int sisfb_has_VB_300 (void) //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); + vgawb(VB_PART4_ADR, 0x0); + vb_chipid = vgarb(VB_PART4_DATA); switch (vb_chipid) { - case 0x01: + case 0x01: ivideo.hasVB = HASVB_301; break; - case 0x02: + case 0x02: ivideo.hasVB = HASVB_302; break; - case 0x03: + case 0x03: ivideo.hasVB = HASVB_303; break; - default: + default: ivideo.hasVB = HASVB_NONE; return FALSE; } return TRUE; -} -#endif /* CONFIG_FB_SIS_300 */ + //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; + //} -#ifdef CONFIG_FB_SIS_315 /* for SiS 315H/315 */ -static int sisfb_get_dram_size_315 (void) + // ~Eden Chen +} +#endif /* CONFIG_FB_SIS_300 */ + +#ifdef CONFIG_FB_SIS_315 /* for SiS 315/550/650/740 */ +static int sisfb_get_dram_size_315(void) { -#ifdef LINUXBIOS struct pci_dev *pdev = NULL; int pdev_valid = 0; - u8 pci_data; -#endif - u8 reg = 0; + u8 pci_data; + u8 reg = 0; - if (ivideo.chip == SIS_550) { + if (ivideo.chip == SIS_550 || ivideo.chip == SIS_650) { #ifdef LINUXBIOS - 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_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))) { + 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)); + (unsigned int)(1 << (pci_data+21)); pdev_valid = 1; - vgawb (SEQ_ADR, IND_SIS_DRAM_SIZE); - reg = vgarb (SEQ_DATA) & 0xC0; + /* TW: Initialize SR14 "by hand" */ + vgawb(SEQ_ADR, IND_SIS_DRAM_SIZE); + reg = vgarb(SEQ_DATA) & 0xC0; switch (pci_data) { - //case BRI_DRAM_SIZE_2MB: - // reg |= (SIS315_DRAM_SIZE_2MB << 4); break; - case BRI_DRAM_SIZE_4MB: + //case BRI_DRAM_SIZE_2MB: + // reg |= (SIS315_DRAM_SIZE_2MB << 4); break; + case BRI_DRAM_SIZE_4MB: reg |= SIS550_DRAM_SIZE_4MB; break; - case BRI_DRAM_SIZE_8MB: + case BRI_DRAM_SIZE_8MB: reg |= SIS550_DRAM_SIZE_8MB; break; - case BRI_DRAM_SIZE_16MB: + case BRI_DRAM_SIZE_16MB: reg |= SIS550_DRAM_SIZE_16MB; break; - case BRI_DRAM_SIZE_32MB: + case BRI_DRAM_SIZE_32MB: reg |= SIS550_DRAM_SIZE_32MB; break; - case BRI_DRAM_SIZE_64MB: + case BRI_DRAM_SIZE_64MB: reg |= SIS550_DRAM_SIZE_64MB; break; - /* case BRI_DRAM_SIZE_128MB: - reg |= (SIS315_DRAM_SIZE_128MB << 4); 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); + vgawb(SEQ_DATA, reg); break; - } + } } - + if (!pdev_valid) return -1; #else - vgawb (SEQ_ADR, IND_SIS_DRAM_SIZE); - reg = vgarb (SEQ_DATA); + vgawb(SEQ_ADR, IND_SIS_DRAM_SIZE); + reg = vgarb(SEQ_DATA); switch (reg & SIS550_DRAM_SIZE_MASK) { - case SIS550_DRAM_SIZE_4MB: - ivideo.video_size = 0x400000; - break; - case SIS550_DRAM_SIZE_8MB: - ivideo.video_size = 0x800000; - break; - case SIS550_DRAM_SIZE_16MB: - ivideo.video_size = 0x1000000; - break; - case SIS550_DRAM_SIZE_24MB: - ivideo.video_size = 0x1800000; - break; - case SIS550_DRAM_SIZE_32MB: - ivideo.video_size = 0x2000000; - break; - case SIS550_DRAM_SIZE_64MB: - ivideo.video_size = 0x4000000; - break; - case SIS550_DRAM_SIZE_96MB: - ivideo.video_size = 0x6000000; - break; - case SIS550_DRAM_SIZE_128MB: - ivideo.video_size = 0x8000000; - break; - case SIS550_DRAM_SIZE_256MB: - ivideo.video_size = 0x10000000; - break; - default: - return -1; + case SIS550_DRAM_SIZE_4MB: + ivideo.video_size = 0x400000; break; + case SIS550_DRAM_SIZE_8MB: + ivideo.video_size = 0x800000; break; + case SIS550_DRAM_SIZE_16MB: + ivideo.video_size = 0x1000000; break; + case SIS550_DRAM_SIZE_24MB: + ivideo.video_size = 0x1800000; break; + case SIS550_DRAM_SIZE_32MB: + ivideo.video_size = 0x2000000; break; + case SIS550_DRAM_SIZE_64MB: + ivideo.video_size = 0x4000000; break; + case SIS550_DRAM_SIZE_96MB: + ivideo.video_size = 0x6000000; break; + case SIS550_DRAM_SIZE_128MB: + ivideo.video_size = 0x8000000; break; + case SIS550_DRAM_SIZE_256MB: + ivideo.video_size = 0x10000000; break; + default: + /* TW: Some 550 BIOSes don't seem to initialize SR14 correctly (if at all), + * do it the hard way ourselves in this case. Unfortunately, we don't + * support 24, 48, 96 and other "odd" amounts here. + */ + printk(KERN_INFO + "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; + switch (pci_data) { + case BRI_DRAM_SIZE_4MB: + reg |= SIS550_DRAM_SIZE_4MB; break; + case BRI_DRAM_SIZE_8MB: + reg |= SIS550_DRAM_SIZE_8MB; break; + case BRI_DRAM_SIZE_16MB: + reg |= SIS550_DRAM_SIZE_16MB; break; + case BRI_DRAM_SIZE_32MB: + 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); + } + } + if (!pdev_valid) { + printk(KERN_INFO "sisfb: Total confusion - No SiS PCI VGA device found?!\n"); + return -1; + } + return 0; } #endif return 0; - } else { - vgawb (SEQ_ADR, IND_SIS_DRAM_SIZE); - reg = vgarb (SEQ_DATA); + } else { /* 315 */ + vgawb(SEQ_ADR, IND_SIS_DRAM_SIZE); + reg = vgarb(SEQ_DATA); switch ((reg & SIS315_DRAM_SIZE_MASK) >> 4) { - case SIS315_DRAM_SIZE_2MB: + case SIS315_DRAM_SIZE_2MB: ivideo.video_size = 0x200000; break; - case SIS315_DRAM_SIZE_4MB: + case SIS315_DRAM_SIZE_4MB: ivideo.video_size = 0x400000; break; - case SIS315_DRAM_SIZE_8MB: + case SIS315_DRAM_SIZE_8MB: ivideo.video_size = 0x800000; break; - case SIS315_DRAM_SIZE_16MB: + case SIS315_DRAM_SIZE_16MB: ivideo.video_size = 0x1000000; break; - case SIS315_DRAM_SIZE_32MB: + case SIS315_DRAM_SIZE_32MB: ivideo.video_size = 0x2000000; break; - case SIS315_DRAM_SIZE_64MB: + case SIS315_DRAM_SIZE_64MB: ivideo.video_size = 0x4000000; break; - case SIS315_DRAM_SIZE_128MB: + case SIS315_DRAM_SIZE_128MB: ivideo.video_size = 0x8000000; break; - default: + default: return -1; } } @@ -993,209 +1162,318 @@ static int sisfb_get_dram_size_315 (void) reg &= SIS315_DUAL_CHANNEL_MASK; reg >>= 2; switch (reg) { - case SIS315_SINGLE_CHANNEL_2_RANK: + case SIS315_SINGLE_CHANNEL_2_RANK: ivideo.video_size <<= 1; break; - case SIS315_DUAL_CHANNEL_1_RANK: + 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; } -static void sisfb_detect_VB_connect_315 (void) +static void sisfb_detect_VB_connect_315(void) { - u8 cr32, temp; + u8 sr17, cr32, temp; - vgawb (CRTC_ADR, IND_SIS_SCRATCH_REG_CR32); - cr32 = vgarb (CRTC_DATA); + vgawb(CRTC_ADR, IND_SIS_SCRATCH_REG_CR32); + cr32 = vgarb(CRTC_DATA); ivideo.TV_plug = ivideo.TV_type = 0; if ((cr32 & SIS_CRT1) && !sisfb_crt1off) sisfb_crt1off = 0; else { - if (cr32 & 0x5F) + if (cr32 & 0x5F) sisfb_crt1off = 1; else sisfb_crt1off = 0; } - if (cr32 & SIS_VB_CRT2) + if (sisfb_crt2type != -1) + /* TW: Override with option */ + ivideo.disp_state = sisfb_crt2type; + else if (cr32 & SIS_VB_CRT2) ivideo.disp_state = DISPTYPE_CRT2; else if (cr32 & SIS_VB_LCD) ivideo.disp_state = DISPTYPE_LCD; - else if (cr32 & SIS_VB_TV) { + else if (cr32 & SIS_VB_TV) ivideo.disp_state = DISPTYPE_TV; + else + ivideo.disp_state = 0; - if (cr32 & SIS_VB_HIVISION) { - ivideo.TV_type = TVMODE_HIVISION; - ivideo.TV_plug = TVPLUG_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 (cr32 & SIS_VB_HIVISION) { + ivideo.TV_type = TVMODE_HIVISION; + ivideo.TV_plug = TVPLUG_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) + ivideo.TV_type = TVMODE_PAL; + else + ivideo.TV_type = TVMODE_NTSC; + } else { + vgawb(CRTC_ADR, 0x79); + temp = vgarb(CRTC_DATA); + if (temp & 0x20) + ivideo.TV_type = TVMODE_PAL; + else + ivideo.TV_type = TVMODE_NTSC; + } + } - if (ivideo.TV_type == 0) { - vgawb (SEQ_ADR, IND_SIS_POWER_ON_TRAP); - temp = vgarb (SEQ_DATA); + /* 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 (temp & 0x01) - ivideo.TV_type = TVMODE_PAL; - else - ivideo.TV_type = TVMODE_NTSC; +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; + } } - } else - ivideo.disp_state = 0; } -static void sisfb_get_VB_type_315 (void) + +static int sisfb_has_VB_315(void) { u8 vb_chipid; - vgawb (VB_PART4_ADR, 0x0); - vb_chipid = vgarb (VB_PART4_DATA); + vgawb(VB_PART4_ADR, 0x00); + vb_chipid = vgarb(VB_PART4_DATA); switch (vb_chipid) { - case 0x01: + case 0x01: ivideo.hasVB = HASVB_301; break; - case 0x02: + case 0x02: ivideo.hasVB = HASVB_302; break; - case 0x03: + case 0x03: ivideo.hasVB = HASVB_303; break; - default: + default: ivideo.hasVB = HASVB_NONE; + return FALSE; } - // Eden Chen - //sishw_ext.hasVB = ivideo.hasVB; - // ~Eden Chen + return TRUE; } -#endif /* CONFIG_FB_SIS_315 */ + +#endif /* CONFIG_FB_SIS_315 */ /* --------------------- Heap Routines ------------------------------- */ -static int sisfb_heap_init (void) +static int sisfb_heap_init(void) { SIS_OH *poh; - u8 temp = 0; + u8 temp=0; #ifdef CONFIG_FB_SIS_315 - int agp_enabled = 1; - u32 agp_size; + int agp_enabled = 1; + u32 agp_size; unsigned long *cmdq_baseport = 0; unsigned long *read_port = 0; unsigned long *write_port = 0; - SIS_CMDTYPE cmd_type; + SIS_CMDTYPE cmd_type; #ifndef AGPOFF - agp_kern_info *agp_info; - agp_memory *agp; - u32 agp_phys; + agp_kern_info *agp_info; + agp_memory *agp; + u32 agp_phys; #endif #endif - /*karl:10/01/2001 */ - if (!sisfb_mem) { - - if (ivideo.video_size > 0x800000) - sisfb_heap_start = - (unsigned long) ivideo.video_vbase + 0x800000; - else - sisfb_heap_start = - (unsigned long) ivideo.video_vbase + 0x400000; - } else - sisfb_heap_start = - (unsigned long) (ivideo.video_vbase + sisfb_mem * 0x100000); +/* TW: The heap start is either set manually using the "mem" parameter, or + * defaults as follows: + * -) If more than 16MB videoRAM available, let our heap start at 12MB. + * -) If more than 8MB videoRAM available, let our heap start at 8MB. + * -) If 4MB or less is available, let it start at 4MB. + * This is for avoiding a clash with X driver which uses the beginning + * of the videoRAM. To limit size of X framebuffer, use Option MaxXFBMem + * in XF86Config-4. + * The heap start can also be specified by parameter "mem" when starting the sisfb + * driver. sisfb mem=1024 lets heap starts at 1MB, etc. + */ + if ((!sisfb_mem) || (sisfb_mem > (ivideo.video_size/1024))) { + if (ivideo.video_size > 0x1000000) { + ivideo.heapstart = 0xc00000; + } else if (ivideo.video_size > 0x800000) { + ivideo.heapstart = 0x800000; + } else { + ivideo.heapstart = 0x400000; + } + } else { + ivideo.heapstart = sisfb_mem * 1024; + } + sisfb_heap_start = + (unsigned long) (ivideo.video_vbase + ivideo.heapstart); + printk(KERN_INFO "sisfb: Memory heap starting at %dK\n", + (int)(ivideo.heapstart / 1024)); - sisfb_heap_end = (unsigned long) ivideo.video_vbase + ivideo.video_size; - sisfb_heap_size = sisfb_heap_end - sisfb_heap_start; + sisfb_heap_end = (unsigned long) ivideo.video_vbase + ivideo.video_size; + sisfb_heap_size = sisfb_heap_end - sisfb_heap_start; #ifdef CONFIG_FB_SIS_315 - - cmdq_baseport = - (unsigned long *) (ivideo.mmio_vbase + MMIO_QUEUE_PHYBASE); - write_port = - (unsigned long *) (ivideo.mmio_vbase + MMIO_QUEUE_WRITEPORT); - read_port = (unsigned long *) (ivideo.mmio_vbase + MMIO_QUEUE_READPORT); - - DPRINTK ("AGP base: 0x%p, read: 0x%p, write: 0x%p\n", cmdq_baseport, - read_port, write_port); - - agp_size = COMMAND_QUEUE_AREA_SIZE; + 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: + * 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. + * 2. VRAM queue mode (bit 6, 0x40). In this case, one will + * have to do queue management himself. Register 0x85c4 will + * hold the location of the next free queue slot, 0x85c8 + * is the "queue read pointer" whose way of working is + * unknown to me. Anyway, this mode would require a + * translation of the MMIO commands to some kind of + * accelerator assembly and writing these commands + * to the memory location pointed to by 0x85c4. + * We will not use this, as nobody knows how this + * "assembly" works, and as it would require a complete + * re-write of the accelerator code. + * 3. AGP queue mode (bit 7, 0x80). Works as 2., but keeps the + * queue in AGP memory space. + * + * SR26 bit 4 is called "Bypass H/W queue". + * SR26 bit 1 is called "Enable Command Queue Auto Correction" + * SR26 bit 0 resets the queue + * Size of queue memory is encoded in bits 3:2 like this: + * 00 (0x00) 512K + * 01 (0x04) 1M + * 10 (0x08) 2M + * 11 (0x0C) 4M + * The queue location is to be written to 0x85C0. + * + */ + cmdq_baseport = (unsigned long *)(ivideo.mmio_vbase + MMIO_QUEUE_PHYBASE); + write_port = (unsigned long *)(ivideo.mmio_vbase + MMIO_QUEUE_WRITEPORT); + read_port = (unsigned long *)(ivideo.mmio_vbase + MMIO_QUEUE_READPORT); + + DPRINTK("AGP base: 0x%p, read: 0x%p, write: 0x%p\n", cmdq_baseport, read_port, write_port); + + agp_size = COMMAND_QUEUE_AREA_SIZE; #ifndef AGPOFF + if (sisfb_queuemode == AGP_CMD_QUEUE) { + agp_info = vmalloc(sizeof(agp_kern_info)); + memset((void*)agp_info, 0x00, sizeof(agp_kern_info)); + agp_copy_info(agp_info); - agp_info = vmalloc (sizeof (agp_kern_info)); - memset ((void *) agp_info, 0x00, sizeof (agp_kern_info)); - agp_copy_info (agp_info); - - agp_backend_acquire (); + agp_backend_acquire(); - agp = - agp_allocate_memory (COMMAND_QUEUE_AREA_SIZE / PAGE_SIZE, - AGP_NORMAL_MEMORY); - if (agp == NULL) { - DPRINTK ("Allocate AGP buffer failed.\n"); - agp_enabled = 0; - } else { - if (agp_bind_memory (agp, agp->pg_start) != 0) { - DPRINTK ("AGP : can not bind memory\n"); + agp = agp_allocate_memory(COMMAND_QUEUE_AREA_SIZE/PAGE_SIZE, + AGP_NORMAL_MEMORY); + if (agp == NULL) { + DPRINTK("sisfb: Allocating AGP buffer failed.\n"); agp_enabled = 0; } else { - agp_enable (0); + if (agp_bind_memory(agp, agp->pg_start) != 0) { + DPRINTK("sisfb: AGP: Failed to bind memory\n"); + /* TODO: Free AGP memory here */ + agp_enabled = 0; + } else { + agp_enable(0); + } } } - #else - agp_enabled = 0; + agp_enabled= 0; #endif - if (agp_enabled) + + /* TW: Now select the queue mode */ + + if ((agp_enabled) && (sisfb_queuemode == AGP_CMD_QUEUE)) { cmd_type = AGP_CMD_QUEUE; - else if (sisfb_heap_size >= COMMAND_QUEUE_AREA_SIZE) + printk(KERN_INFO "sisfb: Using AGP queue mode\n"); +/* } else if (sisfb_heap_size >= COMMAND_QUEUE_AREA_SIZE) */ + } else if (sisfb_queuemode == VM_CMD_QUEUE) { cmd_type = VM_CMD_QUEUE; - else + printk(KERN_INFO "sisfb: Using VRAM queue mode\n"); + } else { + printk(KERN_INFO "sisfb: Using MMIO queue mode\n"); cmd_type = MMIO_CMD; + } switch (agp_size) { - case 0x80000: + case 0x80000: temp = SIS_CMD_QUEUE_SIZE_512k; break; - case 0x100000: + case 0x100000: temp = SIS_CMD_QUEUE_SIZE_1M; break; - case 0x200000: + case 0x200000: temp = SIS_CMD_QUEUE_SIZE_2M; break; - case 0x400000: + case 0x400000: temp = SIS_CMD_QUEUE_SIZE_4M; break; } switch (cmd_type) { - case AGP_CMD_QUEUE: + case AGP_CMD_QUEUE: #ifndef AGPOFF - DPRINTK ("AGP buffer base:0x%lx, offset:0x%x, size is %dK\n", - agp_info->aper_base, agp->physical, agp_size / 1024); + 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); + vgawb(CRTC_ADR, IND_SIS_AGP_IO_PAD); + vgawb(CRTC_DATA, 0); + vgawb(CRTC_DATA, SIS_AGP_2X); - vgawb (SEQ_ADR, IND_SIS_CMDQUEUE_THRESHOLD); - vgawb (SEQ_DATA, COMMAND_QUEUE_THRESHOLD); + 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); + vgawb(SEQ_ADR, IND_SIS_CMDQUEUE_SET); + vgawb(SEQ_DATA, SIS_CMD_QUEUE_RESET); *write_port = *read_port; temp |= SIS_AGP_CMDQUEUE_ENABLE; - vgawb (SEQ_ADR, IND_SIS_CMDQUEUE_SET); - vgawb (SEQ_DATA, temp); + vgawb(SEQ_ADR, IND_SIS_CMDQUEUE_SET); + vgawb(SEQ_DATA, temp); *cmdq_baseport = agp_phys; @@ -1203,94 +1481,124 @@ static int sisfb_heap_init (void) #endif break; - case VM_CMD_QUEUE: + case VM_CMD_QUEUE: 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_THRESHOLD); + vgawb(SEQ_DATA, COMMAND_QUEUE_THRESHOLD); - vgawb (SEQ_ADR, IND_SIS_CMDQUEUE_SET); - vgawb (SEQ_DATA, SIS_CMD_QUEUE_RESET); + vgawb(SEQ_ADR, IND_SIS_CMDQUEUE_SET); + vgawb(SEQ_DATA, SIS_CMD_QUEUE_RESET); *write_port = *read_port; temp |= SIS_VRAM_CMDQUEUE_ENABLE; - vgawb (SEQ_ADR, IND_SIS_CMDQUEUE_SET); - vgawb (SEQ_DATA, temp); + vgawb(SEQ_ADR, IND_SIS_CMDQUEUE_SET); + vgawb(SEQ_DATA, temp); *cmdq_baseport = ivideo.video_size - COMMAND_QUEUE_AREA_SIZE; sisfb_caps |= VM_CMD_QUEUE_CAP; - DPRINTK ("VM Cmd Queue offset = 0x%lx, size is %dK\n", - *cmdq_baseport, COMMAND_QUEUE_AREA_SIZE / 1024); + DPRINTK("sisfb: VM Cmd Queue offset = 0x%lx, size is %dK\n", + *cmdq_baseport, COMMAND_QUEUE_AREA_SIZE/1024); break; - default: - vgawb (SEQ_ADR, IND_SIS_CMDQUEUE_SET); - vgawb (SEQ_DATA, SIS_MMIO_CMD_ENABLE); + + default: /* MMIO */ + /* TW: This previously only wrote SIS_MMIO_CMD_ENABLE + * to IND_SIS_CMDQUEUE_SET. I doubt that this is + * enough. Reserve memory in any way. + */ + 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); + + *write_port = *read_port; + + /* TW: Set Auto_Correction bit; this works in sisfb lite, + * so why not. + */ + temp |= (SIS_MMIO_CMD_ENABLE | SIS_CMD_AUTO_CORR); + vgawb(SEQ_ADR, IND_SIS_CMDQUEUE_SET); + vgawb(SEQ_DATA, temp); + + *cmdq_baseport = ivideo.video_size - COMMAND_QUEUE_AREA_SIZE; + + DPRINTK("sisfb: MMIO Cmd Queue offset = 0x%lx, size is %dK\n", + *cmdq_baseport, COMMAND_QUEUE_AREA_SIZE/1024); break; } - + } /* sisvga_engine = 315 */ #endif #ifdef CONFIG_FB_SIS_300 - if (sisfb_heap_size >= TURBO_QUEUE_AREA_SIZE) { - unsigned int tqueue_pos; + if (sisvga_engine == SIS_300_VGA) { + /* TW: Now initialize TurboQueue. TB is always located at the very + * top of the video RAM. */ + if (sisfb_heap_size >= TURBO_QUEUE_AREA_SIZE) { + unsigned int tqueue_pos; u8 tq_state; - tqueue_pos = - (ivideo.video_size - TURBO_QUEUE_AREA_SIZE) / (64 * 1024); + 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); + vgawb(SEQ_ADR, IND_SIS_TURBOQUEUE_SET); + tq_state = vgarb(SEQ_DATA); 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); + vgawb(SEQ_DATA, tq_state); + vgawb(SEQ_ADR, IND_SIS_TURBOQUEUE_ADR); + vgawb(SEQ_DATA, temp); sisfb_caps |= TURBO_QUEUE_CAP; sisfb_heap_end -= TURBO_QUEUE_AREA_SIZE; sisfb_heap_size -= TURBO_QUEUE_AREA_SIZE; - DPRINTK ("Turbo Queue: start at 0x%lx, size is %dK\n", - sisfb_heap_end, TURBO_QUEUE_AREA_SIZE / 1024); - } + DPRINTK("sisfb: TurboQueue start at 0x%lx, size is %dK\n", + sisfb_heap_end, TURBO_QUEUE_AREA_SIZE/1024); + } + } #endif - - if (sisfb_heap_size >= HW_CURSOR_AREA_SIZE) { - sisfb_heap_end -= HW_CURSOR_AREA_SIZE; - sisfb_heap_size -= HW_CURSOR_AREA_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; sisfb_caps |= HW_CURSOR_CAP; - DPRINTK ("Hardware Cursor: start at 0x%lx, size is %dK\n", - sisfb_heap_end, HW_CURSOR_AREA_SIZE / 1024); + 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; - poh = sisfb_poh_new_node (); + poh = sisfb_poh_new_node(); 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; - 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", - (unsigned int) poh->offset, (unsigned int) poh->size / 1024); + 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", + (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; @@ -1303,7 +1611,7 @@ static int sisfb_heap_init (void) return 0; } -static SIS_OH *sisfb_poh_new_node (void) +static SIS_OH *sisfb_poh_new_node(void) { int i; unsigned long cOhs; @@ -1311,14 +1619,16 @@ static SIS_OH *sisfb_poh_new_node (void) SIS_OH *poh; if (sisfb_heap.poh_freelist == NULL) { - poha = kmalloc (OH_ALLOC_SIZE, GFP_KERNEL); + poha = kmalloc(OH_ALLOC_SIZE, GFP_KERNEL); + 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; + sizeof(SIS_OHALLOC)) / sizeof(SIS_OH) + 1; poh = &poha->aoh[0]; for (i = cOhs - 1; i != 0; i--) { @@ -1336,15 +1646,15 @@ static SIS_OH *sisfb_poh_new_node (void) return (poh); } -static SIS_OH *sisfb_poh_allocate (unsigned long size) +static SIS_OH *sisfb_poh_allocate(unsigned long size) { SIS_OH *pohThis; SIS_OH *pohRoot; int bAllocated = 0; if (size > sisfb_heap.max_freesize) { - DPRINTK ("sisfb: Can't allocate %dk size on offscreen\n", - (unsigned int) size / 1024); + DPRINTK("sisfb: Can't allocate %dk size on offscreen\n", + (unsigned int) size / 1024); return (NULL); } @@ -1359,16 +1669,16 @@ static SIS_OH *sisfb_poh_allocate (unsigned long size) } if (!bAllocated) { - DPRINTK ("sisfb: Can't allocate %dk size on offscreen\n", - (unsigned int) size / 1024); + DPRINTK("sisfb: Can't allocate %dk size on offscreen\n", + (unsigned int) size / 1024); return (NULL); } if (size == pohThis->size) { pohRoot = pohThis; - sisfb_delete_node (pohThis); + sisfb_delete_node(pohThis); } else { - pohRoot = sisfb_poh_new_node (); + pohRoot = sisfb_poh_new_node(); if (pohRoot == NULL) { return (NULL); @@ -1384,16 +1694,17 @@ static SIS_OH *sisfb_poh_allocate (unsigned long size) sisfb_heap.max_freesize -= size; pohThis = &sisfb_heap.oh_used; - sisfb_insert_node (pohThis, pohRoot); + sisfb_insert_node(pohThis, pohRoot); return (pohRoot); } -static void sisfb_delete_node (SIS_OH * poh) +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; @@ -1403,7 +1714,7 @@ static void sisfb_delete_node (SIS_OH * poh) return; } -static void sisfb_insert_node (SIS_OH * pohList, SIS_OH * poh) +static void sisfb_insert_node(SIS_OH *pohList, SIS_OH *poh) { SIS_OH *pohTemp; @@ -1416,9 +1727,8 @@ static void sisfb_insert_node (SIS_OH * pohList, SIS_OH * poh) poh->poh_next = pohTemp; } -static SIS_OH *sisfb_poh_free (unsigned long base) +static SIS_OH *sisfb_poh_free(unsigned long base) { - SIS_OH *pohThis; SIS_OH *poh_freed; SIS_OH *poh_prev; @@ -1452,41 +1762,43 @@ static SIS_OH *sisfb_poh_free (unsigned long base) while (pohThis != &sisfb_heap.oh_free) { if (pohThis->offset == ulUpper) { poh_next = pohThis; - } else if ((pohThis->offset + pohThis->size) == ulLower) { + } + else if ((pohThis->offset + pohThis->size) == + ulLower) { poh_prev = pohThis; } pohThis = pohThis->poh_next; } - sisfb_delete_node (poh_freed); + sisfb_delete_node(poh_freed); if (poh_prev && poh_next) { poh_prev->size += (poh_freed->size + poh_next->size); - sisfb_delete_node (poh_next); - sisfb_free_node (poh_freed); - sisfb_free_node (poh_next); + sisfb_delete_node(poh_next); + sisfb_free_node(poh_freed); + sisfb_free_node(poh_next); return (poh_prev); } if (poh_prev) { poh_prev->size += poh_freed->size; - sisfb_free_node (poh_freed); + sisfb_free_node(poh_freed); return (poh_prev); } if (poh_next) { poh_next->size += poh_freed->size; poh_next->offset = poh_freed->offset; - sisfb_free_node (poh_freed); + sisfb_free_node(poh_freed); return (poh_next); } - sisfb_insert_node (&sisfb_heap.oh_free, poh_freed); + sisfb_insert_node(&sisfb_heap.oh_free, poh_freed); return (poh_freed); } -static void sisfb_free_node (SIS_OH * poh) +static void sisfb_free_node(SIS_OH *poh) { if (poh == NULL) { return; @@ -1498,20 +1810,20 @@ static void sisfb_free_node (SIS_OH * poh) return; } -void sis_malloc (struct sis_memreq *req) +void sis_malloc(struct sis_memreq *req) { SIS_OH *poh; - poh = sisfb_poh_allocate (req->size); + poh = sisfb_poh_allocate(req->size); if (poh == NULL) { req->offset = 0; req->size = 0; - DPRINTK ("sisfb: VMEM Allocation Failed\n"); + DPRINTK("sisfb: Video RAM allocation failed\n"); } else { - DPRINTK ("sisfb: VMEM Allocation Successed : 0x%p\n", - (char *) (poh->offset + - (unsigned long) ivideo.video_vbase)); + DPRINTK("sisfb: Video RAM allocation succeeded: 0x%p\n", + (char *) (poh->offset + + (unsigned long) ivideo.video_vbase)); req->offset = poh->offset; req->size = poh->size; @@ -1519,280 +1831,294 @@ void sis_malloc (struct sis_memreq *req) } -void sis_free (unsigned long base) +void sis_free(unsigned long base) { SIS_OH *poh; - poh = sisfb_poh_free (base); + poh = sisfb_poh_free(base); if (poh == NULL) { - DPRINTK ("sisfb: sisfb_poh_free() failed at base 0x%x\n", - (unsigned int) base); + DPRINTK("sisfb: sisfb_poh_free() failed at base 0x%x\n", + (unsigned int) base); } } /* ------------------ SetMode Routines ------------------------------- */ -static void sisfb_pre_setmode (void) +static void sisfb_pre_setmode(void) { u8 cr30 = 0, cr31 = 0; - vgawb (CRTC_ADR, 0x31); - cr31 = vgarb (CRTC_DATA) & ~0x60; + vgawb(CRTC_ADR, 0x31); + cr31 = vgarb(CRTC_DATA) & ~0x60; switch (ivideo.disp_state & DISPTYPE_DISP2) { - case DISPTYPE_CRT2: + 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: - cr30 = (SIS_VB_OUTPUT_LCD | SIS_SIMULTANEOUS_VIEW_ENABLE); + 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: + 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); + cr30 = (SIS_VB_OUTPUT_HIVISION | SIS_SIMULTANEOUS_VIEW_ENABLE); else if (ivideo.TV_plug == TVPLUG_SVIDEO) - cr30 = - (SIS_VB_OUTPUT_SVIDEO | - SIS_SIMULTANEOUS_VIEW_ENABLE); + cr30 = (SIS_VB_OUTPUT_SVIDEO | SIS_SIMULTANEOUS_VIEW_ENABLE); else if (ivideo.TV_plug == TVPLUG_COMPOSITE) - cr30 = - (SIS_VB_OUTPUT_COMPOSITE | - SIS_SIMULTANEOUS_VIEW_ENABLE); + cr30 = (SIS_VB_OUTPUT_COMPOSITE | SIS_SIMULTANEOUS_VIEW_ENABLE); else if (ivideo.TV_plug == TVPLUG_SCART) - cr30 = - (SIS_VB_OUTPUT_SCART | - SIS_SIMULTANEOUS_VIEW_ENABLE); + cr30 = (SIS_VB_OUTPUT_SCART | SIS_SIMULTANEOUS_VIEW_ENABLE); cr31 |= SIS_DRIVER_MODE; - - /*karl */ - if (sisfb_tvmode == 1) + /* 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) - cr31 &= ~0x1; - + if (sisfb_tvmode == 2 || ivideo.TV_type == TVMODE_NTSC) + cr31 &= ~0x1; break; - default: + default: /* CRT2 disable */ + printk(KERN_INFO "sisfb: CRT2 is disabled\n"); 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); - vgawb (CRTC_ADR, IND_SIS_SCRATCH_REG_CR33); - vgawb (CRTC_DATA, sisfb_rate_idx & 0x0F); + vgawb(CRTC_ADR, IND_SIS_SCRATCH_REG_CR30); + vgawb(CRTC_DATA, cr30); + vgawb(CRTC_ADR, IND_SIS_SCRATCH_REG_CR31); + vgawb(CRTC_DATA, 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); } -static void sisfb_post_setmode (void) +static void sisfb_post_setmode(void) { u8 reg; - vgawb (CRTC_ADR, 0x17); - reg = vgarb (CRTC_DATA); + /* 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; + } + } - if ((ivideo.hasVB == HASVB_LVDS) - || (ivideo.hasVB == HASVB_LVDS_CHRONTEL)) if (ivideo.video_bpp == 8) + /* 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 (sisfb_crt1off) + /* 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(sisvga_engine == SIS_315_VGA) { + if((reg & 0x50) == 0x10) { + sisfb_crt1off = 0; + } + } + + vgawb(CRTC_ADR, 0x17); + reg = vgarb(CRTC_DATA); + if (sisfb_crt1off) reg &= ~0x80; - else + else reg |= 0x80; - vgawb (CRTC_DATA, reg); - - vgawb (SEQ_ADR, IND_SIS_RAMDAC_CONTROL); - reg = vgarb (SEQ_DATA); + vgawb(CRTC_DATA, reg); + + vgawb(SEQ_ADR, IND_SIS_RAMDAC_CONTROL); + reg = vgarb(SEQ_DATA); reg &= ~0x04; - vgawb (SEQ_DATA, reg); + vgawb(SEQ_DATA, reg); if ((ivideo.disp_state & DISPTYPE_TV) && (ivideo.hasVB == HASVB_301)) { - /*karl */ - vgawb (VB_PART4_ADR, 0x01); - reg = vgarb (VB_PART4_DATA); - - if ((reg != 0xB1) && (reg != 0xB0)) { /*301B Revision ID */ - // Eden Chen - switch (ivideo.video_width) { - case 320: - filter_tb = - (ivideo.TV_type == TVMODE_NTSC) ? 4 : 12; - break; - case 640: - filter_tb = - (ivideo.TV_type == TVMODE_NTSC) ? 5 : 13; - break; - case 720: - filter_tb = - (ivideo.TV_type == TVMODE_NTSC) ? 6 : 14; - break; - case 800: - filter_tb = - (ivideo.TV_type == TVMODE_NTSC) ? 7 : 15; - break; - default: - filter = -1; - break; - } - // ~Eden Chen - - // Eden Chen - //vgawb(VB_PART1_ADR, 0x24); - vgawb (VB_PART1_ADR, IND_SIS_CRT2_WRITE_ENABLE); - // ~Eden Chen - vgawb (VB_PART1_DATA, 0x1); - // Eden Chen for Debug - // ~Eden Chen + vgawb(VB_PART4_ADR,0x01); + reg = vgarb(VB_PART4_DATA); + if (reg < 0xB0) /* 301B Revision ID */ + { + // Eden Chen + switch (ivideo.video_width) { + case 320: + filter_tb = (ivideo.TV_type == TVMODE_NTSC) ? 4 : 12; + break; + case 640: + filter_tb = (ivideo.TV_type == TVMODE_NTSC) ? 5 : 13; + break; + case 720: + filter_tb = (ivideo.TV_type == TVMODE_NTSC) ? 6 : 14; + break; + case 800: + filter_tb = (ivideo.TV_type == TVMODE_NTSC) ? 7 : 15; + break; + default: + filter = -1; + break; + } + // ~Eden Chen - if (ivideo.TV_type == TVMODE_NTSC) { - vgawb (VB_PART2_ADR, 0x3A); - reg = vgarb (VB_PART2_DATA); - reg &= 0x1F; - vgawb (VB_PART2_DATA, reg); - - if (ivideo.TV_plug == TVPLUG_SVIDEO) { - vgawb (VB_PART2_ADR, 0x30); - reg = vgarb (VB_PART2_DATA); - reg &= 0xDF; - vgawb (VB_PART2_DATA, reg); - } else if (ivideo.TV_plug == TVPLUG_COMPOSITE) { - vgawb (VB_PART2_ADR, 0x30); - reg = vgarb (VB_PART2_DATA); - reg |= 0x20; - vgawb (VB_PART2_DATA, reg); - - 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); - 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); - 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); - 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); - - if (ivideo.TV_plug == TVPLUG_SVIDEO) { - vgawb (VB_PART2_ADR, 0x30); - reg = vgarb (VB_PART2_DATA); - reg &= 0xDF; - vgawb (VB_PART2_DATA, reg); - } else if (ivideo.TV_plug == TVPLUG_COMPOSITE) { - vgawb (VB_PART2_ADR, 0x30); - reg = vgarb (VB_PART2_DATA); - reg |= 0x20; - vgawb (VB_PART2_DATA, reg); - - 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); - 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); - 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); - break; - } + // 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); + + if (ivideo.TV_plug == TVPLUG_SVIDEO) { + vgawb(VB_PART2_ADR, 0x30); + reg = vgarb(VB_PART2_DATA); + reg &= 0xDF; + vgawb(VB_PART2_DATA, reg); + } else if (ivideo.TV_plug == TVPLUG_COMPOSITE) { + vgawb(VB_PART2_ADR, 0x30); + reg = vgarb(VB_PART2_DATA); + reg |= 0x20; + vgawb(VB_PART2_DATA, reg); + + 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); + 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); + 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); + 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], - sis_TV_filter[filter_tb].filter[filter][1], - 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]); + } else if (ivideo.TV_type == TVMODE_PAL) { + vgawb(VB_PART2_ADR, 0x3A); + reg = vgarb(VB_PART2_DATA); + reg &= 0x1F; + vgawb(VB_PART2_DATA, reg); + + if (ivideo.TV_plug == TVPLUG_SVIDEO) { + vgawb(VB_PART2_ADR, 0x30); + reg = vgarb(VB_PART2_DATA); + reg &= 0xDF; + vgawb(VB_PART2_DATA, reg); + } else if (ivideo.TV_plug == TVPLUG_COMPOSITE) { + vgawb(VB_PART2_ADR, 0x30); + reg = vgarb(VB_PART2_DATA); + reg |= 0x20; + vgawb(VB_PART2_DATA, reg); + + 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); + 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); + 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); + break; + } } - // ~Eden } + + // 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], + sis_TV_filter[filter_tb].filter[filter][1], + 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) +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; + 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); + vgawb(SEQ_ADR, IND_SIS_COLOR_MODE); + sr_data = vgarb(SEQ_DATA); if (sr_data & SIS_INTERLACED_MODE) var->vmode = FB_VMODE_INTERLACED; @@ -1800,25 +2126,25 @@ static void sisfb_crtc_to_var (struct fb_var_screeninfo *var) var->vmode = FB_VMODE_NONINTERLACED; switch ((sr_data & 0x1C) >> 2) { - case SIS_8BPP_COLOR_MODE: + case SIS_8BPP_COLOR_MODE: var->bits_per_pixel = 8; break; - case SIS_16BPP_COLOR_MODE: + case SIS_16BPP_COLOR_MODE: var->bits_per_pixel = 16; break; - case SIS_32BPP_COLOR_MODE: + case SIS_32BPP_COLOR_MODE: var->bits_per_pixel = 32; break; } switch (var->bits_per_pixel) { - case 8: + case 8: var->red.length = 6; var->green.length = 6; var->blue.length = 6; video_cmap_len = 256; break; - case 16: + case 16: var->red.offset = 11; var->red.length = 5; var->green.offset = 5; @@ -1828,9 +2154,8 @@ static void sisfb_crtc_to_var (struct fb_var_screeninfo *var) var->transp.offset = 0; var->transp.length = 0; video_cmap_len = 16; - break; - case 24: + case 24: var->red.offset = 16; var->red.length = 8; var->green.offset = 8; @@ -1841,7 +2166,7 @@ static void sisfb_crtc_to_var (struct fb_var_screeninfo *var) var->transp.length = 0; video_cmap_len = 16; break; - case 32: + case 32: var->red.offset = 16; var->red.length = 8; var->green.offset = 8; @@ -1854,47 +2179,45 @@ static void sisfb_crtc_to_var (struct fb_var_screeninfo *var) break; } - vgawb (SEQ_ADR, 0xA); - sr_data = vgarb (SEQ_DATA); + 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); + 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); + 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); + 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); + 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); + ((u16) (cr_data3 & 0x20) << 4) | ((u16) (sr_data & 0x04) << 8); - vgawb (CRTC_ADR, 0x16); - cr_data = vgarb (CRTC_DATA); + 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); + 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); @@ -1902,41 +2225,46 @@ static void sisfb_crtc_to_var (struct fb_var_screeninfo *var) 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(SEQ_ADR, 0xb); + sr_data = vgarb(SEQ_DATA); - vgawb (CRTC_ADR, 0x0); - cr_data = vgarb (CRTC_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); + 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); + 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); + 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); + 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); @@ -1956,7 +2284,7 @@ static void sisfb_crtc_to_var (struct fb_var_screeninfo *var) var->sync = 0; - mr_data = vgarb (0x1C); + mr_data = vgarb(0x1C); if (mr_data & 0x80) var->sync &= ~FB_SYNC_VERT_HIGH_ACT; else @@ -1978,21 +2306,24 @@ static void sisfb_crtc_to_var (struct fb_var_screeninfo *var) /* ------------------ Public Routines -------------------------------- */ -static int sisfb_get_fix (struct fb_fix_screeninfo *fix, int con, struct fb_info *info) +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); + memset(fix, 0, sizeof(struct fb_fix_screeninfo)); + strcpy(fix->id, fb_info.modename); fix->smem_start = ivideo.video_base; - - /*karl:10/01/2001 */ - if (!sisfb_mem) { - if (ivideo.video_size > 0x800000) - fix->smem_len = 0x800000; - else - fix->smem_len = 0x400000; - } else - fix->smem_len = sisfb_mem * 0x100000; + + /*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; @@ -2012,98 +2343,121 @@ static int sisfb_get_fix (struct fb_fix_screeninfo *fix, int con, struct fb_info fix->reserved[2] = sisfb_caps; return 0; - } -static int sisfb_get_var (struct fb_var_screeninfo *var, int con, struct fb_info *info) +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)); + 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) +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 (sisfb_do_set_var (var, con == info->currcon, info)) { - sisfb_crtc_to_var (var); +#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); + 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))) + if ((err = fb_alloc_cmap(&fb_display[con].cmap, 0, 0))) return err; - sisfb_do_install_cmap (con, 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); + 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) +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) - 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 + 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); + 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) +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); + 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); + 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); + 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) +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)) + case FBIO_ALLOC: + if (!capable(CAP_SYS_RAWIO)) return -EPERM; - sis_malloc ((struct sis_memreq *) arg); + sis_malloc((struct sis_memreq *) arg); break; - case FBIO_FREE: - if (!capable (CAP_SYS_RAWIO)) + case FBIO_FREE: + if (!capable(CAP_SYS_RAWIO)) return -EPERM; - sis_free (*(unsigned long *) arg); + sis_free(*(unsigned long *) arg); break; - case FBIOGET_GLYPH: - sis_get_glyph (info, (SIS_GLYINFO *) arg); + 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: + case FBIOGET_HWCINFO: { unsigned long *hwc_offset = (unsigned long *) arg; @@ -2115,32 +2469,47 @@ static int sisfb_ioctl (struct inode *inode, struct file *file, break; } - case FBIOPUT_MODEINFO: + 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; - + 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); + case FBIOGET_DISPINFO: + sis_dispinfo((struct ap_data *)arg); break; - default: + 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; + } + default: return -EINVAL; } return 0; } -static int sisfb_mmap (struct fb_info *info, struct file *file, struct vm_area_struct *vma) +static int sisfb_mmap(struct fb_info *info, struct file *file, + struct vm_area_struct *vma) { struct fb_var_screeninfo var; unsigned long start; @@ -2150,17 +2519,21 @@ static int sisfb_mmap (struct fb_info *info, struct file *file, struct vm_area_s 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); + len = PAGE_ALIGN((start & ~PAGE_MASK) + ivideo.video_size); if (off >= len) { off -= len; - sisfb_get_var (&var, info->currcon, info); +#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); + len = PAGE_ALIGN((start & ~PAGE_MASK) + sisfb_mmio_size); } start &= PAGE_MASK; @@ -2169,11 +2542,17 @@ static int sisfb_mmap (struct fb_info *info, struct file *file, struct vm_area_s off += start; vma->vm_pgoff = off >> PAGE_SHIFT; -#if defined(__i386__) +#if defined(__i386__) || defined(__x86_64__) if (boot_cpu_data.x86 > 3) - pgprot_val (vma->vm_page_prot) |= _PAGE_PCD; + 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 - if (io_remap_page_range(vma, vma->vm_start, off, vma->vm_end - vma->vm_start, vma->vm_page_prot)) return -EAGAIN; return 0; @@ -2186,69 +2565,85 @@ static struct fb_ops sisfb_ops = { fb_set_var: sisfb_set_var, fb_get_cmap: sisfb_get_cmap, fb_set_cmap: sisfb_set_cmap, - fb_setcolreg: sisfb_setcolreg, - fb_blank: sisfb_blank, +#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) +static int sisfb_update_var(int con, struct fb_info *info) { return 0; } -static int sisfb_switch (int con, struct fb_info *info) +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); + 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 (!memcmp(&fb_display[con].var, &fb_display[info->currcon].var, sizeof (struct fb_var_screeninfo))) { +#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; + } - sisfb_do_set_var (&fb_display[con].var, 1, info); + currcon = con; +#endif - sisfb_set_disp (con, &fb_display[con].var); + sisfb_do_set_var(&fb_display[con].var, 1, info); - sisfb_do_install_cmap (con, 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); + vc_resize_con(rows, cols, fb_display[con].conp->vc_num); - sisfb_update_var (con, info); + sisfb_update_var(con, info); return 1; - } -static int sisfb_blank(int blank, struct fb_info *info) +static void sisfb_blank(int blank, struct fb_info *info) { u8 reg; - vgawb (CRTC_ADR, 0x17); - reg = vgarb (CRTC_DATA); + vgawb(CRTC_ADR, 0x17); + reg = vgarb(CRTC_DATA); - if (blank > 0) + if (blank > 0) reg &= 0x7f; - else + else reg |= 0x80; - vgawb (CRTC_ADR, 0x17); - vgawb (CRTC_DATA, reg); - return 0; + vgawb(CRTC_ADR, 0x17); + vgawb(CRTC_DATA, reg); } -int sisfb_setup (char *options) +int sisfb_setup(char *options) { char *this_opt; @@ -2258,46 +2653,60 @@ int sisfb_setup (char *options) if (!options || !*options) return 0; - while ((this_opt = strsep (&options, ",")) != NULL) { + while((this_opt = strsep(&options, ",")) != NULL) { if (!*this_opt) continue; - if (!strcmp (this_opt, "inverse")) { + if (!strcmp(this_opt, "inverse")) { sisfb_inverse = 1; - fb_invert_cmaps (); - } else if (!strncmp (this_opt, "font:", 5)) { - strcpy (fb_info.fontname, this_opt + 5); - } else if (!strncmp (this_opt, "mode:", 5)) { - sisfb_search_mode (this_opt + 5); - } else if (!strncmp (this_opt, "vrate:", 6)) { + fb_invert_cmaps(); + } else if (!strncmp(this_opt, "font:", 5)) { + strcpy(fb_info.fontname, this_opt + 5); + } else if (!strncmp(this_opt, "mode:", 5)) { + sisfb_search_mode(this_opt + 5); + } else if (!strncmp(this_opt, "vrate:", 6)) { + ivideo.refresh_rate = + simple_strtoul(this_opt + 6, NULL, 0); + } else if (!strncmp(this_opt, "rate:", 5)) { ivideo.refresh_rate = - simple_strtoul (this_opt + 6, NULL, 0); - } else if (!strncmp (this_opt, "off", 3)) { + simple_strtoul(this_opt + 5, NULL, 0); + } else if (!strncmp(this_opt, "off", 3)) { sisfb_off = 1; - } else if (!strncmp (this_opt, "crt1off", 7)) { + } else if (!strncmp(this_opt, "crt1off", 7)) { sisfb_crt1off = 1; - } else if (!strncmp (this_opt, "filter:", 7)) { - filter = (int) simple_strtoul (this_opt + 7, NULL, 0); - } - /*karl */ - 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; + } else if (!strncmp(this_opt, "filter:", 7)) { + filter = (int)simple_strtoul(this_opt + 7, NULL, 0); + } else if (!strncmp(this_opt, "forcecrt2type:", 14)) { + sisfb_search_crt2type(this_opt + 14); + } 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; + } 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); + /* TW: DSTN overrules forcecrt2type */ + if (enable_dstn) sisfb_crt2type = DISPTYPE_LCD; + } else if (!strncmp(this_opt, "queuemode:", 10)) { + sisfb_search_queuemode(this_opt + 10); + } else if (!strncmp(this_opt, "pdc:", 4)) { + sisfb_pdc = simple_strtoul(this_opt + 4, NULL, 0); + if(sisfb_pdc & ~0x3c) { + printk(KERN_INFO "sisfb: Illegal pdc parameter\n"); + sisfb_pdc = 0; + } + } else { + printk(KERN_INFO "sisfb: Invalid parameter %s\n", this_opt); } - /*karl:10/01/2001 */ - else if (!strncmp (this_opt, "mem:", 4)) { - - sisfb_mem = simple_strtoul (this_opt + 4, NULL, 0); - - } else - DPRINTK ("invalid parameter %s\n", this_opt); } return 0; } -int __init sisfb_init (void) +int __init sisfb_init(void) { struct pci_dev *pdev = NULL; struct board *b; @@ -2305,493 +2714,689 @@ int __init sisfb_init (void) //unsigned long rom_vbase; u32 reg32; u16 reg16; - u8 reg; - int nRes; + u8 reg; + int temp1, temp2; + + outb(0x77, 0x80); - outb (0x77, 0x80); +#if 0 + /* for DOC VB */ + sisfb_set_reg4(0xcf8,0x800000e0); + reg32 = sisfb_get_reg3(0xcfc); + reg32 = reg32 | 0x00001000; + sisfb_set_reg4(0xcfc,reg32); + } +#endif if (sisfb_off) return -ENXIO; - pci_for_each_dev (pdev) - { + if (enable_dstn) + SetEnableDstn(); + + 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); + strcpy(fb_info.modename, b->name); ivideo.chip_id = pdev->device; - pci_read_config_byte (pdev, PCI_REVISION_ID, - &ivideo.revision_id); - pci_read_config_word (pdev, PCI_COMMAND, ®16); - // Eden Chen - //sishw_ext.uRevisionID = ivideo.revision_id; + pci_read_config_byte(pdev, PCI_REVISION_ID, + &ivideo.revision_id); + pci_read_config_word(pdev, PCI_COMMAND, ®16); sishw_ext.jChipRevision = ivideo.revision_id; - // ~Eden Chen sisvga_enabled = reg16 & 0x1; break; } } - + if (pdev_valid) break; } - + if (!pdev_valid) return -1; - - // Eden Chen + +// Eden Chen switch (ivideo.chip_id) { - case PCI_DEVICE_ID_SI_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_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) { - ivideo.chip = SIS_730; - strcpy (fb_info.modename, "SIS 730"); - } else - ivideo.chip = SIS_630; - - sisvga_engine = SIS_300_VGA; - break; - } - case PCI_DEVICE_ID_SI_540_VGA: + case PCI_DEVICE_ID_SI_630_VGA: + { + sisfb_set_reg4(0xCF8, 0x80000000); + reg32 = sisfb_get_reg3(0xCFC); + if (reg32 == 0x07301039) { + ivideo.chip = SIS_730; + strcpy(fb_info.modename, "SIS 730"); + } else + ivideo.chip = SIS_630; + + sisvga_engine = SIS_300_VGA; + sisfb_hwcursor_size = HW_CURSOR_AREA_SIZE_300; + 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_CRT2_write_enable = IND_SIS_CRT2_WRITE_ENABLE_300; break; - case PCI_DEVICE_ID_SI_315H: + case PCI_DEVICE_ID_SI_315H: ivideo.chip = SIS_315H; sisvga_engine = SIS_315_VGA; + sisfb_hwcursor_size = HW_CURSOR_AREA_SIZE_315; + sisfb_CRT2_write_enable = IND_SIS_CRT2_WRITE_ENABLE_315; break; - case PCI_DEVICE_ID_SI_315: + case PCI_DEVICE_ID_SI_315: ivideo.chip = SIS_315; sisvga_engine = SIS_315_VGA; + sisfb_hwcursor_size = HW_CURSOR_AREA_SIZE_315; + sisfb_CRT2_write_enable = IND_SIS_CRT2_WRITE_ENABLE_315; break; - case PCI_DEVICE_ID_SI_315PRO: + case PCI_DEVICE_ID_SI_315PRO: ivideo.chip = SIS_315PRO; sisvga_engine = SIS_315_VGA; + sisfb_hwcursor_size = HW_CURSOR_AREA_SIZE_315; + sisfb_CRT2_write_enable = IND_SIS_CRT2_WRITE_ENABLE_315; break; - case PCI_DEVICE_ID_SI_550_VGA: + 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_CRT2_write_enable = IND_SIS_CRT2_WRITE_ENABLE_315; + break; + case PCI_DEVICE_ID_SI_650_VGA: + ivideo.chip = SIS_650; + sisvga_engine = SIS_315_VGA; + sisfb_hwcursor_size = HW_CURSOR_AREA_SIZE_315; + sisfb_CRT2_write_enable = IND_SIS_CRT2_WRITE_ENABLE_315; break; } - - // Eden Chen - //sishw_ext.jChipID = ivideo.chip; sishw_ext.jChipType = ivideo.chip; // for Debug - if ((sishw_ext.jChipType == SIS_315PRO) - || (sishw_ext.jChipType == SIS_315)) + if ((sishw_ext.jChipType == SIS_315PRO) + || (sishw_ext.jChipType == SIS_315) ) sishw_ext.jChipType = SIS_315H; - // ~Eden Chen - DPRINTK ("%s is used as %s device(VGA Engine %d).\n", - fb_info.modename, sisvga_enabled ? "primary" : "secondary", - sisvga_engine); - - ivideo.video_base = pci_resource_start (pdev, 0); - ivideo.mmio_base = pci_resource_start (pdev, 1); - // Eden Chen - //sishw_ext.IOAddress = (unsigned short) ivideo.vga_base - // = pci_resource_start(pdev, 2) + 0x30; - sishw_ext.ulIOAddress = (unsigned short) ivideo.vga_base = pci_resource_start (pdev, 2) + 0x30; - // ~Eden Chen + DPRINTK("%s is used as %s device(VGA Engine %d).\n", + fb_info.modename, sisvga_enabled ? "primary" : "secondary", sisvga_engine); + + 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; - sisfb_mmio_size = pci_resource_len (pdev, 1); + sisfb_mmio_size = pci_resource_len(pdev, 1); if (!sisvga_enabled) - if (pci_enable_device (pdev)) - return -EIO; + if (pci_enable_device(pdev)) return -EIO; + +// 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 - vgawb (SEQ_ADR, IND_SIS_PASSWORD); - vgawb (SEQ_DATA, SIS_PASSWORD); + vgawb(SEQ_ADR, IND_SIS_PASSWORD); + vgawb(SEQ_DATA, SIS_PASSWORD); + + /* 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 CONFIG_FB_SIS_300 - if (sisvga_engine == SIS_300_VGA) - { - vgawb (SEQ_ADR, 0x28); - vgawb (SEQ_DATA, 0x37); + if (sisvga_engine == SIS_300_VGA) { + vgawb(SEQ_ADR, 0x28); + vgawb(SEQ_DATA, 0x37); - vgawb (SEQ_ADR, 0x29); - vgawb (SEQ_DATA, 0x61); + vgawb(SEQ_ADR, 0x29); + vgawb(SEQ_DATA, 0x61); - vgawb (SEQ_ADR, IND_SIS_SCRATCH_REG_1A); - reg = vgarb (SEQ_DATA); + vgawb(SEQ_ADR, IND_SIS_SCRATCH_REG_1A); + reg = vgarb(SEQ_DATA); reg |= SIS_SCRATCH_REG_1A_MASK; - vgawb (SEQ_DATA, reg); + vgawb(SEQ_DATA, reg); } #endif #ifdef CONFIG_FB_SIS_315 - if (ivideo.chip == SIS_550) { - vgawb (SEQ_ADR, 0x28); - vgawb (SEQ_DATA, 0x5A); - - vgawb (SEQ_ADR, 0x29); - vgawb (SEQ_DATA, 0x64); + if (ivideo.chip == SIS_550 || ivideo.chip == SIS_650) { + vgawb(SEQ_ADR, 0x28); + vgawb(SEQ_DATA, 0x5A); - vgawb (CRTC_ADR, 0x3A); - vgawb (CRTC_DATA, 0x00); + vgawb(SEQ_ADR, 0x29); + vgawb(SEQ_DATA, 0x64); + + vgawb(CRTC_ADR, 0x3A); + vgawb(CRTC_DATA, 0x00); } #endif -#endif +#endif /* LinuxBIOS */ if (sisvga_engine == SIS_315_VGA) { switch (ivideo.chip) { - case SIS_315H: - case SIS_315: + case SIS_315H: + case SIS_315: sishw_ext.bIntegratedMMEnabled = TRUE; break; - case SIS_550: + 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; + // sishw_ext.bIntegratedMMEnabled = TRUE; //else - // sishw_ext.bIntegratedMMEnabled = FALSE; + // sishw_ext.bIntegratedMMEnabled = FALSE; //for Debug sishw_ext.bIntegratedMMEnabled = TRUE; // ~Eden Chen break; - default: + default: break; } } else if (sisvga_engine == SIS_300_VGA) { if (ivideo.chip == SIS_300) { sishw_ext.bIntegratedMMEnabled = TRUE; } else { - vgawb (SEQ_ADR, IND_SIS_SCRATCH_REG_1A); - reg = vgarb (SEQ_DATA); + 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; } } - // Eden Chen + sishw_ext.pDevice = NULL; sishw_ext.pjVirtualRomBase = NULL; sishw_ext.pjCustomizedROMImage = NULL; sishw_ext.bSkipDramSizing = 0; sishw_ext.pQueryVGAConfigSpace = &sisfb_query_VGA_config_space; sishw_ext.pQueryNorthBridgeSpace = &sisfb_query_north_bridge_space; - strcpy (sishw_ext.szVBIOSVer, "0.84"); + strcpy(sishw_ext.szVBIOSVer, "0.84"); + + /* TW: Mode numbers for 1280x960 are different for 300 and 310/325 series */ + if(sisvga_engine == SIS_300_VGA) { + sisbios_mode[MODEINDEX_1280x960].mode_no = 0x6e; + sisbios_mode[MODEINDEX_1280x960+1].mode_no = 0x6f; + sisbios_mode[MODEINDEX_1280x960+2].mode_no = 0x7b; + sisbios_mode[MODEINDEX_1280x960+3].mode_no = 0x7b; + } - sishw_ext.pSR = vmalloc (sizeof (SIS_DSReg) * SR_BUFFER_SIZE); - if (sishw_ext.pSR == NULL) - printk (KERN_DEBUG "Allocated SRReg space fail.\n"); + 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"); + 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_DEBUG "Allocated CRReg space fail.\n"); + 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"); + return -ENODEV; + } sishw_ext.pCR[0].jIdx = sishw_ext.pCR[0].jVal = 0xFF; - // ~Eden Chen - #ifdef CONFIG_FB_SIS_300 +#ifdef CONFIG_FB_SIS_300 if (sisvga_engine == SIS_300_VGA) { if (!sisvga_enabled) { - // Eden Chen - sishw_ext.pjVideoMemoryAddress = ioremap (ivideo.video_base, 0x2000000); - //SiSInit300(&sishw_ext); - SiSInit (&sishw_ext); - vgawb (SEQ_ADR, IND_SIS_PASSWORD); - vgawb (SEQ_DATA, SIS_PASSWORD); - // ~Eden Chen + 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); + } } #ifdef LINUXBIOS else { - // Eden Chen sishw_ext.pjVideoMemoryAddress - = ioremap (ivideo.video_base, 0x2000000); - //SiSInit300(&sishw_ext); - SiSInit (&sishw_ext); - vgawb (SEQ_ADR, IND_SIS_PASSWORD); - vgawb (SEQ_DATA, SIS_PASSWORD); - // ~Eden Chen + = 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); + } + } + 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); } - vgawb (SEQ_ADR, 0x7); - reg = vgarb (SEQ_DATA); - reg |= 0x10; - vgawb (SEQ_DATA, reg); #endif - sisfb_get_dram_size_300 (); + if (sisfb_get_dram_size_300()) { + printk(KERN_INFO "sisfb: Fatal error: Unable to determine RAM size\n"); + return -ENODEV; + } } #endif - #ifdef CONFIG_FB_SIS_315 +#ifdef CONFIG_FB_SIS_315 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); - //SiSInit310(&sishw_ext); - SiSInit (&sishw_ext); - - vgawb (SEQ_ADR, IND_SIS_PASSWORD); - vgawb (SEQ_DATA, 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; - sishw_ext.pSR[2].jVal = 0xFF; - // Eden Chen + 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); + + 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; + sishw_ext.pSR[2].jVal = 0xFF; + } } #ifdef LINUXBIOS else { - sishw_ext.pjVideoMemoryAddress = ioremap (ivideo.video_base, 0x8000000); - SiSInit (&sishw_ext); - vgawb (SEQ_ADR, IND_SIS_PASSWORD); - vgawb (SEQ_DATA, 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; - sishw_ext.pSR[2].jVal = 0xFF; + 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); + + 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; + sishw_ext.pSR[2].jVal = 0xFF; + } } #endif - sisfb_get_dram_size_315 (); + if (sisfb_get_dram_size_315()) { + printk(KERN_INFO "sisfb: Fatal error: Unable to determine RAM size.\n"); + return -ENODEV; + } } #endif - //Eden Chen - vgawb (SEQ_ADR, IND_SIS_PCI_ADDRESS_SET); - reg = vgarb (SEQ_DATA); - reg |= SIS_PCI_ADDR_ENABLE; - reg |= SIS_MEM_MAP_IO_ENABLE; - vgawb (SEQ_DATA, reg); - - vgawb (SEQ_ADR, IND_SIS_MODULE_ENABLE); - reg = vgarb (SEQ_DATA); - reg |= SIS_ENABLE_2D; - vgawb (SEQ_DATA, reg); - //~Eden Chen + 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); + + vgawb(SEQ_ADR, IND_SIS_MODULE_ENABLE); + reg = vgarb(SEQ_DATA); + reg |= SIS_ENABLE_2D; /* Enable 2D accelerator engine */ + vgawb(SEQ_DATA, reg); + + } - // Eden Chen sishw_ext.ulVideoMemorySize = ivideo.video_size; - // ~Eden Chen - if (!request_mem_region (ivideo.video_base, ivideo.video_size, "sisfb FB")) { - printk (KERN_ERR "sisfb: cannot reserve frame buffer memory\n"); + + if(sisfb_pdc) { + sishw_ext.pdc = sisfb_pdc; + } else { + sishw_ext.pdc = 0; + } + + 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"); return -ENODEV; } - if (!request_mem_region (ivideo.mmio_base, sisfb_mmio_size, "sisfb MMIO")) { - printk (KERN_ERR "sisfb: cannot reserve MMIO region\n"); - release_mem_region (ivideo.video_base, ivideo.video_size); + 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); return -ENODEV; } - // Eden Chen - //sishw_ext.VirtualVideoMemoryAddress = ivideo.video_vbase - sishw_ext.pjVideoMemoryAddress = ivideo.video_vbase = ioremap (ivideo.video_base, ivideo.video_size); - // Eden Chen - 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", - ivideo.video_base, ivideo.video_vbase, ivideo.video_size / 1024); + sishw_ext.pjVideoMemoryAddress = ivideo.video_vbase + = ioremap(ivideo.video_base, ivideo.video_size); + ivideo.mmio_vbase = ioremap(ivideo.mmio_base, sisfb_mmio_size); - 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); + 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); - #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 (); + 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" */ + +#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 (); + if (sisvga_engine == SIS_315_VGA) { + sisfb_get_VB_type_315(); + if (ivideo.hasVB != HASVB_NONE) { + sisfb_detect_VB_connect_315(); + } } - } #endif - // Eden Chen -sishw_ext.ujVBChipID = VB_CHIP_UNKNOWN; -sishw_ext.usExternalChip = 0; - - switch (ivideo.hasVB) { - case HASVB_301: - /*karl */ - vgawb (VB_PART4_ADR, 0x01); - reg = vgarb (VB_PART4_DATA); - if ((reg != 0xB1) && (reg != 0xB0)) - sishw_ext.ujVBChipID = VB_CHIP_301; - else - sishw_ext.ujVBChipID = VB_CHIP_301B; - break; - case HASVB_302: - sishw_ext.ujVBChipID = VB_CHIP_302; - break; - case HASVB_303: - sishw_ext.ujVBChipID = VB_CHIP_303; - break; - case HASVB_LVDS: - sishw_ext.usExternalChip = 0x1; - break; - case HASVB_TRUMPION: - sishw_ext.usExternalChip = 0x2; - break; - case HASVB_CHRONTEL: - sishw_ext.usExternalChip = 0x4; - break; - case HASVB_LVDS_CHRONTEL: - sishw_ext.usExternalChip = 0x5; - break; - default: - break; - } - - // ~Eden Chen - - if (ivideo.disp_state & DISPTYPE_DISP2) { - if (sisfb_crt1off) - ivideo.disp_state |= DISPMODE_SINGLE; - else - ivideo.disp_state |= (DISPMODE_MIRROR | DISPTYPE_CRT1); - } else - ivideo.disp_state = DISPMODE_SINGLE | DISPTYPE_CRT1; - - if (ivideo.disp_state & DISPTYPE_LCD) { - vgawb (CRTC_ADR, IND_SIS_LCD_PANEL); - reg = vgarb (CRTC_DATA); - // Eden Chen - switch (reg) { - case SIS_LCD_PANEL_800X600: - sishw_ext.ulCRT2LCDType = LCD_800x600; - break; - case SIS_LCD_PANEL_1024X768: - sishw_ext.ulCRT2LCDType = LCD_1024x768; + sishw_ext.ujVBChipID = VB_CHIP_UNKNOWN; + sishw_ext.usExternalChip = 0; + + switch (ivideo.hasVB) { + + case HASVB_301: + vgawb(VB_PART4_ADR,0x01); + reg = vgarb(VB_PART4_DATA); + 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); + } else { + sishw_ext.ujVBChipID = VB_CHIP_301; + printk(KERN_INFO "sisfb: SiS301 bridge detected\n"); + } break; - case SIS_LCD_PANEL_1280X1024: - sishw_ext.ulCRT2LCDType = LCD_1280x1024; + case HASVB_302: + vgawb(VB_PART4_ADR,0x01); + reg = vgarb(VB_PART4_DATA); + if (reg >= 0xD0) { + sishw_ext.ujVBChipID = VB_CHIP_302LV; + printk(KERN_INFO "sisfb: SiS302LV bridge detected (revision 0x%02x)\n",reg); + } else if (reg >= 0xB0) { + sishw_ext.ujVBChipID = VB_CHIP_302B; + printk(KERN_INFO "sisfb: SiS302B bridge detected (revision 0x%02x)\n",reg); + } else { + sishw_ext.ujVBChipID = VB_CHIP_302; + printk(KERN_INFO "sisfb: SiS302 bridge detected\n"); + } break; - case SIS_LCD_PANEL_640X480: - sishw_ext.ulCRT2LCDType = LCD_640x480; + case HASVB_303: + sishw_ext.ujVBChipID = VB_CHIP_303; + printk(KERN_INFO "sisfb: SiS303 bridge detected (not supported)\n"); break; - case SIS_LCD_PANEL_1280X960: - sishw_ext.ulCRT2LCDType = LCD_1280x960; + case HASVB_LVDS: + sishw_ext.usExternalChip = 0x1; + printk(KERN_INFO "sisfb: LVDS transmitter detected\n"); break; - default: - sishw_ext.ulCRT2LCDType = LCD_1024x768; + case HASVB_TRUMPION: + sishw_ext.usExternalChip = 0x2; + printk(KERN_INFO "sisfb: Trumpion Zurac LVDS scaler detected\n"); break; - } - // ~Eden Chen - } - - if (sisfb_mode_idx >= 0) - sisfb_validate_mode (); - - if (sisfb_mode_idx < 0) { - switch (ivideo.disp_state & DISPTYPE_DISP2) { - case DISPTYPE_LCD: - sisfb_mode_idx = DEFAULT_LCDMODE; + case HASVB_CHRONTEL: + sishw_ext.usExternalChip = 0x4; + printk(KERN_INFO "sisfb: Chrontel TV encoder detected\n"); break; - case DISPTYPE_TV: - sisfb_mode_idx = DEFAULT_TVMODE; + case HASVB_LVDS_CHRONTEL: + sishw_ext.usExternalChip = 0x5; + printk(KERN_INFO "sisfb: LVDS transmitter and Chrontel TV encoder detected\n"); break; default: - sisfb_mode_idx = DEFAULT_MODE; + printk(KERN_INFO "sisfb: No or unknown bridge type detected\n"); break; } - } - - sisfb_mode_no = sisbios_mode[sisfb_mode_idx].mode_no; - - if (ivideo.refresh_rate != 0) - sisfb_search_refresh_rate (ivideo.refresh_rate); - if (sisfb_rate_idx == 0) { - sisfb_rate_idx = sisbios_mode[sisfb_mode_idx].rate_idx; - ivideo.refresh_rate = 60; - } + /* 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 */ +#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 */ +#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; + } +#endif + } + } - 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); + if (ivideo.disp_state & DISPTYPE_DISP2) { + if (sisfb_crt1off) + ivideo.disp_state |= DISPMODE_SINGLE; + else + ivideo.disp_state |= (DISPMODE_MIRROR | DISPTYPE_CRT1); + } else { + ivideo.disp_state = DISPMODE_SINGLE | DISPTYPE_CRT1; + } - printk (KERN_INFO "sisfb: mode is %dx%dx%d, linelength=%d\n", - ivideo.video_width, ivideo.video_height, ivideo.video_bpp, - video_linelength); + if (ivideo.disp_state & DISPTYPE_LCD) { + if (!enable_dstn) { + vgawb(CRTC_ADR, IND_SIS_LCD_PANEL); + reg = vgarb(CRTC_DATA) & 0x0f; + if (sisvga_engine == SIS_300_VGA) { + sishw_ext.ulCRT2LCDType = sis300paneltype[reg]; + } else { + sishw_ext.ulCRT2LCDType = sis310paneltype[reg]; + } + } else { + /* TW: FSTN/DSTN */ + sishw_ext.ulCRT2LCDType = LCD_320x480; + } + } - // 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 + if (sisfb_mode_idx >= 0) + sisfb_validate_mode(); - sisfb_pre_setmode (); + if (sisfb_mode_idx < 0) { + switch (ivideo.disp_state & DISPTYPE_DISP2) { + case DISPTYPE_LCD: + sisfb_mode_idx = DEFAULT_LCDMODE; + break; + case DISPTYPE_TV: + sisfb_mode_idx = DEFAULT_TVMODE; + break; + default: + sisfb_mode_idx = DEFAULT_MODE; + break; + } + } - if (SiSSetMode (&sishw_ext, sisfb_mode_no) == 0) { - DPRINTK ("set mode[0x%x]: failed\n", sisfb_mode_no); - return -1; - } - vgawb (SEQ_ADR, IND_SIS_PASSWORD); - vgawb (SEQ_DATA, SIS_PASSWORD); - // Eden Chen + sisfb_mode_no = sisbios_mode[sisfb_mode_idx].mode_no; - sisfb_post_setmode (); + if (ivideo.refresh_rate != 0) + sisfb_search_refresh_rate(ivideo.refresh_rate); - sisfb_crtc_to_var (&default_var); + if (sisfb_rate_idx == 0) { + sisfb_rate_idx = sisbios_mode[sisfb_mode_idx].rate_idx; + ivideo.refresh_rate = 60; + } - fb_info.changevar = NULL; - fb_info.node = NODEV; - fb_info.fbops = &sisfb_ops; - fb_info.screen_base = ivideo.video_vbase; - fb_info.disp = &disp; - fb_info.currcon = -1; - fb_info.switch_con = &sisfb_switch; - fb_info.updatevar = &sisfb_update_var; - fb_info.flags = FBINFO_FLAG_DEFAULT; + 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); - sisfb_set_disp (-1, &default_var); + printk(KERN_INFO "sisfb: Mode is %dx%dx%d (%dHz), linelength=%d\n", + ivideo.video_width, ivideo.video_height, ivideo.video_bpp, + ivideo.refresh_rate, video_linelength); - if (sisfb_heap_init ()) { - DPRINTK ("sisfb: Failed to enable offscreen heap\n"); - } - - /*H.C. */ - nRes = mtrr_add ((unsigned int) ivideo.video_base, (unsigned int) ivideo.video_size, MTRR_TYPE_WRCOMB, 1); - vc_resize_con (1, 1, 0); + // 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 - if (register_framebuffer (&fb_info) < 0) - return -EINVAL; + sisfb_pre_setmode(); - printk (KERN_INFO "fb%d: %s frame buffer device, Version %d.%d.%02d\n", - GET_FB_IDX (fb_info.node), fb_info.modename, VER_MAJOR, VER_MINOR, - VER_LEVEL); + if (SiSSetMode(&sishw_ext, sisfb_mode_no) == 0) { + printk("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); + + sisfb_post_setmode(); + + sisfb_crtc_to_var(&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; +#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); + + } /* TW: if mode = "none" */ + + if (sisfb_heap_init()) { + printk("sisfb: Failed to initialize offscreen memory heap\n"); + } + + ivideo.mtrr = (unsigned int) 0; + if ((sisbios_mode[sisfb_mode_idx].mode_no) != 0xFF) { /* TW: for mode "none" */ + /*H.C.*/ + 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); + } + */ + vc_resize_con(1, 1, 0); + + if (register_framebuffer(&fb_info) < 0) + return -EINVAL; + + printk(KERN_INFO "fb%d: %s frame buffer device, Version %d.%d.%02d\n", + GET_FB_IDX(fb_info.node), fb_info.modename, VER_MAJOR, VER_MINOR, + VER_LEVEL); + + printk(KERN_INFO "sisfb: Added SISFB_GET_INFO ioctl = %x\n", SISFB_GET_INFO); + + } /* TW: if mode = "none" */ return 0; } @@ -2799,38 +3404,151 @@ sishw_ext.usExternalChip = 0; static char *mode = NULL; static unsigned int rate = 0; -static unsigned int crt1 = 1; - -MODULE_PARM (mode, "s"); -MODULE_PARM (rate, "i"); -MODULE_PARM (crt1, "i"); -MODULE_PARM (filter, "i"); - -int init_module (void) +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>"); + +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)"); + +MODULE_PARM(rate, "i"); +MODULE_PARM_DESC(rate, + "Selects the desired vertical refresh rate for CRT1 (external VGA) in Hz. " + "(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])"); + +MODULE_PARM(dstn, "i"); /* JennyLee 20011211 */ +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)"); + +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)"); + +/* 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."); + +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])"); + +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])"); + +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])"); + + +int init_module(void) { if (mode) - sisfb_search_mode (mode); + sisfb_search_mode(mode); + else /* TW: set mode=none if no mode parameter is given */ + sisfb_mode_idx = MODE_INDEX_NONE; ivideo.refresh_rate = rate; - if (crt1 == 0) + if (forcecrt2type) + sisfb_search_crt2type(forcecrt2type); + + if (crt1off == 0) sisfb_crt1off = 1; else sisfb_crt1off = 0; - sisfb_init (); + sisfb_forcecrt1 = forcecrt1; + if (forcecrt1 == 1) + sisfb_crt1off = 0; + else if (forcecrt1 == 0) + sisfb_crt1off = 1; + + if (mem) + sisfb_mem = mem; + + enable_dstn = dstn; /* JennyLee 20011211 */ + /* TW: DSTN overrules forcecrt2type */ + if (enable_dstn) sisfb_crt2type = DISPTYPE_LCD; + + if (queuemode) + sisfb_search_queuemode(queuemode); + + if(pdc) { + if(!(pdc & ~0x3c)) { + sisfb_pdc = pdc & 0x3c; + } + } + + sisfb_init(); return 0; } -void cleanup_module (void) +void cleanup_module(void) { - unregister_framebuffer (&fb_info); + /* TW: Release mem regions */ + release_mem_region(ivideo.video_base, ivideo.video_size); + release_mem_region(ivideo.mmio_base, sisfb_mmio_size); + /* TW: Release MTRR region */ + if (ivideo.mtrr) mtrr_del(ivideo.mtrr, + (unsigned int)ivideo.video_base, + (unsigned int)ivideo.video_size); + /* Unregister the framebuffer */ + unregister_framebuffer(&fb_info); + printk(KERN_INFO "sisfb: Module unloaded\n"); } + #endif -EXPORT_SYMBOL (sis_malloc); -EXPORT_SYMBOL (sis_free); -EXPORT_SYMBOL (sis_dispinfo); +EXPORT_SYMBOL(sis_malloc); +EXPORT_SYMBOL(sis_free); +EXPORT_SYMBOL(sis_dispinfo); -EXPORT_SYMBOL (ivideo); +EXPORT_SYMBOL(ivideo); + diff --git a/drivers/video/sis/sis_main.h b/drivers/video/sis/sis_main.h index d4d89d9e38b1..6246cdc4b2dc 100644 --- a/drivers/video/sis/sis_main.h +++ b/drivers/video/sis/sis_main.h @@ -1,18 +1,25 @@ #ifndef _SISFB_MAIN #define _SISFB_MAIN +/* Comments and changes marked with "TW" by Thomas Winischhofer <tw@webit.com> */ + /* ------------------- Constant Definitions ------------------------- */ -#undef LINUXBIOS /* turn on when use LINUXBIOS */ -#define AGPOFF /* default is turn off AGP */ +#undef LINUXBIOS /* turn on when use LINUXBIOS */ +#define AGPOFF /* default is turn off AGP */ #define VER_MAJOR 1 -#define VER_MINOR 3 -#define VER_LEVEL 9 +#define VER_MINOR 4 +#define VER_LEVEL 1 -#define DEFAULT_MODE 0 -#define DEFAULT_LCDMODE 9 -#define DEFAULT_TVMODE 9 +/* TW: To be included in pci_ids.h */ +#ifndef PCI_DEVICE_ID_SI_650_VGA +#define PCI_DEVICE_ID_SI_650_VGA 0x6325 +#endif +#ifndef PCI_DEVICE_ID_SI_650 +#define PCI_DEVICE_ID_SI_650 0x0650 +#endif +/* TW end */ #define MAX_ROM_SCAN 0x10000 @@ -23,17 +30,19 @@ /* For 300 series */ #ifdef CONFIG_FB_SIS_300 -#define TURBO_QUEUE_AREA_SIZE 0x80000 /* 512K */ -#define HW_CURSOR_AREA_SIZE 0x1000 /* 4K */ +#define TURBO_QUEUE_AREA_SIZE 0x80000 /* 512K */ #endif /* For 315 series */ #ifdef CONFIG_FB_SIS_315 -#define COMMAND_QUEUE_AREA_SIZE 0x80000 /* 512K */ -#define HW_CURSOR_AREA_SIZE 0x4000 /* 16K */ +#define COMMAND_QUEUE_AREA_SIZE 0x80000 /* 512K */ #define COMMAND_QUEUE_THRESHOLD 0x1F #endif +/* TW */ +#define HW_CURSOR_AREA_SIZE_315 0x4000 /* 16K */ +#define HW_CURSOR_AREA_SIZE_300 0x1000 /* 4K */ + #define OH_ALLOC_SIZE 4000 #define SENTINEL 0x7fffffff @@ -54,7 +63,7 @@ #define VB_PART4_ADR (0x14-0x30) #define VB_PART4_DATA (0x15-0x30) -#define IND_SIS_PASSWORD 0x05 /* SRs */ +#define IND_SIS_PASSWORD 0x05 /* SRs */ #define IND_SIS_COLOR_MODE 0x06 #define IND_SIS_RAMDAC_CONTROL 0x07 #define IND_SIS_DRAM_SIZE 0x14 @@ -70,7 +79,7 @@ #define IND_SIS_CMDQUEUE_SET 0x26 #define IND_SIS_CMDQUEUE_THRESHOLD 0x27 -#define IND_SIS_SCRATCH_REG_CR30 0x30 /* CRs */ +#define IND_SIS_SCRATCH_REG_CR30 0x30 /* CRs */ #define IND_SIS_SCRATCH_REG_CR31 0x31 #define IND_SIS_SCRATCH_REG_CR32 0x32 #define IND_SIS_SCRATCH_REG_CR33 0x33 @@ -78,28 +87,24 @@ #define IND_SIS_SCRATCH_REG_CR37 0x37 #define IND_SIS_AGP_IO_PAD 0x48 -#define IND_BRI_DRAM_STATUS 0x63 +#define IND_BRI_DRAM_STATUS 0x63 /* PCI config memory size offset */ #define MMIO_QUEUE_PHYBASE 0x85C0 #define MMIO_QUEUE_WRITEPORT 0x85C4 #define MMIO_QUEUE_READPORT 0x85C8 -// Eden Chen -#ifdef CONFIG_FB_SIS_300 -#define IND_SIS_CRT2_WRITE_ENABLE 0x24 -#endif -#ifdef CONFIG_FB_SIS_315 -#define IND_SIS_CRT2_WRITE_ENABLE 0x2F -#endif -// ~Eden Chen - -#define SIS_PASSWORD 0x86 /* SR05 */ -#define SIS_INTERLACED_MODE 0x20 /* SR06 */ -#define SIS_8BPP_COLOR_MODE 0x0 -#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 */ +/* 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 */ +#define SIS_8BPP_COLOR_MODE 0x0 +#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_1MB 0x00 #define SIS_DRAM_SIZE_2MB 0x01 #define SIS_DRAM_SIZE_4MB 0x03 @@ -111,7 +116,8 @@ #define SIS_DATA_BUS_32 0x00 #define SIS_DATA_BUS_64 0x01 #define SIS_DATA_BUS_128 0x02 -#define SIS315_DRAM_SIZE_MASK 0xF0 /* 315 SR14 */ + +#define SIS315_DRAM_SIZE_MASK 0xF0 /* 315 SR14 */ #define SIS315_DRAM_SIZE_2MB 0x01 #define SIS315_DRAM_SIZE_4MB 0x02 #define SIS315_DRAM_SIZE_8MB 0x03 @@ -123,10 +129,12 @@ #define SIS315_DATA_BUS_64 0x00 #define SIS315_DATA_BUS_128 0x01 #define SIS315_DUAL_CHANNEL_MASK 0x0C -#define SIS315_SINGLE_CHANNEL_1_RANK 0x0 -#define SIS315_SINGLE_CHANNEL_2_RANK 0x1 -#define SIS315_DUAL_CHANNEL_1_RANK 0x3 -#define SIS550_DRAM_SIZE_MASK 0x3F /* 550 SR14 */ +#define SIS315_SINGLE_CHANNEL_1_RANK 0x0 +#define SIS315_SINGLE_CHANNEL_2_RANK 0x1 +#define SIS315_ASYM_DDR 0x02 +#define SIS315_DUAL_CHANNEL_1_RANK 0x3 + +#define SIS550_DRAM_SIZE_MASK 0x3F /* 550/650/740 SR14 */ #define SIS550_DRAM_SIZE_4MB 0x00 #define SIS550_DRAM_SIZE_8MB 0x01 #define SIS550_DRAM_SIZE_16MB 0x03 @@ -138,10 +146,13 @@ #define SIS550_DRAM_SIZE_256MB 0x3F #define SIS_SCRATCH_REG_1A_MASK 0x10 -#define SIS_ENABLE_2D 0x40 /* SR1E */ -#define SIS_MEM_MAP_IO_ENABLE 0x01 /* SR20 */ + +#define SIS_ENABLE_2D 0x40 /* SR1E */ + +#define SIS_MEM_MAP_IO_ENABLE 0x01 /* SR20 */ #define SIS_PCI_ADDR_ENABLE 0x80 -#define SIS_AGP_CMDQUEUE_ENABLE 0x80 /* 315 SR26 */ + +#define SIS_AGP_CMDQUEUE_ENABLE 0x80 /* 315/650/740 SR26 */ #define SIS_VRAM_CMDQUEUE_ENABLE 0x40 #define SIS_MMIO_CMD_ENABLE 0x20 #define SIS_CMD_QUEUE_SIZE_512k 0x00 @@ -149,7 +160,9 @@ #define SIS_CMD_QUEUE_SIZE_2M 0x08 #define SIS_CMD_QUEUE_SIZE_4M 0x0C #define SIS_CMD_QUEUE_RESET 0x01 -#define SIS_SIMULTANEOUS_VIEW_ENABLE 0x01 /* CR30 */ +#define SIS_CMD_AUTO_CORR 0x02 + +#define SIS_SIMULTANEOUS_VIEW_ENABLE 0x01 /* CR30 */ #define SIS_MODE_SELECT_CRT2 0x02 #define SIS_VB_OUTPUT_COMPOSITE 0x04 #define SIS_VB_OUTPUT_SVIDEO 0x08 @@ -157,9 +170,11 @@ #define SIS_VB_OUTPUT_LCD 0x20 #define SIS_VB_OUTPUT_CRT2 0x40 #define SIS_VB_OUTPUT_HIVISION 0x80 -#define SIS_VB_OUTPUT_DISABLE 0x20 /* CR31 */ + +#define SIS_VB_OUTPUT_DISABLE 0x20 /* CR31 */ #define SIS_DRIVER_MODE 0x40 -#define SIS_VB_COMPOSITE 0x01 /* CR32 */ + +#define SIS_VB_COMPOSITE 0x01 /* CR32 */ #define SIS_VB_SVIDEO 0x02 #define SIS_VB_SCART 0x04 #define SIS_VB_LCD 0x08 @@ -167,21 +182,21 @@ #define SIS_CRT1 0x20 #define SIS_VB_HIVISION 0x40 #define SIS_VB_DVI 0x80 -#define SIS_VB_TV (SIS_VB_COMPOSITE | SIS_VB_SVIDEO | SIS_VB_SCART | SIS_VB_HIVISION) -#define SIS_LCD_PANEL_800X600 0x1 /* CR36 */ -#define SIS_LCD_PANEL_1024X768 0x2 -#define SIS_LCD_PANEL_1280X1024 0x3 -#define SIS_LCD_PANEL_1280X960 0x4 -#define SIS_LCD_PANEL_640X480 0x5 -#define SIS_EXTERNAL_CHIP_MASK 0x0E /* CR37 */ -#define SIS_EXTERNAL_CHIP_SIS301 0x01 -#define SIS_EXTERNAL_CHIP_LVDS 0x02 -#define SIS_EXTERNAL_CHIP_TRUMPION 0x03 -#define SIS_EXTERNAL_CHIP_LVDS_CHRONTEL 0x04 -#define SIS_EXTERNAL_CHIP_CHRONTEL 0x05 -#define SIS_AGP_2X 0x20 /* CR48 */ - -#define BRI_DRAM_SIZE_MASK 0x70 /* PCI bridge */ +#define SIS_VB_TV (SIS_VB_COMPOSITE | SIS_VB_SVIDEO | \ + SIS_VB_SCART | SIS_VB_HIVISION) + +#define SIS_EXTERNAL_CHIP_MASK 0x0E /* CR37 */ +#define SIS_EXTERNAL_CHIP_SIS301 0x01 /* in CR37 << 1 ! */ +#define SIS_EXTERNAL_CHIP_LVDS 0x02 /* in CR37 << 1 ! */ +#define SIS_EXTERNAL_CHIP_TRUMPION 0x03 /* in CR37 << 1 ! */ +#define SIS_EXTERNAL_CHIP_LVDS_CHRONTEL 0x04 /* in CR37 << 1 ! */ +#define SIS_EXTERNAL_CHIP_CHRONTEL 0x05 /* in CR37 << 1 ! */ +#define SIS310_EXTERNAL_CHIP_LVDS 0x02 /* in CR37 << 1 ! */ +#define SIS310_EXTERNAL_CHIP_LVDS_CHRONTEL 0x03 /* in CR37 << 1 ! */ + +#define SIS_AGP_2X 0x20 /* CR48 */ + +#define BRI_DRAM_SIZE_MASK 0x70 /* PCI bridge config data */ #define BRI_DRAM_SIZE_2MB 0x00 #define BRI_DRAM_SIZE_4MB 0x01 #define BRI_DRAM_SIZE_8MB 0x02 @@ -190,7 +205,7 @@ #define BRI_DRAM_SIZE_64MB 0x05 // Eden Chen -#define HW_DEVICE_EXTENSION SIS_HW_DEVICE_INFO +#define HW_DEVICE_EXTENSION SIS_HW_DEVICE_INFO #define PHW_DEVICE_EXTENSION PSIS_HW_DEVICE_INFO #define SR_BUFFER_SIZE 5 @@ -207,19 +222,33 @@ static int video_linelength; static int video_cmap_len; static struct display_switch sisfb_sw; static struct fb_var_screeninfo default_var = { - 0, 0, 0, 0, - 0, 0, - 0, - 0, - {0, 8, 0}, - {0, 8, 0}, - {0, 8, 0}, - {0, 0, 0}, - 0, - FB_ACTIVATE_NOW, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, - FB_VMODE_NONINTERLACED, - {0, 0, 0, 0, 0, 0} + xres: 0, + yres: 0, + xres_virtual: 0, + yres_virtual: 0, + xoffset: 0, + yoffset: 0, + bits_per_pixel: 0, + grayscale: 0, + red: {0, 8, 0}, + green: {0, 8, 0}, + blue: {0, 8, 0}, + transp: {0, 0, 0}, + nonstd: 0, + activate: FB_ACTIVATE_NOW, + height: -1, + width: -1, + accel_flags: 0, + pixclock: 0, + left_margin: 0, + right_margin: 0, + upper_margin: 0, + lower_margin: 0, + hsync_len: 0, + vsync_len: 0, + sync: 0, + vmode: FB_VMODE_NONINTERLACED, + reserved: {0, 0, 0, 0, 0, 0} }; static struct { @@ -240,11 +269,14 @@ static union { /* 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; -/*karl*/ +static int currcon = 0; static int sisfb_tvmode = 0; static int sisfb_mem = 0; +static int sisfb_pdc = 0; +static int enable_dstn = 0; static enum _VGA_ENGINE { UNKNOWN_VGA = 0, @@ -252,22 +284,28 @@ static enum _VGA_ENGINE { SIS_315_VGA, } sisvga_engine = UNKNOWN_VGA; -/* mode-related variables */ -int sisfb_mode_idx = -1; -u8 sisfb_mode_no = 0; -u8 sisfb_rate_idx = 0; +/* 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_queuemode = -1; /* TW: Use MMIO queue mode by default (310 series only) */ /* data for sis components*/ struct video_info ivideo; -// Eden Chen +/* TW: For ioctl SISFB_GET_INFO */ +sisfb_info sisfbinfo; + +/* TW: Hardware extension; contains data on hardware */ HW_DEVICE_EXTENSION sishw_ext = { NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, - {0, 0, 0, 0} + {0, 0, 0, 0}, + 0 }; -// ~Eden Chen /* card parameters */ static unsigned long sisfb_mmio_size = 0; @@ -284,19 +322,19 @@ static struct board { u16 vendor, device; 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"}, { - 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"}, { - 0, 0, NULL} + {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_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"}, + {0, 0, NULL} }; /* mode table */ -static const struct _sisbios_mode { +struct _sisbios_mode { char name[15]; u8 mode_no; u16 xres; @@ -306,32 +344,131 @@ static const struct _sisbios_mode { u16 cols; u16 rows; } sisbios_mode[] = { - { - "640x480x8", 0x2E, 640, 480, 8, 1, 80, 30}, { - "640x480x16", 0x44, 640, 480, 16, 1, 80, 30}, { - "640x480x32", 0x62, 640, 480, 32, 1, 80, 30}, { - "720x480x8", 0x31, 720, 480, 8, 1, 90, 30}, { - "720x480x16", 0x33, 720, 480, 16, 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}, { - "720x576x32", 0x36, 720, 576, 32, 1, 90, 36}, { - "800x600x8", 0x30, 800, 600, 8, 2, 100, 37}, { - "800x600x16", 0x47, 800, 600, 16, 2, 100, 37}, { - "800x600x32", 0x63, 800, 600, 32, 2, 100, 37}, { - "1024x768x8", 0x38, 1024, 768, 8, 2, 128, 48}, { - "1024x768x16", 0x4A, 1024, 768, 16, 2, 128, 48}, { - "1024x768x32", 0x64, 1024, 768, 32, 2, 128, 48}, { - "1280x1024x8", 0x3A, 1280, 1024, 8, 2, 160, 64}, { - "1280x1024x16", 0x4D, 1280, 1024, 16, 2, 160, 64}, { - "1280x1024x32", 0x65, 1280, 1024, 32, 2, 160, 64}, { - "1600x1200x8", 0x3C, 1600, 1200, 8, 1, 200, 75}, { - "1600x1200x16", 0x3D, 1600, 1200, 16, 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}, { - "1920x1440x32", 0x6B, 1920, 1440, 32, 1, 240, 75}, { - "\0", 0x00, 0, 0, 0, 0, 0, 0} +#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}, +#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}, +#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} +}; + +/* mode-related variables */ +int sisfb_mode_idx = MODE_INDEX_NONE; +u8 sisfb_mode_no = 0; +u8 sisfb_rate_idx = 0; + +/* TW: CR36 evaluation */ +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[] = + { 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]; + int type_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} +}; + +/* Queue mode selection for 310 series */ +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} }; static struct _sis_vrate { @@ -340,43 +477,32 @@ static struct _sis_vrate { u16 yres; u16 refresh; } sisfb_vrate[] = { - { - 1, 640, 480, 60}, { - 2, 640, 480, 72}, { - 3, 640, 480, 75}, { - 4, 640, 480, 85}, { - 5, 640, 480, 100}, { - 6, 640, 480, 120}, { - 7, 640, 480, 160}, { - 8, 640, 480, 200}, { - 1, 720, 480, 60}, { - 1, 720, 576, 50}, { - 1, 800, 600, 56}, { - 2, 800, 600, 60}, { - 3, 800, 600, 72}, { - 4, 800, 600, 75}, { - 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, 1280, 1024, 43}, { - 2, 1280, 1024, 60}, { - 3, 1280, 1024, 75}, { - 4, 1280, 1024, 85}, { - 1, 1600, 1200, 60}, { - 2, 1600, 1200, 65}, { - 3, 1600, 1200, 70}, { - 4, 1600, 1200, 75}, { - 5, 1600, 1200, 85}, { - 1, 1920, 1440, 60}, { - 0, 0, 0, 0} + {1, 640, 480, 60}, {2, 640, 480, 72}, {3, 640, 480, 75}, {4, 640, 480, 85}, + {5, 640, 480,100}, {6, 640, 480, 120}, {7, 640, 480, 160}, {8, 640, 480, 200}, + {1, 720, 480, 60}, + {1, 720, 576, 58}, + {1, 800, 480, 60}, {2, 800, 480, 75}, {3, 800, 480, 85}, + {1, 800, 600, 56}, {2, 800, 600, 60}, {3, 800, 600, 72}, {4, 800, 600, 75}, + {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, 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, 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}, + {0, 0, 0, 0} }; /* Offscreen layout */ @@ -419,167 +545,150 @@ static SIS_HEAP sisfb_heap; static struct _sis_TV_filter { u8 filter[9][4]; } sis_TV_filter[] = { - { { { - 0x00, 0x00, 0x00, 0x40}, /* NTSCFilter_0 */ - { - 0x00, 0xE0, 0x10, 0x60}, { - 0x00, 0xEE, 0x10, 0x44}, { - 0x00, 0xF4, 0x10, 0x38}, { - 0xF8, 0xF4, 0x18, 0x38}, { - 0xFC, 0xFB, 0x14, 0x2A}, { - 0x00, 0x00, 0x10, 0x20}, { - 0x00, 0x04, 0x10, 0x18}, { - 0xFF, 0xFF, 0xFF, 0xFF}}}, { { { - 0x00, 0x00, 0x00, 0x40}, /* NTSCFilter_1 */ - { - 0x00, 0xE0, 0x10, 0x60}, { - 0x00, 0xEE, 0x10, 0x44}, { - 0x00, 0xF4, 0x10, 0x38}, { - 0xF8, 0xF4, 0x18, 0x38}, { - 0xFC, 0xFB, 0x14, 0x2A}, { - 0x00, 0x00, 0x10, 0x20}, { - 0x00, 0x04, 0x10, 0x18}, { - 0xFF, 0xFF, 0xFF, 0xFF}}}, { { { - 0x00, 0x00, 0x00, 0x40}, /* NTSCFilter_2 */ - { - 0xF5, 0xEE, 0x1B, 0x44}, { - 0xF8, 0xF4, 0x18, 0x38}, { - 0xEB, 0x04, 0x25, 0x18}, { - 0xF1, 0x05, 0x1F, 0x16}, { - 0xF6, 0x06, 0x1A, 0x14}, { - 0xFA, 0x06, 0x16, 0x14}, { - 0x00, 0x04, 0x10, 0x18}, { - 0xFF, 0xFF, 0xFF, 0xFF}}}, { { { - 0x00, 0x00, 0x00, 0x40}, /* NTSCFilter_3 */ - { - 0xF1, 0x04, 0x1F, 0x18}, { - 0xEE, 0x0D, 0x22, 0x06}, { - 0xF7, 0x06, 0x19, 0x14}, { - 0xF4, 0x0B, 0x1C, 0x0A}, { - 0xFA, 0x07, 0x16, 0x12}, { - 0xF9, 0x0A, 0x17, 0x0C}, { - 0x00, 0x07, 0x10, 0x12}, { - 0xFF, 0xFF, 0xFF, 0xFF}}}, { { { - 0x00, 0x00, 0x00, 0x40}, /* NTSCFilter_4 */ - { - 0x00, 0xE0, 0x10, 0x60}, { - 0x00, 0xEE, 0x10, 0x44}, { - 0x00, 0xF4, 0x10, 0x38}, { - 0xF8, 0xF4, 0x18, 0x38}, { - 0xFC, 0xFB, 0x14, 0x2A}, { - 0x00, 0x00, 0x10, 0x20}, { - 0x00, 0x04, 0x10, 0x18}, { - 0xFF, 0xFF, 0xFF, 0xFF}}}, { { { - 0x00, 0x00, 0x00, 0x40}, /* NTSCFilter_5 */ - { - 0xF5, 0xEE, 0x1B, 0x44}, { - 0xF8, 0xF4, 0x18, 0x38}, { - 0xEB, 0x04, 0x25, 0x18}, { - 0xF1, 0x05, 0x1F, 0x16}, { - 0xF6, 0x06, 0x1A, 0x14}, { - 0xFA, 0x06, 0x16, 0x14}, { - 0x00, 0x04, 0x10, 0x18}, { - 0xFF, 0xFF, 0xFF, 0xFF}}}, { { { - 0x00, 0x00, 0x00, 0x40}, /* NTSCFilter_6 */ - { - 0xEB, 0x04, 0x25, 0x18}, { - 0xE7, 0x0E, 0x29, 0x04}, { - 0xEE, 0x0C, 0x22, 0x08}, { - 0xF6, 0x0B, 0x1A, 0x0A}, { - 0xF9, 0x0A, 0x17, 0x0C}, { - 0xFC, 0x0A, 0x14, 0x0C}, { - 0x00, 0x08, 0x10, 0x10}, { - 0xFF, 0xFF, 0xFF, 0xFF}}}, { { { - 0x00, 0x00, 0x00, 0x40}, /* NTSCFilter_7 */ - { - 0xEC, 0x02, 0x24, 0x1C}, { - 0xF2, 0x04, 0x1E, 0x18}, { - 0xEB, 0x15, 0x25, 0xF6}, { - 0xF4, 0x10, 0x1C, 0x00}, { - 0xF8, 0x0F, 0x18, 0x02}, { - 0x00, 0x04, 0x10, 0x18}, { - 0x01, 0x06, 0x0F, 0x14}, { - 0xFF, 0xFF, 0xFF, 0xFF}}}, { { { - 0x00, 0x00, 0x00, 0x40}, /* PALFilter_0 */ - { - 0x00, 0xE0, 0x10, 0x60}, { - 0x00, 0xEE, 0x10, 0x44}, { - 0x00, 0xF4, 0x10, 0x38}, { - 0xF8, 0xF4, 0x18, 0x38}, { - 0xFC, 0xFB, 0x14, 0x2A}, { - 0x00, 0x00, 0x10, 0x20}, { - 0x00, 0x04, 0x10, 0x18}, { - 0xFF, 0xFF, 0xFF, 0xFF}}}, { { { - 0x00, 0x00, 0x00, 0x40}, /* PALFilter_1 */ - { - 0x00, 0xE0, 0x10, 0x60}, { - 0x00, 0xEE, 0x10, 0x44}, { - 0x00, 0xF4, 0x10, 0x38}, { - 0xF8, 0xF4, 0x18, 0x38}, { - 0xFC, 0xFB, 0x14, 0x2A}, { - 0x00, 0x00, 0x10, 0x20}, { - 0x00, 0x04, 0x10, 0x18}, { - 0xFF, 0xFF, 0xFF, 0xFF}}}, { { { - 0x00, 0x00, 0x00, 0x40}, /* PALFilter_2 */ - { - 0xF5, 0xEE, 0x1B, 0x44}, { - 0xF8, 0xF4, 0x18, 0x38}, { - 0xF1, 0xF7, 0x01, 0x32}, { - 0xF5, 0xFB, 0x1B, 0x2A}, { - 0xF9, 0xFF, 0x17, 0x22}, { - 0xFB, 0x01, 0x15, 0x1E}, { - 0x00, 0x04, 0x10, 0x18}, { - 0xFF, 0xFF, 0xFF, 0xFF}}}, { { { - 0x00, 0x00, 0x00, 0x40}, /* PALFilter_3 */ - { - 0xF5, 0xFB, 0x1B, 0x2A}, { - 0xEE, 0xFE, 0x22, 0x24}, { - 0xF3, 0x00, 0x1D, 0x20}, { - 0xF9, 0x03, 0x17, 0x1A}, { - 0xFB, 0x02, 0x14, 0x1E}, { - 0xFB, 0x04, 0x15, 0x18}, { - 0x00, 0x06, 0x10, 0x14}, { - 0xFF, 0xFF, 0xFF, 0xFF}}}, { { { - 0x00, 0x00, 0x00, 0x40}, /* PALFilter_4 */ - { - 0x00, 0xE0, 0x10, 0x60}, { - 0x00, 0xEE, 0x10, 0x44}, { - 0x00, 0xF4, 0x10, 0x38}, { - 0xF8, 0xF4, 0x18, 0x38}, { - 0xFC, 0xFB, 0x14, 0x2A}, { - 0x00, 0x00, 0x10, 0x20}, { - 0x00, 0x04, 0x10, 0x18}, { - 0xFF, 0xFF, 0xFF, 0xFF}}}, { { { - 0x00, 0x00, 0x00, 0x40}, /* PALFilter_5 */ - { - 0xF5, 0xEE, 0x1B, 0x44}, { - 0xF8, 0xF4, 0x18, 0x38}, { - 0xF1, 0xF7, 0x1F, 0x32}, { - 0xF5, 0xFB, 0x1B, 0x2A}, { - 0xF9, 0xFF, 0x17, 0x22}, { - 0xFB, 0x01, 0x15, 0x1E}, { - 0x00, 0x04, 0x10, 0x18}, { - 0xFF, 0xFF, 0xFF, 0xFF}}}, { { { - 0x00, 0x00, 0x00, 0x40}, /* PALFilter_6 */ - { - 0xF5, 0xEE, 0x1B, 0x2A}, { - 0xEE, 0xFE, 0x22, 0x24}, { - 0xF3, 0x00, 0x1D, 0x20}, { - 0xF9, 0x03, 0x17, 0x1A}, { - 0xFB, 0x02, 0x14, 0x1E}, { - 0xFB, 0x04, 0x15, 0x18}, { - 0x00, 0x06, 0x10, 0x14}, { - 0xFF, 0xFF, 0xFF, 0xFF}}}, { { { - 0x00, 0x00, 0x00, 0x40}, /* PALFilter_7 */ - { - 0xF5, 0xEE, 0x1B, 0x44}, { - 0xF8, 0xF4, 0x18, 0x38}, { - 0xFC, 0xFB, 0x14, 0x2A}, { - 0xEB, 0x05, 0x25, 0x16}, { - 0xF1, 0x05, 0x1F, 0x16}, { - 0xFA, 0x07, 0x16, 0x12}, { - 0x00, 0x07, 0x10, 0x12}, { - 0xFF, 0xFF, 0xFF, 0xFF}}} + { {{0x00,0x00,0x00,0x40}, /* NTSCFilter_0 */ + {0x00,0xE0,0x10,0x60}, + {0x00,0xEE,0x10,0x44}, + {0x00,0xF4,0x10,0x38}, + {0xF8,0xF4,0x18,0x38}, + {0xFC,0xFB,0x14,0x2A}, + {0x00,0x00,0x10,0x20}, + {0x00,0x04,0x10,0x18}, + {0xFF,0xFF,0xFF,0xFF} }}, + { {{0x00,0x00,0x00,0x40}, /* NTSCFilter_1 */ + {0x00,0xE0,0x10,0x60}, + {0x00,0xEE,0x10,0x44}, + {0x00,0xF4,0x10,0x38}, + {0xF8,0xF4,0x18,0x38}, + {0xFC,0xFB,0x14,0x2A}, + {0x00,0x00,0x10,0x20}, + {0x00,0x04,0x10,0x18}, + {0xFF,0xFF,0xFF,0xFF} }}, + { {{0x00,0x00,0x00,0x40}, /* NTSCFilter_2 */ + {0xF5,0xEE,0x1B,0x44}, + {0xF8,0xF4,0x18,0x38}, + {0xEB,0x04,0x25,0x18}, + {0xF1,0x05,0x1F,0x16}, + {0xF6,0x06,0x1A,0x14}, + {0xFA,0x06,0x16,0x14}, + {0x00,0x04,0x10,0x18}, + {0xFF,0xFF,0xFF,0xFF} }}, + { {{0x00,0x00,0x00,0x40}, /* NTSCFilter_3 */ + {0xF1,0x04,0x1F,0x18}, + {0xEE,0x0D,0x22,0x06}, + {0xF7,0x06,0x19,0x14}, + {0xF4,0x0B,0x1C,0x0A}, + {0xFA,0x07,0x16,0x12}, + {0xF9,0x0A,0x17,0x0C}, + {0x00,0x07,0x10,0x12}, + {0xFF,0xFF,0xFF,0xFF} }}, + { {{0x00,0x00,0x00,0x40}, /* NTSCFilter_4 */ + {0x00,0xE0,0x10,0x60}, + {0x00,0xEE,0x10,0x44}, + {0x00,0xF4,0x10,0x38}, + {0xF8,0xF4,0x18,0x38}, + {0xFC,0xFB,0x14,0x2A}, + {0x00,0x00,0x10,0x20}, + {0x00,0x04,0x10,0x18}, + {0xFF,0xFF,0xFF,0xFF} }}, + { {{0x00,0x00,0x00,0x40}, /* NTSCFilter_5 */ + {0xF5,0xEE,0x1B,0x44}, + {0xF8,0xF4,0x18,0x38}, + {0xEB,0x04,0x25,0x18}, + {0xF1,0x05,0x1F,0x16}, + {0xF6,0x06,0x1A,0x14}, + {0xFA,0x06,0x16,0x14}, + {0x00,0x04,0x10,0x18}, + {0xFF,0xFF,0xFF,0xFF} }}, + { {{0x00,0x00,0x00,0x40}, /* NTSCFilter_6 */ + {0xEB,0x04,0x25,0x18}, + {0xE7,0x0E,0x29,0x04}, + {0xEE,0x0C,0x22,0x08}, + {0xF6,0x0B,0x1A,0x0A}, + {0xF9,0x0A,0x17,0x0C}, + {0xFC,0x0A,0x14,0x0C}, + {0x00,0x08,0x10,0x10}, + {0xFF,0xFF,0xFF,0xFF} }}, + { {{0x00,0x00,0x00,0x40}, /* NTSCFilter_7 */ + {0xEC,0x02,0x24,0x1C}, + {0xF2,0x04,0x1E,0x18}, + {0xEB,0x15,0x25,0xF6}, + {0xF4,0x10,0x1C,0x00}, + {0xF8,0x0F,0x18,0x02}, + {0x00,0x04,0x10,0x18}, + {0x01,0x06,0x0F,0x14}, + {0xFF,0xFF,0xFF,0xFF} }}, + { {{0x00,0x00,0x00,0x40}, /* PALFilter_0 */ + {0x00,0xE0,0x10,0x60}, + {0x00,0xEE,0x10,0x44}, + {0x00,0xF4,0x10,0x38}, + {0xF8,0xF4,0x18,0x38}, + {0xFC,0xFB,0x14,0x2A}, + {0x00,0x00,0x10,0x20}, + {0x00,0x04,0x10,0x18}, + {0xFF,0xFF,0xFF,0xFF} }}, + { {{0x00,0x00,0x00,0x40}, /* PALFilter_1 */ + {0x00,0xE0,0x10,0x60}, + {0x00,0xEE,0x10,0x44}, + {0x00,0xF4,0x10,0x38}, + {0xF8,0xF4,0x18,0x38}, + {0xFC,0xFB,0x14,0x2A}, + {0x00,0x00,0x10,0x20}, + {0x00,0x04,0x10,0x18}, + {0xFF,0xFF,0xFF,0xFF} }}, + { {{0x00,0x00,0x00,0x40}, /* PALFilter_2 */ + {0xF5,0xEE,0x1B,0x44}, + {0xF8,0xF4,0x18,0x38}, + {0xF1,0xF7,0x01,0x32}, + {0xF5,0xFB,0x1B,0x2A}, + {0xF9,0xFF,0x17,0x22}, + {0xFB,0x01,0x15,0x1E}, + {0x00,0x04,0x10,0x18}, + {0xFF,0xFF,0xFF,0xFF} }}, + { {{0x00,0x00,0x00,0x40}, /* PALFilter_3 */ + {0xF5,0xFB,0x1B,0x2A}, + {0xEE,0xFE,0x22,0x24}, + {0xF3,0x00,0x1D,0x20}, + {0xF9,0x03,0x17,0x1A}, + {0xFB,0x02,0x14,0x1E}, + {0xFB,0x04,0x15,0x18}, + {0x00,0x06,0x10,0x14}, + {0xFF,0xFF,0xFF,0xFF} }}, + { {{0x00,0x00,0x00,0x40}, /* PALFilter_4 */ + {0x00,0xE0,0x10,0x60}, + {0x00,0xEE,0x10,0x44}, + {0x00,0xF4,0x10,0x38}, + {0xF8,0xF4,0x18,0x38}, + {0xFC,0xFB,0x14,0x2A}, + {0x00,0x00,0x10,0x20}, + {0x00,0x04,0x10,0x18}, + {0xFF,0xFF,0xFF,0xFF} }}, + { {{0x00,0x00,0x00,0x40}, /* PALFilter_5 */ + {0xF5,0xEE,0x1B,0x44}, + {0xF8,0xF4,0x18,0x38}, + {0xF1,0xF7,0x1F,0x32}, + {0xF5,0xFB,0x1B,0x2A}, + {0xF9,0xFF,0x17,0x22}, + {0xFB,0x01,0x15,0x1E}, + {0x00,0x04,0x10,0x18}, + {0xFF,0xFF,0xFF,0xFF} }}, + { {{0x00,0x00,0x00,0x40}, /* PALFilter_6 */ + {0xF5,0xEE,0x1B,0x2A}, + {0xEE,0xFE,0x22,0x24}, + {0xF3,0x00,0x1D,0x20}, + {0xF9,0x03,0x17,0x1A}, + {0xFB,0x02,0x14,0x1E}, + {0xFB,0x04,0x15,0x18}, + {0x00,0x06,0x10,0x14}, + {0xFF,0xFF,0xFF,0xFF} }}, + { {{0x00,0x00,0x00,0x40}, /* PALFilter_7 */ + {0xF5,0xEE,0x1B,0x44}, + {0xF8,0xF4,0x18,0x38}, + {0xFC,0xFB,0x14,0x2A}, + {0xEB,0x05,0x25,0x16}, + {0xF1,0x05,0x1F,0x16}, + {0xFA,0x07,0x16,0x12}, + {0x00,0x07,0x10,0x12}, + {0xFF,0xFF,0xFF,0xFF} }} }; static int filter = -1; @@ -589,101 +698,107 @@ static unsigned char filter_tb; /* ---------------------- Routine Prototype ------------------------- */ /* Interface used by the world */ -int sisfb_setup (char *options); -static int sisfb_get_fix (struct fb_fix_screeninfo *fix, int con, +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_get_var (struct fb_var_screeninfo *var, int con, +static int sisfb_set_cmap(struct fb_cmap *cmap, int kspc, 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_setcolreg (unsigned regno, unsigned red, unsigned green, - unsigned blue, unsigned transp, - struct fb_info *fb_info); -static int sisfb_ioctl (struct inode *inode, struct file *file, - unsigned int cmd, unsigned long arg, 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); /* 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 int sisfb_blank(int blank, struct fb_info *info); +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); -// Eden Chen -//void sisfb_clear_DAC(u16 port); -//void sisfb_clear_buffer(PHW_DEVICE_EXTENSION psishw_ext); -// ~Eden Chen +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_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_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 */ #ifdef CONFIG_FB_SIS_300 -static int sisfb_get_dram_size_300 (void); -//extern BOOLEAN SiSInit300(PHW_DEVICE_EXTENSION HwDeviceExtension); -static void sisfb_detect_VB_connect_300 (void); -static void sisfb_get_VB_type_300 (void); -static int sisfb_has_VB_300 (void); -//extern BOOLEAN SiSSetMode(PHW_DEVICE_EXTENSION HwDeviceExtension,USHORT ModeNo); +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); -//extern BOOLEAN SiSInit310(PHW_DEVICE_EXTENSION HwDeviceExtension); -static void sisfb_detect_VB_connect_315 (void); -static void sisfb_get_VB_type_315 (void); -//extern BOOLEAN SiSSetMode310(PHW_DEVICE_EXTENSION HwDeviceExtension, USHORT ModeNo); +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 -/* SetMode routines */ +/* Routines from init.c/init301.c */ -// Eden Chen -extern BOOLEAN SiSSetMode (PSIS_HW_DEVICE_INFO HwDeviceExtension, - USHORT ModeNo); -extern BOOLEAN SiSInit (PSIS_HW_DEVICE_INFO HwDeviceExtension); -// ~Eden Chen +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); -static void sisfb_pre_setmode (void); -static void sisfb_post_setmode (void); -static void sisfb_crtc_to_var (struct fb_var_screeninfo *var); +/* 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 */ -static void sis_get_glyph (struct fb_info *info, SIS_GLYINFO * gly); -void sis_dispinfo (struct ap_data *rec); -void sis_malloc (struct sis_memreq *req); -void sis_free (unsigned long base); +#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); +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); +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); #endif diff --git a/drivers/video/sis/sisfb.h b/drivers/video/sis/sisfb.h new file mode 100644 index 000000000000..2216373d5136 --- /dev/null +++ b/drivers/video/sis/sisfb.h @@ -0,0 +1,153 @@ +#ifndef _LINUX_SISFB +#define _LINUX_SISFB + +#include <asm/ioctl.h> +#include <asm/types.h> + +#define DISPTYPE_CRT1 0x00000008L +#define DISPTYPE_CRT2 0x00000004L +#define DISPTYPE_LCD 0x00000002L +#define DISPTYPE_TV 0x00000001L +#define DISPTYPE_DISP1 DISPTYPE_CRT1 +#define DISPTYPE_DISP2 (DISPTYPE_CRT2 | DISPTYPE_LCD | DISPTYPE_TV) +#define DISPMODE_SINGLE 0x00000020L +#define DISPMODE_MIRROR 0x00000010L +#define DISPMODE_DUALVIEW 0x00000040L + +#define HASVB_NONE 0x00 +#define HASVB_301 0x01 +#define HASVB_LVDS 0x02 +#define HASVB_TRUMPION 0x04 +#define HASVB_LVDS_CHRONTEL 0x10 +#define HASVB_302 0x20 +#define HASVB_303 0x40 +#define HASVB_CHRONTEL 0x80 + +/* TW: *Never* change the order of the following enum */ +typedef enum _SIS_CHIP_TYPE { + SIS_VGALegacy = 0, + SIS_300, + SIS_630, + SIS_540, + SIS_730, + SIS_315H, + SIS_315, + SIS_550, + SIS_315PRO, + SIS_640, + SIS_740, + SIS_650, + SIS_330, + MAX_SIS_CHIP +} SIS_CHIP_TYPE; + +typedef enum _TVTYPE { + TVMODE_NTSC = 0, + TVMODE_PAL, + TVMODE_HIVISION, + TVMODE_TOTAL +} SIS_TV_TYPE; + +typedef enum _TVPLUGTYPE { + TVPLUG_Legacy = 0, + TVPLUG_COMPOSITE, + TVPLUG_SVIDEO, + TVPLUG_SCART, + TVPLUG_TOTAL +} SIS_TV_PLUG; + +struct sis_memreq { + unsigned long offset; + unsigned long size; +}; + +struct mode_info { + int bpp; + int xres; + int yres; + int v_xres; + int v_yres; + int org_x; + int org_y; + unsigned int vrate; +}; + +struct ap_data { + struct mode_info minfo; + unsigned long iobase; + unsigned int mem_size; + unsigned long disp_state; + SIS_CHIP_TYPE chip; + unsigned char hasVB; + SIS_TV_TYPE TV_type; + SIS_TV_PLUG TV_plug; + unsigned long version; + char reserved[256]; +}; + +struct video_info { + int chip_id; + unsigned int video_size; + unsigned long video_base; + char *video_vbase; + unsigned long mmio_base; + char *mmio_vbase; + unsigned long vga_base; + unsigned long mtrr; + unsigned long heapstart; + + int video_bpp; + int video_width; + int video_height; + int video_vwidth; + int video_vheight; + int org_x; + int org_y; + unsigned int refresh_rate; + + unsigned long disp_state; + unsigned char hasVB; + unsigned char TV_type; + unsigned char TV_plug; + + SIS_CHIP_TYPE chip; + unsigned char revision_id; + + char reserved[256]; +}; + + +/* TW: Addtional IOCTL for communication sisfb <> X driver */ +/* 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)) + +/* TW: Structure argument for SISFB_GET_INFO ioctl */ +typedef struct _SISFB_INFO sisfb_info, *psisfb_info; + +struct _SISFB_INFO { + unsigned long sisfb_id; /* for identifying sisfb */ +#ifndef SISFB_ID +#define SISFB_ID 0x53495346 /* Identify myself with 'SISF' */ +#endif + int chip_id; /* PCI ID of detected chip */ + int memory; /* video memory in KB which sisfb manages */ + int heapstart; /* heap start (= sisfb "mem" argument) in KB */ + unsigned char fbvidmode; /* current sisfb mode */ + + unsigned char sisfb_version; + unsigned char sisfb_revision; + unsigned char sisfb_patchlevel; + + char reserved[253]; /* for future use */ +}; + +#ifdef __KERNEL__ +extern struct video_info ivideo; + +extern void sis_malloc(struct sis_memreq *req); +extern void sis_free(unsigned long base); +extern void sis_dispinfo(struct ap_data *rec); +#endif +#endif diff --git a/drivers/video/sis/vgatypes.h b/drivers/video/sis/vgatypes.h index 3fc841f7c57a..2385034e3401 100644 --- a/drivers/video/sis/vgatypes.h +++ b/drivers/video/sis/vgatypes.h @@ -1,6 +1,14 @@ #ifndef _VGATYPES_ #define _VGATYPES_ +#ifdef LINUX_XF86 +#include "xf86Pci.h" +#endif + +#ifdef LINUX_KERNEL /* TW: We don't want the X driver to depend on kernel source */ +#include <linux/ioctl.h> +#endif + #ifndef TC #define far #endif @@ -26,7 +34,7 @@ typedef short SHORT; #endif #ifndef LONG -typedef long LONG; +typedef long LONG; #endif #ifndef UCHAR @@ -68,27 +76,52 @@ typedef UCHAR BOOLEAN; #ifndef bool typedef UCHAR bool; #endif -#endif /* WINCE_HEADER */ +#endif /*WINCE_HEADER*/ #ifndef VBIOS_VER_MAX_LENGTH #define VBIOS_VER_MAX_LENGTH 4 #endif +#ifndef LINUX_KERNEL /* For kernel, this is defined in sisfb.h */ +#ifndef WIN2000 +#ifndef SIS_CHIP_TYPE +typedef enum _SIS_CHIP_TYPE { + SIS_VGALegacy = 0, +#ifdef LINUX_XF86 + SIS_530, /* TW */ + SIS_OLD, /* TW */ +#endif + SIS_300, + SIS_630, + SIS_730, + SIS_540, + SIS_315H, /* SiS 310 */ + SIS_315, + SIS_315PRO, /* SiS 325 */ + SIS_550, + SIS_640, + SIS_740, + SIS_650, + SIS_330, + MAX_SIS_CHIP +} SIS_CHIP_TYPE; +#endif +#endif +#endif + #ifndef WIN2000 #ifndef SIS_VB_CHIP_TYPE typedef enum _SIS_VB_CHIP_TYPE { - VB_CHIP_Legacy = 0, - VB_CHIP_301, - VB_CHIP_301B, - VB_CHIP_301BLCD, - VB_CHIP_301BTV, - VB_CHIP_302, - VB_CHIP_302B, - VB_CHIP_302BLCD, - VB_CHIP_302BTV, - VB_CHIP_303, - VB_CHIP_UNKNOWN, /* other video bridge or no video bridge */ - MAX_VB_CHIP + VB_CHIP_Legacy = 0, + VB_CHIP_301, + VB_CHIP_301B, + VB_CHIP_301LV, + 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; #endif #endif @@ -96,125 +129,169 @@ typedef enum _SIS_VB_CHIP_TYPE { #ifndef WIN2000 #ifndef SIS_LCD_TYPE typedef enum _SIS_LCD_TYPE { - LCD_INVALID = 0, - LCD_800x600, - LCD_1024x768, - LCD_1280x1024, - LCD_1280x960, - LCD_640x480, - LCD_1600x1200, - LCD_1920x1440, - LCD_2048x1536, - LCD_UNKNOWN + LCD_INVALID = 0, + LCD_800x600, + LCD_1024x768, + LCD_1280x1024, + LCD_1280x960, + LCD_640x480, + LCD_1600x1200, + LCD_1920x1440, + LCD_2048x1536, + LCD_320x480, /* TW: FSTN */ + LCD_1400x1050, + LCD_1152x864, + LCD_1152x768, + LCD_1280x768, + LCD_1024x600, + LCD_UNKNOWN } SIS_LCD_TYPE; #endif #endif -#ifndef WIN2000 /* mark by Paul ,Move definition to sisv.h */ +#ifndef WIN2000 /* mark by Paul, Move definition to sisv.h*/ #ifndef PSIS_DSReg -typedef struct _SIS_DSReg { - UCHAR jIdx; - UCHAR jVal; +typedef struct _SIS_DSReg +{ + UCHAR jIdx; + UCHAR jVal; } SIS_DSReg, *PSIS_DSReg; #endif #ifndef SIS_HW_DEVICE_INFO -typedef struct _SIS_HW_DEVICE_INFO SIS_HW_DEVICE_INFO, *PSIS_HW_DEVICE_INFO; - -typedef BOOLEAN (*PSIS_QUERYSPACE) (PSIS_HW_DEVICE_INFO, ULONG, ULONG, ULONG *); - -struct _SIS_HW_DEVICE_INFO { - PVOID pDevice; /* The pointer to the physical device data structure - in each OS or NULL for unused. */ - UCHAR *pjVirtualRomBase; /* Only for NT, NULL for WinCE & Linux. */ - /* base virtual address of VBIOS ROM Space */ - /* or base virtual address of ROM image file. */ - /* if NULL, then read from pjROMImage; */ - /* Note:ROM image file is the file of VBIOS ROM */ - - UCHAR *pjCustomizedROMImage; /* base virtual address of ROM image file. */ - /* wincE:ROM image file is the file for OEM */ - /* customized table */ - /* Linux: not used */ - /* NT : not used */ - /* Note : pjCustomizedROMImage=NULL if no ROM image file */ - - UCHAR *pjVideoMemoryAddress; /* base virtual memory address */ - /* of Linear VGA memory */ - - ULONG ulVideoMemorySize; /* size, in bytes, of the memory on the board */ - ULONG ulIOAddress; /* base I/O address of VGA ports (0x3B0) */ - UCHAR jChipType; /* Used to Identify SiS Graphics Chip */ - /* defined in the data structure type */ - /* "SIS_CHIP_TYPE" */ - - UCHAR jChipRevision; /* Used to Identify SiS Graphics Chip Revision */ - UCHAR ujVBChipID; /* the ID of video bridge */ - /* defined in the data structure type */ - /* "SIS_VB_CHIP_TYPE" */ - - USHORT usExternalChip; /* NO VB or other video bridge(not */ - /* SiS video bridge) */ - /* if ujVBChipID = VB_CHIP_UNKNOWN, */ - /* then bit0=1 : LVDS,bit1=1 : trumpion, */ - /* bit2=1 : CH7005 & no video bridge if */ - /* usExternalChip = 0. */ - /* Note: CR37[3:1]: */ - /* 001:SiS 301 */ - /* 010:LVDS */ - /* 011:Trumpion LVDS Scaling Chip */ - /* 100:LVDS(LCD-out)+Chrontel 7005 */ - /* 101:Single Chrontel 7005 */ - - ULONG ulCRT2LCDType; /* defined in the data structure type */ - /* "SIS_LCD_TYPE" */ - - BOOLEAN bIntegratedMMEnabled; /* supporting integration MM enable */ - - BOOLEAN bSkipDramSizing; /* True: Skip video memory sizing. */ - PSIS_DSReg pSR; /* restore SR registers in initial function. */ - /* end data :(idx, val) = (FF, FF). */ - /* Note : restore SR registers if */ - /* bSkipDramSizing = TRUE */ - - PSIS_DSReg pCR; /* restore CR registers in initial function. */ - /* end data :(idx, val) = (FF, FF) */ - /* Note : restore cR registers if */ - /* bSkipDramSizing = TRUE */ - - PSIS_QUERYSPACE pQueryVGAConfigSpace; /* Get/Set VGA Configuration */ - /* space */ - - PSIS_QUERYSPACE pQueryNorthBridgeSpace; /* Get/Set North Bridge */ - /* space */ - - UCHAR szVBIOSVer[VBIOS_VER_MAX_LENGTH]; +typedef struct _SIS_HW_DEVICE_INFO SIS_HW_DEVICE_INFO, *PSIS_HW_DEVICE_INFO; + +typedef BOOLEAN (*PSIS_QUERYSPACE) (PSIS_HW_DEVICE_INFO, ULONG, ULONG, ULONG *); + + +struct _SIS_HW_DEVICE_INFO +{ + PVOID pDevice; /* The pointer to the physical device data structure + in each OS or NULL for unused. */ + UCHAR *pjVirtualRomBase; /* base virtual address of VBIOS ROM Space */ + /* or base virtual address of ROM image file. */ + /* if NULL, then read from pjROMImage; */ + /* Note:ROM image file is the file of VBIOS ROM */ + + + UCHAR *pjCustomizedROMImage;/* base virtual address of ROM image file. */ + /* wincE:ROM image file is the file for OEM */ + /* customized table */ + /* Linux: not used */ + /* NT : not used */ + /* Note : pjCustomizedROMImage=NULL if no ROM image file */ + + UCHAR *pjVideoMemoryAddress;/* base virtual memory address */ + /* of Linear VGA memory */ + + ULONG ulVideoMemorySize; /* size, in bytes, of the memory on the board */ + ULONG ulIOAddress; /* base I/O address of VGA ports (0x3B0) */ + UCHAR jChipType; /* Used to Identify SiS Graphics Chip */ + /* defined in the data structure type */ + /* "SIS_CHIP_TYPE" */ + + UCHAR jChipRevision; /* Used to Identify SiS Graphics Chip Revision */ + UCHAR ujVBChipID; /* the ID of video bridge */ + /* defined in the data structure type */ + /* "SIS_VB_CHIP_TYPE" */ + + USHORT usExternalChip; /* NO VB or other video bridge(not */ + /* SiS video bridge) */ + /* if ujVBChipID = VB_CHIP_UNKNOWN, */ + /* then bit0=1 : LVDS,bit1=1 : trumpion, */ + /* bit2=1 : CH7005 & no video bridge if */ + /* usExternalChip = 0. */ + /* Note: CR37[3:1]: */ + /* 001:SiS 301 */ + /* 010:LVDS */ + /* 011:Trumpion LVDS Scaling Chip */ + /* 100:LVDS(LCD-out)+Chrontel 7005 */ + /* 101:Single Chrontel 7005 */ + + ULONG ulCRT2LCDType; /* defined in the data structure type */ + /* "SIS_LCD_TYPE" */ + + BOOLEAN bIntegratedMMEnabled;/* supporting integration MM enable */ + + BOOLEAN bSkipDramSizing; /* True: Skip video memory sizing. */ + PSIS_DSReg pSR; /* restore SR registers in initial function. */ + /* end data :(idx, val) = (FF, FF). */ + /* Note : restore SR registers if */ + /* bSkipDramSizing = TRUE */ + + PSIS_DSReg pCR; /* restore CR registers in initial function. */ + /* end data :(idx, val) = (FF, FF) */ + /* Note : restore cR registers if */ + /* bSkipDramSizing = TRUE */ + + PSIS_QUERYSPACE pQueryVGAConfigSpace; /* Get/Set VGA Configuration */ + /* space */ + + PSIS_QUERYSPACE pQueryNorthBridgeSpace;/* Get/Set North Bridge */ + /* space */ + + UCHAR szVBIOSVer[VBIOS_VER_MAX_LENGTH]; + + UCHAR pdc; /* TW: PanelDelayCompensation */ + +#ifdef LINUX_XF86 + PCITAG PciTag; /* PCI Tag for Linux XF86 */ +#endif +}; +#endif +#endif /*~ mark by Paul ,Move definition to sisv.h */ + + +/* TW: Addtional IOCTL for communication sisfb <> X driver */ +/* If changing this, sisfb.h must also be changed (for sisfb) */ + +#ifdef LINUX_XF86 /* We don't want the X driver to depend on the kernel source */ + +/* TW: ioctl for identifying and giving some info (esp. memory heap start) */ +#define SISFB_GET_INFO 0x80046ef8 /* Wow, what a terrible hack... */ + +/* TW: Structure argument for SISFB_GET_INFO ioctl */ +typedef struct _SISFB_INFO sisfb_info, *psisfb_info; + +struct _SISFB_INFO { + unsigned long sisfb_id; /* for identifying sisfb */ +#ifndef SISFB_ID +#define SISFB_ID 0x53495346 /* Identify myself with 'SISF' */ +#endif + int chip_id; /* PCI ID of detected chip */ + int memory; /* video memory in KB which sisfb manages */ + int heapstart; /* heap start (= sisfb "mem" argument) in KB */ + unsigned char fbvidmode; /* current sisfb mode */ + + unsigned char sisfb_version; + unsigned char sisfb_revision; + unsigned char sisfb_patchlevel; + char reserved[253]; /* for future use */ }; #endif -#endif /*~ mark by Paul ,Move definition to sisv.h */ #ifndef WIN2000 #ifndef WINCE_HEADER #ifndef BUS_DATA_TYPE typedef enum _BUS_DATA_TYPE { - ConfigurationSpaceUndefined = -1, - Cmos, - EisaConfiguration, - Pos, - CbusConfiguration, - PCIConfiguration, - VMEConfiguration, - NuBusConfiguration, - PCMCIAConfiguration, - MPIConfiguration, - MPSAConfiguration, - PNPISAConfiguration, - MaximumBusDataType + ConfigurationSpaceUndefined = -1, + Cmos, + EisaConfiguration, + Pos, + CbusConfiguration, + PCIConfiguration, + VMEConfiguration, + NuBusConfiguration, + PCMCIAConfiguration, + MPIConfiguration, + MPSAConfiguration, + PNPISAConfiguration, + MaximumBusDataType } BUS_DATA_TYPE, *PBUS_DATA_TYPE; #endif -#endif /* WINCE_HEADER */ +#endif /* WINCE_HEADER */ #ifndef PCI_TYPE0_ADDRESSES #define PCI_TYPE0_ADDRESSES 6 @@ -227,41 +304,42 @@ typedef enum _BUS_DATA_TYPE { #ifndef WINCE_HEADER #ifndef PCI_COMMON_CONFIG typedef struct _PCI_COMMON_CONFIG { - USHORT VendorID; /* (ro) */ - USHORT DeviceID; /* (ro) */ - USHORT Command; /* Device control */ - USHORT Status; - UCHAR RevisionID; /* (ro) */ - UCHAR ProgIf; /* (ro) */ - UCHAR SubClass; /* (ro) */ - UCHAR BaseClass; /* (ro) */ - UCHAR CacheLineSize; /* (ro+) */ - UCHAR LatencyTimer; /* (ro+) */ - UCHAR HeaderType; /* (ro) */ - UCHAR BIST; /* Built in self test */ - - union { - struct _PCI_HEADER_TYPE_0 { - ULONG BaseAddresses[PCI_TYPE0_ADDRESSES]; - ULONG CIS; - USHORT SubVendorID; - USHORT SubSystemID; - ULONG ROMBaseAddress; - ULONG Reserved2[2]; - - UCHAR InterruptLine; /* */ - UCHAR InterruptPin; /* (ro) */ - UCHAR MinimumGrant; /* (ro) */ - UCHAR MaximumLatency; /* (ro) */ - } type0; - - } u; - - UCHAR DeviceSpecific[192]; + USHORT VendorID; /* (ro) */ + USHORT DeviceID; /* (ro) */ + USHORT Command; /* Device control */ + USHORT Status; + UCHAR RevisionID; /* (ro) */ + UCHAR ProgIf; /* (ro) */ + UCHAR SubClass; /* (ro) */ + UCHAR BaseClass; /* (ro) */ + UCHAR CacheLineSize; /* (ro+) */ + UCHAR LatencyTimer; /* (ro+) */ + UCHAR HeaderType; /* (ro) */ + UCHAR BIST; /* Built in self test */ + + union { + struct _PCI_HEADER_TYPE_0 { + ULONG BaseAddresses[PCI_TYPE0_ADDRESSES]; + ULONG CIS; + USHORT SubVendorID; + USHORT SubSystemID; + ULONG ROMBaseAddress; + ULONG Reserved2[2]; + + UCHAR InterruptLine; /* */ + UCHAR InterruptPin; /* (ro) */ + UCHAR MinimumGrant; /* (ro) */ + UCHAR MaximumLatency; /* (ro) */ + } type0; + + + } u; + + UCHAR DeviceSpecific[192]; } PCI_COMMON_CONFIG, *PPCI_COMMON_CONFIG; #endif -#endif /* WINCE_HEADER */ +#endif /* WINCE_HEADER */ #ifndef FIELD_OFFSET #define FIELD_OFFSET(type, field) ((LONG)&(((type *)0)->field)) diff --git a/drivers/video/sis/vstruct.h b/drivers/video/sis/vstruct.h index 29f86daf97e1..e903f420406f 100644 --- a/drivers/video/sis/vstruct.h +++ b/drivers/video/sis/vstruct.h @@ -2,13 +2,15 @@ #define EXTERN #else #define EXTERN extern -#endif /* _INIT_ */ +#endif /* _INIT_ */ -typedef struct _SiS_PanelDelayTblStruct { - UCHAR timer[2]; +typedef struct _SiS_PanelDelayTblStruct +{ + UCHAR timer[2]; } SiS_PanelDelayTblStruct; -typedef struct _SiS_LCDDataStruct { +typedef struct _SiS_LCDDataStruct +{ USHORT RVBHCMAX; USHORT RVBHCFACT; USHORT VGAHT; @@ -17,7 +19,8 @@ typedef struct _SiS_LCDDataStruct { USHORT LCDVT; } SiS_LCDDataStruct; -typedef struct _SiS_TVDataStruct { +typedef struct _SiS_TVDataStruct +{ USHORT RVBHCMAX; USHORT RVBHCFACT; USHORT VGAHT; @@ -33,32 +36,38 @@ typedef struct _SiS_TVDataStruct { UCHAR RY4COE; } SiS_TVDataStruct; -typedef struct _SiS_LVDSDataStruct { +typedef struct _SiS_LVDSDataStruct +{ USHORT VGAHT; USHORT VGAVT; USHORT LCDHT; USHORT LCDVT; } SiS_LVDSDataStruct; -typedef struct _SiS_LVDSDesStruct { +typedef struct _SiS_LVDSDesStruct +{ USHORT LCDHDES; USHORT LCDVDES; } SiS_LVDSDesStruct; -typedef struct _SiS_LVDSCRT1DataStruct { +typedef struct _SiS_LVDSCRT1DataStruct +{ UCHAR CR[15]; } SiS_LVDSCRT1DataStruct; /*add for LCDA*/ -typedef struct _SiS_LCDACRT1DataStruct { +typedef struct _SiS_LCDACRT1DataStruct +{ UCHAR CR[17]; } SiS_LCDACRT1DataStruct; -typedef struct _SiS_CHTVRegDataStruct { - UCHAR Reg[5]; +typedef struct _SiS_CHTVRegDataStruct +{ + UCHAR Reg[16]; } SiS_CHTVRegDataStruct; -typedef struct _SiS_StStruct { +typedef struct _SiS_StStruct +{ UCHAR St_ModeID; USHORT St_ModeFlag; UCHAR St_StTableIndex; @@ -69,18 +78,20 @@ typedef struct _SiS_StStruct { UCHAR VB_StTVYFilterIndex; } SiS_StStruct; -typedef struct _SiS_VBModeStruct { - UCHAR ModeID; - UCHAR VB_TVDelayIndex; - UCHAR VB_TVFlickerIndex; - UCHAR VB_TVPhaseIndex; - UCHAR VB_TVYFilterIndex; - UCHAR VB_LCDDelayIndex; - UCHAR _VB_LCDHIndex; - UCHAR _VB_LCDVIndex; +typedef struct _SiS_VBModeStruct +{ + UCHAR ModeID; + UCHAR VB_TVDelayIndex; + UCHAR VB_TVFlickerIndex; + UCHAR VB_TVPhaseIndex; + UCHAR VB_TVYFilterIndex; + UCHAR VB_LCDDelayIndex; + UCHAR _VB_LCDHIndex; + UCHAR _VB_LCDVIndex; } SiS_VBModeStruct; -typedef struct _SiS_StandTableStruct { +typedef struct _SiS_StandTableStruct +{ UCHAR CRT_COLS; UCHAR ROWS; UCHAR CHAR_HEIGHT; @@ -92,7 +103,8 @@ typedef struct _SiS_StandTableStruct { UCHAR GRC[9]; } SiS_StandTableStruct; -typedef struct _SiS_ExtStruct { +typedef struct _SiS_ExtStruct +{ UCHAR Ext_ModeID; USHORT Ext_ModeFlag; USHORT Ext_ModeInfo; @@ -106,65 +118,79 @@ typedef struct _SiS_ExtStruct { UCHAR REFindex; } SiS_ExtStruct; -typedef struct _SiS_Ext2Struct { +typedef struct _SiS_Ext2Struct +{ USHORT Ext_InfoFlag; UCHAR Ext_CRT1CRTC; UCHAR Ext_CRTVCLK; UCHAR Ext_CRT2CRTC; - UCHAR ModeID; + UCHAR ModeID; USHORT XRes; USHORT YRes; USHORT ROM_OFFSET; } SiS_Ext2Struct; -typedef struct _SiS_CRT1TableStruct { +typedef struct _SiS_Part2PortTblStruct +{ + UCHAR CR[12]; +} SiS_Part2PortTblStruct; + +typedef struct _SiS_CRT1TableStruct +{ UCHAR CR[17]; } SiS_CRT1TableStruct; -typedef struct _SiS_MCLKDataStruct { - UCHAR SR28, SR29, SR2A; +typedef struct _SiS_MCLKDataStruct +{ + UCHAR SR28,SR29,SR2A; USHORT CLOCK; } SiS_MCLKDataStruct; -typedef struct _SiS_ECLKDataStruct { - UCHAR SR2E, SR2F, SR30; +typedef struct _SiS_ECLKDataStruct +{ + UCHAR SR2E,SR2F,SR30; USHORT CLOCK; } SiS_ECLKDataStruct; -typedef struct _SiS_VCLKDataStruct { - UCHAR SR2B, SR2C; +typedef struct _SiS_VCLKDataStruct +{ + UCHAR SR2B,SR2C; USHORT CLOCK; } SiS_VCLKDataStruct; -typedef struct _SiS_VBVCLKDataStruct { - UCHAR Part4_A, Part4_B; +typedef struct _SiS_VBVCLKDataStruct +{ + UCHAR Part4_A,Part4_B; USHORT CLOCK; } SiS_VBVCLKDataStruct; -typedef struct _SiS_StResInfoStruct { +typedef struct _SiS_StResInfoStruct +{ USHORT HTotal; USHORT VTotal; } SiS_StResInfoStruct; -typedef struct _SiS_ModeResInfoStruct { +typedef struct _SiS_ModeResInfoStruct +{ USHORT HTotal; USHORT VTotal; - UCHAR XChar; - UCHAR YChar; + UCHAR XChar; + 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_ExtStruct *SiS_EModeIDTable; +EXTERN SiS_Ext2Struct *SiS_RefIndex; EXTERN SiS_VBModeStruct *SiS_VBModeIDTable; -EXTERN SiS_CRT1TableStruct *SiS_CRT1Table; -EXTERN SiS_MCLKDataStruct *SiS_MCLKData; -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 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; @@ -172,8 +198,8 @@ 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 DRAM4Type *SiS_SR15; /* pointer : point to array */ +EXTERN DRAM4Type *SiS_CR40; /* pointer : point to array */ EXTERN UCHAR *SiS_CR49; EXTERN UCHAR *SiS_SR25; @@ -192,7 +218,7 @@ 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_RGBSenseData2; /*301b*/ EXTERN USHORT *pSiS_VideoSenseData2; EXTERN USHORT *pSiS_YCSenseData2; @@ -202,21 +228,24 @@ EXTERN UCHAR *SiS_NTSCPhase2; EXTERN UCHAR *SiS_PALPhase2; EXTERN UCHAR *SiS_PALMPhase; EXTERN UCHAR *SiS_PALNPhase; -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_NoScaleData; -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_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; @@ -228,91 +257,125 @@ EXTERN UCHAR *SiS_HiTVGroup3Simu; EXTERN UCHAR *SiS_HiTVGroup3Text; EXTERN SiS_PanelDelayTblStruct *SiS_PanelDelayTbl; -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_LVDS640x480Data_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; -/*301b*/ -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; -/*end 301b*/ -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_LVDSCRT1800x600_1_H; -EXTERN SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x768_1_H; -EXTERN SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11280x1024_1_H; -EXTERN SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1800x600_2; -EXTERN SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x768_2; -EXTERN SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11280x1024_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_CHTVCRT1UNTSC; -EXTERN SiS_LVDSCRT1DataStruct *SiS_CHTVCRT1ONTSC; -EXTERN SiS_LVDSCRT1DataStruct *SiS_CHTVCRT1UPAL; -EXTERN SiS_LVDSCRT1DataStruct *SiS_CHTVCRT1OPAL; -/*add for LCDA*/ -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; -/*end 301b*/ +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; @@ -322,3 +385,6 @@ EXTERN UCHAR *SiS_CHTVVCLKUNTSC; EXTERN UCHAR *SiS_CHTVVCLKONTSC; EXTERN UCHAR *SiS_CHTVVCLKUPAL; EXTERN UCHAR *SiS_CHTVVCLKOPAL; + + + |
