Convert memory_region_init*() calls that pass NULL owner to pass the enclosing machine instead. All sites are inside board init functions (MachineState *machine) or a helper that already carries an Object *parent from the earlier hw/mips device-parenting patch (malta_fpga_init).
No functional change intended. Assisted-by: Kiro Signed-off-by: Alexander Graf <[email protected]> --- hw/mips/boston.c | 8 ++++---- hw/mips/fuloong2e.c | 2 +- hw/mips/jazz.c | 16 ++++++++-------- hw/mips/loongson3_virt.c | 6 +++--- hw/mips/malta.c | 12 ++++++------ 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/hw/mips/boston.c b/hw/mips/boston.c index a156b218fb..f012f22307 100644 --- a/hw/mips/boston.c +++ b/hw/mips/boston.c @@ -711,7 +711,7 @@ static void boston_mach_init(MachineState *machine) sysbus_mmio_map_overlap(SYS_BUS_DEVICE(&s->cps), 0, 0, 1); flash = g_new(MemoryRegion, 1); - memory_region_init_rom(flash, NULL, "boston.flash", + memory_region_init_rom(flash, OBJECT(machine), "boston.flash", boston_memmap[BOSTON_FLASH].size, &error_fatal); memory_region_add_subregion_overlap(sys_mem, boston_memmap[BOSTON_FLASH].base, @@ -722,7 +722,7 @@ static void boston_mach_init(MachineState *machine) machine->ram, 0); ddr_low_alias = g_new(MemoryRegion, 1); - memory_region_init_alias(ddr_low_alias, NULL, "boston_low.ddr", + memory_region_init_alias(ddr_low_alias, OBJECT(machine), "boston_low.ddr", machine->ram, 0, MIN(machine->ram_size, (256 * MiB))); memory_region_add_subregion_overlap(sys_mem, 0, ddr_low_alias, 0); @@ -749,7 +749,7 @@ static void boston_mach_init(MachineState *machine) get_cps_irq(&s->cps, 0)); platreg = g_new(MemoryRegion, 1); - memory_region_init_io(platreg, NULL, &boston_platreg_ops, s, + memory_region_init_io(platreg, OBJECT(machine), &boston_platreg_ops, s, "boston-platregs", boston_memmap[BOSTON_PLATREG].size); memory_region_add_subregion_overlap(sys_mem, @@ -761,7 +761,7 @@ static void boston_mach_init(MachineState *machine) serial_hd(0), DEVICE_LITTLE_ENDIAN); lcd = g_new(MemoryRegion, 1); - memory_region_init_io(lcd, NULL, &boston_lcd_ops, s, "boston-lcd", 0x8); + memory_region_init_io(lcd, OBJECT(machine), &boston_lcd_ops, s, "boston-lcd", 0x8); memory_region_add_subregion_overlap(sys_mem, boston_memmap[BOSTON_LCD].base, lcd, 0); diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c index 1b105ca37c..29e6561f2a 100644 --- a/hw/mips/fuloong2e.c +++ b/hw/mips/fuloong2e.c @@ -245,7 +245,7 @@ static void mips_fuloong2e_init(MachineState *machine) memory_region_add_subregion(address_space_mem, 0, machine->ram); /* Boot ROM */ - memory_region_init_rom(bios, NULL, "fuloong2e.bios", BIOS_SIZE, + memory_region_init_rom(bios, OBJECT(machine), "fuloong2e.bios", BIOS_SIZE, &error_fatal); memory_region_add_subregion(address_space_mem, 0x1fc00000LL, bios); diff --git a/hw/mips/jazz.c b/hw/mips/jazz.c index cb24d8c00d..8999efb352 100644 --- a/hw/mips/jazz.c +++ b/hw/mips/jazz.c @@ -234,9 +234,9 @@ static void mips_jazz_init(MachineState *machine, /* allocate RAM */ memory_region_add_subregion(address_space, 0, machine->ram); - memory_region_init_rom(bios, NULL, "mips_jazz.bios", MAGNUM_BIOS_SIZE, + memory_region_init_rom(bios, OBJECT(machine), "mips_jazz.bios", MAGNUM_BIOS_SIZE, &error_fatal); - memory_region_init_alias(bios2, NULL, "mips_jazz.bios", bios, + memory_region_init_alias(bios2, OBJECT(machine), "mips_jazz.bios", bios, 0, MAGNUM_BIOS_SIZE); memory_region_add_subregion(address_space, 0x1fc00000LL, bios); memory_region_add_subregion(address_space, 0xfff00000LL, bios2); @@ -270,17 +270,17 @@ static void mips_jazz_init(MachineState *machine, sysbus_mmio_get_region(sysbus, 0)); memory_region_add_subregion(address_space, 0xf0000000, sysbus_mmio_get_region(sysbus, 1)); - memory_region_init_io(dma_dummy, NULL, &dma_dummy_ops, + memory_region_init_io(dma_dummy, OBJECT(machine), &dma_dummy_ops, NULL, "dummy_dma", 0x1000); memory_region_add_subregion(address_space, 0x8000d000, dma_dummy); - memory_region_init_rom(dp8393x_prom, NULL, "dp8393x-jazz.prom", + memory_region_init_rom(dp8393x_prom, OBJECT(machine), "dp8393x-jazz.prom", SONIC_PROM_SIZE, &error_fatal); memory_region_add_subregion(address_space, 0x8000b000, dp8393x_prom); /* ISA bus: IO space at 0x90000000, mem space at 0x91000000 */ - memory_region_init(isa_io, NULL, "isa-io", 0x00010000); - memory_region_init(isa_mem, NULL, "isa-mem", 0x01000000); + memory_region_init(isa_io, OBJECT(machine), "isa-io", 0x00010000); + memory_region_init(isa_mem, OBJECT(machine), "isa-mem", 0x01000000); memory_region_add_subregion(address_space, 0x90000000, isa_io); memory_region_add_subregion(address_space, 0x91000000, isa_mem); isa_bus = isa_bus_new_bridge(OBJECT(machine), isa_mem, isa_io, &error_abort); @@ -306,7 +306,7 @@ static void mips_jazz_init(MachineState *machine, { /* Simple ROM, so user doesn't have to provide one */ MemoryRegion *rom_mr = g_new(MemoryRegion, 1); - memory_region_init_rom(rom_mr, NULL, "g364fb.rom", 0x80000, + memory_region_init_rom(rom_mr, OBJECT(machine), "g364fb.rom", 0x80000, &error_fatal); uint8_t *rom = memory_region_get_ram_ptr(rom_mr); memory_region_add_subregion(address_space, 0x60000000, rom_mr); @@ -357,7 +357,7 @@ static void mips_jazz_init(MachineState *machine, /* Real time clock */ mc146818_rtc_init(OBJECT(machine), isa_bus, 1980, NULL); - memory_region_init_io(rtc, NULL, &rtc_ops, NULL, "rtc", 0x1000); + memory_region_init_io(rtc, OBJECT(machine), &rtc_ops, NULL, "rtc", 0x1000); memory_region_add_subregion(address_space, 0x80004000, rtc); /* Keyboard (i8042) */ diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c index 93c14026ab..97d097373d 100644 --- a/hw/mips/loongson3_virt.c +++ b/hw/mips/loongson3_virt.c @@ -586,11 +586,11 @@ static void mips_loongson3_virt_init(MachineState *machine) assert(cpu); /* This variable points to the first created cpu. */ /* Allocate RAM/BIOS, 0x00000000~0x10000000 is alias of 0x80000000~0x90000000 */ - memory_region_init_rom(bios, NULL, "loongson3.bios", + memory_region_init_rom(bios, OBJECT(machine), "loongson3.bios", virt_memmap[VIRT_BIOS_ROM].size, &error_fatal); - memory_region_init_alias(ram, NULL, "loongson3.lowmem", + memory_region_init_alias(ram, OBJECT(machine), "loongson3.lowmem", machine->ram, 0, virt_memmap[VIRT_LOWMEM].size); - memory_region_init_io(iomem, NULL, &loongson3_pm_ops, + memory_region_init_io(iomem, OBJECT(machine), &loongson3_pm_ops, NULL, "loongson3_pm", virt_memmap[VIRT_PM].size); qemu_register_wakeup_support(); diff --git a/hw/mips/malta.c b/hw/mips/malta.c index 72bc97625f..e1d8c3b4dd 100644 --- a/hw/mips/malta.c +++ b/hw/mips/malta.c @@ -577,11 +577,11 @@ static MaltaFPGAState *malta_fpga_init(Object *parent, MemoryRegion *address_spa s = g_new0(MaltaFPGAState, 1); - memory_region_init_io(&s->iomem, NULL, &malta_fpga_ops, s, + memory_region_init_io(&s->iomem, parent, &malta_fpga_ops, s, "malta-fpga", 0x100000); - memory_region_init_alias(&s->iomem_lo, NULL, "malta-fpga", + memory_region_init_alias(&s->iomem_lo, parent, "malta-fpga", &s->iomem, 0, 0x900); - memory_region_init_alias(&s->iomem_hi, NULL, "malta-fpga", + memory_region_init_alias(&s->iomem_hi, parent, "malta-fpga", &s->iomem, 0xa00, 0x100000 - 0xa00); memory_region_add_subregion(address_space, base, &s->iomem_lo); @@ -1115,14 +1115,14 @@ void mips_malta_init(MachineState *machine) memory_region_add_subregion(system_memory, 0x80000000, machine->ram); /* alias for pre IO hole access */ - memory_region_init_alias(ram_low_preio, NULL, "mips_malta_low_preio.ram", + memory_region_init_alias(ram_low_preio, OBJECT(machine), "mips_malta_low_preio.ram", machine->ram, 0, MIN(ram_size, 256 * MiB)); memory_region_add_subregion(system_memory, 0, ram_low_preio); /* alias for post IO hole access, if there is enough RAM */ if (ram_size > 512 * MiB) { ram_low_postio = g_new(MemoryRegion, 1); - memory_region_init_alias(ram_low_postio, NULL, + memory_region_init_alias(ram_low_postio, OBJECT(machine), "mips_malta_low_postio.ram", machine->ram, 512 * MiB, ram_size - 512 * MiB); @@ -1213,7 +1213,7 @@ void mips_malta_init(MachineState *machine) * handled by an overlapping region as the resulting ROM code subpage * regions are not executable. */ - memory_region_init_ram(bios_copy, NULL, "bios.1fc", BIOS_SIZE, + memory_region_init_ram(bios_copy, OBJECT(machine), "bios.1fc", BIOS_SIZE, &error_fatal); if (!rom_copy(memory_region_get_ram_ptr(bios_copy), FLASH_ADDRESS, BIOS_SIZE)) { -- 2.47.1
