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 correct for known temperature bias values.



details:   https://anonhg.NetBSD.org/src/rev/a3600a8a58ef
branches:  trunk
changeset: 999701:a3600a8a58ef
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sun Jun 16 09:12:51 2019 +0000

description:
correct for known temperature bias values.

diffstat:

 sys/arch/x86/pci/amdzentemp.c |  20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diffs (63 lines):

diff -r f4814347a716 -r a3600a8a58ef sys/arch/x86/pci/amdzentemp.c
--- a/sys/arch/x86/pci/amdzentemp.c     Sun Jun 16 07:42:52 2019 +0000
+++ b/sys/arch/x86/pci/amdzentemp.c     Sun Jun 16 09:12:51 2019 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: amdzentemp.c,v 1.8 2018/07/25 19:10:41 para Exp $ */
+/*      $NetBSD: amdzentemp.c,v 1.9 2019/06/16 09:12:51 mlelstv 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.8 2018/07/25 19:10:41 para Exp $ ");
+__KERNEL_RCSID(0, "$NetBSD: amdzentemp.c,v 1.9 2019/06/16 09:12:51 mlelstv Exp $ ");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -81,6 +81,7 @@
        envsys_data_t *sc_sensor;
        size_t sc_sensor_len;
         size_t sc_numsensors;
+       int32_t sc_offset;
 };
 
 
@@ -123,7 +124,7 @@
        sc->sc_pc = pa->pa_pc;
        sc->sc_pcitag = pa->pa_tag;
        sc->sc_smn = parent;
-     
+
        amdzentemp_family17_init(sc);
 
        aprint_normal("\n");
@@ -190,7 +191,19 @@
 static void
 amdzentemp_family17_init(struct amdzentemp_softc *sc) 
 {
+
        sc->sc_numsensors = 1;
+       sc->sc_offset = 0;
+
+       if (strstr(cpu_brand_string, "AMD Ryzen 5 1600X")
+           || strstr(cpu_brand_string, "AMD Ryzen 7 1700X")
+           || strstr(cpu_brand_string, "AMD Ryzen 7 1800X"))
+               sc->sc_offset = -20000000;
+       else if (strstr(cpu_brand_string, "AMD Ryzen 7 2700X"))
+               sc->sc_offset = -10000000;
+       else if (strstr(cpu_brand_string, "AMD Ryzen Threadripper 19")
+           || strstr(cpu_brand_string, "AMD Ryzen Threadripper 29"))
+               sc->sc_offset = -27000000;
 }
 
 static void
@@ -222,6 +235,7 @@
        /* adjust for possible offset of 49K */
        if (temp & 0x80000) 
                edata->value_cur -= 49000000;
+       edata->value_cur += sc->sc_offset;
 }
 
 MODULE(MODULE_CLASS_DRIVER, amdzentemp, "sysmon_envsys,amdsmn");



Home | Main Index | Thread Index | Old Index