Subject: kern/33968: amdpm(4) timer, fix and AMD8111 support
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <njoly@pasteur.fr>
List: netbsd-bugs
Date: 07/10/2006 19:30:00
>Number: 33968
>Category: kern
>Synopsis: amdpm(4) timer, fix and AMD8111 support
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jul 10 19:30:00 +0000 2006
>Originator: Nicolas Joly
>Release: NetBSD 3.99.21
>Organization:
Institut Pasteur, Paris.
>Environment:
System: NetBSD lanfeust.sis.pasteur.fr 3.99.21 NetBSD 3.99.21 (LANFEUST) #2: Mon Jul 10 19:34:32 CEST 2006 njoly@lanfeust.sis.pasteur.fr:/local/src/NetBSD/obj/amd64/sys/arch/amd64/compile/LANFEUST amd64
Architecture: x86_64
Machine: amd64
>Description:
While trying to activate amdpm(4) timer on my amd64 workstation, i noticed
that the timer code was checking wrong register values (AMDPM_PMPTR instead
of AMDPM_CONFREG).
sys/dev/pci/amdpm.c:
[...]
reg = pci_conf_read(pa->pa_pc, pa->pa_tag, AMDPM_CONFREG);
[...]
reg = pci_conf_read(pa->pa_pc, pa->pa_tag, AMDPM_PMPTR);
[...]
#ifdef __HAVE_TIMECOUNTER
if ((reg & AMDPM_TMRRST) == 0 && (reg & AMDPM_STOPTMR) == 0 &&
PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_AMD_PBC768_PMC) {
[...]
This small problem fixed, i was able to make it work on the AMD8111 chipset.
amdpm0 at pci0 dev 7 function 3: Advanced Micro Devices AMD8111 ACPI Controller (rev. 0x05)
amdpm0: 24-bit timer at 3579545Hz
timecounter: Timecounter "amdpm" frequency 3579545 Hz quality 1000
timecounter: selected timecounter "amdpm" frequency 3579545 Hz quality 1000
iic0 at amdpm0: I2C bus
adt7463c0 at iic0 addr 0x2e
amdpm0: random number generator enabled (apprx. 58ms)
>How-To-Repeat:
code inspection
>Fix:
Index: sys/dev/pci/amdpm.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/amdpm.c,v
retrieving revision 1.14
diff -u -r1.14 amdpm.c
--- sys/dev/pci/amdpm.c 21 Jun 2006 21:09:36 -0000 1.14
+++ sys/dev/pci/amdpm.c 10 Jul 2006 18:10:19 -0000
@@ -151,8 +151,8 @@
}
#ifdef __HAVE_TIMECOUNTER
- if ((reg & AMDPM_TMRRST) == 0 && (reg & AMDPM_STOPTMR) == 0 &&
- PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_AMD_PBC768_PMC) {
+ reg = pci_conf_read(pa->pa_pc, pa->pa_tag, AMDPM_CONFREG);
+ if ((reg & AMDPM_TMRRST) == 0 && (reg & AMDPM_STOPTMR) == 0) {
aprint_normal("%s: %d-bit timer at %" PRIu64 "Hz\n",
sc->sc_dev.dv_xname,
(reg & AMDPM_TMR32) ? 32 : 24,