/** *pci_vc_save_restore_dwords-Saveorrestoreaseriesofdwords *@dev:device *@pos:startingconfigspaceposition *@buf:buffertosavetoorrestorefrom *@dwords:numberofdwordstosave/restore *@save:whethertosaveorrestore
*/ staticvoid pci_vc_save_restore_dwords(struct pci_dev *dev, int pos,
u32 *buf, int dwords, bool save)
{ int i;
for (i = 0; i < dwords; i++, buf++) { if (save)
pci_read_config_dword(dev, pos + (i * 4), buf); else
pci_write_config_dword(dev, pos + (i * 4), *buf);
}
}
pci_read_config_dword(dev, ctrl_pos, &ctrl);
id = ctrl & PCI_VC_RES_CTRL_ID;
pci_read_config_dword(dev, pos, &header);
/* If there is no opposite end of the link, skip to enable */ if (PCI_EXT_CAP_ID(header) == PCI_EXT_CAP_ID_VC9 ||
pci_is_root_bus(dev->bus)) goto enable;
pos2 = pci_find_ext_capability(dev->bus->self, PCI_EXT_CAP_ID_VC); if (!pos2) goto enable;
/* VC0 is hardwired enabled, so we can start with 1 */ for (i = 1; i < evcc + 1; i++) {
ctrl_pos2 = pos2 + PCI_VC_RES_CTRL +
(i * PCI_CAP_VC_PER_VC_SIZEOF);
status_pos2 = pos2 + PCI_VC_RES_STATUS +
(i * PCI_CAP_VC_PER_VC_SIZEOF);
pci_read_config_dword(dev->bus->self, ctrl_pos2, &ctrl2); if ((ctrl2 & PCI_VC_RES_CTRL_ID) == id) {
link = dev->bus->self; break;
}
}
if (!link) goto enable;
/* Disable if enabled */ if (ctrl2 & PCI_VC_RES_CTRL_ENABLE) {
ctrl2 &= ~PCI_VC_RES_CTRL_ENABLE;
pci_write_config_dword(link, ctrl_pos2, ctrl2);
}
/* Enable on both ends */
ctrl2 |= PCI_VC_RES_CTRL_ENABLE;
pci_write_config_dword(link, ctrl_pos2, ctrl2);
enable:
ctrl |= PCI_VC_RES_CTRL_ENABLE;
pci_write_config_dword(dev, ctrl_pos, ctrl);
if (!pci_wait_for_pending(dev, status_pos, PCI_VC_RES_STATUS_NEGO))
pci_err(dev, "VC%d negotiation stuck pending\n", id);
/** *pci_save_vc_state-SaveVCstatetopre-allocatesavebuffer *@dev:device * *ForeachtypeofVCcapability,VC/VC9/MFVC,findthecapabilityand *saveittothepre-allocatedsavebuffer.
*/ int pci_save_vc_state(struct pci_dev *dev)
{ int i;
for (i = 0; i < ARRAY_SIZE(vc_caps); i++) { int pos, ret; struct pci_cap_saved_state *save_state;
pos = pci_find_ext_capability(dev, vc_caps[i].id); if (!pos) continue;
save_state = pci_find_saved_ext_cap(dev, vc_caps[i].id); if (!save_state) {
pci_err(dev, "%s buffer not found in %s\n",
vc_caps[i].name, __func__); return -ENOMEM;
}
ret = pci_vc_do_save_buffer(dev, pos, save_state, true); if (ret) {
pci_err(dev, "%s save unsuccessful %s\n",
vc_caps[i].name, __func__); return ret;
}
}
for (i = 0; i < ARRAY_SIZE(vc_caps); i++) { int len, pos = pci_find_ext_capability(dev, vc_caps[i].id);
if (!pos) continue;
len = pci_vc_do_save_buffer(dev, pos, NULL, false); if (pci_add_ext_cap_save_buffer(dev, vc_caps[i].id, len))
pci_err(dev, "unable to preallocate %s save buffer\n",
vc_caps[i].name);
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.12 Sekunden
(vorverarbeitet am 2026-09-29)
¤
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.