Revision e327e323 hw/pci.c

b/hw/pci.c
605 605
                                         const char *name, int devfn,
606 606
                                         PCIConfigReadFunc *config_read,
607 607
                                         PCIConfigWriteFunc *config_write,
608
                                         uint8_t header_type)
608
                                         bool is_bridge)
609 609
{
610 610
    if (devfn < 0) {
611 611
        for(devfn = bus->devfn_min ; devfn < ARRAY_SIZE(bus->devices);
......
627 627
    pci_dev->irq_state = 0;
628 628
    pci_config_alloc(pci_dev);
629 629

  
630
    header_type &= ~PCI_HEADER_TYPE_MULTI_FUNCTION;
631
    if (header_type == PCI_HEADER_TYPE_NORMAL) {
630
    if (!is_bridge) {
632 631
        pci_set_default_subsystem_id(pci_dev);
633 632
    }
634 633
    pci_init_cmask(pci_dev);
635 634
    pci_init_wmask(pci_dev);
636
    if (header_type == PCI_HEADER_TYPE_BRIDGE) {
635
    if (is_bridge) {
637 636
        pci_init_wmask_bridge(pci_dev);
638 637
    }
639 638

  
......
1563 1562
    pci_set_word(dev->config + PCI_STATUS,
1564 1563
                 PCI_STATUS_66MHZ | PCI_STATUS_FAST_BACK);
1565 1564
    pci_config_set_class(dev->config, PCI_CLASS_BRIDGE_PCI);
1566
    dev->config[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_BRIDGE;
1565
    dev->config[PCI_HEADER_TYPE] =
1566
        (dev->config[PCI_HEADER_TYPE] & PCI_HEADER_TYPE_MULTI_FUNCTION) |
1567
        PCI_HEADER_TYPE_BRIDGE;
1567 1568
    pci_set_word(dev->config + PCI_SEC_STATUS,
1568 1569
                 PCI_STATUS_66MHZ | PCI_STATUS_FAST_BACK);
1569 1570
    return 0;
......
1614 1615
    devfn = pci_dev->devfn;
1615 1616
    pci_dev = do_pci_register_device(pci_dev, bus, base->name, devfn,
1616 1617
                                     info->config_read, info->config_write,
1617
                                     info->header_type);
1618
                                     info->is_bridge);
1618 1619
    if (pci_dev == NULL)
1619 1620
        return -1;
1620 1621
    rc = info->init(pci_dev);
......
1890 1891
    .init         = pci_bridge_initfn,
1891 1892
    .exit         = pci_bridge_exitfn,
1892 1893
    .config_write = pci_bridge_write_config,
1893
    .header_type  = PCI_HEADER_TYPE_BRIDGE,
1894
    .is_bridge    = 1,
1894 1895
    .qdev.props   = (Property[]) {
1895 1896
        DEFINE_PROP_HEX32("vendorid", PCIBridge, vid, 0),
1896 1897
        DEFINE_PROP_HEX32("deviceid", PCIBridge, did, 0),

Also available in: Unified diff