diff mbox

[v3,2/4] rom loader: make vga+rom loading target specific

Message ID 1255945615-2853-3-git-send-email-kraxel@redhat.com
State New
Headers show

Commit Message

Gerd Hoffmann Oct. 19, 2009, 9:46 a.m. UTC
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.target    |    2 +-
 hw/loader-target.c |   34 ++++++++++++++++++++++++++++++++++
 hw/loader.h        |    6 ++----
 3 files changed, 37 insertions(+), 5 deletions(-)
 create mode 100644 hw/loader-target.c
diff mbox

Patch

diff --git a/Makefile.target b/Makefile.target
index 2726487..6054a68 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -154,7 +154,7 @@  endif #CONFIG_BSD_USER
 # System emulator target
 ifdef CONFIG_SOFTMMU
 
-obj-y = vl.o monitor.o pci.o machine.o gdbstub.o
+obj-y = vl.o monitor.o pci.o machine.o gdbstub.o loader-target.o
 # virtio has to be here due to weird dependency between PCI and virtio-net.
 # need to fix this properly
 obj-y += virtio-blk.o virtio-balloon.o virtio-net.o virtio-console.o virtio-pci.o
diff --git a/hw/loader-target.c b/hw/loader-target.c
new file mode 100644
index 0000000..78dbd69
--- /dev/null
+++ b/hw/loader-target.c
@@ -0,0 +1,34 @@ 
+/*
+ * target specific rom code
+ */
+
+#include "hw.h"
+#include "loader.h"
+
+#ifdef TARGET_I386
+
+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);
+}
+
+#else
+
+int rom_add_vga(const char *file)
+{
+    /* nothing */
+    return 0;
+}
+
+int rom_add_option(const char *file)
+{
+    /* nothing */
+    return 0;
+}
+
+#endif
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