Skip to content

Commit

Permalink
lasi: move memory region initialisation to new lasi_init() function
Browse files Browse the repository at this point in the history
Create a new lasi_init() instance initialisation function and move the LASI
memory region initialisation into it. Rename the existing lasi_init() function
to lasi_initfn() for now.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Helge Deller <deller@gmx.de>
Message-Id: <20220504092600.10048-25-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>
  • Loading branch information
mcayland committed May 8, 2022
1 parent 63588da commit 46f2594
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion hw/hppa/hppa_sys.h
Expand Up @@ -10,7 +10,7 @@

#include "hppa_hardware.h"

DeviceState *lasi_init(MemoryRegion *);
DeviceState *lasi_initfn(MemoryRegion *);
#define enable_lasi_lan() 0

/* hppa_pci.c. */
Expand Down
13 changes: 10 additions & 3 deletions hw/hppa/lasi.c
Expand Up @@ -296,7 +296,7 @@ static int lasi_get_irq(unsigned long hpa)
}
}

DeviceState *lasi_init(MemoryRegion *address_space)
DeviceState *lasi_initfn(MemoryRegion *address_space)
{
DeviceState *dev;
LasiState *s;
Expand All @@ -306,8 +306,6 @@ DeviceState *lasi_init(MemoryRegion *address_space)
s->iar = CPU_HPA + 3;

/* Lasi access from main memory. */
memory_region_init_io(&s->this_mem, OBJECT(s), &lasi_chip_ops,
s, "lasi", 0x100000);
memory_region_add_subregion(address_space, LASI_HPA, &s->this_mem);

sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
Expand Down Expand Up @@ -347,6 +345,14 @@ DeviceState *lasi_init(MemoryRegion *address_space)
return dev;
}

static void lasi_init(Object *obj)
{
LasiState *s = LASI_CHIP(obj);

memory_region_init_io(&s->this_mem, OBJECT(s), &lasi_chip_ops,
s, "lasi", 0x100000);
}

static void lasi_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
Expand All @@ -357,6 +363,7 @@ static void lasi_class_init(ObjectClass *klass, void *data)
static const TypeInfo lasi_pcihost_info = {
.name = TYPE_LASI_CHIP,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_init = lasi_init,
.instance_size = sizeof(LasiState),
.class_init = lasi_class_init,
};
Expand Down
2 changes: 1 addition & 1 deletion hw/hppa/machine.c
Expand Up @@ -175,7 +175,7 @@ static void machine_hppa_init(MachineState *machine)


/* Init Lasi chip */
lasi_init(addr_space);
lasi_initfn(addr_space);

/* Init Dino (PCI host bus chip). */
dino_dev = DEVICE(dino_init(addr_space));
Expand Down

0 comments on commit 46f2594

Please sign in to comment.