Subject: Re: Driver for AMD K7 POWERNOW
To: Sergio Jimenez <tripledes@eslack.org>
From: netbsd <netbsd@purk.ee>
List: current-users
Date: 07/17/2004 09:26:59
Hi,

I applyed this patch successfully and what i don't have is powernow:)
Evene this BROKEN stuff didn't help on HP/Compaq nx9005.This mashine
does have worst BIOS that i've ever seen.It works under winxp as
expected so there must be a way to get it running on NetBSD.

Any help will greatly welcome!

NetBSD 2.0G (pnowK7-2) #0: Fri Jul 16 23:55:16 EEST 2004
        argo@hp:/usr/src/sys/arch/i386/compile/pnowK7-2
total memory = 446 MB
avail memory = 429 MB
BIOS32 rev. 0 found at 0xfd730
mainbus0 (root)
cpu0 at mainbus0: (uniprocessor)
cpu0: AMD Athlon XP2600+ (686-class), 1987.83 MHz, id 0x6a0
cpu0: features c3cbf9ff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR>
cpu0: features c3cbf9ff<PGE,MCA,CMOV,PAT,PSE36,MPC,MMXX,MMX>
cpu0: features c3cbf9ff<FXSR,SSE,3DNOW2,3DNOW>
cpu0: "mobile AMD Athlon(tm) XP2600+"
cpu0: I-cache 64 KB 64B/line 2-way, D-cache 64 KB 64B/line 2-way
cpu0: L2 cache 512 KB 64B/line 16-way
cpu0: ITLB 16 4 KB entries fully associative, 8 4 MB entries fully
associative
cpu0: DTLB 32 4 KB entries fully associative, 8 4 MB entries 4-way
cpu0: 8 page colors
acpi0 at mainbus0
acpi0: using Intel ACPI CA subsystem version 20040211
acpi0: X/RSDT: OemId <PTLTD ,  RSDT  ,06040000>, AslId < LTP,00000000>
acpi0: SCI interrupting at int 9
acpi0: fixed-feature power button present
ACPI Object Type 'Processor' (0x0c) at acpi0 not configured




On Fri, 2004-07-16 at 19:38, Sergio Jimenez wrote:
> On Fri, Jul 16, 2004 at 08:33:16PM +0100, Sergio Jimenez wrote:
> > On Mon, Jul 12, 2004 at 08:14:42PM +0100, Sergio Jimenez wrote:
> > > >
> > > >Hi,
> > > >
> > > >I have written a driver for AMD's POWERNOW function on K7 CPUs. It
> > > >enables CPU frequency scaling which allows laptops with AMD K7 CPUs to
> > > >have longer battery life and stay cool.
> > > >
> > > >http://www.amd.com/us-en/Processors/ProductInformation/0,,30_118_10220_10221%5E964,00.html
> > > >
> > > >I have made it compatible to i386/est.c (Intel SpeedStep) sysctl's
> > > >interface.
> > > >
> > > 
> > > After a little work to apply the patch successfully, it seems to be
> > > working. I've compiled a kernel using the max and min frequencies
> > > allowed by my laptop and the times are quite differents:
> > > 
> > > - 500MHz
> > > 
> > > 	# time ./build.sh kernel=GENERIC
> > > 	...
> > > 	1760.88s real 1594.39s user 175.95s system
> > > 
> > > - 1400MHz
> > > 	
> > > 	# time ./build.sh kernel=GENERIC
> > > 	...
> > > 	777.60s real 654.42s user 125.30s system
> > > 
> > > * After the first built I rebooted the box.
> > > 
> > > - Machine:
> > > 
> > > Acer Aspire 1300
> > > mobile AMD Athlon XP 1600+
> > > machdep.powernow.frequency.available = 500 600 700 900 1000 1100 1200
> > > 1400
> > > 
> > > The lastest bios revision (3A71) for this serie from Acer has a bogus pst table
> > > and less frequencies are allowed.
> > > 
> > > Thanks for the patch :)
> > 
> > Here I attached a working patch with a bug fixed.
> > Also I'd like to explain how to get this working with a bogus bios,
> > because some bioses return 0x780 as a cpuid and this driver needs 0x680,
> > so if this is your case add this to pnow_k7.c:
> > 
> > --- pnow_k7.c.orig      Fri Jul 16 20:29:50 2004
> > +++ pnow_k7.c   Fri Jul 16 20:30:41 2004
> > @@ -40,6 +40,7 @@
> >  #include <machine/cpu.h>
> >  #include <machine/isa_machdep.h>
> >  
> > +#define BROKEN                 0x780
> >  #define BIOS_START             0xe0000
> >  #define BIOS_END               0xFFFFF
> >  #define BIOS_LEN               BIOS_END - BIOS_START
> > @@ -170,7 +171,7 @@
> >                                 ptr += sizeof(struct pst_s);
> >                                 
> >                                 /* Use the first PST with matching CPUID
> >  * */
> > -                               if (cpuid == pst->cpuid)
> > +                               if (cpuid == pst->cpuid || BROKEN ==
> > pst->cpuid)
> >                                 {
> >                                         /*
> >                                          * XXX I need more info on this.
> > 
> > This was recommended by the patch author :)
> 
> Sorry wrong patch. :)
> 
> Cheers,
> Sergio