Page MenuHomeFreeBSD

Detect AMD Family 0x0f one or two sensors per core

Authored by cy on Jul 29 2019, 7:18 PM.



amdtemp assumes all AMD family 0x0f have two sensors per core. Not all do. This patch, obtained from NetBSD, correctly determines one or two sensors per core.

In addition, this revision corrects temp = ((val >> 21) & 0x7ff) * 5 / 4 to use the macros instead of raw values.

The scope of this revision does not attempt to rename functions or macros which support family 0x0f. This should be considered in another revision. I will submit another revision for that at a later date.

Test Plan

This has been tested and is running on what was my three family 0x0f machines (now two family 0x0f machines and one family 0x10 machine).

Diff Detail

rS FreeBSD src repository
Lint Skipped
Unit Tests Skipped
Build Status
Buildable 25567

Event Timeline

cy created this revision.Jul 29 2019, 7:18 PM
cem requested changes to this revision.Jul 29 2019, 7:56 PM
cem added inline comments.

This seems to be the "CmpCap [13:12]" field specified for F3xE8 Northbridge Capabilities Register in the Family 10h BKDG; it might be good to define macro names for the magic number 12 and 0x3 mask.

A zero value indicates a single core on the node. 0x1 => 2 cores, 0x2 => 3 cores, 0x3 => 4 cores, FWIW.


I think this unrelated change should be addressed separately.

This revision now requires changes to proceed.Jul 29 2019, 7:56 PM
cy marked an inline comment as done.Jul 30 2019, 12:14 PM

$JOB is taking precedence this week. I'll update this revision Friday or later.


According to 0x0f BKDG (26094.PDF), 00b == single core , 01b == dual, 10b == reserved, 11b = reserved.

We should do as you suggest for 0x10 though. I will update the 0x10 code as well.

cy abandoned this revision.Jul 31 2019, 12:05 PM

NetBSD determines the number of sensors and cores differently than we do. I will need more time to compare our approach with theirs.