mirror of https://gitee.com/openkylin/qemu.git
qdev/pci: add pci_create_noinit()
Like pci_create_simple() but doesn't call qdev_init(), so one can set properties before initializing the device. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
parent
ffabf03718
commit
71077c1cb0
11
hw/pci.c
11
hw/pci.c
|
@ -923,15 +923,20 @@ void pci_qdev_register_many(PCIDeviceInfo *info)
|
|||
}
|
||||
}
|
||||
|
||||
PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name)
|
||||
PCIDevice *pci_create_noinit(PCIBus *bus, int devfn, const char *name)
|
||||
{
|
||||
DeviceState *dev;
|
||||
|
||||
dev = qdev_create(&bus->qbus, name);
|
||||
qdev_prop_set_uint32(dev, "addr", devfn);
|
||||
qdev_init(dev);
|
||||
return DO_UPCAST(PCIDevice, qdev, dev);
|
||||
}
|
||||
|
||||
return (PCIDevice *)dev;
|
||||
PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name)
|
||||
{
|
||||
PCIDevice *dev = pci_create_noinit(bus, devfn, name);
|
||||
qdev_init(&dev->qdev);
|
||||
return dev;
|
||||
}
|
||||
|
||||
static int pci_find_space(PCIDevice *pdev, uint8_t size)
|
||||
|
|
1
hw/pci.h
1
hw/pci.h
|
@ -328,6 +328,7 @@ void pci_qdev_register(PCIDeviceInfo *info);
|
|||
void pci_qdev_register_many(PCIDeviceInfo *info);
|
||||
|
||||
PCIDevice *pci_create(const char *name, const char *devaddr);
|
||||
PCIDevice *pci_create_noinit(PCIBus *bus, int devfn, const char *name);
|
||||
PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name);
|
||||
|
||||
/* lsi53c895a.c */
|
||||
|
|
Loading…
Reference in New Issue