Message ID | 1539064514-2606-1-git-send-email-liq3ea@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | i386: pc_sysfw: load bios using rom API | expand |
On 09/10/2018 07:55, Li Qiang wrote: > As the bios is a ROM, just using rom API. > AFAICS no functionality changed. > > Signed-off-by: Li Qiang <liq3ea@gmail.com> > --- ROM and RAM are just the same, with the readonly flag defaulting to either true or false. Because the alias here: memory_region_init_alias(isa_bios, NULL, "isa-bios", bios, bios_size - isa_bios_size, isa_bios_size); if (!isapc_ram_fw) { memory_region_set_readonly(isa_bios, true); } defaults to read-write (and your patch is wrong in changing the direction of the if), it makes sense to do the same for the bios memory region. Thanks, Paolo
diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c index 091e22dd60..7f469fd582 100644 --- a/hw/i386/pc_sysfw.c +++ b/hw/i386/pc_sysfw.c @@ -209,9 +209,9 @@ static void old_pc_system_rom_init(MemoryRegion *rom_memory, bool isapc_ram_fw) goto bios_error; } bios = g_malloc(sizeof(*bios)); - memory_region_init_ram(bios, NULL, "pc.bios", bios_size, &error_fatal); - if (!isapc_ram_fw) { - memory_region_set_readonly(bios, true); + memory_region_init_rom(bios, NULL, "pc.bios", bios_size, &error_fatal); + if (isapc_ram_fw) { + memory_region_set_readonly(bios, false); } ret = rom_add_file_fixed(bios_name, (uint32_t)(-bios_size), -1); if (ret != 0) { @@ -230,8 +230,8 @@ static void old_pc_system_rom_init(MemoryRegion *rom_memory, bool isapc_ram_fw) 0x100000 - isa_bios_size, isa_bios, 1); - if (!isapc_ram_fw) { - memory_region_set_readonly(isa_bios, true); + if (isapc_ram_fw) { + memory_region_set_readonly(isa_bios, false); } /* map all the bios at the top of memory */
As the bios is a ROM, just using rom API. AFAICS no functionality changed. Signed-off-by: Li Qiang <liq3ea@gmail.com> --- hw/i386/pc_sysfw.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)