Module Name:    src
Committed By:   para
Date:           Wed Jul 25 19:10:41 UTC 2018

Modified Files:
        src/sys/arch/x86/pci: amdzentemp.c

Log Message:
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)


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/x86/pci/amdzentemp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/pci/amdzentemp.c
diff -u src/sys/arch/x86/pci/amdzentemp.c:1.7 src/sys/arch/x86/pci/amdzentemp.c:1.8
--- src/sys/arch/x86/pci/amdzentemp.c:1.7	Fri Jan 26 23:01:44 2018
+++ src/sys/arch/x86/pci/amdzentemp.c	Wed Jul 25 19:10:41 2018
@@ -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 @@ amdzentemp_family17_refresh(struct sysmo
 	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");

Reply via email to