From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:33938) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RFsgC-0002PD-RP for qemu-devel@nongnu.org; Mon, 17 Oct 2011 15:16:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RFsgB-0006Ro-JP for qemu-devel@nongnu.org; Mon, 17 Oct 2011 15:16:56 -0400 Received: from mga09.intel.com ([134.134.136.24]:62638) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RFsgB-0006RC-D5 for qemu-devel@nongnu.org; Mon, 17 Oct 2011 15:16:55 -0400 From: Jordan Justen Date: Mon, 17 Oct 2011 12:16:08 -0700 Message-Id: <1318878968-18090-4-git-send-email-jordan.l.justen@intel.com> In-Reply-To: <1318878968-18090-1-git-send-email-jordan.l.justen@intel.com> References: <1318878968-18090-1-git-send-email-jordan.l.justen@intel.com> Subject: [Qemu-devel] [PATCH 4/4] pcflash: Add pc flash to qemu roms List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Jordan Justen The pflash image is added to the roms using the memory region buffer and rom_add_file_buf_fixed. Signed-off-by: Jordan Justen --- 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