Source-Changes-HG archive

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

[src/trunk]: src/sys/dev - Add new PCI quirk PCI_QUIRK_HASEXTCNF and PCI_QUIR...



details:   https://anonhg.NetBSD.org/src/rev/c765a855bb38
branches:  trunk
changeset: 830180:c765a855bb38
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Feb 28 05:50:06 2018 +0000

description:
- Add new PCI quirk PCI_QUIRK_HASEXTCNF and PCI_QUIRK_NOEXTCNF. Some devices'
  extended configuration area may be broken or violate spec. If an extended
  configuration space is strange but it really exist, use PCI_QUIRK_HASEXTCNF.
  If an extended configuration space is plausible to exist but it really
  doesn't exist, use PCI_QUIRK_NOEXTCNF.
- Add PCI_PRODUCT_INTEL_XEOND_MEM_0_TTR_1(0x6fa8) and
  PCI_PRODUCT_INTEL_COREI76K_IMC_0(0x6f68) with PCI_QUIRK_HASEXTCNF. The
  document clearly states they violate spec and it support the extended
  configuration space.

diffstat:

 sys/dev/acpi/acpi_mcfg.c |  20 ++++++++++++++++----
 sys/dev/pci/pci_quirks.c |   8 ++++++--
 sys/dev/pci/pcivar.h     |   8 +++++---
 3 files changed, 27 insertions(+), 9 deletions(-)

diffs (107 lines):

diff -r d699cd6d1373 -r c765a855bb38 sys/dev/acpi/acpi_mcfg.c
--- a/sys/dev/acpi/acpi_mcfg.c  Wed Feb 28 05:47:00 2018 +0000
+++ b/sys/dev/acpi/acpi_mcfg.c  Wed Feb 28 05:50:06 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpi_mcfg.c,v 1.4 2016/07/12 09:45:34 hannken Exp $    */
+/*     $NetBSD: acpi_mcfg.c,v 1.5 2018/02/28 05:50:06 msaitoh Exp $    */
 
 /*-
  * Copyright (C) 2015 NONAKA Kimihiro <nonaka%NetBSD.org@localhost>
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_mcfg.c,v 1.4 2016/07/12 09:45:34 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_mcfg.c,v 1.5 2018/02/28 05:50:06 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -464,6 +464,9 @@
        int func = pa->pa_function;
        int last_dev, last_func, end_func;
        int alias = 0;
+       const struct pci_quirkdata *qd;
+       bool force_hasextcnf = false;
+       bool force_noextcnf = false;
        int i, j;
 
        seg = acpimcfg_get_segment(bus);
@@ -488,9 +491,18 @@
        }
        mb->last_probed = tag;
 
+       reg = pci_conf_read(pc, tag, PCI_ID_REG);
+       qd = pci_lookup_quirkdata(PCI_VENDOR(reg), PCI_PRODUCT(reg));
+       if (qd != NULL && (qd->quirks & PCI_QUIRK_HASEXTCNF) != 0)
+               force_hasextcnf = true;
+       if (qd != NULL && (qd->quirks & PCI_QUIRK_NOEXTCNF) != 0)
+               force_noextcnf = true;
+       
        /* Probe extended configuration space. */
-       if (((reg = pci_conf_read(pc, tag, PCI_CONF_SIZE)) == (pcireg_t)-1) ||
-           (reg == 0) || (alias = acpimcfg_ext_conf_is_aliased(pc, tag))) {
+       if ((!force_hasextcnf) && ((force_noextcnf) ||
+               ((reg = pci_conf_read(pc, tag, PCI_CONF_SIZE)) == (pcireg_t)-1)
+               || (reg == 0)
+               || (alias = acpimcfg_ext_conf_is_aliased(pc, tag)))) {
                aprint_debug_dev(acpi_sc->sc_dev,
                    "MCFG: %03d:%02d:%d: invalid config space "
                    "(cfg[0x%03x]=0x%08x, alias=%s)\n", bus, dev, func,
diff -r d699cd6d1373 -r c765a855bb38 sys/dev/pci/pci_quirks.c
--- a/sys/dev/pci/pci_quirks.c  Wed Feb 28 05:47:00 2018 +0000
+++ b/sys/dev/pci/pci_quirks.c  Wed Feb 28 05:50:06 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci_quirks.c,v 1.9 2009/08/19 16:31:28 pgoyette Exp $  */
+/*     $NetBSD: pci_quirks.c,v 1.10 2018/02/28 05:50:06 msaitoh Exp $  */
 
 /*
  * Copyright (c) 1998 Christopher G. Demetriou.  All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_quirks.c,v 1.9 2009/08/19 16:31:28 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_quirks.c,v 1.10 2018/02/28 05:50:06 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -49,6 +49,10 @@
            PCI_QUIRK_MULTIFUNCTION },
        { PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_XBOX_PCHB,
            PCI_QUIRK_SKIP_FUNC1 | PCI_QUIRK_SKIP_FUNC2 },
+       { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XEOND_MEM_0_TTR_1,
+           PCI_QUIRK_HASEXTCNF },
+       { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_COREI76K_IMC_0,
+           PCI_QUIRK_HASEXTCNF },
 };
 
 const struct pci_quirkdata *
diff -r d699cd6d1373 -r c765a855bb38 sys/dev/pci/pcivar.h
--- a/sys/dev/pci/pcivar.h      Wed Feb 28 05:47:00 2018 +0000
+++ b/sys/dev/pci/pcivar.h      Wed Feb 28 05:50:06 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pcivar.h,v 1.109 2016/11/25 12:10:59 knakahara Exp $   */
+/*     $NetBSD: pcivar.h,v 1.110 2018/02/28 05:50:06 msaitoh Exp $     */
 
 /*
  * Copyright (c) 1996, 1997 Christopher G. Demetriou.  All rights reserved.
@@ -208,8 +208,8 @@
        pci_product_id_t        product;        /* Product ID */
        int                     quirks;         /* quirks; see below */
 };
-#define        PCI_QUIRK_MULTIFUNCTION         1
-#define        PCI_QUIRK_MONOFUNCTION          2
+#define        PCI_QUIRK_MULTIFUNCTION         __BIT(0)
+#define        PCI_QUIRK_MONOFUNCTION          __BIT(1)
 #define        PCI_QUIRK_SKIP_FUNC(n)          (4 << n)
 #define        PCI_QUIRK_SKIP_FUNC0            PCI_QUIRK_SKIP_FUNC(0)
 #define        PCI_QUIRK_SKIP_FUNC1            PCI_QUIRK_SKIP_FUNC(1)
@@ -219,6 +219,8 @@
 #define        PCI_QUIRK_SKIP_FUNC5            PCI_QUIRK_SKIP_FUNC(5)
 #define        PCI_QUIRK_SKIP_FUNC6            PCI_QUIRK_SKIP_FUNC(6)
 #define        PCI_QUIRK_SKIP_FUNC7            PCI_QUIRK_SKIP_FUNC(7)
+#define        PCI_QUIRK_HASEXTCNF             __BIT(10)
+#define        PCI_QUIRK_NOEXTCNF              __BIT(11)
 
 struct pci_conf_state {
        pcireg_t reg[16];



Home | Main Index | Thread Index | Old Index