qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 4/4] pcflash: Add pc flash to qemu roms


From: Jordan Justen
Subject: [Qemu-devel] [PATCH 4/4] pcflash: Add pc flash to qemu roms
Date: Mon, 17 Oct 2011 12:16:08 -0700

The pflash image is added to the roms using the memory
region buffer and rom_add_file_buf_fixed.

Signed-off-by: Jordan Justen <address@hidden>
---
 hw/pcflash.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/hw/pcflash.c b/hw/pcflash.c
index eece7ec..e28bdb0 100644
--- a/hw/pcflash.c
+++ b/hw/pcflash.c
@@ -65,6 +65,21 @@ static void pc_isa_bios_init(MemoryRegion *rom_memory,
     memory_region_set_readonly(isa_bios, true);
 }
 
+static void pc_flash_add_qemu_rom(DriveInfo *pflash_drv,
+                                  MemoryRegion *flash_mem)
+{
+    const char *filename;
+    void *data;
+    uint64_t size;
+    uint32_t addr;
+
+    filename = qemu_opt_get(pflash_drv->opts, "file");
+    data = memory_region_get_ram_ptr(flash_mem);
+    size = memory_region_size(flash_mem);
+    addr = (uint32_t) -((int32_t)size);
+    rom_add_file_buf_fixed(filename, data, size, addr, -1);
+}
+
 static void pc_default_system_flash_init(void)
 {
     QemuOpts *opts;
@@ -118,6 +133,7 @@ static void pc_system_flash_init(MemoryRegion *rom_memory,
     flash_mem = pflash_cfi01_get_memory(system_flash);
 
     pc_isa_bios_init(rom_memory, flash_mem, size);
+    pc_flash_add_qemu_rom(pflash_drv, flash_mem);
 }
 
 void pc_system_firmware_init(MemoryRegion *rom_memory)
-- 
1.7.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]