Date: Thu, 4 Mar 2021 15:14:10 GMT From: Alexander Motin <mav@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: c7d9dcb97ab7 - stable/12 - amdsmn(4), amdtemp(4): add support for Family 19h (Zen 3) Message-ID: <202103041514.124FEA9l058994@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=c7d9dcb97ab74cf6f5116df6622d1eff455f5df1 commit c7d9dcb97ab74cf6f5116df6622d1eff455f5df1 Author: Conrad Meyer <cem@FreeBSD.org> AuthorDate: 2020-12-12 19:34:12 +0000 Commit: Alexander Motin <mav@FreeBSD.org> CommitDate: 2021-03-04 15:10:50 +0000 amdsmn(4), amdtemp(4): add support for Family 19h (Zen 3) Zen 3 "Vermeer" support, tested on Ryzen 9 5950X. Model numbers from https://en.wikichip.org/wiki/amd/cpuid "Extended Model" column. Submitted by: Greg V <greg AT unrelenting.technology> Differential Revision: https://reviews.freebsd.org/D27552 (cherry picked from commit ea6189d3a470ce9ffb19335f915eab6af0cfef57) --- sys/dev/amdsmn/amdsmn.c | 3 ++- sys/dev/amdtemp/amdtemp.c | 69 ++++++++++++++++++++++++++++++++++------------- 2 files changed, 53 insertions(+), 19 deletions(-) diff --git a/sys/dev/amdsmn/amdsmn.c b/sys/dev/amdsmn/amdsmn.c index ebc45256d14d..e83219b02705 100644 --- a/sys/dev/amdsmn/amdsmn.c +++ b/sys/dev/amdsmn/amdsmn.c @@ -59,7 +59,7 @@ __FBSDID("$FreeBSD$"); #define PCI_DEVICE_ID_AMD_15H_M60H_ROOT 0x1576 #define PCI_DEVICE_ID_AMD_17H_ROOT 0x1450 #define PCI_DEVICE_ID_AMD_17H_M10H_ROOT 0x15d0 -#define PCI_DEVICE_ID_AMD_17H_M30H_ROOT 0x1480 /* Also M70H. */ +#define PCI_DEVICE_ID_AMD_17H_M30H_ROOT 0x1480 /* Also M70H, F19H M00H/M20H */ #define PCI_DEVICE_ID_AMD_17H_M60H_ROOT 0x1630 struct pciid; @@ -187,6 +187,7 @@ amdsmn_probe(device_t dev) switch (family) { case 0x15: case 0x17: + case 0x19: break; default: return (ENXIO); diff --git a/sys/dev/amdtemp/amdtemp.c b/sys/dev/amdtemp/amdtemp.c index 5847f9da00e1..48c4341a67cb 100644 --- a/sys/dev/amdtemp/amdtemp.c +++ b/sys/dev/amdtemp/amdtemp.c @@ -106,7 +106,7 @@ struct amdtemp_softc { #define DEVICEID_AMD_MISC16_M30H 0x1583 #define DEVICEID_AMD_HOSTB17H_ROOT 0x1450 #define DEVICEID_AMD_HOSTB17H_M10H_ROOT 0x15d0 -#define DEVICEID_AMD_HOSTB17H_M30H_ROOT 0x1480 /* Also M70h. */ +#define DEVICEID_AMD_HOSTB17H_M30H_ROOT 0x1480 /* Also M70H, F19H M00H/M20H */ #define DEVICEID_AMD_HOSTB17H_M60H_ROOT 0x1630 static const struct amdtemp_product { @@ -207,6 +207,7 @@ static int32_t amdtemp_gettemp(device_t dev, amdsensor_t sensor); static int32_t amdtemp_gettemp15hm60h(device_t dev, amdsensor_t sensor); static int32_t amdtemp_gettemp17h(device_t dev, amdsensor_t sensor); static void amdtemp_probe_ccd_sensors17h(device_t dev, uint32_t model); +static void amdtemp_probe_ccd_sensors19h(device_t dev, uint32_t model); static int amdtemp_sysctl(SYSCTL_HANDLER_ARGS); static device_method_t amdtemp_methods[] = { @@ -294,6 +295,7 @@ amdtemp_probe(device_t dev) case 0x15: case 0x16: case 0x17: + case 0x19: break; default: return (ENXIO); @@ -451,6 +453,7 @@ amdtemp_attach(device_t dev) sc->sc_gettemp = amdtemp_gettemp; break; case 0x17: + case 0x19: sc->sc_ntemps = 1; sc->sc_gettemp = amdtemp_gettemp17h; needsmn = true; @@ -508,6 +511,8 @@ amdtemp_attach(device_t dev) if (family == 0x17) amdtemp_probe_ccd_sensors17h(dev, model); + else if (family == 0x19) + amdtemp_probe_ccd_sensors19h(dev, model); else if (sc->sc_ntemps > 1) { SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(sysctlnode), @@ -767,28 +772,13 @@ amdtemp_gettemp17h(device_t dev, amdsensor_t sensor) } static void -amdtemp_probe_ccd_sensors17h(device_t dev, uint32_t model) +amdtemp_probe_ccd_sensors(device_t dev, uint32_t maxreg) { char sensor_name[16], sensor_descr[32]; struct amdtemp_softc *sc; - uint32_t maxreg, i, val; + uint32_t i, val; int error; - switch (model) { - case 0x00 ... 0x1f: /* Zen1, Zen+ */ - maxreg = 4; - break; - case 0x30 ... 0x3f: /* Zen2 TR/Epyc */ - case 0x70 ... 0x7f: /* Zen2 Ryzen */ - maxreg = 8; - _Static_assert((int)NUM_CCDS >= 8, ""); - break; - default: - device_printf(dev, - "Unrecognized Family 17h Model: %02xh\n", model); - return; - } - sc = device_get_softc(dev); for (i = 0; i < maxreg; i++) { error = amdsmn_read(sc->sc_smn, AMDTEMP_17H_CCD_TMP_BASE + @@ -808,3 +798,46 @@ amdtemp_probe_ccd_sensors17h(device_t dev, uint32_t model) dev, CCD_BASE + i, amdtemp_sysctl, "IK", sensor_descr); } } + +static void +amdtemp_probe_ccd_sensors17h(device_t dev, uint32_t model) +{ + uint32_t maxreg; + + switch (model) { + case 0x00 ... 0x1f: /* Zen1, Zen+ */ + maxreg = 4; + break; + case 0x30 ... 0x3f: /* Zen2 TR/EPYC */ + case 0x70 ... 0x7f: /* Zen2 Ryzen */ + maxreg = 8; + _Static_assert((int)NUM_CCDS >= 8, ""); + break; + default: + device_printf(dev, + "Unrecognized Family 17h Model: %02xh\n", model); + return; + } + + amdtemp_probe_ccd_sensors(dev, maxreg); +} + +static void +amdtemp_probe_ccd_sensors19h(device_t dev, uint32_t model) +{ + uint32_t maxreg; + + switch (model) { + case 0x00 ... 0x0f: /* Zen3 EPYC "Milan" */ + case 0x20 ... 0x2f: /* Zen3 Ryzen "Vermeer" */ + maxreg = 8; + _Static_assert((int)NUM_CCDS >= 8, ""); + break; + default: + device_printf(dev, + "Unrecognized Family 19h Model: %02xh\n", model); + return; + } + + amdtemp_probe_ccd_sensors(dev, maxreg); +}
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202103041514.124FEA9l058994>