Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x86/pci Add support for Ryzen 2xxx and 3xxx.



details:   https://anonhg.NetBSD.org/src/rev/8d9b8448b36b
branches:  trunk
changeset: 452634:8d9b8448b36b
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Thu Jul 18 08:53:41 2019 +0000

description:
Add support for Ryzen 2xxx and 3xxx.

diffstat:

 sys/arch/x86/pci/amdsmn.c |  25 ++++++++++++++++++++-----
 1 files changed, 20 insertions(+), 5 deletions(-)

diffs (60 lines):

diff -r 8b6091a057fa -r 8d9b8448b36b sys/arch/x86/pci/amdsmn.c
--- a/sys/arch/x86/pci/amdsmn.c Thu Jul 18 08:51:49 2019 +0000
+++ b/sys/arch/x86/pci/amdsmn.c Thu Jul 18 08:53:41 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdsmn.c,v 1.3 2018/01/27 21:24:30 kardel Exp $        */
+/*     $NetBSD: amdsmn.c,v 1.4 2019/07/18 08:53:41 msaitoh Exp $       */
 
 /*-
  * Copyright (c) 2017 Conrad Meyer <cem%FreeBSD.org@localhost>
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.3 2018/01/27 21:24:30 kardel Exp $ ");
+__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.4 2019/07/18 08:53:41 msaitoh Exp $ ");
 
 /*
  * Driver for the AMD Family 17h CPU System Management Network.
@@ -54,7 +54,6 @@
 
 #define        SMN_ADDR_REG    0x60
 #define        SMN_DATA_REG    0x64
-#define        AMD_17H_MANAGEMENT_NETWORK_PCI_ID       0x14501022
 
 struct amdsmn_softc {
        kmutex_t smn_lock;
@@ -63,6 +62,14 @@
        pcitag_t pcitag;
 };
 
+static const struct pciid {
+       uint16_t        amdsmn_deviceid;
+} amdsmn_ids[] = {
+       { PCI_PRODUCT_AMD_F17_RC },
+       { PCI_PRODUCT_AMD_F17_1X_RC },
+       { PCI_PRODUCT_AMD_F17_7X_RC },
+};
+
 static int amdsmn_match(device_t, cfdata_t, void *);
 static void amdsmn_attach(device_t, device_t, void *);
 static int amdsmn_rescan(device_t, const char *, const int *);
@@ -76,8 +83,16 @@
 amdsmn_match(device_t parent, cfdata_t match, void *aux) 
 {
        struct pci_attach_args *pa = aux;
-       
-       return pa->pa_id == AMD_17H_MANAGEMENT_NETWORK_PCI_ID ? 2 : 0;
+       int i;
+
+       if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_AMD)
+               return 0;
+
+       for (i = 0; i <  __arraycount(amdsmn_ids); i++)
+               if (PCI_PRODUCT(pa->pa_id) == amdsmn_ids[i].amdsmn_deviceid)
+                       return 2;
+
+       return 0;
 }
 
 static int 



Home | Main Index | Thread Index | Old Index