/* zpci_bus_prepare_device - Prepare a zPCI function for scanning *@zdev:thezPCIfunctiontobeprepared * *ThePCIresourcesforthefunctionaresetupandaddedtoitszbusandthe *functionisenabled.Thefunctionmustbeaddedtoazbuswhichmusthave *aPCIbuscreated.IfanerroroccursthezPCIfunctionisnotenabled. * *Return:0onsuccess,anerrorcodeotherwise
*/ staticint zpci_bus_prepare_device(struct zpci_dev *zdev)
{ int rc, i;
if (!zdev_enabled(zdev)) {
rc = zpci_enable_device(zdev); if (rc) return rc;
}
if (!zdev->has_resources) {
zpci_setup_bus_resources(zdev); for (i = 0; i < PCI_STD_NUM_BARS; i++) { if (zdev->bars[i].res)
pci_bus_add_resource(zdev->zbus->bus, zdev->bars[i].res);
}
}
return0;
}
/* zpci_bus_scan_device - Scan a single device adding it to the PCI core *@zdev:thezdevtobescanned * *ScansthePCIfunctionmakingitavailabletothecommonPCIcode. * *Return:0onsuccess,anerrorvalueotherwise
*/ int zpci_bus_scan_device(struct zpci_dev *zdev)
{ struct pci_dev *pdev; int rc;
rc = zpci_bus_prepare_device(zdev); if (rc) return rc;
pdev = pci_scan_single_device(zdev->zbus->bus, zdev->devfn); if (!pdev) return -ENODEV;
/* zpci_bus_scan_bus - Scan all configured zPCI functions on the bus *@zbus:thezbustobescanned * *EnablesandscansallPCIfunctionsonthebusmakingthemavailabletothe *commonPCIcode.IfaPCIfunctionfailstobeinitializedanerrorwillbe *returnedbutattemptswillstillbemadeforallotherfunctionsonthebus. * *Return:0onsuccess,anerrorvalueotherwise
*/ int zpci_bus_scan_bus(struct zpci_bus *zbus)
{ struct zpci_dev *zdev; int devfn, rc, ret = 0;
for (devfn = 0; devfn < ZPCI_FUNCTIONS_PER_BUS; devfn++) {
zdev = zbus->function[devfn]; if (zdev && zdev->state == ZPCI_FN_STATE_CONFIGURED) {
rc = zpci_bus_prepare_device(zdev); if (rc)
ret = -EIO;
}
}
if (zbus->multifunction) { if (!zdev->rid_available) {
WARN_ONCE(1, "rid_available not set for multifunction\n"); return rc;
}
zdev->devfn = zdev->rid & ZPCI_RID_MASK_DEVFN;
}
if (zbus->function[zdev->devfn]) {
pr_err("devfn %04x is already assigned\n", zdev->devfn); return rc;
}
zdev->zbus = zbus;
zbus->function[zdev->devfn] = zdev;
zpci_nb_devices++;
rc = zpci_init_slot(zdev); if (rc) goto error;
zdev->has_hp_slot = 1;
if (zpci_nb_devices == ZPCI_NR_DEVICES) {
pr_warn("Adding PCI function %08x failed because the configured limit of %d is reached\n",
zdev->fid, ZPCI_NR_DEVICES); return -ENOSPC;
}
if (!zbus) {
zbus = zpci_bus_alloc(topo, topo_is_tid); if (!zbus) return -ENOMEM;
}
if (!zbus->bus) { /* The UID of the first PCI function registered with a zpci_bus *isusedasthedomainnumberforthatbus.Currentlythere *isexactlyonezpci_busperdomain.
*/
rc = zpci_bus_create_pci_bus(zbus, zdev, ops); if (rc) goto error;
}
rc = zpci_bus_add_device(zbus, zdev); if (rc) goto error;
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.