From patchwork Mon Oct 17 19:16:08 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jordan.l.justen@intel.com X-Patchwork-Id: 120290 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 20848B708F for ; Tue, 18 Oct 2011 06:17:27 +1100 (EST) Received: from localhost ([::1]:48384 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RFsge-0003v6-8Y for incoming@patchwork.ozlabs.org; Mon, 17 Oct 2011 15:17:24 -0400 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 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 17 Oct 2011 12:16:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.67,351,1309762800"; d="scan'208";a="64061852" Received: from jljusten-laptop.jf.intel.com ([10.7.202.147]) by orsmga002.jf.intel.com with ESMTP; 17 Oct 2011 12:16:55 -0700 From: Jordan Justen To: qemu-devel@nongnu.org Date: Mon, 17 Oct 2011 12:16:08 -0700 Message-Id: <1318878968-18090-4-git-send-email-jordan.l.justen@intel.com> X-Mailer: git-send-email 1.7.1 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> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 134.134.136.24 Cc: Jordan Justen Subject: [Qemu-devel] [PATCH 4/4] pcflash: Add pc flash to qemu roms X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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)