qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jordan Justen <jordan.l.justen@intel.com>
To: qemu-devel@nongnu.org
Cc: Jordan Justen <jordan.l.justen@intel.com>
Subject: [Qemu-devel] [PATCH 4/4] pcflash: Add pc flash to qemu roms
Date: Mon, 17 Oct 2011 12:16:08 -0700	[thread overview]
Message-ID: <1318878968-18090-4-git-send-email-jordan.l.justen@intel.com> (raw)
In-Reply-To: <1318878968-18090-1-git-send-email-jordan.l.justen@intel.com>

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

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
---
 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

      parent reply	other threads:[~2011-10-17 19:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-17 19:16 [Qemu-devel] [PATCH 1/4] pflash: Support read-only mode Jordan Justen
2011-10-17 19:16 ` [Qemu-devel] [PATCH 2/4] pc: Support system flash memory with pflash Jordan Justen
2011-10-17 19:27   ` Jordan Justen
2011-10-17 19:16 ` [Qemu-devel] [PATCH 3/4] loader: Add rom_add_file_buf for adding roms from a buffer Jordan Justen
2011-10-18 18:05   ` Blue Swirl
2011-10-18 21:17     ` Jordan Justen
2011-10-23 11:27       ` Blue Swirl
2011-10-24 22:19         ` Jordan Justen
2011-10-17 19:16 ` Jordan Justen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1318878968-18090-4-git-send-email-jordan.l.justen@intel.com \
    --to=jordan.l.justen@intel.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).