pci: use qbus_create in pci_bus_new
Remove knowledge of QOM innards. The common part of pci_bus_new and pci_bus_new_inplace is moved to a new function pci_bus_init. Acked-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
39355c3826
commit
4fec640446
21
hw/pci/pci.c
21
hw/pci/pci.c
@ -274,13 +274,12 @@ int pci_find_domain(const PCIBus *bus)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pci_bus_new_inplace(PCIBus *bus, DeviceState *parent,
|
static void pci_bus_init(PCIBus *bus, DeviceState *parent,
|
||||||
const char *name,
|
const char *name,
|
||||||
MemoryRegion *address_space_mem,
|
MemoryRegion *address_space_mem,
|
||||||
MemoryRegion *address_space_io,
|
MemoryRegion *address_space_io,
|
||||||
uint8_t devfn_min)
|
uint8_t devfn_min)
|
||||||
{
|
{
|
||||||
qbus_create_inplace(&bus->qbus, TYPE_PCI_BUS, parent, name);
|
|
||||||
assert(PCI_FUNC(devfn_min) == 0);
|
assert(PCI_FUNC(devfn_min) == 0);
|
||||||
bus->devfn_min = devfn_min;
|
bus->devfn_min = devfn_min;
|
||||||
bus->address_space_mem = address_space_mem;
|
bus->address_space_mem = address_space_mem;
|
||||||
@ -293,6 +292,17 @@ void pci_bus_new_inplace(PCIBus *bus, DeviceState *parent,
|
|||||||
vmstate_register(NULL, -1, &vmstate_pcibus, bus);
|
vmstate_register(NULL, -1, &vmstate_pcibus, bus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pci_bus_new_inplace(PCIBus *bus, DeviceState *parent,
|
||||||
|
const char *name,
|
||||||
|
MemoryRegion *address_space_mem,
|
||||||
|
MemoryRegion *address_space_io,
|
||||||
|
uint8_t devfn_min)
|
||||||
|
{
|
||||||
|
qbus_create_inplace(bus, TYPE_PCI_BUS, parent, name);
|
||||||
|
pci_bus_init(bus, parent, name, address_space_mem,
|
||||||
|
address_space_io, devfn_min);
|
||||||
|
}
|
||||||
|
|
||||||
PCIBus *pci_bus_new(DeviceState *parent, const char *name,
|
PCIBus *pci_bus_new(DeviceState *parent, const char *name,
|
||||||
MemoryRegion *address_space_mem,
|
MemoryRegion *address_space_mem,
|
||||||
MemoryRegion *address_space_io,
|
MemoryRegion *address_space_io,
|
||||||
@ -300,10 +310,9 @@ PCIBus *pci_bus_new(DeviceState *parent, const char *name,
|
|||||||
{
|
{
|
||||||
PCIBus *bus;
|
PCIBus *bus;
|
||||||
|
|
||||||
bus = g_malloc0(sizeof(*bus));
|
bus = PCI_BUS(qbus_create(TYPE_PCI_BUS, parent, name));
|
||||||
pci_bus_new_inplace(bus, parent, name, address_space_mem,
|
pci_bus_init(bus, parent, name, address_space_mem,
|
||||||
address_space_io, devfn_min);
|
address_space_io, devfn_min);
|
||||||
OBJECT(bus)->free = g_free;
|
|
||||||
return bus;
|
return bus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user