lasi: move register memory mapping from lasi.c to machine.c

The device register should be mapped directly by the board code.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Helge Deller <deller@gmx.de>
Message-Id: <20220504092600.10048-26-mark.cave-ayland@ilande.co.uk>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
diff --git a/hw/hppa/lasi.c b/hw/hppa/lasi.c
index c028b77..08ebe7c 100644
--- a/hw/hppa/lasi.c
+++ b/hw/hppa/lasi.c
@@ -304,10 +304,6 @@
     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 @@
 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 2fa55de..6618bce 100644
--- a/hw/hppa/machine.c
+++ b/hw/hppa/machine.c
@@ -139,7 +139,7 @@
     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 @@
 
 
     /* 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));