summaryrefslogtreecommitdiff
path: root/hw/loader.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2010-01-08 15:25:40 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2010-01-11 13:41:00 -0600
commit8832cb805dcb65009b979cd8e17d75ac4b03c7e4 (patch)
tree73af84c03b08927e5e4e8719d8beb212eed2926f /hw/loader.c
parentde9352bcaed2452af1d2b06b829748676c691794 (diff)
downloadqemu-8832cb805dcb65009b979cd8e17d75ac4b03c7e4.zip
roms: rework rom loading via fw
This patch changes the way rom loading via fw_cfg is handled. Instead of having pc_init1() call a function which passed all roms to the firmware config we simply pass a pointer to fw_cfg to the rom loader. Advantage: loading roms via firmware works also for devices which are initialized after pc_init1(), i.e. everyting added via -device. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/loader.c')
-rw-r--r--hw/loader.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/hw/loader.c b/hw/loader.c
index 38ee2daf2a..b3bbd77d1e 100644
--- a/hw/loader.c
+++ b/hw/loader.c
@@ -535,6 +535,7 @@ struct Rom {
QTAILQ_ENTRY(Rom) next;
};
+static FWCfgState *fw_cfg;
static QTAILQ_HEAD(, Rom) roms = QTAILQ_HEAD_INITIALIZER(roms);
int rom_enable_driver_roms;
@@ -592,6 +593,8 @@ int rom_add_file(const char *file, const char *fw_dir,
}
close(fd);
rom_insert(rom);
+ if (rom->fw_file && fw_cfg)
+ fw_cfg_add_file(fw_cfg, rom->fw_dir, rom->fw_file, rom->data, rom->romsize);
return 0;
err:
@@ -681,17 +684,9 @@ int rom_load_all(void)
return 0;
}
-int rom_load_fw(void *fw_cfg)
+void rom_set_fw(void *f)
{
- Rom *rom;
-
- QTAILQ_FOREACH(rom, &roms, next) {
- if (!rom->fw_file) {
- continue;
- }
- fw_cfg_add_file(fw_cfg, rom->fw_dir, rom->fw_file, rom->data, rom->romsize);
- }
- return 0;
+ fw_cfg = f;
}
static Rom *find_rom(target_phys_addr_t addr)