Date: Fri, 5 Aug 2016 18:41:51 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r303781 - stable/11/sys/dev/pci Message-ID: <201608051841.u75Ifp6M093873@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Fri Aug 5 18:41:51 2016 New Revision: 303781 URL: https://svnweb.freebsd.org/changeset/base/303781 Log: MFC 303497,303559,303645: Disable PCI-e hotplug on bridges with power controllers. 303497: Add a loader tunable (hw.pci.enable_pcie_hp) to disable PCI-e HotPlug. Some systems and/or devices (such as riser cards) do not include a non-compliant implementation of PCI-e HotPlug that can result in devices not being attached (e.g. the HotPlug code might assume that a card is being unplugged and will power the slot off and detach it). This tunable can be set to 0 to disable support for PCI-e HotPlug ignoring the incorrect HotPlug state on these slots. 303559: Try to declare _hw_pci for all sysctl cases needed after r303497. 303645: Disable PCI hotplug support for slots with power controllers. After further review of the spec, I do not think the current HotPlug code handles slots with power controllers correctly. In particular, the power state of the slot is to be inferred from other events, not from examining the state of the power control bit in SLOT_CTL. For now, disable PCI hotplug support on such slots. PR: 211081 Approved by: re (gjb) Modified: stable/11/sys/dev/pci/pci_pci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/pci/pci_pci.c ============================================================================== --- stable/11/sys/dev/pci/pci_pci.c Fri Aug 5 17:49:13 2016 (r303780) +++ stable/11/sys/dev/pci/pci_pci.c Fri Aug 5 18:41:51 2016 (r303781) @@ -128,9 +128,11 @@ static devclass_t pcib_devclass; DEFINE_CLASS_0(pcib, pcib_driver, pcib_methods, sizeof(struct pcib_softc)); DRIVER_MODULE(pcib, pci, pcib_driver, pcib_devclass, NULL, NULL); -#ifdef NEW_PCIB +#if defined(NEW_PCIB) || defined(PCI_HP) SYSCTL_DECL(_hw_pci); +#endif +#ifdef NEW_PCIB static int pci_clear_pcib; SYSCTL_INT(_hw_pci, OID_AUTO, clear_pcib, CTLFLAG_RDTUN, &pci_clear_pcib, 0, "Clear firmware-assigned resources for PCI-PCI bridge I/O windows."); @@ -907,11 +909,19 @@ pcib_set_mem_decode(struct pcib_softc *s /* * PCI-express HotPlug support. */ +static int pci_enable_pcie_hp = 1; +SYSCTL_INT(_hw_pci, OID_AUTO, enable_pcie_hp, CTLFLAG_RDTUN, + &pci_enable_pcie_hp, 0, + "Enable support for native PCI-express HotPlug."); + static void pcib_probe_hotplug(struct pcib_softc *sc) { device_t dev; + if (!pci_enable_pcie_hp) + return; + dev = sc->dev; if (pci_find_cap(dev, PCIY_EXPRESS, NULL) != 0) return; @@ -922,6 +932,13 @@ pcib_probe_hotplug(struct pcib_softc *sc sc->pcie_link_cap = pcie_read_config(dev, PCIER_LINK_CAP, 4); sc->pcie_slot_cap = pcie_read_config(dev, PCIER_SLOT_CAP, 4); + /* + * XXX: Handling of slots with a power controller needs to be + * reexamined. Ignore hotplug on such slots for now. + */ + if (sc->pcie_slot_cap & PCIEM_SLOT_CAP_PCP) + return; + if (sc->pcie_slot_cap & PCIEM_SLOT_CAP_HPC) sc->flags |= PCIB_HOTPLUG; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201608051841.u75Ifp6M093873>