/* Global variables */ bool pciehp_poll_mode; int pciehp_poll_time;
/* * not really modular, but the easiest way to keep compat with existing * bootargs behaviour is to continue using module_param here.
*/
module_param(pciehp_poll_mode, bool, 0644);
module_param(pciehp_poll_time, int, 0644);
MODULE_PARM_DESC(pciehp_poll_mode, "Using polling mechanism for hot-plug events or not");
MODULE_PARM_DESC(pciehp_poll_time, "Polling mechanism frequency, in seconds");
pci_config_pm_runtime_get(pdev);
ret = pciehp_card_present_or_link_active(ctrl);
pci_config_pm_runtime_put(pdev); if (ret < 0) return ret;
*value = ret; return 0;
}
/** * pciehp_check_presence() - synthesize event if presence has changed * @ctrl: controller to check * * On probe and resume, an explicit presence check is necessary to bring up an * occupied slot or bring down an unoccupied slot. This can't be triggered by * events in the Slot Status register, they may be stale and are therefore * cleared. Secondly, sending an interrupt for "events that occur while * interrupt generation is disabled [when] interrupt generation is subsequently * enabled" is optional per PCIe r4.0, sec 6.7.3.4.
*/ staticvoid pciehp_check_presence(struct controller *ctrl)
{ int occupied;
staticint pciehp_probe(struct pcie_device *dev)
{ int rc; struct controller *ctrl;
/* If this is not a "hotplug" service, we have no business here. */ if (dev->service != PCIE_PORT_SERVICE_HP) return -ENODEV;
if (!dev->port->subordinate) { /* Can happen if we run out of bus numbers during probe */
pci_err(dev->port, "Hotplug bridge without secondary bus, ignoring\n"); return -ENODEV;
}
/* Setup the slot information structures */
rc = init_slot(ctrl); if (rc) { if (rc == -EBUSY)
ctrl_warn(ctrl, "Slot already registered by another hotplug driver\n"); else
ctrl_err(ctrl, "Slot initialization failed (%d)\n", rc); goto err_out_release_ctlr;
}
/* Enable events after we have setup the data structures */
rc = pcie_init_notification(ctrl); if (rc) {
ctrl_err(ctrl, "Notification initialization failed (%d)\n", rc); goto err_out_free_ctrl_slot;
}
/* Publish to user space */
rc = pci_hp_add(&ctrl->hotplug_slot); if (rc) {
ctrl_err(ctrl, "Publication to user space failed (%d)\n", rc); goto err_out_shutdown_notification;
}
staticvoid pciehp_disable_interrupt(struct pcie_device *dev)
{ /* * Disable hotplug interrupt so that it does not trigger * immediately when the downstream link goes down.
*/ if (pme_is_native(dev))
pcie_disable_interrupt(get_service_data(dev));
}
#ifdef CONFIG_PM_SLEEP staticint pciehp_suspend(struct pcie_device *dev)
{ /* * If the port is already runtime suspended we can keep it that * way.
*/ if (dev_pm_skip_suspend(&dev->port->dev)) return 0;
/* pci_restore_state() just wrote to the Slot Control register */
ctrl->cmd_started = jiffies;
ctrl->cmd_busy = true;
/* clear spurious events from rediscovery of inserted card */ if (ctrl->state == ON_STATE || ctrl->state == BLINKINGOFF_STATE) {
pcie_clear_hotplug_events(ctrl);
/* * If hotplugged device was replaced with a different one * during system sleep, mark the old device disconnected * (to prevent its driver from accessing the new device) * and synthesize a Presence Detect Changed event.
*/ if (pciehp_device_replaced(ctrl)) {
ctrl_dbg(ctrl, "device replaced during system sleep\n");
pci_walk_bus(ctrl->pcie->port->subordinate,
pci_dev_set_disconnected, NULL);
pciehp_request(ctrl, PCI_EXP_SLTSTA_PDC);
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.