From owner-svn-src-head@freebsd.org  Fri Feb 14 15:04:57 2020
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id B5D4023801B;
 Fri, 14 Feb 2020 15:04:57 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 48JxWF4Mcsz3Dm8;
 Fri, 14 Feb 2020 15:04:57 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from repo.freebsd.org (repo.freebsd.org
 [IPv6:2610:1c1:1:6068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 90ACA2572E;
 Fri, 14 Feb 2020 15:04:57 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01EF4vRY066510;
 Fri, 14 Feb 2020 15:04:57 GMT (envelope-from mav@FreeBSD.org)
Received: (from mav@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01EF4vDN066509;
 Fri, 14 Feb 2020 15:04:57 GMT (envelope-from mav@FreeBSD.org)
Message-Id: <202002141504.01EF4vDN066509@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org
 using -f
From: Alexander Motin <mav@FreeBSD.org>
Date: Fri, 14 Feb 2020 15:04:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r357920 - head/sys/dev/ntb/ntb_hw
X-SVN-Group: head
X-SVN-Commit-Author: mav
X-SVN-Commit-Paths: head/sys/dev/ntb/ntb_hw
X-SVN-Commit-Revision: 357920
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 14 Feb 2020 15:04:57 -0000

Author: mav
Date: Fri Feb 14 15:04:56 2020
New Revision: 357920
URL: https://svnweb.freebsd.org/changeset/base/357920

Log:
  Add support for Hygon NTB PCI device in ntb_hw_amd driver.
  
  Submitted by:	Pu Wen <puwen@hygon.cn>
  MFC after:	1 week
  Differential Revision:	https://reviews.freebsd.org/D23565

Modified:
  head/sys/dev/ntb/ntb_hw/ntb_hw_amd.c
  head/sys/dev/ntb/ntb_hw/ntb_hw_amd.h

Modified: head/sys/dev/ntb/ntb_hw/ntb_hw_amd.c
==============================================================================
--- head/sys/dev/ntb/ntb_hw/ntb_hw_amd.c	Fri Feb 14 14:55:40 2020	(r357919)
+++ head/sys/dev/ntb/ntb_hw/ntb_hw_amd.c	Fri Feb 14 15:04:56 2020	(r357920)
@@ -101,6 +101,16 @@ static const struct amd_ntb_hw_info amd_ntb_hw_info_li
 	  .msix_vector_count = 24,
 	  .quirks = 0,
 	  .desc = "AMD Non-Transparent Bridge"},
+
+	{ .vendor_id = NTB_HW_HYGON_VENDOR_ID,
+	  .device_id = NTB_HW_HYGON_DEVICE_ID1,
+	  .mw_count = 3,
+	  .bar_start_idx = 1,
+	  .spad_count = 16,
+	  .db_count = 16,
+	  .msix_vector_count = 24,
+	  .quirks = QUIRK_MW0_32BIT,
+	  .desc = "Hygon Non-Transparent Bridge"},
 };
 
 static const struct pci_device_table amd_ntb_devs[] = {
@@ -109,7 +119,10 @@ static const struct pci_device_table amd_ntb_devs[] = 
 	  PCI_DESCR("AMD Non-Transparent Bridge") },
 	{ PCI_DEV(NTB_HW_AMD_VENDOR_ID, NTB_HW_AMD_DEVICE_ID2),
 	  .driver_data = (uintptr_t)&amd_ntb_hw_info_list[1],
-	  PCI_DESCR("AMD Non-Transparent Bridge") }
+	  PCI_DESCR("AMD Non-Transparent Bridge") },
+	{ PCI_DEV(NTB_HW_HYGON_VENDOR_ID, NTB_HW_HYGON_DEVICE_ID1),
+	  .driver_data = (uintptr_t)&amd_ntb_hw_info_list[0],
+	  PCI_DESCR("Hygon Non-Transparent Bridge") }
 };
 
 static unsigned g_amd_ntb_hw_debug_level;

Modified: head/sys/dev/ntb/ntb_hw/ntb_hw_amd.h
==============================================================================
--- head/sys/dev/ntb/ntb_hw/ntb_hw_amd.h	Fri Feb 14 14:55:40 2020	(r357919)
+++ head/sys/dev/ntb/ntb_hw/ntb_hw_amd.h	Fri Feb 14 15:04:56 2020	(r357920)
@@ -51,6 +51,9 @@
 #define	NTB_HW_AMD_DEVICE_ID1	0x145B
 #define	NTB_HW_AMD_DEVICE_ID2	0x148B
 
+#define	NTB_HW_HYGON_VENDOR_ID	0x19D4
+#define	NTB_HW_HYGON_DEVICE_ID1	0x145B
+
 #define	NTB_DEF_PEER_CNT	1
 #define	NTB_DEF_PEER_IDX	0