[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#641863: athcool on GNU/Hurd: iopl



Package: athcool
Tags: patch
User: debian-hurd@lists.debian.org
Usertags: hurd
X-Debbugs-CC: debian-hurd@lists.debian.org, Osamu Kayasono <jacobi@jcom.home.ne.jp>
thanks


Hi!

Debian GNU/Hurd folks: why do I have to specify Hurd
User/Usertags/X-Debbugs-CC, all three?  Can't this be made simpler?
(This is from
<http://www.gnu.org/software/hurd/hurd/running/debian/patch_submission.html>.)


Some months ago, I already sent this to Osamu Kayasono, athcool upstream,
<http://members.jcom.home.ne.jp/jacobi/linux/softwares.html> (but no
response yet).  Now re-posting for Debian.

On Mon, 23 May 2011 19:37:01 +0200, I wrote:
> I have a system with a K7VTA3 motherboard (Athlon XP 1700), where I want
> to run athcool.  In idle mode, this reduces the power consumption from
> 125 W to only 73 W!  This is a dual-boot system for Debian GNU/Linux and
> Debian GNU/Hurd.  I'm seeing the same power saving effect with both
> configurations.
> 
> I used to have some manual hackery in the init scripts, but now I found
> there is a Debian athcool package, and your upstream package, which is
> better than my manual setpci commands.
> 
> Result (same on GNU/Linux and GNU/Hurd):
> 
>     VIA KT266/333[A] (1106 3099) found
>     enabling 'Disconnect when STPGNT Detected' bit ...  done
>             Address 0x92 : 0x6B -> 0xEB
>     enabling 'HALT Command Detection' bit ...  done
>             Address 0x95 : 0x1C -> 0x1E
> 
> (These are the same changes I've been manually doing with setpci.)
> 
> As it is not implemented on GNU/Hurd (and there is no need to), I removed
> the iopl call from your code.  This is not actually needed: libpci will
> itself error out if it doesn't have sufficient permission.  Additionally,
> I added comments to the athcool help screen and its manpage.  Is that
> change OK for you to add?

diff -u ../athcool-0.3.12.orig/ChangeLog athcool-0.3.12/ChangeLog
--- ../athcool-0.3.12.orig/ChangeLog	2007-11-05 13:48:12.000000000 +0100
+++ athcool-0.3.12/ChangeLog	2011-05-23 18:47:28.000000000 +0200
@@ -1,3 +1,7 @@
+2011-05-23  Thomas Schwinge  <thomas@schwinge.name>
+
+	* Remove iopl calls.
+
 2007-11-05
  * Released as 0.3.12
  * fix freeze problem on SiS741 series chipsets
diff -u ../athcool-0.3.12.orig/athcool.8 athcool-0.3.12/athcool.8
--- ../athcool-0.3.12.orig/athcool.8	2004-07-28 04:48:04.000000000 +0200
+++ athcool-0.3.12/athcool.8	2011-05-23 18:54:27.000000000 +0200
@@ -23,6 +23,10 @@
 \fBlist\fR
 List supported chipsets.
 
+.PP
+\fBathcool\fR needs to be run with permissions appropriate to access the PCI
+configuration space.
+
 .SH WARNINGS
 athcool only sets/unsets the "Disconnect enable when STPGNT detected"
 bit in the northbridge of the chipset.
diff -u ../athcool-0.3.12.orig/athcool.c athcool-0.3.12/athcool.c
--- ../athcool-0.3.12.orig/athcool.c	2005-02-10 06:58:12.000000000 +0100
+++ athcool-0.3.12/athcool.c	2011-05-23 18:59:06.000000000 +0200
@@ -58,7 +58,6 @@
 #include <unistd.h>
 #include <stdio.h>
 #include <stdint.h>
-#include <sys/io.h>
 #include <string.h>
 #include <pci/pci.h>
 #include  "athcool.h"
@@ -121,6 +120,9 @@
   printf( "\tDANGEROUS. Must not use this option, unless it is sure\n" );
   printf( "\tthat it has same config as your chipsets.\n\n" );
 #endif
+
+  printf( "athcool needs to be run with permissions appropriate to access\n");
+  printf( "the PCI configuration space.\n\n");
 }
 
 LONG_t read_reg(struct pci_dev *dev, int tp, int addr)
@@ -466,11 +468,6 @@
 
   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 );
diff -u ../athcool-0.3.12.orig/scanpci.c athcool-0.3.12/scanpci.c
--- ../athcool-0.3.12.orig/scanpci.c	2004-12-30 01:28:11.000000000 +0100
+++ athcool-0.3.12/scanpci.c	2011-05-23 18:45:40.000000000 +0200
@@ -4,7 +4,6 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <stdio.h>
-#include <sys/io.h>
 #include <string.h>
 #include <pci/pci.h>
 #include "athcool.h"
diff -u ../athcool-0.3.12.orig/test.c athcool-0.3.12/test.c
--- ../athcool-0.3.12.orig/test.c	2003-09-22 18:19:36.000000000 +0200
+++ athcool-0.3.12/test.c	2011-05-23 18:44:44.000000000 +0200
@@ -1,7 +1,6 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <stdio.h>
-#include <sys/io.h>
 #include <string.h>
 #include <pci/pci.h>
 #include  "athcool.h"
@@ -34,11 +33,6 @@
   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 );


Grüße,
 Thomas

Attachment: pgpsmHJ9E5saC.pgp
Description: PGP signature


Reply to: