Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Jul 2017 17:55:53 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 221071] NCT6779D - implement support for sensor readings
Message-ID:  <bug-221071-8-7fD0UlkTI9@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-221071-8@https.bugs.freebsd.org/bugzilla/>
References:  <bug-221071-8@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221071

--- Comment #2 from Nils Beyer <nbe@renzel.net> ---
I don't get it; for instance, CPU temperature - bank 4, register 91h reads
36h = 54

so, the logic in NetBSD code is as following:
-----------------------------------------------------------------------
        data = (*sc->lm_readreg)(sc, sc->lm_sensors[n].reg) << 1;
        data += (*sc->lm_readreg)(sc, sc->lm_sensors[n].reg + 1) >> 7;
        if (data > 0xfffffff || (data > 0x0fa && data < 0x1a6)) {
                sc->sensors[n].state = ENVSYS_SINVALID;
        } else {
                if (data & 0x100)
                        data -= 0x200;
                sc->sensors[n].state = ENVSYS_SVALID;
                sc->sensors[n].value_cur = data * 500000 + 273150000;
        }
-----------------------------------------------------------------------

1) shift original value one left -> 6Ch = 108
2) shift value of next register seven right (0) and add that to original value
-> 6Ch stays
2) bit-and that with 100h, if true then subtract 200h -> it's false, so 6Ch
stays
3) multiply that with 500000 -> 0337f980h = 54000000
4) add 273150000 -> 137FE9B0h = 327150000

So, I have exceeded the safe temperature of my CPU and of the solar system's
sun...

-- 
You are receiving this mail because:
You are the assignee for the bug.


Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-221071-8-7fD0UlkTI9>