static int pcie_endpoint_cap_common_init(PCIDevice *dev, uint8_t offset, uint8_t cap_size) { uint8_t type = PCI_EXP_TYPE_ENDPOINT; Error *local_err = NULL; int ret; /* * Windows guests will report Code 10, device cannot start, if * a regular Endpoint type is exposed on a root complex. These * should instead be Root Complex Integrated Endpoints. */ if (pci_bus_is_express(pci_get_bus(dev)) && pci_bus_is_root(pci_get_bus(dev))) { type = PCI_EXP_TYPE_RC_END; } if (cap_size == PCI_EXP_VER1_SIZEOF) { return pcie_cap_v1_init(dev, offset, type, 0); } else { ret = pcie_cap_init(dev, offset, type, 0, &local_err); if (ret < 0) { error_report_err(local_err); } return ret; } }
int pcie_endpoint_cap_init(PCIDevice *dev, uint8_t offset) { uint8_t type = PCI_EXP_TYPE_ENDPOINT; /* * Windows guests will report Code 10, device cannot start, if * a regular Endpoint type is exposed on a root complex. These * should instead be Root Complex Integrated Endpoints. */ if (pci_bus_is_express(dev->bus) && pci_bus_is_root(dev->bus)) { type = PCI_EXP_TYPE_RC_END; } return pcie_cap_init(dev, offset, type, 0); }