summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authormsaitoh <msaitoh@NetBSD.org>2018-02-28 05:50:06 +0000
committermsaitoh <msaitoh@NetBSD.org>2018-02-28 05:50:06 +0000
commit5ca9d74117083395a426fc7bf7acd76fcc1e329d (patch)
treefe9cead8902f0606acd019085315a057e4393a3d /sys/dev
parent379f646b0d2fca461c4fbc6ce8ad1b61634e320a (diff)
- 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 (limited to 'sys/dev')
-rw-r--r--sys/dev/acpi/acpi_mcfg.c20
-rw-r--r--sys/dev/pci/pci_quirks.c8
-rw-r--r--sys/dev/pci/pcivar.h8
3 files changed, 27 insertions, 9 deletions
diff --git a/sys/dev/acpi/acpi_mcfg.c b/sys/dev/acpi/acpi_mcfg.c
index 04c8f033eef..3602690c46f 100644
--- a/sys/dev/acpi/acpi_mcfg.c
+++ b/sys/dev/acpi/acpi_mcfg.c
@@ -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>
@@ -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 @@ acpimcfg_device_probe(const struct pci_attach_args *pa)
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 @@ acpimcfg_device_probe(const struct pci_attach_args *pa)
}
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 --git a/sys/dev/pci/pci_quirks.c b/sys/dev/pci/pci_quirks.c
index 51e34385dcc..b21810a5817 100644
--- a/sys/dev/pci/pci_quirks.c
+++ b/sys/dev/pci/pci_quirks.c
@@ -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 @@ static const struct pci_quirkdata pci_quirks[] = {
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 --git a/sys/dev/pci/pcivar.h b/sys/dev/pci/pcivar.h
index 2276877d4ad..61783254769 100644
--- a/sys/dev/pci/pcivar.h
+++ b/sys/dev/pci/pcivar.h
@@ -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 @@ struct pci_quirkdata {
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 @@ struct pci_quirkdata {
#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];