git: c7d5163a1335 - stable/14 - amdsmn(4), amdtemp(4): add support for AMD Ryzen 7 "Phoenix" processors

From: Xin LI <delphij_at_FreeBSD.org>
Date: Mon, 26 Aug 2024 05:16:03 UTC
The branch stable/14 has been updated by delphij:

URL: https://cgit.FreeBSD.org/src/commit/?id=c7d5163a1335a1ff41bee28a6d49c87cdbd36411

commit c7d5163a1335a1ff41bee28a6d49c87cdbd36411
Author:     Oliver Fromme <olli@FreeBSD.org>
AuthorDate: 2024-08-23 04:46:19 +0000
Commit:     Xin LI <delphij@FreeBSD.org>
CommitDate: 2024-08-26 05:15:43 +0000

    amdsmn(4), amdtemp(4): add support for AMD Ryzen 7 "Phoenix" processors
    
    Adds support for AMD Ryzen 7 "Phoenix" processors (family 0x19,
    model 0x70-0x7f) to the amdsmn(4) and amdtemp(4) drivers. This
    enables temperature readings of these CPUs via sysctl.
    
    The sensors function identically to those for the "Raphael" processors
    (model 0x60-0x6f); only the PCI device ID differs.
    
    PR:             kern/280942
    Relnotes:       yes
    MFC after:      3 days
    
    (cherry picked from commit ef3f8aa0a0492487ac7db839de078b1913f61b4c)
---
 sys/dev/amdsmn/amdsmn.c   | 7 +++++++
 sys/dev/amdtemp/amdtemp.c | 3 +++
 2 files changed, 10 insertions(+)

diff --git a/sys/dev/amdsmn/amdsmn.c b/sys/dev/amdsmn/amdsmn.c
index 5af8d9aca7bd..a0a7b9db60f8 100644
--- a/sys/dev/amdsmn/amdsmn.c
+++ b/sys/dev/amdsmn/amdsmn.c
@@ -61,6 +61,7 @@
 #define	PCI_DEVICE_ID_AMD_17H_M60H_ROOT		0x1630
 #define	PCI_DEVICE_ID_AMD_19H_M10H_ROOT		0x14a4
 #define	PCI_DEVICE_ID_AMD_19H_M60H_ROOT		0x14d8
+#define	PCI_DEVICE_ID_AMD_19H_M70H_ROOT		0x14e8
 
 struct pciid;
 struct amdsmn_softc {
@@ -116,6 +117,12 @@ static const struct pciid {
 		.amdsmn_addr_reg = F17H_SMN_ADDR_REG,
 		.amdsmn_data_reg = F17H_SMN_DATA_REG,
 	},
+	{
+		.amdsmn_vendorid = CPU_VENDOR_AMD,
+		.amdsmn_deviceid = PCI_DEVICE_ID_AMD_19H_M70H_ROOT,
+		.amdsmn_addr_reg = F17H_SMN_ADDR_REG,
+		.amdsmn_data_reg = F17H_SMN_DATA_REG,
+	},
 };
 
 /*
diff --git a/sys/dev/amdtemp/amdtemp.c b/sys/dev/amdtemp/amdtemp.c
index 73a4ba86bb84..583ff80cac69 100644
--- a/sys/dev/amdtemp/amdtemp.c
+++ b/sys/dev/amdtemp/amdtemp.c
@@ -116,6 +116,7 @@ struct amdtemp_softc {
 #define	DEVICEID_AMD_HOSTB17H_M60H_ROOT	0x1630
 #define	DEVICEID_AMD_HOSTB19H_M10H_ROOT	0x14a4
 #define	DEVICEID_AMD_HOSTB19H_M60H_ROOT	0x14d8
+#define	DEVICEID_AMD_HOSTB19H_M70H_ROOT	0x14e8
 
 static const struct amdtemp_product {
 	uint16_t	amdtemp_vendorid;
@@ -142,6 +143,7 @@ static const struct amdtemp_product {
 	{ VENDORID_AMD,	DEVICEID_AMD_HOSTB17H_M60H_ROOT, false },
 	{ VENDORID_AMD,	DEVICEID_AMD_HOSTB19H_M10H_ROOT, false },
 	{ VENDORID_AMD,	DEVICEID_AMD_HOSTB19H_M60H_ROOT, false },
+	{ VENDORID_AMD,	DEVICEID_AMD_HOSTB19H_M70H_ROOT, false },
 };
 
 /*
@@ -874,6 +876,7 @@ amdtemp_probe_ccd_sensors19h(device_t dev, uint32_t model)
 		_Static_assert((int)NUM_CCDS >= 12, "");
 		break;
 	case 0x60 ... 0x6f: /* Zen4 Ryzen "Raphael" */
+	case 0x70 ... 0x7f: /* Zen4 Ryzen "Phoenix" */
 		sc->sc_temp_base = AMDTEMP_ZEN4_CCD_TMP_BASE;
 		maxreg = 8;
 		_Static_assert((int)NUM_CCDS >= 8, "");