Date: Tue, 22 Jan 2019 21:33:14 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r343323 - in stable/11/sys/dev: amdsmn amdtemp Message-ID: <201901222133.x0MLXEpL074871@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Tue Jan 22 21:33:14 2019 New Revision: 343323 URL: https://svnweb.freebsd.org/changeset/base/343323 Log: MFC r340425 (by cem): 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 Modified: stable/11/sys/dev/amdsmn/amdsmn.c stable/11/sys/dev/amdtemp/amdtemp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/amdsmn/amdsmn.c ============================================================================== --- stable/11/sys/dev/amdsmn/amdsmn.c Tue Jan 22 21:04:03 2019 (r343322) +++ stable/11/sys/dev/amdsmn/amdsmn.c Tue Jan 22 21:33:14 2019 (r343323) @@ -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 }, }; /* @@ -93,12 +101,15 @@ MODULE_VERSION(amdsmn, 1); 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); } Modified: stable/11/sys/dev/amdtemp/amdtemp.c ============================================================================== --- stable/11/sys/dev/amdtemp/amdtemp.c Tue Jan 22 21:04:03 2019 (r343322) +++ stable/11/sys/dev/amdtemp/amdtemp.c Tue Jan 22 21:33:14 2019 (r343323) @@ -84,7 +84,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; @@ -99,7 +102,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 }, { 0, 0 } };
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201901222133.x0MLXEpL074871>