Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86/pci adjust for possible 49K offset



details:   https://anonhg.NetBSD.org/src/rev/f7f192480185
branches:  trunk
changeset: 363398:f7f192480185
user:      para <para%NetBSD.org@localhost>
date:      Wed Jul 25 19:10:41 2018 +0000

description:
adjust for possible 49K offset

presence of this offset is indicated by a set 19th bit which is shifted away
this brings the temperature to "normal" levels on my ryzen 2700
(I assumed the same 49K offset as the k10temp project)

diffstat:

 sys/arch/x86/pci/amdzentemp.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r e7744f2ceecd -r f7f192480185 sys/arch/x86/pci/amdzentemp.c
--- a/sys/arch/x86/pci/amdzentemp.c     Wed Jul 25 19:09:38 2018 +0000
+++ b/sys/arch/x86/pci/amdzentemp.c     Wed Jul 25 19:10:41 2018 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: amdzentemp.c,v 1.7 2018/01/26 23:01:44 pgoyette Exp $ */
+/*      $NetBSD: amdzentemp.c,v 1.8 2018/07/25 19:10:41 para Exp $ */
 /*      $OpenBSD: kate.c,v 1.2 2008/03/27 04:52:03 cnst Exp $   */
 
 /*
@@ -50,7 +50,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdzentemp.c,v 1.7 2018/01/26 23:01:44 pgoyette Exp $ ");
+__KERNEL_RCSID(0, "$NetBSD: amdzentemp.c,v 1.8 2018/07/25 19:10:41 para Exp $ ");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -219,6 +219,9 @@
        edata->state = ENVSYS_SVALID;
        /* From C to uK. */      
        edata->value_cur = ((temp >> 21) * 125000) + 273150000;
+       /* adjust for possible offset of 49K */
+       if (temp & 0x80000) 
+               edata->value_cur -= 49000000;
 }
 
 MODULE(MODULE_CLASS_DRIVER, amdzentemp, "sysmon_envsys,amdsmn");



Home | Main Index | Thread Index | Old Index