amdsmn(4)/amdtemp(4): Attach to Ryzen 2 hostbridges

As reported, tested, and patch supplied by Johannes.

There may be future work to do to support multiple sensors, but for now, any
sensor at all is a strict improvement for Ryzen 2 systems.

PR:		228480
Submitted by:	Johannes Lundberg <johalun0 AT gmail.com> (earlier version)
Reported by:	deischen@, Johannes, and numerous others
MFC after:	3.72 days
This commit is contained in:
Conrad Meyer 2018-11-14 03:42:39 +00:00
parent 5b1df30051
commit 9d49c4229a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=340425
2 changed files with 23 additions and 8 deletions

View File

@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <machine/cpufunc.h>
#include <machine/cputypes.h>
#include <machine/md_var.h>
#include <machine/specialreg.h>
@ -53,14 +54,21 @@ __FBSDID("$FreeBSD$");
#define SMN_ADDR_REG 0x60
#define SMN_DATA_REG 0x64
#define PCI_DEVICE_ID_AMD_17H_ROOT 0x1450
#define PCI_DEVICE_ID_AMD_17H_ROOT_DF_F3 0x1463
#define PCI_DEVICE_ID_AMD_17H_M10H_ROOT 0x15d0
#define PCI_DEVICE_ID_AMD_17H_M10H_ROOT_DF_F3 0x15eb
struct amdsmn_softc {
struct mtx smn_lock;
};
static struct pciid {
uint32_t device_id;
uint16_t amdsmn_vendorid;
uint16_t amdsmn_deviceid;
} amdsmn_ids[] = {
{ 0x14501022 },
{ CPU_VENDOR_AMD, PCI_DEVICE_ID_AMD_17H_ROOT },
{ CPU_VENDOR_AMD, PCI_DEVICE_ID_AMD_17H_M10H_ROOT },
};
/*
@ -89,18 +97,21 @@ static driver_t amdsmn_driver = {
static devclass_t amdsmn_devclass;
DRIVER_MODULE(amdsmn, hostb, amdsmn_driver, amdsmn_devclass, NULL, NULL);
MODULE_VERSION(amdsmn, 1);
MODULE_PNP_INFO("W32:vendor/device", pci, amdsmn, amdsmn_ids,
MODULE_PNP_INFO("U16:vendor;U16:device", pci, amdsmn, amdsmn_ids,
nitems(amdsmn_ids));
static bool
amdsmn_match(device_t parent)
{
uint32_t devid;
uint16_t vendor, device;
size_t i;
devid = pci_get_devid(parent);
vendor = pci_get_vendor(parent);
device = pci_get_device(parent);
for (i = 0; i < nitems(amdsmn_ids); i++)
if (amdsmn_ids[i].device_id == devid)
if (vendor == amdsmn_ids[i].amdsmn_vendorid &&
device == amdsmn_ids[i].amdsmn_deviceid)
return (true);
return (false);
}

View File

@ -86,7 +86,10 @@ struct amdtemp_softc {
#define DEVICEID_AMD_MISC16 0x1533
#define DEVICEID_AMD_MISC16_M30H 0x1583
#define DEVICEID_AMD_MISC17 0x141d
#define DEVICEID_AMD_HOSTB17H 0x1450
#define DEVICEID_AMD_HOSTB17H_ROOT 0x1450
#define DEVICEID_AMD_HOSTB17H_DF_F3 0x1463
#define DEVICEID_AMD_HOSTB17H_M10H_ROOT 0x15d0
#define DEVICEID_AMD_HOSTB17H_M10H_DF_F3 0x15eb
static struct amdtemp_product {
uint16_t amdtemp_vendorid;
@ -101,7 +104,8 @@ static struct amdtemp_product {
{ VENDORID_AMD, DEVICEID_AMD_MISC16 },
{ VENDORID_AMD, DEVICEID_AMD_MISC16_M30H },
{ VENDORID_AMD, DEVICEID_AMD_MISC17 },
{ VENDORID_AMD, DEVICEID_AMD_HOSTB17H },
{ VENDORID_AMD, DEVICEID_AMD_HOSTB17H_ROOT },
{ VENDORID_AMD, DEVICEID_AMD_HOSTB17H_M10H_ROOT },
};
/*