aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2022-10-04 14:34:15 +0000
committerAlexander Motin <mav@FreeBSD.org>2022-10-18 01:02:36 +0000
commit03acc85e3f2aa5478ae6aa74dd5be7ed05d87a98 (patch)
treec4cf733c615b650dba1125f400839c068a26fb95 /sys/dev/pci
parent9f4b854c028b5b0395848683388fa78bd569405a (diff)
pci: Disable Electromechanical Interlock.
Add sysctl/tunable to control Electromechanical Interlock support. Disable it by default since Linux does not do it either and it seems the number of systems having it broken is higher than having working. This fixes NVMe backplane operation on ASUS RS500A-E11-RS12U server with AMD EPYC 7402 CPU, where attempts to control reported interlock for some reason end up in PCIe link loss, while interlock status does not change (it is not really there). MFC after: 2 weeks (cherry picked from commit a58536b91ae3931d222c3e4f1a949ff4a4927fb2)
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/pci_pci.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/dev/pci/pci_pci.c b/sys/dev/pci/pci_pci.c
index 0945606bbc50..b735da657a6c 100644
--- a/sys/dev/pci/pci_pci.c
+++ b/sys/dev/pci/pci_pci.c
@@ -1096,6 +1096,11 @@ pcib_hotplug_present(struct pcib_softc *sc)
return (-1);
}
+static int pci_enable_pcie_ei = 0;
+SYSCTL_INT(_hw_pci, OID_AUTO, enable_pcie_ei, CTLFLAG_RWTUN,
+ &pci_enable_pcie_ei, 0,
+ "Enable support for PCI-express Electromechanical Interlock.");
+
static void
pcib_pcie_hotplug_update(struct pcib_softc *sc, uint16_t val, uint16_t mask,
bool schedule_task)
@@ -1135,7 +1140,8 @@ pcib_pcie_hotplug_update(struct pcib_softc *sc, uint16_t val, uint16_t mask,
* process of detaching), disable the Electromechanical
* Interlock.
*/
- if (sc->pcie_slot_cap & PCIEM_SLOT_CAP_EIP) {
+ if ((sc->pcie_slot_cap & PCIEM_SLOT_CAP_EIP) &&
+ pci_enable_pcie_ei) {
mask |= PCIEM_SLOT_CTL_EIC;
ei_engaged = (sc->pcie_slot_sta & PCIEM_SLOT_STA_EIS) != 0;
if (card_inserted != ei_engaged)