athcool-0.3.12/0000755000000000000000000000000010713610422011720 5ustar rootrootathcool-0.3.12/README0000644000000000000000000000547210202573742012616 0ustar rootrootathcool - control power-saving mode on AMD Athlon/Duron CPUs -------------------------------------------- 1. Introduction -------------------------------------------- athcool is a program that controls the power-saving mode on AMD Athlon/Duron CPUs. Since enabling power-saving mode, you can save power consumption, lower CPU temprature when CPU is idle. athcool only sets/unsets the "Disconnect enable when STPGNT detected" bit in the northbridge of the chipset. To save power, someone has to send the STPGNT signal when the CPU is idle. This is done by the ACPI subsystem when the C2 state is entered. Hence, you need ACPI support in your kernel to achieve power savings. !!!WARNING!!! Depending on your motherboard and/or hardware components, enabling Athlon powersaving mode may cause: * noisy or distorted sound playback * a slowdown in harddisk performance * system locks or instability * massive corruption of the filesystem (rare, but observed at least once) Before use athcool, you must recognize these potential DANGERS. Please use athcool AT YOUR OWN RISK. athcool is supplied "as is". The author disclaims all warranties, expressed or implied. The author and any other persons assume no liability for damages, direct or consequential, which may result from the use of athcool. Osamu Kayasono http://members.jcom.home.ne.jp/jacobi/linux/softwares.html -------------------------------------------- 2. Supported Chipsets -------------------------------------------- VIA KX133 VIA KT133/KM133/KL133/KN133[A] VIA KT266/333[A] VIA KM266 VIA P/KN266 VIA KT400[A]/KM400/KT600 SiS 730/733 SiS 735/740/741/745/755 SiS 746[FX]/748 nVIDIA nForce nVIDIA nForce2 AMD AMD-751/761 (AMD AMD-762) * AMD-762 Chipset has not support HALT disconnect, so Powersaving only enables when S1 or S3 state entered see http://members.jcom.home.ne.jp/jacobi/linux/softwares.html for more information -------------------------------------------- 3. Installation -------------------------------------------- make (become root if necessary) make install Good luck! * required libraries and header files of pciutils, when building athcool. -------------------------------------------- 4. Usage -------------------------------------------- /usr/sbin/athcool [options] supported option: on Enable power-saving mode off Disable power-saving mode stat Quely power-saving mode list List supported chipsets * install and use athcool, you need super user privilege. -------------------------------------------- 5. Related and Useful links -------------------------------------------- * CoolOn Project http://coolon.o-ya.net/ * pciutils http://atrey.karlin.mff.cuni.cz/~mj/pciutils.shtml * Athlon Powersaving HOWTO http://www.daniel.nofftz.net/linux/Athlon-Powersaving-HOWTO.html * LVCool http://vcool.occludo.net/ athcool-0.3.12/scanpci.c0000644000000000000000000000354010164645633013522 0ustar rootroot/* codes from lspci/pciutils * http://atrey.karlin.mff.cuni.cz/~mj/pciutils.shtml */ #include #include #include #include #include #include #include "athcool.h" #define die printf struct pci_filter filter; struct pci_access *pacc; static int show_hex = 0; static struct device *scan_device( struct pci_dev *p ) { int how_much = (show_hex > 2) ? 256 : 64; struct device *d; if ( ! pci_filter_match(&filter, p) ) { return (NULL); } /* d = xmalloc(sizeof(struct device)); */ if ( (d = malloc( sizeof(struct device) )) == NULL ) { return (NULL); } bzero( d, sizeof( *d ) ); d->dev = p; if ( !pci_read_block( p, 0, d->config, how_much ) ) { die( "Unable to read %d bytes of configuration space.", how_much ); } if ( how_much < 128 && (d->config[PCI_HEADER_TYPE] & 0x7f) == PCI_HEADER_TYPE_CARDBUS ) { /* For cardbus bridges, we need to fetch 64 bytes more to get the full standard header... */ if ( !pci_read_block( p, 64, d->config + 64, 64 ) ) { die( "Unable to read cardbus bridge extension data." ); } how_much = 128; } d->config_cnt = how_much; pci_setup_cache( p, d->config, d->config_cnt ); pci_fill_info( p, PCI_FILL_IDENT | PCI_FILL_IRQ | PCI_FILL_BASES | PCI_FILL_ROM_BASE | PCI_FILL_SIZES ); return (d); } struct device *scan_devices( void ) { struct device *d; struct device *first_dev = NULL; struct pci_dev *p; pci_scan_bus( pacc ); for ( p = pacc->devices; p != NULL; p = p->next ) { if ( (d = scan_device( p )) != NULL ) { d->next = first_dev; first_dev = d; } } return (first_dev); } WORD_t get_conf_word(struct device *d, unsigned int pos) { return d->config[pos] | (d->config[pos+1] << 8); } /* End Of File **************************************************************/ athcool-0.3.12/Makefile0000644000000000000000000000240410713610362013363 0ustar rootrootPACKAGE = athcool VERSION = 0.3.12 DESTDIR = prefix = $(DESTDIR)/usr sysconfdir = $(DESTDIR)/etc initdir = $(sysconfdir)/init.d sbindir = $(prefix)/sbin libdir = $(prefix)/lib includedir = $(prefix)/include datadir = $(prefix)/share mandir = $(datadir)/man SRCS = athcool.c scanpci.c OBJS = $(SRCS:.c=.o) CC = gcc RM = rm -f CFLAGS = -O2 -Wall DEFS = -I. -I$(includedir) -DPACKAGE=\"$(PACKAGE)\" -DVERSION=\"$(VERSION)\" #DEFS += -DENABLE_FORCEID=1 #DEFS += -DDISABLE_WRITE_REG=1 LIBS = -lpci ### rules ### .SUFFIXES: .SUFFIXES:.o .c all: $(PACKAGE) $(PACKAGE): $(OBJS) $(CC) $(CFLAGS) $(OBJS) $(LIBS) -o $@ install: install-program install-man # install-script install-program: [ -d $(sbindir) ] || install -m 755 -d $(sbindir) install -s $(PACKAGE) $(sbindir) install-man: [ -d $(mandir)/man8 ] || install -m 755 -d $(mandir)/man8 install -m 644 $(PACKAGE).8 $(mandir)/man8 install-script: [ -d $(initdir) ] || install -m 755 -d $(initdir) install -m 755 athcool.init $(initdir)/athcool .c.o: $(CC) $(CFLAGS) $(DEFS) -c $< -o $@ clean: -$(RM) $(PACKAGE) *.o core *~ a.out test test: scanpci.o test.o $(CC) $(CFLAGS) scanpci.o test.o $(LIBS) -o $@ athcool.o: athcool.c chips.h athcool.h scanpci.o: scanpci.c athcool.h athcool-0.3.12/athcool.80000644000000000000000000000512710101611744013446 0ustar rootroot.TH ATHCOOL 8 "Jul. 27, 2004" .SH NAME athcool \- control power-saving mode on AMD Athlon/Duron CPUs .SH SYNOPSIS \fBathcool\fR \fIcommand\fR .SH DESCRIPTION \fBathcool\fR is a program that controls the power-saving mode on AMD Athlon/Duron CPUs. The parameter \fIcommand\fR is one of: .TP \fBon\fR Enable power-saving mode. .TP \fBoff\fR Disable power-saving mode. .TP \fBstat\fR Query power-saving mode. .TP \fBlist\fR List supported chipsets. .SH WARNINGS athcool only sets/unsets the "Disconnect enable when STPGNT detected" bit in the northbridge of the chipset. To save power, someone has to send the STPGNT signal when the CPU is idle. This is done by the ACPI subsystem when the C2 state is entered. Hence, you need ACPI support in your kernel to achieve power savings. Depending on your motherboard and/or hardware components, enabling power-saving mode may cause: .RS .PP .B * noisy or distorted sound playback, .PP .B * a slowdown in disk performance, .PP .B * system freezes or instability, .PP .B * massive corruption of the filesystem (rare, but observed at least once). .RE .PP Before use athcool, you must recognize these .B potential DANGERS. Please use athcool .B AT YOUR OWN RISK. athcool is supplied "as is". The author disclaims all warranties, expressed or implied. The author and any other persons assume no liability for damages, direct or consequential, which may result from the use of athcool. .SH AUTHOR Copyright (C) 2002-2004 Osamu Kayasono .PP This manual page was written by Nicolas Boullis . And many users reported to me it works (or not). Thanks to all who contributed to athcool. .PP 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. .PP On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL. .SH SEE ALSO For more information about power-saving with Athlon/Duron CPUs, see the Athlon-Powersaving-HOWTO at .IR http://www.daniel.nofftz.net/linux/Athlon-Powersaving-HOWTO.html . athcool-0.3.12/athcool.spec0000644000000000000000000000324110713610362014230 0ustar rootrootSummary: Athlon Powersaving bits enabler Name: athcool Version: 0.3.12 Release: 1 License: GPL Group: Applications/System URL: http://members.jcom.home.ne.jp/jacobi/linux/softwares.html Source: athcool-%{version}.tar.gz BuildPrereq: pciutils-devel Buildroot: /var/tmp/%{name}-root ExclusiveArch: %{ix86} Prereq: /sbin/chkconfig, /sbin/service %description athcool is a small utility, enabling/disabling Powersaving mode for AMD Athlon/Duron processors. Since enabling Powersaving mode, you can save power consumption, lower CPU temprature when CPU is idle. Powersaving works if your kernel support ACPI (APM not work), because athcool only set/unset "Disconnect enable when STPGNT detected" bits in the Northbridge of Chipset. To really save power, someone has to send the STPGNT signal when idle. This is done by the ACPI subsystem when C2 state entered. !!!WARNING!!! Depending on your motherboard and/or hardware components, enabling powersaving mode may cause that: * noisy or distorted sound playback * a slowdown in harddisk performance * system locks or instability * massive filesystem corruption (rare, but observed at least once) If you met those problems, you should not use athcool. Please use athcool AT YOUR OWN RISK. %prep %setup -q %build make %install rm -rf $RPM_BUILD_ROOT #make install DESTDIR=$RPM_BUILD_ROOT %makeinstall %clean rm -rf $RPM_BUILD_ROOT #%post #/sbin/chkconfig --add athcool #%preun #if [ "$1" = "0" ]; then # /sbin/service athcool stop >/dev/null 2>&1 # /sbin/chkconfig --del athcool #fi %files %defattr(-, root, root) %doc README COPYING ChangeLog %{_sbindir}/athcool %{_mandir}/man8/* #%attr(0755,root,root) %{_sysconfdir}/init.d/athcool athcool-0.3.12/athcool.c0000644000000000000000000003372410202573764013540 0ustar rootroot/*************************************************************************** athcool is a program that controls the power-saving mode on AMD Athlon/Duron CPUs. Since enabling power-saving mode, you can save power consumption, lower CPU temprature when CPU is idle. athcool only sets/unsets the "Disconnect enable when STPGNT detected" bit in the northbridge of the chipsets. To save power, someone has to send the STPGNT signal when the CPU is idle. This is done by the ACPI subsystem when the C2 state is entered. Hence, you need ACPI support in your kernel to achieve power savings. !!!WARNING!!! Depending on your motherboard and/or hardware components, enabling Athlon powersaving mode may cause: * noisy or distorted sound playback * a slowdown in harddisk performance * system locks or instability * massive filesystem corruption (rare, but observed at least once) Before use athcool, you must recognize these potential DANGERS. Please use athcool AT YOUR OWN RISK. athcool is supplied "as is". The author disclaims all warranties, expressed or implied. The author and any other persons assume no liability for damages, direct or consequential, which may result from the use of athcool. Osamu Kayasono http://members.jcom.home.ne.jp/jacobi/linux/softwares.html (Related links) * CoolOn Project http://coolon.o-ya.net/ * pciutils http://atrey.karlin.mff.cuni.cz/~mj/pciutils.shtml * Athlon Powersaving HOWTO http://www.daniel.nofftz.net/linux/Athlon-Powersaving-HOWTO.html * LVCool http://vcool.occludo.net/ ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #include #include #include #include #include #include #include #include "athcool.h" #include "chips.h" struct pci_filter filter; struct pci_access *pacc; struct device *scan_devices( void ); LONG_t get_conf_word(struct device *d, unsigned int pos); static void print_title( void ) { printf( PACKAGE " version " VERSION ); printf( " - control power-saving mode on AMD Athlon/Duron CPUs\n\n"); } static void print_warnings( void ) { printf( "!!!WARNING!!!\n"); printf( "Depending on your motherboard and/or hardware components, \n" ); printf( "enabling Athlon powersaving mode may cause:\n" ); printf( " * noisy or distorted sound playback\n" ); printf( " * a slowdown in harddisk performance\n" ); printf( " * system locks or instability\n" ); printf( " * massive filesystem corruption (rare, but observed at least once)\n\n"); printf( "Before use athcool, you must recognize these potential DANGERS.\n"); printf( "Please use athcool AT YOUR OWN RISK.\n\n"); printf( "athcool is supplied \"as is\". The author disclaims all warranties,\n"); printf( "expressed or implied. The author and any other persons assume\n"); printf( "no liability for damages, direct or consequential, which may \n"); printf( "result from the use of athcool.\n\n"); } static void list_chipsets( void ) { AthlonChips_s *p_athlon; printf( " Supported Chipsets:\n" ); printf( "\t[Reg ID] chipsets name\n" ); for ( p_athlon = AthlonChips; p_athlon->name != NULL; p_athlon++ ) { printf( "\t[ 0x%02x ] %s\n", p_athlon->chipreg, p_athlon->name ); } } static void usage( const char *package ) { printf( " Usage: %s option\n", package ); printf( " supported options\n" ); printf( "\ton\t Enable power-saving mode\n" ); printf( "\toff\t Disable power-saving mode\n" ); printf( "\tstat\t Query power-saving mode\n" ); printf( "\tlist\t List supported chipsets\n" ); printf( "\tfixup\t fixup some problems for specific hardwares (EXPERIMENTAL)\n" ); printf( "\t\t (it may cause system locks or instability)\n\n" ); #ifdef ENABLE_FORCEID printf( " %s on|off|stat force RegID\n", package ); printf( "\tmanual specification of chipsets\n" ); printf( "\tDANGEROUS. Must not use this option, unless it is sure\n" ); printf( "\tthat it has same config as your chipsets.\n\n" ); #endif } LONG_t read_reg(struct pci_dev *dev, int tp, int addr) { LONG_t regval = 0; switch (tp) { case TP_BYTE: regval = (LONG_t)pci_read_byte( dev, addr ); break; case TP_WORD: regval = (LONG_t)pci_read_word( dev, addr ); break; case TP_LONG: regval = (LONG_t)pci_read_long( dev, addr ); break; default: printf(" error : unknown reg type \n"); break; } return regval; } int write_reg(struct pci_dev *dev, int tp, int addr, LONG_t regval_cur, LONG_t regval_new) { int res = FALSE; #ifndef DISABLE_WRITE_REG LONG_t regval_after; #endif if (regval_cur != regval_new) { switch (tp) { case TP_BYTE: #ifndef DISABLE_WRITE_REG res = pci_write_byte( dev, addr, (BYTE_t) regval_new ); regval_after = read_reg(dev, tp, addr); if (regval_new != regval_after) { printf( " failed!\n" ); printf( "\tAddress 0x%02X : (expected) 0x%02X -> (actual) 0x%02X\n", addr, regval_new, regval_after ); res = FALSE; } else { #endif printf( " done\n" ); printf( "\tAddress 0x%02X : 0x%02X -> 0x%02X\n", addr, regval_cur, regval_new ); #ifndef DISABLE_WRITE_REG } #endif break; case TP_WORD: #ifndef DISABLE_WRITE_REG res = pci_write_word( dev, addr, (WORD_t)regval_new ); regval_after = read_reg(dev, tp, addr); if (regval_new != regval_after) { printf( " failed!\n" ); printf( "\tAddress 0x%02X - 0x%02X : (expected) 0x%04X -> (actual) 0x%04X\n", addr, addr+1, regval_new, regval_after ); res = FALSE; } else { #endif printf( " done\n" ); printf( "\tAddress 0x%02X - 0x%02X : 0x%04X -> 0x%04X\n", addr, addr+1, regval_cur, regval_new ); #ifndef DISABLE_WRITE_REG } #endif break; case TP_LONG: #ifndef DISABLE_WRITE_REG res = pci_write_long( dev, addr, (LONG_t) regval_new ); regval_after = read_reg(dev, tp, addr); if (regval_new != regval_after) { printf( " failed!\n" ); printf( "\tAddress 0x%02X - 0x%02X : (expected) 0x%08X -> (actual) 0x%08X\n", addr, addr+3, regval_new, regval_after ); res = FALSE; } else { #endif printf( " done\n" ); printf( "\tAddress 0x%02X - 0x%02X : 0x%08X -> 0x%08X\n", addr, addr+3, regval_cur, regval_new ); #ifndef DISABLE_WRITE_REG } #endif break; default: printf(" error : unknown reg type \n"); break; } } else { printf(" already changed\n" ); } return res; } int setAthlonPowersave( int m, int force_id, struct device *first_dev ) { struct device *d = NULL; const char *msg; AthlonChips_s *p_athlon = NULL; ChipReg_s *p_reg; EachReg_s *p_eachreg; LONG_t regval_cur, regval_new; int fixup = FALSE; int addr; if (m & ATHLONPM_FIXUP) { fixup = TRUE; m = m & ~ATHLONPM_FIXUP; } #ifdef ENABLE_FORCEID LONG_t class_id; if (force_id >= 0) { /* search Host Bridge device */ for ( d = first_dev; d != NULL; d= d->next ){ class_id = get_conf_word(d, PCI_CLASS_DEVICE); if (class_id == PCI_CLASS_BRIDGE_HOST ) { printf( "Host Bridge found : %02x:%02x.%x , %04x %04x\n", d->dev->bus, d->dev->dev, d->dev->func, d->dev->vendor_id, d->dev->device_id); break; } /* else { printf( "skipping : %02x:%02x.%x [%04x], %04x %04x\n", d->dev->bus, d->dev->dev, d->dev->func, class_id, d->dev->vendor_id, d->dev->device_id); } */ } if ( d == NULL) { printf( " Host Bridge is not found. exit. \n"); exit (1); } /* search forced Reg ID */ for ( p_reg = ChipReg; p_reg->regs->desc != NULL; p_reg++ ) { if ( p_reg->regid == force_id ) { break; } } printf( " *** disabled auto detection on user request.\n" ); } else { #endif /* search supported chipset */ for ( d = first_dev; d != NULL; d = d->next ) { for ( p_athlon = AthlonChips; p_athlon->name != NULL ; p_athlon++ ) { if ( (d->dev->vendor_id == p_athlon->vendorid) && (d->dev->device_id == p_athlon->deviceid) ) { printf( "%s (%04x %04x) found\n", p_athlon->name, d->dev->vendor_id, d->dev->device_id ); break; } } if ( p_athlon->name != NULL ) { break; } } if ( p_athlon == NULL || p_athlon->name == NULL ) { printf( "no supported Chipset found. nothing changed.\n" ); return 1; } /* search chipset config */ for ( p_reg = ChipReg; p_reg->regs->desc != NULL; p_reg++ ) { if ( p_reg->regid == p_athlon->chipreg ) { break; } } #ifdef ENABLE_FORCEID } #endif if ( p_reg->regs->desc == NULL ) { printf( "internal error." " supported Chipset found," " but Chipset Configuration not found.\n" ); return 1; } /* read current value of register */ for ( p_eachreg = p_reg->regs; p_eachreg->desc != NULL; p_eachreg++ ) { regval_cur = read_reg( d->dev, p_reg->tp, p_eachreg->addr ); switch (m) { case ATHLONPM_STAT: /* begin of checking status */ printf( "'%s' bit is %s.\n", p_eachreg->desc, ( (regval_cur & p_eachreg->bit) == p_eachreg->bit ) ? "enabled" : "disabled" ); break; /* end of checking status */ case ATHLONPM_ON: case ATHLONPM_OFF: /* begin of enabling/disabling bits */ regval_new = regval_cur | p_eachreg->bit; msg = ( m == ATHLONPM_ON ) ? "enabl" : "disabl"; printf( "%sing '%s' bit ... ", msg, p_eachreg->desc ); if ( ((regval_cur == regval_new) && (m == ATHLONPM_ON)) || ((regval_cur != regval_new) && (m == ATHLONPM_OFF)) ) { printf( "already %sed.\n", msg ); break; } if ( m == ATHLONPM_OFF ) { regval_new = regval_cur & ~p_eachreg->bit; } /* write new value into register */ write_reg( d->dev, p_reg->tp, p_eachreg->addr, regval_cur, regval_new); break; /* end of enabling/disabling bits */ } } /* fix something */ if (fixup) { switch (p_reg->regid) { case REGID_VIA_KT133: case REGID_VIA_KT266: case REGID_VIA_KT400: /* fix audio problem for VIA chipsets (0x70 bit 3) */ /* from information provided by Wijatmoko U. Prayitno*/ /* 0.3.5: enable bit3(Enhance CPU to PCI Write?), bit2(PCI Master Read Buffering), bit1(Delay Transaction) (=0x0E) on all VIA platform */ addr = 0x70; regval_cur = pci_read_byte( d->dev, addr ); regval_new = regval_cur | 0x0E; printf( "Fixup for VIA audio problem ... "); write_reg( d->dev, TP_BYTE, addr, regval_cur, regval_new); break; case REGID_NVIDIA_NFORCE2: /* fixup for C1 HALT disconnect problem on nForce2 system */ /* A hang is caused when the CPU generates a very fast CONNECT/HALT cycle sequence. Workaround is to set the SYSTEM_IDLE_TIMEOUT to 80 ns. 'C18D' means nforce2 rev.C1 or greater */ // Chip Old Value New Value // C17 0x1F0FFF01 0x1F01FF01 // C18D 0x9F0FFF01 0x9F01FF01 /* from information provided by Allen Martin. Thanks Herrmann. */ if (m == ATHLONPM_ON) { /* addr = 0x6C; rev = pci_read_byte(d->dev, PCI_REVISION_ID); regval_new = rev < 0xC1 ? 0x1F01FF01 : 0x9F01FF01; regval_cur = pci_read_long(d->dev, addr); printf( "Fixup for C1 HALT disconnect problem ... "); write_reg( d->dev, TP_LONG, addr, regval_cur, regval_new ); */ addr = 0x6e; regval_cur = pci_read_byte(d->dev, addr); regval_new = 0x01; printf( "Fixup for C1 HALT disconnect problem ... "); write_reg( d->dev, TP_BYTE, addr, regval_cur, regval_new ); } else { printf( "nForce2 fixup is needed with 'on' option.\n"); } break; default: printf( "not prepared any fixup.\n"); break; } } return 0; } #ifdef ENABLE_FORCEID int hex2int(char c) { int result; if ( '0' <= c && c <= '9'){ result = c - '0'; } // 0〜9 else if( 'a' <= c && c <= 'f'){ result = c - 'a' + 10; } // a〜f else if( 'A' <= c && c <= 'F'){ result = c - 'A' + 10; } // A〜F else { result = -1; } // Others return result; } int getforceid ( char *idstr ) { int result = -1; int i = 0; if ((idstr[0] == '0') && (idstr[1] == 'x')) i = 2; if (strlen(idstr+i) < 2) { result = hex2int(idstr[i]); } else { result = hex2int(idstr[i]) * 16 + hex2int(idstr[i+1]); } return result; } #endif int main ( int argc, char *argv[] ) { int mode = ATHLONPM_USAGE; int force_id = -1; int fixup = FALSE; int result, c; /* read optarg */ for (c = 1; c < argc; c++ ) { if ( strcmp( argv[c], "on") == 0 ) { mode = ATHLONPM_ON; } else if ( strcmp( argv[c], "off" ) == 0 ) { mode = ATHLONPM_OFF; } else if ( strcmp( argv[c], "fixup" ) == 0 ) { fixup = TRUE; } else if ( strcmp( argv[c], "stat" ) == 0 ) { mode = ATHLONPM_STAT; } else if ( strcmp( argv[c], "list" ) == 0 ) { mode = ATHLONPM_LIST; #ifdef ENABLE_FORCEID } else if ( strcmp( argv[c], "force" ) == 0 ) { c++; if (c < argc) force_id = getforceid( argv[c] ); #endif } } print_title(); switch (mode) { case ATHLONPM_USAGE: usage( argv[0] ); exit (1); case ATHLONPM_LIST: list_chipsets(); exit (1); } if (fixup) { mode |= ATHLONPM_FIXUP; } print_warnings(); if ( iopl( 3 ) < 0 ) { printf( "%s : must run as root. exit\n", argv[0] ); exit (1); } /* init pciutil, and scan devices */ pacc = pci_alloc(); pci_filter_init( pacc, &filter ); pci_init( pacc ); result = setAthlonPowersave( mode, force_id, scan_devices() ); /* clean up, exit */ pci_cleanup( pacc ); return result; } /* End Of File **************************************************************/ athcool-0.3.12/athcool.init0000755000000000000000000000151710004236341014242 0ustar rootroot#!/bin/bash # # athcool This scripts runs athcool, enabling/disabling # powersaving mode for Athlon/Duron processors. # # chkconfig: 2345 10 90 # description: This scripts runs athcool, enabling/disabling \ # powersaving mode for Athlon/Duron processors. PROG=/usr/sbin/athcool RETVAL=$? test -x $PROG || exit 0 case "$1" in start) echo -n "Enabling Athlon powersaving mode..." if $PROG on > /dev/null; then echo "done." else echo "failed." fi ;; stop) echo -n "Disabling Athlon powersaving mode..." if $PROG off > /dev/null; then echo "done." else echo "failed." fi ;; status) echo -n "Query Athlon powersaving mode..." $PROG stat ;; restart|force-reload) $0 stop $0 start ;; *) echo "Usage: /etc/init.d/athcool {start|stop|status|restart|force-reload}" >&2 exit 1 ;; esac exit 0 athcool-0.3.12/COPYING0000644000000000000000000004307007500040150012752 0ustar rootroot GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy 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. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. athcool-0.3.12/init.diff0000644000000000000000000000272510254716755013543 0ustar rootrootdiff -urN athcool-0.3.11.orig/Makefile athcool-0.3.11/Makefile --- athcool-0.3.11.orig/Makefile 2005-06-18 13:03:43.000000000 +0900 +++ athcool-0.3.11/Makefile 2005-06-15 00:11:13.000000000 +0900 @@ -18,7 +18,7 @@ RM = rm -f CFLAGS = -O2 -Wall DEFS = -I. -I$(includedir) -DPACKAGE=\"$(PACKAGE)\" -DVERSION=\"$(VERSION)\" -#DEFS += -DENABLE_FORCEID=1 +DEFS += -DENABLE_FORCEID=1 #DEFS += -DDISABLE_WRITE_REG=1 LIBS = -lpci @@ -32,7 +32,7 @@ $(PACKAGE): $(OBJS) $(CC) $(CFLAGS) $(OBJS) $(LIBS) -o $@ -install: install-program install-man # install-script +install: install-program install-man install-script install-program: [ -d $(sbindir) ] || install -m 755 -d $(sbindir) diff -urN athcool-0.3.11.orig/athcool.spec athcool-0.3.11/athcool.spec --- athcool-0.3.11.orig/athcool.spec 2005-06-18 13:04:10.000000000 +0900 +++ athcool-0.3.11/athcool.spec 2005-06-18 13:02:42.000000000 +0900 @@ -50,19 +50,19 @@ %clean rm -rf $RPM_BUILD_ROOT -#%post -#/sbin/chkconfig --add athcool +%post +/sbin/chkconfig --add athcool -#%preun -#if [ "$1" = "0" ]; then -# /sbin/service athcool stop >/dev/null 2>&1 -# /sbin/chkconfig --del athcool -#fi +%preun +if [ "$1" = "0" ]; then + /sbin/service athcool stop >/dev/null 2>&1 + /sbin/chkconfig --del athcool +fi %files %defattr(-, root, root) %doc README COPYING ChangeLog %{_sbindir}/athcool %{_mandir}/man8/* -#%attr(0755,root,root) %{_sysconfdir}/init.d/athcool +%attr(0755,root,root) %{_sysconfdir}/init.d/athcool athcool-0.3.12/chips.h0000644000000000000000000001307210713610362013205 0ustar rootroot#include typedef struct { WORD_t vendorid; WORD_t deviceid; int chipreg; const char *name; } AthlonChips_s; typedef struct { const char *desc; int addr; LONG_t bit; } EachReg_s; typedef struct { int regid; int tp; EachReg_s regs[3]; } ChipReg_s; #define VENDORID_AMD 0x1022 #define VENDORID_VIA 0x1106 #define VENDORID_SIS 0x1039 #define VENDORID_NVIDIA 0x10DE #define REGID_AMD_751 0x00 #define REGID_AMD_762 0x01 #define REGID_VIA_KT133 0x10 #define REGID_VIA_KT266 0x11 #define REGID_VIA_KT400 0x12 #define REGID_VIA_KT880 0x13 #define REGID_SIS_730 0x20 #define REGID_SIS_735 0x21 #define REGID_SIS_746 0x22 #define REGID_NVIDIA_NFORCE1 0x30 #define REGID_NVIDIA_NFORCE2 0x31 /* VendorID, DeviceID, ChipReg number, Name strings */ static AthlonChips_s AthlonChips[] = { /* AMD chipset ---------------------------------------------------------*/ /* AMD 751 */ { VENDORID_AMD, 0x7006, REGID_AMD_751, "AMD-751" }, { VENDORID_AMD, 0x700E, REGID_AMD_751, "AMD-761" }, { VENDORID_AMD, 0x700C, REGID_AMD_762, "AMD-762" }, /* VIA Chipset --------------------------------------------------------*/ /* VIA VT8371 */ { VENDORID_VIA, 0x0391, REGID_VIA_KT133, "VIA KX133" }, { VENDORID_VIA, 0x0691, REGID_VIA_KT133, "VIA KX133" }, /* VIA VT8361 */ { VENDORID_VIA, 0x3112, REGID_VIA_KT133, "VIA KLE133" }, /* VIA VT8363/8365/8364/8362[A] */ { VENDORID_VIA, 0x0305, REGID_VIA_KT133, "VIA KT133/KM133/KL133/KN133[A]" }, /* VIA VT8366 */ { VENDORID_VIA, 0x3099, REGID_VIA_KT266, "VIA KT266/333[A]" }, /* VIA VT8375 */ { VENDORID_VIA, 0x3116, REGID_VIA_KT266, "VIA KM266[A]/KL266/KM333" }, { VENDORID_VIA, 0x3156, REGID_VIA_KT266, "VIA KN266" }, /* VIA VT8368 */ { VENDORID_VIA, 0x3189, REGID_VIA_KT400, "VIA KT400[A]/KT600" }, /* VIA VT8378 */ { VENDORID_VIA, 0x3205, REGID_VIA_KT400, "VIA KM400[A]" }, /* VIA KT880 (function 2) */ { VENDORID_VIA, 0x2269, REGID_VIA_KT880, "VIA KT880" }, /* SiS Chipset ----------------------------------------------------------*/ /* SiS 730/733 */ { VENDORID_SIS, 0x0730, REGID_SIS_730, "SiS 730" }, { VENDORID_SIS, 0x0733, REGID_SIS_730, "SiS 733" }, /* SiS 735 or later */ { VENDORID_SIS, 0x0735, REGID_SIS_735, "SiS 735" }, { VENDORID_SIS, 0x0740, REGID_SIS_735, "SiS 740" }, { VENDORID_SIS, 0x0745, REGID_SIS_735, "SiS 745" }, { VENDORID_SIS, 0x0755, REGID_SIS_735, "SiS 755" }, /* SiS 746 or later */ { VENDORID_SIS, 0x0746, REGID_SIS_746, "SiS 746[FX]" }, { VENDORID_SIS, 0x0741, REGID_SIS_746, "SiS 741/741GX/M741" }, { VENDORID_SIS, 0x0748, REGID_SIS_746, "SiS 748" }, /* nVIDIA chipset -----------------------------------------------------*/ /* nForce */ { VENDORID_NVIDIA, 0x01a4, REGID_NVIDIA_NFORCE1, "nVIDIA nForce" }, /* nForce2 */ { VENDORID_NVIDIA, 0x01e0, REGID_NVIDIA_NFORCE2, "nVIDIA nForce2" }, /* End Mark */ { 0, 0, 0, NULL } }; static ChipReg_s ChipReg[] = { /* AMD chipset ----------------------------------------------------------*/ #if 0 /* use WORD instead of LONG (0.3.10) */ /* AMD AMD-751/761 */ { REGID_AMD_751, TP_LONG, { {"Halt Disconnect and Stop Grant Disconnect", 0x60, 0x00060000}, {NULL, 0, 0 } } }, /* AMD AMD-762 */ { REGID_AMD_762, TP_LONG, { {"Halt Disconnect and Stop Grant Disconnect #0", 0x60, 0x00060000}, {"Halt Disconnect and Stop Grant Disconnect #1", 0x68, 0x00060000}, {NULL, 0, 0 } } }, #else /* AMD AMD-751/761 */ { REGID_AMD_751, TP_WORD, { {"Halt Disconnect and Stop Grant Disconnect", 0x62, 0x0006}, {NULL, 0, 0 } } }, /* AMD AMD-762 */ { REGID_AMD_762, TP_WORD, { {"Halt Disconnect and Stop Grant Disconnect #0", 0x62, 0x0006}, {"Halt Disconnect and Stop Grant Disconnect #1", 0x6a, 0x0006}, {NULL, 0, 0 } } }, #endif /* VIA Chipset ---------------------------------------------------------*/ /* VIA KX/KLE/KT/KM/KL/KN133[A] */ { REGID_VIA_KT133, TP_BYTE, { {"Disconnect when STPGNT Detected", 0x52, 0x80}, {NULL, 0, 0 } } }, /* VIA KT/KM/266/333[A] */ { REGID_VIA_KT266, TP_BYTE, { {"Disconnect when STPGNT Detected", 0x92, 0x80}, {"HALT Command Detection", 0x95, 0x02}, {NULL, 0, 0 } } }, /* VIA VT8368 */ { REGID_VIA_KT400, TP_BYTE, { {"Disconnect when STPGNT Detected", 0xD2, 0x80}, {"HALT Command Detection", 0xD5, 0x02}, {NULL, 0, 0 } } }, /* VIA KT880 */ { REGID_VIA_KT880, TP_BYTE, { {"Disconnect when STPGNT Detected", 0x82, 0x80}, {"HALT Command Detection", 0x85, 0x02}, {NULL, 0, 0 } } }, /* SiS Chipset ---------------------------------------------------------*/ /* SiS 730/733 */ { REGID_SIS_730, TP_BYTE, { {"ACPI C1 Disconnect Enable", 0x6B, 0x01}, {NULL, 0, 0 } } }, /* SiS 735/740/745/755 */ { REGID_SIS_735, TP_WORD, { {"ACPI C1 Disconnect Enable", 0x6A, 0x0001}, {NULL, 0, 0 } } }, /* SiS 746 or later */ { REGID_SIS_746, TP_WORD, { {"ACPI C1 Disconnect Enable", 0x6C, 0x0001}, {NULL, 0, 0 } } }, /* nVIDIA chipset -----------------------------------------------------*/ /* nForce */ { REGID_NVIDIA_NFORCE1, TP_WORD, { /* {"Self-reflesh enable", 0x6C, 0x8000}, */ {"Halt Disconnect and Stop Grant Disconnect", 0xE6, 0x0600 }, {NULL, 0, 0 } } }, /* nForce2 */ { REGID_NVIDIA_NFORCE2, TP_BYTE, { {"Halt Disconnect and Stop Grant Disconnect", 0x6F, 0x10}, {NULL, 0, 0 } } }, /* end mark */ { 0, 0, { {NULL, 0, 0} } } }; /* End Of File **************************************************************/ athcool-0.3.12/ChangeLog0000644000000000000000000000552510713610414013502 0ustar rootroot2007-11-05 * Released as 0.3.12 * fix freeze problem on SiS741 series chipsets (I cannot test, but it seemed to work. Thanks Aisenbrey and Gajownik) 2005-06-18 * Released as 0.3.11 * replace 'Copyright' to 'License' in athcool.spec 2005-02-19 * Released as 0.3.10 * use TP_WORD instead of TP_LONG (for AMD-751/761/762) TP_LONG (32bit addressing) didn't work? (Thanks Lorenz) * add 'Halt Disconnect' support on AMD-762 (Thanks Lorenz) * 'Coolon' web site was moved 2004-12-31 * Released as 0.3.9 * fix compilation problem with Fedora Core 3 * rewrite 'read & write register' - check register value after writing 2004-09-04 * Released as 0.3.8 * add VIA KT880 support (Thanks Rjeousski) * rewrite WARNING messages I received a bug report that hard disk was massively corrupted when tried athcool on ASUS L3350M (SiS 740 based laptop). * rewrite manpage (Thanks Boullis) 2004-06-26 * Released as 0.3.7 * add SiS 741 support (Thanks Bezerra) 2004-06-12 * Released as 0.3.6 * fix nforce2 fixup value (Thanks Nakamura) 2004-05-15 * Released as 0.3.5 * add 'fixup' option (EXPERIMENTAL) - fixup nForce2 C1 HALT disconnect problem (Thanks Herrmann) - fixup VIA audio problem Address 0x70: bit3(Enhance CPU to PCI Write?), bit2(PCI Master Read Buffering), bit1(Delay Transaction) on all VIA platform * fix a bug in forceid (Thanks Boullis) 2004-04-24 * Released as 0.3.4 * add fixup audio function for VIA chipsets (Thanks Prayitno) 2004-01-24 * Released as 0.3.3 * add VIA P/KN266 support (Thanks Schachtschabel) * clean up Makefile etc. * add init.d script (not installed by default) (experimental. You should check working athcool fine, before enabling init.d script) * add manual specification of chipsets (disabled by default) athcool on|off|stat force RegID DANGEROUS. Must not use this option, unless it is sure that it has same config as your chipsets. 2003-12-20 * Released as 0.3.2 * add KM400 support (Thanks mikell) * add simple man page 2003-09-23 * Released as 0.3.1 * add WARNING message * add 'DESTDIR' variable in Makefile * merge Zuckschwerdt's patch (Thanks Zuckschwerdt) - fix compilation problem with gcc-3.3 2003-06-21 * Released as 0.3.0 * add SiS 748 support (not tested) * display values before and after changing the register * merge Nakata's patch (Thanks Nakata) ( http://www.nakata-jp.org/ [ written in Japanese ]) - fix bug which may fail in recognition of a chipset - clean up whole codes for improving readability and removing hidden bugs 2003-03-01 * Released as 0.2.0 * add listing supported chipsets * add nVIDIA nForce/nForce2 support (not tested) * separate Chipset ID and Register configuration (because some chipsets has different ID, but same config) 2002-10-12 * Released as 0.1.1 * fix a bug (cannot disable powersaving) athcool-0.3.12/athcool.h0000644000000000000000000000201010164645413013523 0ustar rootroot#define TP_BYTE 1 #define TP_WORD 2 #define TP_LONG 4 #define TRUE 1 #define FALSE 0 #define B8(y) ( ((0x##y##L & 0x00000001L) >> 0) \ | ((0x##y##L & 0x00000010L) >> 3) \ | ((0x##y##L & 0x00000100L) >> 6) \ | ((0x##y##L & 0x00001000L) >> 9) \ | ((0x##y##L & 0x00010000L) >> 12) \ | ((0x##y##L & 0x00100000L) >> 15) \ | ((0x##y##L & 0x01000000L) >> 18) \ | ((0x##y##L & 0x10000000L) >> 21) ) #define ATHLONPM_USAGE 0x00 #define ATHLONPM_ON B8(00000001) #define ATHLONPM_OFF B8(00000010) #define ATHLONPM_STAT B8(00000100) #define ATHLONPM_LIST B8(00001000) #define ATHLONPM_FIXUP B8(00010000) #define BYTE_t u8 // uint8_t #define WORD_t u16 //uint16_t #define LONG_t u32 //uint32_t struct device { struct device *next; struct pci_dev *dev; unsigned int config_cnt; int8_t config[256]; }; /* End Of File **************************************************************/ athcool-0.3.12/test.c0000644000000000000000000000262707733620430013062 0ustar rootroot#include #include #include #include #include #include #include "athcool.h" extern struct pci_filter filter; extern struct pci_access *pacc; extern struct device *scan_devices( void ); #define B8(y) ( ((0x##y##L & 0x00000001L) >> 0) \ | ((0x##y##L & 0x00000010L) >> 3) \ | ((0x##y##L & 0x00000100L) >> 6) \ | ((0x##y##L & 0x00001000L) >> 9) \ | ((0x##y##L & 0x00010000L) >> 12) \ | ((0x##y##L & 0x00100000L) >> 15) \ | ((0x##y##L & 0x01000000L) >> 18) \ | ((0x##y##L & 0x10000000L) >> 21) ) #define B16(h,l) (B8(h)<<8 | B8(l)) #define B32(hh, hl, lh, ll) (B16(hh, hl)<<16 | B16(lh, ll)) #define TESTBIN32 B32(00000110,00000000,00000000,00000000) /* bit 25 and 26 */ int main ( int argc, char *argv[] ) { struct device *d = NULL; int regval_cur; /* printf("0x%08x\n", TESTBIN32); return 0; */ if ( iopl( 3 ) < 0 ) { printf( "%s : must run as root. exit\n", argv[0] ); exit (1); } /* init pciutil, and scan devices */ pacc = pci_alloc(); pci_filter_init( pacc, &filter ); pci_init( pacc ); d = scan_devices(); regval_cur = pci_read_long( d->dev, 0x60 ); printf( "reg values in 0x%02X to 0x%02X : 0x%08x\n", 0x60, 0x63, regval_cur); /* clean up, exit */ pci_cleanup( pacc ); return 0; }