Date: Wed, 14 Nov 2018 21:31:27 +0000 (UTC) From: Eric van Gyzen <vangyzen@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r340446 - in stable/12/sys/dev: amdsmn amdtemp Message-ID: <201811142131.wAELVRRC059619@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: vangyzen Date: Wed Nov 14 21:31:26 2018 New Revision: 340446 URL: https://svnweb.freebsd.org/changeset/base/340446 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 Early MFC approved by: cem Approved by: re (kib) Relnotes: yes Modified: stable/12/sys/dev/amdsmn/amdsmn.c stable/12/sys/dev/amdtemp/amdtemp.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/amdsmn/amdsmn.c ============================================================================== --- stable/12/sys/dev/amdsmn/amdsmn.c Wed Nov 14 20:36:18 2018 (r340445) +++ stable/12/sys/dev/amdsmn/amdsmn.c Wed Nov 14 21:31:26 2018 (r340446) @@ -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); } Modified: stable/12/sys/dev/amdtemp/amdtemp.c ============================================================================== --- stable/12/sys/dev/amdtemp/amdtemp.c Wed Nov 14 20:36:18 2018 (r340445) +++ stable/12/sys/dev/amdtemp/amdtemp.c Wed Nov 14 21:31:26 2018 (r340446) @@ -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 }, }; /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201811142131.wAELVRRC059619>