Source-Changes-HG archive

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

[src/netbsd-8]: src/sys/arch/x86/pci Pull up following revision(s) (requested...



details:   https://anonhg.NetBSD.org/src/rev/fca87236e04a
branches:  netbsd-8
changeset: 453760:fca87236e04a
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Aug 06 16:05:11 2019 +0000

description:
Pull up following revision(s) (requested by msaitoh in ticket #1328):

        sys/arch/x86/pci/amdsmn.c: revision 1.4
        sys/arch/x86/pci/amdsmn.c: revision 1.5
        sys/arch/x86/pci/amdsmn.c: revision 1.6

Add support for Ryzen 2xxx and 3xxx.

Use unsigned to fix compile error on i386.

Whitespace fix.

diffstat:

 sys/arch/x86/pci/amdsmn.c |  39 +++++++++++++++++++++++++++------------
 1 files changed, 27 insertions(+), 12 deletions(-)

diffs (93 lines):

diff -r b5d28b6739f7 -r fca87236e04a sys/arch/x86/pci/amdsmn.c
--- a/sys/arch/x86/pci/amdsmn.c Tue Aug 06 16:02:54 2019 +0000
+++ b/sys/arch/x86/pci/amdsmn.c Tue Aug 06 16:05:11 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdsmn.c,v 1.3.2.3 2018/02/06 09:05:27 martin Exp $    */
+/*     $NetBSD: amdsmn.c,v 1.3.2.4 2019/08/06 16:05:11 martin 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.2.3 2018/02/06 09:05:27 martin Exp $ ");
+__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.3.2.4 2019/08/06 16:05:11 martin 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 *);
@@ -71,17 +78,25 @@
 
 CFATTACH_DECL3_NEW(amdsmn, sizeof(struct amdsmn_softc), amdsmn_match,
     amdsmn_attach, amdsmn_detach, NULL, amdsmn_rescan, NULL, 0);
-    
+
 static int
-amdsmn_match(device_t parent, cfdata_t match, void *aux) 
+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;
+       unsigned 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 
-amdsmn_misc_search(device_t parent, cfdata_t cf, const int *locs, void *aux) 
+static int
+amdsmn_misc_search(device_t parent, cfdata_t cf, const int *locs, void *aux)
 {
        if (config_match(parent, cf, aux))
                config_attach_loc(parent, cf, locs, aux, NULL);
@@ -89,8 +104,8 @@
        return 0;
 }
 
-static void 
-amdsmn_attach(device_t parent, device_t self, void *aux) 
+static void
+amdsmn_attach(device_t parent, device_t self, void *aux)
 {
        struct amdsmn_softc *sc = device_private(self);
        struct pci_attach_args *pa = aux;
@@ -115,7 +130,7 @@
 }
 
 static int
-amdsmn_detach(device_t self, int flags) 
+amdsmn_detach(device_t self, int flags)
 {
        struct amdsmn_softc *sc = device_private(self);
 



Home | Main Index | Thread Index | Old Index