From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH v4 2/4] rom loader: make vga+rom loading configurable.
Date: Mon, 26 Oct 2009 12:18:25 +0100 [thread overview]
Message-ID: <1256555907-21505-3-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1256555907-21505-1-git-send-email-kraxel@redhat.com>
The rom_add_vga() and rom_add_option() macros are transformed into
functions. They look at the new rom_enable_driver_roms variable
and only do something if it is set to non-zero, making vga+option rom
loading runtime option. pc_init() sets rom_enable_driver_roms to 1.
With this in place we can move the rom loading calls from pc.c to the
individual drivers.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/loader.c | 15 +++++++++++++++
hw/loader.h | 7 +++----
hw/pc.c | 1 +
3 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/hw/loader.c b/hw/loader.c
index 6baafa8..a08585b 100644
--- a/hw/loader.c
+++ b/hw/loader.c
@@ -534,6 +534,7 @@ struct Rom {
};
static QTAILQ_HEAD(, Rom) roms = QTAILQ_HEAD_INITIALIZER(roms);
+int rom_enable_driver_roms;
static void rom_insert(Rom *rom)
{
@@ -612,6 +613,20 @@ int rom_add_blob(const char *name, const void *blob, size_t len,
return 0;
}
+int rom_add_vga(const char *file)
+{
+ if (!rom_enable_driver_roms)
+ return 0;
+ return rom_add_file(file, PC_ROM_MIN_VGA, PC_ROM_MAX, PC_ROM_ALIGN);
+}
+
+int rom_add_option(const char *file)
+{
+ if (!rom_enable_driver_roms)
+ return 0;
+ return rom_add_file(file, PC_ROM_MIN_OPTION, PC_ROM_MAX, PC_ROM_ALIGN);
+}
+
static void rom_reset(void *unused)
{
Rom *rom;
diff --git a/hw/loader.h b/hw/loader.h
index 945c662..67dae57 100644
--- a/hw/loader.h
+++ b/hw/loader.h
@@ -38,9 +38,8 @@ void do_info_roms(Monitor *mon);
#define PC_ROM_ALIGN 0x800
#define PC_ROM_SIZE (PC_ROM_MAX - PC_ROM_MIN_VGA)
-#define rom_add_vga(_f) \
- rom_add_file(_f, PC_ROM_MIN_VGA, PC_ROM_MAX, PC_ROM_ALIGN)
-#define rom_add_option(_f) \
- rom_add_file(_f, PC_ROM_MIN_OPTION, PC_ROM_MAX, PC_ROM_ALIGN)
+extern int rom_enable_driver_roms;
+int rom_add_vga(const char *file);
+int rom_add_option(const char *file);
#endif
diff --git a/hw/pc.c b/hw/pc.c
index 408d6d6..09d60ed 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1137,6 +1137,7 @@ static void pc_init1(ram_addr_t ram_size,
+ rom_enable_driver_roms = 1;
option_rom_offset = qemu_ram_alloc(PC_ROM_SIZE);
cpu_register_physical_memory(PC_ROM_MIN_VGA, PC_ROM_SIZE, option_rom_offset);
--
1.6.2.5
next prev parent reply other threads:[~2009-10-26 11:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-26 11:18 [Qemu-devel] [PATCH v4 0/4] more rom loader patches Gerd Hoffmann
2009-10-26 11:18 ` [Qemu-devel] [PATCH v4 1/4] rom loader: use qemu_strdup Gerd Hoffmann
2009-10-26 11:18 ` Gerd Hoffmann [this message]
2009-10-26 11:18 ` [Qemu-devel] [PATCH v4 3/4] vga roms: move loading from pc.c to vga drivers Gerd Hoffmann
2009-10-26 11:18 ` [Qemu-devel] [PATCH v4 4/4] use rom loader for pc bios Gerd Hoffmann
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=1256555907-21505-3-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.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).