qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 2/4] rom loader: make vga+rom loading target specific
Date: Fri, 16 Oct 2009 16:04:09 +0200	[thread overview]
Message-ID: <1255701851-11147-3-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1255701851-11147-1-git-send-email-kraxel@redhat.com>

This patch adds a loader-target.c file for target-specific
rom loading functions.  The rom_add_vga() and rom_add_option()
macros are transformed into functions and sticked in there.  They
load the bios on TARGET_I386 and no nothing on other targets.

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>
---
 Makefile.hw       |    7 +++++++
 hw/loader-dummy.c |   18 ++++++++++++++++++
 hw/loader-i386.c  |   16 ++++++++++++++++
 hw/loader.h       |    6 ++----
 4 files changed, 43 insertions(+), 4 deletions(-)
 create mode 100644 hw/loader-dummy.c
 create mode 100644 hw/loader-i386.c

diff --git a/Makefile.hw b/Makefile.hw
index f4b4469..7da6775 100644
--- a/Makefile.hw
+++ b/Makefile.hw
@@ -12,7 +12,14 @@ VPATH=$(SRC_PATH):$(SRC_PATH)/hw
 QEMU_CFLAGS+=-I.. -I$(SRC_PATH)/fpu
 
 obj-y =
+
 obj-y += loader.o
+ifdef TARGET_I386
+obj-y += loader-i386.o
+else
+obj-y += loader-dummy.o
+endif
+
 obj-y += virtio.o
 obj-y += fw_cfg.o
 obj-y += watchdog.o
diff --git a/hw/loader-dummy.c b/hw/loader-dummy.c
new file mode 100644
index 0000000..31e12ce
--- /dev/null
+++ b/hw/loader-dummy.c
@@ -0,0 +1,18 @@
+/*
+ * target specific rom code -- dummy
+ */
+
+#include "hw.h"
+#include "loader.h"
+
+int rom_add_vga(const char *file)
+{
+    /* nothing */
+    return 0;
+}
+
+int rom_add_option(const char *file)
+{
+    /* nothing */
+    return 0;
+}
diff --git a/hw/loader-i386.c b/hw/loader-i386.c
new file mode 100644
index 0000000..06eaf4d
--- /dev/null
+++ b/hw/loader-i386.c
@@ -0,0 +1,16 @@
+/*
+ * target specific rom code -- i386
+ */
+
+#include "hw.h"
+#include "loader.h"
+
+int rom_add_vga(const char *file)
+{
+    return rom_add_file(file, PC_ROM_MIN_VGA, PC_ROM_MAX, PC_ROM_ALIGN);
+}
+
+int rom_add_option(const char *file)
+{
+    return rom_add_file(file, PC_ROM_MIN_OPTION, PC_ROM_MAX, PC_ROM_ALIGN);
+}
diff --git a/hw/loader.h b/hw/loader.h
index 945c662..d013253 100644
--- a/hw/loader.h
+++ b/hw/loader.h
@@ -38,9 +38,7 @@ 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)
+int rom_add_vga(const char *file);
+int rom_add_option(const char *file);
 
 #endif
-- 
1.6.2.5

  parent reply	other threads:[~2009-10-16 14:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-16 14:04 [Qemu-devel] [PATCH v2 0/4] more rom loader patches Gerd Hoffmann
2009-10-16 14:04 ` [Qemu-devel] [PATCH 1/4] rom loader: use qemu_strdup Gerd Hoffmann
2009-10-16 14:04 ` Gerd Hoffmann [this message]
2009-10-17  9:23   ` [Qemu-devel] Re: [PATCH 2/4] rom loader: make vga+rom loading target specific Juan Quintela
2009-10-19  7:58     ` Gerd Hoffmann
2009-10-16 14:04 ` [Qemu-devel] [PATCH 3/4] vga roms: move loading from pc.c to vga drivers Gerd Hoffmann
2009-10-16 14:04 ` [Qemu-devel] [PATCH 4/4] use rom loader for pc bios Gerd Hoffmann
  -- strict thread matches above, loose matches on Subject: below --
2009-10-13 11:06 [Qemu-devel] [PATCH 0/4] more rom loader patches Gerd Hoffmann
2009-10-13 11:06 ` [Qemu-devel] [PATCH 2/4] rom loader: make vga+rom loading target specific Gerd Hoffmann
2009-10-13 14:58   ` Blue Swirl
2009-10-13 15:29     ` Gerd Hoffmann
2009-10-13 16:45       ` Blue Swirl
2009-10-14  7:28         ` Gerd Hoffmann
2009-10-13 22:03     ` Natalia Portillo
2009-10-14 10:21       ` Gerd Hoffmann
2009-10-14 12:37         ` Natalia Portillo

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=1255701851-11147-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).