summaryrefslogtreecommitdiffstats
path: root/hw/pci.c
diff options
context:
space:
mode:
authorIsaku Yamahata <yamahata@valinux.co.jp>2010-06-23 16:15:30 +0900
committerBlue Swirl <blauwirbel@gmail.com>2010-07-11 20:00:59 +0300
commit498238687fd3a2bf3efb32694732f88ceac72e99 (patch)
tree10fd1cca0fd960971145e5a4c0dd3a49fb3b7c91 /hw/pci.c
parentf4594a3be005ea96e276a1354184258f5ef3b8da (diff)
downloadhqemu-498238687fd3a2bf3efb32694732f88ceac72e99.zip
hqemu-498238687fd3a2bf3efb32694732f88ceac72e99.tar.gz
pci: introduce multifunction property.
introduce multifunction property. Also introduce new convenient device creation function which will be used later. For bisectability this patch doesn't do anything, but sets the property resulting in no functional changes. Actual changes will be introduced by later patch. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'hw/pci.c')
-rw-r--r--hw/pci.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/hw/pci.c b/hw/pci.c
index 81fff66..bbb14d3 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -69,6 +69,8 @@ static struct BusInfo pci_bus_info = {
DEFINE_PROP_PCI_DEVFN("addr", PCIDevice, devfn, -1),
DEFINE_PROP_STRING("romfile", PCIDevice, romfile),
DEFINE_PROP_UINT32("rombar", PCIDevice, rom_bar, 1),
+ DEFINE_PROP_BIT("multifunction", PCIDevice, cap_present,
+ QEMU_PCI_CAP_MULTIFUNCTION_BITNR, false),
DEFINE_PROP_END_OF_LIST()
}
};
@@ -1659,22 +1661,36 @@ void pci_qdev_register_many(PCIDeviceInfo *info)
}
}
-PCIDevice *pci_create(PCIBus *bus, int devfn, const char *name)
+PCIDevice *pci_create_multifunction(PCIBus *bus, int devfn, bool multifunction,
+ const char *name)
{
DeviceState *dev;
dev = qdev_create(&bus->qbus, name);
qdev_prop_set_uint32(dev, "addr", devfn);
+ qdev_prop_set_bit(dev, "multifunction", multifunction);
return DO_UPCAST(PCIDevice, qdev, dev);
}
-PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name)
+PCIDevice *pci_create_simple_multifunction(PCIBus *bus, int devfn,
+ bool multifunction,
+ const char *name)
{
- PCIDevice *dev = pci_create(bus, devfn, name);
+ PCIDevice *dev = pci_create_multifunction(bus, devfn, multifunction, name);
qdev_init_nofail(&dev->qdev);
return dev;
}
+PCIDevice *pci_create(PCIBus *bus, int devfn, const char *name)
+{
+ return pci_create_multifunction(bus, devfn, false, name);
+}
+
+PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name)
+{
+ return pci_create_simple_multifunction(bus, devfn, false, name);
+}
+
static int pci_find_space(PCIDevice *pdev, uint8_t size)
{
int config_size = pci_config_size(pdev);
OpenPOWER on IntegriCloud