[Bug 221071] NCT6779D - implement support for sensor readings

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Jul 28 17:55:53 UTC 2017


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

--- Comment #2 from Nils Beyer <nbe at 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.


More information about the freebsd-bugs mailing list