qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC PATCH v2 3/5] replace rom_add_file* with image_file_re


From: Olivia Yin
Subject: [Qemu-devel] [RFC PATCH v2 3/5] replace rom_add_file* with image_file_reset
Date: Mon, 29 Oct 2012 13:21:34 +0800

Signed-off-by: Olivia Yin <address@hidden>
---
 hw/cirrus_vga.c |    6 +++++-
 hw/pc.c         |    6 +++++-
 hw/pc_sysfw.c   |   14 +++++++-------
 hw/pci.c        |   10 ++++++++--
 hw/sga.c        |    6 +++++-
 hw/vga-isa.c    |    6 +++++-
 6 files changed, 35 insertions(+), 13 deletions(-)

diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c
index e4af2e9..8b2c974 100644
--- a/hw/cirrus_vga.c
+++ b/hw/cirrus_vga.c
@@ -2906,7 +2906,11 @@ static int vga_initfn(ISADevice *dev)
     s->ds = graphic_console_init(s->update, s->invalidate,
                                  s->screen_dump, s->text_update,
                                  s);
-    rom_add_vga(VGABIOS_CIRRUS_FILENAME);
+    ImageFile *image;
+    image = g_malloc(sizeof(*image));
+    image->name = g_strdup(VGABIOS_CIRRUS_FILENAME);
+    image->addr = 0;
+    qemu_register_reset(image_file_reset, image);
     /* XXX ISA-LFB support */
     /* FIXME not qdev yet */
     return 0;
diff --git a/hw/pc.c b/hw/pc.c
index 16de04c..aa4ccba 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -977,7 +977,11 @@ void *pc_memory_init(MemoryRegion *system_memory,
     }
 
     for (i = 0; i < nb_option_roms; i++) {
-        rom_add_option(option_rom[i].name, option_rom[i].bootindex);
+        ImageFile *image;
+        image = g_malloc(sizeof(*image));
+        image->name = g_strdup(option_rom[i].name);
+        image->addr = 0;
+        qemu_register_reset(image_file_reset, image);
     }
     return fw_cfg;
 }
diff --git a/hw/pc_sysfw.c b/hw/pc_sysfw.c
index 9d7c5f4..06e606b 100644
--- a/hw/pc_sysfw.c
+++ b/hw/pc_sysfw.c
@@ -151,18 +151,18 @@ static void old_pc_system_rom_init(MemoryRegion 
*rom_memory)
     }
     if (bios_size <= 0 ||
         (bios_size % 65536) != 0) {
-        goto bios_error;
+        fprintf(stderr, "qemu: could not load PC BIOS '%s'\n", bios_name);
+        exit(1);
     }
     bios = g_malloc(sizeof(*bios));
     memory_region_init_ram(bios, "pc.bios", bios_size);
     vmstate_register_ram_global(bios);
     memory_region_set_readonly(bios, true);
-    ret = rom_add_file_fixed(bios_name, (uint32_t)(-bios_size), -1);
-    if (ret != 0) {
-    bios_error:
-        fprintf(stderr, "qemu: could not load PC BIOS '%s'\n", bios_name);
-        exit(1);
-    }
+    ImageFile *image;
+    image = g_malloc(sizeof(*image));
+    image->name = g_strdup(filename);
+    image->addr = (uint32_t)(-bios_size);
+    qemu_register_reset(image_file_reset, image);
     if (filename) {
         g_free(filename);
     }
diff --git a/hw/pci.c b/hw/pci.c
index d44fd0e..7efc41a 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -34,6 +34,7 @@
 #include "msi.h"
 #include "msix.h"
 #include "exec-memory.h"
+#include "loader.h"
 
 //#define DEBUG_PCI
 #ifdef DEBUG_PCI
@@ -1792,12 +1793,17 @@ static int pci_add_option_rom(PCIDevice *pdev, bool 
is_default_rom)
          * Load rom via fw_cfg instead of creating a rom bar,
          * for 0.11 compatibility.
          */
+        ImageFile *image;
+        image = g_malloc(sizeof(*image));
+        image->name = g_strdup(pdev->romfile);
+        image->addr = 0;
         int class = pci_get_word(pdev->config + PCI_CLASS_DEVICE);
         if (class == 0x0300) {
-            rom_add_vga(pdev->romfile);
+            image->dir = g_strdup("vgaroms");
         } else {
-            rom_add_option(pdev->romfile, -1);
+            image->dir = g_strdup("genroms");
         }
+        qemu_register_reset(image_file_reset, image);
         return 0;
     }
 
diff --git a/hw/sga.c b/hw/sga.c
index a666349..25c002a 100644
--- a/hw/sga.c
+++ b/hw/sga.c
@@ -37,7 +37,11 @@ typedef struct ISAGAState {
 
 static int sga_initfn(ISADevice *dev)
 {
-    rom_add_vga(SGABIOS_FILENAME);
+    ImageFile *image;
+    image = g_malloc(sizeof(*image));
+    image->name = g_strdup(SGABIOS_FILENAME);
+    image->addr = 0;
+    qemu_register_reset(image_file_reset, image);
     return 0;
 }
 static void sga_class_initfn(ObjectClass *klass, void *data)
diff --git a/hw/vga-isa.c b/hw/vga-isa.c
index 046602b..e9c90e8 100644
--- a/hw/vga-isa.c
+++ b/hw/vga-isa.c
@@ -67,7 +67,11 @@ static int vga_initfn(ISADevice *dev)
 
     vga_init_vbe(s, isa_address_space(dev));
     /* ROM BIOS */
-    rom_add_vga(VGABIOS_FILENAME);
+    ImageFile *image;
+    image = g_malloc(sizeof(*image));
+    image->name = g_strdup(VGABIOS_FILENAME);
+    image->addr = 0;
+    qemu_register_reset(image_file_reset, image);
     return 0;
 }
 
-- 
1.7.1





reply via email to

[Prev in Thread] Current Thread [Next in Thread]