From 8832cb805dcb65009b979cd8e17d75ac4b03c7e4 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Fri, 8 Jan 2010 15:25:40 +0100 Subject: 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 Signed-off-by: Anthony Liguori --- hw/loader.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'hw/loader.c') 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) -- cgit v1.2.3