Skip to content

Commit 3fab7f2

Browse files
philmdAMarkovic
authored andcommitted
hw/mips: Use memory_region_init_rom() with read-only regions
This commit was produced with the Coccinelle script scripts/coccinelle/memory-region-housekeeping.cocci. Reviewed-by: Aleksandar Markovic <[email protected]> Signed-off-by: Aleksandar Markovic <[email protected]> Message-Id: <[email protected]>
1 parent 0009b4f commit 3fab7f2

File tree

4 files changed

+5
-10
lines changed

4 files changed

+5
-10
lines changed

hw/mips/mips_fulong2e.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,9 +319,8 @@ static void mips_fulong2e_init(MachineState *machine)
319319
}
320320

321321
/* allocate RAM */
322-
memory_region_init_ram(bios, NULL, "fulong2e.bios", BIOS_SIZE,
322+
memory_region_init_rom(bios, NULL, "fulong2e.bios", BIOS_SIZE,
323323
&error_fatal);
324-
memory_region_set_readonly(bios, true);
325324

326325
memory_region_add_subregion(address_space_mem, 0, machine->ram);
327326
memory_region_add_subregion(address_space_mem, 0x1fc00000LL, bios);

hw/mips/mips_jazz.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,8 @@ static void mips_jazz_init(MachineState *machine,
197197
/* allocate RAM */
198198
memory_region_add_subregion(address_space, 0, machine->ram);
199199

200-
memory_region_init_ram(bios, NULL, "mips_jazz.bios", MAGNUM_BIOS_SIZE,
200+
memory_region_init_rom(bios, NULL, "mips_jazz.bios", MAGNUM_BIOS_SIZE,
201201
&error_fatal);
202-
memory_region_set_readonly(bios, true);
203202
memory_region_init_alias(bios2, NULL, "mips_jazz.bios", bios,
204203
0, MAGNUM_BIOS_SIZE);
205204
memory_region_add_subregion(address_space, 0x1fc00000LL, bios);
@@ -265,9 +264,8 @@ static void mips_jazz_init(MachineState *machine,
265264
{
266265
/* Simple ROM, so user doesn't have to provide one */
267266
MemoryRegion *rom_mr = g_new(MemoryRegion, 1);
268-
memory_region_init_ram(rom_mr, NULL, "g364fb.rom", 0x80000,
267+
memory_region_init_rom(rom_mr, NULL, "g364fb.rom", 0x80000,
269268
&error_fatal);
270-
memory_region_set_readonly(rom_mr, true);
271269
uint8_t *rom = memory_region_get_ram_ptr(rom_mr);
272270
memory_region_add_subregion(address_space, 0x60000000, rom_mr);
273271
rom[0] = 0x10; /* Mips G364 */

hw/mips/mips_mipssim.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,8 @@ mips_mipssim_init(MachineState *machine)
165165
qemu_register_reset(main_cpu_reset, reset_info);
166166

167167
/* Allocate RAM. */
168-
memory_region_init_ram(bios, NULL, "mips_mipssim.bios", BIOS_SIZE,
168+
memory_region_init_rom(bios, NULL, "mips_mipssim.bios", BIOS_SIZE,
169169
&error_fatal);
170-
memory_region_set_readonly(bios, true);
171170

172171
memory_region_add_subregion(address_space_mem, 0, machine->ram);
173172

hw/mips/mips_r4k.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,8 @@ void mips_r4k_init(MachineState *machine)
237237
dinfo = drive_get(IF_PFLASH, 0, 0);
238238
if ((bios_size > 0) && (bios_size <= BIOS_SIZE)) {
239239
bios = g_new(MemoryRegion, 1);
240-
memory_region_init_ram(bios, NULL, "mips_r4k.bios", BIOS_SIZE,
240+
memory_region_init_rom(bios, NULL, "mips_r4k.bios", BIOS_SIZE,
241241
&error_fatal);
242-
memory_region_set_readonly(bios, true);
243242
memory_region_add_subregion(get_system_memory(), 0x1fc00000, bios);
244243

245244
load_image_targphys(filename, 0x1fc00000, BIOS_SIZE);

0 commit comments

Comments
 (0)