Re: powernow not working on AMD Athlon XP Mobile

2011-09-15 Thread Maurizio Lombardi
Hi Sepherosa,

> Well, I think I will need AMD 06h family BKDG to figure out how the
> ACPI VID and FID should be used.  The code we have messed w/ so far is
> according to AMD 0fh family BKDG.

I'm doing some research and looking how other operating systems works
with my Athlon XP-M processor.

1) The DFly's powernow driver is almost identical to the NetBSD's
powernow_k8 driver (NetBSD has a powernow_k7 driver too) , probably
this is the reason why on DFly the powernow module returns an error
message when I try to load it, it simply does not support K7
architectures.

2) On FreeBSD: sys/x86/cpufreq/hwpstate.c

Looks like my CPU family (0x06) is not supported:


did = AMD_10H_11H_CUR_DID(msr);
fid = AMD_10H_11H_CUR_FID(msr);
switch(family) {
case 0x11:
/* fid/did to frequency */
hwpstate_set[i].freq = 100 * (fid + 0x08) / (1 << did);
break;
case 0x10:
/* fid/did to frequency */
hwpstate_set[i].freq = 100 * (fid + 0x10) / (1 << did);
break;
default:
HWPSTATE_DEBUG(dev, "get_info_from_msr: AMD family %d CPU's are not
implemented yet. sorry.\n", family);
return (ENXIO);
break;
}

---

But in their powernow driver my cpu family *is* supported:

sys/x86/cpufreq/powernow.c
--

switch (cpu_id & 0xf00) {
case 0x600:
sfid = PN7_STA_SFID(status);
mfid = PN7_STA_MFID(status);
cfid = PN7_STA_CFID(status);
sc->pn_type = PN7_TYPE;
sc->fsb = rate / 10 / pn7_fid_to_mult[cfid];

/*
 * If start FID is different to max FID, then it is a
 * mobile processor.  If not, it is a low powered desktop
 * processor.
 */
if (PN7_STA_SFID(status) != PN7_STA_MFID(status)) {
sc->vid_to_volts = pn7_mobile_vid_to_volts;
device_set_desc(dev, "PowerNow! K7");
} else {
sc->vid_to_volts = pn7_desktop_vid_to_volts;
device_set_desc(dev, "Cool`n'Quiet K7");
}
break;
---


Cheers,

-- 

Maurizio Lombardi



Re: powernow not working on AMD Athlon XP Mobile

2011-09-14 Thread Sepherosa Ziehau
On Thu, Sep 15, 2011 at 4:13 AM, Maurizio Lombardi
 wrote:
>> You could try to set hw.acpi.cpu.pstate.strigent_check=0 in 
>> /boot/loader.conf. My K8 box needs that for it's messed up FID/VID.
>>
>
> Thanks,
>
> I tried but the kernel freezes at boot.
>
> It prints a lot of error like:
>
> "cpu0: Invalid FID"
> "cpu0: Invalid VID..."
>
> The last two lines it prints are a bit different:
>
> "cpu0: min VID mismatch real 9, lim 11"
> "cpu0: min FID mismatch real 50, lim 6"

Well, I think I will need AMD 06h family BKDG to figure out how the
ACPI VID and FID should be used.  The code we have messed w/ so far is
according to AMD 0fh family BKDG.

Best Regards,
sephe

-- 
Tomorrow Will Never Die


Re: powernow not working on AMD Athlon XP Mobile

2011-09-14 Thread Maurizio Lombardi
> You could try to set hw.acpi.cpu.pstate.strigent_check=0 in 
> /boot/loader.conf. My K8 box needs that for it's messed up FID/VID.
>

Thanks,

I tried but the kernel freezes at boot.

It prints a lot of error like:

"cpu0: Invalid FID"
"cpu0: Invalid VID..."

The last two lines it prints are a bit different:

"cpu0: min VID mismatch real 9, lim 11"
"cpu0: min FID mismatch real 50, lim 6"

Cheers,


-- 

Maurizio Lombardi


Re: powernow not working on AMD Athlon XP Mobile

2011-09-14 Thread Max Herrgard
On 14 sep 2011, at 20.45, Maurizio Lombardi wrote
>> Ok.  Remove the old patch and try this one:
>> http://leaf.dragonflybsd.org/~sephe/pstate.c.diff1
> 
> Thanks for your support Sepherosa, but unfortunately it still does not work.
> 
> The last patch triggered others errors like the following:
> cpu0: Invalid FID 0x20, out [0xe, 0x16]
> cpu0: Invalid VID 0x6, in [0xd, 0xb]


You could try to set hw.acpi.cpu.pstate.strigent_check=0 in /boot/loader.conf. 
My K8 box needs that for it's messed up FID/VID.

See http://bugs.dragonflybsd.org/issue2025


cheers,
Max


Re: powernow not working on AMD Athlon XP Mobile

2011-09-14 Thread Maurizio Lombardi
> Ok.  Remove the old patch and try this one:
> http://leaf.dragonflybsd.org/~sephe/pstate.c.diff1

Thanks for your support Sepherosa, but unfortunately it still does not work.

The last patch triggered others errors like the following:
cpu0: Invalid FID 0x20, out [0xe, 0x16]
cpu0: Invalid VID 0x6, in [0xd, 0xb]

I modified your patch to force the kernel to ignore those errors:
http://www.dotter.it/~maurizio/acpic5.diff

But the kernel freezes at boot when it tries to initialize the cpu driver


-- 

Maurizio Lombardi



Re: powernow not working on AMD Athlon XP Mobile

2011-09-13 Thread Sepherosa Ziehau
On Wed, Sep 14, 2011 at 5:25 AM, Maurizio Lombardi
 wrote:
>> Try following patch:
>> http://leaf.dragonflybsd.org/~sephe/pstate_machdep.c.diff
>>
>> See whether following sysctl appears:
>> hw.acpi.cpu.px_dom0.select
>
> I applied your patch and rebuild the kernel.
>
> Unfortunately it does not work:
>
> #sysctl -a | grep px
> #
>
> Now it does not print anything at all!
> Any ideas?

Ok.  Remove the old patch and try this one:
http://leaf.dragonflybsd.org/~sephe/pstate.c.diff1

>
> However, full dmesg attached.
>
> --
> 
> Maurizio Lombardi
>



-- 
Tomorrow Will Never Die


Re: powernow not working on AMD Athlon XP Mobile

2011-09-13 Thread Maurizio Lombardi
> Try following patch:
> http://leaf.dragonflybsd.org/~sephe/pstate_machdep.c.diff
>
> See whether following sysctl appears:
> hw.acpi.cpu.px_dom0.select

I applied your patch and rebuild the kernel.

Unfortunately it does not work:

#sysctl -a | grep px
#

Now it does not print anything at all!
Any ideas?

However, full dmesg attached.

-- 

Maurizio Lombardi
Copyright (c) 2003-2011 The DragonFly Project.
Copyright (c) 1992-2003 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
madt_probe: can't locate MADT
DragonFly v2.11.0.836.g3ddc3-DEVELOPMENT #0: Tue Sep 13 22:48:33 UTC 2011
root@:/usr/obj/usr/src/sys/LMB
TSC clock: 1855182810 Hz, i8254 clock: 1193179 Hz
CPU: mobile AMD Athlon(tm) XP2500+ (1855.20-MHz 686-class CPU)
  Origin = "AuthenticAMD"  Id = 0x6a0  Stepping = 0
  
Features=0x383f9ff
  AMD Features=0xc0480800
real memory  = 526972928 (502 MB)
avail memory = 494817280 (471 MB)
LAPIC: Can't find LAPIC
module_register: module pci/ahci already exists!
Module pci/ahci failed to register: 17
FQ scheduler policy version 1.1 loaded
kbd0 at kbdmux0
disk scheduler: set policy of md0 to noop
md0: Malloc disk
ACPI: RSDP 0xf7290 00014 (v0 PTLTD )
ACPI: RSDT 0x1f6f8b67 00030 (v1 PTLTDRSDT   0604  LTP )
ACPI: FACP 0x1f6fee2b 00074 (v1 ATIRaptor   0604 ATI  000F4240)
ACPI: DSDT 0x1f6f8b97 06294 (v1ATI U1_M1535 0604 MSFT 010D)
ACPI: FACS 0x1f6fffc0 00040
ACPI: BOOT 0x1f6fee9f 00028 (v1 PTLTD  $SBFTBL$ 0604  LTP 0001)
ACPI: SSDT 0x1f6feec7 00139 (v1 PTLTD  POWERNOW 0604  LTP 0001)
npx0:  on motherboard
npx0: INT 16 interface
Using MMX optimized bcopy/copyin/copyout
cryptosoft0:  on motherboard
acpi0:  on motherboard
ACPI FADT: SCI testing interrupt mode ...
ACPI FADT: SCI select level/low
objcache_reclaimlist
objcache_reclaimlist
objcache_reclaimlist
objcache_reclaimlist
acpi0: Power Button (fixed)
Warning: ACPI is disabling APM's device.  You can't run both
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
acpi_timer0: <32-bit timer at 3.579545MHz> port 0x8008-0x800b on acpi0
acpi_ec0:  port 0x66,0x62 on acpi0
[ACPI Debug]  String [0x1C] "THERM: _Q80 - Thermal Change"
[ACPI Debug]  String [0x16] "Notify _TZ.THRM , 0x80"
pcib0:  port 0xcf8-0xcff on acpi0
pci0:  on pcib0
agp0:  port 0x8090-0x8093 mem 
0xe440-0xe4400fff,0xe800-0xebff at device 0.0 on pci0
pcib1:  at device 1.0 on pci0
pci1:  on pcib1
vgapci0:  port 0x9000-0x90ff mem 
0xe410-0xe410,0xec00-0xedff irq 10 at device 5.0 on pci1
ohci0:  mem 0xe400-0xe4000fff 
irq 9 at device 2.0 on pci0
usb0: OHCI version 1.0, legacy support
usb0:  on ohci0
usb0: USB revision 1.0
uhub0:  on usb0
uhub0: 4 ports with 4 removable, self powered
pci0:  (vendor 0x10b9, dev 0x5451) at device 6.0 irq 5
isab0:  at device 7.0 on pci0
isa0:  on isab0
pci0:  (vendor 0x10b9, dev 0x5457) at device 8.0 
irq 3
cbb0:  irq 11 at device 10.0 on pci0
cardbus0:  on cbb0
pccard0: <16-bit PCCard bus> on cbb0
atapci0:  port 
0x8080-0x808f,0x376,0x170-0x177,0x3f6,0x1f0-0x1f7 at device 16.0 on pci0
atapci0: using PIO transfers above 137GB as workaround for 48bit DMA access 
bug, expect reduced performance
ata0:  on atapci0
disk scheduler: set policy of ad0 to noop
[ACPI Debug]  String [0x1C] "THERM: _Q80 - Thermal Change"
[ACPI Debug]  String [0x16] "Notify _TZ.THRM , 0x80"
[ACPI Debug]  String [0x1C] "THERM: _Q80 - Thermal Change"
[ACPI Debug]  String [0x16] "Notify _TZ.THRM , 0x80"
ad0: 152627MB  at ata0-master UDMA100
ata1:  on atapci0
disk scheduler: set policy of acd0 to noop
acd0: CDRW  at ata1-master PIO4
pci0:  (vendor 0x10b9, dev 0x7101) at device 17.0
sis0:  port 0x8c00-0x8cff mem 
0xe4003000-0xe4003fff irq 11 at device 18.0 on pci0
miibus0:  on sis0
ukphy0:  on miibus0
ukphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
sis0: MAC address: 00:0f:20:c7:7f:8d
acpi_button0:  on acpi0
acpi_lid0:  on acpi0
acpi_acad0:  on acpi0
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String

Re: powernow not working on AMD Athlon XP Mobile

2011-09-12 Thread Sepherosa Ziehau
On Sun, Sep 11, 2011 at 6:46 PM, Maurizio Lombardi
 wrote:
>>
>> Under most of the cases, powernow kernel module is outdated, you
>> should use acpi p-states if possible.
>> It looks like acpi p-states do exist, but lacking CPU driver.  Could
>> you post the dmesg?
>
> dmesg attached, thanks for your quick answer.

Try following patch:
http://leaf.dragonflybsd.org/~sephe/pstate_machdep.c.diff

See whether following sysctl appears:
hw.acpi.cpu.px_dom0.select

>
> --
> 
> Maurizio Lombardi
>



-- 
Tomorrow Will Never Die



Re: powernow not working on AMD Athlon XP Mobile

2011-09-11 Thread Maurizio Lombardi
>
> Under most of the cases, powernow kernel module is outdated, you
> should use acpi p-states if possible.
> It looks like acpi p-states do exist, but lacking CPU driver.  Could
> you post the dmesg?

dmesg attached, thanks for your quick answer.

-- 

Maurizio Lombardi
Copyright (c) 2003-2011 The DragonFly Project.
Copyright (c) 1992-2003 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
DragonFly v2.10.1.1.gf7ba0-RELEASE #1: Mon Apr 25 19:48:10 UTC 2011
r...@pkgbox32.dragonflybsd.org:/usr/obj/usr/src/sys/GENERIC
TSC clock: 1855145616 Hz, i8254 clock: 1193155 Hz
CPU: mobile AMD Athlon(tm) XP2500+ (1753.31-MHz 686-class CPU)
  Origin = "AuthenticAMD"  Id = 0x6a0  Stepping = 0
  
Features=0x383f9ff
  AMD Features=0xc0480800
real memory  = 526972928 (502 MB)
avail memory = 495161344 (472 MB)
module_register: module pci/ahci already exists!
Module pci/ahci failed to register: 17
FQ scheduler policy version 1.0 loaded
disk scheduler: set policy of md0 to noop
md0: Malloc disk
kbd0 at kbdmux0
ACPI: RSDP 0xf7290 00014 (v0 PTLTD )
ACPI: RSDT 0x1f6f8b67 00030 (v1 PTLTDRSDT   0604  LTP )
ACPI: FACP 0x1f6fee2b 00074 (v1 ATIRaptor   0604 ATI  000F4240)
ACPI: DSDT 0x1f6f8b97 06294 (v1ATI U1_M1535 0604 MSFT 010D)
ACPI: FACS 0x1f6fffc0 00040
ACPI: BOOT 0x1f6fee9f 00028 (v1 PTLTD  $SBFTBL$ 0604  LTP 0001)
ACPI: SSDT 0x1f6feec7 00139 (v1 PTLTD  POWERNOW 0604  LTP 0001)
npx0:  on motherboard
npx0: INT 16 interface
Using MMX optimized bcopy/copyin/copyout
cryptosoft0:  on motherboard
acpi0:  on motherboard
ACPI FADT: SCI testing interrupt mode ...
ACPI FADT: SCI select level/low
objcache_reclaimlist
objcache_reclaimlist
objcache_reclaimlist
objcache_reclaimlist
acpi0: Power Button (fixed)
Warning: ACPI is disabling APM's device.  You can't run both
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
acpi_timer0: <32-bit timer at 3.579545MHz> port 0x8008-0x800b on acpi0
acpi_ec0:  port 0x66,0x62 on acpi0
pcib0:  port 0xcf8-0xcff on acpi0
pci0:  on pcib0
agp0:  port 0x8090-0x8093 mem 
0xe440-0xe4400fff,0xe800-0xebff at device 0.0 on pci0
pcib1:  at device 1.0 on pci0
pci1:  on pcib1
vgapci0:  port 0x9000-0x90ff mem 
0xe410-0xe410,0xec00-0xedff irq 10 at device 5.0 on pci1
ohci0:  mem 0xe400-0xe4000fff 
irq 9 at device 2.0 on pci0
usb0: OHCI version 1.0, legacy support
usb0:  on ohci0
usb0: USB revision 1.0
uhub0:  on usb0
uhub0: 4 ports with 4 removable, self powered
pci0:  (vendor 0x10b9, dev 0x5451) at device 6.0 irq 5
isab0:  at device 7.0 on pci0
isa0:  on isab0
pci0:  (vendor 0x10b9, dev 0x5457) at device 8.0 
irq 3
cbb0:  irq 11 at device 10.0 on pci0
cardbus0:  on cbb0
pccard0: <16-bit PCCard bus> on cbb0
atapci0:  port 
0x8080-0x808f,0x376,0x170-0x177,0x3f6,0x1f0-0x1f7 at device 16.0 on pci0
atapci0: using PIO transfers above 137GB as workaround for 48bit DMA access 
bug, expect reduced performance
ata0:  on atapci0
disk scheduler: set policy of ad0 to noop
ad0: 152627MB  at ata0-master UDMA100
ata1:  on atapci0
disk scheduler: set policy of acd0 to noop
acd0: CDRW  at ata1-master PIO4
pci0:  (vendor 0x10b9, dev 0x7101) at device 17.0
sis0:  port 0x8c00-0x8cff mem 
0xe4003000-0xe4003fff irq 11 at device 18.0 on pci0
miibus0:  on sis0
ukphy0:  on miibus0
ukphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
sis0: MAC address: 00:0f:20:c7:7f:8d
acpi_button0:  on acpi0
acpi_lid0:  on acpi0
acpi_acad0:  on acpi0
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
battery0:  on acpi0
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
[ACPI Debug]  String [0x12] "CMBatt - _STA.BAT1"
acpi_tz0:  on acpi0
atkbdc0:  port 0x64,0x60 irq 1 on acpi0
atkbd0:  flags 0x1 irq 1 on atkbdc0
kbd1 at atkbd0
[ACPI Debug]  String [0x1C] "THERM: _Q80 - Thermal Change"
[ACPI Debug]  String [0x16] "Notify _TZ.THRM , 0x80"
[ACPI Debug]  String [0x25] "Current Temperature C is --- "
[ACPI Debug]  Integ

Re: powernow not working on AMD Athlon XP Mobile

2011-09-11 Thread Sepherosa Ziehau
On Sun, Sep 11, 2011 at 5:51 PM, Maurizio Lombardi
 wrote:
> I'm looking at the DFly BSD powernow and the FreeBSD's powernow
> drivers differences.
> If I'm not wrong, the DFly powernow does not support the K7
> architecture, is it correct?

Under most of the cases, powernow kernel module is outdated, you
should use acpi p-states if possible.
It looks like acpi p-states do exist, but lacking CPU driver.  Could
you post the dmesg?
Or at least post the lines like following one (usually at the beginning of ):
CPU: AMD Phenom(tm) 9550 Quad-Core Processor (2200.09-MHz K8-class CPU)
  Origin = "AuthenticAMD"  Id = 0x100f23  Stepping = 3

Best Regards,
sephe

-- 
Tomorrow Will Never Die


Re: powernow not working on AMD Athlon XP Mobile

2011-09-11 Thread Maurizio Lombardi
I'm looking at the DFly BSD powernow and the FreeBSD's powernow
drivers differences.
If I'm not wrong, the DFly powernow does not support the K7
architecture, is it correct?

-- 

Maurizio Lombardi