/* Scan the device and add it to the bus */
hp_slot->hp_pdev = pci_scan_single_device(hp_ctrl->pdev->bus,
hp_slot->hp_devfn);
pci_bus_assign_resources(hp_ctrl->pdev->bus);
pci_bus_add_device(hp_slot->hp_pdev);
/* * Enable or disable the slots based on the slot mask. * intr_val is a bit mask where each bit represents a slot.
*/
list_for_each_entry(hp_slot, &hp_ctrl->slot_list, list) { if (!(hp_cmd->intr_val & BIT(hp_slot->slot_number))) continue;
pci_info(hp_ctrl->pdev, "Received %s command for slot %s\n",
octep_hp_cmd_name(hp_cmd->intr_type),
hotplug_slot_name(&hp_slot->slot));
switch (hp_cmd->intr_type) { case OCTEP_HP_INTR_ENA:
octep_hp_enable_pdev(hp_ctrl, hp_slot); break; case OCTEP_HP_INTR_DIS:
octep_hp_disable_pdev(hp_ctrl, hp_slot); break; default: break;
}
}
}
/* Add the command to the list and schedule the work */
spin_lock(&hp_ctrl->hp_cmd_lock);
list_add_tail(&hp_cmd->list, &hp_ctrl->hp_cmd_list);
spin_unlock(&hp_ctrl->hp_cmd_lock);
schedule_work(&hp_ctrl->work);
ret = pci_alloc_irq_vectors(pdev, 1,
OCTEP_HP_INTR_VECTOR(OCTEP_HP_INTR_MAX),
PCI_IRQ_MSIX); if (ret < 0) return dev_err_probe(dev, ret, "Failed to alloc MSI-X vectors\n");
ret = devm_add_action(&pdev->dev, octep_hp_irq_cleanup, hp_ctrl); if (ret) return dev_err_probe(&pdev->dev, ret, "Failed to add IRQ cleanup action\n");
for (type = OCTEP_HP_INTR_ENA; type < OCTEP_HP_INTR_MAX; type++) {
ret = octep_hp_request_irq(hp_ctrl, type); if (ret) return dev_err_probe(dev, ret, "Failed to request IRQ for vector %d\n",
OCTEP_HP_INTR_VECTOR(type));
}
hp_ctrl = devm_kzalloc(&pdev->dev, sizeof(*hp_ctrl), GFP_KERNEL); if (!hp_ctrl) return -ENOMEM;
ret = octep_hp_controller_setup(pdev, hp_ctrl); if (ret) return ret;
/* * Register all hotplug slots. Hotplug controller is the first function * of the PCI device. The hotplug slots are the remaining functions of * the PCI device. The hotplug slot functions are logically removed from * the bus during probing and are re-enabled by the driver when a * hotplug event is received.
*/
list_for_each_entry_safe(tmp_pdev, next, &pdev->bus->devices, bus_list) { if (tmp_pdev == pdev) continue;
hp_slot = octep_hp_register_slot(hp_ctrl, tmp_pdev, slot_number); if (IS_ERR(hp_slot)) return dev_err_probe(&pdev->dev, PTR_ERR(hp_slot), "Failed to register hotplug slot %u\n",
slot_number);
ret = devm_add_action(&pdev->dev, octep_hp_deregister_slot,
hp_slot); if (ret) return dev_err_probe(&pdev->dev, ret, "Failed to add action for deregistering slot %u\n",
slot_number);
slot_number++;
}
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.