diff mbox series

[v1,03/12] PCI: hotplug: add and expose link disable API

Message ID 20230119013602.607466-4-tianfei.zhang@intel.com (mailing list archive)
State New
Headers show
Series add FPGA hotplug manager driver | expand

Commit Message

Zhang, Tianfei Jan. 19, 2023, 1:35 a.m. UTC
When a PCIe-based FPGA card is reprogrammed, it temporarily
disappears from the PCIe bus. This needs to be managed to
avoid PCIe errors while the device is not present. Also,
re-probing and rescan the PCI devices must be performed after
loading the new images. Export functions from pciehp driver
necessary for disable and enable the PCI link of a PCI hotplug
bridge.

Signed-off-by: Tianfei Zhang <tianfei.zhang@intel.com>
---
 drivers/pci/hotplug/pciehp.h     | 1 +
 drivers/pci/hotplug/pciehp_hpc.c | 6 ++++++
 2 files changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h
index c7f455a3b08f..8b58d0e84644 100644
--- a/drivers/pci/hotplug/pciehp.h
+++ b/drivers/pci/hotplug/pciehp.h
@@ -195,6 +195,7 @@  int pciehp_get_raw_indicator_status(struct hotplug_slot *h_slot, u8 *status);
 int pciehp_slot_reset(struct pcie_device *dev);
 
 int pciehp_link_enable(struct controller *ctrl);
+int pciehp_link_disable(struct controller *ctrl);
 
 static inline const char *slot_name(struct controller *ctrl)
 {
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 11e4bc58aec0..729546c0c1f9 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -353,6 +353,12 @@  int pciehp_link_enable(struct controller *ctrl)
 }
 EXPORT_SYMBOL_NS_GPL(pciehp_link_enable, PCIEHP);
 
+int pciehp_link_disable(struct controller *ctrl)
+{
+	return __pciehp_link_set(ctrl, false);
+}
+EXPORT_SYMBOL_NS_GPL(pciehp_link_disable, PCIEHP);
+
 int pciehp_get_raw_indicator_status(struct hotplug_slot *hotplug_slot,
 				    u8 *status)
 {