--- svgatextmode-1.9.orig/Makefile +++ svgatextmode-1.9/Makefile @@ -14,15 +14,22 @@ # Linux compilation or vice versa. -ARCH=$(shell arch) +# ARCH=$(shell arch) +# The Debian package should always be built with i386 flags anyway +ARCH = $(shell dpkg-architecture -qDEB_BUILD_ARCH) + CFLAGS_alpha = CFLAGS_i386 = -pipe -O2 -Wall -Wpointer-arith -Wnested-externs CFLAGS_i486 = $(CFLAGS_i386) -m486 -fomit-frame-pointer CFLAGS_i586 = $(CFLAGS_i486) -fno-strength-reduce -malign-loops=2 -malign-jumps=2 -malign-functions=2 +CFLAGS_i686 = $(CFLAGS_i586) +CFLAGS_amd64 = $(CFLAGS_i386) LDFLAGS_alpha = LDFLAGS_i386 = LDFLAGS_i486 = $(LDFLAGS_i386) LDFLAGS_i586 = $(LDFLAGS_i386) +LDFLAGS_i686 = $(LDFLAGS_i386) +LDFLAGS_amd64 = $(LDFLAGS_i386) YACC = bison -y LEX = flex -l @@ -40,15 +47,21 @@ export CFLAGS +# added for Debian by Ron Lee +DESTDIR = + # installation path for SVGATextMode -INSTBINDIR = /usr/sbin +#INSTBINDIR = /usr/sbin +INSTBINDIR = $(DESTDIR)/sbin # installation path for TextConfig. This is also the path that will be # compiled into SVGATextMode. -INSTCONFDIR = /etc +#INSTCONFDIR = /etc +INSTCONFDIR = $(DESTDIR)/etc # installation path for the manual files -INSTMANDIR = /usr/man +#INSTMANDIR = /usr/man +INSTMANDIR = $(DESTDIR)/usr/share/man # misc configuration flags. # @@ -134,18 +147,19 @@ STM_OBJECTS = ttyresize.o messages.o vga_prg.o setclock.o file_ops.o SVGATextMode.o \ validate.o run_extprog.o wait_vsync.o clockchip.o std_clock.o cfglex.o \ - y.tab.o misc.o dump_cfgdata.o kversion.o unlock_svga.o special_svga.o + y.tab.o misc.o dump_cfgdata.o kversion.o unlock_svga.o special_svga.o \ + console_dev.o CP_OBJECTS = messages.o vga_prg.o setclock.o file_ops.o string_ops.o ClockProg.o \ validate.o run_extprog.o wait_vsync.o clockchip.o std_clock.o cfglex.o \ y.tab.o misc.o dump_cfgdata.o unlock_svga.o special_svga.o -SET80_OBJECTS = set80.o vga_prg.o messages.o ttyresize.o file_ops.o kversion.o +SET80_OBJECTS = set80.o vga_prg.o messages.o ttyresize.o file_ops.o kversion.o console_dev.o VGAREG_OBJECTS = setVGAreg.o vga_prg.o file_ops.o string_ops.o messages.o \ cfglex.o y.tab.o misc.o unlock_svga.o -PAL_OBJECTS = setpalette.o vga_prg.o string_ops.o messages.o file_ops.o kversion.o +PAL_OBJECTS = setpalette.o vga_prg.o string_ops.o messages.o file_ops.o kversion.o console_dev.o GRAB_OBJECTS = grabmode.o modedata.o probe.o wait_vsync.o vga_prg.o messages.o \ string_ops.o user_time.o @@ -393,7 +407,19 @@ tar czf $(DOSDIR).tar.gz $(DOSDIR); \ popd ; \ ) - + +debrelease: PACKAGE_NAME = svgatextmode-$(VERSION_NUM) +debrelease: PACKAGE_DIR = ../Packages/svgatextmode +debrelease: PACKAGE_VERS = $(shell dpkg-parsechangelog | awk '/Version:/ {print $$2}') +debrelease: + mkdir -p $(PACKAGE_DIR) + $(RM) -r $(PACKAGE_DIR)/$(PACKAGE_NAME) + git archive --format=tar --prefix=$(PACKAGE_NAME)/ HEAD | \ + ( cd $(PACKAGE_DIR) && tar xf - \ + && cd $(PACKAGE_NAME) \ + && dpkg-buildpackage -rfakeroot 2>&1 | \ + tee ../build.log-$(PACKAGE_VERS) \ + ) # # dependencies --- svgatextmode-1.9.orig/SVGATextMode.c +++ svgatextmode-1.9/SVGATextMode.c @@ -121,7 +121,7 @@ int main (int argc, char* argv[]) { char *req_label=NULL; - + bool program_hardware=TRUE; bool scanmodes=FALSE; bool validate=TRUE; @@ -133,13 +133,16 @@ int c; char *cptr; /* bc3c */ - + bool sresize=TRUE; /* will be set when screen has been resized and vice-versa */ - + bool run_resetprog=TRUE, run_fontprog=TRUE, run_pixclock=TRUE; t_mode *curr_textmode; - + + const char *cdev = ConsoleDevice(""); + size_t clen = strlen(cdev); + /* * command-line argument parsing */ @@ -199,7 +202,7 @@ if ((cptr=ttyname(STDIN_FILENO))) { PDEBUG(("running from %s\n", cptr)); if (strcmp(cptr, "/dev/console")) - if ( !((!strncmp(cptr, "/dev/tty",8)) && (isdigit(cptr[8]))) ) + if ( !((!strncmp(cptr, cdev, clen)) && (isdigit(cptr[clen]))) ) { PERROR(("You can only run SVGATextMode from a virtual terminal " "(=not in X or remotely), unless you use the '-x' option.\n")); @@ -462,7 +465,7 @@ { char tempstr[1024]=""; int result=0; - sprintf(tempstr,"%s ", font_data.fontprogpath); + snprintf(tempstr, sizeof(tempstr), "%s ", font_data.fontprogpath); if (font_data.fontpath) { strcat(tempstr, font_data.fontpath); @@ -502,7 +505,7 @@ PDEBUG(("Screen not resized. ResetProg not executed.\n")); else { - sprintf(tempstr,"%s %d %d", resetprogpath, curr_textmode->cols, curr_textmode->rows); + snprintf(tempstr, sizeof(tempstr), "%s %d %d", resetprogpath, curr_textmode->cols, curr_textmode->rows); Run_extern_Prog(tempstr); } } --- svgatextmode-1.9.orig/TextConfig +++ svgatextmode-1.9/TextConfig @@ -131,6 +131,7 @@ # non-standard text mode. #RefClk 14.31818 # common values are: 14.31818, 16.0 , 24.0 and 50.0 MHz +#RefClk 28 # Suggested by Stanislav Voronyi for S3 Trio3D2X (YMMV) #ChipSet "ET4000" #Option "hibit_high" # This option MUST be in your XF86Config file, too!!! @@ -298,6 +299,7 @@ #Chipset "matrox" #clockchip "ti3026" # for the Millennium #clockchip "mystique" # for the Mystique +#clockchip "mgag200" # for the G100 and G200 (only tested on last) # @@ -314,6 +316,10 @@ #Option "topleft" +# Suggested by Francesco Potorti to enable this card +# no Clocks or ClockChip line seems required.. +#ChipSet "Riva128" + # for the really unsupported cards, or others using a special clock chip # (but first try the "Clockchip" option !). @@ -333,7 +339,7 @@ # cards, and is useless on cards with a programmable clock chip. # Cirrus cards seem not to like this feature! # -Option "ClockDiv2" +#Option "ClockDiv2" ############################################################################# # @@ -401,12 +407,15 @@ # It will be called with TWO arguments: the H and V size of the new text # mode. Example: SVGATextMode 100x37 will call # -# /etc/STM_reset 100 37 +# /usr/sbin/STM_reset 100 37 # Your reset program NEED not use those two arguments, but it could be useful # for some applications. # +# Debian package includes STM_reset script set up properly for use with gpm. +# You should not change the line below unless you have your own reset script +# in another location. -#ResetProg "/etc/STM_reset" +ResetProg "/usr/sbin/STM_reset" ############################################################################# @@ -448,13 +457,25 @@ # Option "LoadFont" -FontProg "/usr/bin/setfont" +#FontProg "/usr/bin/setfont" #FontPath "/usr/lib/kbd/consolefonts" -FontSelect "Cyr_a8x16" 8x16 9x16 8x15 9x15 -FontSelect "Cyr_a8x14" 8x14 9x14 8x13 9x13 -FontSelect "8x12alt.psf" 8x12 9x12 8x11 9x11 -FontSelect "Cyr_a8x8" 8x8 9x8 8x7 9x7 -FontSelect "Cyr_a8x32" 8x32 9x32 8x31 9x31 +#FontSelect "Cyr_a8x16" 8x16 9x16 8x15 9x15 +#FontSelect "Cyr_a8x14" 8x14 9x14 8x13 9x13 +#FontSelect "8x12alt.psf" 8x12 9x12 8x11 9x11 +#FontSelect "Cyr_a8x8" 8x8 9x8 8x7 9x7 +#FontSelect "Cyr_a8x32" 8x32 9x32 8x31 9x31 + +# Debian defaults for use with kbd again, if you use console-tools +# then use consolechars as your FontProg instead. +#FontProg "/usr/bin/consolechars -f" +FontProg "/usr/bin/setfont" +FontPath "/usr/share/consolefonts" +FontSelect "lat1u-16" 8x16 9x16 8x15 9x15 +FontSelect "lat1u-14" 8x14 9x14 8x13 9x13 +FontSelect "lat1u-12" 8x12 9x12 8x11 9x11 +FontSelect "lat1u-10" 8x10 9x10 8x9 9x9 +FontSelect "lat1u-08" 8x8 9x8 8x7 9x7 + # # using the following FontProg line will avoid losing high-ascii characters @@ -470,6 +491,14 @@ # it. syntax is 'Cursor -'. Cursor size is always relative to a # 32-pixel high font! (see TextConfig.doc). So '0-31' will be scaled to '0-7' # when selecting an 8-pixel font size. +# +# NOTE: Those with kernel 2.6.11 or later may find this option unreliable. +# The FontProg is called after the cursor is set, but with later kernels, +# vgacon_adjust_height resets both the cursor and font size. +# One workaround suggested at present is to disable font loading +# above and set the font before starting stm. An easier one is +# to just leave the cursor be. Best and hardest would be to look +# at if stm could do things differently... someday. #Cursor 0-31 # block cursor #Cursor 28-31 # underline cursor: the default. @@ -504,7 +533,7 @@ # # This is NOT the maximum pixel clock for graphics modes! it is MUCH lower. # -# Each chipset has it's own maximum, which had to be determined through +# Each chipset has its own maximum, which had to be determined through # experimentation (not many manufacturers care to mention them in their data # sheets). See the TextConfig manual file for details. # @@ -1011,6 +1040,16 @@ "B160x30" 94.5 1280 1348 1432 1680 960 986 989 1023 font 8x32 "B160x100" 94.5 1280 1352 1472 1680 800 809 819 850 font 8x8 +#160x100 for Matrox cards +"MGA160x100" 65 1280 1312 1420 1500 800 810 820 830 font 8x8 + +# +# A couple contributed to Debian by Keith that he +# thinks people will find pleasantly readable +# +"116x48x8_small" 36 928 944 1088 1144 480 490 492 525 font 8x10 +"116x48x9_small" 40 928 944 1080 1128 480 490 492 525 font 9x10 + ############################################################################### # CUSTOM modes: put your own modes (new or adapted from above) here. --- svgatextmode-1.9.orig/XFREE/common/compiler.h +++ svgatextmode-1.9/XFREE/common/compiler.h @@ -74,7 +74,7 @@ #ifdef __GNUC__ -#if defined(__i386__) +#if defined(__i386__) || defined(__amd64__) #ifndef FAKEIT #ifdef GCCUSESGAS @@ -258,6 +258,10 @@ #define outw(p,v) _outw((v),(p)) #define outl(p,v) _outl((v),(p)) +#elif defined(__linux__) + +#include + #endif #else /* __GNUC__ */ --- svgatextmode-1.9.orig/XFREE/common_hw/ATTDac.c +++ svgatextmode-1.9/XFREE/common_hw/ATTDac.c @@ -165,6 +165,8 @@ return FALSE; } +#if 0 +/* unused by stm */ static void Att409UseClock(clk) @@ -200,6 +202,7 @@ return; } +#endif #define BASE_FREQ 14.31818 #define FREQ_MIN (120000.0 / 8.0) /* p = 3 */ --- svgatextmode-1.9.orig/XFREE/common_hw/Ch8391clk.c +++ svgatextmode-1.9/XFREE/common_hw/Ch8391clk.c @@ -256,7 +256,7 @@ { double ffreq; int n, nmin, nmax, k, m, m0; - int best_n, best_m; + int best_n = 0, best_m = 0; double diff, mindiff; if (freq < FREQ_MIN) --- svgatextmode-1.9.orig/XFREE/common_hw/CirrusClk.c +++ svgatextmode-1.9/XFREE/common_hw/CirrusClk.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common_hw/CirrusClk.c,v 3.10 1996/09/29 13:36:29 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common_hw/CirrusClk.c,v 3.10 1996/09/29 13:36:29 dawes Exp $ */ /* * Programming of the built-in Cirrus clock generator. @@ -8,7 +8,8 @@ * Max clock specification added by Harm Hanemaayer (H.Hanemaayer@inter.nl.net) */ /* $XConsortium: CirrusClk.c /main/6 1995/11/12 19:29:48 kaleb $ */ - + +#include #include "Xfuncproto.h" #include "compiler.h" #include "misc.h" @@ -76,8 +77,8 @@ int *usemclk_out; { int n, i; - int num, den; - int ffreq, mindiff; + int num = 0, den = 0; + int ffreq, mindiff = 0; int mclk; /* Prefer a tested value if it matches within 0.1%. */ --- svgatextmode-1.9.orig/XFREE/common_hw/S3gendac.c +++ svgatextmode-1.9/XFREE/common_hw/S3gendac.c @@ -6,8 +6,13 @@ * Also used for GenDAC and GenDAC-like chips on non-S3 chipsets. */ /* $XConsortium: S3gendac.c /main/9 1995/12/28 17:16:09 kaleb $ */ - + +/* 22/10/99 - applied patch from Stanislav V. Voronyi" + * for S3 Trio 3D2X support. (Ron) + */ + #include "Xfuncproto.h" +#include "cfg_structs.h" #include "S3gendac.h" #include "compiler.h" #define NO_OSLIB_PROTOTYPES @@ -194,6 +199,8 @@ *ndiv = (best_n1 - 2) | (best_n2 << 5); *mdiv = best_m - 2; + + return 0; } int --- svgatextmode-1.9.orig/XFREE/common_hw/S3gendac.h +++ svgatextmode-1.9/XFREE/common_hw/S3gendac.h @@ -6,9 +6,13 @@ /* $XConsortium: S3gendac.h /main/5 1995/11/12 19:30:20 kaleb $ */ +/* 22/10/99 - applied patch from Stanislav V. Voronyi" + * for S3 Trio 3D2X support. (Ron) + */ + #define GENDAC_INDEX 0x3C8 #define GENDAC_DATA 0x3C9 -#define BASE_FREQ 14.31818 /* MHz */ +#define BASE_FREQ ((clock_data.refclk==REFCLK_NOT_DEFINED) ? 14.31818 : clock_data.refclk/1000.0) /* MHz */ int S3gendacSetClock( #if NeedFunctionPrototypes --- svgatextmode-1.9.orig/XFREE/common_hw/SC11412.c +++ svgatextmode-1.9/XFREE/common_hw/SC11412.c @@ -26,7 +26,7 @@ register long frequency; { unsigned i; -unsigned Multiplier, Divider, BigD; +unsigned Multiplier = 0, Divider = 0, BigD; unsigned ErrorTerm=32767; SetSC11412(106,31,0,0); /* set Mclock to 49 MHz */ @@ -118,7 +118,6 @@ static void wrtSC11412bit(bool) int bool; { - int vgaCRIndex = vgaIOBase + 4; int vgaCRReg = vgaIOBase + 5; if (bool==1) { --- svgatextmode-1.9.orig/XFREE/common_hw/xf86_PCI.c +++ svgatextmode-1.9/XFREE/common_hw/xf86_PCI.c @@ -27,6 +27,7 @@ /* #define DEBUGPCI 1 */ #include +#include /* #include "os.h" */ #include "compiler.h" /* #include "input.h" */ @@ -794,7 +795,9 @@ { /* This is enough to ensure that full I/O is enabled */ unsigned pciIOPorts[] = { PCI_MODE1_ADDRESS_REG }; - int numPciIOPorts = sizeof(pciIOPorts) / sizeof(pciIOPorts[0]); + int numPciIOPorts; + + numPciIOPorts = sizeof(pciIOPorts) / sizeof(pciIOPorts[0]); xf86ClearIOPortList(scrnIndex); xf86AddIOPorts(scrnIndex, numPciIOPorts, pciIOPorts); @@ -914,7 +917,7 @@ if (xf86Verbose > 1) { ErrorF("PCI: Bus 0x%x Card 0x%02x Func 0x%x ID 0x%04x," "0x%04x Rev 0x%02x Class 0x%02x,0x%02x\n", - pcr._bus, pcr._cardnum, pcr._func, pcr._vendor, + (unsigned)pcr._bus, (unsigned)pcr._cardnum, (unsigned)pcr._func, pcr._vendor, pcr._device, pcr._rev_id, pcr._base_class, pcr._sub_class); } @@ -941,13 +944,13 @@ return; tag = pcibusTag(bus, cardnum, func); - data = pcibusRead(tag, reg) & ~mask | (value & mask); + data = (pcibusRead(tag, reg) & ~mask) | (value & mask); pcibusWrite(tag, reg, data); if (xf86Verbose > 2) { ErrorF("PCI: xf86writepci: Bus=0x%x Card=0x%x Func=0x%x Reg=0x%02x " "Mask=0x%08x Val=0x%08x\n", - bus, cardnum, func, reg, mask, value); + bus, cardnum, func, reg, (unsigned)mask, (unsigned)value); } pciDisableIO(scrnIndex); --- svgatextmode-1.9.orig/XFREE/mach64/mach64_mem_access.c +++ svgatextmode-1.9/XFREE/mach64/mach64_mem_access.c @@ -29,6 +29,7 @@ /************************* Linux ****************************************/ /************************************************************************/ +#include #include #include #include --- svgatextmode-1.9.orig/XFREE/mga_clock.c +++ svgatextmode-1.9/XFREE/mga_clock.c @@ -57,8 +57,14 @@ if (pcr->_vendor == PCI_VENDOR_MATROX) { if ((pcr->_device == PCI_CHIP_MGA2064) - || (pcr->_device == PCI_CHIP_MGA1064) - || (pcr->_device == PCI_CHIP_MGA2164)) + || (pcr->_device == PCI_CHIP_MGA1064) + || (pcr->_device == PCI_CHIP_MGA2164) + || (pcr->_device == PCI_CHIP_MGAG200) + || (pcr->_device == PCI_CHIP_MGAG400) + || (pcr->_device == PCI_CHIP_MGAG100) + || (pcr->_device == PCI_CHIP_MGAG200PCI) + || (pcr->_device == PCI_CHIP_MGAG100PCI) + || (pcr->_device == PCI_CHIP_MGA2164AGP)) break; } } @@ -66,7 +72,15 @@ if (!pcr) return(FALSE); - if ((pcr->_device != PCI_CHIP_MGA2064) && (pcr->_device != PCI_CHIP_MGA1064) && (pcr->_device != PCI_CHIP_MGA2164)) + if ((pcr->_device != PCI_CHIP_MGA2064) + && (pcr->_device != PCI_CHIP_MGA1064) + && (pcr->_device != PCI_CHIP_MGA2164) + && (pcr->_device != PCI_CHIP_MGAG100) + && (pcr->_device != PCI_CHIP_MGAG200) + && (pcr->_device != PCI_CHIP_MGAG400) + && (pcr->_device != PCI_CHIP_MGAG100PCI) + && (pcr->_device != PCI_CHIP_MGAG200PCI) + && (pcr->_device != PCI_CHIP_MGA2164AGP)) return(FALSE); /* @@ -86,12 +100,16 @@ PDEBUG(("MGAbase0: %x ; MGAbase1: %x ; MGAbase2: %x\n", pcr->_base0, pcr->_base1, pcr->_base2)); - if ( ( (pcr->_device == PCI_CHIP_MGA1064) && - (pcr->_rev_id == 0x3)) || - (pcr->_device == PCI_CHIP_MGA2164)) - - { - /* + if ( ((pcr->_device == PCI_CHIP_MGA1064) && (pcr->_rev_id == 0x3)) + || (pcr->_device == PCI_CHIP_MGA2164) + || (pcr->_device == PCI_CHIP_MGAG400) + || (pcr->_device == PCI_CHIP_MGAG200) + || (pcr->_device == PCI_CHIP_MGAG200PCI) + || (pcr->_device == PCI_CHIP_MGAG100) + || (pcr->_device == PCI_CHIP_MGAG100PCI) + || (pcr->_device == PCI_CHIP_MGA2164AGP) ) + { + /* only for mystique rev 3 with 220MHz RAMDAC mem adress bytes are swapped Also for Millenium II according to XFree86 3.3.1 code @@ -122,16 +140,39 @@ return TRUE; } -static ulong midCalcFreq(uchar m, uchar n, uchar p) { - ulong retval = ((14318 * (n + 1)) / (m + 1)) / (p + 1); +static ulong midCalcFreq(int reff, uchar m, uchar n, uchar p) { + ulong retval = ((reff * (n + 1)) / (m + 1)) / (p + 1); return retval; } -static ulong midCalcMNPS(ulong freq, uchar *m, uchar *n, uchar *p, uchar *s) { +static ulong midCalcMNPS(ulong freq, uchar *m, uchar *n, uchar *p, uchar *s, int type) { ulong Fvco; long delta, d; uchar nt, mt, pt; + int feed_div_min, feed_div_max; + int in_div_min, in_div_max; + + int reff; + + switch( type ) + { + case 0: + reff = 14318; + feed_div_min = 100; + feed_div_max = 127; + in_div_min = 1; + in_div_max = 31; + break; + default: + reff = 27051; + feed_div_min = 7; + feed_div_max = 127; + in_div_min = 1; + in_div_max = 6; + break; + } + // find m and n such that: // 'freq' - ((14318 * (n + 1)) / (m + 1)) / (p + 1) // is as close to 0 as possible @@ -140,9 +181,9 @@ for (pt = 1; pt <= 8; pt <<= 1) { Fvco = freq * pt; if ((Fvco > 50000) && (Fvco < 220000)) { - for (nt = 127; nt >= 100; nt--) { - for (mt = 1; mt < 32; mt++) { - d = (long)midCalcFreq(mt, nt, (pt - 1)) - (long)freq; + for (nt = feed_div_max; nt >= feed_div_min; nt--) { + for (mt = in_div_min; mt <= in_div_max; mt++) { + d = (long)midCalcFreq(reff, mt, nt, (pt - 1)) - (long)freq; if (d < 0) d = -d; if (d < delta) { *n = nt; @@ -158,7 +199,7 @@ } } } - return midCalcFreq(*m, *n, *p); + return midCalcFreq(reff, *m, *n, *p); } /* ================== XFREE code starts here ======================== */ @@ -194,12 +235,14 @@ return val; } -void midSetPixClock(ulong freq) { +void midSetPixClock(ulong freq, int isG2) { uchar m, n, p, s; uchar tmpByte; PDEBUG(("Requested PIX clock freq: %d\n", freq)); - midCalcMNPS(freq, &m, &n, &p, &s); + freq = midCalcMNPS(freq, &m, &n, &p, &s, isG2); + + PDEBUG(("Actual PIX clock freq: %ld\n", freq)); // MGA1064SG 5-77 // Step 1) force screen off @@ -226,7 +269,7 @@ PDEBUG(("VGA_MISC_W - wrote 0x%02x, read 0x%02x\n", tmpByte, INREG8(VGA_MISC_R))); #endif - + PDEBUG(("Wait for PLL lock\n")); // Step 4) wait for frequency lock while ((MGAinTi3026(MID_XPIXPLLSTAT) & 0x40) != 0x40); #endif @@ -351,7 +394,7 @@ int *n; int *p; { - int best_m, best_n; + int best_m = 0, best_n = 0; double f_pll, f_vco; double m_err, inc_m, calc_m; --- svgatextmode-1.9.orig/XFREE/riva128_clock.c +++ svgatextmode-1.9/XFREE/riva128_clock.c @@ -57,6 +57,51 @@ |* *| \***************************************************************************/ +/* This code has been updated with stuff from Debian's XFree86 4.3.0, + * version 4.3.0.dfsg.1-8. + * + * Here are the updated notices: */ + /***************************************************************************\ +|* *| +|* Copyright 1993-2003 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-2003 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/nv_hw.c,v 1.4 2003/11/03 05:11:25 tsi Exp $ */ + + #include #include #include @@ -67,15 +112,183 @@ #include "vga_prg.h" #ifdef DOS -#include +#error DOS NOT SUPPORTED FOR THIS DRIVER #endif /* PCI stuff -- copied largely from the MGAProbe() code */ #include "include/Xmd.h" #include "vgaPCI.h" -#define PCI_VENDOR_NVIDIA_SGS 0x12d2 -#define PCI_CHIP_RIVA128 0x0018 +#define PCI_VENDOR_NVIDIA_SGS 0x12D2 + +#define UNKNOWN 0 +#define NV5 (1<<0) +#define NV10 (1<<1) +#define NV17 (1<<2) +#define NV1X (NV10 | NV17) +#define NV20 (1<<3) +#define NV25 (1<<4) +#define NV2X (NV20 | NV25) +#define NV30 (1<<5) +#define NV31 (1<<6) +#define NV35 (1<<7) +#define NV3X (NV30 | NV31 | NV35) +#define NV40 (1<<8) +#define NV41 (1<<9) +#define NV43 (1<<10) +#define NV44 (1<<11) +#define NV47 (1<<12) +#define NV4X (NV40 | NV41 | NV43 | NV44 | NV47) + +unsigned int nvidia_pci_ids[] = { + 0x12D20018, /*RIVA128*/ + 0x10DE0020, /*RIVATNT*/ + 0x10DE0028, /*RIVATNT2*/ + 0x10DE0029, /*RIVATNT2Ultra*/ + 0x10DE002A, /*UnknownTNT2*/ + 0x10DE002B, /*RIVATNT2*/ + 0x10DE002C, /*Vanta*/ + 0x10DE002D, /*RIVATNT2Model64*/ + 0x10DE002E, /*Vanta*/ + 0x10DE002F, /*Vanta*/ + 0x10DE0091, /*GeForce7800GTX*/ + 0x10DE0092, /*GeForce7800GT*/ + 0x10DE0099, /*GeForceGo7800GTX*/ + 0x10DE009D, /*QuadroFX4500*/ + 0x10DE00A0, /*AladdinTNT2*/ + 0x10DE00F0, /*GeForce6800Ultra*/ + 0x10DE00F1, /*GeForce6600GT*/ + 0x10DE00F2, /*GeForce6600*/ + 0x10DE00F3, /*GeForce6200*/ + 0x10DE00F8, /*Quadro3400*/ + 0x10DE00F9, /*GeForce6800Ultra*/ + 0x10DE00FA, /*GeForcePCX5750*/ + 0x10DE00FB, /*GeForcePCX5900*/ + 0x10DE00FC, /*GeForcePCX5300*/ + 0x10DE00FD, /*QuadroNVS280/FX330*/ + 0x10DE00FE, /*QuadroFX1300*/ + 0x10DE00FF, /*GeForcePCX4300*/ + 0x10DE0100, /*GeForce256*/ + 0x10DE0101, /*GeForceDDR*/ + 0x10DE0103, /*Quadro*/ + 0x10DE0110, /*GeForce2MX/MX400*/ + 0x10DE0111, /*GeForce2MX100/200*/ + 0x10DE0112, /*GeForce2Go*/ + 0x10DE0113, /*Quadro2MXR/EX/Go*/ + 0x10DE0140, /*GeForce6600GT*/ + 0x10DE0141, /*GeForce6600*/ + 0x10DE0142, /*GeForce6600LE*/ + 0x10DE0144, /*GeForceGo6600*/ + 0x10DE0145, /*GeForce6610XL*/ + 0x10DE0146, /*GeForceGo6600TE/6200TE*/ + 0x10DE0147, /*GeForce6700XL*/ + 0x10DE0148, /*GeForce6600*/ + 0x10DE0149, /*GeForce6600GT*/ + 0x10DE014E, /*QuadroFX540*/ + 0x10DE014F, /*GeForce6200*/ + 0x10DE0161, /*GeForce6200TurboCache*/ + 0x10DE0162, /*GeForce6600SETurboCache*/ + 0x10DE0164, /*GeForceGo6200*/ + 0x10DE0165, /*QuadroNVS285*/ + 0x10DE0166, /*GeForceGo6400*/ + 0x10DE0167, /*GeForceGo6200*/ + 0x10DE0168, /*GeForceGo6400*/ + 0x10DE0211, /*GeForce6800*/ + 0x10DE0212, /*GeForce6800LE*/ + 0x10DE0215, /*GeForce6800GT*/ + 0x10DE0221, /*GeForce6200*/ + 0x10DE01A0, /*GeForce2IntegratedGPU*/ + 0x10DE0150, /*GeForce2GTS*/ + 0x10DE0151, /*GeForce2Ti*/ + 0x10DE0152, /*GeForce2Ultra*/ + 0x10DE0153, /*Quadro2Pro*/ + 0x10DE0170, /*GeForce4MX460*/ + 0x10DE0171, /*GeForce4MX440*/ + 0x10DE0172, /*GeForce4MX420*/ + 0x10DE0173, /*GeForce4MX440-SE*/ + 0x10DE0174, /*GeForce4440Go*/ + 0x10DE0175, /*GeForce4420Go*/ + 0x10DE0176, /*GeForce4420Go32M*/ + 0x10DE0177, /*GeForce4460Go*/ + 0x10DE0179, /*GeForce4440Go64M*/ + 0x10DE017D, /*GeForce4410Go16M*/ + 0x10DE017C, /*Quadro4500GoGL*/ + 0x10DE0178, /*Quadro4550XGL*/ + 0x10DE017A, /*Quadro4NVS*/ + 0x10DE0181, /*GeForce4MX440withAGP8X*/ + 0x10DE0182, /*GeForce4MX440SEwithAGP8X*/ + 0x10DE0183, /*GeForce4MX420withAGP8X*/ + 0x10DE0186, /*GeForce4448Go*/ + 0x10DE0187, /*GeForce4488Go*/ + 0x10DE0188, /*Quadro4580XGL*/ + 0x10DE0189, /*GeForce4MXwithAGP8X(Mac)*/ + 0x10DE018A, /*Quadro4280NVS*/ + 0x10DE018B, /*Quadro4380XGL*/ + 0x10DE01F0, /*GeForce4MXIntegratedGPU*/ + 0x10DE0200, /*GeForce3*/ + 0x10DE0201, /*GeForce3Ti200*/ + 0x10DE0202, /*GeForce3Ti500*/ + 0x10DE0203, /*QuadroDCC*/ + 0x10DE0250, /*GeForce4Ti4600*/ + 0x10DE0251, /*GeForce4Ti4400*/ + 0x10DE0252, /*0x0252*/ + 0x10DE0253, /*GeForce4Ti4200*/ + 0x10DE0258, /*Quadro4900XGL*/ + 0x10DE0259, /*Quadro4750XGL*/ + 0x10DE025B, /*Quadro4700XGL*/ + 0x10DE0280, /*GeForce4Ti4800*/ + 0x10DE0281, /*GeForce4Ti4200withAGP8X*/ + 0x10DE0282, /*GeForce4Ti4800SE*/ + 0x10DE0286, /*GeForce44200Go*/ + 0x10DE028C, /*Quadro4700GoGL*/ + 0x10DE0288, /*Quadro4980XGL*/ + 0x10DE0289, /*Quadro4780XGL*/ + 0x10DE0301, /*GeForceFX5800Ultra*/ + 0x10DE0302, /*GeForceFX5800*/ + 0x10DE0308, /*QuadroFX2000*/ + 0x10DE0309, /*QuadroFX1000*/ + 0x10DE0311, /*GeForceFX5600Ultra*/ + 0x10DE0312, /*GeForceFX5600*/ + 0x10DE0313, /*0x0313*/ + 0x10DE0314, /*GeForceFX5600SE*/ + 0x10DE0316, /*0x0316*/ + 0x10DE0317, /*0x0317*/ + 0x10DE031A, /*GeForceFXGo5600*/ + 0x10DE031B, /*GeForceFXGo5650*/ + 0x10DE031C, /*QuadroFXGo700*/ + 0x10DE031D, /*0x031D*/ + 0x10DE031E, /*0x031E*/ + 0x10DE031F, /*0x031F*/ + 0x10DE0321, /*GeForceFX5200Ultra*/ + 0x10DE0322, /*GeForceFX5200*/ + 0x10DE0323, /*GeForceFX5200SE*/ + 0x10DE0324, /*GeForceFXGo5200*/ + 0x10DE0325, /*GeForceFXGo5250*/ + 0x10DE0328, /*GeForceFXGo520032M/64M*/ + 0x10DE0329, /*GeForceFX5200(Mac)*/ + 0x10DE032A, /*QuadroNVS280PCI*/ + 0x10DE032B, /*QuadroFX500*/ + 0x10DE032C, /*GeForceFXGo5300*/ + 0x10DE032D, /*GeForceFXGo5100*/ + 0x10DE032F, /*0x032F*/ + 0x10DE0330, /*GeForceFX5900Ultra*/ + 0x10DE0331, /*GeForceFX5900*/ + 0x10DE0332, /*GeForceFX5900XT*/ + 0x10DE0333, /*GeForceFX5950Ultra*/ + 0x10DE0334, /*0x0334*/ + 0x10DE0338, /*QuadroFX3000*/ + 0x10DE0341, /*GeForceFX5700Ultra*/ + 0x10DE0342, /*GeForceFX5700*/ + 0x10DE0343, /*0x0343*/ + 0x10DE0347, /*0x0347*/ + 0x10DE0348, /*0x0348*/ + 0x10DE0349, /*0x0349*/ + 0x10DE034B, /*0x034B*/ + 0x10DE034C, /*0x034C*/ + 0x10DE034E, /*QuadroFX1100*/ + 0x10DE034F, /*0x034F*/ + 0 /* NULL terminator */ +}; vgaPCIInformation *vgaPCIInfo; @@ -84,92 +297,278 @@ #define PRAMDAC_BASE 0x00680000 #define PRAMDAC_PLL_COEFF 0x00000508 #define PRAMDAC_PLL_COEFF_SELECT 0x0000050C +#define PRAMDAC_PLL2_COEFF 0x00000578 +#define PEXTDEV_BASE 0x00101000 #define NV3_MIN_CLOCK_IN_KHZ 25000 // Not sure about this, but it seems reasonable #define NV3_MAX_CLOCK_IN_KHZ 230000 +#define NV4_MAX_CLOCK_IN_KHZ 350000 +#define NV31_34_MAX_CLOCK_IN_KHZ 400000 -/* NTSC cards have approx 14.3Mhz. Need to detect, but leave for now*/ -#define PLL_INPUT_FREQ 13500 +static int max_clock, is_nv3, pll_coeff, CrystalFreqKHz, twoStagePLL; + #define M_MIN 7 #define M_MAX 13 #define P_MIN 0 -#define P_MAX 7 /* Not sure about this. Could be 4 */ +#define P_MAX 4 //=== Function section === -// This function copied straight out the of nv3driver.c in the Xserver -static int NV3ClockSelect(float clockIn,float *clockOut,int *mOut, - int *nOut,int *pOut) -{ - int m,n,p; - float bestDiff=1e10; - float target=0.0; - float best=0.0; - float diff; - int nMax,nMin; - - *clockOut=0.0; - for(p=P_MIN;p<=P_MAX;p++) { - for(m=M_MIN;m<=M_MAX;m++) { - float fm=(float)m; - /* Now calculate maximum and minimum values for n */ - nMax=(int) (((256000/PLL_INPUT_FREQ)*fm)-0.5); - nMin=(int) (((128000/PLL_INPUT_FREQ)*fm)+0.5); - n=(int)(((clockIn*((float)(1<=nMin && n<=nMax) { - float fn=(float)n; - target=(PLL_INPUT_FREQ*(fn/fm))/((float)(1< %.2f\n", m, n, p, target ));*/ - if(diff*/CrystalFreqKHz == 14318) + { + lowM = 8; + highM = 14 - (/*chip->Architecture == NV_ARCH_03*/is_nv3); + } + else + { + lowM = 7; + highM = 13 - (/*chip->Architecture == NV_ARCH_03*/is_nv3); + } + + highP = 4 - (/*chip->Architecture == NV_ARCH_03*/is_nv3); + for (P = 0; P <= highP; P ++) + { + Freq = VClk << P; + if ((Freq >= 128000) && (Freq <= /*chip->MaxVClockFreqKHz*/max_clock)) + { + for (M = lowM; M <= highM; M++) + { + N = ((VClk << P) * M) / /*chip->*/CrystalFreqKHz; + if (N <= 255) { + Freq = ((/*chip->*/CrystalFreqKHz * N) / M) >> P; + if (Freq > VClk) + DeltaNew = Freq - VClk; + else + DeltaNew = VClk - Freq; + if (DeltaNew < DeltaOld) + { + *mOut = M; + *nOut = N; + *pOut = P; + *clockOut = Freq; + DeltaOld = DeltaNew; + } + } + } } - } } - } - return (best!=0.0); + return (DeltaOld != 0xFFFFFFFF); +} + +static int CalcVClock2Stage ( + int clockIn, + int double_scan, + int *clockOut, + int *mOut, + int *nOut, + int *pOut, + unsigned *pllBOut +) +{ + unsigned DeltaNew, DeltaOld; + unsigned VClk, Freq; + unsigned M, N, P; + + DeltaOld = 0xFFFFFFFF; + + *pllBOut = 0x80000401; /* fixed at x4 for now */ + + VClk = (unsigned)clockIn; + if (double_scan) + VClk *= 2; + + for (P = 0; P <= 6; P++) { + Freq = VClk << P; + if ((Freq >= 400000) && (Freq <= 1000000)) { + for (M = 1; M <= 13; M++) { + N = ((VClk << P) * M) / (CrystalFreqKHz << 2); + if((N >= 5) && (N <= 255)) { + Freq = (((CrystalFreqKHz << 2) * N) / M) >> P; + if (Freq > VClk) + DeltaNew = Freq - VClk; + else + DeltaNew = VClk - Freq; + if (DeltaNew < DeltaOld) { + *mOut = M; + *nOut = N; + *pOut = P; + *clockOut = Freq; + DeltaOld = DeltaNew; + } + } + } + } + } + return (DeltaOld != 0xFFFFFFFF); +} + +// get GPU architecture +short get_gpu_arch(int device_id) +{ + short arch = UNKNOWN; + switch(device_id & 0xff0) + { + case 0x20: + arch = NV5; + break; + case 0x100: + case 0x110: + case 0x150: + case 0x1a0: + arch = NV10; + break; + case 0x170: + case 0x180: + case 0x1f0: + arch = NV17; + break; + case 0x200: + arch = NV20; + break; + case 0x250: + case 0x280: + case 0x320: /* We don't treat the FX5200/FX5500 as FX cards */ + arch = NV25; + break; + case 0x300: + arch = NV30; + break; + case 0x330: + arch = NV35; /* Similar to NV30 but fanspeed stuff works differently */ + break; + /* Give a seperate arch to FX5600/FX5700 cards as they need different code than other FX cards */ + case 0x310: + case 0x340: + arch = NV31; + break; + case 0x40: + case 0x120: + case 0x130: + case 0x1d0: + case 0x210: + case 0x230: + arch = NV40; + break; + case 0xc0: + arch = NV41; + break; + case 0x140: + arch = NV43; /* Similar to NV40 but with different fanspeed code */ + break; + case 0x160: + case 0x220: + arch = NV44; + break; + case 0x90: + arch = NV47; + break; + case 0xf0: + /* The code above doesn't work for pci-express cards as multiple architectures share one id-range */ + switch(device_id) + { + case 0xf0: /* 6800 */ + case 0xf9: /* 6800Ultra */ + arch = NV40; + break; + case 0xf1: /* 6600/6600GT */ + case 0xf2: /* 6600GT */ + case 0xf3: /* 6200 */ + arch = NV43; + break; + case 0xfa: /* PCX5700 */ + arch = NV31; + break; + case 0xf8: /* QuadroFX 3400 */ + case 0xfb: /* PCX5900 */ + arch = NV35; + break; + case 0xfc: /* PCX5300 */ + case 0xfd: /* Quadro NVS280/FX330, FX5200 based? */ + case 0xff: /* PCX4300 */ + arch = NV25; + break; + case 0xfe: /* Quadro 1300, has the same id as a FX3000 */ + arch = NV35; + break; + } + break; + default: + arch = UNKNOWN; + } + return arch; } - + + // Set the clock to the given speed (in KHz) Bool RIVA128ClockSelect( int clockspeed ) { - int *ptr; + int *PRAMDAC0; + int *PEXTDEV; - float out; - int m, n, p, value; + int out; + int m, n, p; + unsigned pll1, pll2; int i = 0; pciConfigPtr pcr = NULL; + int arch = 0; int fd; vgaPCIInfo = vgaGetPCIInfo(); if (vgaPCIInfo && vgaPCIInfo->AllCards) { while ((pcr = vgaPCIInfo->AllCards[i++])) { - if (pcr->_vendor == PCI_VENDOR_NVIDIA_SGS) - { - if (pcr->_device == PCI_CHIP_RIVA128) - break; + int i, supported = 0; + for (i = 0; nvidia_pci_ids[i]; i++) + if( nvidia_pci_ids[i] == (pcr->_device | (pcr->_vendor << 16)) ) + supported++; + + if (supported) { + is_nv3 = (pcr->_vendor == PCI_VENDOR_NVIDIA_SGS) ? 1 : 0; + if (!is_nv3) arch = get_gpu_arch(pcr->_device); + break; } } } else { - PERROR(("No RIVA128 chip found in PCI info!\n")); + PERROR(("No supported nVidia GPU found in PCI info!\n")); return FALSE; } - if ( (!pcr) || (pcr->_device != PCI_CHIP_RIVA128) ) + if ( !pcr ) { - PERROR(("No RIVA128 chip found in PCI info!\n")); + PERROR(("No supported nVidia GPU found in PCI info!\n")); return FALSE; } PDEBUG(("PCI BASE0 = 0x%x\n", pcr->_base0)); -#ifndef DOS // Uses memory mapped registers, so must map memory fd = open( "/dev/mem", O_RDWR ); @@ -180,45 +579,71 @@ } // mmap the programmable RAMDAC into our address space - ptr = (int*)mmap( 0, 0x1000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, (off_t)(pcr->_base0) + PRAMDAC_BASE ); + PRAMDAC0 = (int*)mmap( 0, 0x1000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, (off_t)(pcr->_base0) + PRAMDAC_BASE ); - if( ptr == (int*)-1 ) + if( PRAMDAC0 == (int*)-1 ) { PERROR(( "Error mmap'ing /dev/mem" )); return FALSE; } + // mmap the PEXTDEV into our address space + PEXTDEV = (int*)mmap( 0, 0x1000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, (off_t)(pcr->_base0) + PEXTDEV_BASE ); + + if( PEXTDEV == (int*)-1 ) + { + PERROR(( "Error mmap'ing /dev/mem" )); + return FALSE; + } + close( fd ); -#else - ptr=(int*) malloc(0x4000); - if (!ptr || __djgpp_map_physical_memory(ptr, 0x1000, (off_t)(pcr->_base0))) + + // Get chip config + if (is_nv3) { + pll_coeff = 0x00010100; + max_clock = NV3_MAX_CLOCK_IN_KHZ; + CrystalFreqKHz = (PEXTDEV[0x00000000/4] & 0x00000020) ? 14318 : 13500; + twoStagePLL = 0; + } + else { - PERROR(("mmap() failed %d\n", ptr)); - return FALSE; + pll_coeff = 0x00000700; + CrystalFreqKHz = (PEXTDEV[0x0000/4] & (1 << 6)) ? 14318 : 13500; + if(arch & (NV17 | NV2X | NV3X | NV4X)) + { + if(PEXTDEV[0x0000/4] & (1 << 22)) CrystalFreqKHz = 27000; + } + twoStagePLL = (arch & (NV31 | NV35 | NV4X)); + + max_clock = twoStagePLL ? NV31_34_MAX_CLOCK_IN_KHZ + : NV4_MAX_CLOCK_IN_KHZ; } -#endif // Calculate the clock - NV3ClockSelect( (float)clockspeed, &out, &m, &n, &p ); - - value = (m) + (n<<8) + (p<<16); + if (twoStagePLL) { + CalcVClock2Stage ((float) clockspeed, 0, &out, &m, &n, &p, &pll2); + pll1 = (m) + (n<<8) + (p<<16); + PDEBUG(( "Wanted %dkHz, got %dkHz (m=%d, n=%d, p=%d, pll1=0x%08X, pll2=0x%08X)\n", + clockspeed, (int)out, m, n, p, pll1, pll2 )); + } else { + CalcVClock ((float) clockspeed, 0, &out, &m, &n, &p); + pll1 = (m) + (n<<8) + (p<<16); + PDEBUG(( "Wanted %dkHz, got %dkHz (m=%d, n=%d, p=%d, pll=0x%08X)\n", + clockspeed, (int)out, m, n, p, pll1 )); + } - // But of debug info - PDEBUG(( "Wanted %dkHz, got %dkHz (m=%d, n=%d, p=%d, value=0x%08X)\n", - clockspeed, (int)out, m, n, p, value )); - - // Default value is 0x00000100 - // X uses 0x10010100 - // We use 0x00010100 - ptr[PRAMDAC_PLL_COEFF_SELECT/4] = 0x00010100; // could use |= + // Default value is 0x00000100 (NV3) + // X uses 0x10010100 (NV3) or 0x10000700 (NV4/10/20/30) + // We use 0x00010100 (NV3) or 0x00000700 (NV4/10/20/30) + PRAMDAC0[PRAMDAC_PLL_COEFF_SELECT/4] = pll_coeff; // could use |= // Divide by 4 because we're dealing with integers - ptr[PRAMDAC_PLL_COEFF/4] = value; + PRAMDAC0[PRAMDAC_PLL_COEFF/4] = pll1; + if (twoStagePLL) PRAMDAC0[PRAMDAC_PLL2_COEFF/4] = pll2; -#ifndef DOS // Unmap memory - munmap( ptr, 0x1000 ); -#endif + munmap( PRAMDAC0, 0x1000 ); + munmap( PEXTDEV, 0x1000 ); // All done return TRUE; --- svgatextmode-1.9.orig/XFREE/vgaPCI.c +++ svgatextmode-1.9/XFREE/vgaPCI.c @@ -42,7 +42,7 @@ if (!pcrpp) return NULL; - while (pcrp = pcrpp[i]) { + while ( (pcrp = pcrpp[i]) ) { if ((pcrp->_base_class == PCI_CLASS_PREHISTORIC && pcrp->_sub_class == PCI_SUBCLASS_PREHISTORIC_VGA) || (pcrp->_base_class == PCI_CLASS_DISPLAY && @@ -66,10 +66,10 @@ * It should be possible to move this out into the Cirrus * driver now. */ - if (info->Vendor == PCI_VENDOR_CIRRUS && - (info->ChipType == PCI_CHIP_GD5462) || - (info->ChipType == PCI_CHIP_GD5464) || - (info->ChipType == PCI_CHIP_GD7548)) { + if ( info->Vendor == PCI_VENDOR_CIRRUS && + ( (info->ChipType == PCI_CHIP_GD5462) || + (info->ChipType == PCI_CHIP_GD5464) || + (info->ChipType == PCI_CHIP_GD7548) ) ) { info->IOBase = pcrp->_base0; info->MemBase = pcrp->_base1; @@ -81,7 +81,8 @@ break; } if (info->Vendor == PCI_VENDOR_MATROX && - (info->ChipType == PCI_CHIP_MGA2164)) { + (info->ChipType == PCI_CHIP_MGA2164 || + info->ChipType == PCI_CHIP_MGA2164AGP)) { info->IOBase = pcrp->_base1; info->MemBase = pcrp->_base0; } --- svgatextmode-1.9.orig/XFREE/vgaPCI.h +++ svgatextmode-1.9/XFREE/vgaPCI.h @@ -95,6 +95,13 @@ #define PCI_CHIP_MGA2064 0x0519 #define PCI_CHIP_MGA1064 0x051A #define PCI_CHIP_MGA2164 0x051B +#define PCI_CHIP_MGA2164AGP 0x051F + +#define PCI_CHIP_MGAG400 0x0525 +#define PCI_CHIP_MGAG200PCI 0x0520 +#define PCI_CHIP_MGAG200 0x0521 +#define PCI_CHIP_MGAG100PCI 0x1000 +#define PCI_CHIP_MGAG100 0x1001 /* Chips & Tech */ #define PCI_CHIP_65545 0x00D8 @@ -255,7 +262,13 @@ {PCI_CHIP_MGA2085, "MGA 2085PX"}, {PCI_CHIP_MGA2064, "MGA 2064W"}, {PCI_CHIP_MGA2164, "MGA 2164W"}, + {PCI_CHIP_MGA2164AGP, "MGA 2164W/AGP"}, {PCI_CHIP_MGA1064, "MGA 1064SG"}, + {PCI_CHIP_MGAG400, "MGA G400 AGP"}, + {PCI_CHIP_MGAG200PCI, "MGA G200 PCI"}, + {PCI_CHIP_MGAG200, "MGA G200 AGP"}, + {PCI_CHIP_MGAG100PCI, "MGA G100 PCI"}, + {PCI_CHIP_MGAG100, "MGA G100 AGP"}, {0x0000, NULL}}}, {PCI_VENDOR_CHIPSTECH, "C&T", { {PCI_CHIP_65545, "65545"}, --- svgatextmode-1.9.orig/XFREE/xfree_compat.h +++ svgatextmode-1.9/XFREE/xfree_compat.h @@ -14,6 +14,7 @@ #include #include +#include #ifndef _XF86_HWLIB_H @@ -105,7 +106,7 @@ Bool mga_get_pci_info(); void MGATi3026SetPCLK( long f_out, int bpp ); void MGATi3026SetMCLK( long f_out ); -void midSetPixClock( ulong freq ); +void midSetPixClock( ulong freq, int isG2 ); void MGAoutTi3026(unsigned char reg, unsigned char val); Bool RIVA128ClockSelect( int clockspeed ); --- svgatextmode-1.9.orig/cfg_structs.h +++ svgatextmode-1.9/cfg_structs.h @@ -141,9 +141,8 @@ extern int bordercolor; extern int cursor_start, cursor_end; - +extern const char *ConsoleDevice(const char *number); #endif - --- svgatextmode-1.9.orig/cfgfile.y +++ svgatextmode-1.9/cfgfile.y @@ -24,6 +24,7 @@ /****************************************************************************/ /* C DECLARATIONS */ +#include #include #include #include "cfg_structs.h" --- svgatextmode-1.9.orig/cfglex.l +++ svgatextmode-1.9/cfglex.l @@ -52,10 +52,9 @@ %} -/* These options reduce the warnings when compiling with -Wall, but need at least flex 2.5 +/* These options reduce the warnings when compiling with -Wall, but need at least flex 2.5 */ %option noyywrap %option nounput -*/ delim [ \t] ws {delim}+ --- svgatextmode-1.9.orig/chipset.h +++ svgatextmode-1.9/chipset.h @@ -121,6 +121,7 @@ #define CLKCHIP_MGA1064 24 #define CLKCHIP_LAGUNA 25 #define CLKCHIP_RIVA128 26 +#define CLKCHIP_MGAG200 27 #define OPT_HIBIT_LOW 1<<0 #define OPT_HIBIT_HIGH 1<<1 @@ -388,9 +389,9 @@ }, { CS_MATROX, - 1< +#include #include #include "misc.h" #include "vga_prg.h" @@ -279,10 +280,11 @@ MGATi3026SetPCLK(freq, 1); break; case CLKCHIP_MGA1064: + case CLKCHIP_MGAG200: if (!mga_get_pci_info()) PERROR(("Could not get Mystique PCI info\n")); MatroxClockSelect(2); - midSetPixClock(freq); + midSetPixClock(freq, clock_data.clockchiptype == CLKCHIP_MGAG200); break; default: PERROR(("Unknown clock chip #%d for Matrox chipset.\n", clock_data.clockchiptype)); } @@ -395,6 +397,7 @@ (void) MGATi3026SetMCLK(freq); break; case CLKCHIP_MGA1064: + case CLKCHIP_MGAG200: break; default: ENDRESET_SEQ; --- svgatextmode-1.9.orig/console_dev.c +++ svgatextmode-1.9/console_dev.c @@ -0,0 +1,62 @@ +/* SVGATextMode -- An SVGA textmode manipulation/enhancement tool + * + * console_dev.c -- console device base name discovery + * + * Copyright (C) 2000 Ron Lee + * + * 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 License, or + * (at your option) 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include + +#include "messages.h" + +static char console_device_name[64] = ""; + +void GetConsoleDevice(void) +{ + const char device_list[][10] = { "/dev/vc/", "/dev/tty", "" }; + struct stat st; + char dev[64]; + int i = 0; + + while( device_list[i][0] != '\0' ) { + snprintf(dev, sizeof(dev), "%s0", device_list[i]); + if( !stat(dev, &st) ) { + strncpy(console_device_name, device_list[i], sizeof(console_device_name)); + return; + } + ++i; + } + PERROR(("Failed to determine console device name\n")); +} + +const char *ConsoleDevice(const char *number) +{ + static char device[64]; + + if( console_device_name[0] == '\0' ) + GetConsoleDevice(); + + snprintf(device, sizeof(device), "%s%s", console_device_name, number); + + return device; +} + --- svgatextmode-1.9.orig/contrib/STM_utilities.8 +++ svgatextmode-1.9/contrib/STM_utilities.8 @@ -0,0 +1,25 @@ +.TH STM_utilities 8 "10 April 1999" "Debian GNU/Linux" "SVGATextMode Utilities" +.\" Copyright (c) 1999 Ron Lee. All rights reserved. +.\" This text may be distributed under the terms of the GPL. +.\" +.SH NAME +STM_utilities \- helper programs supplied with SVGATextMode +.SH SYNOPSIS +.B STM_reset +.br +.B ClockProg +.br +.B getVGAreg +.br +.B getpalette +.br +.B setVGAreg +.br +.B setpalette +.br +.B set80 +.SH "DESCRIPTION" +These utilities currently do not have manual pages. +.PP +see \fI/usr/doc/svgatextmode\fP for details about their use. + --- svgatextmode-1.9.orig/contrib/scripts/STM_reset +++ svgatextmode-1.9/contrib/scripts/STM_reset @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # This scripts is called from the "resetprog" line in TextConfig, # when SVGATextMode has finished switching modes. @@ -13,10 +13,19 @@ # on some kernel versions (according to Mr Rubini). # +# *** old gpm pid file.. kept for backward compatibility *** if [ -f /var/run/gpmpid ] then echo "Screen resized to $1x$2. Restarting GPM..." - kill -WINCH `cat /var/run/gpmpid # gets pid from current gpm daemon, and send resize signal to it + kill -WINCH `cat /var/run/gpmpid` # gets pid from current gpm daemon, and send resize signal to it +fi + +# *** modified by Ron Lee *** +# *** to do the same for the new one *** +if [ -f /var/run/gpm.pid ] +then + echo "Screen resized to $1x$2. Restarting GPM..." + kill -WINCH `cat /var/run/gpm.pid` # gets pid from current gpm daemon, and send resize signal to it fi # --- svgatextmode-1.9.orig/contrib/scripts/STMmenu +++ svgatextmode-1.9/contrib/scripts/STMmenu @@ -24,7 +24,7 @@ exit fi -STM=/usr/sbin/SVGATextMode +STM=/sbin/SVGATextMode ModeDB=`$STM -s | awk '{ printf("%s \"%10s %8s %6s %18s\" "),$1,$3,$5,$7,$9}' ` --- svgatextmode-1.9.orig/contrib/scripts/gettextregs +++ svgatextmode-1.9/contrib/scripts/gettextregs @@ -7,7 +7,8 @@ # current mode. It does about the same as "textmode" from svgalib # -BINDIR=. +#BINDIR=. +BINDIR=/usr/sbin $BINDIR/getVGAreg -x CRTC 0 $BINDIR/getVGAreg -x CRTC 1 --- svgatextmode-1.9.orig/debian/NEWS +++ svgatextmode-1.9/debian/NEWS @@ -0,0 +1,12 @@ +svgatextmode (1.9-16) unstable; urgency=low + + The console-tools package is scheduled to be dropped from Lenny, so the + SVGATextmode package once again depends upon kbd instead. If you are + currently using it with console-tools you will have to edit your existing + TextConfig to change the FontProg back to /usr/bin/setfont before your + next reboot. If you are installing this package with no existing config + files you may disregard this message, the FontProg will be set correctly + in the TextConfig supplied by the package. + + -- Ron Lee Sun, 03 Jun 2007 05:53:35 +0930 + --- svgatextmode-1.9.orig/debian/Patches/001-S3Trio3D2X.diff +++ svgatextmode-1.9/debian/Patches/001-S3Trio3D2X.diff @@ -0,0 +1,108 @@ +To: ron@debian.org +From: "Stanislav V. Voronyi" +Date: Sat, 26 Jun 1999 17:30:38 +0300 +Subject: diff for SVGATextMode to support S3 Trio 3D2X + + Hi! +I've bought S3 Trio3D2X card and found that SVGAText mode does not +work properly with it. I've made a patch for SVGATextmode to make +it workable & sent it to author of SVGATextMode. But he answered me +that he has not plan to future support of this project and suggest +me send this patch to debian. The patch is very short so I attach it +to end of this letter. + + Sincerely Yours, Stanislav Voronyi. +------------------------------------------------------------------------- +diff -u --recursive SVGATextMode-1.8-src/TextConfig SVGATextMode-1.8-src.s3d/TextConfig +--- SVGATextMode-1.8-src/TextConfig Wed Nov 12 22:21:29 1997 ++++ SVGATextMode-1.8-src.s3d/TextConfig Fri Jun 4 12:25:01 1999 +@@ -60,21 +60,21 @@ + # This is for a "generic" VGA card. It should work on ANY VGA card, but can + # only use the first 4 clocks + +-Chipset "VGA" +-Clocks 25.175 28.322 ++#Chipset "VGA" ++#Clocks 25.175 28.322 + +-echo "The SVGATextMode config file is configured as `standard VGA' by default." +-echo "This is highly sub-optimal on modern VGA cards." +-echo "Edit the TextConfig file for your VGA card to enable the many extra features." +-echo "(and then you can also get rid of this message...)." +-echo "" ++#echo "The SVGATextMode config file is configured as `standard VGA' by default." ++#echo "This is highly sub-optimal on modern VGA cards." ++#echo "Edit the TextConfig file for your VGA card to enable the many extra features." ++#echo "(and then you can also get rid of this message...)." ++#echo "" + + + ############################################################# + # + # Now come the SVGA chipsets + +-#ChipSet "S3" ++ChipSet "S3" + + #Clocks 25.175 28.322 40.00 0.00 50.00 77.00 36.00 44.90 + #Clocks 130.00 120.00 80.00 31.50 110.00 65.00 75.00 94.50 +@@ -87,7 +87,7 @@ + #ClockChip "sc11412" + #ClockChip "s3gendac" + #ClockChip "s3_sdac" +-#ClockChip "S3Trio" ++ClockChip "S3Trio" + #ClockChip "S3Virge" + #ClockChip "ti3025" + #ClockChip "ics2595" +@@ -108,7 +108,7 @@ + #Option "SLOW_DRAM" + #Option "MED_DRAM" + #Option "FAST_DRAM" +-#Option "XFAST_DRAM" ++Option "XFAST_DRAM" + + # This option enables S3 high-speed text modes for pixel clocks > 36 MHz. + # USE WITH CAUTION! This needs a different font format in VGA memory. Read +@@ -118,7 +118,7 @@ + # before strange effects appear. Older S3 cards (911, 924, 928, ...) need + # this option for modes with >36 MHz pixel clocks + +-#Option "S3_HSText" ++Option "S3_HSText" + + # IBM RGB RAMDAC's absolutely _need_ this. You will have to copy this value + # from the output of the XFree86 server startup messages. MAKE SURE THIS +@@ -128,6 +128,7 @@ + # non-standard text mode. + + #RefClk 14.31818 # common values are: 14.31818, 16.0 , 24.0 and 50.0 MHz ++RefClk 28 # For S3 Trio3D2X + + #ChipSet "ET4000" + #Option "hibit_high" # This option MUST be in your XF86Config file, too!!! +diff -u --recursive SVGATextMode-1.8-src/XFREE/common_hw/S3gendac.c SVGATextMode-1.8-src.s3d/XFREE/common_hw/S3gendac.c +--- SVGATextMode-1.8-src/XFREE/common_hw/S3gendac.c Mon Dec 9 22:11:32 1996 ++++ SVGATextMode-1.8-src.s3d/XFREE/common_hw/S3gendac.c Fri Jun 4 12:26:37 1999 +@@ -8,6 +8,7 @@ + /* $XConsortium: S3gendac.c /main/9 1995/12/28 17:16:09 kaleb $ */ + + #include "Xfuncproto.h" ++#include "cfg_structs.h" + #include "S3gendac.h" + #include "compiler.h" + #define NO_OSLIB_PROTOTYPES +diff -u --recursive SVGATextMode-1.8-src/XFREE/common_hw/S3gendac.h SVGATextMode-1.8-src.s3d/XFREE/common_hw/S3gendac.h +--- SVGATextMode-1.8-src/XFREE/common_hw/S3gendac.h Mon Dec 9 22:49:18 1996 ++++ SVGATextMode-1.8-src.s3d/XFREE/common_hw/S3gendac.h Tue Jun 1 14:45:27 1999 +@@ -8,7 +8,7 @@ + + #define GENDAC_INDEX 0x3C8 + #define GENDAC_DATA 0x3C9 +-#define BASE_FREQ 14.31818 /* MHz */ ++#define BASE_FREQ ((clock_data.refclk==REFCLK_NOT_DEFINED)?14.31818:clock_data.refclk/1000.0) /* MHz */ + + int S3gendacSetClock( + #if NeedFunctionPrototypes + + --- svgatextmode-1.9.orig/debian/Patches/002-MGAGx00.diff +++ svgatextmode-1.9/debian/Patches/002-MGAGx00.diff @@ -0,0 +1,303 @@ +This patch was written by Tom Zerucha and was obtained from: +www.execpc.com/~tz + +Only in SVGAT.Gx00: SVGATextMode +diff -Bbur SVGATextMode-1.9-src/TextConfig SVGAT.Gx00/TextConfig +--- SVGATextMode-1.9-src/TextConfig Tue Oct 13 15:09:15 1998 ++++ SVGAT.Gx00/TextConfig Sun Jan 9 18:46:29 2000 +@@ -298,6 +298,7 @@ + #Chipset "matrox" + #clockchip "ti3026" # for the Millennium + #clockchip "mystique" # for the Mystique ++#clockchip "mgag200" # for the G100 and G200 (only tested on last) + + + # +@@ -1011,6 +1012,8 @@ + "B160x30" 94.5 1280 1348 1432 1680 960 986 989 1023 font 8x32 + "B160x100" 94.5 1280 1352 1472 1680 800 809 819 850 font 8x8 + ++#160x100 for Matrox cards ++"MGA160x100" 65 1280 1312 1420 1500 800 810 820 830 font 8x8 + + ############################################################################### + # CUSTOM modes: put your own modes (new or adapted from above) here. +diff -Bbur SVGATextMode-1.9-src/XFREE/mga_clock.c SVGAT.Gx00/XFREE/mga_clock.c +--- SVGATextMode-1.9-src/XFREE/mga_clock.c Wed Nov 26 10:53:09 1997 ++++ SVGAT.Gx00/XFREE/mga_clock.c Sun Jan 9 20:03:08 2000 +@@ -58,7 +58,13 @@ + { + if ((pcr->_device == PCI_CHIP_MGA2064) + || (pcr->_device == PCI_CHIP_MGA1064) +- || (pcr->_device == PCI_CHIP_MGA2164)) ++ || (pcr->_device == PCI_CHIP_MGA2164) ++ || (pcr->_device == PCI_CHIP_MGAG200) ++ || (pcr->_device == PCI_CHIP_MGAG400) ++ || (pcr->_device == PCI_CHIP_MGAG100) ++ || (pcr->_device == PCI_CHIP_MGAG200PCI) ++ || (pcr->_device == PCI_CHIP_MGAG100PCI) ++ || (pcr->_device == PCI_CHIP_MGA2164AGP)) + break; + } + } +@@ -66,7 +72,15 @@ + + if (!pcr) return(FALSE); + +- if ((pcr->_device != PCI_CHIP_MGA2064) && (pcr->_device != PCI_CHIP_MGA1064) && (pcr->_device != PCI_CHIP_MGA2164)) ++ if ((pcr->_device != PCI_CHIP_MGA2064) ++ && (pcr->_device != PCI_CHIP_MGA1064) ++ && (pcr->_device != PCI_CHIP_MGA2164) ++ && (pcr->_device != PCI_CHIP_MGAG100) ++ && (pcr->_device != PCI_CHIP_MGAG200) ++ && (pcr->_device != PCI_CHIP_MGAG400) ++ && (pcr->_device != PCI_CHIP_MGAG100PCI) ++ && (pcr->_device != PCI_CHIP_MGAG200PCI) ++ && (pcr->_device != PCI_CHIP_MGA2164AGP)) + return(FALSE); + + /* +@@ -88,7 +102,13 @@ + + if ( ( (pcr->_device == PCI_CHIP_MGA1064) && + (pcr->_rev_id == 0x3)) || +- (pcr->_device == PCI_CHIP_MGA2164)) ++ (pcr->_device == PCI_CHIP_MGA2164) ++ || (pcr->_device == PCI_CHIP_MGAG400) ++ || (pcr->_device == PCI_CHIP_MGAG200) ++ || (pcr->_device == PCI_CHIP_MGAG200PCI) ++ || (pcr->_device == PCI_CHIP_MGAG100) ++ || (pcr->_device == PCI_CHIP_MGAG100PCI) ++ || (pcr->_device == PCI_CHIP_MGA2164AGP)) + + { + /* +@@ -122,16 +142,46 @@ + return TRUE; + } + +-static ulong midCalcFreq(uchar m, uchar n, uchar p) { +- ulong retval = ((14318 * (n + 1)) / (m + 1)) / (p + 1); ++static ulong midCalcFreq(int reff, uchar m, uchar n, uchar p) { ++ ulong retval = ((reff * (n + 1)) / (m + 1)) / (p + 1); + return retval; + } + +-static ulong midCalcMNPS(ulong freq, uchar *m, uchar *n, uchar *p, uchar *s) { ++ ++ ++ ++ ++ ++ ++static ulong midCalcMNPS(ulong freq, uchar *m, uchar *n, uchar *p, uchar *s, int type) { + ulong Fvco; + long delta, d; + uchar nt, mt, pt; + ++ int feed_div_min, feed_div_max; ++ int in_div_min, in_div_max; ++ ++ int reff; ++ ++ switch( type ) ++{ ++case 0: ++ reff = 14318; ++ feed_div_min = 100; ++ feed_div_max = 127; ++ in_div_min = 1; ++ in_div_max = 31; ++ break; ++default: ++ reff = 27051; ++ feed_div_min = 7; ++ feed_div_max = 127; ++ in_div_min = 1; ++ in_div_max = 6; ++ break; ++} ++ ++ + // find m and n such that: + // 'freq' - ((14318 * (n + 1)) / (m + 1)) / (p + 1) + // is as close to 0 as possible +@@ -140,9 +190,9 @@ + for (pt = 1; pt <= 8; pt <<= 1) { + Fvco = freq * pt; + if ((Fvco > 50000) && (Fvco < 220000)) { +- for (nt = 127; nt >= 100; nt--) { +- for (mt = 1; mt < 32; mt++) { +- d = (long)midCalcFreq(mt, nt, (pt - 1)) - (long)freq; ++ for (nt = feed_div_max; nt >= feed_div_min; nt--) { ++ for (mt = in_div_min; mt <= in_div_max; mt++) { ++ d = (long)midCalcFreq(reff, mt, nt, (pt - 1)) - (long)freq; + if (d < 0) d = -d; + if (d < delta) { + *n = nt; +@@ -158,7 +208,7 @@ + } + } + } +- return midCalcFreq(*m, *n, *p); ++ return midCalcFreq(reff, *m, *n, *p); + } + /* ================== XFREE code starts here ======================== */ + +@@ -194,12 +244,14 @@ + return val; + } + +-void midSetPixClock(ulong freq) { ++void midSetPixClock(ulong freq, int isG2) { + uchar m, n, p, s; + uchar tmpByte; + + PDEBUG(("Requested PIX clock freq: %d\n", freq)); +- midCalcMNPS(freq, &m, &n, &p, &s); ++ freq = midCalcMNPS(freq, &m, &n, &p, &s, isG2); ++ ++ PDEBUG(("Actual PIX clock freq: %ld\n", freq)); + + // MGA1064SG 5-77 + // Step 1) force screen off +@@ -226,7 +278,7 @@ + PDEBUG(("VGA_MISC_W - wrote 0x%02x, read 0x%02x\n", + tmpByte, INREG8(VGA_MISC_R))); + #endif +- ++ PDEBUG(("Wait for PLL lock\n")); + // Step 4) wait for frequency lock + while ((MGAinTi3026(MID_XPIXPLLSTAT) & 0x40) != 0x40); + #endif +diff -Bbur SVGATextMode-1.9-src/XFREE/vgaPCI.c SVGAT.Gx00/XFREE/vgaPCI.c +--- SVGATextMode-1.9-src/XFREE/vgaPCI.c Wed Nov 26 10:56:43 1997 ++++ SVGAT.Gx00/XFREE/vgaPCI.c Sun Jan 9 18:46:29 2000 +@@ -81,7 +81,8 @@ + break; + } + if (info->Vendor == PCI_VENDOR_MATROX && +- (info->ChipType == PCI_CHIP_MGA2164)) { ++ (info->ChipType == PCI_CHIP_MGA2164 || ++ info->ChipType == PCI_CHIP_MGA2164AGP)) { + info->IOBase = pcrp->_base1; + info->MemBase = pcrp->_base0; + } +diff -Bbur SVGATextMode-1.9-src/XFREE/vgaPCI.h SVGAT.Gx00/XFREE/vgaPCI.h +--- SVGATextMode-1.9-src/XFREE/vgaPCI.h Wed Nov 26 10:52:14 1997 ++++ SVGAT.Gx00/XFREE/vgaPCI.h Sun Jan 9 20:04:19 2000 +@@ -95,6 +95,13 @@ + #define PCI_CHIP_MGA2064 0x0519 + #define PCI_CHIP_MGA1064 0x051A + #define PCI_CHIP_MGA2164 0x051B ++#define PCI_CHIP_MGA2164AGP 0x051F ++ ++#define PCI_CHIP_MGAG400 0x0525 ++#define PCI_CHIP_MGAG200PCI 0x0520 ++#define PCI_CHIP_MGAG200 0x0521 ++#define PCI_CHIP_MGAG100PCI 0x1000 ++#define PCI_CHIP_MGAG100 0x1001 + + /* Chips & Tech */ + #define PCI_CHIP_65545 0x00D8 +@@ -255,7 +262,18 @@ + {PCI_CHIP_MGA2085, "MGA 2085PX"}, + {PCI_CHIP_MGA2064, "MGA 2064W"}, + {PCI_CHIP_MGA2164, "MGA 2164W"}, ++ {PCI_CHIP_MGA2164AGP, "MGA 2164W/AGP"}, + {PCI_CHIP_MGA1064, "MGA 1064SG"}, ++ ++ ++ {PCI_CHIP_MGAG400, "MGA G400 AGP"}, ++ {PCI_CHIP_MGAG200PCI, "MGA G200 PCI"}, ++ {PCI_CHIP_MGAG200, "MGA G200 AGP"}, ++ {PCI_CHIP_MGAG100PCI, "MGA G100 PCI"}, ++ {PCI_CHIP_MGAG100, "MGA G100 AGP"}, ++ ++ ++ + {0x0000, NULL}}}, + {PCI_VENDOR_CHIPSTECH, "C&T", { + {PCI_CHIP_65545, "65545"}, +diff -Bbur SVGATextMode-1.9-src/XFREE/xfree_compat.h SVGAT.Gx00/XFREE/xfree_compat.h +--- SVGATextMode-1.9-src/XFREE/xfree_compat.h Mon Oct 19 06:46:49 1998 ++++ SVGAT.Gx00/XFREE/xfree_compat.h Sun Jan 9 18:46:29 2000 +@@ -105,7 +105,7 @@ + Bool mga_get_pci_info(); + void MGATi3026SetPCLK( long f_out, int bpp ); + void MGATi3026SetMCLK( long f_out ); +-void midSetPixClock( ulong freq ); ++void midSetPixClock( ulong freq, int isG2 ); + void MGAoutTi3026(unsigned char reg, unsigned char val); + + Bool RIVA128ClockSelect( int clockspeed ); +Only in SVGAT.Gx00/XFREE: xfree_compat.h.orig +Only in SVGAT.Gx00: cfglex.c +diff -Bbur SVGATextMode-1.9-src/chipset.h SVGAT.Gx00/chipset.h +--- SVGATextMode-1.9-src/chipset.h Wed Oct 14 14:39:07 1998 ++++ SVGAT.Gx00/chipset.h Sun Jan 9 18:48:25 2000 +@@ -121,6 +121,7 @@ + #define CLKCHIP_MGA1064 24 + #define CLKCHIP_LAGUNA 25 + #define CLKCHIP_RIVA128 26 ++#define CLKCHIP_MGAG200 27 + + #define OPT_HIBIT_LOW 1<<0 + #define OPT_HIBIT_HIGH 1<<1 +@@ -388,9 +389,9 @@ + }, + + { CS_MATROX, +- 1< 1) { + ErrorF("PCI: Bus 0x%x Card 0x%02x Func 0x%x ID 0x%04x," + "0x%04x Rev 0x%02x Class 0x%02x,0x%02x\n", +- pcr._bus, pcr._cardnum, pcr._func, pcr._vendor, ++ (unsigned)pcr._bus, (unsigned)pcr._cardnum, (unsigned)pcr._func, pcr._vendor, + pcr._device, pcr._rev_id, pcr._base_class, + pcr._sub_class); + } +@@ -941,13 +943,13 @@ + return; + + tag = pcibusTag(bus, cardnum, func); +- data = pcibusRead(tag, reg) & ~mask | (value & mask); ++ data = (pcibusRead(tag, reg) & ~mask) | (value & mask); + pcibusWrite(tag, reg, data); + + if (xf86Verbose > 2) { + ErrorF("PCI: xf86writepci: Bus=0x%x Card=0x%x Func=0x%x Reg=0x%02x " + "Mask=0x%08x Val=0x%08x\n", +- bus, cardnum, func, reg, mask, value); ++ bus, cardnum, func, reg, (unsigned)mask, (unsigned)value); + } + + pciDisableIO(scrnIndex); +diff -rub svgatextmode-1.9-old/XFREE/mga_clock.c svgatextmode-1.9/XFREE/mga_clock.c +--- svgatextmode-1.9-old/XFREE/mga_clock.c Tue Sep 26 12:56:32 2000 ++++ svgatextmode-1.9/XFREE/mga_clock.c Wed Sep 27 03:51:15 2000 +@@ -394,7 +394,7 @@ + int *n; + int *p; + { +- int best_m, best_n; ++ int best_m = 0, best_n = 0; + double f_pll, f_vco; + double m_err, inc_m, calc_m; + +diff -rub svgatextmode-1.9-old/XFREE/vgaPCI.c svgatextmode-1.9/XFREE/vgaPCI.c +--- svgatextmode-1.9-old/XFREE/vgaPCI.c Tue Sep 26 12:58:08 2000 ++++ svgatextmode-1.9/XFREE/vgaPCI.c Wed Sep 27 03:50:17 2000 +@@ -42,7 +42,7 @@ + if (!pcrpp) + return NULL; + +- while (pcrp = pcrpp[i]) { ++ while ( (pcrp = pcrpp[i]) ) { + if ((pcrp->_base_class == PCI_CLASS_PREHISTORIC && + pcrp->_sub_class == PCI_SUBCLASS_PREHISTORIC_VGA) || + (pcrp->_base_class == PCI_CLASS_DISPLAY && +@@ -66,10 +66,10 @@ + * It should be possible to move this out into the Cirrus + * driver now. + */ +- if (info->Vendor == PCI_VENDOR_CIRRUS && +- (info->ChipType == PCI_CHIP_GD5462) || ++ if ( info->Vendor == PCI_VENDOR_CIRRUS && ++ ( (info->ChipType == PCI_CHIP_GD5462) || + (info->ChipType == PCI_CHIP_GD5464) || +- (info->ChipType == PCI_CHIP_GD7548)) { ++ (info->ChipType == PCI_CHIP_GD7548) ) ) { + info->IOBase = pcrp->_base0; + info->MemBase = pcrp->_base1; + +diff -rub svgatextmode-1.9-old/XFREE/xfree_compat.h svgatextmode-1.9/XFREE/xfree_compat.h +--- svgatextmode-1.9-old/XFREE/xfree_compat.h Tue Sep 26 13:03:02 2000 ++++ svgatextmode-1.9/XFREE/xfree_compat.h Wed Sep 27 02:49:36 2000 +@@ -14,6 +14,7 @@ + + #include + #include ++#include + + #ifndef _XF86_HWLIB_H + +diff -rub svgatextmode-1.9-old/cfglex.l svgatextmode-1.9/cfglex.l +--- svgatextmode-1.9-old/cfglex.l Tue Sep 9 03:37:20 1997 ++++ svgatextmode-1.9/cfglex.l Wed Sep 27 03:12:52 2000 +@@ -52,10 +52,9 @@ + + %} + +-/* These options reduce the warnings when compiling with -Wall, but need at least flex 2.5 ++/* These options reduce the warnings when compiling with -Wall, but need at least flex 2.5 */ + %option noyywrap + %option nounput +-*/ + + delim [ \t] + ws {delim}+ +diff -rub svgatextmode-1.9-old/user_time.c svgatextmode-1.9/user_time.c +--- svgatextmode-1.9-old/user_time.c Sat Sep 5 23:47:16 1998 ++++ svgatextmode-1.9/user_time.c Wed Sep 27 03:51:56 2000 +@@ -35,7 +35,7 @@ + { + static unsigned long time=0; + static unsigned short last_count=0; +- unsigned short count; ++ unsigned short count = 0; + + /* + note: dynamic detection of the max. latch value is only possible +diff -rub svgatextmode-1.9-old/vga_prg.c svgatextmode-1.9/vga_prg.c +--- svgatextmode-1.9-old/vga_prg.c Wed Oct 14 04:58:44 1998 ++++ svgatextmode-1.9/vga_prg.c Wed Sep 27 03:03:58 2000 +@@ -33,6 +33,13 @@ + #include "textregs.h" /* for Set_Textmode */ + + /* ++ * this is ugly, it's really declared in sys/io.h but including that here ++ * fritzes the inb/outb macros again. otoh compiler warnings are ugly too. ++ * -- Ron ++ */ ++extern int iopl(int); ++ ++/* + * global vars + */ + + --- svgatextmode-1.9.orig/debian/Patches/004-devfs.diff +++ svgatextmode-1.9/debian/Patches/004-devfs.diff @@ -0,0 +1,226 @@ +If all goes well, this patch along with the code I wrote in console_dev.c +should enable STM to work transparently with both devfs and traditional +console devices. + +Many thanks to Sergey Golod who did the initial legwork to figure out +what was required! + + Ron + + +diff -rub svgatextmode-1.9-old/Makefile svgatextmode-1.9/Makefile +--- svgatextmode-1.9-old/Makefile Tue Sep 26 15:35:02 2000 ++++ svgatextmode-1.9/Makefile Wed Sep 27 03:53:53 2000 +@@ -145,18 +145,19 @@ + + STM_OBJECTS = ttyresize.o messages.o vga_prg.o setclock.o file_ops.o SVGATextMode.o \ + validate.o run_extprog.o wait_vsync.o clockchip.o std_clock.o cfglex.o \ +- y.tab.o misc.o dump_cfgdata.o kversion.o unlock_svga.o special_svga.o ++ y.tab.o misc.o dump_cfgdata.o kversion.o unlock_svga.o special_svga.o \ ++ console_dev.o + + CP_OBJECTS = messages.o vga_prg.o setclock.o file_ops.o string_ops.o ClockProg.o \ + validate.o run_extprog.o wait_vsync.o clockchip.o std_clock.o cfglex.o \ + y.tab.o misc.o dump_cfgdata.o unlock_svga.o special_svga.o + +-SET80_OBJECTS = set80.o vga_prg.o messages.o ttyresize.o file_ops.o kversion.o ++SET80_OBJECTS = set80.o vga_prg.o messages.o ttyresize.o file_ops.o kversion.o console_dev.o + + VGAREG_OBJECTS = setVGAreg.o vga_prg.o file_ops.o string_ops.o messages.o \ + cfglex.o y.tab.o misc.o unlock_svga.o + +-PAL_OBJECTS = setpalette.o vga_prg.o string_ops.o messages.o file_ops.o kversion.o ++PAL_OBJECTS = setpalette.o vga_prg.o string_ops.o messages.o file_ops.o kversion.o console_dev.o + + GRAB_OBJECTS = grabmode.o modedata.o probe.o wait_vsync.o vga_prg.o messages.o \ + string_ops.o user_time.o +diff -rub svgatextmode-1.9-old/SVGATextMode.c svgatextmode-1.9/SVGATextMode.c +--- svgatextmode-1.9-old/SVGATextMode.c Tue Sep 26 16:57:05 2000 ++++ svgatextmode-1.9/SVGATextMode.c Wed Sep 27 02:47:30 2000 +@@ -140,6 +140,9 @@ + + t_mode *curr_textmode; + ++ const char *cdev = ConsoleDevice(""); ++ size_t clen = strlen(cdev); ++ + /* + * command-line argument parsing + */ +@@ -199,7 +202,7 @@ + if ((cptr=ttyname(STDIN_FILENO))) { + PDEBUG(("running from %s\n", cptr)); + if (strcmp(cptr, "/dev/console")) +- if ( !((!strncmp(cptr, "/dev/tty",8)) && (isdigit(cptr[8]))) ) ++ if ( !((!strncmp(cptr, cdev, clen)) && (isdigit(cptr[clen]))) ) + { + PERROR(("You can only run SVGATextMode from a virtual terminal " + "(=not in X or remotely), unless you use the '-x' option.\n")); +diff -rub svgatextmode-1.9-old/cfg_structs.h svgatextmode-1.9/cfg_structs.h +--- svgatextmode-1.9-old/cfg_structs.h Sun Sep 6 00:35:20 1998 ++++ svgatextmode-1.9/cfg_structs.h Wed Sep 27 02:40:08 2000 +@@ -141,9 +141,8 @@ + extern int bordercolor; + extern int cursor_start, cursor_end; + +- ++extern const char *ConsoleDevice(const char *number); + + #endif +- + + +Only in svgatextmode-1.9: console_dev.c +diff -rub svgatextmode-1.9-old/file_ops.c svgatextmode-1.9/file_ops.c +--- svgatextmode-1.9-old/file_ops.c Sat Sep 5 23:47:46 1998 ++++ svgatextmode-1.9/file_ops.c Wed Sep 27 02:42:07 2000 +@@ -39,7 +39,7 @@ + return(param_file); + } + +-int opentty(char *devname) ++int opentty(const char *devname) + { + int fd; + +diff -rub svgatextmode-1.9-old/file_ops.h svgatextmode-1.9/file_ops.h +--- svgatextmode-1.9-old/file_ops.h Sat Sep 5 23:49:19 1998 ++++ svgatextmode-1.9/file_ops.h Wed Sep 27 02:42:22 2000 +@@ -22,7 +22,7 @@ + + FILE* open_param_file(char* conf_file); + +-int opentty(char *devname); ++int opentty(const char *devname); + + #endif + +diff -rub svgatextmode-1.9-old/set80.c svgatextmode-1.9/set80.c +--- svgatextmode-1.9-old/set80.c Fri Oct 9 05:58:50 1998 ++++ svgatextmode-1.9/set80.c Wed Sep 27 02:31:05 2000 +@@ -183,7 +183,7 @@ + + + #ifndef DOS +- ioctl(opentty("/dev/tty0"), KDSETMODE, KD_TEXT); ++ ioctl(opentty( ConsoleDevice("0") ), KDSETMODE, KD_TEXT); + #endif + + #else +diff -rub svgatextmode-1.9-old/setpalette.c svgatextmode-1.9/setpalette.c +--- svgatextmode-1.9-old/setpalette.c Sat Sep 5 23:47:26 1998 ++++ svgatextmode-1.9/setpalette.c Wed Sep 27 04:00:46 2000 +@@ -156,7 +156,7 @@ + } + + +-void main (int argc, char* argv[]) ++int main (int argc, char* argv[]) + { + int index,r,g,b; + char* commandfilename; +@@ -228,11 +228,11 @@ + + if (program_hardware && setreg && kernel_can_do_cmap && tellkernel) + { +- fd = opentty("/dev/tty0"); ++ fd = opentty( ConsoleDevice("0") ); + if (ioctl(fd, GIO_CMAP, kernel_palette)) /* this ioctl first popped up in kernel 1.3.3 */ + { + perror("GIO_CMAP"); +- PERROR(("Could not do GIO_CMAP on /dev/tty0\n")); ++ PERROR(("Could not do GIO_CMAP on %s\n", ConsoleDevice("0"))); + } + } + +@@ -317,8 +317,11 @@ + if (ioctl(fd, PIO_CMAP, kernel_palette)) + { + perror("PIO_CMAP"); +- PERROR(("Could not do PIO_CMAP on /dev/tty0\n")); ++ PERROR(("Could not do PIO_CMAP on %s\n", ConsoleDevice("0"))); + } + close (fd); + } ++ ++ exit(0); + } ++ +diff -rub svgatextmode-1.9-old/ttyresize.c svgatextmode-1.9/ttyresize.c +--- svgatextmode-1.9-old/ttyresize.c Tue Sep 26 16:58:25 2000 ++++ svgatextmode-1.9/ttyresize.c Wed Sep 27 02:46:44 2000 +@@ -62,7 +62,7 @@ + # include + #endif + +-void get_ttysize(int fd, char *devname, struct winsize *this_winsize) ++void get_ttysize(int fd, const char *devname, struct winsize *this_winsize) + { + if (ioctl(fd, TIOCGWINSZ, this_winsize)) + { +@@ -74,7 +74,7 @@ + + #ifndef NO_RESIZE + +-void set_ttysize(int fd, char *devname, struct winsize *this_winsize, int cols, int rows) ++void set_ttysize(int fd, const char *devname, struct winsize *this_winsize, int cols, int rows) + { + /* no need to skip this if the screen is not resized. The kernel already does that */ + +@@ -89,7 +89,7 @@ + } + } + +-void resizetty(char *devicename, int cols, int rows) ++void resizetty(const char *devicename, int cols, int rows) + { + struct winsize my_winsize; + int fd; +@@ -214,7 +214,7 @@ + int fd; + + PDEBUG(("%s\n", descr)); +- fd = opentty("/dev/tty0"); ++ fd = opentty( ConsoleDevice("0") ); + + if (try_resize(fd, p_struct_size, memsize, cmd)) return(FALSE); + +@@ -349,15 +349,15 @@ + struct vt_stat vst; + unsigned short mask; + int i; +- char devicename[64]; ++ char devicenum[5]; + + PDEBUG(("Resizing all active VT's when needed\n")); + +- fd = opentty("/dev/tty0"); ++ fd = opentty( ConsoleDevice("0") ); + if (ioctl(fd, VT_GETSTATE, &vst)) + { + perror("VT_GETSTATE"); +- PERROR(("Could not do VT_GETSTATE on /dev/tty0\n")); ++ PERROR(("Could not do VT_GETSTATE on %s\n", ConsoleDevice("0"))); + } + close(fd); + +@@ -372,8 +372,8 @@ + { + if ((vst.v_state & mask) != 0) /* only resize active VT's */ + { +- snprintf(devicename, sizeof(devicename), "/dev/tty%d",i); +- resizetty(devicename, cols, rows); ++ snprintf(devicenum, sizeof(devicenum), "%d", i); ++ resizetty(ConsoleDevice(devicenum), cols, rows); + } + } + } +@@ -384,7 +384,7 @@ + { + struct winsize my_winsize; + int fd; +- char devicename[]="/dev/tty0"; ++ const char *devicename = ConsoleDevice("0"); + + PDEBUG(("Checking if new mode requires screen resizing (from %s)\n", devicename)); + --- svgatextmode-1.9.orig/debian/Patches/005-RivaTNT.diff +++ svgatextmode-1.9/debian/Patches/005-RivaTNT.diff @@ -0,0 +1,220 @@ +On Fri, Apr 07, 2000 at 12:13:04AM +0100, Tom Lees wrote: + +OK, as promised, here's the fixed patch. It still works with my TNT2, hopefully it should +also work with the TNT, Ultra TNT2 etc and more importantly, still work with the Riva 128. + +-- +Tom + +diff -ur svgatextmode-1.9.orig/XFREE/riva128_clock.c svgatextmode-1.9.tom/XFREE/riva128_clock.c +--- svgatextmode-1.9.orig/XFREE/riva128_clock.c Mon Oct 19 12:28:32 1998 ++++ svgatextmode-1.9.tom/XFREE/riva128_clock.c Sat Apr 8 13:53:46 2000 +@@ -76,6 +76,13 @@ + + #define PCI_VENDOR_NVIDIA_SGS 0x12d2 + #define PCI_CHIP_RIVA128 0x0018 ++#define PCI_VENDOR_ID_NVIDIA 0x10de ++#define PCI_DEVICE_ID_NVIDIA_TNT 0x0020 ++#define PCI_DEVICE_ID_NVIDIA_TNT2 0x0028 ++#define PCI_DEVICE_ID_NVIDIA_UTNT2 0x0029 ++#define PCI_DEVICE_ID_NVIDIA_VTNT2 0x002C ++#define PCI_DEVICE_ID_NVIDIA_UVTNT2 0x002D ++#define PCI_DEVICE_ID_NVIDIA_ITNT2 0x00A0 + + vgaPCIInformation *vgaPCIInfo; + +@@ -87,6 +94,9 @@ + + #define NV3_MIN_CLOCK_IN_KHZ 25000 // Not sure about this, but it seems reasonable + #define NV3_MAX_CLOCK_IN_KHZ 230000 ++#define NV4_MAX_CLOCK_IN_KHZ 350000 ++ ++static int max_clock, is_nv3, pll_coeff; + + /* NTSC cards have approx 14.3Mhz. Need to detect, but leave for now*/ + #define PLL_INPUT_FREQ 13500 +@@ -94,51 +104,82 @@ + #define M_MAX 13 + + #define P_MIN 0 +-#define P_MAX 7 /* Not sure about this. Could be 4 */ ++#define P_MAX 4 + + //=== Function section === +-// This function copied straight out the of nv3driver.c in the Xserver +-static int NV3ClockSelect(float clockIn,float *clockOut,int *mOut, +- int *nOut,int *pOut) +-{ +- int m,n,p; +- float bestDiff=1e10; +- float target=0.0; +- float best=0.0; +- float diff; +- int nMax,nMin; +- +- *clockOut=0.0; +- for(p=P_MIN;p<=P_MAX;p++) { +- for(m=M_MIN;m<=M_MAX;m++) { +- float fm=(float)m; +- /* Now calculate maximum and minimum values for n */ +- nMax=(int) (((256000/PLL_INPUT_FREQ)*fm)-0.5); +- nMin=(int) (((128000/PLL_INPUT_FREQ)*fm)+0.5); +- n=(int)(((clockIn*((float)(1<=nMin && n<=nMax) { +- float fn=(float)n; +- target=(PLL_INPUT_FREQ*(fn/fm))/((float)(1< %.2f\n", m, n, p, target ));*/ +- if(diffCrystalFreqKHz*/PLL_INPUT_FREQ == 14318) ++ { ++ lowM = 8; ++ highM = 14 - (/*chip->Architecture == NV_ARCH_03*/is_nv3); ++ } ++ else ++ { ++ lowM = 7; ++ highM = 13 - (/*chip->Architecture == NV_ARCH_03*/is_nv3); ++ } ++ ++ highP = 4 - (/*chip->Architecture == NV_ARCH_03*/is_nv3); ++ for (P = 0; P <= highP; P ++) ++ { ++ Freq = VClk << P; ++ if ((Freq >= 128000) && (Freq <= /*chip->MaxVClockFreqKHz*/max_clock)) ++ { ++ for (M = lowM; M <= highM; M++) ++ { ++ N = (VClk * M / /*chip->CrystalFreqKHz*/PLL_INPUT_FREQ) << P; ++ Freq = (/*chip->CrystalFreqKHz*/PLL_INPUT_FREQ * N / M) >> P; ++ if (Freq > VClk) ++ DeltaNew = Freq - VClk; ++ else ++ DeltaNew = VClk - Freq; ++ if (DeltaNew < DeltaOld) ++ { ++ *mOut = M; ++ *nOut = N; ++ *pOut = P; ++ *clockOut = Freq; ++ DeltaOld = DeltaNew; ++ } ++ } + } +- } + } +- } +- return (best!=0.0); ++ return (DeltaOld != 0xFFFFFFFF); + } ++ + + // Set the clock to the given speed (in KHz) + Bool RIVA128ClockSelect( int clockspeed ) + { + int *ptr; + +- float out; ++ //float out; ++ int out; + int m, n, p, value; + int i = 0; + pciConfigPtr pcr = NULL; +@@ -151,19 +192,39 @@ + if (pcr->_vendor == PCI_VENDOR_NVIDIA_SGS) + { + if (pcr->_device == PCI_CHIP_RIVA128) ++ { ++ is_nv3 = 1; ++ pll_coeff = 0x00010100; ++ max_clock = NV3_MAX_CLOCK_IN_KHZ; ++ break; ++ } ++ } ++ if (pcr->_vendor == PCI_VENDOR_ID_NVIDIA) ++ { ++ if (pcr->_device == PCI_DEVICE_ID_NVIDIA_TNT || ++ pcr->_device == PCI_DEVICE_ID_NVIDIA_TNT2 || ++ pcr->_device == PCI_DEVICE_ID_NVIDIA_UTNT2 || ++ pcr->_device == PCI_DEVICE_ID_NVIDIA_VTNT2 || ++ pcr->_device == PCI_DEVICE_ID_NVIDIA_UVTNT2 || ++ pcr->_device == PCI_DEVICE_ID_NVIDIA_ITNT2) ++ { ++ is_nv3 = 0; ++ pll_coeff = 0x00010700; ++ max_clock = NV4_MAX_CLOCK_IN_KHZ; + break; ++ } + } + } + } + else + { +- PERROR(("No RIVA128 chip found in PCI info!\n")); ++ PERROR(("No RIVA128/TNT/TNT2 chip found in PCI info!\n")); + return FALSE; + } + +- if ( (!pcr) || (pcr->_device != PCI_CHIP_RIVA128) ) ++ if ( (!pcr) ) + { +- PERROR(("No RIVA128 chip found in PCI info!\n")); ++ PERROR(("No RIVA128/TNT/TNT2 chip found in PCI info!\n")); + return FALSE; + } + +@@ -199,7 +260,8 @@ + #endif + + // Calculate the clock +- NV3ClockSelect( (float)clockspeed, &out, &m, &n, &p ); ++ //NV3ClockSelect( (float)clockspeed, &out, &m, &n, &p ); ++ CalcVClock ((float) clockspeed, 0, &out, &m, &n, &p); + + value = (m) + (n<<8) + (p<<16); + +@@ -207,10 +269,10 @@ + PDEBUG(( "Wanted %dkHz, got %dkHz (m=%d, n=%d, p=%d, value=0x%08X)\n", + clockspeed, (int)out, m, n, p, value )); + +- // Default value is 0x00000100 +- // X uses 0x10010100 +- // We use 0x00010100 +- ptr[PRAMDAC_PLL_COEFF_SELECT/4] = 0x00010100; // could use |= ++ // Default value is 0x00000100 (NV3) ++ // X uses 0x10010100 (NV3) or 0x10000700 (NV4) ++ // We use 0x00010100 (NV3) or 0x00010700 (NV4) ++ ptr[PRAMDAC_PLL_COEFF_SELECT/4] = pll_coeff; // could use |= + + // Divide by 4 because we're dealing with integers + ptr[PRAMDAC_PLL_COEFF/4] = value; --- svgatextmode-1.9.orig/debian/Patches/006-geforce.diff +++ svgatextmode-1.9/debian/Patches/006-geforce.diff @@ -0,0 +1,51 @@ +Package: svgatextmode +Version: 1.9-6 +Severity: important +Tags: patch + +Please incorporate this patch into the debian package. + +You could send it upstream, but be aware of the fact that this +patch has been sent to them countless times and it was not included +for no good reason. + +There could be further nVidia chip PCI ID's which is the same as +these, but I do not have the PCI ID's handy. + + +diff -u svgatextmode-1.9/XFREE/riva128_clock*.c +--- svgatextmode-1.9/XFREE/riva128_clock-old.c Tue Oct 9 14:03:37 2001 ++++ svgatextmode-1.9/XFREE/riva128_clock.c Tue Oct 9 14:04:13 2001 +@@ -83,6 +83,8 @@ + #define PCI_DEVICE_ID_NVIDIA_VTNT2 0x002C + #define PCI_DEVICE_ID_NVIDIA_UVTNT2 0x002D + #define PCI_DEVICE_ID_NVIDIA_ITNT2 0x00A0 ++#define PCI_DEVICE_ID_NVIDIA_GEFORCE2 0x0110 ++#define PCI_DEVICE_ID_NVIDIA_GEFORCE 0x0100 + + vgaPCIInformation *vgaPCIInfo; + +@@ -205,6 +207,8 @@ + pcr->_device == PCI_DEVICE_ID_NVIDIA_UTNT2 || + pcr->_device == PCI_DEVICE_ID_NVIDIA_VTNT2 || + pcr->_device == PCI_DEVICE_ID_NVIDIA_UVTNT2 || ++ pcr->_device == PCI_DEVICE_ID_NVIDIA_GEFORCE || ++ pcr->_device == PCI_DEVICE_ID_NVIDIA_GEFORCE2 || + pcr->_device == PCI_DEVICE_ID_NVIDIA_ITNT2) + { + is_nv3 = 0; + + + +-- System Information +Debian Release: testing/unstable +Architecture: i386 +Kernel: Linux Yikes 2.4.10 #1 Fri Oct 5 03:03:01 CEST 2001 i686 +Locale: LANG=C, LC_CTYPE=hu_HU + +Versions of packages svgatextmode depends on: +ii console-tools 1:0.2.3-23.2 Linux console and font utilities. +ii libc6 2.2.4-2 GNU C Library: Shared libraries an + + + --- svgatextmode-1.9.orig/debian/Patches/007-geforce3-all-hopefully.diff +++ svgatextmode-1.9/debian/Patches/007-geforce3-all-hopefully.diff @@ -0,0 +1,95 @@ +--- svgatextmode-1.9/XFREE/riva128_clock-pristine.c Sat Oct 13 21:36:22 2001 ++++ svgatextmode-1.9/XFREE/riva128_clock.c Sat Oct 13 23:42:01 2001 +@@ -77,14 +77,64 @@ + #define PCI_VENDOR_NVIDIA_SGS 0x12d2 + #define PCI_CHIP_RIVA128 0x0018 + #define PCI_VENDOR_ID_NVIDIA 0x10de +-#define PCI_DEVICE_ID_NVIDIA_TNT 0x0020 +-#define PCI_DEVICE_ID_NVIDIA_TNT2 0x0028 +-#define PCI_DEVICE_ID_NVIDIA_UTNT2 0x0029 +-#define PCI_DEVICE_ID_NVIDIA_VTNT2 0x002C +-#define PCI_DEVICE_ID_NVIDIA_UVTNT2 0x002D +-#define PCI_DEVICE_ID_NVIDIA_ITNT2 0x00A0 +-#define PCI_DEVICE_ID_NVIDIA_GEFORCE 0x0100 +-#define PCI_DEVICE_ID_NVIDIA_GEFORCE2 0x0110 ++ ++/* Straight from NVidia's X4.x driver README: ++ ++ NVIDIA CHIP NAME DEVICE PCI ID ++ ++ o RIVA TNT 0x0020 ++ o RIVA TNT2 0x0028 ++ o RIVA TNT2 (Ultra) 0x0029 ++ o RIVA TNT2 (Vanta) 0x002C ++ o RIVA TNT2 (M64) 0x002D ++ o RIVA TNT2 0x002E ++ o RIVA TNT2 0x002F ++ o RIVA TNT2 (Integrated) 0x00A0 ++ o GeForce 256 0x0100 ++ o GeForce DDR 0x0101 ++ o Quadro 0x0103 ++ o GeForce2 MX 0x0110 ++ o GeForce2 MX 400 0x0110 ++ o GeForce2 MX 200 0x0111 ++ o GeForce2 MX 100 0x0111 ++ o GeForce2 Go 0x0112 ++ o GeForce2 MXR 0x0113 ++ o Quadro2 Go 0x0113 ++ o GeForce2 Pro 0x0150 ++ o GeForce2 GTS 0x0150 ++ o GeForce2 GTS 0x0151 ++ o GeForce2 Ultra 0x0152 ++ o Quadro2 Pro 0x0153 ++ o Quadro2 Ex 0x0153 ++ o GeForce3 0x0200 ++ o Quadro DDC 0x0203 ++ */ ++unsigned short nvidia_pci_ids[] = { ++ 0x0020, /* TNT */ ++ 0x0028, /* TNT2 */ ++ 0x0029, /* Ultra TNT2 */ ++ 0x002C, /* Vanta TNT2 */ ++ 0x002D, /* M64 TNT2 */ ++ 0x002E, /* TNT2 (?) */ ++ 0x002F, /* TNT2 (?) */ ++ 0x00A0, /* Integrated TNT2 */ ++ 0x0100, /* GeForce 256 */ ++ 0x0101, /* GeForce DDR */ ++ 0x0103, /* Quadro */ ++ 0x0110, /* GeForce2 MX, GeForce2 MX 400 */ ++ 0x0111, /* GeForce2 MX 100, GeForce2 MX 200 */ ++ 0x0112, /* GeForce2 Go */ ++ 0x0113, /* GeForce2 MXR, Quadro2 Go */ ++ 0x0150, /* GeForce2 Pro, GeForce2 GTS */ ++ 0x0151, /* GeForce2 GTS (?) */ ++ 0x0152, /* GeForce2 Ultra */ ++ 0x0153, /* Quadro2 Pro, Quadro2 Ex */ ++ 0x0200, /* GeForce3 */ ++ 0x0201, /* GeForce3 Ti 200 */ ++ 0x0202, /* GeForce3 Ti 500 (unverified guess) */ ++ 0x0203, /* Quadro DDC */ ++ 0 /* NULL terminator */ ++}; + + vgaPCIInformation *vgaPCIInfo; + +@@ -202,14 +252,11 @@ + } + if (pcr->_vendor == PCI_VENDOR_ID_NVIDIA) + { +- if (pcr->_device == PCI_DEVICE_ID_NVIDIA_TNT || +- pcr->_device == PCI_DEVICE_ID_NVIDIA_TNT2 || +- pcr->_device == PCI_DEVICE_ID_NVIDIA_UTNT2 || +- pcr->_device == PCI_DEVICE_ID_NVIDIA_VTNT2 || +- pcr->_device == PCI_DEVICE_ID_NVIDIA_GEFORCE || +- pcr->_device == PCI_DEVICE_ID_NVIDIA_GEFORCE2 || +- pcr->_device == PCI_DEVICE_ID_NVIDIA_UVTNT2 || +- pcr->_device == PCI_DEVICE_ID_NVIDIA_ITNT2) ++ int supported = 0, tmpiter; ++ for(tmpiter=0;nvidia_pci_ids[tmpiter];tmpiter++) ++ if(nvidia_pci_ids[tmpiter] == pcr->_device) ++ supported++; ++ if (supported) + { + is_nv3 = 0; + pll_coeff = 0x00010700; --- svgatextmode-1.9.orig/debian/Patches/008-131826-buildfix.diff +++ svgatextmode-1.9/debian/Patches/008-131826-buildfix.diff @@ -0,0 +1,12 @@ +diff -urN svgatextmode-1.9/cfgfile.y svgatextmode-1.9.fix/cfgfile.y +--- svgatextmode-1.9/cfgfile.y Sat Sep 5 23:52:04 1998 ++++ svgatextmode-1.9.fix/cfgfile.y Fri Feb 1 20:03:37 2002 +@@ -24,6 +24,7 @@ + + /****************************************************************************/ + /* C DECLARATIONS */ ++#include + #include + #include + #include "cfg_structs.h" + --- svgatextmode-1.9.orig/debian/Patches/009-palette-mapping.diff +++ svgatextmode-1.9/debian/Patches/009-palette-mapping.diff @@ -0,0 +1,62 @@ + +diff -Nur -x *~ -x *.[oaP] -x .#* -x .*swp -x CVS -x *.rej -x *.orig -x tags -x config.status -x config.log -x config.ca +che -x Makefile -x ABOUT-NLS -x Makefile.in -x aclocal.m4 -x config.guess -x config.h -x config.h.in -x config.sub -x co +nfigure -x install-sh svgatextmode-1.9-9/textregs.h svgatextmode-1.9/textregs.h +--- svgatextmode-1.9-9/textregs.h Sat Sep 5 07:19:07 1998 ++++ svgatextmode-1.9/textregs.h Tue Jan 8 14:16:27 2002 +@@ -35,12 +35,14 @@ + 0xff + }; + +-/* 21 ATRCTL registers */ ++/* 21 ATRCTL registers ++ * Note that the first 16 entries map the 16 screen colors to the first 16 vga ++ * palette regs, as Linux vga console driver expects/requires. */ + + #define NUM_STD_ATRCTL_REGS 21 + unsigned char TXT_ATRCTL_REGS[NUM_STD_ATRCTL_REGS] = { +- 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, 0x38, 0x39, 0x3a, 0x3b, +- 0x3c, 0x3d, 0x3e, 0x3f, 0x0c, 0x00, 0x0f, 0x08, 0x00 ++ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, ++ 0x0c, 0x0d, 0x0e, 0x0f, 0x0c, 0x00, 0x0f, 0x08, 0x00 + }; + + /* 9 GRCTL regs */ +@@ -72,14 +74,14 @@ + { 0x2A, 0x00, 0x2A }, + { 0x2A, 0x2A, 0x00 }, + { 0x2A, 0x2A, 0x2A }, +- { 0x00, 0x00, 0x15 }, +- { 0x00, 0x00, 0x3F }, +- { 0x00, 0x2A, 0x15 }, +- { 0x00, 0x2A, 0x3F }, +- { 0x2A, 0x00, 0x15 }, +- { 0x2A, 0x00, 0x3F }, +- { 0x2A, 0x2A, 0x15 }, +- { 0x2A, 0x2A, 0x3F }, ++ { 0x15, 0x15, 0x15 }, ++ { 0x15, 0x15, 0x3F }, ++ { 0x15, 0x3F, 0x15 }, ++ { 0x15, 0x3F, 0x3F }, ++ { 0x3F, 0x15, 0x15 }, ++ { 0x3F, 0x15, 0x3F }, ++ { 0x3F, 0x3F, 0x15 }, ++ { 0x3F, 0x3F, 0x3F }, + { 0x00, 0x15, 0x00 }, + { 0x00, 0x15, 0x2A }, + { 0x00, 0x3F, 0x00 }, +diff -Nur -x *~ -x *.[oaP] -x .#* -x .*swp -x CVS -x *.rej -x *.orig -x tags -x config.status -x config.log -x config.ca +che -x Makefile -x ABOUT-NLS -x Makefile.in -x aclocal.m4 -x config.guess -x config.h -x config.h.in -x config.sub -x co +nfigure -x install-sh svgatextmode-1.9-9/vga_prg.c svgatextmode-1.9/vga_prg.c +--- svgatextmode-1.9-9/vga_prg.c Tue Jan 8 13:51:52 2002 ++++ svgatextmode-1.9/vga_prg.c Tue Jan 8 14:16:27 2002 +@@ -313,6 +313,7 @@ + else + { + Outb_GR_CTL(6,Inb_GR_CTL(6) & 0xFE); ++ for (i=0 ; i<16; i++) Outb_ATR_CTL(i, TXT_ATRCTL_REGS[i]); /* ensure palette is mapped as Linux expects */ + Outb_ATR_CTL(16,inb_ATR_CTL(16) & 0xFE); + Outb_GR_CTL(0x08,0xFF); /* pixel bit mask */ + } + + --- svgatextmode-1.9.orig/debian/Patches/010-amd64.diff +++ svgatextmode-1.9/debian/Patches/010-amd64.diff @@ -0,0 +1,41 @@ + +Patch from Kurt Roeckx for amd64. +ref BTS #255540 + +diff -urN svgatextmode-1.9/Makefile +svgatextmode-1.9+amd64/Makefile +--- svgatextmode-1.9/Makefile 2004-06-21 20:04:29.326060620 ++0200 ++++ svgatextmode-1.9+amd64/Makefile 2004-06-21 +19:55:09.741407877 +0200 +@@ -23,11 +23,13 @@ + CFLAGS_i486 = $(CFLAGS_i386) -m486 -fomit-frame-pointer + CFLAGS_i586 = $(CFLAGS_i486) -fno-strength-reduce -malign-loops=2 -malign-jumps=2 -malign-functions=2 + CFLAGS_i686 = $(CFLAGS_i586) ++CFLAGS_amd64 = $(CFLAGS_i386) + LDFLAGS_alpha = + LDFLAGS_i386 = + LDFLAGS_i486 = $(LDFLAGS_i386) + LDFLAGS_i586 = $(LDFLAGS_i386) + LDFLAGS_i686 = $(LDFLAGS_i386) ++LDFLAGS_amd64 = $(LDFLAGS_i386) + + YACC = bison -y + LEX = flex -l +diff -urN svgatextmode-1.9/XFREE/common/compiler.h +svgatextmode-1.9+amd64/XFREE/common/compiler.h +--- svgatextmode-1.9/XFREE/common/compiler.h 1995-10-29 +17:31:14.000000000 +0100 ++++ svgatextmode-1.9+amd64/XFREE/common/compiler.h +2004-06-21 19:40:25.645665333 +0200 +@@ -258,6 +258,8 @@ + #define outw(p,v) _outw((v),(p)) + #define outl(p,v) _outl((v),(p)) + ++#elif defined(__linux__) ++#include + #endif + + #else /* __GNUC__ */ + + --- svgatextmode-1.9.orig/debian/Patches/011-geforce5200.diff +++ svgatextmode-1.9/debian/Patches/011-geforce5200.diff @@ -0,0 +1,377 @@ + +Patch from hmh@d.o, tested on GeForceFX 5200 Ultra only. +ref BTS #173590 + +--- riva128_clock.c.orig-332 2003-12-21 15:16:13.000000000 -0200 ++++ riva128_clock.c 2003-12-24 15:57:32.000000000 -0200 +@@ -67,72 +67,121 @@ + #include "vga_prg.h" + + #ifdef DOS +-#include ++#error DOS NOT SUPPORTED FOR THIS DRIVER + #endif + + /* PCI stuff -- copied largely from the MGAProbe() code */ + #include "include/Xmd.h" + #include "vgaPCI.h" + +-#define PCI_VENDOR_NVIDIA_SGS 0x12d2 +-#define PCI_CHIP_RIVA128 0x0018 +-#define PCI_VENDOR_ID_NVIDIA 0x10de +- +-/* Straight from NVidia's X4.x driver README: +- +- NVIDIA CHIP NAME DEVICE PCI ID +- +- o RIVA TNT 0x0020 +- o RIVA TNT2 0x0028 +- o RIVA TNT2 (Ultra) 0x0029 +- o RIVA TNT2 (Vanta) 0x002C +- o RIVA TNT2 (M64) 0x002D +- o RIVA TNT2 0x002E +- o RIVA TNT2 0x002F +- o RIVA TNT2 (Integrated) 0x00A0 +- o GeForce 256 0x0100 +- o GeForce DDR 0x0101 +- o Quadro 0x0103 +- o GeForce2 MX 0x0110 +- o GeForce2 MX 400 0x0110 +- o GeForce2 MX 200 0x0111 +- o GeForce2 MX 100 0x0111 +- o GeForce2 Go 0x0112 +- o GeForce2 MXR 0x0113 +- o Quadro2 Go 0x0113 +- o GeForce2 Pro 0x0150 +- o GeForce2 GTS 0x0150 +- o GeForce2 GTS 0x0151 +- o GeForce2 Ultra 0x0152 +- o Quadro2 Pro 0x0153 +- o Quadro2 Ex 0x0153 +- o GeForce3 0x0200 +- o Quadro DDC 0x0203 +- */ +-unsigned short nvidia_pci_ids[] = { +- 0x0020, /* TNT */ +- 0x0028, /* TNT2 */ +- 0x0029, /* Ultra TNT2 */ +- 0x002C, /* Vanta TNT2 */ +- 0x002D, /* M64 TNT2 */ +- 0x002E, /* TNT2 (?) */ +- 0x002F, /* TNT2 (?) */ +- 0x00A0, /* Integrated TNT2 */ +- 0x0100, /* GeForce 256 */ +- 0x0101, /* GeForce DDR */ +- 0x0103, /* Quadro */ +- 0x0110, /* GeForce2 MX, GeForce2 MX 400 */ +- 0x0111, /* GeForce2 MX 100, GeForce2 MX 200 */ +- 0x0112, /* GeForce2 Go */ +- 0x0113, /* GeForce2 MXR, Quadro2 Go */ +- 0x0150, /* GeForce2 Pro, GeForce2 GTS */ +- 0x0151, /* GeForce2 GTS (?) */ +- 0x0152, /* GeForce2 Ultra */ +- 0x0153, /* Quadro2 Pro, Quadro2 Ex */ +- 0x0200, /* GeForce3 */ +- 0x0201, /* GeForce3 Ti 200 */ +- 0x0202, /* GeForce3 Ti 500 (unverified guess) */ +- 0x0203, /* Quadro DDC */ ++#define PCI_VENDOR_NVIDIA_SGS 0x12D2 ++ ++unsigned int nvidia_pci_ids[] = { ++ 0x12D20018, /*RIVA128*/ ++ 0x10DE0020, /*RIVATNT*/ ++ 0x10DE0028, /*RIVATNT2*/ ++ 0x10DE002A, /*UnknownTNT2*/ ++ 0x10DE002C, /*Vanta*/ ++ 0x10DE0029, /*RIVATNT2Ultra*/ ++ 0x10DE002D, /*RIVATNT2Model64*/ ++ 0x10DE00A0, /*AladdinTNT2*/ ++ 0x10DE0100, /*GeForce256*/ ++ 0x10DE0101, /*GeForceDDR*/ ++ 0x10DE0103, /*Quadro*/ ++ 0x10DE0110, /*GeForce2MX/MX400*/ ++ 0x10DE0111, /*GeForce2MX100/200*/ ++ 0x10DE0112, /*GeForce2Go*/ ++ 0x10DE0113, /*Quadro2MXR/EX/Go*/ ++ 0x10DE01A0, /*GeForce2IntegratedGPU*/ ++ 0x10DE0150, /*GeForce2GTS*/ ++ 0x10DE0151, /*GeForce2Ti*/ ++ 0x10DE0152, /*GeForce2Ultra*/ ++ 0x10DE0153, /*Quadro2Pro*/ ++ 0x10DE0170, /*GeForce4MX460*/ ++ 0x10DE0171, /*GeForce4MX440*/ ++ 0x10DE0172, /*GeForce4MX420*/ ++ 0x10DE0173, /*GeForce4MX440-SE*/ ++ 0x10DE0174, /*GeForce4440Go*/ ++ 0x10DE0175, /*GeForce4420Go*/ ++ 0x10DE0176, /*GeForce4420Go32M*/ ++ 0x10DE0177, /*GeForce4460Go*/ ++ 0x10DE0179, /*GeForce4440Go64M*/ ++ 0x10DE017D, /*GeForce4410Go16M*/ ++ 0x10DE017C, /*Quadro4500GoGL*/ ++ 0x10DE0178, /*Quadro4550XGL*/ ++ 0x10DE017A, /*Quadro4NVS*/ ++ 0x10DE0181, /*GeForce4MX440withAGP8X*/ ++ 0x10DE0182, /*GeForce4MX440SEwithAGP8X*/ ++ 0x10DE0183, /*GeForce4MX420withAGP8X*/ ++ 0x10DE0186, /*GeForce4448Go*/ ++ 0x10DE0187, /*GeForce4488Go*/ ++ 0x10DE0188, /*Quadro4580XGL*/ ++ 0x10DE0189, /*GeForce4MXwithAGP8X(Mac)*/ ++ 0x10DE018A, /*Quadro4280NVS*/ ++ 0x10DE018B, /*Quadro4380XGL*/ ++ 0x10DE01F0, /*GeForce4MXIntegratedGPU*/ ++ 0x10DE0200, /*GeForce3*/ ++ 0x10DE0201, /*GeForce3Ti200*/ ++ 0x10DE0202, /*GeForce3Ti500*/ ++ 0x10DE0203, /*QuadroDCC*/ ++ 0x10DE0250, /*GeForce4Ti4600*/ ++ 0x10DE0251, /*GeForce4Ti4400*/ ++ 0x10DE0252, /*0x0252*/ ++ 0x10DE0253, /*GeForce4Ti4200*/ ++ 0x10DE0258, /*Quadro4900XGL*/ ++ 0x10DE0259, /*Quadro4750XGL*/ ++ 0x10DE025B, /*Quadro4700XGL*/ ++ 0x10DE0280, /*GeForce4Ti4800*/ ++ 0x10DE0281, /*GeForce4Ti4200withAGP8X*/ ++ 0x10DE0282, /*GeForce4Ti4800SE*/ ++ 0x10DE0286, /*GeForce44200Go*/ ++ 0x10DE028C, /*Quadro4700GoGL*/ ++ 0x10DE0288, /*Quadro4980XGL*/ ++ 0x10DE0289, /*Quadro4780XGL*/ ++ 0x10DE0301, /*GeForceFX5800Ultra*/ ++ 0x10DE0302, /*GeForceFX5800*/ ++ 0x10DE0308, /*QuadroFX2000*/ ++ 0x10DE0309, /*QuadroFX1000*/ ++ 0x10DE0311, /*GeForceFX5600Ultra*/ ++ 0x10DE0312, /*GeForceFX5600*/ ++ 0x10DE0313, /*0x0313*/ ++ 0x10DE0314, /*GeForceFX5600SE*/ ++ 0x10DE0316, /*0x0316*/ ++ 0x10DE0317, /*0x0317*/ ++ 0x10DE031A, /*GeForceFXGo5600*/ ++ 0x10DE031B, /*GeForceFXGo5650*/ ++ 0x10DE031C, /*QuadroFXGo700*/ ++ 0x10DE031D, /*0x031D*/ ++ 0x10DE031E, /*0x031E*/ ++ 0x10DE031F, /*0x031F*/ ++ 0x10DE0321, /*GeForceFX5200Ultra*/ ++ 0x10DE0322, /*GeForceFX5200*/ ++ 0x10DE0323, /*GeForceFX5200SE*/ ++ 0x10DE0324, /*GeForceFXGo5200*/ ++ 0x10DE0325, /*GeForceFXGo5250*/ ++ 0x10DE0328, /*GeForceFXGo520032M/64M*/ ++ 0x10DE0329, /*GeForceFX5200(Mac)*/ ++ 0x10DE032A, /*QuadroNVS280PCI*/ ++ 0x10DE032B, /*QuadroFX500*/ ++ 0x10DE032C, /*GeForceFXGo5300*/ ++ 0x10DE032D, /*GeForceFXGo5100*/ ++ 0x10DE032F, /*0x032F*/ ++ 0x10DE0330, /*GeForceFX5900Ultra*/ ++ 0x10DE0331, /*GeForceFX5900*/ ++ 0x10DE0332, /*GeForceFX5900XT*/ ++ 0x10DE0333, /*GeForceFX5950Ultra*/ ++ 0x10DE0334, /*0x0334*/ ++ 0x10DE0338, /*QuadroFX3000*/ ++ 0x10DE0341, /*GeForceFX5700Ultra*/ ++ 0x10DE0342, /*GeForceFX5700*/ ++ 0x10DE0343, /*0x0343*/ ++ 0x10DE0347, /*0x0347*/ ++ 0x10DE0348, /*0x0348*/ ++ 0x10DE0349, /*0x0349*/ ++ 0x10DE034B, /*0x034B*/ ++ 0x10DE034C, /*0x034C*/ ++ 0x10DE034E, /*QuadroFX1100*/ ++ 0x10DE034F, /*0x034F*/ + 0 /* NULL terminator */ + }; + +@@ -143,15 +192,14 @@ + #define PRAMDAC_BASE 0x00680000 + #define PRAMDAC_PLL_COEFF 0x00000508 + #define PRAMDAC_PLL_COEFF_SELECT 0x0000050C ++#define PEXTDEV_BASE 0x00101000 + + #define NV3_MIN_CLOCK_IN_KHZ 25000 // Not sure about this, but it seems reasonable + #define NV3_MAX_CLOCK_IN_KHZ 230000 + #define NV4_MAX_CLOCK_IN_KHZ 350000 + +-static int max_clock, is_nv3, pll_coeff; ++static int max_clock, is_nv3, pll_coeff, CrystalFreqKHz; + +-/* NTSC cards have approx 14.3Mhz. Need to detect, but leave for now*/ +-#define PLL_INPUT_FREQ 13500 + #define M_MIN 7 + #define M_MAX 13 + +@@ -185,7 +233,7 @@ + if (double_scan) + VClk *= 2; + +- if (/*chip->CrystalFreqKHz*/PLL_INPUT_FREQ == 14318) ++ if (/*chip->*/CrystalFreqKHz == 14318) + { + lowM = 8; + highM = 14 - (/*chip->Architecture == NV_ARCH_03*/is_nv3); +@@ -204,8 +252,8 @@ + { + for (M = lowM; M <= highM; M++) + { +- N = (VClk * M / /*chip->CrystalFreqKHz*/PLL_INPUT_FREQ) << P; +- Freq = (/*chip->CrystalFreqKHz*/PLL_INPUT_FREQ * N / M) >> P; ++ N = (VClk * M / /*chip->*/CrystalFreqKHz) << P; ++ Freq = (/*chip->*/CrystalFreqKHz * N / M) >> P; + if (Freq > VClk) + DeltaNew = Freq - VClk; + else +@@ -228,59 +276,46 @@ + // Set the clock to the given speed (in KHz) + Bool RIVA128ClockSelect( int clockspeed ) + { +- int *ptr; ++ int *PRAMDAC0; ++ int *PEXTDEV; + + int out; + int m, n, p, value; + int i = 0; + pciConfigPtr pcr = NULL; ++ int implementation; + int fd; + + vgaPCIInfo = vgaGetPCIInfo(); + + if (vgaPCIInfo && vgaPCIInfo->AllCards) { + while ((pcr = vgaPCIInfo->AllCards[i++])) { +- if (pcr->_vendor == PCI_VENDOR_NVIDIA_SGS) +- { +- if (pcr->_device == PCI_CHIP_RIVA128) +- { +- is_nv3 = 1; +- pll_coeff = 0x00010100; +- max_clock = NV3_MAX_CLOCK_IN_KHZ; +- break; +- } +- } +- if (pcr->_vendor == PCI_VENDOR_ID_NVIDIA) +- { +- int i, supported = 0; +- for (i = 0; nvidia_pci_ids[i]; i++) +- if(nvidia_pci_ids[i] == pcr->_device) +- supported++; +- if (supported) +- { +- is_nv3 = 0; +- pll_coeff = 0x00010700; +- max_clock = NV4_MAX_CLOCK_IN_KHZ; +- break; +- } ++ int i, supported = 0; ++ for (i = 0; nvidia_pci_ids[i]; i++) ++ if( nvidia_pci_ids[i] == (pcr->_device | (pcr->_vendor << 16)) ) ++ supported++; ++ ++ if (supported) { ++ implementation = pcr->_device & 0x0ff0; ++ is_nv3 = (pcr->_vendor == PCI_VENDOR_NVIDIA_SGS) ? 1 : 0; ++ break; + } + } + } + else + { +- PERROR(("No RIVA128/TNT/TNT2 chip found in PCI info!\n")); ++ PERROR(("No supported nVidia GPU found in PCI info!\n")); + return FALSE; + } + + if ( !pcr ) + { +- PERROR(("No RIVA128/TNT/TNT2 chip found in PCI info!\n")); ++ PERROR(("No supported nVidia GPU found in PCI info!\n")); + return FALSE; + } + + PDEBUG(("PCI BASE0 = 0x%x\n", pcr->_base0)); + +-#ifndef DOS + // Uses memory mapped registers, so must map memory + fd = open( "/dev/mem", O_RDWR ); + +@@ -291,23 +326,44 @@ + } + + // mmap the programmable RAMDAC into our address space +- ptr = (int*)mmap( 0, 0x1000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, (off_t)(pcr->_base0) + PRAMDAC_BASE ); ++ PRAMDAC0 = (int*)mmap( 0, 0x1000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, (off_t)(pcr->_base0) + PRAMDAC_BASE ); + +- if( ptr == (int*)-1 ) ++ if( PRAMDAC0 == (int*)-1 ) + { + PERROR(( "Error mmap'ing /dev/mem" )); + return FALSE; + } + ++ // mmap the PEXTDEV into our address space ++ PEXTDEV = (int*)mmap( 0, 0x1000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, (off_t)(pcr->_base0) + PEXTDEV_BASE ); ++ ++ if( PEXTDEV == (int*)-1 ) ++ { ++ PERROR(( "Error mmap'ing /dev/mem" )); ++ return FALSE; ++ } ++ + close( fd ); +-#else +- ptr=(int*) malloc(0x4000); +- if (!ptr || __djgpp_map_physical_memory(ptr, 0x1000, (off_t)(pcr->_base0))) ++ ++ // Get chip config ++ if (is_nv3) { ++ pll_coeff = 0x00010100; ++ max_clock = NV3_MAX_CLOCK_IN_KHZ; ++ CrystalFreqKHz = (PEXTDEV[0x00000000/4] & 0x00000020) ? 14318 : 13500; ++ } ++ else + { +- PERROR(("mmap() failed %d\n", ptr)); +- return FALSE; ++ pll_coeff = 0x00000700; ++ CrystalFreqKHz = (PEXTDEV[0x0000/4] & (1 << 6)) ? 14318 : 13500; ++ if((implementation == 0x0170) || ++ (implementation == 0x0180) || ++ (implementation == 0x01F0) || ++ (implementation >= 0x0250)) ++ { ++ if(PEXTDEV[0x0000/4] & (1 << 22)) CrystalFreqKHz = 27000; ++ } ++ max_clock = NV4_MAX_CLOCK_IN_KHZ; + } +-#endif + + // Calculate the clock + CalcVClock ((float) clockspeed, 0, &out, &m, &n, &p); +@@ -319,17 +375,16 @@ + clockspeed, (int)out, m, n, p, value )); + + // Default value is 0x00000100 (NV3) +- // X uses 0x10010100 (NV3) or 0x10000700 (NV4) +- // We use 0x00010100 (NV3) or 0x00010700 (NV4) +- ptr[PRAMDAC_PLL_COEFF_SELECT/4] = pll_coeff; // could use |= ++ // X uses 0x10010100 (NV3) or 0x10000700 (NV4/10/20/30) ++ // We use 0x00010100 (NV3) or 0x00000700 (NV4/10/20/30) ++ PRAMDAC0[PRAMDAC_PLL_COEFF_SELECT/4] = pll_coeff; // could use |= + + // Divide by 4 because we're dealing with integers +- ptr[PRAMDAC_PLL_COEFF/4] = value; ++ PRAMDAC0[PRAMDAC_PLL_COEFF/4] = value; + +-#ifndef DOS + // Unmap memory +- munmap( ptr, 0x1000 ); +-#endif ++ munmap( PRAMDAC0, 0x1000 ); ++ munmap( PEXTDEV, 0x1000 ); + + // All done + return TRUE; --- svgatextmode-1.9.orig/debian/Patches/012-geforce5700.diff +++ svgatextmode-1.9/debian/Patches/012-geforce5700.diff @@ -0,0 +1,215 @@ + +Another from hmh@d.o, tested on GeForceFX 5700 (for NV31, NV34 cards). +ref BTS #279744 + +--- riva128_clock.c 2004-11-05 00:17:07.000000000 -0200 ++++ riva128_clock.c 2004-11-05 00:02:20.000000000 -0200 +@@ -57,6 +57,51 @@ + |* *| + \***************************************************************************/ + ++/* This code has been updated with stuff from Debian's XFree86 4.3.0, ++ * version 4.3.0.dfsg.1-8. ++ * ++ * Here are the updated notices: */ ++ /***************************************************************************\ ++|* *| ++|* Copyright 1993-2003 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-2003 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/nv_hw.c,v 1.4 2003/11/03 05:11:25 tsi Exp $ */ ++ ++ + #include + #include + #include +@@ -192,13 +237,15 @@ + #define PRAMDAC_BASE 0x00680000 + #define PRAMDAC_PLL_COEFF 0x00000508 + #define PRAMDAC_PLL_COEFF_SELECT 0x0000050C ++#define PRAMDAC_PLL2_COEFF 0x00000578 + #define PEXTDEV_BASE 0x00101000 + + #define NV3_MIN_CLOCK_IN_KHZ 25000 // Not sure about this, but it seems reasonable + #define NV3_MAX_CLOCK_IN_KHZ 230000 + #define NV4_MAX_CLOCK_IN_KHZ 350000 ++#define NV31_34_MAX_CLOCK_IN_KHZ 400000 + +-static int max_clock, is_nv3, pll_coeff, CrystalFreqKHz; ++static int max_clock, is_nv3, pll_coeff, CrystalFreqKHz, twoStagePLL; + + #define M_MIN 7 + #define M_MAX 13 +@@ -252,19 +299,68 @@ + { + for (M = lowM; M <= highM; M++) + { +- N = (VClk * M / /*chip->*/CrystalFreqKHz) << P; +- Freq = (/*chip->*/CrystalFreqKHz * N / M) >> P; +- if (Freq > VClk) +- DeltaNew = Freq - VClk; +- else +- DeltaNew = VClk - Freq; +- if (DeltaNew < DeltaOld) +- { +- *mOut = M; +- *nOut = N; +- *pOut = P; +- *clockOut = Freq; +- DeltaOld = DeltaNew; ++ N = ((VClk << P) * M) / /*chip->*/CrystalFreqKHz; ++ if (N <= 255) { ++ Freq = ((/*chip->*/CrystalFreqKHz * N) / M) >> P; ++ if (Freq > VClk) ++ DeltaNew = Freq - VClk; ++ else ++ DeltaNew = VClk - Freq; ++ if (DeltaNew < DeltaOld) ++ { ++ *mOut = M; ++ *nOut = N; ++ *pOut = P; ++ *clockOut = Freq; ++ DeltaOld = DeltaNew; ++ } ++ } ++ } ++ } ++ } ++ return (DeltaOld != 0xFFFFFFFF); ++} ++ ++static int CalcVClock2Stage ( ++ int clockIn, ++ int double_scan, ++ int *clockOut, ++ int *mOut, ++ int *nOut, ++ int *pOut, ++ unsigned *pllBOut ++) ++{ ++ unsigned DeltaNew, DeltaOld; ++ unsigned VClk, Freq; ++ unsigned M, N, P; ++ ++ DeltaOld = 0xFFFFFFFF; ++ ++ *pllBOut = 0x80000401; /* fixed at x4 for now */ ++ ++ VClk = (unsigned)clockIn; ++ if (double_scan) ++ VClk *= 2; ++ ++ for (P = 0; P <= 6; P++) { ++ Freq = VClk << P; ++ if ((Freq >= 400000) && (Freq <= 1000000)) { ++ for (M = 1; M <= 13; M++) { ++ N = ((VClk << P) * M) / (CrystalFreqKHz << 2); ++ if((N >= 5) && (N <= 255)) { ++ Freq = (((CrystalFreqKHz << 2) * N) / M) >> P; ++ if (Freq > VClk) ++ DeltaNew = Freq - VClk; ++ else ++ DeltaNew = VClk - Freq; ++ if (DeltaNew < DeltaOld) { ++ *mOut = M; ++ *nOut = N; ++ *pOut = P; ++ *clockOut = Freq; ++ DeltaOld = DeltaNew; ++ } + } + } + } +@@ -280,10 +376,11 @@ + int *PEXTDEV; + + int out; +- int m, n, p, value; ++ int m, n, p; ++ unsigned pll1, pll2; + int i = 0; + pciConfigPtr pcr = NULL; +- int implementation; ++ int implementation = 0; + int fd; + + vgaPCIInfo = vgaGetPCIInfo(); +@@ -362,25 +459,34 @@ + { + if(PEXTDEV[0x0000/4] & (1 << 22)) CrystalFreqKHz = 27000; + } +- max_clock = NV4_MAX_CLOCK_IN_KHZ; ++ twoStagePLL = (implementation == 0x310) || ++ (implementation == 0x340); ++ ++ max_clock = twoStagePLL ? NV31_34_MAX_CLOCK_IN_KHZ ++ : NV4_MAX_CLOCK_IN_KHZ; + } + + // Calculate the clock +- CalcVClock ((float) clockspeed, 0, &out, &m, &n, &p); +- +- value = (m) + (n<<8) + (p<<16); ++ if (twoStagePLL) { ++ CalcVClock2Stage ((float) clockspeed, 0, &out, &m, &n, &p, &pll2); ++ pll1 = (m) + (n<<8) + (p<<16); ++ PDEBUG(( "Wanted %dkHz, got %dkHz (m=%d, n=%d, p=%d, pll1=0x%08X, pll2=0x%08X)\n", ++ clockspeed, (int)out, m, n, p, pll1, pll2 )); ++ } else { ++ CalcVClock ((float) clockspeed, 0, &out, &m, &n, &p); ++ pll1 = (m) + (n<<8) + (p<<16); ++ PDEBUG(( "Wanted %dkHz, got %dkHz (m=%d, n=%d, p=%d, pll=0x%08X)\n", ++ clockspeed, (int)out, m, n, p, pll1 )); ++ } + +- // But of debug info +- PDEBUG(( "Wanted %dkHz, got %dkHz (m=%d, n=%d, p=%d, value=0x%08X)\n", +- clockspeed, (int)out, m, n, p, value )); +- + // Default value is 0x00000100 (NV3) + // X uses 0x10010100 (NV3) or 0x10000700 (NV4/10/20/30) + // We use 0x00010100 (NV3) or 0x00000700 (NV4/10/20/30) + PRAMDAC0[PRAMDAC_PLL_COEFF_SELECT/4] = pll_coeff; // could use |= + + // Divide by 4 because we're dealing with integers +- PRAMDAC0[PRAMDAC_PLL_COEFF/4] = value; ++ PRAMDAC0[PRAMDAC_PLL_COEFF/4] = pll1; ++ if (twoStagePLL) PRAMDAC0[PRAMDAC_PLL2_COEFF/4] = pll2; + + // Unmap memory + munmap( PRAMDAC0, 0x1000 ); --- svgatextmode-1.9.orig/debian/Patches/013-geforce6600.diff +++ svgatextmode-1.9/debian/Patches/013-geforce6600.diff @@ -0,0 +1,243 @@ +the attached patch adds detection of some more nVidia GPUs to +svgatextmode utility, especially the 6600 & 6800 family of chips. The +chip detection code is based on the nvclock utility +(http://www.linuxhardware.org/nvclock/). Unfortunately I cannot test the +patch on anything else than my GF6600, but I hope it is so trivial it +should be bug-free. + +Regards, +-- +Jindrich Makovicka + +--- riva128_clock.c.orig 2005-10-23 10:36:18.000000000 +0200 ++++ riva128_clock.c 2005-10-23 11:27:18.087470384 +0200 +@@ -121,15 +121,53 @@ + + #define PCI_VENDOR_NVIDIA_SGS 0x12D2 + ++#define UNKNOWN 0 ++#define NV5 (1<<0) ++#define NV10 (1<<1) ++#define NV17 (1<<2) ++#define NV1X (NV10 | NV17) ++#define NV20 (1<<3) ++#define NV25 (1<<4) ++#define NV2X (NV20 | NV25) ++#define NV30 (1<<5) ++#define NV31 (1<<6) ++#define NV35 (1<<7) ++#define NV3X (NV30 | NV31 | NV35) ++#define NV40 (1<<8) ++#define NV41 (1<<9) ++#define NV43 (1<<10) ++#define NV44 (1<<11) ++#define NV47 (1<<12) ++#define NV4X (NV40 | NV41 | NV43 | NV44 | NV47) ++ + unsigned int nvidia_pci_ids[] = { + 0x12D20018, /*RIVA128*/ + 0x10DE0020, /*RIVATNT*/ + 0x10DE0028, /*RIVATNT2*/ ++ 0x10DE0029, /*RIVATNT2Ultra*/ + 0x10DE002A, /*UnknownTNT2*/ ++ 0x10DE002B, /*RIVATNT2*/ + 0x10DE002C, /*Vanta*/ +- 0x10DE0029, /*RIVATNT2Ultra*/ + 0x10DE002D, /*RIVATNT2Model64*/ ++ 0x10DE002E, /*Vanta*/ ++ 0x10DE002F, /*Vanta*/ ++ 0x10DE0091, /*GeForce7800GTX*/ ++ 0x10DE0092, /*GeForce7800GT*/ ++ 0x10DE0099, /*GeForceGo7800GTX*/ ++ 0x10DE009D, /*QuadroFX4500*/ + 0x10DE00A0, /*AladdinTNT2*/ ++ 0x10DE00F0, /*GeForce6800Ultra*/ ++ 0x10DE00F1, /*GeForce6600GT*/ ++ 0x10DE00F2, /*GeForce6600*/ ++ 0x10DE00F3, /*GeForce6200*/ ++ 0x10DE00F8, /*Quadro3400*/ ++ 0x10DE00F9, /*GeForce6800Ultra*/ ++ 0x10DE00FA, /*GeForcePCX5750*/ ++ 0x10DE00FB, /*GeForcePCX5900*/ ++ 0x10DE00FC, /*GeForcePCX5300*/ ++ 0x10DE00FD, /*QuadroNVS280/FX330*/ ++ 0x10DE00FE, /*QuadroFX1300*/ ++ 0x10DE00FF, /*GeForcePCX4300*/ + 0x10DE0100, /*GeForce256*/ + 0x10DE0101, /*GeForceDDR*/ + 0x10DE0103, /*Quadro*/ +@@ -137,6 +175,28 @@ + 0x10DE0111, /*GeForce2MX100/200*/ + 0x10DE0112, /*GeForce2Go*/ + 0x10DE0113, /*Quadro2MXR/EX/Go*/ ++ 0x10DE0140, /*GeForce6600GT*/ ++ 0x10DE0141, /*GeForce6600*/ ++ 0x10DE0142, /*GeForce6600LE*/ ++ 0x10DE0144, /*GeForceGo6600*/ ++ 0x10DE0145, /*GeForce6610XL*/ ++ 0x10DE0146, /*GeForceGo6600TE/6200TE*/ ++ 0x10DE0147, /*GeForce6700XL*/ ++ 0x10DE0148, /*GeForce6600*/ ++ 0x10DE0149, /*GeForce6600GT*/ ++ 0x10DE014E, /*QuadroFX540*/ ++ 0x10DE014F, /*GeForce6200*/ ++ 0x10DE0161, /*GeForce6200TurboCache*/ ++ 0x10DE0162, /*GeForce6600SETurboCache*/ ++ 0x10DE0164, /*GeForceGo6200*/ ++ 0x10DE0165, /*QuadroNVS285*/ ++ 0x10DE0166, /*GeForceGo6400*/ ++ 0x10DE0167, /*GeForceGo6200*/ ++ 0x10DE0168, /*GeForceGo6400*/ ++ 0x10DE0211, /*GeForce6800*/ ++ 0x10DE0212, /*GeForce6800LE*/ ++ 0x10DE0215, /*GeForce6800GT*/ ++ 0x10DE0221, /*GeForce6200*/ + 0x10DE01A0, /*GeForce2IntegratedGPU*/ + 0x10DE0150, /*GeForce2GTS*/ + 0x10DE0151, /*GeForce2Ti*/ +@@ -368,6 +428,102 @@ + return (DeltaOld != 0xFFFFFFFF); + } + ++// get GPU architecture ++short get_gpu_arch(int device_id) ++{ ++ short arch = UNKNOWN; ++ switch(device_id & 0xff0) ++ { ++ case 0x20: ++ arch = NV5; ++ break; ++ case 0x100: ++ case 0x110: ++ case 0x150: ++ case 0x1a0: ++ arch = NV10; ++ break; ++ case 0x170: ++ case 0x180: ++ case 0x1f0: ++ arch = NV17; ++ break; ++ case 0x200: ++ arch = NV20; ++ break; ++ case 0x250: ++ case 0x280: ++ case 0x320: /* We don't treat the FX5200/FX5500 as FX cards */ ++ arch = NV25; ++ break; ++ case 0x300: ++ arch = NV30; ++ break; ++ case 0x330: ++ arch = NV35; /* Similar to NV30 but fanspeed stuff works differently */ ++ break; ++ /* Give a seperate arch to FX5600/FX5700 cards as they need different code than other FX cards */ ++ case 0x310: ++ case 0x340: ++ arch = NV31; ++ break; ++ case 0x40: ++ case 0x120: ++ case 0x130: ++ case 0x1d0: ++ case 0x210: ++ case 0x230: ++ arch = NV40; ++ break; ++ case 0xc0: ++ arch = NV41; ++ break; ++ case 0x140: ++ arch = NV43; /* Similar to NV40 but with different fanspeed code */ ++ break; ++ case 0x160: ++ case 0x220: ++ arch = NV44; ++ break; ++ case 0x90: ++ arch = NV47; ++ break; ++ case 0xf0: ++ /* The code above doesn't work for pci-express cards as multiple architectures share one id-range */ ++ switch(device_id) ++ { ++ case 0xf0: /* 6800 */ ++ case 0xf9: /* 6800Ultra */ ++ arch = NV40; ++ break; ++ case 0xf1: /* 6600/6600GT */ ++ case 0xf2: /* 6600GT */ ++ case 0xf3: /* 6200 */ ++ arch = NV43; ++ break; ++ case 0xfa: /* PCX5700 */ ++ arch = NV31; ++ break; ++ case 0xf8: /* QuadroFX 3400 */ ++ case 0xfb: /* PCX5900 */ ++ arch = NV35; ++ break; ++ case 0xfc: /* PCX5300 */ ++ case 0xfd: /* Quadro NVS280/FX330, FX5200 based? */ ++ case 0xff: /* PCX4300 */ ++ arch = NV25; ++ break; ++ case 0xfe: /* Quadro 1300, has the same id as a FX3000 */ ++ arch = NV35; ++ break; ++ } ++ break; ++ default: ++ arch = UNKNOWN; ++ } ++ return arch; ++} ++ + + // Set the clock to the given speed (in KHz) + Bool RIVA128ClockSelect( int clockspeed ) +@@ -380,7 +536,7 @@ + unsigned pll1, pll2; + int i = 0; + pciConfigPtr pcr = NULL; +- int implementation = 0; ++ int arch = 0; + int fd; + + vgaPCIInfo = vgaGetPCIInfo(); +@@ -393,8 +549,8 @@ + supported++; + + if (supported) { +- implementation = pcr->_device & 0x0ff0; + is_nv3 = (pcr->_vendor == PCI_VENDOR_NVIDIA_SGS) ? 1 : 0; ++ if (!is_nv3) arch = get_gpu_arch(pcr->_device); + break; + } + } +@@ -447,20 +603,17 @@ + pll_coeff = 0x00010100; + max_clock = NV3_MAX_CLOCK_IN_KHZ; + CrystalFreqKHz = (PEXTDEV[0x00000000/4] & 0x00000020) ? 14318 : 13500; ++ twoStagePLL = 0; + } + else + { + pll_coeff = 0x00000700; + CrystalFreqKHz = (PEXTDEV[0x0000/4] & (1 << 6)) ? 14318 : 13500; +- if((implementation == 0x0170) || +- (implementation == 0x0180) || +- (implementation == 0x01F0) || +- (implementation >= 0x0250)) ++ if(arch & (NV17 | NV2X | NV3X | NV4X)) + { + if(PEXTDEV[0x0000/4] & (1 << 22)) CrystalFreqKHz = 27000; + } +- twoStagePLL = (implementation == 0x310) || +- (implementation == 0x340); ++ twoStagePLL = (arch & (NV31 | NV35 | NV4X)); + + max_clock = twoStagePLL ? NV31_34_MAX_CLOCK_IN_KHZ + : NV4_MAX_CLOCK_IN_KHZ; --- svgatextmode-1.9.orig/debian/Patches/README +++ svgatextmode-1.9/debian/Patches/README @@ -0,0 +1,9 @@ +This dir contains the separate diffs of patches applied to the main source. +I've kept copies of them separate here as many of them are contributed and +I do not have the hardware to test them myself. + +So in the event that any of them need to be backed out later... + + Ron + + --- svgatextmode-1.9.orig/debian/README.Debian +++ svgatextmode-1.9/debian/README.Debian @@ -0,0 +1,102 @@ +Various notes on svgatextmode for Debian +----------------------- + +As of svgatextmode_1.9-16 the default configuration is to use the font +program from the kbd package. If you must continue to use console-tools +you will need to edit the FontProg setting in etc/Textconfig but since +(after some 6 years) kbd appears to have won the day and console-tools +is planned for removal in Lenny, that probably won't be a very long +term solution you can use. + +============================================================================ + +As of svgatextmode_1.9-2 the default configuration is to use the font +program from the console-tools package. If you must continue to use +kbd you will need to edit the FontProg setting in etc/Textconfig but +as kbd is slowly being deprecated upgrading to console-tools is +probably worth considering ;-) + +============================================================================ + +If you experience problems after upgrading to SVGATextMode-1.9, it may be +because some of the modes in your old TextConfig have been invalidated by +new upstream mode checking. Mode lines with Vertical Totals > 1023 are +subject to this. It is recommended that you install the TextConfig file +that came with this package and reapply any custom changes to that. + +It is possible that the offending lines will be taken care of by the +install scripts in a later release ... +( submissions to this end are welcome ;) + +============================================================================ + +SVGATextMode is now started from /etc/init.d/svgatextmode instead of from +rc.boot. This allows it to set default font even if the fonts are located on +a partition that is not mounted early in the boot process. + +10/4/99 - it is now started from rcS.d/S40... which should be after the mount + process. +22/10/99 - oops, moved that to S60 so it now starts after /var/run is cleaned + (only significant if you poweroff without a proper shutdown) +2/1/00 - It's now also only started if no framebuffer devices are reported + by /proc/fb. see STM_nocheckfb(5) + +============================================================================ + +If you need more resolution, or want to load a different font, then please +customize /etc/TextConfig according to what kind of video card you have. + +/etc/svgamode file is no longer needed, because you can set the default mode +in the /etc/TextConfig file. + +You can restore the screen to 80x25 mode with + +stm 80x25 + +at all times. + +(Does not work with some high level video boards that do have +some problems with the low refresh rates when in native mode!) + +============================================================================ + +If you have installed kbd >=0.92-3, and did not replace TextConfig conffile on +upgrade, you will need to edit it, and change FontPath to +/usr/share/consolefonts . + +============================================================================ + +If your card is buggy, and you get a lot of garbage on your screen after +reboot, add the following line to your /etc/init.d/reboot +test -x /sbin/stm -a -f /etc/svgamode && stm 80x25 || true +This will reset your video card on reboot. + +=========================================================================== + +For some PCI cards, notably Matrox Millenium, it is in some cases +necessary to type 'cat /proc/pci' before using stm. If your card +requires it, you need to add this line to /etc/init.d/svgatextmode, +under 'start)' : + +cat /proc/pci &>/dev/null + +========================================================================== + +If you are having problems with keeping gpm happy after screen resize, make sure +your /usr/sbin/STM_reset has the following command in it: + +if [ -f /var/run/gpm.pid ] +then + echo "Screen resized to $1x$2. Restarting GPM..." + kill -WINCH `cat /var/run/gpm.pid` # gets pid from current gpm daemon + , and send resize signal to it +fi + +Also make sure you have the following uncommented in /etc/TextConfig: + +ResetProg "/usr/sbin/STM_reset" +========================================================================== + +Igor Grobman, + +updated by Ron Lee , Fri, 9 Apr 1999 21:15:51 +0930 --- svgatextmode-1.9.orig/debian/STM_nocheckfb.5 +++ svgatextmode-1.9/debian/STM_nocheckfb.5 @@ -0,0 +1,30 @@ +.\" Copyright (c) Jan 2000 Ron Lee (ron@debian.org) +.\" +.\" This is free documentation; 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 License, or (at your option) any later version. +.\" +.\" This manual 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. +.\" +.TH STM_nocheckfb 5 "January 2 2000" "Debian GNU/Linux" "SVGATextMode" +.SH NAME +STM_nocheckfb \- disable startup checks for framebuffer devices +.SH DESCRIPTION +If the file \fI/etc/default/STM_nocheckfb\fP exists at boot, +then SVGATextMode will be started even if a framebuffer device +has been reported by \fI/proc/fb\fP +.br +The default behavior of a standard Debian installation is to +\fBnot\fP run STM if framebuffer device(s) are active at boot. +This is probably what you want. +.br +Override this \fBonly\fP if you know what you are doing or are +desperate to find some way to crash your Debian system. +.SH FILES +.I /etc/default/STM_nocheckfb +.br +.I /etc/init.d/svgatextmode --- svgatextmode-1.9.orig/debian/changelog +++ svgatextmode-1.9/debian/changelog @@ -0,0 +1,419 @@ +svgatextmode (1.9-19) unstable; urgency=low + + * Relax the build dep to either linux-libc-dev or linux-kernel-headers + for a while to be friendly to people building backports. Closes: #439658 + + -- Ron Lee Fri, 21 Sep 2007 10:13:26 +0930 + +svgatextmode (1.9-18) unstable; urgency=low + + * Change Build-dep to linux-libc-dev. Closes: #428999 (again) + * Use sys/io.h instead of asm/io.h, the latter has vanished from libc headers. + * Ensure the right io primitives are used for amd64 builds. + + -- Ron Lee Fri, 27 Jul 2007 04:03:08 +0930 + +svgatextmode (1.9-17) unstable; urgency=low + + * Add Build-dep for linux-kernel-headers. Closes: #428999 + + -- Ron Lee Sat, 16 Jun 2007 06:20:11 +0930 + +svgatextmode (1.9-16) unstable; urgency=low + + * Don't use PAGE_SIZE directly, get it from sysconf(). Closes: #394213 + * Switch back to using kbd instead of console-tools, apparently the + tide has turned on this again. Closes: #387118 + * Add an LSB blob to the init script. + * Remove ancient prompts in the postinst about (re)moving obsolete + config files. They should all be long gone by now and lintian + (rightly) bitches about us querying the user directly still. + * Drop the preinst entirely, it contains only ancient warnings about + incompatible changes and also tries to interact with the user directly. + The package dependencies and conffile handling should take care of + the latest transition well enough by itself, but we can poke people + from a NEWS file now too, so do that instead. + + -- Ron Lee Sun, 03 Jun 2007 05:53:35 +0930 + +svgatextmode (1.9-15) unstable; urgency=low + + * Update stm man page to be a bit clearer about the possibility of + using this application with a DOS box. Thanks to Wolfram Sang, + who apparently still has one! + * Add a note to TextConfig about trouble with setting the cursor + (or rather keeping it set beyond a font change) for linux2.6.11 + and later. We can probably do better than that if someone is + in the mood for a little hacking about. Closes: #351849 + + -- Ron Lee Tue, 10 Jan 2006 08:09:57 +1030 + +svgatextmode (1.9-14) unstable; urgency=low + + * Applied patch from Jindrich Makovicka for GF6600/6800, tested + on 6600 only so far. + + -- Ron Lee Sun, 23 Oct 2005 22:22:30 +0930 + +svgatextmode (1.9-13) unstable; urgency=low + + * Typo fix for TextConfig.5 Closes: #326409, thanks! + * Fix a couple similar in SVGATextMode.8 too. + * Fix bashism's in preinst. Thanks to the lintian crew. + * Update for new standard version. + + -- Ron Lee Sat, 3 Sep 2005 13:45:48 +0930 + +svgatextmode (1.9-12) unstable; urgency=low + + * Applied NV31, NV34 patch from hmh@d.o, this seems to be the + last contender for entry to stable, thanks again! Closes: #279744 + + -- Ron Lee Tue, 8 Feb 2005 23:01:01 +1030 + +svgatextmode (1.9-11) unstable; urgency=low + + * Fixed FTBFS on amd64. Thanks to Kurt Roeckx. Closes: #255540 + * Applied patch from hmh@d.o for improved nVidia GeForce support, + this seemed like the sanest patch on offer. Closes: #173590 + * Update for new standards and dhv4. + + -- Ron Lee Wed, 4 Aug 2004 14:37:30 +0930 + +svgatextmode (1.9-10) unstable; urgency=low + + * Added missing header patch from Jonathon Abbott, and flipped the order + of checking for tty's and devfs. devfs systems with bc symlinks should + work correctly now. Closes: #131826, #142151, #131821 + * Applied patch from Matthew Mueller to fix palette mapping glitch, + Closes: #76679 + * Made my peace with the grammar police, Closes: #125401 + * Suggested svgalib-bin, since tools in there are mentioned in the docs. + Closes: #131482 + * Thanks to everyone who submitted patches and/or offered to NMU, + please test it. + + -- Ron Lee Mon, 15 Jul 2002 18:16:59 -0700 + +svgatextmode (1.9-9) unstable; urgency=low + + * GeForce3 Ti 200 driver patch, well it started that + way, ..now its the Grand Unified GeForce support patch + from Mark Glines (for a while we hope). Thanks. + + -- Ron Lee Sat, 13 Oct 2001 22:58:23 -0700 + +svgatextmode (1.9-8) unstable; urgency=low + + * Piped stderr of update-rc.d to /dev/null since it's + suddenly got noisy about asserting -f Closes: #115331 + * removed INSTALL from docs to pacify lintian. + (it did contain some useful information but not enough + to dick about with it more than that.) + + -- Ron Lee Thu, 11 Oct 2001 21:29:29 -0700 + +svgatextmode (1.9-7) unstable; urgency=low + + * Applied GEFORCE support patch from Peter Gervai - Closes: #114983 + Closes: #87621 + + -- Ron Lee Tue, 9 Oct 2001 10:56:31 -0700 + +svgatextmode (1.9-6) unstable; urgency=low + + * changed console-tools to depends to fix apt-get stm problem + Closes: #76104 + + -- Ron Lee Sat, 25 Nov 2000 19:07:19 -0800 + +svgatextmode (1.9-5) unstable; urgency=low + + * fixed typo in RivaTNT patch. (thanks Henrique) - Closes: #72818 + + -- Ron C. Lee Sat, 28 Oct 2000 23:28:03 +0930 + +svgatextmode (1.9-4) unstable; urgency=low + + * repackaged to use dh_v2, updated for current policy. + * made examples executable - Closes: #54377 + * fixed build flags - Closes: #61268 + * added some contributed mode lines to TextConfig - Closes: #56564 + * applied patch from Tom Lees for Riva TNT/TNT2 support - Closes: #61840 + * applied Tom Zerucha's MGAGx00 patch for Matrox cards - Closes: #55115 + * coded some functions to enable STM to work transparently with both + devfs and traditional console devices. Many thanks to Sergey Golod + for his initial patches which shed clues in just the right places. + - Closes: #63887 + * silenced *lots* of warnings in the original code. + + -- Ron C. Lee Tue, 26 Sep 2000 06:51:34 +1030 + +svgatextmode (1.9-3) unstable; urgency=low + + * modified sVinit script similar to a patch sent by + Eduard Bloch (thanks!!) to check for framebuffer + devices - Closes: #50340 + * added man page for STM_nocheckfb + * fixed section typo in STM_utilities.8 + * added -isp switch to dpkg-gencontrol to silence new + lintian warnings. + + -- Ron C. Lee Sun, 2 Jan 2000 17:57:59 +1030 + +svgatextmode (1.9-2) unstable; urgency=low + + * added suggested config line for riva128 to TextConfig + (thanks to Francesco Potorti - Closes: #36074 ) + * changed it's -> its in Textconfig - Closes: #36550 + * now configured to support console-tools by default + instead of kbd - Closes: #20492, #43084 + * changed startup timing from S40 to S60 so STM now + starts after /var/run is cleaned - Closes: #46509 + * applied patch from Stanislav Voronyi for S3 Trio 3D2X support + * updated to standards version 3 and FHS compliance + + -- Ron C. Lee Fri, 22 Oct 1999 14:45:32 +0930 + +svgatextmode (1.9-1) unstable; urgency=low + + * New upstream release. + * New maintainer. + * Streamlined debian/rules to use debstd + * bloated them again adding man page links to satisfy lintian. + * Added preinst warning that some old modes in Textconfig may + now be invalid due to upstream changes to Vertical limit. + * fixes: #17089, #17255, #20493, #23048, #27210, #17326(??) + + -- Ron C. Lee Fri, 9 Apr 1999 21:20:55 +0930 + +svgatextmode (1.8-5.3) unstable; urgency=medium + + * Non-maintainer upload + * Changed Fontselect lines in TextConfig to avoid fonts removed + in kbd-data 0.97-1 and to fix #33463 + * fixed path to SVGATextMode in STMmenu (#34963) + * patched for new gpm.pid in STM_reset (#31815, #32339, #34703, + #35339 ) + * STM is now started from rcS.d, not at runlevel change (#25829) + + -- Ron C. Lee Mon, 5 Apr 1999 19:59:37 +0930 + +svgatextmode (1.8-5.2) frozen unstable; urgency=low + + * Interim release. + * Changed the "Depends: kbd (>= 0.92-3)" into "Conflicts: kbd (<< + 0.92-3)" and "Recommends: kbd". + * Added note in Description why kbd is recommended. + * Corrected the case of "SVGATextMode" in startup messages (Fixes: + Bug#21059). + + -- Yann Dirson Mon, 27 Apr 1998 22:42:59 +0200 + +svgatextmode (1.8-5.1) frozen unstable; urgency=low + + * Interim release. + * Fixed init.d messages to comply with current policy. + * Factorized uselessly duplicated lines in init.d script. + * Do not hide error messages (Fixes: Bug#19889). + + -- Yann Dirson Tue, 31 Mar 1998 22:40:13 +0200 + +svgatextmode (1.8-5) unstable; urgency=low + + * vgaset now GPL'ed! + * patched xfree_compat.c to fix a bug with Matrox and some S3 cards + * STM_reset now uses /bin/sh + * added a note about STM_reset to README.debian + * added call to update-rc.d in postrm + * /etc/init.d/svgatextmode now supports all required options + + -- Igor Grobman Fri, 13 Mar 1998 11:05:59 -0500 + +svgatextmode (1.8-4) unstable; urgency=low + + * #include in vga_prg.c. Hopefully, this is the source of odd + behaviour reported in some bugs. + * added 'chmod 755 /usr/doc/svgatextmode' to postinst. This is to fix older + package's incorrect permissions. + * added a note to README.debian about some cards that need to be + initialized by cat /proc/pci + + -- Igor Grobman Thu, 22 Jan 1998 20:01:24 -0500 + +svgatextmode (1.8-3) unstable; urgency=low + + * fixed some bugs in TextConfig + * use rm -f to remove obsolete conffiles in postinst + + -- Igor Grobman Wed, 24 Dec 1997 21:51:51 -0500 + +svgatextmode (1.8-2) unstable; urgency=low + + * ugh, I messed up with the first revision. Many things weren't included + or written properly. This should fix all problems mentioned in + bug #15974 + + -- Igor Grobman Mon, 15 Dec 1997 20:16:38 -0500 + +svgatextmode (1.8-1) unstable; urgency=low + + * New upstream release + * changed the package to start svgatextmode in /etc/init.d, not + /etc/rc.boot to make sure it starts after all the partitions are mounted + * renamed README.debian to README.Debian + * all binaries stripped + + -- Igor Grobman Wed, 26 Nov 1997 15:25:22 -0500 + +svgatextmode (1.6-5) unstable; urgency=low + + * removed / in the beginning of TextConfig + * added dpkg-shlibdeps call (forgot to add it after removing debstd, but the + binary deps were not screwed up, because rules clean did not remove + debian/substvars) + * renamed changelog.gz to changelog.Debian.gz + + -- Igor Grobman Thu, 13 Nov 1997 10:06:40 -0500 + +svgatextmode (1.6-4) unstable; urgency=low + + * copyright and changelog files are back in the package. + + -- Igor Grobman Tue, 4 Nov 1997 12:19:02 -0500 + +svgatextmode (1.6-3) unstable; urgency=low + + * do not use absolute path in postinst + * restructured rules file + * all docs and examples should now be installed correctly + + -- Igor Grobman Sat, 1 Oct 1997 23:19:38 -0400 + +svgatextmode (1.6-2) unstable; urgency=low + + * included STM_reset script that sends SIGWINCH to gpm on screen resize. + Enabled it as ResetProg in default TextConfig (fixes bug #9220 filed + against gpm + * All files in /usr/doc/svgatextmode should have correct permissions now + (bug #11092) + + -- Igor Grobman Sat, 12 Jul 1997 16:51:24 -0400 + +svgatextmode (1.6-1) unstable; urgency=low + + * New upstream release + * svgatextmode uses /dev/tty0 for VT interface now instead of /dev/console + (bug #10586) + + -- Igor Grobman Tue, 1 Jul 1997 12:07:56 -0400 + +svgatextmode (1.5-2) unstable; urgency=low + + * fixed wrong permissions in /usr/doc/svgatextmode + * added get/setpallette and get/setVGAreg utilities to the package + * applied patches provided by author (can be found in stm.patches) + * compiled with libc6 + + -- Igor Grobman Sun, 18 May 1997 00:50:41 -0400 + +svgatextmode (1.5-1) unstable; urgency=low + + * New upstream release + + -- Igor Grobman Sun, 20 Apr 1997 20:09:07 -0400 + +svgatextmode (1.4-10) frozen unstable; urgency=low + + * changed the FontPath in TextConfig to make stm compatible with the latest + kbd package + * added a hint on how to reset text mode to standard 80x25 on reboot + (needed for some buggy video cards) + + -- Igor Grobman Mon, 31 Mar 1997 14:01:16 -0500 + +svgatextmode (1.4-9) unstable; urgency=low + + * New maintainer + * Disabled activation on install (the lines in /etc/rc.boot/svgatextmode + are now commented out). bugs #6189 and #7140 + * applied Stuart Lamble's patch to fix the bug with the display of + continuous lines (bug #7493) + + -- Igor Grobman Mon, 10 Mar 1997 16:46:52 -0500 + +svgatextmode (1.4-8) unstable; urgency=low + + * got rid of postrm and postinst script. Put the instructions that + postinst displayed into README.debian + * included parts of the contrib section in /usr/doc/svgatextmode/samples + * debmake upgrade may finally compress the files the way they should be. + + -- Christoph Lameter Sun, 20 Oct 1996 09:53:31 -0800 + +svgatextmode (1.4-7) unstable; urgency=low + + * debmake bug: scripts not included in -6 + + -- Christoph Lameter Thu, 17 Oct 1996 06:53:06 -0800 + +svgatextmode (1.4-6) unstable; urgency=low + + * Adapted to use debmake. Thus compressed manpages + docs. + + -- Christoph Lameter Wed, 16 Oct 1996 21:59:08 -0800 + +svgatextmode (1.4-5) unstable; urgency=low + + * Remove prerm script. Caused too much trouble. + * removed /etc/init.d/svgatextmode script. Instead installed svgatextmode + initialization in /etc/rc.boot/svgatextmode + + -- Christoph Lameter Sat, 5 Oct 1996 9:00:00 -0800 + +svgatextmode (1.4-4) unstable; urgency=high + + * another bug in /etc/init.d/svgatextmode + + -- Christoph Lameter Thu, 26 Sep 1996 9:00:00 -0800 + +svgatextmode (1.4-3) unstable; urgency=high + + * added changelog.DEBIAN to /usr/doc/svgatextmode + * Bugs and suggestions reported by Eric Delaunay + + -- Christoph Lameter Wed, 25 Sep 1996 9:00:00 -0800 + +svgatextmode (1.4-2) unstable; urgency=low + + * Missing "then" in postinst + * Had a garbled up screen in testing the thing. Dont know if it was + because I was running an experimental version? + + -- Christoph Lameter Mon, 23 Sep 1996 9:00:00 -0800 + +svgatextmode (1.4-1) unstable; urgency=low + + * New upstream release + + -- Christoph Lameter Mon, 23 Sep 1996 9:00:00 -0800 + +svgatextmode (1.3-4) unstable; urgency=low + + * Bug #4533: problem in postinst script and svgatextmode + + -- Christoph Lameter Fri, 20 Sep 1996 9:00:00 -0800 + +svgatextmode (1.3-3) unstable; urgency=low + + * First Release with standards 2.1.0.0 + * Removed manpages from /usr/doc/svgatextmode + * Added script to /etc/init.d to automatically switch svgatextmode on and + off. + * Added a configuration file /etc/svgamode to define the default mode + + -- Christoph Lameter Wed, 18 Sep 1996 9:00:00 -0800 + +Local variables: +mode: debian-changelog +End: --- svgatextmode-1.9.orig/debian/compat +++ svgatextmode-1.9/debian/compat @@ -0,0 +1 @@ +5 --- svgatextmode-1.9.orig/debian/control +++ svgatextmode-1.9/debian/control @@ -0,0 +1,30 @@ +Source: svgatextmode +Section: admin +Priority: extra +Build-Depends: debhelper (>=5.0), flex, bison, linux-libc-dev | linux-kernel-headers +Maintainer: Ron Lee +Standards-Version: 3.7.2.2 + +Package: svgatextmode +Architecture: any +Depends: kbd, ${shlibs:Depends} +Suggests: svgalib-bin +Description: enable higher resolution text modes + This program is designed to greatly improve the normal (EGA-based) text modes + on your Linux machine. It uses an Xconfig-like configuration file to set up + better looking text modes. (higher resolution, larger font size, higher + display refresh...) This is already a big boon on normal 14" displays, and + it is an immense difference on larger and better (15" and up) screens. + It stems from the idea that it is a real waste of hardware to use EGA + text modes on an SVGA-card, which was designed to do much better than that. + . + This package is mainly of use to people with older hardware that is not + adequately supported by the Linux framebuffer drivers. If you abhor 80x25 + text modes as much as I do but have a modern CPU and video hardware, then + building a kernel with framebuffer support is probably a better option. + Some newer video cards are not supported by this package at all (but are + supported by the kernel fb drivers) + . + WARNING: This program will not work on non-VGA based systems. Installing it + will not do any harm, but activating the program can. + --- svgatextmode-1.9.orig/debian/copyright +++ svgatextmode-1.9/debian/copyright @@ -0,0 +1,9 @@ +This package was debianized by Ron Lee +Fri, 9 Apr 1999 21:15:51 +0930. + +It was downloaded from: +ftp://sunsite.unc.edu/pub/Linux/utils/console/SVGATextMode* + +SVGATextMode is licenced under the GPL which you can find in +/usr/share/common-licenses/GPL on debian systems. + --- svgatextmode-1.9.orig/debian/rules +++ svgatextmode-1.9/debian/rules @@ -0,0 +1,72 @@ +#!/usr/bin/make -f +# Converted from the old debstd rules file by Ron Lee +# ..well when I say converted, you'd probably find more water in your +# wine than remnants of the original here, but still.. :-) + +package=svgatextmode + +HACKPROGS = setVGAreg getVGAreg setpalette getpalette set80 ClockProg + + +build: build-stamp + +build-stamp: + dh_testdir + $(MAKE) all + touch $@ + +clean: + dh_testdir + dh_testroot + -rm -f build-stamp + -$(MAKE) mrproper + -rm -f `find . -name "*~"` + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + $(MAKE) newinstall DESTDIR=`pwd`/debian/$(package) + $(MAKE) maninstall DESTDIR=`pwd`/debian/$(package) + install $(HACKPROGS) `pwd`/debian/$(package)/usr/sbin + install -m 755 contrib/scripts/STM_reset `pwd`/debian/$(package)/usr/sbin + + +binary-indep: build install +# no architecture-independent files generated by this package. + +binary-arch: build install + dh_testdir + dh_testroot + dh_installdocs + dh_installexamples + dh_installinit -n + dh_installchangelogs HISTORY + dh_installman debian/STM_nocheckfb.5 \ + $(addprefix doc/,TextConfig.man SVGATextMode.man grabmode.man) \ + contrib/STM_utilities.8 + dh_link usr/share/man/man8/STM_utilities.8 usr/share/man/man8/ClockProg.8 \ + usr/share/man/man8/STM_utilities.8 usr/share/man/man8/STM_reset.8 \ + usr/share/man/man8/STM_utilities.8 usr/share/man/man8/getVGAreg.8 \ + usr/share/man/man8/STM_utilities.8 usr/share/man/man8/getpalette.8 \ + usr/share/man/man8/STM_utilities.8 usr/share/man/man8/setVGAreg.8 \ + usr/share/man/man8/STM_utilities.8 usr/share/man/man8/setpalette.8 \ + usr/share/man/man8/STM_utilities.8 usr/share/man/man8/set80.8 + + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch + + +.PHONY: build clean install binary-indep binary-arch binary + --- svgatextmode-1.9.orig/debian/svgatextmode.dirs +++ svgatextmode-1.9/debian/svgatextmode.dirs @@ -0,0 +1,7 @@ +etc +etc/init.d +sbin +usr/sbin +usr/share/man/man5 +usr/share/man/man8 + --- svgatextmode-1.9.orig/debian/svgatextmode.docs +++ svgatextmode-1.9/debian/svgatextmode.docs @@ -0,0 +1,24 @@ +README +README.FIRST +CREDITS +INDEX +TODO +doc/ClockProg.doc +doc/FAQ +doc/NO_SUPPORT +doc/No_more_display_corruption +doc/PROBLEMS_QuickStart +doc/README.Alpha +doc/README.ET4000 +doc/README.ET4000.AltClockSelect +doc/SVGATextMode.des +doc/SVGATextMode.lsm +doc/creating_textmodes_from_scratch.HOWTO +doc/grabmode_pixmux +doc/monitor-timings.howto +doc/screen-resizing.note +doc/set80.doc +doc/setVGAreg.doc +doc/setpalette.doc +doc/vgaset.note + --- svgatextmode-1.9.orig/debian/svgatextmode.examples +++ svgatextmode-1.9/debian/svgatextmode.examples @@ -0,0 +1,5 @@ +contrib/consoletools +contrib/probe_clocks +contrib/scripts +contrib/svgalib +contrib/vgaset --- svgatextmode-1.9.orig/debian/svgatextmode.init +++ svgatextmode-1.9/debian/svgatextmode.init @@ -0,0 +1,46 @@ +#!/bin/sh + +### BEGIN INIT INFO +# Provides: svgatextmode +# Required-Start: +# Required-Stop: +# Should-Start: $syslog $local_fs bootmisc +# Default-Start: S +# Default-Stop: +# Short-Description: Provide VGA text modes for console users +# Description: Switches to the selected mode early in the boot sequence +### END INIT INFO + + +set -e + +test -f /sbin/SVGATextMode || exit 0 + +case "$1" in + +# all the settings including the default font and default mode can be configured +# in /etc/TextConfig, therefore no arguments are needed for SVGATextMode + + start|restart|force-reload) + echo -n "Invoking SVGATextMode... " + if egrep '.+' /proc/fb >/dev/null 2>&1; then + echo -n "detected framebuffer" + if [ -f /etc/default/STM_nocheckfb ]; then + echo -n "(ignored, starting STM)... " + else + echo "(aborting) see STM_nocheckfb(5)." + exit 0 + fi + fi + /sbin/SVGATextMode>/dev/null + echo "done." + ;; + + stop) +# Since stm is not really a daemon, stop does nothing + exit 0 + ;; + *) + echo "Usage: /etc/init.d/svgatextmode {start|stop|restart|force-reload}" + exit 1 +esac --- svgatextmode-1.9.orig/debian/svgatextmode.postinst +++ svgatextmode-1.9/debian/svgatextmode.postinst @@ -0,0 +1,35 @@ +#!/bin/sh + +set -e + +if grep -q CLGD542x /etc/TextConfig +then + echo 'fixing your TextConfig to reflect Cirrus chipset name change.' + echo 'see /usr/doc/HISTORY for more information' + sed '/'CLGD542x'/s/'CLGD542x'/'Cirrus'/' /etc/TextConfig > /etc/TextConfig.new + mv /etc/TextConfig.new /etc/TextConfig +fi + +# fix permissions on /usr/doc/svgatextmode which were possibly messed up by +# previous versions of the package +# (this seems to be an old problem and can probably be removed, but for now +# we'll err on the cautious side and just make sure its not a symlink - Ron ) +if [ -d /usr/doc/svgatextmode ]; +then + chmod 755 /usr/doc/svgatextmode +fi + +# ** changed by Ron Lee for version 1.8-5.3 ** +# to remove links previously created by +# update-rc.d svgatextmode defaults 40 > /dev/null +# and start STM from rcS.d instead. + +if [ ! -e /etc/rcS.d/S60svgatextmode ]; +then + update-rc.d -f svgatextmode remove > /dev/null 2>&1 +fi + +update-rc.d svgatextmode start 60 S . > /dev/null 2>&1 + +#DEBHELPER# + --- svgatextmode-1.9.orig/debian/svgatextmode.postrm +++ svgatextmode-1.9/debian/svgatextmode.postrm @@ -0,0 +1,11 @@ +#!/bin/sh + +set -e + +if [ $1 = "purge" ] +then + update-rc.d svgatextmode remove > /dev/null +fi + +#DEBHELPER# + --- svgatextmode-1.9.orig/doc/SVGATextMode.man +++ svgatextmode-1.9/doc/SVGATextMode.man @@ -273,7 +273,8 @@ all necessary code (set the tty settings again, tell the kernel about the resizing, and run the optional \fBResetProg\fP). -.TP B -k +.TP +.B -k Don't tell the kernel if the screen size has changed. If the horizontal screen size really has changed, the kernel will not know about it and render text in completely wrong places. Some people seem to want to use this to lie @@ -287,7 +288,8 @@ course), so it could be used to send explicit resize messages to console applications that otherwise relied on the kernel SIGWINCH signal. -.TP B -x +.TP +.B -x always run SVGATextMode, even if you are not running it from a normal VGA textmode console. This disables the "dumb-user protection" that was added to avoid people from messing up their XFree86 display when running SVGATextMode @@ -387,10 +389,10 @@ .SH DOS VERSION There is a DOS version of all SVGATextMode tools (including SVGATextMode -itself) included in the distribution. +itself) which may be built from the source distribution. The stm.exe program will do the same, and require the same as SVGATextMode -under Linux, with the following exceptions: +does under Linux, with the following exceptions: .IP * 3 The TextConfig file is in \\etc\\textconf. Note the lack of a drive letter. --- svgatextmode-1.9.orig/doc/TextConfig.man +++ svgatextmode-1.9/doc/TextConfig.man @@ -1331,7 +1331,8 @@ .IP \fBCirrus \fP(If not specified, "Cirrus" is assumed) -.IP fBLaguna \fP(for the CL-GD546x chips. This is required for those chips, +.IP +\fBLaguna \fP(for the CL-GD546x chips. This is required for those chips, otherwise the standard "Cirrus" is assumed, which will not work on these cards) --- svgatextmode-1.9.orig/dump_cfgdata.c +++ svgatextmode-1.9/dump_cfgdata.c @@ -137,4 +137,5 @@ } } - \ No newline at end of file + + --- svgatextmode-1.9.orig/file_ops.c +++ svgatextmode-1.9/file_ops.c @@ -21,8 +21,9 @@ /*** *** file_ops.c: file operation functions ***/ - + #include +#include #include /* for open() */ #include "messages.h" @@ -39,7 +40,7 @@ return(param_file); } -int opentty(char *devname) +int opentty(const char *devname) { int fd; --- svgatextmode-1.9.orig/file_ops.h +++ svgatextmode-1.9/file_ops.h @@ -22,7 +22,7 @@ FILE* open_param_file(char* conf_file); -int opentty(char *devname); +int opentty(const char *devname); #endif --- svgatextmode-1.9.orig/set80.c +++ svgatextmode-1.9/set80.c @@ -49,6 +49,7 @@ #include "ttyresize.h" #include #include +#include #ifndef DOS # include # include @@ -183,7 +184,7 @@ #ifndef DOS - ioctl(opentty("/dev/tty0"), KDSETMODE, KD_TEXT); + ioctl(opentty( ConsoleDevice("0") ), KDSETMODE, KD_TEXT); #endif #else --- svgatextmode-1.9.orig/setVGAreg.c +++ svgatextmode-1.9/setVGAreg.c @@ -31,6 +31,7 @@ ***/ #include +#include #include #include --- svgatextmode-1.9.orig/setclock.c +++ svgatextmode-1.9/setclock.c @@ -23,6 +23,7 @@ ***/ #include +#include #include #include #include "misc.h" @@ -266,7 +267,7 @@ int clockindex = 0; /* find clock index in clocks line */ clockindex = GetClock(chipset, clock, &clock, TRUE); - sprintf(tempstr,"%s %1.3f %d", clock_data.ck_prog_path, clock/1000.0, clockindex); + snprintf(tempstr, sizeof(tempstr), "%s %1.3f %d", clock_data.ck_prog_path, clock/1000.0, clockindex); SYNCRESET_SEQ; Run_extern_Prog(tempstr); ENDRESET_SEQ; --- svgatextmode-1.9.orig/setpalette.c +++ svgatextmode-1.9/setpalette.c @@ -156,7 +156,7 @@ } -void main (int argc, char* argv[]) +int main (int argc, char* argv[]) { int index,r,g,b; char* commandfilename; @@ -228,11 +228,11 @@ if (program_hardware && setreg && kernel_can_do_cmap && tellkernel) { - fd = opentty("/dev/tty0"); + fd = opentty( ConsoleDevice("0") ); if (ioctl(fd, GIO_CMAP, kernel_palette)) /* this ioctl first popped up in kernel 1.3.3 */ { perror("GIO_CMAP"); - PERROR(("Could not do GIO_CMAP on /dev/tty0\n")); + PERROR(("Could not do GIO_CMAP on %s\n", ConsoleDevice("0"))); } } @@ -317,8 +317,11 @@ if (ioctl(fd, PIO_CMAP, kernel_palette)) { perror("PIO_CMAP"); - PERROR(("Could not do PIO_CMAP on /dev/tty0\n")); + PERROR(("Could not do PIO_CMAP on %s\n", ConsoleDevice("0"))); } close (fd); } + + exit(0); } + --- svgatextmode-1.9.orig/std_clock.c +++ svgatextmode-1.9/std_clock.c @@ -26,6 +26,7 @@ ***/ #include +#include #include #include #include "misc.h" --- svgatextmode-1.9.orig/textregs.h +++ svgatextmode-1.9/textregs.h @@ -35,12 +35,14 @@ 0xff }; -/* 21 ATRCTL registers */ +/* 21 ATRCTL registers + * Note that the first 16 entries map the 16 screen colors to the first 16 vga + * palette regs, as Linux vga console driver expects/requires. */ #define NUM_STD_ATRCTL_REGS 21 unsigned char TXT_ATRCTL_REGS[NUM_STD_ATRCTL_REGS] = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, 0x38, 0x39, 0x3a, 0x3b, - 0x3c, 0x3d, 0x3e, 0x3f, 0x0c, 0x00, 0x0f, 0x08, 0x00 + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, + 0x0c, 0x0d, 0x0e, 0x0f, 0x0c, 0x00, 0x0f, 0x08, 0x00 }; /* 9 GRCTL regs */ @@ -72,14 +74,14 @@ { 0x2A, 0x00, 0x2A }, { 0x2A, 0x2A, 0x00 }, { 0x2A, 0x2A, 0x2A }, - { 0x00, 0x00, 0x15 }, - { 0x00, 0x00, 0x3F }, - { 0x00, 0x2A, 0x15 }, - { 0x00, 0x2A, 0x3F }, - { 0x2A, 0x00, 0x15 }, - { 0x2A, 0x00, 0x3F }, - { 0x2A, 0x2A, 0x15 }, - { 0x2A, 0x2A, 0x3F }, + { 0x15, 0x15, 0x15 }, + { 0x15, 0x15, 0x3F }, + { 0x15, 0x3F, 0x15 }, + { 0x15, 0x3F, 0x3F }, + { 0x3F, 0x15, 0x15 }, + { 0x3F, 0x15, 0x3F }, + { 0x3F, 0x3F, 0x15 }, + { 0x3F, 0x3F, 0x3F }, { 0x00, 0x15, 0x00 }, { 0x00, 0x15, 0x2A }, { 0x00, 0x3F, 0x00 }, --- svgatextmode-1.9.orig/ttyresize.c +++ svgatextmode-1.9/ttyresize.c @@ -42,7 +42,6 @@ #include #include #include -#include /* for PAGE_SIZE */ #include /* for VT_RESIZE */ #include #include @@ -62,7 +61,7 @@ # include #endif -void get_ttysize(int fd, char *devname, struct winsize *this_winsize) +void get_ttysize(int fd, const char *devname, struct winsize *this_winsize) { if (ioctl(fd, TIOCGWINSZ, this_winsize)) { @@ -74,7 +73,7 @@ #ifndef NO_RESIZE -void set_ttysize(int fd, char *devname, struct winsize *this_winsize, int cols, int rows) +void set_ttysize(int fd, const char *devname, struct winsize *this_winsize, int cols, int rows) { /* no need to skip this if the screen is not resized. The kernel already does that */ @@ -89,7 +88,7 @@ } } -void resizetty(char *devicename, int cols, int rows) +void resizetty(const char *devicename, int cols, int rows) { struct winsize my_winsize; int fd; @@ -160,8 +159,10 @@ exit(1); /* Dirty the pages. This is better than calloc(). */ - for (i = 0; i < bytes; i += PAGE_SIZE) - p[i] = 1; + { + size_t page_size = sysconf(_SC_PAGESIZE); + for (i = 0; i < bytes; i += page_size) p[i] = 1; + } free(p); exit(0); @@ -214,7 +215,7 @@ int fd; PDEBUG(("%s\n", descr)); - fd = opentty("/dev/tty0"); + fd = opentty( ConsoleDevice("0") ); if (try_resize(fd, p_struct_size, memsize, cmd)) return(FALSE); @@ -349,15 +350,15 @@ struct vt_stat vst; unsigned short mask; int i; - char devicename[64]; + char devicenum[5]; PDEBUG(("Resizing all active VT's when needed\n")); - fd = opentty("/dev/tty0"); + fd = opentty( ConsoleDevice("0") ); if (ioctl(fd, VT_GETSTATE, &vst)) { perror("VT_GETSTATE"); - PERROR(("Could not do VT_GETSTATE on /dev/tty0\n")); + PERROR(("Could not do VT_GETSTATE on %s\n", ConsoleDevice("0"))); } close(fd); @@ -372,8 +373,8 @@ { if ((vst.v_state & mask) != 0) /* only resize active VT's */ { - sprintf(devicename,"/dev/tty%d",i); - resizetty(devicename, cols, rows); + snprintf(devicenum, sizeof(devicenum), "%d", i); + resizetty(ConsoleDevice(devicenum), cols, rows); } } } @@ -384,7 +385,7 @@ { struct winsize my_winsize; int fd; - char devicename[]="/dev/tty0"; + const char *devicename = ConsoleDevice("0"); PDEBUG(("Checking if new mode requires screen resizing (from %s)\n", devicename)); --- svgatextmode-1.9.orig/user_time.c +++ svgatextmode-1.9/user_time.c @@ -35,7 +35,7 @@ { static unsigned long time=0; static unsigned short last_count=0; - unsigned short count; + unsigned short count = 0; /* note: dynamic detection of the max. latch value is only possible --- svgatextmode-1.9.orig/vga_prg.c +++ svgatextmode-1.9/vga_prg.c @@ -33,6 +33,13 @@ #include "textregs.h" /* for Set_Textmode */ /* + * this is ugly, it's really declared in sys/io.h but including that here + * fritzes the inb/outb macros again. otoh compiler warnings are ugly too. + * -- Ron + */ +extern int iopl(int); + +/* * global vars */ @@ -306,6 +313,7 @@ else { Outb_GR_CTL(6,Inb_GR_CTL(6) & 0xFE); + for (i=0 ; i<16; i++) Outb_ATR_CTL(i, TXT_ATRCTL_REGS[i]); /* ensure palette is mapped as Linux expects */ Outb_ATR_CTL(16,inb_ATR_CTL(16) & 0xFE); Outb_GR_CTL(0x08,0xFF); /* pixel bit mask */ } --- svgatextmode-1.9.orig/vga_prg.h +++ svgatextmode-1.9/vga_prg.h @@ -40,8 +40,8 @@ # define ioperm(x,y,z) (0) # define iopl(x) (0) #else -# include -# ifdef __ALPHA_IO_H +# include +# if defined(__ALPHA_IO_H) || defined(_SYS_IO_H) # define _ASM_IO_H # endif #endif