Module Name: src Committed By: msaitoh Date: Wed Feb 28 05:50:06 UTC 2018
Modified Files: src/sys/dev/acpi: acpi_mcfg.c src/sys/dev/pci: pci_quirks.c pcivar.h Log Message: - 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. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/acpi/acpi_mcfg.c cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pci/pci_quirks.c cvs rdiff -u -r1.109 -r1.110 src/sys/dev/pci/pcivar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/acpi/acpi_mcfg.c diff -u src/sys/dev/acpi/acpi_mcfg.c:1.4 src/sys/dev/acpi/acpi_mcfg.c:1.5 --- src/sys/dev/acpi/acpi_mcfg.c:1.4 Tue Jul 12 09:45:34 2016 +++ src/sys/dev/acpi/acpi_mcfg.c Wed Feb 28 05:50:06 2018 @@ -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 <non...@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_a 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_a } 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, Index: src/sys/dev/pci/pci_quirks.c diff -u src/sys/dev/pci/pci_quirks.c:1.9 src/sys/dev/pci/pci_quirks.c:1.10 --- src/sys/dev/pci/pci_quirks.c:1.9 Wed Aug 19 16:31:28 2009 +++ src/sys/dev/pci/pci_quirks.c Wed Feb 28 05:50:06 2018 @@ -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_qu 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 * Index: src/sys/dev/pci/pcivar.h diff -u src/sys/dev/pci/pcivar.h:1.109 src/sys/dev/pci/pcivar.h:1.110 --- src/sys/dev/pci/pcivar.h:1.109 Fri Nov 25 12:10:59 2016 +++ src/sys/dev/pci/pcivar.h Wed Feb 28 05:50:06 2018 @@ -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];