rom loader: make vga+rom loading configurable.
The rom_add_vga() and rom_add_option() macros are transformed into functions. They look at the new rom_enable_driver_roms variable and only do something if it is set to non-zero, making vga+option rom loading runtime option. pc_init() sets rom_enable_driver_roms to 1. 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> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
14a3f32d9e
commit
de2aff17a3
15
hw/loader.c
15
hw/loader.c
|
@ -534,6 +534,7 @@ struct Rom {
|
||||||
};
|
};
|
||||||
|
|
||||||
static QTAILQ_HEAD(, Rom) roms = QTAILQ_HEAD_INITIALIZER(roms);
|
static QTAILQ_HEAD(, Rom) roms = QTAILQ_HEAD_INITIALIZER(roms);
|
||||||
|
int rom_enable_driver_roms;
|
||||||
|
|
||||||
static void rom_insert(Rom *rom)
|
static void rom_insert(Rom *rom)
|
||||||
{
|
{
|
||||||
|
@ -612,6 +613,20 @@ int rom_add_blob(const char *name, const void *blob, size_t len,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int rom_add_vga(const char *file)
|
||||||
|
{
|
||||||
|
if (!rom_enable_driver_roms)
|
||||||
|
return 0;
|
||||||
|
return rom_add_file(file, PC_ROM_MIN_VGA, PC_ROM_MAX, PC_ROM_ALIGN);
|
||||||
|
}
|
||||||
|
|
||||||
|
int rom_add_option(const char *file)
|
||||||
|
{
|
||||||
|
if (!rom_enable_driver_roms)
|
||||||
|
return 0;
|
||||||
|
return rom_add_file(file, PC_ROM_MIN_OPTION, PC_ROM_MAX, PC_ROM_ALIGN);
|
||||||
|
}
|
||||||
|
|
||||||
static void rom_reset(void *unused)
|
static void rom_reset(void *unused)
|
||||||
{
|
{
|
||||||
Rom *rom;
|
Rom *rom;
|
||||||
|
|
|
@ -38,9 +38,8 @@ void do_info_roms(Monitor *mon);
|
||||||
#define PC_ROM_ALIGN 0x800
|
#define PC_ROM_ALIGN 0x800
|
||||||
#define PC_ROM_SIZE (PC_ROM_MAX - PC_ROM_MIN_VGA)
|
#define PC_ROM_SIZE (PC_ROM_MAX - PC_ROM_MIN_VGA)
|
||||||
|
|
||||||
#define rom_add_vga(_f) \
|
extern int rom_enable_driver_roms;
|
||||||
rom_add_file(_f, PC_ROM_MIN_VGA, PC_ROM_MAX, PC_ROM_ALIGN)
|
int rom_add_vga(const char *file);
|
||||||
#define rom_add_option(_f) \
|
int rom_add_option(const char *file);
|
||||||
rom_add_file(_f, PC_ROM_MIN_OPTION, PC_ROM_MAX, PC_ROM_ALIGN)
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
1
hw/pc.c
1
hw/pc.c
|
@ -1137,6 +1137,7 @@ static void pc_init1(ram_addr_t ram_size,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
rom_enable_driver_roms = 1;
|
||||||
option_rom_offset = qemu_ram_alloc(PC_ROM_SIZE);
|
option_rom_offset = qemu_ram_alloc(PC_ROM_SIZE);
|
||||||
cpu_register_physical_memory(PC_ROM_MIN_VGA, PC_ROM_SIZE, option_rom_offset);
|
cpu_register_physical_memory(PC_ROM_MIN_VGA, PC_ROM_SIZE, option_rom_offset);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue