Revision e075e788 hw/pci.c

b/hw/pci.c
200 200
    return NULL;
201 201
}
202 202

  
203
int pci_find_domain(const PCIBus *bus)
204
{
205
    PCIDevice *d;
206
    struct PCIHostBus *host;
207

  
208
    /* obtain root bus */
209
    while ((d = bus->parent_dev) != NULL) {
210
        bus = d->bus;
211
    }
212

  
213
    QLIST_FOREACH(host, &host_buses, next) {
214
        if (host->bus == bus) {
215
            return host->domain;
216
        }
217
    }
218

  
219
    abort();    /* should not be reached */
220
    return -1;
221
}
222

  
203 223
void pci_bus_new_inplace(PCIBus *bus, DeviceState *parent,
204 224
                         const char *name, int devfn_min)
205 225
{
......
505 525
    }
506 526

  
507 527
    *devfnp = slot << 3;
508
    return pci_find_bus(pci_find_root_bus(0), bus);
528
    return pci_find_bus(pci_find_root_bus(dom), bus);
509 529
}
510 530

  
511 531
static void pci_init_cmask(PCIDevice *dev)

Also available in: Unified diff