Revision 49823868

b/hw/pci.c
69 69
        DEFINE_PROP_PCI_DEVFN("addr", PCIDevice, devfn, -1),
70 70
        DEFINE_PROP_STRING("romfile", PCIDevice, romfile),
71 71
        DEFINE_PROP_UINT32("rombar",  PCIDevice, rom_bar, 1),
72
        DEFINE_PROP_BIT("multifunction", PCIDevice, cap_present,
73
                        QEMU_PCI_CAP_MULTIFUNCTION_BITNR, false),
72 74
        DEFINE_PROP_END_OF_LIST()
73 75
    }
74 76
};
......
1659 1661
    }
1660 1662
}
1661 1663

  
1662
PCIDevice *pci_create(PCIBus *bus, int devfn, const char *name)
1664
PCIDevice *pci_create_multifunction(PCIBus *bus, int devfn, bool multifunction,
1665
                                    const char *name)
1663 1666
{
1664 1667
    DeviceState *dev;
1665 1668

  
1666 1669
    dev = qdev_create(&bus->qbus, name);
1667 1670
    qdev_prop_set_uint32(dev, "addr", devfn);
1671
    qdev_prop_set_bit(dev, "multifunction", multifunction);
1668 1672
    return DO_UPCAST(PCIDevice, qdev, dev);
1669 1673
}
1670 1674

  
1671
PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name)
1675
PCIDevice *pci_create_simple_multifunction(PCIBus *bus, int devfn,
1676
                                           bool multifunction,
1677
                                           const char *name)
1672 1678
{
1673
    PCIDevice *dev = pci_create(bus, devfn, name);
1679
    PCIDevice *dev = pci_create_multifunction(bus, devfn, multifunction, name);
1674 1680
    qdev_init_nofail(&dev->qdev);
1675 1681
    return dev;
1676 1682
}
1677 1683

  
1684
PCIDevice *pci_create(PCIBus *bus, int devfn, const char *name)
1685
{
1686
    return pci_create_multifunction(bus, devfn, false, name);
1687
}
1688

  
1689
PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name)
1690
{
1691
    return pci_create_simple_multifunction(bus, devfn, false, name);
1692
}
1693

  
1678 1694
static int pci_find_space(PCIDevice *pdev, uint8_t size)
1679 1695
{
1680 1696
    int config_size = pci_config_size(pdev);
b/hw/pci.h
111 111
enum {
112 112
    QEMU_PCI_CAP_MSIX = 0x1,
113 113
    QEMU_PCI_CAP_EXPRESS = 0x2,
114

  
115
    /* multifunction capable device */
116
#define QEMU_PCI_CAP_MULTIFUNCTION_BITNR        2
117
    QEMU_PCI_CAP_MULTIFUNCTION = (1 << QEMU_PCI_CAP_MULTIFUNCTION_BITNR),
114 118
};
115 119

  
116 120
struct PCIDevice {
......
342 346
void pci_qdev_register(PCIDeviceInfo *info);
343 347
void pci_qdev_register_many(PCIDeviceInfo *info);
344 348

  
349
PCIDevice *pci_create_multifunction(PCIBus *bus, int devfn, bool multifunction,
350
                                    const char *name);
351
PCIDevice *pci_create_simple_multifunction(PCIBus *bus, int devfn,
352
                                           bool multifunction,
353
                                           const char *name);
345 354
PCIDevice *pci_create(PCIBus *bus, int devfn, const char *name);
346 355
PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name);
347 356

  

Also available in: Unified diff