Page MenuHomeFreeBSD

Detect AMD Family 0x0f one or two sensors per core
AbandonedPublic

Authored by cy on Jul 29 2019, 7:18 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 12 2024, 5:20 PM
Unknown Object (File)
Feb 28 2024, 1:55 PM
Unknown Object (File)
Jan 21 2024, 12:55 AM
Unknown Object (File)
Jan 4 2024, 1:46 AM
Unknown Object (File)
Dec 20 2023, 5:03 AM
Unknown Object (File)
Nov 30 2023, 7:13 PM
Unknown Object (File)
Nov 6 2023, 7:13 PM
Unknown Object (File)
Oct 24 2023, 9:33 AM
Subscribers
None

Details

Summary

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

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

Event Timeline

cem requested changes to this revision.Jul 29 2019, 7:56 PM
cem added inline comments.
sys/dev/amdtemp/amdtemp.c
389

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.

709–710

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.

sys/dev/amdtemp/amdtemp.c
389

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.

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