From 544393fe584d333480659a4bed30f5295355df11 Mon Sep 17 00:00:00 2001 From: Thomas Winischhofer Date: Fri, 9 Sep 2005 13:04:45 -0700 Subject: [PATCH] sisfb update This lifts sisfb from version 1.7.17 to version 1.8.9. Changes include: - Added support for XGI V3XT, V5, V8, Z7 chipsets, including POSTing of all of these chipsets. - Added support for latest SiS chipsets (761). - Added support for SiS76x memory "hybrid" mode. - Added support for new LCD resolutions (eg 1280x854, 856x480). - Fixed support for 320x240 STN panels (for embedded devices). - Fixed many HDTV modes (525p, 750p, 1080i). - Fixed PCI config register reading/writing to use proper kernel functions for this purpose. - Fixed PCI ROM handling to use the kernel's proper functions. - Removed lots of "typedef"s. - Removed lots of code which was for X.org/XFree86 only. - Fixed coding style in many places. - Removed lots of 2.4 cruft. - Reduced stack size by unifying two previously separate structs into one. - Added new hooks for memory allocation (for DRM). Now the driver can truly handle multiple cards, including memory management. - Fixed numerous minor bugs. Signed-off-by: Thomas Winischhofer Cc: "Antonino A. Daplas" Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/Kconfig | 14 +- drivers/video/sis/300vtbl.h | 1363 +----- drivers/video/sis/310vtbl.h | 2125 ++------- drivers/video/sis/Makefile | 2 +- drivers/video/sis/init.c | 5649 ++++++++++------------- drivers/video/sis/init.h | 1732 ++----- drivers/video/sis/init301.c | 9668 ++++++++++++++++++---------------------- drivers/video/sis/init301.h | 351 +- drivers/video/sis/initdef.h | 145 +- drivers/video/sis/initextlfb.c | 238 + drivers/video/sis/oem300.h | 335 +- drivers/video/sis/oem310.h | 421 +- drivers/video/sis/osdef.h | 27 +- drivers/video/sis/sis.h | 746 ++-- drivers/video/sis/sis_accel.c | 479 +- drivers/video/sis/sis_accel.h | 9 +- drivers/video/sis/sis_main.c | 7839 ++++++++++++++++++-------------- drivers/video/sis/sis_main.h | 602 +-- drivers/video/sis/vgatypes.h | 155 +- drivers/video/sis/vstruct.h | 1097 ++--- 20 files changed, 14425 insertions(+), 18572 deletions(-) create mode 100644 drivers/video/sis/initextlfb.c (limited to 'drivers') diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 544c717c6ee4..e906b5421795 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -1079,15 +1079,16 @@ config FB_SAVAGE_ACCEL choose N here. config FB_SIS - tristate "SiS acceleration" + tristate "SiS/XGI display support" depends on FB && PCI select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT select FB_SOFT_CURSOR help - This is the frame buffer device driver for the SiS 300, 315 and - 330 series VGA chipsets. Specs available at + This is the frame buffer device driver for the SiS 300, 315, 330 + and 340 series as well as XGI V3XT, V5, V8, Z7 graphics chipsets. + Specs available at and . To compile this driver as a module, choose M here; the module will be called sisfb. @@ -1099,11 +1100,12 @@ config FB_SIS_300 Say Y here to support use of the SiS 300/305, 540, 630 and 730. config FB_SIS_315 - bool "SiS 315/330 series support" + bool "SiS 315/330/340 series and XGI support" depends on FB_SIS help - Say Y here to support use of the SiS 315 and 330 series - (315/H/PRO, 55x, 650, 651, 740, 330, 661, 741, 760). + Say Y here to support use of the SiS 315, 330 and 340 series + (315/H/PRO, 55x, 650, 651, 740, 330, 661, 741, 760, 761) as well + as XGI V3XT, V5, V8 and Z7. config FB_NEOMAGIC tristate "NeoMagic display support" diff --git a/drivers/video/sis/300vtbl.h b/drivers/video/sis/300vtbl.h index b6d5c71b2563..e4b4a2626da4 100644 --- a/drivers/video/sis/300vtbl.h +++ b/drivers/video/sis/300vtbl.h @@ -3,7 +3,7 @@ /* * Register settings for SiS 300 series * - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria * * If distributed as part of the Linux kernel, the following license terms * apply: @@ -50,31 +50,7 @@ * */ -static const SiS_StStruct SiS300_SModeIDTable[] = -{ - {0x01,0x9208,0x01,0x00,0x00,0x00,0x00,0x00, 0}, - {0x01,0x1210,0x14,0x01,0x01,0x00,0x00,0x00, 0}, - {0x01,0x1010,0x17,0x02,0x02,0x00,0x00,0x00, 0}, - {0x03,0x8208,0x03,0x00,0x00,0x00,0x00,0x00, 0}, - {0x03,0x0210,0x16,0x01,0x01,0x00,0x00,0x00, 0}, - {0x03,0x0010,0x18,0x02,0x02,0x00,0x00,0x00, 0}, - {0x05,0x9209,0x05,0x00,0x00,0x00,0x00,0x00, 0}, - {0x06,0x8209,0x06,0x00,0x00,0x00,0x00,0x00, 0}, - {0x07,0x0000,0x07,0x03,0x03,0x00,0x00,0x00, 0}, - {0x07,0x0000,0x19,0x02,0x02,0x00,0x00,0x00, 0}, - {0x0d,0x920a,0x0d,0x00,0x00,0x00,0x00,0x00, 0}, - {0x0e,0x820a,0x0e,0x00,0x00,0x00,0x00,0x00, 0}, - {0x0f,0x0202,0x11,0x01,0x01,0x00,0x00,0x00, 0}, - {0x10,0x0212,0x12,0x01,0x01,0x00,0x00,0x00, 0}, - {0x11,0x0212,0x1a,0x04,0x04,0x00,0x00,0x00, 0}, - {0x12,0x0212,0x1b,0x04,0x04,0x00,0x00,0x00, 0}, - {0x13,0x021b,0x1c,0x00,0x00,0x00,0x00,0x00, 0}, - {0x12,0x0010,0x18,0x02,0x02,0x00,0x00,0x00, 0}, - {0x12,0x0210,0x18,0x01,0x01,0x00,0x00,0x00, 0}, - {0xff, 0, 0, 0, 0, 0, 0, 0, 0} -}; - -static const SiS_ExtStruct SiS300_EModeIDTable[] = +static const struct SiS_Ext SiS300_EModeIDTable[] = { {0x6a,0x2212,0x0102,SIS_RI_800x600, 0x00,0x00,0x00,0x00,0x00,-1}, /* 800x600x? */ {0x2e,0x0a1b,0x0101,SIS_RI_640x480, 0x00,0x00,0x00,0x00,0x08,-1}, @@ -110,7 +86,7 @@ static const SiS_ExtStruct SiS300_EModeIDTable[] = {0x59,0x921b,0x0138,SIS_RI_320x200, 0x00,0x00,0x00,0x00,0x23,-1}, /* 320x200x8 */ {0x5c,0x921f,0x0000,SIS_RI_512x384, 0x00,0x00,0x00,0x00,0x26,-1}, /* 512x384x32 */ {0x5d,0x021d,0x0139,SIS_RI_640x400, 0x00,0x00,0x00,0x00,0x10,-1}, /* 640x400x16 */ - {0x5e,0x021f,0x0000,SIS_RI_640x400, 0x00,0x00,0x00,0x00,0x10,-1}, /* 640x400x32 */ + {0x5e,0x021f,0x0000,SIS_RI_640x400, 0x00,0x00,0x00,0x00,0x10,-1}, /* 640x400x32 */ {0x62,0x0a3f,0x013a,SIS_RI_640x480, 0x00,0x00,0x00,0x00,0x08,-1}, {0x63,0x2a3f,0x013b,SIS_RI_800x600, 0x00,0x00,0x00,0x00,0x00,-1}, /* 800x600x32 */ {0x64,0x0a7f,0x013c,SIS_RI_1024x768, 0x00,0x00,0x00,0x00,0x13,-1}, @@ -119,8 +95,8 @@ static const SiS_ExtStruct SiS300_EModeIDTable[] = {0x68,0x067b,0x013f,SIS_RI_1920x1440,0x00,0x00,0x00,0x00,0x27,-1}, {0x69,0x06fd,0x0140,SIS_RI_1920x1440,0x00,0x00,0x00,0x00,0x27,-1}, {0x6b,0x07ff,0x0000,SIS_RI_1920x1440,0x00,0x00,0x00,0x00,0x27,-1}, - {0x6c,0x067b,0x0000,SIS_RI_2048x1536,0x00,0x00,0x00,0x00,0x28,-1}, /* 2048x1536x8 - not in BIOS! */ - {0x6d,0x06fd,0x0000,SIS_RI_2048x1536,0x00,0x00,0x00,0x00,0x28,-1}, /* 2048x1536x16 - not in BIOS! */ + {0x6c,0x067b,0x0000,SIS_RI_2048x1536,0x00,0x00,0x00,0x00,0x28,-1}, /* 2048x1536x8 */ + {0x6d,0x06fd,0x0000,SIS_RI_2048x1536,0x00,0x00,0x00,0x00,0x28,-1}, /* 2048x1536x16 */ {0x70,0x6a1b,0x0000,SIS_RI_800x480, 0x00,0x00,0x07,0x00,0x2d,-1}, /* 800x480x8 */ {0x71,0x4a1b,0x0000,SIS_RI_1024x576, 0x00,0x00,0x00,0x00,0x30,-1}, /* 1024x576x8 */ {0x74,0x4a1d,0x0000,SIS_RI_1024x576, 0x00,0x00,0x00,0x00,0x30,-1}, /* 1024x576x16 */ @@ -166,77 +142,77 @@ static const SiS_ExtStruct SiS300_EModeIDTable[] = {0xff,0x0000,0xffff,0, 0x00,0x00,0x00,0x00,0x00} }; -static const SiS_Ext2Struct SiS300_RefIndex[] = -{ - {0x085f,0x0d,0x03,0x05,0x05,0x6a, 800, 600, 0}, /* 00 */ - {0x0467,0x0e,0x44,0x05,0x05,0x6a, 800, 600, 0}, /* 01 */ - {0x0067,0x0f,0x07,0x48,0x05,0x6a, 800, 600, 0}, /* 02 - CRT1CRTC was 0x4f */ - {0x0067,0x10,0x06,0x8b,0x05,0x6a, 800, 600, 0}, /* 03 */ - {0x0147,0x11,0x08,0x00,0x05,0x6a, 800, 600, 0}, /* 04 */ - {0x0147,0x12,0x0c,0x00,0x05,0x6a, 800, 600, 0}, /* 05 */ - {0x0047,0x11,0x4e,0x00,0x05,0x6a, 800, 600, 0}, /* 06 - CRT1CRTC was 0x51 */ - {0x0047,0x11,0x13,0x00,0x05,0x6a, 800, 600, 0}, /* 07 */ - {0xc85f,0x05,0x00,0x04,0x04,0x2e, 640, 480, 0}, /* 08 */ - {0xc067,0x06,0x02,0x04,0x04,0x2e, 640, 480, 0}, /* 09 */ - {0xc067,0x07,0x02,0x47,0x04,0x2e, 640, 480, 0}, /* 0a */ - {0xc067,0x08,0x03,0x8a,0x04,0x2e, 640, 480, 0}, /* 0b */ - {0xc047,0x09,0x05,0x00,0x04,0x2e, 640, 480, 0}, /* 0c */ - {0xc047,0x0a,0x08,0x00,0x04,0x2e, 640, 480, 0}, /* 0d */ - {0xc047,0x0b,0x0a,0x00,0x04,0x2e, 640, 480, 0}, /* 0e */ - {0xc047,0x0c,0x10,0x00,0x04,0x2e, 640, 480, 0}, /* 0f */ - {0x487f,0x04,0x00,0x00,0x00,0x2f, 640, 400, 0}, /* 10 */ - {0xc06f,0x31,0x01,0x06,0x13,0x31, 720, 480, 0}, /* 11 */ - {0x006f,0x32,0x03,0x06,0x14,0x32, 720, 576, 0}, /* 12 */ - {0x0187,0x15,0x05,0x00,0x06,0x37,1024, 768, 0}, /* 13 */ - {0xc877,0x16,0x09,0x06,0x06,0x37,1024, 768, 0}, /* 14 */ - {0xc067,0x17,0x0b,0x49,0x06,0x37,1024, 768, 0}, /* 15 - CRT1CRTC was 0x97 */ - {0x0267,0x18,0x0d,0x00,0x06,0x37,1024, 768, 0}, /* 16 */ - {0x0047,0x19,0x11,0x8c,0x06,0x37,1024, 768, 0}, /* 17 - CRT1CRTC was 0x59 */ - {0x0047,0x1a,0x52,0x00,0x06,0x37,1024, 768, 0}, /* 18 */ - {0x0007,0x1b,0x16,0x00,0x06,0x37,1024, 768, 0}, /* 19 - CRT1CRTC was 0x5b */ - {0x0387,0x1c,0x4d,0x00,0x07,0x3a,1280,1024, 0}, /* 1a - CRT1CRTC was 0x5c */ - {0x0077,0x1d,0x14,0x07,0x07,0x3a,1280,1024, 0}, /* 1b */ - {0x0047,0x1e,0x17,0x00,0x07,0x3a,1280,1024, 0}, /* 1c */ - {0x0007,0x1f,0x98,0x00,0x07,0x3a,1280,1024, 0}, /* 1d */ - {0x0007,0x20,0x59,0x00,0x00,0x3c,1600,1200, 0}, /* 1e - CRT1CRTC was 0x60 */ - {0x0007,0x21,0x5a,0x00,0x00,0x3c,1600,1200, 0}, /* 1f */ - {0x0007,0x22,0x1b,0x00,0x00,0x3c,1600,1200, 0}, /* 20 */ - {0x0007,0x23,0x1d,0x00,0x00,0x3c,1600,1200, 0}, /* 21 - CRT1CRTC was 0x63 */ - {0x0007,0x24,0x1e,0x00,0x00,0x3c,1600,1200, 0}, /* 22 */ - {0x407f,0x00,0x00,0x00,0x00,0x40, 320, 200, 0}, /* 23 */ - {0xc07f,0x01,0x00,0x04,0x04,0x50, 320, 240, 0}, /* 24 */ - {0x0077,0x02,0x04,0x05,0x05,0x51, 400, 300, 0}, /* 25 */ - {0xc877,0x03,0x09,0x06,0x06,0x52, 512, 384, 0}, /* 26 */ /* was c077 */ - {0x8207,0x25,0x1f,0x00,0x00,0x68,1920,1440, 0}, /* 27 */ - {0x0007,0x26,0x20,0x00,0x00,0x6c,2048,1536, 0}, /* 28 */ - {0x0067,0x27,0x14,0x08,0x0a,0x6e,1280, 960, 0}, /* 29 - 1280x960-60 */ - {0x0027,0x45,0x3c,0x08,0x0a,0x6e,1280, 960, 0}, /* 2a - 1280x960-85 */ - {0xc077,0x33,0x09,0x06,0x00,0x20,1024, 600, 0}, /* 2b */ - {0xc077,0x34,0x0b,0x06,0x00,0x23,1152, 768, 0}, /* 2c */ /* VCLK 0x09 */ - {0x0077,0x35,0x27,0x08,0x18,0x70, 800, 480, 0}, /* 2d */ - {0x0047,0x36,0x37,0x08,0x18,0x70, 800, 480, 0}, /* 2e */ - {0x0047,0x37,0x08,0x08,0x18,0x70, 800, 480, 0}, /* 2f */ - {0x0077,0x38,0x09,0x09,0x19,0x71,1024, 576, 0}, /* 30 */ - {0x0047,0x39,0x38,0x09,0x19,0x71,1024, 576, 0}, /* 31 */ - {0x0047,0x3a,0x11,0x09,0x19,0x71,1024, 576, 0}, /* 32 */ - {0x0077,0x3b,0x39,0x0a,0x0c,0x75,1280, 720, 0}, /* 33 */ - {0x0047,0x3c,0x3a,0x0a,0x0c,0x75,1280, 720, 0}, /* 34 */ - {0x0007,0x3d,0x3b,0x0a,0x0c,0x75,1280, 720, 0}, /* 35 */ - {0x0067,0x49,0x35,0x06,0x1a,0x29,1152, 864, 0}, /* 36 1152x864-60Hz */ - {0x0067,0x3e,0x34,0x06,0x1a,0x29,1152, 864, 0}, /* 37 1152x864-75Hz */ - {0x0047,0x44,0x3a,0x06,0x1a,0x29,1152, 864, 0}, /* 38 1152x864-85Hz */ - {0x00c7,0x3f,0x28,0x00,0x16,0x39, 848, 480, 0}, /* 39 848x480-38Hzi */ - {0xc067,0x40,0x3d,0x0b,0x16,0x39, 848, 480, 0}, /* 3a 848x480-60Hz */ - {0x00c7,0x41,0x28,0x00,0x17,0x3f, 856, 480, 0}, /* 3b 856x480-38Hzi */ - {0xc047,0x42,0x28,0x00,0x17,0x3f, 856, 480, 0}, /* 3c 856x480-60Hz */ - {0x0067,0x43,0x3e,0x0c,0x1b,0x48,1360, 768, 0}, /* 3d 1360x768-60Hz */ - {0x0077,0x46,0x3f,0x08,0x08,0x55,1280, 768, 0}, /* 3e 1280x768-60Hz */ - {0x006f,0x47,0x03,0x06,0x15,0x5f, 768, 576, 0}, /* 3f 768x576 */ - {0x0027,0x48,0x13,0x08,0x00,0x67,1360,1024, 0}, /* 40 1360x1024-59Hz (BARCO1366 only) */ - {0xffff, 0, 0, 0, 0, 0, 0, 0, 0} -}; - -static const SiS_VBModeStruct SiS300_VBModeIDTable[] = +static const struct SiS_Ext2 SiS300_RefIndex[] = +{ + {0x085f,0x0d,0x03,0x05,0x05,0x6a, 800, 600, 0, 0x00, 0x00}, /* 00 */ + {0x0467,0x0e,0x04,0x05,0x05,0x6a, 800, 600, 0, 0x00, 0x00}, /* 01 */ + {0x0067,0x0f,0x07,0x48,0x05,0x6a, 800, 600, 0, 0x00, 0x00}, /* 02 - CRT1CRTC was 0x4f */ + {0x0067,0x10,0x06,0x8b,0x05,0x6a, 800, 600, 0, 0x00, 0x00}, /* 03 */ + {0x0147,0x11,0x08,0x00,0x05,0x6a, 800, 600, 0, 0x00, 0x00}, /* 04 */ + {0x0147,0x12,0x0c,0x00,0x05,0x6a, 800, 600, 0, 0x00, 0x00}, /* 05 */ + {0x0047,0x11,0x0e,0x00,0x05,0x6a, 800, 600, 0, 0x00, 0x00}, /* 06 - CRT1CRTC was 0x51 */ + {0x0047,0x11,0x13,0x00,0x05,0x6a, 800, 600, 0, 0x00, 0x00}, /* 07 */ + {0xc85f,0x05,0x00,0x04,0x04,0x2e, 640, 480, 0, 0x00, 0x00}, /* 08 */ + {0xc067,0x06,0x02,0x04,0x04,0x2e, 640, 480, 0, 0x00, 0x00}, /* 09 */ + {0xc067,0x07,0x02,0x47,0x04,0x2e, 640, 480, 0, 0x00, 0x00}, /* 0a */ + {0xc067,0x08,0x03,0x8a,0x04,0x2e, 640, 480, 0, 0x00, 0x00}, /* 0b */ + {0xc047,0x09,0x05,0x00,0x04,0x2e, 640, 480, 0, 0x00, 0x00}, /* 0c */ + {0xc047,0x0a,0x08,0x00,0x04,0x2e, 640, 480, 0, 0x00, 0x00}, /* 0d */ + {0xc047,0x0b,0x0a,0x00,0x04,0x2e, 640, 480, 0, 0x00, 0x00}, /* 0e */ + {0xc047,0x0c,0x10,0x00,0x04,0x2e, 640, 480, 0, 0x00, 0x00}, /* 0f */ + {0x487f,0x04,0x00,0x00,0x00,0x2f, 640, 400, 0, 0x4a, 0x49}, /* 10 */ + {0xc06f,0x31,0x01,0x06,0x13,0x31, 720, 480, 0, 0x00, 0x00}, /* 11 */ + {0x006f,0x32,0x4a,0x06,0x14,0x32, 720, 576, 0, 0x00, 0x00}, /* 12 */ /* 4a was 03 */ + {0x0187,0x15,0x05,0x00,0x06,0x37,1024, 768, 0, 0x00, 0x00}, /* 13 */ + {0xc877,0x16,0x09,0x06,0x06,0x37,1024, 768, 0, 0x00, 0x00}, /* 14 */ + {0xc067,0x17,0x0b,0x49,0x06,0x37,1024, 768, 0, 0x00, 0x00}, /* 15 - CRT1CRTC was 0x97 */ + {0x0267,0x18,0x0d,0x00,0x06,0x37,1024, 768, 0, 0x00, 0x00}, /* 16 */ + {0x0047,0x19,0x11,0x8c,0x06,0x37,1024, 768, 0, 0x00, 0x00}, /* 17 - CRT1CRTC was 0x59 */ + {0x0047,0x1a,0x12,0x00,0x06,0x37,1024, 768, 0, 0x00, 0x00}, /* 18 */ + {0x0007,0x1b,0x16,0x00,0x06,0x37,1024, 768, 0, 0x00, 0x00}, /* 19 - CRT1CRTC was 0x5b */ + {0x0387,0x1c,0x0d,0x00,0x07,0x3a,1280,1024, 0, 0x00, 0x00}, /* 1a - CRT1CRTC was 0x5c */ + {0x0077,0x1d,0x14,0x07,0x07,0x3a,1280,1024, 0, 0x00, 0x00}, /* 1b */ + {0x0047,0x1e,0x17,0x00,0x07,0x3a,1280,1024, 0, 0x00, 0x00}, /* 1c */ + {0x0007,0x1f,0x18,0x00,0x07,0x3a,1280,1024, 0, 0x00, 0x00}, /* 1d */ + {0x0007,0x20,0x19,0x00,0x00,0x3c,1600,1200, 0, 0x00, 0x00}, /* 1e - CRT1CRTC was 0x60 */ + {0x0007,0x21,0x1a,0x00,0x00,0x3c,1600,1200, 0, 0x00, 0x00}, /* 1f */ + {0x0007,0x22,0x1b,0x00,0x00,0x3c,1600,1200, 0, 0x00, 0x00}, /* 20 */ + {0x0007,0x23,0x1d,0x00,0x00,0x3c,1600,1200, 0, 0x00, 0x00}, /* 21 - CRT1CRTC was 0x63 */ + {0x0007,0x24,0x1e,0x00,0x00,0x3c,1600,1200, 0, 0x00, 0x00}, /* 22 */ + {0x407f,0x00,0x00,0x00,0x00,0x40, 320, 200, 0, 0x4b, 0x4b}, /* 23 */ + {0xc07f,0x01,0x00,0x04,0x04,0x50, 320, 240, 0, 0x00, 0x00}, /* 24 */ + {0x0077,0x02,0x04,0x05,0x05,0x51, 400, 300, 0, 0x00, 0x00}, /* 25 */ + {0xc877,0x03,0x09,0x06,0x06,0x52, 512, 384, 0, 0x00, 0x00}, /* 26 */ /* was c077 */ + {0x8207,0x25,0x1f,0x00,0x00,0x68,1920,1440, 0, 0x00, 0x00}, /* 27 */ + {0x0007,0x26,0x20,0x00,0x00,0x6c,2048,1536, 0, 0x00, 0x00}, /* 28 */ + {0x0067,0x27,0x14,0x08,0x0a,0x6e,1280, 960, 0, 0x00, 0x00}, /* 29 - 1280x960-60 */ + {0x0027,0x45,0x3c,0x08,0x0a,0x6e,1280, 960, 0, 0x00, 0x00}, /* 2a - 1280x960-85 */ + {0xc077,0x33,0x09,0x06,0x00,0x20,1024, 600, 0, 0x00, 0x00}, /* 2b */ + {0xc077,0x34,0x0b,0x06,0x00,0x23,1152, 768, 0, 0x00, 0x00}, /* 2c */ /* VCLK 0x09 */ + {0x0077,0x35,0x27,0x08,0x18,0x70, 800, 480, 0, 0x00, 0x00}, /* 2d */ + {0x0047,0x36,0x37,0x08,0x18,0x70, 800, 480, 0, 0x00, 0x00}, /* 2e */ + {0x0047,0x37,0x08,0x08,0x18,0x70, 800, 480, 0, 0x00, 0x00}, /* 2f */ + {0x0077,0x38,0x09,0x09,0x19,0x71,1024, 576, 0, 0x00, 0x00}, /* 30 */ + {0x0047,0x39,0x38,0x09,0x19,0x71,1024, 576, 0, 0x00, 0x00}, /* 31 */ + {0x0047,0x3a,0x11,0x09,0x19,0x71,1024, 576, 0, 0x00, 0x00}, /* 32 */ + {0x0077,0x3b,0x39,0x0a,0x0c,0x75,1280, 720, 0, 0x00, 0x00}, /* 33 */ + {0x0047,0x3c,0x3a,0x0a,0x0c,0x75,1280, 720, 0, 0x00, 0x00}, /* 34 */ + {0x0007,0x3d,0x3b,0x0a,0x0c,0x75,1280, 720, 0, 0x00, 0x00}, /* 35 */ + {0x0067,0x49,0x35,0x06,0x1a,0x29,1152, 864, 0, 0x00, 0x00}, /* 36 1152x864-60Hz */ + {0x0067,0x3e,0x34,0x06,0x1a,0x29,1152, 864, 0, 0x00, 0x00}, /* 37 1152x864-75Hz */ + {0x0047,0x44,0x3a,0x06,0x1a,0x29,1152, 864, 0, 0x00, 0x00}, /* 38 1152x864-85Hz */ + {0x00c7,0x3f,0x28,0x00,0x16,0x39, 848, 480, 0, 0x00, 0x00}, /* 39 848x480-38Hzi */ + {0xc067,0x40,0x3d,0x0b,0x16,0x39, 848, 480, 0, 0x00, 0x00}, /* 3a 848x480-60Hz */ + {0x00c7,0x41,0x28,0x00,0x17,0x3f, 856, 480, 0, 0x00, 0x00}, /* 3b 856x480-38Hzi */ + {0xc067,0x42,0x28,0x0c,0x17,0x3f, 856, 480, 0, 0x00, 0x00}, /* 3c 856x480-60Hz */ + {0x0067,0x43,0x3e,0x0d,0x1b,0x48,1360, 768, 0, 0x00, 0x00}, /* 3d 1360x768-60Hz */ + {0x0077,0x46,0x3f,0x08,0x08,0x55,1280, 768, 0, 0x00, 0x00}, /* 3e 1280x768-60Hz */ + {0x006f,0x47,0x4c,0x06,0x15,0x5f, 768, 576, 0, 0x00, 0x00}, /* 3f 768x576 */ + {0x0027,0x48,0x13,0x08,0x00,0x67,1360,1024, 0, 0x00, 0x00}, /* 40 1360x1024-59Hz (BARCO1366 only) */ + {0xffff, 0, 0, 0, 0, 0, 0, 0, 0, 0x00, 0x00} +}; + +static const struct SiS_VBMode SiS300_VBModeIDTable[] = { {0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, {0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01}, @@ -303,53 +279,26 @@ static const SiS_VBModeStruct SiS300_VBModeIDTable[] = {0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00} }; -static const SiS_CRT1TableStruct SiS300_CRT1Table[] = +static const struct SiS_CRT1Table SiS300_CRT1Table[] = { -#if 1 {{0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f, /* 0x00 - 320x200 */ 0x9c,0x8e,0x8f,0x96,0xb9,0x30,0x00,0x00, /* HRE [4],[15] is invalid - but correcting it does not work */ 0x00}}, -#endif -#if 0 - {{0x2d,0x27,0x27,0x91,0x2c,0x92,0xbf,0x1f, /* 0x00 - corrected 320x200-72 - does not work */ - 0x9c,0x8e,0x8f,0x96,0xb9,0x30,0x00,0x04, - 0x00}}, -#endif {{0x2d,0x27,0x28,0x90,0x2c,0x80,0x0b,0x3e, /* 0x01 */ 0xe9,0x8b,0xdf,0xe7,0x04,0x00,0x00,0x00, /* HRE [4],[15] is invalid - but correcting it does not work */ 0x00}}, -#if 0 - {{0x2d,0x27,0x27,0x91,0x2c,0x92,0x0b,0x3e, /* 0x01 - corrected 320x240-60 - does not work */ - 0xe9,0x8b,0xdf,0xe7,0x04,0x00,0x00,0x04, - 0x00}}, -#endif {{0x3d,0x31,0x31,0x81,0x37,0x1f,0x72,0xf0, /* 0x02 */ 0x58,0x8c,0x57,0x57,0x73,0x20,0x00,0x05, 0x01}}, -#if 0 - {{0x3d,0x31,0x31,0x81,0x37,0x1f,0x72,0xf0, /* 0x02 - corrected 400x300-60 */ - 0x58,0x8c,0x57,0x57,0x73,0x20,0x00,0x05, - 0x01}}, -#endif {{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}}, -#if 0 - {{0x5f,0x4f,0x50,0x82,0x55,0x81,0x0b,0x3e, /* 0x05 */ - 0xe9,0x8b,0xdf,0xe7,0x04,0x00,0x00,0x05, - 0x00}}, -#endif {{0x5f,0x4f,0x4f,0x83,0x55,0x81,0x0b,0x3e, /* 0x05 - corrected 640x480-60 */ 0xe9,0x8b,0xdf,0xe8,0x0c,0x00,0x00,0x05, 0x00}}, -#if 0 - {{0x63,0x4f,0x50,0x86,0x56,0x9b,0x06,0x3e, /* 0x06 */ - 0xe8,0x8b,0xdf,0xe7,0xff,0x10,0x00,0x01, - 0x00}}, -#endif {{0x63,0x4f,0x4f,0x87,0x56,0x9b,0x06,0x3e, /* 0x06 - corrected 640x480-72 */ 0xe8,0x8a,0xdf,0xe7,0x07,0x00,0x00,0x01, 0x00}}, @@ -359,19 +308,9 @@ static const SiS_CRT1TableStruct SiS300_CRT1Table[] = {{0x63,0x4f,0x4f,0x87,0x5a,0x81,0xfb,0x1f, 0xe0,0x83,0xdf,0xdf,0xfc,0x10,0x00,0x05, 0x00}}, -#if 0 - {{0x66,0x4f,0x4f,0x86,0x56,0x9e,0x03,0x3e, /* 0x09 */ - 0xe4,0x87,0xdf,0xdf,0x04,0x00,0x00,0x01, - 0x00}}, -#endif {{0x67,0x4f,0x4f,0x8b,0x57,0x83,0x10,0x3e, /* 0x09 - corrected 640x480-100 */ 0xe7,0x8d,0xdf,0xe6,0x11,0x00,0x00,0x05, 0x00}}, -#if 0 - {{0x6c,0x4f,0x4f,0x83,0x59,0x9e,0x00,0x3e, /* 0x0a */ - 0xe5,0x8d,0xdf,0xdf,0x01,0x00,0x00,0x01, - 0x00}}, -#endif {{0x67,0x4f,0x4f,0x8b,0x57,0x83,0x10,0x3e, /* 0x0a - corrected 640x480-120 */ 0xe7,0x8d,0xdf,0xe6,0x11,0x00,0x00,0x05, 0x00}}, @@ -459,11 +398,6 @@ static const SiS_CRT1TableStruct SiS300_CRT1Table[] = {{0x55,0xff,0xff,0x99,0x0d,0x0c,0x3e,0xba, 0x00,0x84,0xff,0xff,0x3f,0x0f,0x41,0x05, 0x00}}, -#if 0 - {{0xdc,0x9f,0x9f,0x00,0xab,0x19,0xe6,0xef, /* 0x27: 1280x960-70 - invalid! */ - 0xc0,0xc3,0xbf,0xbf,0xe7,0x10,0x00,0x07, - 0x01}}, -#endif {{0xdc,0x9f,0x9f,0x80,0xaf,0x9d,0xe6,0xff, /* 0x27: 1280x960-60 - correct */ 0xc0,0x83,0xbf,0xbf,0xe7,0x10,0x00,0x07, 0x01}}, @@ -497,9 +431,9 @@ static const SiS_CRT1TableStruct SiS300_CRT1Table[] = {{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}}, + {{0x6d,0x59,0x59,0x91,0x60,0x89,0x53,0xf0, /* 0x32: 720x576, corrected to 60Hz */ + 0x41,0x84,0x3f,0x3f,0x54,0x00,0x00,0x05, + 0x41}}, {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x1e,0xf1, /* 0x33 - 1024x600 */ 0xae,0x85,0x57,0x57,0x1f,0x30,0x00,0x02, 0x01}}, @@ -560,18 +494,24 @@ static const SiS_CRT1TableStruct SiS300_CRT1Table[] = {{0xce,0x9f,0x9f,0x92,0xa9,0x17,0x20,0xf5, /* 1280x768-60 */ 0x03,0x88,0xff,0xff,0x21,0x10,0x00,0x07, 0x01}}, /* 0x46 */ - {{0x7b,0x5f,0x63,0x9f,0x6a,0x93,0x6f,0xf0, /* 768x576 */ - 0x58,0x8a,0x3f,0x57,0x70,0x20,0x00,0x05, - 0x01}}, /* 0x47 */ + {{0x75,0x5f,0x5f,0x99,0x66,0x90,0x53,0xf0, /* 768x576, corrected to 60Hz */ + 0x41,0x84,0x3f,0x3f,0x54,0x00,0x00,0x05, + 0x41}}, /* 0x47 */ {{0xce,0xa9,0xa9,0x92,0xb1,0x07,0x28,0x52, /* 1360x1024 (Barco iQ Pro R300) */ 0x02,0x8e,0xff,0x00,0x29,0x0d,0x00,0x03, 0x00}}, /* 0x48 */ {{0xcd,0x8f,0x8f,0x91,0x9b,0x1b,0x7a,0xff, /* 1152x864-60 */ 0x64,0x8c,0x5f,0x62,0x7b,0x10,0x00,0x07, - 0x41}} /* 0x49 */ + 0x41}}, /* 0x49 */ + {{0x5c,0x4f,0x4f,0x80,0x57,0x80,0xa3,0x1f, /* fake 640x400@60Hz (for LCD and TV, not actually used) */ + 0x98,0x8c,0x8f,0x96,0xa4,0x30,0x00,0x05, + 0x40}}, /* 0x4a */ + {{0x2c,0x27,0x27,0x90,0x2d,0x92,0xa4,0x1f, /* fake 320x200@60Hz (for LCD and TV, not actually used) */ + 0x98,0x8c,0x8f,0x96,0xa5,0x30,0x00,0x04, + 0x00}} /* 0x4b */ }; -static const SiS_MCLKDataStruct SiS300_MCLKData_630[] = +static const struct SiS_MCLKData SiS300_MCLKData_630[] = { { 0x5a,0x64,0x80, 66}, { 0xb3,0x45,0x80, 83}, @@ -583,7 +523,7 @@ static const SiS_MCLKDataStruct SiS300_MCLKData_630[] = { 0x37,0x61,0x80,100} }; -static const SiS_MCLKDataStruct SiS300_MCLKData_300[] = +static const struct SiS_MCLKData SiS300_MCLKData_300[] = { { 0x68,0x43,0x80,125}, { 0x68,0x43,0x80,125}, @@ -595,7 +535,7 @@ static const SiS_MCLKDataStruct SiS300_MCLKData_300[] = { 0x37,0x61,0x80,100} }; -static SiS_VCLKDataStruct SiS300_VCLKData[] = +static struct SiS_VCLKData SiS300_VCLKData[] = { { 0x1b,0xe1, 25}, /* 0x00 */ { 0x4e,0xe4, 28}, /* 0x01 */ @@ -669,53 +609,26 @@ static SiS_VCLKDataStruct SiS300_VCLKData[] = { 0xe2,0x46,135}, /* 0x45 */ /* 1280x1024-75, better clock for VGA2 */ { 0x70,0x29, 81}, /* 0x46 */ /* unused */ { 0, 0, 0}, /* 0x47 custom (will be filled out) */ - { 0xce,0x25,189} /* 0x48 */ /* Replacement for index 0x1b for 730 (and 540?) */ + { 0xce,0x25,189}, /* 0x48 */ /* Replacement for index 0x1b for 730 (and 540?) */ + { 0x15,0xe1, 20}, /* 0x49 */ /* 640x400@60 (fake, not actually used) */ + { 0x5f,0xc6, 33}, /* 0x4a */ /* 720x576@60 */ + { 0x37,0x5a, 10}, /* 0x4b */ /* 320x200@60 (fake, not actually used) */ + { 0x2b,0xc2, 35} /* 0x4c */ /* 768@576@60 */ }; -#ifdef LINUX_KERNEL -static UCHAR SiS300_SR07 = 0x10; -#endif - -static const DRAM4Type SiS300_SR15[8] = +static const unsigned char SiS300_SR15[4 * 8] = { - {0x01,0x09,0xa3,0x00}, - {0x43,0x43,0x43,0x00}, - {0x1e,0x1e,0x1e,0x00}, - {0x2a,0x2a,0x2a,0x00}, - {0x06,0x06,0x06,0x00}, - {0x00,0x00,0x00,0x00}, - {0x00,0x00,0x00,0x00}, - {0x00,0x00,0x00,0x00} + 0x01,0x09,0xa3,0x00, + 0x43,0x43,0x43,0x00, + 0x1e,0x1e,0x1e,0x00, + 0x2a,0x2a,0x2a,0x00, + 0x06,0x06,0x06,0x00, + 0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00 }; -#ifdef LINUX_KERNEL -static UCHAR SiS300_SR1F = 0x00; -static UCHAR SiS300_SR21 = 0x16; -static UCHAR SiS300_SR22 = 0xb2; -static UCHAR SiS300_SR23 = 0xf6; -static UCHAR SiS300_SR24 = 0x0d; -static UCHAR SiS300_SR25[] = {0x0,0x0}; -static UCHAR SiS300_SR31 = 0x00; -static UCHAR SiS300_SR32 = 0x11; -static UCHAR SiS300_SR33 = 0x00; -static UCHAR SiS300_CRT2Data_1_2 = 0x40; -static UCHAR SiS300_CRT2Data_4_D = 0x00; -static UCHAR SiS300_CRT2Data_4_E = 0x00; -static UCHAR SiS300_CRT2Data_4_10 = 0x80; - -static const USHORT SiS300_RGBSenseData = 0xd1; -static const USHORT SiS300_VideoSenseData = 0xb3; -static const USHORT SiS300_YCSenseData = 0xb9; -static const USHORT SiS300_RGBSenseData2 = 0x0190; -static const USHORT SiS300_VideoSenseData2 = 0x0174; -static const USHORT SiS300_YCSenseData2 = 0x016b; - -static const DRAM4Type SiS300_CR40[5]; - -static UCHAR SiS300_CR49[2]; -#endif - -static const SiS_PanelDelayTblStruct SiS300_PanelDelayTbl[] = +static const struct SiS_PanelDelayTbl SiS300_PanelDelayTbl[] = { {{0x05,0xaa}}, {{0x05,0x14}}, @@ -735,33 +648,11 @@ static const SiS_PanelDelayTblStruct SiS300_PanelDelayTbl[] = {{0x05,0x60}} }; -#if 0 -static const SiS_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}}, /* 2.07a (JVC): 14,96 */ - {{0x05,0x28}}, /* 2.04.5c: 20, 80 - Clevo (2.04.2c): 05, 28 */ - {{0x05,0x14}}, - {{0x05,0x14}}, /* Some BIOSes: 05, 40 */ - {{0x05,0x60}} -}; -#endif - /**************************************************************/ /* SIS VIDEO BRIDGE ----------------------------------------- */ /**************************************************************/ -static const SiS_LCDDataStruct SiS300_St2LCD1024x768Data[] = +static const struct SiS_LCDData SiS300_St2LCD1024x768Data[] = { { 62, 25, 800, 546,1344, 806}, { 32, 15, 930, 546,1344, 806}, @@ -772,7 +663,7 @@ static const SiS_LCDDataStruct SiS300_St2LCD1024x768Data[] = { 1, 1,1344, 806,1344, 806} }; -static const SiS_LCDDataStruct SiS300_ExtLCD1024x768Data[] = +static const struct SiS_LCDData SiS300_ExtLCD1024x768Data[] = { { 12, 5, 896, 512,1344, 806}, { 12, 5, 896, 510,1344, 806}, @@ -789,7 +680,7 @@ static const SiS_LCDDataStruct SiS300_ExtLCD1024x768Data[] = { 1, 1,1344, 806,1344, 806} }; -static const SiS_LCDDataStruct SiS300_St2LCD1280x1024Data[] = +static const struct SiS_LCDData SiS300_St2LCD1280x1024Data[] = { { 22, 5, 800, 510,1650,1088}, { 22, 5, 800, 510,1650,1088}, @@ -801,7 +692,7 @@ static const SiS_LCDDataStruct SiS300_St2LCD1280x1024Data[] = { 1, 1,1688,1066,1688,1066} }; -static const SiS_LCDDataStruct SiS300_ExtLCD1280x1024Data[] = +static const struct SiS_LCDData SiS300_ExtLCD1280x1024Data[] = { { 211, 60,1024, 501,1688,1066}, { 211, 60,1024, 508,1688,1066}, @@ -813,53 +704,116 @@ static const SiS_LCDDataStruct SiS300_ExtLCD1280x1024Data[] = { 1, 1,1688,1066,1688,1066} }; -static const SiS_Part2PortTblStruct SiS300_CRT2Part2_1024x768_1[] = +static const struct SiS_Part2PortTbl SiS300_CRT2Part2_1024x768_1[] = { /* VESA Timing */ - {{0x21,0x12,0xbf,0xe4,0xc0,0x21,0x45,0x09,0x00,0xa9,0x09,0x04}}, - {{0x2c,0x12,0x9a,0xae,0x88,0x21,0x45,0x09,0x00,0xa9,0x09,0x04}}, - {{0x21,0x12,0xbf,0xe4,0xc0,0x21,0x45,0x09,0x00,0xa9,0x09,0x04}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, - {{0x22,0x13,0xfe,0x25,0xff,0x21,0x45,0x0a,0x00,0xa9,0x0d,0x04}}, - {{0x22,0x13,0xfe,0x25,0xff,0x21,0x45,0x0a,0x00,0xa9,0x0d,0x04}}, - {{0x22,0x13,0xfe,0x25,0xff,0x21,0x45,0x0a,0x00,0xa9,0x0d,0x04}} + {{0x21,0x12,0xbf,0xe4,0xc0,0x21,0x45,0x09,0x00,0xa9,0x09,0x04}}, + {{0x2c,0x12,0x9a,0xae,0x88,0x21,0x45,0x09,0x00,0xa9,0x09,0x04}}, + {{0x21,0x12,0xbf,0xe4,0xc0,0x21,0x45,0x09,0x00,0xa9,0x09,0x04}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, + {{0x22,0x13,0xfe,0x25,0xff,0x21,0x45,0x0a,0x00,0xa9,0x0d,0x04}}, + {{0x22,0x13,0xfe,0x25,0xff,0x21,0x45,0x0a,0x00,0xa9,0x0d,0x04}}, + {{0x22,0x13,0xfe,0x25,0xff,0x21,0x45,0x0a,0x00,0xa9,0x0d,0x04}} }; -static const SiS_Part2PortTblStruct SiS300_CRT2Part2_1024x768_2[] = +static const struct SiS_Part2PortTbl SiS300_CRT2Part2_1024x768_2[] = { /* Non-VESA */ - {{0x28,0x12,0xa3,0xd0,0xaa,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, - {{0x2c,0x12,0x9a,0xae,0x88,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, - {{0x28,0x12,0xa3,0xd0,0xaa,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, - {{0x2c,0x12,0x9a,0xae,0x88,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, - {{0x28,0x13,0xe7,0x0b,0xe8,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, - {{0x38,0x18,0x16,0x00,0x00,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, - {{0x36,0x13,0x13,0x25,0xff,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}} -}; - -static const SiS_Part2PortTblStruct SiS300_CRT2Part2_1024x768_3[] = -{ - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} -}; - -static const SiS_Part2PortTblStruct SiS300_CRT2Part2_1280x1024_1[] = -{ - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} -}; - -static const SiS_Part2PortTblStruct SiS300_CRT2Part2_1280x1024_2[] = -{ - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} + {{0x28,0x12,0xa3,0xd0,0xaa,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, + {{0x2c,0x12,0x9a,0xae,0x88,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, + {{0x28,0x12,0xa3,0xd0,0xaa,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, + {{0x2c,0x12,0x9a,0xae,0x88,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, + {{0x28,0x13,0xe7,0x0b,0xe8,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, + {{0x38,0x18,0x16,0x00,0x00,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, + {{0x36,0x13,0x13,0x25,0xff,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}} }; -static const SiS_Part2PortTblStruct SiS300_CRT2Part2_1280x1024_3[] = +static const struct SiS_Part2PortTbl SiS300_CRT2Part2_1024x768_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}} }; /**************************************************************/ /* LVDS/Chrontel -------------------------------------------- */ /**************************************************************/ -static const SiS_LVDSDataStruct SiS300_CHTVUPALData[] = +/* Custom data for Barco iQ R series */ +static const struct SiS_LVDSData SiS300_LVDSBARCO1366Data_1[]= +{ + { 832, 438,1331, 806}, + { 832, 388,1331, 806}, + { 832, 438,1331, 806}, + { 832, 388,1331, 806}, + { 832, 518,1331, 806}, + {1050, 638,1344, 806}, + {1344, 806,1344, 806}, + {1688,1066,1688,1066}, + {1688,1066,1688,1066} /* 1360x1024 */ +}; + +/* Custom data for Barco iQ R series */ +static const struct SiS_LVDSData SiS300_LVDSBARCO1366Data_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}, + {1688,1066,1688,1066}, + {1688,1066,1688,1066} /* 1360x1024 */ +}; + +/* Custom data for Barco iQ G series */ +static const struct SiS_LVDSData SiS300_LVDSBARCO1024Data_1[]= +{ + { 832, 438,1331, 806}, + { 832, 409,1331, 806}, + { 832, 438,1331, 806}, + { 832, 409,1331, 806}, + { 832, 518,1331, 806}, /* 640x480 */ + {1050, 638,1344, 806}, /* 800x600 */ + {1344, 806,1344, 806}, /* 1024x768 */ +}; + +/* Custom data for 848x480 and 856x480 parallel LVDS panels */ +static const struct SiS_LVDSData SiS300_LVDS848x480Data_1[]= +{ + { 0, 0, 0, 0}, + { 0, 0, 0, 0}, + { 0, 0, 0, 0}, + { 0, 0, 0, 0}, + {1088, 525,1088, 525}, /* 640x480 TODO */ + {1088, 525,1088, 525}, /* 800x600 TODO */ + {1088, 525,1088, 525}, /* 1024x768 TODO */ + { 0, 0, 0, 0}, + { 0, 0, 0, 0}, + { 0, 0, 0, 0}, + { 0, 0, 0, 0}, + {1088, 525,1088, 525}, /* 848x480 */ + {1088, 525,1088, 525}, /* 856x480 */ + {1088, 525,1088, 525} /* 1360x768 TODO */ +}; + +/* Custom data for 848x480 parallel panel */ +static const struct SiS_LVDSData SiS300_LVDS848x480Data_2[]= +{ + { 0, 0, 0, 0}, + { 0, 0, 0, 0}, + { 0, 0, 0, 0}, + { 0, 0, 0, 0}, + {1088, 525,1088, 525}, /* 640x480 */ + {1088, 525,1088, 525}, /* 800x600 */ + {1088, 525,1088, 525}, /* 1024x768 */ + { 0, 0, 0, 0}, + { 0, 0, 0, 0}, + { 0, 0, 0, 0}, + { 0, 0, 0, 0}, + {1088, 525,1088, 525}, /* 848x480 */ + {1088, 525,1088, 525}, /* 856x480 */ + {1088, 525,1088, 525} /* 1360x768 TODO */ +}; + +static const struct SiS_LVDSData SiS300_CHTVUPALData[] = { {1008, 625,1008, 625}, {1008, 625,1008, 625}, @@ -869,7 +823,7 @@ static const SiS_LVDSDataStruct SiS300_CHTVUPALData[] = { 936, 836, 936, 836} }; -static const SiS_LVDSDataStruct SiS300_CHTVOPALData[] = +static const struct SiS_LVDSData SiS300_CHTVOPALData[] = { {1008, 625,1008, 625}, {1008, 625,1008, 625}, @@ -879,7 +833,7 @@ static const SiS_LVDSDataStruct SiS300_CHTVOPALData[] = { 960, 750, 960, 750} }; -static const SiS_LVDSDataStruct SiS300_CHTVSOPALData[] = +static const struct SiS_LVDSData SiS300_CHTVSOPALData[] = { {1008, 625,1008, 625}, {1008, 625,1008, 625}, @@ -889,486 +843,8 @@ static const SiS_LVDSDataStruct SiS300_CHTVSOPALData[] = { 944, 625, 944, 625} }; - -static const SiS_LVDSDesStruct SiS300_PanelType00_1[] = -{ - { 1059, 626 }, /* 2.08 */ - { 1059, 624 }, - { 1059, 626 }, - { 1059, 624 }, - { 1059, 624 }, - { 0, 627 }, - { 0, 627 }, - { 0, 0 }, - { 0, 0 } -#if 0 - {0, 626}, - {0, 624}, - {0, 626}, - {0, 624}, - {0, 624}, - {0, 627}, - {0, 627}, - {0, 0}, - {0, 0} -#endif -}; - -static const SiS_LVDSDesStruct SiS300_PanelType01_1[] = -{ - { 0, 0 }, /* 2.08 */ - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 } -#if 0 - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} -#endif -}; - -static const SiS_LVDSDesStruct SiS300_PanelType02_1[] = -{ - { 1059, 626 }, /* 2.08 */ - { 1059, 624 }, - { 1059, 626 }, - { 1059, 624 }, - { 1059, 624 }, - { 0, 627 }, - { 0, 627 }, - { 0, 0 }, - { 0, 0 } -#if 0 - {0, 626}, - {0, 624}, - {0, 626}, - {0, 624}, - {0, 624}, - {0, 627}, - {0, 627}, - {0, 0}, - {0, 0} -#endif -}; - -static const SiS_LVDSDesStruct SiS300_PanelType03_1[] = -{ - { 8, 436}, - { 8, 440}, - { 8, 436}, - { 8, 440}, - { 8, 512}, - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType04_1[] = /* 1280x1024 */ -{ - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType05_1[] = -{ - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType06_1[] = /* Clevo Trumpion 1024x768 */ -{ - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType07_1[] = -{ - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType08_1[] = -{ - {1059, 626}, - {1059, 624}, - {1059, 626}, - {1059, 624}, - {1059, 624}, - { 0, 627}, - { 0, 627}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType09_1[] = -{ - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType0a_1[] = -{ - {1059, 626}, - {1059, 624}, - {1059, 626}, - {1059, 624}, - {1059, 624}, - { 0, 627}, - { 0, 627}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType0b_1[] = -{ - {1343, 0}, - {1343, 0}, - {1343, 0}, - {1343, 0}, - {1343, 0}, - {1343, 0}, - { 0, 799}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType0c_1[] = -{ - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType0d_1[] = -{ - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_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 */ -}; - -static const SiS_LVDSDesStruct SiS300_PanelType0f_1[] = -{ - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType00_2[] = -{ - {976, 527}, - {976, 502}, - {976, 527}, - {976, 502}, - {976, 567}, - { 0, 627}, - { 0, 627}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType01_2[] = -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType02_2[] = -{ - {976, 527}, - {976, 502}, - {976, 527}, - {976, 502}, - {976, 567}, - { 0, 627}, - { 0, 627}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType03_2[] = -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - {1152, 622}, - {1152, 597} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType04_2[] = -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType05_2[] = -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType06_2[] = -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType07_2[] = -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType08_2[] = -{ - {976, 527}, - {976, 502}, - {976, 527}, - {976, 502}, - {976, 567}, - { 0, 627}, - { 0, 627}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType09_2[] = -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType0a_2[] = -{ - {976, 527}, - {976, 502}, - {976, 527}, - {976, 502}, - {976, 567}, - { 0, 627}, - { 0, 627}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType0b_2[] = -{ - { 1152, 700}, - { 1152, 675}, - { 1152, 700}, - { 1152, 675}, - { 1152, 740}, - { 1232, 799}, - { 0, 799}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType0c_2[] = -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType0d_2[] = -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType0e_2[] = -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType0f_2[] = -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelTypeNS_1[]= -{ - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 805}, - { 0, 0}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelTypeNS_2[] = -{ - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0} -}; - -/* Custom data for Barco iQ R200/300/400 (BIOS 2.00.07) */ -static const SiS_LVDSDesStruct SiS300_PanelType04_1a[] = /* 1280x1024 (1366x1024) */ +/* Custom des data for Barco iQ R200/300/400 (BIOS 2.00.07) */ +static const struct SiS_LVDSDes SiS300_PanelType04_1a[] = /* 1280x1024 (1366x1024) */ { {1330, 798}, /* 320x200 */ {1330, 794}, @@ -1381,7 +857,7 @@ static const SiS_LVDSDesStruct SiS300_PanelType04_1a[] = /* 1280x1024 (1366x102 { 0, 0} /* 1360x1024 */ }; -static const SiS_LVDSDesStruct SiS300_PanelType04_2a[] = +static const struct SiS_LVDSDes SiS300_PanelType04_2a[] = { {1152, 622}, {1152, 597}, @@ -1394,8 +870,8 @@ static const SiS_LVDSDesStruct SiS300_PanelType04_2a[] = { 0, 0} }; -/* Custom data for Barco iQ G200/300/400 (BIOS 2.00.07) */ -static const SiS_LVDSDesStruct SiS300_PanelType04_1b[] = /* 1024x768 */ +/* Custom des data for Barco iQ G200/300/400 (BIOS 2.00.07) */ +static const struct SiS_LVDSDes SiS300_PanelType04_1b[] = /* 1024x768 */ { {1330, 798}, /* 320x200 */ {1330, 794}, @@ -1406,7 +882,7 @@ static const SiS_LVDSDesStruct SiS300_PanelType04_1b[] = /* 1024x768 */ { 0, 805} /* 1024x768 / 512x384 */ }; -static const SiS_LVDSDesStruct SiS300_PanelType04_2b[] = +static const struct SiS_LVDSDes SiS300_PanelType04_2b[] = { {1152, 622}, {1152, 597}, @@ -1419,376 +895,7 @@ static const SiS_LVDSDesStruct SiS300_PanelType04_2b[] = /* CRT1 CRTC for slave modes */ -static const SiS_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 }} -}; - -static const SiS_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 }} -}; - -static const SiS_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}} -}; - -static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_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 }} - -#if 0 - {{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 }} -#endif -}; - -static const SiS_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 }} -}; - -static const SiS_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 }} -}; - -static const SiS_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 }} -}; - -static const SiS_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 }} -}; - -static const SiS_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 }} -}; - -static const SiS_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 }} -}; - -static const SiS_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 }} -}; - -static const SiS_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}} -}; - -static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT1XXXxXXX_1[] = -{ - {{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,0xa8,0x14,0x28,0x5a, - 0x00,0x84,0xff,0x29,0x09,0x00,0x07, - 0x01}}, - {{0xce,0x9f,0x92,0xa9,0x17,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x07, - 0x01}} -}; - -static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT1XXXxXXX_1_H[] = -{ - {{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}} -}; - - -static const SiS_LVDSCRT1DataStruct SiS300_CHTVCRT1UNTSC[] = +static const struct SiS_LVDSCRT1Data SiS300_CHTVCRT1UNTSC[] = { {{0x64,0x4f,0x88,0x56,0x9f,0x56,0x3e, 0xe8,0x84,0x8f,0x57,0x20,0x00,0x01, @@ -1810,7 +917,7 @@ static const SiS_LVDSCRT1DataStruct SiS300_CHTVCRT1UNTSC[] = 0x01 }} }; -static const SiS_LVDSCRT1DataStruct SiS300_CHTVCRT1ONTSC[] = +static const struct SiS_LVDSCRT1Data SiS300_CHTVCRT1ONTSC[] = { {{0x64,0x4f,0x88,0x5a,0x9f,0x0b,0x3e, 0xc0,0x84,0x8f,0x0c,0x20,0x00,0x01, @@ -1832,7 +939,7 @@ static const SiS_LVDSCRT1DataStruct SiS300_CHTVCRT1ONTSC[] = 0x01 }} }; -static const SiS_LVDSCRT1DataStruct SiS300_CHTVCRT1UPAL[] = +static const struct SiS_LVDSCRT1Data SiS300_CHTVCRT1UPAL[] = { {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, 0xf8,0x83,0x8f,0x70,0x20,0x00,0x05, @@ -1854,7 +961,7 @@ static const SiS_LVDSCRT1DataStruct SiS300_CHTVCRT1UPAL[] = 0x01 }} }; -static const SiS_LVDSCRT1DataStruct SiS300_CHTVCRT1OPAL[] = +static const struct SiS_LVDSCRT1Data SiS300_CHTVCRT1OPAL[] = { {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, 0xf0,0x83,0x8f,0x70,0x20,0x00,0x05, @@ -1876,7 +983,7 @@ static const SiS_LVDSCRT1DataStruct SiS300_CHTVCRT1OPAL[] = 0x01 }} }; -static const SiS_LVDSCRT1DataStruct SiS300_CHTVCRT1SOPAL[] = +static const struct SiS_LVDSCRT1Data SiS300_CHTVCRT1SOPAL[] = { {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, 0xf0,0x83,0x8f,0x70,0x20,0x00,0x05, @@ -1898,7 +1005,7 @@ static const SiS_LVDSCRT1DataStruct SiS300_CHTVCRT1SOPAL[] = 0x01 }} }; -static const SiS_CHTVRegDataStruct SiS300_CHTVReg_UNTSC[] = +static const struct SiS_CHTVRegData SiS300_CHTVReg_UNTSC[] = { {{0x4a,0x94,0x00,0x48,0xfe,0,0,0,0,0,0,0,0,0,0,0}}, {{0x4a,0x94,0x00,0x48,0xfe,0,0,0,0,0,0,0,0,0,0,0}}, @@ -1908,7 +1015,7 @@ static const SiS_CHTVRegDataStruct SiS300_CHTVReg_UNTSC[] = {{0x8d,0xc4,0x00,0x3b,0xfb,0,0,0,0,0,0,0,0,0,0,0}} /* Mode 24: 800x600 NTSC 7/10 */ }; -static const SiS_CHTVRegDataStruct SiS300_CHTVReg_ONTSC[] = +static const struct SiS_CHTVRegData SiS300_CHTVReg_ONTSC[] = { {{0x49,0x94,0x00,0x34,0xfe,0,0,0,0,0,0,0,0,0,0,0}}, {{0x49,0x94,0x00,0x34,0xfe,0,0,0,0,0,0,0,0,0,0,0}}, @@ -1918,7 +1025,7 @@ static const SiS_CHTVRegDataStruct SiS300_CHTVReg_ONTSC[] = {{0x8c,0xb4,0x00,0x32,0xf9,0,0,0,0,0,0,0,0,0,0,0}} /* Mode 23: 800x600 NTSC 3/4 */ }; -static const SiS_CHTVRegDataStruct SiS300_CHTVReg_UPAL[] = +static const struct SiS_CHTVRegData SiS300_CHTVReg_UPAL[] = { {{0x41,0x12,0x01,0x50,0x34,0,0,0,0,0,0,0,0,0,0,0}}, {{0x41,0x12,0x00,0x50,0x00,0,0,0,0,0,0,0,0,0,0,0}}, @@ -1929,7 +1036,7 @@ static const SiS_CHTVRegDataStruct SiS300_CHTVReg_UPAL[] = }; -static const SiS_CHTVRegDataStruct SiS300_CHTVReg_OPAL[] = +static const struct SiS_CHTVRegData SiS300_CHTVReg_OPAL[] = { {{0x41,0x12,0x01,0x50,0x34,0,0,0,0,0,0,0,0,0,0,0}}, /* Mode 9: 640x400 PAL 1/1 */ {{0x41,0x12,0x00,0x50,0x00,0,0,0,0,0,0,0,0,0,0,0}}, @@ -1940,26 +1047,26 @@ static const SiS_CHTVRegDataStruct SiS300_CHTVReg_OPAL[] = }; -static const SiS_CHTVRegDataStruct SiS300_CHTVReg_SOPAL[] = +static const struct SiS_CHTVRegData SiS300_CHTVReg_SOPAL[] = { {{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}}, - {{0x60,0x30,0x00,0x10,0x00,0,0,0,0,0,0,0,0,0,0,0}}, /* TW: Mode 13: 640x480 PAL 5/4 */ - {{0x81,0x50,0x00,0x1b,0x00,0,0,0,0,0,0,0,0,0,0,0}} /* TW: Mode 19: 800x600 PAL 1/1 */ + {{0x60,0x30,0x00,0x10,0x00,0,0,0,0,0,0,0,0,0,0,0}}, /* Mode 13: 640x480 PAL 5/4 */ + {{0x81,0x50,0x00,0x1b,0x00,0,0,0,0,0,0,0,0,0,0,0}} /* Mode 19: 800x600 PAL 1/1 */ }; -static const UCHAR SiS300_CHTVVCLKUNTSC[] = {0x29,0x29,0x29,0x29,0x2a,0x2e}; +static const unsigned char SiS300_CHTVVCLKUNTSC[] = { 0x29,0x29,0x29,0x29,0x2a,0x2e }; -static const UCHAR SiS300_CHTVVCLKONTSC[] = {0x2c,0x2c,0x2c,0x2c,0x2d,0x2b}; +static const unsigned char SiS300_CHTVVCLKONTSC[] = { 0x2c,0x2c,0x2c,0x2c,0x2d,0x2b }; -static const UCHAR SiS300_CHTVVCLKSONTSC[] = {0x2c,0x2c,0x2c,0x2c,0x2d,0x2b}; +static const unsigned char SiS300_CHTVVCLKSONTSC[] = { 0x2c,0x2c,0x2c,0x2c,0x2d,0x2b }; -static const UCHAR SiS300_CHTVVCLKUPAL[] = {0x2f,0x2f,0x2f,0x2f,0x2f,0x31}; +static const unsigned char SiS300_CHTVVCLKUPAL[] = { 0x2f,0x2f,0x2f,0x2f,0x2f,0x31 }; -static const UCHAR SiS300_CHTVVCLKOPAL[] = {0x2f,0x2f,0x2f,0x2f,0x30,0x32}; +static const unsigned char SiS300_CHTVVCLKOPAL[] = { 0x2f,0x2f,0x2f,0x2f,0x30,0x32 }; -static const UCHAR SiS300_CHTVVCLKSOPAL[] = {0x2f,0x2f,0x2f,0x2f,0x36,0x29}; +static const unsigned char SiS300_CHTVVCLKSOPAL[] = { 0x2f,0x2f,0x2f,0x2f,0x36,0x29 }; diff --git a/drivers/video/sis/310vtbl.h b/drivers/video/sis/310vtbl.h index 2c71d048f7c4..54fcbbf4ef63 100644 --- a/drivers/video/sis/310vtbl.h +++ b/drivers/video/sis/310vtbl.h @@ -1,9 +1,9 @@ /* $XFree86$ */ /* $XdotOrg$ */ /* - * Register settings for SiS 315/330 series + * Register settings for SiS 315/330/340 series * - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria * * If distributed as part of the Linux kernel, the following license terms * apply: @@ -50,37 +50,13 @@ * */ -static const SiS_StStruct SiS310_SModeIDTable[]= -{ - {0x01,0x9208,0x01,0x00,0x00,0x00,0x01,0x00, 0x40}, - {0x01,0x1210,0x14,0x01,0x01,0x00,0x01,0x00, 0x40}, - {0x01,0x1010,0x17,0x02,0x02,0x00,0x01,0x01, 0x40}, - {0x03,0x8208,0x03,0x00,0x00,0x00,0x01,0x02, 0x40}, - {0x03,0x0210,0x16,0x01,0x01,0x00,0x01,0x02, 0x40}, - {0x03,0x0010,0x18,0x02,0x02,0x00,0x01,0x03, 0x40}, - {0x05,0x9209,0x05,0x00,0x00,0x00,0x00,0x04, 0x40}, - {0x06,0x8209,0x06,0x00,0x00,0x00,0x00,0x05, 0x40}, - {0x07,0x0000,0x07,0x03,0x03,0x00,0x01,0x03, 0x40}, - {0x07,0x0000,0x19,0x02,0x02,0x00,0x01,0x03, 0x40}, - {0x0d,0x920a,0x0d,0x00,0x00,0x00,0x00,0x04, 0x40}, - {0x0e,0x820a,0x0e,0x00,0x00,0x00,0x00,0x05, 0x40}, - {0x0f,0x0202,0x11,0x01,0x01,0x00,0x00,0x05, 0x40}, - {0x10,0x0212,0x12,0x01,0x01,0x00,0x00,0x05, 0x40}, - {0x11,0x0212,0x1a,0x04,0x04,0x00,0x00,0x05, 0x40}, - {0x12,0x0212,0x1b,0x04,0x04,0x00,0x00,0x05, 0x40}, - {0x13,0x021b,0x1c,0x00,0x00,0x00,0x00,0x04, 0x40}, - {0x12,0x0010,0x18,0x02,0x02,0x00,0x00,0x05, 0x40}, - {0x12,0x0210,0x18,0x01,0x01,0x00,0x00,0x05, 0x40}, - {0xff,0x0000,0x00,0x00,0x00,0x00,0x00,0x00, 0x40} -}; - -static const SiS_ExtStruct SiS310_EModeIDTable[]= +static const struct SiS_Ext SiS310_EModeIDTable[] = { {0x6a,0x2212,0x0102,SIS_RI_800x600, 0x00,0x00,0x07,0x06,0x00, 3}, /* 800x600x? */ {0x2e,0x0a1b,0x0101,SIS_RI_640x480, 0x00,0x00,0x05,0x05,0x08, 2}, /* 640x480x8 */ - {0x2f,0x0a1b,0x0100,SIS_RI_640x400, 0x00,0x00,0x05,0x05,0x10, 0}, /* 640x400x8 */ + {0x2f,0x0a1b,0x0100,SIS_RI_640x400, 0x00,0x00,0x05,0x05,0x10, 0}, /* 640x400x8 */ {0x30,0x2a1b,0x0103,SIS_RI_800x600, 0x00,0x00,0x07,0x06,0x00, 3}, /* 800x600x8 */ - {0x31,0x4a1b,0x0000,SIS_RI_720x480, 0x00,0x00,0x06,0x06,0x11,-1}, /* 720x480x8 */ + {0x31,0x4a1b,0x0000,SIS_RI_720x480, 0x00,0x00,0x06,0x06,0x11,-1}, /* 720x480x8 */ {0x32,0x4a1b,0x0000,SIS_RI_720x576, 0x00,0x00,0x06,0x06,0x12,-1}, /* 720x576x8 */ {0x33,0x4a1d,0x0000,SIS_RI_720x480, 0x00,0x00,0x06,0x06,0x11,-1}, /* 720x480x16 */ {0x34,0x6a1d,0x0000,SIS_RI_720x576, 0x00,0x00,0x06,0x06,0x12,-1}, /* 720x576x16 */ @@ -103,10 +79,10 @@ static const SiS_ExtStruct SiS310_EModeIDTable[]= {0x4d,0x0e7d,0x011a,SIS_RI_1280x1024,0x00,0x00,0x00,0x00,0x1a, 8}, /* 1280x1024x16 */ {0x50,0x9a1b,0x0132,SIS_RI_320x240, 0x00,0x00,0x04,0x04,0x26, 2}, /* 320x240x8 */ {0x51,0xba1b,0x0133,SIS_RI_400x300, 0x00,0x00,0x07,0x07,0x27, 3}, /* 400x300x8 */ - {0x52,0xba1b,0x0134,SIS_RI_512x384, 0x00,0x00,0x00,0x00,0x28, 4}, /* 512x384x8 */ + {0x52,0xba1b,0x0134,SIS_RI_512x384, 0x00,0x00,0x00,0x00,0x28, 4}, /* 512x384x8 */ {0x56,0x9a1d,0x0135,SIS_RI_320x240, 0x00,0x00,0x04,0x04,0x26, 2}, /* 320x240x16 */ {0x57,0xba1d,0x0136,SIS_RI_400x300, 0x00,0x00,0x07,0x07,0x27, 3}, /* 400x300x16 */ - {0x58,0xba1d,0x0137,SIS_RI_512x384, 0x00,0x00,0x00,0x00,0x28, 4}, /* 512x384x16 */ + {0x58,0xba1d,0x0137,SIS_RI_512x384, 0x00,0x00,0x00,0x00,0x28, 4}, /* 512x384x16 */ {0x59,0x9a1b,0x0138,SIS_RI_320x200, 0x00,0x00,0x04,0x04,0x25, 0}, /* 320x200x8 */ {0x5a,0x021b,0x0138,SIS_RI_320x240, 0x00,0x00,0x00,0x00,0x3f, 2}, /* 320x240x8 fstn */ {0x5b,0x0a1d,0x0135,SIS_RI_320x240, 0x00,0x00,0x00,0x00,0x3f, 2}, /* 320x240x16 fstn */ @@ -139,406 +115,335 @@ static const SiS_ExtStruct SiS310_EModeIDTable[]= {0x23,0x0e3b,0x0000,SIS_RI_1280x768, 0x00,0x00,0x00,0x00,0x40, 6}, /* 1280x768x8 */ {0x24,0x0e7d,0x0000,SIS_RI_1280x768, 0x00,0x00,0x00,0x00,0x40, 6}, /* 1280x768x16 */ {0x25,0x0eff,0x0000,SIS_RI_1280x768, 0x00,0x00,0x00,0x00,0x40, 6}, /* 1280x768x32 */ - {0x26,0x0e3b,0x0000,SIS_RI_1400x1050,0x00,0x00,0x00,0x00,0x41, 9}, /* 1400x1050x8 */ - {0x27,0x0e7d,0x0000,SIS_RI_1400x1050,0x00,0x00,0x00,0x00,0x41, 9}, /* 1400x1050x16 */ - {0x28,0x0eff,0x0000,SIS_RI_1400x1050,0x00,0x00,0x00,0x00,0x41, 9}, /* 1400x1050x32*/ - {0x29,0x4e1b,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x43,-1}, /* 1152x864 */ - {0x2a,0x4e3d,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x43,-1}, - {0x2b,0x4e7f,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x43,-1}, - {0x39,0x6a1b,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x46,-1}, /* 848x480 */ - {0x3b,0x6a3d,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x46,-1}, - {0x3e,0x6a7f,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x46,-1}, - {0x3f,0x6a1b,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x48,-1}, /* 856x480 */ - {0x42,0x6a3d,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x48,-1}, - {0x45,0x6a7f,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x48,-1}, - {0x48,0x6a3b,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x4a,-1}, /* 1360x768 */ - {0x4b,0x6a7d,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x4a,-1}, - {0x4e,0x6aff,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x4a,-1}, + {0x26,0x0e3b,0x0000,SIS_RI_1400x1050,0x00,0x00,0x00,0x00,0x43, 9}, /* 1400x1050x8 */ + {0x27,0x0e7d,0x0000,SIS_RI_1400x1050,0x00,0x00,0x00,0x00,0x43, 9}, /* 1400x1050x16 */ + {0x28,0x0eff,0x0000,SIS_RI_1400x1050,0x00,0x00,0x00,0x00,0x43, 9}, /* 1400x1050x32*/ + {0x29,0x4e1b,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x45,-1}, /* 1152x864 */ + {0x2a,0x4e3d,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x45,-1}, + {0x2b,0x4e7f,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x45,-1}, + {0x39,0x6a1b,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x48,-1}, /* 848x480 */ + {0x3b,0x6a3d,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x48,-1}, + {0x3e,0x6a7f,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x48,-1}, + {0x3f,0x6a1b,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x4a,-1}, /* 856x480 */ + {0x42,0x6a3d,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x4a,-1}, + {0x45,0x6a7f,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x4a,-1}, + {0x48,0x6a3b,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x4c,-1}, /* 1360x768 */ + {0x4b,0x6a7d,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x4c,-1}, + {0x4e,0x6aff,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x4c,-1}, {0x4f,0x9a1f,0x0000,SIS_RI_320x200, 0x00,0x00,0x04,0x04,0x25, 0}, /* 320x200x32 */ {0x53,0x9a1f,0x0000,SIS_RI_320x240, 0x00,0x00,0x04,0x04,0x26, 2}, /* 320x240x32 */ {0x54,0xba1f,0x0000,SIS_RI_400x300, 0x00,0x00,0x07,0x07,0x27, 3}, /* 400x300x32 */ - {0x5f,0x6a1b,0x0000,SIS_RI_768x576, 0x00,0x00,0x06,0x06,0x4b,-1}, /* 768x576 */ - {0x60,0x6a1d,0x0000,SIS_RI_768x576, 0x00,0x00,0x06,0x06,0x4b,-1}, - {0x61,0x6a3f,0x0000,SIS_RI_768x576, 0x00,0x00,0x06,0x06,0x4b,-1}, - {0x14,0x0e3b,0x0000,SIS_RI_1280x800, 0x00,0x00,0x00,0x00,0x4c, 7}, /* 1280x800 */ - {0x15,0x0e7d,0x0000,SIS_RI_1280x800, 0x00,0x00,0x00,0x00,0x4c, 7}, - {0x16,0x0eff,0x0000,SIS_RI_1280x800, 0x00,0x00,0x00,0x00,0x4c, 7}, - {0x17,0x0e3b,0x0000,SIS_RI_1680x1050,0x00,0x00,0x00,0x00,0x4d, 9}, /* 1680x1050 */ - {0x18,0x0e7d,0x0000,SIS_RI_1680x1050,0x00,0x00,0x00,0x00,0x4d, 9}, - {0x19,0x0eff,0x0000,SIS_RI_1680x1050,0x00,0x00,0x00,0x00,0x4d, 9}, - {0x2c,0x267b,0x0000,SIS_RI_1920x1080,0x00,0x00,0x00,0x00,0x4e,-1}, /* 1920x1080(i) */ - {0x2d,0x26fd,0x0000,SIS_RI_1920x1080,0x00,0x00,0x00,0x00,0x4e,-1}, - {0x73,0x27ff,0x0000,SIS_RI_1920x1080,0x00,0x00,0x00,0x00,0x4e,-1}, - {0x1d,0x6a1b,0x0000,SIS_RI_960x540, 0x00,0x00,0x00,0x00,0x4f,-1}, /* 960x540 */ - {0x1e,0x6a3d,0x0000,SIS_RI_960x540, 0x00,0x00,0x00,0x00,0x4f,-1}, - {0x1f,0x6a7f,0x0000,SIS_RI_960x540, 0x00,0x00,0x00,0x00,0x4f,-1}, - {0x20,0x6a1b,0x0000,SIS_RI_960x600, 0x00,0x00,0x00,0x00,0x50,-1}, /* 960x600 */ - {0x21,0x6a3d,0x0000,SIS_RI_960x600, 0x00,0x00,0x00,0x00,0x50,-1}, - {0x22,0x6a7f,0x0000,SIS_RI_960x600, 0x00,0x00,0x00,0x00,0x50,-1}, + {0x5f,0x6a1b,0x0000,SIS_RI_768x576, 0x00,0x00,0x06,0x06,0x4d,-1}, /* 768x576 */ + {0x60,0x6a1d,0x0000,SIS_RI_768x576, 0x00,0x00,0x06,0x06,0x4d,-1}, + {0x61,0x6a3f,0x0000,SIS_RI_768x576, 0x00,0x00,0x06,0x06,0x4d,-1}, + {0x14,0x0e3b,0x0000,SIS_RI_1280x800, 0x00,0x00,0x00,0x00,0x4e, 7}, /* 1280x800 */ + {0x15,0x0e7d,0x0000,SIS_RI_1280x800, 0x00,0x00,0x00,0x00,0x4e, 7}, + {0x16,0x0eff,0x0000,SIS_RI_1280x800, 0x00,0x00,0x00,0x00,0x4e, 7}, + {0x17,0x0e3b,0x0000,SIS_RI_1680x1050,0x00,0x00,0x00,0x00,0x51, 9}, /* 1680x1050 */ + {0x18,0x0e7d,0x0000,SIS_RI_1680x1050,0x00,0x00,0x00,0x00,0x51, 9}, + {0x19,0x0eff,0x0000,SIS_RI_1680x1050,0x00,0x00,0x00,0x00,0x51, 9}, + {0x2c,0x267b,0x0000,SIS_RI_1920x1080,0x00,0x00,0x00,0x00,0x52,-1}, /* 1920x1080(i) */ + {0x2d,0x26fd,0x0000,SIS_RI_1920x1080,0x00,0x00,0x00,0x00,0x52,-1}, + {0x73,0x27ff,0x0000,SIS_RI_1920x1080,0x00,0x00,0x00,0x00,0x52,-1}, + {0x1d,0x6a1b,0x0000,SIS_RI_960x540, 0x00,0x00,0x00,0x00,0x53,-1}, /* 960x540 */ + {0x1e,0x6a3d,0x0000,SIS_RI_960x540, 0x00,0x00,0x00,0x00,0x53,-1}, + {0x1f,0x6a7f,0x0000,SIS_RI_960x540, 0x00,0x00,0x00,0x00,0x53,-1}, + {0x20,0x6a1b,0x0000,SIS_RI_960x600, 0x00,0x00,0x00,0x00,0x54,-1}, /* 960x600 */ + {0x21,0x6a3d,0x0000,SIS_RI_960x600, 0x00,0x00,0x00,0x00,0x54,-1}, + {0x22,0x6a7f,0x0000,SIS_RI_960x600, 0x00,0x00,0x00,0x00,0x54,-1}, + {0x1a,0x0e3b,0x0000,SIS_RI_1280x854, 0x00,0x00,0x00,0x00,0x55, 8}, /* 1280x854 */ + {0x1b,0x0e7d,0x0000,SIS_RI_1280x854, 0x00,0x00,0x00,0x00,0x55, 8}, + {0x1c,0x0eff,0x0000,SIS_RI_1280x854, 0x00,0x00,0x00,0x00,0x55, 8}, {0xff,0x0000,0x0000,0, 0x00,0x00,0x00,0x00,0x00,-1} }; -static const SiS_Ext2Struct SiS310_RefIndex[]= -{ - {0x085f,0x0d,0x03,0x05,0x05,0x6a, 800, 600, 0x40}, /* 0x0 */ - {0x0067,0x0e,0x04,0x05,0x05,0x6a, 800, 600, 0x40}, /* 0x1 */ - {0x0067,0x0f,0x08,0x48,0x05,0x6a, 800, 600, 0x40}, /* 0x2 */ - {0x0067,0x10,0x07,0x8b,0x05,0x6a, 800, 600, 0x40}, /* 0x3 */ - {0x0047,0x11,0x0a,0x00,0x05,0x6a, 800, 600, 0x40}, /* 0x4 */ - {0x0047,0x12,0x0d,0x00,0x05,0x6a, 800, 600, 0x40}, /* 0x5 */ - {0x0047,0x13,0x13,0x00,0x05,0x6a, 800, 600, 0x20}, /* 0x6 */ - {0x0107,0x14,0x1c,0x00,0x05,0x6a, 800, 600, 0x20}, /* 0x7 */ - {0xc85f,0x05,0x00,0x04,0x04,0x2e, 640, 480, 0x40}, /* 0x8 */ - {0xc067,0x06,0x02,0x04,0x04,0x2e, 640, 480, 0x40}, /* 0x9 */ - {0xc067,0x07,0x02,0x47,0x04,0x2e, 640, 480, 0x40}, /* 0xa */ - {0xc067,0x08,0x03,0x8a,0x04,0x2e, 640, 480, 0x40}, /* 0xb */ - {0xc047,0x09,0x05,0x00,0x04,0x2e, 640, 480, 0x40}, /* 0xc */ - {0xc047,0x0a,0x09,0x00,0x04,0x2e, 640, 480, 0x40}, /* 0xd */ - {0xc047,0x0b,0x0e,0x00,0x04,0x2e, 640, 480, 0x40}, /* 0xe */ - {0xc047,0x0c,0x15,0x00,0x04,0x2e, 640, 480, 0x40}, /* 0xf */ - {0x487f,0x04,0x00,0x00,0x00,0x2f, 640, 400, 0x30}, /* 0x10 */ - {0xc06f,0x3c,0x01,0x06,0x13,0x31, 720, 480, 0x30}, /* 0x11 */ - {0x006f,0x3d,0x03,0x06,0x14,0x32, 720, 576, 0x30}, /* 0x12 */ - {0x0087,0x15,0x06,0x00,0x06,0x37,1024, 768, 0x30}, /* 0x13 */ - {0xc877,0x16,0x0b,0x06,0x06,0x37,1024, 768, 0x20}, /* 0x14 */ - {0xc067,0x17,0x0f,0x49,0x06,0x37,1024, 768, 0x20}, /* 0x15 */ - {0x0067,0x18,0x11,0x00,0x06,0x37,1024, 768, 0x20}, /* 0x16 */ - {0x0047,0x19,0x16,0x8c,0x06,0x37,1024, 768, 0x20}, /* 0x17 */ - {0x0107,0x1a,0x1b,0x00,0x06,0x37,1024, 768, 0x10}, /* 0x18 */ - {0x0107,0x1b,0x1f,0x00,0x06,0x37,1024, 768, 0x10}, /* 0x19 */ - {0x0087,0x1c,0x11,0x00,0x07,0x3a,1280,1024, 0x30}, /* 0x1a */ - {0x0137,0x1d,0x19,0x07,0x07,0x3a,1280,1024, 0x00}, /* 0x1b */ - {0x0107,0x1e,0x1e,0x00,0x07,0x3a,1280,1024, 0x00}, /* 0x1c */ - {0x0207,0x1f,0x20,0x00,0x07,0x3a,1280,1024, 0x00}, /* 0x1d */ - {0x0227,0x20,0x21,0x09,0x09,0x3c,1600,1200, 0x00}, /* 0x1e */ - {0x0407,0x21,0x22,0x00,0x09,0x3c,1600,1200, 0x00}, /* 0x1f */ - {0x0407,0x22,0x23,0x00,0x09,0x3c,1600,1200, 0x00}, /* 0x20 */ - {0x0407,0x23,0x25,0x00,0x09,0x3c,1600,1200, 0x00}, /* 0x21 */ - {0x0007,0x24,0x26,0x00,0x09,0x3c,1600,1200, 0x00}, /* 0x22 */ - {0x0007,0x25,0x2c,0x00,0x09,0x3c,1600,1200, 0x00}, /* 0x23 */ - {0x0007,0x26,0x34,0x00,0x09,0x3c,1600,1200, 0x00}, /* 0x24 */ - {0x407f,0x00,0x00,0x00,0x00,0x40, 320, 200, 0x30}, /* 0x25 */ - {0xc07f,0x01,0x00,0x04,0x04,0x50, 320, 240, 0x30}, /* 0x26 */ - {0x007f,0x02,0x04,0x05,0x05,0x51, 400, 300, 0x30}, /* 0x27 */ - {0xc077,0x03,0x0b,0x06,0x06,0x52, 512, 384, 0x30}, /* 0x28 */ - {0x8007,0x27,0x27,0x00,0x00,0x68,1920,1440, 0x00}, /* 0x29 */ - {0x4007,0x28,0x29,0x00,0x00,0x68,1920,1440, 0x00}, /* 0x2a */ - {0x4007,0x29,0x2e,0x00,0x00,0x68,1920,1440, 0x00}, /* 0x2b */ - {0x4007,0x2a,0x30,0x00,0x00,0x68,1920,1440, 0x00}, /* 0x2c */ - {0x4007,0x2b,0x35,0x00,0x00,0x68,1920,1440, 0x00}, /* 0x2d */ - {0x4005,0x2c,0x39,0x00,0x00,0x68,1920,1440, 0x00}, /* 0x2e */ - {0x4007,0x2d,0x2b,0x00,0x00,0x6c,2048,1536, 0x00}, /* 0x2f */ - {0x4007,0x2e,0x31,0x00,0x00,0x6c,2048,1536, 0x00}, /* 0x30 */ - {0x4007,0x2f,0x33,0x00,0x00,0x6c,2048,1536, 0x00}, /* 0x31 */ - {0x4007,0x30,0x37,0x00,0x00,0x6c,2048,1536, 0x00}, /* 0x32 */ - {0x4005,0x31,0x38,0x00,0x00,0x6c,2048,1536, 0x00}, /* 0x33 */ - {0x0077,0x32,0x40,0x08,0x18,0x70, 800, 480, 0x30}, /* 0x34 */ - {0x0047,0x33,0x07,0x08,0x18,0x70, 800, 480, 0x30}, /* 0x35 */ - {0x0047,0x34,0x0a,0x08,0x18,0x70, 800, 480, 0x30}, /* 0x36 */ - {0x0077,0x35,0x0b,0x09,0x19,0x71,1024, 576, 0x30}, /* 0x37 */ - {0x0047,0x36,0x11,0x09,0x19,0x71,1024, 576, 0x30}, /* 0x38 */ - {0x0047,0x37,0x16,0x09,0x19,0x71,1024, 576, 0x30}, /* 0x39 */ - {0x1137,0x38,0x19,0x0a,0x0c,0x75,1280, 720, 0x30}, /* 0x3a */ - {0x1107,0x39,0x1e,0x0a,0x0c,0x75,1280, 720, 0x30}, /* 0x3b */ - {0x1307,0x3a,0x20,0x0a,0x0c,0x75,1280, 720, 0x30}, /* 0x3c */ - {0x0127,0x3b,0x19,0x08,0x0a,0x7c,1280, 960, 0x30}, /* 0x3d */ - {0x0227,0x4c,0x59,0x08,0x0a,0x7c,1280, 960, 0x20}, /* 0x3e */ - {0xc07f,0x4e,0x00,0x06,0x04,0x5a, 320, 240, 0x30}, /* 0x3f */ /* FSTN 320x240 */ - {0x0077,0x42,0x5b,0x08,0x11,0x23,1280, 768, 0x30}, /* 0x40 */ /* 0x5b was 0x12 */ - {0x0127,0x43,0x4d,0x08,0x0b,0x26,1400,1050, 0x30}, /* 0x41 */ - {0x0207,0x4b,0x5a,0x08,0x0b,0x26,1400,1050, 0x30}, /* 0x42 1400x1050-75Hz */ - {0x0127,0x54,0x6d,0x00,0x1a,0x29,1152, 864, 0x30}, /* 0x43 1152x864-60Hz */ - {0x0127,0x44,0x19,0x00,0x1a,0x29,1152, 864, 0x30}, /* 0x44 1152x864-75Hz */ - {0x0127,0x4a,0x1e,0x00,0x1a,0x29,1152, 864, 0x30}, /* 0x45 1152x864-85Hz */ - {0x0087,0x45,0x57,0x00,0x16,0x39, 848, 480, 0x30}, /* 0x46 848x480-38Hzi */ - {0xc067,0x46,0x55,0x0b,0x16,0x39, 848, 480, 0x30}, /* 0x47 848x480-60Hz */ - {0x0087,0x47,0x57,0x00,0x17,0x3f, 856, 480, 0x30}, /* 0x48 856x480-38Hzi */ - {0xc067,0x48,0x57,0x00,0x17,0x3f, 856, 480, 0x30}, /* 0x49 856x480-60Hz */ - {0x0067,0x49,0x58,0x0c,0x1b,0x48,1360, 768, 0x30}, /* 0x4a 1360x768-60Hz */ - {0x006f,0x4d,0x03,0x06,0x15,0x5f, 768, 576, 0x30}, /* 0x4b 768x576-56Hz */ - {0x0067,0x4f,0x5c,0x08,0x0d,0x14,1280, 800, 0x30}, /* 0x4c 1280x800-60Hz */ - {0x0067,0x50,0x5d,0x0c,0x0e,0x17,1680,1050, 0x30}, /* 0x4d 1680x1050-60Hz */ - {0x0087,0x51,0x69,0x00,0x00,0x2c,1920,1080, 0x30}, /* 0x4e 1920x1080 60Hzi */ - {0x0067,0x52,0x6a,0x00,0x1c,0x1d, 960, 540, 0x30}, /* 0x4f 960x540 60Hz */ - {0x0077,0x53,0x6b,0x0b,0x1d,0x20, 960, 600, 0x30}, /* 0x50 960x600 60Hz */ - {0xffff,0x00,0x00,0x00,0x00,0x00, 0, 0, 0} -}; - -#ifdef LINUX_XF86 -static const struct { - UCHAR Ext_ModeID; /* ModeID in new ROM */ - UCHAR Ext_MyModeID; /* corresponding ModeID in my tables (0 = identical) */ - USHORT Ext_VESAID; /* corresponding VESA ID in new ROM */ -} SiS_EModeIDTable661[] = { - { 0x6a, 0x00, 0x0102 }, - { 0x1d, 0x20, 0x0000 }, - { 0x1e, 0x21, 0x0000 }, - { 0x1f, 0x22, 0x0000 }, - { 0x20, 0x29, 0x0000 }, - { 0x21, 0x2a, 0x0000 }, - { 0x22, 0x2b, 0x0000 }, - { 0x23, 0x00, 0x011c }, - { 0x24, 0x00, 0x011d }, - { 0x25, 0x00, 0x011e }, - { 0x26, 0x00, 0x011f }, - { 0x27, 0x00, 0x0120 }, - { 0x28, 0x00, 0x0121 }, - { 0x2a, 0x14, 0x013d }, - { 0x2b, 0x15, 0x013e }, - { 0x2c, 0x16, 0x013f }, - { 0x2e, 0x00, 0x0101 }, - { 0x2f, 0x00, 0x0100 }, - { 0x30, 0x00, 0x0103 }, - { 0x37, 0x00, 0x0104 }, - { 0x38, 0x00, 0x0105 }, - { 0x3a, 0x00, 0x0107 }, - { 0x3c, 0x00, 0x0125 }, - { 0x3d, 0x00, 0x0126 }, - { 0x40, 0x00, 0x010d }, - { 0x41, 0x00, 0x010e }, - { 0x43, 0x00, 0x0110 }, - { 0x44, 0x00, 0x0111 }, - { 0x46, 0x00, 0x0113 }, - { 0x47, 0x00, 0x0114 }, - { 0x49, 0x00, 0x0116 }, - { 0x4a, 0x00, 0x0117 }, - { 0x4c, 0x00, 0x0119 }, - { 0x4d, 0x00, 0x011a }, - { 0x50, 0x00, 0x0127 }, - { 0x51, 0x00, 0x0128 }, - { 0x52, 0x00, 0x0129 }, - { 0x56, 0x00, 0x012a }, - { 0x57, 0x00, 0x012b }, - { 0x58, 0x00, 0x012c }, - { 0x59, 0x00, 0x012d }, - { 0x5a, 0x17, 0x012e }, - { 0x5b, 0x18, 0x012f }, - { 0x5c, 0x19, 0x0130 }, - { 0x5d, 0x00, 0x0131 }, - { 0x62, 0x00, 0x0112 }, - { 0x63, 0x00, 0x0115 }, - { 0x64, 0x00, 0x0118 }, - { 0x65, 0x00, 0x011b }, - { 0x66, 0x00, 0x0132 }, - { 0x75, 0x00, 0x013a }, - { 0x78, 0x00, 0x013b }, - { 0x79, 0x00, 0x013c }, - { 0x7b, 0x7c, 0x0136 }, - { 0x7c, 0x7d, 0x0137 }, - { 0x7d, 0x7e, 0x0138 }, - { 0xff, 0xff, 0xffff } -}; -#endif - -static const SiS_CRT1TableStruct SiS310_CRT1Table[]= +static const struct SiS_Ext2 SiS310_RefIndex[] = +{ + {0x085f,0x0d,0x03,0x05,0x05,0x6a, 800, 600, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x0 */ + {0x0067,0x0e,0x04,0x05,0x05,0x6a, 800, 600, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x1 */ + {0x0067,0x0f,0x08,0x48,0x05,0x6a, 800, 600, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x2 */ + {0x0067,0x10,0x07,0x8b,0x05,0x6a, 800, 600, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x3 */ + {0x0047,0x11,0x0a,0x00,0x05,0x6a, 800, 600, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x4 */ + {0x0047,0x12,0x0d,0x00,0x05,0x6a, 800, 600, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x5 */ + {0x0047,0x13,0x13,0x00,0x05,0x6a, 800, 600, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x6 */ + {0x0107,0x14,0x1c,0x00,0x05,0x6a, 800, 600, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x7 */ + {0xc85f,0x05,0x00,0x04,0x04,0x2e, 640, 480, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x8 */ + {0xc067,0x06,0x02,0x04,0x04,0x2e, 640, 480, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x9 */ + {0xc067,0x07,0x02,0x47,0x04,0x2e, 640, 480, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0xa */ + {0xc067,0x08,0x03,0x8a,0x04,0x2e, 640, 480, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0xb */ + {0xc047,0x09,0x05,0x00,0x04,0x2e, 640, 480, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0xc */ + {0xc047,0x0a,0x09,0x00,0x04,0x2e, 640, 480, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0xd */ + {0xc047,0x0b,0x0e,0x00,0x04,0x2e, 640, 480, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0xe */ + {0xc047,0x0c,0x15,0x00,0x04,0x2e, 640, 480, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0xf */ + {0x487f,0x04,0x00,0x00,0x00,0x2f, 640, 400, 0x30, 0x55, 0x6e, 0x00, 0x00, 0x00, 0x00}, /* 0x10 */ + {0xc06f,0x3c,0x01,0x06,0x13,0x31, 720, 480, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x11 */ + {0x006f,0x3d,0x6f,0x06,0x14,0x32, 720, 576, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x12 (6f was 03) */ + {0x0087,0x15,0x06,0x00,0x06,0x37,1024, 768, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x13 */ + {0xc877,0x16,0x0b,0x06,0x06,0x37,1024, 768, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x14 */ + {0xc067,0x17,0x0f,0x49,0x06,0x37,1024, 768, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x15 */ + {0x0067,0x18,0x11,0x00,0x06,0x37,1024, 768, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x16 */ + {0x0047,0x19,0x16,0x8c,0x06,0x37,1024, 768, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x17 */ + {0x0107,0x1a,0x1b,0x00,0x06,0x37,1024, 768, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x18 */ + {0x0107,0x1b,0x1f,0x00,0x06,0x37,1024, 768, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x19 */ + {0x0087,0x1c,0x11,0x00,0x07,0x3a,1280,1024, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x1a */ + {0x0137,0x1d,0x19,0x07,0x07,0x3a,1280,1024, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x1b */ + {0x0107,0x1e,0x1e,0x00,0x07,0x3a,1280,1024, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x1c */ + {0x0207,0x1f,0x20,0x00,0x07,0x3a,1280,1024, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x1d */ + {0x0227,0x20,0x21,0x09,0x09,0x3c,1600,1200, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x1e */ + {0x0407,0x21,0x22,0x00,0x09,0x3c,1600,1200, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x1f */ + {0x0407,0x22,0x23,0x00,0x09,0x3c,1600,1200, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x20 */ + {0x0407,0x23,0x25,0x00,0x09,0x3c,1600,1200, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x21 */ + {0x0007,0x24,0x26,0x00,0x09,0x3c,1600,1200, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x22 */ + {0x0007,0x25,0x2c,0x00,0x09,0x3c,1600,1200, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x23 */ + {0x0007,0x26,0x34,0x00,0x09,0x3c,1600,1200, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x24 */ + {0x407f,0x00,0x00,0x00,0x00,0x40, 320, 200, 0x30, 0x56, 0x4e, 0x00, 0x00, 0x00, 0x00}, /* 0x25 */ + {0xc07f,0x01,0x00,0x04,0x04,0x50, 320, 240, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x26 */ + {0x007f,0x02,0x04,0x05,0x05,0x51, 400, 300, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x27 */ + {0xc077,0x03,0x0b,0x06,0x06,0x52, 512, 384, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x28 */ + {0x8007,0x27,0x27,0x00,0x00,0x68,1920,1440, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x29 */ + {0x4007,0x28,0x29,0x00,0x00,0x68,1920,1440, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x2a */ + {0x4007,0x29,0x2e,0x00,0x00,0x68,1920,1440, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x2b */ + {0x4007,0x2a,0x30,0x00,0x00,0x68,1920,1440, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x2c */ + {0x4007,0x2b,0x35,0x00,0x00,0x68,1920,1440, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x2d */ + {0x4005,0x2c,0x39,0x00,0x00,0x68,1920,1440, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x2e */ + {0x4007,0x2d,0x2b,0x00,0x00,0x6c,2048,1536, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x2f */ + {0x4007,0x2e,0x31,0x00,0x00,0x6c,2048,1536, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x30 */ + {0x4007,0x2f,0x33,0x00,0x00,0x6c,2048,1536, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x31 */ + {0x4007,0x30,0x37,0x00,0x00,0x6c,2048,1536, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x32 */ + {0x4005,0x31,0x38,0x00,0x00,0x6c,2048,1536, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x33 */ + {0x2077,0x32,0x40,0x08,0x18,0x70, 800, 480, 0x30, 0x00, 0x00, 0x32, 0x40, 0x5e, 0x73}, /* 0x34 */ + {0x2047,0x33,0x07,0x08,0x18,0x70, 800, 480, 0x30, 0x00, 0x00, 0x33, 0x07, 0xff, 0xff}, /* 0x35 */ + {0x2047,0x34,0x0a,0x08,0x18,0x70, 800, 480, 0x30, 0x00, 0x00, 0x34, 0x0a, 0xff, 0xff}, /* 0x36 */ + {0x2077,0x35,0x0b,0x09,0x19,0x71,1024, 576, 0x30, 0x00, 0x00, 0x35, 0x0b, 0x5f, 0x74}, /* 0x37 */ + {0x2047,0x36,0x11,0x09,0x19,0x71,1024, 576, 0x30, 0x00, 0x00, 0x36, 0x11, 0xff, 0xff}, /* 0x38 */ + {0x2047,0x37,0x16,0x09,0x19,0x71,1024, 576, 0x30, 0x00, 0x00, 0x37, 0x16, 0xff, 0xff}, /* 0x39 */ + {0x3137,0x38,0x19,0x0a,0x0c,0x75,1280, 720, 0x30, 0x00, 0x00, 0x38, 0x19, 0x60, 0x75}, /* 0x3a */ + {0x3107,0x39,0x1e,0x0a,0x0c,0x75,1280, 720, 0x30, 0x00, 0x00, 0x39, 0x1e, 0xff, 0xff}, /* 0x3b */ + {0x3307,0x3a,0x20,0x0a,0x0c,0x75,1280, 720, 0x30, 0x00, 0x00, 0x3a, 0x20, 0xff, 0xff}, /* 0x3c */ + {0x0127,0x3b,0x19,0x08,0x0a,0x7c,1280, 960, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x3d */ + {0x0227,0x4c,0x59,0x08,0x0a,0x7c,1280, 960, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x3e */ + {0xc07f,0x4e,0x00,0x06,0x04,0x5a, 320, 240, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x3f */ /* FSTN 320x240 */ + {0x2077,0x42,0x5b,0x08,0x11,0x23,1280, 768, 0x30, 0x00, 0x00, 0x58, 0x19, 0x42, 0x5b}, /* 0x40 */ /* 0x5b was 0x12 */ + {0x2077,0x42,0x5b,0x08,0x11,0x23,1280, 768, 0x30, 0x00, 0x00, 0x59, 0x1e, 0xff, 0xff}, /* 0x41 */ + {0x2077,0x42,0x5b,0x08,0x11,0x23,1280, 768, 0x30, 0x00, 0x00, 0x5a, 0x20, 0xff, 0xff}, /* 0x42 */ + {0x0127,0x43,0x4d,0x08,0x0b,0x26,1400,1050, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x43 */ + {0x0207,0x4b,0x5a,0x08,0x0b,0x26,1400,1050, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x44 1400x1050-75Hz */ + {0x0127,0x54,0x6d,0x00,0x1a,0x29,1152, 864, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x45 1152x864-60Hz */ + {0x0127,0x44,0x19,0x00,0x1a,0x29,1152, 864, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x46 1152x864-75Hz */ + {0x0127,0x4a,0x1e,0x00,0x1a,0x29,1152, 864, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x47 1152x864-85Hz */ + {0x0087,0x45,0x57,0x00,0x16,0x39, 848, 480, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x48 848x480-38Hzi */ + {0xc067,0x46,0x55,0x0b,0x16,0x39, 848, 480, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x49 848x480-60Hz */ + {0x0087,0x47,0x57,0x00,0x17,0x3f, 856, 480, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x4a 856x480-38Hzi */ + {0xc067,0x48,0x57,0x00,0x17,0x3f, 856, 480, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x4b 856x480-60Hz */ + {0x0067,0x49,0x58,0x0c,0x1b,0x48,1360, 768, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x4c 1360x768-60Hz */ + {0x006f,0x4d,0x71,0x06,0x15,0x5f, 768, 576, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x4d 768x576-56Hz */ + {0x2067,0x4f,0x5c,0x08,0x0d,0x14,1280, 800, 0x30, 0x00, 0x00, 0x5b, 0x19, 0x4f, 0x5c}, /* 0x4e 1280x800-60Hz */ + {0x2067,0x4f,0x5c,0x08,0x0d,0x14,1280, 800, 0x30, 0x00, 0x00, 0x5c, 0x1e, 0xff, 0xff}, /* 0x4f 1280x800-75Hz */ + {0x2067,0x4f,0x5c,0x08,0x0d,0x14,1280, 800, 0x30, 0x00, 0x00, 0x5d, 0x20, 0xff, 0xff}, /* 0x50 1280x800-85Hz */ + {0x0067,0x50,0x5d,0x0c,0x0e,0x17,1680,1050, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x51 1680x1050-60Hz */ + {0x0087,0x51,0x69,0x00,0x00,0x2c,1920,1080, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x52 1920x1080 60Hzi */ + {0x0067,0x52,0x6a,0x00,0x1c,0x1d, 960, 540, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x53 960x540 60Hz */ + {0x0077,0x53,0x6b,0x0b,0x1d,0x20, 960, 600, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x54 960x600 60Hz */ + {0x2067,0x61,0x76,0x0d,0x22,0x1a,1280, 854, 0x30, 0x00, 0x00, 0x62, 0x19, 0x61, 0x76}, /* 0x55 1280x854-60Hz */ + {0x2067,0x61,0x76,0x0d,0x22,0x1a,1280, 854, 0x30, 0x00, 0x00, 0x63, 0x1e, 0xff, 0xff}, /* 0x56 1280x854-75Hz */ + {0x2067,0x61,0x76,0x0d,0x22,0x1a,1280, 854, 0x30, 0x00, 0x00, 0x64, 0x20, 0xff, 0xff}, /* 0x57 1280x854-85Hz */ + {0xffff,0x00,0x00,0x00,0x00,0x00, 0, 0, 0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} +}; + +static const struct SiS_CRT1Table SiS310_CRT1Table[] = { {{0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f, 0x9c,0x8e,0x8f,0x96,0xb9,0x30,0x00,0x00, - 0x00}}, /* 0x0 */ + 0x00}}, /* 0x0 */ {{0x2d,0x27,0x28,0x90,0x2c,0x80,0x0b,0x3e, 0xe9,0x8b,0xdf,0xe7,0x04,0x00,0x00,0x00, - 0x00}}, /* 0x1 */ + 0x00}}, /* 0x1 */ {{0x3d,0x31,0x31,0x81,0x37,0x1f,0x72,0xf0, 0x58,0x8c,0x57,0x57,0x73,0x20,0x00,0x05, - 0x01}}, /* 0x2 */ + 0x01}}, /* 0x2 */ {{0x4f,0x3f,0x3f,0x93,0x45,0x0d,0x24,0xf5, 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x01, - 0x01}}, /* 0x3 */ + 0x01}}, /* 0x3 */ {{0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, 0x9c,0x8e,0x8f,0x96,0xb9,0x30,0x00,0x05, - 0x00}}, /* 0x4 */ -#if 0 - {{0x5f,0x4f,0x50,0x82,0x55,0x81,0x0b,0x3e, - 0xe9,0x8b,0xdf,0xe7,0x04,0x00,0x00,0x05, - 0x00}}, /* 0x5 */ -#endif - {{0x5f,0x4f,0x4f,0x83,0x55,0x81,0x0b,0x3e, /* 0x05 - corrected 640x480-60 */ + 0x00}}, /* 0x4 */ + {{0x5f,0x4f,0x4f,0x83,0x55,0x81,0x0b,0x3e, /* corrected 640x480-60 */ 0xe9,0x8b,0xdf,0xe8,0x0c,0x00,0x00,0x05, - 0x00}}, -#if 0 - {{0x63,0x4f,0x50,0x86,0x56,0x9b,0x06,0x3e, - 0xe8,0x8b,0xdf,0xe7,0xff,0x10,0x00,0x01, - 0x00}}, /* 0x6 */ -#endif - {{0x63,0x4f,0x4f,0x87,0x56,0x9b,0x06,0x3e, /* 0x06 - corrected 640x480-72 */ + 0x00}}, /* 0x5 */ + {{0x63,0x4f,0x4f,0x87,0x56,0x9b,0x06,0x3e, /* corrected 640x480-72 */ 0xe8,0x8a,0xdf,0xe7,0x07,0x00,0x00,0x01, - 0x00}}, + 0x00}}, /* 0x6 */ {{0x64,0x4f,0x4f,0x88,0x55,0x9d,0xf2,0x1f, 0xe0,0x83,0xdf,0xdf,0xf3,0x10,0x00,0x01, - 0x00}}, /* 0x7 */ + 0x00}}, /* 0x7 */ {{0x63,0x4f,0x4f,0x87,0x5a,0x81,0xfb,0x1f, 0xe0,0x83,0xdf,0xdf,0xfc,0x10,0x00,0x05, - 0x00}}, /* 0x8 */ + 0x00}}, /* 0x8 */ {{0x65,0x4f,0x4f,0x89,0x58,0x80,0xfb,0x1f, 0xe0,0x83,0xdf,0xdf,0xfc,0x10,0x00,0x05, /* Corrected VBE */ - 0x61}}, /* 0x9 */ + 0x61}}, /* 0x9 */ {{0x65,0x4f,0x4f,0x89,0x58,0x80,0x01,0x3e, 0xe0,0x83,0xdf,0xdf,0x02,0x00,0x00,0x05, - 0x61}}, /* 0xa */ + 0x61}}, /* 0xa */ {{0x67,0x4f,0x4f,0x8b,0x58,0x81,0x0d,0x3e, 0xe0,0x83,0xdf,0xdf,0x0e,0x00,0x00,0x05, /* Corrected VBE */ - 0x61}}, /* 0xb */ + 0x61}}, /* 0xb */ {{0x65,0x4f,0x4f,0x89,0x57,0x9f,0xfb,0x1f, 0xe6,0x8a,0xdf,0xdf,0xfc,0x10,0x00,0x01, /* Corrected VDE, VBE */ - 0x00}}, /* 0xc */ + 0x00}}, /* 0xc */ {{0x7b,0x63,0x63,0x9f,0x6a,0x93,0x6f,0xf0, 0x58,0x8a,0x57,0x57,0x70,0x20,0x00,0x05, - 0x01}}, /* 0xd */ + 0x01}}, /* 0xd */ {{0x7f,0x63,0x63,0x83,0x6c,0x1c,0x72,0xf0, 0x58,0x8c,0x57,0x57,0x73,0x20,0x00,0x06, - 0x01}}, /* 0xe */ + 0x01}}, /* 0xe */ {{0x7d,0x63,0x63,0x81,0x6e,0x1d,0x98,0xf0, 0x7c,0x82,0x57,0x57,0x99,0x00,0x00,0x06, - 0x01}}, /* 0xf */ + 0x01}}, /* 0xf */ {{0x7f,0x63,0x63,0x83,0x69,0x13,0x6f,0xf0, 0x58,0x8b,0x57,0x57,0x70,0x20,0x00,0x06, - 0x01}}, /* 0x10 */ + 0x01}}, /* 0x10 */ {{0x7e,0x63,0x63,0x82,0x6b,0x13,0x75,0xf0, 0x58,0x8b,0x57,0x57,0x76,0x20,0x00,0x06, - 0x01}}, /* 0x11 */ + 0x01}}, /* 0x11 */ {{0x81,0x63,0x63,0x85,0x6d,0x18,0x7a,0xf0, 0x58,0x8b,0x57,0x57,0x7b,0x20,0x00,0x06, - 0x61}}, /* 0x12 */ + 0x61}}, /* 0x12 */ {{0x83,0x63,0x63,0x87,0x6e,0x19,0x81,0xf0, 0x58,0x8b,0x57,0x57,0x82,0x20,0x00,0x06, - 0x61}}, /* 0x13 */ + 0x61}}, /* 0x13 */ {{0x85,0x63,0x63,0x89,0x6f,0x1a,0x91,0xf0, 0x58,0x8b,0x57,0x57,0x92,0x20,0x00,0x06, - 0x61}}, /* 0x14 */ + 0x61}}, /* 0x14 */ {{0x99,0x7f,0x7f,0x9d,0x84,0x1a,0x96,0x1f, 0x7f,0x83,0x7f,0x7f,0x97,0x10,0x00,0x02, - 0x00}}, /* 0x15 */ + 0x00}}, /* 0x15 */ {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf5, 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x02, - 0x01}}, /* 0x16 */ + 0x01}}, /* 0x16 */ {{0xa1,0x7f,0x7f,0x85,0x86,0x97,0x24,0xf5, 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x02, - 0x01}}, /* 0x17 */ + 0x01}}, /* 0x17 */ {{0x9f,0x7f,0x7f,0x83,0x85,0x91,0x1e,0xf5, 0x00,0x83,0xff,0xff,0x1f,0x10,0x00,0x02, - 0x01}}, /* 0x18 */ + 0x01}}, /* 0x18 */ {{0xa7,0x7f,0x7f,0x8b,0x89,0x95,0x26,0xf5, 0x00,0x83,0xff,0xff,0x27,0x10,0x00,0x02, - 0x01}}, /* 0x19 */ + 0x01}}, /* 0x19 */ {{0xa9,0x7f,0x7f,0x8d,0x8c,0x9a,0x2c,0xf5, 0x00,0x83,0xff,0xff,0x2d,0x14,0x00,0x02, - 0x62}}, /* 0x1a */ + 0x62}}, /* 0x1a */ {{0xab,0x7f,0x7f,0x8f,0x8d,0x9b,0x35,0xf5, 0x00,0x83,0xff,0xff,0x36,0x14,0x00,0x02, - 0x62}}, /* 0x1b */ + 0x62}}, /* 0x1b */ {{0xcf,0x9f,0x9f,0x93,0xb2,0x01,0x14,0xba, 0x00,0x83,0xff,0xff,0x15,0x00,0x00,0x03, - 0x00}}, /* 0x1c */ + 0x00}}, /* 0x1c */ {{0xce,0x9f,0x9f,0x92,0xa9,0x17,0x28,0x5a, 0x00,0x83,0xff,0xff,0x29,0x09,0x00,0x07, - 0x01}}, /* 0x1d */ + 0x01}}, /* 0x1d */ {{0xce,0x9f,0x9f,0x92,0xa5,0x17,0x28,0x5a, 0x00,0x83,0xff,0xff,0x29,0x09,0x00,0x07, - 0x01}}, /* 0x1e */ + 0x01}}, /* 0x1e */ {{0xd3,0x9f,0x9f,0x97,0xab,0x1f,0x2e,0x5a, 0x00,0x83,0xff,0xff,0x2f,0x09,0x00,0x07, - 0x01}}, /* 0x1f */ + 0x01}}, /* 0x1f */ {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, - 0x00}}, /* 0x20 */ + 0x00}}, /* 0x20 */ {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, - 0x00}}, /* 0x21 @ 4084 */ + 0x00}}, /* 0x21 */ {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, - 0x00}}, /* 0x22 */ + 0x00}}, /* 0x22 */ {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, - 0x00}}, /* 0x23 */ + 0x00}}, /* 0x23 */ {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, - 0x00}}, /* 0x24 */ + 0x00}}, /* 0x24 */ {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, - 0x00}}, /* 0x25 */ + 0x00}}, /* 0x25 */ {{0x09,0xc7,0xc7,0x8d,0xd3,0x0b,0xe0,0x10, 0xb0,0x83,0xaf,0xaf,0xe1,0x2f,0x01,0x04, - 0x00}}, /* 0x26 */ + 0x00}}, /* 0x26 */ {{0x40,0xef,0xef,0x84,0x03,0x1d,0xda,0x1f, 0xa0,0x83,0x9f,0x9f,0xdb,0x1f,0x41,0x01, - 0x00}}, /* 0x27 */ + 0x00}}, /* 0x27 */ {{0x43,0xef,0xef,0x87,0x06,0x00,0xd4,0x1f, 0xa0,0x83,0x9f,0x9f,0xd5,0x1f,0x41,0x05, - 0x63}}, /* 0x28 */ + 0x63}}, /* 0x28 */ {{0x45,0xef,0xef,0x89,0x07,0x01,0xd9,0x1f, 0xa0,0x83,0x9f,0x9f,0xda,0x1f,0x41,0x05, - 0x63}}, /* 0x29 */ + 0x63}}, /* 0x29 */ {{0x40,0xef,0xef,0x84,0x03,0x1d,0xda,0x1f, 0xa0,0x83,0x9f,0x9f,0xdb,0x1f,0x41,0x01, - 0x00}}, /* 0x2a */ + 0x00}}, /* 0x2a */ {{0x40,0xef,0xef,0x84,0x03,0x1d,0xda,0x1f, 0xa0,0x83,0x9f,0x9f,0xdb,0x1f,0x41,0x01, - 0x00}}, /* 0x2b */ + 0x00}}, /* 0x2b */ {{0x40,0xef,0xef,0x84,0x03,0x1d,0xda,0x1f, 0xa0,0x83,0x9f,0x9f,0xdb,0x1f,0x41,0x01, - 0x00}}, /* 0x2c */ + 0x00}}, /* 0x2c */ {{0x59,0xff,0xff,0x9d,0x17,0x13,0x33,0xba, 0x00,0x83,0xff,0xff,0x34,0x0f,0x41,0x05, - 0x44}}, /* 0x2d */ + 0x44}}, /* 0x2d */ {{0x5b,0xff,0xff,0x9f,0x18,0x14,0x38,0xba, 0x00,0x83,0xff,0xff,0x39,0x0f,0x41,0x05, - 0x44}}, /* 0x2e */ + 0x44}}, /* 0x2e */ {{0x5b,0xff,0xff,0x9f,0x18,0x14,0x3d,0xba, 0x00,0x83,0xff,0xff,0x3e,0x0f,0x41,0x05, - 0x44}}, /* 0x2f */ + 0x44}}, /* 0x2f */ {{0x5d,0xff,0xff,0x81,0x19,0x95,0x41,0xba, 0x00,0x84,0xff,0xff,0x42,0x0f,0x41,0x05, - 0x44}}, /* 0x30 */ + 0x44}}, /* 0x30 */ {{0x55,0xff,0xff,0x99,0x0d,0x0c,0x3e,0xba, 0x00,0x84,0xff,0xff,0x3f,0x0f,0x41,0x05, - 0x00}}, /* 0x31 */ + 0x00}}, /* 0x31 */ {{0x7f,0x63,0x63,0x83,0x6c,0x1c,0x72,0xba, 0x27,0x8b,0xdf,0xdf,0x73,0x00,0x00,0x06, - 0x01}}, /* 0x32 */ + 0x01}}, /* 0x32 */ {{0x7f,0x63,0x63,0x83,0x69,0x13,0x6f,0xba, 0x26,0x89,0xdf,0xdf,0x6f,0x00,0x00,0x06, - 0x01}}, /* 0x33 */ + 0x01}}, /* 0x33 */ {{0x7f,0x63,0x63,0x82,0x6b,0x13,0x75,0xba, 0x29,0x8c,0xdf,0xdf,0x75,0x00,0x00,0x06, - 0x01}}, /* 0x34 */ + 0x01}}, /* 0x34 */ {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf1, 0xaf,0x85,0x3f,0x3f,0x25,0x30,0x00,0x02, - 0x01}}, /* 0x35 */ + 0x01}}, /* 0x35 */ {{0x9f,0x7f,0x7f,0x83,0x85,0x91,0x1e,0xf1, 0xad,0x81,0x3f,0x3f,0x1f,0x30,0x00,0x02, - 0x01}}, /* 0x36 */ + 0x01}}, /* 0x36 */ {{0xa7,0x7f,0x7f,0x88,0x89,0x95,0x26,0xf1, /* 95 was 15 - illegal HBE! */ 0xb1,0x85,0x3f,0x3f,0x27,0x30,0x00,0x02, - 0x01}}, /* 0x37 */ + 0x01}}, /* 0x37 */ {{0xce,0x9f,0x9f,0x92,0xa9,0x17,0x28,0xc4, 0x7a,0x8e,0xcf,0xcf,0x29,0x21,0x00,0x07, - 0x01}}, /* 0x38 */ + 0x01}}, /* 0x38 */ {{0xce,0x9f,0x9f,0x92,0xa5,0x17,0x28,0xd4, 0x7a,0x8e,0xcf,0xcf,0x29,0x21,0x00,0x07, - 0x01}}, /* 0x39 */ + 0x01}}, /* 0x39 */ {{0xd3,0x9f,0x9f,0x97,0xab,0x1f,0x2e,0xd4, 0x7d,0x81,0xcf,0xcf,0x2f,0x21,0x00,0x07, - 0x01}}, /* 0x3a */ -#if 0 - {{0xdc,0x9f,0x9f,0x00,0xab,0x19,0xe6,0xef, /* 1280x960 - invalid */ - 0xc0,0xc3,0xbf,0xbf,0xe7,0x10,0x00,0x07, - 0x01}}, /* 0x3b */ -#endif + 0x01}}, /* 0x3a */ {{0xdc,0x9f,0x9f,0x80,0xaf,0x9d,0xe6,0xff, /* 1280x960-60 - corrected */ 0xc0,0x83,0xbf,0xbf,0xe7,0x10,0x00,0x07, - 0x01}}, /* 0x3b */ + 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 */ + 0x00}}, /* 0x3c */ + {{0x6d,0x59,0x59,0x91,0x60,0x89,0x53,0xf0, /* 720x576, corrected to 60Hz */ + 0x41,0x84,0x3f,0x3f,0x54,0x00,0x00,0x05, + 0x41}}, /* 0x3d */ {{0x86,0x6a,0x6a,0x8a,0x74,0x06,0x8c,0x15, 0x4f,0x83,0xef,0xef,0x8d,0x30,0x00,0x02, - 0x00}}, /* 0x3e */ + 0x00}}, /* 0x3e */ {{0x81,0x6a,0x6a,0x85,0x70,0x00,0x0f,0x3e, 0xeb,0x8e,0xdf,0xdf,0x10,0x00,0x00,0x02, - 0x00}}, /* 0x3f */ + 0x00}}, /* 0x3f */ {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x1e,0xf1, 0xae,0x85,0x57,0x57,0x1f,0x30,0x00,0x02, 0x01}}, /* 0x40 */ @@ -578,11 +483,11 @@ static const SiS_CRT1TableStruct SiS310_CRT1Table[]= {{0xd3,0x9f,0x9f,0x97,0xab,0x1f,0xf1,0xff, /* 1280x960-85 */ 0xc0,0x83,0xbf,0xbf,0xf2,0x10,0x00,0x07, 0x01}}, /* 0x4c */ - {{0x7b,0x5f,0x63,0x9f,0x6a,0x93,0x6f,0xf0, /* 768x576 */ - 0x58,0x8a,0x3f,0x57,0x70,0x20,0x00,0x05, - 0x01}}, /* 0x4d */ - {{0x2d,0x27,0x28,0x90,0x2c,0x80,0x0b,0x3e, /* FSTN 320x480, TEMP - possibly invalid */ - 0xe9,0x8b,0xdf,0xe7,0x04,0x00,0x00,0x00, + {{0x75,0x5f,0x5f,0x99,0x66,0x90,0x53,0xf0, /* 768x576, corrected to 60Hz */ + 0x41,0x84,0x3f,0x3f,0x54,0x00,0x00,0x05, + 0x41}}, /* 0x4d */ + {{0x5f,0x27,0x4f,0x83,0x55,0x81,0x0b,0x3e, /* FSTN 320x240 (working) */ + 0xe9,0x8b,0xdf,0xe8,0x0c,0x00,0x00,0x05, 0x00}}, /* 0x4e */ {{0xcd,0x9f,0x9f,0x91,0xab,0x1c,0x3a,0xff, /* 1280x800-60 */ 0x20,0x83,0x1f,0x1f,0x3b,0x10,0x00,0x07, @@ -601,10 +506,58 @@ static const SiS_CRT1TableStruct SiS310_CRT1Table[]= 0x01}}, /* 0x53 */ {{0xcd,0x8f,0x8f,0x91,0x9b,0x1b,0x7a,0xff, /* 1152x864-60 */ 0x64,0x8c,0x5f,0x62,0x7b,0x10,0x00,0x07, - 0x41}} /* 0x54 */ -}; - -static const SiS_MCLKDataStruct SiS310_MCLKData_0_315[] = + 0x41}}, /* 0x54 */ + {{0x5c,0x4f,0x4f,0x80,0x57,0x80,0xa3,0x1f, /* fake 640x400@60Hz (for LCD and TV, not actually used) */ + 0x98,0x8c,0x8f,0x96,0xa4,0x30,0x00,0x05, + 0x40}}, /* 0x55 */ + {{0x2c,0x27,0x27,0x90,0x2d,0x92,0xa4,0x1f, /* fake 320x200@60Hz (for LCD and TV, not actually used) */ + 0x98,0x8c,0x8f,0x96,0xa5,0x30,0x00,0x04, + 0x00}}, /* 0x56 */ + {{0xd7,0xc7,0xc7,0x9b,0xd1,0x15,0xd1,0x10, /* 1600x1200 for LCDA */ + 0xb2,0x86,0xaf,0xb0,0xd2,0x2f,0x00,0x03, + 0x00}}, /* 0x57 */ + {{0xce,0x9f,0x9f,0x92,0xa9,0x17,0x28,0xdc, /* 1280x768 (1280x1024) 60 Hz */ + 0x92,0x86,0xff,0x91,0x29,0x21,0x00,0x07, + 0x01}}, /* 0x58 */ + {{0xce,0x9f,0x9f,0x92,0xa5,0x17,0x28,0xdc, /* 1280x768 (1280x1024) 75 Hz */ + 0x92,0x86,0xff,0x91,0x29,0x21,0x00,0x07, + 0x01}}, /* 0x59 */ + {{0xd3,0x9f,0x9f,0x97,0xab,0x1f,0x2e,0xdc, /* 1280x768 (1280x1024) 85 Hz */ + 0x95,0x89,0xff,0x94,0x2f,0x21,0x00,0x07, + 0x01}}, /* 0x5a */ + {{0xce,0x9f,0x9f,0x92,0xa9,0x17,0x28,0xde, /* 1280x800 (1280x1024) 60 Hz */ + 0xa2,0x86,0x1f,0xa1,0x29,0x01,0x00,0x07, + 0x01}}, /* 0x5b */ + {{0xce,0x9f,0x9f,0x92,0xa5,0x17,0x28,0xde, /* 1280x800 (1280x1024) 75 Hz */ + 0xa2,0x86,0x1f,0xa1,0x29,0x01,0x00,0x07, + 0x01}}, /* 0x5c */ + {{0xd3,0x9f,0x9f,0x97,0xab,0x1f,0x2e,0xde, /* 1280x800 (1280x1024) 85 Hz */ + 0xa5,0x89,0x1f,0xa4,0x2f,0x01,0x00,0x07, + 0x01}}, /* 0x5d */ + {{0x7f,0x63,0x63,0x83,0x6d,0x1d,0x0b,0x3e, /* 800x480 (wide) 60 Hz */ + 0xe9,0x8b,0xdf,0xe8,0x0c,0x00,0x00,0x06, + 0x00}}, /* 0x5e */ + {{0xa0,0x7f,0x7f,0x84,0x85,0x97,0x52,0xf0, /* 1024x576 (wide) 60 Hz */ + 0x41,0x85,0x3f,0x40,0x53,0x00,0x00,0x02, + 0x01}}, /* 0x5f */ + {{0xc9,0x9f,0x9f,0x8d,0xb0,0x15,0xec,0xf0, /* 1280x720 (wide) 60 Hz */ + 0xd4,0x89,0xcf,0xd3,0xed,0x20,0x00,0x07, + 0x01}}, /* 0x60 */ + {{0xcb,0x9f,0x9f,0x8f,0xa5,0x13,0x5b,0xff, /* 1280x854-60 wide */ + 0x56,0x89,0x55,0x55,0x5c,0x30,0x00,0x07, + 0x01}}, /* 0x61 */ + {{0xce,0x9f,0x9f,0x92,0xa9,0x17,0x28,0xde, /* 1280x854 (1280x1024) 60 Hz */ + 0xbd,0x81,0x55,0xbc,0x29,0x01,0x00,0x07, + 0x41}}, /* 0x62 */ + {{0xce,0x9f,0x9f,0x92,0xa5,0x17,0x28,0xde, /* 1280x854 (1280x1024) 75 Hz */ + 0xbd,0x81,0x55,0xbc,0x29,0x01,0x00,0x07, + 0x41}}, /* 0x63 */ + {{0xd3,0x9f,0x9f,0x97,0xab,0x1f,0x2e,0xde, /* 1280x854 (1280x1024) 85 Hz */ + 0xc0,0x84,0x55,0xbf,0x2f,0x01,0x00,0x07, + 0x41}} /* 0x64 */ +}; + +static const struct SiS_MCLKData SiS310_MCLKData_0_315[] = { { 0x3b,0x22,0x01,143}, { 0x5c,0x23,0x01,166}, @@ -616,7 +569,7 @@ static const SiS_MCLKDataStruct SiS310_MCLKData_0_315[] = { 0x5c,0x23,0x01,166} }; -static const SiS_MCLKDataStruct SiS310_MCLKData_0_650[] = +static const struct SiS_MCLKData SiS310_MCLKData_0_650[] = { { 0x5a,0x64,0x82, 66}, { 0xb3,0x45,0x82, 83}, @@ -628,7 +581,7 @@ static const SiS_MCLKDataStruct SiS310_MCLKData_0_650[] = { 0x37,0x22,0x82,133} }; -static const SiS_MCLKDataStruct SiS310_MCLKData_0_330[] = +static const struct SiS_MCLKData SiS310_MCLKData_0_330[] = { { 0x5c,0x23,0x01,166}, { 0x5c,0x23,0x01,166}, @@ -640,7 +593,7 @@ static const SiS_MCLKDataStruct SiS310_MCLKData_0_330[] = { 0x79,0x06,0x01,250} }; -static const SiS_MCLKDataStruct SiS310_MCLKData_0_660[] = +static const struct SiS_MCLKData SiS310_MCLKData_0_660[] = { { 0x5c,0x23,0x82,166}, { 0x5c,0x23,0x82,166}, @@ -652,7 +605,7 @@ static const SiS_MCLKDataStruct SiS310_MCLKData_0_660[] = { 0x37,0x21,0x82,200} }; -static const SiS_MCLKDataStruct SiS310_MCLKData_0_760[] = +static const struct SiS_MCLKData SiS310_MCLKData_0_760[] = { { 0x37,0x22,0x82,133}, { 0x5c,0x23,0x82,166}, @@ -664,7 +617,7 @@ static const SiS_MCLKDataStruct SiS310_MCLKData_0_760[] = { 0x37,0x21,0x82,200} }; -static const SiS_MCLKDataStruct SiS310_MCLKData_0_761[] = +static const struct SiS_MCLKData SiS310_MCLKData_0_761[] = { { 0x37,0x22,0x82,133}, /* Preliminary */ { 0x5c,0x23,0x82,166}, @@ -676,7 +629,7 @@ static const SiS_MCLKDataStruct SiS310_MCLKData_0_761[] = { 0x37,0x21,0x82,200} }; -static const SiS_MCLKDataStruct SiS310_MCLKData_0_340[] = +static const struct SiS_MCLKData SiS310_MCLKData_0_340[] = { { 0x79,0x06,0x01,250}, { 0x7c,0x08,0x01,200}, @@ -688,9 +641,9 @@ static const SiS_MCLKDataStruct SiS310_MCLKData_0_340[] = { 0x29,0x01,0x81,300} }; -static const SiS_MCLKDataStruct SiS310_MCLKData_1[] = /* ECLK */ +static const struct SiS_MCLKData SiS310_MCLKData_1[] = /* ECLK */ { - { 0x29,0x21,0x82,150}, + { 0x29,0x21,0x82,150}, { 0x5c,0x23,0x82,166}, { 0x65,0x23,0x82,183}, { 0x37,0x21,0x82,200}, @@ -700,7 +653,7 @@ static const SiS_MCLKDataStruct SiS310_MCLKData_1[] = /* ECLK */ { 0x37,0x22,0x82,133} }; -static const SiS_MCLKDataStruct SiS310_MCLKData_1_340[] = +static const struct SiS_MCLKData SiS310_MCLKData_1_340[] = { { 0x7c,0x08,0x01,200}, { 0x7c,0x08,0x01,200}, @@ -712,7 +665,7 @@ static const SiS_MCLKDataStruct SiS310_MCLKData_1_340[] = { 0x29,0x01,0x81,300} }; -static SiS_VCLKDataStruct SiS310_VCLKData[]= +static struct SiS_VCLKData SiS310_VCLKData[] = { { 0x1b,0xe1, 25}, /* 0x00 */ { 0x4e,0xe4, 28}, /* 0x01 */ @@ -805,7 +758,7 @@ static SiS_VCLKDataStruct SiS310_VCLKData[]= { 0x30,0x23, 88}, /* 0x58 1360x768-62 (is 60Hz!) */ { 0x52,0x07,149}, /* 0x59 1280x960-85 */ { 0x56,0x07,156}, /* 0x5a 1400x1050-75 */ - { 0x70,0x29, 81}, /* 0x5b 1280x768 LCD */ + { 0x70,0x29, 81}, /* 0x5b 1280x768 LCD */ { 0x45,0x25, 83}, /* 0x5c 1280x800 */ { 0x70,0x0a,147}, /* 0x5d 1680x1050 */ { 0x70,0x24,162}, /* 0x5e 1600x1200 */ @@ -823,10 +776,19 @@ static SiS_VCLKDataStruct SiS310_VCLKData[]= { 0x7c,0x6b, 38}, /* 0x6a 960x540@60 */ { 0xe3,0x56, 41}, /* 0x6b 960x600@60 */ { 0x45,0x25, 83}, /* 0x6c 1280x800 */ - { 0x70,0x28, 90} /* 0x6d 1152x864@60 */ + { 0x70,0x28, 90}, /* 0x6d 1152x864@60 */ + { 0x15,0xe1, 20}, /* 0x6e 640x400@60 (fake, not actually used) */ + { 0x5f,0xc6, 33}, /* 0x6f 720x576@60 */ + { 0x37,0x5a, 10}, /* 0x70 320x200@60 (fake, not actually used) */ + { 0x2b,0xc2, 35}, /* 0x71 768x576@60 */ + { 0xa8,0x42,131}, /* 0x72 1600x1200@60 for LCDA */ + { 0x1b,0xc1, 34}, /* 0x73 800x480 60Hz (wide) */ + { 0x41,0x64, 48}, /* 0x74 1024x576 60Hz (wide) */ + { 0x52,0x27, 75}, /* 0x75 1280x720 60Hz (wide) */ + { 0x75,0x13, 84} /* 0x76 1280x854 60Hz (wide) */ }; -static SiS_VBVCLKDataStruct SiS310_VBVCLKData[]= +static struct SiS_VBVCLKData SiS310_VBVCLKData[] = { { 0x1b,0xe1, 25}, /* 0x00 */ { 0x4e,0xe4, 28}, /* 0x01 */ @@ -858,12 +820,6 @@ static SiS_VBVCLKDataStruct SiS310_VBVCLKData[]= { 0x5e,0x43,113}, /* 0x1b */ { 0xbc,0x44,116}, /* 0x1c */ { 0xe0,0x46,132}, /* 0x1d */ -#if 0 - { 0xd4,0x28,135}, /* 0x1e */ - { 0xea,0x2a,139}, /* 0x1f */ - { 0x41,0x22,157}, /* 0x20 */ - { 0x70,0x24,162}, /* 0x21 */ -#endif { 0xe2,0x46,135}, /* 0x1e */ /* 1280x1024-75, better clock for VGA2 */ { 0xe5,0x46,139}, /* 0x1f */ /* 1024x768-120, better clock for VGA2 */ { 0x15,0x01,157}, /* 0x20 */ /* 1280x1024-85, better clock for VGA2 */ @@ -912,7 +868,7 @@ static SiS_VBVCLKDataStruct SiS310_VBVCLKData[]= { 0x34,0x61, 95}, /* 0x4b UNUSED */ { 0x78,0x27,108}, /* 0x4c UNUSED */ { 0x66,0x43,123}, /* 0x4d 1400x1050-60 */ - { 0x41,0x4e, 21}, /* 0x4e UNUSED */ + { 0x41,0x4e, 21}, /* 0x4e */ { 0xa1,0x4a, 29}, /* 0x4f UNUSED */ { 0x19,0x42, 42}, /* 0x50 UNUSED */ { 0x54,0x46, 58}, /* 0x51 UNUSED */ @@ -925,7 +881,7 @@ static SiS_VBVCLKDataStruct SiS310_VBVCLKData[]= { 0x30,0x23, 88}, /* 0x58 1360x768-62 (is 60Hz!) TEMP, UNUSED */ { 0x52,0x07,149}, /* 0x59 1280x960-85 */ { 0x56,0x07,156}, /* 0x5a 1400x1050-75 */ - { 0x70,0x29, 81}, /* 0x5b 1280x768 LCD (TMDS) */ + { 0x70,0x29, 81}, /* 0x5b 1280x768 LCD (TMDS) */ { 0xce,0x1e, 73}, /* 0x5c 1280x800_2 LCD (SiS LVDS) - (CRT1: 45 25 83) */ { 0xbe,0x44,121}, /* 0x5d 1680x1050 LCD */ { 0x70,0x24,162}, /* 0x5e 1600x1200 LCD */ @@ -943,57 +899,33 @@ static SiS_VBVCLKDataStruct SiS310_VBVCLKData[]= { 0x7c,0x6b, 38}, /* 0x6a 960x540@60 */ { 0xe3,0x56, 41}, /* 0x6b 960x600@60 */ { 0x9c,0x62, 69}, /* 0x6c 1280x800 (SiS TMDS) (special) */ - { 0x70,0x28, 90} /* 0x6d 1152x864@60 */ + { 0x70,0x28, 90}, /* 0x6d 1152x864@60 */ + { 0x15,0xe1, 20}, /* 0x6e 640x400@60 (fake, not actually used) */ + { 0x5f,0xc6, 33}, /* 0x6f 720x576@60 */ + { 0x37,0x5a, 10}, /* 0x70 320x200@60 (fake, not actually used) */ + { 0x2b,0xc2, 35}, /* 0x71 768@576@60 */ + { 0xa8,0x42,131}, /* 0x72 1600x1200@60 for LCDA */ + { 0x1b,0xc1, 34}, /* 0x73 800x480 60Hz (wide) */ + { 0x41,0x64, 48}, /* 0x74 1024x576 60Hz (wide) */ + { 0x52,0x27, 75}, /* 0x75 1280x720 60Hz (wide) */ + { 0x75,0x13, 84} /* 0x76 1280x854 60Hz (SiS LVDS) LCD */ }; -static const DRAM4Type SiS310_SR15[8] = { - {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} -}; - -#ifdef LINUX_KERNEL - -static UCHAR SiS310_SR07 = 0x18; - -static const DRAM4Type SiS310_CR40[5] = { - {0x77,0x77,0x33,0x33}, - {0x77,0x77,0x33,0x33}, - {0x00,0x00,0x00,0x00}, - {0x5b,0x5b,0x03,0x03}, - {0x00,0x00,0xf0,0xf8} +static const unsigned char SiS310_SR15[4 * 8] = +{ + 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 }; -static UCHAR SiS310_CR49[] = {0xaa,0x88}; -static UCHAR SiS310_SR1F = 0x00; -static UCHAR SiS310_SR21 = 0xa5; -static UCHAR SiS310_SR22 = 0xfb; -static UCHAR SiS310_SR23 = 0xf6; -static UCHAR SiS310_SR24 = 0x0d; -static UCHAR SiS310_SR25[] = {0x33,0x3}; -static UCHAR SiS310_SR31 = 0x00; -static UCHAR SiS310_SR32 = 0x11; -static UCHAR SiS310_SR33 = 0x00; -static UCHAR SiS310_CRT2Data_1_2 = 0x00; -static UCHAR SiS310_CRT2Data_4_D = 0x00; -static UCHAR SiS310_CRT2Data_4_E = 0x00; -static UCHAR SiS310_CRT2Data_4_10 = 0x80; -static const USHORT SiS310_RGBSenseData = 0xd1; -static const USHORT SiS310_VideoSenseData = 0xb9; -static const USHORT SiS310_YCSenseData = 0xb3; -static const USHORT SiS310_RGBSenseData2 = 0x0190; -static const USHORT SiS310_VideoSenseData2 = 0x0174; -static const USHORT SiS310_YCSenseData2 = 0x016b; -#endif - -static const SiS_PanelDelayTblStruct SiS310_PanelDelayTbl[]= +static const struct SiS_PanelDelayTbl SiS310_PanelDelayTbl[] = { - {{0x10,0x40}}, + {{0x10,0x40}}, {{0x10,0x40}}, {{0x10,0x40}}, {{0x10,0x40}}, @@ -1011,7 +943,7 @@ static const SiS_PanelDelayTblStruct SiS310_PanelDelayTbl[]= {{0x10,0x40}} }; -static const SiS_PanelDelayTblStruct SiS310_PanelDelayTblLVDS[]= +static const struct SiS_PanelDelayTbl SiS310_PanelDelayTblLVDS[] = { {{0x28,0xc8}}, {{0x28,0xc8}}, @@ -1035,18 +967,18 @@ static const SiS_PanelDelayTblStruct SiS310_PanelDelayTblLVDS[]= /* SIS VIDEO BRIDGE ----------------------------------------- */ /**************************************************************/ -static const SiS_LCDDataStruct SiS310_St2LCD1024x768Data[] = +static const struct SiS_LCDData SiS310_St2LCD1024x768Data[] = { { 62, 25, 800, 546,1344, 806}, { 32, 15, 930, 546,1344, 806}, - { 62, 25, 800, 546,1344, 806}, + { 62, 25, 800, 546,1344, 806}, { 104, 45, 945, 496,1344, 806}, { 62, 25, 800, 546,1344, 806}, { 31, 18,1008, 624,1344, 806}, { 1, 1,1344, 806,1344, 806} }; -static const SiS_LCDDataStruct SiS310_ExtLCD1024x768Data[] = +static const struct SiS_LCDData SiS310_ExtLCD1024x768Data[] = { { 42, 25,1536, 419,1344, 806}, { 48, 25,1536, 369,1344, 806}, @@ -1057,7 +989,7 @@ static const SiS_LCDDataStruct SiS310_ExtLCD1024x768Data[] = { 1, 1,1344, 806,1344, 806} }; -static const SiS_LCDDataStruct SiS310_St2LCD1280x1024Data[] = +static const struct SiS_LCDData SiS310_St2LCD1280x1024Data[] = { { 22, 5, 800, 510,1650,1088}, { 22, 5, 800, 510,1650,1088}, @@ -1069,7 +1001,7 @@ static const SiS_LCDDataStruct SiS310_St2LCD1280x1024Data[] = { 1, 1,1688,1066,1688,1066} }; -static const SiS_LCDDataStruct SiS310_ExtLCD1280x1024Data[] = +static const struct SiS_LCDData SiS310_ExtLCD1280x1024Data[] = { { 211, 60,1024, 501,1688,1066}, { 211, 60,1024, 508,1688,1066}, @@ -1081,45 +1013,22 @@ static const SiS_LCDDataStruct SiS310_ExtLCD1280x1024Data[] = { 1, 1,1688,1066,1688,1066} }; -static const SiS_Part2PortTblStruct SiS310_CRT2Part2_1024x768_1[] = +static const struct SiS_Part2PortTbl 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}} + {{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}} }; -/* *** LCDA *** */ - -#if 0 -static const SiS_LVDSDataStruct SiS_LCDA1600x1200Data_1[]= -{ /* Clevo, 651+301C */ - {1200, 450, 2048,1250}, - {1200, 400, 2048,1250}, - {1280, 450, 2048,1250}, - {1280, 400, 2048,1250}, - {1200, 530, 2048,1250}, - {1360, 650, 2048,1250}, - {1584, 818, 2048,1250}, - {1688,1066, 2048,1250}, - {1688,1066, 2048,1250}, -#if 0 - {2048,1250, 2048,1250} /* this should be correct */ -#endif -#if 1 - {2160,1250, 2048,1250} /* ? */ -#endif -}; -#endif - /**************************************************************/ /* LVDS, CHRONTEL ------------------------------------------- */ /**************************************************************/ -static const SiS_LVDSDataStruct SiS310_CHTVUPALData[]= +static const struct SiS_LVDSData SiS310_CHTVUPALData[] = { {1008, 625,1008, 625}, {1008, 625,1008, 625}, @@ -1130,7 +1039,7 @@ static const SiS_LVDSDataStruct SiS310_CHTVUPALData[]= {1400,1000,1400,1000} }; -static const SiS_LVDSDataStruct SiS310_CHTVOPALData[]= +static const struct SiS_LVDSData SiS310_CHTVOPALData[] = { {1008, 625,1008, 625}, {1008, 625,1008, 625}, @@ -1138,10 +1047,10 @@ static const SiS_LVDSDataStruct SiS310_CHTVOPALData[]= {1008, 625,1008, 625}, { 840, 625, 840, 625}, { 944, 625, 944, 625}, - {1400, 875,1400, 875} + {1400, 875,1400, 875} }; -static const SiS_LVDSDataStruct SiS310_CHTVUPALMData[]= +static const struct SiS_LVDSData SiS310_CHTVUPALMData[] = { { 840, 600, 840, 600}, { 840, 600, 840, 600}, @@ -1149,10 +1058,10 @@ static const SiS_LVDSDataStruct SiS310_CHTVUPALMData[]= { 840, 600, 840, 600}, { 784, 600, 784, 600}, {1064, 750,1064, 750}, - {1160, 945,1160, 945} + {1160, 945,1160, 945} }; -static const SiS_LVDSDataStruct SiS310_CHTVOPALMData[]= +static const struct SiS_LVDSData SiS310_CHTVOPALMData[] = { { 840, 525, 840, 525}, { 840, 525, 840, 525}, @@ -1160,10 +1069,10 @@ static const SiS_LVDSDataStruct SiS310_CHTVOPALMData[]= { 840, 525, 840, 525}, { 784, 525, 784, 525}, {1040, 700,1040, 700}, - {1160, 840,1160, 840} + {1160, 840,1160, 840} }; -static const SiS_LVDSDataStruct SiS310_CHTVUPALNData[]= +static const struct SiS_LVDSData SiS310_CHTVUPALNData[] = { {1008, 625,1008, 625}, {1008, 625,1008, 625}, @@ -1174,7 +1083,7 @@ static const SiS_LVDSDataStruct SiS310_CHTVUPALNData[]= {1400,1000,1400,1000} }; -static const SiS_LVDSDataStruct SiS310_CHTVOPALNData[]= +static const struct SiS_LVDSData SiS310_CHTVOPALNData[] = { {1008, 625,1008, 625}, {1008, 625,1008, 625}, @@ -1182,10 +1091,10 @@ static const SiS_LVDSDataStruct SiS310_CHTVOPALNData[]= {1008, 625,1008, 625}, { 840, 625, 840, 625}, { 944, 625, 944, 625}, - {1400, 875,1400, 875} + {1400, 875,1400, 875} }; -static const SiS_LVDSDataStruct SiS310_CHTVSOPALData[]= /* (super overscan - no effect on 7019) */ +static const struct SiS_LVDSData SiS310_CHTVSOPALData[] = /* (super overscan - no effect on 7019) */ { {1008, 625,1008, 625}, {1008, 625,1008, 625}, @@ -1196,1333 +1105,10 @@ static const SiS_LVDSDataStruct SiS310_CHTVSOPALData[]= /* (super overscan - {1400, 875,1400, 875} }; - -static const SiS_LVDSDesStruct SiS310_PanelType00_1[]= /* 800x600 */ -{ - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType01_1[]= /* 1024x768 */ -{ - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 805}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType02_1[]= /* 1280x1024 */ -{ - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 1065}, - { 0, 0}, - { 0, 0} -}; - - -static const SiS_LVDSDesStruct SiS310_PanelType03_1[]= -{ - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType04_1[]= -{ - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType05_1[]= -{ - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType06_1[]= -{ - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType07_1[]= -{ - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType08_1[]= /* 1400x1050 */ -{ - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType09_1[]= /* 1280x768 */ -{ - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType0a_1[]= /* 1600x1200 */ -{ - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType0b_1[]= /* 640x480_2 */ -{ - { 0, 524}, - { 0, 524}, - { 0, 524}, - { 0, 524}, - { 0, 524}, - { 0, 524}, - { 8, 524}, - { 0, 524} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType0c_1[]= /* 640x480_3 */ -{ - { 0, 524}, - { 0, 524}, - { 0, 524}, - { 0, 524}, - { 0, 524}, - { 0, 524}, - { 8, 524}, - { 0, 524} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType0d_1[]= -{ - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType0e_1[]= -{ - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType0f_1[]= -{ - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType00_2[]= -{ - {980, 528}, - {980, 503}, - {980, 528}, - {980, 503}, - {980, 568}, - { 0, 628}, - { 0, 0}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType01_2[]= -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 806}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType02_2[]= -{ - {1368, 754}, - {1368, 729}, - {1368, 754}, - {1368, 729}, - {1368, 794}, - {1448, 854}, - {1560, 938}, - { 0,1066}, - { 0, 0}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType03_2[]= -{ - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType04_2[]= -{ - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType05_2[]= -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType06_2[]= -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType07_2[]= -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType08_2[]= /* 1400x1050 */ -{ - {1308, 741}, - {1308, 716}, - {1308, 741}, - {1308, 716}, - {1308, 781}, - {1388, 841}, - {1500, 925}, - {1628,1053}, - { 0,1065}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType09_2[]= /* 1280x768 */ -{ - {1083, 622}, - {1083, 597}, - {1083, 622}, - {1083, 597}, - {1083, 662}, - {1163, 722}, - {1286, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType0a_2[]= /* 1600x1200 */ -{ - {1568, 920}, - {1568, 895}, - {1568, 920}, - {1568, 895}, - {1568, 960}, - {1648,1020}, - {1760,1104}, - {1888,1232}, - {1948,1245}, - { 0, 0} -#if 0 - {1568, 850}, - {1568, 825}, - {1568, 850}, - {1568, 825}, - {1568, 890}, - {1648, 950}, - {1760,1034}, - {1888,1162}, - {1948,1175}, - { 0, 0} -#endif -}; - -static const SiS_LVDSDesStruct SiS310_PanelType0b_2[]= /* 640x480_2 */ -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType0c_2[]= /* 640x480_3 */ -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType0d_2[]= -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType0e_2[]= -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType0f_2[] = -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelTypeNS_1[]= -{ - { 8, 0}, - { 8, 0}, - { 8, 0}, - { 8, 0}, - { 8, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 806}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelTypeNS_2[] = -{ - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0} -}; - -/* CRT1 CRTC for SlaveModes and LCDA */ - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_1[] = -{ - {{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 }} -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_1_H[] = -{ - {{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 }} -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_2[]= -{ - {{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 }} -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_2_H[] = -{ - {{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 }} -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_1[] = -{ - {{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}} -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_1_H[] = -{ - {{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 }} -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_2[] = -{ - {{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 }} -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_2_H[] = -{ - {{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 }} -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_1[] = -{ - {{0x7e,0x4f,0x82,0x58,0x04,0xb8,0x1f, - 0x90,0x84,0x8f,0xb9,0x30,0x00,0x06, - 0x00}}, - {{0x7e,0x4f,0x82,0x58,0x04,0x86,0x1f, - 0x5e,0x82,0x5d,0x87,0x10,0x00,0x06, - 0x00}}, - {{0x7e,0x4f,0x82,0x58,0x04,0xb8,0x1f, - 0x90,0x84,0x8f,0xb9,0x30,0x00,0x06, - 0x00}}, - {{0x7e,0x4f,0x82,0x58,0x04,0x86,0x1f, - 0x5e,0x82,0x5d,0x87,0x10,0x00,0x06, - 0x00}}, - {{0x7e,0x4f,0x82,0x58,0x04,0x08,0x3e, - 0xe0,0x84,0xdf,0x09,0x00,0x00,0x06, - 0x00}}, - {{0x92,0x63,0x96,0x6c,0x18,0x80,0xf0, - 0x58,0x8c,0x57,0x81,0x20,0x00,0x06, - 0x01}}, - {{0xae,0x7f,0x92,0x88,0x94,0x28,0xf5, - 0x00,0x84,0xff,0x29,0x10,0x00,0x02, - 0x01}}, - {{0xce,0x9f,0x92,0xa8,0x14,0x28,0x5a, - 0x00,0x84,0xff,0x29,0x09,0x00,0x07, - 0x01}} -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_1_H[] = -{ - {{0x56,0x27,0x9a,0x31,0x1c,0xb8,0x1f, - 0x90,0x84,0x8f,0xb9,0x30,0x00,0x05, - 0x00}}, - {{0x56,0x27,0x9a,0x31,0x1c,0x86,0x1f, - 0x5e,0x82,0x5d,0x87,0x10,0x00,0x05, - 0x00}}, - {{0x56,0x27,0x9a,0x31,0x1c,0xb8,0x1f, - 0x90,0x84,0x8f,0xb9,0x30,0x00,0x05, - 0x00}}, - {{0x56,0x27,0x9a,0x31,0x1c,0x86,0x1f, - 0x5e,0x82,0x5d,0x87,0x10,0x00,0x05, - 0x01}}, - {{0x56,0x27,0x9a,0x31,0x1c,0x08,0x3e, - 0xe0,0x84,0xdf,0x09,0x00,0x00,0x05, - 0x00}}, - {{0x60,0x31,0x84,0x3a,0x86,0x80,0xf0, - 0x58,0x8c,0x57,0x81,0x20,0x00,0x01, - 0x01}}, - {{0x6e,0x3f,0x92,0x48,0x94,0x28,0xf5, - 0x00,0x84,0xff,0x29,0x10,0x00,0x01, - 0x01}} -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_2[] = -{ - {{0xce,0x72,0x91,0x81,0x8f,0x28,0x92, - 0xc8,0x8c,0x5d,0x5c,0x01,0x00,0x02, - 0x01}}, - {{0xce,0x72,0x91,0x81,0x8f,0x28,0x92, - 0xaf,0x83,0x44,0x43,0x21,0x00,0x02, - 0x01}}, - {{0xce,0x72,0x91,0x81,0x8f,0x28,0x92, - 0xc8,0x8c,0x5d,0x5c,0x01,0x00,0x02, - 0x01}}, - {{0xce,0x72,0x91,0x81,0x8f,0x28,0x92, - 0xaf,0x83,0x44,0x43,0x21,0x00,0x02, - 0x01}}, - {{0xce,0x72,0x91,0x81,0x8f,0x28,0x92, - 0xf0,0x84,0x85,0x84,0x11,0x00,0x02, - 0x01}}, - {{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,0xa8,0x14,0x28,0x5a, - 0x00,0x84,0xff,0x29,0x09,0x00,0x07, - 0x01}} -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_2_H[] = -{ - {{0xa6,0x4a,0x89,0x59,0x07,0x28,0x92, - 0xc8,0x8c,0x5d,0x5c,0x01,0x00,0x06, - 0x01}}, - {{0xa6,0x4a,0x89,0x59,0x07,0x28,0x92, - 0xaf,0x83,0x44,0x43,0x21,0x00,0x06, - 0x01}}, - {{0xa6,0x4a,0x89,0x59,0x07,0x28,0x92, - 0xc8,0x8c,0x5d,0x5c,0x01,0x00,0x06, - 0x01}}, - {{0xa6,0x4a,0x89,0x59,0x07,0x28,0x92, - 0xfa,0x83,0x44,0x43,0x31,0x00,0x06, - 0x01}}, - {{0xa6,0x4a,0x89,0x59,0x07,0x28,0x92, - 0xf0,0x84,0x85,0x84,0x11,0x00,0x06, - 0x01}}, - {{0x9c,0x31,0x80,0x59,0x87,0x28,0xd4, - 0x3f,0x83,0x57,0x29,0x01,0x00,0x06, - 0x01}}, - {{0x8e,0x3f,0x92,0x59,0x07,0x28,0xd4, - 0x93,0x87,0xff,0x29,0x21,0x00,0x06, - 0x01}} -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_1[] = -{ - {{0x6f,0x4f,0x93,0x54,0x82,0x9e,0x1f, - 0x8f,0x81,0x8f,0x9f,0x30,0x00,0x05, - 0x00}}, - {{0x6f,0x4f,0x93,0x54,0x82,0x6c,0x1f, - 0x5e,0x81,0x5d,0x6d,0x10,0x00,0x05, - 0x00}}, - {{0x6f,0x4f,0x93,0x54,0x82,0x9e,0x1f, - 0x90,0x83,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, - 0xdf,0x82,0xdf,0xef,0x10,0x00,0x05, - 0x00}}, - {{0x83,0x63,0x87,0x68,0x16,0x66,0xf0, - 0x57,0x8e,0x57,0x67,0x20,0x00,0x06, - 0x01}}, - {{0x9f,0x7f,0x83,0x84,0x92,0x0e,0xf1, - 0xff,0x86,0xff,0x0f,0x10,0x00,0x02, - 0x01,}}, - {{0xbf,0x9f,0x83,0xa4,0x12,0x0e,0xde, - 0xff,0x86,0xff,0x0f,0x01,0x00,0x07, - 0x01}}, - {{0xce,0xae,0x92,0xb3,0x01,0x28,0x10, - 0x19,0x80,0x19,0x29,0x0f,0x00,0x03, - 0x00}} -#if 0 - {{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}} -#endif -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_1_H[] = -{ - {{0x47,0x27,0x8b,0x2c,0x1a,0x9e,0x1f, - 0x8f,0x81,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, - 0x90,0x83,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, - 0xdf,0x86,0xdf,0xef,0x10,0x00,0x05, - 0x00}}, - {{0x51,0x31,0x95,0x36,0x04,0x66,0xf0, - 0x57,0x8e,0x57,0x67,0x20,0x00,0x01, - 0x01}}, - {{0x5f,0x3f,0x83,0x44,0x92,0x0e,0xf1, - 0xff,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}} -#if 0 - {{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}} -#endif -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_2[] = -{ - {{0xce,0x72,0x91,0x84,0x92,0x28,0x92, - 0xd7,0x8b,0x5d,0x5c,0x21,0x00,0x02, - 0x01}}, - {{0xce,0x72,0x91,0x84,0x92,0x28,0x92, - 0xbe,0x82,0x44,0x43,0x01,0x00,0x02, - 0x01}}, - {{0xce,0x72,0x91,0x84,0x92,0x28,0x92, - 0xd7,0x8b,0x5d,0x5c,0x21,0x00,0x02, - 0x01}}, - {{0xce,0x72,0x91,0x84,0x92,0x28,0x92, - 0xbe,0x82,0x44,0x43,0x01,0x00,0x02, - 0x01}}, - {{0xce,0x72,0x91,0x84,0x92,0x28,0x92, - 0xff,0x83,0x85,0x84,0x11,0x00,0x02, - 0x01}}, - {{0xce,0x63,0x92,0x8e,0x1c,0x28,0xd4, - 0x3f,0x83,0x57,0x29,0x01,0x00,0x03, - 0x01}}, - {{0xce,0x7f,0x92,0x9c,0x0a,0x28,0xd4, - 0x93,0x87,0xff,0x29,0x21,0x00,0x07, - 0x01}}, - {{0xce,0x9f,0x92,0xac,0x1a,0x28,0x5a, - 0x13,0x87,0xff,0x29,0x29,0x00,0x07, - 0x01}}, - {{0xce,0xae,0x92,0xbc,0x0a,0x28,0x10, - 0x20,0x84,0x19,0x29,0x0f,0x00,0x03, - 0x00}} -#if 0 - {{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}} -#endif -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_2_H[] = -{ - {{0xa6,0x4a,0x89,0x5c,0x0a,0x28,0x92, - 0xd7,0x8b,0x5d,0x5c,0x21,0x00,0x06, - 0x01}}, - {{0xa6,0x4a,0x89,0x5c,0x0a,0x28,0x92, - 0xbe,0x82,0x44,0x43,0x01,0x00,0x06, - 0x01}}, - {{0xa6,0x4a,0x89,0x5c,0x0a,0x28,0x92, - 0xd7,0x8b,0x5d,0x5c,0x21,0x00,0x06, - 0x01}}, - {{0xa6,0x4a,0x89,0x5c,0x0a,0x28,0x92, - 0xbe,0x82,0x44,0x43,0x01,0x00,0x06, - 0x01}}, - {{0xa6,0x4a,0x89,0x5c,0x0a,0x28,0x92, - 0xff,0x83,0x85,0x84,0x11,0x00,0x06, - 0x01}}, - {{0x9c,0x31,0x80,0x5c,0x8a,0x28,0xd4, - 0x3f,0x83,0x57,0x29,0x01,0x00,0x06, - 0x01}}, - {{0x8e,0x3f,0x92,0x5c,0x0a,0x28,0xd4, - 0x93,0x87,0xff,0x29,0x21,0x00,0x06, - 0x01}}, - {{0x7e,0x4f,0x82,0x5c,0x0a,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}} -#if 0 - {{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}} -#endif -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11600x1200_1[] = -{ - {{0x83,0x4F,0x87,0x5B,0x13,0x06,0x3E, - 0xB3,0x86,0x8F,0x07,0x20,0x00,0x06, - 0x00}}, - {{0x83,0x4F,0x87,0x5B,0x13,0xD4,0x1F, - 0x81,0x84,0x5D,0xD5,0x10,0x00,0x06, - 0x00}}, - {{0x83,0x4F,0x87,0x5B,0x13,0x06,0x3E, - 0xB3,0x86,0x8F,0x07,0x20,0x00,0x06, - 0x00}}, - {{0x83,0x4F,0x87,0x5B,0x13,0xD4,0x1F, - 0x81,0x84,0x5D,0xD5,0x10,0x00,0x06, - 0x00}}, - {{0x83,0x4F,0x87,0x5B,0x13,0x56,0xBA, - 0x03,0x86,0xDF,0x57,0x00,0x00,0x06, - 0x00}}, - {{0x97,0x63,0x9B,0x6F,0x07,0xCE,0xF0, - 0x7B,0x8E,0x57,0xCF,0x20,0x00,0x02, - 0x01}}, - {{0xB3,0x7F,0x97,0x8B,0x83,0x76,0xF5, - 0x23,0x86,0xFF,0x77,0x10,0x00,0x06, - 0x01}}, - {{0xD3,0x9F,0x97,0xAB,0x03,0x76,0x5A, - 0x23,0x86,0xFF,0x77,0x09,0x00,0x03, - 0x01}}, - {{0xE2,0xAE,0x86,0xBA,0x92,0x90,0x10, - 0x3D,0x80,0x19,0x91,0x0F,0x00,0x03, - 0x00}}, - {{0xFB,0xC7,0x9F,0xD3,0x8B,0x26,0x11, - 0xD3,0x86,0xAF,0x27,0x3F,0x00,0x07, - 0x00}} -#if 0 - {{0x83,0x4f,0x87,0x51,0x09,0xc0,0x1f, - 0x90,0x84,0x8f,0xc1,0x30,0x00,0x06, - 0x00}}, - {{0x83,0x4f,0x87,0x51,0x09,0x8e,0x1f, - 0x5e,0x82,0x5d,0x8f,0x10,0x00,0x06, - 0x00}}, - {{0x83,0x4f,0x87,0x51,0x09,0xc0,0x1f, - 0x90,0x84,0x8f,0xc1,0x30,0x00,0x06, - 0x00}}, - {{0x83,0x4f,0x87,0x51,0x09,0x8e,0x1f, - 0x5e,0x82,0x5d,0x8f,0x10,0x00,0x06, - 0x00}}, - {{0x83,0x4f,0x87,0x51,0x09,0x10,0x3e, - 0xe0,0x84,0xdf,0x11,0x00,0x00,0x06, - 0x00}}, - {{0x97,0x63,0x9b,0x65,0x1d,0x88,0xf0, - 0x58,0x8c,0x57,0x89,0x20,0x00,0x06, - 0x01}}, - {{0xb3,0x7f,0x97,0x81,0x99,0x30,0xf5, - 0x00,0x84,0xff,0x31,0x10,0x00,0x02, - 0x01}}, - {{0xd3,0x9f,0x97,0xa1,0x19,0x30,0x5a, - 0x00,0x84,0xff,0x31,0x09,0x00,0x07, - 0x01}}, - {{0xe2,0xae,0x86,0xb0,0x88,0x4a,0x10, - 0x1a,0x8e,0x19,0x4b,0x2f,0x00,0x03, - 0x00}}, - {{0xfb,0xc7,0x9f,0xc9,0x81,0xe0,0x10, - 0xb0,0x84,0xaf,0xe1,0x2f,0x00,0x07, - 0x00}} -#endif -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11600x1200_1_H[] = -{ - {{0x5B,0x27,0x9F,0x33,0x0B,0x06,0x2E, - 0xB3,0x86,0x8F,0x07,0x20,0x00,0x01, - 0x00}}, - {{0x5B,0x27,0x9F,0x29,0x01,0x8E,0x1F, - 0x81,0x84,0x5D,0xD5,0x10,0x00,0x06, - 0x00}}, - {{0x5B,0x27,0x9F,0x33,0x0B,0x06,0x2E, - 0xB3,0x86,0x8F,0x07,0x20,0x00,0x01, - 0x00}}, - {{0x83,0x4F,0x87,0x5B,0x13,0xD4,0x1F, - 0x81,0x84,0x5D,0xD5,0x10,0x00,0x06, - 0x00}}, - {{0x5B,0x27,0x9F,0x33,0x0B,0x56,0xBA, - 0x03,0x86,0xDF,0x57,0x00,0x00,0x01, - 0x00}}, - {{0x65,0x31,0x89,0x3D,0x95,0xCE,0xF0, - 0x7B,0x8E,0x57,0xCF,0x20,0x00,0x01, - 0x01}}, - {{0x73,0x3F,0x97,0x4B,0x83,0x76,0xF5, - 0x23,0x86,0xFF,0x77,0x10,0x00,0x05, - 0x01}}, - {{0xD3,0x9F,0x97,0xAB,0x03,0x76,0x5A, - 0x23,0x86,0xFF,0x77,0x09,0x00,0x03, - 0x01}}, - {{0xE2,0xAE,0x86,0xBA,0x92,0x90,0x10, - 0x3D,0x80,0x19,0x91,0x0F,0x00,0x03, - 0x00}}, - {{0x97,0x63,0x9B,0x6F,0x07,0xE0,0x10, - 0xB0,0x84,0xAF,0xE1,0x2F,0x00,0x06, - 0x00}} -#if 0 - {{0x5b,0x27,0x9f,0x29,0x01,0xc0,0x1f, - 0x90,0x84,0x8f,0xc1,0x30,0x00,0x01, - 0x00}}, - {{0x5b,0x27,0x9f,0x29,0x01,0x8e,0x1f, - 0x5e,0x82,0x5d,0x8f,0x10,0x00,0x01, - 0x00}}, - {{0x5b,0x27,0x9f,0x29,0x01,0xc0,0x1f, - 0x90,0x84,0x8f,0xc1,0x30,0x00,0x01, - 0x00}}, - {{0x5b,0x27,0x9f,0x29,0x01,0x8e,0x1f, - 0x5e,0x82,0x5d,0x8f,0x10,0x00,0x01, - 0x00}}, - {{0x5b,0x27,0x9f,0x29,0x01,0x10,0x3e, - 0xe0,0x84,0xdf,0x11,0x00,0x00,0x01, - 0x00}}, - {{0x65,0x31,0x89,0x33,0x8b,0x88,0xf0, - 0x58,0x8c,0x57,0x89,0x20,0x00,0x01, - 0x01}}, - {{0x73,0x3f,0x97,0x41,0x99,0x30,0xf5, - 0x00,0x84,0xff,0x31,0x10,0x00,0x01, - 0x01}}, - {{0x83,0x4f,0x87,0x51,0x09,0x30,0x5a, - 0x00,0x84,0xff,0x31,0x09,0x00,0x06, - 0x01}}, - {{0x8a,0x56,0x8e,0x58,0x10,0x4a,0x10, - 0x1a,0x8e,0x19,0x4b,0x2f,0x00,0x06, - 0x00}}, - {{0x97,0x63,0x9b,0x65,0x1d,0xe0,0x10, - 0xb0,0x84,0xaf,0xe1,0x2f,0x00,0x06, - 0x00}} -#endif -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11600x1200_2[] = -{ - {{0xFB,0x87,0x86,0x97,0x0F,0x26,0x97, - 0x43,0x86,0xDB,0xDA,0x11,0x00,0x07, - 0x01}}, - {{0xFB,0x87,0x86,0x97,0x0F,0x26,0x97, - 0x2A,0x8D,0xC2,0xC1,0x11,0x00,0x07, - 0x01}}, - {{0xFB,0x87,0x86,0x97,0x0F,0x26,0x97, - 0x43,0x86,0xDB,0xDA,0x11,0x00,0x07, - 0x01}}, - {{0xFB,0x87,0x86,0x97,0x0F,0x26,0x97, - 0x2A,0x8D,0xC2,0xC1,0x11,0x00,0x07, - 0x01}}, - {{0xFB,0x87,0x86,0x97,0x0F,0x26,0x9F, - 0x6B,0x8E,0x03,0x02,0x01,0x00,0x07, - 0x01}}, - {{0xFB,0x63,0x9F,0xA1,0x99,0x26,0xD5, - 0xA7,0x8A,0xBF,0xBE,0x01,0x00,0x07, - 0x01}}, - {{0xFB,0x7F,0x9F,0xAF,0x87,0x26,0xDD, - 0xFB,0x8E,0x13,0x12,0x31,0x00,0x03, - 0x01}}, - {{0xFB,0x9F,0x9F,0xBF,0x97,0x26,0x5B, - 0x7B,0x8E,0xFF,0x27,0x39,0x00,0x03, - 0x01}}, - {{0xFB,0xAE,0x9F,0xC6,0x9E,0x26,0x11, - 0x88,0x8B,0x19,0x27,0x1F,0x00,0x03, - 0x00}}, - {{0xFB,0xC7,0x9F,0xD3,0x8B,0x26,0x11, - 0xD3,0x86,0xAF,0x27,0x3F,0x00,0x07, - 0x00}} -#if 0 - {{0xfb,0x88,0x87,0x90,0x08,0xe0,0x96, - 0x20,0x84,0xb9,0xb8,0x01,0x00,0x07, - 0x01}}, - {{0xfb,0x88,0x87,0x90,0x08,0xe0,0x96, - 0x07,0x8b,0xa0,0x9f,0x01,0x00,0x07, - 0x01}}, - {{0xfb,0x88,0x87,0x90,0x08,0xe0,0x96, - 0x20,0x84,0xb9,0xb8,0x01,0x00,0x07, - 0x01}}, - {{0xfb,0x88,0x87,0x90,0x08,0xe0,0x96, - 0x07,0x8b,0xa0,0x9f,0x01,0x00,0x07, - 0x01}}, - {{0xfb,0x88,0x87,0x90,0x08,0xe0,0x96, - 0x48,0x8c,0xe1,0xe0,0x11,0x00,0x07, - 0x01}}, - {{0xfb,0x63,0x9f,0x9a,0x92,0xe0,0xd4, - 0x9b,0x8f,0x9d,0x9c,0x21,0x00,0x07, - 0x01}}, - {{0xfb,0x7f,0x9f,0xa8,0x80,0xe0,0xd4, - 0xef,0x83,0xff,0xe1,0x21,0x00,0x03, - 0x01}}, - {{0xfb,0x9f,0x9f,0xb8,0x90,0xe0,0x5a, - 0x6f,0x83,0xff,0xe1,0x29,0x00,0x03, - 0x01}}, - {{0xfb,0xae,0x9f,0xbf,0x97,0xe0,0x10, - 0x7c,0x80,0x19,0xe1,0x0f,0x00,0x03, - 0x00}}, - {{0xfb,0xc7,0x9f,0xc9,0x84,0xe0,0x10, - 0xc7,0x8b,0xaf,0xe1,0x0f,0x00,0x07, - 0x00}} -#endif -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11600x1200_2_H[] = -{ - {{0xD3,0x5F,0x9E,0x6F,0x07,0x26,0x97, - 0x43,0x86,0xDB,0xDA,0x11,0x00,0x02, - 0x01}}, - {{0xD3,0x27,0x97,0x6F,0x07,0x26,0x97, - 0x6B,0x8E,0x83,0x82,0x01,0x00,0x03, - 0x01}}, - {{0xD3,0x5F,0x9E,0x6F,0x07,0x26,0x97, - 0x43,0x86,0xDB,0xDA,0x11,0x00,0x02, - 0x01}}, - {{0xD3,0x27,0x97,0x6F,0x07,0x26,0x97, - 0x07,0x8B,0xA0,0x9F,0x01,0x00,0x02, - 0x01}}, - {{0xD3,0x27,0x97,0x6F,0x07,0x26,0x97, - 0x6B,0x8E,0x83,0x82,0x01,0x00,0x03, - 0x01}}, - {{0xC9,0x31,0x8D,0x6F,0x07,0x26,0xD5, - 0xA7,0x8A,0xBF,0xBE,0x01,0x00,0x03, - 0x01}}, - {{0xBB,0x3F,0x9F,0x6F,0x87,0x26,0xDD, - 0xFB,0x8E,0x13,0x12,0x31,0x00,0x02, - 0x01}}, - {{0xAB,0x4F,0x8F,0x68,0x80,0xE0,0x5A, - 0x6F,0x83,0xFF,0xE1,0x29,0x00,0x02, - 0x01}}, - {{0xA3,0x56,0x87,0x67,0x9F,0xE0,0x10, - 0x7C,0x80,0x19,0xE1,0x0F,0x00,0x06, - 0x00}}, - {{0x97,0x63,0x9B,0x68,0x00,0xE0,0x10, - 0xC7,0x8B,0xAF,0xE1,0x0F,0x00,0x02, - 0x00}} -#if 0 - {{0xd3,0x60,0x9f,0x68,0x00,0xe0,0x96, - 0x20,0x84,0xb9,0xb8,0x01,0x00,0x02, - 0x01}}, - {{0xd3,0x60,0x9f,0x68,0x00,0xe0,0x96, - 0x07,0x8b,0xa0,0x9f,0x01,0x00,0x02, - 0x01}}, - {{0xd3,0x60,0x9f,0x68,0x00,0xe0,0x96, - 0x20,0x84,0xb9,0xb8,0x01,0x00,0x02, - 0x01}}, - {{0xd3,0x60,0x9f,0x68,0x00,0xe0,0x96, - 0x07,0x8b,0xa0,0x9f,0x01,0x00,0x02, - 0x01}}, - {{0xd3,0x60,0x9f,0x68,0x00,0xe0,0x96, - 0x48,0x8c,0xe1,0xe0,0x11,0x00,0x02, - 0x01}}, - {{0xc9,0x31,0x8d,0x68,0x00,0xe0,0xd4, - 0x9b,0x8f,0x9d,0x9c,0x21,0x00,0x03, - 0x01}}, - {{0xbb,0x3f,0x9f,0x68,0x80,0xe0,0xd4, - 0xef,0x83,0xff,0xe1,0x21,0x00,0x02, - 0x01}}, - {{0xab,0x4f,0x8f,0x68,0x80,0xe0,0x5a, - 0x6f,0x83,0xff,0xe1,0x29,0x00,0x02, - 0x01}}, - {{0xa3,0x56,0x87,0x67,0x9f,0xe0,0x10, - 0x7c,0x80,0x19,0xe1,0x0f,0x00,0x06, - 0x00}}, - {{0x97,0x63,0x9b,0x68,0x00,0xe0,0x10, - 0xc7,0x8b,0xaf,0xe1,0x0f,0x00,0x02, - 0x00}} -#endif -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT1XXXxXXX_1[] = -{ - {{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,0xa8,0x14,0x28,0x5a, - 0x00,0x84,0xff,0x29,0x09,0x00,0x07, - 0x01}}, - {{0xce,0x9f,0x92,0xa9,0x17,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x07, - 0x01}} -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT1XXXxXXX_1_H[] = -{ - {{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}} -}; - - /* CRT1 CRTC for Chrontel TV slave modes */ -static const SiS_LVDSCRT1DataStruct SiS310_CHTVCRT1UNTSC[] = -{ +static const struct SiS_LVDSCRT1Data SiS310_CHTVCRT1UNTSC[] = +{ {{0x64,0x4f,0x88,0x56,0x9f,0x56,0x3e, 0xe8,0x84,0x8f,0x57,0x20,0x00,0x01, 0x00 }}, @@ -2546,7 +1132,7 @@ static const SiS_LVDSCRT1DataStruct SiS310_CHTVCRT1UNTSC[] = 0x01}} }; -static const SiS_LVDSCRT1DataStruct SiS310_CHTVCRT1ONTSC[] = +static const struct SiS_LVDSCRT1Data SiS310_CHTVCRT1ONTSC[] = { {{0x63,0x4f,0x87,0x5a,0x9f,0x0b,0x3e, 0xc0,0x84,0x8f,0x0c,0x20,0x00,0x01, @@ -2571,8 +1157,8 @@ static const SiS_LVDSCRT1DataStruct SiS310_CHTVCRT1ONTSC[] = 0x01 }} }; -static const SiS_LVDSCRT1DataStruct SiS310_CHTVCRT1UPAL[] = -{ +static const struct SiS_LVDSCRT1Data SiS310_CHTVCRT1UPAL[] = +{ {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, 0xf8,0x83,0x8f,0x70,0x20,0x00,0x05, 0x00 }}, @@ -2596,7 +1182,7 @@ static const SiS_LVDSCRT1DataStruct SiS310_CHTVCRT1UPAL[] = 0x01}} }; -static const SiS_LVDSCRT1DataStruct SiS310_CHTVCRT1OPAL[] = +static const struct SiS_LVDSCRT1Data SiS310_CHTVCRT1OPAL[] = { {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, 0xf0,0x83,0x8f,0x70,0x20,0x00,0x05, @@ -2621,8 +1207,7 @@ static const SiS_LVDSCRT1DataStruct SiS310_CHTVCRT1OPAL[] = 0x01 }} }; - -static const SiS_CHTVRegDataStruct SiS310_CHTVReg_UNTSC[] = +static const struct SiS_CHTVRegData SiS310_CHTVReg_UNTSC[] = { {{0x4a,0x77,0xbb,0x94,0x84,0x48,0xfe,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, {{0x4a,0x77,0xbb,0x94,0x84,0x48,0xfe,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, @@ -2642,7 +1227,7 @@ static const SiS_CHTVRegDataStruct SiS310_CHTVReg_UNTSC[] = for PAL-M and PAL-N all above is corrected. */ -static const SiS_CHTVRegDataStruct SiS310_CHTVReg_ONTSC[] = +static const struct SiS_CHTVRegData SiS310_CHTVReg_ONTSC[] = { {{0x49,0x77,0xbb,0x7b,0x84,0x34,0x00,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, {{0x49,0x77,0xbb,0x7b,0x84,0x34,0x00,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, @@ -2653,7 +1238,7 @@ static const SiS_CHTVRegDataStruct SiS310_CHTVReg_ONTSC[] = {{0xed,0x77,0xbb,0x66,0x8c,0x21,0x02,0x5a,0x04,0x00,0x80,0x1f,0x9f,0xc1,0x0c,0x00}} }; -static const SiS_CHTVRegDataStruct SiS310_CHTVReg_UPAL[] = +static const struct SiS_CHTVRegData SiS310_CHTVReg_UPAL[] = { {{0x41,0x7f,0xb7,0x34,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, {{0x41,0x7f,0xb7,0x80,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, @@ -2664,7 +1249,7 @@ static const SiS_CHTVRegDataStruct SiS310_CHTVReg_UPAL[] = {{0xe5,0x7f,0xb7,0x1d,0xa7,0x3e,0x04,0x5a,0x05,0x00,0x80,0x20,0x3e,0xe4,0x22,0x00}} }; -static const SiS_CHTVRegDataStruct SiS310_CHTVReg_OPAL[] = +static const struct SiS_CHTVRegData SiS310_CHTVReg_OPAL[] = { {{0x41,0x7f,0xb7,0x36,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, {{0x41,0x7f,0xb7,0x86,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, @@ -2675,7 +1260,7 @@ static const SiS_CHTVRegDataStruct SiS310_CHTVReg_OPAL[] = {{0xe4,0x7f,0xb7,0x1e,0xaf,0x29,0x37,0x5a,0x05,0x00,0x80,0x25,0x8c,0xb2,0x2a,0x00}} }; -static const SiS_CHTVRegDataStruct SiS310_CHTVReg_UPALM[] = +static const struct SiS_CHTVRegData SiS310_CHTVReg_UPALM[] = { {{0x52,0x77,0xbb,0x94,0x84,0x48,0xfe,0x83,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, {{0x52,0x77,0xbb,0x94,0x84,0x48,0xfe,0x83,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, @@ -2691,7 +1276,7 @@ static const SiS_CHTVRegDataStruct SiS310_CHTVReg_UPALM[] = #endif }; -static const SiS_CHTVRegDataStruct SiS310_CHTVReg_OPALM[] = +static const struct SiS_CHTVRegData SiS310_CHTVReg_OPALM[] = { {{0x51,0x77,0xbb,0x7b,0x84,0x34,0x00,0x83,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, {{0x51,0x77,0xbb,0x7b,0x84,0x34,0x00,0x83,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, @@ -2707,7 +1292,7 @@ static const SiS_CHTVRegDataStruct SiS310_CHTVReg_OPALM[] = #endif }; -static const SiS_CHTVRegDataStruct SiS310_CHTVReg_UPALN[] = +static const struct SiS_CHTVRegData SiS310_CHTVReg_UPALN[] = { {{0x41,0x7f,0xb7,0x34,0xad,0x50,0x34,0x6e,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x03}}, {{0x41,0x7f,0xb7,0x80,0x85,0x50,0x00,0x6e,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x03}}, @@ -2723,7 +1308,7 @@ static const SiS_CHTVRegDataStruct SiS310_CHTVReg_UPALN[] = #endif }; -static const SiS_CHTVRegDataStruct SiS310_CHTVReg_OPALN[] = +static const struct SiS_CHTVRegData SiS310_CHTVReg_OPALN[] = { {{0x41,0x7f,0xb7,0x36,0xad,0x50,0x34,0x6e,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x03}}, {{0x41,0x7f,0xb7,0x86,0x85,0x50,0x00,0x6e,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x03}}, @@ -2739,16 +1324,16 @@ static const SiS_CHTVRegDataStruct SiS310_CHTVReg_OPALN[] = #endif }; -static const UCHAR SiS310_CHTVVCLKUNTSC[] = {0x41,0x41,0x41,0x41,0x42,0x46,0x53}; -static const UCHAR SiS310_CHTVVCLKONTSC[] = {0x48,0x48,0x48,0x48,0x45,0x43,0x51}; +static const unsigned char SiS310_CHTVVCLKUNTSC[] = { 0x41,0x41,0x41,0x41,0x42,0x46,0x53 }; +static const unsigned char SiS310_CHTVVCLKONTSC[] = { 0x48,0x48,0x48,0x48,0x45,0x43,0x51 }; -static const UCHAR SiS310_CHTVVCLKUPAL[] = {0x47,0x47,0x47,0x47,0x48,0x4a,0x54}; -static const UCHAR SiS310_CHTVVCLKOPAL[] = {0x47,0x47,0x47,0x47,0x48,0x4f,0x52}; +static const unsigned char SiS310_CHTVVCLKUPAL[] = { 0x47,0x47,0x47,0x47,0x48,0x4a,0x54 }; +static const unsigned char SiS310_CHTVVCLKOPAL[] = { 0x47,0x47,0x47,0x47,0x48,0x4f,0x52 }; -static const UCHAR SiS310_CHTVVCLKUPALM[] = {0x41,0x41,0x41,0x41,0x42,0x46,0x53}; -static const UCHAR SiS310_CHTVVCLKOPALM[] = {0x48,0x48,0x48,0x48,0x45,0x43,0x51}; +static const unsigned char SiS310_CHTVVCLKUPALM[] = { 0x41,0x41,0x41,0x41,0x42,0x46,0x53 }; +static const unsigned char SiS310_CHTVVCLKOPALM[] = { 0x48,0x48,0x48,0x48,0x45,0x43,0x51 }; -static const UCHAR SiS310_CHTVVCLKUPALN[] = {0x47,0x47,0x47,0x47,0x48,0x4a,0x54}; -static const UCHAR SiS310_CHTVVCLKOPALN[] = {0x47,0x47,0x47,0x47,0x48,0x4f,0x52}; +static const unsigned char SiS310_CHTVVCLKUPALN[] = { 0x47,0x47,0x47,0x47,0x48,0x4a,0x54 }; +static const unsigned char SiS310_CHTVVCLKOPALN[] = { 0x47,0x47,0x47,0x47,0x48,0x4f,0x52 }; diff --git a/drivers/video/sis/Makefile b/drivers/video/sis/Makefile index aaed8c2b4a64..f7c0046e5b1d 100644 --- a/drivers/video/sis/Makefile +++ b/drivers/video/sis/Makefile @@ -4,4 +4,4 @@ obj-$(CONFIG_FB_SIS) += sisfb.o -sisfb-objs := sis_main.o sis_accel.o init.o init301.o +sisfb-objs := sis_main.o sis_accel.o init.o init301.o initextlfb.o diff --git a/drivers/video/sis/init.c b/drivers/video/sis/init.c index ecfd72178dbb..2ab3868efde3 100644 --- a/drivers/video/sis/init.c +++ b/drivers/video/sis/init.c @@ -2,11 +2,12 @@ /* $XdotOrg$ */ /* * Mode initializing code (CRT1 section) for - * for SiS 300/305/540/630/730 and - * SiS 315/550/650/M650/651/661FX/M661FX/740/741(GX)/M741/330/660/M660/760/M760 - * (Universal module for Linux kernel framebuffer and XFree86 4.x) + * for SiS 300/305/540/630/730, + * SiS 315/550/[M]650/651/[M]661[FGM]X/[M]74x[GX]/330/[M]76x[GX], + * XGI Volari V3XT/V5/V8, Z7 + * (Universal module for Linux kernel framebuffer and X.org/XFree86 4.x) * - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria * * If distributed as part of the Linux kernel, the following license terms * apply: @@ -53,17 +54,12 @@ * * Formerly based on non-functional code-fragements for 300 series by SiS, Inc. * Used by permission. - * - * TW says: This code looks awful, I know. But please don't do anything about - * this otherwise debugging will be hell. - * The code is extremely fragile as regards the different chipsets, different - * video bridges and combinations thereof. If anything is changed, extreme - * care has to be taken that that change doesn't break it for other chipsets, - * bridges or combinations thereof. - * All comments in this file are by me, regardless if they are marked TW or not. - * */ - + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "init.h" #ifdef SIS300 @@ -84,24 +80,13 @@ #if defined(SIS300) || defined(SIS315H) static void -InitCommonPointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) +InitCommonPointer(struct SiS_Private *SiS_Pr) { + SiS_Pr->SiS_SModeIDTable = SiS_SModeIDTable; SiS_Pr->SiS_StResInfo = SiS_StResInfo; SiS_Pr->SiS_ModeResInfo = SiS_ModeResInfo; SiS_Pr->SiS_StandTable = SiS_StandTable; - SiS_Pr->SiS_NTSCPhase = SiS_NTSCPhase; - SiS_Pr->SiS_PALPhase = SiS_PALPhase; - SiS_Pr->SiS_NTSCPhase2 = SiS_NTSCPhase2; - SiS_Pr->SiS_PALPhase2 = SiS_PALPhase2; - SiS_Pr->SiS_PALMPhase = SiS_PALMPhase; - SiS_Pr->SiS_PALNPhase = SiS_PALNPhase; - SiS_Pr->SiS_PALMPhase2 = SiS_PALMPhase2; - SiS_Pr->SiS_PALNPhase2 = SiS_PALNPhase2; - SiS_Pr->SiS_SpecialPhase = SiS_SpecialPhase; - SiS_Pr->SiS_SpecialPhaseM = SiS_SpecialPhaseM; - SiS_Pr->SiS_SpecialPhaseJ = SiS_SpecialPhaseJ; - SiS_Pr->SiS_NTSCTiming = SiS_NTSCTiming; SiS_Pr->SiS_PALTiming = SiS_PALTiming; SiS_Pr->SiS_HiTVSt1Timing = SiS_HiTVSt1Timing; @@ -137,6 +122,7 @@ InitCommonPointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) SiS_Pr->SiS_ExtLCD1280x768_2Data = SiS_ExtLCD1280x768_2Data; SiS_Pr->SiS_LCD1280x800Data = SiS_LCD1280x800Data; SiS_Pr->SiS_LCD1280x800_2Data = SiS_LCD1280x800_2Data; + SiS_Pr->SiS_LCD1280x854Data = SiS_LCD1280x854Data; SiS_Pr->SiS_LCD1280x960Data = SiS_LCD1280x960Data; SiS_Pr->SiS_StLCD1400x1050Data = SiS_StLCD1400x1050Data; SiS_Pr->SiS_ExtLCD1400x1050Data = SiS_ExtLCD1400x1050Data; @@ -145,67 +131,30 @@ InitCommonPointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) SiS_Pr->SiS_ExtLCD1600x1200Data = SiS_ExtLCD1600x1200Data; SiS_Pr->SiS_NoScaleData = SiS_NoScaleData; - SiS_Pr->SiS_LVDS320x480Data_1 = SiS_LVDS320x480Data_1; + SiS_Pr->SiS_LVDS320x240Data_1 = SiS_LVDS320x240Data_1; + SiS_Pr->SiS_LVDS320x240Data_2 = SiS_LVDS320x240Data_2; + SiS_Pr->SiS_LVDS640x480Data_1 = SiS_LVDS640x480Data_1; SiS_Pr->SiS_LVDS800x600Data_1 = SiS_LVDS800x600Data_1; - SiS_Pr->SiS_LVDS800x600Data_2 = SiS_LVDS800x600Data_2; - SiS_Pr->SiS_LVDS1024x768Data_1 = SiS_LVDS1024x768Data_1; - SiS_Pr->SiS_LVDS1024x768Data_2 = SiS_LVDS1024x768Data_2; - SiS_Pr->SiS_LVDS1280x1024Data_1 = SiS_LVDS1280x1024Data_1; - SiS_Pr->SiS_LVDS1280x1024Data_2 = SiS_LVDS1280x1024Data_2; - SiS_Pr->SiS_LVDS1400x1050Data_1 = SiS_LVDS1400x1050Data_1; - SiS_Pr->SiS_LVDS1400x1050Data_2 = SiS_LVDS1400x1050Data_2; - SiS_Pr->SiS_LVDS1600x1200Data_1 = SiS_LVDS1600x1200Data_1; - SiS_Pr->SiS_LVDS1600x1200Data_2 = SiS_LVDS1600x1200Data_2; - SiS_Pr->SiS_LVDS1280x768Data_1 = SiS_LVDS1280x768Data_1; - SiS_Pr->SiS_LVDS1280x768Data_2 = SiS_LVDS1280x768Data_2; SiS_Pr->SiS_LVDS1024x600Data_1 = SiS_LVDS1024x600Data_1; - SiS_Pr->SiS_LVDS1024x600Data_2 = SiS_LVDS1024x600Data_2; - SiS_Pr->SiS_LVDS1152x768Data_1 = SiS_LVDS1152x768Data_1; - SiS_Pr->SiS_LVDS1152x768Data_2 = SiS_LVDS1152x768Data_2; - SiS_Pr->SiS_LVDSXXXxXXXData_1 = SiS_LVDSXXXxXXXData_1; - SiS_Pr->SiS_LVDS1280x960Data_1 = SiS_LVDS1280x960Data_1; - SiS_Pr->SiS_LVDS1280x960Data_2 = SiS_LVDS1280x960Data_2; - SiS_Pr->SiS_LVDS640x480Data_1 = SiS_LVDS640x480Data_1; - SiS_Pr->SiS_LVDS1280x960Data_1 = SiS_LVDS1280x1024Data_1; - SiS_Pr->SiS_LVDS1280x960Data_2 = SiS_LVDS1280x1024Data_2; - SiS_Pr->SiS_LVDS640x480Data_1 = SiS_LVDS640x480Data_1; - SiS_Pr->SiS_LVDS640x480Data_2 = SiS_LVDS640x480Data_2; - - SiS_Pr->SiS_LVDS848x480Data_1 = SiS_LVDS848x480Data_1; - SiS_Pr->SiS_LVDS848x480Data_2 = SiS_LVDS848x480Data_2; - SiS_Pr->SiS_LVDSBARCO1024Data_1 = SiS_LVDSBARCO1024Data_1; - SiS_Pr->SiS_LVDSBARCO1024Data_2 = SiS_LVDSBARCO1024Data_2; - SiS_Pr->SiS_LVDSBARCO1366Data_1 = SiS_LVDSBARCO1366Data_1; - SiS_Pr->SiS_LVDSBARCO1366Data_2 = SiS_LVDSBARCO1366Data_2; + SiS_Pr->SiS_LVDS1024x768Data_1 = SiS_LVDS1024x768Data_1; - SiS_Pr->SiS_LVDSCRT11280x768_1 = SiS_LVDSCRT11280x768_1; + SiS_Pr->SiS_LVDSCRT1320x240_1 = SiS_LVDSCRT1320x240_1; + SiS_Pr->SiS_LVDSCRT1320x240_2 = SiS_LVDSCRT1320x240_2; + SiS_Pr->SiS_LVDSCRT1320x240_2_H = SiS_LVDSCRT1320x240_2_H; + SiS_Pr->SiS_LVDSCRT1320x240_3 = SiS_LVDSCRT1320x240_3; + SiS_Pr->SiS_LVDSCRT1320x240_3_H = SiS_LVDSCRT1320x240_3_H; + SiS_Pr->SiS_LVDSCRT1640x480_1 = SiS_LVDSCRT1640x480_1; + SiS_Pr->SiS_LVDSCRT1640x480_1_H = SiS_LVDSCRT1640x480_1_H; +#if 0 SiS_Pr->SiS_LVDSCRT11024x600_1 = SiS_LVDSCRT11024x600_1; - SiS_Pr->SiS_LVDSCRT11152x768_1 = SiS_LVDSCRT11152x768_1; - SiS_Pr->SiS_LVDSCRT11280x768_1_H = SiS_LVDSCRT11280x768_1_H; SiS_Pr->SiS_LVDSCRT11024x600_1_H = SiS_LVDSCRT11024x600_1_H; - SiS_Pr->SiS_LVDSCRT11152x768_1_H = SiS_LVDSCRT11152x768_1_H; - SiS_Pr->SiS_LVDSCRT11280x768_2 = SiS_LVDSCRT11280x768_2; SiS_Pr->SiS_LVDSCRT11024x600_2 = SiS_LVDSCRT11024x600_2; - SiS_Pr->SiS_LVDSCRT11152x768_2 = SiS_LVDSCRT11152x768_2; - SiS_Pr->SiS_LVDSCRT11280x768_2_H = SiS_LVDSCRT11280x768_2_H; SiS_Pr->SiS_LVDSCRT11024x600_2_H = SiS_LVDSCRT11024x600_2_H; - SiS_Pr->SiS_LVDSCRT11152x768_2_H = SiS_LVDSCRT11152x768_2_H; - SiS_Pr->SiS_LVDSCRT1320x480_1 = SiS_LVDSCRT1320x480_1; - SiS_Pr->SiS_LVDSCRT1640x480_1 = SiS_LVDSCRT1640x480_1; - SiS_Pr->SiS_LVDSCRT1640x480_1_H = SiS_LVDSCRT1640x480_1_H; - SiS_Pr->SiS_LVDSCRT1640x480_2 = SiS_LVDSCRT1640x480_2; - SiS_Pr->SiS_LVDSCRT1640x480_2_H = SiS_LVDSCRT1640x480_2_H; - SiS_Pr->SiS_LVDSCRT1640x480_3 = SiS_LVDSCRT1640x480_3; - SiS_Pr->SiS_LVDSCRT1640x480_3_H = SiS_LVDSCRT1640x480_3_H; +#endif SiS_Pr->SiS_CHTVUNTSCData = SiS_CHTVUNTSCData; SiS_Pr->SiS_CHTVONTSCData = SiS_CHTVONTSCData; - SiS_Pr->SiS_CHTVUNTSCDesData = SiS_CHTVUNTSCDesData; - SiS_Pr->SiS_CHTVONTSCDesData = SiS_CHTVONTSCDesData; - SiS_Pr->SiS_CHTVUPALDesData = SiS_CHTVUPALDesData; - SiS_Pr->SiS_CHTVOPALDesData = SiS_CHTVOPALDesData; - SiS_Pr->SiS_PanelMinLVDS = Panel_800x600; /* lowest value LVDS/LCDA */ SiS_Pr->SiS_PanelMin301 = Panel_1024x768; /* lowest value 301 */ } @@ -213,50 +162,24 @@ InitCommonPointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) #ifdef SIS300 static void -InitTo300Pointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) +InitTo300Pointer(struct SiS_Private *SiS_Pr) { - InitCommonPointer(SiS_Pr, HwInfo); + InitCommonPointer(SiS_Pr); - SiS_Pr->SiS_SModeIDTable = SiS300_SModeIDTable; SiS_Pr->SiS_VBModeIDTable = SiS300_VBModeIDTable; SiS_Pr->SiS_EModeIDTable = SiS300_EModeIDTable; SiS_Pr->SiS_RefIndex = SiS300_RefIndex; SiS_Pr->SiS_CRT1Table = SiS300_CRT1Table; - if(HwInfo->jChipType == SIS_300) { - SiS_Pr->SiS_MCLKData_0 = SiS300_MCLKData_300; /* 300 */ + if(SiS_Pr->ChipType == SIS_300) { + SiS_Pr->SiS_MCLKData_0 = SiS300_MCLKData_300; /* 300 */ } else { - SiS_Pr->SiS_MCLKData_0 = SiS300_MCLKData_630; /* 630, 730 */ + SiS_Pr->SiS_MCLKData_0 = SiS300_MCLKData_630; /* 630, 730 */ } SiS_Pr->SiS_VCLKData = SiS300_VCLKData; - SiS_Pr->SiS_VBVCLKData = (SiS_VBVCLKDataStruct *)SiS300_VCLKData; + SiS_Pr->SiS_VBVCLKData = (struct SiS_VBVCLKData *)SiS300_VCLKData; SiS_Pr->SiS_SR15 = SiS300_SR15; -#ifdef LINUX_KERNEL - SiS_Pr->pSiS_SR07 = &SiS300_SR07; - SiS_Pr->SiS_CR40 = SiS300_CR40; - SiS_Pr->SiS_CR49 = SiS300_CR49; - SiS_Pr->pSiS_SR1F = &SiS300_SR1F; - SiS_Pr->pSiS_SR21 = &SiS300_SR21; - SiS_Pr->pSiS_SR22 = &SiS300_SR22; - SiS_Pr->pSiS_SR23 = &SiS300_SR23; - SiS_Pr->pSiS_SR24 = &SiS300_SR24; - SiS_Pr->SiS_SR25 = SiS300_SR25; - SiS_Pr->pSiS_SR31 = &SiS300_SR31; - SiS_Pr->pSiS_SR32 = &SiS300_SR32; - SiS_Pr->pSiS_SR33 = &SiS300_SR33; - SiS_Pr->pSiS_CRT2Data_1_2 = &SiS300_CRT2Data_1_2; - SiS_Pr->pSiS_CRT2Data_4_D = &SiS300_CRT2Data_4_D; - SiS_Pr->pSiS_CRT2Data_4_E = &SiS300_CRT2Data_4_E; - SiS_Pr->pSiS_CRT2Data_4_10 = &SiS300_CRT2Data_4_10; - SiS_Pr->pSiS_RGBSenseData = &SiS300_RGBSenseData; - SiS_Pr->pSiS_VideoSenseData = &SiS300_VideoSenseData; - SiS_Pr->pSiS_YCSenseData = &SiS300_YCSenseData; - SiS_Pr->pSiS_RGBSenseData2 = &SiS300_RGBSenseData2; - SiS_Pr->pSiS_VideoSenseData2 = &SiS300_VideoSenseData2; - SiS_Pr->pSiS_YCSenseData2 = &SiS300_YCSenseData2; -#endif - SiS_Pr->SiS_PanelDelayTbl = SiS300_PanelDelayTbl; SiS_Pr->SiS_PanelDelayTblLVDS = SiS300_PanelDelayTbl; @@ -266,11 +189,8 @@ InitTo300Pointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) SiS_Pr->SiS_St2LCD1280x1024Data = SiS300_St2LCD1280x1024Data; SiS_Pr->SiS_CRT2Part2_1024x768_1 = SiS300_CRT2Part2_1024x768_1; - SiS_Pr->SiS_CRT2Part2_1280x1024_1 = SiS300_CRT2Part2_1280x1024_1; SiS_Pr->SiS_CRT2Part2_1024x768_2 = SiS300_CRT2Part2_1024x768_2; - SiS_Pr->SiS_CRT2Part2_1280x1024_2 = SiS300_CRT2Part2_1280x1024_2; SiS_Pr->SiS_CRT2Part2_1024x768_3 = SiS300_CRT2Part2_1024x768_3; - SiS_Pr->SiS_CRT2Part2_1280x1024_3 = SiS300_CRT2Part2_1280x1024_3; SiS_Pr->SiS_CHTVUPALData = SiS300_CHTVUPALData; SiS_Pr->SiS_CHTVOPALData = SiS300_CHTVOPALData; @@ -280,64 +200,16 @@ InitTo300Pointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) SiS_Pr->SiS_CHTVOPALNData = SiS300_CHTVOPALData; /* not supported on 300 series */ SiS_Pr->SiS_CHTVSOPALData = SiS300_CHTVSOPALData; - SiS_Pr->SiS_PanelType00_1 = SiS300_PanelType00_1; - SiS_Pr->SiS_PanelType01_1 = SiS300_PanelType01_1; - SiS_Pr->SiS_PanelType02_1 = SiS300_PanelType02_1; - SiS_Pr->SiS_PanelType03_1 = SiS300_PanelType03_1; - SiS_Pr->SiS_PanelType04_1 = SiS300_PanelType04_1; - SiS_Pr->SiS_PanelType05_1 = SiS300_PanelType05_1; - SiS_Pr->SiS_PanelType06_1 = SiS300_PanelType06_1; - SiS_Pr->SiS_PanelType07_1 = SiS300_PanelType07_1; - SiS_Pr->SiS_PanelType08_1 = SiS300_PanelType08_1; - SiS_Pr->SiS_PanelType09_1 = SiS300_PanelType09_1; - SiS_Pr->SiS_PanelType0a_1 = SiS300_PanelType0a_1; - SiS_Pr->SiS_PanelType0b_1 = SiS300_PanelType0b_1; - SiS_Pr->SiS_PanelType0c_1 = SiS300_PanelType0c_1; - SiS_Pr->SiS_PanelType0d_1 = SiS300_PanelType0d_1; - SiS_Pr->SiS_PanelType0e_1 = SiS300_PanelType0e_1; - SiS_Pr->SiS_PanelType0f_1 = SiS300_PanelType0f_1; - SiS_Pr->SiS_PanelType00_2 = SiS300_PanelType00_2; - SiS_Pr->SiS_PanelType01_2 = SiS300_PanelType01_2; - SiS_Pr->SiS_PanelType02_2 = SiS300_PanelType02_2; - SiS_Pr->SiS_PanelType03_2 = SiS300_PanelType03_2; - SiS_Pr->SiS_PanelType04_2 = SiS300_PanelType04_2; - SiS_Pr->SiS_PanelType05_2 = SiS300_PanelType05_2; - SiS_Pr->SiS_PanelType06_2 = SiS300_PanelType06_2; - SiS_Pr->SiS_PanelType07_2 = SiS300_PanelType07_2; - SiS_Pr->SiS_PanelType08_2 = SiS300_PanelType08_2; - SiS_Pr->SiS_PanelType09_2 = SiS300_PanelType09_2; - SiS_Pr->SiS_PanelType0a_2 = SiS300_PanelType0a_2; - SiS_Pr->SiS_PanelType0b_2 = SiS300_PanelType0b_2; - SiS_Pr->SiS_PanelType0c_2 = SiS300_PanelType0c_2; - SiS_Pr->SiS_PanelType0d_2 = SiS300_PanelType0d_2; - SiS_Pr->SiS_PanelType0e_2 = SiS300_PanelType0e_2; - SiS_Pr->SiS_PanelType0f_2 = SiS300_PanelType0f_2; - SiS_Pr->SiS_PanelTypeNS_1 = SiS300_PanelTypeNS_1; - SiS_Pr->SiS_PanelTypeNS_2 = SiS300_PanelTypeNS_2; - - if(SiS_Pr->SiS_CustomT == CUT_BARCO1366) { - SiS_Pr->SiS_PanelType04_1 = SiS300_PanelType04_1a; - SiS_Pr->SiS_PanelType04_2 = SiS300_PanelType04_2a; - } - if(SiS_Pr->SiS_CustomT == CUT_BARCO1024) { - SiS_Pr->SiS_PanelType04_1 = SiS300_PanelType04_1b; - SiS_Pr->SiS_PanelType04_2 = SiS300_PanelType04_2b; - } - - SiS_Pr->SiS_LVDSCRT1800x600_1 = SiS300_LVDSCRT1800x600_1; - SiS_Pr->SiS_LVDSCRT1800x600_1_H = SiS300_LVDSCRT1800x600_1_H; - SiS_Pr->SiS_LVDSCRT1800x600_2 = SiS300_LVDSCRT1800x600_2; - SiS_Pr->SiS_LVDSCRT1800x600_2_H = SiS300_LVDSCRT1800x600_2_H; - SiS_Pr->SiS_LVDSCRT11024x768_1 = SiS300_LVDSCRT11024x768_1; - SiS_Pr->SiS_LVDSCRT11024x768_1_H = SiS300_LVDSCRT11024x768_1_H; - SiS_Pr->SiS_LVDSCRT11024x768_2 = SiS300_LVDSCRT11024x768_2; - SiS_Pr->SiS_LVDSCRT11024x768_2_H = SiS300_LVDSCRT11024x768_2_H; - SiS_Pr->SiS_LVDSCRT11280x1024_1 = SiS300_LVDSCRT11280x1024_1; - SiS_Pr->SiS_LVDSCRT11280x1024_1_H = SiS300_LVDSCRT11280x1024_1_H; - SiS_Pr->SiS_LVDSCRT11280x1024_2 = SiS300_LVDSCRT11280x1024_2; - SiS_Pr->SiS_LVDSCRT11280x1024_2_H = SiS300_LVDSCRT11280x1024_2_H; - SiS_Pr->SiS_LVDSCRT1XXXxXXX_1 = SiS300_LVDSCRT1XXXxXXX_1; - SiS_Pr->SiS_LVDSCRT1XXXxXXX_1_H = SiS300_LVDSCRT1XXXxXXX_1_H; + SiS_Pr->SiS_LVDS848x480Data_1 = SiS300_LVDS848x480Data_1; + SiS_Pr->SiS_LVDS848x480Data_2 = SiS300_LVDS848x480Data_2; + SiS_Pr->SiS_LVDSBARCO1024Data_1 = SiS300_LVDSBARCO1024Data_1; + SiS_Pr->SiS_LVDSBARCO1366Data_1 = SiS300_LVDSBARCO1366Data_1; + SiS_Pr->SiS_LVDSBARCO1366Data_2 = SiS300_LVDSBARCO1366Data_2; + + SiS_Pr->SiS_PanelType04_1a = SiS300_PanelType04_1a; + SiS_Pr->SiS_PanelType04_2a = SiS300_PanelType04_2a; + SiS_Pr->SiS_PanelType04_1b = SiS300_PanelType04_1b; + SiS_Pr->SiS_PanelType04_2b = SiS300_PanelType04_2b; SiS_Pr->SiS_CHTVCRT1UNTSC = SiS300_CHTVCRT1UNTSC; SiS_Pr->SiS_CHTVCRT1ONTSC = SiS300_CHTVCRT1ONTSC; @@ -367,64 +239,38 @@ InitTo300Pointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) #ifdef SIS315H static void -InitTo310Pointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) +InitTo310Pointer(struct SiS_Private *SiS_Pr) { - InitCommonPointer(SiS_Pr, HwInfo); + InitCommonPointer(SiS_Pr); - SiS_Pr->SiS_SModeIDTable = SiS310_SModeIDTable; SiS_Pr->SiS_EModeIDTable = SiS310_EModeIDTable; - SiS_Pr->SiS_RefIndex = (SiS_Ext2Struct *)SiS310_RefIndex; + SiS_Pr->SiS_RefIndex = SiS310_RefIndex; SiS_Pr->SiS_CRT1Table = SiS310_CRT1Table; - if(HwInfo->jChipType >= SIS_340) { - SiS_Pr->SiS_MCLKData_0 = SiS310_MCLKData_0_340; /* 340 */ - } else if(HwInfo->jChipType >= SIS_761) { + if(SiS_Pr->ChipType >= SIS_340) { + SiS_Pr->SiS_MCLKData_0 = SiS310_MCLKData_0_340; /* 340 + XGI */ + } else if(SiS_Pr->ChipType >= SIS_761) { SiS_Pr->SiS_MCLKData_0 = SiS310_MCLKData_0_761; /* 761 - preliminary */ - } else if(HwInfo->jChipType >= SIS_760) { + } else if(SiS_Pr->ChipType >= SIS_760) { SiS_Pr->SiS_MCLKData_0 = SiS310_MCLKData_0_760; /* 760 */ - } else if(HwInfo->jChipType >= SIS_661) { + } else if(SiS_Pr->ChipType >= SIS_661) { SiS_Pr->SiS_MCLKData_0 = SiS310_MCLKData_0_660; /* 661/741 */ - } else if(HwInfo->jChipType == SIS_330) { + } else if(SiS_Pr->ChipType == SIS_330) { SiS_Pr->SiS_MCLKData_0 = SiS310_MCLKData_0_330; /* 330 */ - } else if(HwInfo->jChipType > SIS_315PRO) { + } else if(SiS_Pr->ChipType > SIS_315PRO) { SiS_Pr->SiS_MCLKData_0 = SiS310_MCLKData_0_650; /* 550, 650, 740 */ } else { SiS_Pr->SiS_MCLKData_0 = SiS310_MCLKData_0_315; /* 315 */ } - if(HwInfo->jChipType >= SIS_340) { - SiS_Pr->SiS_MCLKData_1 = SiS310_MCLKData_1_340; + if(SiS_Pr->ChipType >= SIS_340) { + SiS_Pr->SiS_MCLKData_1 = SiS310_MCLKData_1_340; } else { - SiS_Pr->SiS_MCLKData_1 = SiS310_MCLKData_1; + SiS_Pr->SiS_MCLKData_1 = SiS310_MCLKData_1; } SiS_Pr->SiS_VCLKData = SiS310_VCLKData; SiS_Pr->SiS_VBVCLKData = SiS310_VBVCLKData; SiS_Pr->SiS_SR15 = SiS310_SR15; -#ifdef LINUX_KERNEL - SiS_Pr->pSiS_SR07 = &SiS310_SR07; - SiS_Pr->SiS_CR40 = SiS310_CR40; - SiS_Pr->SiS_CR49 = SiS310_CR49; - SiS_Pr->pSiS_SR1F = &SiS310_SR1F; - SiS_Pr->pSiS_SR21 = &SiS310_SR21; - SiS_Pr->pSiS_SR22 = &SiS310_SR22; - SiS_Pr->pSiS_SR23 = &SiS310_SR23; - SiS_Pr->pSiS_SR24 = &SiS310_SR24; - SiS_Pr->SiS_SR25 = SiS310_SR25; - SiS_Pr->pSiS_SR31 = &SiS310_SR31; - SiS_Pr->pSiS_SR32 = &SiS310_SR32; - SiS_Pr->pSiS_SR33 = &SiS310_SR33; - SiS_Pr->pSiS_CRT2Data_1_2 = &SiS310_CRT2Data_1_2; - SiS_Pr->pSiS_CRT2Data_4_D = &SiS310_CRT2Data_4_D; - SiS_Pr->pSiS_CRT2Data_4_E = &SiS310_CRT2Data_4_E; - SiS_Pr->pSiS_CRT2Data_4_10 = &SiS310_CRT2Data_4_10; - SiS_Pr->pSiS_RGBSenseData = &SiS310_RGBSenseData; - SiS_Pr->pSiS_VideoSenseData = &SiS310_VideoSenseData; - SiS_Pr->pSiS_YCSenseData = &SiS310_YCSenseData; - SiS_Pr->pSiS_RGBSenseData2 = &SiS310_RGBSenseData2; - SiS_Pr->pSiS_VideoSenseData2 = &SiS310_VideoSenseData2; - SiS_Pr->pSiS_YCSenseData2 = &SiS310_YCSenseData2; -#endif - SiS_Pr->SiS_PanelDelayTbl = SiS310_PanelDelayTbl; SiS_Pr->SiS_PanelDelayTblLVDS = SiS310_PanelDelayTblLVDS; @@ -435,41 +281,6 @@ InitTo310Pointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) SiS_Pr->SiS_CRT2Part2_1024x768_1 = SiS310_CRT2Part2_1024x768_1; - SiS_Pr->SiS_PanelType00_1 = SiS310_PanelType00_1; - SiS_Pr->SiS_PanelType01_1 = SiS310_PanelType01_1; - SiS_Pr->SiS_PanelType02_1 = SiS310_PanelType02_1; - SiS_Pr->SiS_PanelType03_1 = SiS310_PanelType03_1; - SiS_Pr->SiS_PanelType04_1 = SiS310_PanelType04_1; - SiS_Pr->SiS_PanelType05_1 = SiS310_PanelType05_1; - SiS_Pr->SiS_PanelType06_1 = SiS310_PanelType06_1; - SiS_Pr->SiS_PanelType07_1 = SiS310_PanelType07_1; - SiS_Pr->SiS_PanelType08_1 = SiS310_PanelType08_1; - SiS_Pr->SiS_PanelType09_1 = SiS310_PanelType09_1; - SiS_Pr->SiS_PanelType0a_1 = SiS310_PanelType0a_1; - SiS_Pr->SiS_PanelType0b_1 = SiS310_PanelType0b_1; - SiS_Pr->SiS_PanelType0c_1 = SiS310_PanelType0c_1; - SiS_Pr->SiS_PanelType0d_1 = SiS310_PanelType0d_1; - SiS_Pr->SiS_PanelType0e_1 = SiS310_PanelType0e_1; - SiS_Pr->SiS_PanelType0f_1 = SiS310_PanelType0f_1; - SiS_Pr->SiS_PanelType00_2 = SiS310_PanelType00_2; - SiS_Pr->SiS_PanelType01_2 = SiS310_PanelType01_2; - SiS_Pr->SiS_PanelType02_2 = SiS310_PanelType02_2; - SiS_Pr->SiS_PanelType03_2 = SiS310_PanelType03_2; - SiS_Pr->SiS_PanelType04_2 = SiS310_PanelType04_2; - SiS_Pr->SiS_PanelType05_2 = SiS310_PanelType05_2; - SiS_Pr->SiS_PanelType06_2 = SiS310_PanelType06_2; - SiS_Pr->SiS_PanelType07_2 = SiS310_PanelType07_2; - SiS_Pr->SiS_PanelType08_2 = SiS310_PanelType08_2; - SiS_Pr->SiS_PanelType09_2 = SiS310_PanelType09_2; - SiS_Pr->SiS_PanelType0a_2 = SiS310_PanelType0a_2; - SiS_Pr->SiS_PanelType0b_2 = SiS310_PanelType0b_2; - SiS_Pr->SiS_PanelType0c_2 = SiS310_PanelType0c_2; - SiS_Pr->SiS_PanelType0d_2 = SiS310_PanelType0d_2; - SiS_Pr->SiS_PanelType0e_2 = SiS310_PanelType0e_2; - SiS_Pr->SiS_PanelType0f_2 = SiS310_PanelType0f_2; - SiS_Pr->SiS_PanelTypeNS_1 = SiS310_PanelTypeNS_1; - SiS_Pr->SiS_PanelTypeNS_2 = SiS310_PanelTypeNS_2; - SiS_Pr->SiS_CHTVUPALData = SiS310_CHTVUPALData; SiS_Pr->SiS_CHTVOPALData = SiS310_CHTVOPALData; SiS_Pr->SiS_CHTVUPALMData = SiS310_CHTVUPALMData; @@ -478,33 +289,11 @@ InitTo310Pointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) SiS_Pr->SiS_CHTVOPALNData = SiS310_CHTVOPALNData; SiS_Pr->SiS_CHTVSOPALData = SiS310_CHTVSOPALData; - SiS_Pr->SiS_LVDSCRT1800x600_1 = SiS310_LVDSCRT1800x600_1; - SiS_Pr->SiS_LVDSCRT11024x768_1 = SiS310_LVDSCRT11024x768_1; - SiS_Pr->SiS_LVDSCRT11280x1024_1 = SiS310_LVDSCRT11280x1024_1; - SiS_Pr->SiS_LVDSCRT11400x1050_1 = SiS310_LVDSCRT11400x1050_1; - SiS_Pr->SiS_LVDSCRT11600x1200_1 = SiS310_LVDSCRT11600x1200_1; - SiS_Pr->SiS_LVDSCRT1800x600_1_H = SiS310_LVDSCRT1800x600_1_H; - SiS_Pr->SiS_LVDSCRT11024x768_1_H = SiS310_LVDSCRT11024x768_1_H; - SiS_Pr->SiS_LVDSCRT11280x1024_1_H = SiS310_LVDSCRT11280x1024_1_H; - SiS_Pr->SiS_LVDSCRT11400x1050_1_H = SiS310_LVDSCRT11400x1050_1_H; - SiS_Pr->SiS_LVDSCRT11600x1200_1_H = SiS310_LVDSCRT11600x1200_1_H; - SiS_Pr->SiS_LVDSCRT1800x600_2 = SiS310_LVDSCRT1800x600_2; - SiS_Pr->SiS_LVDSCRT11024x768_2 = SiS310_LVDSCRT11024x768_2; - SiS_Pr->SiS_LVDSCRT11280x1024_2 = SiS310_LVDSCRT11280x1024_2; - SiS_Pr->SiS_LVDSCRT11400x1050_2 = SiS310_LVDSCRT11400x1050_2; - SiS_Pr->SiS_LVDSCRT11600x1200_2 = SiS310_LVDSCRT11600x1200_2; - SiS_Pr->SiS_LVDSCRT1800x600_2_H = SiS310_LVDSCRT1800x600_2_H; - SiS_Pr->SiS_LVDSCRT11024x768_2_H = SiS310_LVDSCRT11024x768_2_H; - SiS_Pr->SiS_LVDSCRT11280x1024_2_H = SiS310_LVDSCRT11280x1024_2_H; - SiS_Pr->SiS_LVDSCRT11400x1050_2_H = SiS310_LVDSCRT11400x1050_2_H; - SiS_Pr->SiS_LVDSCRT11600x1200_2_H = SiS310_LVDSCRT11600x1200_2_H; - SiS_Pr->SiS_LVDSCRT1XXXxXXX_1 = SiS310_LVDSCRT1XXXxXXX_1; - SiS_Pr->SiS_LVDSCRT1XXXxXXX_1_H = SiS310_LVDSCRT1XXXxXXX_1_H; - SiS_Pr->SiS_CHTVCRT1UNTSC = SiS310_CHTVCRT1UNTSC; - SiS_Pr->SiS_CHTVCRT1ONTSC = SiS310_CHTVCRT1ONTSC; - SiS_Pr->SiS_CHTVCRT1UPAL = SiS310_CHTVCRT1UPAL; - SiS_Pr->SiS_CHTVCRT1OPAL = SiS310_CHTVCRT1OPAL; - SiS_Pr->SiS_CHTVCRT1SOPAL = SiS310_CHTVCRT1OPAL; + SiS_Pr->SiS_CHTVCRT1UNTSC = SiS310_CHTVCRT1UNTSC; + SiS_Pr->SiS_CHTVCRT1ONTSC = SiS310_CHTVCRT1ONTSC; + SiS_Pr->SiS_CHTVCRT1UPAL = SiS310_CHTVCRT1UPAL; + SiS_Pr->SiS_CHTVCRT1OPAL = SiS310_CHTVCRT1OPAL; + SiS_Pr->SiS_CHTVCRT1SOPAL = SiS310_CHTVCRT1OPAL; SiS_Pr->SiS_CHTVReg_UNTSC = SiS310_CHTVReg_UNTSC; SiS_Pr->SiS_CHTVReg_ONTSC = SiS310_CHTVReg_ONTSC; @@ -528,208 +317,203 @@ InitTo310Pointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) } #endif -static void -SiSInitPtr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) +BOOLEAN +SiSInitPtr(struct SiS_Private *SiS_Pr) { - switch(HwInfo->jChipType) { -#ifdef SIS315H - case SIS_315H: - case SIS_315: - case SIS_315PRO: - case SIS_550: - case SIS_650: - case SIS_740: - case SIS_330: - case SIS_661: - case SIS_741: - case SIS_660: - case SIS_760: - case SIS_761: - case SIS_340: - InitTo310Pointer(SiS_Pr, HwInfo); - break; -#endif + if(SiS_Pr->ChipType < SIS_315H) { #ifdef SIS300 - case SIS_300: - case SIS_540: - case SIS_630: - case SIS_730: - InitTo300Pointer(SiS_Pr, HwInfo); - break; + InitTo300Pointer(SiS_Pr); +#else + return FALSE; +#endif + } else { +#ifdef SIS315H + InitTo310Pointer(SiS_Pr); +#else + return FALSE; #endif - default: - break; } + return TRUE; } /*********************************************/ /* HELPER: Get ModeID */ /*********************************************/ -#ifdef LINUX_XF86 -USHORT -SiS_GetModeID(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, - int Depth, BOOLEAN FSTN, int LCDwidth, int LCDheight) +#ifndef SIS_XORG_XF86 +static +#endif +unsigned short +SiS_GetModeID(int VGAEngine, unsigned int VBFlags, int HDisplay, int VDisplay, + int Depth, BOOLEAN FSTN, int LCDwidth, int LCDheight) { - USHORT ModeIndex = 0; + unsigned short ModeIndex = 0; switch(HDisplay) { - case 320: - if(VDisplay == 200) ModeIndex = ModeIndex_320x200[Depth]; - else if(VDisplay == 240) { - if(FSTN) ModeIndex = ModeIndex_320x240_FSTN[Depth]; - else ModeIndex = ModeIndex_320x240[Depth]; - } - break; - case 400: - if((!(VBFlags & CRT1_LCDA)) || ((LCDwidth >= 800) && (LCDwidth >= 600))) { - if(VDisplay == 300) ModeIndex = ModeIndex_400x300[Depth]; - } - break; - case 512: - if((!(VBFlags & CRT1_LCDA)) || ((LCDwidth >= 1024) && (LCDwidth >= 768))) { - if(VDisplay == 384) ModeIndex = ModeIndex_512x384[Depth]; - } - break; - case 640: - if(VDisplay == 480) ModeIndex = ModeIndex_640x480[Depth]; - else if(VDisplay == 400) ModeIndex = ModeIndex_640x400[Depth]; - break; - case 720: - if(VDisplay == 480) ModeIndex = ModeIndex_720x480[Depth]; - else if(VDisplay == 576) ModeIndex = ModeIndex_720x576[Depth]; - break; - case 768: - if(VDisplay == 576) ModeIndex = ModeIndex_768x576[Depth]; - break; - case 800: - if(VDisplay == 600) ModeIndex = ModeIndex_800x600[Depth]; - else if(VDisplay == 480) ModeIndex = ModeIndex_800x480[Depth]; - break; - case 848: - if(VDisplay == 480) ModeIndex = ModeIndex_848x480[Depth]; - break; - case 856: - if(VDisplay == 480) ModeIndex = ModeIndex_856x480[Depth]; - break; - case 960: - if(VGAEngine == SIS_315_VGA) { - if(VDisplay == 540) ModeIndex = ModeIndex_960x540[Depth]; - else if(VDisplay == 600) ModeIndex = ModeIndex_960x600[Depth]; - } - break; - case 1024: - if(VDisplay == 576) ModeIndex = ModeIndex_1024x576[Depth]; - else if(VDisplay == 768) ModeIndex = ModeIndex_1024x768[Depth]; - else if(VGAEngine == SIS_300_VGA) { - if(VDisplay == 600) ModeIndex = ModeIndex_1024x600[Depth]; - } - break; - case 1152: - if(VDisplay == 864) ModeIndex = ModeIndex_1152x864[Depth]; - if(VGAEngine == SIS_300_VGA) { - if(VDisplay == 768) ModeIndex = ModeIndex_1152x768[Depth]; - } - break; - case 1280: - switch(VDisplay) { - case 720: - ModeIndex = ModeIndex_1280x720[Depth]; - break; - case 768: - if(VGAEngine == SIS_300_VGA) { - ModeIndex = ModeIndex_300_1280x768[Depth]; - } else { - ModeIndex = ModeIndex_310_1280x768[Depth]; - } - break; - case 800: - if(VGAEngine == SIS_315_VGA) { - ModeIndex = ModeIndex_1280x800[Depth]; - } - break; - case 960: - ModeIndex = ModeIndex_1280x960[Depth]; - break; - case 1024: - ModeIndex = ModeIndex_1280x1024[Depth]; - break; - } - break; - case 1360: - if(VDisplay == 768) ModeIndex = ModeIndex_1360x768[Depth]; - if(VGAEngine == SIS_300_VGA) { - if(VDisplay == 1024) ModeIndex = ModeIndex_300_1360x1024[Depth]; - } - break; - case 1400: - if(VGAEngine == SIS_315_VGA) { - if(VDisplay == 1050) { - ModeIndex = ModeIndex_1400x1050[Depth]; - } - } - break; - case 1600: - if(VDisplay == 1200) ModeIndex = ModeIndex_1600x1200[Depth]; - break; - case 1680: - if(VGAEngine == SIS_315_VGA) { - if(VDisplay == 1050) ModeIndex = ModeIndex_1680x1050[Depth]; - } - break; - case 1920: - if(VDisplay == 1440) ModeIndex = ModeIndex_1920x1440[Depth]; - else if(VGAEngine == SIS_315_VGA) { - if(VDisplay == 1080) ModeIndex = ModeIndex_1920x1080[Depth]; - } - break; - case 2048: - if(VDisplay == 1536) { - if(VGAEngine == SIS_300_VGA) { - ModeIndex = ModeIndex_300_2048x1536[Depth]; - } else { - ModeIndex = ModeIndex_310_2048x1536[Depth]; - } - } - break; + case 320: + if(VDisplay == 200) ModeIndex = ModeIndex_320x200[Depth]; + else if(VDisplay == 240) { + if((VBFlags & CRT2_LCD) && (FSTN)) + ModeIndex = ModeIndex_320x240_FSTN[Depth]; + else + ModeIndex = ModeIndex_320x240[Depth]; + } + break; + case 400: + if((!(VBFlags & CRT1_LCDA)) || ((LCDwidth >= 800) && (LCDwidth >= 600))) { + if(VDisplay == 300) ModeIndex = ModeIndex_400x300[Depth]; + } + break; + case 512: + if((!(VBFlags & CRT1_LCDA)) || ((LCDwidth >= 1024) && (LCDwidth >= 768))) { + if(VDisplay == 384) ModeIndex = ModeIndex_512x384[Depth]; + } + break; + case 640: + if(VDisplay == 480) ModeIndex = ModeIndex_640x480[Depth]; + else if(VDisplay == 400) ModeIndex = ModeIndex_640x400[Depth]; + break; + case 720: + if(VDisplay == 480) ModeIndex = ModeIndex_720x480[Depth]; + else if(VDisplay == 576) ModeIndex = ModeIndex_720x576[Depth]; + break; + case 768: + if(VDisplay == 576) ModeIndex = ModeIndex_768x576[Depth]; + break; + case 800: + if(VDisplay == 600) ModeIndex = ModeIndex_800x600[Depth]; + else if(VDisplay == 480) ModeIndex = ModeIndex_800x480[Depth]; + break; + case 848: + if(VDisplay == 480) ModeIndex = ModeIndex_848x480[Depth]; + break; + case 856: + if(VDisplay == 480) ModeIndex = ModeIndex_856x480[Depth]; + break; + case 960: + if(VGAEngine == SIS_315_VGA) { + if(VDisplay == 540) ModeIndex = ModeIndex_960x540[Depth]; + else if(VDisplay == 600) ModeIndex = ModeIndex_960x600[Depth]; + } + break; + case 1024: + if(VDisplay == 576) ModeIndex = ModeIndex_1024x576[Depth]; + else if(VDisplay == 768) ModeIndex = ModeIndex_1024x768[Depth]; + else if(VGAEngine == SIS_300_VGA) { + if(VDisplay == 600) ModeIndex = ModeIndex_1024x600[Depth]; + } + break; + case 1152: + if(VDisplay == 864) ModeIndex = ModeIndex_1152x864[Depth]; + if(VGAEngine == SIS_300_VGA) { + if(VDisplay == 768) ModeIndex = ModeIndex_1152x768[Depth]; + } + break; + case 1280: + switch(VDisplay) { + case 720: + ModeIndex = ModeIndex_1280x720[Depth]; + break; + case 768: + if(VGAEngine == SIS_300_VGA) { + ModeIndex = ModeIndex_300_1280x768[Depth]; + } else { + ModeIndex = ModeIndex_310_1280x768[Depth]; + } + break; + case 800: + if(VGAEngine == SIS_315_VGA) { + ModeIndex = ModeIndex_1280x800[Depth]; + } + break; + case 854: + if(VGAEngine == SIS_315_VGA) { + ModeIndex = ModeIndex_1280x854[Depth]; + } + break; + case 960: + ModeIndex = ModeIndex_1280x960[Depth]; + break; + case 1024: + ModeIndex = ModeIndex_1280x1024[Depth]; + break; + } + break; + case 1360: + if(VDisplay == 768) ModeIndex = ModeIndex_1360x768[Depth]; + if(VGAEngine == SIS_300_VGA) { + if(VDisplay == 1024) ModeIndex = ModeIndex_300_1360x1024[Depth]; + } + break; + case 1400: + if(VGAEngine == SIS_315_VGA) { + if(VDisplay == 1050) { + ModeIndex = ModeIndex_1400x1050[Depth]; + } + } + break; + case 1600: + if(VDisplay == 1200) ModeIndex = ModeIndex_1600x1200[Depth]; + break; + case 1680: + if(VGAEngine == SIS_315_VGA) { + if(VDisplay == 1050) ModeIndex = ModeIndex_1680x1050[Depth]; + } + break; + case 1920: + if(VDisplay == 1440) ModeIndex = ModeIndex_1920x1440[Depth]; + else if(VGAEngine == SIS_315_VGA) { + if(VDisplay == 1080) ModeIndex = ModeIndex_1920x1080[Depth]; + } + break; + case 2048: + if(VDisplay == 1536) { + if(VGAEngine == SIS_300_VGA) { + ModeIndex = ModeIndex_300_2048x1536[Depth]; + } else { + ModeIndex = ModeIndex_310_2048x1536[Depth]; + } + } + break; } - return(ModeIndex); + return ModeIndex; } -#endif -USHORT -SiS_GetModeID_LCD(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, - int Depth, BOOLEAN FSTN, USHORT CustomT, int LCDwidth, int LCDheight) +unsigned short +SiS_GetModeID_LCD(int VGAEngine, unsigned int VBFlags, int HDisplay, int VDisplay, + int Depth, BOOLEAN FSTN, unsigned short CustomT, int LCDwidth, int LCDheight, + unsigned int VBFlags2) { - USHORT ModeIndex = 0; + unsigned short ModeIndex = 0; - if(VBFlags & (VB_LVDS | VB_30xBDH)) { + if(VBFlags2 & (VB2_LVDS | VB2_30xBDH)) { switch(HDisplay) { case 320: - if(CustomT != CUT_PANEL848) { - if(VDisplay == 200) ModeIndex = ModeIndex_320x200[Depth]; - else if(VDisplay == 240) { + if((CustomT != CUT_PANEL848) && (CustomT != CUT_PANEL856)) { + if(VDisplay == 200) { + if(!FSTN) ModeIndex = ModeIndex_320x200[Depth]; + } else if(VDisplay == 240) { if(!FSTN) ModeIndex = ModeIndex_320x240[Depth]; - else if(VGAEngine == SIS_315_VGA) { - ModeIndex = ModeIndex_320x240_FSTN[Depth]; + else if(VGAEngine == SIS_315_VGA) { + ModeIndex = ModeIndex_320x240_FSTN[Depth]; } } } - break; - case 400: - if(CustomT != CUT_PANEL848) { - if(!((VGAEngine == SIS_300_VGA) && (VBFlags & VB_TRUMPION))) { - if(VDisplay == 300) ModeIndex = ModeIndex_400x300[Depth]; + break; + case 400: + if((CustomT != CUT_PANEL848) && (CustomT != CUT_PANEL856)) { + if(!((VGAEngine == SIS_300_VGA) && (VBFlags2 & VB2_TRUMPION))) { + if(VDisplay == 300) ModeIndex = ModeIndex_400x300[Depth]; } } - break; + break; case 512: - if(CustomT != CUT_PANEL848) { - if(!((VGAEngine == SIS_300_VGA) && (VBFlags & VB_TRUMPION))) { + if((CustomT != CUT_PANEL848) && (CustomT != CUT_PANEL856)) { + if(!((VGAEngine == SIS_300_VGA) && (VBFlags2 & VB2_TRUMPION))) { if(LCDwidth >= 1024 && LCDwidth != 1152 && LCDheight >= 768) { if(VDisplay == 384) { ModeIndex = ModeIndex_512x384[Depth]; @@ -739,9 +523,10 @@ SiS_GetModeID_LCD(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, } break; case 640: - if(VDisplay == 480) ModeIndex = ModeIndex_640x480[Depth]; + if(VDisplay == 480) ModeIndex = ModeIndex_640x480[Depth]; else if(VDisplay == 400) { - if(CustomT != CUT_PANEL848) ModeIndex = ModeIndex_640x400[Depth]; + if((CustomT != CUT_PANEL848) && (CustomT != CUT_PANEL856)) + ModeIndex = ModeIndex_640x400[Depth]; } break; case 800: @@ -752,6 +537,11 @@ SiS_GetModeID_LCD(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, if(VDisplay == 480) ModeIndex = ModeIndex_848x480[Depth]; } break; + case 856: + if(CustomT == CUT_PANEL856) { + if(VDisplay == 480) ModeIndex = ModeIndex_856x480[Depth]; + } + break; case 1024: if(VDisplay == 768) ModeIndex = ModeIndex_1024x768[Depth]; else if(VGAEngine == SIS_300_VGA) { @@ -762,7 +552,7 @@ SiS_GetModeID_LCD(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, break; case 1152: if(VGAEngine == SIS_300_VGA) { - if((VDisplay == 768) && (LCDheight == 768)) { + if((VDisplay == 768) && (LCDheight == 768)) { ModeIndex = ModeIndex_1152x768[Depth]; } } @@ -770,49 +560,49 @@ SiS_GetModeID_LCD(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, case 1280: if(VDisplay == 1024) ModeIndex = ModeIndex_1280x1024[Depth]; else if(VGAEngine == SIS_315_VGA) { - if((VDisplay == 768) && (LCDheight == 768)) { + if((VDisplay == 768) && (LCDheight == 768)) { ModeIndex = ModeIndex_310_1280x768[Depth]; } } break; case 1360: if(VGAEngine == SIS_300_VGA) { - if(CustomT == CUT_BARCO1366) { + if(CustomT == CUT_BARCO1366) { if(VDisplay == 1024) ModeIndex = ModeIndex_300_1360x1024[Depth]; } } if(CustomT == CUT_PANEL848) { - if(VDisplay == 768) ModeIndex = ModeIndex_1360x768[Depth]; + if(VDisplay == 768) ModeIndex = ModeIndex_1360x768[Depth]; } break; case 1400: if(VGAEngine == SIS_315_VGA) { - if(VDisplay == 1050) ModeIndex = ModeIndex_1400x1050[Depth]; + if(VDisplay == 1050) ModeIndex = ModeIndex_1400x1050[Depth]; } break; case 1600: if(VGAEngine == SIS_315_VGA) { - if(VDisplay == 1200) ModeIndex = ModeIndex_1600x1200[Depth]; + if(VDisplay == 1200) ModeIndex = ModeIndex_1600x1200[Depth]; } break; } - } else if(VBFlags & VB_SISBRIDGE) { + } else if(VBFlags2 & VB2_SISBRIDGE) { switch(HDisplay) { case 320: - if(VDisplay == 200) ModeIndex = ModeIndex_320x200[Depth]; + if(VDisplay == 200) ModeIndex = ModeIndex_320x200[Depth]; else if(VDisplay == 240) ModeIndex = ModeIndex_320x240[Depth]; - break; - case 400: + break; + case 400: if(LCDwidth >= 800 && LCDheight >= 600) { - if(VDisplay == 300) ModeIndex = ModeIndex_400x300[Depth]; + if(VDisplay == 300) ModeIndex = ModeIndex_400x300[Depth]; } - break; + break; case 512: if(LCDwidth >= 1024 && LCDheight >= 768 && LCDwidth != 1152) { - if(VDisplay == 384) ModeIndex = ModeIndex_512x384[Depth]; + if(VDisplay == 384) ModeIndex = ModeIndex_512x384[Depth]; } break; case 640: @@ -821,96 +611,115 @@ SiS_GetModeID_LCD(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, break; case 720: if(VGAEngine == SIS_315_VGA) { - if(VDisplay == 480) ModeIndex = ModeIndex_720x480[Depth]; + if(VDisplay == 480) ModeIndex = ModeIndex_720x480[Depth]; else if(VDisplay == 576) ModeIndex = ModeIndex_720x576[Depth]; } break; case 768: if(VGAEngine == SIS_315_VGA) { - if(VDisplay == 576) ModeIndex = ModeIndex_768x576[Depth]; + if(VDisplay == 576) ModeIndex = ModeIndex_768x576[Depth]; } break; case 800: if(VDisplay == 600) ModeIndex = ModeIndex_800x600[Depth]; if(VGAEngine == SIS_315_VGA) { - if(VDisplay == 480) ModeIndex = ModeIndex_800x480[Depth]; + if(VDisplay == 480) ModeIndex = ModeIndex_800x480[Depth]; } break; case 848: if(VGAEngine == SIS_315_VGA) { - if(VDisplay == 480) ModeIndex = ModeIndex_848x480[Depth]; + if(VDisplay == 480) ModeIndex = ModeIndex_848x480[Depth]; } break; case 856: if(VGAEngine == SIS_315_VGA) { - if(VDisplay == 480) ModeIndex = ModeIndex_856x480[Depth]; + if(VDisplay == 480) ModeIndex = ModeIndex_856x480[Depth]; } break; case 960: if(VGAEngine == SIS_315_VGA) { - if(VDisplay == 540) ModeIndex = ModeIndex_960x540[Depth]; + if(VDisplay == 540) ModeIndex = ModeIndex_960x540[Depth]; else if(VDisplay == 600) ModeIndex = ModeIndex_960x600[Depth]; } break; case 1024: if(VDisplay == 768) ModeIndex = ModeIndex_1024x768[Depth]; if(VGAEngine == SIS_315_VGA) { - if(VDisplay == 576) ModeIndex = ModeIndex_1024x576[Depth]; + if(VDisplay == 576) ModeIndex = ModeIndex_1024x576[Depth]; } break; case 1152: if(VGAEngine == SIS_315_VGA) { - if(VDisplay == 864) ModeIndex = ModeIndex_1152x864[Depth]; + if(VDisplay == 864) ModeIndex = ModeIndex_1152x864[Depth]; } break; case 1280: switch(VDisplay) { case 720: - ModeIndex = ModeIndex_1280x720[Depth]; + ModeIndex = ModeIndex_1280x720[Depth]; case 768: - if(VGAEngine == SIS_300_VGA) { + if(VGAEngine == SIS_300_VGA) { ModeIndex = ModeIndex_300_1280x768[Depth]; } else { ModeIndex = ModeIndex_310_1280x768[Depth]; } break; case 800: - if(VGAEngine == SIS_315_VGA) { + if(VGAEngine == SIS_315_VGA) { ModeIndex = ModeIndex_1280x800[Depth]; } break; + case 854: + if(VGAEngine == SIS_315_VGA) { + ModeIndex = ModeIndex_1280x854[Depth]; + } + break; case 960: - ModeIndex = ModeIndex_1280x960[Depth]; + ModeIndex = ModeIndex_1280x960[Depth]; break; case 1024: - ModeIndex = ModeIndex_1280x1024[Depth]; + ModeIndex = ModeIndex_1280x1024[Depth]; break; } break; case 1360: - if(VGAEngine == SIS_315_VGA) { - if(VDisplay == 768) ModeIndex = ModeIndex_1360x768[Depth]; + if(VGAEngine == SIS_315_VGA) { /* OVER1280 only? */ + if(VDisplay == 768) ModeIndex = ModeIndex_1360x768[Depth]; } break; case 1400: if(VGAEngine == SIS_315_VGA) { - if(VBFlags & (VB_301C | VB_302LV | VB_302ELV)) { + if(VBFlags2 & VB2_LCDOVER1280BRIDGE) { if(VDisplay == 1050) ModeIndex = ModeIndex_1400x1050[Depth]; } } break; case 1600: if(VGAEngine == SIS_315_VGA) { - if(VBFlags & (VB_301C | VB_302LV | VB_302ELV)) { - if(VDisplay == 1200) ModeIndex = ModeIndex_1600x1200[Depth]; + if(VBFlags2 & VB2_LCDOVER1280BRIDGE) { + if(VDisplay == 1200) ModeIndex = ModeIndex_1600x1200[Depth]; } } break; #ifndef VB_FORBID_CRT2LCD_OVER_1600 case 1680: if(VGAEngine == SIS_315_VGA) { - if(VBFlags & (VB_301C | VB_302LV | VB_302ELV)) { - if(VDisplay == 1050) ModeIndex = ModeIndex_1680x1050[Depth]; + if(VBFlags2 & VB2_LCDOVER1280BRIDGE) { + if(VDisplay == 1050) ModeIndex = ModeIndex_1680x1050[Depth]; + } + } + break; + case 1920: + if(VGAEngine == SIS_315_VGA) { + if(VBFlags2 & VB2_LCDOVER1600BRIDGE) { + if(VDisplay == 1440) ModeIndex = ModeIndex_1920x1440[Depth]; + } + } + break; + case 2048: + if(VGAEngine == SIS_315_VGA) { + if(VBFlags2 & VB2_LCDOVER1600BRIDGE) { + if(VDisplay == 1536) ModeIndex = ModeIndex_310_2048x1536[Depth]; } } break; @@ -921,16 +730,17 @@ SiS_GetModeID_LCD(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, return ModeIndex; } -USHORT -SiS_GetModeID_TV(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int Depth) +unsigned short +SiS_GetModeID_TV(int VGAEngine, unsigned int VBFlags, int HDisplay, int VDisplay, int Depth, + unsigned int VBFlags2) { - USHORT ModeIndex = 0; + unsigned short ModeIndex = 0; - if(VBFlags & VB_CHRONTEL) { + if(VBFlags2 & VB2_CHRONTEL) { switch(HDisplay) { - case 512: + case 512: if(VGAEngine == SIS_315_VGA) { if(VDisplay == 384) ModeIndex = ModeIndex_512x384[Depth]; } @@ -944,27 +754,27 @@ SiS_GetModeID_TV(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int D break; case 1024: if(VGAEngine == SIS_315_VGA) { - if(VDisplay == 768) ModeIndex = ModeIndex_1024x768[Depth]; + if(VDisplay == 768) ModeIndex = ModeIndex_1024x768[Depth]; } break; } - } else if(VBFlags & VB_SISTVBRIDGE) { + } else if(VBFlags2 & VB2_SISTVBRIDGE) { switch(HDisplay) { case 320: - if(VDisplay == 200) ModeIndex = ModeIndex_320x200[Depth]; + if(VDisplay == 200) ModeIndex = ModeIndex_320x200[Depth]; else if(VDisplay == 240) ModeIndex = ModeIndex_320x240[Depth]; - break; - case 400: - if(VDisplay == 300) ModeIndex = ModeIndex_400x300[Depth]; - break; - case 512: + break; + case 400: + if(VDisplay == 300) ModeIndex = ModeIndex_400x300[Depth]; + break; + case 512: if( ((VBFlags & TV_YPBPR) && (VBFlags & (TV_YPBPR750P | TV_YPBPR1080I))) || - (VBFlags & TV_HIVISION) || - ((!(VBFlags & (TV_YPBPR | TV_PALM))) && (VBFlags & TV_PAL)) ) { - if(VDisplay == 384) ModeIndex = ModeIndex_512x384[Depth]; + (VBFlags & TV_HIVISION) || + ((!(VBFlags & (TV_YPBPR | TV_PALM))) && (VBFlags & TV_PAL)) ) { + if(VDisplay == 384) ModeIndex = ModeIndex_512x384[Depth]; } break; case 640: @@ -973,34 +783,34 @@ SiS_GetModeID_TV(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int D break; case 720: if((!(VBFlags & TV_HIVISION)) && (!((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR1080I)))) { - if(VDisplay == 480) { - ModeIndex = ModeIndex_720x480[Depth]; - } else if(VDisplay == 576) { + if(VDisplay == 480) { + ModeIndex = ModeIndex_720x480[Depth]; + } else if(VDisplay == 576) { if( ((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR750P)) || ((!(VBFlags & (TV_YPBPR | TV_PALM))) && (VBFlags & TV_PAL)) ) - ModeIndex = ModeIndex_720x576[Depth]; - } + ModeIndex = ModeIndex_720x576[Depth]; + } } break; case 768: if((!(VBFlags & TV_HIVISION)) && (!((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR1080I)))) { - if( ((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR750P)) || + if( ((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR750P)) || ((!(VBFlags & (TV_YPBPR | TV_PALM))) && (VBFlags & TV_PAL)) ) { - if(VDisplay == 576) ModeIndex = ModeIndex_768x576[Depth]; + if(VDisplay == 576) ModeIndex = ModeIndex_768x576[Depth]; } } break; case 800: if(VDisplay == 600) ModeIndex = ModeIndex_800x600[Depth]; else if(VDisplay == 480) { - if((VBFlags & TV_HIVISION) || ((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR1080I))) { + if(!((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR750P))) { ModeIndex = ModeIndex_800x480[Depth]; } } break; case 960: if(VGAEngine == SIS_315_VGA) { - if(VDisplay == 600) { + if(VDisplay == 600) { if((VBFlags & TV_HIVISION) || ((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR1080I))) { ModeIndex = ModeIndex_960x600[Depth]; } @@ -1009,25 +819,28 @@ SiS_GetModeID_TV(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int D break; case 1024: if(VDisplay == 768) { - if(VBFlags & (VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV|VB_302ELV)) { + if(VBFlags2 & VB2_30xBLV) { ModeIndex = ModeIndex_1024x768[Depth]; } } else if(VDisplay == 576) { - if((VBFlags & TV_HIVISION) || ((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR1080I))) { + if( (VBFlags & TV_HIVISION) || + ((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR1080I)) || + ((VBFlags2 & VB2_30xBLV) && + ((!(VBFlags & (TV_YPBPR | TV_PALM))) && (VBFlags & TV_PAL))) ) { ModeIndex = ModeIndex_1024x576[Depth]; } } break; case 1280: if(VDisplay == 720) { - if((VBFlags & TV_HIVISION) || + if((VBFlags & TV_HIVISION) || ((VBFlags & TV_YPBPR) && (VBFlags & (TV_YPBPR1080I | TV_YPBPR750P)))) { - ModeIndex = ModeIndex_1280x720[Depth]; + ModeIndex = ModeIndex_1280x720[Depth]; } } else if(VDisplay == 1024) { - if((VBFlags & TV_HIVISION) || + if((VBFlags & TV_HIVISION) || ((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR1080I))) { - ModeIndex = ModeIndex_1280x1024[Depth]; + ModeIndex = ModeIndex_1280x1024[Depth]; } } break; @@ -1036,99 +849,31 @@ SiS_GetModeID_TV(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int D return ModeIndex; } -USHORT -SiS_GetModeID_VGA2(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int Depth) +unsigned short +SiS_GetModeID_VGA2(int VGAEngine, unsigned int VBFlags, int HDisplay, int VDisplay, int Depth, + unsigned int VBFlags2) { - USHORT ModeIndex = 0; + if(!(VBFlags2 & VB2_SISVGA2BRIDGE)) return 0; - if(!(VBFlags & (VB_301|VB_301B|VB_301C|VB_302B))) return 0; + if(HDisplay >= 1920) return 0; switch(HDisplay) { - case 320: - if(VDisplay == 200) ModeIndex = ModeIndex_320x200[Depth]; - else if(VDisplay == 240) ModeIndex = ModeIndex_320x240[Depth]; - break; - case 400: - if(VDisplay == 300) ModeIndex = ModeIndex_400x300[Depth]; - break; - case 512: - if(VDisplay == 384) ModeIndex = ModeIndex_512x384[Depth]; - break; - case 640: - if(VDisplay == 480) ModeIndex = ModeIndex_640x480[Depth]; - else if(VDisplay == 400) ModeIndex = ModeIndex_640x400[Depth]; - break; - case 720: - if(VDisplay == 480) ModeIndex = ModeIndex_720x480[Depth]; - else if(VDisplay == 576) ModeIndex = ModeIndex_720x576[Depth]; - break; - case 768: - if(VDisplay == 576) ModeIndex = ModeIndex_768x576[Depth]; - break; - case 800: - if(VDisplay == 600) ModeIndex = ModeIndex_800x600[Depth]; - else if(VDisplay == 480) ModeIndex = ModeIndex_800x480[Depth]; - break; - case 848: - if(VDisplay == 480) ModeIndex = ModeIndex_848x480[Depth]; - break; - case 856: - if(VDisplay == 480) ModeIndex = ModeIndex_856x480[Depth]; - break; - case 960: - if(VGAEngine == SIS_315_VGA) { - if(VDisplay == 540) ModeIndex = ModeIndex_960x540[Depth]; - else if(VDisplay == 600) ModeIndex = ModeIndex_960x600[Depth]; - } - break; - case 1024: - if(VDisplay == 768) ModeIndex = ModeIndex_1024x768[Depth]; - else if(VDisplay == 576) ModeIndex = ModeIndex_1024x576[Depth]; - break; - case 1152: - if(VDisplay == 864) ModeIndex = ModeIndex_1152x864[Depth]; - else if(VGAEngine == SIS_300_VGA) { - if(VDisplay == 768) ModeIndex = ModeIndex_1152x768[Depth]; - } - break; - case 1280: - if(VDisplay == 768) { - if(VGAEngine == SIS_300_VGA) { - ModeIndex = ModeIndex_300_1280x768[Depth]; - } else { - ModeIndex = ModeIndex_310_1280x768[Depth]; - } - } else if(VDisplay == 1024) ModeIndex = ModeIndex_1280x1024[Depth]; - else if(VDisplay == 720) ModeIndex = ModeIndex_1280x720[Depth]; - else if(VDisplay == 800) ModeIndex = ModeIndex_1280x800[Depth]; - else if(VDisplay == 960) ModeIndex = ModeIndex_1280x960[Depth]; - break; - case 1360: - if(VDisplay == 768) ModeIndex = ModeIndex_1360x768[Depth]; - break; - case 1400: - if(VGAEngine == SIS_315_VGA) { - if(VDisplay == 1050) ModeIndex = ModeIndex_1400x1050[Depth]; - } - break; case 1600: - if(VGAEngine == SIS_315_VGA) { - if(VBFlags & (VB_301B|VB_301C|VB_302B)) { - if(VDisplay == 1200) ModeIndex = ModeIndex_1600x1200[Depth]; - } + if(VDisplay == 1200) { + if(VGAEngine != SIS_315_VGA) return 0; + if(!(VBFlags2 & VB2_30xB)) return 0; } break; case 1680: - if(VGAEngine == SIS_315_VGA) { - if(VBFlags & (VB_301B|VB_301C|VB_302B)) { - if(VDisplay == 1050) ModeIndex = ModeIndex_1680x1050[Depth]; - } + if(VDisplay == 1050) { + if(VGAEngine != SIS_315_VGA) return 0; + if(!(VBFlags2 & VB2_30xB)) return 0; } break; } - return ModeIndex; + return SiS_GetModeID(VGAEngine, 0, HDisplay, VDisplay, Depth, FALSE, 0, 0); } @@ -1137,83 +882,83 @@ SiS_GetModeID_VGA2(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int /*********************************************/ void -SiS_SetReg(SISIOADDRESS port, USHORT index, USHORT data) +SiS_SetReg(SISIOADDRESS port, unsigned short index, unsigned short data) { - OutPortByte(port,index); - OutPortByte(port + 1,data); + OutPortByte(port, index); + OutPortByte(port + 1, data); } void -SiS_SetRegByte(SISIOADDRESS port, USHORT data) +SiS_SetRegByte(SISIOADDRESS port, unsigned short data) { - OutPortByte(port,data); + OutPortByte(port, data); } void -SiS_SetRegShort(SISIOADDRESS port, USHORT data) +SiS_SetRegShort(SISIOADDRESS port, unsigned short data) { - OutPortWord(port,data); + OutPortWord(port, data); } void -SiS_SetRegLong(SISIOADDRESS port, ULONG data) +SiS_SetRegLong(SISIOADDRESS port, unsigned int data) { - OutPortLong(port,data); + OutPortLong(port, data); } -UCHAR -SiS_GetReg(SISIOADDRESS port, USHORT index) +unsigned char +SiS_GetReg(SISIOADDRESS port, unsigned short index) { - OutPortByte(port,index); + OutPortByte(port, index); return(InPortByte(port + 1)); } -UCHAR +unsigned char SiS_GetRegByte(SISIOADDRESS port) { return(InPortByte(port)); } -USHORT +unsigned short SiS_GetRegShort(SISIOADDRESS port) { return(InPortWord(port)); } -ULONG +unsigned int SiS_GetRegLong(SISIOADDRESS port) { return(InPortLong(port)); } void -SiS_SetRegANDOR(SISIOADDRESS Port,USHORT Index,USHORT DataAND,USHORT DataOR) +SiS_SetRegANDOR(SISIOADDRESS Port, unsigned short Index, unsigned short DataAND, unsigned short DataOR) { - USHORT temp; + unsigned short temp; - temp = SiS_GetReg(Port,Index); - temp = (temp & (DataAND)) | DataOR; - SiS_SetReg(Port,Index,temp); + temp = SiS_GetReg(Port, Index); + temp = (temp & (DataAND)) | DataOR; + SiS_SetReg(Port, Index, temp); } void -SiS_SetRegAND(SISIOADDRESS Port,USHORT Index,USHORT DataAND) +SiS_SetRegAND(SISIOADDRESS Port, unsigned short Index, unsigned short DataAND) { - USHORT temp; + unsigned short temp; - temp = SiS_GetReg(Port,Index); - temp &= DataAND; - SiS_SetReg(Port,Index,temp); + temp = SiS_GetReg(Port, Index); + temp &= DataAND; + SiS_SetReg(Port, Index, temp); } void -SiS_SetRegOR(SISIOADDRESS Port,USHORT Index,USHORT DataOR) +SiS_SetRegOR(SISIOADDRESS Port, unsigned short Index, unsigned short DataOR) { - USHORT temp; + unsigned short temp; - temp = SiS_GetReg(Port,Index); - temp |= DataOR; - SiS_SetReg(Port,Index,temp); + temp = SiS_GetReg(Port, Index); + temp |= DataOR; + SiS_SetReg(Port, Index, temp); } /*********************************************/ @@ -1221,13 +966,13 @@ SiS_SetRegOR(SISIOADDRESS Port,USHORT Index,USHORT DataOR) /*********************************************/ void -SiS_DisplayOn(SiS_Private *SiS_Pr) +SiS_DisplayOn(struct SiS_Private *SiS_Pr) { SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x01,0xDF); } void -SiS_DisplayOff(SiS_Private *SiS_Pr) +SiS_DisplayOff(struct SiS_Private *SiS_Pr) { SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x01,0x20); } @@ -1238,7 +983,7 @@ SiS_DisplayOff(SiS_Private *SiS_Pr) /*********************************************/ void -SiSRegInit(SiS_Private *SiS_Pr, SISIOADDRESS BaseAddr) +SiSRegInit(struct SiS_Private *SiS_Pr, SISIOADDRESS BaseAddr) { SiS_Pr->SiS_P3c4 = BaseAddr + 0x14; SiS_Pr->SiS_P3d4 = BaseAddr + 0x24; @@ -1251,16 +996,17 @@ SiSRegInit(SiS_Private *SiS_Pr, SISIOADDRESS BaseAddr) SiS_Pr->SiS_P3c8 = BaseAddr + 0x18; SiS_Pr->SiS_P3c9 = BaseAddr + 0x19; SiS_Pr->SiS_P3cb = BaseAddr + 0x1b; + SiS_Pr->SiS_P3cc = BaseAddr + 0x1c; SiS_Pr->SiS_P3cd = BaseAddr + 0x1d; SiS_Pr->SiS_P3da = BaseAddr + 0x2a; - SiS_Pr->SiS_Part1Port = BaseAddr + SIS_CRT2_PORT_04; /* Digital video interface registers (LCD) */ - SiS_Pr->SiS_Part2Port = BaseAddr + SIS_CRT2_PORT_10; /* 301 TV Encoder registers */ - SiS_Pr->SiS_Part3Port = BaseAddr + SIS_CRT2_PORT_12; /* 301 Macrovision registers */ - SiS_Pr->SiS_Part4Port = BaseAddr + SIS_CRT2_PORT_14; /* 301 VGA2 (and LCD) registers */ - SiS_Pr->SiS_Part5Port = BaseAddr + SIS_CRT2_PORT_14 + 2; /* 301 palette address port registers */ - SiS_Pr->SiS_DDC_Port = BaseAddr + 0x14; /* DDC Port ( = P3C4, SR11/0A) */ - SiS_Pr->SiS_VidCapt = BaseAddr + SIS_VIDEO_CAPTURE; - SiS_Pr->SiS_VidPlay = BaseAddr + SIS_VIDEO_PLAYBACK; + SiS_Pr->SiS_Part1Port = BaseAddr + SIS_CRT2_PORT_04; + SiS_Pr->SiS_Part2Port = BaseAddr + SIS_CRT2_PORT_10; + SiS_Pr->SiS_Part3Port = BaseAddr + SIS_CRT2_PORT_12; + SiS_Pr->SiS_Part4Port = BaseAddr + SIS_CRT2_PORT_14; + SiS_Pr->SiS_Part5Port = BaseAddr + SIS_CRT2_PORT_14 + 2; + SiS_Pr->SiS_DDC_Port = BaseAddr + 0x14; + SiS_Pr->SiS_VidCapt = BaseAddr + SIS_VIDEO_CAPTURE; + SiS_Pr->SiS_VidPlay = BaseAddr + SIS_VIDEO_PLAYBACK; } /*********************************************/ @@ -1268,7 +1014,7 @@ SiSRegInit(SiS_Private *SiS_Pr, SISIOADDRESS BaseAddr) /*********************************************/ static void -SiS_GetSysFlags(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) +SiS_GetSysFlags(struct SiS_Private *SiS_Pr) { unsigned char cr5f, temp1, temp2; @@ -1276,9 +1022,9 @@ SiS_GetSysFlags(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) /* (SR11 is used for DDC and in enable/disablebridge) */ SiS_Pr->SiS_SensibleSR11 = FALSE; SiS_Pr->SiS_MyCR63 = 0x63; - if(HwInfo->jChipType >= SIS_330) { + if(SiS_Pr->ChipType >= SIS_330) { SiS_Pr->SiS_MyCR63 = 0x53; - if(HwInfo->jChipType >= SIS_661) { + if(SiS_Pr->ChipType >= SIS_661) { SiS_Pr->SiS_SensibleSR11 = TRUE; } } @@ -1286,43 +1032,52 @@ SiS_GetSysFlags(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) /* You should use the macros, not these flags directly */ SiS_Pr->SiS_SysFlags = 0; - if(HwInfo->jChipType == SIS_650) { + if(SiS_Pr->ChipType == SIS_650) { cr5f = SiS_GetReg(SiS_Pr->SiS_P3d4,0x5f) & 0xf0; SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x5c,0x07); temp1 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x5c) & 0xf8; SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x5c,0xf8); temp2 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x5c) & 0xf8; if((!temp1) || (temp2)) { - switch(cr5f) { + switch(cr5f) { case 0x80: case 0x90: case 0xc0: - SiS_Pr->SiS_SysFlags |= SF_IsM650; break; + SiS_Pr->SiS_SysFlags |= SF_IsM650; + break; case 0xa0: case 0xb0: case 0xe0: - SiS_Pr->SiS_SysFlags |= SF_Is651; break; + SiS_Pr->SiS_SysFlags |= SF_Is651; + break; } } else { - switch(cr5f) { + switch(cr5f) { case 0x90: temp1 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x5c) & 0xf8; switch(temp1) { - case 0x00: SiS_Pr->SiS_SysFlags |= SF_IsM652; break; + case 0x00: SiS_Pr->SiS_SysFlags |= SF_IsM652; break; case 0x40: SiS_Pr->SiS_SysFlags |= SF_IsM653; break; default: SiS_Pr->SiS_SysFlags |= SF_IsM650; break; } break; case 0xb0: - SiS_Pr->SiS_SysFlags |= SF_Is652; break; + SiS_Pr->SiS_SysFlags |= SF_Is652; + break; default: - SiS_Pr->SiS_SysFlags |= SF_IsM650; break; + SiS_Pr->SiS_SysFlags |= SF_IsM650; + break; } } } - if(HwInfo->jChipType == SIS_760) { - temp1 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x78); - if(temp1 & 0x30) SiS_Pr->SiS_SysFlags |= SF_760LFB; + + if(SiS_Pr->ChipType >= SIS_760 && SiS_Pr->ChipType <= SIS_761) { + if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x78) & 0x30) { + SiS_Pr->SiS_SysFlags |= SF_760LFB; + } + if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x79) & 0xf0) { + SiS_Pr->SiS_SysFlags |= SF_760UMA; + } } } @@ -1331,18 +1086,20 @@ SiS_GetSysFlags(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) /*********************************************/ static void -SiSInitPCIetc(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) +SiSInitPCIetc(struct SiS_Private *SiS_Pr) { - switch(HwInfo->jChipType) { + switch(SiS_Pr->ChipType) { +#ifdef SIS300 case SIS_300: case SIS_540: case SIS_630: case SIS_730: /* Set - PCI LINEAR ADDRESSING ENABLE (0x80) - * - RELOCATED VGA IO (0x20) - * - MMIO ENABLE (0x1) + * - RELOCATED VGA IO ENABLED (0x20) + * - MMIO ENABLED (0x01) + * Leave other bits untouched. */ - SiS_SetReg(SiS_Pr->SiS_P3c4,0x20,0xa1); + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x20,0xa1); /* - Enable 2D (0x40) * - Enable 3D (0x02) * - Enable 3D Vertex command fetch (0x10) ? @@ -1350,6 +1107,8 @@ SiSInitPCIetc(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) */ SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x5A); break; +#endif +#ifdef SIS315H case SIS_315H: case SIS_315: case SIS_315PRO: @@ -1362,21 +1121,30 @@ SiSInitPCIetc(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) case SIS_760: case SIS_761: case SIS_340: - SiS_SetReg(SiS_Pr->SiS_P3c4,0x20,0xa1); - /* - Enable 2D (0x40) - * - Enable 3D (0x02) + case XGI_40: + /* See above */ + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x20,0xa1); + /* - Enable 3D G/L transformation engine (0x80) + * - Enable 2D (0x40) * - Enable 3D vertex command fetch (0x10) * - Enable 3D command parser (0x08) - * - Enable 3D G/L transformation engine (0x80) + * - Enable 3D (0x02) */ SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0xDA); break; + case XGI_20: case SIS_550: - SiS_SetReg(SiS_Pr->SiS_P3c4,0x20,0xa1); + /* See above */ + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x20,0xa1); /* No 3D engine ! */ /* - Enable 2D (0x40) + * - disable 3D */ - SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x40); + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x1E,0x60,0x40); + break; +#endif + default: + break; } } @@ -1384,38 +1152,40 @@ SiSInitPCIetc(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) /* HELPER: SetLVDSetc */ /*********************************************/ -static void -SiSSetLVDSetc(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) +#ifdef SIS_LINUX_KERNEL +static +#endif +void +SiSSetLVDSetc(struct SiS_Private *SiS_Pr) { - USHORT temp; + unsigned short temp; SiS_Pr->SiS_IF_DEF_LVDS = 0; SiS_Pr->SiS_IF_DEF_TRUMPION = 0; SiS_Pr->SiS_IF_DEF_CH70xx = 0; - SiS_Pr->SiS_IF_DEF_DSTN = 0; - SiS_Pr->SiS_IF_DEF_FSTN = 0; SiS_Pr->SiS_IF_DEF_CONEX = 0; SiS_Pr->SiS_ChrontelInit = 0; + if(SiS_Pr->ChipType == XGI_20) return; + /* Check for SiS30x first */ temp = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x00); if((temp == 1) || (temp == 2)) return; - switch(HwInfo->jChipType) { + switch(SiS_Pr->ChipType) { #ifdef SIS300 case SIS_540: case SIS_630: case SIS_730: - temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x37); - temp = (temp & 0x0E) >> 1; - if((temp >= 2) && (temp <= 5)) SiS_Pr->SiS_IF_DEF_LVDS = 1; - if(temp == 3) SiS_Pr->SiS_IF_DEF_TRUMPION = 1; - if((temp == 4) || (temp == 5)) { + temp = (SiS_GetReg(SiS_Pr->SiS_P3d4,0x37) & 0x0e) >> 1; + if((temp >= 2) && (temp <= 5)) SiS_Pr->SiS_IF_DEF_LVDS = 1; + if(temp == 3) SiS_Pr->SiS_IF_DEF_TRUMPION = 1; + if((temp == 4) || (temp == 5)) { /* Save power status (and error check) - UNUSED */ SiS_Pr->SiS_Backup70xx = SiS_GetCH700x(SiS_Pr, 0x0e); SiS_Pr->SiS_IF_DEF_CH70xx = 1; - } + } break; #endif #ifdef SIS315H @@ -1423,26 +1193,26 @@ SiSSetLVDSetc(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) case SIS_650: case SIS_740: case SIS_330: - temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x37); - temp = (temp & 0x0E) >> 1; - if((temp >= 2) && (temp <= 3)) SiS_Pr->SiS_IF_DEF_LVDS = 1; - if(temp == 3) SiS_Pr->SiS_IF_DEF_CH70xx = 2; - break; + temp = (SiS_GetReg(SiS_Pr->SiS_P3d4,0x37) & 0x0e) >> 1; + if((temp >= 2) && (temp <= 3)) SiS_Pr->SiS_IF_DEF_LVDS = 1; + if(temp == 3) SiS_Pr->SiS_IF_DEF_CH70xx = 2; + break; case SIS_661: case SIS_741: case SIS_660: case SIS_760: case SIS_761: case SIS_340: - temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38); - temp = (temp & 0xe0) >> 5; - if((temp >= 2) && (temp <= 3)) SiS_Pr->SiS_IF_DEF_LVDS = 1; - if(temp == 3) SiS_Pr->SiS_IF_DEF_CH70xx = 2; - if(temp == 4) SiS_Pr->SiS_IF_DEF_CONEX = 1; /* Not yet supported */ - break; + case XGI_20: + case XGI_40: + temp = (SiS_GetReg(SiS_Pr->SiS_P3d4,0x38) & 0xe0) >> 5; + if((temp >= 2) && (temp <= 3)) SiS_Pr->SiS_IF_DEF_LVDS = 1; + if(temp == 3) SiS_Pr->SiS_IF_DEF_CH70xx = 2; + if(temp == 4) SiS_Pr->SiS_IF_DEF_CONEX = 1; /* Not yet supported */ + break; #endif default: - break; + break; } } @@ -1451,35 +1221,55 @@ SiSSetLVDSetc(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) /*********************************************/ void -SiS_SetEnableDstn(SiS_Private *SiS_Pr, int enable) +SiS_SetEnableDstn(struct SiS_Private *SiS_Pr, int enable) { SiS_Pr->SiS_IF_DEF_DSTN = enable ? 1 : 0; } void -SiS_SetEnableFstn(SiS_Private *SiS_Pr, int enable) +SiS_SetEnableFstn(struct SiS_Private *SiS_Pr, int enable) { SiS_Pr->SiS_IF_DEF_FSTN = enable ? 1 : 0; } +/*********************************************/ +/* HELPER: Get modeflag */ +/*********************************************/ + +unsigned short +SiS_GetModeFlag(struct SiS_Private *SiS_Pr, unsigned short ModeNo, + unsigned short ModeIdIndex) +{ + if(SiS_Pr->UseCustomMode) { + return SiS_Pr->CModeFlag; + } else if(ModeNo <= 0x13) { + return SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + } else { + return SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + } +} + /*********************************************/ /* HELPER: Determine ROM usage */ /*********************************************/ BOOLEAN -SiSDetermineROMLayout661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) +SiSDetermineROMLayout661(struct SiS_Private *SiS_Pr) { - UCHAR *ROMAddr = HwInfo->pjVirtualRomBase; - USHORT romversoffs, romvmaj = 1, romvmin = 0; - - if(HwInfo->jChipType >= SIS_761) { - /* I very much assume 761 and 340 will use new layout */ + unsigned char *ROMAddr = SiS_Pr->VirtualRomBase; + unsigned short romversoffs, romvmaj = 1, romvmin = 0; + + if(SiS_Pr->ChipType >= XGI_20) { + /* XGI ROMs don't qualify */ + return FALSE; + } else if(SiS_Pr->ChipType >= SIS_761) { + /* I very much assume 761, 340 and newer will use new layout */ return TRUE; - } else if(HwInfo->jChipType >= SIS_661) { + } else if(SiS_Pr->ChipType >= SIS_661) { if((ROMAddr[0x1a] == 'N') && - (ROMAddr[0x1b] == 'e') && - (ROMAddr[0x1c] == 'w') && - (ROMAddr[0x1d] == 'V')) { + (ROMAddr[0x1b] == 'e') && + (ROMAddr[0x1c] == 'w') && + (ROMAddr[0x1d] == 'V')) { return TRUE; } romversoffs = ROMAddr[0x16] | (ROMAddr[0x17] << 8); @@ -1494,9 +1284,9 @@ SiSDetermineROMLayout661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) } } else if(IS_SIS650740) { if((ROMAddr[0x1a] == 'N') && - (ROMAddr[0x1b] == 'e') && - (ROMAddr[0x1c] == 'w') && - (ROMAddr[0x1d] == 'V')) { + (ROMAddr[0x1b] == 'e') && + (ROMAddr[0x1c] == 'w') && + (ROMAddr[0x1d] == 'V')) { return TRUE; } } @@ -1504,45 +1294,50 @@ SiSDetermineROMLayout661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) } static void -SiSDetermineROMUsage(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) +SiSDetermineROMUsage(struct SiS_Private *SiS_Pr) { - UCHAR *ROMAddr = HwInfo->pjVirtualRomBase; - USHORT romptr = 0; + unsigned char *ROMAddr = SiS_Pr->VirtualRomBase; + unsigned short romptr = 0; SiS_Pr->SiS_UseROM = FALSE; SiS_Pr->SiS_ROMNew = FALSE; + SiS_Pr->SiS_PWDOffset = 0; - if((ROMAddr) && (HwInfo->UseROM)) { - if(HwInfo->jChipType == SIS_300) { - /* 300: We check if the code starts below 0x220 by + if(SiS_Pr->ChipType >= XGI_20) return; + + if((ROMAddr) && (SiS_Pr->UseROM)) { + if(SiS_Pr->ChipType == SIS_300) { + /* 300: We check if the code starts below 0x220 by * checking the jmp instruction at the beginning * of the BIOS image. */ if((ROMAddr[3] == 0xe9) && ((ROMAddr[5] << 8) | ROMAddr[4]) > 0x21a) SiS_Pr->SiS_UseROM = TRUE; - } else if(HwInfo->jChipType < SIS_315H) { + } else if(SiS_Pr->ChipType < SIS_315H) { /* Sony's VAIO BIOS 1.09 follows the standard, so perhaps * the others do as well */ SiS_Pr->SiS_UseROM = TRUE; } else { - /* 315/330 series stick to the standard(s) */ + /* 315/330 series stick to the standard(s) */ SiS_Pr->SiS_UseROM = TRUE; - if((SiS_Pr->SiS_ROMNew = SiSDetermineROMLayout661(SiS_Pr, HwInfo))) { + if((SiS_Pr->SiS_ROMNew = SiSDetermineROMLayout661(SiS_Pr))) { SiS_Pr->SiS_EMIOffset = 14; + SiS_Pr->SiS_PWDOffset = 17; SiS_Pr->SiS661LCD2TableSize = 36; /* Find out about LCD data table entry size */ if((romptr = SISGETROMW(0x0102))) { if(ROMAddr[romptr + (32 * 16)] == 0xff) - SiS_Pr->SiS661LCD2TableSize = 32; + SiS_Pr->SiS661LCD2TableSize = 32; else if(ROMAddr[romptr + (34 * 16)] == 0xff) - SiS_Pr->SiS661LCD2TableSize = 34; - else if(ROMAddr[romptr + (36 * 16)] == 0xff) /* 0.94 */ - SiS_Pr->SiS661LCD2TableSize = 36; + SiS_Pr->SiS661LCD2TableSize = 34; + else if(ROMAddr[romptr + (36 * 16)] == 0xff) /* 0.94, 2.05.00+ */ + SiS_Pr->SiS661LCD2TableSize = 36; else if( (ROMAddr[romptr + (38 * 16)] == 0xff) || /* 2.00.00 - 2.02.00 */ - (ROMAddr[0x6F] & 0x01) ) { /* 2.03.00+ */ - SiS_Pr->SiS661LCD2TableSize = 38; + (ROMAddr[0x6F] & 0x01) ) { /* 2.03.00 - <2.05.00 */ + SiS_Pr->SiS661LCD2TableSize = 38; /* UMC data layout abandoned at 2.05.00 */ SiS_Pr->SiS_EMIOffset = 16; + SiS_Pr->SiS_PWDOffset = 19; } } } @@ -1555,9 +1350,9 @@ SiSDetermineROMUsage(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) /*********************************************/ static void -SiS_SetSegRegLower(SiS_Private *SiS_Pr, USHORT value) +SiS_SetSegRegLower(struct SiS_Private *SiS_Pr, unsigned short value) { - USHORT temp; + unsigned short temp; value &= 0x00ff; temp = SiS_GetRegByte(SiS_Pr->SiS_P3cb) & 0xf0; @@ -1569,9 +1364,9 @@ SiS_SetSegRegLower(SiS_Private *SiS_Pr, USHORT value) } static void -SiS_SetSegRegUpper(SiS_Private *SiS_Pr, USHORT value) +SiS_SetSegRegUpper(struct SiS_Private *SiS_Pr, unsigned short value) { - USHORT temp; + unsigned short temp; value &= 0x00ff; temp = SiS_GetRegByte(SiS_Pr->SiS_P3cb) & 0x0f; @@ -1583,22 +1378,22 @@ SiS_SetSegRegUpper(SiS_Private *SiS_Pr, USHORT value) } static void -SiS_SetSegmentReg(SiS_Private *SiS_Pr, USHORT value) +SiS_SetSegmentReg(struct SiS_Private *SiS_Pr, unsigned short value) { SiS_SetSegRegLower(SiS_Pr, value); SiS_SetSegRegUpper(SiS_Pr, value); } static void -SiS_ResetSegmentReg(SiS_Private *SiS_Pr) +SiS_ResetSegmentReg(struct SiS_Private *SiS_Pr) { SiS_SetSegmentReg(SiS_Pr, 0); } static void -SiS_SetSegmentRegOver(SiS_Private *SiS_Pr, USHORT value) +SiS_SetSegmentRegOver(struct SiS_Private *SiS_Pr, unsigned short value) { - USHORT temp = value >> 8; + unsigned short temp = value >> 8; temp &= 0x07; temp |= (temp << 4); @@ -1607,15 +1402,15 @@ SiS_SetSegmentRegOver(SiS_Private *SiS_Pr, USHORT value) } static void -SiS_ResetSegmentRegOver(SiS_Private *SiS_Pr) +SiS_ResetSegmentRegOver(struct SiS_Private *SiS_Pr) { SiS_SetSegmentRegOver(SiS_Pr, 0); } static void -SiS_ResetSegmentRegisters(SiS_Private *SiS_Pr,PSIS_HW_INFO HwInfo) +SiS_ResetSegmentRegisters(struct SiS_Private *SiS_Pr) { - if((IS_SIS65x) || (HwInfo->jChipType >= SIS_661)) { + if((IS_SIS65x) || (SiS_Pr->ChipType >= SIS_661)) { SiS_ResetSegmentReg(SiS_Pr); SiS_ResetSegmentRegOver(SiS_Pr); } @@ -1625,154 +1420,153 @@ SiS_ResetSegmentRegisters(SiS_Private *SiS_Pr,PSIS_HW_INFO HwInfo) /* HELPER: GetVBType */ /*********************************************/ -static void -SiS_GetVBType(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) +#ifdef SIS_LINUX_KERNEL +static +#endif +void +SiS_GetVBType(struct SiS_Private *SiS_Pr) { - USHORT flag=0, rev=0, nolcd=0, p4_0f, p4_25, p4_27; - - SiS_Pr->SiS_VBType = 0; - - if((SiS_Pr->SiS_IF_DEF_LVDS) || (SiS_Pr->SiS_IF_DEF_CONEX)) - return; - - flag = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x00); - - if(flag > 3) return; - - rev = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x01); - - if(flag >= 2) { - SiS_Pr->SiS_VBType = VB_SIS302B; - } else if(flag == 1) { - if(rev >= 0xC0) { - SiS_Pr->SiS_VBType = VB_SIS301C; - } else if(rev >= 0xB0) { - SiS_Pr->SiS_VBType = VB_SIS301B; - /* Check if 30xB DH version (no LCD support, use Panel Link instead) */ - nolcd = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x23); - if(!(nolcd & 0x02)) SiS_Pr->SiS_VBType |= VB_NoLCD; - } else { - SiS_Pr->SiS_VBType = VB_SIS301; - } - } - if(SiS_Pr->SiS_VBType & (VB_SIS301B | VB_SIS301C | VB_SIS302B)) { - if(rev >= 0xE0) { - flag = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x39); - if(flag == 0xff) SiS_Pr->SiS_VBType = VB_SIS302LV; - else SiS_Pr->SiS_VBType = VB_SIS301C; /* VB_SIS302ELV; */ - } else if(rev >= 0xD0) { - SiS_Pr->SiS_VBType = VB_SIS301LV; - } - } - if(SiS_Pr->SiS_VBType & (VB_301C | VB_301LV | VB_302LV | VB_302ELV)) { - p4_0f = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x0f); - p4_25 = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x25); - p4_27 = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x27); - SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x0f,0x7f); - SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x25,0x08); - SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x27,0xfd); - if(SiS_GetReg(SiS_Pr->SiS_Part4Port,0x26) & 0x08) { - SiS_Pr->SiS_VBType |= VB_UMC; - } - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x27,p4_27); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x25,p4_25); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x0f,p4_0f); - } -} + unsigned short flag = 0, rev = 0, nolcd = 0; + unsigned short p4_0f, p4_25, p4_27; -/*********************************************/ -/* HELPER: Check RAM size */ -/*********************************************/ + SiS_Pr->SiS_VBType = 0; -#ifdef LINUX_KERNEL -static BOOLEAN -SiS_CheckMemorySize(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, - USHORT ModeNo, USHORT ModeIdIndex) -{ - USHORT AdapterMemSize = HwInfo->ulVideoMemorySize / (1024*1024); - USHORT memorysize,modeflag; - - if(SiS_Pr->UseCustomMode) { - modeflag = SiS_Pr->CModeFlag; - } else { - if(ModeNo <= 0x13) { - modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; - } else { - modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - } - } - - memorysize = modeflag & MemoryInfoFlag; - memorysize >>= MemorySizeShift; /* Get required memory size */ - memorysize++; - - if(AdapterMemSize < memorysize) return FALSE; - return TRUE; -} -#endif + if((SiS_Pr->SiS_IF_DEF_LVDS) || (SiS_Pr->SiS_IF_DEF_CONEX)) + return; + + if(SiS_Pr->ChipType == XGI_20) + return; + + flag = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x00); + + if(flag > 3) + return; + + rev = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x01); + + if(flag >= 2) { + SiS_Pr->SiS_VBType = VB_SIS302B; + } else if(flag == 1) { + if(rev >= 0xC0) { + SiS_Pr->SiS_VBType = VB_SIS301C; + } else if(rev >= 0xB0) { + SiS_Pr->SiS_VBType = VB_SIS301B; + /* Check if 30xB DH version (no LCD support, use Panel Link instead) */ + nolcd = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x23); + if(!(nolcd & 0x02)) SiS_Pr->SiS_VBType |= VB_NoLCD; + } else { + SiS_Pr->SiS_VBType = VB_SIS301; + } + } + if(SiS_Pr->SiS_VBType & (VB_SIS301B | VB_SIS301C | VB_SIS302B)) { + if(rev >= 0xE0) { + flag = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x39); + if(flag == 0xff) SiS_Pr->SiS_VBType = VB_SIS302LV; + else SiS_Pr->SiS_VBType = VB_SIS301C; /* VB_SIS302ELV; */ + } else if(rev >= 0xD0) { + SiS_Pr->SiS_VBType = VB_SIS301LV; + } + } + if(SiS_Pr->SiS_VBType & (VB_SIS301C | VB_SIS301LV | VB_SIS302LV | VB_SIS302ELV)) { + p4_0f = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x0f); + p4_25 = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x25); + p4_27 = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x27); + SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x0f,0x7f); + SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x25,0x08); + SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x27,0xfd); + if(SiS_GetReg(SiS_Pr->SiS_Part4Port,0x26) & 0x08) { + SiS_Pr->SiS_VBType |= VB_UMC; + } + SiS_SetReg(SiS_Pr->SiS_Part4Port,0x27,p4_27); + SiS_SetReg(SiS_Pr->SiS_Part4Port,0x25,p4_25); + SiS_SetReg(SiS_Pr->SiS_Part4Port,0x0f,p4_0f); + } +} + +/*********************************************/ +/* HELPER: Check RAM size */ +/*********************************************/ + +#ifdef SIS_LINUX_KERNEL +static BOOLEAN +SiS_CheckMemorySize(struct SiS_Private *SiS_Pr, unsigned short ModeNo, + unsigned short ModeIdIndex) +{ + unsigned short AdapterMemSize = SiS_Pr->VideoMemorySize / (1024*1024); + unsigned short modeflag = SiS_GetModeFlag(SiS_Pr, ModeNo, ModeIdIndex); + unsigned short memorysize = ((modeflag & MemoryInfoFlag) >> MemorySizeShift) + 1; + + if(!AdapterMemSize) return TRUE; + + if(AdapterMemSize < memorysize) return FALSE; + return TRUE; +} +#endif /*********************************************/ /* HELPER: Get DRAM type */ /*********************************************/ #ifdef SIS315H -static UCHAR -SiS_Get310DRAMType(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) +static unsigned char +SiS_Get310DRAMType(struct SiS_Private *SiS_Pr) { - UCHAR data, temp; + unsigned char data; if((*SiS_Pr->pSiS_SoftSetting) & SoftDRAMType) { - data = (*SiS_Pr->pSiS_SoftSetting) & 0x03; + data = (*SiS_Pr->pSiS_SoftSetting) & 0x03; } else { - if(HwInfo->jChipType >= SIS_340) { - /* TODO */ - data = 0; - } if(HwInfo->jChipType >= SIS_661) { - data = SiS_GetReg(SiS_Pr->SiS_P3d4,0x78) & 0x07; - if(SiS_Pr->SiS_ROMNew) { - data = ((SiS_GetReg(SiS_Pr->SiS_P3d4,0x78) & 0xc0) >> 6); - } - } else if(IS_SIS550650740) { - data = SiS_GetReg(SiS_Pr->SiS_P3c4,0x13) & 0x07; - } else { /* 315, 330 */ - data = SiS_GetReg(SiS_Pr->SiS_P3c4,0x3a) & 0x03; - if(HwInfo->jChipType == SIS_330) { - if(data > 1) { - temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x5f) & 0x30; - switch(temp) { - case 0x00: data = 1; break; - case 0x10: data = 3; break; - case 0x20: data = 3; break; - case 0x30: data = 2; break; - } - } else { - data = 0; - } - } - } + if(SiS_Pr->ChipType >= XGI_20) { + /* Do I need this? SR17 seems to be zero anyway... */ + data = 0; + } else if(SiS_Pr->ChipType >= SIS_340) { + /* TODO */ + data = 0; + } if(SiS_Pr->ChipType >= SIS_661) { + if(SiS_Pr->SiS_ROMNew) { + data = ((SiS_GetReg(SiS_Pr->SiS_P3d4,0x78) & 0xc0) >> 6); + } else { + data = SiS_GetReg(SiS_Pr->SiS_P3d4,0x78) & 0x07; + } + } else if(IS_SIS550650740) { + data = SiS_GetReg(SiS_Pr->SiS_P3c4,0x13) & 0x07; + } else { /* 315, 330 */ + data = SiS_GetReg(SiS_Pr->SiS_P3c4,0x3a) & 0x03; + if(SiS_Pr->ChipType == SIS_330) { + if(data > 1) { + switch(SiS_GetReg(SiS_Pr->SiS_P3d4,0x5f) & 0x30) { + case 0x00: data = 1; break; + case 0x10: data = 3; break; + case 0x20: data = 3; break; + case 0x30: data = 2; break; + } + } else { + data = 0; + } + } + } } return data; } -static USHORT -SiS_GetMCLK(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) +static unsigned short +SiS_GetMCLK(struct SiS_Private *SiS_Pr) { - UCHAR *ROMAddr = HwInfo->pjVirtualRomBase; - USHORT index; - - index = SiS_Get310DRAMType(SiS_Pr, HwInfo); - if(HwInfo->jChipType >= SIS_661) { - if(SiS_Pr->SiS_ROMNew) { - return((USHORT)(SISGETROMW((0x90 + (index * 5) + 3)))); - } - return(SiS_Pr->SiS_MCLKData_0[index].CLOCK); - } else if(index >= 4) { - index -= 4; - return(SiS_Pr->SiS_MCLKData_1[index].CLOCK); - } else { - return(SiS_Pr->SiS_MCLKData_0[index].CLOCK); - } + unsigned char *ROMAddr = SiS_Pr->VirtualRomBase; + unsigned short index; + + index = SiS_Get310DRAMType(SiS_Pr); + if(SiS_Pr->ChipType >= SIS_661) { + if(SiS_Pr->SiS_ROMNew) { + return((unsigned short)(SISGETROMW((0x90 + (index * 5) + 3)))); + } + return(SiS_Pr->SiS_MCLKData_0[index].CLOCK); + } else if(index >= 4) { + return(SiS_Pr->SiS_MCLKData_1[index - 4].CLOCK); + } else { + return(SiS_Pr->SiS_MCLKData_0[index].CLOCK); + } } #endif @@ -1780,30 +1574,30 @@ SiS_GetMCLK(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) /* HELPER: ClearBuffer */ /*********************************************/ -#ifdef LINUX_KERNEL +#ifdef SIS_LINUX_KERNEL static void -SiS_ClearBuffer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo) +SiS_ClearBuffer(struct SiS_Private *SiS_Pr, unsigned short ModeNo) { - UCHAR SISIOMEMTYPE *VideoMemoryAddress = HwInfo->pjVideoMemoryAddress; - ULONG AdapterMemorySize = HwInfo->ulVideoMemorySize; - USHORT SISIOMEMTYPE *pBuffer; - int i; - - if(SiS_Pr->SiS_ModeType >= ModeEGA) { - if(ModeNo > 0x13) { - SiS_SetMemory(VideoMemoryAddress, AdapterMemorySize, 0); - } else { - pBuffer = (USHORT SISIOMEMTYPE *)VideoMemoryAddress; - for(i=0; i<0x4000; i++) writew(0x0000, &pBuffer[i]); - } - } else { - if(SiS_Pr->SiS_ModeType < ModeCGA) { - pBuffer = (USHORT SISIOMEMTYPE *)VideoMemoryAddress; - for(i=0; i<0x4000; i++) writew(0x0720, &pBuffer[i]); - } else { - SiS_SetMemory(VideoMemoryAddress, 0x8000, 0); - } - } + unsigned char SISIOMEMTYPE *memaddr = SiS_Pr->VideoMemoryAddress; + unsigned int memsize = SiS_Pr->VideoMemorySize; + unsigned short SISIOMEMTYPE *pBuffer; + int i; + + if(!memaddr || !memsize) return; + + if(SiS_Pr->SiS_ModeType >= ModeEGA) { + if(ModeNo > 0x13) { + SiS_SetMemory(memaddr, memsize, 0); + } else { + pBuffer = (unsigned short SISIOMEMTYPE *)memaddr; + for(i = 0; i < 0x4000; i++) writew(0x0000, &pBuffer[i]); + } + } else if(SiS_Pr->SiS_ModeType < ModeCGA) { + pBuffer = (unsigned short SISIOMEMTYPE *)memaddr; + for(i = 0; i < 0x4000; i++) writew(0x0720, &pBuffer[i]); + } else { + SiS_SetMemory(memaddr, 0x8000, 0); + } } #endif @@ -1812,35 +1606,36 @@ SiS_ClearBuffer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo) /*********************************************/ BOOLEAN -SiS_SearchModeID(SiS_Private *SiS_Pr, USHORT *ModeNo, USHORT *ModeIdIndex) +SiS_SearchModeID(struct SiS_Private *SiS_Pr, unsigned short *ModeNo, + unsigned short *ModeIdIndex) { - UCHAR VGAINFO = SiS_Pr->SiS_VGAINFO; + unsigned char VGAINFO = SiS_Pr->SiS_VGAINFO; - if(*ModeNo <= 0x13) { + if((*ModeNo) <= 0x13) { if((*ModeNo) <= 0x05) (*ModeNo) |= 0x01; - for(*ModeIdIndex = 0; ;(*ModeIdIndex)++) { - if(SiS_Pr->SiS_SModeIDTable[*ModeIdIndex].St_ModeID == (*ModeNo)) break; - if(SiS_Pr->SiS_SModeIDTable[*ModeIdIndex].St_ModeID == 0xFF) return FALSE; + for((*ModeIdIndex) = 0; ;(*ModeIdIndex)++) { + if(SiS_Pr->SiS_SModeIDTable[(*ModeIdIndex)].St_ModeID == (*ModeNo)) break; + if(SiS_Pr->SiS_SModeIDTable[(*ModeIdIndex)].St_ModeID == 0xFF) return FALSE; } - if(*ModeNo == 0x07) { - if(VGAINFO & 0x10) (*ModeIdIndex)++; /* 400 lines */ - /* else 350 lines */ + if((*ModeNo) == 0x07) { + if(VGAINFO & 0x10) (*ModeIdIndex)++; /* 400 lines */ + /* else 350 lines */ } - if(*ModeNo <= 0x03) { - if(!(VGAINFO & 0x80)) (*ModeIdIndex)++; - if(VGAINFO & 0x10) (*ModeIdIndex)++; /* 400 lines */ - /* else 350 lines */ + if((*ModeNo) <= 0x03) { + if(!(VGAINFO & 0x80)) (*ModeIdIndex)++; + if(VGAINFO & 0x10) (*ModeIdIndex)++; /* 400 lines */ + /* else 350 lines */ } /* else 200 lines */ } else { - for(*ModeIdIndex = 0; ;(*ModeIdIndex)++) { - if(SiS_Pr->SiS_EModeIDTable[*ModeIdIndex].Ext_ModeID == (*ModeNo)) break; - if(SiS_Pr->SiS_EModeIDTable[*ModeIdIndex].Ext_ModeID == 0xFF) return FALSE; + for((*ModeIdIndex) = 0; ;(*ModeIdIndex)++) { + if(SiS_Pr->SiS_EModeIDTable[(*ModeIdIndex)].Ext_ModeID == (*ModeNo)) break; + if(SiS_Pr->SiS_EModeIDTable[(*ModeIdIndex)].Ext_ModeID == 0xFF) return FALSE; } } @@ -1851,10 +1646,10 @@ SiS_SearchModeID(SiS_Private *SiS_Pr, USHORT *ModeNo, USHORT *ModeIdIndex) /* HELPER: GetModePtr */ /*********************************************/ -UCHAR -SiS_GetModePtr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex) +unsigned short +SiS_GetModePtr(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short ModeIdIndex) { - UCHAR index; + unsigned short index; if(ModeNo <= 0x13) { index = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_StTableIndex; @@ -1865,80 +1660,126 @@ SiS_GetModePtr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex) return index; } +/*********************************************/ +/* HELPERS: Get some indices */ +/*********************************************/ + +unsigned short +SiS_GetRefCRTVCLK(struct SiS_Private *SiS_Pr, unsigned short Index, int UseWide) +{ + if(SiS_Pr->SiS_RefIndex[Index].Ext_InfoFlag & HaveWideTiming) { + if(UseWide == 1) { + return SiS_Pr->SiS_RefIndex[Index].Ext_CRTVCLK_WIDE; + } else { + return SiS_Pr->SiS_RefIndex[Index].Ext_CRTVCLK_NORM; + } + } else { + return SiS_Pr->SiS_RefIndex[Index].Ext_CRTVCLK; + } +} + +unsigned short +SiS_GetRefCRT1CRTC(struct SiS_Private *SiS_Pr, unsigned short Index, int UseWide) +{ + if(SiS_Pr->SiS_RefIndex[Index].Ext_InfoFlag & HaveWideTiming) { + if(UseWide == 1) { + return SiS_Pr->SiS_RefIndex[Index].Ext_CRT1CRTC_WIDE; + } else { + return SiS_Pr->SiS_RefIndex[Index].Ext_CRT1CRTC_NORM; + } + } else { + return SiS_Pr->SiS_RefIndex[Index].Ext_CRT1CRTC; + } +} + /*********************************************/ /* HELPER: LowModeTests */ /*********************************************/ static BOOLEAN -SiS_DoLowModeTest(SiS_Private *SiS_Pr, USHORT ModeNo, PSIS_HW_INFO HwInfo) +SiS_DoLowModeTest(struct SiS_Private *SiS_Pr, unsigned short ModeNo) { - USHORT temp,temp1,temp2; - - if((ModeNo != 0x03) && (ModeNo != 0x10) && (ModeNo != 0x12)) - return(TRUE); - temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x11); - SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x11,0x80); - temp1 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x00); - SiS_SetReg(SiS_Pr->SiS_P3d4,0x00,0x55); - temp2 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x00); - SiS_SetReg(SiS_Pr->SiS_P3d4,0x00,temp1); - SiS_SetReg(SiS_Pr->SiS_P3d4,0x11,temp); - if((HwInfo->jChipType >= SIS_315H) || - (HwInfo->jChipType == SIS_300)) { - if(temp2 == 0x55) return(FALSE); - else return(TRUE); - } else { - if(temp2 != 0x55) return(TRUE); - else { - SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x35,0x01); - return(FALSE); - } - } + unsigned short temp, temp1, temp2; + + if((ModeNo != 0x03) && (ModeNo != 0x10) && (ModeNo != 0x12)) + return TRUE; + temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x11); + SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x11,0x80); + temp1 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x00); + SiS_SetReg(SiS_Pr->SiS_P3d4,0x00,0x55); + temp2 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x00); + SiS_SetReg(SiS_Pr->SiS_P3d4,0x00,temp1); + SiS_SetReg(SiS_Pr->SiS_P3d4,0x11,temp); + if((SiS_Pr->ChipType >= SIS_315H) || + (SiS_Pr->ChipType == SIS_300)) { + if(temp2 == 0x55) return FALSE; + else return TRUE; + } else { + if(temp2 != 0x55) return TRUE; + else { + SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x35,0x01); + return FALSE; + } + } } static void -SiS_SetLowModeTest(SiS_Private *SiS_Pr, USHORT ModeNo, PSIS_HW_INFO HwInfo) +SiS_SetLowModeTest(struct SiS_Private *SiS_Pr, unsigned short ModeNo) { - if(SiS_DoLowModeTest(SiS_Pr, ModeNo, HwInfo)) { - SiS_Pr->SiS_SetFlag |= LowModeTests; - } + if(SiS_DoLowModeTest(SiS_Pr, ModeNo)) { + SiS_Pr->SiS_SetFlag |= LowModeTests; + } } /*********************************************/ -/* HELPER: ENABLE CRT1 */ +/* HELPER: OPEN/CLOSE CRT1 CRTC */ /*********************************************/ static void -SiS_SetupCR5x(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) +SiS_OpenCRTC(struct SiS_Private *SiS_Pr) +{ + if(IS_SIS650) { + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x51,0x1f); + if(IS_SIS651) SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x51,0x20); + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x56,0xe7); + } else if(IS_SIS661741660760) { + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x61,0xf7); + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x51,0x1f); + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x56,0xe7); + if(!SiS_Pr->SiS_ROMNew) { + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x3a,0xef); + } + } +} + +static void +SiS_CloseCRTC(struct SiS_Private *SiS_Pr) { - if(IS_SIS650) { - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x51,0x1f); - if(IS_SIS651) SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x51,0x20); - SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x56,0xe7); - } - } else if(IS_SIS661741660760) { - SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x61,0xf7); - SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x51,0x1f); - SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x56,0xe7); - if(!SiS_Pr->SiS_ROMNew) { - SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x3a,0xef); - } - } +#if 0 /* This locks some CRTC registers. We don't want that. */ + unsigned short temp1 = 0, temp2 = 0; + + if(IS_SIS661741660760) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { + temp1 = 0xa0; temp2 = 0x08; + } + SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x51,0x1f,temp1); + SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x56,0xe7,temp2); + } +#endif } static void -SiS_HandleCRT1(SiS_Private *SiS_Pr) +SiS_HandleCRT1(struct SiS_Private *SiS_Pr) { - /* Enable CRT1 gating */ - SiS_SetRegAND(SiS_Pr->SiS_P3d4,SiS_Pr->SiS_MyCR63,0xbf); + /* Enable CRT1 gating */ + SiS_SetRegAND(SiS_Pr->SiS_P3d4,SiS_Pr->SiS_MyCR63,0xbf); #if 0 - if(!(SiS_GetReg(SiS_Pr->SiS_P3c4,0x15) & 0x01)) { - if((SiS_GetReg(SiS_Pr->SiS_P3c4,0x15) & 0x0a) || - (SiS_GetReg(SiS_Pr->SiS_P3c4,0x16) & 0x01)) { - SiS_SetRegOR(SiS_Pr->SiS_P3d4,SiS_Pr->SiS_MyCR63,0x40); - } - } + if(!(SiS_GetReg(SiS_Pr->SiS_P3c4,0x15) & 0x01)) { + if((SiS_GetReg(SiS_Pr->SiS_P3c4,0x15) & 0x0a) || + (SiS_GetReg(SiS_Pr->SiS_P3c4,0x16) & 0x01)) { + SiS_SetRegOR(SiS_Pr->SiS_P3d4,SiS_Pr->SiS_MyCR63,0x40); + } + } #endif } @@ -1946,57 +1787,54 @@ SiS_HandleCRT1(SiS_Private *SiS_Pr) /* HELPER: GetColorDepth */ /*********************************************/ -USHORT -SiS_GetColorDepth(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex) +unsigned short +SiS_GetColorDepth(struct SiS_Private *SiS_Pr, unsigned short ModeNo, + unsigned short ModeIdIndex) { - USHORT ColorDepth[6] = { 1, 2, 4, 4, 6, 8}; - SHORT index; - USHORT modeflag; - - /* Do NOT check UseCustomMode, will skrew up FIFO */ - if(ModeNo == 0xfe) { - modeflag = SiS_Pr->CModeFlag; - } else { - if(ModeNo <= 0x13) - modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; - else - modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - } - - index = (modeflag & ModeTypeMask) - ModeEGA; - if(index < 0) index = 0; - return(ColorDepth[index]); + static const unsigned short ColorDepth[6] = { 1, 2, 4, 4, 6, 8 }; + unsigned short modeflag; + short index; + + /* Do NOT check UseCustomMode, will skrew up FIFO */ + if(ModeNo == 0xfe) { + modeflag = SiS_Pr->CModeFlag; + } else if(ModeNo <= 0x13) { + modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + } else { + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + } + + index = (modeflag & ModeTypeMask) - ModeEGA; + if(index < 0) index = 0; + return ColorDepth[index]; } /*********************************************/ /* HELPER: GetOffset */ /*********************************************/ -USHORT -SiS_GetOffset(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, - USHORT RefreshRateTableIndex,PSIS_HW_INFO HwInfo) +unsigned short +SiS_GetOffset(struct SiS_Private *SiS_Pr, unsigned short ModeNo, + unsigned short ModeIdIndex, unsigned short RRTI) { - USHORT xres, temp, colordepth, infoflag; - - if(SiS_Pr->UseCustomMode) { - infoflag = SiS_Pr->CInfoFlag; - xres = SiS_Pr->CHDisplay; - } else { - infoflag = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag; - xres = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].XRes; - } - - colordepth = SiS_GetColorDepth(SiS_Pr,ModeNo,ModeIdIndex); - - temp = xres / 16; - if(infoflag & InterlaceMode) temp <<= 1; - temp *= colordepth; - if(xres % 16) { - colordepth >>= 1; - temp += colordepth; - } - - return(temp); + unsigned short xres, temp, colordepth, infoflag; + + if(SiS_Pr->UseCustomMode) { + infoflag = SiS_Pr->CInfoFlag; + xres = SiS_Pr->CHDisplay; + } else { + infoflag = SiS_Pr->SiS_RefIndex[RRTI].Ext_InfoFlag; + xres = SiS_Pr->SiS_RefIndex[RRTI].XRes; + } + + colordepth = SiS_GetColorDepth(SiS_Pr, ModeNo, ModeIdIndex); + + temp = xres / 16; + if(infoflag & InterlaceMode) temp <<= 1; + temp *= colordepth; + if(xres % 16) temp += (colordepth >> 1); + + return temp; } /*********************************************/ @@ -2004,55 +1842,29 @@ SiS_GetOffset(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, /*********************************************/ static void -SiS_SetSeqRegs(SiS_Private *SiS_Pr, USHORT StandTableIndex, PSIS_HW_INFO HwInfo) +SiS_SetSeqRegs(struct SiS_Private *SiS_Pr, unsigned short StandTableIndex) { - UCHAR SRdata; - USHORT i; + unsigned char SRdata; + int i; - SiS_SetReg(SiS_Pr->SiS_P3c4,0x00,0x03); /* Set SR0 */ + SiS_SetReg(SiS_Pr->SiS_P3c4,0x00,0x03); - SRdata = SiS_Pr->SiS_StandTable[StandTableIndex].SR[0]; + /* or "display off" */ + SRdata = SiS_Pr->SiS_StandTable[StandTableIndex].SR[0] | 0x20; - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { - SRdata |= 0x01; - } - if(HwInfo->jChipType >= SIS_661) { - if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToTV)) { - if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { - SRdata |= 0x01; /* 8 dot clock */ - } - } - } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { - if(SiS_Pr->SiS_VBType & VB_NoLCD) { - if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { - SRdata |= 0x01; /* 8 dot clock */ - } - } - } - } + /* determine whether to force x8 dotclock */ + if((SiS_Pr->SiS_VBType & VB_SISVB) || (SiS_Pr->SiS_IF_DEF_LVDS)) { - if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { - if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { - if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { - if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { - SRdata |= 0x01; /* 8 dot clock */ - } - } - } - if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { - if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { - SRdata |= 0x01; /* 8 dot clock */ - } - } - } + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToTV)) { + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) SRdata |= 0x01; + } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) SRdata |= 0x01; - SRdata |= 0x20; /* screen off */ + } SiS_SetReg(SiS_Pr->SiS_P3c4,0x01,SRdata); for(i = 2; i <= 4; i++) { - SRdata = SiS_Pr->SiS_StandTable[StandTableIndex].SR[i-1]; + SRdata = SiS_Pr->SiS_StandTable[StandTableIndex].SR[i - 1]; SiS_SetReg(SiS_Pr->SiS_P3c4,i,SRdata); } } @@ -2062,17 +1874,17 @@ SiS_SetSeqRegs(SiS_Private *SiS_Pr, USHORT StandTableIndex, PSIS_HW_INFO HwInfo) /*********************************************/ static void -SiS_SetMiscRegs(SiS_Private *SiS_Pr, USHORT StandTableIndex, PSIS_HW_INFO HwInfo) +SiS_SetMiscRegs(struct SiS_Private *SiS_Pr, unsigned short StandTableIndex) { - UCHAR Miscdata; + unsigned char Miscdata; Miscdata = SiS_Pr->SiS_StandTable[StandTableIndex].MISC; - if(HwInfo->jChipType < SIS_661) { - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { - Miscdata |= 0x0C; - } + if(SiS_Pr->ChipType < SIS_661) { + if(SiS_Pr->SiS_VBType & VB_SIS30xBLV) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { + Miscdata |= 0x0C; + } } } @@ -2084,33 +1896,34 @@ SiS_SetMiscRegs(SiS_Private *SiS_Pr, USHORT StandTableIndex, PSIS_HW_INFO HwInfo /*********************************************/ static void -SiS_SetCRTCRegs(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, - USHORT StandTableIndex) +SiS_SetCRTCRegs(struct SiS_Private *SiS_Pr, unsigned short StandTableIndex) { - UCHAR CRTCdata; - USHORT i; - - SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x11,0x7f); /* Unlock CRTC */ - - for(i = 0; i <= 0x18; i++) { - CRTCdata = SiS_Pr->SiS_StandTable[StandTableIndex].CRTC[i]; - SiS_SetReg(SiS_Pr->SiS_P3d4,i,CRTCdata); /* Set CRTC(3d4) */ - } - if(HwInfo->jChipType >= SIS_661) { - SiS_SetupCR5x(SiS_Pr, HwInfo); - for(i = 0x13; i <= 0x14; i++) { - CRTCdata = SiS_Pr->SiS_StandTable[StandTableIndex].CRTC[i]; - SiS_SetReg(SiS_Pr->SiS_P3d4,i,CRTCdata); - } - } else if( ( (HwInfo->jChipType == SIS_630) || - (HwInfo->jChipType == SIS_730) ) && - (HwInfo->jChipRevision >= 0x30) ) { /* for 630S0 */ - if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { - if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToTV)) { - SiS_SetReg(SiS_Pr->SiS_P3d4,0x18,0xFE); - } - } - } + unsigned char CRTCdata; + unsigned short i; + + /* Unlock CRTC */ + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x11,0x7f); + + for(i = 0; i <= 0x18; i++) { + CRTCdata = SiS_Pr->SiS_StandTable[StandTableIndex].CRTC[i]; + SiS_SetReg(SiS_Pr->SiS_P3d4,i,CRTCdata); + } + + if(SiS_Pr->ChipType >= SIS_661) { + SiS_OpenCRTC(SiS_Pr); + for(i = 0x13; i <= 0x14; i++) { + CRTCdata = SiS_Pr->SiS_StandTable[StandTableIndex].CRTC[i]; + SiS_SetReg(SiS_Pr->SiS_P3d4,i,CRTCdata); + } + } else if( ( (SiS_Pr->ChipType == SIS_630) || + (SiS_Pr->ChipType == SIS_730) ) && + (SiS_Pr->ChipRevision >= 0x30) ) { + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToTV)) { + SiS_SetReg(SiS_Pr->SiS_P3d4,0x18,0xFE); + } + } + } } /*********************************************/ @@ -2118,64 +1931,58 @@ SiS_SetCRTCRegs(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, /*********************************************/ static void -SiS_SetATTRegs(SiS_Private *SiS_Pr, USHORT StandTableIndex, - PSIS_HW_INFO HwInfo) +SiS_SetATTRegs(struct SiS_Private *SiS_Pr, unsigned short StandTableIndex) { - UCHAR ARdata; - USHORT i; + unsigned char ARdata; + unsigned short i; for(i = 0; i <= 0x13; i++) { ARdata = SiS_Pr->SiS_StandTable[StandTableIndex].ATTR[i]; -#if 0 - if((i <= 0x0f) || (i == 0x11)) { - if(ds:489 & 0x08) { - continue; - } - } -#endif + if(i == 0x13) { - /* Pixel shift. If screen on LCD or TV is shifted left or right, - * this might be the cause. - */ - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) ARdata=0; - } - if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { - if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { - if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { - if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) ARdata=0; - } - } - } - if(HwInfo->jChipType >= SIS_661) { + /* Pixel shift. If screen on LCD or TV is shifted left or right, + * this might be the cause. + */ + if(SiS_Pr->SiS_VBType & VB_SIS30xBLV) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) ARdata = 0; + } + if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { + if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) ARdata = 0; + } + } + } + if(SiS_Pr->ChipType >= SIS_661) { if(SiS_Pr->SiS_VBInfo & (SetCRT2ToTV | SetCRT2ToLCD)) { - if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) ARdata=0; + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) ARdata = 0; } } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { - if(HwInfo->jChipType >= SIS_315H) { + if(SiS_Pr->ChipType >= SIS_315H) { if(IS_SIS550650740660) { - /* 315, 330 don't do this */ - if(SiS_Pr->SiS_VBType & VB_SIS301B302B) { - if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) ARdata=0; - } else { - ARdata = 0; - } + /* 315, 330 don't do this */ + if(SiS_Pr->SiS_VBType & VB_SIS30xB) { + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) ARdata = 0; + } else { + ARdata = 0; + } } } else { - if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) ARdata=0; + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) ARdata = 0; } - } + } } - SiS_GetRegByte(SiS_Pr->SiS_P3da); /* reset 3da */ - SiS_SetRegByte(SiS_Pr->SiS_P3c0,i); /* set index */ - SiS_SetRegByte(SiS_Pr->SiS_P3c0,ARdata); /* set data */ + SiS_GetRegByte(SiS_Pr->SiS_P3da); /* reset 3da */ + SiS_SetRegByte(SiS_Pr->SiS_P3c0,i); /* set index */ + SiS_SetRegByte(SiS_Pr->SiS_P3c0,ARdata); /* set data */ } - SiS_GetRegByte(SiS_Pr->SiS_P3da); /* reset 3da */ - SiS_SetRegByte(SiS_Pr->SiS_P3c0,0x14); /* set index */ - SiS_SetRegByte(SiS_Pr->SiS_P3c0,0x00); /* set data */ + + SiS_GetRegByte(SiS_Pr->SiS_P3da); /* reset 3da */ + SiS_SetRegByte(SiS_Pr->SiS_P3c0,0x14); /* set index */ + SiS_SetRegByte(SiS_Pr->SiS_P3c0,0x00); /* set data */ SiS_GetRegByte(SiS_Pr->SiS_P3da); - SiS_SetRegByte(SiS_Pr->SiS_P3c0,0x20); /* Enable Attribute */ + SiS_SetRegByte(SiS_Pr->SiS_P3c0,0x20); /* Enable Attribute */ SiS_GetRegByte(SiS_Pr->SiS_P3da); } @@ -2184,10 +1991,10 @@ SiS_SetATTRegs(SiS_Private *SiS_Pr, USHORT StandTableIndex, /*********************************************/ static void -SiS_SetGRCRegs(SiS_Private *SiS_Pr, USHORT StandTableIndex) +SiS_SetGRCRegs(struct SiS_Private *SiS_Pr, unsigned short StandTableIndex) { - UCHAR GRdata; - USHORT i; + unsigned char GRdata; + unsigned short i; for(i = 0; i <= 0x08; i++) { GRdata = SiS_Pr->SiS_StandTable[StandTableIndex].GRC[i]; @@ -2205,22 +2012,22 @@ SiS_SetGRCRegs(SiS_Private *SiS_Pr, USHORT StandTableIndex) /*********************************************/ static void -SiS_ClearExt1Regs(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo) +SiS_ClearExt1Regs(struct SiS_Private *SiS_Pr, unsigned short ModeNo) { - USHORT i; + unsigned short i; - for(i = 0x0A; i <= 0x0E; i++) { - SiS_SetReg(SiS_Pr->SiS_P3c4,i,0x00); - } + for(i = 0x0A; i <= 0x0E; i++) { + SiS_SetReg(SiS_Pr->SiS_P3c4,i,0x00); + } - if(HwInfo->jChipType >= SIS_315H) { - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x37,0xFE); - if(ModeNo <= 0x13) { - if(ModeNo == 0x06 || ModeNo >= 0x0e) { - SiS_SetReg(SiS_Pr->SiS_P3c4,0x0e,0x20); - } - } - } + if(SiS_Pr->ChipType >= SIS_315H) { + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x37,0xFE); + if(ModeNo <= 0x13) { + if(ModeNo == 0x06 || ModeNo >= 0x0e) { + SiS_SetReg(SiS_Pr->SiS_P3c4,0x0e,0x20); + } + } + } } /*********************************************/ @@ -2228,32 +2035,24 @@ SiS_ClearExt1Regs(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo) /*********************************************/ static void -SiS_ResetCRT1VCLK(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) +SiS_ResetCRT1VCLK(struct SiS_Private *SiS_Pr) { - if(HwInfo->jChipType >= SIS_315H) { - if(HwInfo->jChipType < SIS_661) { - if(SiS_Pr->SiS_IF_DEF_LVDS == 0) return; + if(SiS_Pr->ChipType >= SIS_315H) { + if(SiS_Pr->ChipType < SIS_661) { + if(SiS_Pr->SiS_IF_DEF_LVDS == 0) return; } } else { if((SiS_Pr->SiS_IF_DEF_LVDS == 0) && - (!(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) ) { + (!(SiS_Pr->SiS_VBType & VB_SIS30xBLV)) ) { return; } } - if(HwInfo->jChipType >= SIS_315H) { - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x31,0xCF,0x20); - } else { - SiS_SetReg(SiS_Pr->SiS_P3c4,0x31,0x20); - } + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x31,0xcf,0x20); SiS_SetReg(SiS_Pr->SiS_P3c4,0x2B,SiS_Pr->SiS_VCLKData[1].SR2B); SiS_SetReg(SiS_Pr->SiS_P3c4,0x2C,SiS_Pr->SiS_VCLKData[1].SR2C); SiS_SetReg(SiS_Pr->SiS_P3c4,0x2D,0x80); - if(HwInfo->jChipType >= SIS_315H) { - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x31,0xcf,0x10); - } else { - SiS_SetReg(SiS_Pr->SiS_P3c4,0x31,0x10); - } + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x31,0xcf,0x10); SiS_SetReg(SiS_Pr->SiS_P3c4,0x2B,SiS_Pr->SiS_VCLKData[0].SR2B); SiS_SetReg(SiS_Pr->SiS_P3c4,0x2C,SiS_Pr->SiS_VCLKData[0].SR2C); SiS_SetReg(SiS_Pr->SiS_P3c4,0x2D,0x80); @@ -2264,19 +2063,19 @@ SiS_ResetCRT1VCLK(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) /*********************************************/ static void -SiS_SetCRT1Sync(SiS_Private *SiS_Pr, USHORT RefreshRateTableIndex) +SiS_SetCRT1Sync(struct SiS_Private *SiS_Pr, unsigned short RRTI) { - USHORT sync; + unsigned short sync; - if(SiS_Pr->UseCustomMode) { - sync = SiS_Pr->CInfoFlag >> 8; - } else { - sync = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag >> 8; - } + if(SiS_Pr->UseCustomMode) { + sync = SiS_Pr->CInfoFlag >> 8; + } else { + sync = SiS_Pr->SiS_RefIndex[RRTI].Ext_InfoFlag >> 8; + } - sync &= 0xC0; - sync |= 0x2f; - SiS_SetRegByte(SiS_Pr->SiS_P3c2,sync); + sync &= 0xC0; + sync |= 0x2f; + SiS_SetRegByte(SiS_Pr->SiS_P3c2,sync); } /*********************************************/ @@ -2284,72 +2083,67 @@ SiS_SetCRT1Sync(SiS_Private *SiS_Pr, USHORT RefreshRateTableIndex) /*********************************************/ static void -SiS_SetCRT1CRTC(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex, - PSIS_HW_INFO HwInfo) +SiS_SetCRT1CRTC(struct SiS_Private *SiS_Pr, unsigned short ModeNo, + unsigned short ModeIdIndex, unsigned short RRTI) { - UCHAR index; - USHORT temp,i,j,modeflag; - - SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x11,0x7f); /* unlock cr0-7 */ - - if(SiS_Pr->UseCustomMode) { - - modeflag = SiS_Pr->CModeFlag; - - for(i=0,j=0;i<=7;i++,j++) { - SiS_SetReg(SiS_Pr->SiS_P3d4,j,SiS_Pr->CCRT1CRTC[i]); - } - for(j=0x10;i<=10;i++,j++) { - SiS_SetReg(SiS_Pr->SiS_P3d4,j,SiS_Pr->CCRT1CRTC[i]); - } - for(j=0x15;i<=12;i++,j++) { - SiS_SetReg(SiS_Pr->SiS_P3d4,j,SiS_Pr->CCRT1CRTC[i]); - } - for(j=0x0A;i<=15;i++,j++) { - SiS_SetReg(SiS_Pr->SiS_P3c4,j,SiS_Pr->CCRT1CRTC[i]); - } - - temp = SiS_Pr->CCRT1CRTC[16] & 0xE0; - SiS_SetReg(SiS_Pr->SiS_P3c4,0x0E,temp); - - temp = (SiS_Pr->CCRT1CRTC[16] & 0x01) << 5; - if(modeflag & DoubleScanMode) temp |= 0x80; - SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,0x5F,temp); - - } else { - - if(ModeNo <= 0x13) { - modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; - } else { - modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - } - - index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; - - for(i=0,j=0;i<=7;i++,j++) { - SiS_SetReg(SiS_Pr->SiS_P3d4,j,SiS_Pr->SiS_CRT1Table[index].CR[i]); - } - for(j=0x10;i<=10;i++,j++) { - SiS_SetReg(SiS_Pr->SiS_P3d4,j,SiS_Pr->SiS_CRT1Table[index].CR[i]); - } - for(j=0x15;i<=12;i++,j++) { - SiS_SetReg(SiS_Pr->SiS_P3d4,j,SiS_Pr->SiS_CRT1Table[index].CR[i]); - } - for(j=0x0A;i<=15;i++,j++) { - SiS_SetReg(SiS_Pr->SiS_P3c4,j,SiS_Pr->SiS_CRT1Table[index].CR[i]); - } - - temp = SiS_Pr->SiS_CRT1Table[index].CR[16] & 0xE0; - SiS_SetReg(SiS_Pr->SiS_P3c4,0x0E,temp); - - temp = ((SiS_Pr->SiS_CRT1Table[index].CR[16]) & 0x01) << 5; - if(modeflag & DoubleScanMode) temp |= 0x80; - SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,0x5F,temp); - - } - - if(SiS_Pr->SiS_ModeType > ModeVGA) SiS_SetReg(SiS_Pr->SiS_P3d4,0x14,0x4F); + unsigned short temp, i, j, modeflag; + unsigned char *crt1data = NULL; + + modeflag = SiS_GetModeFlag(SiS_Pr, ModeNo, ModeIdIndex); + + if(SiS_Pr->UseCustomMode) { + + crt1data = &SiS_Pr->CCRT1CRTC[0]; + + } else { + + temp = SiS_GetRefCRT1CRTC(SiS_Pr, RRTI, SiS_Pr->SiS_UseWide); + + /* Alternate for 1600x1200 LCDA */ + if((temp == 0x20) && (SiS_Pr->Alternate1600x1200)) temp = 0x57; + + crt1data = (unsigned char *)&SiS_Pr->SiS_CRT1Table[temp].CR[0]; + + } + + /* unlock cr0-7 */ + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x11,0x7f); + + for(i = 0, j = 0; i <= 7; i++, j++) { + SiS_SetReg(SiS_Pr->SiS_P3d4,j,crt1data[i]); + } + for(j = 0x10; i <= 10; i++, j++) { + SiS_SetReg(SiS_Pr->SiS_P3d4,j,crt1data[i]); + } + for(j = 0x15; i <= 12; i++, j++) { + SiS_SetReg(SiS_Pr->SiS_P3d4,j,crt1data[i]); + } + for(j = 0x0A; i <= 15; i++, j++) { + SiS_SetReg(SiS_Pr->SiS_P3c4,j,crt1data[i]); + } + + SiS_SetReg(SiS_Pr->SiS_P3c4,0x0E,crt1data[16] & 0xE0); + + temp = (crt1data[16] & 0x01) << 5; + if(modeflag & DoubleScanMode) temp |= 0x80; + SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,0x5F,temp); + + if(SiS_Pr->SiS_ModeType > ModeVGA) { + SiS_SetReg(SiS_Pr->SiS_P3d4,0x14,0x4F); + } + +#ifdef SIS315H + if(SiS_Pr->ChipType == XGI_20) { + SiS_SetReg(SiS_Pr->SiS_P3d4,0x04,crt1data[4] - 1); + if(!(temp = crt1data[5] & 0x1f)) { + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x0c,0xfb); + } + SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x05,0xe0,((temp - 1) & 0x1f)); + temp = (crt1data[16] >> 5) + 3; + if(temp > 7) temp -= 7; + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0e,0x1f,(temp << 5)); + } +#endif } /*********************************************/ @@ -2359,33 +2153,32 @@ SiS_SetCRT1CRTC(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, /*********************************************/ static void -SiS_SetCRT1Offset(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex, - PSIS_HW_INFO HwInfo) +SiS_SetCRT1Offset(struct SiS_Private *SiS_Pr, unsigned short ModeNo, + unsigned short ModeIdIndex, unsigned short RRTI) { - USHORT temp, DisplayUnit, infoflag; + unsigned short temp, DisplayUnit, infoflag; if(SiS_Pr->UseCustomMode) { infoflag = SiS_Pr->CInfoFlag; } else { - infoflag = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag; + infoflag = SiS_Pr->SiS_RefIndex[RRTI].Ext_InfoFlag; } - DisplayUnit = SiS_GetOffset(SiS_Pr,ModeNo,ModeIdIndex, - RefreshRateTableIndex,HwInfo); + DisplayUnit = SiS_GetOffset(SiS_Pr, ModeNo, ModeIdIndex, RRTI); temp = (DisplayUnit >> 8) & 0x0f; SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0E,0xF0,temp); - temp = DisplayUnit & 0xFF; - SiS_SetReg(SiS_Pr->SiS_P3d4,0x13,temp); + SiS_SetReg(SiS_Pr->SiS_P3d4,0x13,DisplayUnit & 0xFF); if(infoflag & InterlaceMode) DisplayUnit >>= 1; DisplayUnit <<= 5; - temp = (DisplayUnit & 0xff00) >> 8; + temp = (DisplayUnit >> 8) + 1; if(DisplayUnit & 0xff) temp++; - temp++; + if(SiS_Pr->ChipType == XGI_20) { + if(ModeNo == 0x4a || ModeNo == 0x49) temp--; + } SiS_SetReg(SiS_Pr->SiS_P3c4,0x10,temp); } @@ -2394,39 +2187,49 @@ SiS_SetCRT1Offset(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, /*********************************************/ static void -SiS_SetCRT1VCLK(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, - PSIS_HW_INFO HwInfo, USHORT RefreshRateTableIndex) +SiS_SetCRT1VCLK(struct SiS_Private *SiS_Pr, unsigned short ModeNo, + unsigned short ModeIdIndex, unsigned short RRTI) { - USHORT index=0, clka, clkb; - - if(SiS_Pr->UseCustomMode) { - clka = SiS_Pr->CSR2B; - clkb = SiS_Pr->CSR2C; - } else { - index = SiS_GetVCLK2Ptr(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, HwInfo); - if((SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) { - clka = SiS_Pr->SiS_VBVCLKData[index].Part4_A; - clkb = SiS_Pr->SiS_VBVCLKData[index].Part4_B; - } else { - clka = SiS_Pr->SiS_VCLKData[index].SR2B; - clkb = SiS_Pr->SiS_VCLKData[index].SR2C; - } - } - - if(HwInfo->jChipType >= SIS_315H) { - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x31,0xCF); - } else { - SiS_SetReg(SiS_Pr->SiS_P3c4,0x31,0x00); - } - - SiS_SetReg(SiS_Pr->SiS_P3c4,0x2B,clka); - SiS_SetReg(SiS_Pr->SiS_P3c4,0x2C,clkb); - - if(HwInfo->jChipType >= SIS_315H) { - SiS_SetReg(SiS_Pr->SiS_P3c4,0x2D,0x01); - } else { - SiS_SetReg(SiS_Pr->SiS_P3c4,0x2D,0x80); - } + unsigned short index = 0, clka, clkb; + + if(SiS_Pr->UseCustomMode) { + clka = SiS_Pr->CSR2B; + clkb = SiS_Pr->CSR2C; + } else { + index = SiS_GetVCLK2Ptr(SiS_Pr, ModeNo, ModeIdIndex, RRTI); + if((SiS_Pr->SiS_VBType & VB_SIS30xBLV) && + (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) { + /* Alternate for 1600x1200 LCDA */ + if((index == 0x21) && (SiS_Pr->Alternate1600x1200)) index = 0x72; + clka = SiS_Pr->SiS_VBVCLKData[index].Part4_A; + clkb = SiS_Pr->SiS_VBVCLKData[index].Part4_B; + } else { + clka = SiS_Pr->SiS_VCLKData[index].SR2B; + clkb = SiS_Pr->SiS_VCLKData[index].SR2C; + } + } + + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x31,0xCF); + + SiS_SetReg(SiS_Pr->SiS_P3c4,0x2b,clka); + SiS_SetReg(SiS_Pr->SiS_P3c4,0x2c,clkb); + + if(SiS_Pr->ChipType >= SIS_315H) { +#ifdef SIS315H + SiS_SetReg(SiS_Pr->SiS_P3c4,0x2D,0x01); + if(SiS_Pr->ChipType == XGI_20) { + unsigned short mf = SiS_GetModeFlag(SiS_Pr, ModeNo, ModeIdIndex); + if(mf & HalfDCLK) { + SiS_SetReg(SiS_Pr->SiS_P3c4,0x2b,SiS_GetReg(SiS_Pr->SiS_P3c4,0x2b)); + clkb = SiS_GetReg(SiS_Pr->SiS_P3c4,0x2c); + clkb = (((clkb & 0x1f) << 1) + 1) | (clkb & 0xe0); + SiS_SetReg(SiS_Pr->SiS_P3c4,0x2c,clkb); + } + } +#endif + } else { + SiS_SetReg(SiS_Pr->SiS_P3c4,0x2D,0x80); + } } /*********************************************/ @@ -2434,802 +2237,730 @@ SiS_SetCRT1VCLK(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, /*********************************************/ #ifdef SIS300 -static USHORT -SiS_DoCalcDelay(SiS_Private *SiS_Pr, USHORT MCLK, USHORT VCLK, USHORT colordepth, USHORT key) +void +SiS_GetFIFOThresholdIndex300(struct SiS_Private *SiS_Pr, unsigned short *idx1, + unsigned short *idx2) { - const UCHAR ThLowA[] = { 61, 3,52, 5,68, 7,100,11, - 43, 3,42, 5,54, 7, 78,11, - 34, 3,37, 5,47, 7, 67,11 }; - - const UCHAR ThLowB[] = { 81, 4,72, 6,88, 8,120,12, - 55, 4,54, 6,66, 8, 90,12, - 42, 4,45, 6,55, 8, 75,12 }; - - const UCHAR ThTiming[] = { 1, 2, 2, 3, 0, 1, 1, 2 }; - - USHORT tempah, tempal, tempcl, tempbx, temp; - ULONG longtemp; - - tempah = SiS_GetReg(SiS_Pr->SiS_P3c4,0x18); - tempah &= 0x62; - tempah >>= 1; - tempal = tempah; - tempah >>= 3; - tempal |= tempah; - tempal &= 0x07; - tempcl = ThTiming[tempal]; - tempbx = SiS_GetReg(SiS_Pr->SiS_P3c4,0x16); - tempbx >>= 6; - tempah = SiS_GetReg(SiS_Pr->SiS_P3c4,0x14); - tempah >>= 4; - tempah &= 0x0c; - tempbx |= tempah; - tempbx <<= 1; - if(key == 0) { - tempal = ThLowA[tempbx + 1]; - tempal *= tempcl; - tempal += ThLowA[tempbx]; - } else { - tempal = ThLowB[tempbx + 1]; - tempal *= tempcl; - tempal += ThLowB[tempbx]; - } - longtemp = tempal * VCLK * colordepth; - temp = longtemp % (MCLK * 16); - longtemp /= (MCLK * 16); - if(temp) longtemp++; - return((USHORT)longtemp); + unsigned short temp1, temp2; + static const unsigned char ThTiming[8] = { + 1, 2, 2, 3, 0, 1, 1, 2 + }; + + temp1 = temp2 = (SiS_GetReg(SiS_Pr->SiS_P3c4,0x18) & 0x62) >> 1; + (*idx2) = (unsigned short)(ThTiming[((temp2 >> 3) | temp1) & 0x07]); + (*idx1) = (unsigned short)(SiS_GetReg(SiS_Pr->SiS_P3c4,0x16) >> 6) & 0x03; + (*idx1) |= (unsigned short)(((SiS_GetReg(SiS_Pr->SiS_P3c4,0x14) >> 4) & 0x0c)); + (*idx1) <<= 1; } -static USHORT -SiS_CalcDelay(SiS_Private *SiS_Pr, USHORT VCLK, USHORT colordepth, USHORT MCLK) +static unsigned short +SiS_GetFIFOThresholdA300(unsigned short idx1, unsigned short idx2) { - USHORT tempax, tempbx; - - tempbx = SiS_DoCalcDelay(SiS_Pr, MCLK, VCLK, colordepth, 0); - tempax = SiS_DoCalcDelay(SiS_Pr, MCLK, VCLK, colordepth, 1); - if(tempax < 4) tempax = 4; - tempax -= 4; - if(tempbx < tempax) tempbx = tempax; - return(tempbx); -} + static const unsigned char ThLowA[8 * 3] = { + 61, 3,52, 5,68, 7,100,11, + 43, 3,42, 5,54, 7, 78,11, + 34, 3,37, 5,47, 7, 67,11 + }; -static void -SiS_SetCRT1FIFO_300(SiS_Private *SiS_Pr, USHORT ModeNo, PSIS_HW_INFO HwInfo, - USHORT RefreshRateTableIndex) -{ - USHORT ThresholdLow = 0; - USHORT index, VCLK, MCLK, colorth=0; - USHORT tempah, temp; - - if(ModeNo > 0x13) { - - if(SiS_Pr->UseCustomMode) { - VCLK = SiS_Pr->CSRClock; - } else { - index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; - index &= 0x3F; - VCLK = SiS_Pr->SiS_VCLKData[index].CLOCK; /* Get VCLK */ - } - - switch (SiS_Pr->SiS_ModeType - ModeEGA) { /* Get half colordepth */ - case 0 : colorth = 1; break; - case 1 : colorth = 1; break; - case 2 : colorth = 2; break; - case 3 : colorth = 2; break; - case 4 : colorth = 3; break; - case 5 : colorth = 4; break; - } - - index = SiS_GetReg(SiS_Pr->SiS_P3c4,0x3A); - index &= 0x07; - MCLK = SiS_Pr->SiS_MCLKData_0[index].CLOCK; /* Get MCLK */ - - tempah = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35); - tempah &= 0xc3; - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x16,0x3c,tempah); - - do { - ThresholdLow = SiS_CalcDelay(SiS_Pr, VCLK, colorth, MCLK); - ThresholdLow++; - if(ThresholdLow < 0x13) break; - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x16,0xfc); - ThresholdLow = 0x13; - tempah = SiS_GetReg(SiS_Pr->SiS_P3c4,0x16); - tempah >>= 6; - if(!(tempah)) break; - tempah--; - tempah <<= 6; - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x16,0x3f,tempah); - } while(0); - - } else ThresholdLow = 2; - - /* Write CRT/CPU threshold low, CRT/Engine threshold high */ - temp = (ThresholdLow << 4) | 0x0f; - SiS_SetReg(SiS_Pr->SiS_P3c4,0x08,temp); - - temp = (ThresholdLow & 0x10) << 1; - if(ModeNo > 0x13) temp |= 0x40; - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0f,0x9f,temp); - - /* What is this? */ - SiS_SetReg(SiS_Pr->SiS_P3c4,0x3B,0x09); - - /* Write CRT/CPU threshold high */ - temp = ThresholdLow + 3; - if(temp > 0x0f) temp = 0x0f; - SiS_SetReg(SiS_Pr->SiS_P3c4,0x09,temp); + return (unsigned short)((ThLowA[idx1 + 1] * idx2) + ThLowA[idx1]); } -static USHORT -SiS_CalcDelay2(SiS_Private *SiS_Pr, UCHAR key, PSIS_HW_INFO HwInfo) +unsigned short +SiS_GetFIFOThresholdB300(unsigned short idx1, unsigned short idx2) { - USHORT data,index; - const UCHAR LatencyFactor[] = { - 97, 88, 86, 79, 77, 00, /*; 64 bit BQ=2 */ - 00, 87, 85, 78, 76, 54, /*; 64 bit BQ=1 */ - 97, 88, 86, 79, 77, 00, /*; 128 bit BQ=2 */ - 00, 79, 77, 70, 68, 48, /*; 128 bit BQ=1 */ - 80, 72, 69, 63, 61, 00, /*; 64 bit BQ=2 */ - 00, 70, 68, 61, 59, 37, /*; 64 bit BQ=1 */ - 86, 77, 75, 68, 66, 00, /*; 128 bit BQ=2 */ - 00, 68, 66, 59, 57, 37 /*; 128 bit BQ=1 */ - }; - const UCHAR LatencyFactor730[] = { - 69, 63, 61, - 86, 79, 77, - 103, 96, 94, - 120,113,111, - 137,130,128, /* --- Table ends with this entry, data below */ - 137,130,128, /* to avoid using illegal values */ - 137,130,128, - 137,130,128, - 137,130,128, - 137,130,128, - 137,130,128, - 137,130,128, - 137,130,128, - 137,130,128, - 137,130,128, - 137,130,128, - }; - - if(HwInfo->jChipType == SIS_730) { - index = ((key & 0x0f) * 3) + ((key & 0xC0) >> 6); - data = LatencyFactor730[index]; - } else { - index = (key & 0xE0) >> 5; - if(key & 0x10) index +=6; - if(!(key & 0x01)) index += 24; - data = SiS_GetReg(SiS_Pr->SiS_P3c4,0x14); - if(data & 0x0080) index += 12; - data = LatencyFactor[index]; - } - return(data); + static const unsigned char ThLowB[8 * 3] = { + 81, 4,72, 6,88, 8,120,12, + 55, 4,54, 6,66, 8, 90,12, + 42, 4,45, 6,55, 8, 75,12 + }; + + return (unsigned short)((ThLowB[idx1 + 1] * idx2) + ThLowB[idx1]); } -static void -SiS_SetCRT1FIFO_630(SiS_Private *SiS_Pr, USHORT ModeNo, - PSIS_HW_INFO HwInfo, - USHORT RefreshRateTableIndex) +static unsigned short +SiS_DoCalcDelay(struct SiS_Private *SiS_Pr, unsigned short MCLK, unsigned short VCLK, + unsigned short colordepth, unsigned short key) { - USHORT i,index,data,VCLK,MCLK,colorth=0; - ULONG B,eax,bl,data2; - USHORT ThresholdLow=0; - UCHAR FQBQData[]= { - 0x01,0x21,0x41,0x61,0x81, - 0x31,0x51,0x71,0x91,0xb1, - 0x00,0x20,0x40,0x60,0x80, - 0x30,0x50,0x70,0x90,0xb0, - 0xFF - }; - UCHAR FQBQData730[]= { - 0x34,0x74,0xb4, - 0x23,0x63,0xa3, - 0x12,0x52,0x92, - 0x01,0x41,0x81, - 0x00,0x40,0x80, - 0xff - }; - - i=0; - if(ModeNo > 0x13) { - if(SiS_Pr->UseCustomMode) { - VCLK = SiS_Pr->CSRClock; - } else { - index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; - index &= 0x3F; - VCLK = SiS_Pr->SiS_VCLKData[index].CLOCK; /* Get VCLK */ - } - - index = SiS_GetReg(SiS_Pr->SiS_P3c4,0x1A); - index &= 0x07; - MCLK = SiS_Pr->SiS_MCLKData_0[index].CLOCK; /* Get MCLK */ - - data2 = SiS_Pr->SiS_ModeType - ModeEGA; /* Get half colordepth */ - 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; - } - - if(HwInfo->jChipType == SIS_730) { - - do { - B = SiS_CalcDelay2(SiS_Pr, FQBQData730[i], HwInfo) * VCLK * colorth; - bl = B / (MCLK * 16); - - if(B == bl * 16 * MCLK) { - bl = bl + 1; - } else { - bl = bl + 2; - } - - if(bl > 0x13) { - if(FQBQData730[i+1] == 0xFF) { - ThresholdLow = 0x13; - break; - } - i++; - } else { - ThresholdLow = bl; - break; - } - } while(FQBQData730[i] != 0xFF); + unsigned short idx1, idx2; + unsigned int longtemp = VCLK * colordepth; - } else { + SiS_GetFIFOThresholdIndex300(SiS_Pr, &idx1, &idx2); - do { - B = SiS_CalcDelay2(SiS_Pr, FQBQData[i], HwInfo) * VCLK * colorth; - bl = B / (MCLK * 16); + if(key == 0) { + longtemp *= SiS_GetFIFOThresholdA300(idx1, idx2); + } else { + longtemp *= SiS_GetFIFOThresholdB300(idx1, idx2); + } + idx1 = longtemp % (MCLK * 16); + longtemp /= (MCLK * 16); + if(idx1) longtemp++; + return (unsigned short)longtemp; +} - if(B == bl * 16 * MCLK) { - bl = bl + 1; - } else { - bl = bl + 2; - } +static unsigned short +SiS_CalcDelay(struct SiS_Private *SiS_Pr, unsigned short VCLK, + unsigned short colordepth, unsigned short MCLK) +{ + unsigned short temp1, temp2; + + temp2 = SiS_DoCalcDelay(SiS_Pr, MCLK, VCLK, colordepth, 0); + temp1 = SiS_DoCalcDelay(SiS_Pr, MCLK, VCLK, colordepth, 1); + if(temp1 < 4) temp1 = 4; + temp1 -= 4; + if(temp2 < temp1) temp2 = temp1; + return temp2; +} - if(bl > 0x13) { - if(FQBQData[i+1] == 0xFF) { - ThresholdLow = 0x13; - break; - } - i++; - } else { - ThresholdLow = bl; - break; - } - } while(FQBQData[i] != 0xFF); - } - } - else { - if(HwInfo->jChipType == SIS_730) { - } else { - i = 9; - } - ThresholdLow = 0x02; - } +static void +SiS_SetCRT1FIFO_300(struct SiS_Private *SiS_Pr, unsigned short ModeNo, + unsigned short RefreshRateTableIndex) +{ + unsigned short ThresholdLow = 0; + unsigned short temp, index, VCLK, MCLK, colorth; + static const unsigned short colortharray[6] = { 1, 1, 2, 2, 3, 4 }; - /* Write foreground and background queue */ - if(HwInfo->jChipType == SIS_730) { - - data2 = FQBQData730[i]; - data2 = (data2 & 0xC0) >> 5; - data2 <<= 8; - -#ifdef LINUX_KERNEL - SiS_SetRegLong(0xcf8,0x80000050); - eax = SiS_GetRegLong(0xcfc); - eax &= 0xfffff9ff; - eax |= data2; - SiS_SetRegLong(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 &= 0xfffff9ff; - eax |= data2; - pciWriteLong(0x00000000, 0x50, eax); -#endif + if(ModeNo > 0x13) { - /* Write GUI grant timer (PCI config 0xA3) */ - data2 = FQBQData730[i] << 8; - data2 = (data2 & 0x0f00) | ((data2 & 0x3000) >> 8); - data2 <<= 20; - -#ifdef LINUX_KERNEL - SiS_SetRegLong(0xcf8,0x800000A0); - eax = SiS_GetRegLong(0xcfc); - eax &= 0x00ffffff; - eax |= data2; - SiS_SetRegLong(0xcfc,eax); -#else - eax = pciReadLong(0x00000000, 0xA0); - eax &= 0x00ffffff; - eax |= data2; - pciWriteLong(0x00000000, 0xA0, eax); -#endif + /* Get VCLK */ + if(SiS_Pr->UseCustomMode) { + VCLK = SiS_Pr->CSRClock; + } else { + index = SiS_GetRefCRTVCLK(SiS_Pr, RefreshRateTableIndex, SiS_Pr->SiS_UseWide); + VCLK = SiS_Pr->SiS_VCLKData[index].CLOCK; + } - } else { + /* Get half colordepth */ + colorth = colortharray[(SiS_Pr->SiS_ModeType - ModeEGA)]; - data2 = FQBQData[i]; - data2 = (data2 & 0xf0) >> 4; - data2 <<= 24; + /* Get MCLK */ + index = SiS_GetReg(SiS_Pr->SiS_P3c4,0x3A) & 0x07; + MCLK = SiS_Pr->SiS_MCLKData_0[index].CLOCK; -#ifdef LINUX_KERNEL - SiS_SetRegLong(0xcf8,0x80000050); - eax = SiS_GetRegLong(0xcfc); - eax &= 0xf0ffffff; - eax |= data2; - SiS_SetRegLong(0xcfc,eax); -#else - eax = pciReadLong(0x00000000, 0x50); - eax &= 0xf0ffffff; - eax |= data2; - pciWriteLong(0x00000000, 0x50, eax); -#endif + temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35) & 0xc3; + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x16,0x3c,temp); - /* Write GUI grant timer (PCI config 0xA3) */ - data2 = FQBQData[i]; - data2 &= 0x0f; - data2 <<= 24; - -#ifdef LINUX_KERNEL - SiS_SetRegLong(0xcf8,0x800000A0); - eax = SiS_GetRegLong(0xcfc); - eax &= 0xf0ffffff; - eax |= data2; - SiS_SetRegLong(0xcfc,eax); -#else - eax = pciReadLong(0x00000000, 0xA0); - eax &= 0xf0ffffff; - eax |= data2; - pciWriteLong(0x00000000, 0xA0, eax); -#endif + do { + ThresholdLow = SiS_CalcDelay(SiS_Pr, VCLK, colorth, MCLK) + 1; + if(ThresholdLow < 0x13) break; + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x16,0xfc); + ThresholdLow = 0x13; + temp = SiS_GetReg(SiS_Pr->SiS_P3c4,0x16) >> 6; + if(!temp) break; + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x16,0x3f,((temp - 1) << 6)); + } while(0); - } + } else ThresholdLow = 2; - /* Write CRT/CPU threshold low, CRT/Engine threshold high */ - data = ((ThresholdLow & 0x0f) << 4) | 0x0f; - SiS_SetReg(SiS_Pr->SiS_P3c4,0x08,data); + /* Write CRT/CPU threshold low, CRT/Engine threshold high */ + temp = (ThresholdLow << 4) | 0x0f; + SiS_SetReg(SiS_Pr->SiS_P3c4,0x08,temp); - data = (ThresholdLow & 0x10) << 1; - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0F,0xDF,data); + temp = (ThresholdLow & 0x10) << 1; + if(ModeNo > 0x13) temp |= 0x40; + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0f,0x9f,temp); - /* What is this? */ - SiS_SetReg(SiS_Pr->SiS_P3c4,0x3B,0x09); + /* What is this? */ + SiS_SetReg(SiS_Pr->SiS_P3c4,0x3B,0x09); - /* Write CRT/CPU threshold high (gap = 3) */ - data = ThresholdLow + 3; - if(data > 0x0f) data = 0x0f; - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x09,0x80,data); + /* Write CRT/CPU threshold high */ + temp = ThresholdLow + 3; + if(temp > 0x0f) temp = 0x0f; + SiS_SetReg(SiS_Pr->SiS_P3c4,0x09,temp); } -#endif -#ifdef SIS315H -static void -SiS_SetCRT1FIFO_310(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, - PSIS_HW_INFO HwInfo) +unsigned short +SiS_GetLatencyFactor630(struct SiS_Private *SiS_Pr, unsigned short index) { - USHORT modeflag; - - /* disable auto-threshold */ - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x3D,0xFE); - - if(SiS_Pr->UseCustomMode) { - modeflag = SiS_Pr->CModeFlag; - } else { - modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - } - - SiS_SetReg(SiS_Pr->SiS_P3c4,0x08,0xAE); - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x09,0xF0); - if(ModeNo > 0x13) { - if(HwInfo->jChipType >= SIS_661) { - if(!(modeflag & HalfDCLK)) { - SiS_SetReg(SiS_Pr->SiS_P3c4,0x08,0x34); - SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x3D,0x01); - } - } else { - if((!(modeflag & DoubleScanMode)) || (!(modeflag & HalfDCLK))) { - SiS_SetReg(SiS_Pr->SiS_P3c4,0x08,0x34); - SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x3D,0x01); - } - } - } + static const unsigned char LatencyFactor[] = { + 97, 88, 86, 79, 77, 0, /* 64 bit BQ=2 */ + 0, 87, 85, 78, 76, 54, /* 64 bit BQ=1 */ + 97, 88, 86, 79, 77, 0, /* 128 bit BQ=2 */ + 0, 79, 77, 70, 68, 48, /* 128 bit BQ=1 */ + 80, 72, 69, 63, 61, 0, /* 64 bit BQ=2 */ + 0, 70, 68, 61, 59, 37, /* 64 bit BQ=1 */ + 86, 77, 75, 68, 66, 0, /* 128 bit BQ=2 */ + 0, 68, 66, 59, 57, 37 /* 128 bit BQ=1 */ + }; + static const unsigned char LatencyFactor730[] = { + 69, 63, 61, + 86, 79, 77, + 103, 96, 94, + 120,113,111, + 137,130,128 + }; + + if(SiS_Pr->ChipType == SIS_730) { + return (unsigned short)LatencyFactor730[index]; + } else { + return (unsigned short)LatencyFactor[index]; + } } -#endif -/*********************************************/ -/* MODE REGISTERS */ -/*********************************************/ +static unsigned short +SiS_CalcDelay2(struct SiS_Private *SiS_Pr, unsigned char key) +{ + unsigned short index; + + if(SiS_Pr->ChipType == SIS_730) { + index = ((key & 0x0f) * 3) + ((key & 0xc0) >> 6); + } else { + index = (key & 0xe0) >> 5; + if(key & 0x10) index += 6; + if(!(key & 0x01)) index += 24; + if(SiS_GetReg(SiS_Pr->SiS_P3c4,0x14) & 0x80) index += 12; + } + return SiS_GetLatencyFactor630(SiS_Pr, index); +} static void -SiS_SetVCLKState(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, - USHORT ModeNo, USHORT RefreshRateTableIndex, - USHORT ModeIdIndex) +SiS_SetCRT1FIFO_630(struct SiS_Private *SiS_Pr, unsigned short ModeNo, + unsigned short RefreshRateTableIndex) { - USHORT data=0, VCLK=0, index=0; + unsigned short ThresholdLow = 0; + unsigned short i, data, VCLK, MCLK16, colorth = 0; + unsigned int templ, datal; + const unsigned char *queuedata = NULL; + static const unsigned char FQBQData[21] = { + 0x01,0x21,0x41,0x61,0x81, + 0x31,0x51,0x71,0x91,0xb1, + 0x00,0x20,0x40,0x60,0x80, + 0x30,0x50,0x70,0x90,0xb0, + 0xff + }; + static const unsigned char FQBQData730[16] = { + 0x34,0x74,0xb4, + 0x23,0x63,0xa3, + 0x12,0x52,0x92, + 0x01,0x41,0x81, + 0x00,0x40,0x80, + 0xff + }; + static const unsigned short colortharray[6] = { + 1, 1, 2, 2, 3, 4 + }; + + i = 0; - if(ModeNo > 0x13) { - if(SiS_Pr->UseCustomMode) { - VCLK = SiS_Pr->CSRClock; - } else { - index = SiS_GetVCLK2Ptr(SiS_Pr,ModeNo,ModeIdIndex, - RefreshRateTableIndex,HwInfo); - VCLK = SiS_Pr->SiS_VCLKData[index].CLOCK; - } - } + if(ModeNo > 0x13) { + + /* Get VCLK */ + if(SiS_Pr->UseCustomMode) { + VCLK = SiS_Pr->CSRClock; + } else { + data = SiS_GetRefCRTVCLK(SiS_Pr, RefreshRateTableIndex, SiS_Pr->SiS_UseWide); + VCLK = SiS_Pr->SiS_VCLKData[data].CLOCK; + } - if(HwInfo->jChipType < SIS_315H) { + /* Get MCLK * 16 */ + data = SiS_GetReg(SiS_Pr->SiS_P3c4,0x1A) & 0x07; + MCLK16 = SiS_Pr->SiS_MCLKData_0[data].CLOCK * 16; - if(VCLK > 150) data |= 0x80; - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x07,0x7B,data); + /* Get half colordepth */ + colorth = colortharray[(SiS_Pr->SiS_ModeType - ModeEGA)]; - data = 0x00; - if(VCLK >= 150) data |= 0x08; - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x32,0xF7,data); + if(SiS_Pr->ChipType == SIS_730) { + queuedata = &FQBQData730[0]; + } else { + queuedata = &FQBQData[0]; + } - } else { + do { + templ = SiS_CalcDelay2(SiS_Pr, queuedata[i]) * VCLK * colorth; - if(VCLK >= 166) data |= 0x0c; - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x32,0xf3,data); + datal = templ % MCLK16; + templ = (templ / MCLK16) + 1; + if(datal) templ++; - if(VCLK >= 166) { - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1f,0xe7); - } - } + if(templ > 0x13) { + if(queuedata[i + 1] == 0xFF) { + ThresholdLow = 0x13; + break; + } + i++; + } else { + ThresholdLow = templ; + break; + } + } while(queuedata[i] != 0xFF); - /* DAC speed */ - if(HwInfo->jChipType >= SIS_661) { + } else { - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x07,0xE8,0x10); + if(SiS_Pr->ChipType != SIS_730) i = 9; + ThresholdLow = 0x02; - } else { + } - data = 0x03; - if((VCLK >= 135) && (VCLK < 160)) data = 0x02; - else if((VCLK >= 160) && (VCLK < 260)) data = 0x01; - else if(VCLK >= 260) data = 0x00; + /* Write CRT/CPU threshold low, CRT/Engine threshold high */ + data = ((ThresholdLow & 0x0f) << 4) | 0x0f; + SiS_SetReg(SiS_Pr->SiS_P3c4,0x08,data); - if(HwInfo->jChipType == SIS_540) { - if((VCLK == 203) || (VCLK < 234)) data = 0x02; - } + data = (ThresholdLow & 0x10) << 1; + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0F,0xDF,data); - if(HwInfo->jChipType < SIS_315H) { - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x07,0xFC,data); - } else { - if(HwInfo->jChipType > SIS_315PRO) { - if(ModeNo > 0x13) data &= 0xfc; - } - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x07,0xF8,data); - } + /* What is this? */ + SiS_SetReg(SiS_Pr->SiS_P3c4,0x3B,0x09); - } -} + /* Write CRT/CPU threshold high (gap = 3) */ + data = ThresholdLow + 3; + if(data > 0x0f) data = 0x0f; + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x09,0x80,data); -static void -SiS_SetCRT1ModeRegs(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, - USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex) -{ - USHORT data,infoflag=0,modeflag; - USHORT resindex,xres; -#ifdef SIS315H - USHORT data2,data3; - ULONG longdata; - UCHAR *ROMAddr = HwInfo->pjVirtualRomBase; + /* Write foreground and background queue */ +#ifdef SIS_LINUX_KERNEL + templ = sisfb_read_nbridge_pci_dword(SiS_Pr, 0x50); +#else + templ = pciReadLong(0x00000000, 0x50); #endif - if(SiS_Pr->UseCustomMode) { - modeflag = SiS_Pr->CModeFlag; - infoflag = SiS_Pr->CInfoFlag; - xres = SiS_Pr->CHDisplay; - } else { - resindex = SiS_GetResInfo(SiS_Pr,ModeNo,ModeIdIndex); - if(ModeNo > 0x13) { - modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - infoflag = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag; - xres = SiS_Pr->SiS_ModeResInfo[resindex].HTotal; - } else { - modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; - xres = SiS_Pr->SiS_StResInfo[resindex].HTotal; - } - } - - /* Disable DPMS */ - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1F,0x3F); - - data = 0; - if(ModeNo > 0x13) { - if(SiS_Pr->SiS_ModeType > ModeEGA) { - data |= 0x02; - data |= ((SiS_Pr->SiS_ModeType - ModeVGA) << 2); - } - if(infoflag & InterlaceMode) data |= 0x20; - } - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x06,0xC0,data); - - if(HwInfo->jChipType != SIS_300) { - data = 0; - if(infoflag & InterlaceMode) { - if(xres <= 800) data = 0x0020; - else if(xres <= 1024) data = 0x0035; - else data = 0x0048; - } - SiS_SetReg(SiS_Pr->SiS_P3d4,0x19,(data & 0xFF)); - SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x1a,0xFC,(data >> 8)); - } - - if(modeflag & HalfDCLK) { - SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x01,0x08); - } - - data = 0; - if(modeflag & LineCompareOff) data = 0x08; - if(HwInfo->jChipType == SIS_300) { - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0F,0xF7,data); - } else { - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0F,0xB7,data); - if(SiS_Pr->SiS_ModeType == ModeEGA) { - if(ModeNo > 0x13) { - SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x0F,0x40); - } - } - } - - if(HwInfo->jChipType >= SIS_661) { - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x31,0xfb); - } + if(SiS_Pr->ChipType == SIS_730) { -#ifdef SIS315H - if(HwInfo->jChipType == SIS_315PRO) { - - data = SiS_Get310DRAMType(SiS_Pr, HwInfo); - data = SiS_Pr->SiS_SR15[2][data]; - if(SiS_Pr->SiS_ModeType == ModeText) { - data &= 0xc7; - } else { - data2 = SiS_GetOffset(SiS_Pr,ModeNo,ModeIdIndex, - RefreshRateTableIndex,HwInfo); - data2 >>= 1; - if(infoflag & InterlaceMode) data2 >>= 1; - data3 = SiS_GetColorDepth(SiS_Pr,ModeNo,ModeIdIndex) >> 1; - if(!data3) data3++; - data2 /= data3; - if(data2 >= 0x50) { - data &= 0x0f; - data |= 0x50; - } - } - SiS_SetReg(SiS_Pr->SiS_P3c4,0x17,data); - - } else if( (HwInfo->jChipType == SIS_330) || - ((HwInfo->jChipType == SIS_760) && (SiS_Pr->SiS_SysFlags & SF_760LFB))) { - - data = SiS_Get310DRAMType(SiS_Pr, HwInfo); - if(HwInfo->jChipType == SIS_330) { - data = SiS_Pr->SiS_SR15[2][data]; - } else { - if(SiS_Pr->SiS_ROMNew) data = ROMAddr[0xf6]; - else if(SiS_Pr->SiS_UseROM) data = ROMAddr[0x100 + data]; - else data = 0xba; - } - if(SiS_Pr->SiS_ModeType <= ModeEGA) { - data &= 0xc7; - } else { - if(SiS_Pr->UseCustomMode) { - data2 = SiS_Pr->CSRClock; - } else { - data2 = SiS_GetVCLK2Ptr(SiS_Pr,ModeNo,ModeIdIndex, - RefreshRateTableIndex,HwInfo); - data2 = SiS_Pr->SiS_VCLKData[data2].CLOCK; - } + templ &= 0xfffff9ff; + templ |= ((queuedata[i] & 0xc0) << 3); - data3 = SiS_GetColorDepth(SiS_Pr,ModeNo,ModeIdIndex) >> 1; - if(data3) data2 *= data3; - - longdata = SiS_GetMCLK(SiS_Pr, HwInfo) * 1024; - - data2 = longdata / data2; - - if(HwInfo->jChipType == SIS_330) { - if(SiS_Pr->SiS_ModeType != Mode16Bpp) { - if (data2 >= 0x19c) data = 0xba; - else if(data2 >= 0x140) data = 0x7a; - else if(data2 >= 0x101) data = 0x3a; - else if(data2 >= 0xf5) data = 0x32; - else if(data2 >= 0xe2) data = 0x2a; - else if(data2 >= 0xc4) data = 0x22; - else if(data2 >= 0xac) data = 0x1a; - else if(data2 >= 0x9e) data = 0x12; - else if(data2 >= 0x8e) data = 0x0a; - else data = 0x02; - } else { - if(data2 >= 0x127) data = 0xba; - else data = 0x7a; - } - } else { /* 760+LFB */ - if (data2 >= 0x190) data = 0xba; - else if(data2 >= 0xff) data = 0x7a; - else if(data2 >= 0xd3) data = 0x3a; - else if(data2 >= 0xa9) data = 0x1a; - else if(data2 >= 0x93) data = 0x0a; - else data = 0x02; - } - } - SiS_SetReg(SiS_Pr->SiS_P3c4,0x17,data); - } else if(HwInfo->jChipType == SIS_340) { - /* TODO */ - } + } else { + + templ &= 0xf0ffffff; + if( (ModeNo <= 0x13) && + (SiS_Pr->ChipType == SIS_630) && + (SiS_Pr->ChipRevision >= 0x30) ) { + templ |= 0x0b000000; + } else { + templ |= ((queuedata[i] & 0xf0) << 20); + } + + } + +#ifdef SIS_LINUX_KERNEL + sisfb_write_nbridge_pci_dword(SiS_Pr, 0x50, templ); + templ = sisfb_read_nbridge_pci_dword(SiS_Pr, 0xA0); +#else + pciWriteLong(0x00000000, 0x50, templ); + templ = pciReadLong(0x00000000, 0xA0); #endif - data = 0x60; - if(SiS_Pr->SiS_ModeType != ModeText) { - data ^= 0x60; - if(SiS_Pr->SiS_ModeType != ModeEGA) { - data ^= 0xA0; - } - } - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x21,0x1F,data); + /* GUI grant timer (PCI config 0xA3) */ + if(SiS_Pr->ChipType == SIS_730) { - SiS_SetVCLKState(SiS_Pr, HwInfo, ModeNo, RefreshRateTableIndex, ModeIdIndex); + templ &= 0x00ffffff; + datal = queuedata[i] << 8; + templ |= (((datal & 0x0f00) | ((datal & 0x3000) >> 8)) << 20); -#ifdef SIS315H - if(HwInfo->jChipType >= SIS_315H) { - if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x31) & 0x40) { - SiS_SetReg(SiS_Pr->SiS_P3d4,0x52,0x2c); - } else { - SiS_SetReg(SiS_Pr->SiS_P3d4,0x52,0x6c); - } - } + } else { + + templ &= 0xf0ffffff; + templ |= ((queuedata[i] & 0x0f) << 24); + + } + +#ifdef SIS_LINUX_KERNEL + sisfb_write_nbridge_pci_dword(SiS_Pr, 0xA0, templ); +#else + pciWriteLong(0x00000000, 0xA0, templ); #endif } +#endif /* SIS300 */ + +#ifdef SIS315H +static void +SiS_SetCRT1FIFO_310(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short ModeIdIndex) +{ + unsigned short modeflag; + + /* disable auto-threshold */ + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x3D,0xFE); + + modeflag = SiS_GetModeFlag(SiS_Pr, ModeNo, ModeIdIndex); + + SiS_SetReg(SiS_Pr->SiS_P3c4,0x08,0xAE); + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x09,0xF0); + if(ModeNo > 0x13) { + if(SiS_Pr->ChipType >= XGI_20) { + SiS_SetReg(SiS_Pr->SiS_P3c4,0x08,0x34); + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x3D,0x01); + } else if(SiS_Pr->ChipType >= SIS_661) { + if(!(modeflag & HalfDCLK)) { + SiS_SetReg(SiS_Pr->SiS_P3c4,0x08,0x34); + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x3D,0x01); + } + } else { + if((!(modeflag & DoubleScanMode)) || (!(modeflag & HalfDCLK))) { + SiS_SetReg(SiS_Pr->SiS_P3c4,0x08,0x34); + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x3D,0x01); + } + } + } +} +#endif /*********************************************/ -/* LOAD DAC */ +/* MODE REGISTERS */ /*********************************************/ -#if 0 static void -SiS_ClearDAC(SiS_Private *SiS_Pr, ULONG port) +SiS_SetVCLKState(struct SiS_Private *SiS_Pr, unsigned short ModeNo, + unsigned short RefreshRateTableIndex, unsigned short ModeIdIndex) +{ + unsigned short data = 0, VCLK = 0, index = 0; + + if(ModeNo > 0x13) { + if(SiS_Pr->UseCustomMode) { + VCLK = SiS_Pr->CSRClock; + } else { + index = SiS_GetVCLK2Ptr(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex); + VCLK = SiS_Pr->SiS_VCLKData[index].CLOCK; + } + } + + if(SiS_Pr->ChipType < SIS_315H) { +#ifdef SIS300 + if(VCLK > 150) data |= 0x80; + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x07,0x7B,data); + + data = 0x00; + if(VCLK >= 150) data |= 0x08; + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x32,0xF7,data); +#endif + } else if(SiS_Pr->ChipType < XGI_20) { +#ifdef SIS315H + if(VCLK >= 166) data |= 0x0c; + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x32,0xf3,data); + + if(VCLK >= 166) { + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1f,0xe7); + } +#endif + } else { +#ifdef SIS315H + if(VCLK >= 200) data |= 0x0c; + if(SiS_Pr->ChipType == XGI_20) data &= ~0x04; + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x32,0xf3,data); + if(SiS_Pr->ChipType != XGI_20) { + data = SiS_GetReg(SiS_Pr->SiS_P3c4,0x1f) & 0xe7; + if(VCLK < 200) data |= 0x10; + SiS_SetReg(SiS_Pr->SiS_P3c4,0x1f,data); + } +#endif + } + + /* DAC speed */ + if(SiS_Pr->ChipType >= SIS_661) { + + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x07,0xE8,0x10); + + } else { + + data = 0x03; + if(VCLK >= 260) data = 0x00; + else if(VCLK >= 160) data = 0x01; + else if(VCLK >= 135) data = 0x02; + + if(SiS_Pr->ChipType == SIS_540) { + if((VCLK == 203) || (VCLK < 234)) data = 0x02; + } + + if(SiS_Pr->ChipType < SIS_315H) { + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x07,0xFC,data); + } else { + if(SiS_Pr->ChipType > SIS_315PRO) { + if(ModeNo > 0x13) data &= 0xfc; + } + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x07,0xF8,data); + } + + } +} + +static void +SiS_SetCRT1ModeRegs(struct SiS_Private *SiS_Pr, unsigned short ModeNo, + unsigned short ModeIdIndex, unsigned short RRTI) +{ + unsigned short data, infoflag = 0, modeflag, resindex; +#ifdef SIS315H + unsigned char *ROMAddr = SiS_Pr->VirtualRomBase; + unsigned short data2, data3; +#endif + + modeflag = SiS_GetModeFlag(SiS_Pr, ModeNo, ModeIdIndex); + + if(SiS_Pr->UseCustomMode) { + infoflag = SiS_Pr->CInfoFlag; + } else { + resindex = SiS_GetResInfo(SiS_Pr, ModeNo, ModeIdIndex); + if(ModeNo > 0x13) { + infoflag = SiS_Pr->SiS_RefIndex[RRTI].Ext_InfoFlag; + } + } + + /* Disable DPMS */ + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1F,0x3F); + + data = 0; + if(ModeNo > 0x13) { + if(SiS_Pr->SiS_ModeType > ModeEGA) { + data |= 0x02; + data |= ((SiS_Pr->SiS_ModeType - ModeVGA) << 2); + } + if(infoflag & InterlaceMode) data |= 0x20; + } + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x06,0xC0,data); + + if(SiS_Pr->ChipType != SIS_300) { + data = 0; + if(infoflag & InterlaceMode) { + /* data = (Hsync / 8) - ((Htotal / 8) / 2) + 3 */ + int hrs = (SiS_GetReg(SiS_Pr->SiS_P3d4,0x04) | + ((SiS_GetReg(SiS_Pr->SiS_P3c4,0x0b) & 0xc0) << 2)) - 3; + int hto = (SiS_GetReg(SiS_Pr->SiS_P3d4,0x00) | + ((SiS_GetReg(SiS_Pr->SiS_P3c4,0x0b) & 0x03) << 8)) + 5; + data = hrs - (hto >> 1) + 3; + } + SiS_SetReg(SiS_Pr->SiS_P3d4,0x19,data); + SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x1a,0xFC,((data >> 8) & 0x03)); + } + + if(modeflag & HalfDCLK) { + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x01,0x08); + } + + data = 0; + if(modeflag & LineCompareOff) data = 0x08; + if(SiS_Pr->ChipType == SIS_300) { + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0F,0xF7,data); + } else { + if(SiS_Pr->ChipType >= XGI_20) data |= 0x20; + if(SiS_Pr->SiS_ModeType == ModeEGA) { + if(ModeNo > 0x13) { + data |= 0x40; + } + } + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0F,0xB7,data); + } + +#ifdef SIS315H + if(SiS_Pr->ChipType >= SIS_315H) { + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x31,0xfb); + } + + if(SiS_Pr->ChipType == SIS_315PRO) { + + data = SiS_Pr->SiS_SR15[(2 * 4) + SiS_Get310DRAMType(SiS_Pr)]; + if(SiS_Pr->SiS_ModeType == ModeText) { + data &= 0xc7; + } else { + data2 = SiS_GetOffset(SiS_Pr, ModeNo, ModeIdIndex, RRTI) >> 1; + if(infoflag & InterlaceMode) data2 >>= 1; + data3 = SiS_GetColorDepth(SiS_Pr, ModeNo, ModeIdIndex) >> 1; + if(data3) data2 /= data3; + if(data2 >= 0x50) { + data &= 0x0f; + data |= 0x50; + } + } + SiS_SetReg(SiS_Pr->SiS_P3c4,0x17,data); + + } else if((SiS_Pr->ChipType == SIS_330) || (SiS_Pr->SiS_SysFlags & SF_760LFB)) { + + data = SiS_Get310DRAMType(SiS_Pr); + if(SiS_Pr->ChipType == SIS_330) { + data = SiS_Pr->SiS_SR15[(2 * 4) + data]; + } else { + if(SiS_Pr->SiS_ROMNew) data = ROMAddr[0xf6]; + else if(SiS_Pr->SiS_UseROM) data = ROMAddr[0x100 + data]; + else data = 0xba; + } + if(SiS_Pr->SiS_ModeType <= ModeEGA) { + data &= 0xc7; + } else { + if(SiS_Pr->UseCustomMode) { + data2 = SiS_Pr->CSRClock; + } else { + data2 = SiS_GetVCLK2Ptr(SiS_Pr, ModeNo, ModeIdIndex, RRTI); + data2 = SiS_Pr->SiS_VCLKData[data2].CLOCK; + } + + data3 = SiS_GetColorDepth(SiS_Pr, ModeNo, ModeIdIndex) >> 1; + if(data3) data2 *= data3; + + data2 = ((unsigned int)(SiS_GetMCLK(SiS_Pr) * 1024)) / data2; + + if(SiS_Pr->ChipType == SIS_330) { + if(SiS_Pr->SiS_ModeType != Mode16Bpp) { + if (data2 >= 0x19c) data = 0xba; + else if(data2 >= 0x140) data = 0x7a; + else if(data2 >= 0x101) data = 0x3a; + else if(data2 >= 0xf5) data = 0x32; + else if(data2 >= 0xe2) data = 0x2a; + else if(data2 >= 0xc4) data = 0x22; + else if(data2 >= 0xac) data = 0x1a; + else if(data2 >= 0x9e) data = 0x12; + else if(data2 >= 0x8e) data = 0x0a; + else data = 0x02; + } else { + if(data2 >= 0x127) data = 0xba; + else data = 0x7a; + } + } else { /* 76x+LFB */ + if (data2 >= 0x190) data = 0xba; + else if(data2 >= 0xff) data = 0x7a; + else if(data2 >= 0xd3) data = 0x3a; + else if(data2 >= 0xa9) data = 0x1a; + else if(data2 >= 0x93) data = 0x0a; + else data = 0x02; + } + } + SiS_SetReg(SiS_Pr->SiS_P3c4,0x17,data); + + } + /* XGI: Nothing. */ + /* TODO: Check SiS340 */ +#endif + + data = 0x60; + if(SiS_Pr->SiS_ModeType != ModeText) { + data ^= 0x60; + if(SiS_Pr->SiS_ModeType != ModeEGA) { + data ^= 0xA0; + } + } + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x21,0x1F,data); + + SiS_SetVCLKState(SiS_Pr, ModeNo, RRTI, ModeIdIndex); + +#ifdef SIS315H + if(((SiS_Pr->ChipType >= SIS_315H) && (SiS_Pr->ChipType < SIS_661)) || + (SiS_Pr->ChipType == XGI_40)) { + if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x31) & 0x40) { + SiS_SetReg(SiS_Pr->SiS_P3d4,0x52,0x2c); + } else { + SiS_SetReg(SiS_Pr->SiS_P3d4,0x52,0x6c); + } + } else if(SiS_Pr->ChipType == XGI_20) { + if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x31) & 0x40) { + SiS_SetReg(SiS_Pr->SiS_P3d4,0x52,0x33); + } else { + SiS_SetReg(SiS_Pr->SiS_P3d4,0x52,0x73); + } + SiS_SetReg(SiS_Pr->SiS_P3d4,0x51,0x02); + } +#endif +} + +#ifdef SIS315H +static void +SiS_SetupDualChip(struct SiS_Private *SiS_Pr) { +#if 0 + /* TODO: Find out about IOAddress2 */ + SISIOADDRESS P2_3c2 = SiS_Pr->IOAddress2 + 0x12; + SISIOADDRESS P2_3c4 = SiS_Pr->IOAddress2 + 0x14; + SISIOADDRESS P2_3ce = SiS_Pr->IOAddress2 + 0x1e; int i; - OutPortByte(port, 0); - port++; - for (i=0; i < (256 * 3); i++) { - OutPortByte(port, 0); + if((SiS_Pr->ChipRevision != 0) || + (!(SiS_GetReg(SiS_Pr->SiS_P3c4,0x3a) & 0x04))) + return; + + for(i = 0; i <= 4; i++) { /* SR00 - SR04 */ + SiS_SetReg(P2_3c4,i,SiS_GetReg(SiS_Pr->SiS_P3c4,i)); } + for(i = 0; i <= 8; i++) { /* GR00 - GR08 */ + SiS_SetReg(P2_3ce,i,SiS_GetReg(SiS_Pr->SiS_P3ce,i)); + } + SiS_SetReg(P2_3c4,0x05,0x86); + SiS_SetReg(P2_3c4,0x06,SiS_GetReg(SiS_Pr->SiS_P3c4,0x06)); /* SR06 */ + SiS_SetReg(P2_3c4,0x21,SiS_GetReg(SiS_Pr->SiS_P3c4,0x21)); /* SR21 */ + SiS_SetRegByte(P2_3c2,SiS_GetRegByte(SiS_Pr->SiS_P3cc)); /* MISC */ + SiS_SetReg(P2_3c4,0x05,0x00); +#endif } #endif +/*********************************************/ +/* LOAD DAC */ +/*********************************************/ + static void -SiS_WriteDAC(SiS_Private *SiS_Pr, SISIOADDRESS DACData, USHORT shiftflag, - USHORT dl, USHORT ah, USHORT al, USHORT dh) +SiS_WriteDAC(struct SiS_Private *SiS_Pr, SISIOADDRESS DACData, unsigned short shiftflag, + unsigned short dl, unsigned short ah, unsigned short al, unsigned short dh) { - USHORT temp,bh,bl; - - bh = ah; - bl = al; - if(dl != 0) { - temp = bh; - bh = dh; - dh = temp; - if(dl == 1) { - temp = bl; - bl = dh; - dh = temp; - } else { - temp = bl; - bl = bh; - bh = temp; - } - } - if(shiftflag) { - dh <<= 2; - bh <<= 2; - bl <<= 2; - } - SiS_SetRegByte(DACData,(USHORT)dh); - SiS_SetRegByte(DACData,(USHORT)bh); - SiS_SetRegByte(DACData,(USHORT)bl); + unsigned short d1, d2, d3; + + switch(dl) { + case 0: d1 = dh; d2 = ah; d3 = al; break; + case 1: d1 = ah; d2 = al; d3 = dh; break; + default: d1 = al; d2 = dh; d3 = ah; + } + SiS_SetRegByte(DACData, (d1 << shiftflag)); + SiS_SetRegByte(DACData, (d2 << shiftflag)); + SiS_SetRegByte(DACData, (d3 << shiftflag)); } void -SiS_LoadDAC(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, - USHORT ModeNo, USHORT ModeIdIndex) +SiS_LoadDAC(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short ModeIdIndex) { - USHORT data,data2; - USHORT time,i,j,k,m,n,o; - USHORT si,di,bx,dl,al,ah,dh; - USHORT shiftflag; + unsigned short data, data2, time, i, j, k, m, n, o; + unsigned short si, di, bx, sf; SISIOADDRESS DACAddr, DACData; - const USHORT *table = NULL; + const unsigned char *table = NULL; - if(ModeNo <= 0x13) { - data = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; - } else { - if(SiS_Pr->UseCustomMode) { - data = SiS_Pr->CModeFlag; - } else { - data = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - } - } + data = SiS_GetModeFlag(SiS_Pr, ModeNo, ModeIdIndex) & DACInfoFlag; - 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) { + j = time = 64; + if(data == 0x00) table = SiS_MDA_DAC; + else if(data == 0x08) table = SiS_CGA_DAC; + else if(data == 0x10) table = SiS_EGA_DAC; + else if(data == 0x18) { + j = 16; time = 256; table = SiS_VGA_DAC; } - if(time == 256) j = 16; - else j = time; if( ( (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) && /* 301B-DH LCD */ (SiS_Pr->SiS_VBType & VB_NoLCD) ) || (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) || /* LCDA */ (!(SiS_Pr->SiS_SetFlag & ProgrammingCRT2)) ) { /* Programming CRT1 */ + SiS_SetRegByte(SiS_Pr->SiS_P3c6,0xFF); DACAddr = SiS_Pr->SiS_P3c8; DACData = SiS_Pr->SiS_P3c9; - shiftflag = 0; - SiS_SetRegByte(SiS_Pr->SiS_P3c6,0xFF); + sf = 0; } else { - shiftflag = 1; DACAddr = SiS_Pr->SiS_Part5Port; DACData = SiS_Pr->SiS_Part5Port + 1; + sf = 2; } SiS_SetRegByte(DACAddr,0x00); - for(i=0; i>= 2; } } if(time == 256) { for(i = 16; i < 32; i++) { - data = table[i]; - if(shiftflag) data <<= 2; + data = table[i] << sf; for(k = 0; k < 3; k++) SiS_SetRegByte(DACData, data); } si = 32; for(m = 0; m < 9; m++) { - di = si; - bx = si + 4; - dl = 0; - for(n = 0; n < 3; n++) { - for(o = 0; o < 5; o++) { - dh = table[si]; - ah = table[di]; - al = table[bx]; + di = si; + bx = si + 4; + for(n = 0; n < 3; n++) { + for(o = 0; o < 5; o++) { + SiS_WriteDAC(SiS_Pr, DACData, sf, n, table[di], table[bx], table[si]); si++; - SiS_WriteDAC(SiS_Pr, DACData, shiftflag, dl, ah, al, dh); } si -= 2; for(o = 0; o < 3; o++) { - dh = table[bx]; - ah = table[di]; - al = table[si]; + SiS_WriteDAC(SiS_Pr, DACData, sf, n, table[di], table[si], table[bx]); si--; - SiS_WriteDAC(SiS_Pr, DACData, shiftflag, dl, ah, al, dh); } - dl++; } /* for n < 3 */ si += 5; } /* for m < 9 */ @@ -3241,89 +2972,114 @@ SiS_LoadDAC(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, /*********************************************/ static void -SiS_SetCRT1Group(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, - USHORT ModeNo, USHORT ModeIdIndex) +SiS_SetCRT1Group(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short ModeIdIndex) { - USHORT StandTableIndex,RefreshRateTableIndex; - - SiS_Pr->SiS_CRT1Mode = ModeNo; - StandTableIndex = SiS_GetModePtr(SiS_Pr, ModeNo, ModeIdIndex); - if(SiS_Pr->SiS_SetFlag & LowModeTests) { - if(SiS_Pr->SiS_VBInfo & (SetSimuScanMode | SwitchCRT2)) { - SiS_DisableBridge(SiS_Pr, HwInfo); - } - } - - SiS_ResetSegmentRegisters(SiS_Pr, HwInfo); - - SiS_SetSeqRegs(SiS_Pr, StandTableIndex, HwInfo); - SiS_SetMiscRegs(SiS_Pr, StandTableIndex, HwInfo); - SiS_SetCRTCRegs(SiS_Pr, HwInfo, StandTableIndex); - SiS_SetATTRegs(SiS_Pr, StandTableIndex, HwInfo); - SiS_SetGRCRegs(SiS_Pr, StandTableIndex); - SiS_ClearExt1Regs(SiS_Pr, HwInfo, ModeNo); - SiS_ResetCRT1VCLK(SiS_Pr, HwInfo); - - SiS_Pr->SiS_SelectCRT2Rate = 0; - SiS_Pr->SiS_SetFlag &= (~ProgrammingCRT2); - -#ifdef LINUX_XF86 - xf86DrvMsgVerb(0, X_PROBED, 4, "(init: VBType=0x%04x, VBInfo=0x%04x)\n", + unsigned short StandTableIndex, RefreshRateTableIndex; + + SiS_Pr->SiS_CRT1Mode = ModeNo; + + StandTableIndex = SiS_GetModePtr(SiS_Pr, ModeNo, ModeIdIndex); + + if(SiS_Pr->SiS_SetFlag & LowModeTests) { + if(SiS_Pr->SiS_VBInfo & (SetSimuScanMode | SwitchCRT2)) { + SiS_DisableBridge(SiS_Pr); + } + } + + SiS_ResetSegmentRegisters(SiS_Pr); + + SiS_SetSeqRegs(SiS_Pr, StandTableIndex); + SiS_SetMiscRegs(SiS_Pr, StandTableIndex); + SiS_SetCRTCRegs(SiS_Pr, StandTableIndex); + SiS_SetATTRegs(SiS_Pr, StandTableIndex); + SiS_SetGRCRegs(SiS_Pr, StandTableIndex); + SiS_ClearExt1Regs(SiS_Pr, ModeNo); + SiS_ResetCRT1VCLK(SiS_Pr); + + SiS_Pr->SiS_SelectCRT2Rate = 0; + SiS_Pr->SiS_SetFlag &= (~ProgrammingCRT2); + +#ifdef SIS_XORG_XF86 + xf86DrvMsgVerb(0, X_PROBED, 4, "(init: VBType=0x%04x, VBInfo=0x%04x)\n", SiS_Pr->SiS_VBType, SiS_Pr->SiS_VBInfo); #endif - if(SiS_Pr->SiS_VBInfo & SetSimuScanMode) { - if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { - SiS_Pr->SiS_SetFlag |= ProgrammingCRT2; - } - } + if(SiS_Pr->SiS_VBInfo & SetSimuScanMode) { + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { + SiS_Pr->SiS_SetFlag |= ProgrammingCRT2; + } + } - if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { - SiS_Pr->SiS_SetFlag |= ProgrammingCRT2; - } + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { + SiS_Pr->SiS_SetFlag |= ProgrammingCRT2; + } - RefreshRateTableIndex = SiS_GetRatePtr(SiS_Pr, ModeNo, ModeIdIndex, HwInfo); + RefreshRateTableIndex = SiS_GetRatePtr(SiS_Pr, ModeNo, ModeIdIndex); - if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) { - SiS_Pr->SiS_SetFlag &= ~ProgrammingCRT2; - } + if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) { + SiS_Pr->SiS_SetFlag &= ~ProgrammingCRT2; + } - if(RefreshRateTableIndex != 0xFFFF) { - SiS_SetCRT1Sync(SiS_Pr, RefreshRateTableIndex); - SiS_SetCRT1CRTC(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, HwInfo); - SiS_SetCRT1Offset(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, HwInfo); - SiS_SetCRT1VCLK(SiS_Pr, ModeNo, ModeIdIndex, HwInfo, RefreshRateTableIndex); - } + if(RefreshRateTableIndex != 0xFFFF) { + SiS_SetCRT1Sync(SiS_Pr, RefreshRateTableIndex); + SiS_SetCRT1CRTC(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex); + SiS_SetCRT1Offset(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex); + SiS_SetCRT1VCLK(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex); + } + switch(SiS_Pr->ChipType) { #ifdef SIS300 - if(HwInfo->jChipType == SIS_300) { - SiS_SetCRT1FIFO_300(SiS_Pr, ModeNo,HwInfo,RefreshRateTableIndex); - } else if((HwInfo->jChipType == SIS_630) || - (HwInfo->jChipType == SIS_730) || - (HwInfo->jChipType == SIS_540)) { - SiS_SetCRT1FIFO_630(SiS_Pr, ModeNo, HwInfo, RefreshRateTableIndex); - } + case SIS_300: + SiS_SetCRT1FIFO_300(SiS_Pr, ModeNo, RefreshRateTableIndex); + break; + case SIS_540: + case SIS_630: + case SIS_730: + SiS_SetCRT1FIFO_630(SiS_Pr, ModeNo, RefreshRateTableIndex); + break; #endif + default: #ifdef SIS315H - if(HwInfo->jChipType >= SIS_315H) { - SiS_SetCRT1FIFO_310(SiS_Pr, ModeNo, ModeIdIndex, HwInfo); - } + if(SiS_Pr->ChipType == XGI_20) { + unsigned char sr2b = 0, sr2c = 0; + switch(ModeNo) { + case 0x00: + case 0x01: sr2b = 0x4e; sr2c = 0xe9; break; + case 0x04: + case 0x05: + case 0x0d: sr2b = 0x1b; sr2c = 0xe3; break; + } + if(sr2b) { + SiS_SetReg(SiS_Pr->SiS_P3c4,0x2b,sr2b); + SiS_SetReg(SiS_Pr->SiS_P3c4,0x2c,sr2c); + SiS_SetRegByte(SiS_Pr->SiS_P3c2,(SiS_GetRegByte(SiS_Pr->SiS_P3cc) | 0x0c)); + } + } + SiS_SetCRT1FIFO_310(SiS_Pr, ModeNo, ModeIdIndex); #endif + break; + } + + SiS_SetCRT1ModeRegs(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex); - SiS_SetCRT1ModeRegs(SiS_Pr, HwInfo, ModeNo, ModeIdIndex, RefreshRateTableIndex); +#ifdef SIS315H + if(SiS_Pr->ChipType == XGI_40) { + SiS_SetupDualChip(SiS_Pr); + } +#endif - SiS_LoadDAC(SiS_Pr, HwInfo, ModeNo, ModeIdIndex); + SiS_LoadDAC(SiS_Pr, ModeNo, ModeIdIndex); -#ifdef LINUX_KERNEL - if(SiS_Pr->SiS_flag_clearbuffer) { - SiS_ClearBuffer(SiS_Pr,HwInfo,ModeNo); - } +#ifdef SIS_LINUX_KERNEL + if(SiS_Pr->SiS_flag_clearbuffer) { + SiS_ClearBuffer(SiS_Pr, ModeNo); + } #endif - if(!(SiS_Pr->SiS_VBInfo & (SetSimuScanMode | SwitchCRT2 | SetCRT2ToLCDA))) { - SiS_WaitRetrace1(SiS_Pr); - SiS_DisplayOn(SiS_Pr); - } + if(!(SiS_Pr->SiS_VBInfo & (SetSimuScanMode | SwitchCRT2 | SetCRT2ToLCDA))) { + SiS_WaitRetrace1(SiS_Pr); + SiS_DisplayOn(SiS_Pr); + } } /*********************************************/ @@ -3331,33 +3087,62 @@ SiS_SetCRT1Group(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, /*********************************************/ static void -SiS_ResetVB(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) +SiS_InitVB(struct SiS_Private *SiS_Pr) +{ + unsigned char *ROMAddr = SiS_Pr->VirtualRomBase; + + SiS_Pr->Init_P4_0E = 0; + if(SiS_Pr->SiS_ROMNew) { + SiS_Pr->Init_P4_0E = ROMAddr[0x82]; + } else if(SiS_Pr->ChipType >= XGI_40) { + if(SiS_Pr->SiS_XGIROM) { + SiS_Pr->Init_P4_0E = ROMAddr[0x80]; + } + } +} + +static void +SiS_ResetVB(struct SiS_Private *SiS_Pr) { - UCHAR *ROMAddr = HwInfo->pjVirtualRomBase; - USHORT temp; +#ifdef SIS315H + unsigned char *ROMAddr = SiS_Pr->VirtualRomBase; + unsigned short temp; /* VB programming clock */ if(SiS_Pr->SiS_UseROM) { - if(HwInfo->jChipType < SIS_330) { - temp = ROMAddr[VB310Data_1_2_Offset] | 0x40; + if(SiS_Pr->ChipType < SIS_330) { + temp = ROMAddr[VB310Data_1_2_Offset] | 0x40; if(SiS_Pr->SiS_ROMNew) temp = ROMAddr[0x80] | 0x40; SiS_SetReg(SiS_Pr->SiS_Part1Port,0x02,temp); - } else if(HwInfo->jChipType >= SIS_661) { - temp = ROMAddr[0x7e] | 0x40; - if(SiS_Pr->SiS_ROMNew) temp = ROMAddr[0x80] | 0x40; + } else if(SiS_Pr->ChipType >= SIS_661 && SiS_Pr->ChipType < XGI_20) { + temp = ROMAddr[0x7e] | 0x40; + if(SiS_Pr->SiS_ROMNew) temp = ROMAddr[0x80] | 0x40; SiS_SetReg(SiS_Pr->SiS_Part1Port,0x02,temp); } + } else if(SiS_Pr->ChipType >= XGI_40) { + temp = 0x40; + if(SiS_Pr->SiS_XGIROM) temp |= ROMAddr[0x7e]; + /* Can we do this on any chipset? */ + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x02,temp); } +#endif } /*********************************************/ -/* HELPER: SET VIDEO REGISTERS */ +/* HELPER: SET VIDEO/CAPTURE REGISTERS */ /*********************************************/ static void -SiS_StrangeStuff(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) +SiS_StrangeStuff(struct SiS_Private *SiS_Pr) { - if((IS_SIS651) || (IS_SISM650)) { + /* SiS65x and XGI set up some sort of "lock mode" for text + * which locks CRT2 in some way to CRT1 timing. Disable + * this here. + */ +#ifdef SIS315H + if((IS_SIS651) || (IS_SISM650) || + SiS_Pr->ChipType == SIS_340 || + SiS_Pr->ChipType == XGI_40) { SiS_SetReg(SiS_Pr->SiS_VidCapt, 0x3f, 0x00); /* Fiddle with capture regs */ SiS_SetReg(SiS_Pr->SiS_VidCapt, 0x00, 0x00); SiS_SetReg(SiS_Pr->SiS_VidPlay, 0x00, 0x86); /* (BIOS does NOT unlock) */ @@ -3365,49 +3150,99 @@ SiS_StrangeStuff(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) SiS_SetRegAND(SiS_Pr->SiS_VidPlay, 0x3f, 0xef); } /* !!! This does not support modes < 0x13 !!! */ +#endif +} + +/*********************************************/ +/* HELPER: SET AGP TIMING FOR SiS760 */ +/*********************************************/ + +static void +SiS_Handle760(struct SiS_Private *SiS_Pr) +{ +#ifdef SIS315H + unsigned int somebase; + unsigned char temp1, temp2, temp3; + + if( (SiS_Pr->ChipType != SIS_760) || + ((SiS_GetReg(SiS_Pr->SiS_P3d4, 0x5c) & 0xf8) != 0x80) || + (!(SiS_Pr->SiS_SysFlags & SF_760LFB)) || + (!(SiS_Pr->SiS_SysFlags & SF_760UMA)) ) + return; + +#ifdef SIS_LINUX_KERNEL + somebase = sisfb_read_mio_pci_word(SiS_Pr, 0x74); +#else + somebase = pciReadWord(0x00001000, 0x74); +#endif + somebase &= 0xffff; + + if(somebase == 0) return; + + temp3 = SiS_GetRegByte((somebase + 0x85)) & 0xb7; + + if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x31) & 0x40) { + temp1 = 0x21; + temp2 = 0x03; + temp3 |= 0x08; + } else { + temp1 = 0x25; + temp2 = 0x0b; + } + +#ifdef SIS_LINUX_KERNEL + sisfb_write_nbridge_pci_byte(SiS_Pr, 0x7e, temp1); + sisfb_write_nbridge_pci_byte(SiS_Pr, 0x8d, temp2); +#else + pciWriteByte(0x00000000, 0x7e, temp1); + pciWriteByte(0x00000000, 0x8d, temp2); +#endif + + SiS_SetRegByte((somebase + 0x85), temp3); +#endif } /*********************************************/ -/* XFree86: SET SCREEN PITCH */ +/* X.org/XFree86: SET SCREEN PITCH */ /*********************************************/ -#ifdef LINUX_XF86 +#ifdef SIS_XORG_XF86 static void -SiS_SetPitchCRT1(SiS_Private *SiS_Pr, ScrnInfoPtr pScrn) +SiS_SetPitchCRT1(struct SiS_Private *SiS_Pr, ScrnInfoPtr pScrn) { SISPtr pSiS = SISPTR(pScrn); - UShort HDisplay = pSiS->scrnPitch >> 3; + unsigned short HDisplay = pSiS->scrnPitch >> 3; SiS_SetReg(SiS_Pr->SiS_P3d4,0x13,(HDisplay & 0xFF)); - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0E,0xF0,(HDisplay>>8)); + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0E,0xF0,(HDisplay >> 8)); } static void -SiS_SetPitchCRT2(SiS_Private *SiS_Pr, ScrnInfoPtr pScrn) +SiS_SetPitchCRT2(struct SiS_Private *SiS_Pr, ScrnInfoPtr pScrn) { SISPtr pSiS = SISPTR(pScrn); - UShort HDisplay = pSiS->scrnPitch2 >> 3; + unsigned short HDisplay = pSiS->scrnPitch2 >> 3; /* Unlock CRT2 */ if(pSiS->VGAEngine == SIS_315_VGA) - SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2F, 0x01); + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2F, 0x01); else - SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x24, 0x01); + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x24, 0x01); SiS_SetReg(SiS_Pr->SiS_Part1Port,0x07,(HDisplay & 0xFF)); SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x09,0xF0,(HDisplay >> 8)); } static void -SiS_SetPitch(SiS_Private *SiS_Pr, ScrnInfoPtr pScrn) +SiS_SetPitch(struct SiS_Private *SiS_Pr, ScrnInfoPtr pScrn) { SISPtr pSiS = SISPTR(pScrn); BOOLEAN isslavemode = FALSE; - if( (pSiS->VBFlags & VB_VIDEOBRIDGE) && + if( (pSiS->VBFlags2 & VB2_VIDEOBRIDGE) && ( ((pSiS->VGAEngine == SIS_300_VGA) && - (SiS_GetReg(SiS_Pr->SiS_Part1Port,0x00) & 0xa0) == 0x20) || - ((pSiS->VGAEngine == SIS_315_VGA) && + (SiS_GetReg(SiS_Pr->SiS_Part1Port,0x00) & 0xa0) == 0x20) || + ((pSiS->VGAEngine == SIS_315_VGA) && (SiS_GetReg(SiS_Pr->SiS_Part1Port,0x00) & 0x50) == 0x10) ) ) { isslavemode = TRUE; } @@ -3427,59 +3262,59 @@ SiS_SetPitch(SiS_Private *SiS_Pr, ScrnInfoPtr pScrn) /* SiSSetMode() */ /*********************************************/ -#ifdef LINUX_XF86 +#ifdef SIS_XORG_XF86 /* We need pScrn for setting the pitch correctly */ BOOLEAN -SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,ScrnInfoPtr pScrn,USHORT ModeNo, BOOLEAN dosetpitch) +SiSSetMode(struct SiS_Private *SiS_Pr, ScrnInfoPtr pScrn, unsigned short ModeNo, BOOLEAN dosetpitch) #else BOOLEAN -SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo) +SiSSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo) #endif { - USHORT ModeIdIndex; - SISIOADDRESS BaseAddr = HwInfo->ulIOAddress; - unsigned char backupreg=0; -#ifdef LINUX_KERNEL - USHORT KeepLockReg; - ULONG temp; + SISIOADDRESS BaseAddr = SiS_Pr->IOAddress; + unsigned short RealModeNo, ModeIdIndex; + unsigned char backupreg = 0; +#ifdef SIS_LINUX_KERNEL + unsigned short KeepLockReg; SiS_Pr->UseCustomMode = FALSE; SiS_Pr->CRT1UsesCustomMode = FALSE; #endif + SiS_Pr->SiS_flag_clearbuffer = 0; + if(SiS_Pr->UseCustomMode) { ModeNo = 0xfe; + } else { +#ifdef SIS_LINUX_KERNEL + if(!(ModeNo & 0x80)) SiS_Pr->SiS_flag_clearbuffer = 1; +#endif + ModeNo &= 0x7f; } - SiSInitPtr(SiS_Pr, HwInfo); + /* Don't use FSTN mode for CRT1 */ + RealModeNo = ModeNo; + if(ModeNo == 0x5b) ModeNo = 0x56; + + SiSInitPtr(SiS_Pr); SiSRegInit(SiS_Pr, BaseAddr); - SiS_GetSysFlags(SiS_Pr, HwInfo); + SiS_GetSysFlags(SiS_Pr); -#if defined(LINUX_XF86) && (defined(i386) || defined(__i386) || defined(__i386__) || defined(__AMD64__)) + SiS_Pr->SiS_VGAINFO = 0x11; +#if defined(SIS_XORG_XF86) && (defined(i386) || defined(__i386) || defined(__i386__) || defined(__AMD64__) || defined(__amd64__) || defined(__x86_64__)) if(pScrn) SiS_Pr->SiS_VGAINFO = SiS_GetSetBIOSScratch(pScrn, 0x489, 0xff); - else -#endif - SiS_Pr->SiS_VGAINFO = 0x11; - - SiSInitPCIetc(SiS_Pr, HwInfo); - SiSSetLVDSetc(SiS_Pr, HwInfo); - SiSDetermineROMUsage(SiS_Pr, HwInfo); - - SiS_Pr->SiS_flag_clearbuffer = 0; - - if(!SiS_Pr->UseCustomMode) { -#ifdef LINUX_KERNEL - if(!(ModeNo & 0x80)) SiS_Pr->SiS_flag_clearbuffer = 1; #endif - ModeNo &= 0x7f; - } -#ifdef LINUX_KERNEL +#ifdef SIS_LINUX_KERNEL KeepLockReg = SiS_GetReg(SiS_Pr->SiS_P3c4,0x05); #endif SiS_SetReg(SiS_Pr->SiS_P3c4,0x05,0x86); - SiS_UnLockCRT2(SiS_Pr, HwInfo); + SiSInitPCIetc(SiS_Pr); + SiSSetLVDSetc(SiS_Pr); + SiSDetermineROMUsage(SiS_Pr); + + SiS_UnLockCRT2(SiS_Pr); if(!SiS_Pr->UseCustomMode) { if(!(SiS_SearchModeID(SiS_Pr, &ModeNo, &ModeIdIndex))) return FALSE; @@ -3487,13 +3322,13 @@ SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo) ModeIdIndex = 0; } - SiS_GetVBType(SiS_Pr, HwInfo); + SiS_GetVBType(SiS_Pr); /* Init/restore some VB registers */ - - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - if(HwInfo->jChipType >= SIS_315H) { - SiS_ResetVB(SiS_Pr, HwInfo); + SiS_InitVB(SiS_Pr); + if(SiS_Pr->SiS_VBType & VB_SIS30xBLV) { + if(SiS_Pr->ChipType >= SIS_315H) { + SiS_ResetVB(SiS_Pr); SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x32,0x10); SiS_SetRegOR(SiS_Pr->SiS_Part2Port,0x00,0x0c); backupreg = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38); @@ -3503,21 +3338,20 @@ SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo) } /* Get VB information (connectors, connected devices) */ - SiS_GetVBInfo(SiS_Pr, ModeNo, ModeIdIndex, HwInfo, (SiS_Pr->UseCustomMode) ? 0 : 1); - SiS_SetYPbPr(SiS_Pr, HwInfo); - SiS_SetTVMode(SiS_Pr, ModeNo, ModeIdIndex, HwInfo); - SiS_GetLCDResInfo(SiS_Pr, ModeNo, ModeIdIndex, HwInfo); - SiS_SetLowModeTest(SiS_Pr, ModeNo, HwInfo); - -#ifdef LINUX_KERNEL - /* 3. Check memory size (Kernel framebuffer driver only) */ - temp = SiS_CheckMemorySize(SiS_Pr, HwInfo, ModeNo, ModeIdIndex); - if(!temp) return(0); + SiS_GetVBInfo(SiS_Pr, ModeNo, ModeIdIndex, (SiS_Pr->UseCustomMode) ? 0 : 1); + SiS_SetYPbPr(SiS_Pr); + SiS_SetTVMode(SiS_Pr, ModeNo, ModeIdIndex); + SiS_GetLCDResInfo(SiS_Pr, ModeNo, ModeIdIndex); + SiS_SetLowModeTest(SiS_Pr, ModeNo); + +#ifdef SIS_LINUX_KERNEL + /* Check memory size (kernel framebuffer driver only) */ + if(!SiS_CheckMemorySize(SiS_Pr, ModeNo, ModeIdIndex)) { + return FALSE; + } #endif - if(HwInfo->jChipType >= SIS_315H) { - SiS_SetupCR5x(SiS_Pr, HwInfo); - } + SiS_OpenCRTC(SiS_Pr); if(SiS_Pr->UseCustomMode) { SiS_Pr->CRT1UsesCustomMode = TRUE; @@ -3530,38 +3364,41 @@ SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo) /* Set mode on CRT1 */ if( (SiS_Pr->SiS_VBInfo & (SetSimuScanMode | SetCRT2ToLCDA)) || (!(SiS_Pr->SiS_VBInfo & SwitchCRT2)) ) { - SiS_SetCRT1Group(SiS_Pr, HwInfo, ModeNo, ModeIdIndex); + SiS_SetCRT1Group(SiS_Pr, ModeNo, ModeIdIndex); } /* Set mode on CRT2 */ if(SiS_Pr->SiS_VBInfo & (SetSimuScanMode | SwitchCRT2 | SetCRT2ToLCDA)) { if( (SiS_Pr->SiS_VBType & VB_SISVB) || - (SiS_Pr->SiS_IF_DEF_LVDS == 1) || - (SiS_Pr->SiS_IF_DEF_CH70xx != 0) || - (SiS_Pr->SiS_IF_DEF_TRUMPION != 0) ) { - SiS_SetCRT2Group(SiS_Pr, HwInfo, ModeNo); + (SiS_Pr->SiS_IF_DEF_LVDS == 1) || + (SiS_Pr->SiS_IF_DEF_CH70xx != 0) || + (SiS_Pr->SiS_IF_DEF_TRUMPION != 0) ) { + SiS_SetCRT2Group(SiS_Pr, RealModeNo); } } SiS_HandleCRT1(SiS_Pr); - SiS_StrangeStuff(SiS_Pr, HwInfo); + SiS_StrangeStuff(SiS_Pr); SiS_DisplayOn(SiS_Pr); SiS_SetRegByte(SiS_Pr->SiS_P3c6,0xFF); - if(HwInfo->jChipType >= SIS_315H) { +#ifdef SIS315H + if(SiS_Pr->ChipType >= SIS_315H) { if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { - if(!(SiS_IsDualEdge(SiS_Pr, HwInfo))) { + if(!(SiS_IsDualEdge(SiS_Pr))) { SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x13,0xfb); } } } +#endif - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - if(HwInfo->jChipType >= SIS_315H) { - if(!SiS_Pr->SiS_ROMNew) { - if(SiS_IsVAMode(SiS_Pr,HwInfo)) { + if(SiS_Pr->SiS_VBType & VB_SIS30xBLV) { + if(SiS_Pr->ChipType >= SIS_315H) { +#ifdef SIS315H + if(!SiS_Pr->SiS_ROMNew) { + if(SiS_IsVAMode(SiS_Pr)) { SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x35,0x01); } else { SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x35,0xFE); @@ -3574,23 +3411,24 @@ SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo) if((ModeNo == 0x03) || (ModeNo == 0x10)) { SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x51,0x80); SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x56,0x08); - } + } } if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x30) & SetCRT2ToLCD) { SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x38,0xfc); } - } else if((HwInfo->jChipType == SIS_630) || - (HwInfo->jChipType == SIS_730)) { - SiS_SetReg(SiS_Pr->SiS_P3d4,0x35,backupreg); +#endif + } else if((SiS_Pr->ChipType == SIS_630) || + (SiS_Pr->ChipType == SIS_730)) { + SiS_SetReg(SiS_Pr->SiS_P3d4,0x35,backupreg); } } -#ifdef LINUX_XF86 +#ifdef SIS_XORG_XF86 if(pScrn) { /* SetPitch: Adapt to virtual size & position */ if((ModeNo > 0x13) && (dosetpitch)) { - SiS_SetPitch(SiS_Pr, pScrn); + SiS_SetPitch(SiS_Pr, pScrn); } /* Backup/Set ModeNo in BIOS scratch area */ @@ -3598,33 +3436,37 @@ SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo) } #endif -#ifdef LINUX_KERNEL /* We never lock registers in XF86 */ - if(KeepLockReg == 0xA1) SiS_SetReg(SiS_Pr->SiS_P3c4,0x05,0x86); - else SiS_SetReg(SiS_Pr->SiS_P3c4,0x05,0x00); + SiS_CloseCRTC(SiS_Pr); + + SiS_Handle760(SiS_Pr); + +#ifdef SIS_LINUX_KERNEL + /* We never lock registers in XF86 */ + if(KeepLockReg != 0xA1) SiS_SetReg(SiS_Pr->SiS_P3c4,0x05,0x00); #endif return TRUE; } /*********************************************/ -/* XFree86: SiSBIOSSetMode() */ +/* X.org/XFree86: SiSBIOSSetMode() */ /* for non-Dual-Head mode */ /*********************************************/ -#ifdef LINUX_XF86 +#ifdef SIS_XORG_XF86 BOOLEAN -SiSBIOSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn, +SiSBIOSSetMode(struct SiS_Private *SiS_Pr, ScrnInfoPtr pScrn, DisplayModePtr mode, BOOLEAN IsCustom) { SISPtr pSiS = SISPTR(pScrn); - UShort ModeNo = 0; + unsigned short ModeNo = 0; SiS_Pr->UseCustomMode = FALSE; if((IsCustom) && (SiS_CheckBuildCustomMode(pScrn, mode, pSiS->VBFlags))) { xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "Setting custom mode %dx%d\n", - SiS_Pr->CHDisplay, + SiS_Pr->CHDisplay, (mode->Flags & V_INTERLACE ? SiS_Pr->CVDisplay * 2 : (mode->Flags & V_DBLSCAN ? SiS_Pr->CVDisplay / 2 : SiS_Pr->CVDisplay))); @@ -3632,32 +3474,33 @@ SiSBIOSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn, } else { /* Don't need vbflags here; checks done earlier */ - ModeNo = SiS_GetModeNumber(pScrn, mode, 0); + ModeNo = SiS_GetModeNumber(pScrn, mode, pSiS->VBFlags); if(!ModeNo) return FALSE; xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "Setting standard mode 0x%x\n", ModeNo); } - return(SiSSetMode(SiS_Pr, HwInfo, pScrn, ModeNo, TRUE)); + return(SiSSetMode(SiS_Pr, pScrn, ModeNo, TRUE)); } /*********************************************/ -/* XFree86: SiSBIOSSetModeCRT2() */ +/* X.org/XFree86: SiSBIOSSetModeCRT2() */ /* for Dual-Head modes */ /*********************************************/ + BOOLEAN -SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn, +SiSBIOSSetModeCRT2(struct SiS_Private *SiS_Pr, ScrnInfoPtr pScrn, DisplayModePtr mode, BOOLEAN IsCustom) { - USHORT ModeIdIndex; - SISIOADDRESS BaseAddr = HwInfo->ulIOAddress; - UShort ModeNo = 0; - unsigned char backupreg=0; - SISPtr pSiS = SISPTR(pScrn); + SISIOADDRESS BaseAddr = SiS_Pr->IOAddress; + SISPtr pSiS = SISPTR(pScrn); #ifdef SISDUALHEAD SISEntPtr pSiSEnt = pSiS->entityPrivate; #endif + unsigned short ModeIdIndex; + unsigned short ModeNo = 0; + unsigned char backupreg = 0; SiS_Pr->UseCustomMode = FALSE; @@ -3672,22 +3515,25 @@ SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn, } else { - ModeNo = SiS_GetModeNumber(pScrn, mode, 0); - if(!ModeNo) return FALSE; + ModeNo = SiS_GetModeNumber(pScrn, mode, pSiS->VBFlags); + if(!ModeNo) return FALSE; } SiSRegInit(SiS_Pr, BaseAddr); - SiSInitPtr(SiS_Pr, HwInfo); - SiS_GetSysFlags(SiS_Pr, HwInfo); -#if (defined(i386) || defined(__i386) || defined(__i386__) || defined(__AMD64__)) + SiSInitPtr(SiS_Pr); + SiS_GetSysFlags(SiS_Pr); +#if defined(i386) || defined(__i386) || defined(__i386__) || defined(__AMD64__) || defined(__amd64__) || defined(__x86_64__) SiS_Pr->SiS_VGAINFO = SiS_GetSetBIOSScratch(pScrn, 0x489, 0xff); #else SiS_Pr->SiS_VGAINFO = 0x11; #endif - SiSInitPCIetc(SiS_Pr, HwInfo); - SiSSetLVDSetc(SiS_Pr, HwInfo); - SiSDetermineROMUsage(SiS_Pr, HwInfo); + + SiS_SetReg(SiS_Pr->SiS_P3c4,0x05,0x86); + + SiSInitPCIetc(SiS_Pr); + SiSSetLVDSetc(SiS_Pr); + SiSDetermineROMUsage(SiS_Pr); /* Save mode info so we can set it from within SetMode for CRT1 */ #ifdef SISDUALHEAD @@ -3700,23 +3546,20 @@ SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn, pSiSEnt->CRT2CR35 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35); pSiSEnt->CRT2CR38 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38); #if 0 - /* We can't set CRT2 mode before CRT1 mode is set */ + /* We can't set CRT2 mode before CRT1 mode is set - says who...? */ if(pSiSEnt->CRT1ModeNo == -1) { - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "Setting CRT2 mode delayed until after setting CRT1 mode\n"); - return TRUE; + return TRUE; } #endif pSiSEnt->CRT2ModeSet = TRUE; } #endif - /* We don't clear the buffer in X */ - SiS_Pr->SiS_flag_clearbuffer=0; - if(SiS_Pr->UseCustomMode) { - USHORT temptemp = SiS_Pr->CVDisplay; + unsigned short temptemp = SiS_Pr->CVDisplay; if(SiS_Pr->CModeFlag & DoubleScanMode) temptemp >>= 1; else if(SiS_Pr->CInfoFlag & InterlaceMode) temptemp <<= 1; @@ -3728,13 +3571,11 @@ SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn, } else { xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "Setting standard mode 0x%x on CRT2\n", ModeNo); + "Setting standard mode 0x%x on CRT2\n", ModeNo); } - SiS_SetReg(SiS_Pr->SiS_P3c4,0x05,0x86); - - SiS_UnLockCRT2(SiS_Pr, HwInfo); + SiS_UnLockCRT2(SiS_Pr); if(!SiS_Pr->UseCustomMode) { if(!(SiS_SearchModeID(SiS_Pr, &ModeNo, &ModeIdIndex))) return FALSE; @@ -3742,56 +3583,59 @@ SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn, ModeIdIndex = 0; } - SiS_GetVBType(SiS_Pr, HwInfo); + SiS_GetVBType(SiS_Pr); - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - if(HwInfo->jChipType >= SIS_315H) { - SiS_ResetVB(SiS_Pr, HwInfo); + SiS_InitVB(SiS_Pr); + if(SiS_Pr->SiS_VBType & VB_SIS30xBLV) { + if(SiS_Pr->ChipType >= SIS_315H) { + SiS_ResetVB(SiS_Pr); SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x32,0x10); SiS_SetRegOR(SiS_Pr->SiS_Part2Port,0x00,0x0c); - backupreg = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38); + backupreg = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38); } else { - backupreg = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35); + backupreg = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35); } } /* Get VB information (connectors, connected devices) */ if(!SiS_Pr->UseCustomMode) { - SiS_GetVBInfo(SiS_Pr, ModeNo, ModeIdIndex, HwInfo, 1); + SiS_GetVBInfo(SiS_Pr, ModeNo, ModeIdIndex, 1); } else { /* If this is a custom mode, we don't check the modeflag for CRT2Mode */ - SiS_GetVBInfo(SiS_Pr, ModeNo, ModeIdIndex, HwInfo, 0); + SiS_GetVBInfo(SiS_Pr, ModeNo, ModeIdIndex, 0); } - SiS_SetYPbPr(SiS_Pr, HwInfo); - SiS_SetTVMode(SiS_Pr, ModeNo, ModeIdIndex, HwInfo); - SiS_GetLCDResInfo(SiS_Pr, ModeNo, ModeIdIndex, HwInfo); - SiS_SetLowModeTest(SiS_Pr, ModeNo, HwInfo); + SiS_SetYPbPr(SiS_Pr); + SiS_SetTVMode(SiS_Pr, ModeNo, ModeIdIndex); + SiS_GetLCDResInfo(SiS_Pr, ModeNo, ModeIdIndex); + SiS_SetLowModeTest(SiS_Pr, ModeNo); + + SiS_ResetSegmentRegisters(SiS_Pr); /* Set mode on CRT2 */ if( (SiS_Pr->SiS_VBType & VB_SISVB) || (SiS_Pr->SiS_IF_DEF_LVDS == 1) || (SiS_Pr->SiS_IF_DEF_CH70xx != 0) || (SiS_Pr->SiS_IF_DEF_TRUMPION != 0) ) { - SiS_SetCRT2Group(SiS_Pr, HwInfo, ModeNo); + SiS_SetCRT2Group(SiS_Pr, ModeNo); } - SiS_StrangeStuff(SiS_Pr, HwInfo); + SiS_StrangeStuff(SiS_Pr); SiS_DisplayOn(SiS_Pr); SiS_SetRegByte(SiS_Pr->SiS_P3c6,0xFF); - if(HwInfo->jChipType >= SIS_315H) { + if(SiS_Pr->ChipType >= SIS_315H) { if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { - if(!(SiS_IsDualEdge(SiS_Pr, HwInfo))) { + if(!(SiS_IsDualEdge(SiS_Pr))) { SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x13,0xfb); } } } - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - if(HwInfo->jChipType >= SIS_315H) { - if(!SiS_Pr->SiS_ROMNew) { - if(SiS_IsVAMode(SiS_Pr,HwInfo)) { + if(SiS_Pr->SiS_VBType & VB_SIS30xBLV) { + if(SiS_Pr->ChipType >= SIS_315H) { + if(!SiS_Pr->SiS_ROMNew) { + if(SiS_IsVAMode(SiS_Pr)) { SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x35,0x01); } else { SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x35,0xFE); @@ -3803,8 +3647,8 @@ SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn, if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x30) & SetCRT2ToLCD) { SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x38,0xfc); } - } else if((HwInfo->jChipType == SIS_630) || - (HwInfo->jChipType == SIS_730)) { + } else if((SiS_Pr->ChipType == SIS_630) || + (SiS_Pr->ChipType == SIS_730)) { SiS_SetReg(SiS_Pr->SiS_P3d4,0x35,backupreg); } } @@ -3812,25 +3656,27 @@ SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn, /* SetPitch: Adapt to virtual size & position */ SiS_SetPitchCRT2(SiS_Pr, pScrn); + SiS_Handle760(SiS_Pr); + return TRUE; } /*********************************************/ -/* XFree86: SiSBIOSSetModeCRT1() */ +/* X.org/XFree86: SiSBIOSSetModeCRT1() */ /* for Dual-Head modes */ /*********************************************/ BOOLEAN -SiSBIOSSetModeCRT1(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn, +SiSBIOSSetModeCRT1(struct SiS_Private *SiS_Pr, ScrnInfoPtr pScrn, DisplayModePtr mode, BOOLEAN IsCustom) { + SISIOADDRESS BaseAddr = SiS_Pr->IOAddress; SISPtr pSiS = SISPTR(pScrn); - SISIOADDRESS BaseAddr = HwInfo->ulIOAddress; - USHORT ModeIdIndex, ModeNo=0; - UCHAR backupreg=0; + unsigned short ModeIdIndex, ModeNo = 0; + unsigned char backupreg = 0; #ifdef SISDUALHEAD SISEntPtr pSiSEnt = pSiS->entityPrivate; - UCHAR backupcr30, backupcr31, backupcr38, backupcr35, backupp40d=0; + unsigned char backupcr30, backupcr31, backupcr38, backupcr35, backupp40d=0; BOOLEAN backupcustom; #endif @@ -3838,43 +3684,41 @@ SiSBIOSSetModeCRT1(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn, if((IsCustom) && (SiS_CheckBuildCustomMode(pScrn, mode, pSiS->VBFlags))) { - USHORT temptemp = SiS_Pr->CVDisplay; + unsigned short temptemp = SiS_Pr->CVDisplay; - if(SiS_Pr->CModeFlag & DoubleScanMode) temptemp >>= 1; - else if(SiS_Pr->CInfoFlag & InterlaceMode) temptemp <<= 1; + if(SiS_Pr->CModeFlag & DoubleScanMode) temptemp >>= 1; + else if(SiS_Pr->CInfoFlag & InterlaceMode) temptemp <<= 1; - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "Setting custom mode %dx%d on CRT1\n", SiS_Pr->CHDisplay, temptemp); ModeNo = 0xfe; } else { - ModeNo = SiS_GetModeNumber(pScrn, mode, 0); - if(!ModeNo) return FALSE; + ModeNo = SiS_GetModeNumber(pScrn, mode, 0); /* don't give VBFlags */ + if(!ModeNo) return FALSE; - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "Setting standard mode 0x%x on CRT1\n", ModeNo); } - SiSInitPtr(SiS_Pr, HwInfo); + SiSInitPtr(SiS_Pr); SiSRegInit(SiS_Pr, BaseAddr); - SiS_GetSysFlags(SiS_Pr, HwInfo); -#if (defined(i386) || defined(__i386) || defined(__i386__) || defined(__AMD64__)) + SiS_GetSysFlags(SiS_Pr); +#if defined(i386) || defined(__i386) || defined(__i386__) || defined(__AMD64__) || defined(__amd64__) || defined(__x86_64__) SiS_Pr->SiS_VGAINFO = SiS_GetSetBIOSScratch(pScrn, 0x489, 0xff); #else SiS_Pr->SiS_VGAINFO = 0x11; #endif - SiSInitPCIetc(SiS_Pr, HwInfo); - SiSSetLVDSetc(SiS_Pr, HwInfo); - SiSDetermineROMUsage(SiS_Pr, HwInfo); - - /* We don't clear the buffer in X */ - SiS_Pr->SiS_flag_clearbuffer = 0; SiS_SetReg(SiS_Pr->SiS_P3c4,0x05,0x86); - SiS_UnLockCRT2(SiS_Pr, HwInfo); + SiSInitPCIetc(SiS_Pr); + SiSSetLVDSetc(SiS_Pr); + SiSDetermineROMUsage(SiS_Pr); + + SiS_UnLockCRT2(SiS_Pr); if(!SiS_Pr->UseCustomMode) { if(!(SiS_SearchModeID(SiS_Pr, &ModeNo, &ModeIdIndex))) return FALSE; @@ -3883,10 +3727,11 @@ SiSBIOSSetModeCRT1(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn, } /* Determine VBType */ - SiS_GetVBType(SiS_Pr, HwInfo); + SiS_GetVBType(SiS_Pr); - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - if(HwInfo->jChipType >= SIS_315H) { + SiS_InitVB(SiS_Pr); + if(SiS_Pr->SiS_VBType & VB_SIS30xBLV) { + if(SiS_Pr->ChipType >= SIS_315H) { backupreg = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38); } else { backupreg = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35); @@ -3895,25 +3740,29 @@ SiSBIOSSetModeCRT1(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn, /* Get VB information (connectors, connected devices) */ /* (We don't care if the current mode is a CRT2 mode) */ - SiS_GetVBInfo(SiS_Pr, ModeNo, ModeIdIndex, HwInfo, 0); - SiS_SetYPbPr(SiS_Pr, HwInfo); - SiS_SetTVMode(SiS_Pr, ModeNo, ModeIdIndex, HwInfo); - SiS_GetLCDResInfo(SiS_Pr, ModeNo, ModeIdIndex, HwInfo); - SiS_SetLowModeTest(SiS_Pr, ModeNo, HwInfo); + SiS_GetVBInfo(SiS_Pr, ModeNo, ModeIdIndex, 0); + SiS_SetYPbPr(SiS_Pr); + SiS_SetTVMode(SiS_Pr, ModeNo, ModeIdIndex); + SiS_GetLCDResInfo(SiS_Pr, ModeNo, ModeIdIndex); + SiS_SetLowModeTest(SiS_Pr, ModeNo); - if(HwInfo->jChipType >= SIS_315H) { - SiS_SetupCR5x(SiS_Pr, HwInfo); - } + SiS_OpenCRTC(SiS_Pr); /* Set mode on CRT1 */ - SiS_SetCRT1Group(SiS_Pr, HwInfo, ModeNo, ModeIdIndex); + SiS_SetCRT1Group(SiS_Pr, ModeNo, ModeIdIndex); if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { - SiS_SetCRT2Group(SiS_Pr, HwInfo, ModeNo); + SiS_SetCRT2Group(SiS_Pr, ModeNo); } /* SetPitch: Adapt to virtual size & position */ SiS_SetPitchCRT1(SiS_Pr, pScrn); + SiS_HandleCRT1(SiS_Pr); + + SiS_StrangeStuff(SiS_Pr); + + SiS_CloseCRTC(SiS_Pr); + #ifdef SISDUALHEAD if(pSiS->DualHeadMode) { pSiSEnt->CRT1ModeNo = ModeNo; @@ -3933,7 +3782,7 @@ SiSBIOSSetModeCRT1(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn, #ifdef SISDUALHEAD if(pSiS->DualHeadMode) { if(pSiSEnt->CRT2ModeNo != -1) { - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "(Re-)Setting mode for CRT2\n"); backupcustom = SiS_Pr->UseCustomMode; backupcr30 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30); @@ -3952,9 +3801,11 @@ SiSBIOSSetModeCRT1(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn, SiS_SetReg(SiS_Pr->SiS_P3d4,0x35,pSiSEnt->CRT2CR35); SiS_SetReg(SiS_Pr->SiS_P3d4,0x38,pSiSEnt->CRT2CR38); } - SiSBIOSSetModeCRT2(SiS_Pr, HwInfo, pSiSEnt->pScrn_1, + + SiSBIOSSetModeCRT2(SiS_Pr, pSiSEnt->pScrn_1, pSiSEnt->CRT2DMode, pSiSEnt->CRT2IsCustom); - SiS_SetReg(SiS_Pr->SiS_P3d4,0x30,backupcr30); + + SiS_SetReg(SiS_Pr->SiS_P3d4,0x30,backupcr30); SiS_SetReg(SiS_Pr->SiS_P3d4,0x31,backupcr31); SiS_SetReg(SiS_Pr->SiS_P3d4,0x35,backupcr35); SiS_SetReg(SiS_Pr->SiS_P3d4,0x38,backupcr38); @@ -3970,22 +3821,20 @@ SiSBIOSSetModeCRT1(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn, * possibly overwritten */ - SiS_HandleCRT1(SiS_Pr); - - SiS_StrangeStuff(SiS_Pr, HwInfo); - SiS_DisplayOn(SiS_Pr); SiS_SetRegByte(SiS_Pr->SiS_P3c6,0xFF); - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - if(HwInfo->jChipType >= SIS_315H) { + if(SiS_Pr->SiS_VBType & VB_SIS30xBLV) { + if(SiS_Pr->ChipType >= SIS_315H) { SiS_SetReg(SiS_Pr->SiS_P3d4,0x38,backupreg); - } else if((HwInfo->jChipType == SIS_630) || - (HwInfo->jChipType == SIS_730)) { + } else if((SiS_Pr->ChipType == SIS_630) || + (SiS_Pr->ChipType == SIS_730)) { SiS_SetReg(SiS_Pr->SiS_P3d4,0x35,backupreg); } } + SiS_Handle760(SiS_Pr); + /* Backup/Set ModeNo in BIOS scratch area */ SiS_GetSetModeID(pScrn,ModeNo); @@ -3993,84 +3842,6 @@ SiSBIOSSetModeCRT1(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn, } #endif /* Linux_XF86 */ - -#ifdef LINUX_XF86 -BOOLEAN -SiS_GetPanelID(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) -{ - const USHORT PanelTypeTable300[16] = { - 0xc101, 0xc117, 0x0121, 0xc135, 0xc142, 0xc152, 0xc162, 0xc072, - 0xc181, 0xc192, 0xc1a1, 0xc1b6, 0xc1c2, 0xc0d2, 0xc1e2, 0xc1f2 - }; - const USHORT PanelTypeTable31030x[16] = { - 0xc102, 0xc112, 0x0122, 0xc132, 0xc142, 0xc152, 0xc169, 0xc179, - 0x0189, 0xc192, 0xc1a2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 - }; - const USHORT PanelTypeTable310LVDS[16] = { - 0xc111, 0xc122, 0xc133, 0xc144, 0xc155, 0xc166, 0xc177, 0xc188, - 0xc199, 0xc0aa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 - }; - USHORT tempax,tempbx,temp; - - if(HwInfo->jChipType < SIS_315H) { - - tempax = SiS_GetReg(SiS_Pr->SiS_P3c4,0x18); - tempbx = tempax & 0x0F; - if(!(tempax & 0x10)){ - if(SiS_Pr->SiS_IF_DEF_LVDS == 1){ - tempbx = 0; - temp = SiS_GetReg(SiS_Pr->SiS_P3c4,0x38); - if(temp & 0x40) tempbx |= 0x08; - if(temp & 0x20) tempbx |= 0x02; - if(temp & 0x01) tempbx |= 0x01; - temp = SiS_GetReg(SiS_Pr->SiS_P3c4,0x39); - if(temp & 0x80) tempbx |= 0x04; - } else { - return 0; - } - } - tempbx = PanelTypeTable300[tempbx]; - tempbx |= LCDSync; - temp = tempbx & 0x00FF; - SiS_SetReg(SiS_Pr->SiS_P3d4,0x36,temp); - temp = (tempbx & 0xFF00) >> 8; - SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x37,~(LCDSyncBit|LCDRGB18Bit),temp); - - } else { - - if(HwInfo->jChipType >= SIS_661) return 0; - - tempax = SiS_GetReg(SiS_Pr->SiS_P3c4,0x1a); - tempax &= 0x1e; - tempax >>= 1; - if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { - if(tempax == 0) { - /* TODO: Include HUGE detection routine - (Probably not worth bothering) - */ - return 0; - } - temp = tempax & 0xff; - tempax--; - tempbx = PanelTypeTable310LVDS[tempax]; - } else { - tempbx = PanelTypeTable31030x[tempax]; - temp = tempbx & 0xff; - } - SiS_SetReg(SiS_Pr->SiS_P3d4,0x36,temp); - tempbx = (tempbx & 0xff00) >> 8; - temp = tempbx & 0xc1; - SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x37,~(LCDSyncBit|LCDRGB18Bit),temp); - if(SiS_Pr->SiS_VBType & VB_SISVB) { - temp = tempbx & 0x04; - SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x39,0xfb,temp); - } - - } - return 1; -} -#endif - #ifndef GETBITSTR #define BITMASK(h,l) (((unsigned)(1U << ((h)-(l)+1))-1)<<(l)) #define GENMASK(mask) BITMASK(1?mask,0?mask) @@ -4078,26 +3849,28 @@ SiS_GetPanelID(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) #define GETBITSTR(val,from,to) ((GETBITS(val,from)) << (0?to)) #endif -static void -SiS_CalcCRRegisters(SiS_Private *SiS_Pr, int depth) +void +SiS_CalcCRRegisters(struct SiS_Private *SiS_Pr, int depth) { + int x = 1; /* Fix sync */ + SiS_Pr->CCRT1CRTC[0] = ((SiS_Pr->CHTotal >> 3) - 5) & 0xff; /* CR0 */ SiS_Pr->CCRT1CRTC[1] = (SiS_Pr->CHDisplay >> 3) - 1; /* CR1 */ SiS_Pr->CCRT1CRTC[2] = (SiS_Pr->CHBlankStart >> 3) - 1; /* CR2 */ SiS_Pr->CCRT1CRTC[3] = (((SiS_Pr->CHBlankEnd >> 3) - 1) & 0x1F) | 0x80; /* CR3 */ SiS_Pr->CCRT1CRTC[4] = (SiS_Pr->CHSyncStart >> 3) + 3; /* CR4 */ SiS_Pr->CCRT1CRTC[5] = ((((SiS_Pr->CHBlankEnd >> 3) - 1) & 0x20) << 2) | /* CR5 */ - (((SiS_Pr->CHSyncEnd >> 3) + 3) & 0x1F); + (((SiS_Pr->CHSyncEnd >> 3) + 3) & 0x1F); - SiS_Pr->CCRT1CRTC[6] = (SiS_Pr->CVTotal - 2) & 0xFF; /* CR6 */ - SiS_Pr->CCRT1CRTC[7] = (((SiS_Pr->CVTotal - 2) & 0x100) >> 8) /* CR7 */ - | (((SiS_Pr->CVDisplay - 1) & 0x100) >> 7) - | ((SiS_Pr->CVSyncStart & 0x100) >> 6) - | (((SiS_Pr->CVBlankStart - 1) & 0x100) >> 5) + SiS_Pr->CCRT1CRTC[6] = (SiS_Pr->CVTotal - 2) & 0xFF; /* CR6 */ + SiS_Pr->CCRT1CRTC[7] = (((SiS_Pr->CVTotal - 2) & 0x100) >> 8) /* CR7 */ + | (((SiS_Pr->CVDisplay - 1) & 0x100) >> 7) + | (((SiS_Pr->CVSyncStart - x) & 0x100) >> 6) + | (((SiS_Pr->CVBlankStart- 1) & 0x100) >> 5) | 0x10 - | (((SiS_Pr->CVTotal - 2) & 0x200) >> 4) - | (((SiS_Pr->CVDisplay - 1) & 0x200) >> 3) - | ((SiS_Pr->CVSyncStart & 0x200) >> 2); + | (((SiS_Pr->CVTotal - 2) & 0x200) >> 4) + | (((SiS_Pr->CVDisplay - 1) & 0x200) >> 3) + | (((SiS_Pr->CVSyncStart - x) & 0x200) >> 2); SiS_Pr->CCRT1CRTC[16] = ((((SiS_Pr->CVBlankStart - 1) & 0x200) >> 4) >> 5); /* CR9 */ @@ -4106,55 +3879,44 @@ SiS_CalcCRRegisters(SiS_Private *SiS_Pr, int depth) else if(SiS_Pr->CHDisplay >= 640) SiS_Pr->CCRT1CRTC[16] |= 0x40; } -#if 0 - if (mode->VScan >= 32) - regp->CRTC[9] |= 0x1F; - else if (mode->VScan > 1) - regp->CRTC[9] |= mode->VScan - 1; -#endif - - SiS_Pr->CCRT1CRTC[8] = (SiS_Pr->CVSyncStart ) & 0xFF; /* CR10 */ - SiS_Pr->CCRT1CRTC[9] = ((SiS_Pr->CVSyncEnd ) & 0x0F) | 0x80; /* CR11 */ + SiS_Pr->CCRT1CRTC[8] = (SiS_Pr->CVSyncStart - x) & 0xFF; /* CR10 */ + SiS_Pr->CCRT1CRTC[9] = ((SiS_Pr->CVSyncEnd - x) & 0x0F) | 0x80; /* CR11 */ SiS_Pr->CCRT1CRTC[10] = (SiS_Pr->CVDisplay - 1) & 0xFF; /* CR12 */ SiS_Pr->CCRT1CRTC[11] = (SiS_Pr->CVBlankStart - 1) & 0xFF; /* CR15 */ SiS_Pr->CCRT1CRTC[12] = (SiS_Pr->CVBlankEnd - 1) & 0xFF; /* CR16 */ SiS_Pr->CCRT1CRTC[13] = /* SRA */ - GETBITSTR((SiS_Pr->CVTotal -2), 10:10, 0:0) | - GETBITSTR((SiS_Pr->CVDisplay -1), 10:10, 1:1) | - GETBITSTR((SiS_Pr->CVBlankStart-1), 10:10, 2:2) | - GETBITSTR((SiS_Pr->CVSyncStart ), 10:10, 3:3) | - GETBITSTR((SiS_Pr->CVBlankEnd -1), 8:8, 4:4) | - GETBITSTR((SiS_Pr->CVSyncEnd ), 4:4, 5:5) ; + GETBITSTR((SiS_Pr->CVTotal -2), 10:10, 0:0) | + GETBITSTR((SiS_Pr->CVDisplay -1), 10:10, 1:1) | + GETBITSTR((SiS_Pr->CVBlankStart-1), 10:10, 2:2) | + GETBITSTR((SiS_Pr->CVSyncStart -x), 10:10, 3:3) | + GETBITSTR((SiS_Pr->CVBlankEnd -1), 8:8, 4:4) | + GETBITSTR((SiS_Pr->CVSyncEnd ), 4:4, 5:5) ; SiS_Pr->CCRT1CRTC[14] = /* SRB */ - GETBITSTR((SiS_Pr->CHTotal >> 3) - 5, 9:8, 1:0) | - GETBITSTR((SiS_Pr->CHDisplay >> 3) - 1, 9:8, 3:2) | - GETBITSTR((SiS_Pr->CHBlankStart >> 3) - 1, 9:8, 5:4) | - GETBITSTR((SiS_Pr->CHSyncStart >> 3) + 3, 9:8, 7:6) ; + GETBITSTR((SiS_Pr->CHTotal >> 3) - 5, 9:8, 1:0) | + GETBITSTR((SiS_Pr->CHDisplay >> 3) - 1, 9:8, 3:2) | + GETBITSTR((SiS_Pr->CHBlankStart >> 3) - 1, 9:8, 5:4) | + GETBITSTR((SiS_Pr->CHSyncStart >> 3) + 3, 9:8, 7:6) ; SiS_Pr->CCRT1CRTC[15] = /* SRC */ - GETBITSTR((SiS_Pr->CHBlankEnd >> 3) - 1, 7:6, 1:0) | - GETBITSTR((SiS_Pr->CHSyncEnd >> 3) + 3, 5:5, 2:2) ; + GETBITSTR((SiS_Pr->CHBlankEnd >> 3) - 1, 7:6, 1:0) | + GETBITSTR((SiS_Pr->CHSyncEnd >> 3) + 3, 5:5, 2:2) ; } void -SiS_CalcLCDACRT1Timing(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex) +SiS_CalcLCDACRT1Timing(struct SiS_Private *SiS_Pr, unsigned short ModeNo, + unsigned short ModeIdIndex) { - USHORT modeflag, tempax, tempbx, VGAHDE = SiS_Pr->SiS_VGAHDE; - int i,j; + unsigned short modeflag, tempax, tempbx = 0, remaining = 0; + unsigned short VGAHDE = SiS_Pr->SiS_VGAHDE; + int i, j; /* 1:1 data: use data set by setcrt1crtc() */ if(SiS_Pr->SiS_LCDInfo & LCDPass11) return; - if(ModeNo <= 0x13) { - modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; - } else if(SiS_Pr->UseCustomMode) { - modeflag = SiS_Pr->CModeFlag; - } else { - modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - } + modeflag = SiS_GetModeFlag(SiS_Pr, ModeNo, ModeIdIndex); if(modeflag & HalfDCLK) VGAHDE >>= 1; @@ -4164,32 +3926,91 @@ SiS_CalcLCDACRT1Timing(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex) SiS_Pr->CVDisplay = SiS_Pr->SiS_VGAVDE; SiS_Pr->CVBlankStart = SiS_Pr->SiS_VGAVDE; - tempbx = SiS_Pr->PanelHT - SiS_Pr->PanelXRes; - tempax = SiS_Pr->SiS_VGAHDE; /* not /2 ! */ - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { - tempax = SiS_Pr->PanelXRes; + if(SiS_Pr->ChipType < SIS_315H) { +#ifdef SIS300 + tempbx = SiS_Pr->SiS_VGAHT; + if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { + tempbx = SiS_Pr->PanelHT; + } + if(modeflag & HalfDCLK) tempbx >>= 1; + remaining = tempbx % 8; +#endif + } else { +#ifdef SIS315H + /* OK for LCDA, LVDS */ + tempbx = SiS_Pr->PanelHT - SiS_Pr->PanelXRes; + tempax = SiS_Pr->SiS_VGAHDE; /* not /2 ! */ + if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { + tempax = SiS_Pr->PanelXRes; + } + tempbx += tempax; + if(modeflag & HalfDCLK) tempbx -= VGAHDE; +#endif } - tempbx += tempax; - if(modeflag & HalfDCLK) tempbx -= VGAHDE; SiS_Pr->CHTotal = SiS_Pr->CHBlankEnd = tempbx; - tempax = VGAHDE; - tempbx = SiS_Pr->CHTotal; - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { - tempbx = SiS_Pr->PanelXRes; - if(modeflag & HalfDCLK) tempbx >>= 1; - tempax += ((tempbx - tempax) >> 1); + if(SiS_Pr->ChipType < SIS_315H) { +#ifdef SIS300 + if(SiS_Pr->SiS_VGAHDE == SiS_Pr->PanelXRes) { + SiS_Pr->CHSyncStart = SiS_Pr->SiS_VGAHDE + ((SiS_Pr->PanelHRS + 1) & ~1); + SiS_Pr->CHSyncEnd = SiS_Pr->CHSyncStart + SiS_Pr->PanelHRE; + if(modeflag & HalfDCLK) { + SiS_Pr->CHSyncStart >>= 1; + SiS_Pr->CHSyncEnd >>= 1; + } + } else if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { + tempax = (SiS_Pr->PanelXRes - SiS_Pr->SiS_VGAHDE) >> 1; + tempbx = (SiS_Pr->PanelHRS + 1) & ~1; + if(modeflag & HalfDCLK) { + tempax >>= 1; + tempbx >>= 1; + } + SiS_Pr->CHSyncStart = (VGAHDE + tempax + tempbx + 7) & ~7; + tempax = SiS_Pr->PanelHRE + 7; + if(modeflag & HalfDCLK) tempax >>= 1; + SiS_Pr->CHSyncEnd = (SiS_Pr->CHSyncStart + tempax) & ~7; + } else { + SiS_Pr->CHSyncStart = SiS_Pr->SiS_VGAHDE; + if(modeflag & HalfDCLK) { + SiS_Pr->CHSyncStart >>= 1; + tempax = ((SiS_Pr->CHTotal - SiS_Pr->CHSyncStart) / 3) << 1; + SiS_Pr->CHSyncEnd = SiS_Pr->CHSyncStart + tempax; + } else { + SiS_Pr->CHSyncEnd = (SiS_Pr->CHSyncStart + (SiS_Pr->CHTotal / 10) + 7) & ~7; + SiS_Pr->CHSyncStart += 8; + } + } +#endif + } else { +#ifdef SIS315H + tempax = VGAHDE; + if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { + tempbx = SiS_Pr->PanelXRes; + if(modeflag & HalfDCLK) tempbx >>= 1; + tempax += ((tempbx - tempax) >> 1); + } + tempax += SiS_Pr->PanelHRS; + SiS_Pr->CHSyncStart = tempax; + tempax += SiS_Pr->PanelHRE; + SiS_Pr->CHSyncEnd = tempax; +#endif } - tempax += SiS_Pr->PanelHRS; - SiS_Pr->CHSyncStart = tempax; - tempax += SiS_Pr->PanelHRE; - SiS_Pr->CHSyncEnd = tempax; - tempbx = SiS_Pr->PanelVT - SiS_Pr->PanelYRes; tempax = SiS_Pr->SiS_VGAVDE; if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { tempax = SiS_Pr->PanelYRes; + } else if(SiS_Pr->ChipType < SIS_315H) { +#ifdef SIS300 + /* Stupid hack for 640x400/320x200 */ + if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) { + if((tempax + tempbx) == 438) tempbx += 16; + } else if((SiS_Pr->SiS_LCDResInfo == Panel_800x600) || + (SiS_Pr->SiS_LCDResInfo == Panel_1024x600)) { + tempax = 0; + tempbx = SiS_Pr->SiS_VGAVT; + } +#endif } SiS_Pr->CVTotal = SiS_Pr->CVBlankEnd = tempbx + tempax; @@ -4201,22 +4022,28 @@ SiS_CalcLCDACRT1Timing(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex) SiS_Pr->CVSyncStart = tempax; tempax += SiS_Pr->PanelVRE; SiS_Pr->CVSyncEnd = tempax; + if(SiS_Pr->ChipType < SIS_315H) { + SiS_Pr->CVSyncStart--; + SiS_Pr->CVSyncEnd--; + } SiS_CalcCRRegisters(SiS_Pr, 8); + SiS_Pr->CCRT1CRTC[15] &= ~0xF8; + SiS_Pr->CCRT1CRTC[15] |= (remaining << 4); SiS_Pr->CCRT1CRTC[16] &= ~0xE0; SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x11,0x7f); - for(i=0,j=0;i<=7;i++,j++) { + for(i = 0, j = 0; i <= 7; i++, j++) { SiS_SetReg(SiS_Pr->SiS_P3d4,j,SiS_Pr->CCRT1CRTC[i]); } - for(j=0x10;i<=10;i++,j++) { + for(j = 0x10; i <= 10; i++, j++) { SiS_SetReg(SiS_Pr->SiS_P3d4,j,SiS_Pr->CCRT1CRTC[i]); } - for(j=0x15;i<=12;i++,j++) { + for(j = 0x15; i <= 12; i++, j++) { SiS_SetReg(SiS_Pr->SiS_P3d4,j,SiS_Pr->CCRT1CRTC[i]); } - for(j=0x0A;i<=15;i++,j++) { + for(j = 0x0A; i <= 15; i++, j++) { SiS_SetReg(SiS_Pr->SiS_P3c4,j,SiS_Pr->CCRT1CRTC[i]); } @@ -4227,1092 +4054,192 @@ SiS_CalcLCDACRT1Timing(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex) if(modeflag & DoubleScanMode) tempax |= 0x80; SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,0x5F,tempax); +#ifdef SIS_XORG_XF86 #ifdef TWDEBUG xf86DrvMsg(0, X_INFO, "%d %d %d %d %d %d %d %d (%d %d %d %d)\n", - SiS_Pr->CHDisplay, SiS_Pr->CHSyncStart, SiS_Pr->CHSyncEnd, SiS_Pr->CHTotal, + SiS_Pr->CHDisplay, SiS_Pr->CHSyncStart, SiS_Pr->CHSyncEnd, SiS_Pr->CHTotal, SiS_Pr->CVDisplay, SiS_Pr->CVSyncStart, SiS_Pr->CVSyncEnd, SiS_Pr->CVTotal, SiS_Pr->CHBlankStart, SiS_Pr->CHBlankEnd, SiS_Pr->CVBlankStart, SiS_Pr->CVBlankEnd); - xf86DrvMsg(0, X_INFO, " {{0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,\n", - SiS_Pr->CCRT1CRTC[0], SiS_Pr->CCRT1CRTC[1], + SiS_Pr->CCRT1CRTC[0], SiS_Pr->CCRT1CRTC[1], SiS_Pr->CCRT1CRTC[2], SiS_Pr->CCRT1CRTC[3], SiS_Pr->CCRT1CRTC[4], SiS_Pr->CCRT1CRTC[5], SiS_Pr->CCRT1CRTC[6], SiS_Pr->CCRT1CRTC[7]); xf86DrvMsg(0, X_INFO, " 0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,\n", - SiS_Pr->CCRT1CRTC[8], SiS_Pr->CCRT1CRTC[9], + SiS_Pr->CCRT1CRTC[8], SiS_Pr->CCRT1CRTC[9], SiS_Pr->CCRT1CRTC[10], SiS_Pr->CCRT1CRTC[11], SiS_Pr->CCRT1CRTC[12], SiS_Pr->CCRT1CRTC[13], SiS_Pr->CCRT1CRTC[14], SiS_Pr->CCRT1CRTC[15]); xf86DrvMsg(0, X_INFO, " 0x%02x}},\n", SiS_Pr->CCRT1CRTC[16]); #endif +#endif } -#ifdef LINUX_XF86 - void -SiS_MakeClockRegs(ScrnInfoPtr pScrn, int clock, UCHAR *p2b, UCHAR *p2c) -{ - int out_n, out_dn, out_div, out_sbit, out_scale; - unsigned int vclk[5]; - -#define Midx 0 -#define Nidx 1 -#define VLDidx 2 -#define Pidx 3 -#define PSNidx 4 - - if(SiS_compute_vclk(clock, &out_n, &out_dn, &out_div, &out_sbit, &out_scale)) { - (*p2b) = (out_div == 2) ? 0x80 : 0x00; - (*p2b) |= ((out_n - 1) & 0x7f); - (*p2c) = (out_dn - 1) & 0x1f; - (*p2c) |= (((out_scale - 1) & 3) << 5); - (*p2c) |= ((out_sbit & 0x01) << 7); -#ifdef TWDEBUG - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Clock %d: n %d dn %d div %d sb %d sc %d\n", - clock, out_n, out_dn, out_div, out_sbit, out_scale); +SiS_Generic_ConvertCRData(struct SiS_Private *SiS_Pr, unsigned char *crdata, + int xres, int yres, +#ifdef SIS_XORG_XF86 + DisplayModePtr current #endif - } else { - SiSCalcClock(pScrn, clock, 2, vclk); - (*p2b) = (vclk[VLDidx] == 2) ? 0x80 : 0x00; - (*p2b) |= (vclk[Midx] - 1) & 0x7f; - (*p2c) = (vclk[Nidx] - 1) & 0x1f; - if(vclk[Pidx] <= 4) { - /* postscale 1,2,3,4 */ - (*p2c) |= ((vclk[Pidx] - 1) & 3) << 5; - } else { - /* postscale 6,8 */ - (*p2c) |= (((vclk[Pidx] / 2) - 1) & 3) << 5; - (*p2c) |= 0x80; - } -#ifdef TWDEBUG - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Clock %d: n %d dn %d div %d sc %d\n", - clock, vclk[Midx], vclk[Nidx], vclk[VLDidx], vclk[Pidx]); -#endif - } -} - +#ifdef SIS_LINUX_KERNEL + struct fb_var_screeninfo *var, BOOLEAN writeres #endif - -/* ================ XFREE86/X.ORG ================= */ - -/* Helper functions */ - -#ifdef LINUX_XF86 - -USHORT -SiS_CheckBuildCustomMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int VBFlags) +) { - SISPtr pSiS = SISPTR(pScrn); - int depth = pSiS->CurrentLayout.bitsPerPixel; - - pSiS->SiS_Pr->CModeFlag = 0; - - pSiS->SiS_Pr->CDClock = mode->Clock; - - pSiS->SiS_Pr->CHDisplay = mode->HDisplay; - pSiS->SiS_Pr->CHSyncStart = mode->HSyncStart; - pSiS->SiS_Pr->CHSyncEnd = mode->HSyncEnd; - pSiS->SiS_Pr->CHTotal = mode->HTotal; - - pSiS->SiS_Pr->CVDisplay = mode->VDisplay; - pSiS->SiS_Pr->CVSyncStart = mode->VSyncStart; - pSiS->SiS_Pr->CVSyncEnd = mode->VSyncEnd; - pSiS->SiS_Pr->CVTotal = mode->VTotal; - - pSiS->SiS_Pr->CFlags = mode->Flags; - - if(pSiS->SiS_Pr->CFlags & V_INTERLACE) { - pSiS->SiS_Pr->CVDisplay >>= 1; - pSiS->SiS_Pr->CVSyncStart >>= 1; - pSiS->SiS_Pr->CVSyncEnd >>= 1; - pSiS->SiS_Pr->CVTotal >>= 1; - } - if(pSiS->SiS_Pr->CFlags & V_DBLSCAN) { - /* pSiS->SiS_Pr->CDClock <<= 1; */ - pSiS->SiS_Pr->CVDisplay <<= 1; - pSiS->SiS_Pr->CVSyncStart <<= 1; - pSiS->SiS_Pr->CVSyncEnd <<= 1; - pSiS->SiS_Pr->CVTotal <<= 1; - } + unsigned short HRE, HBE, HRS, HBS, HDE, HT; + unsigned short VRE, VBE, VRS, VBS, VDE, VT; + unsigned char sr_data, cr_data, cr_data2; + int A, B, C, D, E, F, temp; - pSiS->SiS_Pr->CHBlankStart = pSiS->SiS_Pr->CHDisplay; - pSiS->SiS_Pr->CHBlankEnd = pSiS->SiS_Pr->CHTotal; - pSiS->SiS_Pr->CVBlankStart = pSiS->SiS_Pr->CVSyncStart - 1; - pSiS->SiS_Pr->CVBlankEnd = pSiS->SiS_Pr->CVTotal; + sr_data = crdata[14]; - SiS_MakeClockRegs(pScrn, pSiS->SiS_Pr->CDClock, &pSiS->SiS_Pr->CSR2B, &pSiS->SiS_Pr->CSR2C); + /* Horizontal total */ + HT = crdata[0] | ((unsigned short)(sr_data & 0x03) << 8); + A = HT + 5; - pSiS->SiS_Pr->CSRClock = (pSiS->SiS_Pr->CDClock / 1000) + 1; + /* Horizontal display enable end */ + HDE = crdata[1] | ((unsigned short)(sr_data & 0x0C) << 6); + E = HDE + 1; - SiS_CalcCRRegisters(pSiS->SiS_Pr, depth); + /* Horizontal retrace (=sync) start */ + HRS = crdata[4] | ((unsigned short)(sr_data & 0xC0) << 2); + F = HRS - E - 3; - switch(depth) { - case 8: pSiS->SiS_Pr->CModeFlag |= 0x223b; break; - case 16: pSiS->SiS_Pr->CModeFlag |= 0x227d; break; - case 32: pSiS->SiS_Pr->CModeFlag |= 0x22ff; break; - default: return 0; - } + /* Horizontal blank start */ + HBS = crdata[2] | ((unsigned short)(sr_data & 0x30) << 4); - if(pSiS->SiS_Pr->CFlags & V_DBLSCAN) - pSiS->SiS_Pr->CModeFlag |= DoubleScanMode; + sr_data = crdata[15]; + cr_data = crdata[5]; - if((pSiS->SiS_Pr->CVDisplay >= 1024) || - (pSiS->SiS_Pr->CVTotal >= 1024) || - (pSiS->SiS_Pr->CHDisplay >= 1024)) - pSiS->SiS_Pr->CModeFlag |= LineCompareOff; + /* Horizontal blank end */ + HBE = (crdata[3] & 0x1f) | + ((unsigned short)(cr_data & 0x80) >> 2) | + ((unsigned short)(sr_data & 0x03) << 6); - if(pSiS->SiS_Pr->CFlags & V_CLKDIV2) - pSiS->SiS_Pr->CModeFlag |= HalfDCLK; + /* Horizontal retrace (=sync) end */ + HRE = (cr_data & 0x1f) | ((sr_data & 0x04) << 3); - pSiS->SiS_Pr->CInfoFlag = 0x0007; + temp = HBE - ((E - 1) & 255); + B = (temp > 0) ? temp : (temp + 256); - if(pSiS->SiS_Pr->CFlags & V_NHSYNC) - pSiS->SiS_Pr->CInfoFlag |= 0x4000; + temp = HRE - ((E + F + 3) & 63); + C = (temp > 0) ? temp : (temp + 64); - if(pSiS->SiS_Pr->CFlags & V_NVSYNC) - pSiS->SiS_Pr->CInfoFlag |= 0x8000; + D = B - F - C; - if(pSiS->SiS_Pr->CFlags & V_INTERLACE) - pSiS->SiS_Pr->CInfoFlag |= InterlaceMode; - - pSiS->SiS_Pr->UseCustomMode = TRUE; +#ifdef SIS_XORG_XF86 + current->HDisplay = (E * 8); + current->HSyncStart = (E * 8) + (F * 8); + current->HSyncEnd = (E * 8) + (F * 8) + (C * 8); + current->HTotal = (E * 8) + (F * 8) + (C * 8) + (D * 8); #ifdef TWDEBUG - xf86DrvMsg(0, X_INFO, "Custom mode %dx%d:\n", - pSiS->SiS_Pr->CHDisplay,pSiS->SiS_Pr->CVDisplay); - xf86DrvMsg(0, X_INFO, "Modeflag %04x, Infoflag %04x\n", - pSiS->SiS_Pr->CModeFlag, pSiS->SiS_Pr->CInfoFlag); - xf86DrvMsg(0, X_INFO, " {{0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,\n", - pSiS->SiS_Pr->CCRT1CRTC[0], pSiS->SiS_Pr->CCRT1CRTC[1], - pSiS->SiS_Pr->CCRT1CRTC[2], pSiS->SiS_Pr->CCRT1CRTC[3], - pSiS->SiS_Pr->CCRT1CRTC[4], pSiS->SiS_Pr->CCRT1CRTC[5], - pSiS->SiS_Pr->CCRT1CRTC[6], pSiS->SiS_Pr->CCRT1CRTC[7]); - xf86DrvMsg(0, X_INFO, " 0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,\n", - pSiS->SiS_Pr->CCRT1CRTC[8], pSiS->SiS_Pr->CCRT1CRTC[9], - pSiS->SiS_Pr->CCRT1CRTC[10], pSiS->SiS_Pr->CCRT1CRTC[11], - pSiS->SiS_Pr->CCRT1CRTC[12], pSiS->SiS_Pr->CCRT1CRTC[13], - pSiS->SiS_Pr->CCRT1CRTC[14], pSiS->SiS_Pr->CCRT1CRTC[15]); - xf86DrvMsg(0, X_INFO, " 0x%02x}},\n", pSiS->SiS_Pr->CCRT1CRTC[16]); - xf86DrvMsg(0, X_INFO, "Clock: 0x%02x, 0x%02x, %d\n", - pSiS->SiS_Pr->CSR2B, pSiS->SiS_Pr->CSR2C, pSiS->SiS_Pr->CSRClock); -#endif - return 1; -} - -int -SiS_FindPanelFromDB(SISPtr pSiS, USHORT panelvendor, USHORT panelproduct, int *maxx, int *maxy, int *prefx, int *prefy) -{ - int i, j; - BOOLEAN done = FALSE; - - i = 0; - while((!done) && (SiS_PlasmaTable[i].vendor) && panelvendor) { - if(SiS_PlasmaTable[i].vendor == panelvendor) { - for(j=0; jpScrn->scrnIndex, X_PROBED, - "Identified %s, correcting max X res %d, max Y res %d\n", - SiS_PlasmaTable[i].plasmaname, - SiS_PlasmaTable[i].maxx, SiS_PlasmaTable[i].maxy); - break; - } - } - } - } - i++; - } - return (done) ? 1 : 0; -} - -/* Build a list of supported modes: - * Built-in modes for which we have all data are M_T_DEFAULT, - * modes derived from DDC or database data are M_T_BUILTIN - */ -DisplayModePtr -SiSBuildBuiltInModeList(ScrnInfoPtr pScrn, BOOLEAN includelcdmodes, BOOLEAN isfordvi) -{ - SISPtr pSiS = SISPTR(pScrn); - unsigned short VRE, VBE, VRS, VBS, VDE, VT; - unsigned short HRE, HBE, HRS, HBS, HDE, HT; - unsigned char sr_data, cr_data, cr_data2, cr_data3; - unsigned char sr2b, sr2c; - float num, denum, postscalar, divider; - int A, B, C, D, E, F, temp, i, j, k, l, index, vclkindex; - DisplayModePtr new = NULL, current = NULL, first = NULL; - BOOLEAN done = FALSE; -#if 0 - DisplayModePtr backup = NULL; -#endif - - pSiS->backupmodelist = NULL; - pSiS->AddedPlasmaModes = FALSE; - - /* Initialize our pointers */ - if(pSiS->VGAEngine == SIS_300_VGA) { -#ifdef SIS300 - InitTo300Pointer(pSiS->SiS_Pr, &pSiS->sishw_ext); + xf86DrvMsg(0, X_INFO, + "H: A %d B %d C %d D %d E %d F %d HT %d HDE %d HRS %d HBS %d HBE %d HRE %d\n", + A, B, C, D, E, F, HT, HDE, HRS, HBS, HBE, HRE); #else - return NULL; + (void)VBS; (void)HBS; (void)A; #endif - } else if(pSiS->VGAEngine == SIS_315_VGA) { -#ifdef SIS315H - InitTo310Pointer(pSiS->SiS_Pr, &pSiS->sishw_ext); -#else - return NULL; #endif - } else return NULL; - - i = 0; - while(pSiS->SiS_Pr->SiS_RefIndex[i].Ext_InfoFlag != 0xFFFF) { - - index = pSiS->SiS_Pr->SiS_RefIndex[i].Ext_CRT1CRTC; - - /* 0x5a (320x240) is a pure FTSN mode, not DSTN! */ - if((!pSiS->FSTN) && - (pSiS->SiS_Pr->SiS_RefIndex[i].ModeID == 0x5a)) { - i++; - continue; - } - if((pSiS->FSTN) && - (pSiS->SiS_Pr->SiS_RefIndex[i].XRes == 320) && - (pSiS->SiS_Pr->SiS_RefIndex[i].YRes == 240) && - (pSiS->SiS_Pr->SiS_RefIndex[i].ModeID != 0x5a)) { - i++; - continue; - } - - if(!(new = xalloc(sizeof(DisplayModeRec)))) return first; - memset(new, 0, sizeof(DisplayModeRec)); - if(!(new->name = xalloc(10))) { - xfree(new); - return first; - } - if(!first) first = new; - if(current) { - current->next = new; - new->prev = current; - } - - current = new; - - sprintf(current->name, "%dx%d", pSiS->SiS_Pr->SiS_RefIndex[i].XRes, - pSiS->SiS_Pr->SiS_RefIndex[i].YRes); - - current->status = MODE_OK; - - current->type = M_T_DEFAULT; - - vclkindex = pSiS->SiS_Pr->SiS_RefIndex[i].Ext_CRTVCLK; - if(pSiS->VGAEngine == SIS_300_VGA) vclkindex &= 0x3F; - - sr2b = pSiS->SiS_Pr->SiS_VCLKData[vclkindex].SR2B; - sr2c = pSiS->SiS_Pr->SiS_VCLKData[vclkindex].SR2C; - - divider = (sr2b & 0x80) ? 2.0 : 1.0; - postscalar = (sr2c & 0x80) ? - ( (((sr2c >> 5) & 0x03) == 0x02) ? 6.0 : 8.0) : (((sr2c >> 5) & 0x03) + 1.0); - num = (sr2b & 0x7f) + 1.0; - denum = (sr2c & 0x1f) + 1.0; - -#ifdef TWDEBUG - xf86DrvMsg(0, X_INFO, "------------\n"); - xf86DrvMsg(0, X_INFO, "sr2b: %x sr2c %x div %f ps %f num %f denum %f\n", - sr2b, sr2c, divider, postscalar, num, denum); +#ifdef SIS_LINUX_KERNEL + if(writeres) var->xres = xres = E * 8; + var->left_margin = D * 8; + var->right_margin = F * 8; + var->hsync_len = C * 8; #endif - current->Clock = (int)(14318 * (divider / postscalar) * (num / denum)); - - sr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[14]; - /* inSISIDXREG(SISSR, 0x0b, sr_data); */ - - cr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[0]; - /* inSISIDXREG(SISCR, 0x00, cr_data); */ - - /* Horizontal total */ - HT = (cr_data & 0xff) | - ((unsigned short) (sr_data & 0x03) << 8); - A = HT + 5; - - cr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[1]; - /* inSISIDXREG(SISCR, 0x01, cr_data); */ - - /* Horizontal display enable end */ - HDE = (cr_data & 0xff) | - ((unsigned short) (sr_data & 0x0C) << 6); - E = HDE + 1; /* 0x80 0x64 */ - - cr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[4]; - /* inSISIDXREG(SISCR, 0x04, cr_data); */ - - /* Horizontal retrace (=sync) start */ - HRS = (cr_data & 0xff) | - ((unsigned short) (sr_data & 0xC0) << 2); - F = HRS - E - 3; /* 0x06 0x06 */ - - cr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[2]; - /* inSISIDXREG(SISCR, 0x02, cr_data); */ - - /* Horizontal blank start */ - HBS = (cr_data & 0xff) | - ((unsigned short) (sr_data & 0x30) << 4); - - sr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[15]; - /* inSISIDXREG(SISSR, 0x0c, sr_data); */ - - cr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[3]; - /* inSISIDXREG(SISCR, 0x03, cr_data); */ - - cr_data2 = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[5]; - /* inSISIDXREG(SISCR, 0x05, cr_data2); */ - - /* Horizontal blank end */ - HBE = (cr_data & 0x1f) | - ((unsigned short) (cr_data2 & 0x80) >> 2) | - ((unsigned short) (sr_data & 0x03) << 6); - - /* Horizontal retrace (=sync) end */ - HRE = (cr_data2 & 0x1f) | ((sr_data & 0x04) << 3); - - temp = HBE - ((E - 1) & 255); - B = (temp > 0) ? temp : (temp + 256); - - temp = HRE - ((E + F + 3) & 63); - C = (temp > 0) ? temp : (temp + 64); /* 0x0b 0x0b */ - - D = B - F - C; - - if((pSiS->SiS_Pr->SiS_RefIndex[i].XRes == 320) && - ((pSiS->SiS_Pr->SiS_RefIndex[i].YRes == 200) || - (pSiS->SiS_Pr->SiS_RefIndex[i].YRes == 240))) { - - /* Terrible hack, but correct CRTC data for - * these modes only produces a black screen... - * (HRE is 0, leading into a too large C and - * a negative D. The CRT controller does not - * seem to like correcting HRE to 50 - */ - current->HDisplay = 320; - current->HSyncStart = 328; - current->HSyncEnd = 376; - current->HTotal = 400; - - } else { - - current->HDisplay = (E * 8); - current->HSyncStart = (E * 8) + (F * 8); - current->HSyncEnd = (E * 8) + (F * 8) + (C * 8); - current->HTotal = (E * 8) + (F * 8) + (C * 8) + (D * 8); - - } - -#ifdef TWDEBUG - xf86DrvMsg(0, X_INFO, - "H: A %d B %d C %d D %d E %d F %d HT %d HDE %d HRS %d HBS %d HBE %d HRE %d\n", - A, B, C, D, E, F, HT, HDE, HRS, HBS, HBE, HRE); -#endif - - sr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[13]; - /* inSISIDXREG(SISSR, 0x0A, sr_data); */ - - cr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[6]; - /* inSISIDXREG(SISCR, 0x06, cr_data); */ - - cr_data2 = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[7]; - /* inSISIDXREG(SISCR, 0x07, cr_data2); */ - - /* Vertical total */ - VT = (cr_data & 0xFF) | - ((unsigned short) (cr_data2 & 0x01) << 8) | - ((unsigned short)(cr_data2 & 0x20) << 4) | - ((unsigned short) (sr_data & 0x01) << 10); - A = VT + 2; - - cr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[10]; - /* inSISIDXREG(SISCR, 0x12, cr_data); */ - - /* Vertical display enable end */ - VDE = (cr_data & 0xff) | - ((unsigned short) (cr_data2 & 0x02) << 7) | - ((unsigned short) (cr_data2 & 0x40) << 3) | - ((unsigned short) (sr_data & 0x02) << 9); - E = VDE + 1; - - cr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[8]; - /* inSISIDXREG(SISCR, 0x10, cr_data); */ - - /* Vertical retrace (=sync) start */ - VRS = (cr_data & 0xff) | - ((unsigned short) (cr_data2 & 0x04) << 6) | - ((unsigned short) (cr_data2 & 0x80) << 2) | - ((unsigned short) (sr_data & 0x08) << 7); - F = VRS + 1 - E; - - cr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[11]; - /* inSISIDXREG(SISCR, 0x15, cr_data); */ - - cr_data3 = (pSiS->SiS_Pr->SiS_CRT1Table[index].CR[16] & 0x01) << 5; - /* inSISIDXREG(SISCR, 0x09, cr_data3); */ - - /* Vertical blank start */ - VBS = (cr_data & 0xff) | - ((unsigned short) (cr_data2 & 0x08) << 5) | - ((unsigned short) (cr_data3 & 0x20) << 4) | - ((unsigned short) (sr_data & 0x04) << 8); - - cr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[12]; - /* inSISIDXREG(SISCR, 0x16, cr_data); */ - - /* Vertical blank end */ - VBE = (cr_data & 0xff) | - ((unsigned short) (sr_data & 0x10) << 4); - temp = VBE - ((E - 1) & 511); - B = (temp > 0) ? temp : (temp + 512); - - cr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[9]; - /* inSISIDXREG(SISCR, 0x11, cr_data); */ - - /* Vertical retrace (=sync) end */ - VRE = (cr_data & 0x0f) | ((sr_data & 0x20) >> 1); - temp = VRE - ((E + F - 1) & 31); - C = (temp > 0) ? temp : (temp + 32); - - D = B - F - C; - - current->VDisplay = VDE + 1; - current->VSyncStart = VRS + 1; - current->VSyncEnd = ((VRS & ~0x1f) | VRE) + 1; - if(VRE <= (VRS & 0x1f)) current->VSyncEnd += 32; - current->VTotal = E + D + C + F; - + /* Vertical */ + sr_data = crdata[13]; + cr_data = crdata[7]; + + /* Vertical total */ + VT = crdata[6] | + ((unsigned short)(cr_data & 0x01) << 8) | + ((unsigned short)(cr_data & 0x20) << 4) | + ((unsigned short)(sr_data & 0x01) << 10); + A = VT + 2; + + /* Vertical display enable end */ + VDE = crdata[10] | + ((unsigned short)(cr_data & 0x02) << 7) | + ((unsigned short)(cr_data & 0x40) << 3) | + ((unsigned short)(sr_data & 0x02) << 9); + E = VDE + 1; + + /* Vertical retrace (=sync) start */ + VRS = crdata[8] | + ((unsigned short)(cr_data & 0x04) << 6) | + ((unsigned short)(cr_data & 0x80) << 2) | + ((unsigned short)(sr_data & 0x08) << 7); + F = VRS + 1 - E; + + cr_data2 = (crdata[16] & 0x01) << 5; + + /* Vertical blank start */ + VBS = crdata[11] | + ((unsigned short)(cr_data & 0x08) << 5) | + ((unsigned short)(cr_data2 & 0x20) << 4) | + ((unsigned short)(sr_data & 0x04) << 8); + + /* Vertical blank end */ + VBE = crdata[12] | ((unsigned short)(sr_data & 0x10) << 4); + temp = VBE - ((E - 1) & 511); + B = (temp > 0) ? temp : (temp + 512); + + /* Vertical retrace (=sync) end */ + VRE = (crdata[9] & 0x0f) | ((sr_data & 0x20) >> 1); + temp = VRE - ((E + F - 1) & 31); + C = (temp > 0) ? temp : (temp + 32); + + D = B - F - C; + +#ifdef SIS_XORG_XF86 + current->VDisplay = VDE + 1; + current->VSyncStart = VRS + 1; + current->VSyncEnd = ((VRS & ~0x1f) | VRE) + 1; + if(VRE <= (VRS & 0x1f)) current->VSyncEnd += 32; + current->VTotal = E + D + C + F; #if 0 - current->VDisplay = E; - current->VSyncStart = E + D; - current->VSyncEnd = E + D + C; - current->VTotal = E + D + C + F; + current->VDisplay = E; + current->VSyncStart = E + D; + current->VSyncEnd = E + D + C; + current->VTotal = E + D + C + F; #endif - -#ifdef TWDEBUG - xf86DrvMsg(0, X_INFO, - "V: A %d B %d C %d D %d E %d F %d VT %d VDE %d VRS %d VBS %d VBE %d VRE %d\n", - A, B, C, D, E, F, VT, VDE, VRS, VBS, VBE, VRE); -#endif - - if(pSiS->SiS_Pr->SiS_RefIndex[i].Ext_InfoFlag & 0x4000) - current->Flags |= V_NHSYNC; - else - current->Flags |= V_PHSYNC; - - if(pSiS->SiS_Pr->SiS_RefIndex[i].Ext_InfoFlag & 0x8000) - current->Flags |= V_NVSYNC; - else - current->Flags |= V_PVSYNC; - - if(pSiS->SiS_Pr->SiS_RefIndex[i].Ext_InfoFlag & 0x0080) - current->Flags |= V_INTERLACE; - - j = 0; - while(pSiS->SiS_Pr->SiS_EModeIDTable[j].Ext_ModeID != 0xff) { - if(pSiS->SiS_Pr->SiS_EModeIDTable[j].Ext_ModeID == - pSiS->SiS_Pr->SiS_RefIndex[i].ModeID) { - if(pSiS->SiS_Pr->SiS_EModeIDTable[j].Ext_ModeFlag & DoubleScanMode) { - current->Flags |= V_DBLSCAN; - } - break; - } - j++; - } - - if(current->Flags & V_INTERLACE) { - current->VDisplay <<= 1; - current->VSyncStart <<= 1; - current->VSyncEnd <<= 1; - current->VTotal <<= 1; - current->VTotal |= 1; - } - if(current->Flags & V_DBLSCAN) { - current->Clock >>= 1; - current->VDisplay >>= 1; - current->VSyncStart >>= 1; - current->VSyncEnd >>= 1; - current->VTotal >>= 1; - } - #ifdef TWDEBUG - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Built-in: %s %.2f %d %d %d %d %d %d %d %d\n", - current->name, (float)current->Clock / 1000, - current->HDisplay, current->HSyncStart, current->HSyncEnd, current->HTotal, - current->VDisplay, current->VSyncStart, current->VSyncEnd, current->VTotal); -#else - (void)VBS; (void)HBS; (void)A; + xf86DrvMsg(0, X_INFO, + "V: A %d B %d C %d D %d E %d F %d VT %d VDE %d VRS %d VBS %d VBE %d VRE %d\n", + A, B, C, D, E, F, VT, VDE, VRS, VBS, VBE, VRE); #endif - - i++; - } - - /* Add non-standard LCD modes for panel's detailed timings */ - - if(!includelcdmodes) return first; - - if(pSiS->SiS_Pr->CP_Vendor) { - xf86DrvMsg(0, X_INFO, "Checking database for vendor %x, product %x\n", - pSiS->SiS_Pr->CP_Vendor, pSiS->SiS_Pr->CP_Product); - } - - i = 0; - while((!done) && (SiS_PlasmaTable[i].vendor) && (pSiS->SiS_Pr->CP_Vendor)) { - - if(SiS_PlasmaTable[i].vendor == pSiS->SiS_Pr->CP_Vendor) { - - for(j=0; jSiS_Pr->CP_Product) { - - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Identified %s panel, adding specific modes\n", - SiS_PlasmaTable[i].plasmaname); - - for(k=0; kVBFlags & (VB_301|VB_301B|VB_302B|VB_301LV)) { - if(isfordvi) { - if(SiS_PlasmaMode[l].VDisplay > 1024) continue; - } - } - - if(!(new = xalloc(sizeof(DisplayModeRec)))) return first; - - memset(new, 0, sizeof(DisplayModeRec)); - if(!(new->name = xalloc(12))) { - xfree(new); - return first; - } - if(!first) first = new; - if(current) { - current->next = new; - new->prev = current; - } - - current = new; - - pSiS->AddedPlasmaModes = TRUE; - - strcpy(current->name, SiS_PlasmaMode[l].name); - /* sprintf(current->name, "%dx%d", SiS_PlasmaMode[l].HDisplay, - SiS_PlasmaMode[l].VDisplay); */ - - current->status = MODE_OK; - - current->type = M_T_BUILTIN; - - current->Clock = SiS_PlasmaMode[l].clock; - current->SynthClock = current->Clock; - - current->HDisplay = SiS_PlasmaMode[l].HDisplay; - current->HSyncStart = current->HDisplay + SiS_PlasmaMode[l].HFrontPorch; - current->HSyncEnd = current->HSyncStart + SiS_PlasmaMode[l].HSyncWidth; - current->HTotal = SiS_PlasmaMode[l].HTotal; - - current->VDisplay = SiS_PlasmaMode[l].VDisplay; - current->VSyncStart = current->VDisplay + SiS_PlasmaMode[l].VFrontPorch; - current->VSyncEnd = current->VSyncStart + SiS_PlasmaMode[l].VSyncWidth; - current->VTotal = SiS_PlasmaMode[l].VTotal; - - current->CrtcHDisplay = current->HDisplay; - current->CrtcHBlankStart = current->HSyncStart; - current->CrtcHSyncStart = current->HSyncStart; - current->CrtcHSyncEnd = current->HSyncEnd; - current->CrtcHBlankEnd = current->HSyncEnd; - current->CrtcHTotal = current->HTotal; - - current->CrtcVDisplay = current->VDisplay; - current->CrtcVBlankStart = current->VSyncStart; - current->CrtcVSyncStart = current->VSyncStart; - current->CrtcVSyncEnd = current->VSyncEnd; - current->CrtcVBlankEnd = current->VSyncEnd; - current->CrtcVTotal = current->VTotal; - - if(SiS_PlasmaMode[l].SyncFlags & SIS_PL_HSYNCP) - current->Flags |= V_PHSYNC; - else - current->Flags |= V_NHSYNC; - - if(SiS_PlasmaMode[l].SyncFlags & SIS_PL_VSYNCP) - current->Flags |= V_PVSYNC; - else - current->Flags |= V_NVSYNC; - - if(current->HDisplay > pSiS->LCDwidth) - pSiS->LCDwidth = pSiS->SiS_Pr->CP_MaxX = current->HDisplay; - if(current->VDisplay > pSiS->LCDheight) - pSiS->LCDheight = pSiS->SiS_Pr->CP_MaxY = current->VDisplay; - - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "\tAdding \"%s\" to list of built-in modes\n", current->name); - - } - done = TRUE; - break; - } - } - } - - i++; - - } - - if(pSiS->SiS_Pr->CP_HaveCustomData) { - - for(i=0; i<7; i++) { - - if(pSiS->SiS_Pr->CP_DataValid[i]) { - - if(!(new = xalloc(sizeof(DisplayModeRec)))) return first; - - memset(new, 0, sizeof(DisplayModeRec)); - if(!(new->name = xalloc(10))) { - xfree(new); - return first; - } - if(!first) first = new; - if(current) { - current->next = new; - new->prev = current; - } - - current = new; - - sprintf(current->name, "%dx%d", pSiS->SiS_Pr->CP_HDisplay[i], - pSiS->SiS_Pr->CP_VDisplay[i]); - - current->status = MODE_OK; - - current->type = M_T_BUILTIN; - - current->Clock = pSiS->SiS_Pr->CP_Clock[i]; - current->SynthClock = current->Clock; - - current->HDisplay = pSiS->SiS_Pr->CP_HDisplay[i]; - current->HSyncStart = pSiS->SiS_Pr->CP_HSyncStart[i]; - current->HSyncEnd = pSiS->SiS_Pr->CP_HSyncEnd[i]; - current->HTotal = pSiS->SiS_Pr->CP_HTotal[i]; - - current->VDisplay = pSiS->SiS_Pr->CP_VDisplay[i]; - current->VSyncStart = pSiS->SiS_Pr->CP_VSyncStart[i]; - current->VSyncEnd = pSiS->SiS_Pr->CP_VSyncEnd[i]; - current->VTotal = pSiS->SiS_Pr->CP_VTotal[i]; - - current->CrtcHDisplay = current->HDisplay; - current->CrtcHBlankStart = pSiS->SiS_Pr->CP_HBlankStart[i]; - current->CrtcHSyncStart = current->HSyncStart; - current->CrtcHSyncEnd = current->HSyncEnd; - current->CrtcHBlankEnd = pSiS->SiS_Pr->CP_HBlankEnd[i]; - current->CrtcHTotal = current->HTotal; - - current->CrtcVDisplay = current->VDisplay; - current->CrtcVBlankStart = pSiS->SiS_Pr->CP_VBlankStart[i]; - current->CrtcVSyncStart = current->VSyncStart; - current->CrtcVSyncEnd = current->VSyncEnd; - current->CrtcVBlankEnd = pSiS->SiS_Pr->CP_VBlankEnd[i]; - current->CrtcVTotal = current->VTotal; - - if(pSiS->SiS_Pr->CP_SyncValid[i]) { - if(pSiS->SiS_Pr->CP_HSync_P[i]) - current->Flags |= V_PHSYNC; - else - current->Flags |= V_NHSYNC; - - if(pSiS->SiS_Pr->CP_VSync_P[i]) - current->Flags |= V_PVSYNC; - else - current->Flags |= V_NVSYNC; - } else { - /* No sync data? Use positive sync... */ - current->Flags |= V_PHSYNC; - current->Flags |= V_PVSYNC; - } - } - } - } - - return first; - -} - -/* Translate a mode number into the VESA pendant */ -int -SiSTranslateToVESA(ScrnInfoPtr pScrn, int modenumber) -{ - SISPtr pSiS = SISPTR(pScrn); - int i = 0; - - /* Initialize our pointers */ - if(pSiS->VGAEngine == SIS_300_VGA) { -#ifdef SIS300 - InitTo300Pointer(pSiS->SiS_Pr, &pSiS->sishw_ext); -#else - return -1; #endif - } else if(pSiS->VGAEngine == SIS_315_VGA) { -#ifdef SIS315H - InitTo310Pointer(pSiS->SiS_Pr, &pSiS->sishw_ext); -#else - return -1; +#ifdef SIS_LINUX_KERNEL + if(writeres) var->yres = yres = E; + var->upper_margin = D; + var->lower_margin = F; + var->vsync_len = C; #endif - } else return -1; - - if(modenumber <= 0x13) return modenumber; -#ifdef SIS315H - if(pSiS->ROM661New) { - while(SiS_EModeIDTable661[i].Ext_ModeID != 0xff) { - if(SiS_EModeIDTable661[i].Ext_ModeID == modenumber) { - return (int)SiS_EModeIDTable661[i].Ext_VESAID; - } - i++; - } - } else { + if((xres == 320) && ((yres == 200) || (yres == 240))) { + /* Terrible hack, but correct CRTC data for + * these modes only produces a black screen... + * (HRE is 0, leading into a too large C and + * a negative D. The CRT controller does not + * seem to like correcting HRE to 50) + */ +#ifdef SIS_XORG_XF86 + current->HDisplay = 320; + current->HSyncStart = 328; + current->HSyncEnd = 376; + current->HTotal = 400; #endif - while(pSiS->SiS_Pr->SiS_EModeIDTable[i].Ext_ModeID != 0xff) { - if(pSiS->SiS_Pr->SiS_EModeIDTable[i].Ext_ModeID == modenumber) { - return (int)pSiS->SiS_Pr->SiS_EModeIDTable[i].Ext_VESAID; - } - i++; - } -#ifdef SIS315H - } +#ifdef SIS_LINUX_KERNEL + var->left_margin = (400 - 376); + var->right_margin = (328 - 320); + var->hsync_len = (376 - 328); #endif - return -1; -} -/* Translate a new BIOS mode number into the driver's pendant */ -int -SiSTranslateToOldMode(int modenumber) -{ -#ifdef SIS315H - int i = 0; - - while(SiS_EModeIDTable661[i].Ext_ModeID != 0xff) { - if(SiS_EModeIDTable661[i].Ext_ModeID == modenumber) { - if(SiS_EModeIDTable661[i].Ext_MyModeID) - return (int)SiS_EModeIDTable661[i].Ext_MyModeID; - else - return modenumber; - } - i++; } -#endif - return modenumber; -} - -#endif /* Xfree86 */ -#ifdef LINUX_KERNEL -int -sisfb_mode_rate_to_dclock(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, - unsigned char modeno, unsigned char rateindex) -{ - USHORT ModeNo = modeno; - USHORT ModeIdIndex = 0, ClockIndex = 0; - USHORT RefreshRateTableIndex = 0; - int Clock; - - if(HwInfo->jChipType < SIS_315H) { -#ifdef SIS300 - InitTo300Pointer(SiS_Pr, HwInfo); -#else - return 65 * 1000; -#endif - } else { -#ifdef SIS315H - InitTo310Pointer(SiS_Pr, HwInfo); -#else - return 65 * 1000; -#endif - } - - if(!(SiS_SearchModeID(SiS_Pr, &ModeNo, &ModeIdIndex))) {; - printk(KERN_ERR "Could not find mode %x\n", ModeNo); - return 65 * 1000; - } - - RefreshRateTableIndex = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].REFindex; - RefreshRateTableIndex += (rateindex - 1); - ClockIndex = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; - if(HwInfo->jChipType < SIS_315H) { - ClockIndex &= 0x3F; - } - Clock = SiS_Pr->SiS_VCLKData[ClockIndex].CLOCK * 1000; - - return(Clock); } -BOOLEAN -sisfb_gettotalfrommode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, - unsigned char modeno, int *htotal, int *vtotal, unsigned char rateindex) -{ - USHORT ModeNo = modeno; - USHORT ModeIdIndex = 0, CRT1Index = 0; - USHORT RefreshRateTableIndex = 0; - unsigned char sr_data, cr_data, cr_data2; - - if(HwInfo->jChipType < SIS_315H) { -#ifdef SIS300 - InitTo300Pointer(SiS_Pr, HwInfo); -#else - return FALSE; -#endif - } else { -#ifdef SIS315H - InitTo310Pointer(SiS_Pr, HwInfo); -#else - return FALSE; -#endif - } - - if(!(SiS_SearchModeID(SiS_Pr, &ModeNo, &ModeIdIndex))) return FALSE; - - RefreshRateTableIndex = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].REFindex; - RefreshRateTableIndex += (rateindex - 1); - CRT1Index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; - - sr_data = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[14]; - cr_data = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[0]; - *htotal = (((cr_data & 0xff) | ((unsigned short) (sr_data & 0x03) << 8)) + 5) * 8; - sr_data = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[13]; - cr_data = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[6]; - cr_data2 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[7]; - *vtotal = ((cr_data & 0xFF) | - ((unsigned short)(cr_data2 & 0x01) << 8) | - ((unsigned short)(cr_data2 & 0x20) << 4) | - ((unsigned short)(sr_data & 0x01) << 10)) + 2; - if(SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag & InterlaceMode) - *vtotal *= 2; - - return TRUE; -} - -int -sisfb_mode_rate_to_ddata(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, - unsigned char modeno, unsigned char rateindex, - struct fb_var_screeninfo *var) -{ - USHORT ModeNo = modeno; - USHORT ModeIdIndex = 0, index = 0; - USHORT RefreshRateTableIndex = 0; - unsigned short VRE, VBE, VRS, VBS, VDE, VT; - unsigned short HRE, HBE, HRS, HBS, HDE, HT; - unsigned char sr_data, cr_data, cr_data2, cr_data3; - int A, B, C, D, E, F, temp, j; - - if(HwInfo->jChipType < SIS_315H) { -#ifdef SIS300 - InitTo300Pointer(SiS_Pr, HwInfo); -#else - return 0; -#endif - } else { -#ifdef SIS315H - InitTo310Pointer(SiS_Pr, HwInfo); -#else - return 0; -#endif - } - - if(!(SiS_SearchModeID(SiS_Pr, &ModeNo, &ModeIdIndex))) return 0; - - RefreshRateTableIndex = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].REFindex; - RefreshRateTableIndex += (rateindex - 1); - index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; - - sr_data = SiS_Pr->SiS_CRT1Table[index].CR[14]; - - cr_data = SiS_Pr->SiS_CRT1Table[index].CR[0]; - - /* Horizontal total */ - HT = (cr_data & 0xff) | - ((unsigned short) (sr_data & 0x03) << 8); - A = HT + 5; - - cr_data = SiS_Pr->SiS_CRT1Table[index].CR[1]; - - /* Horizontal display enable end */ - HDE = (cr_data & 0xff) | - ((unsigned short) (sr_data & 0x0C) << 6); - E = HDE + 1; - - cr_data = SiS_Pr->SiS_CRT1Table[index].CR[4]; - - /* Horizontal retrace (=sync) start */ - HRS = (cr_data & 0xff) | - ((unsigned short) (sr_data & 0xC0) << 2); - F = HRS - E - 3; - - cr_data = SiS_Pr->SiS_CRT1Table[index].CR[2]; - - /* Horizontal blank start */ - HBS = (cr_data & 0xff) | - ((unsigned short) (sr_data & 0x30) << 4); - - sr_data = SiS_Pr->SiS_CRT1Table[index].CR[15]; - - cr_data = SiS_Pr->SiS_CRT1Table[index].CR[3]; - - cr_data2 = SiS_Pr->SiS_CRT1Table[index].CR[5]; - - /* Horizontal blank end */ - HBE = (cr_data & 0x1f) | - ((unsigned short) (cr_data2 & 0x80) >> 2) | - ((unsigned short) (sr_data & 0x03) << 6); - - /* Horizontal retrace (=sync) end */ - HRE = (cr_data2 & 0x1f) | ((sr_data & 0x04) << 3); - - temp = HBE - ((E - 1) & 255); - B = (temp > 0) ? temp : (temp + 256); - - temp = HRE - ((E + F + 3) & 63); - C = (temp > 0) ? temp : (temp + 64); - - D = B - F - C; - - if((SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].XRes == 320) && - ((SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].YRes == 200) || - (SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].YRes == 240))) { - - /* Terrible hack, but the correct CRTC data for - * these modes only produces a black screen... - */ - var->left_margin = (400 - 376); - var->right_margin = (328 - 320); - var->hsync_len = (376 - 328); - - } else { - - var->left_margin = D * 8; - var->right_margin = F * 8; - var->hsync_len = C * 8; - - } - - sr_data = SiS_Pr->SiS_CRT1Table[index].CR[13]; - - cr_data = SiS_Pr->SiS_CRT1Table[index].CR[6]; - - cr_data2 = SiS_Pr->SiS_CRT1Table[index].CR[7]; - - /* Vertical total */ - VT = (cr_data & 0xFF) | - ((unsigned short) (cr_data2 & 0x01) << 8) | - ((unsigned short)(cr_data2 & 0x20) << 4) | - ((unsigned short) (sr_data & 0x01) << 10); - A = VT + 2; - - cr_data = SiS_Pr->SiS_CRT1Table[index].CR[10]; - - /* Vertical display enable end */ - VDE = (cr_data & 0xff) | - ((unsigned short) (cr_data2 & 0x02) << 7) | - ((unsigned short) (cr_data2 & 0x40) << 3) | - ((unsigned short) (sr_data & 0x02) << 9); - E = VDE + 1; - - cr_data = SiS_Pr->SiS_CRT1Table[index].CR[8]; - - /* Vertical retrace (=sync) start */ - VRS = (cr_data & 0xff) | - ((unsigned short) (cr_data2 & 0x04) << 6) | - ((unsigned short) (cr_data2 & 0x80) << 2) | - ((unsigned short) (sr_data & 0x08) << 7); - F = VRS + 1 - E; - - cr_data = SiS_Pr->SiS_CRT1Table[index].CR[11]; - - cr_data3 = (SiS_Pr->SiS_CRT1Table[index].CR[16] & 0x01) << 5; - - /* Vertical blank start */ - VBS = (cr_data & 0xff) | - ((unsigned short) (cr_data2 & 0x08) << 5) | - ((unsigned short) (cr_data3 & 0x20) << 4) | - ((unsigned short) (sr_data & 0x04) << 8); - - cr_data = SiS_Pr->SiS_CRT1Table[index].CR[12]; - - /* Vertical blank end */ - VBE = (cr_data & 0xff) | - ((unsigned short) (sr_data & 0x10) << 4); - temp = VBE - ((E - 1) & 511); - B = (temp > 0) ? temp : (temp + 512); - - cr_data = SiS_Pr->SiS_CRT1Table[index].CR[9]; - - /* Vertical retrace (=sync) end */ - VRE = (cr_data & 0x0f) | ((sr_data & 0x20) >> 1); - temp = VRE - ((E + F - 1) & 31); - C = (temp > 0) ? temp : (temp + 32); - - D = B - F - C; - - var->upper_margin = D; - var->lower_margin = F; - var->vsync_len = C; - - if(SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag & 0x8000) - var->sync &= ~FB_SYNC_VERT_HIGH_ACT; - else - var->sync |= FB_SYNC_VERT_HIGH_ACT; - - if(SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag & 0x4000) - var->sync &= ~FB_SYNC_HOR_HIGH_ACT; - else - var->sync |= FB_SYNC_HOR_HIGH_ACT; - - var->vmode = FB_VMODE_NONINTERLACED; - if(SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag & 0x0080) - var->vmode = FB_VMODE_INTERLACED; - else { - j = 0; - while(SiS_Pr->SiS_EModeIDTable[j].Ext_ModeID != 0xff) { - if(SiS_Pr->SiS_EModeIDTable[j].Ext_ModeID == - SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].ModeID) { - if(SiS_Pr->SiS_EModeIDTable[j].Ext_ModeFlag & DoubleScanMode) { - var->vmode = FB_VMODE_DOUBLE; - } - break; - } - j++; - } - } - - if((var->vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) { -#if 0 /* Do this? */ - var->upper_margin <<= 1; - var->lower_margin <<= 1; - var->vsync_len <<= 1; -#endif - } else if((var->vmode & FB_VMODE_MASK) == FB_VMODE_DOUBLE) { - var->upper_margin >>= 1; - var->lower_margin >>= 1; - var->vsync_len >>= 1; - } - - return 1; -} - -#endif diff --git a/drivers/video/sis/init.h b/drivers/video/sis/init.h index 7e36b7ac1470..634c0a9d219b 100644 --- a/drivers/video/sis/init.h +++ b/drivers/video/sis/init.h @@ -3,7 +3,7 @@ /* * Data and prototypes for init.c * - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria * * If distributed as part of the Linux kernel, the following license terms * apply: @@ -50,18 +50,24 @@ * */ -#ifndef _INIT_ -#define _INIT_ +#ifndef _INIT_H_ +#define _INIT_H_ #include "osdef.h" #include "initdef.h" -#ifdef LINUX_XF86 +#ifdef SIS_XORG_XF86 #include "sis.h" +#define SIS_NEED_inSISREG +#define SIS_NEED_inSISREGW +#define SIS_NEED_inSISREGL +#define SIS_NEED_outSISREG +#define SIS_NEED_outSISREGW +#define SIS_NEED_outSISREGL #include "sis_regs.h" #endif -#ifdef LINUX_KERNEL +#ifdef SIS_LINUX_KERNEL #include "vgatypes.h" #include "vstruct.h" #ifdef SIS_CP @@ -73,6 +79,10 @@ #include #include #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) +#include