kevinlekiller / amdctl

Set P-State voltages and clock speeds on recent AMD CPUs on Linux.
GNU General Public License v3.0
241 stars 22 forks source link

Fix CPU and CPU-NB frequency reporting for early fam15h CPUs #34

Closed ermo closed 2 years ago

ermo commented 2 years ago

Add output of registers used for voltage and frequency on fam15h.

Change the REFCLK variable to be a read-only static variable so the compiler will complain if an attempt is made to re-assign it.

REFCLK = 200 was erroneously used in CPU frequency calculations, where the correct formula for fam15h is:

100 * (CpuFid + 0x10h) >> CpuDid

REFCLK = 400 was erroneously used in CPU-NB frequency calculations, where the correct formula for fam15h is:

200 * (nbdid + 0x4) >> nbfid)

Fixes #33

kevinlekiller commented 2 years ago

Nice work!

I think math.h (and linking math in cmake / makefile) is not required anymore without the pow on line 363.