--- set6x86-1.5.orig/set6x86.c +++ set6x86-1.5/set6x86.c @@ -32,7 +32,7 @@ #include #ifndef DOS -# include +# include #else # ifdef DJGPP # include @@ -125,6 +125,7 @@ (setreg) ? "data" : "", (setreg) ? \ " -p silent mode: don't spread the news (no output)\n" + " -B Bypass cpu check\n"\ " -s `data' is a bitmask for setting bits in the register\n"\ " -c `data' is a bitmask for clearing bits in the register\n"\ : \ @@ -141,15 +142,19 @@ int main (int argc, char* argv[]) { - int c; + int c, i; int tmpbyte=0; int regnum=0; bool setreg = FALSE; bool silent = FALSE; + bool check_cpu = TRUE; bool arg_is_setmask=FALSE; bool arg_is_clearmask=FALSE; char* commandfilename; + char input[512]; int data=0; + int fclose(); + FILE *file_id, *fopen(); /* * See what action is required: read or write @@ -166,7 +171,7 @@ * command-line argument parsing */ - while ((c = getopt (argc, argv, "hpsc")) != EOF) + while ((c = getopt (argc, argv, "hpscB")) != EOF) switch (c) { case 'h': usage(setreg); @@ -178,6 +183,8 @@ break; case 'c': arg_is_clearmask=TRUE; break; + case 'B': check_cpu=FALSE; + break; case '?': usage(setreg); printf("Bad option '-%c'\n",(char)optopt); exit(1); @@ -186,6 +193,31 @@ exit(1); } + file_id = fopen("/proc/cpuinfo", "r"); + + /* if /proc/cpuinfo does not exist, bypass this test */ + if (file_id == NULL) { + check_cpu = FALSE; + } + if (check_cpu) { + for (i=0; i < 50; i++) { + fscanf(file_id, "%s", input); + if (!strcmp(input, "vendor_id")) { + fscanf(file_id, "%s", input); + fscanf(file_id, "%s", input); + if (strncmp(input, "Cyrix", 5)) { + printf("May not be a Cyrix cpu\n"); + printf("Use the bypass switch -B to avoid this check\n"); + exit(0); + } + else { + i = 55; + } + } + } + fclose(file_id); + } + /* get register set from commandline */ if (argcoptind) fprintf(stderr,"Extra parameters (starting with '%s') ignored\n", argv[optind]); - + /* * start doing something useful */ --- set6x86-1.5.orig/6x86_reg.c +++ set6x86-1.5/6x86_reg.c @@ -34,7 +34,7 @@ #include #include #include -#include +#include typedef int bool; @@ -83,7 +83,9 @@ /* the original bogomips code from the Linux kernel */ static __inline__ void delay(int loops) { - __asm__(".align 2,0x90\n1:\tdecl %0\n\tjns 1b": :"a" (loops):"ax"); + int dummy; + + __asm__(".align 2,0x90\n1:\tdecl %0\n\tjns 1b":"=a" (dummy):"0" (loops)); } /* a short routine to read /proc/cpuinfo */ @@ -278,9 +280,9 @@ printf(" CCR3: 0x%x\n", ccr); outb(CCR4, 0x22); ccr = inb(0x23); printf(" CCR4: 0x%x\t", ccr); - if (dir & 0xf0) /* if this is a 6x86 or 6x86L */ + if (dir & 0xf0) { /* if this is a 6x86 or 6x86L */ if (ccr & 0x10) printf("DTE cache enabled, "); - else printf("DTE cache disabled, "); + else printf("DTE cache disabled, "); } switch (ccr & 0x07) { case 0x00: { printf("1 clock cycle I/O recovery time"); @@ -318,9 +320,9 @@ printf("\n"); outb(CCR5, 0x22); ccr = inb(0x23); printf(" CCR5: 0x%x\t", ccr); - if (dir & 0xf0) /* if this is a 6x86 or 6x86L */ + if (dir & 0xf0) { /* if this is a 6x86 or 6x86L */ if (ccr & 0x02) printf("slow LOOP enabled, "); - else printf("slow LOOP disabled, "); + else printf("slow LOOP disabled, "); } if (ccr & 0x01) printf("allocate cache lines on write misses\n\n"); else printf("default cache line allocation policy\n\n"); --- set6x86-1.5.orig/rc.cyrix +++ set6x86-1.5/rc.cyrix @@ -7,9 +7,21 @@ # # set6x86 version 1.2 or newer required +### BEGIN INIT INFO +# Provides: set6x86 +# Required-Start: $syslog +# Required-Stop: $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Tweak cpu settings to local perferences +### END INIT INFO + +set -e BINPATH=/usr/sbin +case $1 in +start | restart | stop | status | reload | force-reload ) echo -n "Cyrix 6x86: Suspend-on-Halt, " $BINPATH/set6x86 -p 0xC2 -s 0x08 @@ -46,3 +58,4 @@ $BINPATH/set6x86 -p 0xC3 -c 0x10 echo +esac --- set6x86-1.5.orig/Makefile +++ set6x86-1.5/Makefile @@ -1,7 +1,7 @@ # Makefile for set6x86, a program to get/set Cyrix 6x86 CPU config settings # from GNU/Linux -CFLAGS = -O2 -Wall +CFLAGS = -O2 -g -Wall VERSION=1.5 --- set6x86-1.5.orig/get6x86.8 +++ set6x86-1.5/get6x86.8 @@ -0,0 +1 @@ +.so man8/set6x86.8 --- set6x86-1.5.orig/set6x86.8 +++ set6x86-1.5/set6x86.8 @@ -0,0 +1,49 @@ +.TH SET6X86 8 "set6x86 version 1-5" +.SH NAME +set6x86, get6x86 \- access Cyrix control registers +.SH SYNOPSIS +.B set6x86 +[ +.I -hpsc +] +.I register_index +data +.SH DESCRIPTION +This utility program allows access to the special control +registers of the Cyrix 6x86 processors. This initial manpage +is intended to satisfy the lintian requirements of a Debian +package and will be improved after the other serious issues +are cleaned up. +.SH PARAMETERS +.B register_index +An index to the specified Cyrix 6x86 config register in +decimal (e.g. '24'), hex ('0x18') or octal ('030'). +.TP +.B data +The data to program into the specified register (dec|hex|oct) +(or the bitmask for the -s' (set) or -c' (clear) options). +.SH OPTIONS +.B set6x86 accepts the following options: + +.TP +.B \-c +The data is a bitmask for clearing bits in the register. +.TP +.B \-h +The usage information is printed. +.TP +.B \-p +The output is pipeable (in hex format). Only the contents +of the register is output. +.TP +.B \-B +We now check /proc/cpuinfo to make sure it is a Cyrix cpu. +This option bypasses the check. It has only been tested on +a MediaGX chip and expects the vender id to start with "Cyrix". +This option allows setting other chips without that string. +.TP +.B \-s +The data is a bitmask for setting bits in the register. +.SH "SEE ALSO" +.I 6x86_reg (8) +.I rc.cyrix (8) --- set6x86-1.5.orig/6x86_reg.8 +++ set6x86-1.5/6x86_reg.8 @@ -0,0 +1,11 @@ +.TH 6X86_REG 8 "6x86_reg version 1-5" +.SH NAME +6x86_reg \- Register Dump utility for Cyrix 6x86 +.SH SYNOPSIS +.B 6x86_reg +.SH DESCRIPTION +This program dumps the contents of the Cyrix special +registers. +.SH "SEE ALSO" +.I set6x86 (8) +.I get6x86 (8) --- set6x86-1.5.orig/debian/postrm +++ set6x86-1.5/debian/postrm @@ -0,0 +1,13 @@ +#! /bin/sh + +if [ "$1" = "purge" ] +then + update-rc.d set6x86 remove > /dev/null + if [ -f /etc/rc.boot/set6x86 ] ; then + rm /etc/rc.boot/set6x86 + fi +fi + +#DEBHELPER# + +exit 0 --- set6x86-1.5.orig/debian/changelog +++ set6x86-1.5/debian/changelog @@ -0,0 +1,138 @@ +set6x86 (1.5-14) unstable; urgency=low + + * Use dh_strip to strip comment sections (Closes: #438014) + * Eliminated lintian d-rules-ignores-make-clean-error message. + + -- Richard A. Hecker Wed, 07 Nov 2007 10:16:55 -0800 + +set6x86 (1.5-13) unstable; urgency=low + + * Use blank as delimeter (Closes: #372157) + * Strip .comment section to avoid lintian warnings. + * Finally examined the previous NMU. + * Upgraded standards version to 3.7.2 from 3.6.2 + * Make init script LSB compliant. + + -- Richard A. Hecker Mon, 19 Feb 2007 15:36:15 -0800 + +set6x86 (1.5-12.1) unstable; urgency=low + + * Non-maintainer upload. + * More debhelper fixes: + + Use debian/$(package) instead of debian/tmp (Closes: #359940). + + Use more dh_* programs. + + Remove debian/conffiles. + + Add debhelper token to maintainer scripts. + + Add missing Depends: field for binary package. + * Clean the package before doing dpkg-source -b. + + -- Christoph Berg Thu, 20 Apr 2006 14:15:28 +0200 + +set6x86 (1.5-12) unstable; urgency=low + + * Retire debmake dependencies. + * Finish upgrading to debhelper. + + -- Richard A. Hecker Wed, 22 Mar 2006 18:18:46 -0800 + +set6x86 (1.5-11) unstable; urgency=low + + * Upgrade the debhelper compatability version. + * Remove comma so kfreebsd-i386 is a supported architecture. Closes: #314285 + + -- Richard A. Hecker Wed, 14 Sep 2005 07:00:49 -0700 + +set6x86 (1.5-10) unstable; urgency=low + + * Added kfreebsd-i386 as a supported architecture. Closes: #314285 + * Check /proc/cpuinfo if available. Closes: #65194, #12105 + * Upgraded to Standards version 3.6.2 from 3.2.1 previously. + + -- Richard A. Hecker Sat, 10 Sep 2005 12:30:52 -0700 + +set6x86 (1.5-9) unstable; urgency=low + + * Added Build-Depends for debmake, Closes: #190524 + + -- Richard A. Hecker Thu, 22 May 2003 05:19:17 -0700 + +set6x86 (1.5-8) unstable; urgency=low + + * Fixed bad symlink, Closes: #111157 + + -- Richard A. Hecker Tue, 25 Sep 2001 16:12:23 -0600 + +set6x86 (1.5-7) unstable; urgency=low + + * New Maintainer field, Closes: #94339 + + -- Richard A. Hecker Fri, 4 May 2001 15:59:10 -0700 + +set6x86 (1.5-6) unstable; urgency=low + + * Cleaned up lintian errors, reworking scripts and file permissions. + + -- Richard Hecker Wed, 20 Sep 2000 17:57:15 -0700 + +set6x86 (1.5-5) unstable; urgency=low + + * New Maintainer and fixed a compiler warning message. + + -- Richard Hecker Sun, 13 Aug 2000 22:52:16 -0700 + +set6x86 (1.5-4) unstable; urgency=low + + * Recompiled against libc6 2.1. + + -- Clint Adams Sat, 15 May 1999 16:06:19 -0400 + +set6x86 (1.5-3) frozen unstable; urgency=high + + * Delayed execution of initscript until after mountall. + + -- Clint Adams Sat, 6 Feb 1999 17:59:49 -0500 + +set6x86 (1.5-2) frozen unstable; urgency=medium + + * Moved startup from rc.boot to init.d (bug #32443). + * Put rc.cyrix and rc.6x86MX into /usr/doc/set6x86/examples. + + -- Clint Adams Sun, 31 Jan 1999 16:57:37 -0500 + +set6x86 (1.5-1) unstable; urgency=low + + * New upstream release (bug #16152). + + -- Clint Adams Wed, 4 Feb 1998 00:14:55 -0500 + +set6x86 (1.3-1) unstable; urgency=low + + * New upstream release (bug #13980). + + -- Clint Adams Mon, 20 Oct 1997 10:21:05 -0400 + +set6x86 (1.2-4) unstable; urgency=low + + * Fixed misleading description (bug #11025). + + -- Clint Adams Wed, 23 Jul 1997 19:14:32 -0400 + +set6x86 (1.2-3) unstable; urgency=low + + * Fixed corrupt patch file (bug #11267). + + -- Clint Adams Thu, 17 Jul 1997 09:54:48 -0400 + +set6x86 (1.2-2) unstable; urgency=low + + * Recompiled with libc6. + * Moved into main distribution. + + -- Clint Adams Thu, 15 May 1997 12:37:59 -0400 + +set6x86 (1.2-1) experimental; urgency=low + + * Initial Release. + + -- Clint Adams Wed, 19 Feb 1997 11:17:24 -0500 + --- set6x86-1.5.orig/debian/compat +++ set6x86-1.5/debian/compat @@ -0,0 +1 @@ +4 --- set6x86-1.5.orig/debian/postinst +++ set6x86-1.5/debian/postinst @@ -0,0 +1,13 @@ +#! /bin/sh + +if [ $1 = "configure" ] ; then + update-rc.d set6x86 start 38 S . > /dev/null + # Clean up old init script + if [ -f /etc/rc.boot/set6x86 -a -f /etc/init.d/set6x86 ] ; then + rm /etc/rc.boot/set6x86 + fi +fi + +#DEBHELPER# + +exit 0 --- set6x86-1.5.orig/debian/dirs +++ set6x86-1.5/debian/dirs @@ -0,0 +1,2 @@ +usr/sbin +etc/init.d --- set6x86-1.5.orig/debian/rules +++ set6x86-1.5/debian/rules @@ -0,0 +1,62 @@ +#!/usr/bin/make -f +# Made with the aid of debmake, by Christoph Lameter, +# based on the sample debian/rules file for GNU hello by Ian Jackson. +# Converted to debhelper (helped by Christoph Berg) by Richard Hecker + +package=set6x86 + +build: + $(checkdir) + + make CFLAGS="-O2 -g -Wall" all + + touch build + +clean: + $(checkdir) + -rm -f build + [ ! -f Makefile ] || $(MAKE) clean + -rm -f `find . -name "*~"` + -rm -rf debian/$(package) debian/files* core debian/substvars + +binary-indep: checkroot build + $(checkdir) +# There are no architecture-independent files to be uploaded +# generated by this package. If there were any they would be +# made here. + +binary-arch: checkroot build + $(checkdir) + dh_clean -k + dh_installdirs + make + install -s -m 755 -o root -g root set6x86 debian/$(package)/usr/sbin + ln -s set6x86 debian/$(package)/usr/sbin/get6x86 + install -s -m 755 -o root -g root 6x86_reg debian/$(package)/usr/sbin + install -m 755 -o root -g root rc.cyrix debian/$(package)/etc/init.d/set6x86 + dh_installchangelogs CHANGES + dh_installexamples rc.cyrix rc.6x86MX + dh_installman *.8 + dh_installdocs README Doc-6x86.txt + dh_compress + dh_fixperms + dh_shlibdeps + dh_installdeb + dh_gencontrol + dh_strip + dh_md5sums + dh_builddeb + +define checkdir + test -f debian/rules +endef + +# Below here is fairly generic really + +binary: binary-indep binary-arch + +checkroot: + $(checkdir) + test root = "`whoami`" + +.PHONY: binary binary-arch binary-indep clean checkroot --- set6x86-1.5.orig/debian/copyright +++ set6x86-1.5/debian/copyright @@ -0,0 +1,27 @@ +| Authors: Koen Gadeyne, Richard Hecker +| +| Copyright (C) 1996 Koen Gadeyne, 2005 Richard Hecker +| +| 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 with +| the Debian GNU/Linux distribution in file /usr/share/common-licenses/GPL; +| if not, it can be obtained from the Free Software Foundation, Inc. +| +| On Debian systems, the complete text of the GNU General Public +| License, version 2, can be found in /usr/share/common-licenses/GPL-2. +| +| This package was debianized by Clint Adams on +| Wed, 19 Feb 1997 11:17:24 -0500. + +| It was downloaded from ftp://tsx-11.mit.edu/pub/linux/sources/sbin + + --- set6x86-1.5.orig/debian/examples +++ set6x86-1.5/debian/examples @@ -0,0 +1,2 @@ +rc.cyrix +rc.6x86MX --- set6x86-1.5.orig/debian/set6x86.substvars +++ set6x86-1.5/debian/set6x86.substvars @@ -0,0 +1 @@ +shlibs:Depends=libc6 (>= 2.6-1) --- set6x86-1.5.orig/debian/control +++ set6x86-1.5/debian/control @@ -0,0 +1,20 @@ +Source: set6x86 +Section: utils +Priority: extra +Maintainer: Richard A. Hecker +Standards-Version: 3.7.2 +Build-Depends: debhelper (>=4.1) + +Package: set6x86 +Architecture: kfreebsd-i386 i386 +Depends: ${shlibs:Depends}, ${misc:Depends} +Description:Cyrix/IBM 5x86/6x86 CPU configuration tool + Allows one to modify the internal configuration registers in + the 5x86 and 6x86 CPU. These include specifying non-cacheable + memory areas (important for e.g. graphics cards), I/O delays, + cache write policy (WB/WT), write-gathering, and also enable an + automatic standby mode where a CPU "halt" instruction cuts down + power by a factor of 70 (from 20 Watts to 0.3 Watts for the + 6x86 P133+) when the CPU is idle. Especially the CPU power + reduction cuts down on most temperature-related problems on + many motherboards.