Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Feb 2020 19:09:24 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r357869 - in head/sys/dev: amdsbwd intpm
Message-ID:  <202002131909.01DJ9OYD044987@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Thu Feb 13 19:09:24 2020
New Revision: 357869
URL: https://svnweb.freebsd.org/changeset/base/357869

Log:
  amdsbwd, intpm: Add Hygon Dhyana support.
  
  Initialize the FCH SMBus controller for Hygon Dhyana CPU.
  Set the vendor of the FCH description via the exact CPU vendor.
  
  Submitted by:	Pu Wen <puwen@hygon.cn>
  MFC after:	1 week
  Differential revision:	https://reviews.freebsd.org/D23558

Modified:
  head/sys/dev/amdsbwd/amd_chipset.h
  head/sys/dev/amdsbwd/amdsbwd.c
  head/sys/dev/intpm/intpm.c

Modified: head/sys/dev/amdsbwd/amd_chipset.h
==============================================================================
--- head/sys/dev/amdsbwd/amd_chipset.h	Thu Feb 13 19:07:42 2020	(r357868)
+++ head/sys/dev/amdsbwd/amd_chipset.h	Thu Feb 13 19:09:24 2020	(r357869)
@@ -146,3 +146,5 @@
 #define	AMDCZ_SMBUS_DEVID		0x790b1022
 #define	AMDCZ49_SMBUS_REVID		0x49
 
+#define	HYGONCZ_SMBUS_DEVID		0x790b1d94
+

Modified: head/sys/dev/amdsbwd/amdsbwd.c
==============================================================================
--- head/sys/dev/amdsbwd/amdsbwd.c	Thu Feb 13 19:07:42 2020	(r357868)
+++ head/sys/dev/amdsbwd/amdsbwd.c	Thu Feb 13 19:09:24 2020	(r357869)
@@ -60,6 +60,8 @@ __FBSDID("$FreeBSD$");
 #include <sys/bus.h>
 #include <machine/bus.h>
 #include <sys/rman.h>
+#include <machine/cputypes.h>
+#include <machine/md_var.h>
 #include <machine/resource.h>
 #include <sys/watchdog.h>
 
@@ -269,7 +271,8 @@ amdsbwd_identify(driver_t *driver, device_t parent)
 		return;
 	if (pci_get_devid(smb_dev) != AMDSB_SMBUS_DEVID &&
 	    pci_get_devid(smb_dev) != AMDFCH_SMBUS_DEVID &&
-	    pci_get_devid(smb_dev) != AMDCZ_SMBUS_DEVID)
+	    pci_get_devid(smb_dev) != AMDCZ_SMBUS_DEVID &&
+	    pci_get_devid(smb_dev) != HYGONCZ_SMBUS_DEVID)
 		return;
 
 	child = BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "amdsbwd", -1);
@@ -378,6 +381,7 @@ static void
 amdsbwd_probe_fch41(device_t dev, struct resource *pmres, uint32_t *addr)
 {
 	uint8_t	val;
+	char buf[36];
 
 	val = pmio_read(pmres, AMDFCH41_PM_ISA_CTRL);
 	if ((val & AMDFCH41_MMIO_EN) != 0) {
@@ -416,7 +420,9 @@ amdsbwd_probe_fch41(device_t dev, struct resource *pmr
 	amdsbwd_verbose_printf(dev, "AMDFCH41_PM_DECODE_EN3 value = %#04x\n",
 	    val);
 #endif
-	device_set_desc(dev, "AMD FCH Rev 41h+ Watchdog Timer");
+	snprintf(buf, sizeof(buf), "%s FCH Rev 41h+ Watchdog Timer",
+	    cpu_vendor_id == CPU_VENDOR_HYGON ? "Hygon" : "AMD");
+	device_set_desc_copy(dev, buf);
 }
 
 static int

Modified: head/sys/dev/intpm/intpm.c
==============================================================================
--- head/sys/dev/intpm/intpm.c	Thu Feb 13 19:07:42 2020	(r357868)
+++ head/sys/dev/intpm/intpm.c	Thu Feb 13 19:09:24 2020	(r357869)
@@ -102,6 +102,7 @@ const struct intsmb_device {
 	{ AMDSB_SMBUS_DEVID, "AMD SB600/7xx/8xx/9xx SMBus Controller" },
 	{ AMDFCH_SMBUS_DEVID, "AMD FCH SMBus Controller" },
 	{ AMDCZ_SMBUS_DEVID, "AMD FCH SMBus Controller" },
+	{ HYGONCZ_SMBUS_DEVID, "Hygon FCH SMBus Controller" },
 };
 
 static int
@@ -243,6 +244,7 @@ intsmb_attach(device_t dev)
 		break;
 	case AMDFCH_SMBUS_DEVID:
 	case AMDCZ_SMBUS_DEVID:
+	case HYGONCZ_SMBUS_DEVID:
 		sc->sb8xx = 1;
 		break;
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202002131909.01DJ9OYD044987>