Revision 070297d2

b/hw/pci.c
239 239
    return s->parent_dev->config[PCI_SECONDARY_BUS];
240 240
}
241 241

  
242
static uint8_t pci_sub_bus(PCIBus *s)
243
{
244
    if (!s->parent_dev)
245
        return 255;     /* pci host bridge */
246
    return s->parent_dev->config[PCI_SUBORDINATE_BUS];
247
}
248

  
249 242
static int get_pci_config_device(QEMUFile *f, void *pv, size_t size)
250 243
{
251 244
    PCIDevice *s = container_of(pv, PCIDevice, config);
......
1180 1173

  
1181 1174
    /* try child bus */
1182 1175
    QLIST_FOREACH(sec, &bus->child, sibling) {
1183
        if (pci_bus_num(sec) <= bus_num && bus_num <= pci_sub_bus(sec)) {
1176

  
1177
        if (!bus->parent_dev /* pci host bridge */
1178
            || (pci_bus_num(sec) <= bus_num &&
1179
                bus->parent_dev->config[PCI_SUBORDINATE_BUS])) {
1184 1180
            return pci_find_bus(sec, bus_num);
1185 1181
        }
1186 1182
    }

Also available in: Unified diff