Convert memory_region_init*() calls that pass NULL owner to pass the enclosing machine or device instead.
Thread Object *owner through the static mcf5208_sys_init() helper. mcf5206_mbar_realize() already has DeviceState *dev in scope. No functional change intended. Assisted-by: Kiro Signed-off-by: Alexander Graf <[email protected]> --- hw/m68k/an5206.c | 2 +- hw/m68k/mcf5206.c | 2 +- hw/m68k/mcf5208.c | 15 ++++++++------- hw/m68k/next-cube.c | 10 +++++----- hw/m68k/q800.c | 10 +++++----- 5 files changed, 20 insertions(+), 19 deletions(-) diff --git a/hw/m68k/an5206.c b/hw/m68k/an5206.c index 5027311cad..6c6c7d7248 100644 --- a/hw/m68k/an5206.c +++ b/hw/m68k/an5206.c @@ -60,7 +60,7 @@ static void an5206_init(MachineState *machine) memory_region_add_subregion(address_space_mem, 0, machine->ram); /* Internal SRAM. */ - memory_region_init_ram(sram, NULL, "an5206.sram", 512, &error_fatal); + memory_region_init_ram(sram, OBJECT(machine), "an5206.sram", 512, &error_fatal); memory_region_add_subregion(address_space_mem, AN5206_RAMBAR_ADDR, sram); mcf5206_init(OBJECT(machine), cpu, address_space_mem, AN5206_MBAR_ADDR); diff --git a/hw/m68k/mcf5206.c b/hw/m68k/mcf5206.c index b3c745d3f9..ee39a6ac30 100644 --- a/hw/m68k/mcf5206.c +++ b/hw/m68k/mcf5206.c @@ -589,7 +589,7 @@ static void mcf5206_mbar_realize(DeviceState *dev, Error **errp) { m5206_mbar_state *s = MCF5206_MBAR(dev); - memory_region_init_io(&s->iomem, NULL, &m5206_mbar_ops, s, + memory_region_init_io(&s->iomem, OBJECT(dev), &m5206_mbar_ops, s, "mbar", 0x00001000); sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->iomem); diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c index a955efebeb..93aee5ebd5 100644 --- a/hw/m68k/mcf5208.c +++ b/hw/m68k/mcf5208.c @@ -227,7 +227,8 @@ static const MemoryRegionOps m5208_rcm_ops = { .endianness = DEVICE_BIG_ENDIAN, }; -static void mcf5208_sys_init(MemoryRegion *address_space, DeviceState *intc, +static void mcf5208_sys_init(Object *owner, MemoryRegion *address_space, + DeviceState *intc, M68kCPU *cpu) { MemoryRegion *iomem = g_new(MemoryRegion, 1); @@ -236,17 +237,17 @@ static void mcf5208_sys_init(MemoryRegion *address_space, DeviceState *intc, int i; /* RCM */ - memory_region_init_io(iomem_rcm, NULL, &m5208_rcm_ops, cpu, + memory_region_init_io(iomem_rcm, owner, &m5208_rcm_ops, cpu, "m5208-rcm", 0x00000080); memory_region_add_subregion(address_space, 0xfc0a0000, iomem_rcm); /* SDRAMC. */ - memory_region_init_io(iomem, NULL, &m5208_sys_ops, NULL, "m5208-sys", 0x00004000); + memory_region_init_io(iomem, owner, &m5208_sys_ops, NULL, "m5208-sys", 0x00004000); memory_region_add_subregion(address_space, 0xfc0a8000, iomem); /* Timers. */ for (i = 0; i < 2; i++) { s = g_new0(m5208_timer_state, 1); s->timer = ptimer_init(m5208_timer_trigger, s, PTIMER_POLICY_LEGACY); - memory_region_init_io(&s->iomem, NULL, &m5208_timer_ops, s, + memory_region_init_io(&s->iomem, owner, &m5208_timer_ops, s, "m5208-timer", 0x00004000); memory_region_add_subregion(address_space, 0xfc080000 + 0x4000 * i, &s->iomem); @@ -296,14 +297,14 @@ static void mcf5208evb_init(MachineState *machine) /* TODO: Configure BARs. */ /* ROM at 0x00000000 */ - memory_region_init_rom(rom, NULL, "mcf5208.rom", ROM_SIZE, &error_fatal); + memory_region_init_rom(rom, OBJECT(machine), "mcf5208.rom", ROM_SIZE, &error_fatal); memory_region_add_subregion(address_space_mem, 0x00000000, rom); /* DRAM at 0x40000000 */ memory_region_add_subregion(address_space_mem, 0x40000000, machine->ram); /* Internal SRAM. */ - memory_region_init_ram(sram, NULL, "mcf5208.sram", 16 * KiB, &error_fatal); + memory_region_init_ram(sram, OBJECT(machine), "mcf5208.sram", 16 * KiB, &error_fatal); memory_region_add_subregion(address_space_mem, 0x80000000, sram); /* Internal peripherals. */ @@ -316,7 +317,7 @@ static void mcf5208evb_init(MachineState *machine) mcf_uart_create_mmap(OBJECT(machine), 0xfc068000, qdev_get_gpio_in(intc, 28), serial_hd(2)); - mcf5208_sys_init(address_space_mem, intc, cpu); + mcf5208_sys_init(OBJECT(machine), address_space_mem, intc, cpu); mcf_fec_init(address_space_mem, 0xfc030000, intc); diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c index c80d32ef29..564a10a69e 100644 --- a/hw/m68k/next-cube.c +++ b/hw/m68k/next-cube.c @@ -1310,11 +1310,11 @@ static void next_cube_init(MachineState *machine) sysbus_mmio_map(SYS_BUS_DEVICE(pcdev), 5, 0x0211a000); /* BMAP memory */ - memory_region_init_ram_flags_nomigrate(&m->bmapm1, NULL, "next.bmapmem", + memory_region_init_ram_flags_nomigrate(&m->bmapm1, OBJECT(machine), "next.bmapmem", 64, RAM_SHARED, &error_fatal); memory_region_add_subregion(sysmem, 0x020c0000, &m->bmapm1); /* The Rev_2.5_v66.bin firmware accesses it at 0x820c0020, too */ - memory_region_init_alias(&m->bmapm2, NULL, "next.bmapmem2", &m->bmapm1, + memory_region_init_alias(&m->bmapm2, OBJECT(machine), "next.bmapmem2", &m->bmapm1, 0x0, 64); memory_region_add_subregion(sysmem, 0x820c0000, &m->bmapm2); @@ -1322,9 +1322,9 @@ static void next_cube_init(MachineState *machine) sysbus_create_simple(OBJECT(machine), "kbd", TYPE_NEXTKBD, 0x0200e000, NULL); /* Load ROM here */ - memory_region_init_rom(&m->rom, NULL, "next.rom", 0x20000, &error_fatal); + memory_region_init_rom(&m->rom, OBJECT(machine), "next.rom", 0x20000, &error_fatal); memory_region_add_subregion(sysmem, 0x01000000, &m->rom); - memory_region_init_alias(&m->rom2, NULL, "next.rom2", &m->rom, 0x0, + memory_region_init_alias(&m->rom2, OBJECT(machine), "next.rom2", &m->rom, 0x0, 0x20000); memory_region_add_subregion(sysmem, 0x0, &m->rom2); Error *local_err = NULL; @@ -1352,7 +1352,7 @@ static void next_cube_init(MachineState *machine) } /* DMA */ - memory_region_init_io(&m->dmamem, NULL, &next_dma_ops, machine, + memory_region_init_io(&m->dmamem, OBJECT(machine), &next_dma_ops, machine, "next.dma", 0x5000); memory_region_add_subregion(sysmem, 0x02000000, &m->dmamem); } diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index 15b3bcab5f..954cdf8489 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -309,7 +309,7 @@ static void q800_machine_init(MachineState *machine) memory_region_add_subregion(get_system_memory(), IO_BASE + IO_SLICE, &m->macio_alias); - memory_region_init_io(&m->machine_id, NULL, &machine_id_ops, NULL, + memory_region_init_io(&m->machine_id, OBJECT(machine), &machine_id_ops, NULL, "Machine ID", 4); memory_region_add_subregion(get_system_memory(), 0x5ffffffc, &m->machine_id); @@ -407,7 +407,7 @@ static void q800_machine_init(MachineState *machine) sysbus_connect_irq(sysbus, 0, qdev_get_gpio_in(DEVICE(&m->glue), GLUE_IRQ_IN_SONIC)); - memory_region_init_rom(&m->dp8393x_prom, NULL, "dp8393x-q800.prom", + memory_region_init_rom(&m->dp8393x_prom, OBJECT(machine), "dp8393x-q800.prom", SONIC_PROM_SIZE, &error_fatal); memory_region_add_subregion(get_system_memory(), SONIC_PROM_BASE, &m->dp8393x_prom); @@ -606,7 +606,7 @@ static void q800_machine_init(MachineState *machine) BOOTINFO1(param_ptr, BI_MAC_VROW, macfb_mode->stride); BOOTINFO1(param_ptr, BI_MAC_SCCBASE, SCC_BASE); - memory_region_init_ram_ptr(&m->rom, NULL, "m68k_fake_mac.rom", + memory_region_init_ram_ptr(&m->rom, OBJECT(machine), "m68k_fake_mac.rom", sizeof(fake_mac_rom), fake_mac_rom); memory_region_set_readonly(&m->rom, true); memory_region_add_subregion(get_system_memory(), MACROM_ADDR, &m->rom); @@ -651,12 +651,12 @@ static void q800_machine_init(MachineState *machine) } else { uint8_t *ptr; /* allocate and load BIOS */ - memory_region_init_rom(&m->rom, NULL, "m68k_mac.rom", MACROM_SIZE, + memory_region_init_rom(&m->rom, OBJECT(machine), "m68k_mac.rom", MACROM_SIZE, &error_abort); filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); memory_region_add_subregion(get_system_memory(), MACROM_ADDR, &m->rom); - memory_region_init_alias(&m->rom_alias, NULL, "m68k_mac.rom-alias", + memory_region_init_alias(&m->rom_alias, OBJECT(machine), "m68k_mac.rom-alias", &m->rom, 0, MACROM_SIZE); memory_region_add_subregion(get_system_memory(), 0x40000000, &m->rom_alias); -- 2.47.1
