@@ -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
new file mode 100644
@@ -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;
+}
new file mode 100644
@@ -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);
+}
@@ -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
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