diff --git a/hw/hppa/lasi.c b/hw/hppa/lasi.c index c028b7786e..08ebe7c6d9 100644 --- a/hw/hppa/lasi.c +++ b/hw/hppa/lasi.c @@ -304,10 +304,6 @@ DeviceState *lasi_initfn(MemoryRegion *address_space) dev = qdev_new(TYPE_LASI_CHIP); s = LASI_CHIP(dev); s->iar = CPU_HPA + 3; - - /* Lasi access from main memory. */ - memory_region_add_subregion(address_space, LASI_HPA, &s->this_mem); - sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); /* LAN */ @@ -348,9 +344,12 @@ DeviceState *lasi_initfn(MemoryRegion *address_space) static void lasi_init(Object *obj) { LasiState *s = LASI_CHIP(obj); + SysBusDevice *sbd = SYS_BUS_DEVICE(obj); memory_region_init_io(&s->this_mem, OBJECT(s), &lasi_chip_ops, s, "lasi", 0x100000); + + sysbus_init_mmio(sbd, &s->this_mem); } static void lasi_class_init(ObjectClass *klass, void *data) diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c index 2fa55de549..6618bce435 100644 --- a/hw/hppa/machine.c +++ b/hw/hppa/machine.c @@ -139,7 +139,7 @@ static void machine_hppa_init(MachineState *machine) const char *kernel_filename = machine->kernel_filename; const char *kernel_cmdline = machine->kernel_cmdline; const char *initrd_filename = machine->initrd_filename; - DeviceState *dev, *dino_dev; + DeviceState *dev, *dino_dev, *lasi_dev; PCIBus *pci_bus; ISABus *isa_bus; char *firmware_filename; @@ -175,7 +175,10 @@ static void machine_hppa_init(MachineState *machine) /* Init Lasi chip */ - lasi_initfn(addr_space); + lasi_dev = lasi_initfn(addr_space); + memory_region_add_subregion(addr_space, LASI_HPA, + sysbus_mmio_get_region( + SYS_BUS_DEVICE(lasi_dev), 0)); /* Init Dino (PCI host bus chip). */ dino_dev = DEVICE(dino_init(addr_space));