This patch should be applied to an un-modified XFree86 version 4.3.0 source tree. It is patch 4 of 4 patches that will will convert the source tree to XFree86 version 4.4.0. To apply this patch, run the following from the directory containing your 'xc' directory: patch -p0 -E < XFree86-4.3.0-4.4.0.diff1 patch -p0 -E < XFree86-4.3.0-4.4.0.diff2 patch -p0 -E < XFree86-4.3.0-4.4.0.diff3 patch -p0 -E < XFree86-4.3.0-4.4.0.diff4 sh XFree86-4.3.0-4.4.0-cleanup.sh gzip -d < XFree86-4.3.0-4.4.0-diff0.tgz | tar vxf - ------------------------------------------------------------------------------- Index: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h:1.24 xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h:1.26 --- xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h:1.24 Mon Feb 10 18:42:51 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h Thu Jul 31 16:24:31 2003 @@ -36,18 +36,13 @@ |* those rights set forth herein. *| |* *| \***************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h,v 1.24 2003/02/10 23:42:51 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h,v 1.26 2003/07/31 20:24:31 mvojkovi Exp $ */ #ifndef __RIVA_HW_H__ #define __RIVA_HW_H__ -#define RIVA_SW_VERSION 0x00010003 /* * Define supported architectures. */ -#define NV_ARCH_03 0x03 -#define NV_ARCH_04 0x04 -#define NV_ARCH_10 0x10 -#define NV_ARCH_20 0x20 /***************************************************************************\ * * * FIFO registers. * @@ -60,12 +55,8 @@ typedef volatile struct { U032 reserved00[4]; -#if X_BYTE_ORDER == X_BIG_ENDIAN - U032 FifoFree; -#else U016 FifoFree; U016 Nop; -#endif U032 reserved01[0x0BB]; U032 Rop3; } RivaRop; @@ -75,12 +66,8 @@ typedef volatile struct { U032 reserved00[4]; -#if X_BYTE_ORDER == X_BIG_ENDIAN - U032 FifoFree; -#else U016 FifoFree; U016 Nop; -#endif U032 reserved01[0x0BD]; U032 Shape; U032 reserved03[0x001]; @@ -94,12 +81,8 @@ typedef volatile struct { U032 reserved00[4]; -#if X_BYTE_ORDER == X_BIG_ENDIAN - U032 FifoFree; -#else U016 FifoFree; U016 Nop; -#endif U032 reserved01[0x0BB]; U032 TopLeft; U032 WidthHeight; @@ -110,12 +93,8 @@ typedef volatile struct { U032 reserved00[4]; -#if X_BYTE_ORDER == X_BIG_ENDIAN - U032 FifoFree; -#else U016 FifoFree; U016 Nop[1]; -#endif U032 reserved01[0x0BC]; U032 Color; U032 reserved03[0x03E]; @@ -128,12 +107,8 @@ typedef volatile struct { U032 reserved00[4]; -#if X_BYTE_ORDER == X_BIG_ENDIAN - U032 FifoFree; -#else U016 FifoFree; U016 Nop; -#endif U032 reserved01[0x0BB]; U032 TopLeftSrc; U032 TopLeftDst; @@ -145,12 +120,8 @@ typedef volatile struct { U032 reserved00[4]; -#if X_BYTE_ORDER == X_BIG_ENDIAN - U032 FifoFree; -#else U016 FifoFree; U016 Nop[1]; -#endif U032 reserved01[0x0BC]; U032 TopLeft; U032 WidthHeight; @@ -164,12 +135,8 @@ typedef volatile struct { U032 reserved00[4]; -#if X_BYTE_ORDER == X_BIG_ENDIAN - U032 FifoFree; -#else U016 FifoFree; U016 Nop; -#endif U032 reserved01[0x0BB]; U032 reserved03[(0x040)-1]; U032 Color1A; @@ -230,12 +197,8 @@ typedef volatile struct { U032 reserved00[4]; -#if X_BYTE_ORDER == X_BIG_ENDIAN - U032 FifoFree; -#else U016 FifoFree; U016 Nop[1]; -#endif U032 reserved01[0x0BC]; U032 Color; /* source color 0304-0307*/ U032 Reserved02[0x03e]; @@ -265,24 +228,16 @@ typedef volatile struct { U032 reserved00[4]; -#if X_BYTE_ORDER == X_BIG_ENDIAN - U032 FifoFree; -#else U016 FifoFree; U016 Nop; -#endif U032 reserved01[0x0BE]; U032 Offset; } RivaSurface; typedef volatile struct { U032 reserved00[4]; -#if X_BYTE_ORDER == X_BIG_ENDIAN - U032 FifoFree; -#else U016 FifoFree; U016 Nop; -#endif U032 reserved01[0x0BD]; U032 Pitch; U032 RenderBufferOffset; @@ -308,9 +263,6 @@ /* * Chip specific settings. */ - U032 Architecture; - U032 Version; - U032 Chipset; U032 CrystalFreqKHz; U032 RamAmountKBytes; U032 MaxVClockFreqKHz; @@ -321,14 +273,10 @@ U032 FifoFreeCount; U032 FifoEmptyCount; U032 CursorStart; - U032 flatPanel; - Bool twoHeads; /* * Non-FIFO registers. */ - volatile U032 *PCRTC0; volatile U032 *PCRTC; - volatile U032 *PRAMDAC0; volatile U032 *PFB; volatile U032 *PFIFO; volatile U032 *PGRAPH; @@ -338,10 +286,8 @@ volatile U032 *PRAMIN; volatile U032 *FIFO; volatile U032 *CURSOR; - volatile U008 *PCIO0; volatile U008 *PCIO; volatile U008 *PVIO; - volatile U008 *PDIO0; volatile U008 *PDIO; volatile U032 *PRAMDAC; /* @@ -381,22 +327,14 @@ U032 repaint0; U032 repaint1; U032 screen; - U032 scale; - U032 dither; U032 extra; U032 pixel; U032 horiz; U032 arbitration0; U032 arbitration1; U032 vpll; - U032 vpll2; - U032 vpllB; - U032 vpll2B; U032 pllsel; U032 general; - U032 crtcOwner; - U032 head; - U032 head2; U032 config; U032 cursorConfig; U032 cursor0; Index: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_include.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nv/riva_include.h:1.1 --- /dev/null Sat Feb 28 21:42:50 2004 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/riva_include.h Thu Jul 31 16:24:31 2003 @@ -0,0 +1,59 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_include.h,v 1.1 2003/07/31 20:24:31 mvojkovi Exp $ */ + +#ifndef __RIVA_INCLUDE_H__ +#define __RIVA_INCLUDE_H__ + +/* All drivers should typically include these */ +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86Resources.h" +#include "xf86_ansic.h" +#include "compiler.h" + +/* Drivers for PCI hardware need this */ +#include "xf86PciInfo.h" + +/* Drivers that need to access the PCI config space directly need this */ +#include "xf86Pci.h" + +/* All drivers initialising the SW cursor need this */ +#include "mipointer.h" + +/* All drivers implementing backing store need this */ +#include "mibstore.h" + +#include "micmap.h" + +#include "xf86DDC.h" + +#include "vbe.h" + +#include "xf86RAC.h" + +#include "riva_const.h" + +#include "dixstruct.h" +#include "scrnintstr.h" + +#include "fb.h" + +#include "xaa.h" +#include "xf86cmap.h" +#include "shadowfb.h" +#include "fbdevhw.h" + +#include "xf86xv.h" +#include "Xv.h" + +#include "vgaHW.h" + +#include "xf86Cursor.h" +#include "xf86DDC.h" + +#include "region.h" + +#include "riva_local.h" +#include "riva_type.h" +#include "riva_proto.h" + +#endif /* __RIVA_INCLUDE_H__ */ Index: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_local.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nv/riva_local.h:1.2 --- /dev/null Sat Feb 28 21:42:50 2004 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/riva_local.h Mon Nov 3 00:11:26 2003 @@ -0,0 +1,74 @@ + /***************************************************************************\ +|* *| +|* Copyright 1993-1999 NVIDIA, Corporation. All rights reserved. *| +|* *| +|* NOTICE TO USER: The source code is copyrighted under U.S. and *| +|* international laws. Users and possessors of this source code are *| +|* hereby granted a nonexclusive, royalty-free copyright license to *| +|* use this code in individual and commercial software. *| +|* *| +|* Any use of this source code must include, in the user documenta- *| +|* tion and internal comments to the code, notices to the end user *| +|* as follows: *| +|* *| +|* Copyright 1993-1999 NVIDIA, Corporation. All rights reserved. *| +|* *| +|* NVIDIA, CORPORATION MAKES NO REPRESENTATION ABOUT THE SUITABILITY *| +|* OF THIS SOURCE CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" *| +|* WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. NVIDIA, CORPOR- *| +|* ATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOURCE CODE, *| +|* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGE- *| +|* MENT, AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL *| +|* NVIDIA, CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT, INCI- *| +|* DENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RE- *| +|* SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION *| +|* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF *| +|* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE. *| +|* *| +|* U.S. Government End Users. This source code is a "commercial *| +|* item," as that term is defined at 48 C.F.R. 2.101 (OCT 1995), *| +|* consisting of "commercial computer software" and "commercial *| +|* computer software documentation," as such terms are used in *| +|* 48 C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Govern- *| +|* ment only as a commercial end item. Consistent with 48 C.F.R. *| +|* 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), *| +|* all U.S. Government End Users acquire the source code with only *| +|* those rights set forth herein. *| +|* *| + \***************************************************************************/ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_local.h,v 1.2 2003/11/03 05:11:26 tsi Exp $ */ + +#ifndef __RIVA_LOCAL_H__ +#define __RIVA_LOCAL_H__ + +/* + * This file includes any environment or machine specific values to access the + * HW. Put all affected includes, typdefs, etc. here so the riva_hw.* files + * can stay generic in nature. + */ +#include "xf86_ansic.h" +#include "compiler.h" +#include "xf86_OSproc.h" + +/* + * Typedefs to force certain sized values. + */ +typedef unsigned char U008; +typedef unsigned short U016; +typedef unsigned int U032; + +/* + * HW access macros. These assume memory-mapped I/O, and not normal I/O space. + */ +#define RIVA_WR08(p,i,d) MMIO_OUT8((pointer)(p), (i), (d)) +#define RIVA_RD08(p,i) MMIO_IN8((pointer)(p), (i)) +#define RIVA_WR16(p,i,d) MMIO_OUT16((pointer)(p), (i), (d)) +#define RIVA_RD16(p,i) MMIO_IN16((pointer)(p), (i)) +#define RIVA_WR32(p,i,d) MMIO_OUT32((pointer)(p), (i), (d)) +#define RIVA_RD32(p,i) MMIO_IN32((pointer)(p), (i)) + +/* VGA I/O is now always done through MMIO */ +#define VGA_WR08(p,i,d) RIVA_WR08(p,i,d) +#define VGA_RD08(p,i) RIVA_RD08(p,i) + +#endif /* __RIVA_LOCAL_H__ */ Index: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_proto.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nv/riva_proto.h:1.1 --- /dev/null Sat Feb 28 21:42:51 2004 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/riva_proto.h Thu Jul 31 16:24:31 2003 @@ -0,0 +1,41 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_proto.h,v 1.1 2003/07/31 20:24:31 mvojkovi Exp $ */ + +#ifndef __RIVA_PROTO_H__ +#define __RIVA_PROTO_H__ + +/* in riva_driver.c */ +Bool RivaSwitchMode(int scrnIndex, DisplayModePtr mode, int flags); +void RivaAdjustFrame(int scrnIndex, int x, int y, int flags); +Bool RivaI2CInit(ScrnInfoPtr pScrn); +const OptionInfoRec * RivaAvailableOptions(int chipid, int busid); +Bool RivaGetScrnInfoRec(PciChipsets *chips, int chip); + +/* in riva_dac.c */ +Bool RivaDACInit(ScrnInfoPtr pScrn, DisplayModePtr mode); +void RivaDACSave(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, + RivaRegPtr rivaReg, Bool saveFonts); +void RivaDACRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, + RivaRegPtr rivaReg, Bool restoreFonts); +void RivaDACLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, + LOCO *colors, VisualPtr pVisual ); +Bool RivaDACi2cInit(ScrnInfoPtr pScrn); + + +/* in riva_setup.c */ +void RivaEnterLeave(ScrnInfoPtr pScrn, Bool enter); +void Riva3Setup(ScrnInfoPtr pScrn); + +/* in riva_cursor.c */ +Bool RivaCursorInit(ScreenPtr pScreen); + +/* in riva_xaa.c */ +Bool RivaAccelInit(ScreenPtr pScreen); +void RivaSync(ScrnInfoPtr pScrn); +void RivaResetGraphics(ScrnInfoPtr pScrn); + +/* in riva_dga.c */ +Bool RivaDGAInit(ScreenPtr pScreen); + + +#endif /* __RIVA_PROTO_H__ */ + Index: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_setup.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nv/riva_setup.c:1.1 --- /dev/null Sat Feb 28 21:42:51 2004 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/riva_setup.c Thu Jul 31 16:24:31 2003 @@ -0,0 +1,279 @@ +/* + * Copyright 1996-1997 David J. McKay + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * DAVID J. MCKAY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* Hacked together from mga driver and 3.3.4 NVIDIA driver by Jarno Paananen + */ + +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_setup.c,v 1.1 2003/07/31 20:24:31 mvojkovi Exp $ */ + +#include "riva_include.h" + +/* + * Override VGA I/O routines. + */ +static void RivaWriteCrtc(vgaHWPtr pVga, CARD8 index, CARD8 value) +{ + RivaPtr pRiva = (RivaPtr)pVga->MMIOBase; + VGA_WR08(pRiva->riva.PCIO, pVga->IOBase + VGA_CRTC_INDEX_OFFSET, index); + VGA_WR08(pRiva->riva.PCIO, pVga->IOBase + VGA_CRTC_DATA_OFFSET, value); +} +static CARD8 RivaReadCrtc(vgaHWPtr pVga, CARD8 index) +{ + RivaPtr pRiva = (RivaPtr)pVga->MMIOBase; + VGA_WR08(pRiva->riva.PCIO, pVga->IOBase + VGA_CRTC_INDEX_OFFSET, index); + return (VGA_RD08(pRiva->riva.PCIO, pVga->IOBase + VGA_CRTC_DATA_OFFSET)); +} +static void RivaWriteGr(vgaHWPtr pVga, CARD8 index, CARD8 value) +{ + RivaPtr pRiva = (RivaPtr)pVga->MMIOBase; + VGA_WR08(pRiva->riva.PVIO, VGA_GRAPH_INDEX, index); + VGA_WR08(pRiva->riva.PVIO, VGA_GRAPH_DATA, value); +} +static CARD8 RivaReadGr(vgaHWPtr pVga, CARD8 index) +{ + RivaPtr pRiva = (RivaPtr)pVga->MMIOBase; + VGA_WR08(pRiva->riva.PVIO, VGA_GRAPH_INDEX, index); + return (VGA_RD08(pRiva->riva.PVIO, VGA_GRAPH_DATA)); +} +static void RivaWriteSeq(vgaHWPtr pVga, CARD8 index, CARD8 value) +{ + RivaPtr pRiva = (RivaPtr)pVga->MMIOBase; + VGA_WR08(pRiva->riva.PVIO, VGA_SEQ_INDEX, index); + VGA_WR08(pRiva->riva.PVIO, VGA_SEQ_DATA, value); +} +static CARD8 RivaReadSeq(vgaHWPtr pVga, CARD8 index) +{ + RivaPtr pRiva = (RivaPtr)pVga->MMIOBase; + VGA_WR08(pRiva->riva.PVIO, VGA_SEQ_INDEX, index); + return (VGA_RD08(pRiva->riva.PVIO, VGA_SEQ_DATA)); +} +static void RivaWriteAttr(vgaHWPtr pVga, CARD8 index, CARD8 value) +{ + RivaPtr pRiva = (RivaPtr)pVga->MMIOBase; + volatile CARD8 tmp; + + tmp = VGA_RD08(pRiva->riva.PCIO, pVga->IOBase + VGA_IN_STAT_1_OFFSET); + if (pVga->paletteEnabled) + index &= ~0x20; + else + index |= 0x20; + VGA_WR08(pRiva->riva.PCIO, VGA_ATTR_INDEX, index); + VGA_WR08(pRiva->riva.PCIO, VGA_ATTR_DATA_W, value); +} +static CARD8 RivaReadAttr(vgaHWPtr pVga, CARD8 index) +{ + RivaPtr pRiva = (RivaPtr)pVga->MMIOBase; + volatile CARD8 tmp; + + tmp = VGA_RD08(pRiva->riva.PCIO, pVga->IOBase + VGA_IN_STAT_1_OFFSET); + if (pVga->paletteEnabled) + index &= ~0x20; + else + index |= 0x20; + VGA_WR08(pRiva->riva.PCIO, VGA_ATTR_INDEX, index); + return (VGA_RD08(pRiva->riva.PCIO, VGA_ATTR_DATA_R)); +} +static void RivaWriteMiscOut(vgaHWPtr pVga, CARD8 value) +{ + RivaPtr pRiva = (RivaPtr)pVga->MMIOBase; + VGA_WR08(pRiva->riva.PVIO, VGA_MISC_OUT_W, value); +} +static CARD8 RivaReadMiscOut(vgaHWPtr pVga) +{ + RivaPtr pRiva = (RivaPtr)pVga->MMIOBase; + return (VGA_RD08(pRiva->riva.PVIO, VGA_MISC_OUT_R)); +} +static void RivaEnablePalette(vgaHWPtr pVga) +{ + RivaPtr pRiva = (RivaPtr)pVga->MMIOBase; + volatile CARD8 tmp; + + tmp = VGA_RD08(pRiva->riva.PCIO, pVga->IOBase + VGA_IN_STAT_1_OFFSET); + VGA_WR08(pRiva->riva.PCIO, VGA_ATTR_INDEX, 0x00); + pVga->paletteEnabled = TRUE; +} +static void RivaDisablePalette(vgaHWPtr pVga) +{ + RivaPtr pRiva = (RivaPtr)pVga->MMIOBase; + volatile CARD8 tmp; + + tmp = VGA_RD08(pRiva->riva.PCIO, pVga->IOBase + VGA_IN_STAT_1_OFFSET); + VGA_WR08(pRiva->riva.PCIO, VGA_ATTR_INDEX, 0x20); + pVga->paletteEnabled = FALSE; +} +static void RivaWriteDacMask(vgaHWPtr pVga, CARD8 value) +{ + RivaPtr pRiva = (RivaPtr)pVga->MMIOBase; + VGA_WR08(pRiva->riva.PDIO, VGA_DAC_MASK, value); +} +static CARD8 RivaReadDacMask(vgaHWPtr pVga) +{ + RivaPtr pRiva = (RivaPtr)pVga->MMIOBase; + return (VGA_RD08(pRiva->riva.PDIO, VGA_DAC_MASK)); +} +static void RivaWriteDacReadAddr(vgaHWPtr pVga, CARD8 value) +{ + RivaPtr pRiva = (RivaPtr)pVga->MMIOBase; + VGA_WR08(pRiva->riva.PDIO, VGA_DAC_READ_ADDR, value); +} +static void RivaWriteDacWriteAddr(vgaHWPtr pVga, CARD8 value) +{ + RivaPtr pRiva = (RivaPtr)pVga->MMIOBase; + VGA_WR08(pRiva->riva.PDIO, VGA_DAC_WRITE_ADDR, value); +} +static void RivaWriteDacData(vgaHWPtr pVga, CARD8 value) +{ + RivaPtr pRiva = (RivaPtr)pVga->MMIOBase; + VGA_WR08(pRiva->riva.PDIO, VGA_DAC_DATA, value); +} +static CARD8 RivaReadDacData(vgaHWPtr pVga) +{ + RivaPtr pRiva = (RivaPtr)pVga->MMIOBase; + return (VGA_RD08(pRiva->riva.PDIO, VGA_DAC_DATA)); +} + + + +static xf86MonPtr +RivaProbeDDC (ScrnInfoPtr pScrn) +{ + RivaPtr pRiva = RivaPTR(pScrn); + xf86MonPtr MonInfo = NULL; + + if(!pRiva->I2C) return NULL; + + pRiva->DDCBase = 0x3e; + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Probing for EDID...\n"); + + if ((MonInfo = xf86DoEDID_DDC2(pScrn->scrnIndex, pRiva->I2C))) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + " ... found one\n"); + xf86PrintEDID( MonInfo ); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + " ... none found\n"); + } + + return MonInfo; +} + +void +Riva3Setup(ScrnInfoPtr pScrn) +{ + RivaPtr pRiva = RivaPTR(pScrn); + vgaHWPtr pVga = VGAHWPTR(pScrn); + CARD32 regBase = pRiva->IOAddress; + CARD32 frameBase = pRiva->FbAddress; + xf86MonPtr monitor; + int mmioFlags; + + pRiva->Save = RivaDACSave; + pRiva->Restore = RivaDACRestore; + pRiva->ModeInit = RivaDACInit; + + pRiva->Dac.LoadPalette = RivaDACLoadPalette; + + /* + * Override VGA I/O routines. + */ + pVga->writeCrtc = RivaWriteCrtc; + pVga->readCrtc = RivaReadCrtc; + pVga->writeGr = RivaWriteGr; + pVga->readGr = RivaReadGr; + pVga->writeAttr = RivaWriteAttr; + pVga->readAttr = RivaReadAttr; + pVga->writeSeq = RivaWriteSeq; + pVga->readSeq = RivaReadSeq; + pVga->writeMiscOut = RivaWriteMiscOut; + pVga->readMiscOut = RivaReadMiscOut; + pVga->enablePalette = RivaEnablePalette; + pVga->disablePalette = RivaDisablePalette; + pVga->writeDacMask = RivaWriteDacMask; + pVga->readDacMask = RivaReadDacMask; + pVga->writeDacWriteAddr = RivaWriteDacWriteAddr; + pVga->writeDacReadAddr = RivaWriteDacReadAddr; + pVga->writeDacData = RivaWriteDacData; + pVga->readDacData = RivaReadDacData; + /* + * Note: There are different pointers to the CRTC/AR and GR/SEQ registers. + * Bastardize the intended uses of these to make it work. + */ + pVga->MMIOBase = (CARD8 *)pRiva; + pVga->MMIOOffset = 0; + + /* + * No IRQ in use. + */ + pRiva->riva.EnableIRQ = 0; + pRiva->riva.IO = VGA_IOBASE_COLOR; + + mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT; + + pRiva->riva.PRAMDAC = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pRiva->PciTag, + regBase+0x00680000, 0x00003000); + pRiva->riva.PFB = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pRiva->PciTag, + regBase+0x00100000, 0x00001000); + pRiva->riva.PFIFO = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pRiva->PciTag, + regBase+0x00002000, 0x00002000); + pRiva->riva.PGRAPH = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pRiva->PciTag, + regBase+0x00400000, 0x00002000); + pRiva->riva.PEXTDEV = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pRiva->PciTag, + regBase+0x00101000, 0x00001000); + pRiva->riva.PTIMER = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pRiva->PciTag, + regBase+0x00009000, 0x00001000); + pRiva->riva.PMC = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pRiva->PciTag, + regBase+0x00000000, 0x00009000); + pRiva->riva.FIFO = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pRiva->PciTag, + regBase+0x00800000, 0x00010000); + pRiva->riva.PRAMIN = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pRiva->PciTag, + frameBase+0x00C00000, 0x00008000); + + /* + * These registers are read/write as 8 bit values. Probably have to map + * sparse on alpha. + */ + pRiva->riva.PCIO = (U008 *)xf86MapPciMem(pScrn->scrnIndex, mmioFlags, + pRiva->PciTag, regBase+0x00601000, + 0x00003000); + pRiva->riva.PDIO = (U008 *)xf86MapPciMem(pScrn->scrnIndex, mmioFlags, + pRiva->PciTag, regBase+0x00681000, + 0x00003000); + pRiva->riva.PVIO = (U008 *)xf86MapPciMem(pScrn->scrnIndex, mmioFlags, + pRiva->PciTag, regBase+0x000C0000, + 0x00001000); + + pRiva->riva.PCRTC = pRiva->riva.PGRAPH; + + RivaGetConfig(pRiva); + + pRiva->riva.LockUnlock(&pRiva->riva, 0); + + RivaI2CInit(pScrn); + + monitor = RivaProbeDDC(pScrn); + + if(monitor) + xf86SetDDCproperties(pScrn, monitor); + + pRiva->Dac.maxPixelClock = pRiva->riva.MaxVClockFreqKHz; +} Index: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_shadow.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nv/riva_shadow.c:1.1 --- /dev/null Sat Feb 28 21:42:51 2004 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/riva_shadow.c Thu Jul 31 16:24:31 2003 @@ -0,0 +1,194 @@ +/* + Copyright (c) 1999, The XFree86 Project Inc. + Written by Mark Vojkovich +*/ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_shadow.c,v 1.1 2003/07/31 20:24:31 mvojkovi Exp $ */ + +#include "riva_local.h" +#include "riva_include.h" +#include "riva_type.h" +#include "shadowfb.h" +#include "servermd.h" + + +void +RivaRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + RivaPtr pRiva = RivaPTR(pScrn); + int width, height, Bpp, FBPitch; + unsigned char *src, *dst; + + Bpp = pScrn->bitsPerPixel >> 3; + FBPitch = BitmapBytePad(pScrn->displayWidth * pScrn->bitsPerPixel); + + while(num--) { + width = (pbox->x2 - pbox->x1) * Bpp; + height = pbox->y2 - pbox->y1; + src = pRiva->ShadowPtr + (pbox->y1 * pRiva->ShadowPitch) + + (pbox->x1 * Bpp); + dst = pRiva->FbStart + (pbox->y1 * FBPitch) + (pbox->x1 * Bpp); + + while(height--) { + memcpy(dst, src, width); + dst += FBPitch; + src += pRiva->ShadowPitch; + } + + pbox++; + } +} + +void +RivaPointerMoved(int index, int x, int y) +{ + ScrnInfoPtr pScrn = xf86Screens[index]; + RivaPtr pRiva = RivaPTR(pScrn); + int newX, newY; + + if(pRiva->Rotate == 1) { + newX = pScrn->pScreen->height - y - 1; + newY = x; + } else { + newX = y; + newY = pScrn->pScreen->width - x - 1; + } + + (*pRiva->PointerMoved)(index, newX, newY); +} + +void +RivaRefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + RivaPtr pRiva = RivaPTR(pScrn); + int count, width, height, y1, y2, dstPitch, srcPitch; + CARD8 *dstPtr, *srcPtr, *src; + CARD32 *dst; + + dstPitch = pScrn->displayWidth; + srcPitch = -pRiva->Rotate * pRiva->ShadowPitch; + + while(num--) { + width = pbox->x2 - pbox->x1; + y1 = pbox->y1 & ~3; + y2 = (pbox->y2 + 3) & ~3; + height = (y2 - y1) >> 2; /* in dwords */ + + if(pRiva->Rotate == 1) { + dstPtr = pRiva->FbStart + + (pbox->x1 * dstPitch) + pScrn->virtualX - y2; + srcPtr = pRiva->ShadowPtr + ((1 - y2) * srcPitch) + pbox->x1; + } else { + dstPtr = pRiva->FbStart + + ((pScrn->virtualY - pbox->x2) * dstPitch) + y1; + srcPtr = pRiva->ShadowPtr + (y1 * srcPitch) + pbox->x2 - 1; + } + + while(width--) { + src = srcPtr; + dst = (CARD32*)dstPtr; + count = height; + while(count--) { + *(dst++) = src[0] | (src[srcPitch] << 8) | + (src[srcPitch * 2] << 16) | + (src[srcPitch * 3] << 24); + src += srcPitch * 4; + } + srcPtr += pRiva->Rotate; + dstPtr += dstPitch; + } + + pbox++; + } +} + + +void +RivaRefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + RivaPtr pRiva = RivaPTR(pScrn); + int count, width, height, y1, y2, dstPitch, srcPitch; + CARD16 *dstPtr, *srcPtr, *src; + CARD32 *dst; + + dstPitch = pScrn->displayWidth; + srcPitch = -pRiva->Rotate * pRiva->ShadowPitch >> 1; + + while(num--) { + width = pbox->x2 - pbox->x1; + y1 = pbox->y1 & ~1; + y2 = (pbox->y2 + 1) & ~1; + height = (y2 - y1) >> 1; /* in dwords */ + + if(pRiva->Rotate == 1) { + dstPtr = (CARD16*)pRiva->FbStart + + (pbox->x1 * dstPitch) + pScrn->virtualX - y2; + srcPtr = (CARD16*)pRiva->ShadowPtr + + ((1 - y2) * srcPitch) + pbox->x1; + } else { + dstPtr = (CARD16*)pRiva->FbStart + + ((pScrn->virtualY - pbox->x2) * dstPitch) + y1; + srcPtr = (CARD16*)pRiva->ShadowPtr + + (y1 * srcPitch) + pbox->x2 - 1; + } + + while(width--) { + src = srcPtr; + dst = (CARD32*)dstPtr; + count = height; + while(count--) { + *(dst++) = src[0] | (src[srcPitch] << 16); + src += srcPitch * 2; + } + srcPtr += pRiva->Rotate; + dstPtr += dstPitch; + } + + pbox++; + } +} + + +void +RivaRefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + RivaPtr pRiva = RivaPTR(pScrn); + int count, width, height, dstPitch, srcPitch; + CARD32 *dstPtr, *srcPtr, *src, *dst; + + dstPitch = pScrn->displayWidth; + srcPitch = -pRiva->Rotate * pRiva->ShadowPitch >> 2; + + while(num--) { + width = pbox->x2 - pbox->x1; + height = pbox->y2 - pbox->y1; + + if(pRiva->Rotate == 1) { + dstPtr = (CARD32*)pRiva->FbStart + + (pbox->x1 * dstPitch) + pScrn->virtualX - pbox->y2; + srcPtr = (CARD32*)pRiva->ShadowPtr + + ((1 - pbox->y2) * srcPitch) + pbox->x1; + } else { + dstPtr = (CARD32*)pRiva->FbStart + + ((pScrn->virtualY - pbox->x2) * dstPitch) + pbox->y1; + srcPtr = (CARD32*)pRiva->ShadowPtr + + (pbox->y1 * srcPitch) + pbox->x2 - 1; + } + + while(width--) { + src = srcPtr; + dst = dstPtr; + count = height; + while(count--) { + *(dst++) = *src; + src += srcPitch; + } + srcPtr += pRiva->Rotate; + dstPtr += dstPitch; + } + + pbox++; + } +} + + + Index: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h:1.9 xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h:1.9 Tue Jan 29 20:35:03 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h Thu Jul 31 16:24:31 2003 @@ -36,7 +36,7 @@ |* those rights set forth herein. *| |* *| \***************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h,v 1.9 2002/01/30 01:35:03 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h,v 1.10 2003/07/31 20:24:31 mvojkovi Exp $ */ /* @@ -251,576 +251,4 @@ {0x00000D1C, 0x10419208}, {0x00000D30, 0x10118201} }; -static unsigned nv4TableFIFO[][2] = -{ - {0x00003800, 0x80000014} -}; -static unsigned nv4TablePFIFO[][2] = -{ - {0x00000140, 0x00000000}, - {0x00000480, 0x00000000}, - {0x00000494, 0x00000000}, - {0x00000481, 0x00000000}, - {0x0000048B, 0x00000000}, - {0x00000400, 0x00000000}, - {0x00000414, 0x00000000}, - {0x00000084, 0x03000100}, - {0x00000085, 0x00000110}, - {0x00000086, 0x00000112}, - {0x00000143, 0x0000FFFF}, - {0x00000496, 0x0000FFFF}, - {0x00000050, 0x00000000}, - {0x00000040, 0xFFFFFFFF}, - {0x00000415, 0x00000001}, - {0x00000480, 0x00000001}, - {0x00000494, 0x00000001}, - {0x00000495, 0x00000001}, - {0x00000140, 0x00000001} -}; -static unsigned nv4TablePGRAPH[][2] = -{ - {0x00000020, 0x1231C001}, - {0x00000021, 0x72111101}, - {0x00000022, 0x11D5F071}, - {0x00000023, 0x10D4FF31}, - {0x00000060, 0x00000000}, - {0x00000068, 0x00000000}, - {0x00000070, 0x00000000}, - {0x00000078, 0x00000000}, - {0x00000061, 0x00000000}, - {0x00000069, 0x00000000}, - {0x00000071, 0x00000000}, - {0x00000079, 0x00000000}, - {0x00000062, 0x00000000}, - {0x0000006A, 0x00000000}, - {0x00000072, 0x00000000}, - {0x0000007A, 0x00000000}, - {0x00000063, 0x00000000}, - {0x0000006B, 0x00000000}, - {0x00000073, 0x00000000}, - {0x0000007B, 0x00000000}, - {0x00000064, 0x00000000}, - {0x0000006C, 0x00000000}, - {0x00000074, 0x00000000}, - {0x0000007C, 0x00000000}, - {0x00000065, 0x00000000}, - {0x0000006D, 0x00000000}, - {0x00000075, 0x00000000}, - {0x0000007D, 0x00000000}, - {0x00000066, 0x00000000}, - {0x0000006E, 0x00000000}, - {0x00000076, 0x00000000}, - {0x0000007E, 0x00000000}, - {0x00000067, 0x00000000}, - {0x0000006F, 0x00000000}, - {0x00000077, 0x00000000}, - {0x0000007F, 0x00000000}, - {0x00000058, 0x00000000}, - {0x00000059, 0x00000000}, - {0x0000005A, 0x00000000}, - {0x0000005B, 0x00000000}, - {0x00000196, 0x00000000}, - {0x000001A1, 0x01FFFFFF}, - {0x00000197, 0x00000000}, - {0x000001A2, 0x01FFFFFF}, - {0x00000198, 0x00000000}, - {0x000001A3, 0x01FFFFFF}, - {0x00000199, 0x00000000}, - {0x000001A4, 0x01FFFFFF}, - {0x00000050, 0x00000000}, - {0x00000040, 0xFFFFFFFF}, - {0x0000005C, 0x10010100}, - {0x000001C4, 0xFFFFFFFF}, - {0x000001C8, 0x00000001}, - {0x00000204, 0x00000000}, - {0x000001C3, 0x00000001} -}; -static unsigned nv4TablePGRAPH_8BPP[][2] = -{ - {0x000001C9, 0x00111111}, - {0x00000186, 0x00001010}, - {0x0000020C, 0x03020202} -}; -static unsigned nv4TablePGRAPH_15BPP[][2] = -{ - {0x000001C9, 0x00226222}, - {0x00000186, 0x00002071}, - {0x0000020C, 0x09080808} -}; -static unsigned nv4TablePGRAPH_16BPP[][2] = -{ - {0x000001C9, 0x00556555}, - {0x00000186, 0x000050C2}, - {0x0000020C, 0x0C0B0B0B} -}; -static unsigned nv4TablePGRAPH_32BPP[][2] = -{ - {0x000001C9, 0x0077D777}, - {0x00000186, 0x000070E5}, - {0x0000020C, 0x0E0D0D0D} -}; -static unsigned nv4TablePRAMIN[][2] = -{ - {0x00000000, 0x80000010}, - {0x00000001, 0x80011145}, - {0x00000002, 0x80000011}, - {0x00000003, 0x80011146}, - {0x00000004, 0x80000012}, - {0x00000005, 0x80011147}, - {0x00000006, 0x80000013}, - {0x00000007, 0x80011148}, - {0x00000008, 0x80000014}, - {0x00000009, 0x80011149}, - {0x0000000A, 0x80000015}, - {0x0000000B, 0x8001114A}, - {0x0000000C, 0x80000016}, - {0x0000000D, 0x8001114F}, - {0x00000020, 0x80000000}, - {0x00000021, 0x80011142}, - {0x00000022, 0x80000001}, - {0x00000023, 0x80011143}, - {0x00000024, 0x80000002}, - {0x00000025, 0x80011144}, - {0x00000026, 0x80000003}, - {0x00000027, 0x8001114B}, - {0x00000028, 0x80000004}, - {0x00000029, 0x8001114C}, - {0x0000002A, 0x80000005}, - {0x0000002B, 0x8001114D}, - {0x0000002C, 0x80000006}, - {0x0000002D, 0x8001114E}, - {0x00000500, 0x00003000}, - {0x00000501, 0x01FFFFFF}, - {0x00000502, 0x00000002}, - {0x00000503, 0x00000002}, - {0x00000508, 0x01008043}, - {0x0000050A, 0x00000000}, - {0x0000050B, 0x00000000}, - {0x0000050C, 0x01008019}, - {0x0000050E, 0x00000000}, - {0x0000050F, 0x00000000}, -#if 1 - {0x00000510, 0x01008018}, -#else - {0x00000510, 0x01008044}, -#endif - {0x00000512, 0x00000000}, - {0x00000513, 0x00000000}, - {0x00000514, 0x01008021}, - {0x00000516, 0x00000000}, - {0x00000517, 0x00000000}, - {0x00000518, 0x0100805F}, - {0x0000051A, 0x00000000}, - {0x0000051B, 0x00000000}, -#if 1 - {0x0000051C, 0x0100804B}, -#else - {0x0000051C, 0x0100804A}, -#endif - {0x0000051E, 0x00000000}, - {0x0000051F, 0x00000000}, - {0x00000520, 0x0100A048}, - {0x00000521, 0x00000D01}, - {0x00000522, 0x11401140}, - {0x00000523, 0x00000000}, - {0x00000524, 0x0300A054}, - {0x00000525, 0x00000D01}, - {0x00000526, 0x11401140}, - {0x00000527, 0x00000000}, - {0x00000528, 0x0300A055}, - {0x00000529, 0x00000D01}, - {0x0000052A, 0x11401140}, - {0x0000052B, 0x00000000}, - {0x0000052C, 0x00000058}, - {0x0000052E, 0x11401140}, - {0x0000052F, 0x00000000}, - {0x00000530, 0x00000059}, - {0x00000532, 0x11401140}, - {0x00000533, 0x00000000}, - {0x00000534, 0x0000005A}, - {0x00000536, 0x11401140}, - {0x00000537, 0x00000000}, - {0x00000538, 0x0000005B}, - {0x0000053A, 0x11401140}, - {0x0000053B, 0x00000000}, - {0x0000053C, 0x0300A01C}, - {0x0000053E, 0x11401140}, - {0x0000053F, 0x00000000} -}; -static unsigned nv4TablePRAMIN_8BPP[][2] = -{ - /* 0xXXXXXX01 For MSB mono format */ - /* 0xXXXXXX02 For LSB mono format */ - {0x00000509, 0x00000302}, - {0x0000050D, 0x00000302}, - {0x00000511, 0x00000202}, - {0x00000515, 0x00000302}, - {0x00000519, 0x00000302}, - {0x0000051D, 0x00000302}, - {0x0000052D, 0x00000302}, - {0x0000052E, 0x00000302}, - {0x00000535, 0x00000000}, - {0x00000539, 0x00000000}, - {0x0000053D, 0x00000302} -}; -static unsigned nv4TablePRAMIN_15BPP[][2] = -{ - /* 0xXXXXXX01 For MSB mono format */ - /* 0xXXXXXX02 For LSB mono format */ - {0x00000509, 0x00000902}, - {0x0000050D, 0x00000902}, - {0x00000511, 0x00000802}, - {0x00000515, 0x00000902}, - {0x00000519, 0x00000902}, - {0x0000051D, 0x00000902}, - {0x0000052D, 0x00000902}, - {0x0000052E, 0x00000902}, - {0x00000535, 0x00000702}, - {0x00000539, 0x00000702}, - {0x0000053D, 0x00000902} -}; -static unsigned nv4TablePRAMIN_16BPP[][2] = -{ - /* 0xXXXXXX01 For MSB mono format */ - /* 0xXXXXXX02 For LSB mono format */ - {0x00000509, 0x00000C02}, - {0x0000050D, 0x00000C02}, - {0x00000511, 0x00000B02}, - {0x00000515, 0x00000C02}, - {0x00000519, 0x00000C02}, - {0x0000051D, 0x00000C02}, - {0x0000052D, 0x00000C02}, - {0x0000052E, 0x00000C02}, - {0x00000535, 0x00000702}, - {0x00000539, 0x00000702}, - {0x0000053D, 0x00000C02} -}; -static unsigned nv4TablePRAMIN_32BPP[][2] = -{ - /* 0xXXXXXX01 For MSB mono format */ - /* 0xXXXXXX02 For LSB mono format */ - {0x00000509, 0x00000E02}, - {0x0000050D, 0x00000E02}, - {0x00000511, 0x00000D02}, - {0x00000515, 0x00000E02}, - {0x00000519, 0x00000E02}, - {0x0000051D, 0x00000E02}, - {0x0000052D, 0x00000E02}, - {0x0000052E, 0x00000E02}, - {0x00000535, 0x00000E02}, - {0x00000539, 0x00000E02}, - {0x0000053D, 0x00000E02} -}; -static unsigned nv10TableFIFO[][2] = -{ - {0x00003800, 0x80000014} -}; -static unsigned nv10TablePFIFO[][2] = -{ - {0x00000140, 0x00000000}, - {0x00000480, 0x00000000}, - {0x00000494, 0x00000000}, - {0x00000481, 0x00000000}, - {0x0000048B, 0x00000000}, - {0x00000400, 0x00000000}, - {0x00000414, 0x00000000}, - {0x00000084, 0x03000100}, - {0x00000085, 0x00000110}, - {0x00000086, 0x00000112}, - {0x00000143, 0x0000FFFF}, - {0x00000496, 0x0000FFFF}, - {0x00000050, 0x00000000}, - {0x00000040, 0xFFFFFFFF}, - {0x00000415, 0x00000001}, - {0x00000480, 0x00000001}, - {0x00000494, 0x00000001}, - {0x00000495, 0x00000001}, - {0x00000140, 0x00000001} -}; -static unsigned nv10TablePGRAPH[][2] = -{ - {0x00000020, 0x0003FFFF}, - {0x00000021, 0x00118701}, - {0x00000022, 0x24F82AD9}, - {0x00000023, 0x55DE0030}, - {0x00000020, 0x00000000}, - {0x00000024, 0x00000000}, - {0x00000058, 0x00000000}, - {0x00000060, 0x00000000}, - {0x00000068, 0x00000000}, - {0x00000070, 0x00000000}, - {0x00000078, 0x00000000}, - {0x00000059, 0x00000000}, - {0x00000061, 0x00000000}, - {0x00000069, 0x00000000}, - {0x00000071, 0x00000000}, - {0x00000079, 0x00000000}, - {0x0000005A, 0x00000000}, - {0x00000062, 0x00000000}, - {0x0000006A, 0x00000000}, - {0x00000072, 0x00000000}, - {0x0000007A, 0x00000000}, - {0x0000005B, 0x00000000}, - {0x00000063, 0x00000000}, - {0x0000006B, 0x00000000}, - {0x00000073, 0x00000000}, - {0x0000007B, 0x00000000}, - {0x0000005C, 0x00000000}, - {0x00000064, 0x00000000}, - {0x0000006C, 0x00000000}, - {0x00000074, 0x00000000}, - {0x0000007C, 0x00000000}, - {0x0000005D, 0x00000000}, - {0x00000065, 0x00000000}, - {0x0000006D, 0x00000000}, - {0x00000075, 0x00000000}, - {0x0000007D, 0x00000000}, - {0x0000005E, 0x00000000}, - {0x00000066, 0x00000000}, - {0x0000006E, 0x00000000}, - {0x00000076, 0x00000000}, - {0x0000007E, 0x00000000}, - {0x0000005F, 0x00000000}, - {0x00000067, 0x00000000}, - {0x0000006F, 0x00000000}, - {0x00000077, 0x00000000}, - {0x0000007F, 0x00000000}, - {0x00000053, 0x00000000}, - {0x00000054, 0x00000000}, - {0x00000055, 0x00000000}, - {0x00000056, 0x00000000}, - {0x00000057, 0x00000000}, - {0x00000196, 0x00000000}, - {0x000001A1, 0x01FFFFFF}, - {0x00000197, 0x00000000}, - {0x000001A2, 0x01FFFFFF}, - {0x00000198, 0x00000000}, - {0x000001A3, 0x01FFFFFF}, - {0x00000199, 0x00000000}, - {0x000001A4, 0x01FFFFFF}, - {0x0000019A, 0x00000000}, - {0x000001A5, 0x01FFFFFF}, - {0x0000019B, 0x00000000}, - {0x000001A6, 0x01FFFFFF}, - {0x00000050, 0x01111111}, - {0x00000040, 0xFFFFFFFF}, - {0x00000051, 0x10010100}, - {0x000001C5, 0xFFFFFFFF}, - {0x000001C8, 0x00000001}, - {0x00000204, 0x00000000}, - {0x000001C4, 0x00000001} -}; -static unsigned nv10TablePGRAPH_8BPP[][2] = -{ - {0x000001C9, 0x00111111}, - {0x00000186, 0x00001010}, - {0x0000020C, 0x03020202} -}; -static unsigned nv10TablePGRAPH_15BPP[][2] = -{ - {0x000001C9, 0x00226222}, - {0x00000186, 0x00002071}, - {0x0000020C, 0x09080808} -}; -static unsigned nv10TablePGRAPH_16BPP[][2] = -{ - {0x000001C9, 0x00556555}, - {0x00000186, 0x000050C2}, - {0x0000020C, 0x000B0B0C} -}; -static unsigned nv10TablePGRAPH_32BPP[][2] = -{ - {0x000001C9, 0x0077D777}, - {0x00000186, 0x000070E5}, - {0x0000020C, 0x0E0D0D0D} -}; -static unsigned nv10TablePRAMIN[][2] = -{ - {0x00000000, 0x80000010}, - {0x00000001, 0x80011145}, - {0x00000002, 0x80000011}, - {0x00000003, 0x80011146}, - {0x00000004, 0x80000012}, - {0x00000005, 0x80011147}, - {0x00000006, 0x80000013}, - {0x00000007, 0x80011148}, - {0x00000008, 0x80000014}, - {0x00000009, 0x80011149}, - {0x0000000A, 0x80000015}, - {0x0000000B, 0x8001114A}, - {0x0000000C, 0x80000016}, - {0x0000000D, 0x80011150}, - {0x00000020, 0x80000000}, - {0x00000021, 0x80011142}, - {0x00000022, 0x80000001}, - {0x00000023, 0x80011143}, - {0x00000024, 0x80000002}, - {0x00000025, 0x80011144}, - {0x00000026, 0x80000003}, - {0x00000027, 0x8001114B}, - {0x00000028, 0x80000004}, - {0x00000029, 0x8001114C}, - {0x0000002A, 0x80000005}, - {0x0000002B, 0x8001114D}, - {0x0000002C, 0x80000006}, - {0x0000002D, 0x8001114E}, - {0x0000002E, 0x80000007}, - {0x0000002F, 0x8001114F}, - {0x00000500, 0x00003000}, - {0x00000501, 0x01FFFFFF}, - {0x00000502, 0x00000002}, - {0x00000503, 0x00000002}, -#if X_BYTE_ORDER == X_BIG_ENDIAN - {0x00000508, 0x01088043}, -#else - {0x00000508, 0x01008043}, -#endif - {0x0000050A, 0x00000000}, - {0x0000050B, 0x00000000}, -#if X_BYTE_ORDER == X_BIG_ENDIAN - {0x0000050C, 0x01088019}, -#else - {0x0000050C, 0x01008019}, -#endif - {0x0000050E, 0x00000000}, - {0x0000050F, 0x00000000}, -#if X_BYTE_ORDER == X_BIG_ENDIAN - {0x00000510, 0x01088018}, -#else - {0x00000510, 0x01008018}, -#endif - {0x00000512, 0x00000000}, - {0x00000513, 0x00000000}, -#if X_BYTE_ORDER == X_BIG_ENDIAN - {0x00000514, 0x01088021}, -#else - {0x00000514, 0x01008021}, -#endif - {0x00000516, 0x00000000}, - {0x00000517, 0x00000000}, -#if X_BYTE_ORDER == X_BIG_ENDIAN - {0x00000518, 0x0108805F}, -#else - {0x00000518, 0x0100805F}, -#endif - {0x0000051A, 0x00000000}, - {0x0000051B, 0x00000000}, -#if X_BYTE_ORDER == X_BIG_ENDIAN - {0x0000051C, 0x0108804B}, -#else - {0x0000051C, 0x0100804B}, -#endif - {0x0000051E, 0x00000000}, - {0x0000051F, 0x00000000}, - {0x00000520, 0x0100A048}, - {0x00000521, 0x00000D01}, - {0x00000522, 0x11401140}, - {0x00000523, 0x00000000}, - {0x00000524, 0x0300A094}, - {0x00000525, 0x00000D01}, - {0x00000526, 0x11401140}, - {0x00000527, 0x00000000}, - {0x00000528, 0x0300A095}, - {0x00000529, 0x00000D01}, - {0x0000052A, 0x11401140}, - {0x0000052B, 0x00000000}, -#if X_BYTE_ORDER == X_BIG_ENDIAN - {0x0000052C, 0x00080058}, -#else - {0x0000052C, 0x00000058}, -#endif - {0x0000052E, 0x11401140}, - {0x0000052F, 0x00000000}, -#if X_BYTE_ORDER == X_BIG_ENDIAN - {0x00000530, 0x00080059}, -#else - {0x00000530, 0x00000059}, -#endif - {0x00000532, 0x11401140}, - {0x00000533, 0x00000000}, - {0x00000534, 0x0000005A}, - {0x00000536, 0x11401140}, - {0x00000537, 0x00000000}, - {0x00000538, 0x0000005B}, - {0x0000053A, 0x11401140}, - {0x0000053B, 0x00000000}, - {0x0000053C, 0x00000093}, - {0x0000053E, 0x11401140}, - {0x0000053F, 0x00000000}, -#if X_BYTE_ORDER == X_BIG_ENDIAN - {0x00000540, 0x0308A01C}, -#else - {0x00000540, 0x0300A01C}, -#endif - {0x00000542, 0x11401140}, - {0x00000543, 0x00000000} -}; -static unsigned nv10TablePRAMIN_8BPP[][2] = -{ - /* 0xXXXXXX01 For MSB mono format */ - /* 0xXXXXXX02 For LSB mono format */ - {0x00000509, 0x00000302}, - {0x0000050D, 0x00000302}, - {0x00000511, 0x00000202}, - {0x00000515, 0x00000302}, - {0x00000519, 0x00000302}, - {0x0000051D, 0x00000302}, - {0x0000052D, 0x00000302}, - {0x0000052E, 0x00000302}, - {0x00000535, 0x00000000}, - {0x00000539, 0x00000000}, - {0x0000053D, 0x00000000}, - {0x00000541, 0x00000302} -}; -static unsigned nv10TablePRAMIN_15BPP[][2] = -{ - /* 0xXXXXXX01 For MSB mono format */ - /* 0xXXXXXX02 For LSB mono format */ - {0x00000509, 0x00000902}, - {0x0000050D, 0x00000902}, - {0x00000511, 0x00000802}, - {0x00000515, 0x00000902}, - {0x00000519, 0x00000902}, - {0x0000051D, 0x00000902}, - {0x0000052D, 0x00000902}, - {0x0000052E, 0x00000902}, - {0x00000535, 0x00000902}, - {0x00000539, 0x00000902}, - {0x0000053D, 0x00000902}, - {0x00000541, 0x00000902} -}; -static unsigned nv10TablePRAMIN_16BPP[][2] = -{ - /* 0xXXXXXX01 For MSB mono format */ - /* 0xXXXXXX02 For LSB mono format */ - {0x00000509, 0x00000C02}, - {0x0000050D, 0x00000C02}, - {0x00000511, 0x00000B02}, - {0x00000515, 0x00000C02}, - {0x00000519, 0x00000C02}, - {0x0000051D, 0x00000C02}, - {0x0000052D, 0x00000C02}, - {0x0000052E, 0x00000C02}, - {0x00000535, 0x00000C02}, - {0x00000539, 0x00000C02}, - {0x0000053D, 0x00000C02}, - {0x00000541, 0x00000C02} -}; -static unsigned nv10TablePRAMIN_32BPP[][2] = -{ - /* 0xXXXXXX01 For MSB mono format */ - /* 0xXXXXXX02 For LSB mono format */ - {0x00000509, 0x00000E02}, - {0x0000050D, 0x00000E02}, - {0x00000511, 0x00000D02}, - {0x00000515, 0x00000E02}, - {0x00000519, 0x00000E02}, - {0x0000051D, 0x00000E02}, - {0x0000052D, 0x00000E02}, - {0x0000052E, 0x00000E02}, - {0x00000535, 0x00000E02}, - {0x00000539, 0x00000E02}, - {0x0000053D, 0x00000E02}, - {0x00000541, 0x00000E02} -}; Index: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_type.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nv/riva_type.h:1.1 --- /dev/null Sat Feb 28 21:42:51 2004 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/riva_type.h Thu Jul 31 16:24:31 2003 @@ -0,0 +1,122 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_type.h,v 1.1 2003/07/31 20:24:31 mvojkovi Exp $ */ + +#ifndef __Riva_STRUCT_H__ +#define __Riva_STRUCT_H__ + +#include "riva_hw.h" +#include "colormapst.h" +#include "vgaHW.h" +#include "xaa.h" +#include "xf86Cursor.h" +#include "xf86int10.h" + + +#define BITMASK(t,b) (((unsigned)(1U << (((t)-(b)+1)))-1) << (b)) +#define MASKEXPAND(mask) BITMASK(1?mask,0?mask) +#define SetBF(mask,value) ((value) << (0?mask)) +#define GetBF(var,mask) (((unsigned)((var) & MASKEXPAND(mask))) >> (0?mask) ) +#define SetBitField(value,from,to) SetBF(to, GetBF(value,from)) +#define SetBit(n) (1<<(n)) +#define Set8Bits(value) ((value)&0xff) + +typedef RIVA_HW_STATE* RivaRegPtr; + +typedef struct { + Bool isHwCursor; + int CursorMaxWidth; + int CursorMaxHeight; + int CursorFlags; + int CursorOffscreenMemSize; + Bool (*UseHWCursor)(ScreenPtr, CursorPtr); + void (*LoadCursorImage)(ScrnInfoPtr, unsigned char*); + void (*ShowCursor)(ScrnInfoPtr); + void (*HideCursor)(ScrnInfoPtr); + void (*SetCursorPosition)(ScrnInfoPtr, int, int); + void (*SetCursorColors)(ScrnInfoPtr, int, int); + long maxPixelClock; + void (*LoadPalette)(ScrnInfoPtr, int, int*, LOCO*, VisualPtr); + void (*Save)(ScrnInfoPtr, vgaRegPtr, RivaRegPtr, Bool); + void (*Restore)(ScrnInfoPtr, vgaRegPtr, RivaRegPtr, Bool); + Bool (*ModeInit)(ScrnInfoPtr, DisplayModePtr); +} RivaRamdacRec, *RivaRamdacPtr; + +typedef struct { + int bitsPerPixel; + int depth; + int displayWidth; + rgb weight; + DisplayModePtr mode; +} RivaFBLayout; + +typedef struct { + RIVA_HW_INST riva; + RIVA_HW_STATE SavedReg; + RIVA_HW_STATE ModeReg; + EntityInfoPtr pEnt; + pciVideoPtr PciInfo; + PCITAG PciTag; + xf86AccessRec Access; + int ChipRev; + Bool Primary; + CARD32 IOAddress; + unsigned long FbAddress; + int FbBaseReg; + unsigned char * IOBase; + unsigned char * FbBase; + unsigned char * FbStart; + long FbMapSize; + long FbUsableSize; + RivaRamdacRec Dac; + Bool NoAccel; + Bool HWCursor; + Bool ShowCache; + Bool ShadowFB; + unsigned char * ShadowPtr; + int ShadowPitch; + int MinClock; + int MaxClock; + XAAInfoRecPtr AccelInfoRec; + xf86CursorInfoPtr CursorInfoRec; + DGAModePtr DGAModes; + int numDGAModes; + Bool DGAactive; + int DGAViewportStatus; + void (*Save)(ScrnInfoPtr, vgaRegPtr, RivaRegPtr, Bool); + void (*Restore)(ScrnInfoPtr, vgaRegPtr, RivaRegPtr, Bool); + Bool (*ModeInit)(ScrnInfoPtr, DisplayModePtr); + void (*PointerMoved)(int index, int x, int y); + CloseScreenProcPtr CloseScreen; + Bool FBDev; + /* Color expansion */ + unsigned char *expandBuffer; + unsigned char *expandFifo; + int expandWidth; + int expandRows; + CARD32 FgColor; + CARD32 BgColor; + int Rotate; + RivaFBLayout CurrentLayout; + /* Cursor */ + CARD32 curFg, curBg; + CARD32 curImage[64]; + /* Misc flags */ + unsigned int opaqueMonochrome; + int currentRop; + /* I2C / DDC */ + I2CBusPtr I2C; + xf86Int10InfoPtr pInt; + OptionInfoPtr Options; + unsigned char DDCBase; +} RivaRec, *RivaPtr; + +#define RivaPTR(p) ((RivaPtr)((p)->driverPrivate)) + +void RivaRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +void RivaRefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +void RivaRefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +void RivaRefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +void RivaPointerMoved(int index, int x, int y); + +int RivaGetConfig(RivaPtr); + +#endif /* __Riva_STRUCT_H__ */ Index: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_xaa.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nv/riva_xaa.c:1.1 --- /dev/null Sat Feb 28 21:42:51 2004 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/riva_xaa.c Thu Jul 31 16:24:31 2003 @@ -0,0 +1,554 @@ + /***************************************************************************\ +|* *| +|* Copyright 1993-1999 NVIDIA, Corporation. All rights reserved. *| +|* *| +|* NOTICE TO USER: The source code is copyrighted under U.S. and *| +|* international laws. Users and possessors of this source code are *| +|* hereby granted a nonexclusive, royalty-free copyright license to *| +|* use this code in individual and commercial software. *| +|* *| +|* Any use of this source code must include, in the user documenta- *| +|* tion and internal comments to the code, notices to the end user *| +|* as follows: *| +|* *| +|* Copyright 1993-1999 NVIDIA, Corporation. All rights reserved. *| +|* *| +|* NVIDIA, CORPORATION MAKES NO REPRESENTATION ABOUT THE SUITABILITY *| +|* OF THIS SOURCE CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" *| +|* WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. NVIDIA, CORPOR- *| +|* ATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOURCE CODE, *| +|* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGE- *| +|* MENT, AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL *| +|* NVIDIA, CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT, INCI- *| +|* DENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RE- *| +|* SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION *| +|* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF *| +|* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE. *| +|* *| +|* U.S. Government End Users. This source code is a "commercial *| +|* item," as that term is defined at 48 C.F.R. 2.101 (OCT 1995), *| +|* consisting of "commercial computer software" and "commercial *| +|* computer software documentation," as such terms are used in *| +|* 48 C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Govern- *| +|* ment only as a commercial end item. Consistent with 48 C.F.R. *| +|* 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), *| +|* all U.S. Government End Users acquire the source code with only *| +|* those rights set forth herein. *| +|* *| + \***************************************************************************/ + +/* Hacked together from mga driver and 3.3.4 NVIDIA driver by + Jarno Paananen */ + +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_xaa.c,v 1.1 2003/07/31 20:24:31 mvojkovi Exp $ */ + +#include "riva_include.h" +#include "xaalocal.h" +#include "xaarop.h" + +#include "miline.h" + +static void +RivaSetClippingRectangle(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2) +{ + int height = y2-y1 + 1; + int width = x2-x1 + 1; + RivaPtr pRiva = RivaPTR(pScrn); + + RIVA_FIFO_FREE(pRiva->riva, Clip, 2); + pRiva->riva.Clip->TopLeft = (y1 << 16) | (x1 & 0xffff); + pRiva->riva.Clip->WidthHeight = (height << 16) | width; +} + + +static void +RivaDisableClipping(ScrnInfoPtr pScrn) +{ + RivaSetClippingRectangle(pScrn, 0, 0, 0x7fff, 0x7fff); +} + +/* + * Set pattern. Internal routine. The upper bits of the colors + * are the ALPHA bits. 0 == transparency. + */ +static void +RivaSetPattern(RivaPtr pRiva, int clr0, int clr1, int pat0, int pat1) +{ + RIVA_FIFO_FREE(pRiva->riva, Patt, 4); + pRiva->riva.Patt->Color0 = clr0; + pRiva->riva.Patt->Color1 = clr1; + pRiva->riva.Patt->Monochrome[0] = pat0; + pRiva->riva.Patt->Monochrome[1] = pat1; +} + +/* + * Set ROP. Translate X rop into ROP3. Internal routine. + */ +static void +RivaSetRopSolid(RivaPtr pRiva, int rop) +{ + if (pRiva->currentRop != rop) { + if (pRiva->currentRop >= 16) + RivaSetPattern(pRiva, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF); + pRiva->currentRop = rop; + RIVA_FIFO_FREE(pRiva->riva, Rop, 1); + pRiva->riva.Rop->Rop3 = XAACopyROP[rop]; + } +} + +static void +RivaSetRopPattern(RivaPtr pRiva, int rop) +{ + if (pRiva->currentRop != (rop + 16)) { + pRiva->currentRop = rop + 16; /* +16 is important */ + RIVA_FIFO_FREE(pRiva->riva, Rop, 1); + pRiva->riva.Rop->Rop3 = XAAPatternROP[rop]; + } +} + +/* + * Fill solid rectangles. + */ +static +void RivaSetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, + unsigned planemask) +{ + RivaPtr pRiva = RivaPTR(pScrn); + + RivaSetRopSolid(pRiva, rop); + RIVA_FIFO_FREE(pRiva->riva, Bitmap, 1); + pRiva->riva.Bitmap->Color1A = color; +} + +static void +RivaSubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h) +{ + RivaPtr pRiva = RivaPTR(pScrn); + + RIVA_FIFO_FREE(pRiva->riva, Bitmap, 2); + pRiva->riva.Bitmap->UnclippedRectangle[0].TopLeft = (x << 16) | y; + write_mem_barrier(); + pRiva->riva.Bitmap->UnclippedRectangle[0].WidthHeight = (w << 16) | h; + write_mem_barrier(); +} + +/* + * Screen to screen BLTs. + */ +static void +RivaSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop, + unsigned planemask, int transparency_color) +{ + RivaSetRopSolid(RivaPTR(pScrn), rop); +} + +static void +RivaSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, + int x2, int y2, int w, int h) +{ + RivaPtr pRiva = RivaPTR(pScrn); + + RIVA_FIFO_FREE(pRiva->riva, Blt, 3); + pRiva->riva.Blt->TopLeftSrc = (y1 << 16) | x1; + pRiva->riva.Blt->TopLeftDst = (y2 << 16) | x2; + write_mem_barrier(); + pRiva->riva.Blt->WidthHeight = (h << 16) | w; + write_mem_barrier(); +} + + +/* + * Fill 8x8 monochrome pattern rectangles. patternx and patterny are + * the overloaded pattern bits themselves. The pattern colors don't + * support 565, only 555. Hack around it. + */ +static void +RivaSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patternx, int patterny, + int fg, int bg, int rop, unsigned planemask) +{ + RivaPtr pRiva = RivaPTR(pScrn); + + RivaSetRopPattern(pRiva, rop); + if (pScrn->depth == 16) + { + fg = ((fg & 0x0000F800) << 8) + | ((fg & 0x000007E0) << 5) + | ((fg & 0x0000001F) << 3) + | 0xFF000000; + if (bg != -1) + bg = ((bg & 0x0000F800) << 8) + | ((bg & 0x000007E0) << 5) + | ((bg & 0x0000001F) << 3) + | 0xFF000000; + else + bg = 0; + } + else + { + fg |= pRiva->opaqueMonochrome; + bg = (bg == -1) ? 0 : bg | pRiva->opaqueMonochrome; + }; + RivaSetPattern(pRiva, bg, fg, patternx, patterny); + RIVA_FIFO_FREE(pRiva->riva, Bitmap, 1); + pRiva->riva.Bitmap->Color1A = fg; +} + +static void +RivaSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, + int patternx, int patterny, + int x, int y, int w, int h) +{ + RivaPtr pRiva = RivaPTR(pScrn); + + RIVA_FIFO_FREE(pRiva->riva, Bitmap, 2); + pRiva->riva.Bitmap->UnclippedRectangle[0].TopLeft = (x << 16) | y; + write_mem_barrier(); + pRiva->riva.Bitmap->UnclippedRectangle[0].WidthHeight = (w << 16) | h; + write_mem_barrier(); +} + + +void +RivaResetGraphics(ScrnInfoPtr pScrn) +{ + RivaPtr pRiva = RivaPTR(pScrn); + + if(pRiva->NoAccel) return; + + RIVA_FIFO_FREE(pRiva->riva, Patt, 1); + pRiva->riva.Patt->Shape = 0; + RivaDisableClipping(pScrn); + pRiva->currentRop = 16; /* to force RivaSetRopSolid to reset the pattern */ + RivaSetRopSolid(pRiva, GXcopy); +} + + + +/* + * Synchronise with graphics engine. Make sure it is idle before returning. + * Should attempt to yield CPU if busy for awhile. + */ +void RivaSync(ScrnInfoPtr pScrn) +{ + RivaPtr pRiva = RivaPTR(pScrn); + RIVA_BUSY(pRiva->riva); +} + +/* Color expansion */ +static void +RivaSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, + int fg, int bg, int rop, + unsigned int planemask) +{ + RivaPtr pRiva = RivaPTR(pScrn); + + RivaSetRopSolid(pRiva, rop); + + if ( bg == -1 ) + { + /* Transparent case */ + bg = 0x80000000; + pRiva->expandFifo = (unsigned char*)&pRiva->riva.Bitmap->MonochromeData1C; + } + else + { + pRiva->expandFifo = (unsigned char*)&pRiva->riva.Bitmap->MonochromeData01E; + if (pScrn->depth == 16) + { + bg = ((bg & 0x0000F800) << 8) + | ((bg & 0x000007E0) << 5) + | ((bg & 0x0000001F) << 3) + | 0xFF000000; + } + else + { + bg |= pRiva->opaqueMonochrome; + }; + } + pRiva->FgColor = fg; + pRiva->BgColor = bg; +} + +static void +RivaSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) +{ + RivaPtr pRiva = RivaPTR(pScrn); + + int t = pRiva->expandWidth; + CARD32 *pbits = (CARD32*)pRiva->expandBuffer; + CARD32 *d = (CARD32*)pRiva->expandFifo; + + while(t >= 16) + { + RIVA_FIFO_FREE(pRiva->riva, Bitmap, 16); + d[0] = pbits[0]; + d[1] = pbits[1]; + d[2] = pbits[2]; + d[3] = pbits[3]; + d[4] = pbits[4]; + d[5] = pbits[5]; + d[6] = pbits[6]; + d[7] = pbits[7]; + d[8] = pbits[8]; + d[9] = pbits[9]; + d[10] = pbits[10]; + d[11] = pbits[11]; + d[12] = pbits[12]; + d[13] = pbits[13]; + d[14] = pbits[14]; + d[15] = pbits[15]; + t -= 16; pbits += 16; + } + if(t) { + RIVA_FIFO_FREE(pRiva->riva, Bitmap, t); + while(t >= 4) + { + d[0] = pbits[0]; + d[1] = pbits[1]; + d[2] = pbits[2]; + d[3] = pbits[3]; + t -= 4; pbits += 4; + } + while(t--) + *(d++) = *(pbits++); + } + + if (!(--pRiva->expandRows)) { /* hardware bug workaround */ + RIVA_FIFO_FREE(pRiva->riva, Blt, 1); + write_mem_barrier(); + pRiva->riva.Blt->TopLeftSrc = 0; + } + write_mem_barrier(); +} + +static void +RivaSubsequentColorExpandScanlineFifo(ScrnInfoPtr pScrn, int bufno) +{ + RivaPtr pRiva = RivaPTR(pScrn); + + if ( --pRiva->expandRows ) { + RIVA_FIFO_FREE(pRiva->riva, Bitmap, pRiva->expandWidth); + } else { /* hardware bug workaround */ + RIVA_FIFO_FREE(pRiva->riva, Blt, 1); + write_mem_barrier(); + pRiva->riva.Blt->TopLeftSrc = 0; + } + write_mem_barrier(); +} + +static void +RivaSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int x, + int y, int w, int h, + int skipleft) +{ + int bw; + RivaPtr pRiva = RivaPTR(pScrn); + + bw = (w + 31) & ~31; + pRiva->expandWidth = bw >> 5; + + if ( pRiva->BgColor == 0x80000000 ) + { + /* Use faster transparent method */ + RIVA_FIFO_FREE(pRiva->riva, Bitmap, 5); + pRiva->riva.Bitmap->ClipC.TopLeft = (y << 16) | ((x+skipleft) + & 0xFFFF); + pRiva->riva.Bitmap->ClipC.BottomRight = ((y+h) << 16) | ((x+w)&0xffff); + pRiva->riva.Bitmap->Color1C = pRiva->FgColor; + pRiva->riva.Bitmap->WidthHeightC = (h << 16) | bw; + write_mem_barrier(); + pRiva->riva.Bitmap->PointC = (y << 16) | (x & 0xFFFF); + write_mem_barrier(); + } + else + { + /* Opaque */ + RIVA_FIFO_FREE(pRiva->riva, Bitmap, 7); + pRiva->riva.Bitmap->ClipE.TopLeft = (y << 16) | ((x+skipleft) + & 0xFFFF); + pRiva->riva.Bitmap->ClipE.BottomRight = ((y+h) << 16) | ((x+w)&0xffff); + pRiva->riva.Bitmap->Color0E = pRiva->BgColor; + pRiva->riva.Bitmap->Color1E = pRiva->FgColor; + pRiva->riva.Bitmap->WidthHeightInE = (h << 16) | bw; + pRiva->riva.Bitmap->WidthHeightOutE = (h << 16) | bw; + write_mem_barrier(); + pRiva->riva.Bitmap->PointE = (y << 16) | (x & 0xFFFF); + write_mem_barrier(); + } + + pRiva->expandRows = h; + + if(pRiva->expandWidth > (pRiva->riva.FifoEmptyCount >> 2)) { + pRiva->AccelInfoRec->ScanlineColorExpandBuffers = &pRiva->expandBuffer; + pRiva->AccelInfoRec->SubsequentColorExpandScanline = + RivaSubsequentColorExpandScanline; + } else { + pRiva->AccelInfoRec->ScanlineColorExpandBuffers = &pRiva->expandFifo; + pRiva->AccelInfoRec->SubsequentColorExpandScanline = + RivaSubsequentColorExpandScanlineFifo; + RIVA_FIFO_FREE(pRiva->riva, Bitmap, pRiva->expandWidth); + } +} + +static void +RivaSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop, unsigned planemask) +{ + RivaPtr pRiva = RivaPTR(pScrn); + + RivaSetRopSolid(pRiva, rop); + pRiva->FgColor = color; +} + +static void +RivaSubsequentSolidHorVertLine(ScrnInfoPtr pScrn, int x, int y, int len, int dir) +{ + RivaPtr pRiva = RivaPTR(pScrn); + + RIVA_FIFO_FREE(pRiva->riva, Line, 3); + pRiva->riva.Line->Color = pRiva->FgColor; + pRiva->riva.Line->Lin[0].point0 = ((y << 16) | ( x & 0xffff)); + write_mem_barrier(); + if ( dir ==DEGREES_0 ) + pRiva->riva.Line->Lin[0].point1 = ((y << 16) | (( x + len ) & 0xffff)); + else + pRiva->riva.Line->Lin[0].point1 = (((y + len) << 16) | ( x & 0xffff)); + write_mem_barrier(); +} + +static void +RivaSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, int x1, int y1, + int x2, int y2, int flags) +{ + RivaPtr pRiva = RivaPTR(pScrn); + Bool lastPoint = !(flags & OMIT_LAST); + + RIVA_FIFO_FREE(pRiva->riva, Line, lastPoint ? 5 : 3); + pRiva->riva.Line->Color = pRiva->FgColor; + pRiva->riva.Line->Lin[0].point0 = ((y1 << 16) | (x1 & 0xffff)); + write_mem_barrier(); + pRiva->riva.Line->Lin[0].point1 = ((y2 << 16) | (x2 & 0xffff)); + write_mem_barrier(); + if (lastPoint) + { + pRiva->riva.Line->Lin[1].point0 = ((y2 << 16) | (x2 & 0xffff)); + write_mem_barrier(); + pRiva->riva.Line->Lin[1].point1 = (((y2 + 1) << 16) | (x2 & 0xffff)); + write_mem_barrier(); + } +} + +static void +RivaValidatePolyArc( + GCPtr pGC, + unsigned long changes, + DrawablePtr pDraw +){ + if(pGC->planemask != ~0) return; + + if(!pGC->lineWidth && + ((pGC->alu != GXcopy) || (pGC->lineStyle != LineSolid))) + { + pGC->ops->PolyArc = miZeroPolyArc; + } +} + +static void +RivaValidatePolyPoint( + GCPtr pGC, + unsigned long changes, + DrawablePtr pDraw +){ + pGC->ops->PolyPoint = XAAFallbackOps.PolyPoint; + + if(pGC->planemask != ~0) return; + + if(pGC->alu != GXcopy) + pGC->ops->PolyPoint = miPolyPoint; +} + +/* Initialize XAA acceleration info */ +Bool +RivaAccelInit(ScreenPtr pScreen) +{ + XAAInfoRecPtr infoPtr; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RivaPtr pRiva = RivaPTR(pScrn); + + pRiva->AccelInfoRec = infoPtr = XAACreateInfoRec(); + if(!infoPtr) return FALSE; + + /* fill out infoPtr here */ + infoPtr->Flags = LINEAR_FRAMEBUFFER | PIXMAP_CACHE | OFFSCREEN_PIXMAPS; + + /* sync */ + infoPtr->Sync = RivaSync; + + /* solid fills */ + infoPtr->SolidFillFlags = NO_PLANEMASK; + infoPtr->SetupForSolidFill = RivaSetupForSolidFill; + infoPtr->SubsequentSolidFillRect = RivaSubsequentSolidFillRect; + + /* screen to screen copy */ + infoPtr->ScreenToScreenCopyFlags = NO_TRANSPARENCY | NO_PLANEMASK; + infoPtr->SetupForScreenToScreenCopy = RivaSetupForScreenToScreenCopy; + infoPtr->SubsequentScreenToScreenCopy = RivaSubsequentScreenToScreenCopy; + + /* 8x8 mono patterns */ + /* + * Set pattern opaque bits based on pixel format. + */ + pRiva->opaqueMonochrome = ~((1 << pScrn->depth) - 1); + + infoPtr->Mono8x8PatternFillFlags = HARDWARE_PATTERN_SCREEN_ORIGIN | + HARDWARE_PATTERN_PROGRAMMED_BITS | + NO_PLANEMASK; + infoPtr->SetupForMono8x8PatternFill = RivaSetupForMono8x8PatternFill; + infoPtr->SubsequentMono8x8PatternFillRect = + RivaSubsequentMono8x8PatternFillRect; + + /* Color expansion */ + infoPtr->ScanlineCPUToScreenColorExpandFillFlags = + BIT_ORDER_IN_BYTE_LSBFIRST | + NO_PLANEMASK | + CPU_TRANSFER_PAD_DWORD | + LEFT_EDGE_CLIPPING | + LEFT_EDGE_CLIPPING_NEGATIVE_X; + + infoPtr->NumScanlineColorExpandBuffers = 1; + + infoPtr->SetupForScanlineCPUToScreenColorExpandFill = + RivaSetupForScanlineCPUToScreenColorExpandFill; + infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = + RivaSubsequentScanlineCPUToScreenColorExpandFill; + + pRiva->expandFifo = (unsigned char*)&pRiva->riva.Bitmap->MonochromeData01E; + + /* Allocate buffer for color expansion and also image writes in the + future */ + pRiva->expandBuffer = xnfalloc(((pScrn->virtualX*pScrn->bitsPerPixel)/8) + 8); + + + infoPtr->ScanlineColorExpandBuffers = &pRiva->expandBuffer; + infoPtr->SubsequentColorExpandScanline = RivaSubsequentColorExpandScanline; + + infoPtr->SolidLineFlags = infoPtr->SolidFillFlags; + infoPtr->SetupForSolidLine = RivaSetupForSolidLine; + infoPtr->SubsequentSolidHorVertLine = + RivaSubsequentSolidHorVertLine; + infoPtr->SubsequentSolidTwoPointLine = + RivaSubsequentSolidTwoPointLine; + infoPtr->SetClippingRectangle = RivaSetClippingRectangle; + infoPtr->DisableClipping = RivaDisableClipping; + infoPtr->ClippingFlags = HARDWARE_CLIP_SOLID_LINE; + miSetZeroLineBias(pScreen, OCTANT1 | OCTANT3 | OCTANT4 | OCTANT6); + + infoPtr->ValidatePolyArc = RivaValidatePolyArc; + infoPtr->PolyArcMask = GCFunction | GCLineWidth | GCPlaneMask; + infoPtr->ValidatePolyPoint = RivaValidatePolyPoint; + infoPtr->PolyPointMask = GCFunction | GCPlaneMask; + + RivaResetGraphics(pScrn); + + return(XAAInit(pScreen, infoPtr)); +} + Index: xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.c diff -u xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.c:1.50 xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.c:1.59 --- xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.c:1.50 Tue Oct 8 18:14:10 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.c Sat Jan 10 23:03:16 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.c,v 1.50 2002/10/08 22:14:10 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.c,v 1.59 2004/01/11 04:03:16 dawes Exp $ */ /* * Copyright (C) 1998 The XFree86 Project, Inc. All Rights Reserved. * @@ -75,6 +75,22 @@ #define RENDITION_VERSION_CURRENT ((RENDITION_VERSION_MAJOR << 24) | \ (RENDITION_VERSION_MINOR << 16) | RENDITION_PATCHLEVEL) +/* + * Constants for the (theoretical) maximum width and height that can + * be used to display data on the CRT. These were calculated from + * the HORZ and VERT macors, respectively, in vmodes.c. + */ +static const int MAX_HDISPLAY = 2048; +static const int MAX_VDISPLAY = 2048; + +/* + * Constants for the (theoretical) maximum line length of a scan line + * and scan lines per screen (including overdraw). These were + * calculated from the HORZ and VERT macors, respectively, in vmodes.c. + */ +static const int MAX_HTOTAL = 2880; +static const int MAX_VTOTAL = 2184; + /* * local function prototypes */ @@ -152,12 +168,14 @@ NULL }; +#if defined(XFree86LOADER) || USE_ACCEL static const char *xaaSymbols[] = { "XAACreateInfoRec", "XAADestroyInfoRec", "XAAInit", NULL }; +#endif static const char *ddcSymbols[] = { "xf86DoEDID_DDC1", @@ -171,11 +189,13 @@ NULL }; +#ifdef XFree86LOADER static const char *miscfbSymbols[]={ "xf1bppScreenInit", "xf4bppScreenInit", NULL }; +#endif static const char *fbSymbols[]={ "fbScreenInit", @@ -251,7 +271,7 @@ /* supported chipsets */ static SymTabRec renditionChipsets[] = { {CHIP_RENDITION_V1000, "V1000"}, - {CHIP_RENDITION_V2x00, "V2100/V2200"}, + {CHIP_RENDITION_V2x00, "V2x00"}, {-1, NULL} }; @@ -526,18 +546,43 @@ pScreenInfo->racIoFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT; /* determine depth, bpp, etc. */ - if (!xf86SetDepthBpp(pScreenInfo, 8, 8, 8, Support32bppFb)) + if (!xf86SetDepthBpp(pScreenInfo, 0, 0, 0, Support32bppFb)) return FALSE; - if (pScreenInfo->depth == 15) - { - if (PCI_CHIP_V1000 != pRendition->PciInfo->chipType) { - xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, - "Given depth (%d) is not supported by this chipset.\n", - pScreenInfo->depth); - return FALSE; - } - } + /* Verify that the color depth is supported. */ + switch( pScreenInfo->depth ) { + + case 8: + case 16: + case 24: + { + break; + } + + case 15: + { + if (PCI_CHIP_V1000 != pRendition->PciInfo->chipType) { + xf86DrvMsg( pScreenInfo->scrnIndex, X_ERROR, + "Given depth (%d) is not supported by this chipset.\n", + pScreenInfo->depth); + return FALSE; + } + } + + default: + { + xf86DrvMsg( pScreenInfo->scrnIndex, X_ERROR, + "Given depth (%d) is not supported by this driver\n", + pScreenInfo->depth ); + return FALSE; + } + + } /* End of switch( pScreenInfo->depth ) {*/ + + + /* Print the color depth and frame buffer bits per pixel. */ + xf86PrintDepthBpp( pScreenInfo ); + /* collect all of the options flags and process them */ @@ -599,8 +644,10 @@ renditionClockRange.clockIndex = -1; } - /***********************************************/ - /* ensure vgahw private structure is allocated */ + if (!xf86LoadSubModule(pScreenInfo, "vgahw")){ + return FALSE; + } + xf86LoaderReqSymLists(vgahwSymbols, NULL); if (!vgaHWGetHWRec(pScreenInfo)) return FALSE; @@ -631,7 +678,7 @@ /* I do not get the IO base addres */ /* XXX Is this still true? If so, the wrong base is being checked */ xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED, - "Rendition %s @ %x/%x\n", + "Rendition %s @ %lx/%lx\n", renditionChipsets[pRendition->board.chip==V1000_DEVICE ? 0:1] .name, pRendition->PciInfo->ioBase[1], @@ -657,11 +704,6 @@ /* Load the needed symbols */ - if (!xf86LoadSubModule(pScreenInfo, "vgahw")){ - return FALSE; - } - xf86LoaderReqSymLists(vgahwSymbols, NULL); - pRendition->board.shadowfb=TRUE; if ((in_string = xf86GetOptValString(pRendition->Options, OPTION_ROTATE))){ @@ -733,13 +775,13 @@ #else /* Load DDC module if needed */ if (!xf86ReturnOptValBool(pRendition->Options, OPTION_NO_DDC,0)){ - if (!xf86LoadSubModule(pScreenInfo, "vbe")) { + if (!xf86LoadSubModule(pScreenInfo, "ddc")) { xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, ("Loading of DDC library failed, skipping DDC-probe\n")); } else { xf86MonPtr mon; - xf86LoaderReqSymLists(vbeSymbols, NULL); + xf86LoaderReqSymLists(ddcSymbols, NULL); mon = renditionProbeDDC(pScreenInfo, pRendition->pEnt->index); xf86PrintEDID(mon); xf86SetDDCproperties(pScreenInfo, mon); @@ -787,12 +829,13 @@ * Validate the modes. Note that the limits passed to * xf86ValidateModes() are VGA CRTC architectural limits. */ - pScreenInfo->maxHValue = 2080; - pScreenInfo->maxVValue = 1025; + pScreenInfo->maxHValue = MAX_HTOTAL; + pScreenInfo->maxVValue = MAX_VTOTAL; nModes = xf86ValidateModes(pScreenInfo, pScreenInfo->monitor->Modes, pScreenInfo->display->modes, - &renditionClockRange, NULL, 8, 2040, Rounding, 1, 1024, - pScreenInfo->display->virtualX, pScreenInfo->display->virtualY, + &renditionClockRange, NULL, 8, MAX_HDISPLAY, Rounding, + 1, MAX_VDISPLAY, pScreenInfo->display->virtualX, + pScreenInfo->display->virtualY, 0x10000, LOOKUP_CLOSEST_CLOCK | LOOKUP_CLKDIV2); if (nModes < 0) @@ -911,7 +954,6 @@ renditionSetMode(ScrnInfoPtr pScreenInfo, DisplayModePtr pMode) { struct verite_modeinfo_t *modeinfo=&RENDITIONPTR(pScreenInfo)->mode; - vgaHWPtr pvgaHW; #ifdef DEBUG ErrorF("RENDITION: renditionSetMode() called\n"); @@ -919,8 +961,6 @@ sleep(1); #endif - pvgaHW = VGAHWPTR(pScreenInfo); - /* construct a modeinfo for the verite_setmode function */ modeinfo->clock=pMode->SynthClock; modeinfo->hdisplay=pMode->HDisplay; @@ -1041,17 +1081,17 @@ if (prenditionPriv->board.accel) RENDITIONAccelNone(pScreenInfo); + if (pScreenInfo->vtSema) + renditionLeaveGraphics(pScreenInfo); + + pScreenInfo->vtSema = FALSE; + if (prenditionPriv && (pScreen->CloseScreen = prenditionPriv->CloseScreen)) { prenditionPriv->CloseScreen = NULL; Closed = (*pScreen->CloseScreen)(scrnIndex, pScreen); } - if (pScreenInfo->vtSema) - renditionLeaveGraphics(pScreenInfo); - - pScreenInfo->vtSema = FALSE; - #ifdef DEBUG ErrorF("Closescreen OK...!!!!\n"); sleep(1); @@ -1106,6 +1146,8 @@ verite_save(pScreenInfo); + pScreenInfo->vtSema = TRUE; + if (!renditionSetMode(pScreenInfo, pScreenInfo->currentMode)) return FALSE; @@ -1227,7 +1269,6 @@ if (pScreenInfo->depth > 1) if (!xf86HandleColormaps(pScreen, 256, pScreenInfo->rgbBits, renditionLoadPalette, NULL, - CMAP_LOAD_EVEN_IF_OFFSCREEN| CMAP_RELOAD_ON_MODE_SWITCH)) { xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, "Colormap initialization failed\n"); @@ -1482,16 +1523,4 @@ return value; } -void -renditionProbeDDC(ScrnInfoPtr pScreenInfo, int index) -{ - vbeInfoPtr pVbe; - if (xf86LoadSubModule(pScreenInfo, "vbe")) { - xf86LoaderReqSymLists(vbeSymbols, NULL); - - pVbe = VBEInit(NULL,index); - ConfiguredMonitor = vbeDoEDID(pVbe, NULL); - vbeFree(pVbe); - } -} #endif Index: xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.man diff -u xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.man:1.2 xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.man:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.man:1.2 Sat Jan 27 13:20:51 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.man Wed Jun 18 12:17:39 2003 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.man,v 1.2 2001/01/27 18:20:51 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.man,v 1.3 2003/06/18 16:17:39 eich Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH RENDITION __drivermansuffix__ __vendorversion__ @@ -43,7 +43,7 @@ section, and will override the auto-detection: .PP .RS 4 -"v1000", "v2100", "v2200". +"v1000", "v2x00". .RE .PP The driver will auto-detect the amount of video memory present for all Index: xc/programs/Xserver/hw/xfree86/drivers/rendition/vboard.c diff -u xc/programs/Xserver/hw/xfree86/drivers/rendition/vboard.c:1.16 xc/programs/Xserver/hw/xfree86/drivers/rendition/vboard.c:1.19 --- xc/programs/Xserver/hw/xfree86/drivers/rendition/vboard.c:1.16 Wed Dec 11 12:23:33 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/rendition/vboard.c Thu Nov 6 13:38:04 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vboard.c,v 1.16 2002/12/11 17:23:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vboard.c,v 1.19 2003/11/06 18:38:04 tsi Exp $ */ /* * includes */ @@ -50,7 +50,7 @@ /* Note that CS ucode must wait on address in csucode_base * when initialized for later context switch code to work. */ - ErrorF("Loading csucode @ 0x%x + 0x800\n", pRendition->board.vmem_base); + ErrorF("Loading csucode @ %p + 0x800\n", pRendition->board.vmem_base); vmb=pRendition->board.vmem_base; offset=pRendition->board.csucode_base; for (c=0; cboard.csucode_base){ xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, ("VERITE_INITBOARD -- PC != CSUCODEBASE\n")); - ErrorF ("RENDITION: PC == 0x%x -- CSU == 0x%x\n", - pc,pRendition->board.csucode_base); + ErrorF ("RENDITION: PC == 0x%x -- CSU == 0x%lx\n", + pc,(unsigned long)pRendition->board.csucode_base); } /* reset memory endian */ @@ -105,7 +105,7 @@ pRendition->board.ucode_entry=c; #ifdef DEBUG - ErrorF("UCode_Entry == 0x%x\n",pRendition->board.ucode_entry); */ + ErrorF("UCode_Entry == 0x%x\n",pRendition->board.ucode_entry); #endif /* Everything's OK */ @@ -228,10 +228,10 @@ offset=pRendition->board.csucode_base; for (c=0; cp_paddr); if (lseek(fd, offset, SEEK_SET) != offset) { - ErrorF("RENDITION: Failure in loadSegmentToBoard, offset %lx\n", offset); + ErrorF("RENDITION: Failure in loadSegmentToBoard, offset %lx\n", + (unsigned long)offset); return; } data=(vu8 *)xalloc(size); if (NULL == data){ - ErrorF("RENDITION: GlobalAllocPtr couldn't allocate %x bytes", size); + ErrorF("RENDITION: GlobalAllocPtr couldn't allocate %lx bytes", + (unsigned long)size); return; } if (read(fd, data, size) != size){ - ErrorF("RENDITION: verite_readfile Failure, couldn't read %x bytes ", size); + ErrorF("RENDITION: verite_readfile Failure, couldn't read %lx bytes ", + (unsigned long)size); return; } Index: xc/programs/Xserver/hw/xfree86/drivers/rendition/vmodes.c diff -u xc/programs/Xserver/hw/xfree86/drivers/rendition/vmodes.c:1.13 xc/programs/Xserver/hw/xfree86/drivers/rendition/vmodes.c:1.14 --- xc/programs/Xserver/hw/xfree86/drivers/rendition/vmodes.c:1.13 Wed Dec 11 12:23:33 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/rendition/vmodes.c Mon Feb 23 20:13:10 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vmodes.c,v 1.13 2002/12/11 17:23:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vmodes.c,v 1.14 2004/02/24 01:13:10 dawes Exp $ */ /* * file vmodes.c * @@ -376,7 +376,16 @@ int iob=pRendition->board.io_base; verite_restoredac (pScreenInfo, reg); - verite_out32(iob+MODEREG,reg->mode); + /* + * If this is a Verite 1000, restore the MODEREG + * register now. The MODEREG gets restored later + * for the Verite 2x00 because restoring it here + * has been confirmed to cause intermittent + * system locks. + */ + if (pRendition->board.chip == V1000_DEVICE) { + verite_out32(iob+MODEREG,reg->mode); + } verite_out8(iob+MEMENDIAN,reg->memendian); verite_out32(iob+DRAMCTL,reg->dramctl); verite_out32(iob+SCLKPLL,reg->sclkpll); @@ -397,6 +406,18 @@ while ((verite_in32(iob+CRTCSTATUS)&CRTCSTATUS_VERT_MASK) == CRTCSTATUS_VERT_ACTIVE); } + + /* + * If this is a Verite 2x00, restore the MODEREG + * register now. The MODEREG register is restored + * earlier for the Verite 1000, but is restored + * here for the Verite 2x00 to prevent system + * locks. + */ + if (pRendition->board.chip != V1000_DEVICE) { + verite_out32(iob+MODEREG,reg->mode); + } + verite_out32(iob+CRTCHORZ,reg->crtch); verite_out32(iob+CRTCVERT,reg->crtcv); verite_out32(iob+FRAMEBASEA, reg->vbasea); Index: xc/programs/Xserver/hw/xfree86/drivers/rendition/vramdac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/rendition/vramdac.c:1.18 xc/programs/Xserver/hw/xfree86/drivers/rendition/vramdac.c:1.19 --- xc/programs/Xserver/hw/xfree86/drivers/rendition/vramdac.c:1.18 Wed Dec 11 12:23:33 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/rendition/vramdac.c Tue Sep 23 22:43:25 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vramdac.c,v 1.18 2002/12/11 17:23:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vramdac.c,v 1.19 2003/09/24 02:43:25 dawes Exp $ */ /* * includes */ @@ -170,8 +170,9 @@ switch (bpp) { case 1: case 4: - ErrorF("%s %s: color depth %d not (yet ?) supported\n", - X_CONFIG, /*vga256InfoRec.name*/"Rendition", bpp); + xf86DrvMsg(pScreenInfo->scrnIndex, X_CONFIG, + "color depth %d not (yet ?) supported\n", + bpp); return -1; case 8: @@ -232,8 +233,8 @@ break; default: - ErrorF( "%s %s: Color depth not supported (%d bpp)\n", - X_CONFIG, /*vga256InfoRec.name*/"Rendition", bpp); + xf86DrvMsg(pScreenInfo->scrnIndex, X_CONFIG, + "Color depth not supported (%d bpp)\n", bpp); return -1; break; } Index: xc/programs/Xserver/hw/xfree86/drivers/s3/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/s3/Imakefile:1.10 xc/programs/Xserver/hw/xfree86/drivers/s3/Imakefile:1.11 --- xc/programs/Xserver/hw/xfree86/drivers/s3/Imakefile:1.10 Mon Feb 17 12:06:43 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/s3/Imakefile Mon Apr 21 08:32:11 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/Imakefile,v 1.10 2003/02/17 17:06:43 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/Imakefile,v 1.11 2003/04/21 12:32:11 sven Exp $ */ #define IHaveModules #include @@ -46,6 +46,7 @@ SpecialCObjectRule(s3_video,$(_NOOP_), -DS3_NEWMMIO) InstallDriverSDKNonExecFile(Imakefile,$(DRIVERSDKDIR)/drivers/s3) +InstallDriverSDKNonExecFile(newmmio.h,$(DRIVERSDKDIR)/drivers/s3) InstallDriverSDKNonExecFile(s3.h,$(DRIVERSDKDIR)/drivers/s3) InstallDriverSDKNonExecFile(s3_reg.h,$(DRIVERSDKDIR)/drivers/s3) InstallDriverSDKNonExecFile(s3_driver.c,$(DRIVERSDKDIR)/drivers/s3) @@ -57,4 +58,3 @@ InstallDriverSDKNonExecFile(s3_Trio64DAC.c,$(DRIVERSDKDIR)/drivers/s3) InstallDriverSDKNonExecFile(s3_IBMRGB.c,$(DRIVERSDKDIR)/drivers/s3) InstallDriverSDKNonExecFile(s3_Ti.c,$(DRIVERSDKDIR)/drivers/s3) - Index: xc/programs/Xserver/hw/xfree86/drivers/s3/newmmio.h diff -u xc/programs/Xserver/hw/xfree86/drivers/s3/newmmio.h:1.6 xc/programs/Xserver/hw/xfree86/drivers/s3/newmmio.h:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/s3/newmmio.h:1.6 Mon Jul 2 06:46:04 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/s3/newmmio.h Fri Feb 13 18:58:42 2004 @@ -1,8 +1,51 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/newmmio.h,v 1.6 2001/07/02 10:46:04 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/newmmio.h,v 1.7 2004/02/13 23:58:42 dawes Exp $ */ /* * * Copyright 1995-1997 The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ Index: xc/programs/Xserver/hw/xfree86/drivers/s3/s3.h diff -u xc/programs/Xserver/hw/xfree86/drivers/s3/s3.h:1.16 xc/programs/Xserver/hw/xfree86/drivers/s3/s3.h:1.18 --- xc/programs/Xserver/hw/xfree86/drivers/s3/s3.h:1.16 Wed Dec 11 12:30:47 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/s3/s3.h Thu Jul 17 04:19:35 2003 @@ -24,7 +24,7 @@ * * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3.h,v 1.16 2002/12/11 17:30:47 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3.h,v 1.18 2003/07/17 08:19:35 eich Exp $ */ #ifndef _S3_H @@ -165,6 +165,7 @@ unsigned char *imageBuffer; int imageWidth; int imageHeight; + Bool hwCursor; } S3Rec, *S3Ptr; #define S3PTR(p) ((S3Ptr)((p)->driverPrivate)) @@ -240,6 +241,8 @@ #define S3_964_SERIES() ((pS3->Chipset == PCI_CHIP_964_0) || \ (pS3->Chipset == PCI_CHIP_964_1)) #define S3_TRIO_SERIES() ((pS3->Chipset == PCI_CHIP_TRIO) || \ - (pS3->Chipset == PCI_CHIP_AURORA64VP)) + (pS3->Chipset == PCI_CHIP_AURORA64VP) || \ + (pS3->Chipset == PCI_CHIP_TRIO64UVP) || \ + (pS3->Chipset == PCI_CHIP_TRIO64V2_DXGX)) #endif /* _S3_H */ Index: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_IBMRGB.c diff -u xc/programs/Xserver/hw/xfree86/drivers/s3/s3_IBMRGB.c:1.5 xc/programs/Xserver/hw/xfree86/drivers/s3/s3_IBMRGB.c:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/s3/s3_IBMRGB.c:1.5 Mon Feb 17 11:45:24 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/s3/s3_IBMRGB.c Thu Jul 17 04:19:36 2003 @@ -24,7 +24,7 @@ * * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_IBMRGB.c,v 1.5 2003/02/17 16:45:24 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_IBMRGB.c,v 1.6 2003/07/17 08:19:36 eich Exp $ */ #include "xf86.h" @@ -510,7 +510,9 @@ static Bool S3IBMRGBUseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) { - return TRUE; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + S3Ptr pS3 = S3PTR(pScrn); + return (pS3->hwCursor); } Index: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_Ti.c diff -u xc/programs/Xserver/hw/xfree86/drivers/s3/s3_Ti.c:1.5 xc/programs/Xserver/hw/xfree86/drivers/s3/s3_Ti.c:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/s3/s3_Ti.c:1.5 Mon Feb 17 11:45:24 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/s3/s3_Ti.c Thu Jul 17 04:19:36 2003 @@ -24,7 +24,7 @@ * * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_Ti.c,v 1.5 2003/02/17 16:45:24 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_Ti.c,v 1.6 2003/07/17 08:19:36 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -721,7 +721,9 @@ static Bool S3TiUseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) { - return TRUE; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + S3Ptr pS3 = S3PTR(pScrn); + return (pS3->hwCursor); } Index: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_Trio64DAC.c diff -u xc/programs/Xserver/hw/xfree86/drivers/s3/s3_Trio64DAC.c:1.5 xc/programs/Xserver/hw/xfree86/drivers/s3/s3_Trio64DAC.c:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/s3/s3_Trio64DAC.c:1.5 Mon Feb 17 11:45:24 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/s3/s3_Trio64DAC.c Mon Nov 3 00:11:28 2003 @@ -24,7 +24,7 @@ * * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_Trio64DAC.c,v 1.5 2003/02/17 16:45:24 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_Trio64DAC.c,v 1.8 2003/11/03 05:11:28 tsi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -180,7 +180,7 @@ ffreq = ffreq_min / (1< ffreq_max / (1<> 2) & 0x03) + 1; } pS3->mclk = mclk; @@ -324,10 +322,14 @@ if (pS3->Chipset == PCI_CHIP_AURORA64VP) S3TrioSetClock(pScrn, mode->Clock, 2, 1, 1, 63, 0, 3, 2, 135000, 270000); + else if (pS3->Chipset == PCI_CHIP_TRIO64V2_DXGX) + S3TrioSetClock(pScrn, mode->Clock, 2, 1, 1, 31, 0, 3, 2, + 170000, 270000); else S3TrioSetClock(pScrn, mode->Clock, 2, 1, 1, 31, 0, 3, 2, 135000, 270000); + outb(0x3c4, 1); blank = inb(0x3c5); outb(0x3c5, blank | 0x20); /* blank the screen */ @@ -348,6 +350,11 @@ outb(pS3->vgaCRIndex, 0x33); cr33 = inb(pS3->vgaCRReg) & ~0x28; + if (pS3->Chipset == PCI_CHIP_TRIO64V2_DXGX) + { + cr33 |= 0x20; + } + /* ! pixmux */ switch (pScrn->depth) { case 8: Index: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/s3/s3_accel.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/s3/s3_accel.c:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/s3/s3_accel.c:1.2 Sat Oct 27 23:33:44 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/s3/s3_accel.c Sun Nov 23 13:07:31 2003 @@ -24,7 +24,7 @@ * * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_accel.c,v 1.2 2001/10/28 03:33:44 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_accel.c,v 1.3 2003/11/23 18:07:31 twini Exp $ */ #include "xf86.h" @@ -310,7 +310,7 @@ int error, e1, e2; error = minor + err; - e1 = major; + e1 = minor; /* was: major, wrong (twini@xfree86.org) */ e2 = minor - major; if (major) { Index: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_cursor.c diff -u xc/programs/Xserver/hw/xfree86/drivers/s3/s3_cursor.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/s3/s3_cursor.c:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/s3/s3_cursor.c:1.1 Mon Jul 2 06:46:04 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/s3/s3_cursor.c Thu Jul 17 04:19:36 2003 @@ -24,7 +24,7 @@ * * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_cursor.c,v 1.1 2001/07/02 10:46:04 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_cursor.c,v 1.2 2003/07/17 08:19:36 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -195,7 +195,9 @@ static Bool S3UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) { - return TRUE; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + S3Ptr pS3 = S3PTR(pScrn); + return (pS3->hwCursor); } Index: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/s3/s3_driver.c:1.12 xc/programs/Xserver/hw/xfree86/drivers/s3/s3_driver.c:1.20 --- xc/programs/Xserver/hw/xfree86/drivers/s3/s3_driver.c:1.12 Fri Feb 14 13:06:58 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/s3/s3_driver.c Mon Nov 3 00:11:28 2003 @@ -34,7 +34,7 @@ * * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_driver.c,v 1.12 2003/02/14 18:06:58 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_driver.c,v 1.20 2003/11/03 05:11:28 tsi Exp $ */ #include "xf86.h" @@ -132,6 +132,8 @@ { PCI_CHIP_968, "968" }, { PCI_CHIP_TRIO, "Trio32/64" }, { PCI_CHIP_AURORA64VP, "Aurora64V+" }, + { PCI_CHIP_TRIO64UVP, "Trio64UV+" }, + { PCI_CHIP_TRIO64V2_DXGX, "Trio64V2/DX/GX" }, { -1, NULL } }; @@ -142,6 +144,8 @@ { PCI_CHIP_968, PCI_CHIP_968, RES_SHARED_VGA }, { PCI_CHIP_TRIO, PCI_CHIP_TRIO, RES_SHARED_VGA }, { PCI_CHIP_AURORA64VP, PCI_CHIP_AURORA64VP, RES_SHARED_VGA }, + { PCI_CHIP_TRIO64UVP, PCI_CHIP_TRIO64UVP, RES_SHARED_VGA }, + { PCI_CHIP_TRIO64V2_DXGX, PCI_CHIP_TRIO64V2_DXGX, RES_SHARED_VGA }, { -1, -1, RES_UNDEFINED } }; @@ -241,6 +245,7 @@ NULL }; +static int s3AccelLinePitches[] = { 640, 800, 1024, 1280, 1600 }; #ifdef XFree86LOADER @@ -395,7 +400,7 @@ pScrn->monitor = pScrn->confScreen->monitor; - if (!xf86SetDepthBpp(pScrn, 8, 8, 8, Support24bppFb | Support32bppFb)) + if (!xf86SetDepthBpp(pScrn, 0, 0, 0, Support24bppFb | Support32bppFb)) return FALSE; switch (pScrn->depth) { @@ -531,6 +536,8 @@ case PCI_CHIP_AURORA64VP: /* ??? */ pS3->S3NewMMIO = FALSE; break; + case PCI_CHIP_TRIO64V2_DXGX: + case PCI_CHIP_TRIO64UVP: case PCI_CHIP_968: pS3->S3NewMMIO = TRUE; break; @@ -540,10 +547,10 @@ if (pS3->S3NewMMIO) pS3->IOAddress = pS3->FBAddress + S3_NEWMMIO_REGBASE; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Framebuffer @ 0x%x\n", + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Framebuffer @ 0x%lx\n", pS3->FBAddress); if (pS3->S3NewMMIO) - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "MMIO @ 0x%x\n", + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "MMIO @ 0x%lx\n", pS3->IOAddress); pS3->PCIRetry = FALSE; /* not supported yet */ @@ -580,6 +587,15 @@ outb(0x102, 0x01); outb(0x46e8, 0x08); + if (pS3->Chipset == PCI_CHIP_TRIO64V2_DXGX) + { + outb (0x3d4, 0x86); + outb (0x3d5, 0x80); + + outb (0x3d4, 0x90); + outb (0x3d5, 0x00); + } + if (!pScrn->videoRam) { /* probe videoram */ outb(vgaCRIndex, 0x36); @@ -691,17 +707,19 @@ clockRanges = xnfcalloc(sizeof(ClockRange), 1); clockRanges->next = NULL; - clockRanges->minClock = 16000; /* guess */ + clockRanges->minClock = 15600; clockRanges->maxClock = pS3->MaxClock; clockRanges->clockIndex = -1; clockRanges->interlaceAllowed = FALSE; /* not yet */ - clockRanges->doubleScanAllowed = FALSE; /* not yet */ - + clockRanges->doubleScanAllowed = TRUE; /* not yet */ + i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, pScrn->display->modes, clockRanges, - NULL, 256, 2048, pScrn->bitsPerPixel, - 128, 2048, pScrn->display->virtualX, - pScrn->display->virtualY, pScrn->videoRam * 1024, + pS3->NoAccel ? NULL : s3AccelLinePitches, + 256, 2048, + pScrn->bitsPerPixel, 128, 2048, + pScrn->display->virtualX, + pScrn->display->virtualY, pScrn->videoRam * 1024, LOOKUP_BEST_REFRESH); if (i == -1) { @@ -725,7 +743,7 @@ #ifdef S3_USEFB xf86LoadSubModule(pScrn, "fb"); - xf86LoaderReqSymbols("fbScreenInit", NULL); + xf86LoaderReqSymLists(fbSymbols, NULL); #else { switch (pScrn->bitsPerPixel) { @@ -935,15 +953,10 @@ S3RegPtr save = &pS3->SavedRegs; vgaHWPtr hwp = VGAHWPTR(pScrn); vgaRegPtr pVga = &hwp->SavedReg; - RamDacHWRecPtr pRAMDAC; - RamDacRegRecPtr RAMDACreg; int vgaCRIndex = pS3->vgaCRIndex, vgaCRReg = pS3->vgaCRReg; int i; unsigned char cr5c = 0; - pRAMDAC = RAMDACHWPTR(pScrn); - RAMDACreg = &pRAMDAC->SavedReg; - S3BankZero(pScrn); save->clock = inb(0x3cc); @@ -1046,7 +1059,7 @@ Bool S3SwitchMode(int scrnIndex, DisplayModePtr mode, int flags) { - return S3ModeInit(xf86Screens[scrnIndex], xf86Screens[scrnIndex]->currentMode); + return S3ModeInit(xf86Screens[scrnIndex], mode); } @@ -1118,7 +1131,9 @@ if (pS3->Chipset == PCI_CHIP_968) shift = 1; /* XXX IBMRGB */ - else if (pS3->Chipset == PCI_CHIP_TRIO) + else if (pS3->Chipset == PCI_CHIP_TRIO || + pS3->Chipset == PCI_CHIP_TRIO64UVP || + pS3->Chipset == PCI_CHIP_TRIO64V2_DXGX) shift = -(pS3->s3Bpp >> 1); return shift; @@ -1138,6 +1153,7 @@ pS3->pixMuxShift = S3GetPixMuxShift(pScrn); pS3->s3BppDisplayWidth = pScrn->displayWidth * pS3->s3Bpp; + pS3->hwCursor = (mode->Flags & V_DBLSCAN) ? FALSE : TRUE; pS3->HDisplay = mode->HDisplay; pS3->s3ScissB = ((pScrn->videoRam * 1024) / pS3->s3BppDisplayWidth) - 1; @@ -1146,7 +1162,7 @@ if (mode->HTotal == mode->CrtcHTotal) { if (pS3->pixMuxShift > 0) { /* XXX hack */ - mode->Flags |= V_PIXMUX; +/* mode->Flags |= V_PIXMUX; */ mode->CrtcHTotal >>= pS3->pixMuxShift; mode->CrtcHDisplay >>= pS3->pixMuxShift; @@ -1154,7 +1170,7 @@ mode->CrtcHSyncEnd >>= pS3->pixMuxShift; mode->CrtcHSkew >>= pS3->pixMuxShift; } else if (pS3->pixMuxShift < 0) { - mode->Flags |= V_PIXMUX; +/* mode->Flags |= V_PIXMUX; */ mode->CrtcHTotal <<= -pS3->pixMuxShift; mode->CrtcHDisplay <<= -pS3->pixMuxShift; Index: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_video.c diff -u xc/programs/Xserver/hw/xfree86/drivers/s3/s3_video.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/s3/s3_video.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/s3/s3_video.c:1.2 Wed Aug 15 07:54:27 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/s3/s3_video.c Mon Nov 10 13:22:25 2003 @@ -24,7 +24,7 @@ * * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_video.c,v 1.2 2001/08/15 11:54:27 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3/s3_video.c,v 1.5 2003/11/10 18:22:25 tsi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -168,45 +168,6 @@ -static void S3CopyData(unsigned char *src, unsigned char *dst, - int srcPitch, int dstPitch, int h, int w) -{ - w <<= 1; - while (h--) { - memcpy(dst, src, w); - src += srcPitch; - dst += dstPitch; - } -} - - -static void S3CopyMungedData(unsigned char *src1, unsigned char *src2, - unsigned char *src3, unsigned char *dst1, - int srcPitch, int srcPitch2, int dstPitch, - int h, int w) -{ - CARD32 *dst = (CARD32*)dst1; - int i, j; - - dstPitch >>= 2; - w >>= 1; - - for(j = 0; j < h; j++) { - for(i = 0; i < w; i++) { - dst[i] = src1[i << 1] | (src1[(i << 1) + 1] << 16) | - (src3[i] << 8) | (src2[i] << 24); - } - dst += dstPitch; - src1 += srcPitch; - if(j & 1) { - src2 += srcPitch2; - src3 += srcPitch2; - } - } -} - - - static void S3ResetVideoOverlay(ScrnInfoPtr pScrn) { } @@ -281,7 +242,7 @@ adapt->QueryImageAttributes = S3QueryImageAttributes; /* gotta uninit this someplace */ - REGION_INIT(pScreen, &(pS3->portPrivate->clip), NullBox, 0); + REGION_NULL(pScreen, &(pS3->portPrivate->clip)); S3ResetVideoOverlay(pScrn); @@ -289,110 +250,6 @@ } - -static Bool -RegionsEqual(RegionPtr A, RegionPtr B) -{ - int *dataA, *dataB; - int num; - - num = REGION_NUM_RECTS(A); - if(num != REGION_NUM_RECTS(B)) - return FALSE; - - if((A->extents.x1 != B->extents.x1) || - (A->extents.x2 != B->extents.x2) || - (A->extents.y1 != B->extents.y1) || - (A->extents.y2 != B->extents.y2)) - return FALSE; - - dataA = (int*)REGION_RECTS(A); - dataB = (int*)REGION_RECTS(B); - - while(num--) { - if((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) - return FALSE; - dataA += 2; - dataB += 2; - } - - return TRUE; -} - - - -static Bool S3ClipVideo(BoxPtr dst, INT32 *x1, INT32 *x2, INT32 *y1, INT32 *y2, - RegionPtr reg, INT32 width, INT32 height) -{ - INT32 vscale, hscale, delta; - BoxPtr extents = REGION_EXTENTS(DummyScreen, reg); - int diff; - - hscale = ((*x2 - *x1) << 16) / (dst->x2 - dst->x1); - vscale = ((*y2 - *y1) << 16) / (dst->y2 - dst->y1); - - *x1 <<= 16; *x2 <<= 16; - *y1 <<= 16; *y2 <<= 16; - - diff = extents->x1 - dst->x1; - if(diff > 0) { - dst->x1 = extents->x1; - *x1 += diff * hscale; - } - diff = dst->x2 - extents->x2; - if(diff > 0) { - dst->x2 = extents->x2; - *x2 -= diff * hscale; - } - diff = extents->y1 - dst->y1; - if(diff > 0) { - dst->y1 = extents->y1; - *y1 += diff * vscale; - } - diff = dst->y2 - extents->y2; - if(diff > 0) { - dst->y2 = extents->y2; - *y2 -= diff * vscale; - } - - if(*x1 < 0) { - diff = (- *x1 + hscale - 1)/ hscale; - dst->x1 += diff; - *x1 += diff * hscale; - } - delta = *x2 - (width << 16); - if(delta > 0) { - diff = (delta + hscale - 1)/ hscale; - dst->x2 -= diff; - *x2 -= diff * hscale; - } - if(*x1 >= *x2) return FALSE; - - if(*y1 < 0) { - diff = (- *y1 + vscale - 1)/ vscale; - dst->y1 += diff; - *y1 += diff * vscale; - } - delta = *y2 - (height << 16); - if(delta > 0) { - diff = (delta + vscale - 1)/ vscale; - dst->y2 -= diff; - *y2 -= diff * vscale; - } - if(*y1 >= *y2) return FALSE; - - if((dst->x1 != extents->x1) || (dst->x2 != extents->x2) || - (dst->y1 != extents->y1) || (dst->y2 != extents->y2)) - { - RegionRec clipReg; - REGION_INIT(DummyScreen, &clipReg, dst, 1); - REGION_INTERSECT(DummyScreen, reg, reg, &clipReg); - REGION_UNINIT(DummyScreen, &clipReg); - } - return TRUE; -} - - static void S3StopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit) { S3Ptr pS3 = S3PTR(pScrn); @@ -510,8 +367,6 @@ int top, left, npixels, nlines; BoxRec dstBox; CARD32 tmp; - static int once = 1; - static int once2 = 1; /* Clip */ x1 = src_x; @@ -524,7 +379,8 @@ dstBox.y1 = drw_y; dstBox.y2 = drw_y + drw_h; - if(!S3ClipVideo(&dstBox, &x1, &x2, &y1, &y2, clipBoxes, width, height)) + if(!xf86XVClipVideoHelper(&dstBox, &x1, &x2, &y1, &y2, + clipBoxes, width, height)) return Success; /*if(!pMga->TexturedVideo) {*/ @@ -577,28 +433,24 @@ offset3 = tmp; } nlines = ((((y2 + 0xffff) >> 16) + 1) & ~1) - top; - S3CopyMungedData(buf + (top * srcPitch) + (left >> 1), - buf + offset2, buf + offset3, dst_start, - srcPitch, srcPitch2, dstPitch, nlines, npixels); - once2 = 0; + xf86XVCopyYUV12ToPacked(buf + (top * srcPitch) + (left >> 1), + buf + offset2, buf + offset3, dst_start, + srcPitch, srcPitch2, dstPitch, nlines, npixels); break; case FOURCC_UYVY: case FOURCC_YUY2: default: buf += (top * srcPitch) + left; nlines = ((y2 + 0xffff) >> 16) - top; - S3CopyData(buf, dst_start, srcPitch, dstPitch, nlines, npixels); - once = 0; + xf86XVCopyPacked(buf, dst_start, srcPitch, dstPitch, nlines, npixels); break; } /* update cliplist */ - if(!RegionsEqual(&pPriv->clip, clipBoxes)) { - REGION_COPY(pScreen, &pPriv->clip, clipBoxes); + if(!REGION_EQUAL(pScrn->pScreen, &pPriv->clip, clipBoxes)) { + REGION_COPY(pScrn->pScreen, &pPriv->clip, clipBoxes); /* draw these */ - (*pS3->pXAA->FillSolidRects)(pScrn, pPriv->colorKey, GXcopy, ~0, - REGION_NUM_RECTS(clipBoxes), - REGION_RECTS(clipBoxes)); + xf86XVFillKeyHelper(pScrn->pScreen, pPriv->colorKey, clipBoxes); } offset += left + (top * dstPitch); Index: xc/programs/Xserver/hw/xfree86/drivers/s3virge/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/s3virge/Imakefile:1.21 xc/programs/Xserver/hw/xfree86/drivers/s3virge/Imakefile:1.23 --- xc/programs/Xserver/hw/xfree86/drivers/s3virge/Imakefile:1.21 Mon Feb 17 12:06:43 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/s3virge/Imakefile Fri Feb 13 18:58:43 2004 @@ -1,7 +1,50 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/Imakefile,v 1.21 2003/02/17 17:06:43 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/Imakefile,v 1.23 2004/02/13 23:58:43 dawes Exp $ /* * * Copyright 1995-1998 The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ @@ -63,5 +106,6 @@ InstallDriverSDKNonExecFile(s3v_macros.h,$(DRIVERSDKDIR)/drivers/s3virge) InstallDriverSDKNonExecFile(s3v_rop.h,$(DRIVERSDKDIR)/drivers/s3virge) InstallDriverSDKNonExecFile(s3v_shadow.c,$(DRIVERSDKDIR)/drivers/s3virge) +InstallDriverSDKNonExecFile(s3v_xv.c,$(DRIVERSDKDIR)/drivers/s3virge) InstallDriverSDKObjectModule(s3virge,$(DRIVERSDKMODULEDIR),drivers) Index: xc/programs/Xserver/hw/xfree86/drivers/s3virge/newmmio.h diff -u xc/programs/Xserver/hw/xfree86/drivers/s3virge/newmmio.h:1.5 xc/programs/Xserver/hw/xfree86/drivers/s3virge/newmmio.h:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/s3virge/newmmio.h:1.5 Sun Mar 21 02:35:15 1999 +++ xc/programs/Xserver/hw/xfree86/drivers/s3virge/newmmio.h Fri Feb 13 18:58:43 2004 @@ -1,29 +1,51 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/newmmio.h,v 1.5 1999/03/21 07:35:15 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/newmmio.h,v 1.6 2004/02/13 23:58:43 dawes Exp $ */ /* -Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- -NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the XFree86 Project shall not -be used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the XFree86 Project. -*/ + * Copyright (C) 1994-1999 The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ /*************************************************************************** * Index: xc/programs/Xserver/hw/xfree86/drivers/s3virge/regs3v.h diff -u xc/programs/Xserver/hw/xfree86/drivers/s3virge/regs3v.h:1.9 xc/programs/Xserver/hw/xfree86/drivers/s3virge/regs3v.h:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/s3virge/regs3v.h:1.9 Fri Jan 25 16:56:08 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/s3virge/regs3v.h Fri Feb 13 18:58:43 2004 @@ -1,29 +1,51 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/regs3v.h,v 1.9 2002/01/25 21:56:08 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/regs3v.h,v 1.10 2004/02/13 23:58:43 dawes Exp $ */ /* -Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- -NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the XFree86 Project shall not -be used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the XFree86 Project. -*/ + * Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ /* * regs3v.h Index: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v.h diff -u xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v.h:1.31 xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v.h:1.32 --- xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v.h:1.31 Mon Feb 3 21:20:49 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v.h Fri Feb 13 18:58:43 2004 @@ -1,29 +1,51 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v.h,v 1.31 2003/02/04 02:20:49 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v.h,v 1.32 2004/02/13 23:58:43 dawes Exp $ */ /* -Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- -NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the XFree86 Project shall not -be used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the XFree86 Project. -*/ + * Copyright (C) 1994-1999 The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #ifndef _S3V_H #define _S3V_H Index: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_accel.c:1.23 xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_accel.c:1.26 --- xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_accel.c:1.23 Thu Dec 13 13:01:50 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_accel.c Fri Feb 13 18:58:43 2004 @@ -1,29 +1,51 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_accel.c,v 1.23 2001/12/13 18:01:50 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_accel.c,v 1.26 2004/02/13 23:58:43 dawes Exp $ */ /* -Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- -NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the XFree86 Project shall not -be used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the XFree86 Project. -*/ + * Copyright (C) 1994-1999 The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #include "s3v.h" @@ -245,7 +267,7 @@ if (xf86GetVerbosity() > 1) { ErrorF("\tTrio3D -- S3VNopAllCmdSets: SubsysStats#1 = 0x%08lx\n", - IN_SUBSYS_STAT()); + (unsigned long)IN_SUBSYS_STAT()); } mem_barrier(); @@ -267,7 +289,7 @@ if (xf86GetVerbosity() > 1) { ErrorF("\tTrio3D -- S3VNopAllCmdSets: SubsysStats#2 = 0x%08lx\n", - IN_SUBSYS_STAT()); + (unsigned long)IN_SUBSYS_STAT()); } } @@ -335,8 +357,8 @@ VGAOUT8(vgaCRReg, tmp & ~0x02); usleep(10000); - xf86ErrorFVerb(VERBLEV, " S3VGEReset sub_stat=%x \n", - IN_SUBSYS_STAT() + xf86ErrorFVerb(VERBLEV, " S3VGEReset sub_stat=%lx \n", + (unsigned long)IN_SUBSYS_STAT() ); if (!from_timeout) @@ -415,8 +437,8 @@ if((IN_SUBSYS_STAT() & 0x3f802000 & 0x20002000) != 0x20002000) { if(xf86GetVerbosity() > 1) - ErrorF("restarting S3 graphics engine reset %2d ..." - "%lx\n",r,IN_SUBSYS_STAT()); + ErrorF("restarting S3 graphics engine reset %2d ...%lx\n", + r, (unsigned long)IN_SUBSYS_STAT()); } else break; Index: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_dac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_dac.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_dac.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_dac.c:1.4 Mon Feb 3 21:20:50 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_dac.c Fri Feb 13 18:58:43 2004 @@ -1,29 +1,51 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_dac.c,v 1.4 2003/02/04 02:20:50 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_dac.c,v 1.5 2004/02/13 23:58:43 dawes Exp $ */ /* -Copyright (C) 1994-1998 The XFree86 Project, Inc. All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- -NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the XFree86 Project shall not -be used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the XFree86 Project. -*/ + * Copyright (C) 1994-1998 The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ /* * s3v_dac.c Index: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_dga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_dga.c:1.7 xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_dga.c:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_dga.c:1.7 Mon Jan 14 13:02:58 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_dga.c Fri Feb 13 18:58:43 2004 @@ -1,54 +1,51 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_dga.c,v 1.7 2002/01/14 18:02:58 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_dga.c,v 1.8 2004/02/13 23:58:43 dawes Exp $ */ /* -Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- -NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the XFree86 Project shall not -be used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the XFree86 Project. -*/ - -/* -Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- -NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the XFree86 Project shall not -be used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the XFree86 Project. -*/ + * Copyright (C) 1994-2000 The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ /* * file: s3v_dga.c Index: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c:1.86 xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c:1.94 --- xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c:1.86 Mon Feb 3 21:20:50 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c Fri Feb 13 18:58:43 2004 @@ -1,29 +1,52 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c,v 1.86 2003/02/04 02:20:50 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c,v 1.94 2004/02/13 23:58:43 dawes Exp $ */ /* -Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved. + * Copyright (C) 1994-1999 The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- -NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the XFree86 Project shall not -be used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the XFree86 Project. -*/ #include "xf86Resources.h" /* Needed by Resources Access Control (RAC) */ #include "xf86RAC.h" @@ -56,6 +79,10 @@ #define DPMS_SERVER #include "extensions/dpms.h" +#ifndef USE_INT10 +#define USE_INT10 0 +#endif + /* * Internals */ @@ -283,7 +310,6 @@ "XAACopyROP_PM", "XAADestroyInfoRec", "XAACreateInfoRec", - "XAAFillSolidRects", "XAAHelpPatternROP", "XAAHelpSolidROP", "XAAInit", @@ -331,12 +357,15 @@ NULL }; +#if USE_INT10 static const char *int10Symbols[] = { "xf86InitInt10", "xf86FreeInt10", NULL }; +#endif +#ifdef XFree86LOADER static const char *cfbSymbols[] = { "cfbScreenInit", "cfb16ScreenInit", @@ -350,8 +379,6 @@ NULL }; -#ifdef XFree86LOADER - static MODULESETUPPROTO(s3virgeSetup); static XF86ModuleVersionInfo S3VVersRec = @@ -396,7 +423,10 @@ */ LoaderRefSymLists(vgahwSymbols, cfbSymbols, xaaSymbols, ramdacSymbols, ddcSymbols, i2cSymbols, - int10Symbols, vbeSymbols, shadowSymbols, +#if USE_INT10 + int10Symbols, +#endif + vbeSymbols, shadowSymbols, fbSymbols, NULL); /* @@ -619,10 +649,9 @@ /* * The first thing we should figure out is the depth, bpp, etc. - * Our default depth is 8, so pass it to the helper function. * We support both 24bpp and 32bpp layouts, so indicate that. */ - if (!xf86SetDepthBpp(pScrn, 8, 8, 8, Support24bppFb | Support32bppFb | + if (!xf86SetDepthBpp(pScrn, 0, 0, 0, Support24bppFb | Support32bppFb | SupportConvert32to24 | PreferConvert32to24)) { return FALSE; } else { @@ -907,7 +936,7 @@ return FALSE; } -#if 0 +#if USE_INT10 if (xf86LoadSubModule(pScrn, "int10")) { xf86Int10InfoPtr pInt; xf86LoaderReqSymLists(int10Symbols, NULL); @@ -1011,7 +1040,7 @@ vgaCRReg = vgaIOBase + 5; xf86ErrorFVerb(VERBLEV, - " S3VPreInit vgaCRIndex=%x, vgaIOBase=%x, MMIOBase=%x\n", + " S3VPreInit vgaCRIndex=%x, vgaIOBase=%x, MMIOBase=%p\n", vgaCRIndex, vgaIOBase, hwp->MMIOBase ); @@ -1342,8 +1371,9 @@ , lcdclk / 1000.0); } + S3VDisableMmio(pScrn); S3VUnmapMem(pScrn); - + /* And finally set various possible option flags */ ps3v->bankedMono = FALSE; @@ -1609,6 +1639,8 @@ #ifdef unmap_always S3VMapMem(pScrn); #endif + S3VEnableMmio(pScrn); + S3VSave(pScrn); return S3VModeInit(pScrn, pScrn->currentMode); } @@ -1638,6 +1670,7 @@ S3VWriteMode(pScrn, vgaSavePtr, S3VSavePtr); /* Restore standard register access */ /* and unmap memory. */ + S3VDisableMmio(pScrn); #ifdef unmap_always S3VUnmapMem(pScrn); #endif @@ -1781,8 +1814,8 @@ VGAOUT8(vgaCRIndex, 0x93); save->CR93 = VGAIN8(vgaCRReg); } - if (ps3v->Chipset == S3_ViRGE_DXGX || S3_ViRGE_GX2_SERIES(ps3v->Chipset) || - S3_ViRGE_MX_SERIES(ps3v->Chipset)) { + if (ps3v->Chipset == S3_ViRGE_DXGX || S3_ViRGE_GX2_SERIES(ps3v->Chipset) || + S3_ViRGE_MX_SERIES(ps3v->Chipset) || S3_TRIO_3D_SERIES(ps3v->Chipset)) { VGAOUT8(vgaCRIndex, 0x90); save->CR90 = VGAIN8(vgaCRReg); VGAOUT8(vgaCRIndex, 0x91); @@ -1897,11 +1930,11 @@ { xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, VERBLEV, - "MMPR regs: %08x %08x %08x %08x\n", - INREG(FIFO_CONTROL_REG), - INREG(MIU_CONTROL_REG), - INREG(STREAMS_TIMEOUT_REG), - INREG(MISC_TIMEOUT_REG)); + "MMPR regs: %08lx %08lx %08lx %08lx\n", + (unsigned long)INREG(FIFO_CONTROL_REG), + (unsigned long)INREG(MIU_CONTROL_REG), + (unsigned long)INREG(STREAMS_TIMEOUT_REG), + (unsigned long)INREG(MISC_TIMEOUT_REG)); } PVERB5("\n\nViRGE driver: saved current video mode. Register dump:\n\n"); @@ -2109,7 +2142,7 @@ VGAOUT8(vgaCRReg, restore->CR93); } if (ps3v->Chipset == S3_ViRGE_DXGX || S3_ViRGE_GX2_SERIES(ps3v->Chipset) || - S3_ViRGE_MX_SERIES(ps3v->Chipset)) { + S3_ViRGE_MX_SERIES(ps3v->Chipset) || S3_TRIO_3D_SERIES(ps3v->Chipset)) { VGAOUT8(vgaCRIndex, 0x90); VGAOUT8(vgaCRReg, restore->CR90); VGAOUT8(vgaCRIndex, 0x91); @@ -2268,7 +2301,6 @@ else VGAOUT8(vgaCRReg, cr3a); - if (xf86GetVerbosity() > 1) { xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, VERBLEV, "ViRGE driver: done restoring mode, dumping CR registers:\n"); @@ -2469,8 +2501,6 @@ ps3v->PrimaryVidMapped = FALSE; } - S3VDisableMmio(pScrn); - xf86UnMapVidMem(pScrn->scrnIndex, (pointer)ps3v->MapBase, S3_NEWMMIO_REGSIZE); if (ps3v->FBBase) @@ -2661,19 +2691,7 @@ if(xf86DPMSInit(pScreen, S3VDisplayPowerManagementSet, 0) == FALSE) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "DPMS initialization failed!\n"); -#ifndef XvExtension - { - XF86VideoAdaptorPtr *ptr; - int n; - - n = xf86XVListGenericAdaptors(pScrn,&ptr); - if (n) { - xf86XVScreenInit(pScreen, ptr, n); - } - } -#else - S3VInitVideo(pScreen); -#endif + S3VInitVideo(pScreen); /* Report any unused options (only for the first generation) */ if (serverGeneration == 1) { @@ -3531,6 +3549,7 @@ if (pScrn->vtSema) { S3VWriteMode(pScrn, vgaSavePtr, S3VSavePtr); vgaHWLock(hwp); + S3VDisableMmio(pScrn); S3VUnmapMem(pScrn); } Index: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_hwcurs.c diff -u xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_hwcurs.c:1.7 xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_hwcurs.c:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_hwcurs.c:1.7 Mon Feb 3 21:20:50 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_hwcurs.c Fri Feb 13 18:58:43 2004 @@ -1,29 +1,51 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_hwcurs.c,v 1.7 2003/02/04 02:20:50 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_hwcurs.c,v 1.8 2004/02/13 23:58:43 dawes Exp $ */ /* -Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- -NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the XFree86 Project shall not -be used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the XFree86 Project. -*/ + * Copyright (C) 1994-1999 The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ /* Index: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_i2c.c diff -u xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_i2c.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_i2c.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_i2c.c:1.4 Fri Mar 31 15:13:32 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_i2c.c Fri Feb 13 18:58:43 2004 @@ -1,54 +1,51 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_i2c.c,v 1.4 2000/03/31 20:13:32 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_i2c.c,v 1.5 2004/02/13 23:58:43 dawes Exp $ */ /* -Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- -NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the XFree86 Project shall not -be used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the XFree86 Project. -*/ - -/* -Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- -NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the XFree86 Project shall not -be used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the XFree86 Project. -*/ + * Copyright (C) 1994-2000 The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #include "xf86.h" #include "xf86_OSproc.h" Index: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_macros.h diff -u xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_macros.h:1.11 xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_macros.h:1.12 --- xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_macros.h:1.11 Tue Nov 28 15:59:18 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_macros.h Fri Feb 13 18:58:43 2004 @@ -1,29 +1,51 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_macros.h,v 1.11 2000/11/28 20:59:18 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_macros.h,v 1.12 2004/02/13 23:58:43 dawes Exp $ */ /* -Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- -NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the XFree86 Project shall not -be used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the XFree86 Project. -*/ + * Copyright (C) 1994-1999 The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #ifndef _S3V_MACROS_H #define _S3V_MACROS_H Index: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c diff -u xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c:1.7 xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c:1.11 --- xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c:1.7 Mon Feb 3 21:20:50 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c Mon Nov 10 13:22:25 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c,v 1.7 2003/02/04 02:20:50 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c,v 1.11 2003/11/10 18:22:25 tsi Exp $ */ /* Copyright (C) 2000 The XFree86 Project, Inc. All Rights Reserved. @@ -52,12 +52,6 @@ #define S3V_MAX_PORTS 1 - -#ifndef XvExtension -void S3VInitVideo(ScreenPtr pScreen) {} -int S3VQueryXvCapable(ScrnInfoPtr) {return FALSE;} -#else - #if 0 static void S3VInitOffscreenImages(ScreenPtr); #endif @@ -337,58 +331,6 @@ -static void -S3VCopyData( - unsigned char *src, - unsigned char *dst, - int srcPitch, - int dstPitch, - int h, - int w -){ - w <<= 1; - while(h--) { - memcpy(dst, src, w); - src += srcPitch; - dst += dstPitch; - } -} - - -static void -S3VCopyMungedData( - unsigned char *src1, - unsigned char *src2, - unsigned char *src3, - unsigned char *dst1, - int srcPitch, - int srcPitch2, - int dstPitch, - int h, - int w -){ - CARD32 *dst = (CARD32*)dst1; - int i, j; - - dstPitch >>= 2; - w >>= 1; - - for(j = 0; j < h; j++) { - for(i = 0; i < w; i++) { - dst[i] = src1[i << 1] | (src1[(i << 1) + 1] << 16) | - (src3[i] << 8) | (src2[i] << 24); - } - dst += dstPitch; - src1 += srcPitch; - if(j & 1) { - src2 += srcPitch2; - src3 += srcPitch2; - } - } -} - - - static void S3VResetVideoOverlay(ScrnInfoPtr pScrn) { @@ -516,7 +458,7 @@ adapt->QueryImageAttributes = S3VQueryImageAttributes; /* gotta uninit this someplace */ - REGION_INIT(pScreen, &(ps3v->portPrivate->clip), NullBox, 0); + REGION_NULL(pScreen, &(ps3v->portPrivate->clip)); S3VResetVideoOverlay(pScrn); @@ -524,141 +466,12 @@ } -static Bool -RegionsEqual(RegionPtr A, RegionPtr B) -{ - int *dataA, *dataB; - int num; - - num = REGION_NUM_RECTS(A); - if(num != REGION_NUM_RECTS(B)) - return FALSE; - - if((A->extents.x1 != B->extents.x1) || - (A->extents.x2 != B->extents.x2) || - (A->extents.y1 != B->extents.y1) || - (A->extents.y2 != B->extents.y2)) - return FALSE; - - dataA = (int*)REGION_RECTS(A); - dataB = (int*)REGION_RECTS(B); - - while(num--) { - if((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) - return FALSE; - dataA += 2; - dataB += 2; - } - - return TRUE; -} - - -/* S3VClipVideo - copied from MGAClipVideo - - - Takes the dst box in standard X BoxRec form (top and left - edges inclusive, bottom and right exclusive). The new dst - box is returned. The source boundaries are given (x1, y1 - inclusive, x2, y2 exclusive) and returned are the new source - boundaries in 16.16 fixed point. -*/ - -#define DummyScreen screenInfo.screens[0] - -static Bool -S3VClipVideo( - BoxPtr dst, - INT32 *x1, - INT32 *x2, - INT32 *y1, - INT32 *y2, - RegionPtr reg, - INT32 width, - INT32 height -){ - INT32 vscale, hscale, delta; - BoxPtr extents = REGION_EXTENTS(DummyScreen, reg); - int diff; - - hscale = ((*x2 - *x1) << 16) / (dst->x2 - dst->x1); - vscale = ((*y2 - *y1) << 16) / (dst->y2 - dst->y1); - - *x1 <<= 16; *x2 <<= 16; - *y1 <<= 16; *y2 <<= 16; - - diff = extents->x1 - dst->x1; - if(diff > 0) { - dst->x1 = extents->x1; - *x1 += diff * hscale; - } - diff = dst->x2 - extents->x2; - if(diff > 0) { - dst->x2 = extents->x2; - *x2 -= diff * hscale; - } - diff = extents->y1 - dst->y1; - if(diff > 0) { - dst->y1 = extents->y1; - *y1 += diff * vscale; - } - diff = dst->y2 - extents->y2; - if(diff > 0) { - dst->y2 = extents->y2; - *y2 -= diff * vscale; - } - - if(*x1 < 0) { - diff = (- *x1 + hscale - 1)/ hscale; - dst->x1 += diff; - *x1 += diff * hscale; - } - delta = *x2 - (width << 16); - if(delta > 0) { - diff = (delta + hscale - 1)/ hscale; - dst->x2 -= diff; - *x2 -= diff * hscale; - } - if(*x1 >= *x2) return FALSE; - - if(*y1 < 0) { - diff = (- *y1 + vscale - 1)/ vscale; - dst->y1 += diff; - *y1 += diff * vscale; - } - delta = *y2 - (height << 16); - if(delta > 0) { - diff = (delta + vscale - 1)/ vscale; - dst->y2 -= diff; - *y2 -= diff * vscale; - } - if(*y1 >= *y2) return FALSE; - - if((dst->x1 != extents->x1) || (dst->x2 != extents->x2) || - (dst->y1 != extents->y1) || (dst->y2 != extents->y2)) - { - RegionRec clipReg; - REGION_INIT(DummyScreen, &clipReg, dst, 1); - REGION_INTERSECT(DummyScreen, reg, reg, &clipReg); - REGION_UNINIT(DummyScreen, &clipReg); - } - return TRUE; -} - - - static void S3VStopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown) { S3VPtr ps3v = S3VPTR(pScrn); S3VPortPrivPtr pPriv = ps3v->portPrivate; - vgaHWPtr hwp = VGAHWPTR(pScrn); - /* S3VPtr ps3v = S3VPTR(pScrn);*/ - int vgaCRIndex, vgaCRReg, vgaIOBase; - vgaIOBase = hwp->IOBase; - vgaCRIndex = vgaIOBase + 4; - vgaCRReg = vgaIOBase + 5; - #if 0 MGAPtr pMga = MGAPTR(pScrn); MGAPortPrivPtr pPriv = pMga->portPrivate; @@ -696,8 +509,8 @@ pPriv->area = NULL; } pPriv->videoStatus = 0; - } else { #if 0 + } else { if(pPriv->videoStatus & CLIENT_VIDEO_ON) { pPriv->videoStatus |= OFF_TIMER; pPriv->offTime = currentTime.milliseconds + OFF_DELAY; @@ -983,8 +796,6 @@ int top, left, npixels, nlines; BoxRec dstBox; CARD32 tmp; - static int once = 1; - static int once2 = 1; /* If streams aren't enabled, do nothing */ if(!ps3v->NeedSTREAMS) @@ -1001,7 +812,8 @@ dstBox.y1 = drw_y; dstBox.y2 = drw_y + drw_h; - if(!S3VClipVideo(&dstBox, &x1, &x2, &y1, &y2, clipBoxes, width, height)) + if(!xf86XVClipVideoHelper(&dstBox, &x1, &x2, &y1, &y2, + clipBoxes, width, height)) return Success; /*if(!pMga->TexturedVideo) {*/ @@ -1066,18 +878,16 @@ offset3 = tmp; } nlines = ((((y2 + 0xffff) >> 16) + 1) & ~1) - top; - S3VCopyMungedData(buf + (top * srcPitch) + (left >> 1), - buf + offset2, buf + offset3, dst_start, - srcPitch, srcPitch2, dstPitch, nlines, npixels); - once2 = 0; + xf86XVCopyYUV12ToPacked(buf + (top * srcPitch) + (left >> 1), + buf + offset2, buf + offset3, dst_start, + srcPitch, srcPitch2, dstPitch, nlines, npixels); break; case FOURCC_UYVY: case FOURCC_YUY2: default: buf += (top * srcPitch) + left; nlines = ((y2 + 0xffff) >> 16) - top; - S3VCopyData(buf, dst_start, srcPitch, dstPitch, nlines, npixels); - once = 0; + xf86XVCopyPacked(buf, dst_start, srcPitch, dstPitch, nlines, npixels); break; } @@ -1093,12 +903,10 @@ } else { #endif /* update cliplist */ - if(!RegionsEqual(&pPriv->clip, clipBoxes)) { - REGION_COPY(pScreen, &pPriv->clip, clipBoxes); + if(!REGION_EQUAL(pScrn->pScreen, &pPriv->clip, clipBoxes)) { + REGION_COPY(pScrn->pScreen, &pPriv->clip, clipBoxes); /* draw these */ - XAAFillSolidRects(pScrn, pPriv->colorKey, GXcopy, ~0, - REGION_NUM_RECTS(clipBoxes), - REGION_RECTS(clipBoxes)); + xf86XVFillKeyHelper(pScrn->pScreen, pPriv->colorKey, clipBoxes); } offset += left + (top * dstPitch); @@ -1168,8 +976,3 @@ return size; } - - - -#endif /* !XvExtension */ - Index: xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile:1.8 xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile:1.8 Mon Feb 17 12:06:44 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile Fri Feb 13 18:58:44 2004 @@ -1,7 +1,50 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile,v 1.8 2003/02/17 17:06:44 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile,v 1.9 2004/02/13 23:58:44 dawes Exp $ /* * * Copyright 1995-1998 The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage.man diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/savage.man:1.6 xc/programs/Xserver/hw/xfree86/drivers/savage/savage.man:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/savage/savage.man:1.6 Tue May 14 16:19:51 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage.man Wed Jan 7 12:20:09 2004 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage.man,v 1.6 2002/05/14 20:19:51 alanh Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage.man,v 1.8 2004/01/07 17:20:09 tsi Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH SAVAGE __drivermansuffix__ __vendorversion__ @@ -81,8 +81,7 @@ Default: no rotation. .TP .BI "Option \*qShadowFB\*q \*q" boolean \*q -Enable or disable use of the shadow framebuffer layer. See -shadowfb(__drivermansuffix__) for further information. This option +Enable or disable use of the shadow framebuffer layer. This option disables acceleration. Default: off. .TP .BI "Option \*qLCDClock\*q \*q" frequency \*q @@ -108,7 +107,7 @@ driver use your mode line timing exactly, turn off the UseBios option. Default: on (use the BIOS). .TP -.BI "Option \*qShadowStatus\*q \q*" boolean \*q +.BI "Option \*qShadowStatus\*q \*q" boolean \*q Enables the use of a shadow status register. There is a chip bug in the Savage graphics engine that can cause a bus lock when reading the engine status register under heavy load, such as when scrolling text or dragging Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c:1.18 xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c:1.24 --- xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c:1.18 Fri Nov 8 13:03:32 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c Sun Jan 25 12:39:29 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c,v 1.18 2002/11/08 18:03:32 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c,v 1.24 2004/01/25 17:39:29 dawes Exp $ */ /* * @@ -66,6 +66,7 @@ int length, int octant); +#if 0 static void SavageSubsequentSolidTwoPointLine( ScrnInfoPtr pScrn, int x1, @@ -73,6 +74,7 @@ int x2, int y2, int bias); +#endif #if 0 static void SavageSetupForScreenToScreenColorExpand( @@ -128,6 +130,7 @@ int w, int h); +#if 0 static void SavageSetupForColor8x8PatternFill( ScrnInfoPtr pScrn, int patternx, @@ -144,6 +147,7 @@ int y, int w, int h); +#endif static void SavageSetClippingRectangle( ScrnInfoPtr pScrn, @@ -457,9 +461,13 @@ * We could double the width ourselves into a reserved frame buffer * section, but since I went 18 months with only ONE report of this * error, it seems hardly worth the trouble. + * Savage4 seems to have problems with 8x8 color patterns. + * Not sending the pattern offsetsfixes the lockup but the + * drawing problems remain. + * Until further investigation we have to disable this. */ -#if 1 +#if 0 if( (psav->Chipset == S3_SAVAGE3D) || (psav->Chipset == S3_SAVAGE4) ) { xaaptr->SetupForColor8x8PatternFill = @@ -468,8 +476,8 @@ SavageSubsequentColor8x8PatternFillRect; xaaptr->Color8x8PatternFillFlags = 0 | NO_TRANSPARENCY - | HARDWARE_PATTERN_PROGRAMMED_BITS - | HARDWARE_PATTERN_PROGRAMMED_ORIGIN + | HARDWARE_PATTERN_SCREEN_ORIGIN + | ROP_NEEDS_SOURCE ; } #endif @@ -477,10 +485,9 @@ /* Solid lines */ #if 1 - xaaptr->SolidLineFlags = NO_PLANEMASK; + xaaptr->SolidLineFlags = NO_PLANEMASK | ROP_NEEDS_SOURCE; xaaptr->SetupForSolidLine = SavageSetupForSolidFill; xaaptr->SubsequentSolidBresenhamLine = SavageSubsequentSolidBresenhamLine; - xaaptr->SubsequentSolidTwoPointLine = SavageSubsequentSolidTwoPointLine; #if 0 xaaptr->SubsequentSolidFillTrap = SavageSubsequentSolidFillTrap; #endif @@ -496,6 +503,7 @@ | SCANLINE_PAD_DWORD | BIT_ORDER_IN_BYTE_MSBFIRST | LEFT_EDGE_CLIPPING + | ROP_NEEDS_SOURCE ; xaaptr->SetupForImageWrite = SavageSetupForImageWrite; xaaptr->SubsequentImageWriteRect = SavageSubsequentImageWriteRect; @@ -506,7 +514,7 @@ /* WriteBitmap color expand */ #if 0 - xaaptr->WriteBitmapFlags = NO_PLANEMASK; + xaaptr->WriteBitmapFlags = NO_PLANEMASK | ROP_NEEDS_SOURCE; xaaptr->WriteBitmap = SavageWriteBitmapCPUToScreenColorExpand; #endif @@ -984,6 +992,7 @@ } +#if 0 static void SavageSetupForColor8x8PatternFill( ScrnInfoPtr pScrn, @@ -996,7 +1005,6 @@ SavagePtr psav = SAVPTR(pScrn); int cmd; - int mix; unsigned int bd; int pat_offset; @@ -1008,7 +1016,7 @@ cmd = BCI_CMD_RECT | BCI_CMD_RECT_XP | BCI_CMD_RECT_YP | BCI_CMD_DEST_GBD | BCI_CMD_PAT_PBD_COLOR_NEW; - mix = XAAHelpSolidROP( pScrn, &trans_col, planemask, &rop ); + (void) XAAHelpSolidROP( pScrn, &trans_col, planemask, &rop ); BCI_CMD_SET_ROP(cmd, rop); bd = BCI_BD_BW_DISABLE; @@ -1038,14 +1046,14 @@ if( !w || !h ) return; - psav->WaitQueue(psav,6); + psav->WaitQueue(psav,5); BCI_SEND(psav->SavedBciCmd); BCI_SEND(psav->SavedSbdOffset); BCI_SEND(psav->SavedSbd); - BCI_SEND(BCI_X_Y(patternx,patterny)); BCI_SEND(BCI_X_Y(x, y)); BCI_SEND(BCI_W_H(w, h)); } +#endif static void @@ -1085,6 +1093,7 @@ } +#if 0 static void SavageSubsequentSolidTwoPointLine( ScrnInfoPtr pScrn, @@ -1144,6 +1153,7 @@ BCI_SEND( BCI_LINE_STEPS( 2 * (min - max), 2 * min ) ); BCI_SEND( BCI_LINE_MISC( max, ym, xp, yp, 2 * min - max ) ); } +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_dga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/savage_dga.c:1.6 xc/programs/Xserver/hw/xfree86/drivers/savage/savage_dga.c:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/savage/savage_dga.c:1.6 Sat Jan 18 10:22:29 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_dga.c Fri Feb 13 18:58:44 2004 @@ -1,29 +1,51 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_dga.c,v 1.6 2003/01/18 15:22:29 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_dga.c,v 1.7 2004/02/13 23:58:44 dawes Exp $ */ /* -Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- -NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the XFree86 Project shall not -be used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the XFree86 Project. -*/ + * Copyright (C) 1994-2000 The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ /* Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c:1.34 xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c:1.49 --- xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c:1.34 Mon Feb 24 23:08:21 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c Thu Nov 6 13:38:06 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c,v 1.34 2003/02/25 04:08:21 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c,v 1.49 2003/11/06 18:38:06 tsi Exp $ */ /* * vim: sw=4 ts=8 ai ic: * @@ -19,16 +19,12 @@ #define DPMS_SERVER #include "extensions/dpms.h" -#ifdef XvExtension #include "xf86xv.h" -#endif #include "savage_driver.h" #include "savage_bci.h" - - /* * prototypes */ @@ -82,10 +78,10 @@ #define iabs(a) ((int)(a)>0?(a):(-(a))) #define DRIVER_NAME "savage" -#define DRIVER_VERSION "1.1.26" +#define DRIVER_VERSION "1.1.27" #define VERSION_MAJOR 1 #define VERSION_MINOR 1 -#define PATCHLEVEL 26 +#define PATCHLEVEL 27 #define SAVAGE_VERSION ((VERSION_MAJOR << 24) | \ (VERSION_MINOR << 16) | \ PATCHLEVEL) @@ -260,6 +256,7 @@ NULL }; +#ifdef XFree86LOADER static const char *vbeOptSymbols[] = { "vbeModeInit", "VBESetVBEMode", @@ -267,6 +264,7 @@ "VBEFreeVBEInfo", NULL }; +#endif static const char *ddcSymbols[] = { "xf86DoEDID_DDC1", @@ -287,11 +285,9 @@ "XAACopyROP_PM", "XAACreateInfoRec", "XAADestroyInfoRec", - "XAAFillSolidRects", "XAAHelpPatternROP", "XAAHelpSolidROP", "XAAInit", - "XAAScreenIndex", NULL }; @@ -377,7 +373,8 @@ ! (ALT_STATUS_WORD0 & 0x00200000) ) { - ErrorF( "Resetting BCI, stat = %08x...\n", ALT_STATUS_WORD0); + ErrorF( "Resetting BCI, stat = %08lx...\n", + (unsigned long) ALT_STATUS_WORD0); /* Turn off BCI */ OUTREG( 0x48c18, cob & ~8 ); usleep(10000); @@ -627,9 +624,12 @@ /* sanity checks */ if ((numDevSections = xf86MatchDevice("savage", &devSections)) <= 0) - return FALSE; - if (xf86GetPciVideoInfo() == NULL) - return FALSE; + return FALSE; + if (xf86GetPciVideoInfo() == NULL) { + if (devSections) + xfree(devSections); + return FALSE; + } numUsed = xf86MatchPciInstances("SAVAGE", PCI_VENDOR_S3, SavageChipsets, SavagePciChipsets, @@ -647,7 +647,7 @@ for (i=0; idriverVersion = (int)DRIVER_VERSION; + pScrn->driverVersion = SAVAGE_VERSION; pScrn->driverName = DRIVER_NAME; pScrn->name = "SAVAGE"; pScrn->Probe = SavageProbe; @@ -725,7 +725,7 @@ * We support bpp of 8, 16, and 32. */ - if (!xf86SetDepthBpp(pScrn, 8, 8, 8, Support32bppFb)) + if (!xf86SetDepthBpp(pScrn, 0, 0, 0, Support32bppFb)) return FALSE; else { int requiredBpp; @@ -1000,6 +1000,7 @@ if (!SavageMapMMIO(pScrn)) { + SavageFreeRec(pScrn); vbeFree(psav->pVbe); return FALSE; } @@ -1031,6 +1032,7 @@ if (!xf86SetGamma(pScrn, zeros)) { vbeFree(psav->pVbe); + SavageFreeRec(pScrn); return FALSE; } } @@ -1250,10 +1252,9 @@ psav->dacSpeedBpp = pScrn->clock[3]; else if (pScrn->bitsPerPixel >= 24) psav->dacSpeedBpp = pScrn->clock[2]; - else if ((pScrn->bitsPerPixel > 8) && (pScrn->bitsPerPixel < 24)) + else if (pScrn->bitsPerPixel > 8) psav->dacSpeedBpp = pScrn->clock[1]; - else if (pScrn->bitsPerPixel <= 8) - psav->dacSpeedBpp = pScrn->clock[0]; + else psav->dacSpeedBpp = pScrn->clock[0]; } /* Set ramdac limits */ @@ -1683,7 +1684,7 @@ static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, SavageRegPtr restore, Bool Entering) { - unsigned char tmp, cr3a, cr66, cr67; + unsigned char tmp, cr3a, cr66; vgaHWPtr hwp = VGAHWPTR(pScrn); SavagePtr psav = SAVPTR(pScrn); int vgaCRIndex, vgaCRReg, vgaIOBase; @@ -1848,6 +1849,20 @@ break; } + /* set the correct clock for some BIOSes */ + VGAOUT8(VGA_MISC_OUT_W, + VGAIN8(VGA_MISC_OUT_R) | 0x0C); + /* Some BIOSes turn on clock doubling on non-doubled modes */ + if (pScrn->bitsPerPixel < 24) { + VGAOUT8(vgaCRIndex, 0x67); + if (!(VGAIN8(vgaCRReg) & 0x10)) { + VGAOUT8(0x3c4, 0x15); + VGAOUT8(0x3c5, VGAIN8(0x3C5) & ~0x10); + VGAOUT8(0x3c4, 0x18); + VGAOUT8(0x3c5, VGAIN8(0x3c5) & ~0x80); + } + } + SavageInitialize2DEngine(pScrn); SavageSetGBD(pScrn); @@ -1885,7 +1900,7 @@ } VGAOUT8(vgaCRIndex, 0x67); - cr67 = VGAIN8(vgaCRReg); + (void) VGAIN8(vgaCRReg); VGAOUT8(vgaCRReg, restore->CR67 & ~0x0c); /* no STREAMS yet */ /* restore extended regs */ @@ -2090,8 +2105,18 @@ VGAOUT8(vgaCRIndex, 0x3a); VGAOUT8(vgaCRReg, cr3a); - if( Entering ) + if( Entering ) { + /* We reinit the engine here just as in the UseBIOS case + * as otherwise we lose performance because the engine + * isn't setup properly (Alan Hourihane - alanh@fairlite.demon.co.uk). + */ + SavageInitialize2DEngine(pScrn); + SavageSetGBD(pScrn); + + VGAOUT16(vgaCRIndex, 0x0140); + SavageSetGBD(pScrn); + } vgaHWProtect(pScrn, FALSE); @@ -2117,7 +2142,7 @@ } xf86DrvMsg( pScrn->scrnIndex, X_PROBED, - "mapping MMIO @ 0x%x with size 0x%x\n", + "mapping MMIO @ 0x%lx with size 0x%x\n", psav->MmioBase, SAVAGE_NEWMMIO_REGSIZE); psav->MapBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, psav->PciTag, @@ -2151,7 +2176,7 @@ TRACE(("SavageMapFB()\n")); xf86DrvMsg( pScrn->scrnIndex, X_PROBED, - "mapping framebuffer @ 0x%x with size 0x%x\n", + "mapping framebuffer @ 0x%lx with size 0x%x\n", psav->FrameBufferBase, psav->videoRambytes); if (psav->videoRambytes) { @@ -2237,8 +2262,8 @@ (psav->FBBase + psav->CursorKByte*1024 + 4096 - 32); xf86DrvMsg( pScrn->scrnIndex, X_PROBED, - "Shadow area physical %08x, linear %08x\n", - psav->ShadowPhysical, psav->ShadowVirtual ); + "Shadow area physical %08lx, linear %p\n", + psav->ShadowPhysical, (void *)psav->ShadowVirtual ); psav->WaitQueue = ShadowWait1; psav->WaitIdle = ShadowWait; @@ -2363,10 +2388,8 @@ if (xf86DPMSInit(pScreen, SavageDPMS, 0) == FALSE) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "DPMS initialization failed\n"); -#ifdef XvExtension if( !psav->NoAccel && !SavagePanningCheck(pScrn) ) SavageInitVideo( pScreen ); -#endif if (serverGeneration == 1) xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); @@ -2489,22 +2512,7 @@ - if (pScrn->bitsPerPixel == 8) - psav->HorizScaleFactor = 1; - else if (pScrn->bitsPerPixel == 16) - psav->HorizScaleFactor = 1; /* I don't think we ever want 2 */ - else - psav->HorizScaleFactor = 1; - - if (psav->HorizScaleFactor == 2) - if (!mode->CrtcHAdjusted) { - mode->CrtcHDisplay *= 2; - mode->CrtcHSyncStart *= 2; - mode->CrtcHSyncEnd *= 2; - mode->CrtcHTotal *= 2; - mode->CrtcHSkew *= 2; - mode->CrtcHAdjusted = TRUE; - } + psav->HorizScaleFactor = 1; if (!vgaHWInit(pScrn, mode)) return FALSE; @@ -2958,10 +2966,6 @@ int i, index; vgaHWPtr hwp = VGAHWPTR(pScrn); - int vgaCRIndex, vgaCRReg, vgaIOBase; - vgaIOBase = hwp->IOBase; - vgaCRIndex = vgaIOBase + 4; - vgaCRReg = vgaIOBase + 5; VerticalRetraceWait(psav); for (i=0; ivgaIOBase + 5, a); \ } +#define HZEXP_COMP_1 0x54 +#define HZEXP_BORDER 0x58 #define HZEXP_FACTOR_IGA1 0x59 + +#define VTEXP_COMP_1 0x56 +#define VTEXP_BORDER 0x5a #define VTEXP_FACTOR_IGA1 0x5b +#define EC1_CENTER_ON 0x10 +#define EC1_EXPAND_ON 0x0c + #endif /* _SAVAGE_REGS_H */ Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c:1.12 xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c:1.14 --- xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c:1.12 Wed Oct 2 16:39:55 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c Wed Jun 18 12:17:40 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c,v 1.12 2002/10/02 20:39:55 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c,v 1.14 2003/06/18 16:17:40 eich Exp $ */ #include "savage_driver.h" #include "savage_vbe.h" @@ -72,7 +72,7 @@ SavageClearVM86Regs( psav->pInt10 ); psav->pInt10->ax = 0x4f14; /* S3 extensions */ psav->pInt10->bx = 0x0001; /* Set default refresh rate */ - psav->pInt10->cx = n; + psav->pInt10->cx = n & 0x3fff; psav->pInt10->di = Refresh & 0xffff; xf86ExecX86int10( psav->pInt10 ); @@ -150,6 +150,7 @@ xfree( pMode->RefreshRate ); pMode->RefreshRate = NULL; } + pMode++; } xfree( *ppTable ); Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c:1.11 xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c:1.18 --- xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c:1.11 Sat Jan 11 22:55:49 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c Mon Nov 10 13:22:26 2003 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c,v 1.11 2003/01/12 03:55:49 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c,v 1.18 2003/11/10 18:22:26 tsi Exp $ */ #include "Xv.h" #include "dix.h" @@ -17,11 +17,6 @@ #define TIMER_MASK (OFF_TIMER | FREE_TIMER) -#ifndef XvExtension -void SavageInitVideo(ScreenPtr pScreen) {} -void SavageResetVideo(ScrnInfoPtr pScrn) {} -#else - void myOUTREG( SavagePtr psav, unsigned long offset, unsigned long value ); static XF86VideoAdaptorPtr SavageSetupImageVideo(ScreenPtr); @@ -79,7 +74,7 @@ ) = NULL; static void OverlayParamInit(ScrnInfoPtr pScrn); -static void InitStreamsForExpansion(SavagePtr psav); +static void InitStreamsForExpansion(ScrnInfoPtr pScrn); /*static void SavageBlockHandler(int, pointer, pointer, pointer);*/ @@ -303,10 +298,10 @@ void myOUTREG( SavagePtr psav, unsigned long offset, unsigned long value ) { - ErrorF( "MMIO %04x, was %08x, want %08x,", - offset, MMIO_IN32( psav->MapBase, offset ), value ); + ErrorF( "MMIO %04lx, was %08lx, want %08lx,", + offset, (unsigned long)MMIO_IN32( psav->MapBase, offset ), value ); MMIO_OUT32( psav->MapBase, offset, value ); - ErrorF( " now %08x\n", MMIO_IN32( psav->MapBase, offset ) ); + ErrorF( " now %08lx\n", (unsigned long)MMIO_IN32( psav->MapBase, offset ) ); } void SavageInitStreamsOld(ScrnInfoPtr pScrn) @@ -421,7 +416,6 @@ /* Sequence stolen from streams.c in M7 NT driver */ - xf86EnableIO(); /* Unlock extended registers. */ @@ -430,10 +424,20 @@ VGAOUT16(vgaCRIndex, 0xa039); VGAOUT16(0x3c4, 0x0608); + if( + S3_SAVAGE_MOBILE_SERIES(psav->Chipset) && + !psav->CrtOnly && + !psav->TvOn + ) { + OverlayParamInit( pScrn ); + } + VGAOUT8( vgaCRIndex, EXT_MISC_CTRL2 ); if( S3_SAVAGE_MOBILE_SERIES(psav->Chipset) || - (psav->Chipset == S3_SUPERSAVAGE) || +#if 0 /* I don't think commenting this out is correct (EE) */ + (psav->Chipset == S3_SUPERSAVAGE) || +#endif (psav->Chipset == S3_SAVAGE2000) ) { jStreamsControl = VGAIN8( vgaCRReg ) | ENABLE_STREAM1; @@ -447,7 +451,7 @@ VGAOUT16( vgaCRIndex, (jStreamsControl << 8) | EXT_MISC_CTRL2 ); psav->blendBase = GetBlendForFourCC( id ) << 9; - xf86ErrorFVerb(XVTRACE+1,"Format %4.4s, blend is %08x\n", &id, psav->blendBase ); + xf86ErrorFVerb(XVTRACE+1,"Format %4.4s, blend is %08x\n", (char *)&id, psav->blendBase ); OUTREG( BLEND_CONTROL, psav->blendBase | 0x08 ); /* These values specify brightness, contrast, saturation and hue. */ @@ -701,7 +705,7 @@ SavagePortPrivPtr pPriv = psav->adaptor->pPortPrivates[0].ptr; xf86ErrorFVerb(XVTRACE, "bright %d, contrast %d, saturation %d, hue %d\n", - pPriv->brightness, pPriv->contrast, pPriv->saturation, pPriv->hue ); + pPriv->brightness, (int)pPriv->contrast, (int)pPriv->saturation, pPriv->hue ); if( (psav->videoFourCC == FOURCC_RV15) || @@ -743,7 +747,7 @@ unsigned long assembly; xf86ErrorFVerb(XVTRACE, "bright %d, contrast %d, saturation %d, hue %d\n", - pPriv->brightness, pPriv->contrast, pPriv->saturation, pPriv->hue ); + pPriv->brightness, (int)pPriv->contrast, (int)pPriv->saturation, pPriv->hue ); if( psav->videoFourCC == FOURCC_Y211 ) k = 1.0; /* YUV */ @@ -771,20 +775,20 @@ k2 = (int)(dk2+0.5) & 0x1ff; k3 = (int)(dk3+0.5) & 0x1ff; assembly = (k3<<18) | (k2<<9) | k1; - xf86ErrorFVerb(XVTRACE+1, "CC1 = %08x ", assembly ); + xf86ErrorFVerb(XVTRACE+1, "CC1 = %08lx ", assembly ); OUTREG( SEC_STREAM_COLOR_CONVERT1, assembly ); k4 = (int)(dk4+0.5) & 0x1ff; k5 = (int)(dk5+0.5) & 0x1ff; k6 = (int)(dk6+0.5) & 0x1ff; assembly = (k6<<18) | (k5<<9) | k4; - xf86ErrorFVerb(XVTRACE+1, "CC2 = %08x ", assembly ); + xf86ErrorFVerb(XVTRACE+1, "CC2 = %08lx ", assembly ); OUTREG( SEC_STREAM_COLOR_CONVERT2, assembly ); k7 = (int)(dk7+0.5) & 0x1ff; kb = (int)(dkb+0.5) & 0xffff; assembly = (kb<<9) | k7; - xf86ErrorFVerb(XVTRACE+1, "CC3 = %08x\n", assembly ); + xf86ErrorFVerb(XVTRACE+1, "CC3 = %08lx\n", assembly ); OUTREG( SEC_STREAM_COLOR_CONVERT3, assembly ); } @@ -865,7 +869,7 @@ pPriv->lastKnownPitch = 0; /* gotta uninit this someplace */ - REGION_INIT(pScreen, &pPriv->clip, NullBox, 0); + REGION_NULL(pScreen, &pPriv->clip); psav->adaptor = adapt; @@ -878,36 +882,6 @@ } -static Bool -RegionsEqual(RegionPtr A, RegionPtr B) -{ - int *dataA, *dataB; - int num; - - num = REGION_NUM_RECTS(A); - if(num != REGION_NUM_RECTS(B)) - return FALSE; - - if((A->extents.x1 != B->extents.x1) || - (A->extents.x2 != B->extents.x2) || - (A->extents.y1 != B->extents.y1) || - (A->extents.y2 != B->extents.y2)) - return FALSE; - - dataA = (int*)REGION_RECTS(A); - dataB = (int*)REGION_RECTS(B); - - while(num--) { - if((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) - return FALSE; - dataA += 2; - dataB += 2; - } - - return TRUE; -} - - /* SavageClipVideo - Takes the dst box in standard X BoxRec form (top and left @@ -992,9 +966,8 @@ REGION_EMPTY(pScrn->pScreen, &pPriv->clip); - SavageStreamsOff( pScrn ); - if(shutdown) { + SavageStreamsOff( pScrn ); if(pPriv->area) { xf86FreeOffscreenArea(pPriv->area); pPriv->area = NULL; @@ -1266,16 +1239,15 @@ if( src_w > (drw_w << 1) ) { - /* BUGBUG shouldn't this be >=? */ if( src_w <= (drw_w << 2) ) ssControl |= HDSCALE_4; - else if( src_w > (drw_w << 3) ) + else if( src_w <= (drw_w << 3) ) ssControl |= HDSCALE_8; - else if( src_w > (drw_w << 4) ) + else if( src_w <= (drw_w << 4) ) ssControl |= HDSCALE_16; - else if( src_w > (drw_w << 5) ) + else if( src_w <= (drw_w << 5) ) ssControl |= HDSCALE_32; - else if( src_w > (drw_w << 6) ) + else if( src_w <= (drw_w << 6) ) ssControl |= HDSCALE_64; } @@ -1283,9 +1255,11 @@ ssControl |= (1 << 24); OUTREG(SSTREAM_CONTROL_REG, ssControl); +#if 0 /* Set color key on primary. */ SavageSetColorKey( pScrn ); +#endif /* Set FIFO L2 on second stream. */ @@ -1358,10 +1332,10 @@ !psav->CrtOnly && !psav->TvOn ) { - drw_w = (float)(drw_w * psav->XExp1)/(float)psav->XExp2 + 1; - drw_h = (float)(drw_h * psav->YExp1)/(float)psav->YExp2 + 1; - dstBox->x1 = (float)(dstBox->x1 * psav->XExp1)/(float)psav->XExp2; - dstBox->y1 = (float)(dstBox->y1 * psav->YExp1)/(float)psav->YExp2; + drw_w = (drw_w * psav->XExp1)/psav->XExp2 + 1; + drw_h = (drw_h * psav->YExp1)/psav->YExp2 + 1; + dstBox->x1 = (dstBox->x1 * psav->XExp1)/psav->XExp2; + dstBox->y1 = (dstBox->y1 * psav->YExp1)/psav->YExp2; dstBox->x1 += psav->displayXoffset; dstBox->y1 += psav->displayYoffset; } @@ -1378,14 +1352,16 @@ * are 2 bytes/pixel. */ - OUTREG(SEC_STREAM_FBUF_ADDR0, (offset + (x1>>15)) & 0x3ffff0 ); + OUTREG(SEC_STREAM_FBUF_ADDR0, (offset + (x1>>15)) & 0x7ffff0 ); OUTREG(SEC_STREAM_STRIDE, pitch & 0xfff ); OUTREG(SEC_STREAM_WINDOW_START, ((dstBox->x1+1) << 16) | (dstBox->y1+1) ); OUTREG(SEC_STREAM_WINDOW_SZ, ((drw_w) << 16) | drw_h ); +#if 0 /* Set color key on primary. */ SavageSetColorKey( pScrn ); +#endif /* Set FIFO L2 on second stream. */ @@ -1417,6 +1393,7 @@ ){ SavagePortPrivPtr pPriv = (SavagePortPrivPtr)data; SavagePtr psav = SAVPTR(pScrn); + ScreenPtr pScreen = pScrn->pScreen; INT32 x1, x2, y1, y2; unsigned char *dst_start; int pitch, new_h, offset, offsetV=0, offsetU=0; @@ -1424,6 +1401,20 @@ int top, left, npixels, nlines; BoxRec dstBox; CARD32 tmp; +/* xf86ErrorFVerb(XVTRACE,"SavagePutImage\n"); */ + + if( psav->cxScreen != pScrn->currentMode->HDisplay ) + { + /* The mode has changed. Recompute the offsets. */ + + if( + S3_SAVAGE_MOBILE_SERIES(psav->Chipset) && + !psav->CrtOnly && + !psav->TvOn + ) { + OverlayParamInit( pScrn ); + } + } if(drw_w > 16384) drw_w = 16384; @@ -1519,18 +1510,19 @@ SavageCopyData(buf, dst_start, srcPitch, dstPitch, nlines, npixels); break; } + + /* We need to enable the video before we draw the chroma color. + Otherwise, we get blue flashes. */ + + SavageDisplayVideo(pScrn, id, offset, width, height, dstPitch, + x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h); /* update cliplist */ - if(!RegionsEqual(&pPriv->clip, clipBoxes)) { + if(!REGION_EQUAL(pScreen, &pPriv->clip, clipBoxes)) { REGION_COPY(pScreen, &pPriv->clip, clipBoxes); /* draw these */ - XAAFillSolidRects(pScrn, pPriv->colorKey, GXcopy, ~0, - REGION_NUM_RECTS(clipBoxes), - REGION_RECTS(clipBoxes)); + xf86XVFillKeyHelper(pScrn->pScreen, pPriv->colorKey, clipBoxes); } - - SavageDisplayVideo(pScrn, id, offset, width, height, dstPitch, - x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h); pPriv->videoStatus = CLIENT_VIDEO_ON; @@ -1692,6 +1684,7 @@ XF86SurfacePtr surface ){ OffscreenPrivPtr pPriv = (OffscreenPrivPtr)surface->devPrivate.ptr; + xf86ErrorFVerb(XVTRACE,"SavageStopSurface\n"); if(pPriv->isOn) { /*SavagePtr psav = SAVPTR(surface->pScrn);*/ @@ -1751,9 +1744,11 @@ ){ OffscreenPrivPtr pPriv = (OffscreenPrivPtr)surface->devPrivate.ptr; ScrnInfoPtr pScrn = surface->pScrn; + ScreenPtr pScreen = pScrn->pScreen; SavagePortPrivPtr portPriv = GET_PORT_PRIVATE(pScrn); INT32 x1, y1, x2, y2; BoxRec dstBox; + xf86ErrorFVerb(XVTRACE,"SavageDisplaySurface\n"); x1 = src_x; x2 = src_x + src_w; @@ -1777,18 +1772,16 @@ dstBox.y1 -= pScrn->frameY0; dstBox.y2 -= pScrn->frameY0; - XAAFillSolidRects(pScrn, portPriv->colorKey, GXcopy, ~0, - REGION_NUM_RECTS(clipBoxes), - REGION_RECTS(clipBoxes)); - SavageDisplayVideo(pScrn, surface->id, surface->offsets[0], surface->width, surface->height, surface->pitches[0], x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h); + xf86XVFillKeyHelper(pScrn->pScreen, portPriv->colorKey, clipBoxes); + pPriv->isOn = TRUE; #if 0 if(portPriv->videoStatus & CLIENT_VIDEO_ON) { - REGION_EMPTY(pScrn->pScreen, &portPriv->clip); + REGION_EMPTY(pScreen, &portPriv->clip); UpdateCurrentTime(); portPriv->videoStatus = FREE_TIMER; portPriv->freeTime = currentTime.milliseconds + FREE_DELAY; @@ -1839,144 +1832,87 @@ SavagePtr psav = SAVPTR(pScrn); psav = SAVPTR(pScrn); - psav->cxScreen = psav->iResX; - InitStreamsForExpansion(psav); + psav->cxScreen = pScrn->currentMode->HDisplay; + InitStreamsForExpansion(pScrn); } -/* Function to calculate lcd expansion x,yfactor and offset for overlay +/* Function to calculate lcd expansion x,y factor and offset for overlay */ -static void InitStreamsForExpansion(SavagePtr psav) +static void InitStreamsForExpansion(ScrnInfoPtr pScrn) { + SavagePtr psav = SAVPTR(pScrn); int PanelSizeX,PanelSizeY; int ViewPortWidth,ViewPortHeight; + int XExpansion, YExpansion; int XFactor, YFactor; + int Hstate, Vstate; + + static CARD32 Xfactors[] = { + 0x00010001, + 0x00010001, /* 1 */ + 0, + 0x00090008, /* 3 */ + 0x00050004, /* 4 */ + 0, + 0x00030002, /* 6 */ + 0x00020001 /* 7 */ + }; + + static CARD32 Yfactors[] = { + 0x00010001, 0x00010001, + 0, 0x00060005, + 0x00050004, 0x00040003, + 0, 0x00030002, + 0x00020001, 0x00050002, + 0x000C0005, 0x00080003, + 0x00090004, 0, + 0x00030001, 0x00040001, + }; + + PanelSizeX = psav->PanelX; PanelSizeY = psav->PanelY; - ViewPortWidth = psav->iResX; - ViewPortHeight = psav->iResY; + ViewPortWidth = pScrn->currentMode->HDisplay; + ViewPortHeight = pScrn->currentMode->VDisplay; + if( PanelSizeX == 1408 ) PanelSizeX = 1400; - psav->XExpansion = 0x00010001; - psav->YExpansion = 0x00010001; + + XExpansion = 0x00010001; + YExpansion = 0x00010001; + psav->displayXoffset = 0; psav->displayYoffset = 0; + VGAOUT8(0x3C4, HZEXP_COMP_1); + Hstate = VGAIN8(0x3C5); + VGAOUT8(0x3C4, VTEXP_COMP_1); + Vstate = VGAIN8(0x3C5); VGAOUT8(0x3C4, HZEXP_FACTOR_IGA1); - XFactor = VGAIN8(0x3C5) >> 4; + XFactor = VGAIN8(0x3C5); VGAOUT8(0x3C4, VTEXP_FACTOR_IGA1); - YFactor = VGAIN8(0x3C5) >> 4; + YFactor = VGAIN8(0x3C5); - switch( XFactor ) + if( Hstate & EC1_EXPAND_ON ) { - case 1: - psav->XExpansion = 0x00010001; - psav->displayXoffset = - (((PanelSizeX - ViewPortWidth) / 2) + 0x7) & 0xFFF8; - break; - - case 3: - psav->XExpansion = 0x00090008; - psav->displayXoffset = - (((PanelSizeX - ((9 * ViewPortWidth)/8)) / 2) + 0x7) & 0xFFF8; - break; + XExpansion = Xfactors[XFactor>>4]; + } - case 4: - psav->XExpansion = 0x00050004; + if( Vstate & EC1_EXPAND_ON ) + { + YExpansion = Yfactors[YFactor>>4]; + } - if ((psav->cxScreen == 800) && (PanelSizeX !=1400)) - { - psav->displayXoffset = - (((PanelSizeX - ((5 * ViewPortWidth)/4)) / 2) ) & 0xFFF8; - } - else - { - psav->displayXoffset = - (((PanelSizeX - ((5 * ViewPortWidth)/4)) / 2) +0x7) & 0xFFF8; - } - break; + psav->XExp1 = XExpansion >> 16; + psav->XExp2 = XExpansion & 0xFFFF; - case 6: - psav->XExpansion = 0x00030002; - psav->displayXoffset = - (((PanelSizeX - ((3 * ViewPortWidth)/2)) / 2) + 0x7) & 0xFFF8; - break; + psav->YExp1 = YExpansion >> 16; + psav->YExp2 = YExpansion & 0xFFFF; - case 7: - psav->XExpansion = 0x00020001; - psav->displayXoffset = - (((PanelSizeX - (2 * ViewPortWidth)) / 2) + 0x7) & 0xFFF8; - break; - } - - switch( YFactor ) - { - case 0: - psav->YExpansion = 0x00010001; - psav->displayYoffset = (PanelSizeY - ViewPortHeight) / 2; - break; - case 1: - psav->YExpansion = 0x00010001; - psav->displayYoffset = (PanelSizeY - ViewPortHeight) / 2; - break; - case 2: - psav->YExpansion = 0x00040003; - psav->displayYoffset = (PanelSizeY - ((4 * ViewPortHeight)/3)) / 2; - break; - case 4: - psav->YExpansion = 0x00050004; - psav->displayYoffset = (PanelSizeY - ((5 * ViewPortHeight)/4)) / 2; - break; - case 5: - psav->YExpansion = 0x00040003; + psav->displayXoffset = + ((PanelSizeX - (psav->XExp1 * ViewPortWidth) / psav->XExp2) / 2 + 7) & 0xfff8; + psav->displayYoffset = + ((PanelSizeY - (psav->YExp1 * ViewPortHeight) / psav->YExp2) / 2); - if((psav->cxScreen == 1024)&&(PanelSizeX ==1400)) - { - psav->displayYoffset = - ((PanelSizeY - ((4 * ViewPortHeight)/3)) / 2) - 0x1 ; - } - else - { - psav->displayYoffset = (PanelSizeY - ((4 * ViewPortHeight)/3)) / 2; - } - break; - case 6: - psav->YExpansion = 0x00050004; - psav->displayYoffset = (PanelSizeY - ((5 * ViewPortHeight)/4)) / 2; - break; - case 7: - psav->YExpansion = 0x00030002; - psav->displayYoffset = (PanelSizeY - ((3 * ViewPortHeight)/2)) / 2; - break; - case 8: - psav->YExpansion = 0x00020001; - psav->displayYoffset = (PanelSizeY - (2 * ViewPortHeight)) /2; - break; - case 9: - psav->YExpansion = 0x00090004; - psav->displayYoffset = (PanelSizeY - ((9 * ViewPortHeight)/4)) /2; - break; - case 11: - psav->YExpansion = 0x00110005; - psav->displayYoffset = (PanelSizeY - ((11 * ViewPortHeight)/5)) /2; - break; - case 12: - psav->YExpansion = 0x00070003; - psav->displayYoffset = (PanelSizeY - ((7 * ViewPortHeight)/3)) /2; - break; - case 14: - psav->YExpansion = 0x00050002; - psav->displayYoffset = (PanelSizeY - ((5 * ViewPortHeight)/2)) /2; - break; - case 15: - psav->YExpansion = 0x00040001; - psav->displayYoffset = (PanelSizeY - (4 * ViewPortHeight)) /2; - break; - } - psav->XExp1 = psav->XExpansion >> 16; - psav->XExp2 = psav->XExpansion & 0xFFFF; - psav->YExp1 = psav->YExpansion >> 16; - psav->YExp2 = psav->YExpansion & 0xFFFF; } /* InitStreamsForExpansionPM */ - -#endif /* XvExtension */ Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/regsmi.h diff -u xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/regsmi.h:1.2 xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/regsmi.h:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/regsmi.h:1.2 Fri Jan 25 16:56:09 2002 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/regsmi.h Wed Oct 8 07:13:01 2003 @@ -26,13 +26,14 @@ sale, use or other dealings in this Software without prior written authorization from the XFree86 Project and SIlicon Motion. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/regsmi.h,v 1.2 2002/01/25 21:56:09 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/regsmi.h,v 1.3 2003/10/08 11:13:01 eich Exp $ */ #ifndef _REGSMI_H #define _REGSMI_H #define SMI_LYNX_SERIES(chip) ((chip & 0xF0F0) == 0x0010) #define SMI_LYNX3D_SERIES(chip) ((chip & 0xF0F0) == 0x0020) +#define SMI_COUGAR_SERIES(chip) ((chip & 0xF0F0) == 0x0030) #define SMI_LYNXEM_SERIES(chip) ((chip & 0xFFF0) == 0x0710) #define SMI_LYNXM_SERIES(chip) ((chip & 0xFF00) == 0x0700) @@ -45,6 +46,7 @@ #define SMI_LYNXEM PCI_CHIP_SMI710 #define SMI_LYNXEMplus PCI_CHIP_SMI712 #define SMI_LYNX3DM PCI_CHIP_SMI720 +#define SMI_COUGAR3DR PCI_CHIP_SMI731 /* I/O Functions */ static __inline__ CARD8 @@ -114,6 +116,8 @@ #define READ_VPR(pSmi, vpr) MMIO_IN32(pSmi->VPRBase, vpr) #define WRITE_CPR(pSmi, cpr, data) MMIO_OUT32(pSmi->CPRBase, cpr, data); DEBUG((VERBLEV, "CPR%02X = %08X\n", cpr, data)) #define READ_CPR(pSmi, cpr) MMIO_IN32(pSmi->CPRBase, cpr) +#define WRITE_FPR(pSmi, fpr, data) MMIO_OUT32(pSmi->FPRBase, fpr, data); DEBUG((VERBLEV, "FPR%02X = %08X\n", fpr, data)) +#define READ_FPR(pSmi, fpr) MMIO_IN32(pSmi->FPRBase, fpr) /* 2D Engine commands */ #define SMI_TRANSPARENT_SRC 0x00000100 @@ -204,4 +208,65 @@ #define RGB16_555 1 #define RGB32_888 2 +/* register defines so we're not hardcoding numbers */ + +#define FPR00 0x0000 + +/* video window formats - I=indexed, P=packed */ +#define FPR00_FMT_8I 0x0 +#define FPR00_FMT_15P 0x1 +#define FPR00_FMT_16P 0x2 +#define FPR00_FMT_32P 0x3 +#define FPR00_FMT_24P 0x4 +#define FPR00_FMT_8P 0x5 +#define FPR00_FMT_YUV422 0x6 +#define FPR00_FMT_YUV420 0x7 + +/* possible bit definitions for FPR00 - VWI = Video Window 1 */ +#define FPR00_VWIENABLE 0x00000008 +#define FPR00_VWITILE 0x00000010 +#define FPR00_VWIFILTER2 0x00000020 +#define FPR00_VWIFILTER4 0x00000040 +#define FPR00_VWIKEYENABLE 0x00000080 +#define FPR00_VWIGDF_SHIFT 16 +#define FPR00_VWIGDENABLE 0x00080000 +#define FPR00_VWIGDTILE 0x00100000 + +#define FPR00_MASKBITS 0x0000FFFF + +#define FPR04 0x0004 +#define FPR08 0x0008 +#define FPR0C 0x000C +#define FPR10 0x0010 +#define FPR14 0x0014 +#define FPR18 0x0018 +#define FPR1C 0x001C +#define FPR20 0x0020 +#define FPR24 0x0024 +#define FPR58 0x0058 +#define FPR5C 0x005C +#define FPR68 0x0068 +#define FPRB0 0x00B0 +#define FPRB4 0x00B4 +#define FPRC4 0x00C4 +#define FPRCC 0x00CC + +#define FPR158 0x0158 +#define FPR158_MASK_MAXBITS 0x07FF +#define FPR158_MASK_BOUNDARY 0x0800 +#define FPR15C 0x015C +#define FPR15C_MASK_HWCCOLORS 0x0000FFFF +#define FPR15C_MASK_HWCADDREN 0xFFFF0000 +#define FPR15C_MASK_HWCENABLE 0x80000000 + +/* panel sizes returned by the bios */ + +#define PANEL_640x480 0x00 +#define PANEL_800x600 0x01 +#define PANEL_1024x768 0x02 +#define PANEL_1280x1024 0x03 +#define PANEL_1600x1200 0x04 +#define PANEL_1400x1050 0x0A + + #endif /* _REGSMI_H */ Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.man diff -u xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.man:1.4 xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.man:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.man:1.4 Thu Dec 20 16:35:38 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.man Wed Oct 8 07:13:01 2003 @@ -1,5 +1,5 @@ .\" Header: //Mercury/Projects/archives/XFree86/4.0/siliconmotion.cpp-arc 1.4 29 Nov 2000 14:12:56 Frido $ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.man,v 1.4 2001/12/20 21:35:38 eich Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.man,v 1.5 2003/10/08 11:13:01 eich Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH siliconmotion __drivermansuffix__ __vendorversion__ @@ -48,6 +48,9 @@ .TP 12 .B Lynx3DM SM720 +.TP 12 +.B Cougar3DR +SM730 .SH CONFIGURATION DETAILS Please refer to XF86Config(__filemansuffix__) for general configuration details. This section only covers configuration details specific to this @@ -61,7 +64,7 @@ section, and will override the auto-detection: .PP .RS 4 -"lynx", "lynxe", "lynx3d", "lynxem", "lynxem+", "lynx3dm". +"lynx", "lynxe", "lynx3d", "lynxem", "lynxem+", "lynx3dm", "cougar3dr". .RE .PP Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h diff -u xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h:1.12 xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h:1.14 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h:1.12 Sat Jan 11 22:55:49 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h Wed Oct 8 07:13:01 2003 @@ -26,7 +26,7 @@ sale, use or other dealings in this Software without prior written authorization from the XFree86 Project and Silicon Motion. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h,v 1.12 2003/01/12 03:55:49 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h,v 1.14 2003/10/08 11:13:01 eich Exp $ */ #ifndef _SMI_H #define _SMI_H @@ -64,10 +64,8 @@ #include "xf86int10.h" #include "vbe.h" -#ifdef XvExtension -# include "xf86xv.h" -# include "Xv.h" -#endif +#include "xf86xv.h" +#include "Xv.h" /******************************************************************************/ /* D E F I N I T I O N S */ @@ -104,6 +102,7 @@ DPR44; CARD32 VPR00, VPR0C, VPR10; CARD32 CPR00; + CARD32 FPR00_, FPR0C_, FPR10_; } SMIRegRec, *SMIRegPtr; @@ -147,6 +146,7 @@ CARD8 * DPRBase; /* Base of DPR registers */ CARD8 * VPRBase; /* Base of VPR registers */ CARD8 * CPRBase; /* Base of CPR registers */ + CARD8 * FPRBase; /* Base of FPR registers - for 0730 chipset */ CARD8 * DataPortBase; /* Base of data port */ int DataPortSize; /* Size of data port */ CARD8 * IOBase; /* Base of MMIO VGA ports */ @@ -241,17 +241,15 @@ void (*PointerMoved)(int index, int x, int y); -#ifdef XvExtension int videoKey; /* Video chroma key */ Bool ByteSwap; /* Byte swap for ZV port */ - Bool interlaced; /* True: Interlaced Video */ + Bool interlaced; /* True: Interlaced Video */ /* XvExtension */ XF86VideoAdaptorPtr ptrAdaptor; /* Pointer to VideoAdapter structure */ void (*BlockHandler)(int i, pointer blockData, pointer pTimeout, pointer pReadMask); - GCPtr videoGC; -#endif + GCPtr videoGC; OptionInfoPtr Options; CARD8 DACmask; } SMIRec, *SMIPtr; @@ -355,6 +353,7 @@ /* smi_shadow.c */ void SMI_PointerMoved(int index, int x, int y); void SMI_RefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox); +void SMI_RefreshArea730(ScrnInfoPtr pScrn, int num, BoxPtr pbox); /* smi_video.c */ void SMI_InitVideo(ScreenPtr pScreen); Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c:1.7 xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c:1.7 Sat Jan 11 22:55:49 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c Wed Oct 8 07:13:01 2003 @@ -26,7 +26,7 @@ sale, use or other dealings in this Software without prior written authorization from the XFree86 Project and silicon Motion. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c,v 1.7 2003/01/12 03:55:49 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c,v 1.9 2003/10/08 11:13:01 eich Exp $ */ #include "smi.h" @@ -207,7 +207,7 @@ } else { -#if defined(XvExtension) && SMI_USE_VIDEO +#if SMI_USE_VIDEO numLines = ((pSmi->FBReserved - pSmi->width * pSmi->Bpp * pSmi->height) * 25 / 100 + pSmi->width * pSmi->Bpp - 1) / (pSmi->width * pSmi->Bpp); @@ -1096,7 +1096,14 @@ if (box) { /* Refresh all polyline segments now. */ - SMI_RefreshArea(pScrn, box, pBox); + if (pSmi->Chipset == SMI_COUGAR3DR) + { + SMI_RefreshArea730(pScrn, box, pBox); + } + else + { + SMI_RefreshArea(pScrn, box, pBox); + } } /* Free the temporary buffer. */ Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c:1.28 xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c:1.37 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c:1.28 Wed Feb 5 12:45:29 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c Thu Nov 6 13:38:08 2003 @@ -26,7 +26,7 @@ sale, use or other dealings in this Software without prior written authorization from The XFree86 Project or Silicon Motion. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c,v 1.28 2003/02/05 17:45:29 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c,v 1.37 2003/11/06 18:38:08 tsi Exp $ */ #include "xf86Resources.h" #include "xf86RAC.h" @@ -120,6 +120,7 @@ { PCI_CHIP_SMI710, "LynxEM" }, { PCI_CHIP_SMI712, "LynxEM+" }, { PCI_CHIP_SMI720, "Lynx3DM" }, + { PCI_CHIP_SMI731, "Cougar3DR" }, { -1, NULL } }; @@ -132,6 +133,7 @@ { PCI_CHIP_SMI710, PCI_CHIP_SMI710, RES_SHARED_VGA }, { PCI_CHIP_SMI712, PCI_CHIP_SMI712, RES_SHARED_VGA }, { PCI_CHIP_SMI720, PCI_CHIP_SMI720, RES_SHARED_VGA }, + { PCI_CHIP_SMI731, PCI_CHIP_SMI731, RES_SHARED_VGA }, { -1, -1, RES_UNDEFINED } }; @@ -149,13 +151,11 @@ OPTION_HWCURSOR, OPTION_SHADOW_FB, OPTION_ROTATE, -#ifdef XvExtension OPTION_VIDEOKEY, OPTION_BYTESWAP, - /* CZ 26.10.2001: interlaced video */ - OPTION_INTERLACED, - /* end CZ */ -#endif + /* CZ 26.10.2001: interlaced video */ + OPTION_INTERLACED, + /* end CZ */ OPTION_USEBIOS, OPTION_ZOOMONLCD, NUMBER_OF_OPTIONS @@ -164,28 +164,26 @@ static const OptionInfoRec SMIOptions[] = { - { OPTION_PCI_BURST, "pci_burst", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_FIFO_CONSERV, "fifo_conservative", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_FIFO_MODERATE, "fifo_moderate", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_PCI_BURST, "pci_burst", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_FIFO_CONSERV, "fifo_conservative", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_FIFO_MODERATE, "fifo_moderate", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_FIFO_AGGRESSIVE, "fifo_aggressive", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_PCI_RETRY, "pci_retry", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_MCLK, "set_mclk", OPTV_FREQ, {0}, FALSE }, - { OPTION_SHOWCACHE, "show_cache", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_HWCURSOR, "HWCursor", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_SWCURSOR, "SWCursor", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE }, -#ifdef XvExtension - { OPTION_VIDEOKEY, "VideoKey", OPTV_INTEGER, {0}, FALSE }, - { OPTION_BYTESWAP, "ByteSwap", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_PCI_RETRY, "pci_retry", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_MCLK, "set_mclk", OPTV_FREQ, {0}, FALSE }, + { OPTION_SHOWCACHE, "show_cache", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_HWCURSOR, "HWCursor", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_SWCURSOR, "SWCursor", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE }, + { OPTION_VIDEOKEY, "VideoKey", OPTV_INTEGER, {0}, FALSE }, + { OPTION_BYTESWAP, "ByteSwap", OPTV_BOOLEAN, {0}, FALSE }, /* CZ 26.10.2001: interlaced video */ - { OPTION_INTERLACED, "Interlaced", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_INTERLACED, "Interlaced", OPTV_BOOLEAN, {0}, FALSE }, /* end CZ */ -#endif - { OPTION_USEBIOS, "UseBIOS", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_ZOOMONLCD, "ZoomOnLCD", OPTV_BOOLEAN, {0}, FALSE }, - { -1, NULL, OPTV_NONE, {0}, FALSE } + { OPTION_USEBIOS, "UseBIOS", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_ZOOMONLCD, "ZoomOnLCD", OPTV_BOOLEAN, {0}, FALSE }, + { -1, NULL, OPTV_NONE, {0}, FALSE } }; /* @@ -223,10 +221,8 @@ "XAACreateInfoRec", "XAADestroyInfoRec", "XAAFallbackOps", - "XAAFillSolidRects", "XAAInit", "XAAPatternROP", - "XAAScreenIndex", NULL }; @@ -516,7 +512,7 @@ unsigned char config, m, n, shift; int mclk; vgaHWPtr hwp; - int vgaCRIndex, vgaCRReg, vgaIOBase; + int vgaCRIndex, vgaIOBase; vbeInfoPtr pVbe = NULL; ENTER_PROC("SMI_PreInit"); @@ -567,11 +563,10 @@ pScrn->monitor = pScrn->confScreen->monitor; /* - * The first thing we should figure out is the depth, bpp, etc. Our - * default depth is 8, so pass it to the helper function. We support - * only 24bpp layouts, so indicate that. + * The first thing we should figure out is the depth, bpp, etc. + * We support only 24bpp layouts, so indicate that. */ - if (!xf86SetDepthBpp(pScrn, 8, 8, 8, Support24bppFb)) + if (!xf86SetDepthBpp(pScrn, 0, 0, 0, Support24bppFb)) { LEAVE_PROC("SMI_PreInit"); return(FALSE); @@ -792,7 +787,12 @@ } } -#ifdef XvExtension + if (pSmi->rotate) + { + /* Disable the RandR extension, it messes up the internal rotation stuff */ + xf86DisableRandR(); + } + if (xf86GetOptValInteger(pSmi->Options, OPTION_VIDEOKEY, &pSmi->videoKey)) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: Video key set to " @@ -815,18 +815,17 @@ pSmi->ByteSwap = FALSE; } - /* CZ 26.10.2001: interlaced video */ - if (xf86ReturnOptValBool(pSmi->Options, OPTION_INTERLACED, FALSE)) - { - pSmi->interlaced = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: Interlaced enabled.\n"); - } - else - { - pSmi->interlaced = FALSE; - } - /* end CZ */ -#endif + /* CZ 26.10.2001: interlaced video */ + if (xf86ReturnOptValBool(pSmi->Options, OPTION_INTERLACED, FALSE)) + { + pSmi->interlaced = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: Interlaced enabled.\n"); + } + else + { + pSmi->interlaced = FALSE; + } + /* end CZ */ if (xf86GetOptValBool(pSmi->Options, OPTION_USEBIOS, &pSmi->useBIOS)) { @@ -943,11 +942,10 @@ hwp = VGAHWPTR(pScrn); vgaIOBase = hwp->IOBase; vgaCRIndex = vgaIOBase + VGA_CRTC_INDEX_OFFSET; - vgaCRReg = vgaIOBase + VGA_CRTC_DATA_OFFSET; pSmi->PIOBase = hwp->PIOOffset; xf86ErrorFVerb(VERBLEV, "\tSMI_PreInit vgaCRIndex=%x, vgaIOBase=%x, " - "MMIOBase=%x\n", vgaCRIndex, vgaIOBase, hwp->MMIOBase); + "MMIOBase=%p\n", vgaCRIndex, vgaIOBase, hwp->MMIOBase); /* Next go on to detect amount of installed ram */ config = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x71); @@ -1053,6 +1051,14 @@ pSmi->videoRAMKBytes = mem_table[(config >> 6)] * 1024; break; } + + case SMI_COUGAR3DR: + { + /* DANGER - Cougar3DR BIOS is broken - hardcode video ram size */ + /* per instructions from Silicon Motion engineers */ + pSmi->videoRAMKBytes = 16 * 1024; + break; + } } pSmi->videoRAMBytes = pSmi->videoRAMKBytes * 1024; pScrn->videoRam = pSmi->videoRAMKBytes; @@ -1077,7 +1083,7 @@ pScrn->clock[3] = pScrn->clock[2]; } - if (pSmi->Chipset == SMI_LYNX3DM) + if ((pSmi->Chipset == SMI_LYNX3DM) || (pSmi->Chipset == SMI_COUGAR3DR)) { if (pScrn->clock[0] <= 0) pScrn->clock[0] = 200000; if (pScrn->clock[1] <= 0) pScrn->clock[1] = 200000; @@ -1322,7 +1328,14 @@ box.y1 = 0; box.x2 = pScrn->virtualY; box.y2 = pScrn->virtualX; - SMI_RefreshArea(pScrn, 1, &box); + if (pSmi->Chipset == SMI_COUGAR3DR) + { + SMI_RefreshArea730(pScrn, 1, &box); + } + else + { + SMI_RefreshArea(pScrn, 1, &box); + } } /* Reset the grapics engine */ @@ -1410,7 +1423,7 @@ ENTER_PROC("SMI_Save"); /* Save the standard VGA registers */ - vgaHWSave(pScrn, vgaSavePtr, VGA_SR_MODE); + vgaHWSave(pScrn, vgaSavePtr, VGA_SR_ALL); save->smiDACMask = VGAIN8(pSmi, VGA_DAC_MASK); VGAOUT8(pSmi, VGA_DAC_READ_ADDR, 0); for (i = 0; i < 256; i++) @@ -1482,11 +1495,11 @@ } } - /* CZ 2.11.2001: for gamma correction (TODO: other chipsets?) */ - if (pSmi->Chipset == SMI_LYNX3DM) { - save->CCR66 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x66); - } - /* end CZ */ + /* CZ 2.11.2001: for gamma correction (TODO: other chipsets?) */ + if ((pSmi->Chipset == SMI_LYNX3DM) || (pSmi->Chipset == SMI_COUGAR3DR)) { + save->CCR66 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x66); + } + /* end CZ */ save->DPR10 = READ_DPR(pSmi, 0x10); save->DPR1C = READ_DPR(pSmi, 0x1C); @@ -1503,6 +1516,13 @@ save->VPR0C = READ_VPR(pSmi, 0x0C); save->VPR10 = READ_VPR(pSmi, 0x10); + if (pSmi->Chipset == SMI_COUGAR3DR) + { + save->FPR00_ = READ_FPR(pSmi, FPR00); + save->FPR0C_ = READ_FPR(pSmi, FPR0C); + save->FPR10_ = READ_FPR(pSmi, FPR10); + } + save->CPR00 = READ_CPR(pSmi, 0x00); if (!pSmi->ModeStructInit) @@ -1601,7 +1621,7 @@ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0xA0, restore->SRA0); /* Restore the standard VGA registers */ - vgaHWRestore(pScrn, vgaSavePtr, VGA_SR_MODE); + vgaHWRestore(pScrn, vgaSavePtr, VGA_SR_ALL); if (restore->smiDACMask) { VGAOUT8(pSmi, VGA_DAC_MASK, restore->smiDACMask); @@ -1672,7 +1692,7 @@ } if (restore->modeInit) - vgaHWRestore(pScrn, vgaSavePtr, VGA_SR_MODE); + vgaHWRestore(pScrn, vgaSavePtr, VGA_SR_ALL); if (!SMI_LYNXM_SERIES(pSmi->Chipset)) { @@ -1686,11 +1706,11 @@ } } - /* CZ 2.11.2001: for gamma correction (TODO: other chipsets?) */ - if (pSmi->Chipset == SMI_LYNX3DM) { - VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x66, restore->CCR66); - } - /* end CZ */ + /* CZ 2.11.2001: for gamma correction (TODO: other chipsets?) */ + if ((pSmi->Chipset == SMI_LYNX3DM) || (pSmi->Chipset == SMI_COUGAR3DR)) { + VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x66, restore->CCR66); + } + /* end CZ */ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81, 0x00); @@ -1709,6 +1729,13 @@ WRITE_VPR(pSmi, 0x0C, restore->VPR0C); WRITE_VPR(pSmi, 0x10, restore->VPR10); + if(pSmi->Chipset == SMI_COUGAR3DR) + { + WRITE_FPR(pSmi, FPR00, restore->FPR00_); + WRITE_FPR(pSmi, FPR0C, restore->FPR0C_); + WRITE_FPR(pSmi, FPR10, restore->FPR10_); + } + WRITE_CPR(pSmi, 0x00, restore->CPR00); if (xf86GetVerbosity() > 1) @@ -1740,6 +1767,11 @@ pSmi->MapSize = 0x10000; break; + case SMI_COUGAR3DR: + memBase = pSmi->PciInfo->memBase[1]; + pSmi->MapSize = 0x200000; + break; + case SMI_LYNX3D: memBase = pSmi->PciInfo->memBase[0] + 0x680000; pSmi->MapSize = 0x180000; @@ -1778,6 +1810,16 @@ pSmi->DataPortSize = 0x8000; break; + case SMI_COUGAR3DR: + pSmi->DPRBase = pSmi->MapBase + 0x000000; + pSmi->VPRBase = pSmi->MapBase + 0x000800; + pSmi->CPRBase = pSmi->MapBase + 0x001000; + pSmi->FPRBase = pSmi->MapBase + 0x005800; + pSmi->IOBase = pSmi->MapBase + 0x0C0000; + pSmi->DataPortBase = pSmi->MapBase + 0x100000; + pSmi->DataPortSize = 0x100000; + break; + case SMI_LYNX3D: pSmi->DPRBase = pSmi->MapBase + 0x000000; pSmi->VPRBase = pSmi->MapBase + 0x000800; @@ -1807,15 +1849,15 @@ break; } xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, VERBLEV, - "Physical MMIO at 0x%08X\n", memBase); + "Physical MMIO at 0x%08lX\n", (unsigned long)memBase); xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, VERBLEV, - "Logical MMIO at 0x%08X - 0x%08X\n", pSmi->MapBase, + "Logical MMIO at %p - %p\n", pSmi->MapBase, pSmi->MapBase + pSmi->MapSize - 1); xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, VERBLEV, - "DPR=0x%08X, VPR=0x%08X, IOBase=0x%08X\n", pSmi->DPRBase, - pSmi->VPRBase, pSmi->IOBase); + "DPR=%p, VPR=%p, IOBase=%p\n", + pSmi->DPRBase, pSmi->VPRBase, pSmi->IOBase); xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, VERBLEV, - "DataPort=0x%08X - 0x%08X\n", pSmi->DataPortBase, + "DataPort=%p - %p\n", pSmi->DataPortBase, pSmi->DataPortBase + pSmi->DataPortSize - 1); /* Map the frame buffer */ @@ -1842,9 +1884,9 @@ } pSmi->FBOffset = pScrn->fbOffset = 0; xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, VERBLEV, - "Physical frame buffer at 0x%08X\n", pScrn->memPhysBase); + "Physical frame buffer at 0x%08lX\n", pScrn->memPhysBase); xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, VERBLEV, - "Logical frame buffer at 0x%08X - 0x%08X\n", pSmi->FBBase, + "Logical frame buffer at %p - %p\n", pSmi->FBBase, pSmi->FBBase + pSmi->videoRAMBytes - 1); SMI_EnableMmio(pScrn); @@ -1868,44 +1910,122 @@ { pSmi->FBReserved = pSmi->videoRAMBytes - 2048; } - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Cursor Offset: %08X Reserved: %08X\n", - pSmi->FBCursorOffset, pSmi->FBReserved); - - pSmi->lcd = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x31) & 0x01; - if (VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x30) & 0x01) - { - pSmi->lcd <<= 1; - } - switch (VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x30) & 0x0C) - { - case 0x00: - pSmi->lcdWidth = 640; - pSmi->lcdHeight = 480; - break; - - case 0x04: - pSmi->lcdWidth = 800; - pSmi->lcdHeight = 600; - break; - - case 0x08: - if (VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x74) & 0x02) + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Cursor Offset: %08lX Reserved: %08lX\n", + (unsigned long)pSmi->FBCursorOffset, + (unsigned long)pSmi->FBReserved); + /* panel size detection ... requires BIOS call on 730 hardware */ + if (pSmi->Chipset == SMI_COUGAR3DR) + { + if (pSmi->pInt10 != NULL) + { + pSmi->pInt10->num = 0x10; + pSmi->pInt10->ax = 0x5F00; + pSmi->pInt10->bx = 0; + pSmi->pInt10->cx = 0; + pSmi->pInt10->dx = 0; + xf86ExecX86int10(pSmi->pInt10); + if (pSmi->pInt10->ax == 0x005F) { - pSmi->lcdWidth = 1024; - pSmi->lcdHeight = 600; + switch (pSmi->pInt10->cx & 0x0F) + { + case PANEL_640x480: + pSmi->lcdWidth = 640; + pSmi->lcdHeight = 480; + break; + + case PANEL_800x600: + pSmi->lcdWidth = 800; + pSmi->lcdHeight = 600; + break; + + case PANEL_1024x768: + pSmi->lcdWidth = 1024; + pSmi->lcdHeight = 768; + break; + + case PANEL_1280x1024: + pSmi->lcdWidth = 1280; + pSmi->lcdHeight = 1024; + break; + + case PANEL_1600x1200: + pSmi->lcdWidth = 1600; + pSmi->lcdHeight = 1200; + break; + + case PANEL_1400x1050: + pSmi->lcdWidth = 1400; + pSmi->lcdHeight = 1050; + break; + } + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Detected panel size via BIOS: %d x %d\n", + pSmi->lcdWidth, pSmi->lcdHeight); } else { - pSmi->lcdWidth = 1024; - pSmi->lcdHeight = 768; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "BIOS error during 730 panel detection!\n"); + pSmi->lcdWidth = pScrn->virtualX; + pSmi->lcdHeight = pScrn->virtualY; } - break; + } + else + { + /* int10 support isn't setup on the second call to this function, + so if this is the second call, don't do detection again */ + if (pSmi->lcd == 0) + { + /* If we get here, int10 support is not loaded or not working */ + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "No BIOS support for 730 panel detection!\n"); + pSmi->lcdWidth = pScrn->virtualX; + pSmi->lcdHeight = pScrn->virtualY; + } + } - case 0x0C: - pSmi->lcdWidth = 1280; - pSmi->lcdHeight = 1024; - break; + /* Set this to indicate that we've done the detection */ + pSmi->lcd = 1; + } + else /* panel size detection for hardware other than 730 */ + { + pSmi->lcd = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x31) & 0x01; + + if (VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x30) & 0x01) + { + pSmi->lcd <<= 1; + } + switch (VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x30) & 0x0C) + { + case 0x00: + pSmi->lcdWidth = 640; + pSmi->lcdHeight = 480; + break; + + case 0x04: + pSmi->lcdWidth = 800; + pSmi->lcdHeight = 600; + break; + + case 0x08: + if (VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x74) & 0x02) + { + pSmi->lcdWidth = 1024; + pSmi->lcdHeight = 600; + } + else + { + pSmi->lcdWidth = 1024; + pSmi->lcdHeight = 768; + } + break; + + case 0x0C: + pSmi->lcdWidth = 1280; + pSmi->lcdHeight = 1024; + break; + } } + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s Panel Size = %dx%d\n", (pSmi->lcd == 0) ? "OFF" : (pSmi->lcd == 1) ? "TFT" : "DSTN", pSmi->lcdWidth, pSmi->lcdHeight); @@ -2093,7 +2213,7 @@ numLines = maxLines; } else { /* CZ 3.11.2001: What does the following code? see also smi_video.c aaa line 1226 */ -/*#if defined(XvExtension) && SMI_USE_VIDEO */ +/*#if SMI_USE_VIDEO */ #if 0 numLines = ((pSmi->FBReserved - pSmi->width * pSmi->Bpp * pSmi->height) * 25 / 100 + pSmi->width @@ -2147,7 +2267,16 @@ if (pSmi->shadowFB) { - RefreshAreaFuncPtr refreshArea = SMI_RefreshArea; + RefreshAreaFuncPtr refreshArea; + + if (pSmi->Chipset == SMI_COUGAR3DR) + { + refreshArea = SMI_RefreshArea730; + } + else + { + refreshArea = SMI_RefreshArea; + } if (pSmi->rotate) { @@ -2251,10 +2380,17 @@ pSmi->FBReserved -= pSmi->saveBufferSize; pSmi->FBReserved &= ~0x15; WRITE_VPR(pSmi, 0x0C, (pSmi->FBOffset = pSmi->FBReserved) >> 3); + if(pSmi->Chipset == SMI_COUGAR3DR) + { + WRITE_FPR(pSmi, FPR0C, (pSmi->FBOffset = pSmi->FBReserved) >> 3); + } - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Shadow: width=%d height=%d " - "offset=0x%08X pitch=0x%08X\n", pSmi->ShadowWidth, - pSmi->ShadowHeight, pSmi->FBOffset, pSmi->ShadowPitch); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Shadow: width=%d height=%d " + "offset=0x%08lX pitch=0x%08X\n", + pSmi->ShadowWidth, pSmi->ShadowHeight, + (unsigned long)pSmi->FBOffset, + pSmi->ShadowPitch); } else { @@ -2435,14 +2571,18 @@ outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x21); new->SR21 = inb(pSmi->PIOBase + VGA_SEQ_DATA) & ~0x03; - outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x31); - new->SR31 = inb(pSmi->PIOBase + VGA_SEQ_DATA) & ~0xC0; - - outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x32); - new->SR32 = inb(pSmi->PIOBase + VGA_SEQ_DATA) & ~0x07; - if (SMI_LYNXM_SERIES(pSmi->Chipset)) + if (pSmi->Chipset != SMI_COUGAR3DR) { - new->SR32 |= 0x04; + outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x31); + new->SR31 = inb(pSmi->PIOBase + VGA_SEQ_DATA) & ~0xC0; + + outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x32); + new->SR32 = inb(pSmi->PIOBase + VGA_SEQ_DATA) & ~0x07; + + if (SMI_LYNXM_SERIES(pSmi->Chipset)) + { + new->SR32 |= 0x04; + } } new->SRA0 = new->CR33 = new->CR3A = 0x00; @@ -2547,7 +2687,7 @@ /* CZ 2.11.2001: for gamma correction (TODO: other chipsets?) */ new->CCR66 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x66); - if (pSmi->Chipset == SMI_LYNX3DM) { + if ((pSmi->Chipset == SMI_LYNX3DM) || (pSmi->Chipset == SMI_COUGAR3DR)){ switch (pScrn->bitsPerPixel) { case 8: new->CCR66 = (new->CCR66 & 0xF3) | 0x00; /* 6 bits-RAM */ @@ -2566,15 +2706,18 @@ } } - outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x30); - if (inb(pSmi->PIOBase + VGA_SEQ_DATA) & 0x01) + if (pSmi->Chipset != SMI_COUGAR3DR) { - new->SR21 = 0x00; + outb(pSmi->PIOBase + VGA_SEQ_INDEX, 0x30); + if (inb(pSmi->PIOBase + VGA_SEQ_DATA) & 0x01) + { + new->SR21 = 0x00; + } } if (pSmi->MCLK > 0) { - SMI_CommonCalcClock(pScrn->scrnIndex,pSmi->MCLK, + SMI_CommonCalcClock(pScrn->scrnIndex, pSmi->MCLK, 1, 1, 31, 0, 2, pSmi->minClock, pSmi->maxClock, &new->SR6A, &new->SR6B); } @@ -2653,37 +2796,44 @@ new->DPR40 = 0; new->DPR44 = 0; - /* Set VPR registers */ + /* Set VPR registers (and FPR registers for SM731) */ switch (pScrn->bitsPerPixel) { case 8: new->VPR00 = 0x00000000; + new->FPR00_= 0x00080000; break; case 16: new->VPR00 = 0x00020000; + new->FPR00_= 0x000A0000; break; case 24: new->VPR00 = 0x00040000; + new->FPR00_= 0x000C0000; break; case 32: new->VPR00 = 0x00030000; + new->FPR00_= 0x000B0000; break; } new->VPR0C = pSmi->FBOffset >> 3; if (pSmi->rotate) { - new->VPR10 = ((((min(pSmi->lcdWidth, pSmi->height) * pSmi->Bpp) >> 3) + new->VPR10 = (((( pSmi->height * pSmi->Bpp) >> 3) + 2) << 16) | ((pSmi->height * pSmi->Bpp) >> 3); } else { - new->VPR10 = ((((min(pSmi->lcdWidth, pSmi->width) * pSmi->Bpp) >> 3) + new->VPR10 = ((((pSmi->width * pSmi->Bpp) >> 3) + 2) << 16) | ((pSmi->width * pSmi->Bpp) >> 3); } + new->FPR0C_ = new->VPR0C; + new->FPR10_ = new->VPR10; + /* Set CPR registers */ new->CPR00 = 0x00000000; @@ -2786,7 +2936,6 @@ xf86FreeInt10(pSmi->pInt10); pSmi->pInt10 = NULL; } -#ifdef XvExtension if (pSmi->ptrAdaptor != NULL) { xfree(pSmi->ptrAdaptor); @@ -2795,13 +2944,6 @@ { pScreen->BlockHandler = pSmi->BlockHandler; } -#endif - if (pSmi->I2C != NULL) - { - xf86DestroyI2CBusRec(pSmi->I2C, FALSE, TRUE); - xfree(pSmi->I2C); - pSmi->I2C = NULL; - } /* #670 */ if (pSmi->pSaveBuffer) { @@ -2855,7 +2997,7 @@ } Base = pSmi->FBOffset + (x + y * pScrn->virtualX) * pSmi->Bpp; - if (SMI_LYNX3D_SERIES(pSmi->Chipset)) + if (SMI_LYNX3D_SERIES(pSmi->Chipset) || SMI_COUGAR_SERIES(pSmi->Chipset)) { Base = (Base + 15) & ~15; #if 1 /* PDR#1058 */ @@ -2877,6 +3019,10 @@ } WRITE_VPR(pSmi, 0x0C, Base >> 3); + if(pSmi->Chipset == SMI_COUGAR3DR) + { + WRITE_FPR(pSmi, FPR0C, Base >> 3); + } LEAVE_PROC("SMI_AdjustFrame"); } @@ -2903,6 +3049,16 @@ ENTER_PROC("SMI_LoadPalette"); + /* Enable both the CRT and LCD DAC RAM paths, so both palettes are updated */ + if ((pSmi->Chipset == SMI_LYNX3DM) || (pSmi->Chipset == SMI_COUGAR3DR)) + { + CARD8 ccr66; + + ccr66 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x66); + ccr66 &= 0x0f; + VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x66, ccr66); + } + for(i = 0; i < numColors; i++) { DEBUG((VERBLEV, "pal[%d] = %d %d %d\n", indicies[i], @@ -2992,7 +3148,7 @@ static void SMI_PrintRegs(ScrnInfoPtr pScrn) { - unsigned char i, tmp; + unsigned char i; vgaHWPtr hwp = VGAHWPTR(pScrn); SMIPtr pSmi = SMIPTR(pScrn); int vgaCRIndex = hwp->IOBase + VGA_CRTC_INDEX_OFFSET; @@ -3041,34 +3197,34 @@ " x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF"); for (i = 0x00; i <= 0x14; i++) { - tmp = VGAIN8(pSmi, vgaStatus); + (void) VGAIN8(pSmi, vgaStatus); if ((i & 0xF) == 0x0) xf86ErrorFVerb(VERBLEV, "\n%02X|", i); if ((i & 0x3) == 0x0) xf86ErrorFVerb(VERBLEV, " "); xf86ErrorFVerb(VERBLEV, "%02X ", VGAIN8_INDEX(pSmi, VGA_ATTR_INDEX, VGA_ATTR_DATA_R, i)); } - tmp = VGAIN8(pSmi, vgaStatus); + (void) VGAIN8(pSmi, vgaStatus); VGAOUT8(pSmi, VGA_ATTR_INDEX, 0x20); xf86ErrorFVerb(VERBLEV, "\n\nDPR x0 x4 x8 xC"); for (i = 0x00; i <= 0x44; i += 4) { if ((i & 0xF) == 0x0) xf86ErrorFVerb(VERBLEV, "\n%02X|", i); - xf86ErrorFVerb(VERBLEV, " %08X", READ_DPR(pSmi, i)); + xf86ErrorFVerb(VERBLEV, " %08lX", (unsigned long)READ_DPR(pSmi, i)); } xf86ErrorFVerb(VERBLEV, "\n\nVPR x0 x4 x8 xC"); for (i = 0x00; i <= 0x60; i += 4) { if ((i & 0xF) == 0x0) xf86ErrorFVerb(VERBLEV, "\n%02X|", i); - xf86ErrorFVerb(VERBLEV, " %08X", READ_VPR(pSmi, i)); + xf86ErrorFVerb(VERBLEV, " %08lX", (unsigned long)READ_VPR(pSmi, i)); } xf86ErrorFVerb(VERBLEV, "\n\nCPR x0 x4 x8 xC"); for (i = 0x00; i <= 0x18; i += 4) { if ((i & 0xF) == 0x0) xf86ErrorFVerb(VERBLEV, "\n%02X|", i); - xf86ErrorFVerb(VERBLEV, " %08X", READ_CPR(pSmi, i)); + xf86ErrorFVerb(VERBLEV, " %08lX", (unsigned long)READ_CPR(pSmi, i)); } xf86ErrorFVerb(VERBLEV, "\n\n"); Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_hwcurs.c diff -u xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_hwcurs.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_hwcurs.c:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_hwcurs.c:1.2 Sat Mar 3 17:26:13 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_hwcurs.c Wed Oct 8 07:13:01 2003 @@ -26,7 +26,7 @@ sale, use or other dealings in this Software without prior written authorization from the XFree86 Project and Silicon Motion. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_hwcurs.c,v 1.2 2001/03/03 22:26:13 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_hwcurs.c,v 1.3 2003/10/08 11:13:01 eich Exp $ */ #include "cursorstr.h" #include "smi.h" @@ -211,6 +211,17 @@ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81, tmp | ((pSmi->FBCursorOffset / 2048) >> 8)); + /* Program FPR copy when on the 730 */ + if (pSmi->Chipset == SMI_COUGAR3DR) + { + CARD32 fpr15c; + + /* put address in upper word, and disable the cursor */ + fpr15c = READ_FPR(pSmi, FPR15C) & FPR15C_MASK_HWCCOLORS; + fpr15c |= (pSmi->FBCursorOffset / 2048) << 16; + WRITE_FPR(pSmi, FPR15C, fpr15c); + } + /* Copy cursor image to framebuffer storage */ memcpy(pSmi->FBBase + pSmi->FBCursorOffset, src, 1024); @@ -229,6 +240,17 @@ tmp = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81); VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81, tmp | 0x80); + /* Program FPR copy when on the 730 */ + if (pSmi->Chipset == SMI_COUGAR3DR) + { + CARD32 fpr15c; + + /* turn on the top bit */ + fpr15c = READ_FPR(pSmi, FPR15C); + fpr15c |= FPR15C_MASK_HWCENABLE; + WRITE_FPR(pSmi, FPR15C, fpr15c); + } + LEAVE_PROC("SMI_ShowCursor"); } @@ -244,6 +266,17 @@ tmp = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81); VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81, tmp & ~0x80); + /* Program FPR copy when on the 730 */ + if (pSmi->Chipset == SMI_COUGAR3DR) + { + CARD32 fpr15c; + + /* turn off the top bit */ + fpr15c = READ_FPR(pSmi, FPR15C); + fpr15c &= ~FPR15C_MASK_HWCENABLE; + WRITE_FPR(pSmi, FPR15C, fpr15c); + } + LEAVE_PROC("SMI_HideCursor"); } @@ -301,6 +334,34 @@ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x8B, 0x08); } + /* Program FPR copy when on the 730 */ + if (pSmi->Chipset == SMI_COUGAR3DR) + { + CARD32 fpr158; + + if (xoff >= 0) + { + fpr158 = (xoff & FPR158_MASK_MAXBITS)<<16; + } + else + { + fpr158 = (((-xoff) & FPR158_MASK_MAXBITS) | FPR158_MASK_BOUNDARY)<<16; + } + + if (yoff >= 0) + { + fpr158 |= (yoff & FPR158_MASK_MAXBITS); + } + else + { + fpr158 |= (((-yoff) & FPR158_MASK_MAXBITS) | FPR158_MASK_BOUNDARY); + } + + /* Program combined coordinates */ + WRITE_FPR(pSmi, FPR158, fpr158); + + } + LEAVE_PROC("SMI_SetCursorPosition"); } @@ -326,6 +387,17 @@ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x8C, packedFG); VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x8D, packedBG); + /* Program FPR copy when on the 730 */ + if (pSmi->Chipset == SMI_COUGAR3DR) + { + CARD32 fpr15c; + + fpr15c = READ_FPR(pSmi, FPR15C) & FPR15C_MASK_HWCADDREN; + fpr15c |= packedFG; + fpr15c |= packedBG<<8; + WRITE_FPR(pSmi, FPR15C, fpr15c); + } + LEAVE_PROC("SMI_SetCursorColors"); } Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_shadow.c diff -u xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_shadow.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_shadow.c:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_shadow.c:1.2 Tue Dec 5 16:18:37 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_shadow.c Wed Oct 8 07:13:01 2003 @@ -26,7 +26,7 @@ sale, use or other dealings in this Software without prior written authorization from the XFree86 Project and Silicon Motion. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_shadow.c,v 1.2 2000/12/05 21:18:37 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_shadow.c,v 1.3 2003/10/08 11:13:01 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -181,6 +181,162 @@ LEAVE_PROC("SMI_RefreshArea"); } +/* Custom version for the 730 series (Cougar3DR). + This chipset has problems with large rotate-blts. */ + +void SMI_RefreshArea730(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +{ + SMIPtr pSmi = SMIPTR(pScrn); + int width, height, srcX, srcY, destX, destY; + int maxPixels, tempWidth; + + ENTER_PROC("SMI_RefreshArea730"); + + /* #671 */ + if (pSmi->polyLines) + { + pSmi->polyLines = FALSE; + return; + } + + if (pSmi->rotate) + { + /* IF we need to do rotation, setup the hardware here. */ + WaitIdleEmpty(); + WRITE_DPR(pSmi, 0x10, pSmi->ShadowPitch); + WRITE_DPR(pSmi, 0x3C, pSmi->ShadowPitch); + WRITE_DPR(pSmi, 0x44, pSmi->FBOffset >> 3); + } + + /* #672 */ + if (pSmi->ClipTurnedOn) + { + WaitQueue(1); + WRITE_DPR(pSmi, 0x2C, pSmi->ScissorsLeft); + pSmi->ClipTurnedOn = FALSE; + } + + /* SM731 cannot rotate-blt more than a certain number of pixels + (based on a calculation from the Windows driver source */ + maxPixels = 1280 / pScrn->bitsPerPixel; + + while (num--) + { + /* Get coordinates of the box to refresh. */ + srcX = pbox->x1; + srcY = pbox->y1; + width = pbox->x2 - srcX; + height = pbox->y2 - srcY; + + DEBUG((VERBLEV, "x=%d y=%d w=%d h=%d\n", srcX, srcY, width, height)); + + if ((width > 0) && (height > 0)) + { + switch (pSmi->rotate) + { + case SMI_ROTATE_CW: + /* 90 degrees CW rotation. Calculate destination + coordinates: + + *---+ + | | +-----* + | | | | destX = shadowHeight - srcY - 1 + | | --> | | destY = srcX + | | | | + | | +-----+ + +---+ + */ + destX = pSmi->ShadowHeight - srcY - 1; + destY = srcX; + + for (tempWidth=width; tempWidth>0;) + { + if (width>maxPixels) + width = maxPixels; + WaitQueue(4); + WRITE_DPR(pSmi, 0x00, (srcX << 16) + srcY); + WRITE_DPR(pSmi, 0x04, (destX << 16) + destY); + WRITE_DPR(pSmi, 0x08, (width << 16) + height); + WRITE_DPR(pSmi, 0x0C, 0xCC | SMI_ROTATE_BLT | + SMI_ROTATE_CW | SMI_START_ENGINE); + destY += maxPixels; + srcX += maxPixels; + tempWidth -= maxPixels; + width = tempWidth; + } + + break; + + case SMI_ROTATE_CCW: + /* 90 degrees CCW rotatation. Calculate destination + coordinates: + + *---+ + | | +-----+ + | | | | destX = srcY + | | --> | | destY = shadowWidth - srcX - 1 + | | | | + | | *-----+ + +---+ + */ + destX = srcY; + destY = pSmi->ShadowWidth - srcX - 1; + + for (tempWidth=width; tempWidth>0;) + { + if (width>maxPixels) + width = maxPixels; + WaitQueue(4); + WRITE_DPR(pSmi, 0x00, (srcX << 16) + srcY); + WRITE_DPR(pSmi, 0x04, (destX << 16) + destY); + WRITE_DPR(pSmi, 0x08, (width << 16) + height); + WRITE_DPR(pSmi, 0x0C, 0xCC | SMI_ROTATE_BLT | + SMI_ROTATE_CCW | SMI_START_ENGINE); + destY -= maxPixels; + srcX += maxPixels; + tempWidth -= maxPixels; + width = tempWidth; + } + + break; + + default: + /* No rotation, perform a normal copy. */ + if (pScrn->bitsPerPixel == 24) + { + srcX *= 3; + width *= 3; + + if (pSmi->Chipset == SMI_LYNX) + { + srcY *= 3; + } + } + + WaitQueue(4); + WRITE_DPR(pSmi, 0x00, (srcX << 16) + srcY); + WRITE_DPR(pSmi, 0x04, (srcX << 16) + srcY); + WRITE_DPR(pSmi, 0x08, (width << 16) + height); + WRITE_DPR(pSmi, 0x0C, SMI_BITBLT + SMI_START_ENGINE + 0xCC); + break; + } + } + + pbox++; + } + + if (pSmi->rotate) + { + /* If we did a rotation, we need to restore the hardware state here. */ + WaitIdleEmpty(); + WRITE_DPR(pSmi, 0x10, (pSmi->Stride << 16) | pSmi->Stride); + WRITE_DPR(pSmi, 0x3C, (pSmi->Stride << 16) | pSmi->Stride); + WRITE_DPR(pSmi, 0x44, 0); + } + + LEAVE_PROC("SMI_RefreshArea730"); +} + /******************************************************************************\ |* SMI_PointerMoved |*============================================================================= Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c diff -u xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c:1.9 xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c:1.14 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c:1.9 Sat Jan 11 22:55:49 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c Mon Dec 8 11:03:58 2003 @@ -34,14 +34,14 @@ XV_SATURATION, XV_HUE, XV_COLORKEY, XV_INTERLACED XV_CAPTURE_BRIGHTNESS can be used to set brightness in the capture device - bug fixes -- tries not to use acceleration functions (if USE_XAA = 0) +- tries not to use acceleration functions - interlaced video for double vertical resolution Author of changes: Corvin Zahn Date: 2.11.2001 */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c,v 1.9 2003/01/12 03:55:49 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c,v 1.14 2003/12/08 16:03:58 alanh Exp $ */ #include "smi.h" #include "smi_video.h" @@ -79,20 +79,8 @@ #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) -#if defined(XvExtension) && SMI_USE_VIDEO - -/* USE_XAA = 1: use XAA functions for color key rectangle fill, - USE_XAA = 0: use xf86XVFillKeyHelper for color key rectangle fill, - needs common/xf86xv.c >= 1.30, - common/xf86xv.h >= 1.22, - loader/xf86sym.c >= 1.194 */ -#define USE_XAA 1 - +#if SMI_USE_VIDEO #include "dixstruct.h" -#if USE_XAA -#include "xaa.h" -#include "xaalocal.h" -#endif static int SMI_AddEncoding(XF86VideoEncodingPtr enc, int i, @@ -125,13 +113,15 @@ int id, unsigned short *width, unsigned short *height, int *picthes, int *offsets); -static Bool RegionsEqual(RegionPtr A, RegionPtr B); static Bool SMI_ClipVideo(ScrnInfoPtr pScrn, BoxPtr dst, INT32 *x1, INT32 *y1, INT32 *x2, INT32 *y2, RegionPtr reg, INT32 width, INT32 height); static void SMI_DisplayVideo(ScrnInfoPtr pScrn, int id, int offset, short width, short height, int pitch, int x1, int y1, int x2, int y2, BoxPtr dstBox, short vid_w, short vid_h, short drw_w, short drw_h); +static void SMI_DisplayVideo0730(ScrnInfoPtr pScrn, int id, int offset, + short width, short height, int pitch, int x1, int y1, int x2, int y2, + BoxPtr dstBox, short vid_w, short vid_h, short drw_w, short drw_h); static void SMI_BlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadMask); #if 0 @@ -143,11 +133,6 @@ static void SMI_InitOffscreenImages(ScreenPtr pScreen); static FBAreaPtr SMI_AllocateMemory(ScrnInfoPtr pScrn, FBAreaPtr area, int numLines); -static void SMI_CopyData(unsigned char *src, unsigned char *dst, int srcPitch, - int dstPitch, int height, int width); -static void SMI_CopyYV12Data(unsigned char *src1, unsigned char *src2, - unsigned char *src3, unsigned char *dst, int srcPitch1, int srcPitch2, - int dstPitch, int height, int width); static int SMI_AllocSurface(ScrnInfoPtr pScrn, int id, unsigned short width, unsigned short height, @@ -164,7 +149,11 @@ static int SetAttr(ScrnInfoPtr pScrn, int i, int value); static int SetAttrSAA7110(ScrnInfoPtr pScrn, int i, int value); static int SetAttrSAA7111(ScrnInfoPtr pScrn, int i, int value); +static void SetKeyReg(SMIPtr pSmi, int reg, int value); +#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,3,99,0,0) +static Bool RegionsEqual(RegionPtr A, RegionPtr B); +#endif /** * Atoms */ @@ -277,7 +266,7 @@ {XvSettable | XvGettable, 0, 1, XV_INTERLACED_NAME}, }; -static XF86AttributeRec SMI_VideoAttributes[N_ATTRS] = { +static XF86AttributeRec SMI_VideoAttributes[2] = { {XvSettable | XvGettable, 0, 255, XV_BRIGHTNESS_NAME}, {XvSettable | XvGettable, 0x000000, 0xFFFFFF, XV_COLORKEY_NAME}, }; @@ -470,6 +459,55 @@ /**************************************************************************/ +/* To allow this ddx to work on 4_3_0 and above, we need to include this */ +#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,3,99,0,0) +static Bool +RegionsEqual( + RegionPtr A, + RegionPtr B +) +{ + int *dataA, *dataB; + int num; + + ENTER_PROC("RegionsEqual"); + + num = REGION_NUM_RECTS(A); + if (num != REGION_NUM_RECTS(B)) + { + LEAVE_PROC("RegionsEqual"); + return(FALSE); + } + + if ( (A->extents.x1 != B->extents.x1) + || (A->extents.y1 != B->extents.y1) + || (A->extents.x2 != B->extents.x2) + || (A->extents.y2 != B->extents.y2) + ) + { + LEAVE_PROC("RegionsEqual"); + return(FALSE); + } + + dataA = (int*) REGION_RECTS(A); + dataB = (int*) REGION_RECTS(B); + + while (num--) + { + if ((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) + { + return(FALSE); + } + dataA += 2; + dataB += 2; + } + + LEAVE_PROC("RegionsEqual"); + return(TRUE); +} +#endif + + /** * generates XF86VideoEncoding[i] with video norm norm, video input format * input and video input channel channel @@ -673,7 +711,7 @@ if (i == XV_BRIGHTNESS) { int my_value = (value <= 128? value + 128 : value - 128); - WRITE_VPR(pSmi, 0x5C, 0xEDEDED | (my_value << 24)); + SetKeyReg(pSmi, 0x5C, 0xEDEDED | (my_value << 24)); } else if (pPort->I2CDev.SlaveAddr == SAA7110) { return SetAttrSAA7110(pScrn, i, value); } @@ -863,7 +901,10 @@ ptrAdaptor->pImages = SMI_VideoImages; #if SMI_USE_CAPTURE - ptrAdaptor->PutVideo = SMI_PutVideo; + if (pSmi->Chipset == SMI_COUGAR3DR) + ptrAdaptor->PutVideo = NULL; + else + ptrAdaptor->PutVideo = SMI_PutVideo; ptrAdaptor->PutStill = NULL; ptrAdaptor->GetVideo = NULL; ptrAdaptor->GetStill = NULL; @@ -919,7 +960,11 @@ } else smiPortPtr->I2CDev.SlaveAddr = 0; +#if defined(REGION_NULL) + REGION_NULL(pScreen, &smiPortPtr->clip); +#else REGION_INIT(pScreen, &smiPortPtr->clip, NullBox, 0); +#endif pSmi->ptrAdaptor = ptrAdaptor; pSmi->BlockHandler = pScreen->BlockHandler; @@ -956,26 +1001,26 @@ switch (pScrn->depth) { case 8: - WRITE_VPR(pSmi, 0x04, pPort->Attribute[XV_COLORKEY] & 0x00FF); - WRITE_VPR(pSmi, 0x08, 0); + SetKeyReg(pSmi, FPR04, pPort->Attribute[XV_COLORKEY] & 0x00FF); + SetKeyReg(pSmi, FPR08, 0); break; case 15: case 16: - WRITE_VPR(pSmi, 0x04, pPort->Attribute[XV_COLORKEY] & 0xFFFF); - WRITE_VPR(pSmi, 0x08, 0); + SetKeyReg(pSmi, FPR04, pPort->Attribute[XV_COLORKEY] & 0xFFFF); + SetKeyReg(pSmi, FPR08, 0); break; default: r = (pPort->Attribute[XV_COLORKEY] & pScrn->mask.red) >> pScrn->offset.red; g = (pPort->Attribute[XV_COLORKEY] & pScrn->mask.green) >> pScrn->offset.green; b = (pPort->Attribute[XV_COLORKEY] & pScrn->mask.blue) >> pScrn->offset.blue; - WRITE_VPR(pSmi, 0x04, ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3)); - WRITE_VPR(pSmi, 0x08, 0); + SetKeyReg(pSmi, FPR04, ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3)); + SetKeyReg(pSmi, FPR08, 0); break; } - WRITE_VPR(pSmi, 0x5C, 0xEDEDED | (pPort->Attribute[XV_BRIGHTNESS] << 24)); + SetKeyReg(pSmi, FPR5C, 0xEDEDED | (pPort->Attribute[XV_BRIGHTNESS] << 24)); LEAVE_PROC("SMI_ResetVideo"); } @@ -1247,17 +1292,16 @@ vid_address = (pPort->area->box.y1 * fbPitch); DEBUG((VERBLEV, "test RegionsEqual\n")); +#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,3,99,0,0) if (!RegionsEqual(&pPort->clip, clipBoxes)) +#else + if (!REGION_EQUAL(pScrn->pScreen, &pPort->clip, clipBoxes)) +#endif { DEBUG((VERBLEV, "RegionCopy\n")); - REGION_COPY(pScreen, &pPort->clip, clipBoxes); -#if USE_XAA - XAAFillSolidRects(pScrn, pPort->Attribute[XV_COLORKEY], GXcopy, ~0, - REGION_NUM_RECTS(clipBoxes), REGION_RECTS(clipBoxes)); -#else + REGION_COPY(pScrn->pScreen, &pPort->clip, clipBoxes); DEBUG((VERBLEV, "FillKey\n")); xf86XVFillKeyHelper(pScrn->pScreen, pPort->Attribute[XV_COLORKEY], clipBoxes); -#endif } @@ -1353,11 +1397,21 @@ { if (pPort->videoStatus & CLIENT_VIDEO_ON) { - WRITE_VPR(pSmi, 0x00, READ_VPR(pSmi, 0x00) & ~0x01000008); + if (pSmi->Chipset == SMI_COUGAR3DR) + { + WRITE_FPR(pSmi, FPR00, READ_FPR(pSmi, 0x00) & ~(FPR00_VWIENABLE)); + } + else + { + WRITE_VPR(pSmi, 0x00, READ_VPR(pSmi, 0x00) & ~0x01000008); + } #if SMI_USE_CAPTURE - WRITE_CPR(pSmi, 0x00, READ_CPR(pSmi, 0x00) & ~0x00000001); - WRITE_VPR(pSmi, 0x54, READ_VPR(pSmi, 0x54) & ~0x00F00000); -/* #864 OUT_SEQ(pSmi, 0x21, IN_SEQ(pSmi, 0x21) | 0x04); */ + if (pSmi->Chipset != SMI_COUGAR3DR) + { + WRITE_CPR(pSmi, 0x00, READ_CPR(pSmi, 0x00) & ~0x00000001); + WRITE_VPR(pSmi, 0x54, READ_VPR(pSmi, 0x54) & ~0x00F00000); + } + /* #864 OUT_SEQ(pSmi, 0x21, IN_SEQ(pSmi, 0x21) | 0x04); */ #endif } if (pPort->area != NULL) @@ -1402,19 +1456,19 @@ switch (pScrn->depth) { case 8: - WRITE_VPR(pSmi, 0x04, value & 0x00FF); + SetKeyReg(pSmi, FPR04, value & 0x00FF); break; case 15: case 16: - WRITE_VPR(pSmi, 0x04, value & 0xFFFF); + SetKeyReg(pSmi, FPR04, value & 0xFFFF); break; default: r = (value & pScrn->mask.red) >> pScrn->offset.red; g = (value & pScrn->mask.green) >> pScrn->offset.green; b = (value & pScrn->mask.blue) >> pScrn->offset.blue; - WRITE_VPR(pSmi, 0x04, + SetKeyReg(pSmi, FPR04, ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3)); break; } @@ -1631,42 +1685,49 @@ offset = (pPort->area->box.y1 * fbPitch) + (top * dstPitch); dstStart = pSmi->FBBase + offset + left; - switch (id) - { - case FOURCC_YV12: - case FOURCC_I420: - top &= ~1; - tmp = ((top >> 1) * srcPitch2) + (left >> 2); - offset2 += tmp; - offset3 += tmp; - nLines = ((((y2 + 0xFFFF) >> 16) + 1) & ~1) - top; - SMI_CopyYV12Data(buf + (top * srcPitch) + (left >> 1), - buf + offset2, buf + offset3, dstStart, srcPitch, srcPitch2, - dstPitch, nLines, nPixels); - break; - - default: - buf += (top * srcPitch) + left; - nLines = ((y2 + 0xFFFF) >> 16) - top; - SMI_CopyData(buf, dstStart, srcPitch, dstPitch, nLines, - nPixels * bpp); - break; - } + switch(id) { + case FOURCC_YV12: + case FOURCC_I420: + top &= ~1; + tmp = ((top >> 1) * srcPitch2) + (left >> 2); + offset2 += tmp; + offset3 += tmp; + if(id == FOURCC_I420) { + tmp = offset2; + offset2 = offset3; + offset3 = tmp; + } + nLines = ((((y2 + 0xffff) >> 16) + 1) & ~1) - top; + xf86XVCopyYUV12ToPacked(buf + (top * srcPitch) + (left >> 1), + buf + offset2, buf + offset3, dstStart, + srcPitch, srcPitch2, dstPitch, nLines, nPixels); + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + buf += (top * srcPitch) + left; + nLines = ((y2 + 0xffff) >> 16) - top; + xf86XVCopyPacked(buf, dstStart, srcPitch, dstPitch, nLines, nPixels); + break; + } +#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,3,99,0,0) if (!RegionsEqual(&pPort->clip, clipBoxes)) - { - REGION_COPY(pScreen, &pPort->clip, clipBoxes); -#if USE_XAA - XAAFillSolidRects(pScrn, pPort->Attribute[XV_COLORKEY], GXcopy, ~0, - REGION_NUM_RECTS(clipBoxes), REGION_RECTS(clipBoxes)); #else - /*aaa*/ - return(BadAlloc); + if (!REGION_EQUAL(pScrn->pScreen, &pPort->clip, clipBoxes)) #endif + { + REGION_COPY(pScrn->pScreen, &pPort->clip, clipBoxes); + xf86XVFillKeyHelper(pScrn->pScreen, pPort->Attribute[XV_COLORKEY], + clipBoxes); } - SMI_DisplayVideo(pScrn, id, offset, width, height, dstPitch, x1, y1, x2, y2, - &dstBox, src_w, src_h, drw_w, drw_h); + if (pSmi->Chipset != SMI_COUGAR3DR) + SMI_DisplayVideo(pScrn, id, offset, width, height, dstPitch, x1, y1, x2, y2, + &dstBox, src_w, src_h, drw_w, drw_h); + else + SMI_DisplayVideo0730(pScrn, id, offset, width, height, dstPitch, x1, y1, x2, y2, + &dstBox, src_w, src_h, drw_w, drw_h); pPort->videoStatus = CLIENT_VIDEO_ON; LEAVE_PROC("SMI_PutImage"); @@ -1792,51 +1853,6 @@ #endif static Bool -RegionsEqual( - RegionPtr A, - RegionPtr B -) -{ - int *dataA, *dataB; - int num; - - ENTER_PROC("RegionsEqual"); - - num = REGION_NUM_RECTS(A); - if (num != REGION_NUM_RECTS(B)) - { - LEAVE_PROC("RegionsEqual"); - return(FALSE); - } - - if ( (A->extents.x1 != B->extents.x1) - || (A->extents.y1 != B->extents.y1) - || (A->extents.x2 != B->extents.x2) - || (A->extents.y2 != B->extents.y2) - ) - { - LEAVE_PROC("RegionsEqual"); - return(FALSE); - } - - dataA = (int*) REGION_RECTS(A); - dataB = (int*) REGION_RECTS(B); - - while (num--) - { - if ((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) - { - return(FALSE); - } - dataA += 2; - dataB += 2; - } - - LEAVE_PROC("RegionsEqual"); - return(TRUE); -} - -static Bool SMI_ClipVideo( ScrnInfoPtr pScrn, BoxPtr dst, @@ -1849,8 +1865,9 @@ INT32 height ) { + ScreenPtr pScreen = pScrn->pScreen; INT32 vscale, hscale; - BoxPtr extents = REGION_EXTENTS(pScrn, reg); + BoxPtr extents = REGION_EXTENTS(pScreen, reg); int diff; ENTER_PROC("SMI_ClipVideo"); @@ -1945,9 +1962,9 @@ ) { RegionRec clipReg; - REGION_INIT(pScrn, &clipReg, dst, 1); - REGION_INTERSECT(pScrn, reg, reg, &clipReg); - REGION_UNINIT(pScrn, &clipReg); + REGION_INIT(pScreen, &clipReg, dst, 1); + REGION_INTERSECT(pScreen, reg, reg, &clipReg); + REGION_UNINIT(pScreen, &clipReg); } DEBUG((VERBLEV, "ClipVideo(%d): x1=%d y1=%d x2=%d y2=%d\n", __LINE__, *x1 >> 16, *y1 >> 16, *x2 >> 16, *y2 >> 16)); @@ -2041,6 +2058,90 @@ } static void +SMI_DisplayVideo0730( + ScrnInfoPtr pScrn, + int id, + int offset, + short width, + short height, + int pitch, + int x1, + int y1, + int x2, + int y2, + BoxPtr dstBox, + short vid_w, + short vid_h, + short drw_w, + short drw_h +) +{ + SMIPtr pSmi = SMIPTR(pScrn); + CARD32 fpr00; + int hstretch, vstretch; + + ENTER_PROC("SMI_DisplayVideo0730"); + + fpr00 = READ_FPR(pSmi, 0x00) & ~(FPR00_MASKBITS); + + switch (id) + { + case FOURCC_YV12: + case FOURCC_I420: + case FOURCC_YUY2: + fpr00 |= FPR00_FMT_YUV422; + break; + + case FOURCC_RV15: + fpr00 |= FPR00_FMT_15P; + break; + + case FOURCC_RV16: + fpr00 |= FPR00_FMT_16P; + break; + + case FOURCC_RV24: + fpr00 |= FPR00_FMT_24P; + break; + + case FOURCC_RV32: + fpr00 |= FPR00_FMT_32P; + break; + } + + /* the formulas for calculating the stretch values do not match the + documentation, but they're the same as the ddraw driver and they work */ + if (drw_w > vid_w) + { + hstretch = (8192 * vid_w / drw_w); + } + else + { + hstretch = 0; + } + + if (drw_h > vid_h) + { + vstretch = (8192 * vid_h / drw_h); + } + else + { + vstretch = 0; + } + + + WRITE_FPR(pSmi, FPR00, fpr00 | FPR00_VWIENABLE | FPR00_VWIKEYENABLE); + WRITE_FPR(pSmi, FPR14, (dstBox->x1) | (dstBox->y1 << 16)); + WRITE_FPR(pSmi, FPR18, (dstBox->x2) | (dstBox->y2 << 16)); + WRITE_FPR(pSmi, FPR1C, offset >> 3); + WRITE_FPR(pSmi, FPR20, (pitch >> 3) | ((pitch >> 3) << 16)); + WRITE_FPR(pSmi, FPR24, (hstretch & 0xFF00) | ((vstretch & 0xFF00)>>8)); + WRITE_FPR(pSmi, FPR68, ((hstretch & 0x00FF)<<8) | (vstretch & 0x00FF)); + + LEAVE_PROC("SMI_DisplayVideo0730"); +} + +static void SMI_BlockHandler( int i, pointer blockData, @@ -2064,7 +2165,14 @@ { if (pPort->offTime < currentTime.milliseconds) { - WRITE_VPR(pSmi, 0x00, READ_VPR(pSmi, 0x00) & ~0x00000008); + if (pSmi->Chipset == SMI_COUGAR3DR) + { + WRITE_FPR(pSmi, FPR00, READ_FPR(pSmi, 0x00) & ~(FPR00_VWIENABLE)); + } + else + { + WRITE_VPR(pSmi, 0x00, READ_VPR(pSmi, 0x00) & ~0x00000008); + } pPort->videoStatus = FREE_TIMER; pPort->freeTime = currentTime.milliseconds + FREE_DELAY; } @@ -2240,65 +2348,6 @@ return(area); } -static void -SMI_CopyData( - unsigned char *src, - unsigned char *dst, - int srcPitch, - int dstPitch, - int height, - int width -) -{ - ENTER_PROC("SMI_CopyData"); - - while (height-- > 0) - { - memcpy(dst, src, width); - src += srcPitch; - dst += dstPitch; - } - - LEAVE_PROC("SMI_CopyData"); -} - -static void -SMI_CopyYV12Data( - unsigned char *src1, - unsigned char *src2, - unsigned char *src3, - unsigned char *dst, - int srcPitch1, - int srcPitch2, - int dstPitch, - int height, - int width -) -{ - CARD32 *pDst = (CARD32 *) dst; - int i, j; - - ENTER_PROC("SMI_CopyYV12Data"); - - for (j = 0; j < height; j++) - { - for (i =0; i < width; i++) - { - pDst[i] = src1[i << 1] | (src1[(i << 1) + 1] << 16) | - (src3[i] << 8) | (src2[i] << 24); - } - pDst += dstPitch >> 2; - src1 += srcPitch1; - if (j & 1) - { - src2 += srcPitch2; - src3 += srcPitch2; - } - } - - LEAVE_PROC("SMI_CopyYV12Data"); -} - static int SMI_AllocSurface( ScrnInfoPtr pScrn, @@ -2472,23 +2521,28 @@ dstBox.x2 -= surface->pScrn->frameX0; dstBox.y2 -= surface->pScrn->frameY0; -#if USE_XAA - XAAFillSolidRects(surface->pScrn, pPort->Attribute[XV_COLORKEY], GXcopy, ~0, - REGION_NUM_RECTS(clipBoxes), REGION_RECTS(clipBoxes)); -#else - /*aaa*/ - return(BadAlloc); -#endif + xf86XVFillKeyHelper(surface->pScrn->pScreen, + pPort->Attribute[XV_COLORKEY], clipBoxes); - SMI_ResetVideo(surface->pScrn); - SMI_DisplayVideo(surface->pScrn, surface->id, surface->offsets[0], - surface->width, surface->height, surface->pitches[0], x1, y1, x2, - y2, &dstBox, vid_w, vid_h, drw_w, drw_h); + if (pSmi->Chipset != SMI_COUGAR3DR) + { + SMI_ResetVideo(surface->pScrn); + SMI_DisplayVideo(surface->pScrn, surface->id, surface->offsets[0], + surface->width, surface->height, surface->pitches[0], x1, y1, x2, + y2, &dstBox, vid_w, vid_h, drw_w, drw_h); + } + else + { + SMI_ResetVideo(surface->pScrn); + SMI_DisplayVideo0730(surface->pScrn, surface->id, surface->offsets[0], + surface->width, surface->height, surface->pitches[0], x1, y1, x2, + y2, &dstBox, vid_w, vid_h, drw_w, drw_h); + } ptrOffscreen->isOn = TRUE; if (pPort->videoStatus & CLIENT_VIDEO_ON) { - REGION_EMPTY(pScrn->pScreen, &pPort->clip); + REGION_EMPTY(surface->pScrn->pScreen, &pPort->clip); UpdateCurrentTime(); pPort->videoStatus = FREE_TIMER; pPort->freeTime = currentTime.milliseconds + FREE_DELAY; @@ -2510,7 +2564,15 @@ if (ptrOffscreen->isOn) { SMIPtr pSmi = SMIPTR(surface->pScrn); - WRITE_VPR(pSmi, 0x00, READ_VPR(pSmi, 0x00) & ~0x00000008); + if (pSmi->Chipset == SMI_COUGAR3DR) + { + WRITE_FPR(pSmi, FPR00, READ_FPR(pSmi, 0x00) & ~(FPR00_VWIENABLE)); + } + else + { + WRITE_VPR(pSmi, 0x00, READ_VPR(pSmi, 0x00) & ~0x00000008); + } + ptrOffscreen->isOn = FALSE; } @@ -2543,6 +2605,20 @@ return(SMI_SetPortAttribute(pScrn, attr, value, (pointer) pSmi->ptrAdaptor->pPortPrivates[0].ptr)); } -#else /* XvExtension */ + +static void +SetKeyReg(SMIPtr pSmi, int reg, int value) +{ + if (pSmi->Chipset == SMI_COUGAR3DR) + { + WRITE_FPR(pSmi, reg, value); + } + else + { + WRITE_VPR(pSmi, reg, value); + } +} + +#else /* SMI_USE_VIDEO */ void SMI_InitVideo(ScreenPtr pScreen) {} #endif Index: xc/programs/Xserver/hw/xfree86/drivers/sis/300vtbl.h diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/300vtbl.h:1.6 xc/programs/Xserver/hw/xfree86/drivers/sis/300vtbl.h:1.25 --- xc/programs/Xserver/hw/xfree86/drivers/sis/300vtbl.h:1.6 Sun Feb 9 20:14:16 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/300vtbl.h Thu Feb 26 04:16:17 2004 @@ -1,603 +1,240 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/300vtbl.h,v 1.6 2003/02/10 01:14:16 tsi Exp $ */ - - -/* Register settings for SiS 300 series */ - +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/300vtbl.h,v 1.25 2004/02/26 09:16:17 twini Exp $ */ +/* + * Register settings for SiS 300 series + * + * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria + * + * If distributed as part of the Linux kernel, the following license terms + * apply: + * + * * This program is free software; you can redistribute it and/or modify + * * it under the terms of the GNU General Public License as published by + * * the Free Software Foundation; either version 2 of the named License, + * * or any later version. + * * + * * This program is distributed in the hope that it will be useful, + * * but WITHOUT ANY WARRANTY; without even the implied warranty of + * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * * GNU General Public License for more details. + * * + * * You should have received a copy of the GNU General Public License + * * along with this program; if not, write to the Free Software + * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA + * + * Otherwise, the following license terms apply: + * + * * Redistribution and use in source and binary forms, with or without + * * modification, are permitted provided that the following conditions + * * are met: + * * 1) Redistributions of source code must retain the above copyright + * * notice, this list of conditions and the following disclaimer. + * * 2) Redistributions in binary form must reproduce the above copyright + * * notice, this list of conditions and the following disclaimer in the + * * documentation and/or other materials provided with the distribution. + * * 3) The name of the author may not be used to endorse or promote products + * * derived from this software without specific prior written permission. + * * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR + * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Author: Thomas Winischhofer + * + */ + +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[] = +{ + {0x6a,0x2212,0x0102,SIS_RI_800x600, 0x00,0x00,0x00,0x00,0x00}, /* 800x600x? */ + {0x2e,0x0a1b,0x0101,SIS_RI_640x480, 0x00,0x00,0x00,0x00,0x08}, + {0x2f,0x021b,0x0100,SIS_RI_640x400, 0x00,0x00,0x00,0x00,0x10}, /* 640x400x8 */ + {0x30,0x2a1b,0x0103,SIS_RI_800x600, 0x00,0x00,0x00,0x00,0x00}, + {0x31,0x0a1b,0x0000,SIS_RI_720x480, 0x00,0x00,0x00,0x00,0x11}, /* 720x480x8 */ + {0x32,0x2a1b,0x0000,SIS_RI_720x576, 0x00,0x00,0x00,0x00,0x12}, /* 720x576x8 */ + {0x33,0x0a1d,0x0000,SIS_RI_720x480, 0x00,0x00,0x00,0x00,0x11}, /* 720x480x16 */ + {0x34,0x2a1d,0x0000,SIS_RI_720x576, 0x00,0x00,0x00,0x00,0x12}, /* 720x576x16 */ + {0x35,0x0a1f,0x0000,SIS_RI_720x480, 0x00,0x00,0x00,0x00,0x11}, /* 720x480x32 */ + {0x36,0x2a1f,0x0000,SIS_RI_720x576, 0x00,0x00,0x00,0x00,0x12}, /* 720x576x32 */ + {0x37,0x0212,0x0104,SIS_RI_1024x768, 0x00,0x00,0x00,0x00,0x13}, /* 1024x768x? */ + {0x38,0x0a1b,0x0105,SIS_RI_1024x768, 0x00,0x00,0x00,0x00,0x13}, /* 1024x768x8 */ + {0x3a,0x0e3b,0x0107,SIS_RI_1280x1024,0x00,0x00,0x00,0x00,0x1a}, /* 1280x1024x8 */ + {0x3c,0x063b,0x0130,SIS_RI_1600x1200,0x00,0x00,0x00,0x00,0x1e}, + {0x3d,0x067d,0x0131,SIS_RI_1600x1200,0x00,0x00,0x00,0x00,0x1e}, + {0x40,0x921c,0x010d,SIS_RI_320x200, 0x00,0x00,0x00,0x00,0x23}, /* 320x200x15 */ + {0x41,0x921d,0x010e,SIS_RI_320x200, 0x00,0x00,0x00,0x00,0x23}, /* 320x200x16 */ + {0x43,0x0a1c,0x0110,SIS_RI_640x480, 0x00,0x00,0x00,0x00,0x08}, + {0x44,0x0a1d,0x0111,SIS_RI_640x480, 0x00,0x00,0x00,0x00,0x08}, + {0x46,0x2a1c,0x0113,SIS_RI_800x600, 0x00,0x00,0x00,0x00,0x00}, /* 800x600x15 */ + {0x47,0x2a1d,0x0114,SIS_RI_800x600, 0x00,0x00,0x00,0x00,0x00}, /* 800x600x16 */ + {0x49,0x0a3c,0x0116,SIS_RI_1024x768, 0x00,0x00,0x00,0x00,0x13}, + {0x4a,0x0a3d,0x0117,SIS_RI_1024x768, 0x00,0x00,0x00,0x00,0x13}, + {0x4c,0x0e7c,0x0119,SIS_RI_1280x1024,0x00,0x00,0x00,0x00,0x1a}, + {0x4d,0x0e7d,0x011a,SIS_RI_1280x1024,0x00,0x00,0x00,0x00,0x1a}, + {0x50,0x921b,0x0132,SIS_RI_320x240, 0x00,0x00,0x00,0x00,0x24}, /* 320x240x8 */ + {0x51,0xb21b,0x0133,SIS_RI_400x300, 0x00,0x00,0x00,0x00,0x25}, /* 400x300x8 */ + {0x52,0x921b,0x0134,SIS_RI_512x384, 0x00,0x00,0x00,0x00,0x26}, /* 512x384x8 */ + {0x56,0x921d,0x0135,SIS_RI_320x240, 0x00,0x00,0x00,0x00,0x24}, /* 320x240x16 */ + {0x57,0xb21d,0x0136,SIS_RI_400x300, 0x00,0x00,0x00,0x00,0x25}, /* 400x300x16 */ + {0x58,0x921d,0x0137,SIS_RI_512x384, 0x00,0x00,0x00,0x00,0x26}, /* 512x384x16 */ + {0x59,0x921b,0x0138,SIS_RI_320x200, 0x00,0x00,0x00,0x00,0x23}, /* 320x200x8 */ + {0x5c,0x921f,0x0000,SIS_RI_512x384, 0x00,0x00,0x00,0x00,0x26}, /* 512x384x32 */ + {0x5d,0x021d,0x0139,SIS_RI_640x400, 0x00,0x00,0x00,0x00,0x10}, /* 640x400x16 */ + {0x5e,0x021f,0x0000,SIS_RI_640x400, 0x00,0x00,0x00,0x00,0x10}, /* 640x400x32 */ + {0x62,0x0a3f,0x013a,SIS_RI_640x480, 0x00,0x00,0x00,0x00,0x08}, + {0x63,0x2a3f,0x013b,SIS_RI_800x600, 0x00,0x00,0x00,0x00,0x00}, /* 800x600x32 */ + {0x64,0x0a7f,0x013c,SIS_RI_1024x768, 0x00,0x00,0x00,0x00,0x13}, + {0x65,0x0eff,0x013d,SIS_RI_1280x1024,0x00,0x00,0x00,0x00,0x1a}, + {0x66,0x06ff,0x013e,SIS_RI_1600x1200,0x00,0x00,0x00,0x00,0x1e}, + {0x68,0x067b,0x013f,SIS_RI_1920x1440,0x00,0x00,0x00,0x00,0x27}, + {0x69,0x06fd,0x0140,SIS_RI_1920x1440,0x00,0x00,0x00,0x00,0x27}, + {0x6b,0x07ff,0x0000,SIS_RI_1920x1440,0x00,0x00,0x00,0x00,0x27}, + {0x6c,0x067b,0x0000,SIS_RI_2048x1536,0x00,0x00,0x00,0x00,0x28}, /* 2048x1536x8 - not in BIOS! */ + {0x6d,0x06fd,0x0000,SIS_RI_2048x1536,0x00,0x00,0x00,0x00,0x28}, /* 2048x1536x16 - not in BIOS! */ + {0x70,0x2a1b,0x0000,SIS_RI_800x480, 0x00,0x00,0x07,0x00,0x2d}, /* 800x480x8 */ + {0x71,0x0a1b,0x0000,SIS_RI_1024x576, 0x00,0x00,0x00,0x00,0x30}, /* 1024x576x8 */ + {0x74,0x0a1d,0x0000,SIS_RI_1024x576, 0x00,0x00,0x00,0x00,0x30}, /* 1024x576x16 */ + {0x75,0x0e3d,0x0000,SIS_RI_1280x720, 0x00,0x00,0x00,0x00,0x33}, /* 1280x720x16 */ + {0x76,0x2a1f,0x0000,SIS_RI_800x480, 0x00,0x00,0x07,0x00,0x2d}, /* 800x480x32 */ + {0x77,0x0a3f,0x0000,SIS_RI_1024x576, 0x00,0x00,0x00,0x00,0x30}, /* 1024x576x32 */ + {0x78,0x0eff,0x0000,SIS_RI_1280x720, 0x00,0x00,0x00,0x00,0x33}, /* 1280x720x32 */ + {0x79,0x0e3b,0x0000,SIS_RI_1280x720, 0x00,0x00,0x00,0x00,0x33}, /* 1280x720x8 */ + {0x7a,0x2a1d,0x0000,SIS_RI_800x480, 0x00,0x00,0x07,0x00,0x2d}, /* 800x480x16 */ + {0x7c,0x0a3b,0x0000,SIS_RI_1280x960, 0x00,0x00,0x00,0x00,0x29}, /* 1280x960x8 */ + {0x7d,0x0a7d,0x0000,SIS_RI_1280x960, 0x00,0x00,0x00,0x00,0x29}, /* 1280x960x16 */ + {0x7e,0x0aff,0x0000,SIS_RI_1280x960, 0x00,0x00,0x00,0x00,0x29}, /* 1280x960x32 */ + {0x20,0x0a1b,0x0000,SIS_RI_1024x600, 0x00,0x00,0x00,0x00,0x2b}, /* 1024x600 */ + {0x21,0x0a3d,0x0000,SIS_RI_1024x600, 0x00,0x00,0x00,0x00,0x2b}, + {0x22,0x0a7f,0x0000,SIS_RI_1024x600, 0x00,0x00,0x00,0x00,0x2b}, + {0x23,0x0a1b,0x0000,SIS_RI_1152x768, 0x00,0x00,0x00,0x00,0x2c}, /* 1152x768 */ + {0x24,0x0a3d,0x0000,SIS_RI_1152x768, 0x00,0x00,0x00,0x00,0x2c}, + {0x25,0x0a7f,0x0000,SIS_RI_1152x768, 0x00,0x00,0x00,0x00,0x2c}, + {0x29,0x0e1b,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x36}, /* 1152x864 */ + {0x2a,0x0e3d,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x36}, + {0x2b,0x0e7f,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x36}, + {0x39,0x2a1b,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x38}, /* 848x480 */ + {0x3b,0x2a3d,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x38}, + {0x3e,0x2a7f,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x38}, + {0x3f,0x2a1b,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x3a}, /* 856x480 */ + {0x42,0x2a3d,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x3a}, + {0x45,0x2a7f,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x3a}, + {0x48,0x223b,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x3c}, /* 1360x768 */ + {0x4b,0x227d,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x3c}, + {0x4e,0x22ff,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x3c}, + {0x4f,0x921f,0x0000,SIS_RI_320x200, 0x00,0x00,0x00,0x00,0x23}, /* 320x200x32 */ + {0x53,0x921f,0x0000,SIS_RI_320x240, 0x00,0x00,0x00,0x00,0x24}, /* 320x240x32 */ + {0x54,0xb21f,0x0000,SIS_RI_400x300, 0x00,0x00,0x00,0x00,0x25}, /* 400x300x32 */ + {0x55,0x2e3b,0x0000,SIS_RI_1280x768, 0x00,0x00,0x00,0x00,0x3d}, /* 1280x768 */ + {0x5a,0x2e7d,0x0000,SIS_RI_1280x768, 0x00,0x00,0x00,0x00,0x3d}, + {0x5b,0x2eff,0x0000,SIS_RI_1280x768, 0x00,0x00,0x00,0x00,0x3d}, + {0x5f,0x2a1b,0x0000,SIS_RI_768x576, 0x00,0x00,0x00,0x00,0x3e}, /* 768x576x8 */ + {0x60,0x2a1d,0x0000,SIS_RI_768x576, 0x00,0x00,0x00,0x00,0x3e}, /* 768x576x16 */ + {0x61,0x2a1f,0x0000,SIS_RI_768x576, 0x00,0x00,0x00,0x00,0x3e}, /* 768x576x32 */ + {0x67,0x2e3b,0x0000,SIS_RI_1360x1024,0x00,0x00,0x00,0x00,0x3f}, /* 1360x1024x8 (BARCO) */ + {0x6f,0x2e7d,0x0000,SIS_RI_1360x1024,0x00,0x00,0x00,0x00,0x3f}, /* 1360x1024x16 (BARCO) */ + {0x72,0x2eff,0x0000,SIS_RI_1360x1024,0x00,0x00,0x00,0x00,0x3f}, /* 1360x1024x32 (BARCO) */ + {0xff,0x0000,0xffff,0, 0x00,0x00,0x00,0x00,0x00} +}; -typedef struct _SiS300_StStruct -{ - UCHAR St_ModeID; - USHORT St_ModeFlag; - UCHAR St_StTableIndex; - UCHAR St_CRT2CRTC; - UCHAR St_ResInfo; - UCHAR VB_StTVFlickerIndex; - UCHAR VB_StTVEdgeIndex; - UCHAR VB_StTVYFilterIndex; -} SiS300_StStruct; - -static const SiS300_StStruct SiS300_SModeIDTable[] = -{ - {0x01,0x9208,0x01,0x00,0x00,0x00,0x00,0x00}, - {0x01,0x1210,0x14,0x01,0x01,0x00,0x00,0x00}, - {0x01,0x1010,0x17,0x02,0x02,0x00,0x00,0x00}, - {0x03,0x8208,0x03,0x00,0x00,0x00,0x00,0x00}, - {0x03,0x0210,0x16,0x01,0x01,0x00,0x00,0x00}, - {0x03,0x0010,0x18,0x02,0x02,0x00,0x00,0x00}, - {0x05,0x9209,0x05,0x00,0x00,0x00,0x00,0x00}, - {0x06,0x8209,0x06,0x00,0x00,0x00,0x00,0x00}, - {0x07,0x0000,0x07,0x03,0x03,0x00,0x00,0x00}, - {0x07,0x0000,0x19,0x02,0x02,0x00,0x00,0x00}, - {0x0d,0x920a,0x0d,0x00,0x00,0x00,0x00,0x00}, - {0x0e,0x820a,0x0e,0x00,0x00,0x00,0x00,0x00}, - {0x0f,0x0202,0x11,0x01,0x01,0x00,0x00,0x00}, - {0x10,0x0212,0x12,0x01,0x01,0x00,0x00,0x00}, - {0x11,0x0212,0x1a,0x04,0x04,0x00,0x00,0x00}, - {0x12,0x0212,0x1b,0x04,0x04,0x00,0x00,0x00}, - {0x13,0x021b,0x1c,0x00,0x00,0x00,0x00,0x00}, - {0x12,0x0010,0x18,0x02,0x02,0x00,0x00,0x00}, - {0x12,0x0210,0x18,0x01,0x01,0x00,0x00,0x00}, - {0xff, 0, 0, 0, 0, 0, 0, 0} -}; - -typedef struct _SiS300_StandTableStruct -{ - UCHAR CRT_COLS; - UCHAR ROWS; - UCHAR CHAR_HEIGHT; - USHORT CRT_LEN; - UCHAR SR[4]; - UCHAR MISC; - UCHAR CRTC[0x19]; - UCHAR ATTR[0x14]; - UCHAR GRC[9]; -} SiS300_StandTableStruct; - -static const SiS300_StandTableStruct SiS300_StandTable[] = -{ - {0x28,0x18,0x08,0x0800, /* 0x00 */ - {0x09,0x03,0x00,0x02}, - 0x63, - {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f, - 0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00, - 0x9c,0x8e,0x8f,0x14,0x1f,0x96,0xb9,0xa3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, - 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, - 0x08,0x00,0x0f,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, - 0xff} }, - {0x28,0x18,0x08,0x0800, /* 0x01 */ - {0x09,0x03,0x00,0x02}, - 0x63, - {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f, - 0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00, - 0x9c,0x8e,0x8f,0x14,0x1f,0x96,0xb9,0xa3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, - 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, - 0x08,0x00,0x0f,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, - 0xff} }, - {0x50,0x18,0x08,0x1000, /* 0x02 */ - {0x01,0x03,0x00,0x02}, - 0x63, - {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, - 0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00, - 0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, - 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, - 0x08,0x00,0x0f,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, - 0xff} }, - {0x50,0x18,0x08,0x1000, /* 0x03 */ - {0x01,0x03,0x00,0x02}, - 0x63, - {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, - 0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00, - 0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, - 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, - 0x08,0x00,0x0f,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, - 0xff} }, - {0x28,0x18,0x08,0x4000, /* 0x04 */ - {0x09,0x03,0x00,0x02}, - 0x63, - {0x2d,0x27,0x28,0x90,0x2b,0x80,0xbf,0x1f, - 0x00,0xc1,0x00,0x00,0x00,0x00,0x00,0x00, - 0x9c,0x8e,0x8f,0x14,0x00,0x96,0xb9,0xa2, - 0xff}, - {0x00,0x13,0x15,0x17,0x02,0x04,0x06,0x07, - 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, - 0x01,0x00,0x03,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x30,0x0f,0x00, - 0xff} }, - {0x28,0x18,0x08,0x4000, /* 0x05 */ - {0x09,0x03,0x00,0x02}, - 0x63, - {0x2d,0x27,0x28,0x90,0x2b,0x80,0xbf,0x1f, - 0x00,0xc1,0x00,0x00,0x00,0x00,0x00,0x00, - 0x9c,0x8e,0x8f,0x14,0x00,0x96,0xb9,0xa2, - 0xff}, - {0x00,0x13,0x15,0x17,0x02,0x04,0x06,0x07, - 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, - 0x01,0x00,0x03,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x30,0x0f,0x00, - 0xff} }, - {0x50,0x18,0x08,0x4000, /* 0x06 */ - {0x01,0x01,0x00,0x06}, - 0x63, - {0x5f,0x4f,0x50,0x82,0x54,0x80,0xbf,0x1f, - 0x00,0xc1,0x00,0x00,0x00,0x00,0x00,0x00, - 0x9c,0x8e,0x8f,0x28,0x00,0x96,0xb9,0xc2, - 0xff}, - {0x00,0x17,0x17,0x17,0x17,0x17,0x17,0x17, - 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, - 0x01,0x00,0x01,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x00,0x0d,0x00, - 0xff} }, - {0x50,0x18,0x0e,0x1000, /* 0x07 */ - {0x00,0x03,0x00,0x03}, - 0xa6, - {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, - 0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00, - 0x83,0x85,0x5d,0x28,0x0d,0x63,0xba,0xa3, - 0xff}, - {0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08, - 0x10,0x18,0x18,0x18,0x18,0x18,0x18,0x18, - 0x0e,0x00,0x0f,0x08}, - {0x00,0x00,0x00,0x00,0x00,0x10,0x0a,0x00, - 0xff} }, -/* MDA_DAC*/ - {0x00,0x00,0x00,0x0000, /* 0x08 */ - {0x00,0x00,0x00,0x15}, - 0x15, - {0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, - 0x15,0x15,0x15,0x15,0x15,0x15,0x3f,0x3f, - 0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x00, - 0x00}, - {0x00,0x00,0x00,0x00,0x00,0x15,0x15,0x15, - 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, - 0x15,0x15,0x15,0x15}, - {0x15,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, - 0x3f} }, -/* CGA_DAC*/ - {0x00,0x10,0x04,0x0114, /* 0x09 */ - {0x11,0x09,0x15,0x00}, - 0x10, - {0x04,0x14,0x01,0x11,0x09,0x15,0x2a,0x3a, - 0x2e,0x3e,0x2b,0x3b,0x2f,0x3f,0x2a,0x3a, - 0x2e,0x3e,0x2b,0x3b,0x2f,0x3f,0x00,0x10, - 0x04}, - {0x14,0x01,0x11,0x09,0x15,0x00,0x10,0x04, - 0x14,0x01,0x11,0x09,0x15,0x2a,0x3a,0x2e, - 0x3e,0x2b,0x3b,0x2f}, - {0x3f,0x2a,0x3a,0x2e,0x3e,0x2b,0x3b,0x2f, - 0x3f} }, -/* EGA_DAC*/ - {0x00,0x10,0x04,0x0114, /* 0x0a */ - {0x11,0x05,0x15,0x20}, - 0x30, - {0x24,0x34,0x21,0x31,0x25,0x35,0x08,0x18, - 0x0c,0x1c,0x09,0x19,0x0d,0x1d,0x28,0x38, - 0x2c,0x3c,0x29,0x39,0x2d,0x3d,0x02,0x12, - 0x06}, - {0x16,0x03,0x13,0x07,0x17,0x22,0x32,0x26, - 0x36,0x23,0x33,0x27,0x37,0x0a,0x1a,0x0e, - 0x1e,0x0b,0x1b,0x0f}, - {0x1f,0x2a,0x3a,0x2e,0x3e,0x2b,0x3b,0x2f, - 0x3f} }, -/* VGA_DAC*/ - {0x00,0x10,0x04,0x0114, /* 0x0b */ - {0x11,0x09,0x15,0x2a}, - 0x3a, - {0x2e,0x3e,0x2b,0x3b,0x2f,0x3f,0x00,0x05, - 0x08,0x0b,0x0e,0x11,0x14,0x18,0x1c,0x20, - 0x24,0x28,0x2d,0x32,0x38,0x3f,0x00,0x10, - 0x1f}, - {0x2f,0x3f,0x1f,0x27,0x2f,0x37,0x3f,0x2d, - 0x31,0x36,0x3a,0x3f,0x00,0x07,0x0e,0x15, - 0x1c,0x0e,0x11,0x15}, - {0x18,0x1c,0x14,0x16,0x18,0x1a,0x1c,0x00, - 0x04} }, - {0x08,0x0c,0x10,0x0a08, /* 0x0c */ - {0x0c,0x0e,0x10,0x0b}, - 0x0c, - {0x0d,0x0f,0x10,0x10,0x01,0x08,0x00,0x00, - 0x00,0x00,0x01,0x00,0x02,0x02,0x01,0x00, - 0x04,0x04,0x01,0x00,0x05,0x02,0x05,0x00, - 0x06}, - {0x01,0x06,0x05,0x06,0x00,0x08,0x01,0x08, - 0x00,0x07,0x02,0x07,0x06,0x07,0x00,0x00, - 0x00,0x00,0x00,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00} }, - {0x28,0x18,0x08,0x2000, /* 0x0d */ - {0x09,0x0f,0x00,0x06}, - 0x63, - {0x2d,0x27,0x28,0x90,0x2b,0x80,0xbf,0x1f, - 0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00, - 0x9c,0x8e,0x8f,0x14,0x00,0x96,0xb9,0xe3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, - 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, - 0x01,0x00,0x0f,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f, - 0xff} }, - {0x50,0x18,0x08,0x4000, /* 0x0e */ - {0x01,0x0f,0x00,0x06}, - 0x63, - {0x5f,0x4f,0x50,0x82,0x54,0x80,0xbf,0x1f, - 0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00, - 0x9c,0x8e,0x8f,0x28,0x00,0x96,0xb9,0xe3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, - 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, - 0x01,0x00,0x0f,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f, - 0xff} }, - {0x00,0x00,0x00,0x0000, /* 0x0f */ /* TW: Standtable for VGA modes */ - {0x01,0x0f,0x00,0x0e}, - 0x23, - {0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e, - 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, - 0xea,0x8c,0xdf,0x28,0x40,0xe7,0x04,0xa3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, - 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, - 0x01,0x00,0x00,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0f, - 0xff} }, - {0x4a,0x36,0x00,0x00c0, /* 0x10 */ - {0x00,0x00,0x00,0x00}, - 0x00, - {0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x3a, - 0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x1a,0x00,0x57,0x39,0x00,0xc0, - 0x00}, - {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00} }, - {0x50,0x18,0x0e,0x8000, /* 0x11 */ - {0x01,0x0f,0x00,0x06}, - 0xa2, - {0x5f,0x4f,0x50,0x82,0x54,0x80,0xbf,0x1f, - 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, - 0x83,0x85,0x5d,0x28,0x0f,0x63,0xba,0xe3, - 0xff}, - {0x00,0x08,0x00,0x00,0x18,0x18,0x00,0x00, - 0x00,0x08,0x00,0x00,0x00,0x18,0x00,0x00, - 0x0b,0x00,0x05,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x05, - 0xff} }, - {0x50,0x18,0x0e,0x8000, /* 0x12 */ - {0x01,0x0f,0x00,0x06}, - 0xa3, - {0x5f,0x4f,0x50,0x82,0x54,0x80,0xbf,0x1f, - 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, - 0x83,0x85,0x5d,0x28,0x0f,0x63,0xba,0xe3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, - 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, - 0x01,0x00,0x0f,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f, - 0xff} }, - {0x28,0x18,0x0e,0x0800, /* 0x13 */ - {0x09,0x03,0x00,0x02}, - 0xa3, - {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f, - 0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00, - 0x83,0x85,0x5d,0x14,0x1f,0x63,0xba,0xa3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, - 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, - 0x08,0x00,0x0f,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, - 0xff} }, - {0x28,0x18,0x0e,0x0800, /* 0x14 */ - {0x09,0x03,0x00,0x02}, - 0xa3, - {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f, - 0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00, - 0x83,0x85,0x5d,0x14,0x1f,0x63,0xba,0xa3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, - 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, - 0x08,0x00,0x0f,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, - 0xff} }, - {0x50,0x18,0x0e,0x1000, /* 0x15 */ - {0x01,0x03,0x00,0x02}, - 0xa3, - {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, - 0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00, - 0x83,0x85,0x5d,0x28,0x1f,0x63,0xba,0xa3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, - 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, - 0x08,0x00,0x0f,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, - 0xff} }, - {0x50,0x18,0x0e,0x1000, /* 0x16 */ - {0x01,0x03,0x00,0x02}, - 0xa3, - {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, - 0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00, - 0x83,0x85,0x5d,0x28,0x1f,0x63,0xba,0xa3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, - 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, - 0x08,0x00,0x0f,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, - 0xff} }, - {0x28,0x18,0x10,0x0800, /* 0x17 */ - {0x08,0x03,0x00,0x02}, - 0x67, - {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f, - 0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00, - 0x9c,0x8e,0x8f,0x14,0x1f,0x96,0xb9,0xa3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, - 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, - 0x0c,0x00,0x0f,0x08}, - {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, - 0xff} }, - {0x50,0x18,0x10,0x1000, /* 0x18 */ - {0x00,0x03,0x00,0x02}, - 0x67, - {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, - 0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00, - 0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, - 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, - 0x0c,0x00,0x0f,0x08}, - {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, - 0xff} }, - {0x50,0x18,0x10,0x1000, /* 0x19 */ - {0x00,0x03,0x00,0x02}, - 0x66, - {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, - 0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00, - 0x9c,0x8e,0x8f,0x28,0x0f,0x96,0xb9,0xa3, - 0xff}, - {0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08, - 0x10,0x18,0x18,0x18,0x18,0x18,0x18,0x18, - 0x0e,0x00,0x0f,0x08}, - {0x00,0x00,0x00,0x00,0x00,0x10,0x0a,0x00, - 0xff} }, - {0x50,0x1d,0x10,0xa000, /* 0x1a */ - {0x01,0x0f,0x00,0x06}, - 0xe3, - {0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e, - 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, - 0xea,0x8c,0xdf,0x28,0x00,0xe7,0x04,0xc3, - 0xff}, - {0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, - 0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, - 0x01,0x00,0x0f,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x01, - 0xff} }, - {0x50,0x1d,0x10,0xa000, /* 0x1b */ - {0x01,0x0f,0x00,0x06}, - 0xe3, - {0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e, - 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, - 0xea,0x8c,0xdf,0x28,0x00,0xe7,0x04,0xe3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, - 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, - 0x01,0x00,0x0f,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f, - 0xff} }, - {0x28,0x18,0x08,0x2000, /* 0x1c */ - {0x01,0x0f,0x00,0x0e}, - 0x63, - {0x5f,0x4f,0x50,0x82,0x54,0x80,0xbf,0x1f, - 0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00, - 0x9c,0x8e,0x8f,0x28,0x40,0x96,0xb9,0xa3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, - 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, - 0x41,0x00,0x0f,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0f, - 0xff} } -}; - -typedef struct _SiS300_ExtStruct -{ - UCHAR Ext_ModeID; - USHORT Ext_ModeFlag; - USHORT Ext_ModeInfo; - USHORT Ext_Point; - USHORT Ext_VESAID; - UCHAR Ext_VESAMEMSize; - UCHAR Ext_RESINFO; - UCHAR VB_ExtTVFlickerIndex; - UCHAR VB_ExtTVEdgeIndex; - UCHAR VB_ExtTVYFilterIndex; - UCHAR REFindex; -} SiS300_ExtStruct; - -static const SiS300_ExtStruct SiS300_EModeIDTable[] = -{ - {0x6a,0x2212,0x47,0x3563,0x0102,0x08,0x07,0x00,0x00,0x00,0x00}, /* 800x600x? */ - {0x2e,0x0a1b,0x36,0x3539,0x0101,0x08,0x06,0x00,0x00,0x00,0x08}, - {0x2f,0x021b,0x35,0x3532,0x0100,0x08,0x05,0x00,0x00,0x00,0x10}, /* 640x400x8 */ - {0x30,0x2a1b,0x47,0x3563,0x0103,0x08,0x07,0x00,0x00,0x00,0x00}, - {0x31,0x0a1b,0xad,0x3630,0x0000,0x08,0x0c,0x00,0x00,0x00,0x11}, /* 720x480x8 */ - {0x32,0x2a1b,0xae,0x3637,0x0000,0x08,0x0d,0x00,0x00,0x00,0x12}, /* 720x576x8 */ - {0x33,0x0a1d,0xad,0x3630,0x0000,0x08,0x0c,0x00,0x00,0x00,0x11}, /* 720x480x16 */ - {0x34,0x2a1d,0xae,0x3637,0x0000,0x08,0x0d,0x00,0x00,0x00,0x12}, /* 720x576x16 */ - {0x35,0x0a1f,0xad,0x3630,0x0000,0x08,0x0c,0x00,0x00,0x00,0x11}, /* 720x480x32 */ - {0x36,0x2a1f,0xae,0x3637,0x0000,0x08,0x0d,0x00,0x00,0x00,0x12}, /* 720x576x32 */ - {0x37,0x0212,0x58,0x358d,0x0104,0x08,0x08,0x00,0x00,0x00,0x13}, /* 1024x768x? */ - {0x38,0x0a1b,0x58,0x358d,0x0105,0x08,0x08,0x00,0x00,0x00,0x13}, /* 1024x768x8 */ - {0x3a,0x0e3b,0x69,0x35be,0x0107,0x08,0x09,0x00,0x00,0x00,0x1a}, /* 1280x1024x8 */ - {0x3c,0x063b,0x7a,0x35d4,0x0130,0x08,0x0a,0x00,0x00,0x00,0x1e}, - {0x3d,0x067d,0x7a,0x35d4,0x0131,0x08,0x0a,0x00,0x00,0x00,0x1e}, - {0x40,0x921c,0x00,0x3516,0x010d,0x08,0x00,0x00,0x00,0x00,0x23}, - {0x41,0x921d,0x00,0x3516,0x010e,0x08,0x00,0x00,0x00,0x00,0x23}, - {0x43,0x0a1c,0x36,0x3539,0x0110,0x08,0x06,0x00,0x00,0x00,0x08}, - {0x44,0x0a1d,0x36,0x3539,0x0111,0x08,0x06,0x00,0x00,0x00,0x08}, - {0x46,0x2a1c,0x47,0x3563,0x0113,0x08,0x07,0x00,0x00,0x00,0x00}, /* 800x600 */ - {0x47,0x2a1d,0x47,0x3563,0x0114,0x08,0x07,0x00,0x00,0x00,0x00}, /* 800x600 */ - {0x49,0x0a3c,0x58,0x358d,0x0116,0x08,0x08,0x00,0x00,0x00,0x13}, - {0x4a,0x0a3d,0x58,0x358d,0x0117,0x08,0x08,0x00,0x00,0x00,0x13}, - {0x4c,0x0e7c,0x69,0x35be,0x0119,0x08,0x09,0x00,0x00,0x00,0x1a}, - {0x4d,0x0e7d,0x69,0x35be,0x011a,0x08,0x09,0x00,0x00,0x00,0x1a}, - {0x50,0x921b,0x01,0x351d,0x0132,0x08,0x01,0x00,0x00,0x00,0x24}, - {0x51,0xb21b,0x13,0x3524,0x0133,0x08,0x03,0x00,0x00,0x00,0x25}, /* 400x300 */ - {0x52,0x921b,0x24,0x352b,0x0134,0x08,0x04,0x00,0x00,0x00,0x26}, - {0x56,0x921d,0x01,0x351d,0x0135,0x08,0x01,0x00,0x00,0x00,0x24}, - {0x57,0xb21d,0x13,0x3524,0x0136,0x08,0x03,0x00,0x00,0x00,0x25}, /* 400x300 */ - {0x58,0x921d,0x24,0x352b,0x0137,0x08,0x04,0x00,0x00,0x00,0x26}, - {0x59,0x921b,0x00,0x3516,0x0138,0x08,0x00,0x00,0x00,0x00,0x23}, - {0x5c,0x921f,0x24,0x352b,0x0000,0x08,0x04,0x00,0x00,0x00,0x26}, /* TW: inserted 512x384x32 */ - {0x5d,0x021d,0x35,0x3532,0x0139,0x08,0x05,0x00,0x00,0x00,0x10}, /* 640x400x16 */ - {0x5e,0x021f,0x35,0x3532,0x0000,0x08,0x05,0x00,0x00,0x00,0x10}, /* TW: inserted 640x400x32 */ - {0x62,0x0a3f,0x36,0x3539,0x013a,0x08,0x06,0x00,0x00,0x00,0x08}, - {0x63,0x2a3f,0x47,0x3563,0x013b,0x08,0x07,0x00,0x00,0x00,0x00}, /* 800x600 */ - {0x64,0x0a7f,0x58,0x358d,0x013c,0x08,0x08,0x00,0x00,0x00,0x13}, - {0x65,0x0eff,0x69,0x35be,0x013d,0x08,0x09,0x00,0x00,0x00,0x1a}, - {0x66,0x06ff,0x7a,0x35d4,0x013e,0x08,0x0a,0x00,0x00,0x00,0x1e}, - {0x68,0x067b,0x8b,0x35ef,0x013f,0x08,0x0b,0x00,0x00,0x00,0x27}, - {0x69,0x06fd,0x8b,0x35ef,0x0140,0x08,0x0b,0x00,0x00,0x00,0x27}, - {0x6b,0x07ff,0x8b,0x35ef,0x0000,0x10,0x0b,0x00,0x00,0x00,0x27}, - {0x6c,0x067b,0x9c,0x35f6,0x0000,0x08,0x11,0x00,0x00,0x00,0x28}, /* TW: 2048x1536x8 - not in BIOS! */ - {0x6d,0x06fd,0x9c,0x35f6,0x0000,0x10,0x11,0x00,0x00,0x00,0x28}, /* TW: 2048x1536x16 - not in BIOS! */ - {0x6e,0x0a3b,0x6f,0x35b2,0x0000,0x08,0x0e,0x00,0x00,0x00,0x29}, /* 1280x960x8 */ - {0x6f,0x0a7d,0x6f,0x35b2,0x0000,0x08,0x0e,0x00,0x00,0x00,0x29}, /* 1280x960x16 */ - /* TW: 16:9 modes copied from 310/325 series - not in ANY BIOS */ - {0x70,0x2a1b,0x40,0x3b52,0x0000,0x08,0x12,0x00,0x00,0x07,0x2d}, /* 800x480x8 */ - {0x71,0x0a1b,0x51,0x3b63,0x0000,0x08,0x13,0x00,0x00,0x00,0x30}, /* 1024x576x8 */ - {0x74,0x0a1d,0x51,0x3b63,0x0000,0x08,0x13,0x00,0x00,0x00,0x30}, /* 1024x576x16 */ - {0x75,0x0e3d,0x62,0x3b74,0x0000,0x08,0x14,0x00,0x00,0x00,0x33}, /* 1280x720x16 */ - {0x76,0x2a1f,0x40,0x3b52,0x0000,0x08,0x12,0x00,0x00,0x07,0x2d}, /* 800x480x32 */ - {0x77,0x0a3f,0x51,0x3b63,0x0000,0x08,0x13,0x00,0x00,0x00,0x30}, /* 1024x576x32 */ - {0x78,0x0eff,0x62,0x3b74,0x0000,0x08,0x14,0x00,0x00,0x00,0x33}, /* 1280x720x32 */ - {0x79,0x0e3b,0x62,0x3b74,0x0000,0x08,0x14,0x00,0x00,0x00,0x33}, /* 1280x720x8 */ - {0x7a,0x2a1d,0x40,0x3b52,0x0000,0x08,0x12,0x00,0x00,0x07,0x2d}, /* 800x480x16 */ - /* TW: End of new 16:9 modes */ - {0x7b,0x0aff,0x6f,0x35b2,0x0000,0x08,0x0e,0x00,0x00,0x00,0x29}, /* 1280x960x32 */ - {0x20,0x0a1b,0x54,0x0000,0x0000,0x08,0x0f,0x00,0x00,0x00,0x2b}, /* 1024x600 */ - {0x21,0x0a3d,0x54,0x0000,0x0000,0x08,0x0f,0x00,0x00,0x00,0x2b}, - {0x22,0x0a7f,0x54,0x0000,0x0000,0x08,0x0f,0x00,0x00,0x00,0x2b}, - {0x23,0x0a1b,0xc5,0x0000,0x0000,0x08,0x10,0x00,0x00,0x00,0x2c}, /* 1152x768 */ - {0x24,0x0a3d,0xc5,0x431d,0x0000,0x08,0x10,0x00,0x00,0x00,0x2c}, - {0x25,0x0a7f,0xc5,0x431d,0x0000,0x08,0x10,0x00,0x00,0x00,0x2c}, - {0x29,0x0e1b,0xc5,0x0000,0x0000,0x08,0x15,0x00,0x00,0x00,0x36}, /* TW: NEW 1152x864 - not in BIOS */ - {0x2a,0x0e3d,0xc5,0x0000,0x0000,0x08,0x15,0x00,0x00,0x00,0x36}, - {0x2b,0x0e7f,0xc5,0x0000,0x0000,0x08,0x15,0x00,0x00,0x00,0x36}, - {0x39,0x2a1b,0xd6,0x0000,0x0000,0x08,0x16,0x00,0x00,0x00,0x38}, /* TW: NEW 848x480 - not in BIOS */ - {0x3b,0x2a3d,0xd6,0x0000,0x0000,0x08,0x16,0x00,0x00,0x00,0x38}, - {0x3e,0x2a7f,0xd6,0x0000,0x0000,0x08,0x16,0x00,0x00,0x00,0x38}, - {0x3f,0x2a1b,0xd7,0x0000,0x0000,0x08,0x17,0x00,0x00,0x00,0x3a}, /* TW: NEW 856x480 - not in BIOS */ - {0x42,0x2a3d,0xd7,0x0000,0x0000,0x08,0x17,0x00,0x00,0x00,0x3a}, - {0x45,0x2a7f,0xd7,0x0000,0x0000,0x08,0x17,0x00,0x00,0x00,0x3a}, - {0x48,0x223b,0xe8,0x0000,0x0000,0x08,0x18,0x00,0x00,0x00,0x3c}, /* TW: NEW 1360x768 - not in BIOS */ - {0x4b,0x227d,0xe8,0x0000,0x0000,0x08,0x18,0x00,0x00,0x00,0x3c}, - {0x4e,0x22ff,0xe8,0x0000,0x0000,0x08,0x18,0x00,0x00,0x00,0x3c}, - {0xff,0x0000,0x00,0x0000,0xffff,0x00,0x00,0x00,0x00,0x00,0x00} -}; - -typedef struct _SiS300_Ext2Struct -{ - USHORT Ext_InfoFlag; - UCHAR Ext_CRT1CRTC; /* TW: Index in SiS300_CRT1Table */ - UCHAR Ext_CRTVCLK; /* TW: Index in VCLK array */ - UCHAR Ext_CRT2CRTC; /* TW: Index in LCD Paneltype arrays (&3f) */ - UCHAR ModeID; - USHORT XRes; - USHORT YRes; - USHORT ROM_OFFSET; -} SiS300_Ext2Struct; - -static const SiS300_Ext2Struct SiS300_RefIndex[] = -{ /* TW: Don't ever insert anything here, table is indexed */ - {0x085f,0x0d,0x03,0x05,0x6a, 800, 600,0x3563}, /* 00 */ - {0x0467,0x0e,0x44,0x05,0x6a, 800, 600,0x3568}, /* 01 */ - {0x0067,0x0f,0x07,0x48,0x6a, 800, 600,0x356d}, /* 02 - CRT1CRTC was 0x4f */ - {0x0067,0x10,0x06,0x8b,0x6a, 800, 600,0x3572}, /* 03 */ - {0x0147,0x11,0x08,0x00,0x6a, 800, 600,0x3577}, /* 04 */ - {0x0147,0x12,0x0c,0x00,0x6a, 800, 600,0x357c}, /* 05 */ - {0x0047,0x11,0x4e,0x00,0x6a, 800, 600,0x3581}, /* 06 - CRT1CRTC was 0x51 */ - {0x0047,0x11,0x13,0x00,0x6a, 800, 600,0x3586}, /* 07 */ - {0xc85f,0x05,0x00,0x04,0x2e, 640, 480,0x3539}, /* 08 */ - {0xc067,0x06,0x02,0x04,0x2e, 640, 480,0x353e}, /* 09 */ - {0xc067,0x07,0x02,0x47,0x2e, 640, 480,0x3543}, /* 0a */ - {0xc067,0x08,0x03,0x8a,0x2e, 640, 480,0x3548}, /* 0b */ - {0xc047,0x09,0x05,0x00,0x2e, 640, 480,0x354d}, /* 0c */ - {0xc047,0x0a,0x08,0x00,0x2e, 640, 480,0x3552}, /* 0d */ - {0xc047,0x0b,0x0a,0x00,0x2e, 640, 480,0x3557}, /* 0e */ - {0xc047,0x0c,0x10,0x00,0x2e, 640, 480,0x355c}, /* 0f */ - {0x487f,0x04,0x00,0x00,0x2f, 640, 400,0x3532}, /* 10 */ - {0xc00f,0x31,0x01,0x06,0x31, 720, 480,0x3630}, /* 11 */ - {0x000f,0x32,0x03,0x06,0x32, 720, 576,0x3637}, /* 12 */ - {0x0187,0x15,0x05,0x00,0x37,1024, 768,0x358d}, /* 13 */ - {0xc877,0x16,0x09,0x06,0x37,1024, 768,0x3592}, /* 14 */ - {0xc067,0x17,0x0b,0x49,0x37,1024, 768,0x3597}, /* 15 - CRT1CRTC was 0x97 */ - {0x0267,0x18,0x0d,0x00,0x37,1024, 768,0x359c}, /* 16 */ - {0x0047,0x19,0x11,0x8c,0x37,1024, 768,0x35a1}, /* 17 - CRT1CRTC was 0x59 */ - {0x0047,0x1a,0x52,0x00,0x37,1024, 768,0x35a6}, /* 18 */ - {0x0047,0x1b,0x16,0x00,0x37,1024, 768,0x35ab}, /* 19 - CRT1CRTC was 0x5b */ - {0x0387,0x1c,0x4d,0x00,0x3a,1280,1024,0x35be}, /* 1a - CRT1CRTC was 0x5c */ - {0x0077,0x1d,0x14,0x07,0x3a,1280,1024,0x35c3}, /* 1b */ - {0x0047,0x1e,0x17,0x00,0x3a,1280,1024,0x35c8}, /* 1c */ - {0x0007,0x1f,0x98,0x00,0x3a,1280,1024,0x35cd}, /* 1d */ - {0x0007,0x20,0x59,0x00,0x3c,1600,1200,0x35d4}, /* 1e - CRT1CRTC was 0x60 */ - {0x0007,0x21,0x5a,0x00,0x3c,1600,1200,0x35d9}, /* 1f */ - {0x0007,0x22,0x1b,0x00,0x3c,1600,1200,0x35de}, /* 20 */ - {0x0007,0x23,0x1d,0x00,0x3c,1600,1200,0x35e3}, /* 21 - CRT1CRTC was 0x63 */ - {0x0007,0x24,0x1e,0x00,0x3c,1600,1200,0x35e8}, /* 22 */ - {0x407f,0x00,0x00,0x00,0x40, 320, 200,0x3516}, /* 23 */ - {0xc07f,0x01,0x00,0x04,0x50, 320, 240,0x351d}, /* 24 */ - {0x0077,0x02,0x04,0x05,0x51, 400, 300,0x3524}, /* 25 */ - {0xc877,0x03,0x09,0x06,0x52, 512, 384,0x352b}, /* 26 */ /* was c077 */ - {0x8207,0x25,0x1f,0x00,0x68,1920,1440,0x35ef}, /* 27 */ - {0x0007,0x26,0x20,0x00,0x6c,2048,1536,0x35f6}, /* 28 */ - {0x0027,0x27,0x14,0x08,0x6e,1280, 960,0x35b7}, /* 29 - TW: 1280x960-60 */ - {0x0047,0x45,0x3c,0x08,0x6e,1280, 960,0x35b7}, /* 2a - TW: 1280x960-85 */ - {0xc077,0x33,0x09,0x06,0x20,1024, 600,0x0000}, /* 2b */ - {0xc077,0x34,0x0b,0x06,0x23,1152, 768,0x0000}, /* 2c */ /* VCLK 0x09 */ - {0x0057,0x35,0x27,0x08,0x70, 800, 480,0x3b52}, /* 2d - TW: 16:9 modes */ - {0x0047,0x36,0x37,0x08,0x70, 800, 480,0x3b57}, /* 2e */ - {0x0047,0x37,0x08,0x08,0x70, 800, 480,0x3b5c}, /* 2f */ - {0x0057,0x38,0x09,0x09,0x71,1024, 576,0x3b63}, /* 30 */ - {0x0047,0x39,0x38,0x09,0x71,1024, 576,0x3b68}, /* 31 */ - {0x0047,0x3a,0x11,0x09,0x71,1024, 576,0x3b6d}, /* 32 */ - {0x0057,0x3b,0x39,0x0a,0x75,1280, 720,0x3b74}, /* 33 */ - {0x0047,0x3c,0x3a,0x0a,0x75,1280, 720,0x3b79}, /* 34 */ - {0x0047,0x3d,0x3b,0x0a,0x75,1280, 720,0x3b7e}, /* 35 - TW: END of 16:9 modes */ - {0x0047,0x3e,0x34,0x06,0x29,1152, 864,0x0000}, /* 36 TW: 1152x864-75Hz - Non-BIOS, new */ - {0x0047,0x44,0x3a,0x06,0x29,1152, 864,0x0000}, /* 37 TW: 1152x864-85Hz - Non-BIOS, new */ - {0x00c7,0x3f,0x28,0x00,0x39, 848, 480,0x0000}, /* 38 TW: 848x480-38Hzi - Non-BIOS, new */ - {0xc047,0x40,0x3d,0x00,0x39, 848, 480,0x0000}, /* 39 TW: 848x480-60Hz - Non-BIOS, new */ - {0x00c7,0x41,0x28,0x00,0x3f, 856, 480,0x0000}, /* 3a TW: 856x480-38Hzi - Non-BIOS, new */ - {0xc047,0x42,0x28,0x00,0x3f, 856, 480,0x0000}, /* 3b TW: 856x480-60Hz - Non-BIOS, new */ - {0x0047,0x43,0x3e,0x00,0x48,1360, 768,0x0000}, /* 3c TW: 1360x768-60Hz - Non-BIOS, new */ - {0xffff,0,0,0,0,0,0,0} -}; - -/*add for 300 oem util*/ -typedef struct _SiS_VBModeIDTableStruct -{ - UCHAR ModeID; - UCHAR VB_TVDelayIndex; - UCHAR VB_TVFlickerIndex; - UCHAR VB_TVPhaseIndex; - UCHAR VB_TVYFilterIndex; - UCHAR VB_LCDDelayIndex; - UCHAR _VB_LCDHIndex; - UCHAR _VB_LCDVIndex; -}SiS_VBModeIDTableStruct; +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,0x00,0x6a, 800, 600, 0}, /* 02 - CRT1CRTC was 0x4f */ + {0x0067,0x10,0x06,0x8b,0x00,0x6a, 800, 600, 0}, /* 03 */ + {0x0147,0x11,0x08,0x00,0x00,0x6a, 800, 600, 0}, /* 04 */ + {0x0147,0x12,0x0c,0x00,0x00,0x6a, 800, 600, 0}, /* 05 */ + {0x0047,0x11,0x4e,0x00,0x00,0x6a, 800, 600, 0}, /* 06 - CRT1CRTC was 0x51 */ + {0x0047,0x11,0x13,0x00,0x00,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,0x00,0x2e, 640, 480, 0}, /* 0c */ + {0xc047,0x0a,0x08,0x00,0x00,0x2e, 640, 480, 0}, /* 0d */ + {0xc047,0x0b,0x0a,0x00,0x00,0x2e, 640, 480, 0}, /* 0e */ + {0xc047,0x0c,0x10,0x00,0x00,0x2e, 640, 480, 0}, /* 0f */ + {0x487f,0x04,0x00,0x00,0x00,0x2f, 640, 400, 0}, /* 10 */ + {0xc04f,0x31,0x01,0x06,0x00,0x31, 720, 480, 0}, /* 11 */ + {0x004f,0x32,0x03,0x06,0x00,0x32, 720, 576, 0}, /* 12 */ + {0x0187,0x15,0x05,0x00,0x00,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,0x00,0x37,1024, 768, 0}, /* 17 - CRT1CRTC was 0x59 */ + {0x0047,0x1a,0x52,0x00,0x00,0x37,1024, 768, 0}, /* 18 */ + {0x0007,0x1b,0x16,0x00,0x00,0x37,1024, 768, 0}, /* 19 - CRT1CRTC was 0x5b */ + {0x0387,0x1c,0x4d,0x00,0x00,0x3a,1280,1024, 0}, /* 1a - CRT1CRTC was 0x5c */ + {0x0077,0x1d,0x14,0x07,0x00,0x3a,1280,1024, 0}, /* 1b */ + {0x0047,0x1e,0x17,0x00,0x00,0x3a,1280,1024, 0}, /* 1c */ + {0x0007,0x1f,0x98,0x00,0x00,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 */ + {0x0057,0x35,0x27,0x08,0x00,0x70, 800, 480, 0}, /* 2d */ + {0x0047,0x36,0x37,0x08,0x00,0x70, 800, 480, 0}, /* 2e */ + {0x0047,0x37,0x08,0x08,0x00,0x70, 800, 480, 0}, /* 2f */ + {0x0057,0x38,0x09,0x09,0x00,0x71,1024, 576, 0}, /* 30 */ + {0x0047,0x39,0x38,0x09,0x00,0x71,1024, 576, 0}, /* 31 */ + {0x0047,0x3a,0x11,0x09,0x00,0x71,1024, 576, 0}, /* 32 */ + {0x0057,0x3b,0x39,0x0a,0x00,0x75,1280, 720, 0}, /* 33 */ + {0x0047,0x3c,0x3a,0x0a,0x00,0x75,1280, 720, 0}, /* 34 */ + {0x0007,0x3d,0x3b,0x0a,0x00,0x75,1280, 720, 0}, /* 35 */ + {0x0047,0x3e,0x34,0x06,0x00,0x29,1152, 864, 0}, /* 36 1152x864-75Hz */ + {0x0047,0x44,0x3a,0x06,0x00,0x29,1152, 864, 0}, /* 37 1152x864-85Hz */ + {0x00c7,0x3f,0x28,0x00,0x00,0x39, 848, 480, 0}, /* 38 848x480-38Hzi */ + {0xc067,0x40,0x3d,0x0b,0x0b,0x39, 848, 480, 0}, /* 39 848x480-60Hz */ + {0x00c7,0x41,0x28,0x00,0x00,0x3f, 856, 480, 0}, /* 3a 856x480-38Hzi */ + {0xc047,0x42,0x28,0x00,0x00,0x3f, 856, 480, 0}, /* 3b 856x480-60Hz */ + {0x0067,0x43,0x3e,0x0c,0x0b,0x48,1360, 768, 0}, /* 3c 1360x768-60Hz */ + {0x0077,0x46,0x3f,0x08,0x00,0x55,1280, 768, 0}, /* 3d 1280x768-60Hz */ + {0x004f,0x47,0x03,0x06,0x00,0x5f, 768, 576, 0}, /* 3e 768x576 */ + {0x0027,0x48,0x13,0x08,0x08,0x67,1360,1024, 0}, /* 3f 1360x1024-59Hz (BARCO1366 only) */ + {0xffff, 0, 0, 0, 0, 0, 0, 0, 0} +}; -static const SiS_VBModeIDTableStruct SiS300_VBModeIDTable[] = +static const SiS_VBModeStruct SiS300_VBModeIDTable[] = { {0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, {0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01}, @@ -622,6 +259,10 @@ {0x30,0x00,0x00,0x01,0x07,0x00,0x08,0x0a}, {0x31,0x00,0x00,0x01,0x06,0x00,0x00,0x00}, {0x32,0x00,0x00,0x01,0x06,0x00,0x00,0x00}, + {0x33,0x00,0x00,0x01,0x06,0x00,0x00,0x00}, + {0x34,0x00,0x00,0x01,0x06,0x00,0x00,0x00}, + {0x35,0x00,0x00,0x01,0x06,0x00,0x00,0x00}, + {0x36,0x00,0x00,0x01,0x06,0x00,0x00,0x00}, {0x37,0x00,0x00,0x01,0x00,0x00,0x0a,0x0c}, {0x38,0x00,0x00,0x01,0x00,0x00,0x0a,0x0c}, {0x3a,0x00,0x00,0x01,0x00,0x00,0x0b,0x0d}, @@ -635,41 +276,59 @@ {0x4a,0x00,0x00,0x01,0x00,0x00,0x0a,0x0c}, {0x4c,0x00,0x00,0x01,0x00,0x00,0x0b,0x0d}, {0x4d,0x00,0x00,0x01,0x00,0x00,0x0b,0x0d}, + {0x4f,0x00,0x00,0x01,0x04,0x00,0x05,0x05}, {0x50,0x00,0x00,0x01,0x04,0x00,0x05,0x07}, {0x51,0x00,0x00,0x01,0x07,0x00,0x07,0x09}, {0x52,0x00,0x00,0x01,0x00,0x00,0x09,0x0b}, + {0x53,0x00,0x00,0x01,0x04,0x00,0x05,0x07}, + {0x54,0x00,0x00,0x01,0x07,0x00,0x07,0x09}, {0x56,0x00,0x00,0x01,0x04,0x00,0x05,0x07}, {0x57,0x00,0x00,0x01,0x07,0x00,0x07,0x09}, {0x58,0x00,0x00,0x01,0x00,0x00,0x09,0x0b}, {0x59,0x00,0x00,0x01,0x04,0x00,0x05,0x05}, - {0x5d,0x00,0x00,0x01,0x07,0x00,0x06,0x06}, + {0x5c,0x00,0x00,0x01,0x00,0x00,0x09,0x0b}, + {0x5d,0x00,0x00,0x01,0x05,0x00,0x06,0x06}, + {0x5e,0x00,0x00,0x01,0x05,0x00,0x06,0x06}, + {0x5f,0x00,0x00,0x01,0x06,0x00,0x00,0x00}, + {0x60,0x00,0x00,0x01,0x06,0x00,0x00,0x00}, + {0x61,0x00,0x00,0x01,0x06,0x00,0x00,0x00}, {0x62,0x00,0x00,0x01,0x05,0x00,0x06,0x08}, {0x63,0x00,0x00,0x01,0x07,0x00,0x08,0x0a}, {0x64,0x00,0x00,0x01,0x00,0x00,0x0a,0x0c}, {0x65,0x00,0x00,0x01,0x00,0x00,0x0b,0x0d}, - {0x6e,0x00,0x00,0x01,0x00,0x00,0x0b,0x0d}, - {0x6f,0x00,0x00,0x01,0x00,0x00,0x0b,0x0d}, - {0x7b,0x00,0x00,0x01,0x00,0x00,0x0b,0x0d}, - {0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00} /* TW: added! */ + {0x6c,0x00,0x00,0x01,0x00,0x00,0x0b,0x0d}, + {0x6d,0x00,0x00,0x01,0x00,0x00,0x0b,0x0d}, + {0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00} }; -/*end*/ - -typedef struct _SiS300_CRT1TableStruct -{ - UCHAR CR[17]; -} SiS300_CRT1TableStruct; -static const SiS300_CRT1TableStruct SiS300_CRT1Table[] = +static const SiS_CRT1TableStruct SiS300_CRT1Table[] = { - {{0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f, /* 0x00 */ - 0x9c,0x8e,0x8f,0x96,0xb9,0x30,0x00,0x00, +#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}}, - {{0x2d,0x27,0x28,0x90,0x2c,0x80,0x0b,0x3e, - 0xe9,0x8b,0xdf,0xe7,0x04,0x00,0x00,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}}, - {{0x3d,0x31,0x31,0x81,0x37,0x1f,0x72,0xf0, +#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}}, @@ -842,15 +501,10 @@ {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x1e,0xf1, /* 0x33 - 1024x600 */ 0xae,0x85,0x57,0x57,0x1f,0x30,0x00,0x02, 0x01}}, -#if 0 - {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf5, /* 0x34 - 1152x768 */ - 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x02, - 0x01}}, -#endif - {{0xa3,0x8f,0x8f,0x97,0x96,0x97,0x24,0xf5, /* 0x34 - 1152x768 - TW: corrected */ + {{0xa3,0x8f,0x8f,0x97,0x96,0x97,0x24,0xf5, /* 0x34 - 1152x768 - corrected */ 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x02, 0x01}}, - {{0x7f,0x63,0x63,0x83,0x6c,0x1c,0x72,0xba, /* 0x35 - NEW 16:9 modes, not in BIOS ------ */ + {{0x7f,0x63,0x63,0x83,0x6c,0x1c,0x72,0xba, /* 0x35 */ 0x27,0x8b,0xdf,0xdf,0x73,0x00,0x00,0x06, 0x01}}, /* 0x35 */ {{0x7f,0x63,0x63,0x83,0x69,0x13,0x6f,0xba, @@ -865,7 +519,7 @@ {{0x9f,0x7f,0x7f,0x83,0x85,0x91,0x1e,0xf1, 0xad,0x81,0x3f,0x3f,0x1f,0x30,0x00,0x02, 0x01}}, /* 0x39 */ - {{0xa7,0x7f,0x7f,0x88,0x89,0x95,0x26,0xf1, /* TW: 95 was 15 - illegal HBE! */ + {{0xa7,0x7f,0x7f,0x88,0x89,0x95,0x26,0xf1, /* 95 was 15 - illegal HBE! */ 0xb1,0x85,0x3f,0x3f,0x27,0x30,0x00,0x02, 0x01}}, /* 0x3a */ {{0xce,0x9f,0x9f,0x92,0xa9,0x17,0x28,0xc4, @@ -876,46 +530,44 @@ 0x01}}, /* 0x3c */ {{0xd3,0x9f,0x9f,0x97,0xab,0x1f,0x2e,0xd4, 0x7d,0x81,0xcf,0xcf,0x2f,0x21,0x00,0x07, - 0x01}}, /* 0x3d */ /* TW: End of 16:9 modes --------------- */ - {{0xc3,0x8f,0x8f,0x87,0x9b,0x0b,0x82,0xef, /* TW: New, 1152x864-75 (not in any BIOS) */ + 0x01}}, /* 0x3d */ + {{0xc3,0x8f,0x8f,0x87,0x9b,0x0b,0x82,0xef, /* 1152x864-75 */ 0x60,0x83,0x5f,0x5f,0x83,0x10,0x00,0x07, 0x01}}, /* 0x3e */ - {{0x86,0x69,0x69,0x8A,0x74,0x06,0x8C,0x15, /* TW: New, 848x480-38i, not in BIOS */ + {{0x86,0x69,0x69,0x8A,0x74,0x06,0x8C,0x15, /* 848x480-38i */ 0x4F,0x83,0xEF,0xEF,0x8D,0x30,0x00,0x02, 0x00}}, /* 0x3f */ -#if 0 - {{0x81,0x69,0x69,0x85,0x70,0x00,0x0F,0x3E, /* TW: New, 848x480-60, not in BIOS - incorrect for Philips panel */ - 0xEB,0x8E,0xDF,0xDF,0x10,0x00,0x00,0x02, - 0x00}}, /* 0x40 */ -#endif - {{0x83,0x69,0x69,0x87,0x6f,0x1d,0x03,0x3E, /* TW: New, 848x480-60, not in BIOS */ + {{0x83,0x69,0x69,0x87,0x6f,0x1d,0x03,0x3E, /* 848x480-60 */ 0xE5,0x8d,0xDF,0xe4,0x04,0x00,0x00,0x06, 0x00}}, /* 0x40 */ - {{0x86,0x6A,0x6A,0x8A,0x74,0x06,0x8C,0x15, /* TW: New, 856x480-38i, not in BIOS */ + {{0x86,0x6A,0x6A,0x8A,0x74,0x06,0x8C,0x15, /* 856x480-38i */ 0x4F,0x83,0xEF,0xEF,0x8D,0x30,0x00,0x02, 0x00}}, /* 0x41 */ - {{0x81,0x6A,0x6A,0x85,0x70,0x00,0x0F,0x3E, /* TW: New, 856x480-60, not in BIOS */ + {{0x81,0x6A,0x6A,0x85,0x70,0x00,0x0F,0x3E, /* 856x480-60 */ 0xEB,0x8E,0xDF,0xDF,0x10,0x00,0x00,0x02, 0x00}}, /* 0x42 */ - {{0xdd,0xa9,0xa9,0x81,0xb4,0x97,0x26,0xfd, /* TW: New, 1360x768-60, not in BIOS */ + {{0xdd,0xa9,0xa9,0x81,0xb4,0x97,0x26,0xfd, /* 1360x768-60 */ 0x01,0x8d,0xff,0x00,0x27,0x10,0x00,0x03, 0x01}}, /* 0x43 */ - {{0xd9,0x8f,0x8f,0x9d,0xba,0x0a,0x8a,0xff, /* TW: New, 1152x864-84 (not in any BIOS) */ + {{0xd9,0x8f,0x8f,0x9d,0xba,0x0a,0x8a,0xff, /* 1152x864-84 */ 0x60,0x8b,0x5f,0x5f,0x8b,0x10,0x00,0x03, - 0x01}}, /* 0x44 */ - {{0xd3,0x9f,0x9f,0x97,0xab,0x1f,0xf1,0xff, /* TW: New, 1280x960-85 (not in any BIOS) */ + 0x01}}, /* 0x44 */ + {{0xd3,0x9f,0x9f,0x97,0xab,0x1f,0xf1,0xff, /* 1280x960-85 */ 0xc0,0x83,0xbf,0xbf,0xf2,0x10,0x00,0x07, - 0x01}} /* 0x45 */ + 0x01}}, /* 0x45 */ + {{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 */ + {{0xce,0xa9,0xa9,0x92,0xb1,0x07,0x28,0x52, /* 1360x1024 (Barco iQ Pro R300) */ + 0x02,0x8e,0xff,0x00,0x29,0x0d,0x00,0x03, + 0x00}} /* 0x48 */ }; -typedef struct _SiS300_MCLKDataStruct +static const SiS_MCLKDataStruct SiS300_MCLKData_630[] = { - UCHAR SR28,SR29,SR2A; - USHORT CLOCK; -} SiS300_MCLKDataStruct; - -static const SiS300_MCLKDataStruct SiS300_MCLKData_630[] = /* 630 */ -{ /* TW: at 0x54 in BIOS */ { 0x5a,0x64,0x80, 66}, { 0xb3,0x45,0x80, 83}, { 0x37,0x61,0x80,100}, @@ -926,8 +578,8 @@ { 0x37,0x61,0x80,100} }; -static const SiS300_MCLKDataStruct SiS300_MCLKData_300[] = /* 300 */ -{ /* TW: at 0x54 in BIOS */ +static const SiS_MCLKDataStruct SiS300_MCLKData_300[] = +{ { 0x68,0x43,0x80,125}, { 0x68,0x43,0x80,125}, { 0x68,0x43,0x80,125}, @@ -938,223 +590,89 @@ { 0x37,0x61,0x80,100} }; -typedef struct _SiS300_ECLKDataStruct -{ - UCHAR SR2E,SR2F,SR30; - USHORT CLOCK; -} SiS300_ECLKDataStruct; - -static const SiS300_ECLKDataStruct SiS300_ECLKData[] = -{ - { 0x54,0x43,0x80,100}, - { 0x53,0x43,0x80,100}, - { 0x55,0x43,0x80,100}, - { 0x52,0x43,0x80,100}, - { 0x3f,0x42,0x80,100}, - { 0x54,0x43,0x80,100}, - { 0x54,0x43,0x80,100}, - { 0x54,0x43,0x80,100} -}; - -typedef struct _SiS300_VCLKDataStruct -{ - UCHAR SR2B,SR2C; - USHORT CLOCK; -} SiS300_VCLKDataStruct; - -static const SiS300_VCLKDataStruct SiS300_VCLKData[] = +static SiS_VCLKDataStruct SiS300_VCLKData[] = { { 0x1b,0xe1, 25}, /* 0x00 */ - { 0x4e,0xe4, 28}, + { 0x4e,0xe4, 28}, /* 0x01 */ { 0x57,0xe4, 32}, /* 0x02 */ - { 0xc3,0xc8, 36}, + { 0xc3,0xc8, 36}, /* 0x03 */ { 0x42,0xc3, 40}, /* 0x04 */ - { 0x5d,0xc4, 45}, + { 0x5d,0xc4, 45}, /* 0x05 */ { 0x52,0x65, 50}, /* 0x06 */ - { 0x53,0x65, 50}, + { 0x53,0x65, 50}, /* 0x07 */ { 0x6d,0x66, 56}, /* 0x08 */ - { 0x5a,0x64, 65}, + { 0x5a,0x64, 65}, /* 0x09 */ { 0x46,0x44, 68}, /* 0x0a */ - { 0x3e,0x43, 75}, - { 0x6d,0x46, 76}, /* 0x0c: 800x600 | LVDS_2(CH), MITAC(CH); - 730, A901(301B): 0xb1,0x46, 76 */ - { 0x41,0x43, 79}, + { 0x3e,0x43, 75}, /* 0x0b */ + { 0x6d,0x46, 76}, /* 0x0c */ /* 800x600 | LVDS_2(CH), MITAC(CH); - 730, A901(301B): 0xb1,0x46, 76 */ + { 0x41,0x43, 79}, /* 0x0d */ { 0x31,0x42, 79}, /* 0x0e */ - { 0x46,0x25, 85}, + { 0x46,0x25, 85}, /* 0x0f */ { 0x78,0x29, 87}, /* 0x10 */ - { 0x62,0x44, 95}, + { 0x62,0x44, 95}, /* 0x11 */ { 0x2b,0x22,105}, /* 0x12 */ - { 0x49,0x24,106}, + { 0x49,0x24,106}, /* 0x13 */ { 0xc3,0x28,108}, /* 0x14 */ - { 0x3c,0x23,109}, + { 0x3c,0x23,109}, /* 0x15 */ { 0xf7,0x2c,132}, /* 0x16 */ - { 0xd4,0x28,136}, + { 0xd4,0x28,136}, /* 0x17 */ { 0x41,0x05,158}, /* 0x18 */ - { 0x43,0x05,162}, + { 0x43,0x05,162}, /* 0x19 */ { 0xe1,0x0f,175}, /* 0x1a */ { 0xfc,0x12,189}, /* 0x1b */ { 0xde,0x26,194}, /* 0x1c */ - { 0x54,0x05,203}, + { 0x54,0x05,203}, /* 0x1d */ { 0x3f,0x03,230}, /* 0x1e */ - { 0x30,0x02,234}, + { 0x30,0x02,234}, /* 0x1f */ { 0x24,0x01,266}, /* 0x20 */ - { 0x52,0x2a, 54}, /* 301 TV */ - { 0x52,0x6a, 27}, /* 301 TV */ - { 0x62,0x24, 70}, /* 301 TV */ - { 0x62,0x64, 70}, /* 301 TV */ - { 0xa8,0x4c, 30}, /* 301 TV */ - { 0x20,0x26, 33}, /* 301 TV */ - { 0x31,0xc2, 39}, - { 0xbf,0xc8, 35}, /* 0x28 - 856x480 */ - { 0x60,0x36, 30}, /* 0x29 CH/UNTSC TEXT | LVDS_2(CH) - 730, A901(301B), Mitac(CH): 0xe0, 0xb6, 30 */ - { 0x40,0x4a, 28}, - { 0x9f,0x46, 44}, - { 0x97,0x2c, 26}, - { 0x44,0xe4, 25}, - { 0x7e,0x32, 47}, - { 0x8a,0x24, 31}, /* 0x2f CH/PAL TEXT | LVDS_2(CH), Mitac(CH) - 730, A901(301B): 0x57, 0xe4, 31 */ - { 0x97,0x2c, 26}, - { 0xce,0x3c, 39}, - { 0x52,0x4a, 36}, /* 0x32 CH/PAL 800x600 5/6 */ - { 0x34,0x61, 95}, - { 0x78,0x27,108}, - { 0xce,0x25,189}, /* 0x35 */ - { 0x45,0x6b, 21}, /* 0x36 */ /* TW: Added from Mitac */ - { 0x52,0xe2, 49}, /* 0x37 - added for 16:9 modes (not in any BIOS) */ - { 0x2b,0x61, 78}, /* 0x38 - added for 16:9 modes (not in any BIOS) */ - { 0x70,0x44,108}, /* 0x39 - added for 16:9 modes (not in any BIOS) */ - { 0x54,0x42,135}, /* 0x3a - added for 16:9 modes (not in any BIOS) */ - { 0x41,0x22,157}, /* 0x3b - added for 16:9 modes (not in any BIOS) */ - { 0x52,0x07,149}, /* 0x3c - added for 1280x960-85 (not in any BIOS)*/ - { 0x62,0xc6, 34}, /* 0x3d - added for 848x480-60 (not in any BIOS) */ - { 0x30,0x23, 88}, /* 0x3e - added for 1360x768-60 (not in any BIOS)*/ - { 0x3f,0x64, 46}, /* 0x3f - added for 640x480-100 (not in any BIOS)*/ - { 0x72,0x2a, 76}, /* 0x40 - test for SiS730 */ - { 0x15,0x21, 79}, /* 0x41 - test for SiS730 */ - { 0xff,0x00, 0} -}; - -#if 0 /* TW: This table is in all BIOSes, but not used */ -static const SiS300_VCLKDataStruct SiS300_VBVCLKData[] = -{ - { 0x1b,0xe1, 25}, - { 0x4e,0xe4, 28}, - { 0x57,0xe4, 31}, - { 0xc3,0xc8, 36}, - { 0x42,0x47, 40}, - { 0x5d,0xc4, 44}, - { 0x52,0x47, 49}, - { 0x53,0x47, 50}, - { 0x6d,0x66, 56}, - { 0x5a,0x64, 65}, - { 0x46,0x44, 67}, - { 0x29,0x61, 75}, - { 0x6d,0x46, 75}, - { 0x41,0x43, 78}, - { 0x31,0x42, 79}, - { 0x46,0x25, 84}, - { 0x78,0x29, 86}, /* 0x10 */ - { 0x62,0x44, 94}, - { 0x2b,0x22,104}, - { 0x49,0x24,105}, - { 0x43,0x42,108}, - { 0x3c,0x23,109}, - { 0xe0,0x46,132}, - { 0x70,0x25,135}, - { 0x41,0x22,157}, - { 0x43,0x22,162}, - { 0x30,0x21,175}, - { 0xc1,0x24,189}, - { 0xde,0x26,194}, - { 0x70,0x07,202}, - { 0x3f,0x03,229}, - { 0x30,0x02,234}, /* 0x1f */ - { 0x24,0x01,265}, /* 0x20 */ - { 0x52,0x2a, 54}, - { 0x52,0x6a, 27}, - { 0x62,0x24, 70}, - { 0x62,0x64, 70}, - { 0xa8,0x4c, 30}, - { 0x20,0x26, 33}, - { 0x31,0xc2, 39}, - { 0x2e,0x48, 25}, /* 0x28 */ - { 0x24,0x46, 25}, /* 0x29 */ - { 0x26,0x64, 28}, - { 0x37,0x64, 40}, - { 0xa1,0x42,108}, - { 0x37,0x61,100}, - { 0x78,0x27,108}, - { 0xff,0x00, 0} -}; + { 0x52,0x2a, 54}, /* 0x21 */ /* 301 TV */ + { 0x52,0x6a, 27}, /* 0x22 */ /* 301 TV */ + { 0x62,0x24, 70}, /* 0x23 */ /* 301 TV */ + { 0x62,0x64, 70}, /* 0x24 */ /* 301 TV */ + { 0xa8,0x4c, 30}, /* 0x25 */ /* 301 TV */ + { 0x20,0x26, 33}, /* 0x26 */ /* 301 TV */ + { 0x31,0xc2, 39}, /* 0x27 */ + { 0xbf,0xc8, 35}, /* 0x28 */ /* 856x480 */ + { 0x60,0x36, 30}, /* 0x29 */ /* CH/UNTSC TEXT | LVDS_2(CH) - 730, A901(301B), Mitac(CH): 0xe0, 0xb6, 30 */ + { 0x40,0x4a, 28}, /* 0x2a */ /* CH-TV */ + { 0x9f,0x46, 44}, /* 0x2b */ /* CH-TV */ + { 0x97,0x2c, 26}, /* 0x2c */ /* CH-TV */ + { 0x44,0xe4, 25}, /* 0x2d */ /* CH-TV */ + { 0x7e,0x32, 47}, /* 0x2e */ /* CH-TV */ + { 0x8a,0x24, 31}, /* 0x2f */ /* CH/PAL TEXT | LVDS_2(CH), Mitac(CH) - 730, A901(301B): 0x57, 0xe4, 31 */ + { 0x97,0x2c, 26}, /* 0x30 */ /* CH-TV */ + { 0xce,0x3c, 39}, /* 0x31 */ /* CH-TV */ + { 0x52,0x4a, 36}, /* 0x32 */ /* CH/PAL 800x600 5/6 */ + { 0x34,0x61, 95}, /* 0x33 */ + { 0x78,0x27,108}, /* 0x34 */ /* Replacement for index 0x14 for 630 (?) */ + { 0xce,0x25,189}, /* 0x35 */ /* Replacement for index 0x1b for 730 (and 540?) */ + { 0x45,0x6b, 21}, /* 0x36 */ /* Chrontel SuperOverscan */ + { 0x52,0xe2, 49}, /* 0x37 */ /* 16:9 modes */ + { 0x2b,0x61, 78}, /* 0x38 */ /* 16:9 modes */ + { 0x70,0x44,108}, /* 0x39 */ /* 16:9 modes */ + { 0x54,0x42,135}, /* 0x3a */ /* 16:9 modes */ + { 0x41,0x22,157}, /* 0x3b */ /* 16:9 modes */ + { 0x52,0x07,149}, /* 0x3c */ /* 1280x960-85 */ + { 0x62,0xc6, 34}, /* 0x3d */ /* 848x480-60 */ + { 0x30,0x23, 88}, /* 0x3e */ /* 1360x768-60 */ +#if 0 + { 0x3f,0x64, 46}, /* 0x3f */ /* 640x480-100 */ #endif - -static const UCHAR SiS300_ScreenOffset[] = -{ - 0x14,0x19,0x20,0x28,0x32,0x40,0x50, - 0x64,0x78,0x80,0x2d,0x35,0x48,0x35, /* 0x35 for 848 and 856 */ - 0x55,0xff /* 0x55 for 1360 */ -}; - -typedef struct _SiS300_StResInfoStruct -{ - USHORT HTotal; - USHORT VTotal; -} SiS300_StResInfoStruct; - -static const SiS300_StResInfoStruct SiS300_StResInfo[] = -{ - { 640,400}, - { 640,350}, - { 720,400}, - { 720,350}, - { 640,480} -}; - -typedef struct _SiS300_ModeResInfoStruct -{ - USHORT HTotal; - USHORT VTotal; - UCHAR XChar; - UCHAR YChar; -} SiS300_ModeResInfoStruct; - -static const SiS300_ModeResInfoStruct SiS300_ModeResInfo[] = -{ - { 320, 200, 8, 8}, /* 0x00 */ - { 320, 240, 8, 8}, /* 0x01 */ - { 320, 400, 8, 8}, /* 0x02 */ - { 400, 300, 8, 8}, /* 0x03 */ - { 512, 384, 8, 8}, /* 0x04 */ - { 640, 400, 8,16}, /* 0x05 */ - { 640, 480, 8,16}, /* 0x06 */ - { 800, 600, 8,16}, /* 0x07 */ - { 1024, 768, 8,16}, /* 0x08 */ - { 1280,1024, 8,16}, /* 0x09 */ - { 1600,1200, 8,16}, /* 0x0a */ - { 1920,1440, 8,16}, /* 0x0b */ - { 720, 480, 8,16}, /* 0x0c */ - { 720, 576, 8,16}, /* 0x0d */ - { 1280, 960, 8,16}, /* 0x0e */ - { 1024, 600, 8,16}, /* 0x0f */ - { 1152, 768, 8,16}, /* 0x10 */ - { 2048,1536, 8,16}, /* 0x11 - TW: Not in BIOS! */ - { 800, 480, 8,16}, /* 0x12 - TW: New, not in any BIOS */ - { 1024, 576, 8,16}, /* 0x13 - TW: New, not in any BIOS */ - { 1280, 720, 8,16}, /* 0x14 - TW: New, not in any BIOS */ - { 1152, 864, 8,16}, /* 0x15 - TW: New, not in any BIOS */ - { 848, 480, 8,16}, /* 0x16 - TW: New, not in any BIOS */ - { 856, 480, 8,16}, /* 0x17 - TW: New, not in any BIOS */ - { 1360, 768, 8,16} /* 0x18 - TW: New, not in any BIOS */ + { 0x70,0x29, 81}, /* 0x3f */ /* 1280x768-60 */ + { 0x72,0x2a, 76}, /* 0x40 */ /* test for SiS730 */ + { 0x15,0x21, 79}, /* 0x41 */ /* test for SiS730 */ + { 0xa1,0x42,108}, /* 0x42 */ /* 1280x960 LCD */ + { 0x37,0x61,100}, /* 0x43 */ /* 1280x960 LCD */ + { 0xe3,0x9a,106}, /* 0x44 */ /* 1360x1024 - special for Barco iQ R300 */ + { 0xe2,0x46,135}, /* 0x45 */ /* 1280x1024-75, better clock for VGA2 */ + { 0, 0, 0} /* 0x46 custom (will be filled out) */ }; -static const UCHAR SiS300_OutputSelect = 0x40; - -static const UCHAR SiS300_SoftSetting = 0x30; - #ifndef LINUX_XF86 static UCHAR SiS300_SR07 = 0x10; #endif -static const UCHAR SiS300_SR15[8][4] = +static const DRAM4Type SiS300_SR15[8] = { {0x01,0x09,0xa3,0x00}, {0x43,0x43,0x43,0x00}, @@ -1184,32 +702,18 @@ static const USHORT SiS300_RGBSenseData = 0xd1; static const USHORT SiS300_VideoSenseData = 0xb3; static const USHORT SiS300_YCSenseData = 0xb9; -static const USHORT SiS300_RGBSenseData2 = 0x0190; /*301b*/ +static const USHORT SiS300_RGBSenseData2 = 0x0190; static const USHORT SiS300_VideoSenseData2 = 0x0174; static const USHORT SiS300_YCSenseData2 = 0x016b; -static const UCHAR SiS300_CR40[5][4]; +static const DRAM4Type SiS300_CR40[5]; static UCHAR SiS300_CR49[2]; #endif -static const UCHAR SiS300_NTSCPhase[] = {0x21,0xed,0xba,0x08}; /* TW: Was {0x21,0xed,0x8a,0x08}; */ -static const UCHAR SiS300_PALPhase[] = {0x2a,0x05,0xe3,0x00}; /* TW: Was {0x2a,0x05,0xd3,0x00}; */ -static const UCHAR SiS300_PALMPhase[] = {0x21,0xE4,0x2E,0x9B}; /* palmn */ -static const UCHAR SiS300_PALNPhase[] = {0x21,0xF4,0x3E,0xBA}; -static const UCHAR SiS300_NTSCPhase2[] = {0x21,0xF0,0x7B,0xD6}; /* 301b */ -static const UCHAR SiS300_PALPhase2[] = {0x2a,0x09,0x86,0xe9}; /* 301b */ -static const UCHAR SiS300_PALMPhase2[] = {0x21,0xE6,0xEF,0xA4}; /* TW: palm 301b*/ -static const UCHAR SiS300_PALNPhase2[] = {0x21,0xF6,0x94,0x46}; /* TW: paln 301b*/ - -typedef struct _SiS300_PanelDelayTblStruct +static const SiS_PanelDelayTblStruct SiS300_PanelDelayTbl[] = { - UCHAR timer[2]; -} SiS300_PanelDelayTblStruct; - -static const SiS300_PanelDelayTblStruct SiS300_PanelDelayTbl[] = -{ - {{0x05,0xaa}}, /* TW: From 2.04.5a */ + {{0x05,0xaa}}, {{0x05,0x14}}, {{0x05,0x36}}, {{0x05,0x14}}, @@ -1227,7 +731,8 @@ {{0x05,0x60}} }; -static const SiS300_PanelDelayTblStruct SiS300_PanelDelayTblLVDS[] = +#if 0 +static const SiS_PanelDelayTblStruct SiS300_PanelDelayTblLVDS[] = { {{0x05,0xaa}}, {{0x05,0x14}}, @@ -1246,29 +751,24 @@ {{0x05,0x14}}, /* Some BIOSes: 05, 40 */ {{0x05,0x60}} }; +#endif + +/**************************************************************/ +/* SIS VIDEO BRIDGE ----------------------------------------- */ +/**************************************************************/ -typedef struct _SiS300_LCDDataStruct +static const SiS_LCDDataStruct SiS300_St2LCD1024x768Data[] = { - USHORT RVBHCMAX; - USHORT RVBHCFACT; - USHORT VGAHT; - USHORT VGAVT; - USHORT LCDHT; - USHORT LCDVT; -} SiS300_LCDDataStruct; - -static const SiS300_LCDDataStruct SiS300_StLCD1024x768Data[] = -{ - { 66, 31, 992, 510,1320, 816}, - { 66, 31, 992, 510,1320, 816}, - { 176, 75, 900, 510,1320, 816}, - { 176, 75, 900, 510,1320, 816}, - { 66, 31, 992, 510,1320, 816}, - { 27, 16,1024, 650,1350, 832}, + { 62, 25, 800, 546,1344, 806}, + { 32, 15, 930, 546,1344, 806}, + { 32, 15, 930, 546,1344, 806}, + { 104, 45, 945, 496,1344, 806}, + { 62, 25, 800, 546,1344, 806}, + { 31, 18,1008, 624,1344, 806}, { 1, 1,1344, 806,1344, 806} }; -static const SiS300_LCDDataStruct SiS300_ExtLCD1024x768Data[] = +static const SiS_LCDDataStruct SiS300_ExtLCD1024x768Data[] = { { 12, 5, 896, 512,1344, 806}, { 12, 5, 896, 510,1344, 806}, @@ -1285,30 +785,19 @@ { 1, 1,1344, 806,1344, 806} }; -static const SiS300_LCDDataStruct SiS300_St2LCD1024x768Data[] = -{ - { 62, 25, 800, 546,1344, 806}, - { 32, 15, 930, 546,1344, 806}, - { 32, 15, 930, 546,1344, 806}, - { 104, 45, 945, 496,1344, 806}, - { 62, 25, 800, 546,1344, 806}, - { 31, 18,1008, 624,1344, 806}, - { 1, 1,1344, 806,1344, 806} -}; - -static const SiS300_LCDDataStruct SiS300_StLCD1280x1024Data[] = +static const SiS_LCDDataStruct SiS300_St2LCD1280x1024Data[] = { - { 4, 1, 880, 510,1650,1088}, - { 4, 1, 880, 510,1650,1088}, + { 22, 5, 800, 510,1650,1088}, + { 22, 5, 800, 510,1650,1088}, { 176, 45, 900, 510,1650,1088}, { 176, 45, 900, 510,1650,1088}, - { 4, 1, 880, 510,1650,1088}, + { 22, 5, 800, 510,1650,1088}, { 13, 5,1024, 675,1560,1152}, { 16, 9,1266, 804,1688,1072}, { 1, 1,1688,1066,1688,1066} }; -static const SiS300_LCDDataStruct SiS300_ExtLCD1280x1024Data[] = +static const SiS_LCDDataStruct SiS300_ExtLCD1280x1024Data[] = { { 211, 60,1024, 501,1688,1066}, { 211, 60,1024, 508,1688,1066}, @@ -1320,757 +809,169 @@ { 1, 1,1688,1066,1688,1066} }; -static const SiS300_LCDDataStruct SiS300_St2LCD1280x1024Data[] = -{ - { 22, 5, 800, 510,1650,1088}, - { 22, 5, 800, 510,1650,1088}, - { 176, 45, 900, 510,1650,1088}, - { 176, 45, 900, 510,1650,1088}, - { 22, 5, 800, 510,1650,1088}, - { 13, 5,1024, 675,1560,1152}, - { 16, 9,1266, 804,1688,1072}, - { 1, 1,1688,1066,1688,1066} +static const SiS_Part2PortTblStruct SiS300_CRT2Part2_1024x768_1[] = +{ /* VESA Timing */ + {{0x21,0x12,0xbf,0xe4,0xc0,0x21,0x45,0x09,0x00,0xa9,0x09,0x04}}, + {{0x2c,0x12,0x9a,0xae,0x88,0x21,0x45,0x09,0x00,0xa9,0x09,0x04}}, + {{0x21,0x12,0xbf,0xe4,0xc0,0x21,0x45,0x09,0x00,0xa9,0x09,0x04}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, + {{0x22,0x13,0xfe,0x25,0xff,0x21,0x45,0x0a,0x00,0xa9,0x0d,0x04}}, + {{0x22,0x13,0xfe,0x25,0xff,0x21,0x45,0x0a,0x00,0xa9,0x0d,0x04}}, + {{0x22,0x13,0xfe,0x25,0xff,0x21,0x45,0x0a,0x00,0xa9,0x0d,0x04}} }; -static const SiS300_LCDDataStruct SiS300_NoScaleData1024x768[] = -{ - { 1, 1, 800, 449, 800, 449}, - { 1, 1, 800, 449, 800, 449}, - { 1, 1, 900, 449, 900, 449}, - { 1, 1, 900, 449, 900, 449}, - { 1, 1, 800, 525, 800, 525}, - { 1, 1,1056, 628,1056, 628}, - { 1, 1,1344, 806,1344, 806}, - { 1, 1,1688,1066,1688,1066} +static const SiS_Part2PortTblStruct SiS300_CRT2Part2_1024x768_2[] = +{ /* Non-VESA */ + {{0x28,0x12,0xa3,0xd0,0xaa,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, + {{0x2c,0x12,0x9a,0xae,0x88,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, + {{0x28,0x12,0xa3,0xd0,0xaa,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, + {{0x2c,0x12,0x9a,0xae,0x88,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, + {{0x28,0x13,0xe7,0x0b,0xe8,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, + {{0x38,0x18,0x16,0x00,0x00,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, + {{0x36,0x13,0x13,0x25,0xff,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}} +}; + +static const SiS_Part2PortTblStruct SiS300_CRT2Part2_1024x768_3[] = +{ + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} }; -static const SiS300_LCDDataStruct SiS300_NoScaleData1280x1024[] = /* TW: Fake */ +static const SiS_Part2PortTblStruct SiS300_CRT2Part2_1280x1024_1[] = { - { 1, 1, 800, 449, 800, 449}, - { 1, 1, 800, 449, 800, 449}, - { 1, 1, 900, 449, 900, 449}, - { 1, 1, 900, 449, 900, 449}, - { 1, 1, 800, 525, 800, 525}, - { 1, 1,1056, 628,1056, 628}, - { 1, 1,1344, 806,1344, 806}, - { 1, 1,1688,1066,1688,1066} + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} }; -static const SiS300_LCDDataStruct SiS300_LCD1280x960Data[] = +static const SiS_Part2PortTblStruct SiS300_CRT2Part2_1280x1024_2[] = { - { 9, 2, 800, 500,1800,1000}, - { 9, 2, 800, 500,1800,1000}, - { 4, 1, 900, 500,1800,1000}, - { 4, 1, 900, 500,1800,1000}, - { 9, 2, 800, 500,1800,1000}, - { 30, 11,1056, 625,1800,1000}, - { 5, 3,1350, 800,1800,1000}, - { 1, 1,1576,1050,1576,1050}, - { 1, 1,1800,1000,1800,1000} -}; - -static const SiS300_LCDDataStruct SiS300_ExtLCD1400x1050Data[] = /* TW: New */ -{ - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0} -}; - -static const SiS300_LCDDataStruct SiS300_ExtLCD1600x1200Data[] = /* TW: New */ -{ - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0} -}; - -static const SiS300_LCDDataStruct SiS300_StLCD1400x1050Data[] = /* TW: New */ -{ - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0} -}; - -static const SiS300_LCDDataStruct SiS300_StLCD1600x1200Data[] = /* TW: New */ -{ - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0} -}; - -static const SiS300_LCDDataStruct SiS300_NoScaleData1400x1050[] = /* TW: New */ -{ - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0} -}; - -static const SiS300_LCDDataStruct SiS300_NoScaleData1600x1200[] = /* TW: New */ -{ - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0} -}; - - -typedef struct _SiS300_TVDataStruct -{ - USHORT RVBHCMAX; - USHORT RVBHCFACT; - USHORT VGAHT; - USHORT VGAVT; - USHORT TVHDE; - USHORT TVVDE; - USHORT RVBHRS; - UCHAR FlickerMode; - USHORT HALFRVBHRS; - UCHAR RY1COE; - UCHAR RY2COE; - UCHAR RY3COE; - UCHAR RY4COE; -} SiS300_TVDataStruct; - -static const SiS300_TVDataStruct SiS300_StPALData[] = -{ - { 1, 1, 864, 525,1270, 400, 100, 0, 760,0xf4,0xff,0x1c,0x22}, - { 1, 1, 864, 525,1270, 350, 100, 0, 760,0xf4,0xff,0x1c,0x22}, - { 1, 1, 864, 525,1270, 400, 0, 0, 720,0xf1,0x04,0x1f,0x18}, - { 1, 1, 864, 525,1270, 350, 0, 0, 720,0xf4,0x0b,0x1c,0x0a}, - { 1, 1, 864, 525,1270, 480, 50, 0, 760,0xf4,0xff,0x1c,0x22}, - { 1, 1, 864, 525,1270, 600, 50, 0, 0,0xf4,0xff,0x1c,0x22} -}; - -static const SiS300_TVDataStruct SiS300_ExtPALData[] = -{ - { 27, 10, 848, 448,1270, 530, 50, 0, 50,0xf4,0xff,0x1c,0x22}, - { 108, 35, 848, 398,1270, 530, 50, 0, 50,0xf4,0xff,0x1c,0x22}, - { 12, 5, 954, 448,1270, 530, 50, 0, 50,0xf1,0x04,0x1f,0x18}, - { 9, 4, 960, 463,1644, 438, 50, 0, 50,0xf4,0x0b,0x1c,0x0a}, - { 9, 4, 848, 528,1270, 530, 0, 0, 50,0xf5,0xfb,0x1b,0x2a}, - { 36, 25,1060, 648,1316, 530, 438, 0, 438,0xeb,0x05,0x25,0x16}, - { 3, 2,1080, 619,1270, 540, 438, 0, 438,0xf3,0x00,0x1d,0x20}, - { 1, 1,1170, 821,1270, 520, 686, 0, 686,0xF3,0x00,0x1D,0x20} - -}; - -static const SiS300_TVDataStruct SiS300_StNTSCData[] = -{ - { 1, 1, 858, 525,1270, 400, 50, 0, 760,0xf1,0x04,0x1f,0x18}, - { 1, 1, 858, 525,1270, 350, 50, 0, 640,0xf1,0x04,0x1f,0x18}, - { 1, 1, 858, 525,1270, 400, 0, 0, 720,0xf1,0x04,0x1f,0x18}, - { 1, 1, 858, 525,1270, 350, 0, 0, 720,0xf4,0x0b,0x1c,0x0a}, - { 1, 1, 858, 525,1270, 480, 0, 0, 760,0xf1,0x04,0x1f,0x18} -}; - -static const SiS300_TVDataStruct SiS300_ExtNTSCData[] = -{ - { 143, 65, 858, 443,1270, 440, 171, 0, 171,0xf1,0x04,0x1f,0x18}, - { 88, 35, 858, 393,1270, 440, 171, 0, 171,0xf1,0x04,0x1f,0x18}, - { 143, 70, 924, 443,1270, 440, 92, 0, 92,0xf1,0x04,0x1f,0x18}, - { 143, 70, 924, 393,1270, 440, 92, 0, 92,0xf4,0x0b,0x1c,0x0a}, - { 143, 76, 836, 523,1270, 440, 224, 0, 0,0xf1,0x05,0x1f,0x16}, - { 143, 120,1056, 643,1270, 440, 0, 128, 0,0xf4,0x10,0x1c,0x00}, - { 143, 76, 836, 523,1270, 440, 0, 128, 0,0xee,0x0c,0x22,0x08}, - { 65, 64,1056, 791,1270, 480, 638, 0, 0,0xf1,0x04,0x1f,0x18} -}; - -static const SiS_TVDataStruct SiS300_St1HiTVData[] = -{ - {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} -}; - -static const SiS_TVDataStruct SiS300_St2HiTVData[] = -{ - {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} -}; - -static const SiS_TVDataStruct SiS300_ExtHiTVData[] = -{ - {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} -}; - -static const UCHAR SiS300_NTSCTiming[] = -{ - 0x17,0x1d,0x03,0x09,0x05,0x06,0x0c,0x0c, - 0x94,0x49,0x01,0x0a,0x06,0x0d,0x04,0x0a, - 0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x1b, - 0x0c,0x50,0x00,0x97,0x00,0xda,0x4a,0x17, /* (in 2.06.50) */ -/* 0x0c,0x50,0x00,0x99,0x00,0xec,0x4a,0x17, (in 2.04.5a) */ - 0x7d,0x05,0x4b,0x00,0x00,0xe2,0x00,0x02, /* (in 2.06.50) */ -/* 0x88,0x00,0x4b,0x00,0x00,0xe2,0x00,0x02, (in 2.04.5a) */ - 0x03,0x0a,0x65,0x9d,0x08,0x92,0x8f,0x40, - 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x50, - 0x00,0x40,0x44,0x00,0xdb,0x02,0x3b,0x00 -}; - -static const UCHAR SiS300_PALTiming[] = -{ - 0x19,0x52,0x35,0x6e,0x04,0x38,0x3d,0x70, - 0x94,0x49,0x01,0x12,0x06,0x3e,0x35,0x6d, - 0x06,0x14,0x3e,0x35,0x6d,0x00,0x45,0x2b, - 0x70,0x50,0x00,0x9b,0x00,0xd9,0x5d,0x17, /* (in 2.06.50) */ -/* 0x70,0x50,0x00,0x97,0x00,0xd7,0x5d,0x17, (in 2.04.5a) */ - 0x7d,0x05,0x45,0x00,0x00,0xe8,0x00,0x02, /* (in 2.06.50) */ -/* 0x88,0x00,0x45,0x00,0x00,0xe8,0x00,0x02, (in 2.04.5a) */ - 0x0d,0x00,0x68,0xb0,0x0b,0x92,0x8f,0x40, - 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x63, - 0x00,0x40,0x3e,0x00,0xe1,0x02,0x28,0x00 -}; - -#ifdef oldHV -static const UCHAR SiS300_HiTVExtTiming[] = /* TW: New */ -{ - 0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x64, - 0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d, - 0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f, - 0x64,0x90,0x33,0x8c,0x18,0x36,0x3e,0x13, - 0x2a,0xde,0x2a,0x44,0x40,0x2a,0x44,0x40, - 0x8e,0x8e,0x82,0x07,0x0b,0x92,0x0f,0x40, - 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x3d, - 0x63,0x4f,0x27,0x00,0xfc,0xff,0x6a,0x00 -}; - -static const UCHAR SiS300_HiTVSt1Timing[] = /* TW: New */ -{ - 0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x65, - 0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d, - 0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f, - 0x65,0x90,0x7b,0xa8,0x03,0xf0,0x87,0x03, - 0x11,0x15,0x11,0xcf,0x10,0x11,0xcf,0x10, - 0x35,0x35,0x3b,0x69,0x1d,0x92,0x0f,0x40, - 0x60,0x80,0x14,0x90,0x8c,0x60,0x04,0x86, - 0xaf,0x5d,0x0e,0x00,0xfc,0xff,0x2d,0x00 -}; - -static const UCHAR SiS300_HiTVSt2Timing[] = /* TW: New */ -{ - 0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x64, - 0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d, - 0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f, - 0x64,0x90,0x33,0x8c,0x18,0x36,0x3e,0x13, - 0x2a,0xde,0x2a,0x44,0x40,0x2a,0x44,0x40, - 0x8e,0x8e,0x82,0x07,0x0b,0x92,0x0f,0x40, - 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x3d, - 0x63,0x4f,0x27,0x00,0xfc,0xff,0x6a,0x00 -}; - -static const UCHAR SiS300_HiTVTextTiming[] = /* TW: New */ -{ - 0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x65, - 0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d, - 0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f, - 0x65,0x90,0xe7,0xbc,0x03,0x0c,0x97,0x03, - 0x14,0x78,0x14,0x08,0x20,0x14,0x08,0x20, - 0xc8,0xc8,0x3b,0xd2,0x26,0x92,0x0f,0x40, - 0x60,0x80,0x14,0x90,0x8c,0x60,0x04,0x96, - 0x72,0x5c,0x11,0x00,0xfc,0xff,0x32,0x00 -}; - -static const UCHAR SiS300_HiTVGroup3Data[] = /* TW: New */ -{ - 0x00,0x1a,0x22,0x63,0x62,0x22,0x08,0x5f, - 0x05,0x21,0xb2,0xb2,0x55,0x77,0x2a,0xa6, - 0x25,0x2f,0x47,0xfa,0xc8,0xff,0x8e,0x20, - 0x8c,0x6e,0x60,0x2e,0x58,0x48,0x72,0x44, - 0x56,0x36,0x4f,0x6e,0x3f,0x80,0x00,0x80, - 0x4f,0x7f,0x03,0xa8,0x7d,0x20,0x1a,0xa9, - 0x14,0x05,0x03,0x7e,0x64,0x31,0x14,0x75, - 0x18,0x05,0x18,0x05,0x4c,0xa8,0x01 -}; - -static const UCHAR SiS300_HiTVGroup3Simu[] = /* TW: New */ -{ - 0x00,0x1a,0x22,0x63,0x62,0x22,0x08,0x95, - 0xdb,0x20,0xb8,0xb8,0x55,0x47,0x2a,0xa6, - 0x25,0x2f,0x47,0xfa,0xc8,0xff,0x8e,0x20, - 0x8c,0x6e,0x60,0x15,0x26,0xd3,0xe4,0x11, - 0x56,0x36,0x4f,0x6e,0x3f,0x80,0x00,0x80, - 0x67,0x36,0x01,0x47,0x0e,0x10,0xbe,0xb4, - 0x01,0x05,0x03,0x7e,0x65,0x31,0x14,0x75, - 0x18,0x05,0x18,0x05,0x4c,0xa8,0x01 -}; - -static const UCHAR SiS300_HiTVGroup3Text[] = /* TW: New */ -{ - 0x00,0x1a,0x22,0x63,0x62,0x22,0x08,0xa7, - 0xf5,0x20,0xce,0xce,0x55,0x47,0x2a,0xa6, - 0x25,0x2f,0x47,0xfa,0xc8,0xff,0x8e,0x20, - 0x8c,0x6e,0x60,0x18,0x2c,0x0c,0x20,0x22, - 0x56,0x36,0x4f,0x6e,0x3f,0x80,0x00,0x80, - 0x93,0x3c,0x01,0x50,0x2f,0x10,0xf4,0xca, - 0x01,0x05,0x03,0x7e,0x65,0x31,0x14,0x75, - 0x18,0x05,0x18,0x05,0x4c,0xa8,0x01 + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} }; -#endif -typedef struct _SiS300_LVDSDataStruct +static const SiS_Part2PortTblStruct SiS300_CRT2Part2_1280x1024_3[] = { - USHORT VGAHT; - USHORT VGAVT; - USHORT LCDHT; - USHORT LCDVT; -} SiS300_LVDSDataStruct; - -static const SiS300_LVDSDataStruct SiS300_LVDS320x480Data_1[] = -{ - {848, 433,400, 525}, - {848, 389,400, 525}, - {848, 433,400, 525}, - {848, 389,400, 525}, - {848, 518,400, 525}, - {1056,628,400, 525}, - {400, 525,400, 525}, - {800, 449,1000, 644}, - {800, 525,1000, 635} -}; - -static const SiS300_LVDSDataStruct SiS300_LVDS800x600Data_1[] = -{ - {848, 433,1060, 629}, - {848, 389,1060, 629}, - {848, 433,1060, 629}, - {848, 389,1060, 629}, - {848, 518,1060, 629}, - {1056, 628,1056, 628}, - {1056, 628,1056, 628}, - {800, 449,1000, 644}, - {800, 525,1000, 635} -}; - -static const SiS300_LVDSDataStruct SiS300_LVDS800x600Data_2[] = -{ - {1056, 628,1056, 628}, - {1056, 628,1056, 628}, - {1056, 628,1056, 628}, - {1056, 628,1056, 628}, - {1056, 628,1056, 628}, - {1056, 628,1056, 628}, - {1056, 628,1056, 628}, - {800, 449,1000, 644}, - {800, 525,1000, 635} -}; - -static const SiS300_LVDSDataStruct SiS300_LVDS1024x768Data_1[] = -{ - {840, 438,1344, 806}, - {840, 409,1344, 806}, - {840, 438,1344, 806}, - {840, 409,1344, 806}, - {840, 518,1344, 806}, - {1050, 638,1344, 806}, - {1344, 806,1344, 806}, - {800, 449,1280, 801}, - {800, 525,1280, 813} -}; - -static const SiS300_LVDSDataStruct SiS300_LVDS1024x768Data_2[] = -{ - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {800, 449,1280, 801}, - {800, 525,1280, 813} -}; - -static const SiS300_LVDSDataStruct SiS300_LVDS1280x1024Data_1[] = -{ - {840, 438,1344, 806}, - {840, 409,1344, 806}, - {840, 438,1344, 806}, - {840, 409,1344, 806}, - {840, 518,1344, 806}, - {1050, 638,1344, 806}, - {1344, 806,1344, 806}, - {800, 449,1280, 801}, - {800, 525,1280, 813} -}; - -static const SiS300_LVDSDataStruct SiS300_LVDS1280x1024Data_2[] = -{ - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {800, 449,1280, 801}, - {800, 525,1280, 813} -}; - -static const SiS300_LVDSDataStruct SiS300_LVDS1400x1050Data_1[] = /* TW: New */ -{ - {928, 416, 1688, 1066}, - {928, 366, 1688, 1066}, - {928, 416, 1688, 1066}, - {928, 366, 1688, 1066}, - {928, 496, 1688, 1066}, - {1088, 616, 1688, 1066}, - {1312, 784, 1688, 1066}, - {1568, 1040, 1688, 1066}, - {1688, 1066, 1688, 1066} -}; - -static const SiS300_LVDSDataStruct SiS300_LVDS1400x1050Data_2[] = /* TW: New */ -{ - {1688,1066, 1688,1066}, - {1688,1066, 1688,1066}, - {1688,1066, 1688,1066}, - {1688,1066, 1688,1066}, - {1688,1066, 1688,1066}, - {1688,1066, 1688,1066}, - {1688,1066, 1688,1066}, - {1688,1066, 1688,1066}, - {1688,1066, 1688,1066}, -}; - -static const SiS300_LVDSDataStruct SiS300_LVDS1280x768Data_1[]= /* TW: New - TODO */ -{ /* TW: Temp data, invalid (is identical to 1024x768) */ - {840, 438,1344, 806}, - {840, 409,1344, 806}, - {840, 438,1344, 806}, - {840, 409,1344, 806}, - {840, 518,1344, 806}, - {1050, 638,1344, 806}, - {1344, 806,1344, 806}, - {800, 449,1280, 801}, - {800, 525,1280, 813} -}; - -static const SiS300_LVDSDataStruct SiS300_LVDS1280x768Data_2[]= /* TW: New - TODO */ -{ /* TW: Temp data, invalid (is identical to 1024x768) */ - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {800, 449,1280, 801}, - {800, 525,1280, 813} -}; - -/* TW: New: */ -static const SiS300_LVDSDataStruct SiS300_LVDS1024x600Data_1[] = -{ - {840, 604,1344, 800}, - {840, 560,1344, 800}, - {840, 604,1344, 800}, - {840, 560,1344, 800}, - {840, 689,1344, 800}, - {1050, 800,1344, 800}, - {1344, 800,1344, 800}, - {800, 449,1280, 789}, - {800, 525,1280, 785} -}; - -/* TW: New: */ -static const SiS300_LVDSDataStruct SiS300_LVDS1024x600Data_2[] = -{ - {1344, 800,1344, 800}, - {1344, 800,1344, 800}, - {1344, 800,1344, 800}, - {1344, 800,1344, 800}, - {1344, 800,1344, 800}, - {1344, 800,1344, 800}, - {1344, 800,1344, 800}, - {800, 449,1280, 801}, - {800, 525,1280, 813} -}; - -/* TW: New: */ -static const SiS300_LVDSDataStruct SiS300_LVDS1152x768Data_1[] = -{ - {840, 438,1344, 806}, - {840, 409,1344, 806}, - {840, 438,1344, 806}, - {840, 409,1344, 806}, - {840, 518,1344, 806}, - {1050, 638,1344, 806}, - {1344, 806,1344, 806}, - {800, 449,1280, 801}, - {800, 525,1280, 813} -}; - -/* TW: New: */ -static const SiS300_LVDSDataStruct SiS300_LVDS1152x768Data_2[] = -{ - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {800, 449,1280, 801}, - {800, 525,1280, 813} -}; - -/* TW: New in 650/LVDS BIOS - 1:1 */ -static const SiS300_LVDSDataStruct SiS300_LVDSXXXxXXXData_1[] = /* TW: New */ -{ - { 800, 449, 800, 449}, - { 800, 449, 800, 449}, - { 900, 449, 900, 449}, - { 900, 449, 900, 449}, - { 800, 525, 800, 525}, - {1056, 628,1056, 628}, - {1344, 806,1344, 806}, - {1688, 806,1688, 806} -}; - -static const SiS300_LVDSDataStruct SiS300_LVDS640x480Data_1[] = -{ - {800, 449, 800, 449}, - {800, 449, 800, 449}, - {800, 449, 800, 449}, - {800, 449, 800, 449}, - {800, 525, 800, 525}, - {1056, 628,1056, 628}, - {1056, 628,1056, 628}, - {1056, 628,1056, 628}, - {1056, 628,1056, 628} -}; - -static const SiS300_LVDSDataStruct SiS300_LVDS1280x960Data_1[] = /* TW: New */ -{ - {840, 438,1344, 806}, - {840, 409,1344, 806}, - {840, 438,1344, 806}, - {840, 409,1344, 806}, - {840, 518,1344, 806}, - {1050, 638,1344, 806}, - {1344, 806,1344, 806}, - {800, 449,1280, 801}, - {800, 525,1280, 813} -}; - -static const SiS300_LVDSDataStruct SiS300_LVDS1280x960Data_2[] = /* TW: New */ -{ - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {800, 449,1280, 801}, - {800, 525,1280, 813} -}; - -static const SiS300_LVDSDataStruct SiS300_LCDA1400x1050Data_1[] = /* TW: New */ -{ /* TW: Might be temporary (invalid) data */ - {928, 416, 1688, 1066}, - {928, 366, 1688, 1066}, - {1008, 416, 1688, 1066}, - {1008, 366, 1688, 1066}, - {1200, 530, 1688, 1066}, - {1088, 616, 1688, 1066}, - {1312, 784, 1688, 1066}, - {1568, 1040, 1688, 1066}, - {1688, 1066, 1688, 1066} -}; - -static const SiS300_LVDSDataStruct SiS300_LCDA1400x1050Data_2[] = /* TW: New */ -{ /* TW: Temporary data. Not valid */ - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {800, 449,1280, 801}, - {800, 525,1280, 813} -}; - -static const SiS300_LVDSDataStruct SiS300_LCDA1600x1200Data_1[] = /* TW: New */ -{ /* TW: Temporary data. Not valid */ - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {800, 449,1280, 801}, - {800, 525,1280, 813} -}; - -static const SiS300_LVDSDataStruct SiS300_LCDA1600x1200Data_2[] = /* TW: New */ -{ /* TW: Temporary data. Not valid */ - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0} -}; - - -/* TW: New: */ -static const SiS300_LVDSDataStruct SiS300_CHTVUNTSCData[] = -{ - {840, 600, 840, 600}, - {840, 600, 840, 600}, - {840, 600, 840, 600}, - {840, 600, 840, 600}, - {784, 600, 784, 600}, - {1064, 750,1064, 750} -}; - -static const SiS300_LVDSDataStruct SiS300_CHTVONTSCData[] = -{ - {840, 525, 840, 525}, - {840, 525, 840, 525}, - {840, 525, 840, 525}, - {840, 525, 840, 525}, - {784, 525, 784, 525}, - {1040, 700,1040, 700} + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} }; -static const SiS300_LVDSDataStruct SiS300_CHTVUPALData[] = +/**************************************************************/ +/* LVDS/Chrontel -------------------------------------------- */ +/**************************************************************/ + +static const SiS_LVDSDataStruct SiS300_CHTVUPALData[] = { {1008, 625,1008, 625}, {1008, 625,1008, 625}, {1008, 625,1008, 625}, {1008, 625,1008, 625}, - {840, 750, 840, 750}, - {936, 836, 936, 836} + { 840, 750, 840, 750}, + { 936, 836, 936, 836} }; -static const SiS300_LVDSDataStruct SiS300_CHTVOPALData[] = +static const SiS_LVDSDataStruct SiS300_CHTVOPALData[] = { {1008, 625,1008, 625}, {1008, 625,1008, 625}, {1008, 625,1008, 625}, {1008, 625,1008, 625}, - {840, 625, 840, 625}, - {960, 750, 960, 750} + { 840, 625, 840, 625}, + { 960, 750, 960, 750} }; -static const SiS300_LVDSDataStruct SiS300_CHTVSOPALData[] = +static const SiS_LVDSDataStruct SiS300_CHTVSOPALData[] = { {1008, 625,1008, 625}, {1008, 625,1008, 625}, {1008, 625,1008, 625}, {1008, 625,1008, 625}, - {840, 500, 840, 500}, - {944, 625, 944, 625} + { 840, 500, 840, 500}, + { 944, 625, 944, 625} }; -/* TW: new end */ -typedef struct _SiS300_LVDSDesStruct -{ - USHORT LCDHDES; - USHORT LCDVDES; -} SiS300_LVDSDesStruct; - -static const SiS300_LVDSDesStruct SiS300_PanelType00_1[] = +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} + {0, 627}, + {0, 627}, + {0, 0}, + {0, 0} +#endif }; -static const SiS300_LVDSDesStruct SiS300_PanelType01_1[] = +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} + { 0, 805}, + { 0, 794}, + { 0, 0} +#endif }; -static const SiS300_LVDSDesStruct SiS300_PanelType02_1[] = +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} + {0, 627}, + {0, 627}, + {0, 0}, + {0, 0} +#endif }; -static const SiS300_LVDSDesStruct SiS300_PanelType03_1[] = +static const SiS_LVDSDesStruct SiS300_PanelType03_1[] = { - { 8, 436}, - { 8, 440}, - { 8, 436}, - { 8, 440}, - { 8, 512}, + { 8, 436}, + { 8, 440}, + { 8, 436}, + { 8, 440}, + { 8, 512}, {1343, 798}, {1343, 794}, {1343, 798}, {1343, 794} }; -static const SiS300_LVDSDesStruct SiS300_PanelType04_1[] = +static const SiS_LVDSDesStruct SiS300_PanelType04_1[] = /* 1280x1024 */ { {1343, 798}, {1343, 794}, @@ -2078,12 +979,12 @@ {1343, 794}, {1343, 0}, {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} + { 0, 805}, + { 0, 794}, + { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType05_1[] = +static const SiS_LVDSDesStruct SiS300_PanelType05_1[] = { {1343, 798}, {1343, 794}, @@ -2091,12 +992,12 @@ {1343, 794}, {1343, 0}, {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} + { 0, 805}, + { 0, 794}, + { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType06_1[] = +static const SiS_LVDSDesStruct SiS300_PanelType06_1[] = /* Clevo Trumpion 1024x768 */ { {1343, 798}, {1343, 794}, @@ -2104,12 +1005,12 @@ {1343, 794}, {1343, 0}, {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} + { 0, 805}, + { 0, 794}, + { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType07_1[] = +static const SiS_LVDSDesStruct SiS300_PanelType07_1[] = { {1343, 798}, {1343, 794}, @@ -2117,25 +1018,25 @@ {1343, 794}, {1343, 0}, {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} + { 0, 805}, + { 0, 794}, + { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType08_1[] = +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} + { 0, 627}, + { 0, 627}, + { 0, 0}, + { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType09_1[] = +static const SiS_LVDSDesStruct SiS300_PanelType09_1[] = { {1343, 798}, {1343, 794}, @@ -2143,38 +1044,38 @@ {1343, 794}, {1343, 0}, {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} + { 0, 805}, + { 0, 794}, + { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType0a_1[] = +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} + { 0, 627}, + { 0, 627}, + { 0, 0}, + { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType0b_1[] = +static const SiS_LVDSDesStruct SiS300_PanelType0b_1[] = { - {1343, 0}, - {1343, 0}, - {1343, 0}, - {1343, 0}, - {1343, 0}, /* 640x480 - BIOS 1343, 0 */ - {1343, 0}, - { 0, 799}, - { 0, 0}, - { 0, 0} + {1343, 0}, + {1343, 0}, + {1343, 0}, + {1343, 0}, + {1343, 0}, + {1343, 0}, + { 0, 799}, + { 0, 0}, + { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType0c_1[] = +static const SiS_LVDSDesStruct SiS300_PanelType0c_1[] = { {1343, 798}, {1343, 794}, @@ -2182,12 +1083,12 @@ {1343, 794}, {1343, 0}, {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} + { 0, 805}, + { 0, 794}, + { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType0d_1[] = +static const SiS_LVDSDesStruct SiS300_PanelType0d_1[] = { {1343, 798}, {1343, 794}, @@ -2195,25 +1096,25 @@ {1343, 794}, {1343, 0}, {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} + { 0, 805}, + { 0, 794}, + { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType0e_1[] = +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 */ + {1343, 0}, /* 640x480 */ + {1343, 0}, /* 800x600 */ + { 0, 805}, /* 1024x768 */ + { 0, 794}, /* 1280x1024 */ + { 0, 0} /* 1280x960 - not applicable */ }; -static const SiS300_LVDSDesStruct SiS300_PanelType0f_1[] = +static const SiS_LVDSDesStruct SiS300_PanelType0f_1[] = { {1343, 798}, {1343, 794}, @@ -2221,25 +1122,25 @@ {1343, 794}, {1343, 0}, {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} + { 0, 805}, + { 0, 794}, + { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType00_2[] = +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} + { 0, 627}, + { 0, 627}, + { 0, 0}, + { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType01_2[] = +static const SiS_LVDSDesStruct SiS300_PanelType01_2[] = { {1152, 622}, {1152, 597}, @@ -2247,25 +1148,25 @@ {1152, 597}, {1152, 662}, {1232, 722}, - { 0, 805}, - { 0, 794}, - { 0, 0} + { 0, 805}, + { 0, 794}, + { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType02_2[] = +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} + { 0, 627}, + { 0, 627}, + { 0, 0}, + { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType03_2[] = +static const SiS_LVDSDesStruct SiS300_PanelType03_2[] = { {1152, 622}, {1152, 597}, @@ -2278,7 +1179,7 @@ {1152, 597} }; -static const SiS300_LVDSDesStruct SiS300_PanelType04_2[] = +static const SiS_LVDSDesStruct SiS300_PanelType04_2[] = { {1152, 622}, {1152, 597}, @@ -2291,7 +1192,7 @@ { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType05_2[] = +static const SiS_LVDSDesStruct SiS300_PanelType05_2[] = { {1152, 622}, {1152, 597}, @@ -2304,7 +1205,7 @@ { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType06_2[] = +static const SiS_LVDSDesStruct SiS300_PanelType06_2[] = { {1152, 622}, {1152, 597}, @@ -2317,7 +1218,7 @@ { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType07_2[] = +static const SiS_LVDSDesStruct SiS300_PanelType07_2[] = { {1152, 622}, {1152, 597}, @@ -2330,7 +1231,7 @@ { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType08_2[] = +static const SiS_LVDSDesStruct SiS300_PanelType08_2[] = { {976, 527}, {976, 502}, @@ -2343,7 +1244,7 @@ { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType09_2[] = +static const SiS_LVDSDesStruct SiS300_PanelType09_2[] = { {1152, 622}, {1152, 597}, @@ -2356,7 +1257,7 @@ { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType0a_2[] = +static const SiS_LVDSDesStruct SiS300_PanelType0a_2[] = { {976, 527}, {976, 502}, @@ -2369,7 +1270,7 @@ { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType0b_2[] = +static const SiS_LVDSDesStruct SiS300_PanelType0b_2[] = { { 1152, 700}, { 1152, 675}, @@ -2382,7 +1283,7 @@ { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType0c_2[] = +static const SiS_LVDSDesStruct SiS300_PanelType0c_2[] = { {1152, 622}, {1152, 597}, @@ -2395,7 +1296,7 @@ { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType0d_2[] = +static const SiS_LVDSDesStruct SiS300_PanelType0d_2[] = { {1152, 622}, {1152, 597}, @@ -2408,7 +1309,7 @@ { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType0e_2[] = +static const SiS_LVDSDesStruct SiS300_PanelType0e_2[] = { {1152, 622}, {1152, 597}, @@ -2421,7 +1322,7 @@ { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType0f_2[] = +static const SiS_LVDSDesStruct SiS300_PanelType0f_2[] = { {1152, 622}, {1152, 597}, @@ -2434,46 +1335,21 @@ { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType1076_1[] = /* TW: New */ -{ - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0} -}; - -static const SiS300_LVDSDesStruct SiS300_PanelType1076_2[] = /* TW: New */ -{ - { 1152, 622 }, - { 1152, 597 }, - { 1152, 622 }, - { 1152, 597 }, - { 1152, 622 }, - { 1232, 722 }, - { 0, 0 }, - { 0, 794 }, - { 0, 0 } -}; - -static const SiS300_LVDSDesStruct SiS300_PanelType1210_1[] = /* TW: New */ +static const SiS_LVDSDesStruct SiS300_PanelTypeNS_1[]= { - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0} + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 805}, + { 0, 0}, + { 0, 0}, + { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType1210_2[] = /* TW: New */ +static const SiS_LVDSDesStruct SiS300_PanelTypeNS_2[] = { { 0 , 0}, { 0 , 0}, @@ -2483,162 +1359,63 @@ { 0 , 0}, { 0 , 0}, { 0 , 0}, - { 0 , 0} -}; - -static const SiS300_LVDSDesStruct SiS300_PanelType1296_1[] = /* TW: New */ -{ - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, { 0 , 0}, { 0 , 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType1296_2[] = /* TW: New */ +/* Custom data for Barco iQ R200/300/400 (BIOS 2.00.07) */ +static const SiS_LVDSDesStruct SiS300_PanelType04_1a[] = /* 1280x1024 (1366x1024) */ { - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0} + {1330, 798}, /* 320x200 */ + {1330, 794}, + {1330, 798}, + {1330, 794}, + {1330, 0}, /* 640x480 / 320x240 */ + {1343, 0}, /* 800x600 / 400x300 */ + { 0, 805}, /* 1024x768 / 512x384 */ + {1688,1066}, /* 1280x1024 */ + { 0, 0} /* 1360x1024 */ }; - -/* TW: New */ -static const SiS300_LVDSDesStruct SiS300_CHTVUNTSCDesData[] = +static const SiS_LVDSDesStruct SiS300_PanelType04_2a[] = { - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0} + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805}, + {1688,1066}, + { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_CHTVONTSCDesData[] = +/* Custom data for Barco iQ G200/300/400 (BIOS 2.00.07) */ +static const SiS_LVDSDesStruct SiS300_PanelType04_1b[] = /* 1024x768 */ { - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0} + {1330, 798}, /* 320x200 */ + {1330, 794}, + {1330, 798}, + {1330, 794}, + {1330, 0}, /* 640x480 / 320x240 */ + {1343, 0}, /* 800x600 / 400x300 */ + { 0, 805} /* 1024x768 / 512x384 */ }; -static const SiS300_LVDSDesStruct SiS300_CHTVUPALDesData[] = +static const SiS_LVDSDesStruct SiS300_PanelType04_2b[] = { - {256, 0}, - {256, 0}, - {256, 0}, - {256, 0}, - { 0, 0}, - { 0, 0} + {1152, 622}, + {1152, 597}, + {1152, 622}, + {1152, 597}, + {1152, 662}, + {1232, 722}, + { 0, 805} }; -static const SiS300_LVDSDesStruct SiS300_CHTVOPALDesData[] = -{ - {256, 0}, - {256, 0}, - {256, 0}, - {256, 0}, - { 0, 0}, - { 0, 0} -}; -/* TW: New end */ +/* CRT1 CRTC for slave modes */ -/* TW: New for SiS300+301LV */ -typedef struct _SiS300_Part2PortTblStruct -{ - UCHAR CR[12]; -} SiS300_Part2PortTblStruct; - -static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1024x768_1[] = -{ /* VESA Timing */ - {{0x21,0x12,0xbf,0xe4,0xc0,0x21,0x45,0x09,0x00,0xa9,0x09,0x04}}, - {{0x2c,0x12,0x9a,0xae,0x88,0x21,0x45,0x09,0x00,0xa9,0x09,0x04}}, - {{0x21,0x12,0xbf,0xe4,0xc0,0x21,0x45,0x09,0x00,0xa9,0x09,0x04}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, - {{0x22,0x13,0xfe,0x25,0xff,0x21,0x45,0x0a,0x00,0xa9,0x0d,0x04}}, - {{0x22,0x13,0xfe,0x25,0xff,0x21,0x45,0x0a,0x00,0xa9,0x0d,0x04}}, - {{0x22,0x13,0xfe,0x25,0xff,0x21,0x45,0x0a,0x00,0xa9,0x0d,0x04}} -}; - -static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1280x1024_1[] = -{ /* TW: Temporary data, invalid */ - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} -}; - -static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1400x1050_1[] = -{ /* TW: Temporary data, invalid */ - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} -}; - -static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1600x1200_1[] = -{ /* TW: Temporary data, invalid */ - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} -}; - -static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1024x768_2[] = -{ /* Non-VESA */ - {{0x28,0x12,0xa3,0xd0,0xaa,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, - {{0x2c,0x12,0x9a,0xae,0x88,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, - {{0x28,0x12,0xa3,0xd0,0xaa,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, - {{0x2c,0x12,0x9a,0xae,0x88,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, - {{0x28,0x13,0xe7,0x0b,0xe8,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, - {{0x38,0x18,0x16,0x00,0x00,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, - {{0x36,0x13,0x13,0x25,0xff,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}} -}; - -static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1280x1024_2[] = -{ - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} -}; - -static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1400x1050_2[] = -{ - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} -}; - -static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1600x1200_2[] = -{ /* TW: Temporary data, invalid */ - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} -}; - -static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1024x768_3[] = -{ /* TW: Temporary data, invalid */ - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} -}; - -static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1280x1024_3[] = -{ /* TW: Temporary data, invalid */ - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} -}; - -static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1400x1050_3[] = -{ /* TW: Temporary data, invalid */ - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} -}; - -static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1600x1200_3[] = -{ /* TW: Temporary data, invalid */ - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} -}; - -typedef struct _SiS300_LVDSCRT1DataStruct -{ -UCHAR CR[15]; -} SiS300_LVDSCRT1DataStruct; - -static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_1[] = +static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_1[] = { {{0x65,0x4f,0x89,0x56,0x83,0xaf,0x1f, 0x90,0x85,0x8f,0xab,0x30,0x00,0x05, @@ -2660,7 +1437,29 @@ 0x01 }} }; -static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_1[] = +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, @@ -2685,55 +1484,31 @@ 0x01}} }; -static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_1[] = -{ - {{0x63,0x4f,0x87,0x54,0x9f,0xb4,0x1f, - 0x92,0x89,0x8f,0xb5,0x30,0x00,0x01, - 0x00 }}, - {{0x63,0x4f,0x87,0x54,0x9f,0x82,0x1f, - 0x60,0x87,0x5d,0x83,0x10,0x00,0x01, - 0x00 }}, - {{0x63,0x4f,0x87,0x54,0x9f,0xb4,0x1f, - 0x92,0x89,0x8f,0xb5,0x30,0x00,0x01, - 0x00 }}, - {{0x63,0x4f,0x87,0x54,0x9f,0x82,0x1f, - 0x60,0x87,0x5d,0x83,0x10,0x00,0x01, - 0x00 }}, - {{0x63,0x4f,0x87,0x54,0x9f,0x04,0x3e, - 0xe2,0x89,0xdf,0x05,0x00,0x00,0x01, - 0x00 }}, - {{0x7e,0x63,0x82,0x68,0x15,0x7c,0xf0, - 0x5a,0x8f,0x57,0x7d,0x20,0x00,0x26, - 0x01 }}, - {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x02, - 0x01 }} -}; - -static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_1_H[] = +static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_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, + {{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x44, 0x00 }}, - {{0x3d,0x31,0x81,0x37,0x1f,0x72,0xf0, - 0x58,0x8c,0x57,0x73,0x20,0x00,0x05, + {{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 }} -}; -static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_1_H[] = -{ +#if 0 {{0x37,0x27,0x9B,0x2b,0x94,0xc4,0x1f, 0x92,0x89,0x8f,0xb5,0x30,0x00,0x44, 0x00 }}, @@ -2755,9 +1530,35 @@ {{0x4f,0x3F,0x93,0x45,0x0D,0x24,0xf5, 0x02,0x88,0xFf,0x25,0x10,0x00,0x01, 0x01 }} +#endif }; -static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_1_H[] = +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, @@ -2782,7 +1583,7 @@ 0x01 }} }; -static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_2[] = +static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_2[] = { {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, 0xf4,0x88,0x8f,0x73,0x20,0x00,0x06, @@ -2804,32 +1605,29 @@ 0x01 }} }; -static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_2[] = +static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_2_H[] = { - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, + {{0x3d,0x27,0x81,0x32,0x1a,0x72,0x3e, + 0xf4,0x88,0x8f,0x73,0x20,0x00,0x05, 0x00 }}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, + {{0x3d,0x27,0x81,0x32,0x1a,0x72,0x3e, + 0xdb,0x8f,0x5d,0x73,0x20,0x00,0x05, 0x00 }}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, + {{0x3d,0x27,0x81,0x32,0x1a,0x72,0x3e, + 0xf4,0x88,0x8f,0x73,0x20,0x00,0x05, 0x00 }}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, + {{0x3d,0x27,0x81,0x3a,0x1a,0x72,0x3e, + 0xdb,0x8f,0x5d,0x73,0x20,0x00,0x05, 0x00 }}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x72,0x88,0xdf,0x25,0x30,0x00,0x06, + {{0x3d,0x27,0x81,0x32,0x1a,0x72,0xba, + 0x1c,0x80,0xdf,0x73,0x00,0x00,0x05, 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, + {{0x3d,0x31,0x81,0x37,0x1f,0x72,0xf0, + 0x58,0x8c,0x57,0x73,0x20,0x00,0x05, 0x01 }} }; -static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_2[] = +static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_2[] = { {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, @@ -2854,29 +1652,7 @@ 0x01 }} }; -static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_2_H[] = -{ - {{0x3d,0x27,0x81,0x32,0x1a,0x72,0x3e, - 0xf4,0x88,0x8f,0x73,0x20,0x00,0x05, - 0x00 }}, - {{0x3d,0x27,0x81,0x32,0x1a,0x72,0x3e, - 0xdb,0x8f,0x5d,0x73,0x20,0x00,0x05, - 0x00 }}, - {{0x3d,0x27,0x81,0x32,0x1a,0x72,0x3e, - 0xf4,0x88,0x8f,0x73,0x20,0x00,0x05, - 0x00 }}, - {{0x3d,0x27,0x81,0x3a,0x1a,0x72,0x3e, - 0xdb,0x8f,0x5d,0x73,0x20,0x00,0x05, - 0x00 }}, - {{0x3d,0x27,0x81,0x32,0x1a,0x72,0xba, - 0x1c,0x80,0xdf,0x73,0x00,0x00,0x05, - 0x00 }}, - {{0x3d,0x31,0x81,0x37,0x1f,0x72,0xf0, - 0x58,0x8c,0x57,0x73,0x20,0x00,0x05, - 0x01 }} -}; - -static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_2_H[] = +static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_2_H[] = { {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, @@ -2901,7 +1677,32 @@ 0x01 }} }; -static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_2_H[] = +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, @@ -2926,208 +1727,64 @@ 0x01}} }; -static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x600_1[] = -{ - {{0x64,0x4f,0x88,0x54,0x9f,0x5a,0x3e, - 0xe8,0x8f,0x8f,0x5b,0x00,0x00,0x01, - 0x00}}, - {{0x64,0x4f,0x88,0x54,0x9f,0x2e,0x3e, - 0xb9,0x80,0x5d,0x2f,0x00,0x00,0x01, - 0x00}}, - {{0x64,0x4f,0x88,0x54,0x9f,0x5a,0x3e, - 0xe8,0x8f,0x8f,0x5b,0x00,0x00,0x01, - 0x00}}, - {{0x64,0x4f,0x88,0x54,0x9f,0x2e,0x3e, - 0xb9,0x80,0x5d,0x2f,0x00,0x00,0x01, - 0x00}}, - {{0x64,0x4f,0x88,0x54,0x9f,0xaf,0xba, - 0x3b,0x82,0xdf,0xb0,0x00,0x00,0x01, - 0x00}}, - {{0x7e,0x63,0x82,0x68,0x15,0x1e,0xf1, - 0xae,0x85,0x57,0x1f,0x30,0x00,0x26, - 0x01}}, - {{0xa3,0x7f,0x87,0x86,0x97,0x1e,0xf1, - 0xae,0x85,0x57,0x1f,0x30,0x00,0x02, - 0x01}} -}; - -static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x600_1_H[] = -{ - {{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f, - 0x92,0x89,0x8f,0xb5,0x30,0x00,0x44, - 0x00}}, - {{0x2f,0x27,0x93,0x2b,0x90,0x97,0x1f, - 0x60,0x87,0x5d,0x83,0x10,0x00,0x44, - 0x00}}, - {{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f, - 0x92,0x89,0x8f,0xb5,0x30,0x00,0x44, - 0x00}}, - {{0x2f,0x27,0x93,0x2b,0x90,0x97,0x1f, - 0x60,0x87,0x5d,0x83,0x10,0x00,0x44, - 0x00}}, - {{0x2f,0x27,0x93,0x2b,0x90,0x04,0x3e, - 0xe2,0x89,0xdf,0x05,0x00,0x00,0x44, - 0x00}}, - {{0x3c,0x31,0x80,0x35,0x1c,0x7c,0xf0, - 0x5a,0x8f,0x57,0x7d,0x20,0x00,0x55, - 0x01}}, - {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x01, - 0x01}} -}; - -static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x600_2[] = -{ - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x72,0x88,0xdf,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x63,0x87,0x78,0x89,0x24,0xf1, - 0xae,0x84,0x57,0x25,0x30,0x00,0x02, - 0x01}}, - {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x02, - 0x01}} -}; - -static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x600_2_H[] = -{ - {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, - 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, - 0x00}}, - {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, - 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, - 0x00}}, - {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, - 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, - 0x00}}, - {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, - 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, - 0x00}}, - {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, - 0x72,0x88,0xdf,0x25,0x30,0x00,0x01, - 0x00}}, - {{0x4f,0x31,0x93,0x3e,0x06,0x24,0xf1, - 0xae,0x84,0x57,0x25,0x30,0x00,0x01, - 0x01}}, - {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x01, - 0x01}} -}; - -static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11152x768_1[] = +static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT1XXXxXXX_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}} + {{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 SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11152x768_1_H[] = -{ - {{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f, - 0x92,0x89,0x8f,0xb5,0x30,0x00,0x44, - 0x00}}, - {{0x2f,0x27,0x93,0x2b,0x90,0x97,0x1f, - 0x60,0x87,0x5d,0x83,0x10,0x00,0x44, - 0x00}}, - {{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f, - 0x92,0x89,0x8f,0xb5,0x30,0x00,0x44, - 0x00}}, - {{0x2f,0x27,0x93,0x2b,0x90,0x97,0x1f, - 0x60,0x87,0x5d,0x83,0x10,0x00,0x44, - 0x00}}, - {{0x2f,0x27,0x93,0x2b,0x90,0x04,0x3e, - 0xe2,0x89,0xdf,0x05,0x00,0x00,0x44, - 0x00}}, - {{0x3c,0x31,0x80,0x35,0x1c,0x7c,0xf0, - 0x5a,0x8f,0x57,0x7d,0x20,0x00,0x55, - 0x01}}, - {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x01, - 0x01}} -}; - -static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11152x768_2[] = -{ - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x72,0x88,0xdf,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x63,0x87,0x78,0x89,0x24,0xf1, - 0xae,0x84,0x57,0x25,0x30,0x00,0x02, - 0x01}}, - {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x02, - 0x01}} -}; -static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11152x768_2_H[] = -{ - {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, - 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, - 0x00}}, - {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, - 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, - 0x00}}, - {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, - 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, - 0x00}}, - {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, - 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, - 0x00}}, - {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, - 0x72,0x88,0xdf,0x25,0x30,0x00,0x01, - 0x00}}, - {{0x4f,0x31,0x93,0x3e,0x06,0x24,0xf1, - 0xae,0x84,0x57,0x25,0x30,0x00,0x01, - 0x01}}, - {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x01, - 0x01}} -}; - -/* TW: New */ -static const SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1UNTSC[] = +static const SiS_LVDSCRT1DataStruct SiS300_CHTVCRT1UNTSC[] = { {{0x64,0x4f,0x88,0x56,0x9f,0x56,0x3e, 0xe8,0x84,0x8f,0x57,0x20,0x00,0x01, @@ -3149,7 +1806,7 @@ 0x01 }} }; -static const SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1ONTSC[] = +static const SiS_LVDSCRT1DataStruct SiS300_CHTVCRT1ONTSC[] = { {{0x64,0x4f,0x88,0x5a,0x9f,0x0b,0x3e, 0xc0,0x84,0x8f,0x0c,0x20,0x00,0x01, @@ -3171,7 +1828,7 @@ 0x01 }} }; -static const SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1UPAL[] = +static const SiS_LVDSCRT1DataStruct SiS300_CHTVCRT1UPAL[] = { {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, 0xf8,0x83,0x8f,0x70,0x20,0x00,0x05, @@ -3193,7 +1850,7 @@ 0x01 }} }; -static const SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1OPAL[] = +static const SiS_LVDSCRT1DataStruct SiS300_CHTVCRT1OPAL[] = { {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, 0xf0,0x83,0x8f,0x70,0x20,0x00,0x05, @@ -3215,7 +1872,7 @@ 0x01 }} }; -static const SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1SOPAL[] = +static const SiS_LVDSCRT1DataStruct SiS300_CHTVCRT1SOPAL[] = { {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, 0xf0,0x83,0x8f,0x70,0x20,0x00,0x05, @@ -3236,15 +1893,8 @@ 0x90,0x8c,0x57,0xed,0x20,0x00,0x05, 0x01 }} }; -/* TW: New end */ -/* TW: New */ -typedef struct _SiS300_CHTVRegDataStruct -{ - UCHAR Reg[16]; -} SiS300_CHTVRegDataStruct; - -static const SiS300_CHTVRegDataStruct SiS300_CHTVReg_UNTSC[] = +static const SiS_CHTVRegDataStruct SiS300_CHTVReg_UNTSC[] = { {{0x4a,0x94,0x00,0x48,0xfe,0,0,0,0,0,0,0,0,0,0,0}}, {{0x4a,0x94,0x00,0x48,0xfe,0,0,0,0,0,0,0,0,0,0,0}}, @@ -3254,7 +1904,7 @@ {{0x8d,0xc4,0x00,0x3b,0xfb,0,0,0,0,0,0,0,0,0,0,0}} /* Mode 24: 800x600 NTSC 7/10 */ }; -static const SiS300_CHTVRegDataStruct SiS300_CHTVReg_ONTSC[] = +static const SiS_CHTVRegDataStruct SiS300_CHTVReg_ONTSC[] = { {{0x49,0x94,0x00,0x34,0xfe,0,0,0,0,0,0,0,0,0,0,0}}, {{0x49,0x94,0x00,0x34,0xfe,0,0,0,0,0,0,0,0,0,0,0}}, @@ -3264,7 +1914,7 @@ {{0x8c,0xb4,0x00,0x32,0xf9,0,0,0,0,0,0,0,0,0,0,0}} /* Mode 23: 800x600 NTSC 3/4 */ }; -static const SiS300_CHTVRegDataStruct SiS300_CHTVReg_UPAL[] = +static const SiS_CHTVRegDataStruct SiS300_CHTVReg_UPAL[] = { {{0x41,0x12,0x01,0x50,0x34,0,0,0,0,0,0,0,0,0,0,0}}, {{0x41,0x12,0x00,0x50,0x00,0,0,0,0,0,0,0,0,0,0,0}}, @@ -3275,7 +1925,7 @@ }; -static const SiS300_CHTVRegDataStruct SiS300_CHTVReg_OPAL[] = +static const SiS_CHTVRegDataStruct SiS300_CHTVReg_OPAL[] = { {{0x41,0x12,0x01,0x50,0x34,0,0,0,0,0,0,0,0,0,0,0}}, /* Mode 9: 640x400 PAL 1/1 */ {{0x41,0x12,0x00,0x50,0x00,0,0,0,0,0,0,0,0,0,0,0}}, @@ -3286,18 +1936,16 @@ }; -static const SiS300_CHTVRegDataStruct SiS300_CHTVReg_SOPAL[] = +static const SiS_CHTVRegDataStruct SiS300_CHTVReg_SOPAL[] = { - {{0x41,0x12,0x01,0x50,0x34,0,0,0,0,0,0,0,0,0,0,0}}, /* Mode 9: 640x400 PAL 5/4 */ + {{0x41,0x12,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 */ }; -/* TW: New end */ -/* TW: New */ static const UCHAR SiS300_CHTVVCLKUNTSC[] = {0x29,0x29,0x29,0x29,0x2a,0x2e}; static const UCHAR SiS300_CHTVVCLKONTSC[] = {0x2c,0x2c,0x2c,0x2c,0x2d,0x2b}; @@ -3309,6 +1957,5 @@ static const UCHAR SiS300_CHTVVCLKOPAL[] = {0x2f,0x2f,0x2f,0x2f,0x30,0x32}; static const UCHAR SiS300_CHTVVCLKSOPAL[] = {0x2f,0x2f,0x2f,0x2f,0x36,0x29}; -/* TW: New end */ Index: xc/programs/Xserver/hw/xfree86/drivers/sis/310vtbl.h diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/310vtbl.h:1.5 xc/programs/Xserver/hw/xfree86/drivers/sis/310vtbl.h:1.26 --- xc/programs/Xserver/hw/xfree86/drivers/sis/310vtbl.h:1.5 Sun Feb 9 20:14:16 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/310vtbl.h Wed Feb 25 18:22:15 2004 @@ -1,709 +1,256 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/310vtbl.h,v 1.5 2003/02/10 01:14:16 tsi Exp $ */ - - -/* Register settings for SiS 310/325 series */ - - -typedef struct _SiS310_StStruct -{ - UCHAR St_ModeID; - USHORT St_ModeFlag; - UCHAR St_StTableIndex; - UCHAR St_CRT2CRTC; - UCHAR St_ResInfo; - UCHAR VB_StTVFlickerIndex; - UCHAR VB_StTVEdgeIndex; - UCHAR VB_StTVYFilterIndex; -} SiS310_StStruct; - -static const SiS310_StStruct SiS310_SModeIDTable[]= -{ - {0x01,0x9208,0x01,0x00,0x00,0x00,0x01,0x00}, - {0x01,0x1210,0x14,0x01,0x01,0x00,0x01,0x00}, - {0x01,0x1010,0x17,0x02,0x02,0x00,0x01,0x01}, - {0x03,0x8208,0x03,0x00,0x00,0x00,0x01,0x02}, - {0x03,0x0210,0x16,0x01,0x01,0x00,0x01,0x02}, - {0x03,0x0010,0x18,0x02,0x02,0x00,0x01,0x03}, - {0x05,0x9209,0x05,0x00,0x00,0x00,0x00,0x04}, - {0x06,0x8209,0x06,0x00,0x00,0x00,0x00,0x05}, - {0x07,0x0000,0x07,0x03,0x03,0x00,0x01,0x03}, - {0x07,0x0000,0x19,0x02,0x02,0x00,0x01,0x03}, - {0x0d,0x920a,0x0d,0x00,0x00,0x00,0x00,0x04}, - {0x0e,0x820a,0x0e,0x00,0x00,0x00,0x00,0x05}, - {0x0f,0x0202,0x11,0x01,0x01,0x00,0x00,0x05}, - {0x10,0x0212,0x12,0x01,0x01,0x00,0x00,0x05}, - {0x11,0x0212,0x1a,0x04,0x04,0x00,0x00,0x05}, - {0x12,0x0212,0x1b,0x04,0x04,0x00,0x00,0x05}, - {0x13,0x021b,0x1c,0x00,0x00,0x00,0x00,0x04}, - {0x12,0x0010,0x18,0x02,0x02,0x00,0x00,0x05}, - {0x12,0x0210,0x18,0x01,0x01,0x00,0x00,0x05}, - {0xff,0x0000,0x00,0x00,0x00,0x00,0x00,0x00} -}; - -typedef struct _SiS310_StandTableStruct -{ - UCHAR CRT_COLS; - UCHAR ROWS; - UCHAR CHAR_HEIGHT; - USHORT CRT_LEN; - UCHAR SR[4]; - UCHAR MISC; - UCHAR CRTC[0x19]; - UCHAR ATTR[0x14]; - UCHAR GRC[9]; -} SiS310_StandTableStruct; - -static const SiS310_StandTableStruct SiS310_StandTable[]= -{ -/* MD_0_200 */ - { - 0x28,0x18,0x08,0x0800, - {0x09,0x03,0x00,0x02}, - 0x63, - {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f, - 0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00, - 0x9c,0x8e,0x8f,0x14,0x1f,0x96,0xb9,0xa3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, - 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, - 0x08,0x00,0x0f,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, - 0xff} - }, -/* MD_1_200 */ - { - 0x28,0x18,0x08,0x0800, - {0x09,0x03,0x00,0x02}, - 0x63, - {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f, - 0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00, - 0x9c,0x8e,0x8f,0x14,0x1f,0x96,0xb9,0xa3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, - 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, - 0x08,0x00,0x0f,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, - 0xff} - }, -/* MD_2_200 */ - { - 0x50,0x18,0x08,0x1000, - {0x01,0x03,0x00,0x02}, - 0x63, - {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, - 0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00, - 0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, - 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, - 0x08,0x00,0x0f,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, - 0xff} - }, -/* MD_3_200 */ - { - 0x50,0x18,0x08,0x1000, - {0x01,0x03,0x00,0x02}, - 0x63, - {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, - 0x00,0xc7,0x06,0x07,0x00,0x00,0x00,0x00, - 0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, - 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, - 0x08,0x00,0x0f,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, - 0xff} - }, -/* MD_4 */ - { - 0x28,0x18,0x08,0x4000, - {0x09,0x03,0x00,0x02}, - 0x63, - {0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f, - 0x00,0xc1,0x00,0x00,0x00,0x00,0x00,0x00, - 0x9c,0x8e,0x8f,0x14,0x00,0x96,0xb9,0xa2, - 0xff}, - {0x00,0x13,0x15,0x17,0x02,0x04,0x06,0x07, - 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, - 0x01,0x00,0x03,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x30,0x0f,0x00, - 0xff} - }, -/* MD_5 */ - { - 0x28,0x18,0x08,0x4000, - {0x09,0x03,0x00,0x02}, - 0x63, - {0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f, - 0x00,0xc1,0x00,0x00,0x00,0x00,0x00,0x00, - 0x9c,0x8e,0x8f,0x14,0x00,0x96,0xb9,0xa2, - 0xff}, - {0x00,0x13,0x15,0x17,0x02,0x04,0x06,0x07, - 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, - 0x01,0x00,0x03,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x30,0x0f,0x00, - 0xff} - }, -/* MD_6 */ - { - 0x50,0x18,0x08,0x4000, - {0x01,0x01,0x00,0x06}, - 0x63, - {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, - 0x00,0xc1,0x00,0x00,0x00,0x00,0x00,0x00, - 0x9c,0x8e,0x8f,0x28,0x00,0x96,0xb9,0xc2, - 0xff}, - {0x00,0x17,0x17,0x17,0x17,0x17,0x17,0x17, - 0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, - 0x01,0x00,0x01,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x00,0x0d,0x00, - 0xff} - }, -/* MD_7 */ - { - 0x50,0x18,0x0e,0x1000, - {0x00,0x03,0x00,0x03}, - 0xa6, - {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, - 0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00, - 0x83,0x85,0x5d,0x28,0x0d,0x63,0xba,0xa3, - 0xff}, - {0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08, - 0x10,0x18,0x18,0x18,0x18,0x18,0x18,0x18, - 0x0e,0x00,0x0f,0x08}, - {0x00,0x00,0x00,0x00,0x00,0x10,0x0a,0x00, - 0xff} - }, -/* MDA_DAC */ - { - 0x00,0x00,0x00,0x0000, - {0x00,0x00,0x00,0x15}, - 0x15, - {0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, - 0x15,0x15,0x15,0x15,0x15,0x15,0x3f,0x3f, - 0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x00, - 0x00}, - {0x00,0x00,0x00,0x00,0x00,0x15,0x15,0x15, - 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, - 0x15,0x15,0x15,0x15}, - {0x15,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, - 0x3f} - }, -/* CGA_DAC */ - { - 0x00,0x10,0x04,0x0114, - {0x11,0x09,0x15,0x00}, - 0x10, - {0x04,0x14,0x01,0x11,0x09,0x15,0x2a,0x3a, - 0x2e,0x3e,0x2b,0x3b,0x2f,0x3f,0x2a,0x3a, - 0x2e,0x3e,0x2b,0x3b,0x2f,0x3f,0x00,0x10, - 0x04}, - {0x14,0x01,0x11,0x09,0x15,0x00,0x10,0x04, - 0x14,0x01,0x11,0x09,0x15,0x2a,0x3a,0x2e, - 0x3e,0x2b,0x3b,0x2f}, - {0x3f,0x2a,0x3a,0x2e,0x3e,0x2b,0x3b,0x2f, - 0x3f} - }, -/* EGA_DAC */ - { - 0x00,0x10,0x04,0x0114, - {0x11,0x05,0x15,0x20}, - 0x30, - {0x24,0x34,0x21,0x31,0x25,0x35,0x08,0x18, - 0x0c,0x1c,0x09,0x19,0x0d,0x1d,0x28,0x38, - 0x2c,0x3c,0x29,0x39,0x2d,0x3d,0x02,0x12, - 0x06}, - {0x16,0x03,0x13,0x07,0x17,0x22,0x32,0x26, - 0x36,0x23,0x33,0x27,0x37,0x0a,0x1a,0x0e, - 0x1e,0x0b,0x1b,0x0f}, - {0x1f,0x2a,0x3a,0x2e,0x3e,0x2b,0x3b,0x2f, - 0x3f} - }, -/* VGA_DAC */ - { - 0x00,0x10,0x04,0x0114, - {0x11,0x09,0x15,0x2a}, - 0x3a, - {0x2e,0x3e,0x2b,0x3b,0x2f,0x3f,0x00,0x05, - 0x08,0x0b,0x0e,0x11,0x14,0x18,0x1c,0x20, - 0x24,0x28,0x2d,0x32,0x38,0x3f,0x00,0x10, - 0x1f}, - {0x2f,0x3f,0x1f,0x27,0x2f,0x37,0x3f,0x2d, - 0x31,0x36,0x3a,0x3f,0x00,0x07,0x0e,0x15, - 0x1c,0x0e,0x11,0x15}, - {0x18,0x1c,0x14,0x16,0x18,0x1a,0x1c,0x00, - 0x04} - }, - { - 0x08,0x0c,0x10,0x0a08, - {0x0c,0x0e,0x10,0x0b}, - 0x0c, - {0x0d,0x0f,0x10,0x10,0x01,0x08,0x00,0x00, - 0x00,0x00,0x01,0x00,0x02,0x02,0x01,0x00, - 0x04,0x04,0x01,0x00,0x05,0x02,0x05,0x00, - 0x06}, - {0x01,0x06,0x05,0x06,0x00,0x08,0x01,0x08, - 0x00,0x07,0x02,0x07,0x06,0x07,0x00,0x00, - 0x00,0x00,0x00,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00} - }, -/* MD_D */ - { - 0x28,0x18,0x08,0x2000, - {0x09,0x0f,0x00,0x06}, - 0x63, - {0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f, - 0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00, - 0x9c,0x8e,0x8f,0x14,0x00,0x96,0xb9,0xe3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, - 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, - 0x01,0x00,0x0f,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f, - 0xff} - }, -/* MD_E */ - { - 0x50,0x18,0x08,0x4000, - {0x01,0x0f,0x00,0x06}, - 0x63, - {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, - 0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00, - 0x9c,0x8e,0x8f,0x28,0x00,0x96,0xb9,0xe3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, - 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, - 0x01,0x00,0x0f,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f, - 0xff} - }, -/* ExtVGATable */ - { - 0x00,0x00,0x00,0x0000, - {0x01,0x0f,0x00,0x0e}, - 0x23, - {0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e, - 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, - 0xea,0x8c,0xdf,0x28,0x40,0xe7,0x04,0xa3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, - 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, - 0x01,0x00,0x00,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0f, - 0xff} - }, -/* ROM_SAVEPTR */ - { - 0x9f,0x3b,0x00,0x00c0, - {0x00,0x00,0x00,0x00}, - 0x00, - {0x00,0x00,0x00,0x00,0x00,0x00,0xbb,0x3f, - 0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x1a,0x00,0xac,0x3e,0x00,0xc0, - 0x00}, - {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00} - }, -/* MD_F */ - { - 0x50,0x18,0x0e,0x8000, - {0x01,0x0f,0x00,0x06}, - 0xa2, - {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, - 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, - 0x82,0x84,0x5d,0x28,0x0f,0x63,0xba,0xe3, - 0xff}, - {0x00,0x08,0x00,0x00,0x18,0x18,0x00,0x00, - 0x00,0x08,0x00,0x00,0x00,0x18,0x00,0x00, - 0x0b,0x00,0x05,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x05, - 0xff} - }, -/* MD_10 */ - { - 0x50,0x18,0x0e,0x8000, - {0x01,0x0f,0x00,0x06}, - 0xa3, - {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, - 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, - 0x82,0x84,0x5d,0x28,0x0f,0x63,0xba,0xe3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, - 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, - 0x01,0x00,0x0f,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f, - 0xff} - }, -/* MD_0_350 */ - { - 0x28,0x18,0x0e,0x0800, - {0x09,0x03,0x00,0x02}, - 0xa3, - {0x2d,0x27,0x28,0x90,0x2b,0xb1,0xbf,0x1f, - 0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00, - 0x83,0x85,0x5d,0x14,0x1f,0x63,0xba,0xa3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, - 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, - 0x08,0x00,0x0f,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, - 0xff} - }, -/* MD_1_350 */ - { - 0x28,0x18,0x0e,0x0800, - {0x09,0x03,0x00,0x02}, - 0xa3, - {0x2d,0x27,0x28,0x90,0x2b,0xa0,0xbf,0x1f, - 0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00, - 0x83,0x85,0x5d,0x14,0x1f,0x63,0xba,0xa3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, - 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, - 0x08,0x00,0x0f,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, - 0xff} - }, -/* MD_2_350 */ - { - 0x50,0x18,0x0e,0x1000, - {0x01,0x03,0x00,0x02}, - 0xa3, - {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, - 0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00, - 0x83,0x85,0x5d,0x28,0x1f,0x63,0xba,0xa3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, - 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, - 0x08,0x00,0x0f,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, - 0xff} - }, -/* MD_3_350 */ - { - 0x50,0x18,0x0e,0x1000, - {0x01,0x03,0x00,0x02}, - 0xa3, - {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, - 0x00,0x4d,0x0b,0x0c,0x00,0x00,0x00,0x00, - 0x83,0x85,0x5d,0x28,0x1f,0x63,0xba,0xa3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, - 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, - 0x08,0x00,0x0f,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, - 0xff} - }, -/* MD_0_1_400 */ - { - 0x28,0x18,0x10,0x0800, - {0x08,0x03,0x00,0x02}, - 0x67, - {0x2d,0x27,0x28,0x90,0x2b,0xb1,0xbf,0x1f, - 0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00, - 0x9c,0x8e,0x8f,0x14,0x1f,0x96,0xb9,0xa3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, - 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, - 0x0c,0x00,0x0f,0x08}, - {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, - 0xff} - }, -/* MD_2_3_400 */ - { - 0x50,0x18,0x10,0x1000, - {0x00,0x03,0x00,0x02}, - 0x67, - {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, - 0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00, - 0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, - 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, - 0x0c,0x00,0x0f,0x08}, - {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, - 0xff} - }, -/* MD_7_400 */ - { - 0x50,0x18,0x10,0x1000, - {0x00,0x03,0x00,0x02}, - 0x66, - {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, - 0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00, - 0x9c,0x8e,0x8f,0x28,0x0f,0x96,0xb9,0xa3, - 0xff}, - {0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08, - 0x10,0x18,0x18,0x18,0x18,0x18,0x18,0x18, - 0x0e,0x00,0x0f,0x08}, - {0x00,0x00,0x00,0x00,0x00,0x10,0x0a,0x00, - 0xff} - }, -/* MD_11 */ - { - 0x50,0x1d,0x10,0xa000, - {0x01,0x0f,0x00,0x06}, - 0xe3, - {0x5f,0x4f,0x50,0x82,0x55,0x81,0x0b,0x3e, - 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, - 0xe9,0x8b,0xdf,0x28,0x00,0xe7,0x04,0xc3, - 0xff}, - {0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, - 0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f, - 0x01,0x00,0x0f,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x01, - 0xff} - }, -/* ExtEGATable */ - { - 0x50,0x1d,0x10,0xa000, - {0x01,0x0f,0x00,0x06}, - 0xe3, - {0x5f,0x4f,0x50,0x82,0x55,0x81,0x0b,0x3e, - 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, - 0xe9,0x8b,0xdf,0x28,0x00,0xe7,0x04,0xe3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, - 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, - 0x01,0x00,0x0f,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f, - 0xff} - }, -/* MD_13 */ - { - 0x28,0x18,0x08,0x2000, - {0x01,0x0f,0x00,0x0e}, - 0x63, - {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, - 0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00, - 0x9c,0x8e,0x8f,0x28,0x40,0x96,0xb9,0xa3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, - 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, - 0x41,0x00,0x0f,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0f, - 0xff} - } -}; - -typedef struct _SiS310_ExtStruct -{ - UCHAR Ext_ModeID; - USHORT Ext_ModeFlag; - USHORT Ext_ModeInfo; - USHORT Ext_Point; /* TW: Address of table entry in (older) BIOS image */ - USHORT Ext_VESAID; - UCHAR Ext_VESAMEMSize; - UCHAR Ext_RESINFO; - UCHAR VB_ExtTVFlickerIndex; - UCHAR VB_ExtTVEdgeIndex; - UCHAR VB_ExtTVYFilterIndex; - UCHAR REFindex; -} SiS310_ExtStruct; - -/* TW: Checked with 650/LVDS and 650/301LVx 1.10.6s */ -static const SiS310_ExtStruct SiS310_EModeIDTable[]= -{ - {0x6a,0x2212,0x0407,0x3a81,0x0102,0x08,0x07,0x00,0x00,0x07,0x00}, /* 800x600x? */ - {0x2e,0x0a1b,0x0306,0x3a57,0x0101,0x08,0x06,0x00,0x00,0x05,0x08}, /* 640x480x8 */ -/* {0x2e,0x021b,0x0306,0x3a57,0x0101,0x08,0x06,0x00,0x00,0x05,0x08}, */ /* 640x480x8 - 650/LVDS BIOS (no CRt2Mode) */ - {0x2f,0x0a1b,0x0305,0x3a50,0x0100,0x08,0x05,0x00,0x00,0x05,0x10}, /* 640x400x8 */ -/* {0x2f,0x021b,0x0305,0x3a50,0x0100,0x08,0x05,0x00,0x00,0x05,0x10}, */ /* 640x400x8 - 650/LVDS BIOS (no CRt2Mode) */ - {0x30,0x2a1b,0x0407,0x3a81,0x0103,0x08,0x07,0x00,0x00,0x07,0x00}, /* 800x600x8 */ -/* {0x30,0x221b,0x0407,0x3a81,0x0103,0x08,0x07,0x00,0x00,0x07,0x00}, */ /* 800x600x8 - 650/LVDS BIOS (no CRt2Mode) */ -/* {0x31,0x0a1b,0x030d,0x3b85,0x0000,0x08,0x0d,0x00,0x00,0x06,0x11}, */ /* 720x480x8 */ - {0x31,0x0a1b,0x0a0d,0x3b85,0x0000,0x08,0x0d,0x00,0x00,0x06,0x11}, /* 720x480x8 BIOS (301/LVDS) */ - {0x32,0x0a1b,0x0a0e,0x3b8c,0x0000,0x08,0x0e,0x00,0x00,0x06,0x12}, /* 720x576x8 */ - {0x33,0x0a1d,0x0a0d,0x3b85,0x0000,0x08,0x0d,0x00,0x00,0x06,0x11}, /* 720x480x16 */ - {0x34,0x2a1d,0x0a0e,0x3b8c,0x0000,0x08,0x0e,0x00,0x00,0x06,0x12}, /* 720x576x16 */ - {0x35,0x0a1f,0x0a0d,0x3b85,0x0000,0x08,0x0d,0x00,0x00,0x06,0x11}, /* 720x480x32 */ - {0x36,0x2a1f,0x0a0e,0x3b8c,0x0000,0x08,0x0e,0x00,0x00,0x06,0x12}, /* 720x576x32 */ - {0x37,0x0212,0x0508,0x3aab,0x0104,0x08,0x08,0x00,0x00,0x08,0x13}, /* 1024x768x? */ - {0x38,0x0a1b,0x0508,0x3aab,0x0105,0x08,0x08,0x00,0x00,0x08,0x13}, /* 1024x768x8 */ -/* {0x38,0x021b,0x0508,0x3aab,0x0105,0x08,0x08,0x00,0x00,0x00,0x13}, */ /* 1024x768x8 - 650/LVDS BIOS (no CRt2Mode) */ - {0x3a,0x0e3b,0x0609,0x3adc,0x0107,0x08,0x09,0x00,0x00,0x00,0x1a}, /* 1280x1024x8 */ -/* {0x3a,0x063b,0x0609,0x3adc,0x0107,0x08,0x09,0x00,0x00,0x00,0x1a}, */ /* 1280x1024x8 - 650/LVDS BIOS*/ - {0x3c,0x0e3b,0x070a,0x3af2,0x0130,0x08,0x0a,0x00,0x00,0x00,0x1e}, /* 1600x1200x8 */ -/* {0x3c,0x063b,0x070a,0x3af2,0x0130,0x08,0x0a,0x00,0x00,0x00,0x1e}, */ /* 1600x1200x8 - 650/LVDS BIOS */ - {0x3d,0x067d,0x070a,0x3af2,0x0131,0x08,0x0a,0x00,0x00,0x00,0x1e}, /* 1600x1200x16 - 650/301LVx - no CRT2Mode? */ - {0x40,0x9a1c,0x0000,0x3a34,0x010d,0x08,0x00,0x00,0x00,0x04,0x25}, - {0x41,0x9a1d,0x0000,0x3a34,0x010e,0x08,0x00,0x00,0x00,0x04,0x25}, - {0x43,0x0a1c,0x0306,0x3a57,0x0110,0x08,0x06,0x00,0x00,0x05,0x08}, - {0x44,0x0a1d,0x0306,0x3a57,0x0111,0x08,0x06,0x00,0x00,0x05,0x08}, /* 640x480x16 */ - {0x46,0x2a1c,0x0407,0x3a81,0x0113,0x08,0x07,0x00,0x00,0x07,0x00}, - {0x47,0x2a1d,0x0407,0x3a81,0x0114,0x08,0x07,0x00,0x00,0x07,0x00}, /* 800x600x16 */ - {0x49,0x0a3c,0x0508,0x3aab,0x0116,0x08,0x08,0x00,0x00,0x00,0x13}, - {0x4a,0x0a3d,0x0508,0x3aab,0x0117,0x08,0x08,0x00,0x00,0x08,0x13}, /* 1024x768x16 */ - {0x4c,0x0e7c,0x0609,0x3adc,0x0119,0x08,0x09,0x00,0x00,0x00,0x1a}, - {0x4d,0x0e7d,0x0609,0x3adc,0x011a,0x08,0x09,0x00,0x00,0x00,0x1a}, /* 1280x1024x16 */ - {0x50,0x9a1b,0x0001,0x3a3b,0x0132,0x08,0x01,0x00,0x00,0x04,0x26}, -/* {0x50,0x921b,0x0001,0x3a3b,0x0132,0x08,0x01,0x00,0x00,0x04,0x26}, */ /* 650/LVDS BIOS */ - {0x51,0xba1b,0x0103,0x3a42,0x0133,0x08,0x03,0x00,0x00,0x07,0x27}, -/* {0x52,0x9a1b,0x0204,0x3a49,0x0134,0x08,0x04,0x00,0x00,0x00,0x28}, */ - {0x52,0xba1b,0x0204,0x3a49,0x0134,0x08,0x04,0x00,0x00,0x00,0x28}, /* 650/301 BIOS */ -/* {0x52,0xb21b,0x0204,0x3a49,0x0134,0x08,0x04,0x00,0x00,0x00,0x28}, */ /* 650/LVDS BIOS (no CRT2Mode) */ - {0x56,0x9a1d,0x0001,0x3a3b,0x0135,0x08,0x01,0x00,0x00,0x04,0x26}, - {0x57,0xba1d,0x0103,0x3a42,0x0136,0x08,0x03,0x00,0x00,0x07,0x27}, -/* {0x58,0x9a1d,0x0204,0x3a49,0x0137,0x08,0x04,0x00,0x00,0x00,0x28}, */ - {0x58,0xba1d,0x0204,0x3a49,0x0137,0x08,0x04,0x00,0x00,0x00,0x28}, /* BIOS (301+LVDS) */ - {0x59,0x9a1b,0x0000,0x3a34,0x0138,0x08,0x00,0x00,0x00,0x04,0x25}, -/* {0x59,0x921b,0x0000,0x3a34,0x0138,0x08,0x00,0x00,0x00,0x04,0x25}, */ /* 650/LVDS BIOS (no CRT2Mode) */ - {0x5A,0x021b,0x0014,0x3b83,0x0138,0x08,0x01,0x00,0x00,0x04,0x3f}, /* 320x480x8 fstn add new mode*/ - {0x5B,0x0a1d,0x0014,0x3b83,0x0135,0x08,0x01,0x00,0x00,0x04,0x3f}, /* 320x480x16 fstn add new mode*/ - {0x5c,0xba1f,0x0204,0x3a49,0x0000,0x08,0x04,0x00,0x00,0x00,0x28}, /* TW: inserted 512x384x32 */ - {0x5d,0x0a1d,0x0305,0x3a50,0x0139,0x08,0x05,0x00,0x00,0x07,0x10}, - {0x5e,0x0a1f,0x0305,0x3a50,0x0000,0x08,0x05,0x00,0x00,0x07,0x10}, /* TW: Inserted 640x400x32 */ - {0x62,0x0a3f,0x0306,0x3a57,0x013a,0x08,0x06,0x00,0x00,0x05,0x08}, /* 640x480x32 */ - {0x63,0x2a3f,0x0407,0x3a81,0x013b,0x08,0x07,0x00,0x00,0x07,0x00}, /* 800x600x32 */ - {0x64,0x0a7f,0x0508,0x3aab,0x013c,0x08,0x08,0x00,0x00,0x08,0x13}, /* 1024x768x32 */ - {0x65,0x0eff,0x0609,0x3adc,0x013d,0x08,0x09,0x00,0x00,0x00,0x1a}, /* 1280x1024x32 */ - {0x66,0x06ff,0x070a,0x3af2,0x013e,0x08,0x0a,0x00,0x00,0x00,0x1e}, /* 1600x1200x32 */ - {0x68,0x067b,0x080b,0x3b17,0x013f,0x08,0x0b,0x00,0x00,0x00,0x29}, /* 1920x1440x8 */ - {0x69,0x06fd,0x080b,0x3b17,0x0140,0x08,0x0b,0x00,0x00,0x00,0x29}, /* 1920x1440x16 */ - {0x6b,0x07ff,0x080b,0x3b17,0x0141,0x10,0x0b,0x00,0x00,0x00,0x29}, /* 1920x1440x32 */ - {0x6c,0x067b,0x090c,0x3b37,0x0000,0x08,0x0c,0x00,0x00,0x00,0x2f}, /* 2048x1536x8 */ - {0x6d,0x06fd,0x090c,0x3b37,0x0000,0x10,0x0c,0x00,0x00,0x00,0x2f}, /* 2048x1536x16 */ - {0x6e,0x07ff,0x090c,0x3b37,0x0000,0x10,0x0c,0x00,0x00,0x00,0x2f}, /* 2048x1536x32 */ - {0x70,0x2a1b,0x0410,0x3b52,0x0000,0x08,0x10,0x00,0x00,0x07,0x34}, /* 800x480x8 */ - {0x71,0x0a1b,0x0511,0x3b63,0x0000,0x08,0x11,0x00,0x00,0x00,0x37}, /* 1024x576x8 */ - {0x74,0x0a1d,0x0511,0x3b63,0x0000,0x08,0x11,0x00,0x00,0x00,0x37}, /* 1024x576x16 */ - {0x75,0x0a3d,0x0612,0x3b74,0x0000,0x08,0x12,0x00,0x00,0x00,0x3a}, /* 1280x720x16 */ - {0x76,0x2a1f,0x0410,0x3b52,0x0000,0x08,0x10,0x00,0x00,0x07,0x34}, /* 800x480x32 */ - {0x77,0x0a1f,0x0511,0x3b63,0x0000,0x08,0x11,0x00,0x00,0x00,0x37}, /* 1024x576x32 */ - {0x78,0x0a3f,0x0612,0x3b74,0x0000,0x08,0x12,0x00,0x00,0x00,0x3a}, /* 1280x720x32 */ - {0x79,0x0a3b,0x0612,0x3b74,0x0000,0x08,0x12,0x00,0x00,0x00,0x3a}, /* 1280x720x8 */ - {0x7a,0x2a1d,0x0410,0x3b52,0x0000,0x08,0x10,0x00,0x00,0x07,0x34}, /* 800x480x16 */ - {0x7c,0x0e3b,0x060f,0x3ad0,0x0000,0x08,0x0f,0x00,0x00,0x00,0x3d}, /* 1280x960x8 - TW */ - {0x7d,0x0e7d,0x060f,0x3ad0,0x0000,0x08,0x0f,0x00,0x00,0x00,0x3d}, /* 1280x960x16 - TW */ - {0x7e,0x0eff,0x060f,0x3ad0,0x0000,0x08,0x0f,0x00,0x00,0x00,0x3d}, /* 1280x960x32 - TW */ - /* TW: 650/LVDS BIOS new modes */ -/* {0x23,0x063b,0x0614,0x36f7,0x0000,0x08,0x14,0x00,0x00,0x00,0x40}, */ /* 1280x768x8 - 650/LVDS BIOS */ - {0x23,0x0e3b,0x0614,0x36f7,0x0000,0x08,0x14,0x00,0x00,0x00,0x40}, /* 1280x768x8 */ - {0x24,0x0e7d,0x0614,0x36f7,0x0000,0x08,0x14,0x00,0x00,0x00,0x40}, /* 1280x768x16 */ - {0x25,0x0eff,0x0614,0x36f7,0x0000,0x08,0x14,0x00,0x00,0x00,0x40}, /* 1280x768x32 */ - {0x26,0x0e3b,0x0c15,0x36fe,0x0000,0x08,0x15,0x00,0x00,0x00,0x41}, /* 1400x1050x8 */ -/* {0x26,0x063b,0x0c15,0x36fe,0x0000,0x08,0x15,0x00,0x00,0x00,0x41}, */ /* 1400x1050x8 - 650/LVDS BIOS */ - {0x27,0x0e7d,0x0c15,0x36fe,0x0000,0x08,0x15,0x00,0x00,0x00,0x41}, /* 1400x1050x16 */ - {0x28,0x0eff,0x0c15,0x36fe,0x0000,0x08,0x15,0x00,0x00,0x00,0x41}, /* 1400x1050x32*/ - {0x29,0x0e1b,0x0d16,0x0000,0x0000,0x08,0x16,0x00,0x00,0x00,0x43}, /* TW: NEW 1152x864 - not in BIOS */ - {0x2a,0x0e3d,0x0d16,0x0000,0x0000,0x08,0x16,0x00,0x00,0x00,0x43}, - {0x2b,0x0e7f,0x0d16,0x0000,0x0000,0x08,0x16,0x00,0x00,0x00,0x43}, - {0x39,0x2a1b,0x0b17,0x0000,0x0000,0x08,0x17,0x00,0x00,0x00,0x45}, /* TW: NEW 848x480 - not in BIOS */ - {0x3b,0x2a3d,0x0b17,0x0000,0x0000,0x08,0x17,0x00,0x00,0x00,0x45}, - {0x3e,0x2a7f,0x0b17,0x0000,0x0000,0x08,0x17,0x00,0x00,0x00,0x45}, - {0x3f,0x2a1b,0x0b13,0x0000,0x0000,0x08,0x13,0x00,0x00,0x00,0x47}, /* TW: NEW 856x480 - not in BIOS */ - {0x42,0x2a3d,0x0b13,0x0000,0x0000,0x08,0x13,0x00,0x00,0x00,0x47}, - {0x45,0x2a7f,0x0b13,0x0000,0x0000,0x08,0x13,0x00,0x00,0x00,0x47}, - {0x48,0x2a1b,0x0e18,0x0000,0x0000,0x08,0x18,0x00,0x00,0x00,0x49}, /* TW: NEW 1360x768 - not in BIOS */ - {0x4b,0x2a3d,0x0e18,0x0000,0x0000,0x08,0x18,0x00,0x00,0x00,0x49}, - {0x4e,0x2a7f,0x0e18,0x0000,0x0000,0x08,0x18,0x00,0x00,0x00,0x49}, - {0xff,0x0000,0x0000,0x0000,0x0000,0x00,0x00,0x00,0x00,0x00,0x00} -}; - -typedef struct _SiS310_Ext2Struct -{ - USHORT Ext_InfoFlag; - UCHAR Ext_CRT1CRTC; - UCHAR Ext_CRTVCLK; - UCHAR Ext_CRT2CRTC; - UCHAR ModeID; - USHORT XRes; - USHORT YRes; - USHORT ROM_OFFSET; -} SiS310_Ext2Struct; - -static const SiS310_Ext2Struct SiS310_RefIndex[]= -{ -/* {0x005f,0x0d,0x03,0x05,0x6a, 800, 600,0x3a81}, 0x0 - TW: Patch for Chrontel 7019 */ - {0x085f,0x0d,0x03,0x05,0x6a, 800, 600,0x3a81}, /* 0x0 */ - {0x0467,0x0e,0x04,0x05,0x6a, 800, 600,0x3a86}, /* 0x1 */ - {0x0067,0x0f,0x08,0x48,0x6a, 800, 600,0x3a8b}, /* 0x2 */ - {0x0067,0x10,0x07,0x8b,0x6a, 800, 600,0x3a90}, /* 0x3 */ - {0x0147,0x11,0x0a,0x00,0x6a, 800, 600,0x3a95}, /* 0x4 */ - {0x0147,0x12,0x0d,0x00,0x6a, 800, 600,0x3a9a}, /* 0x5 - 4147 TW: Test sync change */ - {0x0047,0x13,0x13,0x00,0x6a, 800, 600,0x3a9f}, /* 0x6 - 4047 */ - {0x0047,0x14,0x1c,0x00,0x6a, 800, 600,0x3aa4}, /* 0x7 - 4047 */ -/* {0xc05f,0x05,0x00,0x04,0x2e, 640, 480,0x3a57}, 0x8 - TW: Patch for Chrontel 7019 */ - {0xc85f,0x05,0x00,0x04,0x2e, 640, 480,0x3a57}, /* 0x8 */ - {0xc067,0x06,0x02,0x04,0x2e, 640, 480,0x3a5c}, /* 0x9 */ - {0xc067,0x07,0x02,0x47,0x2e, 640, 480,0x3a61}, /* 0xa */ - {0xc067,0x08,0x03,0x8a,0x2e, 640, 480,0x3a66}, /* 0xb */ - {0xc047,0x09,0x05,0x00,0x2e, 640, 480,0x3a6b}, /* 0xc - 4047 */ - {0xc047,0x0a,0x09,0x00,0x2e, 640, 480,0x3a70}, /* 0xd - 4047 */ - {0xc047,0x0b,0x0e,0x00,0x2e, 640, 480,0x3a75}, /* 0xe - 4047 */ - {0xc047,0x0c,0x15,0x00,0x2e, 640, 480,0x3a7a}, /* 0xf */ - {0x407f,0x04,0x00,0x00,0x2f, 640, 400,0x3a50}, /* 0x10 */ - {0xc00f,0x3c,0x01,0x06,0x31, 720, 480,0x3b85}, /* 0x11 */ - {0x000f,0x3d,0x03,0x06,0x32, 720, 576,0x3b8c}, /* 0x12 */ - {0x0187,0x15,0x06,0x00,0x37,1024, 768,0x3aab}, /* 0x13 */ - {0xc877,0x16,0x0b,0x06,0x37,1024, 768,0x3ab0}, /* 0x14 301b TV1024x768*/ - {0xc067,0x17,0x0f,0x49,0x37,1024, 768,0x3ab5}, /* 0x15 */ - {0x0267,0x18,0x11,0x00,0x37,1024, 768,0x3aba}, /* 0x16 */ - {0x0047,0x19,0x16,0x8c,0x37,1024, 768,0x3abf}, /* 0x17 */ - {0x0047,0x1a,0x1b,0x00,0x37,1024, 768,0x3ac4}, /* 0x18 - 4047 */ - {0x0047,0x1b,0x1f,0x00,0x37,1024, 768,0x3ac9}, /* 0x19 - 4047 */ - {0x0387,0x1c,0x11,0x00,0x3a,1280,1024,0x3adc}, /* 0x1a */ - {0x0077,0x1d,0x19,0x07,0x3a,1280,1024,0x3ae1}, /* 0x1b */ - {0x0047,0x1e,0x1e,0x00,0x3a,1280,1024,0x3ae6}, /* 0x1c */ - {0x0007,0x1f,0x20,0x00,0x3a,1280,1024,0x3aeb}, /* 0x1d */ - {0x0007,0x20,0x21,0x00,0x3c,1600,1200,0x3af2}, /* 0x1e */ - {0x0007,0x21,0x22,0x00,0x3c,1600,1200,0x3af7}, /* 0x1f */ - {0x0007,0x22,0x23,0x00,0x3c,1600,1200,0x3afc}, /* 0x20 */ - {0x0007,0x23,0x25,0x00,0x3c,1600,1200,0x3b01}, /* 0x21 */ - {0x0007,0x24,0x26,0x00,0x3c,1600,1200,0x3b06}, /* 0x22 */ - {0x0007,0x25,0x2c,0x00,0x3c,1600,1200,0x3b0b}, /* 0x23 */ - {0x0007,0x26,0x34,0x00,0x3c,1600,1200,0x3b10}, /* 0x24 */ - {0x407f,0x00,0x00,0x00,0x40, 320, 200,0x3a34}, /* 0x25 */ - {0xc07f,0x01,0x00,0x04,0x50, 320, 240,0x3a3b}, /* 0x26 */ - {0x007f,0x02,0x04,0x05,0x51, 400, 300,0x3a42}, /* 0x27 */ - {0xc077,0x03,0x0b,0x06,0x52, 512, 384,0x3a49}, /* 0x28 */ - {0x8007,0x27,0x27,0x00,0x68,1920,1440,0x3b17}, /* 0x29 */ - {0x4007,0x28,0x29,0x00,0x68,1920,1440,0x3b1c}, /* 0x2a */ - {0x4007,0x29,0x2e,0x00,0x68,1920,1440,0x3b21}, /* 0x2b */ - {0x4007,0x2a,0x30,0x00,0x68,1920,1440,0x3b26}, /* 0x2c */ - {0x4007,0x2b,0x35,0x00,0x68,1920,1440,0x3b2b}, /* 0x2d */ - {0x4005,0x2c,0x39,0x00,0x68,1920,1440,0x3b30}, /* 0x2e */ - {0x4007,0x2d,0x2b,0x00,0x6c,2048,1536,0x3b37}, /* 0x2f */ - {0x4007,0x2e,0x31,0x00,0x6c,2048,1536,0x3b3c}, /* 0x30 */ - {0x4007,0x2f,0x33,0x00,0x6c,2048,1536,0x3b41}, /* 0x31 */ - {0x4007,0x30,0x37,0x00,0x6c,2048,1536,0x3b46}, /* 0x32 */ - {0x4005,0x31,0x38,0x00,0x6c,2048,1536,0x3b4b}, /* 0x33 */ - {0x0057,0x32,0x40,0x08,0x70, 800, 480,0x3b52}, /* 0x34 */ - {0x0047,0x33,0x07,0x08,0x70, 800, 480,0x3b57}, /* 0x35 */ - {0x0047,0x34,0x0a,0x08,0x70, 800, 480,0x3b5c}, /* 0x36 */ - {0x0057,0x35,0x0b,0x09,0x71,1024, 576,0x3b63}, /* 0x37 */ - {0x0047,0x36,0x11,0x09,0x71,1024, 576,0x3b68}, /* 0x38 */ - {0x0047,0x37,0x16,0x09,0x71,1024, 576,0x3b6d}, /* 0x39 */ - {0x0057,0x38,0x19,0x0a,0x75,1280, 720,0x3b74}, /* 0x3a */ - {0x0047,0x39,0x1e,0x0a,0x75,1280, 720,0x3b79}, /* 0x3b */ - {0x0047,0x3a,0x20,0x0a,0x75,1280, 720,0x3b7e}, /* 0x3c */ - {0x0027,0x3b,0x19,0x08,0x7c,1280, 960,0x3ad0}, /* 0x3d */ - {0x0047,0x4c,0x59,0x08,0x7c,1280, 960,0x3ad0}, /* 0x3e */ - {0xc07f,0x01,0x00,0x06,0x5a, 320, 480,0x3b83}, /* 0x3f */ /* FSTN mode */ - {0x0077,0x42,0x12,0x07,0x23,1280, 768,0x0000}, /* 0x40 */ /* TW: 650/LVDS/301LVx new mode */ - {0x0067,0x43,0x4d,0x08,0x26,1400,1050,0x0000}, /* 0x41 */ /* TW: 650/LVDS/301LVx new mode */ - {0x0067,0x4b,0x5a,0x08,0x26,1400,1050,0x0000}, /* 0x42 */ /* TW: new, not in any BIOS */ - {0x0047,0x44,0x19,0x06,0x29,1152, 864,0x0000}, /* 0x43 TW: Non-BIOS, new */ - {0x0047,0x4a,0x1e,0x06,0x29,1152, 864,0x0000}, /* 0x44 TW: Non-BIOS, new */ - {0x00c7,0x45,0x57,0x00,0x39, 848, 480,0x0000}, /* 0x45 TW: 848x480-38Hzi - Non-BIOS, new */ - {0xc047,0x46,0x55,0x00,0x39, 848, 480,0x0000}, /* 0x46 TW: 848x480-60Hz - Non-BIOS, new */ - {0x00c7,0x47,0x57,0x00,0x3f, 856, 480,0x0000}, /* 0x47 TW: 856x480-38Hzi - Non-BIOS, new */ - {0xc047,0x48,0x57,0x00,0x3f, 856, 480,0x0000}, /* 0x48 TW: 856x480-60Hz - Non-BIOS, new */ - {0x0047,0x49,0x58,0x00,0x48,1360, 768,0x0000}, /* 0x49 TW: 1360x768-60Hz - Non-BIOS, new */ - {0xffff,0x00,0x00,0x00,0x00, 0, 0,0x0000} +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/310vtbl.h,v 1.26 2004/02/25 23:22:15 twini Exp $ */ +/* + * Register settings for SiS 315/330 series + * + * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria + * + * If distributed as part of the Linux kernel, the following license terms + * apply: + * + * * This program is free software; you can redistribute it and/or modify + * * it under the terms of the GNU General Public License as published by + * * the Free Software Foundation; either version 2 of the named License, + * * or any later version. + * * + * * This program is distributed in the hope that it will be useful, + * * but WITHOUT ANY WARRANTY; without even the implied warranty of + * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * * GNU General Public License for more details. + * * + * * You should have received a copy of the GNU General Public License + * * along with this program; if not, write to the Free Software + * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA + * + * Otherwise, the following license terms apply: + * + * * Redistribution and use in source and binary forms, with or without + * * modification, are permitted provided that the following conditions + * * are met: + * * 1) Redistributions of source code must retain the above copyright + * * notice, this list of conditions and the following disclaimer. + * * 2) Redistributions in binary form must reproduce the above copyright + * * notice, this list of conditions and the following disclaimer in the + * * documentation and/or other materials provided with the distribution. + * * 3) The name of the author may not be used to endorse or promote products + * * derived from this software without specific prior written permission. + * * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR + * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Author: Thomas Winischhofer + * + */ + +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[]= +{ + {0x6a,0x2212,0x0102,SIS_RI_800x600, 0x00,0x00,0x07,0x06,0x00}, /* 800x600x? */ + {0x2e,0x0a1b,0x0101,SIS_RI_640x480, 0x00,0x00,0x05,0x05,0x08}, /* 640x480x8 */ + {0x2f,0x0a1b,0x0100,SIS_RI_640x400, 0x00,0x00,0x05,0x05,0x10}, /* 640x400x8 */ + {0x30,0x2a1b,0x0103,SIS_RI_800x600, 0x00,0x00,0x07,0x06,0x00}, /* 800x600x8 */ + {0x31,0x0a1b,0x0000,SIS_RI_720x480, 0x00,0x00,0x06,0x06,0x11}, /* 720x480x8 */ + {0x32,0x0a1b,0x0000,SIS_RI_720x576, 0x00,0x00,0x06,0x06,0x12}, /* 720x576x8 */ + {0x33,0x0a1d,0x0000,SIS_RI_720x480, 0x00,0x00,0x06,0x06,0x11}, /* 720x480x16 */ + {0x34,0x2a1d,0x0000,SIS_RI_720x576, 0x00,0x00,0x06,0x06,0x12}, /* 720x576x16 */ + {0x35,0x0a1f,0x0000,SIS_RI_720x480, 0x00,0x00,0x06,0x06,0x11}, /* 720x480x32 */ + {0x36,0x2a1f,0x0000,SIS_RI_720x576, 0x00,0x00,0x06,0x06,0x12}, /* 720x576x32 */ + {0x37,0x0212,0x0104,SIS_RI_1024x768, 0x00,0x00,0x08,0x07,0x13}, /* 1024x768x? */ + {0x38,0x0a1b,0x0105,SIS_RI_1024x768, 0x00,0x00,0x08,0x07,0x13}, /* 1024x768x8 */ + {0x3a,0x0e3b,0x0107,SIS_RI_1280x1024,0x00,0x00,0x00,0x00,0x1a}, /* 1280x1024x8 */ + {0x3c,0x0e3b,0x0130,SIS_RI_1600x1200,0x00,0x00,0x00,0x00,0x1e}, /* 1600x1200x8 */ + {0x3d,0x0e7d,0x0131,SIS_RI_1600x1200,0x00,0x00,0x00,0x00,0x1e}, /* 1600x1200x16 */ + {0x40,0x9a1c,0x010d,SIS_RI_320x200, 0x00,0x00,0x04,0x04,0x25}, /* 320x200x15 */ + {0x41,0x9a1d,0x010e,SIS_RI_320x200, 0x00,0x00,0x04,0x04,0x25}, /* 320x200x16 */ + {0x43,0x0a1c,0x0110,SIS_RI_640x480, 0x00,0x00,0x05,0x05,0x08}, + {0x44,0x0a1d,0x0111,SIS_RI_640x480, 0x00,0x00,0x05,0x05,0x08}, /* 640x480x16 */ + {0x46,0x2a1c,0x0113,SIS_RI_800x600, 0x00,0x00,0x07,0x06,0x00}, + {0x47,0x2a1d,0x0114,SIS_RI_800x600, 0x00,0x00,0x07,0x06,0x00}, /* 800x600x16 */ + {0x49,0x0a3c,0x0116,SIS_RI_1024x768, 0x00,0x00,0x00,0x07,0x13}, + {0x4a,0x0a3d,0x0117,SIS_RI_1024x768, 0x00,0x00,0x08,0x07,0x13}, /* 1024x768x16 */ + {0x4c,0x0e7c,0x0119,SIS_RI_1280x1024,0x00,0x00,0x00,0x00,0x1a}, + {0x4d,0x0e7d,0x011a,SIS_RI_1280x1024,0x00,0x00,0x00,0x00,0x1a}, /* 1280x1024x16 */ + {0x50,0x9a1b,0x0132,SIS_RI_320x240, 0x00,0x00,0x04,0x04,0x26}, /* 320x240x8 */ + {0x51,0xba1b,0x0133,SIS_RI_400x300, 0x00,0x00,0x07,0x07,0x27}, /* 400x300x8 */ + {0x52,0xba1b,0x0134,SIS_RI_512x384, 0x00,0x00,0x00,0x00,0x28}, /* 512x384x8 */ + {0x56,0x9a1d,0x0135,SIS_RI_320x240, 0x00,0x00,0x04,0x04,0x26}, /* 320x240x16 */ + {0x57,0xba1d,0x0136,SIS_RI_400x300, 0x00,0x00,0x07,0x07,0x27}, /* 400x300x16 */ + {0x58,0xba1d,0x0137,SIS_RI_512x384, 0x00,0x00,0x00,0x00,0x28}, /* 512x384x16 */ + {0x59,0x9a1b,0x0138,SIS_RI_320x200, 0x00,0x00,0x04,0x04,0x25}, /* 320x200x8 */ + {0x5a,0x021b,0x0138,SIS_RI_320x240, 0x00,0x00,0x00,0x00,0x3f}, /* 320x240x8 fstn */ + {0x5b,0x0a1d,0x0135,SIS_RI_320x240, 0x00,0x00,0x00,0x00,0x3f}, /* 320x240x16 fstn */ + {0x5c,0xba1f,0x0000,SIS_RI_512x384, 0x00,0x00,0x00,0x00,0x28}, /* 512x384x32 */ + {0x5d,0x0a1d,0x0139,SIS_RI_640x400, 0x00,0x00,0x05,0x07,0x10}, + {0x5e,0x0a1f,0x0000,SIS_RI_640x400, 0x00,0x00,0x05,0x07,0x10}, /* 640x400x32 */ + {0x62,0x0a3f,0x013a,SIS_RI_640x480, 0x00,0x00,0x05,0x05,0x08}, /* 640x480x32 */ + {0x63,0x2a3f,0x013b,SIS_RI_800x600, 0x00,0x00,0x07,0x06,0x00}, /* 800x600x32 */ + {0x64,0x0a7f,0x013c,SIS_RI_1024x768, 0x00,0x00,0x08,0x07,0x13}, /* 1024x768x32 */ + {0x65,0x0eff,0x013d,SIS_RI_1280x1024,0x00,0x00,0x00,0x00,0x1a}, /* 1280x1024x32 */ + {0x66,0x0eff,0x013e,SIS_RI_1600x1200,0x00,0x00,0x00,0x00,0x1e}, /* 1600x1200x32 */ + {0x68,0x067b,0x013f,SIS_RI_1920x1440,0x00,0x00,0x00,0x00,0x29}, /* 1920x1440x8 */ + {0x69,0x06fd,0x0140,SIS_RI_1920x1440,0x00,0x00,0x00,0x00,0x29}, /* 1920x1440x16 */ + {0x6b,0x07ff,0x0141,SIS_RI_1920x1440,0x00,0x00,0x00,0x00,0x29}, /* 1920x1440x32 */ + {0x6c,0x067b,0x0000,SIS_RI_2048x1536,0x00,0x00,0x00,0x00,0x2f}, /* 2048x1536x8 */ + {0x6d,0x06fd,0x0000,SIS_RI_2048x1536,0x00,0x00,0x00,0x00,0x2f}, /* 2048x1536x16 */ + {0x6e,0x07ff,0x0000,SIS_RI_2048x1536,0x00,0x00,0x00,0x00,0x2f}, /* 2048x1536x32 */ + {0x70,0x2a1b,0x0000,SIS_RI_800x480, 0x00,0x00,0x07,0x07,0x34}, /* 800x480x8 */ + {0x71,0x0a1b,0x0000,SIS_RI_1024x576, 0x00,0x00,0x00,0x00,0x37}, /* 1024x576x8 */ + {0x74,0x0a1d,0x0000,SIS_RI_1024x576, 0x00,0x00,0x00,0x00,0x37}, /* 1024x576x16 */ + {0x75,0x0a3d,0x0000,SIS_RI_1280x720, 0x00,0x00,0x00,0x00,0x3a}, /* 1280x720x16 */ + {0x76,0x2a1f,0x0000,SIS_RI_800x480, 0x00,0x00,0x07,0x07,0x34}, /* 800x480x32 */ + {0x77,0x0a1f,0x0000,SIS_RI_1024x576, 0x00,0x00,0x00,0x00,0x37}, /* 1024x576x32 */ + {0x78,0x0a3f,0x0000,SIS_RI_1280x720, 0x00,0x00,0x00,0x00,0x3a}, /* 1280x720x32 */ + {0x79,0x0a3b,0x0000,SIS_RI_1280x720, 0x00,0x00,0x00,0x00,0x3a}, /* 1280x720x8 */ + {0x7a,0x2a1d,0x0000,SIS_RI_800x480, 0x00,0x00,0x07,0x07,0x34}, /* 800x480x16 */ + {0x7c,0x0e3b,0x0000,SIS_RI_1280x960, 0x00,0x00,0x00,0x00,0x3d}, /* 1280x960x8 */ + {0x7d,0x0e7d,0x0000,SIS_RI_1280x960, 0x00,0x00,0x00,0x00,0x3d}, /* 1280x960x16 */ + {0x7e,0x0eff,0x0000,SIS_RI_1280x960, 0x00,0x00,0x00,0x00,0x3d}, /* 1280x960x32 */ + {0x23,0x0e3b,0x0000,SIS_RI_1280x768, 0x00,0x00,0x00,0x00,0x40}, /* 1280x768x8 */ + {0x24,0x0e7d,0x0000,SIS_RI_1280x768, 0x00,0x00,0x00,0x00,0x40}, /* 1280x768x16 */ + {0x25,0x0eff,0x0000,SIS_RI_1280x768, 0x00,0x00,0x00,0x00,0x40}, /* 1280x768x32 */ + {0x26,0x0e3b,0x0000,SIS_RI_1400x1050,0x00,0x00,0x00,0x00,0x41}, /* 1400x1050x8 */ + {0x27,0x0e7d,0x0000,SIS_RI_1400x1050,0x00,0x00,0x00,0x00,0x41}, /* 1400x1050x16 */ + {0x28,0x0eff,0x0000,SIS_RI_1400x1050,0x00,0x00,0x00,0x00,0x41}, /* 1400x1050x32*/ + {0x29,0x0e1b,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x43}, /* 1152x864 */ + {0x2a,0x0e3d,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x43}, + {0x2b,0x0e7f,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x43}, + {0x39,0x2a1b,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x45}, /* 848x480 */ + {0x3b,0x2a3d,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x45}, + {0x3e,0x2a7f,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x45}, + {0x3f,0x2a1b,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x47}, /* 856x480 */ + {0x42,0x2a3d,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x47}, + {0x45,0x2a7f,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x47}, + {0x48,0x2a1b,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x49}, /* 1360x768 */ + {0x4b,0x2a3d,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x49}, + {0x4e,0x2a7f,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x49}, + {0x4f,0x9a1f,0x0000,SIS_RI_320x200, 0x00,0x00,0x04,0x04,0x25}, /* 320x200x32 */ + {0x53,0x9a1f,0x0000,SIS_RI_320x240, 0x00,0x00,0x04,0x04,0x26}, /* 320x240x32 */ + {0x54,0xba1f,0x0000,SIS_RI_400x300, 0x00,0x00,0x07,0x07,0x27}, /* 400x300x32 */ + {0x5f,0x2a1b,0x0000,SIS_RI_768x576, 0x00,0x00,0x06,0x06,0x4a}, /* 768x576 */ + {0x60,0x2a1d,0x0000,SIS_RI_768x576, 0x00,0x00,0x06,0x06,0x4a}, + {0x61,0x2a1f,0x0000,SIS_RI_768x576, 0x00,0x00,0x06,0x06,0x4a}, + {0x14,0x0e1b,0x0000,SIS_RI_1280x800, 0x00,0x00,0x00,0x00,0x4b}, /* 1280x800 */ + {0x15,0x0e3d,0x0000,SIS_RI_1280x800, 0x00,0x00,0x00,0x00,0x4b}, + {0x16,0x0e7f,0x0000,SIS_RI_1280x800, 0x00,0x00,0x00,0x00,0x4b}, + {0x17,0x0e1b,0x0000,SIS_RI_1680x1050,0x00,0x00,0x00,0x00,0x4c}, /* 1680x1050 */ + {0x18,0x0e3d,0x0000,SIS_RI_1680x1050,0x00,0x00,0x00,0x00,0x4c}, + {0x19,0x0e7f,0x0000,SIS_RI_1680x1050,0x00,0x00,0x00,0x00,0x4c}, + {0xff,0x0000,0x0000,0, 0x00,0x00,0x00,0x00,0x00} +}; + +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 */ + {0xc04f,0x3c,0x01,0x06,0x00,0x31, 720, 480, 0x30}, /* 0x11 */ + {0x004f,0x3d,0x03,0x06,0x00,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 */ + {0x0057,0x32,0x40,0x08,0x00,0x70, 800, 480, 0x30}, /* 0x34 */ + {0x0047,0x33,0x07,0x08,0x00,0x70, 800, 480, 0x30}, /* 0x35 */ + {0x0047,0x34,0x0a,0x08,0x00,0x70, 800, 480, 0x30}, /* 0x36 */ + {0x0057,0x35,0x0b,0x09,0x00,0x71,1024, 576, 0x30}, /* 0x37 */ + {0x0047,0x36,0x11,0x09,0x00,0x71,1024, 576, 0x30}, /* 0x38 */ + {0x0047,0x37,0x16,0x09,0x00,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 */ + {0x0107,0x44,0x19,0x00,0x00,0x29,1152, 864, 0x30}, /* 0x43 1152x864-75Hz */ + {0x0107,0x4a,0x1e,0x00,0x00,0x29,1152, 864, 0x30}, /* 0x44 1152x864-85Hz */ + {0x0087,0x45,0x57,0x00,0x00,0x39, 848, 480, 0x30}, /* 0x45 848x480-38Hzi */ + {0xc067,0x46,0x55,0x0b,0x00,0x39, 848, 480, 0x30}, /* 0x46 848x480-60Hz */ + {0x0087,0x47,0x57,0x00,0x00,0x3f, 856, 480, 0x30}, /* 0x47 856x480-38Hzi */ + {0xc047,0x48,0x57,0x00,0x00,0x3f, 856, 480, 0x30}, /* 0x48 856x480-60Hz */ + {0x0067,0x49,0x58,0x0c,0x00,0x48,1360, 768, 0x30}, /* 0x49 1360x768-60Hz */ + {0x004f,0x4d,0x03,0x06,0x00,0x5f, 768, 576, 0x30}, /* 0x4a 768x576-56Hz */ + {0x0067,0x4f,0x5c,0x08,0x0d,0x14,1280, 800, 0x30}, /* 0x4b 1280x800-60Hz */ + {0x0067,0x50,0x5d,0x0c,0x0e,0x17,1680,1050, 0x30}, /* 0x4c 1680x1050-60Hz */ + {0xffff,0x00,0x00,0x00,0x00,0x00, 0, 0, 0} }; -typedef struct _SiS310_CRT1TableStruct -{ - UCHAR CR[17]; -} SiS310_CRT1TableStruct; - -static const SiS310_CRT1TableStruct SiS310_CRT1Table[]= +static const SiS_CRT1TableStruct SiS310_CRT1Table[]= { {{0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f, 0x9c,0x8e,0x8f,0x96,0xb9,0x30,0x00,0x00, @@ -720,11 +267,11 @@ {{0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, 0x9c,0x8e,0x8f,0x96,0xb9,0x30,0x00,0x05, 0x00}}, /* 0x4 */ -#if 0 +#if 0 {{0x5f,0x4f,0x50,0x82,0x55,0x81,0x0b,0x3e, 0xe9,0x8b,0xdf,0xe7,0x04,0x00,0x00,0x05, 0x00}}, /* 0x5 */ -#endif +#endif {{0x5f,0x4f,0x4f,0x83,0x55,0x81,0x0b,0x3e, /* 0x05 - corrected 640x480-60 */ 0xe9,0x8b,0xdf,0xe8,0x0c,0x00,0x00,0x05, 0x00}}, @@ -743,16 +290,16 @@ 0xe0,0x83,0xdf,0xdf,0xfc,0x10,0x00,0x05, 0x00}}, /* 0x8 */ {{0x65,0x4f,0x4f,0x89,0x58,0x80,0xfb,0x1f, - 0xe0,0x83,0xdf,0xdf,0xfc,0x10,0x00,0x05, /* TW: Corrected VBE */ + 0xe0,0x83,0xdf,0xdf,0xfc,0x10,0x00,0x05, /* Corrected VBE */ 0x61}}, /* 0x9 */ {{0x65,0x4f,0x4f,0x89,0x58,0x80,0x01,0x3e, 0xe0,0x83,0xdf,0xdf,0x02,0x00,0x00,0x05, 0x61}}, /* 0xa */ {{0x67,0x4f,0x4f,0x8b,0x58,0x81,0x0d,0x3e, - 0xe0,0x83,0xdf,0xdf,0x0e,0x00,0x00,0x05, /* TW: Corrected VBE */ + 0xe0,0x83,0xdf,0xdf,0x0e,0x00,0x00,0x05, /* Corrected VBE */ 0x61}}, /* 0xb */ {{0x65,0x4f,0x4f,0x89,0x57,0x9f,0xfb,0x1f, - 0xe6,0x8a,0xdf,0xdf,0xfc,0x10,0x00,0x01, /* TW: Corrected VDE, VBE */ + 0xe6,0x8a,0xdf,0xdf,0xfc,0x10,0x00,0x01, /* Corrected VDE, VBE */ 0x00}}, /* 0xc */ {{0x7b,0x63,0x63,0x9f,0x6a,0x93,0x6f,0xf0, 0x58,0x8a,0x57,0x57,0x70,0x20,0x00,0x05, @@ -880,7 +427,7 @@ {{0x9f,0x7f,0x7f,0x83,0x85,0x91,0x1e,0xf1, 0xad,0x81,0x3f,0x3f,0x1f,0x30,0x00,0x02, 0x01}}, /* 0x36 */ - {{0xa7,0x7f,0x7f,0x88,0x89,0x95,0x26,0xf1, /* TW: 95 was 15 - illegal HBE! */ + {{0xa7,0x7f,0x7f,0x88,0x89,0x95,0x26,0xf1, /* 95 was 15 - illegal HBE! */ 0xb1,0x85,0x3f,0x3f,0x27,0x30,0x00,0x02, 0x01}}, /* 0x37 */ {{0xce,0x9f,0x9f,0x92,0xa9,0x17,0x28,0xc4, @@ -912,7 +459,7 @@ {{0x81,0x6a,0x6a,0x85,0x70,0x00,0x0f,0x3e, 0xeb,0x8e,0xdf,0xdf,0x10,0x00,0x00,0x02, 0x00}}, /* 0x3f */ - {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x1e,0xf1, /* TW: The following from 650/LVDS BIOS */ + {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x1e,0xf1, 0xae,0x85,0x57,0x57,0x1f,0x30,0x00,0x02, 0x01}}, /* 0x40 */ {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf5, @@ -924,50 +471,50 @@ {{0xe6,0xae,0xae,0x8a,0xbd,0x90,0x3d,0x10, 0x1a,0x8d,0x19,0x19,0x3e,0x2f,0x00,0x03, 0x00}}, /* 0x43 */ - {{0xc3,0x8f,0x8f,0x87,0x9b,0x0b,0x82,0xef, /* TW: New, 1152x864-75, not in any BIOS */ + {{0xc3,0x8f,0x8f,0x87,0x9b,0x0b,0x82,0xef, /* 1152x864-75 */ 0x60,0x83,0x5f,0x5f,0x83,0x10,0x00,0x07, 0x01}}, /* 0x44 */ - {{0x86,0x69,0x69,0x8A,0x74,0x06,0x8C,0x15, /* TW: New, 848x480-38i, not in BIOS */ + {{0x86,0x69,0x69,0x8A,0x74,0x06,0x8C,0x15, /* 848x480-38i */ 0x4F,0x83,0xEF,0xEF,0x8D,0x30,0x00,0x02, 0x00}}, /* 0x45 */ -#if 0 - {{0x81,0x69,0x69,0x85,0x70,0x00,0x0F,0x3E, /* TW: New, 848x480-60, not in BIOS - incorrect for Philips panel */ - 0xEB,0x8E,0xDF,0xDF,0x10,0x00,0x00,0x02, - 0x00}}, /* 0x46 */ -#endif - {{0x83,0x69,0x69,0x87,0x6f,0x1d,0x03,0x3E, /* TW: New, 848x480-60, not in BIOS */ + {{0x83,0x69,0x69,0x87,0x6f,0x1d,0x03,0x3E, /* 848x480-60 */ 0xE5,0x8d,0xDF,0xe4,0x04,0x00,0x00,0x06, 0x00}}, /* 0x46 */ - {{0x86,0x6A,0x6A,0x8A,0x74,0x06,0x8C,0x15, /* TW: New, 856x480-38i, not in BIOS */ + {{0x86,0x6A,0x6A,0x8A,0x74,0x06,0x8C,0x15, /* 856x480-38i */ 0x4F,0x83,0xEF,0xEF,0x8D,0x30,0x00,0x02, 0x00}}, /* 0x47 */ - {{0x81,0x6A,0x6A,0x85,0x70,0x00,0x0F,0x3E, /* TW: New, 856x480-60, not in BIOS */ + {{0x81,0x6A,0x6A,0x85,0x70,0x00,0x0F,0x3E, /* 856x480-60 */ 0xEB,0x8E,0xDF,0xDF,0x10,0x00,0x00,0x02, 0x00}}, /* 0x48 */ - {{0xdd,0xa9,0xa9,0x81,0xb4,0x97,0x26,0xfd, /* TW: New, 1360x768-60, not in BIOS */ + {{0xdd,0xa9,0xa9,0x81,0xb4,0x97,0x26,0xfd, /* 1360x768-60 */ 0x01,0x8d,0xff,0x00,0x27,0x10,0x00,0x03, 0x01}}, /* 0x49 */ - {{0xd9,0x8f,0x8f,0x9d,0xba,0x0a,0x8a,0xff, /* TW: New, 1152x864-84, not in any BIOS */ + {{0xd9,0x8f,0x8f,0x9d,0xba,0x0a,0x8a,0xff, /* 1152x864-84 */ 0x60,0x8b,0x5f,0x5f,0x8b,0x10,0x00,0x03, 0x01}}, /* 0x4a */ - {{0xea,0xae,0xae,0x8e,0xba,0x82,0x40,0x10, /* TW: New, 1400x1050-75, not in any BIOS */ + {{0xea,0xae,0xae,0x8e,0xba,0x82,0x40,0x10, /* 1400x1050-75 */ 0x1b,0x87,0x19,0x1a,0x41,0x0f,0x00,0x03, - 0x00}}, /* 0x4b */ - {{0xd3,0x9f,0x9f,0x97,0xab,0x1f,0xf1,0xff, /* TW: New, 1280x960-85, not in any BIOS */ + 0x00}}, /* 0x4b */ + {{0xd3,0x9f,0x9f,0x97,0xab,0x1f,0xf1,0xff, /* 1280x960-85 */ 0xc0,0x83,0xbf,0xbf,0xf2,0x10,0x00,0x07, - 0x01}} /* 0x4c */ + 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, + 0x00}}, /* 0x4e */ + {{0xcd,0x9f,0x9f,0x91,0xab,0x1c,0x3a,0xff, /* 1280x800-60 */ + 0x20,0x83,0x1f,0x1f,0x3b,0x10,0x00,0x07, + 0x21}}, /* 0x4f */ + {{0x15,0xd1,0xd1,0x99,0xe2,0x19,0x3d,0x10, /* 1680x1050-60 */ + 0x1a,0x8d,0x19,0x19,0x3e,0x2f,0x01,0x0c, + 0x20}} /* 0x50 */ }; - -typedef struct _SiS310_MCLKDataStruct -{ - UCHAR SR28,SR29,SR2A; - USHORT CLOCK; -} SiS310_MCLKDataStruct; - -static const SiS310_MCLKDataStruct SiS310_MCLKData_0_315[] = +static const SiS_MCLKDataStruct SiS310_MCLKData_0_315[] = { - { 0x3b,0x22,0x01,143}, /* TW: Was { 0x5c,0x23,0x01,166}, */ + { 0x3b,0x22,0x01,143}, { 0x5c,0x23,0x01,166}, { 0x5c,0x23,0x01,166}, { 0x5c,0x23,0x01,166}, @@ -977,7 +524,7 @@ { 0x5c,0x23,0x01,166} }; -static const SiS310_MCLKDataStruct SiS310_MCLKData_0_650[] = /* @ 0x54 */ +static const SiS_MCLKDataStruct SiS310_MCLKData_0_650[] = { { 0x5a,0x64,0x82, 66}, { 0xb3,0x45,0x82, 83}, @@ -989,7 +536,7 @@ { 0x37,0x22,0x82,133} }; -static const SiS310_MCLKDataStruct SiS310_MCLKData_0_330[] = /* @ 0x54 */ +static const SiS_MCLKDataStruct SiS310_MCLKData_0_330[] = { { 0x5c,0x23,0x01,166}, { 0x5c,0x23,0x01,166}, @@ -1001,56 +548,60 @@ { 0x79,0x06,0x01,250} }; -static const SiS310_MCLKDataStruct SiS310_MCLKData_1[] = /* @ 0x155 */ +static const SiS_MCLKDataStruct SiS310_MCLKData_0_660[] = { - { 0x29,0x21,0x82,150}, { 0x5c,0x23,0x82,166}, - { 0x65,0x23,0x82,183}, + { 0x5c,0x23,0x82,166}, { 0x37,0x21,0x82,200}, { 0x37,0x22,0x82,133}, - { 0x37,0x22,0x82,133}, - { 0x37,0x22,0x82,133}, - { 0x37,0x22,0x82,133} + { 0x29,0x21,0x82,150}, + { 0x5c,0x23,0x82,166}, + { 0x65,0x23,0x82,183}, + { 0x37,0x21,0x82,200} }; -typedef struct _SiS310_ECLKDataStruct +static const SiS_MCLKDataStruct SiS310_MCLKData_0_760[] = { - UCHAR SR2E,SR2F,SR30; - USHORT CLOCK; -} SiS310_ECLKDataStruct; + { 0x37,0x22,0x82,133}, + { 0x5c,0x23,0x82,166}, + { 0x65,0x23,0x82,183}, + { 0x7c,0x08,0x82,200}, + { 0x29,0x21,0x82,150}, + { 0x5c,0x23,0x82,166}, + { 0x65,0x23,0x82,183}, + { 0x37,0x21,0x82,200} +}; -static const SiS310_ECLKDataStruct SiS310_ECLKData[]= +static const SiS_MCLKDataStruct SiS310_MCLKData_1[] = /* ECLK */ { - { 0x5c,0x23,0x01,166}, - { 0x5c,0x23,0x01,166}, - { 0x5c,0x23,0x01,166}, - { 0x5c,0x23,0x01,166} + { 0x29,0x21,0x82,150}, + { 0x5c,0x23,0x82,166}, + { 0x65,0x23,0x82,183}, + { 0x37,0x21,0x82,200}, + { 0x37,0x22,0x82,133}, + { 0x37,0x22,0x82,133}, + { 0x37,0x22,0x82,133}, + { 0x37,0x22,0x82,133} }; -typedef struct _SiS310_VCLKDataStruct +static SiS_VCLKDataStruct SiS310_VCLKData[]= { - UCHAR SR2B,SR2C; - USHORT CLOCK; -} SiS310_VCLKDataStruct; - -static const SiS310_VCLKDataStruct SiS310_VCLKData[]= -{ - { 0x1b,0xe1, 25}, /* 0x0 */ /* 650/LVDS BIOS: @ 0x5647 */ - { 0x4e,0xe4, 28}, /* 0x1 */ - { 0x57,0xe4, 31}, /* 0x2 */ - { 0xc3,0xc8, 36}, /* 0x3 */ - { 0x42,0xe2, 40}, /* 0x4 */ - { 0xfe,0xcd, 43}, /* 0x5 */ - { 0x5d,0xc4, 44}, /* 0x6 */ - { 0x52,0xe2, 49}, /* 0x7 */ - { 0x53,0xe2, 50}, /* 0x8 */ - { 0x74,0x67, 52}, /* 0x9 */ - { 0x6d,0x66, 56}, /* 0xa */ - { 0x5a,0x64, 65}, /* 0xb */ /* TW: was 6c c3 - WRONG */ - { 0x46,0x44, 67}, /* 0xc */ - { 0xb1,0x46, 68}, /* 0xd */ - { 0xd3,0x4a, 72}, /* 0xe */ - { 0x29,0x61, 75}, /* 0xf */ + { 0x1b,0xe1, 25}, /* 0x00 */ + { 0x4e,0xe4, 28}, /* 0x01 */ + { 0x57,0xe4, 31}, /* 0x02 */ + { 0xc3,0xc8, 36}, /* 0x03 */ + { 0x42,0xe2, 40}, /* 0x04 */ + { 0xfe,0xcd, 43}, /* 0x05 */ + { 0x5d,0xc4, 44}, /* 0x06 */ + { 0x52,0xe2, 49}, /* 0x07 */ + { 0x53,0xe2, 50}, /* 0x08 */ + { 0x74,0x67, 52}, /* 0x09 */ + { 0x6d,0x66, 56}, /* 0x0a */ + { 0x5a,0x64, 65}, /* 0x0b */ /* was 6c c3 - WRONG */ + { 0x46,0x44, 67}, /* 0x0c */ + { 0xb1,0x46, 68}, /* 0x0d */ + { 0xd3,0x4a, 72}, /* 0x0e */ + { 0x29,0x61, 75}, /* 0x0f */ { 0x6e,0x46, 76}, /* 0x10 */ { 0x2b,0x61, 78}, /* 0x11 */ { 0x31,0x42, 79}, /* 0x12 */ @@ -1093,66 +644,68 @@ { 0xea,0x08,340}, /* 0x37 */ { 0xe8,0x07,376}, /* 0x38 */ { 0xde,0x06,389}, /* 0x39 */ - { 0x52,0x2a, 54}, /* 0x3a */ - { 0x52,0x6a, 27}, /* 0x3b */ - { 0x62,0x24, 70}, /* 0x3c */ - { 0x62,0x64, 70}, /* 0x3d */ - { 0xa8,0x4c, 30}, /* 0x3e */ - { 0x20,0x26, 33}, /* 0x3f */ + { 0x52,0x2a, 54}, /* 0x3a 301 TV */ + { 0x52,0x6a, 27}, /* 0x3b 301 TV */ + { 0x62,0x24, 70}, /* 0x3c 301 TV */ + { 0x62,0x64, 70}, /* 0x3d 301 TV */ + { 0xa8,0x4c, 30}, /* 0x3e 301 TV */ + { 0x20,0x26, 33}, /* 0x3f 301 TV */ { 0x31,0xc2, 39}, /* 0x40 */ - /* TW: 650/LVDS BIOS @ 0x574b new: */ - { 0x60,0x36, 30}, /* 0x41 */ /* Chrontel */ - { 0x40,0x4a, 28}, /* 0x42 */ /* Chrontel */ - { 0x9f,0x46, 44}, /* 0x43 */ /* Chrontel */ + { 0x60,0x36, 30}, /* 0x41 Chrontel */ + { 0x40,0x4a, 28}, /* 0x42 Chrontel */ + { 0x9f,0x46, 44}, /* 0x43 Chrontel */ { 0x97,0x2c, 26}, /* 0x44 */ - { 0x44,0xe4, 25}, /* 0x45 */ /* Chrontel */ - { 0x7e,0x32, 47}, /* 0x46 */ /* Chrontel */ - { 0x8a,0x24, 31}, /* 0x47 */ /* Chrontel */ - { 0x97,0x2c, 26}, /* 0x48 */ /* Chrontel */ + { 0x44,0xe4, 25}, /* 0x45 Chrontel */ + { 0x7e,0x32, 47}, /* 0x46 Chrontel */ + { 0x8a,0x24, 31}, /* 0x47 Chrontel */ + { 0x97,0x2c, 26}, /* 0x48 Chrontel */ { 0xce,0x3c, 39}, /* 0x49 */ - { 0x52,0x4a, 36}, /* 0x4a */ /* Chrontel */ + { 0x52,0x4a, 36}, /* 0x4a Chrontel */ { 0x34,0x61, 95}, /* 0x4b */ - { 0x78,0x27,108}, /* 0x4c - was 102 */ /* TW: Last entry in 650/301 BIOS */ - { 0x66,0x43,123}, /* 0x4d */ /* Modes 0x26-0x28 (1400x1050) */ + { 0x78,0x27,108}, /* 0x4c - was 102 */ + { 0x66,0x43,123}, /* 0x4d Modes 0x26-0x28 (1400x1050) */ { 0x41,0x4e, 21}, /* 0x4e */ - { 0xa1,0x4a, 29}, /* 0x4f */ /* Chrontel */ + { 0xa1,0x4a, 29}, /* 0x4f Chrontel */ { 0x19,0x42, 42}, /* 0x50 */ - { 0x54,0x46, 58}, /* 0x51 */ /* Chrontel */ + { 0x54,0x46, 58}, /* 0x51 Chrontel */ { 0x25,0x42, 61}, /* 0x52 */ - { 0x44,0x44, 66}, /* 0x53 */ /* Chrontel */ - { 0x3a,0x62, 70}, /* 0x54 */ /* Chrontel */ - { 0x62,0xc6, 34}, /* 0x55 - added for 848x480-60 (not in any BIOS) */ - { 0x6a,0xc6, 37}, /* 0x56 - added for 848x480-75 (not in any BIOS) - TEMP */ - { 0xbf,0xc8, 35}, /* 0x57 - added for 856x480-38i,60 (not in any BIOS) */ - { 0x30,0x23, 88}, /* 0x58 - added for 1360x768-62 (is 60Hz!) (not in any BIOS) - TEMP */ - { 0x52,0x07,149}, /* 0x59 - added for 1280x960-85 (Not in any BIOS) */ - { 0x56,0x07,156} /* 0x5a - added for 1400x1050-75 */ -}; - -typedef struct _SiS310_VBVCLKDataStruct -{ - UCHAR Part4_A,Part4_B; - USHORT CLOCK; -} SiS310_VBVCLKDataStruct; - -static const SiS310_VBVCLKDataStruct SiS310_VBVCLKData[]= -{ - { 0x1b,0xe1, 25}, /* 0x0 */ /* 650/LVDS BIOS: @ 0x579c */ - { 0x4e,0xe4, 28}, /* 0x1 */ - { 0x57,0xe4, 31}, /* 0x2 */ - { 0xc3,0xc8, 36}, /* 0x3 */ - { 0x42,0x47, 40}, /* 0x4 */ - { 0xfe,0xcd, 43}, /* 0x5 */ - { 0x5d,0xc4, 44}, /* 0x6 */ - { 0x52,0x47, 49}, /* 0x7 */ - { 0x53,0x47, 50}, /* 0x8 */ - { 0x74,0x67, 52}, /* 0x9 */ - { 0x6d,0x66, 56}, /* 0xa */ - { 0x35,0x62, 65}, /* 0xb */ /* Was 0x5a,0x64 - 650/LVDS+301 bios: 35,62 */ - { 0x46,0x44, 67}, /* 0xc */ - { 0xb1,0x46, 68}, /* 0xd */ - { 0xd3,0x4a, 72}, /* 0xe */ - { 0x29,0x61, 75}, /* 0xf */ + { 0x44,0x44, 66}, /* 0x53 Chrontel */ + { 0x3a,0x62, 70}, /* 0x54 Chrontel */ + { 0x62,0xc6, 34}, /* 0x55 848x480-60 */ + { 0x6a,0xc6, 37}, /* 0x56 848x480-75 - TEMP */ + { 0xbf,0xc8, 35}, /* 0x57 856x480-38i,60 */ + { 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 */ + { 0x45,0x25, 83}, /* 0x5c 1280x800 */ + { 0x70,0x0a,147}, /* 0x5d 1680x1050 */ + { 0x70,0x24,162}, /* 0x5e 1600x1200 */ + { 0x5a,0x64, 65}, /* 0x5f 1280x720 - temp */ + { 0x63,0x46, 68}, /* 0x60 1280x768_2 */ + { 0x31,0x42, 79}, /* 0x61 1280x768_3 - temp */ + { 0, 0, 0}, /* 0x62 - custom (will be filled out at run-time) */ + { 0x5a,0x64, 65} /* 0x63 1280x720 (LCD LVDS) */ +}; + +static SiS_VBVCLKDataStruct SiS310_VBVCLKData[]= +{ + { 0x1b,0xe1, 25}, /* 0x00 */ + { 0x4e,0xe4, 28}, /* 0x01 */ + { 0x57,0xe4, 31}, /* 0x02 */ + { 0xc3,0xc8, 36}, /* 0x03 */ + { 0x42,0x47, 40}, /* 0x04 */ + { 0xfe,0xcd, 43}, /* 0x05 */ + { 0x5d,0xc4, 44}, /* 0x06 */ + { 0x52,0x47, 49}, /* 0x07 */ + { 0x53,0x47, 50}, /* 0x08 */ + { 0x74,0x67, 52}, /* 0x09 */ + { 0x6d,0x66, 56}, /* 0x0a */ + { 0x35,0x62, 65}, /* 0x0b */ /* Was 0x5a,0x64 - 650/LVDS+301: 35,62 */ + { 0x46,0x44, 67}, /* 0x0c */ + { 0xb1,0x46, 68}, /* 0x0d */ + { 0xd3,0x4a, 72}, /* 0x0e */ + { 0x29,0x61, 75}, /* 0x0f */ { 0x6d,0x46, 75}, /* 0x10 */ { 0x41,0x43, 78}, /* 0x11 */ { 0x31,0x42, 79}, /* 0x12 */ @@ -1162,15 +715,21 @@ { 0x62,0x44, 94}, /* 0x16 */ { 0x2b,0x22,104}, /* 0x17 */ { 0x49,0x24,105}, /* 0x18 */ - { 0xf8,0x2f,108}, /* 0x19 */ + { 0xf8,0x2f,108}, /* 0x19 */ /* 1400x1050 LCD */ { 0x3c,0x23,109}, /* 0x1a */ { 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 */ + { 0x70,0x09,162}, /* 0x21 */ /* 1600x1200-60, better clock for VGA2 */ { 0x30,0x21,175}, /* 0x22 */ { 0x4e,0x22,189}, /* 0x23 */ { 0xde,0x26,194}, /* 0x24 */ @@ -1195,88 +754,51 @@ { 0xea,0x08,340}, /* 0x37 */ { 0xe8,0x07,376}, /* 0x38 */ { 0xde,0x06,389}, /* 0x39 */ - { 0x52,0x2a, 54}, /* 0x3a */ - { 0x52,0x6a, 27}, /* 0x3b */ - { 0x62,0x24, 70}, /* 0x3c */ - { 0x62,0x64, 70}, /* 0x3d */ - { 0xa8,0x4c, 30}, /* 0x3e */ - { 0x20,0x26, 33}, /* 0x3f */ + { 0x52,0x2a, 54}, /* 0x3a 301 TV - start */ + { 0x52,0x6a, 27}, /* 0x3b 301 TV */ + { 0x62,0x24, 70}, /* 0x3c 301 TV */ + { 0x62,0x64, 70}, /* 0x3d 301 TV */ + { 0xa8,0x4c, 30}, /* 0x3e 301 TV */ + { 0x20,0x26, 33}, /* 0x3f 301 TV */ { 0x31,0xc2, 39}, /* 0x40 */ - /* TW: 650/LVDS+301 BIOS (@ 0x58a0 in LVDS) new: */ - { 0x2e,0x48, 25}, /* 0x41 */ - { 0x24,0x46, 25}, /* 0x42 */ - { 0x26,0x64, 28}, /* 0x43 */ - { 0x37,0x64, 40}, /* 0x44 */ - { 0xa1,0x42,108}, /* 0x45 */ - { 0x37,0x61,100}, /* 0x46 */ - { 0x78,0x27,108} /* 0x47 */ - /* --- 0x58bc --- */ -}; - -static const UCHAR SiS310_ScreenOffset[] = -{ - 0x14,0x19,0x20,0x28,0x32,0x40,0x50,0x64, - 0x78,0x80,0x2d,0x35,0x57,0x48,0x55, - 0xff -}; /* TW: Added 1400x1050, 1152x864, 848/856x480, 1360x768 */ - -typedef struct _SiS310_StResInfoStruct -{ - USHORT HTotal; - USHORT VTotal; -} SiS310_StResInfoStruct; - -static const SiS310_StResInfoStruct SiS310_StResInfo[]= -{ - { 640,400}, - { 640,350}, - { 720,400}, - { 720,350}, - { 640,480} -}; - -typedef struct _SiS310_ModeResInfoStruct -{ - USHORT HTotal; - USHORT VTotal; - UCHAR XChar; - UCHAR YChar; -} SiS310_ModeResInfoStruct; - -static const SiS310_ModeResInfoStruct SiS310_ModeResInfo[] = -{ - { 320, 200, 8, 8}, /* 0x00 */ - { 320, 240, 8, 8}, /* 0x01 */ - { 320, 400, 8, 8}, /* 0x02 */ - { 400, 300, 8, 8}, /* 0x03 */ - { 512, 384, 8, 8}, /* 0x04 */ - { 640, 400, 8,16}, /* 0x05 */ - { 640, 480, 8,16}, /* 0x06 */ - { 800, 600, 8,16}, /* 0x07 */ - { 1024, 768, 8,16}, /* 0x08 */ - { 1280,1024, 8,16}, /* 0x09 */ - { 1600,1200, 8,16}, /* 0x0a */ - { 1920,1440, 8,16}, /* 0x0b */ - { 2048,1536, 8,16}, /* 0x0c */ - { 720, 480, 8,16}, /* 0x0d */ - { 720, 576, 8,16}, /* 0x0e */ - { 1280, 960, 8,16}, /* 0x0f */ - { 800, 480, 8,16}, /* 0x10 */ - { 1024, 576, 8,16}, /* 0x11 */ - { 1280, 720, 8,16}, /* 0x12 */ - { 856, 480, 8,16}, /* 0x13 - TW: New, not in any BIOS */ - { 1280, 768, 8,16}, /* 0x14 20; TW: New */ - { 1400,1050, 8,16}, /* 0x15 21; TW: New */ - { 1152, 864, 8,16}, /* 0x16 - TW: New, not in any BIOS */ - { 848, 480, 8,16}, /* 0x17 - TW: New, not in any BIOS */ - { 1360, 768, 8,16} /* 0x18 - TW: New, not in any BIOS */ + { 0x2e,0x48, 25}, /* 0x41 Replacement for LCD on 315 for index 0 */ + { 0x24,0x46, 25}, /* 0x42 Replacement for LCD on 315 for modes 0x01, 0x03, 0x0f, 0x10, 0x12 */ + { 0x26,0x64, 28}, /* 0x43 Replacement for LCD on 315 for index 1 */ + { 0x37,0x64, 40}, /* 0x44 Replacement for LCD on 315 for index 4 */ + { 0xa1,0x42,108}, /* 0x45 1280x960 LCD */ + { 0x37,0x61,100}, /* 0x46 1280x960 LCD */ + { 0x78,0x27,108}, /* 0x47 */ + { 0x97,0x2c, 26}, /* 0x48 UNUSED */ + { 0xce,0x3c, 39}, /* 0x49 UNUSED */ + { 0x52,0x4a, 36}, /* 0x4a UNUSED */ + { 0x34,0x61, 95}, /* 0x4b UNUSED */ + { 0x78,0x27,108}, /* 0x4c UNUSED */ + { 0x66,0x43,123}, /* 0x4d 1400x1050-60 */ + { 0x41,0x4e, 21}, /* 0x4e UNUSED */ + { 0xa1,0x4a, 29}, /* 0x4f UNUSED */ + { 0x19,0x42, 42}, /* 0x50 UNUSED */ + { 0x54,0x46, 58}, /* 0x51 UNUSED */ + { 0x25,0x42, 61}, /* 0x52 UNUSED */ + { 0x44,0x44, 66}, /* 0x53 UNUSED */ + { 0x3a,0x62, 70}, /* 0x54 UNUSED */ + { 0x62,0xc6, 34}, /* 0x55 848x480-60 */ + { 0x6a,0xc6, 37}, /* 0x56 848x480-75 - TEMP, UNUSED */ + { 0xbf,0xc8, 35}, /* 0x57 856x480-38i,60 */ + { 0x30,0x23, 88}, /* 0x58 1360x768-62 (is 60Hz!) TEMP, UNUSED */ + { 0x52,0x07,149}, /* 0x59 1280x960-85 */ + { 0x56,0x07,156}, /* 0x5a 1400x1050-75 */ + { 0x70,0x29, 81}, /* 0x5b 1280x768 LCD */ + { 0x9c,0x62, 69}, /* 0x5c 1280x800 LCD - wrong? */ + { 0xbe,0x44,121}, /* 0x5d 1680x1050 LCD */ + { 0x70,0x24,162}, /* 0x5e 1600x1200 LCD */ + { 0x52,0x27, 75}, /* 0x5f 1280x720 LCD TMDS + HDTV (correct) */ + { 0x63,0x46, 68}, /* 0x60 1280x768_2 */ + { 0x31,0x42, 79}, /* 0x61 1280x768_3 - temp */ + { 0, 0, 0}, /* 0x62 - custom (will be filled out at run-time) */ + { 0x5a,0x64, 65} /* 0x63 1280x720 (LCD LVDS) */ }; -static const UCHAR SiS310_OutputSelect = 0x40; - -static const UCHAR SiS310_SoftSetting = 0x30; /* TW: RAM setting */ - -static const UCHAR SiS310_SR15[8][4]={ +static const DRAM4Type SiS310_SR15[8] = { {0x00,0x04,0x60,0x60}, {0x0f,0x0f,0x0f,0x0f}, {0xba,0xba,0xba,0xba}, @@ -1291,7 +813,7 @@ static UCHAR SiS310_SR07 = 0x18; -static const UCHAR SiS310_CR40[5][4]={ +static const DRAM4Type SiS310_CR40[5] = { {0x77,0x77,0x33,0x33}, {0x77,0x77,0x33,0x33}, {0x00,0x00,0x00,0x00}, @@ -1316,72 +838,78 @@ static const USHORT SiS310_RGBSenseData = 0xd1; static const USHORT SiS310_VideoSenseData = 0xb9; static const USHORT SiS310_YCSenseData = 0xb3; -static const USHORT SiS310_RGBSenseData2 = 0x0190; /*301b*/ +static const USHORT SiS310_RGBSenseData2 = 0x0190; static const USHORT SiS310_VideoSenseData2 = 0x0174; static const USHORT SiS310_YCSenseData2 = 0x016b; #endif -static const UCHAR SiS310_NTSCPhase[] = {0x21,0xed,0xba,0x08}; /* TW: Was {0x21,0xed,0x8a,0x08}; */ -static const UCHAR SiS310_PALPhase[] = {0x2a,0x05,0xe3,0x00}; /* TW: Was {0x2a,0x05,0xd3,0x00}; */ -static const UCHAR SiS310_PALMPhase[] = {0x21,0xE4,0x2E,0x9B}; /* TW: palm*/ -static const UCHAR SiS310_PALNPhase[] = {0x21,0xF4,0x3E,0xBA}; /* TW: paln*/ -static const UCHAR SiS310_NTSCPhase2[] = {0x21,0xF0,0x7B,0xD6}; -static const UCHAR SiS310_PALPhase2[] = {0x2a,0x09,0x86,0xe9}; -static const UCHAR SiS310_PALMPhase2[] = {0x21,0xE6,0xEF,0xA4}; /* TW: palm 301b*/ -static const UCHAR SiS310_PALNPhase2[] = {0x21,0xF6,0x94,0x46}; /* TW: paln 301b*/ -static const UCHAR SiS310_SpecialPhase[] = {0x1e,0x8c,0x5c,0x7a}; - -typedef struct _SiS310_LCDDataStruct -{ - USHORT RVBHCMAX; - USHORT RVBHCFACT; - USHORT VGAHT; - USHORT VGAVT; - USHORT LCDHT; - USHORT LCDVT; -} SiS310_LCDDataStruct; +static const SiS_PanelDelayTblStruct SiS310_PanelDelayTbl[]= +{ + {{0x10,0x40}}, + {{0x10,0x40}}, + {{0x10,0x40}}, + {{0x10,0x40}}, + {{0x10,0x40}}, + {{0x10,0x40}}, + {{0x10,0x40}}, + {{0x10,0x40}}, + {{0x10,0x40}}, + {{0x10,0x40}}, + {{0x10,0x40}}, + {{0x10,0x40}}, + {{0x10,0x40}}, + {{0x10,0x40}}, + {{0x10,0x40}}, + {{0x10,0x40}} +}; + +static const SiS_PanelDelayTblStruct SiS310_PanelDelayTblLVDS[]= +{ + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}}, + {{0x28,0xc8}} +}; + +/**************************************************************/ +/* SIS VIDEO BRIDGE ----------------------------------------- */ +/**************************************************************/ -static const SiS310_LCDDataStruct SiS310_StLCD1024x768Data[]= +static const SiS_LCDDataStruct SiS310_St2LCD1024x768Data[] = { { 62, 25, 800, 546,1344, 806}, { 32, 15, 930, 546,1344, 806}, - { 32, 15, 930, 546,1344, 806}, + { 62, 25, 800, 546,1344, 806}, { 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 SiS310_LCDDataStruct SiS310_ExtLCD1024x768Data[] = /* TW: Checked */ +static const SiS_LCDDataStruct SiS310_ExtLCD1024x768Data[] = { - { 12, 5, 896, 512,1344, 806}, - { 12, 5, 896, 510,1344, 806}, - { 32, 15,1008, 505,1344, 806}, - { 32, 15,1008, 514,1344, 806}, + { 42, 25,1536, 419,1344, 806}, + { 48, 25,1536, 369,1344, 806}, + { 42, 25,1536, 419,1344, 806}, + { 48, 25,1536, 369,1344, 806}, { 12, 5, 896, 500,1344, 806}, { 42, 25,1024, 625,1344, 806}, - { 1, 1,1344, 806,1344, 806}, - { 12, 5, 896, 500,1344, 806}, - { 42, 25,1024, 625,1344, 806}, - { 1, 1,1344, 806,1344, 806}, - { 12, 5, 896, 500,1344, 806}, - { 42, 25,1024, 625,1344, 806}, - { 1, 1,1344, 806,1344, 806} -}; - -static const SiS310_LCDDataStruct SiS310_St2LCD1024x768Data[] = /* TW: Checked */ -{ - { 62, 25, 800, 546,1344, 806}, - { 32, 15, 930, 546,1344, 806}, -/* { 32, 15, 930, 546,1344, 806}, */ - { 62, 25, 800, 546,1344, 806}, /* TW: Different in 650/301LV BIOS */ - { 104, 45, 945, 496,1344, 806}, - { 62, 25, 800, 546,1344, 806}, - { 31, 18,1008, 624,1344, 806}, { 1, 1,1344, 806,1344, 806} }; -static const SiS310_LCDDataStruct SiS310_StLCD1280x1024Data[] = +static const SiS_LCDDataStruct SiS310_St2LCD1280x1024Data[] = { { 22, 5, 800, 510,1650,1088}, { 22, 5, 800, 510,1650,1088}, @@ -1393,7 +921,7 @@ { 1, 1,1688,1066,1688,1066} }; -static const SiS310_LCDDataStruct SiS310_ExtLCD1280x1024Data[] = /* TW: Checked */ +static const SiS_LCDDataStruct SiS310_ExtLCD1280x1024Data[] = { { 211, 60,1024, 501,1688,1066}, { 211, 60,1024, 508,1688,1066}, @@ -1405,686 +933,45 @@ { 1, 1,1688,1066,1688,1066} }; -static const SiS310_LCDDataStruct SiS310_St2LCD1280x1024Data[] = -{ - { 22, 5, 800, 510,1650,1088}, - { 22, 5, 800, 510,1650,1088}, - { 176, 45, 900, 510,1650,1088}, - { 176, 45, 900, 510,1650,1088}, - { 22, 5, 800, 510,1650,1088}, - { 13, 5,1024, 675,1560,1152}, - { 16, 9,1266, 804,1688,1072}, - { 1, 1,1688,1066,1688,1066} -}; - -static const SiS310_LCDDataStruct SiS310_NoScaleData1024x768[] = /* TW: Checked */ +static const SiS_Part2PortTblStruct SiS310_CRT2Part2_1024x768_1[] = { - { 1, 1,1344, 806,1344, 806}, - { 1, 1,1344, 806,1344, 806}, - { 1, 1,1344, 806,1344, 806}, - { 1, 1,1344, 806,1344, 806}, - { 1, 1,1344, 806,1344, 806}, - { 1, 1,1344, 806,1344, 806}, - { 1, 1,1344, 806,1344, 806}, - { 1, 1,1344, 806,1344, 806} -}; - -static const SiS310_LCDDataStruct SiS310_NoScaleData1280x1024[] = /* TW: New; Checked */ -{ - { 1, 1,1688,1066,1688,1066}, - { 1, 1,1688,1066,1688,1066}, - { 1, 1,1688,1066,1688,1066}, - { 1, 1,1688,1066,1688,1066}, - { 1, 1,1688,1066,1688,1066}, - { 1, 1,1688,1066,1688,1066}, - { 1, 1,1688,1066,1688,1066}, - { 1, 1,1688,1066,1688,1066} -}; - -static const SiS310_LCDDataStruct SiS310_LCD1280x960Data[] = -{ - { 9, 2, 800, 500,1800,1000}, - { 9, 2, 800, 500,1800,1000}, - { 4, 1, 900, 500,1800,1000}, - { 4, 1, 900, 500,1800,1000}, - { 9, 2, 800, 500,1800,1000}, - { 30, 11,1056, 625,1800,1000}, - { 5, 3,1350, 800,1800,1000}, - { 1, 1,1576,1050,1576,1050}, - { 1, 1,1800,1000,1800,1000} -}; - -static const SiS310_LCDDataStruct SiS310_StLCD1400x1050Data[] = /* TW: New */ -{ /* TW: New from 1.11.6s */ - { 211, 100, 2100, 408, 1688, 1066 }, - { 211, 64, 1536, 358, 1688, 1066 }, - { 211, 100, 2100, 408, 1688, 1066 }, - { 211, 64, 1536, 358, 1688, 1066 }, - { 211, 48, 840, 488, 1688, 1066 }, - { 211, 72, 1008, 609, 1688, 1066 }, - { 211, 128, 1400, 776, 1688, 1066 }, - { 211, 205, 1680, 1041, 1688, 1066 }, - { 1, 1, 1688, 1066, 1688, 1066 } -}; - -static const SiS310_LCDDataStruct SiS310_ExtLCD1400x1050Data[] = /* TW: New */ -{ /* TW: New from 1.11.6s */ - { 211, 100, 2100, 408, 1688, 1066 }, - { 211, 64, 1536, 358, 1688, 1066 }, - { 211, 100, 2100, 408, 1688, 1066 }, - { 211, 64, 1536, 358, 1688, 1066 }, - { 211, 48, 840, 488, 1688, 1066 }, - { 211, 72, 1008, 609, 1688, 1066 }, - { 211, 128, 1400, 776, 1688, 1066 }, - { 211, 205, 1680, 1041, 1688, 1066 }, - { 1, 1, 1688, 1066, 1688, 1066 } -}; - -static const SiS310_LCDDataStruct SiS310_NoScaleData1400x1050[] = /* TW: New */ -{ /* TW: To be checked (BIOS uses 1280x1024 data, one line too short) */ - { 1, 1, 1688, 1066, 1688, 1066 }, - { 1, 1, 1688, 1066, 1688, 1066 }, - { 1, 1, 1688, 1066, 1688, 1066 }, - { 1, 1, 1688, 1066, 1688, 1066 }, - { 1, 1, 1688, 1066, 1688, 1066 }, - { 1, 1, 1688, 1066, 1688, 1066 }, - { 1, 1, 1688, 1066, 1688, 1066 }, - { 1, 1, 1688, 1066, 1688, 1066 }, - { 1, 1, 1688, 1066, 1688, 1066 } -}; - -static const SiS310_LCDDataStruct SiS310_StLCD1600x1200Data[] = /* TW: New */ -{ /* TODO */ - { 0, 0, 0, 0, 0, 0} -}; - -static const SiS310_LCDDataStruct SiS310_ExtLCD1600x1200Data[] = /* TW: New */ -{ /* TODO */ - { 0, 0, 0, 0, 0, 0} -}; - -static const SiS310_LCDDataStruct SiS310_NoScaleData1600x1200[] = /* TW: New */ -{ /* TODO */ - { 0, 0, 0, 0, 0, 0} -}; - -typedef struct _SiS310_TVDataStruct -{ - USHORT RVBHCMAX; - USHORT RVBHCFACT; - USHORT VGAHT; - USHORT VGAVT; - USHORT TVHDE; - USHORT TVVDE; - USHORT RVBHRS; - UCHAR FlickerMode; - USHORT HALFRVBHRS; - UCHAR RY1COE; - UCHAR RY2COE; - UCHAR RY3COE; - UCHAR RY4COE; -} SiS310_TVDataStruct; - -static const SiS310_TVDataStruct SiS310_StPALData[]= -{ - { 1, 1, 864, 525,1270, 400, 100, 0, 760,0xf4,0xff,0x1c,0x22}, - { 1, 1, 864, 525,1270, 350, 100, 0, 760,0xf4,0xff,0x1c,0x22}, - { 1, 1, 864, 525,1270, 400, 0, 0, 720,0xf1,0x04,0x1f,0x18}, - { 1, 1, 864, 525,1270, 350, 0, 0, 720,0xf4,0x0b,0x1c,0x0a}, - { 1, 1, 864, 525,1270, 480, 50, 0, 760,0xf4,0xff,0x1c,0x22}, - { 1, 1, 864, 525,1270, 600, 50, 0, 0,0xf4,0xff,0x1c,0x22} -}; - -static const SiS310_TVDataStruct SiS310_ExtPALData[] = /* TW: Verfied (1.10.7w) */ -{ - { 27, 10, 848, 448,1270, 530, 50, 0, 50,0xf4,0xff,0x1c,0x22}, - { 108, 35, 848, 398,1270, 530, 50, 0, 50,0xf4,0xff,0x1c,0x22}, - { 12, 5, 954, 448,1270, 530, 50, 0, 50,0xf1,0x04,0x1f,0x18}, - { 9, 4, 960, 463,1644, 438, 50, 0, 50,0xf4,0x0b,0x1c,0x0a}, - { 9, 4, 848, 528,1270, 530, 0, 0, 50,0xf5,0xfb,0x1b,0x2a}, /* 640x480 */ - { 36, 25,1060, 648,1316, 530, 438, 0, 438,0xeb,0x05,0x25,0x16}, /* 800x600 */ - { 3, 2,1080, 619,1270, 540, 438, 0, 438,0xf3,0x00,0x1d,0x20}, /* 720x480/576 */ - { 1, 1,1170, 821,1270, 520, 686, 0, 686,0xF3,0x00,0x1D,0x20} /* 1024x768 */ -}; - -static const SiS310_TVDataStruct SiS310_StNTSCData[]= -{ - { 1, 1, 858, 525,1270, 400, 50, 0, 760,0xf1,0x04,0x1f,0x18}, - { 1, 1, 858, 525,1270, 350, 50, 0, 640,0xf1,0x04,0x1f,0x18}, - { 1, 1, 858, 525,1270, 400, 0, 0, 720,0xf1,0x04,0x1f,0x18}, - { 1, 1, 858, 525,1270, 350, 0, 0, 720,0xf4,0x0b,0x1c,0x0a}, - { 1, 1, 858, 525,1270, 480, 0, 0, 760,0xf1,0x04,0x1f,0x18} -}; - -static const SiS310_TVDataStruct SiS310_ExtNTSCData[]= -{ - { 143, 65, 858, 443,1270, 440, 171, 0, 171,0xf1,0x04,0x1f,0x18}, - { 88, 35, 858, 393,1270, 440, 171, 0, 171,0xf1,0x04,0x1f,0x18}, - { 143, 70, 924, 443,1270, 440, 92, 0, 92,0xf1,0x04,0x1f,0x18}, - { 143, 70, 924, 393,1270, 440, 92, 0, 92,0xf4,0x0b,0x1c,0x0a}, - { 143, 76, 836, 523,1270, 440, 224, 0, 0,0xf1,0x05,0x1f,0x16}, /* 640x480 */ - { 143, 120,1056, 643,1270, 440, 0, 128, 0,0xf4,0x10,0x1c,0x00}, /* 800x600 */ - { 2, 1, 858, 503,1270, 480, 0, 128, 0,0xee,0x0c,0x22,0x08}, /* 720x480/576 */ - { 65, 64,1056, 791,1270, 480, 638, 0, 0,0xEE,0x0C,0x22,0x08} /* 1024x768 */ -}; - -/* TW: These tables will need data ! */ -static const SiS310_TVDataStruct SiS310_St1HiTVData[]= -{ - {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} -}; - -static const SiS310_TVDataStruct SiS310_St2HiTVData[]= -{ - {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} -}; - -static const SiS310_TVDataStruct SiS310_ExtHiTVData[]= -{ - {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} -}; - -static const UCHAR SiS310_NTSCTiming[] = { /* TW: New (checked 1.09, 1.10.6s) */ - 0x17,0x1d,0x03,0x09,0x05,0x06,0x0c,0x0c, - 0x94,0x49,0x01,0x0a,0x06,0x0d,0x04,0x0a, - 0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x1b, - 0x0c,0x50,0x00,0x97,0x00,0xda,0x4a,0x17, - 0x7d,0x05,0x4b,0x00,0x00,0xe2,0x00,0x02, - 0x03,0x0a,0x65,0x9d,0x08,0x92,0x8f,0x40, - 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x50, - 0x00,0x40,0x44,0x00,0xdb,0x02,0x3b,0x00 -}; - -static const UCHAR SiS310_PALTiming[] = { /* TW: New (checked 1.09, 1.10.6s) */ - 0x19,0x52,0x35,0x6e,0x04,0x38,0x3d,0x70, - 0x94,0x49,0x01,0x12,0x06,0x3e,0x35,0x6d, - 0x06,0x14,0x3e,0x35,0x6d,0x00,0x45,0x2b, - 0x70,0x50,0x00,0x9b,0x00,0xd9,0x5d,0x17, - 0x7d,0x05,0x45,0x00,0x00,0xe8,0x00,0x02, - 0x0d,0x00,0x68,0xb0,0x0b,0x92,0x8f,0x40, - 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x63, - 0x00,0x40,0x3e,0x00,0xe1,0x02,0x28,0x00 -}; - -#ifdef oldHV -static const UCHAR SiS310_HiTVExtTiming[] = { /* TW: New */ - 0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x64, - 0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d, - 0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f, - 0x64,0x90,0x33,0x8c,0x18,0x36,0x3e,0x13, - 0x2a,0xde,0x2a,0x44,0x40,0x2a,0x44,0x40, - 0x8e,0x8e,0x82,0x07,0x0b,0x92,0x0f,0x40, - 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x3d, - 0x63,0x4f,0x27,0x00,0xfc,0xff,0x6a,0x00 -}; - -static const UCHAR SiS310_HiTVSt1Timing[] = { /* TW: New */ - 0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x65, - 0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d, - 0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f, - 0x65,0x90,0x7b,0xa8,0x03,0xf0,0x87,0x03, - 0x11,0x15,0x11,0xcf,0x10,0x11,0xcf,0x10, - 0x35,0x35,0x3b,0x69,0x1d,0x92,0x0f,0x40, - 0x60,0x80,0x14,0x90,0x8c,0x60,0x04,0x86, - 0xaf,0x5d,0x0e,0x00,0xfc,0xff,0x2d,0x00 -}; - -static const UCHAR SiS310_HiTVSt2Timing[] = { /* TW: New */ - 0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x64, - 0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d, - 0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f, - 0x64,0x90,0x33,0x8c,0x18,0x36,0x3e,0x13, - 0x2a,0xde,0x2a,0x44,0x40,0x2a,0x44,0x40, - 0x8e,0x8e,0x82,0x07,0x0b,0x92,0x0f,0x40, - 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x3d, - 0x63,0x4f,0x27,0x00,0xfc,0xff,0x6a,0x00 -}; - -static const UCHAR SiS310_HiTVTextTiming[] = { /* TW: New */ - 0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x65, - 0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d, - 0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f, - 0x65,0x90,0xe7,0xbc,0x03,0x0c,0x97,0x03, - 0x14,0x78,0x14,0x08,0x20,0x14,0x08,0x20, - 0xc8,0xc8,0x3b,0xd2,0x26,0x92,0x0f,0x40, - 0x60,0x80,0x14,0x90,0x8c,0x60,0x04,0x96, - 0x72,0x5c,0x11,0x00,0xfc,0xff,0x32,0x00 -}; - -static const UCHAR SiS310_HiTVGroup3Data[] = { /* TW: New */ - 0x00,0x1a,0x22,0x63,0x62,0x22,0x08,0x5f, - 0x05,0x21,0xb2,0xb2,0x55,0x77,0x2a,0xa6, - 0x25,0x2f,0x47,0xfa,0xc8,0xff,0x8e,0x20, - 0x8c,0x6e,0x60,0x2e,0x58,0x48,0x72,0x44, - 0x56,0x36,0x4f,0x6e,0x3f,0x80,0x00,0x80, - 0x4f,0x7f,0x03,0xa8,0x7d,0x20,0x1a,0xa9, - 0x14,0x05,0x03,0x7e,0x64,0x31,0x14,0x75, - 0x18,0x05,0x18,0x05,0x4c,0xa8,0x01 -}; - -static const UCHAR SiS310_HiTVGroup3Simu[] = { /* TW: New */ - 0x00,0x1a,0x22,0x63,0x62,0x22,0x08,0x95, - 0xdb,0x20,0xb8,0xb8,0x55,0x47,0x2a,0xa6, - 0x25,0x2f,0x47,0xfa,0xc8,0xff,0x8e,0x20, - 0x8c,0x6e,0x60,0x15,0x26,0xd3,0xe4,0x11, - 0x56,0x36,0x4f,0x6e,0x3f,0x80,0x00,0x80, - 0x67,0x36,0x01,0x47,0x0e,0x10,0xbe,0xb4, - 0x01,0x05,0x03,0x7e,0x65,0x31,0x14,0x75, - 0x18,0x05,0x18,0x05,0x4c,0xa8,0x01 -}; - -static const UCHAR SiS310_HiTVGroup3Text[] = { /* TW: New */ - 0x00,0x1a,0x22,0x63,0x62,0x22,0x08,0xa7, - 0xf5,0x20,0xce,0xce,0x55,0x47,0x2a,0xa6, - 0x25,0x2f,0x47,0xfa,0xc8,0xff,0x8e,0x20, - 0x8c,0x6e,0x60,0x18,0x2c,0x0c,0x20,0x22, - 0x56,0x36,0x4f,0x6e,0x3f,0x80,0x00,0x80, - 0x93,0x3c,0x01,0x50,0x2f,0x10,0xf4,0xca, - 0x01,0x05,0x03,0x7e,0x65,0x31,0x14,0x75, - 0x18,0x05,0x18,0x05,0x4c,0xa8,0x01 + {{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}} }; -#endif -typedef struct _SiS310_PanelDelayTblStruct -{ - UCHAR timer[2]; -} SiS310_PanelDelayTblStruct; +/* *** LCDA *** */ -static const SiS310_PanelDelayTblStruct SiS310_PanelDelayTbl[]= /* TW: New */ -{ - {{0x10,0x40}}, /* TW: from 650/301LVx 1.10.6s BIOS */ - {{0x10,0x40}}, - {{0x10,0x40}}, - {{0x10,0x40}}, - {{0x10,0x40}}, - {{0x10,0x40}}, - {{0x10,0x40}}, - {{0x10,0x40}}, - {{0x10,0x40}}, - {{0x10,0x40}}, - {{0x10,0x40}}, - {{0x10,0x40}}, - {{0x10,0x40}}, - {{0x10,0x40}}, - {{0x10,0x40}}, - {{0x10,0x40}} #if 0 - {{0x28,0xc8}}, /* TW: from 650/301LV BIOS */ - {{0x28,0xc8}}, - {{0x28,0xc8}}, - {{0x28,0xc8}}, - {{0x28,0xc8}}, - {{0x28,0xc8}}, - {{0x28,0xc8}}, - {{0x28,0xc8}}, - {{0x28,0xc8}}, - {{0x28,0xc8}}, - {{0x28,0xc8}}, - {{0x28,0xc8}}, - {{0x28,0xc8}}, - {{0x28,0xc8}}, - {{0x28,0xc8}}, - {{0x28,0xc8}} +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 -static const SiS310_PanelDelayTblStruct SiS310_PanelDelayTblLVDS[]= -{ - {{0x28,0xc8}}, - {{0x28,0xc8}}, - {{0x28,0xc8}}, - {{0x28,0xc8}}, - {{0x28,0xc8}}, - {{0x28,0xc8}}, - {{0x28,0xc8}}, - {{0x28,0xc8}}, - {{0x28,0xc8}}, - {{0x28,0xc8}}, - {{0x28,0xc8}}, - {{0x28,0xc8}}, - {{0x28,0xc8}}, - {{0x28,0xc8}}, - {{0x28,0xc8}}, - {{0x28,0xc8}} -}; - -typedef struct _SiS310_LVDSDataStruct -{ - USHORT VGAHT; - USHORT VGAVT; - USHORT LCDHT; - USHORT LCDVT; -} SiS310_LVDSDataStruct; - -static const SiS310_LVDSDataStruct SiS310_LVDS320x480Data_1[]= -{ - {848, 433,400, 525}, - {848, 389,400, 525}, - {848, 433,400, 525}, - {848, 389,400, 525}, - {848, 518,400, 525}, - {1056,628,400, 525}, - {400, 525,400, 525}, - {800, 449,1000, 644}, - {800, 525,1000, 635} -}; - -static const SiS310_LVDSDataStruct SiS310_LVDS800x600Data_1[]= /* TW: New */ -{ - {848, 433,1060, 629}, - {848, 389,1060, 629}, - {848, 433,1060, 629}, - {848, 389,1060, 629}, - {848, 518,1060, 629}, - {1056, 628,1056, 628}, - {1056, 628,1056, 628}, - {800, 449,1000, 644}, - {800, 525,1000, 635} -}; - -static const SiS310_LVDSDataStruct SiS310_LVDS800x600Data_2[]= /* TW: New */ -{ - {1056, 628,1056, 628}, - {1056, 628,1056, 628}, - {1056, 628,1056, 628}, - {1056, 628,1056, 628}, - {1056, 628,1056, 628}, - {1056, 628,1056, 628}, - {1056, 628,1056, 628}, - {800, 449,1000, 644}, - {800, 525,1000, 635} -}; - -static const SiS310_LVDSDataStruct SiS310_LVDS1024x768Data_1[]= /* TW: New */ -{ - {840, 438,1344, 806}, - {840, 409,1344, 806}, - {840, 438,1344, 806}, - {840, 409,1344, 806}, - {840, 518,1344, 806}, /* 640x480 */ - {1050, 638,1344, 806}, /* 800x600 */ - {1344, 806,1344, 806}, /* 1024x768 */ - {800, 449,1280, 801}, - {800, 525,1280, 813} -}; - -static const SiS310_LVDSDataStruct SiS310_LVDS1024x768Data_2[]= /* TW: New */ -{ - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {800, 449,1280, 801}, - {800, 525,1280, 813} -}; - -static const SiS310_LVDSDataStruct SiS310_LVDS1280x1024Data_1[]= /* TW: New - TODO */ -{ /* TW: Temp data, invalid (is identical to 1024x768) */ - {840, 438,1344, 806}, - {840, 409,1344, 806}, - {840, 438,1344, 806}, - {840, 409,1344, 806}, - {840, 518,1344, 806}, - {1050, 638,1344, 806}, - {1344, 806,1344, 806}, - {800, 449,1280, 801}, - {800, 525,1280, 813} -}; - -static const SiS310_LVDSDataStruct SiS310_LVDS1280x1024Data_2[]= /* TW: New - TODO */ -{ /* TW: Temp data, invalid (is identical to 1024x768) */ - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {800, 449,1280, 801}, - {800, 525,1280, 813} -}; - -static const SiS310_LVDSDataStruct SiS310_LVDS1400x1050Data_1[]= /* TW: New */ -{ - {928, 416, 1688, 1066}, - {928, 366, 1688, 1066}, - {928, 416, 1688, 1066}, - {928, 366, 1688, 1066}, - {928, 496, 1688, 1066}, - {1088, 616, 1688, 1066}, - {1312, 784, 1688, 1066}, - {1568, 1040, 1688, 1066}, - {1688, 1066, 1688, 1066} -}; - -static const SiS310_LVDSDataStruct SiS310_LVDS1400x1050Data_2[]= /* TW: New */ -{ - {1688,1066, 1688,1066}, - {1688,1066, 1688,1066}, - {1688,1066, 1688,1066}, - {1688,1066, 1688,1066}, - {1688,1066, 1688,1066}, - {1688,1066, 1688,1066}, - {1688,1066, 1688,1066}, - {1688,1066, 1688,1066}, - {1688,1066, 1688,1066}, -}; - -static const SiS310_LVDSDataStruct SiS310_LVDS1280x768Data_1[]= /* TW: New - TODO */ -{ /* TW: Temp data, invalid (is identical to 1024x768) */ - {840, 438,1344, 806}, - {840, 409,1344, 806}, - {840, 438,1344, 806}, - {840, 409,1344, 806}, - {840, 518,1344, 806}, - {1050, 638,1344, 806}, - {1344, 806,1344, 806}, - {800, 449,1280, 801}, - {800, 525,1280, 813} -}; - -static const SiS310_LVDSDataStruct SiS310_LVDS1280x768Data_2[]= /* TW: New - TODO */ -{ /* TW: Temp data, invalid (is identical to 1024x768) */ - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {800, 449,1280, 801}, - {800, 525,1280, 813} -}; - -/* TW: New: - from 300 series */ -static const SiS310_LVDSDataStruct SiS310_LVDS1024x600Data_1[]= -{ - {840, 604,1344, 800}, - {840, 560,1344, 800}, - {840, 604,1344, 800}, - {840, 560,1344, 800}, - {840, 689,1344, 800}, - {1050, 800,1344, 800}, - {1344, 800,1344, 800}, - {800, 449,1280, 801}, - {800, 525,1280, 813} -}; - -/* TW: New: - from 300 series */ -static const SiS310_LVDSDataStruct SiS310_LVDS1024x600Data_2[]= -{ - {1344, 800,1344, 800}, - {1344, 800,1344, 800}, - {1344, 800,1344, 800}, - {1344, 800,1344, 800}, - {1344, 800,1344, 800}, - {1344, 800,1344, 800}, - {1344, 800,1344, 800}, - {800, 449,1280, 801}, - {800, 525,1280, 813} -}; - -/* TW: New: - from 300 series */ -static const SiS310_LVDSDataStruct SiS310_LVDS1152x768Data_1[]= -{ - {840, 438,1344, 806}, - {840, 409,1344, 806}, - {840, 438,1344, 806}, - {840, 409,1344, 806}, - {840, 518,1344, 806}, - {1050, 638,1344, 806}, - {1344, 806,1344, 806}, - {800, 449,1280, 801}, - {800, 525,1280, 813} -}; - -/* TW: New: - from 300 series */ -static const SiS310_LVDSDataStruct SiS310_LVDS1152x768Data_2[]= -{ - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {800, 449,1280, 801}, - {800, 525,1280, 813} -}; - -/* TW: New in 650/LVDS BIOS - pass 1:1 data */ -static const SiS310_LVDSDataStruct SiS310_LVDSXXXxXXXData_1[]= /* TW: New */ -{ - { 800, 449, 800, 449}, - { 800, 449, 800, 449}, - { 900, 449, 900, 449}, - { 900, 449, 900, 449}, - { 800, 525, 800, 525}, - {1056, 628,1056, 628}, - {1344, 806,1344, 806}, - {1688, 806,1688, 806} -}; - -static const SiS310_LVDSDataStruct SiS310_LVDS640x480Data_1[]= /* TW: New */ -{ - {800, 449, 800, 449}, - {800, 449, 800, 449}, - {800, 449, 800, 449}, - {800, 449, 800, 449}, - {800, 525, 800, 525}, - {1056, 628,1056, 628}, - {1056, 628,1056, 628}, - {1056, 628,1056, 628}, - {1056, 628,1056, 628} -}; - -static const SiS310_LVDSDataStruct SiS310_LVDS1280x960Data_1[]= /* TW: New */ -{ - {840, 438,1344, 806}, - {840, 409,1344, 806}, - {840, 438,1344, 806}, - {840, 409,1344, 806}, - {840, 518,1344, 806}, - {1050, 638,1344, 806}, - {1344, 806,1344, 806}, - {800, 449,1280, 801}, - {800, 525,1280, 813} -}; - -static const SiS310_LVDSDataStruct SiS310_LVDS1280x960Data_2[]= /* TW: New */ -{ - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {800, 449,1280, 801}, - {800, 525,1280, 813} -}; - -static const SiS310_LVDSDataStruct SiS310_LCDA1400x1050Data_1[]= /* TW: New */ -{ /* TW: Might be temporary (invalid) data */ - {928, 416, 1688, 1066}, - {928, 366, 1688, 1066}, - {1008, 416, 1688, 1066}, - {1008, 366, 1688, 1066}, - {1200, 530, 1688, 1066}, - {1088, 616, 1688, 1066}, - {1312, 784, 1688, 1066}, - {1568, 1040, 1688, 1066}, - {1688, 1066, 1688, 1066} -}; - -static const SiS310_LVDSDataStruct SiS310_LCDA1400x1050Data_2[]= /* TW: New */ -{ /* TW: Temporary data. Not valid */ - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {800, 449,1280, 801}, - {800, 525,1280, 813} -}; - -static const SiS310_LVDSDataStruct SiS310_LCDA1600x1200Data_1[]= /* TW: New */ -{ /* TW: Temporary data. Not valid */ - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {800, 449,1280, 801}, - {800, 525,1280, 813} -}; - -static const SiS310_LVDSDataStruct SiS310_LCDA1600x1200Data_2[]= /* TW: New */ -{ /* TW: Temporary data. Not valid */ - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0} -}; - -static const SiS310_LVDSDataStruct SiS310_CHTVUNTSCData[]= /* TW: New */ -{ - { 840, 600, 840, 600}, - { 840, 600, 840, 600}, - { 840, 600, 840, 600}, - { 840, 600, 840, 600}, - { 784, 600, 784, 600}, - {1064, 750,1064, 750}, - {1160, 945,1160, 945} /* TW: For Ch7019 1024 */ -}; - -static const SiS310_LVDSDataStruct SiS310_CHTVONTSCData[]= /* TW: New */ -{ - { 840, 525, 840, 525}, - { 840, 525, 840, 525}, - { 840, 525, 840, 525}, - { 840, 525, 840, 525}, - { 784, 525, 784, 525}, - {1040, 700,1040, 700}, - {1160, 840,1160, 840} /* TW: For Ch7019 1024 */ -}; +/**************************************************************/ +/* LVDS, CHRONTEL ------------------------------------------- */ +/**************************************************************/ -static const SiS310_LVDSDataStruct SiS310_CHTVUPALData[]= /* TW: New */ +static const SiS_LVDSDataStruct SiS310_CHTVUPALData[]= { {1008, 625,1008, 625}, {1008, 625,1008, 625}, @@ -2092,10 +979,10 @@ {1008, 625,1008, 625}, { 840, 625, 840, 625}, { 960, 750, 960, 750}, - {1400,1000,1400,1000} /* TW: For Ch7019 1024 */ + {1400,1000,1400,1000} }; -static const SiS310_LVDSDataStruct SiS310_CHTVOPALData[]= /* TW: New */ +static const SiS_LVDSDataStruct SiS310_CHTVOPALData[]= { {1008, 625,1008, 625}, {1008, 625,1008, 625}, @@ -2103,10 +990,10 @@ {1008, 625,1008, 625}, { 840, 625, 840, 625}, { 944, 625, 944, 625}, - {1400, 875,1400, 875} /* TW: For Ch7019 1024 */ + {1400, 875,1400, 875} }; -static const SiS310_LVDSDataStruct SiS310_CHTVUPALMData[]= /* TW: New */ +static const SiS_LVDSDataStruct SiS310_CHTVUPALMData[]= { { 840, 600, 840, 600}, { 840, 600, 840, 600}, @@ -2114,10 +1001,10 @@ { 840, 600, 840, 600}, { 784, 600, 784, 600}, {1064, 750,1064, 750}, - {1160, 945,1160, 945} /* TW: For Ch7019 1024 */ + {1160, 945,1160, 945} }; -static const SiS310_LVDSDataStruct SiS310_CHTVOPALMData[]= /* TW: New */ +static const SiS_LVDSDataStruct SiS310_CHTVOPALMData[]= { { 840, 525, 840, 525}, { 840, 525, 840, 525}, @@ -2125,10 +1012,10 @@ { 840, 525, 840, 525}, { 784, 525, 784, 525}, {1040, 700,1040, 700}, - {1160, 840,1160, 840} /* TW: For Ch7019 1024 */ + {1160, 840,1160, 840} }; -static const SiS310_LVDSDataStruct SiS310_CHTVUPALNData[]= /* TW: New */ +static const SiS_LVDSDataStruct SiS310_CHTVUPALNData[]= { {1008, 625,1008, 625}, {1008, 625,1008, 625}, @@ -2136,10 +1023,10 @@ {1008, 625,1008, 625}, { 840, 625, 840, 625}, { 960, 750, 960, 750}, - {1400,1000,1400,1000} /* TW: For Ch7019 1024 */ + {1400,1000,1400,1000} }; -static const SiS310_LVDSDataStruct SiS310_CHTVOPALNData[]= /* TW: New */ +static const SiS_LVDSDataStruct SiS310_CHTVOPALNData[]= { {1008, 625,1008, 625}, {1008, 625,1008, 625}, @@ -2147,10 +1034,10 @@ {1008, 625,1008, 625}, { 840, 625, 840, 625}, { 944, 625, 944, 625}, - {1400, 875,1400, 875} /* TW: For Ch7019 1024 */ + {1400, 875,1400, 875} }; -static const SiS310_LVDSDataStruct SiS310_CHTVSOPALData[]= /* TW: New (super overscan - no effect on 7019) */ +static const SiS_LVDSDataStruct SiS310_CHTVSOPALData[]= /* (super overscan - no effect on 7019) */ { {1008, 625,1008, 625}, {1008, 625,1008, 625}, @@ -2161,15 +1048,8 @@ {1400, 875,1400, 875} }; -typedef struct _SiS310_LVDSDesStruct -{ - USHORT LCDHDES; - USHORT LCDVDES; -} SiS310_LVDSDesStruct; - -/* TW: PanelType arrays taken from 650/LVDS BIOS 1.10.0 */ -static const SiS310_LVDSDesStruct SiS310_PanelType00_1[]= /* TW: New */ +static const SiS_LVDSDesStruct SiS310_PanelType00_1[]= /* 800x600 */ { { 0, 0}, { 0, 0}, @@ -2182,7 +1062,7 @@ { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType01_1[]= /* TW: New */ +static const SiS_LVDSDesStruct SiS310_PanelType01_1[]= /* 1024x768 */ { { 0, 0}, { 0, 0}, @@ -2195,7 +1075,7 @@ { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType02_1[]= /* TW: New */ +static const SiS_LVDSDesStruct SiS310_PanelType02_1[]= /* 1280x1024 */ { { 0, 0}, { 0, 0}, @@ -2210,7 +1090,7 @@ }; -static const SiS310_LVDSDesStruct SiS310_PanelType03_1[]= /* TW: New */ +static const SiS_LVDSDesStruct SiS310_PanelType03_1[]= { { 0, 0}, { 0, 0}, @@ -2223,7 +1103,7 @@ { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType04_1[]= /* TW: New */ +static const SiS_LVDSDesStruct SiS310_PanelType04_1[]= { {1343, 798}, {1343, 794}, @@ -2236,7 +1116,7 @@ { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType05_1[]= /* TW: New */ +static const SiS_LVDSDesStruct SiS310_PanelType05_1[]= { {1343, 798}, {1343, 794}, @@ -2249,7 +1129,7 @@ { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType06_1[]= /* TW: New */ +static const SiS_LVDSDesStruct SiS310_PanelType06_1[]= { {1343, 798}, {1343, 794}, @@ -2262,7 +1142,7 @@ { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType07_1[]= /* TW: New */ +static const SiS_LVDSDesStruct SiS310_PanelType07_1[]= { {1343, 798}, {1343, 794}, @@ -2275,7 +1155,7 @@ { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType08_1[]= /* TW: New */ +static const SiS_LVDSDesStruct SiS310_PanelType08_1[]= /* 1400x1050 */ { { 0, 0}, { 0, 0}, @@ -2290,45 +1170,61 @@ { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType09_1[]= /* TW: New - to check (1280x768) */ +static const SiS_LVDSDesStruct SiS310_PanelType09_1[]= /* 1280x768 */ { - { 0, 448}, - { 0, 448}, - { 0, 448}, - { 0, 448}, - { 0, 524}, - { 0, 627}, - { 0, 805}, - { 0, 805}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType0a_1[]= /* TW: New */ +static const SiS_LVDSDesStruct SiS310_PanelType0a_1[]= /* 1600x1200 */ { - {1059, 626}, - {1059, 624}, - {1059, 626}, - {1059, 624}, - {1059, 624}, - { 0, 627}, - { 0, 627}, - { 0, 0}, - { 0, 0} + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType0b_1[]= /* TW: New */ +static const SiS_LVDSDesStruct SiS310_PanelType0b_1[]= /* 640x480_2 */ { - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} + { 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 SiS310_LVDSDesStruct SiS310_PanelType0c_1[]= /* TW: New */ +static const SiS_LVDSDesStruct SiS310_PanelType0d_1[]= { {1343, 798}, {1343, 794}, @@ -2341,7 +1237,7 @@ { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType0d_1[]= /* TW: New */ +static const SiS_LVDSDesStruct SiS310_PanelType0e_1[]= { {1343, 798}, {1343, 794}, @@ -2354,7 +1250,7 @@ { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType0e_1[]= /* TW: New */ +static const SiS_LVDSDesStruct SiS310_PanelType0f_1[]= { {1343, 798}, {1343, 794}, @@ -2367,20 +1263,7 @@ { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType0f_1[]= /* TW: New */ -{ - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS310_LVDSDesStruct SiS310_PanelType00_2[]= /* TW: New */ +static const SiS_LVDSDesStruct SiS310_PanelType00_2[]= { {980, 528}, {980, 503}, @@ -2393,7 +1276,7 @@ { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType01_2[]= /* TW: New */ +static const SiS_LVDSDesStruct SiS310_PanelType01_2[]= { {1152, 622}, {1152, 597}, @@ -2406,7 +1289,7 @@ { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType02_2[]= /* TW: New */ +static const SiS_LVDSDesStruct SiS310_PanelType02_2[]= { {1368, 754}, {1368, 729}, @@ -2421,7 +1304,7 @@ { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType03_2[]= /* TW: New */ +static const SiS_LVDSDesStruct SiS310_PanelType03_2[]= { { 0, 0}, { 0, 0}, @@ -2432,7 +1315,7 @@ { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType04_2[]= /* TW: New */ +static const SiS_LVDSDesStruct SiS310_PanelType04_2[]= { { 0, 0}, { 0, 0}, @@ -2445,7 +1328,7 @@ { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType05_2[]= /* TW: New */ +static const SiS_LVDSDesStruct SiS310_PanelType05_2[]= { {1152, 622}, {1152, 597}, @@ -2458,7 +1341,7 @@ { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType06_2[]= /* TW: New */ +static const SiS_LVDSDesStruct SiS310_PanelType06_2[]= { {1152, 622}, {1152, 597}, @@ -2471,7 +1354,7 @@ { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType07_2[]= /* TW: New */ +static const SiS_LVDSDesStruct SiS310_PanelType07_2[]= { {1152, 622}, {1152, 597}, @@ -2484,45 +1367,61 @@ { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType08_2[]= /* TW: New */ -{ - {976, 527}, - {976, 502}, - {976, 527}, - {976, 502}, - {976, 567}, - { 0, 627}, - { 0, 627}, - { 0, 0}, - { 0, 0} -}; - -static const SiS310_LVDSDesStruct SiS310_PanelType09_2[]= /* TW: New - to check (1280x768) */ -{ - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0} -}; - -static const SiS310_LVDSDesStruct SiS310_PanelType0a_2[]= /* TW: New */ +static const SiS_LVDSDesStruct SiS310_PanelType08_2[]= /* 1400x1050 */ { - {976, 527}, - {976, 502}, - {976, 527}, - {976, 502}, - {976, 567}, - { 0, 627}, - { 0, 627}, - { 0, 0}, - { 0, 0} + {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 SiS310_LVDSDesStruct SiS310_PanelType0b_2[]= /* TW: New */ +static const SiS_LVDSDesStruct SiS310_PanelType0b_2[]= /* 640x480_2 */ { {1152, 622}, {1152, 597}, @@ -2535,7 +1434,7 @@ { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType0c_2[]= /* TW: New */ +static const SiS_LVDSDesStruct SiS310_PanelType0c_2[]= /* 640x480_3 */ { {1152, 622}, {1152, 597}, @@ -2548,7 +1447,7 @@ { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType0d_2[]= /* TW: New */ +static const SiS_LVDSDesStruct SiS310_PanelType0d_2[]= { {1152, 622}, {1152, 597}, @@ -2561,7 +1460,7 @@ { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType0e_2[]= /* TW: New */ +static const SiS_LVDSDesStruct SiS310_PanelType0e_2[]= { {1152, 622}, {1152, 597}, @@ -2574,7 +1473,7 @@ { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType0f_2[] = /* TW: New */ +static const SiS_LVDSDesStruct SiS310_PanelType0f_2[] = { {1152, 622}, {1152, 597}, @@ -2587,100 +1486,22 @@ { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType1076_1[]= /* TW: New */ -{ /* 1024x768 - Checked (1.10.6s) */ - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0} -}; - -static const SiS310_LVDSDesStruct SiS310_PanelType1076_2[]= /* TW: New */ -{ /* 1024x768 - Checked (1.10.6s) */ - { 1184, 622 }, - { 1184, 597 }, - { 1184, 622 }, - { 1184, 597 }, - { 1152, 622 }, - { 1232, 722 }, - { 0, 0 }, - { 0, 794 }, - { 0, 0 } -}; - -static const SiS310_LVDSDesStruct SiS310_PanelType1210_1[]= /* TW: New */ -{ /* 1280x1024 - Checked (1.10.6s) */ - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0} -}; - -static const SiS310_LVDSDesStruct SiS310_PanelType1210_2[]= /* TW: New */ -{ /* 1280x1024 - Checked (1.10.6s) */ - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0} -}; - -static const SiS310_LVDSDesStruct SiS310_PanelType1296_1[]= /* TW: New */ -{ /* 1400x1050 - Checked (1.10.6s) */ - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0} -}; - -static const SiS310_LVDSDesStruct SiS310_PanelType1296_2[]= /* TW: New */ -{ /* 1400x1050 - Checked (1.10.6s) - looks heavily invalid */ - { 808 , 740}, - { 0 , 715}, - { 632 , 740}, - { 632 , 715}, - { 1307, 780}, - { 1387,1157}, - { 1499, 924}, - { 1627,1052}, - { 0 , 0} -}; - -static const SiS310_LVDSDesStruct SiS310_PanelType1600_1[]= /* TW: New */ -{ /* 1600x1200 - Checked (1.10.6s) */ - { 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_PanelTypeNS_1[]= +{ + { 8, 0}, + { 8, 0}, + { 8, 0}, + { 8, 0}, + { 8, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 806}, + { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType1600_2[]= /* TW: New */ -{ /* 1600x1200 - Checked (1.10.6s) - looks heavily invalid */ +static const SiS_LVDSDesStruct SiS310_PanelTypeNS_2[] = +{ { 0 , 0}, { 0 , 0}, { 0 , 0}, @@ -2693,1612 +1514,332 @@ { 0 , 0} }; -static const SiS310_LVDSDesStruct SiS310_CHTVUNTSCDesData[]= -{ - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0} -}; - -static const SiS310_LVDSDesStruct SiS310_CHTVONTSCDesData[]= -{ - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0} -}; +/* CRT1 CRTC for SlaveModes and LCDA */ -static const SiS310_LVDSDesStruct SiS310_CHTVUPALDesData[]= +static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_1[] = { - {256, 0}, - {256, 0}, - {256, 0}, - {256, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0} + {{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 SiS310_LVDSDesStruct SiS310_CHTVOPALDesData[]= +static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_1_H[] = { - {256, 0}, - {256, 0}, - {256, 0}, - {256, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0} + {{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 }} }; -typedef struct _SiS310_Part2PortTblStruct -{ - UCHAR CR[12]; -} SiS310_Part2PortTblStruct; - -static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1024x768_1[] = +static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_2[]= { - {{0x25,0x12,0xc9,0xdc,0xb6,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, - {{0x2c,0x12,0x9a,0xae,0x88,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, - {{0x25,0x12,0xc9,0xdc,0xb6,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, - {{0x38,0x13,0x16,0x0c,0xe6,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, - {{0x38,0x18,0x16,0x00,0x00,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, - {{0x36,0x13,0x13,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, - {{0x25,0x12,0xc9,0xdc,0xb6,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}} -}; - -static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1280x1024_1[] = -{ /* TW: Temporary data, invalid */ - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}} -}; - -static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1400x1050_1[] = -{ /* TW: Temporary data, invalid */ - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}} -}; - -static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1600x1200_1[] = -{ /* TW: Temporary data, invalid */ - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}} -}; - -static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1024x768_2[] = -{ - {{0x25,0x12,0x51,0x6e,0x48,0x99,0x35,0x89,0x47,0xc1,0x49,0x33}}, - {{0x2c,0x12,0x38,0x55,0x2f,0x99,0x35,0x89,0x47,0xc1,0x49,0x33}}, - {{0x25,0x12,0x51,0x6e,0x48,0x99,0x35,0x89,0x47,0xc1,0x49,0x33}}, - {{0x2c,0x12,0x38,0x55,0x2f,0xc1,0x35,0xb1,0x47,0xe9,0x71,0x33}}, - {{0x2d,0x12,0x79,0x96,0x70,0x99,0x35,0x89,0x47,0xc1,0x49,0x33}}, - {{0x29,0x12,0xb5,0xd2,0xac,0xe9,0x35,0xd9,0x47,0x11,0x99,0x33}}, - {{0x36,0x13,0x13,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,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,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 SiS310_Part2PortTblStruct SiS310_CRT2Part2_1280x1024_2[] = +static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_2_H[] = { - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} + {{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 SiS310_Part2PortTblStruct SiS310_CRT2Part2_1400x1050_2[] = +static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_1[] = { - {{0x2b,0x12,0xd9,0xe5,0xd5,0x2c,0x23,0x98,0x27,0x3e,0x08,0x42}}, - {{0x22,0x12,0xc0,0xcc,0xbc,0x2c,0x23,0x98,0x27,0x3e,0x08,0x42}}, - {{0x2b,0x12,0xd9,0xe5,0xd5,0x2c,0x23,0x98,0x27,0x3e,0x08,0x42}}, - {{0x22,0x12,0xc0,0xcc,0xbc,0x2c,0x23,0x98,0x27,0x3e,0x08,0x42}}, - {{0x33,0x13,0x01,0x0d,0xfd,0x2c,0x23,0x98,0x27,0x3e,0x08,0x42}}, - {{0x3f,0x1b,0x3d,0x49,0x39,0x54,0x23,0xc0,0x27,0x66,0x30,0x42}}, - {{0x33,0x1b,0x91,0x9d,0x8d,0x8c,0x23,0xf8,0x27,0x9e,0x68,0x42}}, - {{0x43,0x24,0x11,0x1d,0x0d,0xcc,0x23,0x38,0x37,0xde,0xa8,0x42}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}} -}; - -static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1600x1200_2[] = -{ /* TW: Temporary data, invalid */ - {{0x2b,0x12,0xd9,0xe5,0xd5,0x2c,0x23,0x98,0x27,0x3e,0x08,0x42}}, - {{0x22,0x12,0xc0,0xcc,0xbc,0x2c,0x23,0x98,0x27,0x3e,0x08,0x42}}, - {{0x2b,0x12,0xd9,0xe5,0xd5,0x2c,0x23,0x98,0x27,0x3e,0x08,0x42}}, - {{0x22,0x12,0xc0,0xcc,0xbc,0x2c,0x23,0x98,0x27,0x3e,0x08,0x42}}, - {{0x33,0x13,0x01,0x0d,0xfd,0x2c,0x23,0x98,0x27,0x3e,0x08,0x42}}, - {{0x3f,0x1b,0x3d,0x49,0x39,0x54,0x23,0xc0,0x27,0x66,0x30,0x42}}, - {{0x33,0x1b,0x91,0x9d,0x8d,0x8c,0x23,0xf8,0x27,0x9e,0x68,0x42}}, - {{0x43,0x24,0x11,0x1d,0x0d,0xcc,0x23,0x38,0x37,0xde,0xa8,0x42}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}} -}; - - -static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1024x768_3[] = -{ /* TW: Data from 650/301LVx 1.10.6s */ - {{0x25,0x13,0xc9,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, - {{0x2c,0x13,0x9a,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, - {{0x25,0x13,0xc9,0x24,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, - {{0x38,0x13,0x13,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, - {{0x38,0x18,0x16,0x00,0x00,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, - {{0x36,0x13,0x13,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, - {{0x25,0x13,0xc9,0x25,0xff,0xf9,0x45,0x09,0x07,0xf9,0x09,0x24}} -#if 0 /* TW: Data from 650/301LV */ - {{0x25,0x12,0xc9,0xdc,0xb6,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, - {{0x2c,0x12,0x9a,0xae,0x88,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, - {{0x25,0x12,0xc9,0xdc,0xb6,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, - {{0x38,0x13,0x13,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, - {{0x38,0x18,0x16,0x00,0x00,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, - {{0x36,0x13,0x13,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} -#endif -}; - -/* 1 2 4 5 6 1c 1d 1f 20 21 23 25 */ -static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1280x1024_3[] = -{ /* TW: Temporary data, invalid */ - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}} -}; - -static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1400x1050_3[] = -{ /* TW: Temporary data, invalid */ - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}} -}; - -static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1600x1200_3[] = -{ /* TW: Temporary data, invalid */ - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}} -}; - -typedef struct _SiS310_LCDACRT1DataStruct -{ - UCHAR CR[17]; -}SiS310_LCDACRT1DataStruct; - -static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT1800x600_1[] = -{ - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}} -}; - -static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11024x768_1[]= -{ /* TW: Checked (1.10.6s) */ - {{0x73,0x4f,0x4f,0x97,0x55,0x86,0xc4,0x1f, - 0x92,0x89,0x8f,0x8f,0xb5,0x30,0x00,0x05, + {{0x73,0x4f,0x97,0x53,0x84,0xb4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x05, 0x00}}, - {{0x73,0x4f,0x4f,0x97,0x55,0x86,0x97,0x1f, - 0x60,0x87,0x5d,0x5d,0x83,0x10,0x00,0x05, + {{0x73,0x4f,0x97,0x53,0x84,0x82,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x05, 0x00}}, - {{0x73,0x4f,0x4f,0x97,0x55,0x86,0xc4,0x1f, - 0x92,0x89,0x8f,0x8f,0xb5,0x30,0x00,0x05, + {{0x73,0x4f,0x97,0x53,0x84,0xb4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x05, 0x00}}, - {{0x73,0x4f,0x4f,0x97,0x55,0x86,0x97,0x1f, - 0x60,0x87,0x5d,0x5d,0x83,0x10,0x00,0x05, + {{0x73,0x4f,0x97,0x53,0x84,0x82,0x1f, + 0x60,0x87,0x5d,0x83,0x10,0x00,0x05, 0x00}}, - {{0x73,0x4f,0x4f,0x97,0x55,0x86,0x04,0x3e, - 0xE2,0x89,0xDf,0xDf,0x05,0x00,0x00,0x05, + {{0x73,0x4f,0x97,0x53,0x84,0x04,0x3e, + 0xE2,0x89,0xDf,0x05,0x00,0x00,0x05, 0x00}}, - {{0x87,0x63,0x63,0x8B,0x69,0x1A,0x7c,0xf0, - 0x5A,0x8F,0x57,0x57,0x7D,0x20,0x00,0x26, + {{0x87,0x63,0x8B,0x67,0x18,0x7c,0xf0, + 0x5A,0x81,0x57,0x7D,0x00,0x00,0x06, 0x01}}, - {{0xA3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf5, - 0x02,0x88,0xFf,0xFf,0x25,0x10,0x00,0x02, + {{0xA3,0x7f,0x87,0x83,0x94,0x24,0xf5, + 0x02,0x89,0xFf,0x25,0x10,0x00,0x02, 0x01}} }; -static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11280x1024_1[]= -{ /* Checked (1.10.6s) */ - {{0x7e,0x4f,0x4f,0x82,0x58,0x06,0xb8,0x1f, - 0x90,0x84,0x8f,0x8f,0xb9,0x30,0x00,0x06, - 0x00}}, - {{0x7e,0x4f,0x4f,0x82,0x58,0x06,0x86,0x1f, - 0x5e,0x82,0x5d,0x5d,0x87,0x10,0x00,0x06, +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}}, - {{0x7e,0x4f,0x4f,0x82,0x58,0x06,0xb8,0x1f, - 0x90,0x84,0x8f,0x8f,0xb9,0x30,0x00,0x06, + {{0x4b,0x27,0x8f,0x2b,0x1c,0xb4,0x1f, + 0x92,0x89,0x8f,0xb5,0x30,0x00,0x05, 0x00}}, - {{0x7e,0x4f,0x4f,0x82,0x58,0x06,0x86,0x1f, - 0x5e,0x82,0x5d,0x5d,0x87,0x10,0x00,0x06, - 0x00}}, - {{0x7e,0x4f,0x4f,0x82,0x58,0x06,0x08,0x3e, - 0xe0,0x84,0xdf,0xdf,0x09,0x00,0x00,0x06, - 0x00}}, - {{0x92,0x63,0x63,0x96,0x6c,0x1a,0x80,0xf0, - 0x58,0x8c,0x57,0x57,0x81,0x20,0x00,0x06, - 0x01}}, - {{0xae,0x7f,0x7f,0x92,0x88,0x96,0x28,0xf5, - 0x00,0x84,0xff,0xff,0x29,0x10,0x00,0x02, - 0x01}}, - {{0xce,0x9f,0x9f,0x92,0xa8,0x16,0x28,0x5a, - 0x00,0x84,0xff,0xff,0x29,0x01,0x00,0x07, - 0x01}} -}; - -static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11400x1050_1[]= -{ /* Checked (1.10.6s) */ - {{0x6f,0x4f,0x4f,0x93,0x54,0x82,0x9e,0x1f, - 0x93,0x86,0x8f,0x8f,0x9f,0x30,0x00,0x05, - 0x00}}, - {{0x6f,0x4f,0x4f,0x93,0x54,0x82,0x6c,0x1f, - 0x60,0x84,0x5d,0x5d,0x6d,0x10,0x00,0x05, - 0x00}}, - {{0x6f,0x4f,0x4f,0x93,0x54,0x82,0x9e,0x1f, - 0x93,0x86,0x8f,0x8f,0x9f,0x30,0x00,0x05, - 0x00}}, - {{0x6f,0x4f,0x4f,0x93,0x54,0x82,0x6c,0x1f, - 0x60,0x84,0x5d,0x5d,0x6d,0x10,0x00,0x05, - 0x00}}, - {{0x6f,0x4f,0x4f,0x93,0x54,0x82,0xee,0x1f, - 0xe2,0x86,0xdf,0xdf,0xef,0x10,0x00,0x05, - 0x00}}, - {{0x83,0x63,0x63,0x87,0x68,0x16,0x66,0xf0, - 0x5a,0x8e,0x57,0x57,0x67,0x20,0x00,0x06, - 0x01}}, - {{0x9f,0x7f,0x7f,0x83,0x84,0x92,0x0e,0xf5, - 0x02,0x86,0xff,0xff,0x0f,0x10,0x00,0x02, - 0x01}}, - {{0xbf,0x9f,0x9f,0x83,0xa4,0x12,0x0e,0x5a, - 0x02,0x86,0xff,0xff,0x0f,0x09,0x00,0x07, - 0x01}}, - {{0xce,0xae,0xae,0x92,0xb3,0x01,0x28,0x10, - 0x1a,0x80,0x19,0x19,0x29,0x0f,0x00,0x03, - 0x00}} -}; - -static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11600x1200_1[]= -{ /* MISSING */ - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}} -}; - -static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT1800x600_1_H[]= -{ - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}} -}; - -static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11024x768_1_H[]= -{ /* TW: Checked (1.10.6s) */ - {{0x4b,0x27,0x27,0x8f,0x2b,0x03,0xc4,0x1f, - 0x92,0x89,0x8f,0x8f,0xb5,0x30,0x00,0x44, - 0x00}}, - {{0x4b,0x27,0x27,0x8f,0x2b,0x03,0x97,0x1f, - 0x60,0x87,0x5D,0x5D,0x83,0x01,0x00,0x44, - 0x00}}, - {{0x4b,0x27,0x27,0x8f,0x2b,0x03,0xc4,0x1f, - 0x92,0x89,0x8f,0x8f,0xb5,0x30,0x00,0x44, - 0x00}}, - {{0x4b,0x27,0x27,0x8f,0x2b,0x03,0x97,0x1f, - 0x60,0x87,0x5D,0x5D,0x83,0x01,0x00,0x44, - 0x00}}, - {{0x4b,0x27,0x27,0x8f,0x32,0x1b,0x04,0x3e, - 0xE2,0x89,0xDf,0xDf,0x05,0x00,0x00,0x45, - 0x00}}, - {{0x55,0x31,0x31,0x99,0x46,0x1d,0x7c,0xf0, - 0x5A,0x8F,0x57,0x57,0x7D,0x20,0x00,0x55, - 0x01}}, - {{0x63,0x3F,0x3F,0x87,0x4a,0x93,0x24,0xf5, - 0x02,0x88,0xFf,0xFf,0x25,0x10,0x00,0x01, - 0x01}} -}; - -static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11280x1024_1_H[]= -{ /* Checked (1.10.6s) */ - {{0x56,0x27,0x27,0x9a,0x30,0x1e,0xb8,0x1f, - 0x90,0x84,0x8f,0x8f,0xb9,0x30,0x00,0x05, - 0x00}}, - {{0x3c,0x4f,0x4f,0x82,0x58,0x06,0x86,0xd1, /* <-- Invalid data - one byte missing in BIOS */ - 0xbc,0x80,0xbb,0xbb,0xe5,0x00,0x00,0x06, - 0x01}}, - {{0x56,0x27,0x27,0x9a,0x30,0x1e,0xb8,0x1f, - 0x90,0x84,0x8f,0x8f,0xb9,0x30,0x00,0x05, - 0x00}}, - {{0x3c,0x4f,0x4f,0x82,0x58,0x06,0x86,0xd1, - 0xbc,0x80,0xbb,0xbb,0xe5,0x00,0x00,0x06, - 0x01}}, - {{0x56,0x27,0x27,0x9a,0x30,0x1e,0x08,0x3e, - 0xe0,0x84,0xdf,0xdf,0x09,0x00,0x00,0x05, - 0x00}}, - {{0x60,0x31,0x31,0x84,0x3a,0x88,0x80,0xf0, - 0x58,0x8c,0x57,0x57,0x81,0x20,0x00,0x01, - 0x01}}, - {{0x6e,0x3f,0x3f,0x92,0x48,0x96,0x28,0xf5, - 0x00,0x84,0xff,0xff,0x29,0x10,0x00,0x01, - 0x01}} -}; - -static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11400x1050_1_H[]= -{ /* Checked (1.10.6s) */ - {{0x47,0x27,0x27,0x8b,0x2c,0x1a,0x9e,0x1f, - 0x93,0x86,0x8f,0x8f,0x9f,0x30,0x00,0x05, - 0x00}}, - {{0x47,0x27,0x27,0x8b,0x2c,0x1a,0x6c,0x1f, - 0x60,0x84,0x5d,0x5d,0x6d,0x10,0x00,0x05, - 0x00}}, - {{0x47,0x27,0x27,0x8b,0x30,0x1e,0x9e,0x1f, - 0x92,0x86,0x8f,0x8f,0x9f,0x30,0x00,0x05, - 0x00}}, - {{0x47,0x27,0x27,0x8b,0x2c,0x1a,0x6c,0x1f, - 0x60,0x84,0x5d,0x5d,0x6d,0x10,0x00,0x05, - 0x00}}, - {{0x47,0x27,0x27,0x8b,0x2c,0x1a,0xee,0x1f, - 0xe2,0x86,0xdf,0xdf,0xef,0x10,0x00,0x05, - 0x00}}, - {{0x51,0x31,0x31,0x95,0x36,0x04,0x66,0xf0, - 0x5a,0x8e,0x57,0x57,0x67,0x20,0x00,0x01, - 0x01}}, - {{0x5f,0x3f,0x3f,0x83,0x44,0x92,0x0e,0xf5, - 0x02,0x86,0xff,0xff,0x0f,0x10,0x00,0x01, - 0x01}}, - {{0x6f,0x4f,0x4f,0x93,0x54,0x82,0x0e,0x5a, - 0x02,0x86,0xff,0xff,0x0f,0x09,0x00,0x05, - 0x01}}, - {{0x76,0x56,0x56,0x9a,0x5b,0x89,0x28,0x10, - 0x1c,0x80,0x19,0x19,0x29,0x0b,0x00,0x05, - 0x00}} -}; - -static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11600x1200_1_H[]= -{ /* MISSING */ - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}} -}; - -static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT1800x600_2[]= -{ - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}} -}; - -static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11024x768_2[]= -{ /* Checked (1.10.6s) */ - {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x4a,0x80,0x8f,0x8f,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x31,0x87,0x5d,0x5d,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x4a,0x80,0x8f,0x8f,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x31,0x87,0x5d,0x5d,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x72,0x88,0xdf,0xdf,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x63,0x63,0x87,0x78,0x89,0x24,0xf1, - 0xae,0x84,0x57,0x57,0x25,0x30,0x00,0x02, - 0x01}}, - {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf5, - 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x02, - 0x01}} -}; - -static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11280x1024_2[]= -{ /* Checked (1.10.6s) */ - {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x4a,0x80,0x8f,0x8f,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x31,0x87,0x5d,0x5d,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x4a,0x80,0x8f,0x8f,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x31,0x87,0x5d,0x5d,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x72,0x88,0xdf,0xdf,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x63,0x63,0x87,0x78,0x89,0x24,0xf1, - 0xae,0x84,0x57,0x57,0x25,0x30,0x00,0x02, - 0x01}}, - {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf5, - 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x02, - 0x01}} -}; - -static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11400x1050_2[]= -{ /* Checked (1.10.6s) */ - {{0xce,0x4f,0x4f,0x92,0x8c,0x1a,0x28,0x9a, - 0xdb,0x8f,0x8f,0x8f,0x29,0x21,0x00,0x03, - 0x00}}, - {{0xce,0x4f,0x4f,0x92,0x8c,0x1a,0x28,0x9a, - 0xc2,0x86,0x5d,0x5d,0x29,0x01,0x00,0x03, - 0x01}}, - {{0xce,0x4f,0x4f,0x92,0x8c,0x1a,0x28,0x9a, - 0xdb,0x8f,0x8f,0x8f,0x29,0x21,0x00,0x03, - 0x00}}, - {{0xce,0x4f,0x4f,0x92,0x8c,0x1a,0x28,0x9a, - 0xc2,0x86,0x5d,0x5d,0x29,0x01,0x00,0x03, - 0x00}}, - {{0xce,0x4f,0x4f,0x92,0x8c,0x1a,0x28,0x9e, - 0x03,0x87,0xdf,0xdf,0x29,0x01,0x00,0x03, - 0x00}}, - {{0xce,0x63,0x63,0x92,0x96,0x04,0x28,0xd4, - 0x3f,0x83,0x57,0x57,0x29,0x01,0x00,0x07, - 0x01}}, - {{0xce,0x7f,0x7f,0x92,0xa4,0x12,0x28,0xd4, - 0x93,0x87,0xff,0xff,0x29,0x21,0x00,0x07, - 0x01}}, - {{0xce,0x9f,0x9f,0x92,0xb4,0x02,0x28,0x5a, - 0x13,0x87,0xff,0xff,0x29,0x29,0x00,0x03, - 0x01}}, - {{0xce,0xae,0xae,0x92,0xbc,0x0a,0x28,0x10, - 0x20,0x84,0x19,0x19,0x29,0x0f,0x00,0x03, - 0x00}} -}; - -static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11600x1200_2[]= -{ /* MISSING */ - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}} -}; - -static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT1800x600_2_H[]= -{ - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}} -}; - -static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11024x768_2_H[]= -{ /* Checked (1.10.6s) */ - {{0x4f,0x27,0x27,0x93,0x39,0x01,0x24,0xbb, - 0x4a,0x80,0x8f,0x8f,0x25,0x30,0x00,0x01, - 0x00 }}, - {{0x4f,0x27,0x27,0x93,0x39,0x01,0x24,0xbb, - 0x31,0x87,0x8d,0x5d,0x25,0x30,0x00,0x01, /* <-- invalid data */ - 0x00 }}, - {{0x4f,0x27,0x27,0x93,0x39,0x01,0x24,0xbb, - 0x4a,0x80,0x8f,0x8f,0x25,0x30,0x00,0x01, - 0x00 }}, - {{0x4f,0x27,0x27,0x93,0x39,0x01,0x24,0xbb, - 0x31,0x87,0x5d,0x5d,0x25,0x30,0x00,0x01, - 0x00 }}, - {{0x4f,0x27,0x27,0x93,0x39,0x01,0x24,0xbb, - 0x72,0x88,0xdf,0xdf,0x25,0x30,0x00,0x01, - 0x00 }}, - {{0x4f,0x31,0x31,0x93,0x3e,0x06,0x24,0xf1, - 0xae,0x84,0x57,0x57,0x25,0x30,0x00,0x01, /* <-- invalid data */ - 0x01 }}, - {{0x4f,0x3f,0x3f,0x93,0x45,0x0d,0x24,0xf5, - 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x01, - 0x01 }} -}; - -static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11280x1024_2_H[]= -{ /* Checked (1.10.6s) */ - {{0x4f,0x27,0x27,0x93,0x39,0x81,0x24,0xbb, - 0x4a,0x80,0x8f,0x8f,0x25,0x30,0x00,0x01, - 0x00 }}, - {{0x4f,0x27,0x27,0x93,0x39,0x81,0x24,0xbb, - 0x31,0x87,0x5d,0x5d,0x25,0x30,0x00,0x01, - 0x00 }}, - {{0x4f,0x27,0x27,0x93,0x39,0x81,0x24,0xbb, - 0x4a,0x80,0x8f,0x8f,0x25,0x30,0x00,0x01, - 0x00 }}, - {{0x4f,0x27,0x27,0x93,0x39,0x81,0x24,0xbb, - 0x31,0x87,0x5d,0x5d,0x25,0x30,0x00,0x01, - 0x00 }}, - {{0x4f,0x27,0x27,0x93,0x39,0x81,0x24,0xbb, - 0x72,0x88,0xdf,0xdf,0x25,0x30,0x00,0x01, - 0x00 }}, - {{0x4f,0x31,0x31,0x93,0x3e,0x86,0x24,0xf1, - 0xae,0x84,0x57,0x57,0x25,0x30,0x00,0x01, - 0x01 }}, - {{0x4f,0x3f,0x3f,0x93,0x45,0x0d,0x24,0xf5, - 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x01, - 0x01 }} -}; - -static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11400x1050_2_H[]= -{ /* Checked (1.10.6s) */ - {{0xa6,0x27,0x27,0x8a,0x64,0x92,0x28,0x9a, - 0xdb,0x8f,0x8f,0x8f,0x29,0x21,0x00,0x06, - 0x00}}, - {{0xa6,0x27,0x27,0x8a,0x64,0x92,0x28,0x9a, - 0xc2,0x86,0x5d,0x5d,0x29,0x01,0x00,0x06, - 0x00}}, - {{0xa6,0x27,0x27,0x8a,0x64,0x92,0x28,0x9a, - 0xdb,0x8f,0x8f,0x8f,0x29,0x21,0x00,0x06, - 0x00}}, - {{0xa6,0x27,0x27,0x8a,0x64,0x92,0x28,0x9a, - 0xc2,0x86,0x5d,0x5d,0x29,0x01,0x00,0x06, - 0x00}}, - {{0xa6,0x27,0x27,0x8a,0x64,0x92,0x28,0x9e, - 0x03,0x87,0xdf,0xdf,0x29,0x01,0x00,0x06, - 0x00}}, - {{0x9c,0x31,0x31,0x80,0x64,0x92,0x28,0xd4, - 0x3f,0x83,0x57,0x57,0x29,0x01,0x00,0x06, - 0x01}}, - {{0x8e,0x3f,0x3f,0x92,0x64,0x12,0x28,0xd4, - 0x93,0x87,0xff,0xff,0x29,0x21,0x00,0x06, - 0x01}}, - {{0x7e,0x4f,0x4f,0x82,0x64,0x12,0x28,0x5a, - 0x13,0x87,0xff,0xff,0x29,0x29,0x00,0x06, - 0x01}}, - {{0x76,0x56,0x56,0x9a,0x64,0x92,0x28,0x10, - 0x20,0x84,0x19,0x19,0x29,0x0f,0x00,0x05, - 0x00}} -}; - -static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11600x1200_2_H[]= -{ /* MISSING */ - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00}} -}; - -typedef struct _SiS310_LVDSCRT1DataStruct -{ - UCHAR CR[15]; -} SiS310_LVDSCRT1DataStruct; - -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1320x480_1[] = -{ - {{0x65,0x4f,0x89,0x56,0x83,0xaa,0x1f, - 0x90,0x85,0x8f,0xab,0x30,0x00,0x05, - 0x00 }}, - {{0x65,0x4f,0x89,0x56,0x83,0x83,0x1f, - 0x5e,0x83,0x5d,0x79,0x10,0x00,0x05, - 0x00 }}, - {{0x65,0x4f,0x89,0x54,0x9f,0xc4,0x1f, - 0x92,0x89,0x8f,0xb5,0x30,0x00,0x01, - 0x00 }}, - {{0x65,0x4f,0x89,0x56,0x83,0x83,0x1f, - 0x5e,0x83,0x5d,0x79,0x10,0x00,0x05, - 0x00 }}, - {{0x65,0x4f,0x89,0x56,0x83,0x04,0x3e, - 0xe0,0x85,0xdf,0xfb,0x10,0x00,0x05, - 0x00 }}, - {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0, - 0x58,0x8c,0x57,0x73,0x20,0x00,0x06, - 0x01 }}, - {{0x2d,0x27,0x90,0x2c,0x80,0x0b,0x3e, - 0xe9,0x8b,0xe7,0x04,0x00,0x00,0x00, - 0x00 }} -}; - -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_1[] = /* TW: New */ -{ - {{0x6b,0x4f,0x8f,0x55,0x85,0xaa,0x1f, - 0x90,0x85,0x8f,0xab,0x30,0x00,0x05, - 0x00 }}, - {{0x6b,0x4f,0x8f,0x55,0x85,0x78,0x1f, - 0x5e,0x83,0x5d,0x79,0x10,0x00,0x05, - 0x00 }}, - {{0x6b,0x4f,0x8f,0x55,0x85,0xaa,0x1f, - 0x90,0x85,0x8f,0xab,0x30,0x00,0x05, - 0x00 }}, - {{0x6b,0x4f,0x8f,0x55,0x85,0x78,0x1f, - 0x5e,0x83,0x5d,0x79,0x10,0x00,0x05, - 0x00 }}, - {{0x6b,0x4f,0x8f,0x55,0x85,0xfa,0x1f, - 0xe0,0x85,0xdf,0xfb,0x10,0x00,0x05, - 0x00 }}, - {{0x7f,0x63,0x83,0x69,0x19,0x72,0xf0, - 0x58,0x8c,0x57,0x73,0x20,0x00,0x06, - 0x01 }} -}; - -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_1[] = /* TW: New */ -{ - {{0x73,0x4f,0x97,0x53,0x84,0xb4,0x1f, - 0x92,0x89,0x8f,0xb5,0x30,0x00,0x05, - 0x00}}, - {{0x73,0x4f,0x97,0x53,0x84,0x82,0x1f, - 0x60,0x87,0x5d,0x83,0x10,0x00,0x05, - 0x00}}, - {{0x73,0x4f,0x97,0x53,0x84,0xb4,0x1f, - 0x92,0x89,0x8f,0xb5,0x30,0x00,0x05, - 0x00}}, - {{0x73,0x4f,0x97,0x53,0x84,0x82,0x1f, - 0x60,0x87,0x5d,0x83,0x10,0x00,0x05, - 0x00}}, - {{0x73,0x4f,0x97,0x53,0x84,0x04,0x3e, - 0xE2,0x89,0xDf,0x05,0x00,0x00,0x05, - 0x00}}, - {{0x87,0x63,0x8B,0x67,0x18,0x7c,0xf0, - 0x5A,0x81,0x57,0x7D,0x00,0x00,0x06, - 0x01}}, - {{0xA3,0x7f,0x87,0x83,0x94,0x24,0xf5, - 0x02,0x89,0xFf,0x25,0x10,0x00,0x02, - 0x01}} -}; - -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_1[] = /* TW: New */ -{ - {{0x7e,0x4f,0x82,0x56,0x04,0xb8,0x1f, - 0x90,0x84,0x8f,0xb9,0x30,0x00,0x06, - 0x00 }}, - {{0x7e,0x4f,0x82,0x56,0x04,0x86,0x1f, - 0x5e,0x82,0x5d,0x87,0x10,0x00,0x06, - 0x00 }}, - {{0x7e,0x4f,0x82,0x56,0x04,0xb8,0x1f, - 0x90,0x84,0x8f,0xb9,0x30,0x00,0x06, - 0x00 }}, - {{0x7e,0x4f,0x82,0x56,0x04,0x86,0x1f, - 0x5e,0x82,0x5d,0x87,0x10,0x00,0x06, - 0x00 }}, - {{0x7e,0x4f,0x82,0x56,0x04,0x08,0x3e, - 0xe0,0x84,0xdf,0x09,0x00,0x00,0x06, - 0x00 }}, - {{0x92,0x63,0x96,0x6a,0x18,0x80,0xf0, - 0x58,0x8c,0x57,0x81,0x20,0x00,0x06, - 0x01 }}, - {{0xae,0x7f,0x92,0x86,0x94,0x28,0xf5, - 0x00,0x84,0xff,0x29,0x10,0x00,0x02, - 0x01 }}, - {{0xce,0x9f,0x92,0xa6,0x14,0x28,0x5a, - 0x00,0x84,0xff,0x29,0x09,0x00,0x07, - 0x01}} -}; - -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_1_H[] = /* TW: New */ -{ - {{0x43,0x27,0x87,0x2d,0x1d,0xaa,0x1f, - 0x90,0x85,0x8f,0xab,0x30,0x00,0x05, - 0x00 }}, - {{0x43,0x27,0x87,0x2d,0x1d,0x78,0x1f, - 0x5e,0x83,0x5d,0x79,0x10,0x00,0x05, - 0x00 }}, - {{0x43,0x27,0x87,0x2d,0x1d,0xfa,0x1f, - 0xe0,0x85,0xdf,0xfb,0x10,0x00,0x05, - 0x00 }}, - {{0x43,0x27,0x87,0x2d,0x1d,0x78,0x1f, - 0x5e,0x83,0x5d,0x79,0x10,0x00,0x05, - 0x00 }}, - {{0x43,0x27,0x87,0x2d,0x1d,0xfa,0x1f, - 0xe0,0x85,0xdf,0xfb,0x10,0x00,0x05, - 0x00 }}, - {{0x4d,0x31,0x91,0x37,0x07,0x72,0xf0, - 0x58,0x8d,0x57,0x73,0x20,0x00,0x01, - 0x01 }} -}; - -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_1_H[] = /* TW: New */ -{ - {{0x4b,0x27,0x8f,0x2b,0x1c,0xb4,0x1f, - 0x92,0x89,0x8f,0xb5,0x30,0x00,0x05, - 0x00 }}, - {{0x4b,0x27,0x8f,0x2b,0x1c,0x82,0x1f, - 0x60,0x87,0x5D,0x83,0x01,0x00,0x05, - 0x00}}, - {{0x4b,0x27,0x8f,0x2b,0x1c,0xb4,0x1f, - 0x92,0x89,0x8f,0xb5,0x30,0x00,0x05, - 0x00}}, - {{0x4b,0x27,0x8f,0x2b,0x1c,0x82,0x1f, - 0x60,0x87,0x5D,0x83,0x01,0x00,0x05, - 0x00}}, - {{0x4b,0x27,0x8f,0x2b,0x1c,0x04,0x3e, - 0xE2,0x89,0xDf,0x05,0x00,0x00,0x05, - 0x00}}, - {{0x55,0x31,0x99,0x35,0x06,0x7c,0xf0, - 0x5A,0x81,0x57,0x7D,0x00,0x00,0x01, - 0x01}}, - {{0x63,0x3F,0x87,0x43,0x94,0x24,0xf5, - 0x02,0x89,0xFf,0x25,0x10,0x00,0x01, - 0x01 }} -}; - -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_1_H[] = /* TW: New */ -{ - {{0x56,0x27,0x9a,0x2e,0x1c,0xb8,0x1f, - 0x90,0x84,0x8f,0xb9,0x30,0x00,0x05, - 0x00 }}, - {{0x56,0x27,0x9a,0x2e,0x1c,0x86,0x1f, - 0x5e,0x82,0x5d,0x87,0x10,0x00,0x05, - 0x00 }}, - {{0x56,0x27,0x9a,0x2e,0x1c,0xb8,0x1f, - 0x90,0x84,0x8f,0xb9,0x30,0x00,0x05, - 0x00 }}, - {{0x56,0x27,0x9a,0x2e,0x1c,0x86,0x1f, - 0x5e,0x82,0x5d,0x87,0x10,0x00,0x05, - 0x01 }}, - {{0x56,0x27,0x9a,0x2e,0x1c,0x08,0x3e, - 0xe0,0x84,0xdf,0x09,0x00,0x00,0x05, - 0x00 }}, - {{0x60,0x31,0x84,0x38,0x86,0x80,0xf0, - 0x58,0x8c,0x57,0x81,0x20,0x00,0x01, - 0x01 }}, - {{0x6e,0x3f,0x92,0x46,0x94,0x28,0xf5, - 0x00,0x84,0xff,0x29,0x10,0x00,0x01, - 0x01 }} -}; - -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_2[]= /* TW: New */ -{ - {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, - 0xff,0x84,0x8f,0x73,0x00,0x00,0x06, - 0x00 }}, - {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, - 0xe6,0x8b,0x5d,0x73,0x00,0x00,0x06, - 0x00 }}, - {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, - 0xff,0x84,0x8f,0x73,0x00,0x00,0x06, - 0x00 }}, - {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, - 0xe6,0x8b,0x5d,0x73,0x00,0x00,0x06, - 0x00 }}, - {{0x7f,0x4f,0x83,0x62,0x12,0x72,0xba, - 0x27,0x8c,0xdf,0x73,0x00,0x00,0x06, - 0x00 }}, - {{0x7f,0x63,0x83,0x69,0x19,0x72,0xf0, - 0x58,0x8d,0x57,0x73,0x20,0x00,0x06, - 0x01 }} -}; - -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_2[] = /* TW: New */ -{ - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x57,0x8e,0x8f,0x25,0x30,0x00,0x06, - 0x00 }}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x3e,0x85,0x5d,0x25,0x10,0x00,0x06, - 0x00 }}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x57,0x8e,0x8f,0x25,0x30,0x00,0x06, - 0x00 }}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x3e,0x85,0x5d,0x25,0x10,0x00,0x06, - 0x01 }}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x7f,0x86,0xdf,0x25,0x10,0x00,0x06, - 0x00 }}, - {{0xa3,0x63,0x87,0x78,0x89,0x24,0xf1, - 0xbb,0x82,0x57,0x25,0x10,0x00,0x02, - 0x01 }}, - {{0xa3,0x7f,0x87,0x83,0x94,0x24,0xf5, - 0x02,0x89,0xff,0x25,0x10,0x00,0x02, - 0x01 }} -}; - -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_2[] = /* TW: New */ -{ - {{0xce,0x4f,0x92,0x81,0x0f,0x28,0x9a, - 0xdb,0x8f,0x8f,0x29,0x21,0x00,0x03, - 0x00 }}, - {{0xce,0x4f,0x92,0x81,0x0f,0x28,0x9a, - 0xc2,0x86,0x5d,0x29,0x01,0x00,0x03, - 0x00 }}, - {{0xce,0x4f,0x92,0x81,0x0f,0x28,0x9a, - 0xdb,0x8f,0x8f,0x29,0x21,0x00,0x03, - 0x00 }}, - {{0xce,0x4f,0x92,0x81,0x0f,0x28,0x9a, - 0xc2,0x86,0x5d,0x29,0x01,0x00,0x03, - 0x00 }}, - {{0xce,0x4f,0x92,0x81,0x0f,0x28,0x9e, - 0x03,0x87,0xdf,0x29,0x01,0x00,0x03, - 0x00 }}, - {{0xce,0x63,0x92,0x8b,0x19,0x28,0xd4, - 0x3f,0x83,0x57,0x29,0x01,0x00,0x03, - 0x01 }}, - {{0xce,0x7f,0x92,0x99,0x07,0x28,0xd4, - 0x93,0x87,0xff,0x29,0x21,0x00,0x07, - 0x01 }}, - {{0xce,0x9f,0x92,0xa6,0x14,0x28,0x5a, - 0x00,0x84,0xff,0x29,0x09,0x00,0x07, - 0x01}} -}; - -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_2_H[] = /* TW: New */ -{ - {{0x57,0x27,0x9b,0x3a,0x0a,0x72,0x3e, - 0xff,0x84,0x8f,0x73,0x00,0x00,0x01, - 0x00 }}, - {{0x57,0x27,0x9b,0x3a,0x0a,0x72,0x3e, - 0xd6,0x8b,0x5d,0x73,0x00,0x00,0x01, - 0x00 }}, - {{0x57,0x27,0x9b,0x3a,0x0a,0x72,0x3e, - 0xff,0x84,0x8f,0x73,0x00,0x00,0x01, - 0x00 }}, - {{0x57,0x27,0x9b,0x3a,0x0a,0x72,0x3e, - 0xd6,0x8b,0x5d,0x73,0x00,0x00,0x01, - 0x00 }}, - {{0x57,0x27,0x9b,0x3a,0x0a,0x72,0xba, - 0x27,0x8c,0xdf,0x73,0x00,0x00,0x01, - 0x00 }}, - {{0x4d,0x31,0x91,0x3a,0x0a,0x72,0xf0, - 0x63,0x88,0x57,0x73,0x00,0x00,0x01, - 0x01 }} -}; - -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_2_H[] = /* TW: New */ -{ - {{0x7b,0x27,0x9f,0x46,0x97,0x24,0xbb, - 0x57,0x8e,0x8f,0x25,0x30,0x00,0x01, - 0x00 }}, - {{0x7b,0x27,0x9f,0x46,0x97,0x24,0xbb, - 0x3e,0x85,0x5d,0x25,0x10,0x00,0x01, - 0x00 }}, - {{0x7b,0x27,0x9f,0x46,0x97,0x24,0xbb, - 0x57,0x8e,0x8f,0x25,0x30,0x00,0x01, - 0x00 }}, - {{0x7b,0x27,0x9f,0x46,0x97,0x24,0xbb, - 0x3e,0x85,0x5d,0x25,0x10,0x00,0x01, - 0x00 }}, - {{0x7b,0x27,0x9f,0x46,0x97,0x24,0xbb, - 0x7f,0x86,0xdf,0x25,0x10,0x00,0x01, - 0x00 }}, - {{0x71,0x31,0x95,0x46,0x97,0x24,0xf1, - 0xbb,0x82,0x57,0x25,0x10,0x00,0x01, - 0x01 }}, - {{0x63,0x3f,0x87,0x46,0x97,0x24,0xf5, - 0x0f,0x86,0xff,0x25,0x30,0x00,0x01, - 0x01 }} -}; - -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_2_H[] = /* TW: New */ -{ - {{0xa6,0x27,0x8a,0x59,0x87,0x28,0x9a, - 0xdb,0x8f,0x8f,0x29,0x21,0x00,0x06, - 0x00 }}, - {{0xa6,0x27,0x8a,0x59,0x87,0x28,0x9a, - 0xc2,0x86,0x5d,0x29,0x01,0x00,0x06, - 0x00 }}, - {{0xa6,0x27,0x8a,0x59,0x87,0x28,0x9a, - 0xdb,0x8f,0x8f,0x29,0x21,0x00,0x06, - 0x00 }}, - {{0xa6,0x27,0x8a,0x59,0x87,0x28,0x9a, - 0xc2,0x86,0x5d,0x29,0x01,0x00,0x06, - 0x00 }}, - {{0xa6,0x27,0x8a,0x59,0x87,0x28,0x9e, - 0x03,0x87,0xdf,0x29,0x01,0x00,0x06, - 0x00 }}, - {{0x9c,0x31,0x80,0x59,0x87,0x28,0xd4, - 0x3f,0x83,0x57,0x29,0x01,0x00,0x06, - 0x01 }}, - {{0x8e,0x3f,0x92,0x79,0x07,0x28,0xd4, - 0x93,0x87,0xff,0x29,0x21,0x00,0x06, - 0x01}} -}; - -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1XXXxXXX_1[] = /* TW: New */ -{ - {{0x5f,0x4f,0x82,0x55,0x81,0xbf,0x1f, - 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x05, - 0x00}}, - {{0x5f,0x4f,0x82,0x55,0x81,0xbf,0x1f, - 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x05, - 0x00}}, - {{0x5f,0x4f,0x82,0x55,0x81,0xbf,0x1f, - 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x05, - 0x00}}, - {{0x5f,0x4f,0x82,0x55,0x81,0xbf,0x1f, - 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x05, - 0x00}}, - {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e, - 0xe9,0x8b,0xe7,0x04,0x00,0x00,0x05, - 0x00}}, - {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0, - 0x58,0x8c,0x57,0x73,0x20,0x00,0x06, - 0x01}}, - {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x02, - 0x01}}, - {{0xce,0x9f,0x92,0xa9,0x17,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x07, - 0x01}} -}; - -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1XXXxXXX_1_H[] = /* TW: New */ -{ - {{0x38,0x27,0x9c,0x2c,0x80,0xbf,0x1f, - 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x00, - 0x00}}, - {{0x38,0x27,0x9c,0x2c,0x80,0xbf,0x1f, - 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x00, - 0x00}}, - {{0x38,0x27,0x9c,0x2c,0x80,0xbf,0x1f, - 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x00, - 0x00}}, - {{0x38,0x27,0x9c,0x2c,0x80,0xbf,0x1f, - 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x00, - 0x00}}, - {{0x38,0x27,0x9c,0x2c,0x80,0x0b,0x3e, - 0xe9,0x8b,0xe7,0x04,0x00,0x00,0x00, - 0x00}}, - {{0x4d,0x31,0x91,0x3b,0x03,0x72,0xf0, - 0x58,0x8c,0x57,0x73,0x20,0x00,0x01, - 0x01}}, - {{0x63,0x3f,0x87,0x4a,0x92,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x01, - 0x01}} -}; - -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_1[] = /* TW: New */ -{ - {{0x6f,0x4f,0x93,0x54,0x82,0x9e,0x1f, - 0x93,0x86,0x8f,0x9f,0x30,0x00,0x05, - 0x00}}, - {{0x6f,0x4f,0x93,0x54,0x82,0x6c,0x1f, - 0x60,0x84,0x5d,0x6d,0x10,0x00,0x05, - 0x00}}, - {{0x6f,0x4f,0x93,0x54,0x82,0x9e,0x1f, - 0x93,0x86,0x8f,0x9f,0x30,0x00,0x05, - 0x00}}, - {{0x6f,0x4f,0x93,0x54,0x82,0x6c,0x1f, - 0x60,0x84,0x5d,0x6d,0x10,0x00,0x05, + {{0x4b,0x27,0x8f,0x2b,0x1c,0x82,0x1f, + 0x60,0x87,0x5D,0x83,0x01,0x00,0x05, 0x00}}, - {{0x6f,0x4f,0x93,0x54,0x82,0xee,0x1f, - 0xe2,0x86,0xdf,0xef,0x10,0x00,0x05, + {{0x4b,0x27,0x8f,0x2b,0x1c,0x04,0x3e, + 0xE2,0x89,0xDf,0x05,0x00,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, + {{0x55,0x31,0x99,0x35,0x06,0x7c,0xf0, + 0x5A,0x81,0x57,0x7D,0x00,0x00,0x01, 0x01}}, - {{0xce,0xae,0x92,0xb3,0x01,0x28,0x10, - 0x1a,0x80,0x19,0x29,0x0f,0x00,0x03, - 0x00}} + {{0x63,0x3F,0x87,0x43,0x94,0x24,0xf5, + 0x02,0x89,0xFf,0x25,0x10,0x00,0x01, + 0x01 }} }; -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_1_H[] = /* TW: New */ +static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_2[] = { - {{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}} + {{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 SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_2[] = /* TW: New */ +static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_2_H[] = { - {{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}} + {{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 SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_2_H[] = /* TW: New */ +static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_1[] = { - {{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}} -}; - -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x768_1[] = /* TW: New */ -{ /* TW: Temp data, invalid */ - {{0x7e,0x4f,0x82,0x56,0x04,0xb8,0x1f, + {{0x7e,0x4f,0x82,0x58,0x04,0xb8,0x1f, 0x90,0x84,0x8f,0xb9,0x30,0x00,0x06, - 0x00 }}, - {{0x7e,0x4f,0x82,0x56,0x04,0x86,0x1f, + 0x00}}, + {{0x7e,0x4f,0x82,0x58,0x04,0x86,0x1f, 0x5e,0x82,0x5d,0x87,0x10,0x00,0x06, - 0x00 }}, - {{0x7e,0x4f,0x82,0x56,0x04,0xb8,0x1f, + 0x00}}, + {{0x7e,0x4f,0x82,0x58,0x04,0xb8,0x1f, 0x90,0x84,0x8f,0xb9,0x30,0x00,0x06, - 0x00 }}, - {{0x7e,0x4f,0x82,0x56,0x04,0x86,0x1f, + 0x00}}, + {{0x7e,0x4f,0x82,0x58,0x04,0x86,0x1f, 0x5e,0x82,0x5d,0x87,0x10,0x00,0x06, - 0x00 }}, - {{0x7e,0x4f,0x82,0x56,0x04,0x08,0x3e, + 0x00}}, + {{0x7e,0x4f,0x82,0x58,0x04,0x08,0x3e, 0xe0,0x84,0xdf,0x09,0x00,0x00,0x06, - 0x00 }}, - {{0x92,0x63,0x96,0x6a,0x18,0x80,0xf0, + 0x00}}, + {{0x92,0x63,0x96,0x6c,0x18,0x80,0xf0, 0x58,0x8c,0x57,0x81,0x20,0x00,0x06, - 0x01 }}, - {{0xae,0x7f,0x92,0x86,0x94,0x28,0xf5, + 0x01}}, + {{0xae,0x7f,0x92,0x88,0x94,0x28,0xf5, 0x00,0x84,0xff,0x29,0x10,0x00,0x02, - 0x01 }}, - {{0xce,0x9f,0x92,0xa6,0x14,0x28,0x5a, + 0x01}}, + {{0xce,0x9f,0x92,0xa8,0x14,0x28,0x5a, 0x00,0x84,0xff,0x29,0x09,0x00,0x07, 0x01}} }; -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x768_1_H[] = /* TW: New */ -{ /* TW: Temp data, invalid */ - {{0x56,0x27,0x9a,0x2e,0x1c,0xb8,0x1f, +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,0x2e,0x1c,0x86,0x1f, + 0x00}}, + {{0x56,0x27,0x9a,0x31,0x1c,0x86,0x1f, 0x5e,0x82,0x5d,0x87,0x10,0x00,0x05, - 0x00 }}, - {{0x56,0x27,0x9a,0x2e,0x1c,0xb8,0x1f, + 0x00}}, + {{0x56,0x27,0x9a,0x31,0x1c,0xb8,0x1f, 0x90,0x84,0x8f,0xb9,0x30,0x00,0x05, - 0x00 }}, - {{0x56,0x27,0x9a,0x2e,0x1c,0x86,0x1f, + 0x00}}, + {{0x56,0x27,0x9a,0x31,0x1c,0x86,0x1f, 0x5e,0x82,0x5d,0x87,0x10,0x00,0x05, - 0x01 }}, - {{0x56,0x27,0x9a,0x2e,0x1c,0x08,0x3e, + 0x01}}, + {{0x56,0x27,0x9a,0x31,0x1c,0x08,0x3e, 0xe0,0x84,0xdf,0x09,0x00,0x00,0x05, - 0x00 }}, - {{0x60,0x31,0x84,0x38,0x86,0x80,0xf0, + 0x00}}, + {{0x60,0x31,0x84,0x3a,0x86,0x80,0xf0, 0x58,0x8c,0x57,0x81,0x20,0x00,0x01, - 0x01 }}, - {{0x6e,0x3f,0x92,0x46,0x94,0x28,0xf5, + 0x01}}, + {{0x6e,0x3f,0x92,0x48,0x94,0x28,0xf5, 0x00,0x84,0xff,0x29,0x10,0x00,0x01, - 0x01 }} + 0x01}} }; -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x768_2[] = /* TW: New */ -{ /* TW: Temp data, invalid */ - {{0xce,0x4f,0x92,0x81,0x0f,0x28,0x9a, - 0xdb,0x8f,0x8f,0x29,0x21,0x00,0x03, - 0x00 }}, - {{0xce,0x4f,0x92,0x81,0x0f,0x28,0x9a, - 0xc2,0x86,0x5d,0x29,0x01,0x00,0x03, - 0x00 }}, - {{0xce,0x4f,0x92,0x81,0x0f,0x28,0x9a, - 0xdb,0x8f,0x8f,0x29,0x21,0x00,0x03, - 0x00 }}, - {{0xce,0x4f,0x92,0x81,0x0f,0x28,0x9a, - 0xc2,0x86,0x5d,0x29,0x01,0x00,0x03, - 0x00 }}, - {{0xce,0x4f,0x92,0x81,0x0f,0x28,0x9e, - 0x03,0x87,0xdf,0x29,0x01,0x00,0x03, - 0x00 }}, +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 }}, + 0x01}}, {{0xce,0x7f,0x92,0x99,0x07,0x28,0xd4, 0x93,0x87,0xff,0x29,0x21,0x00,0x07, - 0x01 }}, - {{0xce,0x9f,0x92,0xa6,0x14,0x28,0x5a, + 0x01}}, + {{0xce,0x9f,0x92,0xa8,0x14,0x28,0x5a, 0x00,0x84,0xff,0x29,0x09,0x00,0x07, 0x01}} }; -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x768_2_H[] = /* TW: New */ -{ /* TW: Temp data, invalid */ - {{0xa6,0x27,0x8a,0x59,0x87,0x28,0x9a, - 0xdb,0x8f,0x8f,0x29,0x21,0x00,0x06, - 0x00 }}, - {{0xa6,0x27,0x8a,0x59,0x87,0x28,0x9a, - 0xc2,0x86,0x5d,0x29,0x01,0x00,0x06, - 0x00 }}, - {{0xa6,0x27,0x8a,0x59,0x87,0x28,0x9a, - 0xdb,0x8f,0x8f,0x29,0x21,0x00,0x06, - 0x00 }}, - {{0xa6,0x27,0x8a,0x59,0x87,0x28,0x9a, - 0xc2,0x86,0x5d,0x29,0x01,0x00,0x06, - 0x00 }}, - {{0xa6,0x27,0x8a,0x59,0x87,0x28,0x9e, - 0x03,0x87,0xdf,0x29,0x01,0x00,0x06, - 0x00 }}, +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,0x79,0x07,0x28,0xd4, + 0x01}}, + {{0x8e,0x3f,0x92,0x59,0x07,0x28,0xd4, 0x93,0x87,0xff,0x29,0x21,0x00,0x06, 0x01}} }; -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x600_1[] = +static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_1[] = { - {{0x64,0x4f,0x88,0x54,0x9f,0x5a,0x3e, - 0xe8,0x8f,0x8f,0x5b,0x00,0x00,0x01, - 0x00}}, - {{0x64,0x4f,0x88,0x54,0x9f,0x2e,0x3e, - 0xb9,0x80,0x5d,0x2f,0x00,0x00,0x01, - 0x00}}, - {{0x64,0x4f,0x88,0x54,0x9f,0x5a,0x3e, - 0xe8,0x8f,0x8f,0x5b,0x00,0x00,0x01, - 0x00}}, - {{0x64,0x4f,0x88,0x54,0x9f,0x2e,0x3e, - 0xb9,0x80,0x5d,0x2f,0x00,0x00,0x01, - 0x00}}, - {{0x64,0x4f,0x88,0x54,0x9f,0xaf,0xba, - 0x3b,0x82,0xdf,0xb0,0x00,0x00,0x01, - 0x00}}, - {{0x7e,0x63,0x82,0x68,0x15,0x1e,0xf1, - 0xae,0x85,0x57,0x1f,0x30,0x00,0x26, - 0x01}}, - {{0xa3,0x7f,0x87,0x86,0x97,0x1e,0xf1, - 0xae,0x85,0x57,0x1f,0x30,0x00,0x02, - 0x01}} -}; - -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x600_1_H[] = -{ - {{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f, - 0x92,0x89,0x8f,0xb5,0x30,0x00,0x44, - 0x00}}, - {{0x2f,0x27,0x93,0x2b,0x90,0x97,0x1f, - 0x60,0x87,0x5d,0x83,0x10,0x00,0x44, - 0x00}}, - {{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f, - 0x92,0x89,0x8f,0xb5,0x30,0x00,0x44, - 0x00}}, - {{0x2f,0x27,0x93,0x2b,0x90,0x97,0x1f, - 0x60,0x87,0x5d,0x83,0x10,0x00,0x44, - 0x00}}, - {{0x2f,0x27,0x93,0x2b,0x90,0x04,0x3e, - 0xe2,0x89,0xdf,0x05,0x00,0x00,0x44, - 0x00}}, - {{0x3c,0x31,0x80,0x35,0x1c,0x7c,0xf0, - 0x5a,0x8f,0x57,0x7d,0x20,0x00,0x55, - 0x01}}, - {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x01, - 0x01}} -}; - -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x600_2[] = -{ - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x72,0x88,0xdf,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x63,0x87,0x78,0x89,0x24,0xf1, - 0xae,0x84,0x57,0x25,0x30,0x00,0x02, - 0x01}}, - {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x02, - 0x01}} -}; - -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x600_2_H[] = -{ - {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, - 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, - 0x00}}, - {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, - 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, - 0x00}}, - {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, - 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, - 0x00}}, - {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, - 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, - 0x00}}, - {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, - 0x72,0x88,0xdf,0x25,0x30,0x00,0x01, - 0x00}}, - {{0x4f,0x31,0x93,0x3e,0x06,0x24,0xf1, - 0xae,0x84,0x57,0x25,0x30,0x00,0x01, - 0x01}}, - {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x01, - 0x01}} -}; - -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11152x768_1[] = -{ - {{0x64,0x4f,0x88,0x54,0x9f,0xc4,0x1f, - 0x92,0x89,0x8f,0xb5,0x30,0x00,0x01, - 0x00}}, - {{0x64,0x4f,0x88,0x54,0x9f,0x97,0x1f, - 0x60,0x87,0x5d,0x83,0x10,0x00,0x01, - 0x00}}, - {{0x64,0x4f,0x88,0x54,0x9f,0xc4,0x1f, - 0x92,0x89,0x8f,0xb5,0x30,0x00,0x01, - 0x00}}, - {{0x64,0x4f,0x88,0x54,0x9f,0x97,0x1f, - 0x60,0x87,0x5d,0x83,0x10,0x00,0x01, - 0x00}}, - {{0x64,0x4f,0x88,0x54,0x9f,0x04,0x3e, - 0xe2,0x89,0xdf,0x05,0x00,0x00,0x01, - 0x00}}, - {{0x7e,0x63,0x82,0x68,0x15,0x7c,0xf0, - 0x5a,0x8f,0x57,0x7d,0x20,0x00,0x26, - 0x01}}, - {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x02, - 0x01}} -}; - -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11152x768_1_H[] = -{ - {{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f, - 0x92,0x89,0x8f,0xb5,0x30,0x00,0x44, - 0x00}}, - {{0x2f,0x27,0x93,0x2b,0x90,0x97,0x1f, - 0x60,0x87,0x5d,0x83,0x10,0x00,0x44, - 0x00}}, - {{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f, - 0x92,0x89,0x8f,0xb5,0x30,0x00,0x44, - 0x00}}, - {{0x2f,0x27,0x93,0x2b,0x90,0x97,0x1f, - 0x60,0x87,0x5d,0x83,0x10,0x00,0x44, - 0x00}}, - {{0x2f,0x27,0x93,0x2b,0x90,0x04,0x3e, - 0xe2,0x89,0xdf,0x05,0x00,0x00,0x44, - 0x00}}, - {{0x3c,0x31,0x80,0x35,0x1c,0x7c,0xf0, - 0x5a,0x8f,0x57,0x7d,0x20,0x00,0x55, - 0x01}}, - {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x01, - 0x01}} -}; - -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11152x768_2[] = -{ - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x72,0x88,0xdf,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x63,0x87,0x78,0x89,0x24,0xf1, - 0xae,0x84,0x57,0x25,0x30,0x00,0x02, - 0x01}}, - {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x02, - 0x01}} -}; - -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11152x768_2_H[] = -{ - {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, - 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, - 0x00}}, - {{0x4f,0x27,0x93,0x39,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 SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11600x1200_1[] = -{ /* TW: Temporary data - invalid */ + {{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}}, @@ -4320,16 +1861,45 @@ {{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, + {{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}}, - {{0xce,0xae,0x92,0xb3,0x01,0x28,0x10, - 0x1a,0x80,0x19,0x29,0x0f,0x00,0x03, + {{0x6f,0x4f,0x93,0x54,0x82,0x0e,0x5a, + 0x02,0x86,0xff,0x0f,0x09,0x00,0x05, + 0x01}}, + {{0x76,0x56,0x9a,0x5b,0x89,0x28,0x10, + 0x1c,0x80,0x19,0x29,0x0b,0x00,0x05, 0x00}} -}; - -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11600x1200_1_H[] = -{ /* TW: Temporary data - invalid */ +#if 0 {{0x47,0x27,0x8b,0x2c,0x1a,0x9e,0x1f, 0x93,0x86,0x8f,0x9f,0x30,0x00,0x05, 0x00}}, @@ -4357,10 +1927,39 @@ {{0x76,0x56,0x9a,0x5b,0x89,0x28,0x10, 0x1c,0x80,0x19,0x29,0x0b,0x00,0x05, 0x00}} +#endif }; -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11600x1200_2[] = -{ /* TW: Temporary data - invalid */ +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}}, @@ -4388,10 +1987,39 @@ {{0xce,0xae,0x92,0xbc,0x0a,0x28,0x10, 0x20,0x84,0x19,0x29,0x0f,0x00,0x03, 0x00}} +#endif }; -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11600x1200_2_H[] = /* TW: New */ -{ /* TW: Temporary data - invalid */ +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}}, @@ -4419,255 +2047,560 @@ {{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 SiS310_LVDSCRT1DataStruct SiS310_CHTVCRT1UNTSC[] = /* TW: New */ -{ - {{0x64,0x4f,0x88,0x56,0x9f,0x56,0x3e, - 0xe8,0x84,0x8f,0x57,0x20,0x00,0x01, - 0x00 }}, - {{0x64,0x4f,0x88,0x56,0x9f,0x56,0x3e, - 0xd0,0x82,0x5d,0x57,0x00,0x00,0x01, - 0x00 }}, - {{0x64,0x4f,0x88,0x56,0x9f,0x56,0x3e, - 0xe8,0x84,0x8f,0x57,0x20,0x00,0x01, - 0x00 }}, - {{0x64,0x4f,0x88,0x56,0x9f,0x56,0x3e, - 0xd0,0x82,0x5d,0x57,0x00,0x00,0x01, - 0x00 }}, - {{0x5d,0x4f,0x81,0x56,0x99,0x56,0xba, - 0x0a,0x84,0xdf,0x57,0x00,0x00,0x01, - 0x00 }}, - {{0x80,0x63,0x84,0x6d,0x0f,0xec,0xf0, - 0x7a,0x8f,0x57,0xed,0x20,0x00,0x06, - 0x01 }}, - {{0x8c,0x7f,0x90,0x86,0x09,0xaf,0xf5, /* TW: 1024x768 */ - 0x36,0x88,0xff,0xb0,0x10,0x00,0x02, - 0x01}} +static const 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}} }; -static const SiS310_LVDSCRT1DataStruct SiS310_CHTVCRT1ONTSC[] = /* TW: New */ + +/* CRT1 CRTC for Chrontel TV slave modes */ + +static const SiS_LVDSCRT1DataStruct SiS310_CHTVCRT1UNTSC[] = { - {{0x63,0x4f,0x87,0x5a,0x9f,0x0b,0x3e, - 0xc0,0x84,0x8f,0x0c,0x20,0x00,0x01, - 0x00 }}, - {{0x63,0x4f,0x87,0x5a,0x9f,0x0b,0x3e, - 0xb0,0x8d,0x5d,0x0c,0x00,0x00,0x01, - 0x00 }}, - {{0x63,0x4f,0x87,0x5a,0x9f,0x0b,0x3e, - 0xc0,0x84,0x8f,0x0c,0x20,0x00,0x01, - 0x00 }}, - {{0x63,0x4f,0x87,0x5a,0x9f,0x0b,0x3e, - 0xb0,0x8d,0x5d,0x0c,0x00,0x00,0x01, - 0x00 }}, - {{0x5d,0x4f,0x81,0x58,0x9d,0x0b,0x3e, - 0xe8,0x84,0xdf,0x0c,0x00,0x00,0x01, - 0x00 }}, - {{0x7d,0x63,0x81,0x68,0x0e,0xba,0xf0, - 0x78,0x8a,0x57,0xbb,0x20,0x00,0x06, - 0x01 }}, - {{0x8c,0x7f,0x90,0x82,0x06,0x46,0xf5, /* TW: 1024x768 */ - 0x15,0x88,0xff,0x47,0x70,0x00,0x02, - 0x01 }} + {{0x64,0x4f,0x88,0x56,0x9f,0x56,0x3e, + 0xe8,0x84,0x8f,0x57,0x20,0x00,0x01, + 0x00 }}, + {{0x64,0x4f,0x88,0x56,0x9f,0x56,0x3e, + 0xd0,0x82,0x5d,0x57,0x00,0x00,0x01, + 0x00 }}, + {{0x64,0x4f,0x88,0x56,0x9f,0x56,0x3e, + 0xe8,0x84,0x8f,0x57,0x20,0x00,0x01, + 0x00 }}, + {{0x64,0x4f,0x88,0x56,0x9f,0x56,0x3e, + 0xd0,0x82,0x5d,0x57,0x00,0x00,0x01, + 0x00 }}, + {{0x5d,0x4f,0x81,0x56,0x99,0x56,0xba, + 0x0a,0x84,0xdf,0x57,0x00,0x00,0x01, + 0x00 }}, + {{0x80,0x63,0x84,0x6d,0x0f,0xec,0xf0, + 0x7a,0x8f,0x57,0xed,0x20,0x00,0x06, + 0x01 }}, + {{0x8c,0x7f,0x90,0x86,0x09,0xaf,0xf5, + 0x36,0x88,0xff,0xb0,0x10,0x00,0x02, + 0x01}} +}; + +static const SiS_LVDSCRT1DataStruct SiS310_CHTVCRT1ONTSC[] = +{ + {{0x63,0x4f,0x87,0x5a,0x9f,0x0b,0x3e, + 0xc0,0x84,0x8f,0x0c,0x20,0x00,0x01, + 0x00 }}, + {{0x63,0x4f,0x87,0x5a,0x9f,0x0b,0x3e, + 0xb0,0x8d,0x5d,0x0c,0x00,0x00,0x01, + 0x00 }}, + {{0x63,0x4f,0x87,0x5a,0x9f,0x0b,0x3e, + 0xc0,0x84,0x8f,0x0c,0x20,0x00,0x01, + 0x00 }}, + {{0x63,0x4f,0x87,0x5a,0x9f,0x0b,0x3e, + 0xb0,0x8d,0x5d,0x0c,0x00,0x00,0x01, + 0x00 }}, + {{0x5d,0x4f,0x81,0x58,0x9d,0x0b,0x3e, + 0xe8,0x84,0xdf,0x0c,0x00,0x00,0x01, + 0x00 }}, + {{0x7d,0x63,0x81,0x68,0x0e,0xba,0xf0, + 0x78,0x8a,0x57,0xbb,0x20,0x00,0x06, + 0x01 }}, + {{0x8c,0x7f,0x90,0x82,0x06,0x46,0xf5, + 0x15,0x88,0xff,0x47,0x70,0x00,0x02, + 0x01 }} }; -static const SiS310_LVDSCRT1DataStruct SiS310_CHTVCRT1UPAL[] = /* TW: New */ +static const SiS_LVDSCRT1DataStruct SiS310_CHTVCRT1UPAL[] = { - {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, - 0xf8,0x83,0x8f,0x70,0x20,0x00,0x05, - 0x00 }}, - {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, - 0xde,0x81,0x5d,0x70,0x00,0x00,0x05, - 0x00 }}, - {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, - 0xf8,0x83,0x8f,0x70,0x20,0x00,0x05, - 0x00 }}, - {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, - 0xde,0x81,0x5d,0x70,0x00,0x00,0x05, - 0x00 }}, - {{0x64,0x4f,0x88,0x5a,0x9f,0x6f,0xba, - 0x15,0x83,0xdf,0x70,0x00,0x00,0x01, - 0x00 }}, - {{0x73,0x63,0x97,0x69,0x8b,0xec,0xf0, - 0x90,0x8c,0x57,0xed,0x20,0x00,0x05, - 0x01 }}, - {{0xaa,0x7f,0x8e,0x8e,0x96,0xe6,0xf5, /* TW: 1024x768 */ - 0x50,0x88,0xff,0xe7,0x10,0x00,0x02, - 0x01}} -}; - -static const SiS310_LVDSCRT1DataStruct SiS310_CHTVCRT1OPAL[] = /* TW: New */ -{ - {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, - 0xf0,0x83,0x8f,0x70,0x20,0x00,0x05, - 0x00 }}, - {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, - 0xde,0x81,0x5d,0x70,0x00,0x00,0x05, - 0x00 }}, - {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, - 0xf0,0x83,0x8f,0x70,0x20,0x00,0x05, - 0x00 }}, - {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, - 0xde,0x81,0x5d,0x70,0x00,0x00,0x05, - 0x00 }}, - {{0x64,0x4f,0x88,0x58,0x9d,0x6f,0xba, - 0x15,0x83,0xdf,0x70,0x00,0x00,0x01, - 0x00 }}, - {{0x71,0x63,0x95,0x69,0x8c,0x6f,0xf0, - 0x5a,0x8b,0x57,0x70,0x20,0x00,0x05, - 0x01 }}, - {{0xaa,0x7f,0x8e,0x8f,0x96,0x69,0xf5, /* TW: 1024x768 */ - 0x28,0x88,0xff,0x6a,0x10,0x00,0x02, - 0x01 }} -}; - -static const SiS310_LVDSCRT1DataStruct SiS310_CHTVCRT1SOPAL[] = /* TW: New */ -{ - {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, - 0xf0,0x83,0x8f,0x70,0x20,0x00,0x05, - 0x00 }}, - {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, - 0xde,0x81,0x5d,0x70,0x00,0x00,0x05, - 0x00 }}, - {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, - 0xf0,0x83,0x8f,0x70,0x20,0x00,0x05, - 0x00 }}, - {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, - 0xde,0x81,0x5d,0x70,0x00,0x00,0x05, - 0x00 }}, - {{0x64,0x4f,0x88,0x58,0x9d,0x6f,0xba, - 0x15,0x83,0xdf,0x70,0x00,0x00,0x01, - 0x00 }}, - {{0x71,0x63,0x95,0x69,0x8c,0x6f,0xf0, - 0x5a,0x8b,0x57,0x70,0x20,0x00,0x05, - 0x01 }}, - {{0xaa,0x7f,0x8e,0x8f,0x96,0x69,0xf5, /* TW: 1024x768 */ - 0x28,0x88,0xff,0x6a,0x10,0x00,0x02, - 0x01 }} -}; - -/* TW: New data for Chrontel 7019 (From 650/LVDS BIOS 1.10.0) */ -typedef struct _SiS310_CHTVRegDataStruct -{ - UCHAR Reg[16]; -} SiS310_CHTVRegDataStruct; - -static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_UNTSC[] = -{ - {{0x4a,0x77,0xbb,0x94,0x84,0x48,0xfe,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, - {{0x4a,0x77,0xbb,0x94,0x84,0x48,0xfe,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, - {{0x4a,0x77,0xbb,0x94,0x84,0x48,0xfe,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, - {{0x4a,0x77,0xbb,0x94,0x84,0x48,0xfe,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, - {{0x6a,0x77,0xbb,0x6e,0x84,0x2e,0x02,0x5a,0x04,0x00,0x80,0x20,0x7e,0x80,0x98,0x00}}, - {{0xcf,0x77,0xb7,0xc8,0x84,0x3b,0x02,0x5a,0x04,0x00,0x80,0x19,0x88,0x30,0x7f,0x00}}, - {{0xee,0x77,0xbb,0x66,0x87,0x32,0x01,0x5a,0x04,0x00,0x80,0x1b,0xd3,0xf2,0x36,0x00}} -}; - -static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_ONTSC[] = -{ - {{0x49,0x77,0xbb,0x7b,0x84,0x34,0x00,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, - {{0x49,0x77,0xbb,0x7b,0x84,0x34,0x00,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, - {{0x49,0x77,0xbb,0x7b,0x84,0x34,0x00,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, - {{0x49,0x77,0xbb,0x7b,0x84,0x34,0x00,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, - {{0x69,0x77,0xbb,0x6e,0x84,0x1e,0x00,0x5a,0x04,0x00,0x80,0x25,0x1a,0x43,0x04,0x00}}, - {{0xce,0x77,0xb7,0xb6,0x83,0x2c,0x02,0x5a,0x04,0x00,0x80,0x1c,0x00,0x82,0x97,0x00}}, - {{0xed,0x77,0xbb,0x66,0x8c,0x21,0x02,0x5a,0x04,0x00,0x80,0x1f,0x9f,0xc1,0x0c,0x00}} -}; - -static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_UPAL[] = -{ - {{0x41,0x7f,0xb7,0x34,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, - {{0x41,0x7f,0xb7,0x80,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, - {{0x41,0x7f,0xb7,0x34,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, - {{0x41,0x7f,0xb7,0x12,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, - {{0x61,0x7f,0xb7,0x99,0x84,0x35,0x04,0x5a,0x05,0x00,0x80,0x26,0x2a,0x55,0x5d,0x00}}, - {{0xc3,0x7f,0xb7,0x7a,0x84,0x40,0x02,0x5a,0x05,0x00,0x80,0x1f,0x84,0x3d,0x28,0x00}}, - {{0xe5,0x7f,0xb7,0x1d,0xa7,0x3e,0x04,0x5a,0x05,0x00,0x80,0x20,0x3e,0xe4,0x22,0x00}} -}; - -static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_OPAL[] = -{ - {{0x41,0x7f,0xb7,0x36,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, - {{0x41,0x7f,0xb7,0x86,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, - {{0x41,0x7f,0xb7,0x36,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, - {{0x41,0x7f,0xb7,0x86,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, - {{0x61,0x7f,0xb7,0x99,0x84,0x35,0x04,0x5a,0x05,0x00,0x80,0x26,0x2a,0x55,0x5d,0x00}}, - {{0xc1,0x7f,0xb7,0x4d,0x8c,0x1e,0x31,0x5a,0x05,0x00,0x80,0x26,0x78,0x19,0x34,0x00}}, - {{0xe4,0x7f,0xb7,0x1e,0xaf,0x29,0x37,0x5a,0x05,0x00,0x80,0x25,0x8c,0xb2,0x2a,0x00}} -}; - -static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_SOPAL[] = -{ - {{0x41,0x7f,0xb7,0x36,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, - {{0x41,0x7f,0xb7,0x86,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, - {{0x41,0x7f,0xb7,0x36,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, - {{0x41,0x7f,0xb7,0x86,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, - {{0x61,0x7f,0xb7,0x99,0x84,0x35,0x04,0x5a,0x05,0x00,0x80,0x26,0x2a,0x55,0x5d,0x00}}, - {{0xc1,0x7f,0xb7,0x4d,0x8c,0x1e,0x31,0x5a,0x05,0x00,0x80,0x26,0x78,0x19,0x34,0x00}}, - {{0xe4,0x7f,0xb7,0x1e,0xaf,0x29,0x37,0x5a,0x05,0x00,0x80,0x25,0x8c,0xb2,0x2a,0x00}} -}; - -static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_UPALM[] = -{ - {{0x52,0x77,0xbb,0x94,0x84,0x48,0xfe,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, - {{0x52,0x77,0xbb,0x94,0x84,0x48,0xfe,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, - {{0x52,0x77,0xbb,0x94,0x84,0x48,0xfe,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, - {{0x52,0x77,0xbb,0x94,0x84,0x48,0xfe,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, - {{0x72,0x77,0xbb,0x6e,0x84,0x2e,0x02,0x5a,0x04,0x00,0x80,0x20,0x76,0xdb,0x6e,0x00}}, - {{0xd7,0x77,0xb7,0xc8,0x84,0x3b,0x02,0x5a,0x04,0x00,0x80,0x19,0x84,0x0a,0xc7,0x00}}, - {{0xf6,0x77,0xbb,0x66,0x87,0x32,0x01,0x5a,0x04,0x00,0x80,0x1b,0xdc,0xb0,0x8d,0x00}} -}; - -static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_OPALM[] = -{ - {{0x51,0x77,0xbb,0x7b,0x84,0x34,0x00,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, - {{0x51,0x77,0xbb,0x7b,0x84,0x34,0x00,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, - {{0x51,0x77,0xbb,0x7b,0x84,0x34,0x00,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, - {{0x51,0x77,0xbb,0x7b,0x84,0x34,0x00,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, - {{0x71,0x77,0xbb,0x6e,0x84,0x1e,0x00,0x5a,0x04,0x00,0x80,0x25,0x1a,0x1f,0x59,0x00}}, - {{0xd6,0x77,0xb7,0xb6,0x83,0x2c,0x02,0x5a,0x04,0x00,0x80,0x1b,0xf8,0x1f,0x82,0x00}}, - {{0xf5,0x77,0xbb,0x66,0x8c,0x21,0x02,0x5a,0x04,0x00,0x80,0x1f,0x58,0x46,0x9f,0x00}} -}; - -static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_UPALN[] = -{ - {{0x41,0x7f,0xb7,0x34,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, - {{0x41,0x7f,0xb7,0x80,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, - {{0x41,0x7f,0xb7,0x34,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, - {{0x41,0x7f,0xb7,0x12,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, - {{0x61,0x7f,0xb7,0x99,0x84,0x35,0x04,0x5a,0x05,0x00,0x80,0x1f,0x0d,0x54,0x5e,0x00}}, - {{0xc3,0x7f,0xb7,0x7a,0x84,0x40,0x02,0x5a,0x05,0x00,0x80,0x19,0x78,0xef,0x35,0x00}}, - {{0xe5,0x7f,0xb7,0x1d,0xa7,0x3e,0x04,0x5a,0x05,0x00,0x80,0x1a,0x33,0x3f,0x2f,0x00}} -}; - -static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_OPALN[] = -{ - {{0x41,0x7f,0xb7,0x36,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, - {{0x41,0x7f,0xb7,0x86,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, - {{0x41,0x7f,0xb7,0x36,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, - {{0x41,0x7f,0xb7,0x86,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, - {{0x61,0x7f,0xb7,0x99,0x84,0x35,0x04,0x5a,0x05,0x00,0x80,0x1f,0x0d,0x54,0x5e,0x00}}, - {{0xc1,0x7f,0xb7,0x4d,0x8c,0x1e,0x31,0x5a,0x05,0x00,0x80,0x1f,0x15,0xc0,0x1e,0x00}}, - {{0xe4,0x7f,0xb7,0x1e,0xaf,0x29,0x37,0x5a,0x05,0x00,0x80,0x1d,0xf1,0x6c,0xcb,0x00}} + {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, + 0xf8,0x83,0x8f,0x70,0x20,0x00,0x05, + 0x00 }}, + {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, + 0xde,0x81,0x5d,0x70,0x00,0x00,0x05, + 0x00 }}, + {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, + 0xf8,0x83,0x8f,0x70,0x20,0x00,0x05, + 0x00 }}, + {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, + 0xde,0x81,0x5d,0x70,0x00,0x00,0x05, + 0x00 }}, + {{0x64,0x4f,0x88,0x5a,0x9f,0x6f,0xba, + 0x15,0x83,0xdf,0x70,0x00,0x00,0x01, + 0x00 }}, + {{0x73,0x63,0x97,0x69,0x8b,0xec,0xf0, + 0x90,0x8c,0x57,0xed,0x20,0x00,0x05, + 0x01 }}, + {{0xaa,0x7f,0x8e,0x8e,0x96,0xe6,0xf5, + 0x50,0x88,0xff,0xe7,0x10,0x00,0x02, + 0x01}} }; -static const UCHAR SiS310_CHTVVCLKUNTSC[] = {0x41,0x41,0x41,0x41,0x42,0x46,0x53}; +static const SiS_LVDSCRT1DataStruct SiS310_CHTVCRT1OPAL[] = +{ + {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, + 0xf0,0x83,0x8f,0x70,0x20,0x00,0x05, + 0x00 }}, + {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, + 0xde,0x81,0x5d,0x70,0x00,0x00,0x05, + 0x00 }}, + {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, + 0xf0,0x83,0x8f,0x70,0x20,0x00,0x05, + 0x00 }}, + {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, + 0xde,0x81,0x5d,0x70,0x00,0x00,0x05, + 0x00 }}, + {{0x64,0x4f,0x88,0x58,0x9d,0x6f,0xba, + 0x15,0x83,0xdf,0x70,0x00,0x00,0x01, + 0x00 }}, + {{0x71,0x63,0x95,0x69,0x8c,0x6f,0xf0, + 0x5a,0x8b,0x57,0x70,0x20,0x00,0x05, + 0x01 }}, + {{0xaa,0x7f,0x8e,0x8f,0x96,0x69,0xf5, + 0x28,0x88,0xff,0x6a,0x10,0x00,0x02, + 0x01 }} +}; + + +static const SiS_CHTVRegDataStruct SiS310_CHTVReg_UNTSC[] = +{ + {{0x4a,0x77,0xbb,0x94,0x84,0x48,0xfe,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x4a,0x77,0xbb,0x94,0x84,0x48,0xfe,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x4a,0x77,0xbb,0x94,0x84,0x48,0xfe,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x4a,0x77,0xbb,0x94,0x84,0x48,0xfe,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x6a,0x77,0xbb,0x6e,0x84,0x2e,0x02,0x5a,0x04,0x00,0x80,0x20,0x7e,0x80,0x98,0x00}}, + {{0xcf,0x77,0xb7,0xc8,0x84,0x3b,0x02,0x5a,0x04,0x00,0x80,0x19,0x88,0x30,0x7f,0x00}}, + {{0xee,0x77,0xbb,0x66,0x87,0x32,0x01,0x5a,0x04,0x00,0x80,0x1b,0xd3,0xf2,0x36,0x00}} +}; /* WRONG: 0x02: should be 0xfx, because if CIVEnable is clear, this should be set; + 0x07: Blacklevel: NTSC/PAL-M: Should be 131 (0x83), and not 0x50/0x5a + PAL/PAL-N: 110 (0x6e) + NTSC-J: 102 (0x66) + 0x0c-0x0f: CIV is not default as in datasheet + MISSING: 0x21: Should set D1 to ZERO (for NTSC, PAL-M) or ONE (PAL, NTSC-J) + Most of this is wrong in all NTSC and PAL register arrays. But I won't correct + it as long as it works. For NTSC-J, the blacklevel is corrected in init301.c; + for PAL-M and PAL-N all above is corrected. + */ + +static const SiS_CHTVRegDataStruct SiS310_CHTVReg_ONTSC[] = +{ + {{0x49,0x77,0xbb,0x7b,0x84,0x34,0x00,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x49,0x77,0xbb,0x7b,0x84,0x34,0x00,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x49,0x77,0xbb,0x7b,0x84,0x34,0x00,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x49,0x77,0xbb,0x7b,0x84,0x34,0x00,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x69,0x77,0xbb,0x6e,0x84,0x1e,0x00,0x5a,0x04,0x00,0x80,0x25,0x1a,0x43,0x04,0x00}}, + {{0xce,0x77,0xb7,0xb6,0x83,0x2c,0x02,0x5a,0x04,0x00,0x80,0x1c,0x00,0x82,0x97,0x00}}, + {{0xed,0x77,0xbb,0x66,0x8c,0x21,0x02,0x5a,0x04,0x00,0x80,0x1f,0x9f,0xc1,0x0c,0x00}} +}; + +static const SiS_CHTVRegDataStruct SiS310_CHTVReg_UPAL[] = +{ + {{0x41,0x7f,0xb7,0x34,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x41,0x7f,0xb7,0x80,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x41,0x7f,0xb7,0x34,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x41,0x7f,0xb7,0x12,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x61,0x7f,0xb7,0x99,0x84,0x35,0x04,0x5a,0x05,0x00,0x80,0x26,0x2a,0x55,0x5d,0x00}}, + {{0xc3,0x7f,0xb7,0x7a,0x84,0x40,0x02,0x5a,0x05,0x00,0x80,0x1f,0x84,0x3d,0x28,0x00}}, + {{0xe5,0x7f,0xb7,0x1d,0xa7,0x3e,0x04,0x5a,0x05,0x00,0x80,0x20,0x3e,0xe4,0x22,0x00}} +}; + +static const SiS_CHTVRegDataStruct SiS310_CHTVReg_OPAL[] = +{ + {{0x41,0x7f,0xb7,0x36,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x41,0x7f,0xb7,0x86,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x41,0x7f,0xb7,0x36,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x41,0x7f,0xb7,0x86,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, + {{0x61,0x7f,0xb7,0x99,0x84,0x35,0x04,0x5a,0x05,0x00,0x80,0x26,0x2a,0x55,0x5d,0x00}}, + {{0xc1,0x7f,0xb7,0x4d,0x8c,0x1e,0x31,0x5a,0x05,0x00,0x80,0x26,0x78,0x19,0x34,0x00}}, + {{0xe4,0x7f,0xb7,0x1e,0xaf,0x29,0x37,0x5a,0x05,0x00,0x80,0x25,0x8c,0xb2,0x2a,0x00}} +}; + +static const SiS_CHTVRegDataStruct 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}}, + {{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}}, + {{0x72,0x77,0xfb,0x6e,0x84,0x2e,0x02,0x83,0x04,0x00,0x80,0x20,0x76,0xdb,0x6e,0x00}}, + {{0xd7,0x77,0xf7,0xc8,0x84,0x3b,0x02,0x83,0x04,0x00,0x80,0x19,0x84,0x0a,0xc7,0x00}}, + {{0xf6,0x77,0xfb,0x66,0x87,0x32,0x01,0x83,0x04,0x00,0x80,0x1b,0xdc,0xb0,0x8d,0x00}} +#if 0 /* Correct blacklevel and CFRB */ + {{0x72,0x77,0xbb,0x6e,0x84,0x2e,0x02,0x5a,0x04,0x00,0x80,0x20,0x76,0xdb,0x6e,0x00}}, + {{0xd7,0x77,0xb7,0xc8,0x84,0x3b,0x02,0x5a,0x04,0x00,0x80,0x19,0x84,0x0a,0xc7,0x00}}, + {{0xf6,0x77,0xbb,0x66,0x87,0x32,0x01,0x5a,0x04,0x00,0x80,0x1b,0xdc,0xb0,0x8d,0x00}} +#endif +}; + +static const SiS_CHTVRegDataStruct 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}}, + {{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}}, + {{0x71,0x77,0xfb,0x6e,0x84,0x1e,0x00,0x83,0x04,0x00,0x80,0x25,0x1a,0x1f,0x59,0x00}}, + {{0xd6,0x77,0xf7,0xb6,0x83,0x2c,0x02,0x83,0x04,0x00,0x80,0x1b,0xf8,0x1f,0x82,0x00}}, + {{0xf5,0x77,0xfb,0x66,0x8c,0x21,0x02,0x83,0x04,0x00,0x80,0x1f,0x58,0x46,0x9f,0x00}} +#if 0 /* Correct blacklevel and CFRB */ + {{0x71,0x77,0xbb,0x6e,0x84,0x1e,0x00,0x5a,0x04,0x00,0x80,0x25,0x1a,0x1f,0x59,0x00}}, + {{0xd6,0x77,0xb7,0xb6,0x83,0x2c,0x02,0x5a,0x04,0x00,0x80,0x1b,0xf8,0x1f,0x82,0x00}}, + {{0xf5,0x77,0xbb,0x66,0x8c,0x21,0x02,0x5a,0x04,0x00,0x80,0x1f,0x58,0x46,0x9f,0x00}} +#endif +}; + +static const SiS_CHTVRegDataStruct 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}}, + {{0x41,0x7f,0xb7,0x34,0xad,0x50,0x34,0x6e,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x03}}, + {{0x41,0x7f,0xb7,0x12,0x85,0x50,0x00,0x6e,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x03}}, + {{0x61,0x7f,0xb7,0x99,0x84,0x35,0x04,0x6e,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x03}}, + {{0xc3,0x7f,0xb7,0x7a,0x84,0x40,0x02,0x6e,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x03}}, + {{0xe5,0x7f,0xb7,0x1d,0xa7,0x3e,0x04,0x6e,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x03}} +#if 0 /* Correct blacklevel, CIV and CFRB */ + {{0x61,0x7f,0xb7,0x99,0x84,0x35,0x04,0x5a,0x05,0x00,0x80,0x1f,0x0d,0x54,0x5e,0x00}}, + {{0xc3,0x7f,0xb7,0x7a,0x84,0x40,0x02,0x5a,0x05,0x00,0x80,0x19,0x78,0xef,0x35,0x00}}, + {{0xe5,0x7f,0xb7,0x1d,0xa7,0x3e,0x04,0x5a,0x05,0x00,0x80,0x1a,0x33,0x3f,0x2f,0x00}} +#endif +}; + +static const SiS_CHTVRegDataStruct 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}}, + {{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}}, + {{0x61,0x7f,0xb7,0x99,0x84,0x35,0x04,0x6e,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x03}}, + {{0xc1,0x7f,0xb7,0x4d,0x8c,0x1e,0x31,0x6e,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x03}}, + {{0xe4,0x7f,0xb7,0x1e,0xaf,0x29,0x37,0x6e,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x03}} +#if 0 /* Correct blacklevel, CIV and CFRB */ + {{0x61,0x7f,0xb7,0x99,0x84,0x35,0x04,0x5a,0x05,0x00,0x80,0x1f,0x0d,0x54,0x5e,0x00}}, + {{0xc1,0x7f,0xb7,0x4d,0x8c,0x1e,0x31,0x5a,0x05,0x00,0x80,0x1f,0x15,0xc0,0x1e,0x00}}, + {{0xe4,0x7f,0xb7,0x1e,0xaf,0x29,0x37,0x5a,0x05,0x00,0x80,0x1d,0xf1,0x6c,0xcb,0x00}} +#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 UCHAR SiS310_CHTVVCLKUPAL[] = {0x47,0x47,0x47,0x47,0x48,0x4a,0x54}; - static const UCHAR SiS310_CHTVVCLKOPAL[] = {0x47,0x47,0x47,0x47,0x48,0x4f,0x52}; -static const UCHAR SiS310_CHTVVCLKSOPAL[] = {0x47,0x47,0x47,0x47,0x48,0x4f,0x52}; - static const UCHAR SiS310_CHTVVCLKUPALM[] = {0x41,0x41,0x41,0x41,0x42,0x46,0x53}; - static const UCHAR SiS310_CHTVVCLKOPALM[] = {0x48,0x48,0x48,0x48,0x45,0x43,0x51}; static const UCHAR SiS310_CHTVVCLKUPALN[] = {0x47,0x47,0x47,0x47,0x48,0x4a,0x54}; - static const UCHAR SiS310_CHTVVCLKOPALN[] = {0x47,0x47,0x47,0x47,0x48,0x4f,0x52}; -/* TW: New end */ + Index: xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile:1.31 xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile:1.33 --- xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile:1.31 Mon Feb 17 12:06:44 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile Fri Aug 29 04:50:54 2003 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile,v 1.31 2003/02/17 17:06:44 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile,v 1.33 2003/08/29 08:50:54 twini Exp $ XCOMM XCOMM This is an Imakefile for the SIS driver. XCOMM @@ -73,6 +73,7 @@ InstallDriverSDKNonExecFile(sis300_accel.h,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis310_accel.c,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis310_accel.h,$(DRIVERSDKDIR)/drivers/sis) +InstallDriverSDKNonExecFile(sis_accel.h,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_accel.c,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(init.c,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(init.h,$(DRIVERSDKDIR)/drivers/sis) @@ -91,6 +92,7 @@ InstallDriverSDKNonExecFile(sis_dga.c,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_dri.c,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_dri.h,$(DRIVERSDKDIR)/drivers/sis) +InstallDriverSDKNonExecFile(sis_common.h,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_driver.c,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_driver.h,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_opt.c,$(DRIVERSDKDIR)/drivers/sis) @@ -103,5 +105,8 @@ InstallDriverSDKNonExecFile(sis_vga.c,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis_video.c,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKNonExecFile(sis6326_video.c,$(DRIVERSDKDIR)/drivers/sis) +InstallDriverSDKNonExecFile(sis_accel.c,$(DRIVERSDKDIR)/drivers/sis) +InstallDriverSDKNonExecFile(vgatypes.h,$(DRIVERSDKDIR)/drivers/sis) +InstallDriverSDKNonExecFile(vstruct.h,$(DRIVERSDKDIR)/drivers/sis) InstallDriverSDKObjectModule(sis,$(DRIVERSDKMODULEDIR),drivers) Index: xc/programs/Xserver/hw/xfree86/drivers/sis/init.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/init.c:1.6 xc/programs/Xserver/hw/xfree86/drivers/sis/init.c:1.53 --- xc/programs/Xserver/hw/xfree86/drivers/sis/init.c:1.6 Mon Feb 3 21:44:28 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/init.c Thu Feb 26 10:58:43 2004 @@ -1,41 +1,57 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init.c,v 1.6 2003/02/04 02:44:28 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init.c,v 1.53 2004/02/26 15:58:43 twini Exp $ */ /* - * Mode switching code (CRT1 section) for SiS 300/540/630/730/315/550/650/740/330 + * Mode initializing code (CRT1 section) for + * for SiS 300/305/540/630/730 and + * SiS 315/550/650/M650/651/661FX/M661FX/740/741/M741/330/660/M660/760/M760 * (Universal module for Linux kernel framebuffer and XFree86 4.x) * - * Assembler-To-C translation - * Copyright 2002 by Thomas Winischhofer - * Minor parts Copyright SiS, Inc. + * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria * - * Based on BIOS - * 1.10.07, 1.10a for SiS650/LVDS+CH7019 - * 1.11.05 for 650/LVDS (w/o Chrontel) - * 1.07.1b, 1.11.6s, 1.11.6w, 1.11.7w, 1.11.8r for SiS650/301(B/LV) - * 2.04.50 (I) and 2.04.5c (II) for SiS630/301(B) - * 2.06.50 for 630/301B (dual VGA) - * 2.02.3b, 2.03.02, 2.04.5c, 2.07a and 2.08.b3 for 630/LVDS/LVDS+CH7005 - * 2.04.5c, 2.04.6c for 730+LVDS+CH7005 - * 1.09b for 315/301(B) - * 1.16.51 for 300+301LVX (ECS A907) - * 1.01.03 for 330 (Xabre 400) + * If distributed as part of the Linux kernel, the following license terms + * apply: * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of the copyright holder not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. The copyright holder makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. + * * This program is free software; you can redistribute it and/or modify + * * it under the terms of the GNU General Public License as published by + * * the Free Software Foundation; either version 2 of the named License, + * * or any later version. + * * + * * This program is distributed in the hope that it will be useful, + * * but WITHOUT ANY WARRANTY; without even the implied warranty of + * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * * GNU General Public License for more details. + * * + * * You should have received a copy of the GNU General Public License + * * along with this program; if not, write to the Free Software + * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * - * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. + * Otherwise, the following license terms apply: + * + * * Redistribution and use in source and binary forms, with or without + * * modification, are permitted provided that the following conditions + * * are met: + * * 1) Redistributions of source code must retain the above copyright + * * notice, this list of conditions and the following disclaimer. + * * 2) Redistributions in binary form must reproduce the above copyright + * * notice, this list of conditions and the following disclaimer in the + * * documentation and/or other materials provided with the distribution. + * * 3) The name of the author may not be used to endorse or promote products + * * derived from this software without specific prior written permission. + * * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR + * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Author: Thomas Winischhofer + * + * 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. @@ -57,128 +73,187 @@ #include "310vtbl.h" #endif -#ifdef LINUX_XF86 -BOOLEAN SiSBIOSSetMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, - ScrnInfoPtr pScrn, DisplayModePtr mode, BOOLEAN IsCustom); -DisplayModePtr SiSBuildBuiltInModeList(ScrnInfoPtr pScrn); -#ifdef SISDUALHEAD /* TW: For dual head */ -BOOLEAN SiSBIOSSetModeCRT1(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, - ScrnInfoPtr pScrn, DisplayModePtr mode, BOOLEAN IsCustom); -BOOLEAN SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, - ScrnInfoPtr pScrn, DisplayModePtr mode); -#endif /* dual head */ -#endif /* linux_xf86 */ - -#ifdef LINUXBIOS -BOOLEAN SiSInit(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension); -#endif - -#ifdef LINUX_XF86 -BOOLEAN SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, - ScrnInfoPtr pScrn,USHORT ModeNo, BOOLEAN dosetpitch); -#else -BOOLEAN SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, - USHORT ModeNo); -#endif - #if defined(ALLOC_PRAGMA) #pragma alloc_text(PAGE,SiSSetMode) -#pragma alloc_text(PAGE,SiSInit) #endif -static ULONG GetDRAMSize(SiS_Private *SiS_Pr, - PSIS_HW_DEVICE_INFO HwDeviceExtension); - -static void DelaySeconds(int seconds); -void SiS_DebugCode(SiS_Private *SiS_Pr, UCHAR code); - -#ifdef LINUX_XF86 -/* TW: Mode table for X driver */ -const UShort ModeIndex_320x480[] = {0x5a, 0x5b, 0x00, 0x00}; /* DSTN/FSTN */ -const UShort ModeIndex_512x384[] = {0x52, 0x58, 0x00, 0x5c}; -const UShort ModeIndex_640x400[] = {0x2f, 0x5d, 0x00, 0x5e}; -const UShort ModeIndex_640x480[] = {0x2e, 0x44, 0x00, 0x62}; -const UShort ModeIndex_720x480[] = {0x31, 0x33, 0x00, 0x35}; -const UShort ModeIndex_720x576[] = {0x32, 0x34, 0x00, 0x36}; -const UShort ModeIndex_800x480[] = {0x70, 0x7a, 0x00, 0x76}; -const UShort ModeIndex_800x600[] = {0x30, 0x47, 0x00, 0x63}; -const UShort ModeIndex_848x480[] = {0x39, 0x3b, 0x00, 0x3e}; -const UShort ModeIndex_856x480[] = {0x3f, 0x42, 0x00, 0x45}; -const UShort ModeIndex_1024x768[] = {0x38, 0x4a, 0x00, 0x64}; -const UShort ModeIndex_1024x576[] = {0x71, 0x74, 0x00, 0x77}; -const UShort ModeIndex_1024x600[] = {0x20, 0x21, 0x00, 0x22}; /* 300 series only */ -const UShort ModeIndex_1280x1024[] = {0x3a, 0x4d, 0x00, 0x65}; -const UShort ModeIndex_300_1280x960[] = {0x6e, 0x6f, 0x00, 0x7b}; -const UShort ModeIndex_310_1280x960[] = {0x7c, 0x7d, 0x00, 0x7e}; -const UShort ModeIndex_1152x768[] = {0x23, 0x24, 0x00, 0x25}; /* 300 series only */ -const UShort ModeIndex_1152x864[] = {0x29, 0x2a, 0x00, 0x2b}; -const UShort ModeIndex_1280x768[] = {0x23, 0x24, 0x00, 0x25}; /* 310/325 series only */ -const UShort ModeIndex_1280x720[] = {0x79, 0x75, 0x00, 0x78}; -const UShort ModeIndex_1360x768[] = {0x48, 0x4b, 0x00, 0x4e}; -const UShort ModeIndex_1400x1050[] = {0x26, 0x27, 0x00, 0x28}; /* 310/325 series only */ -const UShort ModeIndex_1600x1200[] = {0x3c, 0x3d, 0x00, 0x66}; -const UShort ModeIndex_1920x1440[] = {0x68, 0x69, 0x00, 0x6b}; -const UShort ModeIndex_300_2048x1536[]= {0x6c, 0x6d, 0x00, 0x00}; -const UShort ModeIndex_310_2048x1536[]= {0x6c, 0x6d, 0x00, 0x6e}; -#endif +/*********************************************/ +/* POINTER INITIALIZATION */ +/*********************************************/ static void -DelaySeconds(int seconds) +InitCommonPointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) { - int i; -#ifdef WIN2000 - int j; -#endif - - for (i=0;iSiS_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; + SiS_Pr->SiS_HiTVSt2Timing = SiS_HiTVSt2Timing; + + SiS_Pr->SiS_HiTVExtTiming = SiS_HiTVExtTiming; + SiS_Pr->SiS_HiTVGroup3Data = SiS_HiTVGroup3Data; + SiS_Pr->SiS_HiTVGroup3Simu = SiS_HiTVGroup3Simu; +#if 0 + SiS_Pr->SiS_HiTVTextTiming = SiS_HiTVTextTiming; + SiS_Pr->SiS_HiTVGroup3Text = SiS_HiTVGroup3Text; #endif -#ifdef LINUX_KERNEL -#endif - } -} + SiS_Pr->SiS_StPALData = SiS_StPALData; + SiS_Pr->SiS_ExtPALData = SiS_ExtPALData; + SiS_Pr->SiS_StNTSCData = SiS_StNTSCData; + SiS_Pr->SiS_ExtNTSCData = SiS_ExtNTSCData; + SiS_Pr->SiS_St1HiTVData = SiS_StHiTVData; + SiS_Pr->SiS_St2HiTVData = SiS_St2HiTVData; + SiS_Pr->SiS_ExtHiTVData = SiS_ExtHiTVData; + SiS_Pr->SiS_St525iData = SiS_StNTSCData; + SiS_Pr->SiS_St525pData = SiS_St525pData; + SiS_Pr->SiS_St750pData = SiS_St750pData; + SiS_Pr->SiS_Ext525iData = SiS_ExtNTSCData; + SiS_Pr->SiS_Ext525pData = SiS_ExtNTSCData; + SiS_Pr->SiS_Ext750pData = SiS_Ext750pData; + + SiS_Pr->pSiS_OutputSelect = &SiS_OutputSelect; + SiS_Pr->pSiS_SoftSetting = &SiS_SoftSetting; + + SiS_Pr->SiS_LCD1280x720Data = SiS_LCD1280x720Data; + SiS_Pr->SiS_StLCD1280x768_2Data = SiS_StLCD1280x768_2Data; + SiS_Pr->SiS_ExtLCD1280x768_2Data = SiS_ExtLCD1280x768_2Data; + SiS_Pr->SiS_LCD1280x768_3Data = SiS_LCD1280x768_3Data; + SiS_Pr->SiS_LCD1280x800Data = SiS_LCD1280x800Data; + SiS_Pr->SiS_LCD1280x960Data = SiS_LCD1280x960Data; + SiS_Pr->SiS_StLCD1400x1050Data = SiS_StLCD1400x1050Data; + SiS_Pr->SiS_ExtLCD1400x1050Data = SiS_ExtLCD1400x1050Data; + SiS_Pr->SiS_LCD1680x1050Data = SiS_LCD1680x1050Data; + SiS_Pr->SiS_StLCD1600x1200Data = SiS_StLCD1600x1200Data; + SiS_Pr->SiS_ExtLCD1600x1200Data = SiS_ExtLCD1600x1200Data; + SiS_Pr->SiS_NoScaleData = SiS_NoScaleData; + + SiS_Pr->SiS_LVDS320x480Data_1 = SiS_LVDS320x480Data_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_LVDSCRT11280x768_1 = SiS_LVDSCRT11280x768_1; + 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; + + 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; -void -SiS_DebugCode(SiS_Private *SiS_Pr, UCHAR code) -{ - OutPortByte(0x80, code); - DelaySeconds(0x3); + SiS_Pr->SiS_PanelMinLVDS = Panel_800x600; /* lowest value LVDS/LCDA */ + SiS_Pr->SiS_PanelMin301 = Panel_1024x768; /* lowest value 301 */ } #ifdef SIS300 static void -InitTo300Pointer(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension) +InitTo300Pointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) { - SiS_Pr->SiS_SModeIDTable = (SiS_StStruct *)SiS300_SModeIDTable; - SiS_Pr->SiS_VBModeIDTable = (SiS_VBModeStruct *)SiS300_VBModeIDTable; - SiS_Pr->SiS_StandTable = (SiS_StandTableStruct *)SiS300_StandTable; - SiS_Pr->SiS_EModeIDTable = (SiS_ExtStruct *)SiS300_EModeIDTable; - SiS_Pr->SiS_RefIndex = (SiS_Ext2Struct *)SiS300_RefIndex; - SiS_Pr->SiS_CRT1Table = (SiS_CRT1TableStruct *)SiS300_CRT1Table; - if(HwDeviceExtension->jChipType == SIS_300) { - SiS_Pr->SiS_MCLKData_0 = (SiS_MCLKDataStruct *)SiS300_MCLKData_300; /* 300 */ + InitCommonPointer(SiS_Pr, HwInfo); + + SiS_StandTable[0x04].CRTC[4] = 0x2b; + SiS_StandTable[0x05].CRTC[4] = 0x2b; + SiS_StandTable[0x06].CRTC[4] = 0x54; + SiS_StandTable[0x06].CRTC[5] = 0x80; + SiS_StandTable[0x0d].CRTC[4] = 0x2b; + SiS_StandTable[0x0e].CRTC[4] = 0x54; + SiS_StandTable[0x0e].CRTC[5] = 0x80; + SiS_StandTable[0x11].CRTC[4] = 0x54; + SiS_StandTable[0x11].CRTC[5] = 0x80; + SiS_StandTable[0x11].CRTC[16] = 0x83; + SiS_StandTable[0x11].CRTC[17] = 0x85; + SiS_StandTable[0x12].CRTC[4] = 0x54; + SiS_StandTable[0x12].CRTC[5] = 0x80; + SiS_StandTable[0x12].CRTC[16] = 0x83; + SiS_StandTable[0x12].CRTC[17] = 0x85; + SiS_StandTable[0x13].CRTC[5] = 0xa0; + SiS_StandTable[0x17].CRTC[5] = 0xa0; + SiS_StandTable[0x1a].CRTC[4] = 0x54; + SiS_StandTable[0x1a].CRTC[5] = 0x80; + SiS_StandTable[0x1a].CRTC[16] = 0xea; + SiS_StandTable[0x1a].CRTC[17] = 0x8c; + SiS_StandTable[0x1b].CRTC[4] = 0x54; + SiS_StandTable[0x1b].CRTC[5] = 0x80; + SiS_StandTable[0x1b].CRTC[16] = 0xea; + SiS_StandTable[0x1b].CRTC[17] = 0x8c; + SiS_StandTable[0x1c].CRTC[4] = 0x54; + SiS_StandTable[0x1c].CRTC[5] = 0x80; + + 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 */ } else { - SiS_Pr->SiS_MCLKData_0 = (SiS_MCLKDataStruct *)SiS300_MCLKData_630; /* 630 */ + SiS_Pr->SiS_MCLKData_0 = SiS300_MCLKData_630; /* 630, 730 */ } - SiS_Pr->SiS_ECLKData = (SiS_ECLKDataStruct *)SiS300_ECLKData; - SiS_Pr->SiS_VCLKData = (SiS_VCLKDataStruct *)SiS300_VCLKData; + SiS_Pr->SiS_VCLKData = SiS300_VCLKData; SiS_Pr->SiS_VBVCLKData = (SiS_VBVCLKDataStruct *)SiS300_VCLKData; - SiS_Pr->SiS_ScreenOffset = SiS300_ScreenOffset; - SiS_Pr->SiS_StResInfo = (SiS_StResInfoStruct *)SiS300_StResInfo; - SiS_Pr->SiS_ModeResInfo = (SiS_ModeResInfoStruct *)SiS300_ModeResInfo; - - SiS_Pr->pSiS_OutputSelect = &SiS300_OutputSelect; - SiS_Pr->pSiS_SoftSetting = &SiS300_SoftSetting; SiS_Pr->SiS_SR15 = SiS300_SR15; @@ -207,157 +282,102 @@ SiS_Pr->pSiS_YCSenseData2 = &SiS300_YCSenseData2; #endif - SiS_Pr->SiS_NTSCPhase = SiS300_NTSCPhase; - SiS_Pr->SiS_PALPhase = SiS300_PALPhase; - SiS_Pr->SiS_NTSCPhase2 = SiS300_NTSCPhase2; - SiS_Pr->SiS_PALPhase2 = SiS300_PALPhase2; - SiS_Pr->SiS_PALMPhase = SiS300_PALMPhase; - SiS_Pr->SiS_PALNPhase = SiS300_PALNPhase; - SiS_Pr->SiS_PALMPhase2 = SiS300_PALMPhase2; - SiS_Pr->SiS_PALNPhase2 = SiS300_PALNPhase2; - - SiS_Pr->SiS_StLCD1024x768Data = (SiS_LCDDataStruct *)SiS300_StLCD1024x768Data; - SiS_Pr->SiS_ExtLCD1024x768Data = (SiS_LCDDataStruct *)SiS300_ExtLCD1024x768Data; - SiS_Pr->SiS_St2LCD1024x768Data = (SiS_LCDDataStruct *)SiS300_St2LCD1024x768Data; - SiS_Pr->SiS_StLCD1280x1024Data = (SiS_LCDDataStruct *)SiS300_StLCD1280x1024Data; - SiS_Pr->SiS_ExtLCD1280x1024Data = (SiS_LCDDataStruct *)SiS300_ExtLCD1280x1024Data; - SiS_Pr->SiS_St2LCD1280x1024Data = (SiS_LCDDataStruct *)SiS300_St2LCD1280x1024Data; - SiS_Pr->SiS_NoScaleData1024x768 = (SiS_LCDDataStruct *)SiS300_NoScaleData1024x768; - SiS_Pr->SiS_NoScaleData1280x1024 = (SiS_LCDDataStruct *)SiS300_NoScaleData1280x1024; - SiS_Pr->SiS_LCD1280x960Data = (SiS_LCDDataStruct *)SiS300_LCD1280x960Data; - SiS_Pr->SiS_ExtLCD1400x1050Data = (SiS_LCDDataStruct *)SiS300_ExtLCD1400x1050Data; - SiS_Pr->SiS_ExtLCD1600x1200Data = (SiS_LCDDataStruct *)SiS300_ExtLCD1600x1200Data; - SiS_Pr->SiS_StLCD1400x1050Data = (SiS_LCDDataStruct *)SiS300_StLCD1400x1050Data; - SiS_Pr->SiS_StLCD1600x1200Data = (SiS_LCDDataStruct *)SiS300_StLCD1600x1200Data; - SiS_Pr->SiS_NoScaleData1400x1050 = (SiS_LCDDataStruct *)SiS300_NoScaleData1400x1050; - SiS_Pr->SiS_NoScaleData1600x1200 = (SiS_LCDDataStruct *)SiS300_NoScaleData1600x1200; - - SiS_Pr->SiS_StPALData = (SiS_TVDataStruct *)SiS300_StPALData; - SiS_Pr->SiS_ExtPALData = (SiS_TVDataStruct *)SiS300_ExtPALData; - SiS_Pr->SiS_StNTSCData = (SiS_TVDataStruct *)SiS300_StNTSCData; - SiS_Pr->SiS_ExtNTSCData = (SiS_TVDataStruct *)SiS300_ExtNTSCData; -#ifdef oldHV - SiS_Pr->SiS_St1HiTVData = (SiS_TVDataStruct *)SiS300_St1HiTVData; - SiS_Pr->SiS_St2HiTVData = (SiS_TVDataStruct *)SiS300_St2HiTVData; - SiS_Pr->SiS_ExtHiTVData = (SiS_TVDataStruct *)SiS300_ExtHiTVData; -#endif - - SiS_Pr->SiS_NTSCTiming = SiS300_NTSCTiming; - SiS_Pr->SiS_PALTiming = SiS300_PALTiming; -#ifdef oldHV - SiS_Pr->SiS_HiTVSt1Timing = SiS300_HiTVSt1Timing; - SiS_Pr->SiS_HiTVSt2Timing = SiS300_HiTVSt2Timing; - SiS_Pr->SiS_HiTVTextTiming = SiS300_HiTVTextTiming; - SiS_Pr->SiS_HiTVGroup3Data = SiS300_HiTVGroup3Data; - SiS_Pr->SiS_HiTVGroup3Simu = SiS300_HiTVGroup3Simu; - SiS_Pr->SiS_HiTVGroup3Text = SiS300_HiTVGroup3Text; -#endif - - SiS_Pr->SiS_PanelDelayTbl = (SiS_PanelDelayTblStruct *)SiS300_PanelDelayTbl; - SiS_Pr->SiS_PanelDelayTblLVDS = (SiS_PanelDelayTblStruct *)SiS300_PanelDelayTblLVDS; - - SiS_Pr->SiS_LVDS800x600Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS800x600Data_1; - SiS_Pr->SiS_LVDS800x600Data_2 = (SiS_LVDSDataStruct *)SiS300_LVDS800x600Data_2; - SiS_Pr->SiS_LVDS1024x768Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS1024x768Data_1; - SiS_Pr->SiS_LVDS1024x768Data_2 = (SiS_LVDSDataStruct *)SiS300_LVDS1024x768Data_2; - SiS_Pr->SiS_LVDS1280x1024Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS1280x1024Data_1; - SiS_Pr->SiS_LVDS1280x1024Data_2 = (SiS_LVDSDataStruct *)SiS300_LVDS1280x1024Data_2; - SiS_Pr->SiS_LVDS1280x960Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS1280x1024Data_1; - SiS_Pr->SiS_LVDS1280x960Data_2 = (SiS_LVDSDataStruct *)SiS300_LVDS1280x1024Data_2; - SiS_Pr->SiS_LVDS1400x1050Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS1400x1050Data_1; - SiS_Pr->SiS_LVDS1400x1050Data_2 = (SiS_LVDSDataStruct *)SiS300_LVDS1400x1050Data_2; - SiS_Pr->SiS_LVDS1280x768Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS1280x768Data_1; - SiS_Pr->SiS_LVDS1280x768Data_2 = (SiS_LVDSDataStruct *)SiS300_LVDS1280x768Data_2; - SiS_Pr->SiS_LVDS1024x600Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS1024x600Data_1; - SiS_Pr->SiS_LVDS1024x600Data_2 = (SiS_LVDSDataStruct *)SiS300_LVDS1024x600Data_2; - SiS_Pr->SiS_LVDS1152x768Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS1152x768Data_1; - SiS_Pr->SiS_LVDS1152x768Data_2 = (SiS_LVDSDataStruct *)SiS300_LVDS1152x768Data_2; - SiS_Pr->SiS_LVDSXXXxXXXData_1 = (SiS_LVDSDataStruct *)SiS300_LVDSXXXxXXXData_1; - SiS_Pr->SiS_LVDS320x480Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS320x480Data_1; - SiS_Pr->SiS_LVDS640x480Data_1 = (SiS_LVDSDataStruct *)SiS300_LVDS640x480Data_1; - SiS_Pr->SiS_LCDA1400x1050Data_1 = (SiS_LVDSDataStruct *)SiS300_LCDA1400x1050Data_1; - SiS_Pr->SiS_LCDA1400x1050Data_2 = (SiS_LVDSDataStruct *)SiS300_LCDA1400x1050Data_2; - SiS_Pr->SiS_LCDA1600x1200Data_1 = (SiS_LVDSDataStruct *)SiS300_LCDA1600x1200Data_1; - SiS_Pr->SiS_LCDA1600x1200Data_2 = (SiS_LVDSDataStruct *)SiS300_LCDA1600x1200Data_2; - SiS_Pr->SiS_CHTVUNTSCData = (SiS_LVDSDataStruct *)SiS300_CHTVUNTSCData; - SiS_Pr->SiS_CHTVONTSCData = (SiS_LVDSDataStruct *)SiS300_CHTVONTSCData; - SiS_Pr->SiS_CHTVUPALData = (SiS_LVDSDataStruct *)SiS300_CHTVUPALData; - SiS_Pr->SiS_CHTVOPALData = (SiS_LVDSDataStruct *)SiS300_CHTVOPALData; - SiS_Pr->SiS_CHTVUPALMData = (SiS_LVDSDataStruct *)SiS300_CHTVUNTSCData; /* not supported on 300 series */ - SiS_Pr->SiS_CHTVOPALMData = (SiS_LVDSDataStruct *)SiS300_CHTVONTSCData; /* not supported on 300 series */ - SiS_Pr->SiS_CHTVUPALNData = (SiS_LVDSDataStruct *)SiS300_CHTVUPALData; /* not supported on 300 series */ - SiS_Pr->SiS_CHTVOPALNData = (SiS_LVDSDataStruct *)SiS300_CHTVOPALData; /* not supported on 300 series */ - SiS_Pr->SiS_CHTVSOPALData = (SiS_LVDSDataStruct *)SiS300_CHTVSOPALData; - SiS_Pr->SiS_PanelType00_1 = (SiS_LVDSDesStruct *)SiS300_PanelType00_1; - SiS_Pr->SiS_PanelType01_1 = (SiS_LVDSDesStruct *)SiS300_PanelType01_1; - SiS_Pr->SiS_PanelType02_1 = (SiS_LVDSDesStruct *)SiS300_PanelType02_1; - SiS_Pr->SiS_PanelType03_1 = (SiS_LVDSDesStruct *)SiS300_PanelType03_1; - SiS_Pr->SiS_PanelType04_1 = (SiS_LVDSDesStruct *)SiS300_PanelType04_1; - SiS_Pr->SiS_PanelType05_1 = (SiS_LVDSDesStruct *)SiS300_PanelType05_1; - SiS_Pr->SiS_PanelType06_1 = (SiS_LVDSDesStruct *)SiS300_PanelType06_1; - SiS_Pr->SiS_PanelType07_1 = (SiS_LVDSDesStruct *)SiS300_PanelType07_1; - SiS_Pr->SiS_PanelType08_1 = (SiS_LVDSDesStruct *)SiS300_PanelType08_1; - SiS_Pr->SiS_PanelType09_1 = (SiS_LVDSDesStruct *)SiS300_PanelType09_1; - SiS_Pr->SiS_PanelType0a_1 = (SiS_LVDSDesStruct *)SiS300_PanelType0a_1; - SiS_Pr->SiS_PanelType0b_1 = (SiS_LVDSDesStruct *)SiS300_PanelType0b_1; - SiS_Pr->SiS_PanelType0c_1 = (SiS_LVDSDesStruct *)SiS300_PanelType0c_1; - SiS_Pr->SiS_PanelType0d_1 = (SiS_LVDSDesStruct *)SiS300_PanelType0d_1; - SiS_Pr->SiS_PanelType0e_1 = (SiS_LVDSDesStruct *)SiS300_PanelType0e_1; - SiS_Pr->SiS_PanelType0f_1 = (SiS_LVDSDesStruct *)SiS300_PanelType0f_1; - SiS_Pr->SiS_PanelType00_2 = (SiS_LVDSDesStruct *)SiS300_PanelType00_2; - SiS_Pr->SiS_PanelType01_2 = (SiS_LVDSDesStruct *)SiS300_PanelType01_2; - SiS_Pr->SiS_PanelType02_2 = (SiS_LVDSDesStruct *)SiS300_PanelType02_2; - SiS_Pr->SiS_PanelType03_2 = (SiS_LVDSDesStruct *)SiS300_PanelType03_2; - SiS_Pr->SiS_PanelType04_2 = (SiS_LVDSDesStruct *)SiS300_PanelType04_2; - SiS_Pr->SiS_PanelType05_2 = (SiS_LVDSDesStruct *)SiS300_PanelType05_2; - SiS_Pr->SiS_PanelType06_2 = (SiS_LVDSDesStruct *)SiS300_PanelType06_2; - SiS_Pr->SiS_PanelType07_2 = (SiS_LVDSDesStruct *)SiS300_PanelType07_2; - SiS_Pr->SiS_PanelType08_2 = (SiS_LVDSDesStruct *)SiS300_PanelType08_2; - SiS_Pr->SiS_PanelType09_2 = (SiS_LVDSDesStruct *)SiS300_PanelType09_2; - SiS_Pr->SiS_PanelType0a_2 = (SiS_LVDSDesStruct *)SiS300_PanelType0a_2; - SiS_Pr->SiS_PanelType0b_2 = (SiS_LVDSDesStruct *)SiS300_PanelType0b_2; - SiS_Pr->SiS_PanelType0c_2 = (SiS_LVDSDesStruct *)SiS300_PanelType0c_2; - SiS_Pr->SiS_PanelType0d_2 = (SiS_LVDSDesStruct *)SiS300_PanelType0d_2; - SiS_Pr->SiS_PanelType0e_2 = (SiS_LVDSDesStruct *)SiS300_PanelType0e_2; - SiS_Pr->SiS_PanelType0f_2 = (SiS_LVDSDesStruct *)SiS300_PanelType0f_2; - SiS_Pr->SiS_CHTVUNTSCDesData = (SiS_LVDSDesStruct *)SiS300_CHTVUNTSCDesData; - SiS_Pr->SiS_CHTVONTSCDesData = (SiS_LVDSDesStruct *)SiS300_CHTVONTSCDesData; - SiS_Pr->SiS_CHTVUPALDesData = (SiS_LVDSDesStruct *)SiS300_CHTVUPALDesData; - SiS_Pr->SiS_CHTVOPALDesData = (SiS_LVDSDesStruct *)SiS300_CHTVOPALDesData; - SiS_Pr->SiS_LVDSCRT1800x600_1 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT1800x600_1; - SiS_Pr->SiS_LVDSCRT11024x768_1 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11024x768_1; - SiS_Pr->SiS_LVDSCRT11280x1024_1 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11280x1024_1; - SiS_Pr->SiS_LVDSCRT11024x600_1 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11024x600_1; - SiS_Pr->SiS_LVDSCRT11152x768_1 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11152x768_1; - SiS_Pr->SiS_LVDSCRT1800x600_1_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT1800x600_1_H; - SiS_Pr->SiS_LVDSCRT11024x768_1_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11024x768_1_H; - SiS_Pr->SiS_LVDSCRT11280x1024_1_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11280x1024_1_H; - SiS_Pr->SiS_LVDSCRT11024x600_1_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11024x600_1_H; - SiS_Pr->SiS_LVDSCRT11152x768_1_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11152x768_1_H; - SiS_Pr->SiS_LVDSCRT1800x600_2 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT1800x600_2; - SiS_Pr->SiS_LVDSCRT11024x768_2 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11024x768_2; - SiS_Pr->SiS_LVDSCRT11280x1024_2 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11280x1024_2; - SiS_Pr->SiS_LVDSCRT11024x600_2 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11024x600_2; - SiS_Pr->SiS_LVDSCRT11152x768_2 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11152x768_2; - SiS_Pr->SiS_LVDSCRT1800x600_2_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT1800x600_2_H; - SiS_Pr->SiS_LVDSCRT11024x768_2_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11024x768_2_H; - SiS_Pr->SiS_LVDSCRT11280x1024_2_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11280x1024_2_H; - SiS_Pr->SiS_LVDSCRT11024x600_2_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11024x600_2_H; - SiS_Pr->SiS_LVDSCRT11152x768_2_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11152x768_2_H; - SiS_Pr->SiS_CHTVCRT1UNTSC = (SiS_LVDSCRT1DataStruct *)SiS300_CHTVCRT1UNTSC; - SiS_Pr->SiS_CHTVCRT1ONTSC = (SiS_LVDSCRT1DataStruct *)SiS300_CHTVCRT1ONTSC; - SiS_Pr->SiS_CHTVCRT1UPAL = (SiS_LVDSCRT1DataStruct *)SiS300_CHTVCRT1UPAL; - SiS_Pr->SiS_CHTVCRT1OPAL = (SiS_LVDSCRT1DataStruct *)SiS300_CHTVCRT1OPAL; - SiS_Pr->SiS_CHTVCRT1SOPAL = (SiS_LVDSCRT1DataStruct *)SiS300_CHTVCRT1SOPAL; - SiS_Pr->SiS_CHTVReg_UNTSC = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_UNTSC; - SiS_Pr->SiS_CHTVReg_ONTSC = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_ONTSC; - SiS_Pr->SiS_CHTVReg_UPAL = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_UPAL; - SiS_Pr->SiS_CHTVReg_OPAL = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_OPAL; - SiS_Pr->SiS_CHTVReg_UPALM = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_UNTSC; /* not supported on 300 series */ - SiS_Pr->SiS_CHTVReg_OPALM = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_ONTSC; /* not supported on 300 series */ - SiS_Pr->SiS_CHTVReg_UPALN = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_UPAL; /* not supported on 300 series */ - SiS_Pr->SiS_CHTVReg_OPALN = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_OPAL; /* not supported on 300 series */ - SiS_Pr->SiS_CHTVReg_SOPAL = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_SOPAL; + SiS_Pr->SiS_PanelDelayTbl = SiS300_PanelDelayTbl; + SiS_Pr->SiS_PanelDelayTblLVDS = SiS300_PanelDelayTbl; + + SiS_Pr->SiS_ExtLCD1024x768Data = SiS300_ExtLCD1024x768Data; + SiS_Pr->SiS_St2LCD1024x768Data = SiS300_St2LCD1024x768Data; + SiS_Pr->SiS_ExtLCD1280x1024Data = SiS300_ExtLCD1280x1024Data; + 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; + SiS_Pr->SiS_CHTVUPALMData = SiS_CHTVUNTSCData; /* not supported on 300 series */ + SiS_Pr->SiS_CHTVOPALMData = SiS_CHTVONTSCData; /* not supported on 300 series */ + SiS_Pr->SiS_CHTVUPALNData = SiS300_CHTVUPALData; /* not supported on 300 series */ + 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_CHTVCRT1UNTSC = SiS300_CHTVCRT1UNTSC; + SiS_Pr->SiS_CHTVCRT1ONTSC = SiS300_CHTVCRT1ONTSC; + SiS_Pr->SiS_CHTVCRT1UPAL = SiS300_CHTVCRT1UPAL; + SiS_Pr->SiS_CHTVCRT1OPAL = SiS300_CHTVCRT1OPAL; + SiS_Pr->SiS_CHTVCRT1SOPAL = SiS300_CHTVCRT1SOPAL; + SiS_Pr->SiS_CHTVReg_UNTSC = SiS300_CHTVReg_UNTSC; + SiS_Pr->SiS_CHTVReg_ONTSC = SiS300_CHTVReg_ONTSC; + SiS_Pr->SiS_CHTVReg_UPAL = SiS300_CHTVReg_UPAL; + SiS_Pr->SiS_CHTVReg_OPAL = SiS300_CHTVReg_OPAL; + SiS_Pr->SiS_CHTVReg_UPALM = SiS300_CHTVReg_UNTSC; /* not supported on 300 series */ + SiS_Pr->SiS_CHTVReg_OPALM = SiS300_CHTVReg_ONTSC; /* not supported on 300 series */ + SiS_Pr->SiS_CHTVReg_UPALN = SiS300_CHTVReg_UPAL; /* not supported on 300 series */ + SiS_Pr->SiS_CHTVReg_OPALN = SiS300_CHTVReg_OPAL; /* not supported on 300 series */ + SiS_Pr->SiS_CHTVReg_SOPAL = SiS300_CHTVReg_SOPAL; SiS_Pr->SiS_CHTVVCLKUNTSC = SiS300_CHTVVCLKUNTSC; SiS_Pr->SiS_CHTVVCLKONTSC = SiS300_CHTVVCLKONTSC; SiS_Pr->SiS_CHTVVCLKUPAL = SiS300_CHTVVCLKUPAL; @@ -367,67 +387,61 @@ SiS_Pr->SiS_CHTVVCLKUPALN = SiS300_CHTVVCLKUPAL; /* not supported on 300 series */ SiS_Pr->SiS_CHTVVCLKOPALN = SiS300_CHTVVCLKOPAL; /* not supported on 300 series */ SiS_Pr->SiS_CHTVVCLKSOPAL = SiS300_CHTVVCLKSOPAL; - - /* TW: New from 300/301LV BIOS */ - SiS_Pr->SiS_CRT2Part2_1024x768_1 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1024x768_1; - SiS_Pr->SiS_CRT2Part2_1280x1024_1 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1280x1024_1; - SiS_Pr->SiS_CRT2Part2_1400x1050_1 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1400x1050_1; - SiS_Pr->SiS_CRT2Part2_1600x1200_1 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1600x1200_1; - SiS_Pr->SiS_CRT2Part2_1024x768_2 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1024x768_2; - SiS_Pr->SiS_CRT2Part2_1280x1024_2 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1280x1024_2; - SiS_Pr->SiS_CRT2Part2_1400x1050_2 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1400x1050_2; - SiS_Pr->SiS_CRT2Part2_1600x1200_2 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1600x1200_2; - SiS_Pr->SiS_CRT2Part2_1024x768_3 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1024x768_3; - SiS_Pr->SiS_CRT2Part2_1280x1024_3 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1280x1024_3; - SiS_Pr->SiS_CRT2Part2_1400x1050_3 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1400x1050_3; - SiS_Pr->SiS_CRT2Part2_1600x1200_3 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1600x1200_3; - - /* TW: LCDResInfo will on 300 series be translated to 310/325 series definitions */ - SiS_Pr->SiS_Panel320x480 = Panel_320x480; - SiS_Pr->SiS_Panel640x480 = Panel_640x480; - SiS_Pr->SiS_Panel800x600 = Panel_800x600; - SiS_Pr->SiS_Panel1024x768 = Panel_1024x768; - SiS_Pr->SiS_Panel1280x1024 = Panel_1280x1024; - SiS_Pr->SiS_Panel1280x960 = Panel_1280x960; - SiS_Pr->SiS_Panel1024x600 = Panel_1024x600; - SiS_Pr->SiS_Panel1152x768 = Panel_1152x768; - SiS_Pr->SiS_Panel1600x1200 = 16; /* TW: Something illegal */ - SiS_Pr->SiS_Panel1400x1050 = 16; /* TW: Something illegal */ - SiS_Pr->SiS_Panel1152x864 = 16; /* TW: Something illegal */ - SiS_Pr->SiS_Panel1280x768 = 16; /* TW: Something illegal */ - SiS_Pr->SiS_PanelMax = Panel_320x480; /* TW: highest value */ - SiS_Pr->SiS_PanelMinLVDS = Panel_800x600; /* TW: Lowest value LVDS */ - SiS_Pr->SiS_PanelMin301 = Panel_1024x768; /* TW: lowest value 301 */ } #endif #ifdef SIS315H static void -InitTo310Pointer(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension) +InitTo310Pointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) { - SiS_Pr->SiS_SModeIDTable = (SiS_StStruct *)SiS310_SModeIDTable; - SiS_Pr->SiS_StandTable = (SiS_StandTableStruct *)SiS310_StandTable; - SiS_Pr->SiS_EModeIDTable = (SiS_ExtStruct *)SiS310_EModeIDTable; + InitCommonPointer(SiS_Pr, HwInfo); + + SiS_StandTable[0x04].CRTC[4] = 0x2c; + SiS_StandTable[0x05].CRTC[4] = 0x2c; + SiS_StandTable[0x06].CRTC[4] = 0x55; + SiS_StandTable[0x06].CRTC[5] = 0x81; + SiS_StandTable[0x0d].CRTC[4] = 0x2c; + SiS_StandTable[0x0e].CRTC[4] = 0x55; + SiS_StandTable[0x0e].CRTC[5] = 0x81; + SiS_StandTable[0x11].CRTC[4] = 0x55; + SiS_StandTable[0x11].CRTC[5] = 0x81; + SiS_StandTable[0x11].CRTC[16] = 0x82; + SiS_StandTable[0x11].CRTC[17] = 0x84; + SiS_StandTable[0x12].CRTC[4] = 0x55; + SiS_StandTable[0x12].CRTC[5] = 0x81; + SiS_StandTable[0x12].CRTC[16] = 0x82; + SiS_StandTable[0x12].CRTC[17] = 0x84; + SiS_StandTable[0x13].CRTC[5] = 0xb1; + SiS_StandTable[0x17].CRTC[5] = 0xb1; + SiS_StandTable[0x1a].CRTC[4] = 0x55; + SiS_StandTable[0x1a].CRTC[5] = 0x81; + SiS_StandTable[0x1a].CRTC[16] = 0xe9; + SiS_StandTable[0x1a].CRTC[17] = 0x8b; + SiS_StandTable[0x1b].CRTC[4] = 0x55; + SiS_StandTable[0x1b].CRTC[5] = 0x81; + SiS_StandTable[0x1b].CRTC[16] = 0xe9; + SiS_StandTable[0x1b].CRTC[17] = 0x8b; + SiS_StandTable[0x1c].CRTC[4] = 0x55; + SiS_StandTable[0x1c].CRTC[5] = 0x81; + + SiS_Pr->SiS_SModeIDTable = SiS310_SModeIDTable; + SiS_Pr->SiS_EModeIDTable = SiS310_EModeIDTable; SiS_Pr->SiS_RefIndex = (SiS_Ext2Struct *)SiS310_RefIndex; - SiS_Pr->SiS_CRT1Table = (SiS_CRT1TableStruct *)SiS310_CRT1Table; - /* TW: MCLK is different */ - if(HwDeviceExtension->jChipType == SIS_330) { - SiS_Pr->SiS_MCLKData_0 = (SiS_MCLKDataStruct *)SiS310_MCLKData_0_330; /* 330 */ - } else if(HwDeviceExtension->jChipType > SIS_315PRO) { - SiS_Pr->SiS_MCLKData_0 = (SiS_MCLKDataStruct *)SiS310_MCLKData_0_650; /* 550, 650 */ + SiS_Pr->SiS_CRT1Table = SiS310_CRT1Table; + if(HwInfo->jChipType >= SIS_760) { + SiS_Pr->SiS_MCLKData_0 = SiS310_MCLKData_0_760; /* 760 */ + } else if(HwInfo->jChipType >= SIS_661) { + SiS_Pr->SiS_MCLKData_0 = SiS310_MCLKData_0_660; /* 661/741 */ + } else if(HwInfo->jChipType == SIS_330) { + SiS_Pr->SiS_MCLKData_0 = SiS310_MCLKData_0_330; /* 330 */ + } else if(HwInfo->jChipType > SIS_315PRO) { + SiS_Pr->SiS_MCLKData_0 = SiS310_MCLKData_0_650; /* 550, 650, 740 */ } else { - SiS_Pr->SiS_MCLKData_0 = (SiS_MCLKDataStruct *)SiS310_MCLKData_0_315; /* 315 */ + SiS_Pr->SiS_MCLKData_0 = SiS310_MCLKData_0_315; /* 315 */ } - SiS_Pr->SiS_MCLKData_1 = (SiS_MCLKDataStruct *)SiS310_MCLKData_1; - SiS_Pr->SiS_ECLKData = (SiS_ECLKDataStruct *)SiS310_ECLKData; - SiS_Pr->SiS_VCLKData = (SiS_VCLKDataStruct *)SiS310_VCLKData; - SiS_Pr->SiS_VBVCLKData = (SiS_VBVCLKDataStruct *)SiS310_VBVCLKData; - SiS_Pr->SiS_ScreenOffset = SiS310_ScreenOffset; - SiS_Pr->SiS_StResInfo = (SiS_StResInfoStruct *)SiS310_StResInfo; - SiS_Pr->SiS_ModeResInfo = (SiS_ModeResInfoStruct *)SiS310_ModeResInfo; - - SiS_Pr->pSiS_OutputSelect = &SiS310_OutputSelect; - SiS_Pr->pSiS_SoftSetting = &SiS310_SoftSetting; + 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; @@ -456,218 +470,97 @@ SiS_Pr->pSiS_YCSenseData2 = &SiS310_YCSenseData2; #endif - SiS_Pr->SiS_NTSCPhase = SiS310_NTSCPhase; - SiS_Pr->SiS_PALPhase = SiS310_PALPhase; - SiS_Pr->SiS_NTSCPhase2 = SiS310_NTSCPhase2; - SiS_Pr->SiS_PALPhase2 = SiS310_PALPhase2; - SiS_Pr->SiS_PALMPhase = SiS310_PALMPhase; - SiS_Pr->SiS_PALNPhase = SiS310_PALNPhase; - SiS_Pr->SiS_PALMPhase2 = SiS310_PALMPhase2; - SiS_Pr->SiS_PALNPhase2 = SiS310_PALNPhase2; - SiS_Pr->SiS_SpecialPhase = SiS310_SpecialPhase; - - SiS_Pr->SiS_StLCD1024x768Data = (SiS_LCDDataStruct *)SiS310_StLCD1024x768Data; - SiS_Pr->SiS_ExtLCD1024x768Data = (SiS_LCDDataStruct *)SiS310_ExtLCD1024x768Data; - SiS_Pr->SiS_St2LCD1024x768Data = (SiS_LCDDataStruct *)SiS310_St2LCD1024x768Data; - SiS_Pr->SiS_StLCD1280x1024Data = (SiS_LCDDataStruct *)SiS310_StLCD1280x1024Data; - SiS_Pr->SiS_ExtLCD1280x1024Data = (SiS_LCDDataStruct *)SiS310_ExtLCD1280x1024Data; - SiS_Pr->SiS_St2LCD1280x1024Data = (SiS_LCDDataStruct *)SiS310_St2LCD1280x1024Data; - SiS_Pr->SiS_NoScaleData1024x768 = (SiS_LCDDataStruct *)SiS310_NoScaleData1024x768; - SiS_Pr->SiS_NoScaleData1280x1024 = (SiS_LCDDataStruct *)SiS310_NoScaleData1280x1024; - SiS_Pr->SiS_LCD1280x960Data = (SiS_LCDDataStruct *)SiS310_LCD1280x960Data; - SiS_Pr->SiS_ExtLCD1400x1050Data = (SiS_LCDDataStruct *)SiS310_ExtLCD1400x1050Data; - SiS_Pr->SiS_ExtLCD1600x1200Data = (SiS_LCDDataStruct *)SiS310_ExtLCD1600x1200Data; - SiS_Pr->SiS_StLCD1400x1050Data = (SiS_LCDDataStruct *)SiS310_StLCD1400x1050Data; - SiS_Pr->SiS_StLCD1600x1200Data = (SiS_LCDDataStruct *)SiS310_StLCD1600x1200Data; - SiS_Pr->SiS_NoScaleData1400x1050 = (SiS_LCDDataStruct *)SiS310_NoScaleData1400x1050; - SiS_Pr->SiS_NoScaleData1600x1200 = (SiS_LCDDataStruct *)SiS310_NoScaleData1600x1200; - - SiS_Pr->SiS_StPALData = (SiS_TVDataStruct *)SiS310_StPALData; - SiS_Pr->SiS_ExtPALData = (SiS_TVDataStruct *)SiS310_ExtPALData; - SiS_Pr->SiS_StNTSCData = (SiS_TVDataStruct *)SiS310_StNTSCData; - SiS_Pr->SiS_ExtNTSCData = (SiS_TVDataStruct *)SiS310_ExtNTSCData; -#ifdef oldHV - SiS_Pr->SiS_St1HiTVData = (SiS_TVDataStruct *)SiS310_St1HiTVData; - SiS_Pr->SiS_St2HiTVData = (SiS_TVDataStruct *)SiS310_St2HiTVData; - SiS_Pr->SiS_ExtHiTVData = (SiS_TVDataStruct *)SiS310_ExtHiTVData; -#endif - - SiS_Pr->SiS_NTSCTiming = SiS310_NTSCTiming; - SiS_Pr->SiS_PALTiming = SiS310_PALTiming; -#ifdef oldHV - SiS_Pr->SiS_HiTVSt1Timing = SiS310_HiTVSt1Timing; - SiS_Pr->SiS_HiTVSt2Timing = SiS310_HiTVSt2Timing; - SiS_Pr->SiS_HiTVTextTiming = SiS310_HiTVTextTiming; - SiS_Pr->SiS_HiTVExtTiming = SiS310_HiTVExtTiming; - SiS_Pr->SiS_HiTVGroup3Data = SiS310_HiTVGroup3Data; - SiS_Pr->SiS_HiTVGroup3Simu = SiS310_HiTVGroup3Simu; - SiS_Pr->SiS_HiTVGroup3Text = SiS310_HiTVGroup3Text; -#endif - - SiS_Pr->SiS_PanelDelayTbl = (SiS_PanelDelayTblStruct *)SiS310_PanelDelayTbl; - SiS_Pr->SiS_PanelDelayTblLVDS = (SiS_PanelDelayTblStruct *)SiS310_PanelDelayTblLVDS; - - SiS_Pr->SiS_LVDS800x600Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS800x600Data_1; - SiS_Pr->SiS_LVDS800x600Data_2 = (SiS_LVDSDataStruct *)SiS310_LVDS800x600Data_2; - SiS_Pr->SiS_LVDS1024x768Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS1024x768Data_1; - SiS_Pr->SiS_LVDS1024x768Data_2 = (SiS_LVDSDataStruct *)SiS310_LVDS1024x768Data_2; - SiS_Pr->SiS_LVDS1280x1024Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS1280x1024Data_1; - SiS_Pr->SiS_LVDS1280x1024Data_2 = (SiS_LVDSDataStruct *)SiS310_LVDS1280x1024Data_2; - SiS_Pr->SiS_LVDS1280x960Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS1280x960Data_1; - SiS_Pr->SiS_LVDS1280x960Data_2 = (SiS_LVDSDataStruct *)SiS310_LVDS1280x960Data_2; - SiS_Pr->SiS_LVDS1400x1050Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS1400x1050Data_1; - SiS_Pr->SiS_LVDS1400x1050Data_2 = (SiS_LVDSDataStruct *)SiS310_LVDS1400x1050Data_2; - SiS_Pr->SiS_LVDS1280x768Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS1280x768Data_1; - SiS_Pr->SiS_LVDS1280x768Data_2 = (SiS_LVDSDataStruct *)SiS310_LVDS1280x768Data_2; - SiS_Pr->SiS_LVDS1024x600Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS1024x600Data_1; - SiS_Pr->SiS_LVDS1024x600Data_2 = (SiS_LVDSDataStruct *)SiS310_LVDS1024x600Data_2; - SiS_Pr->SiS_LVDS1152x768Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS1152x768Data_1; - SiS_Pr->SiS_LVDS1152x768Data_2 = (SiS_LVDSDataStruct *)SiS310_LVDS1152x768Data_2; - SiS_Pr->SiS_LVDSXXXxXXXData_1 = (SiS_LVDSDataStruct *)SiS310_LVDSXXXxXXXData_1; - SiS_Pr->SiS_LVDS320x480Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS320x480Data_1; - SiS_Pr->SiS_LVDS640x480Data_1 = (SiS_LVDSDataStruct *)SiS310_LVDS640x480Data_1; - SiS_Pr->SiS_LCDA1400x1050Data_1 = (SiS_LVDSDataStruct *)SiS310_LCDA1400x1050Data_1; - SiS_Pr->SiS_LCDA1400x1050Data_2 = (SiS_LVDSDataStruct *)SiS310_LCDA1400x1050Data_2; - SiS_Pr->SiS_LCDA1600x1200Data_1 = (SiS_LVDSDataStruct *)SiS310_LCDA1600x1200Data_1; - SiS_Pr->SiS_LCDA1600x1200Data_2 = (SiS_LVDSDataStruct *)SiS310_LCDA1600x1200Data_2; - SiS_Pr->SiS_CHTVUNTSCData = (SiS_LVDSDataStruct *)SiS310_CHTVUNTSCData; - SiS_Pr->SiS_CHTVONTSCData = (SiS_LVDSDataStruct *)SiS310_CHTVONTSCData; - SiS_Pr->SiS_CHTVUPALData = (SiS_LVDSDataStruct *)SiS310_CHTVUPALData; - SiS_Pr->SiS_CHTVOPALData = (SiS_LVDSDataStruct *)SiS310_CHTVOPALData; - SiS_Pr->SiS_CHTVUPALMData = (SiS_LVDSDataStruct *)SiS310_CHTVUPALMData; - SiS_Pr->SiS_CHTVOPALMData = (SiS_LVDSDataStruct *)SiS310_CHTVOPALMData; - SiS_Pr->SiS_CHTVUPALNData = (SiS_LVDSDataStruct *)SiS310_CHTVUPALNData; - SiS_Pr->SiS_CHTVOPALNData = (SiS_LVDSDataStruct *)SiS310_CHTVOPALNData; - SiS_Pr->SiS_CHTVSOPALData = (SiS_LVDSDataStruct *)SiS310_CHTVSOPALData; - SiS_Pr->SiS_PanelType00_1 = (SiS_LVDSDesStruct *)SiS310_PanelType00_1; - SiS_Pr->SiS_PanelType01_1 = (SiS_LVDSDesStruct *)SiS310_PanelType01_1; - SiS_Pr->SiS_PanelType02_1 = (SiS_LVDSDesStruct *)SiS310_PanelType02_1; - SiS_Pr->SiS_PanelType03_1 = (SiS_LVDSDesStruct *)SiS310_PanelType03_1; - SiS_Pr->SiS_PanelType04_1 = (SiS_LVDSDesStruct *)SiS310_PanelType04_1; - SiS_Pr->SiS_PanelType05_1 = (SiS_LVDSDesStruct *)SiS310_PanelType05_1; - SiS_Pr->SiS_PanelType06_1 = (SiS_LVDSDesStruct *)SiS310_PanelType06_1; - SiS_Pr->SiS_PanelType07_1 = (SiS_LVDSDesStruct *)SiS310_PanelType07_1; - SiS_Pr->SiS_PanelType08_1 = (SiS_LVDSDesStruct *)SiS310_PanelType08_1; - SiS_Pr->SiS_PanelType09_1 = (SiS_LVDSDesStruct *)SiS310_PanelType09_1; - SiS_Pr->SiS_PanelType0a_1 = (SiS_LVDSDesStruct *)SiS310_PanelType0a_1; - SiS_Pr->SiS_PanelType0b_1 = (SiS_LVDSDesStruct *)SiS310_PanelType0b_1; - SiS_Pr->SiS_PanelType0c_1 = (SiS_LVDSDesStruct *)SiS310_PanelType0c_1; - SiS_Pr->SiS_PanelType0d_1 = (SiS_LVDSDesStruct *)SiS310_PanelType0d_1; - SiS_Pr->SiS_PanelType0e_1 = (SiS_LVDSDesStruct *)SiS310_PanelType0e_1; - SiS_Pr->SiS_PanelType0f_1 = (SiS_LVDSDesStruct *)SiS310_PanelType0f_1; - SiS_Pr->SiS_PanelType00_2 = (SiS_LVDSDesStruct *)SiS310_PanelType00_2; - SiS_Pr->SiS_PanelType01_2 = (SiS_LVDSDesStruct *)SiS310_PanelType01_2; - SiS_Pr->SiS_PanelType02_2 = (SiS_LVDSDesStruct *)SiS310_PanelType02_2; - SiS_Pr->SiS_PanelType03_2 = (SiS_LVDSDesStruct *)SiS310_PanelType03_2; - SiS_Pr->SiS_PanelType04_2 = (SiS_LVDSDesStruct *)SiS310_PanelType04_2; - SiS_Pr->SiS_PanelType05_2 = (SiS_LVDSDesStruct *)SiS310_PanelType05_2; - SiS_Pr->SiS_PanelType06_2 = (SiS_LVDSDesStruct *)SiS310_PanelType06_2; - SiS_Pr->SiS_PanelType07_2 = (SiS_LVDSDesStruct *)SiS310_PanelType07_2; - SiS_Pr->SiS_PanelType08_2 = (SiS_LVDSDesStruct *)SiS310_PanelType08_2; - SiS_Pr->SiS_PanelType09_2 = (SiS_LVDSDesStruct *)SiS310_PanelType09_2; - SiS_Pr->SiS_PanelType0a_2 = (SiS_LVDSDesStruct *)SiS310_PanelType0a_2; - SiS_Pr->SiS_PanelType0b_2 = (SiS_LVDSDesStruct *)SiS310_PanelType0b_2; - SiS_Pr->SiS_PanelType0c_2 = (SiS_LVDSDesStruct *)SiS310_PanelType0c_2; - SiS_Pr->SiS_PanelType0d_2 = (SiS_LVDSDesStruct *)SiS310_PanelType0d_2; - SiS_Pr->SiS_PanelType0e_2 = (SiS_LVDSDesStruct *)SiS310_PanelType0e_2; - SiS_Pr->SiS_PanelType0f_2 = (SiS_LVDSDesStruct *)SiS310_PanelType0f_2; - - SiS_Pr->LVDS1024x768Des_1 = (SiS_LVDSDesStruct *)SiS310_PanelType1076_1; - SiS_Pr->LVDS1280x1024Des_1 = (SiS_LVDSDesStruct *)SiS310_PanelType1210_1; - SiS_Pr->LVDS1400x1050Des_1 = (SiS_LVDSDesStruct *)SiS310_PanelType1296_1 ; - SiS_Pr->LVDS1600x1200Des_1 = (SiS_LVDSDesStruct *)SiS310_PanelType1600_1 ; - SiS_Pr->LVDS1024x768Des_2 = (SiS_LVDSDesStruct *)SiS310_PanelType1076_2; - SiS_Pr->LVDS1280x1024Des_2 = (SiS_LVDSDesStruct *)SiS310_PanelType1210_2; - SiS_Pr->LVDS1400x1050Des_2 = (SiS_LVDSDesStruct *)SiS310_PanelType1296_2; - SiS_Pr->LVDS1600x1200Des_2 = (SiS_LVDSDesStruct *)SiS310_PanelType1600_2 ; - - /* TW: New from 650/301LV BIOS */ - SiS_Pr->SiS_CRT2Part2_1024x768_1 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1024x768_1; - SiS_Pr->SiS_CRT2Part2_1280x1024_1 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1280x1024_1; - SiS_Pr->SiS_CRT2Part2_1400x1050_1 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1400x1050_1; - SiS_Pr->SiS_CRT2Part2_1600x1200_1 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1600x1200_1; - SiS_Pr->SiS_CRT2Part2_1024x768_2 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1024x768_2; - SiS_Pr->SiS_CRT2Part2_1280x1024_2 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1280x1024_2; - SiS_Pr->SiS_CRT2Part2_1400x1050_2 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1400x1050_2; - SiS_Pr->SiS_CRT2Part2_1600x1200_2 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1600x1200_2; - SiS_Pr->SiS_CRT2Part2_1024x768_3 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1024x768_3; - SiS_Pr->SiS_CRT2Part2_1280x1024_3 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1280x1024_3; - SiS_Pr->SiS_CRT2Part2_1400x1050_3 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1400x1050_3; - SiS_Pr->SiS_CRT2Part2_1600x1200_3 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1600x1200_3; - - SiS_Pr->SiS_CHTVUNTSCDesData = (SiS_LVDSDesStruct *)SiS310_CHTVUNTSCDesData; - SiS_Pr->SiS_CHTVONTSCDesData = (SiS_LVDSDesStruct *)SiS310_CHTVONTSCDesData; - SiS_Pr->SiS_CHTVUPALDesData = (SiS_LVDSDesStruct *)SiS310_CHTVUPALDesData; - SiS_Pr->SiS_CHTVOPALDesData = (SiS_LVDSDesStruct *)SiS310_CHTVOPALDesData; - - SiS_Pr->SiS_LVDSCRT1800x600_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT1800x600_1; - SiS_Pr->SiS_LVDSCRT11024x768_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11024x768_1; - SiS_Pr->SiS_LVDSCRT11280x1024_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11280x1024_1; - SiS_Pr->SiS_LVDSCRT11400x1050_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11400x1050_1; - SiS_Pr->SiS_LVDSCRT11280x768_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11280x768_1; - SiS_Pr->SiS_LVDSCRT11024x600_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11024x600_1; - SiS_Pr->SiS_LVDSCRT11152x768_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11152x768_1; - SiS_Pr->SiS_LVDSCRT11600x1200_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11600x1200_1; - SiS_Pr->SiS_LVDSCRT1800x600_1_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT1800x600_1_H; - SiS_Pr->SiS_LVDSCRT11024x768_1_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11024x768_1_H; - SiS_Pr->SiS_LVDSCRT11280x1024_1_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11280x1024_1_H; - SiS_Pr->SiS_LVDSCRT11400x1050_1_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11400x1050_1_H; - SiS_Pr->SiS_LVDSCRT11280x768_1_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11280x768_1_H; - SiS_Pr->SiS_LVDSCRT11024x600_1_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11024x600_1_H; - SiS_Pr->SiS_LVDSCRT11152x768_1_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11152x768_1_H; - SiS_Pr->SiS_LVDSCRT11600x1200_1_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11600x1200_1_H; - SiS_Pr->SiS_LVDSCRT1800x600_2 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT1800x600_2; - SiS_Pr->SiS_LVDSCRT11024x768_2 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11024x768_2; - SiS_Pr->SiS_LVDSCRT11280x1024_2 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11280x1024_2; - SiS_Pr->SiS_LVDSCRT11400x1050_2 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11400x1050_2; - SiS_Pr->SiS_LVDSCRT11280x768_2 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11280x768_2; - SiS_Pr->SiS_LVDSCRT11024x600_2 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11024x600_2; - SiS_Pr->SiS_LVDSCRT11152x768_2 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11152x768_2; - SiS_Pr->SiS_LVDSCRT11600x1200_2 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11600x1200_2; - SiS_Pr->SiS_LVDSCRT1800x600_2_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT1800x600_2_H; - SiS_Pr->SiS_LVDSCRT11024x768_2_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11024x768_2_H; - SiS_Pr->SiS_LVDSCRT11280x1024_2_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11280x1024_2_H; - SiS_Pr->SiS_LVDSCRT11400x1050_2_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11400x1050_2_H; - SiS_Pr->SiS_LVDSCRT11280x768_2_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11280x768_2_H; - SiS_Pr->SiS_LVDSCRT11024x600_2_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11024x600_2_H; - SiS_Pr->SiS_LVDSCRT11152x768_2_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11152x768_2_H; - SiS_Pr->SiS_LVDSCRT11600x1200_2_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11600x1200_2_H; - SiS_Pr->SiS_LVDSCRT1XXXxXXX_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT1XXXxXXX_1; - SiS_Pr->SiS_LVDSCRT1320x480_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT1320x480_1; - SiS_Pr->SiS_CHTVCRT1UNTSC = (SiS_LVDSCRT1DataStruct *)SiS310_CHTVCRT1UNTSC; - SiS_Pr->SiS_CHTVCRT1ONTSC = (SiS_LVDSCRT1DataStruct *)SiS310_CHTVCRT1ONTSC; - SiS_Pr->SiS_CHTVCRT1UPAL = (SiS_LVDSCRT1DataStruct *)SiS310_CHTVCRT1UPAL; - SiS_Pr->SiS_CHTVCRT1OPAL = (SiS_LVDSCRT1DataStruct *)SiS310_CHTVCRT1OPAL; - SiS_Pr->SiS_CHTVCRT1SOPAL = (SiS_LVDSCRT1DataStruct *)SiS310_CHTVCRT1SOPAL; - SiS_Pr->SiS_CHTVReg_UNTSC = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_UNTSC; - SiS_Pr->SiS_CHTVReg_ONTSC = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_ONTSC; - SiS_Pr->SiS_CHTVReg_UPAL = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_UPAL; - SiS_Pr->SiS_CHTVReg_OPAL = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_OPAL; - SiS_Pr->SiS_CHTVReg_UPALM = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_UPALM; - SiS_Pr->SiS_CHTVReg_OPALM = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_OPALM; - SiS_Pr->SiS_CHTVReg_UPALN = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_UPALN; - SiS_Pr->SiS_CHTVReg_OPALN = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_OPALN; - SiS_Pr->SiS_CHTVReg_SOPAL = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_SOPAL; - SiS_Pr->SiS_LCDACRT1800x600_1 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT1800x600_1; - SiS_Pr->SiS_LCDACRT11024x768_1 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11024x768_1; - SiS_Pr->SiS_LCDACRT11280x1024_1 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11280x1024_1; - SiS_Pr->SiS_LCDACRT11400x1050_1 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11400x1050_1; - SiS_Pr->SiS_LCDACRT11600x1200_1 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11600x1200_1; - SiS_Pr->SiS_LCDACRT1800x600_1_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT1800x600_1_H; - SiS_Pr->SiS_LCDACRT11024x768_1_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11024x768_1_H; - SiS_Pr->SiS_LCDACRT11280x1024_1_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11280x1024_1_H; - SiS_Pr->SiS_LCDACRT11400x1050_1_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11400x1050_1_H; - SiS_Pr->SiS_LCDACRT11600x1200_1_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11600x1200_1_H; - SiS_Pr->SiS_LCDACRT1800x600_2 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT1800x600_2; - SiS_Pr->SiS_LCDACRT11024x768_2 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11024x768_2; - SiS_Pr->SiS_LCDACRT11280x1024_2 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11280x1024_2; - SiS_Pr->SiS_LCDACRT11400x1050_2 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11400x1050_2; - SiS_Pr->SiS_LCDACRT11600x1200_2 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11600x1200_2; - SiS_Pr->SiS_LCDACRT1800x600_2_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT1800x600_2_H; - SiS_Pr->SiS_LCDACRT11024x768_2_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11024x768_2_H; - SiS_Pr->SiS_LCDACRT11280x1024_2_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11280x1024_2_H; - SiS_Pr->SiS_LCDACRT11400x1050_2_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11400x1050_2_H; - SiS_Pr->SiS_LCDACRT11600x1200_2_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11600x1200_2_H; + SiS_Pr->SiS_PanelDelayTbl = SiS310_PanelDelayTbl; + SiS_Pr->SiS_PanelDelayTblLVDS = SiS310_PanelDelayTblLVDS; + + SiS_Pr->SiS_St2LCD1024x768Data = SiS310_St2LCD1024x768Data; + SiS_Pr->SiS_ExtLCD1024x768Data = SiS310_ExtLCD1024x768Data; + SiS_Pr->SiS_St2LCD1280x1024Data = SiS310_St2LCD1280x1024Data; + SiS_Pr->SiS_ExtLCD1280x1024Data = SiS310_ExtLCD1280x1024Data; + + 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; + SiS_Pr->SiS_CHTVOPALMData = SiS310_CHTVOPALMData; + SiS_Pr->SiS_CHTVUPALNData = SiS310_CHTVUPALNData; + 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_CHTVReg_UNTSC = SiS310_CHTVReg_UNTSC; + SiS_Pr->SiS_CHTVReg_ONTSC = SiS310_CHTVReg_ONTSC; + SiS_Pr->SiS_CHTVReg_UPAL = SiS310_CHTVReg_UPAL; + SiS_Pr->SiS_CHTVReg_OPAL = SiS310_CHTVReg_OPAL; + SiS_Pr->SiS_CHTVReg_UPALM = SiS310_CHTVReg_UPALM; + SiS_Pr->SiS_CHTVReg_OPALM = SiS310_CHTVReg_OPALM; + SiS_Pr->SiS_CHTVReg_UPALN = SiS310_CHTVReg_UPALN; + SiS_Pr->SiS_CHTVReg_OPALN = SiS310_CHTVReg_OPALN; + SiS_Pr->SiS_CHTVReg_SOPAL = SiS310_CHTVReg_OPAL; + SiS_Pr->SiS_CHTVVCLKUNTSC = SiS310_CHTVVCLKUNTSC; SiS_Pr->SiS_CHTVVCLKONTSC = SiS310_CHTVVCLKONTSC; SiS_Pr->SiS_CHTVVCLKUPAL = SiS310_CHTVVCLKUPAL; @@ -675,1260 +568,1232 @@ SiS_Pr->SiS_CHTVVCLKUPALM = SiS310_CHTVVCLKUPALM; SiS_Pr->SiS_CHTVVCLKOPALM = SiS310_CHTVVCLKOPALM; SiS_Pr->SiS_CHTVVCLKUPALN = SiS310_CHTVVCLKUPALN; - SiS_Pr->SiS_CHTVVCLKOPALN = SiS310_CHTVVCLKOPALN; - SiS_Pr->SiS_CHTVVCLKSOPAL = SiS310_CHTVVCLKSOPAL; - - SiS_Pr->SiS_Panel320x480 = Panel_320x480; - SiS_Pr->SiS_Panel640x480 = Panel_640x480; - SiS_Pr->SiS_Panel800x600 = Panel_800x600; - SiS_Pr->SiS_Panel1024x768 = Panel_1024x768; - SiS_Pr->SiS_Panel1280x1024 = Panel_1280x1024; - SiS_Pr->SiS_Panel1280x960 = Panel_1280x960; - SiS_Pr->SiS_Panel1600x1200 = Panel_1600x1200; - SiS_Pr->SiS_Panel1400x1050 = Panel_1400x1050; - SiS_Pr->SiS_Panel1152x768 = Panel_1152x768; - SiS_Pr->SiS_Panel1152x864 = Panel_1152x864; - SiS_Pr->SiS_Panel1280x768 = Panel_1280x768; - SiS_Pr->SiS_Panel1024x600 = Panel_1024x600; - SiS_Pr->SiS_PanelMax = Panel_320x480; /* TW: highest value */ - SiS_Pr->SiS_PanelMinLVDS = Panel_800x600; /* TW: lowest value LVDS/LCDA */ - SiS_Pr->SiS_PanelMin301 = Panel_1024x768; /* TW: lowest value 301 */ + SiS_Pr->SiS_CHTVVCLKOPALN = SiS310_CHTVVCLKOPALN; + SiS_Pr->SiS_CHTVVCLKSOPAL = SiS310_CHTVVCLKOPAL; } #endif -#ifdef LINUXBIOS -/* -------------- SiSInit -----------------*/ -/* TW: I degraded this for LINUXBIOS only, because we - * don't need this otherwise. Under normal - * circumstances, the video BIOS has initialized - * the adapter for us. BTW, this code is incomplete - * and very possibly not functioning on newer chipsets. - */ -BOOLEAN -SiSInit(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension) +static void +SiSInitPtr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) { - UCHAR *ROMAddr = HwDeviceExtension->pjVirtualRomBase; - ULONG FBAddr = (ULONG)HwDeviceExtension->pjVideoMemoryAddress; - USHORT BaseAddr = (USHORT)HwDeviceExtension->ulIOAddress; - UCHAR i, temp=0; - UCHAR SR11; -#ifdef LINUX_KERNEL - UCHAR temp1; - ULONG base; -#endif - UCHAR SR13=0, SR14=0, SR16=0 - UCHAR SR17=0, SR19=0, SR1A=0; -#ifdef SIS300 - UCHAR SR18=0, SR12=0; -#endif -#ifdef SIS315H - UCHAR CR37=0, CR38=0, CR79=0, - UCHAR CR7A=0, CR7B=0, CR7C=0; - UCHAR SR1B=0, SR15=0; - PSIS_DSReg pSR; - ULONG Temp; -#endif - UCHAR VBIOSVersion[5]; - - if(FBAddr==0) return (FALSE); - if(BaseAddr==0) return (FALSE); - - SiS_SetReg3((USHORT)(BaseAddr+0x12), 0x67); /* Misc */ - -#ifdef SIS315H - if(HwDeviceExtension->jChipType > SIS_315PRO) { - if(!HwDeviceExtension->bIntegratedMMEnabled) - return (FALSE); - } -#endif - - SiS_MemoryCopy(VBIOSVersion,HwDeviceExtension->szVBIOSVer,4); - VBIOSVersion[4]= 0x00; - - SiSDetermineROMUsage(SiS_Pr, HwDeviceExtension, ROMAddr); - - /* TW: Init pointers */ + switch(HwInfo->jChipType) { #ifdef SIS315H - if((HwDeviceExtension->jChipType == SIS_315H) || - (HwDeviceExtension->jChipType == SIS_315) || - (HwDeviceExtension->jChipType == SIS_315PRO) || - (HwDeviceExtension->jChipType == SIS_550) || - (HwDeviceExtension->jChipType == SIS_650) || - (HwDeviceExtension->jChipType == SIS_740) || - (HwDeviceExtension->jChipType == SIS_330)) - InitTo310Pointer(SiS_Pr, HwDeviceExtension); + 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: + InitTo310Pointer(SiS_Pr, HwInfo); + break; #endif - #ifdef SIS300 - if((HwDeviceExtension->jChipType == SIS_540) || - (HwDeviceExtension->jChipType == SIS_630) || - (HwDeviceExtension->jChipType == SIS_730) || - (HwDeviceExtension->jChipType == SIS_300)) - InitTo300Pointer(SiS_Pr, HwDeviceExtension); + case SIS_300: + case SIS_540: + case SIS_630: + case SIS_730: + InitTo300Pointer(SiS_Pr, HwInfo); + break; #endif - - /* TW: Set SiS Register definitions */ - SiSRegInit(SiS_Pr, BaseAddr); - - /* TW: Determine LVDS/CH70xx/TRUMPION */ - SiS_Set_LVDS_TRUMPION(SiS_Pr, HwDeviceExtension); - - /* TW: Unlock registers */ - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x05,0x86); - -#ifdef LINUX_KERNEL - -#ifdef SIS300 /* Set SR14 */ - if((HwDeviceExtension->jChipType==SIS_540) || - (HwDeviceExtension->jChipType==SIS_630) || - (HwDeviceExtension->jChipType==SIS_730)) { - base=0x80000060; - OutPortLong(base,0xcf8); - temp1 = InPortLong(0xcfc); - temp1 >>= (16+8+4); - temp1 &= 0x07; - temp1++; - temp1 = 1 << temp1; - SR14 = temp1 - 1; - base = 0x80000064; - OutPortLong(base,0xcf8); - temp1 = InPortLong(0xcfc); - temp1 &= 0x00000020; - if(temp1) SR14 |= 0x80; - else SR14 |= 0x40; + default: + break; } -#endif +} -#ifdef SIS315H /* Set SR14 */ - if(HwDeviceExtension->jChipType == SIS_550) { - base = 0x80000060; - OutPortLong(base,0xcf8); - temp1 = InPortLong(0xcfc); - temp1 >>= (16+8+4); - temp1 &= 0x07; - temp1++; - temp1 = 1 << temp1; - SR14 = temp1 - 1; - base = 0x80000064; - OutPortLong(base,0xcf8); - temp1 = InPortLong(0xcfc); - temp1 &= 0x00000020; - if(temp1) SR14 |= 0x80; - else SR14 |= 0x40; - } - - if((HwDeviceExtension->jChipType == SIS_740) || /* Set SR14 */ - (HwDeviceExtension->jChipType == SIS_650)) { - base = 0x80000064; - OutPortLong(base,0xcf8); - temp1=InPortLong(0xcfc); - temp1 >>= 4; - temp1 &= 0x07; - if(temp1 > 2) { - temp = temp1; - switch(temp) { - case 3: temp1 = 0x07; break; - case 4: temp1 = 0x0F; break; - case 5: temp1 = 0x1F; break; - case 6: temp1 = 0x05; break; - case 7: temp1 = 0x17; break; - case 8: break; - case 9: break; - } - } - SR14 = temp1; - base = 0x8000007C; - OutPortLong(base,0xcf8); - temp1 = InPortLong(0xcfc); - temp1 &= 0x00000020; - if(temp1) SR14 |= 0x80; - } -#endif +/*********************************************/ +/* HELPER: Get ModeID */ +/*********************************************/ -#endif /* Linux kernel */ +USHORT +SiS_GetModeID(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, + int Depth, BOOLEAN FSTN, int LCDwidth, int LCDheight) +{ + USHORT ModeIndex = 0; -#ifdef SIS300 - if((HwDeviceExtension->jChipType == SIS_540)|| - (HwDeviceExtension->jChipType == SIS_630)|| - (HwDeviceExtension->jChipType == SIS_730)) { - SR12 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x12); - SR13 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13); - SR14 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14); - SR16 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16); - SR17 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x17); - SR18 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x18); - SR19 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x19); - SR1A = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1A); - } else if(HwDeviceExtension->jChipType == SIS_300){ - SR13 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13); - SR14 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14); - } -#endif -#ifdef SIS315H - if((HwDeviceExtension->jChipType == SIS_550) || - (HwDeviceExtension->jChipType == SIS_740) || - (HwDeviceExtension->jChipType == SIS_650)) { - SR19 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x19); - SR19 = (SR19)||0x01; /* TW: ??? || ??? */ - if(SR19==0x00) { - SR13 = 0x22; - SR14 = 0x00; - SR15 = 0x01; - SR16 = 0x00; - SR17 = 0x00; - SR1A = 0x00; - SR1B = 0x00; - CR37 = 0x00; - CR38 = 0x00; - CR79 = 0x00; - CR7A = 0x00; - CR7B = 0x00; - CR7C = 0x00; - } else { - SR13 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13); - SR14 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14); - SR15 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x15); - SR16 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16); - SR17 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x17); - SR1A = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1A); - SR1B = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1B); - CR37 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3d4,0x37); /* TW: Was 0x02 - why? */ - CR38 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38); - CR79 = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3d4,0x79); - CR7A = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3d4,0x7A); - CR7B = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3d4,0x7B); - CR7C = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3d4,0x7C); - } + 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(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(!(VBFlags & CRT1_LCDA)) { + if(VDisplay == 480) ModeIndex = ModeIndex_720x480[Depth]; + else if(VDisplay == 576) ModeIndex = ModeIndex_720x576[Depth]; + } + break; + case 768: + if(!(VBFlags & CRT1_LCDA)) { + if(VDisplay == 576) ModeIndex = ModeIndex_768x576[Depth]; + } + break; + case 800: + if(VDisplay == 600) ModeIndex = ModeIndex_800x600[Depth]; + else if(!(VBFlags & CRT1_LCDA)) { + if(VDisplay == 480) ModeIndex = ModeIndex_800x480[Depth]; + } + break; + case 848: + if(!(VBFlags & CRT1_LCDA)) { + if(VDisplay == 480) ModeIndex = ModeIndex_848x480[Depth]; + } + break; + case 856: + if(!(VBFlags & CRT1_LCDA)) { + if(VDisplay == 480) ModeIndex = ModeIndex_856x480[Depth]; + } + break; + case 1024: + if(VDisplay == 768) ModeIndex = ModeIndex_1024x768[Depth]; + else if(!(VBFlags & CRT1_LCDA)) { + if(VDisplay == 576) ModeIndex = ModeIndex_1024x576[Depth]; + else if(VGAEngine == SIS_300_VGA) { + if(VDisplay == 600) ModeIndex = ModeIndex_1024x600[Depth]; + } + } + break; + case 1152: + if(!(VBFlags & CRT1_LCDA)) { + 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 == 1024) ModeIndex = ModeIndex_1280x1024[Depth]; + else if(VDisplay == 800) { + if(VGAEngine == SIS_315_VGA) { + if((VBFlags & CRT1_LCDA) && (LCDwidth == 1280) && (LCDheight == 800)) { + ModeIndex = ModeIndex_1280x800[Depth]; + } else if(!(VBFlags & CRT1_LCDA)) { + ModeIndex = ModeIndex_1280x800[Depth]; + } + } + } else if(VDisplay == 720) { + if((VBFlags & CRT1_LCDA) && (LCDwidth == 1280) && (LCDheight == 720)) { + ModeIndex = ModeIndex_1280x720[Depth]; + } else if(!(VBFlags & CRT1_LCDA)) { + ModeIndex = ModeIndex_1280x720[Depth]; + } + } else if(!(VBFlags & CRT1_LCDA)) { + if(VDisplay == 960) ModeIndex = ModeIndex_1280x960[Depth]; + else if(VDisplay == 768) { + if(VGAEngine == SIS_300_VGA) { + ModeIndex = ModeIndex_300_1280x768[Depth]; + } else { + ModeIndex = ModeIndex_310_1280x768[Depth]; + } + } + } + break; + case 1360: + if(!(VBFlags & CRT1_LCDA)) { + if(VDisplay == 768) ModeIndex = ModeIndex_1360x768[Depth]; + else if(VGAEngine == SIS_300_VGA) { + if(VDisplay == 1024) ModeIndex = ModeIndex_300_1360x1024[Depth]; + } + } + break; + case 1400: + if(VGAEngine == SIS_315_VGA) { + if(VDisplay == 1050) { + if((VBFlags & CRT1_LCDA) && + (((LCDwidth == 1400) && (LCDheight == 1050)) || + ((LCDwidth == 1600) && (LCDheight == 1200)))) { + ModeIndex = ModeIndex_1400x1050[Depth]; + } else if(!(VBFlags & CRT1_LCDA)) { + 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(!(VBFlags & CRT1_LCDA)) { + if(VDisplay == 1440) ModeIndex = ModeIndex_1920x1440[Depth]; + } + break; + case 2048: + if(!(VBFlags & CRT1_LCDA)) { + if(VDisplay == 1536) { + if(VGAEngine == SIS_300_VGA) { + ModeIndex = ModeIndex_300_2048x1536[Depth]; + } else { + ModeIndex = ModeIndex_310_2048x1536[Depth]; + } + } + } + break; } -#endif - /* Reset extended registers */ - - for(i=0x06; i< 0x20; i++) SiS_SetReg1(SiS_Pr->SiS_P3c4,i,0); - for(i=0x21; i<=0x27; i++) SiS_SetReg1(SiS_Pr->SiS_P3c4,i,0); - for(i=0x31; i<=0x3D; i++) SiS_SetReg1(SiS_Pr->SiS_P3c4,i,0); + return(ModeIndex); +} -#ifdef SIS300 - if((HwDeviceExtension->jChipType == SIS_540) || - (HwDeviceExtension->jChipType == SIS_630) || - (HwDeviceExtension->jChipType == SIS_730) || - (HwDeviceExtension->jChipType == SIS_300)) { - for(i=0x38; i<=0x3F; i++) SiS_SetReg1(SiS_Pr->SiS_P3d4,i,0); - } -#endif +USHORT +SiS_GetModeID_LCD(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, + int Depth, BOOLEAN FSTN, USHORT CustomT, int LCDwidth, int LCDheight) +{ + USHORT ModeIndex = 0; -#ifdef SIS315H - if((HwDeviceExtension->jChipType == SIS_315H) || - (HwDeviceExtension->jChipType == SIS_315) || - (HwDeviceExtension->jChipType == SIS_315PRO) || - (HwDeviceExtension->jChipType == SIS_550) || - (HwDeviceExtension->jChipType == SIS_650) || - (HwDeviceExtension->jChipType == SIS_740) || - (HwDeviceExtension->jChipType == SIS_330)) { - for(i=0x12; i<=0x1B; i++) SiS_SetReg1(SiS_Pr->SiS_P3c4,i,0); - for(i=0x79; i<=0x7C; i++) SiS_SetReg1(SiS_Pr->SiS_P3d4,i,0); - } -#endif + if(VBFlags & (VB_LVDS | VB_30xBDH)) { - /* Restore Extended Registers */ + switch(HDisplay) + { + case 320: + if(CustomT != CUT_PANEL848) { + if(VDisplay == 200) 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]; + } + } + } + break; + case 400: + if(CustomT != CUT_PANEL848) { + if(!((VGAEngine == SIS_300_VGA) && (VBFlags & VB_TRUMPION))) { + if(VDisplay == 300) ModeIndex = ModeIndex_400x300[Depth]; + } + } + break; + case 512: + if(CustomT != CUT_PANEL848) { + if(!((VGAEngine == SIS_300_VGA) && (VBFlags & VB_TRUMPION))) { + if(LCDwidth != 1024 || LCDheight != 600) { + if(VDisplay == 384) { + ModeIndex = ModeIndex_512x384[Depth]; + } + } + } + } + break; + case 640: + if(VDisplay == 480) ModeIndex = ModeIndex_640x480[Depth]; + else if(VDisplay == 400) { + if(CustomT != CUT_PANEL848) ModeIndex = ModeIndex_640x400[Depth]; + } + break; + case 800: + if(VDisplay == 600) ModeIndex = ModeIndex_800x600[Depth]; + break; + case 848: + if(CustomT == CUT_PANEL848) { + if(VDisplay == 480) ModeIndex = ModeIndex_848x480[Depth]; + } + break; + case 1024: + if(VDisplay == 768) ModeIndex = ModeIndex_1024x768[Depth]; + else if(VGAEngine == SIS_300_VGA) { + if((VDisplay == 600) && (LCDheight == 600)) { + ModeIndex = ModeIndex_1024x600[Depth]; + } + } + break; + case 1152: + if(VGAEngine == SIS_300_VGA) { + if((VDisplay == 768) && (LCDheight == 768)) { + ModeIndex = ModeIndex_1152x768[Depth]; + } + } + break; + case 1280: + if(VDisplay == 1024) ModeIndex = ModeIndex_1280x1024[Depth]; + else if(VGAEngine == SIS_315_VGA) { + if((VDisplay == 768) && (LCDheight == 768)) { + ModeIndex = ModeIndex_310_1280x768[Depth]; + } + if((VDisplay == 800) && (LCDheight == 800)) { + ModeIndex = ModeIndex_310_1280x768[Depth]; + } + } + break; + case 1360: + if(VGAEngine == SIS_300_VGA) { + if(CustomT == CUT_BARCO1366) { + if(VDisplay == 1024) ModeIndex = ModeIndex_300_1360x1024[Depth]; + } + } + if(CustomT == CUT_PANEL848) { + 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(VDisplay == 1200) ModeIndex = ModeIndex_1600x1200[Depth]; + } + break; + } -#ifdef SIS300 - if((HwDeviceExtension->jChipType == SIS_540) || - (HwDeviceExtension->jChipType == SIS_630) || - (HwDeviceExtension->jChipType == SIS_730)) { - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x12,SR12); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,SR13); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,SR14); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,SR16); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x17,SR17); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x18,SR18); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x19,SR19); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1A,SR1A); - } -#endif + } else if(VBFlags & VB_SISBRIDGE) { -#ifdef SIS315H - if((HwDeviceExtension->jChipType == SIS_550) || - (HwDeviceExtension->jChipType == SIS_740) || - (HwDeviceExtension->jChipType == SIS_650)) { - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,SR13); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,SR14); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x15,SR15); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,SR16); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x17,SR17); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x19,SR19); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1A,SR1A); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1B,SR1B); - SiS_SetReg1(SiS_Pr->SiS_P3d4,0x37,CR37); - SiS_SetReg1(SiS_Pr->SiS_P3d4,0x38,CR38); - SiS_SetReg1(SiS_Pr->SiS_P3d4,0x79,CR79); - SiS_SetReg1(SiS_Pr->SiS_P3d4,0x7A,CR7A); - SiS_SetReg1(SiS_Pr->SiS_P3d4,0x7B,CR7B); - SiS_SetReg1(SiS_Pr->SiS_P3d4,0x7C,CR7C); + 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 800: + if(VDisplay == 600) ModeIndex = ModeIndex_800x600[Depth]; + break; + case 1024: + if(VDisplay == 768) ModeIndex = ModeIndex_1024x768[Depth]; + break; + case 1280: + if(VDisplay == 1024) ModeIndex = ModeIndex_1280x1024[Depth]; + else if(VDisplay == 768) { + if((LCDheight == 768) || (LCDwidth == 1680) || + ((LCDheight == 1024) && (VBFlags & (VB_301|VB_301B|VB_301C|VB_302B)))) { + if(VGAEngine == SIS_300_VGA) { + ModeIndex = ModeIndex_300_1280x768[Depth]; + } else { + ModeIndex = ModeIndex_310_1280x768[Depth]; + } + } + } else if(VDisplay == 960) { + if((LCDheight == 960) || + ((LCDheight == 1024) && (VBFlags & (VB_301|VB_301B|VB_301C|VB_302B)))) { + ModeIndex = ModeIndex_1280x960[Depth]; + } + } else if(VGAEngine == SIS_315_VGA) { + if(VDisplay == 800) { + if((LCDheight == 800) || (LCDwidth == 1680) || + ((LCDheight == 1024) && (VBFlags & (VB_301|VB_301B|VB_301C|VB_302B)))) { + ModeIndex = ModeIndex_1280x800[Depth]; + } + } else if(VDisplay == 720) { + if((LCDheight == 720) || (LCDwidth == 1680) || + ((LCDheight == 1024) && (VBFlags & (VB_301|VB_301B|VB_301C|VB_302B)))) { + ModeIndex = ModeIndex_1280x720[Depth]; + } + } + } + break; + case 1400: + if(VGAEngine == SIS_315_VGA) { + if(VBFlags & (VB_301B | VB_301C | VB_302B | VB_302LV | VB_302ELV)) { + if((LCDwidth == 1400) || (LCDwidth == 1600) || (LCDwidth == 1680)) { + ModeIndex = ModeIndex_1400x1050[Depth]; + } + } + } + break; + case 1600: + if(VGAEngine == SIS_315_VGA) { + if(VBFlags & (VB_301C | VB_302B | VB_302LV | VB_302ELV)) { + if(VDisplay == 1200) ModeIndex = ModeIndex_1600x1200[Depth]; + } + } + break; + case 1680: + if(VGAEngine == SIS_315_VGA) { + if(VBFlags & (VB_301C | VB_302B | VB_302LV | VB_302ELV)) { + if(VDisplay == 1050) ModeIndex = ModeIndex_1680x1050[Depth]; + } + } + break; + } } -#endif -#ifdef SIS300 - if((HwDeviceExtension->jChipType==SIS_540) || - (HwDeviceExtension->jChipType==SIS_630) || - (HwDeviceExtension->jChipType==SIS_730)) { - temp = (UCHAR)SR1A & 0x03; - } else if(HwDeviceExtension->jChipType == SIS_300) { - /* TW: Nothing */ - } -#endif -#ifdef SIS315H - if((HwDeviceExtension->jChipType == SIS_315H) || - (HwDeviceExtension->jChipType == SIS_315) || - (HwDeviceExtension->jChipType == SIS_315PRO) || - (HwDeviceExtension->jChipType == SIS_330) ) { - if((*SiS_Pr->pSiS_SoftSetting & SoftDRAMType) == 0) { - temp = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x3A) & 0x03; - } - } - if((HwDeviceExtension->jChipType == SIS_550) || - (HwDeviceExtension->jChipType == SIS_740) || - (HwDeviceExtension->jChipType == SIS_650)) { - if((*SiS_Pr->pSiS_SoftSetting & SoftDRAMType) == 0) { - temp = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13) & 0x07; - } - } -#endif + return ModeIndex; +} - SiS_Pr->SiS_RAMType = temp; - SiS_SetMemoryClock(SiS_Pr, ROMAddr, HwDeviceExtension); +USHORT +SiS_GetModeID_TV(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int Depth) +{ + USHORT ModeIndex = 0; - /* Set default register contents */ + if(VBFlags & VB_CHRONTEL) { - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x07,*SiS_Pr->pSiS_SR07); /* DAC speed */ + switch(HDisplay) + { + case 512: + if(VGAEngine == SIS_315_VGA) { + 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 800: + if(VDisplay == 600) ModeIndex = ModeIndex_800x600[Depth]; + break; + case 1024: + if(VGAEngine == SIS_315_VGA) { + if(VDisplay == 768) ModeIndex = ModeIndex_1024x768[Depth]; + } + break; + } - if((HwDeviceExtension->jChipType != SIS_540) && - (HwDeviceExtension->jChipType != SIS_630) && - (HwDeviceExtension->jChipType != SIS_730)){ - for(i=0x15;i<0x1C;i++) { - SiS_SetReg1(SiS_Pr->SiS_P3c4,i,SiS_Pr->SiS_SR15[i-0x15][SiS_Pr->SiS_RAMType]); - } - } + } else if(VBFlags & VB_SISTVBRIDGE) { -#ifdef SIS315H - if((HwDeviceExtension->jChipType == SIS_315H) || - (HwDeviceExtension->jChipType == SIS_315) || - (HwDeviceExtension->jChipType == SIS_315PRO) || - (HwDeviceExtension->jChipType == SIS_330)) { - for(i=0x40;i<=0x44;i++) { - SiS_SetReg1(SiS_Pr->SiS_P3d4,i,SiS_Pr->SiS_CR40[i-0x40][SiS_Pr->SiS_RAMType]); - } - SiS_SetReg1(SiS_Pr->SiS_P3d4,0x48,0x23); - SiS_SetReg1(SiS_Pr->SiS_P3d4,0x49,SiS_Pr->SiS_CR49[0]); - /* SiS_SetReg1(SiS_Pr->SiS_P3c4,0x25,SiS_Pr->SiS_SR25[0]); */ + 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( ((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]; + } + break; + case 640: + if(VDisplay == 480) ModeIndex = ModeIndex_640x480[Depth]; + else if(VDisplay == 400) ModeIndex = ModeIndex_640x400[Depth]; + break; + case 720: + if((!(VBFlags & TV_HIVISION)) && (!((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR1080I)))) { + if(VDisplay == 480) { + if((VBFlags & TV_YPBPR) || (VBFlags & (TV_NTSC | TV_PALM))) + ModeIndex = ModeIndex_720x480[Depth]; + } else if(VDisplay == 576) { + if((!(VBFlags & (TV_YPBPR | TV_PALM))) && (VBFlags & TV_PAL)) + ModeIndex = ModeIndex_720x576[Depth]; + } + } + break; + case 768: + if((!(VBFlags & TV_HIVISION)) && (!((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR1080I)))) { + if((!(VBFlags & (TV_YPBPR | TV_PALM))) && (VBFlags & TV_PAL)) { + 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))) { + ModeIndex = ModeIndex_800x480[Depth]; + } + } + break; + case 1024: + if(VDisplay == 768) { + if(VBFlags & (VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV|VB_302ELV)) { + ModeIndex = ModeIndex_1024x768[Depth]; + } + } else if(VDisplay == 576) { + if((VBFlags & TV_HIVISION) || ((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR1080I))) { + ModeIndex = ModeIndex_1024x576[Depth]; + } + } + break; + case 1280: + if(VDisplay == 720) { + if((VBFlags & TV_HIVISION) || + ((VBFlags & TV_YPBPR) && (VBFlags & (TV_YPBPR1080I | TV_YPBPR750P)))) { + ModeIndex = ModeIndex_1280x720[Depth]; + } + } else if(VDisplay == 1024) { + if((VBFlags & TV_HIVISION) || + ((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR1080I))) { + ModeIndex = ModeIndex_1280x1024[Depth]; + } + } + break; + } } -#endif + return ModeIndex; +} - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1F,*SiS_Pr->pSiS_SR1F); /* DAC pedestal */ - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x20,0xA0); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x23,*SiS_Pr->pSiS_SR23); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x24,*SiS_Pr->pSiS_SR24); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x25,SiS_Pr->SiS_SR25[0]); +USHORT +SiS_GetModeID_VGA2(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int Depth) +{ + USHORT ModeIndex = 0; -#ifdef SIS300 - if(HwDeviceExtension->jChipType == SIS_300) { - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x21,0x84); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x22,0x00); - } -#endif - - SR11 = 0x0F; - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x11,SR11); /* Power Management & DDC port */ - - SiS_UnLockCRT2(SiS_Pr, HwDeviceExtension, BaseAddr); - SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x00,0x00); - SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x02,*SiS_Pr->pSiS_CRT2Data_1_2); - -#ifdef SIS315H - if((HwDeviceExtension->jChipType == SIS_315H) || - (HwDeviceExtension->jChipType == SIS_315) || - (HwDeviceExtension->jChipType == SIS_315PRO) || - (HwDeviceExtension->jChipType == SIS_550) || - (HwDeviceExtension->jChipType == SIS_650) || - (HwDeviceExtension->jChipType == SIS_740) || - (HwDeviceExtension->jChipType == SIS_330)) - SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x2E,0x08); /* use VB */ -#endif - - temp = *SiS_Pr->pSiS_SR32; - if(SiS_BridgeIsOn(SiS_Pr, BaseAddr)) { - temp &= 0xEF; - } - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x32,temp); - -#ifdef SIS315H - if((HwDeviceExtension->jChipType == SIS_315H) || - (HwDeviceExtension->jChipType == SIS_315) || - (HwDeviceExtension->jChipType == SIS_315PRO) || - (HwDeviceExtension->jChipType == SIS_330)) { - HwDeviceExtension->pQueryVGAConfigSpace(HwDeviceExtension,0x50,0,&Temp); - Temp >>= 20; - Temp &= 0xF; - if (Temp != 1) { - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x25,SiS_Pr->SiS_SR25[1]); - SiS_SetReg1(SiS_Pr->SiS_P3d4,0x49,SiS_Pr->SiS_CR49[1]); - } - - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x27,0x1F); - - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x31,*SiS_Pr->pSiS_SR31); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x32,*SiS_Pr->pSiS_SR32); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x33,*SiS_Pr->pSiS_SR33); - } -#endif - - if (SiS_BridgeIsOn(SiS_Pr, BaseAddr) == 0) { - if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { - SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x00,0x1C); - SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x0D,*SiS_Pr->pSiS_CRT2Data_4_D); - SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x0E,*SiS_Pr->pSiS_CRT2Data_4_E); - SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x10,*SiS_Pr->pSiS_CRT2Data_4_10); - SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x0F,0x3F); - } - SiS_LockCRT2(SiS_Pr, HwDeviceExtension, BaseAddr); - } - SiS_SetReg1(SiS_Pr->SiS_P3d4,0x83,0x00); + if(!(VBFlags & (VB_301|VB_301B|VB_301C|VB_302B))) return 0; -#ifdef SIS315H - if((HwDeviceExtension->jChipType == SIS_315H) || - (HwDeviceExtension->jChipType == SIS_315) || - (HwDeviceExtension->jChipType == SIS_315PRO) || - (HwDeviceExtension->jChipType == SIS_330)) { - if(HwDeviceExtension->bSkipDramSizing==TRUE) { - SiS_SetDRAMModeRegister(SiS_Pr, ROMAddr,HwDeviceExtension); - pSR = HwDeviceExtension->pSR; - if(pSR != NULL) { - while(pSR->jIdx != 0xFF) { - SiS_SetReg1(SiS_Pr->SiS_P3c4,pSR->jIdx,pSR->jVal); - pSR++; - } - } - } else SiS_SetDRAMSize_310(SiS_Pr, HwDeviceExtension); - } -#endif - -#ifdef SIS315H - if(HwDeviceExtension->jChipType == SIS_550) { - /* SetDRAMConfig begin */ -/* SiS_SetReg1(SiS_Pr->SiS_P3c4,0x12,SR12); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,SR13); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,SR14); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,SR16); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x17,SR17); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x18,SR18); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x19,SR19); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1A,SR1A); */ - /* SetDRAMConfig end */ - } -#endif - -#ifdef SIS300 - if(HwDeviceExtension->jChipType == SIS_300) { - if (HwDeviceExtension->bSkipDramSizing == TRUE) { -/* SiS_SetDRAMModeRegister(ROMAddr,HwDeviceExtension); - temp = (HwDeviceExtension->pSR)->jVal; - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,temp); - temp = (HwDeviceExtension->pSR)->jVal; - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,temp); */ - } else { -#ifdef TC - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,SR13); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,SR14); - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x15,0xFF,0x04); -#else - SiS_SetDRAMSize_300(SiS_Pr, HwDeviceExtension); - SiS_SetDRAMSize_300(SiS_Pr, HwDeviceExtension); -#endif - } - } - if((HwDeviceExtension->jChipType==SIS_540)|| - (HwDeviceExtension->jChipType==SIS_630)|| - (HwDeviceExtension->jChipType==SIS_730)) { -#if 0 - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x12,SR12); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,SR13); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,SR14); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,SR16); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x17,SR17); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x18,SR18); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x19,SR19); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1A,SR1A); -#endif + 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 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]; + } + } + break; + case 1680: + if(VGAEngine == SIS_315_VGA) { + if(VBFlags & (VB_301B|VB_301C|VB_302B)) { + if(VDisplay == 1050) ModeIndex = ModeIndex_1680x1050[Depth]; + } + } + break; } -/* SetDRAMSize end */ -#endif /* SIS300 */ - /* Set default Ext2Regs */ -#if 0 - AGP=1; - temp=(UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x3A); - temp &= 0x30; - if(temp == 0x30) AGP=0; - if(AGP == 0) *SiS_Pr->pSiS_SR21 &= 0xEF; - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x21,*SiS_Pr->pSiS_SR21); - if(AGP == 1) *SiS_Pr->pSiS_SR22 &= 0x20; - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x22,*SiS_Pr->pSiS_SR22); -#endif - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x21,*SiS_Pr->pSiS_SR21); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x22,*SiS_Pr->pSiS_SR22); + return ModeIndex; +} -#if 0 - SiS_SetReg3(SiS_Pr->SiS_P3c6,0xff); - SiS_ClearDAC(SiS_Pr, SiS_Pr->SiS_P3c8); -#endif -#ifdef LINUXBIOS /* TW: This is not needed for our purposes */ - SiS_DetectMonitor(SiS_Pr, HwDeviceExtension,BaseAddr); /* Sense CRT1 */ - SiS_GetSenseStatus(SiS_Pr, HwDeviceExtension,ROMAddr); /* Sense CRT2 */ -#endif +/*********************************************/ +/* HELPER: SetReg, GetReg */ +/*********************************************/ - return(TRUE); +void +SiS_SetReg(SISIOADDRESS port, USHORT index, USHORT data) +{ + OutPortByte(port,index); + OutPortByte(port + 1,data); } void -SiS_Set_LVDS_TRUMPION(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension) +SiS_SetRegByte(SISIOADDRESS port, USHORT data) { - USHORT temp = 0; - -#ifdef SiS300 - if((HwDeviceExtension->jChipType == SIS_540) || - (HwDeviceExtension->jChipType == SIS_630) || - (HwDeviceExtension->jChipType == SIS_730)) { - /* TW: Read POWER_ON_TRAP and copy to CR37 */ - temp = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1A); - temp = (temp & 0xE0) >> 4; - SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x37,0xF1,temp); - } -#endif -#ifdef SIS315H - if((HwDeviceExtension->jChipType == SIS_650) || - (HwDeviceExtension->jChipType == SIS_740) || - (HwDeviceExtension->jChipType == SIS_330)) { -#if 0 /* TW: This is not required */ - /* TW: Read POWER_ON_TRAP and copy to CR37 */ - temp = (UCHAR)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1A); - temp = (temp & 0xE0) >> 4; - SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x37,0xF1,temp); -#endif - } -#endif - - SiSSetLVDSetc(SiS_Pr, HwDeviceExtension, 0); + OutPortByte(port,data); } -/* =============== SiS 300 dram sizing begin =============== */ -#ifdef SIS300 void -SiS_SetDRAMSize_300(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension) +SiS_SetRegShort(SISIOADDRESS port, USHORT data) { - ULONG FBAddr = (ULONG)HwDeviceExtension->pjVideoMemoryAddress; - USHORT SR13, SR14=0, buswidth, Done; - SHORT i, j, k; - USHORT data, TotalCapacity, PhysicalAdrOtherPage=0; - ULONG Addr; - UCHAR temp; - int PseudoRankCapacity, PseudoTotalCapacity, PseudoAdrPinCount; - int RankCapacity, AdrPinCount, BankNumHigh, BankNumMid, MB2Bank; - int PageCapacity, PhysicalAdrHigh, PhysicalAdrHalfPage; - - SiSSetMode(SiS_Pr, HwDeviceExtension, 0x2e); - - SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x01,0x20); /* Turn OFF Display */ - - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,0x00); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,0xBF); - - buswidth = SiS_ChkBUSWidth_300(SiS_Pr, FBAddr); - - MB2Bank = 16; - Done = 0; - for(i=6; i>=0; i--) { - if(Done == 1) break; - PseudoRankCapacity = 1 << i; - for(j=4; j>=1; j--) { - if(Done == 1) break; - PseudoTotalCapacity = PseudoRankCapacity * j; - PseudoAdrPinCount = 15 - j; - if(PseudoTotalCapacity <= 64) { - for(k=0; k<=16; k++) { - if(Done == 1) break; - RankCapacity = buswidth * SiS_DRAMType[k][3]; - AdrPinCount = SiS_DRAMType[k][2] + SiS_DRAMType[k][0]; - if(RankCapacity == PseudoRankCapacity) - if(AdrPinCount <= PseudoAdrPinCount) { - if(j == 3) { /* Rank No */ - BankNumHigh = RankCapacity * MB2Bank * 3 - 1; - BankNumMid = RankCapacity * MB2Bank * 1 - 1; - } else { - BankNumHigh = RankCapacity * MB2Bank * j - 1; - BankNumMid = RankCapacity * MB2Bank * j / 2 - 1; - } - PageCapacity = (1 << SiS_DRAMType[k][1]) * buswidth * 4; - PhysicalAdrHigh = BankNumHigh; - PhysicalAdrHalfPage = (PageCapacity / 2 + PhysicalAdrHigh) % PageCapacity; - PhysicalAdrOtherPage = PageCapacity * SiS_DRAMType[k][2] + PhysicalAdrHigh; - /* Write data */ - /*Test*/ - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x15,0xFB); - SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x15,0x04); - /*/Test*/ - TotalCapacity = SiS_DRAMType[k][3] * buswidth; - SR13 = SiS_DRAMType[k][4]; - if(buswidth == 4) SR14 = (TotalCapacity - 1) | 0x80; - if(buswidth == 2) SR14 = (TotalCapacity - 1) | 0x40; - if(buswidth == 1) SR14 = (TotalCapacity - 1) | 0x00; - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,SR13); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,SR14); - - Addr = FBAddr + (BankNumHigh) * 64 * 1024 + PhysicalAdrHigh; - *((USHORT *)(Addr)) = (USHORT)PhysicalAdrHigh; - Addr = FBAddr + (BankNumMid) * 64 * 1024 + PhysicalAdrHigh; - *((USHORT *)(Addr)) = (USHORT)BankNumMid; - Addr = FBAddr + (BankNumHigh) * 64 * 1024 + PhysicalAdrHalfPage; - *((USHORT *)(Addr)) = (USHORT)PhysicalAdrHalfPage; - Addr = FBAddr + (BankNumHigh) * 64 * 1024 + PhysicalAdrOtherPage; - *((USHORT *)(Addr)) = PhysicalAdrOtherPage; - - /* Read data */ - Addr = FBAddr + (BankNumHigh) * 64 * 1024 + PhysicalAdrHigh; - data = *((USHORT *)(Addr)); - if(data == PhysicalAdrHigh) Done = 1; - } /* if struct */ - } /* for loop (k) */ - } /* if struct */ - } /* for loop (j) */ - } /* for loop (i) */ + OutPortWord(port,data); } -USHORT -SiS_ChkBUSWidth_300(SiS_Private *SiS_Pr, ULONG FBAddress) +void +SiS_SetRegLong(SISIOADDRESS port, ULONG data) { - PULONG pVideoMemory; - - pVideoMemory = (PULONG)FBAddress; + OutPortLong(port,data); +} - pVideoMemory[0] = 0x01234567L; - pVideoMemory[1] = 0x456789ABL; - pVideoMemory[2] = 0x89ABCDEFL; - pVideoMemory[3] = 0xCDEF0123L; - if (pVideoMemory[3]==0xCDEF0123L) { /* Channel A 128bit */ - return(4); - } - if (pVideoMemory[1]==0x456789ABL) { /* Channel B 64bit */ - return(2); - } - return(1); +UCHAR +SiS_GetReg(SISIOADDRESS port, USHORT index) +{ + OutPortByte(port,index); + return(InPortByte(port + 1)); } -#endif -/* =============== SiS 300 dram sizing end =============== */ -/* ============ SiS 310/325 dram sizing begin ============== */ -#ifdef SIS315H +UCHAR +SiS_GetRegByte(SISIOADDRESS port) +{ + return(InPortByte(port)); +} -/* TW: Moved Get310DRAMType further down */ +USHORT +SiS_GetRegShort(SISIOADDRESS port) +{ + return(InPortWord(port)); +} -void -SiS_Delay15us(SiS_Private *SiS_Pr, ULONG ulMicrsoSec) +ULONG +SiS_GetRegLong(SISIOADDRESS port) { + return(InPortLong(port)); } void -SiS_SDR_MRS(SiS_Private *SiS_Pr, ) +SiS_SetRegANDOR(SISIOADDRESS Port,USHORT Index,USHORT DataAND,USHORT DataOR) { - USHORT data; + USHORT temp; - data = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16); - data &= 0x3F; /* SR16 D7=0, D6=0 */ - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,data); /* enable mode register set(MRS) low */ - SiS_Delay15us(SiS_Pr, 0x100); - data |= 0x80; /* SR16 D7=1, D6=0 */ - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,data); /* enable mode register set(MRS) high */ - SiS_Delay15us(SiS_Pr, 0x100); + temp = SiS_GetReg(Port,Index); + temp = (temp & (DataAND)) | DataOR; + SiS_SetReg(Port,Index,temp); } void -SiS_DDR_MRS(SiS_Private *SiS_Pr) +SiS_SetRegAND(SISIOADDRESS Port,USHORT Index,USHORT DataAND) { - USHORT data; - - /* SR16 <- 1F,DF,2F,AF */ - - /* enable DLL of DDR SD/SGRAM , SR16 D4=1 */ - data=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16); - data &= 0x0F; - data |= 0x10; - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,data); - - if (!(SiS_Pr->SiS_SR15[1][SiS_Pr->SiS_RAMType] & 0x10)) - data &= 0x0F; + USHORT temp; - /* SR16 D7=1,D6=1 */ - data |= 0xC0; - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,data); - - /* SR16 D7=1,D6=0,D5=1,D4=0 */ - data &= 0x0F; - data |= 0x20; - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,data); - if (!(SiS_Pr->SiS_SR15[1][SiS_Pr->SiS_RAMType] & 0x10)) - data &= 0x0F; - - /* SR16 D7=1 */ - data |= 0x80; - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,data); + temp = SiS_GetReg(Port,Index); + temp &= DataAND; + SiS_SetReg(Port,Index,temp); } void -SiS_SetDRAMModeRegister(SiS_Private *SiS_Pr, UCHAR *ROMAddr, PSIS_HW_DEVICE_INFO HwDeviceExtension) +SiS_SetRegOR(SISIOADDRESS Port,USHORT Index,USHORT DataOR) { - if (SiS_Get310DRAMType(ROMAddr,HwDeviceExtension) < 2) - SiS_SDR_MRS(SiS_Pr); - else - /* SR16 <- 0F,CF,0F,8F */ - SiS_DDR_MRS(SiS_Pr); + USHORT temp; + + temp = SiS_GetReg(Port,Index); + temp |= DataOR; + SiS_SetReg(Port,Index,temp); } +/*********************************************/ +/* HELPER: DisplayOn, DisplayOff */ +/*********************************************/ + void -SiS_DisableRefresh(SiS_Private *SiS_Pr) +SiS_DisplayOn(SiS_Private *SiS_Pr) { - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x17,0xF8); - SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x19,0x03); + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x01,0xDF); } void -SiS_EnableRefresh(SiS_Private *SiS_Pr, UCHAR *ROMAddr) +SiS_DisplayOff(SiS_Private *SiS_Pr) { - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x17,SiS_Pr->SiS_SR15[2][SiS_Pr->SiS_RAMType]); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x19,SiS_Pr->SiS_SR15[4][SiS_Pr->SiS_RAMType]); + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x01,0x20); } + +/*********************************************/ +/* HELPER: Init Port Addresses */ +/*********************************************/ + void -SiS_DisableChannelInterleaving(SiS_Private *SiS_Pr, int index, - USHORT SiS_DDRDRAM_TYPE[][5]) +SiSRegInit(SiS_Private *SiS_Pr, SISIOADDRESS BaseAddr) { - USHORT data; + SiS_Pr->SiS_P3c4 = BaseAddr + 0x14; + SiS_Pr->SiS_P3d4 = BaseAddr + 0x24; + SiS_Pr->SiS_P3c0 = BaseAddr + 0x10; + SiS_Pr->SiS_P3ce = BaseAddr + 0x1e; + SiS_Pr->SiS_P3c2 = BaseAddr + 0x12; + SiS_Pr->SiS_P3ca = BaseAddr + 0x1a; + SiS_Pr->SiS_P3c6 = BaseAddr + 0x16; + SiS_Pr->SiS_P3c7 = BaseAddr + 0x17; + SiS_Pr->SiS_P3c8 = BaseAddr + 0x18; + SiS_Pr->SiS_P3c9 = BaseAddr + 0x19; + SiS_Pr->SiS_P3cb = BaseAddr + 0x1b; + 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; +} + +/*********************************************/ +/* HELPER: GetSysFlags */ +/*********************************************/ - data=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x15); - data &= 0x1F; - switch (SiS_DDRDRAM_TYPE[index][3]) - { - case 64: data |= 0; break; - case 32: data |= 0x20; break; - case 16: data |= 0x40; break; - case 4: data |= 0x60; break; +static void +SiS_GetSysFlags(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) +{ + unsigned char cr5f, temp1, temp2; + + /* 661 and newer: NEVER write non-zero to SR11[7:4] */ + /* (SR11 is used for DDC and in enable/disablebridge) */ + SiS_Pr->SiS_SensibleSR11 = FALSE; + SiS_Pr->SiS_MyCR63 = 0x63; + if(HwInfo->jChipType >= SIS_661) { + SiS_Pr->SiS_SensibleSR11 = TRUE; + SiS_Pr->SiS_MyCR63 = 0x53; + } + + /* You should use the macros, not these flags directly */ + + SiS_Pr->SiS_SysFlags = 0; + if(HwInfo->jChipType == 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) { + case 0x80: + case 0x90: + case 0xc0: + SiS_Pr->SiS_SysFlags |= SF_IsM650; break; + case 0xa0: + case 0xb0: + case 0xe0: + SiS_Pr->SiS_SysFlags |= SF_Is651; break; + } + } else { + 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 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; + default: + 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_760UMA; } - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x15,data); } -void -SiS_SetDRAMSizingType(SiS_Private *SiS_Pr, int index, USHORT DRAMTYPE_TABLE[][5]) +/*********************************************/ +/* HELPER: Init PCI & Engines */ +/*********************************************/ + +static void +SiSInitPCIetc(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) { - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,DRAMTYPE_TABLE[index][4]); - /* should delay 50 ns */ + switch(HwInfo->jChipType) { + 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) + */ + SiS_SetReg(SiS_Pr->SiS_P3c4,0x20,0xa1); + /* - Enable 2D (0x40) + * - Enable 3D (0x02) + * - Enable 3D Vertex command fetch (0x10) ? + * - Enable 3D command parser (0x08) ? + */ + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x5A); + break; + case SIS_315H: + case SIS_315: + case SIS_315PRO: + case SIS_650: + case SIS_740: + case SIS_330: + case SIS_661: + case SIS_741: + case SIS_660: + case SIS_760: + SiS_SetReg(SiS_Pr->SiS_P3c4,0x20,0xa1); + /* - Enable 2D (0x40) + * - Enable 3D (0x02) + * - Enable 3D vertex command fetch (0x10) + * - Enable 3D command parser (0x08) + * - Enable 3D G/L transformation engine (0x80) + */ + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0xDA); + break; + case SIS_550: + SiS_SetReg(SiS_Pr->SiS_P3c4,0x20,0xa1); + /* No 3D engine ! */ + /* - Enable 2D (0x40) + */ + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x40); + } } +/*********************************************/ +/* HELPER: SetLVDSetc */ +/*********************************************/ + void -SiS_CheckBusWidth_310(SiS_Private *SiS_Pr, UCHAR *ROMAddress,ULONG FBAddress, - PSIS_HW_DEVICE_INFO HwDeviceExtension) +SiSSetLVDSetc(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) { - USHORT data, temp; - PULONG volatile pVideoMemory; + ULONG temp; - pVideoMemory = (PULONG)FBAddress; + 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; - if(HwDeviceExtension->jChipType == SIS_330) temp = 1; - else temp = 2; + SiS_Pr->SiS_ChrontelInit = 0; - if(SiS_Get310DRAMType(ROMAddress,HwDeviceExtension) < temp) { + /* Check for SiS30x first */ + temp = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x00); + if((temp == 1) || (temp == 2)) return; - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,0x00); - if(HwDeviceExtension->jChipType != SIS_330) { - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,0x12); - } else { - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,0x02); - } - /* should delay */ - SiS_SDR_MRS(SiS_Pr); + switch(HwInfo->jChipType) { +#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)) { + /* 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 + case SIS_550: + 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; + case SIS_661: + case SIS_741: + case SIS_660: + case SIS_760: + 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; +#endif + default: + break; + } +} - SiS_Pr->SiS_ChannelAB = 0; - SiS_Pr->SiS_DataBusWidth = 128; - pVideoMemory[0] = 0x01234567L; - pVideoMemory[1] = 0x456789ABL; - pVideoMemory[2] = 0x89ABCDEFL; - pVideoMemory[3] = 0xCDEF0123L; - pVideoMemory[4] = 0x55555555L; - pVideoMemory[5] = 0x55555555L; - pVideoMemory[6] = 0xFFFFFFFFL; - pVideoMemory[7] = 0xFFFFFFFFL; - if((pVideoMemory[3] != 0xCDEF0123L) || (pVideoMemory[2] != 0x89ABCDEFL)) { - /* Channel A 64Bit */ - SiS_Pr->SiS_DataBusWidth = 64; - SiS_Pr->SiS_ChannelAB = 0; - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x14, 0xFD); - } - if((pVideoMemory[1] != 0x456789ABL) || (pVideoMemory[0] != 0x01234567L)) { - /* Channel B 64Bit */ - SiS_Pr->SiS_DataBusWidth = 64; - SiS_Pr->SiS_ChannelAB = 1; - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x14,0xfd,0x01); - } - return; +/*********************************************/ +/* HELPER: Enable DSTN/FSTN */ +/*********************************************/ - } else { +void +SiS_SetEnableDstn(SiS_Private *SiS_Pr, int enable) +{ + SiS_Pr->SiS_IF_DEF_DSTN = enable ? 1 : 0; +} - /* DDR Dual channel */ - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x13,0x00); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,0x02); /* Channel A, 64bit */ - /* should delay */ - SiS_DDR_MRS(SiS_Pr); - - SiS_Pr->SiS_ChannelAB = 0; - SiS_Pr->SiS_DataBusWidth = 64; - pVideoMemory[0] = 0x01234567L; - pVideoMemory[1] = 0x456789ABL; - pVideoMemory[2] = 0x89ABCDEFL; - pVideoMemory[3] = 0xCDEF0123L; - pVideoMemory[4] = 0x55555555L; - pVideoMemory[5] = 0x55555555L; - pVideoMemory[6] = 0xAAAAAAAAL; - pVideoMemory[7] = 0xAAAAAAAAL; - - if (pVideoMemory[1] == 0x456789ABL) { - if (pVideoMemory[0] == 0x01234567L) { - /* Channel A 64bit */ - return; - } - } else { - if (pVideoMemory[0] == 0x01234567L) { - /* Channel A 32bit */ - SiS_Pr->SiS_DataBusWidth = 32; - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,0x00); - return; - } - } +void +SiS_SetEnableFstn(SiS_Private *SiS_Pr, int enable) +{ + SiS_Pr->SiS_IF_DEF_FSTN = enable ? 1 : 0; +} - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,0x03); /* Channel B, 64bit */ - SiS_DDR_MRS(SiS_Pr); +/*********************************************/ +/* HELPER: Determine ROM usage */ +/*********************************************/ - SiS_Pr->SiS_ChannelAB = 1; - SiS_Pr->SiS_DataBusWidth = 64; - pVideoMemory[0] = 0x01234567L; - pVideoMemory[1] = 0x456789ABL; - pVideoMemory[2] = 0x89ABCDEFL; - pVideoMemory[3] = 0xCDEF0123L; - pVideoMemory[4] = 0x55555555L; - pVideoMemory[5] = 0x55555555L; - pVideoMemory[6] = 0xAAAAAAAAL; - pVideoMemory[7] = 0xAAAAAAAAL; - if(pVideoMemory[1] == 0x456789ABL) { - /* Channel B 64 */ - if(pVideoMemory[0] == 0x01234567L) { - /* Channel B 64bit */ - return; - } else { - /* error */ - } - } else { - if(pVideoMemory[0] == 0x01234567L) { - /* Channel B 32 */ - SiS_Pr->SiS_DataBusWidth = 32; - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,0x01); - } else { - /* error */ - } - } +BOOLEAN +SiSDetermineROMLayout661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) +{ + UCHAR *ROMAddr = HwInfo->pjVirtualRomBase; + USHORT romversoffs, romvmaj = 1, romvmin = 0; + + if(HwInfo->jChipType >= SIS_661) { + romversoffs = ROMAddr[0x16] | (ROMAddr[0x17] << 8); + if(romversoffs) { + if((ROMAddr[romversoffs+1] == '.') || (ROMAddr[romversoffs+4] == '.')) { + romvmaj = ROMAddr[romversoffs] - '0'; + romvmin = ((ROMAddr[romversoffs+2] -'0') * 10) + (ROMAddr[romversoffs+3] - '0'); + } + } + if((romvmaj != 0) || (romvmin >= 92)) { + return TRUE; + } + } else if(IS_SIS650740) { + if((ROMAddr[0x1a] == 'N') && + (ROMAddr[0x1b] == 'e') && + (ROMAddr[0x1c] == 'w') && + (ROMAddr[0x1d] == 'V')) { + return TRUE; + } } + return FALSE; } -int -SiS_SetRank(SiS_Private *SiS_Pr, int index,UCHAR RankNo,USHORT DRAMTYPE_TABLE[][5]) +static void +SiSDetermineROMUsage(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) { - USHORT data; - int RankSize; + UCHAR *ROMAddr = HwInfo->pjVirtualRomBase; + USHORT romptr = 0; - if ((RankNo==2)&&(DRAMTYPE_TABLE[index][0]==2)) - return 0; + SiS_Pr->SiS_UseROM = FALSE; + SiS_Pr->SiS_ROMNew = FALSE; - RankSize = DRAMTYPE_TABLE[index][3]/2 * SiS_Pr->SiS_DataBusWidth / 32; - - if (RankNo * RankSize <= 128) { - data = 0; - while((RankSize >>= 1) > 0) { - data += 0x10; - } - data |= (RankNo - 1) << 2; - data |= (SiS_Pr->SiS_DataBusWidth / 64) & 2; - data |= SiS_Pr->SiS_ChannelAB; - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,data); - /* should delay */ - SiS_SDR_MRS(SiS_Pr); - return 1; - } else - return 0; + if((ROMAddr) && (HwInfo->UseROM)) { + if(HwInfo->jChipType == 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) { + /* 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 */ + SiS_Pr->SiS_UseROM = TRUE; + if((SiS_Pr->SiS_ROMNew = SiSDetermineROMLayout661(SiS_Pr, HwInfo))) { + /* Find out about LCD data table entry size */ + if((romptr = SISGETROMW(0x0102))) { + if(ROMAddr[romptr + (32 * 16)] == 0xff) + SiS_Pr->SiS661LCD2TableSize = 32; + else if(ROMAddr[romptr + (34 * 16)] == 0xff) + SiS_Pr->SiS661LCD2TableSize = 34; + else if(ROMAddr[romptr + (36 * 16)] == 0xff) + SiS_Pr->SiS661LCD2TableSize = 36; + } + } + } + } } -int -SiS_SetDDRChannel(SiS_Private *SiS_Pr, int index,UCHAR ChannelNo, - USHORT DRAMTYPE_TABLE[][5]) +/*********************************************/ +/* HELPER: SET SEGMENT REGISTERS */ +/*********************************************/ + +static void +SiS_SetSegRegLower(SiS_Private *SiS_Pr, USHORT value) { - USHORT data; - int RankSize; + USHORT temp; - RankSize = DRAMTYPE_TABLE[index][3]/2 * SiS_Pr->SiS_DataBusWidth / 32; - /* RankSize = DRAMTYPE_TABLE[index][3]; */ - if (ChannelNo * RankSize <= 128) { - data = 0; - while((RankSize >>= 1) > 0) { - data += 0x10; - } - if(ChannelNo == 2) data |= 0x0C; - data |= (SiS_Pr->SiS_DataBusWidth / 32) & 2; - data |= SiS_Pr->SiS_ChannelAB; - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,data); - /* should delay */ - SiS_DDR_MRS(SiS_Pr); - return 1; - } else - return 0; + value &= 0x00ff; + temp = SiS_GetRegByte(SiS_Pr->SiS_P3cb) & 0xf0; + temp |= (value >> 4); + SiS_SetRegByte(SiS_Pr->SiS_P3cb, temp); + temp = SiS_GetRegByte(SiS_Pr->SiS_P3cd) & 0xf0; + temp |= (value & 0x0f); + SiS_SetRegByte(SiS_Pr->SiS_P3cd, temp); } -int -SiS_CheckColumn(SiS_Private *SiS_Pr, int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress) +static void +SiS_SetSegRegUpper(SiS_Private *SiS_Pr, USHORT value) { - int i; - ULONG Increment,Position; - - /*Increment = 1<<(DRAMTYPE_TABLE[index][2] + SiS_Pr->SiS_DataBusWidth / 64 + 1); */ - Increment = 1 << (10 + SiS_Pr->SiS_DataBusWidth / 64); + USHORT temp; - for (i=0,Position=0;i<2;i++) { - *((PULONG)(FBAddress + Position)) = Position; - Position += Increment; - } - - for (i=0,Position=0;i<2;i++) { -/* if (FBAddress[Position]!=Position) */ - if((*(PULONG)(FBAddress + Position)) != Position) - return 0; - Position += Increment; - } - return 1; + value &= 0x00ff; + temp = SiS_GetRegByte(SiS_Pr->SiS_P3cb) & 0x0f; + temp |= (value & 0xf0); + SiS_SetRegByte(SiS_Pr->SiS_P3cb, temp); + temp = SiS_GetRegByte(SiS_Pr->SiS_P3cd) & 0x0f; + temp |= (value << 4); + SiS_SetRegByte(SiS_Pr->SiS_P3cd, temp); } -int -SiS_CheckBanks(SiS_Private *SiS_Pr, int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress) +static void +SiS_SetSegmentReg(SiS_Private *SiS_Pr, USHORT value) { - int i; - ULONG Increment,Position; - Increment = 1 << (DRAMTYPE_TABLE[index][2] + SiS_Pr->SiS_DataBusWidth / 64 + 2); - - for (i=0,Position=0;i<4;i++) { -/* FBAddress[Position]=Position; */ - *((PULONG)(FBAddress + Position)) = Position; - Position += Increment; - } - - for (i=0,Position=0;i<4;i++) { -/* if (FBAddress[Position]!=Position) */ - if((*(PULONG)(FBAddress + Position)) != Position) - return 0; - Position += Increment; - } - return 1; + SiS_SetSegRegLower(SiS_Pr, value); + SiS_SetSegRegUpper(SiS_Pr, value); } -int -SiS_CheckRank(SiS_Private *SiS_Pr, int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress) +static void +SiS_ResetSegmentReg(SiS_Private *SiS_Pr) { - int i; - ULONG Increment,Position; - Increment = 1<<(DRAMTYPE_TABLE[index][2] + DRAMTYPE_TABLE[index][1] + - DRAMTYPE_TABLE[index][0] + SiS_Pr->SiS_DataBusWidth / 64 + RankNo); - - for (i=0,Position=0;i<2;i++) { -/* FBAddress[Position]=Position; */ - *((PULONG)(FBAddress+Position))=Position; - /* *((PULONG)(FBAddress))=Position; */ - Position += Increment; - } - - for (i=0,Position=0;i<2;i++) { -/* if (FBAddress[Position]!=Position) */ - if ( (*(PULONG) (FBAddress + Position)) !=Position) - /*if ( (*(PULONG) (FBAddress )) !=Position) */ - return 0; - Position += Increment; - } - return 1; + SiS_SetSegmentReg(SiS_Pr, 0); } -int -SiS_CheckDDRRank(SiS_Private *SiS_Pr, int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress) +static void +SiS_SetSegmentRegOver(SiS_Private *SiS_Pr, USHORT value) { - ULONG Increment,Position; - USHORT data; - - Increment = 1<<(DRAMTYPE_TABLE[index][2] + DRAMTYPE_TABLE[index][1] + - DRAMTYPE_TABLE[index][0] + SiS_Pr->SiS_DataBusWidth / 64 + RankNo); + USHORT temp = value >> 8; - Increment += Increment/2; - - Position =0; - *((PULONG)(FBAddress+Position + 0)) = 0x01234567; - *((PULONG)(FBAddress+Position + 1)) = 0x456789AB; - *((PULONG)(FBAddress+Position + 2)) = 0x55555555; - *((PULONG)(FBAddress+Position + 3)) = 0x55555555; - *((PULONG)(FBAddress+Position + 4)) = 0xAAAAAAAA; - *((PULONG)(FBAddress+Position + 5)) = 0xAAAAAAAA; - - if ( (*(PULONG) (FBAddress + 1)) == 0x456789AB) - return 1; - - if ( (*(PULONG) (FBAddress + 0)) == 0x01234567) - return 0; - - data=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14); - data &= 0xF3; - data |= 0x08; - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x14,data); - data=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x15); - data += 0x20; - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x15,data); - - return 1; + temp &= 0x07; + temp |= (temp << 4); + SiS_SetReg(SiS_Pr->SiS_P3c4,0x1d,temp); + SiS_SetSegmentReg(SiS_Pr, value); } -int -SiS_CheckRanks(SiS_Private *SiS_Pr, int RankNo,int index,USHORT DRAMTYPE_TABLE[][5],ULONG FBAddress) +static void +SiS_ResetSegmentRegOver(SiS_Private *SiS_Pr) { - int r; - - for (r=RankNo;r>=1;r--) { - if (!SiS_CheckRank(SiS_Pr, r, index, DRAMTYPE_TABLE, FBAddress)) - return 0; - } - if (!SiS_CheckBanks(SiS_Pr, index, DRAMTYPE_TABLE, FBAddress)) - return 0; - - if (!SiS_CheckColumn(SiS_Pr, index, DRAMTYPE_TABLE, FBAddress)) - return 0; + SiS_SetSegmentRegOver(SiS_Pr, 0); +} - return 1; +static void +SiS_ResetSegmentRegisters(SiS_Private *SiS_Pr,PSIS_HW_INFO HwInfo) +{ + if((IS_SIS65x) || (HwInfo->jChipType >= SIS_661)) { + SiS_ResetSegmentReg(SiS_Pr); + SiS_ResetSegmentRegOver(SiS_Pr); + } } -int -SiS_CheckDDRRanks(SiS_Private *SiS_Pr, int RankNo,int index,USHORT DRAMTYPE_TABLE[][5], - ULONG FBAddress) +/*********************************************/ +/* HELPER: GetVBType */ +/*********************************************/ + +void +SiS_GetVBType(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) { - int r; + USHORT flag=0, rev=0, nolcd=0; - for (r=RankNo;r>=1;r--) { - if (!SiS_CheckDDRRank(SiS_Pr, r,index,DRAMTYPE_TABLE,FBAddress)) - return 0; - } - if (!SiS_CheckBanks(SiS_Pr, index,DRAMTYPE_TABLE,FBAddress)) - return 0; + SiS_Pr->SiS_VBType = 0; - if (!SiS_CheckColumn(SiS_Pr, index,DRAMTYPE_TABLE,FBAddress)) - return 0; + if((SiS_Pr->SiS_IF_DEF_LVDS) || (SiS_Pr->SiS_IF_DEF_CONEX)) + return; - return 1; -} + flag = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x00); -int -SiS_SDRSizing(SiS_Private *SiS_Pr, ULONG FBAddress) -{ - int i; - UCHAR j; + if(flag > 3) return; - for (i=0;i<13;i++) { - SiS_SetDRAMSizingType(SiS_Pr, i, SiS_SDRDRAM_TYPE); - for (j=2;j>0;j--) { - if (!SiS_SetRank(SiS_Pr, i,(UCHAR) j, SiS_SDRDRAM_TYPE)) - continue; - else { - if (SiS_CheckRanks(SiS_Pr, j,i,SiS_SDRDRAM_TYPE, FBAddress)) - return 1; - } - } + 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_SIS302ELV; + } else if(rev >= 0xD0) { + SiS_Pr->SiS_VBType = VB_SIS301LV; + } } - return 0; } -int -SiS_DDRSizing(SiS_Private *SiS_Pr, ULONG FBAddress) -{ - - int i; - UCHAR j; - - for (i=0; i<4; i++){ - SiS_SetDRAMSizingType(SiS_Pr, i, SiS_DDRDRAM_TYPE); - SiS_DisableChannelInterleaving(SiS_Pr, i, SiS_DDRDRAM_TYPE); - for (j=2; j>0; j--) { - SiS_SetDDRChannel(SiS_Pr, i, j, SiS_DDRDRAM_TYPE); - if (!SiS_SetRank(SiS_Pr, i, (UCHAR) j, SiS_DDRDRAM_TYPE)) - continue; - else { - if (SiS_CheckDDRRanks(SiS_Pr, j, i, SiS_DDRDRAM_TYPE, FBAddress)) - return 1; - } - } - } - return 0; -} - -/* - check if read cache pointer is correct -*/ -void -SiS_VerifyMclk(SiS_Private *SiS_Pr, ULONG FBAddr) -{ - PUCHAR pVideoMemory = (PUCHAR) FBAddr; - UCHAR i, j; - USHORT Temp,SR21; - - pVideoMemory[0] = 0xaa; /* alan */ - pVideoMemory[16] = 0x55; /* note: PCI read cache is off */ - - if((pVideoMemory[0] != 0xaa) || (pVideoMemory[16] != 0x55)) { - for (i=0,j=16; i<2; i++,j+=16) { - SR21 = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x21); - Temp = SR21 & 0xFB; /* disable PCI post write buffer empty gating */ - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x21,Temp); - - Temp = SiS_GetReg1(SiS_Pr->SiS_P3c4, 0x3C); - Temp |= 0x01; /* MCLK reset */ - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x3C,Temp); - Temp = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x3C); - Temp &= 0xFE; /* MCLK normal operation */ - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x3C,Temp); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x21,SR21); - - pVideoMemory[16+j] = j; - if(pVideoMemory[16+j] == j) { - pVideoMemory[j] = j; - break; - } - } - } -} - -/* TW: Is this a 315E? */ -int -Is315E(SiS_Private *SiS_Pr) -{ - USHORT data; - - data = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x5F); - if(data & 0x10) return 1; - else return 0; -} +/*********************************************/ +/* HELPER: GetDRAMSize */ +/*********************************************/ -/* TW: For 315 only */ -void -SiS_SetDRAMSize_310(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension) +#ifndef LINUX_XF86 +static ULONG +GetDRAMSize(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) { - UCHAR *ROMAddr = HwDeviceExtension->pjVirtualRomBase; - ULONG FBAddr = (ULONG)HwDeviceExtension->pjVideoMemoryAddress; - USHORT data; - -#ifdef SIS301 /* TW: SIS301 ??? */ - /*SiS_SetReg1(SiS_Pr->SiS_P3d4,0x30,0x40); */ -#endif -#ifdef SIS302 /* TW: SIS302 ??? */ - SiS_SetReg1(SiS_Pr->SiS_P3d4,0x30,0x4D); /* alan,should change value */ - SiS_SetReg1(SiS_Pr->SiS_P3d4,0x31,0xc0); /* alan,should change value */ - SiS_SetReg1(SiS_Pr->SiS_P3d4,0x34,0x3F); /* alan,should change value */ + ULONG AdapterMemorySize = 0; +#ifdef SIS315H + USHORT counter; #endif - SiSSetMode(SiS_Pr, HwDeviceExtension, 0x2e); + switch(HwInfo->jChipType) { +#ifdef SIS315H + case SIS_315H: + case SIS_315: + case SIS_315PRO: + counter = SiS_GetReg(SiS_Pr->SiS_P3c4,0x14); + AdapterMemorySize = 1 << ((counter & 0xF0) >> 4); + counter >>= 2; + counter &= 0x03; + if(counter == 0x02) { + AdapterMemorySize += (AdapterMemorySize / 2); /* DDR asymetric */ + } else if(counter != 0) { + AdapterMemorySize <<= 1; /* SINGLE_CHANNEL_2_RANK or DUAL_CHANNEL_1_RANK */ + } + AdapterMemorySize *= (1024*1024); + break; + + case SIS_330: + counter = SiS_GetReg(SiS_Pr->SiS_P3c4,0x14); + AdapterMemorySize = 1 << ((counter & 0xF0) >> 4); + counter &= 0x0c; + if(counter != 0) { + AdapterMemorySize <<= 1; + } + AdapterMemorySize *= (1024*1024); + break; - data = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x21); - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x21,0xDF); /* disable read cache */ + case SIS_550: + case SIS_650: + case SIS_740: + counter = SiS_GetReg(SiS_Pr->SiS_P3c4,0x14) & 0x3F; + counter++; + AdapterMemorySize = counter * 4; + AdapterMemorySize *= (1024*1024); + break; - SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x01,0x20); /* Turn OFF Display */ + case SIS_661: + case SIS_741: + counter = (SiS_GetReg(SiS_Pr->SiS_P3c4,0x79) & 0xf0) >> 4; + AdapterMemorySize = 1 << counter; + AdapterMemorySize *= (1024*1024); + break; - SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x16,0x0F); /* assume lowest speed DRAM */ + case SIS_660: + case SIS_760: + counter = (SiS_GetReg(SiS_Pr->SiS_P3c4,0x79) & 0xf0) >> 4; + if(counter) { + AdapterMemorySize = 1 << counter; + AdapterMemorySize *= (1024*1024); + } + counter = SiS_GetReg(SiS_Pr->SiS_P3c4,0x78) & 0x30; + if(counter) { + if(counter == 0x10) AdapterMemorySize += (32 * 1024 * 1024); + else AdapterMemorySize += (64 * 1024 * 1024); + } + break; +#endif - SiS_SetDRAMModeRegister(SiS_Pr, ROMAddr, HwDeviceExtension); - SiS_DisableRefresh(SiS_Pr); - SiS_CheckBusWidth_310(SiS_Pr, ROMAddr, FBAddr, HwDeviceExtension); +#ifdef SIS300 + case SIS_300: + case SIS_540: + case SIS_630: + case SIS_730: + AdapterMemorySize = SiS_GetReg(SiS_Pr->SiS_P3c4,0x14) & 0x3F; + AdapterMemorySize++; + AdapterMemorySize *= (1024*1024); + break; +#endif + default: + break; + } - SiS_VerifyMclk(SiS_Pr, FBAddr); + return AdapterMemorySize; +} +#endif - if(HwDeviceExtension->jChipType == SIS_330) temp = 1; - else temp = 2; +/*********************************************/ +/* HELPER: Check RAM size */ +/*********************************************/ - if(SiS_Get310DRAMType(SiS_Pr, ROMAddr, HwDeviceExtension) < temp) - SiS_SDRSizing(SiS_Pr, FBAddr); - else - SiS_DDRSizing(SiS_Pr, FBAddr); +#ifndef LINUX_XF86 +static BOOLEAN +SiS_CheckMemorySize(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, + USHORT ModeNo, USHORT ModeIdIndex) +{ + USHORT memorysize,modeflag; + ULONG temp; - if(HwDeviceExtension->jChipType != SIS_330) { - if(Is315E(SiS_Pr)) { - data = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14); - if((data & 0x0C) == 0x0C) { /* dual channel */ - if((data & 0xF0) > 0x40) - data = (data & 0x0F) | 0x40; - } else { /* single channel */ - if((data & 0xF0) > 0x50) - data = (data & 0x0F) | 0x50; - } + 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; } - } - - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x16,SiS_Pr->SiS_SR15[1][SiS_Pr->SiS_RAMType]); /* restore SR16 */ + } - SiS_EnableRefresh(SiS_Pr, ROMAddr); - SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x21,0x20); /* enable read cache */ -} -#endif + memorysize = modeflag & MemoryInfoFlag; + memorysize >>= MemorySizeShift; /* Get required memory size */ + memorysize++; -void -SiS_SetMemoryClock(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension) -{ - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x28,SiS_Pr->SiS_MCLKData_0[SiS_Pr->SiS_RAMType].SR28); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x29,SiS_Pr->SiS_MCLKData_0[SiS_Pr->SiS_RAMType].SR29); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2A,SiS_Pr->SiS_MCLKData_0[SiS_Pr->SiS_RAMType].SR2A); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2E,SiS_Pr->SiS_ECLKData[SiS_Pr->SiS_RAMType].SR2E); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2F,SiS_Pr->SiS_ECLKData[SiS_Pr->SiS_RAMType].SR2F); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x30,SiS_Pr->SiS_ECLKData[SiS_Pr->SiS_RAMType].SR30); + temp = GetDRAMSize(SiS_Pr, HwInfo); /* Get adapter memory size (in MB) */ + temp /= (1024*1024); -#ifdef SIS315H - if (Is315E(SiS_Pr)) { - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x28,0x3B); /* 143 */ - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x29,0x22); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2E,0x3B); /* 143 */ - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2F,0x22); - } -#endif + if(temp < memorysize) return(FALSE); + else return(TRUE); } +#endif -#endif /* ifdef LINUXBIOS */ +/*********************************************/ +/* HELPER: Get DRAM type */ +/*********************************************/ #ifdef SIS315H -UCHAR -SiS_Get310DRAMType(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension) +static UCHAR +SiS_Get310DRAMType(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) { UCHAR data, temp; if(*SiS_Pr->pSiS_SoftSetting & SoftDRAMType) { data = *SiS_Pr->pSiS_SoftSetting & 0x03; } else { - if((HwDeviceExtension->jChipType > SIS_315PRO) && - (HwDeviceExtension->jChipType < SIS_330)) { - data = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x13) & 0x07; - } else { /* TW: 315, 330 */ - data = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x3a) & 0x03; - if(HwDeviceExtension->jChipType == SIS_330) { + if(HwInfo->jChipType >= SIS_660) { + /* data = SiS_GetReg(SiS_Pr->SiS_P3d4,0x78) & 0x07; */ + data = ((SiS_GetReg(SiS_Pr->SiS_P3d4,0x78) & 0xc0) >> 6); + } else if(HwInfo->jChipType >= SIS_661) { + 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(HwInfo->jChipType == SIS_330) { if(data > 1) { - temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x5f) & 0x30; + temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x5f) & 0x30; switch(temp) { case 0x00: data = 1; break; case 0x10: data = 3; break; @@ -1944,3677 +1809,2647 @@ return data; } -#endif - -/* SiSInit END */ -/* ----------------------------------------- */ - -void SiSRegInit(SiS_Private *SiS_Pr, USHORT BaseAddr) +USHORT +SiS_GetMCLK(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) { - SiS_Pr->SiS_P3c4 = BaseAddr + 0x14; - SiS_Pr->SiS_P3d4 = BaseAddr + 0x24; - SiS_Pr->SiS_P3c0 = BaseAddr + 0x10; - SiS_Pr->SiS_P3ce = BaseAddr + 0x1e; - SiS_Pr->SiS_P3c2 = BaseAddr + 0x12; - SiS_Pr->SiS_P3ca = BaseAddr + 0x1a; - SiS_Pr->SiS_P3c6 = BaseAddr + 0x16; - SiS_Pr->SiS_P3c7 = BaseAddr + 0x17; - SiS_Pr->SiS_P3c8 = BaseAddr + 0x18; - SiS_Pr->SiS_P3c9 = BaseAddr + 0x19; - SiS_Pr->SiS_P3da = BaseAddr + 0x2A; - SiS_Pr->SiS_Part1Port = BaseAddr + SIS_CRT2_PORT_04; /* Digital video interface registers (LCD) */ - SiS_Pr->SiS_Part2Port = BaseAddr + SIS_CRT2_PORT_10; /* 301 TV Encoder registers */ - SiS_Pr->SiS_Part3Port = BaseAddr + SIS_CRT2_PORT_12; /* 301 Macrovision registers */ - SiS_Pr->SiS_Part4Port = BaseAddr + SIS_CRT2_PORT_14; /* 301 VGA2 (and LCD) registers */ - SiS_Pr->SiS_Part5Port = BaseAddr + SIS_CRT2_PORT_14+2; /* 301 palette address port registers */ - SiS_Pr->SiS_DDC_Port = BaseAddr + 0x14; /* DDC Port ( = P3C4, SR11/0A) */ -} + USHORT index; -void -SiSInitPCIetc(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension) -{ -/* #ifdef LINUX_XF86 */ - if ((HwDeviceExtension->jChipType == SIS_540)|| - (HwDeviceExtension->jChipType == SIS_630)|| - (HwDeviceExtension->jChipType == SIS_730)|| - (HwDeviceExtension->jChipType == SIS_300)) { - /* TW: Set - PCI LINEAR ADDRESSING ENABLE (0x80) - - PCI IO ENABLE (0x20) - - MMIO ENABLE (0x1) - */ - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x20,0xa1); - /* TW: Enable 2D (0x42) & 3D accelerator (0x18) */ - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x1E,0xFF,0x5A); - } - if((HwDeviceExtension->jChipType == SIS_315H)|| - (HwDeviceExtension->jChipType == SIS_315) || - (HwDeviceExtension->jChipType == SIS_315PRO)|| - (HwDeviceExtension->jChipType == SIS_550) || - (HwDeviceExtension->jChipType == SIS_650) || - (HwDeviceExtension->jChipType == SIS_740) || - (HwDeviceExtension->jChipType == SIS_330)) { - /* TW: This seems to be done the same way on these chipsets */ - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x20,0xa1); - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x1E,0xFF,0x5A); - } -/* #endif */ + index = SiS_Get310DRAMType(SiS_Pr, HwInfo); + if(HwInfo->jChipType >= SIS_661) { + 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); + } } - -void -SiSSetLVDSetc(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo) -{ - ULONG 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_HiVision = 0; - SiS_Pr->SiS_IF_DEF_DSTN = 0; - SiS_Pr->SiS_IF_DEF_FSTN = 0; - - SiS_Pr->SiS_ChrontelInit = 0; - - if((ModeNo == 0x5a) || (ModeNo == 0x5b)) { - SiS_Pr->SiS_IF_DEF_DSTN = 1; /* for 550 dstn */ - SiS_Pr->SiS_IF_DEF_FSTN = 1; /* for fstn */ - } - -#ifdef SIS300 - if((HwDeviceExtension->jChipType == SIS_540) || - (HwDeviceExtension->jChipType == SIS_630) || - (HwDeviceExtension->jChipType == SIS_730)) - { - /* TW: Check for SiS30x first */ - temp = SiS_GetReg1(SiS_Pr->SiS_Part4Port,0x00); - if((temp == 1) || (temp == 2)) return; - temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x37); - temp = (temp & 0x0E) >> 1; - if((temp >= 2) && (temp <= 5)) SiS_Pr->SiS_IF_DEF_LVDS = 1; - if(temp == 3) SiS_Pr->SiS_IF_DEF_TRUMPION = 1; - if((temp == 4) || (temp == 5)) { - /* TW: Save power status (and error check) - UNUSED */ - SiS_Pr->SiS_Backup70xx = SiS_GetCH700x(SiS_Pr, 0x0e); - SiS_Pr->SiS_IF_DEF_CH70xx = 1; - } - } #endif -#ifdef SIS315H - if((HwDeviceExtension->jChipType == SIS_550) || - (HwDeviceExtension->jChipType == SIS_650) || - (HwDeviceExtension->jChipType == SIS_740) || - (HwDeviceExtension->jChipType == SIS_330)) - { - /* TW: CR37 is different on 310/325 series */ - if(SiS_Pr->SiS_IF_DEF_FSTN) /* fstn: set CR37=0x04 */ - SiS_SetReg1(SiS_Pr->SiS_P3d4,0x37,0x04); /* (fake LVDS bridge) */ - temp=SiS_GetReg1(SiS_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; - } - - /* HiVision (HDTV) is done differently now. */ - /* SiS_Pr->SiS_IF_DEF_HiVision = 1; */ - } -#endif -} +/*********************************************/ +/* HELPER: ClearBuffer */ +/*********************************************/ -void -SiSInitPtr(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension) +#ifndef LINUX_XF86 +static void +SiS_ClearBuffer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo) { -#ifdef SIS315H - if((HwDeviceExtension->jChipType == SIS_315H) || - (HwDeviceExtension->jChipType == SIS_315) || - (HwDeviceExtension->jChipType == SIS_315PRO) || - (HwDeviceExtension->jChipType == SIS_550) || - (HwDeviceExtension->jChipType == SIS_650) || - (HwDeviceExtension->jChipType == SIS_740) || - (HwDeviceExtension->jChipType == SIS_330)) - InitTo310Pointer(SiS_Pr, HwDeviceExtension); -#endif - -#ifdef SIS300 - if ((HwDeviceExtension->jChipType == SIS_540) || - (HwDeviceExtension->jChipType == SIS_630) || - (HwDeviceExtension->jChipType == SIS_730) || - (HwDeviceExtension->jChipType == SIS_300)) - InitTo300Pointer(SiS_Pr, HwDeviceExtension); -#endif -} + UCHAR *VideoMemoryAddress = HwInfo->pjVideoMemoryAddress; + ULONG AdapterMemorySize = (ULONG)HwInfo->ulVideoMemorySize; + USHORT *pBuffer; + int i; -void -SiSDetermineROMUsage(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, UCHAR *ROMAddr) -{ - if((ROMAddr) && (HwDeviceExtension->UseROM)) { - if((ROMAddr[0x00] != 0x55) || (ROMAddr[0x01] != 0xAA)) { - SiS_Pr->SiS_UseROM = FALSE; - } else if(HwDeviceExtension->jChipType == SIS_300) { - /* TW: 300: We check if the code starts below 0x220 by - * checking the jmp instruction at the beginning - * of the BIOS image. - */ - if((ROMAddr[3] == 0xe9) && - ((ROMAddr[5] << 8) | ROMAddr[4]) > 0x21a) - SiS_Pr->SiS_UseROM = TRUE; - else SiS_Pr->SiS_UseROM = FALSE; - } else if(HwDeviceExtension->jChipType < SIS_315H) { - /* TW: Rest of 300 series: We don't use the ROM image if - * the BIOS version < 2.0.0 as such old BIOSes don't - * have the needed data at the expected locations. - */ - if(ROMAddr[0x06] < '2') SiS_Pr->SiS_UseROM = FALSE; - else SiS_Pr->SiS_UseROM = TRUE; + if(SiS_Pr->SiS_ModeType >= ModeEGA) { + if(ModeNo > 0x13) { + AdapterMemorySize = GetDRAMSize(SiS_Pr, HwInfo); + SiS_SetMemory(VideoMemoryAddress,AdapterMemorySize,0); } else { - /* TW: 310/325/330 series stick to the standard */ - SiS_Pr->SiS_UseROM = TRUE; + pBuffer = (USHORT *)VideoMemoryAddress; + for(i=0; i<0x4000; i++) + pBuffer[i] = 0x0000; } - } else SiS_Pr->SiS_UseROM = FALSE; - + } else { + pBuffer = (USHORT *)VideoMemoryAddress; + if(SiS_Pr->SiS_ModeType < ModeCGA) { + for(i=0; i<0x4000; i++) + pBuffer[i] = 0x0720; + } else { + SiS_SetMemory(VideoMemoryAddress,0x8000,0); + } + } } +#endif + +/*********************************************/ +/* HELPER: SearchModeID */ +/*********************************************/ -/* - ========================================= - ======== SiS SetMode Functions ========== - ========================================= -*/ -#ifdef LINUX_XF86 -/* TW: This is used for non-Dual-Head mode from X */ BOOLEAN -SiSBIOSSetMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, ScrnInfoPtr pScrn, - DisplayModePtr mode, BOOLEAN IsCustom) +SiS_SearchModeID(SiS_Private *SiS_Pr, USHORT *ModeNo, USHORT *ModeIdIndex) { - SISPtr pSiS = SISPTR(pScrn); - UShort ModeNo=0; - - SiS_Pr->UseCustomMode = FALSE; + UCHAR VGAINFO = SiS_Pr->SiS_VGAINFO; - if((IsCustom) && (SiS_CheckBuildCustomMode(pScrn, mode, pSiS->VBFlags))) { - - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "Setting custom mode %dx%d\n", - SiS_Pr->CHDisplay, SiS_Pr->CVDisplay); - - return(SiSSetMode(SiS_Pr, HwDeviceExtension, pScrn, ModeNo, TRUE)); - - } - - ModeNo = SiS_CalcModeIndex(pScrn, mode); - if(!ModeNo) return FALSE; + if(*ModeNo <= 0x13) { - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "Setting mode 0x%x\n", ModeNo); + if((*ModeNo) <= 0x05) (*ModeNo) |= 0x01; - return(SiSSetMode(SiS_Pr, HwDeviceExtension, pScrn, ModeNo, TRUE)); -} + 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; + } -#ifdef SISDUALHEAD -/* TW: Set CRT1 mode (used for dual head) */ -BOOLEAN -SiSBIOSSetModeCRT1(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, ScrnInfoPtr pScrn, - DisplayModePtr mode, BOOLEAN IsCustom) -{ - ULONG temp; - USHORT ModeIdIndex; - UCHAR *ROMAddr = HwDeviceExtension->pjVirtualRomBase; - USHORT BaseAddr = (USHORT)HwDeviceExtension->ulIOAddress; - SISPtr pSiS = SISPTR(pScrn); - SISEntPtr pSiSEnt = pSiS->entityPrivate; - unsigned char backupreg=0; - BOOLEAN backupcustom; + 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 */ + } + /* else 200 lines */ - UShort ModeNo=0; - - SiS_Pr->UseCustomMode = FALSE; - - if((IsCustom) && (SiS_CheckBuildCustomMode(pScrn, mode, pSiS->VBFlags))) { - - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "Setting custom mode %dx%d in CRT1\n", - SiS_Pr->CHDisplay, SiS_Pr->CVDisplay); - ModeNo = 0xfe; - } else { - ModeNo = SiS_CalcModeIndex(pScrn, mode); - if(!ModeNo) return FALSE; + 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; + } - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "Setting mode 0x%x on CRT1\n", ModeNo); } + return TRUE; +} - SiSInitPtr(SiS_Pr, HwDeviceExtension); - - SiSRegInit(SiS_Pr, BaseAddr); - - SiS_Pr->SiS_VGAINFO = SiS_GetSetBIOSScratch(pScrn, 0x489, 0xff); - - SiSInitPCIetc(SiS_Pr, HwDeviceExtension); - - SiSSetLVDSetc(SiS_Pr, HwDeviceExtension, ModeNo); - - SiSDetermineROMUsage(SiS_Pr, HwDeviceExtension, ROMAddr); - - /* TW: We don't clear the buffer under X */ - SiS_Pr->SiS_flag_clearbuffer = 0; - - /* 1.Openkey */ - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x05,0x86); +/*********************************************/ +/* HELPER: GetModePtr */ +/*********************************************/ - SiS_UnLockCRT2(SiS_Pr, HwDeviceExtension, BaseAddr); +UCHAR +SiS_GetModePtr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex) +{ + UCHAR index; - if(!SiS_Pr->UseCustomMode) { - /* 2.Get ModeID Table */ - temp = SiS_SearchModeID(SiS_Pr, ROMAddr,&ModeNo,&ModeIdIndex); - if(temp == 0) return(0); + if(ModeNo <= 0x13) { + index = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_StTableIndex; } else { - ModeIdIndex = 0; + if(SiS_Pr->SiS_ModeType <= 0x02) index = 0x1B; /* 02 -> ModeEGA */ + else index = 0x0F; } + return index; +} - /* TW: Determine VBType (301,301B,301LV,302B,302LV) */ - SiS_GetVBType(SiS_Pr, BaseAddr,HwDeviceExtension); +/*********************************************/ +/* HELPER: LowModeTests */ +/*********************************************/ + +static BOOLEAN +SiS_DoLowModeTest(SiS_Private *SiS_Pr, USHORT ModeNo, PSIS_HW_INFO HwInfo) +{ + USHORT temp,temp1,temp2; + + if((ModeNo != 0x03) && (ModeNo != 0x10) && (ModeNo != 0x12)) + return(1); + 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(0); + else return(1); + } else { + if(temp2 != 0x55) return(1); + else { + SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x35,0x01); + return(0); + } + } +} + +static void +SiS_SetLowModeTest(SiS_Private *SiS_Pr, USHORT ModeNo, PSIS_HW_INFO HwInfo) +{ + if(SiS_DoLowModeTest(SiS_Pr, ModeNo, HwInfo)) { + SiS_Pr->SiS_SetFlag |= LowModeTests; + } +} + +/*********************************************/ +/* HELPER: ENABLE CRT1 */ +/*********************************************/ +static void +SiS_SetupCR5x(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) +{ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - if(HwDeviceExtension->jChipType >= SIS_315H) { - backupreg = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38); - } else { - backupreg = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x35); + 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); + } } } +} - SiS_SetHiVision(SiS_Pr, BaseAddr,HwDeviceExtension); - - /* TW: Get VB information (connectors, connected devices) */ - /* (We don't care if the current mode is a CRT2 mode) */ - SiS_GetVBInfo(SiS_Pr, BaseAddr,ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension,0); - SiS_GetLCDResInfo(SiS_Pr, ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension); - - if(HwDeviceExtension->jChipType >= SIS_315H) { - if(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x17) & 0x08) { - /* TW: I am not sure the flag's name is correct */ - if(ModeNo != 0x10) SiS_Pr->SiS_SetFlag |= CRT2IsVGA; - } - - /* TW: New from 650/LV 1.10.6x */ - if(IS_SIS650740) { - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x51,0x1f); - SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x56,0xe7); - } - } - } - - /* TW: Set mode on CRT1 */ - SiS_SetCRT1Group(SiS_Pr, ROMAddr,HwDeviceExtension,ModeNo,ModeIdIndex,BaseAddr); - - pSiSEnt->CRT1ModeNo = ModeNo; - pSiSEnt->CRT1DMode = mode; - - /* TW: SetPitch: Adapt to virtual size & position */ - SiS_SetPitchCRT1(SiS_Pr, pScrn, BaseAddr); - - /* We have to reset CRT2 if changing mode on CRT1 */ - if(pSiSEnt->CRT2ModeNo != -1) { - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "(Re-)Setting mode 0x%x on CRT2\n", - pSiSEnt->CRT2ModeNo); - backupcustom = SiS_Pr->UseCustomMode; - if(SiS_Pr->UseCustomMode) { - SiS_Pr->CRT1UsesCustomMode = TRUE; - } else { - SiS_Pr->CRT1UsesCustomMode = FALSE; - } - SiSBIOSSetModeCRT2(SiS_Pr, HwDeviceExtension, pSiSEnt->pScrn_1, - pSiSEnt->CRT2DMode); - SiS_Pr->UseCustomMode = backupcustom; - SiS_Pr->CRT1UsesCustomMode = FALSE; - } - - if(IS_SIS650740) { /* TW: *** For 650 only! *** */ - SiS_HandleCRT1(SiS_Pr); - } - - SiS_DisplayOn(SiS_Pr); - SiS_SetReg3(SiS_Pr->SiS_P3c6,0xFF); - - /* TW: New from 650/LV 1.10.6x and 1.10.7w, 630/301B 2.06.50 */ - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - if(HwDeviceExtension->jChipType >= SIS_315H) { - SiS_SetReg1(SiS_Pr->SiS_P3d4,0x38,backupreg); - } else if((HwDeviceExtension->jChipType == SIS_630) || - (HwDeviceExtension->jChipType == SIS_730)) { - SiS_SetReg1(SiS_Pr->SiS_P3d4,0x35,backupreg); - } - } - - /* Backup/Set ModeNo in BIOS scratch area */ - SiS_GetSetModeID(pScrn,ModeNo); - - return TRUE; +static void +SiS_HandleCRT1(SiS_Private *SiS_Pr) +{ + 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); + } + } +#endif } -/* TW: Set CRT2 mode (used for dual head) */ -BOOLEAN -SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension, ScrnInfoPtr pScrn, - DisplayModePtr mode) -{ - ULONG temp; - USHORT ModeIdIndex; - UCHAR *ROMAddr = HwDeviceExtension->pjVirtualRomBase; - USHORT BaseAddr = (USHORT)HwDeviceExtension->ulIOAddress; - UShort ModeNo = 0; - SISPtr pSiS = SISPTR(pScrn); - SISEntPtr pSiSEnt = pSiS->entityPrivate; - unsigned char tempr1, tempr2, backupreg=0; - - SiS_Pr->UseCustomMode = FALSE; - - ModeNo = SiS_CalcModeIndex(pScrn, mode); - if(!ModeNo) return FALSE; +/*********************************************/ +/* HELPER: GetColorDepth */ +/*********************************************/ - SiSInitPtr(SiS_Pr, HwDeviceExtension); +USHORT +SiS_GetColorDepth(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex) +{ + USHORT ColorDepth[6] = { 1, 2, 4, 4, 6, 8}; + SHORT index; + USHORT modeflag; - SiSRegInit(SiS_Pr, BaseAddr); + /* 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; + } - SiS_Pr->SiS_VGAINFO = SiS_GetSetBIOSScratch(pScrn, 0x489, 0xff); + index = (modeflag & ModeInfoFlag) - ModeEGA; + if(index < 0) index = 0; + return(ColorDepth[index]); +} - SiSInitPCIetc(SiS_Pr, HwDeviceExtension); +/*********************************************/ +/* HELPER: GetOffset */ +/*********************************************/ - SiSSetLVDSetc(SiS_Pr, HwDeviceExtension, ModeNo); +USHORT +SiS_GetOffset(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, + USHORT RefreshRateTableIndex,PSIS_HW_INFO HwInfo) +{ + USHORT xres, temp, colordepth, infoflag; - SiSDetermineROMUsage(SiS_Pr, HwDeviceExtension, ROMAddr); + 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; + } - /* TW: We don't clear the buffer under X */ - SiS_Pr->SiS_flag_clearbuffer=0; + colordepth = SiS_GetColorDepth(SiS_Pr,ModeNo,ModeIdIndex); - /* TW: Save ModeNo so we can set it from within SetMode for CRT1 */ - pSiSEnt->CRT2ModeNo = ModeNo; - pSiSEnt->CRT2DMode = mode; - - /* TW: We can't set CRT2 mode before CRT1 mode is set */ - if(pSiSEnt->CRT1ModeNo == -1) { - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "Setting CRT2 mode delayed until after setting CRT1 mode\n"); - return TRUE; - } + temp = xres / 16; + if(infoflag & InterlaceMode) temp <<= 1; + temp *= colordepth; + if(xres % 16) { + colordepth >>= 1; + temp += colordepth; + } - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "Setting mode 0x%x on CRT2\n", ModeNo); + return(temp); +} - /* 1.Openkey */ - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x05,0x86); +/*********************************************/ +/* SEQ */ +/*********************************************/ - SiS_UnLockCRT2(SiS_Pr, HwDeviceExtension, BaseAddr); +static void +SiS_SetSeqRegs(SiS_Private *SiS_Pr, USHORT StandTableIndex, PSIS_HW_INFO HwInfo) +{ + UCHAR SRdata; + USHORT i; - /* 2.Get ModeID */ - temp = SiS_SearchModeID(SiS_Pr, ROMAddr,&ModeNo,&ModeIdIndex); - if(temp == 0) return(0); + SiS_SetReg(SiS_Pr->SiS_P3c4,0x00,0x03); /* Set SR0 */ - /* TW: Determine VBType (301,301B,301LV,302B,302LV) */ - SiS_GetVBType(SiS_Pr, BaseAddr,HwDeviceExtension); + SRdata = SiS_Pr->SiS_StandTable[StandTableIndex].SR[0]; if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - if(HwDeviceExtension->jChipType >= SIS_315H) { - SiS_UnLockCRT2(SiS_Pr,HwDeviceExtension,BaseAddr); - if(HwDeviceExtension->jChipType < SIS_330) { - if(ROMAddr && SiS_Pr->SiS_UseROM) { - temp = ROMAddr[VB310Data_1_2_Offset]; - temp |= 0x40; - SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x02,temp); - } + 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 */ + } } - SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x32,0x10); - - SiS_SetRegOR(SiS_Pr->SiS_Part2Port,0x02,0x0c); - - backupreg = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38); - } else { - backupreg = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x35); } } - /* TW: Get VB information (connectors, connected devices) */ - SiS_SetHiVision(SiS_Pr, BaseAddr,HwDeviceExtension); - SiS_GetVBInfo(SiS_Pr, BaseAddr,ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension,1); - SiS_GetLCDResInfo(SiS_Pr, ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension); - - if(HwDeviceExtension->jChipType >= SIS_315H) { - if(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x17) & 0x08) { - /* TW: I am not sure the flag's name is correct */ - if(ModeNo != 0x10) SiS_Pr->SiS_SetFlag |= CRT2IsVGA; + 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 */ + } } } - /* Set mode on CRT2 */ - switch (HwDeviceExtension->ujVBChipID) { - case VB_CHIP_301: - case VB_CHIP_301B: - case VB_CHIP_301LV: - case VB_CHIP_301LVX: - case VB_CHIP_302: - case VB_CHIP_302B: - case VB_CHIP_302LV: - case VB_CHIP_302LVX: - SiS_SetCRT2Group301(SiS_Pr, BaseAddr,ROMAddr,ModeNo,HwDeviceExtension); - break; - case VB_CHIP_303: - break; - case VB_CHIP_UNKNOWN: - if (SiS_Pr->SiS_IF_DEF_LVDS == 1 || - SiS_Pr->SiS_IF_DEF_CH70xx != 0 || - SiS_Pr->SiS_IF_DEF_TRUMPION != 0) { - SiS_SetCRT2Group301(SiS_Pr,BaseAddr,ROMAddr,ModeNo,HwDeviceExtension); - } - break; - } + SRdata |= 0x20; /* screen off */ - SiS_DisplayOn(SiS_Pr); - SiS_SetReg3(SiS_Pr->SiS_P3c6,0xFF); + SiS_SetReg(SiS_Pr->SiS_P3c4,0x01,SRdata); - if(HwDeviceExtension->jChipType >= SIS_315H) { - if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { - if(!(SiS_IsDualEdge(SiS_Pr, HwDeviceExtension, BaseAddr))) { - SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x13,0xfb); - } - } + for(i = 2; i <= 4; i++) { + SRdata = SiS_Pr->SiS_StandTable[StandTableIndex].SR[i-1]; + SiS_SetReg(SiS_Pr->SiS_P3c4,i,SRdata); } +} - /* TW: New from 650/LV 1.10.6x and 1.10.7w, 630 2.06.50 */ - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - if(HwDeviceExtension->jChipType >= SIS_315H) { - if(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) { - SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x35,0x01); - } else { - SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x35,0xFE); - } +/*********************************************/ +/* MISC */ +/*********************************************/ - SiS_SetReg1(SiS_Pr->SiS_P3d4,0x38,backupreg); +static void +SiS_SetMiscRegs(SiS_Private *SiS_Pr, USHORT StandTableIndex, PSIS_HW_INFO HwInfo) +{ + UCHAR Miscdata; - tempr1 = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30); - tempr2 = SiS_GetReg1(SiS_Pr->SiS_Part2Port,0x00); - if(tempr1 & SetCRT2ToAVIDEO) tempr2 &= 0xF7; - if(tempr1 & SetCRT2ToSVIDEO) tempr2 &= 0xFB; - SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x00,tempr2); + Miscdata = SiS_Pr->SiS_StandTable[StandTableIndex].MISC; - if(tempr1 & SetCRT2ToLCD) { - SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x38,0xfc); - } - } else if((HwDeviceExtension->jChipType == SIS_630) || - (HwDeviceExtension->jChipType == SIS_730)) { - SiS_SetReg1(SiS_Pr->SiS_P3d4,0x35,backupreg); + if(HwInfo->jChipType < SIS_661) { + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { + Miscdata |= 0x0C; + } } } - /* TW: SetPitch: Adapt to virtual size & position */ - SiS_SetPitchCRT2(SiS_Pr, pScrn, BaseAddr); - - return TRUE; + SiS_SetRegByte(SiS_Pr->SiS_P3c2,Miscdata); } -#endif /* Dualhead */ -#endif /* Linux_XF86 */ - -#ifdef LINUX_XF86 -/* TW: We need pScrn for setting the pitch correctly */ -BOOLEAN -SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,ScrnInfoPtr pScrn,USHORT ModeNo, BOOLEAN dosetpitch) -#else -BOOLEAN -SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo) -#endif -{ - ULONG temp; - USHORT ModeIdIndex,KeepLockReg; - UCHAR *ROMAddr = HwDeviceExtension->pjVirtualRomBase; - USHORT BaseAddr = (USHORT)HwDeviceExtension->ulIOAddress; - unsigned char backupreg=0, tempr1, tempr2; - -#ifndef LINUX_XF86 - SiS_Pr->UseCustomMode = FALSE; - SiS_Pr->CRT1UsesCustomMode = FALSE; -#endif - - if(SiS_Pr->UseCustomMode) { - ModeNo = 0xfe; - } - - SiSInitPtr(SiS_Pr, HwDeviceExtension); - SiSRegInit(SiS_Pr, BaseAddr); +/*********************************************/ +/* CRTC */ +/*********************************************/ -#ifdef LINUX_XF86 - if(pScrn) SiS_Pr->SiS_VGAINFO = SiS_GetSetBIOSScratch(pScrn, 0x489, 0xff); - else -#endif - SiS_Pr->SiS_VGAINFO = 0x11; +static void +SiS_SetCRTCRegs(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, + USHORT StandTableIndex) +{ + UCHAR CRTCdata; + USHORT i; - SiSInitPCIetc(SiS_Pr, HwDeviceExtension); + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x11,0x7f); /* Unlock CRTC */ - SiSSetLVDSetc(SiS_Pr, HwDeviceExtension, ModeNo); + 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); + } + } + } +} - SiSDetermineROMUsage(SiS_Pr, HwDeviceExtension, ROMAddr); +/*********************************************/ +/* ATT */ +/*********************************************/ - if(!SiS_Pr->UseCustomMode) { - /* TW: Shift the clear-buffer-bit away */ - ModeNo = ((ModeNo & 0x80) << 8) | (ModeNo & 0x7f); - } +static void +SiS_SetATTRegs(SiS_Private *SiS_Pr, USHORT StandTableIndex, + PSIS_HW_INFO HwInfo) +{ + UCHAR ARdata; + USHORT i; -#ifdef LINUX_XF86 - /* TW: We never clear the buffer in X */ - ModeNo |= 0x8000; + 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) { + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToTV | SetCRT2ToLCD)) { + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) ARdata=0; + } + } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { + if(HwInfo->jChipType >= 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; + } + } + } else { + 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,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_GetRegByte(SiS_Pr->SiS_P3da); +} + +/*********************************************/ +/* GRC */ +/*********************************************/ - if(ModeNo & 0x8000) { - ModeNo &= 0x7fff; - SiS_Pr->SiS_flag_clearbuffer = 0; - } else { - SiS_Pr->SiS_flag_clearbuffer = 1; - } - - /* 1.Openkey */ - KeepLockReg = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x05); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x05,0x86); +static void +SiS_SetGRCRegs(SiS_Private *SiS_Pr, USHORT StandTableIndex) +{ + UCHAR GRdata; + USHORT i; - SiS_UnLockCRT2(SiS_Pr, HwDeviceExtension, BaseAddr); + for(i = 0; i <= 0x08; i++) { + GRdata = SiS_Pr->SiS_StandTable[StandTableIndex].GRC[i]; + SiS_SetReg(SiS_Pr->SiS_P3ce,i,GRdata); + } - if(!SiS_Pr->UseCustomMode) { - - /* 2.Get ModeID Table */ - temp = SiS_SearchModeID(SiS_Pr,ROMAddr,&ModeNo,&ModeIdIndex); - if(temp == 0) return(0); - - } else { - - ModeIdIndex = 0; - + if(SiS_Pr->SiS_ModeType > ModeVGA) { + /* 256 color disable */ + SiS_SetRegAND(SiS_Pr->SiS_P3ce,0x05,0xBF); } - - /* TW: Determine VBType (301,301B,301LV,302B,302LV) */ - SiS_GetVBType(SiS_Pr,BaseAddr,HwDeviceExtension); +} - /* TW: Init/restore some VB registers */ - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - if(HwDeviceExtension->jChipType >= SIS_315H) { - SiS_UnLockCRT2(SiS_Pr,HwDeviceExtension,BaseAddr); - if(HwDeviceExtension->jChipType < SIS_330) { - if(ROMAddr && SiS_Pr->SiS_UseROM) { - temp = ROMAddr[VB310Data_1_2_Offset]; - temp |= 0x40; - SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x02,temp); - } - } - SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x32,0x10); +/*********************************************/ +/* CLEAR EXTENDED REGISTERS */ +/*********************************************/ + +static void +SiS_ClearExt1Regs(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo) +{ + USHORT i; - SiS_SetRegOR(SiS_Pr->SiS_Part2Port,0x02,0x0c); + for(i = 0x0A; i <= 0x0E; i++) { + SiS_SetReg(SiS_Pr->SiS_P3c4,i,0x00); + } - backupreg = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38); - } else { - backupreg = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x35); - } - } - - /* TW: Get VB information (connectors, connected devices) */ - SiS_SetHiVision(SiS_Pr,BaseAddr,HwDeviceExtension); - SiS_GetVBInfo(SiS_Pr,BaseAddr,ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension,1); - SiS_GetLCDResInfo(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension); + 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); + } + } + } +} - /* 3. Check memory size */ - temp = SiS_CheckMemorySize(SiS_Pr,ROMAddr,HwDeviceExtension,ModeNo,ModeIdIndex); - if(!temp) return(0); +/*********************************************/ +/* RESET VCLK */ +/*********************************************/ - if(HwDeviceExtension->jChipType >= SIS_315H) { - if(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x17) & 0x08) { - /* TW: I am not sure the flag's name is correct */ - if(ModeNo != 0x10) SiS_Pr->SiS_SetFlag |= CRT2IsVGA; +static void +SiS_ResetCRT1VCLK(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) +{ + if(HwInfo->jChipType >= SIS_315H) { + if(HwInfo->jChipType < SIS_661) { + if(SiS_Pr->SiS_IF_DEF_LVDS == 0) return; } - - /* TW: New from 650/LV 1.10.6x */ - if(IS_SIS650740) { - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x51,0x1f); - SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x56,0xe7); - } + } else { + if((SiS_Pr->SiS_IF_DEF_LVDS == 0) && + (!(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) ) { + return; } } - /* TW: Set mode on CRT1 */ - if(SiS_Pr->SiS_VBInfo & (SetSimuScanMode | SetCRT2ToLCDA)) { - SiS_SetCRT1Group(SiS_Pr,ROMAddr,HwDeviceExtension,ModeNo,ModeIdIndex,BaseAddr); + if(HwInfo->jChipType >= SIS_315H) { + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x31,0xCF,0x20); } else { - if(!(SiS_Pr->SiS_VBInfo & SwitchToCRT2)) { - SiS_SetCRT1Group(SiS_Pr,ROMAddr,HwDeviceExtension,ModeNo,ModeIdIndex,BaseAddr); - } + SiS_SetReg(SiS_Pr->SiS_P3c4,0x31,0x20); } - - /* TW: Set mode on CRT2 */ - if(SiS_Pr->SiS_VBInfo & (SetSimuScanMode | SwitchToCRT2 | SetCRT2ToLCDA)) { - switch (HwDeviceExtension->ujVBChipID) { - case VB_CHIP_301: - case VB_CHIP_301B: - case VB_CHIP_301LV: - case VB_CHIP_301LVX: - case VB_CHIP_302: - case VB_CHIP_302B: - case VB_CHIP_302LV: - case VB_CHIP_302LVX: - SiS_SetCRT2Group301(SiS_Pr,BaseAddr,ROMAddr,ModeNo,HwDeviceExtension); - break; - case VB_CHIP_303: - break; - case VB_CHIP_UNKNOWN: - if(SiS_Pr->SiS_IF_DEF_LVDS == 1 || - SiS_Pr->SiS_IF_DEF_CH70xx != 0 || - SiS_Pr->SiS_IF_DEF_TRUMPION != 0) - SiS_SetCRT2Group301(SiS_Pr,BaseAddr,ROMAddr,ModeNo,HwDeviceExtension); - break; - } + SiS_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_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); +} - if(IS_SIS650740) { /* TW: For 650 only! */ - SiS_HandleCRT1(SiS_Pr); - } +/*********************************************/ +/* SYNC */ +/*********************************************/ - SiS_DisplayOn(SiS_Pr); - SiS_SetReg3(SiS_Pr->SiS_P3c6,0xFF); +static void +SiS_SetCRT1Sync(SiS_Private *SiS_Pr, USHORT RefreshRateTableIndex) +{ + USHORT sync; - if(HwDeviceExtension->jChipType >= SIS_315H) { -#if 0 - if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) { - SiS_Handle301B_1400x1050(SiS_Pr, ModeNo); - } - } -#endif - if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { - if(!(SiS_IsDualEdge(SiS_Pr, HwDeviceExtension, BaseAddr))) { - SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x13,0xfb); - } - } - } + if(SiS_Pr->UseCustomMode) { + sync = SiS_Pr->CInfoFlag >> 8; + } else { + sync = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag >> 8; + } - /* TW: New from 650/LV 1.10.6x and 1.10.7w */ - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - if(HwDeviceExtension->jChipType >= SIS_315H) { - if(SiS_IsVAMode(SiS_Pr,HwDeviceExtension, BaseAddr)) { - SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x35,0x01); - } else { - SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x35,0xFE); - } + sync &= 0xC0; + sync |= 0x2f; + SiS_SetRegByte(SiS_Pr->SiS_P3c2,sync); +} - SiS_SetReg1(SiS_Pr->SiS_P3d4,0x38,backupreg); +/*********************************************/ +/* CRTC/2 */ +/*********************************************/ - tempr1 = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30); - tempr2 = SiS_GetReg1(SiS_Pr->SiS_Part2Port,0x00); - if(tempr1 & SetCRT2ToAVIDEO) tempr2 &= 0xF7; - if(tempr1 & SetCRT2ToSVIDEO) tempr2 &= 0xFB; - SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x00,tempr2); - - if((IS_SIS650740) && (SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30) & 0xfc)) { - if((ModeNo == 0x03) || (ModeNo == 0x10)) { - SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x51,0x80); - SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x56,0x08); - } - } +static void +SiS_SetCRT1CRTC(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, + USHORT RefreshRateTableIndex, + PSIS_HW_INFO HwInfo) +{ + UCHAR index; + USHORT temp,i,j,modeflag; - if(tempr1 & SetCRT2ToLCD) { -/* if(ModeNo <= 0x13) { - not in 1.10.8r */ - SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x38,0xfc); -/* } */ - } - } else if((HwDeviceExtension->jChipType == SIS_630) || - (HwDeviceExtension->jChipType == SIS_730)) { - SiS_SetReg1(SiS_Pr->SiS_P3d4,0x35,backupreg); - } - } + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x11,0x7f); /* unlock cr0-7 */ -#ifdef LINUX_XF86 - if(pScrn) { - /* TW: SetPitch: Adapt to virtual size & position */ - if((ModeNo > 0x13) && (dosetpitch)) { - SiS_SetPitch(SiS_Pr, pScrn, BaseAddr); - } + if(SiS_Pr->UseCustomMode) { - /* Backup/Set ModeNo in BIOS scratch area */ - SiS_GetSetModeID(pScrn, ModeNo); - } -#endif - -#ifndef LINUX_XF86 /* TW: We never lock registers in XF86 */ - if(KeepLockReg == 0xA1) SiS_SetReg1(SiS_Pr->SiS_P3c4,0x05,0x86); - else SiS_SetReg1(SiS_Pr->SiS_P3c4,0x05,0x00); -#endif - - return TRUE; -} - -void -SiS_SetEnableDstn(SiS_Private *SiS_Pr) /* TW: Called from sis_main.c */ -{ - /* For 550 dstn */ - SiS_Pr->SiS_IF_DEF_DSTN = 1; -} + modeflag = SiS_Pr->CModeFlag; -void -SiS_HandleCRT1(SiS_Private *SiS_Pr) -{ - /* TW: Do this on 650 only! */ + 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]); + } - /* TW: No, we don't do this at all. There is a new - * CRT1-is-connected-at-boot-time logic in the 650, which - * confuses our own. So just clear the bit and skip the rest. - */ + temp = SiS_Pr->CCRT1CRTC[16] & 0xE0; + SiS_SetReg(SiS_Pr->SiS_P3c4,0x0E,temp); - SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x63,0xbf); + temp = (SiS_Pr->CCRT1CRTC[16] & 0x01) << 5; + if(modeflag & DoubleScanMode) temp |= 0x80; + SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,0x5F,temp); -#if 0 - if(!(SiS_GetReg1(SiS_Pr->SiS_P3c4,0x15) & 0x01)) - SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x63,0x40); - } -#endif -} + } else { -#if 0 -void -SiS_Handle301B_1400x1050(SiS_Private *SiS_Pr, USHORT ModeNo) -{ - if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30) & SetCRT2ToLCD) { if(ModeNo <= 0x13) { - if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x31) & (SetNotSimuMode >> 8)) { - SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x38,0xFC); - } + modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + } else { + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; } - } -} -#endif - -void -SiS_SetCRT1Group(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension, - USHORT ModeNo,USHORT ModeIdIndex,USHORT BaseAddr) -{ - USHORT StandTableIndex,RefreshRateTableIndex; - SiS_Pr->SiS_CRT1Mode = ModeNo; - StandTableIndex = SiS_GetModePtr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex); - if(SiS_LowModeStuff(SiS_Pr,ModeNo,HwDeviceExtension)) { - if(SiS_Pr->SiS_VBInfo & (SetSimuScanMode | SwitchToCRT2)) { - SiS_DisableBridge(SiS_Pr,HwDeviceExtension,BaseAddr); - } - } + index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; - SiS_SetSeqRegs(SiS_Pr,ROMAddr,StandTableIndex); - SiS_SetMiscRegs(SiS_Pr,ROMAddr,StandTableIndex); - SiS_SetCRTCRegs(SiS_Pr,ROMAddr,HwDeviceExtension,StandTableIndex); - SiS_SetATTRegs(SiS_Pr,ROMAddr,StandTableIndex,HwDeviceExtension); - SiS_SetGRCRegs(SiS_Pr,ROMAddr,StandTableIndex); - SiS_ClearExt1Regs(SiS_Pr,HwDeviceExtension); - SiS_ResetCRT1VCLK(SiS_Pr,ROMAddr,HwDeviceExtension); + 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]); + } - SiS_Pr->SiS_SelectCRT2Rate = 0; - SiS_Pr->SiS_SetFlag &= (~ProgrammingCRT2); + temp = SiS_Pr->SiS_CRT1Table[index].CR[16] & 0xE0; + SiS_SetReg(SiS_Pr->SiS_P3c4,0x0E,temp); -#ifdef LINUX_XF86 - xf86DrvMsgVerb(0, X_PROBED, 3, "(init: VBType=0x%04x, VBInfo=0x%04x)\n", - SiS_Pr->SiS_VBType, SiS_Pr->SiS_VBInfo); -#endif + 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_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_ModeType > ModeVGA) SiS_SetReg(SiS_Pr->SiS_P3d4,0x14,0x4F); +} - RefreshRateTableIndex = SiS_GetRatePtrCRT2(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension); +/*********************************************/ +/* OFFSET & PITCH */ +/*********************************************/ +/* (partly overruled by SetPitch() in XF86) */ +/*********************************************/ - if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) { - SiS_Pr->SiS_SetFlag &= ~ProgrammingCRT2; - } +static void +SiS_SetCRT1Offset(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, + USHORT RefreshRateTableIndex, + PSIS_HW_INFO HwInfo) +{ + USHORT temp, DisplayUnit, infoflag; - if(RefreshRateTableIndex != 0xFFFF) { - SiS_SetSync(SiS_Pr,ROMAddr,RefreshRateTableIndex); - SiS_SetCRT1CRTC(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,HwDeviceExtension); - SiS_SetCRT1Offset(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,RefreshRateTableIndex,HwDeviceExtension); - SiS_SetCRT1VCLK(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension,RefreshRateTableIndex); - } + if(SiS_Pr->UseCustomMode) { + infoflag = SiS_Pr->CInfoFlag; + } else { + infoflag = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag; + } -#ifdef SIS300 - if(HwDeviceExtension->jChipType == SIS_300) { - SiS_SetCRT1FIFO_300(SiS_Pr,ROMAddr,ModeNo,HwDeviceExtension,RefreshRateTableIndex); - } - if((HwDeviceExtension->jChipType == SIS_630) || - (HwDeviceExtension->jChipType == SIS_730) || - (HwDeviceExtension->jChipType == SIS_540)) { - SiS_SetCRT1FIFO_630(SiS_Pr,ROMAddr,ModeNo,HwDeviceExtension,RefreshRateTableIndex); - } -#endif -#ifdef SIS315H - if(HwDeviceExtension->jChipType >= SIS_315H) { - SiS_SetCRT1FIFO_310(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex,HwDeviceExtension); - } -#endif + DisplayUnit = SiS_GetOffset(SiS_Pr,ModeNo,ModeIdIndex, + RefreshRateTableIndex,HwInfo); - SiS_SetCRT1ModeRegs(SiS_Pr,ROMAddr,HwDeviceExtension,ModeNo,ModeIdIndex,RefreshRateTableIndex); + temp = (DisplayUnit >> 8) & 0x0f; + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0E,0xF0,temp); - SiS_LoadDAC(SiS_Pr,HwDeviceExtension,ROMAddr,ModeNo,ModeIdIndex); + temp = DisplayUnit & 0xFF; + SiS_SetReg(SiS_Pr->SiS_P3d4,0x13,temp); -#ifndef LINUX_XF86 - if(SiS_Pr->SiS_flag_clearbuffer) { - SiS_ClearBuffer(SiS_Pr,HwDeviceExtension,ModeNo); - } -#endif + if(infoflag & InterlaceMode) DisplayUnit >>= 1; - if(!(SiS_Pr->SiS_VBInfo & (SetSimuScanMode | SwitchToCRT2 | SetCRT2ToLCDA))) { - SiS_LongWait(SiS_Pr); - SiS_DisplayOn(SiS_Pr); - } + DisplayUnit <<= 5; + temp = (DisplayUnit & 0xff00) >> 8; + if(DisplayUnit & 0xff) temp++; + temp++; + SiS_SetReg(SiS_Pr->SiS_P3c4,0x10,temp); } -#ifdef LINUX_XF86 -void -SiS_SetPitch(SiS_Private *SiS_Pr, ScrnInfoPtr pScrn, UShort BaseAddr) -{ - SISPtr pSiS = SISPTR(pScrn); - - /* TW: We need to set pitch for CRT1 if bridge is in SlaveMode, too */ - if( (pSiS->VBFlags & DISPTYPE_DISP1) || - ( (pSiS->VBFlags & VB_VIDEOBRIDGE) && - ( ((pSiS->VGAEngine == SIS_300_VGA) && (SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x00) & 0xa0) == 0x20) || - ((pSiS->VGAEngine == SIS_315_VGA) && (SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x00) & 0x50) == 0x10) ) ) ) { - SiS_SetPitchCRT1(SiS_Pr, pScrn, BaseAddr); - } - if (pSiS->VBFlags & DISPTYPE_DISP2) { - SiS_SetPitchCRT2(SiS_Pr, pScrn, BaseAddr); - } -} +/*********************************************/ +/* VCLK */ +/*********************************************/ -void -SiS_SetPitchCRT1(SiS_Private *SiS_Pr, ScrnInfoPtr pScrn, UShort BaseAddr) +static void +SiS_SetCRT1VCLK(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, + PSIS_HW_INFO HwInfo, USHORT RefreshRateTableIndex) { - SISPtr pSiS = SISPTR(pScrn); - ULong HDisplay,temp; + USHORT index=0, clka, clkb; - HDisplay = pSiS->scrnPitch / 8; - SiS_SetReg1(SiS_Pr->SiS_P3d4, 0x13, (HDisplay & 0xFF)); - temp = (SiS_GetReg1(SiS_Pr->SiS_P3c4, 0x0E) & 0xF0) | (HDisplay>>8); - SiS_SetReg1(SiS_Pr->SiS_P3c4, 0x0E, temp); -} - -void -SiS_SetPitchCRT2(SiS_Private *SiS_Pr, ScrnInfoPtr pScrn, UShort BaseAddr) -{ - SISPtr pSiS = SISPTR(pScrn); - ULong HDisplay,temp; + 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; + } + } - HDisplay = pSiS->scrnPitch / 8; + if(HwInfo->jChipType >= SIS_315H) { + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x31,0xCF); + } else { + SiS_SetReg(SiS_Pr->SiS_P3c4,0x31,0x00); + } - /* Unlock CRT2 */ - if (pSiS->VGAEngine == SIS_315_VGA) - SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2F, 0x01); - else - SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x24, 0x01); + SiS_SetReg(SiS_Pr->SiS_P3c4,0x2B,clka); + SiS_SetReg(SiS_Pr->SiS_P3c4,0x2C,clkb); - SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x07, (HDisplay & 0xFF)); - temp = (SiS_GetReg1(SiS_Pr->SiS_Part1Port,0x09) & 0xF0) | ((HDisplay >> 8) & 0xFF); - SiS_SetReg1(SiS_Pr->SiS_Part1Port,0x09, temp); + if(HwInfo->jChipType >= SIS_315H) { + SiS_SetReg(SiS_Pr->SiS_P3c4,0x2D,0x01); + } else { + SiS_SetReg(SiS_Pr->SiS_P3c4,0x2D,0x80); + } } -#endif -/* TW: Checked against 650/301 and 630/301B BIOS */ -/* TW: Re-written for 650/301LVx 1.10.6s BIOS */ -void -SiS_GetVBType(SiS_Private *SiS_Pr, USHORT BaseAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension) +/*********************************************/ +/* FIFO */ +/*********************************************/ + +#ifdef SIS300 +static USHORT +SiS_DoCalcDelay(SiS_Private *SiS_Pr, USHORT MCLK, USHORT VCLK, USHORT colordepth, USHORT key) { - USHORT flag=0, rev=0, nolcd=0; + 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 }; - SiS_Pr->SiS_VBType = 0; + 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 }; - if(SiS_Pr->SiS_IF_DEF_LVDS == 1) return; + const UCHAR ThTiming[] = { 1, 2, 2, 3, 0, 1, 1, 2 }; - flag = SiS_GetReg1(SiS_Pr->SiS_Part4Port,0x00); + USHORT tempah, tempal, tempcl, tempbx, temp; + ULONG longtemp; - /* TW: Illegal values not welcome... */ - if(flag > 10) return; + 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); +} - rev = SiS_GetReg1(SiS_Pr->SiS_Part4Port,0x01); +static USHORT +SiS_CalcDelay(SiS_Private *SiS_Pr, USHORT VCLK, USHORT colordepth, USHORT MCLK) +{ + USHORT tempax, tempbx; - if (flag >= 2) { - SiS_Pr->SiS_VBType = VB_SIS302B; - } else if (flag == 1) { - SiS_Pr->SiS_VBType = VB_SIS301; - if(rev >= 0xB0) { - SiS_Pr->SiS_VBType = VB_SIS301B; - if((HwDeviceExtension->jChipType >= SIS_315H) || - (HwDeviceExtension->jChipType == SIS_300)) { - /* 650/301LV and 300/301LV use this, 630/301B does not */ - nolcd = SiS_GetReg1(SiS_Pr->SiS_Part4Port,0x23); - if(!(nolcd & 0x02)) - SiS_Pr->SiS_VBType |= VB_NoLCD; - } - } - } - if(SiS_Pr->SiS_VBType & (VB_SIS301B | VB_SIS302B)) { - if(rev >= 0xD0) { - SiS_Pr->SiS_VBType &= ~(VB_SIS301B | VB_SIS302B); - SiS_Pr->SiS_VBType |= VB_SIS30xLV; - SiS_Pr->SiS_VBType &= ~(VB_NoLCD); - if(rev >= 0xE0) { - SiS_Pr->SiS_VBType &= ~(VB_SIS30xLV); - SiS_Pr->SiS_VBType |= VB_SIS30xNEW; - } - } - } + 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); } -/* TW: Checked against 650/301LVx 1.10.6s */ -BOOLEAN -SiS_SearchModeID(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT *ModeNo,USHORT *ModeIdIndex) +static void +SiS_SetCRT1FIFO_300(SiS_Private *SiS_Pr, USHORT ModeNo, PSIS_HW_INFO HwInfo, + USHORT RefreshRateTableIndex) { - UCHAR VGAINFO = SiS_Pr->SiS_VGAINFO; + USHORT ThresholdLow = 0; + USHORT index, VCLK, MCLK, colorth=0; + USHORT tempah, temp; - if(*ModeNo <= 0x13) { + if(ModeNo > 0x13) { - if((*ModeNo) <= 5) (*ModeNo) |= 1; + 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 */ + } - 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; - } + 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; + } - if(*ModeNo == 0x07) { - if(VGAINFO & 0x10) (*ModeIdIndex)++; /* 400 lines */ - /* else 350 lines */ - } - if(*ModeNo <= 3) { - if(!(VGAINFO & 0x80)) (*ModeIdIndex)++; - if(VGAINFO & 0x10) (*ModeIdIndex)++; /* 400 lines */ - /* else 350 lines */ - } - /* else 200 lines */ + index = SiS_GetReg(SiS_Pr->SiS_P3c4,0x3A); + index &= 0x07; + MCLK = SiS_Pr->SiS_MCLKData_0[index].CLOCK; /* Get MCLK */ - } else { + tempah = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35); + tempah &= 0xc3; + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x16,0x3c,tempah); - 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; - } + 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); - } - return TRUE; -} + } else ThresholdLow = 2; -/* For SiS 300 oem util: Search VBModeID */ -BOOLEAN -SiS_SearchVBModeID(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT *ModeNo) -{ - USHORT ModeIdIndex; - UCHAR VGAINFO = SiS_Pr->SiS_VGAINFO; + /* Write CRT/CPU threshold low, CRT/Engine threshold high */ + temp = (ThresholdLow << 4) | 0x0f; + SiS_SetReg(SiS_Pr->SiS_P3c4,0x08,temp); - if(*ModeNo <= 5) *ModeNo |= 1; + temp = (ThresholdLow & 0x10) << 1; + if(ModeNo > 0x13) temp |= 0x40; + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0f,0x9f,temp); - for(ModeIdIndex=0; ; ModeIdIndex++) { - if(SiS_Pr->SiS_VBModeIDTable[ModeIdIndex].ModeID == *ModeNo) break; - if(SiS_Pr->SiS_VBModeIDTable[ModeIdIndex].ModeID == 0xFF) return FALSE; - } + /* What is this? */ + SiS_SetReg(SiS_Pr->SiS_P3c4,0x3B,0x09); - if(*ModeNo != 0x07) { - if(*ModeNo > 0x03) return ((BOOLEAN)ModeIdIndex); - if(VGAINFO & 0x80) return ((BOOLEAN)ModeIdIndex); - ModeIdIndex++; - } - if(VGAINFO & 0x10) ModeIdIndex++; /* 400 lines */ - /* else 350 lines */ - return ((BOOLEAN)ModeIdIndex); + /* Write CRT/CPU threshold high */ + temp = ThresholdLow + 3; + if(temp > 0x0f) temp = 0x0f; + SiS_SetReg(SiS_Pr->SiS_P3c4,0x09,temp); } -/* TW: Checked against 630/301B, 315 1.09 and 650/301LVx 1.10.6s BIOS */ -BOOLEAN -SiS_CheckMemorySize(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension, - USHORT ModeNo,USHORT ModeIdIndex) +static USHORT +SiS_CalcDelay2(SiS_Private *SiS_Pr, UCHAR key, PSIS_HW_INFO HwInfo) { - USHORT memorysize,modeflag; - ULONG temp; - - 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++; - - temp = GetDRAMSize(SiS_Pr, HwDeviceExtension); /* Get adapter memory size */ - temp /= (1024*1024); /* (in MB) */ - - if(temp < memorysize) return(FALSE); - else return(TRUE); -} - -UCHAR -SiS_GetModePtr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex) -{ - UCHAR index; + 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(ModeNo <= 0x13) { - index = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_StTableIndex; - } else { - if(SiS_Pr->SiS_ModeType <= 0x02) index = 0x1B; /* 02 -> ModeEGA */ - else index = 0x0F; - } - return index; + 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); } -/* TW: Checked against 300, 330, 650/LVDS (1.10.07, 1.10a) and 650/301LV BIOS */ -void -SiS_SetSeqRegs(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT StandTableIndex) +static void +SiS_SetCRT1FIFO_630(SiS_Private *SiS_Pr, USHORT ModeNo, + PSIS_HW_INFO HwInfo, + USHORT RefreshRateTableIndex) { - UCHAR SRdata; - USHORT i; - - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x00,0x03); /* Set SR0 */ - - SRdata = SiS_Pr->SiS_StandTable[StandTableIndex].SR[0]; - - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { - SRdata |= 0x01; - } - } - 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 */ - } - } - } - - SRdata |= 0x20; /* screen off */ + 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 + }; - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x01,SRdata); + 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 */ + } - for(i = 2; i <= 4; i++) { - SRdata = SiS_Pr->SiS_StandTable[StandTableIndex].SR[i-1]; - SiS_SetReg1(SiS_Pr->SiS_P3c4,i,SRdata); - } -} + index = SiS_GetReg(SiS_Pr->SiS_P3c4,0x1A); + index &= 0x07; + MCLK = SiS_Pr->SiS_MCLKData_0[index].CLOCK; /* Get MCLK */ -/* Checked against 300, 650/301LVx 1.10.6s and 650/LVDS 1.10.07 BIOS */ -void -SiS_SetMiscRegs(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT StandTableIndex) -{ - UCHAR Miscdata; + 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; + } - Miscdata = SiS_Pr->SiS_StandTable[StandTableIndex].MISC; + if(HwInfo->jChipType == SIS_730) { - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { - Miscdata |= 0x0C; - } - } + do { + B = SiS_CalcDelay2(SiS_Pr, FQBQData730[i], HwInfo) * VCLK * colorth; + bl = B / (MCLK * 16); - SiS_SetReg3(SiS_Pr->SiS_P3c2,Miscdata); -} + if(B == bl * 16 * MCLK) { + bl = bl + 1; + } else { + bl = bl + 2; + } -/* Checked against 300, 330, 650/LVDS (1.10.07) and 650/301LVx (1.10.6s) BIOS (630 code still there!) */ -void -SiS_SetCRTCRegs(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension, - USHORT StandTableIndex) -{ - UCHAR CRTCdata; - USHORT i; + if(bl > 0x13) { + if(FQBQData730[i+1] == 0xFF) { + ThresholdLow = 0x13; + break; + } + i++; + } else { + ThresholdLow = bl; + break; + } + } while(FQBQData730[i] != 0xFF); + + } else { + + do { + B = SiS_CalcDelay2(SiS_Pr, FQBQData[i], HwInfo) * VCLK * colorth; + bl = B / (MCLK * 16); - SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x11,0x7f); /* Unlock CRTC */ + if(B == bl * 16 * MCLK) { + bl = bl + 1; + } else { + bl = bl + 2; + } - for(i = 0; i <= 0x18; i++) { - CRTCdata = SiS_Pr->SiS_StandTable[StandTableIndex].CRTC[i]; - SiS_SetReg1(SiS_Pr->SiS_P3d4,i,CRTCdata); /* Set CRTC(3d4) */ + if(bl > 0x13) { + if(FQBQData[i+1] == 0xFF) { + ThresholdLow = 0x13; + break; + } + i++; + } else { + ThresholdLow = bl; + break; + } + } while(FQBQData[i] != 0xFF); + } } - if( ( (HwDeviceExtension->jChipType == SIS_630) || - (HwDeviceExtension->jChipType == SIS_730) ) && - (HwDeviceExtension->jChipRevision >= 0x30) ) { /* for 630S0 */ - if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { - if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToTV)) { - SiS_SetReg1(SiS_Pr->SiS_P3d4,0x18,0xFE); - } + else { + if(HwInfo->jChipType == SIS_730) { + } else { + i = 9; } + ThresholdLow = 0x02; } -} -/* TW: Checked against 300, 650/LVDS (1.10.07), 650/301LVx (1.10.6s) and 630/301B BIOS */ -void -SiS_SetATTRegs(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT StandTableIndex, - PSIS_HW_DEVICE_INFO HwDeviceExtension) -{ - UCHAR ARdata; - USHORT i; + /* Write foreground and background queue */ + if(HwInfo->jChipType == SIS_730) { + + data2 = FQBQData730[i]; + data2 = (data2 & 0xC0) >> 5; + data2 <<= 8; - 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; - } - } +#ifndef LINUX_XF86 + 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(i == 0x13) { - 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(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { - if(HwDeviceExtension->jChipType >= SIS_315H) { - /* TW: From 650/LVDS 1.10.07, 1.10a; 650/301LVx 1.10.6s; not in 330 BIOS */ - ARdata = 0; - } else { - if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { - ARdata=0; - } - } - } - } - SiS_GetReg2(SiS_Pr->SiS_P3da); /* reset 3da */ - SiS_SetReg3(SiS_Pr->SiS_P3c0,i); /* set index */ - SiS_SetReg3(SiS_Pr->SiS_P3c0,ARdata); /* set data */ - } - SiS_GetReg2(SiS_Pr->SiS_P3da); /* reset 3da */ - SiS_SetReg3(SiS_Pr->SiS_P3c0,0x14); /* set index */ - SiS_SetReg3(SiS_Pr->SiS_P3c0,0x00); /* set data */ - SiS_GetReg2(SiS_Pr->SiS_P3da); - SiS_SetReg3(SiS_Pr->SiS_P3c0,0x20); /* Enable Attribute */ - SiS_GetReg2(SiS_Pr->SiS_P3da); -} + /* Write GUI grant timer (PCI config 0xA3) */ + data2 = FQBQData730[i] << 8; + data2 = (data2 & 0x0f00) | ((data2 & 0x3000) >> 8); + data2 <<= 20; -/* TW: Checked against 300, 330, 650/LVDS (1.10.07, 1.10a) and 650/301LV BIOS */ -void -SiS_SetGRCRegs(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT StandTableIndex) -{ - UCHAR GRdata; - USHORT i; +#ifndef LINUX_XF86 + 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 - for(i = 0; i <= 0x08; i++) { - GRdata = SiS_Pr->SiS_StandTable[StandTableIndex].GRC[i]; - SiS_SetReg1(SiS_Pr->SiS_P3ce,i,GRdata); /* Set GR(3ce) */ - } + } else { - if(SiS_Pr->SiS_ModeType > ModeVGA) { - SiS_SetRegAND(SiS_Pr->SiS_P3ce,0x05,0xBF); /* 256 color disable */ - } -} + data2 = FQBQData[i]; + data2 = (data2 & 0xf0) >> 4; + data2 <<= 24; -/* TW: Checked against 650/LVDS (1.10.07, 1.10a), 650/301LVx (1.10.6s) and 630/301B BIOS */ -void -SiS_ClearExt1Regs(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension) -{ - USHORT i; +#ifndef LINUX_XF86 + 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 - for(i = 0x0A; i <= 0x0E; i++) { - SiS_SetReg1(SiS_Pr->SiS_P3c4,i,0x00); /* Clear SR0A-SR0E */ - } + /* Write GUI grant timer (PCI config 0xA3) */ + data2 = FQBQData[i]; + data2 &= 0x0f; + data2 <<= 24; + +#ifndef LINUX_XF86 + 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 - /* TW: New from 330, 650/LVDS/301LV BIOSes: */ - if(HwDeviceExtension->jChipType >= SIS_315H) { - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x37,0xFE); } -} -/* TW: Checked against 300, 330, 650/LVDS (1.10.07) and 650/301LV BIOS */ -void -SiS_SetSync(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT RefreshRateTableIndex) -{ - USHORT sync; - USHORT temp; + /* Write CRT/CPU threshold low, CRT/Engine threshold high */ + data = ((ThresholdLow & 0x0f) << 4) | 0x0f; + SiS_SetReg(SiS_Pr->SiS_P3c4,0x08,data); - if(SiS_Pr->UseCustomMode) { - sync = SiS_Pr->CInfoFlag >> 8; - } else { - sync = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag >> 8; - } + data = (ThresholdLow & 0x10) << 1; + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0F,0xDF,data); - sync &= 0xC0; - temp = 0x2F | sync; - SiS_SetReg3(SiS_Pr->SiS_P3c2,temp); /* Set Misc(3c2) */ + /* 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); } +#endif -/* TW: Checked against 300, 330, 650/LVDS (1.10.07) and 650/301LVx (1.10.6s) BIOS */ -void -SiS_SetCRT1CRTC(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, - USHORT RefreshRateTableIndex, - PSIS_HW_DEVICE_INFO HwDeviceExtension) -{ - UCHAR index; - USHORT tempah,i,modeflag,j; #ifdef SIS315H - USHORT temp; - USHORT ResInfo,DisplayType; - const SiS_LCDACRT1DataStruct *LCDACRT1Ptr = NULL; -#endif +static void +SiS_SetCRT1FIFO_310(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, + PSIS_HW_INFO HwInfo) +{ + USHORT modeflag; - SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x11,0x7f); /*unlock cr0-7 */ + /* disable auto-threshold */ + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x3D,0xFE); if(SiS_Pr->UseCustomMode) { modeflag = SiS_Pr->CModeFlag; } else { - if(ModeNo <= 0x13) { - modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + 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 { - modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + if((!(modeflag & DoubleScanMode)) || (!(modeflag & HalfDCLK))) { + SiS_SetReg(SiS_Pr->SiS_P3c4,0x08,0x34); + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x3D,0x01); + } } - } - - if((SiS_Pr->SiS_IF_DEF_LVDS == 0) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) { - -#ifdef SIS315H - - /* LCDA */ - - temp = SiS_GetLCDACRT1Ptr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex, - RefreshRateTableIndex,&ResInfo,&DisplayType); - - switch(DisplayType) { - case Panel_800x600 : LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT1800x600_1; break; - case Panel_1024x768 : LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11024x768_1; break; - case Panel_1280x1024 : LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11280x1024_1; break; - case Panel_1400x1050 : LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11400x1050_1; break; - case Panel_1600x1200 : LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11600x1200_1; break; - case Panel_800x600 + 16 : LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT1800x600_1_H; break; - case Panel_1024x768 + 16 : LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11024x768_1_H; break; - case Panel_1280x1024 + 16: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11280x1024_1_H; break; - case Panel_1400x1050 + 16: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11400x1050_1_H; break; - case Panel_1600x1200 + 16: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11600x1200_1_H; break; - case Panel_800x600 + 32 : LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT1800x600_2; break; - case Panel_1024x768 + 32 : LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11024x768_2; break; - case Panel_1280x1024 + 32: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11280x1024_2; break; - case Panel_1400x1050 + 32: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11400x1050_2; break; - case Panel_1600x1200 + 32: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11600x1200_2; break; - case Panel_800x600 + 48 : LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT1800x600_2_H; break; - case Panel_1024x768 + 48 : LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11024x768_2_H; break; - case Panel_1280x1024 + 48: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11280x1024_2_H; break; - case Panel_1400x1050 + 48: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11400x1050_2_H; break; - case Panel_1600x1200 + 48: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11600x1200_2_H; break; - default: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11024x768_1; break; - } - - tempah = (LCDACRT1Ptr+ResInfo)->CR[0]; - SiS_SetReg1(SiS_Pr->SiS_P3d4,0x00,tempah); - for(i=0x01,j=1;i<=0x07;i++,j++){ - tempah = (LCDACRT1Ptr+ResInfo)->CR[j]; - SiS_SetReg1(SiS_Pr->SiS_P3d4,i,tempah); - } - for(i=0x10,j=8;i<=0x12;i++,j++){ - tempah = (LCDACRT1Ptr+ResInfo)->CR[j]; - SiS_SetReg1(SiS_Pr->SiS_P3d4,i,tempah); - } - for(i=0x15,j=11;i<=0x16;i++,j++){ - tempah =(LCDACRT1Ptr+ResInfo)->CR[j]; - SiS_SetReg1(SiS_Pr->SiS_P3d4,i,tempah); - } - for(i=0x0A,j=13;i<=0x0C;i++,j++){ - tempah = (LCDACRT1Ptr+ResInfo)->CR[j]; - SiS_SetReg1(SiS_Pr->SiS_P3c4,i,tempah); - } - - tempah = (LCDACRT1Ptr+ResInfo)->CR[16]; - tempah &= 0x0E0; - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x0E,tempah); - - tempah = (LCDACRT1Ptr+ResInfo)->CR[16]; - tempah &= 0x01; - tempah <<= 5; - if(modeflag & DoubleScanMode) tempah |= 0x080; - SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,~0x020,tempah); - + } +} #endif - } else { +/*********************************************/ +/* MODE REGISTERS */ +/*********************************************/ - /* LVDS, 301, 301B, 301LV, 302LV, ... (non-LCDA) */ +static void +SiS_SetVCLKState(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, + USHORT ModeNo, USHORT RefreshRateTableIndex, + USHORT ModeIdIndex) +{ + USHORT data=0, VCLK=0, index=0; + if(ModeNo > 0x13) { if(SiS_Pr->UseCustomMode) { - - for(i=0,j=0;i<=07;i++,j++) { - SiS_SetReg1(SiS_Pr->SiS_P3d4,j,SiS_Pr->CCRT1CRTC[i]); - } - for(j=0x10;i<=10;i++,j++) { - SiS_SetReg1(SiS_Pr->SiS_P3d4,j,SiS_Pr->CCRT1CRTC[i]); - } - for(j=0x15;i<=12;i++,j++) { - SiS_SetReg1(SiS_Pr->SiS_P3d4,j,SiS_Pr->CCRT1CRTC[i]); - } - for(j=0x0A;i<=15;i++,j++) { - SiS_SetReg1(SiS_Pr->SiS_P3c4,j,SiS_Pr->CCRT1CRTC[i]); - } - - tempah = SiS_Pr->CCRT1CRTC[16] & 0xE0; - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x0E,tempah); - - tempah = SiS_Pr->CCRT1CRTC[16]; - tempah &= 0x01; - tempah <<= 5; - if(modeflag & DoubleScanMode) tempah |= 0x80; - SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,0xDF,tempah); - - + VCLK = SiS_Pr->CSRClock; } else { - - index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; /* Get index */ -#if 0 /* Not any longer... */ - if(HwDeviceExtension->jChipType < SIS_315H) { - index &= 0x3F; - } -#endif - - for(i=0,j=0;i<=07;i++,j++) { - tempah=SiS_Pr->SiS_CRT1Table[index].CR[i]; - SiS_SetReg1(SiS_Pr->SiS_P3d4,j,tempah); - } - for(j=0x10;i<=10;i++,j++) { - tempah=SiS_Pr->SiS_CRT1Table[index].CR[i]; - SiS_SetReg1(SiS_Pr->SiS_P3d4,j,tempah); - } - for(j=0x15;i<=12;i++,j++) { - tempah=SiS_Pr->SiS_CRT1Table[index].CR[i]; - SiS_SetReg1(SiS_Pr->SiS_P3d4,j,tempah); - } - for(j=0x0A;i<=15;i++,j++) { - tempah=SiS_Pr->SiS_CRT1Table[index].CR[i]; - SiS_SetReg1(SiS_Pr->SiS_P3c4,j,tempah); - } - - tempah = SiS_Pr->SiS_CRT1Table[index].CR[16]; - tempah &= 0xE0; - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x0E,tempah); - - tempah = SiS_Pr->SiS_CRT1Table[index].CR[16]; - tempah &= 0x01; - tempah <<= 5; - if(modeflag & DoubleScanMode) tempah |= 0x80; - SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,0xDF,tempah); - + index = SiS_GetVCLK2Ptr(SiS_Pr,ModeNo,ModeIdIndex, + RefreshRateTableIndex,HwInfo); + VCLK = SiS_Pr->SiS_VCLKData[index].CLOCK; } } - if(SiS_Pr->SiS_ModeType > ModeVGA) SiS_SetReg1(SiS_Pr->SiS_P3d4,0x14,0x4F); -} - -BOOLEAN -SiS_GetLCDACRT1Ptr(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, - USHORT RefreshRateTableIndex,USHORT *ResInfo, - USHORT *DisplayType) - { - USHORT tempbx=0,modeflag=0; - USHORT CRT2CRTC=0; - - if(ModeNo <= 0x13) { - modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; - CRT2CRTC = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; - } else { - modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - CRT2CRTC = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; - } - - tempbx = SiS_Pr->SiS_LCDResInfo; - - if(SiS_Pr->SiS_LCDInfo & LCDNonExpanding) tempbx += 32; - if(modeflag & HalfDCLK) tempbx += 16; - - *ResInfo = CRT2CRTC & 0x3F; - *DisplayType = tempbx; - - return 1; -} - -/* TW: Set offset and pitch - partly overruled by SetPitch() in XF86 */ -/* TW: Checked against 330, 650/LVDS (1.10.07), 650/301LV and 315 BIOS */ -void -SiS_SetCRT1Offset(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, - USHORT RefreshRateTableIndex, - PSIS_HW_DEVICE_INFO HwDeviceExtension) -{ - USHORT temp, DisplayUnit, infoflag; - - if(SiS_Pr->UseCustomMode) { - infoflag = SiS_Pr->CInfoFlag; - } else { - infoflag = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag; - } - - DisplayUnit = SiS_GetOffset(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex, - RefreshRateTableIndex,HwDeviceExtension); - - temp = (DisplayUnit >> 8) & 0x0f; - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0E,0xF0,temp); + if(HwInfo->jChipType < SIS_315H) { - temp = DisplayUnit & 0xFF; - SiS_SetReg1(SiS_Pr->SiS_P3d4,0x13,temp); + if(VCLK > 150) data |= 0x80; + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x07,0x7B,data); - if(infoflag & InterlaceMode) DisplayUnit >>= 1; + data = 0x00; + if(VCLK >= 150) data |= 0x08; + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x32,0xF7,data); - DisplayUnit <<= 5; - temp = (DisplayUnit & 0xff00) >> 8; - if (DisplayUnit & 0xff) temp++; - temp++; - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x10,temp); -} + } else { -/* TW: New from 650/LVDS 1.10.07, 630/301B and 630/LVDS BIOS */ -void -SiS_ResetCRT1VCLK(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension) -{ - USHORT index; + if(VCLK >= 166) data |= 0x0c; + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x32,0xf3,data); - /* TW: We only need to do this if Panel Link is to be - * initialized, thus on 630/LVDS/301B, and 650/LVDS - */ - if(HwDeviceExtension->jChipType >= SIS_315H) { - if (SiS_Pr->SiS_IF_DEF_LVDS == 0) return; - } else { - if( (SiS_Pr->SiS_IF_DEF_LVDS == 0) && - (!(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) ) { - return; - } - } + if(VCLK >= 166) { + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1f,0xe7); + } + } - if(HwDeviceExtension->jChipType >= SIS_315H) { - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x31,0xCF,0x20); - } else { - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x31,0x20); - } - index = 1; - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2B,SiS_Pr->SiS_VCLKData[index].SR2B); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2C,SiS_Pr->SiS_VCLKData[index].SR2C); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2D,0x80); - if(HwDeviceExtension->jChipType >= SIS_315H) { - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x31,0xcf,0x10); - } else { - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x31,0x10); - } - index = 0; - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2B,SiS_Pr->SiS_VCLKData[index].SR2B); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2C,SiS_Pr->SiS_VCLKData[index].SR2C); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2D,0x80); -} + /* DAC speed */ + if(HwInfo->jChipType >= SIS_661) { -/* TW: Checked against 300, 330, 650/LVDS, 650/301LVx, 315, 630/301B, 630/LVDS BIOS */ -void -SiS_SetCRT1VCLK(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, - PSIS_HW_DEVICE_INFO HwDeviceExtension, - USHORT RefreshRateTableIndex) -{ - USHORT index=0; - - if(!SiS_Pr->UseCustomMode) { - index = SiS_GetVCLK2Ptr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex, - RefreshRateTableIndex,HwDeviceExtension); - } - - if( (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) - && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) ){ - - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x31,0xCF); - - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2B,SiS_Pr->SiS_VBVCLKData[index].Part4_A); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2C,SiS_Pr->SiS_VBVCLKData[index].Part4_B); - - if(HwDeviceExtension->jChipType >= SIS_315H) { - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2D,0x01); - } else { - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2D,0x80); - } + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x07,0xE8,0x10); } else { - if(HwDeviceExtension->jChipType >= SIS_315H) { - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x31,0xCF); - } else { - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x31,0x00); - } + data = 0x03; + if((VCLK >= 135) && (VCLK < 160)) data = 0x02; + else if((VCLK >= 160) && (VCLK < 260)) data = 0x01; + else if(VCLK >= 260) data = 0x00; - if(SiS_Pr->UseCustomMode) { - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2B,SiS_Pr->CSR2B); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2C,SiS_Pr->CSR2C); - } else { - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2B,SiS_Pr->SiS_VCLKData[index].SR2B); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2C,SiS_Pr->SiS_VCLKData[index].SR2C); - } + if(HwInfo->jChipType == SIS_540) { + if((VCLK == 203) || (VCLK < 234)) data = 0x02; + } - if(HwDeviceExtension->jChipType >= SIS_315H) { - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2D,0x01); - } else { - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x2D,0x80); + 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; } - } -} - -#if 0 /* TW: Not used */ -void -SiS_IsLowResolution(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex) -{ - USHORT ModeFlag; - - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x0F,0x7F); + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x07,0xF8,data); + } - if(ModeNo > 0x13) { - ModeFlag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - if ((ModeFlag & HalfDCLK) && (ModeFlag & DoubleScanMode)) { - SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x0F,0x80); - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x01,0xF7); - } } } -#endif -/* TW: Checked against 300, 630/LVDS, 650/LVDS, 315 and 330 BIOS */ -void -SiS_SetCRT1ModeRegs(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension, +static void +SiS_SetCRT1ModeRegs(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex) { - USHORT data,data2,data3; - USHORT infoflag=0,modeflag; + USHORT data,infoflag=0,modeflag; USHORT resindex,xres; +#ifdef SIS315H + USHORT data2,data3; + ULONG longdata; + UCHAR *ROMAddr = HwInfo->pjVirtualRomBase; +#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; } } - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1F,0x3F); /* DAC pedestal */ + /* Disable DPMS */ + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1F,0x3F); - if(ModeNo > 0x13) data = infoflag; - else data = 0; - - data2 = 0; + data = 0; if(ModeNo > 0x13) { - if(SiS_Pr->SiS_ModeType > 0x02) { - data2 |= 0x02; - data3 = (SiS_Pr->SiS_ModeType - ModeVGA) << 2; - data2 |= data3; - } - } -#ifdef TWDEBUG - xf86DrvMsg(0, X_INFO, "Debug: Mode infoflag = %x, Chiptype %d\n", - data, HwDeviceExtension->jChipType); -#endif - if(data & InterlaceMode) data2 |= 0x20; - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x06,0xC0,data2); - - if(SiS_Pr->UseCustomMode) { - xres = SiS_Pr->CHDisplay; - } else { - resindex = SiS_GetResInfo(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex); - if(ModeNo <= 0x13) { - xres = SiS_Pr->SiS_StResInfo[resindex].HTotal; - } else { - xres = SiS_Pr->SiS_ModeResInfo[resindex].HTotal; + if(SiS_Pr->SiS_ModeType > 0x02) { + data |= 0x02; + data |= ((SiS_Pr->SiS_ModeType - ModeVGA) << 2); } + if(infoflag & InterlaceMode) data |= 0x20; } + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x06,0xC0,data); - if(HwDeviceExtension->jChipType != SIS_300) { - data = 0x0000; + if(HwInfo->jChipType != SIS_300) { + data = 0; if(infoflag & InterlaceMode) { - if(xres == 1024) data = 0x0035; - else data = 0x0048; + if(xres <= 800) data = 0x0020; + else if(xres <= 1024) data = 0x0035; + else data = 0x0048; } - data2 = data & 0x00FF; - SiS_SetReg1(SiS_Pr->SiS_P3d4,0x19,data2); - data2 = (data & 0xFF00) >> 8; - SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x1a,0xFC,data2); + 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); } - if(HwDeviceExtension->jChipType == SIS_300) { - if(modeflag & LineCompareOff) { - SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x0F,0x08); - } else { - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x0F,0xF7); - } - } else if(HwDeviceExtension->jChipType < SIS_315H) { - if(modeflag & LineCompareOff) { - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0F,0xB7,0x08); - } else { - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x0F,0xB7); - } - /* 630 BIOS does something for mode 0x12 here */ + data = 0; + if(modeflag & LineCompareOff) data = 0x08; + if(HwInfo->jChipType == SIS_300) { + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0F,0xF7,data); } else { - if(modeflag & LineCompareOff) { - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0F,0xB7,0x08); - } else { - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x0F,0xB7); - } - } - - if(HwDeviceExtension->jChipType != SIS_300) { + 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); + } + +#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); -#ifdef SIS315H - /* TW: 315 BIOS sets SR17 at this point */ - if(HwDeviceExtension->jChipType == SIS_315PRO) { - data = SiS_Get310DRAMType(SiS_Pr,ROMAddr,HwDeviceExtension); - data = SiS_Pr->SiS_SR15[2][data]; - if(SiS_Pr->SiS_ModeType == ModeText) { - data &= 0xc7; - } else { - data2 = SiS_GetOffset(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex, - RefreshRateTableIndex,HwDeviceExtension); - data2 >>= 1; - if(infoflag & InterlaceMode) data2 >>= 1; - data3 = SiS_GetColorDepth(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex); - data3 >>= 1; - if(data3 == 0) data3++; - data2 /= data3; - if(data2 >= 0x50) { - data &= 0x0f; - data |= 0x50; - } - } - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x17,data); - } + } else if( (HwInfo->jChipType == SIS_330) || + ((HwInfo->jChipType == SIS_760) && (SiS_Pr->SiS_SysFlags & SF_760UMA))) { - /* TW: 330 BIOS sets SR17 at this point */ - if(HwDeviceExtension->jChipType == SIS_330) { - data = SiS_Get310DRAMType(SiS_Pr,ROMAddr,HwDeviceExtension); - data = SiS_Pr->SiS_SR15[2][data]; - if(SiS_Pr->SiS_ModeType <= ModeEGA) { - data &= 0xc7; - } else { - if(SiS_Pr->UseCustomMode) { - data2 = SiS_Pr->CSRClock; - } else { - data2 = SiS_GetVCLK2Ptr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex, - RefreshRateTableIndex,HwDeviceExtension); - data2 = SiS_Pr->SiS_VCLKData[data2].CLOCK; - } + 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; + } - data3 = SiS_GetColorDepth(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex); - data3 >>= 1; + data3 = SiS_GetColorDepth(SiS_Pr,ModeNo,ModeIdIndex) >> 1; + if(data3) data2 *= data3; - data2 *= data3; + longdata = SiS_GetMCLK(SiS_Pr, HwInfo) * 1024; - data3 = SiS_GetMCLK(SiS_Pr,ROMAddr, HwDeviceExtension); - data3 *= 1024; + data2 = longdata / data2; - data2 = data3 / data2; - - if(SiS_Pr->SiS_ModeType != Mode16Bpp) { - if(data2 >= 0x19c) data = 0xba; - else if(data2 >= 0x140) data = 0x7a; - else if(data2 >= 0x101) data = 0x3a; - else if(data2 >= 0xf5) data = 0x32; - else if(data2 >= 0xe2) data = 0x2a; - else if(data2 >= 0xc4) data = 0x22; - else if(data2 >= 0xac) data = 0x1a; - else if(data2 >= 0x9e) data = 0x12; - else if(data2 >= 0x8e) data = 0x0a; - else data = 0x02; - } else { - if(data2 >= 0x127) data = 0xba; - else data = 0x7a; - } - } - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x17,data); + 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 { + 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); } #endif data = 0x60; if(SiS_Pr->SiS_ModeType != ModeText) { - data ^= 0x60; - if(SiS_Pr->SiS_ModeType != ModeEGA) { - data ^= 0xA0; - } + data ^= 0x60; + if(SiS_Pr->SiS_ModeType != ModeEGA) { + data ^= 0xA0; + } } SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x21,0x1F,data); - SiS_SetVCLKState(SiS_Pr,ROMAddr,HwDeviceExtension,ModeNo,RefreshRateTableIndex,ModeIdIndex); + SiS_SetVCLKState(SiS_Pr, HwInfo, ModeNo, RefreshRateTableIndex, ModeIdIndex); #ifdef SIS315H - if(HwDeviceExtension->jChipType >= SIS_315H) { - if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x31) & 0x40) { - SiS_SetReg1(SiS_Pr->SiS_P3d4,0x52,0x2c); - } else { - SiS_SetReg1(SiS_Pr->SiS_P3d4,0x52,0x6c); - } + 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); + } } #endif } -/* TW: Checked against 300, 315, 330, 650/LVDS, 650/301LVx, 630/301B and 630/LVDS BIOS */ -void -SiS_SetVCLKState(SiS_Private *SiS_Pr, UCHAR *ROMAddr,PSIS_HW_DEVICE_INFO HwDeviceExtension, - USHORT ModeNo,USHORT RefreshRateTableIndex, - USHORT ModeIdIndex) -{ - USHORT data, data2=0; - USHORT VCLK, index=0; - - if (ModeNo <= 0x13) VCLK = 0; - else { - if(SiS_Pr->UseCustomMode) { - VCLK = SiS_Pr->CSRClock; - } else { - index = SiS_GetVCLK2Ptr(SiS_Pr,ROMAddr,ModeNo,ModeIdIndex, - RefreshRateTableIndex,HwDeviceExtension); - VCLK = SiS_Pr->SiS_VCLKData[index].CLOCK; - } - } - - if(HwDeviceExtension->jChipType < SIS_315H) { /* 300 series */ - - data2 = 0x00; - if(VCLK > 150) data2 |= 0x80; - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x07,0x7B,data2); /* DAC speed */ - - data2 = 0x00; - if(VCLK >= 150) data2 |= 0x08; /* VCLK > 150 */ - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x32,0xF7,data2); +/*********************************************/ +/* LOAD DAC */ +/*********************************************/ - } else { /* 310/325 series */ - - data = 0; - if(VCLK >= 166) data |= 0x0c; /* TW: Was 200; is 166 in 650, 315 and 330 BIOSes */ - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x32,0xf3,data); +#if 0 +static void +SiS_ClearDAC(SiS_Private *SiS_Pr, ULONG port) +{ + int i; - if(VCLK >= 166) { /* TW: Was 200, is 166 in 650, 315 and 330 BIOSes */ - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1f,0xe7); - } -#if 0 /* Not done in 315 and 650/301LV/LVDS BIOSes: */ - data = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1F); /* DAC pedestal */ - data &= 0xE7; - if(VCLK<200) data |= 0x10; - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1F,data); /* DAC pedestal */ + OutPortByte(port, 0); + port++; + for (i=0; i < (256 * 3); i++) { + OutPortByte(port, 0); + } +} #endif - } - data2 = 0x03; - if((VCLK >= 135) && (VCLK < 160)) data2 = 0x02; - if((VCLK >= 160) && (VCLK < 260)) data2 = 0x01; - if(VCLK >= 260) data2 = 0x00; +static void +SiS_WriteDAC(SiS_Private *SiS_Pr, SISIOADDRESS DACData, USHORT shiftflag, + USHORT dl, USHORT ah, USHORT al, USHORT dh) +{ + USHORT temp,bh,bl; - if(HwDeviceExtension->jChipType == SIS_540) { - if((VCLK == 203) || (VCLK < 234)) data2 = 0x02; + 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(HwDeviceExtension->jChipType < SIS_315H) { - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x07,0xFC,data2); /* DAC speed */ - } else { - if(HwDeviceExtension->jChipType > SIS_315PRO) { - /* TW: This "if" is done in 330 and 650/LVDS/301LV BIOSes; Not in 315 BIOS */ - if(ModeNo > 0x13) data2 &= 0xfc; - } - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x07,0xF8,data2); /* DAC speed */ + if(shiftflag) { + dh <<= 2; + bh <<= 2; + bl <<= 2; } + SiS_SetRegByte(DACData,(USHORT)dh); + SiS_SetRegByte(DACData,(USHORT)bh); + SiS_SetRegByte(DACData,(USHORT)bl); } -/* TW: Checked against 650/301LVx 1.10.6s, 315, 630/301B BIOS */ void -SiS_LoadDAC(SiS_Private *SiS_Pr,PSIS_HW_DEVICE_INFO HwDeviceExtension, - UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex) +SiS_LoadDAC(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, + USHORT ModeNo, USHORT ModeIdIndex) { USHORT data,data2; - USHORT time,i,j,k; - USHORT m,n,o; - USHORT si,di,bx,dl; - USHORT al,ah,dh; - USHORT DACAddr, DACData, shiftflag; + USHORT time,i,j,k,m,n,o; + USHORT si,di,bx,dl,al,ah,dh; + USHORT shiftflag; + SISIOADDRESS DACAddr, DACData; const USHORT *table = NULL; -#if 0 - USHORT tempah,tempch,tempcl,tempdh,tempal,tempbx; -#endif if(ModeNo <= 0x13) { - data = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + data = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; } else { - if(SiS_Pr->UseCustomMode) { - data = SiS_Pr->CModeFlag; - } else { - data = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - } + if(SiS_Pr->UseCustomMode) { + data = SiS_Pr->CModeFlag; + } else { + data = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + } } -#if 0 - if(!(ds:489 & 0x08)) { -#endif - - data &= DACInfoFlag; - time = 64; - if(data == 0x00) table = SiS_MDA_DAC; - if(data == 0x08) table = SiS_CGA_DAC; - if(data == 0x10) table = SiS_EGA_DAC; - if(data == 0x18) { - time = 256; - table = SiS_VGA_DAC; - } - if(time == 256) j = 16; - else j = time; + data &= DACInfoFlag; + time = 64; + if(data == 0x00) table = SiS_MDA_DAC; + if(data == 0x08) table = SiS_CGA_DAC; + if(data == 0x10) table = SiS_EGA_DAC; + if(data == 0x18) { + time = 256; + table = SiS_VGA_DAC; + } + if(time == 256) j = 16; + else j = time; + + if( ( (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) && /* 301B-DH LCD */ + (SiS_Pr->SiS_VBType & VB_NoLCD) ) || + (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) || /* LCDA */ + (!(SiS_Pr->SiS_SetFlag & ProgrammingCRT2)) ) { /* Programming CRT1 */ + DACAddr = SiS_Pr->SiS_P3c8; + DACData = SiS_Pr->SiS_P3c9; + shiftflag = 0; + SiS_SetRegByte(SiS_Pr->SiS_P3c6,0xFF); + } else { + shiftflag = 1; + DACAddr = SiS_Pr->SiS_Part5Port; + DACData = SiS_Pr->SiS_Part5Port + 1; + } + + SiS_SetRegByte(DACAddr,0x00); + + for(i=0; i>= 2; + } + } - if( ( (HwDeviceExtension->jChipType == SIS_630) && /* 630/301B LCD */ - (SiS_Pr->SiS_VBType & (VB_SIS301B | VB_SIS302B)) && - (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) ) || - (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) || /* LCDA */ - (!(SiS_Pr->SiS_SetFlag & ProgrammingCRT2)) ) { /* Programming CRT1 */ - DACAddr = SiS_Pr->SiS_P3c8; - DACData = SiS_Pr->SiS_P3c9; - shiftflag = 0; - SiS_SetReg3(SiS_Pr->SiS_P3c6,0xFF); - } else { - shiftflag = 1; - DACAddr = SiS_Pr->SiS_Part5Port; - DACData = SiS_Pr->SiS_Part5Port + 1; - } + if(time == 256) { + for(i = 16; i < 32; i++) { + data = table[i]; + if(shiftflag) data <<= 2; + 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]; + 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]; + si--; + SiS_WriteDAC(SiS_Pr, DACData, shiftflag, dl, ah, al, dh); + } + dl++; + } /* for n < 3 */ + si += 5; + } /* for m < 9 */ + } +} - SiS_SetReg3(DACAddr,0x00); +/*********************************************/ +/* SET CRT1 REGISTER GROUP */ +/*********************************************/ - for(i=0; i>= 2; - } - } +static void +SiS_SetCRT1Group(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, + USHORT ModeNo, USHORT ModeIdIndex) +{ + USHORT StandTableIndex,RefreshRateTableIndex; - if(time == 256) { - for(i = 16; i < 32; i++) { - data = table[i]; - if(shiftflag) data <<= 2; - for(k=0; k<3; k++) SiS_SetReg3(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]; - 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]; - si--; - SiS_WriteDAC(SiS_Pr,DACData,shiftflag,dl,ah,al,dh); - } - dl++; - } /* for n < 3 */ - si += 5; - } /* for m < 9 */ - } -#if 0 - } /* ds:489 & 0x08 */ -#endif + 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); + } + } -#if 0 - if((!(ds:489 & 0x08)) && (ds:489 & 0x06)) { - tempbx = 0; - for(i=0; i< 256; i++) { - SiS_SetReg3(SiS_Pr->SiS_P3c8-1,tempbx); /* 7f87 */ - tempah = SiS_GetReg3(SiS_Pr->SiS_P3c8+1); /* 7f83 */ - tempch = SiS_GetReg3(SiS_Pr->SiS_P3c8+1); - tempcl = SiS_GetReg3(SiS_Pr->SiS_P3c8+1); - tempdh = tempah; - tempal = 0x4d * tempdh; /* 7fb8 */ - tempbx += tempal; - tempal = 0x97 * tempch; - tempbx += tempal; - tempal = 0x1c * tempcl; - tempbx += tempal; - if((tempbx & 0x00ff) > 0x80) tempbx += 0x100; - tempdh = (tempbx & 0x00ff) >> 8; - tempch = tempdh; - tempcl = tempdh; - SiS_SetReg3(SiS_Pr->SiS_P3c8,(tempbx & 0xff)); /* 7f7c */ - SiS_SetReg3(SiS_Pr->SiS_P3c8+1,tempdh); /* 7f92 */ - SiS_SetReg3(SiS_Pr->SiS_P3c8+1,tempch); - SiS_SetReg3(SiS_Pr->SiS_P3c8+1,tempcl); - } - } -#endif -} + SiS_ResetSegmentRegisters(SiS_Pr, HwInfo); -void -SiS_WriteDAC(SiS_Private *SiS_Pr, USHORT DACData, USHORT shiftflag, - USHORT dl, USHORT ah, USHORT al, USHORT dh) -{ - USHORT temp; - USHORT bh,bl; + 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); - 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_SetReg3(DACData,(USHORT)dh); - SiS_SetReg3(DACData,(USHORT)bh); - SiS_SetReg3(DACData,(USHORT)bl); -} + SiS_Pr->SiS_SelectCRT2Rate = 0; + SiS_Pr->SiS_SetFlag &= (~ProgrammingCRT2); -static ULONG -GetDRAMSize(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension) -{ - ULONG AdapterMemorySize = 0; -#ifdef SIS315H - USHORT counter; +#ifdef LINUX_XF86 + xf86DrvMsgVerb(0, X_PROBED, 4, "(init: VBType=0x%04x, VBInfo=0x%04x)\n", + SiS_Pr->SiS_VBType, SiS_Pr->SiS_VBInfo); #endif -#ifdef SIS315H - if ((HwDeviceExtension->jChipType == SIS_315H) || - (HwDeviceExtension->jChipType == SIS_315) || - (HwDeviceExtension->jChipType == SIS_315PRO)) { - - counter = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14); - AdapterMemorySize = 1 << ((counter & 0xF0) >> 4); - counter >>= 2; - counter &= 0x03; - if(counter == 0x02) { - AdapterMemorySize += (AdapterMemorySize / 2); /* DDR asymetric */ - } else if(counter != 0) { - AdapterMemorySize <<= 1; /* SINGLE_CHANNEL_2_RANK or DUAL_CHANNEL_1_RANK */ - } - AdapterMemorySize *= (1024*1024); + if(SiS_Pr->SiS_VBInfo & SetSimuScanMode) { + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { + SiS_Pr->SiS_SetFlag |= ProgrammingCRT2; + } + } - } else if(HwDeviceExtension->jChipType == SIS_330) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { + SiS_Pr->SiS_SetFlag |= ProgrammingCRT2; + } - counter = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14); - AdapterMemorySize = 1 << ((counter & 0xF0) >> 4); - counter &= 0x0c; - if(counter != 0) { - AdapterMemorySize <<= 1; - } - AdapterMemorySize *= (1024*1024); + RefreshRateTableIndex = SiS_GetRatePtr(SiS_Pr, ModeNo, ModeIdIndex, HwInfo); - } else if((HwDeviceExtension->jChipType == SIS_550) || - (HwDeviceExtension->jChipType == SIS_740) || - (HwDeviceExtension->jChipType == SIS_650)) { + if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) { + SiS_Pr->SiS_SetFlag &= ~ProgrammingCRT2; + } - counter = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14) & 0x3F; - counter++; - AdapterMemorySize = counter * 4; - AdapterMemorySize *= (1024*1024); + 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); } -#endif #ifdef SIS300 - if ((HwDeviceExtension->jChipType==SIS_300) || - (HwDeviceExtension->jChipType==SIS_540) || - (HwDeviceExtension->jChipType==SIS_630) || - (HwDeviceExtension->jChipType==SIS_730)) { - - AdapterMemorySize = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14) & 0x3F; - AdapterMemorySize++; - AdapterMemorySize *= (1024*1024); - + 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); + } +#endif +#ifdef SIS315H + if(HwInfo->jChipType >= SIS_315H) { + SiS_SetCRT1FIFO_310(SiS_Pr, ModeNo, ModeIdIndex, HwInfo); } #endif - return AdapterMemorySize; -} + SiS_SetCRT1ModeRegs(SiS_Pr, HwInfo, ModeNo, ModeIdIndex, RefreshRateTableIndex); -#ifndef LINUX_XF86 -void -SiS_ClearBuffer(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT ModeNo) -{ - PVOID VideoMemoryAddress = (PVOID)HwDeviceExtension->pjVideoMemoryAddress; - ULONG AdapterMemorySize = (ULONG)HwDeviceExtension->ulVideoMemorySize; - PUSHORT pBuffer; - int i; + SiS_LoadDAC(SiS_Pr, HwInfo, ModeNo, ModeIdIndex); - if (SiS_Pr->SiS_ModeType>=ModeEGA) { - if(ModeNo > 0x13) { - AdapterMemorySize = GetDRAMSize(SiS_Pr, HwDeviceExtension); - SiS_SetMemory(VideoMemoryAddress,AdapterMemorySize,0); - } else { - pBuffer = VideoMemoryAddress; - for(i=0; i<0x4000; i++) - pBuffer[i] = 0x0000; - } - } else { - pBuffer = VideoMemoryAddress; - if (SiS_Pr->SiS_ModeType < ModeCGA) { - for(i=0; i<0x4000; i++) - pBuffer[i] = 0x0720; - } else { - SiS_SetMemory(VideoMemoryAddress,0x8000,0); - } +#ifndef LINUX_XF86 + if(SiS_Pr->SiS_flag_clearbuffer) { + SiS_ClearBuffer(SiS_Pr,HwInfo,ModeNo); } -} #endif -void -SiS_DisplayOn(SiS_Private *SiS_Pr) -{ - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x01,0xDF,0x00); -} - -void -SiS_DisplayOff(SiS_Private *SiS_Pr) -{ - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x01,0xDF,0x20); + if(!(SiS_Pr->SiS_VBInfo & (SetSimuScanMode | SwitchCRT2 | SetCRT2ToLCDA))) { + SiS_WaitRetrace1(SiS_Pr); + SiS_DisplayOn(SiS_Pr); + } } -/* ========================================== */ -/* SR CRTC GR */ -void -SiS_SetReg1(USHORT port, USHORT index, USHORT data) -{ - OutPortByte(port,index); - OutPortByte(port+1,data); -} -/* ========================================== */ -/* AR(3C0) */ -void -SiS_SetReg2(SiS_Private *SiS_Pr, USHORT port, USHORT index, USHORT data) -{ - InPortByte(port+0x3da-0x3c0); - OutPortByte(SiS_Pr->SiS_P3c0,index); - OutPortByte(SiS_Pr->SiS_P3c0,data); - OutPortByte(SiS_Pr->SiS_P3c0,0x20); -} +/*********************************************/ +/* HELPER: RESET VIDEO BRIDGE */ +/*********************************************/ -void -SiS_SetReg3(USHORT port, USHORT data) +static void +SiS_ResetVB(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) { - OutPortByte(port,data); -} + UCHAR *ROMAddr = HwInfo->pjVirtualRomBase; + USHORT temp; -void -SiS_SetReg4(USHORT port, ULONG data) -{ - OutPortLong(port,data); + if(SiS_Pr->SiS_UseROM) { + if(HwInfo->jChipType < 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]; + if(SiS_Pr->SiS_ROMNew) temp = ROMAddr[0x80]; + if(HwInfo->jChipType >= SIS_660) temp |= 0x40; + else if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x7b) >= 100) temp |= 0x40; + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x02,temp); + } + } } -void -SiS_SetReg5(USHORT port, USHORT data) -{ - OutPortWord(port,data); -} +/*********************************************/ +/* HELPER: SET VIDEO REGISTERS */ +/*********************************************/ -UCHAR SiS_GetReg1(USHORT port, USHORT index) +static void +SiS_StrangeStuff(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) { - UCHAR data; - - OutPortByte(port,index); - data = InPortByte(port+1); - - return(data); + if((IS_SIS651) || (IS_SISM650)) { + 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) */ + SiS_SetRegAND(SiS_Pr->SiS_VidPlay, 0x30, 0xfe); /* Fiddle with video regs */ + SiS_SetRegAND(SiS_Pr->SiS_VidPlay, 0x3f, 0xef); + } + /* !!! This does not support modes < 0x13 !!! */ } -UCHAR -SiS_GetReg2(USHORT port) -{ - UCHAR data; - - data= InPortByte(port); +/*********************************************/ +/* XFree86: SET SCREEN PITCH */ +/*********************************************/ - return(data); -} - -ULONG -SiS_GetReg3(USHORT port) +#ifdef LINUX_XF86 +static void +SiS_SetPitchCRT1(SiS_Private *SiS_Pr, ScrnInfoPtr pScrn) { - ULONG data; - - data = InPortLong(port); + SISPtr pSiS = SISPTR(pScrn); + UShort HDisplay = pSiS->scrnPitch >> 3; - return(data); + SiS_SetReg(SiS_Pr->SiS_P3d4,0x13,(HDisplay & 0xFF)); + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0E,0xF0,(HDisplay>>8)); } -USHORT -SiS_GetReg4(USHORT port) +static void +SiS_SetPitchCRT2(SiS_Private *SiS_Pr, ScrnInfoPtr pScrn) { - ULONG data; + SISPtr pSiS = SISPTR(pScrn); + UShort HDisplay = pSiS->scrnPitch2 >> 3; - data = InPortWord(port); + /* Unlock CRT2 */ + if(pSiS->VGAEngine == SIS_315_VGA) + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2F, 0x01); + else + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x24, 0x01); - return(data); + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x07,(HDisplay & 0xFF)); + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x09,0xF0,(HDisplay >> 8)); } -void -SiS_ClearDAC(SiS_Private *SiS_Pr, ULONG port) +static void +SiS_SetPitch(SiS_Private *SiS_Pr, ScrnInfoPtr pScrn) { - int i; + SISPtr pSiS = SISPTR(pScrn); + BOOLEAN isslavemode = FALSE; - OutPortByte(port, 0); - port++; - for (i=0; i < (256 * 3); i++) { - OutPortByte(port, 0); + if( (pSiS->VBFlags & VB_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) & 0x50) == 0x10) ) ) { + isslavemode = TRUE; } + /* We need to set pitch for CRT1 if bridge is in slave mode, too */ + if((pSiS->VBFlags & DISPTYPE_DISP1) || (isslavemode)) { + SiS_SetPitchCRT1(SiS_Pr, pScrn); + } + /* We must not set the pitch for CRT2 if bridge is in slave mode */ + if((pSiS->VBFlags & DISPTYPE_DISP2) && (!isslavemode)) { + SiS_SetPitchCRT2(SiS_Pr, pScrn); + } } +#endif -#if 0 /* TW: Unused */ -void -SiS_SetInterlace(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT RefreshRateTableIndex) +/*********************************************/ +/* SiSSetMode() */ +/*********************************************/ + +#ifdef LINUX_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) +#else +BOOLEAN +SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo) +#endif { - ULONG Temp; - USHORT data,Temp2; + USHORT ModeIdIndex; + SISIOADDRESS BaseAddr = HwInfo->ulIOAddress; + unsigned char backupreg=0; +#ifndef LINUX_XF86 + USHORT KeepLockReg; + ULONG temp; + + SiS_Pr->UseCustomMode = FALSE; + SiS_Pr->CRT1UsesCustomMode = FALSE; +#endif - if (ModeNo<=0x13) return; + if(SiS_Pr->UseCustomMode) { + ModeNo = 0xfe; + } - Temp = (ULONG)SiS_GetReg1(SiS_Pr->SiS_P3d4,0x01); - Temp++; - Temp <<= 3; + SiSInitPtr(SiS_Pr, HwInfo); + SiSRegInit(SiS_Pr, BaseAddr); + SiS_GetSysFlags(SiS_Pr, HwInfo); - if(Temp == 1024) data = 0x0035; - else if(Temp == 1280) data = 0x0048; - else data = 0x0000; +#if defined(LINUX_XF86) && (defined(i386) || defined(__i386) || defined(__i386__) || defined(__AMD64__)) + if(pScrn) SiS_Pr->SiS_VGAINFO = SiS_GetSetBIOSScratch(pScrn, 0x489, 0xff); + else +#endif + SiS_Pr->SiS_VGAINFO = 0x11; - Temp2 = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag; - Temp2 &= InterlaceMode; - if(Temp2 == 0) data=0x0000; + SiSInitPCIetc(SiS_Pr, HwInfo); + SiSSetLVDSetc(SiS_Pr, HwInfo); + SiSDetermineROMUsage(SiS_Pr, HwInfo); - SiS_SetReg1(SiS_Pr->SiS_P3d4,0x19,data); + SiS_Pr->SiS_flag_clearbuffer = 0; - Temp = (ULONG)SiS_GetReg1(SiS_Pr->SiS_P3d4,0x1A); - Temp = (USHORT)(Temp & 0xFC); - SiS_SetReg1(SiS_Pr->SiS_P3d4,0x1A,(USHORT)Temp); + if(!SiS_Pr->UseCustomMode) { +#ifndef LINUX_XF86 + if(!(ModeNo & 0x80)) SiS_Pr->SiS_flag_clearbuffer = 1; +#endif + ModeNo &= 0x7f; + } - Temp = (ULONG)SiS_GetReg1(SiS_Pr->SiS_P3c4,0x0f); - Temp2 = (USHORT)Temp & 0xBF; - if(ModeNo==0x37) Temp2 |= 0x40; - SiS_SetReg1(SiS_Pr->SiS_P3d4,0x1A,(USHORT)Temp2); -} +#ifndef LINUX_XF86 + KeepLockReg = SiS_GetReg(SiS_Pr->SiS_P3c4,0x05); #endif + SiS_SetReg(SiS_Pr->SiS_P3c4,0x05,0x86); -/* TW: Checked against 330, 650/LVDS (1.10.07), 650/301LVx (1.10.6s) and 315 BIOS */ -#ifdef SIS315H -void -SiS_SetCRT1FIFO_310(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,USHORT ModeIdIndex, - PSIS_HW_DEVICE_INFO HwDeviceExtension) -{ - USHORT modeflag; + SiS_UnLockCRT2(SiS_Pr, HwInfo); - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x3D,0xFE); /* disable auto-threshold */ + if(!SiS_Pr->UseCustomMode) { + if(!(SiS_SearchModeID(SiS_Pr, &ModeNo, &ModeIdIndex))) return FALSE; + } else { + ModeIdIndex = 0; + } - if(ModeNo > 0x13) { - if(SiS_Pr->UseCustomMode) { - modeflag = SiS_Pr->CModeFlag; - } else { - modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - } - if( (!(modeflag & DoubleScanMode)) || (!(modeflag & HalfDCLK))) { - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x08,0x34); - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x09,0xF0); - SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x3D,0x01); - } else { - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x08,0xAE); - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x09,0xF0); - } - } else { - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x08,0xAE); - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x09,0xF0); - } -} -#endif + SiS_GetVBType(SiS_Pr, HwInfo); -#ifdef SIS300 -void -SiS_SetCRT1FIFO_300(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo,PSIS_HW_DEVICE_INFO HwDeviceExtension, - USHORT RefreshRateTableIndex) -{ - USHORT ThresholdLow = 0; - USHORT index, VCLK, MCLK, colorth=0; - USHORT tempah, temp; + /* Init/restore some VB registers */ - if(ModeNo > 0x13) { + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + if(HwInfo->jChipType >= SIS_315H) { + SiS_ResetVB(SiS_Pr, HwInfo); + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x32,0x10); + SiS_SetRegOR(SiS_Pr->SiS_Part2Port,0x00,0x0c); + backupreg = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38); + } else { + backupreg = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35); + } + } - 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 */ - } + /* 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); - 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; - } +#ifndef LINUX_XF86 + /* 3. Check memory size (Kernel framebuffer driver only) */ + temp = SiS_CheckMemorySize(SiS_Pr, HwInfo, ModeNo, ModeIdIndex); + if(!temp) return(0); +#endif - index = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x3A); - index &= 0x07; - MCLK = SiS_Pr->SiS_MCLKData_0[index].CLOCK; /* Get MCLK */ + if(HwInfo->jChipType >= SIS_315H) { + SiS_SetupCR5x(SiS_Pr, HwInfo); + } - tempah = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x35); - tempah &= 0xc3; - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x16,0x3c,tempah); + if(SiS_Pr->UseCustomMode) { + SiS_Pr->CRT1UsesCustomMode = TRUE; + SiS_Pr->CSRClock_CRT1 = SiS_Pr->CSRClock; + SiS_Pr->CModeFlag_CRT1 = SiS_Pr->CModeFlag; + } else { + SiS_Pr->CRT1UsesCustomMode = FALSE; + } - do { - ThresholdLow = SiS_CalcDelay(SiS_Pr, ROMAddr, VCLK, colorth, MCLK); - ThresholdLow++; - if(ThresholdLow < 0x13) break; - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x16,0xfc); - ThresholdLow = 0x13; - tempah = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16); - tempah >>= 6; - if(!(tempah)) break; - tempah--; - tempah <<= 6; - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x16,0x3f,tempah); - } while(0); + /* Set mode on CRT1 */ + if( (SiS_Pr->SiS_VBInfo & (SetSimuScanMode | SetCRT2ToLCDA)) || + (!(SiS_Pr->SiS_VBInfo & SwitchCRT2)) ) { + SiS_SetCRT1Group(SiS_Pr, HwInfo, ModeNo, ModeIdIndex); + } - } else ThresholdLow = 2; + /* 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); + } + } - /* Write CRT/CPU threshold low, CRT/Engine threshold high */ - temp = (ThresholdLow << 4) | 0x0f; - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x08,temp); + SiS_HandleCRT1(SiS_Pr); - temp = (ThresholdLow & 0x10) << 1; - if(ModeNo > 0x13) temp |= 0x40; - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0f,0x9f,temp); + SiS_StrangeStuff(SiS_Pr, HwInfo); - /* What is this? */ - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x3B,0x09); + SiS_DisplayOn(SiS_Pr); + SiS_SetRegByte(SiS_Pr->SiS_P3c6,0xFF); - /* Write CRT/CPU threshold high */ - temp = ThresholdLow + 3; - if(temp > 0x0f) temp = 0x0f; - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x09,temp); -} + if(HwInfo->jChipType >= SIS_315H) { + if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { + if(!(SiS_IsDualEdge(SiS_Pr, HwInfo))) { + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x13,0xfb); + } + } + } -USHORT -SiS_CalcDelay(SiS_Private *SiS_Pr, UCHAR *ROMAddr, USHORT VCLK, USHORT colordepth, USHORT MCLK) -{ - USHORT tempax, tempbx; + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + if(HwInfo->jChipType >= SIS_315H) { + if(!SiS_Pr->SiS_ROMNew) { + if(SiS_IsVAMode(SiS_Pr,HwInfo)) { + SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x35,0x01); + } else { + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x35,0xFE); + } + } - 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); -} + SiS_SetReg(SiS_Pr->SiS_P3d4,0x38,backupreg); -USHORT -SiS_DoCalcDelay(SiS_Private *SiS_Pr, USHORT MCLK, USHORT VCLK, USHORT colordepth, USHORT key) -{ - const UCHAR ThLowA[] = { 61, 3,52, 5,68, 7,100,11, - 43, 3,42, 5,54, 7, 78,11, - 34, 3,37, 5,47, 7, 67,11 }; + if((IS_SIS650) && (SiS_GetReg(SiS_Pr->SiS_P3d4,0x30) & 0xfc)) { + if((ModeNo == 0x03) || (ModeNo == 0x10)) { + SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x51,0x80); + SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x56,0x08); + } + } - 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 }; + 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); + } + } - const UCHAR ThTiming[] = { 1, 2, 2, 3, 0, 1, 1, 2 }; +#ifdef LINUX_XF86 + if(pScrn) { + /* SetPitch: Adapt to virtual size & position */ + if((ModeNo > 0x13) && (dosetpitch)) { + SiS_SetPitch(SiS_Pr, pScrn); + } - USHORT tempah, tempal, tempcl, tempbx, temp; - ULONG longtemp; + /* Backup/Set ModeNo in BIOS scratch area */ + SiS_GetSetModeID(pScrn, ModeNo); + } +#endif - tempah = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x18); - tempah &= 0x62; - tempah >>= 1; - tempal = tempah; - tempah >>= 3; - tempal |= tempah; - tempal &= 0x07; - tempcl = ThTiming[tempal]; - tempbx = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16); - tempbx >>= 6; - tempah = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14); - tempah >>= 4; - tempah &= 0x0c; - tempbx |= tempah; - tempbx <<= 1; - if(key == 0) { - tempal = ThLowA[tempbx + 1]; - tempal *= tempcl; - tempal += ThLowA[tempbx]; - } else { - tempal = ThLowB[tempbx + 1]; - tempal *= tempcl; - tempal += ThLowB[tempbx]; - } - longtemp = tempal * VCLK * colordepth; - temp = longtemp % (MCLK * 16); - longtemp /= (MCLK * 16); - if(temp) longtemp++; - return((USHORT)longtemp); +#ifndef LINUX_XF86 /* 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); +#endif + + return TRUE; } -#if 0 /* TW: Old fragment, unused */ -USHORT -SiS_CalcDelay(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT key) -{ - USHORT data,data2,temp0,temp1; - UCHAR ThLowA[]= {61,3,52,5,68,7,100,11, - 43,3,42,5,54,7, 78,11, - 34,3,37,5,47,7, 67,11}; - - UCHAR ThLowB[]= {81,4,72,6,88,8,120,12, - 55,4,54,6,66,8, 90,12, - 42,4,45,6,55,8, 75,12}; - - UCHAR ThTiming[]= {1,2,2,3,0,1,1,2}; - - data=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x16); - data=data>>6; - data2=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14); - data2=(data2>>4)&0x0C; - data=data|data2; - data=data<1; - if(key==0) { - temp0=(USHORT)ThLowA[data]; - temp1=(USHORT)ThLowA[data+1]; - } else { - temp0=(USHORT)ThLowB[data]; - temp1=(USHORT)ThLowB[data+1]; - } +/*********************************************/ +/* XFree86: SiSBIOSSetMode() */ +/* for non-Dual-Head mode */ +/*********************************************/ - data2=0; - data=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x18); - if(data&0x02) data2=data2|0x01; - if(data&0x20) data2=data2|0x02; - if(data&0x40) data2=data2|0x04; +#ifdef LINUX_XF86 +BOOLEAN +SiSBIOSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn, + DisplayModePtr mode, BOOLEAN IsCustom) +{ + SISPtr pSiS = SISPTR(pScrn); + UShort ModeNo=0; + + SiS_Pr->UseCustomMode = FALSE; - data=temp1*ThTiming[data2]+temp0; - return(data); -} -#endif + if((IsCustom) && (SiS_CheckBuildCustomMode(pScrn, mode, pSiS->VBFlags))) { -void -SiS_SetCRT1FIFO_630(SiS_Private *SiS_Pr, UCHAR *ROMAddr,USHORT ModeNo, - PSIS_HW_DEVICE_INFO HwDeviceExtension, - USHORT RefreshRateTableIndex) -{ - USHORT i,index,data,VCLK,MCLK,colorth=0; - ULONG B,eax,bl,data2; - USHORT ThresholdLow=0; - UCHAR FQBQData[]= { - 0x01,0x21,0x41,0x61,0x81, - 0x31,0x51,0x71,0x91,0xb1, - 0x00,0x20,0x40,0x60,0x80, - 0x30,0x50,0x70,0x90,0xb0, - 0xFF - }; - UCHAR FQBQData730[]= { - 0x34,0x74,0xb4, - 0x23,0x63,0xa3, - 0x12,0x52,0x92, - 0x01,0x41,0x81, - 0x00,0x40,0x80, - 0xff - }; + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "Setting custom mode %dx%d\n", + SiS_Pr->CHDisplay, + (mode->Flags & V_INTERLACE ? SiS_Pr->CVDisplay * 2 : + (mode->Flags & V_DBLSCAN ? SiS_Pr->CVDisplay / 2 : + SiS_Pr->CVDisplay))); - 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 */ - } + return(SiSSetMode(SiS_Pr, HwInfo, pScrn, ModeNo, TRUE)); - index = SiS_GetReg1(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; - } + ModeNo = SiS_CalcModeIndex(pScrn, mode, pSiS->VBFlags, pSiS->HaveCustomModes); + if(!ModeNo) return FALSE; - if(HwDeviceExtension->jChipType == SIS_730) { - - do { - B = SiS_CalcDelay2(SiS_Pr, ROMAddr, FQBQData730[i], HwDeviceExtension) * VCLK * colorth; - bl = B / (MCLK * 16); + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "Setting standard mode 0x%x\n", ModeNo); - if(B == bl * 16 * MCLK) { - bl = bl + 1; - } else { - bl = bl + 2; - } + return(SiSSetMode(SiS_Pr, HwInfo, pScrn, ModeNo, TRUE)); +} - if(bl > 0x13) { - if(FQBQData730[i+1] == 0xFF) { - ThresholdLow = 0x13; - break; - } - i++; - } else { - ThresholdLow = bl; - break; - } - } while(FQBQData730[i] != 0xFF); - - } else { - - do { - B = SiS_CalcDelay2(SiS_Pr, ROMAddr, FQBQData[i], HwDeviceExtension) * VCLK * colorth; - bl = B / (MCLK * 16); +/*********************************************/ +/* XFree86: SiSBIOSSetModeCRT2() */ +/* for Dual-Head modes */ +/*********************************************/ +BOOLEAN +SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn, + DisplayModePtr mode, BOOLEAN IsCustom) +{ + USHORT ModeIdIndex; + SISIOADDRESS BaseAddr = HwInfo->ulIOAddress; + UShort ModeNo = 0; + unsigned char backupreg=0; + SISPtr pSiS = SISPTR(pScrn); +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = pSiS->entityPrivate; +#endif - if(B == bl * 16 * MCLK) { - bl = bl + 1; - } else { - bl = bl + 2; - } + SiS_Pr->UseCustomMode = FALSE; - if(bl > 0x13) { - if(FQBQData[i+1] == 0xFF) { - ThresholdLow = 0x13; - break; - } - i++; - } else { - ThresholdLow = bl; - break; - } - } while(FQBQData[i] != 0xFF); - } - } - else { - if(HwDeviceExtension->jChipType == SIS_730) { - } else { - i = 9; - } - ThresholdLow = 0x02; - } + /* Remember: Custom modes for CRT2 are ONLY supported + * -) on 315/330 series, + * -) on the 30x/B/C, and + * -) if CRT2 is LCD or VGA + */ - /* Write foreground and background queue */ - if(HwDeviceExtension->jChipType == SIS_730) { - - data2 = FQBQData730[i]; - data2 = (data2 & 0xC0) >> 5; - data2 <<= 8; + if((IsCustom) && (SiS_CheckBuildCustomMode(pScrn, mode, pSiS->VBFlags))) { -#ifndef LINUX_XF86 - SiS_SetReg4(0xcf8,0x80000050); - eax = SiS_GetReg3(0xcfc); - eax &= 0xfffff9ff; - eax |= data2; - SiS_SetReg4(0xcfc,eax); -#else - /* We use pci functions X offers. We use pcitag 0, because - * we want to read/write to the host bridge (which is always - * 00:00.0 on 630, 730 and 540), not the VGA device. - */ - eax = pciReadLong(0x00000000, 0x50); - eax &= 0xfffff9ff; - eax |= data2; - pciWriteLong(0x00000000, 0x50, eax); -#endif + ModeNo = 0xfe; - /* Write GUI grant timer (PCI config 0xA3) */ - data2 = FQBQData730[i] << 8; - data2 = (data2 & 0x0f00) | ((data2 & 0x3000) >> 8); - data2 <<= 20; - -#ifndef LINUX_XF86 - SiS_SetReg4(0xcf8,0x800000A0); - eax = SiS_GetReg3(0xcfc); - eax &= 0x00ffffff; - eax |= data2; - SiS_SetReg4(0xcfc,eax); -#else - eax = pciReadLong(0x00000000, 0xA0); - eax &= 0x00ffffff; - eax |= data2; - pciWriteLong(0x00000000, 0xA0, eax); -#endif + } else { - } else { - - data2 = FQBQData[i]; - data2 = (data2 & 0xf0) >> 4; - data2 <<= 24; + BOOLEAN havecustommodes = pSiS->HaveCustomModes; -#ifndef LINUX_XF86 - SiS_SetReg4(0xcf8,0x80000050); - eax = SiS_GetReg3(0xcfc); - eax &= 0xf0ffffff; - eax |= data2; - SiS_SetReg4(0xcfc,eax); -#else - eax = pciReadLong(0x00000000, 0x50); - eax &= 0xf0ffffff; - eax |= data2; - pciWriteLong(0x00000000, 0x50, eax); +#ifdef SISMERGED + if(pSiS->MergedFB) havecustommodes = pSiS->HaveCustomModes2; #endif - /* Write GUI grant timer (PCI config 0xA3) */ - data2 = FQBQData[i]; - data2 &= 0x0f; - data2 <<= 24; + ModeNo = SiS_CalcModeIndex(pScrn, mode, pSiS->VBFlags, havecustommodes); + if(!ModeNo) return FALSE; -#ifndef LINUX_XF86 - SiS_SetReg4(0xcf8,0x800000A0); - eax = SiS_GetReg3(0xcfc); - eax &= 0xf0ffffff; - eax |= data2; - SiS_SetReg4(0xcfc,eax); + } + + SiSRegInit(SiS_Pr, BaseAddr); + SiSInitPtr(SiS_Pr, HwInfo); + SiS_GetSysFlags(SiS_Pr, HwInfo); +#if (defined(i386) || defined(__i386) || defined(__i386__) || defined(__AMD64__)) + SiS_Pr->SiS_VGAINFO = SiS_GetSetBIOSScratch(pScrn, 0x489, 0xff); #else - eax = pciReadLong(0x00000000, 0xA0); - eax &= 0xf0ffffff; - eax |= data2; - pciWriteLong(0x00000000, 0xA0, eax); + SiS_Pr->SiS_VGAINFO = 0x11; #endif - - } + SiSInitPCIetc(SiS_Pr, HwInfo); + SiSSetLVDSetc(SiS_Pr, HwInfo); + SiSDetermineROMUsage(SiS_Pr, HwInfo); - /* Write CRT/CPU threshold low, CRT/Engine threshold high */ - data = ((ThresholdLow & 0x0f) << 4) | 0x0f; - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x08,data); + /* Save mode info so we can set it from within SetMode for CRT1 */ +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode) { + pSiSEnt->CRT2ModeNo = ModeNo; + pSiSEnt->CRT2DMode = mode; + pSiSEnt->CRT2IsCustom = IsCustom; + pSiSEnt->CRT2CR30 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30); + pSiSEnt->CRT2CR31 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x31); + 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 */ + if(pSiSEnt->CRT1ModeNo == -1) { + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "Setting CRT2 mode delayed until after setting CRT1 mode\n"); + return TRUE; + } +#endif + pSiSEnt->CRT2ModeSet = TRUE; + } +#endif - data = (ThresholdLow & 0x10) << 1; - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0F,0xDF,data); + /* We don't clear the buffer under X */ + SiS_Pr->SiS_flag_clearbuffer=0; - /* What is this? */ - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x3B,0x09); + if(SiS_Pr->UseCustomMode) { - /* Write CRT/CPU threshold high (gap = 3) */ - data = ThresholdLow + 3; - if(data > 0x0f) data = 0x0f; - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x09,0x80,data); -} + USHORT temptemp = SiS_Pr->CVDisplay; -USHORT -SiS_CalcDelay2(SiS_Private *SiS_Pr, UCHAR *ROMAddr,UCHAR key, PSIS_HW_DEVICE_INFO HwDeviceExtension) -{ - 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(SiS_Pr->CModeFlag & DoubleScanMode) temptemp >>= 1; + else if(SiS_Pr->CInfoFlag & InterlaceMode) temptemp <<= 1; - if(HwDeviceExtension->jChipType == SIS_730) { - index = ((key & 0x0f) * 3) + ((key & 0xC0) >> 6); - data = LatencyFactor730[index]; - } else { - index = (key & 0xE0) >> 5; - if(key & 0x10) index +=6; - if(!(key & 0x01)) index += 24; - data = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x14); - if(data & 0x0080) index += 12; - data = LatencyFactor[index]; - } - return(data); -} -#endif + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "Setting custom mode %dx%d on CRT2\n", + SiS_Pr->CHDisplay, temptemp); -/* =============== Autodetection ================ */ -/* I N C O M P L E T E */ + } else { -BOOLEAN -SiS_GetPanelID(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension) -{ - const USHORT PanelTypeTable300[16] = { - 0xc101, 0xc117, 0x0121, 0xc135, 0xc142, 0xc152, 0xc162, 0xc072, - 0xc181, 0xc192, 0xc1a1, 0xc1b6, 0xc1c2, 0xc0d2, 0xc1e2, 0xc1f2 - }; - const USHORT PanelTypeTable31030x[16] = { - 0xc102, 0xc112, 0x0122, 0xc132, 0xc142, 0xc152, 0xc169, 0xc179, - 0x0189, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 - }; - const USHORT PanelTypeTable310LVDS[16] = { - 0xc111, 0xc122, 0xc133, 0xc144, 0xc155, 0xc166, 0xc177, 0xc188, - 0xc199, 0xc0aa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 - }; - USHORT tempax,tempbx,tempah,temp; + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "Setting standard mode 0x%x on CRT2\n", ModeNo); + + } + + SiS_SetReg(SiS_Pr->SiS_P3c4,0x05,0x86); - if(HwDeviceExtension->jChipType < SIS_315H) { + SiS_UnLockCRT2(SiS_Pr, HwInfo); - tempax = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x18); - tempbx = tempax & 0x0F; - if(!(tempax & 0x10)){ - if(SiS_Pr->SiS_IF_DEF_LVDS == 1){ - tempbx = 0; - temp = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x38); - if(temp & 0x40) tempbx |= 0x08; - if(temp & 0x20) tempbx |= 0x02; - if(temp & 0x01) tempbx |= 0x01; - temp = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x39); - if(temp & 0x80) tempbx |= 0x04; + if(!SiS_Pr->UseCustomMode) { + if(!(SiS_SearchModeID(SiS_Pr, &ModeNo, &ModeIdIndex))) return FALSE; + } else { + ModeIdIndex = 0; + } + + SiS_GetVBType(SiS_Pr, HwInfo); + + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + if(HwInfo->jChipType >= SIS_315H) { + SiS_ResetVB(SiS_Pr, HwInfo); + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x32,0x10); + SiS_SetRegOR(SiS_Pr->SiS_Part2Port,0x00,0x0c); + backupreg = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38); } else { - return 0; + backupreg = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35); } - } - tempbx = PanelTypeTable300[tempbx]; - tempbx |= LCDSync; - temp = tempbx & 0x00FF; - SiS_SetReg1(SiS_Pr->SiS_P3d4,0x36,temp); - temp = (tempbx & 0xFF00) >> 8; - SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x37,~(LCDSyncBit|LCDRGB18Bit),temp); + } - } else { + /* Get VB information (connectors, connected devices) */ + if(!SiS_Pr->UseCustomMode) { + SiS_GetVBInfo(SiS_Pr, ModeNo, ModeIdIndex, HwInfo, 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_SetYPbPr(SiS_Pr, HwInfo); + SiS_SetTVMode(SiS_Pr, ModeNo, ModeIdIndex, HwInfo); + SiS_GetLCDResInfo(SiS_Pr, ModeNo, ModeIdIndex, HwInfo); + SiS_SetLowModeTest(SiS_Pr, ModeNo, HwInfo); - tempax = tempah = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1a); - tempax &= 0x1e; - tempax >>= 1; - if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { - if(tempax == 0) { - /* TODO: Include HUGE detection routine - (Probably not worth bothering) - */ - return 0; - } - temp = tempax & 0xff; - tempax--; - tempbx = PanelTypeTable310LVDS[tempax]; - } else { - tempbx = PanelTypeTable31030x[tempax]; - temp = tempbx & 0xff; - } - SiS_SetReg1(SiS_Pr->SiS_P3d4,0x36,temp); - tempbx = (tempbx & 0xff00) >> 8; - temp = tempbx & 0xc1; - SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x37,~(LCDSyncBit|LCDRGB18Bit),temp); - if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { - temp = tempbx & 0x04; - SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x39,0xfb,temp); - } + /* 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); + } - } - return 1; -} + SiS_StrangeStuff(SiS_Pr, HwInfo); + SiS_DisplayOn(SiS_Pr); + SiS_SetRegByte(SiS_Pr->SiS_P3c6,0xFF); -#ifdef LINUXBIOS + if(HwInfo->jChipType >= SIS_315H) { + if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { + if(!(SiS_IsDualEdge(SiS_Pr, HwInfo))) { + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x13,0xfb); + } + } + } -void -SiS_DetectMonitor(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,USHORT BaseAddr) -{ - UCHAR DAC_TEST_PARMS[] = {0x0F,0x0F,0x0F}; - UCHAR DAC_CLR_PARMS[] = {0x00,0x00,0x00}; - USHORT SR1F; - - SR1F = SiS_GetReg1(SiS_Pr->SiS_P3c4,0x1F); /* backup DAC pedestal */ - SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1F,0x04); - - if(SiS_Pr->SiS_IF_DEF_LVDS == 0) { - if(!(SiS_BridgeIsOn(SiS_Pr, BaseAddr))) { - SiS_SetReg1(SiS_Pr->SiS_P3d4,0x30,0x41); - } - } + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + if(HwInfo->jChipType >= SIS_315H) { + if(!SiS_Pr->SiS_ROMNew) { + if(SiS_IsVAMode(SiS_Pr,HwInfo)) { + SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x35,0x01); + } else { + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x35,0xFE); + } + } - SiSSetMode(SiS_Pr,HwDeviceExtension,0x2E); - if(HwDeviceExtension->jChipType >= SIS_650) { - /* TW: On 650 only - enable CRT1 */ - SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x63,0xbf); - } - SiS_SetReg3(SiS_Pr->SiS_P3c6,0xff); - SiS_ClearDAC(SiS_Pr, SiS_Pr->SiS_P3c8); - SiS_LongWait(SiS_Pr); - SiS_LongWait(SiS_Pr); - SiS_LongWait(SiS_Pr); - SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x32,0xDF,0x00); - if(SiS_TestMonitorType(SiS_Pr, DAC_TEST_PARMS[0],DAC_TEST_PARMS[1],DAC_TEST_PARMS[2])) { - SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x32,0xDF,0x20); - } else if(SiS_TestMonitorType(SiS_Pr, DAC_TEST_PARMS[0],DAC_TEST_PARMS[1],DAC_TEST_PARMS[2])) { - SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x32,0xDF,0x20); - } - SiS_TestMonitorType(SiS_Pr, DAC_CLR_PARMS[0],DAC_CLR_PARMS[1],DAC_CLR_PARMS[2]); + SiS_SetReg(SiS_Pr->SiS_P3d4,0x38,backupreg); - SiS_SetReg1(SiS_Pr->SiS_P3c4,0x1F,SR1F); -} + 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); + } + } -USHORT -SiS_TestMonitorType(SiS_Private *SiS_Pr, UCHAR R_DAC,UCHAR G_DAC,UCHAR B_DAC) -{ - USHORT temp,tempbx; + /* SetPitch: Adapt to virtual size & position */ + SiS_SetPitchCRT2(SiS_Pr, pScrn); - tempbx = R_DAC * 0x4d + G_DAC * 0x97 + B_DAC * 0x1c; - if((tempbx & 0x00ff) > 0x80) tempbx += 0x100; - tempbx = (tempbx & 0xFF00) >> 8; - R_DAC = (UCHAR) tempbx; - G_DAC = (UCHAR) tempbx; - B_DAC = (UCHAR) tempbx; - - SiS_SetReg3(SiS_Pr->SiS_P3c8,0x00); - SiS_SetReg3(SiS_Pr->SiS_P3c9,R_DAC); - SiS_SetReg3(SiS_Pr->SiS_P3c9,G_DAC); - SiS_SetReg3(SiS_Pr->SiS_P3c9,B_DAC); - SiS_LongWait(SiS_Pr); - temp=SiS_GetReg2(SiS_Pr->SiS_P3c2); - if(temp & 0x10) return(1); - else return(0); + return TRUE; } -void -SiS_GetSenseStatus(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension,UCHAR *ROMAddr) -{ - USHORT tempax=0,tempbx,tempcx,temp; - USHORT P2reg0=0,SenseModeNo=0,OutputSelect=*SiS_Pr->pSiS_OutputSelect; - USHORT ModeIdIndex,i; - USHORT BaseAddr = (USHORT)HwDeviceExtension->ulIOAddress; - - if(SiS_Pr->SiS_IF_DEF_LVDS == 1){ - SiS_GetPanelID(SiS_Pr); - temp=LCDSense; - temp=temp|SiS_SenseCHTV(SiS_Pr); - tempbx=~(LCDSense|AVIDEOSense|SVIDEOSense); - SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x32,tempbx,temp); - } else { /* for 301 */ - if(SiS_Pr->SiS_IF_DEF_HiVision==1) { /* for HiVision */ - tempax=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x38); - temp=tempax&0x01; - tempax=SiS_GetReg1(SiS_Pr->SiS_P3c4,0x3A); - temp=temp|(tempax&0x02); - SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x32,0xA0,temp); - } else { - if(SiS_BridgeIsOn(SiS_Pr, BaseAddr)==0) { /* TW: Inserted "==0" */ - P2reg0 = SiS_GetReg1(SiS_Pr->SiS_Part2Port,0x00); - if(!(SiS_BridgeIsEnable(SiS_Pr, BaseAddr,HwDeviceExtension))) { - SenseModeNo=0x2e; - temp = SiS_SearchModeID(SiS_Pr, ROMAddr,&SenseModeNo,&ModeIdIndex); - SiS_Pr->SiS_SetFlag = 0x00; - SiS_Pr->SiS_ModeType = ModeVGA; - SiS_Pr->SiS_VBInfo = SetCRT2ToRAMDAC |LoadDACFlag |SetInSlaveMode; - SiS_SetCRT2Group301(SiS_Pr, BaseAddr,ROMAddr,SenseModeNo,HwDeviceExtension); - for(i=0;i<20;i++) { - SiS_LongWait(SiS_Pr); - } - } - SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x00,0x1c); - tempax=0; - tempbx=*SiS_Pr->pSiS_RGBSenseData; - if(SiS_Is301B(SiS_Pr, BaseAddr)){ - tempbx=*SiS_Pr->pSiS_RGBSenseData2; - } - tempcx=0x0E08; - if(SiS_Sense(SiS_Pr, tempbx,tempcx)){ - if(SiS_Sense(SiS_Pr, tempbx,tempcx)){ - tempax=tempax|Monitor2Sense; - } - } - tempbx=*SiS_Pr->pSiS_YCSenseData; - if(SiS_Is301B(SiS_Pr, BaseAddr)){ - tempbx=*SiS_Pr->pSiS_YCSenseData2; - } - tempcx=0x0604; - if(SiS_Sense(SiS_Pr, tempbx,tempcx)){ - if(SiS_Sense(SiS_Pr,tempbx,tempcx)){ - tempax=tempax|SVIDEOSense; - } - } +/*********************************************/ +/* XFree86: SiSBIOSSetModeCRT1() */ +/* for Dual-Head modes */ +/*********************************************/ - if(ROMAddr && SiS_Pr->SiS_UseROM) { -#ifdef SIS300 - if((HwDeviceExtension->jChipType==SIS_630)|| - (HwDeviceExtension->jChipType==SIS_730)) { - OutputSelect = ROMAddr[0xfe]; - } -#endif -#ifdef SIS315H - if(HwDeviceExtension->jChipType >= SIS_315H) { - OutputSelect = ROMAddr[0xf3]; - if(HwDeviceExtension->jChipType == SIS_330) { - OutputSelect = ROMAddr[0x11b]; - } - } +BOOLEAN +SiSBIOSSetModeCRT1(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn, + DisplayModePtr mode, BOOLEAN IsCustom) +{ + SISPtr pSiS = SISPTR(pScrn); + SISIOADDRESS BaseAddr = HwInfo->ulIOAddress; + USHORT ModeIdIndex, ModeNo=0; + UCHAR backupreg=0; +#ifdef SISDUALHEAD + SISEntPtr pSiSEnt = pSiS->entityPrivate; + UCHAR backupcr30, backupcr31, backupcr38, backupcr35, backupp40d=0; + BOOLEAN backupcustom; #endif - } - if(OutputSelect & BoardTVType){ - tempbx = *SiS_Pr->pSiS_VideoSenseData; - if(SiS_Is301B(SiS_Pr, BaseAddr)){ - tempbx = *SiS_Pr->pSiS_VideoSenseData2; - } - tempcx = 0x0804; - if(SiS_Sense(SiS_Pr, tempbx,tempcx)){ - if(SiS_Sense(SiS_Pr, tempbx,tempcx)){ - tempax |= AVIDEOSense; - } - } - } else { - if(!(tempax & SVIDEOSense)){ - tempbx = *SiS_Pr->pSiS_VideoSenseData; - if(SiS_Is301B(SiS_Pr, BaseAddr)){ - tempbx = *SiS_Pr->pSiS_VideoSenseData2; - } - tempcx = 0x0804; - if(SiS_Sense(SiS_Pr,tempbx,tempcx)){ - if(SiS_Sense(SiS_Pr, tempbx,tempcx)){ - tempax |= AVIDEOSense; - } - } - } - } - } - if(SiS_SenseLCD(SiS_Pr, HwDeviceExtension)){ - tempax |= LCDSense; - } + SiS_Pr->UseCustomMode = FALSE; - tempbx=0; - tempcx=0; - SiS_Sense(SiS_Pr, tempbx,tempcx); - - if(SiS_Pr->SiS_VBType & (VB_SIS30xLV|VB_SIS30xNEW)) { - tempax &= 0x00ef; /* 301lv to disable CRT2*/ - } - SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x32,~0xDF,tempax); - SiS_SetReg1(SiS_Pr->SiS_Part2Port,0x00,P2reg0); - if(!(P2reg0 & 0x20)) { - SiS_Pr->SiS_VBInfo = DisableCRT2Display; - SiS_SetCRT2Group301(SiS_Pr,BaseAddr,ROMAddr,SenseModeNo,HwDeviceExtension); - } - } - } -} + if((IsCustom) && (SiS_CheckBuildCustomMode(pScrn, mode, pSiS->VBFlags))) { + + USHORT temptemp = SiS_Pr->CVDisplay; -BOOLEAN -SiS_Sense(SiS_Private *SiS_Pr, USHORT tempbx,USHORT tempcx) -{ - USHORT temp,i,tempch; + if(SiS_Pr->CModeFlag & DoubleScanMode) temptemp >>= 1; + else if(SiS_Pr->CInfoFlag & InterlaceMode) temptemp <<= 1; - temp = tempbx & 0xFF; - SiS_SetReg1(SiS_Pr->SiS_Part4Port,0x11,temp); - temp = (tempbx & 0xFF00) >> 8; - temp |= (tempcx & 0x00FF); - SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x10,~0x1F,temp); - - for(i=0; i<10; i++) SiS_LongWait(SiS_Pr); - - tempch = (tempcx & 0x7F00) >> 8; - temp = SiS_GetReg1(SiS_Pr->SiS_Part4Port,0x03); - temp ^= 0x0E; - temp &= tempch; - if(temp>0) return 1; - else return 0; -} + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "Setting custom mode %dx%d on CRT1\n", + SiS_Pr->CHDisplay, temptemp); + ModeNo = 0xfe; -USHORT -SiS_SenseLCD(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension) -{ - USHORT temp; + } else { - temp=SiS_GetPanelID(SiS_Pr); - if(!temp) temp=SiS_GetLCDDDCInfo(SiS_Pr, HwDeviceExtension); - return(temp); -} + ModeNo = SiS_CalcModeIndex(pScrn, mode, pSiS->VBFlags, pSiS->HaveCustomModes); + if(!ModeNo) return FALSE; -BOOLEAN -SiS_GetLCDDDCInfo(SiS_Private *SiS_Pr, PSIS_HW_DEVICE_INFO HwDeviceExtension) -{ - USHORT temp; - /*add lcd sense*/ - if(HwDeviceExtension->ulCRT2LCDType==LCD_UNKNOWN) - return 0; - else{ - temp=(USHORT)HwDeviceExtension->ulCRT2LCDType; - SiS_SetReg1(SiS_Pr->SiS_P3d4,0x36,temp); - return 1; - } -} + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "Setting standard mode 0x%x on CRT1\n", ModeNo); + } -USHORT -SiS_SenseCHTV(SiS_Private *SiS_Pr) -{ - USHORT temp,push0e,status; + SiSInitPtr(SiS_Pr, HwInfo); + SiSRegInit(SiS_Pr, BaseAddr); + SiS_GetSysFlags(SiS_Pr, HwInfo); +#if (defined(i386) || defined(__i386) || defined(__i386__) || defined(__AMD64__)) + 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); - status=0; - push0e = SiS_GetCH700x(SiS_Pr, 0x0e); - push0e = (push0e << 8) | 0x0e; - SiS_SetCH700x(SiS_Pr, 0x0b0e); - SiS_SetCH700x(SiS_Pr, 0x0110); - SiS_SetCH700x(SiS_Pr, 0x0010); - temp = SiS_GetCH700x(SiS_Pr, 0x10); - if(temp & 0x08) status |= SVIDEOSense; - if(temp & 0x02) status |= AVIDEOSense; - SiS_SetCH700x(SiS_Pr, push0e); - return(status); -} -#endif /* LINUXBIOS */ + /* We don't clear the buffer under X */ + SiS_Pr->SiS_flag_clearbuffer = 0; -/* ================ for TC only ================= */ + SiS_SetReg(SiS_Pr->SiS_P3c4,0x05,0x86); -#ifdef TC + SiS_UnLockCRT2(SiS_Pr, HwInfo); -int -INT1AReturnCode(union REGS regs) -{ - if (regs.x.cflag) - { - /*printf("Error to find pci device!\n"); */ - return 1; - } - - switch(regs.h.ah) - { - case 0: return 0; - break; - case 0x81: printf("Function not support\n"); - break; - case 0x83: printf("bad vendor id\n"); - break; - case 0x86: printf("device not found\n"); - break; - case 0x87: printf("bad register number\n"); - break; - case 0x88: printf("set failed\n"); - break; - case 0x89: printf("buffer too small"); - break; - } - return 1; -} + if(!SiS_Pr->UseCustomMode) { + if(!(SiS_SearchModeID(SiS_Pr, &ModeNo, &ModeIdIndex))) return FALSE; + } else { + ModeIdIndex = 0; + } -unsigned -FindPCIIOBase(unsigned index,unsigned deviceid) -{ - union REGS regs; + /* Determine VBType */ + SiS_GetVBType(SiS_Pr, HwInfo); - regs.h.ah = 0xb1; /*PCI_FUNCTION_ID */ - regs.h.al = 0x02; /*FIND_PCI_DEVICE */ - regs.x.cx = deviceid; - regs.x.dx = 0x1039; - regs.x.si = index; /* find n-th device */ - - int86(0x1A, ®s, ®s); - - if (INT1AReturnCode(regs)!=0) - return 0; - - /* regs.h.bh *//* bus number */ - /* regs.h.bl *//* device number */ - regs.h.ah = 0xb1; /*PCI_FUNCTION_ID */ - regs.h.al = 0x09; /*READ_CONFIG_WORD */ - regs.x.cx = deviceid; - regs.x.dx = 0x1039; - regs.x.di = 0x18; /* register number */ - int86(0x1A, ®s, ®s); - - if (INT1AReturnCode(regs)!=0) - return 0; - return regs.x.cx; -} + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + if(HwInfo->jChipType >= SIS_315H) { + backupreg = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38); + } else { + backupreg = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35); + } + } + /* 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); -void -main(int argc, char *argv[]) -{ - SIS_HW_DEVICE_INFO HwDeviceExtension; - USHORT temp; - USHORT ModeNo; + if(HwInfo->jChipType >= SIS_315H) { + SiS_SetupCR5x(SiS_Pr, HwInfo); + } + + /* Set mode on CRT1 */ + SiS_SetCRT1Group(SiS_Pr, HwInfo, ModeNo, ModeIdIndex); + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { + SiS_SetCRT2Group(SiS_Pr, HwInfo, ModeNo); + } - /*HwDeviceExtension.pjVirtualRomBase =(PUCHAR) MK_FP(0xC000,0); */ - /*HwDeviceExtension.pjVideoMemoryAddress = (PUCHAR)MK_FP(0xA000,0);*/ + /* SetPitch: Adapt to virtual size & position */ + SiS_SetPitchCRT1(SiS_Pr, pScrn); -#ifdef SIS300 - HwDeviceExtension.ulIOAddress = (FindPCIIOBase(0,0x6300)&0xFF80) + 0x30; - HwDeviceExtension.jChipType = SIS_630; +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode) { + pSiSEnt->CRT1ModeNo = ModeNo; + pSiSEnt->CRT1DMode = mode; + } #endif -#ifdef SIS315H -// HwDeviceExtension.ulIOAddress = (FindPCIIOBase(0,0x5315)&0xFF80) + 0x30; -// HwDeviceExtension.jChipType = SIS_550; - HwDeviceExtension.ulIOAddress = (FindPCIIOBase(0,0x325)&0xFF80) + 0x30; - HwDeviceExtension.jChipType = SIS_315H; + if(SiS_Pr->UseCustomMode) { + SiS_Pr->CRT1UsesCustomMode = TRUE; + SiS_Pr->CSRClock_CRT1 = SiS_Pr->CSRClock; + SiS_Pr->CModeFlag_CRT1 = SiS_Pr->CModeFlag; + } else { + SiS_Pr->CRT1UsesCustomMode = FALSE; + } + + /* Reset CRT2 if changing mode on CRT1 */ +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode) { + if(pSiSEnt->CRT2ModeNo != -1) { + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "(Re-)Setting mode for CRT2\n"); + backupcustom = SiS_Pr->UseCustomMode; + backupcr30 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30); + backupcr31 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x31); + backupcr35 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35); + backupcr38 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38); + if(SiS_Pr->SiS_VBType & VB_SISVB) { + /* Backup LUT-enable */ + if(pSiSEnt->CRT2ModeSet) { + backupp40d = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x0d) & 0x08; + } + } + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { + SiS_SetReg(SiS_Pr->SiS_P3d4,0x30,pSiSEnt->CRT2CR30); + SiS_SetReg(SiS_Pr->SiS_P3d4,0x31,pSiSEnt->CRT2CR31); + 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, + pSiSEnt->CRT2DMode, pSiSEnt->CRT2IsCustom); + 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); + if(SiS_Pr->SiS_VBType & VB_SISVB) { + SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x0d, ~0x08, backupp40d); + } + SiS_Pr->UseCustomMode = backupcustom; + } + } #endif - HwDeviceExtension.ujVBChipID = VB_CHIP_301; - strcpy(HwDeviceExtension.szVBIOSVer,"0.84"); - HwDeviceExtension.bSkipDramSizing = FALSE; - HwDeviceExtension.ulVideoMemorySize = 0; - if(argc==2) { - ModeNo=atoi(argv[1]); - } - else { - ModeNo=0x2e; - /*ModeNo=0x37; */ /* 1024x768x 4bpp */ - /*ModeNo=0x38; *//* 1024x768x 8bpp */ - /*ModeNo=0x4A; *//* 1024x768x 16bpp */ - /*ModeNo=0x47;*/ /* 800x600x 16bpp */ - } - /* SiSInit(SiS_Pr, &HwDeviceExtension);*/ - SiSSetMode(SiS_Pr, &HwDeviceExtension, ModeNo); -} -#endif /* TC END */ + /* Warning: From here, the custom mode entries in SiS_Pr are + * possibly overwritten + */ -/* ================ LINUX XFREE86 ====================== */ + SiS_HandleCRT1(SiS_Pr); -/* Helper functions */ + SiS_StrangeStuff(SiS_Pr, HwInfo); -#ifdef LINUX_XF86 -USHORT -SiS_CalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode) -{ - SISPtr pSiS = SISPTR(pScrn); - UShort i = (pSiS->CurrentLayout.bitsPerPixel+7)/8 - 1; - UShort ModeIndex = 0; + SiS_DisplayOn(SiS_Pr); + SiS_SetRegByte(SiS_Pr->SiS_P3c6,0xFF); - if((pSiS->HaveCustomModes) && (!(mode->type & M_T_DEFAULT))) - return 0xfe; - - switch(mode->HDisplay) - { - case 320: - if(mode->VDisplay == 480) { - ModeIndex = ModeIndex_320x480[i]; - } - break; - case 512: - if(mode->VDisplay == 384) { - ModeIndex = ModeIndex_512x384[i]; - } - break; - case 640: - if(mode->VDisplay == 480) { - ModeIndex = ModeIndex_640x480[i]; - } else if(mode->VDisplay == 400) { - ModeIndex = ModeIndex_640x400[i]; - } - break; - case 720: - if(mode->VDisplay == 480) { - ModeIndex = ModeIndex_720x480[i]; - } else if(mode->VDisplay == 576) { - ModeIndex = ModeIndex_720x576[i]; - } - break; - case 800: - if(mode->VDisplay == 600) { - ModeIndex = ModeIndex_800x600[i]; - } else if(mode->VDisplay == 480) { - ModeIndex = ModeIndex_800x480[i]; - } - break; - case 848: - if(mode->VDisplay == 480) { - ModeIndex = ModeIndex_848x480[i]; - } - break; - case 856: - if(mode->VDisplay == 480) { - ModeIndex = ModeIndex_856x480[i]; - } - break; - case 1024: - if(mode->VDisplay == 768) { - ModeIndex = ModeIndex_1024x768[i]; - } else if(mode->VDisplay == 576) { - ModeIndex = ModeIndex_1024x576[i]; - } else if(pSiS->VGAEngine == SIS_300_VGA) { - if(mode->VDisplay == 600) { - ModeIndex = ModeIndex_1024x600[i]; - } - } - break; - case 1152: - if(mode->VDisplay == 864) { - ModeIndex = ModeIndex_1152x864[i]; - } else if(pSiS->VGAEngine == SIS_300_VGA) { - if(mode->VDisplay == 768) { - ModeIndex = ModeIndex_1152x768[i]; - } - } - break; - case 1280: - if(mode->VDisplay == 960) { - if(pSiS->VGAEngine == SIS_300_VGA) { - ModeIndex = ModeIndex_300_1280x960[i]; - } else { - ModeIndex = ModeIndex_310_1280x960[i]; - } - } else if (mode->VDisplay == 1024) { - ModeIndex = ModeIndex_1280x1024[i]; - } else if (mode->VDisplay == 720) { - ModeIndex = ModeIndex_1280x720[i]; - } else if(pSiS->VGAEngine == SIS_315_VGA) { - if (mode->VDisplay == 768) { - ModeIndex = ModeIndex_1280x768[i]; - } - } - break; - case 1360: - if(mode->VDisplay == 768) { - ModeIndex = ModeIndex_1360x768[i]; - } - break; - case 1400: - if(pSiS->VGAEngine == SIS_315_VGA) { - if(mode->VDisplay == 1050) { - ModeIndex = ModeIndex_1400x1050[i]; - } - } - break; - case 1600: - if(mode->VDisplay == 1200) { - ModeIndex = ModeIndex_1600x1200[i]; - } - break; - case 1920: - if(mode->VDisplay == 1440) { - ModeIndex = ModeIndex_1920x1440[i]; - } - break; - case 2048: - if(mode->VDisplay == 1536) { - if(pSiS->VGAEngine == SIS_300_VGA) { - ModeIndex = ModeIndex_300_2048x1536[i]; - } else { - ModeIndex = ModeIndex_310_2048x1536[i]; - } - } - break; + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + if(HwInfo->jChipType >= SIS_315H) { + SiS_SetReg(SiS_Pr->SiS_P3d4,0x38,backupreg); + } else if((HwInfo->jChipType == SIS_630) || + (HwInfo->jChipType == SIS_730)) { + SiS_SetReg(SiS_Pr->SiS_P3d4,0x35,backupreg); + } } - return(ModeIndex); + /* Backup/Set ModeNo in BIOS scratch area */ + SiS_GetSetModeID(pScrn,ModeNo); + + return TRUE; } +#endif /* Linux_XF86 */ -USHORT -SiS_CheckCalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode, int VBFlags) -{ - SISPtr pSiS = SISPTR(pScrn); - UShort i = (pSiS->CurrentLayout.bitsPerPixel+7)/8 - 1; - UShort ModeIndex = 0; - if(VBFlags & CRT2_LCD) { +#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( (mode->HDisplay <= pSiS->LCDwidth) && - (mode->VDisplay <= pSiS->LCDheight) ) { + if(HwInfo->jChipType < SIS_315H) { - if(VBFlags & VB_LVDS) { /* LCD on LVDS */ - - switch(mode->HDisplay) - { - case 512: - if(mode->VDisplay == 384) { - if(pSiS->LCDwidth != 1024 || pSiS->LCDheight != 600) { /* not supported on 1024x600 panels */ - ModeIndex = ModeIndex_512x384[i]; - } - } - break; - case 640: - if(mode->VDisplay == 480) { - ModeIndex = ModeIndex_640x480[i]; - } else if(mode->VDisplay == 400) { - ModeIndex = ModeIndex_640x400[i]; - } - break; - case 800: - if(mode->VDisplay == 600) { - ModeIndex = ModeIndex_800x600[i]; - } - break; - case 1024: - if(mode->VDisplay == 768) { - ModeIndex = ModeIndex_1024x768[i]; - } else if(pSiS->VGAEngine == SIS_300_VGA) { - if(mode->VDisplay == 600) { - if(pSiS->LCDheight == 600) { /* This mode only supported on 1024x600 panels */ - ModeIndex = ModeIndex_1024x600[i]; - } - } - } - break; - case 1152: - if(pSiS->VGAEngine == SIS_300_VGA) { - if(mode->VDisplay == 768) { - ModeIndex = ModeIndex_1152x768[i]; - } - } - break; - case 1280: - if(mode->VDisplay == 1024) { - ModeIndex = ModeIndex_1280x1024[i]; - } else if(pSiS->VGAEngine == SIS_315_VGA) { - if(mode->VDisplay == 768) { - ModeIndex = ModeIndex_1280x768[i]; - } - } - break; - case 1400: - if(mode->VDisplay == 1050) { - if(pSiS->VGAEngine == SIS_315_VGA) { - ModeIndex = ModeIndex_1400x1050[i]; - } - } - break; - } + 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 { /* LCD on 301(B) */ + } else { - switch(mode->HDisplay) - { - case 512: - if(mode->VDisplay == 384) { - ModeIndex = ModeIndex_512x384[i]; - } - break; - case 640: - if(mode->VDisplay == 480) { - ModeIndex = ModeIndex_640x480[i]; - } else if(mode->VDisplay == 400) { - ModeIndex = ModeIndex_640x400[i]; - } - break; - case 800: - if(mode->VDisplay == 600) { - ModeIndex = ModeIndex_800x600[i]; - } - break; - case 1024: - if(mode->VDisplay == 768) { - ModeIndex = ModeIndex_1024x768[i]; - } - break; - case 1280: - if(mode->VDisplay == 960) { - if(pSiS->VGAEngine == SIS_300_VGA) { - ModeIndex = ModeIndex_300_1280x960[i]; - } else { - ModeIndex = ModeIndex_310_1280x960[i]; - } - } else if (mode->VDisplay == 1024) { - ModeIndex = ModeIndex_1280x1024[i]; - } - break; - case 1400: - if(mode->VDisplay == 1050) { - if(pSiS->VGAEngine == SIS_315_VGA) { - ModeIndex = ModeIndex_1400x1050[i]; - } - } - break; - case 1600: - if(mode->VDisplay == 1200) { - ModeIndex = ModeIndex_1600x1200[i]; - } - break; - } + 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 - } else if(VBFlags & CRT2_TV) { +#ifndef GETBITSTR +#define BITMASK(h,l) (((unsigned)(1U << ((h)-(l)+1))-1)<<(l)) +#define GENMASK(mask) BITMASK(1?mask,0?mask) +#define GETBITS(var,mask) (((var) & GENMASK(mask)) >> (0?mask)) +#define GETBITSTR(val,from,to) ((GETBITS(val,from)) << (0?to)) +#endif - if(VBFlags & VB_CHRONTEL) { /* TV on Chrontel */ +static void +SiS_CalcCRRegisters(SiS_Private *SiS_Pr, int depth) +{ + 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->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) + | 0x10 + | (((SiS_Pr->CVTotal - 2) & 0x200) >> 4) + | (((SiS_Pr->CVDisplay - 1) & 0x200) >> 3) + | ((SiS_Pr->CVSyncStart & 0x200) >> 2); + + SiS_Pr->CCRT1CRTC[16] = ((((SiS_Pr->CVBlankStart - 1) & 0x200) >> 4) >> 5); /* CR9 */ + + if(depth != 8) { + if(SiS_Pr->CHDisplay >= 1600) SiS_Pr->CCRT1CRTC[16] |= 0x60; /* SRE */ + else if(SiS_Pr->CHDisplay >= 640) SiS_Pr->CCRT1CRTC[16] |= 0x40; + } - switch(mode->HDisplay) - { - case 512: - if(pSiS->VGAEngine == SIS_315_VGA) { - if(mode->VDisplay == 384) { - ModeIndex = ModeIndex_512x384[i]; - } - } - break; - case 640: - if(mode->VDisplay == 480) { - ModeIndex = ModeIndex_640x480[i]; - } else if(mode->VDisplay == 400) { - ModeIndex = ModeIndex_640x400[i]; - } - break; - case 800: - if(mode->VDisplay == 600) { - ModeIndex = ModeIndex_800x600[i]; - } - break; - case 1024: - if(mode->VDisplay == 768) { - if(pSiS->VGAEngine == SIS_315_VGA) { - ModeIndex = ModeIndex_1024x768[i]; - } - } - break; - } +#if 0 + if (mode->VScan >= 32) + regp->CRTC[9] |= 0x1F; + else if (mode->VScan > 1) + regp->CRTC[9] |= mode->VScan - 1; +#endif - } else { /* TV on 301(B/LV) */ + SiS_Pr->CCRT1CRTC[8] = (SiS_Pr->CVSyncStart ) & 0xFF; /* CR10 */ + SiS_Pr->CCRT1CRTC[9] = ((SiS_Pr->CVSyncEnd ) & 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 */ - switch(mode->HDisplay) - { - case 512: - if(mode->VDisplay == 384) { - ModeIndex = ModeIndex_512x384[i]; - } - break; - case 640: - if(mode->VDisplay == 480) { - ModeIndex = ModeIndex_640x480[i]; - } - break; - case 720: - if(mode->VDisplay == 480) { - ModeIndex = ModeIndex_720x480[i]; - } else if(mode->VDisplay == 576) { - ModeIndex = ModeIndex_720x576[i]; - } - break; - case 800: - if(mode->VDisplay == 600) { - ModeIndex = ModeIndex_800x600[i]; - } - break; - case 1024: /* Not supported with depth 32 */ - if((mode->VDisplay == 768) && (i != 3) ) { - if(VBFlags & (VB_301B|VB_302B|VB_30xLV|VB_30xLVX)) { - ModeIndex = ModeIndex_1024x768[i]; - } - } - break; - } + 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) ; + + 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) ; + + + 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) ; +} + +void +SiS_CalcLCDACRT1Timing(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex) +{ + USHORT modeflag, tempax, tempbx, 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; + } - } else if(VBFlags & CRT2_VGA) { /* CRT2 is VGA2 */ + if(modeflag & HalfDCLK) VGAHDE >>= 1; - switch(mode->HDisplay) - { - case 640: - if(mode->VDisplay == 480) { - ModeIndex = ModeIndex_640x480[i]; - } else if(mode->VDisplay == 400) { - ModeIndex = ModeIndex_640x400[i]; - } - break; - case 800: - if(mode->VDisplay == 600) { - ModeIndex = ModeIndex_800x600[i]; - } else if(mode->VDisplay == 480) { - ModeIndex = ModeIndex_800x480[i]; - } - break; - case 848: - if(mode->VDisplay == 480) { - ModeIndex = ModeIndex_848x480[i]; - } - break; - case 856: - if(mode->VDisplay == 480) { - ModeIndex = ModeIndex_856x480[i]; - } - break; - case 1024: - if(mode->VDisplay == 768) { - ModeIndex = ModeIndex_1024x768[i]; - } else if(mode->VDisplay == 576) { - ModeIndex = ModeIndex_1024x576[i]; - } - break; - case 1152: - if(mode->VDisplay == 864) { - ModeIndex = ModeIndex_1152x864[i]; - } else if(pSiS->VGAEngine == SIS_300_VGA) { - if(mode->VDisplay == 768) { - ModeIndex = ModeIndex_1152x768[i]; - } - } - break; - case 1280: - if (mode->VDisplay == 1024) { - ModeIndex = ModeIndex_1280x1024[i]; - } else if (mode->VDisplay == 720) { - ModeIndex = ModeIndex_1280x720[i]; - } else if(pSiS->VGAEngine == SIS_315_VGA) { - if (mode->VDisplay == 768) { - ModeIndex = ModeIndex_1280x768[i]; - } - } - break; - } + SiS_Pr->CHDisplay = VGAHDE; + SiS_Pr->CHBlankStart = VGAHDE; - } else { /* CRT1 only, no CRT2 */ + SiS_Pr->CVDisplay = SiS_Pr->SiS_VGAVDE; + SiS_Pr->CVBlankStart = SiS_Pr->SiS_VGAVDE; - ModeIndex = SiS_CalcModeIndex(pScrn, mode); + 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; + 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); } - return(ModeIndex); + 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; + } + SiS_Pr->CVTotal = SiS_Pr->CVBlankEnd = tempbx + tempax; + + tempax = SiS_Pr->SiS_VGAVDE; + if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { + tempax += (SiS_Pr->PanelYRes - tempax) >> 1; + } + tempax += SiS_Pr->PanelVRS; + SiS_Pr->CVSyncStart = tempax; + tempax += SiS_Pr->PanelVRE; + SiS_Pr->CVSyncEnd = tempax; + + SiS_CalcCRRegisters(SiS_Pr, 8); + SiS_Pr->CCRT1CRTC[16] &= ~0xE0; + + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x11,0x7f); + + 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]); + } + + tempax = SiS_Pr->CCRT1CRTC[16] & 0xE0; + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0E,0x1F,tempax); + + tempax = (SiS_Pr->CCRT1CRTC[16] & 0x01) << 5; + if(modeflag & DoubleScanMode) tempax |= 0x80; + SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,0x5F,tempax); + +#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->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[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[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 } +/* ================ XFREE86 ================= */ + +/* Helper functions */ + +#ifdef LINUX_XF86 + USHORT SiS_CheckBuildCustomMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int VBFlags) { SISPtr pSiS = SISPTR(pScrn); int out_n, out_dn, out_div, out_sbit, out_scale; int depth = pSiS->CurrentLayout.bitsPerPixel; - -#ifdef SISDUALHEAD - if( ((!pSiS->DualHeadMode) && (VBFlags & DISPTYPE_DISP2)) || - ((pSiS->DualHeadMode) && (!pSiS->SecondHead)) ) return 0; -#else - if(VBFlags & DISPTYPE_DISP2) return 0; -#endif + unsigned int vclk[5]; + +#define Midx 0 +#define Nidx 1 +#define VLDidx 2 +#define Pidx 3 +#define PSNidx 4 + + 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->CHBlankStart = pSiS->SiS_Pr->CHDisplay; - pSiS->SiS_Pr->CHBlankEnd = pSiS->SiS_Pr->CHTotal; - + pSiS->SiS_Pr->CVDisplay = mode->VDisplay; pSiS->SiS_Pr->CVSyncStart = mode->VSyncStart; pSiS->SiS_Pr->CVSyncEnd = mode->VSyncEnd; pSiS->SiS_Pr->CVTotal = mode->VTotal; + + pSiS->SiS_Pr->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; + } + + 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; - - pSiS->SiS_Pr->CFlags = mode->Flags; - SiS_compute_vclk(pSiS->SiS_Pr->CDClock, &out_n, &out_dn, &out_div, &out_sbit, &out_scale); - + if(SiS_compute_vclk(pSiS->SiS_Pr->CDClock, &out_n, &out_dn, &out_div, &out_sbit, &out_scale)) { + pSiS->SiS_Pr->CSR2B = (out_div == 2) ? 0x80 : 0x00; + pSiS->SiS_Pr->CSR2B |= ((out_n - 1) & 0x7f); + pSiS->SiS_Pr->CSR2C = (out_dn - 1) & 0x1f; + pSiS->SiS_Pr->CSR2C |= (((out_scale - 1) & 3) << 5); + pSiS->SiS_Pr->CSR2C |= ((out_sbit & 0x01) << 7); +#ifdef TWDEBUG + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Clock %d: n %d dn %d div %d sb %d sc %d\n", + pSiS->SiS_Pr->CDClock, out_n, out_dn, out_div, out_sbit, out_scale); +#endif + } else { + SiSCalcClock(pScrn, pSiS->SiS_Pr->CDClock, 2, vclk); + pSiS->SiS_Pr->CSR2B = (vclk[VLDidx] == 2) ? 0x80 : 0x00; + pSiS->SiS_Pr->CSR2B |= (vclk[Midx] - 1) & 0x7f; + pSiS->SiS_Pr->CSR2C = (vclk[Nidx] - 1) & 0x1f; + if(vclk[Pidx] <= 4) { + /* postscale 1,2,3,4 */ + pSiS->SiS_Pr->CSR2C |= ((vclk[Pidx] - 1) & 3) << 5; + } else { + /* postscale 6,8 */ + pSiS->SiS_Pr->CSR2C |= (((vclk[Pidx] / 2) - 1) & 3) << 5; + pSiS->SiS_Pr->CSR2C |= 0x80; + } #ifdef TWDEBUG - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Clock %d: n %d dn %d div %d sb %d sc %d\n", - pSiS->SiS_Pr->CDClock, out_n, out_dn, out_div, out_sbit, out_scale); -#endif - - pSiS->SiS_Pr->CSR2B = (out_div == 2) ? 0x80 : 0x00; - pSiS->SiS_Pr->CSR2B |= ((out_n - 1) & 0x7f); - pSiS->SiS_Pr->CSR2C = (out_dn - 1) & 0x1f; - pSiS->SiS_Pr->CSR2C |= (((out_scale - 1) & 3) << 5); - pSiS->SiS_Pr->CSR2C |= ((out_sbit & 0x01) << 7); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Clock %d: n %d dn %d div %d sc %d\n", + pSiS->SiS_Pr->CDClock, vclk[Midx], vclk[Nidx], vclk[VLDidx], vclk[Pidx]); +#endif + } + pSiS->SiS_Pr->CSRClock = (pSiS->SiS_Pr->CDClock / 1000) + 1; - pSiS->SiS_Pr->CCRT1CRTC[0] = ((pSiS->SiS_Pr->CHTotal >> 3) - 5) & 0xff; - pSiS->SiS_Pr->CCRT1CRTC[1] = (pSiS->SiS_Pr->CHDisplay >> 3) - 1; - pSiS->SiS_Pr->CCRT1CRTC[2] = (pSiS->SiS_Pr->CHBlankStart >> 3) - 1; - pSiS->SiS_Pr->CCRT1CRTC[3] = (((pSiS->SiS_Pr->CHBlankEnd >> 3) - 1) & 0x1F) | 0x80; - pSiS->SiS_Pr->CCRT1CRTC[4] = (pSiS->SiS_Pr->CHSyncStart >> 3) + 3; - pSiS->SiS_Pr->CCRT1CRTC[5] = ((((pSiS->SiS_Pr->CHBlankEnd >> 3) - 1) & 0x20) << 2) | - (((pSiS->SiS_Pr->CHSyncEnd >> 3) + 3) & 0x1F); - - pSiS->SiS_Pr->CCRT1CRTC[6] = (pSiS->SiS_Pr->CVTotal - 2) & 0xFF; - pSiS->SiS_Pr->CCRT1CRTC[7] = (((pSiS->SiS_Pr->CVTotal - 2) & 0x100) >> 8) - | (((pSiS->SiS_Pr->CVDisplay - 1) & 0x100) >> 7) - | ((pSiS->SiS_Pr->CVSyncStart & 0x100) >> 6) - | (((pSiS->SiS_Pr->CVBlankStart - 1) & 0x100) >> 5) - | 0x10 - | (((pSiS->SiS_Pr->CVTotal - 2) & 0x200) >> 4) - | (((pSiS->SiS_Pr->CVDisplay - 1) & 0x200) >> 3) - | ((pSiS->SiS_Pr->CVSyncStart & 0x200) >> 2); - - pSiS->SiS_Pr->CCRT1CRTC[16] = ((((pSiS->SiS_Pr->CVBlankStart - 1) & 0x200) >> 4) >> 5); /* cr9 */ - -#if 0 - if (mode->VScan >= 32) - regp->CRTC[9] |= 0x1F; - else if (mode->VScan > 1) - regp->CRTC[9] |= mode->VScan - 1; -#endif + SiS_CalcCRRegisters(pSiS->SiS_Pr, depth); - pSiS->SiS_Pr->CCRT1CRTC[8] = (pSiS->SiS_Pr->CVSyncStart - 1) & 0xFF; /* cr10 */ - pSiS->SiS_Pr->CCRT1CRTC[9] = ((pSiS->SiS_Pr->CVSyncEnd - 1) & 0x0F) | 0x80; /* cr11 */ - pSiS->SiS_Pr->CCRT1CRTC[10] = (pSiS->SiS_Pr->CVDisplay - 1) & 0xFF; /* cr12 */ - pSiS->SiS_Pr->CCRT1CRTC[11] = (pSiS->SiS_Pr->CVBlankStart - 1) & 0xFF; /* cr15 */ - pSiS->SiS_Pr->CCRT1CRTC[12] = (pSiS->SiS_Pr->CVBlankEnd - 1) & 0xFF; /* cr16 */ - - pSiS->SiS_Pr->CCRT1CRTC[13] = - GETBITSTR((pSiS->SiS_Pr->CVTotal -2), 10:10, 0:0) | - GETBITSTR((pSiS->SiS_Pr->CVDisplay -1), 10:10, 1:1) | - GETBITSTR((pSiS->SiS_Pr->CVBlankStart-1), 10:10, 2:2) | - GETBITSTR((pSiS->SiS_Pr->CVSyncStart ), 10:10, 3:3) | - GETBITSTR((pSiS->SiS_Pr->CVBlankEnd -1), 8:8, 4:4) | - GETBITSTR((pSiS->SiS_Pr->CVSyncEnd -1), 4:4, 5:5) ; - - pSiS->SiS_Pr->CCRT1CRTC[14] = - GETBITSTR((pSiS->SiS_Pr->CHTotal >> 3) - 5, 9:8, 1:0) | - GETBITSTR((pSiS->SiS_Pr->CHDisplay >> 3) - 1, 9:8, 3:2) | - GETBITSTR((pSiS->SiS_Pr->CHBlankStart >> 3) - 1, 9:8, 5:4) | - GETBITSTR((pSiS->SiS_Pr->CHSyncStart >> 3) + 3, 9:8, 7:6) ; - - - pSiS->SiS_Pr->CCRT1CRTC[15] = - GETBITSTR((pSiS->SiS_Pr->CHBlankEnd >> 3) - 1, 7:6, 1:0) | - GETBITSTR((pSiS->SiS_Pr->CHSyncEnd >> 3) + 3, 5:5, 2:2) ; - switch(depth) { - case 8: - pSiS->SiS_Pr->CModeFlag = 0x223b; - break; - case 16: - pSiS->SiS_Pr->CModeFlag = 0x227d; - break; - case 32: - pSiS->SiS_Pr->CModeFlag = 0x22ff; - break; - default: - return 0; - } - - if(pSiS->SiS_Pr->CFlags & V_DBLSCAN) - pSiS->SiS_Pr->CModeFlag |= DoubleScanMode; - if((pSiS->SiS_Pr->CVDisplay >= 1024) || - (pSiS->SiS_Pr->CVTotal >= 1024) || + case 8: pSiS->SiS_Pr->CModeFlag |= 0x223b; break; + case 16: pSiS->SiS_Pr->CModeFlag |= 0x227d; break; + case 32: pSiS->SiS_Pr->CModeFlag |= 0x22ff; break; + default: return 0; + } + + if(pSiS->SiS_Pr->CFlags & V_DBLSCAN) + pSiS->SiS_Pr->CModeFlag |= DoubleScanMode; + + if((pSiS->SiS_Pr->CVDisplay >= 1024) || + (pSiS->SiS_Pr->CVTotal >= 1024) || (pSiS->SiS_Pr->CHDisplay >= 1024)) - pSiS->SiS_Pr->CModeFlag |= LineCompareOff; + pSiS->SiS_Pr->CModeFlag |= LineCompareOff; + if(pSiS->SiS_Pr->CFlags & V_CLKDIV2) - pSiS->SiS_Pr->CModeFlag |= HalfDCLK; - + pSiS->SiS_Pr->CModeFlag |= HalfDCLK; + pSiS->SiS_Pr->CInfoFlag = 0x0007; - if(pSiS->SiS_Pr->CFlags & V_NHSYNC) - pSiS->SiS_Pr->CInfoFlag |= 0x4000; - if(pSiS->SiS_Pr->CFlags & V_NVSYNC) - pSiS->SiS_Pr->CInfoFlag |= 0x8000; - if(pSiS->SiS_Pr->CFlags & V_INTERLACE) - pSiS->SiS_Pr->CInfoFlag |= InterlaceMode; + + if(pSiS->SiS_Pr->CFlags & V_NHSYNC) + pSiS->SiS_Pr->CInfoFlag |= 0x4000; + + if(pSiS->SiS_Pr->CFlags & V_NVSYNC) + pSiS->SiS_Pr->CInfoFlag |= 0x8000; + + if(pSiS->SiS_Pr->CFlags & V_INTERLACE) + pSiS->SiS_Pr->CInfoFlag |= InterlaceMode; pSiS->SiS_Pr->UseCustomMode = TRUE; #ifdef TWDEBUG - xf86DrvMsg(0, X_INFO, "Custom mode %dx%d:\n", + 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]); + 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]); + 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 + pSiS->SiS_Pr->CSR2B, pSiS->SiS_Pr->CSR2C, pSiS->SiS_Pr->CSRClock); +#endif return 1; } -/* TW: Build a list of supported modes */ +/* Build a list of supported modes */ DisplayModePtr -SiSBuildBuiltInModeList(ScrnInfoPtr pScrn) +SiSBuildBuiltInModeList(ScrnInfoPtr pScrn, BOOLEAN includelcdmodes, BOOLEAN isfordvi) { SISPtr pSiS = SISPTR(pScrn); unsigned short VRE, VBE, VRS, VBS, VDE, VT; @@ -5622,23 +4457,28 @@ unsigned char sr_data, cr_data, cr_data2, cr_data3; unsigned char sr2b, sr2c; float num, denum, postscalar, divider; - int A, B, C, D, E, F, temp, i, j, index, vclkindex; - DisplayModePtr new = NULL, current = NULL, first = NULL, backup = NULL; + 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); + InitTo300Pointer(pSiS->SiS_Pr, &pSiS->sishw_ext); #else - return NULL; + return NULL; #endif } else if(pSiS->VGAEngine == SIS_315_VGA) { #ifdef SIS315H - InitTo310Pointer(pSiS->SiS_Pr, &pSiS->sishw_ext); + InitTo310Pointer(pSiS->SiS_Pr, &pSiS->sishw_ext); #else - return NULL; + return NULL; #endif } else return NULL; @@ -5646,19 +4486,21 @@ while(pSiS->SiS_Pr->SiS_RefIndex[i].Ext_InfoFlag != 0xFFFF) { index = pSiS->SiS_Pr->SiS_RefIndex[i].Ext_CRT1CRTC; -#if 0 /* Not any longer */ - if(pSiS->VGAEngine == SIS_300_VGA) index &= 0x3F; -#endif - if(((pSiS->SiS_Pr->SiS_RefIndex[i].XRes < 512) && (!pSiS->DSTN)) || - ((pSiS->DSTN) && - (pSiS->SiS_Pr->SiS_RefIndex[i].XRes < 512) && - (pSiS->SiS_Pr->SiS_RefIndex[i].XRes != 320) && - (pSiS->SiS_Pr->SiS_RefIndex[i].YRes != 480))) { + /* 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))) { @@ -5672,13 +4514,13 @@ } 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; + current->type = M_T_DEFAULT; vclkindex = pSiS->SiS_Pr->SiS_RefIndex[i].Ext_CRTVCLK; if(pSiS->VGAEngine == SIS_300_VGA) vclkindex &= 0x3F; @@ -5691,7 +4533,7 @@ ( (((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", @@ -5717,7 +4559,7 @@ /* Horizontal display enable end */ HDE = (cr_data & 0xff) | ((unsigned short) (sr_data & 0x0C) << 6); - E = HDE + 1; + E = HDE + 1; /* 0x80 0x64 */ cr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[4]; /* inSISIDXREG(SISCR, 0x04, cr_data); */ @@ -5725,7 +4567,7 @@ /* Horizontal retrace (=sync) start */ HRS = (cr_data & 0xff) | ((unsigned short) (sr_data & 0xC0) << 2); - F = HRS - E - 3; + F = HRS - E - 3; /* 0x06 0x06 */ cr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[2]; /* inSISIDXREG(SISCR, 0x02, cr_data); */ @@ -5755,14 +4597,33 @@ B = (temp > 0) ? temp : (temp + 256); temp = HRE - ((E + F + 3) & 63); - C = (temp > 0) ? temp : (temp + 64); + C = (temp > 0) ? temp : (temp + 64); /* 0x0b 0x0b */ D = B - F - C; - current->HDisplay = (E * 8); - current->HSyncStart = (E * 8) + (F * 8); - current->HSyncEnd = (E * 8) + (F * 8) + (C * 8); - current->HTotal = (E * 8) + (F * 8) + (C * 8) + (D * 8); + 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, @@ -5886,7 +4747,7 @@ current->VSyncStart <<= 1; current->VSyncEnd <<= 1; current->VTotal <<= 1; - current->VTotal |= 1; + current->VTotal |= 1; } if(current->Flags & V_DBLSCAN) { current->Clock >>= 1; @@ -5896,6 +4757,7 @@ current->VTotal >>= 1; } +#if 0 if((backup = xalloc(sizeof(DisplayModeRec)))) { if(!pSiS->backupmodelist) pSiS->backupmodelist = backup; else { @@ -5914,6 +4776,7 @@ backup->Flags = current->Flags; backup->Clock = current->Clock; } +#endif #ifdef TWDEBUG xf86DrvMsg(pScrn->scrnIndex, X_INFO, @@ -5921,48 +4784,531 @@ 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; #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; kname = xalloc(10))) { + xfree(new); + return first; + } + if(!first) first = new; + if(current) { + current->next = new; + new->prev = current; + } + + current = new; + + pSiS->AddedPlasmaModes = TRUE; + + l = SiS_PlasmaTable[i].plasmamodes[k] & 0x3f; + + 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; + + } + 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; } -#define MODEID_OFF 0x449 +/* Build a list of supported modes */ +int +SiSTranslateToVESA(ScrnInfoPtr pScrn, int modenumber) +{ + SISPtr pSiS = SISPTR(pScrn); + int i; + + /* 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; +#endif + } else return -1; + + if(modenumber <= 0x13) return modenumber; + + i = 0; + 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++; + } + return -1; +} +#endif /* Xfree86 */ -unsigned char -SiS_GetSetModeID(ScrnInfoPtr pScrn, unsigned char id) +#ifdef LINUX_KERNEL +int +sisfb_mode_rate_to_dclock(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, + unsigned char modeno, unsigned char rateindex) { - return(SiS_GetSetBIOSScratch(pScrn, MODEID_OFF, id)); + 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); } -unsigned char -SiS_GetSetBIOSScratch(ScrnInfoPtr pScrn, USHORT offset, unsigned char value) +BOOLEAN +sisfb_gettotalfrommode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, + unsigned char modeno, int *htotal, int *vtotal, unsigned char rateindex) { - unsigned char ret; - unsigned char *base; + USHORT ModeNo = modeno; + USHORT ModeIdIndex = 0, CRT1Index = 0; + USHORT RefreshRateTableIndex = 0; + unsigned char sr_data, cr_data, cr_data2; - base = xf86MapVidMem(pScrn->scrnIndex, VIDMEM_MMIO, 0, 0x2000); - if(!base) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "(init.c: Could not map BIOS scratch area)\n"); - return 0; + 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 } - ret = *(base + offset); + if(!(SiS_SearchModeID(SiS_Pr, &ModeNo, &ModeIdIndex))) return FALSE; - /* value != 0xff means: set register */ - if (value != 0xff) - *(base + offset) = value; + 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; - xf86UnMapVidMem(pScrn->scrnIndex, base, 0x2000); + if(SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag & InterlaceMode) + *vtotal *= 2; - return ret; + return TRUE; } +int +sisfb_mode_rate_to_ddata(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, + unsigned char modeno, unsigned char rateindex, + ULONG *left_margin, ULONG *right_margin, + ULONG *upper_margin, ULONG *lower_margin, + ULONG *hsync_len, ULONG *vsync_len, + ULONG *sync, ULONG *vmode) +{ + USHORT ModeNo = modeno; + USHORT ModeIdIndex = 0, index = 0; + USHORT RefreshRateTableIndex = 0; + 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... + */ + *left_margin = (400 - 376); + *right_margin = (328 - 320); + *hsync_len = (376 - 328); + + } else { + + *left_margin = D * 8; + *right_margin = F * 8; + *hsync_len = C * 8; + + } + + sr_data = SiS_Pr->SiS_CRT1Table[index].CR[13]; + + cr_data = SiS_Pr->SiS_CRT1Table[index].CR[6]; + + cr_data2 = SiS_Pr->SiS_CRT1Table[index].CR[7]; + + /* Vertical total */ + VT = (cr_data & 0xFF) | + ((unsigned short) (cr_data2 & 0x01) << 8) | + ((unsigned short)(cr_data2 & 0x20) << 4) | + ((unsigned short) (sr_data & 0x01) << 10); + A = VT + 2; + + cr_data = SiS_Pr->SiS_CRT1Table[index].CR[10]; + + /* Vertical display enable end */ + VDE = (cr_data & 0xff) | + ((unsigned short) (cr_data2 & 0x02) << 7) | + ((unsigned short) (cr_data2 & 0x40) << 3) | + ((unsigned short) (sr_data & 0x02) << 9); + E = VDE + 1; + + cr_data = SiS_Pr->SiS_CRT1Table[index].CR[8]; + + /* Vertical retrace (=sync) start */ + VRS = (cr_data & 0xff) | + ((unsigned short) (cr_data2 & 0x04) << 6) | + ((unsigned short) (cr_data2 & 0x80) << 2) | + ((unsigned short) (sr_data & 0x08) << 7); + F = VRS + 1 - E; + + cr_data = SiS_Pr->SiS_CRT1Table[index].CR[11]; + + cr_data3 = (SiS_Pr->SiS_CRT1Table[index].CR[16] & 0x01) << 5; + + /* Vertical blank start */ + VBS = (cr_data & 0xff) | + ((unsigned short) (cr_data2 & 0x08) << 5) | + ((unsigned short) (cr_data3 & 0x20) << 4) | + ((unsigned short) (sr_data & 0x04) << 8); + + cr_data = SiS_Pr->SiS_CRT1Table[index].CR[12]; + + /* Vertical blank end */ + VBE = (cr_data & 0xff) | + ((unsigned short) (sr_data & 0x10) << 4); + temp = VBE - ((E - 1) & 511); + B = (temp > 0) ? temp : (temp + 512); + + cr_data = SiS_Pr->SiS_CRT1Table[index].CR[9]; + + /* Vertical retrace (=sync) end */ + VRE = (cr_data & 0x0f) | ((sr_data & 0x20) >> 1); + temp = VRE - ((E + F - 1) & 31); + C = (temp > 0) ? temp : (temp + 32); + + D = B - F - C; + + *upper_margin = D; + *lower_margin = F; + *vsync_len = C; + if(SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag & 0x8000) + *sync &= ~FB_SYNC_VERT_HIGH_ACT; + else + *sync |= FB_SYNC_VERT_HIGH_ACT; + + if(SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag & 0x4000) + *sync &= ~FB_SYNC_HOR_HIGH_ACT; + else + *sync |= FB_SYNC_HOR_HIGH_ACT; + + *vmode = FB_VMODE_NONINTERLACED; + if(SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag & 0x0080) + *vmode = FB_VMODE_INTERLACED; + else { + j = 0; + while(SiS_Pr->SiS_EModeIDTable[j].Ext_ModeID != 0xff) { + if(SiS_Pr->SiS_EModeIDTable[j].Ext_ModeID == + SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].ModeID) { + if(SiS_Pr->SiS_EModeIDTable[j].Ext_ModeFlag & DoubleScanMode) { + *vmode = FB_VMODE_DOUBLE; + } + break; + } + j++; + } + } + + if((*vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) { +#if 0 /* Do this? */ + *upper_margin <<= 1; + *lower_margin <<= 1; + *vsync_len <<= 1; +#endif + } else if((*vmode & FB_VMODE_MASK) == FB_VMODE_DOUBLE) { + *upper_margin >>= 1; + *lower_margin >>= 1; + *vsync_len >>= 1; + } + + return 1; +} + +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/sis/init.h diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/init.h:1.5 xc/programs/Xserver/hw/xfree86/drivers/sis/init.h:1.48 --- xc/programs/Xserver/hw/xfree86/drivers/sis/init.h:1.5 Sun Feb 9 20:14:16 2003 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/init.h Wed Feb 25 12:45:10 2004 @@ -1,21 +1,63 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init.h,v 1.5 2003/02/10 01:14:16 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init.h,v 1.48 2004/02/25 17:45:10 twini Exp $ */ +/* + * Data and prototypes for init.c + * + * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria + * + * If distributed as part of the Linux kernel, the following license terms + * apply: + * + * * This program is free software; you can redistribute it and/or modify + * * it under the terms of the GNU General Public License as published by + * * the Free Software Foundation; either version 2 of the named License, + * * or any later version. + * * + * * This program is distributed in the hope that it will be useful, + * * but WITHOUT ANY WARRANTY; without even the implied warranty of + * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * * GNU General Public License for more details. + * * + * * You should have received a copy of the GNU General Public License + * * along with this program; if not, write to the Free Software + * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA + * + * Otherwise, the following license terms apply: + * + * * Redistribution and use in source and binary forms, with or without + * * modification, are permitted provided that the following conditions + * * are met: + * * 1) Redistributions of source code must retain the above copyright + * * notice, this list of conditions and the following disclaimer. + * * 2) Redistributions in binary form must reproduce the above copyright + * * notice, this list of conditions and the following disclaimer in the + * * documentation and/or other materials provided with the distribution. + * * 3) The name of the author may not be used to endorse or promote products + * * derived from this software without specific prior written permission. + * * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR + * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Author: Thomas Winischhofer + * + */ #ifndef _INIT_ #define _INIT_ #include "osdef.h" + #include "initdef.h" #include "vgatypes.h" #include "vstruct.h" -#ifdef TC -#include -#include -#include -#include -#include -#endif - #ifdef LINUX_XF86 #include "xf86.h" #include "xf86Pci.h" @@ -26,24 +68,56 @@ #endif #ifdef LINUX_KERNEL +#ifdef SIS_CP +#undef SIS_CP +#endif +#include +#include #include #include +#include +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) #include +#else +#include