summaryrefslogtreecommitdiff
path: root/hw/pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/pci.c')
-rw-r--r--hw/pci.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/hw/pci.c b/hw/pci.c
index 44580790d3..e82965ff12 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -874,11 +874,6 @@ PCIBus *pci_bridge_init(PCIBus *bus, int devfn, uint16_t vid, uint16_t did,
return s->bus;
}
-typedef struct {
- DeviceInfo qdev;
- pci_qdev_initfn init;
-} PCIDeviceInfo;
-
static void pci_qdev_init(DeviceState *qdev, DeviceInfo *base)
{
PCIDevice *pci_dev = (PCIDevice *)qdev;
@@ -889,25 +884,26 @@ static void pci_qdev_init(DeviceState *qdev, DeviceInfo *base)
bus = FROM_QBUS(PCIBus, qdev_get_parent_bus(qdev));
devfn = qdev_get_prop_int(qdev, "devfn", -1);
pci_dev = do_pci_register_device(pci_dev, bus, "FIXME", devfn,
- NULL, NULL);//FIXME:config_read, config_write);
+ info->config_read, info->config_write);
assert(pci_dev);
info->init(pci_dev);
}
-void pci_qdev_register(const char *name, int size, pci_qdev_initfn init)
+void pci_qdev_register(PCIDeviceInfo *info)
{
- PCIDeviceInfo *info;
-
- info = qemu_mallocz(sizeof(*info));
- info->qdev.name = qemu_strdup(name);
- info->qdev.size = size;
- info->init = init;
info->qdev.init = pci_qdev_init;
info->qdev.bus_type = BUS_TYPE_PCI;
-
qdev_register(&info->qdev);
}
+void pci_qdev_register_many(PCIDeviceInfo *info)
+{
+ while (info->qdev.name) {
+ pci_qdev_register(info);
+ info++;
+ }
+}
+
PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name)
{
DeviceState *dev;