aboutsummaryrefslogtreecommitdiff
path: root/hw/pci-host
diff options
context:
space:
mode:
authorBernhard Beschow <shentey@gmail.com>2023-06-30 09:37:19 +0200
committerMichael S. Tsirkin <mst@redhat.com>2023-07-10 16:29:17 -0400
commitce5ac09a7548d90ac414f60bbe87c69a8487de10 (patch)
tree78de59b0d92d039c0b476dbcc021a392890360f1 /hw/pci-host
parentff0a8cc4bed6414ab09816b14e006a11140d0d73 (diff)
downloadqemu-ce5ac09a7548d90ac414f60bbe87c69a8487de10.zip
qemu-ce5ac09a7548d90ac414f60bbe87c69a8487de10.tar.gz
qemu-ce5ac09a7548d90ac414f60bbe87c69a8487de10.tar.bz2
hw/pci-host/i440fx: Resolve i440fx_init()
i440fx_init() is a legacy init function. The previous patches worked towards TYPE_I440FX_PCI_HOST_BRIDGE to be instantiated the QOM way. Do this now by transforming the parameters passed to i440fx_init() into property assignments. Signed-off-by: Bernhard Beschow <shentey@gmail.com> Message-Id: <20230630073720.21297-17-shentey@gmail.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Diffstat (limited to 'hw/pci-host')
-rw-r--r--hw/pci-host/i440fx.c33
1 files changed, 5 insertions, 28 deletions
diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c
index c458987..62d6287 100644
--- a/hw/pci-host/i440fx.c
+++ b/hw/pci-host/i440fx.c
@@ -249,9 +249,14 @@ static void i440fx_pcihost_initfn(Object *obj)
static void i440fx_pcihost_realize(DeviceState *dev, Error **errp)
{
+ ERRP_GUARD();
I440FXState *s = I440FX_PCI_HOST_BRIDGE(dev);
PCIHostState *phb = PCI_HOST_BRIDGE(dev);
SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
+ PCIBus *b;
+ PCIDevice *d;
+ PCII440FXState *f;
+ unsigned i;
memory_region_add_subregion(s->io_memory, 0xcf8, &phb->conf_mem);
sysbus_init_ioports(sbd, 0xcf8, 4);
@@ -262,36 +267,10 @@ static void i440fx_pcihost_realize(DeviceState *dev, Error **errp)
/* register i440fx 0xcf8 port as coalesced pio */
memory_region_set_flush_coalesced(&phb->data_mem);
memory_region_add_coalescing(&phb->conf_mem, 0, 4);
-}
-
-PCIBus *i440fx_init(const char *pci_type,
- DeviceState *dev,
- MemoryRegion *address_space_mem,
- MemoryRegion *address_space_io,
- ram_addr_t below_4g_mem_size,
- ram_addr_t above_4g_mem_size,
- MemoryRegion *pci_address_space,
- MemoryRegion *ram_memory)
-{
- I440FXState *s = I440FX_PCI_HOST_BRIDGE(dev);
- PCIHostState *phb = PCI_HOST_BRIDGE(dev);
- PCIBus *b;
- PCIDevice *d;
- PCII440FXState *f;
- unsigned i;
-
- s->system_memory = address_space_mem;
- s->io_memory = address_space_io;
- s->pci_address_space = pci_address_space;
- s->ram_memory = ram_memory;
- s->below_4g_mem_size = below_4g_mem_size;
- s->above_4g_mem_size = above_4g_mem_size;
- s->pci_type = (char *)pci_type;
b = pci_root_bus_new(dev, NULL, s->pci_address_space,
s->io_memory, 0, TYPE_PCI_BUS);
phb->bus = b;
- sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
d = pci_create_simple(b, 0, s->pci_type);
f = I440FX_PCI_DEVICE(d);
@@ -335,8 +314,6 @@ PCIBus *i440fx_init(const char *pci_type,
d->config[I440FX_COREBOOT_RAM_SIZE] = ram_size;
i440fx_update_memory_mappings(f);
-
- return b;
}
static void i440fx_class_init(ObjectClass *klass, void *data)