Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci ECN: Change Root Complex Event Collector Class Code



details:   https://anonhg.NetBSD.org/src/rev/3e26ab44ce36
branches:  trunk
changeset: 822327:3e26ab44ce36
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Tue Mar 14 08:27:13 2017 +0000

description:
ECN: Change Root Complex Event Collector Class Code
 - Old RCEC has subclass 0x06. It's the same as IOMMU. Read the type in PCIe
   extend capability to know whether it's RCEC or IOMMU.

diffstat:

 sys/dev/pci/pci_subr.c |  23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)

diffs (50 lines):

diff -r 0c623f0a54de -r 3e26ab44ce36 sys/dev/pci/pci_subr.c
--- a/sys/dev/pci/pci_subr.c    Tue Mar 14 08:25:35 2017 +0000
+++ b/sys/dev/pci/pci_subr.c    Tue Mar 14 08:27:13 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci_subr.c,v 1.165 2017/03/14 08:25:35 msaitoh Exp $   */
+/*     $NetBSD: pci_subr.c,v 1.166 2017/03/14 08:27:13 msaitoh Exp $   */
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.165 2017/03/14 08:25:35 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.166 2017/03/14 08:27:13 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -819,12 +819,31 @@
                if (class == classp->val)
                        break;
        }
+
+       /*
+        * ECN: Change Root Complex Event Collector Class Code
+        * Old RCEC has subclass 0x06. It's the same as IOMMU. Read the type
+        * in PCIe extend capability to know whether it's RCEC or IOMMU.
+        */
+       if ((class == PCI_CLASS_SYSTEM)
+           && (subclass == PCI_SUBCLASS_SYSTEM_IOMMU)) {
+               int pcie_capoff;
+               pcireg_t reg;
+
+               if (pci_conf_find_cap(regs, PCI_CAPLISTPTR_REG,
+                   PCI_CAP_PCIEXPRESS, &pcie_capoff)) {
+                       reg = regs[o2i(pcie_capoff + PCIE_XCAP)];
+                       if (PCIE_XCAP_TYPE(reg) == PCIE_XCAP_TYPE_ROOT_EVNTC)
+                               subclass = PCI_SUBCLASS_SYSTEM_RCEC;
+               }
+       }
        subclassp = (classp->name != NULL) ? classp->subclasses : NULL;
        while (subclassp && subclassp->name != NULL) {
                if (subclass == subclassp->val)
                        break;
                subclassp++;
        }
+
        interfacep = (subclassp && subclassp->name != NULL) ?
            subclassp->subclasses : NULL;
        while (interfacep && interfacep->name != NULL) {



Home | Main Index | Thread Index | Old Index