@@ -1126,9 +1126,8 @@ static int assigned_dev_register_msix_mmio(AssignedDevice *dev)
struct PCIDevice *init_assigned_device(AssignedDevInfo *adev,
const char *devaddr)
{
- printf("init_assigned_device: fix me please\n");
- return NULL;
-#if 0
+ PCIBus *bus;
+ int devfn;
int r;
AssignedDevice *dev;
PCIDevice *pci_dev;
@@ -1138,8 +1137,9 @@ struct PCIDevice *init_assigned_device(AssignedDevInfo *adev,
DEBUG("Registering real physical device %s (bus=%x dev=%x func=%x)\n",
adev->name, adev->bus, adev->dev, adev->func);
+ bus = pci_get_bus_devfn(&devfn, devaddr);
pci_dev = pci_register_device(bus, adev->name,
- sizeof(AssignedDevice), -1, assigned_dev_pci_read_config,
+ sizeof(AssignedDevice), devfn, assigned_dev_pci_read_config,
assigned_dev_pci_write_config);
dev = container_of(pci_dev, AssignedDevice, dev);
@@ -1203,7 +1203,6 @@ assigned_out:
out:
free_assigned_device(adev);
return NULL;
-#endif
}
/*
@@ -1268,7 +1267,7 @@ void add_assigned_devices(PCIBus *bus, const char **devices, int n_devices)
exit(1);
}
- if (!init_assigned_device(adev, bus)) {
+ if (!init_assigned_device(adev, NULL)) {
fprintf(stderr, "Failed to initialize assigned device %s\n",
devices[i]);
exit(1);
@@ -290,7 +290,7 @@ int pci_read_devaddr(const char *addr, int *domp, int *busp, unsigned *slotp)
return pci_parse_devaddr(devaddr, domp, busp, slotp);
}
-static PCIBus *pci_get_bus_devfn(int *devfnp, const char *devaddr)
+PCIBus *pci_get_bus_devfn(int *devfnp, const char *devaddr)
{
int dom, bus;
unsigned slot;
@@ -239,6 +239,7 @@ int pci_read_devaddr(const char *addr, int *domp, int *busp, unsigned *slotp);
int pci_parse_host_devaddr(const char *addr, int *busp,
int *slotp, int *funcp);
+PCIBus *pci_get_bus_devfn(int *devfnp, const char *devaddr);
void pci_info(Monitor *mon);
PCIBus *pci_bridge_init(PCIBus *bus, int devfn, uint16_t vid, uint16_t did,
Disabled in merge commit a3b371477e3. Signed-off-by: Markus Armbruster <armbru@redhat.com> --- hw/device-assignment.c | 11 +++++------ hw/pci.c | 2 +- hw/pci.h | 1 + 3 files changed, 7 insertions(+), 7 deletions(-)