From 25a57bd64b024462efe7b8cbd7ad9e701fd6c4c6 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Fri, 29 Jul 2016 17:54:21 +0000 Subject: [PATCH] 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. PR: 211081 Reported by: Sergey Renkas (SuperMicro X7 riser card) Reported by: Jeffrey E Pieper (Intel X520 adapter) MFC after: 1 week Relnotes: yes --- sys/dev/pci/pci_pci.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/dev/pci/pci_pci.c b/sys/dev/pci/pci_pci.c index 06e9e1c919a..9e42116c4e9 100644 --- a/sys/dev/pci/pci_pci.c +++ b/sys/dev/pci/pci_pci.c @@ -907,11 +907,19 @@ pcib_set_mem_decode(struct pcib_softc *sc) /* * 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;