i386: remove bios_name

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20201026143028.3034018-6-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2020-10-26 10:30:18 -04:00
parent b57e3e9785
commit 7d435078af
4 changed files with 11 additions and 13 deletions

View File

@ -158,6 +158,7 @@ static int microvm_ioapics(MicrovmMachineState *mms)
static void microvm_devices_init(MicrovmMachineState *mms) static void microvm_devices_init(MicrovmMachineState *mms)
{ {
const char *default_firmware;
X86MachineState *x86ms = X86_MACHINE(mms); X86MachineState *x86ms = X86_MACHINE(mms);
ISABus *isa_bus; ISABus *isa_bus;
ISADevice *rtc_state; ISADevice *rtc_state;
@ -274,12 +275,10 @@ static void microvm_devices_init(MicrovmMachineState *mms)
serial_hds_isa_init(isa_bus, 0, 1); serial_hds_isa_init(isa_bus, 0, 1);
} }
if (bios_name == NULL) { default_firmware = x86_machine_is_acpi_enabled(x86ms)
bios_name = x86_machine_is_acpi_enabled(x86ms)
? MICROVM_BIOS_FILENAME ? MICROVM_BIOS_FILENAME
: MICROVM_QBOOT_FILENAME; : MICROVM_QBOOT_FILENAME;
} x86_bios_rom_init(MACHINE(mms), default_firmware, get_system_memory(), true);
x86_bios_rom_init(get_system_memory(), true);
} }
static void microvm_memory_init(MicrovmMachineState *mms) static void microvm_memory_init(MicrovmMachineState *mms)

View File

@ -213,7 +213,7 @@ void pc_system_firmware_init(PCMachineState *pcms,
BlockBackend *pflash_blk[ARRAY_SIZE(pcms->flash)]; BlockBackend *pflash_blk[ARRAY_SIZE(pcms->flash)];
if (!pcmc->pci_enabled) { if (!pcmc->pci_enabled) {
x86_bios_rom_init(rom_memory, true); x86_bios_rom_init(MACHINE(pcms), "bios.bin", rom_memory, true);
return; return;
} }
@ -234,7 +234,7 @@ void pc_system_firmware_init(PCMachineState *pcms,
if (!pflash_blk[0]) { if (!pflash_blk[0]) {
/* Machine property pflash0 not set, use ROM mode */ /* Machine property pflash0 not set, use ROM mode */
x86_bios_rom_init(rom_memory, false); x86_bios_rom_init(MACHINE(pcms), "bios.bin", rom_memory, false);
} else { } else {
if (kvm_enabled() && !kvm_readonly_mem_enabled()) { if (kvm_enabled() && !kvm_readonly_mem_enabled()) {
/* /*

View File

@ -55,8 +55,6 @@
#include CONFIG_DEVICES #include CONFIG_DEVICES
#include "kvm_i386.h" #include "kvm_i386.h"
#define BIOS_FILENAME "bios.bin"
/* Physical Address of PVH entry point read from kernel ELF NOTE */ /* Physical Address of PVH entry point read from kernel ELF NOTE */
static size_t pvh_start_addr; static size_t pvh_start_addr;
@ -1080,17 +1078,17 @@ void x86_load_linux(X86MachineState *x86ms,
nb_option_roms++; nb_option_roms++;
} }
void x86_bios_rom_init(MemoryRegion *rom_memory, bool isapc_ram_fw) void x86_bios_rom_init(MachineState *ms, const char *default_firmware,
MemoryRegion *rom_memory, bool isapc_ram_fw)
{ {
const char *bios_name;
char *filename; char *filename;
MemoryRegion *bios, *isa_bios; MemoryRegion *bios, *isa_bios;
int bios_size, isa_bios_size; int bios_size, isa_bios_size;
int ret; int ret;
/* BIOS load */ /* BIOS load */
if (bios_name == NULL) { bios_name = ms->firmware ?: default_firmware;
bios_name = BIOS_FILENAME;
}
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
if (filename) { if (filename) {
bios_size = get_image_size(filename); bios_size = get_image_size(filename);

View File

@ -102,7 +102,8 @@ void x86_cpu_unplug_request_cb(HotplugHandler *hotplug_dev,
void x86_cpu_unplug_cb(HotplugHandler *hotplug_dev, void x86_cpu_unplug_cb(HotplugHandler *hotplug_dev,
DeviceState *dev, Error **errp); DeviceState *dev, Error **errp);
void x86_bios_rom_init(MemoryRegion *rom_memory, bool isapc_ram_fw); void x86_bios_rom_init(MachineState *ms, const char *default_firmware,
MemoryRegion *rom_memory, bool isapc_ram_fw);
void x86_load_linux(X86MachineState *x86ms, void x86_load_linux(X86MachineState *x86ms,
FWCfgState *fw_cfg, FWCfgState *fw_cfg,